function Scrollbar(e,t){this._wrapper="string"==typeof t.el?document.querySelector(t.el):t.el,this._sb=this._wrapper.children[0],this._sbStyle=this._sb.style,this.scroller=e,this.model={listenX:!0,listenY:!0,enableInteraction:!1,enableResize:!0,enableShrink:!1,enableFade:!1,speedRatioX:0,disableTouch:!1,speedRatioY:0,ignoreBoundaries:!1};for(var i in t)this.model[i]=t[i];this._sizeRatioX=1,this._sizeRatioY=1,this._maxPosX=0,this._maxPosY=0,this.model.enableFade&&(this._sbStyle[ej.transform]=this.scroller.model.translateZ,this._sbStyle[ej.transitionDuration]=ej.isLowerAndroid()?"0.001s":"0ms",this._sbStyle.opacity="0"),this._createDelegates(),this._wireEvents()}var LookupCachingMode,FormulaInfoSetAction,__extends,ej,_sideBySeriesPadding,eAnimation;window.ej=window.Syncfusion=window.Syncfusion||{},function(e,t,i){"use strict";var s,a,n,o;t.version="14.1.0.41",t.consts={NamespaceJoin:"-"},t.TextAlign={Center:"center",Justify:"justify",Left:"left",Right:"right"},t.Orientation={Horizontal:"horizontal",Vertical:"vertical"},t.serverTimezoneOffset=0,Object.prototype.hasOwnProperty||(Object.prototype.hasOwnProperty=function(e,t){return e[t]!==i}),String.format=function(){for(var e=arguments[0],t=0;t"),a=e("head").find("link").add("style"),"msie"===t.browserInfo().name?(n="",a.each(function(t,i){"LINK"==i.tagName&&e(i).attr("href",i.href),n+=i.outerHTML}),s.document.write(""+n+o[0].innerHTML+"")):(n="",s.document.write(""),a.each(function(t,i){"LINK"==i.tagName&&e(i).attr("href",i.href),n+=i.outerHTML}),s.document.writeln(n+""),s.document.writeln(o[0].innerHTML+"")),s.document.close(),s.focus(),setTimeout(function(){t.isNullOrUndefined(s.window)||(s.print(),setTimeout(function(){s.close()},1e3))},1e3)},ieClearRemover:function(t){var i=e(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){e.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,s,a,n){var o,r=/^[a-z]*[0-9a-z]+/gi.exec(t)[0],l=/#([a-z]+[-_0-9a-z]+)/gi.exec(t);return l=l?l[l.length-1]:i,o=/\.([a-z]+[-_0-9a-z ]+)/gi.exec(t),o=o?o[o.length-1]:i,e(document.createElement(r)).attr(l?{id:l}:{}).addClass(o||"").css(a||{}).attr(n||{}).html(s||"")},_preventDefaultException:function(e,t){if(e)for(var i in t)if(t[i].test(e[i]))return!0;return!1},getMaxZindex:function(){var t=1;return t=Math.max.apply(null,e.map(e("body *"),function(t){if("absolute"==e(t).css("position")||"fixed"==e(t).css("position"))return parseInt(e(t).css("z-index"))||1})),(t==i||null==t)&&(t=1),t},blockDefaultActions:function(e){e.cancelBubble=!0,e.returnValue=!1,e.preventDefault&&e.preventDefault(),e.stopPropagation&&e.stopPropagation()},getDimension:function(t,i){var s,a,n,o=e(t).parents().andSelf().filter(":hidden");return o&&(a={visibility:"hidden",display:"block"},n=[],o.each(function(){var e={};for(var t in a)e[t]=this.style[t],this.style[t]=a[t];n.push(e)}),s=/(outer)/g.test(i)?e(t)[i](!0):e(t)[i](),o.each(function(e){var t=n[e];for(var i in a)this.style[i]=t[i]})),s},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()||e.support.hasPointer?"touchstart":"mousedown"},endEvent:function(){return t.isTouchDevice()||e.support.hasPointer?"touchend":"mouseup"},moveEvent:function(){return t.isTouchDevice()||e.support.hasPointer?e.support.hasPointer&&!t.isMobile()?"ejtouchmove":"touchmove":"mousemove"},cancelEvent:function(){return t.isTouchDevice()||e.support.hasPointer?"touchcancel":"mousecancel"},tapEvent:function(){return t.isTouchDevice()||e.support.hasPointer?"tap":"click"},tapHoldEvent:function(){return t.isTouchDevice()||e.support.hasPointer?"taphold":"click"},isDevice:function(){return t.getBooleanVal(e("head"),"data-ej-forceset",!1)?t.getBooleanVal(e("head"),"data-ej-device",this._device()):this._device()},isWindowsWebView:function(){return location.href.indexOf("x-wmapp")!=-1},_device:function(){return/mobile|tablet|android|kindle/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(e("head"),"data-ej-mobile",!1)===!0},isTablet:function(){return/ipad|xoom|sch-i800|playbook|tablet|kindle/i.test(navigator.userAgent.toLowerCase())||t.getBooleanVal(e("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 e.trim(t.replace(/\s+/g," ").replace(/(\r\n|\n|\r)/gm,"").replace(new RegExp(">[\n\t ]+<","g"),"><"))},getBooleanVal:function(t,i,s){var a=e(t).attr(i);return null!=a?"true"==a.toLowerCase():s},_getSkewClass:function(e,t,i){var s=e.width(),a=e.height(),n=e.offset().left,o=e.offset().left+s,r=e.offset().top,l=e.offset().top+a,d=.3*s,h=.3*a;return to-d&&io-d&&i>l-h?"e-m-skew-bottomright":tl-h?"e-m-skew-bottomleft":t>n+d&&io-d?"e-m-skew-right":i>l-h?"e-m-skew-bottom":"e-m-skew-center"},_removeSkewClass:function(t){e(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")},_touchStartPoints:function(e,t){if(e){var i=e.touches?e.touches[0]:e;t._distX=0,t._distY=0,t._moved=!1,t._pointX=i.pageX,t._pointY=i.pageY}},_isTouchMoved:function(e,t){if(e){var i,s,a=e.touches?e.touches[0]:e,n=a.pageX-t._pointX,o=a.pageY-t._pointY;Date.now();return t._pointX=a.pageX,t._pointY=a.pageY,t._distX+=n,t._distY+=o,i=Math.abs(t._distX),s=Math.abs(t._distY),!(i<5&&s<5)}},listenEvents:function(e,i,s,a,n,o){for(var r=0;r0)return a=i.parents(),n=e("body").children(),!t.isNullOrUndefined(i)&&i.length>0&&n.splice(n.index(s),1),e(n).each(function(e,t){a.push(t)}),o=Math.max.apply(o,e.map(a,function(t){if("static"!=e(t).css("position"))return parseInt(e(t).css("z-index"))||1})),!o||o<1e4?o=1e4:o+=1,o}},e.extend(t,t.util),t.widgetBase={droppables:{default:[]},resizables:{default:[]},_renderEjTemplate:function(i,s,a,n){var o=null;return("object"==typeof i||i.startsWith("#")||i.startsWith("."))&&(o=e(i).attr("type")),o&&(o=o.toLowerCase(),t.template[o])?t.template[o](this,i,s,a,n):t.template.render(this,i,s,a,n)},destroy:function(){var i,s,a,n;if(!this._trigger("destroy")){this.model.enablePersistence&&(this.persistState(),e(window).off("unload",this._persistHandler));try{this._destroy()}catch(e){}for(i=this.element.data("ejWidgets")||[],n=0;n-1){e.fn.off.apply(t,a?[i,s,r[3]]:[i,s]),d.splice(o,1);break}return this},_trigger:function(i,s){var a,n,o,r=null,l={};return e.extend(l,s),i in this.model&&(r=this.model[i]),r&&("string"==typeof r&&(r=t.util.getObject(r,window)),e.isFunction(r)&&(n=t.event(i,this.model,s),a=r.call(this,n),s&&e.extend(s,n),n.cancel||!t.isNullOrUndefined(a)))?a===!1||n.cancel:(o=Boolean(s),s=s||{},s.originalEventType=i,s.type=this.pluginName+i,n=e.Event(s.type,t.event(s.type,this.model,s)),this.element.trigger(n),o&&e.extend(s,n),t.isOnWebForms&&0==n.cancel&&this.model.serverEvents&&this.model.serverEvents.length&&t.raiseWebFormsServerEvents(i,s,l),n.cancel)},setModel:function(t,i){var a,n,o,r;if(!this._trigger("modelChange",{changes:t})){for(a in t){if(!i){if(this.model[a]===t[a]){delete t[a];continue}if(e.isPlainObject(t[a])&&(s(this.model[a],t[a]),e.isEmptyObject(t[a]))){delete t[a];continue}}if(this.dataTypes&&(n=this._isValidModelValue(a,this.dataTypes,t),n!==!0))throw"setModel - Invalid input for property :"+a+" - "+n;this.model.notifyOnEachPropertyChanges&&this.model[a]!==t[a]&&(o={oldValue:this.model[a],newValue:t[a]},t[a]=this._trigger(a+"Change",o)?this.model[a]:o.newValue)}e.isEmptyObject(t)||(this._setFirst?(r=t.dataSource,r&&delete t.dataSource,e.extend(!0,this.model,t),r&&(this.model.dataSource=r instanceof Array?r.slice():r,t.dataSource=this.model.dataSource),this._setModel&&this._setModel(t)):this._setModel&&this._setModel(t)===!1||e.extend(!0,this.model,t),"enablePersistence"in t&&this._setState(t.enablePersistence))}},option:function(s,a,n){if(!s)return this.model;if(e.isPlainObject(s))return this.setModel(s);if("string"==typeof s){s=s.replace(/^model\./,"");var o=t.getObject(s,this.model);if(a===i)return o;if("enablePersistence"===s)return this._setState(a);if(n&&a===t.extensions.modelGUID)return this._setModel(t.createObject(s,t.getObject(s,this.model),{}));if(n||t.getObject(s,this.model)!==a)return this.setModel(t.createObject(s,a,{}),n)}return i},_isValidModelValue:function(e,t,i){var s,a,n,o=t[e],r=i[e];if(!o)return!0;if("string"==typeof o){if("enum"==o&&(i[e]=r?r.toString().toLowerCase():r,o="string"),"array"===o){if("[object Array]"===Object.prototype.toString.call(r))return!0}else if("data"===o||"parent"===o||typeof r===o)return!0;return"Expected type - "+o}if(r instanceof Array){for(a=0;a"),a=t.preferredCulture(a)?a:"en-US",n=i,o=i.split("{0:"),d=i.split("}"),r=o[0],l=d[1],"string"==typeof s&&e.isNumeric(s)&&(s=Number(s)),i.indexOf("{0:")!=-1)return h=new RegExp("\\{0(:([^\\}]+))?\\}","gm"),c=h.exec(i),null!=c&&null!=s?null!=r&&null!=l?r+t.format(s,c[2],a)+l:t.format(s,c[2],a):null!=s?s:"";if(n.startsWith("{")&&!n.startsWith("{0:")){var p=n.split(""),s=(s||"")+"",g=s.split(""),_=/[0aA\*CN<>\?]/gm;for(u=0,m=0;u0&&e.isPlainObject(c)&&(a=t.copyObject({},c)),_){if(a)if(l=[].slice.call(arguments,1),this.length>0&&l[0]&&"option"===c&&e.isPlainObject(l[0])&&(l[0]=t.copyObject({},l[0])),e.isPlainObject(a))g.setModel(a);else if(0!==a.indexOf("_")&&!t.isNullOrUndefined(f=t.getObject(a,g))||0===a.indexOf("model.")){if(!f||!e.isFunction(f)){if(1==arguments.length)return f;g.option(a,arguments[1]);continue}if(r=f.apply(g,l),r!==i)return r}else o(n+": function/property - "+a+" does not exist")}else d.prototype._requiresID!==!0||this[u].id||p.attr("id",h("ejControl_")),a&&"object"!=typeof a?o(s+": methods/properties can be accessed only after plugin creation"):new d(p,a)}return s.indexOf("ejm")!=-1&&t.widget.registerInstance(p,s,n,d.prototype),this},t.widget.register(s,n,d.prototype);else{d=n;for(c in s)u=s[c],u instanceof Array&&(d._rootCSS=u[1],u=u[0]),t.widget(c,u,d),s[c]instanceof Array&&(d._rootCSS="")}},e.extend(t.widget,function(){var e={},i=[],s=function(i,s,a){t.isNullOrUndefined(e[i])||o("ej.widget : The widget named "+i+" is trying to register twice."),e[i]={name:i,className:s,proto:a},t.widget.extensions&&t.widget.extensions.registerWidget(i)},a=function(e,t,s,a){i.push({element:e,pluginName:t,className:s,proto:a})};return{register:s,registerInstance:a,registeredWidgets:e,registeredInstances:i}}()),t.widget.destroyAll=function(e){var t,i,s,a;if(e&&e.length)for(t=0;t1?t[1]:i},set:function(e,t,i){"object"==typeof t&&(t=JSON.stringify(t)),t=escape(t)+(null==i?"":"; expires="+i.toUTCString()),document.cookie=e+"="+t}},a={getActionFromCode:function(e,t,i,s,n){var o,r,l;i=i||!1,s=s||!1,n=n||!1;for(o in e)if("focus"!==o)for(r=a.getKeyObject(e[o]),l=0;l9&&window.navigator.msPointerEnabled,o},t.eventType={mouseDown:"mousedown touchstart",mouseMove:"mousemove touchmove",mouseUp:"mouseup touchend",mouseLeave:"mouseleave touchcancel",click:"click touchend"},t.event=function(t,i,s){return e.extend(s||{},{type:t,model:i,cancel:!1})},t.proxy=function(e,t,i){return e&&"function"==typeof e?"bind"in e&&t?i?e.bind(t,i):e.bind(t):function(){var s=i?[i]:[];return s.push.apply(s,arguments),e.apply(t||this,s)}:null},t.hasStyle=function(e){var t,i,s=document.documentElement.style;if(e in s)return!0;for(t=["ms","Moz","Webkit","O","Khtml"],e=e[0].toUpperCase()+e.slice(1),i=0;i",i,""].join(""));var o={prop:n,index:a};return e(i).render(s,o)},t.isPlainObject=function(e){if(!e||"object"!=typeof e||e.nodeType||jQuery.isWindow(e))return!1;try{if(e.constructor&&!e.constructor.prototype.hasOwnProperty("isPrototypeOf"))return!1}catch(e){return!1}var s,a=t.support.isOwnLast;for(s in e)if(a)break;return s===i||e.hasOwnProperty(s)},n=!1,t.util.valueFunction=function(e){return function(s,a){var o=t.getObject(e,this.model);return n===!1&&(n=t.getObject("observables.getValue",t.widget)),s===i?t.isNullOrUndefined(n)?"function"==typeof o?o.call(this):o:n(o,a):void("function"==typeof o?(this["ob.values"][e]=s,o.call(this,s)):t.createObject(e,s,this.model))}},t.util.getVal=function(e){return"function"==typeof e?e():e},t.support={isOwnLast:function(){var e,t=function(){this.a=1};t.prototype.b=1;for(e in new t)return"b"===e}(),outerHTML:function(){return document.createElement("div").outerHTML!==i}()},o=t.throwError=function(e){try{throw new Error(e)}catch(e){throw e.message+"\n"+e.stack}},t.getRandomValue=function(e,s){var a,n;return e===i||s===i?t.throwError("Min and Max values are required for generating a random number"):("crypto"in window&&"getRandomValues"in crypto?(n=new Uint16Array(1),window.crypto.getRandomValues(n),a=n[0]%(s-e)+e):a=Math.random()*(s-e)+e,0|a)},t.extensions={},t.extensions.modelGUID="{0B1051BA-1CCB-42C2-A3B5-635389B92A50}"}(window.jQuery,window.Syncfusion),function(){$.fn.addEleAttrs=function(e){var t=$(this);$.each(e,function(e,i){i&&i.specified&&t.attr(i.name,i.value)})},$.fn.removeEleAttrs=function(e){return this.each(function(){var t=$(this),i=$(this.attributes).clone();$.each(i,function(i,s){s&&s.specified&&e.test(s.name)&&t.removeAttr(s.name)})})},$.fn.attrNotStartsWith=function(e){var t,s=[];for(this.each(function(){t=$(this.attributes).clone()}),i=0;ii&&a.push(o);for(e=a,o=0;othis.pageSize;)h.results.splice(0,1),h.keys.splice(0,1);return window.localStorage.setItem(this.guidId,JSON.stringify(h)),i},update:function(e,t,i,s){return this._crudAction=!0,this.cacheAdaptor.update(e,t,i,s)},insert:function(e,t,i){return this._insertAction=!0,this.cacheAdaptor.insert(e,t,i)},remove:function(e,t,i,s){return this._crudAction=!0,this.cacheAdaptor.remove(e,t,i,s)},batchRequest:function(e,t,i){return this.cacheAdaptor.batchRequest(e,t,i)}});var p=function(e,t){return e.filter(function(e){return e.fn===t})||[]},g=function(e,t){for(var i=e.filter(function(e){return t.indexOf(e.fn)!==-1}),s={},a=0;a-1;b--)/ \bContent - ID: /i.test(i[b])&&/\bHTTP. + 201 /.test(i[b])&&(u=parseInt(/\bContent-ID: (\d+)/i.exec(i[b])[1]),r.added[u]&&(p=m.parseJson(/^\{.+\}/m.exec(i[b])[0]),e.extend(r.added[u],this.processResponse(p))));return r}var v=n&&n.getResponseHeader("DataServiceVersion"),x=null,w={};if(v=v&&parseInt(v,10)||2,a&&a._requiresCount&&((i.__count||i["odata.count"])&&(x=i.__count||i["odata.count"]),i.d&&(i=i.d),(i.__count||i["odata.count"])&&(x=i.__count||i["odata.count"])),3===v&&i.value&&(i=i.value),i.d&&(i=i.d),v<3&&i.results&&(i=i.results),h&&h.aggregates&&h.aggregates.length){var y,C=h.aggregates,S={};for(b=0;b-1;b--)/ \bContent - ID: /i.test(i[b])&&/\bHTTP. + 201 /.test(i[b])&&(h=parseInt(/\bContent-ID: (\d+)/i.exec(i[b])[1]),r.added[h]&&(c=m.parseJson(/^\{.+\}/m.exec(i[b])[0]),e.extend(r.added[h],this.processResponse(c))));return r}if(g=null,_={},a&&a._requiresCount&&"@odata.count"in i&&(g=i["@odata.count"]),i=i.value,v&&v.aggregates&&v.aggregates.length){var x,w=v.aggregates,y={};for(b=0;b=0;r--)o[r]&&(n=i.comparer,o[r].endsWith(" desc")&&(n=t.pvt.fnSort(t.sortOrder.Descending),o[r]=o[r].replace(" desc","")),e=S(e,o[r],n,[]));return e}return S(e,o,i.comparer,s?s.queries:[])},onGroup:function(e,i,s){var n,o,r,l;if(!e)return e;if(n=p(s.queries,"onAggregates"),o=[],n.length)for(l=0;l-1&&(a=this.rows.removeAt(i),a.markDelete(),this._deleted.push({model:a,position:i}),this._isDirty=!0,this._events.triggerHandler({type:"remove",model:a,table:this}))},isDirty:function(){return this._isDirty},getChanges:function(){for(var e={added:[],changed:[]},i=this.toArray(),s=0;s-1;a--)t[a].offsetParent?e(t[a])[i](s):t.splice(a,1)},_changeHandler:function(t){t.data.self.set(t.data.prop,e(this).val())},_processField:function(e,t,i){var s={self:this,prop:t},a=this.get(t);return i.fields.push(e[0]),this.formElements.indexOf(e[0].tagName.toLowerCase())===-1?(e.html(a),this._updates[t].read.push(e[0])):(e.val(a).off("change",null,this._changeHandler).on("change",null,s,this._changeHandler),this._updates[t].input.push(e[0]))},formElements:["input","select","textarea"]};var f=/[^\w]+/g,b=function(e){return e.replace(f,"_")},v=function(e){this.setDirty(!0,e.model)};if(t.Predicate=function(e,i,s,a){return this instanceof t.Predicate?("string"==typeof e?(this.field=e,this.operator=i,this.value=s,this.ignoreCase=a,this.isComplex=!1,this._comparer=t.data.fnOperators.processOperator(this.operator)):(e instanceof t.Predicate&&s instanceof t.Predicate||s instanceof Array)&&(this.isComplex=!0,this.condition=i.toLowerCase(),this.predicates=[e],s instanceof Array?[].push.apply(this.predicates,s):this.predicates.push(s)),this):new t.Predicate(e,i,s,a)},t.Predicate.and=function(){return r._combinePredicates([].slice.call(arguments,0),"and")},t.Predicate.or=function(){return r._combinePredicates([].slice.call(arguments,0),"or")},t.Predicate.fromJSON=function(e){var t,i,s;if(P(e,Array)){for(t=[],i=0,s=e.length;i0&&(a=n,o=e[r]));return o},quickSelect:function(e,i,s,a,n,o){if(s==a)return e[s];var r=t.pvt.partition(e,i,s,a,o),l=r-s+1;return l==n?e[r]:n0||t.length>0;)a=e.length>0&&t.length>0?s?s(I(e,i,0),I(t,i,0))<=0?e:t:e[0][i]0?e:t,n.push(a.shift());return n},getObject:function(e,t){var i,a,n;if(!t)return s;if(!e)return t;if(e.indexOf(".")===-1)return t[e];for(i=t,a=e.split("."),n=0;n":"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(e,t,i){return i?D(e)==D(t):e==t},notequal:function(e,i,s){return!t.data.fnOperators.equal(e,i,s)},lessthan:function(e,t,i){return i?D(e)D(t):e>t},lessthanorequal:function(e,t,i){return i?D(e)<=D(t):e<=t},greaterthanorequal:function(e,t,i){return i?D(e)>=D(t):e>=t},contains:function(e,t,i){return i?!d(e)&&!d(t)&&D(e).indexOf(D(t))!=-1:!d(e)&&!d(t)&&e.toString().indexOf(t)!=-1},notnull:function(e){return null!==e},isnull:function(e){return null===e},startswith:function(e,t,i){return i?e&&t&&D(e).startsWith(D(t)):e&&t&&e.startsWith(t)},endswith:function(e,t,i){return i?e&&t&&D(e).endsWith(D(t)):e&&t&&e.endsWith(t)},processSymbols:function(e){var i,s=t.data.operatorSymbols[e];return s&&(i=t.data.fnOperators[s])?i:h("Query - Process Operator : Invalid operator")},processOperator:function(e){var i=t.data.fnOperators[e];return i?i:t.data.fnOperators.processSymbols(e)}},t.NotifierArray=function(i){return P(this,t.NotifierArray)?(this.array=i,this._events=e({}),this._isDirty=!1,this):new t.NotifierArray(i)},t.NotifierArray.prototype={on:function(e,t){this._events.on(e,t)},off:function(e,t){this._events.off(e,t)},push:function(e){var t;return t=P(e,Array)?[].push.apply(this.array,e):this.array.push(e),this._raise("add",{item:e,index:this.length()-1}),t},pop:function(){var e=this.array.pop();return this._raise("remove",{item:e,index:this.length()-1}),e},addAt:function(e,t){return this.array.splice(e,0,t),this._raise("add",{item:t,index:e}),t},removeAt:function(e){var t=this.array.splice(e,1)[0];return this._raise("remove",{item:t,index:e}),t},remove:function(e){var t=this.array.indexOf(e);return t>-1&&(this.array.splice(t,1),this._raise("remove",{item:e,index:t})),t},length:function(){return this.array.length},_raise:function(t,i){this._events.triggerHandler(e.extend({type:t},i)),this._events.triggerHandler({type:"all",name:t,args:i})},toArray:function(){return this.array}},e.extend(t,t.dataUtil),Array.prototype.forEach=Array.prototype.forEach||function(e,t){for(var i=0,s=this.length;i9&&window.navigator.msPointerEnabled,e.pointerEnabled=window.navigator.pointerEnabled,e}function s(t,i,s){var a=s.type;s.type=i,e.event.dispatch.call(t,s),s.type=a}function a(e,t){if(t)for(prop in t)prop in e||(e[prop]=t[prop])}function n(e){return e.originalEvent.touches?e.originalEvent.touches[0]:c?e.originalEvent:e}function o(e){var i=c?e.originalEvent.pointerType:e.originalEvent.touches?"touch":"mouse",s=c&&u==t?4==i?"mouse":"touch":i;return e.pointerType=s,"mousedown"!=e.type&&"mouseup"!=e.type&&a(e,e.originalEvent),e}function r(t,i,s){var a,n,o,r,l,d={};return s&&(l=s.originalEvent.touches?[s.originalEvent.touches[0],t.originalEvent.changedTouches[0]]:[s.originalEvent,t.originalEvent],i._isSwipe||i._isdrag?(a=e.event.special.pinch._getdistance(l[0],l[1]),n=i.time,r={pageX:i.stopPoint.pageX,pageY:i.stopPoint.pageY}):i._isPinch&&(a=e.event.special.pinch.distance(t),n=t.timeStamp-s.timeStamp,o=i._pinchDistance),i._isDelta&&(d._dTime=t.timeStamp-s.timeStamp,d._x=l[1].pageX-l[0].pageX,d._y=l[1].pageY-l[0].pageY)),{options:t,delta:{time:d._dTime||null,X:d._x||null,Y:d._y||null},distance:a,scale:i._isPinch?o:null,time:n,velocity:{XY:a/d._dTime||null,X:d._x/d._dTime||null,Y:d._y/d._dTime||null},currentPosition:{pageX:r?r.pageX:null,pageY:r?r.pageY:null}}}function l(){var e=new Date;return e.getTime()}function d(e){c&&e.css("-ms-touch-action","pinch-zoom").css("touch-action","pinch-zoom")}var h=e(document);e.each("touchstart touchmove touchend tap doubletap taphold swipe swipeleft swiperight pinch pinchin pinchout pinchstop scrollstart scrollstop".split(" "),function(t,i){e.fn[i]=function(e){return e?this.bind(i,e):this.trigger(i)},e.attrFn&&(e.attrFn[i]=!0)});var c=i().isMSPointerEnabled,u=i().pointerEnabled,m="ontouchstart"in window,p="scroll",g=c?u?"pointerdown":"MSPointerDown":m?"touchstart":"mousedown",_=c?u?"pointerup":"MSPointerUp":m?"touchend":"mouseup",f=c?u?"pointermove":"MSPointerMove":m?"touchmove":"mousemove",b=c?u?"pointercancel":"MSPointerCancel":m?"touchcancel":"mouseleave",v=c?g:"touchstart mousedown",x=c?_:"touchend mouseup",w=c?f:"touchmove mousemove",y=i(),C="msie"==y.name&&"9.0"==y.version;e.event.special.ejtouchmove={setup:function(){function t(){}function i(e){if(!e.which||1===e.which){var t=(e.target,e.originalEvent);c&&(o={x:t.x,y:t.y}),l.bind(f,n)}}function n(e){if(!e.which||1===e.which){var t=(e.target,e.originalEvent);a(e,e.originalEvent),(!c||!o||Math.abs(o.x-t.x)>10||Math.abs(o.y-t.y)>10&&c)&&s(r,"ejtouchmove",e)}}var o,r=this,l=e(r);l.bind(g,i),h.bind(_,t),o={}}},e.event.special.swipeupdown={setup:function(){var i=this,s=e(i);d(s),s.bind(g,function(i){function a(e){if(e.preventDefault(),e.stopPropagation(),h){var t=n(e);o={time:(new Date).getTime(),coords:[t.pageX,t.pageY]},Math.abs(h.coords[1]-o.coords[1])>10&&e.preventDefault()}}var o,l=i,d=n(i),h={time:(new Date).getTime(),coords:[d.pageX,d.pageY],origin:e(i.target)};s.bind(f,a).one(_,function(i){if(s.unbind(f,a),h&&o&&o.time-h.time<1e3&&Math.abs(h.coords[1]-o.coords[1])>30&&Math.abs(h.coords[0]-o.coords[0])<75){var n={time:o.time-h.time,_isSwipe:!0,_isDelta:!0,stopPoint:o},d=r(i,n,l);h.origin.trigger(e.extend(!0,{type:"swipeupdown"},d)).trigger(e.extend(!0,{type:h.coords[1]>o.coords[1]?"swipeup":"swipedown"},d))}h=o=t})})}},e.event.special.scrollstart={isEnabled:!0,setup:function(){function t(e,t){i=t,s(n,i?"scrollstart":"scrollstop",e)}var i,a,n=this,o=e(n);o.bind(p,function(s){e.event.special.scrollstart.isEnabled&&(i||t(s,!0),clearTimeout(a),a=setTimeout(function(){t(s,!1)},250))})}},e.event.special.tap={doubleTapThreshold:500,tapholdThreshold:750,canDoubleTap:function(t){return l()-t.doubleTapStartTime<=e.event.special.tap.doubleTapThreshold},setup:function(){var t=this,i=e(t),a=i.data();d(i),a.isDoubleTapWait=!1,a.stopProcess=!1,a.preTouchend=null,a.preTouchstart=null,i.bind(v,function(n){function r(){clearTimeout(m),i.unbind(x,u),C&&h.unbind(x,u),i.unbind(b,r),h.unbind(w,d)}function d(e){var t=e,i=n;c?(t=e.originalEvent,i=n.originalEvent):"touchmove"==e.type&&"touchstart"==n.type&&(t=e.originalEvent.changedTouches[0],i=n.originalEvent.changedTouches[0]),t.pageX==i.pageX&&t.pageY==i.pageY||r()}function u(i){"touchend"==i.type&&(a.preTouchend=l()),r(),p===i.currentTarget&&(s(t,"tap",e.extend(o(i),{time:l()-a.startTime})),a.isDoubleTapWait&&e.event.special.tap.canDoubleTap(a)?(a.isDoubleTapWait=!1,s(t,"doubletap",e.extend(o(i),{time:l()-a.doubleTapStartTime}))):(a.isDoubleTapWait&&(a.isDoubleTapWait=!1,a.doubleTapStartTime=a.startTime),e.event.special.tap.canDoubleTap(a)&&(a.isDoubleTapWait=!0)))}a=i.data(),a.startTime=l(),a.isDoubleTapWait||(a.doubleTapStartTime=a.startTime),"touchstart"==n.type&&(a.preTouchstart=a.startTime),a.stopProcess="mousedown"==n.type&&(a.startTime-a.preTouchend<300||a.startTime-a.preTouchstart<30);var m,p=n.currentTarget,g=n.originalEvent;n.which&&1!==n.which||a.stopProcess?a.stopProcess&&(a.stopProcess=!1):(i.bind(x,u),C&&h.bind(x,u),i.bind(b,r),h.bind(w,d),m=setTimeout(function(){a.isDoubleTapWait&&(a.isDoubleTapWait=!1),s(t,"taphold",e.extend(o(n),{options:g,time:l()-a.startTime}))},e.event.special.tap.tapholdThreshold))})}},e.event.special.swipe={scrollSupression:10,duration:1e3,horizontalDistance:30,verticalDistance:75,pointers:window.navigator.msPointerEnabled,startPoint:function(t){var i=n(t);return{time:(new Date).getTime(),coords:[i.pageX,i.pageY],origin:e(t.target)}},stopPoint:function(e){var t=n(e);return{time:(new Date).getTime(),coords:[t.pageX,t.pageY]}},handleSwipe:function(t,i,s,a){if(i.time-t.timee.event.special.swipe.horizontalDistance&&Math.abs(t.coords[1]-i.coords[1])i.coords[0]?"swipeleft":"swiperight"},o))}},setup:function(){var i=this,s=e(i);d(s),s.bind(g,function(i){function a(t){o&&(n=e.event.special.swipe.stopPoint(t),Math.abs(o.coords[0]-n.coords[0])>e.event.special.swipe.scrollSupression&&t.preventDefault())}var n,o=e.event.special.swipe.startPoint(i),r=i;e(i.target).data("_dataTouchStart",{event:i,_now:(new Date).getTime()}),s.bind(f,a).one(_,function(i){s.unbind(f,a),o&&n&&e.event.special.swipe.handleSwipe(o,n,i,r),o=n=t})})}},e.event.special.pinch={distance:function(t){return t.originalEvent.touches.length<2?null:e.event.special.pinch._getdistance(t.originalEvent.touches[0],t.originalEvent.touches[1])},_getdistance:function(e,t){return Math.sqrt((e.pageX-t.pageX)*(e.pageX-t.pageX)+(e.pageY-t.pageY)*(e.pageY-t.pageY))},setup:function(){var i=this,s=e(i);d(s),s.bind(g,function(i){function a(t){l=t,o=e.event.special.pinch.distance(t)||null,d&&o&&Math.abs(d-o)>h&&(e(t.target).trigger(e.extend(!0,{type:d>o?"pinchin":"pinchout"},r(t,{_isPinch:!0,_pinchDistance:c},n))),d=o)}var n=i;if(i.originalEvent.touches&&i.originalEvent.touches.length>=2){var o,l,d=e.event.special.pinch.distance(i),h=5,c=d,u=r(i,{_isPinch:!0,_pinchDistance:c},n);e(i.target).trigger(e.extend(!0,{type:"pinch"},u)),s.bind(f,a).one(_,function(){s.unbind(f,a),e(i.target).trigger(e.extend(!0,{type:"pinchstop"},r(l,{_isPinch:!0,_pinchDistance:o},n))),d=o=t})}})}},e.event.special.touchdrag={setup:function(){var i=this,s=e(i);d(s),s.bind(g,function(i){function a(t){l&&(o=n(t),e.event.special.pinch._getdistance(l,o)>5&&e(t.target).trigger(e.extend(!0,{type:"touchdrag"},r(t,{_isdrag:!0,stopPoint:o,_isDelta:!0},d))))}var o,l=n(i),d=i;e(i.target).data("_dataTouchStart",{event:i,_now:(new Date).getTime()}),s.bind(f,a).one(_,function(){s.unbind(f,a), l=o=t})})}},e.each({scrollstop:"scrollstart",doubletap:"tap",taphold:"tap",swipeleft:"swipe",swiperight:"swipe",swipedown:"swipeupdown",swipeup:"swipeupdown",pinchin:"pinch",pinchout:"pinch",pinchstop:"pinch"},function(t,i){e.event.special[t]={setup:function(){e(this).bind(i,e.noop)}}})}(jQuery),function(){ejPageAnimation={slideLeft:["slideLeftOut","slideRightIn","slideRightOut","slideLeftIn"],slideRight:["slideRightOut","slideLeftIn","slideLeftOut","slideRightIn"],slideUp:["slideTopOut","slideBottomIn","slideBottomOut","slideTopIn"],slideDown:["slideBottomOut","slideTopIn","slideTopOut","slideBottomIn"],flipIn:["flipYLeftOut","flipYRightIn","flipYRightOut","flipYLeftIn"],flipOut:["flipYRightOut","flipYLeftIn","flipYLeftOut","flipYRightIn"],pop:["fadeZoomOut","fadeZoomIn","fadeZoomOut","fadeZoomIn"]},App={window:$(window),document:$(document),html:$("html"),head:$("head"),container:$("body"),model:{},_isBack:!1,_initialHeap:!0,currentStateId:null,checkStateId:null,activeSubPage:null,activePage:null,renderEJMControlsByDef:!0,applyMobileStyles:!0,defaults:{enableBrowserHistory:!0,forceHash:!1,enableAjax:"auto",ajaxOptions:{async:!0,crossDomain:!0,data:null,dataType:"html",contentType:"text/plain",method:"GET"},hashValue:null,enableCache:!1,enableAnimation:!0,animateOptions:{transitionType:"slideLeft",transitionDuration:"400",easing:"ease"},toPageClass:"",isReverseAnimation:!1,customOption:null,viewTransfered:null,viewBeforeTransfer:null,ajaxSuccess:null,ajaxFailure:null,refreshed:null,onBack:null,onHistoryBack:null},_isUrl:function(e){return/[\.|\/|\#]/g.test(e)},_getModel:function(e){return e.data("historyModel")},_getEventArguments:function(e){return{heap:e.data("heap")?e.data("heap"):{},historyState:history.state?{target:history.state.target,templateUrl:history.state.targetUrl,templateContent:history.state.targetContent,userModel:history.state.userModel,uid:history.state.uid}:{},renderingPage:App._renderingPage}},transferPage:function(e,t,i){var e,s,a,n,o,r,l,d;if(ej.mobile.WaitingPopup.show(),e=$("#"+e),e.addClass("page-container").data({historyModel:$.extend(!1,App.defaults,i?i:{})}),s=App._getModel(e),a=App._isUrl(t),e.children().first().attr("data-url")){for(currentPageUrl=e.children().first().attr("id"),newpageurl=t,n=[],o=0;o-1?(l=e.data("heap")[r],e.data("heap").splice(r,1),e.data("heap").push(l),App._loadExistingView(e,t,s),s.enableBrowserHistory&&(this._trimmedContent=$.trim(e.children().html()),App._initialHeap&&(App._initialTargetId=$("#"+e[0].id),App._initialHeap=!1),l.href==t&&r==e.data("heap").length-1?history.replaceState({target:e[0].id,targetUrl:t,targetContent:s.enableCache?this._trimmedContent:"",userModel:i,uid:App.currentStateId},t,s.forceHash?"#"+(s.hashValue?s.hashValue:t):App._isUrl(t)?t:"#"+t):history.pushState({target:e[0].id,targetUrl:t,targetContent:s.enableCache?this._trimmedContent:"",userModel:i,uid:App.currentStateId},t,s.forceHash?"#"+(s.hashValue?s.hashValue:t):App._isUrl(t)?t:"#"+t))):App._getContent(e,t,s,!0)}else d=$("
"),d.attr({id:"page_"+Math.floor(1e3*Math.random()+1)+"_container"}),e.wrapInner(d),App._pushHistory(e,t,e.html(),i),App._getContent(e,t,s,!0);App.currentStateId=history.state?history.state.uid+1:1},_updateContent:function(e,t,i,s){var a,n,o=App._getModel(e),r=App._isUrl(t)?"template_"+Math.floor(1e3*Math.random()+1):t;App._trimmedContent=$.trim(s),e.css({overflow:"hidden"}),a=$("
"),a.html(App._trimmedContent),n=$("
"),n.append(a.clone()),App._pushHistory(e,t,n.html(),i),n.remove(),App._renderingPage=a,e.append(a),App._animatePages(e,o.isReverseAnimation),o.enableBrowserHistory&&(App._initialHeap&&(App._initialTargetId=$("#"+e[0].id),App._initialHeap=!1),history.pushState({target:e[0].id,targetUrl:t,targetContent:o.enableCache?App._trimmedContent:"",userModel:i,uid:App.currentStateId},t,o.forceHash?"#"+(o.hashValue?o.hashValue:t):App._isUrl(t)?t:"#"+t)),App._currentTarget=e},_animatePages:function(e,t){var i,s=App._getModel(e);"string"==typeof s.animateOptions.transitionType&&(s.animateOptions.transitionType=ejPageAnimation[s.animateOptions.transitionType]),"string"==typeof s.animateOptions.easing&&(s.animateOptions.easing=ejAnimation.Easing[s.animateOptions.easing]),App._page1=e.children().first().addClass("page"),App._page2=e.children().last().addClass("page "+s.toPageClass),s.viewBeforeTransfer&&App._trigger("viewBeforeTransfer",App._getEventArguments(e),e),i=App,ej.widget.init(App._page2),s.enableAnimation?(e.addClass("e-m-intransition"),App._page1.ejAnimation("stop"),App._page2.ejAnimation("stop"),t?(i._page1.removeClass("e-m-hidden").ejAnimation(s.animateOptions.transitionType[2],s.animateOptions.transitionDuration,s.animateOptions.easing),i._page2.removeClass("e-m-hidden").ejAnimation(s.animateOptions.transitionType[3],s.animateOptions.transitionDuration,s.animateOptions.easing).done($.proxy(function(t){t.siblings().remove(),ej.mobile.WaitingPopup.hide(),e.removeClass("e-m-intransition"),this._page2.css("z-index","").removeClass("page"),s.viewTransfered&&App._trigger("viewTransfered",App._getEventArguments(e),e)},i))):(i._page1.removeClass("e-m-hidden").ejAnimation(s.animateOptions.transitionType[0],s.animateOptions.transitionDuration,s.animateOptions.easing),i._page2.removeClass("e-m-hidden").ejAnimation(s.animateOptions.transitionType[1],s.animateOptions.transitionDuration,s.animateOptions.easing).done($.proxy(function(t){t.siblings().remove(),ej.mobile.WaitingPopup.hide(),e.removeClass("e-m-intransition"),this._page2.css("z-index","").removeClass("page"),s.viewTransfered&&App._trigger("viewTransfered",App._getEventArguments(e),e)},i)))):(e.children().not(":last").remove(),App._page2.removeClass("e-m-hidden page").css("z-index",""),ej.mobile.WaitingPopup.hide(),s.viewTransfered&&App._trigger("viewTransfered",App._getEventArguments(e),e)),App._isBack=!1},_pushHistory:function(e,t,i,s){var a=App._getModel(e),n=e.data("heap"),o=n?n.length:0;currentPageUrl=a.enableAjax?t:e.children().first().attr("id"),0==o?e.data("heap",[{target:e,href:e.children().first().attr("id"),content:i,model:s}]):e.data("heap").push({target:e,href:t,content:a.enableCache?i:"",model:s})},_loadExistingView:function(e,t,i){var s=App._getModel(e),a=e.data("heap"),n=a.length;heapLastContent=a[n-1].content,heapLastUrl=a[n-1].href,heapModel=a[n-1].model,""!=heapLastContent?(App._renderingPage=$(heapLastContent),e.append(App._renderingPage),App._animatePages(e,s.isReverseAnimation)):App._getContent(e,heapLastUrl,heapModel,!1),(i.refreshed?i.refreshed:s.refreshed)&&App._trigger("refreshed",App._getEventArguments(e),e)},_getContent:function(e,t,i,s){var a,n,o,r=App._getModel(e);App._isUrl(t)?(proxy=App,$.ajax({url:t,dataType:i.dataType?i.dataType:r.ajaxOptions.dataType,crossDomain:i.crossDomain?i.crossDomain:r.ajaxOptions.crossDomain,contentType:i.contentType?i.contentType:r.ajaxOptions.contentType,async:!1,data:i.data?i.data:r.ajaxOptions.data,method:i.method?i.method:r.ajaxOptions.method,success:function(a){var n,o,l;r.ajaxSuccess&&App._trigger("ajaxSuccess",App._getEventArguments(e),e),n=/]*>((.|[\n\r])*)<\/body>/im,templateContent=n.exec(a)?n.exec(a)[1]:a,s?proxy._updateContent(e,t,i,templateContent):(o=proxy._isUrl(t)?"template_"+Math.floor(1e3*Math.random()+1):t,l=$("
"),l.append($.trim(templateContent)),App._renderingPage=l,e.append(l),proxy._animatePages(e,App._isBack))},error:function(){ej.mobile.WaitingPopup.hide(),r.ajaxFailure&&App._trigger("ajaxFailure",App._getEventArguments(e),e)}})):(a=$("#"+t),templateContent=a.html(),s?App._updateContent(e,t,i,templateContent):(n=App._isUrl(t)?"template_"+Math.floor(1e3*Math.random()+1):t,o=$("
"),o.append($.trim(templateContent)),App._renderingPage=o,e.append(o),App._animatePages(e,r.isReverseAnimation)))},renderEJMControls:function(e){var t=e?e:App.activePage;App.renderEJMControlsByDef&&(t.find("input[type='button']:not([data-role]):attrNotStartsWith('ejm-'),input[type='submit']:not([data-role]):attrNotStartsWith('ejm-'),input[type='reset']:not([data-role]):attrNotStartsWith('ejm-')").attr("data-role","ejmbutton"),t.find("a:not([data-role]):attrNotStartsWith('ejm-')").attr("data-role","ejmactionlink"),t.find("input:not([data-role]):not([type]):attrNotStartsWith('ejm-'),input[type='text']:not([data-role]):attrNotStartsWith('ejm-'),input[type='tel']:not([data-role]):attrNotStartsWith('ejm-'),input[type='email']:not([data-role]):attrNotStartsWith('ejm-'),input[type='password']:not([data-role]):attrNotStartsWith('ejm-')").attr("data-role","ejmtextbox"),t.find("input[type='checkbox']:not([data-role]):attrNotStartsWith('ejm-')").filter(function(){if(!$(this).closest("[data-role='ejmgroupbutton']").length)return this}).attr("data-role","ejmcheckbox"),t.find("input[type='radio']:not([data-role]):attrNotStartsWith('ejm-')").filter(function(){if(!$(this).closest("[data-role='ejmgroupbutton']").length)return this}).attr("data-role","ejmradiobutton"),t.find("input[type='date']:not([data-role]):attrNotStartsWith('ejm-')").attr("data-role","ejmdatepicker"),t.find("input[type='time']:not([data-role]):attrNotStartsWith('ejm-')").attr("data-role","ejmtimepicker"))},back:function(e){var t,i,s,a,n,o;if("undefined"==typeof e)if(t=$("
"),history.state){if(ej.isNullOrUndefined(history.state.target))return;App._currentTarget=e=$("#"+history.state.target),s=App._getModel(e),App._currentTarget.data({historyModel:$.extend(!1,App.defaults,history.state.userModel?history.state.userModel:{})}),""==history.state.targetContent?App._getContent(e,history.state.targetUrl,s,!1):(i=App._isUrl(history.state.targetUrl)?"template_"+Math.floor(1e3*Math.random()+1)+"_container":history.state.targetUrl,t.attr({id:i,"page-url":history.state.targetUrl}),t.html(history.state.targetContent),App._renderingPage=t,e.append(t),App._animatePages(App._currentTarget,s.isReverseAnimation)),App.model.onHistoryBack&&App._trigger("onHistoryBack",App._getEventArguments(e),e),App.checkStateId=history.state&&history.state.uid}else s=App._getModel(App._initialTargetId),t.attr("id",App._initialTargetId.data("heap")[0].href+"_container"),t.html(App._initialTargetId.data("heap")[0].content),App._renderingPage=t,App._initialTargetId.append(t),App._animatePages(App._initialTargetId,s.isReverseAnimation),App.model.onHistoryBack&&App._trigger("onHistoryBack",App._getEventArguments(App._initialTargetId),e);else{if(App._isBack=!0,a=$("#"+e).data("heap"),!a||!a.length)return!1;if(n=$("#"+e),o=a.pop(),a.length){var r=a[a.length-1].content,l=a[a.length-1].href,d=a[a.length-1].model;""!=r||a.length<=1?(App._renderingPage=r,n.append(r),App._animatePages($("#"+e),App._isBack)):App._getContent(n,l,d,!1)}App.model.onBack&&App._trigger("onBack",App._getEventArguments($("#"+e)),$("#"+e))}},_trigger:function(e,t,i){var s,a,n,o,r,l=App._getModel(i);if(l)return s=null,o={},t=$.extend({target:i},t),$.extend(o,t),e in l&&(s=l[e]),s&&("string"==typeof s&&(s=ej.util.getObject(s,window)),$.isFunction(s)&&(n=ej.event(e,l,t),a=s.call(App,n),t&&$.extend(t,n),n.cancel||!ej.isNullOrUndefined(a)))?a===!1||n.cancel:(r=Boolean(t),t=t||{},t.originalEventType=e,t.type=e,n=$.Event(t.type,ej.event(t.type,l,t)),r&&$.extend(t,n),n.cancel)}}}(),$(function(){App.applyMobileStyles&&$("body").find("[data-role*='ejm']").length>0&&$("body").addClass("e-m-user-select e-m-viewport e-m-"+ej.getRenderMode()),App._currentPage=App.activeSubPage=App.activePage=$("body"),App.window.on("popstate",function(e){App._isBack=!0,App.checkStateId&&e.originalEvent.state&&e.originalEvent.state.uid>=App.checkStateId&&(App._isBack=!1),App.back()})}),ej.mobUtil={cssUA:ej.userAgent?"-"+ej.userAgent().toString().toLowerCase()+"-":"",transform:ej.addPrefix("transform"),transition:ej.addPrefix("transition"),transitionProperty:ej.addPrefix("transitionProperty"),transformStyle:ej.addPrefix("transformStyle"),transitionDuration:ej.addPrefix("transitionDuration"),transformOrigin:ej.addPrefix("transformOrigin"),transitionTimingFunction:ej.addPrefix("transitionTimingFunction"),transitionDelay:ej.addPrefix("transitionDelay"),ease:{quadratic:{style:"cubic-bezier(0.25, 0.46, 0.45, 0.94)",fn:function(e){return e*(2-e)}},circular:{style:"cubic-bezier(0.1, 0.57, 0.1, 1)",fn:function(e){return Math.sqrt(1- --e*e)}},back:{style:"cubic-bezier(0.175, 0.885, 0.32, 1.275)",fn:function(e){var t=4;return(e-=1)*e*((t+1)*e+t)+1}},bounce:{style:"",fn:function(e){return(e/=1)<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375}},elastic:{style:"",fn:function(e){var t=.22;return 0===e?0:1==e?1:.4*Math.pow(2,-10*e)*Math.sin(2*(e-t/4)*Math.PI/t)+1}}},angular:{defaultAppName:$("[ng-app]").attr("ng-app"),compile:function(e){var t=angular.element(document.querySelector("[ng-app],[data-ng-app]")||document).injector();t.invoke(["$compile","$rootScope",function(t,i){var s=angular.element(e.closest(".ng-scope")||e).scope();(s||i)&&t(e)(s||i),(s||i).$$phase||(s||i).$digest()}])}},angularMobileSettings:{enableAnimation:!0,animationTime:300},isAppNullOrUndefined:function(){return"undefined"==typeof App},device:{isIOS:function(){return/(ipad|iphone|ipod touch)/i.test(navigator.userAgent.toLowerCase())&&!this.isWindows()},isIOS7:function(){return/(ipad|iphone|ipod touch);.*os 7_\d|(ipad|iphone|ipod touch);.*os 8_\d/i.test(navigator.userAgent.toLowerCase())&&!this.isWindows()},isAndroid:function(){return/android/i.test(navigator.userAgent.toLowerCase())&&!this.isWindows()},isWindows:function(){return/trident|windows phone/i.test(navigator.userAgent.toLowerCase())},isFlat:function(){return ej.getBooleanVal($("head"),"data-ej-flat",!1)===!0}},isIOS:function(){if(!ej.getBooleanVal($("head"),"data-ej-windows")&&!ej.getBooleanVal($("head"),"data-ej-android")&&!ej.getBooleanVal($("head"),"data-ej-flat"))return this._ios()},isIOS7:function(){if(!ej.getBooleanVal($("head"),"data-ej-windows")&&!ej.getBooleanVal($("head"),"data-ej-android")&&!ej.getBooleanVal($("head"),"data-ej-flat"))return this._ios7()},isAndroid:function(){if(!(ej.getBooleanVal($("head"),"data-ej-windows")||ej.getBooleanVal($("head"),"data-ej-ios")||ej.getBooleanVal($("head"),"data-ej-ios7")||ej.getBooleanVal($("head"),"data-ej-flat")))return this._android()},setTransition:function(){return ej.isAndroid()?"pop":ej.isWindows()?(ej.isMobile(),"slide"):"slide"},isLowerAndroid:function(){return/Android /.test(window.navigator.appVersion)&&!/Chrome\/\d/.test(window.navigator.appVersion)},getAndroidVersion:function(){return!(!this._android()||!navigator.userAgent.toLowerCase().match(/android\s+([\d\.]+)/))&&parseFloat(navigator.userAgent.toLowerCase().match(/android\s+([\d\.]+)/)[1])},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()},isFlat:function(){return ej.getBooleanVal($("head"),"data-ej-flat",!1)===!0},isLowerResolution:function(){return window.innerWidth<=640&&ej.isPortrait()&&ej.isDevice()||window.innerWidth<=800&&!ej.isDevice()||window.innerWidth<=800&&!ej.isPortrait()&&ej.isWindows()&&ej.isDevice()||ej.isMobile()},isIOSWebView:function(){return/(iPhone|iPod|iPad).*AppleWebKit(?!.*Safari)/i.test(navigator.userAgent)},isAndroidWebView:function(){return!("undefined"==typeof Android)},hasTheme:function(e){return e.hasClass("e-m-dark")||e.hasClass("e-m-light")||e.hasClass("e-m-default")},setTheme:function(e){"windows"==e.model.renderMode||ej.isMobile()||"default"!=e.model.theme||(e.model.theme="auto");var t=ej.getAttrVal($("head"),"data-ej-theme","auto"),i=ej.getBooleanVal($("head"),"data-ej-windows-renderdefault",!!e.model.windows&&e.model.windows.renderDefault);e.model.windows&&(e.model.windows.renderDefault=i),e.model.theme="auto"==e.model.theme?"auto"==t?"ios7"!=e.model.renderMode&&("android"!=e.model.renderMode&&"windows"!=e.model.renderMode||ej.isMobile())?"dark":"light":t:e.model.theme},getTheme:function(){return objTheme={model:{theme:"auto"}},this.setTheme(objTheme),objTheme.model.theme},hasRenderMode:function(e){return e.hasClass("e-m-ios7")||e.hasClass("e-m-android")||e.hasClass("e-m-windows")||e.hasClass("e-m-flat")},setRenderMode:function(e){e.model.renderMode=ej.getAttrVal(e.element,"data-ej-rendermode",e.model.renderMode),"auto"==e.model.renderMode&&(e.model.renderMode=ej.isAndroid()?"android":ej.isIOS()?"ios7":ej.isWindows()?"windows":ej.isFlat()?"flat":"ios7")},getRenderMode:function(){return this.isAndroid()?"android":this.isIOS()?"ios7":this.isWindows()?"windows":this.isFlat()?"flat":"ios7"},isPortrait:function(){var e=document.documentElement;return e&&e.clientWidth/e.clientHeight<1.1},getCurrentPage:function(){return ej.isAppNullOrUndefined()?$("body"):App._renderingPage?App._renderingPage:App.activePage},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":""},round:function(e,t,i){return t*(i?Math.ceil(e/t):Math.floor(e/t))},logBase:function(e,t){return Math.log(e)/Math.log(t)},correctRect:function(e,t,i,s){return{X:Math.min(e,i),Y:Math.min(t,s),Width:Math.abs(i-e),Height:Math.abs(s-t)}},measureText:function(e,t,i){var s,a=document.createElement("DIV");return a.innerHTML=e,null!=i&&(a.style.font=i),a.style.backgroundColor="white",a.style.position="absolute",a.style.top=-100,a.style.left=0,t&&(a.style.maxwidth=t+"px"),document.body.appendChild(a),s={width:a.offsetWidth,height:a.offsetHeight},$(a).remove(),s},getTime:Date.now||(new Date).getTime(),getFontString:function(e){return null==e&&(e={}),e.FontFamily||(e.FontFamily="Arial"),e.FontStyle||(e.FontStyle=0),e.Size||(e.Size="12px"),ej.GetFontStyle(e.FontStyle)+" "+e.Size+" "+e.FontFamily},getFontStyle:function(e){switch(e){case 0:return"Regular";case 1:return"Bold";case 2:return"Italic";case 4:return"Underline";case 8:return"StrikeOut"}},hexFromRGB:function(e){var t=e.R,i=e.G,s=e.B,a=[t.toString(16),i.toString(16),s.toString(16)];return $.each(a,function(e,t){1===t.length&&(a[e]="0"+t)}),a.join("").toUpperCase()},adjustFixedElement:function(e){e.removeClass("e-m-adjheader e-m-adjfooter");var t=e.siblings(".e-m-navbar-top").length,i=e.siblings(".e-m-navbar-bottom").length;t&&e.addClass("e-m-adjheader-"+t),i&&e.addClass("e-m-adjfooter-"+i)},setCaretToPos:function(e,t,i){if(e.setSelectionRange&&"number"!=e.type)e.focus(),e.setSelectionRange(t,i);else if(e.createTextRange){var s=e.createTextRange();s.collapse(!0),s.moveStart("character",t),s.moveEnd("character",i),s.select()}},isCssCalc:function(){$("body").append('');var e=$("#css3-calc").width();return $("#css3-calc").remove(),20==e},getLocation:function(e){var t=e?this.route.splitUrl(e):location,i=this.route.splitUrl(e||location.href).hash;return i="#"===i?"":i,t.protocol+"//"+t.host+t.pathname+t.search+i},route:{urlSplitReg:/^\s*(((([^:\/#\?]+:)?(?:(\/\/)((?:(([^:@\/#\?]+)(?:\:([^:@\/#\?]+))?)@)?(([^:\/#\?\]\[]+|\[[^\/\]@#?]+\])(?:\:([0-9]+))?))?)?)?((\/?(?:[^\/\?#]+\/+)*)([^\?#]*)))?(\?[^#]+)?)(#.*)?/,splitUrl:function(e){if("object"===$.type(e))return e;var t=this.urlSplitReg.exec(e||"")||[];return{href:t[0]||"",protocol:t[4]||"",host:t[10]||"",pathname:t[13]||"",search:t[16]||"",hash:t[17]||""}}},resize:function(){$(window).bind("onorientationchange"in window?"orientationchange":"resize",function(e){("android"==ej.getRenderMode()||"ios7"==ej.getRenderMode())&&$(document.activeElement).blur(),ej._currentResolution!=ej.isLowerResolution()?(ej._currentResolution=ej.isLowerResolution(),$.extend(!0,e,{resolutionChanged:!0})):$.extend(!0,e,{resolutionChanged:!1});for(var t=0;t0&&r>i?(d=a/(6/(r/o*n)),i+=d,o=o*i/r,r=i):e<0&&r>s&&(d=a/(6/(r/o*n)),s+=d,o=o*s/r,r=s),r*=e<0?-1:1,l=o/n,{dist:r,time:Math.round(l)}},_nativeMomentum:function(e,t,i,s,a,n,o){var r,l,d=e-t,h=Math.abs(d)/i;return n=null==n?6e-4:n,r=e+h*h/(2*(n/o))*(d<0?-1:1),l=h/n,r0&&(r=a?a/2.5*(h/8):0,d=Math.abs(e)+r,l=d/h),{dest:Math.round(r),duration:l}},_setHidden:function(){var e=this;this.hidden.each(function(t){var i=e.tmp[t];for(var s in prop)this.style[s]=i[s]})},_removeHidden:function(e){var t=this;this.hidden=$(e).parents().andSelf().filter(":hidden"),prop={visibility:"hidden",display:"block"},this.tmp=[],this.hidden.each(function(){var e={};for(var i in prop)e[i]=this.style[i],this.style[i]=prop[i];t.tmp.push(e)})},_transitionTime:function(e,t){e+="ms",t.style[ej.transitionDuration]=e},_slideOutWithoutDuration:function(e,t){ej._transitionTime(0,e),e.style[ej.transform]=t?"translateX(-100%)":"translateX(100%)"},_slideInWithoutDuration:function(e,t){ej._transitionTime(0,e),e.style[ej.transform]=t?"translateX(100%)":"translateX(-100%)"},_slideOutWithDuration:function(e,t){ej._transitionTime(300,e),e.style[ej.transform]=t?"translateX(-100%)":"translateX(100%)"},_slideInWithDuration:function(e,t){ej._transitionTime(100,e),e.style[ej.transform]=t?"translateX(100%)":"translateX(-100%)"},_slide:function(e){ej._transitionTime(100,e),e.style[ej.transform]="translateX(0)"},_device:function(){return/mobile|tablet|android|kindle/i.test(navigator.userAgent.toLowerCase())},_ios:function(){return/(ipad|iphone|ipod touch)/i.test(navigator.userAgent.toLowerCase())&&!this._windows()||ej.getBooleanVal($("head"),"data-ej-ios7",!1)===!0},_ios7:function(){return/(ipad|iphone|ipod touch);.*os 7_\d|(ipad|iphone|ipod touch);.*os 8_\d/i.test(navigator.userAgent.toLowerCase())&&!this._windows()||ej.getBooleanVal($("head"),"data-ej-ios7",!1)===!0},_android:function(){return/android/i.test(navigator.userAgent.toLowerCase())&&!this._windows()||ej.getBooleanVal($("head"),"data-ej-android",!1)===!0},_windows:function(){return/trident|windows phone|edge/i.test(navigator.userAgent.toLowerCase())||ej.getBooleanVal($("head"),"data-ej-windows",!1)===!0},_getFontString:function(e,t){return e.model.fontStyle[t.FontStyle]+" "+(null==t.Size?"11px":t.Size)+" "+t.FontFamily},_setScroller:function(e){e._wrpWd=e.element[0].clientWidth,e._scrollerWidth=e.element[0].scrollWidth,e._maxScrollX=e._wrpWd-e._scrollerWidth},_inputTouchStart:function(e,t){var i=e.touches?e.touches[0]:e;t._moved=!1,t._distX=0,t._x=void 0==t._x?t.element[0].scrollLeft:t._x,t._cloned=!1,t._startX=0,t._pointX=i.pageX,t._startTime=ej.getTime()},_inputTouchMove:function(e,t){var i,s,a=e.touches?e.touches[0]:e,n=a.pageX-t._pointX;n>0&&(t._reverse=!0),0==t.element[0].scrollLeft&&n>0||n>0&&t.element[0].scrollLeft0&&t.element[0].scrollLeft+n>t.element[0].scrollLeftMax&&(t._x<0&&(t._x=-t._x),n=-n),i=t._x+n,s=ej.getTime(),t._distX+=n,ej._translateText(t.element,i))},_inputTouchEnd:function(e,t){var i=e.touches?e.changedTouches[0]:e,s=i.pageX-t._pointX;ej.getTime();t._distX+=s,ej._translateText(t.element,t.element[0].scrollLeft),t._x=-t.element[0].scrollLeft},_translateText:function(e,t){e[0].scrollLeft=Math.abs(t)},_setGradientColor:function(e,t,i){i.Name||"string"==typeof i?t.addColorStop(0,ej._getColor(i)):$.each(i,function(e,i){t.addColorStop(NaN!=i.ColorStop?i.ColorStop:0,"string"==typeof i.Color?i.Color:ej._getColor(i.Color))})},_pushValue:function(e,t,s){var s,a=[];for(i=0;i"),this.waitingPopupDiv.find(".e-m-image").text(this.model.text),this.model.target.append(this.waitingPopupDiv),this.model.showOnInit||this.hide()}},setText:function(e){this.model.text=e,this.waitingPopupDiv.find(".e-m-image").text(e)},changeTarget:function(e){this.model.target=e,this.model.target.append(this.waitingPopupDiv)},show:function(){this.model.showOnInit=!0,this.waitingPopupDiv.addClass("e-m-show").removeClass("e-m-hide")},hide:function(){this.model.showOnInit=!1,this.waitingPopupDiv.removeClass("e-m-show").addClass("e-m-hide")}},$(function(){ej.initPage(),ej._currentResolution=ej.isLowerResolution(),ej.mobile.WaitingPopup._init(),ej.mobile.enableRippleEffect&&!ej.isNullOrUndefined(window.ejAnimation)&&$("body").ejAnimation("rippleEffect"),ej.resize()}),ej.mobile.RenderMode={Auto:"auto",IOS7:"ios7",Android:"android",Windows:"windows"},ej.mobile.Theme={Auto:"auto",Dark:"dark",Light:"light"},function(e,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,cursorAt:{top:-1,left:-2},dragStart:null,drag:null,dragStop:null,destroy:null,helper:function(){return e('
').html("draggable").appendTo(document.body)}},_init:function(){this.handler=function(){},this.resizables={},helpers={},this._wireEvents(),this._browser=t.browserInfo(),this._isIE8="msie"==this._browser.name&&"8.0"==this._browser.version,this._isIE9="msie"==this._browser.name&&"9.0"==this._browser.version},_setModel:function(e){for(var t in e)switch(t){case"dragArea":this.model.dragArea=e[t]}},_destroy:function(){e(document).unbind(t.eventType.mouseUp,this._destroyHandler).unbind(t.eventType.mouseUp,this._dragStopHandler).unbind(t.eventType.mouseMove,this._dragStartHandler).unbind(t.eventType.mouseMove,this._dragHandler).unbind("mouseleave",this._dragMouseOutHandler).unbind("selectstart",!1),t.widgetBase.droppables[this.scope]=null},_initialize:function(i){var s,a=i;i.preventDefault(),i=this._getCoordinate(i),this.target=e(a.currentTarget),this._initPosition={x:i.pageX,y:i.pageY},e(document).bind(t.eventType.mouseMove,this._dragStartHandler).bind(t.eventType.mouseUp,this._destroyHandler),this.model.clone||(s=this.element.offset(),this._relXposition=i.pageX-s.left,this._relYposition=i.pageY-s.top),e(document.documentElement).trigger(t.eventType.mouseDown,a)},_setDragArea:function(){var i,s,a,n,o,r,l,d=e(this.model.dragArea)[0];if(d){if(n=["left","right","bottom","top"],t.isNullOrUndefined(d.getBoundingClientRect)){for(i=e(this.model.dragArea).outerWidth(),s=e(this.model.dragArea).outerHeight(),l=0;l=this.model.distance){if(s=this.model.helper({sender:l,element:this.target}),!s||t.isNullOrUndefined(s))return;if(a=this.model.handle=this.helper=s,this.model.dragStart&&(n=null,"touchmove"==l.type?(o=l.originalEvent.changedTouches[0],n=document.elementFromPoint(o.pageX,o.pageY)):n=l.originalEvent.target||l.target,this._trigger("dragStart",{event:l,element:this.element,target:n})))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),r=a.offsetParent().offset(),e(document).unbind(t.eventType.mouseMove,this._dragStartHandler).unbind(t.eventType.mouseUp,this._destroyHandler).bind(t.eventType.mouseMove,this._dragHandler).bind(t.eventType.mouseUp,this._dragStopHandler).bind("mouseleave",this._dragMouseOutHandler).bind("selectstart",!1),t.widgetBase.droppables[this.model.scope]={draggable:this.element,helper:a.css({position:"absolute",left:this.position.left-r.left,top:this.position.top-r.top}),destroy:this._destroyHandler}}},_drag:function(i){var s,a,n,o,r,l,d,h,c;this.position=this._getMousePosition(i),this.position.top<0&&(this.position.top=0),e(document).height()this.position.left?this._left:this._rightthis.position.top?this._top:this._bottom0&&(dropObj=e(s).data("ejDroppable"),!t.isNullOrUndefined(dropObj)))return dropObj},_elementUnderCursor:function(e){return"touchmove"==e.type||"touchstart"==e.type||"touchend"==e.type?document.elementFromPoint(e.originalEvent.changedTouches[0].pageX,e.originalEvent.changedTouches[0].pageY):document.elementFromPoint(e.clientX,e.clientY)},_contains:function(t,i){try{return e.contains(t,i)||t==i}catch(e){return!1}},_wireEvents:function(){this._on(this.element,t.eventType.mouseDown,this._initialize),this._dragStartHandler=e.proxy(this._dragStart,this),this._destroyHandler=e.proxy(this._destroy,this),this._dragStopHandler=e.proxy(this._dragStop,this),this._dragHandler=e.proxy(this._drag,this),this._dragMouseEnterHandler=e.proxy(this._dragMouseEnter,this),this._dragMouseOutHandler=e.proxy(this._dragMouseOut,this)},_getMousePosition:function(e){e=this._getCoordinate(e);var t=this.model.clone?e.pageX:e.pageX-this._relXposition,i=this.model.clone?e.pageY:e.pageY-this._relYposition;return{left:t-[this.margins.left+this.model.cursorAt.left],top:i-[this.margins.top+this.model.cursorAt.top]}},_getCoordinate:function(e){var t=e;return("touchmove"==e.type||"touchstart"==e.type||"touchend"==e.type)&&(t=e.originalEvent.changedTouches[0]),t}})}(jQuery,Syncfusion),function(e,t){t.widget("ejDroppable","ej.Droppable",{element:null,model:null,validTags:["div","span","a"],defaults:{accept:null,scope:"default",drop:null,over:null,out:null},_init:function(){this.model.accept?e(this.element).delegate(this.accept,"mouseup",e.proxy(this._drop,this)):e(this.element).bind("mouseup",e.proxy(this._drop,this)),this._on(e(document),"touchend",this._drop),this._mouseOver=!1},_setModel:function(){},_destroy:function(){},_over:function(e){this._mouseOver||(this._trigger("over",e),this._mouseOver=!0)},_out:function(e){this._mouseOver&&(this._trigger("out",e),this._mouseOver=!1)},_drop:function(i){var s=t.widgetBase.droppables[this.model.scope],a=!t.isNullOrUndefined(s.helper)&&s.helper.is(":visible"),n=this._isDropArea(i);s&&!t.isNullOrUndefined(this.model.drop)&&a&&n.canDrop&&this.model.drop(e.extend(i,{dropTarget:n.target},!0),s)},_isDropArea:function(t){var i,s,a,n,o,r={canDrop:!0,target:e(t.target)};if("touchend"==t.type)for(i=t.originalEvent.changedTouches[0],s=document.elementFromPoint(i.pageX,i.pageY),r.canDrop=!1,a=e(s).parents(),n=0;n').html("resizable").appendTo(document.body)}},_init:function(){this.target=this.element,this._browser=t.browserInfo(),this._isIE8="msie"==this._browser.name&&"8.0"==this._browser.version,this._isIE9="msie"==this._browser.name&&"9.0"==this._browser.version,null!=this.handle?e(this.target).delegate(this.handle,t.eventType.mouseDown,e.proxy(this._mousedown,this)).delegate(this.handle,"resizestart",this._blockDefaultActions):e(this.target).bind("mousedown",e.proxy(this._mousedown,this)),this._resizeStartHandler=e.proxy(this._resizeStart,this),this._destroyHandler=e.proxy(this._destroy,this),this._resizeStopHandler=e.proxy(this._resizeStop,this),this._resizeHandler=e.proxy(this._resize,this),this._resizeMouseEnterHandler=e.proxy(this._resizeMouseEnter,this)},_mouseover:function(i){e(i.target).hasClass("e-resizable")?(e(i.target).css({cursor:"se-resize"}),e(this.target).bind(t.eventType.mouseDown,e.proxy(this._mousedown,this))):(e(this.target).unbind(t.eventType.mouseDown),e(this.target).css({cursor:""}))},_blockDefaultActions:function(e){e.cancelBubble=!0,e.returnValue=!1,e.preventDefault&&e.preventDefault(),e.stopPropagation&&e.stopPropagation()},_setModel:function(){},_mousedown:function(i){var s=i;return i=this._getCoordinate(i),this.target=e(s.currentTarget),this._initPosition={x:i.pageX,y:i.pageY},this._pageX=i.pageX,this._pageY=i.pageY,e(document).bind(t.eventType.mouseMove,this._resizeStartHandler).bind(t.eventType.mouseUp,this._destroyHandler),e(document.documentElement).trigger(t.eventType.mouseDown,s),!1},_resizeStart:function(i){var s,a;if(e(i.target).hasClass("e-resizable")){i=this._getCoordinate(i);var n,o,r=this._initPosition.x-i.pageX,l=this._initPosition.y-i.pageY,d=Math.sqrt(r*r+l*l);if(d>=this.model.distance){if(null!=this.model.resizeStart&&this._trigger("resizeStart",{event:i,element:this.target}))return;s=this.model.helper({element:this.target}),n=i.pageX-this._pageX+s.outerWidth(),o=i.pageY-this._pageY+s.outerHeight(),this._pageX=i.pageX,this._pageY=i.pageY,a=this.getElementPosition(s),e(document).unbind(t.eventType.mouseMove,this._resizeStartHandler).unbind(t.eventType.mouseUp,this._destroyHandler).bind(t.eventType.mouseMove,this._resizeHandler).bind(t.eventType.mouseUp,this._resizeStopHandler).bind("mouseenter",this._resizeMouseEnterHandler).bind("selectstart",!1),t.widgetBase.resizables[this.scope]={resizable:this.target,helper:s.css({width:n,height:o}),destroy:this._destroyHandler}}}},_resize:function(e){var i,s,a,n,o;e=this._getCoordinate(e),n=this.getElementPosition(t.widgetBase.resizables[this.scope].helper),o=this.model.helper({element:this.target}),i=e.pageX-this._pageX+o.outerWidth(),s=e.pageY-this._pageY+o.outerHeight(),this._pageX=e.pageX,this._pageY=e.pageY,ithis.model.maxHeight&&(a=s-this.model.maxHeight,s=this.model.maxHeight,this._pageY=e.pageY-a),null!=this.model.maxWidth&&i>this.model.maxWidth&&(a=i-this.model.maxWidth,i=this.model.maxWidth,this._pageX=e.pageX-a),t.widgetBase.resizables[this.scope].helper.css({width:i,height:s}),this._trigger("resize",{element:this.target})},_resizeStop:function(e){null!=this.model.resizeStop&&this._trigger("resizeStop",{element:this.target}),("mouseup"==e.type||"touchend"==e.type)&&this._destroy(e)},_resizeMouseEnter:function(e){this._isIE9?this._resizeManualStop(e):this._isIE8?0==e.button&&this._resizeManualStop(e):0==e.buttons&&this._resizeManualStop(e)},_resizeManualStop:function(e){null!=this.model.resizeStop&&this._trigger("resizeStop",{element:this.target}),this._destroy(e)},_destroy:function(){e(document).unbind(t.eventType.mouseUp,this._destroyHandler).unbind(t.eventType.mouseUp,this._resizeStopHandler).unbind(t.eventType.mouseMove,this._resizeStartHandler).unbind(t.eventType.mouseMove,this._resizeHandler).unbind("mouseenter",this._resizeMouseEnterHandler).unbind("selectstart",!1),t.widgetBase.resizables[this.scope]=null},getElementPosition:function(e){return null!=e&&e.length>0?{left:e[0].offsetLeft,top:e[0].offsetTop}:null},_getCoordinate:function(e){var t=e;return("touchmove"==e.type||"touchstart"==e.type||"touchend"==e.type)&&(t=e.originalEvent.changedTouches[0]),t}})}(jQuery,Syncfusion),function(e,t,i,s){"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="horizontal"===this.model.orientation?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 e="X";this.model.orientation===t.ScrollBar.Orientation.Horizontal?this.element.addClass("e-hscrollbar"):(this.element.addClass("e-vscrollbar"),e="Y"),(0!==this.value()||0!==this.model.minimum)&&(this.value(){2}
",o=e.fn.jquery,r={};r[i.dimension]=i.modelDim,a=t.buildTag("div."+i.css+"scroll e-box",String.format(n,"up e-icon e-box e-button",i.buttonSize)+String.format(n,"handlespace",i.handleSpace,String.format(n,"handle e-box",i.handle))+String.format(n,"down e-icon e-box e-button",i.buttonSize),r),this.element.append(a),s="1.7.1"===o||"1.7.2"===o?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(e){var i,a;e.scrollDim="scroll"+e.dimension,e.lPosition=e.position.toLowerCase(),e.clientXy="page"+e.xy,e.scrollVal="scroll"+e.position,e.scrollOneStepBy=this.model.smallChange,e.modelDim=this.model[e.dimension=e.dimension.toLowerCase()],e.handler=e.css+"handle",e.buttonSize=this.model.buttonSize,e.main=e.css+"scroll",e.scroll=e.css+"ScrollSpace",e.handleSpace=e.modelDim-2*e.buttonSize,e.scrollable=this.model.maximum-this.model.minimum,i=this.model.height,"horizontal"===this.model.orientation&&(i=this.model.width),e.handle=this.model.viewportSize/(this.model.maximum-this.model.minimum+this.model.viewportSize)*(i-2*this.model.buttonSize),a=!t.isNullOrUndefined(this.model.elementHeight)&&"string"==typeof this.model.elementHeight&&this.model.elementHeight.indexOf("%")!=-1,e.handle<20&&!a&&(e.handle=20),e.onePx=e.scrollable/(e.handleSpace-e.handle),e.fromScroller=!1,e.up=!0,e.vInterval=s},_updateLayout:function(e){this.element.height(this.model.height),this.element.width(this.model.width),this.element.find("."+e.css+"scroll").css(e.dimension,e.modelDim+"px").find(".e-button").css(e.dimension,this.model.buttonSize).end().find("."+e.css+"handlespace").css(e.dimension,e.handleSpace+"px").find("."+e.css+"handle").css(e.dimension,e.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(e,i,s,a){this._scrollData;if(!s)if(this.model.orientation===t.ScrollBar.Orientation.Horizontal){if(this._trigger("scroll",{source:i||"custom",scrollData:this._scrollData,scrollLeft:e,originalEvent:a}))return}else if(this._trigger("scroll",{source:i||"custom",scrollData:this._scrollData,scrollTop:e,originalEvent:a}))return;this.value(e),this.content().length>0&&(this.model.orientation===t.ScrollBar.Orientation.Horizontal?this.content()[0].style.left=(e-this.model.minimum)/this._scrollData.onePx+"px":this.content()[0].style.top=(e-this.model.minimum)/this._scrollData.onePx+"px")},_changeTop:function(e,t,i){var s,a;return s="height"===e.dimension?this.value():this.value(),a=s+t,e.step=t,e.enableRTL&&t<0||t>0&&!e.enableRTL?e.enableRTL?athis.model.maximum&&(a=this.model.maximum):e.enableRTL?a>this.model.minimum&&(a=this.model.minimum):a0: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)),s=Math.ceil(r*this._data.onePx),this.scroll(s,"thumb")):(s=o*this._data.onePx,this._changeTop(this._data,s,"thumb",this._d)),this._trigger("thumbMove",{originalEvent:i,scrollData:this._data})),1===a&&(this._prevY=n)},_spaceMouseDown:function(i){var s,a,n;i.data&&this._enabled&&(s=i.data.d,1===i.which&&i.target!==this[s.handler][0])&&(a=i.data.step?this.model.smallChange:this.model.largeChange,n=i.data.top||this[s.handler].offset()[s.lPosition],i[s.clientXy]=i[s.clientXy]||0,i[s.clientXy]i[s.clientXy])&&(s.up=!0),s.up?void clearInterval(s.vInterval):(this._changeTop(s,a,3===a?"track":"button",i),void(n=i.data?i.data.top||this[s.handler].offset()[s.lPosition]:this[s.handler].offset()[s.lPosition]))},this),150),e(document).one("mouseup",{d:s},t.proxy(this._mouseUp,this)),e(document).mouseout({d:s},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(e,t,i,s){"use strict";t.widget("ejScroller","ej.Scroller",{_addToPersist:["scrollLeft","scrollTop"],defaults:{height:250,autoHide:!1,width:0,scrollOneStepBy:57,buttonSize:18,scrollLeft:0,scrollTop:0,targetPane:null,scrollerSize:18,enablePersistence:!1,enableRTL:s,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===s&&(this.model.enableRTL="rtl"===this.element.css("direction")),this._ensureScrollers(),this.model.enableRTL&&(this.element.addClass("e-rtl"),this._rtlScrollLeftValue=this.content().scrollLeft()),this._on(this.content(),"scroll",this._scroll),null!=this.model.targetPane&&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.element.addClass("e-autohide"),this._on(this.element,"mouseenter mouseleave",this._scrollerHover),this.content().siblings().hide()),this.model.enabled?this.enable():this.disable(),this._setDimension(),(this._prevScrollWidth!==this.content()[0].scrollWidth||this._prevScrollHeight!==this.content()[0].scrollHeight)&&this.refresh())},_setDimension:function(){t.isNullOrUndefined(this.model.height)||"string"!=typeof this.model.height||this.model.height.indexOf("%")==-1||(this._vScroll?this.model.height=this._convertPercentageToPixel(parseInt(this._eleHeight),this.element.parent().height()):e(this.content()[0]).height("")),t.isNullOrUndefined(this.model.width)||"string"!=typeof this.model.width||this.model.width.indexOf("%")==-1||(this._hScroll?this.model.width=this._convertPercentageToPixel(parseInt(this._eleWidth),this.element.parent().width()):e(this.content()[0]).width(""))},_setScrollLeftValue:function(e){this.model.enableRTL&&(e="mozilla"==t.browserInfo().name?e<0?e:e*-1:!t.isNullOrUndefined(this._rtlScrollLeftValue)&&("chrome"==t.browserInfo().name||this._rtlScrollLeftValue>0)?e<0?this._rtlScrollLeftValue+e:this._rtlScrollLeftValue-e:Math.abs(e)),this.content().scrollLeft(e)},_ensureScrollers:function(){var s,a,n,o,r,l=e.fn.jquery;this.model.height="string"==typeof this.model.height&&this.model.height.indexOf("px")!=-1?parseInt(this.model.height):this.model.height,this.model.width="string"==typeof this.model.width&&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&&(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?(this.content().addClass("e-content"),"1.7.1"===l||"1.7.2"===l?(s="height",a="width"):(s="outerHeight",a="outerWidth"),n=this._exactElementDimension(this.element),o=n.height-(this.border_bottom+this.border_top+this.padding_bottom+this.padding_top),this.content()[s](o-(this._hScroll&&!this.model.autoHide?this.model.scrollerSize:0)),r=n.width-(this.border_left+this.border_right+this.padding_left+this.padding_right),this.content()[a](r-(this._vScroll&&!this.model.autoHide?this.model.scrollerSize:0)),isNaN(this._eleWidth)&&this._eleWidth.indexOf("%")>0&&isNaN(this._eleHeight)&&this._eleHeight.indexOf("%")>0&&e(i).bind("resize",e.proxy(this._resetScroller,this))):this.content().removeClass("e-content"),this._setDimension(),this._parentHeight=e(this.element).parent().height(),this._parentWidth=e(this.element).parent().width())},_convertPercentageToPixel:function(e,t){return Math.floor(e*t/100)},isHScroll:function(){if(!t.isNullOrUndefined(this.model.width)&&"string"==typeof this.model.width&&this.model.width.indexOf("%")!=-1)return this.content()[0].scrollWidth>this.element.width();if(this.model.width>0){var e=this.content().find(this.model.targetPane);return null!=this.model.targetPane&&e.length?e[0].scrollWidth+e.siblings().width()>this.model.width:this.content()[0].scrollWidth>this.model.width}return!1},isVScroll:function(){return t.isNullOrUndefined(this.model.height)||"string"!=typeof this.model.height||this.model.height.indexOf("%")==-1?this.model.height>0&&this.content()[0].scrollHeight>this.model.height:this.content()[0].scrollHeight>this.element.outerHeight()},_setModel:function(e){var i,s;for(i in e)if("enableRTL"===i)e[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));else if("scrollLeft"===i)parseFloat(e[i])<0&&(e[i]=0),this._setScrollLeftValue(parseFloat(e[i])),this.scrollLeft(e[i]),t.isNullOrUndefined(this._hScrollbar)||this._hScrollbar.scroll(parseFloat(e[i]),"",!0);else if("scrollTop"===i)parseFloat(e[i])<0&&(e[i]=0),this.content().scrollTop(parseFloat(e[i])),this.scrollTop(e[i]),t.isNullOrUndefined(this._vScrollbar)||(s=(this._vScrollbar.element.find(".e-vhandlespace").height()-this._vScrollbar.element.find(".e-vhandle").outerHeight())*this._scrollYdata.onePx,e[i]=s0?e(this.element.children(".e-hscrollbar")).before(u):this.element.append(u),e(u).ejScrollBar({elementHeight:c._eleHeight,elementWidth:c._eleWidth,buttonSize:c.model.buttonSize,orientation:i,viewportSize:a,height:o,width:n,maximum:r-a,value:l,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)}),h=e(u).ejScrollBar("instance"),i!==t.ScrollBar.Orientation.Vertical&&s||this._off(this.element,"msie"==this._browser?"wheel mousewheel":"mousewheel DOMMouseScroll",this._mouseWheel)._on(this.element,"msie"==this._browser?"wheel mousewheel":"mousewheel DOMMouseScroll",{d:h._scrollData},this._mouseWheel),i===t.ScrollBar.Orientation.Horizontal?this._scrollXdata=h._scrollData:this._scrollYdata=h._scrollData,i===t.ScrollBar.Orientation.Horizontal&&this.model.enableRTL&&(h._scrollData.enableRTL=!0),h._enabled=this.model.enabled,h},_updateScrollbar:function(i,s){var a=i===t.ScrollBar.Orientation.Vertical?this._vScrollbar:this._hScrollbar;a&&(i===t.ScrollBar.Orientation.Vertical?(a.model.width=this.model.scrollerSize,a.model.height=a.model.viewportSize=this.model.height-(s?this.model.scrollerSize:0),a.model.maximum=this.content()[0].scrollHeight-a.model.viewportSize,a.model.value=this.scrollTop()):(a.model.width=a.model.viewportSize=this.model.width-(s?this.model.scrollerSize:0),a.model.height=this.model.scrollerSize,a.model.maximum=(null!=this.model.targetPane&&this.content().find(this.model.targetPane).length>0?this.content().find(this.model.targetPane)[0].scrollWidth+(this.content().width()-e(this.model.targetPane).outerWidth()):this.content()[0].scrollWidth)-a.model.viewportSize,this.model.enableRTL||(a.model.value=this.scrollLeft())))},_scrollChanged:function(i){this._updateScroll=!0,i.scrollTop!==s?this.scrollY(i.scrollTop,!0,"",i.source):i.scrollLeft!==s&&this.scrollX(i.scrollLeft,!0,"",i.source),this._updateScroll=!1;var a=this;e.when(this.content()).done(t.proxy(function(){a._trigger("scrollEnd",{scrollData:i})}))},_bindBlurEvent:function(s,a){this._scrollEle=e(s).data("ejScrollBar"),this._event=a;this._listener=function(){this._scrollEle._off(e(document),"mousemove touchmove",this._scrollEle._mouseMove),e(document).off("mouseup touchend",t.proxy(this._scrollEle._mouseUp,this._scrollEle)),this._scrollEle._prevY=null,this._off(e(document),"mousemove touchmove",this._mouseMove),this._off(e(document),"mouseup touchend",this._mouseUp),this._off(e(i),"blur"),"e-vhandle"===this._evtData.handler?this._scrollEle._trigger("thumbEnd",{originalEvent:this._event,scrollData:this._evtData}):this._scrollEle._trigger("thumbEnd",{originalEvent:this._event,scrollData:this._evtData})},this._on(e(i),"blur",this._listener)},_thumbStart:function(e){this._evtData=e.scrollData;var t="e-vhandle"===e.scrollData.handler?this.element.find("."+e.scrollData.handler).closest(".e-scrollbar"):this.element.find("."+e.scrollData.handler).closest(".e-scrollbar"),t="e-vhandle"===e.scrollData.handler?this.element.find("."+e.scrollData.handler).closest(".e-scrollbar"):this.element.find("."+e.scrollData.handler).closest(".e-scrollbar");this._bindBlurEvent(t,e),this._trigger("thumbStart",e)},_thumbMove:function(e){this._trigger("thumbMove",e)},_thumbEnd:function(t){this._trigger("thumbEnd",t),this._off(e(i),"blur")},refresh:function(i){var s,a;i||this.element.find(">.e-content").removeAttr("style"),t.isNullOrUndefined(this._eleHeight)||"string"!=typeof this._eleHeight||this._eleHeight.indexOf("%")==-1||this._parentHeight==e(this.element).parent().height()||(s=this._exactElementDimension(this.element.parent()),s=s.height-(this.border_bottom+this.border_top+this.padding_bottom+this.padding_top),this.model.height=this._convertPercentageToPixel(parseInt(this._eleHeight),s)),t.isNullOrUndefined(this._eleWidth)||"string"!=typeof this._eleWidth||this._eleWidth.indexOf("%")==-1||this._parentWidth==e(this.element).parent().width()||(s=this._exactElementDimension(this.element.parent()),s=s.width-(this.border_left+this.border_right+this.padding_left+this.padding_right),this.model.width=this._convertPercentageToPixel(parseInt(this._eleWidth),s)),this._ensureScrollers(),a=this.scrollLeft(),this.model.enableRTL?(this.element.hasClass("e-rtl")||this.element.addClass("e-rtl"),this._rtlScrollLeftValue=this.content().scrollLeft(),a>0?this.content().scrollLeft(a):this._setScrollLeftValue(a)):this.content().scrollLeft(a),(this.scrollTop()&&null==this._vScrollbar||null!==this._vScrollbar&&null!=this._vScrollbar._scrollData&&!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)),"msie"==t.browserInfo().name&&"8.0"==t.browserInfo().version?this.element.find(".e-hhandle").css("left","0px"):null!=this.model.targetPane&&this._on(this.content().find(this.model.targetPane),"scroll",this._scroll)},_exactElementDimension:function(e){var t,i,s,a=e.get(0).getBoundingClientRect(),n=["left","right","top","bottom"];for(t=a.width?a.width:a.right-a.left,i=a.height?a.height:a.bottom-a.top,s=0;se.scrollable)&&(n=e.scrollable),(e.enableRTL?n>0:n<0)&&(n=0),n!==o&&(this["scroll"+e.xy](n,!0,"",s,a),"X"!==e.xy||t.isNullOrUndefined(this._hScrollbar)?t.isNullOrUndefined(this._vScrollbar)||this._vScrollbar.scroll(n,s,!0,a):this._hScrollbar.scroll(n,s,!0,a)),n!==o},_mouseWheel:function(t){var s;if((this._vScrollbar||t.shiftKey)&&t.data&&this.model.enabled){var a,n=0,o=t.data.d,r=t;if(t=t.originalEvent,this._wheelStart&&this._trigger("wheelStart",{originalEvent:t,scrollData:r.data.d}),this._wheelStart=!1,clearTimeout(e.data(this,"timer")),1!=this._wheelx&&(0==t.wheelDeltaX||0==t.wheelDeltaY)&&(this._wheelx=1),0==navigator.platform.indexOf("Mac")&&0==this._wheelx&&("webkit"==this._browser||"chrome"==this._browser))return!0;"mozilla"==this._browser?t.axis==t.HORIZONTAL_AXIS?o=this._scrollXdata:this._scrollYdata:"msie"==this._browser?(t.deltaX?o=this._scrollXdata:this._scrollYdata,n=t.deltaX/120):this._wheelx&&0!=t.wheelDeltaX&&0==t.wheelDeltaY&&this._scrollXdata&&(o=this._scrollXdata),0==t.wheelDeltaX&&(this._wheelx=t.wheelDeltaX),t.wheelDelta?(n=0==navigator.platform.indexOf("Mac")?-t.wheelDelta/3:-t.wheelDelta/120,i.opera&&parseFloat(i.opera.version,10)<10&&(n=-n)):t.detail&&(n=t.detail/3),n&&(r.originalEvent&&(a=r.originalEvent.wheelDelta&&r.originalEvent.wheelDelta>0||r.originalEvent.detail&&r.originalEvent.detail<0?-1:1),this._changeTop(o,n*o.scrollOneStepBy,"wheel",t)?(t.preventDefault?t.preventDefault():r.preventDefault(),r.stopImmediatePropagation(),r.stopPropagation(),this._trigger("wheelMove",{originalEvent:t,scrollData:r.data.d,direction:a})):(this._trigger("scrollEnd",{originalEvent:t,scrollData:r}),this._wheelx=0),s=this,e.data(this,"timer",setTimeout(function(){s._wheelStart=!0,s._trigger("wheelStop",{originalEvent:t,scrollData:r.data.d,direction:a})},250)))}},_scrollerHover:function(e){"mouseenter"!=e.type||this.content().siblings().is(":visible")?"mouseleave"==e.type&&this.content().siblings().hide():this.content().siblings().css("display","block")},_mouseUp:function(s){if(s.data){var a=s.data.d;"mouseup"!==s.type&&"touchend"!==s.type&&(s.toElement||s.relatedTarget)||(this._off(e(document),"mousemove touchmove"),this._off(e(document),"mouseup touchend",this._mouseUp),a.fromScroller=!1,this._mouseMoved!==!0||"thumb"!==s.data.source||t.isNullOrUndefined(this.model)||(e.when(this.content()).done(t.proxy(function(){this._trigger("thumbEnd",{originalEvent:s,scrollData:a})},this)),this._off(e(i),"blur"))),a.up=!0}},_mouseDownOnContent:function(s){var a,n;if(this.model.enabled&&(a=s.data.d,this._evtData=s.data,n="e-vhandle"===a.handler?this.element.find("."+a.handler).closest(".e-scrollbar"):this.element.find("."+a.handler).closest(".e-scrollbar"),this._bindBlurEvent(n,s),!this._trigger("thumbStart",{originalEvent:s,scrollData:a}))&&(3!=s.which||2!=s.button)){a.fromScroller=!0;var o,r=null,l=1,d=5;this._document=e(document),this._window=e(i),this._mouseMove=function(e){var i,s,n;return e.preventDefault(),"iframe"===e.target.tagName.toLowerCase()||"html"===e.target.tagName.toLowerCase()?(e.type="mouseup",void this._mouseUp(e)):(i="mousemove"==e.type?e[a.clientXy]:e.originalEvent.changedTouches[0][a.clientXy],r&&i!==r&&(this._mouseMoved=!0,s=i-r,n=this.model[a.scrollVal]-s*a.onePx/d,1==l&&Math.abs(s)>d&&(o=a.position,l=0),0==l&&(r=i),n>=0&&n<=a.scrollable&&o===a.position&&(this["scroll"+a.xy](n,!0,"","thumb"),"X"===a.xy?this._hScrollbar.scroll(n,"thumb",!0):t.isNullOrUndefined(this._vScrollbar)||this._vScrollbar.scroll(n,"thumb",!0),this.content().css("cursor","pointer"),this._trigger("thumbMove",{originalEvent:e,scrollData:a}))),void(null==r&&(r=i)))},this._on(e(document),"mousemove touchmove",{d:a,source:"thumb"},this._mouseMove),this._mouseMoved=!1,this._on(e(document),"mouseup touchend",{d:a,source:"thumb"},this._mouseUp)}},_scroll:function(e){for(var i,s,a=[this._vScrollbar?this._vScrollbar._scrollData:null,this._hScrollbar?this._hScrollbar._scrollData:null],n=0;n<2;n++)if(i=a[n],i&&!i.skipChange){if(null!=this.model.targetPane&&1==n&&this.content().find(this.model.targetPane).length){if(0==this.content().find(this.model.targetPane)[0][i.scrollVal])return;i.sTop=this.content().find(this.model.targetPane)[0][i.scrollVal]}else{if(0==e.target[i.scrollVal])return;i.sTop=e.target[i.scrollVal]}if(this[i.scrollVal](i.sTop),i.fromScroller)return;1===n?(s=this.content()[0],this._rtlScrollLeftValue&&s.scrollWidth-s.clientWidth!=this._rtlScrollLeftValue&&(this._rtlScrollLeftValue=s.scrollWidth-s.clientWidth),i.sTop="mozilla"!=t.browserInfo().name&&this.model.enableRTL?0==this._rtlScrollLeftValue?i.sTop*-1:i.sTop-this._rtlScrollLeftValue:i.sTop,this._hScrollbar.scroll(i.sTop,"",!0)):this._vScrollbar.scroll(i.sTop,"",!0)}},_changevHandlerPosition:function(e){var t=this._vScrollbar;t&&(e=null!=t._scrollData&&e>=t._scrollData.scrollable?t._scrollData.scrollable:e,null!=t&&e>=0&&e<=t._scrollData.scrollable&&t[t._scrollData.handler].css(t._scrollData.lPosition,e/t._scrollData.onePx+"px"))},_changehHandlerPosition:function(e){var t=this._hScrollbar;t&&(e=null!=t._scrollData&&e>=t._scrollData.scrollable?t._scrollData.scrollable:e,null!=t&&top>=0&&e<=t._scrollData.scrollable&&t[t._scrollData.handler].css(t._scrollData.lPosition,e/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:""})}})}(jQuery,Syncfusion,window),function(){function e(e,t){return 0===e.indexOf(t)}function t(e,t){return e.substr(e.length-t.length)===t}function i(e){return(e+"").replace(C,"")}function s(e){return isNaN(e)?NaN:Math[e<0?"ceil":"floor"](e)}function a(e,t,i){for(var s=e.length;s1?parseInt(u[1],10):0;h=u[0],u=h.split("."),h=u[0],c=u.length>1?u[1]:"",m>0?(c=a(c,m,!1),h+=c.slice(0,m),c=c.substr(m)):m<0&&(m=-m,h=a(h,m+1),c=h.slice(-m,h.length)+c,h=h.slice(0,-m)),s=i["."]||".",c=t>0?s+(c.length>t?c.slice(0,t):a(c,t)):"";for(var p=h.length-1,g=i[","]||",",_="";p>=0;){if(0===o||o>p)return h.slice(0,p+1)+(_.length?g+_+c:c);_=h.slice(p-o+1,p+1)+(_.length?g+_:""),p-=o,r1&&(u=parseInt(t.slice(1),10)),n=t.charAt(0).toUpperCase()){case"D":d="n",c=s(c),u!==-1&&(c=a(""+c,u,!0)),e<0&&(c=-c);break;case"N":r=h,r.pattern=r.pattern||["-n"];case"C":r=r||h.currency,r.pattern=r.pattern||["-$n","$n"];case"P":r=r||h.percent,r.pattern=r.pattern||["-n %","n %"],d=e<0?r.pattern[0]||"-n":r.pattern[1]||"n",u===-1&&(u=r.decimals),c=o(c*("P"===n?100:1),u,r);break;default:throw"Bad number format specifier: "+n}return l(c,d,h)}function l(e,t,i){for(var s,a,n=/n|\$|-|%/g,o="";s=n.lastIndex,a=n.exec(t),o+=t.slice(s,a?a.index:t.length),a;)switch(a[0]){case"n":o+=e;break;case"$":o+=i.currency.symbol||"$";break;case"-":/[1-9]/.test(e)&&(o+=i["-"]||"-");break;case"%":o+=i.percent.symbol||"%"}return o}function d(e,t,i){return ei}function h(e,t){var i,s,a=new Date;return t<100&&(i=e.twoDigitYearMax,i="string"==typeof i?(new Date).getFullYear()%100+parseInt(i,10):i,s=a.getFullYear(),t+=s-s%100,t>i&&(t-=100)),t}function c(e,t){if(e.indexOf)return e.indexOf(t);for(var i=0,s=e.length;i1&&s.length-1?(e=e.replace(s.numberFormat.currency.symbol||"$",""),e=e.replace(s.numberFormat.currency["."]||".",s.numberFormat["."]||"."),b=i(s.numberFormat.currency.pattern[0].replace("$",""))):e.indexOf(s.numberFormat.percent.symbol)>-1&&(e=e.replace(s.numberFormat.percent.symbol||"%",""),e=e.replace(s.numberFormat.percent["."]||".",s.numberFormat["."]||"."),b=i(s.numberFormat.percent.pattern[0].replace("%",""))),e=i(e),S.test(e))_=parseFloat(e,t);else if(!t&&T.test(e))_=parseInt(e,16);else{var v=n(e,f,b),x=v[0],w=v[1];""===x&&"-n"!==f.pattern[0]&&(v=n(e,f,"-n"),x=v[0],w=v[1]),x=x||"+",r=w.indexOf("e"),r<0&&(r=w.indexOf("E")),r<0?(o=w,a=null):(o=w.substr(0,r),a=w.substr(r+1)),h=f["."]||".",c=o.indexOf(h),c<0?(l=o,d=null):(l=o.substr(0,c),d=o.substr(c+h.length)),u=f[","]||",",l=l.split(u).join(""),m=u.replace(/\u00A0/g," "),u!==m&&(l=l.split(m).join("")),p=x+l,null!==d&&(p+="."+d),null!==a&&(g=n(a,f,b),p+="e"+(g[0]||"+")+g[1]),D.test(p)&&(_=parseFloat(p))}return _},ej.globalize.parseDate=function(e,t,i){var s,a,n,o,r,l;if(i=this.preferredCulture(i),t){if("string"==typeof t&&(t=[t]),t.length)for(o=0,r=t.length;o-1&&(this.majorimgtag=t.buildTag("span.e-icon "+this.model.prefixIcon),this.minorimgtag=t.buildTag("span.e-icon "+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.text(this.model.text))},_roundedCorner:function(e){1==e?this.element.addClass("e-corner"):this.element.removeClass("e-corner")},_wireEvents:function(t){t&&(this._on(this.element,"mousedown",this._btnRepatMouseClickEvent),this._on(e(document),"mouseup",this._mouseUpClick),this._on(this.element,"keyup",this._btnRepatKeyUpEvent),this._on(e(document),"keypress",this._btnRepatKeyDownEvent)),this._on(this.element,"click",this._btnMouseClickEvent)},_btnMouseClickEvent:function(e){var t,i=this;i.element.hasClass("e-disable")||(t={status:i.model.enabled,e:e},i._trigger("click",t))},_btnRepatMouseClickEvent:function(e){var t,i=this;i.element.hasClass("e-disable")||(t={status:i.model.enabled},(0==e.button||1==e.which)&&(i._timeout=setInterval(function(){i._trigger("click",{target:e.currentTarget,status:i.model.enabled})},this.model.timeInterval)))},_mouseUpClick:function(){clearTimeout(this._timeout)},_btnRepatKeyDownEvent:function(e){var t,i=this;i.element.hasClass("e-disable")||(t={status:i.model.enabled},(32==e.keyCode||13==e.keyCode)&&i._trigger("click",t))},_btnRepatKeyUpEvent:function(e){(32==e.keyCode||13==e.keyCode)&&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(e,t){function i(){this.constructor=e}for(var s=0;s=",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="msie"==ej.browserInfo().name&&"8.0"==ej.browserInfo().version,this._addFunction=function(e,t){return e=e.toUpperCase(),this._libraryFunctions.getItem(e)==undefined&&(this._libraryFunctions.add(e,t),!0)},this._addToFormulaDependentCells=function(e){var t,i=this.cell,s=CalcEngine.getSheetFamilyItem(this.grid);null!=s.sheetNameToParentObject&&i.indexOf(this.sheetToken)==-1&&(t=s.parentObjectToToken.getItem(this.grid),i=t+i),this.getDependentFormulaCells().containsKey(i)?this.getDependentFormulaCells().getItem(i).containsKey(e)||this.getDependentFormulaCells().getItem(i).add(e,e):(this.getDependentFormulaCells().add(i,new HashTable),this.getDependentFormulaCells().getItem(i).add(e,e))},this._arrayRemove=function(e,t){for(var i=null;(i=e.indexOf(t))!==-1;)e.splice(i,1);return e},this._canGetRowIndex=function(e){var t=0;if(t-1&&(t=e.substring(i+1),this._namedRangesNonScoped.containsKey(t)||this._namedRangesNonScoped.add(t,this.namedRanges.getItem(e)))},this._checkHasCharBeforeNumber=function(e){for(var t=!1,i=e.length-1;i>0;i--)if(this._isLetter(e[i])){t=!0;break}return t},this._checkIfScopedRange=function(e,t){var i,s,a,n,o;t="";var r="NaN",l=this.getSheetID(this.grid),d=CalcEngine.getSheetFamilyItem(this.grid);if(e[0]==this.sheetToken.toString()&&(i=e.indexOf(this.sheetToken,1),i>1&&!isNaN(parseInt(e.substring(1,i-1)))&&(e=e.substring(i+1))),s="!"+l.toString()+"!",null==d.sheetNameToToken)return r;for(a=d.sheetNameToToken.keys(),n=0;nthis._absoluteZero?Math.abs((e-t)/t)1;)n=i.pop().toString(),o=n==this.tic+this.tic?o+this.tic:n+o,a=3==s?n:a,s--;i[0]==this.tic+this.tic&&i.pop(),o=e.length==t&&this._isTextEmpty(a.split(this.tic).join(""))?o+a:o,i.push(o)}return i},this._computeMath=function(e,t){var i,s,a,n,o,r,l,d,h,c,u=0,m=!1;if(e.length>0&&(e=this.splitArgsPreservingQuotedCommas(e)[0]),s=[this.getParseArgumentSeparator(),":"],e.length>0&&(!this._isLetter(e[0])&&e[0]!=this.sheetToken&&e[0]!=this.bMARKER||"u"==e[0]&&this._isDigit(e[1]))&&this._indexOfAny(e,s)==-1){if(e=e.split("u").join("-").split("n").join(""),a=this._parseDouble(e),isNaN(a))return this.getErrorStrings()[1].toString();u=t(a)}else if(e.length>0&&(e[0]==this.bMARKER||"u"==e[0]||"n"==e[0]||this._indexOfAny(e,this.tokens)>-1)){e=e.split("{").join("("),e=e.split("}").join(")"),n="",o=Math.PI.toString();try{e.indexOf(o)>-1?(i=this._substring(e,1,e.indexOf(o)-2),i=this._isTextEmpty(i)?"1":i,n=this._indexOfAny(e,this.tokens)>-1?e.split(o.toString())[1]:"1",m=!0):i=this.computedValue(e)}catch(e){if(this._rethrowLibraryComputationExceptions&&null!=this.getLibraryComputationException())throw this.getLibraryComputationException();return e}if(m)if(r=this.computedValue(i.toString()),n.indexOf("180")>-1){if(!(a=this._parseDouble(r)))return this.getErrorStrings()[1].toString();u=t(a*(Math.PI/180))}else{if(l=this.computedValue(r+n),d=this._parseDouble(l),isNaN(d))return this.getErrorStrings()[1].toString();u=t(d*Math.PI)}else{if(a=this._parseDouble(i),isNaN(a))return this.getErrorStrings()[1].toString();u=t(a)}}else for(e=e.split("u").join("-"),h=this.getCellsFromArgs(e),c=0;c0){if(a=this._parseDouble(i),isNaN(a))return this.getErrorStrings()[1].toString();u=t(a)}break}return this.computeIsErr(u.toString())==this.trueValueStr?this.getErrorStrings()[4].toString():u.toString()},this._computeInteriorFunctions=function(e){var t,i,s,a;try{if(this._isTextEmpty(e))return e;for(this.computeFunctionLevel++,t=this._findLastqNotInBrackets(e);t>0;){if(i=e.substring(t).indexOf(this._rightBracket),i==-1)throw this.formulaErrorStrings[this._bad_formula];this._isInteriorFunction=!0,s=this._substring(e,t,i+1),s=this.computedValue(s),""==s||s[0]!=this.tic[0]||s[s.length-1]!=this.tic[0]||(a=this._substring(s,1,s.length-2),a.indexOf(this.tic)!=-1&&(this._multiTick=!0,a=a.split(this.tic).join("|")),s=this.tic+a+this.tic),s=this._markupResultToIncludeInFormula(s),e=this._isInteriorFunction?e.substring(0,t)+s+e.substring(t+i+1):e.substring(0,t)+s.split(this.tic).join("")+e.substring(t+i+1),this._isInteriorFunction=!1,t=this._findLastqNotInBrackets(e)}}catch(e){return e}finally{this.computeFunctionLevel--}return e},this._findAndCheckPrecedingChar=function(e,t,i){var s=e.indexOf(t,i);if(s>0)for(;s>-1&&this.getValidPrecedingChars().indexOf(e[s-1])==-1;)s=e.indexOf(t,s+1);return this._findAndCheckPrecedingCharCopy=e,s},this._findLastNonQB=function(e){var t,i,s=-1;if(e.indexOf(this.bMARKER)>-1)for(t=0,i=e.length-1;i>=0;--i)if(e[i]==this._rightBracket)t--;else if(e[i]==this._leftBracket)t++;else if(e[i]==this.bMARKER&&0==t){s=i;break}return s};this._findLastqNotInBrackets=function(e){for(var t=-1,i=!1,s=e.length-1;s>-1;){if("q"==e[s]&&i){t=s;break}e[s]==this._leftBracket?i=!0:e[s]==this._rightBracket&&(i=!1),s--}return t};this._findNextSeparator=function(e,t){for(var i=0,s=!1;!s&&t-1)for(t=0,i=0;i59&&(e-=1),new Date(this._oaDate.setDate(this._oaDate.getDate()+e))};var _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(e){var t,i,s,a,n,o="",r=[];for(e=this.adjustRangeArg(e),i=this.splitArgsPreservingQuotedCommas(e),s=0;s-1)for(a=this.getCellsFromArgs(i[s]),n=0;n0&&(t=this._parseDouble(o),isNaN(t)?r.push(0):r.push(Number(t)));else o=this.getValueFromArg(i[s]),t=this._parseDouble(o),isNaN(Number(t))?r.push(0):r.push(t);return r},this._getDoubleArrayA=function(e){var t,i,s,a,n,o="",r=[];for(e=this.adjustRangeArg(e),i=this.splitArgsPreservingQuotedCommas(e),s=0;s-1)for(a=this.getCellsFromArgs(i[s]),n=0;n0&&(o==this.trueValueStr||o==this.falseValueStr?t=0:(t=this._parseDouble(o),isNaN(Number(t))&&0==t),r.push(t));else o=this.getValueFromArg(i[s]),o==this.trueValueStr||o==this.falseValueStr?t=0:(t=this._parseDouble(o.toString()),isNaN(t)&&0==t),r.push(t);return r},this._getFormulaArrayBounds=function(e,t,i){var s,a,n,o,r=this.colIndex(this.cell),l=this.rowIndex(this.cell),d="",h=this.getFormulaInfoTable().containsKey(this.cell)?this.getFormulaInfoTable().getItem(this.cell):null;for(d=null!=h?h.getFormulaText():this.parentObject.getValueRowCol==undefined?this.getValueRowCol(this.getSheetID(this.grid)+1,l,r).toString():this.parentObject.getValueRowCol(this.getSheetID(this.grid)+1,l,r).toString(),s=1,a=1,n=1;n<=t;n++)if(r-n>0){var c=this._getSheetTokenFromReference(this.cell)+RangeInfo.getAlphaLabel(r-n)+l.toString(),u="",m=this.getFormulaInfoTable().containsKey(c)?this.getFormulaInfoTable().getItem(c):null;if(u=null!=m?m.getFormulaText():this.parentObject.getValueRowCol==undefined?this.getValueRowCol(this.getSheetID(this.grid)+1,l,r-n).toString():this.parentObject.getValueRowCol(this.getSheetID(this.grid)+1,l,r-n).toString(),a=r-n,null!=d&&u!=d){a++;break}}for(o=1;o<=i;o++)if(l-o>0){var c=this._getSheetTokenFromReference(this.cell)+RangeInfo.getAlphaLabel(a)+(l-o).toString(),u="",m=this.getFormulaInfoTable().containsKey(c)?this.getFormulaInfoTable().getItem(c):null;if(u=null!=m?m.getFormulaText():this.parentObject.getValueRowCol==undefined?this.getValueRowCol(this.getSheetID(this.grid)+1,l-o,a).toString():this.parentObject.getValueRowCol(this.getSheetID(this.grid)+1,l-o,a).toString(),s=l-o,null!=d&&u!=d){s++;break}}return this._getFormulaArrayBoundsfirstRowIndex=s,this._getFormulaArrayBoundsfirstColIndex=a,this._getFormulaArrayBoundslastRowIndex=s+t,this._getFormulaArrayBoundslastColIndex=a+i,!0},this._getSerialDateFromDate=function(e,t,i){var s,a,n,o=0;for(e<1900&&(e+=1900),s=!1;!s;){for(;t>12;)e++,t-=12;for(s=!0,a=new Date(e,t,1,-1).getDate();i>a;)a=new Date(e,t,1,-1).getDate(),t++,i-=a,s=!1;i<1&&(t--,a=new Date(e,t,1,-1).getDate(),i=a-i)}return n=Date.parse(e.toString()+this.getParseDateTimeSeparator()+t.toString()+this.getParseDateTimeSeparator()+i.toString()),isNaN(n)||(o=this._toOADate(new Date(n))),this.treat1900AsLeapYear&&o>59&&(o+=1),o},this._getSerialDateTimeFromDate=function(e){var t=this._toOADate(e);return this.treat1900AsLeapYear&&t>59&&(t+=1),t},this._getSheetTokenFromReference=function(e){var t,i="";if(e.length>2&&e[0]==this.sheetToken){for(t=1,i=this.sheetToken;t0&&a[0]==this.getFormulaCharacter()&&null==l){l=new FormulaInfo,l.setFormulaText(s.toString()),this.getDependentFormulaCells().containsKey(this.cell)||this.getDependentFormulaCells().add(this.cell,new HashTable),n=!0;try{l.setParsedFormula(this.parseFormula(a))}catch(e){this._inAPull?(a=e,l=null):l.setFormulaValue(e),n=!1}n&&(l.setFormulaValue(this.computeFormula(l.getParsedFormula())),r=!0),null!=l&&(l.calcID=this._calcID,this.getFormulaInfoTable().containsKey(this.cell)||this.getFormulaInfoTable().add(this.cell,l),a=null!=l.getFormulaValue()?l.getFormulaValue():"")}return null!=l&&(this.getUseFormulaValues()||this.getCalculatingSuspended()&&(!this._inAPull||r)?a=null!=l.getFormulaValue()?l.getFormulaValue():"":r||(this._calcID==l.calcID?a=l.getFormulaValue():(a=this.computeFormula(l.getParsedFormula()),l.setFormulaValue(a),l.calcID=this._calcID)),this.getTreatStringsAsZero()&&""==a)?"0":((""==a||a==undefined)&&(a=""),o=this._parseDouble(a.substring(0,a.length-1)),"%"!=a[a.length-1]||isNaN(o)||(a=(Number(o)/100).toString()),a)},this._handleEmbeddedEs=function(e){for(var t,i,s=0;s>-1&&(s=e.indexOf(this._string_EP,s))>-1;){if(this._notInBlock(e,s)){for(t=s;t>0&&(this._isDigit(e[t-1])||e[t-1]==this.getParseDecimalSeparator());)t--;if(t!=s&&(0==t||!this._isUpperChar(e[t-1]))){for(i=s+this._string_EP.length;i-1&&(s=e.indexOf(this._string_EM,s))>-1;){if(this._notInBlock(e,s)){for(t=s;t>0&&(this._isDigit(e[t-1])||e[t-1]==this.getParseDecimalSeparator());)t--;if(t!=s&&(0==t||!this._isUpperChar(e[t-1]))){for(i=s+this._string_EM.length;i-1&&(s=e.indexOf(this._string_E,s))>-1&&e[0]!=this.bMARKER;){if(this._notInBlock(e,s)){for(t=s;t>0&&(this._isDigit(e[t-1])||e[t-1]==this.getParseDecimalSeparator());)t--;if(t!=s&&(0==t||!this._isUpperChar(e[t-1]))){for(i=s+this._string_E.length;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("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("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("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("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._comb=function(e,t){for(var i,s=1,a=e+1;a<=t;++a)s*=a;for(i=1,a=2;a<=t-e;++a)i*=a;return s/i},this._finv=function(e,t,i){for(var s=Math.exp(this._gammaln((t+i)/2)-this._gammaln(t/2)-this._gammaln(i/2)+t/2*Math.log(t/i)),a=s,n=a/2,o=0,r=100,l=3,d=0;100==r&&l>0;)for(l--,a/=2,n=a/2,r=0;r<100&&(d++,o=1-s*this._fdist(a,t,i),!(Math.abs((o-e)/e)<1e-7));++r)o>e?a+=n:(n/=2,a-n<0&&(n=a/2),a-=n);return 100==r&&(a=-1),a},this._tProbabilityDensity=function(e,t){var i=this._gammaFunction(.5*t+.5),s=Math.pow(1+e*e/t,-.5*t-.5),a=Math.sqrt(t*Math.PI)*this._gammaFunction(.5*t);return i*s/a},this._tCumulativeDensity=function(e,t){if(isNaN(e))return NaN;if(0==e)return.5;if(e>0){var i=t/(e*e+t);return 1-.5*this._rIBetaFunction(i,.5*t,.5)}return 1-this._tCumulativeDensity(-e,t)},this._sign=function(e){return 0===e||isNaN(e)?e:e>0?1:-1},this._var=function(e){for(var t,i,s=0,a=e.length,n=0;n1)throw"Probability must be between 0 and 1";if(0==e)return Number.NEGATIVE_INFINITY;if(1==e)return Number.POSITIVE_INFINITY;if(.5==e)return 0;switch(t){case 1:return Math.tan(Math.PI*(e-.5));case 2:return i=4*e*(1-e),2*(e-.5)*Math.sqrt(2/i);case 4:var i=4*e*(1-e),l=Math.sqrt(i),d=Math.cos(1/3*Math.acos(l))/l;return 2*this._sign(e-.5)*Math.sqrt(d-1);default:for(s=t>6?this._standardNormalCumulativeDistributionFunctionInverse(e):this._tCumulativeDistributionInverse(e,4),a=0;a<50;a++){if(n=this._tCumulativeDensity(s,t),o=Math.abs(e-n),o<1e-4)return s;r=this._tProbabilityDensity(s,t),s+=(e-n)/r}throw"Solution did not converge"}},this._fdist=function(e,t,i){for(var s,a,n=32,o=0,r=e,l=(r-o)/n,d=l/3,h=this._fdensity(o,t,i)+this._fdensity(r,t,i),c=0,u=1;ut?(s=t-(e-t),a=e):(s=e,a=t+(t-e));var d=(a-s)/l,h=d/3,c=this._normaldensity(s,t,i)+this._normaldensity(a,t,i),u=0;for(o=1;ot?m+(1-m)/2:(1-m)/2},this._normaldensity=function(e,t,i){return 1/(Math.sqrt(2*Math.PI)*i)*Math.exp(-(e-t)*(e-t)/(2*i*i))},this._standardNormalCumulativeDistribution=function(e){if(e<0)return 1-this._standardNormalCumulativeDistribution(-e);var t=this._standardNormalProbabilityDensityFunction(e),i=1/(1+.2316419*e);return 1-t*(.31938153*i+-.356563782*Math.pow(i,2)+1.781477937*Math.pow(i,3)+-1.821255978*Math.pow(i,4)+1.330274429*Math.pow(i,5))},this._normalinv=function(e,t,i){var s=t;s=e<.05?t-2*i:e<.5?t:e<.95?t+2*i:t+5*i;for(var a=s/2,n=0,o=100,r=3,l=0;100==o&&r>0;)for(r--,s/=2,a=s/2,o=0;o<100&&(l++,n=this._normaldist(s,t,i),!(Math.abs((n-e)/e)<1e-7));++o)n1)throw"Probability must be between 0 and 1";if(0==e)return Number.NEGATIVE_INFINITY;if(1==e)return Number.POSITIVE_INFINITY;if(.5==e)return 0;var i,s=-.007784894002430293,a=-.3223964580411365,n=-2.400758277161838,o=-2.549732539343734,r=4.374664141464968,l=2.938163982698783,d=.007784695709041462,h=.3224671290700398,c=2.445134137142996,u=3.754408661907416,m=.02425,p=1-m;return 01)throw"Probability must be between 0 and 1";if(0==e)return Number.NEGATIVE_INFINITY;if(1==e)return Number.POSITIVE_INFINITY;if(.5==e)return 0;var i,s=-.007784894002430293,a=-.3223964580411365,n=-2.400758277161838,o=-2.549732539343734,r=4.374664141464968,l=2.938163982698783,d=.007784695709041462,h=.3224671290700398,c=2.445134137142996,u=3.754408661907416,m=.02425,p=1-m;return 01)throw"x must be between 0 and 1";return this._rIBetaFunction(e,t,i)},this._betaProbabilityDens=function(e,t,i){if(e<0||e>1)throw"x must be between 0 and 1";var s=this._betaFunction(t,i);return Math.pow(e,t-1)*Math.pow(1-e,i-1)/s},this._critbinom=function(e,t,i){var s=e,a=e,n=1,o=1;do{if(a=a/2+1,n>=i){if(o=this._binomdist(e,s-1,t),!isNaN(o))return this.maxValue;if(o0)break;s-=a}else{if(o=this._binomdist(e,s+1,t),o>=i){s+=1;break}s+=a}n=this._binomdist(e,s,t)}while(s0);return s},this._newnormalinv=function(e){var t=[-39.69683028665376,220.9460984245205,-275.9285104469687,138.357751867269,-30.66479806614716,2.506628277459239],i=[-54.47609879822406,161.5858368580409,-155.6989798598866,66.80131188771972,-13.28068155288572],s=[-.007784894002430293,-.3223964580411365,-2.400758277161838,-2.549732539343734,4.374664141464968,2.938163982698783],a=[.007784695709041462,.3224671290700398,2.445134137142996,3.754408661907416],n=.02425,o=1-n,r=0,l=0;return e0;)for(o--,i/=2,s=i/2,n=0;n<100&&(a=1-this._chidist(i,t),!(Math.abs((a-e)/e)<1e-7));++n)a>e?i+=s:(s/=2,i-s<0&&(s=i/2),i-=s);return 100==n&&(i=-1),i},this._chidist=function(e,t){var i,s=[.09654008851,.09563872008,.09384439908,.0911738787,.087652093,.08331192423,.07819389579,.07234579411,.06582222278,.05868409348,.05099805926,.04283589802,.03427386291,.02539206531,.01627439473,.00701861001],a=[.04830766569,.14447196158,.23928736225,.33186860228,.42135127613,.50689990893,.58771575724,.66304426693,.73218211874,.79448379597,.84936761373,.89632115577,.93490607594,.96476225559,.98561151155,.99726386185],n=t/2,o=1/(Math.pow(2,n)*Math.exp(this._gammaln(n)));n-=1;var r,l=0,d=e,h=(l+d)/2,c=(d-l)/2,u=0;for(i=0;i<16;++i)r=a[i]*c,u=Number(u)+Number(s[i]*(Math.pow(h+r,n)*Math.exp(-(h+r)/2)+Math.pow(h-r,n)*Math.exp(-(h-r)/2)));return Number(o)*Number(u)*Number(c)},this._gammaln=function(e){var t,i=[.918938533204673,.000595238095238,.000793650793651,.002777777777778,.083333333333333],s=e,a=0;if(s<7){for(a=s,s++;s<7;)a*=s,s<7&&s++;a=-Math.log(a)}return t=this._parseDouble((1/(s*s)).toString()),a+(s-this._parseDouble("0.5"))*Math.log(s)-s+i[0]+(((-i[1]*t+i[2])*t-i[3])*t+i[4])/s},this._pearson=function(e,t,i){for(var s=0,a=0,n=0;n=1)return 1;if(t%1==0&&i%1==0&&t+i>0)return this._rIBetaFunction1(e,t,i);if(i%1==0&&t+i<172)return this._rIBetaFunction2(e,t,i);if(t%1==0&&t+i<172)return 1-this._rIBetaFunction2(1-e,i,t);if(.5==t&&.5==i)return 2/Math.PI*Math.atan(Math.sqrt(e/(1-e)));if(.5==t&&i%.5==0)return 1-this._rIBetaFunction(1-e,i,.5);if(t%.5==0&&.5==i){if(t<45){var r=0,l=Math.round(t-.5),d=this._parseDouble(this.computeGammaln("0.5".toString()));for(a=0;a.5?1-this._rIBetaFunction(1-e,i,t):(o=this._iBetaFunction(e,t,i)/this._betaFunction(t,i),Math.max(0,Math.min(1,o)))},this._rIBetaFunction1=function(e,t,i){var s,a=0,n=t+i-1;if(n<21){for(s=t;s172)throw"Cannot currently compute RegularizedIncompleteBetaFunction for a + b > 172";for(s=0,a=1;a143?t>20?2.5066282746310002*Math.pow(e,e-.5)*Math.pow(t,t-.5)/Math.pow(e+t,e+t-.5):this._gammaFunction(t)*Math.pow(e,-t):this._gammaFunction(e)*this._gammaFunction(t)/this._gammaFunction(e+t)},this._gammaFunction=function(e){var t,i;if(e>143)throw"Cannot currently compute gamma function for z > 143";if(e>0&&e<21&&e%1==0)return this._factorial(Math.round(e-1));if(e>0&&e<11&&e%.5==0)return t=e,i=1.77245385090552,i*this._factorial(2*t)/(Math.pow(4,t)*this._factorial(t));var s=1+1/(12*e)+1/(288*e*e)-139/(51840*Math.pow(e,3))-571/(2488320*Math.pow(e,4))+163879/(209018880*Math.pow(e,5))+5246819/(75246796800*Math.pow(e,6));return Math.pow(e,e-.5)*Math.exp(-e)*2.5066282746310002*s},this._epsilon=5e-324,this._factorial=function(e){var t,i;if(e<0)throw"Factorial not defined for negative n";if(e>20)throw"Answer will exceed max long";for(t=1,i=e;i>0;i--)t*=i;return t},this._combinations=function(e,t){var i=this._logCombin(e,t),s=Math.exp(i);return Math.round(s)},this._logCombin=function(e,t){return this._logFactorial(e)-this._logFactorial(t)-this._logFactorial(e-t)},this._logFactorial=function(e){for(var t=0,i=2;i<=e;i++)t+=Math.log(i);return t},this._isCellReference=function(e){var t,i,s,a,n,o;if(""==e||(e=this.setTokensForSheets(e),t=this._sheetToken(e),i=!1,""!=t&&(e=e.split(this.sheetToken).join("")),s=!1,a=!1,e.indexOf(":")!=e.lastIndexOf(":")))return!1;for(n=e.split("").join(this.getParseArgumentSeparator()).split(this.getParseArgumentSeparator()),o=0;o-1&&e.indexOf(this.tic)==-1?!!(i&&s&&a)||!(!(s&&!a||!s&&a)||i):!(!s||!a||e.indexOf(this.tic)!=-1)},this._isDate=function(e){var t=new Date(Date.parse(e));return t>=this._dateTime1900?t:"NaN"},this._isDigit=function(e){var t=e.charCodeAt(0);return t>47&&t<58},this._isHLookupCachingEnabled=function(){return 0!=(3&this._enableLookupTableCaching)||0!=(2&this._enableLookupTableCaching)},this._isLetter=function(e){var t=e.charCodeAt(0);return t>=65&&t<=90||t>=97&&t<=122},this._isLetterOrDigit=function(e){var t=e.charCodeAt(0);return t>=48&&t<=57||t>=65&&t<=90||t>=97&&t<=122},this._isLookupCachingEnabled=function(){return 0!=(3&this._enableLookupTableCaching)||0!=(1&this._enableLookupTableCaching)||0!=(2&this._enableLookupTableCaching)},this._isOptimizedMatchesEnabled=function(){return 0!=(4&this._enableLookupTableCaching)},this._isRange=function(e){var t,i,s=!1,a=e.indexOf(":");if(a>1&&a0&&this._isDigit(e[t]);)t--;if(this._isLetter(e[t])){for(t--;t>=0&&this._isLetter(e[t]);)t--;t>-1&&e[t]==this._string_fixedreference[0]&&t--,t<0?i=!0:e[t]==this.sheetToken&&(t-- >1&&e[t]==this.tic[0]?i=0==e.substring(0,t-1).lastIndexOf(this.tic[0]):t>0&&this._isDigit(e[t])&&(i=0==e.substring(0,t).lastIndexOf(this.sheetToken)))}if(i&&(t=a+1,t64&&t<91},this._iisVLookupCachingEnabled=function(){return 0!=(3&this._enableLookupTableCaching)||0!=(1&this._enableLookupTableCaching)},this._mark=function(e,t,i,s,a){var n,o=0;for(a?(o=this._findAndCheckPrecedingChar(e,i,o),e=this._findAndCheckPrecedingCharCopy):o=e.indexOf(i),n=i.length;o>-1;)e=e.substring(0,o)+s+e.substring(o+n),t=t.substring(0,o)+s+t.substring(o+n),a?(o=this._findAndCheckPrecedingChar(e,i,o),e=this._findAndCheckPrecedingCharCopy):o=e.indexOf(i,o);return this._markCopy="",t},this._markColonsInQuotes=function(e){for(var t=!1,i=0;i-1&&i>-1){var a=this.getReservedWordOperators()[this._reservedWord_IF].length,n=i-a,o=i+this.getReservedWordOperators()[this._reservedWord_THEN].length,r=s-o,l=s+this.getReservedWordOperators()[this._reservedWord_ELSE].length,d=t.length-l;t="IF(("+this._substring(t,a,n)+")"+this.getParseArgumentSeparator()+"("+this._substring(t,o,r)+")"+this.getParseArgumentSeparator()+"("+this._substring(t,l,d)+"))",e=t}else if(i>-1){var a=0,n=i,o=i+this.getReservedWordOperators()[this._reservedWord_THEN].length,r=t.length-o+1;t="IF(("+this._substring(t,a,n)+")"+this.getParseArgumentSeparator()+"("+this._substring(t,o,r)+"))",e=t}return this._markIFCopy=t,t},this._markLibraryFormulas=function(e){var t,i,s,a,n,o,r,l,d=e.indexOf(")");if(d==-1)e=this._markNamedRanges(e);else for(;d>-1;){for(t=0,i=d-1;i>-1&&("("!=e[i]||0!=t);)")"==e[i]?t++:")"==e[i]&&t--,i--;if(i==-1)throw this.formulaErrorStrings[this._mismatched_parentheses];for(s=i-1;s>-1&&(this._isLetterOrDigit(e[s])||this._validFunctionNameChars.indexOf(e[s])>-1||e[s]==this.getParseDecimalSeparator());)s--;if(a=i-s-1,a>0&&this.getLibraryFunctions().getItem(this._substring(e,s+1,a))!=undefined)this._ignoreBracet="AREAS"==this._substring(e,s+1,a),l=this._substring(e,i,d-i+1),l=this._markNamedRanges(l),e=e.substring(0,s+1)+"q"+this._substring(e,s+1,a)+l.split("(").join(this._leftBracket).split(")").join(this._rightBracket)+e.substring(d+1);else{if(a>0){if(null!=this.unknownFunction){var h=CalcEngine.getSheetFamilyItem(this.grid),c=this.grid,u=this._sheetToken(this.cell),l=this.cell;for(u.length>0&&(c=h.tokenToParentObject.getItem(u),l=l.substring(l.lastIndexOf(this.sheetToken)+1)),n=h.sheetNameToParentObject.keys(),o=0;o0&&(l=e.substring(0,i)),l=l+"{"+this._substring(e,i+1,d-i-1)+"}",d","=","&"]),o=e.length>0&&("("==e[0]||"{"==e[0])?1:0;for(e.indexOf("#N/A")>-1&&(e=e.split("#N/A").join("#N~A")),e.indexOf("#DIV/0!")>-1&&(e=e.split("#DIV/0!").join("#DIV~0!")),t=o,t=e.indexOf("[")==-1||e.indexOf("[")>this._indexOfAny(e.substring(o),n)?this._indexOfAny(e.substring(o),n):this._findNextEndIndex(e,t);t>-1&&t+o-1?this._getTableRange(this._substring(e,o,t)):this.getNamedRanges().getItem(this._substring(e,o,t)),s==undefined||"string"==typeof s||(s=s.getItem(this._substring(e,o,t))),null==s&&(i=this._checkIfScopedRange(this._substring(e,o,t)),isNaN(i)?this._substring(e,o,t).startsWith(this.sheetToken.toString())&&(a=this._substring(e,o,t).indexOf(this.sheetToken,1),a>1&&(s=this.getNamedRanges().getItem(this._substring(e.substring(o),a+1,t-a-1)))):s=i),null!=s&&(s=s.toUpperCase(),s=this.setTokensForSheets(s),s=this._markLibraryFormulas(s)),null!=s)e=e.substring(0,o)+s+e.substring(o+t),o+=s.length+1;else for(o+=t+1;othis._indexOfAny(e.substring(o),n)?this._indexOfAny(e.substring(o),n):this._findNextEndIndex(e,t),t=this._indexOfAny(e.substring(o),n);0==t&&o-1)&&o-1?this._getTableRange(e.substring(o)):this.getNamedRanges().length>0?this.getNamedRanges().getItem(e.substring(o)):s,null==s&&(i=this._checkIfScopedRange(e.substring(o)),isNaN(i)||(s=i)),null!=s&&(s=s.toUpperCase(),s=this.setTokensForSheets(s),s=this._markLibraryFormulas(s),null!=s&&(e=e.substring(0,o)+s,o+=s.toString().length+1)),t=o-1&&(e=e.split("#N~A").join("#N/A")),e.indexOf("#DIV~0!")>-1&&(e=e.split("#DIV~0!").join("#DIV/0!")),e},this._markReserveWords=function(e){var t=e.toLowerCase(),i=this._isIE8?t.replace(/^\s+|\s+$/g,""):t.trim();return i[0]==this.getReservedWordOperators()[this._reservedWord_IF]&&(e=this._markIF(t,e),t=this._markIFCopy),e=this._mark(t,e,this.getReservedWordOperators()[this._reservedWord_NOT],this.char_NOTop,!0),t=this._markCopy,e=this._mark(t,e,this.getReservedWordOperators()[this._reservedWord_OR],this.char_ORop,!1),t=this._markCopy,e=this._mark(t,e,this.getReservedWordOperators()[this._reservedWord_AND],this.char_ANDop,!1),t=this._markCopy,e=this._mark(t,e,this.getReservedWordOperators()[this._reservedWord_XOR],this.char_XORop,!1),t=this._markCopy,e},this._markupResultToIncludeInFormula=function(e){return e.length>0&&"-"==e[0]&&!isNaN(this._parseDouble(e))?e="nu"+e.substring(1):e.length>0&&(e[0]==this.tic[0]||e[0]==this.bMARKER||"#"==e[0])||e[0]==this.trueValueStr||e[0]==this.falseValueStr||(isNaN(this._parseDouble(e))?this._isRange(e)||(e=this.tic+e+this.tic):(e=e.split(this.getParseArgumentSeparator()).join(String.fromCharCode(32)),e="n"+e)),e},this._matchCompare=function(e,t){var i=e.toString(),s=t.toString(),a=this._parseDouble(i),n=this._parseDouble(s);return isNaN(a)||isNaN(n)?i==s?0:i>s?1:-1:a==n?0:a>n?1:-1},this._matchingRightBracket=function(e){for(var t,i,s=-1,a=1,n=0,o=this._sheetToken(e);s==-1&&a-1&&i-1&&(a=e.indexOf(this.sheetToken,s+1),a>-1&&(i=this._substring(e,s,a-s+1),e=e.replace(i,""),t=e.indexOf(":"))),this.rowIndex(e.substring(0,t)))},this._getTableRange=function(e){var t,i,s,a,n,o,r,l;if(e=e.replace(" ","").toUpperCase(),t=e.replace("]","").replace("#DATA",""),i=t,t.indexOf(this.getParseArgumentSeparator())>-1&&(i=t.substring(0,t.indexOf(this.getParseArgumentSeparator())).replace("[",""),t=t.replace("[","").replace(this.getParseArgumentSeparator(),"_")),s="",e.indexOf("#THISROW")>-1){if(a=this.getNamedRanges().getItem(t.replace("#THISROW","")),a==undefined||"string"==typeof a||(a=a.getItem(t.replace("#THISROW",""))),null==a)return a;a=a.toUpperCase(),n=this.rowIndex(this.cell),a=a.replace(this._string_fixedreference,""),a=this.setTokensForSheets(a),o=0,r=this.getNamedRanges().getItem(i.Replace("#THISROW","")),r==undefined||"string"==typeof r||(r=r.getItem(i.Replace("#THISROW",""))),r=r.replace(this._string_fixedreference,"").toUpperCase(),r=this.setTokensForSheets(r),l=this._getTopRowIndexFromRange(a),s=this.getCellsFromArgs(a)[n-l]}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("#","")),s=this.getNamedRanges().getItem(t),s==undefined||"string"==typeof s||(s=s.getItem(t)),null==s)return null;return s.toUpperCase()},this._parse=function(e){var t,i,s,a,n,o,r,l,d=e;if(this._isTextEmpty(d))return d;if(d=this.getFormulaText(d),this.getSupportLogicalOperators()&&(d=this._markReserveWords(d)),this.getFormulaCharacter()!=String.fromCharCode(0)&&this.getFormulaCharacter()==d[0]&&(d=d.substring(1)),this.getNamedRanges().length>0&&(d.indexOf("[")>-1&&(t=this._getTableRange(d),null!=t&&(d=t)),this.getNamedRanges().getItem(d.toUpperCase())!=undefined?d=this.getNamedRanges().getItem(d.toUpperCase()).toUpperCase():(i="",i=this._checkIfScopedRange(d.toUpperCase()),isNaN(i)||(d=i.toUpperCase()))),s=this._saveStrings(d),d=this._saveStringsText,d=d.split(this.braceLeft).join(this.tic),d=d.split(this.braceRight).join(this.tic),d=d.split("-+").join("-"),a=0,(d[d.length-1]!=this.bMARKER||this._indexOfAny(d,this.tokens)!=d.length-2)&&(d=d.toUpperCase()),d.indexOf(this.sheetToken)>-1&&(n=CalcEngine.getSheetFamilyItem(this.grid),null!=n.sheetNameToParentObject&&n.sheetNameToParentObject.length>0))try{d=this.setTokensForSheets(d)}catch(e){if(this._rethrowExceptions)throw e;return e}if(this._isRangeOperand)return this._isRangeOperand=!1,this._getCellFrom(this._parseSimple(d));d=d.split(" ").join(""),d=d.split("=>").join(">="),d=d.split("=<").join("<=");try{d=this._markLibraryFormulas(d)}catch(e){if(this._rethrowExceptions)throw e;return e}if(!this._ignoreBracet)for(;(a=d.indexOf(")"))>-1;){if(o=d.substring(0,a).lastIndexOf("("),o==-1)throw this.formulaErrorStrings[this._mismatched_parentheses];if(o==a-1)throw this.formulaErrorStrings[this._empty_expression];r="",r=this._ignoreBracet?this._substring(d,o,a-o+1):this._substring(d,o+1,a-o-1),d=d.substring(0,o)+this._parseSimple(r)+d.substring(a+1)}if(!this._ignoreBracet&&d.indexOf("(")>-1)throw this.formulaErrorStrings[this._mismatched_parentheses];return l=this._parseSimple(d),null!=s&&s.length>0&&(l=this._setStrings(l,s)),l},this._parseDouble=function(e){return isNaN(parseInt(e))?NaN:1*Number(e.replace(/[^0-9\.]-+/g,""))},this._parseSimple=function(e){var t=e;if(t.length>0&&"+"==t[0]&&(t=t.substring(1)),"#N/A"==t||"#N~A"==t)return"#N/A";if(t.indexOf("#N/A")>-1&&(t=t.split("#N/A").join("#N~A")),"#DIV/0!"==t||"#DIV~0!"==t)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,s=[this.token_EP,this.token_EM],a=[this.token_or],n=[this.token_multiply,this.token_divide],o=[this.token_add,this.token_subtract],r=[this.token_less,this.token_greater,this.token_equal,this.token_lesseq,this.token_greatereq,this.token_noequal],l=[this.token_NOTop],d=[this.token_ORop,this.token_ANDop,this.token_XORop],h=[this.token_and],c=[this.char_EP,this.char_EM],u=[this.char_or],m=[this.char_multiply,this.char_divide],p=[this.char_add,this.char_subtract],g=[this.char_less,this.char_greater,this.char_equal,this.char_lesseq,this.char_greatereq,this.char_noequal],_=[this.char_NOTop],f=[this.char_ORop,this.char_ANDop,this.char_XORop],b=[this.char_and];return t=this._parseSimpleOperators(t,s,c),t=this._parseSimpleOperators(t,a,u),i&&(t=this._parseSimpleOperators(t,n,m)),i&&(t=this._parseSimpleOperators(t,o,p)),i&&(t=this._parseSimpleOperators(t,r,g)),i&&(t=this._parseSimpleOperators(t,l,_)),i&&(t=this._parseSimpleOperators(t,d,f)),i&&(t=this._parseSimpleOperators(t,h,b)),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(e,t,i){for(var s,a,n,o,r,l,d,h,c,u,m,p,g=e,_="",f=0;f-").join(">u").split("<-").join("+").join(">").split("<+").join("<").split("/+").join("/").split("*+").join("*").split("++").join("+").toString(),g.length>0&&"-"==g[0]?g="0"+g:g.length>0&&"+"==g[0]&&(g=g.substring(1)),this._indexOfAny(g,i)>-1)for(;(p=this._indexOfAny(g,i))>-1;){var b="",v="",x=0,w=0,y=this._supportLogicalOperators&&g[p]==this.char_NOTop,d=0;if(y)x=p;else{if(p<1&&"-"!=g[p])throw this.formulaErrorStrings[this._operators_cannot_start_an_expression];if(d=p-1,0==p&&"-"==g[p]){g=this.bMARKER+"nu"+g.substring(1)+this.bMARKER;continue}if(g[d]==this.tic[0]){if(m=g.substring(0,d-1).lastIndexOf(this.tic),m<0)throw this.formulaErrorStrings[this._cannot_parse];b=this._substring(g,m,d-m+1),x=m}else if(g[d]==this.bMARKER){if(m=this._findLastNonQB(g.substring(0,d-1)),m<0)throw this.formulaErrorStrings[this._cannot_parse];b=this._substring(g,m+1,d-m-1),x=m+1}else if(g[d]==this._rightBracket){for(h=0,m=d-1;m>0&&("q"!=g[m]||0!=h);)"q"==g[m]?h--:g[m]==this._rightBracket&&h++,m--;if(m<0)throw this.formulaErrorStrings[this._cannot_parse];b=this._substring(g,m,d-m+1),x=m}else if(this._isDigit(g[d])||"%"==g[d]){for(c=!1,u=!1;d>-1&&(this._isDigit(g[d])||!c&&g[d]==this.getParseDecimalSeparator()||!u&&"%"==g[d]||"u"==g[d]);)g[d]==this.getParseDecimalSeparator()?c=!0:"%"==g[d]&&(u=!0),d-=1;if(d>-1&&c&&g[d]==this.getParseDecimalSeparator())throw this.formulaErrorStrings[this._number_contains_2_decimal_points];if(d+=1,0==d||d>0&&!this._isUpperChar(g[d-1]))b="n"+this._substring(g,d,p-d),x=d;else{for(d-=1;d>-1&&this._isUpperChar(g[d]);)d-=1;if(d>-1&&"u"==g[d]&&(d-=1),d>-1&&g[d]==this.sheetToken){for(d-=1;d>-1&&g[d]!=this.sheetToken;)d-=1;d>-1&&g[d]==this.sheetToken&&(d-=1)}if(d>-1&&":"==g[d]){for(d-=1;d>-1&&this._isDigit(g[d]);)d-=1;for(;d>-1&&this._isUpperChar(g[d]);)d-=1;if(d>-1&&g[d]==this.sheetToken){for(d--;d>-1&&g[d]!=this.sheetToken;)d--;d>-1&&g[d]==this.sheetToken&&d--}d+=1,b=this._substring(g,d,p-d),b=this._getCellFrom(b)}else d+=1,b=this._substring(g,d,p-d);this.updateDependencies(b),x=d}}else{for(;d>=0&&(this._isUpperChar(g[d])||"_"==g[d]||"."==g[d]);)d--;if(b=this._substring(g,d+1,p-d-1),x=d+1,o="",this.getNamedRanges().containsKey(b)>-1)b=this._parse(this.getNamedRanges()[b]);else if(isNaN(o=this._checkIfScopedRange(b,o)))if(b==this.trueValueStr)b="n"+this.trueValueStr;else{if(b!=this.falseValueStr){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_char_in_front_of]+" "+g[p];return this.getErrorStrings()[5].toString()}b="n"+this.falseValueStr}else b=this._parse(o)}}if(p==g.length-1)throw this.formulaErrorStrings[this._expression_cannot_end_with_an_operator];if(d=p+1,s="u"==g[d],s&&d++,g[d]==this.tic[0]){if(m=g.substring(d+1).indexOf(this.tic),m<0)throw this.formulaErrorStrings[this._cannot_parse];v=this._substring(g,d,m+2),w=m+d+2}else if(g[d]==this.bMARKER){if(m=this._findNonQB(g.substring(d+1)),m<0)throw this.formulaErrorStrings[this._cannot_parse];v=this._substring(g,d+1,m),s&&(v+="nu1m"),w=m+d+2}else if("q"==g[d]){for(h=0,m=d+1;m4){for(;d-1)v=this._parse(this.getNamedRanges()[v]);else if(isNaN(o=this._checkIfScopedRange(v,o)))if(v==this.trueValueStr)v="n"+this.trueValueStr;else{if(v!=this.falseValueStr){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_characters_following_an_operator];return this.getErrorStrings()[5].toString()}v="n"+this.falseValueStr}else v=this._parse(o);else this.updateDependencies(v);w=d+1}r=_.indexOf(g[p]),l=this.bMARKER+this._zapBlocks(b)+this._zapBlocks(v)+t[r]+this.bMARKER,x>0&&(l=g.substring(0,x)+l),w0&&("q"!=g[m]||0!=h);)"q"==g[m]?h--:g[m]==this._rightBracket&&h++,m--;if(m<0)throw this.formulaErrorStrings[this._bad_library]}else if(this._isDigit(g[d])){for(c=!1,u=!1;d>-1&&(this._isDigit(g[d])||!c&&g[d]==this.getParseDecimalSeparator()||!u&&"%"==g[d]);)g[d]==this.getParseDecimalSeparator()?c=!0:"%"==g[d]&&(u=!0),d-=1;if(d>-1&&c&&g[d]==this.getParseDecimalSeparator())throw this.formulaErrorStrings[this._number_contains_2_decimal_points]}if(g.length>0&&(this._isUpperChar(g[0])||g[0]==this.sheetToken)){var C=!0,S=!0,T=!1;for(m=0;m0&&!T)throw this.formulaErrorStrings[this._missing_sheet];for(T=!0,m++;m-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(i=this._parseDouble(t),!isNaN(i))return i;if(this.getUseDatesInCalculations())return s=this._isDate(t),isNaN(s)?0:this._getSerialDateTimeFromDate(s)}return""==t&&this.getTreatStringsAsZero()?0:null!=a&&a.toString().length>0?Number.NaN:0},this._popString=function(e){var t,i=e.pop(),s=this._parseDouble(i);if(null==i)i="";else{if(!isNaN(s))return s.toString();if(this.getUseDatesInCalculations()&&(t=this._isDate(i.split(this.tic).join("")),!isNaN(t)))return this._getSerialDateTimeFromDate(t)}return this.removeTics(i.toString())},this._populateNamedRangesNonScoped=function(){null==this._namedRangesNonScoped&&(this._namedRangesNonScoped=new HashTable),this._namedRangesNonScoped.clear();for(var e=0;e-1)for(;d>-1&&d-1){if(i=this.tic+this._uniqueStringMarker+l.toString()+this.tic,t-1&&d-1&&this.getValidPrecedingChars().indexOf(e[n].toString())==-1;n--)a=e[n]+a;if("'"!=a[0]||"'"!=a[a.length-1])throw this.formulaErrorStrings[this._mismatched_tics];if("'"==a[0]&&(a=a.substring(1)),"'"==a[a.length-1]&&(a=a.substring(0,a.length-1)),this.getSortedSheetNames().indexOf(a.toUpperCase())==-1)throw this.formulaErrorStrings[this._missing_sheet];d+11&&e[0]==this.tic[0]&&e[e.length-1]==this.tic[0]&&(e=this._substring(e,1,e.length-2)),e},this._substring=function(e,t,i){return e.substring(t,i+t)},this._isTextEmpty=function(e){return null==e||""==e},this._toOADate=function(e){return(e.getTime()-Date.parse(this._oaDate))/this._millisecondsOfaDay},this._zapBlocks=function(e){var t,i;if(e.indexOf(this.bMARKER)>-1)for(t=0,i=e.length-1;i>0;--i)e[i]==this._rightBracket?t--:e[i]==this._leftBracket?t++:e[i]==this.bMARKER&&0==t&&(e=e.substring(0,i-1)+e.substring(i+1));return e},this.addCustomFunction=function(e,t){return e=e.toUpperCase(),this._addFunction(e,t),this._customlibraryFunctions.getItem(e)==undefined&&(this._customlibraryFunctions.add(e,t),!0)},this.UpdateDependentNamedRangeCell=function(e){var t,i,s;if(null!=this.getDependentNamedRangeCells()&&this.getDependentNamedRangeCells().containsKey(e)&&(t=this.getDependentNamedRangeCells().keys(),null!=t&&t.length>0))for(i=0;i-1?(s=CalcEngine.getSheetFamilyItem(this.grid),this.grid=s.tokenToParentObject.getItem(o.substring(0,r+3)),a=this.rowIndex(o),n=this.colIndex(o)):(a=this.rowIndex(o),n=this.colIndex(o)),this.recalculateRange(RangeInfo.cells(a,n,a,n),this.grid),this.grid=l}},this.RemoveNamedRangeDependency=function(e){if(this.getDependentNamedRangeCells().containsKey(e)){var t=Hashtable(this.getDependentNamedRangeCells()[e]);t.Clear(),this.getDependentNamedRangeCells().remove(e)}},this.SetNamedRangeDependency=function(e,t){var i,s,a,n=CalcEngine.getSheetFamilyItem(this.grid);null!=n.sheetNameToParentObject&&t.indexOf(this.sheetToken)==-1&&(i=n.GridModelToToken[this.grid],t=i+t),null!=this.getDependentNamedRangeCells()&&this.getDependentNamedRangeCells().containsKey(e)?(s=this.getDependentNamedRangeCells()[e],s.containsKey(t)||s.add(t,"0")):(a=new HashTable,a.add(t,"0"),this.getDependentNamedRangeCells().add(e,t.toString()))},this.addNamedRange=function(e,t){return e=e.toUpperCase(),null==this.getNamedRanges().getItem(e)&&(this.getNamedRanges().add(e,t),this.getNameRangeValues().containsKey(e)||this.getNameRangeValues().add(e,t.toString()),(this.getUndefinedNamedRanges().containsKey(e)||this.getUndefinedNamedRanges().containsKey(e.toUpperCase())||this.getUndefinedNamedRanges().containsKey(e.toLowerCase()))&&(this.SetNamedRangeDependency(e.toUpperCase(),this.cell),this.UpdateDependentNamedRangeCell(e.toUpperCase())),namedRangesSized=null,this._checkAddNonScopedNamedRange(e),!0)},this.adjustRangeArg=function(e){return e.length>1&&e[0]==this.bMARKER&&e[e.length-1]==this.bMARKER&&this._substring(e,1,e.length-2).indexOf(this.bMARKER)==-1&&(e=this.computedValue(e)),e.length>1&&e[0]==this.tic[0]&&e[e.length-1]==this.tic[0]&&(e=this._substring(e,1,e.length-2)),e},this.clearFormulaDependentCells=function(e){var t,i,s,a,n=this.getDependentFormulaCells().getItem(e);if(null!=n){for(t=n.keys(),i=0;ithis._maximumRecursiveCalls)throw this.computedValueLevel=0,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+=1;else{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("q"==formula[i]){if(formula=this._computeInteriorFunctions(formula),ii=formula.substring(i+1).indexOf(this._leftBracket),!(ii>0)){if(formula[0]==this.bMARKER){i=0,0==_stack.length;continue}throw this.formulaErrorStrings[this._improper_formula]}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),"AVG"==name&&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(e){if(this.getRethrowLibraryComputationExceptions())throw this._libraryComputationException=e,e;return e}i+=j+ii+2}else if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._missing_formula]}else if(this._isDigit(formula[i])||"u"==formula[i]){if(s="",("u"==formula[i]||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+=1;break;case this.token_equal:s1=this._popString(_stack),s2=this._popString(_stack),""==s1&&this.getTreatStringsAsZero()&&(s1="0"),""==s2&&this.getTreatStringsAsZero()&&(s2="0"),d=this._parseDouble(s1),d1=this._parseDouble(s2),val=isNaN(d)||isNaN(d1)?"#VALUE!"==s1||"#VALUE!"==s2?"#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+=1;break;case this.token_lesseq:s1=this._popString(_stack),s2=this._popString(_stack),""==s1&&this.getTreatStringsAsZero()&&(s1="0"),""==s2&&this.getTreatStringsAsZero()&&(s2="0"),d=this._parseDouble(s1),d1=this._parseDouble(s2),val=isNaN(d)||isNaN(d1)?"#VALUE!"==s1||"#VALUE!"==s2?"#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+=1;break;case this.token_greatereq:s1=this._popString(_stack),s2=this._popString(_stack),""==s1&&this.getTreatStringsAsZero()&&(s1="0"),""==s2&&this.getTreatStringsAsZero()&&(s2="0"),d=this._parseDouble(s1),d1=this._parseDouble(s2),val=isNaN(d)||isNaN(d1)?"#VALUE!"==s1||"#VALUE!"==s2?"#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+=1;break;case this.token_noequal:s1=this._popString(_stack),s2=this._popString(_stack),""==s1&&this.getTreatStringsAsZero()&&(s1="0"),""==s2&&this.getTreatStringsAsZero()&&(s2="0"),d=this._parseDouble(s1),d1=this._parseDouble(s2),val=isNaN(d)||isNaN(d1)?"#VALUE!"==s1||"#VALUE!"==s2?"#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+=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+=1;break;case this.token_or:d=this._pop(_stack),d1=this._pop(_stack),_stack.push(Math.pow(d1,d).toString()),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=0!=Number(s1)?this.trueValueStr:this.falseValueStr),""==s2?s2=this.falseValueStr:isNaN(d1)||(s2=0!=Number(s2)?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+=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=0!=Number(s1)?this.trueValueStr:this.falseValueStr),""==s2?s2=this.falseValueStr:isNaN(d1)||(s2=0!=Number(s2)?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+=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=0!=Number(s1)?this.trueValueStr:this.falseValueStr),""==s2?s2=this.falseValueStr:isNaN(d1)||(s2=0!=Number(s2)?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+=1;break;case this.token_NOTop:s1=this._popString(_stack),d=this._parseDouble(s1),""==s1?s1=this.falseValueStr:isNaN(d)||(s1=0!=Number(s1)?this.trueValueStr:this.falseValueStr),val=s1.toUpperCase().split(this.tic).join("")==this.falseValueStr?this.trueValueStr:this.falseValueStr,_stack.push(val),i+=1;break;default:if(this.computedValueLevel=0,this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_expression];return this.getErrorStrings()[1].toString()}}}else i+=1;if(this._checkDanglingStack&&_stack.length>1&&formula.length>1&&(0!=formula.indexOf(this.bmarker.toString())||formula.indexOf(this.bmarker)!=formula.length-1||formula.indexOf(this.bmarker2)>-1))return this.computedValueLevel=0,this.formulaErrorStrings[this._improper_formula];if(0==_stack.length)return"";s="",cc=_stack.length;do return _stack.pop().toString()+s;while(cc>0&&!(s.indexOf(this.FALSEVALUESTR)>-1||s.indexOf(this.tRUEVALUESTR)>1));return s}catch(e){if(this.computedValueLevel=0,e.toString().indexOf(this.formulaErrorStrings[this._circular_reference_])>-1||this._rethrowLibraryComputationExceptions&&null!=this.getLibraryComputationException()){if(this._rethrowLibraryComputationExceptions&&null!=this.getLibraryComputationException())throw this.getLibraryComputationException();throw e}if(e.toString().indexOf(this.formulaErrorStrings[this._cell_empty])>-1)return"";if(this.getRethrowLibraryComputationExceptions())throw this._libraryComputationException=e,e;return e}finally{this.computedValueLevel--,this.computedValueLevel<0&&(this.computedValueLevel=0)}},this.computeFormula=function(e){if(this.getThrowCircularException())if(this._iterationMaxCount>0){if(0==this.computedValueLevel)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(0==this.computedValueLevel)this._circCheckList.length=0;else if(this._circCheckList.indexOf(this.cell)>-1)throw this.computedValueLevel=0,this._circCheckList.length=0,this.formulaErrorStrings[this._circular_reference_];this._circCheckList.push(this.cell)}var t=this.computedValue(e);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 e=0;null!=this.grid&&(e=this.getSheetID(this.grid)),CalcEngine._tokenCount--,CalcEngine.sheetFamilyID--,null!=CalcEngine._sheetFamiliesList&&CalcEngine._sheetFamiliesList.length>0&&(CalcEngine._sheetFamiliesList[e]=null,CalcEngine._sheetFamiliesList.remove(e)),null!=CalcEngine.modelToSheetID&&CalcEngine.modelToSheetID.length>0&&(CalcEngine.modelToSheetID[e]=null,CalcEngine._sheetFamiliesList.remove(e)),null!=this._formulaInfoTable&&(this._formulaInfoTable.clear(),this._formulaInfoTable=null),null!=this._circCheckList&&(this._circCheckList.length=0,this._circCheckList=null),null!=this._dependentCells&&(this._dependentCells.clear(),this._dependentCells=null),null!=this._dependentFormulaCells&&(this._dependentFormulaCells.clear(),this._dependentFormulaCells=null),null!=this.getIterationValues()&&(this.getIterationValues().clear(),this.getIterationValues(null)),null!=this._libraryFunctions&&(this._libraryFunctions.clear(),this._libraryFunctions=null),null!=this._lookupTables&&(this._lookupTables.clear(),this._lookupTables=null),this.grid=null,null!=this.getLibraryFunctions()&&(this.getLibraryFunctions().clear(),this.setLibraryFunctions(null)),this._isDisposed=!0}},this.getCalcID=function(){return this._calcID},this.getCellsFromArgs=function(e){var t,i,s,a,n,o,r,l,d,h;if(e=this._markColonsInQuotes(e),s=e.indexOf(":"),s==-1)return e=e.split(this._markerChar).join(":"),s=e.indexOf(this.getParseArgumentSeparator()),s==-1?(t=this.rowIndex(e),i=this.colIndex(e),a=[],a.push(e),a):this.splitArgsPreservingQuotedCommas(e);var c="",u=e,m=e.indexOf(this.sheetToken);if(m>-1&&(n=e.indexOf(this.sheetToken,m+1),n>-1&&(c=this._substring(e,m,n-m+1),e=e.split(c).join(""),s=e.indexOf(":"))),s>0&&this._isLetter(e[s-1]))r=this._rowMaxCount>0?this._rowMaxCount:50,e=e.substring(0,s)+"1:"+e.substring(s+1)+r.toString(),s=e.indexOf(":");else if(s>0&&this._isDigit(e[s-1])){for(o=s-2;o>=0&&this._isDigit(e[o]);)o--;o!=-1&&this._isLetter(e[o])||(r=this._columnMaxCount>0?this._columnMaxCount:50,e="A"+e.substring(0,s)+":"+RangeInfo.getAlphaLabel(r)+e.substring(s+1),s=e.indexOf(":"))}if(l=this._canGetRowIndex(e.substring(0,s)),!l)return this._ignoreCellValue=!0,e=u,this.splitArgsPreservingQuotedCommas(e);if(t=this.rowIndex(e.substring(0,s)),d=this.rowIndex(this._substring(e,s+1,e.length-s-1)),!(t!=-1||d==-1)==(t==-1||!(d==-1)))throw this.getErrorStrings()[5].toString();i=this.colIndex(e.substring(0,s)),h=this.colIndex(this._substring(e,s+1,e.length-s-1)),t>d&&(s=d,d=t,t=s),i>h&&(s=h,h=i,i=s);var p=[],g=0;for(s=t;s<=d;++s)for(m=i;m<=h;++m)try{p[g++]=c+RangeInfo.getAlphaLabel(m)+s.toString()}catch(e){continue}return p},this.getFormulaRowCol=function(e,t,i){var s,a,n,o=CalcEngine.getSheetFamilyItem(e),r=RangeInfo.getAlphaLabel(i)+t.toString();return null!=o.sheetNameToParentObject&&(s=o.parentObjectToToken.getItem(e),r=s+r),this.getFormulaInfoTable().containsKey(r)?(a=this.getFormulaInfoTable.getItem(r),n=a.getFormulaText(),this.getFormulaText(n),n):""},this.getFormulaText=function(e){var t=new FormulaParsing(e);return t.getText()},this.getSheetID=function(e){var t,i,s=CalcEngine.getSheetFamilyItem(e);return null!=s.sheetNameToParentObject&&s.sheetNameToParentObject.length>0&&(t=s.parentObjectToToken.getItem(e),t=t.split("!").join(""),i=this._parseDouble(t),!isNaN(i))?i:-1},this.getStringArray=function(e){for(var t,i=[],s=0,a=!1,n=0;n1&&"ub"==e.substring(0,2))return e=e.split("{").join("("),e=e.split("}").join(")"),i=e.substring(1),i=this.computedValue(i),s=this._parseDouble(i),isNaN(s)?this.computedValue(e):(s=-s,s.toString());if(0==e.indexOf("unu")?e="n"+e.substring(3):0==e.indexOf("un")&&(e="-"+e.substring(2)),e=e.split("u").join("-"),!this._isUpperChar(e[0])&&(this._isDigit(e[0])||e[0]==this.getParseDecimalSeparator()||"-"==e[0]||"n"==e[0])){if("n"==e[0]&&(e=e.substring(1)),t=this._parseDouble(e),!isNaN(t))return this._preserveLeadingZeros?e:t.toString();if(0==e.indexOf(this.trueValueStr)||0==e.indexOf(this.falseValueStr))return e}if(this._ignoreCellValue&&0!=e.indexOf(this.trueValueStr)&&0!=e.indexOf(this.falseValueStr))return this._ignoreCellValue=!1,e;if(a=["+","-","/","*",")",")","{"],this._indexOfAny(e,a)==-1&&this._isUpperChar(e[0])||e[0]==this.sheetToken){if(e!=this.trueValueStr&&e!=this.falseValueStr&&this._isCellReference(e)&&(n=CalcEngine.getSheetFamilyItem(this.grid),null!=n.sheetNameToParentObject&&e.indexOf(this.sheetToken)==-1&&(o=n.parentObjectToToken.getItem(this.grid),e=o+e)),e==this.cell)throw r=this.getDependentCells().getItem(e),null!=r&&r.indexOf(e)>-1&&this._arrayRemove(r,e),this.getDependentFormulaCells().containsKey(this.cell)||this.clearFormulaDependentCells(this.cell),this.formulaErrorStrings[this._circular_reference_]+e;return l=this.getValueFromParentObjectCell(e),e!=this.trueValueStr&&e!=this.falseValueStr&&(t=this._parseDouble(l.split(this.tic).join("")),!this._preserveLeadingZeros&&l.length>0&&!isNaN(t)&&(l=t.toString()),this.updateDependencies(e)),l==this.tic+this.tic?"NaN":(d=this._isDate(l),this.getExcelLikeComputations()&&this.getUseDatesInCalculations()&&!isNaN(d)&&isNaN(this._parseDouble(l))&&!isNaN(d.getDate())&&this._dateTime1900<=d&&(l=this._toOADate(d).toString()),l)}return e=e.split("{").join("("),e=e.split("}").join(")"),e=this._parse(e),t=this._parseDouble(e.substring(0,e.length-1)),e.indexOf("%")!=e.length-1||isNaN(t)||(e=(Number(t)/100).toString()),this.getErrorStrings().indexOf(e)>-1?e:this.computedValue(e)},this.getValueFromParentObjectCell=function(e){var t,i,s;if(e==this.trueValueStr||e==this.falseValueStr)return e;var a=e.lastIndexOf(this.sheetToken),n=0,o=0,r=this.grid,l=CalcEngine.getSheetFamilyItem(this.grid);if(a>-1&&null!=l.tokenToParentObject)this.grid=l.tokenToParentObject.getItem(e.substring(0,a+1)),n=this.rowIndex(e),o=this.colIndex(e);else if(a==-1){for(t=0;t0){if(this._circCheckList.indexOf(this.cell)>-1&&this.computedValueLevel>0)return this.grid=r,this.cell=i,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(n,o,this.grid),this.grid=r,this.cell=i,s},this.getValueFromParentObject=function(e,t,i){var s,a,n=CalcEngine.getSheetFamilyItem(e),o=null==n.parentObjectToToken||0==n.parentObjectToToken.length?"":n.parentObjectToToken.getItem(e).toString();o=o+RangeInfo.getAlphaLabel(i)+t.toString(),s=this.grid,a=this.cell,this.cell=o,this.grid=e;var r=this._getValueComputeFormulaIfNecessary(t,i,e),l=new Date(Date.parse(r)),d=this._parseDouble(r);return this.getExcelLikeComputations()&&this.getUseDatesInCalculations()&&isNaN(d)&&!isNaN(l.getDate())&&this._dateTime1900<=l&&(r=this._toOADate(l).toString()),this.grid=s,this.cell=a,r},this.getValueFromParentObjectRowCol=function(e,t){return this._getValueComputeFormulaIfNecessary(e,t,this.grid)},this.handleIteration=function(e,t){return this.getFormulaInfoTable().containsKey(e)?this.getFormulaInfoTable.add(e,t):this.getFormulaInfoTable.add(e,t),this._iterationMaxCount>0&&e==this.cell&&this._handleIterations(t),t.getFormulaValue()},this.handleSheetRanges=function(e,t){for(var i,s,a,n,o,r,l,d,h,c=e.indexOf(this.sheetToken),u=0;c>0;){if(i=this._substring(e,u,c).lastIndexOf(":"),i>-1)if(s=this._substring(e,u+i+1,c-i-1).toUpperCase().split("'").join(""),a=this._isIE8?s.replace(/^\s+|\s+$/g,""):s.trim(),t.sheetNameToToken.containsKey(a)){if(n=u+i-1,this._sortedSheetNames.contains(s))n=n-s.length-1;else for(;n>0&&this._markers.indexOf(e[n])==-1;)n--;if(o=this._substring(e,n+1,i-n+u-1).toUpperCase().split("'").join(""),a=this._isIE8?o.replace(/^\s+|\s+$/g,""):o.trim(),t.sheetNameToToken.containsKey(a)){if(r=c+u+1,this._sortedSheetNames.contains(a))r=e.length-1;else for(;rf&&_0&&(d+=this.getParseArgumentSeparator()),d+=h+String.fromCharCode(131)+m)}e=e.substring(0,n+1)+d+e.substring(r),u=e.length-r}else u=c+u}else u=c+u;else u=c+u;c=e.substring(u+1).indexOf(this.sheetToken)+1}return e.split(String.fromCharCode(131)).join(this.sheetToken)},this.isSheetMember=function(){var e=CalcEngine.getSheetFamilyItem(this.grid);return null!=e&&e!=undefined&&e.isSheetMember},this.parseAndComputeFormula=function(e){var t,i,s,a,n=e;for(n.length>0&&n[0]==this.getFormulaCharacter()&&(n=n.substring(1)),n.length>0&&"+"==n[0]&&(n=n.substring(1)),n.length>1&&","==n[0]&&n[1]>="0"&&n[1]<="9"&&(n="0,"+n.substring(1)),t=n.split(" ").join(""),i=t.indexOf("(");i!=-1&&i0){if(this._isDigit(t[i-1])&&!this._checkHasCharBeforeNumber(t.substring(0,i)))throw this.formulaErrorStrings[this._bad_formula]+" "+t.substring(0,i+1);if(s=t.substring(i+1).indexOf("("),s==-1)break;i+=s}for(i=t.indexOf(")");i!=-1&&i0&&e[0]==this.getFormulaCharacter()&&(e=e.substring(1)),e.length>0&&"+"==e[0]&&(e=e.substring(1)),this._isRangeOperand=this._supportRangeOperands&&this._isRange(e),this.getCheckDanglingStack()&&e.split(" ").join("").indexOf(this._braceRightNLeft)>-1)return this.computedValueLevel=0,this.formulaErrorStrings[this._improper_formula];var t=this._isIE8?e.replace(/^\s+|\s+$/g,""):e.trim();return this._parse(t)},this.getUpdatedValueCell=function(e){var t,i,s,a,n,o,r;this._inAPull=!0;var l,d=this.grid,h=this.cell,c=CalcEngine.getSheetFamilyItem(this.grid),u=e.toUpperCase();if((l=u.indexOf(this.sheetToken))==-1&&""!=this.cell&&this.cell!=undefined?(l=this.cell.indexOf(this.sheetToken,1),l>-1&&null!=c.tokenToParentObject&&(u=this.cell.substring(0,l+1)+u,this.grid=c.tokenToParentObject.getItem(this.cell.substring(0,l+1)))):l>0&&null!=c.sheetNameToToken&&null!=c.tokenToParentObject&&(o=c.sheetNameToToken.getItem(u.substring(0,l)),u=o+u.substring(l+1),this.grid=c.tokenToParentObject.getItem(o),this.cell=u),this.updateCalcID(),this.getDependentFormulaCells().containsKey(u)||this.getFormulaInfoTable().containsKey(u))this._processedCells.clear(),this.updateDependenciesAndCell(u),this._processedCells.clear(),t=this.getValueFromParentObject(u);else{for(t=this.getValueFromParentObjectCell(u);1==this._breakedFormulaCells.length;)this.updateCalcID(),t=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(i=1;i<=this._tempBreakedFormulaCells.length;i++)t=this.getValueFromParentObjectCell(this._tempBreakedFormulaCells[this._tempBreakedFormulaCells.length-i].toString());this._tempBreakedFormulaCells.length=0,t=this.getValueFromParentObjectCell(u)}this.setUseFormulaValues(this.isUseFormulaValueChanged),s=this.ignoreValueChanged,this.ignoreValueChanged=!0,a=this.rowIndex(u),n=this.colIndex(u),this.getPreserveFormula()?(o=this._sheetToken(e),""==o?(o="!"+this.getSheetID(this.grid)+"!",r=this.getFormulaInfoTable().getItem(o+u),null!=r&&r!=undefined&&(this.parentObject.setValueRowCol==undefined?this.setValueRowCol(this.getSheetID(this.grid)+1,r.getFormulaText(),a,n):this.parentObject.setValueRowCol(this.getSheetID(this.grid)+1,r.getFormulaText(),a,n))):this.parentObject.setValueRowCol==undefined?this.setValueRowCol(this.getSheetID(this.grid)+1,t,a,n):this.parentObject.setValueRowCol(this.getSheetID(this.grid)+1,t,a,n)):this.parentObject.setValueRowCol==undefined?this.setValueRowCol(this.getSheetID(this.grid)+1,t,a,n):this.parentObject.setValueRowCol(this.getSheetID(this.grid)+1,t,a,n),this.ignoreValueChanged=s}return this.grid=d,this.cell=h,this._inAPull=!1,t},this.getUpdatedValueRowCol=function(e,t,i){var s,a,n,o=this.grid,r=CalcEngine.getSheetFamilyItem(this.grid),l=this.sheetToken+e.toString()+this.sheetToken;this.grid=r.tokenToParentObject.getItem(l),this._inAPull=!0,s=l+RangeInfo.getAlphaLabel(i)+t.toString(),this.updateCalcID(),this.getDependentFormulaCells().containsKey(s)||this.formulaInfoTable.containsKey(s)?(this._processedCells.clear(),this.updateDependenciesAndCell(s),this._processedCells.clear()):(a=this.getValueFromParentObjectCell(s),n=this.ignoreValueChanged,this.ignoreValueChanged=!0,this.parentObject.setValueRowCol==undefined?this.setValueRowCol(this.getSheetID(this.grid)+1,a,t,i):this.parentObject.setValueRowCol(this.getSheetID(this.grid)+1,a,t,i),this.ignoreValueChanged=n),this.grid=o,this._inAPull=!1},this.setTokensForSheets=function(e){var t,i,s,a,n=CalcEngine.getSheetFamilyItem(this.grid);if(this.getSupportsSheetRanges()&&(e=this.handleSheetRanges(e,n)),t=this.getSortedSheetNames(),null!=t)for(i=0;i0&&(this.grid=r.tokenToParentObject.getItem(a));try{var h=this.rowIndex(i),c=this.colIndex(i),u=this.getFormulaInfoTable().getItem(i);null!=u&&(n=this.cell,this.cell=i,(this.getAlwaysComputeDuringRefresh()||u.calcID!=this._calcID||""==u.getFormulaValue())&&u.setFormulaValue(this.computeFormula(u.getParsedFormula())),u.calcID=this._calcID,this.cell=n,o=this.ignoreValueChanged,this.ignoreValueChanged=!0,this.parentObject.setValueRowCol==undefined?this.setValueRowCol(this.getSheetID(this.grid)+1,u.getFormulaValue(),h,c):this.parentObject.setValueRowCol(this.getSheetID(this.grid)+1,u.getFormulaValue(),h,c),this.ignoreValueChanged=o,this._refreshedCells.containsKey(i)||(this._refreshedCells.add(i,0),this.refresh(i)))}catch(e){continue}this.grid=s}this._lockDependencies=d}finally{this._refreshedCells.containsKey(e)||this._refreshedCells.add(e,0),this._dependencyLevel--,0==this._dependencyLevel&&this._refreshedCells.clear()}}},this.refreshRange=function(e){for(var t,i,s,a,n=e.getTop();n<=e.getBottom();n++)for(t=e.getLeft();t<=e.getRight();t++)i=RangeInfo.getAlphaLabel(t)+n.toString(),this._dependencyLevel=0,s=CalcEngine.getSheetFamilyItem(this.grid),a=this.sheetToken+this.getSheetID(this.grid).toString()+this.sheetToken,null!=s.tokenToParentObject&&s.tokenToParentObject.contains(a)&&(this.grid=s.tokenToParentObject.getItem(a)),i=a+i,this.refresh(i)},this.registerGridAsSheet=function(e,t,i){var s,a,n;return null!=CalcEngine.modelToSheetID,null==CalcEngine.modelToSheetID&&(CalcEngine.modelToSheetID=new HashTable),(null==CalcEngine.modelToSheetID.getItem(t)||CalcEngine.modelToSheetID.getItem(t)==undefined)&&CalcEngine.modelToSheetID.add(t,i),s=CalcEngine.getSheetFamilyItem(t),s.isSheetMember=!0,a=e.toUpperCase(),null==s.sheetNameToParentObject&&(s.sheetNameToParentObject=new HashTable),null==s.tokenToParentObject&&(s.tokenToParentObject=new HashTable),null==s.sheetNameToToken&&(s.sheetNameToToken=new HashTable),null==s.parentObjectToToken&&(s.parentObjectToToken=new HashTable),s.sheetNameToParentObject.getItem(a)!=undefined?(n=s.sheetNameToToken.getItem(a),s.tokenToParentObject.add(n,t),s.parentObjectToToken.add(t,n)):(n=this.sheetToken+CalcEngine._tokenCount.toString()+this.sheetToken,CalcEngine._tokenCount++,s.tokenToParentObject.add(n,t),s.sheetNameToToken.add(a,n),s.sheetNameToParentObject.add(a,t),s.parentObjectToToken.add(t,n),this.sortedSheetNames=null),e},this.removeFunction=function(e){return this._customlibraryFunctions.getItem(e)!=undefined&&this._customlibraryFunctions.remove(e),null!=this._libraryFunctions.getItem(e)&&(this._libraryFunctions.remove(e),!0)},this.removeNamedRange=function(e){return e=e.toUpperCase(),null!=this.getNamedRanges().getItem(e)&&(this.getNamedRanges().remove(e),this._populateNamedRangesNonScoped(),!0)},this.rowIndex=function(e){var t,i=0,s=!1;if(i1&&e[0]==this.tic[0]&&e[e.length-1]==this.tic[0]&&(this._substring(e,1,e.length-2).indexOf(this.tic)==-1?e=this._substring(e,1,e.length-2):this._multiTick&&(e=this._substring(e,1,e.length-2))),e},this.updateCalcID=function(){this._calcID++,this._calcID==Number.MAX_SAFE_INTEGER&&(this._calcID=Number.MIN_SAFE_INTEGER+1)},this.updateDependencies=function(e){var t,i,s,a,n,o,r,l,d,h;if(!this._lockDependencies&&this.getUseDependencies())if(t=CalcEngine.getSheetFamilyItem(this.grid),i=this.cell,null!=t.sheetNameToParentObject&&i.indexOf(this.sheetToken)==-1&&(s=t.parentObjectToToken.getItem(this.grid),i=s+i),null!=t.sheetNameToParentObject&&e.indexOf(this.sheetToken)==-1&&(s=t.parentObjectToToken.getItem(this.grid),e=s+e),this.getDependentCells().containsKey(e)){if(n=this.getDependentCells().getItem(e),n.indexOf(i)==-1&&n.push(i),this._addToFormulaDependentCells(e),this.getDependentFormulaCells().containsKey(e)&&(o=this.getDependentFormulaCells().getItem(e),null!=o))for(r=o.keys(),l=0;l0&&(this.grid=m.tokenToParentObject.getItem(p)),this.formulaInfoTable.containsKey(e)){if(t=this.formulaInfoTable[e],t.calcID!=this._calcID){if(i=this.cell,this.cell=e,this._iterationMaxCount>0&&this._circCheckList.indexOf(this.cell)>-1?this._handleIterations(t):t.setFormulaValue(this.computeFormula(t.getParsedFormula())),this.getDependentCells().containsKey(e))for(s=this.getDependentCells().getItem(e),a=0;a0&&(s=d.parentObjectToToken.getItem(i),h=s+h),t.getValue().length>0&&t.getValue()[0]==this.getFormulaCharacter()){if(this.cell=h,n=!0,this.getFormulaInfoTable().containsKey(h)){if(a=this.getFormulaInfoTable().getItem(h),t.getValue()!=a.getFormulaText()||null==a.getParsedFormula()){a.setFormulaText(t.getValue()),this.getDependentFormulaCells().containsKey(this.cell)&&this.clearFormulaDependentCells(this.cell);try{a.setParsedFormula(this.parseFormula(t.getValue()))}catch(e){a.setFormulaValue(e),n=!1}}n&&(o=this.computeFormula(a.getParsedFormula()),l=o!=a.getFormulaValue()||this.getForceRefreshCall(),a.setFormulaValue(o)),a.calcID=this._calcID}else{a=new FormulaInfo,a.setFormulaText(t.getValue()),this.getDependentFormulaCells().containsKey(h)||this.getDependentFormulaCells().add(h,new HashTable);try{a.setParsedFormula(this.parseFormula(t.getValue()))}catch(e){a.setFormulaValue(e),n=!1}n&&(a.setFormulaValue(this.computeFormula(a.getParsedFormula())),"#NAME?"!=this.computeIsFormula(a).toString()||this.getNamedRanges().containsKey(a.getFormulaText().split("=")[1].toUpperCase())||this.getUndefinedNamedRanges().add(a.getFormulaText().split("=")[1].toUpperCase())),a.calcID=this._calcID,this.getFormulaInfoTable().containsKey(h)?this.getFormulaInfoTable().add(h,a):this.getFormulaInfoTable().add(h,a)}this._iterationMaxCount>0&&n&&!this._inHandleIterations&&h==this.cell&&this._handleIterations(a),r=this.ignoreValueChanged,this.ignoreValueChanged=!0,this.parentObject.setValueRowCol==undefined?this.setValueRowCol(this.getSheetID(i)+1,a.getFormulaValue(),t.getRowIndex(),t.getColIndex()):this.parentObject.setValueRowCol(this.getSheetID(i)+1,a.getFormulaValue(),t.getRowIndex(),t.getColIndex()),null!=a&&""==a.getFormulaValue()&&t.getValue().startsWith(this.getFormulaCharacter())&&this.getTreatStringsAsZero()&&(this.parentObject.setValueRowCol==undefined?this.setValueRowCol(this.getSheetID(this.grid)+1,"0",t.getRowIndex(),t.getColIndex()):this.parentObject.setValueRowCol(this.getSheetID(this.grid)+1,"0",t.getRowIndex(),t.getColIndex())),this.ignoreValueChanged=r}else!this._inRecalculateRange&&this.getFormulaInfoTable().containsKey(h)&&(this.getFormulaInfoTable().remove(h),this.getDependentFormulaCells().containsKey(h)&&this.clearFormulaDependentCells(h));l&&this.getDependentCells().containsKey(h)&&(this._dependencyLevel=0,this.refresh(h))}},this.getActiveCell=function(){return this.cell},this.getAllowShortCircuitIFs=function(){return this._allowShortCircuitIFs},this.setAllowShortCircuitIFs=function(e){this._allowShortCircuitIFs=e},this.getAlwaysComputeDuringRefresh=function(){return this._alwaysComputeDuringRefresh},this.setAlwaysComputeDuringRefresh=function(e){this._alwaysComputeDuringRefresh=e},this.getCalculatingSuspended=function(){return this._calculatingSuspended},this.setCalculatingSuspended=function(e){this._calculatingSuspended=e},this.getCheckDanglingStack=function(){return this._checkDanglingStack},this.setCheckDanglingStack=function(e){this._checkDanglingStack=e},this.getCustomLibraryFunctions=function(){return this._customlibraryFunctions},this.getDependentCells=function(){if(this.isSheetMember()){var e=CalcEngine.getSheetFamilyItem(this.grid);return null==e.sheetDependentCells&&(e.sheetDependentCells=new HashTable),e.sheetDependentCells}return null==this._dependentCells&&(this._dependentCells=new HashTable),this._dependentCells},this.getDependentFormulaCells=function(){if(this.isSheetMember()){var e=CalcEngine.getSheetFamilyItem(this.grid);return null==e.sheetDependentFormulaCells&&(e.sheetDependentFormulaCells=new HashTable),e.sheetDependentFormulaCells}return null==this._dependentFormulaCells&&(this._dependentFormulaCells=new HashTable),this._dependentFormulaCells},this.getEnableLookupTableCaching=function(){return this._enableLookupTableCaching},this.setEnableLookupTableCaching=function(e){this._enableLookupTableCaching=e},this.getErrorStrings=function(){return null==this._errorStrings&&(this._errorStrings=["#N/A","#VALUE!","#REF!","#DIV/0!","#NUM!","#NAME?","#NULL!"]),this._errorStrings},this.setErrorStrings=function(e){this._errorStrings=e},this.getExcelLikeComputations=function(){return this._excelLikeComputations},this.setExcelLikeComputations=function(e){this._excelLikeComputations=e},this.getForceRefreshCall=function(){return this._forceRefreshCall},this.setForceRefreshCall=function(e){this._forceRefreshCall=e},this.getFormulaCharacter=function(){return"\0"==CalcEngine._formulaChar&&(CalcEngine._formulaChar="="),CalcEngine._formulaChar},this.setFormulaCharacter=function(e){CalcEngine._formulaChar=e},this.getFormulaInfoTable=function(){if(this.isSheetMember()){var e=CalcEngine.getSheetFamilyItem(this.grid);return null==e.sheetFormulaInfoTable&&(e.sheetFormulaInfoTable=new HashTable),e.sheetFormulaInfoTable}return null==this._formulaInfoTable&&(this._formulaInfoTable=new HashTable),this._formulaInfoTable},this.getPreserveLeadingZeros=function(){return this._preserveLeadingZeros},this.setPreserveLeadingZeros=function(e){this._preserveLeadingZeros=e},this.getIterationMaxCount=function(){return this._iterationMaxCount},this.setIterationMaxCount=function(e){this._iterationMaxCount=e,this._iterationMaxCount>0&&this.setThrowCircularException(!0)},this.getIterationMaxTolerance=function(){return this._iterationMaxTolerance},this.setIterationMaxTolerance=function(e){this._iterationMaxTolerance=e},this.getIterationValues=function(){return null==this._iterationValues&&(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(e){this._lockDependencies=e},this.getMaximumRecursiveCalls=function(){return this._maximumRecursiveCalls},this.setMaximumRecursiveCalls=function(e){this._maximumRecursiveCalls=e},this.getNamedRanges=function(){return null==this.namedRanges&&(this.namedRanges=new HashTable,this._namedRangesNonScoped=new HashTable),this.namedRanges},this.setNamedRanges=function(e){this.namedRanges=e,this._populateNamedRangesNonScoped()},this.getUndefinedNamedRanges=function(){var e=CalcEngine.getSheetFamilyItem(this.grid);return null!=e||e!=undefined?(null==this.undefinedsheetNamedRnages&&(this.undefinedsheetNamedRnages=new HashTable),this.undefinedsheetNamedRnages):(null==this.undefinednamedRange&&(this.undefinednamedRange=new HashTable),this.undefinednamedRange)},this.getNameRangeValues=function(){var e=CalcEngine.getSheetFamilyItem(this.grid);return null!=e||e!=undefined?(null==this.namedRangeValues&&(this.namedRangeValues=new HashTable),this.namedRangeValues):(null==this.rangeValues&&(this.rangeValues=new HashTable),this.rangeValues)},this.getNamedRangesOriginalNames=function(){var e=CalcEngine.getSheetFamilyItem(this.grid);return null!=e||e!=undefined?(null==this.sheetNamedRangesOriginalNames&&(this.sheetNamedRangesOriginalNames=new HashTable),this.sheetNamedRangesOriginalNames):(null==this.namedRangesOriginalNames&&(this.namedRangesOriginalNames=new HashTable),this.namedRangesOriginalNames)},this.getNamedRangeCellCollection=function(){var e=CalcEngine.getSheetFamilyItem(this.grid);return null!=e||e!=undefined?(null==this.sheetNamedRangeCellCollection&&(this.sheetNamedRangeCellCollection=new HashTable),this.sheetNamedRangeCellCollection):(null==this.namerangecellcollection&&(this.namerangecellcollection=new HashTable),this.namerangecellcollection)},this.getDependentNamedRangeCells=function(){var e=CalcEngine.getSheetFamilyItem(this.grid);return null!=e||e!=undefined?(null==this.sheetDependentNamedRangeCells&&(this.sheetDependentNamedRangeCells=new HashTable),this.sheetDependentNamedRangeCells):(null==this.dependentNamedRangeCells&&(this.dependentNamedRangeCells=new HashTable),this.dependentNamedRangeCells)},this.getParseArgumentSeparator=function(){"\0"==this._parseArgumentSeparator&&(this._parseArgumentSeparator=",");var e=",";return this._isParseArgumentSeparator||e==this._parseArgumentSeparator||(this._parseArgumentSeparator=e),this._parseArgumentSeparator},this.setParseArgumentSeparator=function(e){this._parseArgumentSeparator=e,this._isParseArgumentSeparator=!0},this.getParseDateTimeSeparator=function(){return this._parseDateTimeSeparator},this.setParseDateTimeSeparator=function(e){this._parseDateTimeSeparator=e},this.getParseDecimalSeparator=function(){"\0"==this._parseDecimalSeparator&&(this._parseDecimalSeparator=".");var e=".";return this._isParseDecimalSeparatorChanged||e==this._parseDecimalSeparator||(this._parseDecimalSeparator=e),this._parseDecimalSeparator},this.setParseDecimalSeparator=function(e){this._parseDecimalSeparator=e,this._parseDecimalSeparator=!0},this.getPreserveFormula=function(){return this._preserveFormula},this.setPreserveFormula=function(e){this._preserveFormula=e},this.getReservedWordOperators=function(){return null==this._reservedWordOperators&&(this._reservedWordOperators=[" or "," and "," xor ","if "," then "," else ","not "]),this._reservedWordOperators},this.setReservedWordOperators=function(e){this._reservedWordOperators=e};this.getRethrowLibraryComputationExceptions=function(){return this._rethrowLibraryComputationExceptions};this.setRethrowLibraryComputationExceptions=function(e){this._rethrowLibraryComputationExceptions=e},this.getRethrowParseExceptions=function(){return this._rethrowExceptions},this.setRethrowParseExceptions=function(e){this._rethrowExceptions=e},this.getRowMaxCount=function(){return this._rowMaxCount},this.setRowMaxCount=function(e){this._rowMaxCount=e},this.getSortedSheetNames=function(){if(null==this._sortedSheetNames){var e=CalcEngine.getSheetFamilyItem(this.grid);null!=e&&null!=e.sheetNameToToken&&(this._sortedSheetNames=e.sheetNameToToken.keys(),this._sortedSheetNames.sort())}return this._sortedSheetNames},this.getSupportLogicalOperators=function(){return this._supportLogicalOperators},this.setSupportLogicalOperators=function(e){this._supportLogicalOperators=e},this.getSupportRangeOperands=function(){return this._supportRangeOperands},this.setSupportRangeOperands=function(e){this._supportRangeOperands=e},this.getSupportsSheetRanges=function(){return this._supportsSheetRanges},this.setSupportsSheetRanges=function(e){this._supportsSheetRanges=e},this.getThrowCircularException=function(){return this._throwCircularException},this.setThrowCircularException=function(e){this._throwCircularException=e},this.getTreatStringsAsZero=function(){return this._treatStringsAsZero},this.setTreatStringsAsZero=function(e){this._treatStringsAsZero=e},this.getUseDatesInCalculations=function(){return this._useDatesInCalcs},this.setUseDatesInCalculations=function(e){this._useDatesInCalcs=e},this.getUseDependencies=function(){return this._useDependencies},this.setUseDependencies=function(e){this._useDependencies=e},this.getUseFormulaValues=function(){return this._useFormulaValues},this.setUseFormulaValues=function(e){this._useFormulaValues=e},this.getUseNoAmpersandQuotes=function(){return this._useNoAmpersandQuotes},this.setUseNoAmpersandQuotes=function(e){this._useNoAmpersandQuotes=e},this.getValidPrecedingChars=function(){return this._validPrecedingChar+this.getParseArgumentSeparator()},this.setValidPrecedingChars=function(e){this._validPrecedingChars=e},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(e){var t,i,s,a,n,o,r=0,l=this.splitArgsPreservingQuotedCommas(e);if(!e||0==e.length){if(this.getRethrowLibraryComputationExceptions()&&null!=this.getLibraryComputationException())throw this.getLibraryComputationException();return this.formulaErrorStrings[this._wrong_number_arguments]}for(a=0;a-1){if(s.startsWith(this.tic)){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_index];return this.getErrorStrings()[4].toString()}for(n=this.getCellsFromArgs(s),o=0;o-1){if(this.getRethrowLibraryComputationExceptions()&&null!=this.getLibraryComputationException())throw this.getLibraryComputationException();return t}}catch(e){if(this.getRethrowLibraryComputationExceptions()&&null!=this.getLibraryComputationException())throw this.getLibraryComputationException();return e}if(""!=t){if(i=t==this.trueValueStr||t!=this.falseValueStr&&this._parseDouble(t),this.getErrorStrings().indexOf(t)>-1){if(this.getRethrowLibraryComputationExceptions()&&null!=this.getLibraryComputationException())throw this.getLibraryComputationException();return t}isNaN(i)?t="":r+=i}}}else{try{if(s.startsWith(this.tic)&&isNaN(this._parseDouble(s))){if(this.getRethrowLibraryComputationExceptions()&&null!=this.getLibraryComputationException())throw this.getLibraryComputationException();return this.getErrorStrings()[1].toString()}if(t=this.getValueFromArg(s).split(this.tic).join(""),this.getErrorStrings().indexOf(t)>-1){if(this.getRethrowLibraryComputationExceptions()&&null!=this.getLibraryComputationException())throw this.getLibraryComputationException();return t}}catch(e){if(this.getRethrowLibraryComputationExceptions()&&null!=this.getLibraryComputationException())throw this.getLibraryComputationException();return e}if(t.length>0){if(i=t==this.trueValueStr||t!=this.falseValueStr&&this._parseDouble(t),this.getErrorStrings().indexOf(t)>-1)return t;isNaN(i)||(r+=i)}}return r.toString()},this.computeDate=function(e){var t,i,s=this.splitArgsPreservingQuotedCommas(e),a=s.length;if(3!=a)return this.formulaErrorStrings[this._wrong_number_arguments];for(t=0;t12;)o-=12,n++;l=this._getSerialDateFromDate(n,o,r)}return this._excelLikeComputations&&(i=this._fromOADate(l),"Invalid Date"!=i.toString())?i.toLocaleDateString():l.toString()},this.computeDatevalue=function(e){var t,i,s,a,n=this.splitArgsPreservingQuotedCommas(e),o=n.length;if(1!=o)return this.formulaErrorStrings[this._wrong_number_arguments];t=new Date(Date.parse(n[0])),i=this._parseDouble(n[0]);try{if(!isNaN(i)||"Invalid Date"==t.toString())if(i>0)t=this._fromOADate(i);else{var r=e.split(this.getParseDateTimeSeparator()),o=r.length,l="";for(s=0;s59&&(a+=1),Math.round(a).toString()},this.computeDay=function(e){var t,i=1,s=this.getValueFromArg(e).split(this.tic).join(""),a=this._parseDouble(s);if(isNaN(a)){if(t=new Date(Date.parse(s)),"Invalid Date"==t.toString()){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_Math_argument];return this.getErrorStrings()[1].toString()}i=t.getDate()}else{if(a<1){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_Math_argument];return this.getErrorStrings()[4].toString()}t=this._getDateFromSerialDate(a),i=t.getDate()}return i.toString()},this.computeDays=function(e){var t,i,s=this.splitArgsPreservingQuotedCommas(e); if(2!=s.length){if(this.getRethrowLibraryComputationExceptions())throw this.getFormulaErrorStrings()[this._wrong_number_arguments];return this.getFormulaErrorStrings()[this._wrong_number_arguments]}var a,n,o=this.getValueFromArg(s[1]),r=this.getValueFromArg(s[0]),l=this._parseDouble(o.split(this.tic).join("")),d=this._parseDouble(r.split(this.tic).join(""));return a=isNaN(l)?new Date(Date.parse(o)):this._getDateFromSerialDate(l),n=isNaN(d)?new Date(Date.parse(r)):this._getDateFromSerialDate(d),t=n.getTime()-a.getTime(),i=Math.ceil(t/864e5),i.toString()},this.computeDays360=function(e){var t,i,s,a=this.splitArgsPreservingQuotedCommas(e),n=a.length;if(2!=n&&3!=n)return this.formulaErrorStrings[this._wrong_number_arguments];var o=!1,r=0,l=new Date(Date.parse(this.getValueFromArg(a[0]).split(this.tic).join(""))),d=new Date(Date.parse(this.getValueFromArg(a[1]).split(this.tic).join(""))),h=this._parseDouble(this.getValueFromArg(a[0]).split(this.tic).join("")),c=this._parseDouble(this.getValueFromArg(a[1]).split(this.tic).join(""));if(isNaN(h)&&isNaN(this._isDate(l))||isNaN(c)&&isNaN(this._isDate(d))){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_Math_argument];return this.getErrorStrings()[1].toString()}return l=h>0?this._getDateFromSerialDate(h):l,d=c>0?this._getDateFromSerialDate(c):d,t=!1,i=this.falseValueStr,3==n&&(i=this.getValueFromArg(a[2])),o=i==this.trueValueStr,31==l.getDate()&&(l=new Date(l.setDate(l.getDate()-1))),31==d.getDate()&&!o&&l.getDate()<30?d=new Date(d.setDate(d.getDate()+1)):31==d.getDate()&&(d=new Date(d.setDate(d.getDate()-1))),d9999&&(l=this._fromOADate(s)),l=new Date(l.setMonth(l.getMonth()+d)),a=new Date(l.getFullYear(),l.getMonth()+1,1,-1).getDate(),l=new Date(l.getFullYear(),l.getMonth(),a),this.getExcelLikeComputations()?l.toLocaleDateString():this._getSerialDateTimeFromDate(l).toString()},this.computeHour=function(e){var t,i,s=new Date(Date.now());if(e=this.getValueFromArg(e),e=e.split(this.tic).join(""),s=new Date(Date.parse(e)),t=parseInt(e),t<0){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._bad_index];return this.getErrorStrings()[4].toString()}if("Invalid Date"==s.toString()&&(i=new Date(Date.now()).toLocaleDateString()+" "+e,s=new Date(Date.parse(i))),"Invalid Date"==s.toString()&&(s=this._fromOADate(e)),"Invalid Date"==s.toString()){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._bad_index];return this.getErrorStrings()[1].toString()}return s.getHours().toString()},this.computeISOWeeknum=function(e){var t,i,s,a,n=this.splitArgsPreservingQuotedCommas(e),o=n.length;if(1!=o){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(t=this.getValueFromArg(n[0]),t[0]==this.tic&&this._isTextEmpty(t.split(this.tic).join(""))){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._bad_formula];return this.getErrorStrings()[1].toString()}this._isTextEmpty(t)&&(e=this.computeDatevalue(new Date(1990,12,28).toLocaleDateString())),(e.indexOf(":")>-1||!this._isCellReference(this.getValueFromArg(n[0]))&&this.getValueFromArg(this.DateFormatter(n[0])).indexOf(":")>-1)&&(e="0");var r=this.getValueFromArg(n[0]).split(this.tic).join(""),l=(new Date(r),this.DateFormatter(r)),d=new Date(Date.parse(l));this.dateTime1900;if("Invalid Date"==d.toString())try{i=parseInt(l),d=this.fromOADate(i),r=d.toLocaleDateString()}catch(e){if(this.getRethrowLibraryComputationExceptions())throw"Bad Cell reference";return this.getErrorStrings()[1].toString()}return s=e+this.getParseArgumentSeparator()+"21",a=parseInt(this.computeWeeknum(s)),a.toString()},this.DateFormatter=function(e){var e,t=new Date(e),i=t.getDate(),s=t.getMonth()+1,a=t.getFullYear();return i<10&&(i=+i),s<10&&(s=s),s+"/"+i+"/"+a},this.computeMinute=function(e){var t,i=new Date(Date.now());if(e=this.getValueFromArg(e),e=e.split(this.tic).join(""),i=new Date(Date.parse(e)),e<0){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._bad_index];return this.getErrorStrings()[4].toString()}if("Invalid Date"==i.toString()&&(t=new Date(Date.now()).toLocaleDateString()+" "+e,i=new Date(Date.parse(t))),"Invalid Date"==i.toString()&&(i=this._fromOADate(e)),"Invalid Date"==i.toString()){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._bad_index];return this.getErrorStrings()[1].toString()}return i.getMinutes().toString()},this.computeMonth=function(e){var t,i=1,s=this.getValueFromArg(e),a=new Date(Date.parse(s.split(this.tic).join(""))),n=parseInt(s);if(!isNaN(n)&&a.getFullYear()>9999&&(a=this._fromOADate(n)),s<0){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._bad_index];return this.getErrorStrings()[4].toString()}if("Invalid Date"==a.toString()&&(e=new Date(Date.now()).toLocaleDateString()+" "+e,a=new Date(Date.parse(e))),"Invalid Date"==a.toString()){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._bad_index];return this.getErrorStrings()[1].toString()}if("Invalid Date"!=a.toString())i=a.getMonth()+1;else{if(t=this._parseDouble(this.getValueFromArg(e)),isNaN(t))return this.formulaErrorStrings[this._invalid_arguments];t<1?i=1:(a=this._getDateFromSerialDate(t),i=a.getMonth()+1)}return i.toString()},this.computeNetworkDays=function(e){var t,i,s,a,n,o,r,l,d,h=this.splitArgsPreservingQuotedCommas(e),c=h.length,u=[];if(2!=c&&3!=c)return this.formulaErrorStrings[this._wrong_number_arguments];var m=this.getValueFromArg(h[0]).split(this.tic).join(""),p=this.getValueFromArg(h[1]).split(this.tic).join(""),g=new Date(Date.parse(m)),_=new Date(Date.parse(p)),a=this._parseDouble(m);if(!isNaN(a)&&g.getFullYear()>9999&&(g=this._fromOADate(a)),"Invalid Date"==g.toString()&&(g=this._fromOADate(a)),"Invalid Date"==g.toString()){if(this.getRethrowLibraryComputationExceptions())throw this.getErrorStrings()[1].toString();return this.getErrorStrings()[1].toString()}if(a=this._parseDouble(p),!isNaN(a)&&_.getFullYear()>9999&&(_=this._fromOADate(a)),"Invalid Date"==_.toString()&&(_=this._fromOADate(a)),"Invalid Date"==_.toString()){if(this.getRethrowLibraryComputationExceptions())throw this.getErrorStrings()[1].toString();return this.getErrorStrings()[1].toString()}if(3==c)if(t=h[2],t.indexOf(":")>-1)for(n=this.getCellsFromArgs(t),o=0;og&&s<_&&0!=s.getDay()&&6!=s.getDay()&&u.push(s))}else for(r=this.splitArgsPreservingQuotedCommas(t.split(this.tic).join("")),l=0;l0&&(s=new Date(Date.parse(i)),"Invalid Date"!=s.toString()&&u.indexOf(s)==-1&&s>g&&s<_&&0!=s.getDay()&&6!=s.getDay()&&u.push(s))}var f=0,b=parseInt(this.computeDatevalue(p))-parseInt(this.computeDatevalue(m)),v=g.getDay(),x=_.getDay(),w=v-1,y=7-x;return b=b+w+y,d=2*parseInt(b/7),f=b-w-y-d+1-u.length,(6==x||0==v)&&f--,f.toString()},this.computeNetworkDaysOintl=function(e){var t,i,s,a,n,o,r,l,d=this.splitArgsPreservingQuotedCommas(e),h=d.length,c=[];if(2!=h&&h>4)return this.formulaErrorStrings[this._wrong_number_arguments];var u=this.getValueFromArg(d[0]).split(this.tic).join(""),m=this.getValueFromArg(d[1]).split(this.tic).join(""),p=new Date(Date.parse(this._fromOADate(u))),g=new Date(Date.parse(this._fromOADate(m)));if("Invalid Date"==p.toString()){if(a=this._parseDouble(u),isNaN(a)){if(this.getRethrowLibraryComputationExceptions())throw this.getErrorStrings()[1].toString();return this.getErrorStrings()[1].toString()}p=this.fromOADate(a)}if("Invalid Date"==g.toString()){if(a=this._parseDouble(m),isNaN(a)){if(this.getRethrowLibraryComputationExceptions())throw this.getErrorStrings()[1].toString();return this.getErrorStrings()[1].toString()}g=this._fromOADate(a)}if(4==h)if(t=d[3],t=this.adjustRangeArg(t),t.indexOf(":")>-1||t.indexOf(",")>-1)for(n=this.getCellsFromArgs(t),o=0;op&&s>g&&0!=s.getDay()&&6!=s.getDay()&&c.push(s))}else{try{i=this.getValueFromArg(t).split(this.tic).join("")}catch(e){if(this._rethrowLibraryComputationExceptions&&null!=this.getLibraryComputationException())throw this.getLibraryComputationException();return e}i.length>0&&(s=new Date(Date.parse(i)),"Invalid Date"!=s.toString()&&c.indexOf(s)==-1&&s>p&&s=0?b--:c.indexOf(x)>=0&&b--,x=new Date(x.setDate(x.getDate()+1)),v++;return b.toString()},this.computeNow=function(e){var t=this.splitArgsPreservingQuotedCommas(e),i=t.length;return 1!=i?this.formulaErrorStrings[this._wrong_number_arguments]:new Date(Date.now()).toString()},this.computeSecond=function(e){var t,i,s=this.splitArgsPreservingQuotedCommas(e),a=s.length;if(1!=a)return this.formulaErrorStrings[this._wrong_number_arguments];if(t=new Date(Date.now()),e=this.getValueFromArg(e),e=e.split(this.tic).join(""),t=new Date(Date.parse(e)),e<0){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._bad_index];return this.getErrorStrings()[4].toString()}if("Invalid Date"==t.toString()&&(i=new Date(Date.now()).toLocaleDateString()+" "+e,t=new Date(Date.parse(i))),"Invalid Date"==t.toString()&&(t=this._fromOADate(e)),"Invalid Date"==t.toString()){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._bad_index];return this.getErrorStrings()[1].toString()}return t.getSeconds().toString()},this.computeTime=function(e){var t,i=this.splitArgsPreservingQuotedCommas(e),s=i.length;if(3!=s)return this.formulaErrorStrings[this._wrong_number_arguments];var a=this._parseDouble(this.getValueFromArg(i[0])),n=this._parseDouble(this.getValueFromArg(i[1])),o=this._parseDouble(this.getValueFromArg(i[2])),r=0;if(isNaN(a)||isNaN(n)||isNaN(o)){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._bad_index];return this.getErrorStrings()[1].toString()}if(r=(3600*a+60*n+o)/86400,t=new Date(Date.now()).toLocaleDateString()+" "+r,dt=new Date(Date.parse(t)),r<0){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._bad_index];return this.getErrorStrings()[4].toString()}return r.toString()},this.computeTimevalue=function(e){var t,i,s,a,n=this.splitArgsPreservingQuotedCommas(e),o=n.length;if(1!=o)return this.formulaErrorStrings[this._wrong_number_arguments];if(i=this.getValueFromArg(n[0]).split(this.tic).join(""),i=i.split(this.tic).join(""),i.indexOf(":")>-1&&(t=new Date,i=t.toLocaleDateString()+" "+i),s=new Date(Date.parse(i)),"Invalid Date"==s.toString()&&(e=new Date(Date.now()).toLocaleDateString()+" "+e,s=new Date(Date.parse(e))),"Invalid Date"==s.toString()){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._bad_index];return this.getErrorStrings()[1].toString()}return a=(3600*s.getHours()+60*s.getMinutes()+s.getSeconds())/86400,a.toString()},this.computeToday=function(){var e=new Date(Date.now());return this.getExcelLikeComputations()?e.toLocaleDateString():this._toOADate(e).toString()},this.computeWeekday=function(e){var t,i,s=this.splitArgsPreservingQuotedCommas(e),a=s.length;if(1!=a&&2!=a)return this.formulaErrorStrings[this._wrong_number_arguments];var n=this.getValueFromArg(s[0]),o=new Date(Date.parse(n.split(this.tic).join(""))),r=parseInt(n);return!isNaN(r)&&o.getFullYear()>9999&&(o=this._fromOADate(r)),s[1]=2==a?s[1]:"1","Invalid Date"==o.toString()&&(o=this._fromOADate(r)),t=parseInt(this.getValueFromArg(s[1])),i=o.getDay(),1==t?i+=1:(0==i&&(i=7),3==t&&(i-=1)),i.toString()},this.computeWeeknum=function(e){var t,i,s,a=this.splitArgsPreservingQuotedCommas(e),n=a.length;if(n>3)return this.formulaErrorStrings[this._wrong_number_arguments];t="Invalid Date"==this._fromOADate(this.DateFormatter(this.getValueFromArg(a[0]).split(this.tic).join("")))?this.getValueFromArg(a[0]).split(this.tic).join(""):this.DateFormatter(this.getValueFromArg(a[0]).split(this.tic).join(""));var o=(parseInt(t),new Date(t),new Date(Date.parse(t)));if("Invalid Date"==o.toString()){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._bad_formula];return this.getErrorStrings()[4].toString()}i=["","0","1","","","","","","","","","1","2","3","4","5","6","0","","","","1"],s=2!=n?1:this.getValueFromArg(a[1]),!isNaN(s);var r=parseInt(i[s]),l=new Date(o.getFullYear(),0,1),d=l.getDate(),h=d3){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(t="",i=0,t=3==o?n[0]+this.getParseArgumentSeparator()+n[1]+this.getParseArgumentSeparator()+"1"+this.getParseArgumentSeparator()+n[2]:n[0]+this.getParseArgumentSeparator()+n[1]+this.getParseArgumentSeparator()+"1",s=this.computeWorkDayOintl(t),a=new Date(Date.parse(this._fromOADate(s).toString())),isNaN(Date.parse(s))&&parseInt(s)&&(a=this._fromOADate(s)),"Invalid Date"==a.toString()){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this.bad_formula];return this.getErrorStrings()[1].toString()}return this._toOADate(a).toString()},this.computeWorkDayOintl=function(e){var t,i,s,a,n,o,r=this.splitArgsPreservingQuotedCommas(e),l=r.length;if(l>4||l<2){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}var d,h,c,u=[],m=this.getValueFromArg(r[0]).split(this.tic).join(""),p=new Date(Date.parse(m)),g=this.getValueFromArg(r[1]).split(this.tic).join("");if(!isNaN(Date.parse(m))&&parseInt(m)&&(p=this._fromOADate(m)),isNaN(g)){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this.bad_formula];return this.getErrorStrings()[1].toString()}if(c=this._toOADate(p)+g,""==m.split(this.tic).join("")){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this.bad_formula];return this.getErrorStrings()[0].toString()}if("Invalid Date"==p.toString()){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this.bad_formula];return this.getErrorStrings()[1].toString()}if(t=parseInt(g.toString()),4==l)if(d=r[3],d=this.adjustRangeArg(d),d.indexOf(":")>-1||d.indexOf(",")>-1)for(i=this.getCellsFromArgs(d),s=0;sp&&u.push(a.toString()))}else{try{h=this.getValueFromArg(d).split(this.tic).join("")}catch(e){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this.bad_formula];return this.getErrorStrings()[4].toString()}""!=h&&(a=new Date(Date.parse(h)),isNaN(Date.parse(h))&&parseInt(h)&&(a=this._fromOADate(h)),"Invalid Date"!=a.toString()&&u.indexOf(a)==-1&&a>p&&u.push(a))}if(n=parseInt(r[2]),l>2&&!isNaN(n)||(n=1),0==n){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this.bad_formula];return this.getErrorStrings()[4].toString()}var _=this._splitArguments(_weekEndType[n].toString(),","),f=0,b=p;if(t<0)for(;f>t;)b=new Date(b.setDate(b.getDate()-1)),o=b.getDay(),_.indexOf(o.toString())<0&&u.indexOf(b)<0&&f--;else for(;f9999&&(a=this._fromOADate(n)),0==n)return"1900";if(n<0){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this.bad_formula];return this.getErrorStrings()[4].toString()}if(""==s.split(this.tic).join("")){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this.bad_formula];return this.getErrorStrings()[0].toString()}if("Invalid Date"==a.toString()){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this.bad_formula];return this.getErrorStrings()[1].toString()}return a.getFullYear().toString()},this.computeChar=function(e){var t,i,s=this.splitArgsPreservingQuotedCommas(e),a=s.length;if(1!=a){if(this.getRethrowLibraryComputationExceptions()&&null!=this.getLibraryComputationException())throw this.getLibraryComputationException();return this.formulaErrorStrings[this._wrong_number_arguments]}if(t=this.getValueFromArg(s[0]).split(this.tic).join(""),i=this._parseDouble(t),!isNaN(i)&&i>0&&i<256)return String.fromCharCode(t);if(this.getErrorStrings().indexOf(t)>-1){if(this.getRethrowLibraryComputationExceptions()&&null!=this.getLibraryComputationException())throw this.getLibraryComputationException();return t}return t[0]==this.tic?this.getErrorStrings()[1].toString():this.getErrorStrings()[5].toString()},this.computeCode=function(e){var t,i,s,a=this.splitArgsPreservingQuotedCommas(e),n=a.length;if(1!=n){if(this.getRethrowLibraryComputationExceptions()&&null!=this.getLibraryComputationException())throw this.getLibraryComputationException();return this.formulaErrorStrings[this._wrong_number_arguments]}if(t=this.getValueFromArg(a[0]).split(this.tic).join(""),i=parseInt(t),!isNaN(i))return t.charCodeAt(0).toString();if(null==t||""==t){if(this.getRethrowLibraryComputationExceptions()&&null!=this.getLibraryComputationException())throw this.getLibraryComputationException();return a[0].length>4?this.getErrorStrings()[5].toString():this.getErrorStrings()[1].toString()}if(!this._isCellReference(a[0])&&a[0].indexOf(this.tic)==-1){if(this.getRethrowLibraryComputationExceptions()&&null!=this.getLibraryComputationException())throw this.getLibraryComputationException();return this.getErrorStrings()[5].toString()}return s=t,s.charCodeAt(0).toString()},this.computeUniCode=function(e){var t,i,s,a=this.splitArgsPreservingQuotedCommas(e),n=a.length;if(1!=n){if(this.getRethrowLibraryComputationExceptions()&&null!=this.getLibraryComputationException())throw this.getLibraryComputationException();return this.formulaErrorStrings[this._wrong_number_arguments]}if(t=this.getValueFromArg(a[0]),this._isCellReference(a[0])){if(this.getRethrowLibraryComputationExceptions()&&null!=this.getLibraryComputationException())throw this.getLibraryComputationException();return this.getErrorStrings()[5].toString()}if(i=this._parseDouble(t),"invalid expression"==t||null==t||""==t||!isNaN(i)){if(this.getRethrowLibraryComputationExceptions()&&null!=this.getLibraryComputationException())throw this.getLibraryComputationException();return this.getErrorStrings()[1].toString()}return s=t.split(this.tic).join("").charCodeAt(0),s.toString()},this.computeUpper=function(e){if(!this._isCellReference(e)&&e[0].indexOf(this.tic)==-1){if(this.getRethrowLibraryComputationExceptions()&&null!=this.getLibraryComputationException())throw this.getLibraryComputationException();return this.getErrorStrings()[5].toString()}return this._stripTics0(this.getValueFromArg(e)).toUpperCase()},this.computeLower=function(e){if(!this._isCellReference(e)&&e[0].indexOf(this.tic)==-1){if(this.getRethrowLibraryComputationExceptions()&&null!=this.getLibraryComputationException())throw this.getLibraryComputationException();return this.getErrorStrings()[5].toString()}return this._stripTics0(this.getValueFromArg(e)).toLowerCase()},this.computeLen=function(e){var t,i,s,a=this.splitArgsPreservingQuotedCommas(e),n=a.length;return 1!=n?this.formulaErrorStrings[this._wrong_number_arguments]:(t=this._stripTics0(this.getValueFromArg(a[0])),isNaN(parseInt(t))&&(i=new Date(Date.parse(t)),"Invalid Date"!=i&&(t=this.DateFormatter(t))),s=t[0]==this.tic&&t[t.length-1]==this.tic,(s?t.length-2:t.length).toString())},this.computeMid=function(e){var t,i,s=this.splitArgsPreservingQuotedCommas(e),a=s.length;if(3!=a)return this.formulaErrorStrings[this._wrong_number_arguments];if(t=s[0],t=this.getValueFromArg(t),!this._isCellReference(s[0])&&s[0][0]!=this.tic){if(this.getRethrowLibraryComputationExceptions()&&null!=this.getLibraryComputationException())throw this.getLibraryComputationException();return this.getErrorStrings()[5].toString()}var n=t[0]==this.tic&&t[t.length-1]==this.tic,o=this.getValueFromArg(s[1]),r=this._parseDouble(s[2]);return o=this.getValueFromArg(s[1]),i=Number(o)+Number(n?0:-1),s[1].indexOf("#VALUE!")>-1?"#VALUE!":Number(i)>t.length?"":(t=i+r>t.length?t.substring(i):this._substring(t,i,r),n&&t[0]!=this.tic&&(t=this.tic+t),n&&t&&(t+=this.tic),this._stripTics0(t))},this.computeLeft=function(e){var t,i,s,a,n=this.splitArgsPreservingQuotedCommas(e),o=n.length;if(1!=o&&2!=o)return this.formulaErrorStrings[this._wrong_number_arguments];if(t=this._stripTics0(this.getValueFromArg(n[0])),!this._isCellReference(n[0])&&n[0].indexOf(this.tic)==-1){if(this.getRethrowLibraryComputationExceptions()&&null!=this.getLibraryComputationException())throw this.getLibraryComputationException();return this.getErrorStrings()[5].toString()}return i=t[0]==this.tic&&t[t.length-1]==this.tic,s=2==o?n[1]:"1",s=this.computedValue(s),a=Number(s)+Number(i?1:0),a=t.length>=a?a:t.length,a=t.length>=a?a:t.length,a<1?this.getErrorStrings()[1].toString():(t=t.substring(0,a),i&&t[t.length-1]!=this.tic&&(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(e){var t,i,s=this.splitArgsPreservingQuotedCommas(e),a=s.length;if(1!=a&&2!=a)return this.formulaErrorStrings[this._wrong_number_arguments];if(s1=this._stripTics0(this.getValueFromArg(s[0])),!this._isCellReference(s[0])&&s[0].indexOf(this.tic)==-1){if(this.getRethrowLibraryComputationExceptions()&&null!=this.getLibraryComputationException())throw this.getLibraryComputationException();return this.getErrorStrings()[5].toString()}var n=s1[0]==this.tic&&s1[s1.length-1]==this.tic,o=2==a?this.getValueFromArg(s[1]):"1",t=parseInt(o);return isNaN(t)||t<0||o.indexOf("#VALUE!")>-1?"#VALUE!":0==t?"":(t=Number(o)+Number(n?1:0),i=s1.length>=t?s1.length-t:0,s1=s1.substring(i),n&&s1[0]!=this.tic&&(s1=this.tic+s1),s1)},this.computeReplace=function(e){var t,i=this.splitArgsPreservingQuotedCommas(e),s=i.length;if(4!=s)return this.formulaErrorStrings[this._wrong_number_arguments];var a=this._stripTics0(this.getValueFromArg(i[0])),n=this._stripTics0(this.getValueFromArg(i[3])),o="",r=this._parseDouble(this.getValueFromArg(i[1])),l=this._parseDouble(this.getValueFromArg(i[2]));if(!this._isCellReference(i[0])&&i[0][0]!=this.tic||!this._isCellReference(i[3])&&i[3][0]!=this.tic){if(this.getRethrowLibraryComputationExceptions()&&null!=this.getLibraryComputationException())throw this.getLibraryComputationException();return this.getErrorStrings()[5].toString()}if(0==r&&0==l){if(this.getRethrowLibraryComputationExceptions()&&null!=this.getLibraryComputationException())throw this.getLibraryComputationException();return this.getErrorStrings()[1].toString()}if(isNaN(r)||isNaN(l)){if(this.getRethrowLibraryComputationExceptions()&&null!=this.getLibraryComputationException())throw this.getLibraryComputationException();return this.getErrorStrings()[1].toString()}try{if(t="",null==a||""==a)return n;a.length<=r&&r>l?o=a+n:a.length<=r?(t=a,o=a.split(t).join(n)):0==l?o=n+a:(t=this._substring(a,r-1,l),o=a.split(t).join(n))}catch(e){if(this.getRethrowLibraryComputationExceptions()&&null!=this.getLibraryComputationException())throw this.getLibraryComputationException();return this.getErrorStrings()[1].toString()}return o},this.computeExact=function(e){var t,i,s,a,n=this.splitArgsPreservingQuotedCommas(e);if(2!=n.length)return this.formulaErrorStrings[this._requires_2_args];if(t=this.getValueFromArg(n[0]),i=this.getValueFromArg(n[1]),s=this._parseDouble(t),a=this._parseDouble(i),!this._isCellReference(n[0])&&n[0].indexOf(this.tic)==-1||!this._isCellReference(n[1])&&n[1].indexOf(this.tic)==-1){if(this.getRethrowLibraryComputationExceptions()&&null!=this.getLibraryComputationException())throw this.getLibraryComputationException();return this.getErrorStrings()[5].toString()}return isNaN(s)||(t=s.toString()),isNaN(a)||(i=a.toString()),t.split(this.tic).join("")==i.split(this.tic).join("")?"TRUE":"FALSE"},this.computeFind=function(e){var t,i,s=this.splitArgsPreservingQuotedCommas(e);if(2!=s.length&&3!=s.length)return this.formulaErrorStrings[this._wrong_number_arguments];if(!this._isCellReference(s[0])&&s[0].indexOf(this.tic)==-1||!this._isCellReference(s[1])&&s[1].indexOf(this.tic)==-1||!this._isCellReference(s[0])&&s[0].indexOf(this.tic)==-1){if(this.getRethrowLibraryComputationExceptions()&&null!=this.getLibraryComputationException())throw this.getLibraryComputationException();return this.getErrorStrings()[5].toString()}var a=this._stripTics0(this.getValueFromArg(s[0])),n=this._stripTics0(this.getValueFromArg(s[1])),o=1;return 3==s.length&&(t=this.getValueFromArg(s[2]),o=this._parseDouble(t),isNaN(o)&&(o=1)),o<=0||o>n.length?"#VALUE!":(i=n.indexOf(a,o-1),i<0?"#VALUE!":(Number(i)+Number(1)).toString())},this.computeSearch=function(e){var t,i,s,a,n,o,r=this.splitArgsPreservingQuotedCommas(e),l=r.length,d=1;if(2!=l&&3!=l)return this.formulaErrorStrings[this._wrong_number_arguments];if(i=this._stripTics0(this.getValueFromArg(r[0])).toUpperCase(),s=this._stripTics0(this.getValueFromArg(r[1])).toUpperCase(),!this._isCellReference(r[0])&&r[0][0]!=this.tic||!this._isCellReference(r[1])&&r[1][0]!=this.tic){if(this.getRethrowLibraryComputationExceptions()&&null!=this.getLibraryComputationException())throw this.getLibraryComputationException();return this.getErrorStrings()[5].toString()}if(a=i,i.indexOf("*")>-1)i=i.split("*").join("")[0].toString();else if(i.indexOf("?")>-1){for(n=a.substring(0,a.indexOf("?")),o=Number(s.indexOf(n));s.indexOf(a)==-1;)for(o=Number(s.substring(o).indexOf(n))+Number(o)+1,a=i;a.indexOf("?")!=-1;){if(s.length<=o)return this.getErrorStrings()[1].toString();a=a.substring(0,a.indexOf("?"))+s[o]+i.substring(a.indexOf("?")+1),o++}i=a}if(t=Number(s.indexOf(i))+1,3==l){if(d=parseInt(this.getValueFromArg(r[2])),1==d&&i[0]==s[0])return d;if(!isNaN(d))try{t=Number(s.indexOf(i,d))+1}catch(e){return this.getErrorStrings()[1].toString()}}return 0==t?this.getErrorStrings()[1].toString():t.toString()},this.computeSubstitute=function(e){var t,i,s,a,n=this.splitArgsPreservingQuotedCommas(e);if(3!=n.length&&4!=n.length)return this.formulaErrorStrings[this._wrong_number_arguments];var o=this._stripTics0(this.getValueFromArg(n[0])),r=this._stripTics0(this.getValueFromArg(n[1])),l=this._stripTics0(this.getValueFromArg(n[2]));if(!this._isCellReference(n[0])&&n[0][0]!=this.tic||!this._isCellReference(n[1])&&n[1][0]!=this.tic||!this._isCellReference(n[2])&&n[2][0]!=this.tic){if(this.getRethrowLibraryComputationExceptions()&&null!=this.getLibraryComputationException())throw this.getLibraryComputationException();return this.getErrorStrings()[5].toString()}if(3==n.length){if(""==r||null==r)return o;o=o.split(r).join(l)}else{if(t=this.getValueFromArg(n[3]),!this._isCellReference(n[3])&&n[3][0]==this.tic){if(this.getRethrowLibraryComputationExceptions()&&null!=this.getLibraryComputationException())throw this.getLibraryComputationException();return this.getErrorStrings()[5].toString()}if(i=parseInt(t),!isNaN(i)){for(s=i,a=-1;s>0&&(a=o.indexOf(r,Number(a)+1))>-1;)s--;0==s&&(o=o.substring(0,a)+l+o.substring(Number(a)+Number(r.length)))}}return o},this.computeUniChar=function(e){var t,i,s,a=this.splitArgsPreservingQuotedCommas(e),n=a.length;if(1!=n){if(this.getRethrowLibraryComputationExceptions()&&null!=this.getLibraryComputationException())throw this.getLibraryComputationException();return this.formulaErrorStrings[this._wrong_number_arguments]}if(t=this.getValueFromArg(a[0]), i=this._parseDouble(this._stripTics0(t)),isNaN(i)||i<=0){if(this.getRethrowLibraryComputationExceptions()&&null!=this.getLibraryComputationException())throw this.getLibraryComputationException();return t[0]==this.tic?this.getErrorStrings()[5].toString():this.getErrorStrings()[1].toString()}return s=String.fromCharCode(t),s.toString()},this.computeClean=function(e){var t,i,s,a,n,o=this.splitArgsPreservingQuotedCommas(e);if(1!=o.length)return this.formulaErrorStrings[this._wrong_number_arguments].toString();if(t=this.getValueFromArg(o[0]),i=!0,!this._isCellReference(o[0])&&o[0][0]!=this.tic){if(this.getRethrowLibraryComputationExceptions()&&null!=this.getLibraryComputationException())throw this.getLibraryComputationException();return this.getErrorStrings()[5].toString()}if(s="TRUE"==t||"FALSE"==t,this.getErrorStrings().indexOf(t)>-1)return t;if(t.indexOf(this.tic)==-1&&!this._isCellReference(e)&&isNaN(this._parseDouble(t))&&!s)return this.getErrorStrings()[5].toString();for(a=0;a<=31;a++)n=this.computeChar(a.toString()),t.indexOf(n)>-1&&(t=t.replace(n,""));return t[0]==this.tic&&t[t.length-1]==this.tic&&(t=this._substring(t,1,t.length-1)),t},this.computeTrim=function(e){var t,i=this._stripTics0(this.getValueFromArg(e));[this.tic,""];if(i=i.split(this.tic).join(""),t=0,!this._isCellReference(e)&&e[0]!=this.tic){if(this.getRethrowLibraryComputationExceptions()&&null!=this.getLibraryComputationException())throw this.getLibraryComputationException();return this.getErrorStrings()[5].toString()}for(;i.length!=t;)t=i.length,i=i.split(" ").join(" ");return i},this.computeRept=function(e){var t,i,s,a,n,o=this.splitArgsPreservingQuotedCommas(e),r=o.length;if(2!=r){if(this.getRethrowLibraryComputationExceptions()&&null!=this.getLibraryComputationException())throw this.getLibraryComputationException();return this.formulaErrorStrings[this._wrong_number_arguments]}if(t=this._stripTics0(this.getValueFromArg(o[0])),!this._isCellReference(o[0])&&o[0][0]!=this.tic){if(this.getRethrowLibraryComputationExceptions()&&null!=this.getLibraryComputationException())throw this.getLibraryComputationException();return this.getErrorStrings()[5].toString()}if(i=1,s=parseInt(this.getValueFromArg(o[1].split(this.tic).join(""))),null==s||""==s)return"";if(s<0||isNaN(s)){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._bad_index];return this.getErrorStrings()[1].toString()}for(a="",n=0;n32767){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._bad_index];return this.getErrorStrings()[1].toString()}a=a.concat(t)}return a},this.computeProper=function(e){var t,i,s,a=this.splitArgsPreservingQuotedCommas(e),n=a.length;if(1!=n){if(this.getRethrowLibraryComputationExceptions()&&null!=this.getLibraryComputationException())throw this.getLibraryComputationException();return this.formulaErrorStrings[this._wrong_number_arguments]}if(t=this.getValueFromArg(a[0]),!this._isCellReference(a[0])&&a[0][0]!=this.tic){if(this.getRethrowLibraryComputationExceptions()&&null!=this.getLibraryComputationException())throw this.getLibraryComputationException();return this.getErrorStrings()[5].toString()}return i=this._stripTics0(t),s=i.indexOf("'"),s>=0&&s64&&i<91);)t++,e[t]!=undefined?i=e[t].toUpperCase().charCodeAt(0):(t--,i=0);return e.substr(0,t)+e.charAt(t).toUpperCase()+e.substr(t+1).toLowerCase()}):/[a - zA - Z0 - 9] + $/.test(i)&&(i=i.replace(/[^a-zA-Z0-9_\\]/,"")),i},this.computeT=function(e){var t,i,s,a=0,n=this.splitArgsPreservingQuotedCommas(e);if(n.length>1)for(t=0;t-1)for(--a,i=this.getCellsFromArgs(t),s=0;s1)return this.formulaErrorStrings[this._wrong_number_arguments];var o=this.getValueFromArg(e),r="TRUE"==o||"FALSE"==o;return isNaN(this._parseDouble(o))&&!r&&isNaN(this._isDate(o))&&/[a-zA-Z0-9!#$%&'()*+,\/:;<=>?@\^_`{|}~-]/.test(o)?this._stripTics0(o):" "},this.computeNumberValue=function(e){var t,i,s,a,n,o,r=this.splitArgsPreservingQuotedCommas(e),l=r.length,d=this._parseDecimalSeparator,h=this._parseArgumentSeparator;if(l>3){if(this.getRethrowLibraryComputationExceptions()&&null!=this.getLibraryComputationException())throw this.getLibraryComputationException();return this.formulaErrorStrings[this._wrong_number_arguments]}if(t=this._stripTics0(this.getValueFromArg(r[0])),l>1)try{if(i=r.length>1&&null!=r[2]?this._stripTics0(this.getValueFromArg(r[1])):h,s=r.length>1&&null!=r[2]?this._stripTics0(this.getValueFromArg(r[2])):d,"invalid expression"==i||"invalid expression"==s||(null==i||""==i)&&(null==s||""==s)){if(this.getRethrowLibraryComputationExceptions()&&null!=this.getLibraryComputationException())throw this.getLibraryComputationException();return this.getErrorStrings()[1].toString()}d=this._stripTics0(i)[0],h=this._stripTics0(s)[0]}catch(e){if(this.getRethrowLibraryComputationExceptions()&&null!=this.getLibraryComputationException())throw this.getLibraryComputationException();return this.getErrorStrings()[1].toString()}if(""==t||null==t)return"0";if(a=t.indexOf(d),n=t.indexOf(h),n>=a&&(a!=-1||n!=-1)&&r.length>2){if(this.getRethrowLibraryComputationExceptions()&&null!=this.getLibraryComputationException())throw this.getLibraryComputationException();return this.getErrorStrings()[1].toString()}if(t=t.replace(this.tic,""),t=t.replace(" ",""),t=t.replace(h.toString(),""),t=t.replace(d,this._parseDecimalSeparator),o=this.computeValue(t),isNaN(o)||"$"==t[t.length-1]){if(this.getRethrowLibraryComputationExceptions()&&null!=this.getLibraryComputationException())throw this.getLibraryComputationException();return this.getErrorStrings()[1].toString()}return o},this.computeConcatenate=function(e){var t,i,s="",a=this.splitArgsPreservingQuotedCommas(e);if(!e||0==e.length){if(this.getRethrowLibraryComputationExceptions()&&null!=this.getLibraryComputationException())throw this.getLibraryComputationException();return this.formulaErrorStrings[this._wrong_number_arguments]}for(t=0;t-1&&(s="#N/A"),s},this.computeValue=function(e){var t,i,s,a,n,o="";try{if(t=this.splitArgsPreservingQuotedCommas(e),i=t.length,1!=i){if(this.getRethrowLibraryComputationExceptions()&&null!=this.getLibraryComputationException())throw this.getLibraryComputationException();return this.formulaErrorStrings[this._wrong_number_arguments]}var r=t[0],l=!1,d=!1;if(r.indexOf(this.tic)>-1&&(l=!0),r=this._stripTics0(this.getValueFromArg(r)),(null!=r||""!=r)&&!this._isCellReference(r)&&l&&isNaN(this._parseDouble(r.split(",").join("").split("$").join("")))&&(r=r.split(this.tic).join(""),d=!0),!this._isCellReference(t[0])&&t[0].indexOf(this.tic)==-1&&isNaN(this._parseDouble(r))){if(this.getRethrowLibraryComputationExceptions()&&null!=this.getLibraryComputationException())throw this.getLibraryComputationException();return this.getErrorStrings()[5].toString()}if((null==r||""==r)&&l){if(this.getRethrowLibraryComputationExceptions()&&null!=this.getLibraryComputationException())throw this.getLibraryComputationException();return this.getErrorStrings()[1].toString()}if((null==r||""==r)&&!l){if(this.getRethrowLibraryComputationExceptions()&&null!=this.getLibraryComputationException())throw this.getLibraryComputationException();return this.formulaErrorStrings[this._invalid_arguments]}if(r.indexOf(":")>-1)return o=this.computeTimevalue(r),o.toString();if("$"==r[0]&&(r=r.split("$").join("")),r.indexOf(",")>-1&&(r=r.split(",").join("")),("%"==r[0]||"%"==r[r.length-1])&&(r=r.split("%").join(""),s=this._parseDouble(r),isNaN(s)||(r=(s/100).toString())),a=new Date(Date.parse(r)),n=this._parseDouble(r),isNaN(n)){if("Invalid Date"==a.toString()){if(this.getRethrowLibraryComputationExceptions()&&null!=this.getLibraryComputationException())throw this.getLibraryComputationException();return this.getErrorStrings()[1].toString()}o=this._toOADate(a)}else o=n.toString()}catch(e){if(this.getRethrowLibraryComputationExceptions()&&null!=this.getLibraryComputationException())throw this.getLibraryComputationException();return this.getErrorStrings()[1].toString()}return o.toString()},this.computeDollar=function(e){var t,i,s,a,n,o=this.splitArgsPreservingQuotedCommas(e),r=o[0],l="2";if(2==o.length&&(l=o[1]),o.length>2){if(this.getRethrowLibraryComputationExceptions()&&null!=this.getLibraryComputationException())throw this.getLibraryComputationException();return this.formulaErrorStrings[this._wrong_number_arguments]}if(r=this.getValueFromArg(r),l=this.getValueFromArg(l),t=this._parseDouble(r),i=!1,isNaN(this._parseDouble(l))){if(this.getRethrowLibraryComputationExceptions()&&null!=this.getLibraryComputationException())throw this.getLibraryComputationException();return this.getErrorStrings()[5].toString()}if((null==r||""==r)&&this._isCellReference(o[0])&&r[0]!=this.tic&&r[r.length-1]!=this.tic&&(t=0,i=!0),isNaN(t)&&!i){if(this.getRethrowLibraryComputationExceptions()&&null!=this.getLibraryComputationException())throw this.getLibraryComputationException();return this.getErrorStrings()[1].toString()}return s=this._parseDouble(l),a=0,isNaN(s)&&(s=""==l?0:2),s>0?ej.format(t,"c"+s):(n=Math.pow(10,-s),a=Math.round(t/n)*n,ej.format(a,"c0"))},this.computeFixed=function(e){var t,i,s,a,n,o=this.splitArgsPreservingQuotedCommas(e),r=o[0],l="2",d="FALSE",h=o.length;if(h>1&&(l=o[1]),h>2&&(d=o[2]),r=this.getValueFromArg(r),l=this.getValueFromArg(l),d=this.getValueFromArg(d),t=this._parseDouble(r),isNaN(t)){if(this.getRethrowLibraryComputationExceptions()&&null!=this.getLibraryComputationException())throw this.getLibraryComputationException();return this.getErrorStrings()[1].toString()}if(i=this._parseDouble(l),isNaN(i)&&(i=""==l?0:2),s=this._parseDouble(d),isNaN(s))if(d.toUpperCase()==this.falseValueStr)a=!1;else{if(d.toUpperCase()!=this.trueValueStr)return"#NAME?";a=!0}else a=0!=s;return a&&(ej.preferredCulture().numberFormat[","]=""),i>0?ej.format(t,"n"+i):(n=Math.pow(10,-i),t=Math.round(t/n)*n,ej.format(t,"n0"))},this.computeBin2Dec=function(e){var t,i,s=this.splitArgsPreservingQuotedCommas(e);if(s.length>1){if(this.getRethrowLibraryComputationExceptions()&&null!=this.getLibraryComputationException())throw this.getLibraryComputationException();return this.formulaErrorStrings[this._wrong_number_arguments]}if(t=this.getValueFromArg(s[0]).replace(this.tic,""),!/^[01]{1,10}$/.test(t))return this.getErrorStrings()[4].toString();try{return""==t&&(t="0"),i=parseInt(t,2),10==t.length&&"1"==t.substring(0,1)?(parseInt(t.substring(1),2)-512).toString():i.toString()}catch(e){if(this.getRethrowLibraryComputationExceptions()&&null!=this.getLibraryComputationException())throw this.getLibraryComputationException();return this.getErrorStrings()[1].toString()}},this.computeBin2Oct=function(e){var t,i,s,a,n,o=this.splitArgsPreservingQuotedCommas(e),r=this.getValueFromArg(o[0]).replace(this.tic,""),l="";if(!/^[01]{1,10}$/.test(r))return this.getErrorStrings()[4].toString();if(o.length>2){if(this.getRethrowLibraryComputationExceptions()&&null!=this.getLibraryComputationException())throw this.getLibraryComputationException();return this.formulaErrorStrings[this._wrong_number_arguments]}if(o.length>1&&(places=parseInt(this.getValueFromArg(o[1]).replace(this.tic,""))),t=o.toString(),10==t.length&&"1"==t.substring(0,1)){for(i=10,s="",a=0;a<3;a++){i-=3;var d=this._substring(t,i,3),h=this._parseDouble(parseInt(d,2).toString(8)),c=0;for(n=h;n>0;c+=parseInt(n%10),n=parseInt(n/10));s=c.toString()+s}return"7777777"+s}if(r<0)return(1073741824+r).toString(8);if(l=parseInt(r,10).toString(8),"undefined"==typeof places)return l;if(isNaN(places))return"#VALUE!";if(places<0)return"#NUM!";if(places=Math.floor(places),places>=l.length&&places<=10)for(;places-l.length>0;)l="0"+l,places--;else if(this.getRethrowLibraryComputationExceptions())throw(new this.getErrorStrings)[4].toString();return l},this.computeBin2Hex=function(e){var t=0,i=this.splitArgsPreservingQuotedCommas(e),s=this.getValueFromArg(i[0]).replace(this.tic,""),a="";if(i.length>2){if(this.getRethrowLibraryComputationExceptions()&&null!=this.getLibraryComputationException())throw this.getLibraryComputationException();return this.formulaErrorStrings[this._wrong_number_arguments]}if(i.length>1&&(t=this._parseDouble(i[1])),"1111111111"==s)return s.replace("1","F");if(10==s.length&&"1"==s.substring(0,1))return(1073741312+parseInt(s,2).toString(8)).toString();try{if(s.length>10||this._parseDouble(s)<0||isNaN(s)){if(this.getRethrowLibraryComputationExceptions()&&null!=this.getLibraryComputationException())throw this.getLibraryComputationException();return this.getErrorStrings()[4].toString()}if(a=parseInt(s,2).toString(16),i.length>1)if(t>=a.length&&t<=10)a=this._padLeft("0",t,a);else{if(this.getRethrowLibraryComputationExceptions()&&null!=this.getLibraryComputationException())throw this.getLibraryComputationException();a=this.getErrorStrings()[4].toString()}}catch(e){if(this.getRethrowLibraryComputationExceptions()&&null!=this.getLibraryComputationException())throw this.getLibraryComputationException();if(this.computeIsText(s)!=this.trueValueStr)return""==s?"0":this.getErrorStrings()[4].toString();a=this.getErrorStrings()[5].toString()}return a.toUpperCase()},this.computeDec2Bin=function(e){var t,i=0,s=this.splitArgsPreservingQuotedCommas(e),a=this.getValueFromArg(s[0]).replace(this.tic,""),n=s.length>1?this.getValueFromArg(s[1]).replace(this.tic,""):"10",o="";if(null==e||""==e||s.length>2||s.length<1){if(this.getRethrowLibraryComputationExceptions()&&null!=this.getLibraryComputationException())throw this.getLibraryComputationException();return this.formulaErrorStrings[this._wrong_number_arguments]}if(isNaN(this._parseDouble(a))&&isNaN(this._parseDouble(n))){if((null!=a||""!=a)&&this.computeIsText(a)==this.trueValueStr||(null!=n||""!=n)&&this.computeIsText(n)==this.trueValueStr){if(this.getRethrowLibraryComputationExceptions()&&null!=this.getLibraryComputationException())throw this.getLibraryComputationException();return this.getErrorStrings()[1].toString()}if(null!=a&&""!=a&&this.computeIsText(a)==this.falseValueStr||null!=a&&""!=a&&this.computeIsText(n)==this.falseValueStr){if(this.getRethrowLibraryComputationExceptions()&&null!=this.getLibraryComputationException())throw this.getLibraryComputationException();return this.getErrorStrings()[1].toString()}if(null==a&&""==a||null==n||""==n){if(this.getRethrowLibraryComputationExceptions()&&null!=this.getLibraryComputationException())throw this.getLibraryComputationException();return this.getErrorStrings()[1].toString()}}try{if(s.length>1&&(t=this.getValueFromArg(s[1]).replace(this.tic,""),i=this._parseDouble(t)),this._parseDouble(a)<-512||this._parseDouble(a)>511){if(this.getRethrowLibraryComputationExceptions()&&null!=this.getLibraryComputationException())throw this.getLibraryComputationException();return this.getErrorStrings()[4].toString()}if(o=(a>>>0).toString(2),!isNaN(this._parseDouble(a))&&this._parseDouble(a)<0&&(o=o.substring(o.length-10)),s.length>1){if(i>10){if(this.getRethrowLibraryComputationExceptions()&&null!=this.getLibraryComputationException())throw this.getLibraryComputationException();return this.getErrorStrings()[4].toString()}i<=10&&(o=this._padLeft("0",i,o))}}catch(e){if(this.getRethrowLibraryComputationExceptions()&&null!=this.getLibraryComputationException())throw this.getLibraryComputationException()}return o},this.computeDec2Oct=function(e){var t,i=0,s=this.splitArgsPreservingQuotedCommas(e),a=this.getValueFromArg(s[0]).replace(this.tic,""),n=s.length>1?this.getValueFromArg(s[1]).replace(this.tic,""):"10",o="";if(null==e||""==e||s.length>2||s.length<1){if(this.getRethrowLibraryComputationExceptions()&&null!=this.getLibraryComputationException())throw this.getLibraryComputationException();return this.formulaErrorStrings[this._wrong_number_arguments]}if(isNaN(this._parseDouble(a))&&isNaN(this._parseDouble(n))){if((null!=a||""!=a)&&this.computeIsText(a)==this.trueValueStr||(null!=n||""!=n)&&this.computeIsText(n)==this.trueValueStr){if(this.getRethrowLibraryComputationExceptions()&&null!=this.getLibraryComputationException())throw this.getLibraryComputationException();return this.getErrorStrings()[1].toString()}if(this.getErrorStrings().indexOf(a)>-1)return a;if(this.getErrorStrings().indexOf(n)>-1)return n;if(null!=a&&""!=a&&this.computeIsText(a)==this.falseValueStr||null!=a&&""!=a&&this.computeIsText(n)==this.falseValueStr){if(this.getRethrowLibraryComputationExceptions()&&null!=this.getLibraryComputationException())throw this.getLibraryComputationException();return this.getErrorStrings()[1].toString()}if(null==a&&""==a||null==n||""==n){if(this.getRethrowLibraryComputationExceptions()&&null!=this.getLibraryComputationException())throw this.getLibraryComputationException();return this.getErrorStrings()[1].toString()}}try{if(s.length>1&&(t=this.getValueFromArg(s[1]).replace(this.tic,""),i=this._parseDouble(t)),this._parseDouble(a)<-536870912||this._parseDouble(a)>536870911){if(this.getRethrowLibraryComputationExceptions()&&null!=this.getLibraryComputationException())throw this.getLibraryComputationException();return this.getErrorStrings()[4].toString()}if(this._parseDouble(a)<0)o=parseInt(a>>>0,10).toString(8),!isNaN(this._parseDouble(a))&&this._parseDouble(a)<0&&(o=o.substring(o.length-10));else if(o=parseInt(a,10).toString(8),!isNaN(this._parseDouble(a))&&this._parseDouble(a)<0&&(o=o.substring(o.length-10)),s.length>1){if(i>10){if(this.getRethrowLibraryComputationExceptions()&&null!=this.getLibraryComputationException())throw this.getLibraryComputationException();return this.getErrorStrings()[4].toString()}i<=10&&(o=this._padLeft("0",i,o))}}catch(e){if(this.getRethrowLibraryComputationExceptions()&&null!=this.getLibraryComputationException())throw this.getLibraryComputationException()}return o},this.computeHex2Bin=function(e){var t,i,s,a,n,o=0,r=this.splitArgsPreservingQuotedCommas(e);if(e==this._parseArgumentSeparator.toString()){if(this.getRethrowLibraryComputationExceptions()&&null!=this.getLibraryComputationException())throw this.getLibraryComputationException();return this.getErrorStrings()[0].toString()}if(t=this.getValueFromArg(r[0]),i=2==r.length?this.getValueFromArg(r[1]):"0",""!=t){if(t[0]!=this.tic&&!this._isCellReference(t)&&isNaN(this._parseDouble(t))){if(this.getRethrowLibraryComputationExceptions()&&null!=this.getLibraryComputationException())throw this.getLibraryComputationException();return this.getErrorStrings()[5].toString()}}else if(this._isCellReference(r[0])&&""==t)return"0";if(t[0]==this.tic&&(null==t.split(this.tic).join("")||""==t.split(this.tic).join("")))return"0";if(i[0]==this.tic){if(this.getRethrowLibraryComputationExceptions()&&null!=this.getLibraryComputationException())throw this.getLibraryComputationException();return this.getErrorStrings()[1].toString()}if(isNaN(this._parseDouble(i.split(this.tic).join("")))){if(this.getRethrowLibraryComputationExceptions()&&null!=this.getLibraryComputationException())throw this.getLibraryComputationException();return this.getErrorStrings()[5].toString()}if(o=this._parseDouble(i),o<0||"-"==t[0]){if(this.getRethrowLibraryComputationExceptions()&&null!=this.getLibraryComputationException())throw this.getLibraryComputationException();return this.getErrorStrings()[4].toString()}s="",t=t.split(this.tic).join("");try{for(a=0;a10||o>10||o=s.length)s=this._padLeft("0",o,s);else if(0!=o){if(this.getRethrowLibraryComputationExceptions()&&null!=this.getLibraryComputationException())throw this.getLibraryComputationException();return this.getErrorStrings()[4].toString()}if(!isNaN(this._parseDouble(s))&&this._parseDouble(s)>536870911){if(this.getRethrowLibraryComputationExceptions()&&null!=this.getLibraryComputationException())throw this.getLibraryComputationException();return this.getErrorStrings()[4].toString()}}catch(e){if(this.getRethrowLibraryComputationExceptions()&&null!=this.getLibraryComputationException())throw this.getLibraryComputationException();return this.getErrorStrings()[4].toString()}return s},this.computeHex2Oct=function(e){var t,i,s,a,n=0,o=this.splitArgsPreservingQuotedCommas(e);if(e==this._parseArgumentSeparator.toString()){if(this.getRethrowLibraryComputationExceptions()&&null!=this.getLibraryComputationException())throw this.getLibraryComputationException();return this.getErrorStrings()[0].toString()}if(t=this.getValueFromArg(o[0]),o[0]=o[0].split(this.TIC).join(""),i=2==o.length?this.getValueFromArg(o[1]):"0",t[0]==this.tic&&(null==t.split(this.tic).join("")||""==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)),a="",isNaN(this._parseDouble(i.split(this.tic).join("")))){if(this.getRethrowLibraryComputationExceptions()&&null!=this.getLibraryComputationException())throw this.getLibraryComputationException();return this.getErrorStrings()[5].toString()}if(n=this._parseDouble(i),n<0||"-"==t[0]){if(this.getRethrowLibraryComputationExceptions()&&null!=this.getLibraryComputationException())throw this.getLibraryComputationException();return this.getErrorStrings()[4].toString()}if(o.length>2){if(this.getRethrowLibraryComputationExceptions()&&null!=this.getLibraryComputationException())throw this.getLibraryComputationException();return this.getErrorStrings()[4].toString()}o.length>1&&(n=this._parseDouble(o[1]));try{if(t=t.split(this.tic).join(""),a=parseInt(t,16).toString(8),!isNaN(this._parseDouble(a))&&a.length>10&&(a=a.substring(a.length-10)),o.length>1){if(!(n>=a.length&&n<=10)){if(this.getRethrowLibraryComputationExceptions()&&null!=this.getLibraryComputationException())throw this.getLibraryComputationException();return this.getErrorStrings()[4].toString()}if(a=this._padLeft("0",n,a),!isNaN(this._parseDouble(a))&&this._parseDouble(a)>536870911){if(this.getRethrowLibraryComputationExceptions()&&null!=this.getLibraryComputationException())throw this.getLibraryComputationException();return this.getErrorStrings()[4].toString()}}}catch(e){if(this.getRethrowLibraryComputationExceptions()&&null!=this.getLibraryComputationException())throw this.getLibraryComputationException();return this.computeIsText(t)==this.trueValueStr?this.getErrorStrings()[4].toString():""==t?"0":this.getErrorStrings()[4].toString()}return a},this._padLeft=function(e,t,i){var s,a=i.length;if(i.length0)for(s=0;s2?this.getValueFromArg(s[2].split(this.tic).join(this._string_empty)):"1",c=d,u=c%26;if(c=parseInt(c/26),n+=this._charTable[u],n+=this._charTable[parseInt(c)],t=n.split("").join(",").split(this.getParseArgumentSeparator()),t.reverse(),i=t,n="$"+i+"$"+o,a>2)switch(h){case"2":n=i+"$"+o;break;case"3":n="$"+i+o;break;case"4":n=i+o}if(a>3&&("FALSE"==this.getValueFromArg(s[3].split(this.tic).join(this._string_empty))||"0"==this.getValueFromArg(s[3].split(this.tic).join(this._string_empty))))switch(h){case"":n="R"+l+"C"+d;break;case"1":n="R"+l+"C"+d;break;case"2":n="R"+l+"C["+d+"]";break;case"3":n="R["+l+"]C"+d;break;case"4":n="R["+l+"]C["+d+"]"}return a>4&&this.getValueFromArg(s[4].split(this.tic).join(this._string_empty))==this._string_empty&&(s[4]=this.getValueFromArg(s[4]),n=s[4].split(this.tic).join(this._string_empty)+"!"+n),n},this.computeAreas=function(e){var t,i,s,a,n;if(e.indexOf(" ")>0&&(e=e.substring(0,e.indexOf(" "))),!this._isCellReference(e)&&!this.getNamedRanges().containsKey(e)&&!e.indexOf(")")){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._invalid_arguments];return this.formulaErrorStrings[this._invalid_arguments]}if(t=this._splitArguments(e,")"),t.length>2){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.getErrorStrings()[1].toString()}for(i=t[0].split("(").join(this._string_empty),s=this.splitArgsPreservingQuotedCommas(i),a=s.length,n=0;nt.length-1||a<1)return"#VALUE!";if(this._isInteriorFunction)return this._isInteriorFunction=!this._isInteriorFunction,t[a];if(n=this.getValueFromArg(t[a]),""==n){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_Math_argument];return this.getErrorStrings()[5].toString()}return n},this.computeColumn=function(e){var t,i;if(null==e||e==this._string_empty)return i=this.colIndex(this.cell).toString(),t=this.rowIndex(this.cell).toString(),i;if(i=this.colIndex(e).toString(),t=this.rowIndex(e).toString(),t<=0){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_Math_argument];return this.getErrorStrings()[5].toString()}return i},this.computeColumns=function(e){var t,i,s,a,n,o,r,l;if(t=this.splitArgsPreservingQuotedCommas(e),1!=t.length){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(i=-1,this._parseDouble(t[0],i))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])&&!e.indexOf(";")&&!e.indexOf(this.getParseArgumentSeparator().toString())){if(this._rethrowLibraryComputationExceptions)throw this.getErrorStrings()[1].toString();return this.getErrorStrings()[1].toString()}if(n=1,e.indexOf(":")>-1)o=this.getCellsFromArgs(e),s=this.colIndex(o[0].toString()),a=this.colIndex(o[o.length-1].toString()),n=a-s+1,n=n>0?n:1;else if(e.indexOf(";")>-1)for(l=this._splitArguments(e.split(this.tic).join(this._string_empty),";"),r=1;r2){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}return t=this._stripTics0(this.getValueFromArg(s[0])),2==a?(i=this._stripTics0(this.getValueFromArg(s[1])),null==i?"0":i==this._string_empty?this._string_empty:i):t},this.computeAbs=function(e){var t,i,s=this.splitArgsPreservingQuotedCommas(e),a=s.length;if(1!=a){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(t=this.getValueFromArg(s[0]),t="TRUE"==t.split(this.tic).join("")?"1":"FALSE"==t.split(this.tic).join("")?"0":t,i=this._parseDouble(t.split(this.tic).join("")),isNaN(i)){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_formula];return t[0]==this.tic||this._isCellReference(s[0])?this.getErrorStrings()[1].toString():this.getErrorStrings()[5].toString()}return Math.abs(i).toString()},this.computeAcos=function(e){var t,i,s=this.splitArgsPreservingQuotedCommas(e),a=s.length;if(1!=a){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(t=this.getValueFromArg(s[0]),i=this._parseDouble(t),isNaN(i)){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_formula];return t[0]==this.tic||this._isCellReference(s[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(e){var t,i,s=this.splitArgsPreservingQuotedCommas(e),a=s.length;if(1!=a){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(t=this.getValueFromArg(s[0]),i=this._parseDouble(t),isNaN(i)){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_formula];return t[0]==this.tic||this._isCellReference(s[0])?this.getErrorStrings()[1].toString():this.getErrorStrings()[5].toString()}if(z=Math.log(i+Math.sqrt(i*i-1)),i<=0||z==1/0){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_formula];return this.getErrorStrings()[4].toString()}return z.toString()},this.computeAcot=function(e){var t,i,s,a,n=this.splitArgsPreservingQuotedCommas(e),o=n.length;if(1!=o){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]; }if(t=this.getValueFromArg(n[0]),i=this._parseDouble(t),isNaN(i)){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_formula];return t[0]==this.tic||this._isCellReference(n[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 s=this._parseDouble(e),a=0,isNaN(s)||(a=Math.PI/2-Math.atan(s)),a.toString()},this.computeAcoth=function(e){var t,i,s,a=this.splitArgsPreservingQuotedCommas(e),n=a.length;if(1!=n){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(t=this.getValueFromArg(a[0]),i=this._parseDouble(t),isNaN(i)){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_formula];return t[0]==this.tic||this._isCellReference(a[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()}if(s=(Math.log((i+1)/(i-1))/2).toString(),this.computeIsErr(s)==this.trueValueStr&&this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_formula];return this.getErrorStrings()[4].toString()},this.computeArabic=function(e){var t,i,s,a=this.splitArgsPreservingQuotedCommas(e);if(1!=a.length){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(t=this.getValueFromArg(a[0]),i=parseInt(t.split(this.tic).join("").toUpperCase()),!isNaN(i)||!this._isCellReference(a[0])&&a[0][0]!=this.tic){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_formula];return isNaN(i)?this.getErrorStrings()[5].toString():this.getErrorStrings()[1].toString()}t=t.split(this.tic).join("").toUpperCase();var n=0,o=null,r=0,l=0,d=0;for(d=1e3,s=!1,n=1;n<=t.length;n++){switch(o=this._substring(t,n-1,1)){case"-":s=!0;break;case"I":l=1;break;case"V":l=5;break;case"X":l=10;break;case"L":l=50;break;case"C":l=100;break;case"D":l=500;break;case"M":l=1e3;break;default:if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_formula];return this.getErrorStrings()[1].toString()}r=l>d?r+l-2*d:r+l,d=l}return s&&(r=-r),r.toString()},this.computeAsin=function(e){var t,i,s,a,n=this.splitArgsPreservingQuotedCommas(e),o=n.length;if(1!=o){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(t=this.getValueFromArg(n[0]),i=this._parseDouble(t),isNaN(i)){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_formula];return t[0]==this.tic||this._isCellReference(n[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 s=this._parseDouble(t),a=0,isNaN(s)||(a=Math.asin(s)),a.toString()},this.computeAtan=function(e){return this._computeMath(e,Math.atan).toString()},this.computeAtan2=function(e){var t,i,s,a,n,o,r,l=this.splitArgsPreservingQuotedCommas(e),d=l.length;if(2!=d)return this.formulaErrorStrings[this.requires_2_args];if(i=0,s=0,a=this.getValueFromArg(l[0]),n=this.getValueFromArg(l[1]),o="true"==a,r="true"==n,o?a=o.toString():a==this._string_empty&&(a="0"),r?n=r.toString():n==this._string_empty&&(n="0"),this.getErrorStrings().indexOf(a)>-1)return a;if(this.getErrorStrings().indexOf(n)>-1)return n;if(t=this._parseDouble(a),i=this._parseDouble(n),isNaN(t)||isNaN(i)){if(this._rethrowLibraryComputationExceptions)throw this.getErrorStrings()[1].toString();return this.getErrorStrings()[1].toString()}if(0==i&&0==t){if(this._rethrowLibraryComputationExceptions)throw this.getErrorStrings()[3].toString();return this.getErrorStrings()[3].toString()}return s=Math.atan2(i,t),s.toString()},this.computeCeilingMath=function(e){var t,i=this.splitArgsPreservingQuotedCommas(e),s=i.length;if(this._isTextEmpty(e)||s>3||s<1){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}var a,n,o=this.getValueFromArg(i[0]),r=s>1&&0!=i[1].length?this.getValueFromArg(i[1]):"1",l=3==s&&0!=i[2].length?this.getValueFromArg(i[2]):"1",d=-1,h=-1,c=!1,u=!1,m=!1;if(c="true"==o.split(this.tic).join(this._string_empty),u="true"==r.split(this.tic).join(this._string_empty),m="true"==l.split(this.tic).join(this._string_empty),o=c?c.toString():o,r=u?u.toString():r,l=m?m.toString():l,this.getErrorStrings().indexOf(o)!=-1)return o;if(this.getErrorStrings().indexOf(r)!=-1)return r;if(this.getErrorStrings().indexOf(l)!=-1)return l;if(r.indexOf(" ")>-1){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_index];return this.getErrorStrings()[1].toString()}if(r.startsWith(this.tic)){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_index];return this.getErrorStrings()[4].toString()}if(a=this._parseDouble(o),d=this._parseDouble(r),h=this._parseDouble(l),isNaN(a)&&!isNaN(d)&&!isNaN(h)){if(0==a&&!this._isTextEmpty(o)&&this.computeIsText(o)==this.falseValueStr||0==d&&!this._isTextEmpty(r)&&this.computeIsText(r)==this.falseValueStr||0==h&&!this._isTextEmpty(l)&&this.computeIsText(l)==this.falseValueStr){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_index];return this.getErrorStrings()[5].toString()}if(this._isTextEmpty(o.split(this.tic).join(this._string_empty))&&o[0]==this.tic||this._isTextEmpty(r.split(this.tic).join(this._string_empty))&&r[1]==this.tic||this._isTextEmpty(l.split(this.tic).join(this._string_empty))&&l[2]==this.tic){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._invalid_arguments];return this.getErrorStrings()[1].toString()}if(this._isTextEmpty(o.split(this.tic).join(this._string_empty))||this._isTextEmpty(r.split(this.tic).join(this._string_empty))||this._isTextEmpty(l.split(this.tic).join(this._string_empty)))return"0";if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._invalid_arguments];return this.getErrorStrings()[1].toString()}return a<0&&h<0&&(d=-1),0==a||0==d?"0":(t=0,a=this._parseDouble(a.toString()),a>0&&(a+=.4999999999),a<0&&-.5>=a-parseInt(a)&&(a-=.4999999999),a=Math.round(a),t=Math.floor(a/d),n=t*d,a<0&&a%2!=0&&0==h&&(n+=d),n.toString())},this.computeCeiling=function(e){var t,i,s,a,n,o,r,l=this.splitArgsPreservingQuotedCommas(e),d=l.length;if(2!=d)return this.formulaErrorStrings[this._wrong_number_arguments];if(t=d>1?this.getValueFromArg(l[0]):"1",i=d>1&&0!=l[1].length?this.getValueFromArg(l[1]):"0",i=""==i||null==i?"0":i,s=!1,a=!1,s="true"==t.split(this.tic).join(this._string_empty),a="true"==i.split(this.tic).join(this._string_empty),t=s?s.toString():t,i=a?a.toString():i,i==this.trueValueStr)return"1";if(i==this.falseValueStr)return"0";if(i.indexOf(" ")>-1){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_index];return this.getErrorStrings()[1].toString()}if(this.getErrorStrings().indexOf(t)!=-1)return t;if(this.getErrorStrings().indexOf(i)!=-1)return i;if(o=-1,r=-1,n=this._parseDouble(t),o=this._parseDouble(i),isNaN(n)&&!isNaN(o)){if(0==n&&!this._isTextEmpty(t)&&this.computeIsText(t)==this.falseValueStr||0==o&&!this._isTextEmpty(i)&&this.computeIsText(i)==this.falseValueStr){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_index];return this.getErrorStrings()[5].toString()}if(this._isTextEmpty(t.split(this.tic).join(this._string_empty))&&t[0]==this.tic||this._isTextEmpty(i.split(this.tic).join(this._string_empty))&&i[0]==this.TIC){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this.invalid_arguments];return this.getErrorStrings()[1].toString()}if(this._isTextEmpty(t.split(this.tic).join(this._string_empty))||this._isTextEmpty(i.split(this.tic).join(this._string_empty)))return"0";if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._invalid_arguments];return this.getErrorStrings()[1].toString()}if(n=this._parseDouble(t),o=this._parseDouble(i),!isNaN(n)&&!isNaN(o)){if(n>0&&o<0){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._invalid_arguments];return this.getErrorStrings()[4].toString()}if(0==n||0==o)return"0";if(r=Math.floor(n/o)*o,o>0)for(;rn;)r+=o}return r.toString()},this.computeDecimal2=function(e){var t,i,s,a,n,o,r,l=this.splitArgsPreservingQuotedCommas(e),d=l.length;if(d>3){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(t="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz+/",!this.getValueFromArg(l[0]).indexOf(this.tic)&&!this._isCellReference(l[0])){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._invalid_Math_argument];return this.getErrorStrings()[1].toString()}s=0;try{i=this.getValueFromArg(l[0]).split(this.tic).join(""),s=parseInt(this.getValueFromArg(l[1]).split(this.tic).join(""))}catch(e){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._invalid_Math_argument]+e;return this.getErrorStrings()[1].toString()}if(s<2||s>t.length){if(this._rethrowLibraryComputationExceptions)throw"Base requested outside range, it should be from 2 - 16";return this.getErrorStrings()[4].toString()}for(i=this._isIE8?i.replace(/^\s+|\s+$/g,""):i.trim(),s<=36&&(i=i.toUpperCase()),n=0,a=0;n=0&&r-1){if(this._rethrowLibraryComputationExceptions)throw this.getErrorStrings()[4].toString();return this.getErrorStrings()[4].toString()}if(2!=r){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(e.length>15){if(this._rethrowLibraryComputationExceptions)throw this.getErrorStrings()[4].toString();return this.getErrorStrings()[4].toString()}return t=parseInt(this.getValueFromArg(o[0]).split(this.tic).join("")),i=parseInt(this.getValueFromArg(o[1]).split(this.tic).join("")),0==t&&0==i?s="1":(a=t+i-1,n=a+","+(t-1),s=this.computeCombin(n)),s},this.computeCos=function(e){return this._computeMath(e,Math.cos).toString()},this.computeCosh=function(e){var t,i,s,a=this._splitArguments(e,this.getParseArgumentSeparator().toString()),n=a.length;if(n>1)return this.formulaErrorStrings[this._wrong_number_arguments];if(t=this.getValueFromArg(a[0]),i=this._parseDouble(t.split(this.tic).join("")),isNaN(i)){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_formula];return t[0]==this.tic||this._isCellReference(a[0])?this.getErrorStrings()[1].toString():this.getErrorStrings()[5].toString()}return s=Math.exp(i),(s+1/s)/2},this.computeCot=function(e){var t,i,s,a,n=this.splitArgsPreservingQuotedCommas(e),o=n.length,o=n.length;if(1!=o){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(e[0]==this.tic&&e[length-1]==this.tic&&(e=e.split(this.tic).join("")),e==this._string_empty){if(this._rethrowLibraryComputationExceptions)throw this.getErrorStrings()[4].toString();return this.getErrorStrings()[4].toString()}if(t=this.computeIsNumber(e),t!=this.trueValueStr){if(this._rethrowLibraryComputationExceptions)throw this.getErrorStrings()[4].toString();return this.getErrorStrings()[5].toString()}if(i=e,i=i.indexOf("u")?i.split("u").join(this._string_empty):i,s=this._parseDouble(i),s>=134217728){if(this._rethrowLibraryComputationExceptions)throw this.getErrorStrings()[4].toString();return this.getErrorStrings()[4].toString()}if("0"==e){if(this._rethrowLibraryComputationExceptions)throw this.getErrorStrings()[3].toString();return this.getErrorStrings()[3].toString()}return a=this._computeMath(e,Math.tan),("#NUM!"!=a||"#VALUE!"!=a)&&(a=(1/parseFloat(a)).toString()),a},this.computeCsc=function(e){var t,i,s=this.splitArgsPreservingQuotedCommas(e),a=s.length;if(1!=a){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(t=this.getValueFromArg(s[0]),i=this._parseDouble(t),isNaN(i)){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_formula];return t[0]==this.tic||this._isCellReference(s[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(e){var t=this.splitArgsPreservingQuotedCommas(e),i=t.length;if(1!=i){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}var s=this.getValueFromArg(t[0]),a=this._parseDouble(s);this.computeIsNumber(e);if(isNaN(a)){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_formula];return s[0]==this.tic||this._isCellReference(t[0])?this.getErrorStrings()[1].toString():this.getErrorStrings()[5].toString()}if(0==a){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_formula];return this.getErrorStrings()[3].toString()}return a>709?"0":(2/(Math.exp(a)-Math.exp(-a))).toString()},this.computeDecimal=function(e){var t,i,s,a,n,o,r,l=this.splitArgsPreservingQuotedCommas(e),d=l.length;if(d>3){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(t="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz+/",this.getValueFromArg(l[0]).indexOf(this.tic)!=-1&&!this._isCellReference(l[0])){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._invalid_Math_argument];return this.getErrorStrings()[1].toString()}s=0;try{i=this.getValueFromArg(l[0]).split(this.tic).join(""),s=parseInt(this.getValueFromArg(l[1]).split(this.tic).join(""))}catch(e){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._invalid_Math_argument]+e;return this.getErrorStrings()[1].toString()}if(s<2||s>t.length){if(this._rethrowLibraryComputationExceptions)throw"Base requested outside range, it should be from 2 - 16";return this.getErrorStrings()[4].toString()}for(i=this._isIE8?i.replace(/^\s+|\s+$/g,""):i.trim(),s<=36&&(i=i.toUpperCase()),n=0,a=0;n=0&&r1)return this.formulaErrorStrings[this.invalid_arguments];if(t=this.getValueFromArg(s[0]),""==t&&(e="0"),i=this._parseDouble(t),i>709){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_formula];return this.getErrorStrings()[4].toString()}return this._computeMath(e,Math.exp).toString()},this.computeEven=function(e){var t,i,s,a=0,n=this.splitArgsPreservingQuotedCommas(e),o=n.length;if(o>1)return this.formulaErrorStrings[this.invalid_arguments];if(t=this.getValueFromArg(n[0]),i=this._parseDouble(t),isNaN(i)){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_formula];return t[0]==this.tic||this._isCellReference(n[0])?this.getErrorStrings()[1].toString():this.getErrorStrings()[5].toString()}return s=i>0?1:0===i||isNaN(i)?x:-1,i=Math.abs(i),i=Math.ceil(i),a=i%2==1?s*(i+1):s*i,a.toString()},this.computeFact=function(e){var t,i,s=0,a=this.splitArgsPreservingQuotedCommas(e);if(a.length>1)return this.formulaErrorStrings[this.invalid_arguments];if(number=parseInt(this.getValueFromArg(e)),isNaN(number))return this.getErrorStrings()[1].toString();if(number<0)return this.getErrorStrings()[4].toString();if(t=number,t>12)for(s=this._factorialTable[12],i=13;i<=t;i++)s*=i;else s=this._factorialTable[t];return s.toString()},this.computeFactdouble=function(e){var t,i,s,a=1,n=this.splitArgsPreservingQuotedCommas(e);if(n.length>1)return this.formulaErrorStrings[this.invalid_arguments];if(t=parseInt(this.getValueFromArg(e)),isNaN(t))return this.getErrorStrings()[1].toString();if(t<0)return this.getErrorStrings()[4].toString();if(i=t,s=i,i>3)for(;s>0;)a*=s,s-=2;else a=0==i?1:i;return a.toString()},this.computeFloor=function(e){var t=this.splitArgsPreservingQuotedCommas(e),i=t.length;if(2!=i)return this.formulaErrorStrings[this._wrong_number_arguments];var s=this._parseDouble(this.getValueFromArg(t[0])),a=this._parseDouble(this.getValueFromArg(t[1])),n=0;if(!isNaN(s)&&!isNaN(a)){if(0==s)return n.toString();if(s*a<=0&&!(s<0))return this.formulaErrorStrings[this._invalid_arguments];if(n=Math.ceil(s/a)*a,a>0)for(;n>s;)n-=a;else for(;n1)return this.formulaErrorStrings[this.invalid_arguments];if(t=this.getValueFromArg(s[0]),i=Math.floor(t).toString(),isNaN(i)){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_formula];return t[0]==this.tic||this._isCellReference(s[0])?this.getErrorStrings()[1].toString():this.getErrorStrings()[5].toString()}return i},this.computeLn=function(e){var t,i,s=this.splitArgsPreservingQuotedCommas(e),a=s.length;if(a>1)return this.formulaErrorStrings[this.invalid_arguments];if(t=this.getValueFromArg(s[0]),i=this._parseDouble(t),i<=0){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_formula];return this.getErrorStrings()[4].toString()}if(isNaN(i)){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_formula];return t[0]==this.tic||this._isCellReference(s[0])?this.getErrorStrings()[1].toString():this.getErrorStrings()[5].toString()}return Math.log(i).toString()},this.computeLog=function(e){var t=this.splitArgsPreservingQuotedCommas(e),i=t.length;if(i>2)return this.formulaErrorStrings[this.invalid_arguments];var s=this.getValueFromArg(t[0]),a=this._parseDouble(s),n=2==i?this.getValueFromArg(t[1]):"10",o=this._parseDouble(n);if(a<=0||o<=0){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_formula];return this.getErrorStrings()[4].toString()}if(isNaN(a)||isNaN(o)){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_formula];return s[0]==this.tic||n[0]==this.tic?this.getErrorStrings()[1].toString():this.getErrorStrings()[5].toString()}return(Math.log(a)/Math.LN10/(Math.log(o)/Math.LN10)).toString()},this.computeLogTen=function(e){var t,i,s=this._splitArguments(e,this.getParseArgumentSeparator().toString()),a=s.length;if(a>1)return this.formulaErrorStrings[this._wrong_number_arguments];if(t=this.getValueFromArg(s[0]),i=this._parseDouble(t.split(this.tic).join("")),isNaN(i)){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_formula];return t[0]==this.tic||this._isCellReference(s[0])?this.getErrorStrings()[1].toString():this.getErrorStrings()[5].toString()}if(i<=0){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_formula];return this.getErrorStrings()[4].toString()}return(this._computeMath(e,Math.log)/Math.LN10).toString()},this.computePI=function(){return Math.PI.toString()},this.computeProduct=function(e){var t,i,s,a,n,o,r,l=1,d=!0;for(this.adjustRangeArg(e),s=this.splitArgsPreservingQuotedCommas(e),a=0;a-1)for(o=this.getCellsFromArgs(n),r=0;r0){if(t=this._parseDouble(i),isNaN(t)){if(this.getErrorStrings().indexOf(i)>-1)return i;if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_formula];return this.getErrorStrings()[1].toString()}l*=t,d=!1}}else{try{i=this.getValueFromArg(s[a])}catch(e){return e}if(i.length>0){if(t=this._parseDouble(i),isNaN(t)){if(this.getErrorStrings().indexOf(i)>-1)return i;if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_formula];return i==this.tic||this._isCellReference(s[a])?this.getErrorStrings()[1].toString():this.getErrorStrings()[5].toString()}l*=t,d=!1}}return d?"0":l.toString()},this.computeSecant=function(e){var t,i,s,a,n,o=this.splitArgsPreservingQuotedCommas(e);if(e=this.getValueFromArg(e),t=o.length,1!=t){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(e[0]==this.tic&&e[length-1]==this.tic&&(e=e.split(this.tic).join("")),e==this._string_empty){if(this._rethrowLibraryComputationExceptions)throw this.getErrorStrings()[4].toString();return this.getErrorStrings()[4].toString()}if(i=this.computeIsNumber(e),i!=this.trueValueStr){if(this._rethrowLibraryComputationExceptions)throw this.getErrorStrings()[4].toString();return this.getErrorStrings()[5].toString()}if(s=e,s=s.indexOf("u")?s.split("u").join(""):s,a=parseFloat(s),a>=134217728){if(this._rethrowLibraryComputationExceptions)throw this.getErrorStrings()[4].toString();return this.getErrorStrings()[4].toString()}return n=this._computeMath(e,Math.cos),("#NUM!"!=n||"#VALUE!"!=n)&&(n=(1/parseFloat(n)).toString()),n},this.computeSeriessum=function(e){var t,i=this.splitArgsPreservingQuotedCommas(e);if(4!=i.length){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}var s,a=0,n=0,o=0,r=0,l=0;if(s=i[3].indexOf(";")>-1?this._splitArguments(i[3].split(this.tic).join(""),";"):this.getCellsFromArgs(i[3].split(this.tic).join("")),""==i[0]||""==i[1]||""==i[2]){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_formula];return this.getErrorStrings()[0].toString()}if(a=this._parseDouble(this.getValueFromArg(i[0])),n=this._parseDouble(this.getValueFromArg(i[1])),o=this._parseDouble(this.getValueFromArg(i[2])),isNaN(a)||isNaN(n)||isNaN(o)){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_formula];return argVal[0]==this.tic||this._isCellReference(e[0])?this.getErrorStrings()[1].toString():this.getErrorStrings()[5].toString()}for(s=this.getCellsFromArgs(i[3].split(this.tic).join("")),t=0;t1)return this.formulaErrorStrings[this._wrong_number_arguments];if(t=this.getValueFromArg(a[0]),i=this._parseDouble(t.split(this.tic).join("")),isNaN(i)){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_formula];return t[0]==this.tic||this._isCellReference(a[0])?this.getErrorStrings()[1].toString():this.getErrorStrings()[5].toString()}return s=Math.exp(i),(s-1/s)/2},this.computeSqrt=function(e){var t,i,s=this._splitArguments(e,this.getParseArgumentSeparator().toString()),a=s.length;if(a>1)return this.formulaErrorStrings[this._wrong_number_arguments];if(t=this.getValueFromArg(s[0]),i=parseInt(t.split(this.tic).join("")),isNaN(i)){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_formula];return t[0]==this.tic?this.getErrorStrings()[1].toString():this.getErrorStrings()[5].toString()}if(i<0){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_formula];return this.getErrorStrings()[4].toString()}return this._computeMath(e,Math.sqrt).toString()},this.computeSubTotal=function(e){var t,i,s=!1,a=this._string_empty,n=0,o=this._splitArguments(e,this.getParseArgumentSeparator().toString()),r=o.length;if(r<2)return this.formulaErrorStrings[this._wrong_number_arguments];if(a=this._isCellReference(o[0])?this.getValueFromArg(o[0]):o[0].toString(),t=this._parseDouble(a),isNaN(t)){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_formula];return this.getErrorStrings()[5].toString()}if(n=parseInt(t.toString()),(n<1||n>11)&&(n<101||n>111))return this.getErrorStrings()[1].toString();if(s)return"0";switch(a=e.substring(o[0].toString().length+1),s=!0,i=this._string_empty,n){case 1:case 101:i=this.computeAverage(a);break;case 2:case 102:i=this.computeCount(a);break;case 3:case 103:i=this.computeCounta(a);break;case 4:case 104:i=this.computeMax(a);break;case 5:case 105:i=this.computeMin(a);break;case 6:case 106:i=this.computeProduct(a);break;case 7:case 107:i=this.computeStdev(a);break;case 8:case 108:i=this.computeStdevp(a);break;case 9:case 109:i=this.computeSum(a);break;case 10:case 110:i=this.computeVar(a);break;case 11:case 111:i=this.ComputeVarp(a);break;default:i=this.getErrorStrings()[1].toString()}return s=!1,i},this.computeSumif=function(e){var t,i,s,a,n,o,r,l,d,h,c=this.splitArgsPreservingQuotedCommas(e),u=c.length;if(2!=u&&3!=u)return this.formulaErrorStrings[this._wrong_number_arguments];if(t=c[0],i=c[1],i.length<1)return"0";s=this.token_equal,i[0]!=this.tic[0]&&"=><".indexOf(i[0])==-1&&(i=this.getValueFromArg(i)),a=i.length>0&&i[0]==this.tic[0]?1:0,n=this.minValue,">="==i.substring(a)[0]?(i=this._substring(i,a+2,i.length-2-2*a),s=this.token_greatereq):"<="==i.substring(a)[0]?(i=this._substring(i,a+2,i.length-2-2*a),s=this.token_lesseq):"<"==i.substring(a)[0]?(i=this._substring(i,a+1,i.length-1-2*a),s=this.token_less):">"==i.substring(a)[0]?(i=this._substring(i,a+1,i.length-1-2*a),s=this.token_greater):"="==i.substring(a)[0]&&(i=this._substring(i,a+1,i.length-1-2*a)),i=i.split(this.tic).join("");var m=(this._parseDouble(i,n),2==u?t:c[2]),p=this.getCellsFromArgs(t),g=this.getCellsFromArgs(m),_=p.length;if(_>g.length&&(o=m.indexOf(":"),o>-1)){var f=this.rowIndex(this._substring(m,0,o)),b=this.colIndex(this._substring(m,0,o)),v=this.rowIndex(this._substring(m,o+1)),x=this.CclIndex(this._substring(m,o+1));f!=v?v+=_-g.length:b!=x&&(x+=_-g.length),m=this._substring(m,0,o+1)+RangeInfo.getAlphaLabel(x)+v.toString(),g=this.getCellsFromArgs(m)}switch(r=0,s){case this.token_equal:for(h=0;h<_;++h)d=this.getValueFromArg(p[h]),d.split(this.tic).join("")==i&&(d=g[h],d=this.getValueFromArg(d),l=this._parseDouble(d.split(this.tic).join("").split("$").join("")),isNaN(l)||(r+=l));break;case this.token_greatereq:for(h=0;h<_;++h)d=this.getValueFromArg(p[h]),l=this._parseDouble(d.split(this.tic).join("").split("$").join("")),isNaN(l)||l>=n&&(d=g[h],d=this.getValueFromArg(d),l=this._parseDouble(d),isNaN(l)||(r+=l));break;case this.token_greater:for(h=0;h<_;++h)d=this.getValueFromArg(p[h]),l=this._parseDouble(d.split(this.tic).join("").split("$").join("")),isNaN(l)||l>n&&(d=g[h],d=this.getValueFromArg(d),l=this._parseDouble(d),isNaN(l)||(r+=l));break;case this.token_less:for(h=0;h<_;++h)d=this.getValueFromArg(p[h]),l=this._parseDouble(d.split(this.tic).join("").split("$").join("")),isNaN(l)||l=0&&t<=0||s<=0){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments]+this.getErrorStrings()[4].toString();return this.getErrorStrings()[4].toString()}a=this._normalCumulativeDistributionFunctionInverse(t,i,s)}return a<=0?this.formulaErrorStrings[this._iterations_dont_converge]:a.toString()},this.computeNormOdist=function(e){var t,i,s,a,n,o,r,l=this.splitArgsPreservingQuotedCommas(e),d=l.length;if(4!=d){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}for(a=0,n=0,o=0;o=1){if(this._rethrowLibraryComputationExceptions)throw"#NUM! Passed argument value doesnot match with in range level";return this.getErrorStrings()[4].toString()}return i=this._standardNormalCumulativeDistributionFunctionInverse(t),i.toString()},this.computePermut=function(e){var t,i,s,a,n=this.splitArgsPreservingQuotedCommas(e),o=n.length;if(2!=o)return this.formulaErrorStrings[this.requires_2_args];if(s=0,t=this._parseDouble(this.getValueFromArg(n[0])),i=this._parseDouble(this.getValueFromArg(n[1])),isNaN(t)||isNaN(i))return this.formulaErrorStrings[this._invalid_arguments];var r=i+.1,l=t+.1,d=1;for(a=l-r+1;a<=l;++a)d*=a;return s=d,s.toString()},this.computePermutationA=function(e){var t,i,s,a,n,o=this.splitArgsPreservingQuotedCommas(e),r=o.length;return 2!=r?this.formulaErrorStrings[this.requires_2_args]:(s=0,t=this._parseDouble(o[0]),i=this._parseDouble(o[1]),isNaN(t)||isNaN(i)?this.formulaErrorStrings[this._invalid_arguments]:(a=i+.1,n=t+.1,Math.pow(t,i).toString()))},this.computeStandardize=function(e){var t,i,s,a,n,o=this.splitArgsPreservingQuotedCommas(e),r=o.length;if(3!=r)return this.formulaErrorStrings[this._wrong_number_arguments];for(s=0,a=0,n=0;ni||s<0||s>1){if(this._rethrowLibraryComputationExceptions)throw"#NAME! Passed argument value is not equal to minimum par value";return this.getErrorStrings()[4].toString()}return a=r[3]==this.trueValueStr?1:0,n=0==a?this._comb(t,i)*Math.pow(s,t)*Math.pow(1-s,i-t):this._binomdist(i,t,s),n.toString()},this.computeChisqOinvOrt=function(e){var t,i,s,a,n=this.splitArgsPreservingQuotedCommas(e),o=n.length;if(2!=o)return this.formulaErrorStrings[this._wrong_number_arguments];for(s=0,a=0;a0?(t=this._gammaln(t),t.toString()):this.formulaErrorStrings[this._invalid_arguments]},this.computeConfidenceOnorm=function(e){var t,i,s,a,n,o=this.splitArgsPreservingQuotedCommas(e),r=o.length;if(3!=r){if(this._rethrowLibraryComputationExceptions)throw"Wrong number of arguments";return this.formulaErrorStrings[this._wrong_number_arguments]}for(a=0,n=0;n=1||i<=0||s<1){if(this._rethrowLibraryComputationExceptions)throw"Passed argument value is different from minimum par";return this.getErrorStrings()[4].toString()}a=this._excelLikeComputations?this._normalinv(1-t+t/2,0,1):this._newnormalinv(1-t+t/2),a=a*i/Math.sqrt(s)}return a.toString()},this.computeExponOdist=function(e){var t,i,s,a,n,o,r=this.splitArgsPreservingQuotedCommas(e),l=r.length;if(3!=l)return this.formulaErrorStrings[this._wrong_number_arguments];for(s=0,a=0,n=0;n-1&&t<1&&(i=.5*Math.log((1+t)/(1-t))),i.toString())},this.computeFisherInv=function(e){var t,i,s,a,n=this.splitArgsPreservingQuotedCommas(e),o=n.length;return 1!=o?this.formulaErrorStrings[this._wrong_number_arguments]:(i=0,s=this.getValueFromArg(n[0]),t=this._parseDouble(s),isNaN(t)||(a=Math.exp(2*t),i=(a-1)/(a+1)),i.toString())},this.computeGammalnOPrecise=function(e){var t,i=this.splitArgsPreservingQuotedCommas(e),s=i.length;if(i[0]==this.tic+this.tic){if(this._rethrowLibraryComputationExceptions)throw"Passed Argument is empty";return this.getErrorStrings()[1].toString()}if(1!=s){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(t=0,t=this._parseDouble(i.toString()),isNaN(t)||!(t>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()}if(this._rethrowLibraryComputationExceptions)throw"Passed Argument is non numerical";return this.getErrorStrings()[1].toString()}return t=this._gammaln(t),t.toString()},this.computeLarge=function(e){var t,i,s=this.splitArgsPreservingQuotedCommas(e),a=s.length;if(2!=a)return this.formulaErrorStrings[this._wrong_number_arguments];if(i=this.getValueFromArg(s[1]),t=this._parseDouble(i),isNaN(t))return this.formulaErrorStrings[this._invalid_arguments];var n=t,o=this._getDoubleArray(s[0]),r=o.length;return n<1||n>r?this.formulaErrorStrings[this._invalid_arguments]:(o.sort(function(e,t){return isNaN(e)||isNaN(t)?e>t?1:-1:e-t}),o[r-n].toString())},this.computeSmall=function(e){var t,i,s=this.splitArgsPreservingQuotedCommas(e),a=s.length;if(2!=a)return this.formulaErrorStrings[this._wrong_number_arguments];if(t=this.getValueFromArg(s[1]),i=this._parseDouble(t),isNaN(i))return this.formulaErrorStrings[this._invalid_arguments];var n=i,o=this._getDoubleArray(s[0]),r=o.length;return n<1||n>o.length?this.formulaErrorStrings[this._invalid_arguments]:(o.sort(function(e,t){return isNaN(e)||isNaN(t)?e-1)for(a=this.getCellsFromArgs(i),n=0;n0&&l++}else if(""==i)l++;else if(this._isLetter(i[0]))t=this.getValueFromArg(i),t.length>0&&l++;else if(i.indexOf(this.getParseArgumentSeparator())>-1)for(o=this.splitArgsPreservingQuotedCommas(i.split(this.tic).join("")),r=0;r0||""==r)&&l++}else s.length>0&&l++;return l.toString()},this.computeAverage=function(e){var t,i,s,a,n,o,r=0,l=0,d=[],h=this.splitArgsPreservingQuotedCommas(e);if(h.length<1){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this.invalid_arguments];return this.formulaErrorStrings[this.invalid_arguments]}for(s=0;s-1)for(a=this.getCellsFromArgs(d),n=0;n0&&!isNaN(i)){if(t=this._parseDouble(i),isNaN(t)){if(this.getErrorStrings().indexOf(i)==-1)return i;if(this._rethrowLibraryComputationExceptions)throw this.getErrorStrings()[5].toString();return this.getErrorStrings()[5].toString()}r=Number(r)+Number(t),l++}}else{try{i=this.getValueFromArg(d).split(this.tic).join(this._string_empty),o=this.getValueFromArg(d)}catch(e){if(this._rethrowLibraryComputationExceptions)throw this.getErrorStrings()[4].toString();return this.getErrorStrings()[4].toString()}if(i.length>0){if(t=this._parseDouble(i),isNaN(t)){if(o[0]==this.tic){if(this._rethrowLibraryComputationExceptions)throw this.getErrorStrings()[1].toString();return this.getErrorStrings()[1].toString()}if(this._rethrowLibraryComputationExceptions)throw this.getErrorStrings()[5].toString();return this.getErrorStrings()[5].toString()}r=Number(r)+Number(t),l++}}return l>0&&(r=Number(r)/Number(l)),r.toString()},this.computeAverageA=function(e){var t,i,s,a,n,o,r=this.splitArgsPreservingQuotedCommas(e),l=this._string_empty;if(r==this.trueValueStr||r==this.falseValueStr)return t=r==this.trueValueStr,t?+t:+t;for(i=0;i-1)for(s=this.splitArgsPreservingQuotedCommas(r[i].split(this.tic).join(this._string_empty)),a=0,n=0;n-1)for(o=this.getCellsFromArgs(s),r=0;r0)if(t=this._parseDouble(i),isNaN(t)){if(this.getErrorStrings().indexOf(i))return l}else l=Math.max(l,t)}else{try{i=s==this._string_empty?"0":this.getValueFromArg(s)}catch(e){if(this._rethrowLibraryComputationExceptions&&null!=this.getLibraryComputationException())throw this.getLibraryComputationException();return e}if(i.length>0)if(t=this._parseDouble(i),isNaN(t)){if(this.getErrorStrings().indexOf(i))return i}else l=Math.max(l,t)}return l!=this.minValue?l.toString():this._string_empty},this.computeMaxa=function(e){var t,i,s,a,n,o,r=this.minValue;for(this.adjustRangeArg(e),s=this.splitArgsPreservingQuotedCommas(e),a=0;a-1)for(n=this.getCellsFromArgs(s[a]),o=0;o0){if(t=0,i.toUpperCase()==this.trueValueStr)t=1;else{if(this.getErrorStrings().indexOf(i)>-1)return i;t=this._parseDouble(i)}r=Math.max(r,t)}}else{try{i=this.getValueFromArg(s[a])}catch(e){if(this._rethrowLibraryComputationExceptions&&null!=this.getLibraryComputationException())throw this.getLibraryComputationException()}if(i.length>0){if(t=0,i.toUpperCase()==this.trueValueStr)t=1;else{if(this.getErrorStrings().indexOf(i)==-1)return i;t=this._parseDouble(i)}r=Math.max(r,t)}}return r!=this.minValue?r.toString():this._string_empty},this.computeMedian=function(e){var t,i,s=this._getDoubleArray(e);return s.sort(function(e,t){return isNaN(e)||isNaN(t)?e>t?1:-1:e-t}),t=parseInt((s.length/2).toString()),i="",s.length%2==1?s[t].toString():((s[t]+s[t-1])/2).toString()},this.computeMin=function(e){var t,i,s,a,n,o,r,l,d,h=this.maxValue;if(this.adjustRangeArg(e),s=this.splitArgsPreservingQuotedCommas(e),a=e.split(";"),a.length>1){for(r=0;r0)if(t=this._parseDouble(o),isNaN(t)){if(this.getErrorStrings().indexOf(o)==-1)return o}else h=Math.min(h,t);if(h!=this.maxValue)return h.toString()}for(r=0;r-1)for(l=this.getCellsFromArgs(s[r]),d=0;d0)if(t=this._parseDouble(i),isNaN(t)){if(this.getErrorStrings().indexOf(i)==-1)return h}else h=Math.min(h,t)}else{try{i=s[r]==this._string_empty?"0":this.getValueFromArg(s[r])}catch(e){if(this._rethrowLibraryComputationExceptions&&null!=this.getLibraryComputationException())throw this.getLibraryComputationException();return e}if(i.length>0)if(t=this._parseDouble(i),isNaN(t)){if(this.getErrorStrings().indexOf(i)==-1)return i}else h=Math.min(h,t)}return h!=this.maxValue?h.toString():this._string_empty},this.computeMina=function(e){var t,i,s,a,n,o,r,l,d,h=this.maxValue;if(this.adjustRangeArg(e),s=this.splitArgsPreservingQuotedCommas(e),a=e.split(";"),a.length>1){for(r=0;r0){if(t=0,o.toUpperCase()==this.trueValueStr)t=1;else{if(this.getErrorStrings().indexOf(o)==-1)return o;t=this._parseDouble(o)}h=Math.min(h,t)}if(h!=this.maxValue)return h.toString()}for(r=0;r-1)for(l=this.getCellsFromArgs(s[r]),d=0;d0){if(t=0,i.toUpperCase()==this.trueValueStr)t=1;else if(i.toUpperCase()==this.falseValueStr)t=0;else{if(this.getErrorStrings().indexOf(i)!=-1)return i;t=this._parseDouble(i)}h=Math.min(h,t)}}else{try{i=this.getValueFromArg(s[r])}catch(e){if(this._rethrowLibraryComputationExceptions&&null!=this.getLibraryComputationException())throw this.getLibraryComputationException();return e}if(i.length>0){if(t=0,i.toUpperCase()==this.trueValueStr)t=1;else{if(this.getErrorStrings().indexOf(i)==-1)return i;t=this._parseDouble(i)}h=Math.min(h,t)}}return h!=this.maxValue?h.toString():this._string_empty},this.computePercentrankInc=function(e){var t,i,s,a,n,o,r,l,d,h,c=this.splitArgsPreservingQuotedCommas(e),u=c.length;if(2!=u&&3!=u){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(i=3,s=this.getValueFromArg(c[1]),t=this._parseDouble(s),isNaN(t)){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._invalid_arguments];return this.formulaErrorStrings[this._invalid_arguments]}if(3==u&&(s=this.getValueFromArg(c[2]),i=this._parseDouble(s),isNaN(i)&&i<1)){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._invalid_arguments];return this.formulaErrorStrings[this._invalid_arguments]}for(a=this._getDoubleArray(c[0]),n=a.length,a.sort(),o=1,r=0;r0&&a[r-1]1&&(s="1"),a=this._parseDouble(s));var d=r[1],h=0,c=!1;if(d.indexOf(":")==-1)return this.getErrorStrings()[4].toString();if(d.indexOf(":")>-1){for(n=this.getCellsFromArgs(d),o=0;oi?t+=1:h==i&&(c=!0))}c&&(t+=1)}}return t.toString()},this.computePercentile=function(e){var t,i,s,a,n,o,r,l=this.splitArgsPreservingQuotedCommas(e),d=l.length;if(2!=d)return this.formulaErrorStrings[this._wrong_number_arguments];if(i=this.getValueFromArg(l[1]),t=this._parseDouble(i),isNaN(t)&&(t<0||t>1))return this.formulaErrorStrings[this._invalid_arguments];for(s=this._getDoubleArray(l[0]),a=s.length,s.sort(function(e,t){return isNaN(e)||isNaN(t)?et){t=(t-r*n)/n,o=s[r]+t*(s[r+1]-s[r]);break}return o.toString()},this.computePoissonODist=function(e){var t,i,s,a,n,o,r,l,d=this.splitArgsPreservingQuotedCommas(e),h=d.length;if(3!=h)return this.formulaErrorStrings[this._wrong_number_arguments];for(s=0,a=0,l=0;l=5&&s.toString().length>=3){if(this._rethrowLibraryComputationExceptions)throw"Passed argument length exceeded the minimum length";return this.getErrorStrings()[4].toString()}return 3!=d&&(a=l[3]==this.trueValueStr?1:0,r=0,r=this._parseDouble(l[3]),isNaN(r)||(a=1)),n=1==a,a=n?1-Math.exp(-Math.pow(t/s,i)):Math.pow(t,i-1)*Math.exp(-Math.pow(t/s,i))*i/Math.pow(s,i),a.toString()},this.computeFOinvOrt=function(e){var t,i,s,a,n,o=this.splitArgsPreservingQuotedCommas(e),r=o.length;if(3!=r){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}for(a=0,n=0;n0&&t<1&&!isNaN(i)&&!isNaN(s)&&(a=this._finv(t,i,s)),a<=0){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._iterations_dont_converge];return this.formulaErrorStrings[this._iterations_dont_converge]}return a.toString()},this.computeTOdist=function(e){var t,i,s,a,n=this.splitArgsPreservingQuotedCommas(e),o=n.length;if(3!=o)return this.formulaErrorStrings[this._wrong_number_arguments];for(i=0,s=0,a=0;a-1)for(a=this.getCellsFromArgs(s),n=0;n0)if(i=this._parseDouble(t),isNaN(i)){if(this.getErrorStrings().indexOf(t)>0)return t}else l+=i,d.push(i)}else{try{t=this.getValueFromArg(s).split(this.tic).join(this._string_empty)}catch(e){if(this._rethrowLibraryComputationExceptions&&null!=this.getLibraryComputationException())throw this.getLibraryComputationException();return e}if(t.length>0)if(i=this._parseDouble(t),isNaN(i)){if(this.getErrorStrings().indexOf(t)==-1)return t}else l+=i,d.push(i)}if(d.length>0){for(o=l/d.length,l=0,r=0;r-1)for(t=this.getCellsFromArgs(r[l].split(this.tic).join("")),i=0;i0){if(s==this.formulaErrorStrings[19]){if(null!=this.geLibraryComputationException())throw this.getLibraryComputationException();return this.formulaErrorStrings[19]}a=this._parseDouble(s),o=new Date(Date.parse(s)),isNaN(a)&&"Invalid Date"==o.toString()||this.getErrorStrings().indexOf(s)!=-1||n++}}else{try{r[l]!=this._string_empty||r[l][0]==this.tic||n++,s=this.getValueFromArg(l.split(this.tic).join(""))}catch(e){if(null!=this.getLibraryComputationException())throw this.getLibraryComputationException();throw this.getErrorStrings()[4].toString()}if(s.length>0){if(s[0]==this.formulaErrorStrings[19]){if(null!=this.getLibraryComputationException())throw this.getLibraryComputationException();return this.formulaErrorStrings[19]}a=this._parseDouble(s),o=new Date(Date.parse(s)),isNaN(a)&&"Invalid Date"==o.toString()||this.getErrorStrings().indexOf(s)!=-1||n++}}return n.toString()},this.computeFOdistORt=function(e){var t,i,s=this.splitArgsPreservingQuotedCommas(e),a=s.length;if(3!=a)return this.formulaErrorStrings[this._wrong_number_arguments];var n,o=0,r=0,l=0;for(t=0;t-1)for(n=this.getCellsFromArgs(s[a]),o=0;o0)if(i=this._parseDouble(t),isNaN(i)){if(this.getErrorStrings().indexOf(t)==-1)return t}else l++,r*=i}else{try{t=this.getValueFromArg(s[a])}catch(e){if(this._rethrowLibraryComputationExceptions&&null!=this.getLibraryComputationException())throw this.getLibraryComputationException();return e}if(t.length>0)if(i=this._parseDouble(t),isNaN(i)){if(this.getErrorStrings().indexOf(t)==-1)return t}else l++,r*=i}return l>0&&(r=Math.pow(r,1/l)),r.toString()},this.computeHarmean=function(e){var t,i,s,a,n,o,r=0,l=0;for(this.adjustRangeArg(e),s=this.splitArgsPreservingQuotedCommas(e),a=0;a-1)for(n=this.getCellsFromArgs(s[a]),o=0;o0)if(i=this._parseDouble(t),isNaN(i)||0==i){if(this.getErrorStrings().indexOf(t)==-1)return t}else l++,r+=1/i}else{try{t=this.getValueFromArg(s[a])}catch(e){if(this._rethrowLibraryComputationExceptions&&null!=this.getLibraryComputationException())throw this.getLibraryComputationException();return e}if(t.length>0)if(i=this._parseDouble(t),isNaN(i)||0==i){if(this.getErrorStrings().indexOf(t))return t}else l++,r+=1/i}return l>0&&(r=l/r),r.toString()},this.computeIntercept=function(e){var t,i,s,a,n,o,r=this.splitArgsPreservingQuotedCommas(e),l=r.length;if(2!=l)return this.formulaErrorStrings[this._wrong_number_arguments];var d=this._getDoubleArray(r[0]),h=this._getDoubleArray(r[1]),c=h.length;if(c<=0||c!=d.length)return this.formulaErrorStrings[this._wrong_number_arguments];for(t=0,i=0,o=0;o-1)for(n=this.getCellsFromArgs(s),o=0;o1))return this.formulaErrorStrings[this._invalid_arguments];if(s=this._parseDouble(i),0==s||s<=0||s>=1){if(this._rethrowLibraryComputationExceptions)throw this.getErrorStrings()[4].toString();return this.getErrorStrings()[4].toString()}if(a=this._getDoubleArray(l[0]),n=a.length,a.sort(function(e,t){return isNaN(e)||isNaN(t)?e=this._parseDouble((o/(o+1)).toString())){if(this._rethrowLibraryComputationExceptions)throw this.getErrorStrings()[4].toString();return this.getErrorStrings()[4].toString()}return r=t*(o+1),r.toString()},this.computePercentileOInc=function(e){var t,i,s,a,n,o,r,l,d=this.splitArgsPreservingQuotedCommas(e),h=d.length;if(2!=h){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(i=this.getValueFromArg(d[1]),t=this._parseDouble(i),isNaN(t)&&(t<0||t>1))return this.formulaErrorStrings[this._invalid_arguments];if(s=this._parseDouble(i),0==s||s<=0||s>=1){if(this._rethrowLibraryComputationExceptions)throw this.getErrorStrings()[4].toString();return this.getErrorStrings()[4].toString()}for(a=this._getDoubleArray(d[0]),n=a.length,a.sort(),o=1/(n-1),r=a[n-1],l=0;lt){t=(t-l*o)/o,r=a[l]+t*(a[l+1]-a[l]);break}return r.toString()},this.computeTrimmean=function(e){var t,i,s,a,n=this.splitArgsPreservingQuotedCommas(e),o=n.length;if(2!=o)return this.formulaErrorStrings[this._wrong_number_arguments];if(i=this.getValueFromArg(n[1]),t=this._parseDouble(i),isNaN(t))return this.formulaErrorStrings[this._invalid_arguments];var r=this._getDoubleArray(n[0]),l=r.length,d=parseInt((t*l).toString());if(d=parseInt(d/2),d<1||2*d>=l)return this.formulaErrorStrings[this._invalid_arguments];for(r.sort(function(e,t){return isNaN(e)||isNaN(t)?e>t?1:-1:e-t}),s=0,l-=d,a=d;a-1&&(this.grid=b.tokenToParentObject.getItem(m.substring(0,_+1))),r=this.rowIndex(m.substring(0,o)),l=this.rowIndex(m.substring(o+1)),!(r!=-1||l==-1)==(r==-1||l!=-1))return this.getErrorStrings()[5].toString();var v=this.colIndex(m.substring(0,o)),x=this.colIndex(m.substring(o+1)),w=!1,y="",C=null,S=null;c&&(y=r.toString()+"_"+v.toString()+"_"+x.toString()+"_"+this.grid.GetHashCode(),this._lookupTables.containsKey(y)||(u?(d=new LookUps,d.setMatchLookUpList(new HashTable),this._lookupTables.add(y,d)):(d=new LookUps,this._lookupTables.add(y,d)),w=!0),C=this._lookupTables.getItem(y).getLinearLookUpList(),u&&(S=this._lookupTables.getItem(y).getMatchLookUpList()));var T="",D=v,I="",k=0,P=!0,L=!1;if(c&&u&&S.containsKey(i))D=S.getItem(i),I=i;else for(h=v;h<=x;++h){if(!c||h-v>=C.length||w?(I=this.getValueFromParentObject(this.grid,r,h).toString().toUpperCase().split('"').join(""),c&&(C.push(I),u&&S.add(I,h))):I=C[h-v],k=n?this._parseDouble(I):k,I==i||a&&(n?!isNaN(k)&&k>g:I>i)){if(I==i&&(D=h,a=!0,L=!0),!w)break;P=!1}P&&(D=h),a=w=!0}if(a||I==i){if(!L&&!n)return this.grid=f,"#N/A";if(s+r-1>l)return"#REF!";T=this.getValueFromParentObject(this.grid,s+r-1,D).toString(),T.length>0&&T[0]==this.getFormulaCharacter()&&(T=this.parseFormula(T)),g=this._parseDouble(T),T.length>0&&T[0]!=this.tic[0]&&isNaN(g)&&(T=T)}else T="#N/A";return this.grid=f,T},this.computeIndex=function(e){var t,i,s,a,n,o,r,l,d,h,c,u,m,p,g=this.splitArgsPreservingQuotedCommas(e),_=g.length;if(_<2){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(t=g[0],t=t.split(this.tic).join(""),i=t.indexOf(":"),i==-1){if(!this._isCellReference(t)){if(t.indexOf(";")>-1){var f=parseInt(this.getValueFromArg(g[1])),b=this._splitArguments(t,";"),v=3==_?parseInt(this.getValueFromArg(g[2])):1;try{return f=0==f?1:f,v=0==v?1:v,s=this.splitArgsPreservingQuotedCommas(b[f-1]),s[v-1]}catch(e){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_Math_argument];return this.getErrorStrings()[2].toString()}}if(a=this.splitArgsPreservingQuotedCommas(t),!isNaN(f)&&f>0){if(a.length>=f)return 0==parseInt(f.toString())?a[0]:a[parseInt(f.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()}t=t+":"+t}return i=t.indexOf(":"),e.indexOf("#N/A")>-1||e.indexOf("#N~A")>-1?"#N/A":e.indexOf("#DIV/0!")>-1||e.indexOf("#DIV~0!")>-1?"#DIV/0!":(n=this._getSheetTokenFromReference(t),g[1]=1==_||""==g[1]?"1":g[1],g[2]=_<=2||""==g[2]?"1":g[2],o=parseInt(this.getValueFromArg(g[1])),r=isNaN(o)?-1:o,o=parseInt(this.getValueFromArg(g[2])),l=isNaN(o)?-1:o,r==-1||l==-1?"#REF":(d=this.rowIndex(t.substring(0,i)),h=this.rowIndex(t.substring(i+1)),!(d!=-1||h==-1)==(d==-1||h!=-1)?this.getErrorStrings()[5].toString():(c=this.colIndex(t.substring(0,i)),u=this.colIndex(t.substring(i+1)),r>h-d+1||l>u-c+1?"#REF":(r=this.rowIndex(t.substring(0,i))+r-1,l=this.colIndex(t.substring(0,i))+l-1,m=n+RangeInfo.getAlphaLabel(l)+r,p=this.getValueFromArg(m),this._isTextEmpty(p)?"0":p))))},this.computeIndirect=function(e){var t,i,s,a,n=this.splitArgsPreservingQuotedCommas(e),o=n.length;if(o>2||0==o){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(n[0]=n[0].toUpperCase(),n[0]=this.setTokensForSheets(n[0]),t=this._sheetToken(n[0].split(this.tic).join("")),""!=t&&(n[0]=n[0].split(t).join("")),2==n.length&&n[1]==this.falseValueStr){var r=n[0][0]==this.tic&&n[0][e[0].length-1]==this.tic,l=n[0].toUpperCase().split(this.tic).join(""),d=l.split(":"),h=d[0].split("R").join("C").split("C"),c=h.indexOf("");if(c>-1&&h.splice(c,1),h.length>2)return this.getErrorStrings()[2].toString();n[0]=RangeInfo.getAlphaLabel(parseInt(h[1]))+h[0],2==d.length&&(i=this._sheetToken(d[1]),(null!=i||""!=i)&&(d[1]=d[1].split(i).join("")),h=d[0].split("R").join("C").split("C"),n[0]+=":"+RangeInfo.getAlphaLabel(parseInt(h[1]))+h[0]),r&&(n[0]=this.tic+n[0]+this.tic)}if(s="",n[0][0]==this.tic)s=t+n[0].split(this.tic).join("");else if(this._isCellReference(n[0])){if(a="",s=this.getValueFromArg(t+n[0]),null==s||""==s)return"0";if(this._isInteriorFunction)return this._isInteriorFunction=!this._isInteriorFunction,n[0].split(this._string_fixedreference).join("");if(a=this._checkIfScopedRange(s.toUpperCase()),this.getNamedRanges().containsKey(s.toUpperCase()))s=this.getNamedRanges().getItem(s.toUpperCase()),s=s.toUpperCase(),s=s.split(this._string_fixedreference).join(""),s=this.setTokensForSheets(s),s[0]!=this.sheetToken&&(s=t+s);else{if("NaN"==a)return this._isCellReference(s)?this.getValueFromArg(s):s.indexOf(!1)?this.getErrorStrings()[2].toString():s;s=a,s=s.toUpperCase(),s=s.split(this._string_fixedreference).join(""),s=this.setTokensForSheets(s),s[0]!=this.sheetToken&&(s=t+s)}}else s=n[0];if(!this._isCellReference(s.split(this._string_fixedreference).join("")))if(a="",a=this._checkIfScopedRange(s.toUpperCase()),this.getNamedRanges().containsKey(s.toUpperCase()))s=this.getNamedRanges().getItem(s.toUpperCase()),s[0]!=this.sheetToken&&(s=t+s);else{if("NaN"==a)return this.getErrorStrings()[2].toString();s=a,s[0]!=this.sheetToken&&(s=t+s)}return s.indexOf(":")>-1&&this._isInteriorFunction?(this._isInteriorFunction=!this._isInteriorFunction,s.split(this._string_fixedreference).join("")):this.getValueFromArg(s)},this.computeLookUp=function(e){var t,i,s,a,n,o,r,l,d,h,c,u,m,p,g,_,f,b,v,x,w,y=this._isHLookupCachingEnabled();this._isOptimizedMatchesEnabled();y&&null==this._lookupTables&&(this.lookupTables=new HashTable),t=this.splitArgsPreservingQuotedCommas(e),i=this.getValueFromArg(t[0]),i=i.split(this.tic).join("").toUpperCase(),s="",a=t[1].split('"').join(""),t[2]=(t.length=3)?t[2].split(this.tic).join(""):t[2];var C=(this.getValueFromArg(t[0]),[]),S=[];this.getValueFromArg(t[2]).split(this.tic).join("");if(2==t.length)if(n=t[1],o=this.splitArgsPreservingQuotedCommas(t[1]),t[1].indexOf(";")>-1)if(r=this._splitArguments(t[1],";"),1==r.length)for(h=this.splitArgsPreservingQuotedCommas(r[0].toUpperCase()),c=0;c-1)for(m=this.getCellsFromArgs(t[1]),g=0;g-1)for(m=this.getCellsFromArgs(a),g=0;g-1)for(m=this.getCellsFromArgs(u),g=0;g_&&i>C[b]&&_>i||i>C[b])_=i>C[b]?C[b]:C[b+1],f++;else if(0!=f)break;if(0==f)return this.getErrorStrings()[0].toString();i=_}if(v=0,x=0,3==t.length&&t[2].indexOf(":")>-1){for(w=0;w5){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}var h=l[0],c=this._parseDouble(this.getValueFromArg(l[1])),u=isNaN(c)?-1:parseInt(c.toString());c=this._parseDouble(this.getValueFromArg(l[2])),t=isNaN(c)?-1:parseInt(c.toString()),i=d>=4?l[3]:"-1",c=parseInt(this.getValueFromArg(i)),s=isNaN(c)?1:c,a=5==d?l[4]:"-1",c=parseInt(this.getValueFromArg(a));var m=isNaN(c)?1:c,p=h.indexOf(":"),g=p==-1;g&&(h=h+":"+h,p=h.indexOf(":")),g=g&&m<=1&&s<=1,m==-1&&(g=!0);var _=this._getSheetTokenFromReference(h),f=this.rowIndex(h.substring(0,p))+u;this.rowIndex(h.substring(p+1))+u;return!(this.rowIndex(h.substring(0,p))!=-1||this.rowIndex(h.substring(p+1))!=-1)==(this.rowIndex(h.substring(0,p))==-1||this.rowIndex(h.substring(p+1))!=-1)?this.getErrorStrings()[5].toString():(n=this.colIndex(h.substring(0,p))+t,o=this.colIndex(h.substring(p+1))+t,f<=0||n<=0?this.getErrorStrings()[2].toString():((s>0&&m<0||s<1&&m>1)&&(f=this.rowIndex(this.cell)),o==parseInt(this.computeColumn(h))-1&&(g=!0),r=_+RangeInfo.getAlphaLabel(n)+f,g?this.computedValue(r):r+":"+RangeInfo.getAlphaLabel(n+m-1)+(f+s-1)))},this.computeTranspose=function(e){var t,i,s,a,n,o,r,l,d,h;if(!this._isCellReference(e)&&!this.getNamedRanges().containsKey(e)&&e.indexOf(";")==-1){if(l=this._splitArguments(e.split(this.tic).join(""),";"),1==l.length)return this.getValueFromArg(this.splitArgsPreservingQuotedCommas(l[0])[0]);if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_arguments];return this.formulaErrorStrings[this._invalid_arguments]}if(t=this.splitArgsPreservingQuotedCommas(e),i=t.length,1!=i){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(r="",e.indexOf(";")>-1){for(l=this._splitArguments(e.split(this.tic).join(""),";"),d=1;d-1&&(this.grid=T.tokenToParentObject[e.substring(0,C+1)]),r=this._getValueComputeFormulaIfNecessary(s+w,n+x,this.grid),this.grid=S}return(null==r||""==r)&&(r="0"),r};this.computeEncodeURL=function(e){var t,i=this.splitArgsPreservingQuotedCommas(e),s=i.length;if(1!=s){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(!this._isCellReference(i[0])&&!this.getNamedRanges().containsKey(i[0])&&i[0].indexOf(";")==-1){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._invalid_arguments];return this.getErrorStrings()[5]}return t=this._stripTics0(this.getValueFromArg(i[0])),encodeURIComponent(t)};this.computeAnd=function(e){var t,i,s,a,n,o,r,l=!0;if(null==e||""==e){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._bad_formula];return this.formulaErrorStrings[this._bad_formula]}for(s=this.splitArgsPreservingQuotedCommas(e),a=0;a-1)for(cells=this.getCellsFromArgs(s[a]),n=0;n-1)return n;if(n.startsWith(this.tic)){if(this.getRethrowLibraryComputationExceptions)throw(new this.getErrorStrings)[5].toString();return this.getErrorStrings()[5].toString()}try{if(t=this.getValueFromArg(n),this.getErrorStrings().indexOf(t)>-1)return t}catch(e){if(this.rethrowLibraryComputationExceptions&&null!=this.getLibraryComputationException)throw this.getErrorStrings()[4].toString();return this.getErrorStrings()[4].toString()}l&=""==t||(t.split(this.tic).join("").toUpperCase()==this.trueValueStr||(i=this._parseDouble(t))&&0!=i)}else{try{if(t=this.getValueFromArg(s[a]),o=Date.parse(t.split(this.tic).join("")),i=this._parseDouble(t.split(this.tic).join("")),!isNaN(o))return this.trueValueStr;if(isNaN(i)&&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();return this._isCellReference(s[a])||t[0]==this.tic?this.getErrorStrings()[1].toString():this.getErrorStrings()[5].toString()}}catch(e){if(this.getRethrowLibraryComputationExceptions()&&null!=this.getLibraryComputationException())throw this.getErrorStrings()[4].toString();return this.getErrorStrings()[4].toString()}r=this._parseDouble(t),l&=t.split(this.tic).join("").toUpperCase()==this.trueValueStr||!isNaN(r)&&0!=i}}return l?this.trueValueStr:this.falseValueStr},this.computeFalse=function(){return this.falseValueStr},this.computeIf=function(e){var t,i,s,a=this._string_empty,n=[this.getParseArgumentSeparator(),":"];if(e.length>0&&this._indexOfAny(e,n)==-1)return this.getFormulaErrorStrings();if(t=this.getCellsFromArgs(e),!(t.length>=2))return this.getFormulaErrorStrings();try{if(a=this.getValueFromArg(t[0]),a.split(this.tic).join("")==this.trueValueStr||(i=this._parseDouble(a))&&0!=i)a=this.getValueFromArg(t[1]);else if(a==this.falseValueStr||""==a||(i=this._parseDouble(a))&&0==i)a=3==t.length&&this.getValueFromArg(t[2]);else{if(t.indexOf(this.tic)>-1){var o=t[0].indexOf(this.tic)+1,r=t[0].lastIndexOf(this.tic)-1,l=t[0].substring(o,r-o+1);for(s=0;s0&&this._indexOfAny(e,s)>-1)return this.getFormulaErrorStrings();try{i=this.getValueFromArg(i),i==this.trueValueStr?i=this.falseValueStr:i==this.falseValueStr?i=this.trueValueStr:(t=this._parseDouble(i))&&(i=Math.abs(t)>1e-10?this.falseValueStr:this.trueValueStr)}catch(e){if(this.rethrowLibraryComputationExceptions&&null!=this.getLibraryComputationException)throw this.getLibraryComputationException;return e}return i},this.computeOr=function(e){for(var t,i,s,a=this.falseValueStr,n=this.splitArgsPreservingQuotedCommas(e),o=0;o-1&&this._isCellReference(o))for(cells=this.getCellsFromArgs(n[o]),t=0;t-1&&this._isCellReference(r))for(t=this.getCellsFromArgs(o[r]),i=0;i2){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(t="",2==a.length){if(!this._isCellReference(a[1])&&!this.namedRanges.containsKey(a[1])){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._bad_formula];return this.getErrorStrings()[5].toString()}t=a[1]}else t=this.cell;switch(i=a[0].split(this.tic).join(this._string_empty).toLowerCase(),s="",i){case"address":s=this.rowIndex(t).toString()+this.getParseArgumentSeparator()+this.colIndex(t).toString(),s=this.computeAddress(s);break;case"col":s=this.computeColumn(t);break;case"contents":s=this.getValueFromArg(t);break;case"filename":s="Not Supported";break;case"row":s=this.computeRow(t);break;case"type":s=this.computeIsBlank(t)==this.trueValueStr?"b":this.computeIsText(t)==this.trueValueStr?"l":"v"}return s.toString()},this.computeErrorType=function(e){var t=this._string_empty,i=this._splitArguments(e,this.getParseArgumentSeparator()),s=i.length;if(1!=s){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}return t=this._isCellReference(e)?this.getValueFromArg(e):e,t.length>1&&t[0]==this.tic[0]&&t[t.length-1]==this.tic[0]?"#N/A":"#NULL!"==t?"1":"#DIV/0!"==t?"2":"#VALUE!"==t?"3":"#REF!"==t?"4":"#NAME?"==t?"5":"#NUM!"==t?"6":"#N/A"==t?"7":"#GETTING_DATA"==t?"8":"#N/A"},this.computeInfo=function(e){var t,i,s,a=this.splitArgsPreservingQuotedCommas(e),n=a.length;if(1!=n||""==e){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}switch(t=this._stripTics0(this.getValueFromArg(a[0])).toLowerCase(),i=this._string_empty,t){case"directory":i=window.location.toString();break;case"numfile":i=null!=this.getSortedSheetNames()&&0==CalcEngine._sheetFamiliesList.length?this.getSortedSheetNames().length.toString():"1";break;case"origin":s=this.rowIndex(this.cell).toString()+this.getParseArgumentSeparator()+this.colIndex(this.cell).toString(),i="$A: "+this.computeAddress(s);break;case"osversion":i=navigator.platform.toString();break;case"recalc":i=this._alwaysComputeDuringRefresh?"Automatic":"Manual";break;case"release":i=this.System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.toString();break;case"system":switch(navigator.appVersion.indexOf()){case navigator.platform:i="unix";break;case navigator.platform:i="mac";break;default:i="pcdos"}break;default:if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._bad_formula];return this.getErrorStrings()[1].toString()}return i},this.computeIsBlank=function(e){var t=this.splitArgsPreservingQuotedCommas(e),i=t.length;if(1!=i||""==e){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}return""==this.getValueFromArg(e)?this.trueValueStr:this.falseValueStr},this.computeIsErr=function(e){var t=this.splitArgsPreservingQuotedCommas(e),i=t.length;if(1!=i||""==e){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}return e=this.getValueFromArg(e).toUpperCase().split(this.tic).join(this._string_empty),e.count>1,"NAN"!=e&&"-NAN"!=e&&"INFINITY"!=e&&"-INFINITY"!=e&&"#"!=e&&"n#"!=e||"#N/A"==e?this.falseValueStr:this.trueValueStr},this.computeIsError=function(e){var t=this.splitArgsPreservingQuotedCommas(e),i=t.length;if(1!=i||""==e){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}try{e=this.getValueFromArg(e).toUpperCase().split(this.tic).join(this._string_empty)}catch(e){return this.trueValueStr}return 0==e.indexOf("NAN")||0==e.indexOf("-NAN")||0==e.indexOf("INFINITY")||1==e.indexOf("-INFINITY")||0==e.indexOf("#")||0==e.indexOf("n#")?this.trueValueStr:this.falseValueStr},this.computeIsEven=function(e){var t,i,s,a,n=(this._string_empty,this.splitArgsPreservingQuotedCommas(e)),o=n.length;if(1!=o||""==e){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(t=this.getValueFromArg(n[0]),i=parseInt(t.split(this.tic).join("")),isNaN(i)){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_formula];return t[0]==this.tic||this._isCellReference(n[0])?this.getErrorStrings()[1].toString():this.getErrorStrings()[5].toString()}return s=new Date(Date.parse(t)),isNaN(i)&&"invalid Date"!=s.toString()&&(i=this._toOADate(s)),a=i,a%2==0?this.trueValueStr:this.falseValueStr},this.computeIsFormula=function(e){var t,i,s=this.splitArgsPreservingQuotedCommas(e),a=s.length,n=this._string_empty;if(1!=a){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(n=this.getValueFromArg(s[0]),this.namedRanges.containsValue(n)){ if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._bad_formula];return this.getErrorStrings()[1].toString()}if(t=parseInt(n.split(this.tic).join("")),isNaN(t)||!this._isCellReference(s[0])){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._bad_formula];return this.getErrorStrings()[5].toString()}return i=CalcEngine.getSheetFamilyItem(this.grid),this.isSheetMember()&&null!=i.parentObjectToToken&&(s[0]=i.parentObjectToToken.getItem(this.grid)+s[0]),this.getFormulaInfoTable().containsKey(s[0])?this.trueValueStr:this.falseValueStr},this.computeIsLogical=function(e){return e=this.getValueFromArg(e),e==this.falseValueStr||e==this.trueValueStr?this.trueValueStr:this.falseValueStr},this.computeIsNA=function(e){if(this.getErrorStrings().indexOf(e.toUpperCase())!=-1)return"#N/A"==e.toUpperCase()?this.trueValueStr:this.falseValueStr;try{e=this.getValueFromArg(e).toUpperCase()}catch(e){return this.falseValueStr}return"#N/A"==e[0]?this.trueValueStr:this.falseValueStr},this.computeIsNonText=function(e){return this.computeIsText(e)==this.trueValueStr?this.falseValueStr:this.trueValueStr},this.computeIsNumber=function(e){return e=this.getValueFromArg(e),isNaN(this._parseDouble(e))?this.falseValueStr:this.trueValueStr},this.computeIsRef=function(e){var t=this.splitArgsPreservingQuotedCommas(e);if(1!=t.length){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}return((this.namedRanges.containsKey(e)||this._isCellReference(e))&&e[0]!=this.tic&&e[length-1]!=this.tic).toString().toUpperCase()},this.computeIsOdd=function(e){var t=this._string_empty,i=0,s=this._splitArguments(e,this.getParseArgumentSeparator()),a=s.length,n=[this.getParseArgumentSeparator(),":"];if(1!=a){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(e!=this._string_empty){if(this._indexOfAny(e,n)!=-1)return"#VALUE!";if(t=this.getValueFromArg(s[0]),i=parseInt(t.split(this.tic).join(this._string_empty)),isNaN(i)){if(this._rethrowLibraryComputationExceptions)throw this.formulaErrorStrings[this._bad_formula];return t[0]==this.tic||this._isCellReference(s[0])?this.getErrorStrings()[1].toString():this.getErrorStrings()[5].toString()}return i%2!=0?this.trueValueStr:this.falseValueStr}return this.trueValueStr},this.computeIsText=function(e){var t=this._isCellReference(e),i=t?this.getValueFromArg(e):e;return(t||i[0]==this.tic)&&i.length>0&&isNaN(this._parseDouble(i))?this.trueValueStr:this.falseValueStr},this.computeN=function(e){var t,i=this._string_empty,s=0,a=this._splitArguments(e,this.getParseArgumentSeparator()),n=a.length;if(1!=n){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(i=this.getValueFromArg(e),t=new Date(Date.parse(i)),this._parseDouble(i))return s=this._parseDouble(i),s.toString();if(new Date(Date.parse(i))&&(s=this._getSerialDateTimeFromDate(t)),i==this.trueValueStr)s=1;else{if(i!=this.falseValueStr)return this.getErrorStrings().indexOf(i)>-1||this.formulaErrorStrings.indexOf(i)>-1?i:isNaN(s)?"0":s.toString();s=0}return s.toString()},this.computeNA=function(){return"#N/A"},this.computeSheet=function(e){var t,i,s,a=this.splitArgsPreservingQuotedCommas(e),n=a.length;this._string_empty;if(n>1){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(t=a[0].toUpperCase(),t=null==t||t==this._string_empty?this.cell:t,null==t||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 o=this.getSheetFamilyItem(this.grid),r=this._getSheetTokenFromReference(t),l=0;if(null!=r&&r!=this._string_empty||this.getSortedSheetNames().indexOf(t)!=-1||t.indexOf(this.sheetToken.toString()))if(r.length>0)l=parseInt(r.Replace(this.sheetToken.split(this.tic).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(t=0,i=a[0].toUpperCase(),this.getErrorStrings().indexOf(i)>-1)return i;if(null==i||i==this._string_empty)return this.getSortedSheetNames().length.toString();if(""==i.split(this.tic).join(this._string_empty)){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._bad_formula];return this.getErrorStrings()[5].toString()}if(!this._isCellReference(i)&&!this.namedRanges.containsKey(i)&&this.getSortedSheetNames().indexOf(i)==-1){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._bad_formula];return this.getErrorStrings()[5].toString()}try{if(s=this._splitArguments(i,"!"),t=(s.length-1)/2,0==t){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._bad_formula];return this.getErrorStrings()[5].toString()}}catch(e){if(this.getRethrowLibraryComputationExceptions())throw this.getErrorStrings()[2].toString();return this.getErrorStrings()[2].toString()}return t.toString()},this.computeType=function(e){var t,i=this.splitArgsPreservingQuotedCommas(e),s=i.length,a=0;if(1!=s){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(t=this.getValueFromArg(i[0]),null==t||t==this._string_empty){if(this.getRethrowLibraryComputationExceptions())throw this.getErrorStrings()[1].toString();return this.getErrorStrings()[1].toString()}return e.indexOf(this.getParseArgumentSeparator())>-1?a=64:this.computeIsNumber(t)==this.trueValueStr?a=1:this.computeIsLogical(t)==this.trueValueStr?a=4:this.getErrorStrings().indexOf(t)>-1?a=16:this.computeIsText(t)==this.trueValueStr&&(a=2),a.toString()},this.computeRow=function(e){var t=this.splitArgsPreservingQuotedCommas(e),i=t.length;if(1!=i){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}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 e.indexOf(":")>-1&&(e=this.getCellsFromArgs(e)[0]),this.rowIndex(e).toString()},this.computeRows=function(e){var t,i,s,a,n,o,r=this.splitArgsPreservingQuotedCommas(e);if(1!=r.length){if(this.getRethrowLibraryComputationExceptions())throw this.formulaErrorStrings[this._wrong_number_arguments];return this.formulaErrorStrings[this._wrong_number_arguments]}if(!this._isCellReference(r[0])&&e.indexOf(";")==-1){if(this.getRethrowLibraryComputationExceptions())throw this.getErrorStrings()[4].toString();return this.getErrorStrings()[4].toString()}if(s=1,r[0].indexOf(":")>-1)a=this.getCellsFromArgs(e),t=this.rowIndex(a[0].toString()),i=this.rowIndex(a[a.length-1].toString()),s=i-t+1,s=s>0?s:1;else if(r[0].indexOf(";")>-1)for(n=this._splitArguments(e.split(this.tic).join(this._string_empty),";"),o=1;o<=^(&,",this._validRightChars="+-*/><=^)&,",this.getKeyValue=function(e){if(e=e.toUpperCase(),this.getDataStore().containsKey(e)){var t=this.getDataStore().getItem(e),i=t.getFormulaText();if(i.length>0&&i[0]==CalcEngine.getFormulaCharacter()&&t.calcID!=this.getEngine().getCalcID()){this.getEngine().cell=this._cellPrefix+this.getKeyToRowsMap().getItem(e).toString(),i=i.substring(1);try{t.setParsedFormula(this.getEngine().parseFormula(this._markKeys(i)))}catch(i){if(this.getCheckKeys())return t.setFormulaValue(i.Message),t.calcID=this.getEngine().getCalcID(),null!=this._valueSetEvent&&this._valueSetEvent.trigger(this,new ValueSetEventArgs(e,t.getFormulaValue(),2)),this.getDataStore().getItem(e).getFormulaValue()}try{t.setFormulaValue(this.getEngine().computeFormula(t.getParsedFormula()))}catch(e){if(this.getThrowCircularException()&&0==e.toString().indexOf(this.getEngine().formulaErrorStrings[this.getEngine().circular_reference_]))throw e}t.calcID=this.getEngine().getCalcID(),null!=this._valueSetEvent&&this._valueSetEvent.trigger(this,new ValueSetEventArgs(e,t.getFormulaValue(),2))}return this.getEngine().getThrowCircularException()&&this.getEngine().getIterationMaxCount()>0&&t.setFormulaValue(this.getEngine().handleIteration(this.getEngine().cell,t)),this.getDataStore().getItem(e).getFormulaValue()}return this.getKeyToVectors().containsKey(e)?this.getKeyToVectors().getItem(e).toString():""},this.setKeyValue=function(e,t){var i,s,a,n,o,r,l;if(e=e.toUpperCase(),i=this._isIE8?t.toString().replace(/^\s+|\s+$/g,""):t.toString().trim(),!this.getDataStore().containsKey(e)||0==i.indexOf(this._leftBrace)){if(0==i.indexOf(this._leftBrace)){this.getKeyToVectors().containsKey(e)||this.getKeyToVectors().add(e,""),i=i.substring(1,i.length-2);var d=this.getKeyToRowsMap().length+1,h=i.split(this.getEngine().getParseArgumentSeparator()),c="A"+d+":A"+(d+h.length-1);for(this.getKeyToVectors()[e]=c,s=0;s0&&o.getFormulaText()!=i&&(r=this._cellPrefix+this.getKeyToRowsMap().getItem(e).toString(),l=this.getEngine().getDependentFormulaCells().getItem(r),null!=l&&this.getEngine().clearFormulaDependentCells(r)),i.length>0&&i[0]==CalcEngine.getFormulaCharacter()?(o.setFormulaText(i),null!=this._valueSetEvent&&this._valueSetEvent.trigger(this,new ValueSetEventArgs(e,o.getFormulaValue(),2))):o.getFormulaValue()!=i&&(o.setFormulaText(""),o.setParsedFormula(""),o.setFormulaValue(i),null!=this._valueSetEvent&&this._valueSetEvent.trigger(this,new ValueSetEventArgs(e,o.getFormulaValue(),2))),this.getAutoCalc()&&this.updateDependencies(e)},this.resetKeys=function(){this.getDataStore().clear(),this.getKeyToRowsMap().clear(),this.getRowsToKeyMap().clear(),this.getKeyToVectors().clear(),this.getNameToControlMap().clear()},this._checkAdjacentPiece=function(e,t,i){var s=!0;return e=this._isIE8?e.replace(/^\s+|\s+$/g,""):e.trim(),e.length>0&&(s=t.indexOf(e[i?0:e.length-1])>-1),s},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(),null!=this._engine&&this._engine.dispose(),this._engine=null)},this.tryParseAndCompute=function(e){var t="";try{t=this.parseAndCompute(e)}catch(e){t=e.message}return t},this.getFormula=function(e){return e=e.toUpperCase(),this.getDataStore().containsKey(e)?this.getDataStore().getItem(e).getFormulaText():""},this.getValueRowCol=function(e,t){var i,s=this.getRowsToKeyMap().getItem(t).toString(),a=this.getKeyValue(s).toString();return null!=a&&"%"==a[a.length-1]&&a.length>1&&(i=this.parseDouble(a.substring(0,a.length-1)),isNaN(i)&&(a=(Number(i)/100).toString())),a},this.initCalcQuick=function(e){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(),e&&(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="msie"==ej.browserInfo().name&&"8.0"==ej.browserInfo().version},this._markKeys=function(e){for(var t,i,s,a,n=e.indexOf(this._leftBracket);n>-1;)if(t=e.substring(n).indexOf(this._rightBracket)-1,i="",t>0)if(i=e.substring(n+1,t+n+1).toUpperCase(),this.getKeyToVectors().containsKey(i)){if(s=n+t+20?e.substring(0,n):"",this.getCheckKeys()&&!this._checkAdjacentPiece(a,this._validLeftChars,!1))throw"not followed properly"+i;e=a+this.getKeyToVectors().getItem(i).toString()+s,n=e.indexOf(this._leftbraket)}else{if(!this.getKeyToRowsMap().containsKey(i)){if(e.toUpperCase().indexOf(this._tic+this._leftBracket+i+this._rightBracket+this.tic)>0)break;throw"Unknown key: "+i}if(s=n+t+20?e.substring(0,n):"",this.getCheckKeys()&&!this._checkAdjacentPiece(a,this._validLeftChars,!1))throw"not followed properly"+i;e=a+"A"+this.getKeyToRowsMap().getItem(i).toString()+s,n=e.indexOf(this._leftBracket)}else n=-1;return e},this.parseAndCompute=function(e){return e.length>0&&e[0]==this.getEngine().getFormulaCharacter()&&(e=e.substring(1)),this.getEngine().parseAndComputeFormula(this._markKeys(e))},this.refreshAllCalculations=function(){var e,t;if(this.getAutoCalc()){for(this.setDirty(),this.ignoreChanges=!0,e=0;e0&&a[0]==this.getEngine().getFormulaCharacter()&&s.calcID!=this.getEngine().getCalcID()&&(a=a.substring(1),this.getEngine().cell=this._cellPrefix+this.getKeyToRowsMap().getItem(i).toString(),s.setParsedFormula(this.getEngine().parseFormula(this._markKeys(a))),s.setFormulaValue(this.getEngine().computeFormula(s.getParsedFormula())),s.calcID=this.getEngine().getCalcID(),t=parseInt(this.getKeyToRowsMap().getItem(i)),this.getEngine().valueChanged(this,new ValueChangedArgs(t,1,s.getFormulaValue()))),null!=this._valueSetEvent&&this._valueSetEvent.trigger(this,new ValueSetEventArgs(i,s.getFormulaValue(),2))}this.ignoreChanges=!1}},this.setDirty=function(){this.getEngine().updateCalcID()},this.setValueRowCol=function(){},this.updateDependencies=function(e){var t,i,s,a;if(this.getAutoCalc()&&(t=this._cellPrefix+this.getKeyToRowsMap().getItem(e).toString(),i=this.getEngine().getDependentCells().getItem(t),this.setDirty(),null!=i))for(s=0;s-1&&(a=parseInt(i[s].substring(a+1)),e=this.getRowsToKeyMap().getItem(a).toString(),this.ignoreChanges=!0,this.setKeyValue(e,this.getKeyValue(e)),this.ignoreChanges=!1)},this.initCalcQuick(e)}return e.prototype.getAutoCalc=function(){return this._autoCalc},e.prototype.setAutoCalc=function(e){this._autoCalc=e,this.getEngine().setCalculatingSuspended(!e),this.getEngine().setUseDependencies(e),e&&this.setDirty()},e.prototype.getCalcQuickID=function(){return this._calcQuickID++,this._calcQuickID==Number.MAX_VALUE&&(this._calcQuickID=1),this._calcQuickID},e.prototype.getCheckKeys=function(){return this._checkKeys},e.prototype.setCheckKeys=function(e){this._checkKeys=e},e.prototype.getControlModifiedFlags=function(){return this._controlModifiedFlags},e.prototype.getDataStore=function(){return this._dataStore},e.prototype.getDisposeEngineResource=function(){return this._disposeEngineResource},e.prototype.setDisposeEngineResource=function(e){this._disposeEngineResource=e},e.prototype.getEngine=function(){return this._engine},e.prototype.getFormulaCharacter=function(){return this.getEngine().getFormulaCharacter()},e.prototype.setFormulaCharacter=function(e){this.getEngine().setFormulaCharacter(e)},e.prototype.getKeyToRowsMap=function(){return this._keyToRowsMap},e.prototype.getKeyToVectors=function(){return this._keyToVectors},e.prototype.getNameToControlMap=function(){return this._nameToControlMap},e.prototype.getRowsToKeyMap=function(){return this._rowsToKeyMap},e.prototype.getThrowCircularException=function(){return this.getEngine().getThrowCircularException()},e.prototype.setThrowCircularException=function(e){this.getEngine().setThrowCircularException(e)},e.prototype.getValueSetEventHandler=function(){return null==this._valueSetEvent&&(this._valueSetEvent=new ValueSetEvent),this._valueSetEvent.getValueSet()},e.prototype.setValueSetEventHandler=function(e){null==this._valueSetEvent&&(this._valueSetEvent=new ValueSetEvent),this._valueSetEvent.setValueSet(e)},e}(),CalcQuick=function(e){function t(){e.apply(this,arguments),this.registerControlArray=function(e){for(var t=0;t0&&n<9;)e--,t="A".charCodeAt(0),a[n]=String.fromCharCode(e%26+t),e=parseInt((e/26).toString()),n++;for(i=[],s=0;s-1&&this.wrapper.find("span:first").hasClass("e-chk-inact")&&(this.checked().splice(e.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[0].removeAttribute("disabled"),this._isIE8&&this.span.removeClass("e-disable"),this._wireEvents(),this.model.enabled=!0)},isChecked:function(){if(null!=this._isChecked&&this._isChecked!=i)return this._isChecked}}),t.CheckboxSize={Small:"small",Medium:"medium"},t.CheckState={Check:"check",Uncheck:"uncheck",Indeterminate:"indeterminate"}}(jQuery,Syncfusion),function(e,t){t.widget("ejRadioButton","ej.RadioButton",{_rootCSS:"e-radiobtn",element:null,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,beforeChange:null,change:null,create:null,destroy:null},dataTypes:{id:"string",name:"string",checked:"boolean",enablePersistence:"boolean",size:"enum",enabled:"boolean",idPrefix:"string",validationRules:"data",validationMessage:"data",htmlAttributes:"data"},_init:function(){var e=t.browserInfo();this._isIE8="msie"==e.name&&"8.0"==e.version,this._setValue(),this._renderControl(),this.isChecked&&this._checkedHandler(),this._setEnabled(this.model.enabled),this._addAttr(this.model.htmlAttributes),null!=this.model.validationRules&&(this._initValidator(),this._setValidation()),this._wireEvents(),this.initialRender=!1},_addAttr:function(t){var i=this;e.map(t,function(e,t){"class"==t?i.div.addClass(e):"name"==t?i.radbtn.attr(t,e):"required"==t?i.radbtn.attr(t,e):"disabled"==t&&"disabled"==e?i.disable():"checked"==t&&"checked"==e?i._checkedChange(!0,!0):i.div.attr(t,e)})},_initValidator:function(){this.element.closest("form").data("validator")||this.element.closest("form").validate()},_setValidation:function(){var i,s,a,n;this.element.find("input").rules("add",this.model.validationRules),i=this.element.closest("form").data("validator"),i=i?i:this.element.closest("form").validate(),name=this.element.find("input").attr("name"),i.settings.messages[name]={};for(s in this.model.validationRules)if(a=null,!t.isNullOrUndefined(this.model.validationRules[s])){if(t.isNullOrUndefined(this.model.validationRules.messages&&this.model.validationRules.messages[s])){i.settings.messages[name][s]=e.validator.messages[s];for(n in this.model.validationMessage)s==n?a=this.model.validationMessage[s]:""}else a=this.model.validationRules.messages[s];i.settings.messages[name][s]=null!=a?a:e.validator.messages[s]}},_setModel:function(e){for(var t in e)switch(t){case"cssClass":this._changeSkin(e[t]);break;case"enableRTL":this.model.text?e[t]?this.textWrapDiv.addClass("e-rtl"):this.textWrapDiv.removeClass("e-rtl"):e[t]?this.element.closest(".e-radiobtn-wrap").addClass("e-rtl"):this.element.closest(".e-radiobtn-wrap").removeClass("e-rtl");break;case"text":this._setText(e[t]);break;case"size":this._setSize(e[t]);break;case"validationRules":null!=this.model.validationRules&&(this.element.find("input").rules("remove"),this.model.validationMessage=null),this.model.validationRules=e[t],null!=this.model.validationRules&&(this._initValidator(),this._setValidation());break;case"validationMessage":this.model.validationMessage=e[t],null!=this.model.validationRules&&null!=this.model.validationMessage&&(this._initValidator(),this._setValidation());break;case"checked":this.model.checked=e[t],this._checkedChange(this.model.checked);break;case"enabled":this._setEnabled(e[t]);break;case"id":this._setIdAttr(e[t]);break;case"name":this.radbtn.attr("name",e[t]);break;case"value":this.radbtn.attr("value",e[t]);break;case"htmlAttributes":this._addAttr(e[t])}},_destroy:function(){this.radbtn.removeClass("e-radiobtn e-input"),this.radbtn.insertBefore(this.element),this.element.remove(),this.element=this.radbtn},_changeSkin:function(e){this.model.cssClass!=e&&(this.element.removeClass(this.model.cssClass).addClass(e),this.textWrapDiv.removeClass(this.model.cssClass).addClass(e))},_setValue:function(){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}),this.model.checked||t.isNullOrUndefined(this.element.attr("checked"))?this.isChecked=this.model.checked:this.model.checked=this.isChecked=!0},_setIdAttr:function(t){e("#"+this.model.idPrefix+this.model.id+"_wrapper").attr("id",this.model.idPrefix+t+"_wrapper"),e("#"+this.model.idPrefix+this.model.id).attr("id",this.model.idPrefix+t),this.radbtn.attr("id",t)},_setSize:function(e){e==t.RadioButtonSize.Medium?this.span.removeClass("e-radsmaller").addClass("e-radmedium"):this.span.removeClass("e-radmedium").addClass("e-radsmaller")},_setEnabled:function(e){e?this.enable():this.disable()},_renderControl:function(){this.initialRender=!0;var i=t.browserInfo();this.div=e("msie"==i.name&&"8.0"==i.version?'
':'
'),this.div.attr({id:this.model.idPrefix+this.model.id,role:"radio",tabindex:0,"aria-checked":!1}),this.span=e(""),this.span.addClass("e-spanicon"),this._setSize(this.model.size),this.spanImg=e('',"",{},{role:"presentation"}),this.element.addClass("e-input"),this.model.name=t.isNullOrUndefined(this.model.name)?this.model.id:this.model.name,this.element.attr({id:this.model.id,name:this.model.name,value:this.model.value}),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,this.isChecked&&this.element.find(".e-input").attr("checked",!0)},_setTextWrapper:function(i){""!=i?(this.textWrapDiv=t.buildTag("div.e-radiobtn-wrap "+this.model.cssClass+"#"+this.model.idPrefix+this.model.id+"_wrapper"),this.div.wrapAll(this.textWrapDiv),this.txtSpan=t.buildTag("div.e-text",i),this.textWrapDiv=e("#"+this.model.idPrefix+this.model.id+"_wrapper"),this.textWrapDiv.append(this.txtSpan),this.model.enableRTL&&this.textWrapDiv.addClass("e-rtl")):this.model.enableRTL&&this.element.closest(".e-radiobtn-wrap").addClass("e-rtl")},_setText:function(e){""==this.model.text&&""!=e?this._setTextWrapper(e):this.txtSpan.html(e)},_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(){e(this.element).addClass("e-focus"),e(this.element).bind("keydown",e.proxy(this._checkUnCheck,this))},_focusOut:function(){e(this.element).removeClass("e-focus"),e(this.element).unbind("keydown",e.proxy(this._checkUnCheck,this))},_checkUnCheck:function(e){(32==e.keyCode||37==e.keyCode||38==e.keyCode||39==e.keyCode||40==e.keyCode)&&(e.preventDefault(),this._checkedHandler())},_checkedHandler:function(){this.element.hasClass("e-disable")||(this.isChecked="checked"==this.element.find("input.e-radiobtn:radio").attr("checked"),e(this.element).find(".e-rad-icon").hasClass("e-rad-active")||this._changeEvent(!0))},_checkedChange:function(e,t){this.isChecked=e,this.isChecked&&this.model.enabled&&this._changeEvent(t)},_changeEvent:function(t){var i={isChecked:this.isChecked,isInteraction:!!t};if(!this.initialRender&&1==this._trigger("beforeChange",i))return!1;if(!e(this.element).find(".e-rad-icon").hasClass("e-rad-active")){var s=this.element.find(".e-input").attr("name"),a=e('input.e-radiobtn[name="'+s+'"]:radio'),n=this.element.find(".e-input"),o=e(n).data("ejRadioButton");i.isChecked&&(this.spanImg.addClass("e-rad-active").removeClass("e-rad-select"),this.div.attr({tabindex:0,"aria-checked":!0})),e.each(a,function(t,i){e(i).closest(".e-radiobtn-wrap").find(".e-rad-icon").removeClass("e-rad-active").addClass("e-rad-select"),e(i).closest(".e-radiobtn-wrap").attr({tabindex:0,"aria-checked":!1});var s=e(i).data("ejRadioButton");null!=s&&(s.model.checked=!1)}),null!=o&&(o.model.checked=!0),this.element.find(".e-rad-icon").addClass("e-rad-active").removeClass("e-rad-select"),this.div.attr({tabindex:0,"aria-checked":!0}),this.element.find(".e-input").click(),this.isChecked=!0}i={isChecked:this.isChecked,isInteraction:!!t},this.initialRender||this._trigger("change",i)},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.removeAttr("disabled")),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(e,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"]},defaults:{dataSource:null,query:null,fields:{text:null,key:null,category:null,groupBy:null,htmlAttributes:null},locale:"en-US",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,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,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",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"},observables:["value"],value:t.util.valueFunction("value"),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}),"visualmode"==this.model.multiSelectMode&&this._ulBox.removeClass("e-disable").attr({"aria-disabled":!1}))},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}),"visualmode"==this.model.multiSelectMode&&this._ulBox.addClass("e-disable").attr({"aria-disabled":!0}))},clearText:function(){"visualmode"==this.model.multiSelectMode&&this._deleteBox(this._ulBox.children("li")),this.element.val(""),this._valueChange(),this._isFocused?this.element.blur():this._focusOutAction()},getValue:function(){var e=this.value();return null==e?"":e},getSelectedItems:function(){return this._isFocused&&"visualmode"!=this.model.multiSelectMode&&this._updateSelectedItemArray(),this._selectedItems},_setValue:function(i){var s,a;if(this._isWatermark||this._hiddenSpan.css("display","none"),("object"==typeof i||"number"==typeof i&&isNaN(i)||""==e.trim(i))&&(i=null),i=e.trim(i),"visualmode"==this.model.multiSelectMode&&this._hiddenInput.val(""),this.element.val(""),i)if("visualmode"==this.model.multiSelectMode)if(this._selectedItems=[],this._hiddenInput.val(i),this._modelValue=i,this._deleteBox(this._ulBox.children("li")),s=i.split(this.model.delimiterChar),t.DataManager&&this.model.dataSource instanceof t.DataManager)this._createBoxForObjectType(s);else if(this.suggestionListItems=this.model.dataSource,this.suggestionListItems&&"object"!=typeof this.suggestionListItems[0])for(a=0;a0&&this._OnTextEnter())},setVisible:function(e){e?this.wrapper.show():this.wrapper.hide()},hide:function(){this._hideResult()},open:function(){this._showFullList()},_changeWatermark:function(e){this._isWatermark?this.element.attr("placeholder",e):this._hiddenSpan.text(e)},_changeSkin:function(e){this.wrapper.removeClass(this.model.cssClass).addClass(e),this.suggestionList.removeClass(this.model.cssClass).addClass(e)},_setDropdown:function(e){this.model.showPopupButton=e,e?this._renderDropdown():this._destroyDropdown()},_changeHeight:function(e){this.wrapper.height(e)},_changeWidth:function(e){this.wrapper.width(e),this._setListWidth()},_setCulture:function(){this.defaults.addNewText===this.model.addNewText&&(this.model.addNewText=this._getLocalizedLabels("addNewText")),this.defaults.emptyResultText===this.model.emptyResultText&&(this.model.emptyResultText=this._getLocalizedLabels("emptyResultText"))},_init:function(){return this._setCulture(),!(!this.element.is("input")||this.element.attr("type")&&"text"!=this.element.attr("type"))&&(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,void(null!=this.model.validationRules&&(this._initValidator(),this._setValidation())))},_initValidator:function(){this.element.closest("form").data("validator")||this.element.closest("form").validate()},_setValidation:function(){var i,s,a,n,o;if(this.model.validationRules){i="visualmode"==this.model.multiSelectMode?this._hiddenInput:this.element,i.rules("add",this.model.validationRules),s=this.element.closest("form").data("validator"),s=s?s:this.element.closest("form").validate(),name=i.attr("name"),s.settings.messages[name]={};for(a in this.model.validationRules)if(n=null,!t.isNullOrUndefined(this.model.validationRules[a])){if(t.isNullOrUndefined(this.model.validationRules.messages&&this.model.validationRules.messages[a])){s.settings.messages[name][a]=e.validator.messages[a];for(o in this.model.validationMessage)a==o?n=this.model.validationMessage[a]:""}else n=this.model.validationRules.messages[a];s.settings.messages[name][a]=null!=n?n:e.validator.messages[a]}}},_setModel:function(e){var t,i,s;for(t in e)switch(t){case"dataSource":this.model.dataSource=null;break;case"watermarkText":this._changeWatermark(e[t]);break;case"delaySuggestionTimeout":this.model.delaySuggestionTimeout=parseInt(e[t]);break;case"value":e[t]=this._setValue(e[t]),i="visualmode"==this.model.multiSelectMode?this._hiddenInput.val():""==this.element.val()?null:this.element.val(),this._changeEvtTrigger(i);break;case"showPopupButton":this._setDropdown(e[t]);break;case"enableRTL":this._RightToLeft(e[t]);break;case"showRoundedCorner":this._setRoundedCorner(e[t]);break;case"readOnly":this._checkReadOnly(e[t]);break;case"delimiterChar":s=this.model.delimiterChar,e[t]=this._validateDelimiter(e[t]),this.model.delimiterChar=e[t],this.element.val(this.value().replace(new RegExp(s,"g"),this.model.delimiterChar)),this.value(this.element.val());break;case"validationRules":null!=this.model.validationRules&&(this.element.rules("remove"),this.model.validationMessage=null),this.model.validationRules=e[t],null!=this.model.validationRules&&(this._initValidator(),this._setValidation());break;case"validationMessage":this.model.validationMessage=e[t],null!=this.model.validationRules&&null!=this.model.validationMessage&&(this._initValidator(),this._setValidation());break;case"multiSelectMode":this.model.multiSelectMode=e[t],"visualmode"==e[t]?(null!=this.model.validationRules&&this.element.rules("remove"),this._renderBoxModel()):this.element.hasClass("e-visual-mode")&&this._destroyBoxModel(),this._setValue(this.value()),this._setValidation();break;case"enabled":this._disabled(!e[t]);break;case"visible":this.setVisible(e[t]);break;case"height":this._changeHeight(e[t]);break;case"width":this._changeWidth(e[t]);break;case"cssClass":this._changeSkin(e[t]);break;case"itemsCount ":(e[t]<=0||isNaN(e[t]))&&(e[t]=0);break;case"popupHeight":this.suggestionList.css({"max-height":e[t]});break;case"popupWidth":this.model.popupWidth=e[t],this._setListWidth();break;case"selectValueByKey":this.selectValueByKey(e[t]);break;case"htmlAttributes":this._addAttr(e[t]);break;case"emptyResultText":this._setCulture();break;case"addNewText":this._setCulture()}},_destroy:function(){this.element.insertAfter(this.wrapper),"visualmode"==this.model.multiSelectMode&&this.element.attr("name",this._hiddenInput.attr("name")),this.wrapper.remove(),this.element.removeClass("e-input").val(""),this._isWatermark&&this.element.removeAttr("placeholder"),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"),this.target=this.element[0],this.dropdownbutton=null,this._isIE8="msie"==t.browserInfo().name&&"8.0"==t.browserInfo().version,this.showSuggestionBox=!1,this.noresult=!0,this._queryString=null,this.suggLen=0,this._selectedItems=[],this._modelValue="",this._activeItem=0,this.ctrlKeyPressed=!1,this._isFocused=!1,this._isOpened=!1,this._typed=!1,this._cancelEvent=!1,this._isWatermark=this._checkWatermarkSupport()},_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(){if(this.initialRender=!0,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),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");var e=this;this._hiddenSpan.click(function(){this._isFocused||e.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.dropdownbutton.bind("mousedown",e.proxy(this._OnDropdownClick,this)); }},_addAttr:function(t){var i=this;e.map(t,function(e,t){"required"==t&&i.element.attr(t,e),"class"==t?i.wrapper.addClass(e):"name"==t?i.element.attr(t,e):"disabled"==t&&"disabled"==e?i._disabled(!0):"readOnly"==t&&"readOnly"==e?i._checkReadOnly(!0):i.wrapper.attr(t,e)})},_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"),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.element.width(1),this.container.prepend(this._hiddenInput,this._ulBox),this.wrapper.height("auto"),this._on(this.container,"mousedown",function(t){if(!this.model.enabled)return!1;var i=e(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._ulBox.remove(),this._off(this.container,"mousedown")},_deleteLastBox:function(){var e=this._ulBox.children(),t=e.last(),i=t.hasClass("e-active");this._removeActive(),i?this._deleteBox(t):t.addClass("e-active")},_deleteBox:function(t){for(var i,s,a,n,o,r=0;r0&&this._showResult(e)},_swapUnCategorized:function(t){e(t).each(function(e,i){if(!i.key){for(var s=e;s>0;s--)t[s]=t[s-1];return t[s]=i,!1}})},_generateLi:function(i,s){for(var a,n,o,r=0;rparseInt(e.isNumeric(this.model.popupHeight)?this.model.popupHeight:this.model.popupHeight.replace("px",""))-4?(this.scrollerObj.model.height=this.suggestionList.height(),this.scrollerObj.refresh(),this.scrollerObj.option("scrollTop",0),this.suggestionList.addClass("e-scroller")):this.suggestionList.removeClass("e-scroller"),this.suggestionList.css("height","auto"),this._isIE8&&this.suggestionList.find(".e-vscroll div, .e-hscroll div").attr("unselectable","on")},_setListPosition:function(){var t,i=this.wrapper,s=this._getOffset(i),a=e(document).scrollTop()+e(window).height()-(s.top+e(i).outerHeight()),n=s.top-e(document).scrollTop(),o=this.suggestionList.outerHeight(),r=this.suggestionList.outerWidth(),l=s.left,d=i.outerHeight(),h=(d-i.height())/2,c=this._getZindexPartial(),u=3,m=(on?s.top+d+u:s.top-o-u)-h;t=e(document).scrollLeft()+e(window).width()-l,(this.model.enableRTL||r>t&&r"+n[e]+"":i}))}return t},_RightToLeft:function(e){e?(this.wrapper.addClass("e-rtl"),this.suggestionList.addClass("e-rtl")):(this.wrapper.removeClass("e-rtl"),this.suggestionList.removeClass("e-rtl"))},_setRoundedCorner:function(e){e?(this.container.addClass("e-corner"),this.suggestionList.addClass("e-corner")):(this.container.removeClass("e-corner"),this.suggestionList.removeClass("e-corner"))},_checkReadOnly:function(e){this.model.readOnly=e,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.element.removeAttr("readonly").removeAttr("aria-readonly"),this._on(this.element,"keydown",this._OnKeyDown),this._on(this.element,"keyup",this._OnKeyUp))},_OnKeyDown:function(t){switch("startswith"!=this.model.filterType&&(this.model.enableAutoFill=!1),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._addListHover(),this.model.enableAutoFill&&(this.element.attr("aria-autocomplete","both"),this._queryString=this.target.value,this._setTextBoxValue())),this._PreventDefaultAction(t);break;case 40:this.showSuggestionBox&&this.suggestionList?(this._removeListHover(),this._activeItem=this.model.minCharacter?(this._autoFill=!1,this._OnTextEnter(t)):(this.noresult=!0,this._hideResult(t),""==e.trim(this.element.val())&&(this._isOpened=!1,this._trigger("close",{event:t,isInteraction:!0}))),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(e,i){var s,a;t.isNullOrUndefined(e)||"object"!=typeof e[0]||(s=this.model.fields&&this.model.fields.text?this.model.fields.text:"text",t.isNullOrUndefined(t.DataManager(e).executeLocal(t.Query().select(s))[0])&&this.model.actionFailure&&this._trigger("actionFailure",{error:this._getLocalizedLabels("actionFailure")})),!e||!e.length||e.length<1?(this.suggestionListItems=[],this.model.actionFailure&&this._trigger("actionFailure",{error:this._getLocalizedLabels("actionFailure")})):(a=t.Query(),this._addQuery(a,"object"==typeof e[0]),this.suggestionListItems=t.DataManager(e).executeLocal(a),this.model.actionSuccess&&this._trigger("actionSuccess")),this._doneRemaining(i),this.model.actionComplete&&this._trigger("actionComplete")},_performSearch:function(e){var i,s;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,e):(window.clearTimeout(this.timer),s=this,this.timer=window.setTimeout(function(){s._fetchRemoteDat(i)},700)):this._getFilteredList(i,e)},_fetchRemoteDat:function(e){var t,i=this,s=this._getQuery();this._addQuery(s,!0),t=e.executeQuery(s),t.fail(function(e){i.suggestionListItems=null,i._removeLoadingClass(),i._trigger("actionFailure",e)}).done(function(e){i.suggestionListItems=e.result,i._doneRemaining(e),i._trigger("actionSuccess",e)}).always(function(e){i._trigger("actionComplete",e)})},_addSortingQuery:function(e,t){if(this.model.allowSorting){var i="descending"==this.model.sortOrder;e.sortBy(t,i)}},_addQuery:function(e,t){var i,s="";t&&(i=this.model.fields,s=i&&i.text?i.text:"text"),this._queryString&&e.where(s,this.model.filterType,this._queryString,!this.model.caseSensitiveSearch),this._addSortingQuery(e,s),this.model.itemsCount>0&&e.take(this.model.itemsCount)},_getQuery:function(){var e;if(t.isNullOrUndefined(this.model.query)){var i=[],s=t.Query(),a=this.model.fields;for(e in a)"tableName"!==e&&a[e]&&i.push(a[e]);i.length>0&&s.select(i),t.isNullOrUndefined(this.model.dataSource.dataSource.url)||this.model.dataSource.dataSource.url.match(a.tableName+"$")||t.isNullOrUndefined(a.tableName)||s.from(a.tableName)}else s=this.model.query.clone();return s},_OnTextEnter:function(e){this._addLoadingClass(),this.element.attr("aria-expanded",!1),this._performSearch(e)},_doneRemaining:function(e){this._showSuggestionList(e),this.element.attr("aria-expanded",!0).attr("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(e)},_removeRepeated:function(){var e,t,i=this.suggestionListItems;if(!i||0==i.length||0==this._selectedItems.length)return!1;for(e=0;e6)&&(i[s]=this.culture.calendar.firstDay,a=-1),this.model.startDay=i[s],t.isNullOrUndefined(this._options)&&(this._options={}),this._options.startDay=a,n=!0,o=!0;break;case"startLevel":this.model.startLevel=i[s],n=!0,o=!0;break;case"headerFormat":this.model.headerFormat=i[s],n=!0,o=!0;break;case"depthLevel":this.model.depthLevel=i[s],n=!0,o=!0;break;case"htmlAttributes":this._addAttr(i[s]);break;case"allowEdit":this._changeEditable(i[s]);break;case"tooltipFormat":this.model.tooltipFormat=i[s],n=!0,o=!0;break;case"allowDrillDown":this._allowQuickPick(i[s]),n=!0,o=!0;break;case"showDisabledRange":this._setRestrictDateState(i[s])}r&&(this._validateMinMaxDate(),i.value=this.model.value,i.maxDate=this.model.maxDate,i.minDate=this.model.minDate),this._setWaterMark(),n&&this.isValidState&&this._refreshDatepicker(),o&&this._startLevel(this.model.startLevel),this._triggerChangeEvent(),this._checkErrorClass()},observables:["value"],_destroy:function(){this._isOpen&&this.hide(),this.sfCalendar.remove(),this.wrapper&&(this.element.insertAfter(this.wrapper),this.wrapper.remove()),this.element.removeClass("e-datepicker e-input")},_init:function(e){this._options=e,this._dt_drilldown=!1,this.animation={open:{type:"easeOutQuad",duration:200},close:{type:"easeOutQuad",duration:100}},this._animating=!1,this._isSupport=document.createElement("input").placeholder!=s,this._checkAttribute(),this._setValues(),this._createDatePicker(),this._setRestrictDateState(this.model.showDisabledRange),null!=this.model.validationRules&&(this._initValidator(),this._setValidation()),e&&e.value!=s&&e.value!=this.element.val()&&this._trigger("_change",{value:this.element.val()})},_initValidator:function(){this.element.closest("form").data("validator")||this.element.closest("form").validate()},_setValidation:function(){var i,s,a,n;this.element.rules("add",this.model.validationRules),i=this.element.closest("form").data("validator"),i=i?i:this.element.closest("form").validate(),name=this.element.attr("name"),i.settings.messages[name]={};for(s in this.model.validationRules)if(a=null,!t.isNullOrUndefined(this.model.validationRules[s])){if(t.isNullOrUndefined(this.model.validationRules.messages&&this.model.validationRules.messages[s])){i.settings.messages[name][s]=e.validator.messages[s];for(n in this.model.validationMessage)s==n?a=this.model.validationMessage[s]:""}else a=this.model.validationRules.messages[s];i.settings.messages[name][s]=null!=a?a:e.validator.messages[s]}},_checkAttribute:function(){for(var e,i,s=["min","max","readonly","disabled"],a=["minDate","maxDate","readOnly","enabled"],n=0;n6)&&(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="msie"==t.browserInfo().name&&"8.0"==t.browserInfo().version,this._isIE9="msie"==t.browserInfo().name&&"9.0"==t.browserInfo().version,this._getInternalEvents=!1,this._flag=!0,this._ejHLWeekEnd=!1,this._isOpen=!1,this._prevDate=null,this._isFocused=!1},_addAttr:function(t){var i=this;e.map(t,function(e,t){"required"==t?i.element.attr(t,e):"name"==t?i.element.attr(t,e):"class"==t?i.wrapper.addClass(e):"disabled"==t&&"disabled"==e?i.disable():"readOnly"==t&&"readOnly"==e?i.model.readOnly=!0:i.wrapper.attr(t,e)})},_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._mapField=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.innerWrapper=t.buildTag("span.e-in-wrap e-box"),this.wrapper.append(this.innerWrapper).insertBefore(this.element),this.innerWrapper.append(this.element),this.innerWrapper.addClass("e-padding"),this.dateIcon=t.buildTag("span.e-select#"+this._id+"-img","",{},this._isIE8?{unselectable:"on"}:{}).append(t.buildTag("span.e-icon e-date","",{},{"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;e(this._hiddenInput).focus(function(){i.element.focus()})}this._checkNameAttr(),this._setHeight(this.model.height),this._setWidth(this.model.width),this._id&&e("#e-"+this._id).remove(),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,this._resizeCalender(),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._createCalender(),this._setDisplayInline(this.model.displayInline),this.model.readOnly&&this._disbleMaualInput(),this.model.enabled?this.model.enabled&&e(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(e,t){t&&this.model.showPopupButton==e||(!e&&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=e)},_resizeCalender:function(){"short"==this.model.dayHeaderFormat||"min"==this.model.dayHeaderFormat||"none"==this.model.dayHeaderFormat?this.sfCalendar.removeClass("e-headerlong"):"long"==this.model.dayHeaderFormat&&this.sfCalendar.addClass("e-headerlong")},_setWidth:function(e){e?this.wrapper?this.wrapper.width(e):this.element.width(e):this.model.width=this.wrapper?this.wrapper.outerWidth():this.element.width()},_setHeight:function(e){e?this.wrapper?this.wrapper.height(e):this.element.height(e):this.model.height=this.wrapper?this.wrapper.outerHeight():this.element.height(),this._isIE7&&this.element.height(this.innerWrapper.height())},_setRTL:function(e){e?(this.wrapper&&this.wrapper.addClass("e-rtl"),this.sfCalendar.addClass("e-rtl")):(this.wrapper&&this.wrapper.removeClass("e-rtl"),this.sfCalendar.removeClass("e-rtl"))},_setRoundedCorner:function(e){e?(this.innerWrapper&&this.innerWrapper.addClass("e-corner"),this.sfCalendar.addClass("e-corner")):(this.innerWrapper&&this.innerWrapper.removeClass("e-corner"),this.sfCalendar.removeClass("e-corner"))},_refreshDatepicker:function(){var t=this.element.val(),i=this._parseDate(t,this.model.dateFormat);i=this._validateYearValue(i),this._setDateValue(i),e(".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(e){if(null!=e){var i=t.preferredCulture(this.model.locale).calendars.standard.twoDigitYearMax;i="string"==typeof i?(new Date).getFullYear()%100+parseInt(i,10):i,this._calendarDate.getFullYear()-e.getFullYear()==100&&this._calendarDate.getFullYear()>i&&e.setFullYear(this._calendarDate.getFullYear())}return e},_setFooterText:function(t){e(".e-footer-text",this.sfCalendar).html(t)},_setSkin:function(e){this.wrapper?(this.wrapper.removeClass(this.model.cssClass),this.wrapper.addClass(e)):(this.element.removeClass(this.model.cssClass),this.element.addClass(e)),this.sfCalendar.removeClass(this.model.cssClass),this.sfCalendar.addClass(e)},_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"),e("body").append(this.sfCalendar),this._isOpen=!1),t?(this.show(),this._off(this.dateIcon,"mousedown",this._showDatePopUp),this.element.unbind("mousedown",e.proxy(this._showDatePopUp,this))):this._isInputBox()&&this._renderDateIcon(this.model.showPopupButton,!1)},_disbleMaualInput:function(){this.model.readOnly?(e(this.element).attr("readonly","readonly"),this.model.displayInline||this.hide()):this.model.allowEdit&&e(this.element).removeAttr("readonly")},_checkDateObject:function(e){if(!e||"object"==typeof JSON&&"{}"===JSON.stringify(e))return null;if(!(e instanceof Date)){var t=this._parseDate(e);e=null!=t?t:this._checkJSONString(e)?new Date(e):t}return isNaN(Date.parse(e))?null:this._dateValue=this._calendarDate=this._zeroTime(e)},_checkJSONString:function(e){var t=!1;return isNaN(Date.parse(e))||(new Date(e).toJSON()===e||new Date(e).toDateString()===e||new Date(e).toGMTString()===e||new Date(e).toISOString()===e||new Date(e).toLocaleString()===e||new Date(e).toString()===e||new Date(e).toUTCString()===e)&&(t=!0),t},_checkInstanceType:function(e){return(e=this._stringToObject(e))?(e instanceof Date||(e=this._parseDate(e)),isNaN(Date.parse(e))?null:this._zeroTime(e)):null},_stringToObject:function(e){if("string"==typeof e){var i=t.parseDate(e,this.model.dateFormat);e=null!=i?i:new Date(e)}return e},_validateMinMaxDate:function(){var e=!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,e=!0):(this.element.val(""),this._calendarDatethis.model.maxDate&&(this._calendarDate=this.model.maxDate)),this.isValidState=!0),e&&this.element.val(this._formatter(this.model.value,this.model.dateFormat)),t&&this._getInternalEvents&&this._trigger("outOfRange")},_setCulture:function(e){this.culture=t.preferredCulture(e),this.culture&&(this.model.locale="en"==this.culture.name?"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(null!=this.element&&this.element.hasClass("e-input"))return this._localizedLabels.watermarkText&&""==this.element.val()&&(this.isValidState=!0,this._checkErrorClass()),this._isSupport||""!=this.element.val()?e(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,s,a=this.element.is("input")?this.wrapper:this.element,n=this._getOffset(a),o=e(document).scrollTop()+e(window).height()-(n.top+e(a).outerHeight()),r=n.top-e(document).scrollTop(),l=this.sfCalendar.outerHeight(),d=this.sfCalendar.outerWidth(),h=n.left,c=a.outerHeight(),u=((c-a.height())/2,this._getZindexPartial()),m=3,p=lr?n.top+c+m:n.top-l-m;i=e(document).scrollLeft()+e(window).width()-h,s=e(document).scrollLeft()+h+a.width(),(this.model.enableRTL||d>i&&ds&&(h=n.left),this.sfCalendar.css({left:h+"px",top:p+"px","z-index":u})}},_getOffset:function(e){return t.util.getOffset(e)},_getZindexPartial:function(){return t.util.getZindexPartial(this.element,this.sfCalendar)},_setMinDate:function(e){this.model.minDate=this._checkInstanceType(e),this.model.minDate||(this.model.minDate=new Date("11/31/1899"))},_setMaxDate:function(e){this.model.maxDate=this._checkInstanceType(e),this.model.maxDate||(this.model.maxDate=new Date("12/31/2099"))},_setDateValue:function(e){var i=this._checkDateObject(e);null!=i?(this.isValidState=!0,this.model.value=new Date(i.toString()),this._validateMinMaxDate(),this._preTxtValue=this.element.val(this._formatter(this.model.value,this.model.dateFormat))):(this.model.enableStrictMode?this.element.val(e):this.element.val(null),this.model.value=null,this.isValidState=!(""!=this.element.val()&&!t.isNullOrUndefined(this.element.val()))),this._removeWatermark()},_updateInputVal:function(){var e=this._validateValue();null!=e&&this.sfCalendar.find(".e-datepicker-days").is(":visible")&&this._refreshDatepicker()},_validateInputVal:function(){var e=this._validateValue();null!=e&&(this.model.enableStrictMode||(e<=this.model.maxDate&&e>=this.model.minDate?this.isValidState=!0:(this.model.value="",this.isValidState=!0)))},_validateValue:function(){var e=this._parseDate(this.element.val());return this._validateYearValue(e)},_getSeparator:function(){var e,t;for(formats=this.culture?this.culture.calendar.patterns.d:this.model.dateFormat,e=new RegExp("^[a-zA-Z0-9]+$"),t=0;t=7&&t<8)return!0}return!1},_isValidDate:function(e){return e&&"function"==typeof e.getTime&&isFinite(e.getTime())},_formatter:function(e,i){var s=this._checkFormat(i);return t.format(e,s,this.model.locale)},_parseDate:function(e){var i=this._checkFormat(this.model.dateFormat);return t.parseDate(e,i,this.model.locale)},_checkFormat:function(e){var i=this,s=this._regExp();return e.replace(s,function(e){return"/"===e&&"/"!==t.preferredCulture(i.model.locale).calendars.standard["/"]?"'/'":e})},_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(e){return e%4==0&&e%100!=0||e%400==0},_zeroTime:function(e){var t="string"==typeof e?this._parseDate(e):new Date(e);return t.setMilliseconds(0),t.setSeconds(0),t.setMinutes(0),t.setHours(0),t},_formatDate:function(e){return this._formatter(e,this.Date.format)},_getDaysInMonth:function(e){return[31,this.isLeapYear(e)?29:28,31,30,31,30,31,31,30,31,30,31][e.getMonth()]},_addDays:function(e,t){return e.setDate(e.getDate()+t),e},_addYears:function(e,t){return e.setFullYear(e.getFullYear()+t),e},_addMonths:function(e,t){var i=e.getDate();return e.setMonth(e.getMonth()+t),i>e.getDate()&&this._addDays(e,-e.getDate()),e},_isWeekend:function(e){return 0==e.getDay()||6==e.getDay()},_isSpecialDates:function(e){if(this.model.specialDates)for(var t=0;tn.getTime()&&(o=n),r=this.displayedMonth,l=this.displayedYear,this.displayedMonth=o.getMonth(),this.displayedYear=o.getFullYear(),d=o,i&&(this.displayedMonth!=r||this.displayedYear!=l)&&(this._renderCalendar(this,d),this._dateValue=d,this._trigger("monthChanged",[this.displayedMonth,this.displayedYear])))},_clearSelected:function(){this.numSelected=0,"week"==this.model.highlightSection?e("td.e-active",this.sfCalendar).removeClass("e-active").attr("aria-selected",!1).parent().removeClass("e-selected-week"):"month"==this.model.highlightSection?e("td.e-active",this.sfCalendar).removeClass("e-active").attr("aria-selected",!1).parent().parent().removeClass("e-selected-month"):"workdays"==this.model.highlightSection?e("td.e-active",this.sfCalendar).removeClass("e-active").attr("aria-selected",!1).parent().removeClass("e-work-week"):e("td.e-active",this.sfCalendar).removeClass("e-active").attr("aria-selected",!1)},_addSelected:function(){"week"==this.model.highlightSection?e("td.e-active",this.sfCalendar).parent().addClass("e-selected-week"):"month"==this.model.highlightSection?e("td.e-active, this.sfCalendar").parent().parent().addClass("e-selected-month"):"workdays"==this.model.highlightSection&&e("td.e-active",this.sfCalendar).parent().addClass("e-work-week")},_hideOtherMonths:function(t){e("td.other-month",t).css("visibility","hidden")},_showOtherMonths:function(t){e("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-left-arrow").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-right-arrow").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),e(".e-footer-text",this.sfCalendar).html(this._localizedLabels.buttonText),this._enableFooter(this.model.showFooter)},_enableHeader:function(t){t?e(".e-header",this.sfCalendar).show():e(".e-header",this.sfCalendar).hide()},_enableFooter:function(t){t?e(".e-footer",this.sfCalendar).show():e(".e-footer",this.sfCalendar).hide()},_checkArrows:function(e,t){this._preArrowCondition(e,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(e,t){e<=t?this.sfCalendar.find(".e-left-arrow").addClass("e-disable").attr({"aria-disabled":!0}):this.sfCalendar.find(".e-left-arrow").removeClass("e-disable").attr({"aria-disabled":!1})},_nextArrowCondition:function(e,t){e>=t?this.sfCalendar.find(".e-right-arrow").addClass("e-disable").attr({"aria-disabled":!0}):this.sfCalendar.find(".e-right-arrow").removeClass("e-disable").attr({"aria-disabled":!1})},_previousNextHandler:function(t){if(this.model.readOnly||!this.model.enabled)return!1;t.preventDefault();var i=e(e(t.target).is("a")?t.target.parentNode:t.target),s=!!i.hasClass("e-prev");this._processNextPrevDate(s)},_processNextPrevDate:function(t){var i,s,a,n,o,r,l,d,h;if(t&&this.sfCalendar.find(".e-left-arrow").hasClass("e-disable")||!t&&this.sfCalendar.find(".e-right-arrow").hasClass("e-disable"))return!1;switch(i=e("table",this.sfCalendar),a=i.get(0).className){case"e-dp-viewdays":if(n=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?-n:n),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),e(".e-datepicker-headertext",this.sfCalendar).text(this._formatter(this._dateValue,this.model.headerFormat)),this._addFocus("day",this._hoverDate),o=this._findFirstLastDay(new Date(this._dateValue.toString())),this._preArrowCondition(o.firstDay,this.model.minDate),this._nextArrowCondition(o.lastDay,this.model.maxDate);break;case"e-dp-viewmonths":if(r=this._dateValue,r.setFullYear(e(".e-datepicker-headertext",this.sfCalendar).text()),t){if(r.getFullYear()<=this.model.minDate.getFullYear())return this._flag=!1,!1}else if(r.getFullYear()>=this.model.maxDate.getFullYear())return this._flag=!1,!1;this._flag=!0,this._addYears(r,t?-1:1),this._renderCalendar(this,r),s=r.getFullYear(),e(".e-datepicker-headertext",this.sfCalendar).text(s),e("tbody,tr.e-week-header",i).not(".e-datepicker-months").hide(),e(e(i).find(".e-datepicker-months")).show(),this._addFocus("month",this._hoverMonth),this._checkArrows(s,s);break;case"e-dp-viewyears":if(l=this._dateValue,l.setFullYear(e(i).find(".e-state-hover").text()),t){if(parseInt(e("td.e-year-first:first").text())<=this.model.minDate.getFullYear())return this._flag=!1,!1}else if(parseInt(e("td.e-year-last:first").prev().text())>=this.model.maxDate.getFullYear())return this._flag=!1,!1;this._flag=!0,e(i).find(".e-state-hover").hasClass("e-year-first")&&t||e(i).find(".e-state-hover").hasClass("e-year-last")&&!t?this._dateValue.setFullYear(l.getFullYear()):e(i).find(".e-state-hover").hasClass("e-year-first")&&!t?this._dateValue.setFullYear(l.getFullYear()+11):e(i).find(".e-state-hover").hasClass("e-year-last")&&t?this._dateValue.setFullYear(l.getFullYear()-11):this._dateValue.setFullYear(l.getFullYear()+(t?-10:10)),this._renderCalendar(this,this._dateValue),h=parseInt(this._dateValue.getFullYear())-(parseInt(this._dateValue.getFullYear())%10+1),e(".e-datepicker-headertext",this.sfCalendar).text(h+1+" - "+(h+10)),e("tbody,tr.e-week-header",i).not(".e-datepicker-years").hide(),e(e(i).find(".e-datepicker-years")).show(),this._addFocus("year",this._hoverYear),this._checkArrows(h+1,h+10);break;case"e-dp-viewallyears":if(t){if(d=parseFloat(e("td.e-allyear-first",i.get(0)).text().split("-")[1]),d<=this.model.minDate.getFullYear())return this._flag=!1,!1;this._flag=!0}else{if(d=parseFloat(e("td.e-allyear-last",i.get(0)).prev().text().split("-")[1]),d>=this.model.maxDate.getFullYear())return this._flag=!1,!1;this._flag=!0}this._dateValue.setFullYear(d+(t?-10:10)),this._renderCalendar(this,this._dateValue),h=parseInt(this._dateValue.getFullYear())-(parseInt(this._dateValue.getFullYear())%100+1),s=parseFloat(e("td.e-allyear-last",i.get(0)).prev().text().split("-")[1]),e(".e-datepicker-headertext",this.sfCalendar).text(h+1+" - "+s),e("tbody,tr.e-week-header",i).not(".e-datepicker-allyears").hide(),e(e(i).find(".e-datepicker-allyears")).show(),this._addFocus("allyear",this._hoverAllYear),this._checkArrows(h+1,s)}this._layoutChanged()},_addFocus:function(t,i){var s,a,n="e-current-"+t;return"day"==t&&(n="current-month"),s=this.sfCalendar.find("tbody tr td."+n),"month"==t&&e(s).each(function(t,s){if(parseInt(e(s).attr("index"))==parseInt(i))return void(i=t)}),a=s[i],a||(a=s.last()),this.sfCalendar.find("table td").removeClass("e-state-hover"),e(a).addClass("e-state-hover"),this._setActiveState(t),i},_setActiveState:function(t){var i,s,a;if(this.model.value instanceof Date){var n,o=this.sfCalendar.find("tbody tr td.e-current-"+t),r=this,l=-1;switch(t){case"month":this.model.value.getFullYear()===parseInt(e(".e-text",this.sfCalendar).text())&&e(o).each(function(t,i){if(parseInt(e(i).attr("index"))==parseInt(r.model.value.getMonth()))return void(l=t)});break;case"year":i=this.model.value.getFullYear(),e(o).each(function(e,t){if(parseInt(t.innerHTML)==parseInt(i))return void(l=e)});break;case"allyear":s=parseInt(this.model.value.getFullYear())-(parseInt(this.model.value.getFullYear())%10+1),a=s+1+" - "+(s+10),e(o).each(function(e,t){if(parseInt(t.innerHTML)==parseInt(a))return void(l=e)})}n=o[l],n&&(this.sfCalendar.find("table td").removeClass("e-active"),e(n).addClass("e-active"))}},_setFocusByName:function(t,i){var s,a,n=this.sfCalendar.find("tbody tr td.e-current-"+t);return e(n).each(function(e,t){if(parseInt(t.innerHTML)==parseInt(i))return void(s=e)}),a=n[s],a||(a=n.last()),this.sfCalendar.find("table td").removeClass("e-state-hover"),e(a).addClass("e-state-hover"),this._setActiveState(t),s},_getHeaderTxt:function(){return this.sfCalendar.find(".e-datepicker-headertext").text()},_findFirstLastDay:function(e){y=e.getFullYear(),m=e.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 i,s=e("table",this.sfCalendar),a=e("table",this.sfCalendar).get(0).className;switch(a){case"e-dp-viewdays":this._hoverMonth=this._getDateObj(s.find(".e-state-hover")).getMonth()||this._getDateObj(s.find(".e-active")).getMonth()||0,this._startLevel("year"),this._addFocus("month",this._hoverMonth);break;case"e-dp-viewmonths":i=this._getHeaderTxt(),this._startLevel("decade"),this._hoverYear=this._setFocusByName("year",i);break;case"e-dp-viewyears":i=this._getHeaderTxt(),this._startLevel("century"),this._hoverAllYear=this._setFocusByName("allyear",i)}this._layoutChanged()},_cellSelection:function(){var t,i,s=(e("table",this.sfCalendar),e("table",this.sfCalendar).get(0).className);switch(s){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 i,s,a=this.sfCalendar.find("tbody tr td.e-current-"+t),n=this._dateValue.getFullYear();e(a).each(function(e,t){if(parseInt(t.innerHTML)==parseInt(n))return void(i=e)}),s=a[i],s&&(e(s).hasClass("e-"+t+"-last")?this._processNextPrevDate(!1):e(s).hasClass("e-"+t+"-first")&&this._processNextPrevDate(!0))},_backwardNavHandler:function(i){var s,a;if(this._animating=!0,this.model.readOnly||!this.model.enabled)return!1;i.type?(i.preventDefault(), s=e(i.currentTarget)):s=i;var n,o=e("table",this.sfCalendar),r=e("table",this.sfCalendar).get(0).className,l=this;switch(r){case"e-dp-viewmonths":o.removeClass("e-dp-viewmonths").addClass("e-dp-viewdays"),this._dateValue=new Date(this._dateValue.getFullYear(),parseInt(e(s).attr("index")),1),this._renderCalendar(this,this._dateValue),e("tbody",o).not(".e-datepicker-days,.e-week-header").hide(),e(e(o).find(".e-datepicker-days,.e-week-header")).fadeIn("fast",function(){l._addFocus("day",l._hoverDate||0),l._animating=!1}),e(".e-datepicker-headertext",this.sfCalendar).text(this._formatter(this._dateValue,this.model.headerFormat));break;case"e-dp-viewyears":o.removeClass("e-dp-viewyears").addClass("e-dp-viewmonths"),this._dateValue.setFullYear(parseInt(s.text())),this._renderCalendar(this,this._dateValue),e("tbody,tr.e-week-header",o).not(".e-datepicker-months").hide(),t.isNullOrUndefined(this._hoverMonth)&&!t.isNullOrUndefined(this._dateValue)&&(this._hoverMonth=this._dateValue.getMonth()),e(e(o).find(".e-datepicker-months")).fadeIn("fast",function(){l._addFocus("month",l._hoverMonth||0),l._animating=!1}),n=s.text(),e(".e-datepicker-headertext",this.sfCalendar).text(n),this._checkArrows(n,n);break;case"e-dp-viewallyears":a=s.text().split("-"),o.removeClass("e-dp-viewallyears").addClass("e-dp-viewyears"),a[0]this.model.maxDate.getFullYear()&&(a[0]=this.model.maxDate.getFullYear().toString()),this._renderCalendar(this,new Date(a[0],0,1)),e("tbody,tr.e-week-header",o).not(".e-datepicker-years").hide(),e(e(o).find(".e-datepicker-years")).fadeIn("fast",function(){l._addFocus("year",l._hoverYear||0),l._animating=!1}),e(".e-datepicker-headertext",this.sfCalendar).text(a[0]+" - "+a[1]),this._checkArrows(a[0],a[1]);break;default:this._clearSelected(),this.sfCalendar.find("table td").removeClass("e-state-hover"),s.not("td.other-month").addClass("e-active").attr("aria-selected",!0),this._addSelected(),this._hoverDate=this._getDateObj(s).getDate()-1,this._dateValue=new Date(s.attr("date")),this._clickedDate=new Date(s.attr("date")),this._animating=!1}this._layoutChanged()},_startLevel:function(t){var i,s,a,n,o=e("table",this.sfCalendar),r=e(".e-datepicker-headertext",this.sfCalendar),l=this._dateValue;switch(t){case"decade":o.removeClass("e-dp-viewallyears e-dp-viewmonths e-dp-viewdays").addClass("e-dp-viewyears"),e("tbody,tr.e-week-header",o).not(".e-datepicker-years").hide(),e(e(o).find(".e-datepicker-years")).show(),l=this.model.enableStrictMode&&this._calendarDatethis.model.maxDate.getFullYear()?(o.addClass("e-hidedate"),o.removeClass("e-current-month")):(s.getFullYear()<=this.model.minDate.getFullYear()&&d=this.model.maxDate.getFullYear()&&d>this.model.maxDate.getMonth()+1)&&(o.addClass("e-hidedate"),o.removeClass("e-current-month")),a.append(o);t.append(a)}i.append(t),r=s.getFullYear(),this._checkArrows(r,r)},_datepickerYears:function(t,i,s){for(var a,n,o,r,l=function(e){return document.createElement(e)},d=parseInt(s)-(parseInt(s)%10+1),h=[],c=0;c<12;c++)h.push(d+c);for(a=0,n=0;n<3;n++){for(o=e(l("tr")),c=0;c<4;c++)r=e(l("td")),r.attr(this._isIE8?{unselectable:"on"}:{}),0==a?r.addClass("e-year-first e-current-year "):11==a?r.addClass("e-year-last e-current-year "):r.addClass("e-current-year e-state-default"),(h[a]this.model.maxDate.getFullYear())&&(r.addClass("e-hidedate"),r.removeClass("e-current-year")),r.html(h[a++]),o.append(r);t.append(o)}i.append(t),this._checkArrows(h[0],h[h.length])},_datepickerAllYears:function(t,i,s){for(var a,n,o,r,l=parseInt(s)-(parseInt(s)%100+10),d=[],h=this._isIE8||this._isIE9?"":"\n",c=0;c<12;c++)d.push(parseInt(l)+" -"+h+parseInt(l+9)),l+=10;for(a=0,n=0;n<3;n++){for(o=e(document.createElement("tr")),c=0;c<4;c++)r=e(document.createElement("td")),r.attr(this._isIE8?{unselectable:"on"}:{}),0==a?r.addClass("e-allyear-first e-current-allyear "):11==a?r.addClass("e-allyear-last e-current-allyear "):r.addClass("e-current-allyear e-state-default"),(parseInt(d[a].split("-\n")[1])this.model.maxDate.getFullYear())&&(r.addClass("e-hidedate"),r.removeClass("e-current-allyear")),r.html(d[a++]),o.append(r);t.append(o)}i.append(t)},_renderHeader:function(i){var s,a,n,o,r,l,d=e(document.createElement("thead")),h=t.preferredCulture(this.model.locale).calendars.standard.days;if("none"!=i.model.dayHeaderFormat)for(s=t.buildTag("tr.e-week-header").attr({role:"columnheader"}).attr(this._isIE8?{unselectable:"on"}:{}),a=this.Date.firstDayOfWeek;a1&&(b-=7),l=Math.ceil((-1*b+1+this._getDaysInMonth(f))/7),this._addDays(f,b-1),d=p._zeroTime(new Date),h=this._calendarDate,r=t.buildTag("tbody.e-datepicker-months","",{display:"none"}).attr(this._isIE8?{unselectable:"on"}:{}),this._datepickerMonths(r,o,n),r=t.buildTag("tbody.e-datepicker-days","",{display:"none"}).attr(this._isIE8?{unselectable:"on"}:{});for(var v=0,x=!0,w=!0;v++"+f.getDate():f.getDate()+"").attr({date:f.toDateString(),title:this.model.showTooltip?C&&this.model.specialDates[S][this._mapField._tooltip]?this.model.specialDates[S][this._mapField._tooltip]:this._formatter(f,this.model.tooltipFormat):"","aria-selected":!1,role:"gridcell"}).attr(this._isIE8?{unselectable:"on"}:{}).addClass((y?"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 ")+(y&&f.getTime()==d.getTime()?"today ":""));T.find("span:first-of-type").addClass(C?this.model.specialDates[S][this._mapField._icon]?"e-special-date-icon "+this.model.specialDates[S][this._mapField._icon]+" ":"e-special-day":""),T.addClass(C&&this.model.specialDates[S][this._mapField._custom]?this.model.specialDates[S][this._mapField._custom]:""),h.getTime()==f.getTime()&&y&&(T.addClass("e-active").attr({"aria-selected":!0}),"week"==this.model.highlightSection&&c.addClass("e-selected-week"),"month"==this.model.highlightSection&&r.addClass("e-selected-month"),"workdays"==this.model.highlightSection&&c.addClass("e-work-week"),this._hoverDate||(T.addClass("e-state-hover"),this._hoverDate=f.getDate()-1)),m=!0,(fthis.model.maxDate)&&(T.addClass("e-hidedate"),T.removeClass("current-month"),this.model.showOtherMonths&&T.removeClass("other-month"),m=w=!1),y&&(m&&x&&(this._tempMinDate=f,x=!1,w=!0),w&&(this._tempMaxDate=f)),this._trigger("beforeDateCreate",{date:f,element:T}),c.append(T),f=new Date(f.getFullYear(),f.getMonth(),f.getDate()+1,0,0,0)}r.append(c)}o.append(r),this._isIE8||this._isIE7?e(r).css("display","block"):e(r).fadeIn("fast"),this.model.startLevel===this.model.depthLevel?this._depthLevel(this.model.depthLevel):"month"!=this.model.depthLevel&&""!=this.model.depthLevel?"century"==this.model.startLevel?this._depthLevel(this.model.depthLevel):"decade"==this.model.startLevel&&"century"!=this.model.depthLevel?this._depthLevel(this.model.depthLevel):"year"==this.model.startLevel&&"decade"!=this.model.depthLevel&&"century"!=this.model.depthLevel?this._depthLevel(this.model.depthLevel):(this._on(o.find(".current-month,.other-month,.e-current-month,.e-current-year,.e-current-allyear"),"click",e.proxy(this._backwardNavHandler,this)),this._on(o.find(".current-month , .other-month"),"click",e.proxy(this._onSetCancelDateHandler,this))):(this._on(o.find(".current-month,.other-month,.e-current-month,.e-current-year,.e-current-allyear"),"click",e.proxy(this._backwardNavHandler,this)),this._on(o.find(".current-month , .other-month"),"click",e.proxy(this._onSetCancelDateHandler,this))),this._otherMonthsVisibility(),this._checkDateArrows()},_keyboardNavigation:function(e){var t;if(this._animating)return!1;if(!this._isOpen||37!=e.keyCode&&38!=e.keyCode&&39!=e.keyCode&&40!=e.keyCode&&13!=e.keyCode&&36!=e.keyCode&&35!=e.keyCode)if(this.model.displayInline||27!=e.keyCode&&9!=e.keyCode){if(e.altKey&&40==e.keyCode)return this.show(),!1}else this.hide();else{e.preventDefault&&e.preventDefault(),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 i,s=this.sfCalendar.find("table")[0].className,a=3,n=4;switch(s){case"e-dp-viewallyears":i=this._changeRowCol(t,e.keyCode,a,n,"yearall",e.ctrlKey),e.ctrlKey||(this._hoverAllYear=this.sfCalendar.find("tbody.e-datepicker-allyears tr td").index(i));break;case"e-dp-viewyears":i=this._changeRowCol(t,e.keyCode,a,n,"year",e.ctrlKey),e.ctrlKey||(this._hoverYear=this.sfCalendar.find("tbody.e-datepicker-years tr td").index(i));break;case"e-dp-viewmonths":i=this._changeRowCol(t,e.keyCode,a,n,"month",e.ctrlKey),e.ctrlKey||(this._hoverMonth=this.sfCalendar.find("tbody.e-datepicker-months tr td").index(i));break;case"e-dp-viewdays":a=this.sfCalendar.find("tbody.e-datepicker-days tr").length,n=7,i=this._changeRowCol(t,e.keyCode,a,n,"day",e.ctrlKey),e.ctrlKey||(this._hoverDate=this._getDateObj(i).getDate()-1)}e.ctrlKey||(this.sfCalendar.find("table td").removeClass("e-state-hover"),i.addClass("e-state-hover"))}},_changeRowCol:function(t,i,s,a,n,o){var r,l,d,h,c,u,m={parent:null,child:null};switch(n){case"day":r="tbody.e-datepicker-days tr td.current-month",m.parent=".e-datepicker-days",m.child=".current-month";break;case"month":r="tbody.e-datepicker-months tr td.e-current-month",m.parent=".e-datepicker-months",m.child=".e-current-month";break;case"year":r="tbody.e-datepicker-years tr td.e-current-year",m.parent=".e-datepicker-years",m.child=".e-current-year";break;case"yearall":r="tbody.e-datepicker-allyears tr td.e-current-allyear",m.parent=".e-datepicker-allyears",m.child=".e-current-allyear"}if(t.row<=0&&t.col<=0)return this.sfCalendar.find(r+":first");switch(d=this,i){case 36:return this.sfCalendar.find(r+":first");case 35:return this.sfCalendar.find(r+":last");case 38:if(o&&this.model.allowDrillDown)this._forwardNavHandler();else{if(!(t.row>1))return this._processNextPrevDate(!0),this.sfCalendar.find(r+":nth-child("+t.col+"):last");t.row-=1}if(l=this._getCell(t,m),l.length<=0){if(l=this._findVisible(t,m,"up"),null!==l)return l;this._processNextPrevDate(!0),l=this.sfCalendar.find(r+":nth-child("+t.col+"):last")}return l;case 37:if(o)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))return this._processNextPrevDate(!0),this.sfCalendar.find(r+":last");t={row:t.row-1,col:a}}if(l=this._getCell(t,m),l.length<=0){if(l=this._findVisible(t,m,"left"),null!==l)return l;this._processNextPrevDate(!0),l=this.sfCalendar.find(r+":last")}return l;case 39:if(o)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("+n+") td:nth-child("+a+")"),nextElement.length<=0)return null;if(nextElement.hasClass("e-hidedate")||!nextElement.is(":visible")){if("right"==s||"left"==s?"right"==s?a++:a--:"down"==s?n++:n--,n<=0||n>this.sfCalendar.find("tbody"+t.parent+" tr").length||(a>this.sfCalendar.find("tbody"+t.parent+" tr:nth-child("+n+") td").length&&(n++,a=1),a<=0&&(n--,a=this.sfCalendar.find("tbody"+t.parent+" tr:nth-child("+n+") td").length),n<=0||n>this.sfCalendar.find("tbody"+t.parent+" tr").length))return null}else{if(nextElement.hasClass("other-month"))return null;if(nextElement.hasClass(o))return e.col=a,e.row=n,nextElement}}},_getCell:function(e,t){return this.sfCalendar.find("tbody"+t.parent+" tr:nth-child("+e.row+") td"+t.child+":nth-child("+e.col+")")},_getDateObj:function(e){return new Date(e.attr("date"))},_touchCalendar:function(e){var t=this.sfCalendar.find("table")[0].className;switch(e.type){case"pinchin":"e-dp-viewdays"!=t&&this._keyboardNavigation({keyCode:13});break;case"pinchout":"e-dp-viewallyears"!=t&&this.model.allowDrillDown&&this._forwardNavHandler();break;case"swipeleft":this._processNextPrevDate(!1);break;case"swiperight":this._processNextPrevDate(!0)}},show:function(i){var s,a;if(this._isOpen)return!1;if(s=this,this._popupOpen=!0,a=null!=this._preValue?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"}),s._isOpen=!0,this.sfCalendar.slideDown(this.model.enableAnimation?this.animation.open.duration:0,this.animation.open.type,function(){s.model.displayInline||e(document).bind("mousedown",e.proxy(s._onDocumentClick,s))}),""!==this.element.val()&&this._updateInputVal(),this._refreshLevel(a),this._trigger("open",{prevDate:this._prevDate,value:this._formatter(this.model.value,this.model.dateFormat)}),e(window).bind("resize",e.proxy(this._OnWindowResize,this)),this.model.displayInline||this._on(t.getScrollableParents(this.wrapper),"scroll",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 s=this;this._popupOpen=!1,this.sfCalendar.attr({"aria-hidden":"true"}),this.sfCalendar.slideUp(this.model.enableAnimation?this.animation.close.duration:0,this.animation.close.type,function(){s._isOpen=!1,e(document).unbind("mousedown",e.proxy(s._onDocumentClick,s)),s._setWaterMark()}),""!=this.element.val()&&this._validateInputVal(),this._trigger("close",{prevDate:this._prevDate,value:this._formatter(this.model.value,this.model.dateFormat)}),e(window).unbind("resize",e.proxy(this._OnWindowResize,this)),this._off(t.getScrollableParents(this.wrapper),"scroll",this.hide),this._isInputBox()&&this.wrapper.removeClass("e-active")},enable:function(){this.model.enabled=!0,this.element.removeClass("e-disable").attr({"aria-disabled":!1}),this.element.removeAttr("disabled"),this.dateIcon&&this.dateIcon.removeClass("e-disable").attr({"aria-disabled":!1}),this._isIE8&&this.dateIcon&&this.dateIcon.children().removeClass("e-disable"),this.element.removeAttr("disabled"),this._isSupport||this._hiddenInput.removeAttr("disabled"),this.sfCalendar.removeClass("e-disable").attr({"aria-disabled":!1})},disable:function(){this.model.enabled=!1,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.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)},_wireEvents:function(){this._allowQuickPick(this.model.allowDrillDown),this._on(e(".e-next",this.sfCalendar),"click",e.proxy(this._previousNextHandler,this)),this._on(e(".e-prev",this.sfCalendar),"click",e.proxy(this._previousNextHandler,this)),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.bind("mousedown",e.proxy(this._showDatePopUp,this))),this.model.showFooter&&this._on(e(".e-footer",this.sfCalendar),"click",this._setCurrDate),this._on(this.sfCalendar,"pinchin pinchout swipeleft swiperight",e.proxy(this._touchCalendar,this))},_bindDateButton:function(){this._on(this.dateIcon,"mousedown",this._showDatePopUp),this.model.allowEdit&&this.element.unbind("mousedown",e.proxy(this._showDatePopUp,this))},_bindInputEvent:function(){this._off(this.dateIcon,"mousedown",this._showDatePopUp)},_onFocusOut:function(t){var i,s,a;this._isFocused=!1,i=null!=this._preValue?new Date(this._preValue.toString()):this._preValue,this._validateOnFocusOut(this._validateValue(),t),this.wrapper.removeClass("e-focus"),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(i),""!=this.element.val()&&(!this._isOpen||this.model.displayInline)&&this._validateInputVal(),this.element.unbind("keydown",e.proxy(this._keyboardNavigation,this)),this.model.showPopupButton||this._off(this.element,"click",this._elementClick),s=this.element.val(),a={prevDate:this._prevDate,value:s},this._setDateValue(s),this._trigger("focusOut",a),this._checkErrorClass()},_onFocusIn:function(t){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.model.readOnly||(this._isSupport||this._hiddenInput.css("display","none"),this.element.bind("keydown",e.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",{value:this.model.value}))},_elementClick:function(e){this._popupOpen||this.show(e)},_removeWatermark:function(){""==this.element.val()||this._isSupport||this._hiddenInput.css("display","none")},_refreshPopup:function(){this._refreshDatepicker(),this._startLevel(this.model.startLevel)},_refreshLevel:function(e){if(this.model.startLevel==this.model.depthLevel&&"month"!=this.model.startLevel){var t=this._stringToObject(this.element.val());t=this._validateYearValue(t),t&&(this._compareDate(e,t)||this._refreshPopup())}},_validateOnFocusOut:function(e,i){var s=this._formatter(this._calendarDate,this.model.dateFormat),a=(this._formatter(this._parseDate(this._formatter(new Date,"MM/dd/yyyy")),this.model.dateFormat),!1),n=!1;null==e||this.model.enableStrictMode?null!=e||this.model.enableStrictMode?e?(ethis.model.maxDate?(this.isValidState=!1,n=!0,this._calendarDate=ethis.model.maxDate&&(this._calendarDate=this.model.maxDate)):(null==this._preTxtValue||""==this.element.val()?(this.element.val(""),this._isSupport||this._hiddenInput.css("display","block")):this.element.val(s),this._triggerChangeEvent(i)):(t.isNullOrUndefined(this.model.value)&&(this.model.value=this._parseDate(this.element.val())),this.model.maxDatethis.model.maxDate)&&(a=!0,this._calendarDate=e=ethis.model.maxDate&&(this._calendarDate=this.model.maxDate)),this.isValidState=!0),a&&this.element.val(this._formatter(e,this.model.dateFormat)),this._compareDate(this._preValue,this._parseDate(this.element.val(),this.model.dateFormat))||this._triggerChangeEvent(i))},_onKeyDown:function(e){if(13===e.keyCode){var t=null!=this._preValue?new Date(this._preValue.toString()):this._preValue;this._validateOnFocusOut(this._validateValue(),e),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(e){return!!this.model.enabled&&void(this._isOpen?(!this._isFocused&&this.element.is(":input")&&this.element.focus(),this._cancelValue||this.hide(e)):(!this._isFocused&&this.element.is(":input")&&this.element.focus(),this.show(e)))},_compareDate:function(e,t){return+e==+t},_triggerChangeEvent:function(e){var t,i,s=""==this.element.val()?null:this.element.val();this._prevDate=this._formatter(this._preValue,this.model.dateFormat),t={prevDate:this._prevDate,value:s,isInteraction:!!e},i=this._parseDate(s,this.model.dateFormat),i=this._validateYearValue(i),this._compareDate(this._preValue,i)||(this._preValue=this.model.value=i,this.model.displayInline&&!this._isInputBox()&&this._hiddenInput.attr("value",s),this._trigger("change",t),this._trigger("_change",t),this._checkErrorClass())},_triggerSelectEvent:function(){var e,t=this.element.val();this._parseDate(t)&&(e={prevDate:this._prevDate,value:t,isSpecialDay:this._isSpecialDates(this.model.value)},this._prevDate!=t&&this._parseDate(e.value)&&this.model.value>=this.model.minDate&&this.model.value<=this.model.maxDate&&(this._cancelValue=this._trigger("select",e)),this._dt_drilldown&&this._trigger("dt_drilldown",e))},_onDocumentClick:function(t){this.model&&(e(t.target).is(this.popup)||e(t.target).parents(".e-popup").is(this.popup)||e(t.target).is(this.wrapper)||e(t.target).parents(".e-datewidget").is(this.wrapper)?(e(t.target).is(this.popup)||e(t.target).parents(".e-popup").is(this.popup))&&t.preventDefault():this.hide(t))},_OnWindowResize:function(){this._setDatePickerPosition()},_showDatePopUp:function(e){var t=!1;if(e.button?t=2==e.button:e.which&&(t=3==e.which),!t&&(this._isSupport||this.model.showPopupButton||(e.preventDefault(),this._onFocusIn()),!this.model.readOnly)){if(e.preventDefault(),!this.model.enabled&&this.model.displayInline)return!1;this._showhidePopup(e)}},_layoutChanged:function(){this._getInternalEvents&&this._trigger("layoutChange")},_setCurrDate:function(e){if(this.model.readOnly||!this.model.enabled)return!1;e&&e.preventDefault();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(e),this._triggerChangeEvent(e),this._refreshDatepicker(),this._changeDayClass(),this._startLevel(this.model.startLevel),this._onSetCancelDateHandler(e),this._layoutChanged()},_changeDayClass:function(){var e=this.popup.children("table")[0].className;"e-dp-viewdays"!=e&&this.popup.children("table").removeClass(e).addClass("e-dp-viewdays")},_onSetCancelDateHandler:function(t){return!(this.model.readOnly||!this.model.enabled||t&&e(t.target).hasClass("e-disable"))&&(t&&t.type&&t.preventDefault(),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&&e(t.currentTarget).hasClass("other-month")&&this._refreshDatepicker(),void this._cellSelection())},_closeCalendar:function(e){e&&e!=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(e,t,i){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:00 AM",maxTime:"11:59:59 PM",showRoundedCorner:!1,enableRTL:!1,popupHeight:"191px",popupWidth:"auto",enabled:!0,enablePersistence:!1,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",htmlAttributes:"data"},observables:["value"],enable:function(){this.model.enabled||(this.element[0].disabled=!1,this.element.removeAttr("disabled"),this.model.enabled=!0,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.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()},_timeFormat:function(e){var t=this._validateTimeFormat(e);return t&&(this.model.timeFormat=t,this.model.value=this._localizeTime(this.getValue()),this.element.val(this.model.value)),t},_getTimeFormat:function(){this.model.timeFormat=t.preferredCulture(this.model.locale).calendar.patterns.t||"h:mm tt",this.seperator=this._getSeperator()},_changeSkin:function(e){this.wrapper.removeClass(this.model.cssClass).addClass(e),this.popupList&&this.popupList.removeClass(this.model.cssClass).addClass(e)},_localize:function(e){var t=this._createObject(this.element.val());this.model.locale=e,this._getTimeFormat(),this.model.value=this._localizeTime(t),this.element.val(this.model.value),this._getAmPm()},_init:function(e){return!(!this.element.is("input")||this.element.attr("type")&&"text"!=this.element.attr("type"))&&(this._initialize(),this._render(),this._wireEvents(),void(e&&e.value!=i&&e.value!=this.element.val()&&this._trigger("_change",{value:this.element.val()})))},_setModel:function(s){var a,n,o=!1,r=this.model.value;t.isNullOrUndefined(s.minTime)&&t.isNullOrUndefined(s.maxTime)||(!t.isNullOrUndefined(s.minTime)&&e.trim(s.minTime)&&this._isValid(s.minTime)&&(this.model.minTime=s.minTime,this._validateTimes()),!t.isNullOrUndefined(s.maxTime)&&e.trim(s.maxTime)&&this._isValid(s.maxTime)&&(this.model.maxTime=s.maxTime,this._validateTimes()),this._validateMinMax(),t.isNullOrUndefined(s.minTime)||(s.minTime=this.model.minTime),t.isNullOrUndefined(s.maxTime)||(s.maxTime=this.model.maxTime),this.model.showPopupButton&&this._reRenderDropdown(),s.value==i&&this._enableMask(),o=!0);for(a in s)switch(a){case"timeFormat":this._preTimeformat=this.model.timeFormat,this._setModelOption=!0,n=this._timeFormat(s[a]),s[a]=this.model.timeFormat,n&&(this.seperator=this._getSeperator(),this.model.showPopupButton&&this._reRenderDropdown());break;case"locale":this._localize(s[a]),this.model.showPopupButton&&this._reRenderDropdown();break;case"interval":this.model.interval=s[a],this.model.showPopupButton&&this._reRenderDropdown();break;case"showPopupButton":this._showButton(s[a]);break;case"cssClass":this._changeSkin(s[a]);break;case"showRoundedCorner":this._setRoundedCorner(s[a]);break;case"enableRTL":this._setRtl(s[a]);break;case"height":this._setHeight(s[a]);break;case"width":this.wrapper.width(s[a]),this._setListWidth();break;case"value":this.model.enableStrictMode?(this.model.value=s[a],this._enableMask()):this._isValid(s[a])&&(this.model.value=s[a],this._enableMask()),s[a]=this.model.value,o=!0;break;case"enableStrictMode":this.model.enableStrictMode=s[a];break;case"popupHeight":this.model.popupHeight=s[a],this._setListHeight();break;case"popupWidth":this.model.popupWidth=s[a],this._setListWidth();break;case"enabled":s[a]?this.enable():this.disable();break;case"htmlAttributes":this._addAttr(s[a])}o&&this._raiseChangeEvent(r,!0),this._checkErrorClass()},_destroy:function(){this.element.insertAfter(this.wrapper),this.wrapper.remove(),this.element.removeClass("e-input").removeAttr("ondragstart draggable").val(""),this.popupList&&this.popupList.remove()},_initialize:function(){this.target=this.element[0],this.timeIcon=null,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._getAmPm(),this.showDropdown=!1,this._activeItem=0,this.isValidState=!0,this._manualFocus=!1,this._isIE7=this._checkIE7(),t.isNullOrUndefined(this.model.value)&&""!=this.element[0].value&&(this.model.value=this.element[0].value),this._isIE8="msie"==t.browserInfo().name&&"8.0"==t.browserInfo().version,this._getInternalEvents=!1,this.model.timeFormat?this.seperator=this._getSeperator():this._getTimeFormat()},_render:function(){this._renderWrapper(),this._setDimentions(),this._renderTimeIcon(),this._validateTimes(),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})},_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.container=t.buildTag("span.e-in-wrap e-box").append(this.element),this.wrapper.append(this.container)},_addAttr:function(t){var i=this;e.map(t,function(e,t){"class"==t?i.wrapper.addClass(e):"name"==t?i.element.attr(t,e):"required"==t?i.element.attr(t,e):"disabled"==t&&"disabled"==e?i.disable():"readOnly"==t&&"readOnly"==e?i.model.readOnly=!0:i.wrapper.attr(t,e)})},_renderTimeIcon:function(){if(this.model.showPopupButton){this.timeIcon=t.buildTag("span.e-select").attr({role:"button","aria-label":"select"});var e=t.buildTag("span.e-icon e-time").attr("role","presentation");this._isIE8&&(this.timeIcon.attr("unselectable","on"),e.attr("unselectable","on")),this.timeIcon.append(e),this.container.append(this.timeIcon).addClass("e-padding"),this._on(this.timeIcon,"mousedown",this._timeIconClick)}},_renderDropdown:function(){var i,s=e("#"+this.element.context.id+"_popup").get(0);return s&&e(s).remove(),!(!this.model.showPopupButton||this.popupList)&&(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":""}),this.popup=this.popupList,this.ul=t.buildTag("ul.e-ul"),this._isIE8&&this.ul.attr("unselectable","on"),i=t.buildTag("div").append(this.ul),e("body").append(this.popupList.append(i)),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"),void(this._listSize=this.ul.find("li").size()))},_renderLiTags:function(){var i,s,a,n,o,r;if(this.model.interval<1)return!1;for(n=6e4*this.model.interval,i=this.model.minTime?this._createObject(this.model.minTime):this._createObject("12:00:00 AM"),s=this.model.maxTime?this._createObject(this.model.maxTime):this._createObject("11:59:59 PM");this._compareTime(s,i,!0);)a=this._localizeTime(i),o=t.buildTag("li",a),this._isIE8&&o.attr("unselectable","on"),this.ul.append(o),i=this._createObject(i).getTime()+n;r=this.ul.find("li"),this._on(r,"mouseenter",e.proxy(this._OnMouseEnter,this)),this._on(r,"mouseleave",e.proxy(this._OnMouseLeave,this)),this._on(r,"click",e.proxy(this._OnMouseClick,this))},_reRenderDropdown:function(){this.ul.empty(),this._renderLiTags(),this._refreshScroller(),this._changeActiveEle()},_refreshScroller:function(){var t="none"==this.popupList.css("display");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&&(e("#"+this.scrollerObj._id).children(".e-vscroll").children().attr("unselectable","on"),e("#"+this.scrollerObj._id).find(".e-vhandle").attr("unselectable","on")),t&&this.popupList.css("display","none")},_setListWidth:function(){if(this.popupList){var e=this.model.popupWidth;e&&"auto"!=e?this.popupList.css({width:e}):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(){"auto"==this.model.popupWidth&&this.popupList.css({width:this.wrapper.width()}),this._setListPosition(),this._refreshScroller()},_setListPosition:function(){var t,i=this.wrapper,s=this._getOffset(i),a=e(document).scrollTop()+e(window).height()-(s.top+e(i).outerHeight()),n=s.top-e(document).scrollTop(),o=this.popupList.outerHeight(),r=this.popupList.outerWidth(),l=s.left,d=i.outerHeight(),h=(d-i.height())/2,c=this._getZindexPartial(),u=3,m=(on?s.top+d+u:s.top-o-u)-h;t=e(document).scrollLeft()+e(window).width()-l,(this.model.enableRTL||r>t&&rh.length)return{start:s,end:a,isValid:l};if("tt"==e)(n[o.tt]==this.ttAM||n[o.tt]==this.ttPM)&&(s=0==o.tt?0:n[o.time].length+1,a=s+n[o.tt].length,l=!0);else if(s=0==o.time?0:n[o.tt].length+1,t=d.indexOf(e),t!=-1){for(i=0;i1&&(this._activeItem-=1),this._addListHover(),this._selectTimeItem(this._getActiveItem())):this._modifyValue(!0);break;case 40:e.preventDefault(),e.altKey&&this.model.showPopupButton?this._showhidePopup():this.showDropdown?(this._activeItem0?d=!0:!e.shiftKey&&t.end47&&e.keyCode<58?b=String.fromCharCode(f):e.keyCode>95&&e.keyCode<106&&(b=String.fromCharCode(f-48)),"tt"==s&&(!e.shiftKey&&!e.ctrlKey&&!e.altKey&&e.keyCode>64&&e.keyCode<91||e.keyCode>47&&e.keyCode<58||e.keyCode>95&&e.keyCode<106)&&(e.preventDefault(),v=this._getCategoryPosition(s),this.start=v.start,this.end=v.end,this._changeAmPm(_),this._raiseChangeEvent()),!e.shiftKey&&!e.ctrlKey&&!e.altKey&&e.keyCode>47&&e.keyCode<58||e.keyCode>95&&e.keyCode<106?"tt"!=s&&(this._getMinMax(s,!0),t.start==t.end?(this._findCategoryPosition(s),x=t.start==this.start?b+_:_+b,(x.length>2||!(Number(x)>=this.min&&this.max>=Number(x)))&&e.preventDefault()):Number(b)>=this.min&&this.max>=Number(b)||e.preventDefault()):this._allowKeyCodes(e)||(this.model.enableStrictMode?e.stopPropagation():e.preventDefault())},_allowKeyCodes:function(e){return!((!e.ctrlKey||65!=e.keyCode&&67!=e.keyCode&&90!=e.keyCode&&89!=e.keyCode)&&9!=e.keyCode&&116!=e.keyCode&&13!=e.keyCode)},_readOnlyKeys:function(e){return!(35!=e.keyCode&&36!=e.keyCode&&37!=e.keyCode&&39!=e.keyCode&&!this._allowKeyCodes(e))},_firstlastVal:function(e){var t,i=this.model.timeFormat.split(" "),s=this.seperator;return e?"tt"!=i[0]?i[0].split(s)[0]:"tt":"tt"!=i[0]?"tt":i[1]?(t=i[1].split(s),t.length?t[t.length-1]:"tt"):"tt"},_mouseWheel:function(e){if(e.preventDefault(),this.model.readOnly)return!1;var t,i=e.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");var e=this._getActiveItem();e.addClass("e-active")},_getActiveItem:function(){return e(this.ul.find("li")[this._activeItem-1])},_timeIconClick:function(e){if(e.preventDefault(),!this.model.enabled||this.model.readOnly||this.ul.find("li").length<1)return!1;this._showhidePopup();var t=this.element.val().length;this._setSelection(t,t)},_showhidePopup:function(){return!this._getInternalEvents&&void(this.showDropdown?this._hideResult():this._showResult())},_showResult:function(){this._raiseEvent("beforeOpen"),this._refreshPopup(),this.focused||this._focusElement(),this._changeActiveEle();var i=this,s=this._vissibleAndCalculateTop();this.popupList.slideDown(this.model.enableAnimation?200:0,"easeOutQuad",function(){e(document).bind("mousedown",e.proxy(i._OnDocumentClick,i))}),this.scrollerObj.setModel({scrollTop:s}),this.showDropdown=!0,this._listSize=this.ul.find("li").size(),e(window).bind("resize",e.proxy(this._OnWindowResize,this)),this._on(t.getScrollableParents(this.wrapper),"scroll",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,"easeOutQuad"),e(document).unbind("mousedown",e.proxy(this._OnDocumentClick,this)),e(window).unbind("resize",e.proxy(this._OnWindowResize,this)),this._off(t.getScrollableParents(this.wrapper),"scroll",this._hideResult),this._raiseEvent("close"),this.wrapper.removeClass("e-active"))},_vissibleAndCalculateTop:function(){this.popupList.css({display:"block"});var e=this._calcScrollTop();return this.popupList.css({display:"none"}),e},_calcScrollTop:function(){var e,t=(this.ul.outerHeight(),this.ul.find("li").outerHeight());return e=this.ul.find("li.e-active").index(),t*e-(this.popupList.outerHeight()-t)/2},_changeActiveEle:function(){if(!this.model.showPopupButton||!this.popupList)return!1;var e,t=this.ul.find("li"),i=this.element.val(),s=t.first().html();e=(this._parse(i)-this._parse(s))/(6e4*this.model.interval),e=Math.round(e),this._activeItem=e==t.length?e:e+1,(this._activeItem<0||this._activeItem>t.length||isNaN(this._activeItem))&&(this._activeItem=1),this._addListHover()},_OnDocumentClick:function(t){e(t.target).is(this.popupList)||e(t.target).parents(".e-time-popup").is(this.popupList)||e(t.target).is(this.wrapper)||e(t.target).parents(".e-timewidget").is(this.wrapper)?(e(t.target).is(this.popupList)||e(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"),e(i).addClass("e-hover")},_OnMouseLeave:function(){this.ul.find("li").removeClass("e-hover")},_OnMouseClick:function(t){t.preventDefault(),this.model.enabled&&!this.model.readOnly&&(this._activeItem=e(t.target).index()+1,this.ul.find("li").attr({tabindex:-1,"aria-selected":!1}),e(t.target).attr({"aria-selected":!0,tabindex:0}),this._addSelected(),this._selectTimeItem(e(t.target))),this._showhidePopup()},_selectTimeItem:function(e){this._beforeChange(e);var t=this._raiseChangeEvent();t&&this._trigger("select",{value:this.model.value,prevTime:this._previousValue})},_findCategoryPosition:function(e){"least"==e&&(e=this._getLeast(!0));var t=this._getCategoryPosition(e);this.start=t.start,this.end=t.end},_getLeast:function(t){var i=this.model.timeFormat.split(" "),s=this.seperator,a=null;return e(i).each(function(e,i){if("tt"!=i){var n=i.split(s);a=t?n[n.length-1]:n[0]}}),a},_changeValue:function(e,t){var i,s,a=this.target.value,n=this._getCategory(e);return!!n&&(this._setSelection(this.start,this.end),i=this.target.value.substring(this.start,this.end),this._checkMinMax(this.target.value)?i!=this.ttAM&&i!=this.ttPM?(i=this._changeCurrentValue(i,n,t),1!=n.length&&(i=this._changeWhole(i)),this._findCategoryPosition(n),this.model.value=this._replaceAt(this.target.value,this.start,this.end,i),this.element.val(this.model.value),this.end=this.start+i.toString().length,this._setSelection(this.start,this.end)):this._changeAmPm(i):(s=this._checkExceedRange(this.target.value),this._setTime(this.model[s]),this._findCategoryPosition(n),this._setSelection(this.start,this.end)),void(this._checkMinMax(this.target.value)?this._raiseChangeEvent(a):(this.element.val(a),this._findCategoryPosition(n),this._setSelection(this.start,this.end))))},_checkMinMax:function(e){var t=this._checkExceedRange(e);return!t},_checkExceedRange:function(e){return this.model.minTime&&!this._compareTime(e,this.model.minTime,!0)?"minTime":this.model.maxTime&&!this._compareTime(this.model.maxTime,e,!0)?"maxTime":null},_changeWhole:function(e){return e>9?""+e:"0"+e},_changeAmPm:function(e){e=e==this.ttAM?this.ttPM:this.ttAM,this.element.val(this._replaceAt(this.target.value,this.start,this.end,e)),this._setSelection(this.start,this.end)},_changeMinute:function(e){var t,i=this._getExactFormat(["mm","m"]);i&&(this._findCategoryPosition(i),t=Number(this.target.value.substring(this.start,this.end)),this._getMinMax(i),e?t==this.max?(t=this.min,this._changeHour()):t+=1:t==this.min?(t=this.max,this._changeHour()):t-=1,this._findCategoryPosition(i),1!=i.length&&(t=this._changeWhole(t)),this.element.val(this._replaceAt(this.target.value,this.start,this.end,t)))},_changeHour:function(e){var t,i=this._getExactFormat(["hh","h","HH","H"]);i&&(this._findCategoryPosition(i),t=Number(this.target.value.substring(this.start,this.end)),this._getMinMax(i),e?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),1!=i.length&&(t=this._changeWhole(t)),this.element.val(this._replaceAt(this.target.value,this.start,this.end,t)))},_getExactFormat:function(e){for(var t=this.model.timeFormat,i=0;ithis.max?e=this.min-1+a:ethis.max+1&&(e-=this.max+1,n&&this._changeAdjacent(s,i)):n&&this._changeAdjacent(s,i),"hh"!=s&&"h"!=s&&e==this.max+1&&(e=this.min,n&&this._changeAdjacent(s,i))):("hh"!=s&&"h"!=s&&e>this.min?e-=a:("hh"==s||"h"==s)&&e>this.min&&e<=this.max?e-=a:"hh"!=s&&"h"!=s||e!=this.min?(n=!1,e=this.max+1-a,this._changeAdjacent(s,i)):e=this.max+2-a,e=7&&t<8)return!0}return!1},_replaceAt:function(e,t,i,s){return e.substring(0,t)+s+e.substring(i)},_localizeTime:function(i){return e.trim(t.format(this._createObject(i),this.model.timeFormat,this.model.locale))},_localizeMeridian:function(i){return e.trim(t.format(this._createObject(i),"tt",this.model.locale))},_compareTime:function(e,t,i){return i=!!i,i?this._parse(e)>=this._parse(t):this._parse(e)>this._parse(t)},_isValid:function(e){return e=this._createObject(e),e&&"function"==typeof e.getTime&&isFinite(e.getTime())},_parse:function(e){return Date.parse(this._createObject(e))},_setEmptyDate:function(e){var t=new Date(e);return t.setDate(1),t.setMonth(0),t.setFullYear(2e3),t},_createObject:function(e){var i;if("string"==typeof e||null==e){var s=this._setModelOption?this._preTimeformat:this.model.timeFormat,a=t.preferredCulture(this.model.locale).calendar.patterns.d,n=t.format(new Date("1/1/2000"),a,this.model.locale),o=t.parseDate(n+" "+e,a+" "+s);if(this._setModelOption=!1,!o){if(i=new Date(e),!isNaN(Date.parse(i))&&!t.isNullOrUndefined(e))return this._setEmptyDate(e);o=new Date("1/1/2000 "+e)}return o}return"number"==typeof e?new Date(e):e instanceof Date?this._setEmptyDate(e):void 0},_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(e,t,s){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:{},enabled:!0,value:"",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"},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,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:{cssClass:"string",locale:"string",readOnly:"boolean",showRoundedCorner:"boolean",enableRTL:"boolean",enabled:"boolean",enableAnimation:"boolean",dateTimeFormat:"string",showPopupButton:"boolean",buttonText:"data",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",htmlAttributes:"data"},_setModel:function(i){var s,a,n,o,r=!1;for(s in i)switch(s){case"cssClass":this._changeSkin(i[s]);break;case"locale":this._localize(i[s]);break;case"readOnly":this._readOnly(i[s]);break;case"showRoundedCorner":this._setRoundedCorner(i[s]);break;case"enableRTL":this._setRtl(i[s]);break;case"enabled":this._enabled(i[s]);break;case"validationRules":null!=this.model.validationRules&&(this.element.rules("remove"),this.model.validationMessage=null),this.model.validationRules=i[s],null!=this.model.validationRules&&(this._initValidator(),this._setValidation());break;case"validationMessage":this.model.validationMessage=i[s],null!=this.model.validationRules&&null!=this.model.validationMessage&&(this._initValidator(),this._setValidation());break;case"value":i[s]=this._setValue(i[s]),r=!0;break;case"enableStrictMode":this.model.enableStrictMode=i[s],r=!0;break;case"minDateTime":n=this._stringToObject(i[s]),a=this._getFormat(n,"HH:mm:ss"),this._isValidDate(n)?(this.datePicker.option("minDate",n),this.timePicker.option("minTime",a),i[s]=n):i[s]=this.model[s],r=!0;break;case"maxDateTime":n=this._stringToObject(i[s]),o=this._getFormat(i[s],"HH:mm:ss"),this._isValidDate(n)?(this.datePicker.option("maxDate",n),this.timePicker.option("maxTime",o),i[s]=n):i[s]=this.model[s],r=!0;break;case"height":this.wrapper.height(i[s]);break;case"width":this.wrapper.width(i[s]);break;case"dateTimeFormat":this.model.dateTimeFormat=i[s],this.isValidState&&this._setValue(this.model.value);break;case"showPopupButton":this._showButton(i[s]);break;case"buttonText":t.isNullOrUndefined(this._options)||(this._options=[]),this._options.buttonText=this.model.buttonText=i[s],this._localizedLabels.buttonText=this.model.buttonText,this._buttonText(i[s]);break;case"interval":this._updateTimeHeight(),this.timePicker.option("interval",i[s]);break;case"timeDisplayFormat":this._updateTimeHeight(),this.timePicker.option("timeFormat",i[s]);break;case"timePopupWidth":this._updateTimeHeight(),this.timePicker.option("popupWidth",i[s]);break;case"dayHeaderFormat":this.datePicker.option("dayHeaderFormat",i[s]);break;case"startLevel":this.datePicker.option("startLevel",i[s]);break;case"depthLevel":this.datePicker.option("depthLevel",i[s]);break;case"startDay":this.datePicker.option("startDay",i[s]),this.model.startDay=this.datePicker.model.startDay,i[s]=this.model.startDay;break;case"stepMonths":this.datePicker.option("stepMonths",i[s]);break;case"showOtherMonths":this.datePicker.option("showOtherMonths",i[s]);break;case"headerFormat":this.datePicker.option("headerFormat",i[s]);break;case"htmlAttributes":this._addAttr(i[s]);break;case"popupPosition":this.model.popupPosition=i[s],this._setListPosition();break;case"timeDrillDown":t.isNullOrUndefined(i[s].enabled)||(this.model.timeDrillDown.enabled=i[s].enabled,this._changeDesign()),t.isNullOrUndefined(i[s].interval)||(this.model.timeDrillDown.interval=i[s].interval,this._generateMins(e.trim(t.format(this.timePicker._createObject(this._datetimeValue),"HH:00",this.model.locale)))),t.isNullOrUndefined(i[s].showMeridian)||(this.model.timeDrillDown.showMeridian=i[s].showMeridian,this._sfTimeHour.empty(),this._renderHourTable()),t.isNullOrUndefined(i[s].showFooter)||(this.model.timeDrillDown.showFooter=i[s].showFooter,this._changeDesign())}r&&this._validateMinMax(),this._valueChange(!0),this._checkErrorClass()},observables:["value"],_destroy:function(){this.isPopupOpen&&this._hideResult(),this.element.insertAfter(this.wrapper),this.element.removeClass("e-input").val(""),this.wrapper.remove(),this.popup.remove()},_init:function(e){return!(!this.element.is("input")||this.element.attr("type")&&"text"!=this.element.attr("type"))&&(this._options=e,this._validateMeridian(),this._initialize(),this._initial=!0,this._interval=60,this._render(),this._wireEvents(),this._addAttr(this.model.htmlAttributes),null!=this.model.validationRules&&(this._initValidator(),this._setValidation()),this._changeDesign(),void(e&&e.value!=s&&e.value!=this.element.val()&&this._trigger("_change",{value:this.element.val()})))},_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),e(".e-footer",this._sfTimeHour).css("display",t),e(".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()},_setValidation:function(){var i,s,a,n;this.element.rules("add",this.model.validationRules),i=this.element.closest("form").data("validator"),i=i?i:this.element.closest("form").validate(),name=this.element.attr("name"),i.settings.messages[name]={};for(s in this.model.validationRules)if(a=null,!t.isNullOrUndefined(this.model.validationRules[s])){if(t.isNullOrUndefined(this.model.validationRules.messages&&this.model.validationRules.messages[s])){i.settings.messages[name][s]=e.validator.messages[s];for(n in this.model.validationMessage)s==n?a=this.model.validationMessage[s]:""}else a=this.model.validationRules.messages[s];i.settings.messages[name][s]=null!=a?a:e.validator.messages[s]}},_addAttr:function(t){var i=this;e.map(t,function(e,t){"required"==t?i.element.attr(t,e):"name"==t?i.element.attr(t,e):"class"==t?i.wrapper.addClass(e):"disabled"==t&&"disabled"==e?i._enabled(!1):"readOnly"==t&&"readOnly"==e?i._readOnly(!0):i.wrapper.attr(t,e)})},_validateMeridian:function(){var e=t.preferredCulture(this.model.locale);e&&(this.model.locale="en"==e.name?"en-US":e.name),t.isNullOrUndefined(this._options)?this.model.timeDrillDown.showMeridian=!t.isNullOrUndefined(t.preferredCulture(this.model.locale).calendars.standard.AM):t.isNullOrUndefined(this._options.timeDrillDown)?this.model.timeDrillDown.showMeridian=!t.isNullOrUndefined(t.preferredCulture(this.model.locale).calendars.standard.AM):t.isNullOrUndefined(this._options.timeDrillDown.showMeridian)&&(this.model.timeDrillDown.showMeridian=!t.isNullOrUndefined(t.preferredCulture(this.model.locale).calendars.standard.AM))},_initialize:function(){var i,s,a;this.popup=null,this.isPopupOpen=!1,this.isValidState=!0,this.model.value=""===this.model.value?this.element[0].value:this.model.value,this._localizedLabels=this._getLocalizedLabels(),t.isNullOrUndefined(this._options)||t.isNullOrUndefined(this._options.buttonText)||e.extend(this._localizedLabels.buttonText,this._options.buttonText),this._localizedLabelToModel(),this._isIE8="msie"==t.browserInfo().name&&"8.0"==t.browserInfo().version,this.model.dateTimeFormat&&this.model.timeDisplayFormat||this._getDateTimeFormat(),"string"==typeof this.model.value&&""!=typeof this.model.value&&(i=this._stringToObject(this.model.value),i&&(this.model.value=i)),s=this.model.minDateTime=this._stringToObject(this.model.minDateTime),s&&this._isValidDate(s)||(this.model.minDateTime=this.defaults.minDateTime),a=this.model.maxDateTime=this._stringToObject(this.model.maxDateTime),a&&this._isValidDate(a)||(this.model.maxDateTime=this.defaults.maxDateTime)},_render:function(){this._renderWrapper(),this._renderIcon(),this._setDimentions(),this._renderDropdown(),this._checkProperties()},_renderWrapper:function(){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.container=t.buildTag("span.e-in-wrap e-box").append(this.element),this.wrapper.append(this.container)},_renderIcon:function(){if(!this.model.showPopupButton)return!1;this.datetimeIcon=t.buildTag("span.e-select","",{}).attr(this._isIE8?{unselectable:"on"}:{});var e=t.buildTag("span.e-icon e-datetime","",{},{"aria-label":"select"}).attr(this._isIE8?{unselectable:"on"}:{});this.datetimeIcon.append(e),this.container.append(this.datetimeIcon).addClass("e-padding"),this._on(this.datetimeIcon,"click",this._iconClick),this._on(this.datetimeIcon,"mousedown",function(e){e.preventDefault()})},_setDimentions:function(){this.model.height&&this.wrapper.height(this.model.height),this.model.width&&this.wrapper.width(this.model.width)},_renderDropdown:function(){var i,s,a,n,o,r=e("#"+this.element.context.id+"_popup").get(0);r&&e(r).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"),e("body").append(this.popup),this._renderControls(),i=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(i,this.timePicker.popup).attr(this._isIE8?{unselectable:"on"}:{}),this._drillDownContainer=t.buildTag("div.e-drillDowncontainer").append().attr(this._isIE8?{unselectable:"on"}:{}),s=t.buildTag("div.e-popup-container").append(this._dateContainer,this._timeContainer,this._drillDownContainer).attr(this._isIE8?{unselectable:"on"}:{}),a=t.buildTag("div.e-dt-button e-dt-today",this._localizedLabels.buttonText.today).attr(this._isIE8?{unselectable:"on"}:{}),n=t.buildTag("div.e-dt-button e-dt-now",this._localizedLabels.buttonText.timeNow).attr(this._isIE8?{unselectable:"on"}:{}),o=t.buildTag("div.e-dt-button e-dt-done",this._localizedLabels.buttonText.done).attr(this._isIE8?{unselectable:"on"}:{}),this._buttonContainer=t.buildTag("div.e-button-container").append(a,n,o).attr(this._isIE8?{unselectable:"on"}:{}),this._renderDrillDown(),this.popup.append(s,this._buttonContainer),this._checkForResponsive(),this._updateTimeHeight(),this._bindOperations(),this._updateValues(),this.popup.css({visibility:"visible",display:"none"}),this._on(a,"click",this._todayClick),this._on(n,"click",this._nowClick),this._on(o,"click",this._doneClick)},_renderControls:function(){this._renderDateControl(),this._renderTimeControl();var e=t.buildTag("span").append(this.datePicker.wrapper,this.timePicker.wrapper);e.find("span").css("display","none"),this.popup.append(e)},_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"}:{}),this._drillDownContainer.append(this._sfTimeHour),this._renderHourTable()},_renderHourTable:function(){var s,a,n,o,r,l,d;if(t.buildTag("div.e-header").attr(this._isIE8?{unselectable:"on"}:{}).append(t.buildTag("span.e-prev").append(t.buildTag("a.e-icon e-left-arrow").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-right-arrow").attr({role:"button"}).attr(this._isIE8?{unselectable:"on"}:{}))).appendTo(this._sfTimeHour),this._interval<1)return!1;o=6e4*this._interval,r=this.model.timeDrillDown.showMeridian?2:1,rowCount=this.model.timeDrillDown.showMeridian?6:4;var h=this.model.timeDrillDown.showMeridian?"hh":"HH:00",c=["AM","PM"],u=0,m="";for(s=this.timePicker._createObject("12:00:00 AM"),a=this.model.timeDrillDown.showMeridian?this.timePicker._createObject("11:59:59 AM"):this.timePicker._createObject("11:59:59 PM"),i=0;i=rowCount&&(u=0,tbody.append(tr),tr=t.buildTag("tr","").attr(this._isIE8?{unselectable:"on"}:{})),s=this.timePicker._createObject(s).getTime()+o;table.append(tbody),this.model.timeDrillDown.showMeridian&&(s=this.timePicker._createObject("12:00:00 PM"),a=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),e(".e-footer-text",this._sfTimeHour).html(this._localizedLabels.buttonText.timeNow),e(".e-hours-headertext",this._sfTimeHour).text(t.format(this.datePicker.model.value,"dd MMM yyyy")),this._on(this._sfTimeHour.find(".e-hour"),"click",e.proxy(this._hourNavHandler,this)),this._on(e(".e-next",this._sfTimeHour),"click",e.proxy(this._prevNextHourHandler,this)),this._on(e(".e-prev",this._sfTimeHour),"click",e.proxy(this._prevNextHourHandler,this)),this._on(e(".e-footer",this._sfTimeHour),"click",this._todayBtn),e(".e-hours-headertext",this._sfTimeHour).on("click",e.proxy(this._forwardNavHandler,this)),this._sfTimeHour.hide()},_localizeTime:function(i,s){return e.trim(t.format(this.timePicker._createObject(i),s,this.model.locale))},_renderMinsPopup:function(){var i,s,a,n,o,r,l;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"}:{}),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-left-arrow").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-right-arrow").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),i=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(i),tbody=t.buildTag("tbody.e-timepicker-mins").attr(this._isIE8?{unselectable:"on"}:{}),this._intervall<1)return!1;for(o=6e4*this._interval,s=this.timePicker._createObject("12:00:00 AM"),a=this.timePicker._createObject("11:59:59 PM"),tr=t.buildTag("tr","").attr(this._isIE8?{unselectable:"on"}:{}),r=0;this.timePicker._compareTime(a,s,!0);)n=this._localizeTime(s,"HH:00"),l=t.buildTag("td.e-mins e-state-default",n),this._isIE8&&l.attr("unselectable","on"),tr.append(l),r++,r>=4&&(r=0,tbody.append(tr),tr=t.buildTag("tr","").attr(this._isIE8?{unselectable:"on"}:{})),s=this.timePicker._createObject(s).getTime()+o;i.append(tbody),e(".e-minitues-headertext",this._sfTimeMins).text(e(".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),e(".e-footer-text",this._sfTimeMins).html(this._localizedLabels.buttonText.timeNow),e(".e-minitues-headertext",this._sfTimeMins).text(t.format(this.datePicker.model.value,"dd MMM yyyy")),this.model.timeDrillDown.showMeridian||e(".e-mins-header",this._sfTimeMins).css("display","none"),this._on(i.find(".e-mins"),"click",e.proxy(this._minsNavHandler,this)),this._on(e(".e-next",this._sfTimeMins),"click",e.proxy(this._prevNextMinsHandler,this)),this._on(e(".e-prev",this._sfTimeMins),"click",e.proxy(this._prevNextMinsHandler,this)),this._on(e(".e-footer",this._sfTimeMins),"click",this._todayBtn),e(".e-minitues-headertext",this._sfTimeMins).on("click",e.proxy(this._forwardNavHandler,this)),this._sfTimeMins.hide()},_todayBtn:function(){this._nowClick(),this._hideResult()},_hourNavHandler:function(i){var s,a;if(this.model.readOnly||!this.model.enabled||i&&e(i.target).hasClass("e-disable"))return!1;i&&i.type&&i.preventDefault(),e("table",this._sfTimeHour).find("td").removeClass("e-active"),e(i.target).addClass("e-active"),this._sfTimeHour.hide(),this._sfTimeMins.show(),this._addFocus(this._sfTimeMins),this.model.timeDrillDown.showMeridian?(a=e(i.target).hasClass("e-hour-am")?"AM":"PM",s=e(i.target).text()+":00 "+a):s=e(i.target).text(),this._generateMins(s);var n=new Date(this._datetimeValue.toString()).setMinutes(this.model.value.getMinutes()),o=e.trim(t.format(this.timePicker._createObject(n),"HH:mm",this.model.locale)),r=e.trim(t.format(this.timePicker._createObject(n),"HH:00",this.model.locale));index=(this.timePicker._parse(o)-this.timePicker._parse(r))/(6e4*this.model.timeDrillDown.interval),index=Math.ceil(index),this._hoverMins=this._setFocusByIndex("mins",index,this._sfTimeMins)},_minsNavHandler:function(i){return!(this.model.readOnly||!this.model.enabled||i&&e(i.target).hasClass("e-disable"))&&(i&&i.type&&i.preventDefault(),e("table",this._sfTimeMins).find("td").removeClass("e-active").removeClass("e-state-hover"),e(i.target).addClass("e-active"),this.model.timeDrillDown.showMeridian?(value=e(i.target).text()+" "+t.format(this._datetimeValue,"tt","en-US"),value=this.timePicker._localizeTime(value)):value=e(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(),void this._updateInput())},_generateMins:function(i){var s,a,n,o,r,l,d,h=e("table",this._sfTimeMins);for(h.empty(),this.model.timeDrillDown.showMeridian?e(".e-mins-header",this._sfTimeMins).show():e(".e-mins-header",this._sfTimeMins).hide(),s=this.model.timeDrillDown.showMeridian?"hh:mm":"HH:mm",e(".e-minitues-headertext",this._sfTimeMins).text(e(".e-hours-headertext",this._sfTimeHour).text()),tbody=t.buildTag("tbody.e-timepicker-mins").attr(this._isIE8?{unselectable:"on"}:{}),r=0,l=6e4*this.model.timeDrillDown.interval,a=this.timePicker._createObject(i),this._datetimeValue.setHours(a.getHours()),n=this.timePicker._createObject(a).getTime()+354e4,tr=t.buildTag("tr","").attr(this._isIE8?{unselectable:"on"}:{}),tbody.append(tr);this.timePicker._compareTime(n,a,!0);)r>=4&&(r=0,tr=t.buildTag("tr","").attr(this._isIE8?{unselectable:"on"}:{}),tbody.append(tr)),o=this._localizeTime(a,s),d=t.buildTag("td.e-mins e-state-default",o),this._isIE8&&d.attr("unselectable","on"),tr.append(d),r++,a=this.timePicker._createObject(a).getTime()+l;h.append(tbody),e(".e-mins-header",this._sfTimeMins).find(".e-minitues-meridiantxt").text(t.format(this._datetimeValue,"tt",this.model.locale)),this._disableRange("mins"),this._on(h.find(".e-mins"),"click",e.proxy(this._minsNavHandler,this))},_prevNextHourHandler:function(t){if(this.model.readOnly||!this.model.enabled)return!1;t.preventDefault();var i=e(e(t.target).is("a")?t.target.parentNode:t.target),s=!!i.hasClass("e-prev");this._processNextPrev(s,this._sfTimeHour)},_prevNextMinsHandler:function(t){if(this.model.readOnly||!this.model.enabled)return!1;t.preventDefault();var i=e(e(t.target).is("a")?t.target.parentNode:t.target),s=!!i.hasClass("e-prev");this._processNextPrev(s,this._sfTimeMins)},_processNextPrev:function(i,s){var a,n,o;if(i&&s.find(".e-left-arrow").hasClass("e-disable")||!i&&s.find(".e-right-arrow").hasClass("e-disable"))return!1;switch(a=e("table",s),o=a.get(0).className){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),e(".e-hours-headertext",this._sfTimeHour).text(t.format(this._datetimeValue,"dd MMM yyyy")),e(".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(e.trim(t.format(this.timePicker._createObject(this._datetimeValue),"HH:00",this.model.locale)));var n=new Date(this._datetimeValue.toString()).setMinutes(this.model.value.getMinutes()),r=e.trim(t.format(this.timePicker._createObject(n),"HH:mm",this.model.locale)),l=e.trim(t.format(this.timePicker._createObject(n),"HH:00",this.model.locale));index=(this.timePicker._parse(r)-this.timePicker._parse(l))/(6e4*this.model.timeDrillDown.interval),index=Math.ceil(index),this._disableRange("mins"),this._hoverMins=this._setFocusByIndex("mins",index,this._sfTimeMins),e(".e-hours-headertext",this._sfTimeHour).text(t.format(this._datetimeValue,"dd MMM yyyy")),e(".e-minitues-headertext",this._sfTimeMins).text(t.format(this._datetimeValue,"dd MMM yyyy"))}},_forwardNavHandler:function(i,s){var a,n,o;if(this.model.readOnly||!this.model.enabled)return!1;switch(n=this,i&&i.preventDefault(),a=i?e(i.currentTarget).get(0).className:s.find(".e-text>span").get(0).className){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"),o=e.trim(t.format(this.timePicker._createObject(this._datetimeValue),"HH:00",this.model.locale)),indx=(this.timePicker._parse(o)-this.timePicker._parse(start))/(6e4*this._interval),indx=Math.floor(indx),this._hoverHour=this._setFocusByIndex("hour",indx,this._sfTimeHour),e(".e-hours-headertext",this._sfTimeHour).text(t.format(this._datetimeValue,"dd MMM yyyy")),e(".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 e=t.buildTag("input#"+this.element[0].id+"_date","",{},{type:"text"});this.popup.append(e),e.ejDatePicker({height:"0px",width:"0px",displayInline:!0,showDateIcon:!1,showFooter:!!this.model.timeDrillDown.enabled&&this.model.timeDrillDown.showFooter,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,buttonText:this._localizedLabels.buttonText.today,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=e.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 e,i,s=t.buildTag("input#"+this.element[0].id+"_time","",{},{type:"text"});this.popup.append(s),s.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=s.data("ejTimePicker"),this.timePicker._getInternalEvents=!0,this.timePicker.showDropdown=!0,this.timePicker.popup.css({position:"static",display:"block"}),e=this.model.minDateTime?this._stringToObject(this.model.minDateTime):this.defaults.minDateTime,i=this.model.maxDateTime?this._stringToObject(this.model.maxDateTime):this.defaults.maxDateTime,""==this.model.value&&(+this.datePicker.model.value==+this.datePicker._zeroTime(this.model.minDateTime)&&this.timePicker.option("minTime",this._getFormat(e,"HH:mm:ss")),+this.datePicker.model.value==+this.datePicker._zeroTime(this.model.maxDateTime)&&this.timePicker.option("maxTime",this._getFormat(i,"HH:mm:ss")))},_updateTimeHeight:function(){var e=this.datePicker.popup.height()-this.popup.find(".e-header").height();e=this.popup.hasClass("e-dt-responsive")?"98px":e,this.timePicker.option("popupHeight",e)},_bindOperations:function(){var e=this;this.datePicker.option("layoutChange",function(){e._updateTimeHeight()}),this.datePicker.option("outOfRange",function(){e.isValidState=!1}),this.timePicker.option("outOfRange",function(){e.isValidState=!1}),this.datePicker.option("change",function(t){e._refreshTimes(t)}),this.datePicker.option("select",function(t){e._updateInput(t)}),this.datePicker.option("dt_drilldown",function(t){e.model.timeDrillDown.enabled&&(e._updateInput(t),e._switchToDrilDown(t))}),this.timePicker.option("select",function(){e._updateInput()})},_switchToDrilDown:function(){var i,s;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"),s=e.trim(t.format(this.timePicker._createObject(this._datetimeValue),"HH:00",this.model.locale)),indx=(this.timePicker._parse(s)-this.timePicker._parse(start))/(6e4*this._interval),indx=Math.floor(indx),this._hoverHour=this._setFocusByIndex("hour",indx,this._sfTimeHour),e(".e-hours-headertext",this._sfTimeHour).text(t.format(this._datetimeValue,"dd MMM yyyy")),e(".e-minitues-headertext",this._sfTimeMins).text(t.format(this._datetimeValue,"dd MMM yyyy"))},_disableRange:function(s){var a,n,o,r,l="hour"==s?this._interval:this.model.timeDrillDown.interval,d="hour"==s?this._sfTimeHour:this._sfTimeMins,h="hour"==s?"e-hide-hour e-disable":"e-hide-mins e-disable";if(d.find("tbody tr td.e-"+s).removeClass(h),d.find(".e-left-arrow").removeClass("e-disable"),d.find(".e-right-arrow").removeClass("e-disable"),start="hour"==s?this._localizeTime(this.timePicker._createObject("12:00:00 AM"),"HH:00"):this._localizeTime(e.trim(t.format(this.timePicker._createObject(this._datetimeValue),"HH:00",this.model.locale)),"HH:00"),this._compareDate(this.model.minDateTime,this._datetimeValue)){if("mins"==s&&this.model.minDateTime.getHours()!==this._datetimeValue.getHours())return!1;for(a=e.trim(t.format(this.timePicker._createObject(this.model.minDateTime),"HH:mm",this.model.locale)),indx=(this.timePicker._parse(a)-this.timePicker._parse(start))/(6e4*l),indx="hour"==s?Math.floor(indx):Math.ceil(indx),i=0;ithis.model.maxDateTime?(this.model.value=null,this.isValidState=!1):this.isValidState=!0},_validateMinMax:function(){var e,t,i;return e=this.model.value?this._stringToObject(this.model.value):null,t=this.model.minDateTime?this._stringToObject(this.model.minDateTime):this.defaults.minDateTime,i=this.model.maxDateTime?this._stringToObject(this.model.maxDateTime):this.defaults.maxDateTime,!!(e&&t&&i)&&(t>i&&(this.model.minDateTime=this.model.maxDateTime),void(this.isValidState=!(ei)))},_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.element.attr("name")||this.element.attr({name:this.element[0].id}),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()))},_checkStrictMode:function(){this.model.enableStrictMode||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(e){e.preventDefault(),this.isFocused=!0,this.wrapper.addClass("e-focus"),this.wrapper.removeClass("e-error"),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})},_targetBlur:function(){this.isFocused=!1,this.wrapper.removeClass("e-focus"),this.model.showPopupButton||this._hideResult();var e=t.parseDate(this.element.val(),this.model.dateTimeFormat);e&&!this.model.enableStrictMode&&(ethis.model.maxDateTime)&&(e=e0&&(t.removeClass("e-focus"),t.hasClass("e-datepicker e-popup")?e(document).unbind("keydown",e.proxy(this.datePicker._keyboardNavigation,this.datePicker)):t.hasClass("e-timecontainer")?e(document).unbind("keydown",e.proxy(this.timePicker._keyDownOnInput,this.timePicker)):t.hasClass("e-time-hours")?e(document).unbind("keydown",e.proxy(this._keyDownOnHours,this)):t.hasClass("e-time-minitues")?e(document).unbind("keydown",e.proxy(this._keyDownOnMinutes,this)):t.hasClass("e-dt-button")&&e(document).unbind("keydown",e.proxy(this._buttonClick,this)))},_addPrevNextFocus:function(e){var t,i=this._getFocusedElement();i.length>0?i.hasClass("e-datepicker e-popup")?t=e?this.popup.find(".e-dt-done"):this.popup.find(".e-timecontainer"):i.hasClass("e-timecontainer")?t=e?this.popup.find(".e-datecontainer >.e-datepicker.e-popup"):this.popup.find(".e-dt-today"):i.hasClass("e-dt-today")?t=e?this.popup.find(".e-timecontainer"):this.popup.find(".e-dt-now"):i.hasClass("e-dt-now")?t=e?this.popup.find(".e-dt-today"):this.popup.find(".e-dt-done"):i.hasClass("e-dt-done")&&(t=e?this.popup.find(".e-dt-now"):this.popup.find(".e-datecontainer >.e-datepicker.e-popup")):t=e?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(e){var t,i,s;(37==e.keyCode||38==e.keyCode||39==e.keyCode||40==e.keyCode||13==e.keyCode||36==e.keyCode||35==e.keyCode)&&(e.preventDefault&&e.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)),i=this._sfTimeHour.find("table")[0].className,rowLength=this._sfTimeHour.find("tbody.e-timepicker-hours tr").length,colLength=this.model.timeDrillDown.showMeridian?6:4,s=this._changeRowCol(t,e.keyCode,rowLength,colLength,"hours",e.ctrlKey),e.ctrlKey||(this._hoverHour=this._sfTimeHour.find("tbody.e-timepicker-hours tr td").index(s)),e.ctrlKey||(this._sfTimeHour.find("table td").removeClass("e-state-hover"),s.addClass("e-state-hover")))},_changeRowCol:function(t,i,s,a,n,o){var r,l,d,h,c,u,m={parent:null,child:null};switch(n){case"hours":r="tbody.e-timepicker-hours tr td.e-hour",m.parent=".e-timepicker-hours",m.child=".e-hour",hiddenClass=".e-hide-hour",l=this._sfTimeHour;break;case"mins":r="tbody.e-timepicker-mins tr td.e-mins",m.parent=".e-timepicker-mins",m.child=".e-mins",hiddenClass=".e-hide-mins",l=this._sfTimeMins,a=l.find("tbody"+m.parent+" tr:nth-child("+t.row+") td"+m.child).length}if(t.row<=0&&t.col<=0)return l.find(r+":not(.e-disable):first");switch(h=this,i){case 36:return l.find(r+":not(.e-disable):first");case 35:return l.find(r+":not(.e-disable):last");case 38:if(o)this._forwardNavHandler(null,l);else{if(!(t.row>1))return this._processNextPrev(!0,l),l.find(r+":nth-child("+t.col+"):last");t.row-=1}if(d=this._getCell(t,m,l).not(hiddenClass),d.length<=0){if(d=this._findVisible(t,m,"up",l),null!==d)return d;this._processNextPrev(!0,l),d=l.find(r+":nth-child("+t.col+"):last")}return d;case 37:if(o)return this._processNextPrev(!0,l),l.find("tbody tr td.e-state-hover");if(t.col>1)t.col-=1;else{if(!(t.row>1))return this._processNextPrev(!0,l),l.find(r+":not(.e-disable):last");t={row:t.row-1,col:a},"mins"==n&&(t.col=a=l.find("tbody"+m.parent+" tr:nth-child("+t.row+") td"+m.child).length)}if(d=this._getCell(t,m,l).not(hiddenClass),d.length<=0){if(d=this._findVisible(t,m,"left",l),null!==d)return d;this._processNextPrev(!0,l),d=l.find(r+":not(.e-disable):last")}return d;case 39:if(o)return this._processNextPrev(!1,l),l.find("tbody tr td.e-state-hover");if(t.col2&&s.hasClass("e-time-hours")&&(n-=2),a=s.find("tbody"+i.parent+" tr:nth-child("+n+") td"+i.child+":nth-child("+t.col+")"),this.model.timeDrillDown.showMeridian&&a.length>0&&s.hasClass("e-time-hours")&&(a=e(t.row<=2?a[0]:a[1])),a},_findVisible:function(e,t,s,a){var n=e.col,o=e.row,r=t.child.slice(1,t.child.length);for(i=0;i>=0;i++){if(nextElement=this._getCell({row:o,col:n},t,a),nextElement.length<=0)return null;if(nextElement.hasClass("e-disable")||!nextElement.is(":visible")){if("right"==s||"left"==s?"right"==s?n++:n--:"down"==s?o++:o--,o<=0||o>a.find("tbody"+t.parent+" tr").length||(n>a.find("tbody"+t.parent+" tr:nth-child("+o+") td").length&&(o++,n=1),n<=0&&(o--,n=a.find("tbody"+t.parent+" tr:nth-child("+o+") td").length),o<=0||o>a.find("tbody"+t.parent+" tr").length))return null}else if(nextElement.hasClass(r))return e.col=n,e.row=o,nextElement=this._getCell(e,t,a)}},_keyDownOnMinutes:function(e){var t,i,s;(37==e.keyCode||38==e.keyCode||39==e.keyCode||40==e.keyCode||13==e.keyCode||36==e.keyCode||35==e.keyCode)&&(e.preventDefault&&e.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,i=this._sfTimeMins.find("table")[0].className,rowLength=this._sfTimeMins.find("tbody.e-timepicker-mins tr").length,colLength=4,s=this._changeRowCol(t,e.keyCode,rowLength,colLength,"mins",e.ctrlKey),e.ctrlKey||(this._hoverHour=this._sfTimeMins.find("tbody.e-timepicker-mins tr td").index(s)),e.ctrlKey||(this._sfTimeMins.find("table td").removeClass("e-state-hover"),s.addClass("e-state-hover")))},_valueChange:function(e){this._preVal!=this.element.val()&&(this._preVal=this.element.val(),this._updateModel(),this._validateMinMax(),this._raiseChangeEvent(e))},_updateModel:function(){var e,i=this.element.val();""==i?(this.model.value=null,this.isValidState=!0):(e=t.parseDate(i,this.model.dateTimeFormat,this.model.locale),e?(this.model.value=e,this.isValidState=!0,this._refreshPopup()):(this.model.value=null,this.isValidState=!1))},_refreshPopup:function(){if(this.isValidState&&this.isPopupOpen){var e=this._setEmptyTime(this.model.value),t=this._setEmptyDate(this.model.value),i=this._getDate(),s=this._getTime();i&&this._compare(i,e)||this.datePicker.option("value",e),s&&this._compare(s,t)||this.timePicker.option("value",t)}},_buttonClick:function(e){if(13==e.keyCode){e.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(){return!(!this.model.enabled||this.model.readOnly)&&void(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 e;if(!this.model.enabled||this.model.readOnly)return!1;this.timePicker.setCurrentTime();var i=this.model.minDateTime,s=this.model.maxDateTime,a=this.datePicker.model.value,n=new Date;a=t.isNullOrUndefined(a)?new Date:a,e=new Date(a.getFullYear(),a.getMonth(),a.getDate(),n.getHours(),n.getMinutes(),n.getSeconds()),es&&this.timePicker.option("value",this.timePicker._localizeTime(s)),this._updateInput()},_doneClick:function(){this._hideResult()},_iconClick:function(e){e.preventDefault(),this.isFocused||this.element.focus(),this._showhidePopup()},_showhidePopup:function(){return!this.model.readOnly&&void(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,"easeOutQuad",function(){i._on(e(document),"mousedown",i._OnDocumentClick),i.model.timeDrillDown.enabled&&i._addFocus(i._dateContainer.find(".e-datepicker"))}),this._updateModel(),this._updateTimeHeight(),this._validateMinMax(),this._on(e(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(){var i=this;return!(!this.isPopupOpen||this._trigger("beforeClose",{element:this.popup}))&&(this.isPopupOpen=!1,this._removeFocus(),this.popup.slideUp(this.model.enableAnimation?100:0,"easeOutQuad",function(){i.model&&(i.model.timeDrillDown.enabled&&(i._sfTimeHour.hide(),i._sfTimeMins.hide(),i._dateContainer.show()),t.isNullOrUndefined(i.model.value)||(i._datetimeValue=new Date(i.model.value.toString())))}),this._raiseEvent("close"),this._off(e(document),"mousedown",this._OnDocumentClick),this._off(e(window),"resize",this._OnWindowResize),this._off(t.getScrollableParents(this.wrapper),"scroll",this._hideResult),void this.wrapper.removeClass("e-active"))},_setListPosition:function(){var i,s,a=this.wrapper,n=this._getOffset(a),o=e(document).scrollTop()+e(window).height()-(n.top+e(a).outerHeight()),r=n.top-e(document).scrollTop(),l=this.popup.outerHeight(),d=this.popup.outerWidth(),h=n.left,c=a.outerHeight(),u=(c-a.height())/2,m=this._getZindexPartial(),p=3;this.model.popupPosition;s=this.model.popupPosition==t.PopupPosition.Bottom?(lr?n.top+c+p:n.top-l-p)-u:(l>r?n.top+c+p:n.top-l-p)-u,i=e(document).scrollLeft()+e(window).width()-h,(this.model.enableRTL||d>i&&d0?this._addFocus(e(t.target).parents(".e-datepicker")):e(t.target).parents(".e-timecontainer").length>0?this._addFocus(e(t.target).parents(".e-timecontainer")):e(t.target).hasClass("e-dt-button")?this._addFocus(e(t.target)):e(t.target).parents(".e-time-hours").length>0?this._addFocus(e(t.target).parents(".e-time-hours")):e(t.target).parents(".e-time-minitues").length>0?this._addFocus(e(t.target).parents(".e-time-minitues")):this._removeFocus()):this._hideResult())},_OnWindowResize:function(){this._setListPosition(),this._checkForResponsive(),this._updateTimeHeight()},_raiseChangeEvent:function(i){var s,a,n=(this._stringToObject(this._prevDateTimeVal),t.parseDate(this.element.val(),this.model.dateTimeFormat));null==this.element||!n||nthis.model.maxDateTime||(s=""==e.trim(this.element.val())?null:this.element.val(),a={prevDateTime:this._prevDateTimeVal,value:s,isInteraction:!i,isValidState:this.isValidState},this._trigger("change",a),this._trigger("_change",a),this._prevDateTimeVal=this.element.val())},_raiseEvent:function(e){return!(null==this.element||!this.model[e])&&this._trigger(e,{prevDateTime:this._preVal,value:this.element.val()})},_getDateTimeFormat:function(){var e=t.preferredCulture(this.model.locale).calendar.patterns;this.model.dateTimeFormat||(this.model.dateTimeFormat=e.d+" "+e.t),this.model.timeDisplayFormat||(this.model.timeDisplayFormat=e.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(e){var t=new Date(e);return t.setMilliseconds(0),t.setSeconds(0),t.setMinutes(0),t.setHours(0),t},_setEmptyDate:function(e){var t=new Date(e);return t.setDate(1),t.setMonth(0),t.setFullYear(2e3),t},_objectToString:function(e){return this._getFormat(e,this.model.dateTimeFormat)},_stringToObject:function(e){return this._getDateObj(e,this.model.dateTimeFormat)},_getFormat:function(e,i){if(e instanceof Date){var s=this._checkFormat(i);return t.format(e,s,this.model.locale)}return e},_checkFormat:function(e){var i=this,s=this._regExp();return e.replace(s,function(e){return"/"===e&&"/"!==t.preferredCulture(i.model.locale).calendars.standard["/"]?"'/'":e})},_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(e,i){var s,a;if("string"!=typeof e)return e;if(s=this._checkFormat(i),a=t.parseDate(e,s,this.model.locale),null!=a)return a;if(""==e||null==e)return null;var n,o=/^\s*(\d{4})-(\d\d)-(\d\d)T(\d\d):(\d\d):(\d\d).*Z\s*$/.exec(e),r=new Date;return o&&(r=new Date,n=+o[2],r.setUTCFullYear(o[1],n-1,o[3]),r.setUTCHours(o[4],o[5],o[6]),n!=r.getUTCMonth()+1&&r.setTime()),this._isValidDate(r)?r:void 0},_compare:function(e,t){return e&&t&&e.getTime()==t.getTime()},_isValidDate:function(e){return e&&"function"==typeof e.getTime&&isFinite(e.getTime())},_change:function(e,t){this.datePicker.option(e,t),this.timePicker.option(e,t)},_changeSkin:function(e){this.wrapper.removeClass(this.model.cssClass).addClass(e),this.popup.removeClass(this.model.cssClass).addClass(e),this._change("cssClass",e)},_localize:function(s){var a,n;if(this.model.locale=s,this.model.dateTimeFormat=this.model.timeDisplayFormat="",a=["AM","PM"],this._getDateTimeFormat(),this._localizedLabels=this._getLocalizedLabels(),t.isNullOrUndefined(this._options)||t.isNullOrUndefined(this._options.buttonText)||e.extend(this._localizedLabels.buttonText,this._options.buttonText),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",s),this.model.startDay=this.datePicker.model.startDay,this._validateMeridian(),this._sfTimeHour.empty(),this._renderHourTable(),this.model.timeDrillDown.showMeridian)for(i=0;i<2;i++)n=t.isNullOrUndefined(t.preferredCulture(this.model.locale).calendars.standard[a[i]])?"":t.preferredCulture(this.model.locale).calendars.standard[a[i]][0],e("span.e-hours-meridiantxt-"+a[i].toLowerCase(),this._sfTimeHour).text(n)},_localizedLabelToModel:function(){this.model.buttonText=this._localizedLabels.buttonText},_readOnly:function(e){this.model.readOnly=e,e?this.element.attr("readonly","readonly"):this.element.removeAttr("readonly"),this._change("readOnly",e)},_setRoundedCorner:function(e){e?(this.container.addClass("e-corner"),this.popup.addClass("e-corner")):(this.container.removeClass("e-corner"),this.popup.removeClass("e-corner")),this.datePicker.option("showRoundedCorner",e)},_setRtl:function(e){e?(this.wrapper.addClass("e-rtl"),this.popup.addClass("e-rtl")):(this.wrapper.removeClass("e-rtl"),this.popup.removeClass("e-rtl")),this._change("enableRTL",e)},_enabled:function(e){e?(this.model.enabled=!1,this.enable()):(this.model.enabled=!0,this.disable())},_showButton:function(e){this.model.showPopupButton=e,e?(this.container.addClass("e-padding"),this._renderIcon()):(this.container.removeClass("e-padding"),this.datetimeIcon.remove(),this.datetimeIcon=null)},_buttonText:function(t){e.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(e(window).outerWidth()>200&&e(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.removeAttr("disabled"),this.element.removeClass("e-disable").attr("aria-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.element.addClass("e-disable").attr("aria-disabled",!0),this.element.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(){this._on(this.element,"focus",this._targetFocus),this._on(this.element,"blur",this._targetBlur),this._on(this.element,"keydown",this._keyDownOnInput)},_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"]={buttonText:{today:"Today",timeNow:"Time Now",done:"Done",timeTitle:"Time"}},t.PopupPosition={Bottom:"bottom",Top:"top"}}(jQuery,Syncfusion),function(e,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"],model:null,validTags:["div","span"],_setFirst:!1,angular:{terminal:!1},defaults:{showOnInit:!0,closeOnEscape:!0,closeIconTooltip:"close",enableAnimation:!0,allowDraggable:!0,height:"auto",minHeight:120,minWidth:200,maxHeight:null,maxWidth:null,enableModal:!1,position:{X:"",Y:""},containment:null,enableResize:!0,htmlAttributes:{},showHeader:!0,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"},locale:"en-US",faviconCSS:null,content:null,target:null,enablePersistence:!1,enabled:!0,isResponsive:!1,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",position:"data",animation:"data",closeIconTooltip:"string",tooltip:"data",allowDraggable:"boolean",enableModal:"boolean",enableResize:"boolean",isResponsive:"boolean",showHeader:"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"},_setModel:function(i){for(var s in i)switch(s){case"closeIconTooltip":this._dialogClose.attr("title",i[s]);break;case"tooltip":this._tooltipText(i[s]);break;case"title":this.model.title=i[s],this._ejDialog.find("span.e-title").length<=0?this._addTitleText():this._ejDialog.find("span.e-title").html(i[s]),this._updateCaptionWidth();break;case"width":this.model.width=i[s],this._changeSize(),this._updateCaptionWidth();break;case"height":this.model.height=i[s],this._changeSize();break;case"position":this.model.position=i[s],this._dialogPosition();break;case"cssClass":this._changeSkin(i[s]);break;case"showRoundedCorner":this._roundedCorner(i[s]);break;case"contentType":this._appendContent(i[s]);break;case"enabled":this.model.enabled=i[s],this._enabledAction(i[s]);break;case"contentUrl":this.model.contentUrl=i[s],this._appendContent(this.model.contentType);break;case"content":case"target":this._ejDialog.appendTo(e(i[s])),this.model.target=this.model.content=i[s],this._dialogPosition();break;case"containment":this._setDragArea(i[s]),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[s]=this._target,this.model.enableModal&&this._createOverlay(),this._dialogTitlebar.ejDraggable({dragArea:this._target});break;case"locale":this.localizedLabels=this._getLocalizedLabels(),this._setLocaleCulture(this.localizedLabels),this._tooltipText(this.model.tooltip);break;case"minHeight":this.model.minHeight=i[s],this._ejDialog.css("minHeight",i[s]),this._resetScroller(),this._resizeDialog();break;case"minWidth":this.model.minWidth=i[s],this._ejDialog.css("minWidth",i[s]),this._resetScroller(),this._resizeDialog();break;case"maxHeight":this.model.maxHeight=i[s],this._ejDialog.css("maxHeight",i[s]),this._resetScroller(),this._resizeDialog();break;case"maxWidth":this.model.maxWidth=i[s],this._ejDialog.css("maxWidth",i[s]),this._resetScroller(),this._resizeDialog();break;case"zIndex":this._ejDialog.css("z-index",i[s]);break;case"faviconCSS":this.model.faviconCSS=i[s],this._favIcon(),this._updateCaptionWidth();break;case"isResponsive":this.model.isResponsive=i[s],this.model.isResponsive?this._ejDialog.addClass("e-dialog-resize"):this._ejDialog.removeClass("e-dialog-resize"),this._wireResizing();break;case"allowDraggable":this.model.allowDraggable=i[s],i[s]?this._enableDrag():this._dialogTitlebar.removeClass("e-draggable");break;case"enableResize":this.model.enableResize=i[s],i[s]?this._enableResize():(this._ejDialog.removeClass("e-resizable"),this._ejDialog.find(".e-resize-handle").remove()),this._reRenderScroller();break;case"showHeader":this.model.showHeader=i[s],i[s]?(this._renderTitleBar(),this._iconsRender(this.model.actionButtons),this.model.faviconCSS&&(this._dialogFavIcon=!1,this._favIcon()),this._enableDrag(),this._updateScroller(this._ejDialog.outerHeight(!0)-this._dialogTitlebar.outerHeight(!0),this._ejDialog.width()-2)):(this._ejDialog.find(".e-titlebar").remove(),this._updateScroller(this._ejDialog.outerHeight(!0),this._ejDialog.width()-2));break;case"enableRTL":this.model.enableRTL=i[s],this.model.faviconCSS&&this._favIcon(),i[s]?(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[s])),this.model.actionButtons=i[s],this._updateCaptionWidth();break;case"enableModal":this._enableModal(i[s]);break;case"htmlAttributes":this._addAttr(i[s])}},_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._cloneElement.remove(),this._isOpen=!1},keyConfigs:[37,38,39,40],_init:function(){this._widthPercent=null,this._heightPercent=null,this._windowSize={outerWidth:e(window).outerWidth(),outerHeight:e(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._renderControl(),this._wireEvents(),scrObj=this._ejDialog.closest(".e-dialog.e-js").data("ejDialog"), scrObj&&scrObj._resetScroller(),this.hidden=!1},_setLocaleCulture:function(e){this.defaults.closeIconTooltip===this.model.closeIconTooltip&&(this.model.closeIconTooltip=e.closeIconTooltip),JSON.stringify(this.model.tooltip)===JSON.stringify(this.defaults.tooltip)&&(this.model.tooltip=e.tooltip)},_setDragArea:function(i){t.isNullOrUndefined(i)?this._target=null:"string"==typeof i?("parent"==i&&(this._target=e(this.element).parent()),"document"==i.toLowerCase()&&(this._target=e(document)),"window"==i.toLowerCase()?this._target=e(window):e(i).length>0&&(this._target=e(i))):"object"==typeof i?i.length>0&&(this._target=i):this._target=null},_addAttr:function(t){var i=this;e.map(t,function(e,t){"class"==t?i._ejDialog.addClass(e):"disabled"==t&&"disabled"==e?(i.model.enabled=!1,i._enabledAction(!1)):i._ejDialog.attr(t,e)})},_tooltipText:function(t){e.extend(this.model.tooltip,t),this._dialogClose.hasClass("e-close")&&this._dialogClose.attr("title",this.model.tooltip.close),this._dialogCollapsible.hasClass("e-collapse-arrow")&&this._dialogCollapsible.attr("title",this.model.tooltip.collapse),this._dialogCollapsible.hasClass("e-expand-arrow")&&this._dialogCollapsible.attr("title",this.model.tooltip.expand),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),this._dialogMinimize.hasClass("e-minimize")&&this._dialogMinimize.attr("title",this.model.tooltip.minimize),this._dialogMinimize.hasClass("e-restore")&&this._dialogMinimize.attr("title",this.model.tooltip.restore),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 e;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")+"_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)||(e=this.model.target):e=this._target,this._ejDialog.appendTo(t.isNullOrUndefined(e)?document.body:e),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()._sizeInPercent(),"ajax"!=this.model.contentType&&(this.model.showOnInit&&this.open()?this._setContainerSize()._resetScroller():this._setHiddenDialogSize()),this._roundedCorner(this.model.showRoundedCorner),this._enabledAction(this.model.enabled),"auto"==this._sizeType.width&&(this._maxWidth=this.model.width),"auto"==this._sizeType.height&&(this._maxHeight=this.model.height)},_setContainerSize:function(){if("auto"!=this.model.height){var t=this._ejDialog.outerHeight()-e(this._ejDialog.find("div.e-titlebar")).outerHeight()-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 e=t.buildTag("div.e-icon e-resize-handle");e.appendTo(this._ejDialog),this._resizeDialog()}return this},_changeSkin:function(e){this.model.cssClass!=e&&this._ejDialog.removeClass(this.model.cssClass).addClass(e)},_enableModal:function(e){e?this._isOpen&&this._createOverlay():this._overLay&&this._overLay.remove()},_enabledAction:function(e){e?(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"),"string"!=typeof this._elementTitle&&(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()},_addTitleText:function(){return this.model.title&&(this._titleText=t.buildTag("span.e-title",this.model.title).prependTo(this._dialogTitlebar)),this},_updateCaptionWidth:function(){var e=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-e),this},_iconsRender:function(e){for(var t=0;t0?(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:"no",frameborder:0,src:this.model.contentUrl}),this.element.appendTo(this.contentDiv).append(this.iframe).show()),this.model.enableRTL&&e(this.iframe).load(function(){s.iframe.contents().find("body").css("direction","rtl")}),this._trigger("contentLoad",{contentType:i,url:this.model.contentUrl})):"image"==i?(a=t.buildTag("img.e-images","","",{src:this.model.contentUrl}),this.element.append(a).show().appendTo(this.contentDiv),e(a).load(function(){s._dialogPosition()}),this._trigger("contentLoad",{contentType:i,url:this.model.contentUrl})):this.element.show().appendTo(this.contentDiv),this._ejDialog.find("div.e-resize-handle").length>0?this.contentDiv.insertBefore(this._ejDialog.find("div.e-resize-handle")):this.contentDiv.appendTo(this._ejDialog)},_roundedCorner:function(e){this._ejDialog[e?"addClass":"removeClass"]("e-corner")},_reRenderScroller:function(){if(this.scroller!=i&&(this.scroller.refresh(),!this.model.enableRTL)){if(this.scroller._vScrollbar&&this.scroller._vScrollbar._scrollData&&this.model.enableResize){var e=this.scroller._vScrollbar.element.find("> div.e-vscroll").height(),t=2,s=this._ejDialog.find("div.e-resize-handle").outerHeight();this.contentDiv.outerHeight()===this.scroller._vScrollbar.model.height+1&&(this.scroller._vScrollbar.model.height-=s+t,this.scroller._vScrollbar._scrollData.handle-=s,this.scroller._vScrollbar._scrollData.handleSpace-=s+t,this.scroller._vScrollbar._updateLayout(this.scroller._vScrollbar._scrollData),this.scroller._vScrollbar.element.find("> div.e-vscroll").height(e-s-t))}if((!this.scroller._vScrollbar||!this.scroller._vScrollbar._scrollData)&&this.scroller._hScrollbar&&this.scroller._hScrollbar._scrollData&&this.model.enableResize){var a=this.scroller._hScrollbar.element.find("> div.e-hscroll").width(),t=2,s=this._ejDialog.find("div.e-resize-handle").outerWidth();this.scroller._hScrollbar.model.width-=s+t,this.scroller._hScrollbar._scrollData.handle-=s+t,this.scroller._hScrollbar._scrollData.handleSpace-=s+t,this.scroller._hScrollbar._updateLayout(this.scroller._hScrollbar._scrollData),this.scroller._hScrollbar.element.find("> div.e-hscroll").width(a-s-t)}}},_dialogMaxZindex:function(){var t,i,s,a=this.element.parents();return t=e("body").children(),index=t.index(this.popup),t.splice(index,1),e(t).each(function(e,t){a.push(t)}),i=e(this.model.target).children(),cindex=i.index(this.popup),i.splice(cindex,1),e(i).each(function(e,t){a.push(t)}),s=Math.max.apply(s,e.map(a,function(t){if("static"!=e(t).css("position"))return parseInt(e(t).css("z-index"))||1})),!s||s<1e4?s=1e4:s+=1,s},_setZindex:function(){var e=this._dialogMaxZindex();this.model.zIndex<=e&&this._ejDialog.css({zIndex:e+1})},_createOverlay:function(){var i,s,a=this._ejDialog.css("zIndex");t.isNullOrUndefined(this._overLay)||this._overLay.remove(),this._overLay=t.buildTag("div#"+this.element.attr("id")+"_overLay.e-overlay","",{zIndex:a-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 s=t.isNullOrUndefined(this.model.containment)||t.isNullOrUndefined(this._target)?"fixed":"absolute",n=t.isNullOrUndefined(i)||"fixed"==s?0:"static"!=e(i).css("position").toLowerCase()?0:e(i).offset().left,o=t.isNullOrUndefined(i)||"fixed"==s?0:"static"!=e(i).css("position").toLowerCase()?0:e(i).offset().top;this._overLay.css({top:o,left:n,position:s})},_sendAjaxOptions:function(t,i){t.addClass("e-load");var s=this,a=this.model.title,n={success:function(e){try{s._ajaxSuccessHandler(e,t,i,a)}catch(e){}},error:function(e){try{s._ajaxErrorHandler({status:e.status,responseText:e.responseText,statusText:e.statusText},t,i,a)}catch(e){}},complete:function(){try{s._setContainerSize(),s._resetScroller(),s.model.showOnInit||s._setHiddenDialogSize()}catch(e){}}};e.extend(!0,n,this.model.ajaxSettings),this._sendAjaxRequest(n)},_setHiddenDialogSize:function(){this._isOpen||(this._ejDialog.css({display:"block",visibility:"hidden"}),this._setContainerSize()._resetScroller(),this._ejDialog.css({display:"none",visibility:""}))},_sendAjaxRequest:function(t){e.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(e,t,i){t.removeClass("e-load"),t.html(e).addClass("e-dialog-loaded").appendTo(this._ejDialog),t.appendTo(this.contentDiv),this._dialogPosition(),this.model.showOnInit&&this.open(),this._trigger("ajaxSuccess",{data:e,url:i})},_ajaxErrorHandler:function(e,t,i){t.addClass("e-dialog-loaded").appendTo(this.contentDiv),this._dialogPosition().open(),this._trigger("ajaxError",{data:e,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"),"close"==this.model.closeIconTooltip&&"Close"==this.model.tooltip.close?this._dialogClose.appendTo(this._dialogTitlebar).attr("title",this.model.tooltip.close):"close"!=this.model.closeIconTooltip&&"Close"==this.model.tooltip.close?this._dialogClose.appendTo(this._dialogTitlebar).attr("title",this.model.closeIconTooltip):"close"==this.model.closeIconTooltip&&"Close"!=this.model.tooltip.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-expand-arrow").removeClass("e-collapse-arrow"):this._dialogCollapsible.appendTo(this._dialogTitlebar).attr("title",this.model.tooltip.collapse).addClass("e-collapse-arrow").removeClass("e-expand-arrow"),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-minimize"):this._dialogMinimize.appendTo(this._dialogTitlebar).attr("title",this.model.tooltip.minimize).addClass("e-minimize").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 e-unpin",null,null).attr("tabIndex","0"),this.dialogPin?this._dialogPin.appendTo(this._dialogTitlebar).attr("title",this.model.tooltip.unPin):this._dialogPin.appendTo(this._dialogTitlebar).attr("title",this.model.tooltip.pin),this._on(this._dialogPin,"touchstart click",this._pinClick)},_favIcon:function(){if(this._dialogFavIcon)e=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 e=t.util.buildTag("span.e-dialog-custom","",{},{role:"presentation"});e.appendTo(this._dialogFavIcon),this._dialogFavIcon.appendTo(this._dialogTitlebar)}this.model.faviconCSS?e.addClass(this.model.faviconCSS):this._dialogFavIcon.remove(),this._dialogFavIcon.css("float",this.model.enableRTL?"right":"left")},_setSize:function(){var e=this.model;return this._ejDialog.css({width:e.width,minWidth:e.minWidth,maxWidth:e.maxWidth}),this._ejDialog.css({height:e.height,minHeight:e.minHeight,maxHeight:e.maxHeight}),this._dialogPosition(),this},_resetScroller:function(){var i,s=this._ejDialog.outerHeight(!0)-e(this._ejDialog.find("div.e-titlebar")).outerHeight(!0),a={width:this._ejDialog.width()-2,enableRTL:this.model.enableRTL,height:s};this.element.css({height:"auto","max-width":"","max-height":"",width:""}),"auto"==this.model.height&&(this.element.height()0&&(i=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(),"auto"!=this.model.height&&"100%"!=this.model.height?this.element.css({height:i}):this.element.css("height",this.model.height),"auto"!=this.model.height&&"100%"!=this.model.height||this.scroller._vScrollbar||this.element.css({"min-height":this.model.minHeight-e(this._ejDialog.find("div.e-titlebar")).outerHeight(!0)}),this.scroller._vScrollbar||"auto"==this.model.width||"100%"==this.model.width?this.scroller._vScrollbar||this.element.css("width",this.model.width):this.element.outerWidth(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(e,t){this.contentDiv.ejScroller({width:t,height:e,enableRTL:this.model.enableRTL}),this.scroller=this.contentDiv.data("ejScroller"),this._reRenderScroller()},_dragDialog:function(){var i=this;this._ejDialog.parents(".e-dialog-scroller");return this._dialogTitlebar.ejDraggable({handle:".e-titlebar",cursorAt:{top:0,left:0},dragArea:i._target,dragStart:function(e){return i._clickHandler(),!i.dialogPin&&i.model.allowDraggable&&i.model.enabled?i._trigger("dragStart",{event:e})?(e.cancel=!0,!1):void 0:(e.cancel=!0,!1)},drag:function(e){i._trigger("drag",{event:e})},dragStop:function(s){i._ejDialog.focus(),i.element.find("> .e-draggable.e-titlebar")&&(dragobject=e("#"+i.element.find("> .e-draggable.e-titlebar").attr("id")).data("ejDraggable"),dragobject&&dragobject.option("cursorAt",i.element.offset()));var a=this.helper.offsetParent().offset();i._trigger("dragStop",{event:s}),i.model.position.X=t.isNullOrUndefined(this.position.left)?parseInt(this.helper.css("left")):this.position.left-[a.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-[a.top+parseFloat(this.helper.offsetParent().css("border-top-width"))]},helper:function(){return e(i._ejDialog).addClass("dragClone")}}),this},_resizeDialog:function(){if(this.model.enableResize){var t,i=this,s=!1,a=parseInt(this.model.minWidth),n=parseInt(this.model.minHeight),o=parseInt(this.model.maxWidth),r=parseInt(this.model.maxHeight);return t=this._getParentObj(),isNaN(this.model.minWidth)&&this.model.minWidth.indexOf("%")>0&&(a=this._convertPercentageToPixel(t.outerWidth(),a)),isNaN(this.model.minHeight)&&this.model.minHeight.indexOf("%")>0&&(n=this._convertPercentageToPixel(t.outerHeight(),n)),isNaN(this.model.maxWidth)&&this.model.maxWidth.indexOf("%")>0&&(o=this._convertPercentageToPixel(t.innerWidth(),o)),isNaN(this.model.maxHeight)&&this.model.maxHeight.indexOf("%")>0&&(r=this._convertPercentageToPixel(t.innerHeight(),r)),this._ejDialog.find("div.e-resize-handle").ejResizable({minHeight:n,minWidth:a,maxHeight:r,maxWidth:o,handle:"e-widget-content",resizeStart:function(e){return!!i.model.enabled&&(s||i._trigger("resizeStart",{event:e}),s=!0,i.model.position={X:i._ejDialog.css("left"),Y:i._ejDialog.css("top")},void i._dialogPosition())},resize:function(t){var s=e(t.element).parents("div.e-dialog-wrap");i.model.height=e(s).outerHeight(),i.model.width=e(s).outerWidth(),i._setSize(),i._setContainerSize(),i._resetScroller(),i._updateCaptionWidth(),i._trigger("resize",{event:t}),i._sizeType={width:"px",height:"px"},scrObj=i._ejDialog.closest(".e-dialog.e-js").data("ejDialog"),scrObj&&scrObj._resetScroller()},resizeStop:function(t){i._ejDialog.focus(),i._sizeInPercent();var a=e(t.element).parents("div.e-dialog-wrap");i.model.height=e(a).outerHeight(),i.model.width=e(a).outerWidth(),i._setSize(),i._setContainerSize(),i._resetScroller(),s&&i._trigger("resizeStop",{event:t}),s=!1,i._setDimension()},helper:function(){return e(i._ejDialog)}}),this}},_dialogPosition:function(){return 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?(this._ejDialog.css("position","absolute"),this._ejDialog.css("left",this.model.position.X),this._ejDialog.css("top",this.model.position.Y)):this._centerPosition(),this},_centerPosition:function(){var i,s,a,n,o=0,r=0;t.isNullOrUndefined(this.model.target)&&(t.isNullOrUndefined(this._target)||e(this._target).is(e(document))||e(this._target).is(e(window)))?(n=document.documentElement,o=(e(window).outerWidth()>this._ejDialog.width()?(e(window).outerWidth()-this._ejDialog.outerWidth())/2:0)+(window.pageXOffset||n.scrollLeft),r=(e(window).outerHeight()>this._ejDialog.height()?(e(window).outerHeight()-this._ejDialog.outerHeight())/2:0)+(window.pageYOffset||n.scrollTop)):(i=e(t.isNullOrUndefined(this._target)?this.model.target:this._target),"static"==i.css("position")&&(s=i.offsetParent().offset(),a=i.offset(),o=a.left-s.left,r=a.top-s.top),i.outerWidth()>this._ejDialog.width()&&(o+=(i.outerWidth()-this._ejDialog.width())/2),i.outerHeight()>this._ejDialog.height()&&(r+=(i.outerHeight()-this._ejDialog.height())/2)),this._ejDialog.css({top:r,left:o}),this._ejDialog.css("position","absolute")},_closeClick:function(e){this.model.enabled&&(e.stopPropagation(),this.close(e))},_collapsibleClick:function(t){this.model.enabled&&(e(t.target).hasClass("e-collapse-arrow")?this._actionCollapse(t):e(t.target).hasClass("e-expand-arrow")&&this._actionExpand(t))},_actionCollapse:function(e){this._minimize||(this._dialogCollapsible&&this._dialogCollapsible.removeClass("e-collapse-arrow").addClass("e-expand-arrow"),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._ejDialog.removeClass("e-shadow"),this._ejDialog.css("minHeight","0"),this._ejDialog.height("auto"),this._trigger("collapse",{isInteraction:!!e}),this._collapsible=!0)},_actionExpand:function(e){this._minimize||(this._dialogCollapsible&&this._dialogCollapsible.removeClass("e-expand-arrow").addClass("e-collapse-arrow"),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._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:!!e}),this._collapsible=!1)},_maximizeClick:function(i){if(this.model.enabled){var s=e(i.target),a=this._dialogMaximize;s.hasClass("e-maximize")?(this._actionMaximize(),this._dialogTitlebar&&(this._dialogTitlebar.find(".e-restore").removeClass("e-restore").addClass("e-minimize"),this._dialogMinimize&&this._dialogMinimize.attr("title",this.model.tooltip.minimize)),s.removeClass("e-maximize").addClass("e-restore"),this._dialogMaximize.attr("title",this.model.tooltip.restore),this._hideIcon(!0)):s.hasClass("e-restore")&&(this._actionRestore(),s.removeClass("e-restore").addClass("e-maximize"),this._dialogMaximize.attr("title",this.model.tooltip.maximize),!t.isNullOrUndefined(a)&&e(a).hasClass("e-expand-arrow")&&(e(a).removeClass("e-expand-arrow").addClass("e-collapse-arrow"),this._dialogMaximize.attr("title",this.model.tooltip.collapse)),this._hideIcon(!0))}},_actionMaximize:function(){this._ejDialog.css("top","0px").css("left","0px").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,this._dialogCollapsible&&!t.isNullOrUndefined(this._dialogCollapsible.hasClass("e-expand-arrow"))&&(this._dialogCollapsible.removeClass("e-expand-arrow").addClass("e-collapse-arrow"),this._dialogCollapsible.attr("title",this.model.tooltip.collapse),this._ejDialog.find(".e-widget-content").parent().slideDown("fast")),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 s=e(i.target),a=this._dialogMinimize.hasClass("e-icon")&&this._dialogMinimize;s.hasClass("e-minimize")?(this._maximize&&this._setSize(),this._actionMinimize()):s.hasClass("e-restore")&&(this._actionRestore(),s.removeClass("e-restore").addClass("e-minimize"),this._dialogMinimize.attr("title",this.model.tooltip.minimize),!t.isNullOrUndefined(a)&&e(a).hasClass("e-expand-arrow")&&(e(a).removeClass("e-expand-arrow").addClass("e-collapse-arrow"),this._dialogMinimize.attr("title",this.model.tooltip.collapse)),this._hideIcon(!0))}},_actionMinimize:function(){var t;e(window).height()-this._ejDialog.height()+this.element.height()+14;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-minimize").removeClass("e-minimize").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._maximize=!1,this._minimize=!0},_hideIcon:function(i){var s=this._dialogCollapsible?this._dialogCollapsible:null;i?(t.isNullOrUndefined(s)||e(s).parent(".e-dialog-icon").show(),this._ejDialog.find("div.e-resize-handle").show()):(t.isNullOrUndefined(s)||e(s).parent(".e-dialog-icon").hide(),this._ejDialog.find("div.e-resize-handle").hide())},_pinClick:function(t){if(this.model.enabled){var i=e(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._ejDialog.css({position:"absolute",bottom:""}).addClass("e-shadow"),this._setSize()._resetScroller(),this._dialogTitlebar&&(this._dialogTitlebar.find(".e-minimize").parent().show(),this._dialogCollapsible&&(this._dialogCollapsible.removeClass("e-expand-arrow").addClass("e-collapse-arrow"),this._dialogCollapsible.attr("title",this.model.tooltip.collapse)))},_clickHandler:function(){var e=this._dialogMaxZindex();parseInt(this._ejDialog.css("zIndex"))-1&&this.model.allowDraggable&&!this.dialogPin&&(this._keyPressed(code,t.ctrlKey),t.preventDefault()),this.model.closeOnEscape&&27===code&&this.model.enabled&&(this.element.find(".e-js.e-dialog").first().is(":visible")||(this.close(t),t.preventDefault())),13===code&&this.model.enabled&&(e(t.target).hasClass("e-close")?this.close(t):(e(t.target).hasClass("e-collapse-arrow")||e(t.target).hasClass("e-expand-arrow"))&&this._collapsibleClick(t),e(t.target).hasClass("e-maximize")||e(t.target).hasClass("e-restore")&&e(t.target).is(this._dialogMaximize)?this._maximizeClick(t):(e(t.target).hasClass("e-minimize")||e(t.target).hasClass("e-restore")&&e(t.target).is(this._dialogMinimize))&&this._minimizeClick(t),(e(t.target).hasClass("e-pin")||e(t.target).hasClass("e-unpin"))&&this._pinClick(t)),9==code&&this.model.enableModal&&this._focusOnTab(t)},_focusOnTab:function(t){var i=this._ejDialog.find("a, button, :input, select, [tabindex]:not('-1')");i=e(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(e,t){switch(e){case 40:t?this.option("height",this._ejDialog.outerHeight()+3):this.option("position",{X:this._ejDialog.position().left,Y:this._ejDialog.position().top+3});break;case 39:t?this.option("width",this._ejDialog.outerWidth()+3):this.option("position",{X:this._ejDialog.position().left+3,Y:this._ejDialog.position().top});break;case 38:t?this.option("height",this._ejDialog.outerHeight()-3):this.option("position",{X:this._ejDialog.position().left,Y:this._ejDialog.position().top-3});break;case 37:t?this.option("width",this._ejDialog.outerWidth()-3):this.option("position",{X:this._ejDialog.position().left-3,Y:this._ejDialog.position().top})}},_sizeInPercent:function(){if(!this._enableWindowResize())return this;var e=this._getParentObj();return this._widthPercent="%"==this._sizeType.width?parseFloat(this.model.width):this._convertPixelToPercentage(e.outerWidth(),this._ejDialog.outerWidth()),this._heightPercent="%"==this._sizeType.height?parseFloat(this.model.height):this._convertPixelToPercentage(e.outerHeight(),this._ejDialog.outerHeight()),this._widthPercent>=100&&(this._widthPercent=100,this._ejDialog.outerWidth(e.outerWidth()),this.model.width=this._ejDialog.width()),this._heightPercent>=100&&(this._heightPercent=100,this._ejDialog.outerHeight(e.outerHeight()),this.model.height=this._ejDialog.height()),this},_getParentObj:function(){return e(t.isNullOrUndefined(this.model.containment)?t.isNullOrUndefined(this.model.target)?document:this.model.target:this.model.containment)},_convertPercentageToPixel:function(e,t){return Math.round(t*e/100)},_convertPixelToPercentage:function(e,t){return Math.round(t/e*100)},_reSizeHandler:function(){var t;return this._maximize?void this._resetScroller():(this._minimize||this._centerPosition(),t=this._getParentObj(),this._change=!1,this._windowSize.outerWidth!=e(window).outerWidth()?"%"==this._sizeType.width?this._percentageWidthDimension(t):this._pixelsWidthDimension(t):this._windowSize.outerHeight!=e(window).outerHeight()&&("%"==this._sizeType.height?this._percentageHeightDimension(t):this._pixelsHeightDimension(t)),this._change&&this._resizeContainer(t),void(this._windowSize={outerWidth:e(window).outerWidth(),outerHeight:e(window).outerHeight()}))},_setDimension:function(){t.isNullOrUndefined(this.model.maxWidth)?t.isNullOrUndefined(this._sizeType.width)?this._maxWidth=+this.model.width:("px"==this._sizeType.width||"auto"==this._sizeType.width)&&(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:("px"==this._sizeType.height||"auto"==this._sizeType.height)&&(this._maxHeight=this.model.height):this._maxHeight=this.model.maxHeight},_percentageWidthDimension:function(e){this._ejDialog.outerWidth(this._convertPercentageToPixel(e.outerWidth(),this._widthPercent)),this._change=!0},_percentageHeightDimension:function(e){this._ejDialog.outerHeight(this._convertPercentageToPixel(e.outerHeight(),this._heightPercent)),this._change=!0},_pixelsWidthDimension:function(t){e(t).outerWidth()<=this._ejDialog.outerWidth()&&this._setWidth(t),e(t).outerHeight()<=this._ejDialog.outerHeight()&&this._setHeight(t),parseInt(this._ejDialog.css("width"))0&&isNaN(this.model.height)&&this.model.height.indexOf("%")>0&&"auto"!=this.model.height)},_wireResizing:function(){e(window)[this._enableWindowResize()?"bind":"unbind"]("resize",e.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 t,i,s,a;return!!this._isOpen||1!=this._trigger("beforeOpen")&&(this.element.css("display","block"),this._setZindex(),this._minimize||this._maximize||this._dialogPosition(),t=this,i={},this._ejDialog.show(),this.model.enableAnimation&&(this._ejDialog.css({opacity:0}),"slide"==this.model.animation.show.effect?(a=this._ejDialog.css("left"),this._ejDialog.css({left:-this._ejDialog.width()}),i={left:a,opacity:1}):i={opacity:1}),this._ejDialog.animate(i,this.model.enableAnimation?Number(this.model.animation.show.duration):0,function(){t.model&&(t._ejDialog.eq(0).focus(),t._ejDialog.css({opacity:""}),t.contentDiv.find("a:visible:enabled, button:visible:enabled, :input:visible:enabled, select:visible:enabled").first().focus(),t._trigger("open"),t._updateCaptionWidth(),(t.model.maxHeight||t.model.maxWidth)&&(s=t._ejDialog.outerHeight(!0)-(t._dialogTitlebar?t._dialogTitlebar.outerHeight(!0):0),("auto"==t.model.height||"100%"==t.model.height)&&(s=t.model.height),t._updateScroller(s,t._ejDialog.width()-2)))}),1==this.model.enableModal&&this._createOverlay(),this._isOpen=!0,this.element.find("> .e-draggable.e-titlebar")&&(dragobject=e("#"+this.element.find("> .e-draggable.e-titlebar").attr("id")).data("ejDraggable"),dragobject&&dragobject.option("cursorAt",this.element.offset())),this)},close:function(e){var t,i,s;return!this._isOpen||!this.model.enabled||(t=!!e,1!=this._trigger("beforeClose",{event:e,isInteraction:t})&&(this._isOpen=!1,i=this,s={},this.model.enableAnimation&&(s="slide"==this.model.animation.hide.effect?{left:-this._ejDialog.width(),opacity:0}:{opacity:0}),this._ejDialog.animate(s,this.model.enableAnimation?Number(this.model.animation.hide.duration):0,function(){i._trigger("close",{event:e,isInteraction:t}),i._ejDialog.hide()}),this.model.enableModal&&this._overLay&&this._overLay.remove(),this))},isOpened:function(){return this.isOpen()},isOpen:function(){return this._isOpen},setTitle:function(e){return this.model.title=e,this._titleText.text(e),this._updateCaptionWidth(),this},setContent:function(e){return!!this.model.enabled&&(this.element.html(e),this._resetScroller(),this)},focus:function(){return this._setZindex(),this.element.focus(),this},minimize:function(){return this._actionMinimize(),e(this.wrapper.find(".e-minimize")[0]).parent().hide(),this},maximize:function(){return this._actionMaximize(),e(this.wrapper.find(".e-maximize")[0]).removeClass("e-maximize").addClass("e-restore"),this._dialogMaximize&&this._dialogMaximize.attr("title",this.model.tooltip.restore),this.contentDiv.show(),this._dialogTitlebar&&this._dialogTitlebar.find(".e-minimize").parent().show(),this},restore:function(){return this._actionRestore(),e(this.wrapper.find(".e-restore")[0]).removeClass("e-restore").addClass("e-maximize"),this._dialogMaximize&&this._dialogMaximize.attr("title",this.model.tooltip.maximize),this},pin:function(){return this.dialogPin=!0,e(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(){return this.dialogPin=!1,e(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(){return this._actionCollapse(),this},expand:function(){return this._actionExpand(),this}}),t.Dialog.Locale=t.Dialog.Locale||{},t.Dialog.Locale["en-US"]={tooltip:{close:"Close",collapse:"Collapse",restore:"Restore",maximize:"Maximize",minimize:"Minimize",expand:"Expand",unPin:"UnPin",pin:"Pin"},closeIconTooltip:"close"}}(jQuery,Syncfusion),function(t,i){i.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"]},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},watermarkText:null,height:"",width:"",popupHeight:"152px",popupWidth:"auto",maxPopupHeight:null,minPopupHeight:20,maxPopupWidth:null,minPopupWidth:0,targetID:null,template:null,headerTemplate:null,selectedItemIndex:null,selectedIndex:null,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"},observables:["value","selectedItemIndex","selectedIndex"],value:i.util.valueFunction("value"),selectedItemIndex:i.util.valueFunction("selectedItemIndex"),selectedIndex:i.util.valueFunction("selectedIndex"),enable:function(){this._visibleInput.hasClass("e-disable")&&(this.target.disabled=!1,this.model.enabled=!0,this._visibleInput.removeClass("e-disable"),this.dropdownbutton.removeClass("e-disable"),this.popupListWrapper.removeClass("e-disable"),this._isIE8&&this.drpbtnspan.removeClass("e-disable"),this.container.bind("mousedown",t.proxy(this._OnDropdownClick,this)),"visualmode"==this.model.multiSelectMode&&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._visibleInput.addClass("e-disable"),this.popupListWrapper.addClass("e-disable"),this.dropdownbutton.addClass("e-disable"),this._isIE8&&this.drpbtnspan.addClass("e-disable"),"visualmode"==this.model.multiSelectMode&&this._ulBox.addClass("e-disable"),this.container.unbind("mousedown",t.proxy(this._OnDropdownClick,this)),this._unwireEvents(),this.wrapper.removeAttr("tabindex"),this._isPopupShown()&&this._hideResult())},getValue:function(){return this._visibleInput.val()},_setValue:function(e){i.isNullOrUndefined(e)||(this._raiseEvents=!1,i.isNullOrUndefined(this.model.text)||this.unselectItemByText(this.model.text),this._raiseEvents=!0,this.selectItemByValue(e))},_setText:function(e){e&&(this._raiseEvents=!1,this.unselectItemByText(this.model.text),this._raiseEvents=!0,this.selectItemByText(e))},_setItemValue:function(e){this.model.itemValue=e},_changeWatermark:function(e){return!!this.model.enabled&&void(this._isWatermark?this._visibleInput.attr("placeholder",e):this._hiddenSpan.text(e))},hidePopup:function(){return!!this.model.enabled&&void(this.ultag.find("li").length>0&&this._hideResult())},showPopup:function(){return!!this.model.enabled&&void(this.ultag.find("li").length>0&&this._showResult())},clearText:function(){this._clearTextboxValue(),this._isWatermark||this._setWatermark()},addItem:function(e){var i,s,a,n,o,r;if(!this.model.enabled||!e||(this._mapFields(),i=t.isArray(e)?e:[e],i.length<1))return!1;for(s=this.mapFld,a={_id:null,_imageUrl:null,_imageAttributes:null,_spriteCSS:null,_text:null,_value:null,_htmlAttributes:null,_selected:null,_category:null},a._id=i[0][s._id]?s._id:"id",a._imageUrl=i[0][s._imageUrl]?s._imageUrl:"imageUrl",a._imageAttributes=i[0][s._imageAttributes]?s._imageAttributes:"imageAttributes",a._spriteCSS=i[0][s._spriteCSS]?s._spriteCSS:"spriteCssClass",a._text=i[0][s._text]?s._text:"text",a._value=i[0][s._value]?s._value:"value",a._htmlAttributes=i[0][s._htmlAttributes]?s._htmlAttributes:"htmlAttributes",a._selected=i[0][s._selected]?s._selected:"selected",a._category=i[0][s._category]?s._category:"groupBy",this._generateLi(i,a),this._virtualUl.append(t(this.dummyUl).clone(!0)),this.ultag.append(this.dummyUl),n=this.dummyUl,o=0;o=0){if(t.inArray(s,this._selectedIndices)==-1)for(n=0;n0&&!(t.inArray(parseInt(i[s]),this._disabledItems)>-1)&&(index=t.inArray(i[s],this._disabledItems),this._setClass(this._getLi()[parseInt(i[s])],"e-disable"),this._disabledItems.push(parseInt(i[s])),this.model.disableItemsByIndex=String(this._disabledItems.join(",")))},enableItemsByIndices:function(e){this._enableItemByIndex(e)},enableItemByIndex:function(e){this._enableItemByIndex(e)},_enableItemByIndex:function(e){var i,s,a=this._toArray(e,!1);for(this.model.enableItemsByIndex=e,s=0;s0&&t.inArray(parseInt(a[s]),this._disabledItems)>-1&&!isNaN(parseInt(a[s]))&&(i=t.inArray(parseInt(a[s]),this._disabledItems),this._removeClass(this._getLi()[parseInt(a[s])],"e-disable"),this._disabledItems.splice(i,1));this.model.enableItemsByIndex=null,this.model.disableItemsByIndex=this._disabledItems.join(this.model.delimiterChar)},_validateDelimiter:function(e){return 1!=this._trim(e).length||/^[a-zA-Z0-9]+$/.test(e)?",":e},_removeText:function(e){var i=this.element[0].value.split(this.model.delimiterChar),s=this._visibleInput[0].value.split(this.model.delimiterChar),a=t.inArray(e,s);a>=0&&(i.splice(a,1),s.splice(a,1)),this.element[0].value=i.join(this.model.delimiterChar),this._visibleInput[0].value=s.join(this.model.delimiterChar)},_addText:function(e){var t,i,s,a;if(this._checkContains(e))return!1;for(t=["element","_visibleInput"],s=0;s0&&this._selectCheckedItem(this._selectedIndices),null!=this.model.disableItemsByIndex&&this._disableItemByIndex(this.model.disableItemsByIndex),null!=this.model.enableItemsByIndex&&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=null!=this.model.selectedIndex?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 e,s,a,n;for(this.inputElement=i.buildTag("input.e-dropdownlist#"+this._id+"_input","",{},{type:"text","data-role":"none"}),this.inputElement.insertAfter(this.element),this.optionDiv=i.buildTag("div#"+this._id+"_list"),this.optionDiv.insertAfter(this.inputElement),this.optionUl=i.buildTag("ul"),this.optionDiv.append(this.optionUl),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.selectOptionItems=this.element.children("option"),s=this.selectOptionItems.length,this.optionDummyUl=t(),e=0;e0&&o.select(s)}return this.model.allowVirtualScrolling&&o.requiresCount(),this.model.itemsCount>0&&o.take(this.model.itemsCount),t=this.model.dataSource.dataSource,n&&(t&&t.url&&!t.url.match(n.tableName+"$")||t&&!t.url||!t)&&(i.isNullOrUndefined(n.tableName)||o.from(n.tableName)),o},_addLoadingClass:function(){this._isPopupShown()?this.popupListWrapper.addClass("e-load"):(this.dropdownbutton.addClass("e-load"),this.drpbtnspan.removeClass("e-icon e-down-arrow")),this.model.readOnly=!0},_removeLoadingClass:function(){this.dropdownbutton.removeClass("e-load"),this.drpbtnspan.addClass("e-icon e-down-arrow"),this.model.readOnly=!1,this.popupListWrapper.removeClass("e-load")},_renderDropdown:function(){this.wrapper=i.buildTag("span.e-ddl e-widget "+this.model.cssClass+"#"+this._id+"_wrapper","",{},{tabindex:"0",accesskey:this.element.attr("accesskey")}),this.container=i.buildTag("span.e-in-wrap e-box "+this.model.cssClass+"#"+this._id+"_container"),this.element.removeAttr("accesskey"),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=i.buildTag("span.e-icon e-down-arrow","",{},{"aria-label":"select",unselectable:"on"}),this.dropdownbutton=i.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=i.buildTag("input#"+this._id+"_hidden","",{}).insertAfter(this.element),this._visibleInput.addClass("e-input "+this.model.cssClass),this._setAttr(this._visibleInput[0],{readonly:!0,tabindex:-1,"data-role":"none"}),this._isWatermark||(this._hiddenSpan=i.buildTag("span.e-input e-placeholder ").insertAfter(this.element),this._hiddenSpan.text(this.model.watermarkText),this._hiddenSpan.css("display","none"),this._hiddenSpan.bind("mousedown",t.proxy(this._OnDropdownClick,this))),this._checkNameAttr(),this._setDimentions(),this._RightToLeft(),this.ddWidth=this.dropdownbutton.outerWidth()>0?this.dropdownbutton.outerWidth():24,this.container.bind("mousedown",t.proxy(this._OnDropdownClick,this))},_checkNameAttr:function(){this._name=i.isNullOrUndefined(this.element.attr("name"))?this._id:this.element.attr("name"),this.element.attr("name",this._name)},_addAttr:function(e){var i=this;t.map(e,function(e,t){"class"==t?i.wrapper.addClass(e):"name"==t?i._visibleInput.attr(t,e):"required"==t?i.element.attr(t,e):"disabled"==t&&"disabled"==e?i.disable():"readOnly"==t&&"readOnly"==e?i.model.readOnly=!0:i.wrapper.attr(t,e)})},_renderBoxModel:function(){return"visualmode"==this.model.multiSelectMode&&(this._ulBox=i.buildTag("ul.e-ul e-boxes"),this.container.prepend(this._ulBox),this._ulBox.css("min-height","30px"),this._ulBox.css("display","none"),void this._on(this.container,"click",function(e){if(!this.model.enabled)return!1;var i=t(e.target);i.hasClass("e-options")&&(!e.ctrlKey&&i.siblings().hasClass("e-active")&&this._removeActive(),i.hasClass("e-active")?i.removeClass("e-active"):i.addClass("e-active")),!e.ctrlKey&&i.hasClass("e-boxes")&&this._removeActive()}))},_renderPopupPanelWrapper:function(){var e=t("#"+this.element.context.id+"_popup_wrapper").get(0);e&&t(e).remove(),this.popupPanelWrapper=i.buildTag("div#"+this._id+"_popup_wrapper"),t("body").append(this.popupPanelWrapper),this.popupListWrapper=i.buildTag("div.e-ddl-popup e-box e-widget e-popup#"+this._id+"_popup_list_wrapper","",{display:"none",overflow:"hidden"}),this.popupList=i.buildTag("div#"+this._id+"_popup",{tabIndex:0}),this.popupList.addClass(this.model.cssClass),this.popup=this.popupList,this.popupScroller=i.buildTag("div"),this.ultag=i.buildTag("ul.e-ul","",{},{role:"listbox"}),this.popupScroller.append(this.ultag),this.popupList.append(this.popupScroller),this.model.headerTemplate&&(this.headerTemplate=t("
").append(this.model.headerTemplate),this.popupListWrapper.append(this.headerTemplate)),this.popupListWrapper.append(this.popupList),this.popupPanelWrapper.append(this.popupListWrapper),this.ultag.on({mouseenter:t.proxy(this._OnMouseEnter,this),mouseleave:t.proxy(this._OnMouseLeave,this),click:t.proxy(this._OnMouseClick,this)},"li:not('.e-category')"),t(window).on("resize",t.proxy(this._OnWindowResize,this))},_updateText:function(){this.model.text=""==this._visibleInput.val()?null:this._visibleInput.val()},_updateValue:function(e){this.value(""==e?null:e)},_setGroupingAndSorting:function(e,t){var i,s,a;if(this.model[e]=t,i=this.model.text,this._updateValue(""),this._selectedIndices=[],this.ultag.empty(),this._showFullList(),this.model.showCheckbox&&i)for(s=i.split(this.model.delimiterChar),a=0;a.e-category").length>0)for(this.popupListWrapper.addClass("e-atc-popup"),e=0;e.e-category").length;e++)i=t(s).find(">.e-category").eq(0).first().nextUntil(".e-category").get(),this._setSortList(s,i);else t(s).children(">.e-category").remove(),i=t(s).children("li").get(),this._setSortList(s,i);this.itemsContainer=t(s)},_setSortList:function(e,i){i.sort(function(e,i){var s=t(e).text().toUpperCase(),a=t(i).text().toUpperCase();return sa?1:0}),"descending"==this.model.sortOrder&&i.reverse(),(this.model.allowGrouping||t(e).find(">.e-category").length>0)&&(t(e).append(t("
  • ").text(t(e).find(">.e-category").eq(0).text()).addClass("e-category")),t(e).find(">.e-category").eq(0).remove()),t.each(i,function(i,s){t(e).append(s)})},_renderPopupList:function(){this._doDataBind(),this._renderRemaining()},_renderRemaining:function(){var e=this;this._dropbtnRTL(),this.model.enableFilterSearch&&this._enableSearch(),this.model.enablePopupResize&&this._enablePopupResize(),this.model.allowVirtualScrolling&&"normal"==this.model.virtualScrollMode&&this._totalCount&&this._totalCount>0&&(this._totalHeight=29*this._totalCount,this._totalPages=this._totalCount/(29*this.model.itemsCount),this._loadedItemHeight=29*this._getLi().length,this._getLi().attr("page",0),this._virtualPages=[0],this.ultag.append(t("").addClass("e-virtual").css({height:this._totalHeight-this._loadedItemHeight,display:"block"}))),this._virtualUl=this.ultag.clone(!0),this._setListWidth(),this._setListHeight(),this._setListPosition(),this.popupScroller.css({height:"",width:""}),this.popupList.ejScroller({height:this._getPopupHeight(),width:0,scrollerSize:20,scroll:function(t){e.model.allowVirtualScrolling&&e._onScroll(t)}}),this.scrollerObj=this.popupList.ejScroller("instance"),this.popupList.find("div.e-scrollbar div").attr("unselectable","on"),this.popupListWrapper.css({display:"none",visibility:"visible"}),this._isSingleSelect()||(this.model.showCheckbox?this._checkboxHideShow(this.model.showCheckbox):this._multiItemSelection(this._getLi())),this._setUncheckAll(this.model.uncheckAll),this._changeSkin(this.model.cssClass),this.model.showPopupOnLoad&&this._showResult()},_enableSearch:function(){this.model.enableFilterSearch&&(this.inputSearch||(this.inputSearch=i.buildTag("input#"+this._id+"_inputSearch.e-input","",{},{type:"text","data-role":"none"}),this.popupListWrapper.prepend(t("").addClass("e-atc e-search").append(t("").addClass("e-in-wrap ").append(this.inputSearch).append(t("").addClass(" e-icon e-isearch")))),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(e){var s,a,n=this,o="mozilla"==i.browserInfo().name?e.charCode:e.keyCode;t.inArray(o,[38,40,13])!=-1&&this.ultag.find("li.e-nosuggestion").length<=0?13==o?this._OnKeyUp(e):this._OnKeyDown(e):(this._activeItem=-1,this._queryString=this.inputSearch.val(),""==this._queryString&&this._virtualUl?(a={searchString:this._queryString,searchQuery:null,items:this._rawList},this._trigger("search",a),this._resetList(),this._updateSelectedIndexByValue(this.value()),this._refreshScroller(),this._setListPosition()):(this._mapFields(),s=this._addSearchQuery(i.Query(),!this._isPlainType(this._rawList)),a={searchString:this._queryString,items:this._rawList,searchQuery:s},this.popupListWrapper.find(".e-atc.e-search .e-isearch").addClass("e-iclose").removeClass("e-isearch"),this._on(this.popupListWrapper.find(".e-atc.e-search .e-iclose"),"mousedown",this._refreshSearch),this._trigger("search",a)||n._filterSearch(s,a)))},_refreshSearch:function(){this._resetSearch(),this._refreshPopup()},_filterSearch:function(e,t){var s=!1,a=t.result?t.result:i.DataManager(this._rawList).executeLocal(e);0==a.length&&(s=!0,a.push("No suggestions")),this.popupListItems=a,this.ultag.empty(),this._isPlainType(this.popupListItems)?this._plainArrayTypeBinding(a):this._objectArrayTypeBinding(a,"search"),s&&1==this.ultag.find("li").length&&this.ultag.find("li").eq(0).addClass("e-nosuggestion"),this.model.showCheckbox&&!s&&this._appendCheckbox(this._getLi()),this._onSearch=!0,this._setValue(this.value()),this._onSearch=!1,this._updateSelectedIndexByValue(this.value()),this._refreshScroller(),this._setListPosition()},_updateSelectedIndexByValue:function(e){var t,i,s;if(e&&this.model.enableFilterSearch){for(this._selectedIndices=this.model.selectedItems=this.model.selectedIndices=[],this._virtualList=this._virtualUl.children("li:not('.e-category')"),t=this._toArray(e),i=0;i").append(this._virtualUl)),this._virtualUl.find(".e-chkbox-wrap").remove()),this.ultag.empty().append(this._virtualUl.children().clone(!0)),this.model.showCheckbox&&this._appendCheckbox(this._getLi()),this._onSearch=!0,this._setValue(this.value()),this._onSearch=!1},_addSearchQuery:function(e,t){var i,s="";return t&&(i=this.model.fields,s=i&&i.text?i.text:"text"),this._queryString&&e.where(s,this.model.filterType,this._queryString,!this.model.caseSensitiveSearch),this.model.itemsCount>0&&e.take(this.model.itemsCount),e},_targetElementBinding:function(){var e,i,s,a,n,o=this.element.parents().last();if(this.docbdy=this.model.targetID?o.find("#"+this.model.targetID):this.optionDiv?this.optionDiv:null,!this.docbdy)return!1;if(this.itemsContainer="UL"==this.docbdy[0].nodeName?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"),e=0;e.e-category").length;e++)i=this.itemsContainer.find(">.e-category").eq(e),i.replaceWith(t("
  • ").text(i.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([]),s=0;s0){for(s=0;s=t(a.popupList).find("ul,ol").height()-t(a.popupList).height()&&a._rawList.length=0;s--)if(this._virtualPages[s]"),l=n?(s-1)*o*29-29*(i*o+o):s*o*29-29*(i*o+o),0!=l&&r.append(t("").addClass("e-virtual").css({display:"block",height:l})),this._mapFields(),this._generateLi(e,this.mapFld),t(this.dummyUl).attr("page",s),n&&t(this.dummyUl).slice(0,o).attr("page",s-1),this.model.showCheckbox&&this._appendCheckbox(this.dummyUl),r.append(this.dummyUl),d=29*(s*o+o),d=null!=a?a*o*29-d:this.ultag.height()-d,0!=d&&r.append(t("").addClass("e-virtual").css({display:"block",height:d})),h=this.ultag.find("li[page="+i+"]").last(),h.next().remove(),r.children().insertAfter(h),this._virtualPages.push(s),n&&this._virtualPages.push(s-1),c=0;c0&&_.setAttribute("data-value","object"==typeof m?JSON.stringify(m):m),i.isNullOrUndefined(l)||""===l||_.setAttribute("id",l),i.isNullOrUndefined(p)||""==p||this._setAttr(_,p),this.model.template?t(_).append(this._getTemplatedString(e[a])):(i.isNullOrUndefined(d)||""==d||(n=document.createElement("img"),this._setClass(n,"e-align")._setAttr(n,{src:d,alt:u}),h&&""!=h&&this._setAttr(n,h),_.appendChild(n)),i.isNullOrUndefined(c)||""==c||(o=document.createElement("div"),this._setClass(o,"div.e-align "+c+" sprite-image"),_.appendChild(o)),g&&this._setClass(_,"chkselect"),i.isNullOrUndefined(u)&&(u=String(u)),r=document.createElement("span"),r.innerHTML=u,this._setClass(r,"e-ddltxt"),_.innerHTML+=r.outerHTML),this._setAttr(_,{role:"option",unselectable:"on"}),this.dummyUl.push(_)}},_setAttr:function(e,t){var i,s,a;if("string"==typeof t)i=t.replace(/['"]/g,"").split("="),2==i.length&&e.setAttribute(i[0],i[1]);else for(s in t)if("styles"!=s&&"style"!=s||"object"!=typeof t[s])e.setAttribute(s,t[s]);else for(a in t[s])e.style[a]=t[s][a];return this},_setClass:function(e,t){return e.className+=" "+t,this},_removeClass:function(e,t){var i=e.className.indexOf(t);return i>=0&&(e.className=0!=i&&" "===e.className[i-1]?e.className.replace(" "+t,""):e.className.replace(t,"")),this},_hasClass:function(e,t){return e.className.indexOf(t)>=0},_swapUnCategorized:function(e){t(e).each(function(t,i){if(!i.key){for(var s=t;s>0;s--)e[s]=e[s-1];return e[s]=i,!1}})},_getField:function(e,t){return i.pvt.getObject(t,e)},_getTemplatedString:function(e){for(var t,i,s=this.model.template,a=s.indexOf("${"),n=s.indexOf("}");a!=-1&&n!=-1;)t=s.substring(a,n+1),i=t.replace("${","").replace("}",""),s=s.replace(t,this._getField(e,i)),a=s.indexOf("${"),n=s.indexOf("}");return s},_setWatermark:function(){null!=this.model.watermarkText&&""==this.element.val()&&""==this._trim(this._visibleInput.val())&&(this._isWatermark?this._visibleInput.attr("placeholder",this.model.watermarkText):this._hiddenSpan.css("display","block").text(this.model.watermarkText),"visualmode"==this.model.multiSelectMode&&this._ulBox&&0==this._ulBox.find("li").length&&this._swapUlandInput(!1))},_checkboxHideShow:function(e){if(e){this.listitems=this._getLi();var t=this.listitems.find("input[type=checkbox]");0==t.length&&this._appendCheckbox(this.listitems)}else this._removeCheck(this.popupList);this.model.showCheckbox=e},_setCheckAll:function(e){!this._isSingleSelect()&&e?this.checkAll():this.model.checkAll=!1},_setUncheckAll:function(e){!this._isSingleSelect()&&e?this.uncheckAll():this.model.uncheckAll=!1},checkAll:function(){var e,s,a=this._selectedIndices,n=!1;if(this._mapFields(),this.listitems=this._getLi(),this._isWatermark||this._hiddenSpan.css("display","none"),!this._isSingleSelect()){for(e=0;e-1&&(this._selectedIndices.splice(t.inArray(e,a),1),this.model.selectedItems=this.model.selectedIndices=this._selectedIndices),this._selectedValue=this._getAttributeValue(this.listitems[e])||"",this._itemID=t(this.listitems[e]).attr("id"),i.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:e,selectedValue:this._selectedValue,value:this._selectedValue,isChecked:this.checkedStatus},this._initValue||this._trigger("change",args),this._cascadeAction());this._updateValue(this.element.val()),this._updateText(),this.model.itemValue=this._selectedValue,this.model.checkAll=!1,this.model.uncheckAll=!0,this._setWatermark(),this._activeItem=-1}},_removeSelectedItemsID:function(){var e;e=this._selectedItemsID.indexOf(this._itemID),this._selectedItemsID.splice(e,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 e=this._isPopupShown();this.popupListWrapper.css("display","block"),this.popupList.css({display:"block"}),this.scrollerObj.model.height=this._getPopupHeight(),this.scrollerObj.refresh(),this.model.enablePopupResize||(this.popupList.css("height","auto"),this.popupListWrapper.css("height","auto")),this.scrollerObj.option("scrollTop",0),e||this.popupListWrapper.css("display","none")},_enablePopupResize:function(){this.model.enablePopupResize&&(this.popupListWrapper.addClass("e-resizable").append(i.buildTag("div.e-resizebar").append(i.buildTag("div.e-icon e-resize-handle"))).find(".e-resize-handle").addClass(this.model.enableRTL?"e-rtl-resize":""),this._resizePopup())},_resizePopup:function(){var e=this,i=!1;this.popupListWrapper.find("div.e-resize-handle").ejResizable({minHeight:e.model.minPopupHeight,minWidth:e.model.minPopupWidth,maxHeight:e.model.maxPopupHeight,maxWidth:e.model.maxPopupWidth,handle:"e-ddl-popup",resizeStart:function(t){return!!e.model.enabled&&(i||e._trigger("popupResizeStart",{event:t}),void(i=!0))},resize:function(i){var s=t(i.element).parents("div.e-ddl-popup");e._refreshPopupOnResize(t(s).outerHeight(),t(s).outerWidth()),e._trigger("popupResize",{event:i})},resizeStop:function(t){i&&(e._refreshPopupOnResize(e.model.popupHeight,e.model.popupWidth),i&&e._trigger("popupResizeStop",{event:t}),i=!1)},helper:function(i){var s=t(i.element).parents("div.e-ddl-popup");return e._refreshPopupOnResize(t(s).outerHeight(),t(s).outerWidth()),t(e.popupListWrapper)}})},_refreshPopupOnResize:function(e,t){e&&(this.model.popupHeight=e),t&&(this.model.popupWidth=t),this.popupListWrapper.css({height:this.model.popupHeight,"min-height":this.model.minPopupHeight,"max-height":this.model.maxPopupHeight}),this._setListWidth(),this._refreshScroller()},_setListWidth:function(){var e=this.model.popupWidth;"auto"!=e?this.popupListWrapper.css({width:e}):this.popupListWrapper.css({"min-width":this.model.minPopupWidth}),this.popupListWrapper.css({"max-width":this.model.maxPopupWidth})},_setListHeight:function(){this.model.enablePopupResize&&this.model.enableFilterSearch&&20==this.model.minPopupHeight&&(this.model.minPopupHeight+=45),this.model.enablePopupResize?this.popupListWrapper.css({"min-height":this.model.minPopupHeight,"max-height":this.model.maxPopupHeight,height:this.model.popupHeight}):this.popupListWrapper.css({"max-height":this.model.popupHeight,"min-height":this.model.minPopupHeight})},_getPopupHeight:function(){var e,t=this.popupListWrapper.height();return this.model.enablePopupResize&&(t-=this.popupListWrapper.find(">div.e-resizebar").height()),this.model.headerTemplate&&this.headerTemplate&&(t-=this.headerTemplate.height()),this.model.enableFilterSearch&&this.inputSearch&&(e=this.inputSearch.parent(".e-in-wrap"),t-=parseInt(e.css("height"))+parseInt(e.css("margin-top"))+parseInt(e.css("margin-bottom"))),t},_refreshPopup:function(){"auto"!=this.model.popupWidth||this.model.minPopupWidth?this.model.minPopupWidth&&this.popupListWrapper.css({"min-width":this.model.minPopupWidth}):this.popupListWrapper.css({"min-width":this.wrapper.width()}),this._refreshScroller(),this._setListPosition()},_setListPosition:function(){var e,i=this.wrapper,s=this._getOffset(i),a=t(document).scrollTop()+t(window).height()-(s.top+t(i).outerHeight()),n=s.top-t(document).scrollTop(),o=this.popupListWrapper.outerHeight(),r=this.popupListWrapper.outerWidth(),l=s.left,d=i.outerHeight(),h=(d-i.height())/2,c=this._getZindexPartial(),u=3,m=(on?s.top+d+u:s.top-o-u)-h;e=t(document).scrollLeft()+t(window).width()-l,(this.model.enableRTL||r>e&&r=0||null!=this._activeItem)&&(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):this._checkContains(this._currentText)||(this.model.showCheckbox?(i=this.activeItem.find(".e-checkwrap")[0],this._isChecked(i)||(this._setClass(i,"e-check-act"),this._setAttr(i,{"aria-checked":!0}),t(i).find(".e-check-input")[0].checked=!0,this.checkedStatus=!0)):this.activeItem.addClass("e-active"),"visualmode"==this.model.multiSelectMode&&(this._ulBox.append(this._createBox(this._currentText)),this._isPopupShown()&&this._setListPosition()),this._maintainHiddenValue(),this._addText(this._currentText),this._createListHidden(this._hiddenValue),t.inArray(this.selectedIndexValue,this._selectedIndices)==-1&&(this._selectedIndices.push(this.selectedIndexValue),this.model.selectedItems=this.model.selectedIndices=this._selectedIndices)), this._onValueChange(),this._cascadeAction(),this.selectelement&&t("#"+this._id).children().length>this.selectedIndexValue&&(t("#"+this._id).children()[this.selectedIndexValue].selected=!0)),this.model.uncheckAll=!1,this._setWatermark()},_onValueChange:function(){this.model.itemValue=this._selectedValue,this._updateText(),this.value()!=this.element.val()&&(this._updateSelectedIndexByValue(this._visibleInput.val()),this._updateValue(this.element.val()),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(e){return t("").html(e).text()},_chooseSelectionType:function(){this.activeItem=this._getActiveItem(),this.selectedIndexValue=this._activeItem,this._mapFields(),null==this.model.dataSource||this._isPlainType(this.model.dataSource)?(this._currentText=this.activeItem.text(),this._getAttributeValue(this.activeItem[0])?this._selectedValue=this._getAttributeValue(this.activeItem[0]):null!=this._currentText?(this.activeItem[0].setAttribute("value",this._currentText),this._selectedValue=this._currentText):this._selectedValue="",this._itemID=t(this.activeItem).attr("id")):(this._currentText=this._decode(this._getField(this.popupListItems[this._activeItem],this.mapFld._text)),this._currentText=""===this._currentText||null==this._currentText?this.activeItem.text():this._currentText,this._selectedValue=this._getField(this.popupListItems[this._activeItem],this.mapFld._value),this._itemID=this._getField(this.popupListItems[this._activeItem],this.mapFld._id)),i.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 e,i;this._uiInteract=!0,this.removeID=!0,this._chooseSelectionType(),this._maintainHiddenValue(),this._removeText(this._currentText),this._removeListHidden(this._hiddenValue),this.activeItem.removeClass("e-active"),this._isSingleSelect()||(this.model.showCheckbox?(e=this.activeItem.find(".e-checkwrap")[0],this._isChecked(e)&&(this._removeClass(e,"e-check-act"),this._setAttr(e,{"aria-checked":!1}),t(e).find(".e-check-input")[0].checked=!0,this.checkedStatus=!1)):this.activeItem.removeClass("e-active"),t.inArray(this.selectedIndexValue,this._selectedIndices)>-1&&(this._selectedIndices.splice(t.inArray(this.selectedIndexValue,this._selectedIndices),1),this.model.selectedItems=this.model.selectedIndices=this._selectedIndices),"visualmode"==this.model.multiSelectMode&&(this._deleteBoxCheck(this._currentText),this._isPopupShown()&&this._setListPosition())),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._onValueChange(),null!=this.model.cascadeTo&&this.model.showCheckbox&&this._cascadeAction(),this.model.checkAll=!1,this._setWatermark()},_createBox:function(e){if(!this._checkContains(e)){"none"==this._ulBox.css("display")&&"none"!=this._visibleInput.css("display")&&this._swapUlandInput(!0);var s=i.buildTag("span.e-icon e-close","",{},{unselectable:"on"}),a=i.buildTag("li.e-options").text(e).append(s);return this._on(s,"click",function(e){return!!this.model.enabled&&void this._deleteBox(t(e.target).parent())}),a}},_deleteBoxCheck:function(e){for(var i=this._ulBox.children("li"),s=0;s0&&"active"==e?(n=this._getLi(),i=this._selectedIndices.length==n.length?0:this._selectedIndices[this._selectedIndices.length-1],(null!=this.model.fields.groupBy||this.ultag.find("li.e-category").length>0)&&(i=t.inArray(n.eq(i)[0],o))):i=this.ultag.find("li.e-"+e).index(),a=0;a0&&(e.which&&1==e.which||e.button&&0==e.button)&&this._OnPopupHideShow())},_OnPopupHideShow:function(){this._isPopupShown()?this._hideResult():(this._showResult(),this.wrapper.focus())},_showFullList:function(){var e,t=this.model.dataSource;i.DataManager&&t instanceof i.DataManager?t.dataSource.offline||t.dataSource.json&&t.dataSource.json.length>0?this._getFilteredList(t.dataSource.json):(e=this,e._initDataSource(t)):this._getFilteredList(t)},_getFilteredList:function(e){if(!e||!e.length||e.length<1)this._targetElementBinding(),this._renderRemaining();else{var t=i.DataManager(e).executeLocal(this._isPlainType(e)?i.Query():this._getQuery(!0));this._totalCount=t.count,this._listItem(t.result?t.result:t),this._renderPopupList()}},_cascadeAction:function(){if(this.model.cascadeTo)for(var e=this.model.cascadeTo.split(","),s=0;s0}),(e.model.showCheckbox||"none"!=e.model.multiSelectMode)&&(t("input:hidden[id^='#'][name="+e._id+"]").remove(),e._visibleInput.attr("name",e._name)),n){for(d=["dataSource","query","fields","itemsCount","template"],h=0;h0&&setTimeout(function(){i._incqueryString=""},1e3);var s,a,n=this._getLi(),o=this.model.caseSensitiveSearch,r=(this.model.fields,this._incqueryString),l=this._incqueryString.length,d=!1;for(o||(r=r.toLowerCase()),s=0;s=e;a--)t.inArray(a,this._disabledItems)<0&&t.inArray(a,this.model.selectedIndices)<0&&this._selectFocusedItem(a)},_selectShiftHome:function(e,i,s){if(s||this._clearTextboxValue(),e>=0&&e<=this._listSize-1){if(0==e)this._clearTextboxValue();else for(var a=e;a>=i;a--)t.inArray(a,this._disabledItems)<0&&t.inArray(a,this.model.selectedIndices)<0&&(this._activeItem=a,this._enterTextBoxValue());this._activeItem=e,0==e&&this._enterTextBoxValue(),this.scrollerObj.setModel({scrollTop:0})}},_selectShiftEnd:function(e,i,s){if(s||this._clearTextboxValue(),e<=this._listSize-1){if(e==i)this._clearTextboxValue();else for(var a=e;a<=i;a++)t.inArray(a,this._disabledItems)<0&&t.inArray(a,this.model.selectedIndices)<0&&(this._activeItem=a,this._enterTextBoxValue());this._activeItem=e,e==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(e,i){var s=i?e-1:e+1;return t.inArray(s,this._selectedIndices)<0?e:this._getLastShiftFocusedLi(s,i)},_shiftUp:function(e,t,i){var s,a,n;if(null==e||e<0)this._checkDisableStep(0,t,!1,!1,!0);else if(e>0&&e<=this._listSize-1&&(s=this._disableItemSelectUp(e-t),null!=s))if(null!=this._getLastFocusedLi())if(this._selectedIndices.length>1&&e-1==this._selectedIndices[this._selectedIndices.length-2])for(a=1;a<=t&&e-a==this._selectedIndices[this._selectedIndices.length-2];a++)this._activeItem=e+1-a,this._removeTextBoxValue(),this._focusItem(e-a);else n=this._getLastShiftFocusedLi(this._getLastFocusedLi(),!1),this._selectShiftUp(s,n,i);else this._moveUp(e,t,!1)},_shiftDown:function(e,t,i){var s,a,n;if(null==e||e<0)this._checkDisableStep(-1,t,!0,!1,!0);else if(e1&&e+1==this._selectedIndices[this._selectedIndices.length-2])for(a=1;a<=t&&e+a==this._selectedIndices[this._selectedIndices.length-2];a++)this._activeItem=e-1+a,this._removeTextBoxValue(),this._focusItem(e+a);else n=this._getLastShiftFocusedLi(this._getLastFocusedLi(),!0),this._selectShiftDown(n,s,i);else this._moveDown(e,t,!1)},_moveUp:function(e,t,i){null==e||e<=0?this._checkDisableStep(0,t,!1,i):e>this._listSize-1?this._checkDisableStep(this._listSize-1,t,!1,i):e>0&&e<=this._listSize-1&&this._checkDisableStep(e,t,!1,i)},_moveDown:function(e,t,i){null==e||e<0?this._checkDisableStep(-1,t,!0,i):0==e?this._checkDisableStep(0,t,!0,i):e>=this._listSize-1?this._checkDisableStep(this._listSize-1,t,!0,i):e=0&&(r=i?e+n:e-n,l=this[o](r),null==l);n--);null!=l&&(s?this._focusItem(l):this._selectItem(l),a&&s&&this._enterTextBoxValue())},_disableItemSelectDown:function(e){return(null==e||e<0)&&(e=0),e0)return this._disableItemSelectUp(e-1)}},_preventDefaultAction:function(e,t){e.preventDefault?e.preventDefault():e.returnValue=!1,t&&(e.stopPropagation?e.stopPropagation():e.cancelBubble=!0)},_OnKeyDown:function(e){var t,i,s,a,n;if(this._uiInteract=!0,this.model.enabled)if(this._itemId=null,t=this._getLi(),this._listSize=t.size(),s=this.popupList.height(),i=this.ultag.children("li").outerHeight(),a=0!=Math.round(s/i)?Math.round(s/i):5,this._isSingle=this._isSingleSelect(),this._isSingle)switch(e.keyCode){case 38:if(e.altKey){this.ultag.find("li").length>0&&this._hideResult();break}case 33:n=33==e.keyCode?a:1,this._moveUp(this._activeItem,n),this._preventDefaultAction(e);break;case 40:if(e.altKey){this.ultag.find("li").length>0&&this._showResult();break}case 34:n=34==e.keyCode?a:1,this._moveDown(this._activeItem,n),this._preventDefaultAction(e);break;case 37:this.model.enableRTL?this._moveDown(this._activeItem,1):this._moveUp(this._activeItem,1),this._preventDefaultAction(e);break;case 39:this.model.enableRTL?this._moveUp(this._activeItem,1):this._moveDown(this._activeItem,1),this._preventDefaultAction(e);break;case 9:case 27:this._isPopupShown()&&this._hideResult();break;case 35:this._moveDown(this._listSize-1,0),this._preventDefaultAction(e);break;case 36:n=null!=this._activeItem?this._activeItem:this._listSize-1,this._moveUp(n,n),this._preventDefaultAction(e)}else switch(e.keyCode){case 38:e.altKey?this.ultag.find("li").length>0&&this._hideResult():e.shiftKey?this._shiftUp(this._activeItem,1,e.ctrlKey):this._moveUp(this._activeItem,1,e.ctrlKey),this._preventDefaultAction(e);break;case 33:e.shiftKey?this._shiftUp(this._activeItem,a,e.ctrlKey):this._moveUp(this._activeItem,a,e.ctrlKey),this._preventDefaultAction(e);break;case 40:e.altKey?this.ultag.find("li").length>0&&this._showResult():e.shiftKey?this._shiftDown(this._activeItem,1,e.ctrlKey):this._moveDown(this._activeItem,1,e.ctrlKey),this._preventDefaultAction(e);break;case 34:e.shiftKey?this._shiftDown(this._activeItem,a,e.ctrlKey):this._moveDown(this._activeItem,a,e.ctrlKey),this._preventDefaultAction(e);break;case 37:this.model.enableRTL?this._moveDown(this._activeItem,1,!1):this._moveUp(this._activeItem,1,!1),this._preventDefaultAction(e);break;case 39:this.model.enableRTL?this._moveUp(this._activeItem,1,!1):this._moveDown(this._activeItem,1,!1),this._preventDefaultAction(e);break;case 9:case 27:this._isPopupShown()&&this._hideResult();break;case 35:e.shiftKey?this._selectShiftEnd(this._activeItem,this._listSize-1,e.ctrlKey):this._moveDown(this._activeItem,this._listSize,e.ctrlKey),this._preventDefaultAction(e);break;case 36:n=null!=this._activeItem?this._activeItem:this._listSize-1,e.shiftKey?this._selectShiftHome(this._activeItem,0,e.ctrlKey):this._moveUp(this._activeItem,n,e.ctrlKey),this._preventDefaultAction(e)}},_OnKeyUp:function(e){if(this.model.enabled){this._preventDefaultAction(e);e.target;if(null==this._activeItem&&(this._activeItem=this._getLi().index(this.popupList.find("ol,ul").children("li.e-hover"))),""==this._trim(this._visibleInput.val())&&38==e.keyCode&&40==e.keyCode)return this._hideResult(),!1;switch(e.keyCode){case 13:!this._isSingle&&this._isPopupShown()&&(e.ctrlKey||e.shiftKey)&&this._activeItem>=0?this._selectAndUnselect():this._isPopupShown()&&this._hideResult(),this._preventDefaultAction(e);break;case 32:this._isPopupShown()&&this._isSingle&&this._hideResult(),!this._isSingle&&this._isPopupShown()&&this._activeItem>=0&&this._selectAndUnselect(),this._preventDefaultAction(e);break;case 8:this._isPopupShown()&&this._hideResult(),this._preventDefaultAction(e);break;case 46:if("visualmode"==this.model.multiSelectMode||this.model.showCheckbox){this._deleteBox(this._ulBox.children("li.e-active"));break}}}},_isSingleSelect:function(){return!this.model.showCheckbox&&"none"==this.model.multiSelectMode},_selectAndUnselect:function(){this.model.showCheckbox?this._isChecked(this._getActiveItem().find(".e-checkwrap")[0])?this._removeTextBoxValue():this._enterTextBoxValue():"none"!=this.model.MultiSelectMode&&(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"),this._isFocused=!0,this._trigger("focusIn"))},_targetBlur:function(){this.model.enabled&&(this._isFocused=!1,this.wrapper.removeClass("e-focus"),this._setWatermark(),this._trigger("focusOut"))},_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)},_multiItemSelection:function(e,t){var i,s;for(this._ulBox||"visualmode"!=this.model.multiSelectMode||this._renderBoxModel(),i=0;io.width?(l.horizontal="right",d.horizontal="left"):(l.horizontal="center",l.vertical="top",d.vertical="bottom"):d.horizontal="left"),h++),o.top<0&&("left"==i.horizontal||"right"==i.horizontal?this.model.collision==a.Fit&&"top"==i.vertical?l.vertical="center":this.model.collision==a.Fit&&"center"==i.vertical?l.vertical="bottom":(l.horizontal="center",l.vertical="bottom",d.vertical="top"):"center"==i.horizontal&&(this.model.collision==a.Fit&&"bottom"==s.vertical?d.vertical="top":(d.vertical="top",l.vertical="bottom")),h++),o.left+o.width>r.width&&("right"==i.horizontal?this.model.collision==a.Fit?d.horizontal="left"==s.horizontal?"right":"left":(l.horizontal="left",d.horizontal="right"):"left"==i.horizontal?this.model.collision==a.Fit?d.horizontal="left"==d.horizontal?"right":"left":(l.horizontal="center",l.vertical="top",d.horizontal="right"):"center"==i.horizontal&&(this.model.collision==a.Fit&&"left"==s.horizontal?d.horizontal="center":this.model.collision==a.Fit&&"center"==s.horizontal?d.horizontal="right":(l.horizontal="left",d.horizontal="right")),h++),o.top+o.height>r.height&&("right"==i.horizontal||"left"==i.horizontal?"bottom"==l.vertical&&this.model.collision==a.Fit?l.vertical="center":"center"==i.vertical&&this.model.collision==a.Fit?l.vertical="top":(l.horizontal="center",l.vertical="top",d.vertical="bottom"):"center"==i.horizontal&&("top"==s.vertical&&this.model.collision==a.Fit?d.vertical="bottom":(l.vertical="top",d.vertical="bottom")),h++),(h>2||this.count>2)&&(l.horizontal="center",l.vertical="center",d.vertical="center",d.horizontal="center"),{target:l,stem:d}},r.prototype._createTitle=function(){this.tooltipTitle=e.buildTag("div.e-def e-header","",{},{}),this.tooltipHeader=e.buildTag("div","",{},{}),$(this.tooltipTitle).html(this.model.title).appendTo(this.tooltipHeader)},r.prototype._createHeader=function(){null!=this.model.title&&(e.isNullOrUndefined(this.tooltipTitle)&&this._createTitle(),$(this.tooltipHeader).appendTo(this.tooltipInter).addClass("e-tooltipHeader")),this.model.closeMode==t.Sticky&&this._iconRender()},r.prototype._hideTooltip=function(){var e;if(e=0!=this.model.animation.speed?this.model.animation.speed:this.model.animation.effect==i.Slide?200:this.model.animation.effect==i.Fade?800:0,1==this.model.enabled&&"block"==$(this.tooltip).css("display")){if(this.triggerEvents("beforeClose",{content:this.model.content}))return;if(this.model.animation.effect==i.Fade?$(this.tooltip).fadeOut(e):$(this.tooltip).slideUp(e),"none"==$(this.tooltip).css("display")&&$(this.tooltip).attr("aria-hidden","true"),this.triggerEvents("close",{content:this.model.content}))return}},r.prototype._showTooltip=function(){var t;if(t=0!=this.model.animation.speed?this.model.animation.speed:this.model.animation.effect==i.Slide?200:this.model.animation.effect==i.Fade?800:0,"none"==$(this.tooltip).css("display")&&1==this.model.enabled){if(this.triggerEvents("beforeOpen",{content:this.model.content}))return;if(this.model.animation.effect==i.Fade?$(this.tooltip).fadeIn(t):$(this.tooltip).slideDown(t),"block"==$(this.tooltip).css("display")&&$(this.tooltip).attr("aria-hidden","false").css({zIndex:e.getMaxZindex()+1}),this.triggerEvents("open",{content:this.model.content}))return}},r.prototype._tooltipAuto=function(){var e=this;setTimeout(function(){e._hideTooltip()},e.model.autoCloseTimeout)},r.prototype._targetHover=function(e){this.model.enabled&&this.model.associate!=n.Mouse&&(null!=this.model.target?(this.model.content=$(e.target).attr("data-content"),this._setContent(this.model.content),this._positionElement(e.target)):this._positionElement(this.element),this._showTooltip(),"click"==e.type?this.triggerEvents("click",{event:e}):this.triggerEvents("hover",{event:e}))},r.prototype._onMouseOut=function(){var e=this;this.model.closeMode==t.Sticky?this._showTooltip():this.model.enableInteraction||this.model.closeMode==t.Auto?this._tooltipAuto():(this.model.animation.effect==i.None&&($(this.tooltip).bind("mouseenter",function(){$(e.tooltip).css({display:"block"})}),$(this.tooltip).bind("mouseleave",function(){$(e.tooltip).css({display:"none"})})),e._hideTooltip())},r.prototype._keyDown=function(e){var t=e.keyCode?e.keyCode:e.which?e.which:e.charCode;if(this.model.enabled)switch(t){case 27:e.preventDefault(),this._hideTooltip()}},r.prototype._onResize=function(){this.tooltipPos.height=$(this.tooltip).outerHeight(),this.tooltipPos.width=$(this.tooltip).outerWidth(),$(this.tooltip).css({display:"none"})},r}(e.WidgetBase),e.Tooltip=o,e.widget("ejTooltip","ejTooltip",new o)}(ej||(ej={})),function(e,t,s){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,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,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,enableVirtualScrolling:!1,checkAll:!1,uncheckAll:!1,enableLoadOnDemand:!1,itemRequest:null,allowDragAndDrop:s,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",enableIncrementalSearch:"boolean",caseSensitiveSearch:"boolean",height:"string",width:"string",template:"string",targetID:"string",selectedIndex:"number",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"},observables:["value"],value:t.util.valueFunction("value"),enable:function(){if(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");var e=this.listContainer.find(".e-vscrollbar,.e-hscrollbar");this.model.showCheckbox&&this.element.find(".listcheckbox").ejCheckBox("enable"),e.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 e=this.listContainer.find(".e-vscrollbar,.e-hscrollbar");this.model.showCheckbox&&this.element.find(".listcheckbox").ejCheckBox("disable"),e.length>0&&this.scrollerObj.disable()}},selectItemByIndex:function(t){var i,s;t=parseInt(t),null==t||this.model.showCheckbox||(this._activeItem=t,this._activeItem==this._listSize-1&&(this._activeItem=this._listSize-1),i=e(this.element.children("li")[this._activeItem]),i.hasClass("e-select")||i.hasClass("e-disable")||(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),s=this._getItemObject(i,null),s.isInteraction=!1,this.model.select&&this._trigger("select",s))),this.model.cascadeTo&&(this._activeItem=t,this._cascadeAction()),this._setSelectionValues()},checkItemByIndex:function(e){"number"==typeof e&&this.checkItemsByIndices(e.toString())},uncheckItemByIndex:function(e){"number"==typeof e&&this.uncheckItemsByIndices(e.toString())},checkItemsByIndices:function(i){var s,a,n,o;if(t.isNullOrUndefined(i))return!1;if(s=i.toString().split(","),s.length>0)for(a=0;a-1||this._checkedItems.push(this._activeItem),e.inArray(n[0],this.model.checkedIndices)>-1||this.model.checkedIndices.push(n[0]),o=this._getItemObject(n,null),o.isInteraction=!1,this.model.change&&this._trigger("change",o))));this._setSelectionValues()},uncheckItemsByIndices:function(i){var s,a,n,o,r,l;if(t.isNullOrUndefined(i))return!1;if(s=i.toString().split(","),s.length>0)for(a=0;a-1&&this._checkedItems.splice(r,1),e.inArray(o[0],this.model.checkedIndices)>-1&&this.model.checkedIndices.splice(r,1),l=this._getItemObject(o,null),l.isInteraction=!1,this.model.checkChange&&this._trigger("checkChange",l)));this._setSelectionValues()},selectAll:function(){var t,i,s;if(!this.model.showCheckbox&&this.model.allowMultiSelection)for(t=this.element.children("li"),i=0;i=t&&null!=this.model.selectedIndex&&(this.model.selectedIndex==t||e(this.element.children()[t-1]).hasClass("e-disable")?this.model.selectedIndex=null:this.model.selectedIndex!=t&&(this.model.selectedIndex-=1)),a=e(t).length,a>1){for(i=a;i>=0;i--)e(this.element.children()[t[i]]).remove();for(s=this.element.children().length,o=0;o=0;n--)e(this.element.children()[n]).hasClass("e-disable")&&this.model.disableItemsByIndex.push(n),e(this.element.children()[n]).hasClass("e-select")&&this.model.selectedIndices.push(n),e(this.element.children()[n]).find(".listcheckbox").ejCheckBox("isChecked")&&this.model.checkedIndices.push(n);for(t=parseInt(t)+1;t'+i+"
  • "):e(this.element.find("li")[s-1]).after('
  • '+i+"
  • "):e(this.element).html('
  • '+i+"
  • "),this.listitems=this.element.find("li"),this._addItemIndex=s,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)}),e(this.listitems[s]).prepend($checkbox),e(e(this.listitems[s]).find(".listcheckbox")).ejCheckBox({change:e.proxy(this._onClickCheckList,this)})),(this.model.allowDrag||this.model.allowDrop)&&this._enableDragDrop(),this._addItemIndex=null,this._refreshItems());else if(!(this.model.dataSource instanceof t.DataManager)){for(i instanceof Array||(i=[i]),e(i).each(function(e,t){n.model.dataSource.splice(s,0,t),s+=1}),this.model.disableItemsByIndex=[],this.model.selectedIndices=[],this.model.checkedIndices=[],this.model.selectedIndex>=o&&(this.model.selectedIndex+=1), a=o-1;a>=0;a--)e(this.element.children()[a]).hasClass("e-disable")&&this.model.disableItemsByIndex.push(a),e(this.element.children()[a]).hasClass("e-select")&&this.model.selectedIndices.push(a),e(this.element.children()[a]).find(".listcheckbox").ejCheckBox("isChecked")&&this.model.checkedIndices.push(a);for(o;o0&&!(e.inArray(s[a],this._disabledItems)>-1)&&(e(this.element.children("li")[parseInt(s[a])]).hasClass("e-select")&&e(this.element.children("li")[parseInt(s[a])]).removeClass("e-select"),n=e(this.element.children("li")[parseInt(s[a])]).addClass("e-disable"),n.find(".listcheckbox").ejCheckBox("disable"),this._disabledItems.push(s[a]))},enableItemsByIndices:function(t){for(var i,s,a=t.toString().split(","),n=0;n0&&e.inArray(a[n],this._disabledItems)>-1&&(s=e.inArray(a[n],this._disabledItems),i=e(this.element.children("li")[parseInt(a[n])]).removeClass("e-disable"),i.find(".listcheckbox").ejCheckBox("enable"),this._disabledItems.splice(s,1))},_init:function(){this._id=this.element[0].id,this._isMozilla="mozilla"==t.browserInfo().name,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!=s&&(this.model.allowDrag=this.model.allowDrop=!0),this.model.selectedIndex=null!=this.model.selectedIndex?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 s,a=!1;for(s in i)switch(s){case"value":this._setText(t.util.getVal(i[s]));break;case"dataSource":this.model.selectedIndex=null,this._checkModelDataBinding(i[s]);break;case"query":this._queryCheck(i[s]);break;case"fields":this.model.fields=i[s],this._checkModelDataBinding(this.model.dataSource);break;case"template":this.model.template=i[s],this.refresh(!0);break;case"loadDataOnInit":this._loadContent=i[s],this._checkModelDataBinding(this.model.dataSource);break;case"enableRTL":this.model.enableRTL=i[s],this.model.enableRTL?this.listContainer.addClass("e-rtl"):this.listContainer.removeClass("e-rtl");break;case"enabled":this.model.enabled=i[s],this._enabled(i[s]);break;case"height":case"width":this.model[s]=i[s],this._setDimensions();break;case"cssClass":this.model.cssClass=i[s],this.listContainer.addClass(this.model.cssClass);break;case"showCheckbox":this._removeListHover()._checkboxHideShow(i[s]).uncheckAll();break;case"showRoundedCorner":this._roundedCorner(i[s]);break;case"selectedItemIndex":case"selectedIndex":e(this.listitem[this.model.selectedIndex]).hasClass("e-disable")||(this.selectItemByIndex(i[s]),this.model.selectedIndex=this.model.selectedItemIndex=i[s]);break;case"checkItemsByIndex":case"checkedItemlist":case"checkedItems":case"checkedIndices":this.uncheckAll(),this.checkItemsByIndices(i[s].toString()),this.model.checkedIndices=this.model[s]=i[s];break;case"uncheckItemsByIndex":this.uncheckItemsByIndices(i[s].toString()),this.model[s]=i[s];break;case"selectedItemlist":case"selectedItems":case"selectedIndices":this.unselectAll(),this.selectItemsByIndices(i[s].toString()),this.model.selectedIndices=i[s];break;case"enableItemsByIndex":this.model[s]=i[s],this.enableItemsByIndices(i[s].toString());break;case"disableItemsByIndex":this.model[s]=i[s],this.disableItemsByIndices(i[s].toString());break;case"enableVirtualScrolling":this.model.allowVirtualScrolling=i[s],a=!0;break;case"allowDrag":case"allowDrop":case"allowDragAndDrop":case"allowVirtualScrolling":case"virtualScrollMode":this.model[s]=i[s],a=!0;break;case"checkAll":this.model[s]=i[s],i[s]?this.checkAll():this.uncheckAll();break;case"uncheckAll":this.model[s]=i[s],i[s]?this.uncheckAll():this.checkAll();break;case"htmlAttributes":this._addAttr(i[s]);break;case"itemsCount":this.model.itemsCount=i[s],this._setItemsCount()._setDimensions();break;case"allowMultiSelection":this.model.allowMultiSelection=i[s],this._removeListHover();break;case"totalItemsCount":t.isNullOrUndefined(this.model.dataSource)||(this.model.totalItemsCount=i[s],this.model.query&&this._queryCheck(this.model.query))}a&&this._refresh()},_destroy:function(){return this.element.insertAfter(this.listContainer),this.listContainer.remove(),this._isList||this.element.empty(),e(window).unbind("resize",e.proxy(this._OnWindowResize,this)),this},_refresh:function(){this._destroy()._init()},_finalize:function(){return null!=this.model.selectedIndex?this.selectItemByIndex(this.model.selectedIndex):1==this.model.showCheckbox&&this._selectedItems.length>0&&this._selectCheckedItem(this._selectedItems),null!=this.model.checkedIndices&&this.checkItemsByIndices(this.model.checkedIndices.toString()),this},_initialize:function(){return this._isList=!!this.element.children().length,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.model.dataSource instanceof t.DataManager?(this.model.actionBegin&&this._trigger("actionBegin",{}),this._loadInitialRemoteData&&this._initDataSource(this.model.dataSource)):this._showFullList(),this.model.dataSource||this._finalize(),this.model.showRoundedCorner&&this._roundedCorner(!0),this},_queryCheck:function(e){this._savedQueries=e.clone(),this.element.empty(),this.model.dataSource&&this._checkModelDataBinding(this.model.dataSource)},_checkModelDataBinding:function(e){this.mergeValue=null,this.model.dataSource=e,null!=e&&0!=e.length?t.DataManager&&e instanceof t.DataManager?this._initDataSource(e):this._showFullList():this.element.empty()},_initDataSource:function(e){var t,i=this;i.listitems=i.model.dataSource,i._updateLoadingClass(!0),t=e.executeQuery(this._getQuery()),t.done(function(e){i.listitems=e.result,i._updateLoadingClass()._showFullList()._trigger("actionSuccess",e),i._finalize()}).fail(function(e){i.model.dataSource=null,i._updateLoadingClass(!0)._trigger("actionFailure",e)}).always(function(e){i.model.checkAll&&i.checkAll(),i.model.uncheckAll&&i.uncheckAll(),i._trigger("actionComplete",e)})},_getQuery:function(){var e,i,s,a;if(t.isNullOrUndefined(this.model.query)){i=[],s=this.model.fields,e=t.Query();for(a in s)"tableName"!==a&&i.push(s[a]);i.length>0&&e.select(i),this.model.dataSource.dataSource.url.match(s.tableName+"$")||t.isNullOrUndefined(s.tableName)||e.from(s.tableName)}else e=this._savedQueries;return e},_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&&e(this).addClass("e-draggable"),t.model.allowDrop&&e(this).addClass("e-droppable")})}return this},_enableDragDrop:function(){(this.model.allowDrag||this.model.allowDrop)&&this._drag()},_updateLoadingClass:function(e){return this.listContainer[e?"addClass":"removeClass"]("e-load"),this},_addAttr:function(t){var i=this;e.map(t,function(e,t){"class"==t?i.listContainer.addClass(e):"required"==t?i.element.attr(t,e):"disabled"==t&&"disabled"==e?i._enabled(!1):i.listContainer.attr(t,e)})},_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":Object.keys(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:""},_renderlistContainer:function(){var i,a,n,o,r,l,d,h,c,u,m,p;if(this.hold=this.touchhold=!1,this.item="",this.startime=0,this.listitemheight=24,i=this.listitems,o=this.model.fields,this.lastScrollTop=-1,this.dummyUl=e(),this.model.enableRTL&&this.listContainer.addClass("e-rtl"),null==this.model.dataSource||this.model.dataSource.length<1)r=this.element.parents().last(),this.docbdy=this.model.targetID?r.find("#"+this.model.targetID):r.find("#"+this._id),this.itemsContainer=this.docbdy,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"),this.itemsContainer.children("span").addClass("e-ghead"),this.element.append(this.itemsContainer.children());else if(null!=this.model.dataSource&&"object"!=typeof i[0])if(this._loadInitialRemoteData&&this.mergeValue&&"continuous"==this.model.virtualScrollMode&&this.model.totalItemsCount)this._loadlist(this.mergeValue);else if(this._loadInitialRemoteData&&this.mergeValue&&"normal"==this.model.virtualScrollMode&&this.model.totalItemsCount){for(this.realUllength=0,this.mergeUl=[],a=0;a0){if(this.mergeValue&&this.mergeValue!=l&&this.mergeValue!=s)for(this.mergeUl=[],a=0;a0&&(this.listitem.find(".listcheckbox").ejCheckBox("destroy"),this.listitem.find("input[type=checkbox]").remove(),this._checkedItems=[])},_selectCheckedItem:function(e){if(e.length>0)for(i=0;i1?i._onDragStarts(n,t.target):i._onDragStarts([i._getItemObject(t.element,t)],t.target))?(t.cancel=!0,a&&a.remove(),!1):void 0)},drag:function(t){var s=t.target,a=i.getSelectedItems();return(a.length>1?!i._onDrag(a,s):!i._onDrag([i._getItemObject(t.element,t)],s))&&void((e(s).hasClass("e-droppable")||e(s).parent().hasClass("e-droppable"))&&e(s).addClass("allowDrop"))},dragStop:function(t){t.element.dropped||a&&a.remove();var n=t.target,o=i.getSelectedItems();return(o.length>1?!i._onDragStop(o,n):!i._onDragStop([i._getItemObject(t.element,t)],n))&&(e(t.element).removeClass("e-active"),"UL"==n.nodeName&&(n=e(n).children()[0]),e(n).closest("li").length?n=e(t.target).closest("li")[0]:"LI"!=n.nodeName&&(n=e(n).closest(".e-ddl-popup.e-droppable")[0]),n&&"LI"==n.nodeName&&e(n).hasClass("e-droppable")&&e(n).closest(".e-ddl-popup.e-droppable").length?i._dropItem(n,t.element,s,t.event):e(n).hasClass("e-droppable")&&e(n).closest(".e-ddl-popup.e-droppable").length&&i._dropItemContainer(n,t.element,t.event),e(".allowDrop").removeClass("allowDrop"),!(t.target!=i.element[0]&&t.element.parent().length&&"ejListBox"==e(t.element.parent()[0]).data().ejWidgets[0]&&(i=e("#"+t.element.parent()[0].id).data(e(t.element.parent()[0]).data().ejWidgets[0]),o.length>1?i._onDropped(o,n):i._onDropped([i._getItemObject(t.element),t],t.target)))&&void 0)},helper:function(s){if(!t.isNullOrUndefined(s.element)&&!e(s.element.closest(".e-ddl-popup.e-js")).hasClass("e-disable")&&e(s.element).hasClass("e-draggable")&&(i=e(s.element).closest(".e-listbox.e-js").data("ejListBox"),i._tempTarget=e(s.element).text(),i))return a=e(s.sender.target).clone().addClass("dragClone dragClonelist"),a.css({width:i.element.width(),padding:"5px 5px 5px 0.857em","list-style":"none","text-align":"left",opacity:"1"}),a.appendTo(e("body"))}})},_dropItem:function(t,i,s,a){var n;i.addClass("e-droppable");var o=e(t).closest(".e-ddl-popup.e-droppable")[0].id.replace("_container",""),r=[],l=[],d=e("#"+o).data("ejListBox"),h=d.model.showCheckbox?!this.model.showCheckbox:this.model.showCheckbox;h||(n=this._getDropObject(t,i,a),r=n.dataIndex,l=n.dataObj,s?e(li).insertBefore(t):e(li).insertAfter(t),this._refreshItems(),l&&this.model.dataSource&&this._dropDataSource(d,r,l,li.index()),d._refreshItems())},_dropItemContainer:function(t,i,s){i.addClass("e-droppable");var a=e(t)[0].id.replace("_container",""),n=e("#"+a).data("ejListBox"),o=n.model.showCheckbox?!this.model.showCheckbox:this.model.showCheckbox;if(!o){var r=[],l=[],d=this._getDropObject(t,i,s);r=d.dataIndex,l=d.dataObj,li.insertAfter(e(e(t).find("li")).last()),e(t).find("ul").append(li),this._refreshItems(),l&&this.model.dataSource&&this._dropDataSource(n,r,l,n.model.dataSource?n.model.dataSource.length:0),n.model.allowDrag||e(li).ejDraggable("instance")._destroy(),n._refreshItems()}},_dropDataSource:function(i,s,a,n){var o,r=t.DataManager&&this.model.dataSource instanceof t.DataManager;r||(s instanceof Array?(o=this,e.each(a,function(e){indx=o.model.dataSource.indexOf(a[e]),o.model.dataSource.splice(indx,1)})):this.model.dataSource.splice(s,1),i.model.dataSource instanceof Array?i.model.dataSource.splice.apply(i.model.dataSource,[n,0].concat(a)):i.model.dataSource=a)},_getDropObject:function(t,i){var s=[],a=[];return this.model.allowMultiSelection?(li=e(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,e.each(li,function(){s.push(e(this).index()),a.push(proxy.model.dataSource?proxy.model.dataSource[e(this).index()]:null)})):(s=li.index(),a=this.model.dataSource?this.model.dataSource[s]:null),{dataIndex:s,dataObj:a}},_showResult:function(){var t,i=this;return this._refreshContainer(),this.element.attr({"aria-expanded":!0}),t=this.element.children("li"),this._listSize=t.size(),t.unbind("contextmenu",e.proxy(this._OnMouseContext,this)),t.unbind("click",e.proxy(this._OnMouseClick,this)),t.unbind("touchstart mouseenter",e.proxy(this._OnMouseEnter,this)),t.unbind("touchend mouseleave",e.proxy(this._OnMouseLeave,this)),t.bind("touchstart mouseenter",e.proxy(this._OnMouseEnter,this)),t.bind("touchend mouseleave",e.proxy(this._OnMouseLeave,this)),t.bind("click",e.proxy(this._OnMouseClick,this)),t.bind("contextmenu",e.proxy(this._OnMouseContext,this)),i.model.showCheckbox&&i.element.find(".listcheckbox").ejCheckBox({enabled:i.model.enabled}),this},_OnWindowResize:function(){this._refreshContainer(),this.listContainer.css("display","block")},refresh:function(e){t.isNullOrUndefined(this.model.query)||(this._savedQueries=this.model.query),e||t.isNullOrUndefined(e)?(this.model.template&&this.element.empty(),this._checkModelDataBinding(this.model.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"),this},_addListHover:function(){this._activeItem=this._selectedItem;var e=this._getItem(this._selectedItem);e.addClass("e-select e-hover"),this.scrollerObj.setModel({scrollTop:this._calcScrollTop()}),e.focus(),this._OnListSelect(this.prevselectedItem,this._selectedItem)},_calcScrollTop:function(e){for(var t=(this.element.outerHeight(),this.element.find("li")),i=0,s=e?e:this.element.find("li.e-select").index(),a=0;a0)&&(40==t.keyCode||39==t.keyCode?this._disableItemSelectDown():this._disableItemSelectUp(),this._selectedItem=this._activeItem);var i=this._getItem(this._selectedItem);this._selectedItems.push(i)},_getItem:function(t){return e(this.element.children("li")[t])},_getItemObject:function(e,t){return{item:e,index:e.index(),text:e.text(),value:e.attr("value")?e.attr("value"):e.text(),isEnabled:!e.hasClass("e-disable"),isSelected:e.hasClass("e-select"),isChecked:e.find(".e-chk-image").hasClass("e-chk-activeicon"),data:this.model.dataSource?this.getListData()[e.index()]:null,event:t?t:null}},_roundedCorner:function(e){return this.listContainer[e?"addClass":"removeClass"]("e-corner-all"),this},_enabled:function(e){return e?this.enable():this.disable(),this},_showFullList:function(){return null!=this.model.dataSource&&(t.DataManager&&this.model.dataSource instanceof t.DataManager||(this.listitems=this.model.dataSource),!this._savedQueries.queries.length||t.DataManager&&this.model.dataSource instanceof t.DataManager||(this.listitems=t.DataManager(this.model.dataSource).executeLocal(this._savedQueries))),this._renderlistContainer(),this.model.dataSource instanceof t.DataManager||this._trigger("actionComplete"),this._addDragableClass()._enableDragDrop(),this._disabledItems=[],this.disableItemsByIndices(this.model.disableItemsByIndex),this.model.selectedIndex&&this.selectItemByIndex(this.model.selectedIndex),this.selectItemsByIndices(this.model.selectedIndices),this.checkItemsByIndices(this.model.checkedIndices),this},_cascadeAction:function(){this.model.cascadeTo&&(this._currentValue=this._getField(this.listitems[this._activeItem],this.mapFld._value),this.selectDropObj=e("#"+this.model.cascadeTo).ejListBox("instance"),t.isNullOrUndefined(this._dSource)&&(this._dSource=this.selectDropObj.model.dataSource),this._performJsonDataInit())},_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(e){return e.preventDefault(),!1},_OnMouseEnter:function(t){var i,s,a;this.startime=0,this.item="","touchstart"==t.type&&(this.item=e(t.target).text(),this.startime=(new Date).getTime()),this.model.enabled&&(this.element.children("li").removeClass("e-hover"),e(t.target).is("li")&&e(t.target).addClass("e-hover"),e(t.target).hasClass("e-disable")?e(t.target).removeClass("e-hover e-select"):"li"!=t.target.tagName&&(i=e(t.target).parents("li"),e(i).addClass("e-hover")),a=0,this.element.children("li").each(function(t){if(e(this).hasClass("e-hover"))return s=t,!1}),this._activeItem=s)},_OnMouseLeave:function(t){this.element.children("li").removeClass("e-hover"),this.endtime=(new Date).getTime(),(this.endtime-this.startime)/200>2&&this.item==e(t.target).text()&&(this.hold=(this.endtime-this.startime)/200>2&&!this.hold)},_OnMouseClick:function(t){var i,a,n,o,r,l,d,h;if(3==t.which&&(this.hold=!0),this.endtime=(new Date).getTime(),(this.endtime-this.startime)/200>2&&(this.model.template||this.item!=e(t.target).text()||this.hold||(this.hold=(this.endtime-this.startime)/200>2)),this.model.enabled&&this._activeItem!=s){if(this.model.showCheckbox){if(e(t.currentTarget).is("li")&&e(t.target).is("li"))e(t.currentTarget.firstChild).find(".listcheckbox").ejCheckBox("isChecked")?(e(t.currentTarget.firstChild).find(".listcheckbox").ejCheckBox("option","checked",!1),l=this.model.checkedIndices.indexOf(e(t.currentTarget).index()),this._checkedItems.splice(l,1),this.model.checkedIndices.splice(l,1),this.checkedStatus=!1):(e(t.currentTarget.firstChild).find(".listcheckbox").ejCheckBox("option","checked",!0),this._checkedItems.push(this._activeItem),this.model.checkedIndices.push(e(t.currentTarget).index()),this.checkedStatus=!0);else{if(!e(t.currentTarget).is("li")||!e(t.target).is("span"))return!1;e(t.currentTarget.firstChild).find(".listcheckbox").ejCheckBox("isChecked")?(this._checkedItems.push(this._activeItem),this.model.checkedIndices.push(e(t.currentTarget).index()),this.checkedStatus=!0):(l=this.model.checkedIndices.indexOf(e(t.currentTarget).index()),this._checkedItems.splice(l,1),this.model.checkedIndices.splice(l,1),this.checkedStatus=!1)}this.selectedTextValue=e(t.currentTarget).text(),!this.element.hasClass("e-disable")&&e(t.target).is("li")&&(d={status:this.model.enabled,isChecked:this.checkedStatus,selectedTextValue:this.selectedTextValue},h=this._getItemObject(e(t.target),t),h.isInteraction=!0,this._trigger("checkChange",h)),this._lastEleSelect=e(t.currentTarget).index()}else{if(this.prevselectedItem=this._lastEleSelect?this._lastEleSelect:this._selectedIndices(),i=e(this.element.children("li")[this._activeItem]),this.model.allowMultiSelection&&(t.ctrlKey||this.touchhold||this.hold||t.shiftKey)||this._removeListHover(),this.element.children("li").removeClass("e-hover"),i.hasClass("e-select"))i.removeClass("e-select"),this._selectedItems.splice(this.model.selectedIndices.indexOf(this._activeItem),1),this.model.selectedIndices.splice(this.model.selectedIndices.indexOf(this._activeItem),1);else if(i.addClass("e-select"),this._selectedItems.push(i),this.model.selectedIndices.push(this._activeItem),t.shiftKey&&this.model.allowMultiSelection)for(t.ctrlKey||this._removeListHover(),this.prevselectedItem-1;i++)this._activeItem--,this._activeItem<0&&(this._activeItem=this.listitems.length-1);e(this.element.children("li")[this._activeItem]).addClass("e-select")},_disableItemSelectDown:function(){var t,i;for(this._disableItemSelectCommon(),t="object"!=typeof this.model.disableItemsByIndex?this.model.disableItemsByIndex.split(",").sort():this.model.disableItemsByIndex,this.listitems.length-1==this._activeItem?this._activeItem=0:this._activeItem++,i=0;e.inArray(this._activeItem.toString(),t.toString())>-1;i++)this._activeItem++,this.listitems.length==this._activeItem&&(this._activeItem=0);e(this.element.children("li")[this._activeItem]).addClass("e-select")},_checkitems:function(){var t,s;if(this.model.showCheckbox)for(t=this.element.find("li"),i=0;ithis.listContainer.outerHeight()/e(n).outerHeight()&&(o=this.mergeValue&&o>=this.mergeValue.length?o-this.mergeValue.length:o,l=this.itemIndex+this._getLiCount()),(this.mergeValue&&this.itemIndex<=this.mergeValue.length||o<=0)&&(o=0),this.model.dataSource.length==s&&this._temp==this.model.dataSource?t.DataManager&&this.model.dataSource instanceof t.DataManager&&this._queryPromise(o,a,o+Math.round(this.model.height/this.listitemheight),i):this._temp!=this.model.dataSource?this._queryPromise(o,a,this._listitems.length,i):this.model.dataSource.length>0&&this._loadQueryData(o,l,a);else if(this.model.allowVirtualScrolling&&"continuous"==this.model.virtualScrollMode&&this.element.find("li").length-2<=(this.scrollerObj.scrollTop()+this.listContainer.height())/this.element.find("li").outerHeight()&&(this.lastScrollPosition=this.scrollerObj.scrollTop(),o=this.mergeValue&&!this._skipInitialRemoteData?this.element.children().length-this.mergeValue.length:this.element.children().length,o<=0&&(o=0),this._oldStartValue&&(o=this._oldStartValue),r=this.model.totalItemsCount?this.model.totalItemsCount:this.listitems.length,this.element.find("li").lengththis.model.totalItemsCount?this.model.totalItemsCount-this.mergeValue.length:o+this.model.itemRequestCount:this.model.totalItemsCount&&o+this.model.itemRequestCount>this.model.totalItemsCount?this.model.totalItemsCount:o+this.model.itemRequestCount,t.DataManager&&this.model.dataSource instanceof t.DataManager){if(!(o<=l))return!1;this._queryPromise(o,a,l,i)}this._oldStartValue=o+this.model.itemRequestCount}else if(this.model.dataSource.length>0){if(this._isScrollComplete)return;this._loadQueryData(a.realUllength,a.realUllength+this.model.itemRequestCount,a)}},_queryPromise:function(e,t,i,s){this._trigger("itemRequest",{event:s,isInteraction:!0}),this._setMapFields();var a=this._savedQueries.clone(),n=this.model.dataSource.executeQuery(a.range(e,i));this._updateLoadingClass(!0),n.done(function(i){t._trigger("actionBeforeSuccess",i),t.realUllength="wheel"!=s.source&&t.mergeValue?t.mergeValue.length+e:e,t._loadlist(i.result)._checkboxHideShow(t.model.showCheckbox)._showResult()._updateLoadingClass(),t._applySelection(),"continuous"==t.model.virtualScrollMode&&(t.scrollerObj.refresh(),t.scrollerObj.option("scrollTop",t.lastScrollPosition)),t._trigger("actionSuccess",i)}).fail(function(e){t._trigger("actionFailure",e)}).always(function(e){t._trigger("actionComplete",e)})},_selectListItems:function(){var t=this.element.find("li");for(i=0;i=this.listitems.length,this._updateLoadingClass(!0);var s=this.model.dataSource;this._loadlist(s.slice(e,t))._showResult()._updateLoadingClass(),i._applySelection(),"continuous"==i.model.virtualScrollMode&&(i.scrollerObj.option("scrollTop",i.lastScrollPosition),i.scrollerObj.refresh())},_setText:function(t){for(i=0;i0&&null==this._typeInterval&&(this._typeInterval=setTimeout(function(){_proxy._incqueryString="",_proxy._typeInterval=null},_proxy._typingThreshold));var n,o,r=this.listContainer.find("ol,ul").children("li:not('.e-category')"),l=this.model.caseSensitiveSearch,d=this._incqueryString,h=this._incqueryString.length,c=!1;for(l||(d=d.toLowerCase()),s=this._activeItem,--s,a=this._activeItem!=r.length-1?this._activeItem+1:0,this._incqueryString.length>1&&(a=this._activeItem),n=a;n'),s=t.buildTag("span.e-icon e-arrow").attr({role:"presentation",unselectable:"on"});this.innerWrap.append(i),i.find(".e-spin").append(s),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,null===this.model.value?(this.isValidState=!0,this._hiddenInput.val(null)):(this.model.valuethis.model.maxValue)&&(this.isValidState=!1),this._checkErrorClass(),this._setWaterMark()},_showSpin:function(e){e?(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(e){e&&!this.innerWrap.hasClass("e-corner")?this.innerWrap.addClass("e-corner"):this.innerWrap.hasClass("e-corner")&&this.innerWrap.removeClass("e-corner")},_enableRTL:function(e){e?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(e){""!=e?this.wrapper.width(e):this.model.width=this.wrapper.outerWidth()},_setHeight:function(e){""!=e?this.wrapper.height(e):this.model.height=this.wrapper.outerHeight()},_setSkin:function(e){this.wrapper.removeClass(this.model.cssClass),this.wrapper.addClass(e)},_setValue:function(e,t){this._isWatermark||this._hiddenSpan.css("display","none"),this.model.value=this._checkNumValue(e),this._validateMinMaxValue(!1),this._checkErrorClass(),this._localizedFormat(),this._raiseChangeEvent(t), this._setWaterMark()},_setLocalize:function(e){var i=t.preferredCulture(this.model.locale).numberFormat[","];this.model.locale="en"==t.preferredCulture(e).name?"en-US":t.preferredCulture(e).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(),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(e){this._percentSymbol=t.preferredCulture(e).numberFormat.percent.symbol,this._currencySymbol=t.preferredCulture(e).numberFormat.currency.symbol},_setDecimal:function(e){this.model.decimalPlaces=e,this._localizedFormat()},_validateMinMaxValue:function(e,i){var s,a=!1;this.model.minValue>this.model.maxValue&&(this.model.minValue=this.model.maxValue),!t.isNullOrUndefined(this.model.value)&&this.model.minValue>this.model.value?(1!=this.model.enableStrictMode?(this.isValidState=!0,this._startValue=this.model.value=this.model.minValue):this.isValidState=!1,a=!0):!t.isNullOrUndefined(this.model.value)&&this.model.maxValue0?this._updateInputField("increment"):t<0&&this._updateInputField("decrement"),this._cancelEvent(e)}},_numberValue:function(){var e=this._textBox.value;return"ej.NumericTextbox"===this.sfType&&(e=this._formatValue(this.model.value,"n",!0)),"ej.PercentageTextbox"===this.sfType?e=this._formatValue(this.model.value,"n",!0):"ej.CurrencyTextbox"===this.sfType&&(e=this._formatValue(this.model.value,"n",!0)),"string"!=typeof e||isNaN(this._parseValue(e))?"":e},_formatValue:function(e,i,s){s&&this._updateCultureInfo();var e=t.format(e,i+this.model.decimalPlaces,this.model.locale);return s&&this._restCultureInfo(),e},_parseValue:function(e){this._updateCultureInfo();var e=t.parseFloat(e,this.model.locale);return this._restCultureInfo(),e},_initCustomValue:function(){var e,i="ej.PercentageTextbox"==this.sfType?"percent":"ej.CurrencyTextbox"==this.sfType?"currency":"numeric";switch(i){case"percent":case"currency":e=this.culture.numberFormat[i],t.isNullOrUndefined(this._options.negativePattern)&&(this.model.negativePattern=e.pattern[0]),t.isNullOrUndefined(this._options.positivePattern)&&(this.model.positivePattern=e.pattern[1]),t.isNullOrUndefined(this._options.groupSize)&&(this.model.groupSize=e.groupSizes[0]);break;case"numeric":e=this.culture.numberFormat,t.isNullOrUndefined(this._options.negativePattern)&&(this.model.negativePattern=e.pattern[0]),t.isNullOrUndefined(this._options.groupSize)&&(this.model.groupSize=e.groupSizes[0])}},_updateCultureInfo:function(){var e,t="ej.PercentageTextbox"==this.sfType?"percent":"ej.CurrencyTextbox"==this.sfType?"currency":"numeric";e="numeric"==t?this.culture.numberFormat:this.culture.numberFormat[t],this._oldNegativePattern=e.pattern[0],this._oldGroupSize=e.groupSizes[0],e.pattern[0]=this.model.negativePattern,e.groupSizes[0]=this.model.groupSize,"numeric"!=t&&(this._oldPositivePattern=e.pattern[1],e.pattern[1]=this.model.positivePattern)},_restCultureInfo:function(){var e,t="ej.PercentageTextbox"==this.sfType?"percent":"ej.CurrencyTextbox"==this.sfType?"currency":"numeric";e="numeric"==t?this.culture.numberFormat:this.culture.numberFormat[t],e.pattern[0]=this._oldNegativePattern,e.groupSizes[0]=this._oldGroupSize,"numeric"!=t&&(e.pattern[1]=this._oldPositivePattern)},_toggleTextbox:function(e){var t=this;t._hiddenInput.toggle(e),t.element.toggle(!e)},_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 e=this._formatValue(this._textBox.value,"n",!0);this._textBox.value=e,this._hiddenInput.val(e)}this._setSelectionRange(0,this._textBox.value.length)}this._trigger("focusIn",{value:this.model.value})}},_focusOut:function(){var e;this._focused=!1,this.wrapper.removeClass("e-focus"),this._error||(""!=this._textBox.value?(e=t.parseFloat(this._textBox.value,this.model.locale),ethis.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()):(e=""==this._textBox.value?null:this._textBox.value,this.model.value=e,this._hiddenInput.val(e),this._toggleTextbox(!0),this._textBox=this._hiddenInput[0]),null===this.model.value||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(),e=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(e),this._updateSeparator(),this._trigger("focusOut",{value:this.model.value})),this._checkErrorClass()},_cancelEvent:function(e){return e.cancelBubble=!0,e.returnValue=!1,e.stopPropagation(),e.preventDefault(),!1},_updateInputField:function(e){var i,s,a,n;this.isValidState=!0,i=this.model.incrementStep,s=this.model.value,""===this._textBox.value?(this._textBox.value=this._formatValue(this._startValue,"n",!0),i=0):this._textBox.value.indexOf(" ")>=0&&(this._textBox.value=this._textBox.value.replace(" ","")),"ej.PercentageTextbox"===this.sfType||"ej.CurrencyTextbox"===this.sfType?(a=this._textBox.value,n=a,a.indexOf(t.preferredCulture(this.model.locale).numberFormat.percent.symbol)>-1&&(n=a.substring(0,a.length-1)),this.model.value=this._parseValue(n)):"ej.NumericTextbox"==this.sfType&&(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&&(n="increment"==e?this.model.value+i:this.model.value-i,n>=this.model.minValue&&n<=this.model.maxValue&&this._setValue(n)),this._checkErrorClass()},_validateDecimal:function(e){var i=String.fromCharCode(e.keyCode);return i=188==e.keyCode?",":190==e.keyCode?".":110==e.keyCode?t.preferredCulture(this.model.locale).numberFormat["."]:i,t.preferredCulture(this.model.locale).numberFormat["."].charCodeAt(0)==i.charCodeAt(0)},_allowKeyCodes:function(e){for(var t=[38,40,35,36,109,189,46,8,127,37,39,190,9,13,16,17,18,20,110,173,86,88,67],i=0;i1?i[0]:i,s.test(i)?null!=this._prevSeparator?this._prevSeparator:t.preferredCulture(this.model.locale).numberFormat[","]:i},_keyPress:function(e){var i,s;if(0!==e.which&&!e.metaKey&&!e.ctrlKey&&8!==e.keyCode&&13!==e.keyCode){var a=this,n=null,o=".";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,i=String.fromCharCode(e.which),value=beforeCursor+i+afterCursor,s=numberFormat[o],s=s===o?"\\"+s:s,n=0===a.model.decimalPlaces?/^(-)?(\d*)$/:new RegExp("^(-)?(((\\d+("+s+"\\d*)?)|("+s+"\\d*)))?$"),!!n.test(value)&&void 0}},_validateDecimalOnType:function(e){var i,s,a,n,o,r,l,d;return i=this._caretPosition(),a=this._textBox.value.toString().substring(0,i),n=this._textBox.value.toString().substring(i),o=this._getSelection(this._textBox.value),l=t.preferredCulture(this.model.locale).numberFormat["."],r=t.isNullOrUndefined(this.model.value)?"":this.model.value.toString(),0!=this.model.decimalPlaces?(d=this._textBox.value.split(l)[1],s=r.indexOf(l)>0?r.substring(r.indexOf(l)+1,r.length).length>this.model.decimalPlaces||!!(0==o.length&&i>this._textBox.value.indexOf(l)&&d&&d.length>=this.model.decimalPlaces):!!(0==o.length&&i>this._textBox.value.indexOf(l)&&d&&d.length>=this.model.decimalPlaces)):s=!1,s?(this._keypressFlag=!1,this._cancelEvent(e),!1):void 0},_keyDown:function(s){var a,n,o,r,l,d,h,c,u,m;if(!this.model.readOnly)if(this._CurrentCultureInfo=JSON.parse(JSON.stringify(t.preferredCulture())),s.keyCode>=48&&s.keyCode<=57||s.keyCode>=96&&s.keyCode<=105||this._allowKeyCodes(s)){if(s.shiftKey&&(35==s.keyCode||36==s.keyCode||37==s.keyCode||39==s.keyCode||46==s.keyCode||127==s.keyCode)||s.ctrlKey&&(86==s.keyCode||118==s.keyCode||67==s.keyCode||88==s.keyCode))return!0;if(1==s.ctrlKey&&9!=s.keyCode&&17!=s.keyCode&&86!=s.keyCode&&67!=s.keyCode||67==s.keyCode||86==s.keyCode||88==s.keyCode)return this._keypressFlag=!1,this._cancelEvent(s),!1;if((s.keyCode>=48&&s.keyCode<=57||s.keyCode>=96&&s.keyCode<=105||110==s.keyCode)&&(a=this._caretPosition(),o=this._textBox.value.toString().substring(0,a),r=this._textBox.value.toString().substring(a),l=this._getSelection(this._textBox.value),s.keyCode>=96&&s.keyCode<=105&&(s.keyCode-=48),this.model.validateOnType&&this._validateDecimalOnType(s),this._validateOnType)){var p=t.preferredCulture(this.model.locale).numberFormat["."],g=this.model.value.toString(),_=g.indexOf(p),f=this.model.value,b=this.model.minValue.toFixed(this.model.decimalPlaces),v=this.model.maxValue.toFixed(this.model.decimalPlaces),x=!1;if((b.toString().indexOf("e")>0||v.toString().indexOf("e")>0)&&(x=!0),x)0!=this.model.decimalPlaces?(d=this._textBox.value.split(".")[1],n=g.indexOf(p)>0||Number(g)Number(v)?g.substring(g.indexOf(p)+1,g.length).length>this.model.decimalPlaces||!!(0==l.length&&a>this._textBox.value.indexOf(p)&&d&&d.length>=this.model.decimalPlaces):!!(0==l.length&&a>this._textBox.value.indexOf(p)&&d&&d.length>=this.model.decimalPlaces)):n=!1;else if("."!=p&&(g=this._textBox.value.toString(),this.model.minValue.toString().match(new RegExp(".","g"))&&(b=this.model.minValue.toString().replace(/["."]/g,p)),this.model.maxValue.toString().match(new RegExp(".","g"))&&(v=this.model.maxValue.toString().replace(/["."]/g,p))),c=b.toString().indexOf(p)>0?Number(b.toString().substring(0,b.toString().indexOf(p))):this.model.minValue,u=v.toString().indexOf(p)>0?Number(v.toString().toString().substring(0,v.toString().indexOf(p))):this.model.maxValue,_>0){f=Number(g.substring(g.indexOf(p)+1,g.toString().length)),c=b.toString().indexOf(p)>0?Number(b.toString().substring(b.toString().indexOf(p)+1,b.toString().length)):0,u=v.toString().indexOf(p)>0?Number(v.toString().substring(v.toString().indexOf(p)+1,v.toString().length)):0;var w=Number(g.substring(0,g.indexOf(p))),y=Number(b.toString().substring(0,b.toString().indexOf(p))),C=Number(v.toString().substring(0,v.toString().indexOf(p)));n=!this._validateValue(f,c,u,!0,w,y,C)}else n=!this._validateValue(f,c,u,!1);if(n)return this._keypressFlag=!1,this._cancelEvent(s),!1}if(38==s.keyCode&&this._allowkeyboard&&(this._updateInputField("increment"),this._cancelEvent(s)),40==s.keyCode&&this._allowkeyboard&&(this._updateInputField("decrement"),this._cancelEvent(s)),8==s.keyCode&&(a=this._caretPosition(),o=this._textBox.value.substring(0,a),r=this._textBox.value.substring(a),l=this._getSelection(this._textBox.value)),(46==s.keyCode||127==s.keyCode)&&(a=this._caretPosition(),o=this._textBox.value.substring(0,a),r=this._textBox.value.substring(a),l=this._getSelection(this._textBox.value)),this._validateDecimal(s)&&0!=this.model.decimalPlaces&&46!=s.keyCode){if(h=t.preferredCulture(this.model.locale).numberFormat["."],m=this._textBox.value.split(h),m[1]==i){var S=this._caretPosition(),T=m[0].substring(0,S),D=m[0].substring(S);if((this.model.minValue.toString().indexOf("e")>0||this.model.maxValue.toString().indexOf("e")>0)&&(x=!0),D.length>this.model.decimalPlaces&&1==this.model.validateOnType)return this._keypressFlag=!1,this._cancelEvent(s),!1;if(this._validateOnType&&!x){if(this.model.minValue.toString().match(new RegExp(".","g"))&&(c=this.model.minValue.toString().replace(/["."]/g,h)),this.model.maxValue.toString().match(new RegExp(".","g"))&&(u=this.model.maxValue.toString().replace(/["."]/g,h)),c=c.indexOf(h)>0?Number(c.substring(0,c.indexOf(h))):Number(c),u=u.indexOf(h)>0?Number(u.substring(0,u.indexOf(h))):Number(u),!this._validateValue(this.model.value,c,u,"DecimalKeyPressed"))return this._keypressFlag=!1,this._cancelEvent(s),!1;this._textBox.value=T+h+D}else this._textBox.value=T+h+D;this._setSelectionRange(S+1,S+1)}this._cancelEvent(s)}else(190==s.keyCode||110==s.keyCode)&&this._cancelEvent(s);(109==s.keyCode||189==s.keyCode||173==s.keyCode)&&(0!=this._caretPosition()&&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(s):this._getSelection()==this.model.value&&(this.model.value=null)),13==s.keyCode&&this._checkNumValue(this._preVal)!==this._checkNumValue(this._textBox.value)&&this._setValue(this._textBox.value)}else(27!=s.keyCode&&!s.ctrlKey||s.ctrlKey&&90==s.keyCode&&""===e.trim(this._textBox.value))&&(this._keypressFlag=!1,this._cancelEvent(s))},_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(e,t,s){t.widget("ejMaskEdit","ej.MaskEdit",{element:null,model:null,validTags:["input"],_addToPersist:["value"],_setFirst:!1,type:"editor",angular:{require:["?ngModel","^?form","^?ngModelOptions"]},defaults:{maskFormat:"",value:null,watermarkText:"",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(e){for(var t in e)switch(t){case"value":this._setValue(e[t]),e[t]=this.get_UnstrippedValue(),this._raiseEvents("change",!0);break;case"width":this._setWidth(e[t]);break;case"height":this._setHeight(e[t]);break;case"watermarkText":this.model.watermarkText=e[t],this._changeWatermark(e[t]);break;case"showRoundedCorner":this._roundedCorner(e[t]);break;case"showPromptChar":this._setShowPrompt(e[t]);break;case"validationRules":null!=this.model.validationRules&&(this._hiddenInput.rules("remove"),this.model.validationMessage=null),this.model.validationRules=e[t],null!=this.model.validationRules&&(this._initValidator(),this._setValidation());break;case"validationMessage":this.model.validationMessage=e[t],null!=this.model.validationRules&&null!=this.model.validationMessage&&(this._initValidator(),this._setValidation());break;case"textAlign":this._setTextAlign(e[t]);break;case"inputMode":this._setInputMode(e[t]);break;case"maskFormat":this.model.maskFormat=e[t],this._valueMapper(),this._setMask(e[t]),e[t]=this.model.maskFormat;break;case"cssClass":this._setSkin(e[t]);break;case"readOnly":this._setReadOnly(e[t]);break;case"enabled":this.model.enabled=e[t],this._controlStatus(e[t]);break;case"htmlAttributes":this._addAttr(e[t]);break;case"hidePromptOnLeave":this.model.hidePromptOnLeave=e[t],""!=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(){this.element.attr("name",this._hiddenInput.attr("name")),this._isWatermark&&this.element.removeAttr("placeholder"),this.element.insertAfter(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(e){return this._options=e,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._destroy(),!1):(this._isWatermark="placeholder"in document.createElement("input"),this._setValues(),this._valueMapper(),this._renderControl(),this._initObjects(),this._wireEvents(),this._addAttr(this.model.htmlAttributes),null!=this.model.validationRules&&(this._initValidator(),this._setValidation()),void 0)},_initValidator:function(){this.element.closest("form").data("validator")||this.element.closest("form").validate()},_addAttr:function(t){var i=this;e.map(t,function(e,t){"class"==t?i.wrapper.addClass(e):"name"==t?i.element.attr(t,e):"required"==t?i.element.attr(t,e):"disabled"==t&&"disabled"==e?i.disable():"readOnly"==t&&"readOnly"==e?i._setReadOnly(!0):i.wrapper.attr(t,e)})},_setValidation:function(){var i,s,a,n;this._hiddenInput.rules("add",this.model.validationRules),i=this.element.closest("form").data("validator"),i=i?i:this.element.closest("form").validate(),name=this._hiddenInput.attr("name"),i.settings.messages[name]={};for(s in this.model.validationRules)if(a=null,!t.isNullOrUndefined(this.model.validationRules[s])){if(t.isNullOrUndefined(this.model.validationRules.messages&&this.model.validationRules.messages[s])){i.settings.messages[name][s]=e.validator.messages[s];for(n in this.model.validationMessage)s==n?a=this.model.validationMessage[s]:""}else a=this.model.validationRules.messages[s];i.settings.messages[name][s]=null!=a?a:e.validator.messages[s]}},_setShowPrompt:function(e){this.model.showPromptChar=e,this._textbox.value=this.model.showPromptChar?this._unStrippedMask:this.get_UnstrippedValue()},_controlStatus:function(e){1!=e?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:"[A-Za-z ]","?":"[A-Za-z]"}},_renderControl:function(){this.model.name=null!=this.element.attr("name")?this.element.attr("name"):null!=this.model.name?this.model.name:this.element[0].id,null!=this.element.attr("name")&&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||"password"==this.model.inputMode||(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",e.proxy(this._OnFocusHandler,this))),t.isNullOrUndefined(this.model.value)&&""!=this.element[0].value&&(this.model.value=this.element[0].value),this._hiddenInput.attr({name:this.model.name,value:this.model.value}),this.element.attr({"aria-invalid":!1,value:this.model.value}).addClass("e-input"),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 e,t;if(this._textbox=this.element[0],this._keypressFlag=0,this._selectedTextKeyDown=0,this._keydownFlag=0,this.model.maskFormat.indexOf("\\")>=0){for(e=0,t=0;t=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,"password"!=this.model.inputMode&&(this._setValue(this.model.value),this._setWaterMark()),this.model.showError&&this.element.addClass("e-error").attr("aria-invalid","true")},_setWidth:function(e){this.wrapper.width(e)},_setHeight:function(e){this.wrapper.height(e)},_roundedCorner:function(e){e&&!this.innerWrapper.hasClass("e-corner")?this.innerWrapper.addClass("e-corner"):this.innerWrapper.hasClass("e-corner")&&this.innerWrapper.removeClass("e-corner")},_setTextAlign:function(e){"right"==e?this.wrapper.addClass("e-rtl"):this.wrapper.removeClass("e-rtl")},_setInputMode:function(e){this.element.attr("type",e)},_setReadOnly:function(e){this.model.readOnly=e,e?this.element.attr("readonly",!0):this.element.removeAttr("readonly")},_setSkin:function(e){this.wrapper.removeClass(this.model.cssClass),this.wrapper.addClass(e)},_setWaterMark:function(){var t=this.model.showPromptChar?this._maskModel:""!=this._maskModel&&null!=this._maskModel?this._maskModel.replace(/[_]/g," "):this._maskModel;this._maskModel=this.model.maskFormat.indexOf("\\")>=0?""===this.model.maskFormat?null:this.model.maskFormat:""===e.trim(this.model.maskFormat.replace(/[9?CANa#&]/g,"_"))?null:this.model.maskFormat.replace(/[9?CANa#&]/g,"_"),(""!=this._maskModel&&this._textbox.value==t||""==t&&""==this._textbox.value&&"password"!=this.model.inputMode)&&(this._textbox.value=""),this.model.watermarkText&&(this._isWatermark?this.element.attr("placeholder",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=t)},_changeWatermark:function(t){if(!this.model.enabled)return!1;var i=this.model.showPromptChar?this._maskModel:""!=this._maskModel&&null!=this._maskModel?this._maskModel.replace(/[_]/g," "):this._maskModel;(this._textbox.value==i||""==this._textbox.value||""==e.trim(this.get_StrippedValue()))&&"password"!=this.model.inputMode&&(this._textbox.value=""),this._isWatermark?this.element.attr("placeholder",t):this._hiddenSpan.text(t),!this.model.watermarkText&&""==e.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(){e(t._textbox).removeClass("e-error").attr("aria-invalid","false")})},_unMask:function(){for(var e,t,a,n=this.model.value,o="",r=i=0,l="_";rn.length)););return o},_validateValue:function(){var e,i,a,n,o,r,l,d,h;if(!t.isNullOrUndefined(this.model.value)){var c,u,m=this.model.value,p=this._maskModel,g=d=0,_="_",f=this._unMask();if(this._isWatermark||"password"==this.model.inputMode||this._hiddenSpan.css("display","none"),0==this._maskLength)return this._textbox.value=m,this._setWaterMark(),!0;for(e=this.model.value.toString(),m=this.model.maskFormat.indexOf("\\")>=0?this.model.value:this.model.value=e.replace(/[\(\)-]/g,"");gm.length)););if(this.model.value)if(this._textbox.value=p,this.model.value=this.get_UnstrippedValue(),this.model.maskFormat.indexOf("\\")>=0||this.model.maskFormat.indexOf("&")>=0){for(this._textbox.value="",o=0,_pos=0;_pos=0)for(l=0;l")>=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()),null!=this._tempMask)for(d=0;d=0?(_position=this._getCunrrentPos(i),s=this.model.maskFormat.substr(i+_position,1)):s=this.model.maskFormat.substr(i,1),a=this.model.customCharacter,n=String.fromCharCode(t),e.each(o,function(e,t){s==e&&(null!=a&&("C"==e?t="["+a+"]":("A"==e||"N"==e||"#"==e)&&(t=t.replace("]","")+a+"]")),r=!!n.match(new RegExp(t)))}),r},_seekNext:function(){for(var e,t,i=this._caretPosition(this._textbox),s=i,a=!0;a;){if(i>=0&&i=0?"\\"!=this.model.maskFormat.charAt(i+e)&&"\\"!=this.model.maskFormat.charAt(i+e-1)&&(this._charMap[this.model.maskFormat.charAt(i+e)]||(this._setCaretPosition(i),i++)):this._charMap[this.model.maskFormat.charAt(i)]||(this._setCaretPosition(i),i++),i!=s)){s=i;continue}}a=!1}return i},_seekBefore:function(){var e=this._caretPosition(this._textbox),t=--e,i=!0;for(1==this._selectedTextKeyDown&&(i=!1);i;)e>=0&&e=0){for(r=0,l=0;l<=t;l++)this.model.maskFormat[l].indexOf("\\")>=0&&0!=t&&(r+=1);this._textbox.value=this.model.maskFormat[t+r].indexOf("\\")>=0?n+i[t]+o.substr(1,o.length):n+e+o.substr(1,o.length)}else this._textbox.value=n+e+o.substr(1,o.length);this._setCaretPosition(t+1)}},_updateCasing:function(e,t){for(var i,s=0;s"==this._tempMask.substr(s,1))&&t++;for(i=t;i>-1;i--){if("<"==this._tempMask.substr(i,1))return e.toLowerCase();if(">"==this._tempMask.substr(i,1))return e.toUpperCase()}},get_StrippedValue:function(){var t,i,s,a,n,o=this.model.maskFormat,r=null;if(t=""==this._textbox.value&&"password"!=this.model.inputMode?this._maskModel:this._textbox.value,0==o.length)return t;for(i=0,s=0;s=0?"\\"==this.model.maskFormat[s]?i+=1:"\\"==this.model.maskFormat[s-1]?r+=this._textbox.value[s-i]:(a=o[s],n=null,"9?$a*".indexOf(a)!=-1?n=this._charMap[a]:"A"==a||"N"==a||"#"==a?n=this._charMap[a].replace("]","")+this.model.customCharacter+"]":"C"==a?n="["+this.model.customCharacter+"]":"&"==a&&(r+=t[s-i]),n&&t[s-i]&&t[s-i].match(new RegExp(n))&&(r+=t[s-i])):(a=o[s],n=null,"9?$a*".indexOf(a)!=-1?n=this._charMap[a]:"A"==a||"N"==a||"#"==a?n=this._charMap[a].replace("]","")+this.model.customCharacter+"]":"C"==a?n="["+this.model.customCharacter+"]":"&"==a&&(r+=t[s-i]),n&&t[s]&&t[s].match(new RegExp(n))&&(r+=t[s]));return r},get_UnstrippedValue:function(){var t=""==this._textbox.value&&"password"!=this.model.inputMode?this._maskModel:this._textbox.value,i=null;return 0==this.model.maskFormat.length?t:(t!=s&&(i=""==e.trim(t.replace(/[_]/g," "))?null:t.replace(/[_]/g," ")),i)},_setValue:function(i){(t.isNullOrUndefined(i)||""==e.trim(i))&&(i=null),this.model.value=i,this._isWatermark||"password"==this.model.inputMode||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 e,t,i,s=[],a=0,n=this.model.maskFormat||"",o=n.split(""),r=0,l="",d=this._charMap;r=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=e.trim(unstripVal.replace(/[\(\)-]/g,"")),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.model.enabled=!0},disable:function(){this.element.disabled=!0,this.element.attr("disabled","disabled").addClass("e-disable").attr({"aria-disabled":!0}),this.model.enabled=!1},clear:function(){this._textbox.value=this.model.maskFormat.replace(/[9?aCAN]/g,"_")},_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 e=this._maskModel.substring(this._textbox.selectionStart,this._textbox.selectionEnd),t=this._textbox.value.substring(0,this._textbox.selectionStart),i=this._textbox.value.substring(this._textbox.selectionEnd),s=this._textbox.selectionStart,a=this;setTimeout(function(){a._textbox.value=t+e+i,a._setCaretPosition(s),a._raiseEvents("change")},0)},_OnPasteHandler:function(){var t=this;return setTimeout(function(){var i=e(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&&null!=this._maskModel?this._maskModel.replace(/[_]/g," "):this._maskModel;this.model.readOnly||(this._isWatermark||"password"==this.model.inputMode||this._hiddenSpan.css("display","none"),""==this._textbox.value&&""!=this._maskModel&&"password"!=this.model.inputMode&&(this._textbox.value=this.model.maskFormat.indexOf("\\")>=0?this.model.watermarkText:t.isNullOrUndefined(this._maskModel)?"":i),(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&&null!=this._unStrippedMask&&this.model.hidePromptOnLeave&&(this._textbox.value=this._unStrippedMask),this.model.showPromptChar||(this._textbox.value=this.get_UnstrippedValue()),e.fn.selectRange=function(e,t){return this.each(function(){if(this.setSelectionRange)this.focus(),this.setSelectionRange(e,t);else if(this.createTextRange){var i=this.createTextRange();i.collapse(!0),i.moveEnd("character",t),i.moveStart("character",e),i.select()}})},this.model.maskFormat&&e(this.element).selectRange(0,0),this._raiseEvents("focusIn"))},_OnBlurHandler:function(){var e,i,a,n;if(this.wrapper.removeClass("e-focus"),this.model.value=this.get_StrippedValue(),e=[],i=[],(this._textbox.value.indexOf("_")!=-1||this._textbox.value.indexOf(" ")!=-1)&&!t.isNullOrUndefined(this.model.value)){for(a=0;a=0)for(i=0;i=35&&n<=41&&("Mozilla"==window.navigator.appCodeName||"opera"==window.navigator.appCodeName)&&(this._keypressFlag=1),e.shiftKey&&(35==e.keyCode||36==e.keyCode||37==e.keyCode||39==e.keyCode||46==e.keyCode||127==e.keyCode)||e.ctrlKey&&(86==e.keyCode||65==e.keyCode||67==e.keyCode||88==e.keyCode)?void(this._keypressFlag=1):8==n?"password"!=this.model.inputMode?(this._keydownFlag=1,a=this._seekBefore(),this._selectedTextKeyDown?!this.model.showPromptChar&&this._selectedTextKeyDown&&(this._textbox.value=this.get_UnstrippedValue(),this._setCaretPosition(a+1)):(a>=0&&a=0&&a=0?n=0||this.model.maskFormat.indexOf("\\")>=0?(_position=this._getCunrrentPos(n),"&"==this.model.maskFormat[n+_position]&&127==i||(this.model.maskFormat.indexOf("\\")>=0?n ul")').find("> a,> span").addClass("aschild"),this.element.find(">li").addClass("e-list").attr({role:"menuitem"}),i=this.element.find(".e-list a.aschild"),s=this.element.find(".e-list span.aschild"),a=0;a0)){for(m=t.buildTag("ul"),p=0;p0){for(i=e(document.createElement("ul")),s=0;s").addClass("e-icon e-arrows")).addClass("e-arrow-space"):d.model.showSubLevelArrows&&e(n).children("a.aschild").append(e("").addClass("e-icon e-arrows")).addClass("e-arrow-space")}});else if(u=t.DataManager(a.child.dataSource).executeLocal(t.Query().where(a.child.parentId,t.FilterOperators.equal,i[a.id])),u&&u.length>0){for(m=e(document.createElement("ul")),p=0;pli.e-list:has("> ul")').children("a,span").append(e("").addClass("e-icon e-arrows")).addClass("e-arrow-space"):this.element.find('>li.e-list:has("> ul")').children("a,span").removeClass("e-arrow-space").children("span.e-icon").remove(),i?this.element.find(">li.e-list > ul li.e-list:has(>ul)").children("a,span").append(e("").addClass("e-icon e-arrows")).addClass("e-arrow-space"):this.element.find(">li.e-list > ul li.e-list:has(>ul)").children("a,span").removeClass("e-arrow-space").children("span.e-icon").remove()},_intializeMenu:function(){0!=this.model.height&&this._setHeight(this.model.height),0!=this.model.width&&this._setWidth(this.model.width),"contextmenu"==this.model.menuType&&(this.model.openOnClick=!1),this.model.openOnClick&&(this._hoverOpen=!1,this._hoverClose=!1)},_setOrientation:function(e){"horizontal"==e?this.element.removeClass("e-vertical e-horizontal").addClass("e-horizontal"):this.element.removeClass("e-horizontal e-vertical").addClass("e-vertical")},_setHeight:function(e){"horizontal"==this.model.orientation&&"auto"!==e?(e="number"==typeof e?e+"px":e,this.element.find("> li").find(">a:first").css("line-height",e),this.model.showRootLevelArrows&&this.element.find("> li").find(">a:first").find("> span:first").css({"line-height":e,top:"0px"})):this.element.height(e)},_setWidth:function(e){this.element.css("width",e),"horizontal"===this.model.orientation&&this.resWrap.css("width",e)},_setRTL:function(e){e?this.element.removeClass("e-rtl").addClass("e-rtl"):this.element.removeClass("e-rtl"),e&&"horizontal"===this.model.orientation?this.wrapper.removeClass("e-menu-rtl").addClass("e-menu-rtl"):this.wrapper.removeClass("e-menu-rtl")},_setSubMenuDirection:function(e){"left"!=e&&"right"!=e&&(this.model.subMenuDirection=this.model.enableRTL?"left":"right")},_setAnimation:function(e){"none"===e?(this._showAnim="none",this._hideAnim="none"):(this._showAnim="slideDown",this._hideAnim="slideUp")},_controlStatus:function(e){1!=e?this.disable():this.enable()},_centerAlign:function(e){"horizontal"==this.model.orientation&&e?this.element.css("text-align","center"):this.element.css("text-align","inherit")},_columnToSelect:function(e){var i,s=[],a=t.Query();if(t.isNullOrUndefined(e.query)){for(i in e)"tableName"!==i&&"child"!==i&&"dataSource"!==i&&e[i]&&s.push(e[i]); s.length>0&&a.select(s),this.model.fields.dataSource.dataSource.url.match(e.tableName+"$")||t.isNullOrUndefined(e.tableName)||a.from(e.tableName)}else a=e.query;return a},_max_zindex:function(){var t,i,s;return"contextmenu"==this.model.menuType?(t=e(this._targetElement).parents(),t.push(this._targetElement)):t=e(this.element).parents(),i=e("body").children(),index=i.index(this.popup),i.splice(index,1),e(i).each(function(e,i){t.push(i)}),s=Math.max.apply(s,e.map(t,function(t){if("static"!=e(t).css("position"))return parseInt(e(t).css("z-index"))||1})),!s||s<1e4?s=1e4:s+=1,s},_recursiveFunction:function(t,i){var s=this,a=!1;e.each(t,function(e,t){return t.Text==i?(s.selectedItem=t,a=!0,!1):(null!=t.ChildItems&&s._recursiveFunction(t.ChildItems,i),!a&&void 0)})},_contextMenu_Template:function(){var t=e(".e-menu-wrap #"+this.element.context.id).get(0);t&&e(t.parentElement).remove(),this.model.orientation="vertical",this.element.addClass(this.model.cssClass+" e-context"),this.element.css("display","none"),e("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(e,t,i){t._delayMenuHover=window.setTimeout(function(){if(1==t._mouseOver&&i){var s=t._showAnim,a=t._hideAnim;t._showSpeed,t._hideSpeed;t._show(e,s,a)}},this._showSpeed)},_onHide:function(e,t,i){t._delaySubMenuHover=window.setTimeout(function(){if(0==t._mouseOver&&i){t._id,t._hideAnim,t._hideSpeed;t._closeAll()}},t._hideSpeed)},_subMenuPos:function(t,s){var a,n,o,r,l,d,h,c=e(t).offset(),u=c.left,m=e("ul:first",t),p=e(t).outerWidth();return null!=c&&c!=i&&(a=m.outerWidth()+1,n=document.documentElement.clientWidth+e(document).scrollLeft(),void("normalmenu"==this.model.menuType?e(t.parentNode).is(this.element)?"horizontal"==this.model.orientation?m.css("top",e(t).outerHeight()+"px"):"left"==s&&u>a||"right"==s&&n<=c.left+p+a?m.css("left",-(a+4)+"px"):m.css("left",e(t).outerWidth()+4+"px"):"left"==s&&u>a||"right"==s&&n<=c.left+p+a?m.css("left",-(a+4)+"px"):(m.css("left",e(t).outerWidth()+4+"px"),d=m.outerHeight(),o=e(window).height(),oa&&m.css("left",-(a+4)+"px"),d=m.outerHeight(),c.top+d>e(window).height()?(h=-d+e(t).outerHeight(),d>c.top+e(t).outerHeight()/2?m.css("top",-(d/2)+"px"):m.css("top",h+"px")):m.css("top","0px"))))},_setSkin:function(e){this.wrapper.removeClass(this.model.cssClass).addClass(e+" e-menu-wrap")},_setSeparator:function(e){e?this.element.addClass("e-separator"):this.element.removeClass("e-separator")},_contextMenuEvents:function(t){this[t](e(this.model.contextMenuTarget),"mouseup taphold",this._ContextMenuHandler),this[t](this.element,"contextmenu",this._onDefaultPreventer),this[t](e(this.model.contextMenuTarget),"contextmenu",this._onDefaultPreventer),this[t](e(document),"mousedown",this._onContextClose)},_show:function(t,i,s){var a,n=e("> ul",t);n.attr({"aria-hidden":!1}),this._hideAnimation(e(t).siblings().find(" > ul:visible"),s),e.inArray(this._disabledMenuItems,t)>-1||("none"!=n.css("display")?(a=this.model.openOnClick?e(n):n.children().find("> ul"),this._hideAnimation(a,s)):e("> ul",t).children().find("> ul").hide(),this._subMenuPos(t,this.model.subMenuDirection),n.css({"z-index":this._max_zindex()+1}),"block"==e("> ul",t).css("display")||e(t).hasClass("e-disable-item")||(this._showAnimation(n,i),n.closest("li").addClass("e-active e-mfocused")),e(t).siblings("li.e-active").length>0&&e(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(e,t){switch(t){case"slideDown":e.slideDown(this.model.enableAnimation?200:0,"easeOutQuad");break;case"none":e.css("display","block")}},_hideAnimation:function(t,i){switch(i){case"slideUp":e(t).attr({"aria-hidden":!0}),t.slideUp(this.model.enableAnimation?100:0,"easeOutQuad");break;case"none":t.css("display","none")}t.closest("li").removeClass("e-active e-mfocused")},_removeValue:function(i,s){for(var a=t.browserInfo(),n="8.0"===a.version&&"msie"===a.name?i[0].outerText:i[0].textContent,o=e(s).length,r=0,l=0==e(s).children("a").length?e(s).children("span"):e(s).children("a");r<=o;){if(e(l[r]).text()===n)return r;r++}},_createSubLevelItem:function(t,i){var s;s=e(document.createElement("ul")),s.append(i),t.append(s),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(s)},_insertArrows:function(t){this.model.showRootLevelArrows?t.find(">a,>span").append(e("").addClass("e-icon e-arrows")).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(e("").addClass("e-icon e-arrows")).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 i,s,a,n;return i=e(document.createElement("li")),i.attr({class:"e-list",role:"menuitem"}),t.htmlAttribute&&this._setAttributes(t.htmlAttribute,i),t.text&&""!=t.text&&(s=e(document.createElement("a")),t.imageUrl&&""!=t.imageUrl?(a=e(document.createElement("img")),a.attr("src",t.imageUrl),t.imageAttribute&&this._setAttributes(t.imageAttribute,a),s.append(a)):t.spriteCssClass&&""!=t.spriteCssClass&&(n=e(document.createElement("span")),n.addClass(t.spriteCssClass),s.append(n)),s.append(t.text),t.linkAttribute&&this._setAttributes(t.linkAttribute,s),t.url&&s.attr("href",t.url),i.append(s)),t.id&&i.prop("id",t.id),this.model.enabled||i.addClass("e-disable-item"),i},_insertNode:function(i,s,a){var n=0,o=0,r=0,l=[];for(e(s).is(this.element)?l.push(this.element):"string"==typeof s?l.push(this.element.find(s)):"undefined"==typeof s?l.push(this.element):l.push(s),o=0;o0&&e.inArray(t[0],this._hiddenMenuItems)==-1&&(t.addClass("e-hidden-item"),this._hiddenMenuItems.push(t[0]))},_showElement:function(t){t.length>0&&e.inArray(t[0],this._hiddenMenuItems)>-1&&(t.removeClass("e-hidden-item"),this._hiddenMenuItems.splice(this._hiddenMenuItems.indexOf(t[0]),1))},_getNodeByID:function(t){return"object"!=typeof t&&""!=t&&(t=this.element.find(".e-list"+t)),e(t)},_processItems:function(t,i){for(var s=this._getNodeByID(t),a=0;aa ,li.e-list >span")).filter(function(){return e.trim(e(this).text())===t});i.length>0&&!(e.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.e-arrows").addClass("e-disable"),this._disabledMenuItems.push(i.parent()[0]))},disableItemByID:function(t){if(t&&""!=t){var s=this.element.find("#"+t)?this.element.find("#"+t)[0]:i;!s||e.inArray(s,this._disabledMenuItems)>-1||(e(s).addClass("e-disable-item").attr({"aria-disabled":!0}),e(s).find(">a.aschild span.e-icon.e-arrows").addClass("e-disable"),this._disabledMenuItems.push(s))}},getHiddenItems:function(){return this._hiddenMenuItems},hideItems:function(e){if("object"==typeof e&&e.length!==i)for(var t=0;ta ,li.e-list >span")).filter(function(){return e.trim(e(this).text())===t});s.length>0&&e.inArray(s.parent()[0],this._disabledMenuItems)>-1&&(s.parent().removeClass("e-disable-item").attr({"aria-disabled":!1}),s.parent().find(">a.aschild span.e-icon.e-arrows").removeClass("e-disable"),i=this._removeValue(s,this._disabledMenuItems),this._disabledMenuItems.splice(i,1))},enableItemByID:function(t){var i,s;if(t&&""!=t&&(i=this.element.find("#"+t)[0],i&&e.inArray(i,this._disabledMenuItems)>-1))for(e(i).removeClass("e-disable-item").attr({"aria-disabled":!1}),e(i).find(">a.aschild span.e-icon.e-arrows").removeClass("e-disable"),s=this._disabledMenuItems.length-1;s>=0;s--)this._disabledMenuItems[s].id==t&&this._disabledMenuItems.splice(s,1)},disable:function(){this.model.enabled=!1;var t=this.element.find(">li[class~=e-list]"),i=this;e.each(t,function(t,s){e(s).addClass("e-disable-item").attr({"aria-disabled":!0}),e(s).find(">a.aschild span.e-icon.e-arrows").addClass("e-disable"),i._disabledMenuItems.push(s)})},enable:function(){var t,i=this;this.model.enabled=!0,t=this.element.find("li.e-disable-item"),e.each(t,function(t,s){e(s).removeClass("e-disable-item").attr({"aria-disabled":!1}),e(s).find(">a.aschild span.e-icon.e-arrows").removeClass("e-disable"),i._disabledMenuItems.pop(s)})},show:function(e,t,i,s){return!!this.model.enabled&&void("contextmenu"==this.model.menuType?this.showContextMenu(e,t,i,s,!1):this.element.css("display","block"))},hide:function(e){return!!this.model.enabled&&void("contextmenu"==this.model.menuType?this.hideContextMenu(e):(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,"click",this._onClickHandler),this[t](this.element,"keydown",this._onKeyDownHandler),this[t](this.element,"focus",this._OnFocusHandler),this[t](this.element,"blur",this._OnFocusOutHandler),"contextmenu"==this.model.menuType&&null!=e(this.model.contextMenuTarget)[0]&&this._contextMenuEvents(t),"contextmenu"!=this.model.menuType&&(this[t](e(document),"click",this._onDocumentClick),this[t](this.element,"mousedown",this._onMouseDownHandler))},_mouseOverHandler:function(i){var s,a,n,o="";if(this.element.find(".e-mhover").removeClass("e-mhover"),i.currentTarget=e(i.target).closest("li")[0],e(i.currentTarget).hasClass("e-disable-item")?this._isFocused=!1:e(i.currentTarget).addClass("e-mhover"),i.stopPropagation&&i.stopPropagation(),"undefined"!=typeof this._delaySubMenuHover&&clearTimeout(this._delaySubMenuHover),"undefined"!=typeof this._delaySubMenuHover&&clearTimeout(this._delayMenuHover),this._mouseOver=!0,this._isMenuOpen=!0,this._isSubMenuOpen=!e(i.currentTarget.parentNode.parentNode).is(this.element),"LI"==i.currentTarget.nodeName)s=i.currentTarget;else{if(!i.currentTarget.parentNode)return i.preventDefault(),!1;if("LI"!=i.currentTarget.parentNode.nodeName)return!1;s=i.currentTarget.parentNode}e(i.currentTarget).hasClass("e-disable-item")||this._onMenuIntent(s,this,this._hoverOpen),e.inArray(s,this._disabledMenuItems)>-1||(a=e(s).children("a,span").text(),o=t.isNullOrUndefined(s)?"":e(s)[0].id,n={text:a,element:s,event:i,ID:o},this._trigger("mouseover",e.extend({events:n},n)))},_onMouseDownHandler:function(t){e(t.target).hasClass("e-menu")&&(this._isFocused=!1)},_mouseOutHandler:function(i){var s,a,n,o="";if(e(i.currentTarget).removeClass("e-mhover"),i.stopPropagation&&i.stopPropagation(),"undefined"!=typeof this._delaySubMenuHover&&clearTimeout(this._delaySubMenuHover),"undefined"!=typeof this._delaySubMenuHover&&clearTimeout(this._delayMenuHover),this._mouseOver=!1,this._isMenuOpen=!1,"LI"==i.currentTarget.nodeName)s=i.currentTarget;else{if(!i.currentTarget.parentNode)return i.preventDefault(),!1;if("LI"!=i.currentTarget.parentNode.nodeName)return!1;s=i.currentTarget.parentNode}this._onHide(s,this,this._hoverClose),e.inArray(s,this._disabledMenuItems)>-1||(a=e(s).children("a,span").text(),o=t.isNullOrUndefined(s)?"":e(s)[0].id,n={text:a,element:s,event:i,ID:o},this._trigger("mouseout",e.extend({events:n},n)))},_onClickHandler:function(i){var s,a,n,o,r,l="";return this._isFocused=!0,a=!1,!e(i.target).closest("li.e-list").hasClass("e-disable-item")&&e(i.target).closest("li.e-list").length>0?(s=e(i.target).closest("li.e-list")[0],e(s).is(this.element.find(">li.e-list"))&&(this._activeElement=s),e(i.target).is("a")&&e(s).find(">a,>span").hasClass("aschild")&&this.model.openOnClick&&(this._isFocused=!1),!this._hoverOpen&&e(s).find(">a,>span").hasClass("aschild")&&(this._show(s,this._showAnim,this._hideAnim),this._hoverOpen=!1,a=!0),void(e.inArray(s,this._disabledMenuItems)>-1||("contextmenu"==this.model.menuType&&this._isContextMenuOpen&&!e(s).hasClass("e-haschild")&&(this._hideAnimation(this.element,this._hideAnim),this._isContextMenuOpen=!1,this._trigger("close",e.extend({events:i},i))),a||e(s).find(">a,>span").hasClass("aschild")||(this._closeMenu(),this.model.openOnClick&&(this._hoverOpen=!1)),n=e(s).children("a,span").text(),o=e(s).closest("ul").parent("li"),0!=o.length?(parentId=t.isNullOrUndefined(o.attr("id"))?null:o.attr("id"),parentText=o.children("a,span").text()):(parentId=null,parentText=null),l=t.isNullOrUndefined(s)?"":e(s)[0].id,r={text:n,element:s,event:i,selectedItem:this.selectedItem,ID:l,parentId:parentId,parentText:parentText},this._trigger("click",e.extend({events:r},r)),this.selectedItem=null,this.model.openOnClick&&"contextmenu"!=this.model.menuType&&this.element.focus()))):void(e(i.target).is(this.element)&&(this._activeElement=this.element.find(">li:first")))},_onKeyDownHandler:function(i){var s,a,n;if("contextmenu"!=this.model.menuType||this._isContextMenuOpen){var o,r,l,d="",h=this.element.find(".e-mhover"),c=this.element.find(".e-mfocused");if(!e(h).length>0&&e(this._activeElement).length>0&&(h=c=e(this._activeElement)),9==i.keyCode?(this._isFocused=!1,this._OnFocusOutHandler()):(37==i.keyCode||38==i.keyCode||39==i.keyCode||40==i.keyCode)&&i.preventDefault(),40==i.keyCode&&("horizontal"==this.model.orientation?this.element.find(">li.e-mhover").children("ul").length>0||e(this._activeElement).length>0?("none"===e(h).children("ul").css("display")&&this._show(h[h.length-1],this._showAnim,this._hideAnim),h.removeClass("e-mhover e-mfocused").children("ul:first").find("li:first").addClass("e-mhover"),null==this._activeElement?h.addClass("e-mfocused"):e(this._activeElement).addClass("e-mfocused")):(liVisible=h.parent().children("li.e-list:visible:not(.e-hidden-item, .e-disable-item)"),e(h[h.length-1]).removeClass("e-mfocused e-mhover"),r=e(liVisible[liVisible.index(h)+1]).length>0?e(liVisible[liVisible.index(h[h.length-1])+1]):liVisible.first(),r.addClass("e-mhover")):"horizontal"!=this.model.orientation&&(liVisible=0==h.length?this.element.children("li.e-list:visible:not(.e-hidden-item, .e-disable-item)"):h.parent().children("li.e-list:visible:not(.e-hidden-item, .e-disable-item)"),h.removeClass("e-mfocused e-mfocused"),h.length>0?(h.removeClass("e-mhover"),r=e(liVisible[liVisible.index(h[h.length-1])+1]).length>0?e(liVisible[liVisible.index(h[h.length-1])+1]):liVisible.first()):r=liVisible.first(),r.addClass("e-mhover"))),39==i.keyCode&&("horizontal"==this.model.orientation&&(this.element.find(">li.e-list").hasClass("e-mhover")||e(this._activeElement).length>0)?(h.removeClass("e-mfocused e-mhover"),liVisible=this.element.children("li.e-list:visible:not(.e-hidden-item, .e-disable-item)"),r=e(liVisible[liVisible.index(h[h.length-1])+1]).length>0?e(liVisible[liVisible.index(h[h.length-1])+1]):liVisible.first(),r.addClass("e-mhover")):e(h).children("ul").length>0?(h.removeClass("e-mfocused e-mhover"),s=h.children("ul:first").find("li:first"),this._show(h[h.length-1],this._showAnim,this._hideAnim),liVisible=h.addClass("e-mfocused").children("ul:first").children("li.e-list:visible:not(.e-hidden-item, .e-disable-item)"),r=e(liVisible[liVisible.index(s)]).length>0?e(liVisible[liVisible.index(s)]):liVisible.first(),r.addClass("e-mhover")):h.children("ul").length<=0&&"horizontal"==this.model.orientation&&h.parent().closest(".e-list").parent().hasClass("e-menu")&&(this._hideAnimation(h.parent(),this._hideAnim),h.removeClass("e-mfocused e-mhover"),e(c[c.length-1]).removeClass("e-mfocused"),liVisible=h.parent().closest(".e-list").parent().children("li.e-list:visible:not(.e-hidden-item, .e-disable-item)"),r=e(e(liVisible[liVisible.index(c[c.length-1])+1]).length>0?liVisible[liVisible.index(c[c.length-1])+1]:liVisible[liVisible.index(c.first())]),r.addClass("e-mhover"))),38==i.keyCode&&("horizontal"==this.model.orientation?(liVisible=h.parent().children("li.e-list:visible:not(.e-hidden-item, .e-disable-item)"),h.removeClass("e-mfocused e-mhover"),r=e(liVisible[liVisible.index(h[h.length-1])-1]).length>0?e(liVisible[liVisible.index(h[h.length-1])-1]):liVisible.last()):"horizontal"!=this.model.orientation&&(liVisible=0==h.length?this.element.children("li.e-list:visible:not(.e-hidden-item, .e-disable-item)"):h.parent().children("li.e-list:visible:not(.e-hidden-item, .e-disable-item)"),h.length>0?(h.removeClass("e-mfocused e-mhover"),r=e(liVisible[liVisible.index(h[h.length-1])-1]).length>0?e(liVisible[liVisible.index(h[h.length-1])-1]):liVisible.last()):r=liVisible.last()),r.addClass("e-mhover")),37==i.keyCode&&("horizontal"==this.model.orientation?this.element.find(">li.e-list").hasClass("e-mhover")||e(this._activeElement).length>0?(h.removeClass("e-mfocused e-mhover"),liVisible=this.element.find("li.e-list:visible:not(.e-hidden-item, .e-disable-item)"),r=e(liVisible[liVisible.index(h[h.length-1])-1]).length>0?e(liVisible[liVisible.index(h[h.length-1])-1]):liVisible.last(),r.addClass("e-mhover")):(this._hideAnimation(h.parent(),this._hideAnim),h.removeClass("e-mfocused e-mhover"),e(c[c.length-1]).removeClass("e-mfocused e-active"),liVisible=h.parent().closest(".e-list").parent().children("li.e-list:visible:not(.e-hidden-item, .e-disable-item)"),r=h.parent().closest(".e-list").parent(".e-menu").length>0?e(liVisible[liVisible.index(c[c.length-1])-1]).length>0?e(liVisible[liVisible.index(c[c.length-1])-1]):liVisible.last():e(liVisible[liVisible.index(c[c.length-1])]).length>0?e(liVisible[liVisible.index(c[c.length-1])]):liVisible.last(),r.addClass("e-mhover")):(0==h.parent("ul.e-menu").length||"contextmenu"==this.model.menuType&&0==h.parent("ul.e-context").length)&&(this._hideAnimation(h.parent(),this._hideAnim),h.removeClass("e-mfocused e-mhover"),e(c[c.length-1]).removeClass("e-mfocused"),liVisible=h.parent().closest(".e-list").parent().children("li.e-list:visible:not(.e-hidden-item, .e-disable-item)"),r=e(e(liVisible[liVisible.index(c[c.length-1])]).length>0?liVisible[liVisible.index(c[c.length-1])]:liVisible[liVisible.index(c.last())]),r.addClass("e-mhover"))),13==i.keyCode&&(a=e(h).children("a,span").text(),d=t.isNullOrUndefined(e(h)[0])?"":e(h)[0].id,n={menuId:this.element[0].id,text:a,selectedItem:c,ID:d},"contextmenu"==this.model.menuType?this._isContextMenuOpen&&h.length>0&&!c.hasClass("e-disable-item")&&(this.model.click&&this._trigger("click",e.extend({events:n},n)),this.selectedItem=null,this.hideContextMenu(i)):h.length>0&&!h.hasClass("e-disable-item")&&(e(h).find(">a,>span").hasClass("aschild")&&"none"===e(h).children("ul").css("display")?(this._show(h[0],this._showAnim,this._hideAnim),h.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(e(h).find(">a").attr("href"))&&this._trigger("click",e.extend({events:n},n)))),27==i.keyCode&&("contextmenu"==this.model.menuType?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()),!e(i.target).is(this.element)||!i.target.parentNode)return!1;h.length&&(o=h),e.inArray(o,this._disabledMenuItems)>-1||(a=e(o).children("a,span").text(),d=t.isNullOrUndefined(o)?"":e(o)[0].id,(this.element.find("li.e-mfocused.e-mhover").length||13==i.keyCode)&&(l=13==i.keyCode?h:this.element.find("li.e-mfocused.e-mhover")),n={text:a,element:o,targetElement:l,event:i,ID:d},this._trigger("keydown",e.extend({events:n},n))),this._activeElement=null,c=this.element.find(".e-mfocused")}},_OnFocusHandler:function(){"contextmenu"!=this.model.menuType&&!this.element.find(">li:first").hasClass("e-disable-item")&&this._isFocused&&0==this.element.find(".e-mhover").length?this.element.find(">li:first").addClass("e-mhover"):this._isFocused=!0,"contextmenu"!=this.model.menuType&&(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),e(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)},_ContextMenuHandler:function(e){var t,i,s,a,n,o=!1;"taphold"==e.type?o=!0:e.button?o=2==e.button:e.which&&(o=3==e.which),t=e.target,o?(i=e,"taphold"==e.type&&(i="touchstart"==e.options.type?e.options.touches[0]:e.options),s=this._showSpeed,this.showContextMenu(null,null,t,i,!0)):this._isContextMenuOpen&&(a=this._hideAnim,n=this._hideSpeed,this.hideContextMenu(e,a,n))},_calculateContextMenuPosition:function(t){locationX=t.clientX+this.element.width()this.element.height()?t.pageY-this.element.height():e(window).height()-this.element.outerHeight();var i="static"!=e("body").css("position")?e("body").offset():{left:0,top:0};return locationX-=i.left,locationY-=i.top,{X:locationX,Y:locationY}},_onDefaultPreventer:function(e){return e.preventDefault(),e.stopPropagation(),!1},_onContextClose:function(t){var i,s,a,n,o=this;this._isContextMenuOpen&&(i=!1,t.button?i=2==t.button:t.which&&(i=3==t.which),i=!(!(e(t.target).is(this.model.contextMenuTarget)||e(t.target).parents().is(this.model.contextMenuTarget)||e(t.target).is(this.element)||e(t.target).parents(".e-context").is(this.element))||this._checkForExclusion(t.target)),i||(s=this._hideAnim,a=this._hideSpeed,this.hideContextMenu(t,s,a),n=e(t.target).parents(),e.each(n,function(e,t){t.id==o._ContextTargetId})))}}),t.MenuType={NormalMenu:"normalmenu",ContextMenu:"contextmenu"},t.Direction={Left:"left",Right:"right",None:"none"},t.AnimationType={None:"none",Default:"default"}}(jQuery,Syncfusion),function(e,t,i){t.widget("ejPager","ej.Pager",{_rootCSS:"e-pager",validTags:["div"],defaults:{pageSize:12,pageCount:10,currentPage:1,enableExternalMessage:!1,externalMessage:"",enableQueryString:!1,locale:"en-US",masterObject:null,click:null,enableRTL:!1,totalRecordsCount:null,totalPages:null,customText:""},_init:function(){this._initPrivateProperties(),this.model.enableQueryString&&this._queryStringValue(),this.renderPager(),this._wireEvents()},_initPrivateProperties:function(){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()},_wireEvents:function(){this.model.click!=i&&this._on(this.element,"click",this._pagerClickHandler)},renderPager:function(){var e=t.buildTag("div.e-pagercontainer","",{},{unselectable:"on"}),i=t.buildTag("div.e-parentmsgbar");this._renderPagerContainer(e),this._renderMsgBar(i),this.element.append(e).append(i).addClass(this.model.enableRTL?"e-pager e-rtl":"e-pager"),this.model.enableExternalMessage&&this._renderPagerMessage()},_queryStringValue:function(){var e=new RegExp("[\\?&]page=([^&#]*)").exec(window.location.href);this.model.currentPage=e?parseInt(e[1]||1):1},_renderPagerMessage:function(){var e=t.buildTag("div.e-pagermessage");this.model.externalMessage.toString().length?e.html(this.model.externalMessage):e.hide(),this.element.append(e)},_renderPagerContainer:function(e){this._renderBackwardButton(e),this._renderpreviousPager(e),this._renderNumericItem(e),this._renderForwardPager(e),this._renderForwardButton(e)},_renderMsgBar:function(e){var i=t.buildTag("span.e-pagermsg",String.format(this.localizedLabels.pagerInfo,this.model.currentPage,this.model.totalPages||0,this.model.totalRecordsCount||0));e.append(i),e.css("text-align",t.TextAlign.Right)},_renderpreviousPager:function(e){this._$PP=t.buildTag("a.e-link e-nextprevitemdisabled e-disable e-spacing e-PP","...",{},{title:this.localizedLabels.previousPagerTooltip,role:"link"}),e.append(this._$PP)},_renderForwardPager:function(e){this._$NP=t.buildTag("a.e-link e-NP e-numericitem e-spacing e-default","...",{},{title:this.localizedLabels.nextPagerTooltip,role:"link"}),e.append(this._$NP)},_renderBackwardButton:function(e){this._$first=t.buildTag("div.e-first e-icon e-mediaback e-firstpagedisabled e-disable","",{},{unselectable:"on",title:this.localizedLabels.firstPageTooltip}),this._$prev=t.buildTag("div.e-prev e-icon e-arrowheadleft-2x e-prevpagedisabled e-disable","",{},{unselectable:"on",title:this.localizedLabels.previousPageTooltip}),e.append(this._$first),e.append(this._$prev)},_renderNumericItem:function(e){var i=t.buildTag("div.e-numericcontainer e-default","",{},{unselectable:"on",id:"NumericContainer"});this._renderNumericLinks(i,this.model.pageCount),e.append(i)},_renderNumericLinks:function(e){var i,s;for(e.empty(),i=1;i<=this.model.pageCount;i++)s=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&&s.removeClass("e-default").addClass("e-currentitem e-active"),e.append(s);this._links=e.children()},_renderForwardButton:function(e){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}),e.append(this._$next),e.append(this._$last)},_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==this._lastNP?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,0==this._lastpageCount&&(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||0==this.model.totalRecordsCount?(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"),e(this._links[(this.model.currentPage-1)%this.model.pageCount]).removeClass("e-default").addClass("e-currentitem e-active"),e(this._links[(this._prevPageNo-1)%this.model.pageCount]).removeClass("e-default").addClass("e-numericitem")),this.model.pageSize>=this.model.totalRecordsCount/this.model.pageCount&&null!=this._$PP&&0!=this._$PP.length&&(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.model.pageSize==0?this.model.totalRecordsCount/this.model.pageSize:parseInt(this.model.totalRecordsCount/this.model.pageSize,10)+1},_refreshNumericItem:function(){ var t,i,s;if(0!=this._links.length&&null!=this._links)for(this.model.currentPage=1==this.model.totalPages?1:this.model.currentPage,this.model.currentPage>this.model.totalPages&&0!=this.model.totalPages&&(this.model.currentPage=this.model.totalPages),t=parseInt(this.model.currentPage/this.model.pageCount,10),this.model.currentPage%this.model.pageCount==0&&t>0&&(t-=1),this._links.css("display","none"),i=0;i=this.model.totalPages&&(this._lastNP=!0)):this.model.currentPage++:s.hasClass("e-prevpage")&&1!=s.hasClass("e-prevpagedisabled")?(this.model.currentPage%this.model.pageCount==1&&(this._lastNP=!1),this.model.currentPage--,this.model.currentPage<0&&(this.model.currentPage=0)):s.hasClass("e-lastpage")&&1!=s.hasClass("e-lastpagedisabled")?(this._LastpageCount=this.model.totalPages%this.model.pageCount,0==this._LastpageCount?this._LastpageCount=this.model.pageCount:null,this.model.currentPage=this.model.totalPages,this._lastNP=!0):s.hasClass("e-firstpage")&&1!=s.hasClass("e-firstpagedisabled")?(this.model.currentPage=1,this._lastNP=!1):s.hasClass("e-NP")&&1!=s.hasClass("e-nextprevitemdisabled")?(this._links!=i&&(this.model.currentPage=parseInt(e(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.model.pageSize=1&&e<=this.model.totalPages?(this.model.currentPage=e,this.model.enableQueryString&&this._updateQueryString(this.model.currentPage),this._trigger("click",{currentPage:e,event:t})):this._trigger("click",{currentPage:e,event:t})},_updateQueryString:function(e){var t=this._getUpdatedURL(window.location.href,"page",e);history.pushState?window.history.pushState({path:t},"",t):window.location.href=t},_getUpdatedURL:function(e,t,i){var s,a,n=new RegExp("([?|&])"+t+"=.*?(&|#|$)","i");return e.match(n)?e.replace(n,"$1"+t+"="+i+"$2"):(s="",a=e.indexOf("?")!==-1?"&":"?",e.indexOf("#")!==-1&&(s=e.replace(/.*#/,"#"),e=e.replace(/#.*/,"")),e+a+t+"="+i+s)},_getLocalizedLabels:function(){return t.getLocalizedConstants(this.sfType,this.model.locale)},_setFirst:!0,_setModel:function(e){for(var t in e)switch(t){case"pageCount":this._renderNumericLinks(this.element.find("#NumericContainer"))}this.refreshPager()},_destroy:function(){this.element.empty().removeClass("e-pager")}}),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(e,t,i){t.widget("ejSlider","ej.Slider",{element:null,model:null,validTags:["div","span"],_addToPersist:["value","values"],_rootCSS:"e-slider",_setFirst:!1,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,start:null,stop:null,slide:null,change:null,create:null,destroy: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"},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(e){null==e||""===e?e=this.model.minValue:"string"==typeof e&&(e=parseFloat(e)),this._isNumber(e)?this.value(e):this._isNumber(this.value())||this.value(this.model.minValue),"range"!=this.model.sliderType&&this._setValue()},_validateRangeValue:function(e){if(null==e)e=[this.model.minValue,this.model.maxValue];else if("string"==typeof e){var t=e.split(",");t.length>1&&(e=[parseFloat(t[0]),parseFloat(t[1])])}"object"==typeof e&&this._isNumber(e[0])&&this._isNumber(e[1])?this.values([e[0],e[1]]):"object"==typeof this.values()&&this._isNumber(this.values()[0])&&this._isNumber(this.values()[1])||this.values([this.model.minValue,this.model.maxValue]),"range"==this.model.sliderType&&this._setRangeValue()},_validateStartEnd:function(){isNaN(this.model.minValue)&&(this.model.minValue=0),isNaN(this.model.maxValue)&&(this.model.maxValue=100)},_isNumber:function(e){return"number"==typeof e&&!isNaN(e)},_outerCorner:function(e){e?this._roundedCorner():this._sharpedCorner()},_changeSkin:function(e){this.element.removeClass(this.model.cssClass).addClass(e),this.model.showScale&&this.ul.removeClass(this.model.cssClass).addClass(e)},getValue:function(){return this._getHandleValue()},setValue:function(e){var t={};t["range"==this.model.sliderType?"values":"value"]=e,this._setModel(t)},_init:function(){this._isInteraction=!0,this._initialize(),this._render()},_setModel:function(e){var s,a;this._isInteraction=!1,t.isNullOrUndefined(e.minValue)&&t.isNullOrUndefined(e.maxValue)||(this._isNumber(e.minValue)?this.model.minValue=e.minValue:e.minValue=this.model.minValue,this._isNumber(e.maxValue)?this.model.maxValue=e.maxValue:e.maxValue=this.model.maxValue,"range"==this.model.sliderType&&e.values==i?this._setRangeValue():"range"!=this.model.sliderType&&e.value==i&&this._setValue());for(s in e)switch(s){case"value":this._validateValue(t.util.getVal(e[s])),e[s]=this.value();break;case"values":this._validateRangeValue(t.util.getVal(e[s])),e[s]=this.values();break;case"height":this.model.height=e[s],this._setDimension(),this.model.showScale&&this._scaleAlignment();break;case"width":this.model.width=e[s],this._setDimension(),this.model.showScale&&this._scaleAlignment();break;case"enabled":this._disabled(!e[s]);break;case"showRoundedCorner":this._outerCorner(e[s]);break;case"enableRTL":this.model.enableRTL=e[s],this._checkRTL(),e[s]=this.model.enableRTL;break;case"cssClass":this._changeSkin(e[s]);break;case"showScale":this._renderScale(e[s]);break;case"orientation":a=this.model.height,this.model.height=this.model.width,this.model.width=a;case"sliderType":this._sliderOptions(s,e[s]);break;case"smallStep":case"largeStep":case"showSmallTicks":case"minValue":case"maxValue":this._scaleOptions(s,e[s]);break;case"htmlAttributes":this._addAttr(e[s])}},_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.wrapper=t.buildTag("div.e-slider-wrap "+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),"default"!=this.model.sliderType&&(this.header=t.buildTag("div.e-range"),this.element.append(this.header),"range"==this.model.sliderType&&(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;e.map(t,function(e,t){"class"==t?i.wrapper.addClass(e):"disabled"==t&&"disabled"==e?i._disabled(!1):i.element.attr(t,e)})},_renderScale:function(e){var i,s,a,n,o,r;if(e){i="width",s="h","vertical"==this.model.orientation&&(i="height",s="v"),a=this.model.smallStep,this.model.showSmallTicks?a<=0&&(a=this.model.incrementStep):a=this.model.largeStep>0?this.model.largeStep:this.model.maxValue-this.model.minValue,n=Math.abs(this.model.maxValue-this.model.minValue)/a,this.ul=t.buildTag("ul.e-scale e-"+s+"-scale "+this.model.cssClass),this.wrapper.append(this.ul);var l,d=this.model.minValue,h=0,c=100/n;for("v"==s&&(d=this.model.maxValue),o=0;o<=n;o++)l=t.buildTag("li.e-tick","",{},{title:d}),l.css(i,c+"%"),d%this.model.largeStep==0&&(r=t.buildTag("span.e-tick-value",""+d),l.addClass("e-large").append(r)),this.ul.append(l),"h"==s?d+=a:d-=a,h+=a;this.ul.children().first().addClass("e-first-tick").css(i,c/2+"%"),this.ul.children().last().addClass("e-last-tick").css(i,c/2+"%"),this._scaleAlignment()}else this._destroyScale()},_destroyScale:function(){this.ul.remove(),this.ul=null},_tickValuePosition:function(){var e="vertical"==this.model.orientation?"height":"width",t="vertical"==this.model.orientation?"top":"left",i=this.ul.find(".e-tick.e-first-tick"),s=i.find(".e-tick-value"),a=this.ul.find(".e-tick.e-large:not(.e-first-tick)").find(".e-tick-value");tickWidth=2*i[e](),s.css(t,-s[e]()/2),a.css(t,(tickWidth-a[e]())/2)},_scaleAlignment:function(){var e;this._tickValuePosition();var t=12,i=20,s=i/2,a="height",n="top",o="h";"vertical"==this.model.orientation&&(a="width",n="right",o="v"),this.ul.css(n,-(this.wrapper[a]()+s)),"v"==o&&this.ul.css("top",-this.wrapper.height()).css(n,s),this.ul[a](this.wrapper[a]()+i),e=-(i-t)/2,null==this.model.largeStep&&"v"!=o&&(e=-e),this.ul.find(".e-tick:not(.e-large)").css(a,this.wrapper[a]()+t).css(n,e),"v"==o&&this.ul.children(".e-large").find(".e-tick-value").css("right",this.wrapper.width()+i+4)},_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}),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}).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.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(e){var t,i=-(this.firstHandle.outerWidth()/2)+"px";t="vertical"!=this.model.orientation?e?"0 "+i+" 0 0":"0 0 0 "+i:e?i+" 0 0 0":"0 0 "+i+" 0",this.element.children(".e-handle").css("margin",t)},_checkRTL:function(){var e,t,i;this.model.showScale&&"vertical"==this.model.orientation&&this.model.enableRTL&&(this.model.enableRTL=!1),e=this.model.enableRTL,t="vertical"!=this.model.orientation?this.horDir:this.verDir,e?(this.wrapper.addClass("e-rtl"),this.horDir="right",this.verDir="top"):(this.wrapper.removeClass("e-rtl"),this.horDir="left",this.verDir="bottom"),i="vertical"!=this.model.orientation?this.horDir:this.verDir,t!=i&&(this.firstHandle.css(i,this.firstHandle.css(t)).css(t,"auto"),"default"!=this.model.sliderType&&(this.header.css(i,this.header.css(t)).css(t,"auto"),"range"==this.model.sliderType&&this.secondHandle.css(i,this.secondHandle.css(t)).css(t,"auto"))),this._handleAlignment(e)},_setOrientation:function(){"vertical"!=this.model.orientation?this.wrapper.addClass("e-horizontal"):(this.wrapper.addClass("e-vertical"),this.firstHandle.css(this.verDir,"0"))},_setHandleSize:function(){var e;e="vertical"!=this.model.orientation?this.wrapper.height()+2:this.wrapper.width()+2,this.element.find(".e-handle").height(e).width(e)},_disabled:function(e){e?this.disable():this.enable()},_sliderOptions:function(e,t){this._unWireEvents(),this._destroy(),this.model[e]=t,this._init()},_scaleOptions:function(e,t){this.model.showScale&&(this._destroyScale(),this.model[e]=t,this._renderScale(!0))},_showTooltip:function(){this.model.showTooltip&&(e("body .e-tooltipbox").remove(),this.tooltip=t.buildTag("div.e-tooltipbox"+this.model.cssClass+" e-corner",{role:"tooltip"}),e("body").append(this.tooltip),this._setTooltipPosition())},_hideTooltip:function(){this.model.showTooltip&&this.tooltip.fadeOut(800)},_showhideTooltip:function(e){this.model.showTooltip&&e&&(this._showTooltip(),this._hideTooltip())},_setTooltipPosition:function(){var t,i,s,a,n,o,r,l,d,h;this.model.showTooltip&&(this._updateTooltipValue(),r=5,n=this._getHandle(),o=this._getOffset(n),tooltipPos=this._getOffset(this.tooltip),border=e(n).outerHeight()-e(n).height(),"vertical"==this.model.orientation?(a=(this.tooltip.outerHeight()-n.outerHeight())/2,s=n.outerWidth()+r,t=o.top-a,i=o.left+s,l=e(window).height(),window.pageYOffset>0&&(l+=window.pageYOffset),t<0?t=0:le(window).width()&&this.tooltip.css({left:"0px"}),s=(this.tooltip.outerWidth()-n.outerWidth())/2,a=this.tooltip.outerHeight()+r,t=o.top-a,i=o.left-s,d=e(window).width(),window.pageXOffset>0&&(d+=window.pageXOffset),i<0?i=0:de(window).height()?(t=o.top,i=o.left>this.tooltip.outerWidth()+r+border?o.left-(this.tooltip.outerWidth()+border):o.left+(n.outerWidth()+r+border)):t=o.top+n.outerHeight()+border)),h=this._maxZindex(),this.tooltip.css({top:t,left:i,zIndex:h+1}))},_getOffset:function(e){return t.util.getOffset(e)},_maxZindex:function(){return t.util.getZindexPartial(this.element,this.popup)},_updateTooltipValue:function(){var e,t=0,i=1;this.model.enableRTL&&(t=1,i=0),e=this._getHandleValue(),this.tooltip[0].innerHTML="range"!=this.model.sliderType?e:e[t]+" - "+e[i]},_increaseHeaderWidth:function(e){if("default"!=this.model.sliderType){var t="width",i=this.horDir,s={};"vertical"==this.model.orientation&&(t="height",i=this.verDir),"range"==this.model.sliderType?(s[t]=this.handlePos-this.handlePos2+"%",s[i]=this.handlePos2+"%"):(s[t]=this.handlePos+"%",s[i]=0),e?this.header.animate(s,this.model.animationSpeed):this.header.css(s)}},_setSliderValue:function(){this._validateStartEnd(),"range"==this.model.sliderType?this._validateRangeValue(this.values()):this._validateValue(this.value()),this.preValue=this.getValue().toString()},_hoverOnHandle:function(t){e(t.currentTarget).addClass("e-hover")},_leaveFromHandle:function(t){e(t.currentTarget).removeClass("e-hover")},_firstHandleClick:function(i){return i.preventDefault(),this.firstHandle.focus(),!this._raiseEvent("start")&&(this.mouseDownPos=this.handlePos,this.model.readOnly||e(document).bind(t.eventType.mouseMove,e.proxy(this._firstHandleMove,this)),e(document).bind(t.eventType.mouseUp,e.proxy(this._firstHandleUp,this)),e(document).bind("mouseleave",e.proxy(this._firstHandleUp,this)),void this._showTooltip())},_firstHandleMove:function(e){e.preventDefault(),e="touchmove"==e.type?e.originalEvent.changedTouches[0]:e;var t={x:e.pageX,y:e.pageY};this.handlePos=this._xyToPosition(t),"range"==this.model.sliderType&&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(),e(document).unbind(t.eventType.mouseMove,e.proxy(this._secondHandleMove,this)),e(document).unbind(t.eventType.mouseUp,e.proxy(this._secondHandleUp,this)),e(document).unbind("mouseleave",e.proxy(this._secondHandleUp,this)),this._hideTooltip(),this.mouseDownPos2!=this.handlePos2&&this._raiseChangeEvent()},_focusInHandle:function(t){this._isFocused||(this._isFocused=!0,e(t.currentTarget).addClass("e-focus"),this.model.readOnly||e(document).bind("keydown",e.proxy(this._moveHandle,this)),this.activeHandle=e(t.currentTarget).is(this.firstHandle)?1:2,this._setZindex())},_focusOutHandle:function(t){this._isFocused=!1,e(t.currentTarget).removeClass("e-focus"),e(document).unbind("keydown",e.proxy(this._moveHandle,this))},_moveHandle:function(e){var t,i,s,a,n;switch(s=this._getHandleIndex(this.activeHandle)-1,e.keyCode){case 37:case 40:e.preventDefault(),t="sub";break;case 38:case 39:e.preventDefault(),t="add";break;case 36:if(e.preventDefault(),this._raiseEvent("start"))return!1;"range"!=this.model.sliderType&&this.value()!=this.model.minValue?this._changeHandleValue(this.model.minValue,this.model.enableAnimation):"range"==this.model.sliderType&&(i=2==this.activeHandle?this.model.minValue:this.handleVal2,this.values()[s]!=i&&this._changeHandleValue(i,this.model.enableAnimation));break;case 35:if(e.preventDefault(),this._raiseEvent("start"))return!1;"range"!=this.model.sliderType&&this.value()!=this.model.maxValue?this._changeHandleValue(this.model.maxValue,this.model.enableAnimation):"range"==this.model.sliderType&&(i=1==this.activeHandle?this.model.maxValue:this.handleVal,this.values()[s]!=i&&this._changeHandleValue(i,this.model.enableAnimation));break;case 27:e.preventDefault(),this._getHandle().focusout()}if("add"==t||"sub"==t){if(this._raiseEvent("start"))return!1;a=1==this.activeHandle?this.handleVal:this.handleVal2,n="add"==t?this._add(a,this.model.incrementStep,!0):this._add(a,this.model.incrementStep,!1),this._changeHandleValue(n,!1)}},_changeHandleValue:function(e,t){var i=null;1==this.activeHandle?(this.handleVal=this._checkHandleValue(e),this.handlePos=this._checkHandlePosition(this.handleVal),"range"==this.model.sliderType&&this.handlePosi-this.handlePos2?(this.handlePos2=this.preHandlePos2=i,this.handleVal2=s,this.activeHandle=2):(this.handlePos=this.preHandlePos=i,this.handleVal=s,this.activeHandle=1),this._getHandle().focus(),"default"!=this.model.sliderType&&this._increaseHeaderWidth(this.model.enableAnimation),this._setHandlePosition(this.model.enableAnimation,!0,!0)}},_setHandlePosition:function(e,t,i){var s,a,n,o=this._getHandle(),r=this,l={};s=1==this.activeHandle?this.handlePos:this.handlePos2,a=1==this.activeHandle?this.handleVal:this.handleVal2,o.attr("aria-label",a),n="vertical"==this.model.orientation?this.verDir:this.horDir,l[n]=s+"%",e?o.animate(l,this.model.animationSpeed,function(){r._showhideTooltip(t),i&&r._raiseChangeEvent()}):(o.css(l),this._showhideTooltip(t),i&&this._raiseChangeEvent())},_xyToPosition:function(e){if(this.model.minValue==this.model.maxValue)return 100;if("vertical"!=this.model.orientation)var t=e.x-this.element.offset().left,i=this.element.width()/100,s=t/i;else var a=e.y-this.element.offset().top,i=this.element.height()/100,s=100-a/i;return s=this._stepValueCalculation(s),s<0?s=0:s>100&&(s=100),this.model.enableRTL?100-s:s},_updateValue:function(){this.handleVal=this._checkHandleValue(this.value()),this.handlePos=this._checkHandlePosition(this.handleVal),this.preHandlePos=this.handlePos,this.activeHandle=1},_setValue:function(){this._updateValue(),this._increaseHeaderWidth(this.model.enableAnimation),this._setHandlePosition(this.model.enableAnimation,!1,!0)},_updateRangeValue:function(){var e=this.values();this.handleVal=this._checkHandleValue(e[1]),this.handleVal2=this._checkHandleValue(e[0]),this.handlePos=this._checkHandlePosition(this.handleVal),this.handlePos2=this._checkHandlePosition(this.handleVal2),this.handlePos=t.start&&e<=t.end?100*(e-this.model.minValue)/(this.model.maxValue-this.model.minValue):et.end&&(e=t.end),e},_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(e){var t=this.model.maxValue-this.model.minValue,i=this._round(t*e/100);return this._add(i,this.model.minValue,!0)},_getHandle:function(){return 1==this.activeHandle?this.firstHandle:this.secondHandle},_getHandleIndex:function(e){return"range"==this.model.sliderType&&1==e?2:1},_getHandleValue:function(){return"range"==this.model.sliderType?[this.handleVal2,this.handleVal]:this.handleVal},_updateModelValue:function(){var e=this._getHandleValue();"range"==this.model.sliderType?this.values(e):this.value(e),this._hidden.val(e)},_add:function(e,t,i,s){var a=Math.pow(10,s||3);return i?(Math.round(e*a)+Math.round(t*a))/a:(Math.round(e*a)-Math.round(t*a))/a},_round:function(e){var t=this.model.incrementStep.toString().split(".");return t[1]?parseFloat(e.toFixed(t[1].length)):Math.round(e)},_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(e){var t={id:this.target.id,value:this._getHandleValue(),sliderIndex:this._getHandleIndex(this.activeHandle)};return"change"==e&&(t={id:this.target.id,isInteraction:this._isInteraction,value:this._getHandleValue(),sliderIndex:this._getHandleIndex(this.activeHandle)}),this._trigger(e,t)},_setZindex:function(){"range"==this.model.sliderType&&(1==this.activeHandle?(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(e){0==this.model.incrementStep&&(this.model.incrementStep=1);var t=this.model.incrementStep/((this.model.maxValue-this.model.minValue)/100),i=e%Math.abs(t);return 0!=i&&(t/2>i?e-=i:e+=Math.abs(t)-i),e},_wireEvents:function(){this._on(this.element,"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),"range"==this.model.sliderType&&(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.element,"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"),"range"==this.model.sliderType&&(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(e,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,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",targetID:"string",prefixIcon:"string",suffixIcon:"string",cssClass:"string",enableRTL:"boolean",htmlAttributes:"data"},disable:function(){this.element.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},enable:function(){this.element.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._wireEvents()},_destroy:function(){this.splitwrap.removeClass("e-drop"),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(),e("#"+this.model.targetID).ejMenu("destroy"),e("#"+this.model.targetID).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":this._setTargetId(t[i]);break;case"showRoundedCorner":this._roundedCorner(t[i]);break;case"cssClass":this._setSkin(t[i]);break;case"enableRTL":this._setRTL(t[i]),e("#"+this.model.targetID).ejMenu({enableRTL:t[i]});break;case"htmlAttributes":this._addAttr(t[i])}},_setText:function(e){this.model.contentType==t.ContentType.TextOnly?this.model.buttonMode==t.ButtonMode.Split?this.element.html(e):(this.element.empty(),this.imgtxtwrap=e,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(e)},_setMajorIcon:function(e){this.majorimgtag.removeClass(this.model.prefixIcon),this.majorimgtag.addClass(e)},_setMinorIcon:function(e){this.minorimgtag.removeClass(this.model.suffixIcon),this.minorimgtag.addClass(e)},_setTargetId:function(e){this.model.targetID=e,this._renderContxtMenu()},_setContentType:function(e){e!=this.model.contentType&&(this.element.empty(),this.model.contentType=e,this._renderButtonContent())},_setImagePosition:function(e){(e==t.ImagePosition.ImageRight||e==t.ImagePosition.ImageLeft||e==t.ImagePosition.ImageBottom||e==t.ImagePosition.ImageTop)&&this.model.contentType==t.ContentType.TextAndImage&&e!=this.model.imagePosition&&(this.element.empty(),this.model.imagePosition=e,this._renderButtonContent())},_setButtonMode:function(e){(e==t.ButtonMode.Split||e==t.ButtonMode.Dropdown)&&e!=this.model.buttonMode&&(this._destroy(),this.model.buttonMode=e,this._init())},_setArrowPosition:function(e){(e==t.ArrowPosition.Right||e==t.ArrowPosition.Left||e==t.ArrowPosition.Bottom||e==t.ArrowPosition.Top)&&(this.model.buttonMode==t.ButtonMode.Dropdown&&e!=this.model.arrowPosition?(this.model.arrowPosition=e,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&&e!=this.model.arrowPosition&&(this.model.arrowPosition=e,this._setSize(this.model.size),this.innerWrap.removeClass("e-splitarrowright e-splitarrowleft e-splitarrowbottom e-splitarrowtop"),this._setRTL(this.model.enableRTL)))},_setRTL:function(e){if(this.model.buttonMode==t.ButtonMode.Split){switch(this.dropdownimg.removeClass("e-up-arrow").addClass("e-down-arrow"),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-up-arrow").removeClass("e-down-arrow")}1==e?this.splitwrap.addClass("e-rtl e-btnrtl"):this.splitwrap.removeClass("e-rtl e-btnrtl")}else 1==e?this.splitwrap.addClass("e-rtl"):this.splitwrap.removeClass("e-rtl");this.model.enableRTL=e,this._roundedCorner(this.model.showRoundedCorner)},_roundedCorner:function(e){1==e?this.element.addClass("e-corner"):this.element.removeClass("e-corner")},_controlStatus:function(e){e?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),e("#"+this.model.targetID).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;e.map(t,function(e,t){"class"==t?i.wrapper.addClass(e):"disabled"==t&&"disabled"==e?i._controlStatus(!1):i.wrapper.attr(t,e)})},_render:function(){this.element.addClass(this.model.cssClass+" e-btn e-select e-split-btn").attr("role","button"),null==this.model.text||""==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"):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-down-arrow"),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#"+this.element[0].id+"drpbtn","",{},{type:"button","data-role":"none"}),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._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.e-icon "+this.model.prefixIcon),this.minorimgtag=t.buildTag("span.e-icon "+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(){switch(this.btnimgwrap.css("position","absolute"),this.dropdownimg.removeClass("e-up-arrow").addClass("e-down-arrow"),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-up-arrow").removeClass("e-down-arrow"),this.element.append(this.btnimgwrap,this.imgtxtwrap)}},_setSize:function(e){var i=this.model.height,s=this.model.width;switch(e){case"mini":""==i&&(i="28px"),""==s&&(s="63px"),this._splitbtnHeight(i),this._splitbtnWidth(s),this.element.css("font-size","12px");break;case"small":""==i&&(i="32px"),""==s&&(s="89px"),this._splitbtnHeight(i),this._splitbtnWidth(s),this.element.css("font-size","13px");break;case"medium":""==i&&(i="36px"),""==s&&(s="113px"),this._splitbtnHeight(i),this._splitbtnWidth(s),this.element.css("font-size","14px");break;case"large":""==i&&(i="40px"),""==s&&(s="130px"),this.element.css("font-size","15px"),this._splitbtnHeight(i),this._splitbtnWidth(s);break;default:this._splitbtnHeight(i),this._splitbtnWidth(s)}this.model.arrowPosition==t.ArrowPosition.Bottom&&""==this.model.height?this._splitbtnHeight(this.splitwrap.height()+(this.model.buttonMode==t.ButtonMode.Dropdown?15:24)):this.model.arrowPosition==t.ArrowPosition.Top&&""==this.model.height&&this._splitbtnHeight(this.splitwrap.height()+(this.model.buttonMode==t.ButtonMode.Dropdown?10:24))},_splitbtnHeight:function(e){(""==e||null==e)&&(e="30px"),this.splitwrap.css("height",e)},_splitbtnWidth:function(e){this.splitwrap.css("width",e)},_renderContxtMenu:function(){e("#"+this.model.targetID).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",e.proxy(this._onKeyDown,this))},_onKeyDown:function(e){27==e.keyCode&&this._hide()},_itemClick:function(t){e(t.element).hasClass("e-haschild")||this._hide(),t={status:this.model.enabled,ID:t.ID,text:t.text},this._trigger("itemSelected",t)},_itemMouseOver:function(e){this._trigger("itemMouseOver",e)},_itemMouseOut:function(e){this._trigger("itemMouseOut",e)},_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(e(document),"mousedown",this._docrhtclk)},_btnMouseClick:function(i){var s;e(i.currentTarget).hasClass("e-disable")||(i.currentTarget.id!=this.element[0].id+"drpbtn"&&this.model.buttonMode==t.ButtonMode.Split?(s={status:this.model.enabled},this._trigger("click",s)):(this.contstatus||this._trigger("beforeOpen"),this.wrapper.addClass("e-active"),this.contstatus?this._hidecontext(i):(this._contextPosition(i),this._trigger("open"),this._on(e(window),"resize",this._OnWindowResize),this.contstatus=!0,this.element.bind("click",e.proxy(this._hidecontext,this)),this._on(e(document),"mousedown",this._documentClick),this._on(t.getScrollableParents(this.wrapper),"scroll",this._hidePopup))))},_OnWindowResize:function(e){this._contextPosition(e)},_contextPosition:function(i){var s,a,n,o=this._getXYpos(i);a=this.model.buttonMode==t.ButtonMode.Split?this.dropbutton:this.element,n=e("#"+this.model.targetID).ejMenu("instance"),s=o.x-(e("#"+this.model.targetID).outerWidth()-(this.model.buttonMode==t.ButtonMode.Split?this.dropbutton.outerWidth():this.element.outerWidth())),o.x=this.model.enableRTL?s'),e(this.element).wrap(this.wrapper),this.labelFinder.insertAfter(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"}),this.labelFinder.append(this.buttontag),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;e.map(t,function(e,t){"class"==t?i.wrapper.addClass(e):"disabled"==t&&"disabled"==e?i.disable():"checked"==t&&"checked"==e?i._tglevaluestatus(this.toggleState()):i.wrapper.attr(t,e)})},_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.e-icon "+(this.toggleState()?this.model.activePrefixIcon:this.model.defaultPrefixIcon)+"#"+this.element[0].id+"mainiconstatic"),this.defMiniIcon=t.buildTag("span.e-icon "+(this.toggleState()?this.model.activeSuffixIcon:this.model.defaultSuffixIcon)+"#"+this.element[0].id+"miniconstatic")),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(e){e?(this._toggleButtonStatus(e),this.element.attr("checked","checked")):(this._toggleButtonStatus(e),this.element.removeAttr("checked"))},_roundedCorner:function(e){1==e?this.buttontag.addClass("e-corner"):this.buttontag.removeClass("e-corner")},_wireEvents:function(){this._on(this.buttontag,"click",this._tglebtnclicked)},_tglebtnclicked:function(i){this.model.preventToggle||this.buttontag.hasClass("e-disable")||(this.toggleState(!this.toggleState()),"msie"==t.browserInfo().name&&"8.0"==t.browserInfo().version?this._tglevaluestatus(this.toggleState()):this._toggleButtonStatus(this.toggleState()),e(this.element).prop("checked",this.toggleState()),i.preventDefault(),this._trigger("click",{isChecked:this.toggleState(),status:this.model.enabled}))},_toggleButtonStatus:function(e){e?(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(e),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(e,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 i,s,a,n,o;for(i in t)switch(s=t[i],i){case"size":this._setSize(s);break;case"height":this._setDimension("height",s);break;case"width":this._setDimension("width",s);break;case"enabled":this._setControlStatus(s);break;case"showRoundedCorner":this._setRoundedCorner(s);break;case"cssClass":this._setSkin(s);break;case"enableRTL":this._setRTL(s);break;case"htmlAttributes":this._setAttr(s);break;case"dataSource":this.element.html(""),this.model.dataSource=s,this._initialize();break;case"groupButtonMode":this.model.groupButtonMode!=s&&this.itemsContainer.children(".e-grp-btn-item.e-active").removeClass("e-active").attr({"aria-selected":!1});break;case"orientation":this._setOrientation(s),this._setDimension("width",s),this._setDimension("height",s);break;case"selectedItemIndex":for(a=JSON.parse(JSON.stringify(this.model.selectedItemIndex)),n=0,o=a.length;n0&&s.select(i),this.model.dataSource.dataSource.url.match(a.tableName+"$")||t.isNullOrUndefined(a.tableName)||s.from(a.tableName)}else s=this.model.query;return s},_createItems:function(e){this.list=e;var i;for(this.mapField=this._getMapper(),this.ultag=t.buildTag("ul"),this.element.append(this.ultag),i=0;i-1&&(i[s._prefixIcon]&&(n=t.buildTag("span.e-icon "+i[s._prefixIcon])),i[s._suffixIcon]&&(o=t.buildTag("span.e-icon "+i[s._suffixIcon]))),l){case t.ContentType.TextAndImage:switch(r){case t.ImagePosition.ImageRight:h.append(d,n);break;case t.ImagePosition.ImageLeft:h.append(n,d);break;case t.ImagePosition.ImageBottom:n.attr("style","display:inherit"),h.append(d,n);break;case t.ImagePosition.ImageTop:n.attr("style","display:inherit"),h.append(n,d)}break;case t.ContentType.ImageTextImage:h.append(n,d,o);break;case t.ContentType.ImageBoth:h.append(n,o);break;case t.ContentType.ImageOnly:h.append(n);break;case t.ContentType.TextOnly:h.append(d)}i[s._url]&&(aTag=t.buildTag("a.e-grp-btn-link").attr("href",i[s._url]),i[s._linkAttribute]&&this._setAttributes(i[s._linkAttribute],aTag),h.wrapInner(aTag)),this.ultag.append(h),i[s._selected]&&e.inArray(a,this.model.selectedItemIndex)<=-1&&this.model.selectedItemIndex.push(a)},_setAttributes:function(e,t){for(var i in e)"class"==i?t.addClass(e[i]):t.attr(i,e[i])},_renderItems:function(){var t;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 i,s,a=0,n=[],o=this.items.length;a0?n.children("a").children():n.children(),t.appendTo(i)),t=n.children("a").length>0?n.children("a"):n,t.append(i);this.items.filter(":last").addClass("last")},_handleSeletedItem:function(){var i,s,a=this.model.selectedItemIndex;if(this.model.groupButtonMode==t.GroupButtonMode.RadioButton)this._setSeletedItem(e(this.items[a[a.length-1]]));else for(i=0,s=a.length;i0?e(a[a.index(n)+1]):a.first()):(37==s||40==s)&&this.model.orientation!=t.Orientation.Vertical||(37==s||38==s)&&this.model.orientation==t.Orientation.Vertical?(i.preventDefault(),o=e(a[a.index(n)-1]).length>0?e(a[a.index(n)-1]):a.last()):36==s?(i.preventDefault(),o=a.first()):35==s?(i.preventDefault(),o=a.last()):32==s&&i.preventDefault(),o){if(r=this._getDetails(o),r.element=o,r.event=i,this._triggerEvent("keyPress",r))return;o.addClass("e-hover").siblings(".e-hover").removeClass("e-hover")}}else switch(s){case 13:case 32:i.preventDefault(),this._selectDeselect(n,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=e(t.currentTarget);i.hasClass("e-disable")||i.addClass("e-hover")},_onBtnLeave:function(t){var i=e(t.currentTarget);i.hasClass("e-disable")||i.removeClass("e-hover")},_onBtnClick:function(t){var i=e(t.currentTarget);i.hasClass("e-disable")||this._selectDeselect(i,t)},_onMouseDown:function(){this._clicked=!0},_triggerEvent:function(e,t){if(this._isRender)return this._trigger(e,t)},_wireUnwireEvents:function(e){this[e](this.element,"mousedown",this._onMouseDown)[e](this.element,"focus",this._onfocusIn)[e](this.element,"blur",this._onfocusOut),this[e](this.items,"click",this._onBtnClick)[e](this.items,"mouseenter",this._onBtnHover)[e](this.items,"mouseleave",this._onBtnLeave)},isSelected:function(e){return e=this._getNodeByID(e),null!=e[0]&&e.hasClass("e-grp-btn-item")?e.hasClass("e-active"):void 0},isDisabled:function(e){return e=this._getNodeByID(e),null!=e[0]&&e.hasClass("e-grp-btn-item")?"true"==e.attr("aria-disabled"):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(e){return e=this._getNodeByID(e),null!=e[0]&&e.hasClass("e-grp-btn-item")?this.items.index(e):void 0},enableItem:function(e){e=this._getNodeByID(e),null!=e[0]&&e.hasClass("e-grp-btn-item")&&(e.removeClass("e-disable").attr("aria-disabled",!1),e.next(".e-grp-btn-item").removeClass("e-border-left e-border-bottom"))},disableItem:function(e){e=this._getNodeByID(e),null!=e[0]&&e.hasClass("e-grp-btn-item")&&!e.hasClass("e-disable")&&(e.addClass("e-disable").attr("aria-disabled",!0),this.model.orientation==t.Orientation.Horizontal?(this._setDimension("width",this.model.width),e.next(".e-grp-btn-item").addClass("e-border-left")):(e.next(".e-grp-btn-item").addClass("e-border-bottom"),this._setDimension("height",this.model.height)))},selectItem:function(e){e=this._getNodeByID(e),null!=e[0]&&e.hasClass("e-grp-btn-item")&&this._setSeletedItem(e)},deselectItem:function(e){e=this._getNodeByID(e),null!=e[0]&&e.hasClass("e-grp-btn-item")&&this._removeSelection(e)},showItem:function(e){e=this._getNodeByID(e),null!=e[0]&&e.hasClass("e-grp-btn-item")&&(e.removeClass("e-hidden"),this._updateCss())},hideItem:function(e){e=this._getNodeByID(e),null!=e[0]&&e.hasClass("e-grp-btn-item")&&(e.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(e,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,enableSeparator:!1,orientation:"horizontal",enableRTL:!1,isResponsive:!1,showRoundedCorner:!1,htmlAttributes:{},dataSource:null,query:null,fields:{id:"id",tooltipText:"tooltipText",imageUrl:"imageUrl",text:"text",imageAttributes:"imageAttributes",spriteCssClass:"spriteCssClass",htmlAttributes:"htmlAttributes",group:"group"},cssClass:"",create:null,click:null,itemHover:null,itemLeave:null,destroy:null},dataTypes:{enabled:"boolean",hide:"boolean",enableSeparator:"boolean",orientation:"enum",enableRTL:"boolean",showRoundedCorner:"boolean",isResponsive:"boolean",dataSource:"data",query:"data",fields:"data",cssClass:"string",htmlAttributes:"data"},hide:function(){return!(!this.model.enabled&&"none"==this.element.css("display"))&&(this.element.css("display","none"),void(this.model.hide=!0))},show:function(){return!(!this.model.enabled&&"none"!=this.element.css("display"))&&(this.element.css("display","block"),void(this.model.hide=!1))},_init:function(){this._cloneElement=e(this.element).clone(),null!=this.model.dataSource&&this._generateTemplate(),this.model.dataSource instanceof t.DataManager||this._initialize()},_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"isResponsive":this.model.isResponsive=t[i],this.model.isResponsive?this._responsiveLayout():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"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":e.extend(this.model.fields,t[i]);break;case"query":this.model.query=t[i];break;case"dataSource":for(optio in t)"fields"==optio&&e.extend(this.model.fields,t[optio]),"query"==optio&&(this.model.query=t[optio]);this._refreshTagItems(i,t[i])}},_refreshTagItems:function(e,t){this.model[e]=t,this.element.empty(),this._generateTemplate(),this._initialize()},_setHeight:function(e){this.element.css("height",e)},_setWidth:function(){var t,i;if("auto"==this.model.width){var s=parseFloat(this.element.css("border-left-width"))+parseFloat(this.element.css("border-right-width")),a=this.element.find("ul").children("li"),n=this.element.find("ul"),o=this.element.find(".e-toolbar-res-arrow");for(t=0,i=n.length;t0&&(e(this.element).append(this._liTemplte.children()),this._renderToolbarSeparator(),this._liTemplte.addClass("e-display-none"),this._contstatus=!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.append(this.itemsContainer[t]));this._isResized=!0},_getZindexPartial:function(){return t.util.getZindexPartial(this.element,this.popup)},_getOffset:function(e){return t.util.getOffset(e)},_btnMouseClick:function(i){var s,a,n,o=1,r=this.element.outerWidth(),l=this.element.outerHeight(),d=e(this._liTemplte).outerWidth(),h=e(window).width(),c=e(window).scrollLeft();e(i.currentTarget).hasClass("e-disable")||(maxZ=this._getZindexPartial(),s=this._getOffset(this.element),a=this.model.enableRTL?s.left:s.left+r-d,n=s.top+l-o+2,a=ah+c?h-d+c-o:a,this._contstatus?(this._liTemplte.addClass("e-display-none"),this._contstatus=!1):(this._liTemplte.removeClass("e-display-none").css({top:n+"px",left:a+"px","z-index":maxZ}),this._contstatus=!0,this._on(t.getScrollableParents(this.element),"scroll",this._hidecontext),this.element.bind("click",e.proxy(this._hidecontext,this))),this._contstatus&&this._on(e(document),"mouseup",this._documentClick),this._removeListHover())},_hidecontext:function(i){e(i.target).is(e("#"+this.element[0].id+"_target"))||(this._liTemplte.addClass("e-display-none"),this._contstatus=!1,this.element.unbind("click",e.proxy(this._hidecontext,this)),this._off(t.getScrollableParents(this.element),"scroll",this._hidecontext),this._off(e(document),"mouseup",this._documentClick))},_documentClick:function(t){e(t.target).is(e("#"+this.element[0].id+"_target"))||0!=e(t.target).closest("div#"+this.element[0].id+"_hiddenlist").length||e(t.target).parents().hasClass("e-ddl-popup")||(this._liTemplte.addClass("e-display-none"),this._contstatus=!1,this._off(e(document),"mouseup",this._documentClick))},_setSkin:function(e){this.element.removeClass(this.model.cssClass).addClass(e)},_destroy:function(){this.element.html(""),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"});this.element.children().find("li");this._focusEnable=!0,this._renderControl(),this._responsiveLayout(),this._wireEvents()},_responsiveLayout:function(){this._roundedCorner(this.model.showRoundedCorner),this.model.isResponsive&&"horizontal"==this.model.orientation&&(this._spantag=e(""),this._spantag.appendTo(this.element),this._spanWidth=this._spantag.outerWidth(!0)+8,this._liTemplte=e("
    "),this.model.enableRTL&&this._liTemplte.addClass("e-rtl"),this._isResized=!1,this._reSizeHandler(),e("body").append(this._liTemplte)),this._on(e("#"+this.element[0].id+"_target"),"mousedown",this._btnMouseClick),this._wireResizing(),this._controlVisibleOptions(this.model.hide),this._enableRTL(this.model.enableRTL),this._controlStatus(this.model.enabled),this._setWidth()},_removeResponsive:function(){e(this._spantag).remove();var t=e(this._liTemplte).children("ul");e(this._liTemplte).detach(),e(this.element).append(t),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),this._wireEvents(),this._wireResizing(),this._setWidth()},_controlVisibleOptions:function(e){0!=e?this.hide():this.show()},_controlStatus:function(e){1!=e?this.disable():this.enable()},_roundedCorner:function(e){e?(this.element.addClass("e-corner"),this._liTemplte&&this._liTemplte.addClass("e-corner")):(this.element.removeClass("e-corner"),this._liTemplte&&this._liTemplte.removeClass("e-corner"))},_generateTemplate:function(){var e,i=this;this.element.css("visibility","hidden"),this.model.dataSource instanceof t.DataManager?(e=this.model.dataSource.executeQuery(this.model.query),e.done(function(e){i._generateGroup(e.result),i._initialize(),i.element.css("visibility","visible")})):(i._generateGroup(i.model.dataSource),i.element.css("visibility","visible"))},_generateGroup:function(e){for(var t,i,s=this,a=-1,n=[],o=0;o0?this._liTemplte.find(".e-tooltxt").index(i):e(this.items).index(i),this._trigger("click",args)))},_onItemLeave:function(t){var i=e(t.currentTarget),s=t.target;i.hasClass("e-disable")||(this._removeSelection(),i.removeClass("e-hover"),args={currentTarget:i,target:s,status:this.model.enabled},this._trigger("itemLeave",args))},_onKeyPress:function(i){var s,a,n,o;if(s=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"),a=this._items.filter(".e-tooltxt:visible:not(.e-hidden, .e-disable)")):(this._keyPressed=!1,a=this.items.filter(".e-tooltxt:visible:not(.e-hidden, .e-disable)")),this._focusedItem?(n=this._focusedItem,this._focusedItem=null):n=a.filter(".e-hover"),"keydown"==i.type)(38==s||39==s)&&this.model.orientation!=t.Orientation.Vertical||(39==s||40==s)&&this.model.orientation==t.Orientation.Vertical?(i.preventDefault(),o=e(a[a.index(n)+1]).length>0?e(a[a.index(n)+1]):a.first()):(37==s||40==s)&&this.model.orientation!=t.Orientation.Vertical||(37==s||38==s)&&this.model.orientation==t.Orientation.Vertical?(i.preventDefault(),o=e(a[a.index(n)-1]).length>0?e(a[a.index(n)-1]):a.last()):33==s||36==s?(i.preventDefault(),o=a.first()):(34==s||35==s)&&(i.preventDefault(),o=a.last()),o&&(this._removeListHover(),o.addClass("e-hover"));else switch(s){case 13:case 32:if(i.preventDefault(),!n[0])break;args={currentTarget:n[0],target:e(n)[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=e(this.items).filter(".e-tooltxt:visible:not(.e-hidden, .e-disable)").first().index(),this._addListHover()}},_removeListHover:function(){e(this.items).removeClass("e-hover")},_addListHover:function(){var e=this._getActiveItem();e.hasClass("e-disable")||e.addClass("e-hover").focus()},_getActiveItem:function(){return e(this.model.isResponsive&&this._keyPressed?this._items[this._activeItem]:this.items[this._activeItem])},_targetBlur:function(e){e.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&&"true"!=this._currentItem.attr("aria-selected")&&this._currentItem.removeClass("e-active")},_focusElement:function(){return 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._removeListHover(),this._activeItem=this._clicked?-1:0,(this._getActiveItem().hasClass("e-disable")||this._getActiveItem().is(":hidden"))&&(this._activeItem=e(this.items).filter('li:not([class*="e-disable"])').first().index()),void this._addListHover()):void(this._focusEnable=!0)}})}(jQuery,Syncfusion),function(e,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-collapse",selectedHeader:"e-expand"},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:"data",disabledItems:"data",enableAnimation:"boolean",htmlAttributes:"data"},_setModel:function(t){var i,s,a,n,o,r,l;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":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":s=this.model.customIcon,a=t[i],this._headers.find("span."+s.header).removeClass(s.header).addClass(a.header),this._headers.find("span."+s.selectedHeader).removeClass(s.selectedHeader).addClass(a.selectedHeader);break;case"height":this.element.height(t[i]),this.model.height=t[i],"fill"!=this.model.heightAdjustMode?this._getHeight()>this.element.height()&&(this._scrollerObj?this._scrollerObj.option({height:this.element.height()}):this._setScoller()):this._setHeight();break;case"width":this.element.width(t[i]),this._scrollerObj&&this._scrollerObj.option("width",t[i]),t[i].toString().indexOf("%")?e(window).bind("resize",e.proxy(this._scrollerRefresh,this)):e(window).unbind("resize",e.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]);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)n=e.extend(!0,[],this.model.enabledItems),this._activeTab(this.model.enabledItems[0]);else if(this.model.selectedItemIndex>0&&this.model.selectedItemIndex<=this._headers.length)for(o=e.extend(!0,[],this.model.selectedItems),o.sort(function(e,t){return e-t}),this.model.selectedItemIndex=o[0],r=o,l=1;l :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,i=this,s=0,a=0;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(t){maxHeight-=e(this).outerHeight(),s+=e(this).outerHeight(),e(i._contentPanels[t]).hasClass("e-acrdn-content-active")&&(a+=e(i._contentPanels[t]).outerHeight())}),maxPadding=0,t=this.element.height()-(a+s),t>0?this._contentPanels.each(function(){e(this).height(e(this).height()+t/i.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 e=this.element.css("width");this.element.parent(".e-acrdn-scroller").ejScroller({height:this.element.height(),width:this.model.width}),this.element.css("width",e),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(){e(this).css({"padding-top":0,"padding-bottom":0}),e(this).css("height",t.model.headerSize);var i="string"==typeof t.model.headerSize&&t.model.headerSize.indexOf("px")!=-1?t.model.headerSize:t.model.headerSize+"px";e(e(this).find("a[href]")).css("line-height",i),e(this).find(".e-icon").length>0&&e(this).find(".e-icon").css("margin-top",e(this).height()/2-5)}),this.model.height&&("fill"!=this.model.heightAdjustMode?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,s=this;return this._headers.each(function(a){t+=e(this).outerHeight(),e(s._contentPanels[a]).hasClass("e-acrdn-content-active")&&(i+=e(s._contentPanels[a]).outerHeight())}),t+i},_setEnabledItems:function(){for(var t=0;t=0&&this.model.selectedItems.indexOf(e[s])==-1&&this._activeTab(e[s],!0);for(t=this.model.selectedItems.length,i=JSON.parse(JSON.stringify(this.model.selectedItems)),s=0;s0)for(var t=0;t=0&&this._activeTab(e[t],!0);else!(this.collapseALL&&this.model.collapsible)&&this.model.selectedItemIndex>=0&&this._activeTab(this.model.selectedItemIndex,!0)},_enabledAction:function(e){e?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||e(this._contentPanels[this.model.selectedItemIndex]).show()},_removeBaseClass:function(){this._headers.removeClass(" e-select"),this._contentPanels.removeClass("e-content").show()},_roundedCorner:function(e){e?this.element.addClass("e-corner"):this.element.hasClass("e-corner")&&this.element.removeClass("e-corner")},_nagativeIndexCheck:function(e){var t,i;if(e<0&&this.model.collapsible)for(this.collapseALL=!0,t=this.getItemsCount(),i=0;i=this._headers.length)&&(this.model.selectedItemIndex=0)},collapsePanel:function(e){this._expandcollapsepanel(!1,e)},expandPanel:function(e){this._expandcollapsepanel(!0,e)},_expandcollapsepanel:function(t,i){proxy=this,i instanceof Array?e.each(i,function(e,i){proxy._activehideIndex(t,i)}):"number"==typeof i&&proxy._activehideIndex(t,i)},_activehideIndex:function(e,t){t>=0&&t<=proxy._headers.length&&(e?this._activeTab(t,!1,!0):(this._hideTab(t,!1,!0),this._deleteSelectedItems(t),this.model.selectedItemIndex==t&&(this.model.selectedItemIndex=null)))},_activeTab:function(i,s,a){var n,o,r;if(e.inArray(i,this.model.disabledItems)<0){if(n={activeIndex:i,isInteraction:!a},!0===(!s&&this._trigger("beforeActivate",n)))return!1;this.model.enableMultipleOpen||this._hideTab(this.model.selectedItemIndex,s,a),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),n={activeHeader:this._activeHeader,activeIndex:this.model.selectedItemIndex,isInteraction:!a},r=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.model.expandSpeed:0,"easeOutQuad",function(){s||r._trigger("activate",n),r.model.height&&("fill"!=r.model.heightAdjustMode?r._getHeight()>r.element.height()&&(r._scrollerObj?r._scrollerObj.refresh():r._setScoller()):r._setHeight(),r._scrollerObj&&r._scrollerObj.refresh())}))}},_paneAdjustSize:function(){var t,i=this;"fill"===this.model.heightAdjustMode&&this.model.enableMultipleOpen&&(maxHeight=this._getDimension(e(this.element).parent(),"height"),e(this.element).parent().css({overflow:"auto"}),this._headers.each(function(){maxHeight-=i._getDimension(e(this),"outerHeight")}),t=0,t=Math.max(t,i._getDimension(e(this._activeHeader.next()),"outerHeight")-i._getDimension(e(this._activeHeader.next()),"height")),maxHeight=maxHeight/this.model.selectedItems.length-t,this._headers.next().animate({height:maxHeight},300))},_hideTab:function(e,t,i){var s,a,n=this.model.customIcon;if(e>=0){if(s={inActiveIndex:e,isInteraction:!i},!0===(!t&&this._trigger("beforeInactivate",s)))return!1;this._activeHeader=this._headers.eq(e).removeClass("e-active ").removeAttr("aria-selected").attr("tabindex",0).attr("aria-expanded",!1),this._activeHeader.find("span.e-icon").removeClass(n.selectedHeader).addClass(n.header),s={inActiveHeader:this._activeHeader,inActiveIndex:e,isInteraction:!i},a=this,a.raiseEvent=t,this._activeHeader.next().removeClass("e-acrdn-content-active").attr("aria-hidden",!0).slideUp(this.model.enableAnimation?this.model.collapseSpeed:0,"easeOutQuad",function(){a.raiseEvent||a._trigger("inActivate",s),a.model.height&&("fill"!=a.model.heightAdjustMode?a._getHeight()>a.element.height()&&(a._scrollerObj?a._scrollerObj.refresh():a._setScoller()):a._setHeight()),a._scrollerObj&&a._scrollerObj.refresh(),a._paneAdjustSize()}),this._deleteSelectedItems(e)}},_renderHeaderIcon:function(){if(this._headers.find(".e-icon").length<=0){var e=this.model.customIcon;e&&(this.collapseALL&&this.model.collapsible||this._headers.eq(this.model.selectedItemIndex).find("span.e-icon").removeClass(e.header).addClass(e.selectedHeader))}},_ajaxLoad:function(){var t,i,s=this._activeHeader.find("a[href]");s.length>0&&(t=e(this._contentPanels[this.model.selectedItemIndex]),i=e(s).attr("href"),i&&"#"!==i&&this._sendAjaxOptions(t,s[0]))},_sendAjaxOptions:function(t,i){if(!0===this._trigger("ajaxBeforeLoad",{url:i}))return!1;t.addClass("e-load");var s=this,a=e(i).html(),n=i.href.replace("#",""),o={type:this.model.ajaxSettings.type,cache:this.model.ajaxSettings.cache,url:n,data:this.model.ajaxSettings.data,dataType:this.model.ajaxSettings.dataType,contentType:this.model.ajaxSettings.contentType,async:this.model.ajaxSettings.async,success:function(e){try{s._ajaxSuccessHandler(e,t,i,a)}catch(e){}},error:function(){try{s._ajaxErrorHandler(data,i,s.model.selectedItemIndex,a)}catch(e){}}};this._sendAjaxRequest(o)},_sendAjaxRequest:function(t){e.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,s,a){null!=a&&e(s).html(a),i.removeClass("e-load"),i.html(t).addClass("e-acrdn-loaded");var n={data:t,url:s,content:i};this._trigger("ajaxSuccess",n),this._trigger("ajaxLoad",{url:s})},_ajaxErrorHandler:function(e,t){this._trigger("ajaxError",{data:e,url:t}),this._trigger("ajaxLoad",{url:t})},_setHeightStyle:function(i){var s,a,n=this;t.Accordion.HeightAdjustMode.Fill==i?null!=this.model.height?this._setHeight():(s=this._getDimension(e(this.element).parent(),"height"),e(this.element).parent().css({overflow:"auto"}),n._headers.each(function(){s-=n._getDimension(e(this),"outerHeight")}),a=0,n._headers.next().each(function(){a=Math.max(a,n._getDimension(e(this),"outerHeight")-n._getDimension(e(this),"height"))}).height(s-a).css({overflow:"auto"})):t.Accordion.HeightAdjustMode.Auto==i&&(s=0,n._headers.next().each(function(){s=Math.max(s,n._getDimension(e(this),"outerHeight"))}).height(s),this.maxAutoHeight=s),t.Accordion.HeightAdjustMode.Fill!=i&&this.model.height&&this._getHeight()>this.element.height()&&this._setScoller()},_getDimension:function(t,i){var s,a=e(t).parents().andSelf().filter(":hidden"),n={visibility:"hidden",display:"block"},o=[];return a.each(function(){var e={};for(var t in n)e[t]=this.style[t],this.style[t]=n[t];o.push(e)}),s=/(outer)/g.test(i)?e(t)[i](!0):e(t)[i](),a.each(function(e){var t=o[e];for(var i in n)this.style[i]=t[i]}),s},_headerEventHandler:function(t){if(this.model.enabled){t.preventDefault();var i=e(t.currentTarget),s=this._headers.index(i);this.model.enableMultipleOpen&&this._headers.eq(s).hasClass("e-active")?this._hideTab(s):this.model.selectedItemIndex==s&&this.model.collapsible?(this._hideTab(this.model.selectedItemIndex),this.model.selectedItemIndex=-1):this._headers.eq(s).hasClass("e-active")||this._activeTab(s)}},_addSelectedItems:function(t){var i=this.model.selectedItems;this._removeNullInArray(i),e.inArray(t,i)==-1&&this.model.selectedItems.push(t)},_deleteSelectedItems:function(t){var i=this.model.selectedItems;e.inArray(t,i)>-1&&(this.model.selectedItems.splice(e.inArray(t,i),1),0==i.length&&i.push(-1))},_removeNullInArray:function(e){var t=e.indexOf(-1);t!=-1&&e.splice(t,1)},_deleteDisabledItems:function(t){e.inArray(t,this.model.disabledItems)>-1&&(position=e.inArray(t,this.model.disabledItems),this.model.disabledItems.splice(position,1))},_addEnabledItems:function(t){e.inArray(t,this.model.enabledItems)<0&&this.model.enabledItems.push(t)},_deleteEnabledItems:function(t){e.inArray(t,this.model.enabledItems)>-1&&(position=e.inArray(t,this.model.enabledItems),this.model.enabledItems.splice(position,1))},_keyPress:function(i){if(this.model.enabled){var s,a,n=e(i.target);if((n.hasClass("e-select")||n.hasClass("e-acrdn"))&&(s=this.model.selectedItemIndex),code=i.keyCode?i.keyCode:i.which?i.which:i.charCode,n.hasClass("e-select")||n.hasClass("e-acrdn"))switch(code){case 39:case 40:i.preventDefault(),s=s==this.getItemsCount()-1?0:s+1,this._activeTab(s),a=e(this._headers[s]);break;case 38:case 37:i.preventDefault(),s=0==s?this.getItemsCount()-1:s-1,this._activeTab(s),a=e(this._headers[s]);break;case 35:i.preventDefault(),a=e(this._headers[this.getItemsCount()-1]),this._activeTab(this.getItemsCount()-1);break;case 36:i.preventDefault(),a=e(this._headers[0]),this._activeTab(0);break;case 32:case 13:i.preventDefault(),e(this._headers[s]).hasClass("e-active")&&(this.model.enableMultipleOpen||this.model.collapsible)?this._hideTab(s):this._activeTab(s)}else if(i.ctrlKey&&!n.hasClass("e-acrdn"))switch(code){case 38:i.preventDefault(),s=this._contentPanels.index(n.parent(".e-content")),a=e(this._headers[s]),this._activeTab(s);break;case 33:i.preventDefault(),a=e(this._headers[0]),this._activeTab(0);break;case 34:i.preventDefault(),a=e(this._headers[this.getItemsCount()-1]),this._activeTab(this.getItemsCount()-1)}t.isNullOrUndefined(a)||(a.addClass("e-focus"),a.focus())}},_wireEvents:function(){this._on(this._headers,this.model.events,this._headerEventHandler),this.model.allowKeyboardNavigation&&this._on(this.element,"keydown",this._keyPress),e(window).bind("resize",e.proxy(this._contentPaneSize,this)),this.model.height&&this.model.width&&this.model.width.toString().indexOf("%")!=-1&&e(window).bind("resize",e.proxy(this._scrollerRefresh,this))},_scrollerRefresh:function(){this.model.height&&("fill"!=this.model.heightAdjustMode?this._getHeight()>this.model.height&&(this._scrollerObj?this._scrollerObj.refresh():this._setScoller()):this._setHeight())},_unWireEvents:function(){this._off(this._headers,this.model.events),e(window).unbind("resize",e.proxy(this._contentPaneSize,this)),this.model.allowKeyboardNavigation&&this._off(this.element,"keydown")},_contentPaneSize:function(){var i=this._getDimension(e(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,s,a;if(e.isArray(t))for(i=0;i=0&&(s++,this.model.selectedItemIndex=s);if(s==this._headers.length)for(s-=1,i=0;i=0&&(s--,this.model.selectedItemIndex=s);a!==this.model.selectedItemIndex&&this._selectedItemsAction(s)}},enableItems:function(t){if(!this.model.enabled)return!1;if(e.isArray(t))for(var i=0;ithis._headers.length)this._addItemIndex=this._headers.length;else{if(!(a>=0&&a<=this._headers.length))return!1;this._addItemIndex=a}for(r=this.model.enableAnimation,r&&(this.model.enableAnimation=!1),"fill"==this.model.heightAdjustMode&&this._headers.next().height("auto"),l=0;l=this._addItemIndex&&this.model.disabledItems[l]++;if(d=t.buildTag("h3").addClass("e-select").attr("role","tab").attr("tabindex",0),0==this._addItemIndex?d.insertBefore(e(this._headers[this._addItemIndex])):d.insertAfter(e(this._headers[this._addItemIndex-1]).next()),this._addItemIndex<=this.model.selectedItemIndex&&(this.model.selectedItemIndex+=1),this._headers.length||(this._headers=d,this.element.append(this._headers),this.model.selectedItemIndex=0),h=t.buildTag("a").attr("href",n?s:"#").text(i),h.appendTo(d),n&&(s=""),o=e(s).length>0?e(s):t.buildTag("div").text(s),o.addClass("e-content").attr("role","tabpanel").attr("aria-hidden",!0).hide(),o.insertAfter(d),this._headers=this.element.find("> :even"),this._contentPanels=this._headers.next(),t.buildTag("span.e-icon "+this.model.customIcon.header).prependTo(d),this.model.showCloseButton&&(c=this._createDeleteIcon(),d.append(c),this._on(c,"click",this._panelDeleteClick)),this.model.enableMultipleOpen){for(this.model.selectedItems=[],u=0;u-1&&tt?this.model.disabledItems[a]--:this.model.disabledItems[a]==t&&this.model.disabledItems.splice(a,1);if(e(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:0==t&&0==this.model.selectedItemIndex?this.model.selectedItemIndex=0:t<=this.model.selectedItemIndex&&(this.model.selectedItemIndex-=1)),this._unWireEvents(),this._wireEvents(),this._enabledAction(this.model.enabled),"fill"!=this.model.heightAdjustMode||this.model.enableMultipleOpen||this._setHeightStyle(this.model.heightAdjustMode),this.model.enableMultipleOpen){for(this.model.selectedItems=[],n=0;n0&&this._scrollerObj.disable()),this._unWireEvents()},enable:function(){this.model.enabled=!0;for(var e=0;ee&&(this.model.minValue=e),this.model.value>e&&(this.model.value=e),this.model.maxValue=e,this._setProgressValue()},_setTop:function(){var e=(this.element.height()-this.text.height())/2;this.text.css("top",Math.floor(e))},_increaseProgressWidth:function(){this.header.css("width",this.model.percentage+"%"),0==this.initial&&this.model.percentage!=this.initial&&this._raiseEvent("start"),this._preVal!=this.model.value&&(this._preVal=this.model.value,e(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"),100==this.model.percentage&&(this.header.addClass("e-complete"),this._raiseEvent("complete")))},_raiseEvent:function(e){this._trigger(e,{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(e){return"number"==typeof e&&!isNaN(e)},_validateRange:function(e,t,i){return ei?i:e},_valueToPercent:function(e){return this.model.maxValue<=this.model.minValue?100:(e=this._validateRange(e,this.model.minValue,this.model.maxValue),100*(e-this.model.minValue)/(this.model.maxValue-this.model.minValue))},_percentToValue:function(e){if(this.model.maxValue<=this.model.minValue)return this.model.minValue;if(e>=0&&e<=100){var t=this.model.maxValue-this.model.minValue,i=t*e/100;e=i+this.model.minValue}else e<0?e=this.model.minValue:e>100&&(e=this.model.maxValue);return e}})}(jQuery,Syncfusion),function(e,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(e){for(var i in e)switch(i){case"allowReset":e[i]?this._showResetButton():this._hideResetButton();break;case"value":this.setValue(t.util.getVal(e[i])),e[i]=this.model.value;break;case"enabled":this._enabledAction(e[i]);break;case"cssClass":this._changeSkin(e[i]);break;case"height":this._mainDiv.height(e[i]);break;case"width":this._mainDiv.width(e[i]);break;case"readOnly":this.model.readOnly=e[i],e[i]?(this._unWireEvents(),this._on(this._mainDiv.find("li"),"mouseleave touchend",this._MouseOutHandler)):this.refresh();break;case"orientation":this.model.orientation=e[i],this.refresh();break;case"maxValue":this.model.maxValue=e[i],this.refresh();break;case"minValue":this.model.minValue=e[i],this.refresh();break;case"incrementStep":this.model.incrementStep=e[i],this.refresh();break;case"shapeWidth":this.model.shapeWidth=e[i],this.refresh();break;case"shapeHeight":this.model.shapeHeight=e[i],this.refresh();break;case"htmlAttributes":this._addAttr(e[i])}},_destroy:function(){this.element.show(),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(),1==this.model.value&&""!=this.element[0].value&&(this.model.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)},_checkNameAttr:function(){this.element.attr("name")||this.element.attr({name:this.element[0].id})},_addAttr:function(t){var i=this;e.map(t,function(e,t){"class"==t?i._mainDiv.addClass(e):"name"==t?i.element.attr(t,e):"readonly"==t?i.model.readOnly=e:"disabled"==t&&"disabled"==e?i._enabledAction(!1):i._mainDiv.attr(t,e)})},_changeSkin:function(e){this.model.cssClass!=e&&this._mainDiv.removeClass(this.model.cssClass).addClass(e)},_enabledAction:function(e){e?(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 e,i,s,a,n,o=Math.round(this.model.maxValue/this.model.incrementStep),r=Math.round(this.model.minValue/this.model.incrementStep);if(this.model.orientation==t.Rating.Orientation.Horizontal?(e=(o+1)*this.model.shapeWidth,i=this.model.shapeHeight):this.model.orientation==t.Rating.Orientation.Vertical&&(e=this.model.shapeWidth,i=this.model.shapeHeight*o),o>0){for(s=t.buildTag("ul.e-ul","",{width:e+"px",height:i},{}),a=r;athis.model.minValue)for(i=this.value()/this.model.incrementStep-this.model.minValue/this.model.incrementStep,this._CurrentIndex=i,this._valueRefresh(this._CurrentIndex),s=0;s.5?1:.5:1,s=(0!=(s%1).toFixed(1)?a:s/this._CurrentIndex)*this.model.shapeWidth,n=0;n=parseFloat(this.toolTipValue)&&this._showhideTooltip(i.target)},_showTooltip:function(i){this.model.showTooltip&&(e(".e-tooltipbox").remove(),this.tooltip=t.buildTag("div#"+this.element.prop("id")+"_tooltip.e-tooltipbox"+this.model.cssClass+" e-corner-all","",{},{role:"tooltip"}),e("body").append(this.tooltip),this._isTooltip=!0,this._setTooltipPosition(i))},_hideTooltip:function(t){this.model.showTooltip&&(e(this.tooltip).fadeOut(t,function(){e(".e-tooltipbox").remove()}),this._isTooltip=!1)},_showhideTooltip:function(e){this.model.showTooltip&&this._showTooltip(e)},_setTooltipPosition:function(t){if(this.model.showTooltip){this._updateTooltipValue();var i,s,a,n,o,r,l=5;o=e(t),r=this._getOffset(o),"vertical"==this.model.orientation?(n=(this.tooltip.outerHeight()-o.outerHeight())/2,a=o.outerWidth()+l,i=r.top-n,s=r.left+a):(a=(this.tooltip.outerWidth()-o.outerWidth())/2,n=this.tooltip.outerHeight()+l,i=r.top-n,s=r.left-a),this.tooltip.css({top:i,left:s})}},_getOffset:function(e){return t.util.getOffset(e)},_updateTooltipValue:function(){this.tooltip[0].innerHTML=this.toolTipValue},_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").unbind("mouseenter touchmove"),this._mainDiv.find("li").unbind("mouseleave touchend"),this._mainDiv.unbind("mousedown"),this.model.precision!==t.Rating.Precision.Full&&this._mainDiv.find("li").unbind(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(){return!!this.model.enabled&&void this._mainDiv.css("visibility","visible")},hide:function(){return!!this.model.enabled&&void this._mainDiv.css("visibility","hidden")},_showResetButton:function(){return!!this.model.enabled&&void this._createReset()},_hideResetButton:function(){return!!this.model.enabled&&void this._mainDiv.find("div.e-reset").hide()},getValue:function(){return null==this.value()||""===this.value()?"":this.value()},setValue:function(t){null!=t&&(this.model.maxValuet&&(t=this.model.minValue),this.value(t),e(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(e,t){t.widget("ejRotator","ej.Rotator",{element:null,model:null,_setFirst:!1,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,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",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(),null==this.model.dataSource&&this._setValues(),this._render(),this._wireEvent(),this.model.enableAutoPlay&&this.play(),this.model.enabled||"msie"!=t.browserInfo().name||"8.0"!=t.browserInfo().version||(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.containerCss=this.model.orientation==t.Orientation.Horizontal?"outerWidth":"outerHeight",this.displayCss=this.model.orientation==t.Orientation.Horizontal?"left":"top",e.extend(jQuery.easing,{slowSlide:function(e,t,i,s,a){var n=(t/=a)*t;return i+s*n*n},fastSlide:function(e,t,i,s,a){var n=(t/=a)*t,o=n*t;return i+s*(o*n+-5*n*n+10*o+-10*n+5*t)},slide:function(e,t,i,s,a){var n=(t/=a)*t,o=n*t;return i+s*(6*o*n+-15*n*n+10*o)}})},_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.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(),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.element.parents(".e-in-wrap").siblings().hasClass("e-thumb")&&(this._thumb.remove(),t.isNullOrUndefined(this._thumbControl)||this._thumbControl.remove()),this._createThumb()):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 e=this.model.dataSource;null!=e&&(this.element.addClass("onloading"),t.DataManager&&e instanceof t.DataManager?this._initDataSource(e):this._renderItems(e)),this._setValues()},_initDataSource:function(e){var t,i=this;t=e.executeQuery(this._getQuery()),t.done(function(e){i._renderItems(e.result)}).fail(function(){i.element.removeClass("onloading")})},_getQuery:function(){var e;if(t.isNullOrUndefined(this.model.query)){e=[],queryManager=t.Query(),mapper=this.model.fields,col;for(col in mapper)"tableName"!==col&&mapper[col]&&e.push(mapper[col]);e.length>0&&queryManager.select(e),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(e){this.list=e,this._generateTagItems(this.list),this.element.removeClass("onloading")},_generateTagItems:function(e){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),void this._setCaptionText(i))},_createThumb:function(){var i,s;if(null!=this.model.dataSource||null!=this.model.thumbnailSourceID){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"),null!=this.model.dataSource)this._thumbItems.addClass("onloading"),this._generateThumbnailTagItems(this.list);else{for(s=0;s0&&("100"==Math.round(parseInt(t))&&(this.model.displayItemsCount=1,this._setVisibleItemCount(this.model.displayItemsCount)),t=this._convertPercentageToPixel(e(this.element[0]).parent()[i](),parseInt(t))),t},_convertPercentageToPixel:function(e,t){return Math.round(t*e/100)},_convertPixelToPercentage:function(e,t){return Math.round(t/e*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(e){isNaN(parseInt(e))?this.model.frameSpace="0px":(this.model.frameSpace=e,this.model.orientation==t.Orientation.Horizontal?this.element.children("li").css({"margin-right":e,"margin-bottom":0}):this.element.children("li").css({"margin-bottom":e,"margin-right":0}))},_setLicount:function(){this._liCount=this.element.children("li").length},_setVisibleItemCount:function(e){this.model.displayItemsCount=e,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 e;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&&(e=(this._wrapper.outerHeight(!0)/2-this._prevButton.height()/2)/this._wrapper.outerHeight(!0)*100+"%",this._prevButton.css("top",e),this._nextButton.css("top",e)),this.model.showThumbnail&&(null!=this.model.dataSource||null!=this.model.thumbnailSourceID)&&null!=this._previous&&null!=this._next&&(e=this._outerWrapper.outerHeight(!0)+this._thumbItems.children("li").outerHeight(!0)/2-this._thumbItems.children("li").outerHeight(!0)-this._previous.height()/2,e=e/this._outerWrapper.outerHeight(!0)*100+"%",this._previous.css("top",e),this._next.css("top",e))},_setItemMove:function(e){this.model.navigateSteps=this._validateItemMove(e),this._checkAndSet()},_validateItemMove:function(e){return e<=this.model.displayItemsCount?e: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(e){null!=this._interval&&(this.model.showPlayButton&&this._autoButton.hasClass("pause")&&this._autoButton.removeClass("pause").addClass("play"),clearInterval(this._interval),this._isInteraction=!e,this._animate=!!this.model.stopOnHover,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(e){this.transitionDelay="slideshow"!=this.model.animationType?e+this.model.delay:2*e+this.model.delay},_setThumbProperty:function(){var i,s,a,n=0,o=this._thumbItems.children("li");if("msie"==t.browserInfo().name&&"8.0"==t.browserInfo().version&&parseFloat(e(o[0]).width())<0)return!1;for(a=0;at?this._thumbMove(t):this._thumbMove(this._thumbItems.width()-i))},_changeThumbControl:function(e){var t;this.model.showThumbnail&&(null!=this.model.dataSource||null!=this.model.thumbnailSourceID)&&(t=this._thumbItems.children("li").length,e*this._thumbItems.children("li").outerWidth(!0)>0?null!=this._previous&&this._previous.hasClass("e-disable")&&this._previous.removeClass("e-disable").addClass("e-enable").attr({"aria-disabled":!1}):null!=this._previous&&this._previous.hasClass("e-enable")&&this._previous.removeClass("e-enable").addClass("e-disable").attr({"aria-disabled":!0}),e*this._thumbItems.children("li").outerWidth(!0)<(t-this._thumbCount)*this._thumbItems.children("li").outerWidth(!0)?null!=this._next&&this._next.hasClass("e-disable")&&this._next.removeClass("e-disable").addClass("e-enable").attr({"aria-disabled":!1}):null!=this._next&&this._next.hasClass("e-enable")&&this._next.removeClass("e-enable").addClass("e-disable").attr({"aria-disabled":!0}))},_getMaxSize:function(e){for(var t=0,i=0,s=0,s=0;st?i:t;return t},_calculateValue:function(){return this._convertPercentageToPixel(this._containerWidth-(this.model.displayItemsCount-1)*parseInt(this.model.frameSpace),100/this.model.displayItemsCount)},_changeState:function(e){e?this.enable():this.disable()},_findActive:function(){var e,t;if(this.model.showPager){for(t=0;t=this._thumbItems.children("li").outerWidth(!0)&&this._thumbMove(this._thumbItems.children("li").outerWidth(!0)),void(this._thumbItems.width()-e<=this._thumbItems.children("li").outerWidth(!0)&&this._next.removeClass("e-enable").addClass("e-disable").attr({"aria-disabled":!0})))},_thumbMove:function(e){var t=this;t._thumbItems.animate({left:"-="+e+"px"},600,function(){t._thumbItems.stop(!0,!0)})},_thumbPrev:function(){var e,t;return!!this.model.enabled&&(this._next.hasClass("e-disable")&&this._next.removeClass("e-disable").addClass("e-enable").attr({"aria-disabled":!1}),e=Math.round(this._thumbItems.position().left),t=this._thumbItems.children("li").outerWidth(!0),-e>=t&&this._thumbMove(-t),void(-e<=t&&this._previous.removeClass("e-enable").addClass("e-disable").attr({"aria-disabled":!0})))},_findLength:function(){var e,t=this;return this.model.showThumbnail&&(e=t._thumbItems.children("li").length-1),this.model.showPager&&(e=t._bullet.children("li").length-1),this.model.showPager||this.model.showThumbnail||(e=this.model.circularMode?this.element[this.containerCss]()/this._liSize-2*this.model.displayItemsCount:this.element[this.containerCss]()/this._liSize-1),e},_changeActiveState:function(e){var t,i,s=this;t=s._findActive(),i=s._findLength(),s._removeActiveItem(),"prev"==e?t>0?(s._setActiveItem(t-1),"slideshow"!=this.model.animationType&&this._setCaptionText(t-1)):(s._setActiveItem(i),"slideshow"!=this.model.animationType&&this._setCaptionText(i)):t0?a-1:n:0,"slideshow"==this.model.animationType&&(o.element.fadeOut(o.model.animationSpeed/2),o.model.showCaption&&o._caption.fadeOut(o.model.animationSpeed/2)),o.element.animate(r,s,i,function(){"end"==t&&o._setBegin(),o._animating=!1,o._setCaptionText(a),o._raiseEvent("change")}),"slideshow"==this.model.animationType&&(o.element.fadeIn(o.model.animationSpeed/2),o.model.showCaption&&o._caption.fadeIn(o.model.animationSpeed/2))},_moveNext:function(){var e,t,i,s,a=this;if(a._animating=!0,this.model.circularMode){if(e=Math.round(a.element.position()[a.displayCss]),t=a.model.displayItemsCount*a._liSize-a._liCount*a._liSize,i=Math.round(a.element.position()[a.displayCss])+a.element[a.containerCss](),a._calculateItemMove(),e>t&&i-a._containerSize>a._move+parseInt(a.model.frameSpace))return{move:a._move,action:"next"};if(i-a._containerSize<=a._move+parseInt(a.model.frameSpace))return s=i-a._containerSize-parseInt(a.model.frameSpace),{move:s,action:"end"}}else{if(e=Math.round(a.element.position()[a.displayCss]),t=-(a._liCount*a._liSize),i=Math.round(a.element.position()[a.displayCss])+a.element[a.containerCss](),a._calculateItemMove(),e-a._liSize!=t)return i-a._containerSize<=a._move+parseInt(a.model.frameSpace)&&(a._move=i-a._containerSize-parseInt(a.model.frameSpace),a._move=0==a._move?e:a._move),{move:a._move,action:"next"};if(i-a._containerSize<=a._move+parseInt(a.model.frameSpace))return{move:e,action:"end"}}},_movePrev:function(){var e,i,s,a,n=this;return e=Math.round(n.element.position()[n.displayCss]),i=n.element.position()[n.displayCss],+n.element[n.containerCss](),s=n.element[n.containerCss](),n._calculateItemMove(),this.model.circularMode?in.model.displayItemsCount*n._liSize?{move:-n._move,action:"prev"}:(a=n.model.displayItemsCount*n._liSize*2+e-n._liCount*n._liSize,n._move=(n._liCount-2*n.model.displayItemsCount)%n.model.navigateSteps*n._liSize,0==n._move&&n._calculateItemMove(),n.model.orientation==t.Orientation.Horizontal?n.element.css("left",a):n.element.css("top",a),{move:-n._move,action:"prev"}):i=n._liSize*n.model.navigateSteps?{move:-n._move,action:"prev"}:(a=n.model.displayItemsCount*n._liSize+e-n._liCount*n._liSize,n._move=-e0?this._thumbItems.children().eq(--a).addClass("e-thumbhover"):this._thumbItems.children().eq(0).addClass("e-thumbhover"):a1){if(this.model.circularMode)for(e=Math.round(-Math.round(this.element.position()[this.displayCss])/this._liSize),e-=this.model.displayItemsCount,t=0;tthis.panes.length||this.panes.length<=1)return!1;var a,n=i?"e-collapse":"e-expand",o=this.element.children(".e-splitbar:not(.e-shadowbar)");return a=t==o.length?this._clickArrow(t-1,!i,!1):e(o[t]).children("."+n),s?void("none"!=a.css("display")&&a.mousedown()):a},addItem:function(i,s,a){var s,n,o,r,l,d,h,c,u=this.panes.length;if(a=this._getNumber(a),t.isNullOrUndefined(a)&&(a=u),a<0||a>u)return"";s=this._getPaneProperty(s),s=this._checkMinMaxSize(s),n=t.buildTag("div.e-pane e-"+this.model.orientation.substr(0,1)+"-pane"),this.element.append(n[this.containerCss](s.paneSize)),o=s.paneSize=n[this.containerCss](),n.remove();var m,p,g,_,f=a,b=u,v={},x=0,w=!1;for(r=o+this._bar,p=0;p<2;p++){for(m=f;m=r-x){v[m]=l-(r-x),w=!0;break}d>0&&(v[m]=this.model.properties[m].minSize,x+=d)}if(w)break;b=f,f=0}if(!w)return"";for(h in v)e(this.panes[h])[this.containerCss](v[h]);return a==u?(g="insertBefore",_=1,n.insertAfter(e(this.panes[a-1]))):(g="insertAfter",_=0,n.insertBefore(e(this.panes[a]))),this.model.properties.splice(a,0,s),this.panes.splice(a,0,n),c=this._createSplitBar(a-_),c[g](n),n.append(i),this._updateModel(),n},removeItem:function(i){var s,a,n,o,r=this.panes.length-1;return i=this._getNumber(i),t.isNullOrUndefined(i)&&(i=r),i<0||i>r||r<1?null:(s=e(this.panes[i]),o=s[this.containerCss]()+this._bar,s.remove(),n=this.element.children(".e-splitbar:not(.e-shadowbar)"),i==r?(a=e(this.panes[i-1]),e(n[i-1]).remove()):(a=e(this.panes[i+1]),e(n[i]).remove()),a[this.containerCss](a[this.containerCss]()+o),this._removeArrays(i),void this._updateModel())},_checkMinMaxSize:function(e){return e.paneSizee.maxSize&&(e.paneSize=e.maxSize),e},_removeArrays:function(e){this.model.properties.splice(e,1),this.panes.splice(e,1),this.oldPaneSize.splice(e,1),this.oldPanePercent.splice(e,1),this._sizePercent.splice(e,1)},_getNumber:function(e){return e=parseFloat(e),isNaN(e)?null:e},_updateModel:function(){for(var t=0;t1)for(var e,t=0;t1)for(s=0;sthis.model.properties[s].maxSize?this.model.properties[s].maxSize:i),e(this.panes[s]).css(c,i),i<=0?(u++,f.push(s),m+=_):g?(e(this.panes[s]).css(c,0),m+=i+_,this.model.properties[s].paneSize=0):(m+=i+_,m>p&&(m-=i-_,a=p-m,n=b-s-1,a-=n*_,e(this.panes[s]).css(c,a),g=!0,m+=a+_),this.model.properties[s].paneSize=i);else 1==b&&(e(this.panes[0]).css(c,"100%"),m=p);if(b>1&&m!=p)if(r=e(this.panes[b-1]),m>p)o=m-p,r.css(c,o);else if(m0)for(d=Math.round(o/u),l=0;l0;h--)if(t.isNullOrUndefined(this.model.properties[h-1].maxSize)){r=e(this.panes[h-1]);break}r.css(c,Math.round(r[c]()+o)),this.model.properties[b-1].paneSize=r[c]()}b>1&&this._checkPaneSize()},_getUnit:function(e){return"px"==e?"px":"pt"==e?"pt":"%"==e.substr(1)?"%":"px"},_getNormalValue:function(e){var t,i,s,a;return"vertical"==this.model.orientation?(t=e.y-this.element.offset().top,i=t/this.element.outerHeight(),s=this.element.height()):(t=e.x-this.element.offset().left,i=t/this.element.outerWidth(),s=this.element.width()),i>1&&(i=1),i<0&&(i=0),a=i*s,this._trimValue(a)},_trimValue:function(e){var t,i,s;return t=1,i=e%t,s=e-i,2*Math.abs(i)>=t&&(s+=i>0?t:-t),parseFloat(s.toFixed(5))},_getSplitbarIndex:function(){return this.element.children(".e-splitbar:not(.e-shadowbar)").index(this.currentSplitBar)},_paneResize:function(){var t,i,s,a,n,o,r,l;return null!=this.shadowBar&&(this.currentSplitBar=this.shadowBar.next(),o=this._getSplitbarIndex(),i=this.shadowBar.prev(),s=this.currentSplitBar.next(),a=o,n=o+1,t=this.shadowBar.offset()[this.displayCss],t-=this.currentSplitBar.offset()[this.displayCss],e(i).css(this.containerCss,t+e(i)[this.containerCss]()+"px"),e(s).css(this.containerCss,e(s)[this.containerCss]()-t+"px"),this.oldPaneSize[a]=e(i)[this.containerCss](),this.oldPaneSize[n]=e(s)[this.containerCss](),this.shadowBar.remove(),this._checkPaneSize(),r={item:i,index:a,size:this.oldPaneSize[a]},l={item:s,index:n,size:this.oldPaneSize[n]},this._updateModelValue(r,l),void this._trigger("resize",{prevPane:r,nextPane:l,splitbarIndex:o}))},_checkPaneSize:function(){for(var t,i,s,a,n=0,o=this.panes.length,r=0;r=0;r--)if(e(this.panes[r]).hasClass("expanded")&&!e(this.panes[r]).hasClass("collapsed")){a=e(this.panes[r])[this.containerCss](),e(this.panes[r]).css(this.containerCss,Math.floor(a+s));break}}else e(this.panes[o-1]).css(this.containerCss,Math.floor(a+s))},_maxminDraggableRange:function(e){var t,i,s,a,n,o,r,l,d,h,c,u,m,p;t=this.shadowBar.prev(),this.currentSplitBar=this.shadowBar.next(),i=this.currentSplitBar.next(),s=t[this.containerCss](),a=i[this.containerCss](),n="left"==this.displayCss?this.currentSplitBar[0].offsetLeft:this.currentSplitBar[0].offsetTop,o=n-s,r=a+n,p=this._getSplitbarIndex(),l=p,d=p+1,h=this.model.properties[l].maxSize,c=this.model.properties[d].maxSize,h=null!=h?parseInt(h,10):null,c=null!=c?parseInt(c,10):null,this.model.properties[l].minSize=parseInt(this.model.properties[l].minSize,10),this.model.properties[d].minSize=parseInt(this.model.properties[d].minSize,10), u=this.model.properties[l].minSize,m=this.model.properties[d].minSize,this.shadowBar.removeClass("e-end-indicaton"),e>r-m?(this.resizedPosition=r-m,this.shadowBar.addClass("e-end-indicaton")):eo+h&&(this.resizedPosition=o+h,this.shadowBar.addClass("e-end-indicaton")),null!=c&&ediv").first()),this.element.find("div.e-active-content").removeClass("e-activebottom")):this.model.headerPosition==t.Tab.Position.Bottom?(this._removeVerticalClass(),this.element.find("div.e-active-content").removeClass("e-activetop")):(this.model.headerPosition==t.Tab.Position.Left||this.model.headerPosition==t.Tab.Position.Right)&&(this._removeHeaderClass(),e(this.items).css("display","")),this._refresh();break;case"showCloseButton":i[s]?(this._addDeleteIcon(),this._on(this.element.find("div.e-delete"),"click",this._tabDeleteClick)):this.element.find("div.e-delete").remove();break;case"enableTabScroll":i[s]?(this.model.enableTabScroll=i[s],this._checkScroll(),this._addScrollIcon()):this.element.find("div.e-scroll").remove();break;case"showReloadIcon":i[s]?this._addReloadIcon():this.element.find("div.e-reload").remove();break;case"enableRTL":i[s]?this.element.addClass("e-rtl"):this.element.removeClass("e-rtl");break;case"htmlAttributes":this._addAttr(i[s]);break;case"hiddenItemIndex":this.model.headerPosition==t.Tab.Position.Top||this.model.headerPosition==t.Tab.Position.Bottom?e(this.items).css("display","inline-block"):e(this.items).css("display",""),this.model.hiddenItemIndex=i[s],this.model.hiddenItemIndex.length>0&&this._hiddenIndexItem(this.model.hiddenItemIndex)}},_init:function(){this._addItemIndex=null,this.tabId=0,this._hiddenIndex=this.model.hiddenItemIndex,this._initialize(),this._prevSize=this._getDimension(e(this.element).parent(),"height")},_changeSkin:function(e){this.model.cssClass!=e&&this.element.removeClass(this.model.cssClass).addClass(e)},_initialize:function(){this.initialRender=!0,this.element.attr("tabindex",0).attr("role","tablist"),this._itemsRefreshing(),e(this.anchors).addClass("e-link"),this._preTabIndex=-1,t.isNullOrUndefined(this.model.width)||this.element.width(this.model.width),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&&("top"==this.model.headerPosition||"bottom"==this.model.headerPosition?this.itemsContainer.width()>this.element.width()&&this._addScrollIcon():this.element.height()0&&this._hiddenIndexItem(this.model.hiddenItemIndex)},_reinitialize:function(){for(var t,i,n=null!=this._addItemIndex?this._addItemIndex:0;n li:has(a[href])"),this.anchors=this.items.find("a[href]")},_setHeaderSize:function(e){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"),"left"==this.model.headerPosition?this.element.find(">ul.e-left").css({width:e,"text-align":"center"}):"right"==this.model.headerPosition?this.element.find(">ul.e-right").css({width:e,"text-align":"center"}):(this.element.find(">ul.e-header li.e-item").css("height",e),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(e){e?this.element.removeClass("e-disable"):this.element.addClass("e-disable")},_hiddenIndexItem:function(t){for(var i,s=0;s-1&&(i=e(this.items[parseInt(t[s])]).children("a").attr("href"),this._hidePanel(i));this._hideContentPanel(this.selectedItemIndex(),this.model.hiddenItemIndex),this._hiddenIndex=this.model.hiddenItemIndex},_hidePanel:function(t){for(var i,s=0;s-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;e.map(t,function(e,t){"class"==t?i.element.addClass(e):"disabled"==t&&"disabled"==e?(i.model.enabled=!1,i._enabledAction(!1)):i.element.attr(t,e)})},_setTabPosition:function(e){e==t.Tab.Position.Bottom?(this.itemsContainer.appendTo(this.element),this.items.removeClass("e-bottom-line"),this.items.addClass("e-top-line")):e==t.Tab.Position.Top?(this.items.removeClass("e-top-line"),this.model.enableRTL?this.items.addClass("e-rtl-top-line e-top-hover"):this.items.addClass("e-bottom-line")):(e==t.Tab.Position.Left||e==t.Tab.Position.Right)&&this.items.length>=0&&(!!this.model.height&&this.itemsContainer.css("height",this.model.height),this.element.addClass("e-vertical"))},_addDeleteIcon:function(){var e,i;this.element.find("div.e-delete").length<=0&&this.items.length>0&&(e=t.buildTag("div.e-icon e-delete","",{},{role:"presentation"}).css("visibility","hidden"),"left"==this.model.headerPosition||"right"==this.model.headerPosition?(i=this.items.find("a"),e.insertBefore(i)):this.items.append(e))},_addScrollIcon:function(){if(this.element.find("div.e-scroll").length<=0&&this.items.length>0){var e=t.buildTag("div.e-icon e-scroll","",{},{role:"presentation"}).css("visibility","hidden");this.itemsContainer.append(e),this.scrollstep=30,e.css("position","relative"),this.model.enableRTL||("left"==this.model.headerPosition?e.css("margin-right",this.itemsContainer.width()/2+"px"):"right"==this.model.headerPosition?e.css("margin-left",this.itemsContainer.width()/2-this.scrollstep+"px"):1==this.model.enablePersistence&&0!=this._beforeWidth&&this._beforeWidth>this.scrollPanelWidth?e.css("margin-right",this.itemsContainer.width()-this.scrollPanelWidth+20-2*(this.items[this.selectedItemIndex()].offsetLeft-this.scrollPanelWidth)+"px"):e.css("margin-right",this.itemsContainer.width()-this.scrollPanelWidth+20+"px")),"left"==this.model.headerPosition||"right"==this.model.headerPosition?(e.css("transform","rotate(270deg)"),"msie"==t.browserInfo().name&&parseInt(t.browserInfo().version)<11?"top"==this.model.headerPosition||"bottom"==this.model.headerPosition?e.css("margin-top","-"+(this.itemsContainer.height()+this.scrollPanelWidth-3)+"px"):this.model.enableRTL?e.css("margin-top","-"+this.items.height()*this.items.length+"px"):e.css("margin-top","-"+(this.items.height()*this.items.length-20)+"px"):1==this.model.enablePersistence&&0!=this._beforeWidth&&this._beforeWidth>this.scrollPanelHeight?e.css("margin-top","-"+(3*this.items[this.selectedItemIndex()].offsetTop-2*this.scrollPanelHeight)+"px"):this.model.enableRTL?e.css("margin-top","-"+this.items.height()*this.items.length+"px"):e.css("margin-top","-"+(this.items.height()*this.items.length-20)+"px")):this.model.enableRTL?(e.css("margin-top","-"+this.itemsContainer.height()+"px"),e.css("margin-left",this.itemsContainer.width()-14+"px")):e.css("margin-top","-"+(this.itemsContainer.height()/2+10)+"px"),"msie"==t.browserInfo().name&&parseInt(t.browserInfo().version)<11&&("top"==this.model.headerPosition?parseInt(e.prev().offset().top)-parseInt(e.offset().top)==-parseInt(e.css("margin-top"))&&e.css("top",this.itemsContainer.height()/2+27+"px"):"bottom"==this.model.headerPosition&&(this.model.enableRTL?e.css("top",this.itemsContainer.height()/2+20+"px"):e.css("top",this.itemsContainer.height()/2+27+"px"))),"left"==this.model.headerPosition?e.css("margin-right",this.itemsContainer.width()/2+"px"):"right"==this.model.headerPosition&&e.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-scroll"),"click",this._tabScrollClick)}},_addScrollBackIcon:function(){if(this.element.find("div.e-right-scroll").length<=0){var e=t.buildTag("div.e-icon e-right-scroll","",{},{role:"presentation"}).css("visibility","hidden");this.itemsContainer.prepend(e),this.rightscrollstep=30,this.element.attr("unselectable","on"),this.element.css("user-select","none"),this.element.on("selectstart",!1),e.css("position","absolute"),("top"==this.model.headerPosition||"bottom"==this.model.headerPosition)&&(this.model.enableRTL?e.css("margin-right",this.itemsContainer.width()/2+"px"):e.css("margin-left","20px")),"left"==this.model.headerPosition||"right"==this.model.headerPosition?(this.model.enableRTL?(e.css("margin-top",+(this.scrollPanelHeight-4)+"px"),"right"==this.model.headerPosition?e.css("margin-right",this.itemsContainer.width()/2+14+"px"):e.css("margin-right",this.itemsContainer.width()/2+"px")):("right"==this.model.headerPosition?e.css("margin-left",this.itemsContainer.width()/2-30+"px"):"left"==this.model.headerPosition&&e.css("margin-left",this.itemsContainer.width()/2-15+"px"),e.css("margin-top",+this.scrollPanelHeight+20+"px")),e.css("transform","rotate(270deg)")):"msie"==t.browserInfo().name&&parseInt(t.browserInfo().version)<11?e.css("margin-top","0px"):this.model.enableRTL?e.css("margin-top","0px"):e.css("margin-top","-5px"),this._on(this.element.find("div.e-right-scroll"),"click",this._tabScrollBackClick)}},_addReloadIcon:function(){var e,i;this.element.find("div.e-reload").length<=0&&this.items.length>0&&(e=t.buildTag("div.e-icon e-reload","",{},{role:"presentation"}).css("visibility","hidden"),"left"==this.model.headerPosition||"right"==this.model.headerPosition?(i=this.items.find("a"),e.insertBefore(i)):this.items.append(e))},_addBaseClass:function(){this.element.addClass("e-widget "+this.model.cssClass),this.itemsContainer.addClass("e-box"),this.model.enableRTL&&this.element.addClass("e-rtl"),"top"==this.model.headerPosition&&(e(this.contentPanels).addClass("e-hidebottom e-addborderbottom"),e(this.itemsContainer).addClass("e-addborderbottom"),e(this.contentPanels).removeClass("e-hidetop e-addbordertop e-hideright e-addborderright e-hideleft e-addborderleft"),e(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"))),"bottom"==this.model.headerPosition&&(e(this.contentPanels).removeClass("e-hidebottom e-addborderbottom e-hideright e-addborderright e-hideleft e-addborderleft"),e(this.itemsContainer).removeClass("e-addborderbottom e-addborderright e-addborderleft"),e(this.contentPanels).addClass("e-hidetop e-addbordertop"),e(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"))),"left"==this.model.headerPosition&&(this.items.length>0&&this.itemsContainer.addClass("e-left"),e(this.contentPanels).removeClass("e-hidetop e-addbordertop e-hidebottom e-addborderbottom e-hideright e-addborderright"),e(this.itemsContainer).removeClass("e-addbordertop e-addborderbottom e-addborderright"),e(this.contentPanels).addClass("e-hideleft e-addborderleft"),e(this.itemsContainer).addClass("e-addborderleft"),e(this.items).removeClass("e-rtl-bottom-line e-rtl-top-line")),"right"==this.model.headerPosition&&(this.items.length>0&&this.itemsContainer.addClass("e-right"),e(this.contentPanels).removeClass("e-hidetop e-addbordertop e-hidebottom e-addborderbottom e-hideleft e-addborderleft"),e(this.itemsContainer).removeClass("e-addbordertop e-addborderbottom e-addborderleft"),e(this.contentPanels).addClass("e-hideright e-addborderright"),e(this.itemsContainer).addClass("e-addborderright"),e(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),e(this.contentPanels).addClass("e-content e-content-item e-box").attr("role","tabpanel").attr("aria-hidden",!0),this._checkScroll()},_checkScroll:function(){var t,i,s,a;if(this.scrollPanelWidth=this.element.width(),this.scrollPanelHeight=this.element.height(),1==this.model.enableTabScroll&&this.itemsContainer.height()>this.items.height()){if(this.scrollstep=0,this.model.enableTabScroll=!0,("top"==this.model.headerPosition||"bottom"==this.model.headerPosition)&&this.itemsContainer.css({width:parseInt(this.element.css("width"))+parseInt(this.items.css("width"))*this.items.length+"px",position:"absolute"}),this._beforeWidth=0,1==this.model.enablePersistence)if("top"==this.model.headerPosition||"bottom"==this.model.headerPosition)for(t=0;tthis.scrollPanelHeight&&this.itemsContainer.css({clip:"rect("+2*(this.items[this.selectedItemIndex()].offsetTop-this.scrollPanelHeight)+"px,"+(this.itemsContainer.width()+2)+"px,"+(2*this.items[this.selectedItemIndex()].offsetTop-this.scrollPanelHeight)+"px,0px)","margin-top":"-"+2*(this.items[this.selectedItemIndex()].offsetTop-this.scrollPanelHeight)+"px"}),this.element.removeClass("e-scrolltab")):"right"==this.model.headerPosition?this.itemsContainer.height()this.scrollPanelHeight&&this.itemsContainer.css({clip:"rect("+2*(this.items[this.selectedItemIndex()].offsetTop-this.scrollPanelHeight)+"px,"+(this.itemsContainer.width()+2)+"px,"+(2*this.items[this.selectedItemIndex()].offsetTop-this.scrollPanelHeight)+"px,0px)","margin-top":"-"+2*(this.items[this.selectedItemIndex()].offsetTop-this.scrollPanelHeight)+"px"}),this.element.removeClass("e-scrolltab")):0==this._beforeWidth||this._beforeWidththis.scrollPanelWidth&&this.itemsContainer.css({clip:"rect(0px,"+(2*this.items[this.selectedItemIndex()].offsetLeft-this.scrollPanelWidth)+"px,100px,"+2*(this.items[this.selectedItemIndex()].offsetLeft-this.scrollPanelWidth)+"px)","margin-left":"-"+2*(this.items[this.selectedItemIndex()].offsetLeft-this.scrollPanelWidth)+"px"}):this.itemsContainer.css("clip","rect(0px,"+i+"px,100px,"+a+"px)"),this.itemsContainer.find(".e-icon.e-right-scroll").length&&this.itemsContainer.find(".e-icon.e-right-scroll").css("display","none")}},_executeForwardScrolling:function(s){var a,n,o,r,l;if(e("div#"+this._id+" .e-icon.e-scroll").css("position","relative"),e("div#"+this._id+" .e-icon.e-scroll")[0]==s.target){if(a=this.scrollstep-this.rightscrollstep,this.offsetwidth=this.itemsContainer.width()-this.scrollPanelWidth,this.offsetheight=this.itemsContainer.height()-this.scrollPanelHeight,this.rightscrollstep>30&&(this.rightscrollstep=this.rightscrollstep-30),null==this.checkwidth||30==this.rightscrollstep?(o=parseInt(this.itemsContainer.css("width")),r=parseInt(o-(this.scrollPanelWidth+this.scrollstep-1)),this.model.enableRTL?("top"==this.model.headerPosition||"bottom"==this.model.headerPosition)&&(this.itemsContainer.css({clip:"rect(0px,"+(o-this.scrollstep)+"px,100px,"+r+"px)","margin-right":"-"+this.scrollstep+"px"}),e("div#"+this._id+" .e-icon.e-right-scroll").css("margin-right",this.scrollPanelWidth+this.scrollstep-40+"px"),this.scrollstep=l+53||n+this.scrollPanelWidth>=l+53)&&e("div#"+this._id+" .e-icon.e-scroll").css("top",0)}this.scrolledwidth=this.scrollPanelWidth+this.scrollstep,this.scrolledheight=this.scrollPanelHeight+this.scrollstep,this.checkwidth="top"==this.model.headerPosition||"bottom"==this.model.headerPosition?this.scrolledwidth:this.scrolledheight}},_executeBackwardScrolling:function(){""!=e("div#"+this._id+" .e-icon.e-scroll")&&e("div#"+this._id+" .e-icon.e-scroll").css("display","block");var i=this.scrollstep-this.rightscrollstep;this.scrolledwidth-this.rightscrollstep;this.scrolledwidth!=this.checkwidth?"top"==this.model.headerPosition||"bottom"==this.model.headerPosition?this.model.enableRTL?(this.itemsContainer.css({clip:"rect(0px,"+(this.itemsContainer.width()-this.scrollstep+this.rightscrollstep+30+1)+"px,100px,"+(this.itemsContainer.width()-(this.scrollPanelWidth+i-30)+"px)"),"margin-right":"-"+(i-30)+"px"}),""!=e("div#"+this._id+" .e-icon.e-scroll")&&e("div#"+this._id+" .e-icon.e-scroll").css("margin-left",this.itemsContainer.width()-i+16+"px")):(this.itemsContainer.css({clip:"rect(0px,"+(this.checkwidth-this.rightscrollstep+30)+"px,100px,"+(i-30)+"px)","margin-left":"-"+(i-30)+"px"}),""!=e("div#"+this._id+" .e-icon.e-scroll")&&e("div#"+this._id+" .e-icon.e-scroll").css("margin-right",this.offsetwidth-i+50+"px")):(this.rightscrollstep>30?this.itemsContainer.css("clip","rect("+(i-30)+"px,"+(this.itemsContainer.width()+3)+"px,"+(this.checkwidth-this.rightscrollstep+30)+"px,0px)"):this.itemsContainer.css("clip","rect("+(i-30)+"px,"+(this.itemsContainer.width()+3)+"px,"+(this.checkwidth-this.rightscrollstep)+"px,0px)"),this.itemsContainer.css("margin-top","-"+(i-30)+"px"),this.model.enableRTL?"msie"==t.browserInfo().name&&parseInt(t.browserInfo().version)<11?""!=e("div#"+this._id+" .e-icon.e-scroll")&&e("div#"+this._id+" .e-icon.e-scroll").css("margin-top","-"+(this.offsetheight-i+5)+"px"):""!=e("div#"+this._id+" .e-icon.e-scroll")&&e("div#"+this._id+" .e-icon.e-scroll").css("margin-top","-"+(this.offsetheight-i+2)+"px"):""!=e("div#"+this._id+" .e-icon.e-scroll")&&e("div#"+this._id+" .e-icon.e-scroll").css("margin-top","-"+(this.offsetheight-i-20)+"px")):"top"==this.model.headerPosition||"bottom"==this.model.headerPosition?this.model.enableRTL?(this.itemsContainer.css({clip:"rect(0px,"+(this.itemsContainer.width()-this.scrollstep+60)+"px,100px,"+(this.itemsContainer.width()-(this.scrollPanelWidth+i-30)+"px)"),"margin-right":"-"+(i-30)+"px"}),""!=e("div#"+this._id+" .e-icon.e-scroll")&&e("div#"+this._id+" .e-icon.e-scroll").css("margin-left",this.itemsContainer.width()-i+16+"px")):(this.itemsContainer.css({clip:"rect(0px,"+(this.checkwidth-this.rightscrollstep)+"px,100px,"+(i-30)+"px)","margin-left":"-"+(i-30)+"px"}),""!=e("div#"+this._id+" .e-icon.e-scroll")&&e("div#"+this._id+" .e-icon.e-scroll").css({"margin-right":this.offsetwidth-i+50+"px",top:this.itemsContainer.height()/2+27+"px"})):(this.itemsContainer.css({clip:"rect("+(i-30)+"px,"+this.itemsContainer.width()+"px,"+(this.checkwidth-this.rightscrollstep)+"px,0px)","margin-top":"-"+(i-30)+"px"}),""!=e("div#"+this._id+" .e-icon.e-scroll")&&e("div#"+this._id+" .e-icon.e-right-scroll").css("margin-top",this.scrollPanelHeight+this.scrollstep-10+"px")),this.updatewidth=this.checkwidth-this.rightscrollstep+30,this.updatestep=i-30,"right"!=this.model.headerPosition&&"left"!=this.model.headerPosition&&this.contentPanels.css("margin-right","-1px"),i<=30?(e("div#"+this._id+" .e-icon.e-right-scroll").css("display","none"),this._addScrollIcon(),this.scrollstep=0,this.rightscrollstep=0):"top"==this.model.headerPosition||"bottom"==this.model.headerPosition?this.model.enableRTL?e("div#"+this._id+" .e-icon.e-right-scroll").css("margin-right",this.scrollPanelWidth+this.scrollstep-70-this.rightscrollstep+"px"):e("div#"+this._id+" .e-icon.e-right-scroll").css("margin-left",i-40+"px"):("left"!=this.model.headerPosition?e("div#"+this._id+" .e-icon.e-right-scroll").css("margin-left",this.itemsContainer.width()/2-30+"px"):e("div#"+this._id+" .e-icon.e-right-scroll").css("margin-left",this.itemsContainer.width()/2-15+"px"),this.model.enableRTL?e("div#"+this._id+" .e-icon.e-right-scroll").css("margin-top",this.scrollPanelHeight+i-64+"px"):e("div#"+this._id+" .e-icon.e-right-scroll").css("margin-top",this.scrollPanelHeight+i-40+"px")),e("div#"+this._id+" .e-icon.e-scroll").css("top","0px"),this.rightscrollstep=this.rightscrollstep+30,this.checkwidth="top"==this.model.headerPosition||"bottom"==this.model.headerPosition?this.scrolledwidth-30:this.scrolledheight-30},_removeHeaderClass:function(){this.itemsContainer.remove(),this.itemsContainer.insertBefore(this.element.find(">div").first()),this.items.removeClass("e-bottom-line e-top-line"),e(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"),("left"==this.model.headerPosition||"right"==this.model.headerPosition)&&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"),e(this.contentPanels).removeClass("e-content e-content-item e-box"),e(this.contentPanels).removeClass("e-content e-content-item e-box e-content-bottom e-activetop e-activebottom e-active-content"),e(this.contentPanels).css("display","")},_addContentTag:function(i,s){var a=this._getTabId(i),n=this.element.find("#"+a);n.length||(n=t.buildTag("div.e-content e-content-item e-box e-content-bottom #"+a).insertAfter(this.contentPanels[s-1]||this.itemsContainer)),this.contentPanels=e(this.contentPanels).add(n)},_roundedCorner:function(e){e?this.element.addClass("e-corner"):this.element.hasClass("e-corner")&&this.element.removeClass("e-corner")},_setTabsHeightStyle:function(i){var s,a;if(t.Tab.HeightAdjustMode.Content!=i&&e(this.contentPanels).height(""),t.Tab.HeightAdjustMode.Fill==i)(t.Tab.Position.Left===this.model.headerPosition||t.Tab.Position.Right===this.model.headerPosition)&&e(this.contentPanels).css("height","100vh"),this._contentPaneSize();else if(t.Tab.HeightAdjustMode.Auto==i){for(s=0,e(this.contentPanels).css({display:"none"}).addClass("e-active-content"),a=0;a=this.contentPanels.length&&(this.selectedItemIndex(0),i=this.selectedItemIndex()),i>=0&&!this.initialRender&&!0===this._onBeforeActive(i))return!1;if(e(this.items[this.selectedItemIndex()]).attr("aria-expanded",!0).attr("aria-selected",!0).attr("tabindex",0),null!=this.selectedItemIndex()&&this.selectedItemIndex()-1&&(e(t).find("a").unbind(this.model.events),this._off(e(t).find("div.e-delete"),"click")),e(t)[e.inArray(i,this.model.disabledItemIndex)==-1||e(t).hasClass("e-tab-selected")?"removeClass":"addClass"]("e-disable"),e(this.contentPanels[i])[e.inArray(i,this.model.disabledItemIndex)==-1||e(this.contentPanels[i]).hasClass("e-tab-selected")?"removeClass":"addClass"]("e-disable")},_tabItemClick:function(t){if(this.model.enabled){t.preventDefault();var i;this.selectedItemIndex()==e(this.items).index(e(t.currentTarget))&&this.model.collapsible?(i=-1,e(this.element).addClass("e-tab-collapsed")):i=e(this.items).index(e(t.currentTarget)),i!=this.selectedItemIndex()&&this.showItem(i),e(this.element).removeClass("e-tab-collapsed")}},_tabDeleteClick:function(t){var i,s;this.model.enabled&&(i=e(t.target),i.hasClass("e-delete")&&(s=e(this.items).index(e(t.target).parent())),s==this.selectedItemIndex()&&this.items.length>s&&this.selectedItemIndex(this.selectedItemIndex()+1),this.removeItem(s))},_tabScrollClick:function(t){this.model.enabled&&e("div#"+this._id+" .e-icon.e-scroll")[0]==t.target&&(this._executeForwardScrolling(t),this.scrollstep=this.scrollstep+30,this._addScrollBackIcon(),e("div#"+this._id+" .e-icon.e-right-scroll").css("display","block"))},_tabScrollBackClick:function(t){this.model.enabled&&e("div.e-icon.e-right-scroll")[0]==t.target&&this._executeBackwardScrolling(t)},_tabReloadClick:function(t){var i;if(this.model.enabled&&(i=e(t.target),i.hasClass("e-reload"))){var s=this.anchors[this.selectedItemIndex()],a=e(s).attr("href"),n=e(this.contentPanels[this.selectedItemIndex()]);0!==a.indexOf("#")?this._sendAjaxOptions(n,s):this.showItem(this.selectedItemIndex())}},_sendAjaxOptions:function(t,i){if(this._onBeforeLoad(i))return!0;t.addClass("e-load");var s=this,a=e(i).html(),n=i.href.replace("#",""),o={type:this.model.ajaxSettings.type,cache:this.model.ajaxSettings.cache,url:n,data:this.model.ajaxSettings.data,dataType:this.model.ajaxSettings.dataType,contentType:this.model.ajaxSettings.contentType,async:this.model.ajaxSettings.async,success:function(e){try{s._ajaxSuccessHandler(e,t,i,a)}catch(e){}},error:function(){try{s._ajaxErrorHandler(i,s.selectedItemIndex(),a)}catch(e){}}};this._sendAjaxRequest(o)},_sendAjaxRequest:function(t){e.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,s,a){null!=a&&e(s).html(a),i.removeClass("e-load"),i.html(t).addClass("e-tab-loaded");var n={data:t,url:s,content:i};return this._trigger("ajaxSuccess",n),!!this._onLoad(s)||void 0},_ajaxErrorHandler:function(e,t){this._trigger("ajaxError",{data:e,url:t}),this._onLoad(t)},_createContentPanel:function(t){return e("
    ").attr("id",t).addClass("e-content e-content-item e-content-bottom e-box")},_refresh:function(){this._unWireEvents(),this._initialize()},_keyPress:function(i){if(this.model.enabled){var s,a,n=e(i.target);if(code=i.keyCode?i.keyCode:i.which?i.which:i.charCode,n.hasClass("e-link")||n.hasClass("e-item"))switch(code){case 39:case 40:i.preventDefault(),this.showItem(this.selectedItemIndex()+1);break;case 37:case 38:i.preventDefault(),0!=this.selectedItemIndex()?this.showItem(this.selectedItemIndex()-1):0==this.selectedItemIndex()&&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&&!n.hasClass("e-tab"))switch(code){case 38:i.preventDefault(),s=e(this.contentPanels).index(n.parent(".e-content")),a=e(this.items[s]);break;case 33:i.preventDefault(),a=e(this.items[0]),this.showItem(0);break;case 34:i.preventDefault(),a=e(this._headers[this.getItemsCount()-1]),this.showItem(this.getItemsCount()-1)}t.isNullOrUndefined(a)||(a.addClass("e-focus"),a.focus())}},_hoverHandler:function(t){if(t.preventDefault(),this.model.enabled){var i=e(this.items).index(e(t.target).parent());i==-1&&(i=e(this.items).index(e(t.target))),"mouseout"===t.type?e(this.element.find("div.e-delete")[i]).css("visibility","hidden"):e(this.element.find("div.e-delete")[i]).css("visibility","visible"),"mouseout"===t.type?e(this.element.find("div.e-scroll")).css("visibility","hidden"):e(this.element.find("div.e-scroll")).css("visibility","visible"),"mouseout"===t.type?e(this.element.find("div.e-right-scroll")).css("visibility","hidden"):e(this.element.find("div.e-right-scroll")).css("visibility","visible"),"mouseout"===t.type?e(this.element.find("div.e-reload")[i]).css("visibility","hidden"):e(this.element.find("div.e-reload")[i]).css("visibility","visible")}},_wireEvents:function(e){this._on(this.items,e,this._tabItemClick),this._on(this.itemsContainer,"mouseover",this._hoverHandler),this._on(this.itemsContainer,"mouseout",this._hoverHandler),this._on(this.element.find("div.e-delete"),"click",this._tabDeleteClick),this._on(this.element.find("div.e-scroll"),"click",this._tabScrollClick),this._on(this.element.find("div.e-right-scroll"),"click",this._tabScrollBackClick),this._on(this.itemsContainer,"focusin",this._focusIn),this._on(this.itemsContainer,"focusout",this._focusOut),this._on(this.element.find("div.e-reload"),"click",this._tabReloadClick)},_unWireEvents:function(){this._off(this.items,this.model.events),this._off(this.element.find("div.e-delete"),"click"),this._off(this.element.find("div.e-scroll"),"click"),this._off(this.element.find("div.e-right-scroll"),"click"),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("div.e-reload"),"click")},_resizeEvents:function(t){"fill"===t?e(window).bind("resize",e.proxy(this._windowResized,this)):e(window).unbind("resize",e.proxy(this._windowResized,this))},_windowResized:function(){var t=this._getDimension(e(this.element).parent(),"height");this._prevSize!=t&&(this._contentPaneSize(),this._prevSize=t)},_contentPaneSize:function(){var t,i,s;for(null!=this.model.height&&"none"==this.model.heightAdjustMode?(e(this.element).height(this.model.height),t=this._getDimension(e(this.element),"height")):t=this._getDimension(e(this.element).parent(),"height"),e(this.contentPanels).height(""),e(this.element).parent().css({overflow:"auto"}),("top"===this.model.headerPosition||"bottom"===this.model.headerPosition)&&(t-=this._getDimension(e(this.itemsContainer),"outerHeight")),i=0,s=0;s=0&&n=n&&this.model.disabledItemIndex[l]++;"left"==this.model.headerPosition?this.items.length>=0&&this.itemsContainer.addClass("e-left"):"right"==this.model.headerPosition?this.items.length>=0&&this.itemsContainer.addClass("e-right"):0==this.items.length&&this.itemsContainer.addClass("e-header"),d=t.buildTag("li.e-select e-item"),"top"==this.model.headerPosition&&(this.model.enableRTL?e(d).addClass("e-rtl-top-line e-top-hover"):e(d).addClass("e-bottom-line")),t.isNullOrUndefined(o)||(h=t.buildTag("span").addClass(o),d.append(h)),n===s&&a===s&&null!=i&&(a="Item"),n===s&&a===s&&r===s&&(i="#Item"+this.items.length,a="Item"),r!=s?(0!=r.indexOf("#")&&(r="#"+r),this.divId=r):i!=s&&(r=i),c=t.buildTag("a",a,{},{href:i}),("top"==this.model.headerPosition||"bottom"==this.model.headerPosition)&&c.appendTo(d),this.model.showCloseButton&&(u=t.buildTag("div.e-icon e-delete","",{},{}).css("visibility","hidden"),d.append(u),this._on(u,"click",this._tabDeleteClick)),("left"==this.model.headerPosition||"right"==this.model.headerPosition)&&c.appendTo(d),n===s&&(n=this.anchors.length),m=n>=this.items.length,m?d.appendTo(this.itemsContainer):d.insertBefore(this.items[n]),t.isNullOrUndefined(this.model.headerSize)||this._setHeaderSize(this.model.headerSize),this.selectedItemIndex()==n?(this.hideItem[n],this.selectedItemIndex(this.selectedItemIndex()+1)):(this.hideItem[n],ni},refreshTabScroll:function(){this._isSizeExceeded()?(this.element.find("div.e-scroll").length>=1&&this.element.find("div.e-scroll").remove(),this.model.enableTabScroll&&(this._checkScroll(),this._addScrollIcon())):this._checkScroll()},removeItem:function(t){var i,s,a;if(!this.model.enabled)return!1;if(null!=t&&t>-1&&tt?this.model.disabledItemIndex[s]--:this.model.disabledItemIndex[s]==t&&this.model.disabledItemIndex.splice(s,1);i.hasClass("e-active")&&(0==t?this.selectedItemIndex(t+1):this.selectedItemIndex(t-1),this.showItem(this.selectedItemIndex())),e(this.element.find(">div.e-content")[t]).remove(),this.contentPanels.splice(t,1),t=this.anchors.length)&&this.selectedItemIndex(0),"left"!=this.model.headerPosition&&"right"!=this.model.headerPosition||1!=this.items.length?1==this.items.length&&this.itemsContainer.removeClass("e-header"):this._removeVerticalClass(),this._unWireEvents(),this._itemsRefreshing(),this._wireEvents(this.model.events),this._disableTabs(),a={removedTab:i},this._onRemove(a)}},show:function(){return!!this.model.enabled&&void this.element.css("visibility","visible")},hide:function(){return!!this.model.enabled&&void this.element.css("visibility","hidden")},_onBeforeLoad:function(e){var t;return t=this.selectedItemIndex()==-1&&this.model.collapsible?{prevActiveHeader:this.items[this._preTabIndex],prevActiveIndex:this._preTabIndex,activeHeader:null,activeIndex:null,url:e,isInteraction:this._isInteraction}:{prevActiveHeader:this.items[this._preTabIndex],prevActiveIndex:this._preTabIndex,activeHeader:this.items[this.selectedItemIndex()],activeIndex:this.selectedItemIndex(),url:e,isInteraction:this._isInteraction},this._trigger("ajaxBeforeLoad",t)},_focusIn:function(){!this.model.readOnly&&this.model.allowKeyboardNavigation&&e(this.element).bind("keydown",e.proxy(this._keyPress,this))},_focusOut:function(){e(this.element).unbind("keydown",e.proxy(this._keyPress,this))},_onLoad:function(e){var t;return t=this.selectedItemIndex()==-1&&this.model.collapsible?{prevActiveHeader:this.items[this._preTabIndex],prevActiveIndex:this._preTabIndex,activeHeader:null,activeIndex:null,url:e,isInteraction:this._isInteraction}:{prevActiveHeader:this.items[this._preTabIndex],prevActiveIndex:this._preTabIndex,activeHeader:this.items[this.selectedItemIndex()],activeIndex:this.selectedItemIndex(),url:e,isInteraction:this._isInteraction},this._trigger("ajaxLoad",t)},_onActive:function(){var e;return e=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",e)},_onBeforeActive:function(e){if(null!=this.model.beforeActive){var t;return t=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[e],activeIndex:e,isInteraction:this._isInteraction},this._trigger("beforeActive",t)}},_onAdd:function(e){return this._trigger("itemAdd",e)},_onRemove:function(e){return this._trigger("itemRemove",e)},_onBrforeRemove:function(e){return this._trigger("beforeItemRemove",e)}}),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(e,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(e){for(var t in e)switch(t){case"fields":case"query":case"dataSource":case"minFontSize":case"maxFontSize":this._refreshTagItems(t,e[t]);break;case"showTitle":this._showTitle(e[t]);break;case"titleText":this._title(e[t]);break;case"titleImage":this._titleImage(e[t]);break;case"cssClass":this._changeSkin(e[t]);break;case"format":this._format(e[t]);break;case"enableRTL":this._rtl(e[t]);break;case"htmlAttributes":this._addAttr(e[t])}},_refreshTagItems:function(e,t){this.model[e]=t,this.ul.empty(),this._checkDataBinding()},_showTitle:function(e){e?this._generateTitle():(this.titleText.remove(),this.titleText=null)},_title:function(e){this.titleText&&(e?this.text?this.text.html(e):this._generateTextTag(e):this.text&&(this.text.remove(),this.text=null))},_titleImage:function(e){this.titleText&&(e?this.image?this.image.attr("src",e):this._generateImageTag(e):this.image&&(this.image.remove(),this.image=null))},_changeSkin:function(e){this.model.cssClass!=e&&this.element.removeClass(this.model.cssClass).addClass(e)},insert:function(t){e.trim(t.text)&&this.ul.append(this._generateLi(t,this._getMapper()))},insertAt:function(t,i){e.trim(t.text)&&e(this.ul.children()[i-1]).before(this._generateLi(t,this._getMapper()))},remove:function(t){for(var i,s=this.ul.children(),a=0;a')),this.text&&!this.model.titleImage?this.image.insertBefore(this.text):this.titleText.append(this.image)},_generateTextTag:function(e){this.text||(this.text=t.buildTag("span",e)),this.titleText.append(this.text)},_renderWrapper:function(){var e;e="list"==this.model.format?"list":"cloud",this.ul=t.buildTag("ul.e-ul e-box e-"+e),this.element.append(this.ul)},_renderItems:function(e){this._generateTagItems(e),this.ul.removeClass("e-load")},_addAttr:function(t){var i=this;e.map(t,function(e,t){"class"==t?i.element.addClass(e):i.element.attr(t,e)})},_checkProperties:function(){this.model.enableRTL&&this._rtl(this.model.enableRTL)},_rtl:function(e){e?this.element.addClass("e-rtl"):this.element.removeClass("e-rtl")},_checkDataBinding:function(){var e=this.model.dataSource;null!=e&&(this.ul.addClass("e-load"),t.DataManager&&e instanceof t.DataManager?this._initDataSource(e):this._renderItems(e))},_initDataSource:function(e){var t=this,i=e.executeQuery(this._getQuery());i.done(function(e){t._renderItems(e.result)}).fail(function(){t.ul.removeClass("e-load")})},_setAttributes:function(e,t){if(e)for(var i in e)"class"==i?t.addClass(e[i]):t.attr(i,("style"==i?t.attr("style")+";":"")+e[i])},_getQuery:function(){var e;if(t.isNullOrUndefined(this.model.query)){var i=[],s=t.Query(),a=this.model.fields;for(e in a)"tableName"!==e&&a[e]&&i.push(a[e]);i.length>0&&s.select(i),this.model.dataSource.dataSource.url.match(a.tableName+"$")||t.isNullOrUndefined(a.tableName)||s.from(a.tableName)}else s=this.model.query;return s},_generateTagItems:function(t){var i,s=this._getMapper(),a=function(e){return e[s._freq]},n=t.map?t.map(a):e.map(t,a);for(this.minFreq=Math.min.apply(Math,n),this.maxFreq=Math.max.apply(Math,n),i=0;i div > .e-chkbox-wrap").remove(),this._updateCheckedNodes());break;case"autoCheck":this.model.autoCheck=i[s];break;case"autoCheckParentNode":this.model.autoCheckParentNode=i[s];break;case"expandedNodes":if(d=i[s].length,r=JSON.parse(JSON.stringify(this.model.expandedNodes)),d>0)for(this._expandNodes(i[s]),l=0,d=r.length;l0)for(this._checkedNodes(i[s]),l=0,d=r.length;l div > .e-chkbox-wrap > .nodecheckbox:first")[0]);else 0==d&&this._uncheckAll();break;case"expandOn":this._off(this.element,this.model.expandOn,this._expandEventHandler),this._on(this.element,i[s],this._expandEventHandler);break;case"allowEditing":this._preventEditable(),i[s]&&this._allowEditable();break;case"allowKeyboardNavigation":h=i[s]?"_on":"_off",this[h](this.element,"keydown",this._KeyPress);break;case"allowDragAndDrop":this.model.allowDragAndDrop=i[s],i[s]?this._addDragableClass():this._preventDraggable();break;case"allowDropChild":this.model.allowDropChild=i[s],i[s]?this._addDragableClass():this._preventDropChild();break;case"allowDropSibling":this.model.allowDropSibling=i[s],i[s]?this._addDragableClass():this._preventDropSibling();break;case"enableRTL":this.model.enableRTL=i[s],c=this.element.is("UL")?this.element.parent(".e-treeview-wrap"):this.element,h=this.model.enableRTL?"addClass":"removeClass",c[h]("e-rtl");break;case"height":this.element.height(i[s]);break;case"width":this.element.width(i[s]);break;case"selectedNode":this.model.selectedNode=i[s],this.model.selectedNode>=0?this._nodeSelectionAction(e(this._liList[this.model.selectedNode])):this.unselectNode(this.element.find(".e-item > div > .e-active").closest(".e-item"));break;case"htmlAttributes":this._addAttr(i[s]);break;case"enableMultipleExpand":i[s]||this.collapseAll();break;case"sortSettings":e.extend(this.model.sortSettings,i[s]),t.isNullOrUndefined(this.model.fields)||null==this.dataSource()||(this.model.expandedNodes=[],this.model.checkedNodes=[],this.model.selectedNode=-1,this._checkDataBinding())}},_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),e("#"+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 e,i;this._cloneElement=this.element.clone(),this._dataSource=[],this._fragment=[],this._templateType="",this._indexID=0,this._animating=!1,this._newDataSource=this.dataSource(),this._id=this.element.prop("id"),this.model.enablePersistence&&(e=this._getCookies("_persistedValues"),e||(i={selectedNode:"",expandedNodes:[],checkedNodes:[]},this._setCookies("_persistedValues",JSON.stringify(i)))),t.isNullOrUndefined(this.model.fields)||null==this.dataSource()?this._initialize():this._checkDataBinding()},_initialize:function(){this._cutNode=null,this._beforeEditText=null,this._CurrenctSelectedNodes=[],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"),null!=this.model.width&&this.element.width(this.model.width),null!=this.model.height&&this.element.height(this.model.height),this.model.enableRTL&&this.element.addClass("e-rtl"),null!=this.model.cssClass&&this.element.addClass(this.model.cssClass),this._addAttr(this.model.htmlAttributes)),this._elementSettings(),this._beforeBaseClass(),null==this.dataSource()&&(this._addBaseClass(),this._controlRender()),this._addDragableClass(),this._finalize(),this._enabledAction(this.model.enabled)},_extendFields:function(t,i){if(null==t||null==i)t=i;else if(null==t.child||null==i.child)e.extend(t,i);else{this._extendFields(t.child,i.child);var s=t.child;e.extend(t,i),e.extend(t.child,s)}},_elementSettings:function(){var e=this.element.is("UL")?this.element.parent(".e-treeview-wrap"):this.element;this.element.is("ul")?e.attr("role","tree"):e.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=e(t.querySelectorAll("ul")),this._liList=e(t.querySelectorAll("li"))},_createWrapper:function(){var e=t.buildTag("div.e-treeview-wrap e-widget "+this.model.cssClass,"","",{tabindex:0,"aria-activedescendant":this._id+"_active"});null!=this.model.width&&e.width(this.model.width),null!=this.model.height&&e.height(this.model.height),this.model.enableRTL&&e.addClass("e-rtl"),e.insertAfter(this.element),e.append(this.element.addClass("e-ul e-box").attr("tabindex",0)),this._addAttr(this.model.htmlAttributes)},_addAttr:function(t){var i=this;e.map(t,function(e,t){"class"==t?i.element.addClass(e):"disabled"==t&&"disabled"==e?i._enabledAction(!1):i.element.attr(t,e)})},_changeSkin:function(e){if(this.model.cssClass!=e){var t=this.element.is("UL")?this.element.parent(".e-treeview-wrap"):this.element;t.removeClass(this.model.cssClass).addClass(e),t.find(".e-item > div > .e-chkbox-wrap").removeClass(this.model.cssClass).addClass(e)}},_enabledAction:function(e){this.model.enabled=e,e?(this.element.removeClass("e-disable"),this._wireEvents()):(this.element.addClass("e-disable"),this._unWireEvents())},_checkDataBinding:function(){this.dataSource()instanceof t.DataManager?this._initDataSource():((t.isNullOrUndefined(this.dataSource().length)||""==this.dataSource())&&(this.model.fields.dataSource=[]),this._ensureDataSource(this.dataSource()),this._initialize())},_initDataSource:function(){this.element.ejWaitingPopup();var e,t,i=(this.element.ejWaitingPopup("instance"),this);this.element.ejWaitingPopup("refresh"),this.element.ejWaitingPopup("show"),t=this._columnToSelect(this.model.fields),e=this.dataSource().executeQuery(t),e.done(function(e){i.element.ejWaitingPopup("hide"),i.retriveData=e.xhr&&e.xhr.responseJSON.d?e.xhr.responseJSON.d:e.result?e.result:[],i._typeOfFieldId=i.retriveData[0]?(typeof i.retriveData[0][i.model.fields.id]).toLowerCase():"",i._ensureDataSource(i.retriveData),i._initialize()})},_columnToSelect:function(e){var i,s=[],a=t.Query();if(e.query||t.isNullOrUndefined(e.tableName))a=e.query?e.query:a;else{for(i in e)"tableName"!==i&&"child"!==i&&"dataSource"!==i&&e[i]&&s.push(e[i]);s.length>0&&a.select(s),this.dataSource().dataSource.url.match(e.tableName+"$")||t.isNullOrUndefined(e.tableName)||a.from(e.tableName)}return a},_ensureDataSource:function(e){e=this._getSortAndFilterList(this.model.fields,e),this.currentSelectedData=e,this._renderTemplate(e),this.element.is("ul")?this.element.html(this._fragment.firstChild.children):this.element.html(this._fragment)},_getTemplateType:function(e,t){for(var i=0,s=e.length;i div:first").addClass("e-icon e-plus"),this._finalizeLoadOnDemand(a)),this._onlineData=!1},_genTemplate:function(i,s){var a,n,o,r,l,d,h,c,u,m,p,g,_,f=document.createDocumentFragment();if(n=document.createElement("li"),f.appendChild(n),a=f.firstChild,a.id=i[s.id]?i[s.id]:"",a.setAttribute("role","treeitem"),i[s.htmlAttribute]&&this._setAttributes(i[s.htmlAttribute],a),a.className+=" e-item",r=document.createElement("a"),i[s.imageUrl]?(o=document.createElement("img"),o.className="e-align",o.src=i[s.imageUrl],i[s.imageAttribute]&&this._setAttributes(i[s.imageAttribute],o)):i[s.spriteCssClass]&&(o=document.createElement("span"),o.className=i[s.spriteCssClass]),this.model.template){if(o&&r.appendChild(o),"function"!=typeof e.fn.render)throw"Error : JsRender dependecy script missing";r.innerHTML+=this._renderEjTemplate(this.model.template,i)}else i[s.text]?e(r).text(i[s.text]):e(r).text("undefined"),o&&r.insertBefore(o,r.lastChild);if(i[s.linkAttribute]&&("object"==typeof i[s.linkAttribute]?this._setAttributes(i[s.linkAttribute],r):r.href=i[s.linkAttribute]),a.appendChild(r),i[s.expanded]&&(a.className+=" expanded"),i[s.selected]&&(a.className+=" selected"),t.isNullOrUndefined(i[s.isChecked])||(a.className+=i[s.isChecked]?" checked":" unchecked"),a.setAttribute("aria-selected",!1),a.setAttribute("aria-expanded",!1),this.dataSource()instanceof t.DataManager)this._updateElement(a,!0),this.model.showCheckbox&&this._checkboxOnTemplate(a.children[0]),this.model.loadOnDemand?(i[s.hasChild]||i.hasOwnProperty("child"))&&(a.children[0].firstChild.className="e-icon e-plus"):!t.isNullOrUndefined(s.child)&&s.child.dataSource instanceof t.DataManager?(d=this,c=s.child.parentId?s.child.parentId:d.model.fields.parentId,u=s.id?s.id:this.model.fields.id,h=this._executeDataQuery(s.child,c,"number"==this._typeOfFieldId?parseInt(i[u]):i[u]),h.done(function(e){l=e.xhr&&e.xhr.responseJSON.d?e.xhr.responseJSON.d:e.result?e.result:[],l=d._getSortAndFilterList(s.child,l),l&&l.length>0&&(d._onlineData=!0,d._onlineDataSource(l,l[0][s.child.parentId],s.child))})):t.isNullOrUndefined(this.model.fields.child)&&this._childNodeCreation(i,a,s);else if(this.model.loadOnDemand){if(this._updateElement(a,!0),(i[s.hasChild]||i.hasOwnProperty("child"))&&(a.children[0].firstChild.className="e-icon e-plus"),this.model.showCheckbox&&this._checkboxOnTemplate(a.children[0]),i[s.expanded]&&this._childNodeCreation(i,a,s),this.model.enablePersistence&&(m=this._getCookies("_childNodes")))for(p=JSON.parse(m),g=0,_=p.length;g<_;g++)if(p[g].toString()==i[s.id].toString()){this._childNodeCreation(i,a,s);break}}else this._onlineData||(this._updateElement(a,!0),this.model.showCheckbox&&this._checkboxOnTemplate(a.children[0]),this._childNodeCreation(i,a,s));return a},_childNodeCreation:function(i,s,a){var n,o,r,l,d,h;if(n=2==this._templateType?!t.isNullOrUndefined(i.child)&&i.child.length>0&&i.child:this._getChildNodes(this._dataSource,{id:i[a.id]}),!t.isNullOrUndefined(n)&&n.length>0){for(s.children[0].firstChild.className="e-icon e-plus",o=document.createDocumentFragment(),r=document.createElement("ul"),o.appendChild(r),l=o.firstChild,l.className="e-treeview-ul",l.setAttribute("role","group"),e(l).attr("style","display:none"),d=0,h=n.length;dul").hide(),p=m.find(".e-text"),p.focus(function(){e(this).blur()}),m.filter(".e-item:last-child").addClass("last"),e(m[0]).addClass("first"),e(m[0]).hasClass("first")&&e(m[0]).hasClass("last")&&e(m[0]).removeClass("first"),e(m.filter(":has(ul)")).each(function(){e(this).attr("aria-expanded",!1).attr("aria-selected",!1);var t=e(this).children("ul:first");e(t).is(":hidden")?e(this).find("> div > div:first").removeClass("e-icon e-minus").addClass("e-icon e-plus"):e(this.childNodes[1]).removeClass("e-icon e-plus").addClass("e-icon e-minus")})},_getText:function(t){return e(t).clone().children().remove().end().text()},_expandNodes:function(i){for(var s,a=i.length,n=[],o=0;odiv>.e-minus").closest(".e-item"),s.length>0)||this.isExpanded(n)||(!this.model.loadOnDemand||this.dataSource()instanceof t.DataManager?this._expandNode(n):this._createChildNodesWhenExpand(n))},_checkedNodes:function(t){var i,s,a;for(t.length>0&&this._removeField(this._newDataSource,this.model.fields.isChecked),s=0,a=t.length;s div > .e-chkbox-wrap > .nodecheckbox:first")[0])},_finalize:function(){var i,s,a,n;this._isRender=!1;var o,r,l,d=this.element,h=this._getCookies("_persistedValues"),c=[],u=0,m=[];if(this.model.showCheckbox&&d.find(".e-item > div .nodecheckbox").ejCheckBox({cssClass:this.model.cssClass,change:this._checkedChange}),!(this.model.expandedNodes instanceof Array&&this.model.expandedNodes.length>0))for(o=d.find("li.expanded"),n=o.length,a=0;adiv>.e-minus").closest(".e-item"),s.length>0)||this._expandNode(i);if(h&&(r=JSON.parse(h),c=r.expandedNodes,m=[]),c.length>0&&!t.isNullOrUndefined(this.model.fields)&&null!=this.dataSource()){for(a=0,n=c.length;adiv>.e-minus").closest(".e-item"),s.length>0))continue;!this.model.loadOnDemand||this.dataSource()instanceof t.DataManager?this._expandNode(m):this._createChildNodesWhenExpand(m)}}else l=JSON.parse(JSON.stringify(this.model.expandedNodes)),this._expandNodes(l);if(this.model.showCheckbox)if(h&&(r=JSON.parse(h),c=r.checkedNodes,m=[]),c.length>0&&!t.isNullOrUndefined(this.model.fields)&&null!=this.dataSource())for(this._removeField(this._newDataSource,this.model.fields.isChecked),a=0,n=c.length;a div > .e-chkbox-wrap > .nodecheckbox:first")[0]);else l=JSON.parse(JSON.stringify(this.model.checkedNodes)),this._checkedNodes(l);this.model.checkedNodes instanceof Array&&this.model.checkedNodes.length>0||this.model.showCheckbox&&this._isCheckedAction(),m=[],h&&(u=r.selectedNode),u&&!t.isNullOrUndefined(this.model.fields)&&null!=this.dataSource()&&(m=this.element.find(".e-item#"+u)),null!=m[0]?this._nodeSelectionAction(m):this.model.selectedNode>=0?this._nodeSelectionAction(e(this._liList[this.model.selectedNode])):null!=this.model.selectedNode&&this._isSelectedAction(),this._isRender=!0,this.model.allowEditing&&this._allowEditable(),d.find(".e-item.checked, .e-item.expanded, .e-item.selected").removeClass("checked expanded selected")},_updateSelectedNode:function(){var t=e(this._liList).find(".e-text.e-active").closest(".e-item"),i=[];this.model.selectedNode=null!=t[0]&&t.length>0?e(this._liList).index(t):null,this.model.selectedNode>=0&&(i=e(this._liList[this.model.selectedNode]),null!=i[0]&&(this._isRender=!1,this.selectNode(i),this._isRender=!0)),this._persistValues([this.model.selectedNode],"selectedNode")},_setCookies:function(e,i){window.localStorage?window.localStorage.setItem(this._id+e,i):document.cookie&&t.cookie.set(this._id+e,i)},_getCookies:function(e){return window.localStorage?window.localStorage.getItem(this._id+e):window.cookie?t.cookie.get(this._id+e):void 0},_updateCheckedNodes:function(){for(var t=[],i=this.element.find(".e-item > div > .e-chkbox-wrap > .nodecheckbox.checked").closest(".e-item"),s=0;s0||0==i.length)&&(this.model.checkedNodes=t),0==i.length&&this.model.checkedNodes.push(-1),this._persistValues(this.model.checkedNodes,"checkedNodes")},_updateExpandedNodes:function(){var t,i,s,a=[];for(t=this.element.find(".e-item > div > .e-minus").closest(".e-item").addClass("e-collapse"),i=0,s=t.length;i0||0==t.length)&&(this.model.expandedNodes=a),0==t.length&&this.model.expandedNodes.push(-1),this._persistValues(this.model.expandedNodes,"expandedNodes")},_isCheckedAction:function(){for(var t,i,s,a=this.element.find(".e-item.checked"),n=0;n0&&i.length==t.length)||!this.model.autoCheck)for(this._nodeCheck(e(a[n]).find("> div > .e-chkbox-wrap > input.nodecheckbox:first")[0]),s=0;s div > .e-chkbox-wrap > .nodecheckbox:first")[0]);this.element.find(".e-item.checked, .e-item.unchecked").removeClass("checked unchecked")},_isSelectedAction:function(){var e=this.element.find(".e-item.selected:last");null!=e[0]&&this._nodeSelectionAction(e),this.element.find(".e-item.selected").removeClass("selected")},_checkedChange:function(t){var i=this.element.closest(".e-treeview.e-js").data("ejTreeView");action=t.isChecked?"_nodeCheck":"_nodeUncheck",i[action](e(this.element)[0],t)},_ClickEventHandler:function(i){var s,a,n,o,r,l=this,d=e(i.target);if(!this._isclicked&&(s=d.closest(".e-item"),!s.hasClass("e-node-disable"))){if(this._isclicked=!0,this._triggerEvent("nodeClick",{event:i,currentElement:d[0]}),!t.isNullOrUndefined(d)&&d.is("DIV")&&(d.hasClass("e-plus")||d.hasClass("e-minus")))if(a=null,d.is("SPAN")&&(d=d.parent("div").find("div:first")),a=s.children("ul:first"),r=this.isChildLoaded(s),!r&&this.model.loadOnDemand){if(d.removeClass("e-plus").addClass("e-load"),this._checkboxChecked=d.parent().find(".nodecheckbox").hasClass("checked"),o=this._getNodeDetails(s),n={currentElement:s,targetElement:d[0],id:o.id,value:o.text,parentId:o.parentId,isChildLoaded:r,hasParent:!0,async:!0},this._isEventTriggered=!0,this._triggerEvent("beforeExpand",n))return d.hasClass("e-plus")||d.hasClass("e-minus")?d.removeClass("e-load"):d.removeClass("e-icon e-load"),this._isclicked=!1,!1;this._loadOnDemand(n,d[0])}else d.hasClass("e-plus")?this._expandNode(s):this._collpaseNode(s);d.is("A")||d.hasClass("input-text")||(d=d.parent()),!t.isNullOrUndefined(d)&&d.is("A")&&d.hasClass("CanSelect")&&!d.hasClass("e-active")&&this._nodeSelectionAction(d.closest(".e-item"))}setTimeout(function(){l._isclicked=!1},300)},_getChildTables:function(e,i,s){if(!t.isNullOrUndefined(e.child))return i==s?e.child:this._getChildTables(e.child,i,s+1)},_loadOnDemand:function(i){var s,a,n,o,r=this;if(this.dataSource()instanceof t.DataManager){if(a=i.currentElement.parents("ul").length,n=this._getChildTables(r.model.fields,a,1),t.isNullOrUndefined(n)&&t.isNullOrUndefined(this.model.fields.child)&&(n=this.model.fields),n.query&&n.query.queries.length>0&&(n.query.queries=[]),!n)return;o=this._executeDataQuery(n,n.parentId,"number"==this._typeOfFieldId?parseInt(i.currentElement[0].id):i.currentElement[0].id),o.done(function(t){s=t.xhr&&t.xhr.responseJSON.d?t.xhr.responseJSON.d:t.result?t.result:[],s=r._getSortAndFilterList(n,s),s.length>0?(r._onlineData=!0,r._loadChildNodeWhenOnDemand(s,i,n)):e(i.targetElement).hasClass("e-load")&&e(i.targetElement).removeClass(e(i.targetElement).hasClass("e-plus")||e(i.targetElement).hasClass("e-minus")?"e-load":"e-icon e-load")})}else s=this._getChildNodes(this._dataSource,i),!t.isNullOrUndefined(s)&&s.length>0?setTimeout(function(){r._createSubNodesWhenLoadOnDemand(s,i.targetElement,r.model.fields)},400):e(i.targetElement).hasClass("e-load")&&e(i.targetElement).removeClass(e(i.targetElement).hasClass("e-plus")||e(i.targetElement).hasClass("e-minus")?"e-load":"e-icon e-load")},_loadChildNodeWhenOnDemand:function(e,i,s){var a=this;!t.isNullOrUndefined(e)&&e.length>0&&setTimeout(function(){a._createSubNodesWhenLoadOnDemand(e,i.targetElement,s)},100)},_createSubNodesWhenLoadOnDemand:function(t,i,s){this._loadOnDemandNodes=!0,this._templateNodeCreation(t,s),e(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 a=e(i).closest(".e-item");a.attr({"aria-expanded":!1,"aria-expanded":!0}),e(i).removeClass("e-load").addClass("e-plus"),this._expandNode(a),this._finalizeLoadOnDemand(a)},_finalizeLoadOnDemand:function(e){var i,s,a,n;this._beforeBaseClass(),this._isRender=!1,this.model.showCheckbox&&(e.children("ul").find("li > div > input.nodecheckbox").ejCheckBox({cssClass:this.model.cssClass,change:this._checkedChange}),i=e.children("ul").find(".e-item"),s=e.children("ul").find(".e-item.unchecked"),s.length>=0&&s.length!=i.length&&this._checkboxChecked?i.not(".unchecked").addClass("checked"):s.length==i.length&&this.isNodeChecked(e)&&this._nodeUncheck(e.find("> div > .e-chkbox-wrap > .nodecheckbox:first")[0]),this._isCheckedAction(),this._updateCheckedNodes()),this._isRender=!0,this._addDragableClass(),this._preventEditable(),this.model.allowEditing&&this._allowEditable(),this._isSelectedAction(),this._updateSelectedNode(),this._updateExpandedNodes(),!this.model.loadOnDemand||!this.model.enablePersistence||this.dataSource()instanceof t.DataManager||(n=this._getCookies("_childNodes"),n&&(a=JSON.parse(n)),t.isNullOrUndefined(a)||a.indexOf(e[0].id)!=-1?a=[e[0].id]:a.push(e[0].id),this._setCookies("_childNodes",JSON.stringify(a)))},_getChildNodes:function(e,i){var s,a,n=[];if(1!=this._templateType){for(s=0,a=e.length;s0))break}return n}for(s=0,a=e.length;s div > .text.e-active").length>0)){var i,s;this._triggerEvent("beforeSelect",{target:t,nodeDetails:this._getNodeDetails(t)})||(this.element.find("li > div > a").removeClass("e-node-focus e-active").closest("li").find("[aria-selected=true]").attr("aria-selected",!1),t.attr("aria-selected",!0),e(t.find("> div > .e-text")[0]).addClass("e-active").attr("id",this._id+"_active"),this.model.selectedNode=this._liList.index(t[0]),i=this._getNodeDetails(t),s={currentElement:t,value:i.text,id:i.id,parentId:i.parentId},this.model.enablePersistence&&this._persistValues([this.model.selectedNode],"selectedNode"),this._triggerEvent("nodeSelect",s))}},_nodeUnSelectionAction:function(e){e.attr("aria-selected",!1).find("> div > .e-text").removeClass("e-active").attr("id",""),this.model.selectedNode=null},_nodeEnableAction:function(e){var t=this.getParent(e);null!=t[0]&&t.hasClass("e-node-disable")||(this.model.showCheckbox&&e.find("div > .e-chkbox-wrap > .nodecheckbox").ejCheckBox("enable").prop("disabled",!1),e.find(".e-text").removeClass("e-node-disable").closest(".e-item").removeClass("e-node-disable").prop("disabled",!0))},_nodeDisableAction:function(t){this._animating=!1,this._collpaseNode(t),this.model.showCheckbox&&t.find("div > .e-chkbox-wrap > .nodecheckbox").ejCheckBox("disable").prop("disabled",!0),t.find(".e-text").addClass("e-node-disable").removeClass("e-active").attr("id","").closest(".e-item").addClass("e-node-disable").prop("disabled",!0);var i=this._liList[this.model.selectedNode];(e(this._liList).index(t)==this.model.selectedNode||null!=t.find(i)[0])&&(this.model.selectedNode=null)},_getNodeDetails:function(e){if(null!=e[0]&&e.is("LI")&&e.hasClass("e-item")){var t,i,s,a,n,o,r,l,d;return t=e.attr("id"),i=e.children("div").find(".e-text:first").text(),s=e.closest("ul").closest(".e-item").attr("id"),a=e.parents("ul").length,n=e.find(".e-item").length,o=this.isExpanded(e),r=this.isNodeChecked(e),l=this.isSelected(e),d=this.getNodeIndex(e),{id:t,text:i,parentId:s?s:"",level:a,count:n,expanded:o,checked:r,selected:l,index:d}}return{id:"",text:"",parentId:"",level:"",count:"",expanded:"",checked:"",selected:"",index:""}},_denyMultipleExpand:function(t){for(var i=t.siblings().find(">div>.e-minus").closest(".e-item"),s=0,a=i.length;s .e-item").length>0)if(this._animating=!!this.model.enableAnimation,a=this._getNodeDetails(s),o=this.isChildLoaded(s),n={currentElement:s,value:a.text,isChildLoaded:o,id:a.id,parentId:a.parentId,async:!1},!this._isNodeExpanded(s)&&o){if(!this._isEventTriggered&&this._triggerEvent("beforeExpand",n))return!1;this._isEventTriggered=!1,s.attr("aria-expanded",!0),i.animate({height:"toggle"},this.model.enableAnimation?350:0,"linear",function(){r._animating=!1,r._triggerEvent("nodeExpand",n),r._addExpandedNodes(r._liList.index(s))}),e(t).removeClass("e-icon e-plus").addClass("e-icon e-minus"),s.addClass("e-collapse")}else{if(s.attr("aria-expanded",!1),this._triggerEvent("beforeCollapse",n)===!0)return!1;i.animate({height:"toggle"},this.model.enableAnimation?200:0,"linear",function(){r._animating=!1,r._triggerEvent("nodeCollapse",n),r._removeExpandedNodes(r._liList.index(n.currentElement))}),e(t).removeClass("e-icon e-minus").addClass("e-icon e-plus"),s.removeClass("e-collapse")}}},_isChecked:function(e){return"true"===e.find("> div > .e-chkbox-wrap:first").attr("aria-checked")},_doRecursiveCheck:function(t,i){var s,a,n,t,o,r;o=t.children[1],s=o?o.querySelectorAll('.e-chkbox-wrap[aria-checked="true"]').length:0,allChkEle=o?o.querySelectorAll(".e-item > div > .e-chkbox-wrap > .nodecheckbox"):[],a=t.firstChild.querySelector(".nodecheckbox"),a&&"INPUT"==a.nodeName.toUpperCase()&&(r=e(a).data("ejCheckBox"),s==allChkEle.length||this.model.autoCheckParentNode?(r.setModel({enableTriState:!1,checked:!0}),a.className+=" checked",n=t.firstChild.getElementsByTagName("a")[0].innerHTML,i.push({id:t.id,text:n}),this._updateField(this._newDataSource,t.id,this.model.fields.isChecked,!0),this._addHiddenInputElement(a,n),this._addCheckNodes(this._liList.index(t))):r.setModel({enableTriState:!0,checkState:"indeterminate"}),t=t.parentNode.parentNode,"LI"==t.nodeName.toUpperCase()&&this._doRecursiveCheck(t,i))},_nodeCheck:function(t,i){var s,a,n,o,r,l,d,h,c;if(null!=e(t)[0]){if(this._CurrenctSelectedNodes=[],this._checkedArray=[],t.className+=" checked",s=e(t).data("ejCheckBox")){if(s.setModel({enableTriState:!1,checked:!0}),a=t.parentNode.parentNode.parentNode,n=a.firstChild.getElementsByTagName("a")[0].lastChild.nodeValue,this._checkedArray.push({id:a.id,text:n}),this._updateField(this._newDataSource,a.id,this.model.fields.isChecked,!0),this._addHiddenInputElement(t,n),this._addCheckNodes(this._liList.index(a)),this.model.autoCheck){for(d=a.children[1],r=d?d.querySelectorAll(".e-item > div > .e-chkbox-wrap > .nodecheckbox"):[],h=0,c=r.length;h div > .e-chkbox-wrap > .nodecheckbox"):[],a=t.firstChild.querySelector(".nodecheckbox"),a&&"INPUT"==a.nodeName.toUpperCase()&&(r=e(a).data("ejCheckBox"),s<=0&&(r.setModel({enableTriState:!1,checked:!1}),e(a).removeClass("checked").removeClass("checked").children().remove(),n=t.firstChild.getElementsByTagName("a")[0].innerHTML,this._removeCheckNodes(this._liList.index(t)),i.push({id:t.id,text:n}),this._updateField(this._newDataSource,t.id,this.model.fields.isChecked,!1)),s>1&&this.model.autoCheckParentNode?(r.setModel({checked:!0}),a.className+=" checked",n=t.firstChild.getElementsByTagName("a")[0].innerHTML,this._addHiddenInputElement(t,n)):s>0&&!this.model.autoCheckParentNode&&(allChkEle.length>1?r.setModel({enableTriState:!0,checkState:"indeterminate"}):r.setModel({checked:!1}),e(a).removeClass("checked").removeClass("checked").children().remove(),this._removeCheckNodes(this._liList.index(t))),t=t.parentNode.parentNode,"LI"==t.nodeName.toUpperCase()&&this._doRecursiveUncheck(t,i))},_nodeUncheck:function(t,i){var s,a,n;if(null!=e(t)[0]){if(s=this,this._uncheckedArray=[],currentLi=t.parentNode.parentNode.parentNode,e(currentLi).find("div > .e-chkbox-wrap > .nodecheckbox").removeClass("checked").children().remove(),chkObj=e(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._updateField(this._newDataSource,currentLi.id,this.model.fields.isChecked,!1),this.model.autoCheck){for(childUl=currentLi.children[1],allChkEle=childUl?childUl.querySelectorAll(".e-item > div > .e-chkbox-wrap > .nodecheckbox"):[],a=0,n=allChkEle.length;a0&&0==e.find("ul .e-item").length){if(i=e.attr("id"),s=e.children("div").find(".e-text:first").text(),n=e.children("div").find("div.e-plus:first"),a={currentElement:e,targetElement:n[0],id:i,value:s,isChildLoaded:!1,hasParent:!0,async:!1},l=this,this._isEventTriggered=!0,this._triggerEvent("beforeExpand",a))return n.hasClass("e-plus")||n.hasClass("e-minus")?n.removeClass("e-load"):n.removeClass("e-icon e-load"),!1;if(this.dataSource()instanceof t.DataManager){if(o=a.currentElement.parents("ul").length,r=this._getChildTables(this.model.fields,o,1),t.isNullOrUndefined(r)&&t.isNullOrUndefined(this.model.fields.child)&&(r=this.model.fields),r.query&&r.query.queries.length>0&&(r.query.queries=[]),!r)return;d=this._executeDataQuery(r,r.parentId,"number"==this._typeOfFieldId?parseInt(a.currentElement[0].id):a.currentElement[0].id),d.done(function(i){h=i.xhr&&i.xhr.responseJSON.d?i.xhr.responseJSON.d:i.result?i.result:[],h=l._getSortAndFilterList(r,h),!t.isNullOrUndefined(h)&&h.length>0&&(l._checkboxChecked=e.find("> div > .e-chkbox-wrap > .nodecheckbox").hasClass("checked"),l._loadOnDemandNodes=!0,0==e.find("ul .e-item").length&&(l._templateNodeCreation(h,r),e.append(l._fragment)),l._finalizeLoadOnDemand(e),l._expandNode(e))})}else h=this._getChildNodes(this._dataSource,{id:e[0].id}),!t.isNullOrUndefined(h)&&h.length>0&&(this._checkboxChecked=e.find("> div > .e-chkbox-wrap > .nodecheckbox").hasClass("checked"),this._loadOnDemandNodes=!0,this._templateNodeCreation(h,this.model.fields),e.append(this._fragment),this._finalizeLoadOnDemand(e),this._expandNode(e))}else this._expandNode(e)},_getSortAndFilterList:function(e,i){var s,a;return!i||!i.length||i.length<1?s=[]:(a=t.Query(),this._addSortingQuery(a,e),s=t.DataManager(i).executeLocal(a)),s},_addSortingQuery:function(e,i){if(this.model.sortSettings.allowSorting){var s=i&&i.text?i.text:"text",a=this.model.sortSettings.sortOrder==t.sortOrder.Descending;e.sortBy(s,a)}},_expandNode:function(e){var t,i;return null!=e[0]&&e.length>0&&(t=e.find("> div > div:first"),this.model.loadOnDemand&&!this.model.enablePersistence?e.find("> ul > .e-item").length>0&&t.hasClass("e-plus")?(this.model.enableMultipleExpand||this._denyMultipleExpand(e),this._animating=!1,this._expandCollapseAction(e.find("> div > div.e-plus:first"))):t.hasClass("e-icon")&&!t.hasClass("e-minus")&&this._allowOnDemand&&this._createChildNodesWhenExpand(e):t.hasClass("e-plus")&&(i=e.find("> ul > .e-item").length>0,i&&(this.model.enableMultipleExpand||this._denyMultipleExpand(e),this._animating=!1,this._expandCollapseAction(t)))),!0},_collpaseNode:function(e){if(null!=e[0]&&e.length>0&&e.find("> ul > .e-item").length>0){var t=e.find("> div > div:first");t.hasClass("e-minus")&&this._expandCollapseAction(t)}},_expandAll:function(){var t,i,s=this.element;if(this.model.loadOnDemand)for(i=e(s).find(".e-item"),t=0,len=i.length;t div > .e-plus").closest(".e-item"),s.find("ul:hidden").length==cnodes.length)for(t=0,len=cnodes.length;t ul:not(:hidden)").closest(".e-item"),enodes=i.find("> div > .e-minus").closest(".e-item"),enodes.length>0)for(t=0,len=enodes.length;t div > .e-chkbox-wrap > .nodecheckbox"),t.addClass("checked"),i=0,len=t.length;i div > .e-chkbox-wrap > .nodecheckbox"),t.removeClass("checked").children().remove(),i=0,len=t.length;i0&&e.find("> div > div.e-minus").length>0},_showCheckBox:function(){for(var e=this.element,t=e.find("li"),i=0;i div > .nodecheckbox").ejCheckBox({cssClass:this.model.cssClass,change:this._checkedChange}),e.find(".e-item.e-node-disable > div > .e-chkbox-wrap > .nodecheckbox").ejCheckBox("disable")},_drag:function(){var i,s,a=!1,n=t.browserInfo(),o=null,r=null,l=null;s="msie"==n.name&&"8.0"==n.version,this.element.is("ul")?(this._treeView=this.element.parent(),this.model.allowDragAndDropAcrossControl||(l=this.element.parent())):(this._treeView=this.element,this.model.allowDragAndDropAcrossControl||(l=this.element)),e(this._treeView).find("ul li div a").not(".e-js").ejDraggable({dragArea:l,clone:!0,dragStart:function(a){if(!i||t.isNullOrUndefined(a.target)||e(a.target).hasClass("e-node-disable")||0!=i.element.find(".e-item > div > .e-text.e-editable").length||e(a.target).is("A")&&!e(a.target).hasClass("e-draggable"))return!1;s&&(document.ondragstart=function(){return!1});var n={target:e(a.target).closest(".e-item"),targetElementData:i._getNodeDetails(e(a.target).closest(".e-item")),dragTarget:a.target,parentElement:e(a.target).closest("ul").closest(".e-item"),parentElementData:i._getNodeDetails(e(a.target).closest("ul").closest(".e-item")),event:a.event};return i._triggerEvent("nodeDragStart",n)?(a.cancel=!0,o&&o.remove(),!1):void 0},drag:function(s){var n,r,l,d,h;return a=!1,e(".e-sibling").remove(),n=s.target,r=i._findTarget(e(n)),e(o).css({"margin-left":"20px","margin-top":s.event.clientY-20<0?"0px":"-20px",display:"table"}),e(o).find("> a.e-text").css({display:"table-cell","white-space":"nowrap",margin:"0 0 1px"}),e(o).find(">.e-dropedStatus").css({display:"table-cell"}),l={draggedElement:e(s.element).closest(".e-item"),draggedElementData:i._getNodeDetails(e(s.element).closest(".e-item")),dragTarget:n,target:r,targetElementData:i._getNodeDetails(r),event:s.event},(e(n).hasClass("e-droppable")||e(n).parent().hasClass("e-droppable"))&&e(n).hasClass("e-dropchild")&&!e(n).hasClass("e-node-disable")?(document.body.style.cursor="",e(o).find("span.e-dropedStatus").removeClass().addClass("e-dropedStatus e-icon e-plus"),e(n).addClass("allowDrop")):e(n).hasClass("e-droppable")&&!e(n).hasClass("e-item")&&!e(n).hasClass("e-text")||e(n).is("UL")&&e(n).hasClass("e-ul")&&0==e(n).find(".e-item").length&&e(n).parent(".e-treeview-wrap").length>0?(document.body.style.cursor="",e(o).find("span.e-dropedStatus").removeClass().addClass("e-dropedStatus e-icon e-plus")):(e(n).hasClass("e-sibling")||e(n).find("a").hasClass("e-text"))&&(e(n).hasClass("e-sibling")||e(n).parent().parent().hasClass("e-item")||e(n).parent().hasClass("e-item")||e(n).hasClass("e-item")||e(n).hasClass("e-text"))&&("LI"!=n.nodeName.toUpperCase()&&(null===n.parentElement||"LI"!=n.parentElement.nodeName.toUpperCase())||this.model.allowDropSibling)||(document.body.style.cursor="not-allowed",e(o).find("span.e-dropedStatus").removeClass().addClass("e-dropedStatus e-icon e-minus"),e(n).removeClass("showline-hover"),e(n).removeClass("noline-hover")),"A"!=n.nodeName?("UL"==n.nodeName&&null!=e(n).children()[0]&&(n=e(n).children()[0],a=!0),"LI"!=n.nodeName&&(n=e(n).closest(".e-droppable")[0]||e(n).parent()),"LI"==n.nodeName&&e(n).hasClass("e-droppable")&&e(n).hasClass("e-dropsibling")?(d=t.buildTag("div.e-sibling"),h=e(n).offset().top+e(n).find("a").height()||-1,a=!(s.event.pageY>h),a?d.insertBefore(e(n).find("> div > a").parent()):d.insertAfter(e(n).find("> div > a").parent()),e(n).parents().hasClass("e-rtl")?(document.body.style.cursor="",e(o).find("span.e-dropedStatus").removeClass().addClass("e-dropedStatus e-icon e-insertInbetween-rtl")):(document.body.style.cursor="",e(o).find("span.e-dropedStatus").removeClass().addClass("e-dropedStatus e-icon e-insertInbetween"))):"A"==n.nodeName&&e(n)&&e(n).hasClass("e-droppable")&&e(n).hasClass("e-dropchild")?(document.body.style.cursor="",e(o).find("span.e-dropedStatus").removeClass().addClass("e-dropedStatus e-icon e-plus"),e(n).addClass("allowDrop")):!e(n).hasClass("e-droppable")||e(n).hasClass("e-item")||e(n).hasClass("e-text")||(document.body.style.cursor="",e(o).find("span.e-dropedStatus").removeClass().addClass("e-dropedStatus e-icon e-plus"))):e(".e-sibling").remove(),!i._triggerEvent("nodeDrag",l)&&void 0},dragStop:function(t){s&&(document.ondragstart=function(){return!0}),t.element.dropped||(o&&o.remove(),document.body.style.cursor="");var n,r,l=t.target;return"e-sibling"==l.className&&(l=e(l).closest(".e-item")[0]),e(".e-sibling").remove(),!(e(l).hasClass("e-node-disable")||(n=a?"Before":"After",trgtEle=i._findTarget(e(l)),n="A"==l.nodeName?"Over":n,r={draggedElementData:i._getNodeDetails(e(t.element).closest(".e-item")),draggedElement:e(t.element).closest(".e-item"),dropTarget:e(l),target:trgtEle,targetElementData:i._getNodeDetails(trgtEle),position:n,event:t.event},i._triggerEvent("nodeDragStop",r))||(i._isRender=!1,"A"==l.nodeName&&e(l).hasClass("e-dropchild")&&e(l).hasClass("e-droppable")||"UL"==l.nodeName&&0==e(l).children().length?(n="Over",e(l).is("UL")&&e(l).hasClass("e-ul")&&0==e(l).find(".e-item").length&&e(l).parent(".e-treeview-wrap").length>0?i._dropAsChildNode(e(l),e(t.element),t.event):0==e(t.element).parent().parent().has(e(l)).length&&(0==e(l).parent().parent().has(e(t.element)).length||i._isDescendant(e(l).parents("li:last").find(">ul>li"),e(t.element).parents("li:first")[0]))&&i._dropAsChildNode(e(l).closest(".e-item"),e(t.element),t.event)):("UL"==l.nodeName&&(l=e(l).children()[0]),"LI"!=l.nodeName&&(l=e(l).closest(".e-droppable")[0]||e(l).parent()),"LI"==l.nodeName&&e(l).hasClass("e-dropsibling")&&e(l).hasClass("e-droppable")?e(t.element).parent().parent().has(e(l)).length<1&&i._dropAsSublingNode(e(l),e(t.element),a,t.event):"A"==l.nodeName&&e(l).hasClass("e-dropchild")&&e(l).hasClass("e-droppable")&&(n="Over",0==e(t.element).parent().parent().has(e(l)).length&&(0==e(l).parent().parent().has(e(t.element)).length||i._isDescendant(e(l).parents("li:last").find(">ul>li"),e(t.element).parents("li:first")[0]))&&i._dropAsChildNode(e(l).closest(".e-item"),e(t.element),t.event))),i._isRender=!0,e(".allowDrop").removeClass("allowDrop"),e(l).hasClass("e-dropchild")||o&&o.remove(),trgtEle=i._findTarget(e(l)),r={droppedElementData:i._getNodeDetails(e(t.element).closest(".e-item")),droppedElement:e(t.element).closest(".e-item"),dropTarget:e(l),target:trgtEle,targetElementData:i._getNodeDetails(trgtEle),position:n,event:t.event},i._triggerEvent("nodeDropped",r)))&&void(document.body.style.cursor="")},helper:function(s){if(!t.isNullOrUndefined(s.element)&&!e(s.element).hasClass("e-node-disable")&&e(s.element).hasClass("e-draggable")&&(i=e(s.element).closest(".e-treeview.e-js").data("ejTreeView")))return o=t.buildTag("div.e-dragedNode"),o.addClass(i.model.cssClass+(i.model.enableRTL?" e-rtl":"")),r=e(s.element).clone().addClass("dragClone"),this.spanEle=t.buildTag("span.e-icon e-plus e-dropedStatus"),o.append(this.spanEle),o.append(r),o.appendTo(e("body"))}})},_findTarget:function(e){return e.hasClass("e-text")?e.closest(".e-item"):e.closest("ul").closest(".e-item").length>0?e.closest("ul").closest(".e-item"):this.element.find(e).length>0?e.parents("ul").first():e},_isDescendant:function(t,i){var s=!0;return e(t).each(function(e,t){return t==i?(s=!1,!1):void(s=!0)}),s},_childDrop:function(){e(this._treeView).find("ul .e-item div .e-text").ejDroppable({accept:e(this._treeView).find("ul .e-item div .e-text").addClass("e-dropchild"),drop:function(t,i){e(i.helper).hide()}})},_siblingDrop:function(){e(this._treeView).find("ul .e-item").addClass("e-dropsibling").ejDroppable({drop:function(t,i){e(i.helper).hide()}})},_dropAsSublingNode:function(i,s,a){var n,o=s.parent().parent(),o=e(o);n=e(s.parents(".e-item")[1]),this.dataSource()instanceof t.DataManager&&this.model.loadOnDemand&&"false"==s.parents(".e-item:first").attr("aria-expanded")&&s.parents(".e-item:first").find("div.e-icon")&&s.parents(".e-item:first").find("div.e-icon").removeClass(),t.isNullOrUndefined(this.model.fields)||null==this.dataSource()||this.dataSource()instanceof t.DataManager||this._updateDataSource(s.parents(".e-item:first"),e(i),a,this),a?o.insertBefore(i):o.insertAfter(i),this.model.template||this._autoGenerateNodes(s.parents(".e-item:first")),this._modifyCss(n),this._finalizeEditing(o),this._updateCheckState(o),this._updateCheckState(n),o.find("> div > .e-minus").length>0&&!this.model.enableMultipleExpand&&this._denyMultipleExpand(o),this._updateChanges(e(i))},_dropAsChildNode:function(i,s){var a,n=s.parent().parent(),n=e(n);a=e(s.parents(".e-item")[1]),e(i).is("UL")?e(i).append(n):this._appendNode(i,n),this.dataSource()instanceof t.DataManager&&this.model.loadOnDemand&&"false"==s.parents(".e-item:first").attr("aria-expanded")&&s.parents(".e-item:first").find("div.e-icon")&&s.parents(".e-item:first").find("div.e-icon").removeClass(),t.isNullOrUndefined(this.model.fields)||null==this.dataSource()||this.dataSource()instanceof t.DataManager||this._updateDataSource(s.parents(".e-item:first"),e(i).find("> div > .e-text").first(),"",this),this.model.template||this._autoGenerateNodes(s.parents(".e-item:first")),this._modifyCss(a),this._finalizeEditing(n),this._updateCheckState(n),this._updateCheckState(a),i.find("> div > .e-icon.e-plus:first").length>0&&this._expandNode(i),this._updateChanges(e(i))},_updateChanges:function(t){if(null!=e(t)[0]){var i=this,s=0;do i._updateNodes(),s++,i=t.closest(".e-treeview.e-js").data("ejTreeView");while(i&&this._id!=i._id&&1==s)}},_orderDataSource:function(){var i,s,a,n,o,r;for(this._beforeBaseClass(),i=[],s=this._newDataSource,a=0,n=this._liList.length;a ul .e-item").length?delete s[o][this.model.fields.hasChild]:1==this._templateType&&(s[o][this.model.fields.hasChild]=!0),i.push(s[o]);break}return i},_updateDataSource:function(i,s,a,n){var o,r,l,d,h,c,u;null!=e(i)[0]&&null!=e(s)[0]&&(o=n,r=s.closest(".e-treeview.e-js").data("ejTreeView"),!o||!r||t.isNullOrUndefined(r.model.fields)||null==r.dataSource()||r.dataSource()instanceof t.DataManager||(s.is("A")?(l=s.closest(".e-item").attr("id"),h=s.closest(".e-item").find("> ul > .e-item"),d=h.length>0?h.length:s.closest(".e-item").index()):(l=s.parents(".e-item:first").attr("id"),c=s.next(".e-item"),u=s.prev(".e-item"),d=c.length>0?d=u.length>0?c.index()-1:a?s.index():c.index():a?s.index():s.index()+1),r&&o._findAndUpdate(i.attr("id"),l,o._newDataSource,d,r)))},_removeObject:function(e,i,s){for(var a=0,n=e.length;a0&&this._convertDataSourceTypes(e.child[i],t);return e.child&&(delete e.child,e[this.model.fields.hasChild]=!0),t},_childObjectCollection:function(e,t,i){for(var s,a=0,n=e.length;a0&&(r=this._childObjectCollection(r,d,r)),2==n._templateType){if(r&&r.length>0){for(h=0,c=r.length;h0){for(h=0,c=r.length;h0){if(!(this.dataSource()instanceof t.DataManager)&&this.model.loadOnDemand){for(n._newDataSource.splice(n._newDataSource.length-1,1),r.push(_[0]),p=0;p div > .e-chkbox-wrap > .checked").closest(".e-item").addClass("checked"),i.length>0?t._isCheckedAction():(s=t.isNodeChecked(e)?"_nodeCheck":"_nodeUncheck",t[s](e.find("> div > .e-chkbox-wrap > .nodecheckbox:first")[0]))))},_autoGenerateNodes:function(t){var i,s,a,n;if(null!=e(t)[0])if(i=t.closest(".e-treeview.e-js").data("ejTreeView"),i&&i.model.showCheckbox){if(0==t.find(".e-chkbox-wrap").length){for(this._checkboxOnTemplate(t[0].children[0]),s=t.find(".e-item"),a=0,n=s.length;a div > div").first().hasClass("e-plus")||a._createChildNodesWhenExpand(i)),n=t.buildTag("ul.e-treeview-ul","",{},{role:"group",style:"display:none"}),e(n).append(e(s)),0==e(i.find("div")[1]).length?(o=document.createElement("div"),o.setAttribute("role","presentation"),o.className="e-icon e-minus",e(i.find("div")).append(e(o))):e(i.find("div")[1]).hasClass("e-minus")||e(i.find("div")[1]).addClass("e-icon e-plus"),a&&a.model.loadOnDemand&&!(this.dataSource()instanceof t.DataManager)&&i.find("ul").length>0?i.children("ul").append(e(s)):i.append(e(n))):e(i.find("ul")[0]).append(s),this.isDisabled(i)||this._expandNode(i)):this.element.is("UL")?this.element.append(s):this.element.children("ul:first").length>0?this.element.children("ul:first").append(s):(n=t.buildTag("ul.e-treeview-ul","",{},{role:"group"}),n.append(s),this.element.append(n)),r=this.element.find(".e-item.expanded"),d=0;d div > .e-icon").removeClass("e-icon e-minus").closest(".e-item").find("ul").remove()},_applyFirstLastChildClass:function(){e(this._liList).removeClass("first last").filter(":first-child:not(:last-child)").addClass("first"),e(this._liList).filter(":last-child").addClass("last")},_expandEventHandler:function(t){var i,s,a=e(t.target);a.hasClass("e-icon")||a.closest(".e-item").hasClass("e-node-disable")||"dblclick"===t.type&&this.model.allowEditing||(t.preventDefault(),i=e(a.is("A")?a.siblings("div"):a.parent().siblings("div")),s=a.closest(".e-item"),i.hasClass("e-minus")?this._collpaseNode(s):this.model.loadOnDemand&&0==i.find(".e-item").length?(this._isclicked=!1,this._ClickEventHandler({target:i[0]})):this._expandNode(s))},_inlineEdit:function(t){t.preventDefault();var i=e(t.target);return i.hasClass("input-text")||i.hasClass("e-node-disable")||!i.closest(".e-item").hasClass("AllowEdit")||(i.is("A")||(i=i.closest(".e-text")),i.is("A")&&!i.hasClass("e-node-disable")&&i.closest(".e-item").hasClass("AllowEdit")&&(this.unselectNode(i.closest(".e-item")),this._inlineEditAction(i))),!1},_inlineEditAction:function(e){var t=this.element.find(".e-item > div > .e-text > #Edit_Input");null==t[0]&&this._createEditTextBox(e)},_createEditTextBox:function(i){var s,a,n,o={currentElement:i};return!this._triggerEvent("beforeEdit",o)&&(s=this.element.find(".e-item > div > .e-text > #Edit_Input"),null==s[0]&&(n=t.buildTag("Input.input-text#Edit_Input","","",{type:"text",value:e.trim(i.text()).replace(/\n\s+/g," "),name:"inplace_value"}),n.width(i.outerWidth()+5),n.height(i.outerHeight()-2),this._beforeEditText=i.text(),i[0].lastChild.nodeValue="",i.addClass("e-editable").append(n),s=n,a=""==s.val().length?3:i.outerWidth()+20,this._mousePositionAtEnd(s),this._currentEditableNode=i,this._on(s,"keypress",this._editTextBoxKeyPress)._on(s,"keydown",this,this._pressEscKey)._on(s,"mousedown",this,this._preventPropagation)._on(s,this.model.expandOn,this,this._preventPropagation)._on(s,"blur",this._focusout)),s)},_preventPropagation:function(e){e.stopImmediatePropagation(),this._off(this._anchors,"mouseup touchstart pointerdown MSPointerDown",this._focusElement)},_editTextBoxKeyPress:function(e){e.target.size=e.target.value.length+1},_mousePositionAtEnd:function(e){return e.focus&&e.focus(),e.select&&e.select(),!0},_focusElement:function(t){if(t&&("touchstart"==t.type||"pointerdown"==t.type||"MSPointerDown"==t.type)){var i=e(t.currentTarget);i.hasClass("e-text")&&this.selectNode(i.closest(".e-item"))}this.element.focus()},_focusout:function(t){var i,s,a=e(t.currentTarget);0==this.getSelectedNode().length&&(s=a.closest(".e-item"),this._isRender=!1,this._nodeSelectionAction(s),this._isRender=!0),i={id:a.closest(".e-item").attr("id"),oldText:this._beforeEditText,newText:a.val()},this._triggerEvent("inlineEditValidation",i)?this._cancelAction(a):this._saveAction(a,t)},_pressEscKey:function(i){var s,a,n;i.cancelBubble=!0,i.returnValue=!1,s=e(i.currentTarget),null!=s[0]&&(13==i.keyCode&&(i.stopPropagation(),this._focusout(i)),27==i.keyCode&&this._cancelAction(s),(13==i.keyCode||27==i.keyCode)&&(a=t.browserInfo(),n="msie"==a.name&&"8.0"==a.version,n&&this.element.focus()))},_onFocusHandler:function(e){e.preventDefault()},_onKeyDown:function(e,t){e.find("> div > .e-text:first").removeClass("e-node-focus"),t.find("> div > .e-text:first").addClass("e-node-focus")},_KeyPress:function(t){var i,s,a,n,o,r,l,d,h,c,u,m,p,g,_,f,b=this;if(_=this.element.is("ul")?this.element:this.element.find("> ul"),i=t.keyCode?t.keyCode:t.which?t.which:t.charCode,b.model.allowKeyboardNavigation&&b.element.find("#Edit_Input").length<1&&b.element.find(".e-chkbox-wrap.e-focus").length<1)if(s=_.find(".e-item > div > .e-text.e-active").closest(".e-item"),a=_.find(".e-item:visible:not(.hidden, .e-node-disable)"),b._focusedNode?(n=b._focusedNode,b._focusedNode=null):n=e(a).find(".e-text.e-node-focus").closest(".e-item"),113==i&&(t.preventDefault(),_=n.length>0?n:s,_.length>0&&b.model.allowEditing&&(t.target=_.find("> div > .e-text:first"),b._inlineEdit(t))),40!=i||t.ctrlKey||t.altKey||t.shiftKey)if(38!=i||t.ctrlKey||t.altKey||t.shiftKey){if(!(39!=i||this.model.enableRTL||t.ctrlKey||t.altKey||t.shiftKey)||37==i&&this.model.enableRTL)if(t.preventDefault(), r=n.length>0?n.find("> div > div").first():s.find("> div > div").first(),o=r.closest(".e-item"),r.hasClass("e-plus"))this.model.loadOnDemand&&0==o.find("> ul .e-item").length?this._ClickEventHandler({target:r[0]}):this._expandNode(e(a[a.index(o)]));else{if(o=e(a[a.index(o)+1]),b._KeyPressEventHandler(o.length>0?o:"",b,i,t))return;(o.length>0&&o[0]==r.closest(".e-item").find("ul > .e-item:first")[0]||o.find("ul > .e-item").first().hasClass("e-node-disable"))&&b._onKeyDown(n,o)}else if(!(37!=i||this.model.enableRTL||t.ctrlKey||t.altKey||t.shiftKey)||39==i&&this.model.enableRTL)if(t.preventDefault(),d=n.length>0?n.find("> div > div").first():s.find("> div > div").first(),l=d.closest(".e-item"),d.hasClass("e-minus"))this._collpaseNode(e(a[a.index(d.closest(".e-item"))]));else{if(l=e(a[a.index(l)]).closest("ul").closest(".e-item"),b._KeyPressEventHandler(l.length>0?l:"",b,i,t))return;l.length>0&&b._onKeyDown(n,l)}else if(36!=i||t.ctrlKey||t.altKey||t.shiftKey){if(35!=i||t.ctrlKey||t.altKey||t.shiftKey){if(13==i)t.preventDefault(),g=n.length>0?n:s,g.find("> div > .e-text").removeClass("e-node-focus"),this._nodeSelectionAction(g);else if(32==i)t.preventDefault(),g=n.length>0?n:s,g.length>0&&this.model.showCheckbox&&(m=g.find("> div > .e-chkbox-wrap > .nodecheckbox:first")[0],m.checked?this._nodeUncheck(m):this._nodeCheck(m));else if(46==i)t.preventDefault(),g=n.length>0?n:s,g.length>0&&this._removeNode(g,t);else if(t&&1==t.ctrlKey)if(88==i&&this.model.allowDragAndDrop&&this.model.allowDropChild){if(t.preventDefault(),g=n.length>0?n:s,g.length>0&&(p=g.parents(".e-item:first"),this._cutNode=e(a[a.index(g)]).detach(),null!=e(this._cutNode)[0])){if(this._triggerEvent("beforeCut",{target:g,nodeDetails:this._getNodeDetails(g),keyCode:i,event:t}))return;this._isRender=!1,this.unselectNode(g),0==p.find("> ul > .e-item").length&&(this.collapseNode(p),this._modifyCss(p)),this._isRender=!0,this._triggerEvent("nodeCut",{parentElement:p,parentDetails:this._getNodeDetails(p),keyCode:i,event:t})}}else if(86==i&&null!=this._cutNode&&this.model.allowDragAndDrop&&this.model.allowDropChild&&(t.preventDefault(),g=n.length>0?n:s,g=e(a[a.index(g)]),0===g.length&&(g=this.element),_=this._cutNode.find(" > div > .e-text").first(),e(a).length>0)){if(this._triggerEvent("beforePaste",{target:g,nodeDetails:this._getNodeDetails(g),keyCode:i,event:t}))return;this._isRender=!1,this._dropAsChildNode(g,_,t),this._isRender=!0,this._cutNode=null,f=_.closest(".e-item"),this._triggerEvent("nodePaste",{target:f,nodeDetails:this._getNodeDetails(f),keyCode:i,event:t})}}else if(t.preventDefault(),u=n.length>0?n:s,c=e(a).last(),s.length>0&&0==n.length&&s[0]!=c[0]||n.length>0&&n[0]!=c[0]){if(b._KeyPressEventHandler(c,b,i,t))return;b._onKeyDown(u,c)}}else if(t.preventDefault(),u=n.length>0?n:s,h=e(a).first(),s.length>0&&0==n.length&&s[0]!=h[0]||n.length>0&&n[0]!=h[0]){if(b._KeyPressEventHandler(h,b,i,t))return;b._onKeyDown(u,h)}}else{if(t.preventDefault(),l=e(n.length>0?a[a.index(n)-1]:a[a.index(s)-1]),b._KeyPressEventHandler(l.length>0?l:null,b,i,t))return;l.length>0&&b._onKeyDown(n,l)}else{if(t.preventDefault(),o=e(n.length>0?a[a.index(n)+1]:a[a.index(s)+1]),b._KeyPressEventHandler(o.length>0?o:null,b,i,t))return;o.length>0&&b._onKeyDown(n,o)}},_removeChildNodes:function(e,i,s){for(var a,n,o=0,r=0;r0){if(d=this,a=i.closest("ul").closest(".e-item"),n=i,this._triggerEvent("beforeDelete",{target:n,nodeDetails:this._getNodeDetails(n),parentElement:null!=a[0]?a:null,parentDetails:this._getNodeDetails(a),event:s}))return;if(this._isRender=!1,!t.isNullOrUndefined(this.dataSource())&&this.dataSource().length>0)for(h=this.dataSource(),l=0;l div > .e-text.e-node-focus"),this._focusedNode=n.closest(".e-item"),n.removeClass("e-node-focus"))},_saveAction:function(t,i){var s=t.val(),a=t.closest(".e-item"),n=t.closest(".e-text")[0];t.remove(),null!=n&&(n.lastChild.nodeValue=s,e(n).removeClass("e-editable"),this._updateField(this._newDataSource,a.attr("id"),this.model.fields.text,s),this._triggerEvent("nodeEdit",{id:a.attr("id"),oldText:this._beforeEditText,newText:s,target:a,nodeDetails:this._getNodeDetails(a),event:i}),this.element.focus())},_cancelAction:function(t){var i=t.closest(".e-text")[0];t.remove(),i.lastChild.nodeValue=this._beforeEditText,e(i).removeClass("e-node-hover e-editable"),0==this.getSelectedNode().length&&(this._isRender=!1,this.selectNode(e(i).closest(".e-item")),this._isRender=!0),this.element.focus()},_mouseEnterEvent:function(t){this.element.find(".e-node-hover").removeClass("e-node-hover"),e(t.currentTarget).hasClass("e-text")&&!e(t.currentTarget).hasClass("e-node-disable")&&e(t.currentTarget).addClass("e-node-hover")},_mouseLeaveEvent:function(t){e(t.currentTarget).removeClass("e-node-hover")},_createObjectByText:function(t,i){if("string"==typeof t){var s={};return s[this.model.fields.id]=t,s[this.model.fields.text]=t,null!=e(i)[0]&&(s[this.model.fields.parentId]=i.attr("id")),s}},_addNodesWhenObject:function(i,s){var a,n,o,r,l,d,h=JSON.stringify(this._dataSource),c=this.dataSource();if(this._dataSource=[],null!=this.dataSource()&&this.dataSource()instanceof t.DataManager&&(c=[]),null!=s[0]&&s.length>0&&(a=s.attr("id")),t.isNullOrUndefined(i.length))this._dataSource.push(i),t.isNullOrUndefined(this.dataSource())||(t.isNullOrUndefined(a)||(i[this.model.fields.parentId]=a),c.push(i));else if(this._dataSource=i,!t.isNullOrUndefined(this.dataSource()))for(o=0;o-1&&(this.model.expandedNodes.splice(e.inArray(t,i),1),0==i.length&&i.push(-1)),this._persistValues(this.model.expandedNodes,"expandedNodes")},_persistValues:function(i,s){var a,n,o,r,l,d,h,c;if(!t.isNullOrUndefined(this.model.fields)&&null!=this.dataSource()){for(a=i,n=[],l=0,d=a.length;l=0&&(o=this._liList[a[l]],r=e(o).attr("id"),r&&n.push(r));h=this._getCookies("_persistedValues"),h&&(c=JSON.parse(h),c[s]="selectedNode"==s?n[0]?n[0]:"":n,this._setCookies("_persistedValues",JSON.stringify(c)))}},_onChecked:function(e,i){var s,a,n,o=e.closest(".e-item");nodeDetails=this._getNodeDetails(o),this._CurrenctSelectedNodes.push(nodeDetails.text),s=this._isChecked(o),a=t.isNullOrUndefined(i)?"":t.isNullOrUndefined(i.event)?"":i.event,n={currentElement:o,id:nodeDetails.id,parentId:nodeDetails.parentId,value:nodeDetails.text,currentNode:this._CurrenctSelectedNodes,currentCheckedNodes:this._checkedArray,isChecked:s,event:a},this._isRender&&this._triggerEvent("nodeCheck",n)},_onUnChecked:function(e,i){var s,a,n,o=e.closest(".e-item");nodeDetails=this._getNodeDetails(o),this._CurrenctSelectedNodes.push(nodeDetails.text),s=this._isChecked(o),a=t.isNullOrUndefined(i)?"":t.isNullOrUndefined(i.event)?"":i.event,n={currentElement:o,id:nodeDetails.id,parentId:nodeDetails.parentId,value:nodeDetails.text,currentNode:nodeDetails.text,currentUncheckedNodes:this._uncheckedArray,isChecked:s,event:a},this._triggerEvent("nodeUncheck",n)},_addCheckNodes:function(e){var t=this.model.checkedNodes;this._removeNullInArray(t),!t instanceof Array&&(t=[]),t.indexOf(e)==-1&&t.push(e)},_removeCheckNodes:function(e){var t,i=this.model.checkedNodes;!i instanceof Array&&(i=[]),t=i.indexOf(e),t!=-1&&(i.splice(t,1),0==i.length&&i.push(-1))},_removeNullInArray:function(e){var t=e.indexOf(-1);t!=-1&&e.splice(t,1)},_afterInsertingNode:function(e){this._addDragableClass(),this._finalizeEditing(e);var t=e.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,s,a){if(s=this._getNodeByID(s),null!=s[0]&&s.is("LI")&&s.hasClass("e-item")){if(this._triggerEvent("beforeAdd",{data:i,targetParent:null!=s[0]?s:null,parentDetails:this._getNodeDetails(s)}))return;if(this._isRender=!1,"object"!=typeof i&&(i=this._createObjectByText(i)),"object"!=typeof i)return;i[this.model.parentId]&&delete i[this.model.parentId],outerLi=this._addNodesWhenObject(i,s),temp=document.createElement("ul"),e(temp).append(outerLi),outerLi=e(temp.children),this.model.showCheckbox&&outerLi.children().find(".nodecheckbox").ejCheckBox({cssClass:this.model.cssClass,change:this._checkedChange}),s.parents(".e-item:first").length>0?s.parents(".e-item:first").append(outerLi):this.element.append(outerLi),this.model.showCheckbox&&this._isCheckedAction(),this._dropAsSublingNode(s,outerLi.find("> div > .e-text"),a,""),this._afterInsertingNode(outerLi),this._isRender=!0,this._triggerEvent("nodeAdd",{data:i,nodes:outerLi,parentElement:null!=s[0]?s:null,parentDetails:this._getNodeDetails(s)});var n=this,o=this.dataSource();setTimeout(function(){null==n.dataSource()||n.dataSource()instanceof t.DataManager||(n._dataSource=n._groupingObjects(o,function(e){return[!t.isNullOrUndefined(e)&&[e[n.model.fields.parentId]].toString()]}))},300)}},_getNodeByID:function(t){return"object"!=typeof t&&""!=t&&(t=this.element.find(".e-item#"+t)),t=e(t),t=e(t[0]),t.is("A")&&t.hasClass("e-text")&&(t=t.closest(".e-item")),t},_isTreeElement:function(t){return null!=e(t)[0]&&t.is("LI")&&t.hasClass("e-item")},_isUrl:function(e){return/(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/.test(e)},_sendAjaxOptions:function(e,t){var i,s,a=this;i=this._getNodeDetails(t),i.mapper=this.model.fields,i.model=this.model,s={url:e,data:i,type:"POST",async:!0,crossDomain:!0,dataType:"JSON",contentType:"application/json; charset=utf-8",success:function(e){try{a._ajaxSuccessHandler(e,t)}catch(e){}},error:function(e){try{a._ajaxErrorHandler(e)}catch(e){}}},this._sendAjaxRequest(s)},_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,e.extend(t,i),e.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(e,t){this._isRender=!1,"object"==typeof e&&this.addNode(e,t),this._isRender=!0,this._triggerEvent("loadSuccess",{data:e,targetParent:t,parentDetails:this._getNodeDetails(t)})},_ajaxErrorHandler:function(e){this._triggerEvent("loadError",{error:e})},_wireEvents:function(){this._on(this.element,"click",this._ClickEventHandler)._on(this.element.find(".e-text"),"mouseenter",this._mouseEnterEvent)._on(this.element.find(".e-text"),"mouseleave",this._mouseLeaveEvent)._on(this.element,this.model.expandOn,this._expandEventHandler)._on(this.element,"focus",this._onFocusHandler),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,"click")._off(this.element.find(".e-text"),"mouseenter")._off(this.element.find(".e-text"),"mouseleave")._off(this.element,this.model.expandOn)._off(this.element,"focus"),this._preventEditable(),this._preventDraggable(),this.model.allowKeyboardNavigation&&this._off(this.element,"keydown"),this.model.showCheckbox&&this.element.find(".nodecheckbox").ejCheckBox("disable")},_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(e(document),"click",this._documentClick)._on(this.element.find(".e-item > div > .e-text"),"dblclick",this._inlineEdit))},_preventEditable:function(){this.element.find(".e-item").removeClass("AllowEdit"),this._off(e(document),"click")._off(this.element.find(".e-item > div > .e-text"),"dblclick")},_preventDraggable:function(){this.element.find(".e-draggable, .e-droppable").removeClass("e-draggable e-droppable"),this._preventDropSibling(),this._preventDropChild(),this._off(this._anchors,"mouseup touchstart pointerdown MSPointerDown",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")},refresh:function(){this._unWireEvents(),this.element.html(""),this._init()},expandAll:function(){this.model.enableMultipleExpand&&this._expandAll()},collapseAll:function(){this.model.enableMultipleExpand&&this._collapseAll()},checkAll:function(){this.model.showCheckbox&&this._checkAll()},unCheckAll:function(){this.model.showCheckbox&&this._uncheckAll()},selectNode:function(e){e=this._getNodeByID(e),this._isTreeElement(e)&&this._nodeSelectionAction(e)},unselectNode:function(e){e=this._getNodeByID(e),this._isTreeElement(e)&&this._nodeUnSelectionAction(e)},enableNode:function(e){e=this._getNodeByID(e),this._isTreeElement(e)&&this._nodeEnableAction(e)},disableNode:function(e){e=this._getNodeByID(e),this._isTreeElement(e)&&this._nodeDisableAction(e)},addNodes:function(e,t){if(e&&"object"==typeof e&&e.length>0)for(var i=0;i div > .e-minus").length>0&&!this.model.enableMultipleExpand&&this._denyMultipleExpand(l),this._updateNodes(),this._afterInsertingNode(d),this._isRender=!0,this._triggerEvent("nodeAdd",{data:i,nodes:d,parentElement:null!=l[0]?l:null,parentDetails:this._getNodeDetails(l)}),a=this,n=this.dataSource(),setTimeout(function(){null==a.dataSource()||a.dataSource()instanceof t.DataManager||(a._dataSource=a._groupingObjects(n,function(e){return[!t.isNullOrUndefined(e)&&[e[a.model.fields.parentId]].toString()]}))},300))}},removeNode:function(e){e=e?this._getNodeByID(e):this.getSelectedNode(),this._isTreeElement(e)&&this._removeNode(e)},removeAll:function(){this._liList.remove(),this._updateNodes()},checkNode:function(e){e=this._getNodeByID(e),this._isTreeElement(e)&&this._nodeCheck(e.find("> div > .e-chkbox-wrap > .nodecheckbox:first")[0])},uncheckNode:function(e){e=this._getNodeByID(e),this._isTreeElement(e)&&this._nodeUncheck(e.find("> div > .e-chkbox-wrap > .nodecheckbox:first")[0])},expandNode:function(e){e=this._getNodeByID(e),this._isTreeElement(e)&&(this._allowOnDemand=!0,this._expandNode(e),this._allowOnDemand=!1)},collapseNode:function(e){e=this._getNodeByID(e),this._isTreeElement(e)&&this._collpaseNode(e)},showNode:function(e){e=this._getNodeByID(e),this._isTreeElement(e)&&e.css("visibility","").removeClass("hidden")},hideNode:function(e){e=this._getNodeByID(e),this._isTreeElement(e)&&e.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(e){return e=this._getNodeByID(e),this._isTreeElement(e)?e.find("> ul > .e-item").length>0:void 0},isChildLoaded:function(e){return e=this._getNodeByID(e),!!(this._isTreeElement(e)&&e.find("ul > .e-item").length>0)},isNodeChecked:function(e){return e=this._getNodeByID(e),this._isTreeElement(e)?this._isChecked(e):void 0},isExpanded:function(e){return e=this._getNodeByID(e),this._isTreeElement(e)?this._isNodeExpanded(e):void 0},isVisible:function(e){return e=this._getNodeByID(e),!(!this._isTreeElement(e)||"hidden"==e.css("visibility"))},isExist:function(e){return e=this._getNodeByID(e),!(!this._isTreeElement(e)||this._liList.index(e)==-1)},isSelected:function(e){return e=this._getNodeByID(e),this._isTreeElement(e)?e.find("> div > .e-text").hasClass("e-active"):void 0},isDisabled:function(e){return e=this._getNodeByID(e),!(!this._isTreeElement(e)||!e.hasClass("e-node-disable"))},getTreeData:function(){if(!(t.isNullOrUndefined(this.model.fields)||null==this.dataSource()||this.dataSource()instanceof t.DataManager))return this._orderDataSource()},getText:function(t){return t=this._getNodeByID(t),this._isTreeElement(t)?e.trim(this.element.find(t).find("> div > .e-text").text()):void 0},getSelectedNode: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(){for(var e=this.getExpandedNodes(),t=[],i=0,s=e.length;i .e-text")[0];if(null!=o){if(n={currentElement:e(o)},this._triggerEvent("beforeEdit",n))return!1;a=o.lastChild.nodeValue}o.lastChild.nodeValue=s,this._updateField(this._newDataSource,i.attr("id"),this.model.fields.text,s),this._triggerEvent("nodeEdit",{id:i.attr("id"),oldText:a,newText:s,target:i,nodeDetails:this._getNodeDetails(i),event:null})}},insertAfter:function(e,t){this._insertBeforeOrAfter(e,t,!1)},insertBefore:function(e,t){this._insertBeforeOrAfter(e,t,!0)},moveNode:function(e,i,s){if(e=this._getNodeByID(e),i=this._getNodeByID(i),this._isTreeElement(e)){if(e.parents(".e-item")[0]==i[0]&&t.isNullOrUndefined(s)||i.find(e).index()==s||null==i[0]&&this._liList.index(e)==s)return;var a=null!=i[0]&&s>=0?i.find("> ul > .e-item").eq(s):this.getNodeByIndex(s);this._isRender=!1,this._isTreeElement(a)?a.parents(".e-item:first")[0]==e.parents(".e-item:first")[0]&&null==a.next(".e-item")[0]?this._dropAsSublingNode(a,e.find(" > div > .e-text"),!1,""):this._dropAsSublingNode(a,e.find(" > div > .e-text"),!0,""):this._dropAsChildNode(i,e.find(" > div > .e-text"),""),i.length>0&&i.hasClass("e-node-disable")&&this._nodeDisableAction(i),this._isRender=!0}},loadData:function(e,t){t=this._getNodeByID(t),this._isUrl(e)&&(null==t[0]||this._isTreeElement(t))&&this._sendAjaxOptions(e,t)},ensureVisible:function(t){var i,s,a,n;if(t=this._getNodeByID(t),this._isTreeElement(t)&&!this.isDisabled(t)&&this.isVisible(t)){for(i=t.parents(".e-item"),a=0,n=i.length;a div > .e-text").addClass("e-node-hover"),s=t.offset(),t.animate({scrollTop:s.top},this.model.enableAnimation?350:0,"linear",function(){t[0].scrollIntoView(!1)}),!0}return!1},_triggerEvent:function(e,t){if(this._isRender)return this._trigger(e,t)}})}(jQuery,Syncfusion),function(e,t,s){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,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?e(this.control).removeClass("e-disable"):e(this.control).addClass("e-disable"),this.model.enabled=t,e(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())},_init:function(){this.s=t.browserInfo(),this._initialize(),this._wireEvents(),this.model.asyncUpload||this._initObjectsSyncUpload(),this._controlStatus(this.model.enabled),"en-US"==this.model.locale?this._buttonText(this.model.buttonText):this._setLocale(),this._roundedCorner(this.model.showRoundedCorner)},_setModel:function(e){for(var t in e){switch(t){case"buttonText":this._buttonText(e[t]);break;case"htmlAttributes":this._addAttr(e[t]);break;case"dialogText":this._dialogText(e[t]);break;case"cssClass":this._setSkin(e[t]);break;case"enableRTL":this._setRTL(e[t]);break;case"enabled":this._controlStatus(e[t]);break;case"locale":this.model.locale=e[t],this._setLocale();break;case"height":this.model.height=e[t],this._setHeight(this.model.height);break;case"width":this.model.width=e[t],this._setWidth(this.model.width);break;case"dialogPosition":this.model.dialogPosition=e[t],this._dialogPosition();break;case"allowDragAndDrop":this.model.allowDragAndDrop=e[t],this._dragAndDrop();break;case"dropAreaText":this.model.dropAreaText=e[t],this._dropAreaText(this.model.dropAreaText);break;case"showBrowseButton":this.model.showBrowseButton=e[t],this._hideBrowseButton(),this._refreshUploadDialogParent();break;case"showRoundedCorner":this._roundedCorner(e[t]);break;case"dropAreaHeight":this.model.dropAreaHeight=e[t],this._setSize();break;case"dropAreaWidth":this.model.dropAreaWidth=e[t],this._setSize();break;case"pushFile":this.model.pushFile=e[t],null!=this.model.pushFile&&"Xhr"==this.UploadType&&this.model.asyncUpload&&(this._files=this.model.pushFile),this._onXhrSelect();break;case"multipleFilesSelection":this.model.multipleFilesSelection=e[t],this.model.multipleFilesSelection?this._currentElement.find(".e-uploadinput").attr("multiple","multiple"):this._currentElement.find(".e-uploadinput").removeAttr("multiple");break;case"uploadName":this.model.uploadName=e[t],this.inputupload.attr("name",this.model.uploadName),this.refresh();break;case"autoUpload":this.model.autoUpload=e[t];break;case"showFileDetails":this.model.showFileDetails=e[t],this.refresh();break;case"fileSize":this.model.fileSize=e[t];break;case"extensionsAllow":this.model.extensionsAllow=e[t],this._currentElement.find(".e-uploadinput").attr("accept",e[t]);break;case"extensionsDeny":this.model.extensionsDeny=e[t];break;case"saveUrl":this.model.saveUrl=e[t];break;case"removeUrl":this.model.removeUrl=e[t]}this._currentElement=this.model.allowDragAndDrop&&!this.model.showBrowseButton?this.dragWrapper:this.element}},_controlStatus:function(e){1!=e?this.disable():this.enable()},_setRTL:function(e){e?this._currentElement.addClass("e-rtl"):this._currentElement.removeClass("e-rtl"),this.updialog&&this.updialog.ejDialog({enableRTL:e})},_getLocalizedLabels:function(e){var i;return i="browse"==e||"upload"==e||"cancel"==e||"close"==e?"buttonText":"dialogText",t.Uploadbox.Locale[this.model.locale]===s||t.Uploadbox.Locale[this.model.locale][e]===s?t.Uploadbox.Locale[this.model.locale][i][e]:t.Uploadbox.Locale[this.model.locale][e]},_setLocale:function(){this._buttonText(t.Uploadbox.Locale[this.model.locale].buttonText),this._dialogText(t.Uploadbox.Locale[this.model.locale].dialogText),this._dropAreaText(t.Uploadbox.Locale[this.model.locale].dropAreaText)},_buttonText:function(t){e.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){e.extend(this.model.dialogText,t),this.diaObj==s||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(),e(this.dragWrapper).after(this._currentElement),this._bindResizeHandler(!1),this.dragWrapper.remove())},_setSkin:function(e){this._currentElement.removeClass(this.model.cssClass),this._currentElement.addClass(e),this.diaObj&&this.diaObj.setModel({cssClass:this.model.cssClass})},_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&&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.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:null!=this.model.dialogAction.content&&""!=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;e.map(t,function(e,t){"class"==t?i.element.addClass(e):"disabled"==t&&"disabled"==e?i.disable():i.element.attr(t,e)})},_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("en-US"==this.model.locale?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&&(e(window).width()>750?(e(this.updialog).closest(".e-dialog.e-uploadbox").removeClass("e-mobile-upload"),this.diaObj.setModel({width:this._getDialogContentWidth(),height:"auto"})):(e(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 e=0;return this.model.customFileDetails.name&&(e+=200),this.model.customFileDetails.size&&(e+=100),this.model.customFileDetails.status?e+=200:this.model.customFileDetails.action&&(e+=45),e+5},_dropAreaText:function(e){this.model.allowDragAndDrop&&this._spanTag.html(e)},_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(e){this.element.css("width",e)},_setHeight:function(e){this.element.height(e)},_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()-e(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"))+e(this.diaObj.model.content).outerHeight()}""!=this.model.dialogPosition.X&&""!=this.model.dialogPosition.Y&&this.diaObj.setModel({position:this.model.dialogPosition})}},_roundedCorner:function(e){e?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?e(window).bind("resize",e.proxy(this._resizeHandler,this)):e(window).unbind("resize",e.proxy(this._resizeHandler,this))},_keydownselect:function(e){this.element.hasClass("e-disable")||13!=e.keyCode||this.diaObj&&this.diaObj.isOpened()||this.element.find(".e-uploadinput").click()},_onDropHandler:function(e){return!("msie"===t.browserInfo().name&&"8.0"===t.browserInfo().version||"9.0"===t.browserInfo().version||this._currentElement.hasClass("e-disable"))&&(e.stopPropagation(),e.preventDefault(),this._files=this._getAllFileInfo(e.originalEvent.dataTransfer.files),void this._fileSelect(e))},_onDragOverHandler:function(e){return!this._currentElement.hasClass("e-disable")&&(e.stopPropagation(),void e.preventDefault())},_disableclickselect:function(e){this._currentElement.hasClass("e-disable")&&e.preventDefault()},_bindInputChangeEvent:function(){this._on(this.inputupload,"change",this._inputValueChange)},_inputValueChange:function(t){return this._files=this._getInputFileInfo(e(t.target)),this._fileSelect(t)},_fileSelect:function(e){return this._trigger("fileSelect",{files:this._files})?(this._resetFileInput(this._currentElement.find(".e-uploadinput")),!1):void this._fileUpload(e)},_fileUpload:function(e){var t=this._isAllowed(this._files);this._files=t.files,this.model.asyncUpload?null!=t.files&&t.files.length>0&&("Xhr"==this.UploadType?this._onXhrSelect(e):this._onSelectIFrame(e),this._resetFileInput(this._currentElement.find(".e-uploadinput"))):t.status&&this._onSelectSyncUpload(e)},__uploadButtonClick:function(t){if(!this._currentElement.hasClass("e-disable")){this._currentElement.find(".e-uploadbtn");this._currentElement.find(".e-uploadbtn").hasClass("e-disable")?t.preventDefault():"Xhr"==this.UploadType?this._xhrOnUploadButtonClick(t):this._onUploadButtonClickIFrame(t),e(t.target).attr("disabled","disabled").addClass("e-disable")}},_actionClick:function(t){var i,s,a;this._currentElement.hasClass("e-disable")||(i=e(t.target),s=i.closest(".e-upload-file"),this._file=e(s).data("file"),i.hasClass("e-file-delete")?"Xhr"==this.UploadType?this._xhrOnRemove(t,s):this._onRemoveIFrame(t,s):i.hasClass("e-file-cancel")?(this._trigger("cancel",{fileStatus:this._file}),a=this.updialog.find(".e-file-cancel"),a.hasClass("e-disable")?t.preventDefault():this.model.asyncUpload?(this._removeFile(e(s).data("file")),"Xhr"==this.UploadType?this._xhrOnCancel(t,s):this._onCancelIFrame(t,s)):this._onCancelSyncUpload(t,s)):i.hasClass("e-file-retry")&&("Xhr"==this.UploadType?this._xhrOnRetry(t,s):this._onRetryIFrame(t,s)))},_removeFileEntry:function(e){e.remove()},_removeFile:function(e){for(var t=[],i=0;i
    "),c=e("
    "+this._getLocalizedLabels("name")+"
    "),u=e("
    "+this._getLocalizedLabels("size")+"
    "),m=e("
    "+this._getLocalizedLabels("status")+"
    "),this.model.customFileDetails.name&&e(c).appendTo(d),this.model.customFileDetails.size&&e(u).appendTo(d),this.model.customFileDetails.status&&e(m).appendTo(d),filedialog=this.updialog,filedialog&&0!=filedialog.length?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)),a=this.updialog.find(".e-ul"),e(this.updialog.find(".e-head-content"))&&e(this.updialog.find(".e-head-content")).replaceWith(d),0==a.length&&(d.appendTo(this.updialog),a=t.buildTag("ul.e-ul").appendTo(this.updialog)),e(this.updialog).find(".e-file-upload").length>0&&e(this.updialog).find(".e-file-upload").remove(),fileListActions=t.buildTag("div.e-file-upload").appendTo(this.updialog).append(this.model.autoUpload||!this.model.asyncUpload?e(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(e(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),p=null!=this.model.dialogAction.content&&""!=this.model.dialogAction.content?this.model.dialogAction.content:DialogContentContainer,this.updialog.ejDialog({showOnInit:!1,closeIconTooltip:this._getLocalizedLabels("closeToolTip"),minWidth:240,width:e(window).width()<750?250:this._getDialogContentWidth(),height:"auto",cssClass:"e-uploadbox "+this.model.cssClass,close:e.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,showHeader:this.model.customFileDetails.title}),e(window).width()<750?e(this.updialog).closest(".e-dialog.e-uploadbox").addClass("e-mobile-upload"):e(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(),r=0;r").appendTo(a).data(s),addedlist=e("
    "),addedfilename=e("
    "+i[r].name+"
    "),h="
    "+this._formatSize(i[r].size)+"
    ",addedfilestatus=e("
    "),addedfileaction=e("
    "),this.model.customFileDetails.name&&e(addedfilename).appendTo(addedlist),this.model.customFileDetails.size&&(0==this._getFileSize(i[r]).toString().toLowerCase().match("0.0kb").length||null!=i[r].size?e(h).appendTo(addedlist):e(this.updialog).find(".e-head-size").remove()),this.model.customFileDetails.status&&e(addedfilestatus).appendTo(addedlist),this.model.customFileDetails.action&&(e(addedfileaction).appendTo(addedlist),l="cancel",addedlist.find(".e-icon").remove().addClass(l.toString()),"cancel"==l?o=t.buildTag("div.e-icon e-file-cancel","",{},{title:this._getLocalizedLabels("cancelToolTip")}):"remove"==l?o=t.buildTag("div.e-icon e-file-delete","",{},{title:this._getLocalizedLabels("removeToolTip")}):"retry"==l&&(o=t.buildTag("div.e-icon e-file-retry","",{},{title:this._getLocalizedLabels("retryToolTip")})),addedlist.find(".e-action-perform").append(o),this._on(o,"click",this._actionClick)),e(addedlist).appendTo(n);return this.model.showFileDetails&&this.diaObj.open(),this._buttonText(this.model.buttonText),this._dialogText(this.model.dialogText),n},_keydownDialogClose:function(e){this._currentElement.hasClass("e-disable")||13==e.keyCode&&this._dialogclose()},_pushFileDetails:function(i){var s,a,n,o,r,l,d,h,c,u,m,p,g;return n=e("
    "),o=e("
    "+this._getLocalizedLabels("name")+"
    "),r=e("
    "+this._getLocalizedLabels("size")+"
    "),l=e("
    "+this._getLocalizedLabels("status")+"
    "),this.model.customFileDetails.name&&e(o).appendTo(n),this.model.customFileDetails.size&&e(r).appendTo(n),this.model.customFileDetails.status&&e(l).appendTo(n),s=this,filedialog=this.updialog,filedialog&&0!=filedialog.length?this.model.showFileDetails&&(this.updialog&&this.updialog.find(".e-uploadbtn").removeAttr("disabled").removeClass("e-disable"),s.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)),m=this.updialog.find(".e-ul"),e(this.updialog.find(".e-head-content"))&&e(this.updialog.find(".e-head-content")).replaceWith(n),0==m.length&&(n.appendTo(this.updialog),m=t.buildTag("ul.e-ul").appendTo(this.updialog)),e(this.updialog).find(".e-file-upload").length>0&&e(this.updialog).find(".e-file-upload").remove(),fileListActions=t.buildTag("div.e-file-upload").appendTo(this.updialog).append(this.model.autoUpload||!this.model.asyncUpload?e(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(e(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(),p=e("
  • ").appendTo(m).data("file",i),a=e("
    "),d=e("
    "+i.name+"
    "),c=e("
    "+this._formatSize(0)+"\\"+this._formatSize(i.size)+"
    "),h=e("
    "),u=e("
    "),this.model.customFileDetails.name&&e(d).appendTo(a),this.model.customFileDetails.size&&e(c).appendTo(a),this.model.customFileDetails.status&&e(h).appendTo(a),this.model.customFileDetails.action&&e(u).appendTo(a),e(a).appendTo(p),g=null!=this.model.dialogAction.content&&""!=this.model.dialogAction.content?this.model.dialogAction.content:DialogContentContainer,this.updialog.ejDialog({showOnInit:!1,closeIconTooltip:this._getLocalizedLabels("closeToolTip"),minWidth:240,width:e(window).width()<750?250:this._getDialogContentWidth(),height:"auto",cssClass:"e-uploadbox "+this.model.cssClass,close:e.proxy(this._uploadFileListDelete,this),enableRTL:this.model.enableRTL,target:g,enableResize:!1,allowDraggable:this.model.dialogAction.drag,enableModal:!!this.model.asyncUpload&&this.model.dialogAction.modal,showHeader:this.model.customFileDetails.title}),e(window).width()<750?e(this.updialog).closest(".e-dialog.e-uploadbox").addClass("e-mobile-upload"):e(this.updialog).closest(".e-dialog.e-uploadbox").removeClass("e-mobile-upload"),s.diaObj=this.updialog.data("ejDialog"),""!=s.model.cssClass&&s.diaObj.setModel({cssClass:this.model.cssClass}),s._dialogPosition(),this.model.showFileDetails&&s.diaObj.open(),this._buttonText(this.model.buttonText),this._dialogText(this.model.dialogText),p},_setProgress:function(t,i,s){var a,n,o,r;this.model.customFileDetails.status&&(a=e(t).find(".e-file-progress-status"),a.width(i+"%")),this.model.customFileDetails.size&&(n=e(t).find(".e-file-size .e-file-name-txt"),o=this._formatSize(s.loaded),r=this._formatSize(s.total),n.html(o+"\\"+r))},_setAction:function(e,i){if(this.model.customFileDetails.action){var s;e.find(".e-icon").remove().addClass(i.toString()),"cancel"==i?s=t.buildTag("div.e-icon e-file-cancel","",{},{title:this._getLocalizedLabels("cancelToolTip")}):"remove"==i?s=t.buildTag("div.e-icon e-file-delete","",{},{title:this._getLocalizedLabels("removeToolTip")}):"retry"==i&&(s=t.buildTag("div.e-icon e-file-retry","",{},{title:this._getLocalizedLabels("retryToolTip")})),e.find(".e-action-perform").append(s),this._on(s,"click",this._actionClick)}},_setStatus:function(e,i){if(this.model.customFileDetails.status){var s,a=t.buildTag("div");"success"==i&&(e.find(".file-status").addClass("e-file-status-success").html("Completed"),e.find(".e-file-percentage").html("").attr("title",this._getLocalizedLabels("completedToolTip")),a.addClass("e-icon e-file-percentage-success"),e.find(".e-file-percentage").append(a)),"failed"==i&&(e.find(".file-status").addClass("e-file-status-failed").html("Failed"),e.find(".e-file-percentage").html("").attr("title",this._getLocalizedLabels("failedToolTip")),a.addClass("e-icon e-file-percentage-failed"),e.find(".e-file-percentage").append(a)),"progress"==i&&e.find(".file-status").addClass("file-status-inprogress").html("in progress"),"uploading"==i&&(e.find(".file-status").addClass("file-status-inprogress").html("uploading"),s=e.find(".e-file-percentage"),s.html(""))}},_createInputandBind:function(){var e=t.buildTag("input","",{},{type:"file","data-role":"none"});e.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&&e.attr("multiple","multiple"),e.appendTo(this.element.find(".e-selectpart")),this.inputupload=e,this._bindInputChangeEvent()},_showUploadButton:function(){var i=this.updialog.find(".e-uploadbtn");0==i.length&&(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),e(i).focus()),this._buttonText(this.model.buttonText)},_keydownUpload:function(e){13==e.keyCode&&this.__uploadButtonClick(e)},_resetFileInput:function(e){var t=e.clone(!1,!1);this._on(t,"change",this._inputValueChange),e.replaceWith(t)},_isAllowed:function(t){var i,s,a,n,o,r,l=this,d=[],h=[],c=!0;return i=this.element.find(".e-uploadinput"),s=this,""!=this.model.extensionsAllow?(n=this.model.extensionsAllow.replace(/\s/g,"").toLowerCase().split(","),e(t).each(function(){e.inArray(this.extension.toLowerCase(),n)==-1?(a={action:"Files Processing",error:l._getLocalizedLabels("allowError").replace("#Extension",n),files:this},s._trigger("error",a),l._resetFileInput(i),c=!1):""!=this.extension&&d.push(this)})):""!=this.model.extensionsDeny?(r=this.model.extensionsDeny.replace(/\s/g,"").toLowerCase().split(","),e(t).each(function(){e.inArray(this.extension.toLowerCase(),r)!=-1?(a={action:"Files Processing",error:l._getLocalizedLabels("denyError").replace("#Extension",r),files:this},s._trigger("error",a),l._resetFileInput(i),c=!1):""!=this.extension&&d.push(this)})):e(t).each(function(){""!=this.extension&&d.push(this)}),""!=this.model.fileSize?(o=this.model.fileSize,e(d).each(function(){this.size>o?(a={action:"Files Processing",error:l._getLocalizedLabels("filedetail"),files:this},s._trigger("error",a),l._resetFileInput(i),c=!1):h.push(this)})):h=d,{files:h,status:c}},_fileListRemove:function(){fileList=this.updialog.find(".e-upload-file .e-file-delete"),0==fileList.length&&(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"),0==fileList.length&&(this.updialog.find(".e-ul").empty(),this.updialog.find(".e-uploadbtn").attr("disabled","disabled").addClass("e-disable"),this.updialog.ejDialog("close"))},_onBeforeClose:function(i){t.isNullOrUndefined(i.event)||(i.cancel=!!e(i.event.currentTarget).hasClass("e-disable"))},_dialogclose:function(t){if(!this._currentElement.hasClass("e-disable")){var i,s,a=this.updialog.find(".e-uploadclosebtn");s=this.updialog.find(".e-ul").children().first(),i=e(s).data("file"),a.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._resetFileInput(this._currentElement.find(".e-uploadinput")),this.model.asyncUpload||this._formResetSyncUpload()},_onXhrSelect:function(){var t,i;this._xhrBeforeUpload(this._files),t=this,e.each(t._files,function(s,a){i=e(a).data("filelist"),t._setAction(i,"cancel"),t.model.autoUpload?t._xhrPerformUpload(a):t._showUploadButton()})},_xhrBeforeUpload:function(t){var i,s,a,n;return i=t,s=this,e.each(i,function(t,i){a=s._createFormObjectXhr(i),e(i).data("formobject",a),n=s._pushFileDetails(i),e(i).data("filelist",n)}),i},_xhrPerformUpload:function(t){var i,a,n,o,r;return o=new XMLHttpRequest,a=this,r={files:t},this._trigger("begin",r)?(e(t).data("xhr",o),void a._onRequestError(a,s,t)):(i=this.model.saveUrl,n=e(t).data("formobject"),n.append((this.model.uploadName&&""!=this.model.uploadName?this.model.uploadName:this.control.id)+"_data",JSON.stringify(r.data)),e(t).data("xhr",o),o.addEventListener("load",function(e){a._onRequestSuccess(a,e,t)},!1),o.addEventListener("error",function(e){a._onRequestError(a,e,t)},!1),o.upload.addEventListener("progress",function(e){a._onRequestProgress(a,e,t)},!1),o.open("POST",i),r={files:t,xhr:o},this._trigger("beforeSend",r)?(e(t).data("xhr",o),void a._onRequestError(a,s,t)):void o.send(n))},_xhrOnUploadButtonClick:function(){var t,s,a,n;for(t=this.model.showBrowseButton?this.diaObj.wrapper:this.dragWrapper,n=t.find(".e-ul li.e-upload-file"),i=0;i=200&&a.status<=299?t._onXhrUploadSuccess(t,i,s):t._onRequestError(t,i,s)},_onXhrUploadSuccess:function(t,i,s){var a,n,o,r,l,d,h;a=e(s).data("filelist"),n=e(s).data("xhr"),t.model.removeUrl?(t._setAction(a,"remove"),t._setStatus(a,"success")):(a.find(".e-icon").remove(),t._setStatus(a,"success")),e(s).length>0&&(o=e(a).find(".e-file-progress-status"),o.width("100%"),r=e(s)[0].size,l=this._formatSize(r),d=e(a).find(".e-file-size .e-file-name-txt"),d.html(l+"\\"+l)),h={files:s,responseText:n.responseText,xhr:n,e:i},this.updialog.find(".e-file-upload .e-uploadclosebtn").html(this.model.buttonText.close).focus(),t._trigger("success",h),this._successFiles.push(s),t._files.length==this._successFiles.length&&(h={files:s,responseText:n.responseText,success:this._successFiles,xhr:n,e:i},t._trigger("complete",h),this._successFiles.length=0,this.model.dialogAction.closeOnComplete&&this._dialogclose())},_onRequestError:function(t,i,s){var a,n,o;a=e(s).data("filelist"),n=e(s).data("xhr"),t._setAction(a,"retry"),t._setStatus(a,"failed"),o={action:"File Processing",error:n.status?n.status+" "+n.statusText:"Unable to reach the server.",files:s,xhr:n,e:i},t._trigger("error",o)},_onRequestProgress:function(t,i,s){var a,n,o;a=Math.round(100*i.loaded/i.total),n=e(s).data("filelist"),t._setProgress(n,a,i),t._setStatus(n,"progress"),o={file:s,percentage:a,e:i},this._trigger("inProgress",o)},_createFormObjectXhr:function(e){var t=new FormData;return t.append(""!=this.model.uploadName?this.model.uploadName:this.control.id,e.rawFile),t},_getInputFileInfo:function(e){var t=e[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(e){var t,i;t=null,i=null;try{t=new ActiveXObject("Scripting.FileSystemObject")}catch(e){i=null}return t&&(i=t.getFile(e).size),i},_getFileExtensionType:function(e){return e.match&&e.match(/\.([^\.]+)$/)?e.match(/\.([^\.]+)$/)[0]:""},_getAllFileInfo:function(t){var i=this;return e.map(t,function(e){return i._getFileInfo(e||t)})},_GetName:function(e){var t=e.lastIndexOf("\\");return t!=-1?e.substr(t+1):e},_getFileInfo:function(e){var t=e.name||e.fileName||e;return{name:t,extension:this._getFileExtensionType(t),size:e.size||e.fileSize,rawFile:e}},_formatSize:function(e){var t=-1;if(!e)return"0.0KB";do e/=1024,t++;while(e>99);return Math.max(e,0).toFixed(1)+["KB","MB","GB","TB","PB","EB"][t]},_onSelectIFrame:function(t){var i,s,a,n;i=e(t.target),s=this._getInputFileInfo(i),a=this._beforeUploadIFrame(s),n=a.data("iframe"),this.model.autoUpload?this._performUploadIFrame(a):this._showUploadButton(),this._off(this.inputupload,"change"),this._bindInputChangeEvent()},_onRemoveIFrame:function(t,i){var s,a,n,o;s=i.data("iframe"),o=e(i).data("file"),a=o[0].name,n=this,s?(this._removeFileEntry(i),this.model.removeUrl&&e.ajax({url:this.model.removeUrl,type:"POST",data:"fileNames="+a,success:function(){n._fileListRemove(),n._trigger("remove",{fileStatus:n._file})}})):(this._removeFileEntry(i),this._trigger("remove",{fileStatus:this._file}))},_onCancelIFrame:function(e,t){var i;this._trigger("cancel",{Status:t}),i=t.data("iframe"),i&&(this._removeFileEntry(t),"undefined"!=typeof i.stop?i.stop():i.document&&(i.document.execCommand("Stop"),i.contentWindow.location.href=i.contentWindow.location.href),this._processServerResponse(i,"")),this._uploadHide()},_onRetryIFrame:function(e,t){this._performUploadIFrame(t)},_beforeUploadIFrame:function(e){var t,i,s;return t=this._createFrame(this.control.id+"_Iframe"+this.Uploadframes.length),this.Uploadframes.push(t),i=this._createForm(this.model.saveUrl,t[0].id),this._currentElement.find("input.e-uploadinput").removeClass("e-uploadinput").css("display","none").appendTo(i),this._createInputandBind(),s=this._pushFile(e,{iframe:t,form:i,file:e}),t.data({filelist:s}),this._setAction(s,"cancel"),s},_performUploadIFrame:function(t){var i,s,a,n,o;return n={files:t},this._trigger("begin",n)?void this._failureIframeUpload(t,"File upload has been denied"):(i=t.data("file"),this._setStatus(t,"uploading"),s=t.data("iframe"),a=t.data("form"),o=e("").attr("name",(this.model.uploadName&&""!=this.model.uploadName?this.model.uploadName:this.control.id)+"_data").attr("type","hidden").val(JSON.stringify(n.data)),a.append(o),s.appendTo(document.body),a.appendTo(document.body),this._on(s,"load",this._removeFramesIFrame),void a.submit())},_onUploadButtonClickIFrame:function(){var t,i,s;t=this,e(".e-ul li.e-upload-file",t.updialog).each(function(){i=e(this),s=t._isFileUpload(i),s&&t._performUploadIFrame(i)})},_removeFramesIFrame:function(t){var i,s,a;i=e(t.target),a=i.data("filelist");try{s=e.trim(i.context.contentDocument.body.innerText.replace(/\n|\r/g," "))}catch(e){s="Server Error trying to get server response: "+e}"Server Error"!=s.substring(0,12)&&0!=s.indexOf("HTTP Error")?(this._processServerResponse(i,s),this._setIframeProgress(a,100,t),this._setStatus(a,"progress"),this._successIframeUpload(a,s)):this._failureIframeUpload(a,s)},_setIframeProgress:function(t,i){var s;s=e(t).find(".e-file-progress-status"),s.width(i+"%")},_successIframeUpload:function(e,t){fileEntry=e.data("file"),this.model.removeUrl?(this._setAction(e,"remove"),this._setStatus(e,"success")):(e.find(".file-action").remove(),this._setStatus(e,"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),e.length==this._successFiles.length&&(args={files:fileEntry,responseText:t,success:this._successFiles},this._trigger("complete",args),this._successFiles.length=0,this.model.dialogAction.closeOnComplete&&this._dialogclose())},_failureIframeUpload:function(e,t){fileEntry=e.data("file"),this.model.saveUrl&&"File upload has been denied"!=t?(this._setAction(e,"retry"),this._setStatus(e,"failed")):(e.find(".file-action").remove(),this._setStatus(e,"failed")),args=0==t.indexOf("HTTP Error")?{files:fileEntry,responseText:t,status:t.match(/\d+/).toString()}:{files:fileEntry,responseText:t},this._trigger("error",args)},_processServerResponse:function(t){var i;i=e(document.body).find("form[target='"+e(t).attr("id")+"']"),setTimeout(function(){i.remove(),t.remove()},0)},_createDivBlock:function(e){return t.buildTag("div."+e)},_createForm:function(e,i){return t.buildTag("form","",{},{enctype:"multipart/form-data",method:"POST",action:e,target:i})},_createFrame:function(e){return t.buildTag("iframe#"+e,"",{display:"none"},{name:e})},_createInput:function(e){return t.buildTag("input","",{},{type:"file",name:e,"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(e(t),"submit",this._formSubmitSyncUpload),this._on(e(t),"reset",this._formResetSyncUpload)},_onSelectSyncUpload:function(t){var i,s,a;i=e(t.target),s=e(".e-selectpart",this.control),this._currentElement.find("input.e-uploadinput").removeClass("e-uploadinput").css("display","none").appendTo(s),this._createInputandBind(),a=this._pushFile(this._files,{file:this._files,Input:i})},_onCancelSyncUpload:function(e,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=e(".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(){e(".e-selectpart",this.control).children('input[type="file"]').each(function(){e(this).hasClass("e-uploadinput")||e(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 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"}}(jQuery,Syncfusion),function(e,t,s){t.widget("ejRTE","ej.RTE",{element:null,model:null,_rootCSS:"e-rte",validTags:["textarea"],_addOnPersist:["value","height","width"],_setFirst:!1,_requiresID:!0,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,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:"",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:[]},toolsList:["formatStyle","font","style","effects","alignment","lists","indenting","clipboard","doAction","clear","links","images","media","tables","casing","customTools","view","print","edit"],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:"

    ",spriteCssClass:"e-paragraph"},{text:"Quotation",value:"

    ",spriteCssClass:"e-quotation"},{text:"Heading 1",value:"

    ",spriteCssClass:"e-h1"},{text:"Heading 2",value:"

    ",spriteCssClass:"e-h2"},{text:"Heading 3",value:"

    ",spriteCssClass:"e-h3"},{text:"Heading 4",value:"

    ",spriteCssClass:"e-h4"},{text:"Heading 5",value:"

    ",spriteCssClass:"e-h5"},{text:"Heading 6",value:"
    ",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",value:"1"},{text:"2 (10pt)",value:"2"},{text:"3 (12pt)",value:"3"},{text:"4 (14pt)",value:"4"},{text:"5 (18pt)",value:"5"},{text:"6 (24pt)",value:"6"},{text:"7 (36pt)",value:"7"}],tableRows:8,tableColumns:10,colorPaletteRows:6,colorPaletteColumns:6,showCustomTable:!0,value:null,undoStackLimit:50,enableResize:!0,enablePersistence:!1,enableRTL:!1,autoHeight:!1,zoomStep:.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",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",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",customOrderList:"array",customUnOrderList:"array"}},observables:["value"],value:t.util.valueFunction("value"),_setModel:function(i){var s,a,n,o,r,l,d,h;this._isInteraction=!1;for(s in i){switch(s){case"allowEditing":this._enableEdit(i[s]);break;case"autoFocus ":this.model.autoFocus=i[s],i[s]&&this._focus();break;case"showToolbar":i[s]?t.isNullOrUndefined(this._rteToolbar)?this._renderToolBar():this._rteToolbar.show():this._rteToolbar.hide();break;case"showFooter":this.model.showFooter=i[s],i[s]?t.isNullOrUndefined(this._rteFooter)?this._renderFooter():this._rteFooter.show():this._rteFooter.hide();break;case"isResponsive":this.model.isResponsive=i[s],this._renderToolBarList(),a=e(this._rteIframe).outerHeight(),n=e(this._rteToolbar).outerHeight(),e(this._rteWapper).height(a+n),t.isNullOrUndefined(e(this._rteFooter))||(o=e(this._rteFooter).outerHeight(),e(this._rteWapper).height(a+o+n));break;case"enabled":this._disabled(i[s]);break;case"height":this.model.height=i[s],this._rteWapper.height(i[s]);break;case"width":this.model.height=i[s],this._rteWapper.css("width",i[s]);break;case"cssClass":this._changeSkin(i[s]);break;case"showHtmlSource":this._footerElement("div.e-rte-source",i[s]);break;case"showHtmlTagInfo":this._footerElement("div.e-rte-htmltaginfo",i[s]);break;case"showWordCount":this.model.showWordCount=i[s],this._createCountElement(i[s],this._wordCount);break;case"showCharCount":this.model.showCharCount=i[s],this._createCountElement(i[s],this._charCount);break;case"showClearAll":this._footerElement("div.clearAll",i[s]);break;case"showClearFormat":this._footerElement("div.clearFormat",i[s]);break;case"enableResize":this._footerElement("div.e-rte-resize",i[s]);break;case"fontName":this._fontStyleDDL.ejDropDownList({dataSource:i[s]});break;case"fontSize":this._fontSizeDDL.ejDropDownList({dataSource:i[s]});break;case"format":this._formatDDL.ejDropDownList({dataSource:i[s]});break;case"value":this._getDocument().body.innerHTML=t.util.getVal(i[s]),r={text:this._getText(),htmlText:this.getHtml()},this._onChange();break;case"showDimensions":i[s]?(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[s]?this._rteWapper.find("ul.e-rte-fontgroup").show():this._rteWapper.find("ul.e-rte-fontgroup").hide();break;case"locale":this.model.locale=i[s],l=this.model,this.element.ejRTE("destroy").ejRTE(l);break;case"tableRows":this.model.tableRows=i[s],d=this._createTable.find("div.e-rte-table").html(""),this._drawTable(d);break;case"iframeAttributes":this._updateIframeSkin(i[s]);break;case"tableColumns":this.model.tableColumns=i[s],d=this._createTable.find("div.e-rte-table").html(""),this._drawTable(d);break;case"showCustomTable":h=this._createTable.find("div.customtable-group"),i[s]?t.isNullOrUndefined(this._customTableDialog)?this._createCustomTable():h.show():h.hide();break;case"colorPaletteRows":this.model.colorPaletteRows=i[s],this._updateColorPalette();break;case"colorPaletteColumns":this.model.colorPaletteColumns=i[s],this._updateColorPalette();break;case"colorCode":this.model.colorCode=i[s],this._updateColorPalette();break;case"name":this.model.name=i[s],this._checkNameAttr();break;case"showContextMenu":this.model.showContextMenu=i[s],this._showHideContextMenu();break;case"enableRTL":this._enableRTL(i[s]);break;case"htmlAttributes":this._addAttr(i[s]);break;case"showRoundedCorner":this._roundedCorner(i[s]);break;case"validationRules":0!=this.element.closest("form").length&&(null!=this.model.validationRules&&(this.element.rules("remove"),this.model.validationMessage=null),this.model.validationRules=i[s],null!=this.model.validationRules&&(this._initValidator(),this._setValidation()));break;case"validationMessage":0!=this.element.closest("form").length&&(this.model.validationMessage=i[s],null!=this.model.validationRules&&null!=this.model.validationMessage&&(this._initValidator(),this._setValidation()));break;case"autoHeight":this.model.autoHeight=i[s],this._setAutoHeight()}"locale"!=s&&this._setIframeHeight()}this._updateCount()},_init:function(){t.isNullOrUndefined(this.element)||"textarea"!=this.element[0].type||(this.element.hide(),this._initialize()._render(),this.model.allowEditing&&this._wireEvents(),this._updateIframeSkin(this.model.iframeAttributes),0==this.model.enabled&&this._disabled(this.model.enabled),this._addAttr(this.model.htmlAttributes),this.model.autoFocus&&this._focus(),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,null!=this.model.validationRules&&(this._initValidator(),this._setValidation()),this.model.showContextMenu&&this._showHideContextMenu(),this._isInteraction=!0)},_hideContextMenuByItem:function(t){for(index1=0;index1=s},"Please enter the content with min word count."),jQuery.validator.addMethod("minCharCount",function(t,i,s){return e(i).data("ejRTE")._getText().length>=s},"Please enter the content with min length."),jQuery.validator.addMethod("maxCharCount",function(t,i,s){return e(i).data("ejRTE")._getText().length<=s},"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(e,t){var i=null;switch(e){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 i,s,a,n,o,r,l;if(0!=this.element.closest("form").length){i=this.element.closest("form").validate(),n=this.element.attr("name"),i.settings.messages[n]={};for(o in this.model.validationRules)if(r=null,!t.isNullOrUndefined(this.model.validationRules[o])&&this._customRules[o]){if(s=this._customRules[o],a=this.model.validationRules[o],this.element.rules("add",this._getRuleData(s,a)),t.isNullOrUndefined(this.model.validationRules.messages&&this.model.validationRules.messages[s])){i.settings.messages[n][s]=e.validator.messages[s];for(l in this.model.validationMessage)o==l?r=this.model.validationMessage[o]:""}else r=this.model.validationRules.messages[s];i.settings.messages[n][s]=null!=r?r:e.validator.messages[s]}}},_addAttr:function(t){if(null!=t){var i=this;e.map(t,function(e,t){"class"==t?i._rteWapper.addClass(e):"name"==t?i.element.attr(t,e):"required"==t?i.element.attr(t,e):"disabled"==t&&"disabled"==e?i.disable():"readOnly"==t&&"readOnly"==e?i._enableEdit(!1):i._rteWapper.attr(t,e)})}},_addCssToIframe:function(t){for(var i,s=e.isArray(t)?t:t.split(","),a=0;a0&&(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(),this.model.showToolbar&&this.model.isResponsive&&this._toolBarObj._reSizeHandler(),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}),"msie"===t.browserInfo().name&&"8.0"===t.browserInfo().version&&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,t.isResponsive=this.model.isResponsive,t.height=t.isResponsive?"":"auto",t.showRoundedCorner=this.model.showRoundedCorner,this._toolBarItems.ejToolbar(t),this._toolBarObj=this._toolBarItems.ejToolbar("instance"),this._on(e(this._toolBarObj.itemsContainer).find(".e-rteItem-zoomIn , .e-rteItem-zoomOut"),"mouseup touchend",this._zoomUp),this._on(e(this._toolBarObj.itemsContainer).find(".e-rteItem-zoomIn , .e-rteItem-zoomOut"),"mousedown touchstart",this._zoomDown)},_crateToolbarTemplate:function(){var i,s,a;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])||("customTools"==i?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&&(s=t.buildTag("ul#"+this._rteId+"-file-exporer"),a=e("
  • "),a.appendTo(s),s.appendTo(this._toolBarItems)),this},_createToolsItems:function(i,s){var a,n,o=t.buildTag("ul#"+(this._rteId+"_"+s));for("font"==s&&o.addClass("e-rte-fontgroup"),"formatStyle"==s&&o.addClass("e-rte-format"),"lists"==s&&o.addClass("e-rte-lists"),n=0;n
    "),"video"===i[n]&&"msie"===t.browserInfo().name&&"8.0"===t.browserInfo().version?a.attr("title",this._getLocalizedLabels("html5Support")):a.attr("title",this._getLocalizedLabels(i[n].replace(/ /g,""))),"fullScreen"===i[n]?a.attr("title",this._getLocalizedLabels("maximize")).children(".e-rte-toolbar-icon").addClass("maximize"):"findAndReplace"===i[n]&&a.attr("title",this._getLocalizedLabels("FindAndReplace")),a.appendTo(o);o.appendTo(this._toolBarItems),"font"!=s||this.model.showFontOption||o.hide()},_customTools:function(i){for(var s,a,n,o=0;o
    "+(t.isNullOrUndefined(i[o].text)?"":i[o].text)+"
    "),n=i[o].action,"string"==typeof n&&(n=t.util.getObject(n,window)),t.isNullOrUndefined(i[o].action)||this._on(a,"click",n),e(i[o].template).appendTo(a.find("div")),a.appendTo(s),s.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.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 e=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&&0==e.length?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(),null!=navigator.userAgent.match(/iPad/i)&&this._rteEditor.addClass("e-ipadscroll")},_xhtmlTagValidation:function(){var e,i,s,a,n,o;if(null!=this.value()){if(e=this.value(),e=e.replace(/\r/gi," ").replace(/\n/gi,"
    ").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)"),e.indexOf("")!=-1&&(i=e.indexOf(""), s=e.slice(0,i+6),e=e.replace(s,"").replace("","")),e=e.replace(/
    /g,"
    ").replace(/
    /g,"
    "),e=this._imageXhtml(e),e=this._styleXhtml(e),e=this._startXhtml(e),e.indexOf("alt=")!=-1){for(var r,l=/alt=\"(.*?)\"/gi,d=[],h=0;null!=(r=l.exec(e));)d[h]=r[0],h++;for(o=0;o/gi,m=0,p=[];null!==(c=u.exec(e));)p[m]=c[0].toString(),m++;for(a=[],n=0;n/gi,"");for(o=0;o/gi,"").replace(/<\/o:p>/gi,"")}this.value(e)}},_setIFrames:function(){var i,s,a=null;null!=this.value()&&""!=this.value()&&(a=this.value().replace(/'/g,'"')),null==a&&this.value(e.trim(this.element[0].value)),i="msie"==t.browserInfo().name&&8==parseInt(t.browserInfo().version),s=" "+e.trim(this.value())+"",this._rteIframe.css({width:"100%"}),("
    "==this.element[0].value||""==this.element[0].value)&&(this.element[0].innerHTML=this.value()),this._setContent(s),this._isIE8()&&this.value(this._getDocument().body.innerHTML),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",0==i?this.model.height:this._rteWapper.outerHeight()-i-(parseInt(this._rteEditor.css("padding-top"))+parseInt(e(".e-rte-wrapper").css("border-bottom-width"))+parseInt(this.model.showFooter?e(".e-rte-footer").css("margin-top"):0)))},_renderFooter:function(){var e,i,s=this.model;this._rteFooter=t.buildTag("div.e-rte-footer #"+this._rteId+"_footer").appendTo(this._rteWapper),e=t.buildTag("div.e-rte-footer-left"),this._htmlSource=t.buildTag("div.e-rte-icons e-rte-footeritems e-rte-footericon e-rte-source","",{},{title:this._getLocalizedLabels("viewHtml")}).appendTo(e),this._htmlInfo=t.buildTag("div.e-rte-htmltaginfo e-rte-footeritems").appendTo(e),e.appendTo(this._rteFooter),i=t.buildTag("div.e-rte-footer-right"),this._wordCount=t.buildTag("div.e-rte-wordcount e-rte-footeritems").appendTo(i),this._charCount=t.buildTag("div.e-rte-charcount e-rte-footeritems").appendTo(i),this._clearFormat=t.buildTag("div.e-rte-icons clearFormat e-rte-footericon e-rte-footeritems","",{},{title:this._getLocalizedLabels("clearFormat"),unselectable:"on"}).appendTo(i),this._clearAll=t.buildTag("div.e-rte-icons clearAll e-rte-footericon e-rte-footeritems","",{},{title:this._getLocalizedLabels("clearAll")}).appendTo(i),this._resize=t.buildTag("div.e-icons e-rte-resize e-rte-footeritems").appendTo(i),i.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"),s.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)},_footerElement:function(e,t){if(this.model.showFooter){var i=this._rteFooter.find(e);t?i.show().addClass("e-rte-footeritems"):i.hide().addClass("e-rte-footeritems")}},_wordCharClick:function(){this._alertWindow.ejDialog("option",{showHeader:!0,title:""+this._getLocalizedLabels("wordCount")+""}),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("
    "+this._getLocalizedLabels("words")+"

    "+this._getLocalizedLabels("charSpace")+"

    "+this._getLocalizedLabels("charNoSpace")+"

    "+(""!=e.trim(this._getText())?e.trim(this._getText()).split(/\W+/).length:0)+"

    "+this._getText().length+"

    "+this._getText().replace(/\s/g,"").length+"


    ")},_updateColorPalette:function(){var t=e("ul#"+this._rteId+"_colorTable"),i=e("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(e){try{e?this._rteIframe.contents().find("body").css("direction","rtl"):this._rteIframe.contents().find("body").css("direction","ltr")}catch(e){}this._subControlsSetModel("enableRTL",e)},_roundedCorner:function(e){e&&this._rteWapper.toggleClass("e-corner-all"),this._subControlsSetModel("showRoundedCorner",e)},_subControlsSetModel:function(e,i){t.isNullOrUndefined(this._formatDDL)||this._formatDDL.ejDropDownList("option",e,i),t.isNullOrUndefined(this._fontStyleDDL)||this._fontStyleDDL.ejDropDownList("option",e,i),t.isNullOrUndefined(this._fontSizeDDL)||this._fontSizeDDL.ejDropDownList("option",e,i),t.isNullOrUndefined(this._fontColorSplit)||this._fontColorSplit.ejSplitButton("option",e,i),t.isNullOrUndefined(this._bgColorSplit)||this._bgColorSplit.ejSplitButton("option",e,i),t.isNullOrUndefined(this._toolBarItems)||("showRoundedCorner"==e&&this._toolBarItems.hasClass("e-corner-top")&&this._toolBarItems.removeClass("e-corner-top").addClass("e-corner-all"),this._toolBarItems.ejToolbar("option",e,i),"showRoundedCorner"==e&&this._toolBarItems.hasClass("e-corner-all")&&this._toolBarItems.removeClass("e-corner-all").addClass("e-corner-top")),t.isNullOrUndefined(this._linkDialog)||(this._linkDialog.ejDialog("option",e,i),this._linkDialog.find(".e-rte-btn").ejButton("option",e,i),this._chkTarget.ejCheckBox("option",e,i),"showRoundedCorner"==e&&(1==i?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",e,i),this._imgDialog.find("div.e-rte-imageTab").ejTab("option",e,i),this._imgDialog.find(".e-rte-imgBorderPx").ejNumericTextbox("option",e,i),this._imgDialog.find(".e-rte-imgBorderStyle").ejDropDownList("option",e,i),this._chkImgDimensions.ejCheckBox("option",e,i),this._dialogchkTarget.ejCheckBox("option",e,i),this._imgDialog.find(".e-rte-btn").ejButton("option",e,i),"showRoundedCorner"==e&&(1==i?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",e,i),this._videoDialog.find(".e-rte-btn").ejButton("option",e,i),this._chkvideoDimensions.ejCheckBox("option",e,i),"showRoundedCorner"==e&&(1==i?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",e,i),t.isNullOrUndefined(this._sourceDialog)||(this._sourceDialog.ejDialog("option",e,i),this._sourceDialog.find(".e-rte-btn").ejButton("option",e,i),"showRoundedCorner"==e&&(1==i?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",e,i),this._alertWindow.find(".e-rte-btn").ejButton("option",e,i)),t.isNullOrUndefined(this._customTableDialog)||(this._customTableDialog.ejDialog("option",e,i),this._customTableDialog.find(".e-rte-btn").ejButton("option",e,i),this._customTableDialog.find(".numerictextbox").ejNumericTextbox("option",e,i),this._customTableDialog.find(".e-rte-txtColumns").ejNumericTextbox("option",e,i),this._customTableDialog.find(".e-rte-ddlAlignment").ejDropDownList("option",e,i),this._customTableDialog.find(".e-rte-txtBorder").ejDropDownList("option",e,i),this._chkTblCaption.ejCheckBox("option",e,i),"showRoundedCorner"==e&&(1==i?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",e,i),this._eTblDialog.find(".e-numerictextbox").ejNumericTextbox("option",e,i),this._eTblDialog.find(".e-rte-dropdown").ejDropDownList("option",e,i),this._getTableObj("_Tab").ejTab("option",e,i),this._eTblDialog.find(".e-rte-btn").ejButton("option",e,i),this._eTblCaption.ejCheckBox("option",e,i),"showRoundedCorner"==e&&(1==i?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",e,i),this._fileDialog.find(".e-rte-btn").ejButton("option",e,i),this._chkFileTarget.ejCheckBox("option",e,i),"showRoundedCorner"==e&&(1==i?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(e,i),t.isNullOrUndefined(this._fileBrowserObj)||this._fileBrowserObj.option(e,i)},_createCountElement:function(e,t){e?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(e){i._rteEditor.append(i._overlayElement),i._trigger("resizeStart",{event:e})},resize:function(e){i._resizeHeight(e.element),i._trigger("resize",{event:e}),i.model.isResponsive&&i.model.showToolbar&&i._toolBarObj._reSizeHandler()},resizeStop:function(e){i._overlayElement.remove(),i._trigger("resizeStop",{event:e})},helper:function(t){return i._resizeHeight(t.element),e(i._rteWapper)}})},_resizeHeight:function(t){var i=e(t).parents("div.e-rte-wrapper");this._rteWidth=e(i).width(),this._rteHeight=e(i).height(),this._rteWapper.height(this._rteHeight),this._rteWapper.width(this._rteWidth),this._setIframeHeight()},_getDialogModel:function(){var e=this._rteWapper;return dialogModel={enableResize:!1,showOnInit:!1,enableModal:!0,cssClass:this.model.cssClass,target:e,enableRTL:this.model.enableRTL}},_labelFor:function(e){return this._rteId?" for="+this._rteId+e+" ":""},_TagId:function(e){return this._rteId?" id="+this._rteId+e+" ":""},_renderLinkDialog:function(){var i,s=this.model.enableRTL?"e-rtlrte":"",a=this._linkDialog=t.buildTag("div#"+this._rteId+"_link"),n=e("
    ");n.appendTo(a),a.appendTo(this._rteWapper),i=this._getDialogModel(),i.title=this._getLocalizedLabels("createLink"),i.target=null,i.closeIconTooltip=this._getLocalizedLabels("closeIcon"),i.showRoundedCorner=this.model.showRoundedCorner,a.ejDialog(i),e(e(a.parents()).find(".e-dialog-wrap")).addClass("e-rte"),this.model.showRoundedCorner&&a.find(".e-inputtext").addClass("e-corner-all"),this._chkTarget=a.find(".e-rte-linkTarget"),this._chkTarget.ejCheckBox({enableRTL:this.model.enableRTL,cssClass:this.model.cssClass,showRoundedCorner:this.model.showRoundedCorner}),a.find(".e-rte-btn").ejButton({enableRTL:this.model.enableRTL,type:"button",cssClass:this.model.cssClass,showRoundedCorner:this.model.showRoundedCorner}),this._on(a.find(".e-rte-btn"),"click",this._linkBtnClick)._on(this._linkDialog.find(".e-rte-linkUrl"),"keypress",this._urlValidation)},_renderImageDialog:function(){var i,s,a,n,o=this,r="";this._imgDialog=t.buildTag("div#"+this._rteId+"_Image"),i=this.model.enableRTL?"e-rtlrte":"",s="
    "+this._getLocalizedLabels("constrainProportions")+"
    ",""!=this.model.imageBrowser.filePath&&(r="
    "),s=e(r+s),s.appendTo(this._imgDialog),this._imgDialog.appendTo(this._rteWapper),this.model.showDimensions||this._rteWapper.find("div.e-rte-imgdimensions").hide(),a=this._getDialogModel(),a.width=a.width=""!==this.model.imageBrowser.filePath?"720px":"470px",a.title=this._getLocalizedLabels("image"),a.target=null,a.closeIconTooltip=this._getLocalizedLabels("closeIcon"),a.showRoundedCorner=this.model.showRoundedCorner,a.open=function(){t.isNullOrUndefined(o._imgSplitObj)||o._imgSplitObj.option("enableAutoResize",!0)},a.close=function(){t.isNullOrUndefined(o._imgSplitObj)||o._imgSplitObj.option("enableAutoResize",!1)},this._imgDialog.ejDialog(a),this._imgDialog.parents("#"+this._rteId+"_Image_wrapper").css({visibility:"hidden",display:"block"}),e(e(this._imgDialog.parents()).find(".e-dialog-wrap")).addClass("e-rte"),""!=this.model.imageBrowser.filePath&&(n={upload:{url:this.model.imageBrowser.uploadAction}},this.model.imageBrowser.ajaxSettings&&e.extend(!0,n,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,width:"690px",height:"300px",path:this.model.imageBrowser.filePath,fileTypes:this.model.imageBrowser.extensionAllow,layout:"list",select:function(e){o._UpdateImgDetails(e)},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:n}).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 i,s,a,n=this,o="",r=this.model.enableRTL?"e-rtlrte":"";this._fileDialog=t.buildTag("div#"+this._rteId+"_fileDialog"),i="
    ",o="
    ",i=e(o+i),i.appendTo(this._fileDialog),this._fileDialog.appendTo(this._rteWapper),s=this._getDialogModel(),s.width="720px",s.title=this._getLocalizedLabels("fileBrowser"),s.target=null,s.showRoundedCorner=this.model.showRoundedCorner,s.open=function(){t.isNullOrUndefined(n._fileSplitObj)||n._fileSplitObj.option("enableAutoResize",!0)},s.close=function(){t.isNullOrUndefined(n._fileSplitObj)||n._fileSplitObj.option("enableAutoResize",!1)},this._fileDialog.ejDialog(s),this._fileDialog.parents("#"+this._rteId+"_fileDialog_wrapper").css({visibility:"hidden",display:"block"}),e(e(this._fileDialog.parents()).find(".e-dialog-wrap")).addClass("e-rte"),a={upload:{url:this.model.fileBrowser.uploadAction}},this.model.fileBrowser.ajaxSettings&&e.extend(!0,a,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,width:"690px",height:"300px",path:this.model.fileBrowser.filePath,fileTypes:this.model.fileBrowser.extensionAllow,layout:"list",select:function(e){n._UpdateFileDetails(e)},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:a}).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=i.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){e(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){e(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(e){e.target.id===this._rteId+"_file_cancel"?(this._clearFileFields(),this._fileDialog.ejDialog("close"),this._ieCursorMaintainance()):e.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(e){this._selectedHTML=""===this._fileLinkText.val()?e:this._fileLinkText.val()},_onInsertFileLink:function(){var i,s,a,n,o=this._fileURL.val().match(/(ftp:|http:|https:)\/\//g),r=this._fileURL.val().startsWith("~")?this._fileURL.val().replace(this._fileURL.val().substr("0","1"),".."):this._fileURL.val();return t.isNullOrUndefined(o)&&""!==r||!t.isNullOrUndefined(o)&&o[0].length0?this._currentSelNode:this._getSelectedNode(),t.isNullOrUndefined(a)||"A"!=a.tagName.toUpperCase()?t.isNullOrUndefined(a)||"IMG"!=a.tagName.toUpperCase()?(i=t.buildTag("a","",{},{href:r}),i[0].target=this._chkFileTarget.ejCheckBox("isChecked")?"_blank":"_self",this._focus(),this._isIE()?(t.isNullOrUndefined(this._selectedHTML)?this._onGetInsertFileContent(r):0==this._selectedHTML.length&&this._onGetInsertFileContent(r),i[0].innerHTML=this._selectedHTML,s=i[0].outerHTML):(""===this._fileLinkText.val()?i.html(r):i.html(this._fileLinkText.val()),s=e("
    ").append(e(i).clone()).html()),s&&null!=this.model.maxLength&&this.model.maxLength>e.trim(this._getText()).length&&(this._isIE()?this._pasteHtml(s):this._getDocument().execCommand("inserthtml",!1,s),this._focus())):(n=e(a).parent("a")[0],t.isNullOrUndefined(n)?(i=t.buildTag("a","",{},{href:r}),e(a.outerHTML).appendTo(e(i)),e(a).replaceWith(e(i)),i[0].target=this._chkFileTarget.ejCheckBox("isChecked")?"_blank":"_self"):(n.href=r,n.target=this._chkFileTarget.ejCheckBox("isChecked")?"_blank":"_self")):(a.href=r,a.innerHTML=this._fileLinkText.val(),a.target=this._chkFileTarget.ejCheckBox("isChecked")?"_blank":"_self"),this._fileDialog.ejDialog("close"),this.enableToolbarItem("removeLink"),void this._updateCount()):(this._fileURL.addClass("e-error"),!1)},_renderVideoDialog:function(){var i,s,a;this._videoDialog=t.buildTag("div#"+this._rteId+"_video"),i=this.model.enableRTL?"e-rtlrte":"",s=e("
    "+this._getLocalizedLabels("constrainProportions")+"
    "),s.appendTo(this._videoDialog),this._videoDialog.appendTo(this._rteWapper),this.model.showDimensions||this._rteWapper.find(".e-rte-videoDimensions").hide(),a=this._getDialogModel(),a.width="460px",a.closeIconTooltip=this._getLocalizedLabels("closeIcon"),a.title=this._getLocalizedLabels("video"),a.target=null,a.showRoundedCorner=this.model.showRoundedCorner,this._videoDialog.ejDialog(a),e(e(this._videoDialog.parents()).find(".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 e,i;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),e=t.buildTag("div.e-rte-table"),this._drawTable(e),e.appendTo(this._createTable),this._createCustomTable(),this._createTable.appendTo(this._rteWapper),i=this._getDialogModel(),i.enableModal=!1,i.showHeader=!1,i.width="19%",i.minWidth="270px",i.maxWidth="270px",i.showRoundedCorner=this.model.showRoundedCorner,this._createTable.ejDialog(i)},_createCustomTable:function(){var i,s,a,n=e("");this._on(n,"click",this._openCustomTable),n.appendTo(this._createTable),this.model.showCustomTable||this._createTable.find("#"+this._rteId+"_createCustomTableLink").hide(),i=this.model.enableRTL?"e-rtlrte":"",this._customTableDialog=t.buildTag("div.e-rte-customtable#"+this._rteId+"_customTable"),s=e("
    "),s.appendTo(this._customTableDialog),a=this._getDialogModel(),a.width="480px",a.title=this._getLocalizedLabels("customTable"),a.target=null,a.showRoundedCorner=this.model.showRoundedCorner,a.closeIconTooltip=this._getLocalizedLabels("closeIcon"),this._customTableDialog.ejDialog(a),e(e(this._customTableDialog.parents()).find(".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 i;this._eTblDialog=t.buildTag("div#"+this._rteId+"_eTbl");var s=this._rteId,a=this.model.enableRTL?"e-rtlrte":"",n=e("
    ");n.appendTo(this._eTblDialog),this._eTblDialog.appendTo(this._rteWapper),i=this._getDialogModel(),i.width="470px",i.title=this._getLocalizedLabels("editTable"),i.target=null,i.showRoundedCorner=this.model.showRoundedCorner,i.closeIconTooltip=this._getLocalizedLabels("closeIcon"),this._eTblDialog.ejDialog(i),e(e(this._eTblDialog.parents()).find(".e-dialog-wrap")).addClass("e-rte"),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(e){for(var i,s=0;s
    "),s.appendTo(this._sourceDialog),a=this._getDialogModel(),a.title=this._getLocalizedLabels("viewHtml"),a.width="auto",a.target=null,a.showRoundedCorner=this.model.showRoundedCorner,a.closeIconTooltip=this._getLocalizedLabels("closeIcon"),this._sourceDialog.ejDialog(a),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 i,s;this._alertWindow=t.buildTag("div#"+this._rteId+"_Alert"),i=e("

    "),i.appendTo(this._alertWindow),s=this._getDialogModel(),s.showHeader=!1,s.width="auto",s.target=null,s.showRoundedCorner=this.model.showRoundedCorner,s.minHeight="50px",this._alertWindow.ejDialog(s),e(e(this._alertWindow.parents()).find(".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(e.trim(this._alertWindow.find(".e-alerttext").html())==this._getLocalizedLabels("deleteAlert")&&e(t.target).hasClass("e-alert-ok")){this._getDocument().body.innerHTML=" ",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()},_openAlert:function(t){this._alertWindow.find(".e-alerttext").html(t),this._alertWindow.ejDialog("instance")._centerPosition(),e("#"+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 e={};e.dataSource=this._formatText(this.model.format,[{text:"paragraph",value:"

    "},{text:"quotation",value:"

    "},{text:"heading1",value:"

    "},{text:"heading2",value:"

    "},{text:"heading3",value:"

    "},{text:"heading4",value:"

    "},{text:"heading5",value:"

    "},{text:"heading6",value:"
    "}]),e.width="105px",e.enableRTL=this.model.enableRTL,e.popupWidth="175px",e.popupHeight="auto",e.selectedItemIndex=0,e.popupHide=this._formatChange,e.cssClass="e-rte-format-ddl",e.showRoundedCorner=this.model.showRoundedCorner,e.fields={text:"text",value:"value",spriteCssClass:"spriteCssClass"},this._formatDDL.appendTo(this._rteToolbar.find("li.e-rteItem-format").html("")),this._formatDDL.ejDropDownList(e),this._formatPopupStyle()},_formatText:function(e,t){for(var i,s=0;s
  • "),i.find("li").append(this._colorTable()),s={},s.width="42px",s.contentType="textandimage",s.targetID=this._rteId+"_colorTable",s.enableRTL=this.model.enableRTL,s.prefixIcon="e-fontcolor-icon",s.showRoundedCorner=this.model.showRoundedCorner,this._fontColorSplit.appendTo(this._rteToolbar.find("li.e-rteItem-fontColor").html("")),a=e("#"+this._rteId+"_colorTable").get(0),a&&(e(a).parent().hasClass("e-menu-wrap")?e(a).parent().remove():e(a).remove()),i.appendTo(this._rteToolbar.find("li.e-rteItem-fontColor")),this._fontColorSplit.ejSplitButton(s),this._splitObj=this._fontColorSplit.ejSplitButton("instance"),this._splitObj.option("beforeOpen",function(){n._bindClickOperation("FontColor")}),this._on(this._fontColorSplit,"click",this._fontColorClick),this._fontColorSplit.find("span.e-fontcolor-icon").removeClass("e-icon"),this._fontColorSplit.find("span.e-btntxt").css("background-color",this._fontColor)},_renderUnOrderList:function(){var i,s,a=this;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"}),e("
  • ").appendTo(this._unorderLiTemplate),t.isNullOrUndefined(a.model.tools.customUnorderedList)||e.each(a.model.tools.customUnorderedList,function(t,i){0==t&&e(a._unorderLiTemplate).find("#circle,#square").attr("class","e-liseparator"),e("
  • "+(i.text?i.text:"")+"
  • ").appendTo(a._unorderLiTemplate)}),i={},i.width="42px",i.contentType="imageonly",i.targetID=this._rteId+"_unorderlist",i.enableRTL=this.model.enableRTL,i.prefixIcon="e-rte-toolbar-icon unorderedList",i.showRoundedCorner=this.model.showRoundedCorner,i.itemSelected=e.proxy(this._onUnorderList,this),this._unOrderSplit.appendTo(this._rteToolbar.find("li.e-rteItem-unorderedList").html("")),s=e("#"+this._rteId+"_unorderlist").get(0),s&&(e(s).parent().hasClass("e-menu-wrap")?e(s).parent().remove():e(s).remove()),this._unorderLiTemplate.appendTo(this._rteToolbar.parents("body").length>0?this._rteToolbar.find("li.e-rteItem-unorderedList"):e("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 i,s,a=this;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"}),e("
  • ").appendTo(this._orderLiTemplate),t.isNullOrUndefined(a.model.tools.customOrderedList)||e.each(a.model.tools.customOrderedList,function(t,i){0==t&&e(a._orderLiTemplate).find("#upper-roman,#upper-alpha,#lower-roman").attr("class","e-liseparator"),e("
  • "+(i.text?i.text:"")+"
  • ").appendTo(a._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-rte-toolbar-icon orderedList",i.itemSelected=e.proxy(this._onOrderList,this),this._orderSplit.appendTo(this._rteToolbar.find("li.e-rteItem-orderedList").html("")),s=e("#"+this._rteId+"_orderlist").get(0),s&&(e(s).parent().hasClass("e-menu-wrap")?e(s).parent().remove():e(s).remove()),this._orderLiTemplate.appendTo(this._rteToolbar.parents("body").length>0?this._rteToolbar.find("li.e-rteItem-orderedList"):e("body")),this._orderSplit.ejSplitButton(i),this._orderSplitObj=this._orderSplit.ejSplitButton("instance"),this._on(this._orderSplit,"click",this._onOrderList)},_renderBGColor:function(){var i,s,a,n=this;this._bgColorSplit=t.buildTag("button#"+this._rteId+"_backgroundColorbtn","",{},{type:"button","data-role":"none"}),i=e("
    "),i.find("li").append(this._colorTable()),s={},s.width="42px",s.contentType="textandimage",s.targetID=this._rteId+"_colorBGTable",s.enableRTL=this.model.enableRTL,s.prefixIcon="e-bgcolor-icon",s.showRoundedCorner=this.model.showRoundedCorner,this._bgColorSplit.appendTo(this._rteToolbar.find("li.e-rteItem-backgroundColor").html("")),a=e("#"+this._rteId+"_colorBGTable").get(0),a&&(e(a).parent().hasClass("e-menu-wrap")?e(a).parent().remove():e(a).remove()),i.appendTo(this._rteToolbar.find("li.e-rteItem-backgroundColor")),this._bgColorSplit.ejSplitButton(s),this._bgSplitObj=this._bgColorSplit.ejSplitButton("instance"),this._bgSplitObj.option("beforeOpen",function(){n._bindClickOperation("BGColor")}),this._on(this._bgColorSplit,"click",this._bgColorClick),this._bgColorSplit.find("span.e-bgcolor-icon").removeClass("e-icon"),this._bgColorSplit.find("span.e-btntxt").css("background-color",this._bgColor)},_bindClickOperation:function(t){var i=this,s="BGColor"==t?i._bgSplitObj:i._splitObj,a="BGColor"==t?"_colorBGTable":"_colorTable";SplitMenu=e("#"+i._rteId+a).ejMenu("instance"),"BGColor"==t?i._bgSplitMenu=SplitMenu:i._splitMenu=SplitMenu,SplitMenu.model.close=function(){s.contstatus=!1,i._off(e("#"+i._rteId+a).find("div.e-rte-palettetable"),"click","BGColor"==t?i._bgColorPaletteClick:i._colorPaletteClick)},i._on(e("#"+i._rteId+a).find("div.e-rte-palettetable"),"click","BGColor"==t?i._bgColorPaletteClick:i._colorPaletteClick)},_colorTable:function(){for(var e,i,s,a=t.buildTag("div.e-rte-table"),n=0,o=0;oe.trim(this._getText()).length?this._onInsertImage():this._imgDialog.ejDialog("close"),this._onChange(),this._setBackupData()}},_srcBtnClick:function(i){var s,a,n;if("src_update"===i.target.id){s=e.trim(this._sourceDialog.find("textarea.e-rte-srctextarea")[0].value),this.model.enableHtmlEncode&&(s=this._decode(s));try{this._getDocument().documentElement.innerHTML=s.replace("","").replace("",""),this.model.enableXHTML&&(this._getDocument().documentElement.innerHTML=this._updateXhtml())}catch(e){a=/]*>((.|[\n\r])*)<\/body>/i,t.isNullOrUndefined(a.exec(s))||(s=a.exec(s)[1],this._getDocument().body.innerHTML=s)}this._onChange(),this._updateCount()}this._sourceDialog.find("textarea.e-rte-srctextarea")[0].value="",n=e(this._getDocument()).find("table.e-rte-table"),this.model.enableRTL||this._on(n,"mouseover",this._tableMouseOver),this._sourceDialog.ejDialog("close"),this._showHideContextMenu()},_eTblBtnClick:function(e){e.target.id===this._rteId+"_eTbl_cancel"?(this._eTblDialog.ejDialog("close"),this._ieCursorMaintainance()):e.target.id===this._rteId+"_eTbl_apply"&&(this._isIE()&&!this._isIE8()&&this._ieLinkRange(),this._oneditTable(),this._onChange(),this._setBackupData())},_insertCustomTable:function(i){var s,a,n;if(this._customTableValidation=!1,"insert"===i.target.id){var o=this._customTableDialog.find(".e-rte-txtColumns").ejNumericTextbox("getValue"),r=this._customTableDialog.find(".e-rte-txtRows").ejNumericTextbox("getValue"),l=this._customInputValidation(this._customTableDialog.find(".e-rte-txtHeight")),d=this._customInputValidation(this._customTableDialog.find(".e-rte-txtWidth")),h=this._customTableDialog.find(".e-rte-ddlAlignment").ejDropDownList("getSelectedValue"),c=this._customInputValidation(this._customTableDialog.find(".e-rte-txtSpacing")),u=this._customInputValidation(this._customTableDialog.find(".e-rte-txtPadding")),m=this._customTableDialog.find(".e-rte-txtBorder").ejDropDownList("getSelectedValue"),p=this._chkTblCaption.ejCheckBox("isChecked");this._customTableValidation||(t.isNullOrUndefined(this._tableInsertAt)||t.isNullOrUndefined(this._tableInsertAt.startContainer)||this._restoreSelection(this._tableInsertAt),s=this._tableGenerator(r,o,!1,d,l,c,u,h,m,p),this.executeCommand("inserthtml",s),a=e(this._getDocument()).find("table.e-rte-table"),n=this._customTableDialog.find(".e-rte-ddlAlignment").data("ejDropDownList"),"Center"==n.option("value")&&a.attr("style","margin: 0 auto"),this.model.enableRTL||this._on(a,"mouseover",this._tableMouseOver),this._onChange(),n.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(e){var t=e.val().toLowerCase(),i=t.substr(t.length-2,2),s=t.match(/[!@#$%^&*()_+\-=\[\]{};':"\\|,<>\/?]/gi),a=t.match(/[a-z]/gi);return!isNaN(t)&&(null==s||0==s.length)||t.length>1&&"%"==t.substr(t.length-1,1)&&1==s.length&&(null==a||0==a.length)||t.length>2&&(null==s||0==s.length)&&null!=a&&2==a.length&&("px"==i||"in"==i||"cm"==i||"mm"==i||"em"==i||"ex"==i||"pt"==i||"pc"==i)?t:(e.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("");this._customTableDialog.find(".e-rte-txtBorder").ejDropDownList("clearText"),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(e,t,i){if(this._isIE8()){var s=e.createTextRange();s.collapse(!0),s.moveEnd("character",t),s.moveStart("character",i),s.select()}else e.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(e(i).width()),this._videoHeight=parseInt(e(i).width()),this.model.showDimensions&&(this._videoDialog.find(".e-rte-videoX").val(this._videoWidth),this._videoDialog.find(".e-rte-videoY").val(this._videoHeight))),e("#"+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"),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,e("#"+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 s=this._isIE()?this._currentSelNode:this._getSelectedNode();this._selectedHTML="msie"===t.browserInfo().name&&"11.0"===t.browserInfo().version?this._pasteRangeVal.toString():this._getSelText(),i?(this._clearFileFields(),t.isNullOrUndefined(s)||"A"!=s.tagName.toUpperCase()?this._fileLinkText.val(this._selectedHTML):this._fileLinkText.val(e(s).html()),e("#"+this._rteId+"_fileDialog_wrapper").css({"z-index":this._onGetMaxZindex()}),this._fileDialog.ejDialog("open")):(this._clearLinkFields(),t.isNullOrUndefined(s)||"A"!=s.tagName.toUpperCase()?this._txtLinkText.val(this._selectedHTML):this._txtLinkText.val(e(s).html()),e("#"+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)),s&&!/^(A)$/.test(s.nodeName)&&"IMG"==s.tagName.toUpperCase()&&(s=e(s).parent("a")[0]),i?s&&/^(A)$/.test(s.nodeName)&&this._fileURL.val(s.href):s&&/^(A)$/.test(s.nodeName)&&(this._txtURL.val(s.href),this._txtLinkTitle.val(s.title))},_tableManager:function(){var i,s,a,n,o=this._rteToolbar.find("li.e-rteItem-createTable");this._getPasteRangeVal(),"td"==this._getSelectedNode().nodeName.toLowerCase()&&this._createTable.find("div.e-rte-eTblProperties").removeClass("e-disable"),this.model.isResponsive&&0==o.length?(a=e(this._toolBarObj._liTemplte).outerHeight()-e(this._toolBarObj._liTemplte).height(),o=this._toolBarObj._liTemplte.find("li.e-rteItem-createTable"),e("#"+this._rteId+"_table_wrapper").css({visibility:"hidden",display:"block"}),s=e(this._toolBarObj._liTemplte).offset().top+e(this._toolBarObj._liTemplte).outerHeight()+a-e("#"+this._rteId+"_table_wrapper").offsetParent().offset().top,i=e(o).offset().left-e("#"+this._rteId+"_table_wrapper").offsetParent().offset().left,e("#"+this._rteId+"_table_wrapper").css({visibility:"visible"})):(i=e(o).position().left,s=e(o).position().top+o.height()+7),(parseInt(i)+parseInt(e("#"+this._id+"_table_wrapper").css("width"))>document.body.clientWidth||parseInt(i)+parseInt(e("#"+this._id+"_table_wrapper").css("width"))>parseInt(e("#"+this._id+"_wrapper").css("width"))+e("#"+this._id+"_wrapper").position().left)&&(i=parseInt(i)-(parseInt(e("#"+this._id+"_table_wrapper").css("width"))-e(o).width())+"px"),n=document.documentElement&&document.documentElement.scrollTop||document.body.scrollTop,ne(window).height()?n:e(window).height()-parseInt(e("#"+this._id+"_table_wrapper").css("height"))>0?e(window).height()-parseInt(e("#"+this._id+"_table_wrapper").css("height"))+n:n),this._createTable.ejDialog("option","position",{X:i,Y:s}),this._createTable.ejDialog("open"),this._on(t.getScrollableParents(this._createTable),"scroll",function(){this._createTable.ejDialog("close")})},_eTblManager:function(){var i,s,a,n,o,r,l;this._clearEditTableFields(),i=this._rteId,s=this._currentSelNode,t.isNullOrUndefined(s)||"td"!==s.tagName.toLowerCase()||(a=e(s).closest("tbody").closest("table"),this._getTableObj("Height").val(e(a).height()),this._getTableObj("Width").val(e(a).width()),t.isNullOrUndefined(a[0])||(this._getTableObj("CellSpace").data("ejNumericTextbox").option("value",a[0].cellSpacing),this._getTableObj("CellPad").data("ejNumericTextbox").option("value",a[0].cellPadding),n=a[0].align),t.isNullOrUndefined(n)||""==n||(this._eTblAlign.enable(),this._eTblAlign.option("value",n)),o=e(e(s).closest("tbody")).prev("caption"),o.length>0&&this._eTblCaption.ejCheckBox({checked:!0}),t.isNullOrUndefined(a[0])||""==a[0].style||(this._getTableObj("BrdrPx").data("ejNumericTextbox").option("value",a[0].style.borderWidth.split("px")[0]),l=this._getTableObj("_border_style").data("ejDropDownList"),""!=a[0].style.borderStyle?l.selectItemByValue(a[0].style.borderStyle):l.option({selectedItemIndex:0}),this._getTableObj("_border_color").val(a[0].style.borderColor)),this._getTableObj("Style").val(a.attr("style")),r=e(s).closest("tr"),this._getTableObj("RHeight").val(e(r).height()),this._getTableObj("RAlign").data("ejDropDownList").option("value",r[0].style.textAlign),""!=r[0].style&&(this._getTableObj("RBrdrPx").data("ejNumericTextbox").option("value",r[0].style.borderWidth.split("px")[0]),l=this._getTableObj("RBrdrStyle").data("ejDropDownList"),""!=r[0].style.borderStyle?l.selectItemByValue(r[0].style.borderStyle):l.option({selectedItemIndex:0}),this._getTableObj("RBrdrColor").val(r[0].style.borderColor)),this._getTableObj("RStyle").val(r.attr("style")),this._getTableObj("ClWidth").val(e(s).width()),this._getTableObj("ClAlign").data("ejDropDownList").option("value",s.style.textAlign),""!=s.style&&(this._getTableObj("ClBrdrPx").data("ejNumericTextbox").option("value",s.style.borderLeftWidth.split("px")[0]),l=this._getTableObj("ClBrdrStyle").data("ejDropDownList"),""!=s.style.borderStyle?l.selectItemByValue(s.style.borderStyle):l.option({selectedItemIndex:0}),this._getTableObj("ClBrdrColor").val(s.style.borderColor)),this._getTableObj("ClStyle").val(e(s).attr("style")))},_getTableObj:function(e){return this._eTblDialog.find("#"+this._rteId+"_eTbl"+e)},_imageManager:function(){var i,s,a;this._clearImgFields(),i=this._isIE()?this._currentSelNode:this._getSelectedNode(),this._getPasteRangeVal(),i&&!t.isNullOrUndefined(i)&&(this._imgWidth=parseInt(e(i).width()),this._imgHeight=parseInt(e(i).height()),this.model.showDimensions&&(this._imgDialog.find(".e-rte-imgX").val(this._imgWidth),this._imgDialog.find(".e-rte-imgY").val(this._imgHeight)),s=e(i).parent("a"),s.length>0&&this._imageLink.val(s.attr("href")),"img"===i.tagName.toLowerCase()&&(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&&("msie"===t.browserInfo().name&&"8.0"===t.browserInfo().version?this._imgPicker.option("value",i.style.borderColor):(a=i.style.borderColor.split("(")[1].split(")")[0],a=a.split(","),a={r:e.trim(a[0]),g:e.trim(a[1]),b:e.trim(a[2])},this._imgPicker.option("value",this._imgPicker.RGBToHEX(a))))),this._imageStyle.val(e(i).attr("style")))),e("#"+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(e){switch(e){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(e){e._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"),e._alertWindow.find(".e-rte-button").css({"text-align":"","padding-bottom":"","padding-top":""}).addClass("e-fieldseparate"),e._alertWindow.ejDialog("instance").refresh()},_toolBarClick:function(i){var s,a,n,o=e(this.itemsContainer).closest("div.e-rte").find("textarea.e-rte"),r=o.ejRTE("instance"),l=o.attr("id"),d=t.isNullOrUndefined(l)?i.currentTarget.id.replace("_",""):i.currentTarget.id.replace(l+"_","");if(r._alertHeader(r),"mozilla"===t.browserInfo().name&&(r._getDocument().designMode="off"),e(i.currentTarget).hasClass("e-rteItem-copy")&&!r._isIE()&&_proxy._getValidbrowser(t.browserInfo().name)?r._openAlert(r._getLocalizedLabels("copyAlert")):e(i.currentTarget).hasClass("e-rteItem-cut")&&!r._isIE()&&_proxy._getValidbrowser(t.browserInfo().name)?r._openAlert(r._getLocalizedLabels("cutAlert")):e(i.currentTarget).hasClass("e-rteItem-paste")&&!r._isIE()?r._openAlert(r._getLocalizedLabels("pasteAlert")):("chrome"!=t.browserInfo().name&&(n=r._scriptsItems.indexOf(d),r._scriptsItems.indexOf(d)>=0&&e("#"+l+"_"+r._scriptsItems[0==n?1:0]).hasClass("e-active")&&r._selectCommand(l+"_"+r._scriptsItems[0==n?1:0])),s=e.grep(i.currentTarget.children[0].className.split(/\s+/),function(e){return!/^e-(rteItem|rte-toolbar-icon)$/i.test(e)}),(s.indexOf("e-split")>=0||s.indexOf("e-ddl")>=0)&&(s[0]=d),r._selectCommand(s[0])),r._styleItems.indexOf(d)>=0||r._scriptsItems.indexOf(d)>=0)e(i.currentTarget).hasClass("e-isactive")?this.deselectItemByID(i.currentTarget.id):this.selectItemByID(i.currentTarget.id),e(i.currentTarget).hasClass("e-isactive")?e(i.currentTarget).removeClass("e-isactive"):e(i.currentTarget).addClass("e-isactive"),r._scriptsItems.indexOf(d)>=0&&(n=r._scriptsItems.indexOf(d),e("#"+l+"_"+r._scriptsItems[0==n?1:0]).removeClass("e-isactive"),this.deselectItemByID(l+"_"+r._scriptsItems[0==n?1:0]));else if(r._alignItems.indexOf(d)>=0)for(this.selectItemByID(i.currentTarget.id),n=r._alignItems.indexOf(d),a=0;a=0&&(e(i.currentTarget).hasClass("e-isactive")?this.deselectItemByID(i.currentTarget.id):this.selectItemByID(i.currentTarget.id),e(i.currentTarget).hasClass("e-isactive")?e(i.currentTarget).removeClass("e-isactive"):e(i.currentTarget).addClass("e-isactive"),n=r._listItems.indexOf(d),e("#"+l+"_"+r._listItems[0==n?1:0]).removeClass("e-isactive"),0==n?this.deselectItemByID(l+"_"+r._listItems[1]):this.deselectItemByID(l+"_"+r._listItems[0]))},_toggleEditTable:function(){var i,s,a;return this._isIE8()&&(this._currentSelNode=this._getRange().parentElement()),i=this._isIE8()?this._currentSelNode:this._getSelectedNode(),!t.isNullOrUndefined(i)&&(t.isNullOrUndefined(this._toolBarItems)||(a=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"),s=this.model.isResponsive&&0==a.length?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&&"td"==i.tagName.toLowerCase()||"table"==i.tagName.toLowerCase()||"tr"==i.tagName.toLowerCase()?(s.show(),this._createTable&&this._createTable.find("div.e-rte-eTblProperties").removeClass("e-disable")):t.isNullOrUndefined(this._createTable)||(s.hide(),this._createTable.find("div.e-rte-eTblProperties").addClass("e-disable")))),this.model.isResponsive&&this.model.showToolbar&&this._toolBarObj._reSizeHandler(),void((!this.model.autoHeight||e(this._toolBarObj.itemsContainer.find(".resize")).length)&&this._setIframeHeight()))},_formatChange:function(){var t=e(this.element).closest("div.e-rte").find("textarea.e-rte"),i=t.ejRTE("instance");t.attr("id");""!==this.getSelectedValue()&&i._onFormatBlock(this.getSelectedValue()),i._isIE()&&i._focus(),i._onChange()},_fontStyleChange:function(){var t=e(this.element).closest("div.e-rte").find("textarea.e-rte"),i=t.ejRTE("instance");t.attr("id");i._focus(),""!==this.getSelectedValue()&&i._onFontName(this.getSelectedValue()),i._onChange()},_fontSizeChange:function(){var t=e(this.element).closest("div.e-rte").find("textarea.e-rte"),i=t.ejRTE("instance");t.attr("id");i._focus(),""!==this.getSelectedValue()&&i._onFontSize(this.getSelectedValue()),i._onChange()},_colorPaletteClick:function(e){var t;(t=e.target.getAttribute("color-code"))&&(this._focus(),this._onFontColor(t),this._splitMenu.hide(e),this._fontColor=t,this._fontColorSplit.find("span.e-btntxt").css("background-color",t))},_bgColorPaletteClick:function(e){var t;(t=e.target.getAttribute("color-code"))&&(this._focus(),this._onBGColor(t),this._bgSplitMenu.hide(e),this._bgColor=t,this._bgColorSplit.find("span.e-btntxt").css("background-color",t))},_fontColorClick:function(e){return this._onFontColor(this._fontColor),!t.isNullOrUndefined(this._splitMenu)&&void this._splitMenu.hide(e)},_bgColorClick:function(e){return this._onBGColor(this._bgColor),!t.isNullOrUndefined(this._bgSplitMenu)&&void this._bgSplitMenu.hide(e)},_selectCommand:function(i){switch(e(this._imgDupDiv).remove(),e(this._imgOrg).css("outline",""),"format"==i||"fontName"==i||"fontSize"==i||"fontColor"==i||"backgroundColor"==i||"createTable"==i||this._focus(),i){case"fullScreen":this._onFullScreen();break;case"print":this._onPrint();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()}"createLink"!=i&&"image"!=i&&"video"!=i&&"createTable"!=i&&this._onChange(),"undo"!=i&&"redo"!=i&&this._setBackupData();var s=this._isIE()?this._currentSelNode:this._getSelectedNode();this._updateTagInfo(s)},_focus:function(){browserInfo=t.browserInfo(),"webkit"==browserInfo.name?this._getWindow().focus():this._getWindow().document.body.focus(),this._restoreSelection(this._selectionRange)},_getWindow:function(){return e(e(this._rteWapper.find(".content-iframe"))[0].contentWindow)[0]},_getDocument:function(){var e=this._rteWapper.find(".content-iframe");try{return e.contents()[0]}catch(e){return""}},_onFullScreen:function(){e(this._toolBarObj.itemsContainer.find(".resize")).length?(e(this._rteWapper).css({top:this._rteOffset.top,left:this._rteOffset.left,width:this._rteWidth,height:this._rteHeight,position:this._rtePosition,"z-index":""}),e("body").css("overflow",""),e(this._toolBarObj.itemsContainer.find(".resize")).addClass("maximize").removeClass("resize").parent("li").attr("title",this._getLocalizedLabels("maximize"))):(this._rteOffset=e(this._rteWapper).position(),this._rtePosition=e(this._rteWapper).css("position"),e(this._rteWapper).css({top:"0px",left:"0px",width:"100%",height:"100%",position:"fixed","z-index":this._onGetMaxZindex()}),e("body").css("overflow","hidden"),e(this._toolBarObj.itemsContainer.find(".maximize")).removeClass("maximize").addClass("resize").parent("li").attr("title",this._getLocalizedLabels("resize"))),e(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,e.map(e("body *"),function(t){return parseInt(e(t).css("z-index"))+1||1}))},_onZooming:function(i){i._zoomValue=0;var s=Number(""==i.getDocument().body.style.zoom||t.isNullOrUndefined(i.getDocument().body.style.zoom)?1:i.getDocument().body.style.zoom),a=isNaN(i.model.zoomStep)&&i.model.zoomStep.indexOf("%")!=-1?parseInt(i.model.zoomStep)/100:Number(i.model.zoomStep);return i._zoomValue="IN"==i._zoomArgs?s+a:s-a>.1?s-a:.1,e(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"}),e(i._toolBarObj.itemsContainer.find(".e-rteItem-zoomIn")).attr("title",i._getLocalizedLabels("zoomIn")+" "+parseInt(100*i._zoomValue)+"%"),e(i._toolBarObj.itemsContainer.find(".e-rteItem-zoomOut")).attr("title",i._getLocalizedLabels("zoomOut")+" "+parseInt(100*i._zoomValue)+"%"),i._isIE()?i:void 0},_onKeyZoom:function(e){var t=this;this._mouseStillDown=!0,this._zoomArgs=e,this._setInterval=setInterval(t._onZooming(t),100)},_onPrint:function(){var i=this;this._isIE()||"mozilla"===t.browserInfo().name?this._getWindow().onafterprint=function(){e(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||e(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"})}),e(i.getDocument().body).css({zoom:"",transform:"","-o-transform":"","-webkit-transform":""}),this._getWindow().print()},_zoomUp:function(){this._setInterval&&(this._mouseStillDown=!1,clearInterval(this._setInterval),this._setInterval=null)},_zoomDown:function(t){var i=this;i._mouseStillDown=!0,i._zoomArgs=e(t.target).hasClass("e-rte-toolbar-icon zoomIn")||e(t.target).hasClass("e-rteItem-zoomIn")?"IN":"OUT",i._setInterval="mousedown"==t.type?setInterval(function(){i._onZooming(i)},40):setInterval(i._onZooming(i),40)},_onBold:function(){var e;this.executeCommand("bold",e)},_onItalics:function(){var e;this.executeCommand("italic",e)},_onStrikeThrough:function(){var e;this.executeCommand("strikethrough",e)},_onUnderLine:function(){var e;this.executeCommand("underline",e)},_onJustifyLeft:function(){var e;this.executeCommand("JustifyLeft",e)},_onJustifyRight:function(){var e;this.executeCommand("JustifyRight",e)},_onJustifyCenter:function(){var e;this.executeCommand("JustifyCenter",e)},_onJustifyFull:function(){this._alignFlag=!0,this.executeCommand("justifyfull")},_onCut:function(){var e;this.executeCommand("cut",e)},_onCopy:function(){var e;this.executeCommand("copy",e)},_onOpen:function(){var t=this._isIE()?this._currentSelNode:this._getSelectedNode();window.open(e(t).attr("href"))},_onPaste:function(){var e;this.executeCommand("paste",e)},_onOrderList:function(i){var s,a=this._isIE()?this._isIE8()?this._pasteRangeVal.parentElement():this._pasteRangeVal.startContainer.parentNode:this._getSelectedNode();("OL"==e(a).prop("tagName")||0!=e(a).parents("ol").length||"none"==i.ID)&&"click"!=i.type&&(!("OL"==e(a).prop("tagName")||e(a).parents("ol").length>0)||"none"!=i.ID)||t.isNullOrUndefined(i.ID)&&"none"==this._listOrderType||this.executeCommand("insertorderedlist","listItem"),a=this._isIE()?this._isIE8()?this._pasteRangeVal.parentElement():this._pasteRangeVal.startContainer.parentNode:this._getSelectedNode(),"click"==i.type&&e(a).parents("ol").length>=0&&(i.ID=this._listOrderType),t.isNullOrUndefined(i.ID)||(s="OL"==e(a).prop("tagName")?a:e(a).parents("ol")),this._generateListItems(i,s,t.isNullOrUndefined(this.model.tools.customOrderedList)?[]:this.model.tools.customOrderedList),this._listOrderType=i.ID,this._updateIndent(a)},_onUnorderList:function(i){var s,a=this._isIE()?this._isIE8()?this._pasteRangeVal.parentElement():this._pasteRangeVal.startContainer.parentNode:this._getSelectedNode();("UL"==e(a).prop("tagName")||0!=e(a).parents("ul").length||"none"==i.ID)&&"click"!=i.type&&(!("UL"==e(a).prop("tagName")||e(a).parents("ul").length>0)||"none"!=i.ID)||t.isNullOrUndefined(i.ID)&&"none"==this._listType||this.executeCommand("insertunorderedlist","listItem"),a=this._isIE()?this._isIE8()?this._pasteRangeVal.parentElement():this._pasteRangeVal.startContainer.parentNode:this._getSelectedNode(),"click"==i.type&&e(a).parents("ul").length>=0&&(i.ID=this._listType),t.isNullOrUndefined(i.ID)||(s="UL"==e(a).prop("tagName")?a:e(a).parents("ul")),this._generateListItems(i,s,t.isNullOrUndefined(this.model.tools.customUnorderedList)?[]:this.model.tools.customUnorderedList),this._listType=i.ID,this._updateIndent(a)},_generateListItems:function(t,i,s){e(i).css({"list-style-type":t.ID,"list-style-image":""});["none","disc","circle","square","decimal","upper-roman","lower-roman","upper-alpha","lower-alpha"].indexOf(t.ID)==-1&&e.each(s,function(s,a){a.name==t.ID&&e(i).css({"list-style-type":a.listStyle,"list-style-image":a.listImage})}),this._setBackupData(),this._isIE()?this.selectRange(this._pasteRangeVal):this.selectRange(this._getRange()),this._updateTagInfo(this._isIE()?this._currentSelNode:this._getSelectedNode())},_onUndo:function(){this.executeCommand("undo",null)},_onDelete:function(){this.executeCommand("delete",null)},_onRedo:function(){this.executeCommand("redo",null)},_onClearFormat:function(){var e;this.executeCommand("removeformat",e),this._setBackupData(),this._onChange(),this._updateIframeSkin(this.model.iframeAttributes),this._updateToolbarStatus()},_onFormatBlock:function(e){this._focus();var t;t=document.getSelection?this._getSelectedNode():this._getWindow().document.selection.createRange().parentElement(),this._onClearFormat(),this.executeCommand("formatBlock",e)},_onFontName:function(e){this.executeCommand("fontName",e)},_onFontSize:function(e){this.executeCommand("fontSize",e)},_onFontColor:function(e){this.executeCommand("foreColor",e),this._onChange(),this._updateIframeSkin(this.model.iframeAttributes)},_onBGColor:function(e){this.executeCommand("backColor",e),this._onChange()},_onIndent:function(){this._getWindow().document.body.style.wordWrap="break-word";var t=document.getSelection?this._getWindow().document.getSelection().focusNode:this._getWindow().document.selection.createRange().parentElement();t&&/^(OL|UL|LI)$/.test(t.nodeName)?this._listIndent(t):t&&/^(#text)$/.test(t.nodeName)&&/^(OL|UL|LI)$/.test(e(t).parent()[0].nodeName)?this._listIndent(e(t).parents("li")[0],t):this.executeCommand("indent",!1),t&&e(t).focus(),this._updateIframeSkin(this.model.iframeAttributes),this._updateIndentStatus()},_onOutdent:function(){var t=document.getSelection?this._getWindow().document.getSelection().focusNode:this._getWindow().document.selection.createRange().parentElement();t&&/^(OL|UL|LI)$/.test(t.nodeName)?this._listOutdent(t):t&&/^(#text)$/.test(t.nodeName)&&/^(OL|UL|LI)$/.test(e(t).parent()[0].nodeName)?this._listOutdent(e(t).parents("li")[0],t):this.executeCommand("outdent",!1),this._updateIndentStatus()},_onSelectAll:function(){this.executeCommand("selectall")},selectAll:function(){this._onSelectAll()},_onHyperLink:function(e){this.executeCommand("createlink",e)},_onInsertLink:function(){var i,s,a,n;return (this._isUrl(e.trim(this._txtURL.val())) || e.trim(this._txtURL.val()).startsWith("mailto:"))?(a=("msie"==t.browserInfo().name||"chrome"==t.browserInfo().name)&&e(this._currentSelNode).parents("body").length>0?this._currentSelNode:this._getSelectedNode(), t.isNullOrUndefined(a)||"A"!=a.tagName.toUpperCase()?t.isNullOrUndefined(a)||"IMG"!=a.tagName.toUpperCase()?(i=t.buildTag("a","",{},{href:this._txtURL.val(),title:""==this._txtLinkTitle.val()?this._txtURL.val()+"\n"+this._getLocalizedLabels("linktooltip"):this._txtLinkTitle.val()}),i[0].target=this._chkTarget.ejCheckBox("isChecked")?"_blank":"",this._focus(),this._isIE()?(0==this._selectedHTML.length&&(this._selectedHTML=""===this._txtLinkText.val()?this._txtURL.val():this._txtLinkText.val()),i[0].innerHTML=this._selectedHTML,s=i[0].outerHTML):(""===this._txtLinkText.val()?i.html(this._txtURL.val()):i.html(this._txtLinkText.val()),s=e("
    ").append(e(i).clone()).html()),s&&null!=this.model.maxLength&&this.model.maxLength>e.trim(this._getText()).length&&(this._isIE()?this._pasteHtml(s):this._getDocument().execCommand("inserthtml",!1,s),this.selectRange(this._getRange()))):(n=e(a).parent("a")[0],t.isNullOrUndefined(n)?(i=t.buildTag("a","",{},{href:this._txtURL.val(),title:""==this._txtLinkTitle.val()?this._txtURL.val()+"\n"+this._getLocalizedLabels("linktooltip"):this._txtLinkTitle.val()}),i[0].target=this._chkTarget.ejCheckBox("isChecked")?"_blank":"",e(a.outerHTML).appendTo(e(i)),e(a).replaceWith(e(i))):(n.href=this._txtURL.val(),n.title=this._txtLinkTitle.val(),n.target=this._chkTarget.ejCheckBox("isChecked")?"_blank":"")):(a.href=this._txtURL.val(),a.title=this._txtLinkTitle.val(),a.innerHTML=this._txtLinkText.val(),a.target=this._chkTarget.ejCheckBox("isChecked")?"_blank":""),this._linkDialog.ejDialog("close"),this.enableToolbarItem("removeLink"),void this._updateCount()):(this._txtURL.addClass("e-error"),!1)},_setImageProperties:function(i,s,a,n,o,r,l){this.model.showDimensions&&(""!=s&&(i[0].width=s),""!=a&&(i[0].height=a)),i=e(i).attr("style",n),border=o+"px ",border+=t.isNullOrUndefined(r)||""==r?"solid ":r+" ",border+=t.isNullOrUndefined(l)||""==l?"#000000":l,i=i.css("border",border)},_onInsertImage:function(){var i,s,a,n=this._imgDialog.find(".e-rte-imgUrl"),o=this._imgDialog.find(".e-rte-imgText"),r=this._imgDialog.find(".e-rte-imgX").val(),l=this._imgDialog.find(".e-rte-imgY").val(),d=this;this._restoreSelection(this._selectionRange);var h="",c=d._imageLink.val(),u=d._imageBorderPx.getValue(),m=d._imageBorderStyle.getSelectedValue(),p=d._imgPicker.getValue(),g=d._imageStyle.val(),_=d._isIE()?d._currentSelNode:d._getSelectedNode();if(t.isNullOrUndefined(_)||(h=_.nodeName.toUpperCase()),p=!t.isNullOrUndefined(p)&&p.length>0?p:"",i=n.val().startsWith("~")?n.val().replace(n.val().substr("0","1"),".."):n.val(),"IMG"!=h)s=e("",{src:i,error:function(){n.addClass("e-error")},success:function(){var s,a,n=t.buildTag("img","",{},{alt:o.val(),src:i});if(d._setImageProperties(n,r,l,g,u,m,p),""!=c){if(!d._isUrl(e.trim(c)))return d._imageLink.addClass("e-error"),!1;s=t.buildTag("a","",{},{href:c}),s[0].target=d._dialogchkTarget.ejCheckBox("isChecked")?"_blank":"_self",e(n[0].outerHTML).appendTo(s),n=s}a=n[0].outerHTML,d.executeCommand("inserthtml",a)}});else{if(_.src=i,_.alt=o.val(),d._setImageProperties(e(_),r,l,g,u,m,p),a=e(_).parent("a"),""!=c){if(!d._isUrl(e.trim(c)))return d._imageLink.addClass("e-error"),!1;a.length>0?a.attr("href",c):(a=t.buildTag("a","",{},{href:c}),e(_.outerHTML).appendTo(a),e(_).replaceWith(a))}else a.length>0&&a.attr("href","");!t.isNullOrUndefined(a)&&a.length>0&&(a[0].target=this._dialogchkTarget.ejCheckBox("isChecked")?"_blank":"_self")}d._setAutoHeight(),d._imageLink.hasClass("e-error")||d._imgDialog.ejDialog("close"),d._on(d._imageLink,"keypress",d._urlValidation)._on(d._imageLink,"blur",d._urlValidation)},_insertVideo:function(i){var s,a=e.trim(this._videoDialog.find("textarea.e-rte-video")[0].value),n=this._videoDialog.find(".e-rte-videoX").val(),o=this._videoDialog.find(".e-rte-videoY").val();this._restoreSelection(this._selectionRange),this._alertHeader(this),"video_insert"===i.target.id&&""!==a?(this._isIE()&&!this._isIE8()&&this._ieLinkRange(),s=e(a)[0],this.model.showDimensions&&!t.isNullOrUndefined(s)&&(""!=n&&(s.width=n),""!=o&&(s.height=o)),!t.isNullOrUndefined(s)&&null!=this.model.maxLength&&this.model.maxLength>e.trim(this._getText()).length&&this.executeCommand("inserthtml",s.outerHTML+"
    "),this._onChange(),this._setBackupData(),this._videoDialog.ejDialog("close")):"video_cancel"===i.target.id?(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 i,s,a,n=this._currentSelNode,o=e(n).closest("tbody").closest("table"),r=e(e(n).closest("tbody")).prev("caption");this._eTblCaption.ejCheckBox("isChecked")?0==r.length&&t.buildTag("caption").append(e('
    ')).insertBefore(e(e(n).closest("tbody"))):r.length>0&&r.remove(),i=this._eTblAlign.getSelectedValue(),s=this._getTableObj("Style").val(),"center"==i&&(s+=";margin: 0 auto;"),s&&o.attr("style",s),this._customTableValidation=!1;var l=this._customInputValidation(this._getTableObj("Width")),d=this._customInputValidation(this._getTableObj("Height")),h=this._customInputValidation(this._getTableObj("RHeight")),c=this._customInputValidation(this._getTableObj("ClWidth"));this._customTableValidation||(o.attr({width:l,height:d,cellPadding:this._getTableObj("CellPad").data("ejNumericTextbox").getValue(),cellSpacing:this._getTableObj("CellSpace").data("ejNumericTextbox").getValue(),align:i}).css({"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()}),a=e(n).closest("tr"),a.attr({style:this._getTableObj("RStyle").val()}).css({height:h,"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()}),e(n).attr({style:this._getTableObj("ClStyle").val()}).css({width:c,"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._alertWindow.find(".e-alert-cancel").show(),this._alertHeader(this),this._openAlert(this._getLocalizedLabels("deleteAlert"))},_onUnlink:function(){var e;this.executeCommand("unlink",e),this.disableToolbarItem("removeLink")},_onSuperScript:function(){var e;this.executeCommand("SuperScript",e)},_onSubScript:function(){var e;this.executeCommand("SubScript",e)},_onInsertTable:function(i,s,a){if(null!=this.model.maxLength&&this.model.maxLength>e.trim(this._getText()).length){e(this._getDocument().body).css("display","inline-block");var n=this._tableGenerator(i,s,a);this.executeCommand("inserthtml",n),(t.isNullOrUndefined(e(this._getDocument().body).find("table:last")[0].nextSibling)||"#text"==e(this._getDocument().body).find("table:last")[0].nextSibling.nodeName.toLowerCase()&&"\n"==e.trim(e(this._getDocument().body).find("table:last")[0].nextSibling.nodeValue))&&e("


    ").insertAfter(e(this._getDocument().body).find("table")),e(this._getDocument().body).css("display",""),this._setAutoHeight()}},_onUpperCase:function(){if(document.getSelection){var i=(this._getWindow().getSelection(),this._saveSelection()),s=i.commonAncestorContainer,a=i.commonAncestorContainer.children;if(null!=a){var n=i.cloneContents(),o=this._changeCase(n,"Upper"),r=e(o).clone(),l=document.createElement("div");e(l).append(e(r)),null!=l.innerHTML&&""!=l.innerHTML&&this._getWindow().document.execCommand("inserthtml",!1,l.innerHTML)}else{var d=s.nodeValue.substring(i.startOffset,i.endOffset).toUpperCase(),h=s.nodeValue.substr(0,i.startOffset),c=s.nodeValue.substring(i.endOffset);s.nodeValue=h+d+c}}else{if("control"==this._getWindow().document.selection.type.toLowerCase())return;this._seleText=t.isNullOrUndefined(this._seleText)?"":this._seleText,this._getDocument().selection.createRange().pasteHTML(this._seleText.toUpperCase())}this._trigger("execute",{commandName:"uppercase"})},_changeCase:function(e,t){var i,s=e.childNodes;if(s.length>0)for(i=0;i=0;n--)s=a[n].tagName.toLowerCase(),"html"!=s?o+=" » "+s:r++;o+=" » "+this._curNode,e(i).parents().length>0&&(t.isNullOrUndefined(a[a.length-r])||(this._pTag=a[a.length-r].tagName.toLowerCase()))}this._tags=o,this._responsiveTagList()}},_responsiveTagList:function(){e(this._htmlInfo).html(this._tags),e(this._rteWapper).outerWidth()/gi,r=0,l=[];null!==(i=o.exec(e));)l.push(i[0].toString());for(s=[],s=l.slice(0),a=0;a0;r--)l[a]=l[a].replace(g[r],"");if(null==m&&null==p)l[a]=l[a].substr(0,l[a].length-2)+' src=""'+l[a].substr(l[a].length-2,l[a].length);else for(r=p.length-1;r>0;r--)l[a]=l[a].replace(p[r],"")}for(n=0;n0?this.enableToolbarItem("outdent"):this.disableToolbarItem("outdent")},_replaceHeightWidth:function(e,i){var s,a=e.exec(i);return t.isNullOrUndefined(a)||(s=a[0],s=s.replace(/\"/gi,"").replace("=",":")),this._tagCssReplace(s,i,a)},_typeXhtmlValidation:function(){var e=styleRegval[0];e='type="a"'==e?e.replace(/\"/gi,"").replace("=",":").replace("type","list-style-type").replace("a","lower-alpha"):'type="A"'==e?e.replace(/\"/gi,"").replace("=",":").replace("type","list-style-type").replace("A","upper-alpha"):'type="1"'==e?e.replace(/\"/gi,"").replace("=",":").replace("type","list-style-type").replace("1","decimal"):'type="i"'==e?e.replace(/\"/gi,"").replace("=",":").replace("type","list-style-type").replace("i","lower-roman"):'type="I"'==e?e.replace(/\"/gi,"").replace("=",":").replace("type","list-style-type").replace("I","upper-roman"):e.replace(/\"/gi,"").replace("=",":").replace("type","list-style-type")},_getCssXhtml:function(e,i){var s,a=e.exec(i);return t.isNullOrUndefined(a)||(s=a[0],s=s.replace(/\"/gi,"").replace("=",":").replace("valign","text-align").replace("align","text-align"),i=i.replace(a[0],'style="'+s+';"')),i},_styleXhtml:function(e){for(var i,s,a,n,o,r,l,d,h,c,u=/<((?:(?!\/)).)*?>/gi,m=[];null!==(i=u.exec(e));)m.push(i[0].toString());for(s=[],s=m.slice(0),c=0;c/gi,e)),e},_filerXhtmlNode:function(e,t){for(var i,s=[];null!=(i=e.exec(t));)s.push(i[0]);return s},_replaceXhtmlNode:function(e,t,i){for(var s=0;s).))*?"+a[i].substr(s,a[i].length);return this._replaceXhtmlNode(a,e,t)},_ptagXhtml:function(e){var t,i,s,a=/<\/p>((?:(?!/gi,n=[];if(null!=(t=a.exec(e)))for(;null!=(t=a.exec(e));)n.push(t[0]);for(i=[],i=n.slice(0),s=0;s/gi,"");return this._replaceXhtmlVal(a,t,i)},_replaceInputParams:function(e,t){var i,s,a,n=[];for(n=this._getUpdaeNodeXhtml(e,t,n),i=[],i=n.slice(0),s=0;s"),n[s]=n[s].substr(0,a)+"/"+n[s].substr(a,n[s].length-1);return this._replaceXhtmlVal(n,t,i)},_updateXhtml:function(){var e,i,s,a,n,o,r,l,d,h,c,u,m,p,g,_,f,b,v,x,w,y,C,S,T,D,I,k,P,L,R,M,O,E,A,j,N,z,F,B=this._getDocument().body.innerHTML;if(this.model.enableXHTML){if(B=B.replace(/hhh/g,"").replace(/
    /g,"
    ").replace(/contenteditable="false"/g,"").replace(/contenteditable="true"/g,"").replace(/ /g," ").replace(/
    /g,"
    ").replace(/cellspacing =[0-9]/g,"").replace(/cellpadding =[0-9]/g,""),this.value(B),this._xhtmlTagValidation(),B=this.value(),e=B.replace(/\s+/g," ").replace(/> <"),e.indexOf("/gi,V=[],i=0;null!=(xmlTemp=H.exec(e));)O=e.indexOf("/gi,d=[],d=this._getUpdaeNodeXhtml(l,e,d),h=[],h=d.slice(0),F=0;F/gi,"").replace(/<\/p>/gi,""),d[F].indexOf(""==d[F].charAt(O)&&0==a&&(d[F]=d[F].substr(0,s)+d[F].substr(O+1,d[F].length-1),a++);e=this._replaceXhtmlVal(d,e,h)}if(e.indexOf("(?!<\/td>)/gi,o=[],o=this._getUpdaeNodeXhtml(n,e,o),r=[],r=o.slice(0),F=0;F")!=-1&&(o[F]=o[F].replace("",""));for(e=this._replaceXhtmlVal(o,e,r),l=//gi,d=[],d=this._getUpdaeNodeXhtml(l,e,d),h=[],h=d.slice(0),F=0;F"),v=d[F].charAt(T-5)+d[F].charAt(T-4)+d[F].charAt(T-3)+d[F].charAt(T-2)+d[F].charAt(T-1),""!=v&&(d[F]=d[F].substr(0,T)+""+d[F].substr(T,d[F].length));e=this._replaceXhtmlVal(d,e,h)}if(e.indexOf("/gi,e=this._replaceInputParams(c,e),e=e.replace(/<\/input>/gi,"")),e.indexOf("/gi,e=this._replaceInputParams(c,e),e=e.replace(/<\/param>/gi,"")),e.indexOf("

    ")!=-1){if(u=//gi,m=[],m=this._getUpdaeNodeXhtml(u,e,m),p=[],p.slice(0),g=m[0].length-1,_=m[0],_.indexOf(""==(v=_.charAt(b)+_.charAt(b+1)+_.charAt(b+2)+_.charAt(b+3))&&F++,""==T&&0==y&&(C=S);_=_.substr(0,f+w)+"

    "+_.substr(f+w,-(f+w)+C+6)+"

    "+_.substr(C+6,_.length-1),F++}if(0==F){if(_.indexOf(""==T&&0==y&&(C=S);_=_.substr(0,f+w)+"

    "+_.substr(f+w,-(f+w)+C+8)+"

    "+_.substr(C+8,_.length-1),F++}0==F&&(_=_.substr(0,b-1)+"

    "+_.substr(b,_.length-1),g++,F++)}}for(_=_.replace(/<\/p><\/p>/gi,"

    "),D=[],D=m.slice(0),F=0;F<2;F++)_=this._ptagXhtml(_);for(I=//gi,k=[],k=this._getUpdaeNodeXhtml(I,_,k),P=[],P.slice(0),O=0;O/gi,k[O]=this._replaceTagUpdateXhtml(E,k[O],"

    ","

    ")),k[O].indexOf("/gi,k[O]=this._replaceTagUpdateXhtml(E,k[O],"

    ","

    "));_=this._replaceXhtmlVal(k,_,P),e=e.replace(p[0],_)}if(e.indexOf("/gi,R=[],R=this._getUpdaeNodeXhtml(L,e,R),M=[],sapnEX=R.slice(0),O=0;O/gi,R[O]=this._replaceTagUpdateXhtml(E,R[O],"","")),R[O].indexOf("/gi,R[O]=this._replaceTagUpdateXhtml(E,R[O],"","")),R[O].indexOf("/gi,R[O]=this._replaceTagUpdateXhtml(E,R[O],"",""));e=this._replaceXhtmlVal(R,e,M)}if(e.indexOf("/gi,e=this._replaceTagXHTML(A,e)),e.indexOf("<\/table>/gi,e=this._replaceTagXHTML(A,e)),e.indexOf("style")!=-1&&(A=/style="(.*?)"/gi,e=this._replaceTagXHTML(A,e)),t.isNullOrUndefined(this._fontXhtml(e))||(e=this._fontXhtml(e)),(e.indexOf("
    ")!=-1)&&(N=//gi,e=this._replaceUpdateXhtml(N,e,"
    ")),(e.indexOf("")!=-1)&&(N=//gi,e=this._replaceUpdateXhtml(N,e,"").replace(/<\/strong>/gi,"")),e.indexOf("/gi,e=this._replaceUpdateXhtml(N,e,"").replace(/<\/strong>/gi,"")),e.indexOf("/gi,e=this._replaceUpdateXhtml(N,e,'').replace(/<\/u>/gi,"")),e.indexOf("/gi,j=[],e=this._replaceUpdateXhtml(N,e,"


    ")),t.isNullOrUndefined(this._startXhtml(e))||(e=this._startXhtml(e)),e.indexOf("v:shapes=")!=-1&&(N=/v:shapes=\"(.*?)\"/gi,e=this._replaceUpdateXhtml(N,e,"")),e.indexOf("v:")!=-1&&(N=//gi,e=this._replaceUpdateXhtml(N,e,"")),e.indexOf("/v:")!=-1&&(N=/<\/v:(.*?)>/gi,e=this._replaceUpdateXhtml(N,e,"")),e.indexOf("o:")!=-1&&(N=//gi,e=this._replaceUpdateXhtml(N,e,"")),e.indexOf("/o:")!=-1&&(N=/<\/o:(.*?)>/gi,e=this._replaceUpdateXhtml(N,e,"")),e.indexOf("role=")!=-1&&(N=/role=\"(.*?)\"/gi,e=this._replaceUpdateXhtml(N,e,"")),e.indexOf("target=")!=-1&&(N=/target=\"(.*?)\"/gi,e=this._replaceUpdateXhtml(N,e,"")),e.indexOf("language=")!=-1&&(N=/language=\"(.*?)\"/gi,e=this._replaceUpdateXhtml(N,e,"")),e.indexOf("lang=")!=-1)for(N=/lang=\"(.*?)\"/gi,j=this._getUpdaeNodeXhtml(N,e,j),z=[],z=j.slice(0),F=0;F<\/td>/gi,"").replace(/<\/th><\/td>/gi,""),e="
    "+e+"
    ",B=e.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(B)}return B},_setClearFormat:function(){this._rteToolbar.find(".e-active").length},_updateToolbarStatus:function(){var t,i;try{if(t=!1,this.model.showToolbar){for(i=0;i";this._formatDDL.hasClass("e-dropdownlist")&&(t.isNullOrUndefined(i)||""==i?this._formatDDL.ejDropDownList({value:this._getLocalizedLabels("format")}):0==!e(this._formatDDL).parents("ul.e-rte-format").length&&this._formatDDL.ejDropDownList("setSelectedValue",i))}}catch(e){}},_updateFontOptionStatus:function(){var i,s;try{this.model.showFontOption&&this.model.showToolbar&&!t.isNullOrUndefined(this.model.tools.font)&&(i=e.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")&&0==!e(this._fontStyleDDL).parents("ul.e-rte-fontgroup").length&&this._fontStyleDDL.ejDropDownList("setSelectedValue",i),s=this._getCommandValue("fontsize"),(t.isNullOrUndefined(s)||""==s)&&(s=2),!t.isNullOrUndefined(this._fontSizeDDL)&&this._fontSizeDDL.hasClass("e-dropdownlist")&&0==!e(this._fontSizeDDL).parents("ul.e-rte-fontgroup").length&&this._fontSizeDDL.ejDropDownList("setSelectedValue",s))}catch(e){}},_getSelText:function(){var e,t,i,s="";return this._isIE()?s=this._seleText:window.getSelection?(e=this._getWindow().getSelection(),i=this._saveSelection(),t=document.createTextNode(i.toString()),s=t.nodeValue):document.getSelection&&(s=this._getWindow().document.getSelection()),s},_isIE:function(){var e=!1,i=t.browserInfo();return"msie"==i.name&&(e=!0),e},_isIE8:function(){var e=!1,i=t.browserInfo();return"msie"==i.name&&"8.0"==i.version&&(e=!0),e},_isUrl:function(e){return/(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/.test(e)},_pasteHtml:function(t){var i,s,a,n,o,r,l,d,h,c,u,m,p;if(this._pasteAPIFlag?this._isIE()&&this._focus():this._focus(),window.getSelection){if(i=this._getWindow().getSelection(),i.getRangeAt&&i.rangeCount){for(s=this._pasteFlag?this._pasteRangeVal:i.getRangeAt(0),a=s.commonAncestorContainer,n=3==a.nodeType?e(a).parentsUntil("body"):e(a).children(),u=n.length-1;u>=0;u--)if(n[u].textContent==s.toString()&&"li"!=n[u].nodeName.toLowerCase()){s.selectNode(n[u]);break}if(s.deleteContents(),o=document.createElement("div"),o.innerHTML=t,r=this._getDocument().createDocumentFragment(),h=o.firstChild,this._pasteFlag||this._pasteAPIFlag){for(;l=o.firstChild;)h!=l?d=h.appendChild(l):o.removeChild(o.firstChild);d=r.appendChild(h)}else for(;l=o.firstChild;)d=r.appendChild(l);s.insertNode(r),d&&(s=s.cloneRange(),s.setStartAfter(d),s.collapse(!0),i.removeAllRanges(),i.addRange(s))}}else if(this._getDocument().selection&&"Control"!=this._getDocument().selection.type)if(!this._ieSelectionRange||0==this._ieSelectionRange.offsetLeft&&0==this._ieSelectionRange.offsetTop&&0==this._ieSelectionRange.boundingHeight)this._getDocument().body.insertAdjacentHTML("afterBegin",t);else if(this._pasteFlag&&this.selectRange(this._pasteRangeVal),c=this._ieParents(this._getRange()),m=!1,this._pasteAPIFlag)this._getRange().pasteHTML(t);else{for(p=this._getRange().text,u=c.length-1;u>=0;u--)if(c[u].innerText==p&&"li"!=c[u].nodeName.toLowerCase()){"BODY"==c[u].nodeName?c[u].innerHTML=t:c[u].outerHTML=t,m=!0;break}m||this._getRange().pasteHTML(t)}this._pasteAPIFlag=this._pasteFlag=!1},_ieParents:function(e){var t=[];for(rangeval=this._isIE8()?e.duplicate():e.cloneRange(),e.parentElement=rangeval.parentElement();"HTML"!=e.parentElement.nodeName&&("TD"!=e.parentElement.nodeName&&"TH"!=e.parentElement.nodeName);)t.push(e.parentElement),e=e.parentElement;return t},_getLocalizedLabels:function(e){return t.RTE.Locale[this.model.locale][e]===s?t.RTE.Locale["en-US"][e]:t.RTE.Locale[this.model.locale][e]},_getSelectedNode:function(){var e,t=this._getRange(),i=this._ieSelectionRange&&0==t.offsetLeft&&0==t.offsetTop&&0==t.boundingHeight?this._ieSelectionRange:t,s=i.startContainer,a=i.endContainer,n=i.startOffset,o=i.endOffset;return i?i.setStart?(e=i.commonAncestorContainer,!i.collapsed&&(s==a&&o-n<2&&s.hasChildNodes()&&(e=s.childNodes[n]),3===s.nodeType&&3===a.nodeType&&(s=s.length===n?this._skipEmptyNode(s.nextSibling,!0):s.parentNode, a=0===o?this._skipEmptyNode(a.previousSibling,!1):a.parentNode,s&&s===a))?s:e&&3==e.nodeType?e.parentNode:e):i.item?i.item(0):i.parentElement():this._getDocument().selection},_skipEmptyNode:function(e,t){for(var i=e;e&&3===e.nodeType&&0===e.length;)e=t?e.nextSibling:e.previousSibling;return e||i},_getSelection:function(){var e;return this._isIE()?(e=this._getDocument().selection.createRange(),e.type=this._getDocument().selection.type):(e=window.getSelection(),e.rangeCount&&(sText=e.getRangeAt(0)),e.type=this._getWindow().getSelection().type),e},_saveSelection:function(){var e,t,i=this._getWindow(),s=i.document,a=i.getSelection?i.getSelection():s.selection;return a&&(a.createRange?e=a.createRange():a.rangeCount>0&&a.getRangeAt(0)?e=a.getRangeAt(0):a.anchorNode&&a.focusNode&&s.createRange?(e=s.createRange(),e.setStart(a.anchorNode,a.anchorOffset),e.setEnd(a.focusNode,a.focusOffset),e.collapsed!==a.isCollapsed&&(e.setStart(a.focusNode,a.focusOffset),e.setEnd(a.anchorNode,a.anchorOffset))):s.createRange()?(e=s.createRange(),e.setStart(i.document.body,0),e.setEnd(i.document.body,0)):(t=document.getElementsByTagName("iframe")[0],i=t.contentWindow,e=i.document.createRange(),e.setStart(i.document.body,0),e.setEnd(i.document.body,0))),e},_restoreSelection:function(e){var t=this._getWindow(),i=t.document,s=t.getSelection?t.getSelection():i.selection;s&&e&&(e.select?e.select():s.removeAllRanges&&s.addRange&&(s.removeAllRanges(),s.addRange(e)))},_getRange:function(){var e,i,s,a,n;if(this._isIE8())return e=this._saveSelection(),i=this._ieSelectionRange&&0==e.offsetLeft&&0==e.offsetTop&&0==e.boundingHeight?this._ieSelectionRange:e;if(this._isIE())return this._ieSelection=window.getSelection&&!t.isNullOrUndefined(this._selectionRange)&&this._selectionRange.length>0?this._selectionRange:this._saveSelection();if(this._getWindow().getSelection()&&this._getWindow().getSelection().rangeCount>0)return this._getWindow().getSelection().getRangeAt(0);s=document.getElementsByTagName("iframe")[0],a=s.contentWindow;try{n=a.document.createRange(),n.setStart(a.document.body,0),n.setEnd(a.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&&!e("#"+this._rteId+"_undo").hasClass("e-rteTooldisable")&&this._toolBarObj.enableItemByID(this._rteId+"_undo")},_getSelectedHtmlString:function(){var t,i,s,a,n,o,r,l;if("undefined"!=typeof document.selection&&this._isIE8()){for(t=this._ieParents(this._getRange()),i=!1,r=t.length-1;r>=0;r--)if(t[r].innerText==this._getRange().text){s="BODY"==t[r].nodeName?t[r].innerHTML:t[r].outerHTML,i=!0;break}return i||(s="<"==this._getRange().htmlText.substring(0,1)?this._getRange().text:this._getRange().htmlText),s}for(a=this._getRange(),n=a.commonAncestorContainer,o=3==n.nodeType?e(n).parentsUntil("body"):e(n).children(),r=o.length-1;r>=0;r--)if(""!=o[r].textContent&&o[r].textContent==a.toString()){a.selectNode(o[r]);break}return l=document.createElement("div"),l.appendChild(a.cloneContents()),l.innerHTML},_getText:function(){var e=this._getDocument().body;if(null!=e)return this._isIE()?e.innerText:e.textContent},_validateMaxLength:function(e){if(null!=this.model.maxLength){var t=this.model.maxLength,i=this._getText();t<=i.length&&(e.keyCode<47||e.ctrlKey&&65==e.keyCode||e.ctrlKey&&67==e.keyCode||e.ctrlKey&&86==e.keyCode||e.ctrlKey&&88==e.keyCode||(this._keypressFlag=!1,this._cancelEvent(e)))}},_cancelEvent:function(e){return e.returnValue=!1,e.stopPropagation(),e.preventDefault(),!1},_alignToolUpdate:function(e){for(var t=0;t0&&(this.model.enableHtmlEncode?this.setHtml(this._decode(this._backupArray[this._undoRedoPosition-1])):this.setHtml(this._backupArray[this._undoRedoPosition-1]),this._undoRedoPosition--,this._updateFontOptionStatus(),this._updateFormat(),this._updateCount(),this._toggleEditTable(),this.model.isResponsive&&this._toolBarObj._liTemplte.removeClass("e-display-none"),this._toolBarObj.enableItemByID(this._rteId+"_redo")),0==this._undoRedoPosition&&(this._toolBarObj.disableItemByID(this._rteId+"_undo"),this._toolBarObj.enableItemByID(this._rteId+"_redo")),this._focus(),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 e,i;this._undoRedoPosition!=this._backupArray.length&&(null!=this._backupArray[this._undoRedoPosition+1]?(e=this._getRedoContent(),this.setHtml(e),this._undoRedoPosition++):(i=this._getRedoContent(),t.isNullOrUndefined(i)||this.setHtml(i),this._undoRedoPosition=this._backupArray.length-2),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._focus(),this._trigger("execute",{commandName:"redo"})},_setContent:function(e){var i=this._getDocument();""==i||t.isNullOrUndefined(i)||(i.open(),i.write(e),i.close(),i.EditMode=!0)},_removeResizeObject:function(){e(this._getDocument()).find(".e-rteColumnResizer , .e-rteRowResizer , .e-rteLastcolumn").remove()},_tableMouseOver:function(i){("TABLE"==i.target.nodeName||"mozilla"===t.browserInfo().name&&"TD"==i.target.nodeName)&&(this._curTable="TD"==i.target.nodeName?e(i.target).closest("table")[0]:i.target,this._removeResizeObject(),e(this._getDocument()).find(".e-rte-tablebox").remove(),this._tableResizeObject(e(this._curTable)))},_preventDefaultResize:function(){var e=this._getDocument();"msie"===t.browserInfo().name&&"11.0"===t.browserInfo().version?e.body.addEventListener("mscontrolselect",this._ieDefaultTableHandler):this._isIE()&&e.body.attachEvent("oncontrolselect",this._ieTableHandler),"mozilla"===t.browserInfo().name&&(e.designMode="on",e.execCommand("enableObjectResizing",!1,"false"),e.execCommand("enableInlineTableEditing",!1,"false"))},_tableResizeObject:function(i){var s,a,n;for(this.model.allowEditing&&this._preventDefaultResize(),s=parseInt(e(i).attr("cellspacing")?e(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"),a=0;this._newcol.length>a;a++)e(this._getDocument().body).after('
    ');for(a=0;this._newRow.length>a;a++)e(this._getDocument().body).after('
    ');e(this._getDocument().body).after('
    '),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"},{}),n=i.find("tr:last td:last:not(:has(>span.e-rte-tablebox))"),n.length>0&&e(this._getDocument().body).after(e(this._botRigTab).css({left:parseInt(n.closest("table").width())+n.closest("table").offset().left+"px",top:parseInt(n.closest("table").height())+n.closest("table").offset().top+"px"}))},_ieDefaultTableHandler:function(e){e.preventDefault()},_ieTableHandler:function(){return!1},_tableCellStart:function(){this._tableInsertAt=this._saveSelection()},_tableCellSelect:function(i){var s,a=e(i.target),n=a.parent().index(),o=a.index();this._createTable.find("div.e-rte-tablecell").each(function(){s=e(this),s.index()<=o&&s.parent().index()<=n?s.addClass("e-active"):s.removeClass("e-active")}),this._tblheaderDiv.html(o+1+"x"+(n+1)+this._getLocalizedLabels("table")),e(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"),e(this._getDocument()).find("table.e-rte-tableremove").remove(),this._tblheaderDiv.html(this._getLocalizedLabels("createTable"))},_tableCellDown:function(i){var s,a=e(i.target),n=a.parent().index()+1,o=a.index()+1;this._focus(),e(this._getDocument()).find("table.e-rte-tableremove").remove(),t.isNullOrUndefined(this._tableInsertAt)||(this._restoreSelection(this._tableInsertAt),this._onInsertTable(n,o,!1)),s=e(this._getDocument()).find("table.e-rte-table"),this.model.enableRTL||this._on(s,"mouseover",this._tableMouseOver),s.attr({width:"99%"}),this._createTable.ejDialog("close"),this._setBackupData(),this._onChange(),this.model.isResponsive&&this._toolBarObj._liTemplte&&(this._toolBarObj._liTemplte.addClass("e-display-none"),this._toolBarObj.contstatus=!1)},_tableGenerator:function(e,i,s,a,n,o,r,l,d,h){var c="e-rte-table";switch(s&&(c+=" e-rte-tableremove"),a=t.isNullOrUndefined(a)||""==a?"width='100%'":"width='"+a+"'",n=t.isNullOrUndefined(n)||""==n?"":"height='"+n+"'",o=t.isNullOrUndefined(o)||""==o?"":"cellspacing='"+o+"'",r=t.isNullOrUndefined(r)||""==r?"":"cellpadding='"+r+"'",l=t.isNullOrUndefined(l)?"":" align='"+l+"'",d){case"dotted":borderstyle="dotted";break;case"double":return this._border="style='border:3px double #5C5C5C;'",borderstyle="double",""+(h?"":"")+Array(e+1).join(""+Array(i+1).join("")+"")+"

    ";case"dashed":borderstyle="dashed";break;case"solid":borderstyle="solid";break;default:borderstyle="solid"}return"double"!=borderstyle?(this._border="style='border:1px "+borderstyle+"#5C5C5C;'",""+(h?'':"")+Array(e+1).join(""+Array(i+1).join("")+"")+"


    "):""+(h?'':"")+Array(e+1).join(""+Array(i+1).join("")+"")+"


    "},_openCustomTable:function(t){t.currentTarget.id==this._rteId+"_createCustomTableLink"?(e("#"+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(),e("#"+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())},_createTableClose:function(i){!t.isNullOrUndefined(this._createTable)&&(!t.isNullOrUndefined(i)&&e(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]&&e(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?this._toolBarObj._liTemplte.removeClass("e-display-none"):!this.model.isResponsive||t.isNullOrUndefined(i)||e(i.target).is(e("#"+this._toolBarObj.element[0].id+"_target"))||0!=e(i.target).closest("div#"+this._toolBarObj.element[0].id+"_hiddenlist").length||e(i.target).parents().hasClass("e-ddl-popup")||this._toolBarObj._liTemplte.addClass("e-display-none")):e(this._createTable.find("div.e-rte-eTblProperties").hasClass("e-disable")).addClass("e-disable")},_documentClick:function(e){if(this._createTableClose(e),this._isIE()&&!window.getSelection){var t=e.target.id;""==t&&(t=e.target.parentNode.id),(t==this._rteId+"_fontSizeDDL"||t==this._rteId+"_fontNameDDL"||t==this._rteId+"_formatDDL"||t==this._rteId+"_fontSizeDDL_dropdown"||t==this._rteId+"_fontNameDDL_dropdown"||t==this._rteId+"_formatDDL_dropdown")&&this._restoreSelection(this._selectionRange)}},_iframeFocus:function(i){!t.isNullOrUndefined(this._createTable)&&this._createTable.ejDialog("isOpened")&&this._createTable.ejDialog("close"),0==!e(this._fontSizeDDL).parents("ul.e-rte-fontgroup").length&&!t.isNullOrUndefined(this._fontSizeDDL)&&this._fontSizeDDL.hasClass("e-dropdownlist")&&this._fontSizeDDL.ejDropDownList("hidePopup"),0==!e(this._fontStyleDDL).parents("ul.e-rte-fontgroup").length&&!t.isNullOrUndefined(this._fontStyleDDL)&&this._fontStyleDDL.hasClass("e-dropdownlist")&&this._fontStyleDDL.ejDropDownList("hidePopup"),0==!e(this._formatDDL).parents("ul.e-rte-format").length&&!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),this._contentBeforfocus=this.value()},_updateKeyDownSelectStatus:function(e,t){e.hasClass("e-active")?this._toolBarObj.deselectItemByID(this._rteId+"_"+t):this._toolBarObj.selectItemByID(this._rteId+"_"+t)},_iframeKeyDown:function(i){var s,a;if(this.model.showToolbar&&this.model.allowKeyboardNavigation&&i)if(i.ctrlKey)switch(65==i.keyCode?this._contolAKeyfalg=!0:t.isNullOrUndefined(this._contolAKeyfalg)?this._contolAKeyfalg:this._contolAKeyfalg=!1,a=this,i.keyCode){case 48:return i.preventDefault(),e(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"}),e(a._toolBarObj.itemsContainer.find(".e-rteItem-zoomIn")).attr("title",a._getLocalizedLabels("zoomIn")+" 100%"),e(a._toolBarObj.itemsContainer.find(".e-rteItem-zoomOut")).attr("title",a._getLocalizedLabels("zoomOut")+" 100%"),a._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(),s=this._toolBarItems.find("li.e-rteItem-bold"),s.hasClass("e-disable")||(this._onBold(),this._updateKeyDownSelectStatus(s,"bold")),!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():(s=this._toolBarItems.find("li.e-rteItem-italic"),s.hasClass("e-disable")||(this._onItalics(),this._updateKeyDownSelectStatus(s,"italic"))),!1;case 85:return i.preventDefault(),i.shiftKey?this._onUpperCase():(s=this._toolBarItems.find("li.e-rteItem-underline"),s.hasClass("e-disable")||(this._onUnderLine(),this._updateKeyDownSelectStatus(s,"underline"))),!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")),!1;case 82:return i.preventDefault(),i.altKey?this.removeRow():i.shiftKey?this._onClearFormat():(s=this._toolBarItems.find("li.e-rteItem-justifyRight"),s.hasClass("e-disable")||(this._onJustifyRight(),this._alignToolUpdate("justifyRight"))),!1;case 69:if(i.shiftKey)return i.preventDefault(),this._openCustomTable(i),!1;if(!this._toolBarItems.find("li.e-rteItem-justifyCenter").hasClass("e-disable"))return i.preventDefault(),this._onJustifyCenter(),this._alignToolUpdate("justifyCenter"),!1;break;case 74:if(!this._toolBarItems.find("li.e-rteItem-justifyFull").hasClass("e-disable"))return i.preventDefault(),this._onJustifyFull(),this._alignToolUpdate("justifyFull"),!1;break;case 90:if(!this._toolBarItems.find("li.e-rteItem-undo").hasClass("e-disable"))return i.preventDefault(),this._onUndo(),this._toolBarItems.find("li.e-rteItem-redo").removeClass("e-disable"),this._toolBarObj.deselectItemByID(this._rteId+"_redo"),!1;break;case 89:if(!this._toolBarItems.find("li.e-rteItem-redo").hasClass("e-disable"))return i.preventDefault(),this._onRedo(),this._toolBarItems.find("li.e-rteItem-undo").addClass("e-disable"),this._toolBarObj.deselectItemByID(this._rteId+"_undo"),!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;break;case 86:if(this._toolBarItems.find("li.e-rteItem-paste").hasClass("e-disable")||this.model.maxLength<=e.trim(this._getText()).length&&(!!t.isNullOrUndefined(this._contolAKeyfalg)||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++),!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),!1;break;case 190:if(i.shiftKey)return i.preventDefault(),this._changeFontsize(!0),!1;break;case 61:case 187:return i.preventDefault(),i.shiftKey?this._onSuperScript():this._onSubScript(),!1;case 79:if(i.shiftKey)return i.preventDefault(),this.executeCommand("insertorderedlist","listItem"),!1;if(i.altKey)return i.preventDefault(),this.executeCommand("insertunorderedlist","listItem"),!1;break;case 83:if(i.shiftKey)return i.preventDefault(),this._onStrikeThrough(),!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)return i.preventDefault(),this.insertColumn(!0),!1;break;case 39:if(i.shiftKey)return i.preventDefault(),this.insertColumn(!1),!1;break;case 38:if(i.shiftKey)return i.preventDefault(),this.insertRow(!0),!1;break;case 40:if(i.shiftKey)return i.preventDefault(),this.insertRow(!1),!1;break;case 65:if(i.altKey)return i.preventDefault(),this.removeTable(),!1;break;case 121:return i.preventDefault(),this._clearAllManager(),!1}else{if(9==i.keyCode&&this.model.enableTabKeyNavigation&&(this._isIE8()?"td"!=this._currentSelNode.nodeName.toLowerCase():"td"!=this._getSelectedNode().nodeName.toLowerCase()))return this._keypressFlag=!1,this.executeCommand("inserthtml","     "),!1;8==i.keyCode&&(ele=this._getSelectedNode(),e(ele).find("span#RTE_imgDupDiv").length>0&&e(this._imgDupDiv).remove(),e(ele).parents("BLOCKQUOTE").length>0&&(this._onOutdent(),i.preventDefault()))}else 1!=i.ctrlKey||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!=i.keyCode||this.model.allowKeyboardNavigation||i.preventDefault();if(!(null==this.model.maxLength||!t.isNullOrUndefined(this._contolAKeyfalg)&&this._contolAKeyfalg))try{!this._isIE8()||86!=i.keyCode||this.model.maxLength>=window.clipboardData.getData("Text").length+e.trim(this._getText()).length?this._validateMaxLength(i):i.preventDefault()}catch(e){}(this._isIE8()?"td"==this._currentSelNode.nodeName.toLowerCase():"td"==this._getSelectedNode().nodeName.toLowerCase())&&(ele=this._isIE8()?this._currentSelNode:this._getSelectedNode(),_newElementIndex=e(ele).parent().children().index(e(ele)),9!=i.keyCode||i.shiftKey||(_newElement=t.isNullOrUndefined(ele.nextSibling)?t.isNullOrUndefined(e(ele).parents("tr")[0].nextSibling)?t.isNullOrUndefined(e(ele).parents("table")[0].nextSibling)?ele:"td"==e(ele).parents("table")[0].nextSibling.nodeName.toLowerCase()?e(ele).parents("table")[0].nextSibling:ele:e(ele).parents("tr")[0].nextSibling.childNodes[0]:ele.nextSibling,this._setTableSelection(_newElement,i)),9==i.keyCode&&i.shiftKey?(_newElement=t.isNullOrUndefined(ele.previousSibling)?t.isNullOrUndefined(e(ele).parents("tr")[0].previousSibling)?t.isNullOrUndefined(e(ele).parents("table")[0].previousSibling)?ele:"td"==e(ele).parents("table")[0].previousSibling.nodeName.toLowerCase()?e(ele).parents("table")[0].previousSibling:ele:e(ele).parents("tr")[0].previousSibling.childNodes[e(ele).parents("tr")[0].previousSibling.childNodes.length-1]:ele.previousSibling,this._setTableSelection(_newElement,i)):40==i.keyCode?_newElement=t.isNullOrUndefined(e(ele).parents("tr")[0].nextSibling)?t.isNullOrUndefined(e(ele).parents("table")[0].nextSibling)||this._isIE8()?ele:e(ele).parents("table")[0].nextSibling:e(ele).parents("tr")[0].nextSibling.children[_newElementIndex]:38==i.keyCode&&(_newElement=t.isNullOrUndefined(e(ele).parents("tr")[0].previousSibling)?t.isNullOrUndefined(e(ele).parents("table")[0].previousSibling)||this._isIE8()?ele:e(ele).parents("table")[0].previousSibling:e(ele).parents("tr")[0].previousSibling.children[_newElementIndex]),9!=i.keyCode||ele!=_newElement||t.isNullOrUndefined(e(ele).parents("tr")[0].previousSibling)?(9==i.keyCode&&this._isIE8()||40==i.keyCode||38==i.keyCode)&&(this._setRange(_newElement,this._getRange(),!0),i.preventDefault()):(this.insertRow(!1),this._setRange(this._isIE8()?e(this._getRange().parentElement()).parents("tr").next().children().first()[0]:e(this._getRange().startContainer).parents("tr").next().children().first()[0],this._getRange(),!0),i.preventDefault()),this._isIE8()&&(this._currentSelNode=this._getRange().parentElement())),0==e(i.target).parents("table").length&&e(this._getDocument()).find(".e-rte-tablebox").remove(),this._setAutoHeight(),this._trigger("keydown",{keyCode:i.keyCode})},_changeFontsize:function(e){var t=parseInt(this._getCommandValue("fontsize"))?parseInt(this._getCommandValue("fontsize")):2;(!e&&t>this.model.fontSize[0].value||e&&t
    "),this.selectRange(this._getRange())),range=e(t.parentNode).position().top+parseInt(e(t.parentNode).css("height"))),"DIV"==t.nodeName&&(range=e(t).position().top+parseInt(e(t).css("height"))),range},_setAutoHeight:function(){this.model.autoHeight&&this.model.showToolbar&&!e(this._toolBarObj.itemsContainer.find(".resize")).length?this._autoHeight():t.isNullOrUndefined(this._getDocument())||e(this._getDocument().body).css("overflow","")},_autoHeight:function(){if(!t.isNullOrUndefined(this._getDocument().body)){e(this._getDocument().body).css("overflow","hidden");var i=t.isNullOrUndefined(this._getDocument().body.lastChild)?0:this._getDocument().body.lastChild.clientHeight+this._getDocument().body.lastChild.offsetTop;parseInt(e(this._rteWapper[0]).css("min-height"))-this._toolBarItems.outerHeight()<=i?e(this._rteIframe[0]).css("height",i+30+"px"):e(this._rteIframe[0]).css("height",parseInt(e(this._rteWapper[0]).css("min-height"))-this._toolBarItems.outerHeight()+"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?e(this._rteIframe[0]).css("height",this._rteIframe[0].contentDocument.documentElement.scrollHeight+20+"px"):e(this._rteIframe[0]).css("height",this._rteIframe[0].contentWindow.document.body.scrollHeight+20+"px")),this._rteWapper.outerHeight(this._rteEditor.outerHeight()+this._toolBarItems.outerHeight()+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(e){this._trigger("select",{event:e,model:this.model})},_iframeKeyUp:function(t){e(this._imgDupDiv).remove(),e(this._imgOrg).css("outline",""),this._toggleEditTable(),this._setBackupData(),t.ctrlKey&&(57==t.keyCode||189==t.keyCode)&&this._zoomUp(),this._updateToolbarStatus(),this._updateFontOptionStatus(),this._updateFormat(),this._updateCount();var i=this._isIE8()?this._currentSelNode:this._getSelectedNode();this.model.showToolbar&&(this._isIE8()?i.nodeName.toLowerCase():"a"!=i.nodeName.toLowerCase()?this.disableToolbarItem("removeLink"):this.enableToolbarItem("removeLink")),this._updateTagInfo(i),this._updateValue(),this._setAutoHeight(),this._ieSelRange(),this._trigger("keyup",{keyCode:t.keyCode}),this._iframeSelectionChange(t)},_iframeMouseUp:function(i){if(this._tableResizeUp(i),this._resizeBtnInit(),!t.isNullOrUndefined(this._imgDup)&&e(this._imgOrg).parents("body").length>0&&(e(this._imgOrg).css({width:e(this._imgDup).css("width"),height:e(this._imgDup).css("height")}),e(this._imgOrg).position({left:e(this._imgDup).position().left,top:e(this._imgDup).position().top}),e(this._imgDup).css("display","none"),this._resizeImgPos(),this._setAutoHeight()),"IMG"==i.target.nodeName||e(i.target).hasClass("e-rte-imageboxmark")||(e(this._imgOrg).css("outline",""),e(this._imgDupDiv).remove(),this._off(e(this._getDocument()),"mousemove",this._imgBoxMouseMove)),"IMG"==i.target.nodeName&&e(i.target).parents("body").length>0){var s=this._isIE8()?this._getDocument().body.createTextRange():this._getDocument().createRange();this._isIE8()?s.moveToElementText(i.target):s.selectNode(i.target),this.selectRange(s)}this._currentSelNode=i.target,this._toggleEditTable(),this._updateToolbarStatus(),i.button?isRightClick=2==i.button:i.which&&(isRightClick=3==i.which),isRightClick||(this._updateFormat(),this._updateFontOptionStatus()),this._ieSelRange(),this._iframeSelectionChange(i),this._fontStyleDDL&&!t.isNullOrUndefined(this._fontStyleDDL.data("ejDropDownList"))&&this._fontStyleDDL.ejDropDownList("instance")._isPopupShown()&&e(this._fontStyleDDL.ejDropDownList("instance").popupList.ejScroller("instance").element).trigger("mouseup"),this._fontSizeDDL&&!t.isNullOrUndefined(this._fontSizeDDL.data("ejDropDownList"))&&this._fontSizeDDL.ejDropDownList("instance")._isPopupShown()&&e(this._fontSizeDDL.ejDropDownList("instance").popupList.ejScroller("instance").element).trigger("mouseup"),i.currentTarget&&i.target.nodeName&&"html"==i.target.nodeName.toLowerCase()&&this._getDocument()&&this._getDocument().body&&(i.currentTarget.createRange&&this._setRange(this._getDocument().body,i.currentTarget.createRange()),this._getDocument().body.focus())},_iframeMouseDown:function(i){return"mozilla"===t.browserInfo().name&&(this._getDocument().designMode="off"),"msie"==t.browserInfo().name&&"8.0"==t.browserInfo().version&&this._focus(),this._contolAKeyfalg=!1,this._updateTagInfo(i.target),this._updateIndent(i.target),this.model.showToolbar&&("A"!=i.target.nodeName?this.disableToolbarItem("removeLink"):this.enableToolbarItem("removeLink")),"VIDEO"==i.target.nodeName&&this.model.allowEditing&&this._preventDefaultResize(),"IMG"==i.target.nodeName&&this.model.allowEditing&&(this._preventDefaultResize(),this._imageClick(i.target)),e(i.target).hasClass("e-rte-imageboxmark")?(this._resizeBtnInit(),this._commonBoxDown=!0,e(i.target).hasClass("e-rte-rigmed")&&(this._rigMidBox=!0),e(i.target).hasClass("e-rte-toplef")&&(this._topLefBox=!0),e(i.target).hasClass("e-rte-topmed")&&(this._topMidBox=!0),e(i.target).hasClass("e-rte-toprig")&&(this._topRigBox=!0),e(i.target).hasClass("e-rte-lefmed")&&(this._lefMidBox=!0),e(i.target).hasClass("e-rte-botlef")&&(this._botLefBox=!0),e(i.target).hasClass("e-rte-botmid")&&(this._botMidBox=!0),e(i.target).hasClass("e-rte-botrig")&&(this._botRigBox=!0),!1):(e(i.target).hasClass("e-rteColumnResizer")&&(this._lastCol=!!e(i.target).hasClass("e-rtelastcol"),this._columnEle=e(this._curTable).find("tr:first td").eq(parseInt(e(i.target).attr("data-col")))[0],this._columnDown=!0,this._columnIndex=this._columnEle.cellIndex,e(this._getDocument().body).after("")),e(i.target).hasClass("e-rteRowResizer")&&(this._rowEle=e(this._curTable).find("tr").eq(parseInt(e(i.target).attr("data-row")))[0],this._rowDown=!0),e(i.target).hasClass("e-rte-tablebox")&&(this._boxDown=!0,this._boxElement=this._curTable),(e(i.target).hasClass("e-rte-tablebox")||e(i.target).hasClass("e-rteRowResizer")||e(i.target).hasClass("e-rteColumnResizer"))&&this._on(e(this._getDocument()),"mousemove",this._imgBoxMouseMove),("msie"==t.browserInfo().name||"chrome"==t.browserInfo().name)&&1==i.ctrlKey&&1==i.which&&("A"!=i.target.tagName.toUpperCase()||t.isNullOrUndefined(e(i.target).attr("href"))||window.open(e(i.target).attr("href"),"_blank")), this.model.isResponsive&&!t.isNullOrUndefined(this._toolBarObj)&&this._toolBarObj._liTemplte.children("ul").length>0&&(this._toolBarObj.contstatus=!0,this._toolBarObj._liTemplte.addClass("e-display-none"),this._toolBarObj.contstatus=!1),void this._iframeFocus())},_iframeFocusOut:function(){_proxy._onChange(),_proxy._selectionRange=_proxy._isIE8()?_proxy._getRange():_proxy._saveSelection(),_proxy._seleText=t.isNullOrUndefined(_proxy._getWindow().document.selection)?_proxy._selectionRange.toString():_proxy._isIE8()?_proxy._getWindow().document.selection.createRange().text:_proxy._getWindow().getSelection().toString()},_widthFocusOut:function(){var t,i,s;this._customTableDialog.ejDialog("isOpen")?(t=this._customTableDialog,i="#"+this._rteId+"_ddlAlignment",s="#"+this._rteId+"_txtWidth"):(t=this._eTblDialog,i="#"+this._rteId+"_eTblAlign",s="#"+this._rteId+"_eTblWidth");var a=t.find(s).val(),n=e(i).data("ejDropDownList"),o=!((!a||""==a||isNaN(a))&&"px"!=a.slice(-2)&&"em"!=a.slice(-2)&&"pt"!=a.slice(-2)&&"%"!=a.slice(-1));n.option("enabled",o)},_windowResize:function(){this._setAutoHeight(),this._setIframeHeight()},_tableResizeUp:function(){e(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&&e(this).width(parseInt(e(this).closest("table").width()/(e(this).siblings().length+1)))}),this._currentTable.eq(this._columnIndex).width(this.lasColIndexWid),this._currentTable.closest("table").attr({width:""}),e(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(),e(this._getDocument()).find(".colresizerline").remove(),this._restoreSelection(this._tableSelection),this._columnDown=!1,this._rowDown=!1,this._boxDown=!1,this._columnDownClick=!1):(e(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(),e(this._getDocument().body).after(this._imgDupDiv),e(i).css({outline:"1px dashed #5C5C5C"}),this._on(e(this._getDocument()),"mousemove",this._imgBoxMouseMove)},_resizeImgPos:function(){this._ltPos=e(this._imgOrg).position(),this._imgWid=e(this._imgOrg).css("width"),this._imgHgt=e(this._imgOrg).css("height"),this._imgDup.css({width:this._imgWid,height:this._imgHgt,left:this._ltPos.left+"px",top:this._ltPos.top+"px",border:e(this._imgOrg).css("border")}),this._imgDup.attr({src:e(this._imgOrg).attr("src")});var t=parseInt(e(this._imgOrg).css("width"))-2+this._ltPos.left,i=(parseInt(e(this._imgOrg).css("width"))-2)/2+this._ltPos.left,s=parseInt(e(this._imgOrg).css("height"))-2+this._ltPos.top,a=(parseInt(e(this._imgOrg).css("height"))-2)/2+this._ltPos.top,n=parseInt(""==e(this._imgOrg).css("border-width")?0:e(this._imgOrg).css("border-width"));e(this._rigMid).css({left:t+2*n+"px",top:a+"px"}),e(this._botLef).css({left:this._ltPos.left-3+"px",top:s+2*n+"px"}),e(this._botRig).css({left:t+2*n+"px",top:s+2*n+"px"}),e(this._botMid).css({left:i+"px",top:s+2*n+"px"}),e(this._topRig).css({left:t+2*n+"px",top:this._ltPos.top-3+"px"}),e(this._topLef).css({left:this._ltPos.left-3+"px",top:this._ltPos.top-3+"px"}),e(this._topMid).css({left:i+"px",top:this._ltPos.top-3+"px"}),e(this._leftMid).css({left:this._ltPos.left-3+"px",top:a+"px"})},_resizeImgDupPos:function(){this._ltDupPos=e(this._imgOrg).position(),this._imgMidWid=e(this._imgOrg).css("width"),this._imgDupHgt=e(this._imgOrg).css("height")},_imgBoxMouseMove:function(i){var s,a;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),e(this._imgDup).offset({left:i.pageX})):this._topMidBox?(this._imgDupMouseMove(this._img_wid,parseInt(this._imgDupHgt)+this._ltDupPos.top-i.pageY+"px",i),e(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),e(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),e(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),e(this._imgDup).offset({top:i.pageY,left:i.pageX}));else if(this._columnDown){this._columnDownClick=!0,this._currentTable=e(this._columnEle).closest("table").find("tr:first td");var n=""==this._columnEle.style.width?e(this._columnEle).width():parseInt(this._columnEle.style.width),o=e(this._columnEle).offset().left,r=o>i.pageX?n+(o-i.pageX):n-(i.pageX-o),l=""==e(this._currentTable).eq(this._columnIndex-1)[0].style.width?e(e(this._currentTable).eq(this._columnIndex-1)).width():parseInt(e(this._currentTable).eq(this._columnIndex-1)[0].style.width),d=n+l;!this._lastCol&&r>15&&d-r>15?(this.nexColIndexWid=d-r,this._columnIndexWid=r,e(this._getDocument()).find(".colresizerline").css({left:i.pageX+"px"})):this._lastCol&&o15&&(this.lasColIndexWid=i.pageX-o,e(this._getDocument()).find(".colresizerline").css({left:i.pageX+"px"})),this._removeMouseSelection(i),e(this._columnEle).closest("table").find("tr:last td:last span.e-rte-tablebox").css({display:"none"})}else this._rowDown?(("chrome"===t.browserInfo().name||"mozilla"===t.browserInfo().name)&&(select=this._getDocument().getSelection().removeAllRanges()),s=this._rowEle.offsetTop,a=this._rowEle.parentElement.parentElement.offsetTop,i.pageY-(s+a)>20&&(this._rowEle.style.height=i.pageY-(s+a)+"px"),this._removeMouseSelection(i),e(this._getDocument()).find(".e-rte-tablebox").css({left:e(this._rowEle).closest("table").width()+e(this._rowEle).closest("table").offset().left+"px",top:e(this._rowEle).closest("table").height()+e(this._rowEle).closest("table").offset().top+"px"})):this._boxDown&&(("chrome"===t.browserInfo().name||"mozilla"===t.browserInfo().name)&&this._getDocument().getSelection().removeAllRanges(),e(this._boxElement).attr({width:(i.pageX-e(this._boxElement).offset().left)/e(this._boxElement).parent().width()*100+"%",height:(i.pageY-e(this._boxElement).offset().top)/e(this._boxElement).parent().height()*100+"%"}),e(this._getDocument()).find(".e-rte-tablebox").css({left:e(this._boxElement).width()+e(this._boxElement).offset().left+"px",top:e(this._boxElement).height()+e(this._boxElement).offset().top+"px"}),e(this._boxElement).find("tr:first td").each(function(){e(this).width(parseInt(e(this).closest("table").width()/(e(this).siblings().length+1)))}),this._removeMouseSelection(i))},_removeMouseSelection:function(e){return"mozilla"===t.browserInfo().name&&this._getDocument().getSelection().removeAllRanges(),e.stopPropagation&&e.stopPropagation(),e.preventDefault&&e.preventDefault(),e.cancelBubble=!0,e.returnValue=!1,!1},_imgDupMouseMove:function(t,i,s){e(this._imgDup).css({display:"block",width:t,height:i}),this._resizeImgDupPos(),this._isIE8()&&this._removeMouseSelection(s)},_imageClick:function(t){e(this._getDocument().body).find("img").css("outline",""),this._imgDupDiv&&this._imgDupDiv.remove(),this._imgSpanBox(t)},_iframePaste:function(i){var s,a,n,o=this;try{s=t.isNullOrUndefined(window.clipboardData)?i.originalEvent.clipboardData.getData("text/plain"):window.clipboardData.getData("Text"),0!=s.length?o.model.maxLength>=s.length+e.trim(o._getText()).length||i.preventDefault():(a=i.originalEvent.clipboardData.items[0].getAsFile(),n=new FileReader,n.onload=function(e){o.executeCommand("inserthtml","")},n.readAsDataURL(a))}catch(e){}setTimeout(function(){o._updateValue(),o._setAutoHeight(),o._updateCount()},0)},_wireEvents:function(){var i=e(this._getDocument());""!=this._getDocument()&&(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(e(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(i,"paste",this._iframePaste)._on(e(window),"resize",this._windowResize),_proxy=this,t.isNullOrUndefined(document.getElementById(this._id+"_Iframe"))||e(document.getElementById(this._id+"_Iframe").contentWindow).on("blur",this._iframeFocusOut),t.isNullOrUndefined(this._customTableDialog)||this._on(this._customTableDialog.find(".e-rte-txtWidth"),"focusout",this._widthFocusOut))},_unwireEvents:function(){var i=e(this._getDocument());t.isNullOrUndefined(this._createTable)||this._off(this._createTable.find("div.e-rte-tablecell"),"mousemove")._off(this._createTable.find("div.e-rte-table"),"mouseleave")._off(this._createTable.find("div.e-rte-tablecell"),"mousedown")._off(e(document),"click",this._documentClick),this._off(i,"focus")._off(i,"keydown")._off(i,"keyup")._off(i,"mouseup")._off(i,"mousedown")._off(e(window),"resize",this._windowResize),e(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(e){this[e](this._htmlSource,"click",this._sourceCodeManager),this[e](this._clearFormat,"click",this._onClearFormat),this[e](this._clearAll,"click",this._clearAllManager)},_onChange:function(){if(_prevhtml=e.trim(this.value()),this.model.enableXHTML&&(this._updateXhtml(),this.model.enableHtmlEncode&&this.value(this._encode(this.value()))),_prevhtml!==this.getHtml()||!t.isNullOrUndefined(this._contentBeforfocus)&&e.trim(this._contentBeforfocus)!==this.getHtml()){this._updateValue();var i={text:this._getText(),htmlText:this.getHtml(),isInteraction:this._isInteraction};this._contentBeforfocus=this.value(),this._trigger("change",i),this._isInteraction=!0}},_disableIframeContent:function(){try{this._rteIframe.contents().find("body,[contenteditable='true']").attr("contenteditable",!1)}catch(e){}},disable:function(){this.model.enabled=!1,this._showHideContextMenu(),this.element.attr("disabled","disabled"),this._unwireEvents(),this.model.showToolbar&&this._toolBarObj.disable(),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(),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)||0==e(this._toolBarObj.target).find("#"+this._rteId+"_"+i).length&&0==e(this._toolBarObj._liTemplte).find("#"+this._rteId+"_"+i).length?this._toolBarObj.disableItemByID(i):this._toolBarObj.disableItemByID(this._rteId+"_"+i),"undo"==i&&e("#"+this._rteId+"_"+i).addClass("e-rteTooldisable")},enableToolbarItem:function(i){t.isNullOrUndefined(i)||0==e(this._toolBarObj.target).find("#"+this._rteId+"_"+i).length&&0==e(this._toolBarObj._liTemplte).find("#"+this._rteId+"_"+i).length?this._toolBarObj.enableItemByID(i):this._toolBarObj.enableItemByID(this._rteId+"_"+i),"undo"==i&&e("#"+this._rteId+"_"+i).hasClass("e-rteTooldisable"),e("#"+i).removeClass("e-rteTooldisable")},removeToolbarItem:function(e){t.isNullOrUndefined(e)||this._toolBarObj.removeItemByID(this._rteId+"_"+e),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()},hide:function(){this._rteWapper.hide()},setColorPickerType:function(e){"palette"==e||"picker"===e?this._imgPicker.option("modelType",e):this._imgPicker.option("modelType","default")},pasteContent:function(e){this._pasteAPIFlag=!0,this._pasteHtml(e),this._onChange()},getDocument:function(){return this._getDocument()},getHtml:function(t){if(this.model.enableXHTML)return this.model.enableHtmlEncode&&0==t?e.trim(this._decode(this.value())):e.trim(this.value());try{return this.model.enableHtmlEncode?0==t?e.trim(this._getDocument().body.innerHTML):this._encode(e.trim(this._getDocument().body.innerHTML)):e.trim(this._getDocument().body.innerHTML)}catch(e){return""}},setHtml:function(t){this._getDocument().body.innerHTML="",this._getDocument().body.innerHTML=e.trim(t),this._onChange()},getText:function(){return this._getText()},executeCommand:function(i,s){if(this._isIE8()&&t.isNullOrUndefined(this._ieSelectionRange)?this._ieSelectionRange=this._getRange():this._isIE()&&"inserthtml"==i.toLowerCase()&&!this._isIE8()&&("body"!=this._getRange().startContainer.nodeName.toLowerCase()?this._currentSelNode=this._getRange().startContainer:this._ieLinkRange()),this._trigger("execute",{commandName:i}))return!1;var a="";if("chrome"==t.browserInfo().name&&0==this._getWindow().getSelection().rangeCount&&this._restoreSelection(this._saveSelection()),"underline"==i){if(window.getSelection&&(a=e(this._getWindow().getSelection().anchorNode).parents("a"),a.length>0))return void e(a).css("text-decoration","none"==e(a).css("text-decoration")?"underline":"none")}else{if("inserthtml"==i.toLowerCase())return void(this._isIE()?this._pasteHtml(s):this._getDocument().execCommand(i,!1,s));"formatblock"==i.toLowerCase()&&this._isIE()&&"<"!=s.charAt(0)&&">"!=s.charAt(s.length-1)&&(s="<"+s+">")}"msie"==t.browserInfo().name&&this._focus(),this._isIE()&&"fontName"==i&&(s=s.substring(0,s.indexOf(","))),this._getDocument().execCommand(i,!1,s),this._onChange(),"fontName"==i||"fontSize"==i||"indent"==i||"cut"==i||"copy"==i||"paste"==i||"undo"==i||"redo"==i||"outdent"==i||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)),"listItem"!=s&&this._setBackupData()},focus:function(){this._focus()},getCommandStatus:function(e){if(t.isNullOrUndefined(e)||""!=e)return this._getCommandStatus(e)},getSelectedHtml:function(){return this._getSelectedHtmlString()},insertMenuOption:function(t){if(t.newItem&&t.targetItem&&t.insertType&&t.menuType){var s,a=this._textMenuObj,n=t.newItem,o=t.spriteCssClass?[{text:t.newItem,id:n,spriteCssClass:t.spriteCssClass}]:[{text:t.newItem,id:n}];for(i=0;ie.trim(this._getText()).length){var a=t.isNullOrUndefined(s)?this._getSelectedNode():s,n="
    ",o=e(a).closest("tr"),r=o.find("td").length,l=e(""+Array(r+1).join(n)+"");return i?l.insertBefore(o):l.insertAfter(o),l.find("td:first").focus(),this._setAutoHeight(),a}},insertColumn:function(i,s){var a;if(null!=this.model.maxLength&&this.model.maxLength>e.trim(this._getText()).length){var n,o=t.isNullOrUndefined(s)?this._getSelectedNode():s,r="
    ",l=e(o).closest("tr"),d=l.closest("table").find("tr"),h=l.find("td").index(o);for(a=0;a").text(t).html()},_decode:function(e){return e.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(e,i,s){this._isIE8()?t.isNullOrUndefined(e)||(i.collapse(!0),i.moveToElementText(e),i.moveStart("character",1),i.select()):(i.setStart(e,0),i.collapse(!0),"msie"==t.browserInfo().name&&"11.0"!=t.browserInfo().version&&t.isNullOrUndefined(s)?t.isNullOrUndefined(s)&&(selection=this._getDocument().body.createTextRange(),selection.moveToElementText(e)):this.selectRange(i))},removeColumn:function(i){var s,a=t.isNullOrUndefined(i)?this._getSelectedNode():i,n=this._getRange(),o=e(a).closest("tr"),r=o.closest("table").find("tr"),l=o.find("td").index(a),d=t.isNullOrUndefined(a.nextElementSibling)?e(a.previousSibling)[0]:e(a.nextElementSibling)[0];if(t.isNullOrUndefined(d))e(a).parent("tr").parents("table").remove();else for(s=0;s0?r.ejButton("enable"):r.ejButton("disable"),this._highlightNode(++this._selectedIndex,o),this._updateBtnStatus(this._selectedIndex,l)):(e.merge(l,r).ejButton("disable"),this._findObject.revertAll(),e(this._findDialog.element).children("span").html(this._getLocalizedLabels("FindErrorMsg")))):this._findObject.nodeCollection.length&&this._findObject.revertAll();break;case"next":this._selectedIndex0&&this._highlightNode(--this._selectedIndex,o),this._updateBtnStatus(this._selectedIndex,l);break;case"replace":this._findObject.replaceByIndex(this._selectedIndex,n),this._findObject.nodeCollection.length?this._selectedIndex>this._findObject.nodeCollection.length-1&&--this._selectedIndex:this._selectedIndex=-1,this._selectedIndex>-1?(this._highlightNode(this._selectedIndex,o),this._updateBtnStatus(this._selectedIndex,l)):e.merge(l,r).ejButton("disable"),this._setBackupData();break;case"replaceAll":this._findObject.replaceAll(n),this._selectedIndex=-1,e.merge(l,r).ejButton("disable"),this._setBackupData()}this._updateCount()},_updateBtnStatus:function(t,i){t0?e(i[0]).ejButton("enable"):e(i[0]).ejButton("disable")},_highlightNode:function(i,s){var a,n;for(e(s).find(".e-highlight").removeClass("e-highlight"),a=0;a
    "+this._getLocalizedLabels("Find")+"
    "+this._getLocalizedLabels("ReplaceWith")+"
    ";i._findDialog=e(s).ejDialog({width:380,close:this._onCloseFindAndReplace,cssClass:"e-rte e-findandreplace",enableRTL:i.model.enableRTL,enableResize:!1,enableModal:!0}).data("ejDialog"),e(i._findDialog.element).find("input[type=text]").ejMaskEdit({width:"100%",enableRTL:i.model.enableRTL}),e(i._findDialog.element).find("input[type=text]").val(""),e(i._findDialog.element).find("button").ejButton({height:30}),e(i._findDialog.element).find("[ej-function='replace'],[ej-function='replaceAll'],[ej-function='prev'],[ej-function='next']").ejButton("disable"),e(i._findDialog.element).find("[ej-function='prev'],[ej-function='next']").ejButton({height:30,width:30,contentType:"imageonly"}),e(i._findDialog.element).find("[ej-function='prev']").ejButton({prefixIcon:"e-chevron-left_02"}).next().ejButton({prefixIcon:"e-chevron-right_02"}),e(i._findDialog.element).find("[ej-function='wholeWords'],[ej-function='matchCase']").ejCheckBox({enableRTL:i.model.enableRTL}),this._findObject=new t.FindAndReplace,this._on(i._findDialog.element.find("button"),"click",this._findAndReplaceClick)},_onCloseFindAndReplace:function(){e("#"+this._id.replace("_basicDialog","")).data("ejRTE")._findObject.revertAll(),e(this.element).find("[ej-function='replace'],[ej-function='replaceAll'],[ej-function='prev'],[ej-function='next']").ejButton("disable"),e(this.element).find("input[type=text]").val(""),e(this.element).find("[ej-function='wholeWords'],[ej-function='matchCase']").ejCheckBox({checked:!1}),e(this.element).children("span").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=[]},ej.FindAndReplace.prototype.find=function(e,t,i,s){return this.nodeCollection.length&&this.revertAll(),this._validateTextContent(e,this._getFormatedText(t),i,s),!!this.matches.length&&(this._iterateNodes(t), this.matches=[],!0)},ej.FindAndReplace.prototype._replace=function(e,t){for(var i=0;i=t.startIndex||t.startIndex=t.endIndex)o=ej.buildTag("span.e-selected-node").append(document.createTextNode(i.data))[0],$(i).replaceWith(o),this.elements.push({node:o});else if(e.startIndex<=t.startIndex&&e.endIndext.startIndex&&e.endIndex>=t.endIndex)s=e.startIndex-t.startIndex,o=ej.buildTag("span.e-selected-node").append(document.createTextNode(n.substr(s)))[0],$(o).insertAfter(i),i.data=n.substr(0,s),this.elements.push({node:o});else if(e.startIndex>t.startIndex&&e.endIndext.startIndex&&e.endIndex<=t.endIndex,curNode:o}},ej.FindAndReplace.prototype._getFormatedText=function(e){var t="";if(3===e.nodeType)return e.data.replace(/\n/g," ");if(e=e.firstChild)do t+=3===e.nodeType?e.data.replace(/\n/g," "):this._getFormatedText(e);while(e=e.nextSibling);return t},ej.FindAndReplace.prototype._iterateNodes=function(e){temp=this,$(this.matches).each(function(t,i){temp._traverseNode(e,i),temp.nodeCollection.push(temp.elements),temp.indexLength=0,temp.elements=[]})}}(),ej.RTE.FindAndReplace&&$.extend(ej.RTE.prototype,ej.RTE.FindAndReplace),function(e,t){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",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",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(e){for(var s in e)switch(s){case"enableOpacity":this.model.enableOpacity=e[s],this._previewSlider(this.model.enableOpacity),this._valueOperation();break;case"opacityValue":if(this.model.enableOpacity){this._tempOpacity=parseFloat(t.util.getVal(e[s])),this._changeOpacity(),this._opacity.option("value",this._tempOpacity),this._updateValue(),this.opacityValue(this._tempOpacity),"function"==typeof e[s]?e[s](this.opacityValue()):e[s]=this.opacityValue();break}return!1;case"custom":this.model.custom=e[s],this._reInitialize();break;case"palette":this.model.palette=e[s],this._reInitialize();break;case"columns":this.model.columns=parseFloat(e[s]),this._reInitialize(),e[s]=this.model.columns;break;case"presetType":if(this.model.presetType=e[s],t.isNullOrUndefined(i[this.model.presetType]))return!1;this._reInitialize();break;case"buttonMode":this._unBindIconClick(),this._buttonElement=t.ColorPicker.ButtonMode.Split==e[s]?this.dropdownbutton:this.wrapper,t.ColorPicker.ButtonMode.Split==e[s]?this.wrapper.addClass("e-split"):this.wrapper.removeClass("e-split"),this._bindIconClick();break;case"showTooltip":this._colorSlider.option("showTooltip",e[s]),this._opacity.option("showTooltip",e[s]);break;case"value":this._setValue(t.util.getVal(e[s]),!0),"function"==typeof e[s]?e[s](this.value()):e[s]=this.value();break;case"modelType":this.model.modelType=e[s],this._reInitialize();break;case"showSwitcher":this.model.showSwitcher=e[s],this._showSwitcher();break;case"tooltipText":this._toolTipText(e[s]);break;case"showPreview":this.model.showPreview=e[s],this._previewPane(this.model.showPreview);break;case"buttonText":this._buttonText(e[s]);break;case"displayInline":this._setDisplayInline(e[s]);break;case"cssClass":this._setSkin(e[s]),this.model.cssClass=e[s];break;case"enabled":this._enabled(e[s]);break;case"showRecentColors":this.model.showRecentColors=e[s],this._previewColor(this.model.showRecentColors);break;case"htmlAttributes":this._addAttr(e[s]);break;case"showClearButton":this._showClearIcon(e[s]);break;case"showApplyCancel":this.model.showApplyCancel=e[s],this._buttonContainer()}},_setSkin:function(e){this.wrapper?this.wrapper.removeClass(this.model.cssClass).addClass(e):this.element.removeClass(this.model.cssClass).addClass(e)},_showSwitcher:function(){this.model.showSwitcher?(this._changeTag.removeClass("e-hide"),"picker"==this.model.modelType?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(),"default"==this.model.modelType?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-color-image e-"+this.model.presetType),this.popupList.prepend(this.PaletteWrapper),this._showSwitcher()},_reInitialize:function(){this._destroyPalette(!1)},_destroyPalette:function(e){this.PaletteWrapper.remove(),(e||this._columns!=this.model.columns&&"custompalette"!==this.model.palette)&&(this.PaletteWrapper=this._presetType(this._presetsId)),this._temp!==this.model.presetType&&(this.PaletteWrapper=this._layoutType(this.model.palette)),"palette"==this.model.modelType&&(this._modelType="palette",this.PaletteWrapper=this._layoutType(this.model.palette),this._hideUnBindEvents(),this.isPopupOpen&&this._showBindEvents(),this._gradient.addClass("e-hide"),this._paletteType(),e||"custompalette"==this.model.palette?"":this._splitObj.option("prefixIcon","e-color-image e-"+this.model.presetType)),"picker"==this.model.modelType&&(this._pickerType(),this.model.displayInline&&!this.element.is("input")&&this._footer.addClass("e-hide")),this._temp=this.model.presetType,this._columns=this.model.columns,"picker"==this._modelType?this._presetTag.parents(".e-split.e-widget").addClass("e-hide"):this._presetTag.parents(".e-split.e-widget").removeClass("e-hide"),this.refresh()},_previewColor:function(e){e?(this._swatchesArea.fadeIn(200),this._bindRecentEvent()):(this._swatchesArea.fadeOut(200),this._unBindRecentEvent())},_buttonText:function(t){e.extend(this.model.buttonText,t),this._buttonTag.html(this.model.buttonText.apply),this._cancelTag.html(this.model.buttonText.cancel),this._spnTag.html(this.model.buttonText.swatches)},_toolTipText:function(t){e.extend(this.model.tooltipText,t),this._addTitleText()},_previewPane:function(e){e?this._previewTag.removeClass("e-hide"):this._previewTag.addClass("e-hide")},_previewSlider:function(e){e?this._opacity.enable():this._opacity.disable()},_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")},_init:function(){this._browser=t.browserInfo(),this._isFocused=!1,this.isPopupOpen=!1,this._dataBind=!1,this._modelType="picker",this._id&&e("#"+this._id+"_popup").remove(),"#"+this._id+"_Presets"&&e("#"+this._id+"_Presets").parent(".e-menu-wrap").remove(),"basicpalette"===this.model.palette?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(),"custompalette"===this.model.palette&&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._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"),this.drpbtnspan=t.buildTag("span.e-icon e-down-arrow","",{},{"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 i,s,a,n;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"),e("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._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"),i=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),s=0;s"),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="9.0"==this._browser.version||"8.0"==this._browser.version)?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"}).data("ejButton"),this._cancelObj=this.popupContainer.find("button.e-cancelButton").ejButton({text:this.model.buttonText.cancel,type:"button"}).data("ejButton"),this._on(this._cancelTag,"click",this._hidePopup),this._on(this._buttonTag,"click",this._buttonClick)):(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;e.map(t,function(e,t){"class"==t?i.wrapper.addClass(e):"required"==t?i.element.attr(t,e):"disabled"==t&&"disabled"==e?i._enabled(!1):i.wrapper.attr(t,e)})},_showClearIcon:function(e){e?(this._clearIcon=t.buildTag("div.e-clearicon").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(e){this._presetsId=e.currentTarget.id,"e-presets00"===this._presetsId?this.model.presetType="webcolors":"e-presets01"===this._presetsId?this.model.presetType="vintage":"e-presets02"===this._presetsId?this.model.presetType="seawolf":"e-presets10"===this._presetsId?this.model.presetType="sandy":"e-presets11"===this._presetsId?this.model.presetType="pinkshades":"e-presets12"===this._presetsId?this.model.presetType="moonlight":"e-presets20"===this._presetsId?this.model.presetType="monochrome":"e-presets21"===this._presetsId?this.model.presetType="misty":"e-presets22"===this._presetsId?this.model.presetType="flatcolors":"e-presets30"===this._presetsId?this.model.presetType="basic":"e-presets31"===this._presetsId?this.model.presetType="candycrush":"e-presets32"===this._presetsId&&(this.model.presetType="citrus"),this._splitObj.option("prefixIcon","e-color-image e-"+this.model.presetType),this.PaletteWrapper.remove(),"palette"==this._modelType&&(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 e,i,s,a,n=t.buildTag("div.e-presets-table");for(this._spnTag=t.buildTag("span.e-presetHeader"),this._spnTag.html(this.model.buttonText.swatches),n.append(this._spnTag),e=0,s=0;s<4;s++){for(i=t.buildTag("ul.e-tablerow"),a=0;a<3;a++)tableCell=t.buildTag("li.e-color-image e-preset-row#e-presets"+[s]+[a]),tableCell.appendTo(i);i.appendTo(n)}return n},_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(e){i._bindClickOperation(e)}),this._presetTag.parents(".e-split.e-widget").css({height:"27px"}),0==this.model.custom.length?this._splitObj.option("prefixIcon","e-color-image e-"+this.model.presetType):"",this._splitObj._getXYpos=function(){return e("#"+this.model.targetID).ejMenu({animationType:"none"}),btnpos=this.dropbutton.offset(),btnposx=btnpos.left-this.dropbutton.prev().outerWidth()-1,btnposy=btnpos.top-e("#"+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(e){i._changeHue(e)},slide:function(e){i._changeHue(e)}}).data("ejSlider"),this._opacity=this._alphaSlider.ejSlider({value:this.opacityValue(),showTooltip:this.model.showTooltip,orientation:"Vertical",incrementStep:5,value:100,change:function(e){i._changeAlpha(e)},slide:function(e){i._changeAlpha(e)}}).data("ejSlider"),(this._browser.name="8.0"==this._browser.version)&&(this._handleTag=t.buildTag("div.e-handle-wrapper"),this._handleTag.appendTo(this._opacity.element.find("a.e-handle"))),this._colorSlider.firstHandle.css({height:"13px",margin:"0px 0px -12px -2px",width:"13px"}),this._opacity.firstHandle.css({height:"13px",margin:"0px 0px -12px -2px",width:"13px"}),this.popupContainer.css({visibility:"visible",display:"none"}),"picker"==this.model.modelType?(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):"palette"==this.model.modelType&&(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(e){return"string"==typeof e&&"basicpalette"==e?this._collection=this._paletteGenerate(i[this.model.presetType],this.model.columns):"string"==typeof e&&"custompalette"==e&&"palette"==this.model.modelType&&(this._collection=this._paletteGenerate(this.model.custom,this.model.columns)),"custompalette"==e?this._collection.addClass("e-custom"):"",this._collection},_presetType:function(e){return"e-presets00"===e?this._collection=this._paletteGenerate(i.webcolors,this.model.columns):"e-presets01"===e?this._collection=this._paletteGenerate(i.vintage,this.model.columns):"e-presets02"===e?this._collection=this._paletteGenerate(i.seawolf,this.model.columns):"e-presets10"===e?this._collection=this._paletteGenerate(i.sandy,this.model.columns):"e-presets11"===e?this._collection=this._paletteGenerate(i.pinkshades,this.model.columns):"e-presets12"===e?this._collection=this._paletteGenerate(i.moonlight,this.model.columns):"e-presets20"===e?this._collection=this._paletteGenerate(i.monochrome,this.model.columns):"e-presets21"===e?this._collection=this._paletteGenerate(i.misty,this.model.columns):"e-presets22"===e?this._collection=this._paletteGenerate(i.flatcolors,this.model.columns):"e-presets30"===e?this._collection=this._paletteGenerate(i.basic,this.model.columns):"e-presets31"===e?this._collection=this._paletteGenerate(i.candycrush,this.model.columns):"e-presets32"===e&&(this._collection=this._paletteGenerate(i.citrus,this.model.columns)),this._collection},_paletteGenerate:function(i,s){var a;for(this._PresetTable=t.buildTag("div.e-palette-color").attr({role:"presentation"}),this._tag=t.buildTag("div.e-row"),a=0;an?s.top+d+u:s.top-o-u)-h;t=e(document).scrollLeft()+e(window).width()-l,(this.model.enableRTL||r>t&&r div");value="HSVA"!=this._selectedButton.html()?this._inputTag.val():this._formRGBA(this.HSVToRGB(this._hsv)),""!==value&&this._change&&this.model.showRecentColors&&t.length<=12&&(e(e(t)[t.length-2]).remove(),this._generateLi()),(!this.model.displayInline||this.element.is("input"))&&this.wrapper.focus()},_buttonClick:function(){this._change=!0;this._inputTag.val(),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)return this._inputTag.addClass("e-error"),!1;this._setValue("")}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").attr({value:this.RGBToHEX(this.rgb),tabindex:"0"});var e=t.buildTag("div.e-color e-set").attr({value:this.RGBToHEX(this.rgb),title:this.RGBToHEX(this.rgb)});(this._browser.name="8.0"==this._browser.version)?e.css({"background-color":this._formRGB(this.rgb),filter:"alpha(opacity="+100*this.rgb.a+")"}):e.css({"background-color":this._formRGBA(this.rgb)}),this._liTag.append(e),this._divTag.prepend(this._liTag)},_colorCodeValue:function(i){var s,a,n,o,r,l,d="",h=this._inputTag.val();if(s=e.trim(h),5==s.length?this._inputTag.removeClass("e-error"):"",this._keyPressFlag=i.shiftKey&&i.keyCode>=35&&i.keyCode<=40||i.ctrlKey&&(88==i.keyCode||86==i.keyCode)||190==i.keyCode?1:i.crtlKey||i.shiftKey||!(i.keyCode>=65&&i.keyCode<71||i.keyCode>=35&&i.keyCode<=40||i.keyCode>=48&&i.keyCode<=57||13==i.keyCode||8==i.keyCode||46==i.keyCode||"blur"===i.type)?0:1,(this.model.enableOpacity&&(188==i.keyCode||71==i.keyCode||82==i.keyCode)||i.shiftKey&&(57==i.keyCode||48==i.keyCode))&&(this._keyPressFlag=1),1==this._keyPressFlag){if(this._inputTag.removeClass("e-error"),13===i.keyCode||"blur"===i.type){if(""===s&&(this.model.showClearButton?this._setEmptyValue():this._inputTag.addClass("e-error")),o=/^\#([a-fA-F0-9]{6}|[a-fA-F0-9]{3})$/,a=s.match(o),t.isNullOrUndefined(a))if(r=/^rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*(\d+(?:\.\d+)?))?\)$/,a=s.match(r),t.isNullOrUndefined(a)){if(l=/^hsva?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*(\d+(?:\.\d+)?))?\)$/,a=s.match(l),t.isNullOrUndefined(a))return""!=s&&this._inputTag.addClass("e-error"),this._change=!1,!1;this._hsvColor(a)}else this._rgbaColor(a);else{if(3===a[1].length)for(n=0;ns.outerHeight(!0)||e(this._tag).outerWidth()-e(s).outerWidth(!0)*a>s.outerWidth()||0==e(this._tag).outerWidth())&&(t=parseFloat(e(this._tag).outerWidth())-36,i=t/a-(s.outerWidth()-s.width()),this._PresetTable.find(".e-item").css("width",i),s.outerWidth(!0)*a>this._tag.outerWidth()&&this._PresetTable.find(".e-item").css("width",i-1)),this.isPopupOpen?"picker"==this._modelType&&this.PaletteWrapper.css({display:"none",visibility:"visible"}):(this.popupContainer.css({display:"none",visibility:"visible"}),"palette"==this._modelType&&this.PaletteWrapper.css({visibility:"visible"})),this._prevSize=e(window).width(),this._width=this._gradientArea.width(),this._height=this._gradientArea.height()},_range:function(e,t){return""===t?0:t>e?e: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(e){if(!t.isNullOrUndefined(e))return"rgb("+e.r+","+e.g+","+e.b+")"},_formRGBA:function(e){if(!t.isNullOrUndefined(e))return"rgba("+e.r+","+e.g+","+e.b+","+e.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",100*this.rgb.a)),this._valueOperation(),this._inputTagValue(this._selectedButton)},_valueOperation:function(){this._handlePosition(),this._alphaGradient(this._tempValue),this._inputTag.removeClass("e-error"),this._updateUI()},_HexToHSV:function(e){return this.HSVToRGB(this.RGBToHSV(this._HexToRGB(e)))},_HexToRGB:function(e){if(!t.isNullOrUndefined(e)){var e,i=e.match("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$");return t.isNullOrUndefined(i)?(this._change=!1,!1):(3==i[1].length&&(e="#"+i[1][0]+i[1][0]+i[1][1]+i[1][1]+i[1][2]+i[1][2]),this._change=!0,e=parseInt(e.indexOf("#")>-1?e.substring(1):e,16),value=t.isNullOrUndefined(this.rgb)?parseFloat(this._tempOpacity)/100:this.rgb.a,this.rgb={r:e>>16,g:(65280&e)>>8,b:255&e,a:value})}},RGBToHSV:function(e){var t={h:0,s:0,v:0},i=Math.min(e.r,e.g,e.b),s=Math.max(e.r,e.g,e.b),a=s-i;return t.v=s,t.v*=100/255,0===a?(this._hsv=t,t):(t.s=0!=s?255*a/s:0,t.h=0!=t.s?e.r==s?(e.g-e.b)/a:e.g==s?2+(e.b-e.r)/a:4+(e.r-e.g)/a:-1,t.h*=60,t.h<0&&(t.h+=360),t.s*=100/255,this._hsv=t,t)},HSVToRGB:function(e){var i,s={},a=Math.round(e.h),n=Math.round(255*e.s/100),o=Math.round(255*e.v/100);if(0==n)s.r=s.g=s.b=o;else{var r=o,l=(255-n)*o/255,d=(r-l)*(a%60)/60;360==a&&(a=0),a<60?(s.r=r,s.b=l,s.g=l+d):a<120?(s.g=r,s.b=l,s.r=r-d):a<180?(s.g=r,s.r=l,s.b=l+d):a<240?(s.b=r,s.r=l,s.g=r-d):a<300?(s.b=r,s.g=l,s.r=l+d):a<360?(s.r=r,s.g=l,s.b=r-d):(s.r=0,s.g=0,s.b=0)}return this._hsv=e,i=t.isNullOrUndefined(this.rgb)?parseFloat(this._tempOpacity)/100:this.rgb.a,{r:Math.round(s.r),g:Math.round(s.g),b:Math.round(s.b),a:i}},_HSVToHex:function(e){return this.RGBToHEX(this.HSVToRGB(e))},_toHEX:function(e){return e.indexOf("#")!==-1?e:(e=e.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/),"#"+this._hex(e[1])+this._hex(e[2])+this._hex(e[3]))},RGBToHEX:function(e){if(!t.isNullOrUndefined(e))return"#"+this._hex(e.r)+this._hex(e.g)+this._hex(e.b)},_hex:function(e){return("0"+parseInt(e).toString(16)).slice(-2)},_colorValue:function(e){return this._color=e.indexOf("#")!=-1?this.hexCodeToRGB(e):"","rgb("+this._color.r+", "+this._color.g+", "+this._color.b+")"},hexCodeToRGB:function(e){var t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);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="8.0"==this._browser.version)?this._previousTag.css({"background-color":this._formRGB(this.rgb),filter:"alpha(opacity="+100*this.rgb.a+")"}):this._previousTag.css({"background-color":this._formRGBA(this.rgb)}),this._oldValue=this.rgb},_updateUI:function(){var e,t=this._hsv;this._switch?(e={h:this._hsv.h,s:100,v:100},this._gradientArea.css({"background-color":this._colorValue(this._HSVToHex(e))})):this._cellSelect(),(this._browser.name="8.0"==this._browser.version)?(this._currentTag.css({"background-color":this._formRGB(this.rgb),filter:"alpha(opacity="+100*this.rgb.a+")"}),this._previousTag.css({"background-color":this._formRGB(this._oldValue),filter:"alpha(opacity="+100*this.rgb.a+")"})):(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(e){e.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 e=this;this._off(this._changeTag,"click",this._switchModel),"palette"==this._modelType?(this._modelType="picker",this._switcher.removeClass("e-pickerModel").addClass("e-paletteModel"),this.PaletteWrapper.fadeOut(300,function(){e._presetTag.parents(".e-split.e-widget").addClass("e-hide"),e._gradient.fadeIn(300),e._on(e._changeTag,"click",e._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(){e._presetTag.parents(".e-split.e-widget").removeClass("e-hide"),t.isNullOrUndefined(e.PaletteWrapper)&&(e.PaletteWrapper=e._layoutType(e.model.palette),e._splitObj.option("prefixIcon","e-color-image e-"+e.model.presetType),e.popupList.prepend(e.PaletteWrapper)),e.PaletteWrapper.fadeIn(300),e._on(e._changeTag,"click",e._switchModel)}),""!==this.value()&&this._cellSelect(),this._disableHSVButton()),"custompalette"===this.model.palette&&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(){e(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 t,i,s=this;this._removeClass(),this._collection.find(".e-item").each(function(){t=e(this).css("background-color"),(s._browser.name="8.0"==s._browser.version)?t&&t.replace(/ /g,"")===s.RGBToHEX(s.rgb)&&(i=this,e(i).addClass("e-filter")):t&&t.replace(/ /g,"")===s._formRGB(s.rgb)&&(i=this)}),e(i).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(e,t,i){e=Array.prototype.slice.call(e);var s=e.length,a=e.indexOf(t);return a<0?i<0?e[s-1]:e[0]:(a+=i,e[a<0?a+=s:a%=s])},_onSelect:function(e){return!!this.model.enabled&&(this._isFocused=!0,this._handleArea.css("visibility","visible"),""!=e.target.style.backgroundColor&&(this._collection.find(".e-item").removeClass("e-state-selected").removeAttr("aria-selected"),this._HexToRGB(this._toHEX(e.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)),void e.preventDefault())},_keyDown:function(t){if(this._isFocused){if(this._change=!0,!this.model.enabled)return!1;var i="",s=t.keyCode,a=this._collection.find(".e-item"),n=a.filter(".e-state-selected").get(0),o=this.model.columns;switch(t.altKey||37!=s&&38!=s&&39!=s&&40!=s||"e-color-code"===t.target.className||this._removeClass(),!t.altKey&&s){case 40:"e-color-code"!==t.target.className&&(t.preventDefault(),i=this._position(a,n,o));break;case 37:"e-color-code"!==t.target.className&&(t.preventDefault(),i=this._position(a,n,-1));break;case 38:"e-color-code"!==t.target.className&&(t.preventDefault(),i=this._position(a,n,-o));break;case 39:"e-color-code"!==t.target.className&&(t.preventDefault(),i=this._position(a,n,1));break;case 13:this._collection.find(".e-item").removeClass("e-state-selected").removeAttr("aria-selected"),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(),e(this._presetContainer).hide(),this.element.is("input")&&this.wrapper.focus();break;case 9:active=document.activeElement,e(active).is(this.wrapper)&&this._focusPalettePopup(t,!0)}i&&(e(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 27==t.keyCode&&(this.hide(),e(this._presetContainer).hide())},_focusPalettePopup:function(t){e(this.popupContainer).focus(),t.preventDefault()}}),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 i={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","ffeb9e","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","A68F63","261414","FFFFFF","7F3443","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(e,t,s){t.widget("ejFileExplorer","ej.FileExplorer",{element:null,model:null,validTags:["div"],_addToPersist:["layout","selectedFolder","selectedItems","height","width"],_rootCSS:"e-fileexplorer",defaults:{fileTypes:"*.*",filterSettings:{caseSensitiveSearch:!1,filterType:"contains"},showToolbar:!0,showCheckbox:!0,showNavigationPane:!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"}]},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"]},toolsList:["layout","creation","navigation","addressBar","editing","copyPaste","getProperties","searchBar"],path:"",height:400,width:850,minWidth:"400px",maxWidth:null,minHeight:"250px",maxHeight:null,isResponsive:!1,uploadSettings:{allowMultipleFile:!0,maxFileSize:31457280,autoUpload:!1},enableResize:!1,cssClass:"",enableRTL:!1,showThumbnail:!0,showRoundedCorner:!1,ajaxAction:"",ajaxDataType:"json",ajaxSettings:{read:{},createFolder:{},remove:{},rename:{},paste:{},getDetails:{},download:{},upload:{},getImage:{},search:{}},allowMultiSelection:!0,layoutChange:null,select:null,createFolder:null,remove:null,cut:null,copy:null,paste:null,open:null,beforeOpen:null,beforeUpload:null,beforeDownload:null,beforeAjaxRequest:null,resizeStart:null,resize:null,resizeStop:null,templateRefresh:null},dataTypes:{filterSettings:"data",showToolbar:"boolean",showNavigationPane:"boolean",showContextMenu:"boolean",showRoundedCorner:"boolean",showFooter:"boolean",layout:"enum",gridSettings:"data",tools:{creation:"array",navigation:"array",addressBar:"array",editing:"array",copyPaste:"array",getProperties:"array",searchBar:"array"},toolsList:"array",uploadSettings:"data",ajaxSettings:"data"},_setModel:function(i){var s,a,n,o,r,l;for(s in i)switch(s){case"showToolbar":i[s]?t.isNullOrUndefined(this._toolBarItems)?this._updateToolbar():this._toolBarItems.show():this._toolBarItems.hide(),this.adjustSize();break;case"showNavigationPane":case"showTreeview":a=this.model.enableRTL,a&&this._enableRTL(!1),this.model.showNavigationPane=this.model.showTreeview=i[s],this._showHideSplitBar(!1),a&&this._enableRTL(!0);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"showThumbnail":this.model.showThumbnail=i[s],this._switchLayoutView();break;case"path":i[s]?this._setPath(i[s]):this._getPath();break;case"enableRTL":this._enableRTL(i[s]);break;case"showFooter":i[s]?(this._statusbar.hasClass("e-statusbar")?(n=this._splittag.find(".e-cont2").outerHeight()-this._statusbar.outerHeight(),this._tileView.height(n),this._gridtag.height(n),this._statusbar.show()):(this._createStatusBar(),this._updateData(),this.model.enableResize&&this._resizeFileExplorer(),this._on(e("#"+this._ExplorerId+"_switchGridView"),"click",this._switchView),this._on(e("#"+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})):(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}));break;case"gridSettings":r=JSON.parse(JSON.stringify(i[s])),r.columns.unshift({field:"cssClass",headerText:"",cssClass:"e-grid-image",width:22,template:"",textAlign:t.TextAlign.Center,allowResizing:!1}),this.model.showCheckbox&&r.columns.unshift({field:"",headerText:"check",cssClass:"e-col-check",width:18,template:"",textAlign:t.TextAlign.Center,headerTextAlign:t.TextAlign.Center,allowResizing:!1,allowSorting:!1}),this._gridObj&&this._gridtag.ejGrid(r);break;case"locale":this.model.locale=i[s],this._destroy(),this._init();break;case"cssClass":this._changeSkin(i[s]);break;case"fileTypes":l=this,e.each(l._fileExplorer,function(e){l._fileExplorer[e]=""}),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._setSelectedItems(i[s]);break;case"allowMultiSelection":i[s]||this._setSelectedItems([]),this._gridtag.find(".e-gridheader").length&&this._gridtag.ejGrid("option",{selectionType:i[s]?"multiple":"single"});break;case"isResponsive":this.model.isResponsive=i[s],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":"tools"==s?e.extend(this.model.tools,i[s]):this.model.toolsList=i[s],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[s]?i[s]&&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,"grid"==this.model.layout?this._renderGridView(this._fileExplorer[this._originalPath]):this._renderTileView(this._fileExplorer[this._originalPath]),this._setSelectedItems(this.model.selectedItems);break;case"showRoundedCorner":this._roundedCorner(i[s])}},_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()},_initialize:function(){this._ExplorerId=this.element[0].id,this._fileExplorer={},this._feParent={},this._updateImages={},this._selectedStates=[],this._updateOnNodeSelection=!1,this._isClicked=!0,this._tileView=null,this._tileScroll=null,this._originalPath=null,this._initPath="",this._initUpdate=!1,this._scrollerSize=8,this._editingToolsState=!0,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._contextMenu={navbar:["NewFolder","Upload","|","Delete","Rename","|","Cut","Copy","Paste","|","Getinfo"],cwd:["Refresh","Paste","|","NewFolder","Upload","|","Getinfo"],files:["Open","Download","|","Upload","|","Delete","Rename","|","Cut","Copy","Paste","|","OpenFolderLocation","Getinfo"]},this._changeCheckState=this.model.showCheckbox,this._perRow=1,this._suggestionItems=[],this._highlightedNodes=""},_initContextMenuOptions:function(e){for(var t=[],i={class:"e-fe-separator"},s=0;s .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(e){this.element.removeClass(this._customCssClass).addClass(e),this._customCssClass=e,this._waitingPopup.option("cssClass",e),this._subControlsSetModel("cssClass",e)},_swapWith:function(t,i){t=e(t),i=e(i);var s=e("").hide();t.before(s),i.before(t),s.replaceWith(i)},_enableRTL:function(e){var t,i,s=this._splittag.find(".e-cont1"),a=this._splittag.find(".e-cont2");if(this.model.enableRTL=e,e){for(s.index()a.index()&&this._swapWith(a,s),this._gridObj&&this._oldFormat&&this._gridObj.columns(this._oldFormat),this._oldFormat&&(this.model.gridSettings.columns=this._oldFormat),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",e)},_roundedCorner:function(e){var t=e?"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",e)},_destroy:function(){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._waitingPopup&&this._waitingPopup.destroy(),this._gridObj&&this._gridObj.element.ejWaitingPopup("destroy"),this._unwireEvents(),this.element.html(""),e(this._cloneElement).attr("style")?this.element.attr("style",e(this._cloneElement).attr("style")):this.element.removeAttr("style")},_createFolder:function(i){var a=this,n={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(e){var i,n,o;if(e!==s&&null!==e){if(e.hasOwnProperty("d")&&(e=e.d),!t.isNullOrUndefined(e.error))return void a._showErrorDialog(e.error);i=a._selectedNode,n=[{id:e.files[0].name,name:e.files[0].name,spriteCssClass:e.files[0].permission&&!e.files[0].permission.Read?"e-fe-icon e-fe-folder e-fe-lock":"e-fe-icon e-fe-folder",hasChild:!1}],a._treetag.ejTreeView("isExpanded",i)||i.find(".e-icon").click(),a._nodeExpanded=!0,a._treeObj.addNode(n,i),a._nodeExpanded=!1,a._update=!0,a._treeObj.selectNode(i),a._setSelectedItems([e.files[0].name]),a._refreshTreeScroller(),a._treetag.find("li").removeAttr("tabindex"),o={data:e,selectedItems:a._selectedItemDetails},a._trigger("createFolder",o)}},successAfter:this.model.ajaxSettings.createFolder.success};this.model.ajaxSettings.createFolder.success=s,e.extend(!0,n,this.model.ajaxSettings.createFolder),this._sendAjaxRequest(n)},_cut_copy:function(){var e,i,s;if(this._sourcePath==this._currentPath&&"move"==this._option)return this.element.find(".e-blur").removeClass("e-blur"),void this._setSelectedItems(this._fileName);for(e=this._fileExplorer[this._currentPath],i="string"==typeof this._copiedNodes?[this._copiedNodes]:this._copiedNodes,this._pastedFiles=i.slice(),s=0;s=0){s=a;break}if(s!=-1){var l=this._getLocalizedLabels("CancelPasteAction"),d=t.buildTag("div"),h=t.buildTag("div.e-fe-dialog-label",l),c=t.buildTag("div.e-fe-dialog-centerbtn"),u=t.buildTag("button.e-fe-btn-cancel ",this._getLocalizedLabels("CancelButton"));u.ejButton({type:"button",click:function(){i._removeDialog(i._alertDialogObj)}}),o=t.buildTag("button.e-fe-btn-skip ",this._getLocalizedLabels("SkipButton")),o.ejButton({type:"button",click:function(){i._fileName.splice(s,1),i._removeDialog(i._alertDialogObj),i._performPasteOperation()}}),c.append(o,u),e(d).append(h,c),r=function(){u.focus()},this._alertDialog=this._createDialog(d,{width:400,height:"auto",title:this._getLocalizedLabels("Error"),open:r}),this._alertDialogObj=this._alertDialog.data("ejDialog")}else this._performPasteOperation()},_performPasteOperation:function(){var i=this,a=this._currentPath.split("/"),n={data:{ActionType:"Paste",LocationFrom:this._sourcePath,LocationTo:this._currentPath,Names:"string"==typeof this._fileName?[this._fileName]:this._fileName,Action:this._option,CommonFiles:this._existingItems,SelectedItems:this._getSelectedItemDetails(this._sourcePath,this._fileName),TargetFolder:this._getSelectedItemDetails(this._getFolderPath(),a[a.length-2])},url:this.model.ajaxAction,type:"POST",success:function(s){var n,o,r,l,d,h;if(s.hasOwnProperty("d")&&(s=s.d),!t.isNullOrUndefined(s.error))return void i._showErrorDialog(s.error);for("string"==typeof i._fileName&&(i._fileName=[i._fileName]),r=0;r-1&&i._pastedFiles.splice(s,1)}}),i._existingItems=[],n=i._originalPath,o=i._selectedNode,"move"==i._option){for(r=0;r 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),0==i._treeObj.getSelectedNode().length&&e(i._parentNode).find("li a").each(function(){if(e(this).text()==i._ajax_person)return i._treeObj.selectNode(e(this).closest("li.e-item")),!1})))):void i._showErrorDialog(s.error)},successAfter:this.model.ajaxSettings.rename.success};this.model.ajaxSettings.rename.success=s,e.extend(!0,a,this.model.ajaxSettings.rename),this._sendAjaxRequest(a)},_downloadFile:function(){var t,i=this._getSelectedItemDetails(this._currentPath,this._selectedItems),s={Path:this._currentPath,ActionType:"Download",SelectedItems:JSON.stringify(i),Names:this._selectedItems},a=this.model.ajaxAction+"?"+e.param(s,!0);return this.model.ajaxSettings.download.url&&(a=this.model.ajaxSettings.download.url.indexOf("{")>=0?String.format(this.model.ajaxSettings.download.url,"?"+e.param(s,!0)):this.model.ajaxSettings.download.url),t={path:this._currentPath,files:this._selectedItems,selectedItems:i},!this._trigger("beforeDownload",t)&&void(window.location=a)},_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 i,s,a,n,o=t.length>0;for(this._collapse=!1,i=this,s=this._currentPath.split("/"),a=0;a div > .e-text")[0]){this._selectedContent=t.currentElement.text,this._selectedNode=e(t.currentElement).closest("li.e-item");var i=e(this._selectedNode.parents("li.e-item")[0]);this._parentNode=0!=i.length?i:this._selectedNode,this._nodeType="Directory",this._isTreeNode=!0}},_showHideContextMenu:function(){if(this.model.showContextMenu){var i,s={beforeOpen:"",click:""},a={id:"",targetId:""};i=this._initContextMenuOptions("navbar"),a.id=this._ExplorerId+"_treeView",a.targetId="#"+this._ExplorerId+"_treeView",s.beforeOpen=e.proxy(this._beforeOpenContextMenu,this),s.close=e.proxy(this._onHideContextMenu,this),s.click=e.proxy(this._contextMenuClick,this),this._treeContextMenutag=this._createContextMenuTag(i,a,s),this._treeMenuObj=this._treeContextMenutag.ejMenu("instance"),this._cwdMenuOptions=this._initContextMenuOptions("cwd"),a.id=this._ExplorerId+"_tileView",a.targetId=".e-tile-wrapper,#"+this._ExplorerId+"_grid",s.beforeOpen=e.proxy(this._beforeOpenTileContextMenu,this),s.click=e.proxy(this._fileContextMenuClick,this),this._tileContextMenutag=this._createContextMenuTag(this._cwdMenuOptions,a,s),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(),e("#"+this._ExplorerId+"_treeViewContextMenu").remove(),e("#"+this._ExplorerId+"_tileViewContextMenu").remove(),this._viewMenuObj=this._treeMenuObj=null)},enableMenuItem:function(e){e=this._findCommand(e,this._contextMenu);for(var t=0;t{{:"+a[o].field+"}}");this._suggestionItems.length&&a.push({field:"filterPath",headerText:"Folder",width:"20%"}),a.unshift({field:"cssClass",headerText:"",cssClass:"e-grid-image",width:22,template:"",textAlign:t.TextAlign.Center,allowResizing:!1}),this.model.showCheckbox&&a.unshift({field:"",headerText:"check",cssClass:"e-col-check",width:18,template:"",textAlign:t.TextAlign.Center,headerTextAlign:t.TextAlign.Center,allowResizing:!1,allowSorting:!1}),i=this,s=a[a.length-1],s&&(s.customAttributes?s.customAttributes.class?s.customAttributes.class.search("e-rowcell e-last-rowcell")==-1&&(s.customAttributes.class=s.customAttributes.class+" e-rowcell e-last-rowcell"):s.customAttributes.class=" e-rowcell e-last-rowcell":s.customAttributes={class:"e-rowcell e-last-rowcell"}),this._gridObj?(a.length!=this._gridObj.model.columns.length&&(this._gridObj.model.columns=a,this._gridObj.columns(this._gridObj.model.columns)),n=JSON.parse(JSON.stringify(this._gridObj.model.sortSettings)),this._gridObj.option("dataSource",e),this._gridObj.option("enableRTL",this.model.enableRTL),this._gridObj.option("sortSettings",n)):this._gridtag.ejGrid({cssClass:i.model.cssClass,enableRTL:i.model.enableRTL,dataSource:e,selectionType:i.model.allowMultiSelection||i.model.showCheckbox?"multiple":"single",allowSorting:i.model.gridSettings.allowSorting,columns:a,isResponsive:!0,scrollSettings:{width:186,height:200,buttonSize:0,scrollerSize:i._scrollerSize},allowScrolling:!0,enableResponsiveRow:!1,rowSelected:function(e){i._updatePathFromGrid(e)},recordDoubleClick:function(e){i._openAction(e)},templateRefresh:function(e){i._templateRefresh(e)},create:this.model.showCheckbox?function(e){i._gridCheckboxState(e)}:null,actionComplete:function(e){i._gridActionComplete(e)}}),e.length&&e[0].filterPath&&this._setFilteredContent(),this._gridObj=this._gridtag.ejGrid("instance"),this.gridItems=this._gridObj.getRows(),this._reSizeHandler(),this._gridtag.attr("tabindex",-1),this._gridViewEvents("_off"),this._gridViewEvents("_on")},_setFilteredContent:function(){for(var t,i=this._gridtag.find(".e-gridcontent tr"),s=0;s").addClass("e-col-check"),this._headCheckObj=this._gridtag.find("#headchk").ejCheckBox({showRoundedCorner:e.model.showRoundedCorner,change:function(t){e._headCheckChange(t)}}).data("ejCheckBox"),this._gridtag.find(".e-grid-row-checkbox").ejCheckBox({showRoundedCorner:e.model.showRoundedCorner}),this._gridtag.find(".e-chkbox-wrap").removeAttr("tabindex")},_checkChange:function(t){for(var i,s=this._gridtag.find(".e-grid-row-checkbox"),a=this._gridtag.find(" .e-gridcontent .e-checkbox:checked"),n=[],o=0;os&&(s=t)}),a.find(".e-thumb-image.e-image").css("height",s);this._tileScroll&&this._tileScroll.refresh()}this._perRow=n},_renderTileView:function(i){var s,a,n,o,r,l,d,h;if(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"),0==i.length?this._tileView.html("No items to display").addClass("e-fe-center"):this._tileView.html("").removeClass("e-fe-center"),s=this,a=null,e.each(i,function(i,n){var o,r,l,d,h,c,u,m;o=e(n.filterPath?"
  • ":"
  • "),r=e("
    "),n.isFile?(r.appendTo(o),l=n.name.substr(n.name.lastIndexOf(".")+1).toLowerCase(),/\.(bmp|dib|jpg|jpeg|jpe|jfif|gif|tif|tiff|png|ico)$/i.test(n.name)?s.model.showThumbnail?(d=n.filterPath?n.filterPath.replace("~","..")+n.name:s._currentPath.replace("~","..")+n.name,h=s._getImage(d,n.name),a=t.buildTag("img.e-thumbImage","","",{src:h?h:d+"?"+(s._updateImages[d]?s._updateImages[d]:s._initialTime),unselectable:"on"})):a=e("").addClass("e-fe-images"):a=/\.(mp3|wav|aac|ogg|wma|aif|fla|m4a)$/i.test(n.name)?e("").addClass("e-fe-audio"):/\.(webm|mkv|flv|vob|ogv|ogg|avi|wmv|mp4|3gp)$/i.test(n.name)?e("").addClass("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("").addClass("e-fe-"+l):e("").addClass("e-fe-"+l)):(r.appendTo(o),a=e(""),n.permission&&!n.permission.Read&&a.addClass("e-fe-lock")),a.appendTo(r.find(".e-thumb-image")),s.model.showCheckbox&&(c=e(""));var p=e("
    "),g=e("
    "),_=e("
    "+n.name+"
    ");_.appendTo(g),n.isFile&&"tile"==s.model.layout&&(u=e("
    "+n.type+"
    "),u.appendTo(g),m=e("
    "+n.size+"
    "),m.appendTo(g)),g.appendTo(p),o.attr({"aria-selected":!1,title:n.isFile?n.dateModified+" ("+n.size+")":n.dateModified,role:"tileitem"}),s.model.showCheckbox&&c.prependTo(o),p.appendTo(o),o.appendTo(s._tileView),s.model.showCheckbox&&s._tileView.find(".e-tile-checkbox").ejCheckBox({size:"mini",showRoundedCorner:s.model.showRoundedCorner}),s._tileView.find(".e-chkbox-wrap").removeAttr("tabindex")}),this._activeItem=0,this.items=this._tileView.find("li.e-tilenode"),this._tileViewEvents("_off"),this._tileViewEvents("_on"),this._tileContent.addClass("e-content"),n=this.model.showFooter?this._splittag.outerHeight()-this._statusbar.outerHeight():this._splittag.outerHeight(),o=this._splittag.find(".e-cont2").width(),t.isNullOrUndefined(this._tileScroll)?this._tileScroll=this._tileContent.parent(".e-tile-wrapper").ejScroller({height:n,width:o,buttonSize:0,scrollerSize:this._scrollerSize}).data("ejScroller"):(this._tileScroll.option({height:n,width:o}),this._tileScroll&&this._tileScroll.refresh()),s._tileView.find(".e-image > img").length)for(r=s._tileView.find(".e-image > img"),l=0,d=0;d=0?String.format(this.model.ajaxSettings.getImage.url,"?Path="+e+"&SelectedItems="+JSON.stringify(i)):this.model.ajaxSettings.getImage.url)}return s?s:""},_gridtagClick:function(t){t.stopPropagation(),(e(t.target).hasClass("e-gridcontent")||e(t.target).hasClass("e-content")||e(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._updateCurrentPathPermission())},_updateGridSelection:function(t){t.events&&!t.events.ctrlKey&&null!=e(t.target)[0]&&this._gridObj.selectRows(e(t.target).closest("td").parent().index(),null,e(t.target).closest("td"))},_updateTileSelection:function(t){t.events&&!t.events.ctrlKey&&null!=e(t.target)[0]&&e(t.target).click()},_tileViewEvents:function(e){this[e](this.items,"mousedown",this._preventDefaultSelection),this[e](this.items,"click",this._upDatePathFromTileView),this[e](this.items,"dblclick",this._openAction),this[e](this.items,"mouseenter",this._onItemHover),this[e](this.items,"mouseleave",this._onItemLeave),this[e](this._tileViewWrapper,"focusin",this._focusTileView),this[e](this._tileViewWrapper,"focusout",this._blurTileView)},_preventDefaultSelection:function(e){e.shiftKey&&e.preventDefault()},_tileViewWrapperClick:function(t){(e(t.target).hasClass("e-tile-wrapper")||e(t.target).hasClass("e-tile-content")||e(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())},_onItemHover:function(t){var i=t.currentTarget;t.target;e(i).hasClass("e-disable")||(this.items.removeClass("e-hover"),e(i).addClass("e-hover"))},_onItemLeave:function(t){var i=t.currentTarget;t.target;e(i).hasClass("e-disable")||e(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,s=this._itemList.length-1;switch(this._activeItem=this._lastItemIndex?this._lastItemIndex:this._itemList?this._itemList.filter(".e-active").index():-1,i=this._getKeyCode(t)){case 38:if(t.preventDefault(),e(t.target).hasClass("e-statusbar"))return void this._focusLayout(this.model.layout);if(this._activeItems?this._activeItem=0:0==this._activeItem?this._activeItem=s:this._activeItem-=1,this._beforeListHover(t.shiftKey);break;case 40:if(t.preventDefault(),this._activeItem+this._perRow>=this._itemList.length)return;this._activeItem+=this._perRow,this._beforeListHover(t.shiftKey);break;case 39:if(t.preventDefault(),this._activeItem==s)return;this._activeItem>s||null==this._activeItem||this._activeItem<0?this._activeItem=s:this._activeItem==s?this._activeItem=0:this._activeItem+=1,this._beforeListHover(t.shiftKey);break;case 33:case 36:t.preventDefault(),this._activeItem=0,this._beforeListHover(t.shiftKey);break;case 34:case 35:t.preventDefault(),this._activeItem=s,this._beforeListHover(t.shiftKey)}this._lastItemIndex=t.shiftKey?this._activeItem:null},_OnKeyUp:function(i){var s,a,n,o,r,l=this._getKeyCode(i);switch(l){case 13:i.preventDefault(),i.altKey?(this._lastFocusedElement=i.currentTarget,this._getDetails()):(i.preventDefault(),this._lastFocusedElement=i.currentTarget,e(i.currentTarget).hasClass("e-treeview")||(s=!1,e(i.currentTarget).hasClass("e-tile-wrapper")?s=this.items.hasClass("e-active"):e(i.currentTarget).hasClass("e-gridcontent")&&(s=e(this.gridItems).find("td").hasClass("e-active")),s&&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,s=!1,e(i.currentTarget).hasClass("e-treeview")?this._rootPath!=this._currentPath&&(s=this._treetag.find(".e-active").length>0):e(i.currentTarget).hasClass("e-tile-wrapper")?s=this.items.hasClass("e-active"):e(i.currentTarget).hasClass("e-gridcontent")&&(s=e(this.gridItems).find("td").hasClass("e-active")),s&&this._selectedContent&&this._toRead&&(67==l&&this._toCopy&&i.ctrlKey&&this._copyMoveNode("copy"),this._toEdit))switch(l){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||93==l)&&this.model.showContextMenu)if(i.preventDefault(),this._lastFocusedElement=i.currentTarget,a=null,e(i.currentTarget).hasClass("e-treeview"))o=this._treeObj.getSelectedNode().find(".e-active"),a=this._getMenuPosition(o),this._treeMenuObj.show(a.left,a.top,o,i,!0);else{if(e(i.currentTarget).hasClass("e-tile-wrapper")){for(r=0;r=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),e},_renderUploadBox:function(){var e=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:e._getLocalizedLabels("Upload")},showRoundedCorner:!1,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){e._uploadSuccess(t)},remove:function(t){e._uploadSuccess(t)},fileSelect:function(t){var i,s,a,n;for(e._fileExplorer[e._currentPath]||e._getFileDetails(e._currentPath),i=e._fileExplorer[e._currentPath],e._existingItems=[],s=e._files=t.files,a=0;a");i.insertBefore(this._addresstag),"msie"==t.browserInfo().name&&t.ieClearRemover(this._addresstag[0]),this._on(e("#"+this._ExplorerId+"_addressbar"),"keydown",this._searchPath),this._on(e("#"+this._ExplorerId+"_addressbar"),"blur",this._addressbarFocusout)},_updateAddressBar:function(){if(this._addresstag){var e=this._currentPath;this._addresstag.val(e.replace(this._initPath,""))}},_onEpand:function(e){this._reSizeHandler(e)},_createSplitPane:function(){var e,i=this,s=t.buildTag("div"),a=t.buildTag("div");this._splittag=t.buildTag("div#"+this._ExplorerId+"_splitter"),s.addClass("e-cont1"),a.addClass("e-cont2"),this._splittag.append(s,a),this.element.append(this._splittag),this._splitObj=this._splittag.ejSplitter({enableAutoResize:!0,width:this.element.width(),cssClass:this.model.cssClass,enableRTL:this.model.enableRTL,height:Math.ceil(this.element.height()-(this._toolBarItems?this._toolBarItems.outerHeight():0)),properties:[{paneSize:"25%"},{}],expandCollapse:function(e){i._onEpand(e)},resize:function(e){i._reSizeHandler(e)}}).data("ejSplitter"),this._splitObj._bar=0,this._splitObj.refresh(),e=t.buildTag("div.e-tree-wrapper"),s.append(e),this._treetag=t.buildTag("div#"+this._ExplorerId+"_treeView"),e.append(this._treetag),this._gridtag=t.buildTag("div#"+this._ExplorerId+"_grid"),a.append(this._gridtag),this._tileViewWrapper=t.buildTag("div.e-tile-wrapper","","",{tabindex:0}),"tile"==this.model.layout&&this._tileViewWrapper.addClass("e-tileInfo-view"),a.append(this._tileViewWrapper),this._tileViewWrapper.append("
    "),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),a.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(),"grid"==this.model.layout?this._tileContent.parent().hide():this._gridtag.hide(),this._createUploadBox()},_selectedFolder:function(e){var t,i,s,a=e.replace(this._initPath,""),n=this._treeObj.getSelectedNode(),o=a.split("/");for(a&&this._treeObj.selectNode(this._treeObj.element.find("li:first")),t=0;tli").find("div:first .e-text"),s=0;s0&&(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(e){t._trigger("resizeStart",{event:e})},resize:function(e){t._refreshResizeEventHandler(e),t._trigger("resize",{event:e})},resizeStop:function(e){t._refreshResizeEventHandler(e),t._trigger("resizeStop",{event:e})},helper:function(){return e(t.element)}})},_showHideSplitBar:function(e){this._splittag.show(),0==this._splitObj.model.properties[1].paneSize?(this.element.find(".e-splitbar").show(),this._splitObj.expand(1),!this._gridtag.hasClass("e-grid")&&e&&this._updateData()):0==this._splitObj.model.properties[0].paneSize&&(this.element.find(".e-splitbar").show(),this._splitObj.expand(0),this._treetag.parent(".e-tree-wrapper").css("display","block")),this.model.showNavigationPane||(this._splitObj.collapse(0),this.element.find(".e-splitbar").hide(),!this._gridtag.hasClass("e-grid")&&e&&this._updateData(),this._treetag.parent(".e-tree-wrapper").css("display","none"))},_updateTreePath:function(i){var s,a,n,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,s=e(this._selectedNode.parents("li.e-item")[0]),this._parentNode=0!=s.length?s: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(a=this._selectedStates.length-1;a>this._currentState;a--)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),2==this._selectedStates.length&&this._toolBarItems&&this._enableToolbarItem("Back"))}this._updateAccessRules(this._originalPath),this._updateToolbarItems(),this._updateNewFolderTool(this._toRead&&this._toEditContents),s.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=[],n=this._getFolderPath(),i={name:[i.value],path:n,nodeType:this._nodeType,selectedItems:this._getSelectedItemDetails(n,this._selectedContent)},this._trigger("select",i)},_modifySelectedStates:function(t,i){var s=this;e.each(s._selectedStates,function(e,a){a&&a.startsWith(t)&&(s._selectedStates[e]=i?s._selectedStates[e].replace(t,i):i)})},_onBeforeCollapse:function(){this._collapse=!0},_updatePath:function(t,i){for(var s="",a=0;a-1&&d.splice(h,1),r=0;r0?i._suggestionItems:i._fileExplorer[i._originalPath],function(e,i){i.name!=t.data.name||i.isFile||(n=!0)}),n?(this._nodeType="Directory",a.hasClass("e-active")&&this._updateNode(t.data.name)):this._nodeType="File",this._currntNode=null!=a[0]&&a.parent("tr"),this._selectedContent=this._selectedItems[this._selectedItems.length-1],!a.hasClass("e-active")&&d.length>0&&(this._selectedContent=this._selectedItems[this._selectedItems.length-1],this._nodeType=d[d.length-1].isFile?"File":"Directory","Directory"==this._nodeType&&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&&o?" "+this._bytesToSize(l):"")),this._setFilteredItemsName(),this.model.selectedItems=this._filteredItemsName,t={name:this._selectedItems,path:this.model.selectedFolder,nodeType:this._nodeType,selectedItems:this._getSelectedItemDetails(this.model.selectedFolder,this._filteredItemsName)},this._urlTag&&this._urlTag.find("input").val(t.path),this._nameTag&&this._nameTag.find("input").val(t.name),this._updateSelectionDetails(),this._isClicked&&this._trigger("select",t)},_enableEditingTools:function(){var e,t;if(!this._editingToolsState&&this._toolBarItems){for(e=["Rename","Delete","Cut"],t=0;th&&(c=d,d=h,h=c),u=this._tileContent.find(".e-tilenode"),u.removeClass("e-active").attr("aria-selected",!1),m=d;m<=h;m++)this._selectItems.push(e(u.get(m)).find(".e-file-name").text());this._setSelectedItems(this._selectItems)}else{if(t.ctrlKey&&this.model.allowMultiSelection||(this._sizeInByte=0,this._selectedItems=[],this._selectedTileItems=[],e(t.currentTarget).siblings().removeClass("e-active").attr("aria-selected",!1),e(t.currentTarget).removeClass("e-active").attr("aria-selected",!1),this._clearTileCheckBoxSelection()),e(t.currentTarget).hasClass("e-active")?(e(t.currentTarget).removeClass("e-active").attr("aria-selected",!1),s&&s.option("checked",!1)):(e(t.currentTarget).addClass("e-active").attr("aria-selected",!0),s&&s.option("checked",!0)),a="File",n=!0,this._toDownload=this._toUpload=this._toEdit=this._toEditContents=this._toRead=this._toCopy=!0,o=e(t.currentTarget).find(".e-file-name").text(),this._currentPath!=this._originalPath&&(this._currentPath=this._originalPath),u=this._suggestionItems.length?this._suggestionItems:this._fileExplorer[this._originalPath])for(m=0;m-1&&this._selectedTileItems.splice(r,1));break}e.each(this._selectedTileItems,function(e,t){t.isFile||(i._update=!1,n=!1,i._toDownload=!1),i._updateAccessValue(t)}),e(t.currentTarget).find(".e-fe-folder").length&&(a="Directory",e(t.currentTarget).hasClass("e-active")&&this._updateNode(o)),this._currntNode=e(t.currentTarget),this._currntNode.attr("data-parent-path")&&(o=this._currntNode.attr("data-parent-path").replace(this._originalPath,"")+o),this._selectedContent=o,e(t.currentTarget).hasClass("e-active")?this._selectedItems.push(this._selectedContent):(r=e.inArray(this._selectedContent,this._selectedItems),r>-1&&this._selectedItems.splice(r,1),this._selectedTileItems.length>0&&(this._selectedContent=this._selectedItems[this._selectedItems.length-1],a=this._selectedTileItems[this._selectedTileItems.length-1].type,"Directory"==a&&this._updateNode(this._selectedContent))),this._startNode&&0!=this._selectItems.length&&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&&n?" "+this._bytesToSize(this._sizeInByte):"")),this._nodeType=a,this._setFilteredItemsName(),this.model.selectedItems=this._filteredItemsName,l={name:this._selectedItems,path:this.model.selectedFolder,nodeType:this._nodeType,selectedItems:this._getSelectedItemDetails(this.model.selectedFolder,this._filteredItemsName)},this._urlTag&&this._urlTag.find("input").val(l.url),this._nameTag&&this._nameTag.find("input").val(l.name),this._updateSelectionDetails(),this._isClicked&&this._trigger("select",l),this._selectItems=[])}},_setFilteredItemsName:function(){var e,t;for(this._filteredItemsName=[],e=0;e div > .e-text:first").addClass("e-node-focus"),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),1==e(t.target).parents("li.e-item:first").attr("id")&&this._disableEditingMenus()):t.cancel=!0},_beforeOpenTileContextMenu:function(t){if(e(t.target).closest("th.e-headercell").hasClass("e-col-check")&&this._headCheckObj.wrapper.click(),e(t.target).hasClass("e-scrollbar")||e(t.target).parents().hasClass("e-scrollbar")||e(t.target).closest("th.e-headercell").hasClass("e-col-check"))return void(t.cancel=!0);e(t.target).hasClass("e-rowcell")||e(t.target).closest("td.e-rowcell").hasClass("e-col-check")||!(e(t.target).closest("td.e-rowcell").length>0)||e(t.target).closest("td.e-rowcell").hasClass("e-active")||!t.events||2!=t.events.button&&3!=t.events.which?(e(t.target).hasClass("e-file-info")||e(t.target).hasClass("e-thumb-image")||e(t.target).closest(".e-thumb-image").length>0)&&0==e(t.target).closest(".e-chkbox-wrap").length&&!e(t.target).closest(".e-tilenode").hasClass("e-active")&&this._updateTileSelection(t):this._updateGridSelection(t),e(t.target).is(".e-tilenode.e-active")||e(t.target).closest(".e-tilenode").hasClass("e-active")||e(t.target).closest("td.e-rowcell").is(".e-active")||(t.events.ctrlKey||t.events.shiftKey||e(t.target).closest("td.e-rowcell").hasClass("e-col-check")||e(t.target).closest(".e-chkbox-wrap").length>0)&&(e(this.items).hasClass("e-active")||e(this.gridItems).find("td").hasClass("e-active"))?JSON.stringify(this._viewMenuObj.model.fields.dataSource)==JSON.stringify(this._cwdMenuOptions)&&this._viewMenuObj.option("fields",{dataSource:this._fileMenuOptions,id:"text",text:"text",htmlAttribute:"htmlAttr",spriteCssClass:"sprite"}):(JSON.stringify(this._viewMenuObj.model.fields.dataSource)==JSON.stringify(this._fileMenuOptions)&&this._viewMenuObj.option("fields",{dataSource:this._cwdMenuOptions,id:"text",text:"text",htmlAttribute:"htmlAttr",spriteCssClass:"sprite"}),e(t.events.currentTarget).hasClass("e-grid")&&(e(t.target).hasClass("e-gridcontent")||e(t.target).hasClass("e-content")||e(t.target).hasClass("e-table")||!e(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}))),e(t.events.currentTarget).hasClass("e-tile-wrapper")&&(e(t.target).hasClass("e-tile-wrapper")||e(t.target).hasClass("e-tile-content")||e(t.target).hasClass("e-tileview")||!(e(t.target).is(".e-tilenode.e-active")||e(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());for(var i=0;i:]/.test(String.fromCharCode(t))||(i.html(s._getLocalizedLabels("InvalidFileName")),!1)}),e.keydown(function(){i.html("")})},_deleteFolder:function(){var e,i;this._alertWindow=t.buildTag("div#e-fe_deleteAlert"),e=this._selectedItems.length>1?String.format(this._getLocalizedLabels("DeleteMultipleFolder"),this._selectedItems.length):this._getLocalizedLabels("DeleteFolder")+this._selectedContent+"?";var s=t.buildTag("div.e-fe-dialog-label",e),a=t.buildTag("div.e-fe-dialog-btn"),n=t.buildTag("button.e-fe-btn-ok",this._getLocalizedLabels("OkButton")),o=t.buildTag("button.e-fe-btn-cancel",this._getLocalizedLabels("CancelButton"));a.append(n,o),this._alertWindow.append(s,a),proxy=this,n.ejButton({type:"button",click:function(){proxy._removeDialog(proxy._alertWindowObj),proxy._ajax_folderPath="Directory"==proxy._nodeType?proxy._getFolderPath():proxy._currentPath,proxy._deletion(proxy._selectedItems.length>1?proxy._selectedItems:proxy._selectedContent,proxy._ajax_folderPath),proxy._disableEditingTools()}}),o.ejButton({type:"button",click:function(){proxy._removeDialog(proxy._alertWindowObj)}}),i=function(){n.focus()},this._alertWindow=this._createDialog(this._alertWindow,{width:350,height:"auto",title:this._getLocalizedLabels("Delete"),open:i}),this._alertWindowObj=this._alertWindow.data("ejDialog")},_getFileDetails:function(i,a,n){var o=this,r={data:{ActionType:"Read",Path:i,ExtensionsAllow:this.model.fileTypes,SelectedItems:this._getSelectedItemDetails(this._getFolderPath(i),a?a.text():this.model.selectedItems.length?this.model.selectedItems:this._selectedContent)},url:this.model.ajaxAction,type:"POST",async:!1,success:function(s){if(s=s.hasOwnProperty("d")?s.d:s,!t.isNullOrUndefined(s.error))return void o._showErrorDialog(s.error);for(var r=0;r0?"("+i+")":"")+(t.split(".")[1]?"."+t.split(".")[1]:"");return t},_isNameExist:function(e,t){for(var i=0;i li"),n=0;n div > .e-text"),!0)},_getDuplicateItems:function(e,t,i){var s,a,n,o;for(this._fileExplorer[t]||this._getFileDetails(t),s=this._fileExplorer[t],this._fileExplorer[e]||this._getFileDetails(e),a=this._fileExplorer[e],n=0;n0){var t=!0,i=0;for(this._isStateNavigation=!0,e=this._currentState,--this._currentState;""==this._selectedStates[this._currentState]||this._selectedStates[this._currentState]==this._selectedStates[e];)this._currentState?--this._currentState:t=!1;t&&this._selectedFolder(this._selectedStates[this._currentState]),this._isStateNavigation=!1,(this._currentState==i||this._selectedStates.length-2==this._currentState)&&this._toolBarItems&&this._enableToolbarItem("Forward"),this._currentState==i&&this._toolBarItems&&this._disableToolbarItem("Back")}},_forward:function(){var e;if(this._currentState+11?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)},"move"==e?this._trigger("cut",i):this._trigger("copy",i)},_openAction:function(){var i,s,a,n,o,r,l,d,h;if(this._toRead&&(i=this,!this._onBeforeOpen())){if("Directory"==this._nodeType)if(this._suggestionItems.length)this._selectedFolder(this._originalPath+this._selectedContent);else{for(a=this._treeObj.getSelectedNode(),n=this._selectedContent,this._treeObj.isExpanded(a)||a.find(".e-icon").click(),o=a.find("ul:first>li").find("div:first .e-text"),this._treeObj.hasChildNode(a)||(r=1==this._isTreeNode?this._currentPath:this._currentPath.replace(this._selectedContent+"/",""),this._isTreeNode=!1,this._addChild(this._fileExplorer[r])),l=0;l0&&this._createAddressBar(),this._toolBarItems.find("#"+this._ExplorerId+"Searchbar").length>0&&this._searchDetails(),this._toolBarItems.find("#"+this._ExplorerId+"Layout").length>0&&this._renderLayoutDrpdwn()},_renderLayoutDrpdwn:function(){var s,a,n;for(this._showLayoutDDL=t.buildTag("button#"+this._ExplorerId+"_layout","","",{title:this._getLocalizedLabels("Layout"),"data-role":"none",type:"button"}),s=e("
      "),this._layoutList=["Tile","Grid","LargeIcons"],i=0;i"+this._getLocalizedLabels(this._layoutList[i])+""));s.appendTo(this._toolBarItems.find("#"+this._ExplorerId+"Layout").html("")),a={},n=this,a.height="24px",a.enableRTL=this.model.enableRTL,a.showRoundedCorner=this.model.showRoundedCorner,a.targetID=this._ExplorerId+"_splitMenu",a.contentType="imageonly",a.buttonMode="dropdown",a.itemSelected=function(e){switch(e.text){case n._getLocalizedLabels("LargeIcons"):n.model.layout="largeicons";break;case n._getLocalizedLabels("Tile"):n.model.layout="tile";break;case n._getLocalizedLabels("Grid"):default:n.model.layout="grid"}n._switchLayoutView()},a.prefixIcon="e-fe-"+this.model.layout,this._showLayoutDDL.appendTo(this._toolBarItems.find("#"+this._ExplorerId+"Layout")),this._showLayoutDDL.ejSplitButton(a),this._splitButtonObj=this._showLayoutDDL.data("ejSplitButton")},_changeLayoutActive:function(i){if(this._splitButtonObj&&this._splitButtonObj.option("prefixIcon","e-fe-"+i),this._toolBarItems&&this._toolBarItems.find("#"+this._ExplorerId+"Layout").length>0)switch(e(e("#"+this._ExplorerId+"_splitMenu").find("li span").removeClass("e-fe-activeicon")),i){case t.FileExplorer.layoutType.LargeIcons:e(e("#"+this._ExplorerId+"_splitMenu").find("li")[2]).find("span").addClass("e-fe-activeicon");break;case t.FileExplorer.layoutType.Tile:e(e("#"+this._ExplorerId+"_splitMenu").find("li")[0]).find("span").addClass("e-fe-activeicon");break;case t.FileExplorer.layoutType.Grid:default:e(e("#"+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("")),"msie"==t.browserInfo().name&&t.ieClearRemover(this._searchbar[0]),this._isWatermark||(this._hiddenSpan=t.buildTag("span.e-input e-placeholder ",i,{display:"block"}).insertAfter(this._searchbar)),this._on(e("#"+this._ExplorerId+"_searchbar"),"keyup",this._onSearchKeyup)},_setUploadLocalization:function(){e.each(t.FileExplorer.Locale,function(e,i){i.UploadSettings&&(t.Uploadbox.Locale[e]=i.UploadSettings)})},_getLocalizedLabels:function(e){return t.FileExplorer.Locale[this.model.locale][e]===s?t.FileExplorer.Locale["en-US"][e]?t.FileExplorer.Locale["en-US"][e]:e:t.FileExplorer.Locale[this.model.locale][e]},_crateToolbarTemplate:function(){this._toolBarItems=t.buildTag("div#"+this._ExplorerId+"_toolbar").prependTo(this.element);for(var e=0;e0&&this._createToolsItems(this.model.tools[items],items))},_createToolsItems:function(i,s){var a,n,o=t.buildTag("ul#"+(this._ExplorerId+s));for(o.addClass("e-ul-"+s),n=0;n
      "),a.appendTo(o);o.appendTo(this._toolBarItems)},_customTools:function(i){for(var s,a,n,o=0;o
      "),n=i[o].action,"string"==typeof n&&(n=t.util.getObject(n,window)),t.isNullOrUndefined(i[o].action)||this._on(a,"click",n),e(i[o].template).appendTo(a.find("div")),a.appendTo(s),s.appendTo(this._toolBarItems)},_toolBarClick:function(t){var i,s,a=this;if(t.event.which&&(3==t.event.which||2==t.event.which)||t.event.button&&2==t.event.button)return!1;if(""!=this.model.ajaxAction&&""!=this._currentPath)switch(this._lastFocusedElement=e(t.currentTarget),i=e(t.currentTarget),s=i.attr("id")){case this._ExplorerId+"Addressbar":case this._ExplorerId+"Searchbar":this._searchbar&&!this._isWatermark&&(this._searchbar.blur(function(){a._searchbar.val()||a._hiddenSpan.css("display","block")}),this._hiddenSpan.css("display","none")),i.find("input").focus(),i.find("input").select();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.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=[],e.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=[],"grid"==this.model.layout?this._renderGridView(this._fileExplorer[this._originalPath]):this._renderTileView(this._fileExplorer[this._originalPath]),this._updateItemStatus(this._fileExplorer[this._originalPath])},_updateItemStatus:function(e){e&&this._itemStatus&&this._itemStatus.html(e.length+" "+(1==e.length?this._getLocalizedLabels("Item"):this._getLocalizedLabels("Items")))},_onSearchKeyup:function(e){var t=this,e=e;clearTimeout(this._searchTimer),this._searchTimer=setTimeout(function(){t._validateKeyCode(e)},300)},_validateKeyCode:function(e){var t;switch(e.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]),"grid"==this.model.layout?this._addFocus(this._gridtag.find(".e-gridcontent")):this._addFocus(this._tileViewWrapper);break;case 9:case 46:case 8:case 13:default:this._queryString=e.currentTarget.value,t=this._addresstag.val(),this._removeOldSelectionDetails(),this._currentPath=this._currentPath.split(t)[0]+t,this._getFilteredList(this._fileExplorer[this._currentPath])}},_onDialogClose:function(){e("body").find("#"+this._ExplorerId+"_basicDialog_wrapper").remove(),this._lastFocusedElement&&this._lastFocusedElement.focus()},_switchView:function(e){var i=!1;e.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(),this._addFocus(this._statusbar))},_switchLayoutView:function(e){var i,s=!1,a=this._searchbar&&""!=this._searchbar.val()&&this._suggestionItems.length>=0?this._suggestionItems:this._fileExplorer[this._originalPath];switch(this._currentPath=this._originalPath,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(a),s=!0;break;case t.FileExplorer.layoutType.Grid:default:this._tileView&&this._tileContent.parent().hide(),this._gridtag.show(),this._renderGridView(a),this._statusbar&&(this._statusbar.find(".e-swithListView").removeClass("e-active"),this._statusbar.find(".e-switchGridView").addClass("e-active")),s=!0}this._changeLayoutActive(this.model.layout),s&&(this._updateItemStatus(a),this._setSelectedItems(this.model.selectedItems),i={layoutType:this.model.layout,isInteraction:!e},this._trigger("layoutChange",i))},_wireEvents:function(){this._on(e("#"+this._ExplorerId+"_newFolder"),"click",this._createNewFolder),this._on(e("#"+this._ExplorerId+"_switchGridView"),"click",this._switchView),this._on(e("#"+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)},_onHideContextMenu:function(){this._treeObj&&this._treeObj.element.find(".e-node-focus").removeClass("e-node-focus")},_adjustSize:function(e){this._isWindowResized=!!e,this.adjustSize()},_closeDialog:function(t){this._unwireDialogEvent(t),e(t.target).closest("div.e-dialog").find(".e-dialog").ejDialog("close")},_searchPath:function(i){var s,a=this._getKeyCode(i);switch(a){case 13:this._searchbar&&this._searchbar.val("");var n=this._addresstag.val(),o=n.split("/"),r=this._treetag;for(s=0;s0&&e.blur()},_subControlsSetModel:function(e,t){var i={};i[e]=t,this._treeObj&&this._treeObj.option(e,t),this._downloadDialogObj&&this._downloadDialogObj.isOpen()&&this._downloadDialogObj.option(e,t),this._newFolderDialogObj&&this._newFolderDialogObj.isOpen()&&this._newFolderDialogObj.option(e,t),this._renameDialogObj&&this._renameDialogObj.isOpen()&&this._renameDialogObj.option(e,t),this._openDialogObj&&this._openDialogObj.isOpen()&&this._openDialogObj.option(e,t),this._detailsDialogObj&&this._detailsDialogObj.isOpen()&&this._detailsDialogObj.option(e,t),this._alertDialogObj&&this._alertDialogObj.isOpen()&&this._alertDialogObj.option(e,t),this._alertWindowObj&&this._alertWindowObj.isOpen()&&this._alertWindowObj.option(e,t),this._treeContextMenutag&&this._treeMenuObj.option(e,t),this._tileContextMenutag&&this._viewMenuObj.option(e,t),this._toolBarObj&&this._toolBarObj.option(e,t),this._uploadtag&&this._uploadtag.data("ejUploadbox").option(e,t),this._splitObj&&this._splitObj.option(e,t),this._splitButtonObj&&this._splitButtonObj.option(e,t),this._statusbar.find("button").length&&this._statusbar.find("button").ejButton(i),this._headCheckObj&&this._headCheckObj.option(e,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(e){e.close();var t=e._overLay;t&&t.remove(),e._ejDialog.remove()},_reSizeHandler:function(){if(this._splitterCorrection(),""!=this.model.ajaxAction&&""!=this._currentPath){if("grid"==this.model.layout){var e=this._splittag.outerHeight()-this._gridtag.find(".e-gridheader").outerHeight();this._gridObj&&this._gridObj.option("scrollSettings",{height:this.model.showFooter?e-this._statusbar.outerHeight():e,width:this._splittag.find(".e-cont2").width()}),this._gridObj&&this._gridObj.getContentTable().css("width",this._gridObj.getContent().find(".e-content").width())}else this._tileScroll&&this._tileScroll.option("width",this._splittag.find(".e-cont2").width()),this._setThumbImageHeight();this._treeScroll&&this._treeScroll.option("width",this._splittag.find(".e-cont1").width()),this._waitingPopup&&this._waitingPopup.refresh()}},_splitterCorrection:function(){var e=this._splittag.find(this.model.enableRTL?".e-cont2":".e-cont1").width()-1;this._splittag.find(".e-split-divider").css("left",e).css("z-index",1)},_findCommand:function(t,i){return e.each(i,function(e,i){for(var s=0,a=i.length;s0?this._toolBarObj.itemsContainer.find("li#"+t):this._toolBarObj.itemsContainer.find("li#"+this._ExplorerId+t.replace(/ /g,"")):this._toolBarObj.itemsContainer.find("li").eq(t)),t=e(t),e(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 e=[this._menuRename,this._menuDelete,this._menuCut],t=0;t|",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",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(e,t){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,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",showRefreshButton:"boolean",enableRTL:"boolean",mapper:"string",hatchStyle:"enum",enablePattern:"boolean"},_init:function(){this._initialize(),this._wireEvents()},_initialize:function(){e("#"+this._id+"_RefreshButton").ejButton({size:"normal",showRoundedCorner:!0,contentType:"imageonly",prefixIcon:"e-captcha refreshicon",type:"button"}),e("#"+this._id+"_PlayAudio").ejButton({size:"normal",showRoundedCorner:!0,contentType:"imageonly",prefixIcon:"e-captcha audioicon",type:"button"}),this._control=e("#"+this._id).get(0),this.model.targetInput||(this.model.targetInput=this._id+"_ValidText"),this._target=e("#"+this.model.targetInput).get(0),this._captchaImage=e("#"+this._id+"_CaptchaImage").get(0),this._message=e("#"+this._id+"_CaptchaMessage").get(0),this._refreshButton=e("#"+this._id+"_RefreshButton").get(0),this._form=e(this._target).parents("form")[0],this._audioObject=e("#"+this._id+"_AudioObject").get(0),this._audioButton=e("#"+this._id+"_PlayAudio").get(0),this._audioPluginObject=null,this._audioType="audio/wav",this._submitButton=e("#"+this.model.targetButton).get(0),this._submitButton||(this._submitButton=e("[id$='"+this.model.targetButton+"']").get(0)),this._hiddenField=e("#"+this._id+"_Hidden").get(0),this._audioObject&&(this._isSupportAudio(this._audioType)||this._appendAudioPlugin())},_wireEvents:function(){this._FormSubmitDelegate=e.proxy(this.formSubmit,this),this._CaptchaRefreshDelegate=e.proxy(this.refresh,this),this._PlayAudioDelegate=e.proxy(this.playAudio,this),this._audioButton&&e(this._audioButton).on("click",this._PlayAudioDelegate),this._submitButton&&e(this._submitButton).on("click",this._FormSubmitDelegate),this._refreshButton&&e(this._refreshButton).on("click",this._CaptchaRefreshDelegate)},_unwireEvents:function(){this._audioButton&&e(this._audioButton).unbind("click",this._PlayAudioDelegate),this._submitButton&&e(this._submitButton).unbind("click",this._FormSubmitDelegate),this._refreshButton&&e(this._refreshButton).unbind("click",this._CaptchaRefreshDelegate)},playAudio:function(){try{this._audioPluginObject?this._audioPluginObject.Play():this._audioObject&&this._audioObject.play&&this._audioObject.play()}catch(e){}},_isSupportAudio:function(e){return!!document.createElement("audio").canPlayType&&!!document.createElement("audio").canPlayType(e).match(/maybe|probably/i)},_appendAudioPlugin:function(){e(this._audioPluginObject).remove();var t=this._createAudioPluginObject();this._audioObject.parentNode.appendChild(t),this._audioPluginObject=e("#"+this._id+"_AudioPlugin").get(0)},_createAudioPluginObject:function(){var e=document.createElement("embed");return e.setAttribute("id",this._id+"_AudioPlugin"),e.setAttribute("src",this.model.audioUrl),e.setAttribute("name","AudioPlugin"),e.setAttribute("enablejavascript","true"),e.setAttribute("type","audio/wav"),e.setAttribute("autostart","false"),e.setAttribute("pluginspage","http://www.apple.com/quicktime/download/"),e.style.top=0,e.style.left=0,e.style.width="0px", e.style.height="0px",e.style.position="absolute",e},_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(e){}this._captchaImage.src=i.NewChallenge,this._audioObject&&(this._audioObject.src=i.AudioLink),this.model.audioURL=i.AudioLink,this._audioPluginObject&&this._appendAudioPlugin(),this.model.isValid="False"!=i.Validation,this.model.enableAutoValidation&&this._displayMessages(),e("#"+this._id+"_ValidText")&&e("#"+this._id+"_ValidText").val(""),this.model.encryptedCode=i.Script,e(this._hiddenField).val(this.model.encryptedCode)},_displayMessages:function(){this.model.isValid?e("#"+this._id+"_CaptchaMessage").html(""):(e("#"+this._id+"_CaptchaMessage").html(this.model.customErrorMessage),e("#"+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(e){}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,e(this._hiddenField).val(i.EncryptedText)},formSubmit:function(t){var i=this,s={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:e(this._target).val(),Id:this._id,HatchStyle:this.model.hatchStyle,EnablePattern:this.model.enablePattern,RequestType:"CaptchaRequest",ActionType:"Validation"};return e.ajax({type:"POST",url:this.model.requestMapper?this.model.requestMapper:this.model.pathName+"/"+this.model.mapper,data:JSON.stringify({captchaModel:s}),dataType:"json",contentType:"application/json; charset=utf-8",async:!1,success:function(e){e&&i._onSuccess(e)},error:function(){i._trigger("refreshFailure")}}),!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"},s=this.model.refreshBegin,a=this.model;return(!s||(s(t,a),!a.getCancel()))&&void e.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(e){e&&(t._onRefreshSuccess(e),t._trigger("refreshSuccess"))},error:function(){t._trigger("refreshFailure")},complete:function(){t._trigger("refreshComplete")}})}}),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"}}(jQuery,Syncfusion),function(e,t,s){t.gridFeatures=t.gridFeatures||{},t.gridFeatures.common={refreshContent:function(e){e&&(this.refreshTemplate(),this._refreshHeader());var i={};this._initialRenderings(),i.requestType=t.Grid.Actions.Refresh,this._processBindings(i)},rowHeightRefresh:function(){var i,s;if(this.model.scrollSettings.frozenColumns>0&&!t.isNullOrUndefined(this.model.currentViewData)&&this.model.currentViewData.length){var a=this.getContentTable().get(0).rows,n=this.getContentTable().get(1).rows,o=0;if(this.getContent().find(".e-frozencontentdiv").is(":visible"))for(i=0;i0))}},dataSource:function(e,t){t&&(this._templateRefresh=!0),this._dataSource(e),this.model.scrollSettings.enableVirtualization||(e.length>0?this._currentPage(1):this._currentPage(0)),this._refreshDataSource(e);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.length0&&this.model.columns.indexOf(this.model.columns[o])0&&(d=this._renderGridHeader(),this.element.find(".e-gridheader").replaceWith(d[0]),this.model.allowFiltering&&"filterbar"==this.model.filterSettings.filterType&&this._renderFiltering(),this.model.allowReordering&&this._headerCellreorderDragDrop()),this.refreshTemplate(),this.model.scrollSettings.allowVirtualScrolling&&this._virtualShowHide(m),this.sendDataRenderingRequest(m),this.rowHeightRefresh(),this.model.allowScrolling&&(0==this.model.scrollSettings.frozenColumns&&"msie"==this.getBrowserDetails().browser&&(h=this._calculateWidth(),this.getHeaderTable().width(h),this.getContentTable().width(h)),t.isNullOrUndefined(this._scrollObject)||this.getScrollObject().refresh()),this.model.showColumnChooser&&this._refreshColumnChooserList(),this.model.allowScrolling&&this.model.scrollSettings.frozenColumns>0&&(g==this.model.scrollSettings.frozenColumns&&(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"]="",c=this.model.scrollSettings.width-this._scrollObject._vScrollbar["e-vscroll"].width()-1,this.model.scrollSettings.width>this.getContent().find(".e-movablecontentdiv").width()&&(this.getContent().find(".e-movablecontentdiv").width(c),this.getHeaderContent().find(".e-movableheaderdiv").width(c)),this._scrollObject.option("scrollLeft",0)),this.getScrollObject().refresh()),this._showHideColumns=!1},showColumns:function(i){var s,a,n,o,r,l,d,h,c=0,u={},m=[];s="string"==typeof i?this.getColumnByHeaderText(i):this.getColumnByHeaderText(i[0]),a="string"==typeof i?this.getColumnByField(i):this.getColumnByField(i[0]),this._showHideColumns=!0;var p=this._isDuplicate(e.merge(e.merge([],this._visibleColumns),this._hiddenColumns)),g=p?"_hiddenColumnsField":"_hiddenColumns",_=p?"_visibleColumnsField":"_visibleColumns";if(!p&&null!=a)if(e.isArray(i))for(d=0;d0){for(r=!1,d=0;d0&&(r=this.getHeaderTable().find(".e-filterdiv input"));var C=t.isNullOrUndefined(r),S={cellattributes:[],headerattributes:[],filtercellattributes:[],filterThattributes:[]},T=i1&&y.eq(L).prepend(this._createSortNumber(I,y.eq(L)).addClass("e-sortnumber")),y.eq(L).append(this._createSortElement().addClass("e-"+(k.direction||"ascending")+" "+imageDirection))):(y.eq(L).append(this._createSortElement().addClass("e-"+(k.direction||"ascending")+" "+imageDirection)),this.model.sortSettings.sortedColumns.length>1&&y.eq(L).append(this._createSortNumber(I,y.eq(L)).addClass("e-sortnumber")))}else imageDirection="descending"!=k.direction?"e-rarrowup-2x":"e-rarrowdown-2x",y.eq(L).append(this._createSortElement().addClass("e-"+(k.direction||"ascending")+" "+imageDirection))}v={},v.requestType=t.Grid.Actions.Reorder,this._isReorder=!0,this.refreshTemplate(),this._isAddNew&&this.model.isEdit&&(this.model.query=this.commonQuery.clone(),this._ensureDataSource(v),this._isAddNew=!1),this.sendDataRenderingRequest(v),this._isReorder=!1}},getPager:function(){return this._gridPager},getFooterTable:function(){return this._gridFooterTable},setGridFooterTable:function(e){this._gridFooterTable=e},getFooterContent:function(){return this._gridFooterContent},setGridFooterContent:function(e){this._gridFooterContent=e},getScrollObject:function(){return(null==this._scrollObject||t.isNullOrUndefined(this._scrollObject.model))&&(this._scrollObject=this.getContent().ejScroller("instance")),this._scrollObject},setGridPager:function(e){this._gridPager=e},getRowHeight:function(){var e,t,i,s=-1;return null!=this.getContentTable()&&(e=this.getContentTable().find("tr:not(.e-virtualrow)"),t=e.length>2?1:0,e.length&&(i=e[t].getBoundingClientRect()),e.length>1&&(s=i&&i.height?i.height:e[t].offsetHeight)),s==-1?32:s},getCurrentIndex:function(){return(this._currentPage()-1)*this.model.pageSettings.pageSize},getColumnByIndex:function(e){return es.totalPages||e<1||e==this._currentPage())&&(t.isNullOrUndefined(this._prevPageNo)&&(this._prevPageNo=this._currentPage()),this._currentPage(e),this._currentPage()!=this._prevPageNo&&(i={},i.requestType="paging",this.gotoPage(this._currentPage(),i),!0))},set_currentVirtualIndex:function(e){var t,i;return!(e<1||1!=e&&e!=this._totalVirtualViews&&e==this._currentVirtualIndex&&this._checkCurrentVirtualView(this._virtualLoadedRows,e))&&(this._prevVirtualIndex=this._currentVirtualIndex,this._currentVirtualIndex=e,t=this._calculateCurrentViewPage(),t<=this.model.pageSettings.totalPages&&!this._checkCurrentVirtualView(this._virtualLoadedRecords,this._currentVirtualIndex)?this._prevVirtualIndexe?(i=this._isThumbScroll?t:t-1,this._virtualPageRecords[i]&&!this._virtualLoadedRecords[e-1]&&(i=t-1),!this._virtualPageRecords[i]&&i>=1&&this._setCurrentViewPage(i)):this._renderVirtulViewContent(t):this._renderVirtulViewContent(t),!0)},_setCurrentViewPage:function(e){this._needPaging=!0,this._prevPageNo=this._currentPage(),this.gotoPage(e)},_renderVirtulViewContent:function(){this._needPaging=!1,this._refreshVirtualView(this._currentVirtualIndex),this.element.ejWaitingPopup("hide")},_checkCurrentVirtualView:function(t,i){var s,a=this._virtualRowCount,n=i-1,o=i+1;if(t instanceof Array){if(t.length&&((0==n||o==this._totalVirtualViews+1)&&e.inArray(i,t)!=-1||e.inArray(n,t)!=-1&&e.inArray(i,t)!=-1&&e.inArray(o,t)!=-1))return!0}else if(s=o==this._totalVirtualViews?this._lastViewData:a,!this.initialRender&&1==i&&this._virtualLoadedRows[i]||i==this._totalVirtualViews&&t==this._virtualLoadedRows&&t[i]||0==n&&t[i]&&t[i].length==a||o==this._totalVirtualViews+1&&t[i]&&t[i].length==this._lastViewData||t[n]&&t[n].length==a&&t[i]&&t[i].length==a&&t[o]&&t[o].length==s)return!0;return!1},expandCollapse:function(i){var a,n,o,r,l,d,h,c,u,m,p,g,_,f;if("DIV"==i.prop("tagName")&&(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(n=i.attr("ej-mappingname"),fieldValue=i.attr("ej-mappingvalue"),i.parents(".e-tabletd").length&&(o=i.parents(".e-tabletd").parent("tr").prev("tr").find(".e-recordplusexpand").attr("ej-mappingvalue")),r=this.model._groupingCollapsed,f=0;f0&&p.push(_)),i.removeClass("e-recordpluscollapse").addClass("e-recordplusexpand").find("div").removeClass("e-gnextforward").addClass("e-gdiagonalnext"),f=0;f0?this.getIndexByRow(i.closest("tr"))-i.closest("tr").parents("tr").prevAll("tr").find("td.e-summaryrow").parent().length:this.getIndexByRow(i.closest("tr")),l=i.closest("tr").next(),l.hide(0,function(){var e={masterRow:i.closest("tr"),detailsRow:l,masterData:h._currentJsonData[c]},s=h._getForeignKeyData(e.masterData);t.isNullOrUndefined(s)||(e.foreignKeyData=s),h._trigger("detailsCollapse",e),null!=h.model.childGrid&&h.model.allowScrolling&&h._refreshScroller({requestType:"refresh"})}),i.removeClass("e-detailrowexpand").addClass("e-detailrowcollapse").find("div").addClass("e-gnextforward").removeClass("e-gdiagonalnext");else if(i.hasClass("e-detailrowcollapse")){if(d=i.index(),h=this,c=this.model.groupSettings.groupedColumns.length>0?this.getIndexByRow(i.closest("tr"))-i.closest("tr").parents("tr").prevAll("tr").find("td.e-summaryrow").parent().length:this.getIndexByRow(i.closest("tr")),u=i.closest("tr").next(),u.hasClass("e-detailrow"))l=u;else{var b=t.buildTag("tr.e-detailrow","",{display:"none"},{}),v=t.buildTag("td.e-detailindentcell"),x=this.model.groupSettings.showGroupedColumn?0:this.model.groupSettings.groupedColumns.length,w=t.buildTag("td.e-detailcell","",{},{colspan:this._visibleColumns.length-x}),y=t.buildTag("div"),C=e(i.closest("tr")).parents(".e-grid").length;if(y.attr("id","child"+C+"_grid"+c),e(b).append(v),e(b).append(w),m=this._currentJsonData[c],this.model.detailsTemplate&&e(b).append(w.append(this._renderEjTemplate(this.model.detailsTemplate,m))),e(i.closest("tr")).after(b),this.model.childGrid){var S=this.model.childGrid.queryString,T=this.model.childGrid.foreignKeyField,D=m[S]===s?"undefined":m[S];this.model.childGrid.query=t.Query().where(t.isNullOrUndefined(T)?S:T,"equal",D,!0),this.model.childGrid.parentDetails={parentID:this._id,parentPrimaryKeys:this.getPrimaryKeyFieldNames(),parentKeyField:S,parentKeyFieldValue:m[S],parentRowData:m},e(b).append(w.append(y))}l=b}for(this._showGridLines(),p=[],g=l,e(g[0].cells[d]).hasClass("e-detailindentcell")&&(g.show(0,function(){var e={masterRow:i.closest("tr"),detailsRow:l,masterData:h._currentJsonData[c]},s=h._getForeignKeyData(e.masterData);t.isNullOrUndefined(s)||(e.foreignKeyData=s),h._trigger("detailsExpand",e),null!=h.model.childGrid&&h.model.allowScrolling&&h._refreshScroller({requestType:"refresh"})}),u.hasClass("e-detailrow")||(this._trigger("detailsDataBound",{detailsElement:b,data:m}),this._trigger("refresh")),this.model.childGrid&&!t.isNullOrUndefined(y)&&y.ejGrid(this.model.childGrid),_=g.children(".e-detailrowexpand"),null!=_&&_.length>0&&p.push(_)),i.removeClass("e-detailrowcollapse").addClass("e-detailrowexpand").find("div").addClass("e-gdiagonalnext").removeClass("e-gnextforward"),f=0;f=n?h.eq(a).removeClass("e-hide").index()+n:h.eq(a).removeClass("e-hide").index(),c.eq(o).removeClass("e-hide"),u.length>this.model.columns.length&&this.model.groupSettings.groupedColumns.length&&(r=u.length-this.model.columns.length,u=u.slice(this.model.detailsTemplate||this.model.childGrid?r+1:r)),u.eq(a).css("display","");this.model.showStackedHeader&&this._refreshStackedHeader()},_hideHeaderColumn:function(i,s){for(var a,n,o=this.getHeaderTable().find("thead"),r=o.find("tr").not(".e-stackedHeaderRow").find(".e-headercell"),l=o.find(".e-filterbar").find(".e-filterbarcell"),d=this.getHeaderTable().find("colgroup").find("col"),h=0;h=m?r.eq(u).addClass("e-hide").index()+m:r.eq(u).addClass("e-hide").index(),l.eq(a).addClass("e-hide"),d.length>this.model.columns.length&&(d=d.slice(d.length-this.model.columns.length)),d.eq(c).css("display","none")}this.model.showStackedHeader&&(this._refreshStackedHeader(),this._colgroupRefresh())},_refreshStackedHeader:function(){var t,i,s,a;if(this.model.showStackedHeader){for(t=this.model.stackedHeaderRows,a=0;a0)for(a=0;a0&&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&&0==this.model.groupSettings.groupedColumns.length&&(this.model.editSettings.showAddNewRow&&this.getContentTable().find(".e-addedrow").remove(),i.tr.remove()),this._editForm=this.model.scrollSettings.frozenColumns>0?this.element.find(".gridform"):e("#"+this._id+"EditForm"),this.model.editSettings.showAddNewRow&&"beginedit"==i.requestType||0==this._editForm.length||(this._editForm.length>1&&("save"==i.requestType&&"edit"==i.action||"cancel"==i.requestType)&&(this._editForm="top"==this.model.editSettings.rowPosition?this._editForm[1]:this._editForm[0]),e(this._editForm).find("select.e-dropdownlist").ejDropDownList("destroy"),e(this._editForm).find(".e-datepicker").ejDatePicker("destroy"),e(this._editForm).find(".e-datetimepicker").ejDateTimePicker("destroy"),e(this._editForm).find(".e-numerictextbox").ejNumericTextbox("destroy")),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.model.scrollSettings.allowVirtualScrolling&&!this.model.scrollSettings.enableVirtualization&&this.model.pageSettings.totalPages==this.model.pageSettings.currentPage&&(s=t.pvt.filterQueries(this.model.query.queries,"onPage"),this.model.query.queries.splice(e.inArray(s[0],this.model.query.queries),1),this.model.query.page(this._currentPage()-1,this.model.pageSettings.pageSize),a=this._dataSource().executeQuery(this.model.query),this.model.query.queries.splice(e.inArray(s[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 n=this._queryPromise=this._dataSource().executeQuery(this.model.query),o=(this.element.ejWaitingPopup("instance"),this);this.element.ejWaitingPopup("show"),o._dataSource().ready?o._dataSource().ready.done(function(){o._processDataRequest(o,i,n,a)}):o._processDataRequest(o,i,n,a)}else this._isRelationalRendering(i)?this._setForeignKeyData(i):this.sendDataRenderingRequest(i)},_processDataRequest:function(e,i,s,a){s.done(t.proxy(function(s){var n,o,r;if(0==e._relationalColumns.length&&e.element.ejWaitingPopup("hide"),a&&!e._previousPageRendered)e._processLastPageData(e,i,s.result,a),e.model.previousViewData&&0!=e.model.previousViewData.length&&(e.model.previousViewData.splice(0,s.result.length),e._previousPageLength=s.result.length,e._currentPageData=s.result,t.merge(e.model.previousViewData,s.result),e.model.currentViewData=e.model.previousViewData,e._remoteLastPageRendered=!0);else if(e._remoteLastPageRendered&&e.model.pageSettings.currentPage==e.model.pageSettings.totalPages-1&&!e.model.scrollSettings.enableVirtualization){for(n=e.model.pageSettings.pageSize-e._previousPageLength,o=0;o0&&(e._fkParentTblData=s.result);e.model.allowScrolling&&e.model.scrollSettings.allowVirtualScrolling&&e.model.scrollSettings.enableVirtualization&&("filtering"==i.requestType&&(e._gridRecordsCount=e._filteredRecordsCount=s.count,e._refreshVirtualViewDetails()),s.result.length?(e._isInitNextPage||e._isLastVirtualpage?(e._setInitialCurrentIndexRecords(s.result,e._currentPage()),e._isInitNextPage=e._isLastVirtualpage=!1):e._setVirtualLoadedRecords(s.result,e._currentPage()),e._isThumbScroll&&!e._checkCurrentVirtualView(e._virtualLoadedRecords,e._currentVirtualIndex)&&e._checkPrevNextViews(),e._remoteRefresh=!0):e.getContent().find(".e-virtualtop, .e-virtualbottom").remove()),t.isNullOrUndefined(s.aggregates)||(e._remoteSummaryData=s.aggregates),e._processData(s,i),t.isNullOrUndefined(e._unboundRow)||i.selectedRow==e._unboundRow||"save"!=i.requestType||(e._unboundRow.find(".e-editbutton").trigger("click"),e._unboundRow=null)})),s.fail(t.proxy(function(t){e.element.ejWaitingPopup("hide"),i.error=t.error,t=[],e.model.currentViewData=[],e._processData(t,i),e._trigger("actionFailure",i)}))},_processIdentityField:function(i,s){var a=this._primaryKeys[0],n=t.distinct(i,a),o=t.distinct(this.model.currentViewData,a),r=e.grep(n,function(t){return e.inArray(t,o)==-1});s.data=t.DataManager(i).executeLocal((new t.Query).where(a,"equal",r))[0]},_processLastPageData:function(e,i,s,a){a.done(t.proxy(function(t){e.model.previousViewData=t.result})),a.fail(t.proxy(function(t){e.element.ejWaitingPopup("hide"),i.error=t.error,t=[],e.model.previousViewData=[],e._processData(t,i),e._trigger("actionFailure",i)}))},_createUnboundElement:function(i){var s,a,n,o,r=document.createElement("div");for(i.headerText=t.isNullOrUndefined(i.headerText)?i.field:i.headerText,t.isNullOrUndefined(i.headerText)||(r.id=this._id+i.headerText.replace(/[^a-z0-9|s_]/gi,"")+"_UnboundTemplate"),s=t.buildTag("div.e-unboundcelldiv"),a=i.commands,n=0;n0&&(this.element.append(m),r=this.element.parents("div.e-grid"),l=t.Menu.prototype._showContextMenu,t.Menu.prototype._showContextMenu=function(t,i,s,a){e(this.model.contextMenuTarget).hasClass("e-grid")&&(++t,++i),l.apply(this,[t,i,s,a])},e(m).ejMenu({menuType:t.MenuType.ContextMenu,openOnClick:!1,contextMenuTarget:"#"+this._id,click:e.proxy(this._clickevent,this),width:"auto",beforeOpen:e.proxy(this._menu,this)}),r.length&&(d=e("#"+r[0].id+"_Context"),h=d.ejMenu("model.excludeTarget"),d.ejMenu({excludeTarget:t.isNullOrUndefined(h)||0==h.length?"#"+this._id:h.concat(",#"+this._id)})),this._conmenu=m.data("ejMenu"))},_clickevent:function(i){var s,a,n=i.events.text,o=e(this._contexttarget.parentNode),r=e(this._contexttarget);if(r.hasClass("e-filterset")?r=r.siblings():(r.hasClass("e-icon")||r.hasClass("e-number"))&&(r=r.parent()),s=r.attr("ej-mappingname")||r.find(".e-headercelldiv").attr("ej-mappingname"),!this._trigger("contextClick",i))switch(n){case this.localizedLabels.AddRecord:this._startAdd();break;case this.localizedLabels.EditRecord:if("batch"==this.model.editSettings.editMode){var l=e(this._contexttarget.parentNode).find(".e-rowcell").index(r),d=this._excludeDetailRows().index(o),h=this.model.columns[l].field;this.editCell(d,h)}else this.startEdit(o);break;case this.localizedLabels.DeleteRecord:this.model.editSettings.showDeleteConfirmDialog?this._confirmDialog.find(".e-content").html(this.localizedLabels.ConfirmDelete).end().ejDialog("open"):this.deleteRow(o);break;case this.localizedLabels.Save:this.endEdit();break;case this.localizedLabels.Cancel:this.cancelEdit();break;case this.localizedLabels.SortInDescendingOrder:a=t.sortOrder.Descending,this.sortColumn(s,a);break;case this.localizedLabels.SortInAscendingOrder:a=t.sortOrder.Ascending,this.sortColumn(s,a);break;case this.localizedLabels.Grouping:this.groupColumn(s);break;case this.localizedLabels.Ungrouping:this.ungroupColumn(s);break;case this.localizedLabels.NextPage:case this.localizedLabels.PreviousPage:case this.localizedLabels.LastPage:case this.localizedLabels.FirstPage:this._page(i)}},_menu:function(i){var s,a,n,o,r,l,d,h,c,u,m,p=this._conmenu.element;if(this._contexttarget=i.target,s=e(i.target),o=e(this._contexttarget),o.hasClass("e-rowcell")&&this.model.allowSelection&&(this.model.isEdit||this.selectRows(this.getIndexByRow(o.parent()),null,o)),(s.hasClass("e-ascending")||s.hasClass("e-descending"))&&!s.parent().hasClass("e-headercelldiv"))return!1;a=s.hasClass("e-filtericon")||s.hasClass("e-headercelldiv")?i.target.parentNode.getAttribute("aria-sort"):s.hasClass("e-headercell")?i.target.getAttribute("aria-sort"):s.parent().parent().attr("aria-sort"),r=i.target.className,l=e(p),n=s.hasClass("e-filterset")?s.siblings().attr("ej-mappingname"):s.hasClass("e-icon")||s.hasClass("e-number")?s.parent().attr("ej-mappingname"):s.hasClass("e-headercell")?s.find(".e-headercelldiv").attr("ej-mappingname"):s.attr("ej-mappingname"),p.css("visibility","visible");var g=s.closest("tr").hasClass("e-insertedrow")?this.model.groupSettings.groupedColumns.length:0,_=s.closest(".e-rowcell"),f=s.closest(".e-headercell"),b=_.index()!=-1?_.index():f.index()-this.model.groupSettings.groupedColumns.length,v=s.hasClass("e-rowcell")?s.index()-g:b-g;v=null!=this.model.detailsTemplate||null!=this.model.childGrid?v-1:v,d=this.model.columns[v],h={allowGrouping:".e-contextgrouping",allowSorting:".e-contextascending, .e-contextdescending","editSettings.allowAdding":".e-contextadd","editSettings.allowEditing":".e-contextedit","editSettings.allowDeleting":".e-contextdelete"};for(c in h)u=p.find(h[c]).parent(),0==t.getObject(c,this.model)||t.getObject(c,d)===!1?u.css("display","none"):"none"==u.css("display")&&u.css("display","block");if(s.closest(".e-grid").attr("id")!==this._id||s.is("input"))return void p.css("visibility","hidden");if(this.getHeaderTable().find(s).length>0){if(0==f.length||!f.children().hasClass("e-headercelldiv"))return void p.css("visibility","hidden");m=e(p.find(".e-head")),p.find(".e-page").css("display","none"),p.find(".e-content").css("display","none"),p.find(".e-savcan").css("display","none"),m.css("display","block"),(t.isNullOrUndefined(d.field)||""==d.field)&&(m.css("display","none"),0==p.find(".e-customitem").length&&p.css("visibility","hidden"))}else if(this.getContentTable().find(s).length>0){if(0==_.length)return void p.css("visibility","hidden");m=e(p.find(".e-content")),p.find(".e-head").css("display","none"),p.find(".e-page").css("display","none"),p.find(".e-savcan").css("display","none"),m.css("display","block"),(t.isNullOrUndefined(d.field)||""==d.field)&&"batch"==this.model.editSettings.editMode&&(m.css("display","none"),0==p.find(".e-customitem").length&&p.css("visibility","hidden"))}else{if(!(this.getPager().find(s).length>0||s.hasClass("e-pager")))return m=e(p),p.css("visibility","hidden"),!1;m=e(p.find(".e-page")),p.find(".e-head").css("display","none"),p.find(".e-content").css("display","none"),p.find(".e-savcan").css("display","none"),m.css("display","block")}switch(a){case"ascending":l.find(".ascending").parent().css("display","none");break;case"descending":l.find(".descending").parent().css("display","none")}this.model.isEdit&&s.hasClass("e-rowcell")&&(m=e(p.find(".e-savcan")),p.find(".e-head").css("display","none"),p.find(".e-content").css("display","none"),p.find(".e-page").css("display","none"),m.css("display","block")),1==this.model.pageSettings.totalPages&&m.hasClass("e-page")?0==p.find(".e-customitem").length?p.css("visibility","hidden"):p.find(".e-page").css("display","none"):1==this.model.pageSettings.currentPage?(l.find(".previous").parent().css("display","none"),l.find(".first").parent().css("display","none")):this.model.pageSettings.currentPage==this.model.pageSettings.totalPages&&(l.find(".last").parent().css("display","none"),l.find(".nextpage").parent().css("display","none")),this.model.groupSettings.groupedColumns.indexOf(n)!=-1?m.find(".group").parent().css("display","none"):this.model.groupSettings.groupedColumns.indexOf(n)==-1&&m.find(".ungroup").parent().css("display","none"),this.model.contextOpen&&this._trigger("contextOpen",i)},_items:function(i,s){var a,n,o,r;return""!=i&&("contextMenuItem"==s&&(i.indexOf("Record")!=-1?(n=t.buildTag("li","",{},{class:"e-content"}),n.css("display","none")):i.indexOf("Page")!=-1?(n=t.buildTag("li","",{},{class:"e-page"}),i.indexOf("Next")!=-1?a=t.buildTag("div","",{},{class:"nextpage"}):i.indexOf("Previous")!=-1?a=t.buildTag("div","",{},{class:"previous"}):i.indexOf("Last")!=-1?a=t.buildTag("div","",{},{class:"last"}):i.indexOf("First")!=-1&&(a=t.buildTag("div","",{},{class:"first"})),n.css("display","none")):"Save"==i||"Cancel"==i?(n=t.buildTag("li","",{},{class:"e-savcan"}),n.css("display","none")):(i.indexOf("Order")!=-1||"Grouping"==i||"Ungrouping"==i)&&(n=t.buildTag("li","",{},{class:"e-head"}),i.indexOf("Ascending")!=-1?a=t.buildTag("div","",{},{class:"ascending"}):i.indexOf("Descending")!=-1?a=t.buildTag("div","",{},{class:"descending"}):"Grouping"==i?a=t.buildTag("div","",{},{class:"group"}):"Ungrouping"==i&&(a=t.buildTag("div","",{},{class:"ungroup"})),n.css("display","none"))),t.isNullOrUndefined(n)&&(n=t.buildTag("li","",{},{class:"e-customitem"}),n.css("display","block")),n.append(a),o=document.createElement("a"),r="","string"==typeof i&&(r=i.indexOf("Ascending")!=-1?"ascending":i.indexOf("Descending")!=-1?"descending":i.split(" ")[0].toLowerCase(),o.innerHTML=t.isNullOrUndefined(this.localizedLabels[i.replace(/\s+/g,"")])?i:this.localizedLabels[i.replace(/\s+/g,"")]),"object"==typeof i&&(r="Ascending"==i.id?"ascending":"Descending"==i.id?"descending":i.id.split(" ")[0].toLowerCase(),o.innerHTML=t.isNullOrUndefined(this.localizedLabels[i.text.replace(/\s+/g,"")])?i.text:this.localizedLabels[i.text.replace(/\s+/g,"")],n.attr("id",i.id)),e(o).append(t.buildTag("span","",{},{class:"e-gridcontext e-icon e-context"+r})),n.append(o),n)},_page:function(e){var t;"Next Page"==e.events.text?(t=this.model.pageSettings.currentPage,++t,this.gotoPage(t)):"Previous Page"==e.events.text?(t=this.model.pageSettings.currentPage,t>1?(--t,this.gotoPage(t)):this.gotoPage(t)):"Last Page"==e.events.text?(t=this.model.pageSettings.totalPages,this.gotoPage(t)):this.gotoPage(1)},gotoPage:function(e){var i,s,a;(this.model.allowPaging||this.model.allowScrolling||this.model.scrollSettings.allowVirtualScrolling)&&(i={},i.previousPage=this._currentPage(),this._currentPage(e),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=e,this.model.allowPaging&&(i.requestType=t.Grid.Actions.Paging),this.model.scrollSettings.allowVirtualScrolling&&this.model.allowScrolling&&(this._isVirtualRecordsLoaded=!1,a=this._refreshVirtualPagerInfo(),this._showPagerInformation(a),i.requestType=t.Grid.Actions.VirtualScroll),s=this._processBindings(i),s&&this._currentPage(i.previousPage),this._primaryKeyValues=[])},_gPagerClickHandler:function(e){if(this._prevPageNo!=e.currentPage)return this.model.masterObject.gotoPage(e.currentPage),!1},_processData:function(e,i){this._gridRecordsCount=0==e.count&&this.model.currentViewData.length?e.result.length:e.count,null!=this.getPager()&&(this.model.pageSettings.totalRecordsCount=this._gridRecordsCount),(i.requestType==t.Grid.Actions.Filtering||t.Grid.Actions.Save||this.model.filterSettings.filteredColumns.length>0&&i.requestType==t.Grid.Actions.Refresh)&&(this._filteredRecordsCount=e.count),this._setForeignKeyData(i),0==this._relationalColumns.length&&this.sendDataRenderingRequest(i)},_frozenCell:function(t,i){var s=i,a=0,n=this.getRowByIndex(t);return i>=this.model.scrollSettings.frozenColumns&&(a=1,s-=this.model.scrollSettings.frozenColumns),e(n.eq(a).find(".e-rowcell:eq("+s+")"))},_frozenColumnSelection:function(t,i,s){var a,n,o=i,r=0;if(s)for(n=i;n=this.model.scrollSettings.frozenColumns&&(r=1,o=n-this.model.scrollSettings.frozenColumns),a=0;a=this.model.scrollSettings.frozenColumns&&(r=1,o=i-this.model.scrollSettings.frozenColumns),n=0;n0){if(e=t.buildTag("div.e-gridfooter"),i=t.buildTag("table.e-gridsummary","",{},{cellspacing:"0.25px"}),this.setGridFooterContent(e),this.model.scrollSettings.frozenColumns>0){var s=t.buildTag("div.e-frozenfooterdiv"),a=t.buildTag("div.e-movablefooter"),n=i.clone(),o=t.buildTag("div.e-movablefooterdiv");a.append(o),i.append(this.getHeaderTable().first().find("colgroup").clone()),n.append(this.getHeaderTable().last().find("colgroup").clone()),s.append(i),o.append(n),this.setGridFooterTable(i.add(n)),this._createSummaryRows(this.getFooterTable()),e.append(s.add(a)),e.find(".e-frozenfooterdiv").outerWidth(this.getHeaderContent().find(".e-frozenheaderdiv").width()).end().find(".e-movablefooterdiv").outerWidth(this.getContent().find(".e-movablecontentdiv").width())}else i.append(this.getHeaderTable().find("colgroup").clone()),this.setGridFooterTable(i),this._createSummaryRows(this.getFooterTable()),e.append(i);return e}throw"summary row collection is missing"},_setSummaryAggregate:function(e){for(var t,i,s,a=this.model.summaryRows,n=0,o=a.length;n0&&i.find("tbody").remove();var l=t.buildTag("tbody"),d=this,h=l.clone(),c=this.model.summaryRows;!t.isNullOrUndefined(s)&&this._isCaptionSummary&&(c=this._captionSummary(o)),e.each(c,function(c,u){var m,p,g,_,f,b;if(u.showTotalSummary===!1&&t.isNullOrUndefined(s)||u.showGroupSummary===!1&&o&&!t.isNullOrUndefined(s))return!0;if(m=t.buildTag("tr.e-gridSummaryRows"),t.isNullOrUndefined(n&&n.level))for(b=0;b"):m.prepend(""));var v=d.getHeaderTable().find("td").clone().addClass("e-summaryrow"+p),g=0;if(t.isNullOrUndefined(u.titleColumn)||(g=d.getColumnIndexByField(u.titleColumn),g>=d.model.columns.length&&(g=d.getColumnIndexByHeaderText(u.titleColumn))),v=d._assignTitleColumn(g,u.title,v,0),d._hideSummaryColumn(v,r),d.model.scrollSettings.frozenColumns>0)_=m.clone(),l.append(m.append(v.slice(0,d.model.scrollSettings.frozenColumns))),h.append(_.append(v.slice(d.model.scrollSettings.frozenColumns)));else if(d._isCaptionSummary&&!o||t.isNullOrUndefined(n&&n.level))l.append(m.append(v));else{var x=d.model.groupSettings.groupedColumns.length-n.level+1,w=i.clone().addClass("e-groupsummary"),y={};for(y.data={items:n},m.prepend(""),e(m[0].cells).filter(".e-summaryrow").html(w.append(t.buildTag("tr",v))),f=w.find("col").length-(d.model.columns.length+x),b=0;b"),e(w.find("col")[b]).addClass("e-summary");l.append(m)}e.each(u.summaryColumns,function(i,n){var o,r,l,h;o="custom"!=n.summaryType?a?a[n.dataMember+" - "+n.summaryType]:d._remoteSummaryData[n.dataMember+" - "+n.summaryType]:d.getSummaryValues(n,s),prefix=n.prefix?n.prefix:"",r=d.getColumnIndexByField(n.displayColumn),l=n.suffix?n.suffix:"",d.model.allowScrolling&&e(v[r]).addClass("e-scroller"),""!=e(v[r]).html()&&""==prefix&&(prefix=e(v[r]).html()),t.isNullOrUndefined(n.template)?r!=-1&&e(v[r]).html(prefix+(n.format?d.formatting(n.format,o,d.model.locale):o)+l).css("text-align",d.model.columns[r].textAlign):(h={summaryValue:n.format?d.formatting(n.format,o,d.model.locale):o,summaryColumn:n},e(v[r]).html(e.render[d._id+"_summaryTemplate"+n.template](h)).css("text-align",d.model.columns[r].textAlign),e(v[r]).addClass("e-summarytemplate"))})}),this.model.scrollSettings.frozenColumns>0?(i.first().append(l),i.last().append(h)):i.append(l)},_assignTitleColumn:function(e,t,i,s){for(var a,n=e;n0?this._filteredRecords:this._dataSource():s,n instanceof t.DataManager?(o=n,n=n.dataSource.json):o=t.DataManager(n),i.summaryType){case t.Grid.SummaryType.Maximum:r=t.max(n,i.dataMember),a=t.getObject(i.dataMember,r);break;case t.Grid.SummaryType.Minimum:r=t.min(n,i.dataMember),a=t.getObject(i.dataMember,r);break;case t.Grid.SummaryType.Average:a=t.avg(n,i.dataMember);break;case t.Grid.SummaryType.Sum:a=t.sum(n,i.dataMember);break;case t.Grid.SummaryType.Count:a=n.length;break;case t.Grid.SummaryType.TrueCount:l=t.Predicate(i.dataMember,"equal",!0),a=o.executeLocal(t.Query().where(l)).length;break;case t.Grid.SummaryType.FalseCount:l=t.Predicate(i.dataMember,"equal",!1),a=o.executeLocal(t.Query().where(l)).length;break;case t.Grid.SummaryType.Custom:d=i.customSummaryValue,d&&("string"==typeof d&&(d=t.util.getObject(d,window)),e.isFunction(d)&&(a=d.call(this,i,n)))}return a},_hideCaptionSummaryColumn:function(){var e,t,s,a=this.getHeaderTable().find(".e-headercelldiv[ej-mappingname]").first(),n=this.getContentTable().find(".e-groupcaption").clone(),o=this.getContentTable().find(".e-groupcaption").parent(),r=this.model.columns.length-1;if(this._isCaptionSummary&&(this.getContentTable().find(".e-summaryrow:not(.e-gcsummary)").remove(),this.getFooterTable().find("tbody td").slice(-r).removeClass("e-groupcaptionsummary").addClass("e-summaryrow"),null!=this.getFooterTable()&&this.getContentTable().find(".e-recordplusexpand").parent().children(".e-indentcell").remove(),!this.model.groupSettings.showGroupedColumn&&this.getContentTable().find(".e-groupcaptionsummary").not(".e-hide").length&&(e=+this.getContentTable().find(".e-recordtable:first").parents("tbody:first").find(".e-groupcaption").attr("colspan"),this._hiddenColumnsField.length==this.model.columns.length-1&&a.parent().hasClass("e-hide")||!e)))for(i=0;ithis.model.columns.length&&(s=s.slice(s.length-this.model.columns.length)),!this.model.groupSettings.showGroupedColumn&&this.model.showSummary)for(i=0;i0&&(i=this.model.scrollSettings.frozenColumns,this.model.columns=e.merge(e.merge([],s),a),this.model.scrollSettings.frozenColumns=s.length,s.length!=i&&0!=i&&(this.model.scrollSettings.frozenColumns=i)),(this.model.scrollSettings.frozenColumns>0||this.model.scrollSettings.frozenRows>0)&&(this.model.allowGrouping||null!=this.model.rowTemplate||null!=this.model.detailsTemplate||null!=this.model.childGrid||this.model.scrollSettings.allowVirtualScrolling||"batch"==this.model.editSettings.editMode)?(this._renderAlertDialog(),this._alertDialog.find(".e-content").text(this._getLocalizedLabels().FrozenNotSupportedException),void this._alertDialog.ejDialog("open")):(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<5*this._virtualRowCount&&(this.model.pageSettings.pageSize=5*this._virtualRowCount)):(this.model.pageSettings.pageSize=12==this.model.pageSettings.pageSize?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)),void(this._originalScrollWidth=t.isNullOrUndefined(this.model.scrollSettings.previousStateWidth)?this.model.scrollSettings.width:this.model.scrollSettings.previousStateWidth))},_checkScrollActions:function(e){return!(this.model.scrollSettings.allowVirtualScrolling||e!=t.Grid.Actions.Sorting&&e!=t.Grid.Actions.Reorder)||e==t.Grid.Actions.Grouping||e==t.Grid.Actions.Ungrouping||e==t.Grid.Actions.Add||e==t.Grid.Actions.Cancel||e==t.Grid.Actions.Save||e==t.Grid.Actions.BatchSave||e==t.Grid.Actions.Delete||e==t.Grid.Actions.Filtering||e==t.Grid.Actions.Paging||e==t.Grid.Actions.Refresh||e==t.Grid.Actions.Search; },_frozenAlign:function(){var e,t=this.getContent().first(),i=this.getBrowserDetails();e=this.model.enableRTL?"margin-right":"margin-left",t.find(".e-movablecontent").css(e,"safari"===i.browser?"auto":t.find(".e-frozencontentdiv").width()+"px"),this.getHeaderContent().find(".e-movableheader").removeAttr("style").css(e,"safari"===i.browser?"auto":this.getHeaderContent().find(".e-frozenheaderdiv").width()+"px")},_refreshScroller:function(e){var i,s,a,n,o,r=this.getContent().first();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),("cancel"==e.requestType||"save"==e.requestType)&&i>this._editFormHeight&&this.model.editSettings.editMode.indexOf("inlineform")!=-1&&(i-=this._editFormHeight),e.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)),"beginedit"==e.requestType&&(i=this.getScrollObject().model.scrollTop,this.getScrollObject().scrollY(0,!0)),!t.isNullOrUndefined(this.model.dataSource)&&("refresh"==e.requestType||"searching"==e.requestType)&&this.model.scrollSettings.allowVirtualScrolling&&(this.model.scrollSettings.enableVirtualization&&this._isLocalData&&this._gridRecordsCount>0?this._refreshVirtualView(this._currentVirtualIndex):this._refreshVirtualContent(1),1==this._currentVirtualIndex&&this.getScrollObject().scrollY(0)),this.model.scrollSettings.frozenColumns>0&&"filtering"!=e.requestType?this.rowHeightRefresh():this.getScrollObject().refresh(),r.ejScroller("model.enableRTL",this.model.enableRTL),this.model.isResponsive&&("searching"==e.requestType||"filtering"==e.requestType)&&(s=this.getScrollObject(),a=s.isHScroll()?this.getContentTable().height()+s.model.buttonSize:this.getContentTable().height(),a>this.model.scrollSettings.height&&(a=this.model.scrollSettings.height),n="string"==typeof this.model.scrollSettings.width?this.element.width()-s.model.buttonSize:this.model.scrollSettings.width,width=n,this.getContent().ejScroller({height:a,width:width})),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)&&e.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)),"virtualscroll"==e.requestType&&(o=this.getScrollObject().model.scrollTop+this.getScrollObject().model.height-.3*this.getScrollObject().model.height,this.getScrollObject().scrollY(o,!0)))},_renderScroller:function(){var i,s,a,n,o,r,l,d,h;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),"string"!=typeof this._originalScrollWidth||this.model.isResponsive||(this.element.css("width","auto"),i=this.element.width(),("auto"==this.model.scrollSettings.width||"auto"==this._originalScrollWidth)&&(this._originalScrollWidth="100%"),this.model.scrollSettings.width=i*(parseFloat(this._originalScrollWidth)/100)),"string"!=typeof this.model.scrollSettings.height||this.model.isResponsive||(s=this.element.height(),"auto"==this.model.scrollSettings.height&&(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&&this.element.width(this.model.scrollSettings.width||this.model.width),a=this.getContent().attr("tabindex","0"),r=this.getRows(),this.model.scrollSettings.frozenColumns>0){if(scrollWidth=this.getContent().find(".e-frozencontentdiv").width()+20,scrollWidth>this.model.scrollSettings.width)return this.getContent().remove(),this.getHeaderTable().eq(1).remove(),this._alertDialog.find(".e-content").text(this.localizedLabels.FrozenColumnsViewAlert),void this._alertDialog.ejDialog("open");n=this.getContent().find(".e-frozencontentdiv").width(),o=this.model.enableRTL?"margin-right":"margin-left",this.getContent().find(".e-movablecontent").css(o,n+"px"),this.getHeaderContent().find(".e-movableheader").css(o,n+"px"),this.model.scrollSettings.targetPane=".e-movablecontent"}this._initFrozenRows(),this.model.scrollSettings.autoHide&&(this.model.scrollSettings.show=e.proxy(this._showHideScroller,this)),l=this,this.model.scrollSettings.frozenRows||(this.model.scrollSettings.scroll=function(e){t.isNullOrUndefined(e.scrollData)||"e-hhandle"!=e.scrollData.handler?(l._scrollValue=e.scrollTop,l.model.currentIndex=0==e.scrollTop?e.scrollTop:Math.floor(e.scrollTop/l._vRowHeight)):(l.model.allowFiltering&&("menu"==l.model.filterSettings.filterType||l._isExcelFilter)&&(l._isExcelFilter?l._excelFilter.closeXFDialog():l._closeFilterDlg()),l._checkScroller(e,this))}),!this.model.scrollSettings.allowVirtualScrolling&&this.model.currentIndex>0&&!this.model.scrollSettings.scrollTop&&(d=this.model.currentIndex*this.getRowHeight(),this.model.scrollSettings.scrollTop=d),a.ejScroller(this.model.scrollSettings),null!=this.model.rowTemplate&&("msie"==this.getBrowserDetails().browser||"safari"==this.getBrowserDetails().browser)&&this.getScrollObject().refresh(),this.model.scrollSettings.frozenColumns>0&&0==this.model.scrollSettings.frozenRows&&this.getScrollObject()._vScrollbar&&this.getScrollObject()._hScrollbar&&(this.getScrollObject()._vScrollbar._scrollData.skipChange=this.getScrollObject()._hScrollbar._scrollData.skipChange=!0),this.model.scrollSettings.autoHide||this._showHideScroller(),"safari"==this.getBrowserDetails().browser&&this.model.scrollSettings.frozenColumns>0&&this.getHeaderContent().find(".e-movableheader").add(this.getContent().find(".e-movablecontent")).css(o,"auto"),this.refreshScrollerEvent(),l.model.scrollSettings.allowVirtualScrolling&&(h=this._refreshVirtualPagerInfo(),this._showPagerInformation(h),a.ejScroller({scroll:function(i){if(l.model.scrollSettings.enableVirtualization&&null!=i.scrollData&&"e-hhandle"!=i.scrollData.handler){if(i.reachedEnd=i.scrollData.scrollable-i.scrollTop==0,"thumb"==i.source){var s=Object.keys(l._virtualLoadedRows),a=(l._currentVirtualIndex+2).toString();"continuous"==l.model.scrollSettings.virtualScrollMode&&e.inArray(a,s)==-1&&a0?e.scrollLeft:Math.abs(e.scrollLeft);"thumb"==e.source&&(t.content()[0].scrollWidth-s==t.content()[0].clientWidth||0==s)&&(this.model.enableRTL&&(i=0==s?e.scrollData.scrollable:0,e.scrollData.sTop=e.model.scrollLeft=i,t.content().scrollLeft(i)),t.refresh())},_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"),"msie"==this.getBrowserDetails().browser||0!=this.model.scrollSettings.frozenColumns||this._mediaQuery||(this.element.find(".e-gridheader").hasClass("e-scrollcss")||!this.model.filterSettings.filteredColumns.length&&!this._hiddenColumns.length?(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.getHeaderTable().removeAttr("style"),this.getContentTable().removeAttr("style"))),"msie"==this.getBrowserDetails().browser&&0==this.model.scrollSettings.frozenColumns&&(this.getContent().ejScroller("isVScroll")?this.getContent().width(this.getHeaderContent().width()+18):this.getContent().width(this.getHeaderContent().width())),this._isHscrollcss()},_isHscrollcss:function(){var e=this.getContent().data("ejScroller"),t=e&&(e.isHScroll()||e.isVScroll())?"addClass":"removeClass";this.getHeaderContent().find(".e-headercontent")[t]("e-hscrollcss")},_initFrozenRows:function(){var i=this.getRows();this.model.currentViewData&&0!=this.model.currentViewData.length&&(this.model.scrollSettings.frozenRows>0&&null!=i?(this.model.scrollSettings.scroll=e.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?e(i[0][this.model.scrollSettings.frozenRows-1].cells).add(i[1][this.model.scrollSettings.frozenRows-1].cells).addClass("e-frozeny").parent().addClass("e-frozenrow"):e(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)},refreshScrollerEvent:function(){this.getContent().find(".e-content:first,.e-movablecontent").scroll(t.proxy(function(t){if(this.model.scrollSettings.targetPane?this.getHeaderContent().find(".e-movableheader").scrollLeft(e(t.currentTarget).scrollLeft()):this.getHeaderContent().find("div").first().scrollLeft(e(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=e(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(e){if(e)this._clearFilter(e);else{for(var t=this.model.filterSettings.filteredColumns,i=0;i
    {{:~colgroup2}}{{for datas tmpl='"+this._id+"_JSONTemplate'/}}
    ",i={};i[this._id+"_FrozenTemplate"]=t,e.templates(i)},_getTopRow:function(e){var t=this.model.scrollSettings.frozenRows,i=0;if(e>10)for(i=0;ie){t=this.model.scrollSettings.frozenRows+i-1;break}return{imaginaryIndex:t,actualIndex:i}},_showHideRow:function(t,i,s,a){var n=this.getRows();this.model.scrollSettings.frozenColumns>0?e(n[0]).slice(t,i).add(e(n[1]).slice(t,i).toArray())[s]():e(n).slice(t,i)[s](),this._currentTopFrozenRow="show"==s?t:i,this.getScrollObject()._changevHandlerPosition(a)},_scroll:function(e){var i,s,a,n,o;if(null!=e.scrollData&&"width"!=e.scrollData.dimension){e.cancel=!0;var r=(this.getRows(),this._getTopRow(e.scrollTop)),l=r.imaginaryIndex;if(l>this._currentTopFrozenRow?this._showHideRow(this.model.scrollSettings.frozenRows,l,"hide",e.scrollTop):lthis.element.find(".e-content").height()){for(a=i.last().prev()[0].offsetTop+i.last().prev().height(),n=1,o=i.length-2;a-s>this.element.find(".e-content").height();o++){a=i[o].offsetTop+i.eq(o).height(),n++;break}this._showHideRow(this.model.scrollSettings.frozenRows,l+n,"hide",e.scrollTop)}e.model.scrollTop=e.scrollTop}else t.isNullOrUndefined(this.getScrollObject()._vScrollbar)||t.isNullOrUndefined(this.getScrollObject()._vScrollbar._scrollData)||(this.getScrollObject()._vScrollbar._scrollData.skipChange=!0)},_renderAlertDialog:function(){var i=t.buildTag("div.e-content",this._getLocalizedLabels().frozenColumnsMessage),s=t.buildTag("span.e-buttons","");this._alertDialog=t.buildTag("div#"+this._id+"AlertDialog"),this._alertDialog.append(i).append(s),this.element.append(this._alertDialog),s.find("input").ejButton({cssClass:this.model.cssClass,showRoundedCorner:!0,size:"mini",click:e.proxy(function(){this._alertDialog.ejDialog("close")},this)}),this._renderFDialog(this._id+"AlertDialog"),this._alertDialog.ejDialog({width:"auto",enableModal:!0})},_renderFDialog:function(t){e("#"+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,a;if(null!=t){var n=0,o=0==this.model.filterSettings.filteredColumns.length?null==this._searchCount?this._gridRecordsCount:this._searchCount:this._filteredRecordsCount,r=this.model.pageSettings,l=this.getContentTable()[0].tBodies[0],d=e(l).find("tr.e-virtualrow");if(r.totalPages=Math.ceil(o/r.pageSize),t.scrollTop!==s&&(t.model.scrollTop=t.scrollTop),t.reachedEnd!=s&&(t.model.reachedEnd=t.reachedEnd),i=this._calculateCurrenPage(d,this.getContentTable(),t.model),i>r.totalPages&&(i=r.totalPages),r.currentPage!=i&&e.inArray((i-1)*r.pageSize,this.virtualLoadedPages)==-1&&(this._isVirtualRecordsLoaded=!1),this._isVirtualRecordsLoaded)r.currentPage=i;else{if(e.inArray((i-1)*r.pageSize,this.virtualLoadedPages)==-1){if("continuous"==this.model.scrollSettings.virtualScrollMode&&!t.reachedEnd)return;i==r.totalPages&&e.inArray((i-2)*r.pageSize,this.virtualLoadedPages)==-1&&(n++,this.set_currentPageIndex(i)),1==n&&(this._lastRow=!0),this.set_currentPageIndex(i)}r.currentPage=i}a=this._refreshVirtualPagerInfo(),this._showPagerInformation(a)}},_virtualViewScroll:function(t){if(null!=t){t.scrollTop!==s&&(t.model.scrollTop=t.scrollTop),t.reachedEnd!=s&&(t.model.reachedEnd=t.reachedEnd);var i=this._calculateCurrentVirtualIndex(t);e.inArray(i,this._currentLoadedIndexes)==-1&&(this._isVirtualRecordsLoaded=!1),this._isVirtualRecordsLoaded||this.set_currentVirtualIndex(i)}},_createPagerStatusBar:function(){var e,i,s=this.element.find(".e-pagerstatusbar");s.length&&s.remove(),e=t.buildTag("div.e-pagermsgdiv"),this.$pagerStatusBarDiv=t.buildTag("div.e-pagerstatusbar").append(e),this.model.scrollSettings.allowVirtualScrolling&&this.model.allowFiltering&&"filterbar"==this.model.filterSettings.filterType&&(i=t.buildTag("div.e-pagerfiltermsg").css("display","none"),this.$pagerStatusBarDiv.append(i)),this.$pagerStatusBarDiv.appendTo(this.element),this.$pagerStatusBarDiv.css("display","none")},_refreshVirtualContent:function(t){var i,s,a,n,o,r,l,d=this.getRowHeight(),h=0==this.model.filterSettings.filteredColumns.length?null==this._searchCount?this._gridRecordsCount:this._searchCount:this._filteredRecordsCount;null!=t&&(this._currentPage(t),i=this._refreshVirtualPagerInfo(),this._showPagerInformation(i)),s=this.getCurrentIndex(),a=this.getContentTable()[0].tBodies[0],s>0&&(n=document.createElement("tr"),e(n).addClass("e-virtualrow").css("height",d*s).prependTo(a)),s+this.model.pageSettings.pageSize<=h&&1!=this.getContentTable().find("tr").last().hasClass("e-virtualrow")&&0==this.model.scrollSettings.frozenColumns&&(o=document.createElement("tr"),r="normal"==this.model.scrollSettings.virtualScrollMode?d*(h-(s+this.model.pageSettings.pageSize)):1,e(o).addClass("e-virtualrow").css("height",r).appendTo(e(a))),this.virtualLoadedPages=[],this.orderedVirtualLoadedPage=[],this.virtualLoadedPages.push(s>=0?s:0),this.orderedVirtualLoadedPage.push(s>=0?s:0),l=e(a).find("tr:not(.e-virtualrow)").attr("name",s>=0?s:0)[0],l&&l.previousSibling&&(e(l.previousSibling).hasClass("e-virtualrow")||l.previousSibling.offsetTop>s*this.getContent().height())&&(this.getContent().children("div").first().scrollTop(this.getContent().find(".content").scrollTop()-(this.getContent().find(".content").scrollTop()-l.offsetTop)),this._isVirtualRecordsLoaded=!0)},_refreshVirtualView:function(t){var i,s,a,n,o,r,l,d;if(this._singleView)this._singleView=!1,this._addLastRow(),this.getContent().find(".e-virtualtop, .e-virtualbottom").remove(),l=this._currentVirtualIndex.toString(32),e(this._gridRows).attr("name",l),this._virtualLoadedRows[this._currentVirtualIndex]=this._gridRows,this._eventBindings();else{if(i=this._virtualRowCount,t)t>this._totalVirtualViews&&(t=1,s=!0),this._currentVirtualIndex=t,this._virtualLoadedRecords[t]?a=Math.ceil(this.model.currentIndex/this.model.pageSettings.pageSize):(this._virtualDataRefresh||this._currentVirtualIndex==this._totalVirtualViews||(s=!0),a=Math.ceil(t*this._virtualRowCount/this.model.pageSettings.pageSize)),this._refreshVirtualViewScroller(s),a>this.model.pageSettings.totalPages&&(a=this.model.pageSettings.totalPages),a<=0&&(a=1),e.inArray(a,this._virtualLoadedPages)==-1?this.gotoPage(a):(this._currentPage(a),this._needPaging=!this._checkCurrentVirtualView(this._virtualLoadedRecords,t),this._getVirtualLoadedRecords(this.model.query),this._replacingVirtualContent());else{if(this._refreshVirtualViewDetails(),n=e(this.getContentTable()[0].rows),this._setVirtualTopBottom(),this.initialRender){for(d=0;d1&&this._refreshVirtualViewScroller()}this._eventBindings()}e.inArray(this._currentPage(),this._virtualLoadedPages)==-1&&this._virtualLoadedPages.push(this._currentPage())}if(!t&&(this.model.queryCellInfo||this.model.rowDataBound))for(d=0;dthis.model.pageSettings.totalPages&&(this._currentPage(1),this._currentVirtualIndex=1)},setCurrentPageData:function(e){this.model.scrollSettings.allowVirtualScrolling&&this.model.scrollSettings.enableVirtualization&&(this._refreshVirtualViewData(),this._refreshVirtualViewDetails(),this._setVirtualLoadedRecords(e,this._currentPage()),this._refreshVirtualView(this._currentVirtualIndex))},_refreshVirtualViewScroller:function(e){var t,i;this.initialRender&&!this.model.scrollSettings.scrollTop||e?(i=this._vRowHeight,t=this.model.currentIndex*this._vRowHeight):t=this._scrollObject.model.scrollTop,this.getContent().ejScroller("model.scrollTop",t),this._scrollValue=t},_calculateCurrentViewPage:function(e){e||(e=this._scrollObject.model);var t=this.model.pageSettings.pageSize,i=Math.ceil((e.scrollTop+this.model.scrollSettings.height)/this._vRowHeight/t);return null==this.model.pageSettings.totalPages&&(this.model.pageSettings.totalPages=Math.ceil(this._getVirtualTotalRecord()/t)),i>this.model.pageSettings.totalPages&&(i=this.model.pageSettings.totalPages),i},_calculateCurrentVirtualIndex:function(t){var i,s,a,n,o,r,l,d,h,c=t.model,u=(this._getVirtualTotalRecord(),[]),m=c.scrollTop,p=m+this.model.scrollSettings.height;if(i=p/this._vRowHeight/this._virtualRowCount,i=this._prevVirtualIndex>this._currentVirtualIndex&&m<=this._scrollValue?Math.floor(i):Math.ceil(i),m>=this._scrollValue&&"continuous"==c.virtualScrollMode&&c.reachedEnd&&(i+=1),i>this._totalVirtualViews&&(i=this._totalVirtualViews),i<=0&&(i=1),e.inArray(i,this._currentLoadedIndexes)!==-1&&this._virtualLoadedRows[i]&&m!=t.scrollData.scrollable){for(l=this.getContentTable()[0].rows,r=l.length,d=this.getContent().find(".e-virtualtop").height(),a=m>=this._scrollValue,h=0;hm+this.model.scrollSettings.height){0===u.length&&0!==h&&(u=[l[n.offsetTop<=m+this.model.scrollSettings.height?h:h-1]]);break}if(o>=m&&o<=m+this.model.scrollSettings.height&&(u.push(n),a===!1&&u.length>1))break}s=e(m>=this._scrollValue?u[u.length-1]:u[0]),s.length&&(i=parseInt(s.attr("name"),32))}return this._scrollValue=m,i},_calculateCurrenPage:function(t,i,s){var a,n,o,r,l,d,h,c,u,m,p,g,_,f=this.model.pageSettings.pageSize,b=this,v=[],x=this.getRowHeight();if(a=(s.scrollTop+this.model.scrollSettings.height)/x/f,h=this.model.pageSettings.pageSize*(this.model.pageSettings.currentPage-1),c=this.getContentTable().find("tr[name="+h+"]").eq(0),a=c.length&&c.offset().top>0&&a>=1&&s.scrollTop=this._scrollValue&&"continuous"==s.virtualScrollMode&&s.reachedEnd&&(a=this.virtualLoadedPages[this.virtualLoadedPages.length-1]/f+2),e.inArray((a-1)*f,this.virtualLoadedPages)!==-1){for(u=this.getContentTable().children("tbody").children("tr"),d=u.length,o=s.scrollTop>=this._scrollValue,m=0;ms.scrollTop+b.model.scrollSettings.height){0===v.length&&0!==m&&(v=[u[r.offsetTop<=s.scrollTop+b.model.scrollSettings.height?m:m-1]]);break}if(l>=s.scrollTop&&l<=s.scrollTop+b.model.scrollSettings.height&&(v.push(r),o===!1&&v.length>1))break}n=e(s.scrollTop>=this._scrollValue?v[v.length-1]:v[0]),n.hasClass("e-virtualrow")?1===v.length&&a++:a=parseInt(n.attr("name"),10)/f+1}for(this._scrollValue=s.scrollTop,p=0;p=s.scrollTop)return _=this._calculatePrevPage(t,i,s),this._prevPageNo=_,0==a&&(a=1),a>this.model.pageSettings.totalPages?this.model.pageSettings.totalPages:a;return a},_calculatePrevPage:function(t,i,s){for(var a,n,o=0;o=s.scrollTop&&(n=e(a).prevAll("tr[name]")[0],null!=n))return Math.ceil(parseInt(e(n).attr("name"),10)/this.model.pageSettings.pageSize)+1;return-1},_refreshVirtualPagerInfo:function(){var e={};return e.pageSize=this.model.pageSettings.pageSize,e.currentPage=this._currentPage(),e.totalRecordsCount=0==this.model.filterSettings.filteredColumns.length?null==this._searchCount?this._gridRecordsCount:this._searchCount:this._filteredRecordsCount,e.totalPages=Math.ceil(e.totalRecordsCount/e.pageSize),e},_showPagerInformation:function(t){var i=(t.currentPage-1)*t.pageSize;e(this.$pagerStatusBarDiv).find("div:first").html(String.format(this.localizedLabels.PagerInfo,t.currentPage,t.totalPages,t.totalRecordsCount),i,i+t.pageSize),e(this.$pagerStatusBarDiv).css("display","block")},_cellMerging:function(i){i.colMerge=function(e){if(this.cell.className.indexOf("e-colmerge")==-1){this.cell.className+=" e-colmerge",this.model.columns.length-this.cell.cellIndex1&&a>1){if(this.cell.className.indexOf("e-colmerge")==-1){if(this.cell.className+=" e-colmerge",n=this.cell.parentNode.parentNode,n.rows.length-this.cell.parentElement.rowIndex1&&i.colMerge(s),a>1&&i.rowMerge(a)}},_replacingContent:function(){var i,a,n,o,r,l,d,h,c,u,m,p,g,_,f,b,v,x,w,y,C,S,T,D=document.createElement("div"),I=this.getCurrentIndex(),k=this.getContentTable()[0],P=e(k).find("colgroup").first(),L=this.getRowHeight();P.replaceWith(this._getMetaColGroup()),(null!=this.model.detailsTemplate||null!=this.model.childGrid)&&P.prepend(this._getIndentCol()),i=k.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 R=e("").append(e.render[this._id+"_JSONTemplate"](a)),M=this,O=R.children("tr");if(this._allowcolumnSelection&&this.selectedColumnIndexes.length>0)for(v=0;v=0?I:0),o=t.dataUtil.mergeSort(t.distinct(this.virtualLoadedPages)),e(O).attr("name",I),r=t.dataUtil.min(o),l=t.dataUtil.max(o),e(i).children(".e-virtualrow").remove(),b=0;b0&&(m=document.createElement("tr"),e(m).addClass("e-virtualrow").css("height",L*u).insertBefore(e(i).children("[name="+d+"]:first")))),d==l&&(p=M._gridRecordsCount-l-M.model.pageSettings.pageSize,p>0&&(g=document.createElement("tr"),e(g).addClass("e-virtualrow").css("height",L*p).appendTo(i))); r>0&&(_=document.createElement("tr"),e(_).addClass("e-virtualrow").css("height",L*r).prependTo(i));var E=this.getContent(),A=e(i).children("tr[name="+I+"]")[0],j=A.previousSibling,N=E.height(),z=A.offsetTop;if(this._virtaulUnSel)for(f=e.extend(!0,[],this._virtaulUnSel),b=0;bI*N)&&(this._gridRecordsCount-I>=this.model.pageSettings.pageSize||A.offsetParent.offsetHeight-z");if(this._checkCurrentVirtualView(this._virtualLoadedRows,this._currentVirtualIndex)){for(t=[],l=0;l"),l=0;l").append(e.render[this._id+"_JSONTemplate"](this._virtualLoadedRecords[s])),u=i[0].rows,m=u.length-1;e(u[m]).addClass("e-virtualview"+s),n=s.toString(32),o=e(u).attr("name",n),(o.length==this._virtualRowCount||s==this._totalVirtualViews)&&(this._virtualLoadedRows[s]=o,c.append(u))}if(d.replaceChild(c[0],d.lastChild),e(d.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=d.rows,this._checkCurrentVirtualView(this._queryCellView,this._currentVirtualIndex)||this._eventBindings(),this.model.queryCellInfo||this.model.rowDataBound)for(l=0;l0&&this._getVirtualTotalRecord()>2*this._virtualRowCount)if(Math.round(n).toString().length<7)t.buildTag("div.e-virtualbottom","",{height:n}).insertAfter(c);else for(t.buildTag("div.e-virtualbottom").insertAfter(c),l=Math.ceil(n/o),d=0;d1)if(r=(p-1)*this._virtualRowCount*u,Math.round(r).toString().length<7)t.buildTag("div.e-virtualtop","",{height:r}).insertBefore(c);else for(t.buildTag("div.e-virtualtop").insertBefore(c),l=Math.ceil(r/o),d=0;d0&&!t.isNullOrUndefined(this.getRows()[0])?e(this.getRows()[0]).length-1:e(this.getRows()).length-1),this.selectRows(g);break;case"upArrow":if(this.model.isEdit&&b.hasClass("e-ddl"))break;if(t.gridFeatures.selection&&(this._selectedRow()!=-1||this._previousRowCellIndex!=s)&&document.activeElement.id==this._id||"batch"==this.model.editSettings.editMode){if(("text"==a.type||"checkbox"==a.type)&&this.model.isEdit&&"batch"!=this.model.editSettings.editMode)return!0;this._selectedRow()>0&&!this.model.scrollSettings.enableVirtualization&&(this.selectRows(this._selectedRow()-1),"batch"==this.model.editSettings.editMode&&this._moveCurrentCell("up")),this._previousRowCellIndex&&0!=this._previousRowCellIndex.length&&0!=this._previousRowCellIndex[0][0]&&this._allowcellSelection&&(this.selectCells([[this._previousRowCellIndex[0][0]-1,this._previousRowCellIndex[0][1]]]),"batch"==this.model.editSettings.editMode&&this._moveCurrentCell("down"))}break;case"downArrow":if(this.model.isEdit&&b.hasClass("e-ddl"))break;if(t.gridFeatures.selection&&(this._selectedRow()!=-1||this._previousRowCellIndex!=s)&&document.activeElement.id==this._id||"batch"==this.model.editSettings.editMode){if(("text"==a.type||"checkbox"==a.type)&&this.model.isEdit&&"batch"!=this.model.editSettings.editMode)return!0;g=this._excludeDetailRows().length-1,this.model.scrollSettings.frozenColumns>0&&!t.isNullOrUndefined(this.getRows()[0])&&(g=this.getRows()[0].length-1),this._selectedRow()==g||this._selectedRow()==-1||this.model.scrollSettings.enableVirtualization||(this.selectRows(this._selectedRow()+1),"batch"==this.model.editSettings.editMode&&this._moveCurrentCell("down")),this._previousRowCellIndex&&0!=this._previousRowCellIndex.length&&this._previousRowCellIndex[0][0]!=g&&this._allowcellSelection&&(this.selectCells([[this._previousRowCellIndex[0][0]+1,this._previousRowCellIndex[0][1]]]),"batch"==this.model.editSettings.editMode&&this._moveCurrentCell("down"))}break;case"rightArrow":if(t.gridFeatures.selection&&this._allowcellSelection){if(("text"==a.type||"checkbox"==a.type)&&this.model.isEdit&&"batch"!=this.model.editSettings.editMode)return!0;g=e(this.getRows()).length-1,this._previousRowCellIndex&&this._previousRowCellIndex[0][1]==this.model.columns.length-1&&this._previousRowCellIndex[0][0]!=g?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){if(("text"==a.type||"checkbox"==a.type)&&this.model.isEdit&&"batch"!=this.model.editSettings.editMode)return!0;this._previousRowCellIndex&&0==this._previousRowCellIndex[0][1]&&0!=this._previousRowCellIndex[0][0]?this.selectCells([[this._previousRowCellIndex[0][0]-1,[this.model.columns.length-1]]]):this._previousRowCellIndex&&0!=this._previousRowCellIndex[0][1]&&this.selectCells([[this._previousRowCellIndex[0][0],[parseInt(this._previousRowCellIndex[0][1])-1]]])}break;case"firstCellSelection":if(t.gridFeatures.selection&&this._allowcellSelection){if(("text"==a.type||"checkbox"==a.type)&&this.model.isEdit&&"batch"!=this.model.editSettings.editMode)return!0;g=e(this.getRows()).length-1,g>-1&&this.selectCells([[0,[0]]])}break;case"lastCellSelection":if(t.gridFeatures.selection&&this._allowcellSelection){if(("text"==a.type||"checkbox"==a.type)&&this.model.isEdit&&"batch"!=this.model.editSettings.editMode)return!0;g=this.model.scrollSettings.frozenColumns>0&&!t.isNullOrUndefined(this.getRows()[0])?this.getRows()[0].length-1:e(this.getRows()).length-1,g>-1&&this.selectCells([[g,[this.model.columns.length-1]]])}break;case"nextPage":null!=this.getPager()&&(h+=1),"msie"==this.getBrowserDetails().browser&&this.element.focus();break;case"previousPage":null!=this.getPager()&&(h-=1),"msie"==this.getBrowserDetails().browser&&this.element.focus();break;case"lastPage":null!=this.getPager()&&(h=d.totalPages);break;case"firstPage":null!=this.getPager()&&(h=1);break;case"nextPager":null!=this.getPager()&&(h=Math.ceil(d.currentPage/d.pageCount)*d.pageCount+1);break;case"previousPager":null!=this.getPager()&&(h=(Math.floor(d.currentPage/d.pageCount)-1)*d.pageCount+1);break;case"moveCellLeft":"batch"==this.model.editSettings.editMode?(this._tabKey=!0,c=this._moveCurrentCell("left")):c=!0;break;case"moveCellRight":"batch"==this.model.editSettings.editMode&&b?(this._tabKey=!0,c=this._moveCurrentCell("right")):c=!0;break;case"multiSelectionByDownArrow":t.gridFeatures.selection&&(this._selectedRow()!=-1||this._previousRowCellIndex!=s)&&(g=this._excludeDetailRows().length-1,b=this.element.find(".e-gridcontent").find(".e-rowcell"),this.model.scrollSettings.frozenColumns>0&&!t.isNullOrUndefined(this.getRows()[0])&&(g=this.getRows()[0].length-1),this._selectedRow()<=g&&this._selectedRow()!=-1&&(_=this._selectedRow()+1,f=this._previousIndex,this.selectRows(f,_,b),_-1==g&&(this.selectRows(f,g),_=g)),this._selectedRow(_),this._previousIndex=f),"batch"==this.model.editSettings.editMode&&this.element.focus();break;case"multiSelectionByUpArrow":p=0,t.gridFeatures.selection&&(this._selectedRow()!=-1||this._previousRowCellIndex!=s)&&(g=this._excludeDetailRows().length-1,b=this.element.find(".e-gridcontent").find(".e-rowcell"),this._selectedRow()>=0&&this._selectedRow()>=-1&&(_=this._selectedRow()-1,f=this._previousIndex,this.selectRows(f,_,b),_<0&&(this.selectRows(f,p),_=p)),this._selectedRow(_),this._previousIndex=f),"batch"==this.model.editSettings.editMode&&this.element.focus();break;default:c=!0}return null!=this.getPager()&&h<=d.totalPages&&d.currentPage!==h&&"searchRequest"!=i&&"deleteRecord"!==i&&this.getPager().ejPager("goToPage",h),c}},_findColumnsWidth:function(){for(var e=this.getHeaderTable().find(".e-headercell").not(".e-stackedHeaderCell, .e-detailheadercell"),t=0;t0&&!t.isNullOrUndefined(s[0])&&!t.isNullOrUndefined(s[1])&&(s=e(s[0]).add(s[1])),s.removeClass("e-hover")):this.model.scrollSettings.frozenColumns>0&&!t.isNullOrUndefined(s[0])&&!t.isNullOrUndefined(s[1])?(s=e(s[0]).add(s[1]),s.removeClass("e-hover"),a=this.getIndexByRow(n.parent()),a!=-1&&this.getRowByIndex(a).addClass("e-hover")):(s.removeClass("e-hover"),(n.parent().hasClass("e-row")||n.parent().hasClass("e-alt_row"))&&n.parent().addClass("e-hover"))),!1},_showTooltip:function(i){var s,a,n,o,r,l,d=i.index(),h=i.hasClass("e-stackedHeaderCell");if(i.hasClass("e-headercelldiv")&&(d=i.parent(".e-headercell").index()-this.model.groupSettings.groupedColumns.length),!h&&(this.model.childGrid||this.model.detailsTemplate)&&d--,this.model.scrollSettings.frozenColumns>0&&(i.closest(".e-movableheaderdiv").length||i.closest(".e-movablecontentdiv").length)&&(d+=this.model.scrollSettings.frozenColumns),s=h?this._getStackedColumnByTarget(i):this.getColumnByIndex(d),s.clipMode!=t.Grid.ClipMode.Ellipsis){if(s.clipMode==t.Grid.ClipMode.EllipsisWithTooltip&&(a=i,i.find("span").hasClass("e-tooltip")||($span=t.buildTag("span.e-tooltip",{},{}),$span.html(i.html()),a.html($span)),a.find("span.e-tooltip").css("display","inline-block"),n=a.find("span:first")[0].getBoundingClientRect().width,a.find("span.e-tooltip").css("display","inline"),i.width()>n))return void i.removeAttr("title");if(o=document.createElement("script"),t.isNullOrUndefined(s.tooltip))return;o.id=(this._id+s.headerText+e.inArray(s,this.model.columns)+"_TemplateToolTip").split(" ").join(""),o.type="text/x-template","#"!==s.tooltip.slice(0,1)?o.text=s.tooltip:r=e(s.tooltip),r&&(o.text=r.html(),o.type=r.attr("type")||o.type),e("body").append(o),l=e(o).render({value:i.text()}),i.attr("title",l)}else i.removeAttr("title")},_rightClickHandler:function(i){var s,a,n,o;if(i.preventDefault(),s=t.browserInfo(),3==i.which||"msie"==s.name&&"8.0"==s.version){if(a={},$target=e(i.target),$gridRow=e(this.getRows()),this.getContentTable().has($target).length){var o=$gridRow.index($target.parent()),r=this.getRowByIndex(o),l=this._currentJsonData[o];if(this.model.scrollSettings.allowVirtualScrolling&&this.model.scrollSettings.enableVirtualization&&(n=this._getSelectedViewData(o,$target),l=n.data,o=n.rowIndex),o==-1)return;a={rowIndex:o,row:r,data:l,cellIndex:$target.index(),cellValue:$target.html(),cell:$target}}else if(this.getHeaderTable().has($target).length){if(o=0,$th=this.getHeaderTable().find("th").not(".e-detailheadercell,.e-grouptopleftcell,.e-filterbarcell"),o=$target.is(".e-headercelldiv")?$th.index($target.closest(".e-headercell")):$th.index($target),o==-1)return;a={headerIndex:o,headerText:this.getColumnFieldNames()[o],headerCell:$th.eq(o),column:this.getColumnByIndex(o)}}else($target.is(".e-pager")||null!=this.getPager()&&this.getPager().has($target).length)&&(a={pager:this.model.pageSettings});this._trigger("rightClick",a)}},_touchGrid:function(e){var t=this._currentPage();switch(e.type){case"swipeleft":this.model.allowPaging&&t!=this.model.pageSettings.totalPages&&!this.model.isEdit&&this.element.ejGrid("gotoPage",t+1);break;case"swiperight":this.model.allowPaging&&t>1&&!this.model.isEdit&&this.element.ejGrid("gotoPage",t-1)}},_recorddblClickHandler:function(t){var i,s,a={},n=e(t.target).is(".e-rowcell")?e(t.target):e(t.target).closest("td");if(n.closest(".e-grid").attr("id")===this._id&&(n.is(".e-rowcell")||n.closest("td").is(".e-rowcell"))&&!(n.closest(".e-editcell,.e-editedbatchcell").length>0)){var o=this.getIndexByRow(n.closest("tr")),r=this.getRowByIndex(o),l=this._currentJsonData[o];this.model.scrollSettings.allowVirtualScrolling&&this.model.scrollSettings.enableVirtualization&&(i=this._getSelectedViewData(o,n),l=i.data,o=i.rowIndex),s=null!=this.model.detailsTemplate||null!=this.model.childGrid?n.index()-1:n.index(),a={rowIndex:o,row:r,data:l,cell:n,cellIndex:s,columnName:this.getColumnByIndex(s).headerText,cellValue:n.text()},this._trigger("recordDoubleClick",a)}},_recordClick:function(t){var i,s,a={},n=e(t.target).is(".e-rowcell")?e(t.target):e(t.target).closest("td");if(n.closest(".e-grid").attr("id")===this._id&&(n.is(".e-rowcell")||n.closest("td").is(".e-rowcell"))&&!(n.closest(".e-editcell,.e-editedbatchcell").length>0)){var o=this.getIndexByRow(n.closest("tr")),r=this.getRowByIndex(o),l=this._currentJsonData[o];this.model.scrollSettings.allowVirtualScrolling&&this.model.scrollSettings.enableVirtualization&&(i=this._getSelectedViewData(o,n),l=i.data,o=i.rowIndex),s=null!=this.model.detailsTemplate||null!=this.model.childGrid?n.index()-1:n.index(),a={rowIndex:o,row:r,data:l,cell:n,cellIndex:s,columnName:this.getColumnByIndex(s).headerText,cellValue:n.text()},this._trigger("recordClick",a)}},_headerMouseDown:function(t){if(e(t.target).hasClass("e-headercelldiv")&&!e(t.target).parent().hasClass("e-grouptopleftcell")||e(t.target).hasClass("e-headercell")){var i=e(t.target).hasClass("e-headercelldiv")?e(t.target).parent():e(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){if(!e(i.target).closest("td").hasClass("e-selectionbackground")&&e(i.target).closest("tr").length){this._dragDiv=t.buildTag("div.e-griddragarea","",{position:"absolute",width:"0px",height:"0px"}),this.getContent().append(this._dragDiv);var s=e(i.target).closest("tr.e-row");s.length||(s=e(i.target).closest("tr.e-alt_row")),this._startIndex=s.length?this.getIndexByRow(s):null,this._on(this.getContent(),"mousemove",this._mouseMoveDragHandler),this._on(e(document),"mouseup",this._mouseUpDragHandler),this._startDrag={_x:i.pageX,_y:i.pageY}}},_mouseMoveDragHandler:function(i){var s,a,n;if(1==i.which&&i.pageY!=this._startDrag._y){this._selectDrag=!0;var o,r=(this._dragDiv[0].offsetLeft,this._dragDiv[0].offsetTop,this._startDrag._x),l=this._startDrag._y,d=i.pageX,h=i.pageY,c=i.pageY+2;r>d&&(o=d,d=r,r=o),l>h&&(o=h,h=l,l=o,c=i.pageY-2),s=this._dragDiv.height(),this._dragDiv.css({left:r,top:l,width:d-r,height:h-l}),a=e(document.elementFromPoint(i.pageX,c)),n=a.closest("tr.e-row"),n.length||(n=a.closest("tr.e-alt_row")),n.length&&(this._endIndex=this.getIndexByRow(n),t.isNullOrUndefined(this._startIndex)&&(this._startIndex=this._endIndex),this.selectRows(this._startIndex,this._endIndex))}},_mouseUpDragHandler:function(){this._off(e(document),"mouseup",this._mouseUpDragHandler),this._off(this.getContent(),"mousemove",this._mouseMoveDragHandler),this._selectDrag=!1,this._dragDiv.remove()},_headerHover:function(t){var i=e(t.target);"mouseover"==t.type||"mousemove"==t.type||"touchmove"==t.type||"MSPointerMove"==t.type?((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),"mouseover"==t.type&&this._addCursor()):this.model.enableHeaderHover&&this.getHeaderTable().find(".e-columnheader").find(".e-headercell-hover").removeClass("e-headercell-hover").removeClass("e-hover")},_addCursor:function(){var e,i,s,a=this.model.allowResizing||this.model.allowResizeToFit||this.model.allowGrouping||this.model.allowFiltering||this.model.allowSorting||this.model.allowReordering||this.model.contextMenuSettings.enableContextMenu||this._allowcolumnSelection;if(a){if(this.getHeaderTable().find(".e-columnheader").removeClass("e-defaultcursor"),!(this.model.contextMenuSettings.enableContextMenu||"column"==this.model.selectionSettings.selectionMode)){for(e=[{val:this.model.allowSorting,str:"sort"},{val:this.model.allowGrouping,str:"group"},{val:this.model.allowReordering,str:"reorder"},{val:this.model.allowFiltering,str:"filter"}],i=0,s=0;s0;s++){for(j=0;j0?(t=e(this.getHeaderTable()).find("colgroup"),i=e(this.getContentTable()).find("colgroup")):(t=e(this.getHeaderTable()).find("colgroup")[0],i=e(this.getContentTable()).find("colgroup")[0]),s=e(t).clone(),a=e(i).clone(),e(i).remove(),e(t).remove(),(this.model.allowResizing||this.model.allowResizeToFit)&&this.model.scrollSettings.frozenColumns>0?(e(s[0]).prependTo(this.getHeaderTable()[0]),e(s[1]).prependTo(this.getHeaderTable()[1]),e(a[0]).prependTo(this.getContentTable()[0]),e(a[1]).prependTo(this.getContentTable()[1])):(e(s).prependTo(this.getHeaderTable()),e(a).prependTo(this.getContentTable()))},_detailColsRefresh:function(){this._$headerCols=this.getHeaderTable().children("colgroup").find("col"),this._$contentCols=this.getContentTable().children("colgroup").find("col");var e=this.model.columns.length;this._$headerCols.length>e&&this._$headerCols.splice(0,this._$headerCols.length-e),this._$contentCols.length>e&&this._$contentCols.splice(0,this._$contentCols.length-e)},_summaryColRrefresh:function(){for(var e=this.getFooterContent().find(".e-gridsummary"),t=0;t0)},_mouseUp:function(e){this.model.allowResizing&&this._resizer._mouseUp(e)},_mouseMove:function(e){this.model.allowResizing&&this._resizer._mouseMove(e)},_setModel:function(i){var a,n,o,r,l,d,h,c,u,m,p,g,_,f,b,v,x,w,y;for(a in i)switch(a){case"enableResponsiveRow":i[a]?(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&&(e("body").find(".e-filterDialoge").remove(),this._renderFilterDialogs()),"none"==this.element.css("display")&&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)&&(n=this.model.toolbarSettings.toolbarItems.indexOf("responsiveFilter"),n!=-1&&this.model.toolbarSettings.toolbarItems.splice(n,1),o=this.model.toolbarSettings.toolbarItems.indexOf("responsiveSorting"),o!=-1&&this.model.toolbarSettings.toolbarItems.splice(o,1),this.element.find(".e-gridtoolbar").remove(),this._renderToolBar().insertBefore(this.element.find(".e-gridheader").first()));break;case"showColumnChooser":i[a]?(this._visibleColumns=[],this._hiddenColumns=[],this._visibleColumnsField=[],this._hiddenColumnsField=[],this._renderGridHeaderInternalDesign(this.model.columns),this._renderColumnChooser()):(this.element.find(".e-ccButton").remove(),e("#"+this._id+"ccDiv_wrapper").remove());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[a],i[a]?this._renderConfirmDialog():this.element.find("#"+this._id+"ConfirmDialog_wrapper").remove();break;case"showConfirmDialog":this.model.editSettings.showConfirmDialog=i[a],i[a]?this._renderConfirmDialog():this.element.find("#"+this._id+"ConfirmDialog_wrapper").remove();break;case"pageSettings":if(r=this.getPager().ejPager("model"),t.isNullOrUndefined(i[a].currentPage)||r.currentPage!=this._currentPage()){for(l in i[a])"currentPage"!=l&&i[a][l]===r[l]&&delete i[a][l];if(e.isEmptyObject(i[a]))break;i[a].currentPage=this._currentPage(),this.getPager().ejPager("option",i[a]),this._renderPagerTemplate(this.getPager(),i[a].showDefaults),this._currentPage(this._currentPage()>r.totalPages?r.totalPages:this._currentPage()),this.refreshContent()}break;case"columns":d=i.columns,this.model.columns=[],this.columns(d,"add");break;case"allowPaging":this.model.allowPaging=i[a],i[a]&&0==this.element.children(".e-pager").length?(this.element.append(this._renderGridPager()),this.refreshContent(),this.getPager().ejPager("refreshPager")):(this.getPager().remove(),this.setGridPager(null),this.refreshContent(),"filterbar"==this.model.filterSettings.filterType&&this.model.allowFiltering&&this._createPagerStatusBar());break;case"allowSearching":this.model.allowSearching=i[a];break;case"searchSettings":e.extend(this.model.searchSetings,i[a]),this.refreshContent();break;case"allowGrouping":i[a]&&0==this.element.children(".e-groupdroparea").length?(this.model.allowGrouping=i[a],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)||e.extend(this.model.groupSettings,i.groupSettings),this._enableGrouping());break;case"groupSettings":e.extend(this.model.groupSettings,i[a]),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[a]);break;case"allowFiltering":case"filterSettings":if("filterSettings"==a?e.extend(this.model.filterSettings,i[a]):this.model.allowFiltering=i[a],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.model.filterSettings.showFilterBarStatus&&!this.model.allowPaging?this._createPagerStatusBar():this.model.allowPaging&&this.getPager().ejPager({enableExternalMessage:this.model.filterSettings.showFilterBarStatus}),h=this.getHeaderTable().find(".e-filterbar"),f=0;f0&&this._renderGridFooter().insertAfter(_),this._gridRecordsCount&&this.model.allowFiltering&&(this._initColumns(this.model.currentViewData[0]!=s?this.model.currentViewData[0]:this.model.currentViewData.value),this._renderFilterDialogs()),(!this.model.scrollSettings.enableVirtualization||this._gridRows.length0,this.refreshContent(!0))}}else this.element.children(".e-gridfooter").remove();break;case"enableAltRow":this.model.enableAltRow=i[a],this.addInitTemplate(),this.refreshContent();break;case"toolbarSettings":e.extend(this.model.toolbarSettings,i[a]),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[a],this.model.allowSorting||this.clearSorting();break;case"selectionSettings":e.extend(this.model.selectionSettings,i[a]),this._allowrowSelection=this._allowcellSelection=this._allowcolumnSelection=!1,this.model.selectionSettings.selectionMode.length>0&&this.model.allowSelection&&this._initSelection();break;case"sortSettings":e.extend(this.model.sortSettings,i[a]),this.refreshContent();break;case"contextMenuSettings":e.extend(this.model.contextMenuSettings,i[a]),!t.isNullOrUndefined(e("#"+this._id+"_Context").data("ejMenu"))&&e("#"+this._id+"_Context").ejMenu("destroy")&&e("#"+this._id+"_Context").remove(),this.model.contextMenuSettings.enableContextMenu&&this._renderContext();break;case"enableRTL":this.model.enableRTL=i[a],w=this.model,w.query=this.commonQuery.clone(),this.element.ejGrid("destroy"),w.enableRTL?e("#"+this._id).addClass("e-rtl"):e("#"+this._id).removeClass("e-rtl"),e("#"+this._id).ejGrid(w);break;case"enableTouch":this.model.enableTouch=i[a],this.model.enableTouch?(this._on(this.element,"swipeleft swiperight",".e-gridcontent .e-table",e.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[a]?(this._off(this.element,e.isFunction(e.fn.tap)&&this.model.enableTouch?"tap":"click",this._clickHandler),this._on(this.element,"click",this._clickHandler),this._initSelection()):this.clearSelection();break;case"query":this.commonQuery=e.extend(!0,{},i[a]);break;case"showStackedHeader":case"stackedHeaderRows":this.model.showStackedHeader?(t.getObject("stackedHeaderRows.length",i)&&(this.model.stackedHeaderRows=i.stackedHeaderRows),this._refreshStackedHeader()):this.getHeaderTable().find(".e-stackedHeaderRow").remove();break;case"allowTextWrap":this.element.addClass("e-wrap");break;case"textWrapSettings":e.extend(this.model.textWrapSettings,i[a]),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")):(y=this.element.children(".e-gridheader"),y.find("div").first().empty().append(this._renderGridHeader().find("table")),this.model.allowFiltering&&"filterbar"==this.model.filterSettings.filterType&&this._renderFiltering(),this.setGridHeaderContent(y),this.refreshContent(!0),this.model.allowReordering&&this._headerCellreorderDragDrop(),this.model.allowGrouping&&this._headerCellgDragDrop())}},resetModelCollections:function(){this.model.groupSettings.groupedColumns=[],this.model.filterSettings.filteredColumns=[],this.model.sortSettings.sortedColumns=[],this.model.pageSettings.currentPage=this.defaults.pageSettings.currentPage},_enableGrouping:function(){var i,s,a,n,o;if(this.refreshTemplate(),this.model.groupSettings.showToggleButton)for(i=0;i0?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(n={},n.columnName=this.model.groupSettings.groupedColumns[this.model.groupSettings.groupedColumns.length-1],n.requestType=t.Grid.Actions.Grouping,e(".e-grid").find(".e-groupdroparea").empty(),o=0;o").html(t).text()},_htmlEscape:function(e){var t={"&":"&","<":"<",">":">",'"':""","'":"'"};return e.replace(/[&<>"']/g,function(e){return t[e]})},_getForeignKeyData:function(e){var s,a,n=this,o={};for(i=0;i0;)t.createObject(l[--o],i[s].result,this._dropDownManager),e=!0;e&&0==s||(obj=h[n],key=obj.key+"."+obj.value,t.createObject(key,i[s].result,this._dropDownManager),n++)}this._initiateTemplateRendering()},this)):this._initiateTemplateRendering()},_initiateTemplateRendering:function(){"normal"==this.model.editSettings.editMode?this.addEditingTemplate():"batch"==this.model.editSettings.editMode?this.addBatchEditTemplate():"dialog"==this.model.editSettings.editMode||"externalform"==this.model.editSettings.editMode||"inlineform"==this.model.editSettings.editMode?this.addDialogEditingTemplate():this.addExternalDialogEditingTemplate(),this.model.editSettings.showAddNewRow&&"normal"==this.model.editSettings.editMode&&this._startAdd()},addEditingTemplate:function(){var i,a,n,o,r,l,d,h;if(0!=this.model.columns.length){var c=t.buildTag("tbody"),u=t.buildTag("tr"),m=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"}),g=t.buildTag("table.e-table","",{},{cellspacing:.25}),_=t.buildTag("tbody"),f=t.buildTag("tr");for(c.append(u),u.append(m),m.append(p),i=e(document.createElement("colgroup")),p.append(g),g.append(i),_.append(f).appendTo(g),this.model.scrollSettings.frozenColumns>0&&(a=c.clone(),a.find("td").first().prop("colSpan",this.model.columns.length-this.model.scrollSettings.frozenColumns)),n=0;n0&&o.addClass("e-frozenunbound"),this._isUnboundColumn=!0),this.model.columns[n].textAlign!=s&&o.css("text-align",this.model.columns[n].textAlign),0==this.model.columns[n].allowEditing&&o.find(".e-field").attr("disabled",!0).addClass("e-disable"),this.model.columns[n].isPrimaryKey===!0&&o.find(".e-field").attr("disabled",!0).addClass("e-disable"),this.model.columns[n].isIdentity===!0&&(o.find(".e-field").addClass("e-identity"),this._identityKeys.push(e.trim(this.model.columns[n].field)),this._identityKeys=e.unique(this._identityKeys)),h=e(document.createElement("col")),this.model.columns[n].priority&&(o.addClass("e-table-priority-"+this.model.columns[n].priority),h.addClass("e-table-priority-"+this.model.columns[n].priority)),this.model.columns[n].visible===!1&&(h.css("display","none"),o.addClass("e-hide")),t.isNullOrUndefined(this.model.columns[n].cssClass)||o.addClass(this.model.columns[n].cssClass),!this.model.groupSettings.showGroupedColumn&&o.addClass("{{for ~groupedColumns}} {{if #data == '"+this.model.columns[n].field+"'}}e-hide{{/if}}{{/for}}")&&h.css("display","none"),i.append(h),n==this.model.scrollSettings.frozenColumns-1&&(f=a.find("tr").last(),i=a.find("colgroup"),e.templates(this._id+"_JSONFrozenEditingTemplate",c.html()),c=a);e.templates(this._id+"_JSONEditingTemplate",c.html())}},addDialogEditingTemplate:function(){var i,a,n,o;if(0!=this.model.columns.length){var r,l,d,h,c,u=t.buildTag("div"),m=t.buildTag("form.gridform","",{},{id:this._id+"EditForm"}),p=t.buildTag("table","",{},{cellspacing:"14px"});for(i=0;i"+this.model.columns[i].headerText+""),t.isNullOrUndefined(this.model.columns[i].commands)&&t.isNullOrUndefined(this.model.columns[i].template)?this._initCellEditType(i,d):this.model.columns[i].template?(o={},a=this.model.columns[i].headerText,o["_"+this._id+"ColumnTemplating"]=t.proxy(this._gridTemplate,null,this),e.views.helpers(o),t.isNullOrUndefined(a)||t.isNullOrUndefined(a.match(/[^0-9\s\w]/g))||(a=a.replace(/[^0-9\s\w]/g,"_")),e("#"+this._id+a+i+"_Template").remove(),n=this._createTemplateElement(this.model.columns[i]),d.addClass("e-templatecell").html("{{:~_"+this._id+"ColumnTemplating('"+n.id+"')}}")):this.model.columns[i].commands&&(o={},o["_"+this._id+"UnboundTemplate"]=this._unboundTemplateRendering,e.views.helpers(o),e("#"+this._id+this.model.columns[i].headerText.replace(/[^a-z0-9|s_]/gi,"")+"_UnboundTemplate").remove(),divElement=this._createUnboundElement(this.model.columns[i]),d.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&&d.addClass("e-frozenunbound"),this._isUnboundColumn=!0,r.addClass("e-hide")),0==this.model.columns[i].allowEditing&&d.find(".e-field").attr("disabled",!0).addClass("e-disable"),this.model.columns[i].isIdentity===!0&&(d.find(".e-field").addClass("e-identity"),this._identityKeys.push(e.trim(this.model.columns[i].field)),this._identityKeys=e.unique(this._identityKeys)),this.model.columns[i].visible===!1&&r.addClass("e-hide"),t.isNullOrUndefined(this.model.columns[i].cssClass)||d.addClass(this.model.columns[i].cssClass),"dialog"==this.model.editSettings.editMode?(m.append(p),p.append(r)):m.append(r),m.appendTo(u),this.model.columns[i].isPrimaryKey===!0&&(d.find(".e-field").attr("disabled",!0).addClass("e-disable"),this._primaryKeys.push(e.trim(this.model.columns[i].field)),this._primaryKeys=e.unique(this._primaryKeys));"dialog"==this.model.editSettings.editMode&&m.append(p),u=this.renderDiaglogButton(m,u),e.templates(this._id+"_JSONDialogEditingTemplate",u.html())}},_editEventTrigger:function(e){if("save"==e.requestType||"delete"==e.requestType){var i={data:e.data,action:e.action!==s?e.action:e.requestType};t.isNullOrUndefined(e.foreignKeyData)||(i.foreignKeyData=e.foreignKeyData),this._trigger("end"+i.action.charAt(0).toUpperCase()+i.action.slice(1),i)}},_compiledDropDownTemplate:function(i,s,a,n){var o,r,l={_gridFormatting:this.formatting};return e.views.helpers(l),o=t.buildTag("select"),r=t.buildTag("option",null!=n?"{{:~_gridFormatting('"+n+"',"+s+",'"+this.model.locale+"')}}":"{{:"+s+"}}",{},{value:"{{:"+i+"}}"}),o.append(r),e.templates(o.html())},_initCellEditType:function(i,a){var n,o,r,l,d,h,c,u,m,p,g,_,f,b,v,x,w=this.model.columns[i].field;this.model.columns[i].foreignKeyValue&&(this.model.columns[i].editType="dropdownedit"),this._dataSource()instanceof t.DataManager&&this._dataSource().adaptor instanceof t.ForeignKeyAdaptor&&(b=e.inArray(this.model.columns[i].field,this._dataSource().adaptor.value),b!=-1&&(this.model.columns[i].editType="dropdownedit",n=this._dataSource().adaptor.value[b],o=this._dataSource().adaptor.key[b])),this.model.columns[i].editTemplate&&(this.model.columns[i].editType="edittemplate"),t.isNullOrUndefined(this.model.columns[i].editType)&&(this.model.columns[i].editType="date"==this.model.columns[i].type||"datetime"==this.model.columns[i].type?this.model.columns[i].type+"picker":"stringedit"),this.model.isResponsive&&a.attr("data-cell",this._decode(this.model.columns[i].headerText));var y=(w||"").split("."),C=y.length-1,S="";for(t.isNullOrUndefined(w)||(w=w.replace(/[^a-z0-9\s_]/gi,""));C;)S+="(",C--;switch(this.model.columns[i].editType){case"edittemplate":r=this.model.columns[i].editTemplate.create,"string"==typeof r?(l=t.util.getObject(r,window),d=e.isFunction(l)?e(l()).attr({id:this._id+w,name:this.model.columns[i].field}):1==e(r).length&&"SCRIPT"==e(r).get(0).tagName?e(e(r).html()).attr({id:this._id+w,name:this.model.columns[i].field}):e(r).attr({id:this._id+w,name:this.model.columns[i].field})):d=e(r()).attr({id:this._id+w,name:this.model.columns[i].field}),a.append(d);break;case"stringedit":a.html(t.buildTag("input.e-field e-ejinputtext","",{},{value:"{{html:"+S+"#data['"+y.join("'] || {})['")+"']}}",id:this._id+w,name:this.model.columns[i].field}));break;case"booleanedit":a.html('{{if #data["'+y.join('"]["')+'"]}} {{else}} ":[""].join(""), a.find("select,input").prop({id:this._id+w,name:u.field}).addClass("e-field e-dropdownlist")}},addBatchEditTemplate:function(){if(0!=this.model.columns.length){for(var i,s=t.buildTag("div","",{display:"none"},{id:this._id+"_BulkEditTemplate"}),a=0,n=this.model.columns.length;a0||this.model.scrollSettings.frozenRows>0?this.getRowByIndex(i.closest("tr").index()):i.closest("tr"),this.startEdit(this._$currentTr)),!1},_columnToSelect:function(){for(var e=[],i=0;i").replace(/"/g,'"').replace(/'/g,"'"):str),str},startEdit:function(i){var s,a,n,o,r;if(this.model.editSettings.allowEditing&&(!this.model.editSettings.showAddNewRow||"normal"!=this.model.editSettings.editMode||!this._excludeDetailRows().hasClass("e-editedrow"))&&!this.element.ejWaitingPopup("model.showOnInit")){if(this._selectedRow()==-1&&t.isNullOrUndefined(i))return void alert(this.localizedLabels.EditOperationAlert);if(t.isNullOrUndefined(i)?(this._currentTrIndex=this._selectedRow(),this._$currentTr=this.getRowByIndex(this._currentTrIndex)):(this._currentTrIndex=this.getIndexByRow(i),this._$currentTr=i),!e(this._$currentTr).is(":visible"))return!1;for(this._primaryKeyValues=[],s=0;s1&&(h=this.getContentTable().find(".e-addedrow").find("table").find("colgroup").children(),e(h.slice(0,d-1)).css("width",this.getHeaderTable().find("colgroup").children()[0].style.width))}},endEdit:function(){var i,a,n,o,r,l,d,h,c,u,m,p,g,_,f,b;if(this.model.isEdit){if(o=0,!this.editFormValidate())return!0;if(r={},"batch"==this.model.editSettings.editMode)this.saveCell();else{for(this.model.editSettings.showAddNewRow&&(n=this.getContentTable().find(".e-editedrow")),i=this.model.scrollSettings.frozenColumns>0?this.element.find(".gridform"):t.isNullOrUndefined(n)||1!=n.length?document.getElementById(this._id+"EditForm"):n[0].lastChild.lastChild,a=e(i),l="normal"==this.model.editSettings.editMode||"inlineform"==this.model.editSettings.editMode||"inlineformtemplate"==this.model.editSettings.editMode?a.closest("tr"):a.closest("div"),l.find("td.e-rowcell").removeClass("e-validError"),i=this.model.scrollSettings.frozenColumns>0?i[0]:i,h=0;h0?new Date(x):x)):(t.isNullOrUndefined(i[h+1])||"hidden"!=i[h].type||h++,"hidden"!=i[h].type&&(m=v.editTemplate.read,u=e(i[h]),"string"==typeof m&&(m=t.util.getObject(m,window)),x=t.isNullOrUndefined(v.foreignKeyField)?m(u):u.ejDropDownList("getSelectedValue"))),d&&(x="number"==d?+x:"boolean"==d?x===this.localizedLabels.True:"date"===d?new Date(x):x),null==v?x=!isNaN(parseFloat(x))&&isFinite(x)?parseFloat(x):x:"number"==v.type&&!t.isNullOrUndefined(x)&&x.length&&(x=t.parseFloat(x,this.model.locale)),"string"!=typeof x||x.length||(x=null),("checkbox"!=w&&!t.isNullOrUndefined(x)&&""!==x||y)&&o++,p="checkbox"!=w?x:y,c.indexOf(".")!=-1?t.createObject(c,p,r):r[c]=p}h==i.length-1&&a.length>1&&0==a.index(i)&&(i=a[1],h=-1)}if(g={data:r},_=this._getForeignKeyData(g.data),t.isNullOrUndefined(_)||(g.foreignKeyData=_),g.requestType=t.Grid.Actions.Save,g.selectedRow=this._selectedRow(),this._trigger("actionBegin",g))return!0;if(l.hasClass("e-editedrow")?(this._cModifiedData=r,g.action="edit"):l.hasClass("e-addedrow")&&(o&&(this._cAddedRecord=r),g.action="add"),"add"==g.action&&this.editFormValidate()&&!o)return elements=this.model.scrollSettings.frozenColumns>0?this.element.find(".gridform"):e("#"+this._id+"EditForm"),f=t.buildTag("div"),b=elements.find("input:visible").not(".e-identity").first(),this._renderValidator(f,b),$errorMessage=t.buildTag("div.e-field-validation-error",this.localizedLabels.EmptyRowValidationMessage),$tail=e(f).find(".e-errortail"),$errorMessage.insertAfter($tail),$errorMessage.css("display","block"),!1;this._updateAction(g)}}},_updateAction:function(i){var a,n;this._dataSource()instanceof t.DataManager&&!this._dataManager.dataSource.offline&&this._dataManager.dataSource.json!==s||this._dataSource().adaptor instanceof t.remoteSaveAdaptor||this._dataSource().adaptor instanceof t.ForeignKeyAdaptor?(a=t.isNullOrUndefined(this._cModifiedData)?this._dataManager.insert(i.data):this._dataManager.update(this._primaryKeys[0],i.data),n=this,this.element.ejWaitingPopup("show"),e.isFunction(a.promise)?(a.done(function(s){n.model.isEdit=!1,!t.isNullOrUndefined(s)&&e.isPlainObject(s.record)&&(e.extend(i.data,s.record),"add"==i.action&&(n._cAddedRecord=i.data),"edit"==i.action&&(n._cModifiedData=i.data)),n._processBindings(i),n._isRemoteSaveAdaptor&&(n.element.ejWaitingPopup("hide"),t.isNullOrUndefined(n._unboundRow)||i.selectedRow==n._unboundRow||"save"!=i.requestType||(n._unboundRow.find(".e-editbutton").trigger("click"),n._unboundRow=null)),n._cModifiedData=null,n._cAddedRecord=null,n._primaryKeyValues=[]}),a.fail(function(e){i.error=e&&e.error?e.error:e,n._trigger("actionFailure",i)})):(n.model.isEdit=!1,n._processBindings(i))):this._processBindings(i),a!=s&&e.isFunction(a.promise)||(this._cModifiedData=null,this._cAddedRecord=null,this._primaryKeyValues=[])},cancelEdit:function(){var e={};e.requestType=t.Grid.Actions.Cancel,this._cModifiedData=null,this._processBindings(e),this._primaryKeyValues=[],this._currentData=null},refreshToolbar:function(){var t,i,s=e("#"+this._id+"_toolbarItems"),a=s.find("li");if(s.ejToolbar("enableItem",a),t=this.getContentTable().find(".e-editedrow"),this.model.editSettings.showAddNewRow&&"normal"==this.model.editSettings.editMode&&0==t.length)this._disabledToolItems.push(a.filter("[id="+this._id+"_add]"));else for(i=0;i",e.render[this._id+"_JSONEditingTemplate"](this._currentData,{groupedColumns:this.model.groupSettings.groupedColumns}),""].join("");var f=_.find("tr").first(),r=0,b=this.model.columns.length,v=i.row.first();this.model.scrollSettings.frozenColumns>0&&(_.prepend(["",e.render[this._id+"_JSONFrozenEditingTemplate"](this._currentData,{groupedColumns:this.model.groupSettings.groupedColumns}),"
    "].join("")),f.splice(0,0,_.find("table").first().find("tr").first().get(0)),$currentTrLa=i.row.last(),$tempLastTR=f.last()),s=_.find("tr").first(),_.find("td").not(".e-rowcell").addClass("e-editcell e-normaledit"),this._setEditDropdownValue(_),this.model.groupSettings.groupedColumns.length>=2&&(n=i.row.find("td.e-indentcell"),_.find("tr").first().prepend(n)),(null!=this.model.detailsTemplate||null!=this.model.childGrid)&&(r++,_.find(".e-editcell").find("tr").prepend(i.row.find("[class^=e-detailrow]").removeClass("e-selectionbackground e-active")),"both"!=this.model.gridLines&&_.find(".e-editcell .e-rowcell:first").addClass("e-detailrowvisible")),this.model.scrollSettings.frozenColumns>0&&(_.find(".e-editcell").get(1).colSpan=this.model.columns.length-this.model.scrollSettings.frozenColumns-i.row.last().find(".e-hide").length+r,b=this.model.scrollSettings.frozenColumns,$currentTrLa.hasClass("e-alt_row")&&$tempLastTR.addClass("e-alt_row")),_.find(".e-editcell").get(0).colSpan=b-v.find("td").not(":visible").length+r,v.hasClass("e-alt_row")&&s.addClass("e-alt_row"),v.empty().replaceWith(s.addClass("e-editedrow")),s.is(":last-child")||s.find("td.e-rowcell").addClass("e-validError"),this.model.scrollSettings.frozenColumns>0&&$currentTrLa.empty().replaceWith($tempLastTR.addClass("e-editedrow")),this._refreshUnboundTemplate(f.find(".gridform")),this._gridRows=0==this.model.scrollSettings.frozenColumns?this.getContentTable().first().find(".e-rowcell").closest("tr.e-row, tr.e-alt_row, tr.e-editedrow").toArray():e(this.getContentTable().get(0).rows).toArray(),this.model.scrollSettings.frozenColumns>0&&(this.getScrollObject().scrollY(this.getScrollObject().model.scrollTop,!0),this._gridRows=[this._gridRows,e(this.getContentTable().get(1).rows).toArray()])}else"inlineform"==this.model.editSettings.editMode||"inlineformtemplate"==this.model.editSettings.editMode?(o=this.model.groupSettings.showGroupedColumn?0:this.model.groupSettings.groupedColumns.length,r=0,p.innerHTML="inlineform"==this.model.editSettings.editMode?e.render[this._id+"_JSONDialogEditingTemplate"](this._currentData):e.render[this._id+"_JSONdialogTemplateMode"](this._currentData),this._setEditDropdownValue(_),l=t.buildTag("tr"),d=t.buildTag("td"),l.addClass("e-editedrow"),d.addClass("e-inlineformedit"),p=e(p).clone(!0).children(),d.html(p),l.append(d),l.is(":last-child")||l.find(".e-rowcell").addClass("e-validError"),this.model.scrollSettings.frozenColumns>0?(h=l.clone(),h.find("td").empty().prop("colspan",this.model.scrollSettings.frozenColumns),i.row.eq(1).after(l).end().eq(0).after(h),this._gridRows=[this._gridRows,this.getContentTable().last().find("tr").toArray()]):i.row.after(l),this._gridRows=this.getContentTable().first().find(".e-rowcell,.e-inlineformedit").closest("tr").toArray(),(null!=this.model.detailsTemplate||null!=this.model.childGrid)&&r++,this.model.scrollSettings.frozenColumns>0?d.prop("colspan",this.model.columns.length-this.model.scrollSettings.frozenColumns-l.find("form").children().not(":visible").length-o+r):d.prop("colspan",this.model.columns.length-this._hiddenColumns.length-o+r),this.model.scrollSettings.frozenColumns>0&&(this._gridRows=[this._gridRows,this.getContentTable().last().find("tr").toArray()]),e("#"+this._id+"_inlineFormTitle").text(this.localizedLabels.EditFormTitle+this._currentData[0][g]),i.row.find("input").attr("disabled","disabled").addClass("e-disable")):(_.addClass("e-editedrow"),p.innerHTML="dialog"==this.model.editSettings.editMode||"externalform"==this.model.editSettings.editMode?e.render[this._id+"_JSONDialogEditingTemplate"](this._currentData):e.render[this._id+"_JSONdialogTemplateMode"](this._currentData),this._setEditDropdownValue(_),"dialog"==this.model.editSettings.editMode||"dialogtemplate"==this.model.editSettings.editMode?(e("#"+this._id+"_dialogEdit").html(e(p)),c={},c.cssClass=this.model.cssClass,c.enableRTL=this.model.enableRTL,c.width="auto",c.enableResize=this.phoneMode,c.close=e.proxy(this._buttonClick,this),c.content="#"+this._id,c.enableModal=!0,c.allowKeyboardNavigation=!1,c.title=this.localizedLabels.EditFormTitle+this._currentData[0][g],e("#"+this._id+"_dialogEdit").ejDialog(c),e("#"+this._id+"_dialogEdit").ejDialog("open")):(e("#"+this._id+"_externalEdit").css("display","block").css("z-index",this._maxZindex()+1),e("#"+this._id+"_externalForm").find(".e-externalformedit").html(e(p)),e("#"+this._id+"_eFormHeader").find(".e-form-title").text(this.localizedLabels.EditFormTitle+this._currentData[0][g]),this._externalFormPosition(),i.row.find("input").attr("disabled","disabled").addClass("e-disable")));"normal"!=this.model.editSettings.editMode&&(s=e(p)),t.isNullOrUndefined(this.model.templateRefresh)||0==s.find(".e-templatecell").length||this._refreshTemplateCell(s,this.model.currentViewData[s.index()])},_setEditDropdownValue:function(i){for(var s,a,n,o,r=i.find("select.e-field"),l=i.find("input.e-field.e-dropdownlist"),d=0;d",e.render[this._id+"_JSONEditingTemplate"](i.data,{groupedColumns:this.model.groupSettings.groupedColumns}),""].join(""),u=e(g).find("select.e-field"),m=0;m0&&($tempLastTR=n.find("table").first().find("tr").first(),n.prepend(["",e.render[this._id+"_JSONFrozenEditingTemplate"](i.data,{groupedColumns:this.model.groupSettings.groupedColumns}),"
    "].join("")),e($tempLastTR).find("td").first().addClass("e-editcell")),a=n.find("tr").first(),r=e(g).find(".e-editcell").get(0),e(g).find("td").first().addClass("e-editcell"),this.model.allowPaging&&this.model.pageSettings.pageSize<=this._currentJsonData.length&&0==this.model.groupSettings.groupedColumns.length&&!this.model.editSettings.showAddNewRow&&this.getContentTable().get(0).lastChild.removeChild(this.getContentTable().get(0).lastChild.lastChild),(null!=this.model.detailsTemplate||null!=this.model.childGrid)&&e(this.getContentTable().get(0).lastChild.lastChild).children(".e-detailrowexpand").length&&this.getContentTable().get(0).lastChild.removeChild(this.getContentTable().get(0).lastChild.lastChild),0==this.model.currentViewData.length||0==this.getContentTable().find("td.e-rowcell").length?(this.getContentTable().find("tr").first().replaceWith(e(g).find("tr").first().addClass("e-addedrow e-normaledit")),0==this.getContentTable().find("tr").length&&this.getContentTable().append(e(g).find("tr").first().addClass("e-addedrow e-normaledit"))):(l=this.getContentTable().first().find("tbody").first(),"top"==this.model.editSettings.rowPosition?l.prepend(a.addClass("e-addedrow e-normaledit")):"bottom"==this.model.editSettings.rowPosition&&l.append(a.addClass("e-addedrow e-normaledit")),this.model.scrollSettings.frozenColumns>0&&this.getContentTable().last().find("tbody").first().prepend($tempLastTR.addClass("e-addedrow e-normaledit"))),s=this.getContentTable().find("tr.e-addedrow"),(null!=this.model.detailsTemplate||null!=this.model.childGrid)&&s.find("tr").first().prepend(t.buildTag("td.e-detailrowcollapse")),d=this.model.groupSettings.showGroupedColumn?0:this.model.groupSettings.groupedColumns.length,this.model.groupSettings.groupedColumns.length){for(m=0;m=2?s.find("td.e-editcell").prop("colspan",this.model.columns.length+(this.model.groupSettings.groupedColumns.length-1)-this._hiddenColumns.length-d):s.find("td.e-editcell").prop("colspan",this.model.columns.length-this._hiddenColumns.length-d)}else null!=this.model.detailsTemplate||null!=this.model.childGrid?s.find(".e-editcell").prop("colspan",this.model.columns.length-this._hiddenColumns.length-d+1):(this.model.scrollSettings.frozenColumns>0&&(s.find(".e-editcell").last().prop("colspan",this.model.columns.length-this.model.scrollSettings.frozenColumns-$tempLastTR.find("td").not(":visible").length-d),o=this.model.scrollSettings.frozenColumns),s.find(".e-editcell").first().prop("colspan",o-a.find("td").not(":visible").length-d));s.is(":last-child")||s.find("td.e-rowcell").addClass("e-validError"),"msie"==this.getBrowserDetails().browser&&"bottom"==this.model.editSettings.rowPosition&&this._colgroupRefresh(),this._refreshUnboundTemplate(s.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("inlineform"==this.model.editSettings.editMode||"inlineformtemplate"==this.model.editSettings.editMode){for(g.innerHTML="inlineform"==this.model.editSettings.editMode?e.render[this._id+"_JSONDialogEditingTemplate"](i.data):e.render[this._id+"_JSONdialogTemplateMode"](i.data),u=e(g).find("select.e-field"),m=0;m0?(h=f.clone(),c=r.find(".gridform").children(),h.find("td").empty().prop("colSpan",this.model.scrollSettings.frozenColumns-this._getHiddenCount(c.slice(0,this.model.scrollSettings.frozenColumns))),r.prop("colSpan",this.model.columns.length-this.model.scrollSettings.frozenColumns-this._getHiddenCount(c.slice(this.model.scrollSettings.frozenColumns))),this.getContentTable().first().find("tbody").first().prepend(h),this.getContentTable().last().find("tbody").first().prepend(f)):((null!=this.model.detailsTemplate||null!=this.model.childGrid)&&_++,r.prop("colspan",this.model.columns.length-this._hiddenColumns.length-d+_),0==this.model.currentViewData.length||0==this.getContentTable().find("td.e-rowcell").length?this.getContentTable().find("tr").first().replaceWith(e(f)):this.model.allowPaging&&this.model.pageSettings.pageSize<=this.model.currentViewData.length&&0==this.model.groupSettings.groupedColumns.length&&this.getContentTable().get(0).lastChild.removeChild(this.getContentTable().get(0).lastChild.lastChild),"top"==this.model.editSettings.rowPosition?this.getContentTable().first().find("tbody").first().prepend(f):"bottom"==this.model.editSettings.rowPosition&&this.getContentTable().first().find("tbody").first().append(f)),(null!=this.model.detailsTemplate||null!=this.model.childGrid)&&e(this.getContentTable().get(0).lastChild.lastChild).children(".e-detailrowexpand").length&&this.getContentTable().get(0).lastChild.removeChild(this.getContentTable().get(0).lastChild.lastChild),e("#"+this._id+"_inlineFormTitle").text(this.localizedLabels.AddFormTitle),this._refreshUnboundTemplate(e("#"+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(e(g).addClass("e-addedrow"),g.innerHTML="dialog"==this.model.editSettings.editMode||"externalform"==this.model.editSettings.editMode?e.render[this._id+"_JSONDialogEditingTemplate"](i.data):e.render[this._id+"_JSONdialogTemplateMode"](i.data), u=e(g).find("select.e-field"),m=0;m0?(t=this.element.find(".gridform"),t.length>1?(i=t.eq(0).validate().form(),s=t.eq(1).validate().form(),!(!i||!s)):t.validate().form()):e("#"+this._id+"EditForm").validate().form())},_refreshAltRow:function(){for(var t,i=this._excludeDetailRows(),s=0;s0)&&this._setoffsetWidth(),this._refreshEditForm(i),this.model.scrollSettings.frozenColumns>0&&("inlineform"==this.model.editSettings.editMode||"inlineformtemplate"==this.model.editSettings.editMode)&&("beginedit"==i.requestType?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&&"beginedit"==i.requestType&&this._initFrozenRows(),this.model.scrollSettings.frozenColumns>0&&this.rowHeightRefresh(),e.isFunction(e.validator)&&this.initValidator()},_refreshEditForm:function(i){var a,n,o,r,l,d,h,c,u,m,p,g,_,f,b,v,x,w;for(this.model.editSettings.showAddNewRow&&(a=this.getContentTable().find(".e-editedrow")),n=this.model.scrollSettings.frozenColumns>0?this.element.find(".gridform"):t.isNullOrUndefined(a)||1!=a.length?document.getElementById(this._id+"EditForm"):a[0].lastChild.lastChild,o=!1,this.model.enableResponsiveRow&&e.isFunction(window.matchMedia)&&(l=window.matchMedia("(max-width: 320px)")),d=e(n).find("input,select,div.e-field"),h=86,(this._isUnboundColumn||null!=this.getContentTable().find(".e-templatecell"))&&(d=d.filter(function(){return!e(this).closest(".e-rowcell").hasClass("e-unboundcell")&&!e(this).closest(".e-rowcell").hasClass("e-templatecell")})),c=0;c0&&(_=new RegExp("\\{0(:([^\\}]+))?\\}","gm"),f=_.exec(b.format),v.dateFormat=f[2]),t.isNullOrUndefined(b.editParams)||e.extend(v,b.editParams),u.ejDatePicker(v),"batch"==this.model.editSettings.editMode&&u.ejDatePicker("show");else if(u.hasClass("e-datetimepicker"))b=this.getColumnByField(u.prop("name")),v={width:m,enableRTL:this.model.enableRTL,cssClass:this.model.cssClass,showPopupButton:!1,locale:this.model.locale},(!t.isNullOrUndefined(l)&&l.matches||b.width&&"string"==typeof b.width&&b.width.indexOf("%")!=-1&&("normal"==this.model.editSettings.editMode||"batch"==this.model.editSettings.editMode))&&(v.width="100%"),u.val().length&&(v.value=new Date(u.val())),u.hasClass("e-disable")&&(v.enabled=!1),b.format!==s&&b.format.length>0&&(_=new RegExp("\\{0(:([^\\}]+))?\\}","gm"),f=_.exec(b.format),v.dateTimeFormat=f[2]),t.isNullOrUndefined(b.editParams)||e.extend(v,b.editParams),u.ejDateTimePicker(v),"batch"==this.model.editSettings.editMode&&u.ejDateTimePicker("show");else if(u.hasClass("e-dropdownlist"))b=this.getColumnByField(u.prop("name")),v={width:m,enableRTL:this.model.enableRTL,enableIncrementalSearch:!0},(!t.isNullOrUndefined(l)&&l.matches||b.width&&"string"==typeof b.width&&b.width.indexOf("%")!=-1&&("normal"==this.model.editSettings.editMode||"batch"==this.model.editSettings.editMode))&&(v.width="100%"),t.isNullOrUndefined(b.editParams)||e.extend(v,b.editParams),!t.isNullOrUndefined(b.dataSource)&&!t.isNullOrUndefined(b.editParams)&&this._dataSource().adaptor instanceof t.ForeignKeyAdaptor&&(v.dataSource=b.dataSource),u.ejDropDownList(v),this._dataSource()instanceof t.DataManager&&this._dataSource().adaptor instanceof t.ForeignKeyAdaptor&&!t.isNullOrUndefined(b.editParams)?u.ejDropDownList("setSelectedValue","add"==i.requestType&&t.isNullOrUndefined(b.defaultValue)?u.val(""):u.attr("value")):u.ejDropDownList("setSelectedValue","add"==i.requestType&&t.isNullOrUndefined(b.defaultValue)?u.val(""):u.val()),u.hasClass("e-disable")&&u.ejDropDownList("disable");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(b)&&b.format&&""!=u.val())switch(b.type){case"date":var x=u.val(),C=new Date(x),w=b.format.replace("{0:","").replace("}",""),S=t.format(C,w);u.val(S);break;case"number":x=u.val(),w=new RegExp("\\{0(:([^\\}]+))?\\}","gm").exec(b.format),"c"==w[2].toLowerCase().split("")[0]?w[2]=w[2].toLowerCase().replace("c","n"):w[2],u.val(t.format(parseFloat(x),w[2]))}"checkbox"!=u.attr("type")?(u.css("text-align",null!=u.attr("name")&&null!=this.getColumnByField(u.attr("name"))?this.getColumnByField(u.attr("name")).textAlign:"center"),"batch"==this.model.editSettings.editMode?(u.css("width","100%").css("height","28px"),"msie"==t.browserInfo().name&&8==parseInt(t.browserInfo().version,10)&&u.css("line-height","22px")):"normal"==this.model.editSettings.editMode?(u.css("width","100%").css("height","30px"),"msie"==t.browserInfo().name&&8==parseInt(t.browserInfo().version,10)&&u.css("line-height","24px")):(u.outerWidth(m).height(28),"msie"==t.browserInfo().name&&8==parseInt(t.browserInfo().version,10)&&u.css("line-height","26px"))):u.width(m>0?u.width()>m?m:u.width():this.model.editSettings.editMode.indexOf("template")!=-1?u.width():1),"batch"!=this.model.editSettings.editMode||this._tabKey||(u.is(":checked")?u.prop("checked",!1):u.prop("checked",!0));break;case"SELECT":u.width(m).height(28)}null==b||b.visible||!b.validationRules||"dialogtemplate"==this.model.editSettings.editMode||"externalformtemplate"==this.model.editSettings.editMode||"inlineformtemplate"==this.model.editSettings.editMode||(b.editType==t.Grid.EditingType.Dropdown&&u.closest(".e-rowcell").find("input").addClass("e-hide"),u.addClass("e-hide")),u.is(":disabled")||o||u.is(":hidden")&&"object"!=typeof(u.data("ejDropDownList")||u.data("ejNumericTextbox"))||(this._focusElements(u),o=!0)}},_focusElements:function(e){if(e.length){var t=e;"select"==t[0].tagName.toLowerCase()&&!t.hasClass("e-field e-dropdownlist")||"input"==t[0].tagName.toLowerCase()&&!t.hasClass("e-numerictextbox")?(t.focus().select(),t[0].focus()):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()}},_renderToolBar:function(){var i,s,a=t.buildTag("div.e-gridtoolbar","",{},{id:this._id+"_toolbarItems"}),n=t.buildTag("ul");return!t.isNullOrUndefined(this.model.toolbarSettings.toolbarItems)&&this.model.toolbarSettings.toolbarItems.length&&this._renderLi(n),a.append(n),i=t.buildTag("ul"),a.append(i),!t.isNullOrUndefined(this.model.toolbarSettings.customToolbarItems)&&this.model.toolbarSettings.customToolbarItems.length&&this._renderCustomLi(i),s={},s.click=this._toolBarClick,s.cssClass=this.model.cssClass,s.enableRTL=this.model.enableRTL,s.enableSeprator=!1,a.ejToolbar(s),a.ejToolbar("disableItem",this._disabledToolItems),this._disabledToolItems=e(),a},_renderCustomLi:function(i){for(var s,a,n,o=0;o1?this._multiRowDelete():this.deleteRow();break;case u+"_update":c&&0==e("#"+this._id+"EditForm").children().find(".e-field-validation-error").length?this.model.editSettings.showConfirmDialog?this._confirmDialog.find(".e-content").html(this.localizedLabels.BatchSaveConfirm).end().ejDialog("open"):this.batchSave():h.endEdit();break;case u+"_cancel":c?e("#"+u+"ConfirmDialog").ejDialog("isOpened")===!0?this._triggerConfirm():h.cancelEditCell():h.cancelEdit();break;case u+"_search":"click"==args.type&&"A"==args.target.nodeName&&d.ejGrid("search",s);break;case u+"_printGrid":this.print();break;case u+"_excelExport":h._exportTo(h.model.exportToExcelAction,"excelExporting",h.model.allowMultipleExporting);break;case u+"_wordExport":h._exportTo(h.model.exportToWordAction,"wordExporting",h.model.allowMultipleExporting);break;case u+"_pdfExport":h._exportTo(h.model.exportToPdfAction,"pdfExporting",h.model.allowMultipleExporting);break;case u+"_responsiveFilter":e("#responsiveFilter").css("display","block"),setTimeout(function(){h.element.css("display","none")});break;case u+"_responsiveSorting":for(this._sortColumns=[],this._removeSortCol=[],n=0;n0&&(this._removeSortCol.push(this._sortColumns[0].field),this._sortColumns=[])),this._sortColumns.push({field:t,direction:i})},_resSortButClick:function(t){var i,s="",a="",n=t.model.id,o=e("#"+t.model.id).ejButton("instance");if("None"==t.model.text)s="Ascending",a="e-resIcon e-respponsiveSortingAsc",this._sortOperation(n,"ascending");else{if("Ascending"!=t.model.text){for(o.model.text="None",o.model.prefixIcon="",o.type="button",o.model.contentType="text",o._render(),i=0;i0?this.element.find(".gridform"):e("#"+this._id+"EditForm");if(0!=this._gridRecordsCount||"batch"==this.model.editSettings.editMode)for(t="batch"==this.model.editSettings.editMode?s.closest("td"):"inlineform"==this.model.editSettings.editMode||"inlineformtemplate"==this.model.editSettings.editMode||"externalform"==this.model.editSettings.editMode||"externalformtemplate"==this.model.editSettings.editMode?s.find(".e-rowcell").not(".e-unboundcell,.e-templatecell"):s.find("tr").find(".e-rowcell").not(".e-unboundcell,.e-templatecell"),i=0;i0||this.batchChanges.changed.length||this.batchChanges.deleted.length)},_renderDialog:function(){return t.buildTag("div.e-dialog e-dialog-content e-shadow e-widget-content","",{display:"none"},{id:this._id+"_dialogEdit"})},getCurrentEditCellData:function(){if(this.model.isEdit&&e("#"+this._id+"EditForm").length){var i,s=e("#"+this._id+this._bulkEditCellDetails.fieldName.replace(/[^a-z0-9\s_]/gi,""));switch(this._bulkEditCellDetails.cellEditType){case t.Grid.EditingType.String:case t.Grid.EditingType.Numeric:i=s.val();break;case t.Grid.EditingType.Dropdown:i=this._bulkEditCellDetails.isForeignKey?{value:s.ejDropDownList("getSelectedValue"),text:s.ejDropDownList("getValue")}:s.ejDropDownList("getSelectedValue");break;case t.Grid.EditingType.Boolean:i=s.is(":checked");break;case t.Grid.EditingType.DatePicker:i=s.ejDatePicker("model.value");break;case t.Grid.EditingType.DateTimePicker:i=s.ejDateTimePicker("model.value")}return"string"==typeof i&&i.length&&"number"==this.model.columns[this._bulkEditCellDetails.columnIndex].type&&(i=t.globalize.parseFloat(i,this.model.locale)),i}return null},cancelEditCell:function(){if(this.model.isEdit){var t,i=this.getRows()[this._bulkEditCellDetails.rowIndex],s={};s[this._bulkEditCellDetails.fieldName]=this._bulkEditCellDetails.cellValue,t=e(i).hasClass("e-insertedrow")?e(i).find(".e-rowcell").get(this._bulkEditCellDetails.columnIndex+this.model.groupSettings.groupedColumns.length):e(i).find(".e-rowcell").get(this._bulkEditCellDetails.columnIndex),e(t).removeClass("e-editedbatchcell").empty().html(e(e.templates[this._id+"_JSONTemplate"].render(s)).find(".e-rowcell").get(this._bulkEditCellDetails.columnIndex).innerHTML),this.model.isEdit=!1,this.element.focus()}},saveCell:function(i){var s,a,n,o;if(this.model.isEdit){if(!this.editFormValidate())return!0;var r,l,d,h,c=e("#"+this._id+"EditForm"),u=c.closest("tr"),m=c.closest("td"),p={},g=this.model.columns[this._bulkEditCellDetails.columnIndex],_=e("#"+this._id+this._bulkEditCellDetails.fieldName.replace(/[^a-z0-9\s_]/gi,""));if(p={columnName:g.field,value:this.getCurrentEditCellData(),rowData:this._bulkEditCellDetails.rowData,previousValue:this._bulkEditCellDetails.cellValue,columnObject:g,cell:m,isForeignKey:this._bulkEditCellDetails.isForeignKey},!i&&this._trigger("cellSave",p))return this._focusElements(p.cell),void(this._bulkEditCellDetails.cancelSave=!0);("datetimepicker"==this._bulkEditCellDetails.cellEditType||"dropdownedit"==this._bulkEditCellDetails.cellEditType||"datepicker"==this._bulkEditCellDetails.cellEditType)&&_[_.data("ejWidgets")[0]]("destroy"),t.isNullOrUndefined(g.format)||(("date"==g.type||"datetime"==g.type)&&(p.isForeignKey?p.value.text=p.value.text.length>0?new Date(p.value.text):p.value.text:p.value=p.value.length>0?new Date(p.value):p.value),l=this.formatting(g.format,p.isForeignKey?!isNaN(parseFloat(p.value.text))&&isFinite(p.value.text)?parseFloat(p.value.text):p.value.text:p.value,this.model.locale),p.cell.empty().html(l)),"edittemplate"==this._bulkEditCellDetails.cellEditType?(s=g.editTemplate.read,"string"==typeof s&&(s=t.util.getObject(s,window)),p.value=p.isForeignKey?{value:_.ejDropDownList("getSelectedValue"),text:_.ejDropDownList("getValue")}:s(_),t.createObject(this._bulkEditCellDetails.fieldName,p.value,p.rowData),p.cell.empty().html(p.isForeignKey?p.value.text:p.value)):"boolean"==p.columnObject.type||"booleanedit"==p.columnObject.editType?(a={},t.createObject(p.columnObject.field,p.value,a),p.cell.empty().html(e(e.templates[this._id+"_JSONTemplate"].render(a))[0].cells[this._bulkEditCellDetails.columnIndex].innerHTML)):"datepicker"==p.columnObject.editType||"datetimepicker"==p.columnObject.editType?p.cell.empty().html(l):t.isNullOrUndefined(g.format)&&p.cell.empty().html(p.isForeignKey?p.value.text:p.value),p.cell.removeClass("e-validError"),p.cell.hasClass("e-updatedtd")&&p.cell.addClass("e-gupdatenotify"),p.previousValue=t.isNullOrUndefined(p.previousValue)?"":"date"==g.type||"datetime"==g.type?new Date(p.previousValue):p.previousValue, r=p.isForeignKey?p.value.value:p.value,n=!1,n="date"==this._bulkEditCellDetails.type||"datetime"==this._bulkEditCellDetails.type&&!t.isNullOrUndefined(this._bulkEditCellDetails.format)?!(this._bulkEditCellDetails.cellValue instanceof Date)||this.formatting(this._bulkEditCellDetails.format,this._bulkEditCellDetails.cellValue)!=this.formatting(this._bulkEditCellDetails.format,r):("datepicker"==this._bulkEditCellDetails.cellEditType||"datetimepicker"==this._bulkEditCellDetails.cellEditType||"dropdownedit"==this._bulkEditCellDetails.cellEditType)&&r instanceof Date&&p.previousValue instanceof Date?r.getTime()!==p.previousValue.getTime():"number"==typeof r?r!==parseFloat(p.previousValue):r!==p.previousValue.toString(),this.model.isEdit=!1,n&&(this._enableSaveCancel(),p.cell.addClass("e-updatedtd e-icon e-gupdatenotify"),d=t.getObject(this._bulkEditCellDetails.fieldName,p.rowData),h="string"==typeof d&&d.length?p.isForeignKey?p.value.value.toString():p.value.toString():p.isForeignKey?isNaN(parseInt(p.value.value))?p.value.value:parseInt(p.value.value):p.value,"string"!=typeof p.value||h.length||(h=null),t.createObject(this._bulkEditCellDetails.fieldName,h,p.rowData),e.inArray(p.rowData,this.batchChanges.changed)==-1&&e.inArray(p.rowData,this.batchChanges.added)==-1&&this.batchChanges.changed.push(p.rowData),this.isejObservableArray&&(o=p.cell.closest("tr").hasClass("e-insertedrow")?"insert":"update",this._refreshViewModel(p,o))),u.removeClass("e-editedrow").removeClass("e-batchrow"),p.cell.removeClass("e-editedbatchcell")}},_refreshViewModel:function(i,a){var n,o,r;for(n=this._dataSource()instanceof t.DataManager?this._dataSource():t.DataManager(this._dataSource()),o=new t.Query,r=0;r(p?this._dataSource():_).length||a>this.model.columns.length,canSkip||(o=o||this._excludeDetailCells(u[i])[a],o.innerHTML=g.format===s?n:this.formatting(g.format,n,this.model.locale),this._trigger("queryCellInfo",{cell:o,text:o.innerHTML,column:g,data:f})),v&&(t.createObject(v,x,f),this._dataManager.update(v,f))},_excludeDetailCells:function(i){return t.isNullOrUndefined(this.model.detailsTemplate||this.model.childGrid||this.model.showSummary)?e(i.cells):e(i.cells).not(".e-detailrowexpand, .e-detailrowcollapse")},setCellValue:function(i,a,n){var o;if(e("#"+this._id+"EditForm").length>0&&e("#"+this._id+"EditForm").attr("id","EditForm1"),"batch"==this.model.editSettings.editMode&&!this.model.scrollSettings.allowVirtualScrolling&&!this.model.scrollSettings.frozenColumns){var r,l=this.getDataByIndex(i),d=this._excludeDetailRows()[i],h=this.getColumnIndexByField(a),c=this,u=n,m=!1,p=this.getColumnByField(a);if(r=e(d).hasClass("e-insertedrow")?e(d.cells).not(".e-detailrowcollapse, .e-detailrowexpand")[h+this.model.groupSettings.groupedColumns.length]:e(d.cells).not(".e-detailrowcollapse, .e-detailrowexpand")[h],!t.isNullOrUndefined(p)&&!p.isPrimaryKey&&0!=p.allowEditing){if(t.isNullOrUndefined(p.validationRules)||($form=t.buildTag("form","",{},{id:this._id+"EditForm"}),$valElem=t.buildTag("input","",{},{id:this._id+p.field,value:n}),$form.append($valElem),this.element.append($form),$form.validate({errorPlacement:function(t){return c._alertDialog||c._renderAlertDialog(),e("#"+c._id+"AlertDialog_wrapper").css("min-height",""),c._alertDialog.find(".e-content").text(t.text()),c._alertDialog.ejDialog("open"),c.element.find($form).remove(),m=!0,!0}}),this.setValidationToField(p.field,p.validationRules)),p.foreignKeyValue&&(u=this._foreignKeyBinding(h,n,this._id),u==s))return this._alertDialog||this._renderAlertDialog(),e("#"+this._id+"AlertDialog_wrapper").css("min-height",""),this._alertDialog.find(".e-content").text(this.localizedLabels.ForeignKeyAlert),this._alertDialog.ejDialog("open"),void(t.isNullOrUndefined(p.validationRules)||this.element.find($form).remove());t.isNullOrUndefined(p.format)||(o=this.formatting(p.format,p.foreignKeyValue&&!isNaN(parseFloat(n))&&isFinite(n)?parseFloat(n):n,this.model.locale),u=o),t.isNullOrUndefined(p.validationRules)||(e($form).validate().form(),this.element.find($form).remove()),e("#EditForm1").attr("id",this._id+"EditForm"),m||r.innerHTML==u||(e(r).has("form").length>0&&(this.model.isEdit=!1),r.innerHTML=u,e(r).addClass("e-updatedtd e-icon e-gupdatenotify"),e(r).removeClass("e-validError e-editedbatchcell"),t.createObject(a,n,l),e.inArray(l,this.batchChanges.changed)==-1&&this.batchChanges.changed.push(l),this._enableSaveCancel())}}},setDefaultData:function(i){var s,a,n,o,r;if(t.isNullOrUndefined(i)){for(s=[],a=this.model.columns,n=0;n1?(n=[],a=this._getSelectedRows(),Array.prototype.push.apply(n,this.getSelectedRecords()),Array.prototype.push.apply(this.batchChanges.deleted,this.getSelectedRecords())):(s=this.getRows()[i],a=e(s),n=this.getDataByIndex(i)),o={primaryKey:this._primaryKeys,rowIndex:i,rowData:n,row:a},this._trigger("beforeBatchDelete",o))return;this.isejObservableArray&&this._refreshViewModel(o,"remove"),a.hasClass("e-insertedrow")?(a.remove(),i=e.inArray(s,this._bulkEditCellDetails.insertedTrCollection),i!=-1&&(this._bulkEditCellDetails.insertedTrCollection.splice(i,1),this.batchChanges.added.splice(i,1))):(a.hide(),(0==o.rowIndex||a.hasClass("e-firstrow"))&&(a.hasClass("e-firstrow")&&this.getContentTable().find("tr").removeClass("e-firstrow"),this.getContentTable().find("tr:visible").first().addClass("e-firstrow")),e.isArray(n)||this.batchChanges.deleted.push(n)),this._gridRows=this.getContentTable().find("td.e-rowcell").closest("tr").toArray(),this._enableSaveCancel(),this._selectedRow(-1),o={primaryKey:this._primaryKeys,rowIndex:i,rowData:n},this._trigger("batchDelete",o)}},_bulkAddRow:function(i){var s,a,n,o,r,l,d=e("#"+this._id+"EditForm");if(d.length&&!this.editFormValidate())return!0;if(this.model.editSettings.allowAdding){if(s={},o=this.getRows(),t.isNullOrUndefined(i)||(this._bulkEditCellDetails.defaultData=i),t.isNullOrUndefined(this._bulkEditCellDetails.defaultData)&&this.setDefaultData(),s={defaultData:e.extend(!0,{},this._bulkEditCellDetails.defaultData),primaryKey:this._primaryKeys},this._trigger("beforeBatchAdd",s))return;for(a=e(e.render[this._id+"_JSONTemplate"](s.defaultData)).addClass("e-insertedrow"),null!=o&&e(o[0]).hasClass("e-alt_row")&&a.removeClass("e-alt_row"),"top"==this.model.editSettings.rowPosition?this.getContentTable().first().find("tbody").first().prepend(a):"bottom"==this.model.editSettings.rowPosition&&this.getContentTable().first().find("tbody").first().append(a),0===this._gridRecordsCount&&this.getContentTable().find("tbody .emptyrecord").first().remove(),this._gridRows=this.getContentTable().find("td.e-rowcell").closest("tr").toArray(),r=0;r0?this.element.find(".gridform"):e("#"+this._id+"EditForm"),s=0;s(this.model.scrollSettings.frozenColumns>0?this.getContent().find(".e-movablecontent"):this.getContent()).height(),c=("normal"==this.model.editSettings.editMode||"batch"==this.model.editSettings.editMode)&&h,u=c&&this.model.allowScrolling;c&&!this.model.allowScrolling&&(o.removeClass("e-validError"),i.find(".e-field-validation-error").css("position","absolute").width(s.width()-5)),this.model.allowScrolling&&!o.hasClass("e-validError")&&o.addClass("e-validError"),a=u?"append":"prepend",r[a](l),this.model.enableRTL?"dialog"!=this.model.editSettings.editMode&&r.offset({top:s.offset().top+s.height()}):"dialog"!=this.model.editSettings.editMode&&r.offset({left:s.offset().left,top:s.offset().top+s.height()}),u&&(n=r.css("top"),l.addClass("e-bottomarrow"),r.css({bottom:n,top:"auto"})),r.show("slow")}},setValidation:function(){for(var e=0;e0?n.find("#"+this._id+l):n.find("#"+l),s.regex&&(s[i+"regex"]=s.regex,delete s.regex,e.validator.addMethod(l+"regex",function(e,t,i){var s=i instanceof RegExp?i:new RegExp(i);return s.test(e)},t.getObject("messages.regex",s)||this.getColumnByField(i).headerText+" should match the given pattern")),a.attr("name")||a.attr("name",i),a.rules("add",s),o=e("#"+this._id+"EditForm").validate(),o.settings.messages[i]=o.settings.messages[i]||{},t.isNullOrUndefined(s.required)||(r=t.isNullOrUndefined(s.messages&&s.messages.required)?e.validator.messages.required:s.messages.required,0==r.indexOf("This field")&&(r=r.replace("This field",this.getColumnByField(i).headerText)),o.settings.messages[i].required=r,a.hasClass("e-datepicker")&&a.ejDatePicker({watermarkText:""}))},_renderConfirmDialog:function(){var i=t.buildTag("div.e-content",this.localizedLabels.BatchSaveConfirm),s=t.buildTag("span.e-buttons"," ");this._confirmDialog=t.buildTag("div#"+this._id+"ConfirmDialog"),this._confirmDialog.append(i).append(s),this.element.append(this._confirmDialog),s.find("input").ejButton({cssClass:this.model.cssClass,showRoundedCorner:!0,size:"mini",click:e.proxy(this._triggerConfirm,this)}),this._renderFDialog(this._id+"ConfirmDialog"),this._confirmDialog.ejDialog({width:"auto",minWidth:0,minHeight:0,enableModal:!0})},_unboundClickHandler:function(i){var s,a,n,o,r,l,d,h,c=e(i.target).closest("button");if(!(c.hasClass("e-button")&&(c.hasClass("e-disable")||c.prop("disabled"))||(s=0,a={},e(i.target).hasClass("e-unboundcelldiv")))){if(n=c.hasClass("e-savebutton")?this.getIndexByRow(e(".e-editedrow")):this.getIndexByRow(c.closest("tr")),this.model.isEdit&&c.hasClass("e-editbutton"))return void(this._unboundRow=c.closest("tr"));if(o=this._currentJsonData[n],r=e(c).ejButton("instance"),("inlineform"==this.model.editSettings.editMode||"inlinetemplate"==this.model.editSettings.editMode)&&(s=e("#"+this._id).find(".e-editedrow").length),this.model.allowSelection&&!this.model.isEdit&&this.selectRows(this.getIndexByRow(c.closest("tr"))-s),c.hasClass("e-cancelbutton")&&(this.model.isEdit=!1),e.isFunction(e.fn.ejDatePicker)&&e("#"+this._id+"EditForm").find(".e-datepicker").ejDatePicker("hide"),c.hasClass("e-editbutton"))this.model.isEdit&&this.cancelEdit(),l=this.getRowByIndex(n),this.startEdit(l);else if(c.hasClass("e-deletebutton")){if(l=this.getRowByIndex(n),this.model.editSettings.showDeleteConfirmDialog)return void this._toolbarOperation(this._id+"_delete");this.deleteRow(l)}else c.hasClass("e-savebutton")?(this.endEdit(),o=this._currentJsonData[n]):c.hasClass("e-cancelbutton")&&this.cancelEdit();a={rowIndex:n,data:o,buttonModel:r.model},t.raiseWebFormsServerEvents&&(d={model:this.model,originalEventType:"commandButtonClick"},h=a,t.isNullOrUndefined(this.model.serverEvents)||e.inArray("commandButtonClick",this.model.serverEvents)==-1||t.raiseWebFormsServerEvents("commandButtonClick",d,h))}},addRecord:function(i,s){var a,n;this.model.editSettings.allowAdding&&0==e(".e-gridcontent").find(".gridform").length&&(i?(("normal"==this.model.editSettings.editMode||"inlineform"==this.model.editSettings.editMode||"inlineformtemplate"==this.model.editSettings.editMode)&&(a=t.buildTag("tr.e-addedrow"),this.getContentTable().find("tbody").first().prepend(a)),n={data:i},n.action="add",n.selectedRow=this._selectedRow(),this._cAddedRecord=i,n.requestType=t.Grid.Actions.Save,this._updateAction(n),n.selectedRow!=-1&&this.selectRows(n.selectedRow+1),this._isUnboundColumn&&this._refreshUnboundTemplate(this.getContentTable()),s||("normal"==this.model.editSettings.editMode||"inlineform"==this.model.editSettings.editMode||"inlineformtemplate"==this.model.editSettings.editMode)&&this.model.allowPaging&&this.model.pageSettings.pageSize0&&this._createSummaryRows(this.getFooterTable())):(e.inArray(o,this.selectedRowsIndexes)==-1&&this.selectedRowsIndexes.push(o),this.deleteRow(r))))},deleteRecord:function(e,t){this._updateDeleteRecord(e,t,"remove")}}}(jQuery,Syncfusion),function(e,t){t.gridFeatures=t.gridFeatures||{},t.gridFeatures.sort={_addSortElementToColumn:function(i,s){var a,n,o,r,l=t.DataManager(this.model.columns).executeLocal(t.Query().where("field","equal",i));if(n=l.length>1?this.getColumnByHeaderText(this._$curSElementTarget.text()):this.getColumnByField(i),!t.isNullOrUndefined(n)){var d=e.inArray(n,this.model.columns),h=this.getsortColumnByField(i),c=e.inArray(h,this.model.sortSettings.sortedColumns),u=this.getHeaderTable().find("thead tr:not('.e-stackedHeaderRow')").find(".e-headercell").not(".e-detailheadercell").eq(d).find(".e-headercelldiv");if(s=t.isNullOrUndefined(s)?"ascending":s.toLowerCase(),u.find(".e-ascending,.e-descending").remove(),this.model.allowGrouping&&0!=this.model.groupSettings.groupedColumns.length&&this.element.find(".e-groupdroparea").find("div[ej-mappingname='"+i+"']").find(".e-ascending,.e-descending").not(".e-ungroupbutton").remove(),a="descending"!=s?"e-rarrowup-2x":"e-rarrowdown-2x",o=1,this.model.allowSorting&&this.model.allowMultiSorting&&this.model.sortSettings.sortedColumns.length>1){for(r=1;r<=c;r++)o+=1;"right"==u.css("text-align")?(u.prepend(this._createSortNumber(o,u).addClass("e-sortnumber")),u.append(this._createSortElement().addClass("e-"+(s||"ascending")+" "+a))):(u.prepend(this._createSortNumber(o,u).addClass("e-sortnumber")),u.append(this._createSortElement().addClass("e-"+(s||"ascending")+" "+a)))}else u.append(this._createSortElement().addClass("e-"+(s||"ascending")+" "+a));this.model.allowGrouping&&0!=this.model.groupSettings.groupedColumns.length&&this.element.find(".e-groupdroparea").find("div[ej-mappingname='"+i+"']").append(this._createSortElement().addClass("e-"+(s||"ascending")+" "+a)),u.parent().attr("aria-sort",s)}},_removeSortElementFromColumn:function(t){var i=this.getColumnByField(t),s=e.inArray(i,this.model.columns),a=this.getHeaderTable().find("thead").find(".e-headercell").not(".e-detailheadercell").eq(s).find(".e-headercelldiv");a.find(".e-ascending,.e-descending").remove(),a.parent().removeAttr("aria-sort")},_sortCompleteAction:function(i){var s,a,n;for(this.getHeaderTable().find(".e-columnheader").find(".e-headercelldiv").find(".e-ascending,.e-descending,.e-number").remove(),this.model.allowGrouping&&0!=this.model.groupSettings.groupedColumns.length&&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]").removeAttr("aria-sort"),a=0;a0&&(r=ej.isNullOrUndefined(o.format)?"date"==this._currentFilterColumn.type?ej.preferredCulture().calendar.patterns.d:ej.preferredCulture().calendar.patterns.f:o.format.replace("{0:","").replace("}",""),i=ej.parseDate(i,r,this.model.locale)),l=[],"object"==typeof e?l=e:l.push({field:e,operator:t,value:i,predicate:s,matchcase:a,actualFilterValue:n}),d=0;d0&&$.inArray(o,this.filterColumnCollection)==-1&&this.filterColumnCollection.push(o),this._oldFilterColumn=this._currentFilterColumn=o,this._showFilterMsg())}},search:function(e){var t={};$("#"+this._id+"_search").find("input").val()!=e,$("#"+this._id+"_search").find("input").val(e),t.requestType=ej.Grid.Actions.Search,t.keyValue=e,(""!=e||""!=this.model.searchSettings.key)&&(this.model.searchSettings.key=e.toLowerCase()==this.localizedLabels.True.toLowerCase()?"true":e.toLowerCase()==this.localizedLabels.False.toLowerCase()?"false":e,this._processBindings(t)),this._primaryKeyValues=[]},_filterBarHandler:function(e){var t,i,s=e.keyCode,a=$(e.target);if(a.closest(".e-grid").attr("id")===this._id&&("immediate"==this.model.filterSettings.filterBarMode||13==s)&&9!=s){if(a=$(e.target),this.filterStatusMsg="",t=a.prop("id").replace("_filterBarcell",""),i=this.getColumnByField(t),null==i)return;if(this._currentFilterColumn=i,this._$curFieldName=i.field,this._currentFilterColumn!=this._oldFilterColumn&&(this.filterValueOldLength=0),this._currentFilterbarValue=a.val().toLowerCase()==this.localizedLabels.True.toLowerCase()?"true":a.val().toLowerCase()==this.localizedLabels.False.toLowerCase()?"false":a.val(),this.filterValueCurrentLength=this._currentFilterbarValue.length,(0==this.filterValueCurrentLength&&0==this.filterValueOldLength||this._currentFilterbarValue==this.OldfilterValue)&&this._currentFilterColumn==this._oldFilterColumn&&!this.model.scrollSettings.enableVirtualization)return void this._showFilterMsg();if(this._skipFilterProcess=this._checkForSkipInput(),this._skipFilterProcess){if("string"!=this._currentFilterColumn.type)return this._skipFilterProcess=!1,void(this.model.scrollSettings.enableVirtualization||this._showFilterMsg());this.filterStatusMsg="Invalid Filter Data",this._showFilterMsg()}else this._processFilter(e)}},_renderResponsiveFilter:function(){for(var e,t,i=ej.buildTag("div#responsiveFilter.resFilterDiv","",{width:"100%",padding:"0px"}),s=$(window).height()+1,a=.08*s,n=(this.element.height()>s?$(window).width()+16.5:$(window).width(),ej.buildTag("div.columnDiv","",{width:"100%"})),o=0;oFilter
    "),d=ej.buildTag("div.e-resFilterleftIcon","",{"margin-top":"3%"}),h=ej.buildTag("span.e-icon e-responsiveFilterClear e-resIcon","",{"font-size":"23px"}),c=ej.buildTag("div.e-resFIlterRigthIcon","",{float:"right","margin-top":"3%"},{closeDialogue:"responsiveFilter",gridEle:!0}),u=ej.buildTag("span.e-icon e-responisveClose e-resIcon","",{"font-size":"23px"},{closeDialogue:"responsiveFilter",gridEle:!0});c.click(function(){$("#responsiveFilter").css("display","none"),r.element.css("display","block")}),d.click(function(){$("#responsiveFilter").find(".e-responsivefilterColDiv").find(".e-filternone").click()}),l.append(d.append(h)),l.append(t).append(c.append(u)),i.prepend(l),i.insertAfter(this.element),$(".resFilterDiv").bind("keydown",$.proxy(this._responsiveDialogueKeyUp,this)),i.css("display","none"),$(".e-responsivefilterColDiv").bind("click",$.proxy(this._mouseClickHandler,this))},_closeDivIcon:function(e){var t,i=$(e.target);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 e,t=$("#responsiveFilter").find(".columnDiv"),i=this;for(t.find(".e-filtericon").remove(),e=0;e0&&"filterbar"==this.model.filterSettings.filterType&&$.inArray(this.model.columns[a].field,h)==-1)for(n=0;n"+this.model.filterSettings.filteredColumns[n].value):"lessthan"==this.model.filterSettings.filteredColumns[n].operator?s.val("<"+this.model.filterSettings.filteredColumns[n].value):"notequal"==this.model.filterSettings.filteredColumns[n].operator?s.val("!="+this.model.filterSettings.filteredColumns[n].value):s.val(this.model.filterSettings.filteredColumns[n].value),$.inArray(this.model.filterSettings.filteredColumns[n].field,h)==-1&&h.push(this.model.filterSettings.filteredColumns[n].field));(this.model.columns[a].allowFiltering===!1||""==this.model.columns[a].field||ej.isNullOrUndefined(this.model.columns[a].field))&&(s.attr("disabled",!0).addClass("e-disable"),this._disabledFilterableColumns.push(this.model.columns[a].headerText)),this.model.columns[a].visible===!1&&c.addClass("e-hide"),ej.isNullOrUndefined(this.model.columns[a].cssClass)||c.addClass(this.model.columns[a].cssClass),0==this.model.columns[a].allowFiltering||ej.isNullOrUndefined(this.model.columns[a].filterBarTemplate)?u.append(s).append(m):u.append(s),d.append(c.append(u)),a==this.model.scrollSettings.frozenColumns-1&&(i=d.clone(),l.find("thead").first().append(i),d.empty())}if(l.find("thead").last().append(d),"msie"==ej.browserInfo().name&&ej.browserInfo().version<10)for(o=l.find("thead").find(".e-ejinputtext.e-filtertext"),r=0;r","<","=","!"],i=0;i=1?ej.parseFloat(this._currentFilterbarValue,this.model.locale):e.length>1?ej.parseFloat(e,this.model.locale):e;break;case"date":case"datetime":this._operator=ej.FilterOperators.equal,this._getOperator(e),s=ej.isNullOrUndefined(this._currentFilterColumn.format)?"date"==this._currentFilterColumn.type?ej.preferredCulture().calendar.patterns.d:ej.preferredCulture().calendar.patterns.f:this._currentFilterColumn.format.replace("{0:","").replace("}",""),""!=this._currentFilterbarValue&&(a=ej.parseDate(this._currentFilterbarValue,s,this.model.locale),ej.isNullOrUndefined(a)?this.filterStatusMsg="Invalid Filter Data":this._currentFilterbarValue=ej.parseDate(this._currentFilterbarValue,s,this.model.locale));break;case"string":"*"==e.charAt(0)?(this._currentFilterbarValue=this._currentFilterbarValue.slice(1),this._operator=ej.FilterOperators.startsWith):"%"==e.charAt(e.length-1)?(this._currentFilterbarValue=this._currentFilterbarValue.slice(0,-1),this._operator=ej.FilterOperators.startsWith):"%"==e.charAt(0)?(this._currentFilterbarValue=this._currentFilterbarValue.slice(1),this._operator=ej.FilterOperators.endsWith):this._operator=ej.FilterOperators.startsWith;break;case"boolean":"true"==this._currentFilterbarValue.toLowerCase()||"1"==this._currentFilterbarValue?this._currentFilterbarValue=!0:("false"==this._currentFilterbarValue.toLowerCase()||"0"==this._currentFilterbarValue)&&(this._currentFilterbarValue=!1),this._operator=ej.FilterOperators.equal;break;default:this._operator=ej.FilterOperators.equal}},_getOperator:function(e){"="==e.charAt(0)&&(this._operator=ej.FilterOperators.equal,this._currentFilterbarValue=e.substring(1)),(ej.data.operatorSymbols[e.charAt(0)]!==undefined||ej.data.operatorSymbols[e.slice(0,2)]!==undefined)&&(this._operator=ej.data.operatorSymbols[e.charAt(0)],this._currentFilterbarValue=e.substring(1),this._operator===undefined&&(this._operator=ej.data.operatorSymbols[e.slice(0,2)],this._currentFilterbarValue=e.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 e,t,i=!1;if("number"==this._currentFilterColumn.type&&(ej.data.operatorSymbols[this._currentFilterbarValue]!==undefined||$.inArray(this._currentFilterbarValue,["="," ","!"])!=-1)&&(i=!0),"string"==this._currentFilterColumn.type)for(e=[">","<","=","!"],t=0;t0)&&"Invalid Filter Data"!=this.filterStatusMsg)for(a=0;a0&&""!=this.filterStatusMsg&&(this.filterStatusMsg+=" && "),this.filterStatusMsg+=i+": "+e);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()),"Invalid Filter Data"==this.filterStatusMsg&&(a=$.inArray(this._currentFilterColumn,this.filterColumnCollection),this.filterColumnCollection.splice(a,1)),this.filterStatusMsg=""},_renderFilterDialogs:function(){var e,t,i,s,a,n;$.each(this.model.columns,ej.proxy(function(o,r){"string"!=r.type||e&&ej.isNullOrUndefined(r.filterType)?"guid"!=r.type||n&&ej.isNullOrUndefined(r.filterType)?"number"!=r.type||t&&ej.isNullOrUndefined(r.filterType)?"date"!=r.type||s&&ej.isNullOrUndefined(r.filterType)?"datetime"!=r.type||a&&ej.isNullOrUndefined(r.filterType)?"boolean"!=r.type||i&&ej.isNullOrUndefined(r.filterType)||(ej.isNullOrUndefined(r.filterType)&&(i=!0),this._renderFilters(r)):(ej.isNullOrUndefined(r.filterType)&&(a=!0),this._renderFilters(r)):(ej.isNullOrUndefined(r.filterType)&&(s=!0),this._renderFilters(r)):(ej.isNullOrUndefined(r.filterType)&&(t=!0),this._renderFilters(r)):(ej.isNullOrUndefined(r.filterType)&&(n=!0),this._renderFilters(r)):(ej.isNullOrUndefined(r.filterType)&&(e=!0),this._renderFilters(r))},this))},_renderFilters:function(col){this._isExcelFilter&&"menu"!=col.filterType||"excel"==col.filterType?(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 e,t=this._id+"_stringDlg";$("#"+t).length>0||(e=ej.buildTag("div#"+t+".e-dlgcontainer e-filterDialoge"),e.appendTo("body"),this._renderDlgContent(e,"string"),this.model.isResponsive&&this._mediaStatus||this._renderFDialog(t))},_renderBooleanDialog:function(){var e,t=this._id+"_booleanDlg";$("#"+t).length>0||(e=ej.buildTag("div#"+t+".e-dlgcontainer e-filterDialoge"),e.appendTo("body"),this._renderDlgContent(e,"boolean"),this.model.isResponsive&&this._mediaStatus||this._renderFDialog(t),this.model.filterSettings.showPredicate?$("#"+t).ejDialog({minHeight:136,width:"100%"}):$("#"+t).ejDialog({minHeight:90,width:"100%"}))},_renderGuidDialog:function(){var e,t=this._id+"_guidDlg";$("#"+t).length>0||(e=ej.buildTag("div#"+t+".e-dlgcontainer e-filterDialoge"),e.appendTo("body"),this._renderDlgContent(e,"guid"),this.model.isResponsive&&this._mediaStatus||this._renderFDialog(t))},_renderNumberDialog:function(){var e,t=this._id+"_numberDlg";$("#"+t).length>0||(e=ej.buildTag("div#"+t+".e-dlgcontainer e-filterDialoge"),e.appendTo("body"),this._renderDlgContent(e,"number"),this.model.isResponsive&&this._mediaStatus||this._renderFDialog(t))},_renderDateDialog:function(e){var t,i=this._id+"_dateDlg";$("#"+i).length>0||(t=ej.buildTag("div#"+i+".e-dlgcontainer e-filterDialoge"),t.appendTo("body"),this._renderDlgContent(t,"date",e),this.model.isResponsive&&this._mediaStatus||this._renderFDialog(i))},_renderDatetimeDialog:function(e){var t,i=this._id+"_datetimeDlg";$("#"+i).length>0||(t=ej.buildTag("div#"+i+".e-dlgcontainer e-filterDialoge"),t.appendTo("body"),this._renderDlgContent(t,"datetime",e),this.model.isResponsive&&this._mediaStatus||this._renderFDialog(i))},_renderFDialog:function(e){$("#"+e).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(e,t,i){e.addClass("e-grid");var s,a=ej.buildTag("div.e-predicate"),n=ej.buildTag("div.e-operator"),o=ej.buildTag("div.e-value"),r=this.localizedLabels.StringMenuOptions,l=this.localizedLabels.NumberMenuOptions,d=ej.buildTag("input#"+this._id+t+"_ddinput",{},{},{type:"text"}),h=ej.buildTag("div#"+this._id+t+"_dropdown"),c=ej.buildTag("ul"),u=ej.buildTag("input",{},{},{type:"radio",name:this._id+"_predicate"+t,value:"or"}),m=ej.buildTag("input",{},{},{type:"radio",name:this._id+"_predicate"+t,value:"and",checked:"checked"});a.append(m).append(ej.buildTag("span.e-caption").html(this.localizedLabels.PredicateAnd)).append(u).append(ej.buildTag("span.e-caption").html(this.localizedLabels.PredicateOr)),this.model.filterSettings.showPredicate||a.hide(),"string"==t&&(s=ej.buildTag("input",{},{},{type:"checkbox"}),a.append(s).append(ej.buildTag("span.e-caption").html(this.localizedLabels.MatchCase)),$.each(r,function(e,t){c.append(ej.buildTag("li",{},{},{value:t.value}).html(t.text))})),("number"==t||"date"==t||"datetime"==t||"guid"==t)&&("guid"==t&&(l=l.slice(4,6)),$.each(l,function(e,t){c.append(ej.buildTag("li",{},{},{value:t.value}).html(t.text))})),"boolean"!=t&&(h.append(c),n.append(d),n.append(h));var p=ej.buildTag("input",{},{},{type:"text"}),g=ej.buildTag("input",{},{},{type:"checkbox"}),_=this.model.enableResponsiveRow?"OkButton":"Filter",f=this.model.enableResponsiveRow?"CancelButton":"Clear",b=ej.buildTag("input.e-filter",{},{},{type:"button",value:this.localizedLabels[_]}),v=ej.buildTag("input.e-clear",{},{},{type:"button",value:this.localizedLabels[f]});o.append(ej.buildTag("span.e-caption").html(this.localizedLabels.FilterMenuCaption+" : ")),e.append(a),"boolean"==t?(o.find("span.e-caption").css("top","1px"),o.append(g)):(o.append(ej.buildTag("br")).append(p),e.append(n)),e.append(o),e.append(ej.buildTag("div.e-dlgBtns").append(b).append(v)),"boolean"!=t&&d.ejDropDownList({cssClass:this.model.cssClass,enableRTL:this.model.enableRTL,targetID:this._id+t+"_dropdown",width:"100%",height:"26px",selectedItemIndex:0}),u.ejRadioButton({cssClass:this.model.cssClass,enableRTL:this.model.enableRTL}),m.ejRadioButton({cssClass:this.model.cssClass,enableRTL:this.model.enableRTL,checked:!0}),s&&s.ejCheckBox({cssClass:this.model.cssClass,enableRTL:this.model.enableRTL}),e.css("display","none"),this._createButton("filter",b),this._createButton("clear",v),"number"==t?p.ejNumericTextbox({cssClass:this.model.cssClass,enableRTL:this.model.enableRTL,value:0,showSpinButton:!1,height:"26px",decimalPlaces:2,width:"100%"}):"guid"==t?p.css({height:"26px",width:"100%"}):"date"==t?(p.attr("id",this._id+"_dpDate"),p.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)||p.ejDatePicker({dateFormat:i.format.replace(/{0:|}/g,function(){return""})})):"datetime"==t?(p.attr("id",this._id+"_dpDateTime"),p.ejDateTimePicker({cssClass:this.model.cssClass,enableRTL:this.model.enableRTL,enableStrictMode:!0,width:"100%",locale:this.model.locale}),ej.isNullOrUndefined(i.format)||p.ejDateTimePicker({dateTimeFormat:i.format.replace(/{0:|}/g,function(){return""})})):"boolean"==t?g.ejCheckBox({cssClass:this.model.cssClass,enableRTL:this.model.enableRTL}):"string"==t&&(p.attr("id",this._id+"_acString"),p.ejAutocomplete({cssClass:this.model.cssClass,enableRTL:this.model.enableRTL,dataSource:this._dataSource(),width:"100%",height:26,enableDistinct:!0,focusIn:function(){var e=this.element.closest(".e-dialog").find(".e-dropdownlist"),t=this.element.closest(".e-dialog").find(".e-checkbox").prop("checked");this.model.filterType=e.ejDropDownList("model.value"),this.model.caseSensitiveSearch=t},open:function(){var e=!this.element.closest(".e-dialog").ejDialog("isOpened");this.suggestionList.css({visibility:e?"hidden":"visible"})}}))},_createButton:function(e,t){var i="filter"==e?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 e;return $.each(this.model.columns,function(t,i){if(i.key)return e=i.field,!1}),e},_filterCompleteAction:function(){var e;if(this.model.allowPaging&&this._refreshGridPager(),"menu"==this.model.filterSettings.filterType||this._isExcelFilter){this._closeFDialog();var t=this.getColumnByField(this._$curFieldName),i=$.inArray(t,this.model.columns),s=this,a=!1;$.each(this.model.filterSettings.filteredColumns,function(e,t){return t.field==s._$curFieldName?(a=!0,!1):1==t.isComplex&&t.predicates[0].field==s._$curFieldName?(a=!0,!1):void 0}),e=this.getHeaderTable().find("thead").find(".e-headercell").not(".e-detailheadercell,.e-stackedHeaderCell").eq(i).find(".e-filtericon"),a?e.addClass("e-filteredicon e-filternone"):e.removeClass("e-filteredicon e-filternone")}},_refreshFilterIcon:function(){var e,t,i,s,a,n;if(this.model.filterSettings.filteredColumns.length)for(e=ej.distinct(this.model.filterSettings.filteredColumns,"field",!0),t=this.getHeaderTable().find("thead").find(".e-headercell").not(".e-detailheadercell"),this.model.showStackedHeader&&(t=t.not(".e-stackedHeaderCell")),this.model.allowReordering&&t.find(".e-filtericon").removeClass("e-filteredicon e-filternone"),a=0,n=e.length;a",d,!s).and(o,"<",h,!s)).select(n):(new ej.Query).where(ej.Predicate(o,"<=",d,!s).or(o,">=",h,!s)).select(n):(new ej.Query).where(o,e,t,!s).select(n)):c=(new ej.Query).where(o,e,t,!s).select(n),u={actualFilterValue:t,actualOperator:e,ejpredicate:undefined,predicate:_},f.executeQuery(c).done(ej.proxy(function(a){for(p=a.result,requireProc=$.isPlainObject(p[0]),preds=[],merge=!1,p=requireProc?ej.distinct(p,n,!1):p,field=this._$curFieldName,m=new ej.Predicate(field,"equal",p[0],s),i=1,vlen=p.length;i1&&n.prepend(o._getIndentCol())),a.html(n),a.html()},_colSpanAdjust:function(s,a,n){var o,r,l,d,h,c,u,m,p;if(t.isNullOrUndefined(s)?(o=this,r=n):(o=this.getRsc("helpers",s),r=this),1==o.model.groupSettings.groupedColumns.length?(l=r.data.items.level===i?1:r.data.items.level-1,"groupcaption"==a&&(o._currentJsonData=o._currentJsonData.concat(r.data.items))):(l=r.data.items.level===i?o.model.groupSettings.groupedColumns.length:r.data.items.level-1,"groupcaption"==a&&r.data.items.level===i&&(o._currentJsonData=o._currentJsonData.concat(r.data.items))),o._isGrouping=!0,d=o.model.groupSettings.showGroupedColumn?0:o.model.groupSettings.groupedColumns.length,h=0,e.each(o._hiddenColumnsField,function(t,i){var s=e.inArray(i,o.model.groupSettings.groupedColumns);s!=-1&&(h+=1,o.model.groupSettings.showGroupedColumn&&(d+=1))}),c=o.model.columns.length+o.model.groupSettings.groupedColumns.length-l-o._hiddenColumnsField.length-d+h,c=null!=o.model.detailsTemplate||null!=o.model.childGrid?c+1:c,o._isCaptionSummary&&"groupcaption"==a){var g=[],_=0,f=o._captionSummary(),b=0,v=[];for(e.each(f[0].summaryColumns,function(t,i){e.inArray(i.displayColumn,o._hiddenColumnsField)!=-1&&_++,v.push(o.getColumnIndexByField(i.displayColumn)),g.push(o.getColumnIndexByField(i.displayColumn)+o.model.groupSettings.groupedColumns.length-l)}),u=t.min(v),m=0;mp&&b++;g.length>0&&(c=t.min(g)),c-=b,c=null!=o.model.detailsTemplate||null!=o.model.childGrid?c+1:c}return c},_captionEncode:function(e){var t=this.getRsc("helpers",e),i=t.getColumnByField(this.data.field);return i.disableHtmlEncode},_captionFormat:function(i){var s,a=this.getRsc("helpers",i),n=this.data,o=a.getColumnByField(n.field);return s=o.foreignKeyValue&&o.dataSource?a._foreignKeyBinding(a.getColumnIndexByField(n.field),n.key,a._id):n.key,t.isNullOrUndefined(o.format)||o.format.indexOf("{0:")!=-1||(n[n.field]=n.key,a.data=n),n.key=o.format?a.formatting(o.format,s,a.model.locale):s,n.headerText=o.headerText,e.render[a._id+"_CaptionTemplate"](n)},_getCaptionColGroup:function(e){var t,i=this.getHeaderTable().find("colgroup").clone(),s=i.find("col"),a=s.length-this.model.columns.length;if((null!=this.model.detailsTemplate||null!=this.model.childGrid)&&(a-=1),i.find("col:lt("+a+")").remove(),e>0&&e!=this.model.groupSettings.groupedColumns.length)if(this.model.groupSettings.groupedColumns.length>2&&e!=this.model.groupSettings.groupedColumns.length-1)for(t=0;t0&&(colIndex=t.min(o)),l=u.model.columns.length,u.getFooterTable().find("tbody td").slice(-(l-colIndex)).removeClass("e-summaryrow").addClass("e-groupcaptionsummary")),!u.model.groupSettings.showGroupedColumn){var m=u.model.groupSettings.groupedColumns,p=0,g=u.getFooterTable().children("tbody").find("tr");for(d=0;d{{if ~_"+o._id+"CaptionEncode('"+o._id+"Object')}}{{html:"+i+"}}{{else}}{{:"+i+"}}{{/if}}",this._isCaptionSummary&&this.model.showSummary&&(s=s+"{{:~_"+o._id+"GroupSummaryRow(items, aggregates,'"+o._id+"Object')}}"),a=""+s+"",n=t.buildTag("tbody"),n.html("{{if items.GROUPGUID}}{{for items tmpl='"+o._id+"_GroupingTemplate'/}}{{else}}{{for items tmpl='"+o._id+"_JSONTemplate'/}}{{/if}}");var l="{{:~_"+o._id+"Colgroup('"+o._id+"Object')}}"+n.html()+"{{:~_"+o._id+"GroupSummaryRow(items, aggregates,'"+o._id+"Object', '"+o._id+"showGroupCaption')}}
    ",d=""+l+"",h=""+d+"";e.templates(o._id+"_GroupingTemplate",a+h)},addSummaryTemplate:function(){var i=this;e.each(i.model.summaryRows,function(s,a){e.each(a.summaryColumns,function(s,a){t.isNullOrUndefined(a.template)||e.templates(i._id+"_summaryTemplate"+a.template,a.template)})})},_getGroupTopLeftCell:function(){var e=t.buildTag("th.e-grouptopleftcell");return e.append(t.buildTag("div.e-headercelldiv e-emptyCell"," ")),e},_getEmptyFilterBarCell:function(){return t.buildTag("th.e-filterbarcell e-grouptopleftcell")},_groupingAction:function(e){var t,i=this.getHeaderTable().find("thead").find(".e-columnheader:not(.e-stackedHeaderRow)").find(".e-grouptopleftcell"),s=(this.getHeaderTable().find("colgroup").find("col"),i.length);for(s&&(this.getHeaderTable().find("colgroup").replaceWith(this._getMetaColGroup()),(null!=this.model.detailsTemplate||null!=this.model.childGrid)&&this.getHeaderTable().find("colgroup").prepend(this._getIndentCol()),i.remove(),this.getHeaderTable().find("thead").find(".e-filterbar").find(".e-filterbarcell:lt("+s+")").remove()),(!this.model.allowResizeToFit||e)&&this.setWidthToColumns(),t=0;t=1&&(l=30/d),this.getHeaderTable().find("colgroup").find("col").slice(0,this.model.groupSettings.groupedColumns.length).css("width",l+"px"),i=this.getContentTable().find("table").filter(":not(.e-recordtable)"),r=this.getHeaderTable().find(".e-lastgrouptopleftcell").width(),r>30||this._isCaptionSummary&&(r>=30||r>l)?(this._isCaptionSummary?(s=this.model.isEdit?i.parent(":not(.gridform)").children("colgroup"):i.children("colgroup"),e.each(s,function(t,i){var s=e(i).find("col").length-n.model.columns.length;(null!=n.model.detailsTemplate||null!=n.model.childGrid)&&s>0&&(s-=1),e(i).find("col").slice(0,s).css("width",l+"px")})):this.model.isEdit?i.parent(":not(.gridform)").children("colgroup").find("col:first-child").css("width",r+"px"):i.children("colgroup").find("col:first-child").css("width",r+"px"),t=this.getContentTable().find("colgroup").first().find("col").slice(0,this.model.groupSettings.groupedColumns.length),"msie"!=o.browser?t.css("width",l+"px"):this._isCaptionSummary?t.css("width",l+"px"):t.first().css("width",r/this.element.width()*100+"%")):(this.getContentTable().find("colgroup").first().find("col").slice(0,this.model.groupSettings.groupedColumns.length).css("width",l+"px"),this.getContentTable().find("table").filter(":not(.e-recordtable)").children("colgroup").find("col:first-child").css("width",r+"px")),this.model.showSummary&&(a=this.getContentTable().find("table").filter(".e-groupsummary").find(".e-summary"),a.css("width",l+"px"))},getFieldNameByHeaderText:function(e){return t.isNullOrUndefined(this._fieldColumnNames[e])?null:this._fieldColumnNames[e]},getHeaderTextByFieldName:function(e){return t.isNullOrUndefined(this._headerColumnNames[e])?null:this._headerColumnNames[e]},expandAll:function(){var t,i=this.element.find(".e-recordpluscollapse"),s=this._excludeDetailRows().find(".e-detailrowcollapse");if(0!=i.length)for(t=0;tthis.model.columns.length&&this.getContentTable().children("colgroup").find("col:lt("+o+")").remove(),this.getContentTable().find("colgroup").first().replaceWith(this._getMetaColGroup()),r=null!=this.model.detailsTemplate||null!=this.model.childGrid?this.model.groupSettings.groupedColumns.length+1:this.model.groupSettings.groupedColumns.length,l=0;l",e.render[this._id+"_GroupingTemplate"](this.model.currentViewData,{groupedColumns:this.model.groupSettings.groupedColumns}),""].join(""),this.getContentTable().get(0).replaceChild(s.firstChild.firstChild,this.getContentTable().get(0).lastChild),this._hideCaptionSummaryColumn()),this._groupingAction(),this._gridRows=this.getContentTable().find(".e-recordtable").find("tbody").find("tr").not(".e-gridSummaryRows"),this._eventBindings()}},_ungroup:function(){var e,i,s,a;if(this._isGrouping=!1,t.isNullOrUndefined(this.model.detailsTemplate)||(this._detailsOuterWidth=null),e=this.element.children(".e-gridheader"),i=e.find(".e-filterbar").find("th").find("input"),e.find("div").first().empty().append(this._renderGridHeader().find("table")),this.setGridHeaderContent(e),this.model.allowFiltering&&"filterbar"==this.model.filterSettings.filterType)for(this._renderFiltering(),this._renderFilterBarTemplate(),s=this.element.children(".e-gridheader").find(".e-filterbar").find("th").find("input"),a=0;a0)for(s=0;s0)||!(s0&&s.element.find(".e-dragclone").remove(),a=e(t.sender.target).hasClass("e-headercell")?e(t.sender.target):e(t.sender.target).closest("th"),o=a.find(".e-headercelldiv"),i=s.getColumnByField(o.attr("ej-mappingname")),s._$curSElementTarget=o,s.model.allowSorting&&s.model.allowMultiSorting?(r=e(a).clone(),r.find(".e-number").remove(),n.text(r.text()).clone().width(a.outerWidth()+2).height(a.height()+2).css({"font-size":parseInt((a.height()+3)/2)}).addClass("e-dragclone").appendTo(s.element)):n.text(a.text()).clone().width(a.outerWidth()+2).height(a.height()+2).css({"font-size":parseInt((a.height()+3)/2)}).addClass("e-dragclone").appendTo(s.element)},dragStart:function(t){var a,n,o=t.target,r=e(o),l={target:o,draggableType:"headercell",column:i},d=!1;return s.model.groupSettings.showToggleButton&&(a=e.inArray(i.field,s.model.groupSettings.groupedColumns),n=r.find(".e-togglegroupbutton").hasClass("e-togglegroup"),(a!=-1&&n||a==-1&&!n)&&(d=!0)), null!=s._resizer&&s._resizer._expand||d||r.eq(0).hasClass("e-filtericon")?(e(".e-dragclone").remove(),!1):(s._dragActive=!0,s.model.allowGrouping&&s.expandGroupDropArea(),!s._trigger("columnDragStart",l)&&void 0)},drag:function(t){var a=e(t.target),n={target:a,draggableType:"headercell",column:i};return!s._trigger("columnDrag",n)&&((a.hasClass("e-headercelldiv")||a.hasClass("e-headercell"))&&s.model.allowReordering&&(document.body.style.cursor="",a.addClass("e-allowDrop"),s.getHeaderTable().find(".e-reorderindicate").removeClass("e-reorderindicate"),a.hasClass("e-headercell")&&!a.hasClass("e-stackedHeaderCell")?a.addClass("e-reorderindicate"):a.parent().addClass("e-reorderindicate")),void(a.hasClass("e-groupdroparea")||a.closest(".e-groupdroparea").length?(document.body.style.cursor="",a.addClass("e-allowDrop")):document.body.style.cursor="not-allowed"))},dragStop:function(t){if(!t.element.dropped){var a=e(t.target),n={target:a,draggableType:"headercell",column:i};s._trigger("columnDrop",n),s.element.find(".e-groupdroparea").removeClass("e-hover"),s.getHeaderTable().find(".e-columnheader").find(".e-headercellactive").removeClass("e-headercellactive").removeClass("e-active"),e(".e-dragclone").remove(),s._dragActive=!1,s.getHeaderTable().find(".e-reorderindicate").removeClass("e-reorderindicate"),s.model.allowGrouping&&s.collapseGroupDropArea(),document.body.style.cursor="",e(s._Indicator).css("display","none")}}})},_groupHeaderCelldrag:function(){var i,s=t.buildTag("div.e-cloneproperties e-grid","",{height:"20px","z-index":2}),a=this,n=this.element.children(".e-groupdroparea").find(".e-groupheadercell");n.ejDraggable({cursorAt:{top:-35,left:-2},helper:function(t){var i=e(t.sender.target).closest(".e-grid-icon");return s.text(e(t.sender.target).closest(".e-groupheadercell").text()).clone().width(i.width()+2).height(i.height()+2).addClass("e-dragclone").appendTo(a.element)},dragStart:function(e){var t,i=e.target;return e.model.cursorAt={top:-35,left:-2},t={target:i,draggableType:"groupheadercell"},!a._trigger("columnDragStart",t)&&void 0},drag:function(t){e(".Sibling").remove();var i=e(t.target),s={target:i,draggableType:"groupheadercell"};return!a._trigger("columnDrag",s)&&void(i.closest("div.e-gridcontent").length?(document.body.style.cursor="",i.addClass("e-allowDrop")):document.body.style.cursor="not-allowed")},dragStop:function(t){if(!t.element.dropped){var i=e(t.target),s={target:i,draggableType:"groupheadercell"};a._trigger("columnDrop",s),e(".e-dragclone").remove(),document.body.style.cursor=""}}}),i=this.element.children(".e-gridcontent, .e-gridheader"),i.ejDroppable({accept:a.element.children("div.e-groupdroparea").find(".e-groupheadercell"),drop:function(i,s){if(!t.isNullOrUndefined(s.helper)&&s.helper.is(":visible")&&s.draggable.hasClass("e-groupheadercell")){var n=e(s.draggable.context).find("div").attr("ej-mappingname");s.helper.remove(),t.isNullOrUndefined(n)||a.ungroupColumn(n)}}})},_rowsDragAndDrop:function(){var i,s;this.dragRowElement(),i=e(this.getRows()),i.length||(i=this.getContent().find("td.emptyrecord").closest("tr")),s=this,i.ejDroppable({accept:i,drop:function(i,a){var n,o,r,l,d,h,c=e(i.target).closest("tr");if(s._draggedGridID=a.helper.find("tr.e-srcgridinfo").children("td").text(),n=s._draggedGridID!=s._id?e("#"+s._draggedGridID).ejGrid("instance"):s,n._id!=s._id&&n.model.rowDropSettings.dropTargetID!="#"+s._id)return!1;var u=n.getSelectedRecords(),m=o=s.getIndexByRow(c);if(m==-1&&(m=o=0),m=m+s.model.pageSettings.currentPage*s.model.pageSettings.pageSize-s.model.pageSettings.pageSize,r={sourceID:n._id,destinationID:s._id,destinationRowIndex:m},l=s._dataSource()instanceof t.DataManager?s._dataSource().dataSource:s._dataSource(),t.isNullOrUndefined(l.headers)&&(l.headers=[]),l.headers.push({rowDropDetails:JSON.stringify(r)}),s._id!=n._id){var p=(s._dataManager,s._dataSource().adaptor,n.getBatchChanges());p.deleted=u,d={dropDetails:r,records:u,requestType:t.Grid.Actions.Refresh,targetIndex:m,action:"rowDragged"},s._processDropRequest(n,p,"drag",d),h=s.getBatchChanges(),h.added=u,d.action="rowDropped",s._processDropRequest(s,h,"drop",d)}else s._draggedGridID==s._id&&s.reorderRows(n.selectedRowsIndexes,o)}})},dragRowElement:function(){var i=this,s=e(this.getRows());s.ejDraggable({cursorAt:{top:-8,left:-8},helper:function(s){var a,n,o,r,l;return this.clone=!0,!i._selectDrag&&e.inArray(e(s.sender.target).closest("tr")[0].rowIndex,i.selectedRowsIndexes)!=-1&&(a=t.buildTag("div.e-cloneproperties e-draganddrop e-grid","",{height:"auto","z-index":2,position:"absolute",width:i.element.width()}),a.append(t.buildTag("table","",{width:i.element.width()})),o=e(i.getRows()).clone().removeClass(),r=0,n=e.map(o,function(t,s){if(e.inArray(s,i.selectedRowsIndexes)!=-1)return t}),l=t.buildTag("tr.e-srcgridinfo e-grid","",{display:"none",height:"auto"}).append(""+i._id+""),n.push(l[0]),e(n).find("td").removeClass("e-selectionbackground e-active"),a.find("table").append(n),e(s.sender.target).closest("td").hasClass("e-selectionbackground")||a.css("display","none"),a.addClass("e-dragclone").appendTo(i.element))},dragStart:function(t){if(i._selectDrag||e.inArray(e(t.target).closest("tr")[0].rowIndex,i.selectedRowsIndexes)==-1)return!1;var s=t.target,a=i.getRowByIndex(i.selectedRowsIndexes[0],i.selectedRowsIndexes[i.selectedRowsIndexes.length]),n=i.getSelectedRecords(),o={target:a,currentTarget:s,draggableType:"rows",data:n};return!i._trigger("rowDragStart",o)&&void 0},drag:function(t){var s,a=e(t.target),n=i.getRowByIndex(i.selectedRowsIndexes[0],i.selectedRowsIndexes[i.selectedRowsIndexes.length]),o=i.getSelectedRecords(),r={target:n,currentTarget:a,draggableType:"rows",data:o};return!i._trigger("rowDrag",r)&&(document.body.style.cursor="not-allowed",s=e(i.model.rowDropSettings.dropTargetID),void((a.closest(i.model.rowDropSettings.dropTargetID).length||a.closest("#"+i._id).length)&&(a.closest(".e-grid").length&&(a.closest(".e-rowcell").length||a.closest(".emptyrecord").length)?a.closest("table").addClass("e-allowRowDrop"):s.hasClass("e-grid")||s.addClass("e-allowRowDrop"))))},dragStop:function(t){var s,a;if(!t.element.dropped){var n=e(t.target),o=i.getRowByIndex(i.selectedRowsIndexes[0],i.selectedRowsIndexes[i.selectedRowsIndexes.length]),r=i.getSelectedRecords();if(e(".e-dragclone").remove(),document.body.style.cursor="",s=e(i.model.rowDropSettings.dropTargetID),s.hasClass("e-grid")?s.find(".e-gridcontent").find("table").removeClass("e-allowRowDrop"):s.removeClass("e-allowRowDrop"),i.getContent().find("table").removeClass("e-allowRowDrop"),a={rows:o,target:n,draggableType:"rows",data:r},i._trigger("rowDrop",a))return!1}}})},_processDropRequest:function(t,i,s,a){var n,o=t._dataManager.dataSource.batchUrl;t._dataManager.dataSource.batchUrl=t.model.rowDropSettings[s+"Mapper"],n=t._dataManager.saveChanges(i,t._primaryKeys[0],t.model.query._fromTable),e.isFunction(n.promise)&&null!=t._dataManager.dataSource.batchUrl?(e("#"+t._id).data("ejWaitingPopup").show(),n.done(function(){t._isLocalData&&"drop"==s&&(a.dropDetails.sourceID==a.dropDetails.destinationID?t._moveDroppedRowIndex(a.targetIndex,a.records,a.draggedRowIndexes):t._moveDroppedRowIndex(a.targetIndex,a.records)),t._dataManager.dataSource.batchUrl=o,t.refreshBatchEditChanges(),e("#"+t._id).data("ejWaitingPopup").hide(),t._processBindings(a)}),n.fail(function(i){t._dataManager.dataSource.batchUrl=o,e("#"+t._id).data("ejWaitingPopup").hide(),a.error=i&&i.error?i.error:i,t._trigger("actionFailure",a)})):(t.refreshBatchEditChanges(),t._dataManager.dataSource.batchUrl=o,"drop"==s&&t._moveDroppedRowIndex(a.targetIndex,a.records),a.dropDetails.sourceID==a.dropDetails.destinationID&&"drag"==s||t._processBindings(a))},reorderRows:function(e,i){var s,a,n;if(!this.model.sortSettings.sortedColumns.length)if(s=this.getSelectedRecords(),this.selectedRowsIndexes=[],a={requestType:t.Grid.Actions.Refresh,action:"rowReordering",draggedRowIndexes:e,targetIndex:i,dropDetails:{sourceID:this._id,destinationID:this._id,DestinationRowIndex:i},records:s},t.isNullOrUndefined(this.model.rowDropSettings.dropMapper)){if(this._trigger("actionBegin",a))return!1;this._moveDroppedRowIndex(i,s,e),this._trigger("actionComplete",a)}else n=this.getBatchChanges(),n.changed=s,this._processDropRequest(this,n,"drop",a)},_moveDroppedRowIndex:function(i,s,a){var n,o,r,l,d;if(t.isNullOrUndefined(a)){if(i>-1)for(r=this._dataSource()instanceof t.DataManager?this._dataSource().dataSource.json:this._dataSource(),l=i+this.model.pageSettings.currentPage*this.model.pageSettings.pageSize-this.model.pageSettings.pageSize,d=0;dc&&m++,this.model.allowPaging&&(h=this.model.pageSettings.currentPage*this.model.pageSettings.pageSize-this.model.pageSettings.pageSize),c=h+c,this.selectedRowsIndexes.push(u-m),d==a.length-1&&(this.model.selectedRowIndex=this.selectedRowsIndexes[0]),(null!=this.model.detailsTemplate||null!=this.model.childGrid)&&o.next().hasClass("e-detailrow")&&(o=o.add(o.next()[0])),g.before(o),us?s:i)),!this.multiSelectCtrlRequest&&this.model.scrollSettings.allowVirtualScrolling&&(this._virtuaOtherPage?this._virtualScrollingSelection=!0:(this.clearSelection(),this._virtualScrollingSelection=!1)),e.isArray(i)&&(n=i,i=n[0],this._virtaulSel=[],this.model.scrollSettings.allowVirtualScrolling&&!this.model.scrollSettings.enableVirtualization))for(this._virtualScrollingSelection=!0,this._virtualSelectedRows=n,o=parseInt(i/this.model.pageSettings.pageSize)*this.model.pageSettings.pageSize,g=(parseInt(i/this.model.pageSettings.pageSize)+1)*this.model.pageSettings.pageSize,this._virtaulSel.push(i),this._virtuaOtherPage||(this._virtaulUnSel=[]),p=1;p1?this._virtualRowCount:0;if(this.initialRender||L!=this._currentVirtualIndex&&!a?(this._isThumbScroll=!0,this._refreshVirtualView(L),i=0!=i?i%this._virtualRowCount+R:i):(i>3*this._virtualRowCount||a?(b=this._getSelectedViewData(i,a).viewIndex,u=i%this._virtualRowCount,D=b*this._virtualRowCount-(this._virtualRowCount-u)):i=i%this._virtualRowCount+R,i!=D||a||(i=0!=i?i%this._virtualRowCount+R:i)),n.length)for(p=0;p0&&e.inArray(l,this.virtualLoadedPages)==-1&&t.isNullOrUndefined(a))if(O--,this._virIndex=!0,this._virtualTrIndex=O,this.gotoPage(E+1),r=this,this._dataSource()instanceof t.DataManager){if(this._queryPromise.done(function(e){var t;r._virtuaOtherPage=!0,r._virtualdata=r._currentJsonData,r._pageTo=E,r._virtualScrollingSelection&&(r._virtualSelRecords=e.virtualSelectRecords);var s=parseInt(i/r.model.pageSettings.pageSize)*r.model.pageSettings.pageSize,a=(parseInt(i/r.model.pageSettings.pageSize)+1)*r.model.pageSettings.pageSize,o=[];for(o.push(i),t=1;t0)for(r._virtualSelRecords=[],p=0;p0?(i=e(document.getElementsByName(l)[O]).index(),T=this._virtualdata[O],this._virtualdata=[]):e(document.getElementsByName(E*M)).length>0&&!t.isNullOrUndefined(this._pageTo)&&(i=e(document.getElementsByName(E*M)[i%M]).index())}if(y={rowIndex:D,row:d.eq(i),data:T,target:a,prevRow:k,prevRowIndex:I},!this._trigger("rowSelecting",y)){if(d=e(this.getRows()),(this.model.editSettings.allowEditing||this.model.editSettings.allowAdding)&&this.model.isEdit&&this.model.enableAutoSaveOnSelectionChange&&(!(this.model.editSettings.showAddNewRow&&"normal"==this.model.editSettings.editMode)||0!=this.getContentTable().find(".e-editedrow").length)){if(this.endEdit())return;("externalform"==this.model.editSettings.editMode||"externalformtemplate"==this.model.editSettings.editMode)&&e("#"+this._id+"_externalEdit").css("display","none")}if(n.length>0){for(p=0;p1?Math.ceil((t+1)/this._virtualRowCount):1,r.viewIndex=a,this._virtualLoadedRecords[a]&&(r.data=this._virtualLoadedRecords[a][o]),n=t%this._virtualRowCount,r.rowIndex=a*this._virtualRowCount-(this._virtualRowCount-n),r},selectCells:function(s){var a,n,o,r,l,d,h,c,u,m,p,g,_,f,b,v;if(!this._allowcellSelection)return!1;if(a=null,r=this._excludeDetailRows(),a=this.model.scrollSettings.frozenColumns?this._frozenCell(s[0][0],s[0][1][0]):r.eq(s[0][0]).find(".e-rowcell:eq("+s[0][1]+")"),t.isNullOrUndefined(this._previousRowCellIndex)||0==this._previousRowCellIndex.length||(this.model.scrollSettings.enableVirtualization?(n=this._prevRowCell,o=this._preVirRowCellIndex):(n=e(this.getRowByIndex(this._previousRowCellIndex[0][0]).find(".e-rowcell:eq("+this._previousRowCellIndex[0][1]+")")),o=this._previousRowCellIndex)),l=this._currentJsonData[s[0][0]],d=s[0][0],this.model.scrollSettings.allowVirtualScrolling&&this.model.scrollSettings.enableVirtualization&&(h=this._getSelectedViewData(s[0][0],a),l=h.data,d=h.rowIndex),v={currentCell:a,cellIndex:s[0][1],data:l,previousRowCellIndex:o,previousRowCell:n},"multiple"==this.model.selectionType&&(v.isCtrlPressed=this.multiSelectCtrlRequest,v.isShiftPressed=this.multiSelectShiftRequest),!this._trigger("cellSelecting",v)){switch(this.model.selectionType){case t.Grid.SelectionType.Multiple:if(this.multiSelectCtrlRequest){b=e.inArray(d,this._rowIndexesColl),b!=-1?this.selectedRowCellIndexes[b].cellIndex.push(parseInt(s[0][1].toString())):(e.inArray(d,this._rowIndexesColl)==-1&&this._rowIndexesColl.push(d),this.selectedRowCellIndexes.push({rowIndex:d,cellIndex:s[0][1]})),a.addClass("e-cellselectionbackground e-activecell");break}if(this.multiSelectShiftRequest&&this._previousRowCellIndex!=i){this.clearCellSelection(),this.clearColumnSelection(),this.selectedRowCellIndexes=[];var x=this._previousRowCellIndex[0][0],w=parseInt(this._previousRowCellIndex[0][1]),y=s[0][0],C=parseInt(s[0][1]);if(this.model.scrollSettings.allowVirtualScrolling&&this.model.scrollSettings.enableVirtualization&&(x=this._preVirRowCellIndex[0][0],y=this._getSelectedViewData(y,this.getRowByIndex(y).find(".e-rowcell")).rowIndex),c=[],"box"==this.model.selectionSettings.cellSelectionMode){var S=(this.model.scrollSettings.frozenColumns?this.getRows()[0].length-1:this.getRows().length-1,wx)for(p=x;p<=y;p++){for(c=[],u=p==x?w:0,m=p==y?C:this.model.columns.length-1,_=u;_<=m;_++)c.push(_),this._selectMultipleCells(p,_,C,w);this.selectedRowCellIndexes.push({rowIndex:p,cellIndex:c}),this._rowIndexesColl.push(p)}else for(p=x;p>=y;p--){if(c=[],u=p==x?w:this.model.columns.length-1,m=p==y?C:0,u>m)for(_=u;_>=m;_--)c.push(_),this._selectMultipleCells(p,_,C,w);else for(_=m;_>=u;_--)c.push(_),this._selectMultipleCells(p,_,C,w);this.selectedRowCellIndexes.push({rowIndex:p,cellIndex:c}),this._rowIndexesColl.push(p)}break}for(this.clearCellSelection(),this._virtualRowCellSelIndex=[],p=0;p1)for(g=r.eq(s[p][0]).find(".e-rowcell"),this.model.scrollSettings.frozenColumns&&(g=e(r[0]).eq(s[p][0]).find(".e-rowcell").add(e(r[1]).eq(s[p][0]).find(".e-rowcell"))),_=0;_a?a:s,l=s>a?s+1:a+1,this.model.scrollSettings.frozenColumns)this._frozenColumnSelection(u,r,l);else for(d=r;d=-1&&(s=this.model.scrollSettings.frozenColumns?this._excludeDetailRows():e(this.element.find("tr[aria-selected='true']")),t.isNullOrUndefined(i)?(this.model.scrollSettings.frozenColumns>0&&(s=e(s[0]).add(s[1])),s.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"),a=this.getRowByIndex(i),this.model.scrollSettings.enableVirtualization&&this.multiSelectCtrlRequest&&e.inArray(i,this.selectedRowsIndexes)==-1&&(n=parseInt(a.attr("name"),32)*this._virtualRowCount,o=this._virtualRowCount-a.index()%this._virtualRowCount,i=n-o),i=e.inArray(i,this.selectedRowsIndexes),i!=-1&&this.selectedRowsIndexes.splice(i,1)),this.selectedRowsIndexes.length||this._selectedRow(-1)),!0},_excludeDetailRows:function(){return t.isNullOrUndefined(this.model.detailsTemplate||this.model.childGrid||this.model.showSummary)?e(this.getRows()):e(this.getRows()).not(".e-detailrow,.e-gridSummaryRows")},clearCellSelection:function(i,s){var a,n,o;if(this._allowcellSelection)if(a=this.model.scrollSettings.frozenColumns||!t.isNullOrUndefined(i)?this._excludeDetailRows():e(this.element.find(".e-cellselectionbackground")).parent(),t.isNullOrUndefined(i))this.model.scrollSettings.frozenColumns&&(a=e(a[0]).add(a[1])),a.find(".e-rowcell, .e-detailrowcollapse, .e-detailrowexpand").removeClass("e-cellselectionbackground").removeClass("e-activecell"),this.selectedRowCellIndexes=[],this._rowIndexesColl=[];else{for(o=0;o=this.model.scrollSettings.frozenColumns&&(n=1,currentIndex=i-this.model.scrollSettings.frozenColumns),o=0;o0?(t.push(this.getRowByIndex(this.selectedRowsIndexes[i])[0]),t.push(this.getRowByIndex(this.selectedRowsIndexes[i])[1])):t.push(this.getRowByIndex(this.selectedRowsIndexes[i])[0]);return t},getSelectedRecords:function(){var e,t=[];if(this._virtualScrollingSelection)return this._virtualSelRecords;for(e=0;e",e.render[this._id+"_GroupingTemplate"](this.model.currentViewData,{groupedColumns:this.model.groupSettings.groupedColumns}),""].join(""),this.getContentTable().get(0).replaceChild(t.firstChild.firstChild,this.getContentTable().get(0).lastChild),this.refreshContent()},getContentTable:function(){return this._gridContentTable},setGridContentTable:function(e){this._gridContentTable=e},getContent:function(){return this._gridContent},setGridContent:function(e){this._gridContent=e},getHeaderContent:function(){return this._gridHeaderContent},setGridHeaderContent:function(e){this._gridHeaderContent=e},getHeaderTable:function(){return this._gridHeaderTable},setGridHeaderTable:function(e){this._gridHeaderTable=e},getRows:function(){return this._gridRows},getFilteredRecords:function(){return this._filteredRecords},getRowByIndex:function(i,s){var a;try{var n=this.getRows(),o=this._excludeDetailRows(),r=e();if(e.isArray(i)){for(a=0;a0?(r.push(n[0][i[a]]),r.push(n[1][i[a]])):r.push(n[i[a]]);return r}return t.isNullOrUndefined(s)?this.model.scrollSettings.frozenColumns>0?(r.push(n[0][i]),r.push(n[1][i]),r):e(o.not(".e-virtualrow")[i]):this.model.scrollSettings.frozenColumns>0?(r.push(e(n[0]).slice(i,s)),r.push(e(n[1]).slice(i,s)),r):e(o.not(".e-virtualrow").slice(i,s))}catch(t){return e()}},getColumnIndexByField:function(e){for(var t=0,i=this.model.columns,s=i.length;t0?(i=e(s[0]).index(t),i==-1&&(i=e(s[1]).index(t)),i):a.not(".e-virtualrow").index(t)},getPrimaryKeyFieldNames:function(){if(0!=this._primaryKeys.length)return this._primaryKeys;for(var e=0,t=this.model.columns,i=t.length;e0),this.phoneMode=!!(this.model.isResponsive&&document.documentElement.clientWidth<360),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={}},_init:function(){this._trigger("load"),!t.isNullOrUndefined(this.model.query)&&this.model.query instanceof t.Query||(this.model.query=t.Query()),this._initPrivateProperties(),t.gridFeatures.common&&this._initScrolling(),this.model.enableResponsiveRow&&this.element.addClass("e-responsive"),this._checkForeignKeyBinding(),this._checkDataBinding()},_initComplexColumn:function(e,i,s){var a,n,o,r=s||i;for(a in e)"object"!=typeof e[a]||t.isNullOrUndefined(e[a])?(n=r.concat(".").concat(a),o=e[a],this.model.columns.push({field:n,type:null!=o?o.getDay?o.getHours()>0||o.getMinutes()>0||o.getSeconds()>0||o.getMilliseconds()>0?"datetime":"date":typeof o:null})):(r=r.concat(".").concat(a),this._initComplexColumn(e[a],a,r))},_initColumns:function(i){for(var a,n,o,r,l;i.items!=s;)i=i.items[0];if(0==this.model.columns.length&&i){for(a in i)i.hasOwnProperty(a)&&("object"!=typeof i[a]||i[a]instanceof Date||null==i[a])?(n=i[a],this.model.columns.push({field:a,type:null!=n?n.getDay?n.getHours()>0||n.getMinutes()>0||n.getSeconds()>0||n.getMilliseconds()>0?"datetime":"date":typeof n:null})):"object"==typeof i[a]&&this._initComplexColumn(i[a],a);this.model.columns.length&&this._renderAfterColumnInitialize()}else for(o=0;o0||r.getMinutes()>0||r.getSeconds()>0||r.getMilliseconds()>0?"datetime":"date":typeof r:null,r=l instanceof t.DataManager?this.model.columns[o].foreignKeyData[0][this.model.columns[o].foreignKeyValue]:l[0][this.model.columns[o].foreignKeyValue]),this.model.columns[o].type=null!=r?r.getDay?r.getHours()>0||r.getMinutes()>0||r.getSeconds()>0||r.getMilliseconds()>0?"datetime":"date":typeof r:null):"date"!=this.model.columns[o].type||this.model.columns[o].format!=s||1==this._isReorder||1==this.model.allowGrouping||this._showHideColumns?"datetime"!=this.model.columns[o].type||this.model.columns[o].format!=s||1==this._isReorder||1==this.model.allowGrouping||this._showHideColumns||(t.isNullOrUndefined(t.globalize)?e.extend(this.model.columns[o],{format:"{0:"+t.preferredCulture().calendars.standard.patterns.d+" "+t.preferredCulture().calendars.standard.patterns.t+"}"}):e.extend(this.model.columns[o],{format:"{0:M/d/yyyy h:mm tt}"})):t.isNullOrUndefined(t.globalize)?e.extend(this.model.columns[o],{format:"{0:"+t.preferredCulture().calendars.standard.patterns.d+"}"}):e.extend(this.model.columns[o],{format:"{0:M/d/yyyy}"})},_initSelection:function(){var e=this.model.selectionSettings.selectionMode;for(i=0;i-1};for(""!=a&&(m=t.DataManager(this.model.columns).executeLocal(t.Query().where("headerText",t.FilterOperators.startsWith,a,!0)),_=t.DataManager(this.model.columns).executeLocal(t.Query().where("field",t.FilterOperators.startsWith,a,!0)),_.forEach(function(t){""==t.headerText&&e.inArray(t,m)==-1&&m.push(t)})),m.forEach(function(e){if(e.showInColumnChooser&&!b(e.field)){var i=t.isNullOrUndefined(e.headerText)||""==e.headerText?""==e.field?null:e.field:e.headerText;p.push(i)}}),t.isNullOrUndefined(e("#nomatches")[0])||e("#nomatches").remove(),o=e("#"+this._id+"ccDiv").find("#"+this._id+"liScrollerDiv"),r=this._columnChooserList.find(".e-columnChooserListDiv"),i=0;i=1?i[t]+1:1;for(t in i)if(i[t]>1)return!0;return!1},_cancelButtonHandler:function(){e("#"+this._id+"ccDiv").ejDialog("close"),e(".e-columnChoosertailAlt").remove(),e(".e-columnChoosertail").remove()},_ccClickHandler:function(){var i,s,a=230,n=this.element.find(".e-ccButton");if(i=n.offset().left+n.width(),s=e("#"+this._id+"ccDiv").data("ejDialog"),s&&s.isOpened())s.close(),e(".e-columnChoosertail").remove(),e(".e-columnChoosertailAlt").remove();else{e("#"+this._id+"ccDiv").ejDialog({width:"230px",height:"309px",position:{X:this.model.enableRTL?i-a+143:i-a,Y:n.offset().top+35}}).ejDialog("open");var o=parseInt(e("#"+this._id+"ccDiv_wrapper").css("z-index")),r=t.buildTag("div #"+this._id+"_ccTail .e-columnChoosertail","",{display:"block",position:"absolute",left:this.model.enableRTL?i-78:i-29,top:n.offset().top+15}),l=t.buildTag("div #"+this._id+"_ccTailAlt .e-columnChoosertailAlt","",{display:"block","z-index":o+2,position:"absolute",left:this.model.enableRTL?i-78:i-29,top:n.offset().top+16});r.insertBefore(e("#"+this._id+"ccDiv_wrapper")),l.insertBefore(e("#"+this._id+"ccDiv_wrapper"))}this._refreshColumnChooserList(),this._ccVisibleColumns=this.getVisibleColumnNames(),this._ccHiddenColumns=this.getHiddenColumnNames(),e("#"+this._id+"liScrollerDiv").ejScroller({height:"228",width:"228",buttonSize:0}),e("#"+this._id+"liScrollerDiv").ejScroller("refresh"),"chrome"==this.getBrowserDetails().browser&&e(".e-columnChooser .e-hscrollbar").attr("style","height: 10px !important;"),e(".e-ejinputtext").bind("keyup",e.proxy(this._columnChooserSearch,this))},_refreshColumnChooserList:function(){for(var t,i=this._columnChooserList.find("input:checkbox.e-js").not(".e-selectall"),a=this._isDuplicate(e.merge(e.merge([],this._visibleColumns),this._hiddenColumns)),n=0,o=i.length;n0&&"excel"==this.model.filterSettings.filterType&&(this._fkParentTblData=i.result),this._gridRecordsCount=null!=this.model.pageSettings.totalRecordsCount&&0==this.model.filterSettings.filteredColumns.length?this.model.pageSettings.totalRecordsCount:0==i.count&&i.result.length?i.result.length:i.count,this.model.filterSettings.filteredColumns.length>0&&(this._filteredRecordsCount=i.count),null!=this.getPager()&&(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=[],a=0;a=0;C--)if(this.model.groupSettings.groupedColumns.indexOf(h[C].field)==-1){if(a.sortBy(h[C].field,h[C].direction),this.model.scrollSettings.allowVirtualScrolling&&this.model.scrollSettings.enableVirtualization&&e.inArray(h[C],this._prevVirtualSort)==-1){for(v=0;v2&&C>1&&"or"==p[C].predicate?u.predicates.push(t.Predicate(p[C].field,p[C].operator,p[C].value,p[C].ignoreCase||!p[C].matchcase)):u=u[p[C].predicate||"and"](p[C].field,p[C].operator,p[C].value,!p[C].matchcase);if(u&&a.where(u),this._isLocalData?(x=this._dataManager.executeLocal(a),this._filteredRecordsCount=b?x.result.length:x.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(a).result,this._$fkColumn&&this.model.filterSettings.filteredColumns.length>0&&"excel"==this.model.filterSettings.filterType&&(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(C=0;C0)&&(this.model.scrollSettings.allowVirtualScrolling&&this.model.scrollSettings.enableVirtualization&&(this._refreshViewPageDetails(),this._refreshVirtualViewDetails(!0)),this._filteredRecordsCount=null,this._filteredRecords=[]),this.model.summaryRows.length&&this._setSummaryAggregate(a),(this.model.allowPaging||this.model.scrollSettings.allowVirtualScrolling&&this.model.allowScrolling&&!this.model.scrollSettings.enableVirtualization)&&(this._isLocalData?(x=this._dataManager.executeLocal(a),this._recordsCount=x.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)):t.isNullOrUndefined(i)&&this._currentPage(1),0==this._currentPage()&&(0==this._prevPageNo||null==this._prevPageNo?this._currentPage(1):this._currentPage(this._prevPageNo)),a.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)&&("continuous"==this.model.scrollSettings.virtualScrollMode&&(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=null!==this._dataSource()?null==this.model.pageSettings.totalRecordsCount?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())),null!=this.model.virtualLoading&&(this._gridRecordsCount=this.model.pageSettings.totalRecordsCount),0==this.model.filterSettings.filteredColumns&&this._prevVirtualFilter.length&&(this._refreshVirtualViewData(),this._prevVirtualFilter=[]),this._isLocalData&&this.initialRender&&this._refreshVirtualViewDetails(),this._getVirtualLoadedRecords(a)),this.model.allowGrouping){for(y=a.clone(),this.model.allowPaging&&this.model.groupSettings.groupedColumns.length&&(y.queries=y.queries.slice(0,y.queries.length-1)),C=0;Cthis._virtualRowCount?(this._initCurrentIndex(i,s),this._needVPaging=!1):i.page(s,this.model.pageSettings.pageSize),this._isLocalData&&!this._virtualPageRecords[s]&&(n=this._dataManager.executeLocal(i),this.initialRender||(this.model.currentViewData=n.result),n.result.length?(this._setVirtualLoadedRecords(n.result,s),e.inArray(s,this._virtualLoadedPages)==-1&&this._virtualLoadedPages.push(s)):this.getContent().find(".e-virtualtop, .e-virtualbottom").remove())},_checkPrevNextViews:function(){var e,t,i=this._currentVirtualIndex,s=this._virtualLoadedRecords[i-1],a=this._virtualLoadedRecords[i+1],n=3==this._maxViews?1:2;1!=i&&i!=this._totalVirtualViews&&(s&&s.length==this._virtualRowCount?a&&a.length==this._virtualRowCount||this._totalVirtualViews==i-1||(t=i-n,this._currentVirtualIndex=this._virtualLoadedRecords[i]?t:t-1,e=this._scrollValue-n*this._virtualRowCount*this._vRowHeight):(t=i+n,this._currentVirtualIndex=this._virtualLoadedRecords[i]?t:t+1,e=this._scrollValue+n*this._virtualRowCount*this._vRowHeight),e&&(this._scrollValue=e,this._setVirtualLoadedIndexes(this._currentVirtualIndex),this.model.currentIndex=0==e?e:Math.floor(e/this._vRowHeight)))},_initCurrentIndex:function(e,t){var i,s,a,n,o,r=t*this.model.pageSettings.pageSize,l=this._currentVirtualIndex*this._virtualRowCount+this._virtualRowCount,d=this._currentVirtualIndex*this._virtualRowCount-2*this._virtualRowCount,h=l>r||dr?(i=(t-1)*this.model.pageSettings.pageSize,s=2*this.model.pageSettings.pageSize,this._isInitNextPage=!0):(dthis._getVirtualTotalRecord()?this._getVirtualTotalRecord():a.endIndex,a.startIndex=i,a.currentPage=this._currentPage(),a.result=null,this._trigger("virtualLoading",a),o=a.result,this._setInitialCurrentIndexRecords(o,t)):(e.skip(i).take(s),this._isLocalData&&(n=this._dataManager.executeLocal(e),o=n.result,this._isLastVirtualpage=!1,this._setInitialCurrentIndexRecords(o,t)))):(this._needVPaging=!1,this.model.virtualLoading&&this._isLocalData&&(0!=this.model.currentIndex||1!=t)?this._getVirtualOnLoadingData(t,!0):this._setVirtualPaging(e,t,!0))},_setInitialCurrentIndexRecords:function(e,t){for(i=0;i<2;i++){var s,a=i*this.model.pageSettings.pageSize,n=a+this.model.pageSettings.pageSize,o=e.slice(a,n);s=this._isInitNextPage?0==i?t:t+1:0==i?t-1:t,this._setVirtualLoadedRecords(o,s)}},_getVirtualOnLoadingData:function(e,t){var i,a;e>0&&(this.model.currentIndex>this._virtualRowCount&&(!t||this._needVPaging)&&this.model.currentIndexthis._gridRecordsCount?this._gridRecordsCount:e*this.model.pageSettings.pageSize,i.startIndex=e*this.model.pageSettings.pageSize-this.model.pageSettings.pageSize,i.currentPage=this._currentPage(),i.result=null,this._trigger("virtualLoading",i),a=i.result,this._setVirtualLoadedRecords(a,e)))},_setVirtualLoadedRecords:function(t,i){var s,a,n,o,r,l,d,h,c,u,m=this._virtualRowCount,p=this.model.pageSettings.pageSize,g=p/m,_=Math.ceil(i*p/m),f=i==this.model.pageSettings.totalPages;for(this._virtualPageRecords[i]||(this._virtualPageRecords[i]=t),f&&(a=this._getVirtualTotalRecord()%p,_=(!this._virtualLoadedRecords[this._totalVirtualViews]||this._virtualLoadedRecords[this._totalVirtualViews].length!=this._lastViewData)&&a0&&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&&e.extend(this.model.keyConfigs,this.model.keySettings),this.render(),this._setTextWrap(),"fixed"==this.model.columnLayout){var l=this.model.scrollSettings.frozenColumns>0?this.getHeaderTable().eq(0).width()+this.getHeaderTable().eq(1).width():this.getHeaderTable().width(),d=this.getHeaderContent().width()>l?"addClass":"removeClass",h=this.getHeaderTable(),c=this.getContentTable();this.model.scrollSettings.frozenColumns>0&&(h=this.getVisibleColumnNames().length<=this.model.scrollSettings.frozenColumns?this.getHeaderTable().eq(1):this.getHeaderTable().eq(0),c=this.getVisibleColumnNames().length<=this.model.scrollSettings.frozenColumns?this.getContentTable().eq(1):this.getContentTable().eq(0)),h[d]("e-tableLastCell"),c[d]("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;i1&&!t.isNullOrUndefined(this.model._groupingCollapsed[i].parent)&&(n=this.model._groupingCollapsed[i].parent,a=a.filter(function(){return e(this).parents(".e-tabletd").parent("tr").prev("tr").find(".e-recordplusexpand[ej-mappingvalue="+n+"]").length})),this.expandCollapse(a);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&&(o=this.model.parentDetails.parentID,r=e("#"+o).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&&("menu"==this.model.filterSettings.filterType||"excel"==this.model.filterSettings.filterType)&&(this._renderFilterDialogs(),this.model.enableResponsiveRow&&this._renderResponsiveFilter()),this.model.allowGrouping&&this.model.showSummary&&this._refreshGroupSummary()},_setTextWrap:function(){if(1==this.model.allowTextWrap)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")}},_getMetaColGroup:function(){for(var i,s=t.buildTag("colgroup"),a=0;a"),b.append(a)),_=0;_{{else}} {{/if}}"):n.html("{{if "+v[_].field+"}}"+this.localizedLabels.True+"{{else}}"+this.localizedLabels.False+"{{/if}}");break;default:v[_].disableHtmlEncode?n.html("{{html:"+y+"#data['"+x.join("'] || {})['")+"']}}"):n.html("{{:"+y+"#data['"+x.join("'] || {})['")+"']}}")}v[_].format==s||v[_].foreignKeyValue||n.html("{{:~_gridFormatting('"+v[_].format+"',"+y+"#data['"+x.join("'] || {})['")+"'],'"+this.model.locale+"')}}"),v[_].foreignKeyValue&&v[_].dataSource&&n.html("{{:~_foreignKey("+_+","+y+"#data['"+x.join("'] || {})['")+"'],'"+this._id+"')}}"),v[_].commands&&(h={},h["_"+this._id+"UnboundTemplate"]=this._unboundTemplateRendering,e.views.helpers(h),(t.isNullOrUndefined(v[_].field)||""==v[_].field)&&(this.model.columns[_].allowGrouping=this.model.columns[_].allowFiltering=this.model.columns[_].allowSorting=!1),t.isNullOrUndefined(v[_].headerText)||e("#"+this._id+v[_].headerText.replace(/[^a-z0-9|s_]/gi,"")+"_UnboundTemplate").remove(),divElement=this._createUnboundElement(v[_]),t.isNullOrUndefined(v[_].headerText)||n.addClass("e-unboundcell").addClass("e-"+v[_].headerText.replace(/[^a-z0-9|s_]/gi,"")+_).html("{{:~_"+this._id+"UnboundTemplate('"+divElement.id+"')}}"),this.model.scrollSettings.frozenColumns>0&&n.addClass("e-frozenunbound"),this._isUnboundColumn=!0)}else h={},r=v[_].headerText,h["_"+this._id+"ColumnTemplating"]=t.proxy(this._gridTemplate,null,this,o),e.views.helpers(h),t.isNullOrUndefined(r)||t.isNullOrUndefined(r.match(/[^0-9\s\w]/g))||(r=r.replace(/[^0-9\s\w]/g,"_")),e("#"+this._id+r+_+"_Template").remove(),l=this._createTemplateElement(v[_]),(""==v[_].field||t.isNullOrUndefined(v[_].field))&&(this.model.columns[_].allowGrouping=this.model.columns[_].allowFiltering=this.model.columns[_].allowSorting=!1), 0!=v[_].template&&n.addClass("e-templatecell").html("{{:~_"+this._id+"ColumnTemplating('"+l.id+"','"+_+"')}}");v[_].textAlign==s&&(v[_].textAlign="left"),v[_].isPrimaryKey===!0&&(this._primaryKeys.push(e.trim(v[_].field)),this._primaryKeys=e.unique(this._primaryKeys)),this.phoneMode||v[_].textAlign==s||(n.css("text-align",v[_].textAlign),e(c[_]).css("text-align",v[_].textAlign)),this.phoneMode||t.isNullOrUndefined(v[_].headerTextAlign)||e(c[_]).css("text-align",v[_].headerTextAlign),t.isNullOrUndefined(v[_].cssClass)||n.addClass(v[_].cssClass),t.isNullOrUndefined(v[_].priority)||n.addClass("e-table-priority-"+v[_].priority),t.isNullOrUndefined(v[_].customAttributes)||n.attr(v[_].customAttributes),n.attr("role","gridcell"),b.append(n),this.model.enableAltRow?(i["_"+this._id+"AlternateRow"]=this._alternateRow,e.views.helpers(i),b.addClass("{{:~_"+this._id+"AlternateRow()}}")):b.addClass("e-row"),b.attr("role","row"),this.model.scrollSettings.frozenColumns>0&&this.model.scrollSettings.frozenColumns==_+1&&(p.appendChild(f),u[this._id+"_JSONFrozenTemplate"]=g.html(),b.empty(),g.empty())}p.appendChild(f)}u[this._id+"_JSONTemplate"]=null!=this.model.rowTemplate?e(this.model.rowTemplate).html():g.html(),e.templates(u)},render:function(){this.model.showSummary=this.model.summaryRows.length>0||this.model.showSummary,this.model.showStackedHeader=this.model.stackedHeaderRows.length>0||this.model.showStackedHeader,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,a){var n,o,r,l,d,h,c,u,m,p,g,_,f=t.buildTag("tr.e-columnheader e-stackedHeaderRow"),b=[],v=[];for(tAl=[],tp=[],g=0;g0&&e.inArray(n.field,this.model.groupSettings.groupedColumns)!=-1)continue;var x="",w="",y="",C="",S=i.stackedHeaderColumns;for(m=0;m0){var T=[],D=0,I=0,k=0;for(u=0;u0;)p=l[I].sapnCount,l[I].sapnCountD?(l[I].sapnCount=l[I].sapnCount-D,a&&T.push({sapnCount:D,headerText:l[I].headerText})):(T.push(l[I]),a||l.splice(I,1)),D-=p;a&&(l=T)}for((this.model.detailsTemplate||this.model.childGrid)&&f.append(t.buildTag("th.e-headercell e-detailheadercell","
    ")),g=0;g")),g.append(this._getIndentCol())),this.model.showStackedHeader)for(h=0;h0?(e=t.buildTag("div.e-frozenheaderdiv",this._renderGridHeaderInternalDesign(this.model.columns.slice(0,this.model.scrollSettings.frozenColumns),!0)),i=t.buildTag("div.e-movableheader",t.buildTag("div.e-movableheaderdiv",this._renderGridHeaderInternalDesign(this.model.columns.slice(this.model.scrollSettings.frozenColumns),!1))),a.append(e).append(i)):a.append(this._renderGridHeaderInternalDesign(this.model.columns)),s.html(a),this.model.isResponsive&&s.addClass("e-textover"),this.setGridHeaderTable(this.getHeaderContent().find(".e-table")),s},_renderGridContent:function(){var i,s,a,n,o,r,l,d=t.buildTag("div.e-gridcontent"),h=t.buildTag("div"),c=t.buildTag("table.e-table","",{},{cellspacing:"0.25px"}),u=e(document.createElement("tbody"));if(c.append(this.getHeaderTable().find("colgroup").clone()).append(u),h.html(c),d.html(h),this.setGridContentTable(c),this.setGridContent(d),c.attr("role","grid"),i={},this.model.allowGrouping&&this.model.groupSettings.groupedColumns.length){if(this.initialRender&&(i.columnName=this.model.groupSettings.groupedColumns[this.model.groupSettings.groupedColumns.length-1],!this.model.groupSettings.showGroupedColumn))for(s=0;s1)for(o=this.getContentTable().find(".e-table").not(".e-recordtable").children("colgroup"),r=e(this.getContentTable().find(".e-recordtable")[0]).children("colgroup").find("col"),s=0;s0&&(o=e.map(n,function(e){return document.getElementById(e)})),e.each(o,function(i,s){var a,n,o,r,l=e(s).data("ejGrid");if(!t.isNullOrUndefined(l)&&(a=e.extend(!0,{},l.model),a=p._getModifyExportModel(a),l.ignoreOnExport)){for(n=0;n0&&(a=this.element.children(".e-gridheader"),a.find("div").first().empty().append(this._renderGridHeader().find("table"))),this.model.allowGrouping||(s=[]),("externalform"==this.model.editSettings.editMode||"externalformtemplate"==this.model.editSettings.editMode)&&e("#"+this._id+"_externalEdit").css("display","none"),0==s.length){var v,x=document.createElement("div"),w=-1,y=!1;if(this.phoneMode||this.getContentTable().find("colgroup").first().replaceWith(this._getMetaColGroup()),(null!=this.model.childGrid||null!=this.model.detailsTemplate)&&this.getContentTable().find("colgroup").first().prepend(this._getIndentCol()),n=this._currentPage(),("inlineform"==this.model.editSettings.editMode||"inlineformtemplate"==this.model.editSettings.editMode||"normal"==this.model.editSettings.editMode)&&("cancel"==i.requestType||"save"==i.requestType)&&(this._editFormHeight=this.element.find(".gridform").closest("tr").height()),this.model.scrollSettings.frozenColumns>0)x.innerHTML=this._renderByFrozenDesign();else{i.data&&(v=document.createElement("div"),v.innerHTML=["",e.render[this._id+"_JSONTemplate"](i.data),"
    "].join(""),this._dataSource()instanceof t.DataManager&&i.requestType==t.Grid.Actions.Save&&(w=this._getDataIndex(this.model.currentViewData,i.data),y=this._dataSource().adaptor instanceof t.remoteSaveAdaptor)),x.innerHTML=["",e.render[this._id+"_JSONTemplate"](this.model.currentViewData),"
    "].join("");var C=this.getContentTable().get(0),S=C.lastChild,T=this.getContentTable().first().find("tbody").first();if("save"!=i.requestType&&"cancel"!=i.requestType||"batch"==this.model.editSettings.editMode)"delete"==i.requestType?(this._isUnboundColumn&&($editedrow=this.element.find(".e-editedrow"),$oldChild=this.getContentTable().find(".e-editedrow").get(0),$newChild=$editedrow.length?x.firstChild.firstChild.firstChild:v.firstChild.firstChild.lastChild,0==$editedrow.length||"normal"!=this.model.editSettings.editMode&&"externalform"!=this.model.editSettings.editMode&&"externalformtemplate"!=this.model.editSettings.editMode?"inlineform"==this.model.editSettings.editMode||"inlineformtemplate"==this.model.editSettings.editMode?($oldChild=$editedrow.prev("tr").get(0),$editedrow.remove()):$oldChild=$editedrow.get(0):e($oldChild).replaceWith(e($newChild))),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?(g=x.firstChild.firstChild.rows.length,_=e(x.firstChild.firstChild.rows).slice(g-this.selectedRowsIndexes.length,g),e(S).append(_)):S.appendChild(x.firstChild.firstChild.lastChild):e(S).prepend(x.firstChild.firstChild.rows)),(null!=this.model.detailsTemplate||null!=this.model.childGrid)&&(f=this.getContentTable().find(".e-detailrow:visible"),e.each(f,function(e){0==f.eq(e).closest("tr").prev().children(".e-detailrowexpand").length&&f.eq(e).remove()})),this._gridRows=C.rows,this.model.enableAltRow&&this._refreshAltRow()):this.getContentTable().get(0).replaceChild(null!=this.model.rowTemplate?x.firstChild.lastChild:x.firstChild.firstChild,this.getContentTable().get(0).lastChild);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(),o=this._currentTrIndex,rowIndex==-1&&(rowIndex=o),null!=this.model.detailsTemplate||null!=this.model.childGrid)for(r=e("inlineform"==this.model.editSettings.editMode?e(S.childNodes).not(".e-detailrow")[rowIndex]:S.childNodes[rowIndex]),l=e(S.childNodes).not(".e-detailrow"),u=0;u0||!t.isNullOrUndefined(this._searchCount)?this.getContentTable().get(0).replaceChild(null!=this.model.rowTemplate?x.firstChild.lastChild:x.firstChild.firstChild,this.getContentTable().get(0).lastChild):S.replaceChild($newChild,$oldChild)):(d=e($newChild),p=e($oldChild),"add"==i.action&&"save"==i.requestType&&this.model.editSettings.showAddNewRow&&this.model.allowPaging&&this.model.pageSettings.pageSize<=this._currentJsonData.length&&("bottom"==this.model.editSettings.rowPosition?S.lastChild.previousSibling.remove():S.lastChild.remove()),"cancel"==i.requestType||this._dataSource()instanceof t.DataManager||1!=this._currentPage()||"save"==i.requestType&&!t.isNullOrUndefined(this._filteredRecordsCount)&&this._filteredRecordsCount==this._previousFilterCount?(t.isNullOrUndefined($oldChild)||(p.remove(),this._dataSource()instanceof t.DataManager&&w!=-1?0==w?S.insertBefore($newChild,S.children[w]):d.insertAfter(S.children[w-1]):this._dataSource()instanceof t.DataManager&&!y||1==this._currentPage()||"save"!=i.requestType||e(S).prepend(e(x.firstChild.firstChild.firstChild)),this.model.allowPaging&&this.model.pageSettings.pageSize<=this.model.currentViewData.length&&0==s.length&&(this._dataSource()instanceof t.DataManager&&w==-1&&!y&&"save"!=i.requestType||"save"!=i.requestType&&!(this._dataSource()instanceof t.DataManager))&&"cancel"==i.requestType&&!this.model.editSettings.showAddNewRow&&C.lastChild.appendChild(x.firstChild.firstChild.lastChild)),"cancel"==i.requestType&&this._selectedRow()!=-1&&this.clearSelection()):1==this.model.currentViewData.length?(e(S).empty(),S.appendChild($newChild)):this.model.sortSettings.sortedColumns.length&&"save"==i.requestType&&this._currentJsonData.length>0||!t.isNullOrUndefined(this._searchCount)?this.getContentTable().get(0).replaceChild(null!=this.model.rowTemplate?x.firstChild.lastChild:x.firstChild.firstChild,this.getContentTable().get(0).lastChild):"bottom"==this.model.editSettings.rowPosition?(T.prepend($oldChild),S.replaceChild($newChild,$oldChild)):S.replaceChild($newChild,$oldChild))}else if("dialog"==this.model.editSettings.editMode||"dialogtemplate"==this.model.editSettings.editMode||"externalform"==this.model.editSettings.editMode||"externalformtemplate"==this.model.editSettings.editMode){if("add"==i.action&&!this.element.find(".e-addedrow").length)break;if($editedTr=this.element.find(".e-editedrow"),"cancel"!=i.requestType&&($editedTr.length||t.isNullOrUndefined(this._filteredRecordsCount)||this._filteredRecordsCount!=this._previousFilterCount))if($editedTr.length){if($newChild=x.firstChild.firstChild.childNodes[rowIndex],$oldChild=this._excludeDetailRows(S.childNodes)[rowIndex],null!=this.model.allowCellMerging&&(p=e($oldChild),e($oldChild.childNodes).hasClass("e-merged")))for(h=p.children(".e-merged").index(),c=$oldChild.children[h].colSpan,u=0;u0||!t.isNullOrUndefined(this._searchCount)?this.getContentTable().get(0).replaceChild(null!=this.model.rowTemplate?x.firstChild.lastChild:x.firstChild.firstChild,this.getContentTable().get(0).lastChild):S.replaceChild($newChild,$oldChild)}else 1==this.model.currentViewData.length&&0==this.getContentTable().find("td.e-rowcell").length?($newChild=x.firstChild.firstChild.firstChild,e(S).empty(),S.appendChild($newChild)):(newChild=$editedTr.length||"cancel"==i.requestType?x.firstChild.firstChild.firstChild:v.firstChild.firstChild.lastChild,this._dataSource()instanceof t.DataManager?w!=-1&&(0==w?S.insertBefore(newChild,S.children[w]):e(newChild).insertAfter(S.children[w-1]),this.model.allowPaging&&(this.model.pageSettings.pageSize<=this.model.currentViewData.length||w==this.model.pageSettings.pageSize-1)&&S.removeChild(S.lastChild)):(this.model.sortSettings.sortedColumns.length&&"save"==i.requestType&&this._currentJsonData.length>0||!t.isNullOrUndefined(this._searchCount)?this.getContentTable().get(0).replaceChild(null!=this.model.rowTemplate?x.firstChild.lastChild:x.firstChild.firstChild,this.getContentTable().get(0).lastChild):1==this._currentPage()?this.getContentTable().find("tbody").first().prepend(e(newChild)):this.getContentTable().find("tbody").first().prepend(e(x.firstChild.firstChild.firstChild)),this.model.allowPaging&&this.model.pageSettings.pageSize<=this.model.currentViewData.length&&S.removeChild(S.lastChild)),null!=this.model.detailsTemplate&&e(C.lastChild.lastChild).children(".e-detailrowexpand").length&&S.removeChild(S.lastChild));else $newChild=x.firstChild.firstChild.childNodes[rowIndex],$oldChild=S.childNodes[rowIndex],d=e($newChild),p=e($oldChild),(null!=this.model.detailsTemplate||null!=this.model.childGrid)&&p.next(".e-detailrow:visible").length&&(m=d.find(".e-detailrowcollapse"),m.removeClass("e-detailrowcollapse").addClass("e-detailrowexpand").find("div").removeClass("e-gnextforward").addClass("e-gdiagonalnext")),p.replaceWith(d),this.clearSelection(),this.model.allowPaging&&this._refreshGridPager()}this._gridRows=C.rows,this.model.enableAltRow&&this._refreshAltRow()}}this._currentJsonData=this.model.currentViewData,this._gridRows=this.getContentTable().get(0).rows,this.model.scrollSettings.frozenColumns>0&&(this._gridRows=[this._gridRows,this.getContentTable().get(1).rows]),b={},("sorting"==i.requestType||"filtering"==i.requestType)&&this.model.scrollSettings.allowVirtualScrolling&&("filtering"==i.requestType&&(this.getContent().first().ejScroller("refresh").ejScroller("isVScroll")?this.element.find(".gridheader").addClass("e-scrollcss"):this.element.find(".gridheader").removeClass("e-scrollcss"),b=this._refreshVirtualPagerInfo()),this.model.scrollSettings.enableVirtualization?this._refreshVirtualView(this._currentVirtualIndex):this._refreshVirtualContent(n),"filtering"==i.requestType&&this.getContent().first().ejScroller("refresh")),this.model.allowPaging&&(this.model.filterSettings.filteredColumns.length?this.getPager().ejPager({totalRecordsCount:null==this._searchCount?this._filteredRecordsCount:this._searchCount,currentPage:this._currentPage()}):this.getPager().ejPager({totalRecordsCount:null==this._searchCount?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 this._newungroup(i);this._showGridLines(),this._completeAction(i)},_showGridLines:function(){var e=this.model.gridLines;"both"!=e&&this.getContent().addClass("none"!=e?"e-"+e+"lines":"e-hidelines")},_showHeaderGridLines:function(){var e=this.model.gridLines;"both"!=e&&this.getHeaderContent().addClass("none"!=e?"e-"+e+"lines":"e-hidelines")},_newungroup:function(e){"ungrouping"==e.requestType?this._ungroup(e):this.getContentTable().find("tbody").empty().first().append(this._getEmptyTbody())},setFormat:function(){for(var e,t,i=[],s=0;s0)for(s=0;s0)||e("#"+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&&null!==this.getHeaderTable()&&this._sortCompleteAction(i), this.model.allowPaging&&(a=this.getPager().ejPager("option"),this._currentPage(a.currentPage),delete a.currentPage,e.extend(this.model.pageSettings,a),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.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()),this.getFooterTable().find("colgroup").remove(),this.getFooterTable().append(this.getHeaderTable().find("colgroup").clone()),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),"virtualscroll"!=i.requestType&&this.clearColumnSelection()&&e(this.getHeaderTable().find("th.e-headercell")).removeClass("e-columnselection")),"batch"==this.model.editSettings.editMode&&this.refreshBatchEditMode(),(!this.initialRender&&(this.model.allowScrolling||this.model.isResponsive)&&(this._checkScrollActions(i.requestType)||this.model.editSettings.editMode.indexOf("inline")!=-1&&"beginedit"==i.requestType)||"continuous"==this.model.scrollSettings.virtualScrollMode&&"virtualscroll"==i.requestType)&&(this.model.isResponsive&&this.model.minWidth?this.windowonresize():this._refreshScroller(i)),"normal"==this.model.scrollSettings.virtualScrollMode&&"virtualscroll"==i.requestType&&this.getContent().find("div:first").scrollLeft(this.getScrollObject().scrollLeft()),null!=this._customPop&&"sorting"!=i.requestType&&this._customPop.hide(),!this.model.allowScrolling||this.initialRender||this.model.scrollSettings.enableVirtualization||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.textWrapSettings&&this._setTextWrap(),this._trigger("actionComplete",i),"refresh"!=i.requestType&&this._trigger("refresh"),this.model.editSettings.showAddNewRow&&"normal"==this.model.editSettings.editMode&&(this.initialRender||0!=this.getContentTable().find("tr.e-addedrow").length||0==this.element.find(".e-gridcontent").find("tr").length||this._startAdd(),"searching"==i.requestType&&this.element.find(".e-gridtoolbar").find("li#"+this._id+"_search input").focus()),(t.Grid.Actions.BeginEdit==i.requestType||t.Grid.Actions.Add==i.requestType)&&e.isFunction(e.validator)&&this.setValidation(),this.initialRender||(this.model._groupingCollapsed=[]),!this.initialRender&&"refresh"==i.requestType)for(n=0;n0?this._gridRows[0].length:this._gridRows.length,c=0,u=this.model.pageSettings.pageSize;if(t.gridFeatures.common&&this._refreshUnboundTemplate(this.getContentTable()),0!=this._gridRecordsCount&&(null!=this.model.queryCellInfo||null!=this.model.rowDataBound||null!=this.model.mergeCellInfo||null!=this.model.templateRefresh))for(s=0;s8&&u.first().css("width",3e3/p+"%")),t.isNullOrUndefined(this.model.detailsTemplate)||(a=this.model.groupSettings.groupedColumns.length,n=0!=this.model.groupSettings.groupedColumns.length?1:0,u.eq(n).css("width",this._detailsOuterWidth),m.eq(a).css("width",this._detailsOuterWidth)),this._detailColsRefresh(),u=this._$headerCols,m=this._$contentCols,c=0;cx?b:x)+parseInt(v.css("padding-left"),10),this.columnsWidthCollection[c]=f,_+=this.model.columns[c].visible?f:0}else _+=this.model.columns[c].visible?parseInt(this.model.columns[c].width,10):0;if(t.isNullOrUndefined(this.columnsWidthCollection[c])){if(this.model.allowScrolling){var w=(p/this.model.columns.length).toFixed(2),y=(p/(this.model.scrollSettings.buttonSize||18)/100).toFixed(2),C=w-y;u.eq(c).css("width",C+"px"),m.eq(c).css("width",C+"px"),this.model.columns[c].width=C,this.columnsWidthCollection[c]=parseFloat(C)}}else u.eq(c).width(this.columnsWidthCollection[c]),m.eq(c).width(this.columnsWidthCollection[c]),this.model.columns[c].priority&&m.eq(c).addClass("e-table-priority-"+this.model.columns[c].priority)}if("fixed"==this.model.columnLayout){this.model.scrollSettings&&0==this.model.scrollSettings.frozenColumns&&(this.getHeaderTable().width(_),this.getContentTable().width(_));var S=this.model.scrollSettings.frozenColumns>0?this.getHeaderTable().eq(0).width()+this.getHeaderTable().eq(1).width():this.getHeaderTable().width(),T=this.getHeaderContent().width()>S?"addClass":"removeClass",D=this.getHeaderTable(),I=this.getContentTable();this.model.scrollSettings.frozenColumns>0&&(D=this.getVisibleColumnNames().length<=this.model.scrollSettings.frozenColumns?this.getHeaderTable().eq(1):this.getHeaderTable().eq(0),I=this.getVisibleColumnNames().length<=this.model.scrollSettings.frozenColumns?this.getContentTable().eq(1):this.getContentTable().eq(0)),D[T]("e-tableLastCell"),I[T]("e-tableLastCell")}if(!this.model.allowScrolling&&this.model.allowResizeToFit&&_>p&&(this.model.allowScrolling=!0,this.model.scrollSettings.width=p,this.getHeaderTable().parent().addClass("e-headercontent"),!this.model.scrollSettings.frozenColumns>0&&this.getHeaderTable().width(p)),this.model.isEdit&&(l=u.clone(),this.model.editSettings.showAddNewRow&&(o=this.getContentTable().find(".e-editedrow")),$colGroup=this.model.scrollSettings.frozenColumns>0?this.getContent().find(".gridform").find("colgroup"):t.isNullOrUndefined(o)||1!=o.length?e("#"+this._id+"EditForm").find("colgroup"):o.find("colgroup"),this.model.scrollSettings.frozenColumns>0&&$colGroup.first().empty().append(l.splice(0,this.model.scrollSettings.frozenColumns)),$colGroup.last().empty().append(l),(null!=this.model.detailsTemplate||null!=this.model.childGrid)&&$colGroup.prepend(this._getIndentCol())),this.model.groupSettings.groupedColumns.length)for(r=this.getContentTable().find(".e-recordtable").children("colgroup"),c=0;c0){for(h=0,c=0;c0||this.model.scrollSettings.frozenRows>0)&&null==e("#"+this._id+"AlertDialog")&&this._renderAlertDialog(),(this.model.allowMultiSorting||"multiple"==this.model.selectionType)&&this._renderMultiTouchDialog(),this.model.scrollSettings.frozenColumns>0&&!this.model.allowScrolling)return this.getContent().remove(),this.getHeaderTable().eq(1).remove(),this._alertDialog.find(".e-content").text(this.localizedLabels.FrozenColumnsScrollAlert),void this._alertDialog.ejDialog("open");if(this.model.scrollSettings.allowVirtualScrolling&&!this.model.scrollSettings.enableVirtualization&&this._createPagerStatusBar(),this._getRowHeights(),0!=this.element.width())this.model.allowScrolling&&this._renderScroller();else if(this.model.allowScrolling&&0==this.element.width()){var i=this,s=setInterval(function(){0==i.element.width()||t.isNullOrUndefined(i.element.width())||(i._renderScroller(),i._endRendering(),clearInterval(s))},100);return}this._endRendering()},_endRendering:function(){var e,i;this.model.allowScrolling&&(e=this.getScrollObject()),i=this.model.enableRTL?"e-summaryscroll e-rtl":"e-summaryscroll",this.model.allowScrolling&&this.model.showSummary&&e._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&&(1!=this._currentPage()||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.selectRows(this._selectedRow())),!this.model.allowFiltering||"filterbar"!=this.model.filterSettings.filterType||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&&0!=this.model.groupSettings.groupedColumns.length&&this._recalculateIndentWidth(),this.initialRender&&(!this.model.scrollSettings.enableVirtualization||this._gridRows.length0&&(this._responsiveScrollWidth=this.model.scrollSettings.width),"string"!=typeof this.model.scrollSettings.height&&this.model.scrollSettings.height>0&&(this._responsiveScrollHiehgt=this.model.scrollSettings.height),this.model.minWidth&&this.model.isResponsive){if(this._$onresize=e.proxy(this.windowonresize,this),e(window).bind("resize",this._$onresize),e.isFunction(window.matchMedia)){var t=window.matchMedia("(max-width: 768px)");this._mediaStatus=t.matches}this.windowonresize()}},_getNoncontentHeight:function(){var e=this.getHeaderContent().outerHeight();return this.model.toolbarSettings.showToolbar&&(e+=this.element.find(".e-gridtoolbar").outerHeight()),this.model.allowPaging&&(e+=this.element.find(".e-pager").outerHeight()),this.model.allowGrouping&&this.model.groupSettings.showDropArea&&(e+=this.element.find(".e-groupdroparea").outerHeight()),e},setDimension:function(e,t){var i=e-this._getNoncontentHeight();this.model.scrollSettings.height=i,this.model.scrollSettings.width=t,this._renderScroller()},_mediaQueryUpdate:function(e,i,s,a){var n,o,r,l;return window.innerWidth<=320&&this.model.enableResponsiveRow?(n=this.getContentTable()[0].style,n.removeAttribute?n.removeAttribute("min-width"):n.removeProperty("min-width"),o=this.getContent().data("ejScroller"),void(o&&this.getContent().ejScroller("destroy"))):void(e?(this.model.scrollSettings.width=t.isNullOrUndefined(this._responsiveScrollWidth)?s:Math.min(this._responsiveScrollWidth,s),l=Math.min(a,i)-this._getNoncontentHeight(),l=t.isNullOrUndefined(this._responsiveScrollHiehgt)?l:Math.min(this._responsiveScrollHiehgt,l),l-=parseInt(this.element.parent().css("margin-bottom"))+1,this.model.minWidth>s&&i>a&&(l+=this.model.scrollSettings.buttonSize),t.isNullOrUndefined(this.getRows())&&(l="auto"),this.model.scrollSettings.height=l,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,s)),r=Math.min(a,i),l=r-this._getNoncontentHeight(),t.isNullOrUndefined(this._responsiveScrollHiehgt)||(l=Math.min(this._responsiveScrollHiehgt,a)),l-=parseInt(this.element.parent().css("margin-bottom")),t.isNullOrUndefined(this.getRows())&&(l="auto"),this.model.scrollSettings.height=l,this.element.find(".e-gridheader").first().find("div").first().addClass("e-headercontent"),this._renderScroller()))},windowonresize:function(){var i,s;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 a=e(window).height()-this.element.offset().top,n=(t.isNullOrUndefined(this.getRows())?1:this.getRows().length,this.element.parent().is(e("body"))||this.element.parent().height()==e("body").height()),o=this.getContentTable()[0].scrollHeight+this._getNoncontentHeight(),r=n?a:this.element.parent().height();o+=parseInt(this.element.parent().css("margin-top")),s=this.model.minWidth>i||r<=o,this._mediaQueryUpdate(s,r,i,o)},_removeMedia:function(){e(window).unbind("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 e,t=this.getRows();if(null!==t)if(this._rowHeightCollection=[],t[1]!==s&&t[1].length&&(this.model.scrollSettings.frozenColumns>0&&t[0]!==s||t[0]!==s&&"undefined"!=typeof t[0].item&&"number"==typeof t[0].length&&"undefined"!=typeof t[1].item&&"number"==typeof t[1].length))for(frotrs=t[0],movtrs=t[1],e=0;e=movtrs[e].offsetTop?frotrs[e].offsetTop:movtrs[e].offsetTop;else for(e=0;e 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",e.proxy(this._touchGrid,this)):this.element.addClass("e-touch"),this._on(this.element,"mousedown",".e-gridheader",this._headerMouseDown),this.model.allowRowDragAndDrop&&"multiple"==this.model.selectionType&&this._on(this.element,"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?"e":this.element[0].accessKey,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||"multiple"==this.model.selectionType||this.model.allowFiltering)&&this._on(e(document),"mousedown",this._docClickHandler),this.model.allowFiltering){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(t){var i=this.getBrowserDetails(),s=e(t.target);null!=this._customPop&&0==this.element.find(t.target).length&&this._customPop.hide(),this.model.allowFiltering&&("menu"==this.model.filterSettings.filterType||"excel"==this.model.filterSettings.filterType?this._$colType&&(e(t.target).find(".e-grid.e-dlgcontainer").length>1||e(t.target).find(".e-excelfilter").length>1)&&("msie"==i.browser?"BODY"!=t.target.tagName&&(this.isExcelFilter?this._excelFilter.closeXFDialog(t):this._closeFilterDlg()):this._isExcelFilter?this._excelFilter.closeXFDialog(t):this._closeFilterDlg()):s.hasClass("e-filtertext")||s.hasClass("e-cancel")||this.getFilterBar().find(".e-cancel").addClass("e-hide"))},_mouseClickHandler:function(i){var a,n,o,r,l,d,h,c,u,m,p,g,_,f,b,v,x,w,y,C,S,T,D,I,k=e(i.target);if((this.model.isResponsive||this.model.enableResponsiveRow||0==k.closest(".e-grid").length||k.closest(".e-grid").attr("id")===this._id)&&"col-resize"!=this.getHeaderTable().find(".e-columnheader").not(".e-stackedHeaderRow").css("cursor"))if(a=e(i.target).is(".e-ascending, .e-descending")?e(i.target.parentNode):k.hasClass("e-groupheadercell")?k.children("div"):e(i.target),this._$fDlgIsOpen&&this.model.allowFiltering&&("menu"==this.model.filterSettings.filterType||this._isExcelFilter)&&(e.fx.off=!0,this._closeFDialog(),e.fx.off=!1),this.getHeaderTable().find(".e-columnheader").find(".e-headercellactive").removeClass("e-headercellactive").removeClass("e-active"),a.hasClass("e-headercelldiv")||!a.hasClass("e-togglegroupbutton")&&a.closest(".e-headercelldiv").length&&e.inArray(a[0].tagName,["SELECT","INPUT","TEXTAREA"])==-1||a.closest(".e-groupheadercell").length&&e(i.target).is(".e-ascending, .e-descending")){if(!this.model.allowSorting||t.gridFeatures.sort===s)return;a=a.hasClass("e-headercelldiv")||a.closest(".e-groupheadercell").length?a:a.closest(".e-headercelldiv"),l=a.attr("ej-mappingname"),n=t.sortOrder.Ascending,this._$prevSElementTarget=this._$curSElementTarget,this._$curSElementTarget=a,n=a.find("span").hasClass("e-ascending")?t.sortOrder.Descending:t.sortOrder.Ascending,"touch"==i.pointerType&&null!=this._customPop&&!this._customPop.is(":visible")&&this._customPop.find(".e-sortdirect").hasClass("e-spanclicked")&&this._customPop.show(),"touch"==i.pointerType&&null!=this._customPop&&(this._customPop.find(".e-rowselect").is(":visible")||!this._customPop.find(".e-sortdirect").hasClass("e-spanclicked"))&&this.model.allowMultiSorting&&(o=a.offset(),this._customPop.removeAttr("style"),this._customPop.offset({left:o.left,top:o.top-this.getHeaderTable().find(".e-columnheader").height()}).find(".e-sortdirect").show().end().find(".e-rowselect").hide().end().show()),this.model.allowMultiSorting&&(i.ctrlKey||this._enableSortMultiTouch)&&(this.multiSortRequest=!0),i.shiftKey&&e.inArray(l,this.model.groupSettings.groupedColumns)==-1&&(this._removeSortedColumnFromCollection(l),this.multiSortRequest=!0,l=null,this.sortColumn(l,n)),t.isNullOrUndefined(l)||this.sortColumn(l,n)}else if(a.hasClass("e-togglegroupbutton")&&this.model.allowGrouping)r=a.parent().attr("ej-mappingname"),a.hasClass("e-togglegroup")&&this.groupColumn(r),a.hasClass("e-toggleungroup")&&this.ungroupColumn(r);else if((a.hasClass("e-filtericon")||a.hasClass("e-filteredicon")||a.hasClass("e-responsivefilterColDiv")||a.parent().hasClass("e-responsivefilterColDiv"))&&(l=a.parent().find(".e-headercelldiv").attr("ej-mappingname")||a.attr("ej-mappingname")||e(a.parent()).attr("ej-mappingname"),this._$prevFieldName=this._$curFieldName,currentColumn=this.getColumnByField(l),d={True:this.localizedLabels.True,False:this.localizedLabels.False},this.model.allowFiltering)){if(h=this,e.each(this.model.columns,function(e,t){t.field==l&&(h._$colType=t.type,h._$curFieldName=t.field,h._$colFormat=t.format,h._$filterType=t.filterType,h._$colForeignKeyField=t.foreignKeyField?t.foreignKeyField:t.field,h._$colForeignKeyValue=t.foreignKeyValue,h._$colDropdownData=t.dataSource)}),("menu"==this.model.filterSettings.filterType&&"excel"!=this._$filterType||"excel"==this.model.filterSettings.filterType&&"menu"==this._$filterType)&&(c="#"+this._id+"_"+this._$colType+"Dlg",this._$menuDlgIsOpen=!0,"string"==this._$colType?this._$colForeignKeyValue&&this._$colDropdownData?e("#"+this._id+"_acString").ejAutocomplete({fields:{text:h._$colForeignKeyValue,key:h._$colForeignKeyField},dataSource:h._$colDropdownData}):e("#"+this._id+"_acString").ejAutocomplete({fields:{text:h._$curFieldName,key:this._getIdField()},dataSource:this._dataSource()}):"date"==this._$colType?this._$colFormat!=s?(this._$colFormat=this._$colFormat.replace("{0:","").replace("}",""),e(c).find(".e-datewidget .e-datepicker").ejDatePicker({dateFormat:this._$colFormat.replace("{0:","").replace("}","")})):e(c).find(".e-datewidget .e-datepicker").ejDatePicker({dateFormat:"MM/dd/yyyy"}):"datetime"==this._$colType&&(this._$colFormat!=s&&(this._$colFormat=this._$colFormat.replace("{0:","").replace("}",""),e(c).find(".e-datetimewidget input").ejDateTimePicker({dateFormat:this._$colFormat.replace("{0:","").replace("}","")})),this._setFilterFieldValues(c))),this._mediaStatus=document.documentElement.clientWidth<768,this.model.isResponsive&&this._mediaStatus){var P=this,L=t.buildTag("div.e-resFilterDialogHeaderDiv"),R=t.buildTag("div.labelRes","Filter");e(".e-filterMenuBtn").length>0&&e(".e-filterMenuBtn").remove();var M=t.buildTag("div.e-filterMenuBtn"),O=t.buildTag("input.e-resposnsiveFilterBtnLeft"),E=t.buildTag("input.e-resposnsiveFilterBtnRight");if(L.append(R),L.css("width","100%"),u=e(c).css("padding-left","0px"),a.parent().hasClass("e-responsivefilterColDiv")&&a.hasClass("e-filternone"))h._fltrClrHandler(),a.remove(),e("#responsiveFilter").css("display","block");else if(this.element.css("display","none"),setTimeout(function(){e("#responsiveFilter").css("display","none")}),this._isExcelFilter||"excel"==this._$filterType){if(this._excelDlg=c="#"+this._id+this._$colType+"_excelDlg",t.isNullOrUndefined(u.find(".e-resFilterDialogHeaderDiv")[0])){O.ejButton({text:"OK",type:"button",click:function(){P._excelFilter._openedFltr=e(P._excelDlg),P._excelFilter._fltrBtnHandler(),P._setResponsiveFilterIcon(),P.element.css("display","block")}}),E.ejButton({text:"Cancel",type:"button",click:function(){e(c).css("display","none"),h.element.css("display","block")}}),e(c).children().not(".e-searchcontainer").remove();var A=this._excelFilter,_=t.buildTag("div.e-resFilterleftIcon","",{},{closeDialogue:c.slice(1),openDialogue:"responsiveFilter"}),f=t.buildTag("span.e-icon e-resIcon e-responisveBack","",{},{closeDialogue:c.slice(1),openDialogue:"responsiveFilter"});_.click(function(t){e.proxy(P._closeDivIcon(t),this)}),L.append(_.append(f)),w=t.buildTag("div.e-resFIlterRigthIcon","",{},{closeDialogue:c.slice(1),gridEle:!0}),y=t.buildTag("span.e-icon e-resIcon e-responisveCustomFilter","",{},{closeDialogue:c.slice(1),gridEle:!0}),w.click(function(t){e.proxy(P._closeDivIcon(t),this)}),"boolean"!=h._$colType&&L.append(w.append(y)),e(c).css("padding","0px"),C=e(c).css("height",e(window).height()-2),C.css("width",e(window).width()-2),D=C.find(".e-searchcontainer .e-searchbox").css("margin-top","10px"),D.children().css("margin-top","10px");var j=C.find(".e-checkboxlist"),N=.97*e(window).width(),z=.65*e(window).height();e(C.find(".e-searchcontainer")).addClass("e-resSearch"),S=C.find(".e-resSearch .e-btncontainer").remove(),S.find("input:first").css("width","45.6%"),S.find("input:first").addClass("e-resposnsiveFilterBtnLeft"),S.find("input:last").addClass("e-resposnsiveFilterBtnRight"),C.find(".e-excelLabel").remove(),T=t.buildTag("div.e-excelLabel","Order Id",{"font-weight":"bold","margin-top":"10px"}),D=C.find(".e-searchcontainer"),T.insertAfter(C.find(".e-searchcontainer .e-searchbox")),C.prepend(L),e(c).append(M.append(O).append(E)),j.ejScroller({height:z,width:N}).ejScroller("refresh")}this._excelFilter.openXFDialog({field:l,enableResponsiveRow:!0,displayName:currentColumn.headerText,dataSource:this._dataSource(),position:{X:H,Y:V},dimension:{height:e(window).height(),width:e(window).width()},cssClass:"resFilter",type:this._$colType,format:this._$colFormat,localizedStrings:d}),e(c).insertAfter(this.element),t.isNullOrUndefined(e(c).parents(".e-grid")[0])||e(c).remove(),w.click(function(){var i,s,a,n,o,r,l,d,u,m,p,g,_,f,b,v,x,w;e(P._excelDlg).css("display","none"),i=e(window).height()-5,s=e(window).width(),A._openCustomFilter("equal"),a=c=e("#"+P._id+P._$colType+"_CustomFDlg").addClass("e-responsviesExcelFilter"),t.isNullOrUndefined(a.find(".e-resFilterDialogHeaderDiv")[0])&&(n=t.buildTag("div.e-resFilterDialogHeaderDiv"),o=t.buildTag("div.labelRes","Custom Filter"),n.append(o),r=t.buildTag("div.e-resFilterleftIcon","",{},{closeDialogue:P._id+P._$colType+"_CustomFDlg",openDialogue:P._excelDlg.slice(1)}),l=t.buildTag("span.e-icon e-resIcon e-responisveBack","",{},{closeDialogue:P._id+P._$colType+"_CustomFDlg",openDialogue:P._excelDlg.slice(1)}),r.click(function(){a.css("display","none"),P.model.enableResponsiveRow?e("#responsiveFilter").css("display","block"):P.element.css("display","block")}),n.append(r.append(l)),d=t.buildTag("div.e-resFIlterRigthIcon","",{},{closeDialogue:P._id+P._$colType+"_CustomFDlg",gridEle:!0}),u=t.buildTag("span.e-icon e-resIcon e-responisveClose","",{},{closeDialogue:P._id+P._$colType+"_CustomFDlg",gridEle:!0}),n.append(d.append(u)),d.click(function(){a.css("display","none"),P.element.css("display","block")}),a.prepend(n),a.insertAfter(P.element),a.find(".e-dlgfields").css("width","100%"),m=a.find(".e-dlgfields:first").css("width","92%").css("margin-left","6%"),m.css("margin-top","4%"),p=a.find(".e-dlgfields").find(".e-fieldset legend").text(),g=t.buildTag("div.e-responsiveLabelDiv",p,{"margin-left":"6%"}),g.insertAfter(m),_=a.find(".e-dlgfields").find(".e-fieldset").find("table").css("width","61%"),a.find(".e-dlgfields").find(".e-fieldset").replaceWith(_),f=_.parent("div").addClass("e-responsiveExcelFilterFieldDiv"),b=_.find(".e-dropdownlist"),_.find(".e-dropdownlist").each(function(t,i){var s=e(i).ejDropDownList("model.dataSource"),a=.4*e(window).width();e(i).ejDropDownList("destroy").ejDropDownList({width:a,popupWidth:a+"px",dataSource:s})}),_.find(".e-autocomplete").each(function(t,i){ var s=e(i).ejAutocomplete("model.dataSource"),a=.4*e(window).width();e(i).ejAutocomplete("destroy").ejAutocomplete({width:a,dataSource:s.dataSource,fields:s.fields})}),_.find(".e-datepicker").each(function(t,i){var s=(e(i).ejDatePicker("model.dataSource"),.4*e(window).width());e(i).ejDatePicker("destroy").ejDatePicker({width:s})}),v=O.clone(),x=E.clone(),v.ejButton({text:"OK",type:"button",click:function(){P._excelFilter._openedFltr=a,P._excelFilter._fltrBtnHandler(),a.hasClass("e-dlgcustom")&&a.ejDialog("close"),P._setResponsiveFilterIcon(),P.element.css("display","block")}}),x.ejButton({text:"Cancel",type:"button",click:function(){a.ejDialog("close"),h.element.css("display","block")}}),a.append(M.clone().append(v).append(x)),w=a.find(".e-dlgfields .e-btncontainer").remove(),w.find("input:first").addClass("e-resposnsiveFilterBtnLeft"),w.find("input:first").css("width","45.6%"),w.find("input:last").addClass("e-resposnsiveFilterBtnRight")),P.element.css("display","none"),a.ejDialog({enableModal:!1,height:i,width:s,position:{X:0,Y:0},enableResize:!1,showHeader:!1}).ejDialog("open")}),I=t.buildTag("div")}else m=this.model.enableResponsiveRow?"OK":"Filter",p=this.model.enableResponsiveRow?"Cancel":"Clear",O.ejButton({text:m,type:"button",click:e.proxy(this._fltrBtnHandler,this)}),E.ejButton({text:p,type:"button",click:function(){"Clear"==p&&(h.element.css("display","block"),h._fltrClrHandler()),e(c).css("display","none"),E.hasClass("e-resposnsiveFilterBtnRight")&&h.element.css("display","block")}}),a.parent().hasClass("e-responsivefilterColDiv")&&a.hasClass("e-filternone")?(h._fltrClrHandler(),a.remove()):(u.addClass("e-resMenuFltr"),u.css("height",e(window).height()-1).css("width",e(window).width()-2),u.find(".e-operator").addClass("e-resFilterOperator"),u.find(".e-value").addClass("e-resFilterOperator"),g=u.find(".e-dlgBtns").remove().addClass("e-filterMenuBtn"),u.append(M.append(O).append(E)),t.isNullOrUndefined(u.find(".e-resFilterDialogHeaderDiv")[0])&&(u.insertAfter(this.element),_=t.buildTag("div.e-resFilterleftIcon","",{},{closeDialogue:c.slice(1),openDialogue:"responsiveFilter"}),f=t.buildTag("span.e-icon e-resIcon e-responisveBack","",{},{closeDialogue:c.slice(1),openDialogue:"responsiveFilter"}),_.click(function(){u.css("display","none"),P.model.enableResponsiveRow?e("#responsiveFilter").css("display","block"):P.element.css("display","block")}),L.append(_.append(f)),w=t.buildTag("div.e-resFIlterRigthIcon","",{},{closeDialogue:c.slice(1),gridEle:!0}),y=t.buildTag("span.e-icon e-resIcon e-responisveClose","",{},{closeDialogue:c.slice(1),gridEle:!0}),w.click(function(){u.css("display","none"),P.element.css("display","block")}),b=e(u.find(".e-value").find("input:last")),"string"==h._$colType&&(v=e(u.find(".e-value").find("input:last")).ejAutocomplete("model"),b.ejAutocomplete("destroy").ejAutocomplete({enableDistinct:!0,dataSource:v.dataSource,fields:v.fields,width:v.width,focusIn:function(){var e=this.element.closest(".e-filterDialoge").find(".e-dropdownlist");this.model.filterType=e.val()}})),L.append(w.append(y)),u.prepend(L)),u.find(".e-responsiveLabelDiv").remove(),x=t.buildTag("div.e-responsiveLabelDiv","",{"margin-left":"5%","font-size":"17px","margin-top":"5%"}).append(t.buildTag("span",this.getHeaderTextByFieldName(l),{"font-weight":"bold"})),x.insertAfter(u.find(".e-resFilterDialogHeaderDiv")),u.fadeIn(100,"easeOutQuad",function(){}))}else{e(c).ejDialog({position:{X:"",Y:""}});var F=e(document).width(),B=document.documentElement.clientWidth<800?200:250,H=a.position().left+18,V=a.position().top+2,U="e-filterdialoglarge";B=this._isExcelFilter?this._excelFilter._dialogContainer.width():B,a.offset().left+18+B>F&&(H-=B),200==B&&(U=""),t.isNullOrUndefined(this._$colType)||("menu"==this.model.filterSettings.filterType&&"excel"!=this._$filterType||"excel"==this.model.filterSettings.filterType&&"menu"==this._$filterType?e(c).ejDialog({position:{X:H,Y:V},width:B,cssClass:U}).ejDialog("open"):this._excelFilter.openXFDialog({field:l,displayName:currentColumn.headerText,dataSource:this._dataSource(),position:{X:H,Y:V},type:this._$colType,format:currentColumn.format,foreignKey:currentColumn.foreignKeyField,foreignKeyType:currentColumn.originalType,foreignKeyValue:currentColumn.foreignKeyValue,foreignDataSource:currentColumn.dataSource,localizedStrings:d}))}this._setFilterFieldValues(c),"number"==this._$colType&¤tColumn.serverType!=s?e(c).find(".e-numerictextbox").ejNumericTextbox({width:"100%",decimalPlaces:0}):"number"==this._$colType&&e(c).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 s,a,n,o,r,l,d,h,c,u,m,p,g,_=e(i.target),f=e("[id$='ccDiv'].e-grid.e-columnChooser"),b=e("#"+this._id+"EditForm");if(f.length)for(r=!0,l=0;l0)return;"batch"==this.model.editSettings.editMode&&this.element.focus(),a=_.closest("tr").hasClass("e-insertedrow")?this.model.groupSettings.groupedColumns.length:0,h=_.closest(".e-rowcell").index()!=-1?_.closest(".e-rowcell").index():_.closest(".e-headercell").index()-this.model.groupSettings.groupedColumns.length,n=_.hasClass("e-rowcell")?_.index()-a:h-a,n=null!=this.model.detailsTemplate||null!=this.model.childGrid?n-1:n,this.model.scrollSettings.frozenColumns&&(_.closest(".e-movableheaderdiv").length||_.closest(".e-movablecontentdiv").length)&&(n+=this.model.scrollSettings.frozenColumns),o=this.getIndexByRow(_.closest("tr")),this._bulkEditCellDetails.columnIndex=n,this._bulkEditCellDetails.rowIndex=o,this.model.allowSelection&&t.gridFeatures.selection&&("multiple"==this.model.selectionType&&((i.ctrlKey||this._enableSelectMultiTouch)&&(this.multiSelectCtrlRequest=!0),i.shiftKey&&(this.multiSelectShiftRequest=!0,this._allowcellSelection&&o>-1&&this.selectCells([[o,[n]]]),this._allowrowSelection&&o>-1&&this.selectRows(this._previousIndex,this.getIndexByRow(_.closest("tr")),_),this._selectedRow(this.getIndexByRow(_.closest("tr"))),this._allowcolumnSelection&&_.hasClass("e-headercell")&&!_.hasClass("e-stackedHeaderCell")&&i.clientY-_.offset().top<_.height()/4&&this.selectColumns(this._previousColumnIndex,n)),"touch"==i.pointerType&&null!=this._customPop&&!this._customPop.is(":visible")&&this._customPop.find(".e-rowselect").hasClass("e-spanclicked")&&"row"==this.model.selectionSettings.selectionMode&&this._customPop.show(),"touch"==i.pointerType&&null!=this._customPop&&(this._customPop.find(".e-sortdirect").is(":visible")||!this._customPop.find(".e-rowselect").hasClass("e-spanclicked"))&&"multiple"==this.model.selectionType&&(this._customPop.removeAttr("style"),c=_.offset(),this._customPop.offset({top:0,left:0}).offset({left:c.left,top:c.top-this.getRowHeight()}).find(".e-sortdirect").hide().end().find(".e-rowselect").show().end().show())),this.multiSelectShiftRequest||(this._allowcellSelection&&o>-1&&(u=this._checkCellSelectionByRow(o,n),(this.model.selectionSettings.enableToggle&&1==this.selectedRowCellIndexes.length&&1==this.selectedRowCellIndexes[0].cellIndex.length||i.ctrlKey&&"multiple"==this.model.selectionType)&&u!=-1&&this.selectedRowCellIndexes.length>0&&this.selectedRowCellIndexes[0].cellIndex.length>0?this.clearCellSelection(u.rowIndex,n):this.selectCells([[o,[n]]])),this._allowrowSelection&&o>-1&&(m=this.getIndexByRow(_.closest("tr")),this.model.scrollSettings.enableVirtualization&&(p=o%this._virtualRowCount,g=parseInt(e(_).closest("tr").attr("name"),32),m=g*this._virtualRowCount-(this._virtualRowCount-p)),this.model.selectionSettings.enableToggle&&1==this.getSelectedRecords().length&&e.inArray(this.getIndexByRow(_.closest("tr")),this.selectedRowsIndexes)!=-1?this.clearSelection(m):this.selectRows(this.getIndexByRow(_.closest("tr")),null,_)),this._allowcolumnSelection&&_.hasClass("e-headercell")&&!_.hasClass("e-stackedHeaderCell")&&i.clientY-_.offset().top<_.height()/4&&(this.model.selectionSettings.enableToggle&&1==this.selectedColumnIndexes.length&&e.inArray(n,this.selectedColumnIndexes)!=-1?this.clearColumnSelection(n):this.selectColumns(n)),this.multiSelectCtrlRequest=!1),this.multiSelectShiftRequest=!1),s=this.model.columns[this._bulkEditCellDetails.columnIndex].field,_.closest(".e-rowcell").length&&s&&(this._tabKey=!1,this.model.editSettings.allowEditing&&this.model.editSettings.editMode==t.Grid.EditMode.Batch&&this.editCell(e.inArray(_.closest("tr").get(0),this.getRows()),s))}(_.hasClass("e-rowselect")||_.hasClass("e-sortdirect"))&&(_.hasClass("e-spanclicked")?(_.removeClass("e-spanclicked"),_.hasClass("e-rowselect")&&(this._enableSelectMultiTouch=!1),_.hasClass("e-sortdirect")&&(this._enableSortMultiTouch=!1),this._customPop.hide()):(_.addClass("e-spanclicked"),_.hasClass("e-rowselect")&&(this._enableSelectMultiTouch=!0),_.hasClass("e-sortdirect")&&(this._enableSortMultiTouch=!0))),t.gridFeatures.common&&this.expandCollapse(_),_.is(".e-filtericon")&&0!=_.closest(".e-detailrow").length&&i.preventDefault(),this._$fDlgIsOpen&&this.model.allowFiltering&&("menu"==this.model.filterSettings.filterType||this._isExcelFilter)&&!_.is(".e-filtericon")&&1!=_.closest(".e-dlgcontainer").length&&this._closeFDialog(),this.model.allowSearching&&null!=this._searchBar&&(_.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 s=0;s=o.left+document.documentElement.scrollLeft+n.offsetWidth-5||r<=o.left+3)&&r=o.left&&l<=o.top+document.documentElement.scrollTop+t.target.offsetHeight?(a=r>o.left+3?e(t.target).find(".e-headercelldiv"):e(t.target).prevAll("th:visible:first").find(".e-headercelldiv"),(this.gridInstance.model.enableRTL&&r>=o.left+10||r>=this.gridInstance.element.find(".e-headercell").not(".e-detailheadercell").offset().left+10-window.pageXOffset)&&((this.gridInstance.model.showStackedHeader||a.length)&&e.inArray(e(a).attr("ej-mappingname"),this.gridInstance._disabledResizingColumns)==-1?(this.gridInstance.model.showStackedHeader&&e(i.parents("thead")).find("tr").css("cursor","col-resize"),this.gridInstance.model.showStackedHeader||i.parent().css("cursor","col-resize"),this._currentCell=e(t.target).hasClass("e-stackedHeaderCell")?this.gridInstance.getHeaderContent().find(".e-headercell:visible").index(n):this.gridInstance.getHeaderContent().find(".e-headercell:visible").not(".e-stackedHeaderCell").index(n),this._allowStart=!0):(i.parent().css("cursor","pointer"),this._currentCell=-1))):(this.gridInstance.model.scrollSettings.frozenColumns?this.gridInstance.element.find(".e-columnheader").css("cursor","pointer"):i.parent().css("cursor","pointer"),this._currentCell=-1)}},_start:function(t,i){var s,a,n,o,r,l,d=this.gridInstance.getHeaderTable().find(".e-columnheader");if(a=e(this._target).hasClass("e-stackedHeaderCell")?d.find(".e-headercell").not(".e-hide"):d.find(".e-headercell").not(".e-stackedHeaderCell,.e-hide"),this._currentCell!=-1&&this._currentCell0){var h=this.gridInstance.getHeaderTable().find("tr.e-columnheader"),c=(h.length,e(this._target).parent("tr")[0].rowIndex);for(l=0;l0?this.gridInstance.getHeaderTable().find("thead"):e(this._target).parents("thead"),this._currentCell!=-1&&this._expand){this._expand=!1;var c=e(this._target).hasClass("e-stackedHeaderCell")?s.find(".e-headercell:not(.e-detailheadercell)").filter(":visible"):s.find(".e-headercell:not(.e-detailheadercell,.e-stackedHeaderCell)").filter(":visible"),u=c[this._currentCell],m=u.offsetWidth,p=t-this._orgX;if(parseInt(p)+parseInt(m)>this._colMinWidth){if(0!=p&&s.css("cursor","default"),this._resizeColumnUsingDiff(m,p),i=this.gridInstance.element.find(".e-gridcontent").first(),a=i.find("div").hasClass("e-content"),n=this.gridInstance.getBrowserDetails(),"msie"==n.browser&&this.gridInstance.model.allowScrolling&&(o=this.gridInstance.getContentTable().width(),r=this.gridInstance._calculateWidth(),this.gridInstance.model.scrollSettings&&this.gridInstance.model.scrollSettings.frozenColumns>0?(this.gridInstance.getHeaderTable().last().width(r-this.gridInstance.getHeaderContent().find(".e-frozenheaderdiv").width()),this.gridInstance.getContentTable().last().width(r-this.gridInstance.getContent().find(".e-frozencontentdiv").width()),this.gridInstance.model.showSummary&&this.gridInstance.getFooterTable().last().width(r-this.gridInstance.getFooterContent().find(".e-frozenfootertdiv").width())):r>o&&(this.gridInstance.getHeaderTable().width(r),this.gridInstance.getContentTable().width(r),this.gridInstance.model.showSummary&&this.gridInstance.getFooterTable().width(r)),parseInt(n.version,10)>8&&this.gridInstance.model.groupSettings&&this.gridInstance.model.groupSettings.groupedColumns.length&&(r>o?(this.gridInstance.getContentTable().width(r),this.gridInstance.getContentTable().children("colgroup").find("col").first().css("width",2e3/i.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()/i.find("table").first().width()*100).toFixed(2)+"%"))),this.gridInstance.getHeaderTable().parent().scrollLeft(i.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(),"msie"==n.browser||!this.gridInstance.model.allowScrolling||0!=this.gridInstance.model.scrollSettings.frozenColumns||(this.gridInstance.getHeaderTable().width("100%"),this.gridInstance.getContentTable().width("100%"),l=this.gridInstance._calculateWidth(),(l<=this.gridInstance.getContentTable().width()||this.gridInstance.getHeaderTable().width()>this.gridInstance.getContentTable().width())&&(this.gridInstance.getHeaderTable().width(l),this.gridInstance.getContentTable().width(l))),this.gridInstance.model.allowResizing&&"default"==this.gridInstance.getHeaderTable().find(".e-columnheader").css("cursor")){var g=this._currentCell,_=e(this._target),f=[],b=[],v=m+p,x={};if(this.gridInstance.model.showStackedHeader&&_.hasClass("e-stackedHeaderCell")){var w=_.parent(".e-stackedHeaderRow").index(),y=_.parent(".e-stackedHeaderRow").children()[this._cellIndex].cellIndex,C=this.gridInstance.model.stackedHeaderRows[w].stackedHeaderColumns[y].column,S=C;for(C instanceof Array||(S=C.split(",")),d=0;d0),!a&&i.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 e=this.gridInstance.getHeaderTable().find("colgroup").find("col").slice(0,this.gridInstance.model.scrollSettings?this.gridInstance.model.scrollSettings.frozenColumns:0),t=0,i=0;i0&&0!=s){if(r=0&&this._currentCellthis.gridInstance.element.find(".e-headercontent").first().width())return;T=o.filter(this._diaplayFinder).eq(this._currentCell)}else T=o.filter(this._diaplayFinder).eq(this.gridInstance.model.allowGrouping&&t.isNullOrUndefined(this.gridInstance.model.detailsTemplate||this.gridInstance.model.childGrid)?this._currentCell+this.gridInstance.model.groupSettings.groupedColumns.length:this._currentCell);if(this.gridInstance.model.showSummary&&(this._$footerCols=this.gridInstance.getFooterTable().find("colgroup").find("col"),l=this.gridInstance.model.columns.length,this._$footerCols.length>l&&this._$footerCols.splice(0,this._$footerCols.length-l),$footerCols=this._$footerCols,D=$footerCols.filter(this._diaplayFinder).eq(this._currentCell),D.outerWidth(r)),e(this._target).parent("tr").hasClass("e-stackedHeaderRow")?this._resizeStackedHeaderColumn(e(this._target).parent("tr"),a,this._currntCe):I.outerWidth(r),e(this._target).parent("tr").hasClass("e-stackedHeaderRow")){if(this.gridInstance.model.groupSettings.groupedColumns.length)for(d=this.gridInstance.getContentTable().find(".e-recordtable"),h=d.find("colgroup"),_=0;_l&&f.splice(0,f.length-l),e(f[c]).width(r)}T.outerWidth(r),this.gridInstance.model.isEdit&&(b=this.gridInstance.getContentTable().find(".e-editedrow,.e-addedrow"),v=b.find("table").find("colgroup col"),x=b.hasClass("e-addedrow")&&this.gridInstance.model.groupSettings.groupedColumns.length?this._currentCell+this.gridInstance.model.groupSettings.groupedColumns.length-1:this._currentCell,w=v.filter(this._diaplayFinder).eq(x), w.outerWidth(r))}if(this.gridInstance._findColumnsWidth(),this.gridInstance.model.scrollSettings&&this.gridInstance.model.scrollSettings.frozenColumns){for(y=this.gridInstance.getContentTable().find("colgroup").find("col").slice(0,this.gridInstance.model.scrollSettings.frozenColumns),C=0,_=0;_c;)g--,a=e(p).children("th").not(".e-detailheadercell")[g],h+=parseInt(e(a).attr("colspan"));for(this._currentCell=h,n=h+parseInt(m),o=h;o=0&&(t.isNullOrUndefined(a)||(this.gridInstance.model.columns[a].width=this.gridInstance.columnsWidthCollection[a]))}},_getResizableCell:function(){var t,i,s,a,n;for(t=e(this._target).hasClass("e-stackedHeaderCell")?this.gridInstance.getHeaderTable().find(".e-columnheader"):this.gridInstance.getHeaderTable().find(".e-columnheader").not(".e-stackedHeaderRow"),i=t.find(".e-headercell").not(".e-hide,.e-detailheadercell"),s=navigator.userAgent.indexOf("WebKit")!=-1?document.body.scrollLeft:document.documentElement.scrollLeft,a=0;athis._orgX&&e(i[a]).height()+point.top>=this._orgY)return void(this._currentCell=a-1);if(a==i.length-1||this.gridInstance.model.showStackedHeader&&e(this._target).get(0)===i[a])return void(this._currentCell=a)}},_moveVisual:function(e){var t=this.gridInstance.getHeaderContent().find("div").first()[0].getBoundingClientRect();t.left+document.documentElement.scrollLeft+t.widthx;)tHeadIndex--,a=e(tr).children("th")[tHeadIndex],v+=parseInt(e(a).attr("colspan"));n=v+parseInt(currentSpan)}else v=C,n=C+1;var k=0,P=0,L=0,R=[],M=[];if(v!=-1)for(o=f.slice(0,v+1).filter(".e-hide").length,r={columnIndex:v+o,column:this.gridInstance.model.columns[v+o],target:b,oldWidth:l},this.gridInstance._trigger("resizeStart",r),g=v;gL?P:L,k+=parseInt($cellDiv.css("padding-left"),10),l=this.gridInstance.getHeaderTable().find("col").filter(this._diaplayFinder).eq(g+x).width(),k=l>k?k:this._colMinWidth0||this.gridInstance.model.groupSettings.groupedColumns.length&&this.gridInstance.model.isEdit)&&(p=g+o,this.gridInstance.columnsWidthCollection[p]=k,this.gridInstance.setWidthToColumns(),this.gridInstance.model.scrollSettings.frozenColumns<=p+1&&(this.gridInstance.getHeaderContent().find(".e-movableheader").css("margin-left",k),this.gridInstance.getContent().find(".e-movablecontent").css("margin-left",k)));for(this.gridInstance._colgroupRefresh(),r={columnIndex:T,column:R,target:S,oldWidth:I,newWidth:D,extra:M},this.gridInstance._trigger("resizeEnd",r),g=0;g0&&this.gridInstance._summaryColRrefresh(),this.gridInstance._findColumnsWidth()}}},_getContentWidth:function(i){var s,a,n=0,o=t.buildTag("span",{},{}),r=this.gridInstance;return t.isNullOrUndefined(r._gridRows)||(a=r._gridRows,this.gridInstance.model.scrollSettings.frozenColumns&&i>=this.gridInstance.model.scrollSettings.frozenColumns&&(a=a[1],i-=this.gridInstance.model.scrollSettings.frozenColumns),e.each(a,function(t,a){if(e(a).is(".e-row,.e-alt_row")){var l=e(a).find("td.e-rowcell").eq(i),d=e(l).html();r.model.columns[i].commands?o.html(e(d).children()):l.hasClass("e-validError")?o.html(e(d).attr("value")):o.html(d),e(l).html(o),s=l.find("span:first").width(),s>n&&(n=s),e(l).html(d)}})),r._refreshUnboundTemplate(this.gridInstance.getContentTable()),n},_getHeaderContentWidth:function(e){var i=0,s=t.buildTag("span",{},{}),a=e.html();return s.html(a),e.html(s),i=e.find("span:first").width(),(this.gridInstance.model.allowFiltering&&"menu"==this.gridInstance.model.filterSettings.filterType||"excel"==this.gridInstance.model.filterSettings.filterType)&&(i=i+e.parent().find(".e-filtericon").width()+10),e.html(a),i}}}(jQuery,Syncfusion),function(e,t){t.scheduleFeatures=t.scheduleFeatures||{};var s=function(){return this._horiDateHeader="{{if multiRes == true}}
    {{:label}}
    {{else}}{{/if}}
    {{if view !== 'month'}}{{/if}}{{if view == 'month'}}{{for cols}}{{/for}}{{for cols}}{{/for}}{{/if}}
    {{if view === 'day'}}{{else}}
    {{/if}} {{for cols ~headercellWidth = headercellWidth}}{{/for}}
    {{:currentDay}}
    {{for timeTdCount ~columnvalue =column }}{{for ~name=time ~dayend=timecellclass ~index=#getIndex() }}{{for ~columnvalue[~index] ~width = timeCellWidth}}{{/for}}{{/for}}{{/for}}
    {{:~name.slice(0,2)}}
    {{:~name.slice(3,5)}}
    {{:currentDate}}
    {{:currentDay}}
    ",this._horiDateHeader},a=function(){return this._userTimeCellsHoriTemplate="{{if multiRes == true}}
    {{:label}}
    {{else}}{{/if}}
    {{if view !== 'month'}}{{/if}}{{if view == 'month'}}{{for cols}}{{/for}}{{for cols}}{{/for}}{{/if}}
    {{if view === 'day'}}{{else}}
    {{/if}} {{for cols ~headercellWidth = headercellWidth}}{{/for}}
    {{:currentDay}}
    {{for timeTdCount ~userTemplateId = userTemplateId ~template=template ~columnvalue =column}}{{for ~name=time ~names=times ~dayend=timecellclass }}{{for ~columnvalue ~width = timeCellWidth ~names=~names}}{{/for}}{{/for}}{{/for}}
    {{:~name}}
    {{if ~template ==true || ~userTemplateId==true }}{{:~names[#getIndex()]}}{{else}}
    {{/if}}
    {{:currentDate}}
    {{:currentDay}}
    ",this._userTimeCellsHoriTemplate},n=function(){return this._horizontalResHeader="
    {{for trs}}{{for ~resname=name ~marginleft=marginleft }}{{if classname == 'e-parentnode'}}{{else}}{{/if}}{{/for}}{{/for}}
    {{if classname == 'e-parentnode'}}
    {{/if}}
    {{if userResTemplId == true}}{{:userResHeader}}{{else}}{{:~resname}}{{/if}}
    ",this._horizontalResHeader},o=function(){return this._cellsTemplate="{{for cellrows ~cols=cols ~hourdiff=hourdiff ~view=view ~classname=classname ~tdWidth=tdWidth ~columnvalue=column ~userTemp=userTemplate ~userHtml=userHtml}}{{if classname == 'e-parentnode'}} {{for ~cols ~tdWidth=tdWidth ~value=#getIndex()}}{{if #index % ~hourdiff == 0 && #index != 0 && ~view !== 'month' }}{{if ~view !== 'month' ~val=#index}}{{for ~columnvalue[#getIndex()] ~width = cellWidth}}{{/for}}{{/if}}{{/for}}{{else}}{{for ~cols ~tdWidth=tdWidth ~value=#getIndex()}}{{if #index % ~hourdiff == 0 && #index != 0 && ~view !== 'month' }}{{if ~view !== 'month' ~val=#index}}{{for ~columnvalue[#getIndex()] ~width = cellWidth}}{{/for}}{{/if}}{{/for}}{{/if}}{{/for}}
    {{else}}{{/if}}
    {{if ~userTemp == true}}{{if ~view !== 'month'}}{{:~userHtml[~value][0][#getIndex()]}}{{else}}{{:~userHtml[~value][#getIndex()]}}{{/if}}{{/if}}
    {{if ~userTemp == true}}{{:~userHtml[~value][1][~val][#getIndex()]}}{{/if}}
    {{else}}{{/if}}
    {{if ~userTemp == true}}{{if ~view !== 'month'}}{{:~userHtml[~value][0][#getIndex()]}}{{else}}{{:~userHtml[~value][#getIndex()]}}{{/if}}{{/if}}
    {{if ~userTemp == true}}{{:~userHtml[~value][1][~val][#getIndex()]}}{{/if}}
    ",this._cellsTemplate};t.scheduleFeatures.horizontal={_renderHorizontalTemplates:function(){this.horizontalHeader=e.templates(this._createTemplate(s(),"_HorizontalHeader")),this.cellTemplate=e.templates(this._createTemplate(o(),"_HorizontalCells")),this.horizontalResHeader=e.templates(this._createTemplate(n(),"_HorizontalResources")),this.userTimeCellHoriTemplate=e.templates(this._createTemplate(a(),"_userTimeCells"))},_horizontalViewNavigation:function(i){var s,a,n,o,r,l,d,h,c;if("click"==i.type){if("week"===this.currentView()||"workweek"===this.currentView()||"customview"===this.currentView()&&this._renderDays<=7){if(this.element.find(".e-headercells").children().removeClass("e-activeview"),s=i.currentTarget.cellIndex,a=new Date(this._dateRender[s]),!(this.model.minDate<=a&&this.model.maxDate>=a))return!1;this.model.timeScale.enable&&e(i.currentTarget).children().addClass("e-activeview"),this.currentDate(a),1!=this.model.highlightBusinessHours||t.isNullOrUndefined(this.model.businessStartHour)?(n=this.element.find(".e-workcells")[parseInt(s*(this.model.endHour-this.model.startHour)*this.model.timeScale.minorSlotCount*(60/this.model.timeScale.majorSlot))].offsetLeft,this.element.find(".e-hscroll").length>0&&(this.model.enableRTL?(o=this.element.find(".e-workcells")[0].offsetLeft,r=o-n,e("div#"+this._id+"_scroller").ejScroller({scrollLeft:r}),l=o+this.element.find(".e-workcells").width()-this.element.find(".e-draggableworkarea").width(),r=r>=l?l:r,e(this.element.find(".e-horizontaltimecells").find("table tr")[2]).css("left",r+"px")):(e(this.element.find(".e-horizontaltimecells").find("table tr")[2]).css("left",-n+"px"),e("div#"+this._id+"_scroller").ejScroller({scrollLeft:n})))):this._businessHourScroller()}else if("month"==this.currentView()||this._isCustomMonthView()){if(s=i.currentTarget.cellIndex,this.model.views.indexOf("day")==-1)return!1;if(a=new Date(this.monthDays[s]),!(this.model.minDate<=a&&this.model.maxDate>=a))return!1;this.currentDate(a),c="day",this._navView=!0,this._viewChange(i,this.currentView(),c)}}else if("dblclick"==i.type&&("week"===this.currentView()||"workweek"===this.currentView()||"customview"===this.currentView()&&this._renderDays<=7)){if(d=e(i.target),h=d.hasClass("e-headercells")?d:d.parent().hasClass("e-headercells")?d.parent():d.parent().parent(),this.model.views.indexOf("day")==-1||!h.hasClass("e-headercells"))return!1;if(a=new Date(this._dateRender[h.index()]),!(this.model.minDate<=a&&this.model.maxDate>=a))return!1;this.currentDate(a),c="day",this._navView=!0,this._viewChange(i,this.currentView(),c)}},_renderHorizontalHeaderDays:function(i){var s,a,n,o,r,l,d,h;if(this.element.find(".e-headercells").addClass("e-dateheaderselect"),"month"===this.currentView()||this._isCustomMonthView())for(d=this._horizontalMonthDates(),h=0;h60?h+this.model.timeScale.majorSlot/60:c>=60?h+1:h,c=c>=60?0:c,m&&(c==this.model.timeScale.majorSlot||0==c)&&(p.push({time:u.trim(),times:f,id:h+"_"+c,timecellclass:h-1==this.model.startHour&&0!=n&&0==c?"e-dayend":"",cellWidth:this.model.cellWidth?this.model.cellWidth:"30px",cellHeight:this.model.cellHeight,timeCellWidth:g}),f=[])}}else for(d=new Date((new Date).setHours(0,0,0,0)),h=this.model.startHour;h60?h+this.model.timeScale.majorSlot/60:h+1}return p},_getHorizontalDayAppointments:function(e,i,s,a){for(var n,o=0;o1?new t.DataManager(this.model.resources[this.model.resources.length-1].resourceSettings.dataSource).executeLocal((new t.Query).where(this.model.resources[this.model.resources.length-1].resourceSettings.groupId,t.FilterOperators.equal,parseInt(e[o][this._appointmentSettings.resourceFields.split(",")[this._appointmentSettings.resourceFields.split(",").length-2]]))):this.res1,0!=n.length&&(new Date(new Date(i[s]).setHours(0,0,0,0)).getTime()==new Date(new Date(e[o][this._appointmentSettings.startTime]).setHours(0,0,0,0)).getTime()&&new Date(new Date(i[s]).setHours(0,0,0,0)).getTime()<=new Date(new Date(e[o][this._appointmentSettings.endTime]).setHours(0,0,0,0)).getTime()&&!t.isNullOrUndefined(this.model.group)&&t.scheduleFeatures.resources?e[o][this._appointmentSettings.resourceFields.toString().split(",")[this.model.resources.length-1].trim()]==this.res1[a][this.model.resources[this.model.resources.length-1].resourceSettings.id]:new Date(new Date(e[o][this._appointmentSettings.startTime]).setHours(0,0,0,0)).getTime()<=new Date(new Date(e[o][this._appointmentSettings.endTime]).setHours(0,0,0,0)).getTime())&&(this._renderApp(e[o],s,a),this._filtered.push(e[o]))},_horizontalMonthDates:function(){var e=[];for(i=0;id?new Date(s).getHours()+(-new Date(s).getHours()+(d-l))+-new Date(s).getMinutes():new Date(s).getHours()+-l,g=new Date(s).getHours()==d?new Date(g).getMinutes()+-new Date(s).getMinutes():g,h=20,u=0,_=0,this.model.startHour<=new Date(i).getHours()&&this.model.endHour>=new Date(i).getHours())){var M=!t.isNullOrUndefined(this.model.group)&&this.model.group.resources.length>1?this._findResourceIndex(R,this.model.resources[this.model.resources.length-2].resourceSettings.id,a[this._appointmentSettings.resourceFields.toString().split(",")[this.model.resources.length-2].trim()])+1:0,O=t.isNullOrUndefined(this.model.group)||t.isNullOrUndefined(this.model.resources)?1:this._findResourceIndex(this.res1,this.model.resources[this.model.resources.length-1].resourceSettings.id,a[this._appointmentSettings.resourceFields.toString().split(",")[this.model.resources.length-1].trim()])+1,E=!t.scheduleFeatures.resources||t.isNullOrUndefined(this.model.resources)||t.isNullOrUndefined(this.model.group)?this._overlapApp(a.AppTaskId,a[this._appointmentSettings.startTime],a[this._appointmentSettings.endTime],null):this._overlapApp(a.AppTaskId,a[this._appointmentSettings.startTime],a[this._appointmentSettings.endTime],a[this._appointmentSettings.resourceFields.toString().split(",")[this.model.resources.length-1].trim()]); !t.isNullOrUndefined(this.model.group)&&this.model.group.resources.length>1&&(this.overlapList=new t.DataManager(E).executeLocal((new t.Query).where(this._appointmentSettings.resourceFields.split(",")[this._appointmentSettings.resourceFields.split(",").length-2],t.FilterOperators.equal,a[this._appointmentSettings.resourceFields.split(",")[this._appointmentSettings.resourceFields.split(",").length-2]])));var A=!!this.model.appointmentTemplateId,j=this._getUserAppointmentTemplate(a);if(h=this.model.appointmentTemplateId?"100%"==e(j).css("height")?o-15:"0px"==e(j).css("height")?h:e(j).height():h,_=!t.scheduleFeatures.resources||t.isNullOrUndefined(this.model.resources)||t.isNullOrUndefined(this.model.group)?this._getOverlapCount(a,n,this._dateRender,null):this._getOverlapCount(a,n,this._dateRender,a[this._appointmentSettings.resourceFields.toString().split(",")[this.model.resources.length-1].trim()]),this._renderedAllDay.push(a),u+=_*h,a[this._appointmentSettings.allDay])f=new Date(new Date(new Date(s).setHours(0,0,0,0)).getTime())-new Date(new Date(new Date(i).setHours(0,0,0,0)).getTime()),b=Math.round(f/864e5)+1,b>this._dateRender.length&&(b=new Date(this._dateRender[this._dateRender.length-1]).getDay()+1-new Date(i).getDay()),v=b*(d-l)*60,x=(this.model.endHour-this.model.startHour)*r*n,w=Math.round((a[this._appointmentSettings.endTime]-a[this._appointmentSettings.startTime])/36e5),c=this.element.find(".e-workcells").outerWidth()/30*v+(v/(this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount)-1),m="0";else if(new Date(new Date(new Date(a[this._appointmentSettings.startTime]).setHours(0,0,0,0)).getTime())new Date(new Date(s).setHours(this.model.startHour,0,0))?60*this.model.startHour:60*new Date(i).getHours()+new Date(i).getMinutes(),U=1;if(N=this._dateRender.indexOf(new Date(s).setHours(0,0,0,0)),z=this._dateRender.indexOf(new Date(i).setHours(0,0,0,0)),N==-1)for(;U<7;){if(new Date(this._dateRender[this._dateRender.length-U]).getTime()this._dateRender.length&&(b=new Date(this._dateRender[this._dateRender.length-1]).getDay()+1-new Date(i).getDay(),v=b*(d-l)*60,c=v/(this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount)*this.element.find(".e-workcells").width()+(v/(this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount)-3)),m=z==-1?0:parseFloat(new Date(i).getMinutes())*this.element.find(".e-workcells")[0].offsetWidth*r/this.model.timeScale.majorSlot}else{if(m=parseFloat(new Date(i).getMinutes()+new Date(i).getMilliseconds()/60)*e(this.element.find(".e-workcells")[1]).width()*this.model.timeScale.minorSlotCount/this.model.timeScale.majorSlot-1,this.model.endHour-this.model.startHour==24)y=60*new Date(s).getHours()+new Date(s).getMinutes()-(60*new Date(i).getHours()+new Date(i).getMinutes());else var H=60*new Date(s).getHours()+new Date(s).getMinutes()>60*this.model.endHour?60*this.model.endHour:60*new Date(s).getHours()+new Date(s).getMinutes(),V=60*new Date(i).getHours()+new Date(i).getMinutes()<60*this.model.startHour?60*this.model.startHour:60*new Date(i).getHours()+new Date(i).getMinutes(),y=H-V;y+=1,c=y/(this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount)*this.element.find(".e-workcells").width()+(y/(this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount)-2)+1,x=(this.model.endHour-this.model.startHour)*r*(60/this.model.timeScale.majorSlot)*n+p*r*(60/this.model.timeScale.majorSlot)}C=this._appointmentColor(a),o=t.isNullOrUndefined(this.model.group)||t.isNullOrUndefined(this.model.resources)?o:e(L[O+M-1]).find(".e-workcells").outerHeight(),S=this._indicationApp(a),u+h+1'),u=o-this.element.find(".e-appsoverflow").height(),this.element.find("#"+this._id+"_"+t.format(new Date(a[this._appointmentSettings.startTime]),"MM_dd_yyyy")+"_"+(O+M-1)+"_"+T).css(this.model.enableRTL?"right":"left",this.element.find(".e-workcells").width()-25+"px").css("top",u+"px")),e("#"+this._id+"_"+t.format(new Date(a[this._appointmentSettings.startTime]),"MM_dd_yyyy")+"_"+(O+M-1)+"_"+T).attr("appcount",_+1)):(e(this.element.find(".e-workcellstab tr")[O+M-1]).find(".e-workcells").css("height",o+h-1+"px"),e(this.element.find(".e-resourceheadertable tr")[O+M-1]).find(".e-childnode").css("height",o+h-1+"px"),D="12"==this._timeMode?t.format(new Date(a[this._appointmentSettings.startTime]),this._pattern.t):t.format(new Date(a[this._appointmentSettings.startTime]),"HH:mm"),I="12"==this._timeMode?t.format(new Date(a[this._appointmentSettings.endTime]),this._pattern.t):t.format(new Date(a[this._appointmentSettings.endTime]),"HH:mm"),t.isNullOrUndefined(a[this._appointmentSettings.recurrenceRule])||(k=a[this._appointmentSettings.recurrenceRule].toString().indexOf("RECUREDITID")!=-1),P=e(this.appTemplate.render({id:a.AppTaskId,appResize:this.model.enableAppointmentResize,currentview:this.currentView(),appHeight:h,rtl:this.model.enableRTL,subject:a[this._appointmentSettings.subject],startTime:D,endTime:I,left:m+"px",top:u,appWidth:c+"px",userAppTemplId:A,userTemplate:j,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?a[this._appointmentSettings.priority]:"",enablePriority:this.model.prioritySettings.template,priorityTemplate:this.model.prioritySettings.template?this._priorityTemplate(a):a[this._appointmentSettings.priority],uid:a.Guid,recurrence:a[this._appointmentSettings.recurrence],recurrenceEdit:k,leftInd:S.leftIndication,rightInd:S.rightIndication})),t.isNullOrUndefined(this.model.queryCellInfo)||this._renderQueryCellInfo("appointment",a,P),e(e(L[O+M-1]).find("div.e-appointwrapper")[x]).append(P),this._overflowFlag=!0),t.isNullOrUndefined(S)||(S.leftIndication&&(this.model.enableRTL?this.element.find("[guid="+a.Guid+"]").find(".e-schedulemouseclose").css("margin-left","11px"):this.element.find("[guid="+a.Guid+"]").find(".e-apptime,.e-apptext").css("margin-left","13px")),S.rightIndication&&(this.model.enableRTL?this.element.find("[guid="+a.Guid+"]").find(".e-apptime,.e-apptext").css("margin-right","13px"):this.element.find("[guid="+a.Guid+"]").find("[guid="+a.Guid+"]").find(".e-schedulemouseclose").css("margin-right","11px"))),!t.isNullOrUndefined(this.model.group)&&this.model.group.resources.length>1&&this._renderAppointmentCategory(R,M,x,a,c,m)}},_renderAppointmentCategory:function(i,s,a,n,o,r){var l,d,h,c,u,m,p,g;if(!t.isNullOrUndefined(this.model.group)&&this.model.group.resources.length>0){l=this._getResourceColor(n),d=""==l.appointData?"e-categorycolor":"",s-=1,o="month"==this.currentView()||this._isCustomMonthView()?o:o+2;do{for(this.model.enableRTL?e(e(this.element.find(".e-resourceheadertr")[s]).find("div.e-appointwrapper")[a]).append("
    "):e(e(this.element.find(".e-resourceheadertr")[s]).find("div.e-appointwrapper")[a]).append("
    "),g=this.model.resources.length-2;g>=0;g--)if(h=this.model.resources[g].resourceSettings.dataSource.indexOf(i[s]),h!=-1){h=g,c=this.model.resources[g].resourceSettings.groupId;break}u=0==h?h:h-1,m=new t.DataManager(i).executeLocal((new t.Query).where(this.model.resources[u].resourceSettings.id,t.FilterOperators.equal,i[s][c])),p=this.model.resources[0].resourceSettings.dataSource.indexOf(m[0]),0==p?(m=[],this.model.resources.length>2&&(this.model.enableRTL?e(e(this.element.find(".e-resourceheadertr")[p]).find("div.e-appointwrapper")[a]).append("
    "):e(e(this.element.find(".e-resourceheadertr")[p]).find("div.e-appointwrapper")[a]).append("
    "))):0!=m.length?s=i.indexOf(m[0]):""}while(0!=m.length)}},_renderCategory:function(i,s,a,n,o,r,l,d,h,c){var u,m,p,g,_,f,b;a[this._appointmentSettings.allDay]?(u=new Date(new Date(new Date(r).setHours(0,0,0,0)).getTime())-new Date(new Date(new Date(o).setHours(0,0,0,0)).getTime()),m=Math.round(u/864e5)+1,m>this.dateRender.length&&(m=new Date(this.dateRender[this.dateRender.length-1]).getDay()+1-new Date(o).getDay()),p=1440*m,g=(this.model.endHour-this.model.startHour)*d*h,_=this.element.find(".e-workcells").width()/28.9*p+3,f="0"):new Date(new Date(new Date(a[this._appointmentSettings.startTime]).setHours(0,0,0,0)).getTime())this.dateRender.length&&(m=new Date(this.dateRender[this.dateRender.length-1]).getDay()+1-new Date(o).getDay(),p=1440*m,_=this.element.find(".e-workcells").width()/28.9*p-25*g+10),f=parseFloat(new Date(o).getMinutes())*this.element.find(".e-workcells")[0].offsetWidth*d/60):(f=parseFloat(new Date(o).getMinutes())*this.element.find(".e-workcells")[0].offsetWidth*d/60,b=60*new Date(r).getHours()+new Date(r).getMinutes()-(60*new Date(o).getHours()+new Date(o).getMinutes()),_=this.element.find(".e-workcells").width()/30*b+(new Date(r).getHours()-new Date(o).getHours())*d-2,g=(this.model.endHour-this.model.startHour)*d*h+c*d),!t.isNullOrUndefined(this.model.group)&&this.model.group.resources.length>1&&e(e(e(i.find("td.e-resourceheadercells")).parent()[s-1]).find("div.e-appointwrapper")[g]).append("
    ")},_getHorizontalOverlapCount:function(e,i,s,a,n){for(var o=[],r=0;r=new Date(new Date(i[s]).setHours(0,0,0,0)).getTime()&&(new Date(a[this._appointmentSettings.startTime])=new Date(e[r][this._appointmentSettings.startTime])||new Date(a[this._appointmentSettings.startTime])new Date(e[r][this._appointmentSettings.endTime])||new Date(a[this._appointmentSettings.startTime])>=new Date(e[r][this._appointmentSettings.startTime])&&new Date(a[this._appointmentSettings.startTime])new Date(e[r][this._appointmentSettings.startTime])&&new Date(a[this._appointmentSettings.endTime])=new Date(new Date(i[s]).setHours(0,0,0,0)).getTime()&&(new Date(a[this._appointmentSettings.startTime])=new Date(e[r][this._appointmentSettings.startTime])||new Date(a[this._appointmentSettings.startTime])new Date(e[r][this._appointmentSettings.endTime])||new Date(a[this._appointmentSettings.startTime])>=new Date(e[r][this._appointmentSettings.startTime])&&new Date(a[this._appointmentSettings.startTime])new Date(e[r][this._appointmentSettings.startTime])&&new Date(a[this._appointmentSettings.endTime])0&&(this.model.enableRTL?(i=this.element.find(".e-workcells")[0].offsetLeft-i,e("div#"+this._id+"_scroller").ejScroller({scrollLeft:i}),e(this.element.find(".e-horizontaltimecells").find("table tr")[2]).css("left",i+"px")):(e(this.element.find(".e-horizontaltimecells").find("table tr")[2]).css("left",-i+"px"),e("div#"+this._id+"_scroller").ejScroller({scrollLeft:i})))}},_renderHorizontalHeaderBar:function(){var i,s,a,n,o,r,l,d,h,c=this.model.timeScale.enable?this._isCustomMonthView()?"month":this.currentView():"month",u="day"==c?1:"week"==c?7:"customview"===this.currentView()&&this._renderDays<=7?this._dateRender.length:this.model.workWeek.length;if(this._strTime=this._getStartEndTime(),i=this._columnTimeScale(this._strTime),this.datesColumn=this._getHeaderAllDayCellsCount(),"month"===c||this._isCustomMonthView()){for(this.datesColumn=[],this.monthDays=[],this.totdays=[],r=0;r60?r+this.model.timeScale.majorSlot/60:b>=60?r+1:r,b=b>=60?0:b,f.push(v)}p=!0}d=!t.isNullOrUndefined(this.model.resources)&&!t.isNullOrUndefined(this.model.group),h=m||p?this.userTimeCellHoriTemplate.render({cols:this.datesColumn,label:this._getLocalizedLabels("Resources"),multiRes:d,view:c,timeTdCount:this._strTime,colspan:"month"==c?1:this._strTime.length/u*2,height:"month"==c?62:59,width:this.model.width,headercellWidth:"day"==c?"100%":"55px",column:i,userTemplateId:m,template:p}):this.horizontalHeader.render({cols:this.datesColumn,label:this._getLocalizedLabels("Resources"),multiRes:d,view:c,timeTdCount:this._strTime,colspan:"month"==c?1:this._strTime.length/u*2,height:"month"==c?62:59,width:this.model.width,headercellWidth:"day"==c?"100%":"55px",column:i}),this.aTR.append(h)},_renderHorizontalContent:function(e,i,s,a,n,o){var r,l,d,h,c,u,m,p,g,_=!t.isNullOrUndefined(this.model.timeScale.majorSlotTemplateId)||!t.isNullOrUndefined(this.model.timeScale.minorSlotTemplateId),f=[],b=[],v=this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount,x=this._getStartEndTime();if(_)for(h=0;h60*(this.model.endHour-this.model.startHour)&&d==this.model.timeScale.minorSlotCount-2){v=0;break}b.push(f),v+=this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount,f=[]}t.isNullOrUndefined(this.model.resources)||t.isNullOrUndefined(this.model.group)?(c="month"==this.currentView()||this._isCustomMonthView()?"24px":"25px",l="",r=[{classname:"e-childnode",tdWidth:c}]):(l=this._renderHorizontalResources(),r=this._horiResources),u=60/this.model.timeScale.majorSlot,m=!t.isNullOrUndefined(this.model.workCellsTemplateId),m&&(p=this._getUserWorkCellsTemplate()),g=this.cellTemplate.render({cellrows:r,hourdiff:Math.ceil((this.model.endHour-this.model.startHour)*u),view:this.model.timeScale.enable?this._isCustomMonthView()?"month":this.currentView():"month",cols:this.model.timeScale.enable?"month"==this.currentView()||this._isCustomMonthView()?this.datesColumn:this._getStartEndTime():this.datesColumn,column:_&&_?f:b,timeScale:this.model.timeScale.minorSlotCount,userTemplate:m,userHtml:p}),""==l?this.wTR.append(t.buildTag("td").append(e.append(i.append(s.append(a.append(n.append(o.append(this.$WorkCellDiv.append(g))))))))):this.wTR.append(t.buildTag("td.e-horizontalrestd",{},{},{width:"200px"}).append(l)).append(t.buildTag("td").append(e.append(i.append(s.append(a.append(n.append(o.append(this.$WorkCellDiv.append(g)))))))))},_columnTimeScale:function(e){var i,s;this._columnValue=[],this._cols2=[];var a=this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount,n=!t.isNullOrUndefined(this.model.timeScale.majorSlotTemplate)||!t.isNullOrUndefined(this.model.timeScale.minorSlotTemplate),o=!t.isNullOrUndefined(this.model.timeScale.majorSlotTemplate)&&!t.isNullOrUndefined(this.model.timeScale.minorSlotTemplate)||!t.isNullOrUndefined(this.model.timeScale.minorSlotTemplate),r=!t.isNullOrUndefined(this.model.timeScale.majorSlotTemplate);if(n)for(s=0;s60*(this.model.endHour-this.model.startHour)){if(this._columnValue.push(i),i==this.model.timeScale.minorSlotCount-2){a=0;break}}else this._columnValue.push(i);this._cols2.push(this._columnValue),a+=this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount,this._columnValue=[]}return o||r?this._columnValue:this._cols2},_getResourceHeadTemplate:function(t){var i=e.templates(e(this.model.resourceHeaderTemplateId).html());return i.render(t)},_renderHorizontalResources:function(){var i,s,a,n,o,r,l,d,h,c;this._resCollect=[],this._horizontalResRender=[],this._horiResources=[];var u=this.currentView(),m=("day"==u?1:"week"==u||"month"==u||this._isCustomMonthView()?7:this.model.workWeek.length,"month"==this.currentView()||this._isCustomMonthView()?"24px":"25px"),p=!!this.model.resourceHeaderTemplateId;if(t.isNullOrUndefined(this.model.group))for(c=0;c0&&(this.element.find(".e-horizontaltabletimecell").parent().append('
    '),e("#"+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 s=t.element.find("td.e-headerToday")[0].cellIndex,a=i.getHours()-t.model.startHour,n=60*(t.model.endHour-t.model.startHour)/t.model.timeScale.majorSlot*t.model.timeScale.minorSlotCount*s+60*a/t.model.timeScale.majorSlot*t.model.timeScale.minorSlotCount,o=parseFloat(i.getMinutes())*t.element.find(".e-workcells")[1].offsetWidth*t.model.timeScale.minorSlotCount/t.model.timeScale.majorSlot;e("#"+t._id+"_HighlightCurrentTimeline").css("left",n*t.element.find(".e-workcells")[1].offsetWidth+o)}},_horizontalBusinessHighlight:function(i,s,a,n,o){var r,l,d,h,c,u=t.scheduleFeatures.resources&&!t.isNullOrUndefined(this.model.group)?this._horiResources.length:1;if("month"!==this.currentView()&&!this._isCustomMonthView()&&this.model.timeScale.enable){for(d=0;d",this._blanks="
    ",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(e,i){var s=t.isNullOrUndefined(e)||""===e||null===e;return i||""!==e&&null!==e||(this._addAtLast=!0),!s},_checkBlank:function(e){if(this.isNotBlank(e))return!0;var t=this._blank==i&&!this._addAtLast;return t&&(this._blank=!0),t},_getValueData:function(e,i){var s=this._empties;return this.isNotBlank(e,!0)&&(s=t.distinct(i,this._$foreignKey||this.fName,!1)),s.join(this._spliter)},getPredicate:function(e,s,a){var n,o,r,l,d;for(this._isUrlAdaptor=this._ctrlInstance._dataSource()instanceof t.DataManager&&(this._ctrlInstance._dataSource().adaptor instanceof t.UrlAdaptor||this._ctrlInstance._dataSource().adaptor instanceof t.WebMethodAdaptor),n=s!=i?[s]:t.distinct(e,"field",!1),r={},l=0,d=n.length;l2&&a>1&&"or"==e[a].predicate?"date"==e[a].type||"datetime"==e[a].type?i.predicates.push(this._getDatePredicate(e[a])):i.predicates.push(t.Predicate(e[a].field,e[a].operator,e[a].value,e[a].ignoreCase||!e[a].matchcase)):i=!this._isUrlAdaptor||"date"!=e[a].type&&"datetime"!=e[a].type?e[a].ejpredicate?i[e[a].predicate](e[a].ejpredicate):i[e[a].predicate](e[a].field,e[a].operator,e[a].value,e[a].ignoreCase||!e[a].matchcase):i[e[a].predicate](this._getDatePredicate(e[a]));return i||null}},_getDatePredicate:function(e){return t.Predicate(e.field,e.operator,e.value,e.ignoreCase||!e.matchcase)},getFilterFrom:function(e,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(e){this._$colType=e;var i=this.id+e+"_excelDlg",s=t.buildTag("div#"+i+".e-excelfilter e-dlgcontainer e-shadow"),a=t.buildTag("ul#"+this.id+e+"_MenuItem"),n=this._getMenuData(e);a=this._createLiTag(a,n,!1);var o=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")),r=t.buildTag("div#"+this.id+e+"_CheckBoxList.e-checkboxlist e-fields").append(t.buildTag("div")),l=this._createBtn(),d=t.buildTag("div.e-searchcontainer"),h=t.buildTag("div.e-status e-fields e-hide",this.localizedLabels.CheckBoxStatusMsg);s.append(a),d.append(o),d.append(h),d.append(r),d.append(l),s.append(d),s.appendTo(this._ctrlInstance.element),s.css("display","none"),this._renderCustomFDlg(e),this._dialogContainer=s,null!=this._cssClass&&s.addClass(this._cssClass),this._showSort||(a.find(".e-fnsort").closest("li").css("display","none"),a.find("li.e-separator:first").css("display","none")),this._lsitBoxTemplate(),this._renderSubCtrls(e),"msie"==t.browserInfo().name&&t.browserInfo().version<10&&t.ieClearRemover(o.find("input")[0]),this._wireEvents()},_renderSubCtrls:function(i){e("#"+this.id+i+"_MenuItem").ejMenu({orientation:"vertical",width:266,click:t.proxy(this._menuHandler,this),enableRTL:this._ctrlInstance.model.enableRTL,enableSeparator:!1}),e("#"+this.id+i+"_OkBtn").ejButton({text:this.localizedLabels.Ok,showRoundedCorner:!0,width:60,click:t.proxy(this._fltrBtnHandler,this),enabled:!0}),e("#"+this.id+i+"_CancelBtn").ejButton({text:this.localizedLabels.Cancel,showRoundedCorner:!0,width:60,click:t.proxy(this.closeXFDialog,this)}),e("#"+this.id+i+"_CheckBoxList").ejScroller({height:130,width:234,scroll:t.proxy(this._virtualize,this)}),e("#"+this.id+i+"_CheckBoxList").ejWaitingPopup({showOnInit:!1})},openXFDialog:function(s){var a,n,o;this.fName=s.field,this._dataSource=s.dataSource,this._$colType=s.type||"string",this._$format=s.format||"",this._enableResponsiveRow=s.enableResponsiveRow,this.filteredColumn=s.filteredColumns||this._ctrlInstance.model.filterSettings.filteredColumns,this.sortedColumns=s.sortedColumns||this._ctrlInstance.model.sortSettings.sortedColumns,this._displayName=s.displayName,this._$key=s.key||0,this._$tableID=s.tableID,this._$blankVal=t.isNullOrUndefined(this._$tableID)?this._$blankVal:s.blank,this._$selectedColors=s.selectedColors||[],this._$enableColor=s.enableColor||!1,this._$filteredByColor=s.filteredByColor||this._$filteredByColor,this._$foreignField=s.foreignKeyValue,this._$foreignData=s.foreignDataSource,this._$foreignKey=s.foreignKey,this._$foreignKeyType=s.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),e.extend(this.localizedLabels,s.localizedStrings||{}),o={requestType:"filterbeforeopen",filterModel:this,columnName:this.fName,columnType:this._$colType},this._ctrlInstance._trigger(this._onActionBegin,o)||(null!=this._openedFltr&&this._openedFltr.is(e("#"+this.id+this._$colType+"_excelDlg"))||(this.closeXFDialog(),this._openedFltr=e("#"+this.id+this._$colType+"_excelDlg")),this._listsWrap=e("#"+this.id+this._$colType+"_CheckBoxList"),this._menuWrap=e("#"+this.id+this._$colType+"_MenuItem"),this._searchBox=this._openedFltr.find(".e-searchbox input"),this._setPosition(this._openedFltr,s.position),this._openedFltr.addClass(s.cssClass),this._openedFltr.fadeIn(300,"easeOutQuad",function(){}),n=e("#"+this.id+this._$colType+"_MenuItem").find("li[ejfnrole='popup']"),this._$enableColor?(this._createDivTag(n.eq(0).find(".e-shadow"),this._$selectedColors,!1,"sort"),this._$filteredByColor==-1||this._$filteredByColor.length<1||this._$filteredByColor===this.fName?this._createDivTag(n.eq(1).find(".e-shadow"),this._$selectedColors,!1,"filter"):n.eq(1).addClass("e-disable-item")):n.hide(),this._isFiltered=this._predicates[this._$key]!=i&&this._predicates[this._$key][this.fName]!=i,this._isFiltered=s.isFiltered||this._isFiltered,("date"==this._$colType||"datetime"==this._$colType)&&""==this._$format&&(this._$format="date"==this._$colType?"{0:MM/dd/yyyy}":"{0:MM/dd/yyyy hh:mm:ss}"),this._processListData(),a=this._listsWrap.data("ejScroller"),this._ctrlInstance.model.enableRTL&&a.isHScroll()&&(a.scrollLeft(a.content()[0].scrollWidth-a.content()[0].clientWidth),a.refresh()),this._actualCount>this._maxCount?this._openedFltr.find("div.e-status").removeClass("e-hide"):this._openedFltr.find("div.e-status").addClass("e-hide"),this._setDisable(),o={requestType:"filterafteropen",filterModel:this,columnName:this.fName,columnType:this._$colType},this._ctrlInstance._trigger(this._onActionComplete,o))},closeXFDialog:function(i){if(null!=i){var s=e(i.target);if(s.closest("#"+this.id+this._$colType+"_CustomFDlg").length)return}this._openedFltr&&(this._openedFltr.hasClass("e-dlgcustom")?this._openedFltr.ejDialog("close"):(this._openedFltr.fadeOut(300,"easeOutQuad",function(){}),this._listsWrap.ejWaitingPopup("hide")),t.isNullOrUndefined(this._cancelHandler)||this._cancelHandler(),this.resetFilterModel(),this._ctrlInstance._$fDlgIsOpen=!1)},_setPosition:function(e,t){e.css("position","absolute"),e.css("left",t.X).css("top",t.Y)},_setDisable:function(){var i,s,a,n=this._menuWrap.find("li[ejfnrole='clearfilter']"),o=this._menuWrap.find("li[ejfnrole='filterpopup']"),r=this._menuWrap.find("li[ejfnrole *= 'sort']");this._listsWrap.find("input").filter(":checked:not(.e-selectall)").length;if(this._isFiltered?n.removeClass("e-disable-item"):n.addClass("e-disable-item"),this._showSort&&(i=t.DataManager(this.sortedColumns).executeLocal((new t.Query).where("field","equal",this.fName)),i.length&&"ascending"==i[0].direction?r.filter("[ejfnrole='sortAsc']").addClass("e-disable-item"):r.filter("[ejfnrole='sortAsc']").removeClass("e-disable-item"),i.length&&"descending"==i[0].direction?r.filter("[ejfnrole='sortDesc']").addClass("e-disable-item"):r.filter("[ejfnrole ='sortDesc']").removeClass("e-disable-item")),s=o.find(".aschild"),0!=this.cFilteredCols.length&&e.inArray(this.fName,this.cFilteredCols)!=-1){for(a=0;a"),s.find("#ejFiltercheck").ejCheckBox({checked:!0}),s.find("#ejFiltercheck").ejCheckBox("disable")),o.find(".e-shadow .e-exceltick").length>0&&o.find(".e-shadow .e-exceltick").remove(),this.filteredColumn[a].field==this.fName&&!t.isNullOrUndefined(this.filteredColumn[a+1])&&this.filteredColumn[a+1].field==this.fName&&(this._$foreignField&&this.filteredColumn[a+1].customFilter||!this._$foreignField)?"greaterthanorequal"==this.filteredColumn[a].operator&&"lessthanorequal"==this.filteredColumn[a+1].operator?o.find(".e-shadow .e-list[ejvalue=between]").find("a").append(""):o.find(".e-shadow .e-list[ejvalue=customfilter]").find("a").append(""):this._$foreignField?o.find(".e-shadow .e-list[ejvalue="+this.filteredColumn[a].actualFilterOperator+"]").find("a").append(""):o.find(".e-shadow .e-list[ejvalue="+this.filteredColumn[a].operator+"]").find("a").append("");break}}else for(a=0;a{{/if}}",e.templates(a)},_processListData:function(s){var a,n,o,r,l,d={},h=new t.Query,c={};this._searchCount=0;var u,m=this._predicates[this._$key],p=null,g=null,_=null,l=null;t.isNullOrUndefined(this._$foreignField&&this._$foreignData)?(p=this._dataSource,g=this.fName,_=this._localJSON):(p=_=this._$foreignData,this._dataSource instanceof t.DataManager&&!(p instanceof t.DataManager)&&(p=t.DataManager(p)),g=this._$foreignField);for(n in m)n!=this.fName&&(o=m[n],r=o.from,r?h.skip("top"==r?0:p.length-(p.length-o.take)).take(o.take):u=u!=i?u.and(o):o);d.columnName=g,h.requiresCount(),u&&h.where(u),c.requestType=s?s.type:"filterchoicerequest",c.filterModel=this,c.query=h,c.dataSource=p,this._ctrlInstance._trigger(this._onActionBegin,c)||(this.enableSelect&&h.select(this.fName),s&&"filterchoicesearch"==s.type?(s.value&&h.where(g,s.operator,s.value,!s.matchcase),!t.isNullOrUndefined(this._$foreignField)&&this._ctrlInstance.model.filterSettings.filteredColumns.length>0&&!t.isNullOrUndefined(this._ctrlInstance._fkParentTbl)&&(this._localJSON=e.extend(!0,this._localJSON,this._ctrlInstance._fkParentTblData)),a=t.DataManager(this._localJSON).executeLocal(h),d.data=this._currentData=a.result,d.type=s.type,this._totalRcrd=this._searchCount=a.count,this._setCheckBoxList(d)):this._dataSource instanceof t.DataManager?(proxy=this,d.type="filterchoicerequest",this._listsWrap.ejWaitingPopup("show"),this._reqInProgess||(this._reqInProgess=!0,this._$foreignField&&u&&(p=this._dataSource),a=p.executeQuery(h),a.done(function(e){proxy._$foreignField?proxy._filterForeignData(e,d):(l=e.result,d.data=proxy._localJSON=proxy._currentData=l,proxy._totalRcrd=e.count,proxy._listsWrap.ejWaitingPopup("hide"),proxy._setCheckBoxList(d),proxy._reqInProgess=!1)}))):(l=[],a=t.DataManager(this._dataSource).executeLocal(h),d.type="filterchoicerequest",this._$foreignField?this._filterForeignData(a,d):(l=a.result,d.data=this._localJSON=this._currentData=l,this._totalRcrd=a.count,this._setCheckBoxList(d))))},_filterForeignData:function(i,s){var a,n,o,r,l,d,h,c="boolean"==typeof s,u=this._$foreignKey,m=this._$foreignField,p=this._$foreignKeyType,g=this,_={},f=new t.Query,b=this._$foreignData instanceof t.DataManager?this._$foreignData:t.DataManager(this._$foreignData);if(c){for(d=i[0],_=i[0],r=i.slice(),!d||this.closeXFDialog(),o=new t.Predicate(m,d.operator,d.value,!d.matchcase),l=1,h=i.length;lthis._actualCount?this._actualCount:this._maxCount,this._filterdCol=t.DataManager(this.filteredColumn).executeLocal(t.Query().where("field","equal",this.fName)),this._listsWrap.find("div:first").html([this._selectAll,e.render[this.id+this._$colType+"_listBox_Template"](s),this._addAtLast?this.replacer(r,/@@/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,{},{})),t.isNullOrUndefined(this._chkList)||(n=this._chkList.filter(":checked").length),this._isFiltered&&this._actualCount!=n?n>0&&this._interDeterminateState&&this._listsWrap.find(".e-selectall").ejCheckBox("model.checkState","indeterminate"):this._listsWrap.find(".e-selectall").ejCheckBox({checked:!0}),e("#"+this.id+this._$colType+"_OkBtn").ejButton({enabled:0!=n}),this._listsWrap.ejScroller({scrollTop:0}).ejScroller("refresh"),this._ctrlInstance._trigger(this._onActionComplete,o)},_createLiTag:function(s,a,n){return proxy=this,e.each(a,function(a,o){var r,l=t.buildTag("li",{},{},o.htmlAttribute||n&&{ejfnrole:"operator",ejvalue:o.value}||{}),d=n&&e.inArray(o.value,proxy._noDlg)==-1?"...":"",h=t.buildTag("a",o.text+d,{},{});o.sprite!=i&&h.append(t.buildTag("span",{},{},{class:o.sprite})),o.child!=i&&(r=3!=o.id&&5!=o.id?proxy._createLiTag(t.buildTag("ul.e-shadow"),o.child,!0):3===o.id?proxy._createDivTag(t.buildTag("ul.e-shadow"),o.child,!0,"sort"):proxy._createDivTag(t.buildTag("ul.e-shadow"),o.child,!0,"filter")),o.child==i?s.append(l.append(h)):s.append(l.append(h).append(r)),e.inArray(o.value||o.htmlAttribute&&o.htmlAttribute.ejfnrole,proxy._sepAftr)!=-1&&s.append(t.buildTag("li.e-separator"))}),s},_createDivTag:function(e,i,s,a){var n,o,r,l,d=[],h=[],c=!1,u="",m="",p="",g="",_="",f="";if("sort"==a?(u=this.localizedLabels.SortByCellColor,m=this.localizedLabels.SortByFontColor):(u=this.localizedLabels.FilterByCellColor,m=this.localizedLabels.FilterByFontColor),p=a+"colorhdr",_=a+"fonthdr",g=a+"bgcolor",f=a+"fgcolor",e.length>0&&e.children().remove(),i.length>0){for(l=0;l0)for(n=t.buildTag("li.e-list e-bghdrcolor","","",{ejfnrole:p}),o=t.buildTag("a",u,{}),n.append(o),e.append(n),l=0;l0)for(n=t.buildTag("li.e-list e-fghdrcolor","","",{ejfnrole:_}),o=t.buildTag("a",m,{}),n.append(o),e.append(n),l=0;l0?"checked":o[0].isCustom===!0?"":"checked"},_genCheckID:function(){return"CheckBox"+this.getIndex()},_formatting:function(e,t,i){if("date"==this._$colType&&""==e&&(e="{0:MM/dd/yyyy hh:mm:ss}"),"boolean"==this._$colType)return""===t?"":this.localizedLabels[1==t?"True":0==t?"False":""];if(this._formatFiltering||"date"==this._$colType){var s=this._ctrlInstance.formatting;return""!=e?s(e,t,i):t}},_updateDateFilter:function(e){return"date"==e.type||e.value instanceof Date?(e.value=e.value instanceof Date?e.value:t.parseJSON({val:e.value}).val,["equal","notequal"].indexOf(e.operator)==-1?e:this._setDateObject(e)):e},_checkHandler:function(t){e("#"+t.model.id).prop("checked",t.isChecked);var i,s=this._listsWrap.find("input.e-ftrchk").filter(":checked:not(.e-selectall)"),a=s.length,n=this._listsWrap.find(".e-selectall");a==this._chkList.length?(n.prop("checked",!0),i=!0):0!=a&&this._interDeterminateState?n.ejCheckBox("model.checkState","indeterminate"):(n.removeProp("checked"),i=!1),n.ejCheckBox({checked:i}),e("#"+this.id+this._$colType+"_OkBtn").ejButton({enabled:0!=a})},_selectAllHandler:function(t){"check"==t.checkState?(this._chkList.filter(":not(:checked)").ejCheckBox({checked:t.isChecked}),this._chkList.prop("checked",!0)):"uncheck"==t.checkState&&(this._chkList.filter(function(){if(e(this).hasClass("e-checkbox")&&e(this).prop("checked"))return this}).ejCheckBox({checked:t.isChecked}),this._chkList.removeProp("checked"),this._chkList.removeAttr("checked")),e("#"+this.id+this._$colType+"_OkBtn").ejButton({enabled:t.isChecked})},_renderCustomFDlg:function(i){var s,a=this.id+i+"_CustomFDlg";e("#"+a).length||(s=t.buildTag("div#"+a+".e-excelfilter e-dlgcustom"),s.addClass(this._cssClass),this._renderCDlgContent(s,i),s.ejDialog({showOnInit:!1,enableResize:!1,enableModal:!0,allowKeyboardNavigation:!1,title:this._title,width:370,content:"#"+this.id,enableRTL:this._ctrlInstance.model.enableRTL,closeIconTooltip:"Close"}),"ej.Grid"==this._ctrlInstance.sfType&&s.ejDialog({position:{Y:this._ctrlInstance._gridContentTable.offset().top}}),s.ejDialog("refresh"))},_renderCDlgContent:function(i,s){var a,n,o=t.buildTag("div.e-dlgfields",this.localizedLabels.Showrowswhere,{},{}),r=this.id+this._$colType,l=t.buildTag("fieldset.e-fieldset"),d=t.buildTag("tr.e-fields"),h=t.buildTag("tr.e-fields"),c=t.buildTag("tr.e-fields e-top"),u=t.buildTag("input#"+r+"_CustomDrop1"),m=t.buildTag("input#"+r+"_CustomDrop2"),p=t.buildTag("input#"+r+"_CustomDrop3"),g=t.buildTag("input#"+r+"_CustomValue1.e-ejinputtext e-excustmfltr",{},{},{type:"text"}),_=t.buildTag("input#"+r+"_CustomValue2.e-ejinputtext e-excustmfltr",{},{},{type:"text"}),f=t.buildTag("input#"+r+"_CustomValue3.e-ejinputtext e-excustmfltr",{},{},{type:"text"}),b=t.buildTag("tr.e-predicate"),v=t.buildTag("input#"+r+"_CustomAndPredicate",{},{},{type:"radio",name:"predicate",value:"and"}),x=t.buildTag("input#"+r+"_CustomOrPredicate",{},{},{type:"radio",name:"predicate",value:"or"}),w=t.buildTag("input#"+r+"_CustomMatchPredicate",{},{},{type:"checkbox"});i.append(o),a=t.buildTag("table.e-optable"),d.append(t.buildTag("td.e-operator").append(u)).append(t.buildTag("td.e-value").append(g)),b.append(t.buildTag("td",{},{},{}).append(v).append(t.buildTag("label.e-caption",this.localizedLabels.PredicateAnd,{},{for:r+"_CustomAndPredicate"})).append(x).append(t.buildTag("label.e-caption",this.localizedLabels.PredicateOr,{},{for:r+"_CustomOrPredicate"}))),h.append(t.buildTag("td.e-operator").append(m)).append(t.buildTag("td.e-value").append(_)),a.append(d).append(b).append(h),"string"==s&&b.append(t.buildTag("td",{},{},{}).append(w).append(t.buildTag("label.e-caption",this.localizedLabels.MatchCase,{},{for:r+"_CustomMatchPredicate"}))),("number"==s||"guid"==s)&&(c.append(t.buildTag("td.e-operator").append(p)).append(t.buildTag("td.e-value").append(f)),a.append(c)),l.append(t.buildTag("legend")).append(a),i.append(t.buildTag("div.e-dlgfields").append(l)),i.append(t.buildTag("div.e-dlgfields").append(this._createBtn(!0))),i.appendTo("body"),n=s.replace(s.charAt(0),s.charAt(0).toUpperCase()),e([u,m]).ejDropDownList({fields:{text:"text",value:"value"},height:27,width:120,enableRTL:this._ctrlInstance.model.enableRTL}),"number"==s?(e([u,m]).ejDropDownList({popupWidth:"170px"}),e([g,_]).ejNumericTextbox({showSpinButton:!1,height:"27px",width:"177px",enableRTL:this._ctrlInstance.model.enableRTL,watermarkText:this.localizedLabels.NumericTextboxWaterMark,focusOut:function(){0==this.model.decimalPlaces&&this.element.prev(".e-input").val(this.model.value)}})):"guid"==s?(e([u,m]).ejDropDownList({popupWidth:"170px"}),e(g).css({height:"22px",width:"175px"}),e(_).css({height:"22px",width:"177px" })):"date"==s?(e([u,m]).ejDropDownList({popupWidth:"170px"}),e([g,_]).ejDatePicker({cssClass:this._ctrlInstance.model.cssClass,height:"27px",width:"177px",enableRTL:this._ctrlInstance.model.enableRTL,watermarkText:this.localizedLabels.DatePickerWaterMark,locale:this._locale})):"datetime"==s?(e([u,m]).ejDropDownList({popupWidth:"170px"}),e([g,_]).ejDateTimePicker({cssClass:this._ctrlInstance.model.cssClass,height:"27px",width:"177px",enableRTL:this._ctrlInstance.model.enableRTL,watermarkText:this.localizedLabels.DateTimePickerWaterMark})):"string"==s&&e([g,_]).ejAutocomplete({cssClass:this._ctrlInstance.model.cssClass,enableRTL:this._ctrlInstance.model.enableRTL,enableDistinct:!0,width:"177px",height:"27px"}),e([v,x]).ejRadioButton({cssClass:this._ctrlInstance.model.cssClass,enableRTL:this._ctrlInstance.model.enableRTL}),w.ejCheckBox({}),e("#"+r+"Custom_OkBtn").ejButton({text:this.localizedLabels.Ok,showRoundedCorner:!0,width:"23.6%",click:t.proxy(this._fltrBtnHandler,this),enabled:!0}),e("#"+r+"Custom_CancelBtn").ejButton({text:this.localizedLabels.Cancel,showRoundedCorner:!0,width:"23.6%",click:t.proxy(this.closeXFDialog,this)})},_openCustomFilter:function(i){var s,a,n,o,r,l,d="top10"!=i?this._$colType:i,h=d.replace(d.charAt(0),d.charAt(0).toUpperCase()),c=this.id+this._$colType;this.closeXFDialog(),this._openedFltr=e("#"+c+"_CustomFDlg"),l={requestType:"filterbeforeopen",filterModel:this,columnName:this.fName,columnType:this._$colType,isCustomFilter:!0},this._ctrlInstance._trigger(this._onActionBegin,l)||(this._openedFltr.ejDialog("open"),this._openedFltr.ejDialog({open:function(){e("#"+c+"_CustomValue1").hasClass("e-autocomplete")?e("#"+c+"_CustomValue1").focus():e("#"+c+"_CustomValue1").prev().focus()}}),this._openedFltr.find("legend").html(this._displayName),s=["Number","Date"].indexOf(h)!=-1?6:5,a=this.localizedLabels[h+"MenuOptions"].slice(0,s),a.unshift({text:"",value:""}),e("#"+c+"_CustomDrop1").ejDropDownList({dataSource:a}),e("#"+c+"_CustomDrop2").ejDropDownList({dataSource:a}),"number"==this._$colType?(n=0,"top10"==i?(this._openedFltr.find(".e-optable tr").not(".e-top").addClass("e-hide"),this._openedFltr.find(".e-optable tr.e-top").removeClass("e-hide"),e("#"+c+"_CustomDrop3").ejDropDownList({dataSource:this.localizedLabels[h+"MenuOptions"]})):(n=0!=this._$format.length?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"),e("#"+c+"_CustomValue1").ejNumericTextbox("model.decimalPlaces",n),e("#"+c+"_CustomValue2").ejNumericTextbox("model.decimalPlaces",n))):(this._openedFltr.find(".e-optable tr.e-top").addClass("e-hide"),this._openedFltr.find(".e-optable tr").not(".e-top").removeClass("e-hide")),"string"==this._$colType&&(o=this._$foreignField?this._$foreignField:this.fName,r=this._$foreignData?this._$foreignData:this._dataSource,this._openedFltr.find(".e-autocomplete").ejAutocomplete({fields:{text:o},dataSource:r,focusIn:function(){var e=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=""==e?this.model.filterType:e}})),"date"==this._$colType&&""!=this._$format?this._openedFltr.find(".e-datepicker").ejDatePicker({dateFormat:this._$format.replace(/{0:|}/g,function(){return""}),enableStrictMode:!0}):"datetime"==this._$colType&&""!=this._$format&&this._openedFltr.find(".e-datetimepicker").ejDateTimePicker({dateTimeFormat:this._$format.replace(/{0:|}/g,function(){return""}),enableStrictMode:!0}),this._setFilteredData(c,i),t.isNullOrUndefined(this._customFilterHandler)||this._customFilterHandler(),l={requestType:"filterafteropen",filterModel:this,columnName:this.fName,columnType:this._$colType,isCustomFilter:!0},this._ctrlInstance._trigger(this._onActionComplete,l))},_setFilteredData:function(s,a){var n,o,r,l,d,h,c=e.inArray(this.fName,this.cFilteredCols),u=[],m=[];if("top10"!=a){c!=-1&&(u=t.DataManager(this.filteredColumn).executeLocal(t.Query().where("field","equal",this.fName))),c!=-1&&this._$foreignField&&(u=u[0].actuals),null!=this._initialFName&&this._initialFName==this.fName&&(u[0].isCustom=!0),n=u.length;var p=this._openedFltr.find(".e-dropdownlist"),g=this._openedFltr.find(".e-value input.e-ejinputtext.e-input"),_=this._openedFltr.find(".e-predicate");for(m=c!=-1&&n&&u[0].from!=i?[a,""]:"between"==a&&c!=-1&&n?[u[0].operator,t.isNullOrUndefined(u[1])?"":u[1].operator]:c!=-1&&n&&u[0].isCustom?["customfilter"!=a&&c!=-1?a:u[0].operator,"customfilter"==a&&u[1]?u[1].operator:""]:c==-1&&"customfilter"==a?["equal",""]:"between"==a||"customfilter"==a?"customfilter"!=a?["greaterthanorequal","lessthanorequal"]:["",""]:[a,""],o=0;o<(c!=-1?n:2);o++)r=/\D*/.exec(m[o])[0],e(p[o]).prop("value",r),e(p[o]).ejDropDownList("setSelectedValue",r),e(p[o]).ejDropDownList({change:function(){this.element.closest(".e-fields").find(".e-autocomplete").val("")}}),l=c!=-1&&n&&u[o].isCustom&&(r==(this._$foreignField?u[o].actualFilterOperator:u[o].operator)||"customfilter"==r||"between"==r)?this._$foreignField?""!=r?u[o].actualFilterValue:"":u[o].value:"",e(g[o]).hasClass("e-datepicker")?e("#"+g[o].id).ejDatePicker("model.value",c!=-1&&n&&u[o].isCustom?u[o].value:null):e(g[o]).hasClass("e-numerictextbox")?e("#"+g[o].id).ejNumericTextbox("model.value",l):e(g[o]).val(l),d=c!=-1&&n&&u[o].isCustom&&u[o].predicate!=i?this._$foreignField?u[o].actualPredicate:u[o].predicate:"and",_.find("input[value="+d+"]").ejRadioButton({checked:!0}),"string"==this._$colType&&(h=c!=-1&&n&&u[o].isCustom?u[o].matchcase:this._matchCase,_.find("input.e-js[type='checkbox']").ejCheckBox({checked:h})),this._openedFltr.find(".e-value input:visible:eq(0)").select()}},_setDateObject:function(i){var s,a,n,o;if(null!=i.value){var r=(i.value,e.extend(!0,{},i)),l=e.extend(!0,{},i);return t.isNullOrUndefined(this._openedFltr)||!this._openedFltr.hasClass("e-dlgcustom")||t.isNullOrUndefined(this._ctrlInstance.getColumnByField(i.field).format)?(a=new Date(r.value.setSeconds(r.value.getSeconds()-1)),n=new Date(l.value.setSeconds(l.value.getSeconds()+2)),i.value=new Date(i.value.setSeconds(l.value.getSeconds()-1))):(s=this._ctrlInstance.getColumnByField(i.field).format,s.indexOf("s")!=-1?(a=new Date(r.value.setSeconds(r.value.getSeconds()-1)),n=new Date(l.value.setSeconds(l.value.getSeconds()+2)),i.value=new Date(i.value.setSeconds(l.value.getSeconds()-1))):s.indexOf("m")!=-1?(a=new Date(r.value.setMinutes(r.value.getMinutes()-1)),n=new Date(l.value.setMinutes(l.value.getMinutes()+2)),i.value=new Date(i.value.setMinutes(l.value.getMinutes()-1))):s.indexOf("h")!=-1?(a=new Date(r.value.setHours(r.value.getHours()-1)),n=new Date(l.value.setHours(l.value.getHours()+2)),i.value=new Date(i.value.setHours(l.value.getHours()-1))):(a=new Date(r.value.setDate(r.value.getDate())),a=new Date(r.value.setSeconds(r.value.getSeconds()-1)),n=new Date(l.value.setDate(l.value.getDate()+1)),i.value=new Date(i.value.setDate(l.value.getDate()-1)))),r.value=a,l.value=n,"equal"==i.operator?(r.operator="greaterthan",r.predicate="and",l.operator="lessthan",l.predicate="and"):"notequal"==i.operator&&(r.operator="lessthanorequal",r.predicate="or",l.operator="greaterthanorequal",l.predicate="or"),o=t.Predicate(r.field,r.operator,r.value,!r.matchcase),o=o[l.predicate](l.field,l.operator,l.value,!l.matchcase),i.ejpredicate=o,i.type="date",i}return i},_getCDlgFields:function(){var t,s,a,n,o,r,l,d,h=this._openedFltr.find(".e-dropdownlist"),c=this._openedFltr.find(".e-checkbox"),u=!0,m=[],p=this._openedFltr.find(".e-value input.e-ejinputtext.e-input"),g=this._openedFltr.find(".e-value input"),_=this._openedFltr.find(".e-predicate input[type='radio']:checked").val();for(e.inArray(this.fName,this.cFilteredCols)==-1&&this.cFilteredCols.push(this.fName),s=0,a=h.length;s-1||"number"==this._$colType&&isNaN(o)?(r=this.iterateAndGetCollection(this._empties.join(this._spliter),e.extend({},t,{predicate:"notequal"===n.toLowerCase()?"and":"or",operator:n.toLowerCase()})),l=this.generatePredicate(r),m.push(e.extend({},t,{ejpredicate:l,operator:n.toLowerCase()}))):(d={},e.extend(!0,d,{value:o,operator:n.toLowerCase(),isCustom:!0,actualFilterOperator:n.toLowerCase(),actualFilterValue:o,actualPredicate:t.predicate},t),"date"==this._$colType&&(d.type="date"),m.push("date"==this._$colType&&["equal","notequal"].indexOf(n.toLowerCase())!=-1?this._setDateObject(d):d))}this._$foreignField==i?this.initiateFilter(m):this._filterForeignData(m,!0)},_fltrBtnHandler:function(){var i,s,a=[],n={};if(this._openedFltr.hasClass("e-dlgcustom"))a=this._getCDlgFields(),e.inArray(this.fName,this.cFilteredCols)==-1&&a[0]&&this.cFilteredCols.push(this.fName);else{if(!this._isFiltered&&this._listsWrap.find(".e-selectall").ejCheckBox("model.checked")&&0==this._searchCount)return this.closeXFDialog();var o,r=this._listsWrap.find("input.e-ftrchk").filter(":checked:not(.e-selectall)"),l=r.length,d=this.getType(),h="string"==this._colType?"startswith":"equal",c="string"!=this._colType||this._matchCase,u={field:this.fName,predicate:"or",operator:h,matchcase:c};for(i=0;ii.scrollTop-this.offsetHeight&&i.scrollTop+a+70>this.offsetTop+this.offsetHeight)return this});0!=n.length&&(n.filter(":checked").ejCheckBox({checked:!0}),n.filter(":not(:checked)").ejCheckBox({checked:!1}),n.ejCheckBox({change:t.proxy(this._checkHandler,this)}),s=this._listsWrap.ejScroller("instance"),s.refresh())},resetFilterModel:function(){this._blank=i,this._addAtLast=!1,this._isFiltered=!1,this._searchCount=0},resetExcelFilter:function(){var t,i,s,a,n,o=this.id;for(this._predicates=[],this.cFilteredCols=[],this.resetFilterModel(),t=0,s=this._posType.length;t1&&(n[c-1].dataSource=[],n[c-1].dataSource=this.res),this.res=[],r=t.group(n[c].dataSource,n[c].groupId),l=t.group(n[c-1].dataSource,n[c-1].id),this._resourceManager1=r instanceof t.DataManager?r:t.DataManager(r),m=0;m0)for(g=0;g0){for(n=this._resCollection,r=0;r
    ${"+this._resCollection[t].text+"}
    "}):e.find(".owner_"+t).ejAutocomplete({enableRTL:this.model.enableRTL,showPopupButton:!0,width:"100%",cssClass:this.model.cssClass,multiSelectMode:"none",emptyResultText:this._getLocalizedLabels("EmptyResultText"),dataSource:i[t],fields:{text:this._resCollection[t].text,key:this._resCollection[t].id},change:this._onResourceChange,template:"
    ${"+this._resCollection[t].text+"}
    "})},_onResourceChange:function(i){var s,n,o,r,l,d,h;if(!t.isNullOrUndefined(i.value)&&""!=i.value){var c=e("#"+this._id.toString().split("_")[0]),u=c.ejSchedule("instance"),m=parseInt(this._id.toString().split("_")[2]),p=u._appointmentAddWindow.find(".owner_"+m).ejAutocomplete("option","multiSelectMode"),g=this.getSelectedItems(),_=u._resCollection;if(m0){var f,b,v=m+1,x=u.render_Resources[v-1]instanceof t.DataManager?u.render_Resources[v-1]:t.DataManager(u.render_Resources[v-1]),w=u.render_Resources[v]instanceof t.DataManager?u.render_Resources[v]:t.DataManager(u.render_Resources[v]),y=[];if("none"==p){if(t.isNullOrUndefined(i.value)||(s=(new t.Query).where(_[v-1].text,t.FilterOperators.equal,i.value),n=x.executeLocal(s)),o=!i.value||t.isNullOrUndefined(i.value)||n.length<=0?g[0][_[v-1].id]:n[0][_[v-1].id],!t.isNullOrUndefined(o))for(a=v;a<_.length;a++){for(b=new t.DataManager(_[v].dataSource).executeLocal((new t.Query).where(_[v].groupId,t.FilterOperators.equal,o)),0!=b.length&&(o=b[0][_[v-1].id]),y=[],h=0;h0){for(l=t.Predicate(_[v].groupId,t.FilterOperators.equal,resApp[0][_[v-1].id]),d=1;ds?1:0})}for(s=[],a=0;a1){for(i=0;i=7?7:"customview"==w&&this._dateRender.length<7?this._dateRender.length:C,t.isNullOrUndefined(this.model.group)){for(x=0;x=0;c--){for(L.push(c),u=0;u=24)&&(this._setAllDayPos(this._processed[s],t,i),this._filtered.push(this._processed[s]),this.allDayCount.push(s))},_getResourceColor:function(e){var i,s=this._resCollection,a="",n="";return t.isNullOrUndefined(this.model.group)?(i=this._findResourceIndex(this.render_Resources[this.render_Resources.length-1],s[s.length-1].id,e[this._appointmentSettings.resourceFields.split(",")[this._appointmentSettings.resourceFields.split(",").length-1].trim()]),t.isNullOrUndefined(i)||(a=t.isNullOrUndefined(this.render_Resources[this.render_Resources.length-1][i][s[s.length-1].color])?a:this.render_Resources[this.render_Resources.length-1][i][s[s.length-1].color],n=t.isNullOrUndefined(this.render_Resources[this.render_Resources.length-1][i][s[s.length-1].appointmentClass])?n:this.render_Resources[this.render_Resources.length-1][i][s[s.length-1].appointmentClass])):(i=this._findResourceIndex(this.render_Resources[0],s[0].id,e[this._appointmentSettings.resourceFields.split(",")[0].trim()]),t.isNullOrUndefined(i)||(a=t.isNullOrUndefined(this.render_Resources[0][i][s[0].color])?a:this.render_Resources[0][i][s[0].color],n=t.isNullOrUndefined(this.render_Resources[0][i][s[0].appointmentClass])?n:this.render_Resources[0][i][s[0].appointmentClass])),{appointData:a,appointCustomcss:n}},_getResourceValue:function(e){var i,s;return t.scheduleFeatures.resources&&!t.isNullOrUndefined(this.model.resources)&&(s=this._getResourceDetails(e),i=t.DataManager(this._resCollection[s.length-1].dataSource).executeLocal((new t.Query).where(this.model.resources[s.length-1].resourceSettings.id,"equal",s[0].id))[0]),i},_getResourceDetails:function(e,i){var s,a,n,o,r,l,d,h,c,u;if(!t.isNullOrUndefined(this.model.resources)&&this.model.resources.length>0){if(s="day"==this.currentView()?1:"week"==this.currentView()||"month"==this.currentView()?7:this.model.workWeek.length,s="customview"==this.currentView()&&this._dateRender.length>=7?7:"customview"==this.currentView()&&this._dateRender.length<7?this._dateRender.length:s, i="month"===this.currentView()||"customview"==this.currentView()?e.index():!t.isNullOrUndefined(this._cellIndex)&&t.isNullOrUndefined(this._multiple)?this._cellIndex:e.index(),e.hasClass("e-detailedapp")?"":this.index=i,i=e.hasClass("e-detailedapp")?this.index:i,this._resWorkWeek){for(a=0,n=0;ne.index()){i=n;break}}else i="vertical"==this.model.orientation?parseInt(i/s):t.isNullOrUndefined(this._workCellIndex)?e.parent().index():this._workCellIndex;for(o="vertical"==this.model.orientation?this._valueCollection:this._resCollect,this._resourceCollection=[],c=this._resCollection,u=c.length-1;u>=0;u--)u==c.length-1?t.isNullOrUndefined(this.model.group)?(this._resourceCollection.push({id:c[c.length-1].dataSource[i][c[c.length-1].id]}),r=c[c.length-1].dataSource[i][c[c.length-1].groupId]):(this._resourceCollection.push({id:o[i][c[u].id]}),r=o[i][c[u].groupId]):(l=c[u].dataSource instanceof t.DataManager?c[u].dataSource:t.DataManager(c[u].dataSource),d=(new t.Query).where(c[u].id,t.FilterOperators.equal,r),h=l.executeLocal(d),this._resourceCollection.push({id:h[0][c[u].id]}),r=h[0][c[u].groupId]);return this._resourceCollection}},_getResourceFields:function(e){if(t.isNullOrUndefined(this.model.group))e[this._appointmentSettings.resourceFields.split(",")[0].trim()]=this._resourceCollection[0].id;else for(var i=0,s=this._resourceCollection.length-1;i=7?7:"customview"==e.model.currentView&&e._dateRender.length<7?e._dateRender.length:a,n=e.model.enableRTL?e.res1.length-Math.floor(i/a)-1:Math.floor(i/a),e._resWorkWeek)for(o=0,r=0;ri){n=r;break}l="vertical"==e.model.orientation?e.res1[n]:e._resCollect[i],this._ownerId=l[e.model.resources[e.model.resources.length-1].resourceSettings.id],this._groupId=l[e.model.resources[e.model.resources.length-1].resourceSettings.groupId],s[e._appointmentSettings.resourceFields.split(",")[e._appointmentSettings.resourceFields.split(",").length-1].trim()]=l[e.model.resources[e.model.resources.length-1].resourceSettings.id],e._appointmentSettings.resourceFields.split(",").length>1&&(s[e._appointmentSettings.resourceFields.split(",")[e._appointmentSettings.resourceFields.split(",").length-2].trim()]=l[e.model.resources[e.model.resources.length-1].resourceSettings.groupId])}return s},_renderResourceData:function(e,i){var s,a,n,o,r,l;if((e.hasClass("e-workcells")||e.hasClass("e-alldaycells")||e.hasClass("e-monthcells"))&&!e.hasClass("e-resourceheadercells")&&this._getResourceDetails(e),s=[],a=[],this.model.resources.length)for(n=this._resourceCollection.length-1;n>=0;n--)o=this._findResourceIndex(this._resCollection[n].dataSource,this._resCollection[n].id,this._resourceCollection[this._resourceCollection.length-1-n].id),s.push(this._resCollection[n].dataSource[o]),0!=n?(r=(new t.Query).where(t.Predicate(this._resCollection[n].groupId,t.FilterOperators.equal,this._resCollection[n].dataSource[o][this._resCollection[n].groupId])),l=new t.DataManager(this._resCollection[n].dataSource).executeLocal(r),i=this._findResourceIndex(l,this._resCollection[n].id,this._resourceCollection[this._resourceCollection.length-1-n].id),a=l,this._appointmentAddWindow.find(".owner_"+n).ejAutocomplete("clearText"),this._appointmentAddWindow.find(".owner_"+n).ejAutocomplete("option","dataSource",a),this._appointmentAddWindow.find(".owner_"+n).data("ejAutocomplete").selectValueByKey(a[i][this._resCollection[n].id])):(this._appointmentAddWindow.find(".owner_"+n).ejAutocomplete("clearText"),this._appointmentAddWindow.find(".owner_"+n).data("ejAutocomplete").selectValueByKey(s[this._resourceCollection.length-1-n][this._resCollection[n].id]))},_bindResourcesData:function(){var e,i;if(!t.isNullOrUndefined(this.model.resources)){for(this._resourceInfo=[],e=!1,i=0;i"+this.model.resources[t].title+":
    ";return e},_renderResourcesTemplate:function(){"vertical"==this.model.orientation&&(this.resourceHeadTemplate=e.templates(this._createTemplate(s(),"_ResourceHeader")))}}}(jQuery,Syncfusion),function(e,t,s){t.scheduleFeatures=t.scheduleFeatures||{};var n=function(){return this._monthCellsTemplate="{{for cellrows ~cols1=cols1 ~userTemp=userTemplate ~userHtml=userHtml}}{{for ~cwidth=cwidth ~cheight=cheight ~cols1 ~value=#getIndex()}}{{/for}}{{/for}}
    {{if ~userTemp == true}}{{:~userHtml[~value][#getIndex()]}}{{/if}}
    ",this._monthCellsTemplate},o=function(){return this._appTemplate="{{else}}{{if recurrence == true}}{{if recurrenceEdit == true}}{{else}}{{/if}}{{/if}}{{:userTemplate}}{{/if}}",this._appTemplate},r=function(){return this._categorizeMultipleTemplate="{{for renderData }}
    {{/for}}",this._categorizeMultipleTemplate},l=function(){return this._headerTemplate="{{for cols ~view=view ~colspan=colspan}}{{if cellToday == 'e-headerToday'}}{{else}}{{/if}}
    {{:currentDay}}
    {{/for}}",this._headerTemplate},h=function(){return this._leftIndent=" {{for trs ~tdClass=tdClass ~divClass=divClass}} {{for ~tdClass=tdClass ~divClass=divClass}} {{/for}}{{/for}}
    ",this._leftIndent},u=function(){return this._alldayTemplate="{{for cols ~colspan=colspan ~userTemp=userTemp ~allDayHtml=userHtml}}{{if ~userTemp==true}}{{:~allDayHtml[#getIndex()]}}{{/if}}{{/for}}",this._alldayTemplate},m=function(){return this._workCellsTemplate="{{for cellrows ~timesc=timeScale ~cols1=cols1 ~userTemp=userTemplate ~userHtml=userHtml}}{{for ~index=#index ~cwidth=cwidth ~cheight=cheight ~cols1 ~value=#getIndex()}}{{if ((~index+1) % ~timesc) == 0 }}{{/for}}{{/for}}
    {{else}}{{/if}}
    {{if ~userTemp == true}}{{:~userHtml[~value][#getIndex()]}}{{/if}}
    ",this._workCellsTemplate},p=function(){return this._timeCellsTemplate="
    {{for timerows ~timesc=timeScale ~cols1=cols1 ~view1=viewclass ~userTemplateId = userTemplateId ~timeValue1=timeValue1 ~template=template}}{{for ~name=time ~id=id ~view=~view1 ~index=#index }} {{if ~view == 0}}{{if ~userTemplateId==true}}{{else}}{{/if}} {{else}}{{/if}}{{/for}}{{/for}}
    {{for ~cols1[~index] }}{{if (#index+1)% ~timesc ==0}}
    {{:~timeValue1[~index][#getIndex()]}}
    {{else}}
    {{:~timeValue1[~index][#getIndex()]}}
    {{/if}}{{/for}}
    {{if ~template==true}}{{:~name}}{{else}}{{:~name.slice(0,2)}}{{/if}}
    {{for ~cols1[~index] }}{{if (#index+1)% ~timesc ==0}}
    {{else}} {{if (#getIndex())== 0}}
    {{if ~template ==true || ~userTemplateId==true }}{{else}}{{:~name.slice(3,6)}}{{/if}}
    {{else}}
    {{/if}} {{/if}}{{/for}}
    ",this._timeCellsTemplate},g=function(){return this._userTimeCellsTemplate="
    {{for timerows ~timesc=timeScale ~cols1=cols1 ~view1=viewclass ~userTemplateId = userTemplateId ~timeValue1=timeValue1 ~template=template ~cheight = cheight}}{{for ~cols1 ~name=time ~id=id ~view=~view1 ~index=#index ~timeSc=~timesc}}{{if (#getIndex()+2)% ~timeSc ==0}} {{else}}{{/if}}{{/for}}{{/for}}
    {{:~timeValue1[#getIndex()][0]}}
    {{:~timeValue1[~index][#getIndex()+1]}}
    {{:~timeValue1[~index][#getIndex()+1]}}
    ",this._userTimeCellsTemplate},_=function(){return this._agendaHeaderTemplate="{{for cols}}
    {{:headertext}}
    {{/for}}",this._agendaHeaderTemplate},f=function(){return this._agendaCellsTemplate="{{for cols}}{{if resGroup}}{{for resGroup}}{{/for}}{{/if}}{{if resChild}}{{/if}}{{if dayChild}}{{/if}}{{/for}}
    {{:text}}
    {{if userResourceId == false}}{{:resName}}{{else}}{{:userResourceHtml}}{{/if}}
    {{if userDateId == false}}{{:date}}{{else}}{{:userDateHtml}}{{/if}}
    {{if userTimeId == false}}{{:time}}{{else}}{{:userTimeHtml}}{{/if}}
    {{if userAppTemplId == false}}{{:event}}{{else}}{{:userTemplate}}{{/if}}{{if readOnly == false}}
    {{/if}}
    ",this._agendaCellsTemplate};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:null,minorSlotCount:2,majorSlot:60,minorSlotTemplateId:null,majorSlotTemplateId:null},startHour:0,endHour:24,highlightBusinessHours:!0,enableLoadOnDemand:!1,enablePersistence:!1,showQuickWindow:!0,showLocationField:!1,businessStartHour:9,businessEndHour:18,workHours:{highlight:null,start:null,end:null},width:"100%",height:"1120px",cellHeight:"20px",cellWidth:"",currentDate:new Date,minDate:new Date(1900,1,1),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,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,appointmentSettings:{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:{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:{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"}}},_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.resources","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"],_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(){e.isEmptyObject(this.model.group)&&(this.model.group=null),this._localizedLabels=t.getLocalizedConstants("ej.Schedule",this.model.locale),"en-US"!=this.model.locale&&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"),!t.isNullOrUndefined(this.model.appointmentSettings.query)&&this.model.appointmentSettings.query instanceof t.Query||(this.model.appointmentSettings.query=t.Query()),null!=this.model.cssClass&&this.element.addClass(this.model.cssClass),this._initPrivateProperties(),!t.isNullOrUndefined(this.model.categorizeSettings)&&this.model.categorizeSettings.dataSource instanceof t.DataManager&&this._bindCategorizeData(),!t.isNullOrUndefined(this.model.prioritySettings)&&this.model.prioritySettings.dataSource instanceof t.DataManager&&this._bindPriorityData(),t.scheduleFeatures.resources&&!t.isNullOrUndefined(this.model.resources)?this._bindResourcesData():this._renderInitSchedule(),this._wireEvents(),t.isNullOrUndefined(this.model.appointmentSettings)||(this._dataManager=this.dataSource()instanceof t.DataManager?this.dataSource():null!=this.dataSource()?t.DataManager(this.dataSource()):null),this._bindAppointmentsData("Load"),this.model.enableRTL&&this.element.addClass("e-rtl"),this.model.reminderSettings.enable&&(this._checkReminders(),this._reminderInterval=window.setInterval(e.proxy(this._checkReminders,this),6e4)),this._businessHourScroller()},_processAppointmentSettings:function(){var i,s,a;this._appointmentSettings={},resource="";for(i in this.model.appointmentSettings)if("tableName"!==i&&"query"!==i&&"dataSource"!==i&&(this._appointmentSettings[i]="string"==e.type(this.model.appointmentSettings[i])||t.isNullOrUndefined(this.model.appointmentSettings[i])?this.model.appointmentSettings[i]:this.model.appointmentSettings[i].field,"resourceFields"!==i&&"categorize"!==i&&"priority"!==i&&t.isNullOrUndefined(this._appointmentSettings[i])&&(this._appointmentSettings[i]=i.charAt(0).toUpperCase()+i.slice(1)),"resourceFields"==i&&t.isNullOrUndefined(this._appointmentSettings.resourceFields)&&!t.isNullOrUndefined(this.model.resources)))for(s=0,a=this.model.resources.length;sthis.model.maxDate&&this.currentDate(this.model.maxDate),this._navigateClick(null,"DateNavigation");break;case"minDate":case"maxDate":this._currentDateFormat(this.model.dateFormat),d=!0;break;case"timeMode":this.model.timeMode=this._timeMode=i[s],this._updateTimeMode();break;case"timeZone":this._setmodelvalue=!0,this.model.timeZone=i[s],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"timeScale":e.extend(this.model.timeScale,i[s]),d=!0;break;case"timezoneCollection":case"timeZoneCollection":e.extend(this.model.timeZoneCollection,i[s]),this._appointmentAddWindow.find(".startutc").ejDropDownList({dataSource:this.model.timeZoneCollection.dataSource}),this._appointmentAddWindow.find(".endutc").ejDropDownList({dataSource:this.model.timeZoneCollection.dataSource});break;case"startHour":this.model.startHour=i[s],this.model.startHour<0&&(this.model.startHour=0),"agenda"!==this.currentView()&&this._setNewStartEndHours();break;case"endHour":this.model.endHour=i[s],this.model.endHour>24&&(this.model.endHour=24),"agenda"!==this.currentView()&&this._setNewStartEndHours();break;case"highlightBusinessHours":this.model.workHours.highlight=i[s],"agenda"!==this.currentView()&&(this.model.workHours.highlight?this._highlightBusinessHours():this.element.find(".e-workcells").removeClass("e-businesshighlightworkcells")&&this.element.find(".e-monthcells").removeClass("e-monthcellhighlight"),0==this.model.workHours.highlight?this._businessHourScroller():"");break;case"workHours":e.extend(this.model.workHours,i[s]),"agenda"!==this.currentView()&&(this.model.workHours.highlight?this._highlightBusinessHours():this.element.find(".e-workcells").removeClass("e-businesshighlightworkcells")&&this.element.find(".e-monthcells").removeClass("e-monthcellhighlight"),0==this.model.workHours.highlight?this._businessHourScroller():"");break;case"showAllDayRow":this.model.showAllDayRow=i[s],this.model.timeScale.enable||(this.model.showAllDayRow=!1),"vertical"==this.model.orientation&&this.model.timeScale.enable&&"agenda"!=this.currentView()&&"month"!=this.currentView()&&!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(),"vertical"==this.model.orientation&&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[s],this._onScheduleResize();break;case"isDST":this.model.isDST=i[s],t.isNullOrUndefined(this.model.timeZone)&&(a=new Date,this._timeValue=0==this._true?-(a.getTimezoneOffset()-this._stdTimezoneOffset()):a.getTimezoneOffset()-this._stdTimezoneOffset(),this._true=1!=this.model.isDST,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():null!=this.dataSource()?t.DataManager(this.dataSource()):null),this._bindAppointmentsData("Load"));break; case"enableRecurrenceValidation":this.model.enableRecurrenceValidation=i[s],this.model.enableRecurrenceValidation&&t.isNullOrUndefined(this._alertWindow)&&this._renderAlertWindow(),this._dataProcessing(this._currentAppointmentData),this._renderAppointmentAll();break;case"businessStartHour":this.model.workHours.start=i[s],"agenda"!==this.currentView()&&("month"===this.currentView()||this._isCustomMonthView()?this.element.find(".e-monthcells").removeClass("e-monthcellhighlight"):this.element.find(".e-workcells").removeClass("e-businesshighlightworkcells"),this.model.workHours.highlight&&this._highlightBusinessHours());break;case"businessEndHour":this.model.workHours.end=i[s],"agenda"!==this.currentView()&&("month"===this.currentView()||this._isCustomMonthView()?this.element.find(".e-monthcells").removeClass("e-monthcellhighlight"):this.element.find(".e-workcells").removeClass("e-businesshighlightworkcells"),this.model.workHours.highlight&&this._highlightBusinessHours());break;case"height":this.model.height=i[s],this.model.showCurrentTimeIndicator&&this.element.find(".e-highlightcurrenttimeline").remove(),d=!0;break;case"width":this.model.width=i[s],this._clientWidth=this.model.width,this.model.showCurrentTimeIndicator&&this.element.find(".e-highlightcurrenttimeline").remove(),d=!0;break;case"cssClass":this.element.removeClass(this.model.cssClass).addClass(i[s]);break;case"locale":this.model.locale=i[s],this._localizedLabels=t.getLocalizedConstants("ej.Schedule",this.model.locale),"en-US"!=this.model.locale&&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&&(e("#"+this._id+"gotoWindow_wrapper").remove(),this._gotoDate=!0),d=!0;break;case"dateFormat":this._appointmentAddWindow.find(".startenddate").ejDatePicker({dateFormat:i[s]}),this._appointmentAddWindow.find(".recurstartdate").ejDatePicker({dateFormat:i[s]}),this._appointmentAddWindow.find(".e-until").ejDatePicker({dateFormat:i[s]}),this._currentDateFormat(i[s]);break;case"enableResize":this.model.enableResize=i[s],this.model.enableResize&&(t.isTouchDevice()?this._on(e(window),"orientationchange",e.proxy(this._onScheduleResize,this)):this._on(e(window),"resize",e.proxy(this._onScheduleResize,this)));break;case"readOnly":this.model.readOnly=i[s],this._renderAppointmentAll();break;case"showCurrentTimeIndicator":this.model.showCurrentTimeIndicator=i[s],"agenda"!==this.currentView()&&(this._highlightCurrentTime(this.model.showCurrentTimeIndicator),this.model.showCurrentTimeIndicator||("month"===this.currentView()||this._isCustomMonthView()?e(this.element.find(".e-monthcells")).removeClass("e-monthcurrenttime"):this.element.find(".e-highlightcurrenttimeline").remove()));break;case"enableRTL":i[s]?this.element.addClass("e-rtl"):this.element.removeClass("e-rtl"),this.model.enableRTL=i[s],d=!0,this.model.contextMenuSettings.enable&&(e("#"+this._id+"gotoWindow_wrapper").remove(),this._gotoDate=!0),this._quickAppointWindow=null;break;case"appointmentTemplateId":this.model.appointmentTemplateId=i[s],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[s],d=!0;break;case"dateHeaderTemplateId":this.model.dateHeaderTemplateId=i[s],d=!0;break;case"workCellsTemplateId":this.model.workCellsTemplateId=i[s],d=!0;break;case"allowKeyboardNavigation":this.model.allowKeyboardNavigation=i[s],this.model.allowKeyboardNavigation?(this._on(this.element,"keydown",e.proxy(this._onKeyDown,this)),this._on(e(document),"keydown",e.proxy(this._documentOnKeyDown,this))):(this._off(this.element,"keydown"),this._off(e(document),"keydown"));break;case"renderDates":this._renderDate=!0,e.extend(this.model.renderDates,i[s]),this._navView=!0,this._navigate=!1,this._viewChange(null,null,"customview");break;case"showTimeScale":this.model.timeScale.enable=i[s],this.model.timeScale.enable?(this.model.showAllDayRow?this.model.showAllDayRow=!0:"",this.model.showCurrentTimeIndicator?this.model.showCurrentTimeIndicator=!0:""):(this.model.showAllDayRow=!1,this.model.showCurrentTimeIndicator=!1),"agenda"!==this.currentView()&&(d=!0);break;case"appointmentSettings":e.isEmptyObject(i[s])||(e.extend(this.model.appointmentSettings,i[s]),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():null!=this.dataSource()?t.DataManager(this.dataSource()):null),this._bindAppointmentsData("Load"));break;case"contextMenuSettings":e.extend(this.model.contextMenuSettings,i[s]),this.model.contextMenuSettings.enable&&t.isNullOrUndefined(this._contextMenu)&&this._showContextMenu(this.model.contextMenuSettings.enable);break;case"reminderSettings":i[s].enable?this._checkReminders()&&(this._reminderInterval=window.setInterval(e.proxy(this._checkReminders,this),6e4)):window.clearInterval(this._reminderInterval);break;case"showAppointmentNavigator":case"enableAppointmentNavigation":this.model.showAppointmentNavigator=this.model.enableAppointmentNavigation=i[s],this.model.showAppointmentNavigator?(this._nextPrevAppointment(this.model.showAppointmentNavigator),"vertical"==this.model.orientation&&this.element.find(".e-vscroll").length>0&&"month"!=this.currentView()&&!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[s],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[s]),this.model.resources=i[s],0==this.model.resources.length?(this.model.resources=null,this.model.group=null,d=!0):(d=!0,h=!0));break;case"categorizeSettings":e.extend(this.model.categorizeSettings,i[s]),t.isNullOrUndefined(this.model.categorizeSettings)||(this.model.categorizeSettings.enable?(1==this._appointmentAddWindow.find(".e-categorizevalue").length&&this._appointmentAddWindow.find("#"+this._id+"categorizetr").remove(),n=""+this._getLocalizedLabels("Categorize")+":",this._appointmentAddWindow.find("."+this._id+"summary").after(n),this._renderTemplates(),l=this._appointmentAddWindow,this._renderCategoryItems(l)):this._appointmentAddWindow.find("#"+this._id+"categorizetr").remove(),this._showContextMenu(this.model.contextMenuSettings.enable),this._appointmentAddWindow.find(".e-categorizevalue").ejAutocomplete("clearText"),l=this._appointmentAddWindow,this._renderCategoryItems(l),t.isNullOrUndefined(this.dataSource())||this._renderAppointmentAll());break;case"group":t.scheduleFeatures.resources&&!t.isNullOrUndefined(this.model.resources)&&(e.extend(this.model.group,i[s]),e.isEmptyObject(this.model.group)&&(this.model.group=null),d=!0,h=!0);break;case"cellWidth":this.model.cellWidth=i[s],this.model.showCurrentTimeIndicator&&this.element.find(".e-highlightcurrenttimeline").remove(),"agenda"!==this.currentView()&&(d=!0);break;case"cellHeight":this.model.cellHeight=i[s],this.model.showCurrentTimeIndicator&&this.element.find(".e-highlightcurrenttimeline").remove(),"agenda"!==this.currentView()&&(d=!0);break;case"orientation":this.model.orientation=i[s],!t.scheduleFeatures.resources||t.isNullOrUndefined(this.model.resources)||t.isNullOrUndefined(this.model.group)||"horizontal"!=this.model.orientation||this._on(this.element,"click",".e-parentnodecategory",e.proxy(this._onResourceClick,this)),d=!0;break;case"resourceHeaderTemplateId":this.model.resourceHeaderTemplateId=i[s],!t.scheduleFeatures.resources||t.isNullOrUndefined(this.model.group)||t.isNullOrUndefined(this.model.resources)||("agenda"!=this.currentView()?"horizontal"==this.model.orientation?(o=e(this.wTR.find("td")[0]),o.find("div.e-horizontresdiv").remove(),r=this._renderHorizontalResources(),o.html(r)):(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[s],this.model.showLocationField?(n=""+this._getLocalizedLabels("Location")+":",this._appointmentAddWindow.find("."+this._id+"subjecttr").after(n)):this._appointmentAddWindow.find("."+this._id+"showLocation").remove();break;case"prioritySettings":e.extend(this.model.prioritySettings,i[s]),this.model.prioritySettings.enable?(0==this._appointmentAddWindow.find("."+this._id+"priorityshow").length&&(n=""+this._getLocalizedLabels("Priority")+":
    ",this._appointmentAddWindow.find("."+this._id+"parrow").prepend(n)),l=this._appointmentAddWindow,this._renderPriorityItems(l),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[s],this.model.showQuickWindow&&t.isNullOrUndefined(this._quickAppointWindow)&&(this._renderQuickAppWindow()||this._renderQuickAppDetailsView()),e.isFunction(e.validator)&&this._setQuickValidation(),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[s],"agenda"==this.currentView())return!1;this.model.allowDragAndDrop?this._dragdropAppointments():this._unWireDragDrop();break;case"enableAppointmentResize":if(this.model.enableAppointmentResize=i[s],"agenda"==this.currentView())return!1;this._renderAppointmentAll();break;case"showHeaderBar":this.model.showHeaderBar=i[s],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":e.extend(this.model.tooltipSettings,i[s]),!t.isNullOrUndefined(this.model.tooltipSettings)&&this.model.tooltipSettings.enable?(this._on(this.element,"mouseover",".e-appointment,.e-alldayappointment,.e-monthappointment",e.proxy(this._showToolTip,this)),this._on(this.element,"mouseout",".e-appointment,.e-alldayappointment,.e-monthappointment",e.proxy(this._hideToolTip,this))):(this._off(this.element,"mouseover",".e-appointment,.e-alldayappointment,.e-monthappointment",e.proxy(this._showToolTip,this)),this._off(this.element,"mouseout",".e-appointment,.e-alldayappointment,.e-monthappointment",e.proxy(this._hideToolTip,this)));break;case"showOverflowButton":this.model.showOverflowButton=i[s],d=!0;break;case"appointmentDragArea":this.model.appointmentDragArea=i[s],d=!0;break;case"firstDayOfWeek":this.model.firstDayOfWeek=this._firstdayofweek=i[s],this._firstdayofweek&&(d=!0);break;case"workWeek":this.model.workWeek=i[s],(null==this.model.workWeek||this.model.workWeek.length>=0)&&(d=!0);break;case"agendaViewSettings":e.extend(this.model.agendaViewSettings,i[s]),"agenda"==this.currentView()&&(this.model.showHeaderBar&&(this.element.find("div.e-datedisplay")[0].innerHTML=this._getCurrentDateHeaderValue()),this._renderAgendaContent());break;case"showNextPrevMonth":this.model.showNextPrevMonth=i[s],"vertical"==this.model.orientation&&"month"==this.currentView()&&(this._renderMonthTimeCells(),this._highlightBusinessHours(),this._dataProcessing(this._currentAppointmentData),this._renderAppointmentAll())}d&&(this.element.empty(),this._scheduleDrawer=null,e("#"+this._id+"AppointmentAddEditWindow_wrapper,#"+this._id+"AppointmentQuickWindow_wrapper,#"+this._id+"AppDetailsWindow_wrapper,#"+this._id+"RecurrenceEdit_wrapper").remove(),h?this._bindResourcesData():this._renderInitSchedule(),1==this.model.workHours.highlight?this._businessHourScroller():"",t.isNullOrUndefined(this.dataSource())||0!=this._firstdayofweek&&this._dataProcessing(this._currentAppointmentData),this._renderAppointmentAll())},_touchSchedule:function(t){if(e(t.target).is(".e-appointment,.e-alldayappointment,.e-monthappointment")||e(t.target).parents().is(".e-appointment,.e-alldayappointment,.e-monthappointment"))return!1;var i,s=parseInt(this.element.find(".e-draggableworkarea").css("margin-left")),a=Math.round(this.element.find(".e-draggableworkarea").width()/this.res1.length);switch(t.type){case"swipeleft":if(this._mediaQuery&&"agenda"!=this.currentView()){if(-s0)return this.element.find(".e-headeralldaydiv,.e-draggableworkarea").animate({"margin-left":s+a},500),!1;this.element.find(".e-headeralldaydiv,.e-draggableworkarea,.e-emptyscrolltd").css("margin-left",-(this.element.find(".e-draggableworkarea").width()-a))}i={currentTarget:this.element.find(".e-navigateprevious")},this._navigateClick(i,"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._navigate=this._navigate=!1,this._gotoDate=this._bindapp=!0,this._tempStart=this._tempEnd=this._currentAction="",this._currentRowIndex=this._currentColIndex=0,this._appId=this._parentId=this._splitId=1,this.overlapList=this._currentAppointmentData=this._processed=this._dateRender=this._app=[],this.res1=[0],this._appMainId=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="webkit"==this._browserInfo.name&&!t.isTouchDevice(),this._focused=null},_destroy:function(){this.element.off(),this._destorySubControls(e("#"+this._id+"_AddEditForm")),this._destorySubControls(e("#"+this._id+"_RecurForm")),this.element.find("#"+this._id+"_navigator").ejDatePicker("destroy"),window.clearInterval(this._intervalID),e("#"+this._id+"AppointmentAddEditWindow_wrapper,#"+this._id+"AppointmentQuickWindow_wrapper,#"+this._id+"AppDetailsWindow_wrapper,#"+this._id+"RecurrenceEdit_wrapper,#"+this._id+"gotoWindow_wrapper").remove(),e("#"+this._id+"_WorkCells_Template,#"+this._id+"_MonthCells_Template,#"+this._id+"_TimeCells_Template,#"+this._id+"_HeaderDate_Template,#"+this._id+"_Appointment_Template,#"+this._id+"_AlldayCells_Template,#"+this._id+"_LeftIndentCells_Template,#"+this._id+"_AgendaCells_Template,#"+this._id+"_userTimeCells_Template").remove(),this.element.empty().removeClass("e-schedule")},_destorySubControls:function(t){for(var i,s=t.find(".e-timepicker,.e-datepicker,.e-dropdownlist,.e-autocomplete"),a=0;athis.element.find(".e-until").ejDatePicker("option","value"))return this._alertWindow.find(".e-alerttext").html(this._getLocalizedLabels("WrongPattern")),this._alertWindow.ejDialog("open"),!1;if(e.model.text==this._getLocalizedLabels("Cancel"))""==this._appointmentAddWindow.find(".e-recurFinalRule").html()&&this._appointmentAddWindow.find("#"+this._id+"recurrence").ejCheckBox({checked:!1});else{var t=this._appointmentAddWindow.find(".e-recurEditor").data("ejRecurrenceEditor"),i=t.closeRecurPublic(),s=t.element.find("#recurstartdate").ejDatePicker("option","value");new Date(this._appointmentAddWindow.find("#"+this._id+"startdate").ejDatePicker("option","value")).getTime()!=new Date(s).getTime()&&this._recurDateChange(s),this._appointmentAddWindow.find("."+this._id+"summary").css("display","table-row"),this._appointmentAddWindow.find(".e-recurFinalRule").html(i),this._appointmentAddWindow.find(".e-recuredit").css("display","inline"),recurOption=""}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,e(window)),"mousedown",e.proxy(this._onScheduleMouseDown,this)),this._on(this.element,"click","div.e-navigateprevious,div.e-navigatenext",e.proxy(this._navigateClick,this)),this._on(e(window),"resize",e.proxy(this._onScheduleResize,this)),this._on(this.element,"click",".e-commonviewbutton",e.proxy(this._viewChange,this)),this._on(this.element,"click",".e-datedisplay",e.proxy(this._viewCalendar,this)),this._on(this.element,"click","div.e-appsoverflow",e.proxy(this._appOverflowClick,this)),this._on(this.element,"click",".e-prevapp.enable,.e-nextapp.enable",e.proxy(this._nextPrev,this)),this._on(this.element,"dblclick",".e-headercells",e.proxy(this._navigateView,this)),this._on(this.element,"click",".e-headercells,.e-timecells,td.e-monthcells div.e-monthheader",e.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",e.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",e.proxy(this._onCellMouseOver,this)),this._on(this.element,"click",".e-workcells,.e-alldaycells,.e-alldayappointment,.e-monthcells:not('.e-othermonths'),.e-agendacells",e.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",e.proxy(this._mouseButtonClick,this)),this._on(this.element,"keydown click","td.e-workcells,td.e-monthcells:not('.e-othermonths'),td.e-alldaycells",e.proxy(this._shiftSelection,this))),this._on(this.element,t.isMobile()?"click":"dblclick",".e-workcells:not('.e-resourceheadercells'),.e-alldaycells,.e-alldayappointment,.e-monthcells:not('.e-othermonths'),.e-agendacells.e-eventcolumn,.e-agendacells.e-timecolumn",e.proxy(this._appointmentWindow,this)),(this._mediaQuery||t.isMobile())&&this._on(this.element,"tap",".e-appointment,.e-alldayappointment,div.e-monthappointment,.e-agendaappointment",e.proxy(this._appointmentWindow,this)),this._on(this.element,"mouseover",".e-appointment,.e-alldayappointment,.e-monthappointment,.e-agendaappointment",e.proxy(this._onAppointMouseOver,this)),this._on(this.element,"mouseout",".e-appointment,.e-alldayappointment,.e-monthappointment,.e-agendaappointment",e.proxy(this._onAppointMouseOver,this)),this._on(this.element,"mouseover",".e-appointment,.e-alldayappointment,.e-monthappointment,.e-eventcolumn",e.proxy(this._showToolTip,this)),this._on(this.element,"mouseout",".e-appointment,.e-alldayappointment,.e-monthappointment,.e-eventcolumn",e.proxy(this._hideToolTip,this)),this._on(this.element,"mouseover",".e-appsoverflow",e.proxy(this._showAppCount,this)),this._on(this.element,"mouseout",".e-appsoverflow",e.proxy(this._hideAppCount,this)),this._on(this.element,"mouseover",".e-appup,.e-appdown",e.proxy(this._renderIconTooltip,this)),this._on(this.element,"mouseout",".e-appup,.e-appdown",e.proxy(this._renderIconTooltip,this)),this._on(this.element,"click",".e-appup,.e-appdown",e.proxy(this._renderAppPosition,this)),(this._mediaQuery||this.element.width()<600)&&this._on(this.element,"click","#"+this._id+"navDrawerIcon",e.proxy(this._drawerOpen,this)),this.model.allowKeyboardNavigation&&(this._on(this.element,"keydown",e.proxy(this._onKeyDown,this)),this._on(e(this.element),"keydown",e.proxy(this._documentOnKeyDown,this))),"horizontal"==this.model.orientation&&this._on(this.element,"click",".e-parentnodecategory",e.proxy(this._onResourceClick,this)),(this._mediaQuery||t.isTouchDevice())&&this._on(this.element,"swipeleft swiperight",".e-contentarearow .e-workcellstab,.e-agendacellstab",e.proxy(this._touchSchedule,this)),this.model.enableResize&&(t.isTouchDevice()?this._on(e(window),"orientationchange",e.proxy(this._onScheduleResize,this)):this._on(e(window),"resize",e.proxy(this._onScheduleResize,this))),this._on(this.element,"click",".e-schedulemouseclose,.e-deleteapp",e.proxy(this._deleteAppoint,this)),this._on(this.element,"click",".e-editapp",e.proxy(this._appointmentWindow,this))},_drawerOpen:function(){this._scheduleDrawer.ejNavigationDrawer("open")},_mouseButtonClick:function(i){var s,a,n;if(!(i.altKey||i.shiftKey||i.ctrlKey||3==i.which||1!=i.which&&"touchstart"!=i.type||e(i.target).hasClass("e-resourceheadercells")||e(i.target).hasClass("e-othermonths"))){var o=i.target||document.activeElement||i.srcElement,r=this.element.find("div.e-draggableworkarea tr"),l=this;e(o).hasClass("e-alldaycells")&&(r=this.element.find(".e-alldaycells").parent()),e(o).hasClass("e-selectedAppointment")&&(this.element.find(".e-selectedAppointment").removeClass("e-selectedAppointment"),e(r[0].cells[0]).addClass("e-selectedCell").attr("tabIndex",0).focus()),this._currentRowIndex=e(o).parent()[0].rowIndex,this._currentColIndex=e(o)[0].cellIndex,s="horizontal"==l.model.orientation&&"month"==l.currentView()?l.monthDays:"vertical"==l.model.orientation?l.dateRender:l._dateRender,a=e(i.target).hasClass("e-workcells")||e(i.target).hasClass("e-alldaycells")?e(i.target).index():7-(7*(parseInt(e(i.target).index()/7)+1)-e(i.target).index())+7*e(i.target).parent().index(),"horizontal"==this.model.orientation&&(a="month"!==l.currentView()?Math.floor(a/((this.model.endHour-this.model.startHour)*this.model.timeScale.minorSlotCount*(60/this.model.timeScale.majorSlot))):a),n=new Date(s[a]),n>=this.model.minDate&&n<=this.model.maxDate&&(e(o).hasClass("e-workcells")||e(o).hasClass("e-monthcells")||e(o).hasClass("e-alldaycells"))&&(r.bind(t.eventType.mouseMove,function(t){var i,s;l.model.showQuickWindow&&l._quickAppointWindow.ejDialog("close")&&l._quickAppDetailsWindow.ejDialog("close"),t.preventDefault(),i=t.target,"touchmove"==t.type&&(s=t.originalEvent.changedTouches[0],i=document.elementFromPoint(s.pageX,s.pageY)),e(i).hasClass("e-selectedCell")&&l.element.find(".e-workcells,.e-alldaycells,.e-monthcells").removeClass("e-selectedCell"),l._mouseSelection(t,l,o,i),l._moveScrollContent(o,l)}),r.bind(t.eventType.mouseUp,function(){r.unbind(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(t,i,s,a){var n,o,r,l,d,h=i.element.find("div.e-draggableworkarea tr"),c=e(s).parent()[0].rowIndex,u=e(s)[0].cellIndex,m=h.length-1,p=e(a).parent()[0].rowIndex,g=e(a)[0].cellIndex,_=i.element.find(".e-alldaycells").parent(),f=i.model.showAllDayRow,b="horizontal"==i.model.orientation?h[0].cells.length:"month"==i.currentView()||i._isCustomMonthView()?h[0].cells.length/i.res1.length:i._dateRender.length,v=Math.floor(e(a).index()/b),x=b*(v+1),w=b*v;if(e(a).hasClass("e-workcells"))if("vertical"==i.model.orientation){if(!(u>=parseInt(w)&&u<=parseInt(x)-1&&"undefined"!=g))return!1;if(u==g)if(p>c)for(r=parseInt(c);r<=p;r++)e(h[r].cells[u]).addClass("e-selectedCell");else if(p=p;r--)e(h[r].cells[u]).addClass("e-selectedCell");else e(h[p].cells[g]).addClass("e-selectedCell");else if(g>u){for(d=g-u,n=parseInt(c);n<=m;n++)e(h[n].cells[u]).addClass("e-selectedCell");if(f&&e(_[0].cells[[u]]).addClass("e-selectedCell"),f&&e(_[0].cells[[g]]).addClass("e-selectedCell"),d>1)for(r=1;r<=d-1;r++){for(l=0;l<=m;l++)e(h[l].cells[g-r]).addClass("e-selectedCell");f&&e(_[0].cells[[g-r]]).addClass("e-selectedCell")}for(o=0;o<=p;o++)e(h[o].cells[g]).addClass("e-selectedCell")}else if(g=0;n--)e(h[n].cells[u]).addClass("e-selectedCell");if(f&&e(_[0].cells[[u]]).addClass("e-selectedCell"),f&&e(_[0].cells[[g]]).addClass("e-selectedCell"),d>1)for(r=1;r<=d-1;r++){for(l=0;l<=m;l++)e(h[l].cells[[g+r]]).addClass("e-selectedCell");f&&e(_[0].cells[[g+r]]).addClass("e-selectedCell")}for(o=parseInt(p);o<=m;o++)e(h[o].cells[g]).addClass("e-selectedCell")}i._currentRowIndex=p,i._currentColIndex=g,e(h[p].cells[g]).addClass("e-selectedCell").attr("tabIndex",0).focus()}else{if(!(c==p&&u>=parseInt(w)&&u<=parseInt(x)-1&&"undefined"!=g))return!1;if(g>u)for(o=u;o<=g;o++)e(h[p].cells[o]).addClass("e-selectedCell").attr("tabIndex",0).focus();else if(g<=u)for(o=u;o>=g;o--)e(h[p].cells[o]).addClass("e-selectedCell").attr("tabIndex",0).focus()}else if(e(a).hasClass("e-alldaycells")){if(!(u>=parseInt(w)&&u<=parseInt(x)-1&&"undefined"!=g))return!1;if(g=g;r--)e(_[0].cells[r]).addClass("e-selectedCell");else if(g>u)for(r=u;r<=g;r++)e(_[0].cells[r]).addClass("e-selectedCell");i._currentRowIndex=0,i._currentColIndex=g,e(_[0].cells[g]).addClass("e-selectedCell").attr("tabIndex",0).focus()}else if(e(a).hasClass("e-monthcells")){if(e(a).hasClass("e-othermonths"))return!1;if(!(u>=parseInt(w)&&u<=parseInt(x)-1&&"undefined"!=g))return!1;if(p==c)if(g=g;r--)e(h[p].cells[r]).addClass("e-selectedCell");else if(g>u)for(r=u;r<=g;r++)e(h[p].cells[r]).addClass("e-selectedCell");else g==u&&e(h[p].cells[g]).addClass("e-selectedCell");else if(p>c){for(d=p-c,n=u;n1)for(r=1;r<=d-1;r++)for(n=w;n=w;n--)e(h[c].cells[n]).addClass("e-selectedCell");if(d>1)for(r=1;r<=d-1;r++)for(n=w;n=g;o--)e(h[p].cells[o]).addClass("e-selectedCell")}i._currentRowIndex=p,i._currentColIndex=g,e(h[p].cells[g]).addClass("e-selectedCell").attr("tabIndex",0).focus()}},_shiftSelection:function(t){var i,s,a;if(1==t.shiftKey&&1==t.which&&!e(t.target).hasClass("e-resourceheadercells")){var n=this._focused,o=this,r=t.target;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"),i="horizontal"==this.model.orientation&&"month"==this.currentView()?this.monthDays:"vertical"==this.model.orientation?this.dateRender:this._dateRender,s=e(t.target).hasClass("e-workcells")||e(t.target).hasClass("e-alldaycells")?e(t.target).index():7-(7*(parseInt(e(t.target).index()/7)+1)-e(t.target).index())+7*e(t.target).parent().index(),"horizontal"==this.model.orientation&&(s="month"!==this.currentView()?Math.floor(s/((this.model.endHour-this.model.startHour)*this.model.timeScale.minorSlotCount*(60/this.model.timeScale.majorSlot))):s),a=new Date(i[s]),a>=this.model.minDate&&a<=this.model.maxDate&&this._mouseSelection(t,o,n,r)}},_moveScrollContent:function(i,s){var a,n,o;"horizontal"===s.model.orientation?(a=s.element.find(".e-draggableworkarea").scrollLeft(),a=s.model.enableRTL?"mozilla"==t.browserInfo().name?a>0?a:a*-1:"chrome"==t.browserInfo().name||"webkit"==t.browserInfo().name?s.element.find(".e-workcells")[0].offsetLeft+s.element.find(".e-workcells").width()-s.element.find(".e-draggableworkarea").scrollLeft()-s.element.find(".e-draggableworkarea").width():Math.abs(a):-a,"month"!=s.currentView()?e(s.element.find(".e-horizontaltimecells").find("table tr")[2]).css("left",a+"px"):s.element.find(".e-headerdays").css("left",a+"px"),"day"===s.currentView()||"month"===s.currentView()||"customview"==s.currentView()&&s._dateRender.length>7||!s.model.timeScale.enable||(n=e(s.element.find(".e-headercells").find(".e-activeview").parent()).index(),o=Math.floor(Math.abs(a)/(s.element.find(".e-workcells").width()+1)/(2*(s.model.endHour-s.model.startHour))),n!==o&&s.element.find(".e-headercells").children().removeClass("e-activeview"),e(s.element.find(".e-headercells")[o]).children().addClass("e-activeview"))):e(i).hasClass("e-monthcells")||s.element.find(".e-scrolltimecells").css("top",-s.element.find(".e-draggableworkarea").scrollTop()+"px")},_onScheduleMouseDown:function(t){var i=e(t.target),s=i.hasClass("e-appointment,e-alldayappointment,e-monthappointment")?i:i.parents(".e-appointment,.e-alldayappointment,.e-monthappointment");i.hasClass("e-workcells")||s.hasClass("e-appointment")||s.hasClass("e-alldayappointment")||s.hasClass("e-monthappointment")||i.hasClass("e-alldaycells")||i.hasClass("e-monthcells")||i.parents(".e-scheduledialog").hasClass("e-scheduledialog")||(this.model.showQuickWindow&&this._quickAppointWindow.ejDialog("close")&&this._quickAppDetailsWindow.ejDialog("close"),this.element.find(".e-workcells").removeClass("e-mousehover"))},_onCellMouseOver:function(i){var s,a;if("agenda"==this.currentView()){if(1==this._mediaQuery)return!1;s=e(i.currentTarget),"mouseover"===i.type?(this.element.find(".e-mousehover").removeClass("e-mousehover"),s.hasClass("e-agendacells")&&(s.parent().find(".e-timecolumn,.e-eventcolumn").addClass("e-mousehover"),s.parent().find(".e-editapp").parent().show())):"mouseout"===i.type&&s.hasClass("e-agendacells")&&(s.parent().find(".e-timecolumn,.e-eventcolumn").removeClass("e-mousehover"), s.parent().find(".e-editapp").parent().hide())}else{s=e(i.currentTarget),a=e(i.target).hasClass("e-workcells")?e(i.target).index():e(i.target).hasClass("e-alldaycells")?e(i.target).index():7-(7*(parseInt(e(i.target).index()/7)+1)-e(i.target).index())+7*e(i.target).parent().index(),"horizontal"==this.model.orientation&&(a="month"!==this.currentView()?Math.floor(a/((this.model.endHour-this.model.startHour)*this.model.timeScale.minorSlotCount*(60/this.model.timeScale.majorSlot))):a);var n="horizontal"==this.model.orientation&&"month"==this.currentView()?this.monthDays:"vertical"==this.model.orientation?this.dateRender:this._dateRender,o=new Date(n[a]),r={currentDate:o,cellIndex:a,target:i,resources:t.isNullOrUndefined(this.model.cellHover)||t.isNullOrUndefined(this.model.resources)?null:this._getResourceValue(s,a)};if(this._trigger("cellHover",r))return!1;if(!(o>=this.model.minDate&&o<=this.model.maxDate))return!1;"mouseover"===i.type?(this.element.find(".e-mousehover").removeClass("e-mousehover"),(s.hasClass("e-workcells")||s.hasClass("e-monthcells"))&&!s.hasClass("e-resourceheadercells")&&s.addClass("e-mousehover")):"mouseout"===i.type&&(s.hasClass("e-workcells")||s.hasClass("e-monthcells"))&&s.removeClass("e-mousehover")}},_getAppDetails:function(i){var s,a,n=e(t.isNullOrUndefined(i.target)?i:i.target),o=n.hasClass("e-appointment")||n.hasClass("e-monthappointment")||n.hasClass("e-alldayappointment")||n.hasClass("e-agendaappointment")?n:n.parents(".e-appointment,.e-alldayappointment,.e-monthappointment,.e-agendaappointment");if(appId=o.attr("guid"),t.isNullOrUndefined(appId))return!1;var r=this._getAppointmentByParentId(appId),l=(new t.Query).where("Guid",t.FilterOperators.equal,appId),d=t.DataManager(this._processed).executeLocal(l);return 1==d[0][this._appointmentSettings.recurrence]?(s=(new t.Query).where("Guid",t.FilterOperators.equal,appId),a=new t.DataManager(this._processed).executeLocal(s)):(s=(new t.Query).where("ParentId",t.FilterOperators.equal,r.ParentId),a=new t.DataManager(this._processed).executeLocal(s)),a[0]},_onAppointMouseOver:function(i){var s,a,n;if(!this.model.readOnly){if(!t.isNullOrUndefined(this.model.appointmentHover)&&(s={appointment:this._getAppDetails(i)},this._trigger("appointmentHover",s)))return!1;if("agenda"==this.currentView()){if(1==this._mediaQuery)return!1;a=e(i.currentTarget),"mouseover"===i.type?(this.element.find(".e-mousehover").removeClass("e-mousehover"),a.hasClass("e-agendaappointment")&&(a.addClass("e-mousehover"),a.find(".e-editapp").parent().show())):"mouseout"===i.type&&a.hasClass("e-agendaappointment")&&(a.removeClass("e-mousehover"),a.find(".e-editapp").parent().hide())}else n=e(i.target).hasClass("e-appointment,e-alldayappointment,e-monthappointment")?e(i.target):e(i.target).parents(".e-appointment,.e-alldayappointment,.e-monthappointment"),n.hasClass("e-appointment")&&"vertical"==this.model.orientation?"mouseover"===i.type?(this.model.enableAppointmentResize&&(n.find(".e-bottomhandle,.e-tophandle").addClass("e-icon e-nsexpand"),n.find(".e-bottomhandle").addClass("e-appointresizer-bottom"),n.find(".e-tophandle").addClass("e-appointresizer-top")),n.find(".e-schedulemouseclose").css("display","block")):"mouseout"===i.type&&(this.model.enableAppointmentResize&&n.find(".e-bottomhandle,.e-tophandle").removeClass("e-icon e-nsexpand"),n.find(".e-schedulemouseclose").css("display","none")):((n.hasClass("e-alldayappointment")||n.hasClass("e-monthappointment"))&&"vertical"==this.model.orientation||"horizontal"==this.model.orientation)&&("mouseover"===i.type?(this.model.enableAppointmentResize&&(n.find(".e-lefthandle,.e-righthandle").addClass("e-icon e-ewexpand"),n.find(".e-lefthandle").addClass("e-appointresizer-left"),n.find(".e-righthandle").addClass("e-appointresizer-right")),n.find(".e-schedulemouseclose").css("display","block")):"mouseout"===i.type&&(this.model.enableAppointmentResize&&n.find(".e-lefthandle,.e-righthandle").removeClass("e-icon e-ewexpand"),n.find(".e-schedulemouseclose").css("display","none")))}},_quickWindowPosition:function(t,i,s,a){var n,o=a.find(".e-tableAppoint"),r=e("#"+a.prop("id")+"_wrapper").width(),l=this.element.offset().left,d=this.element.offset().left+this.element.width(),h=this.element.offset().top,c=this.element.offset().top+this.element.height(),u=s.width()/2,m="rotate(0deg)",p=!0,g="40%",_="4px";return t>l&&t+r>d&&i>h?(t=d-r-5,g=s.offset().left-t+u):th?(t=l+5,g=s.offset().left-t+u):id&&(t=d-r-5,g=s.offset().left-t+u),n=a.prop("id")==this._id+"AppDetailsWindow"?s.height():"horizontal"==this.model.orientation?s.height()/2:s.height()-4,i=s.offset().top+10+n,(ic-e("#"+a.prop("id")+"_wrapper").height())&&(i=h+4,p=!0,m="rotate(0deg)",_="4px")),p?o.removeClass("e-tablePosition"):o.addClass("e-tablePosition"),a.find(".e-quickarrow").css("transform",m).css("top",p?o.outerHeight()+1:0).css("left",g),a.css("top",_),{X:t,Y:i}},_cellSelection:function(s){var a,n,o,r,l,d,h,c,u,m,p,g,_,f,b,v,x,w,y;if(s.shiftKey)return!1;if(this.element.find(".e-scheduletooltip").hide(),this.element.find("e.workcells,e.alldaycells,.e-monthcells,.e-agendacells").removeClass("e-mousehover"),this.element.find(".e-selectedAppointment").removeClass("e-selectedAppointment"),a=e(t.isNullOrUndefined(s.target)?s:s.target),t.isNullOrUndefined(this.model.workCellsTemplateId)&&t.isNullOrUndefined(this.model.allDayCellsTemplateId)||(a=a.hasClass("e-apptime")||a.hasClass("e-appointinnertext")||a.hasClass("e-schedulemouseclose")?e(s.target):a.closest(".e-workcells, .e-alldaycells, .e-monthcells")),a.hasClass("e-appointwrapper")||a.hasClass("e-textwrapper")&&(a=e(a).parent()),t.isNullOrUndefined(s.type)||"beforeOpen"!=s.type?this.element.find(".e-workcells,.e-alldaycells,.e-monthcells,.e-agendacells").removeClass("e-selectedCell"):(n=this.element.find("td.e-selectedCell"),n.length>0&&!a.hasClass("e-selectedCell")&&this.element.find(".e-workcells,.e-alldaycells,.e-monthcells,.e-agendacells").removeClass("e-selectedCell")),"agenda"!=this.currentView()){if((a.hasClass("e-workcells")||a.hasClass("e-alldaycells")||a.hasClass("e-monthcells"))&&!a.hasClass("e-resourceheadercells")){if(this.model.showQuickWindow&&this._quickAppDetailsWindow.ejDialog("close"),this._slotByElement(a),this.model.minDate>this.curDate||this.model.maxDate=24?this._getLocalizedLabels("EventBeginsin")+" "+Math.abs(Math.ceil(I/L))+" "+this._getLocalizedLabels("Days"):this._getLocalizedLabels("Overdue"),p={appointment:h[0]},this._trigger("appointmentClick",p))return e(".e-selectedAppointment").css({border:"none"}),!1;this.model.showQuickWindow&&(this._quickAppDetailsWindow&&this._quickAppDetailsWindow.find(".e-quicksubject").html(D[this._appointmentSettings.subject]).attr("title",D[this._appointmentSettings.subject]),g="12"==this._timeMode?t.format(h[0][this._appointmentSettings.startTime],this._pattern.t):t.format(h[0][this._appointmentSettings.startTime],"HH:mm"),_="12"==this._timeMode?t.format(h[h.length-1][this._appointmentSettings.endTime],this._pattern.t):t.format(h[h.length-1][this._appointmentSettings.endTime],"HH:mm"),this._quickAppDetailsWindow.find(".e-rightfields").html(m),f=Math.ceil((h[0][this._appointmentSettings.endTime]-h[0][this._appointmentSettings.startTime])/36e5)/24,b=h.length>1||"horizontal"==this.model.orientation&&"month"==this.currentView()&&f>1||h[0][this._appointmentSettings.startTime].getDay()!=h[h.length-1][this._appointmentSettings.endTime].getDay()?this._dayFullNames[h[0][this._appointmentSettings.startTime].getDay()]+", "+t.format(h[0][this._appointmentSettings.startTime],"MMMM")+" "+h[0][this._appointmentSettings.startTime].getDate()+" - "+g+" to "+this._dayFullNames[h[h.length-1][this._appointmentSettings.endTime].getDay()]+", "+t.format(h[h.length-1][this._appointmentSettings.endTime],"MMMM")+" "+h[h.length-1][this._appointmentSettings.endTime].getDate()+" - "+_:this._dayFullNames[h[0][this._appointmentSettings.startTime].getDay()]+", "+t.format(h[0][this._appointmentSettings.startTime],"MMMM")+" "+h[0][this._appointmentSettings.startTime].getDate()+", "+g+" - "+_,this._quickAppDetailsWindow.find(".e-quickstartendtime").html(b),1==D[this._appointmentSettings.recurrence]?this._quickAppDetailsWindow.find(".e-editseries").removeClass("e-disable"):this._quickAppDetailsWindow.find(".e-editseries").addClass("e-disable"),"beforeOpen"!=s.type?this._quickAppDetailsWindow.ejDialog("open"):"",this.model.readOnly?this._quickAppDetailsWindow.find(".e-scheduledelete").addClass("e-disable"):this._quickAppDetailsWindow.find(".e-scheduledelete").removeClass("e-disable"),v=e(y).width()>this.element.width()?e(y).offset().left>this.element.offset().left?e(y).offset().left:this.element.find(".e-draggableworkarea").scrollLeft()>e(y).width()?this.element.offset().left:this.element.width()/2-4:e(y).offset().left-((this._quickAppDetailsWindow.width()-e(y).width())/2-4),x=e(y).offset().top-this._quickAppDetailsWindow.height()-10,w=this._quickWindowPosition(v,x,y,this._quickAppDetailsWindow),this._quickAppDetailsWindow.ejDialog({position:{X:w.X,Y:w.Y}}),this._quickAppDetailsWindow.focus()),this._appointmentAddWindow.ejDialog({title:this._getLocalizedLabels("Editevent")})}e(a).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)),this.cur_EndTime=new Date(new Date(this.currentDate()).setHours(23,59)),e(a).parentsUntil(".e-agendacellstab tbody").find(".e-eventcolumn,.e-timecolumn").addClass("e-selectedCell").attr("tabIndex",0).focus(),y=a.hasClass("e-agendaappointment")?a:this.element.find(".e-selectedCell").parent().find(".e-agendaappointment"),this._appUid=y.attr("guid"),this._mediaQuery&&(this._mAppId=this._appUid),a.hasClass("e-editapp")||a.hasClass("e-deleteapp")||(y=new t.DataManager(this._processed).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,this._appUid)),this._trigger("appointmentClick",{appointment:y[0]})))return!1;this._cellClick=!1}},_getDateByElement:function(e){this._cellIndex=this.model.timeScale.enable?e.hasClass("e-workcells")?e.index():e.hasClass("e-alldaycells")?e.index():this._isCustomMonthView()&&this._oneWeek?e.index():7-(7*(parseInt(e.index()/7)+1)-e.index())+7*e.parent().index():"vertical"==this.model.orientation&&"month"==this.currentView()||"customview"==this.currentView()&&this._dateRender.length>=7?7-(7*(parseInt(e.index()/7)+1)-e.index())+7*e.parent().index():e.index(),"horizontal"==this.model.orientation&&(this._cellIndex=this.model.timeScale.enable?"month"===this.currentView()||this._isCustomMonthView()?this._cellIndex:Math.floor(this._cellIndex/((this.model.endHour-this.model.startHour)*this.model.timeScale.minorSlotCount*(60/this.model.timeScale.majorSlot))):e.index(),this._workCellIndex=e.parent().index());var t="horizontal"==this.model.orientation&&"month"==this.currentView()?this.monthDays:"vertical"==this.model.orientation||"customview"==this.currentView()&&this._dateRender.length<=7?this._resWorkWeek?this._dateRender:this.dateRender:this._dateRender;t="horizontal"==this.model.orientation&&"customview"==this.currentView()&&this._dateRender.length<=7?this._dateRender:t,this.curDate=new Date(t[this._cellIndex])},_slotByElement:function(e){this._getDateByElement(e);var t=this.curDate;e.hasClass("e-workcells")&&this.model.timeScale.enable&&"month"!==this.currentView()&&!this._isCustomMonthView()?(this._calcCurrentTime(t,e),this._appointmentAddWindow.find(".allday").ejCheckBox({checked:!1})):(this.cur_StartTime=new Date(new Date(t).setHours(0,0,0)),this.cur_EndTime=new Date(new Date(t).setHours(23,59,59)),this._appointmentAddWindow.find(".allday").ejCheckBox({checked:!0}))},_calcCurrentTime:function(e,t){var i,s="vertical"==this.model.orientation?60*this.model.startHour+t.parent().index()*(this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount):(this.model.startHour*this.model.timeScale.minorSlotCount+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);s*=6e4,this._timeScaleMin=this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount,this._timeScaleMin=6e4*this._timeScaleMin,this.cur_StartTime=new Date(e).setMilliseconds(s),i=parseInt(new Date(this.cur_StartTime).getHours())==new Date(new Date(e).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(e).setMinutes(this._timeScaleMin*this.model.timeScale.minorSlotCount*(this.model.endHour-this.model.startHour)-this.model.timeScale.minorSlotCount)).getMinutes()?s+(this._timeScaleMin-1):new Date(this.cur_StartTime).getMilliseconds()+this._timeScaleMin,this.cur_EndTime=new Date(new Date(this.cur_StartTime).setMilliseconds(i)),this.cur_EndTime=new Date(this.cur_StartTime).getDay()0&&e(p).parentsUntil(".e-draggableworkarea tr").is(".e-agendaappointment,.e-eventcolumn,.e-timecolumn")||e(p).is(".e-agendaappointment,.e-eventcolumn,.e-timecolumn");if(p.hasClass("e-appointment")||p.hasClass("e-workcells")||p.hasClass("e-alldaycells")||p.hasClass("e-monthcells")||t.isNullOrUndefined(this.model.appointmentTemplateId)||(p=e(i.target).offsetParent()),i.cancel=!(p.hasClass("e-alldayappointment")||p.hasClass("e-monthappointment")||p.hasClass("e-appointment")||p.hasClass("e-workcells")||p.hasClass("e-alldaycells")||p.hasClass("e-appointinnertext")||p.hasClass("e-monthcells")||p.hasClass("e-apptime")||p.hasClass("e-apptext")||_),1==i.cancel)return c=this._contextMenu.data("ejMenu"),c.hide(),!1;if("agenda"==this.currentView()&&_&&(i=e(p).hasClass("e-agendaappointment")?i:e(p).parents(".e-draggableworkarea tr").find(".e-agendaappointment")),this._cellSelection(i),(p.hasClass("e-workcells")||p.hasClass("e-alldaycells")||p.hasClass("e-monthcells"))&&(m={currentDate:this.curDate,cellIndex:this._cellIndex,events:i,resources:t.isNullOrUndefined(this.model.beforeContextMenuOpen)||t.isNullOrUndefined(this.model.resources)?null:this._getResourceValue(p,this._cellIndex)}),(p.hasClass("e-alldayappointment")||p.hasClass("e-monthappointment")||p.hasClass("e-appointinnertext")||p.hasClass("e-apptime")||p.hasClass("e-apptext")||p.hasClass("e-appointment"))&&(g=this._getAppDetails(i),m={appointment:g,events:i}),"agenda"==this.currentView()&&(g=new t.DataManager(this._processed).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,this._appUid))[0],m={appointment:g,events:i}),this._baseTarget=p,this._trigger("beforeContextMenuOpen",m))return!1;if(s=this._contextMenu.data("ejMenu"),u=!(p.hasClass("e-alldayappointment")||p.hasClass("e-monthappointment")||p.hasClass("e-appointment")||p.hasClass("e-appointinnertext")||p.hasClass("e-apptime")||p.hasClass("e-apptext")||_),u?s.option("fields.dataSource",this.model.contextMenuSettings.menuItems.cells):s.option("fields.dataSource",this.model.contextMenuSettings.menuItems.appointment),this.model.readOnly?(s.disableItemByID("new"),s.disableItemByID("recurrence"),s.disableItemByID("delete"),s.disableItemByID("categorize")):(s.enableItemByID("new"),s.enableItemByID("recurrence"),s.enableItemByID("delete"),s.enableItemByID("categorize")),a=this.element.find("td.e-selectedCell"),a.length>1&&"agenda"!=this.currentView()&&this._multipleCellAppointCreation(i),this._target=i,this.model.showQuickWindow&&(this._quickAppointWindow.ejDialog("close"),this._quickAppDetailsWindow.ejDialog("close")),this.model.categorizeSettings.enable&&0==u){if(n=this._contextMenu.find("li#categorize").find("li").children(),0==n.find("div").length)for(d=0;d
    ');for(d=1;d<=this.model.categorizeSettings.dataSource.length;d++)this._contextMenu.find("li#categorize").find("li#categorize_"+d).children().find("div:first-child.e-categorizeMenuSelected")&&this._contextMenu.find("li#categorize").find("li#categorize_"+d).children().find("div:first-child").removeClass("e-categorizeMenuSelected");if(o=(new t.Query).where("Guid",t.FilterOperators.equal,this._appUid),r=t.DataManager(this._processed).executeLocal(o),r[0][this._appointmentSettings.categorize])if(l=r[0][this._appointmentSettings.categorize].split(","),this.model.categorizeSettings.allowMultiple){if(l[0].length>0)for(d=0;d0&&(h=l.length-1,this._contextMenu.find("li#categorize").find("li#categorize_"+l[h]).children().find("div:first-child").addClass("e-categorizeMenuSelected"))}else this._contextMenu.find("li#categorize")&&this._contextMenu.find("li#categorize").css("display","none")},_onMenuSelect:function(i){var s,a,n,o,r,l,d,h,c,u=i.events.ID.split("_"),m="",p=this._baseTarget;if(e(p).is(".e-appointment,.e-alldayappointment,.e-monthappointment,.e-agendaappointment")||p.parents(".e-appointment").hasClass("e-appointment")||p.parents(".e-monthappointment").hasClass("e-monthappointment")||p.parents(".e-alldayappointment").hasClass("e-alldayappointment")||"agenda"==this.currentView()&&this.element.find(".e-selectedCell").parent().find(".e-agendaappointment")?(a=(new t.Query).where("Guid",t.FilterOperators.equal,this._appUid),n=t.DataManager(this._processed).executeLocal(a),m=1==n[0][this._appointmentSettings.recurrence]&&n[0][this._appointmentSettings.recurrenceRule].indexOf("RECUREDITID")!=-1?n[0]:this._getAppointmentByParentId(this._appUid),s=!0):(m={startTime:new Date(this.cur_StartTime),endTime:this.cur_EndTime,resourceInfo:this._getResourceDetails(p)},s=!1),this._trigger("menuItemClick",{events:i,targetInfo:m})||this.model.categorizeSettings.enable&&s&&this._trigger("beforeAppointmentChange",{appointment:m}))return!1;switch(u[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});break;case"open":this._appointmentWindow(this._target);break;case"today":this._navigateClick(this.currentDate(new Date),"DateNavigation");break;case"view":t.isNullOrUndefined(u[1])||(o=u[1].toLowerCase(),this._navView=!0,this.currentView()!=o&&this._viewChange(null,this.currentView(),o));break;case"timemode":t.isNullOrUndefined(u[1])||(this.model.timeMode=this._timeMode="Hour12"==u[1]?"12":"24",this._updateTimeMode());break;case"businesshours":case"workhours":this.model.workHours.highlight=!this.model.workHours.highlight,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(u[1]))this.element.find(".e-appointment,.e-alldayappointment,.e-monthappointment,.e-agendaappointment").removeClass("e-selectedAppointment");else if(this.model.categorizeSettings.enable){if(r=u[1],l="",m[this._appointmentSettings.categorize])if(d=m[this._appointmentSettings.categorize].split(","),this.model.categorizeSettings.allowMultiple){if(d[0].length>0){for(c=0;c"+this._getLocalizedLabels("Showin")+":";i+="
    ",this._on(this._gotoWindow,"click",".e-gotobutton",e.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:e.proxy(this._gotoCancel,this)}),e("#"+this._id+"gotoWindow_wrapper").appendTo("body").addClass("e-scheduledialog").find(".e-titlebar").addClass("e-dialogheader")},_highlightCurrentTime:function(i){function s(){var i,s,a,n=new Date;if(n.setMinutes(n.getMinutes()),n.getHours()>=h.model.startHour&&n.getHours()<=h.model.endHour)if("vertical"==h.model.orientation){for(i=(60*(n.getHours()-h.model.startHour)+n.getMinutes())*(h.element.find(".e-workcells").height()+1)*h.model.timeScale.minorSlotCount/h.model.timeScale.majorSlot,a=0;a=h.model.startHour&&(new Date).getHours()<=h.model.endHour)if("vertical"==h.model.orientation)for(d=0;d'),e("#"+this._id+d+"_HighlightCurrentTimeline").append('
    ').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",u+"px").css("left",o[n+c*d].offsetLeft+"px").find(".e-righttimeindicator").css("margin-left",u-3+"px");else this._renderHorizontalCurrentTime();s(),this._intervalID=window.setInterval(s,6e4)}else clearInterval(this._intervalID),this.element.find(".e-highlightcurrenttimeline").remove()}},_filter:function(){var t,i=[],s=[];for(this._filt=!0,this._dataProcessing(this._currentAppointmentData),s=e.extend(!0,[],this._processed),this._filt=!1,t=0;t=this.model.minDate&&new Date(s[t][this._appointmentSettings.endTime])<=this.model.maxDate&&i.push(s[t]);return i},_getPreviousNextAppointment:function(){var e,t,i,s=this._dateRender;if("horizontal"==this.model.orientation&&"month"==this.currentView()&&(s=this._horizontalMonthDates()),e=this._filter(),this._previousList=[],this._nextList=[],this.appointment,"workweek"!=this.currentView())for(t=0;tnew Date(s[s.length-1])&&new Date(e[t][this._appointmentSettings.endTime])>new Date(s[s.length-1])&&this._nextList.push(e[t]);else for(t=0;tnew Date(s[s.length-1])&&new Date(e[t][this._appointmentSettings.endTime])>new Date(s[s.length-1])&&this._nextList.push(e[t]));this.appointment={previous:this._previousList,next:this._nextList}},_nextPrevAppointment:function(e){var i,s,a;if(e&&!("msie"===this._browserInfo.name&&this._browserInfo.version<9)){i=this.element.find("#"+this._id+"_scroller"),this.height=i.height(),this.width=i.width(),s=this.element.find(".e-vscroll").width(),a=this.element.find(".e-scrolltimecells").width(),a=t.isNullOrUndefined(a)?"vertical"==this.model.orientation?56:0:a;var n,o=this.height/2-75,r=t.buildTag("div.e-prevapp enable",this._getLocalizedLabels("PreviousAppointment"),{},{}),l=t.buildTag("div.e-nextapp enable",this._getLocalizedLabels("NextAppointment"),{},{});n=this.model.timeScale.enable&&"agenda"!=this.currentView()&&"vertical"==this.model.orientation?"month"==this.currentView()||this._isCustomMonthView()?-10:-4:-61,this.width=this.model.timeScale.enable&&"agenda"!=this.currentView()?this.width:this.width-a,this.model.enableRTL?(r.css("top",o+40+"px").css("transform","rotate(-90deg)").css("right",n+"px"),l.css("top",o+40+"px").css("transform","rotate(90deg)").css("right",this.width-s-("vertical"!=this.model.orientation||"month"!=this.currentView()&&!this._isCustomMonthView()?"vertical"==this.model.orientation?34:90:41)+"px")):(r.css("top",o+40+"px").css("transform","rotate(90deg)").css("left",n+"px"),l.css("top",o+40+"px").css("transform","rotate(-90deg)").css("left",this.width-s-("vertical"!=this.model.orientation||"month"!=this.currentView()&&!this._isCustomMonthView()?"vertical"==this.model.orientation?34:90:41)+"px")),i.append(r).append(l)}},_nextPrev:function(i){var s=this;e(i.currentTarget).hasClass("e-prevapp")?t.isNullOrUndefined(this.appointment)||(this.appointment.previous.sort(function(e,t){return new Date(t[s._appointmentSettings.startTime])-new Date(e[s._appointmentSettings.startTime])}),"customview"==this.currentView()&&(this._daterend=this.appointment.previous[0][this._appointmentSettings.startTime]),this._navigateClick(this.currentDate(new Date(this.appointment.previous[0][this._appointmentSettings.startTime])),"Previous")):e(i.currentTarget).hasClass("e-nextapp")&&(t.isNullOrUndefined(this.appointment)||(this.appointment.next.sort(function(e,t){return new Date(e[s._appointmentSettings.startTime])-new Date(t[s._appointmentSettings.startTime])}),"customview"==this.currentView()&&(this._daterend=this.appointment.next[0][this._appointmentSettings.startTime]),this._navigateClick(this.currentDate(new Date(this.appointment.next[0][this._appointmentSettings.startTime])),"Next")))},_nextPrevButton:function(e){0!=e.length?this.element.find(".e-prevapp,.e-nextapp").css("display","none"):(this._getPreviousNextAppointment(),this.element.find(".e-prevapp,.e-nextapp").css("display","block"),0==this.appointment.previous.length?this.element.find(".e-prevapp").removeClass("enable").css("opacity","0.4"):this.element.find(".e-prevapp").addClass("enable").css("opacity","1"),0==this.appointment.next.length?this.element.find(".e-nextapp").removeClass("enable").css("opacity","0.4"):this.element.find(".e-nextapp").addClass("enable").css("opacity","1"))},_navigateView:function(i){var s,a,n,o,r,l,d=this.currentView(),h=e(i.target);if("agenda"==this.currentView())return!1;if("vertical"==this.model.orientation){if("month"===this.currentView()||this._isCustomMonthView()){if(h.hasClass("e-monthheader")){if(this.model.views.toString().toLowerCase().split(",").indexOf("day")==-1)return!1;if(o=h.parent().index(),n=o>6?o%7:o,a=new Date(this._dateRender[7*h.parent().parent().index()+n]),!(this.model.minDate<=a&&this.model.maxDate>=a))return!1;this.currentDate(a),s="day"}else if(h.hasClass("e-timecells")||h.hasClass("e-timecelldivs")){if(h=h.hasClass("e-timecells")?h:h.parent(),this.model.views.toString().toLowerCase().split(",").indexOf("week")==-1)return!1;if(a=new Date(this._dateRender[7*h.parent().index()]),!(this.model.minDate<=a&&this.model.maxDate>=a))return!1;this.currentDate(a),s="week"}}else if("week"===this.currentView()||"workweek"===this.currentView()||"customview"===this.currentView()&&this._renderDays<=7){if(r=h.hasClass("e-headercells")?h:h.parent().hasClass("e-headercells")?h.parent():h.parent().parent(),this.model.views.toString().toLowerCase().split(",").indexOf("day")==-1||!r.hasClass("e-headercells"))return!1;if(o=r.index(),l="workweek"===this.currentView()?this.model.workWeek.length:"customview"===this.currentView()?this._dateRender.length:7,n=o>l-1?o%l:o,a=new Date(this._dateRender[n]),!(this.model.minDate<=a&&this.model.maxDate>=a))return!1;this.currentDate(new Date(a)),s="day"}this._navView=!0,"day"==d||t.isNullOrUndefined(s)||(this._viewChange(i,d,s),this._businessHourScroller())}else"horizontal"==this.model.orientation&&t.scheduleFeatures.horizontal&&this._horizontalViewNavigation(i)},_appOverflowClick:function(t){return this.model.views.toString().toLowerCase().split(",").indexOf("day")!==-1&&(!this._trigger("overflowButtonClick",{event:t,Datas:this._overflowApp})&&(this._hideAppCount(),this.currentDate(new Date(parseInt(e(t.target).attr("cellinfo")))),this._navView=!0,void this._viewChange(t,this.currentView(),"day")))},_viewCalendar:function(){var t,i=this.element.find("#"+this._id+"_navigator").data("ejDatePicker");i&&(i.show(),this.element.find("#"+this._id+"_navigator").ejDatePicker({value:new Date(this.currentDate())}),t=this.element.offset(),this.model.enableRTL?e("#e-"+this._id+"_navigator").css("top",t.top+47+"px").css("left",t.left+this.element.width()-280+"px"):e("#e-"+this._id+"_navigator").css("top",t.top+47+"px").css("left",t.left+55+"px")),this.element.find(".e-workcells").removeClass("e-selectedCell"),this.element.find(".e-workcells").removeClass("e-mousehover"),this.element.find(".e-appointment,.e-alldayappointment,.e-monthappointment").removeClass("e-selectedAppointment")},_viewChange:function(t,i,s){this._viewchange=!0,this._renderedApp=[];var a,n=!0;if(a={currentView:this.currentView(),currentDate:new Date(this.currentDate()),target:t,requestType:"viewNavigate"},this._trigger("actionBegin",{data:a,requestType:"viewNavigate"}))return!1;if(this.model.showQuickWindow&&this._quickAppointWindow.ejDialog("close")&&this._quickAppDetailsWindow.ejDialog("close"),i!==s||!i&&!s){if(i=this.currentView(),this._navView?this.currentView(s):(n=this.currentView()!=t.currentTarget.className.split("e-")[2].split(" ")[0],this.currentView(e(t.currentTarget).hasClass("e-activeview")?this.currentView():t.currentTarget.className.split("e-")[2].split(" ")[0])),a={previousView:i,currentView:this.currentView(),currentDate:new Date(this.currentDate()),target:t,requestType:"viewNavigate"},this._trigger("navigation",a))return this.currentView(i),this._navView=!1,!1;n&&this._renderCurrentView("ViewChange")}a={previousView:i,currentView:this.currentView(),currentDate:new Date(this.currentDate()),target:t,requestType:"viewNavigate"},this._mediaQuery&&i!=this.currentView()&&this.element.find(".e-workareadiv,.e-navigate").addClass("navigate"),this._trigger("actionComplete",{data:a,requestType:"viewNavigate"})},_renderCurrentView:function(i){var s,a;this._resWorkWeek="vertical"==this.model.orientation&&"workweek"==this.currentView()&&!t.isNullOrUndefined(this.model.resources)&&!t.isNullOrUndefined(this.model.resources[this.model.resources.length-1].resourceSettings.workWeek),this.element.find(".e-commonviewbutton").blur(),this.element.find(".e-commonviewbutton").removeClass("e-activeview"),"vertical"==this.model.orientation&&this.element.find(".e-headerdaydisplay,.e-datedisplay,.e-headrealldaytable").children().remove(),this.wTR.children().remove(),this.aTR.children().remove(),this._calculateCustomDays()._getRenderDates(),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(),"agenda"!=this.currentView()?("horizontal"==this.model.orientation&&("month"==this.currentView()||this._isCustomMonthView())&&this.element.find(".e-workcells").width()0&&"month"!=this.currentView()&&!this._isCustomMonthView()&&!this._mediaQuery&&this._renderUpDownIcon(),"horizontal"==this.model.orientation&&this._horizontalRender(),this.model.enableRTL&&this.element.addClass("e-rtl"),this._mediaQuery&&this.model.cellWidth&&"day"==this.currentView()&&parseInt(this.element.find(".e-headertr td").siblings("td:last-child").css("width"))>this.element.find(".e-vscroll").width()&&this.element.find(".e-headertr td").siblings("td:last-child").css("width",this.element.find(".e-vscroll").width()+"px"),"horizontal"==this.model.orientation&&t.scheduleFeatures.horizontal&&(this._moveScroller(),this._renderHorizontalHeaderDays(this._culture),this.model.timeScale.enable||this.element.find(".e-headercells").removeClass("e-dateheaderselect"),t.isNullOrUndefined(this.model.group)||this._horizontalResIcon(),!t.isNullOrUndefined(this.model.dateHeaderTemplateId)&&("day"==this.currentView()||"week"==this.currentView()||"workweek"==this.currentView()||"customview"==this.currentView()&&this._oneWeek)&&this.element.find(".e-headercells").parent().parent().parent().css("width",this.element.width()/10*this._dateRender.length+"px")),this._renderHeaderDays()):this.model.showHeaderBar&&(s=this._getCurrentDateHeaderValue(),this.element.find("div.e-datedisplay")[0].innerHTML=s),"agenda"!=this.currentView()&&(this.model.workHours.highlight?this._highlightBusinessHours():this.element.find(".e-workcells").removeClass("e-businesshighlightworkcells"),this._highlightCurrentTime(this.model.showCurrentTimeIndicator)),t.isNullOrUndefined(this.dataSource())||(this.model.enableLoadOnDemand?this._bindAppointmentsData(i):(this._dataProcessing(this._currentAppointmentData),this._renderAppointmentAll()),this._app.length<1&&this.model.showAppointmentNavigator&&this._nextPrevButton(this._app)),this._validateMinMaxDate(),this._navView=!1,this._dateRender.length>60||e.isNumeric(this.element.find(".e-monthcells").height())&&this.element.find(".e-monthcells").height()!=e(this.element.find(".e-timecells")[3]).height()&&"vertical"==this.model.orientation&&this.model.showOverflowButton?this.element.find("td.e-timecells .e-timecelldivs").addClass("e-timedivcells"):"","horizontal"==this.model.orientation&&this._safariBrowser&&this.element.find(".e-workcells.e-dayend").width(this.element.find(".e-workcells.e-dayend").outerWidth()+1),"agenda"==this.currentView()||"horizontal"!=this.model.orientation||t.isNullOrUndefined(this.model.group)||t.isNullOrUndefined(this.model.resources)||(a=this.model.enableRTL?"border-right":"border-left",this.element.find(".e-horizontaldaterender").css(a,"0px"),this.element.find(".e-workareadiv").parent().css(a,"0px")),"msie"==t.browserInfo().name&&t.browserInfo().version<9&&"vertical"==this.model.orientation&&(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")),t.isNullOrUndefined(this.model.queryCellInfo)||this._renderQueryCellInfo("emptycell")},_renderHeaderDays:function(){var i,s,n,o,r,l,d,h,c;if(this.dateRender=[],i=this._getRenderDates(),this.res1=t.isNullOrUndefined(this.model.group)?[0]:this.res1,!this._resWorkWeek)for(h=0;hthis.model.maxDate&&this.currentDate(this.model.maxDate),"vertical"==this.model.orientation)if(this.element.find(".e-currentdayhighlight").removeClass("e-currentdayhighlight"),"month"===this.currentView()||this._isCustomMonthView())this._renderMonthTimeCells();else{if(t.isNullOrUndefined(this.model.dateHeaderTemplateId))for(h=0;h=this.model.maxDate?this.element.find(".e-navigatenext").addClass("e-disable"):this.element.find(".e-navigatenext").removeClass("e-disable")},_onScheduleResize:function(){var i,s,a,n,o,r,l;if(t.isNullOrUndefined(this._scheduleDrawer)||(t.isNullOrUndefined(this._scheduleDrawer.data("ejNavigationDrawer"))?(e(this._scheduleDrawer).remove(),this._scheduleDrawer=null):this._scheduleDrawer.ejNavigationDrawer("close")),this._mediaQuery&&t.isMobile()){if(this._recurEditWindow.ejDialog("refresh"),this._appointmentAddWindow.ejDialog("refresh"),window.orientation==this._screenOrientation&&this._appointmentAddWindow.ejDialog("isOpen"))return!1;this._screenOrientation=window.orientation}if(this.model.showQuickWindow&&this._quickAppointWindow.ejDialog("close")&&this._quickAppDetailsWindow.ejDialog("close"),i=this._mediaQuery,s="number"==typeof innerWidth&&window.innerWidth>document.documentElement.clientWidth,this._mediaQuery=!("msie"==this._browserInfo.name&&parseInt(this._browserInfo.version,10)<=8)&&((document.documentElement.clientWidth+(s?17:0)<361||t.isMobile())&&this.model.isResponsive),this._mediaQuery?this.element.addClass("e-scheduleresponsive"):this.element.removeClass("e-scheduleresponsive"),a=this.element.find(".e-scroller").data("ejScroller"),"agenda"!=this.currentView()){n=this.element.find(".e-vscroll").width(),this.element.find(".e-nextapp").css("left",this.element.width()-n-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");var d="workweek"==this.currentView()?this.model.workWeek.length:"day"==this.currentView()?1:"customview"===this.currentView()&&this._renderDays<=7?this._dateRender.length:7,h=t.isNullOrUndefined(this.model.group)||t.isNullOrUndefined(this.model.resources)?d:this.res1.length*d,c=(parseInt(this.model.cellWidth)*h,"vertical"===this.model.orientation?(s&&this._mediaQuery?this.element.outerWidth()+17:this.element.outerWidth())-(this._mediaQuery&&("month"==this.currentView()||this._isCustomMonthView())?1:this.element.find(".e-scrolltimecells").parent().outerWidth()):"horizontal"!=this.model.orientation||t.isNullOrUndefined(this.model.group)||t.isNullOrUndefined(this.model.resources)?this.element.width():this.element.width()-this.element.find(".e-resourceheadertable").width());a.model.width=c-2,a.model.height=this.scHeight-1-(this.element.find(".e-draggableworkarea").offset().top-this.element.offset().top),a.refresh(),"vertical"==this.model.orientation?(this.model.cellWidth&&!this._mediaQuery&&this.element.find(".e-draggableworkarea").width(this.element.width()>(parseInt(this.model.cellWidth)+1)*h+this.element.find(".e-scrolltimecells").parent().width()+(a.isVScroll()?18:0)?(parseInt(this.model.cellWidth)+1)*h-1:c-2-(a.isVScroll()?18:0)),this.model.timeScale.enable?this._mediaQuery&&this.res1.length>1&&this.element.find(".e-draggableworkarea").width(this.element.find(".e-draggableworkarea").width()*this.res1.length-1):(this.element.find(".e-draggableworkarea").css("height","20px"!=this.model.cellHeight?parseInt(this.model.cellHeight):a.model.height-1+"px"),this.element.find(".e-draggableworkarea").height(t.isNullOrUndefined(this.element.find(".e-hscroll"))?this.element.find(".e-draggableworkarea").height():this.element.find(".e-draggableworkarea").height()-this.element.find(".e-hscroll").height())),this.element.find(".e-headrealldaytable").parent().width(this.element.find(".e-draggableworkarea").width()),this.element.find(".e-datecommondiv").parent().width(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")):e(this.element.find(".e-horizontaltimecells").find("table tr")[2]).css("left",-a.model.scrollLeft+"px"), "month"==this.currentView()||this._isCustomMonthView()||"vertical"!=this.model.orientation?this._renderCurrentView("ScheduleResize"):this.model.enableRTL&&(this.model.cellWidth||"20px"!=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._renderMonthAppointment()),this._unWireResizeEvents(),this._wireResizeEvents(),this._dragdropAppointments()),this.element.find(".e-headrealldaytable").parent().width(this.element.find(".e-draggableworkarea").width()),this.model.showCurrentTimeIndicator&&this.element.find(".e-highlightcurrenttimeline").remove(),this.element.find(".e-scrolltimecells").css("top",-this.element.find(".e-draggableworkarea").scrollTop()+"px"),this._highlightCurrentTime(this.model.showCurrentTimeIndicator)}else a.model.width=this.element.width()-2,a.model.height=this.scHeight-1-(this.element.find(".e-draggableworkarea").offset().top-this.element.offset().top),a.refresh(),o=e("div#"+this._id+"_scroller"),this.element.find(".e-headrealldaytable").parent().width(this.element.find(".e-draggableworkarea").width()),this.element.find(".e-datecommondiv").parent().width(this.element.width()-2),o.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)&&!e("#"+this._id+"navDrawer").hasClass("e-scheduledrawer")&&this._renderNavigationDrawer(),r=this._mediaQuery!=i,!r&&(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",e.proxy(this._drawerOpen,this))),r&&(this.model.showAppointmentNavigator=r&&!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&&this._quickWindow,this.model.showQuickWindow&&t.isNullOrUndefined(this._quickAppointWindow)&&(this._renderQuickAppWindow()||this._renderQuickAppDetailsView()),e.isFunction(e.validator)&&this._setQuickValidation(),this._destorySubControls(e("#"+this._id+"_AddEditForm")),this._destorySubControls(e("#"+this._id+"_RecurForm")),e("#"+this._id+"AppointmentAddEditWindow_wrapper").remove(),t.isNullOrUndefined(this._alertWindow)||this._alertWindow.ejDialog("close"),this._recurEditWindow.ejDialog("close"),this._recurEditWindow.ejDialog({width:this._mediaQuery?"90%":360}),this._renderAppointmentWindow(),e.isFunction(e.validator)&&this._setValidation(),this._mediaQuery&&this._phoneChanges(),this._renderAppointmentAll(),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",e.proxy(this._drawerOpen,this))):(this._on(this.element,t.eventType.mouseDown,"td.e-workcells,td.e-monthcells,td.e-alldaycells",e.proxy(this._mouseButtonClick,this)),this._on(this.element,"keydown click","td.e-workcells,td.e-monthcells,td.e-alldaycells",e.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",e.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",e.proxy(this._appointmentWindow,this)),this._mediaQuery||t.isMobile()?this._on(this.element,"tap",".e-appointment,.e-alldayappointment,div.e-monthappointment,.e-agendaappointment",e.proxy(this._appointmentWindow,this)):this._off(this.element,"tap",".e-appointment,.e-alldayappointment,div.e-monthappointment,.e-agendaappointment"),l=e("#"+this._id+"AppointmentAddEditWindow_wrapper,#"+this._id+"RecurrenceEdit_wrapper,#"+this._id+"navDrawer,#"+this._id+"alertWindow_wrapper"),this._mediaQuery?l.addClass("e-scheduleresponsive"):l.removeClass("e-scheduleresponsive")),(this._mediaQuery||this.element.width()<600)&&this.element.find(".e-mobileNavigation").css("left",this.model.enableRTL?18: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:e.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(){"vertical"==this.model.orientation&&(this.workcellTemp=e.templates(this._createTemplate(m(),"_WorkCells")),this.monthcellTemp=e.templates(this._createTemplate(n(),"_MonthCells")),this.timeCellTemplate=e.templates(this._createTemplate(p(),"_TimeCells")),this.userTimeCellTemplate=e.templates(this._createTemplate(g(),"_userTimeCells")),this.headTemplate=e.templates(this._createTemplate(l(),"_HeaderDate")),this.alldayTemp=e.templates(this._createTemplate(u(),"_AlldayCells")),this.leftIndent=e.templates(this._createTemplate(h(),"_LeftIndentCells"))),t.scheduleFeatures.resources&&!t.isNullOrUndefined(this.model.resources)&&this._renderResourcesTemplate(),this.agendaheadTemplate=e.templates(this._createTemplate(_(),"_HeaderDate")),this.agendacellTemp=e.templates(this._createTemplate(f(),"_AgendaCells")),this.appTemplate=e.templates(this._createTemplate(o(),"_Appointment")),t.scheduleFeatures.horizontal&&"horizontal"===this.model.orientation&&this._renderHorizontalTemplates(),!t.isNullOrUndefined(this.model.categorizeSettings)&&this.model.categorizeSettings.enable&&(this._renderCategorizeTemplate(),this._categorizeMultipleTemplate=e.templates(this._createTemplate(r(),"_CategorizeMultiple")))},_setNewStartEndHours:function(){"month"===this.currentView()||this._isCustomMonthView()||("horizontal"==this.model.orientation&&(this.aTR.children().remove(),this._renderHeaderAllDayTemplate()),this.wTR.children().remove(),this._renderContentAreaTemplate(),this._borderAddRemove(),"horizontal"==this.model.orientation&&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.model.showCurrentTimeIndicator&&this.element.find(".e-highlightcurrenttimeline").remove(),this._highlightCurrentTime(this.model.showCurrentTimeIndicator),this._renderAppointmentAll())},_renderInitSchedule:function(){var i,s,a,n,o;this.element.addClass("e-scheduleouter"),this._screenOrientation=window.orientation,this.model.timeScale.enable||(this.model.showCurrentTimeIndicator=!1),this._quickWindow=this.model.showQuickWindow,i="number"==typeof innerWidth&&window.innerWidth>document.documentElement.clientWidth,this._mediaQuery=!("msie"==this._browserInfo.name&&parseInt(this._browserInfo.version,10)<=8)&&((document.documentElement.clientWidth+(i?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),s=t.preferredCulture(this.model.locale),a=s.calendar,t.isNullOrUndefined(this._clientWidth)&&(this._clientWidth=this.model.width),this.currentView(this.currentView().toLowerCase()),this.model.views=0==this.model.views.length?this.model.currentView.toString().toLowerCase().split(","):this.model.views.toString().toLowerCase().split(","),this.model.workWeek=""==this.model.workWeek||null==this.model.workWeek?this._dayNamesArray:this.model.workWeek,this._resWorkWeek="vertical"==this.model.orientation&&"workweek"==this.currentView()&&!t.isNullOrUndefined(this.model.resources)&&!t.isNullOrUndefined(this.model.resources[this.model.resources.length-1].resourceSettings.workWeek),this.model.endHour>24&&(this.model.endHour=24),this.model.startHour<0&&(this.model.startHour=0),this._timeMode=null==this.model.timeMode?null==a.AM&&null==a.PM?"24":"12":this.model.timeMode,null==this.model.timeMode?this._pattern=s.calendar.patterns:this._pattern.t="12"==this._timeMode?"h:mm tt":"HH:mm",this._firstdayofweek=null!=this.model.firstDayOfWeek?"string"==typeof this.model.firstDayOfWeek?this._dayNamesArray.indexOf(this.model.firstDayOfWeek.toString().toLowerCase()):s.calendar.firstDay:this.model.firstDayOfWeek,this._firstdayofweek=null==this.model.firstDayOfWeek?s.calendar.firstDay:this._firstdayofweek,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.maxDate&&this.currentDate(this.model.maxDate),this.element.addClass("e-scheduleouter").height(this.model.height).width(this._clientWidth).attr("role","presentation"),e(this.element).attr("tabIndex",1);var r=t.buildTag("div.e-scheduleinner","",{},{height:this.scHeight,width:this.scWidth}).css("height",this.scHeight-2+"px").css("position","relative"),l=t.buildTag("table.e-table","",{},{cellpadding:"0px",cellspacing:"0px"}).addClass("e-scheduleoutertable"),d=t.buildTag("tbody");this.hTR=t.buildTag("tr.e-scheduleheader"),this.aTR=t.buildTag("tr.e-headerarearow"),this.model.views.toString().toLowerCase().split(",").indexOf(this.currentView())==-1&&this.currentView(this.model.views[0].toLowerCase()),this._calculateCustomDays()._getRenderDates(),this.wTR=t.buildTag("tr.e-contentarearow"),this._renderTemplates(),this.model.showHeaderBar&&this._renderHeaderBar(this.hTR),this._renderHeaderAllDayTemplate(),this._renderContentAreaTemplate(),r.append(l.append(d.append(this.hTR).append(this.aTR).append(this.wTR))),this._renderDialogs(),this.element.append(r),this.element.append(e("
    ")),this.element.find(".e-scheduletooltip").hide(),this.model.showHeaderBar||this.element.find(".e-scheduleheader").hide(),this.model.showHeaderBar&&(this.element.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:e.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")),"agenda"!=this.currentView()&&("vertical"==this.model.orientation&&(this._headerbarWidth(),("month"===this.currentView()||this._isCustomMonthView())&&this._renderMonthTimeCells(),this.model.timeScale.enable||(this.element.find(".e-headercells").first("td").css("border-left","none"),this.element.find(".e-workcellstab").find("tr").find("td:first-child").css("border-left","none")),!this.model.showAllDayRow&&this.model.cellWidth&&this.element.find(".e-workcellstab tr td:first-child").width(this.element.find(".e-headercells").width())),this.model.enableRTL&&this.element.addClass("e-rtl"),this.model.timeScale.enable&&this._borderAddRemove(),this.model.enableRTL&&this.element.removeClass("e-rtl"),"vertical"==this.model.orientation&&("month"===this.currentView()||this._isCustomMonthView())?"":this.element.find(".e-headercells").addClass("e-dateheaderselect"),this.element.find(".e-schedulesettings").html(this._getLocalizedLabels("AllDay")),"horizontal"==this.model.orientation&&("month"==this.currentView()||this._isCustomMonthView())&&this.element.find(".e-workcells").width()0&&"month"!=this.currentView()&&!this._isCustomMonthView()&&!this._mediaQuery&&this._renderUpDownIcon(),"horizontal"==this.model.orientation&&this._horizontalRender(),this.model.showOverflowButton||"vertical"!=this.model.orientation||"month"!=this.currentView()||this._monthCellsRender(),this._mediaQuery&&this.model.cellWidth&&"day"==this.currentView()&&parseInt(this.element.find(".e-headertr td").siblings("td:last-child").css("width"))>this.element.find(".e-vscroll").width()&&this.element.find(".e-headertr td").siblings("td:last-child").css("width",this.element.find(".e-vscroll").width()+"px"),"month"==this.currentView()||this._isCustomMonthView()?this.element.find(".e-timecells").height(e(this.element.find(".e-monthcells")).height()):this.element.find(".e-ampmdisplay").height(e(this.element.find(".e-workcells")).height()),this._highlightCurrentTime(this.model.showCurrentTimeIndicator),this.model.enableRTL&&this.element.addClass("e-rtl"),"horizontal"==this.model.orientation&&t.scheduleFeatures.horizontal&&(this._moveScroller(),this.model.timeScale.enable||this.element.find(".e-headercells").removeClass("e-dateheaderselect"),t.isNullOrUndefined(this.model.group)||this._horizontalResIcon(),!t.isNullOrUndefined(this.model.dateHeaderTemplateId)&&("day"==this.currentView()||"week"==this.currentView()||"workweek"==this.currentView()||"customview"==this.currentView()&&this._oneWeek)&&this.element.find(".e-headercells").parent().parent().parent().css("width",this.element.width()/10*this._dateRender.length+"px")),this.model.workHours.highlight?this._highlightBusinessHours():this.element.find(".e-workcells").removeClass("e-businesshighlightworkcells"),this._dateRender.length>60||e.isNumeric(this.element.find(".e-monthcells").height())&&this.element.find(".e-monthcells").height()!=e(this.element.find(".e-timecells")[3]).height()&&"vertical"==this.model.orientation?this.element.find("td.e-timecells .e-timecelldivs").addClass("e-timedivcells"):""),t.isNullOrUndefined(this.model.allDayCellsTemplateId)||this.element.find(".e-leftindent, .e-emptyalldaytd").height(this.element.find(".e-alldaycells").height()),this._validateMinMaxDate(),(this._mediaQuery||this.element.width()<600)&&this._renderNavigationDrawer(),this._showContextMenu(this.model.contextMenuSettings.enable),this._renderAlertWindow(),n=e("#"+this._id+"AppointmentAddEditWindow_wrapper,#"+this._id+"RecurrenceEdit_wrapper,#"+this._id+"navDrawer,#"+this._id+"alertWindow_wrapper"),this._mediaQuery?n.addClass("e-scheduleresponsive"):n.removeClass("e-scheduleresponsive"),"horizontal"==this.model.orientation&&this._safariBrowser&&this.element.find(".e-workcells.e-dayend").width(this.element.find(".e-workcells.e-dayend").outerWidth()+1),"agenda"==this.currentView()||"horizontal"!=this.model.orientation||t.isNullOrUndefined(this.model.group)||t.isNullOrUndefined(this.model.resources)||(o=this.model.enableRTL?"border-right":"border-left",this.element.find(".e-horizontaldaterender").css(o,"0px"),this.element.find(".e-workareadiv").parent().css(o,"0px")),this._mediaQuery&&this._phoneChanges(),this.model.enableRTL&&"webkit"==t.browserInfo().name&&this._appointmentAddWindow.find(".e-chk-image").css("margin-right","-13px"),"msie"==t.browserInfo().name&&t.browserInfo().version<9&&"vertical"==this.model.orientation&&(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")),t.isNullOrUndefined(this.model.queryCellInfo)||this._renderQueryCellInfo("emptytd")},_renderDialogs:function(){this._renderAppointmentWindow(),e.isFunction(e.validator)&&this._setValidation(),this._renderRecurEditWindow(),this.model.showQuickWindow&&(this._renderQuickAppWindow()||this._renderQuickAppDetailsView()),e.isFunction(e.validator)&&this._setQuickValidation()},_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")),"horizontal"==this.model.orientation?"month"==this.currentView()?"webkit"!=this._browserInfo.name||""==this.model.cellWidth?this.element.find(".e-headerdays table tr td:first-child").width(this.element.find(".e-workcellstab tr td:first-child").width()):this.element.find(".e-workcellstab tr td:not(:first-child)").width(this.element.find(".e-horizontmonthheaderdaytd").first().width()+1):"webkit"==this._browserInfo.name&&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&&("month"==this.currentView()?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(){this._appointmentAddWindow.ejDialog({allowDraggable:!1,position:{X:"0",Y:"0"}})},_dateConvert:function(i){if(t.isNullOrUndefined(i))s=null;else{var s=new Date(parseInt(i.match(/\d+/).toString()));s="date"==e.type(s)?s:new Date}return s},_calculateCustomDays:function(){var i,s;if(!t.isNullOrUndefined(this.model.renderDates)&&"customview"==this.currentView()&&!this._navigate){if(i="date"!=e.type(this.model.renderDates.start)?t.parseDate(this.model.renderDates.start,this._datepattern()):new Date(this.model.renderDates.start),i=t.isNullOrUndefined(i)?"Invalid Date"==new Date(this.model.renderDates.start).toString()||"NaN"==new Date(this.model.renderDates.start).toString()?this._dateConvert(this.model.renderDates.start):new Date(this.model.renderDates.start):i,s="date"!=e.type(this.model.renderDates.end)?t.parseDate(this.model.renderDates.end,this._datepattern()):new Date(this.model.renderDates.end),s=t.isNullOrUndefined(s)?"Invalid Date"==new Date(this.model.renderDates.end).toString()||"NaN"==new Date(this.model.renderDates.end).toString()?this._dateConvert(this.model.renderDates.end):new Date(this.model.renderDates.end):s,t.isNullOrUndefined(this.model.minDate)||t.isNullOrUndefined(this.model.maxDate)||(i=this.model.minDate>=i&&this.model.maxDate<=i?i:this.model.minDate>=i&&this.model.maxDate>=i?this.model.minDate:this.model.maxDate<=i?this.model.minDate:i,s=this.model.minDate>=s&&this.model.maxDate<=s?s:this.model.minDate<=s&&this.model.maxDate<=s?this.model.maxDate:this.model.minDate>=s?this.model.maxDate:s),this._renderStart=t.isNullOrUndefined(i)?s:new Date(i.getFullYear(),i.getMonth(),i.getDate()),this._renderEnd=t.isNullOrUndefined(s)?i:new Date(s.getFullYear(),s.getMonth(),s.getDate()),this._renderDays=Math.round((this._renderEnd-this._renderStart)/864e5)+1,this.oldDate=this.currentDate(),1!=this._renderDate||t.isNullOrUndefined(this._renderDate)?this._renderStart.getTime()>this.currentDate().getTime()||this._renderEnd.getTime()this.currentDate().getTime()?this.currentDate(new Date(this._renderStart)):this.currentDate(new Date(this._renderStart)):this.currentDate(new Date(this._renderStart)),this._renderDays>7){var a="vertical"==this.model.orientation?new Date(this._firstweekdate(this._renderStart)):new Date(this._renderStart),n=new Date(this._renderEnd),o=n.getDay();0==this._firstdayofweek&&6!=o?n.setDate(new Date(this._renderEnd).getDate()+(6-o)):n.setDate(new Date(this._renderEnd).getDate()+(6-o)+this._firstdayofweek),n="vertical"==this.model.orientation?n:new Date(this._renderEnd),this._numDays=Math.round((n-a)/864e5)+1}this._renderDate&&(this._renderDate=!1)}return this},_isCustomMonthView:function(){return"customview"==this.currentView()&&(this._oneWeek=!(this._dateRender.length>7),!this._oneWeek)},_headerbarWidth:function(){var e="workweek"==this.currentView()?this.model.workWeek.length:"day"==this.currentView()?1:"customview"===this.currentView()&&this._renderDays<=7?this._dateRender.length:7,i=t.isNullOrUndefined(this.model.group)||t.isNullOrUndefined(this.model.resources)?e:this.res1.length*e,s=this.element.outerWidth()-(this.element.find(".e-draggableworkarea").offset().left-this.element.offset().left)0||e(i).text()==o.PM[0]&&parseInt(e(i)[0].id)>12)&&e(i).text("00")})),a.model.showAppointmentNavigator&&"vertical"==a.model.orientation&&a.element.find(".e-vscroll").length>0&&"month"!=a.currentView()&&!a._isCustomMonthView()&&!a._mediaQuery&&(a._renderUpDownIcon(),a._renderUpDownIconPosition())):t.scheduleFeatures.horizontal&&"horizontal"==a.model.orientation&&a._horizontalScroll(i,a)),a.model.showQuickWindow&&a._quickAppointWindow.ejDialog("close")&&a._quickAppDetailsWindow.ejDialog("close")}}),this._mediaQuery||this._nextPrevAppointment(this.model.showAppointmentNavigator),this._renderHoriVerticalScroll(),this.element.find(".e-mobileNavigation").css("left",this.model.enableRTL?i.ejScroller("isVScroll")?18:0:this.element.outerWidth()-36),this._showScrollTd()},_showScrollTd:function(){var e=this.model.enableRTL?"e-borderright":"e-borderleft",i="horizontal"==this.model.orientation?"16px":"18px";"horizontal"==this.model.orientation&&(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"),0==this.element.find(".e-emptyscrolltd").length&&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(e).attr("width",i).show():this.element.find(".e-emptyscrolltd").removeClass(e).attr("width","0px").hide()},_renderHoriVerticalScroll:function(){var i,s=e("div#"+this._id+"_scroller"),a="month"===this.currentView()?0:4,n="vertical"===this.model.orientation?this.element.width()-(this._mediaQuery&&("month"==this.currentView()||this._isCustomMonthView())?1:this.element.find(".e-scrolltimecells").parent().outerWidth()):"horizontal"!=this.model.orientation||t.isNullOrUndefined(this.model.group)||t.isNullOrUndefined(this.model.resources)?this.element.width():this.element.width()-this.element.find(".e-resourceheadertable").width();n-=1;var o=this.scHeight-(this.element.find(".e-draggableworkarea").offset().top-this.element.offset().top),r="workweek"==this.currentView()?this.model.workWeek.length:"day"==this.currentView()?1:"customview"===this.currentView()&&this._renderDays<=7?this._dateRender.length:7,l=t.isNullOrUndefined(this.model.group)||t.isNullOrUndefined(this.model.resources)?r:this.res1.length*r;if("vertical"==this.model.orientation)if(this.model.cellWidth||"20px"!=this.model.cellHeight){"day"==this.currentView()&&this.element.find(".e-headerdaydisplay").css("width",this.model.cellWidth);var d=this._dateRender.length/7,h=(parseInt(this.model.cellWidth)+1)*l,c=parseInt(this.model.cellHeight)*d,u=(this.scWidth-this.element.find(".e-scrolltimecells").width()+a,o);"month"==this.currentView()||this._isCustomMonthView()?(this.element.find(".e-draggableworkarea").width(this.element.width()>h+this.element.find(".e-scrolltimecells").width()+18?h-1:s.ejScroller("isVScroll")?n-19:n-1),"20px"!=this.model.cellHeight?this.element.find(".e-draggableworkarea").height(u>c?c:s.ejScroller("isHScroll")?u-19:u-1):this.element.find(".e-draggableworkarea").height(s.ejScroller("isHScroll")?u-19:u-1)):(this.element.find(".e-draggableworkarea").width(this.element.width()>h+this.element.find(".e-scrolltimecells").width()+(s.ejScroller("isVScroll")?18:0)?h-1:n-1-(s.ejScroller("isVScroll")?18:0)),this.model.timeScale.enable||("20px"==this.model.cellHeight?this.element.find(".e-draggableworkarea").height(s.ejScroller("isHScroll")?u-1-(s.ejScroller("isHScroll")?18:0):u-1):this.element.find(".e-draggableworkarea").height(parseInt(this.model.cellHeight)))),this.model.cellWidth&&this.element.find(".e-datecommondiv").parent().width(this.element.width()-2),this.element.find(".e-headrealldaytable").parent().width(this.element.find(".e-draggableworkarea").width())}else this.element.find(".e-draggableworkarea").height(o-1),this.model.showOverflowButton||this._monthCellsRender(),this.element.find(".e-vscroll").length>0&&!this._mediaQuery?this.element.find(".e-draggableworkarea").width(n-1-(s.ejScroller("isVScroll")?18:0)):"month"==this.currentView()||this._isCustomMonthView()||!this.model.timeScale.enable?(this.element.find(".e-draggableworkarea").width(n-1),this.element.find(".e-draggableworkarea").height(o)):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").parent().width(this.element.find(".e-draggableworkarea").width()),this.element.find(".e-scrolltimecells").height(this.element.find(".e-draggableworkarea").height());else s.ejScroller("isHScroll")?"":this.element.find(".e-draggableworkarea").css("height","100%")&&this.element.find(".e-resfootertr").css("height","0px"),s.ejScroller("isVScroll")?"":this.element.find(".e-draggableworkarea").css("height",o-19),(this.model.cellWidth||"20px"!=this.model.cellHeight)&&(i=e(this.element.find(".e-workcells")[0]).parent().find("td").length,s.ejScroller("isHScroll")?"":this.element.find(".e-draggableworkarea").width(parseInt(this.model.cellWidth)*i),("month"==this.currentView()||this._isCustomMonthView())&&this.element.find(".e-headerdays").children().css("width",this.element.find(".e-draggableworkarea").children().width()+"px"),"20px"==this.model.cellHeight||this.model.resources||this.element.find(".e-draggableworkarea").height(parseInt(this.model.cellHeight)-1)),this.element.find(".e-horizontaltabletimecell").width(this.element.find(".e-workcellstab").width()),this.model.timeScale.enable||"month"==this.currentView()||this._isCustomMonthView()||(this.model.cellWidth||"webkit"==this._browserInfo.name?"webkit"==this._browserInfo.name&&"month"!=this.currentView()?(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-headerdays").width(this.model.cellWidth):(this.element.find(".e-dateheadercell").width(this.element.find(".e-workcells").width()),this.element.find(".e-workcells").width(this.element.find(".e-workcells").width())))},_highlightBusinessHours:function(){var i,s,a,n,o,r,l,d,h,c,u,m,p;if("agenda"==this.currentView())return!1;if(i=!t.isNullOrUndefined(this.model.group)&&!t.isNullOrUndefined(this.model.resources)&&(!t.isNullOrUndefined(this.model.group)&&!t.isNullOrUndefined(this.model.resources[this.model.resources.length-1].resourceSettings.workWeek)||!t.isNullOrUndefined(this.model.group)&&!t.isNullOrUndefined(this.model.resources)&&!t.isNullOrUndefined(this.model.resources[this.model.resources.length-1].resourceSettings.start)||!t.isNullOrUndefined(this.model.resources[this.model.resources.length-1].resourceSettings.end))){ this.element.find(".e-workcells, .e-monthcells").removeClass("e-businesshighlightworkcells e-monthcellhighlight");var g,_,f,b,v,x,w,y,C,d,S,r,T,D,I=0,k=[],c=this.element.find(".e-workcellstab tr"),P="horizontal"==this.model.orientation&&this.model.group.resources.length>1?this._resourceSort():this.res1;if("vertical"==this.model.orientation){for(m=0;m=this.model.startHour?this.model.workHours.start-this.model.startHour:0,f=this.model.workHours.end<=this.model.endHour?this.model.workHours.end-this.model.startHour:this.model.endHour-this.model.startHour):(b=P[m][this.model.resources[this.model.resources.length-1].resourceSettings.start],v=P[m][this.model.resources[this.model.resources.length-1].resourceSettings.end],_=t.isNullOrUndefined(b)?this.model.workHours.start>=this.model.startHour?this.model.workHours.start:this.model.startHour:b>=this.model.startHour?b:this.model.workHours.start>=this.model.startHour?this.model.workHours.start:this.model.startHour,f=t.isNullOrUndefined(v)?this.model.workHours.end<=this.model.endHour?this.model.workHours.end:this.model.endHour:v<=this.model.endHour?v:this.model.workHours.end<=this.model.endHour?this.model.endHour:this.model.workHours.end),x=this.model.endHour-this.model.startHour,w=Math.floor(c.length/x*_)-this.model.startHour*this.model.timeScale.minorSlotCount,y=Math.floor(c.length/x*f)-this.model.startHour*this.model.timeScale.minorSlotCount,d="week"===this.currentView()?7:"workweek"===this.currentView()?S.length:"customview"===this.currentView()&&this._renderDays<=7?this._dateRender.length:1,s=w;s=this.model.startHour?this.model.workHours.start:this.model.startHour:b>=this.model.startHour?b:this.model.workHours.start>=this.model.startHour?this.model.workHours.start:this.model.startHour,f=t.isNullOrUndefined(v)?this.model.workHours.end<=this.model.endHour?this.model.workHours.end:this.model.endHour:v<=this.model.endHour?v:this.model.workHours.end<=this.model.endHour?this.model.endHour:this.model.workHours.end,x=this.model.endHour-this.model.startHour,C=e(c[m]).children().length/g.length,w=Math.floor(C/x*_),y=Math.floor(C/x*f),s=0;s1){o=m,r=this.model.resources.length-1;do l=new t.DataManager(this.model.resources[r-1].resourceSettings.dataSource).executeLocal((new t.Query).where(this.model.resources[r-1].resourceSettings.id,t.FilterOperators.equal,P[o][this.model.resources[this.model.resources.length-1].resourceSettings.groupId])),t.isNullOrUndefined(l)||(o=P.indexOf(l[0]),e(e(c[o]).children()[n]).addClass("e-businesshighlightworkcells")),r-=1;while(r>0)}this._businessHourScroller()}else this._horizontalBusinessHighlight(null,null,null,null,null)}else if("month"!==this.currentView()&&!this._isCustomMonthView()&&this.model.timeScale.enable){this.element.find(".e-workcells").removeClass("e-businesshighlightworkcells");var g=this.dateRender,c=this.element.find(".e-workcells"),L=this.model.workHours.start>=this.model.startHour?this.model.workHours.start-this.model.startHour:0,R=this.model.workHours.end<=this.model.endHour?this.model.workHours.end-this.model.startHour:this.model.endHour-this.model.startHour,M=60/this.model.timeScale.majorSlot*this.model.timeScale.minorSlotCount;if(this.res1=t.isNullOrUndefined(this.model.group)||t.isNullOrUndefined(this.model.resources)?[0]:this.res1,d="week"===this.currentView()?7*this.res1.length:"workweek"===this.currentView()?this.model.workWeek.length*this.res1.length:"customview"===this.currentView()&&this._renderDays<=7?this._dateRender.length*this.res1.length:1*this.res1.length,"vertical"==this.model.orientation){for(m=L*M;m",s=0;s";break;case"week":i+="
  • ";break;case"workweek":i+="
  • ";break;case"month":i+="
  • ";break;case"customview":i+="
  • ";break;case"agenda":i+="
  • "}i+="",this._scheduleDrawer.append(i),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:e.proxy(this._slideMenuClick,this)},position:"normal"}),this.model.enableRTL&&this._scheduleDrawer.parent().css("left","0px"),this._navDrawer=!1}},_slideMenuClick:function(t){var i,s,a,n,o,r;if(this._navDrawer)return!1;if(this._scheduleDrawer.ejNavigationDrawer("close"),i=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","open"!=i)this._navView=this._navSelected=!0,this.currentView()!=i&&this._viewChange(null,this.currentView(),i),this._navSelected=!1;else if("agenda"!=this.currentView()){for(s=new Date(this.currentDate()),n=0,s=new Date(s.setHours(0,0,0,0)),o=0;o"+this._getLocalizedLabels("Ok")+"";this._alertWindow.append(i),this.element.append(this._alertWindow),this._alertWindow.find(".e-alertbutton").ejButton({enableRTL:this.model.enableRTL,showRoundedCorner:!0,width:"100px",click:e.proxy(this._alertClose,this),cssClass: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:e.proxy(this._alertClose,this)}),e("#"+this._id+"alertWindow_wrapper").addClass("e-scheduledialog").find(".e-titlebar").addClass("e-dialogheader")},_alertClose:function(t){this._alertWindow.find(".e-alerttext").html(""),"click"==t.type&&t.model.text==this._getLocalizedLabels("Ok")&&0!=this._alertWindow.find(".e-alertCancel").length&&this._deletingAppointment(),0!=e("#"+this._id+"alertcancel").length&&e("#"+this._id+"alertcancel").remove(),this._alertWindow.ejDialog("close")},_renderAppointmentWindow:function(){var i,s,a,n;this._mediaQuery?(this._appointmentAddWindow=t.buildTag("div.e-scheduledialog#"+this._id+"AppointmentAddEditWindow"),i="
    ",i+="",this.model.showLocationField&&(i+=""),i+="",i+="",this.model.prioritySettings.enable&&(i+=""),i+="",i+="",this.model.categorizeSettings.enable&&(i+=""),!t.isNullOrUndefined(this.model.resources)&&this.model.resources.length>0&&t.scheduleFeatures.resources&&(i=this._renderResourceElements(i)),i+="",i+="
    "+this._getLocalizedLabels("AppointmentSubject")+":
    "+this._getLocalizedLabels("Location")+":
    "+this._getLocalizedLabels("StartTime")+":
    "+this._getLocalizedLabels("EndTime")+":
    "+this._getLocalizedLabels("Priority")+":
    "+this._getLocalizedLabels("Categorize")+":
    Description:
    ",i+="
    ",a=t.buildTag("div.e-recurEditor#"+this._id+"recurrrenceEditor").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}),n="
    ",this._appointmentAddWindow.append(i).append(a),this._appointmentAddWindow.find(".e-recurEditor").css("display","none"),this._appointmentAddWindow.find(".e-recurEditor").append(n),this._appointmentAddWindow.find("#"+this._id+"donerecur").ejButton({enableRTL:this.model.enableRTL,showRoundedCorner:!0,width:"100px",click:e.proxy(this._closeRecurence,this),cssClass:this.model.cssClass}),this._appointmentAddWindow.find("#"+this._id+"cancelrecur").ejButton({enableRTL:this.model.enableRTL,showRoundedCorner:!0,width:"100px",click:e.proxy(this._closeRecurence,this),cssClass:this.model.cssClass})):(this._appointmentAddWindow=t.buildTag("div.e-scheduledialog#"+this._id+"AppointmentAddEditWindow"),i="
    ",i+="",this.model.showLocationField&&(i+=""),i+="",i+="",s=this.model.prioritySettings.enable?"":"",i+=""+s+"",i+="",this.model.categorizeSettings.enable&&(i+=""),!t.isNullOrUndefined(this.model.resources)&&this.model.resources.length>0&&t.scheduleFeatures.resources&&(i=this._renderResourceElements(i)),i+="",i+="
    "+this._getLocalizedLabels("AppointmentSubject")+":
    "+this._getLocalizedLabels("Location")+":
    "+this._getLocalizedLabels("StartTime")+":
    "+this._getLocalizedLabels("EndTime")+":
    "+this._getLocalizedLabels("Priority")+":
    "+this._getLocalizedLabels("Categorize")+":
    ",i+="
    ",a=t.buildTag("div.e-recurEditor#"+this._id+"recurrrenceEditor").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}),n="
    ",this._appointmentAddWindow.append(i).append(a),this._appointmentAddWindow.find(".e-recurEditor").append(n),this._appointmentAddWindow.find("#"+this._id+"donerecur").ejButton({enableRTL:this.model.enableRTL,showRoundedCorner:!0,width:"100px",click:e.proxy(this._closeRecurence,this),cssClass:this.model.cssClass}),this._appointmentAddWindow.find("#"+this._id+"cancelrecur").ejButton({enableRTL:this.model.enableRTL,showRoundedCorner:!0,width:"100px",click:e.proxy(this._closeRecurence,this),cssClass:this.model.cssClass}),this._appointmentAddWindow.find(".e-recurEditor").css("display","none")),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:e.proxy(this._onclose,this)}),e("#"+this._id+"AppointmentAddEditWindow_wrapper").appendTo("body").addClass("e-scheduledialog").find(".e-titlebar").addClass("e-dialogheader"),e("#"+this._id+"priority_popup_wrapper").addClass("e-schedulepriority"),this._on(this._appointmentAddWindow,"click","a.e-recuredit",e.proxy(this._editRecurrence,this)),this._mediaQuery&&this._appointmentAddWindow.ejDialog("refresh")},_renderQuickAppWindow:function(){var i,s;this._quickAppointWindow=t.buildTag("div.e-scheduledialog#"+this._id+"AppointmentQuickWindow"),i="
    ",i+="
    "+this._getLocalizedLabels("AppointmentSubject")+":
    ",i+="
    "+this._getLocalizedLabels("Detailed")+" >>
    ",this._quickAppointWindow.append(i),this.element.append(this._quickAppointWindow),this._quickAppointWindow.append(t.buildTag("div.e-quickarrow").append("
    ").append("
    ")),s=this._quickAppointWindow,s.find(".e-btndone").ejButton({showRoundedCorner:!0,width:"130px",click:e.proxy(this._saveAppointment,this),cssClass:this.model.cssClass,enableRTL:this.model.enableRTL}),this._on(s.find(".e-scheduleclose"),"click",e.proxy(this._quickWindowClose,this)),this._on(s.find(".e-detailedapp"),"click",e.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:e.proxy(function(){this._processFocus()},this)}),e("#"+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="
    ";i+="
    ",i+="
    "+this._getLocalizedLabels("Editevent")+" |
    "+this._getLocalizedLabels("Editseries")+" >>
    ",this._quickAppDetailsWindow.append(i),this.element.append(this._quickAppDetailsWindow),this._quickAppDetailsWindow.append(t.buildTag("div.e-quickarrow").append("
    ").append("
    ")),this._on(this._quickAppDetailsWindow.find(".e-scheduleclose"),"click",e.proxy(this._quickAppDetailWindowClose,this)),this._on(this._quickAppDetailsWindow.find(".e-scheduledelete"),"click",e.proxy(this._deleteAppoint,this)),this._on(this._quickAppDetailsWindow.find(".e-editevent,.e-editseries"),"click",e.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:e.proxy(function(){this._processFocus()},this)}),e("#"+this._id+"AppDetailsWindow_wrapper").addClass("e-scheduledialog e-schedulequickdialog").css("overflow","visible").find("#"+this._id+"AppDetailsWindow").addClass("e-dialogouter")},_editClick:function(i){if(e(i.target).hasClass("e-editseries")&&this._quickAppDetailsWindow.find(".e-editseries").hasClass("e-disable"))return!1;var s=(new t.Query).where("Guid",t.FilterOperators.equal,this._appUid),a=new t.DataManager(this._processed).executeLocal(s); e(i.target).hasClass("e-editevent")?1==a[0][this._appointmentSettings.recurrence]?(this._parentId=a[0].ParentId,this._currentAction=t.Schedule.Actions.EditOcurrence,this._showAppointmentDetails(this._appUid,!0)):t.isNullOrUndefined(a[0][this._appointmentSettings.recurrence])?(this._currentAction=t.Schedule.Actions.Save,this._showAppointmentDetails(this._appUid,!0)):(this._currentAction=t.Schedule.Actions.Save,this._showAppointmentDetails(a[0].Guid,!0)):e(i.target).hasClass("e-editseries")&&1==a[0][this._appointmentSettings.recurrence]&&(this._parentId=null==a[0][this._appointmentSettings.recurrenceId]?a[0].ParentId:a[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 s,a,n;this.model.readOnly||(t.isNullOrUndefined(i)||!t.isNullOrUndefined(this._quickAppDetailsWindow)&&this._quickAppDetailsWindow.ejDialog("isOpen")?(n=new t.DataManager(this._processed).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,this._appUid)),this._recurId=n[0][this._appointmentSettings.recurrenceId],n[0][this._appointmentSettings.recurrence]||!this.model.showDeleteConfirmationDialog?(this.model.showQuickWindow&&this._quickAppDetailsWindow.ejDialog("isOpen")&&this._quickAppDetailsWindow.ejDialog("close"),this._deletingAppointment()):this._deleteConfirmation()):(s=e(i.target).parent(),a=s.hasClass("e-appointment")||s.hasClass("e-monthappointment")||s.hasClass("e-alldayappointment")||s.hasClass("e-agendaappointment")?s:s.parents(".e-appointment,.e-alldayappointment,.e-monthappointment,.e-agendaappointment"),this._appUid=a.attr("guid"),this._mediaQuery&&(this._mAppId=this._appUid),n=new t.DataManager(this._processed).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,this._appUid)),this._recurId=n[0][this._appointmentSettings.recurrenceId],n[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 e=this._getAppointmentByParentId(this._mediaQuery?t.isNullOrUndefined(this._mAppId)?this._appUid:this._mAppId:this._appUid);e[this._appointmentSettings.recurrence]?(this._parentId=parseInt(e.AppTaskId),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(){if(this.model.showQuickWindow&&this._quickAppDetailsWindow.ejDialog("close"),t.isNullOrUndefined(this._alertWindow)&&this._renderAlertWindow(),0==e(".e-alertbtn").find(".e-alertCancel").length){var i="";this._alertWindow.find(".e-alertbtn").append(i),this._alertWindow.find(".e-alertCancel").ejButton({enableRTL:this.model.enableRTL,showRoundedCorner:!0,width:"100px",click:e.proxy(this._alertClose,this),cssClass:this.model.cssClass}),this._mediaQuery&&this._alertWindow.find(".e-alertCancel").css({margin:"0px 20px 15px 10px"}),e("#"+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-alertOk").html(this._getLocalizedLabels("Delete"))}this._alertWindow.ejDialog("isOpen")||(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:"12"==this._timeMode?"12:00 AM":"00:00",enabled:!1}),this._appointmentAddWindow.find("#"+this._id+"endtime").ejTimePicker({value:"12"==this._timeMode?"11:59 PM":"23:59",enabled:!1}),this._appointmentAddWindow.find(".startutc,.endutc").ejDropDownList({enabled:!1});else{if(""!=this._tempStart||""!=this._tempEnd){var e=t.format(new Date((new Date).setHours(0,0,0)),this._pattern.t),i=t.format(new Date((new Date).setHours(23,59,59)),this._pattern.t);this._appointmentAddWindow.find("#"+this._id+"starttime").ejTimePicker({value:this._tempStart}),this._appointmentAddWindow.find("#"+this._id+"endtime").ejTimePicker({value:this._tempEnd}),("12"==this._timeMode?this._tempStart==e&&this._tempEnd==i:"00:00"==this._tempStart&&"23:59"==this._tempEnd)&&(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._appointmentAddWindow.find("#"+this._id+"endtime").ejTimePicker({value:t.format(new Date("1/1/2000 "+this.model.workHours.start+":30:00"),this._pattern.t)}))}this._appointmentAddWindow.find(".startendtime").ejTimePicker({enabled:!0}),this._appointmentAddWindow.find(".startutc,.endutc").ejDropDownList({enabled:!0}),this._endSlotChange=!0,this._startSlotChange=!0}},_renderRecurEditWindow:function(){this._recurEditWindow=t.buildTag("div.e-scheduledialog#"+this._id+"RecurrenceEdit");var i=t.buildTag("div.e-recureditmsg",this._getLocalizedLabels("RecurrenceEditMessage")),s=this._getLocalizedLabels("RecurrenceEditOnly"),a=this._getLocalizedLabels("RecurrenceEditSeries"),n=t.buildTag("div.e-recureditbtns").append(t.buildTag("button.e-editonly#"+this._id+"Editonly",s,{},{name:"recurrenceeditonly",value:s})).append(t.buildTag("button.e-editseries#"+this._id+"EditSeries",a,{},{name:"recurrenceeditseries",value:a}));this._recurEditWindow.append(i).append(n),n.find(".e-editonly,.e-editseries").ejButton({cssClass:this.model.cssClass,enableRTL:this.model.enableRTL,showRoundedCorner:!0}),this._on(this._recurEditWindow,"click",".e-editonly,.e-editseries",e.proxy(this._recurBtnClick,this)),this._on(this._recurEditWindow,"click","div.e-scheduleclose",e.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:e.proxy(this._processFocus,this),beforeOpen:e.proxy(this._deleteBeforeOpen,this)}),e("#"+this._id+"RecurrenceEdit_wrapper").appendTo("body").addClass("e-scheduledialog")},_recrConformClose:function(){this._recurEditWindow.ejDialog("close"),this._processFocus()},_deleteBeforeOpen:function(){e("#"+this._id+"RecurrenceEdit_title").addClass("e-dialogheader"),e("#"+this._id+"RecurrenceEdit_title").find(".e-title").html(this._currentAction==t.Schedule.Actions.Delete?this._getLocalizedLabels("RecurrenceDeleteTitle"):this._getLocalizedLabels("RecurrenceEditTitle"))},_recurBtnClick:function(s){var a,n,o,r,l,d,h,c,u;if(e(s.target).hasClass("e-editonly"))if(this._editOnlyClicked=!0,this._currentAction==t.Schedule.Actions.Delete){if(a=new t.DataManager(this._processed).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,this._appUid))[0],a[this._appointmentSettings.recurrenceRule].toString().indexOf("RECUREDITID")!=-1)if(n=null==a[this._appointmentSettings.recurrenceId]?a.ParentId:a[this._appointmentSettings.recurrenceId],o=new t.DataManager(this._currentAppointmentData).executeLocal((new t.Query).where("AppTaskId",t.FilterOperators.equal,n)),l=this.dataSource()instanceof t.DataManager?this._dataManager.remove(this._appointmentSettings.id,a[this._appointmentSettings.id]):this._dataManager.remove("Guid",a.Guid),h=this,e.isFunction(l.promise))l.done(function(i){if(h._trigger("actionBegin",{id:h._appId,requestType:"appointmentDelete"}))return!1;if(h.model.enableLoadOnDemand)h._initDataSource("refresh");else{var s=t.isNullOrUndefined(i.record)?i:i.record;h._currentAppointmentData.length=0,h._dateFormat(s),h._bindAppointments=!0,h._currentAppointmentData=e.merge(h._currentAppointmentData,s),h._dataProcessing(s),h._renderAppointmentAll()}h._trigger("beforeAppointmentRemove",{appointment:o}),h._trigger("actionComplete",{appointment:o,requestType:"appointmentDelete"}),h._trigger("appointmentRemoved",{appointment:o,requestType:"appointmentDeleted"})}),l.fail(function(){});else{if(this._trigger("actionBegin",{id:this._appUid,requestType:"appointmentDelete"}))return!1;r=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:r},"Guid"),this._renderAppointmentAll(),this._trigger("beforeAppointmentRemove ",{appointment:o}),this._trigger("actionComplete",{appointment:o,requestType:"appointmentDelete"}),this._trigger("appointmentRemoved",{appointment:o,requestType:"appointmentDeleted"})}else{var n=null==a[this._appointmentSettings.recurrenceId]?a.ParentId:a[this._appointmentSettings.recurrenceId],m=this._deleteOcurrence(n,a[this._appointmentSettings.startTime]),p=this._timeZoneAppointments(m[0],"");if(l=this.dataSource()instanceof t.DataManager?this._dataManager.update(this._appointmentSettings.id,p):this._dataManager.update("AppTaskId",p),d=this._timeZoneAppointments(p,"reverse"),new t.DataManager(this._currentAppointmentData).update("AppTaskId",d),h=this,l&&e.isFunction(l.promise)&&this.dataSource()instanceof t.DataManager)l.done(function(i){if(h._trigger("actionBegin",{id:h._appId,requestType:"appointmentDelete"}))return!1;if(h.model.enableLoadOnDemand)h._initDataSource("refresh");else{var s=t.isNullOrUndefined(i.record)?i:i.record;h._currentAppointmentData.length=0,h._dateFormat(s),h._bindAppointments=!0,h._currentAppointmentData=e.merge(h._currentAppointmentData,s),h._dataProcessing(s),h._renderAppointmentAll()}h._trigger("beforeAppointmentRemove",{appointment:a}),h._trigger("appointmentRemoved",{appointment:a,requestType:"appointmentDeleted"}),h._trigger("actionComplete",{appointment:a,requestType:"appointmentDelete"})}),l.fail(function(){});else{if(this._trigger("actionBegin",{id:this._appId,requestType:"appointmentDelete"}))return!1;if(this._trigger("beforeAppointmentRemove",{appointment:a}))return this._recurEditWindow.ejDialog("close"),!1;if(this._refreshCellsHeight(),new Date(new Date(d[this._appointmentSettings.startTime]).setHours(0,0,0,0)).getTime()0&&"workweek"==this.currentView()||"week"==this.currentView()){for(u=0;u<7;u++)p=new Date(m),p.setDate(m.getDate()+u),this._dateRender.push(new Date(p.getFullYear(),p.getMonth(),p.getDate()).getTime());this._renderDates=e.extend(!0,[],this._dateRender)}if(this._resWorkWeek){if(this.model.resources.length>1){for(i=this._resourceSort(),s=[],x=0;x=_[0]){for(l=0;l<_.length;l++)if(this._firstdayofweek<=_[l]){d=_[l];break}}else for(l=0;l<_.length;l++)if(this._firstdayofweek>_[l]){d=_[l];break}for(u=0,h=0;u<_.length;u++)d<=_[u]&&(f[h]=_[u],h++);for(f=e.merge(f,_),f=0!=this._firstdayofweek&&this._firstdayofweek<=d?e.unique(f):e.unique(_),u=0,h=0;uthis.currentDate().getTime()?this.currentDate(new Date(this._renderStart)):(this._renderStart=new Date(this.currentDate()),this._renderEnd=new Date(this._renderStart.getTime()+864e5*(this._renderDays-1)))),c=this._renderDays<=7?this._renderDays:this._numDays,m=this._renderDays<=7?new Date(this.currentDate()):"vertical"==this.model.orientation?this._firstweekdate(this.currentDate()):new Date(this.currentDate()),u=0;u1&&s.length<=7?new Date(s[0]).getYear()===new Date(s[s.length-1]).getYear()?new Date(s[0]).getMonth()===new Date(s[s.length-1]).getMonth()?e=t.format(new Date(s[0]),"dd")+" - "+t.format(new Date(s[s.length-1]),"dd MMM yyyy"):new Date(s[0]).getMonth()!==new Date(s[s.length-1]).getMonth()&&(e=this.model.enableRTL?t.format(new Date(s[s.length-1]),"MMM dd")+" - "+t.format(new Date(s[0]),"dd MMM yyyy"):t.format(new Date(s[0]),"dd MMM")+" - "+t.format(new Date(s[s.length-1]),"dd MMM yyyy")):e=t.format(new Date(s[0]),"MMM dd yyyy")+" - "+t.format(new Date(s[s.length-1]),"MMM dd yyyy"):e=new Date(s[0]).getFullYear()==new Date(s[s.length-1]).getFullYear()?new Date(s[0]).getMonth()==new Date(s[s.length-1]).getMonth()?t.format(new Date(this.currentDate()),"MMM yyyy"):t.format(new Date(s[0]),"MMM")+" - "+t.format(new Date(s[s.length-1]),"MMM yyyy"):t.format(new Date(s[0]),"MMM yyyy")+" - "+t.format(new Date(s[s.length-1]),"MMM yyyy"):"agenda"===this.currentView()?(s=new Date(this.currentDate()),i=this.model.agendaViewSettings.daysInAgenda>0?this.model.agendaViewSettings.daysInAgenda-1:0,new Date(s).getYear()===new Date(new Date(s).setDate(s.getDate()+i)).getYear()?new Date(s).getMonth()===new Date(new Date(s).setDate(s.getDate()+i)).getMonth()?e=t.format(new Date(s),"dd")+" - "+t.format(new Date(new Date(s).setDate(s.getDate()+i)),"dd MMM yyyy"):new Date(s).getMonth()!==new Date(new Date(s).setDate(s.getDate()+i)).getMonth()&&(e=this.model.enableRTL?t.format(new Date(new Date(s).setDate(s.getDate()+i)),"MMM dd")+" - "+t.format(new Date(s),"dd MMM yyyy"):t.format(new Date(s),"dd MMM")+" - "+t.format(new Date(new Date(s).setDate(s.getDate()+i)),"dd MMM yyyy")):e=t.format(new Date(s),"MMM dd yyyy")+" - "+t.format(new Date(new Date(s).setDate(s.getDate()+i)),"MMM dd yyyy")):e=t.format(new Date(this.currentDate()),"MMM yyyy"),e},_firstweekdate:function(e){var t=new Date(e),i=t.getDay();return 0==this._firstdayofweek?0!=i&&(t.setDate(t.getDate()-i),!this.model.timeScale.enable&&("workweek"==this.currentView()||this._oneWeek)&&this._resize&&(t=new Date(this._dateRender[0]))):0!=this._firstdayofweek&&this.currentDate().getDay()>=this._firstdayofweek?(i-=this._firstdayofweek,i=t.getDate()-i,t.setDate(i)):0!=this._firstdayofweek&&this.currentDate().getDay()=7?7-(7*(parseInt(a.index()/7)+1)-a.index())+7*a.parent().index():a.index(),"horizontal"==this.model.orientation&&(this._cellIndex=this.model.showTimeScale?"month"===this.currentView()||this._isCustomMonthView()?this._cellIndex:Math.floor(this._cellIndex/(2*(this.model.endHour-this.model.startHour))):a.index(),this._workCellIndex=a.parent().index()),i="horizontal"==this.model.orientation&&"month"==this.currentView()?this.monthDays:this._dateRender,s=new Date(i[this._cellIndex]),!(this.model.minDate>s||this.model.maxDate0)for(n=0;n=5?o.setDate(o.getDate()-r+this._firstdayofweek-7):this._firstdayofweek<5?(o.setDate(o.getDate()-r+this._firstdayofweek),o.getMonth()==new Date(n.getFullYear(),n.getMonth(),1).getMonth()&&o.setDate(new Date(n.getFullYear(),n.getMonth(),1).getDate()-r+this._firstdayofweek-7)):o.setDate(o.getDate()-r),e=new Date(n.getFullYear(),n.getMonth()+1,0).getDate(),0==this._firstdayofweek||5==this._firstdayofweek||6==this._firstdayofweek?(i=(r+e-1)%7!=0?7-(r+e-1)%7:0,t=parseInt((r+e+i)/7)):(i=7-new Date(n.getFullYear(),n.getMonth()+1,0).getDay(),t=30==e||6==n.getMonth()?6:5),s=[],this.monthDays=[],a=0;a<7*t;a++)o.setDate(o.getDate()+1),s.push(new Date(o.getFullYear(),o.getMonth(),o.getDate(),0,0,0).getTime()),new Date(this.currentDate()).getMonth()===new Date(s[a]).getMonth()&&this.monthDays.push(s[a]);return new Date(s[0]).getDate()==new Date(n.getFullYear(),n.getMonth(),1).getDate()&&(s=s.splice(0,35)),s},_getStartEndTime:function(){var e,i,s,a,n,o=[];if(this._timeInitial=0,i=this._culture.calendar,"vertical"===this.model.orientation)if("month"==this.currentView()||this._isCustomMonthView())for(s=this._dateRender.length,n=0;nnew Date(new Date(a).setHours(0,n,0,0)).getTime()&&(e=(n/60===this.model.startHour||n/60==12)&&i.AM&&i.PM?t.format(new Date(new Date(a).setHours(0,n,0,0)),"hh tt"):t.format(new Date(new Date(a).setHours(0,n,0,0)),"hh mm"),o.push({time:e,id:n/60})):o.push({time:new Date(new Date(a).setHours(0,n,0,0)).toTimeString().slice(0,5)+" 00"}),n+=this.model.timeScale.majorSlot;else o=this._getUserTimeCellsTemplate();else"horizontal"==this.model.orientation&&t.scheduleFeatures.horizontal&&(o=this._getHoriStartEndTime(i));return o},_getWorkCellsCount:function(){var e,t,i,s,a=[];if(this.model.timeScale.enable)if("month"==this.currentView()||this._isCustomMonthView())for(i=this._dateRender.length,s=0;s60*(this.model.endHour-this.model.startHour)){a.push({crow:s,cwidth:this.model.cellWidth,cheight:this.model.cellHeight});break}a.push({crow:s,cwidth:this.model.cellWidth,cheight:this.model.cellHeight})}else for(i=this._resWorkWeek?1:this._dateRender.length,s=0;s60*(this.model.endHour-this.model.startHour)){if(c.push(l),l==this.model.timeScale.minorslotcount-2){h=0;break}}else c.push(l);u.push(c),h+=this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount,c=[]}r=u}else{for(l=0;l60?l+this.model.timeScale.majorSlot/60:o>=60?l+1:l,o=o>=60?0:o,g.push(_)}s=!0}return{columnCount:r,timeValue1:g,strTime:a}},_renderAgendaContent:function(){var i,s,a,n,o,r,l,d,h,c,u,m,p,g,_,f,b,v,x,w,y,C,S,T,D,I,k,P,L,R,M,O,E,A;this.element.find(".e-agendacellstab").remove();var j=new Date(new Date(this.currentDate()).setHours(0,0,0)),N=[],z=[];for(this._app=[],this.model.group||(this.res1=["0"]),f=this._getLocalizedLabels("Recurrence"),b=this.model.agendaViewSettings.daysInAgenda>0?this.model.agendaViewSettings.daysInAgenda-1:0,v=0;v0){if(w=[],!t.isNullOrUndefined(this.model.group)&&t.scheduleFeatures.resources){for(y=this.res1[v][this.model.resources[this.model.resources.length-1].resourceSettings.groupId],L=this._resCollection,R=L.length-1;R>0;R--)C=new t.DataManager(L[R-1].dataSource).executeLocal((new t.Query).where(L[R-1].id,t.FilterOperators.equal,y)),w.push({resId:"resLevel_"+R+"_"+C[0][L[R-1].id],text:C[0][L[R-1].text]}),y=C[0][L[R-1].groupId];w.reverse()}for(S=!(t.isNullOrUndefined(this.model.group)||!t.scheduleFeatures.resources),T=x.length,g=!!this.model.resourceHeaderTemplateId,_=g?this._getResourceHeadTemplate(this.res1[v]):"",D=0,new Date(j)this.model.maxDate&&(b-=Math.floor((new Date(new Date(j).setDate(j.getDate()+b))-new Date(this.model.maxDate))/864e5));D<=b;D++)if(I=t.Predicate(this._appointmentSettings.startTime,t.FilterOperators.greaterThanOrEqual,new Date(new Date(j).setDate(j.getDate()+D))),I=I.and(this._appointmentSettings.startTime,t.FilterOperators.lessThanOrEqual,new Date(new Date(new Date(j).setDate(j.getDate()+D)).setHours(23,59,59))),I=!t.isNullOrUndefined(this.model.group)&&t.scheduleFeatures.resources?I.and(this._appointmentSettings.resourceFields.toString().split(",")[this.model.resources.length-1].trim(),t.FilterOperators.equal,this.res1[v][this.model.resources[this.model.resources.length-1].resourceSettings.id]):I,k=new t.DataManager(x).executeLocal((new t.Query).where(I)),k.length>0){N.push(N.length+1);var F=(k.length,!0),B=!1;for(R=0;R"+t.format(new Date(k[R][this._appointmentSettings.startTime]),"dd")+"
    "+t.format(new Date(k[R][this._appointmentSettings.startTime]),"dddd")+""+t.format(new Date(k[R][this._appointmentSettings.startTime]),"MMM, yyyy")+"",n=!t.isNullOrUndefined(k[R][this._appointmentSettings.allDay])&&e.parseJSON(k[R][this._appointmentSettings.allDay])?"
    "+this._getLocalizedLabels("AllDay"):i+" - "+s,o=!t.isNullOrUndefined(k[R][this._appointmentSettings.recurrence])&&e.parseJSON(k[R][this._appointmentSettings.recurrence])?k[R][this._appointmentSettings.recurrenceRule].toString().indexOf("RECUREDITID")!=-1?""+k[R][this._appointmentSettings.subject]:""+k[R][this._appointmentSettings.subject]:k[R][this._appointmentSettings.subject],r=this.model.categorizeSettings.enable&&!t.isNullOrUndefined(k[R][this._appointmentSettings.categorize])&&""!=k[R][this._appointmentSettings.categorize]?this._getCategorizeColor(k[R]):!t.isNullOrUndefined(this.model.resources)&&t.scheduleFeatures.resources?this._getResourceColor(k[R]):{appointData:"",appointCustomcss:"",appointtextcolor:""},l=!t.isNullOrUndefined(this.model.group)&&t.scheduleFeatures.resources?this.res1[v][this.model.resources[this.model.resources.length-1].resourceSettings.text]:"",d=!!this.model.appointmentTemplateId,h=d?k[R][this._appointmentSettings.recurrence]?k[R][this._appointmentSettings.recurrenceRule].toString().indexOf("RECUREDITID")!=-1?""+this._getUserAppointmentTemplate(k[R]):""+this._getUserAppointmentTemplate(k[R]):this._getUserAppointmentTemplate(k[R]):"",c=!!this.model.agendaViewSettings.dateColumnTemplateId,u=c?this._getUserTemplate(this.model.agendaViewSettings.dateColumnTemplateId,k[R]):"",m=!!this.model.agendaViewSettings.timeColumnTemplateId,p=m?this._getUserTemplate(this.model.agendaViewSettings.timeColumnTemplateId,k[R]):"",z.push({readOnly:this.model.readOnly,edittext:this._getLocalizedLabels("Edit"),deletetext:this._getLocalizedLabels("Delete"),userResourceId:g,userResourceHtml:_,userDateId:c,userDateHtml:u,userTimeId:m,userTimeHtml:p,userAppTemplId:d,userTemplate:h,resGroup:w,resName:l,resChild:S,resRowSpan:T,id:k[R].AppTaskId,uid:k[R].Guid,dayRowSpan:k.length,dayChild:F,dayBorderBottom:B,background:r.appointData,date:a,time:n,event:o}),F=!1,S=!1}}if(P=this.agendacellTemp.render({rows:N,cols:z}),this.element.find(".e-draggableworkarea").append(P),!t.isNullOrUndefined(this.model.group)&&t.scheduleFeatures.resources)for(L=this.render_Resources,R=0;R0,this._angular=this._bindAppointments&&!this._bindapp&&!this._setmodelvalue&&1==this._viewchange&&this._obj.length>0&&this.dataSource()[0][this._appointmentSettings.id]==this._obj[0][this._appointmentSettings.id],this._true=1==this.model.isDST,this._timeZoneOffset=t.isNullOrUndefined(this.model.timeZone)&&0==this.model.isDST?(new Date).getTimezoneOffset()-this._stdTimezoneOffset():0,this._currentAppointmentData=this.dataSource(),e.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._dataProcessing(this._currentAppointmentData),this.element.children().length>0&&this._renderAppointmentAll(),this._app.length<1&&this.model.showAppointmentNavigator&&this._nextPrevButton(this._app),this.tzone=this.model.timeZone,this._bindapp=!1,this._setmodelvalue=!1,this._viewchange=!1))},_initDataSource:function(i){var s,a,n,o,r,l=this._columnToSelect(this.model.appointmentSettings,i),d=e.extend(!0,[],l._params);for(this._true=1==this.model.isDST,this._timeZoneOffset=t.isNullOrUndefined(this.model.timeZone)&&0==this.model.isDST?(new Date).getTimezoneOffset()-this._stdTimezoneOffset():0,l._params=[],s=new Date(new Date(this.currentDate()).setHours(0,0,0)),a=new Date(s.getTime()+6e4*-this._timeZoneCalculate()),l.addParams("CurrentDate",a).addParams("CurrentView",this.currentView()).addParams("CurrentAction",i),n=0;n0,o._currentAppointmentData=e.result,o._overlapList=[],o._dataProcessing(e.result),o._renderAppointmentAll(),o._app.length<1&&o.model.showAppointmentNavigator&&o._nextPrevButton(o._app)}),(t.isNullOrUndefined(this._app)||this._app.length<1)&&(this._app=[],this._app.length<1&&this.model.showAppointmentNavigator&&this._nextPrevButton(this._app))},_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(e){var t=this._columnToSelect(e),i=this,s=e.dataSource.executeQuery(t);s.done(function(t){e.dataSource=t.result,i._categoryInfo.push(e),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(e){var t=this._columnToSelect(e),i=this,s=e.dataSource.executeQuery(t);s.done(function(t){e.dataSource=t.result,i._priorityInfo.push(e),i._renderPriorityItems(i._appointmentAddWindow)})},_dateFormat:function(e){if("Invalid Date"==new Date(e[0][this._appointmentSettings.startTime]).toString())for(var t=0;ts?1:0}),e},_stdTimezoneOffset:function(){var e=new Date,t=new Date(e.getFullYear(),0,1),i=new Date(e.getFullYear(),6,1);return Math.max(t.getTimezoneOffset(),i.getTimezoneOffset())},_timeZoneCalculate:function(){var i,s,a,n=(new Date).getTimezoneOffset();if(null==this.model.timeZone)obj=0==this.model.isDST?-n+this._timeZoneOffset:-n;else if(this.model.timeZone.indexOf(":")!==-1)if(t.isNullOrUndefined(this.tzone)&&(this.tzone=this.model.timeZone),s=this.model.timeZone.indexOf("UTC")!=-1?" "!==this.model.timeZone[3]?this.model.timeZone.split(":"):this.model.timeZone.split(" ")[1].split(":"):this.model.timeZone.split(":"),a=this.tzone.indexOf("UTC")!=-1?" "!==this.tzone[3]?this.tzone.split(":"):this.tzone.split(" ")[1].split(":"):this.tzone.split(":"),e.isNumeric(parseInt(s[0]))&&parseInt(s[0]).toString.length<=2||s[0].indexOf("UTC")!==-1){var o=this.model.timeZone.indexOf("-")!==-1?-parseInt(s[0].replace(/\D/g,"")):parseInt(s[0].replace(/\D/g,"")),r=parseInt(s[1]),l=-(60*o+r);if(1==this._setmodelvalue){if(this.tzone==this.model.timeZone)i=-n+l;else{var d=this.tzone.indexOf("-")!==-1?-parseInt(a[0].replace(/\D/g,"")):parseInt(a[0].replace(/\D/g,"")),h=parseInt(a[1]),c=-(60*d+h);i=-c+l}obj=-i}else obj=-l}else obj=-n;else obj=-n;return obj},_appointTimeZone:function(e){var i,s,a=e[this._appointmentSettings.startTimeZone],n=e[this._appointmentSettings.endTimeZone];return e.EndTimeZone=n=t.isNullOrUndefined(n)&&!t.isNullOrUndefined(a)?a:n,e.StartTimeZone=a=!t.isNullOrUndefined(n)&&t.isNullOrUndefined(a)?n:a,t.isNullOrUndefined(a)&&e[this._appointmentSettings.startTime]?(i=e[this._appointmentSettings.startTime],s=e[this._appointmentSettings.endTime],i=e[this._appointmentSettings.startTime]+this._timeZoneCalculate(e),s=e[this._appointmentSettings.endTime]+this._timeZoneCalculate(e)):t.isNullOrUndefined(a)||""==a&&""==n?a=0:(a=a.indexOf("UTC")!=-1?60*parseInt(a.split(" ")[1].split(":")[0])+parseInt(a.split(" ")[1].split(":")[1]):60*parseInt(a.split(":")[0])+parseInt(a.split(":")[1]),n=n.indexOf("UTC")!=-1?60*parseInt(n.split(" ")[1].split(":")[0])+parseInt(n.split(" ")[1].split(":")[1]):60*parseInt(n.split(":")[0])+parseInt(n.split(":")[1])),a},_timeZoneAppointments:function(e,i){var s,a,n,o;return e[this._appointmentSettings.allDay]?(e[this._appointmentSettings.startTime]=new Date(e[this._appointmentSettings.startTime]),e[this._appointmentSettings.endTime]=new Date(e[this._appointmentSettings.endTime]),e):(t.isNullOrUndefined(this._dayLight)?(localutc=(new Date).getTimezoneOffset(),n=this._appointTimeZone(e),o=t.isNullOrUndefined(n)||0==n&&null==this._appointmentSettings.startTimeZone&&null==this._appointmentSettings.endTimeZone?this._timeZoneCalculate(e):n-this._timeZoneCalculate(e)):o=this._timeValue,o=""==i?-o:o,s=new Date(e[this._appointmentSettings.startTime]),a=new Date(e[this._appointmentSettings.endTime]),e[this._appointmentSettings.allDay]&&Math.round((new Date(e[this._appointmentSettings.endTime])-new Date(e[this._appointmentSettings.startTime]))/36e5)<24?e:(e[this._appointmentSettings.startTime]=new Date(s.setMinutes(s.getMinutes()+o)),e[this._appointmentSettings.endTime]=new Date(a.setMinutes(a.getMinutes()+o)),e))},_dataProcessing:function(e){var i,s,a;if(this._processed=[],this._appMainId=null,e.length>0){for(i=this._sortAppById(e),this._maxId=t.isNullOrUndefined(e[0])||t.isNullOrUndefined(e[0].AppTaskId)?1:e[0].AppTaskId,this.app=!0,s=0;s0?this.model.agendaViewSettings.daysInAgenda-1:0))).setHours(23,59,59)):new Date(new Date(this._dateRender[this._dateRender.length-1]).setHours(23,59,59)),c);u24?(_.Guid=this._guidFormatGenerate(),this._multipleSplit(_,this._maxId,_[this._appointmentSettings.startTime],_[this._appointmentSettings.endTime])):e.isEmptyObject(_)||(_.Guid=this._guidFormatGenerate(),this._processed.push(_)),u++,this._maxId++}this._filt=!1},_recurrenceAppSort:function(i){for(var s,a,n=[],o=0;o1?(a=e.extend(!0,[],s),a[0][this._appointmentSettings.endTime]=a[a.length-1][this._appointmentSettings.endTime],n.push(a[0]),o++):n.push(i[o]);return n},_appointmentProcessing:function(i){var a,n=this._appointmentAddWindow.find(".e-recurrenceeditor").data("ejRecurrenceEditor");this._maxId=t.isNullOrUndefined(this._appMainId)?parseInt(this._maxId):parseInt(this._appMainId)+1;var o=(new Date(i[this._appointmentSettings.startTime]),(new Date(i[this._appointmentSettings.endTime])-new Date(i[this._appointmentSettings.startTime]))/1e3);Math.floor(o/3600),Math.floor(o%3600/60);n._rRule={},_count=0,_lastDay=!1,a={},a=e.extend(!0,{},i),t.isNullOrUndefined(i[this._appointmentSettings.recurrence])||t.isNullOrUndefined(i[this._appointmentSettings.recurrenceRule])||n.recurrenceRuleSplit(i[this._appointmentSettings.recurrenceRule],i[this._appointmentSettings.recurrenceExDate]),1==i[this._appointmentSettings.recurrence]&&t.isNullOrUndefined(n._rRule.recurEditId)&&this._RecurrenceAppointment(i),new Date(new Date(i[this._appointmentSettings.startTime]).setHours(0,0,0,0)).getTime()24?((i[this._appointmentSettings.allDay]===!0||i[this._appointmentSettings.allDay]!==!0&&(i[this._appointmentSettings.endTime]-i[this._appointmentSettings.startTime])/36e5>24)&&1!=i[this._appointmentSettings.recurrence]?(this._filt=!0,this._appMainId=i.AppTaskId=null==i.AppTaskId?this._maxId:i.AppTaskId,t.isNullOrUndefined(i.ParentId)&&(i.ParentId=i.AppTaskId),i.Guid=t.isNullOrUndefined(i.Guid)?this._guidFormatGenerate():i.Guid,this._maxId=i.AppTaskId,this.app=!1,this._multipleSplit(i,this._maxId,i[this._appointmentSettings.startTime],i[this._appointmentSettings.endTime])):t.isNullOrUndefined(n._rRule.recurEditId)||(t.isNullOrUndefined(i.ParentId)&&(i.ParentId=n._rRule.recurEditId),this._appMainId=i.AppTaskId=null==i.AppTaskId?this._maxId:i.AppTaskId,i.Guid=t.isNullOrUndefined(i.Guid)?this._guidFormatGenerate():i.Guid,this._maxId=i.AppTaskId,this.app=!1,this._multipleSplit(i,this._maxId,i[this._appointmentSettings.startTime],i[this._appointmentSettings.endTime])),this._filt=!1):0!=i[this._appointmentSettings.recurrence]&&t.isNullOrUndefined(n._rRule.recurEditId)?i[this._appointmentSettings.recurrence]!=s&&i[this._appointmentSettings.allDay]!=s||i[this._appointmentSettings.recurrence]||(this._appMainId=i.AppTaskId=null==i.AppTaskId?this._maxId:i.AppTaskId,t.isNullOrUndefined(i.ParentId)&&(i.ParentId=i.AppTaskId),i.Guid=t.isNullOrUndefined(i.Guid)?this._guidFormatGenerate():i.Guid,i.RecurrenceId=null,i.recurrenceExDate=null,a=e.extend(!0,{},i),i.Guid=t.isNullOrUndefined(i.Guid)?this._guidFormatGenerate():i.Guid,this.app=!1,this._processed.push(i)):(this._appMainId=i.AppTaskId=null==i.AppTaskId?this._maxId:i.AppTaskId,t.isNullOrUndefined(i.ParentId)&&(i.ParentId=i.AppTaskId),t.isNullOrUndefined(n._rRule.recurEditId)||(i.ParentId=n._rRule.recurEditId),i[this._appointmentSettings.recurrenceId]=null==i[this._appointmentSettings.recurrenceId]?i.ParentId:i[this._appointmentSettings.recurrenceId],i[this._appointmentSettings.recurrenceExDate]=null==i[this._appointmentSettings.recurrenceExDate]?null:i[this._appointmentSettings.recurrenceExDate],i.Guid=t.isNullOrUndefined(i.Guid)?this._guidFormatGenerate():i.Guid,this.app=!1,this._processed.push(i)),this._appMainId=t.isNullOrUndefined(this._appMainId)||this._appMainIdnew Date(new Date(this._dateRender[this._dateRender.length-1]).setHours(29,59,59)))?(a=new Date(new Date(i).getFullYear(),new Date(i).getMonth(),new Date(i).getDate()),n=new Date(new Date(a).setHours(new Date(a).getHours()+24)),n=new Date(new Date(n).setMinutes(new Date(n).getMinutes()-1))):n=new Date(s);r>=new Date(i)&&r<=n&&n<=new Date(s);)e[this._appointmentSettings.recurrenceId]=null==e[this._appointmentSettings.recurrenceId]?null:e[this._appointmentSettings.recurrenceId],e[this._appointmentSettings.recurrenceExDate]=null==e[this._appointmentSettings.recurrenceExDate]?null:e[this._appointmentSettings.recurrenceExDate],o=this._addAppData(e,t,r,n,e.ParentId),this._processed.push(o),r=new Date(new Date(n).setMinutes(new Date(n).getMinutes()+1)),n=e[this._appointmentSettings.endTime],this._maxId=t=this._idChecking()},_multipleSplit:function(e,t,i,s){var a,n,o,r,l,d,h,c,u,m;for(i=new Date(i),"workweek"!=this.currentView()||this._resWorkWeek||(h=new Date(new Date(i).setDate(i.getDate()+1)),c=new Date(new Date(i).setDate(i.getDate()+2)),i=0==new Date(i).getDay()&&"monday"==this.model.workWeek[0]?h:6==new Date(i).getDay()?c:new Date(i)),this.starttime=new Date(this._dateRender[0])<=i||1==this._filt?new Date(new Date(i).getFullYear(),new Date(i).getMonth(),new Date(i).getDate(),new Date(i).getHours(),new Date(i).getMinutes(),new Date(i).getSeconds()):new Date(this._dateRender[0]),a=new Date(new Date(s).getFullYear(),new Date(s).getMonth(),new Date(s).getDate(),23,59,59),n=0;this.starttime<=a&&(this.starttime>=a&&!((s-i)/36e5>24)?this._filt=!1:"",o=0,r=this.starttime,"agenda"!=this.currentView()&&("horizontal"==this.model.orientation&&"month"==this.currentView()?o=new Date(r.getFullYear(),r.getMonth()+1,0).getDate()-r.getDate():"customview"==this.currentView()&&(this._renderDays<=7||"horizontal"==this.model.orientation)?(this.starttime=new Date(new Date(r).getFullYear(),new Date(r).getMonth(),new Date(r).getDate()),o=this._dateRender.indexOf(this.starttime.getTime())!=-1?this._dateRender.length-1-this._dateRender.indexOf(this.starttime.getTime()):this.starttime.getTime()new Date(this._dateRender[this._dateRender.length-1]).setHours(23,59,59)?this._dateRender.length-1:0):"day"!==this.currentView()&&(this.model.showNextPrevMonth||"month"!=this.currentView()||new Date(new Date(this.currentDate()).getFullYear(),new Date(this.currentDate()).getMonth(),1).getTime()==new Date(this.starttime.getFullYear(),this.starttime.getMonth(),1).getTime()?0==this._firstdayofweek?o=6-r.getDay():(0!=this._firstdayofweek||"month"==this.currentView())&&(o=6-r.getDay()+this._firstdayofweek):o=new Date(r.getFullYear(),r.getMonth()+1,0).getDate()-r.getDate(),this._firstdayofweek>r.getDay()&&(o=6-r.getDay()-(7-this._firstdayofweek)))),l=new Date(new Date(this.starttime).getFullYear(),new Date(this.starttime).getMonth(),new Date(this.starttime).getDate()+o),d=new Date(l).getDate()==new Date(a).getDate()&&"month"!==this.currentView()?new Date(new Date(l).setHours(s.getHours(),s.getMinutes(),s.getSeconds())):new Date(new Date(l).setHours(23,59,59)),d>=new Date(s)&&"day"!==this.currentView?d=e[this._appointmentSettings.endTime]:6==d.getDay()&&"workweek"==this.currentView()||0==d.getDay()&&"workweek"==this.currentView()?(h=new Date(new Date(d).setDate(d.getDate()-2)),c=new Date(new Date(d).setDate(d.getDate()-1)),d=6==new Date(d).getDay()?c:h):(d=d,u=!0),this.model.showNextPrevMonth||"month"!=this.currentView()||new Date(this.starttime.getFullYear(),this.starttime.getMonth(),1).getTime()==new Date(d.getFullYear(),d.getMonth(),1).getTime()||(d=new Date(this.starttime.getFullYear(),this.starttime.getMonth()+1,0,d.getHours(),d.getMinutes(),d.getSeconds())),e[this._appointmentSettings.recurrenceId]=null==e[this._appointmentSettings.recurrenceId]?null:e[this._appointmentSettings.recurrenceId],e[this._appointmentSettings.recurrenceExDate]=null==e[this._appointmentSettings.recurrenceExDate]?null:e[this._appointmentSettings.recurrenceExDate],appointment=(e[this._appointmentSettings.endTime]-e[this._appointmentSettings.startTime])/36e5>24&&1!=e[this._appointmentSettings.recurrence]?this._addAppData(e,t,r,d,e.AppTaskId):this._addAppData(e,t,r,d,e.ParentId),this._processed.push(appointment),this._maxId=t=this._idChecking(),n="workweek"==this.currentView()&&1==new Date(this._dateRender[0]).getDay()&&5==new Date(this._dateRender[this._dateRender.length-1]).getDay()?3:("workweek"==this.currentView()&&0!=this._firstdayofweek,1),this.starttime=new Date(new Date(d).getFullYear(),new Date(d).getMonth(),new Date(d).getDate()+n),m="agenda"==this.currentView()?new Date(new Date(new Date(this.currentDate()).setDate(new Date(this.currentDate()).getDate()+(this.model.agendaViewSettings.daysInAgenda>0?this.model.agendaViewSettings.daysInAgenda-1:0))).setHours(23,59,59)):new Date(this._dateRender[this._dateRender.length-1]),!(mu[0][this._appointmentSettings.startTime].getDay()&&(s=new t.DataManager(this._processed).executeLocal((new t.Query).where(this._appointmentSettings.startTime,t.FilterOperators.equal,i)),s=0==s.length?this._objDate:s,a=s,n=s[0].AppTaskId,s=new t.DataManager(this._processed).executeLocal((new t.Query).where("AppTaskId",t.FilterOperators.equal,n))),!t.isNullOrUndefined(u)&&!t.isNullOrUndefined(u[0][this._appointmentSettings.recurrenceRule])){if(o=u[0][this._appointmentSettings.recurrenceRule],h.recurrenceRuleSplit(o,u[0][this._appointmentSettings.recurrenceExDate]),t.isNullOrUndefined(h._rRule.exDate))("delete"==this._currentAction||"editOcurrence"==this._currentAction)&&u[0][this._appointmentSettings.endTime].getDay()>u[0][this._appointmentSettings.startTime].getDay()&&s[0][this._appointmentSettings.startTime].getDay()==s[0][this._appointmentSettings.endTime].getDay()?(i=s[0][this._appointmentSettings.startTime],u[0][this._appointmentSettings.recurrenceRule]=o+";EXDATE="+t.format(i,this._pattern.d),u[0][this._appointmentSettings.recurrenceExDate]=t.isNullOrUndefined(u[0][this._appointmentSettings.recurrenceExDate])?t.format(i,this._pattern.d).toString():u[0][this._appointmentSettings.recurrenceExDate]+","+t.format(i,this._pattern.d).toString()):(u[0][this._appointmentSettings.recurrenceRule]=o+";EXDATE="+t.format(i,this._pattern.d),u[0][this._appointmentSettings.recurrenceExDate]=t.isNullOrUndefined(u[0][this._appointmentSettings.recurrenceExDate])?t.format(i,this._pattern.d).toString():u[0][this._appointmentSettings.recurrenceExDate]+","+t.format(i,this._pattern.d).toString());else{for(r=o.split(";"),recurRule="",l=0;lu[0][this._appointmentSettings.startTime].getDay()&&s[0][this._appointmentSettings.startTime].getDay()==s[0][this._appointmentSettings.endTime].getDay()?(i=s[0][this._appointmentSettings.startTime],r[l]=r[l]+","+t.format(i,this._pattern.d)):r[l]=r[l]+","+t.format(i,this._pattern.d)),recurRule+=r[l];u[0][this._appointmentSettings.recurrenceRule]=recurRule,u[0][this._appointmentSettings.recurrenceExDate]=t.isNullOrUndefined(u[0][this._appointmentSettings.recurrenceExDate])?t.format(i,this._pattern.d).toString():u[0][this._appointmentSettings.recurrenceExDate]+","+t.format(i,this._pattern.d).toString()}return u}},_getWeekIndex:function(e){var t=0,i=new Date(e.getFullYear(),e.getMonth(),1),s=e.getDay();if(s!=i.getDay())do i=new Date(i.setDate(i.getDate()+1));while(s!=i.getDay());for(;i.getDate()!=e.getDate();)i=new Date(i.setDate(i.getDate()+7)),t++;return t},_addAppData:function(i,s,a,n,o){var r,l,d={};for(r in this._appointmentSettings)if("dataSource"!=r&&"query"!=r&&"tableName"!=r&&"resourceFields"!=r&&(d[this._appointmentSettings[r]]=i[this._appointmentSettings[r]]),"resourceFields"==r)for(l in!t.isNullOrUndefined(this._appointmentSettings.resourceFields)&&this._appointmentSettings.resourceFields.split(","))d[this._appointmentSettings.resourceFields.split(",")[l].trim()]=i[this._appointmentSettings.resourceFields.split(",")[l].trim()];return t.isNullOrUndefined(s)||(d.AppTaskId=s),t.isNullOrUndefined(a)||(d[this._appointmentSettings.startTime]=a),t.isNullOrUndefined(n)||(d[this._appointmentSettings.endTime]=n),t.isNullOrUndefined(o)||(d.ParentId=o),e.extend({},i,d)},_renderAppointments:function(){var i,s,a,n,o,r,l,d=e.extend(!0,[],this._dateRender);for(this._overflowFlag=!1,this._tempapp=[],this._app=[],this._filterData=[],this.day=0,this._renderedApp=[],this._renderedAllDay=[],i=1,this.level=0,this.cellwidth=this.element.find(".e-workcells").width(),this.leftPosition=0,this._filtered=[],this._variable=[],this.model.group||(this.res1=["0"]),this.resIndex=0,s=0;sthis.model.maxDate&&(n=Math.floor((new Date(d[d.length-1])-new Date(this.model.maxDate))/864e5),o=d.length-n),this._resWorkWeek)for(o=0,a=0,r=0,l=0;l",downIcon=downIcon+"";upIconHtml=""+upIcon+"",downIconHtml=""+downIcon+"",e(upIconHtml).insertBefore(e(this.element.find(".e-draggableworkarea").parent())),e(downIconHtml).insertAfter(e(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").width(this.element.find(".e-workcellstab").width()),this.element.find(".e-appup, .e-appdown").css("pointer-events","visible"),this.element.find(".e-upicon, .e-downicon").children().width(Math.floor(this.element.find(".e-workcellstab").width()/this.element.find(".e-upicon").children().length)),this.element.find(".e-downicon").css("top",this.element.find(".e-draggableworkarea").height()-20+"px"),this.model.enableRTL?this.element.find(".e-upicon, .e-downicon").children().css("float","right"):this.element.find(".e-upicon, .e-downicon").children().css("float","left"),this.element.find(".e-upicon, .e-downicon").children().css("visibility","hidden")}},_renderUpDownIconPosition:function(){var i,s,n,o,r,l,d,h;if(this.element.find(".e-upicon, .e-downicon").children().css("visibility","hidden"),this.element.find(".e-vscroll").length>0){var u=t.isNullOrUndefined(e("div#"+this._id+"_scroller").data("ejScroller")._scrollYdata)?this.element.height():e("div#"+this._id+"_scroller").data("ejScroller")._scrollYdata.scrollable,m=e("div#"+this._id+"_scroller").data("ejScroller").scrollTop(),p=m>u?u:m,g=p+this.element.find(".e-draggableworkarea").height(),_=parseInt(p/this.element.find(".e-workcells").outerHeight())+1,f=parseInt(g/this.element.find(".e-workcells").outerHeight()),v=this.element.find(".e-upicon"),x=this.element.find(".e-downicon"),w=6e4*(60*this.model.startHour+_*(this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount)),y=this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount*6e4,C=6e4*(60*this.model.startHour+f*(this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount))+y,S=this._appointmentCount();for(S=new t.DataManager(S).executeLocal((new t.Query).where(t.Predicate(this._appointmentSettings.allDay,t.FilterOperators.contains,!1))),a=0;a24}},_getDayAppointments:function(i,s){var a,n,o,r,l,d,h;this._appList=[];var c=this._dateRender,u=this._processed,m=t.Predicate(this._appointmentSettings.endTime,t.FilterOperators.greaterThanOrEqual,new Date(c[i])).and(this._appointmentSettings.startTime,t.FilterOperators.lessThanOrEqual,new Date(new Date(c[i]).setHours(23,59,59))),p=t.Predicate(this._appointmentSettings.startTime,t.FilterOperators.greaterThanOrEqual,new Date(c[i])).and(this._appointmentSettings.startTime,t.FilterOperators.lessThanOrEqual,new Date(new Date(c[i]).setHours(23,59,59))),g=m.or(p);if(g=!t.isNullOrUndefined(this.model.group)&&t.scheduleFeatures.resources?g.and(this._appointmentSettings.resourceFields.toString().split(",")[this.model.resources.length-1].trim(),t.FilterOperators.equal,this.res1[s][this.model.resources[this.model.resources.length-1].resourceSettings.id]):g,u=new t.DataManager(u).executeLocal((new t.Query).where(g)),a=t.Predicate(this._appointmentSettings.startTime,t.FilterOperators.greaterThanOrEqual,new Date(new Date(c[i-1]).setHours(24,0,0))).or(this._appointmentSettings.startTime,t.FilterOperators.greaterThanOrEqual,new Date(c[i])),u=new t.DataManager(u).executeLocal((new t.Query).where(a)),this._appList=this._alldaySort(u),u=this._appointmentSort(u),t.isNullOrUndefined(this.model.group)&&!t.isNullOrUndefined(this.model.resources)&&(u=this._sortAppById(u)),this._app=e.merge(this._app,u),"vertical"==this.model.orientation)for(n=0;n=24,r=u[n][this._appointmentSettings.allDay],new Date(new Date(c[i]).setHours(0,0,0,0)).getTime()==new Date(new Date(u[n][this._appointmentSettings.startTime]).setHours(0,0,0,0)).getTime()&&r||o?(this._setAllDayPos(u[n],i,s),this._filtered.push(u[n])):new Date(new Date(u[n][this._appointmentSettings.startTime]).setHours(0,0,0,0)).getTime()<=new Date(new Date(c[i]).setHours(0,0,0,0)).getTime()&&new Date(new Date(u[n][this._appointmentSettings.endTime]).setHours(0,0,0,0)).getTime()>=new Date(new Date(c[i]).setHours(0,0,0,0)).getTime()&&new Date(new Date(u[n][this._appointmentSettings.startTime]).setHours(0,0,0,0)).getTime()==new Date(new Date(u[n][this._appointmentSettings.endTime]).setHours(0,0,0,0)).getTime()&&(!t.isNullOrUndefined(r)&&""!=r&&(r===!0||"false"!==r.toLowerCase()&&r))===!1&&new Date(new Date(u[n][this._appointmentSettings.startTime]).setHours(0,0,0,0)).getTime()<=new Date(new Date(u[n][this._appointmentSettings.endTime]).setHours(0,0,0,0)).getTime()&&(l=(new t.Query).where("Guid",t.FilterOperators.equal,u[n].Guid),d=new t.DataManager(this._processed).executeLocal(l),r||(h=this._findAllDayApp(u[n])),h||d[0][this._appointmentSettings.allDay]&&Math.round((new Date(d[0][this._appointmentSettings.endTime])-new Date(d[0][this._appointmentSettings.startTime]))/36e5)>=24?(this._setAllDayPos(u[n],i,s),this._filtered.push(u[n])):(this._renderApp(u[n],i,s),this._filtered.push(u[n])));else"horizontal"==this.model.orientation&&t.scheduleFeatures.horizontal&&this._getHorizontalDayAppointments(u,c,i,s)},_startUtc:function(e){!t.isNullOrUndefined(this.startutcValue)&&t.isNullOrUndefined(this.tempValue)?this._utcValue(e,"startUtc"):""==e.model.value?"":e.model.value==this._appointmentAddWindow.find("#"+this._id+"endTimeZone").ejDropDownList("model.value")&&"true"==this._appointmentAddWindow.find("#"+this._id+"startTimeZone").attr("aria-expanded")?this._appointmentAddWindow.find("#"+this._id+"endTimeZone").ejDropDownList("option",{text:e.text,value:e.value}):""},_endUtc:function(e){"true"==this._appointmentAddWindow.find("#"+this._id+"endTimeZone").attr("aria-expanded")?this._utcValue(e,"endUtc"):""},_utcValue:function(e,i){var s,a,n,o,r,l;t.preferredCulture(this.model.locale),"endUtc"==i?this._appointmentAddWindow.find(".endutc").val(e.text):"";var d=new Date(t.format(this._appointmentAddWindow.find("#"+this._id+"startdate").val(),this._datepattern())+" "+t.format(this._appointmentAddWindow.find("#"+this._id+"starttime").ejTimePicker("model.value"))),h=new Date(t.format(this._appointmentAddWindow.find("#"+this._id+"enddate").val(),this._datepattern())+" "+t.format(this._appointmentAddWindow.find("#"+this._id+"endtime").ejTimePicker("model.value"))),c=new Date(d),u=(new Date(h),"Appoint"==i?this.endTimeAppoint:"endUtc"==i?e.value:this._appointmentAddWindow.find("#"+this._id+"endTimeZone").ejDropDownList("model.value")),m="Appoint"==i?this.startTimeAppoint:"startUtc"==i?e.value:this._appointmentAddWindow.find("#"+this._id+"startTimeZone").ejDropDownList("model.value");if(m=""==m?this._timezoneStringValue():m,u=""==u?this._timezoneStringValue():u,u=u.indexOf("UTC")!=-1?60*parseInt(u.split(" ")[1].split(":")[0])+parseInt(u.split(" ")[1].split(":")[1]):60*parseInt(u.split(":")[0])+parseInt(u.split(":")[1]),m=m.indexOf("UTC")!=-1?60*parseInt(m.split(" ")[1].split(":")[0])+parseInt(m.split(" ")[1].split(":")[1]):60*parseInt(m.split(":")[0])+parseInt(m.split(":")[1]),s=u-m,d=new Date(d.setMinutes(d.getMinutes()+s)),"Appoint"==i){var p=new Date(e[this._appointmentSettings.startTime]),g=new Date(e[this._appointmentSettings.endTime]),_=t.isNullOrUndefined(this.model.timeZone)?-(new Date).getTimezoneOffset()+this._timeZoneOffset:this.model.timeZone.indexOf("UTC")!=-1?60*parseInt(this.model.timeZone.split(" ")[1].split(":")[0])+parseInt(this.model.timeZone.split(" ")[1].split(":")[1]):60*parseInt(this.model.timeZone.split(":")[0])+parseInt(this.model.timeZone.split(":")[1]),f=m==_?0:_-m;f=new Date(p.setMinutes(p.getMinutes()-f)),a="12"==this._timeMode?t.format(new Date(f),this._pattern.t):t.format(new Date(f),"HH:mm"),this._appointmentAddWindow.find("#"+this._id+"startdate").ejDatePicker({value:t.format(new Date(f),this._datepattern())}),n=u-_,this._appointmentAddWindow.find("#"+this._id+"starttime").ejTimePicker({value:a})}h="endUtc"==i||"Appoint"==i?new Date(c.setMinutes(c.getMinutes()+s)):d,h="Appoint"==i?new Date(g.setMinutes(g.getMinutes()+n)):h,o="12"==this._timeMode?t.format(new Date(d),this._pattern.t):t.format(new Date(d),"HH:mm"),"Appoint"==i?l="12"==this._timeMode?t.format(new Date(g),this._pattern.t):t.format(new Date(g),"HH:mm"):(r=new Date(h.setMinutes(h.getMinutes()+30)),l="12"==this._timeMode?t.format(new Date(r),this._pattern.t):t.format(new Date(r),"HH:mm")),this._appointmentAddWindow.find("#"+this._id+"enddate").ejDatePicker({value:t.format(new Date(h),this._datepattern())}),"Appoint"==i?this._appointmentAddWindow.find("#"+this._id+"endtime").ejTimePicker({value:l}):this._appointmentAddWindow.find("#"+this._id+"endtime").ejTimePicker({value:l}),this.startutcValue=1},_rowHandlesOver:function(t){this.model.enableAppointmentResize&&e(t.target).addClass("e-rowcursor")},_colHandlesOver:function(t){this.model.enableAppointmentResize&&e(t.target).addClass("e-columncursor")},_renderApp:function(i,s,a){var n,o,r,l,d,h,c,u,m,p,g,_,f,b,v,x,w,y,C,S,T,D,I=this.element.find(".e-workcells").outerHeight(),k=parseInt(this.model.startHour)=d.getTime()&&(g=new Date(d).getHours()P?new Date(h).getHours()+(-new Date(h).getHours()+(P-k))+-new Date(h).getMinutes():new Date(h).getHours()+-k,_=new Date(h).getHours()==P?new Date(_).getMinutes()+-new Date(h).getMinutes():_,P<=h.getHours()?(f=new Date(h.setHours(P,0,0)),m=parseFloat(60*new Date(f).getHours()+new Date(f).getMinutes()-(60*new Date(d).getHours()+new Date(d).getMinutes()))*I*this.model.timeScale.minorSlotCount/60-2):(m=parseFloat(new Date(new Date(h).getTime())-new Date(new Date(d).getTime()))/6e4*I*this.model.timeScale.minorSlotCount/this.model.timeScale.majorSlot-1,i[this._appointmentSettings.endTime].getTimezoneOffset()-i[this._appointmentSettings.startTime].getTimezoneOffset()!=0&&(m-=I*this.model.timeScale.minorSlotCount)),b=(parseFloat(60*new Date(i[this._appointmentSettings.startTime]).getHours()+new Date(d).getMinutes()+new Date(d).getSeconds()/60)-parseInt(60*g/(this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount))*(this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount)-60*this.model.startHour)*I*(this.model.timeScale.minorSlotCount/this.model.timeScale.majorSlot),this.model.startHour<=new Date(d).getHours())){var L=!t.isNullOrUndefined(this.model.group)&&t.scheduleFeatures.resources?this.res1[a][this.model.resources[this.model.resources.length-1].resourceSettings.id]:null,R=this._overlapApp(i.AppTaskId,i[this._appointmentSettings.startTime],i[this._appointmentSettings.endTime],L),M=t.Predicate(this._appointmentSettings.endTime,t.FilterOperators.greaterThan,i[this._appointmentSettings.startTime]).and(this._appointmentSettings.startTime,t.FilterOperators.lessThan,i[this._appointmentSettings.endTime]);M=!t.isNullOrUndefined(this.model.group)&&t.scheduleFeatures.resources?M.and(this._appointmentSettings.resourceFields.toString().split(",")[this.model.resources.length-1].trim(),t.FilterOperators.equal,this.res1[a][this.model.resources[this.model.resources.length-1].resourceSettings.id]):M; var O=new t.DataManager(R).executeLocal((new t.Query).where(M)),n=-1;for(O.length>0&&(v=e.map(O,function(e){return[e.Index]}),n=this._smallestMissingNumber(v)),n=n==-1?0:n,i.Index=n,R.push(i),1!=R.length?t.isNullOrUndefined(this._variable[n])?this._variable.push([i]):this._variable[n].push(i):(this._variable=[],this._variable.push([i])),u=(90-this._variable.length)/this._variable.length+"%",this.leftPosition="0%",x=0;x60?n+this.model.timeScale.majorSlot/60:n+1}return a},_getUserAllDayCellsTemplate:function(){var t,i,s,n=[];for(i=e.templates(e(this.model.allDayCellsTemplateId).html()),a=0;anew Date(s)&&new Date(this._appList[h][this._appointmentSettings.startTime])<=new Date(a)&&new Date(new Date(this._appList[h][this._appointmentSettings.startTime]).setHours(0,0,0,0)).getTime()===new Date(new Date(s).setHours(0,0,0,0)).getTime()&&this.overlapList.push(this._appList[h]):new Date(this._appList[h][this._appointmentSettings.endTime])>new Date(s)&&new Date(this._appList[h][this._appointmentSettings.startTime])<=new Date(a)&&this._appList[h][this.model.resources[this.model.resources.length-1].field]==n&&new Date(new Date(this._appList[h][this._appointmentSettings.startTime]).setHours(0,0,0,0)).getTime()===new Date(new Date(s).setHours(0,0,0,0)).getTime()&&this.overlapList.push(this._appList[h]);return this.overlapList},_getOverlapCount:function(i,s,a,n){var o,r,l,d,h,c,u;if(0==this._renderedAllDay.length)i.Index=0,c=0;else{var u=[],m=this._renderedAllDay,p=t.Predicate(this._appointmentSettings.endTime,t.FilterOperators.greaterThanOrEqual,new Date(a[s])).and(this._appointmentSettings.startTime,t.FilterOperators.lessThanOrEqual,new Date(new Date(a[s]).setHours(23,59,59))),g=t.Predicate(this._appointmentSettings.startTime,t.FilterOperators.greaterThanOrEqual,new Date(a[s])).and(this._appointmentSettings.startTime,t.FilterOperators.lessThanOrEqual,new Date(new Date(a[s]).setHours(23,59,59))),_=p.or(g);if(m=new t.DataManager(m).executeLocal((new t.Query).where(_)),m=this._appointmentSort(m),o=[],"vertical"==this.model.orientation)for(r=0;r=24,d=m[r][this._appointmentSettings.allDay],(new Date(new Date(a[s]).setHours(0,0,0,0)).getTime()==new Date(new Date(m[r][this._appointmentSettings.startTime]).setHours(0,0,0,0)).getTime()&&d||l)&&(!(t.scheduleFeatures.resources&&!t.isNullOrUndefined(this.model.group))||m[r][this.model.resources[this.model.resources.length-1].field]==n)&&o.push(m[r]);else"horizontal"==this.model.orientation&&t.scheduleFeatures.horizontal&&(o=this._getHorizontalOverlapCount(m,a,s,i,n));h=this,o=this._sortAppById(o),o=this._appointmentSort(o),c=-1,c=this._findResourceIndex(o,"AppTaskId",i.AppTaskId),u=e.map(o,function(e){return[e.Index]}),c=this._smallestMissingNumber(u),i.Index=c,c=c==-1?0:c}return c},_smallestMissingNumber:function(e){var t,i;if(0==e.length)return 0;for(t=Math.max.apply(Math,e),i=0;i0&&"month"!=this.currentView()&&!this._isCustomMonthView()&&!this._mediaQuery&&(this._renderUpDownIcon(),this.element.find(".e-upicon, .e-downicon").width(this.element.find(".e-workcellstab").width()),this.element.find(".e-appup, .e-appdown").css("pointer-events","visible"),this.element.find(".e-upicon, .e-downicon").children().width(Math.floor(this.element.find(".e-workcellstab").width()/this.element.find(".e-upicon").children().length)),this.element.find(".e-downicon").css("top",this.element.find(".e-draggableworkarea").height()-20+"px"),this._renderUpDownIconPosition()),this._resWorkWeek){for(l=[],r=t.isNullOrUndefined(this.res1[n][this.model.resources[this.model.resources.length-1].resourceSettings.workWeek])?this.model.workWeek:this.res1[n][this.model.resources[this.model.resources.length-1].resourceSettings.workWeek],d=0;dnew Date(c)?c:w,"workweek"==this.currentView()&&e.inArray(new Date(w.getFullYear(),w.getMonth(),w.getDate()).getTime(),this._dateRender)==-1)for(u=1;u0){m=e.inArray(new Date(w.getFullYear(),w.getMonth(),w.getDate()-u).getTime(),this._dateRender),w=new Date(this._dateRender[m]);break}this._renderedAllDay.push(i),g=Math.ceil((new Date(x)-new Date(h))/864e5),p=this._resWorkWeek?e.inArray(new Date(w.getFullYear(),w.getMonth(),w.getDate()).getTime(),C)-e.inArray(new Date(x.getFullYear(),x.getMonth(),x.getDate()).getTime(),C)+1:"week"==this.currentView()||"day"==this.currentView()||"workweek"==this.currentView()||"customview"==this.currentView()&&parseFloat((w-x)/36e5)<=24?0==x.getHours()&&0==w.getHours()?Math.ceil((new Date(w)-new Date(x))/864e5):Math.ceil((new Date(w).setHours(23,59,59)-new Date(x).setHours(0,0,0))/864e5):6==w.getDay()&&"workweek"==this.currentView()&&0!=this._firstdayofweek?e.inArray(new Date(w.getFullYear(),w.getMonth(),w.getDate()-1).getTime(),this._dateRender):0==w.getDay()&&"workweek"==this.currentView()&&0!=this._firstdayofweek?e.inArray(new Date(w.getFullYear(),w.getMonth(),w.getDate()-2).getTime(),this._dateRender):e.inArray(new Date(w.getFullYear(),w.getMonth(),w.getDate()).getTime(),this._dateRender)-e.inArray(new Date(x.getFullYear(),x.getMonth(),x.getDate()).getTime(),this._dateRender)+1,p<=0&&(p=1);var I=this.element.find(".e-alldaycells").width(),k="week"===this.currentView()?7:"workweek"===this.currentView()?this.model.workWeek.length:"customview"==this.currentView()&&this._renderDays<=7?this._renderDays:1,P=t.isNullOrUndefined(this.model.group)||t.isNullOrUndefined(this.model.resources)?0:this.model.group.resources.length,L=new Date(new Date(x).getFullYear(),new Date(x).getMonth(),new Date(x).getDate()),R="day"===this.currentView()?0:"workweek"===this.currentView()&&0==this._firstdayofweek&&"Monday"==this.model.workWeek[0]&&"Friday"==this.model.workWeek[4]?new Date(x).getDay()-1:this._firstdayofweek||this.model.workWeek.length>0||"customview"==this.currentView()&&(this._renderDays<=7||"horizontal"==this.model.orientation)?this._dateRender.indexOf(L.getTime()):new Date(x).getDay();this._resWorkWeek?S=this.model.enableRTL?this.element.find(".e-headrealldaytable").width()-this.element.find(".e-alldaycells")[a].offsetLeft-this.element.find(".e-alldaycells").width():this.element.find(".e-alldaycells")[a].offsetLeft:t.isNullOrUndefined(this.element.find(".e-alldaycells")[R+n*k])||(S=this.model.enableRTL?this.element.find(".e-headrealldaytable").width()-this.element.find(".e-alldaycells")[R+n*k].offsetLeft-this.element.find(".e-alldaycells").width():this.element.find(".e-alldaycells")[R+n*k].offsetLeft),y=p*I+p-2,T=v*T+3*(v+1)+this.element.find(".e-headercells").height()+1+P*this.element.find(".e-headerbar").first().height();var M=this._appointmentColor(i),O=!!this.model.appointmentTemplateId,E=this._getUserAppointmentTemplate(i),A="12"==this._timeMode?t.format(i[this._appointmentSettings.startTime],this._pattern.t):t.format(i[this._appointmentSettings.startTime],"HH:mm"),j="12"==this._timeMode?t.format(i[this._appointmentSettings.endTime],this._pattern.t):t.format(i[this._appointmentSettings.endTime],"HH:mm");i[this._appointmentSettings.recurrence]&&(_=i[this._appointmentSettings.recurrenceRule].toString().indexOf("RECUREDITID")!=-1),f=this._indicationApp(i),b=e(this.appTemplate.render({id:i.AppTaskId,appResize:this.model.enableAppointmentResize,currentview:this.currentView(),top:T,appHeight:D,rtl:this.model.enableRTL,subject:i[this._appointmentSettings.subject],startTime:A,endTime:j,appWidth:y+"px",allday:!0,left:S+"px",userAppTemplId:O,userTemplate:E,appClass:"e-alldayappointment",appointData:M.appointColor.appointData,appointCustomcss:M.appointColor.appointCustomcss,appointtextcolor:M.appointColor.appointtextcolor,value:M.value,multiDiv:M.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:_,leftInd:f.leftIndication,rightInd:f.rightIndication})),t.isNullOrUndefined(this.model.queryCellInfo)||this._renderQueryCellInfo("appointment",i,b),this.element.find(".e-headrealldaytable").append(b)}if(this._alldayLevel=!1,this.level=this.levelF[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(f)||(f.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")),f.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")))},_indicationApp:function(i){var s,a,n,o,r,l,d,h,c=new t.DataManager(this._currentAppointmentData).executeLocal((new t.Query).where("AppTaskId",t.FilterOperators.equal,i.ParentId))[0];return r="day"==this.currentView()?[new Date(this.dateRender[0]).getTime()]:this._dateRender,l="month"==this.currentView()&&new Date(new Date(c[this._appointmentSettings.startTime]).setHours(0,0,0,0)).getTime()1&&(h=this._sortAppById(d),(h[0][this._appointmentSettings.startTime]i[this._appointmentSettings.endTime]||o==-1)&&!l&&(this.model.enableRTL?a=!0:s=!0))):((new Date(c[this._appointmentSettings.startTime])i[this._appointmentSettings.endTime]||o==-1)&&!l&&(this.model.enableRTL?a=!0:s=!0)),{leftIndication:a,rightIndication:s}},_reRenderScroller:function(){var i,s,a=this._appointmentAddWindow.data("ejDialog");a.option("enableAnimation",!1),a.close();var n=e("div#"+this._id+"_scroller"),o=this.element.find(".e-scroller").data("ejScroller"),r="vertical"===this.model.orientation?this.element.outerWidth()-(this._mediaQuery&&("month"==this.currentView()||this._isCustomMonthView())?1:this.element.find(".e-scrolltimecells").parent().outerWidth()):"horizontal"!=this.model.orientation||t.isNullOrUndefined(this.model.group)||t.isNullOrUndefined(this.model.resources)?this.element.width():this.element.width()-this.element.find(".e-resourceheadertable").width();o.model.width=r-2,o.model.height=this.scHeight-1-(this.wTR.find(".e-draggableworkarea").offset().top-this.element.offset().top),o.refresh(),""!=this.model.cellWidth&&(i="workweek"==this.currentView()?this.model.workWeek.length:"day"==this.currentView()?1:"customview"===this.currentView()&&this._renderDays<=7?this._dateRender.length:7,s=t.isNullOrUndefined(this.model.group)||t.isNullOrUndefined(this.model.resources)?i:this.res1.length*i,"horizontal"==this.model.orientation&&(s+=e(this.element.find(".e-workcells")[0]).parent().find("td").length),this.wTR.find(".e-draggableworkarea").width(this.element.width()>(parseInt(this.model.cellWidth)+1)*s+this.wTR.find(".e-scrolltimecells").parent().width()+(n.ejScroller("isVScroll")?18:0)?(parseInt(this.model.cellWidth)+1)*s-1:r-2-(n.ejScroller("isVScroll")?18:0)),this.aTR.find(".e-headeralldaydiv").width(this.wTR.find(".e-draggableworkarea").width())),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&&this._appointmentAddWindow.ejDialog("close"),a.option("enableAnimation",!0),"horizontal"==this.model.orientation&&n.ejScroller("isVScroll")&&this._renderHoriVerticalScroll(),this._showScrollTd()},_appointmentSort:function(e){var t=this;return"day"!=this.currentView()?e.sort(function(e,i){var s=e[t._appointmentSettings.endTime]-e[t._appointmentSettings.startTime],a=i[t._appointmentSettings.endTime]-i[t._appointmentSettings.startTime],n=new Date(e[t._appointmentSettings.startTime]),o=new Date(i[t._appointmentSettings.startTime]),r=new Date(e[t._appointmentSettings.endTime]),l=new Date(i[t._appointmentSettings.endTime]),d=e[t._appointmentSettings.startTime],h=i[t._appointmentSettings.startTime];return n==o&&r==l?d-h||e.Guid.localeCompare(i.Guid):n-o==0?a-s||d-h||e.Guid.localeCompare(i.Guid):d-h||e.Guid.localeCompare(i.Guid)}):e.sort(function(e,i){var s=e[t._appointmentSettings.startTime],a=i[t._appointmentSettings.startTime],n=e[t._appointmentSettings.endTime]-e[t._appointmentSettings.startTime],o=i[t._appointmentSettings.endTime]-i[t._appointmentSettings.startTime];return s-a||o-n||e.Guid.localeCompare(i.Guid)}),e},_alldaySort:function(e){for(var t=this,i=[],s=0;sthis.model.maxDate&&(l=Math.floor((new Date(s[s.length-1])-new Date(this.model.maxDate))/864e5),d=s.length-l),r;r1?new t.DataManager(this.model.resources[this.model.resources.length-1].resourceSettings.dataSource).executeLocal((new t.Query).where(this.model.resources[this.model.resources.length-1].resourceSettings.groupId,t.FilterOperators.equal,parseInt(a[u][this._appointmentSettings.resourceFields.split(",")[this._appointmentSettings.resourceFields.split(",").length-2]]))):this.res1,0!=m.length&&(1==a[u][this._appointmentSettings.allDay]||(new Date(a[u][this._appointmentSettings.endTime])-new Date(a[u][this._appointmentSettings.startTime]))/36e5>24?new Date(new Date(s[r]).setHours(0,0,0,0)).getTime()==new Date(new Date(a[u][this._appointmentSettings.startTime]).setHours(0,0,0,0)).getTime()&&new Date(new Date(s[r]).setHours(0,0,0,0)).getTime()<=new Date(new Date(a[u][this._appointmentSettings.endTime]).setHours(0,0,0,0)).getTime()&&new Date(new Date(a[u][this._appointmentSettings.startTime]).setHours(0,0,0,0)).getTime()<=new Date(new Date(a[u][this._appointmentSettings.endTime]).setHours(0,0,0,0)).getTime()&&(this._renderAppointmentMonth(a[u],r,o),i.push(a[u])):new Date(new Date(s[r]).setHours(0,0,0,0)).getTime()==new Date(new Date(a[u][this._appointmentSettings.startTime]).setHours(0,0,0,0)).getTime()&&new Date(new Date(s[r]).setHours(0,0,0,0)).getTime()<=new Date(new Date(a[u][this._appointmentSettings.endTime]).setHours(0,0,0,0)).getTime()&&new Date(new Date(a[u][this._appointmentSettings.startTime]).setHours(0,0,0,0)).getTime()<=new Date(new Date(a[u][this._appointmentSettings.endTime]).setHours(0,0,0,0)).getTime()&&(this._renderAppointmentMonth(a[u],r,o),i.push(a[u])));this.model.showAppointmentNavigator&&this._nextPrevButton(i)},_wireResizeEvents:function(){this.model.enableAppointmentResize&&!this.model.readOnly&&(this.element.find("div.e-lefthandle,div.e-righthandle,div.e-tophandle,div.e-bottomhandle").on("mousedown",e.proxy(this._appointmentResizeStart,this)),this._on(this.element.find("div.e-lefthandle,div.e-righthandle"),"mouseover",e.proxy(this._colHandlesOver,this)),this._on(this.element.find("div.e-tophandle,div.e-bottomhandle"),"mouseover",e.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",e.proxy(this._appointmentResizeStart,this)),this._off(this.element.find("div.e-lefthandle,div.e-righthandle"),"mouseover",e.proxy(this._colHandlesOver,this)),this._off(this.element.find("div.e-tophandle,div.e-bottomhandle"),"mouseover",e.proxy(this._rowHandlesOver,this)))},_recuCollectionIndex:function(e,t){for(var i,s=(this._appointmentSettings,0);s=new Date(new Date(a[i]).setHours(0,0,0,0)).getTime()&&new Date(new Date(n[h][this._appointmentSettings.startTime]).setHours(0,0,0,0)).getTime()<=new Date(new Date(n[h][this._appointmentSettings.endTime]).setHours(0,0,0,0)).getTime()&&d.push(n[h]);this.overlapList=d,d=this._sortAppById(d),d=this._appointmentSort(d),c=-1,d.length>0&&(c=this._findResourceIndex(d,"AppTaskId",s.AppTaskId),u=e.map(d,function(e){return[e.Index]}),c=this._smallestMissingNumber(u)),c=c==-1?0:c,s.Index=c}return c},_recurrenceLocal:function(){var i=t.RecurrenceEditor.Locale[this.model.locale]=e.extend(!0,{},t.RecurrenceEditor.Locale["en-US"]),s=this;e.each(i,function(e){t.RecurrenceEditor.Locale[s.model.locale][e]=s._getLocalizedLabels(e)})},_renderAppointmentMonth:function(i,a){var n,o,r,l,d,h,c,u,m,p,g,_,f="vertical"==this.model.orientation?this._dateRender:this.monthDays,b=this._renderedApp,v=!t.scheduleFeatures.resources||t.isNullOrUndefined(this.model.group)||t.isNullOrUndefined(this.model.resources)?this._getIndex(a,i,f,b,null):this._getIndex(a,i,f,b,i[this._appointmentSettings.resourceFields.toString().split(",")[this.model.resources.length-1].trim()]),x=new Date(i[this._appointmentSettings.startTime]),w=new Date(i[this._appointmentSettings.endTime]),y=0;this.element.find(".e-parentnode").width();this.leftPosition=0,this.CellWidth="vertical"==this.model.orientation?this.element.find(".e-monthcells").width():this.element.find(".e-workcells").width()+1,this.CellHeight="vertical"==this.model.orientation?this.element.find(".e-monthcells").height():this.element.find(".e-workcells").height();var C=new Date(x),S=new Date(w),T=new Date(new Date(f[f.length-1]).setHours(23,59,59)); if(S=S>T?T:S,this._renderedApp.push(i),o=0==this._firstdayofweek?7-new Date(C).getDay():7-new Date(C).getDay()+this._firstdayofweek,!this.model.timeScale.enable&&this._oneWeek&&(o=7-f.indexOf(C.getTime())),r=0==C.getHours()&&0==S.getHours()?Math.ceil((new Date(S)-new Date(C))/864e5):Math.ceil((new Date(S).setHours(23,59,59)-new Date(C).setHours(0,0,0))/864e5),S.getTimezoneOffset()-C.getTimezoneOffset()!=0&&(r-=1),x<=w){"vertical"==this.model.orientation?(r=r>=o?o:r,l=Math.ceil((a+1)/7),n=r*this.CellWidth-this.CellWidth/20):n=!this.model.timeScale.enable||"month"==this.currentView()||this._isCustomMonthView()?r*this.CellWidth:this.CellWidth*r-parseInt(this.CellWidth/10),d=t.isNullOrUndefined(this.model.resources)||t.isNullOrUndefined(this.model.group)||!t.scheduleFeatures.resources?0:this._findResourceIndex(this.res1,this.model.resources[this.model.resources.length-1].resourceSettings.id,i[this._appointmentSettings.resourceFields.toString().split(",")[this.model.resources.length-1].trim()]),h=t.isNullOrUndefined(this.model.resources)||t.isNullOrUndefined(this.model.group)||!t.scheduleFeatures.resources?"vertical"==this.model.orientation&&this._isCustomMonthView()&&!this._oneWeek?7*d+(new Date(x).getDay()+1)+(l-1)*this.res1.length*7:a+1:"vertical"==this.model.orientation?"day"==this.currentView()?d+1:"workweek"==this.currentView()||this._isCustomMonthView()&&this._oneWeek?d*this._dateRender.length+(a+1):"workweek"==this.currentView()?d*this._dateRender.length+(new Date(x).getDay()+1)+(l-1)*this.res1.length*this._dateRender.length:0==this._firstdayofweek?7*d+(new Date(x).getDay()+1)+(l-1)*this.res1.length*7:"vertical"==this.model.orientation&&0!=this._firstdayofweek?7*d+(new Date(x).getDay()+1)+(l-1)*this.res1.length*7-this._firstdayofweek:a+1:a+1,"vertical"==this.model.orientation&&0!=this._firstdayofweek&&new Date(x).getDay()1?this._findResourceIndex(c[0].dataSource,c[0].id,i[this._appointmentSettings.resourceFields.toString().split(",")[this.model.resources.length-2].trim()])+1:0:!t.isNullOrUndefined(this.model.group)&&this.model.group.resources.length>1?this._findResourceIndex(u,this.model.resources[this.model.resources.length-2].resourceSettings.id,i[this._appointmentSettings.resourceFields.toString().split(",")[this.model.resources.length-2].trim()])+1:0;var L=t.isNullOrUndefined(this.model.group)||t.isNullOrUndefined(this.model.resources)?1:this._findResourceIndex(this.res1,this.model.resources[this.model.resources.length-1].resourceSettings.id,i[this._appointmentSettings.resourceFields.toString().split(",")[this.model.resources.length-1].trim()])+1,R=this._appointmentColor(i),M=parseInt(this.CellWidth/(this.CellWidth<=n?this.CellWidth:n+(this.element.find(".e-monthappointment").outerWidth(!0)-this.element.find(".e-monthappointment").width()))),O=parseInt((this.CellHeight-this.element.find(".e-monthheader").height()-10)/(this.element.find(".e-monthappointment").length>0?this.element.find(".e-monthappointment").outerHeight(!0):P));this.CellHeight=e(this.element.find("div.e-appointwrapper")[h-1]).closest("tr").find(".e-monthcells").outerHeight(),"horizontal"==this.model.orientation&&(this.CellHeight=e(this.element.find(".e-workcellstab tr")[L+m-1]).find(".e-workcells").height());var E=this._indicationApp(i),A="12"==this._timeMode?t.format(i[this._appointmentSettings.startTime],this._pattern.t):t.format(i[this._appointmentSettings.startTime],"HH:mm"),j="12"==this._timeMode?t.format(i[this._appointmentSettings.endTime],this._pattern.t):t.format(i[this._appointmentSettings.endTime],"HH:mm");if(I&&"0px"!=e(k).css("height")&&"horizontal"!=this.model.orientation?v+1<=M*O:this.CellHeight>this.element.find(".e-monthheader").height()+(v+1)*P+10)n1&&(y=v*P),this.leftPosition>1&&(this.leftPosition-=1),t.isNullOrUndefined(i[this._appointmentSettings.recurrenceRule])||(g=i[this._appointmentSettings.recurrenceRule].toString().indexOf("RECUREDITID")!=-1),_=e(this.appTemplate.render({id:i.AppTaskId,appResize:this.model.enableAppointmentResize,currentview:this.currentView(),appHeight:P,rtl:this.model.enableRTL,subject:i[this._appointmentSettings.subject],startTime:A,endTime:j,left:this.leftPosition+"px",top:y,appWidth:n+"px",userAppTemplId:I,userTemplate:k,appClass:"e-monthappointment",appointData:R.appointColor.appointData,appointCustomcss:R.appointColor.appointCustomcss,appointtextcolor:R.appointColor.appointtextcolor,value:R.value,multiDiv:R.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:g,leftInd:E.leftIndication,rightInd:E.rightIndication})),t.isNullOrUndefined(this.model.queryCellInfo)||this._renderQueryCellInfo("appointment",i,_),"vertical"==this.model.orientation?e(this.element.find("div.e-appointwrapper")[h-1]).append(_):"horizontal"==this.model.orientation&&t.scheduleFeatures.horizontal&&(e(e(this.element.find(".e-workcellstab tr")[L+m-1]).find("div.e-appointwrapper")[h-1]).append(_),!t.isNullOrUndefined(this.model.group)&&this.model.group.resources.length>1&&this._renderAppointmentCategory(u,m,h-1,i,n,this.leftPosition)),_="";else{if(0!=e("#"+this._id+"_"+t.format(new Date(i[this._appointmentSettings.startTime]),"MM_dd_yyyy")+"_"+(L+m-1)+"_"+(h-1)).length&&e("#"+this._id+"_"+t.format(new Date(i[this._appointmentSettings.startTime]),"MM_dd_yyyy")+"_"+(L+m-1)+"_"+(h-1)).remove(),this.model.showOverflowButton){var N=h-1,z=new Date(i[this._appointmentSettings.startTime]).getTime(),F=Math.round((i[this._appointmentSettings.endTime]-i[this._appointmentSettings.startTime])/864e5),B=N,H=v+1;do"vertical"==this.model.orientation?e(this.element.find("div.e-appointwrapper")[B]).append('
    '):e(e(this.element.find(".e-workcellstab tr")[L+m-1]).find("div.e-appointwrapper")[B]).append('
    '),z+=864e5,B++;while(B1&&this._renderAppointmentCategory(u,m,h-1,i,n,this.leftPosition)}else"vertical"==this.model.orientation?(t.isNullOrUndefined(i[this._appointmentSettings.recurrenceRule])||(g=i[this._appointmentSettings.recurrenceRule].toString().indexOf("RECUREDITID")!=-1),y=v*P,p=e(this.element.find("div.e-appointwrapper")[h-1]).closest("tr").index(),_=this.appTemplate.render({id:i.AppTaskId,appResize:this.model.enableAppointmentResize,currentview:this.currentView(),appHeight:P,rtl:this.model.enableRTL,subject:i[this._appointmentSettings.subject],startTime:A,endTime:j,left:this.leftPosition+"px",top:y,appWidth:n+"px",userAppTemplId:I,userTemplate:k,appClass:"e-monthappointment",appointData:R.appointColor.appointData,appointCustomcss:R.appointColor.appointCustomcss,appointtextcolor:R.appointColor.appointtextcolor,value:R.value,multiDiv:R.multiDiv,uid:i.Guid,recurrence:i[this._appointmentSettings.recurrence],recurrenceEdit:g}),e(this.element.find("div.e-appointwrapper")[h-1]).closest("tr").find(".e-monthcells").css("height",this.CellHeight+P-1+"px"),e(this.element.find(".e-timecells")[p]).css("height",this.CellHeight+P-1+"px"),e(this.element.find("div.e-appointwrapper")[h-1]).append(_),this._reRenderScroller()):(y=v*P,e(this.element.find(".e-workcellstab tr")[L+m-1]).find(".e-workcells").css("height",this.CellHeight+P-1+"px"),e(this.element.find(".e-resourceheadertable tr")[L+m-1]).find(".e-childnode").css("height",this.CellHeight+P-1+"px"),t.isNullOrUndefined(i[this._appointmentSettings.recurrenceRule])||(g=i[this._appointmentSettings.recurrenceRule].toString().indexOf("RECUREDITID")!=-1),_=this.appTemplate.render({id:i.AppTaskId,appResize:this.model.enableAppointmentResize,currentview:this.currentView(),appHeight:P,rtl:this.model.enableRTL,subject:i[this._appointmentSettings.subject],startTime:A,endTime:j,left:this.leftPosition+"px",top:y,appWidth:n+"px",userAppTemplId:I,userTemplate:k,appClass:"e-monthappointment",appointData:R.appointColor.appointData,appointCustomcss:R.appointColor.appointCustomcss,appointtextcolor:R.appointColor.appointtextcolor,value:R.value,multiDiv:R.multiDiv,uid:i.Guid,recurrence:i[this._appointmentSettings.recurrence],recurrenceEdit:g,leftInd:E.leftIndication,rightInd:E.rightIndication}),this._reRenderScroller(),e(e(this.element.find(".e-workcellstab tr")[L+m-1]).find("div.e-appointwrapper")[h-1]).append(_),!t.isNullOrUndefined(this.model.group)&&this.model.group.resources.length>1&&this._renderAppointmentCategory(u,m,h-1,i,n,this.leftPosition));y=this.CellHeight-(this.element.find(".e-monthheader").height()+this.element.find(".e-appsoverflow").height()-2),this.element.find(".e-icon.e-appsoverflow").css(this.model.enableRTL?"right":"left",this.CellWidth+this.leftPosition-25+"px").css("top",y+"px")}}if(!i[this._appointmentSettings.recurrence]){var V=i.ParentId==s?i.AppTaskId:i.ParentId,U=(new t.Query).where("AppTaskId",t.FilterOperators.equal,V),W=new t.DataManager(this._currentAppointmentData).executeLocal(U),G=new t.DataManager(this._processed).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,i.Guid));new Date(i[this._appointmentSettings.endTime])W[0][this._appointmentSettings.startTime]&&(this.model.enableRTL?e(this.element.find("div.e-appointwrapper")[h-1]).find("[guid="+i.Guid+"]").children(".e-righthandle").remove():e(this.element.find("div.e-appointwrapper")[h-1]).find("[guid="+i.Guid+"]").children(".e-lefthandle").remove())}!t.isNullOrUndefined(G)&&G>1&&(e(this.element.find("div.e-appointwrapper")[h-1]).find("[guid="+i.Guid+"]").children(".e-lefthandle").remove(),e(this.element.find("div.e-appointwrapper")[h-1]).find("[guid="+i.Guid+"]").children(".e-righthandle").remove()),t.isNullOrUndefined(E)||(E.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")),E.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")))},_quickWindowClose:function(){this._quickAppointWindow.find(".e-error").remove(),this._quickAppointWindow.ejDialog("close"),this._processFocus()},_appointmentWindow:function(i){var s,a,n,o,r,l,d,h,c;if(this.model.showQuickWindow&&this._quickAppointWindow.ejDialog("close"),n=e(t.isNullOrUndefined(i.target)?i:i.target),t.isNullOrUndefined(this.model.workCellsTemplateId)&&t.isNullOrUndefined(this.model.allDayCellsTemplateId)||(n=n.closest(".e-workcells, .e-alldaycells, .e-monthcells")),n.hasClass("e-appup")||n.hasClass("e-appdown"))return!1;if(o=(n.hasClass("e-workcells")||n.hasClass("e-alldaycells")||n.hasClass("e-monthcells")||this._cellClick||n.hasClass("e-detailedapp"))&&!n.hasClass("e-resourceheadercells")&&!n.hasClass("e-schedulemouseclose")&&!n.hasClass("e-appointinnertext")&&!n.hasClass("e-apptext")&&!n.hasClass("e-apptime"),r={startTime:new Date(this.cur_StartTime),endTime:this.cur_EndTime,target:i,resources:null==this.model.appointmentWindowOpen&&null==this.model.cellDoubleClick||!o||t.isNullOrUndefined(this.model.resources)?null:this._getResourceValue(n)},!(n.hasClass("e-workcells")||n.hasClass("e-alldaycells")||n.hasClass("e-monthcells")||this._cellClick||n.hasClass("e-detailedapp"))||n.hasClass("e-resourceheadercells")||n.hasClass("e-schedulemouseclose")||n.hasClass("e-appointinnertext")||n.hasClass("e-apptext")||n.hasClass("e-apptime")){if(!n.hasClass("e-resourceheadercells")&&!n.hasClass("e-schedulemouseclose")){if(n.hasClass("e-monthheader")||n.hasClass("e-appsoverflow"))return!1;l=this._editKey?e(i):n.hasClass("e-appointment")||n.hasClass("e-monthappointment")||n.hasClass("e-alldayappointment")||n.hasClass("e-agendaappointment")?n:n.parents(".e-monthappointment,.e-appointment,.e-alldayappointment,.e-agendaappointment"),"agenda"==this.currentView()&&(l=l.hasClass("e-agendaappointment")?l:this.element.find(".e-selectedCell").parent().find(".e-agendaappointment")),l.length>0&&!t.isNullOrUndefined(l[0].id)&&(this._currentAction=t.Schedule.Actions.Save,this._appUid=l.attr("guid"),h=(new t.Query).where("Guid",t.FilterOperators.equal,this._appUid),d=new t.DataManager(this._processed).executeLocal(h),1==d[0][this._appointmentSettings.recurrence]?(this._parentId=d[0].ParentId,this._recurEditWindow.ejDialog("open"),this._recurEditWindow.focus(),this._deleteBeforeOpen()):(h=(new t.Query).where("Guid",t.FilterOperators.equal,this._appUid),c=new t.DataManager(this._processed).executeLocal(h),this._showAppointmentDetails(this._appUid,!0)),this.model.showQuickWindow&&this._quickAppDetailsWindow.ejDialog("close")),this._editKey=!1}}else{if(this._trigger("cellDoubleClick",r)||n.hasClass("e-categorybar"))return!1;this._currentAction=t.Schedule.Actions.Add,this._appointmentAddWindow.find(".e-recurEditor").css("display","none"),this._appointmentAddWindow.find(".e-appwindow").css("display","block");var u=this._cellIndex,m="horizontal"==this.model.orientation&&"month"==this.currentView()?this.monthDays:"vertical"==this.model.orientation?this.dateRender:this._dateRender,p=new Date(m[u]);if(this.model.minDate>p||this.model.maxDate
    ${"+this.model.prioritySettings.text+"}
    ":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:e.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(e.isFunction(e.validator)&&!e("#"+this._id+"_AddEditForm").validate().form())return!1},_appointmentColor:function(e){var i=this.model.categorizeSettings.enable&&!t.isNullOrUndefined(e[this._appointmentSettings.categorize])&&""!=e[this._appointmentSettings.categorize]?this._getCategorizeColor(e):!t.isNullOrUndefined(this.model.resources)&&t.scheduleFeatures.resources?this._getResourceColor(e):{appointData:"",appointCustomcss:"",appointtextcolor:""};if(this.model.categorizeSettings.enable&&this.model.categorizeSettings.allowMultiple&&!t.isNullOrUndefined(e[this._appointmentSettings.categorize]))var s=e[this._appointmentSettings.categorize].split(","),a=s.length,n=a>1,o=this._categorizeMultipleDiv(e,s,a);return!t.isNullOrUndefined(o)&&i.appointData.length>0&&this.model.categorizeSettings.allowMultiple?{appointColor:i,value:n,multiDiv:o}:i.appointData.length>0&&!this.model.categorizeSettings.allowMultiple||!t.isNullOrUndefined(this.model.resources)&&t.scheduleFeatures.resources?{appointColor:i}:(appointData="",appointCustomcss="",appointtextcolor="",n="",{appointColor:i,value:n,multiDiv:o})},_categorizeMultipleDiv:function(e,s,a){var n,o,r=[];for(i=0;i<=a-1;i++)if(i!=a-1){if(n=this.model.categorizeSettings,o=this._findResourceIndex(n.dataSource,this.model.categorizeSettings.id,s[i]),t.isNullOrUndefined(o)&&(o=this._findResourceIndex(n.dataSource,this.model.categorizeSettings.id,parseInt(s[i]))),t.isNullOrUndefined(o))return e[this._appointmentSettings.categorize]="",null;r.push({text:n.dataSource[o][n.text],value:n.dataSource[o][n.color],key:n.dataSource[o][n.id],fontColor:n.dataSource[o][n.fontColor]})}return this._categorizeMultipleTemplate.render({ renderData:r})},_getResCategorySaveData:function(e,i,s,a){var n,o,r,l,d,h,c,u,m,p,g,_,f=[];if(n=this._addAppData(s,a,new Date(s[this._appointmentSettings.startTime]),new Date(s[this._appointmentSettings.endTime]),a),e.length>0&&!t.isNullOrUndefined(e[0][0])){for(l=e[e.length-1].length-1,d="",g=0;g<=l;g++)h=e[e.length-1][g][this.model.categorizeSettings.id],d=g!=l?d+h.toString()+",":d+h.toString();n[this._appointmentSettings.categorize]=d}if(i.length>0){var b=n[this._appointmentSettings.categorize],_=this._appointmentSettings.resourceFields.toString().split(","),v=this._getResourceCollection();if(i[i.length-1].length>0)for(c=0;c1&&(s.Guid=this._guidFormatGenerate(),s.AppTaskId=a,a++),u=(new t.Query).where("AppTaskId",t.FilterOperators.equal,a),m=new t.DataManager(this._processed).executeLocal(u),a=0==m.length?a:this._processed[this._processed.length-1].AppTaskId+1,n[_[_.length-1].trim()]=i[_.length-1][c][v[v.length-1].id],p=i[_.length-1][c][v[v.length-1].id],g=_.length-1;g>0;g--)o=this.render_Resources[g]instanceof t.DataManager?this.render_Resources[g]:t.DataManager(this.render_Resources[g]),u=(new t.Query).where(v[g].id,t.FilterOperators.equal,p),appointId=o.executeLocal(u),r=this.render_Resources[g-1]instanceof t.DataManager?this.render_Resources[g-1]:t.DataManager(this.render_Resources[g-1]),query1=(new t.Query).where(v[g-1].id,t.FilterOperators.equal,appointId[0][v[g].groupId]),appointGroupId=r.executeLocal(query1),p=appointGroupId[0][v[g-1].id],n[_[g-1]]=p;this._currentAction==t.Schedule.Actions.EditOcurrence&&(n[this._appointmentSettings.id]=n.AppTaskId),f.push(n)}else{if(_=this._appointmentSettings.resourceFields.toString().split(","),n=this._addAppData(s,a,new Date(s[this._appointmentSettings.startTime]),new Date(s[this._appointmentSettings.endTime]),a),n[this._appointmentSettings.categorize]=b,_.length>1)for(g=0;g<_.length;g++)n[_[g].trim()]=this.model.resources[g].resourceSettings.dataSource[0].id;else n[_[_.length-1].trim()]=this.model.resources[0].resourceSettings.dataSource[0].id;this._currentAction==t.Schedule.Actions.EditOcurrence&&(n[this._appointmentSettings.id]=n.AppTaskId),f.push(n)}}return 0==i.length&&e.length>0&&(this._currentAction==t.Schedule.Actions.EditOcurrence&&(n[this._appointmentSettings.id]=n.AppTaskId),f.push(n)),f},_timeZoneCollection:function(e){var i;if(null!==e&&(this.startTimeAppoint=e[this._appointmentSettings.startTimeZone],this.endTimeAppoint=e[this._appointmentSettings.endTimeZone]),this.startutcValue=null,this.tempValue=null,null!==e&&this.endTimeAppoint&&(this._utcValue(e,"Appoint"),this.tempValue=1),null!=this.model.timeInfo)i=this._findResourceIndex(this.model.timeZoneCollection.dataSource,"id",this.model.timeInfo);else{var s=null==this.model.timeZone?this._timezoneStringValue():this.model.timeZone,a=null!==e?t.isNullOrUndefined(this.startTimeAppoint)?s:this.startTimeAppoint:s,n=this.model.timeZoneCollection.dataSource[0][this.model.timeZoneCollection.value],o=n.indexOf("UTC")==-1&&a.indexOf("UTC")!=-1?a.split(" ")[1]:n.indexOf("UTC")!=-1&&a.indexOf("UTC")==-1?"UTC "+a:a,r=!t.isNullOrUndefined(n.split(":")[2])&&!t.isNullOrUndefined(a.split(":")[2])||t.isNullOrUndefined(n.split(":")[2])&&t.isNullOrUndefined(a.split(":")[2])?o:t.isNullOrUndefined(n.split(":")[2])&&!t.isNullOrUndefined(a.split(":")[2])?o.split(":")[0]+":"+o.split(":")[1]:o+":00",l=o.indexOf("UTC")!=-1?1==o.split(" ")[1].split(":")[0].length?"0"+o.split(" ")[1].split(":")[0]:o.split(" ")[1].split(":")[0]:1==o.split(":")[0].length?"0"+o.split(":")[0]:o.split(":")[0],d="+"==l[0]?l.split("+"):l.split("-"),h="0"+d[1],c=2==h.length?h:d[1],u=r.indexOf("UTC")!=-1?r.split(" ")[0]+" +"+c+":"+r.split(" ")[1].split(":")[1]:"0"+c+":"+r.split(" ")[1].split(":")[1],m=r.indexOf("UTC")!=-1?r.split(" ")[0]+" -"+c+":"+r.split(" ")[1].split(":")[1]:"0"+c+":"+r.split(" ")[1].split(":")[1],p="+"==l[0]?u:m,i=this._findResourceIndex(this.model.timeZoneCollection.dataSource,"value",p);i=t.isNullOrUndefined(i)?this._findResourceIndex(this.model.timeZoneCollection.dataSource,"value",p.replace("+","")):i,i=t.isNullOrUndefined(i)?"add":i}if(null==this.model.timeZone&&0==i?(this._appointmentAddWindow.find("#"+this._id+"startTimeZone").val("UTC "+t.format(new Date,"zzz"))&&this._appointmentAddWindow.find("#"+this._id+"startTimeZone_hidden").val("UTC "+t.format(new Date,"zzz")),this._appointmentAddWindow.find("#"+this._id+"endTimeZone").val("UTC "+t.format(new Date,"zzz"))&&this._appointmentAddWindow.find("#"+this._id+"endTimeZone_hidden").val("UTC "+t.format(new Date,"zzz"))):"add"!==i&&(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]})),null===e||t.isNullOrUndefined(this.startTimeAppoint)||(this._appointmentAddWindow.find("#"+this._id+"startTimeZone").ejDropDownList("option",{value:null!==e&&this.startTimeAppoint?this.startTimeAppoint:this.model.timeZoneCollection.dataSource[i][this.model.timeZoneCollection.value]}),this._appointmentAddWindow.find("#"+this._id+"endTimeZone").ejDropDownList("option",{value:null!==e&&this.endTimeAppoint?this.endTimeAppoint:this.model.timeZoneCollection.dataSource[i][this.model.timeZoneCollection.value]})),(null!=this.model.timeZone||null==this.model.timeZone||null!=e)&&"add"==i){var a=null!=e?this.startTimeAppoint:null==this.model.timeZone?this._timezoneStringValue():this.model.timeZone,n=this.model.timeZoneCollection.dataSource[0][this.model.timeZoneCollection.value],p=n.indexOf("UTC")==-1&&a.indexOf("UTC")!=-1?a.split(" ")[1]:n.indexOf("UTC")!=-1&&a.indexOf("UTC")==-1?"UTC "+a:a;this.model.timeZoneCollection.dataSource.push({text:p,id:(this.model.timeZoneCollection.dataSource.length+1).toString()+"_val",value:p}),this._appointmentAddWindow.find("#"+this._id+"startTimeZone").ejDropDownList({dataSource:this.model.timeZoneCollection.dataSource}),this._appointmentAddWindow.find("#"+this._id+"endTimeZone").ejDropDownList({dataSource:this.model.timeZoneCollection.dataSource}),null!=e?this._timeZoneCollection(e):this._timeZoneCollection(null)}},_timezoneStringValue:function(){var e=-(new Date).getTimezoneOffset()+this._timeZoneOffset,t=e<0?"-":"+",i=Math.abs(e),s=Math.floor(i/60)<10?"0"+Math.floor(i/60):Math.floor(i/60),a=i%60<10?"0"+i%60:i%60;return t+s+":"+a},_showCategorizeDetails:function(t){var s,a=t[this._appointmentSettings.categorize].split(",");for(i=0;i
    ${"+this.model.categorizeSettings.text+"}
    ")},_getCategorizeColor:function(e){var i=null,s="",a="",n="",o=e[this._appointmentSettings.categorize].split(","),r=o.length-1,l=this.model.categorizeSettings;return i=this._findResourceIndex(l.dataSource,this.model.categorizeSettings.id,o[r]),t.isNullOrUndefined(i)&&(i=this._findResourceIndex(l.dataSource,this.model.categorizeSettings.id,parseInt(o[r]))),t.isNullOrUndefined(i)?(e[this._appointmentSettings.categorize]="",{appointData:s,appointCustomcss:a,appointtextcolor:n}):(s=t.isNullOrUndefined(l.dataSource[i][l.color])?s:l.dataSource[i][l.color],n=t.isNullOrUndefined(l.dataSource[i][l.fontColor])?n:l.dataSource[i][l.fontColor],{appointData:s,appointCustomcss:a,appointtextcolor:n})},_currentDateFormat:function(i){var s,a,n,o;t.isNullOrUndefined(i)||"date"==e.type(this.currentDate())&&"date"==e.type(this.model.minDate)&&"date"==e.type(this.model.maxDate)?"MM/dd/yyyy"==i&&("date"!=e.type(this.currentDate())||"date"!=e.type(this.model.minDate)||"date"!=e.type(this.model.maxDate))&&(o=t.parseDate(this.currentDate()),s=t.parseDate(this.model.minDate),a=t.parseDate(this.model.maxDate),t.isNullOrUndefined(o)?this.currentDate(new Date):this.currentDate(o),this.model.minDate=t.isNullOrUndefined(s)?this.model.minDate:s,this.model.maxDate=t.isNullOrUndefined(a)?this.model.maxDate:a):(n=t.parseDate(this.currentDate(),this.model.dateFormat),s=t.parseDate(this.model.minDate,this.model.dateFormat),a=t.parseDate(this.model.maxDate,this.model.dateFormat),this.currentDate(t.isNullOrUndefined(n)?"Invalid Date"==new Date(this.currentDate()).toString()||"NaN"==new Date(this.currentDate()).toString()?this._dateConvert(this.currentDate()):new Date(this.currentDate()):n),this.model.minDate=t.isNullOrUndefined(s)?"Invalid Date"==new Date(this.model.minDate).toString()||"NaN"==new Date(this.model.minDate).toString()?this._dateConvert(this.model.minDate):new Date(this.model.minDate):s,this.model.maxDate=t.isNullOrUndefined(a)?"Invalid Date"==new Date(this.model.maxDate).toString()||"NaN"==new Date(this.model.maxDate).toString()?this._dateConvert(this.model.maxDate):new Date(this.model.maxDate):a)},_datepattern:function(){return""==this.model.dateFormat||t.isNullOrUndefined(this.model.dateFormat)?this._pattern.d:this.model.dateFormat},_businessHourScroller:function(){var i,s,a;return"agenda"!=this.currentView()&&(i=0,void("vertical"==this.model.orientation?(i=0!=this.element.find(".e-businesshighlightworkcells").length&&1==this.model.workHours.highlight?this.element.find(".e-businesshighlightworkcells").first().parent()[0].rowIndex*this.element.find(".e-workcells").height():0,e("div#"+this._id+"_scroller").ejScroller({scrollTop:i}),this.element.find(".e-scrolltimecells").css("top",-this.element.find(".e-draggableworkarea").scrollTop()+"px")):"horizontal"==this.model.orientation&&this.model.timeScale.enable&&(0!=this.element.find(".e-businesshighlightworkcells").length&&1==this.model.workHours.highlight&&"month"!=this.currentView()?"week"===this.currentView()||"workweek"===this.currentView()||"customview"===this.currentView()&&this._renderDays<=7?(s=this.element.find(".e-activeview.e-horizontalheaderdiv").parent().index(),!t.isNullOrUndefined(s)&&s>=0&&("customview"==this.currentView()?this.currentDate(new Date(this._dateRender[0])):this.currentDate(new Date(this._getRenderDates()[s])),dateRender=new Date(this._getRenderDates()[s]).getDay(),i=this.element.find(".e-workcells")[s*(this.model.endHour-this.model.startHour)*this.model.timeScale.minorSlotCount*(60/this.model.timeScale.majorSlot)].offsetLeft),("week"===this.currentView()&&[0,6].indexOf(dateRender)==-1||"workweek"===this.currentView())&&(i=this.model.enableRTL?i+this.element.find(".e-workcells").width()-this.model.workHours.start*this.model.timeScale.minorSlotCount*(60/this.model.timeScale.majorSlot)*this.element.find(".e-workcells").width():this.model.workHours.start*this.model.timeScale.minorSlotCount*(60/this.model.timeScale.majorSlot)*this.element.find(".e-workcells").width()+(i-this.element.find(".e-workcells").width()))):i=this.element.find(".e-businesshighlightworkcells")[0].offsetLeft:i=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)*2]:0,this.model.enableRTL?(i=this.element.find(".e-workcells")[0].offsetLeft-i,e("div#"+this._id+"_scroller").ejScroller({scrollLeft:i}),a=this.element.find(".e-workcells")[0].offsetLeft+this.element.find(".e-workcells").width()-this.element.find(".e-draggableworkarea").width(),i=i>=a?a:i,e(this.element.find(".e-horizontaltimecells").find("table tr")[2]).css("left",i+"px")):(e("div#"+this._id+"_scroller").ejScroller({scrollLeft:i}),e(this.element.find(".e-horizontaltimecells").find("table tr")[2]).css("left",-this.element.find(".e-draggableworkarea").scrollLeft()+"px")))))},_minToHour:function(e){var t=parseInt(e/60),e=e%60;return{h:t,m:e}},_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 s,a,n,o,r,l,d=t.buildTag("div");"object"==typeof i?s=i:(a=(new t.Query).where("Guid",t.FilterOperators.equal,i),s=new t.DataManager(this._processed).executeLocal(a)[0]);var h="",c=this,u=["Guid","ParentId","RecurrenceId","RecurrenceExDate","AppTaskId"];return e.each(s,function(e,i){u.indexOf(e)!=-1||t.isNullOrUndefined(i)||t.isNullOrUndefined(e)||"null"==e||((e==c._appointmentSettings.startTime||e==c._appointmentSettings.endTime)&&(i=i),h+="")}),h+="
    "+e+":"+i+"
    ",n="",t.isNullOrUndefined(this.model.resources)||t.isNullOrUndefined(s[this.model.resources[this.model.resources.length-1].field])||(o=c._appointmentSettings.resourceFields.split(","),e.each(this.model.resources[this.model.resources.length-1].resourceSettings.dataSource,function(e,t){t.id==s[o[o.length-1].trim()]&&(n=t.text)})),n=""==n?"Unknown":n,r=""+n+"

    ",l=r+h,d.append(l),t.print(d),!1},_recurrenceValidate:function(e,i,s,a){var n,o,r,l,d,h,c,u,m,p,g,_=this._appointmentAddWindow.find(".e-recurrenceeditor").data("ejRecurrenceEditor");if(t.isNullOrUndefined(e)||_.recurrenceRuleSplit(e,i),t.isNullOrUndefined(a)?(r=this._timeFormat(this._appointmentAddWindow.find("#"+this._id+"endtime").ejTimePicker("option","value")).split(":"),n=new Date(this._appointmentAddWindow.find("#"+this._id+"enddate").ejDatePicker("option","value").setHours(parseInt(r[0],10),parseInt(r[1],10)))):n=a,t.isNullOrUndefined(s)?(l=this._timeFormat(this._appointmentAddWindow.find("#"+this._id+"starttime").ejTimePicker("option","value")).split(":"),o=new Date(this._appointmentAddWindow.find("#"+this._id+"startdate").ejDatePicker("option","value").setHours(parseInt(l[0],10),parseInt(l[1],10)))):o=s,!((n-o)/864e5<14))return!1;if(d=t.isNullOrUndefined(s)?this._appointmentAddWindow.find("#recurstartdate").ejDatePicker("option","value"):s,h=_._rRule.interval,t.isNullOrUndefined(_._rRule.until))if(t.isNullOrUndefined(_._rRule.count))recurEndDate=new Date(new Date(this.currentDate()).setDate(d.getDate()+42*h));else switch(_._rRule.freq){case"DAILY":recurEndDate=new Date(new Date(d).setDate(d.getDate()+_._rRule.count*h));break;case"WEEKLY":c=_._rRule.weekDays.split(","),u=d.getDate()+_._rRule.count/c.length*7*h,recurEndDate=new Date(new Date(d).setDate(Math.round(u)24*parseInt(m));case"WEEKLY":if("INTERVAL"==e.split(";")[1].split("=")[0]){var f=_._rRule.weekDays.split(","),b={SU:0,MO:1,TU:2,WE:3,TH:4,FR:5,SA:6},v=[],x=[];for(g=0;gg?b[f[g]]:v[g-f.length]+7*parseInt(_._rRule.interval);for(p=v.sort(function(e,t){return e-t}),g=1;g24*Math.min.apply(Math,x))}return!((n-o)/36e5>24);case"MONTHLY":return!0;case"YEARLY":return!0}},_saveAppointment:function(){var i,a,n,o,r,l,d,h,c,u,m,p,g,_,f,b,v,x,w,y,C,S,T,D,I,k,P,L,R,M,O,E,A,j,N,z,F,B,H,V=this._appointmentAddWindow.find(".e-recurrenceeditor").data("ejRecurrenceEditor");if(""!=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 this._alertWindow.find(".e-alerttext").html(this._getLocalizedLabels("StartEndError")),this._alertWindow.ejDialog("open"),!1}if(this._appointmentAddWindow.find("#"+this._id+"recurrence").ejCheckBox("option","checked")&&""!=V._recRule&&!t.isNullOrUndefined(V._recRule)&&this.model.enableRecurrenceValidation&&"add"==this._currentAction&&!this._recurrenceValidate(V._recRule))return this._alertCreateError(),!1;if(i=this._sortAppById(this._processed),this._cellClick&&this.model.showQuickWindow){if(e.isFunction(e.validator)&&!e("#"+this._id+"_AddForm").validate().form())return!1;if(o={},a=t.isNullOrUndefined(this._appMainId)?1:this._appMainId+1,this.model.enableLoadOnDemand&&(a=this._dataCount),o[this._appointmentSettings.id]=a,o.AppTaskId=a,o.ParentId=a,o[this._appointmentSettings.subject]=this._quickAppointWindow.find(".subject").val(),o[this._appointmentSettings.startTime]=new Date(this.cur_StartTime),o[this._appointmentSettings.endTime]=new Date(this.cur_EndTime),o[this._appointmentSettings.allDay]=!!("month"===this.currentView()||0==new Date(this.cur_StartTime).getHours()&&23==new Date(this.cur_EndTime).getHours()&&59==new Date(this.cur_EndTime).getMinutes()||this._isCustomMonthView()),o[this._appointmentSettings.allDay]||(o[this._appointmentSettings.startTimeZone]=null==this.model.timeZone?"UTC "+this._timezoneStringValue():this.model.timeZone,o[this._appointmentSettings.endTimeZone]=null==this.model.timeZone?"UTC "+this._timezoneStringValue():this.model.timeZone),o[this._appointmentSettings.recurrence]=!1,t.isNullOrUndefined(this.model.group)&&(t.isNullOrUndefined(this.model.resources)||!t.scheduleFeatures.resources)||(o=this._getResourceFields(o)),"null"in o&&delete o[null],v={appointment:o},this._trigger("actionBegin",{data:v.appointment,requestType:"appointmentSave"})||this._trigger("beforeAppointmentCreate",v))return this._quickAppointWindow.ejDialog("close"),!1;this._currentAction==t.Schedule.Actions.Add,v.appointment.Guid=this._guidFormatGenerate(),e.extend(!0,n={},v.appointment),y=this._timeZoneAppointments(n,""),E=this._dataManager.insert(y),new t.DataManager(this._currentAppointmentData).update("AppTaskId",v.appointment),F=this,e.isFunction(E.promise)&&this.dataSource()instanceof t.DataManager?(E.done(function(i){if(F.model.enableLoadOnDemand)F._initDataSource("refresh");else{var s=t.isNullOrUndefined(i.record)?i:i.record;F._currentAppointmentData.length=0,F._dateFormat(s),F._bindAppointments=!0,F._currentAppointmentData=e.merge(F._currentAppointmentData,s),F._dataProcessing(s),F._renderAppointmentAll()}F._trigger("appointmentCreated",{appointment:v.appointment,requestType:"appointmentSaved"}),F._trigger("actionComplete",{data:v.appointment,requestType:"appointmentSave"})}),E.fail(function(){})):(this._processed.push(v.appointment),this._appMainId=o.AppTaskId+1,this._renderSingleApp(o,v.appointment),this._appMainId=this._sortAppById(this._processed)[this._processed.length-1].AppTaskId,this._trigger("appointmentCreated",{appointment:v.appointment,requestType:"appointmentSaved"}),this._trigger("actionComplete",{data:v.appointment,requestType:"appointmentSave"})),this._cellClick=!1,this._quickAppointWindow.ejDialog("close")}else{if(e.isFunction(e.validator)&&!e("#"+this._id+"_AddEditForm").validate().form())return!1;for(o={},y={},l=new t.DataManager(this._processed).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,this._appUid)),a=this._currentAction==t.Schedule.Actions.Add||this._currentAction==t.Schedule.Actions.EditOcurrence?this.model.enableLoadOnDemand?this._dataCount+1:t.isNullOrUndefined(this._appMainId)?parseInt(this._appId):this._appMainId+1:l[0].AppTaskId,r=e("#"+this._id+"AppointmentAddEditWindow").find("#"+this._id+"_AddEditForm").get(0),d=[],h=[],c=0;cnew Date(new Date(o[$.endTime]).setHours(0,0,0,0)).getTime()):c==Y.length-1?!(new Date(new Date(Y[c-1][$.endTime]).setHours(0,0,0,0)).getTime()new Date(new Date(o[$.endTime]).setHours(0,0,0,0)).getTime()))return this._alertCreateError(),!1}else if(!this._recurrenceValidate(o[this._appointmentSettings.recurrenceRule],b[0][this._appointmentSettings.recurrenceExDate]))return this._alertCreateError(),!1;if(this._currentAction==t.Schedule.Actions.EditOcurrence){this._objDate=b;var G=null==this._objDate[0][this._appointmentSettings.recurrenceId]?"ParentId":this._appointmentSettings.recurrenceId,S=this._deleteOcurrence(this._objDate[0][G],new Date(b[0][this._appointmentSettings.startTime])),q=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:q},"Guid"),o[this._appointmentSettings.recurrence]=1,o[this._appointmentSettings.recurrenceRule]=S[0][this._appointmentSettings.recurrenceRule]+";RECUREDITID="+S[0].AppTaskId,o[this._appointmentSettings.recurrenceId]=S[0][this._appointmentSettings.recurrenceId],o.Guid=this._appUid,o[this._appointmentSettings.recurrenceExDate]=S[0][this._appointmentSettings.recurrenceExDate]}else if(this._currentAction==t.Schedule.Actions.EditSeries){var W=null==b[0][this._appointmentSettings.recurrenceId]?b[0].ParentId:b[0][this._appointmentSettings.recurrenceId],L=(new t.Query).where("AppTaskId",t.FilterOperators.equal,W),S=new t.DataManager(this._currentAppointmentData).executeLocal(L);o.AppTaskId=S[0].AppTaskId,o[this._appointmentSettings.id]=S[0][this._appointmentSettings.id],a=S[0].AppTaskId,o[this._appointmentSettings.recurrenceId]=S[0][this._appointmentSettings.recurrenceId],o.Guid=this._appUid,o[this._appointmentSettings.recurrenceExDate]=S[0][this._appointmentSettings.recurrenceExDate],strDate=S[0][this._appointmentSettings.startTime],o[this._appointmentSettings.recurrenceRule]=t.isNullOrUndefined(V._recRule)||""==V._recRule?S[0][this._appointmentSettings.recurrenceRule]:V._recRule}if(this._currentAction!=t.Schedule.Actions.Add){if(o.Guid=b[0].Guid,o.AppTaskId=b[0].AppTaskId,o[this._appointmentSettings.id]=this._currentAction!=t.Schedule.Actions.EditSeries?b[0][this._appointmentSettings.id]:o[this._appointmentSettings.id],this._trigger("actionBegin",{data:o,requestType:"appointmentEdit"})||this._trigger("beforeAppointmentChange",{appointment:o}))return this._appointmentAddWindow.ejDialog("close"),!1}else if(o.Guid=t.isNullOrUndefined(o.Guid)?this._guidFormatGenerate():o.Guid,this._trigger("actionBegin",{data:o,requestType:"appointmentSave"}))return this._appointmentAddWindow.ejDialog("close"),!1;if(v=[],this._startTimezone!=this._endTimezone?o[this._appointmentSettings.endTime]=f.cloneEnddiffer:"",!t.isNullOrUndefined(this.model.categorizeSettings)&&h.length>0&&!t.isNullOrUndefined(h[0][0])||!t.isNullOrUndefined(this.model.resources)&&t.scheduleFeatures.resources?v=this._getResCategorySaveData(h,d,o,a,y,g,_):(w=this._currentAction==t.Schedule.Actions.EditOcurrence||!t.isNullOrUndefined(o[this._appointmentSettings.recurrenceRule])&&o[this._appointmentSettings.recurrenceRule].toString().indexOf("RECUREDITID")!=-1?this._parentId:this._currentAction==t.Schedule.Actions.Save?b[0].AppTaskId:a,this._maxId=(new Date(o[this._appointmentSettings.endTime])-new Date(o[this._appointmentSettings.startTime]))/36e5>24&&this._currentAction!=t.Schedule.Actions.EditOcurrence&&1==o[this._appointmentSettings.allDay]?w:this._currentAction==t.Schedule.Actions.Save?b[0].AppTaskId:this._appMainId+1,this._maxId=(new Date(o[this._appointmentSettings.endTime])-new Date(o[this._appointmentSettings.startTime]))/36e5>24&&!t.isNullOrUndefined(o[this._appointmentSettings.recurrenceRule])&&o[this._appointmentSettings.recurrenceRule].toString().indexOf("RECUREDITID")!=-1&&this._currentAction==t.Schedule.Actions.Save?b[0].AppTaskId:this._maxId,this._maxId=this._currentAction==t.Schedule.Actions.EditSeries?w:this._maxId,x=this._addAppData(o,this._maxId,new Date(o[this._appointmentSettings.startTime]),new Date(o[this._appointmentSettings.endTime]),w),this._currentAction==t.Schedule.Actions.EditOcurrence&&(x[this._appointmentSettings.id]=x.AppTaskId),v.push(x)),this._currentAction==t.Schedule.Actions.Add&&this._trigger("beforeAppointmentCreate",{appointment:v}))return this._appointmentAddWindow.ejDialog("close"),!1;if(v[this._appointmentSettings.startTime]>v[this._appointmentSettings.endTime])return!1;if(this._currentAction==t.Schedule.Actions.Add||this._currentAction==t.Schedule.Actions.EditOcurrence){for(this._maxId=a,F=this,y=[],M=0;M0?Q.push(v[B]):K.push(v[B]); if(this._currentAction==t.Schedule.Actions.EditSeries)for(B=0;B0)if(F=this,e.isFunction(E.promise)&&this.dataSource()instanceof t.DataManager)E.done(function(i){if(F.model.enableLoadOnDemand)F._initDataSource("refresh");else{var s=t.isNullOrUndefined(i.record)?i:i.record;F._currentAppointmentData.length=0,F._dateFormat(s),F._bindAppointments=!0,F._currentAppointmentData=e.merge(F._currentAppointmentData,s),F._dataProcessing(s),F._renderAppointmentAll()}F._appMainId=F._processed.length>0?F._sortAppById(F._processed)[F._processed.length-1].AppTaskId:F._appMainId,F._trigger("appointmentChanged",{appointment:Q[0],requestType:"appointmentChanged"}),F._trigger("actionComplete",{data:Q,requestType:"appointmentEdit"})}),E.fail(function(){});else{for(B=0;B0?this._sortAppById(this._processed)[this._processed.length-1].AppTaskId:this._appMainId;this._trigger("appointmentChanged",{appointment:Q[0],requestType:"appointmentChanged"}),this._trigger("actionComplete",{data:Q,requestType:"appointmentEdit"})}}}this._clearFields(),this._appointmentAddWindow.ejDialog("close"),this.element.find("div.e-draggableworkarea tr").find("td").hasClass("e-selectedCell")&&this._processFocus(),"horizontal"==this.model.orientation&&"agenda"!=this.currentView()&&this.element.find(".e-draggableworkarea").offset().top>this.element.find(".e-workcellstab").offset().top&&(H=this.element.find(".e-draggableworkarea").offset().top-this.element.find(".e-workcellstab").offset().top,this.element.find(".e-horires").css("top",-H+"px")),this._recRule=""},_alertCreateError:function(){e("#"+this._id+"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(e,i){var s,a,n,o;if(this._startTimezone=e[this._appointmentSettings.startTimeZone],this._endTimezone=e[this._appointmentSettings.endTimeZone],!t.isNullOrUndefined(this._startTimezone)&&""!=this._startTimezone){var r=this._startTimezone.indexOf("UTC")!=-1?this._startTimezone.split(" ")[1].split(":"):this._startTimezone.split(":"),l=parseInt(r[0]),d=parseInt(r[1]),h=60*l+d;if(null==this.model.timeZone?(s=(new Date).getTimezoneOffset()-this._timeZoneOffset,n=this._minToHour(s+(60*l+d))):(a=this.model.timeZone.indexOf("UTC")!=-1?this.model.timeZone.split(" ")[1].split(":"):this.model.timeZone.split(":"),n=this._minToHour(60*l+d),n.h=n.h-parseInt(a[0]),n.m=n.m-parseInt(a[1])),new Date(e[this._appointmentSettings.startTime].setHours(e[this._appointmentSettings.startTime].getHours()-n.h,e[this._appointmentSettings.startTime].getMinutes()-n.m)),this._startTimezone!=this._endTimezone&&this._publicMethodSave){this.startutcValue=null,this.tempValue=null;var c=this._endTimezone.indexOf("UTC")!=-1?this._endTimezone.split(" ")[1].split(":"):this._endTimezone.split(":"),u=parseInt(c[0]),m=parseInt(c[1]),p=60*u+m;h-=p;var g=(new Date(i.StartDate),new Date(e[this._appointmentSettings.startTime]),new Date(i.EndDate));duration=new Date(g.setMinutes(g.getMinutes()+h)),duration=new Date(duration.setMinutes(duration.getMinutes()-(60*n.h+n.m))),o=duration}else new Date(e[this._appointmentSettings.endTime].setHours(e[this._appointmentSettings.endTime].getHours()-n.h,e[this._appointmentSettings.endTime].getMinutes()-n.m))}return{obj:e,cloneEnddiffer:o}},_renderAllDayAppointments:function(){var e,i,s,a,n,o,r,l;this.cellwidth-20;if(this.level=0,e=this._dateRender,this._renderedAllDay=[],allDayCount=[],this.element.find(".e-alldayappointment").remove(),i=this._appointmentSort(this._processed),this.model.group||(this.res1=["0"]),this._resWorkWeek)for(s=0,a=0,n=0;nu)n=n;else if(n!=u&&(n=u,"month"!=c))for(l=parseInt(n),s=0;s<=h;s++)e(d[s].cells[l]).hasClass("e-selectedCell")&&(r=s)}),"month"!=c?e(d[r].cells[n]).attr("tabIndex",0).focus():(t=d.find("td.e-selectedCell"),i=parseInt(t.length)-1,e(t[i]).attr("tabIndex",0).focus())}else this.element.focus(),this.element.find("td.e-selectedCell").attr("tabIndex",0).focus(),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._appointmentAddWindow.find("#"+this._id+"endtime").ejTimePicker("option","value",t.format(new Date,this._pattern.t)),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}},_recurClearFields:function(){for(var t=this._appointmentAddWindow.find("input.weekdays"),i=0;i0&&c._dateFormat(s),c._bindAppointments=!0,c._currentAppointmentData=e.merge(c._currentAppointmentData,s),c._dataProcessing(s),c._renderAppointmentAll()}c._trigger("appointmentRemoved",{appointment:l,requestType:"appointmentDeleted"}),c._trigger("actionComplete",{data:l,requestType:"appointmentDelete"})}),h.fail(function(){});else{if(u=new Date(new Date(l[this._appointmentSettings.startTime]).setHours(0,0,0,0)).getTime()0)this.model.timeScale.enable?l[this._appointmentSettings.recurrence]||u||(new Date(l[this._appointmentSettings.endTime])-new Date(l[this._appointmentSettings.startTime]))/36e5>24?(m=l[this._appointmentSettings.recurrence]?null==r[0][this._appointmentSettings.recurrenceId]?r[0].ParentId:r[0][this._appointmentSettings.recurrenceId]:r[0].AppTaskId,new t.DataManager(this._currentAppointmentData).remove("AppTaskId",l.AppTaskId),this._dataProcessing(this._currentAppointmentData),this._renderAppointmentAll()):(new t.DataManager(this._processed).remove("Guid",s),this.element.find("[guid="+s+"]").remove(),this.element.find("div[id=categorybar_"+s+"]").remove(),"vertical"!=this.model.orientation||"month"==this.currentView()||this._isCustomMonthView()||1!=r[0][this._appointmentSettings.allDay]?this._renderAppointmentAll():this._reRenderAllDayAppointments(),v=this.allDayLevel):l[this._appointmentSettings.recurrence]||u||(new Date(l[this._appointmentSettings.endTime])-new Date(l[this._appointmentSettings.startTime]))/36e5>24?this._dataProcessing(this._currentAppointmentData)&&this._renderAppointmentAll():new t.DataManager(this._processed).remove("Guid",s)&&this._renderAppointmentAll();else for(p=(new t.Query).where("ParentId",t.FilterOperators.equal,l.ParentId),g=new t.DataManager(this._processed).executeLocal(p),i=0;i24||a.appointment[this._appointmentSettings.allDay])&&"month"!=this.currentView()&&!this._isCustomMonthView()&&"agenda"!=this.currentView()&&0==v&&(this._mediaQuery?this.element.find(".e-alldaycells,.e-leftindent,.e-emptyalldaytd").attr("style","height:40px !important"):this.element.find(".e-alldaycells,.e-leftindent,.e-emptyalldaytd").css("height","27px"),this.element.find(".e-alldaycells").first().css(this.model.enableRTL?"border-right":"border-left","none"),this._reRenderScroller())}f=this._appointmentCount(),f.length<1&&this.model.showAppointmentNavigator&&this._nextPrevButton(f),this.model.showOverflowButton||"horizontal"!=this.model.orientation||"agenda"==this.currentView()||(b=this.element.find(".e-draggableworkarea").offset().top-this.element.find(".e-workcellstab").offset().top,this.element.find(".e-horires").css("top",-b+"px")),this._appUid=null},_appointmentCount:function(){var e=this._dateRender,i=this._processed;i=this._sortAppById(i),i=this._appointmentSort(i);var s="agenda"==this.currentView()?new Date(new Date(this.currentDate()).setHours(0,0,0)):new Date(e[0]),a="agenda"==this.currentView()?new Date(new Date(new Date(this.currentDate()).setDate(s.getDate()+(this.model.agendaViewSettings.daysInAgenda>0?this.model.agendaViewSettings.daysInAgenda-1:0))).setHours(23,59,59)):new Date(new Date(e[e.length-1]).setHours(23,59,59)),n=t.Predicate(this._appointmentSettings.startTime,t.FilterOperators.greaterThanOrEqual,s);return n=n.and(this._appointmentSettings.startTime,t.FilterOperators.lessThanOrEqual,a),new t.DataManager(i).executeLocal((new t.Query).where(n))},_reRenderAllDayAppointments:function(){this._alldayLevel=1==this.level,this.model.showAllDayRow&&this.element.find("div.e-alldayappointment").remove()&&this._renderAllDayAppointments(),this._unWireResizeEvents(),this._wireResizeEvents(),this._dragdropAppointments()},_appointmentResizeStart:function(i){if(this.model.enableAppointmentResize){this._appointdata=e(i.target).parent();var s=e(i.target).parent().attr("guid"),a=this._sortAppById(new t.DataManager(this._processed).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,s))),n={element:e(i.target).parent(),appointment:a[0]};if(this._trigger("actionBegin",{data:n,requestType:"appointmentResize"})||this._trigger("resizeStart",n)||(i.preventDefault(),this.model.showQuickWindow&&this._quickAppointWindow.ejDialog("close")&&this._quickAppDetailsWindow.ejDialog("close"),this.resizeStart=!0,e(i.target).hasClass("e-lefthandle")||e(i.target).hasClass("e-righthandle")?(this.resize=i.pageX,this.appoint_width=e(i.target).parent().width(),this.appoint_left=parseInt(e(i.target).parent()[0].style.left),this._appointleft=parseInt(e(e(i.target).parent()[0]).offset().left),this._appointright=parseInt(e(e(i.target).parent()[0]).css("right")),"horizontal"==this.model.orientation&&this.model.enableRTL?e(i.target).hasClass("e-lefthandle")?this._rightResizing=!0:this._leftResizing=!0:e(i.target).hasClass("e-lefthandle")?this._leftResizing=!0:this._rightResizing=!0):(e(i.target).hasClass("e-tophandle")||e(i.target).hasClass("e-bottomhandle"))&&(this.resize=i.pageY,this.appoint_height=e(i.target).parent().height(),this.appoint_top=parseInt(e(i.target).parent()[0].style.top),e(i.target).hasClass("e-tophandle")?this._topResizing=!0:this._bottomResizing=!0),this._curElmt=e(i.target).parent(),this.element.find(".e-workcells").removeClass("e-selectedCell,e-mousehover"),e(document).bind(t.eventType.mouseMove,e.proxy(this._appointmentResizing,this)),e(document).bind(t.eventType.mouseUp,e.proxy(this._appointmentResizeStop,this)),e(i.target).hasClass("e-rowcursor")||e(i.target).hasClass("e-columncursor")))return!1}},_appointmentResizing:function(t){var i,s,a,n=e(t.target),o={element:n.parent()};return this.element.find(".e-scheduletooltip").hide(),i=e(t.target).hasClass("e-appointment")||e(t.target).hasClass("e-monthappointment")||e(t.target).hasClass("e-alldayappointment")?e(t.target):e(t.target).parents(".e-appointment,.e-alldayappointment,.e-monthappointment"),0==e(".e-scheduleAppGlassy").length&&(i.find(".e-schedulemouseclose").addClass("e-schedulemouseclosetemp").removeClass("e-schedulemouseclose e-icon"),i.clone().prop("id","cloneElement").appendTo(i.parent()),i.addClass("e-draggableAppointment e-scheduleAppGlassy").removeClass("e-schedulemouseclose").appendTo(i.parent()),this._topResizing||this._bottomResizing?(this.model.enableRTL?i.css("right","0"):i.css("left","0"),i.css("width","98%")):(this._rightResizing||this._leftResizing)&&("horizontal"!=this.model.orientation?"month"===this.currentView()||this._isCustomMonthView()?this._appointmentResizeHeight(i,-this.element.find(".e-monthheader").height(),"e-monthcells"):this.model.timeScale.enable?(i.css("top",this.element.find(".e-headerarearow").height()-this.element.find(".e-alldaycells").height()-2),i.css("height",this.element.find(".e-alldaycells").height()-2)):i.css("height",this.element.find(".e-monthcells").height()-2):this._appointmentResizeHeight(i,0,"e-workcells"))),i=e(t.target).hasClass("e-appointment")||e(t.target).hasClass("e-monthappointment")||e(t.target).hasClass("e-workcells")||e(t.target).hasClass("e-monthcells")||e(t.target).hasClass("e-alldayappointment")||e(t.target).hasClass("e-alldaycells")?e(t.target):e(t.target).parents(".e-appointment,.e-alldayappointment,.e-monthappointment"),s=this.element.find(".e-workcells").height(),a=e(i[0]).height()/s,!this._trigger("resize",o)&&(this._topResizing?a>0&&!e(t.target).hasClass("e-alldaycells")&&!e(t.target).hasClass("e-apptext")&&(this._curElmt.height(this.appoint_height+this.resize-t.pageY+3),this._curElmt.css("top",this.appoint_top-(this.resize-t.pageY)-3)):this._bottomResizing?this._curElmt.height(this.appoint_height+(t.pageY-this.resize)+2):this._rightResizing?"horizontal"==this.model.orientation&&this.model.enableRTL?(this._curElmt.width(this.appoint_width+this.resize-t.pageX+3),this._curElmt.css("left",this.appoint_left-(this.resize-t.pageX)-3)):(this._curElmt.width(this.appoint_width+(t.pageX-this.resize)+2),this._curElmt.css("right",this._appointright-(t.pageX-this.resize)-2)):this._leftResizing&&("horizontal"==this.model.orientation&&this.model.enableRTL?(this._curElmt.width(this.appoint_width+(t.pageX-this.resize)+2),this._curElmt.css("right",this._appointright-(t.pageX-this.resize)-2)):(this._curElmt.width(this.appoint_width+this.resize-t.pageX+3),this._curElmt.css("left",this.appoint_left-(this.resize-t.pageX)-3))),void(this._curElmt.hasClass("e-appointment")&&this._appointmentCurrentTimeUpdate()))},_appointmentResizeHeight:function(t,i,s){var a,n;this.model.showOverflowButton||(a=document.elementsFromPoint(t.offset().left,t.offset().top)),n=this.model.showOverflowButton?this.element.find("."+s):e.grep(a,function(t){if(e(t).hasClass(s))return t}),t.css("top",i).css("height",e(n).height()-2)},_appointmentCurrentTimeUpdate:function(){var i,s,a,n,o,r,l=new t.DataManager(this._processed).executeLocal((new t.Query).where("AppTaskId",t.FilterOperators.equal,parseInt(this._curElmt.attr("id").split("_")[1])))[0],d=JSON.parse(JSON.stringify(l)),h=new Date(d[this._appointmentSettings.startTime]),c=new Date(d[this._appointmentSettings.endTime]),u=this.element.find(".e-workcells").height(),m=parseInt(this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount);if("month"!==this.currentView()&&!this._isCustomMonthView())var p=this.element.find(".e-draggableworkarea"),g=e(this._curElmt[0]).offset().top,_=p.height()+p.scrollTop(),f=e(this._curElmt[0]).outerHeight(),b=g-p.offset().top+p.scrollTop(),v=b-u/this.model.timeScale.minorSlotCount<_?b:_-f;if(this._topResizing)s=v*this.model.timeScale.majorSlot/(this.model.timeScale.minorSlotCount*(u+1)),h.setHours(parseInt(this.model.startHour)+parseInt(s/60)),h.setMinutes(parseInt(s%60)),m>=10?h.setMinutes(10*Math.round(h.getMinutes()/10)):h.setMinutes(1*h.getMinutes());else if(this._bottomResizing)i=e(this._curElmt[0]).outerHeight()/u,s=(v+i*u)*this.model.timeScale.majorSlot/(this.model.timeScale.minorSlotCount*(u+1)),c.setHours(parseInt(this.model.startHour)+parseInt(s/60)),c.setMinutes(s%60),m>=10?c.setMinutes(10*Math.round(c.getMinutes()/10)):c.setMinutes(1*c.getMinutes());else if(this._rightResizing){if(a=this.model.endHour-this.model.startHour==24?this._curElmt.width()-this.appoint_width:this._curElmt.width(),r=60*a/(this.element.find(".e-workcells").width()*this.model.timeScale.minorSlotCount*(60/this.model.timeScale.majorSlot)+1),this.model.endHour-this.model.startHour==24?(c.setHours(new Date(c).getHours()+parseInt(r/60)),c.setMinutes(new Date(c).getMinutes()+parseInt(r%60))):(c.setHours(new Date(h).getHours()+parseInt(this._curElmt.width()/this.element.find(".e-workcells").width())/(this.model.timeScale.minorSlotCount*(60/this.model.timeScale.majorSlot))),c.setMinutes(new Date(h).getMinutes()+parseInt(r%60))),m>=10?c.setMinutes(10*Math.round(c.getMinutes()/10)):c.setMinutes(1*c.getMinutes()),c>new Date(new Date(this._dateRender[this._dateRender.length-1]).setHours(23,59,59))&&(c=new Date(new Date(this._dateRender[this._dateRender.length-1]).setHours(23,59,59))),this.model.endHour-this.model.startHour!=24){var x=parseInt((this._curElmt.offset().left+(p.scrollLeft()-p.offset().left)+this._curElmt.width())/this.element.find(".e-workcells").width())-1,w=parseInt(x/((this.model.endHour-this.model.startHour)*this.model.timeScale.minorSlotCount*(60/this.model.timeScale.majorSlot))),y=new Date(h),C=new Date(c).getHours()>=this.model.endHour?(this._dateRender[w]-new Date(new Date(new Date(h).setHours(0,0,0,0))).getTime())/864e5:0,S="workweek"==this.currentView()?(C-1)*(this.model.endHour-this.model.startHour):0,T=new Date(c).getHours()>=this.model.endHour?new Date(new Date(y).setHours(new Date(h).getHours()+S+parseInt(e(this._curElmt).width()/this.element.find(".e-workcells").width())/(this.model.timeScale.minorSlotCount*(60/this.model.timeScale.majorSlot))+C*(24-this.model.endHour+this.model.startHour))):c;new Date(c).getHours()>=this.model.endHour&&T.setMinutes(new Date(h).getMinutes()+parseInt(r%60)),new Date(new Date(T).setHours(0,0,0,0)).getTime()!=new Date(this._dateRender[w]).getTime()&&(T=new Date(this._dateRender[w]).setHours(new Date(T).getHours(),new Date(T).getMinutes(),new Date(T).getSeconds(),new Date(T).getMilliseconds())),c=new Date(T)}}else if(this._leftResizing&&(n=e(this.element.find(".e-workcells.e-childworkcell")[0]).offset().left=10?h.setMinutes(10*Math.round(h.getMinutes()/10)):h.setMinutes(1*h.getMinutes()),h=d?(newStartTime=new Date(this._dateRender[0]),!this._resWorkWeek&&this._leftResizing&&(d=e(i[0]).offset().left-e(this.element.find(".e-alldaycells")[s*a]).offset().left,u=Math.round(d/(this.element.find(".e-alldaycells").width()+1))),this.model.workWeek.length>0?this._resWorkWeek?(newStartTime=new Date(this._dateRender[r]),newStartTime.setHours(new Date(m).getHours(),new Date(m).getMinutes(),new Date(m).getSeconds())):(newStartTime=new Date(this._dateRender[0]),newStartTime.setDate(new Date(this._dateRender[u]).getDate()),newStartTime.setMonth(new Date(this._dateRender[u]).getMonth()),newStartTime.setHours(new Date(m).getHours(),new Date(m).getMinutes(),new Date(m).getSeconds())):(newStartTime=new Date(this._dateRender[0]),newStartTime.setDate(new Date(newStartTime).getDate()+(u>=a?u-1:u)),newStartTime.setHours(new Date(m).getHours(),new Date(m).getMinutes(),new Date(m).getSeconds()))):(this._rightResizing?this._rightResizing=!1:this._leftResizing=!1,this.model.enableRTL?newEndTime=o:newStartTime=n);return this.model.enableRTL?newEndTime:newStartTime},_appointmentResizeStop:function(i){var a,n,o,r,l,d,h,c,u,m,p,g,_,f,b,v,x,w,y,C,S,T,D,I,k,P,L,R,M,O;try{a=this.element.find(".e-draggableworkarea"),this.resizeStart=!1,e(document).unbind(t.eventType.mouseMove,e.proxy(this._appointmentResizing,this)),e(document).unbind(t.eventType.mouseUp,e.proxy(this._appointmentResizeStop,this));var E=this._appointmentSettings,A=this.element.find(".e-workcellstab"),j=A.find("tr").length*this.element.find(".e-workcells").height(),N=e(i.target).hasClass("e-appointment")||e(i.target).hasClass("e-monthappointment")||e(i.target).hasClass("e-alldayappointment")?e(i.target):e(i.target).parents(".e-appointment,.e-alldayappointment,.e-monthappointment");0==N.length&&(N=this._appointdata),N.attr("guid")!=this._appointdata.attr("guid")&&(N=this._appointdata),this._appUid=N.attr("guid");var z=new t.DataManager(this._processed).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,this._appUid)),F=z.length>1,B=z[0][E.recurrence]&&z[0][E.recurrenceRule].toString().indexOf("RECUREDITID")==-1?this._getAppointmentByParentId(this._appUid):z[0][E.recurrence]?z[0]:this._getAppointmentByParentId(this._appUid),H="week"===this.currentView()||"month"===this.currentView()||this._isCustomMonthView()?7:"workweek"===this.currentView()&&this.model.workWeek.length>0?this.model.workWeek.length:1;if(H="customview"==this.currentView()&&this._renderDays<=7?this._renderDays:H,this._resWorkWeek&&(o=new t.DataManager(this.res1).executeLocal((new t.Query).where(this.model.resources[this.model.resources.length-1].resourceSettings.id,t.FilterOperators.equal,z[0][this._appointmentSettings.resourceFields.split(",")[this._appointmentSettings.resourceFields.split(",").length-1]])), n=t.isNullOrUndefined(o[0][this.model.resources[this.model.resources.length-1].resourceSettings.workWeek])?this.model.workWeek:o[0][this.model.resources[this.model.resources.length-1].resourceSettings.workWeek],H=n.length),null!=B||B!==s){var V=(B[this._appointmentSettings.startTime].getDate()0?V=this._resizeNewStartTime:V.setHours(0,0,0),this._topResizing=!1):this._bottomResizing?(d=this._bottomResizing,Q>=0&&tem&&(this.model.enableRTL?(g=Math.round((e(N[0]).width()-this.appoint_width)/this.element.find(".e-monthcells").width()),U.setDate(new Date(U).getDate()+g),U.setHours(new Date(G).getHours(),new Date(G).getMinutes())):(this._resize=!0,V=new Date(this._firstweekdate(new Date(z[0][E.startTime]))),this._resize=!1,g=Math.round((e(N[0]).offset().left-e(this.element.find(".e-monthcells")[k*H]).offset().left)/this.element.find(".e-monthcells").width()),V.setDate(V.getDate()+g),V.setHours(new Date(W).getHours(),new Date(W).getMinutes()))))):(h=e(this.element.find(".e-workcells.e-childworkcell")[0]).offset().left=e(N[0]).offset().left+e(N[0]).width()&&(g=Math.round((e(N[0]).width()-this.appoint_width)/u),this.model.enableRTL?(V.setDate(new Date(V).getDate()-g),V.setHours(new Date(W).getHours(),new Date(W).getMinutes())):(U.setDate(new Date(U).getDate()+g),U.setHours(new Date(G).getHours(),new Date(G).getMinutes()))))):(p=this.model.endHour-this.model.startHour==24?e(N[0]).width()-this.appoint_width:e(N[0]).width(),"month"==this.currentView()||this._isCustomMonthView()||!this.model.timeScale.enable?(p=e(N[0]).width()-this.appoint_width,g=Math.round(p/(this.element.find(".e-workcells").width()+1)),U.setDate(new Date(U).getDate()+g)):U=this._resizeNewEndTime),this._rightResizing=!1),(V>=U||0==e(N[0]).width())&&(V=z[0][E.startTime],U=z[0][E.endTime]),V.getTime()==z[0][E.startTime].getTime()&&U.getTime()==z[0][E.endTime].getTime())return this.element.find("#cloneElement").length>0&&(_=this.element.find(".e-monthappointment").length>1?this.element.find("#cloneElement").outerHeight():this.element.find("#cloneElement").height(),this._curElmt.removeClass("e-draggableAppointment e-scheduleAppGlassy").css({width:this.element.find("#cloneElement").width(),height:_,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")).removeAttr("style"),this._curElmt.find(".e-apptime").html(this.element.find("#cloneElement").find(".e-apptime").text()).removeAttr("style"),this.element.find("#cloneElement").remove(),e(N[0]).find(".e-schedulemouseclosetemp").addClass("e-schedulemouseclose e-icon").removeClass("e-schedulemouseclosetemp")),this._trigger("resizeStop",{appointment:z[0],target:i}),!1;this.element.find("#cloneElement").length>0&&this.element.find("#cloneElement").remove(),f=!0,this._refreshCellsHeight();var ie=new Date(new Date(this.currentDate()).getFullYear(),new Date(this.currentDate()).getMonth(),1),se=new Date(new Date(this.model.maxDate).getTime()).setHours(23,59,59),ae=!this.model.showNextPrevMonth&&"vertical"==this.model.orientation&&"month"==this.currentView()&&(ie.getTime()!=new Date(V.getFullYear(),V.getMonth(),1).getTime()||ie.getTime()!=new Date(U.getFullYear(),U.getMonth(),1).getTime());if(!ae&&U>=new Date(this.model.minDate)&&U<=se)if(1==B[E.recurrence]&&B[E.recurrenceRule].toString().indexOf("RECUREDITID")==-1){var ne={},oe=new t.DataManager(this._processed).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,this._appUid))[0],v=null==oe[this._appointmentSettings.recurrenceId]?oe.ParentId:oe[this._appointmentSettings.recurrenceId],re=null==oe[this._appointmentSettings.recurrenceId]?"ParentId":this._appointmentSettings.recurrenceId,I=new t.DataManager(this._processed).executeLocal((new t.Query).where(re,t.FilterOperators.equal,v));F&&(I=this._recurrenceAppSort(I)),I=this._appointmentRecurrenceSort(I),e.extend(ne,z[0]),this.model.enableRecurrenceValidation&&ne[E.recurrence]&&(k=this._recuCollectionIndex(I,oe)),this.model.enableRecurrenceValidation&&ne[E.recurrence]&&!(0==k?!!t.isNullOrUndefined(I[k+1])||new Date(new Date(I[k+1][E.startTime]).setHours(0,0,0,0)).getTime()>new Date(new Date(U).setHours(0,0,0,0)).getTime():k==I.length-1?new Date(new Date(I[k-1][E.endTime]).setHours(0,0,0,0)).getTime()new Date(new Date(U).setHours(0,0,0,0)).getTime())?(ne[E.startTime]=oe[E.startTime],ne[E.endTime]=oe[E.endTime],this._alertDragResizeError(),f=!0):(prvStartTime=ne[E.startTime],prvEndTime=ne[E.endTime],ne[E.startTime]=new Date(V),ne[E.endTime]=new Date(U),this._trigger("resizeStop",{appointment:ne,target:i})?(ne[E.startTime]=new Date(prvStartTime),ne[E.endTime]=new Date(prvEndTime),f=!0):(b=this.model.enableLoadOnDemand?this._dataCount:this._appMainId+1,v=null==ne[E.recurrenceId]?ne.ParentId:ne[E.recurrenceId],this._deleteOcurrence(v,new Date(oe[E.startTime])),ne[E.recurrenceRule]=z[0][E.recurrenceRule]+";RECUREDITID="+ne.ParentId,ne.AppTaskId=b,ne[E.id]=ne.AppTaskId,f=!1));var le={data:ne},P=[],de=[];for(P.push(this._timeZoneAppointments(le.data,"")),x=null==ne[this._appointmentSettings.recurrenceId]?ne.ParentId:ne[this._appointmentSettings.recurrenceId],w=new t.DataManager(this._currentAppointmentData).executeLocal((new t.Query).where("AppTaskId",t.FilterOperators.equal,x)),de.push(this._timeZoneAppointments(w[0],"")),this.dataSource()instanceof t.DataManager?f||(L=this._dataManager.saveChanges({added:P,changed:de,deleted:[]},this._appointmentSettings.id)):f||(L=this._dataManager.saveChanges({added:P,changed:de,deleted:[]},"AppTaskId")),y=[],S=0;Snew Date(new Date(U).setHours(0,0,0,0)).getTime():k==I.length-1?new Date(new Date(I[k-1][E.endTime]).setHours(0,0,0,0)).getTime()new Date(new Date(U).setHours(0,0,0,0)).getTime())?(T[0][E.startTime]=D[0][E.startTime],T[0][E.endTime]=D[0][E.endTime],this._alertDragResizeError(),f=!0):(prevStartTime=T[0][E.startTime],prevEndTime=T[0][E.endTime],T[0][E.startTime]=V,T[0][E.endTime]=U,this._trigger("resizeStop",{appointment:T[0],target:i})?(T[0][E.startTime]=prevStartTime,T[0][E.endTime]=prevEndTime,f=!0):f=!1),P=this._timeZoneAppointments(T[0],""),this.dataSource()instanceof t.DataManager?f||(L=this._dataManager.update(this._appointmentSettings.id,P)):f||(L=this._dataManager.update("AppTaskId",P)),R=this._timeZoneAppointments(P,"reverse"),new t.DataManager(this._currentAppointmentData).update("AppTaskId",R),M=this,!t.isNullOrUndefined(L)&&L&&e.isFunction(L.promise)&&this.dataSource()instanceof t.DataManager?(L.done(function(e){M._processUrlBinding(e),M._trigger("actionComplete",{data:T,requestType:"appointmentResize"})}),L.fail(function(){M._renderAppointmentAll()})):(F?(O=new t.DataManager(this._processed).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,T[0].Guid)),new t.DataManager(this._processed).saveChanges({added:[],changed:[],deleted:O},"Guid"),this._appointmentProcessing(T[0])):new t.DataManager(this._processed).update("Guid",T[0]),this._renderAppointmentAll(),this._trigger("actionComplete",{data:T,requestType:"appointmentResize"}),this._appMainId=this._sortAppById(this._processed)[this._processed.length-1].AppTaskId);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(e){}},_dragdropAppointments:function(){var i,s,a;return!this.model.readOnly&&(this._topResizing=!1,this._bottomResizing=!1,this._leftResizing=!1,this._rightResizing=!1,void(this.model.allowDragAndDrop&&(s=this,a=this.element.find(".e-appointment"),a.ejDraggable({handle:".e-appointment",dragArea:""==s.model.appointmentDragArea?s.element.find("div.e-draggableworkarea",".e-headrealldaytable tr"[t.isNullOrUndefined(this.model.group)||t.isNullOrUndefined(this.model.resources)?1:this.model.group.resources.length+1]):e(s.model.appointmentDragArea),cursorAt:""==s.model.appointmentDragArea?{top:0,left:0}:{top:-40,left:-40},dragStart:function(e){s._dragStart(e)},drag:function(e){s._dragOver(e)},dragStop:function(e){s._dragStop(e)},helper:function(t){return i=e(t.sender.target).hasClass("e-appointment")?e(t.sender.target):e(t.sender.target).parents(".e-appointment"),s._appointElement(i,s)}}),a=this.element.find(".e-alldayappointment"),a.ejDraggable({handle:".e-alldayappointment",dragArea:""==s.model.appointmentDragArea?s.element:e(s.model.appointmentDragArea),cursorAt:{top:17,left:0},dragStart:function(e){s._dragStart(e)},drag:function(e){s._dragOver(e)},dragStop:function(e){s._dragStop(e)},helper:function(t){return i=e(t.sender.target).hasClass("e-alldayappointment")?e(t.sender.target):e(t.sender.target).parents(".e-alldayappointment"),s._appointElement(i,s)}}),a=this.element.find(".e-monthappointment"),a.ejDraggable({handle:".e-monthappointment",dragArea:""==s.model.appointmentDragArea?s.element.find("div.e-draggableworkarea"):e(s.model.appointmentDragArea),cursorAt:""==s.model.appointmentDragArea?{top:0,left:0}:{top:-20,left:10},dragStart:function(e){s._dragStart(e)},drag:function(e){s._dragOver(e)},dragStop:function(e){s._dragStop(e)},helper:function(t){return i=e(t.sender.target).hasClass("e-monthappointment")?e(t.sender.target):e(t.sender.target).parents(".e-monthappointment"),s._appointElement(i,s)}}))))},_appointElement:function(t,i){var s="vertical"==i.model.orientation&&t.hasClass("e-appointment")&&"day"!=this.currentView()?.85*t.closest("td").width():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",s+"px").appendTo(i.element):t.addClass("e-draggableAppointment e-scheduleAppGlassy").removeClass("e-schedulemouseclose e-tophandle e-bottomhandle").css("width",s+"px").appendTo(e(document.body))},_dragStart:function(i){var s,a,n,o,r,l;if(e(i.element[0]).hasClass("e-appointment")||e(i.element[0]).hasClass("e-monthappointment")||e(i.element[0]).hasClass("e-alldayappointment")){if(s=i.element,a=this._appointmentSettings,this._appUid=e(i.element[0]).attr("guid"),o=this._sortAppById(new t.DataManager(this._processed).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,this._appUid))),o.length>1?(r=e.extend(!0,[],o),r[0][a.endTime]=r[r.length-1][a.endTime],n=r[0]):n=o[0],l={target:s,appointment:n},this._trigger("actionBegin",{data:l,requestType:"appointmentDrag"})||this._trigger("dragStart",l))return i.cancel=!0,this._renderAppointmentAll(),!1}else i.cancel=!0;this.model.showQuickWindow&&this._quickAppointWindow.ejDialog("close")&&this._quickAppDetailsWindow.ejDialog("close")},_dragOver:function(t){var i=e(t.element),s={target:i};this.element.find(".e-scheduletooltip").hide(),this.element.find(".e-workcells").removeClass("e-selectedCell").removeClass("e-mousehover"),"month"!=this.currentView()&&!this._isCustomMonthView()&&(e(t.element[0]).hasClass("e-appointment")||"e-workcells"==t.target.classList[0])&&this._dragAppointmentCurrentTime(t),this._trigger("drag",s)},_dragStop:function(s){var a,n,o,r,l,d,h,c,u,m,p,g,_,f,b,v,x,w,y,C,S,T,D,I,k,P,L,R,M,O,E,A,j,N,z,F,B,H,V,U,W,G,Y,X,$,q,K,Q,Z,J,ee,te,ie;this.model.showQuickWindow&&this._quickAppDetailsWindow.ejDialog("close");var se=this,ae=this._appointmentSettings,ne=this.element.find(".e-draggableworkarea");if(this._appUid=s.element.attr("guid"),a=this._sortAppById(new t.DataManager(this._processed).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,this._appUid))),a.length>1&&!a[0][ae.recurrence])n=!0,Q=new t.DataManager(this._currentAppointmentData).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,this._appUid))[0];else if(n=!1,o=e.extend(!0,[],a),o[0][ae.endTime]=o[o.length-1][ae.endTime],Q=a[0][ae.recurrence]&&a[0][ae.recurrenceRule].toString().indexOf("RECUREDITID")==-1?this._getAppointmentByParentId(this._appUid):a[0][ae.recurrence]?a.length>1?o[0]:a[0]:this._getAppointmentByParentId(this._appUid),a.length>1)var n=(new t.DataManager(this._processed).executeLocal((new t.Query).where("AppTaskId",t.FilterOperators.equal,parseInt(s.element[0].id.split("_")[1])))[0],new t.DataManager(this._processed).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,this._appUid)),!0);if(r=e.extend(!0,{},Q),l=Math.ceil((r[ae.endTime]-r[ae.startTime])/36e5)<24&&r[ae.endTime].getDay()!=r[ae.startTime].getDay(),"vertical"==this.model.orientation)if(e(s.element[0]).hasClass("e-appointment"))d=this._dragNewStartTime,h=this._dragNewEndTime,c=this._dragNewStartTime,u=this._dragNewEndTime,"e-alldaycells"==s.target.classList[0]&&(m=!0),I=Math.round((e(s.element[0]).offset().left+ne.scrollLeft()-ne.offset().left)/this.element.find(".e-workcells").width());else if(e(s.element[0]).hasClass("e-alldayappointment"))if("e-workcells"==s.target.classList[0])I=s.target.cellIndex,c=this._dragNewStartTime,u=this._dragNewEndTime,m=!1;else{d=Q[ae.startTime],h=Q[ae.endTime],a[0][ae.recurrence]&&a[0][ae.recurrenceRule].toString().indexOf("RECUREDITID")==-1&&(d=a[0][ae.startTime],h=a[0][ae.endTime]),p=e(s.element[0]).offset().left+ne.scrollLeft()-this.element.find(".e-alldaycells").offset().left-1,p=this.model.enableRTL?Math.abs(p):p;var I=Math.round(p/(this.element.find(".e-alldaycells").width()+1)),oe=(Math.round(e(s.element[0]).width()/(this.element.find(".e-alldaycells").width()+1)),Math.ceil((h-d)/864e5)),re=(Math.round(e(s.element[0]).width()/(this.element.find(".e-alldaycells").width()+1)),"week"===this.currentView()?7:"workweek"===this.currentView()?this.model.workWeek.length:"customview"==this.currentView()?this._renderDays:1);d=new Date(this._dateRender[I]),h=new Date(this._dateRender[I]),h.setHours(Q[ae.endTime].getHours(),Q[ae.endTime].getMinutes(),Q[ae.endTime].getSeconds()),I<0?d<=new Date(this._dateRender[0])?(c=new Date(d),c.setDate(c.getDate()+I),c.setHours(new Date(Q[ae.startTime]).getHours(),new Date(Q[ae.startTime]).getMinutes()),c=new Date(c)):(g=new Date(this._dateRender[0]),g.setDate(g.getDate()+I),g.setHours(new Date(Q[ae.startTime]).getHours(),new Date(Q[ae.startTime]).getMinutes()),c=new Date(g)):dre-1?I%re:I,this._resWorkWeek?d=new Date(new Date(this._dateRender[I])):d.setDate(new Date(Q[se._appointmentSettings.startTime]).getDate()+_),d.setHours(new Date(Q[ae.startTime]).getHours(),new Date(Q[ae.startTime]).getMinutes()),c=new Date(d)):(_=I>re-1?I%re:I,c=new Date(new Date(this._dateRender[_])),c.setHours(new Date(Q[ae.startTime]).getHours(),new Date(Q[ae.startTime]).getMinutes())),f=new Date(c),f.setDate(f.getDate()+oe-1),f.setHours(new Date(Q[ae.endTime]).getHours(),new Date(Q[ae.endTime]).getMinutes()),u=new Date(f)}else e(s.element[0]).hasClass("e-monthappointment")&&(k=Q[ae.startTime],P=Q[ae.endTime],a[0][ae.recurrence]&&a[0][ae.recurrenceRule].toString().indexOf("RECUREDITID")==-1&&(k=a[0][ae.startTime],P=a[a.length-1][ae.endTime]),d=new Date(new Date(this.model.currentDate).getFullYear(),new Date(this.model.currentDate).getMonth(),1),b=d.getDay(),d.setDate(d.getDate()-b),"month"==this.currentView()||"customview"==this.currentView()&&!this._oneWeek?(I=parseInt((e(s.element[0]).offset().left+ne.scrollLeft()-ne.offset().left)/this.element.find(".e-monthcells").width()),I=this.model.enableRTL?6-I:I):(v=t.isNullOrUndefined(this.model.group)?this._dateRender.length:this._dateRender.length*this.res1.length,I=parseInt((e(s.element[0]).offset().left-ne.offset().left)/Math.round(ne.width()/v))),l&&parseInt(s.element.attr("id").split("_")[1])==a[a.length-1].AppTaskId&&(I-=1),x=parseInt((e(s.element[0]).offset().top+ne.scrollTop()-ne.offset().top)/this.element.find(".e-monthcells").outerHeight()),this.model.showOverflowButton||(x=this._findRowIndex(s)),w="month"==this.currentView()||this._isCustomMonthView()&&!this._oneWeek?7:this._dateRender.length,K=this.model.enableRTL?x*w+(I-Math.floor(I/w)*w)-(P.getDay()-k.getDay()):x*w+(I-Math.floor(I/w)*w),d=new Date(new Date(this._dateRender[K]).setHours(k.getHours(),k.getMinutes(),k.getSeconds())),Math.ceil((Q[ae.endTime]-Q[ae.startTime])/36e5)>24?(y=new t.DataManager(this._processed).executeLocal((new t.Query).where("AppTaskId",t.FilterOperators.equal,parseInt(s.element.attr("id").split("_")[1]))),C=new Date(y[0][ae.startTime])-new Date(a[0][ae.startTime]),c=new Date(d-C),L=d.getTime()-new Date(k).getTime()-new Date(C).getTime()):(c=new Date(d),L=d.getTime()-new Date(k).getTime()),h=new Date(new Date(P).getTime()+L),u=new Date(h));else if("horizontal"==this.model.orientation&&t.scheduleFeatures.horizontal){var c=this._dragNewStartTime,u=this._dragNewEndTime,d=this._dragNewStartTime,h=this._dragNewEndTime;S=this.model.enableRTL?document.elementFromPoint(e(s.element[0]).offset().left,e(s.element[0]).offset().top-1).cellIndex-Math.round(e(s.element[0]).width()/30-1):Math.round((e(s.element[0]).offset().left+ne.scrollLeft()-ne.offset().left)/this.element.find(".e-workcells").width()),T=parseInt((e(s.element[0]).offset().top+ne.scrollTop()-ne.offset().top)/this.element.find(".e-workcells").outerHeight()),this.model.showOverflowButton||(T=this._findRowIndex(s)),this.element.find(".e-resourceheadertable .e-resourceexpand").length>0&&(T+=e(this.element.find(".e-resourceheadertable").find("tr").filter(function(){return"none"!==e(this).css("display")})[T]).prevUntil("table.e-resourceheadertable").filter(function(){return"none"==e(this).css("display")}).length),D=e(this.element.find(".e-workcellstab tr")[T]).find("td")[S],e(D).hasClass("e-resourceheadercells")||t.isNullOrUndefined(D)||(this._cellIndex=this.model.enableRTL?this.element.find(".e-workcells").length-Math.round(e(s.element[0]).offset().left/this.element.find(".e-workcells").width()):Math.round((e(s.element[0]).offset().left+ne.scrollLeft()-ne.offset().left)/this.element.find(".e-workcells").width()),I=T,e(s.element[0]).hasClass("e-monthappointment")&&(k=new Date(Q[ae.startTime]),P=new Date(Q[ae.endTime]),a[0][ae.recurrence]&&a[0][ae.recurrenceRule].toString().indexOf("RECUREDITID")==-1?(k=a[0][ae.startTime],P=a[0][ae.endTime]):a[0][ae.recurrence]&&a[0][ae.recurrenceRule].toString().indexOf("RECUREDITID")>0&&(Q=a[0],k=a[0][ae.startTime],P=a[0][ae.endTime]),d=new Date(this.monthDays[this._cellIndex]),d.setHours(k.getHours(),k.getMinutes(),k.getSeconds()),c=new Date(d),L=d.getTime()-new Date(k).getTime(),h=new Date(new Date(P).getTime()+L),u=new Date(h)))}if(R=new Date(new Date(this.model.maxDate).getTime()).setHours(23,59,59),M=!this.model.showNextPrevMonth&&"vertical"==this.model.orientation&&"month"==this.currentView()&&new Date(new Date(this.currentDate()).getFullYear(),new Date(this.currentDate()).getMonth(),1).getTime()!=new Date(c.getFullYear(),c.getMonth(),1).getTime(),!M&&u>=new Date(this.model.minDate)&&u<=R)if(this._refreshCellsHeight(),O=!0,1==Q[ae.recurrence]&&Q[ae.recurrenceRule].indexOf("RECUREDITID")==-1){E=(new t.Query).where("Guid",t.FilterOperators.equal,this._appUid),A=this._sortAppById(new t.DataManager(this._processed).executeLocal(E)),n&&(j=e.extend(!0,[],A)),A.length>1&&(N=e.extend(!0,[],A),N[0][ae.endTime]=N[N.length-1][ae.endTime]),A=A.length>1?N[0]:A[0];var B=null==A[ae.recurrenceId]?A.ParentId:A[ae.recurrenceId],le=null==A[ae.recurrenceId]?"ParentId":ae.recurrenceId,q=new t.DataManager(this._processed).executeLocal((new t.Query).where(le,t.FilterOperators.equal,B));n&&(q=this._recurrenceAppSort(q)),q=this._appointmentRecurrenceSort(q),z={},e.extend(z,a[0]),this.model.enableRecurrenceValidation&&z[ae.recurrence]&&(K=this._recuCollectionIndex(q,A)),this.model.enableRecurrenceValidation&&z[ae.recurrence]&&!(0==K?!!t.isNullOrUndefined(q[K+1])||new Date(new Date(q[K+1][ae.startTime]).setHours(0,0,0,0)).getTime()>new Date(new Date(h).setHours(0,0,0,0)).getTime():K==q.length-1?new Date(new Date(q[K-1][ae.endTime]).setHours(0,0,0,0)).getTime()new Date(new Date(h).setHours(0,0,0,0)).getTime())?(z[ae.startTime]=A[ae.startTime],z[ae.endTime]=A[ae.endTime],this._alertDragResizeError(),O=!0):(X=e.extend(!0,[],A),z[ae.startTime]=c,z[ae.endTime]=u,!t.isNullOrUndefined(this.model.group)&&t.scheduleFeatures.resources&&(z=this._getDragDropResourceData(this,I,z)),t.isNullOrUndefined(m)||(z[ae.allDay]=m),this._trigger("dragStop",{appointment:z,event:s})?(z=e.extend(!0,[],X),O=!0):(O=!1,this._processed=this._sortAppById(this._processed),F=this.model.enableLoadOnDemand?this._dataCount:this._appMainId+1,this._appMainId=F,B=null==Q[ae.recurrenceId]?Q.ParentId:Q[ae.recurrenceId],this._deleteOcurrence(B,A[ae.startTime]),z[ae.recurrenceRule]=Q[ae.recurrenceRule]+";RECUREDITID="+z.ParentId,z[ae.recurrenceExDate]=Q[ae.recurrenceExDate],z.AppTaskId=F,z[ae.id]=z.AppTaskId));var de={data:z},Z=[],he=[];for(Z.push(this._timeZoneAppointments(de.data,"")),B=null==z[ae.recurrenceId]?Q.ParentId:z[ae.recurrenceId],H=new t.DataManager(this._currentAppointmentData).executeLocal((new t.Query).where("AppTaskId",t.FilterOperators.equal,B)),he.push(this._timeZoneAppointments(H[0],"")),this.dataSource()instanceof t.DataManager?O||(J=this._dataManager.saveChanges({added:Z,changed:he,deleted:[]},ae.id)):O||(J=this._dataManager.saveChanges({added:Z,changed:he,deleted:[]},"AppTaskId")),V=[],W=0;W1,n?Y?this._multipleSplit(de.data,de.data.AppTaskId,de.data[this._appointmentSettings.startTime],de.data[this._appointmentSettings.endTime]):G?this._processed.push(de.data):this._multipleDayApp(de.data,de.data.AppTaskId,de.data[this._appointmentSettings.startTime],de.data[this._appointmentSettings.endTime]):this._processed.push(de.data)}this._renderAppointmentAll(),this._trigger("actionComplete",{appointment:z,requestType:"appointmentDrag"})}}else{X={},$=n?new t.DataManager(this._currentAppointmentData).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,a[0].Guid)):new t.DataManager(this._processed).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,a[0].Guid));var X=e.extend(!0,[],$[0]),ce=$[0][ae.startTime],ue=$[0][ae.endTime],q=new t.DataManager(this._processed).executeLocal((new t.Query).where("ParentId",t.FilterOperators.equal,$[0].ParentId));if(n&&(q=this._recurrenceAppSort(q)),q=this._appointmentRecurrenceSort(q),$[0][ae.startTime]=c,$[0][ae.endTime]=u,this.model.enableRecurrenceValidation&&(K=this._recuCollectionIndex(q,$[0])),this.model.enableRecurrenceValidation&&$[0][ae.recurrence]&&!(0==K?!!t.isNullOrUndefined(q[K+1])||new Date(new Date(q[K+1][ae.startTime]).setHours(0,0,0,0)).getTime()>new Date(new Date(h).setHours(0,0,0,0)).getTime():K==q.length-1?new Date(new Date(q[K-1][ae.endTime]).setHours(0,0,0,0)).getTime()new Date(new Date(h).setHours(0,0,0,0)).getTime())?($[0][ae.startTime]=ce,$[0][ae.endTime]=ue,this._alertDragResizeError(),O=!0):(!t.isNullOrUndefined(this.model.group)&&t.scheduleFeatures.resources&&($[0]=this._getDragDropResourceData(this,I,$[0])),t.isNullOrUndefined(m)||($[0][ae.allDay]=m),this._trigger("dragStop",{appointment:$[0],event:s})?($[0]=e.extend(!0,[],X),O=!0):O=!1),""!=this.model.appointmentDragArea&&(Q=new t.DataManager(this._processed).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,this._appUid)),0==Q.length))return!1;Z=this._timeZoneAppointments($[0],""),this.dataSource()instanceof t.DataManager?O||(J=this._dataManager.update(ae.id,Z)):O||(J=this._dataManager.update("AppTaskId",Z)),ee=this._timeZoneAppointments(Z,"reverse"),n?new t.DataManager(this._currentAppointmentData).update("Guid",ee):new t.DataManager(this._currentAppointmentData).update("AppTaskId",ee),!t.isNullOrUndefined(J)&&J&&e.isFunction(J.promise)&&this.dataSource()instanceof t.DataManager?(J.done(function(e){se._processUrlBinding(e),se._trigger("actionComplete",{appointment:$[0],requestType:"appointmentDrag"})}),J.fail(function(){se._renderAppointmentAll()})):(te=new Date(new Date($[0][ae.startTime]).setHours(0,0,0,0)).getTime()0&&e(document.body).find(".e-scheduleAppGlassy").remove(),this.element.find("#cloneElement").length>0&&this.element.find("#cloneElement").remove()},_findRowIndex:function(t){var i=e(document.elementsFromPoint(e(t.element[0]).offset().left,e(t.element[0]).offset().top-1)),s="horizontal"==this.model.orientation?e.grep(i,function(t){if(e(t).hasClass("e-workcells"))return t}):e.grep(i,function(t){if(e(t).hasClass("e-monthcells"))return t});return rowIndex=e(s).parent().index()},_alertDragResizeError:function(){e("#"+this._id+"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._initDataSource("refresh");else{var s=t.isNullOrUndefined(i.record)?i:i.record;this._currentAppointmentData.length=0,this._dateFormat(s),this._bindAppointments=!0,this._currentAppointmentData=e.merge(this._currentAppointmentData,s),this._dataProcessing(s),this._renderAppointmentAll()}},_refreshCellsHeight:function(){return"agenda"!=this.currentView()&&("horizontal"!=this.model.orientation||this.model.showOverflowButton||(this._horizontalRender(),this._reRenderScroller()),void("vertical"!=this.model.orientation||this.model.showOverflowButton||"month"!=this.currentView()||(this._monthCellsRender(),this._reRenderScroller())))},_dragAppointmentCurrentTime:function(i){var s,a,n,o,r,l,d,h,c,u,m,p,g,_,f,b,v,x,w,y,C,S,T,D,I,k,P=this._sortAppById(new t.DataManager(this._processed).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,i.element.attr("guid")))),L=this.element.find(".e-draggableworkarea"),R=parseInt(this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount),M=this,O=M._appointmentSettings;if(P.length>1&&!P[0][O.recurrence])s=!0,n=new t.DataManager(this._currentAppointmentData).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,this._appUid))[0];else if(s=!1,a=e.extend(!0,[],P),a[0][O.endTime]=a[a.length-1][O.endTime],n=P[0][O.recurrence]&&P[0][O.recurrenceRule].toString().indexOf("RECUREDITID")==-1?this._getAppointmentByParentId(this._appUid):P[0][O.recurrence]?P.length>1?a[0]:P[0]:this._getAppointmentByParentId(this._appUid),P.length>1)var E=(new t.DataManager(this._processed).executeLocal((new t.Query).where("AppTaskId",t.FilterOperators.equal,parseInt(i.element[0].id.split("_")[1])))[0],new t.DataManager(this._processed).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,this._appUid))),s=!0;if("vertical"!=this.model.orientation||!e(i.element[0]).hasClass("e-appointment")&&"e-workcells"!=i.target.classList[0]){if("horizontal"==this.model.orientation&&e(i.element[0]).hasClass("e-appointment")&&(g=new Date(n[M._appointmentSettings.startTime]),_=new Date(n[M._appointmentSettings.endTime]),f=this.model.enableRTL?document.elementFromPoint(e(i.element[0]).offset().left,e(i.element[0]).offset().top-1).cellIndex-Math.round(e(i.element[0]).width()/30-1):Math.round((e(i.element[0]).offset().left+L.scrollLeft()-L.offset().left)/this.element.find(".e-workcells").width()),b=parseInt((e(i.element[0]).offset().top+L.scrollTop()-L.offset().top)/this.element.find(".e-workcells").outerHeight()),this.model.showOverflowButton||(b=this._findRowIndex(i)),this.element.find(".e-resourceheadertable .e-resourceexpand").length>0&&(b+=e(this.element.find(".e-resourceheadertable").find("tr").filter(function(){return"none"!==e(this).css("display")})[b]).prevUntil("table.e-resourceheadertable").filter(function(){return"none"==e(this).css("display")}).length),v=e(this.element.find(".e-workcellstab tr")[b]).find("td")[f],!e(v).hasClass("e-resourceheadercells")&&!t.isNullOrUndefined(v))){x=new Date(this._dateRender[0]),p=this.model.enableRTL?30*f:(e(i.element[0]).offset().left+L.scrollLeft()-L.offset().left)*(this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount)/e(this.element.find(".e-workcells")[1]).outerWidth(),w=this.model.startHour+f*(this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount)/60,y=parseInt(f/((this.model.endHour-this.model.startHour)*this.model.timeScale.minorSlotCount*(60/this.model.timeScale.majorSlot))),w=w>=this.model.endHour?Math.round(p/60)+y*(24-this.model.endHour+this.model.startHour):Math.round(p/60),x.setHours(parseInt(M.model.startHour)+w),x.setMinutes(parseInt(p%60)),x=new Date(x).getMinutes()>=30?new Date(new Date(x).setHours(new Date(x).getHours()-1)):new Date(x),R>=10?x.setMinutes(10*Math.round(x.getMinutes()/10)):x.setMinutes(1*x.getMinutes()),g=new Date(x);var A=n[M._appointmentSettings.startTime],j=n[M._appointmentSettings.endTime],N=(j-A)/1e3,S=Math.floor(N/3600),z=parseInt(i.element.width()/this.element.find(".e-workcells").width())/this.model.timeScale.minorSlotCount*(60/this.model.timeScale.majorSlot);"workweek"==this.currentView()&&5!=this.model.workWeek&&new Date(n.StartTime).getDay()!=new Date(n.EndTime).getDay()&&(C=new Date(n.EndTime).getDay()-new Date(n.StartTime).getDay(),S-=(C-1)*(this.model.endHour-this.model.startHour)),T=Math.floor(N%3600/60),F=M._getNewEndTime(x,z,T),new Date(n.StartTime).getDay()==new Date(n.EndTime).getDay()&&"workweek"==this.currentView()&&5!=this.model.workWeek.length&&(totalhrs=x.getHours()+S,totalhrs>24&&(D=e.inArray(new Date(x.getFullYear(),x.getMonth(),x.getDate()).getTime(),this._dateRender)+1,F.setDate(new Date(this._dateRender[D]).getDate()))),I=parseInt(f)+parseInt(e(i.element[0]).width()/this.element.find(".e-workcells").width())-1,I=parseInt(I/((this.model.endHour-this.model.startHour)*this.model.timeScale.minorSlotCount*(60/this.model.timeScale.majorSlot))),k=new Date(F).getHours()>=this.model.endHour?parseInt(parseInt((new Date(F)-new Date(new Date(new Date(x).setHours(0,0,0,0)).setHours(this.model.endHour)))/36e5)/(this.model.endHour-this.model.startHour))+1:0,w=new Date(F).getHours()>=this.model.endHour?new Date(new Date(F).setHours(new Date(F).getHours()+k*(24-this.model.endHour+this.model.startHour))):F,this.model.endHour-this.model.startHour!=24&&new Date(new Date(w).setHours(0,0,0,0)).getTime()!=new Date(this._dateRender[I]).getTime()&&(w=new Date(this._dateRender[I]).setHours(new Date(w).getHours(),new Date(w).getMinutes(),new Date(w).getSeconds(),new Date(w).getMilliseconds())),_=new Date(w),this._cellIndex=this.model.enableRTL?this.element.find(".e-workcells").length-Math.round(e(i.element[0]).offset().left/this.element.find(".e-workcells").width()):Math.round((e(i.element[0]).offset().left+L.scrollLeft()-L.offset().left)/this.element.find(".e-workcells").width())}}else{var x,F,g,_,B=L.height()+L.scrollTop(),H=i.element[0].offsetHeight,V=this.element.find(".e-workcells").height(),U=e(i.element[0]).offset().top-L.offset().top+L.scrollTop(),W=U-V/(60/(this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount))0?60*W/(2*(V+1)):30/(V+1),x.setHours(parseInt(this.model.startHour)+Math.round(o/60)),x.setMinutes(parseInt(o%60)),x=new Date(x).getMinutes()>=30?new Date(new Date(x).setHours(new Date(x).getHours()-1)):new Date(x),x.setMinutes(10*Math.round(x.getMinutes()/10)),g=new Date(x),F=new Date(x).setMinutes(x.getMinutes()+30),_=new Date(F);else if((W>0||!this.model.showAllDayRow)&&"e-alldaycells"!=i.target.classList[0]){o=W>0?60*W/(60/(this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount)*(V+1)):60/(60/(this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount)*(V+1));var s=new Date(new Date(n[M._appointmentSettings.startTime]).setHours(0,0,0,0)).getTime()=30?new Date(new Date(x).setHours(new Date(x).getHours()-1)):new Date(x),R>=10?x.setMinutes(10*Math.round(x.getMinutes()/10)):x.setMinutes(1*x.getMinutes()),g=new Date(x),h=60*n[M._appointmentSettings.endTime].getHours()+n[M._appointmentSettings.endTime].getMinutes()-(60*n[M._appointmentSettings.startTime].getHours()+n[M._appointmentSettings.startTime].getMinutes()),F.setHours(new Date(x).getHours()+parseInt(h/60)),F.setMinutes(new Date(x).getMinutes()+parseInt(h%60)),R>=10?F.setMinutes(10*Math.round(F.getMinutes()/10)):F.setMinutes(1*F.getMinutes()),_=new Date(F)}}else c=L.width(),u="week"===M.currentView()?7:"workweek"===M.currentView()?this.model.workWeek.length:"customview"==M.currentView()?M._renderDays:1,u=t.isNullOrUndefined(M.model.group)?u:u*M.res1.length,m=Math.round((e(i.element[0]).offset().left+L.scrollLeft()-L.offset().left)/this.element.find(".e-workcells").width()),x=this.model.enableRTL?new Date(this.dateRender[u-m-1]):new Date(this.dateRender[m]),x.setHours(0),x.setMinutes(0),g=new Date(x),F=x,F.setHours(23),F.setMinutes(59),_=new Date(F)}i.element.find(".e-apptime").html(t.format(g,this._pattern.t)+" - "+t.format(_,this._pattern.t)).insertBefore(i.element.find(".e-apptext")).css("font-size","12px").css("white-space","normal"),this._dragNewStartTime=g,this._dragNewEndTime=_},_unWireDragDrop:function(){var e=this.element.find("div.e-appointment,div.e-alldayappointment,div.e-monthappointment");e.ejDraggable("destroy")},_getAppointmentByParentId:function(i){var s=this._currentAppointmentData,a=new t.DataManager(this._processed).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,i)),n=new t.DataManager(s).executeLocal((new t.Query).where("AppTaskId",t.FilterOperators.equal,parseInt(a[0].ParentId)));return e.isEmptyObject(n)?n:n[0]},_renderAppointmentAll:function(){var i,s;return 0!=this.element.children().length&&("agenda"==this.currentView()?this._renderAgendaContent():(t.preferredCulture(this.model.locale),this.element.find("div.e-appointment,div.e-alldayappointment,div.e-monthappointment,.e-appsoverflow").remove(),this.element.find("div.e-categorybar").remove(),"month"!=this.currentView()&&!this._isCustomMonthView()&&this.model.timeScale.enable?(this._renderAppointments(),this.model.showAppointmentNavigator&&("vertical"==this.model.orientation&&this.element.find(".e-vscroll").length>0&&!this._mediaQuery&&this._renderUpDownIconPosition(),this._nextPrevButton(this._filtered))):this._renderMonthAppointment(),this._wireResizeEvents(),this._dragdropAppointments(),this.model.showOverflowButton||"horizontal"!=this.model.orientation||(i=this.element.find(".e-draggableworkarea").offset().top-this.element.find(".e-workcellstab").offset().top,this.element.find(".e-horires").css("top",-i+"px"))),void(s=e.map(this._processed,function(e){null!=e.Index&&delete e.Index})))},_getNewEndTime:function(e,t,i){var s=new Date(e);return s.setHours(s.getHours()+t),s.setMinutes(s.getMinutes()+i),s},_getNewStartTime:function(e,t){return t.setHours(t.getHours()+parseInt(this.model.startHour)+parseInt(e/60)),t.setMinutes(t.getMinutes()+parseInt(e%60)),t.setMinutes(10*Math.round(t.getMinutes()/10)),t},_createTemplate:function(t,i){var s=document.createElement("script");return s.id=this._id+i+"_Template",s.type="text/x-jsrender",s.text=t,e("body").append(s),s},_documentOnKeyDown:function(e){if(this.model.allowKeyboardNavigation){var t=e.target||document.activeElement||e.srcElement;27==e.which?this._processEscapeKey():13==e.which?this._processEnterKey(t):0==e.shiftKey&&9==e.which&&this._processWindowTab(t)}},_processWindowTab:function(t){e(t).hasClass("qAppDone")?this._quickAppointWindow.find(".subject").focus():e(t).hasClass("e-appointcancel")||e(t).hasClass("e-cancelrecur")?this._appointmentAddWindow.find(".subject").focus():e(t).hasClass("e-editseries")&&this.model.showQuickWindow&&this._quickAppDetailsWindow.focus()},_onKeyDown:function(t){var i,s,a,n,o,r,l;if(this.model.allowKeyboardNavigation){if(this.model.showQuickWindow&&this._quickAppointWindow.ejDialog("close")&&this._quickAppDetailsWindow.ejDialog("close"),i=this.element.find("div.e-draggableworkarea tr"),s=t.target||document.activeElement||t.srcElement,e(s).hasClass("e-alldaycells")&&(i=this.element.find(".e-alldaycells").parent()),this._trigger("keyDown",{event:t}))return!1;if(e(s).hasClass("e-workcells")||e(s).hasClass("e-alldaycells")||e(s).hasClass("e-monthcells"))this._getDateByElement(e(s)),a=this.curDate,39==t.which&&a.setDate(a.getDate()+1),37==t.which&&a.setDate(a.getDate()-1),a>=this.model.minDate&&a<=this.model.maxDate&&(this.element.find("#"+this._id+"_navigator").ejDatePicker("hide"),(e(s).hasClass("e-workcells")||e(s).hasClass("e-alldaycells")||e(s).hasClass("e-monthcells"))&&e(s).addClass("e-selectedCell"),0==t.shiftKey&&38==t.which?(this._stopDefaultAction(t),this._processUpArrow(s,i)):0==t.shiftKey&&40==t.which?(this._stopDefaultAction(t),this._processDown(s,i)):0==t.ctrlKey&&0==t.shiftKey&&39==t.which?(this._stopDefaultAction(t),this._processRight(s,i)):0==t.ctrlKey&&0==t.shiftKey&&37==t.which?(this._stopDefaultAction(t),this._processLeft(s,i)):1==t.shiftKey&&38==t.which?(this._stopDefaultAction(t),this._processShiftUp(s,t,i)):1==t.shiftKey&&40==t.which?(this._stopDefaultAction(t),this._processShiftDown(s,t,i)):1==t.shiftKey&&37==t.which?(this._stopDefaultAction(t),this._processShiftLeft(s,t,i)):1==t.shiftKey&&39==t.which&&(this._stopDefaultAction(t),this._processShiftRight(s,t,i)));else if("agenda"==this.currentView()&&e(s).hasClass("e-agendacells")&&(this._stopDefaultAction(t),38==t.which||40==t.which)){this.element.find(".e-selectedAppointment").removeClass("e-selectedAppointment");var d=i.length-1,h=this.element.find(".e-selectedCell").parent().index(),c=38==t.which?parseInt(h)-1:parseInt(h)+1;c>=0&&c<=d&&"undefined"!=h&&(e(i).find(".e-eventcolumn,.e-timecolumn").removeClass("e-selectedCell"),e(i[c]).find(".e-eventcolumn,.e-timecolumn").addClass("e-selectedCell").attr("tabIndex",0).focus())}1==t.altKey&&67==t.which?(this._stopDefaultAction(t),this.element.find(".e-datedisplay").click()):1==t.ctrlKey&&37==t.which?(this._stopDefaultAction(t),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())})):1==t.ctrlKey&&39==t.which?(this._stopDefaultAction(t),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())})):1==t.altKey&&107==t.which||1==t.altKey&&187==t.which||1==t.altKey&&61==t.which?(this._stopDefaultAction(t),this._navigateToolbarRight(t)):1==t.altKey&&189==t.which||1==t.altKey&&109==t.which||1==t.altKey&&45==t.which||1==t.altKey&&173==t.which?(this._stopDefaultAction(t),this._navigateToolbarLeft(t)):1==t.ctrlKey&&67==t.which?(this._stopDefaultAction(t),this._cancel()):32==t.which?e(document.activeElement)[0]===this.element.find("div.e-navigateprevious")[0]?(this._stopDefaultAction(t),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())})):e(document.activeElement)[0]===this.element.find("div.e-navigatenext")[0]&&(this._stopDefaultAction(t),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())})):1==t.altKey&&78==t.which?(this._stopDefaultAction(t),"agenda"!=this.currentView()&&this._newAppWindow(s,i),this.element.find("#"+this._id+"_navigator").ejDatePicker("hide")):1==t.ctrlKey&&69==t.which?(this._stopDefaultAction(t),n=this.element.find(".e-selectedAppointment"),"agenda"==this.currentView()&&this.element.find(".e-selectedCell").length>0&&(r=this.element.find(".e-selectedCell").parent().find(".e-agendaappointment"),r.hasClass("e-agendaappointment")&&(n=r)),n.length>0&&(this._editKey=!0,this._cellClick=!1,this._appointmentWindow(n),this.element.find("#"+this._id+"_navigator").ejDatePicker("hide"))):46==t.which?(this._stopDefaultAction(t),o=this.element.find(".e-selectedAppointment"),"agenda"==this.currentView()&&this.element.find(".e-selectedCell").length>0&&(r=this.element.find(".e-selectedCell").parent().find(".e-agendaappointment"),r.hasClass("e-agendaappointment")&&(o=r)),o.length>0&&(this._appUid=o.attr("guid"),this._deleteAppoint())):1==t.shiftKey&&9==t.which?(this._stopDefaultAction(t),this._reverseTab(s,t,i),this.element.find("#"+this._id+"_navigator").ejDatePicker("hide")):0==t.shiftKey&&9==t.which&&(this._stopDefaultAction(t),this._processTab(s,t,i),this.element.find("#"+this._id+"_navigator").ejDatePicker("hide")),l=this,"agenda"!=this.currentView()&&this._moveScrollContent(s,l)}},_processShiftUp:function(t,i,s){var a,n,o;if("horizontal"==this.model.orientation)return!1;if(e(t).hasClass("e-workcells")){var r=s.length-1,l=e(t).parent()[0].rowIndex,d=e(t)[0].cellIndex;l>0&&l<=r&&"undefined"!=l?(a=parseInt(l)-1,a>=0&&(e(s[a].cells[d]).hasClass("e-selectedCell")?(e(s[a].cells[d]).attr("tabIndex",0).focus(),e(s[l].cells[d]).removeClass("e-selectedCell")):(e(s[l].cells[d]).addClass("e-selectedCell"),e(s[a].cells[d]).addClass("e-selectedCell").attr("tabIndex",0).focus())),this._currentRowIndex=a,this._currentColIndex=d):(e(s[l].cells[d]).attr("tabIndex",0).focus(),this._currentRowIndex=l,this._currentColIndex=d)}else{if(!e(t).hasClass("e-monthcells"))return!1;var h=Math.floor(e(t).index()/7),r=s.length-1,c=7*(h+1),u=7*parseInt(h),l=e(t).parent()[0].rowIndex,d=e(t)[0].cellIndex;if(!(l>0&&l<=r&&"undefined"!=l))return!1;if(a=parseInt(l)-1,a>=0)if(e(s[a].cells[d]).hasClass("e-selectedCell")){for(n=d;n>=u;n--)e(s[l].cells[n]).attr("tabIndex",0).focus(),e(s[l].cells[n]).removeClass("e-selectedCell");for(o=c-1;o>=d;o--)a>=0&&(e(s[a].cells[o]).attr("tabIndex",0).focus(),e(s[a].cells[o]).removeClass("e-selectedCell"));e(s[a].cells[d]).hasClass("e-othermonths")||e(s[a].cells[d]).addClass("e-selectedCell").attr("tabIndex",0).focus()}else{for(n=d;n>=u;n--)e(s[l].cells[n]).addClass("e-selectedCell").attr("tabIndex",0).focus();for(o=c-1;o>=d;o--)a>=0&&(e(s[a].cells[o]).hasClass("e-othermonths")||e(s[a].cells[o]).addClass("e-selectedCell").attr("tabIndex",0).focus())}else e(s[a+1].cells[d]).attr("tabIndex",0).focus()}},_processShiftDown:function(t,i,s){var a,n,o;if("horizontal"==this.model.orientation)return!1;if(e(t).hasClass("e-workcells")){var r=s.length-1,l=e(t).parent()[0].rowIndex,d=e(t)[0].cellIndex;l>=0&&l<=r&&"undefined"!=l&&(e(s[l].cells[d]).addClass("e-selectedCell").attr("tabIndex",0).focus(),a=parseInt(l)+1,a<=r?(e(s[a].cells[d]).hasClass("e-selectedCell")?(e(s[a].cells[d]).attr("tabIndex",0).focus(),e(s[l].cells[d]).removeClass("e-selectedCell")):(e(s[l].cells[d]).addClass("e-selectedCell"),e(s[a].cells[d]).addClass("e-selectedCell").attr("tabIndex",0).focus()),this._currentRowIndex=a,this._currentColIndex=d):(e(s[l].cells[d]).attr("tabIndex",0).focus(),this._currentRowIndex=l,this._currentColIndex=d))}else{if(!e(t).hasClass("e-monthcells"))return!1;var h=Math.floor(e(t).index()/7),r=s.length-1,c=7*(h+1),u=7*parseInt(h),l=e(t).parent()[0].rowIndex,d=e(t)[0].cellIndex;if(!(l>=0&&l<=r&&"undefined"!=l))return!1;if(a=parseInt(l)+1,a0&&_>parseInt(m)-1&&"undefined"!=p){if(e(s[g].cells[_]).hasClass("e-selectedCell")){for(a=f;a<=parseInt(g);a++)e(s[a].cells[p]).removeClass("e-selectedCell");for(n=b;n>=parseInt(g);n--)e(s[n].cells[_]).removeClass("e-selectedCell");v&&e(x[0].cells[p]).removeClass("e-selectedCell").attr("tabIndex",0).focus(),e(s[g].cells[_]).addClass("e-selectedCell").attr("tabIndex",0).focus()}else{for(a=f;a<=parseInt(g);a++)e(s[a].cells[p]).addClass("e-selectedCell");for(n=b;n>=parseInt(g);n--)e(s[n].cells[_]).addClass("e-selectedCell");v&&(e(x[0].cells[p]).addClass("e-selectedCell").attr("tabIndex",0).focus(),e(x[0].cells[_]).addClass("e-selectedCell").attr("tabIndex",0).focus()),e(s[g].cells[_]).attr("tabIndex",0).focus()}this._currentRowIndex=g,this._currentColIndex=_}else e(s[g].cells[_+1]).attr("tabIndex",0).focus(),this._currentRowIndex=g,this._currentColIndex=_+1}else if(e(t).hasClass("e-monthcells")){var u=Math.floor(e(t).index()/7),l=s.length-1,w=7*(parseInt(u)+1),y=7*parseInt(u),C=e(t).parent()[0].rowIndex,S=e(t)[0].cellIndex;if(!(S>=y&&S<=w&&"undefined"!=S))return!1;newcur=parseInt(S)-1,e(s[C].cells[newcur]).hasClass("e-selectedCell")?S==y&&C>=1?(o=parseInt(C)-1,r=parseInt(w)-1,o>=0&&(e(s[o].cells[r]).attr("tabIndex",0).focus(),e(s[o].cells[S]).removeClass("e-selectedCell"),e(s[C].cells[y]).removeClass("e-selectedClass"))):S=0?(o=parseInt(C)-1,r=parseInt(w)-1,o>=0?e(s[o].cells[r]).hasClass("e-othermonths")||e(s[o].cells[r]).addClass("e-selectedCell").attr("tabIndex",0).focus():e(s[o+1].cells[S]).attr("tabIndex",0).focus()):S0&&_>parseInt(m)-1&&"undefined"!=p?(e(s[0].cells[_]).hasClass("e-selectedCell")?(e(s[0].cells[p]).removeClass("e-selectedCell"),e(s[0].cells[_]).addClass("e-selectedCell").attr("tabIndex",0).focus()):e(s[0].cells[_]).addClass("e-selectedCell").attr("tabIndex",0).focus(),this._currentRowIndex=0,this._currentColIndex=_):(e(s[0].cells[_+1]).attr("tabIndex",0).focus(),this._currentRowIndex=0,this._currentColIndex=_+1)}},_processShiftRight:function(t,i,s){var a,n,o;if(e(t).hasClass("e-workcells")){var r=s.length-1,l="day"==this.currentView()?1:"workweek"==this.currentView()?this.model.workWeek.length:7,d="vertical"==this.model.orientation?l:"month"==this.currentView()?this.totdays.length:l*(this.model.endHour-this.model.startHour)*this.model.timeScale.minorSlotCount*(60/this.model.timeScale.majorSlot),h=Math.floor(e(t).index()/d),c=d*(h+1),u=e(t).parent()[0].rowIndex,m=e(t)[0].cellIndex,p=parseInt(m)+1,g="vertical"==this.model.orientation?0:u,_="vertical"==this.model.orientation?r:u,f=this.element.find(".e-alldaycells").parent(),b=!("vertical"!=this.model.orientation||!this.model.showAllDayRow);if(m>=0&&m=0&&m<=parseInt(c)-1&&"undefined"!=m))return!1;e(s[u].cells[p]).hasClass("e-selectedCell")?(p=0&&mu)i=i;else if(i!=u&&(i=u,"month"!=l))for(n=parseInt(i),c=0;c<=r;c++)e(o[c].cells[n]).hasClass("e-selectedCell")&&(a=c)}}),{rowInx:s,maxrowInx:a,omincolIndex:t,omaxcolIndex:i}},_multipleCellAppointCreation:function(i){var s=e(t.isNullOrUndefined(i.target)?i:i.target);if(this._multiple=!0,this._slotByCellSelect(s),this.model.showQuickWindow&&"beforeOpen"!==i.type){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")+" "+new Date(this.cur_StartTime).getDate()+", "+t.format(new Date(this.cur_StartTime),"12"==this._timeMode?this._pattern.t:"HH:mm")+" - "+t.format(new Date(this.cur_EndTime),"12"==this._timeMode?this._pattern.t:"HH:mm")):this._quickAppointWindow.find(".e-quickstartend").html(this._dayFullNames[new Date(this.cur_StartTime).getDay()]+", "+t.format(new Date(this.cur_StartTime),"MMMM")+" "+new Date(this.cur_StartTime).getDate()+", "+t.format(new Date(this.cur_StartTime),"12"==this._timeMode?this._pattern.t:"HH:mm")+" - "+this._dayFullNames[new Date(this.cur_EndTime).getDay()]+", "+t.format(new Date(this.cur_EndTime),"MMMM")+" "+new Date(this.cur_EndTime).getDate()+", "+t.format(new Date(this.cur_EndTime),"12"==this._timeMode?this._pattern.t:"HH:mm")),this._quickAppointWindow.find(".subject").val(""),this.model.readOnly||this._quickAppointWindow.ejDialog("open");var a=e(s).offset().left-(this._quickAppointWindow.width()-e(s).width())/2+10,n=e(s).offset().top-this._quickAppointWindow.height()-10,o=this._quickWindowPosition(a,n,e(s),this._quickAppointWindow);this._quickAppointWindow.ejDialog({position:{X:o.X,Y:o.Y}}),this._quickAppointWindow.find(".subject").focus(),t.scheduleFeatures.resources&&!t.isNullOrUndefined(this.model.resources)&&this._getResourceDetails(e(s))}this._cellClick=!0},_slotByCellSelect:function(t){var i,s,a,n;this._cellIndex=e(t).hasClass("e-workcells")?e(t).index():e(t).hasClass("e-alldaycells")?e(t).index():7-(7*(parseInt(e(t).index()/7)+1)-e(t).index())+7*e(t).parent().index(),"horizontal"==this.model.orientation&&(this._cellIndex="month"!==this.currentView()?Math.floor(this._cellIndex/((this.model.endHour-this.model.startHour)*this.model.timeScale.minorSlotCount)):this._cellIndex,this._workCellIndex=e(t).parent().index());var o=this._findMinMaxCellIndex(),r="horizontal"==this.model.orientation&&"month"==this.currentView()?this.monthDays:"vertical"==this.model.orientation?this.dateRender:this._dateRender,l=o.omincolIndex,d=o.omaxcolIndex,h=o.rowInx,c=o.maxrowInx,a=r[l],n=r[d];if("vertical"==this.model.orientation)if(e(t).hasClass("e-workcells"))this._min=this.model.timeScale.majorSlot/this.model.timeScale.minorSlotCount, i=this.model.startHour+h*this._min*6e4,s=(this.model.endHour-this.model.startHour)*this.model.timeScale.minorSlotCount*(60/this.model.timeScale.majorSlot)-1==c?(this.model.startHour*this.model.timeScale.minorSlotCount+(c+1))*this._min*6e4-1:(this.model.startHour*this.model.timeScale.minorSlotCount+(c+1))*this._min*6e4,this.cur_StartTime=new Date(new Date(a).setMilliseconds(i)),this.cur_EndTime=new Date(new Date(n).setMilliseconds(s));else if(e(t).hasClass("e-monthcells")){var u=this.element.find("td.e-selectedCell"),m=u.length-1,p=7*e(u[0]).parent().index()+(e(u[0]).index()-7*Math.floor(e(u[0]).index()/7)),g=7*e(u[m]).parent().index()+(e(u[m]).index()-7*Math.floor(e(u[m]).index()/7)),_=new Date(this._dateRender[p]),f=new Date(this._dateRender[g]);this.cur_StartTime=new Date(_.setHours(0,0,0)),this.cur_EndTime=new Date(f.setHours(23,59,59))}else e(t).hasClass("e-alldaycells")&&(this.cur_StartTime=new Date(a),this.cur_EndTime=new Date(new Date(n).setHours(23,59,59)));else if("month"!=this.currentView()&&!this._isCustomMonthView()&&this.model.timeScale.enable){var a=r[parseInt(l/((this.model.endHour-this.model.startHour)*this.model.timeScale.minorSlotCount*(60/this.model.timeScale.majorSlot)))],n=r[parseInt(d/((this.model.endHour-this.model.startHour)*this.model.timeScale.minorSlotCount*(60/this.model.timeScale.majorSlot)))],b=l%((this.model.endHour-this.model.startHour)*this.model.timeScale.minorSlotCount*(60/this.model.timeScale.majorSlot)),i=this.model.startHour+b/(this.model.timeScale.minorSlotCount*(60/this.model.timeScale.majorSlot)),v=d%((this.model.endHour-this.model.startHour)*this.model.timeScale.minorSlotCount*(60/this.model.timeScale.majorSlot)),s=this.model.startHour+v/(this.model.timeScale.minorSlotCount*(60/this.model.timeScale.majorSlot));this.cur_StartTime=new Date(a).setMinutes(60*i),this.cur_EndTime=new Date(n).setMinutes(60*s),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 a=this.totdays[l],n=this.totdays[d],this.cur_StartTime=new Date(a),this.cur_EndTime=new Date(new Date(n).setHours(23,59,59))},_addCellSelection:function(t){var i=this.element.find("td.e-selectedCell"),s=i.length-1;s>0&&(this.element.find("td.e-selectedCell").removeClass("e-selectedCell"),e(t[this._currentRowIndex].cells[this._currentColIndex]).addClass("e-selectedCell").attr("tabIndex",0).focus())},_processUpArrow:function(t,i){var s,a,n;if(e(t).hasClass("e-selectedAppointment")?(this.element.find(".e-selectedAppointment").removeClass("e-selectedAppointment"),e(i[0].cells[0]).addClass("e-selectedCell").attr("tabIndex",0).focus()):e(t).hasClass("e-selectedCell")&&this._addCellSelection(i),s=this.element.find(".e-alldaycells"),e(t).hasClass("e-workcells")){var o=i.length-1,a=this.element.find("td.e-selectedCell").parent()[0].rowIndex,n=this.element.find("td.e-selectedCell")[0].cellIndex,r=parseInt(a)-1;if(a>0&&a<=o&&"undefined"!=a){if(e(i[a-1].cells[n]).hasClass("e-resourceheadercells"))return!1;e(i[a].cells[n]).removeClass("e-selectedCell").blur(),e(i[r].cells[n]).addClass("e-selectedCell").attr("tabIndex",0).focus()}else 0==a&&("vertical"==this.model.orientation?(a=this.element.find("td.e-selectedCell").parent()[0].rowIndex,n=this.element.find("td.e-selectedCell")[0].cellIndex,e(i[a].cells[n]).removeClass("e-selectedCell").blur(),e(this.element).attr("tabIndex",0).focus(),e(s[n]).addClass("e-selectedCell").attr("tabIndex",0).focus()):e(i[0].cells[n]).addClass("e-selectedCell").attr("tabIndex",0).focus())}else{if(e(t).hasClass("e-alldaycells"))return!1;if(!e(t).hasClass("e-monthcells"))return!1;var o=i.length-1,a=this.element.find("td.e-selectedCell").parent()[0].rowIndex,n=this.element.find("td.e-selectedCell")[0].cellIndex,r=parseInt(a)-1;if(!(a>=0&&a<=o&&"undefined"!=a))return!1;r>=0?(e(i[a].cells[n]).removeClass("e-selectedCell").blur(),e(i[r].cells[n]).addClass("e-selectedCell").attr("tabIndex",0).focus()):e(i[0].cells[n]).addClass("e-selectedCell").attr("tabIndex",0).focus(),this._selectCurrentMonth(i,a,n)}},_processDown:function(t,i){var s,a;if(e(t).hasClass("e-selectedAppointment")?(this.element.find(".e-selectedAppointment").removeClass("e-selectedAppointment"),e(i[0].cells[0]).addClass("e-selectedCell").attr("tabIndex",0).focus()):e(t).hasClass("e-selectedCell")&&this._addCellSelection(i),e(t).hasClass("e-workcells")){var n=i.length-1,o=this.element.find("td.e-selectedCell").parent()[0].rowIndex,r=this.element.find("td.e-selectedCell")[0].cellIndex,l=parseInt(o)+1;if(o>=0&&o<=n&&"undefined"!=o)if(l<=n){if(e(i[o+1].cells[r]).hasClass("e-resourceheadercells"))return!1;e(i[o].cells[r]).removeClass("e-selectedCell").blur(),e(i[l].cells[r]).addClass("e-selectedCell").attr("tabIndex",0).focus()}else e(i[o].cells[r]).attr("tabIndex",0).focus()}else if(e(t).hasClass("e-alldaycells"))s=this.element.find("td.e-selectedCell")[0].cellIndex,a=this.element.find(".e-alldaycells"),e(a[s]).removeClass("e-selectedCell").blur(),e(this.element.find(".e-workcells")[s]).addClass("e-selectedCell").attr("tabIndex",0).focus();else{if(!e(t).hasClass("e-monthcells"))return!1;var n=i.length-1,o=this.element.find("td.e-selectedCell").parent()[0].rowIndex,r=this.element.find("td.e-selectedCell")[0].cellIndex,l=parseInt(o)+1;o>=0&&o=0&&u=0&&l0&&o<=parseInt(p)-1&&"undefined"!=o)e(s[n].cells[o]).removeClass("e-selectedCell").blur(),e(s[n].cells[g]).addClass("e-selectedCell").attr("tabIndex",0).focus();else{if(0!=o)return!1;"month"!=this.currentView()?(a=e(i).parent()[0].rowIndex,this.element.find("div.e-navigateprevious").click(),e(s[a].cells[p-1]).addClass("e-selectedCell").attr("tabIndex",0).focus()):(this.element.find("div.e-navigateprevious").click(),e(this.element.find("div.e-draggableworkarea tr")[n].cells[this.totdays.length-1]).addClass("e-selectedCell").attr("tabIndex",0).focus())}}else if(e(i).hasClass("e-monthcells")){var _=Math.floor(e(i).index()/7),f=(s.length-1,7*(parseInt(_)+1)),b=7*parseInt(_),v="day"==this.currentView()?1:"workweek"==this.currentView()?this.model.workWeek.length:7,x="vertical"==this.model.orientation?v:"month"==this.currentView()?this.totdays.length:v*(this.model.endHour-this.model.startHour)*2;p=t.isNullOrUndefined(this.model.resources)||t.isNullOrUndefined(this.model.group)||!t.scheduleFeatures.resources||"vertical"!=this.model.orientation?x:this.render_Resources[this.render_Resources.length-1].length*x,n=this.element.find("td.e-selectedCell").parent()[0].rowIndex,o=this.element.find("td.e-selectedCell")[0].cellIndex,o==b&&n>=0?(r=parseInt(n)-1,l=parseInt(f)-1,r>=0?(e(s[n].cells[o]).removeClass("e-selectedCell").blur(),e(s[r].cells[l]).addClass("e-selectedCell").attr("tabIndex",0).focus()):(d=o/7,this.element.find("div.e-navigateprevious").click(),h=this._dateRender.length/7,c=t.isNullOrUndefined(this.model.group)?0:7*d,e(this.element.find("div.e-draggableworkarea tr")[h-1].cells[c+6]).addClass("e-selectedCell").attr("tabIndex",0).focus())):o0&&u<=m)e(this.element.find(".e-alldaycells")[u]).removeClass("e-selectedCell").blur(),e(this.element.find(".e-alldaycells")[parseInt(u)-1]).addClass("e-selectedCell").attr("tabIndex",0).focus();else{if(0!=u)return!1;this.element.find("div.e-navigateprevious").click(),e(this.element.find(".e-alldaycells")[m]).addClass("e-selectedCell").attr("tabIndex",0).focus()}this._keyPressed=!0},_selectCurrentMonth:function(t,i,s){t.find(".e-selectedCell").hasClass("e-othermonths")&&(t.find(".e-selectedCell").removeClass("e-selectedCell").blur(),e(t[i].cells[s]).addClass("e-selectedCell").attr("tabIndex",0).focus())},_navigateToolbarRight:function(e){var t,i=this.model.views,s=this.element.find(".e-commonviewbutton.e-"+this.currentView()).parent().index();s0&&(t=this.model.views[i-1].toLowerCase(),this._navView=!0,this._viewChange(e,this.currentView(),t),this.element.find("#"+this._id+"_navigator").ejDatePicker({value:new Date(this.currentDate())}))},_newAppWindow:function(i){var s,a,n,o,r,l;if(e(i).hasClass("e-selectedCell")){this._currentAction=t.Schedule.Actions.Add;var d=null==i?l:i,h=(e(d).parent().index(),e(d).index(),"horizontal"==this.model.orientation&&"month"==this.currentView()?this.monthDays:"vertical"==this.model.orientation||"customview"==this.currentView()&&this._dateRender.length<=7?this.dateRender:this._dateRender);if(h="horizontal"==this.model.orientation&&"customview"==this.currentView()&&this._dateRender.length<=7?this._dateRender:h,s=parseInt(this.element.find("td.e-selectedCell").length)-1,_target=e(d),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-(7*(parseInt(_target.index()/7)+1)-_target.index())+7*_target.parent().index():"vertical"==this.model.orientation&&"month"==this.currentView()||"customview"==this.currentView()&&this._dateRender.length>=7?7-(7*(parseInt(_target.index()/7)+1)-_target.index())+7*_target.parent().index():_target.index(),"horizontal"==this.model.orientation&&(this._cellIndex=this.model.timeScale.enable?"month"===this.currentView()||this._isCustomMonthView()?this._cellIndex:Math.floor(this._cellIndex/(2*(this.model.endHour-this.model.startHour))):_target.index(),this._workCellIndex=_target.parent().index()),0==s){if(a=new Date(h[this._cellIndex]),this.model.minDate>a||this.model.maxDate0){var c=this._findMinMaxCellIndex(),u=c.omincolIndex,m=c.omaxcolIndex,p=c.rowInx,g=c.maxrowInx;if("vertical"==this.model.orientation)if(e(i).hasClass("e-workcells")){var _=h[u],f=h[m],b=(this.model.startHour+p/2).toString().split("."),v=(this.model.startHour+g/2).toString().split(".");startTime=new Date(new Date(_).setHours(parseInt(b[0]),5==parseInt(b[1])?30:0)),endTime=new Date(f).setHours(parseInt(v[0]),5==parseInt(v[1])?30:0),endTime=new Date(new Date(endTime).setMinutes(new Date(endTime).getMinutes()+30))}else if(e(i).hasClass("e-monthcells")){var x=this.element.find("td.e-selectedCell"),w=7*e(x[0]).parent().index()+(e(x[0]).index()-7*Math.floor(e(x[0]).index()/7)),y=7*e(x[s]).parent().index()+(e(x[s]).index()-7*Math.floor(e(x[s]).index()/7)),C=new Date(this._dateRender[w]),S=new Date(this._dateRender[y]);startTime=new Date(new Date(C).setHours(0,0,0)),endTime=new Date(new Date(S).setHours(23,59,59))}else e(i).hasClass("e-alldaycells")&&(startTime=new Date(new Date(h[u]).setHours(0,0,0)),endTime=new Date(new Date(h[m]).setHours(23,59,59)));else if("month"!=this.currentView()&&!this._isCustomMonthView()&&this.model.timeScale.enable){var _=h[0],f=h[0],b=(this.model.startHour+u/2).toString().split("."),v=(this.model.startHour+m/2).toString().split(".");startTime=new Date(new Date(_).setHours(parseInt(b[0]),5==parseInt(b[1])?30:0)),endTime=new Date(f).setHours(parseInt(v[0]),5==parseInt(v[1])?30:0),endTime=new Date(new Date(endTime).setMinutes(new Date(endTime).getMinutes()+30))}else{var _=this.totdays[u],f=this.totdays[m],b=this.model.startHour.toString().split("."),v=this.model.startHour.toString().split(".");startTime=new Date(_).setHours(parseInt(b[0]),5==parseInt(b[1])?30:0),endTime=new Date(f).setHours(parseInt(v[0]),5==parseInt(v[1])?30:0),endTime=new Date(new Date(endTime).setMinutes(new Date(endTime).getMinutes()+30)),endTime=new Date(new Date(endTime).setHours(23,59,59))}}if(l={startTime:new Date(startTime),endTime:new Date(endTime),target:_target,resources:null==this.model.appointmentWindowOpen&&null==this.model.cellDoubleClick||t.isNullOrUndefined(this.model.resources)?null:this._getResourceValue(_target)},this._trigger("appointmentWindowOpen",l))return!1;t.scheduleFeatures.resources&&!t.isNullOrUndefined(this.model.resources)&&this._renderResourceData(e(d),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._appointmentAddWindow.find("#"+this._id+"endtime").ejTimePicker("option","value",t.format(new Date(endTime),this._pattern.t)),(e(i).hasClass("e-alldaycells")||"month"==this.currentView()||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}},_showToolTip:function(i){var s,a;if(this.model.tooltipSettings.enable&&!t.isTouchDevice()){if(e(i.target).is(".e-tophandle,.e-bottomhandle,.e-schedulemouseclose,.e-righthandle,.e-lefthandle,.e-schedulerepeat,.e-editapp,.e-deleteapp")||(s=this._getAppDetails(i),0==s))return!1;if(t.isNullOrUndefined(this.model.tooltipSettings.templateId)){var n="12"==this._timeMode?t.format(s[this._appointmentSettings.startTime],this._pattern.t):t.format(s[this._appointmentSettings.startTime],"HH:mm"),o="12"==this._timeMode?t.format(s[this._appointmentSettings.endTime],this._pattern.t):t.format(s[this._appointmentSettings.endTime],"HH:mm"),r=""==s.Subject?this._getLocalizedLabels("NoTitle"):s[this._appointmentSettings.subject],a=r+": ("+n+"-"+o+")";this.element.find(".e-scheduletooltip").html(a)}else a=e(this.model.tooltipSettings.templateId).render(s),this.element.find(".e-scheduletooltip").html(a.trim());var l=i.pageX,d=i.pageY,h=e(this.element.find(".e-scheduletooltip"));l=l+h.width()0&&this.element.find(".e-scheduletooltip").hide(),this.element.find(".e-scheduletooltip").html(v+" "+this._getLocalizedLabels("OverFlowAppCount"));var x=e(this.element.find(".e-scheduletooltip")),w=i.pageX+x.width()0)for(o=0;o<=n;o++)a[o].blur(),e(a[o]).removeClass("e-selectedCell");else e(t).removeClass("e-selectedCell").blur();e(h[0]).addClass("e-selectedAppointment").attr("tabIndex",0).focus()}e(t).hasClass("e-navigateprevious")?this.element.find(".e-navigatenext").attr("tabIndex",0).focus():e(t).hasClass("e-navigatenext")&&(e(s[0].cells[0]).addClass("e-selectedCell").attr("tabIndex",0).focus(),e(s[0].cells[0]).hasClass("e-resourceheadercells")&&e(s[1].cells[0]).addClass("e-selectedCell").attr("tabIndex",0).focus()),(e(t).hasClass("e-appointment")||e(t).hasClass("e-alldayappointment")||e(t).hasClass("e-monthappointment")||e(t).hasClass("e-agendaappointment"))&&(r=h.length,l=this.element.find("div.e-appointment,div.e-alldayappointment,div.e-monthappointment,div.e-agendaappointment").index(this.element.find(".e-selectedAppointment")),l=0?(e(h[l]).removeClass("e-selectedAppointment").blur(),d=parseInt(l)+1,d0)for(l=0;l<=r;l++)e(o[l]).removeClass("e-selectedCell").blur();else e(t).removeClass("e-selectedCell").blur();e(c[n]).addClass("e-selectedAppointment").attr("tabIndex",0).focus()}e(t).hasClass("e-navigatenext")?e(this.element).find(".e-navigateprevious").attr("tabIndex",0).focus():e(t).hasClass("e-navigateprevious")&&(e(s[0].cells[0]).addClass("e-selectedCell").attr("tabIndex",0).focus(),e(s[0].cells[0]).hasClass("e-resourceheadercells")&&e(s[1].cells[0]).addClass("e-selectedCell").attr("tabIndex",0).focus()),(e(t).hasClass("e-appointment")||e(t).hasClass("e-alldayappointment")||e(t).hasClass("e-monthappointment")||e(t).hasClass("e-agendaappointment"))&&(d=this.element.find("div.e-appointment,div.e-alldayappointment,div.e-monthappointment,div.e-agendaappointment").index(this.element.find(".e-selectedAppointment")),d0?(e(c[d]).removeClass("e-selectedAppointment").blur(),h=parseInt(d)-1,h=0?e(c[h]).addClass("e-selectedAppointment").attr("tabIndex",0).focus():0==h&&e(this.element).find(".e-navigatenext").attr("tabIndex",0).focus()):0==d&&(e(c[d]).removeClass("e-selectedAppointment").blur(),e(this.element).find(".e-navigatenext").attr("tabIndex",0).focus()))},_stopDefaultAction:function(e){e.cancelBubble=!0,e.returnValue=!1,e.stopPropagation(),e.preventDefault()},_getLocalizedLabels:function(e){return this._localizedLabels[e]===s?t.Schedule.Locale["en-US"][e]:this._localizedLabels[e]},refreshAppointments:function(){t.isNullOrUndefined(this._appointmentSettings)||(this._dataManager=this.dataSource()instanceof t.DataManager?this.dataSource():null!=this.dataSource()?t.DataManager(this.dataSource()):null),this._bindAppointmentsData("Refresh")},refresh:function(){this._destroy(),this._init()},getSlotByElement:function(i){var s=e(t.isNullOrUndefined(i)?this.element.find("td.e-selectedCell"):i);return!t.isNullOrUndefined(s)&&0!=s.length&&"agenda"!=this.currentView()&&((s.hasClass("e-workcells")||s.hasClass("e-monthcells")||s.hasClass("e-alldaycells"))&&(1==s.length?this._slotByElement(s):this._slotByCellSelect(s)),{startTime:new Date(this.cur_StartTime),endTime:new Date(this.cur_EndTime),resources:t.isNullOrUndefined(this.model.group)||t.isNullOrUndefined(this.model.resources)?null:this._getResourceValue(s)})},saveAppointment:function(i){var s,a,n,o,r,l,d,h,c,u,m,p,g,_,f,b,v,x,w,y,C;if(!this.model.readOnly)if(s=this._sortAppById(this._processed),this._publicMethodSave=!1,i[this._appointmentSettings.startTimeZone]=null==this.model.timeZone?"UTC "+t.format(new Date,"zzz"):this.model.timeZone,i[this._appointmentSettings.endTimeZone]=null==this.model.timeZone?"UTC "+t.format(new Date,"zzz"):this.model.timeZone,n=this._timeZoneSavingAppoint(i,""),i=n.obj,l=this._timeZoneAppointments(i,""),t.isNullOrUndefined(i[this._appointmentSettings.id])&&""!=!i[this._appointmentSettings.id]||(o=new t.DataManager(this._processed).executeLocal((new t.Query).where(this._appointmentSettings.id,t.FilterOperators.equal,i[this._appointmentSettings.id])),t.isNullOrUndefined(o[0])||(i.Guid=o[0].Guid,i.AppTaskId=o[0].AppTaskId,i.RecurrenceId=o[0].recurrenceId,i.recurrenceExDate=o[0].recurrenceExDate,i.ParentId=o[0].ParentId)),v=this,a=t.isNullOrUndefined(this._appMainId)?1:this._appMainId+1,t.isNullOrUndefined(i.AppTaskId)||""==i.AppTaskId){if(i[this._appointmentSettings.id]=t.isNullOrUndefined(i[this._appointmentSettings.id])||""==i[this._appointmentSettings.id]?a:i[this._appointmentSettings.id],l[this._appointmentSettings.id]=t.isNullOrUndefined(l[this._appointmentSettings.id])||""==l[this._appointmentSettings.id]?a:l[this._appointmentSettings.id],l.AppTaskId=a,i.AppTaskId=a,l.ParentId=a,i.ParentId=a,i.Guid=this._guidFormatGenerate(),this._trigger("actionBegin",{data:i,requestType:"appointmentSave",methodType:"public"})||this._trigger("beforeAppointmentCreate",{appointment:i,methodType:"public"}))return!1;w=this._dataManager.insert(l),h=this._timeZoneAppointments(l,"reverse"),new t.DataManager(this._currentAppointmentData).update("AppTaskId",h),!t.isNullOrUndefined(w)&&e.isFunction(w.promise)&&this.dataSource()instanceof t.DataManager?w.done(function(i){if(v.model.enableLoadOnDemand)v._initDataSource("refresh");else{var s=t.isNullOrUndefined(i.record)?i:i.record;v._currentAppointmentData.length=0,v._dateFormat(s),v._bindAppointments=!0,v._currentAppointmentData=e.merge(v._currentAppointmentData,s),v._dataProcessing(s),v._renderAppointmentAll()}v._trigger("appointmentCreated",{appointment:l,requestType:"appointmentSaved",methodType:"public"}),v._trigger("actionComplete",{data:l,requestType:"appointmentSave",methodType:"public"})}):(this._processed.push(i),this._renderSingleApp(i,i),this._appMainId=this._sortAppById(this._processed)[this._processed.length-1].AppTaskId,this._trigger("appointmentCreated",{appointment:i,requestType:"appointmentSaved",methodType:"public"}),this._trigger("actionComplete",{data:i,requestType:"appointmentSave",methodType:"public"}))}else if("editOcurrence"==this._currentAction){if(this._trigger("actionBegin",{data:i,requestType:"appointmentEdit"})||this._trigger("beforeAppointmentChange",{appointment:i}))return!1;var S=new t.DataManager(this._processed).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,this._appUid))[0],T=null==S[this._appointmentSettings.recurrenceId]?S.ParentId:S[this._appointmentSettings.recurrenceId],r=null==S[this._appointmentSettings.recurrenceId]?"ParentId":this._appointmentSettings.recurrenceId,D=this._appointmentRecurrenceSort(new t.DataManager(this._processed).executeLocal((new t.Query).where(r,t.FilterOperators.equal,T))),I=this._recuCollectionIndex(D,S),k=this._appointmentSettings;if(0==I?!t.isNullOrUndefined(D[I+1])&&!(new Date(new Date(D[I+1][k.startTime]).setHours(0,0,0,0)).getTime()>new Date(new Date(i[k.endTime]).setHours(0,0,0,0)).getTime()):I==D.length-1?!(new Date(new Date(D[I-1][k.endTime]).setHours(0,0,0,0)).getTime()new Date(new Date(i[k.endTime]).setHours(0,0,0,0)).getTime()))return e("#"+this._id+"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"),!1;f=(new t.Query).where("Guid",t.FilterOperators.equal,this._appUid),u=new t.DataManager(this._processed).executeLocal(f),this._objDate=u,r=null==this._objDate[0][this._appointmentSettings.recurrenceId]?"ParentId":this._appointmentSettings.recurrenceId, _=this._deleteOcurrence(this._objDate[0][r],new Date(u[0][this._appointmentSettings.startTime])),new t.DataManager(this._processed).remove("Guid",this._appUid),i[this._appointmentSettings.recurrence]=1,i[this._appointmentSettings.recurrenceRule]=_[0][this._appointmentSettings.recurrenceRule]+";RECUREDITID="+_[0].AppTaskId,i[this._appointmentSettings.recurrenceId]=_[0][this._appointmentSettings.recurrenceId],i.Guid=this._appUid,i[this._appointmentSettings.recurrenceExDate]=_[0][this._appointmentSettings.recurrenceExdate],i.Guid=u[0].Guid,i[this._appointmentSettings.id]=u[0][this._appointmentSettings.id],m=[],g=this._currentAction==t.Schedule.Actions.EditOcurrence||!t.isNullOrUndefined(i[this._appointmentSettings.recurrenceRule])&&i[this._appointmentSettings.recurrenceRule].toString().indexOf("RECUREDITID")!=-1?this._parentId:this._currentAction==t.Schedule.Actions.Save?u[0].AppTaskId:a,this._maxId=(new Date(i[this._appointmentSettings.endTime])-new Date(i[this._appointmentSettings.startTime]))/36e5>24&&this._currentAction!=t.Schedule.Actions.EditOcurrence&&1==i[this._appointmentSettings.allDay]?g:this._currentAction==t.Schedule.Actions.Save?u[0].AppTaskId:this._appMainId+1,this._maxId=(new Date(i[this._appointmentSettings.endTime])-new Date(i[this._appointmentSettings.startTime]))/36e5>24&&!t.isNullOrUndefined(i[this._appointmentSettings.recurrenceRule])&&i[this._appointmentSettings.recurrenceRule].toString().indexOf("RECUREDITID")!=-1&&this._currentAction==t.Schedule.Actions.Save?u[0].AppTaskId:this._maxId,this._maxId=this._currentAction==t.Schedule.Actions.EditSeries?g:this._maxId,p=this._addAppData(i,this._maxId,new Date(i[this._appointmentSettings.startTime]),new Date(i[this._appointmentSettings.endTime]),g),m.push(p),l=[],d=m[0][this._appointmentSettings.startTimeZone],d!=this.model.timeZone?l.push(this._timeZoneAppointments(m[0],"")):l.push(m[0]),new t.DataManager(this._currentAppointmentData).update("AppTaskId",m[0]);var _=[],f=(new t.Query).where("AppTaskId",t.FilterOperators.equal,this._parentId),P=new t.DataManager(this._currentAppointmentData).executeLocal(f);new t.DataManager(this._currentAppointmentData).update("AppTaskId",P[0]),_.push(this._timeZoneAppointments(P[0],"")),w=this.dataSource()instanceof t.DataManager?this._dataManager.saveChanges({added:m,changed:_,deleted:[]},this._appointmentSettings.id):this._dataManager.saveChanges({added:m,changed:_,deleted:[]},"AppTaskId"),h=[],h=d!=this.model.timeZone?this._timeZoneAppointments(l[0],"reverse"):l[0],new t.DataManager(this._currentAppointmentData).update("AppTaskId",h),c=[],c=d!=this.model.timeZone?this._timeZoneAppointments(_[0],"reverse"):_[0],new t.DataManager(this._currentAppointmentData).update("AppTaskId",c),e.isFunction(w.promise)&&this.dataSource()instanceof t.DataManager?(w.done(function(i){if(v.model.enableLoadOnDemand)v._initDataSource("refresh");else{var s=t.isNullOrUndefined(i.record)?i:i.record;v._currentAppointmentData.length=0,v._dateFormat(s),v._bindAppointments=!0,v._currentAppointmentData=e.merge(v._currentAppointmentData,s),v._dataProcessing(s),v._renderAppointmentAll()}v._trigger("appointmentCreated",{appointment:m[0],requestType:"appointmentSaved"}),v._trigger("actionComplete",{data:m,requestType:"appointmentSave"})}),w.fail(function(){})):(this._renderSingleApp(i,m[0]),this._trigger("appointmentChanged",{data:m,requestType:"appointmentChanged",methodType:"public"}),this._trigger("actionComplete",{data:m,requestType:"appointmentEdit",methodType:"public"}))}else if("save"==this._currentAction&&i[this._appointmentSettings.recurrence]||this._currentAction==t.Schedule.Actions.EditSeries){if(this._trigger("actionBegin",{data:i,requestType:"appointmentEdit"})||this._trigger("beforeAppointmentChange",{appointment:i}))return!1;if(f=(new t.Query).where("Guid",t.FilterOperators.equal,this._appUid),u=new t.DataManager(this._processed).executeLocal(f),this._currentAction!=t.Schedule.Actions.EditSeries){t.isNullOrUndefined(u[0][this._appointmentSettings.recurrenceRule])||(i[this._appointmentSettings.recurrenceRule]=u[0][this._appointmentSettings.recurrenceRule]);var S=new t.DataManager(this._processed).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,this._appUid))[0],T=null==S[this._appointmentSettings.recurrenceId]?S.ParentId:S[this._appointmentSettings.recurrenceId],r=null==S[this._appointmentSettings.recurrenceId]?"ParentId":this._appointmentSettings.recurrenceId,D=this._appointmentRecurrenceSort(new t.DataManager(this._processed).executeLocal((new t.Query).where(r,t.FilterOperators.equal,T))),I=this._recuCollectionIndex(D,S),k=this._appointmentSettings;if(0==I?!t.isNullOrUndefined(D[I+1])&&!(new Date(new Date(D[I+1][k.startTime]).setHours(0,0,0,0)).getTime()>new Date(new Date(i[k.endTime]).setHours(0,0,0,0)).getTime()):I==D.length-1?!(new Date(new Date(D[I-1][k.endTime]).setHours(0,0,0,0)).getTime()new Date(new Date(i[k.endTime]).setHours(0,0,0,0)).getTime()))return e("#"+this._id+"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"),!1}else{var T=null==u[0][this._appointmentSettings.recurrenceId]?u[0].ParentId:u[0][this._appointmentSettings.recurrenceId],f=(new t.Query).where("AppTaskId",t.FilterOperators.equal,T),_=new t.DataManager(this._currentAppointmentData).executeLocal(f);i.AppTaskId=_[0].AppTaskId,i[this._appointmentSettings.id]=_[0][this._appointmentSettings.id],a=_[0].AppTaskId,i[this._appointmentSettings.recurrenceId]=_[0][this._appointmentSettings.recurrenceId],i.Guid=this._appUid,i[this._appointmentSettings.recurrenceExDate]=_[0][this._appointmentSettings.recurrenceExate]}i.Guid=u[0].Guid,i[this._appointmentSettings.id]=this._currentAction!=t.Schedule.Actions.EditSeries?u[0][this._appointmentSettings.id]:i[this._appointmentSettings.id],m=[],g=this._currentAction==t.Schedule.Actions.EditOcurrence||!t.isNullOrUndefined(i[this._appointmentSettings.recurrenceRule])&&i[this._appointmentSettings.recurrenceRule].toString().indexOf("RECUREDITID")!=-1?this._parentId:this._currentAction==t.Schedule.Actions.Save?u[0].AppTaskId:a,this._maxId=(new Date(i[this._appointmentSettings.endTime])-new Date(i[this._appointmentSettings.startTime]))/36e5>24&&this._currentAction!=t.Schedule.Actions.EditOcurrence&&1==i[this._appointmentSettings.allDay]?g:this._currentAction==t.Schedule.Actions.Save?u[0].AppTaskId:this._appMainId+1,this._maxId=(new Date(i[this._appointmentSettings.endTime])-new Date(i[this._appointmentSettings.startTime]))/36e5>24&&!t.isNullOrUndefined(i[this._appointmentSettings.recurrenceRule])&&i[this._appointmentSettings.recurrenceRule].toString().indexOf("RECUREDITID")!=-1&&this._currentAction==t.Schedule.Actions.Save?u[0].AppTaskId:this._maxId,this._maxId=this._currentAction==t.Schedule.Actions.EditSeries?g:this._maxId,p=this._addAppData(i,this._maxId,new Date(i[this._appointmentSettings.startTime]),new Date(i[this._appointmentSettings.endTime]),g),m.push(p);var L=[],R=[],M=[],O=this._currentAction==t.Schedule.Actions.Save?m[0].Guid:m[0][this._appointmentSettings.recurrenceId],E=this._currentAction==t.Schedule.Actions.Save?"Guid":this._appointmentSettings.recurrenceId;f=(new t.Query).where(E,t.FilterOperators.equal,O),_=new t.DataManager(this._currentAppointmentData).executeLocal(f),!t.isNullOrUndefined(_)&&_.length>0?R.push(m[0]):L.push(m[0]),this._currentAction==t.Schedule.Actions.EditSeries&&(f=t.Query().where(t.Predicate(this._appointmentSettings.recurrenceRule,t.FilterOperators.contains,"RECUREDITID="+m[0].ParentId,!0)),b=new t.DataManager(this._currentAppointmentData).executeLocal(f),M=M.concat(b));var w,v=this,A=[],j=[];if(L.length>0&&A.push(this._timeZoneAppointments(L[0],"")),R.length>0&&j.push(this._timeZoneAppointments(R[0],"")),w=this.dataSource()instanceof t.DataManager?this._dataManager.saveChanges({added:A,changed:j,deleted:M},this._appointmentSettings.id):this._dataManager.saveChanges({added:A,changed:j,deleted:M},"AppTaskId"),R.length>0&&(y=this._timeZoneAppointments(j[0],"reverse")),L.length>0&&(y=this._timeZoneAppointments(A[0],"reverse")),new t.DataManager(this._currentAppointmentData).update("AppTaskId",y),R.length>0&&(v=this,e.isFunction(w.promise)&&this.dataSource()instanceof t.DataManager?(w.done(function(i){if(v.model.enableLoadOnDemand)v._initDataSource("refresh");else{var s=t.isNullOrUndefined(i.record)?i:i.record;v._currentAppointmentData.length=0,v._dateFormat(s),v._bindAppointments=!0,v._currentAppointmentData=e.merge(v._currentAppointmentData,s),v._dataProcessing(s),v._renderAppointmentAll()}v._appMainId=v._processed.length>0?v._sortAppById(v._processed)[v._processed.length-1].AppTaskId:v._appMainId,v._trigger("appointmentChanged",{data:R,requestType:"appointmentChanged"}),v._trigger("actionComplete",{data:R,requestType:"appointmentEdit"})}),w.fail(function(){})):(R[0][this._appointmentSettings.recurrence]||new Date(new Date(R[0][this._appointmentSettings.startTime]).setHours(0,0,0,0)).getTime()0?this._sortAppById(this._processed)[this._processed.length-1].AppTaskId:this._appMainId),this._trigger("appointmentChanged",{data:R,requestType:"appointmentChanged",methodType:"public"}),this._trigger("actionComplete",{data:R,requestType:"appointmentEdit",methodType:"public"})),L.length>0)if(e.isFunction(w.promise)&&this.dataSource()instanceof t.DataManager)w.done(function(i){if(v.model.enableLoadOnDemand)v._initDataSource("refresh");else{var s=t.isNullOrUndefined(i.record)?i:i.record;v._currentAppointmentData.length=0,v._dateFormat(s),v._bindAppointments=!0,v._currentAppointmentData=e.merge(v._currentAppointmentData,s),v._dataProcessing(s),v._renderAppointmentAll()}}),w.fail(function(){});else for(x=0;x7?s.width(this.element.find(".e-workcellstab").width()+e(".e-monthleftindent").width()):s.width(this.element.find(".e-workcellstab").width()+e(".e-workleftindent").width()),s.height(e("#"+this._id+" .e-headertr").height()+e("#"+this._id+" .e-workcellstab").height()+e("#"+this._id+" .e-scheduleheader").height()+2),s.find(".e-scroller").ejScroller({width:e(".e-dateheader").width(),height:e("#"+this._id+" .e-workcellstab").height()+2}),s.find(".e-scrolltimecells").css({top:0}),s.find(".e-commonviewbutton").css({"margin-top":"0px"}),s.find(".e-viewstable").css({"padding-top":"15px"}),s.children().first().css({border:"0px solid #bbbcbb"}),s.css({border:"1px solid #bbbcbb"}),"month"==this.model.currentView&&s.find(".e-draggableworkarea").css({height:this.element.find(".e-timecells").height()*this.element.find(".e-timecells").length+2})):(s.width(this.element.find(".e-workcellstab").width()+e(".e-workleftindent").width()),s.find(".e-workcellstab").css({left:-e("div#"+this._id+"_scroller").data("ejScroller").scrollLeft(),position:"absolute"})):"month"==this.currentView()||this._isCustomMonthView()&&this._renderDays>7?s.width(this.element.find(".e-workcellstab").width()):(s.find(".e-workcellstab").css({left:-e("div#"+this._id+"_scroller").data("ejScroller").scrollLeft(),position:"absolute"}),s.find(".e-horizontaltimecells tr:nth-child(2)").css("left",-e("div#"+this._id+"_scroller").data("ejScroller").scrollLeft()+"px"))),t.print(s)}else this._printAppointment(i)},deleteAppointment:function(e){var i;this.model.readOnly||("string"==typeof e?(i=new t.DataManager(this._processed).executeLocal((new t.Query).where("Guid",t.FilterOperators.equal,e)),i[0][this._appointmentSettings.recurrence]?(this._deleteUid=e,this._deletingAppointment()):this._deleteApp(e)):"object"==typeof e&&(this._deleteUid=e.Guid,t.isNullOrUndefined(this._deleteUid)&&(i=new t.DataManager(this._processed).executeLocal((new t.Query).where("ParentId",t.FilterOperators.equal,parseInt(e.ParentId))),this._deleteUid=i[0].Guid),e[this._appointmentSettings.recurrence]?this._deletingAppointment():this._deleteApp(this._deleteUid)))},getAppointments:function(){return this.dataSource()},searchAppointments:function(e,i,s,a){var n,o=t.Query(),r=t.isNullOrUndefined(i)?this._getColumns(this._appointmentSettings):i;return s=t.isNullOrUndefined(s)?"contains":s,a=!!t.isNullOrUndefined(a)||a,"string"==typeof e?e.length&&(o.search(e,r,s,a),n=this.dataSource()instanceof t.DataManager?o:this._dataManager.executeLocal(o)):"object"==typeof e&&(n=this.filterAppointments(e)),n},filterAppointments:function(e){var i,s,a,n,o,r=t.Query();if(!t.isNullOrUndefined(e)){for(a=e[0],s=!!t.isNullOrUndefined(a.matchcase)||a.matchcase,n=t.Predicate(a.field,a.operator,a.value,s),o=1;or+this.element.find(".e-scrolltimecells").width()+18?r:i.model.width-18)}this.element.find(".e-headrealldaytable").parent().width(this.element.find(".e-draggableworkarea").width()),this.element.find(".e-datecommondiv").parent().width(this.element.width()-2),this.element.find(".e-headrealldaytable").css("left",-this.element.find(".e-draggableworkarea").scrollLeft()+"px")}else e(this.element.find(".e-horizontaltimecells").find("table tr")[2]).css("left",-i.model.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),"month"==this.currentView()&&"vertical"==this.model.orientation&&this._renderCurrentView()},_refreshAppNavigation:function(){var e,i,s,a,n=this.element.find("#"+this._id+"_scroller");this.height=n.height(),this.width=n.width(),e=this.element.find(".e-vscroll").width(),i=this.element.find(".e-scrolltimecells").width(),i=t.isNullOrUndefined(i)?"vertical"==this.model.orientation?56:0:i,s=this.height/2-75,a=this.model.showTimeScale&&"agenda"!=this.currentView()&&"vertical"==this.model.orientation?"month"==this.currentView()||this._isCustomMonthView()?-10:-4:-61,this.width=this.model.showTimeScale&&"agenda"!=this.currentView()?this.width:this.width-i,this.model.enableRTL?(this.element.find(".e-prevapp").css("top",s+40+"px").css("transform","rotate(-90deg)").css("right",a+"px"),this.element.find(".e-nextapp").css("top",s+40+"px").css("transform","rotate(90deg)").css("right",this.width-e-("vertical"!=this.model.orientation||"month"!=this.currentView()&&!this._isCustomMonthView()?"vertical"==this.model.orientation?34:90:41)+"px")):(this.element.find(".e-prevapp").css("top",s+40+"px").css("transform","rotate(90deg)").css("left",a+"px"),this.element.find(".e-nextapp").css("top",s+40+"px").css("transform","rotate(-90deg)").css("left",this.width-e-("vertical"!=this.model.orientation||"month"!=this.currentView()&&!this._isCustomMonthView()?"vertical"==this.model.orientation?34:90:41)+"px"))},getDifference:function(e){var t="";return e.toString().indexOf("-")!=-1?(t=e.toString().substring(e.toString().indexOf("-")+1,e.toString().indexOf("-")+5),-(60*parseInt(t.substring(0,2)))+parseInt(t.substring(2,4))):(t=e.toString().substring(e.toString().indexOf("+")+1,e.toString().indexOf("+")+5),60*parseInt(t.substring(0,2))+parseInt(t.substring(2,4)))},exportSchedule:function(i,s,a){var n,o,r,l,d,h,c,u={},m=[];for(e.extend(u,this.model),e.extend(m,this._processed),r=0;rthis.model.maxDate?this.model.startDate=this.model.maxDate:"",this._recurrenceContent.find(".recurstartdate").ejDatePicker("option","value",this.model.startDate);break;case"timeZone":this.model.timeZone=i[a];break;case"locale":this.model.locale=i[a],s=!0;break;case"enableRTL":this.model.enableRTL=i[a],this._recurrenceLayout.addClass("e-rtl");break;case"value":this.model.value=i[a];break;case"dateFormat":this.model.dateFormat=i[a],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=i[a],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=i[a],this.element.removeClass(this.model.cssClass).addClass(i[prop])}1==s&&this._render()}},_init:function(){t.isNullOrUndefined(this.element)||(this._render(),this._wireEvents())},_render:function(){var i,s;for(e("#"+this._id+"recurrenceeditor").remove(),this._currentDateFormat(this.model.dateFormat),this._initPrivateProperties(),i="number"==typeof innerWidth&&window.innerWidth>document.documentElement.clientWidth,this._mediaQuery=!("msie"==this._browserInfo.name&&parseInt(this._browserInfo.version,10)<=8)&&(document.documentElement.clientWidth+(i?17:0)<361||t.isMobile()),this.model.frequencies=this.model.frequencies.toString().toLowerCase().split(","),s=0;s
    "+this._getLocalizedLabels("Repeat")+":
      ",s=0;s"+this._getLocalizedLabels(this.model.frequencies[s])+"";i+="
    ",this.element.append(this._recurrenceLayout.append(i)),this._renderRecurrenceContent(),this._initalRender=!0,this._recurrenceLayout.find(".e-recurrencetype").ejDropDownList({enableRTL:this.model.enableRTL,targetID:"recurtypelist",width:"100%",change:e.proxy(this._recurrenceTypeChange,this),cssClass:this.model.cssClass}),this._recurrenceLayout.find(".e-recurrencetype").ejDropDownList({selectedItemIndex:this.model.selectedRecurrenceType})},_datepattern:function(){return""==this.model.dateFormat||t.isNullOrUndefined(this.model.dateFormat)?this._pattern.d:this.model.dateFormat},_currentDateFormat:function(i){var s,a,n,o;t.isNullOrUndefined(i)||"date"==e.type(this.model.startDate)&&"date"==e.type(this.model.minDate)&&"date"==e.type(this.model.maxDate)?"MM/dd/yyyy"==i&&("date"!=e.type(this.model.startDate)||"date"!=e.type(this.model.minDate)||"date"!=e.type(this.model.maxDate))&&(o=t.parseDate(this.model.startDate),s=t.parseDate(this.model.minDate), a=t.parseDate(this.model.maxDate),this.model.startDate=t.isNullOrUndefined(o)?this.model.startDate:o,this.model.minDate=t.isNullOrUndefined(s)?this.model.minDate:s,this.model.maxDate=t.isNullOrUndefined(a)?this.model.maxDate:a):(n=t.parseDate(this.model.startDate,this.model.dateFormat),s=t.parseDate(this.model.minDate,this.model.dateFormat),a=t.parseDate(this.model.maxDate,this.model.dateFormat),this.model.startDate=t.isNullOrUndefined(n)?"Invalid Date"==new Date(this.model.startDate).toString()||"NaN"==new Date(this.model.startDate).toString()?this._dateConvert(this.model.startDate):new Date(this.model.startDate):n,this.model.minDate=t.isNullOrUndefined(s)?"Invalid Date"==new Date(this.model.minDate).toString()||"NaN"==new Date(this.model.minDate).toString()?this._dateConvert(this.model.minDate):new Date(this.model.minDate):s,this.model.maxDate=t.isNullOrUndefined(a)?"Invalid Date"==new Date(this.model.maxDate).toString()||"NaN"==new Date(this.model.maxDate).toString()?this._dateConvert(this.model.maxDate):new Date(this.model.maxDate):a)},_closeRecur:function(i,s){var a,n,o,r,l,d,h,c,u,m,p=this.element.find(".e-recurrenceeditor").data("ejRecurrenceEditor");if(this.element.find(".e-recuruntil").ejRadioButton("option","checked")&&s!=this._getLocalizedLabels("Cancel")&&this.element.find("#recurstartdate").ejDatePicker("option","value")>this.element.find(".e-until").ejDatePicker("option","value"))return this._alertWindow.find(".e-alerttext").html(this._getLocalizedLabels("WrongPattern")),this._alertWindow.ejDialog("open"),!1;if(s==this._getLocalizedLabels("Cancel"))""==this.element.find(".e-recurFinalRule").html()&&this.element.find("#"+this._id+"recurrence").ejCheckBox({checked:!1});else{var g,_,f="",b="",v="";switch(g=this._findInterval(this.element.find(".recurevery")),p._rRuleFreq){case"DAILY":p._recRule="FREQ="+p._rRuleFreq+";INTERVAL="+g;break;case"WEEKDAYS":p._recRule="FREQ=WEEKLY;BYDAY=MO,TU,WE,TH,FR",v="MO,TU,WE,TH,FR";break;case"WEEKLY":var x=this.element.find("input.weekdays"),w="";for(a=0;a1?g+" ":""),m=u+this.element.find(".e-recurRule").html()+b+f,this.element.find("."+this._id+"summary").css("display","table-row"),this.element.find(".e-recurFinalRule").html(m),this.element.find(".e-recuredit").css("display","inline"),b=""}this.element.find(".e-recurEditor").toggle(),this.element.find(".e-appwindow").css("margin-left",700).toggle().animate({"margin-left":10},300),this._mediaQuery&&this.element.parent().parent().find(".e-dialog-icon").css("display","block"),this.element.find(".done").focus()},_renderRecurrenceContent:function(){for(var e,i,s,a,n,o,r,l,d,h,c=0;c",s+="",s+="",s+="",s+="",s+="",s+="",s+="
    "+this._getLocalizedLabels("StartsOn")+":
    "+this._getLocalizedLabels("Ends")+":
    "+this._getLocalizedLabels("Occurence")+"
    "+this._getLocalizedLabels("Summary")+":
    "}else{for(s="
    ",s+="",s+="",s+="",s+="",s+="",s+="",s+="
    "+this._getLocalizedLabels("Summary")+":
    "}this._recurrenceLayout.append(this._recurrenceContent.append(s)),this._renderControls()},_renderControls:function(){var t=this._recurrenceContent;t.find(".weekdays").ejCheckBox({enableRTL:this.model.enableRTL,cssClass:this.model.cssClass,change:e.proxy(this._weeklyClick,this)}),t.find(".monthsrt").ejDropDownList({enableRTL:this.model.enableRTL,targetID:"monthsrtlist",width:"100px",cssClass:this.model.cssClass,change:e.proxy(this._monthSrt,this)}),t.find(".monthsrtday").ejDropDownList({enableRTL:this.model.enableRTL,targetID:"monthsrtdaylist",width:"100px",cssClass:this.model.cssClass,change:e.proxy(this._monthSrt,this)}),t.find(".yearsrt").ejDropDownList({enableRTL:this.model.enableRTL,targetID:"yearsrtlist",width:"100px",cssClass:this.model.cssClass,change:e.proxy(this._yearsrt,this)}),t.find(".yearmonth").ejDropDownList({enableRTL:this.model.enableRTL,targetID:"yearmonthlist",width:"100px",cssClass:this.model.cssClass,change:e.proxy(this._yearmonth,this)}),t.find(".yearsrtday").ejDropDownList({enableRTL:this.model.enableRTL,targetID:"yearsrtdaylist",width:"100px",cssClass:this.model.cssClass,change:e.proxy(this._yearsrt,this)}),t.find(".yearsrtmonth").ejDropDownList({enableRTL:this.model.enableRTL,targetID:"yearsrtmonthlist",width:"100px",cssClass:this.model.cssClass,change:e.proxy(this._yearsrt,this)}),t.find(".e-recurrencetype").ejDropDownList({enableRTL:this.model.enableRTL,targetID:"recurtypelist",width:"100%",change:e.proxy(this._recurrenceTypeChange,this),cssClass:this.model.cssClass}),t.find(".recurstartdate").ejDatePicker({buttonText:this._getLocalizedLabels("Today"),startDay:this._firstDayOfWeek,enableRTL:this.model.enableRTL,locale:this.model.locale,cssClass:this.model.cssClass,dateFormat:this.model.dateFormat,change:e.proxy(this._startDateChange,this),value:this.model.startDate,minDate:this.model.minDate,maxDate:this.model.maxDate}),t.find(".until").ejDatePicker({buttonText:this._getLocalizedLabels("Today"),startDay:this._firstDayOfWeek,enableRTL:this.model.enableRTL,locale:this.model.locale,cssClass:this.model.cssClass,dateFormat:this.model.dateFormat,change:e.proxy(this._recurUntil,this)}),t.find(".recurcount").ejNumericTextbox({enableRTL:this.model.enableRTL,showSpinButton:this.model.enableSpinners,name:"dailyoccurance",minValue:1,value:10,width:"65px",decimalPlaces:0,cssClass:this.model.cssClass,change:e.proxy(this._recurCount,this)}),t.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:e.proxy(this._everyCount,this)}),t.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:e.proxy(this._monthDate,this)}),t.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:e.proxy(this._yearmonth,this)}),t.find(".dailyrecurtype").ejRadioButton({enableRTL:this.model.enableRTL,cssClass:this.model.cssClass,change:e.proxy(this._recurEndChange,this)}),t.find(".e-dailyeveryday").ejRadioButton({enableRTL:this.model.enableRTL,checked:!0,cssClass:this.model.cssClass}),t.find(".recurends").ejRadioButton({enableRTL:this.model.enableRTL,cssClass:this.model.cssClass,change:e.proxy(this._recurEndChange,this)}),t.find(".monthposition").ejRadioButton({enableRTL:this.model.enableRTL,cssClass:this.model.cssClass,change:e.proxy(this._recurEndChange,this)}),t.find(".monthdaytype").ejRadioButton({enableRTL:this.model.enableRTL,cssClass:this.model.cssClass,change:e.proxy(this._recurEndChange,this)}),t.find(".yearrecurposi,.yearrecurday").ejRadioButton({enableRTL:this.model.enableRTL,cssClass:this.model.cssClass,change:e.proxy(this._recurEndChange,this)})},_stringGenerate:function(){this.closeRecurPublic(),this._trigger("change",{recurreneceRule:this._recRule})},_recurEndChange:function(){""!=this._rRuleFreq&&this._trigger("change")&&this._stringGenerate()},_yearmonth:function(){this._recurrenceContent.find("#"+this._id+"yearday").ejRadioButton("option","checked",!0),""!=this._rRuleFreq&&this._trigger("change")&&this._stringGenerate()},_yearsrt:function(){this._recurrenceContent.find("#"+this._id+"yearother").ejRadioButton("option","checked",!0),""!=this._rRuleFreq&&this._trigger("change")&&this._stringGenerate()},_monthSrt:function(){this._recurrenceContent.find("#"+this._id+"monthon").ejRadioButton("option","checked",!0),""!=this._rRuleFreq&&this._trigger("change")&&this._stringGenerate()},_monthDate:function(){this._recurrenceContent.find("#"+this._id+"monthday").ejRadioButton("option","checked",!0),""!=this._rRuleFreq&&this._trigger("change")&&this._stringGenerate()},_everyCount:function(){this._trigger("change")&&this._stringGenerate()},_weeklyClick:function(){this._trigger("change")&&this._stringGenerate()},_recurCount:function(){this._recurrenceContent.find("#"+this._id+"repeatendafter").ejRadioButton("option","checked",!0),this._trigger("change")&&this._stringGenerate()},_recurUntil:function(){this._recurrenceContent.find("#"+this._id+"repeatendon").ejRadioButton("option","checked",!0),""!=this._rRuleFreq&&this._trigger("change")&&this._stringGenerate()},_startDateChange:function(e){this._recurrenceContent.find(".until").ejDatePicker("option","value",new Date(e.model.value.setDate(e.model.value.getDate()+70))),""!=this._rRuleFreq&&this._trigger("change")&&this._stringGenerate()},_findInterval:function(e){var i;return i=e.ejNumericTextbox("option","value"),t.isNullOrUndefined(i)?0:i},_recurrenceTypeChange:function(e){this._recurrenceType(e),(t.isNullOrUndefined(this._initalRender)||1!=this._initalRender)&&""!=this._rRuleFreq&&this.closeRecurPublic(),this._initalRender=!1,""!=this._rRuleFreq&&this._trigger("change",{recurreneceRule:this._recRule})},_recurrenceType:function(i){var s,a,n,o;if(this._rRuleFreq="",s="",a="string"==e.type(this.model.startDate)?this._dateConvert(this.model.startDate):this.model.startDate,this.flag&&(this._recurrenceContent.find(".until").ejDatePicker({value:new Date(new Date(a).setDate(new Date(a).getDate()+70))}),this._recurrenceContent.find(".e-recurnoend").ejRadioButton({checked:!1}),this.flag=!1),this._mediaQuery||this._recurrenceContent.find("#"+this._id+"_startson,#"+this._id+"_endson").css("display","table-row"),null!=i.itemId)switch(this._recurrenceContent.find("#"+this._id+"_every").css("display","table-row"),n=this._getLocalizedLabels(this.model.frequencies[i.itemId])){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._recurrenceContent.find("#"+this._id+"dailyrecur").css("display","table-row"),this._rRuleFreq="DAILY",s=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"),o=this._dayShortNames.indexOf(t.format(a,"ddd")),this._recurrenceContent.find(".e-weekly"+this._dayNames[o]).ejCheckBox({checked:!0}),s=this._getLocalizedLabels("RecurrenceWeek").toLowerCase()+" "+this._getLocalizedLabels("On").toLowerCase()+" "+this._dayFullNames[a.getDay()],this._rRuleFreq="WEEKLY",this._recurrenceContent.find("."+this._id+"_monthly,."+this._id+"_yearly,#"+this._id+"dailyrecur").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,#"+this._id+"dailyrecur").css("display","none"),this._recurrenceContent.find("."+this._id+"_monthly").css("display","table-row"),this._recurrenceContent.find(".monthdate").ejNumericTextbox({value:a.getDate()}),this._recurrenceContent.find(".monthsrtday").ejDropDownList({selectedItemIndex:this._dayNames.indexOf(t.format(a,"ddd").substr(0,2).toUpperCase())}),this._recurrenceContent.find(".monthsrt").ejDropDownList({selectedItemIndex:this._getWeekIndex(a)}),this._recurrenceContent.find(".monthdaytype").ejRadioButton({checked:!0}),this._rRuleFreq="MONTHLY",s=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,#"+this._id+"dailyrecur").css("display","none"),this._recurrenceContent.find("."+this._id+"_yearly").css("display","table-row"),this._recurrenceContent.find(".yearmonth").ejDropDownList({selectedItemIndex:a.getMonth()}),this._recurrenceContent.find(".yeardate").ejNumericTextbox({value:a.getDate()}),this._recurrenceContent.find(".yearsrtday").ejDropDownList({selectedItemIndex:this._dayNames.indexOf(t.format(a,"ddd").substr(0,2).toUpperCase())}),this._recurrenceContent.find(".yearsrtmonth").ejDropDownList({selectedItemIndex:a.getMonth()}),this._recurrenceContent.find(".yearsrt").ejDropDownList({selectedItemIndex:this._getWeekIndex(a)}),this._recurrenceContent.find(".yearrecurday").ejRadioButton({checked:!0}),this._rRuleFreq="YEARLY",s=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+"dailyrecur,#"+this._id+"_every,."+this._id+"_monthly").css("display","none"),s=i.text}this._recurrenceContent.find(".e-recurRule").html(s)},_showRecurrenceFields:function(){for(var e,i=0;i1?i+" ":""),u=c+this._recurrenceContent.find(".e-recurRule").html()+p+m,this._recurrenceContent.find("."+this._id+"summary").css("display","table-row"),this._recurrenceContent.find(".e-recurFinalRule").html(u),this._recurrenceContent.find(".e-recuredit").css("display","inline"),p=""},_recurClearFields:function(){for(var t=this.element.find("input.weekdays"),i=0;ip.getMonth()&&(p=new Date(p.setDate(a.getDate()))),p.getDate()!=n.getDate()&&(t.isNullOrUndefined(this._month)||!this._month)&&(this._month=!0,p=new Date(p.setDate(p.getDate()-p.getDate()))),u=!0;break;case"YEARLY":p=new Date(p.setFullYear(p.getFullYear()+e)),u=!0}u&&c++,u=!1,("WEEKLY"==this._rRuleFreq||"WEEKDAYS"==this._rRuleFreq)&&(p=new Date(p.setDate(p.getDate()+1))),n=new Date(p)}return this._month=!1,this._actualDate="",c},_weeklyDayFind:function(e,t){var i,s=e;do s=new Date(s.setDate(s.getDate()+1)),i=this._dayNamesValue[new Date(s).getDay()].toUpperCase();while(t.indexOf(i)==-1);return s},_dayOfWeekInMonth:function(e,t,i){for(var s=this._dayNames.indexOf(t),a=i==-1?new Date(e.getFullYear(),e.getMonth()+1,0):new Date(e.getFullYear(),e.getMonth(),1);a.getDay()!=s;)a=new Date(i==-1?a.setDate(a.getDate()-1):a.setDate(a.getDate()+1));return new Date(1==i||i==-1?a:a.setDate(a.getDate()+7*(i-1)))},_dateConvert:function(i){if(t.isNullOrUndefined(i))s=null;else{var s=new Date(parseInt(i.match(/\d+/).toString()));s="date"==e.type(s)?s:new Date}return s},_getWeekIndex:function(e){var t=0,i=new Date(e.getFullYear(),e.getMonth(),1),s=e.getDay();if(s!=i.getDay())do i=new Date(i.setDate(i.getDate()+1));while(s!=i.getDay());for(;i.getDate()!=e.getDate();)i=new Date(i.setDate(i.getDate()+7)),t++;return t},_getLocalizedLabels:function(e){return t.isNullOrUndefined(t.RecurrenceEditor.Locale[this.model.locale])?t.RecurrenceEditor.Locale["en-US"][e]:t.RecurrenceEditor.Locale[this.model.locale][e]},_wireEvents:function(){},getRecurrenceRule:function(){this._recurrenceRule()},closeRecurPublic:function(){var s,a,n,o,r,l,d,h,c,u,m,p,g=this._rRuleFreq,_="",f="",b="",v="";switch(s=this._interval=this._findInterval(this.element.find(".recurevery")),g){case"DAILY":v="FREQ="+g+";INTERVAL="+s;break;case"WEEKDAYS":v="FREQ=WEEKLY;BYDAY=MO,TU,WE,TH,FR",b="MO,TU,WE,TH,FR";break;case"WEEKLY":var x=this.element.find("input.weekdays"),w="";for(n=0;n1?s+" ":""),p=m+this.element.find(".e-recurRule").html()+f+_,this._recRule=v,p},recurrenceDateGenerator:function(e,i){var s,a,n,o,r,l,d,h,c,u,m,p,g,_,f=[];e.split(";");if(this._recurDates={},s=i,a=0,r=new Date(s),this.recurrenceRuleSplit(e,null),t.isNullOrUndefined(this._rRule.recurEditId)){if(l="",d=t.isNullOrUndefined(this._rRule.interval)?1:this._rRule.interval,t.isNullOrUndefined(this._rRule.weekDays)||(l=this._rRule.weekDays.split(",")),t.isNullOrUndefined(this._rRule.until))if(t.isNullOrUndefined(this._rRule.count))recurEndDate=new Date(new Date(this.model.startDate).setDate(s.getDate()+42*d));else switch(this._rRule.freq){case"DAILY":recurEndDate=new Date(new Date(s).setDate(s.getDate()+this._rRule.count*d));break;case"WEEKLY":h=s.getDate()+this._rRule.count/l.length*7*d,recurEndDate=new Date(new Date(s).setDate(Math.round(h)this._rRule.setPositions&&this._rRule.setPositions!=-1?new Date(s.getFullYear(),s.getMonth(),1):s);else{for(var b=new Date(s).getDate()==new Date(s.getFullYear(),s.getMonth()+1,0).getDate(),v=s.getMonth(),x=!0;new Date(s).getDate()!=this._rRule.monthDay&&x;)s=new Date(s.setDate(s.getDate()+1)),x=v==s.getMonth();x||(s=new Date(s.setDate(s.getDate()-1)))}n=o=new Date(s);break;case"YEARLY":t.isNullOrUndefined(this._rRule.monthDay)?t.isNullOrUndefined(this._rRule.setPositions)||(s=new Date(s.getFullYear(),this._rRule.month-1,s.getDate()),s=new Date(this._getWeekIndex(s)+1>this._rRule.setPositions&&this._rRule.setPositions!=-1?new Date(s.getFullYear(),s.getMonth(),1):s)):(c=new Date(r.setMonth(this._rRule.month-1)),u=new Date(c.getFullYear(),c.getMonth()+1,0).getDate(),this._rRule.monthDay>u&&(this._rRule.monthDay=u),s=s.getMonth()+1>=this._rRule.month&&s.getDate()>this._rRule.monthDay?new Date(s.getFullYear()+1,this._rRule.month-1,this._rRule.monthDay):new Date(s.getFullYear(),this._rRule.month-1,this._rRule.monthDay))}for(;s<=recurEndDate;){switch("MONTHLY"!=this._rRule.freq&&"YEARLY"!=this._rRule.freq||t.isNullOrUndefined(this._rRule.setPositions)||(s=this._dayOfWeekInMonth(s,this._rRule.weekDays,this._rRule.setPositions)),t.isNullOrUndefined(this._rRule.exDate)?m=0:this._rRule.exDate.indexOf(t.format(new Date(s),this._pattern.d))==-1&&(m=2),p=new Date(s),this._rRule.freq){case"DAILY":f.push(new Date(p).getTime()),s=new Date(s.setDate(s.getDate()+d));break;case"WEEKLY":g=this._dayNamesValue[new Date(s).getDay()].toUpperCase(),l.length-1!=l.indexOf(g)?(f.push(new Date(p).getTime()),s=this._weeklyDayFind(s,l)):(f.push(new Date(p).getTime()),s=new Date(s.setDate(s.getDate()+s.getDay()*-1)),s=new Date(s.setDate(s.getDate()+7*d-1)),s=this._weeklyDayFind(s,l));break;case"MONTHLY":if(f.push(new Date(p).getTime()),b)s=new Date(s.getFullYear(),s.getMonth()+d+1,0);else if(t.isNullOrUndefined(this._rRule.setPositions)){var w=new Date(s),y=new Date(w.setMonth(w.getMonth()+d)),C=new Date(y.getFullYear(),y.getMonth()+1,0),S=s.getFullYear()==y.getFullYear()?s.getMonth()+d:y.getMonth();S==y.getMonth()?s=y>C?new Date(C):new Date(y.setDate(this._rRule.monthDay)):(_=new Date(y.setMonth(y.getMonth()-1)),s=new Date(_.getFullYear(),_.getMonth()+1,0))}else s=new Date(s.getFullYear(),s.getMonth()+d,1);break;case"YEARLY":f.push(new Date(p).getTime()),s=new Date(s.setFullYear(s.getFullYear()+d))}if(a++,!t.isNullOrUndefined(this._rRule.count)&&a==this._rRule.count)break}}return f},recurrenceRuleSplit:function(i,s){var a,n,o,r,l,d;for(this._rRule={},n=s,o=i.split(";"),r=0;r0?(n.taskIdMapping.length>0&&n.parentTaskIdMapping.length>0?(t=this.dataSource().slice(0),i=[],e.each(t,function(e,t){i.push(jQuery.extend(!0,{},t))}),n.childMapping||(n.childMapping="Children"),a._reconstructDatasource(i),a._createGanttRecords(a.secondaryDatasource)):a._createGanttRecords(this.dataSource()),a._initialize()):a._initialize()},_initDataSource:function(){var t=this,i=t.model,a=this._columnToSelect(),t=this,n=this.dataSource().executeQuery(a);n.done(s.proxy(function(s){if(t._retrivedData=t.dataSource().dataSource.offline?t.dataSource().dataSource.json:s.result,i.taskIdMapping.length>0&&i.parentTaskIdMapping.length>0){var a=s.result.slice(0),n=[];e.each(a,function(e,t){n.push(jQuery.extend(!0,{},t))}),i.childMapping||(i.childMapping="Children"),t._reconstructDatasource(n)}else t._reconstructDatasource(s.result);t._createGanttRecords(t.secondaryDatasource),t._initialize()}))},_columnToSelect:function(){var e=this,t=e.model,i=s.Query();return t.query?t.query:i},_reconstructDatasource:function(e){for(var t,i=this,a=i.model,n=[],o=0;o0?(e[o][a.childMapping]=t,i.secondaryDatasource.push(e[o])):!s.isNullOrUndefined(e[o][a.parentTaskIdMapping])||t&&t.length>0?t&&t.length>0&&!s.isNullOrUndefined(t[0][a.parentTaskIdMapping])?i._appendChildDataItems(i.secondaryDatasource,t):s.isNullOrUndefined(e[o][a.parentTaskIdMapping])&&0==t.length&&i.secondaryDatasource.push(e[o]):i.secondaryDatasource.push(e[o]),t&&t.length>0?(i._datasourceChildItems=i._reconstructDatasource(t),s.isNullOrUndefined(e[o][a.childMapping])&&(e[o][a.childMapping]=i._datasourceChildItems,i._getParentIndex(e)),i._datasourceChildItems=[]):s.isNullOrUndefined(e[o][a.parentTaskIdMapping])||n.push(e[o]);if(n&&n.length>0)return n},_appendChildDataItems:function(e,t){for(var i=this,a=i.model,n=0;n0&&i._appendChildDataItems(e[n],t);s.isNullOrUndefined(e.length)&&e&&(e[a.taskIdMapping]===t[0][a.parentTaskIdMapping]?e[a.childMapping]=t:!s.isNullOrUndefined(e[a.childMapping])&&e[a.childMapping].length>0&&i._appendChildDataItems(e[a.childMapping],t))},_getParentIndex:function(e){var t,i,a=this,n=a.model,o=a.secondaryDatasource,r=0;for(e.length>0&&(r=e[0][n.parentTaskIdMapping]),i=0;i864e6?(n._minuteInterval=30,n._perDayWidth=48*n._perMinuteWidth):d>6048e5?(n._minuteInterval=15,n._perDayWidth=96*n._perMinuteWidth):d>1728e5?(n._minuteInterval=5,n._perDayWidth=288*n._perMinuteWidth):(n._minuteInterval=1,n._perDayWidth=1440*n._perMinuteWidth)}else i==a.OneMinute?(n._minuteInterval=1,n._perDayWidth=1440*n._perMinuteWidth):i==a.FiveMinutes?(n._minuteInterval=5,n._perDayWidth=288*n._perMinuteWidth):i==a.FifteenMinutes?(n._minuteInterval=15,n._perDayWidth=96*n._perMinuteWidth):i==a.ThirtyMinutes&&(n._minuteInterval=30,n._perDayWidth=48*n._perMinuteWidth);n._calculateHourSplit(r,l)}n.element.ejGantt("destroy").ejGantt(o),n._isTreeGridRendered=!1,n._isGanttChartRendered=!1},_updateGanttRecords:function(){for(var e,t,i,s=this,a=s.model,n=a.flatRecords,o=n.length,r=0;r864e6?(i._minuteInterval=30,i._perDayWidth=48*i._perMinuteWidth):o>6048e5?(i._minuteInterval=15,i._perDayWidth=96*i._perMinuteWidth):o>1728e5?(i._minuteInterval=5,i._perDayWidth=288*i._perMinuteWidth):(i._minuteInterval=1,i._perDayWidth=1440*i._perMinuteWidth)}else e==t.OneMinute?(i._minuteInterval=1,i._perDayWidth=1440*i._perMinuteWidth):e==t.FiveMinutes?(i._minuteInterval=5,i._perDayWidth=288*i._perMinuteWidth):e==t.FifteenMinutes?(i._minuteInterval=15,i._perDayWidth=96*i._perMinuteWidth):e==t.ThirtyMinutes&&(i._minuteInterval=30,i._perDayWidth=48*i._perMinuteWidth);i._localizedLabels=i._getLocalizedLabels(),i._setCultureInfo(),i.setColumns(model.columns&&model.columns.length?model.columns:i.createTreeGridColumns()),i._updateColumnLocaleText(),i._isRefreshAddedRecord=!1,i._isInAdd=!1,i._activeMenuItemId=null,i._isAddEditDialogSave=!1,i._milesStoneWidth=2*Math.floor((model.rowHeight-6)/2)+6},_updateColumnLocaleText:function(){var e,t=this.model,i=t.columns;if(i&&i.length>0)for(e=0;e=0&&t.selectedRowIndex()0){for(i=[],a=0;a"+d._columnHeaderTexts[c[l].field]+""),$inTr.append($inTd),$innerTable.append($inTr),$inTr2=s.buildTag("tr"),$inTd2=s.buildTag("td.e-editValue"),t=d._columns.indexOf(c[l]),s.TreeGrid._initCellEditType(p,$inTd2,d._id,t),$inTr2.append($inTd2),$innerTable.append($inTr2),$td.append($innerTable),$tr.append($td)):($table.append($tr),$tr=$tempTr=s.buildTag("tr"),l--):m=l);$table.append($tr),$tr=s.buildTag("tr"),h.predecessorMapping&&m!=-1&&($td=s.buildTag("td","",{"text-align":"left",padding:"10px 15px 0","font-weight":"normal",outline:"none"},{colspan:2,unselectable:"on"}),$innerTable=s.buildTag("table#"+d._id+"predecessoreditTable","",{width:"100%",outline:"none"},{unselectable:"on"}),$inTr3=s.buildTag("tr"),$inTd3=s.buildTag("td.editLabel","",{outline:"none"},{unselectable:"on"}),$inTd3.append(""),$inTr3.append($inTd3),$innerTable.append($inTr3),$inTr=s.buildTag("tr"),$inTd=s.buildTag("td.editLabel","",{outline:"none"},{unselectable:"on"}),$inTd.append(""+d._editDialogTexts.addPredecessor+"        "+d._editDialogTexts.removePredecessor+""),$inTr.append($inTd),$innerTable.append($inTr),$inTr2=s.buildTag("tr"),$inTd2=s.buildTag("td.e-editValue"),$preDiv=s.buildTag("div#treegrid"+d._id+"predecessoredit","",{width:"100%",height:"150px"},{}),$inTd2.append($preDiv),$inTr2.append($inTd2),$innerTable.append($inTr2),$td.append($innerTable),$tr.append($td),$table.append($tr)),$form.append($table),$form.appendTo(r),r=d.renderDiaglogButton($form,r),e.templates(d._id+"_JSONDialogEditingTemplate",r.html())}},addDialogTemplate:function(){var t,i,a,n,o,r,l,d=this,h=d.model,c=d._columns,u=c.length,h=d.model,m=-1,p=d._$treegridHelper.data("ejTreeGrid");if(d._mappingItems=d._getMappingItems(),0!=u){if(h.addDialogFields.length>0){for(i=[],a=0;a"+d._columnHeaderTexts[c[l].field]+""),$inTr.append($inTd),$innerTable.append($inTr),$inTr2=s.buildTag("tr"),$inTd2=s.buildTag("td.e-editValue"),t=d._columns.indexOf(c[l]),s.TreeGrid._initCellEditType(p,$inTd2,d._id,t,"Add"),$inTr2.append($inTd2),$innerTable.append($inTr2),$td.append($innerTable),$tr.append($td)):($table.append($tr),$tr=$tempTr=s.buildTag("tr"),l--):m=l);$table.append($tr),$tr=s.buildTag("tr"),h.predecessorMapping&&m!=-1&&($td=s.buildTag("td","",{"text-align":"left",padding:"10px 15px 0","font-weight":"normal",outline:"none"},{colspan:2,unselectable:"on"}),$innerTable=s.buildTag("table#"+d._id+"predecessoraddTable","",{width:"100%",outline:"none"},{unselectable:"on"}),$inTr3=s.buildTag("tr"),$inTd3=s.buildTag("td.editLabel","",{outline:"none"},{unselectable:"on"}),$inTd3.append(""),$inTr3.append($inTd3),$innerTable.append($inTr3),$inTr=s.buildTag("tr"),$inTd=s.buildTag("td.editLabel","",{outline:"none"},{unselectable:"on"}),$inTd.append(""+d._editDialogTexts.addPredecessor+"        "+d._editDialogTexts.removePredecessor+""),$inTr.append($inTd),$innerTable.append($inTr),$inTr2=s.buildTag("tr"),$inTd2=s.buildTag("td.e-editValue"),$preDiv=s.buildTag("div#treegrid"+d._id+"predecessorAdd","",{width:"100%",height:"150px"},{}),$inTd2.append($preDiv),$inTr2.append($inTd2),$innerTable.append($inTr2),$td.append($innerTable),$tr.append($td),$table.append($tr)),$form.append($table),$form.appendTo(r),r=d.renderDiaglogButton($form,r),e.templates(d._id+"_JSONDialogAddingTemplate",r.html())}},_clearContextMenu:function(){e(".e-contextmenu").remove(),e(".e-innerContextmenu").remove()},_createContextMenuTemplate:function(){var t,i,s,a=this,n={};n["_"+a._id+"getHeaderName"]=e.proxy(a._getHeaderName,a),e.views.helpers(n),t="
  • ",i="
    {{if iconPath}}
    {{else}}{{/if}}
    {{:headerText}}
    {{if ~_"+a._id+"getHeaderName(#data)}}
    {{/if}}",t+=i,t+="
  • ",s={},s[a._id+"contextMenuTemplate"]=t,e.templates(s)},_getHeaderName:function(e){var t=this._contextMenuItems.filter(function(t){if(null!=e.menuId&&e.menuId==t.parentMenuId)return!0});return t.length>0},initCellEditType:function(t,i,a){var n,o,r,l,d,h=this,c=h.model,u={};switch(n=a?a:"",s.isNullOrUndefined(t.editType)&&(t.editType="stringedit"),t.editType){case"stringedit":t.mappingName===c.predecessorMapping?(u["_"+h._id+"predecessor"]=h._getPredecessorsValue,e.views.helpers(u),i.html(s.buildTag("input.e-field e-ejinputtext","",{},{value:"{{:~_"+h._id+"predecessor('"+h._id+"Object','"+c.predecessorMapping+"','"+t.field+"')}}",id:h._id+t.field,name:t.field}))):i.html(s.buildTag("input.e-field e-ejinputtext","",{},{value:"{{:#data['"+t.field+"']}}",id:h._id+t.field+n,name:t.field,dialog:a}));break;case"booleanedit":i.html("{{if "+t.field+'}} {{else}} 0&&m.setDate(m.getDate()+duration-1);if(this.model.includeWeekend===!1&&(0==m.getDay()?m.setDate(m.getDate()+1):6==m.getDay()&&m.setDate(m.getDate()+2)),C&&C.length)for(p=0,g=C.length,p=0;p=v._getDateFromFormat(new Date(d),this.model.dateFormat)&&_<=m&&(m.setDate(m.getDate()+1),this.model.includeWeekend===!1&&(0==m.getDay()?m.setDate(m.getDate()+1):6==m.getDay()&&m.setDate(m.getDate()+2)));this.model.includeWeekend===!1&&(0==m.getDay()?m.setDate(m.getDate()+1):6==m.getDay()&&m.setDate(m.getDate()+2)),m=new Date(m),D&&(D.endDate=new Date(m)),w.dateFormat.indexOf("hh")!=-1?e(n).ejDateTimePicker("option","value",m):e(n).ejDatePicker("option","value",m)}else h=v._daydiff(new Date(T.startDate),new Date(D.startDate)),D.duration-=h}else if(y===x+"endDate"||y===x+"endDateAdd"){if(endDate=v._getDateFromFormat(i.value),endDate=v._onHoliDayCheck(endDate),this.model.includeWeekend===!1&&(0===endDate.getDay()?endDate.setDate(endDate.getDate()-2):6===endDate.getDay()&&endDate.setDate(endDate.getDate()-1)),endDate=new Date(endDate),D&&(D.endDate=new Date(endDate)),w.dateFormat.indexOf("hh")!=-1?e(n).ejDateTimePicker("option","value",endDate):e(n).ejDatePicker("option","value",endDate),!d||isNaN(duration))return;if(d=v._getDateFromFormat(d),endDate=v._getDateFromFormat(endDate),d.getTime()<=endDate.getTime()){for(c=0,h=v._daydiff(v._getDateFromFormat(d),v._getDateFromFormat(endDate)),offset=this.model.includeWeekend===!1?v._calculateDateDifference(new Date(d),h)+1:h+1,u=0;u=new Date(d)&&v._getDateFromFormat(C[u].day)<=new Date(endDate)&&offset--;c=offset,D&&(D.duration=c),e(o).ejNumericTextbox("option","value",c)}else D&&(D.endDate=this._getDateFromFormat(i.prevDate)),w.dateFormat.indexOf("hh")!=-1?e(n).ejDateTimePicker("option","value",i.prevDate):e(n).ejDatePicker("option","value",i.prevDate)}else if(y===x+"duration"||y===x+"durationAdd"){if(d=v._getDateFromFormat(d),m=new Date(d),!endDate||!d)return;if(duration=i.value,this.model.includeWeekend===!1)for(u=1;u0&&m.setDate(m.getDate()+duration-1);if(this.model.includeWeekend===!1&&(0==m.getDay()?m.setDate(m.getDate()+1):6==m.getDay()&&m.setDate(m.getDate()+2)),C&&C.length)for(p=0,g=C.length,p=0;p=v._getDateFromFormat(d,this.model.dateFormat)&&_<=m&&(m.setDate(m.getDate()+1),this.model.includeWeekend===!1&&(0==m.getDay()?m.setDate(m.getDate()+1):6==m.getDay()&&m.setDate(m.getDate()+2)));this.model.includeWeekend===!1&&(0==m.getDay()?m.setDate(m.getDate()+1):6==m.getDay()&&m.setDate(m.getDate()+2)),m=new Date(m),D&&(D.endDate=new Date(m),D.duration=duration),w.dateFormat.indexOf("hh")!=-1?e(n).ejDateTimePicker("option","value",m):e(n).ejDatePicker("option","value",m)}else y===x+"baselineStartDateAdd"?e(l).length>0&&(f=v._getDateFromFormat(e(r).val()),b=v._getDateFromFormat(e(l).val()),f&&b&&f.getTime()>b.getTime()&&(w.dateFormat.indexOf("hh")!=-1?e(r).ejDateTimePicker("option","value",i.prevDate):e(r).ejDatePicker("option","value",i.prevDate))):y===x+"baselineEndDateAdd"&&e(r).length>0&&(f=v._getDateFromFormat(e(r).val()),b=v._getDateFromFormat(e(l).val()),f&&b&&f.getTime()>b.getTime()&&(w.dateFormat.indexOf("hh")!=-1?e(l).ejDateTimePicker("option","value",i.prevDate):e(l).ejDatePicker("option","value",i.prevDate)))},_taskNameCollection:function(){var e,t,i,s=this,a=s.model.flatRecords,n=[];for(idsCollection=[],s._preTableCollection=[],e=0;e0&&(a=i.value.split("-"),n=e.map(l._preTableCollection[1],function(e){if(e.id===a[0])return e.id}),n=n[0],h.id=n,h.name=i.value,r=d.indexOf(h.item),r===-1&&(d.push(h.item),r=d.indexOf(h.item)),d[r].id=n,d[r].name=i.value),"id"===i.columnName&&i.value.length>0&&(o=e.map(l._preTableCollection[0],function(e){if(e.value===i.value)return e.id}),o=o[0],h.name=o,h.id=n,r=d.indexOf(h.item),r===-1&&(d.push(h.item),r=d.indexOf(h.item)),d[r].name=o),h.type||s.isNullOrUndefined(r)||(h.type="Finish-Start",d[r].type="Finish-Start"),e(t).ejTreeGrid("refreshRow",i.model.selectedRowIndex),e(t).ejTreeGrid("selectRows",i.model.selectedRowIndex),l.enbleDisableAddPreButton("enable"))},_deleteDisableEnable:function(){var t=this;e(".e-deletepre").unbind("click",e.proxy(t._deletepredecessor,t)),e(".e-deletepre").bind("click",e.proxy(t._deletepredecessor,t)),e(".e-deletepre").removeClass("e-disable"),e(".e-deletepre").addClass("e-enable")},_predecessorEditCollection:function(){var e,t,i,a,n,o,r,l,d,h,c,u,m=this,p=m.model,g=[];if(t="#"+m._id+"predecessor",i=[{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"}],g=[],a=p.selectedItem,m._taskNameCollection(),e=m._preTableCollection[1],!s.isNullOrUndefined(a)&&!s.isNullOrUndefined(a.predecessor)&&!s.isNullOrUndefined(a.item[p.predecessorMapping])){var _=a.predecessor,f=_.length,b=i.length,v=e.length;for(n=0;n0&&(e(n).find("#"+C._id+"predecessoraddTable").parent()[0].hidden=!0),u=C.model.flatRecords.length,u=C._getNewTaskId(u),C.model.enableWBS&&(g=I.editSettings.rowPosition.toLowerCase(),_=C._getNewWBSid(g))):(n=document.getElementById(C._id+"EditForm"),p="#treegrid"+C._id+"predecessoredit",I.flatRecords.length<=2&&1==I.parentRecords.length&&I.predecessorMapping&&e(p).length>0&&(e(n).find("#"+C._id+"predecessoreditTable").parent()[0].hidden=!0)),i=e(n).find("input,select"),o=i.length,T;T0&&(c=new RegExp("\\{0(:([^\\}]+))?\\}","gm"),m=c.exec(h.format),k.dateFormat=m[2],k.value=s.format(new Date(k.value),k.dateFormat),r.val(k.value)),s.isNullOrUndefined(h.editParams)||e.extend(k,h.editParams),r.ejDatePicker(k);else if(r.hasClass("e-datetimepicker"))k={width:D,rtl:I.rtl,locale:I.locale,cssClass:I.css,dateTimeFormat:I.dateFormat},k.value=r.val().length?C._getDateFromFormat(r.val()):C._getDateFromFormat(I.scheduleStartDate),h.format!==a&&h.format.length>0&&(c=new RegExp("\\{0(:([^\\}]+))?\\}","gm"),m=c.exec(h.format),k.dateTimeFormat=m[2],k.value=s.format(new Date(r.val()),k.dateTimeFormat),r.val(k.value)),s.isNullOrUndefined(h.editParams)||e.extend(k,h.editParams),r.ejDateTimePicker(k);else if(r.hasClass("e-dropdownlist"))f=h.dropdownData,"resourceInfo"===h.field?r.ejDropDownList({cssClass:I.cssClass,width:D,showCheckbox:!0,dataSource:f,fields:{id:I.resourceIdMapping,text:I.resourceNameMapping,value:I.resourceNameMapping},selectedItems:"add"==t.requestType?C._getResourceInfoIndex(t.data.resourceInfo,I.resources):C.getIndexofresourceInfo(f,t.data)}):(x={},x.cssClass=I.cssClass,x.width=D,x.dataSource=f,s.isNullOrUndefined(h.editParams)||e.extend(x,h.editParams),r.ejDropDownList(x),b=r.ejDropDownList("instance"),b._setValue(r.attr("cellValue")));else if(r.hasClass("e-maskedit"))x={},x.locale=I.locale,x.cssClass=I.cssClass,x.width=D,s.isNullOrUndefined(h.editParams)||e.extend(x,h.editParams),r.ejMaskEdit(x);else switch(r.prop("tagName")){case"INPUT":"checkbox"!=r.attr("type")?("taskId"===r.attr("name")?"add"!==t.requestType?(r.attr("readonly","readonly"),r.css("opacity",.5)):"add"===t.requestType&&r.val(u):"taskName"===r.attr("name")&&"add"===t.requestType?""==t.data.taskName||s.isNullOrUndefined(t.data.taskName)?r.val(C._newTaskTexts.newTaskName+" "+u):r.val(t.data.taskName):"WBS"===r.attr("name")?"add"!==t.requestType?r.attr("readonly","readonly").css("opacity",.5):"add"===t.requestType&&(r.val(_), r.attr("readonly","readonly").css("opacity",.5)):"WBSPredecessor"===r.attr("name")&&r.attr("readonly","readonly").css("opacity",.5),v=r[0].id,v=v.replace(C._id,""),r.css("text-align",null!=r.attr("name")&&null!=s.TreeGrid.getColumnByField(C._columns,r.prop("name"))?s.TreeGrid.getColumnByField(C._columns,r.attr("name")).textAlign:"center"),r.outerWidth(D).height(25)):(x={},x.cssClass=I.cssClass,x.size="medium",s.isNullOrUndefined(h.editParams)||e.extend(k,h.editParams),r.ejCheckBox(x));break;case"SELECT":r.width(D).height(23)}r.is(":disabled")||S||r.is(":hidden")&&"object"!=typeof r.data("ejDropDownList")||C._isEnterKeyPressed||(C._focusElements(r.closest("td")),S=!0)}I.predecessorMapping&&e(p).length&&(w=[{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"}],y=[],"add"!==t.requestType&&(y=C._predecessorEditCollection()),C._taskNameCollection(),e(p).ejTreeGrid({dataSource:y,allowSorting:!1,allowAdding:!0,columns:[{headerText:C._columnHeaderTexts.taskId,field:"id",editType:s.TreeGrid.EditingType.Dropdown,dropdownData:C._preTableCollection[0],width:"50px"},{headerText:C._columnHeaderTexts.taskName,field:"name",editType:s.TreeGrid.EditingType.Dropdown,dropdownData:C._preTableCollection[1],width:"170px"},{headerText:C._columnHeaderTexts.type,field:"type",editType:s.TreeGrid.EditingType.Dropdown,dropdownData:w,width:"80px"},{headerText:C._columnHeaderTexts.offset,field:"offset",editType:s.TreeGrid.EditingType.Numeric,width:"50px"}],enableAltRow:!0,allowColumnResize:!0,editSettings:{allowAdding:!0,allowDeleting:!0,allowEditing:!0,editMode:"cellEditing"},locale:I.locale,endEdit:e.proxy(C._preEndEdit,C,p),beginEdit:e.proxy(C._preBeginEdit,C),rowSelected:e.proxy(C._deleteDisableEnable,C),treeColumnIndex:5,predecessorTable:C._isFromGantt}),I.selectedItem&&I.selectedItem.hasChildRecords&&"add"!==t.requestType?(C.enbleDisableDeletePreButton("disable"),C.enbleDisableAddPreButton("disable")):(C.enbleDisableDeletePreButton("disable"),C.enbleDisableAddPreButton("enable")))},enbleDisableDeletePreButton:function(t){var i=this;"enable"===t?(e(".e-deletepre").unbind("click",e.proxy(i._deletepredecessor,i)),e(".e-deletepre").bind("click",e.proxy(i._deletepredecessor,i)),e(".e-deletepre").addClass("e-enable"),e(".e-deletepre").removeClass("e-disable")):(e(".e-deletepre").unbind("click",e.proxy(i._deletepredecessor,i)),e(".e-deletepre").addClass("e-disable"),e(".e-deletepre").removeClass("e-enable"))},enbleDisableAddPreButton:function(t){var i=this;"enable"===t?(e(".e-addpre").unbind("click",e.proxy(i._addpredecessor,i)),e(".e-addpre").bind("click",e.proxy(i._addpredecessor,i)),e(".e-addpre").addClass("e-enable"),e(".e-addpre").removeClass("e-disable")):(e(".e-addpre").unbind("click",e.proxy(i._addpredecessor,i)),e(".e-addpre").addClass("e-disable"),e(".e-addpre").removeClass("e-enable"))},_disableAddButton:function(t){var i,s,a=this,n=e(t+"e-table"),o=!1,r=n[0].rows.length;for(a.enbleDisableAddPreButton("disable"),i=0;i-1){if(h)h.indexOf("%")!=-1?(t=parseInt(h),c=!0):(t=parseInt(h)/d*100,c=!1);else{for(a=r.getColumns(),n=0,columnIndex=u,columnIndex>=a.length&&(columnIndex=a.length-1),o=0;o<=columnIndex;o++)n+=a[o].width;if(n<=d)t=parseInt(n)/d*100,u=o-1;else for(n=0,o=0;o<=columnIndex;o++){if(!(n+a[o].width<=d)){t=parseInt(n)/d*100;break}n+=a[o].width,u=o}l.splitterSettings.index=u}(isNaN(t)||t<0)&&(t=0),t>100&&(t=(2*r._commonColumnWidth+3)/d*100,t=t<30?t:30,c=!0)}else t=(2*r._commonColumnWidth+3)/d*100,t=t<30?t:30,c=!0;i=100-t-900/d,i<=0?(c?r.splitterPosition("100%"):r.splitterPosition(d.toString()),t=100-900/d,i=0):i>0&&(c?r.splitterPosition(Math.round(t)+"%"):r.splitterPosition(Math.round(t*d/100).toString())),r._splitterPosition(r.splitterPosition()),e("#e-ejSpliter"+r._id).ejSplitter({height:r._ganttHeight,width:d,orientation:s.Orientation.Horizontal,properties:[{paneSize:t+"%",collapsible:!1},{paneSize:i+"%",collapsible:!1}],enableAutoResize:!1,resize:e.proxy(r._onResize,r)})},_renderTreeGrid:function(){var t=this,i=t.model;t._$treegridHelper=e("#ejTreeGrid"+t._id).ejTreeGrid({enableAltRow:i.enableAltRow,allowColumnResize:i.allowColumnResize,enableVirtualization:i.enableVirtualization,allowSorting:i.allowSorting,showColumnChooser:i.showColumnChooser,showColumnOptions:i.showColumnOptions,allowMultiSorting:i.allowMultiSorting,sortSettings:i.sortSettings,allowSelection:i.allowSelection,selectionType:"cell"==i.selectionMode?i.selectionType:"single",selectionMode:i.selectionMode,selectedRowIndex:this.selectedRowIndex(),allowDragAndDrop:i.allowDragAndDrop,dragTooltip:i.dragTooltip,allowSearching:i.allowSearching,parentIdMapping:i.parentTaskIdMapping,allowKeyboardNavigation:i.allowKeyboardNavigation,cssClass:i.cssClass,locale:i.locale,columns:t.getColumns(),editSettings:i.editSettings,toolbarSettings:i.toolbarSettings,rowTemplate:i.rowTemplate,rowDataBound:i.rowDataBound,queryCellInfo:i.queryCellInfo,cellSelecting:i.cellSelecting,cellSelected:i.cellSelected,selectedCellIndexes:this.selectedCellIndexes(),dataSource:this.dataSource(),flatRecords:i.flatRecords,parentRecords:i.parentRecords,ids:t.model.ids,columns:t._columns,dateFormat:i.dateFormat,resourceInfoMapping:i.resourceInfoMapping,resourceNameMapping:i.resourceNameMapping,resourceIdMapping:i.resourceIdMapping,taskIdMapping:i.taskIdMapping,showGridCellTooltip:i.showGridCellTooltip,cellTooltipTemplate:i.cellTooltipTemplate,showGridExpandCellTooltip:i.showGridExpandCellTooltip,taskNameMapping:i.taskNameMapping,startDateMapping:i.startDateMapping,endDateMapping:i.endDateMapping,childMapping:i.childMapping,durationMapping:i.durationMapping,progressMapping:i.progressMapping,predecessorMapping:i.predecessorMapping,rowHeight:i.rowHeight,emptyRecordText:t._emptyRecordText,isFromGantt:t._isFromGantt,treeColumnIndex:i.treeColumnIndex,workingTimeScale:i.workingTimeScale,enableWBS:i.enableWBS,enableWBSPredecessor:i.enableWBSPredecessor,columnMenuTexts:t._columnMenuTexts,columnDialogTitle:t._columnDialogTitle,deleteColumnText:t._deleteColumnText,okButtonText:t._okButtonText,cancelButtonText:t._cancelButtonText,confirmDeleteText:t._confirmDeleteText,columnDialogFields:i.columnDialogFields,columnDialogTexts:t._columnDialogTexts,dataManagerUpdate:{isDataManagerUpdate:t._isDataManagerUpdate,jsonData:t._jsonData}})},_renderGanttChart:function(){var t=this,i=this.model;t._$ganttchartHelper=e("#ejGanttChart"+t._id).ejGanttChart({dataSource:this.dataSource(),scheduleStartDate:i.scheduleStartDate,scheduleEndDate:i.scheduleEndDate,startDateMapping:i.startDateMapping,endDateMapping:i.endDateMapping,progressMapping:i.progressMapping,durationMapping:i.durationMapping,childPropertyName:i.childMapping,predecessorMapping:i.predecessorMapping,enableVirtualization:i.enableVirtualization,highlightWeekends:i.highlightWeekends,milestoneMapping:i.milestoneMapping,enableRowHover:i.enableRowHover,perDayWidth:t._perDayWidth,workingTimeScale:i.workingTimeScale,roundOffDayworkingTime:i.roundOffDayworkingTime,durationUnit:i.durationUnit,perMonthWidth:t._perMonthWidth,perWeekWidth:t._perWeekWidth,perHourWidth:t._perHourWidth,perMinuteWidth:t._perMinuteWidth,perTopHourWidth:t._perTopHourWidth,minuteInterval:t._minuteInterval,includeWeekend:i.includeWeekend,connectorlineWidth:i.connectorlineWidth,scheduleHeaderSettings:i.scheduleHeaderSettings,taskbarBackground:i.taskbarBackground,progressbarBackground:i.progressbarBackground,connectorLineBackground:i.connectorLineBackground,parentTaskbarBackground:i.parentTaskbarBackground,parentProgressbarBackground:i.parentProgressbarBackground,holidays:i.holidays,dateFormat:i.dateFormat,locale:i.locale,enableTaskbarTooltip:i.enableTaskbarTooltip,enableTaskbarDragTooltip:i.enableTaskbarDragTooltip,flatRecords:i.flatRecords,parentRecords:i.parentRecords,scheduleWeeks:t._scheduleWeeks,projectStartDate:t._projectStartDate,projectEndDate:t._projectEndDate,scheduleYears:t._scheduleYears,scheduleMonths:t._scheduleMonths,scheduleDays:t._scheduleDays,scheduleHours:t._scheduleHours,progressbarHeight:i.progressbarHeight,tooltipTemplate:i.taskbarTooltipTemplate,tooltipTemplateId:i.taskbarTooltipTemplateId,progressbarTooltipTemplate:i.progressbarTooltipTemplate,progressbarTooltipTemplateId:i.progressbarTooltipTemplateId,queryTaskbarInfo:i.queryTaskbarInfo,showTaskNames:i.showTaskNames,showProgressStatus:i.showProgressStatus,showResourceNames:i.showResourceNames,resourceInfoMapping:i.resourceInfoMapping,resourceNameMapping:i.resourceNameMapping,enableProgressBarResizing:i.enableProgressBarResizing,allowGanttChartEditing:i.allowGanttChartEditing,taskbarEditingTooltipTemplateId:i.taskbarEditingTooltipTemplateId,taskbarEditingTooltipTemplate:i.taskbarEditingTooltipTemplate,ids:t.model.ids,stripLines:i.stripLines,_predecessorCollection:t._predecessorsCollection,weekendBackground:i.weekendBackground,allowKeyboardNavigation:i.allowKeyboardNavigation,updatedRecords:t.model.updatedRecords,renderBaseline:i.renderBaseline,baselineColor:i.baselineColor,editSettings:i.editSettings,columnHeaderTexts:t._columnHeaderTexts,durationUnitTexts:t._durationUnitTexts,predecessorEditingTexts:t._predecessorEditingTexts,localizedDays:t._days,localizedMonths:t._months,rowHeight:i.rowHeight,allowSelection:i.allowSelection,selectionMode:i.selectionMode,taskbarTemplate:i.taskbarTemplate,parentTaskbarTemplate:i.parentTaskbarTemplate,milestoneTemplate:i.milestoneTemplate})},createTreeGridColumns:function(){var e,t=this,i=t.model,a=[],n=i.taskIdMapping;return n.length&&(e=i.showColumnChooser?{field:"taskId",headerText:t._columnHeaderTexts.taskId,width:40,editType:s.Gantt.EditingType.String,mappingName:n,allowCellSelection:!0}:{field:"taskId",headerText:t._columnHeaderTexts.taskId,width:30,editType:s.Gantt.EditingType.String,mappingName:n,allowCellSelection:!0},a.push(e)),n=i.taskNameMapping,n.length&&(e={field:"taskName",headerText:t._columnHeaderTexts.taskName,width:150,editType:s.Gantt.EditingType.String,mappingName:n,allowCellSelection:!0},a.push(e)),n=i.startDateMapping,n.length&&(e={field:"startDate",headerText:t._columnHeaderTexts.startDate,width:150,editType:i.dateFormat.indexOf("hh")==-1?s.Gantt.EditingType.DatePicker:s.Gantt.EditingType.DateTimePicker,mappingName:n,allowCellSelection:!0,format:"{0:"+i.dateFormat+"}"},a.push(e)),n=i.endDateMapping,n.length&&(e={field:"endDate",headerText:t._columnHeaderTexts.endDate,width:150,editType:i.dateFormat.indexOf("hh")==-1?s.Gantt.EditingType.DatePicker:s.Gantt.EditingType.DateTimePicker,mappingName:n,allowCellSelection:!0,format:"{0:"+i.dateFormat+"}"},a.push(e)),n=i.resourceInfoMapping,n.length&&(e={field:"resourceInfo",headerText:t._columnHeaderTexts.resourceInfo,width:150,editType:s.Gantt.EditingType.Dropdown,mappingName:n,allowCellSelection:!0,dropdownData:i.resources},a.push(e)),n=i.durationMapping,n.length&&(e={field:"duration",headerText:t._columnHeaderTexts.duration,width:150,editType:s.Gantt.EditingType.Numeric,allowCellSelection:!0,mappingName:n},a.push(e)),n=i.progressMapping,n.length&&(e={field:"status",headerText:t._columnHeaderTexts.status,width:150,editType:s.Gantt.EditingType.Numeric,mappingName:n,allowCellSelection:!0},a.push(e)),n=i.predecessorMapping,n.length&&(e={field:"predecessor",headerText:t._columnHeaderTexts.predecessor,width:150,editType:s.Gantt.EditingType.String,mappingName:n,allowCellSelection:!0},a.push(e)),i.renderBaseline&&i.baselineStartDateMapping&&i.baselineEndDateMapping&&(n=i.baselineStartDateMapping,n.length&&(e={field:"baselineStartDate",headerText:t._columnHeaderTexts.baselineStartDate,width:150,editType:i.dateFormat.indexOf("hh")==-1?s.Gantt.EditingType.DatePicker:s.Gantt.EditingType.DateTimePicker,mappingName:n,format:"{0:"+i.dateFormat+"}",allowEditing:!1,allowCellSelection:!0},a.push(e)),n=i.baselineEndDateMapping,n.length&&(e={field:"baselineEndDate",headerText:t._columnHeaderTexts.baselineEndDate,width:150,editType:i.dateFormat.indexOf("hh")==-1?s.Gantt.EditingType.DatePicker:s.Gantt.EditingType.DateTimePicker,mappingName:n,format:"{0:"+i.dateFormat+"}",allowEditing:!1,allowCellSelection:!0},a.push(e))),i.enableWBS&&(n="WBS",n.length&&(e={field:"WBS",headerText:t._columnHeaderTexts.WBS,width:150,editType:s.Gantt.EditingType.String,allowEditing:!1,mappingName:n},a.push(e))),i.enableWBS&&i.enableWBSPredecessor&&(n="WBSPredecessor",n.length&&(e={field:"WBSPredecessor",headerText:t._columnHeaderTexts.WBSPredecessor,width:150,editType:s.Gantt.EditingType.String,allowEditing:!1,mappingName:n},a.push(e))),a},_createGanttRecords:function(e){var t,i=this,s=i.model,n=s.flatRecords,o=e.length,r=0,l=s.parentRecords,d=(s.allowSorting,s.enableAltRow,i.model.ids);for(r;r0||t?(e.each(d,function(e,t){a=new Date(t.startDate),n=new Date(t.endDate),baseLineStartDate=t.baselineStartDate?new Date(t.baselineStartDate):null,baseLineEndDate=t.baselineEndDate?new Date(t.baselineEndDate):null,i?(i.getTime()>=a.getTime()&&(i=a),baseLineStartDate&&l.renderBaseline&&i.getTime()>=baseLineStartDate.getTime()&&(i=baseLineStartDate)):i=baseLineStartDate&&l.renderBaseline&&a.getTime()>=baseLineStartDate.getTime()?baseLineStartDate:a,s?(s.getTime()<=n.getTime()&&(s=n),baseLineEndDate&&l.renderBaseline&&s.getTime()<=baseLineEndDate.getTime()&&(s=baseLineEndDate)):s=baseLineEndDate&&l.renderBaseline&&n.getTime()<=baseLineEndDate.getTime()?baseLineEndDate:n}),o=r._updateScheduleDatesByTaskLables(i,s),i=o.minStartDate,s=o.maxEndDate):l.scheduleEndDate&&l.scheduleStartDate||0!==d.length||(i=r._getDateFromFormat(new Date),s=r._getDateFromFormat(new Date(i)),s.setDate(s.getDate()+20)),t?(t.minStartDate=i,t.maxEndDate=s):(l.scheduleStartDate=i?r.getFormatedDate(i):l.scheduleStartDate,l.scheduleEndDate=s?r.getFormatedDate(s):l.scheduleEndDate)},_updateScheduleDatesByTaskLables:function(e,t){var i,a=this,n=this.model,o=n.scheduleHeaderSettings.scheduleHeaderType,r=s.Gantt.ScheduleHeaderType,l=a._getResourceStringWidth(),d={},h=n.scheduleEndDate&&this._getDateFromFormat(n.scheduleEndDate);return o==r.Week&&(n.scheduleEndDate&&h.getTime()===t.getTime()||(i=l>0?l/a._perDayWidth+7:7,t.setDate(t.getDate()+i))),o==r.Year&&(n.scheduleEndDate&&h.getTime()===t.getTime()||(i=l>0?l/a._perMonthWidth+1:1,t.setMonth(t.getMonth()+i))),o==r.Month&&(n.scheduleEndDate&&h.getTime()===t.getTime()||(i=l>0?l/a._perDayWidth+7:7,t.setDate(t.getDate()+i))),o==r.Day&&(n.scheduleEndDate&&h.getTime()===t.getTime()||(i=l>0?l/a._perHourWidth+7:7,t.setHours(t.getHours()+i))),o==r.Hour&&(n.scheduleEndDate&&h.getTime()===t.getTime()||(numOfHours=l>0?l/a._perMinuteWidth+5:5,t.setHours(t.getHours()+numOfHours),e.setHours(e.getHours()-1))),d=a._updateScheduleDatesByStripLines(e,t),e=d.startDate,t=d.endDate,d=a._updateScheduleDatesByHolidays(e,t),e=d.startDate,t=d.endDate,d.minStartDate=e,d.maxEndDate=t,d},_updateScheduleDatesByHolidays:function(t,i){var s=this,a=(this.model,{});return s._holidaysList.length>0&&e.each(s._holidaysList,function(e,s){s.getTime()>t.getTime()&&s.getTime()0&&e.each(a.stripLines,function(e,a){var n=s._getDateFromFormat(a.day);n.getTime()>t.getTime()&&n.getTime()0&&n.showResourceNames){for(i=0;i0?d[0]:e):r.item=e,r.isSelected=!1,r.level=t,r.endDate&&s.isNullOrUndefined(r.duration)||r._calculateEndDate(c.includeWeekend,this._holidaysList,c,h._perDayWidth),r.left=r._calculateLeft(h._projectStartDate,h._perDayWidth,h._holidaysList,c),""==r.baselineStartDate||""==r.baselineEndDate||s.isNullOrUndefined(r.baselineStartDate)||s.isNullOrUndefined(r.baselineEndDate)||r.baselineStartDate.getTime()>r.baselineEndDate.getTime()&&(r.baselineEndDate=new Date(r.baselineStartDate)),r.baselineLeft=r._calculateBaselineLeft(h._projectStartDate,h._perDayWidth,c.includeWeekend,c.dateFormat,c.endDateMapping,h._holidaysList),o||(r.width=r._calculateWidth(h._perDayWidth,h._holidaysList,c),r.width=1==r.isMilestone?h._milesStoneWidth:r.width,r.progressWidth=r._calculateProgressWidth(r.width,_),r.baselineStartDate&&r.baselineEndDate&&(r.baselineWidth=r._calculateBaseLineWidth(h._perDayWidth,c))),r.childRecords=p&&p.length>0&&h._createChildRecords(p,t+1,r),r.hasChildRecords=!!(p&&p.length>0),r.isMilestone=!r.hasChildRecords&&r.isMilestone,r.expanded=n!==a?n:!!p&&p.length>0,c.enableVirtualization===!1&&(r.isExpanded=!0),x&&h._predecessorsCollection.push(r),r},_updateResourceName:function(e){var t,i,s=e.resourceInfo,a=[];if(s){for(t=s.length,e.item?e.item[this.model.resourceInfoMapping]=[]:null,i=0;i0){for(e=0;e0){var t=this._holidaysList,i=[],a=t.length;if(a>0){for(e=0;et));i._projectStartDate=new Date(i._scheduleWeeks[0]),i._projectEndDate=new Date(i._scheduleWeeks[i._scheduleWeeks.length-1])},_calculateYearSplit:function(e,t){var i,s,a=this;e.setMonth(0),e.setDate(1);do a._scheduleYears.push(new Date(e)),e.setMonth(e.getMonth()+12);while(!(e>=t));i=new Date(a._scheduleYears[0].getFullYear(),0,1),s=new Date(a._scheduleYears[a._scheduleYears.length-1].getFullYear(),11,31),a._projectStartDate=i,a._projectEndDate=s},_calculateDaySplit:function(e,t){var i=this;e.setHours(0);do i._scheduleDays.push(new Date(e)),e.setDate(e.getDate()+1);while(e<=t);i._projectStartDate=new Date(i._scheduleDays[0]),i._projectEndDate=new Date(i._scheduleDays[i._scheduleDays.length-1])},_calculateHourSplit:function(e,t){var i=this;e.setMinutes(0);do i._scheduleHours.push(new Date(e)),e.setHours(e.getHours()+1);while(e<=t);i._projectStartDate=new Date(i._scheduleHours[0]),i._projectEndDate=new Date(i._scheduleHours[i._scheduleHours.length-1])},_calculateMonthSplit:function(e,t){var i,s,a=this;dt=new Date(e.getFullYear(),e.getMonth()-1,1),e=dt;do a._scheduleMonths.push(new Date(e)),0==e.getMonth()||2==e.getMonth()||4==e.getMonth()||6==e.getMonth()||7==e.getMonth()||9==e.getMonth()||11==e.getMonth()?e.setDate(e.getDate()+31):3==e.getMonth()||5==e.getMonth()||8==e.getMonth()||10==e.getMonth()?e.setDate(e.getDate()+30):1==e.getMonth()&&(e.getFullYear()%4==0?e.setDate(e.getDate()+29):e.setDate(e.getDate()+28));while(!(e>=t));i=new Date(a._scheduleMonths[0]),s=new Date(a._scheduleMonths[a._scheduleMonths.length-1]),s=new Date(s.getFullYear(),s.getMonth()+1,0),a._projectStartDate=i,a._projectEndDate=s},_updatePredecessors:function(){var e,t,i,s,a,n=this,o=0,r=n._predecessorsCollection,l=r.length,d=0;for(o;o0&&(i._$treegridHelper.ejTreeGrid("cancelEditCell"),i._isinBeginEdit=!1),s=a.indexOf("%")!=-1,s?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)},clickHandler:function(t){var i=this,s=e(t.target);i._clearContextMenu(),s.hasClass("e-vhandle")||s.hasClass("e-vscrollbar")||s.hasClass("e-vup")||s.hasClass("e-vhandlespace")||s.hasClass("e-vdown")||s.hasClass("e-hhandle")||s.hasClass("e-hscrollbar")||s.hasClass("e-hup")||s.hasClass("e-hdown")||s.hasClass("e-hhandlespace")||(i._isinBeginEdit&&(s.closest("td").hasClass("e-editedcell")||s.hasClass("e-date")||s.hasClass("e-arrow")||s.hasClass("e-down-arrow")||0!=s.closest("form#ejTreeGrid"+i._id+"EditForm").length||!(e("#ejTreeGrid"+i._id+"EditForm").length>0)||(i._$treegridHelper.ejTreeGrid("saveCell"),i._isinBeginEdit=!1)),i.clearColumnMenu())},windowResize:function(){var t,i,a,n,o,r,l,d,h,c,u,m,p,g=this,_="#e-ejSpliter"+this._id,f="#"+this._id+"_toolbarItems",b="#ejGanttChart"+this._id,v="#ejTreeGrid"+this._id,x=".e-ganttviewerbodyContianer",w=".e-ganttviewerheaderContainer",y="#ejTreeGrid"+this._id,C="#ejTreeGrid"+this._id+"e-gridcontent",S=g.model.sizeSettings.width,T=g.model.sizeSettings.height,D=g.element[0].style.height,I=g.element[0].style.width;S&&"number"!=typeof S&&S.indexOf("%")!=-1||I.indexOf("%")!=-1?(h=S?S:I,n=e(g.element).parent().width()?e(g.element).parent().width():e(g.element).width(),t=n/100*parseInt(h)):t=e(g.element).width(),g.splitterPosition().indexOf("%")==-1?(o=parseInt(g.splitterPosition())+7+2,g._ganttWidth=t=Math.max(t,o)):g._ganttWidth=t,T&&"number"!=typeof S&&T.indexOf("%")!=-1||D.indexOf("%")!=-1?(r=T?T:D,l=e(g.element).parent().height()?e(g.element).parent().height():e(g.element).height(),d=e(g.element).parent().height()?l/100*parseInt(r):e(g.element).height(),i=d):i=e(g.element).height(),i-=g._totalBorderHeight,t=Math.round(t),e(_).css("width",t),e(_).css("height",i-e(f).height()),e(_).ejSplitter("refresh"),e(f).css("width",t),e(f).children(".e-ul:first-child").css("width",t),h=e(b).width(),c=e(v).width(),e(b).height(i-e(f).height()),u=e(x).ejScroller("option","scrollTop"),m=e(x).ejScroller("option","scrollLeft"),e(x).ejScroller({width:h,height:i-e(f).height()-e(w).height()-parseInt(e(w).css("border-bottom-width"))}),e(x).ejScroller("refresh"),a=g._$ganttchartHelper.ejGanttChart("getMaxScrollWidth"),m>a&&(m=a>0?a:0),e(x).ejScroller("option","scrollTop",u),e(x).ejScroller("option","scrollLeft",m),e(y).height(i-e(f).height()),e(C).height(i-e(f).height()-e(w).height()-g._totalBorderHeight),m=e(C).ejScroller("option","scrollLeft"),e(C).width(c),e(C).ejScroller("refresh"),a=g._$treegridHelper.ejTreeGrid("getMaxScrollWidth"),m>a&&(m=a>0?a:0),e(C).ejScroller("option","scrollLeft",m),g._$treegridHelper.ejTreeGrid("updateViewPortHeight"),g._$ganttchartHelper.ejGanttChart("updateViewPortHeight"),g.model.enableVirtualization&&(g._$treegridHelper.ejTreeGrid("cancelRowEditCell"),g._$treegridHelper.ejTreeGrid("processBindings"),p={},p.requestType=s.TreeGrid.Actions.Refresh,g._$treegridHelper.ejTreeGrid("sendDataRenderingRequest",p),g._$ganttchartHelper.ejGanttChart("refreshHelper",g.model.currentViewData,g.model.updatedRecords),g._$ganttchartHelper.ejGanttChart("onScrollHelper",u)),g.setSplitterPosition(g.splitterPosition())},_rightClick:function(t){t.preventDefault();var i,s,a,n,o,r=this,l=e(t.target),d=l.closest("tr"),h={};r._$treegridHelper.ejTreeGrid("disableTooltip"),r.clearColumnMenu(),e(d).hasClass("e-chartcell")||e(d).hasClass("e-ganttrowcell")?(i=r._$ganttchartHelper.ejGanttChart("getGanttChartRows"),h.target="ejTreeGrid"):(i=e(r._$treegridHelper.ejTreeGrid("getRows")),h.target="ejGanttChart"),s=l.closest("tr"),a=i.index(s),r.model.currentViewData=r.getCurrentViewData(),n=r.model.currentViewData[a],a=r.model.updatedRecords.indexOf(n),h.data=n,h.recordIndex=a,n&&r.model.enableContextMenu?(r._contextMenuItems=[],r._contextMenuItems=r._getContextMenuItems(),r._updateIndentOutdentContextmenuOption(n),r._clearContextMenu(),r._contextMenuItems.length>0&&r._renderContextMenu(t,a,n),"row"==model.selectionMode&&(a!=r.model.selectedRowIndex&&r.rowSelected(h),r._$treegridHelper.ejTreeGrid("selectRows",a),r._$ganttchartHelper.ejGanttChart("selectRows",a)),"cell"==model.selectionMode&&(r._rowIndexOfLastSelectedCell=a,o=r._$treegridHelper.ejTreeGrid("getCellIndex",t),e(l.closest("td")).hasClass("e-chartcell")||r.selectCells([{rowIndex:a,cellIndex:o}]))):0===r.model.flatRecords.length&&r.model.enableContextMenu&&(r._contextMenuItems=[],r._contextMenuItems=r._getContextMenuItems(),r._contextMenuItems.splice(5,2),r._updateIndentOutdentContextmenuOption(n),r._clearContextMenu(),r._contextMenuItems.length>0&&r._renderContextMenu(t,a,n))},_mousedownhandler:function(t){var i=e(t.target),s=this;s._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"))&&s.clearColumnMenu()},_removeContextMenuItem:function(e){var t,i,s=this,a=s._contextMenuItems;i=a.filter(function(t){if(t.menuId===e)return!0}),i.length>0&&(t=a.indexOf(i[0]),a.splice(t,1))},_updateIndentOutdentContextmenuOption:function(e){var t,i=this,s=this.model.flatRecords,a=s.indexOf(e);0===a?(i._removeContextMenuItem("Indent"),i._removeContextMenuItem("Outdent")):a>0?0===e.level?i._removeContextMenuItem("Outdent"):(t=s[a-1],e.level-t.level==1&&i._removeContextMenuItem("Indent")):a<0&&(i._removeContextMenuItem("Task"),i._removeContextMenuItem("Delete"),i._removeContextMenuItem("Indent"),i._removeContextMenuItem("Outdent")),model.editSettings.allowAdding||i._removeContextMenuItem("Add"),model.editSettings.allowDeleting||i._removeContextMenuItem("Delete"),model.editSettings.allowEditing||i._removeContextMenuItem("Task")},queryTaskbarInfo:function(e){this._trigger("queryTaskbarInfo",e)},zoomingChart:function(e){var t=this;t.reRenderChart(e.delta)},refreshRowData:function(e){var t=this,i=t._$treegridHelper.ejTreeGrid("instance");s.TreeGrid.refreshRow(i,e.index)},expanding:function(e){var t=this;if(!t._trigger("expanding",e)){if(t.model.enableVirtualization)s.TreeGrid.sendExpandCollapseRequest(t,e);else{if(t._isInExpandCollapse=!0,t._isRefreshAddedRecord)return e.data.expanded=!0,t._$treegridHelper.ejTreeGrid("updateExpandStatus",e.data,!0),t._refreshChartAndGridRows(),void(t._isRefreshAddedRecord=!1);s.TreeGrid.sendExpandCollapseRequest(t,e),t._isInExpandCollapse=!1}t.updateSelectedItemIndex()}},collapsing:function(t){var i,a,n=this,o=this.model,r=e("#"+n._id+"_toolbarItems");if(!n._trigger("collapsing",t)){if(n.model.enableVirtualization)s.TreeGrid.sendExpandCollapseRequest(n,t);else{if(n._isInExpandCollapse=!0,n._isRefreshAddedRecord)return t.data.expanded=!1,n._$treegridHelper.ejTreeGrid("updateExpandStatus",t.data,!1),n._refreshChartAndGridRows(),void(n._isRefreshAddedRecord=!1);n._gridRows=n.getRows(),s.TreeGrid.sendExpandCollapseRequest(n,t),n._isInExpandCollapse=!1}i=n.selectedItem(),i&&(a=n.getExpandStatus(i),a||t.expanded?n.updateSelectedItemIndex():(n._deSelectRowItem(),o.toolbarSettings.showToolbar&&n.model.toolbarSettings.toolbarItems.indexOf("delete")!==-1&&(e(r).ejToolbar("disableItem",e(r).find(".e-deleteitem").parent()[0]),n.model.toolbarSettings.toolbarItems.indexOf("indent")!==-1&&e(r).ejToolbar("disableItem",e(r).find(".e-indent").parent()[0]),n.model.toolbarSettings.toolbarItems.indexOf("outdent")!==-1&&e(r).ejToolbar("disableItem",e(r).find(".e-outdent").parent()[0]),n.model.toolbarSettings.toolbarItems.indexOf("edit")!==-1&&e(r).ejToolbar("disableItem",e(r).find(".e-edititem").parent()[0]))))}},refreshRow:function(e){var t=this;t._$ganttchartHelper.ejGanttChart("refreshRow",e.recordIndex)},_enableEditingEvents:function(){var t=this,i=t.model;(i.editSettings.allowEditing||"dialogTemplate"==i.editSettings.editMode||i.toolbarSettings.showToolbar&&(i.editSettings.allowAdding&&i.toolbarSettings.toolbarItems.indexOf("add")!==-1||i.editSettings.allowEditing&&i.toolbarSettings.toolbarItems.indexOf("index")!==-1))&&(t._on(e("#"+t._id+"_dialogEdit"),"click keypress","#EditDialog_"+t._id+"_Save ,#EditDialog_"+t._id+"_Cancel,#EditDialog_"+t._id+"_Delete",t._buttonClick),t._on(e("#"+t._id+"_dialogAdd"),"click keypress","#AddDialog_"+t._id+"_Save ,#AddDialog_"+t._id+"_Cancel",t._buttonClick))},cancelEditCell:function(){var t=this;e("#ejTreeGrid"+t._id+"EditForm").length>0&&t._$treegridHelper.ejTreeGrid("cancelEditCell")},_keyPressed:function(){},_buttonClick:function(t){var i;if(t.keyCode!==a&&13!=t.keyCode)return!0;var n=this,o=n.model;return o.editSettings.allowEditing||"dialogTemplate"==o.editSettings.editMode||o.toolbarSettings.showToolbar&&(o.editSettings.allowAdding&&o.toolbarSettings.toolbarItems.indexOf("add")!==-1||o.editSettings.allowEditing&&o.toolbarSettings.toolbarItems.indexOf("index")!==-1)?t.target.id=="EditDialog_"+n._id+"_Save"?n._sendSaveRequest("Edit")||(n._isAddEditDialogSave=!0,e("#"+n._id+"_dialogEdit").ejDialog("close")):t.target.id=="EditDialog_"+n._id+"_Cancel"?e("#"+n._id+"_dialogEdit").ejDialog("close"):t.target.id=="EditDialog_"+n._id+"_Delete"?(i=0!=o.allowSelection||s.isNullOrUndefined(n._contextMenuSelectedIndex)?n._$treegridHelper.ejTreeGrid("deleteRow"):n._$treegridHelper.ejTreeGrid("deleteRow",null,!0,n._contextMenuSelectedIndex),1==i||(n._isAddEditDialogSave=!0,e("#"+n._id+"_dialogEdit").ejDialog("close"))):t.target.id=="AddDialog_"+n._id+"_Save"?n._sendSaveRequest("Add")||this._duplicate||this._wrongenddate||(n._isAddEditDialogSave=!0,e("#"+n._id+"_dialogAdd").ejDialog("close")):t.target.id=="AddDialog_"+n._id+"_Cancel"&&e("#"+n._id+"_dialogAdd").ejDialog("close"):n._sendCancelRequest(),!1},rowDrag:function(e){var t=this;t.model.selectedCellIndexes=[],t._trigger("rowDrag",e)},rowDragStart:function(e){var t=this;t._trigger("rowDragStart",e)},rowDragStop:function(e){var t=this;t._trigger("rowDragStop",e)},cellSelecting:function(e){var t=this;t.model;t._trigger("cellSelecting",e)},cellSelected:function(e){var t=this,i=t.model;t._trigger("cellSelected",e),i.selectedCellIndexes=t._$treegridHelper.ejTreeGrid("instance").model.selectedCellIndexes},rowSelecting:function(e){var t=this,i={},a=this.model;return!t.model.rowSelecting||"row"!=a.selectionMode||(i.recordIndex=e.recordIndex,i.previousIndex=e.previousIndex,i.previousData=a.updatedRecords[e.previousIndex],i.data=a.updatedRecords[e.recordIndex],i.previousChartRow=t._$ganttchartHelper.ejGanttChart("getRowByIndex",e.previousIndex),i.previousGridRow=s.TreeGrid.getRowByIndex(this,e.previousIndex),i.targetChartRow=t._$ganttchartHelper.ejGanttChart("getRowByIndex",e.recordIndex),i.targetGridRow=s.TreeGrid.getRowByIndex(this,e.recordIndex),!t._trigger("rowSelecting",i))},rowSelected:function(t){var i,a,n,o=this,r=this.model,l=e("#"+o._id+"_toolbarItems");r.allowSelection&&("ejTreeGrid"==t.target&&o._$ganttchartHelper.ejGanttChart("selectRows",t.recordIndex),"ejGanttChart"==t.target&&o._$treegridHelper.ejTreeGrid("selectRows",t.recordIndex)),i=t.recordIndex,this.selectedItem(t.data),this.selectedRowIndex(i),o.model.toolbarSettings.showToolbar&&((o.model.toolbarSettings.toolbarItems.indexOf("indent")!==-1||o.model.toolbarSettings.toolbarItems.indexOf("outdent")!==-1)&&o.model.allowSelection&&o.updateIndentOutdentOption(t.data),a=[],o.model.editSettings.allowDeleting&&o.model.allowSelection&&o.model.toolbarSettings.toolbarItems.indexOf("delete")!==-1&&a.push(e(l).find(".e-deleteitem").parent()[0]),o.model.editSettings.allowAdding&&o.model.toolbarSettings.toolbarItems.indexOf("add")!==-1&&a.push(e(l).find(".e-addnewitem").parent()[0]),o.model.editSettings.allowEditing&&o.model.allowSelection&&"click"!=r.editSettings.beginEditAction&&o.model.toolbarSettings.toolbarItems.indexOf("edit")!==-1&&a.push(e(l).find(".e-edititem").parent()[0]),e(l).ejToolbar("enableItem",a)),n={},n.recordIndex=t.recordIndex,data=e.extend({},r.updatedRecords[t.recordIndex]),delete data.childRecords,delete data.parentItem,n.data=data,n.targetChartRow=o._$ganttchartHelper.ejGanttChart("getRowByIndex",t.recordIndex),n.targetGridRow=s.TreeGrid.getRowByIndex(this,t.recordIndex),r.allowSelection&&"row"==r.selectionMode&&o._trigger("rowSelected",n)},_treeGridRowHover:function(e){var t=this;"mouseenter"==e.reason?t._$ganttchartHelper.ejGanttChart("addRowHover",e.index):"mouseleave"==e.reason&&t._$ganttchartHelper.ejGanttChart("removeRowHover")},updateIndentOutdentOption:function(t){var i,s=this,a=s.model.flatRecords,n=a.indexOf(t),o=e("#"+s._id+"_toolbarItems"),r=e(o).find(".e-indent").parent()[0],l=e(o).find(".e-outdent").parent()[0];0===n?(r&&e(o).ejToolbar("disableItem",r),l&&e(o).ejToolbar("disableItem",l)):0===t.level?(r&&e(o).ejToolbar("enableItem",r),l&&e(o).ejToolbar("disableItem",l)):(i=a[n-1],t.level-i.level==1?(l&&e(o).ejToolbar("enableItem",l),r&&e(o).ejToolbar("disableItem",r)):(r&&e(o).ejToolbar("enableItem",r),l&&e(o).ejToolbar("enableItem",l)))},_ganttChartRowHover:function(e){var t=this;"mouseenter"==e.reason?t._$treegridHelper.ejTreeGrid("addRowHover",e.index):"mouseleave"==e.reason&&t._$treegridHelper.ejTreeGrid("removeRowHover")},_removeChildRecordsPredecessor:function(e){var t,i,s=this;if(e.hasChildRecords)for(t=e.childRecords.length,i=0;i0?d._updateParentItem(e.data):(parentRecord.expanded=!1,parentRecord.hasChildRecords=!1,d.refreshGanttRecord(parentRecord))),e.isDragAndDropDelete)return;d._isValidationEnabled=!1,d.model.predecessorMapping&&(d._connectorlineIds=[],d._connectorLinesCollection=[],d._predecessorsCollection=[],d._$ganttchartHelper.ejGanttChart("clearConnectorLines"),d._createConnectorLinesCollection()),d._$ganttchartHelper.ejGanttChart("refreshHelper",d.getCurrentViewData(),d.getUpdatedRecords(),d._totalCollapseRecordCount),d._updateToolbarOptions(),d.updateAltRow(d.getUpdatedRecords(),0,1)}if("selection"===e.requestType&&d._$ganttchartHelper.ejGanttChart("selectRows",e.recordIndex),"rowHover"===e.requestType&&d._$ganttchartHelper.ejGanttChart("addRowHover",e.index),"scroll"===e.requestType&&d._$ganttchartHelper.ejGanttChart("onScrollHelper",e.delta),"dragAndDrop"==e.requestType&&(d._isRefreshAddedRecord=!1,this.dataSource(d._$treegridHelper.ejTreeGrid("getDataSource")),d._isDataManagerUpdate&&(this._jsonData=d._$treegridHelper.ejTreeGrid("getUpdatedDataManagerData")),h.flatRecords=d._$treegridHelper.ejTreeGrid("getFlatRecords"),h.ids=d._$treegridHelper.ejTreeGrid("getUpdatedIds"),h.updatedRecords=d.getUpdatedRecords(),h.predecessorMapping&&("insertAsChild"==e.droppedPosition&&(n=e.draggedRow.parentItem,n.predecessor&&d._removePredecessor(n.predecessor,n),n.item[h.predecessorMapping]=a,n.predecessorsName=a,n.predecessor=a),d._isValidationEnabled=!1,d._connectorlineIds=[],d._connectorLinesCollection=[],d._$ganttchartHelper.ejGanttChart("clearConnectorLines"),d._createConnectorLinesCollection()),e.draggedRow.parentItem&&d._updateParentItem(e.draggedRow),e.draggedRow&&d._$ganttchartHelper.ejGanttChart("refreshHelper",d.getCurrentViewData(),d.getUpdatedRecords(),d._totalCollapseRecordCount)),"save"===e.requestType&&(e._cAddedRecord?(h.enableWBS&&h.enableWBSPredecessor&&h.predecessorMapping&&d._$treegridHelper.ejTreeGrid("updateWBSPredecessor",e._cAddedRecord),d._renderAddedRow(e.index,e._cAddedRecord),e._cAddedRecord.parentItem&&d._updateParentItem(e._cAddedRecord),s.TreeGrid.updateAltRow(d,h.currentViewData[0],0,0),d.selectRows(h.updatedRecords.indexOf(e._cAddedRecord)),c=d.selectedRowIndex(),h.enableVirtualization||(o={},o.index=o.recordIndex=h.currentViewData.indexOf(e._cAddedRecord),d.refreshRowData(o),d.refreshRow(o))):e._cModifiedData&&(e._cModifiedData.left=e._cModifiedData._calculateLeft(d._projectStartDate,d._perDayWidth,d._holidaysList,h),e._cModifiedData.width=e._cModifiedData._calculateWidth(d._perDayWidth,d._holidaysList,h),e._cModifiedData.progressWidth=e._cModifiedData._getProgressWidth(e._cModifiedData.width,e._cModifiedData.status),h.enableWBS&&h.enableWBSPredecessor&&h.predecessorMapping&&d._$treegridHelper.ejTreeGrid("updateWBSPredecessor",e._cModifiedData),d.refreshGanttRecord(e._cModifiedData),e._cModifiedData.parentItem&&d._updateParentItem(e._cModifiedData),e._cModifiedData.predecessor&&e.previousValue&&d._removeConnectorLine(e.previousValue,e._cModifiedData)),d.model.predecessorMapping&&(d._isValidationEnabled=!(!e._cModifiedData||!e._cModifiedData.predecessor),e._cAddedRecord?(e._cAddedRecord.predecessor&&(d._validatePredecessorDates(e._cAddedRecord),d._addConnectorLine(e._cAddedRecord)),d._$ganttchartHelper.ejGanttChart("clearConnectorLines"),d._connectorlineIds=[],d._connectorLinesCollection=[],d._createConnectorLinesCollection()):e._cModifiedData&&(e.previousValue&&d._removeConnectorLine(e.previousValue,e._cModifiedData),d._addConnectorLine(e._cModifiedData),e._cModifiedData.predecessor&&(d._isUpdateOffset&&(d._editedTaskBarItem=e._cModifiedData),d._isMileStoneEdited=e._cModifiedData.isMilestone,d._updatedConnectorLineCollection=[],d._connectorlineIds=[],d._validatePredecessor(e._cModifiedData,e.previousValue),d._isUpdateOffset&&(d._editedTaskBarItem=null),d._updatedConnectorLineCollection.length>0&&d._$ganttchartHelper.ejGanttChart("appendConnectorLine",d._updatedConnectorLineCollection)),e._cModifiedData.parentItem&&d._updateParentItem(e._cModifiedData)))),"validatePredecessor"===e.requestType)return r=d._editedPredecessorValidation(e),void(e.result=r);if(d._ganttActionCompleteTrigger(e),c>=0){var u=d.element.find(".e-ganttviewerbodyContianer"),m=u.ejScroller("instance"),p=h.updatedRecords[c].left,g=m.model.width,_=m.model.scrollLeft;hScrollbar=m._hScrollbar,hScrollbar&&(hScrollbar.model.maximum<_&&(_=hScrollbar.model.maximum),(_>p||_+g0&&o._$ganttchartHelper.ejGanttChart("appendConnectorLine",o._updatedConnectorLineCollection),o._editedTaskBarItem=null),"rowHover"===e.requestType&&o._$treegridHelper.ejTreeGrid("addRowHover",e.index),"scroll"===e.requestType&&(o._isTreeGridRendered=!1,o._isGanttChartRendered=!1,e.vscrollExsist&&e.delta!==a&&o._$treegridHelper.ejTreeGrid("onScrollHelper",e.delta),o.model.updatedRecords=o.getUpdatedRecords(),o.model.currentViewData=o.getCurrentViewData(),o.model.enableVirtualization&&o.model.predecessorMapping&&(o._connectorLinesCollection.length>0&&o._$ganttchartHelper.ejGanttChart("clearConnectorLines"),o._isValidationEnabled=!1,o._connectorlineIds=[],o._connectorLinesCollection=[],o._createConnectorLinesCollection()),o._isTreeGridRendered=!0,o._isGanttChartRendered=!0),"selection"===e.requestType&&o._$treegridHelper.ejTreeGrid("selectRows",e.recordIndex),"validatePredecessor"===e.requestType&&(i=o._editedPredecessorValidation(e),e.predecessorValidation=i),"drawConnectorLine"===e.requestType&&(s=e.toItem._calculatePredecessor(e.predecessor),e.toItem.item[o.model.predecessorMapping]=e.predecessorString[0],e.toItem.predecessorsName=e.toItem.item[o.model.predecessorMapping],model.enableWBS&&model.enableWBSPredecessor&&o._$treegridHelper.ejTreeGrid("updateWBSPredecessor",e.toItem),e.fromItem.predecessor?e.fromItem.predecessor.push(s[0]):e.fromItem.predecessor=s,e.toItem.predecessor?e.toItem.predecessor.push(s[0]):(e.toItem.predecessor=[],e.toItem.predecessor.push(s[0])),o._isMileStoneEdited=e.toItem.isMilestone,o._updatedConnectorLineCollection=[],o._connectorlineIds=[],o._validatePredecessor(e.toItem),o._updatedConnectorLineCollection.length>0&&o._$ganttchartHelper.ejGanttChart("appendConnectorLine",o._updatedConnectorLineCollection),n={},n.data=e.toItem,o._updateScheduleDatesOnEditing(n)),o._ganttActionCompleteTrigger(e)},hideColumn:function(e){var t=this;t._$treegridHelper.ejTreeGrid("hideColumn",e)},showColumn:function(e){var t=this;t._$treegridHelper.ejTreeGrid("showColumn",e)},clearColumnMenu:function(){var e=this;e._$treegridHelper.ejTreeGrid("clearColumnMenu")},deleteRow:function(){var e=this;e._$treegridHelper.ejTreeGrid("deleteRow")},taskbarEditing:function(e){this._trigger("taskbarEditing",e)},setInitialData:function(){this._setInitialData()},sortColumn:function(e,t){var i=this;i._$treegridHelper.ejTreeGrid("sortColumn",e,t)},clearSorting:function(){var e=this;e.model;e._$treegridHelper.ejTreeGrid("clearSorting")},_refreshParent:function(e){this.refreshGanttRecord(e),e.parentItem&&this._refreshParent(e.parentItem)},taskbarEdited:function(e){var t,i,a,n,o,r,l,d,h,c,u,m,p,g,_,f,b,v,x,w=this,y=e.data,C=w.model,S=new Date(w._projectStartDate),T=C.scheduleHeaderSettings.scheduleHeaderType,D=s.Gantt.ScheduleHeaderType,I=s.Gantt.DurationUnit,k=0;if(w._isValidationEnabled=!1,e.dragging){if(m="dragging",e.previousData.left!==y.left){if(t=y.left%w._perDayWidth,i=(y.left-t)/w._perDayWidth,k=0,t>0&&C.workingTimeScale!=s.Gantt.workingTimeScale.TimeScale24Hours&&(k=T==D.Day?t>w._perDayWidth/2+3*w._perHourWidth?1:0:t>=w._perDayWidth/2?1:0),b=Math.round(t/(w._perDayWidth/24)),g=Math.round(t/(w._perDayWidth/1440)),S.setDate(S.getDate()+i+k),T==D.Day&&C.workingTimeScale==s.Gantt.workingTimeScale.TimeScale24Hours?C.dateFormat.indexOf("hh")!=-1&&(C.durationUnit==I.Minute?S.setMinutes(g):C.durationUnit==I.Hour&&S.setHours(b)):T==D.Hour?(S.setMinutes(g),C.durationUnit==I.Hour&&(f=S.getMinutes(),f>30?S.setMinutes(60):S.setMinutes(0))):T!=D.Week||C.workingTimeScale!=s.Gantt.workingTimeScale.TimeScale24Hours||C.durationUnit!=I.Day&&C.dateFormat.indexOf("hh:")!=-1?C.dateFormat.indexOf("hh:")!=-1&&C.workingTimeScale==s.Gantt.workingTimeScale.TimeScale8Hours?b>=8&&b<=16?S.setHours(b):S.setHours(8):C.dateFormat.indexOf("hh:")!=-1&&(C.durationUnit==I.Hour?S.setHours(b):C.durationUnit==I.Minute&&S.setMinutes(g)):y.left=i*w._perDayWidth,C.workingTimeScale!=s.Gantt.workingTimeScale.TimeScale24Hours&&(T==D.Day&&C.durationUnit==I.Hour?(x=k+i,a=8,b>=8&&b<16&&(a=b),(b<8||b>15)&&e.previousData.left>y.left?(S.setDate(S.getDate()-1),S.setHours(15),y.left=15*w._perHourWidth):y.left=x>0?x*w._perDayWidth+a*w._perHourWidth:y.left):t>=w._perDayWidth/2?(y.left=y.left+w._perDayWidth,C.roundOffDayworkingTime&&(y.left-=t)):(y.left=y.left,C.roundOffDayworkingTime&&(y.left-=t))),this._stringHolidays&&this._stringHolidays.indexOf(y._getFormatedDate(S,C.dateFormat))!=-1&&(S.setDate(S.getDate()+1),y.left+=w._perDayWidth),0==this.model.includeWeekend&&(0===S.getDay()?(S.setDate(S.getDate()+1),y.left+=w._perDayWidth):6===S.getDay()&&(S.setDate(S.getDate()+2),y.left+=2*w._perDayWidth)),this._stringHolidays&&this._stringHolidays.indexOf(y._getFormatedDate(S,C.dateFormat))!=-1&&(S.setDate(S.getDate()+1),y.left+=w._perDayWidth),T==D.Hour&&C.durationUnit==I.Hour){var P=w._getDateFromFormat(e.previousData.startDate),L=w._getDateFromFormat(y.startDate),o=P.getHours(),R=(L.getHours(),Math.abs(P-L)),M=Math.round(R/36e5),l=L.getMinutes(),O=l/w._minuteInterval,E=w._perDayWidth/(24*w._perMinuteWidth)-O;e.previousData.left>y.left?y.left=l>30?e.previousData.left-M*(w._perDayWidth/24):y.left-w._perMinuteWidth*O:e.previousData.left0&&"TimeScale24Hours"!=C.workingTimeScale&&(k=T==D.Day?n>w._perDayWidth/2+3*w._perHourWidth?1:0:n>=w._perDayWidth/2?1:0);var A=y.left+y.width,j=A%w._perDayWidth,b=j/(w._perDayWidth/24),g=j/(w._perDayWidth/1440),N=w._getDateFromFormat(y.startDate);if(T==D.Day)C.dateFormat.indexOf("hh")!=-1?(o=y.left/w._perHourWidth,r=A/w._perHourWidth,r-=o,_=Math.round(60*(r-Math.floor(r))),d=C.durationUnit==I.Hour?y._dateUpdate(N,0,Math.round(r)):C.durationUnit==I.Minute?y._dateUpdate(N,0,r,_):y._dateUpdate(N,i,0,0)):d=y._dateUpdate(N,i,0,0);else if(T!=D.Hour||C.durationUnit!=I.Minute&&C.durationUnit!=I.Hour)if(T==D.Week){var o=Math.round(y.left/(w._perDayWidth/24)),v=Math.round(A/(w._perDayWidth/24)),z=g%60;v-=o,d=C.dateFormat.indexOf("hh")!=-1?C.durationUnit==I.Hour?y._dateUpdate(N,0,v):C.durationUnit==I.Minute?y._dateUpdate(N,0,v,z):y._dateUpdate(N,Math.floor(i-1+k),0):C.durationUnit==I.Day?y._dateUpdate(N,Math.floor(i-1+k),0):y._dateUpdate(N,Math.floor(i+k),0)}else C.durationUnit==I.Hour?(C.dateFormat.indexOf("hh")!=-1&&(d=y._dateUpdate(N,i-1+k,b)),C.dateFormat.indexOf("hh")==-1&&(d=y._dateUpdate(N,Math.floor(i+k),0))):C.durationUnit==I.Minute?(C.dateFormat.indexOf("hh")!=-1&&(d=y._dateUpdate(N,i+k,0,g)),C.dateFormat.indexOf("hh")==-1&&(d=y._dateUpdate(N,Math.floor(i+k),0))):d=y._dateUpdate(N,Math.floor(i-1+k),0);else l=y.left%w._perDayWidth/w._perMinuteWidth*w._minuteInterval,_=A/w._perMinuteWidth*w._minuteInterval,_-=l,_%=1440,d=y._dateUpdate(N,i,0,_);if(T==D.Day&&C.workingTimeScale==s.Gantt.workingTimeScale.TimeScale24Hours&&C.durationUnit==I.Hour&&C.dateFormat.indexOf("hh")!=-1&&d.setHours(Math.round(b)),C.dateFormat.indexOf("hh:")!=-1&&T==D.Day&&C.workingTimeScale==s.Gantt.workingTimeScale.TimeScale8Hours&&(d.getHours()>16?d.setHours(Math.round(33)):d.getHours()<8&&d.setHours(Math.round(9))),C.holidays&&C.holidays.length)for(h=0,c=C.holidays.length,h=0;h0&&"TimeScale24Hours"!=C.workingTimeScale&&(k=T==D.Day?t>w._perDayWidth/2+3*w._perHourWidth?1:0:t>=w._perDayWidth/2?1:0), b=t/(w._perDayWidth/24),g=Math.round(t/(w._perDayWidth/1440)),S.setDate(S.getDate()+i+k),T==D.Day||T==D.Week?C.dateFormat.indexOf("hh")!=-1&&(C.durationUnit==I.Hour?S.setHours(Math.round(b)):C.durationUnit==I.Minute&&(_=Math.round(60*(b-Math.floor(b))),S.setHours(b),S.setMinutes(_)),C.workingTimeScale==s.Gantt.workingTimeScale.TimeScale8Hours&&(C.durationUnit==I.Hour||C.durationUnit==I.Day)&&(b>=8&&b<=15?S.setHours(b):(S.setDate(S.getDate()-1),S.setHours(15)))):T==D.Hour?(S.setMinutes(g),C.durationUnit==I.Hour&&(f=S.getMinutes(),f>30?S.setMinutes(60):S.setMinutes(0))):C.dateFormat.indexOf("hh:")!=-1&&C.workingTimeScale==s.Gantt.workingTimeScale.TimeScale8Hours?(b=Math.round(t/(w._perDayWidth/9)),S.setHours(8)):C.durationUnit==I.Hour&&C.dateFormat.indexOf("hh")!=-1?S.setHours(b):C.durationUnit==I.Minute&&C.dateFormat.indexOf("hh")!=-1&&S.setMinutes(g),this._stringHolidays&&this._stringHolidays.indexOf(y._getFormatedDate(S,C.dateFormat))!=-1&&(S.setDate(S.getDate()+1),y.left+=w._perDayWidth),0==this.model.includeWeekend&&(0===S.getDay()?(S.setDate(S.getDate()+1),y.left+=w._perDayWidth,i+=1):6===S.getDay()&&(S.setDate(S.getDate()+2),y.left+=2*w._perDayWidth,i+=2)),this._stringHolidays&&this._stringHolidays.indexOf(y._getFormatedDate(S,C.dateFormat))!=-1&&(S.setDate(S.getDate()+1),y.left+=w._perDayWidth),C.workingTimeScale!=s.Gantt.workingTimeScale.TimeScale24Hours&&T==D.Day&&C.durationUnit!=I.Hour?t>=w._perDayWidth/2?(y.left=y.left+w._perDayWidth,C.roundOffDayworkingTime&&(y.left-=t)):(y.left=y.left,C.roundOffDayworkingTime&&(y.left-=t)):T==D.Week&&C.workingTimeScale==s.Gantt.workingTimeScale.TimeScale24Hours?(C.durationUnit==I.Day||C.dateFormat.indexOf("hh")==-1)&&(y.left=i*w._perDayWidth):T!=D.Day&&C.dateFormat.indexOf("hh")==-1?t>=w._perDayWidth/2?(y.left=y.left+w._perDayWidth,C.roundOffDayworkingTime&&(y.left-=t)):(y.left=y.left,C.roundOffDayworkingTime&&(y.left-=t)):T==D.Day&&(C.workingTimeScale==s.Gantt.workingTimeScale.TimeScale8Hours||C.workingTimeScale==s.Gantt.workingTimeScale.TimeScale24Hours)&&(C.durationUnit==I.Hour?v=y.left%w._perHourWidth:C.durationUnit==I.Minute&&(v=y.left%w._perMinuteWidth),x=i+k,C.workingTimeScale==s.Gantt.workingTimeScale.TimeScale8Hours&&(b<8||b>15)&&(y.left=(x-1)*w._perDayWidth+15*w._perHourWidth),v>=w._perHourWidth/2?(y.left=y.left+w._perHourWidth,y.left-=v):y.left-=v),T==D.Hour&&C.durationUnit==I.Hour){var P=w._getDateFromFormat(e.previousData.startDate),L=w._getDateFromFormat(y.startDate),o=P.getHours(),R=(L.getHours(),Math.abs(P-L)),M=Math.round(R/36e5),l=L.getMinutes(),O=l/w._minuteInterval,E=w._perDayWidth/(24*w._perMinuteWidth)-O;e.previousData.left>y.left?y.left=l>30?e.previousData.left-M*(w._perDayWidth/24):y.left-w._perMinuteWidth*O:e.previousData.left0&&w._$ganttchartHelper.ejGanttChart("appendConnectorLine",w._updatedConnectorLineCollection)),w._editedTaskBarItem=null,y.parentItem&&w._updateParentItem(y,m),w.refreshGanttRecord(y)),w._trigger("taskbarEdited",e),!e.cancel&&(e.leftResizing||e.rightResizing||e.dragging)&&w._isValidationEnabled&&w._updateScheduleDatesOnEditing(e)},actionBegin:function(e){var t=this;t._trigger("actionBegin",e)||"beginedit"===e.requestType&&t._sendEditRequest()},_ganttActionCompleteTrigger:function(e){this._trigger("actionComplete",e),e.cancel||"save"!==e.requestType||(e._cModifiedData&&(e.data=e._cModifiedData),e._cAddedRecord&&(e.data=e._cAddedRecord),this._updateScheduleDatesOnEditing(e))},_queryCellInfo:function(e){this._trigger("queryCellInfo",e)},_beginEdit:function(t){var i,s=this,a=e("#"+s._id+"_toolbarItems");if(!s._trigger("beginEdit",t)&&(s._isinBeginEdit=!0,s.model.toolbarSettings.showToolbar)){var n=[],o=e(a).find(".e-cancel").parent()[0],r=e(a).find(".e-saveitem").parent()[0];o&&n.push(o),r&&n.push(r),e(a).ejToolbar("enableItem",n),i=[],s.model.editSettings.allowAdding&&s.model.toolbarSettings.toolbarItems.indexOf("add")!==-1&&i.push(e(a).find(".e-addnewitem").parent()[0]),s.model.editSettings.allowEditing&&s.model.toolbarSettings.toolbarItems.indexOf("edit")!==-1&&i.push(e(a).find(".e-edititem").parent()[0]),s.model.editSettings.allowDeleting&&s.model.toolbarSettings.toolbarItems.indexOf("delete")!==-1&&i.push(e(a).find(".e-deleteitem").parent()[0]),e(a).ejToolbar("disableItem",i)}},_endEdit:function(t){var i,s,a=this,n=(this.model,e("#"+a._id+"_toolbarItems"));a._isinBeginEdit=!1,a._trigger("endEdit",t)?(i="",t.data[t.columnName]=t.previousValue,"predecessor"===t.columnName?(i=a._predecessorToString(t.data.predecessor,t.data),t.data.item[t.columnObject.mappingName]=i,t.data.predecessorsName=i):(t.data.item[t.columnObject.mappingName]=t.previousValue,"resourceInfo"===t.columnName&&a._updateResourceName(t.data))):(t.isModified&&(a.model.currentViewData=a._$treegridHelper.ejTreeGrid("getCurrentViewData"),a._isValidationEnabled=!0,a._updateEditedGanttRecords(t)),"resourceInfo"===t.columnName&&a._updateResourceName(t.data)),a.refreshGanttRecord(t.data),delete t.isModified,a.model.toolbarSettings.showToolbar&&(s=[],a.model.toolbarSettings.toolbarItems.indexOf("cancel")!==-1&&s.push(e(n).find(".e-cancel").parent()[0]),a.model.toolbarSettings.toolbarItems.indexOf("update")!==-1&&s.push(e(n).find(".e-saveitem").parent()[0]),e(n).ejToolbar("disableItem",s)),t.cancel||"startDate"!==t.columnName&&"endDate"!==t.columnName&&"duration"!==t.columnName||a._updateScheduleDatesOnEditing(t)},_updateScheduleDatesOnEditing:function(e){var t,i,s,a,n=this,o=this.model,r=n._getDateFromFormat(e.data.startDate),l=n._getDateFromFormat(e.data.endDate),d=n._projectStartDate,h=n._getDateFromFormat(o.scheduleEndDate),c=!1,u=o.scheduleStartDate,m=o.scheduleEndDate;n._calculateDatesForScheduleCheck(r),o.predecessorMapping?(a={},a.onEditing=!0,n._calculateScheduleDates(a),n._calculateDatesForScheduleCheck(a.minStartDate),a.minStartDate.getTime()h&&(m=e.data._getFormatedDate(a.maxEndDate,o.dateFormat),c=!0),c&&n.updateScheduleDates(u,m)):(r.getTime()>=d.getTime()&&r.getTime()<=h.getTime()||(r.getTime()=d.getTime()&&l.getTime()<=h.getTime()||(l.getTime()0)||(t={},t.currentRecord=e.currentRecord,t.predecessorString=s[a.predecessorMapping].split(","),!!i._editedPredecessorValidation(t)||(s[a.predecessorMapping]="",e.currentRecord.predecessor=null,e.currentRecord.predecessorsName="",!1))},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,e("#gantt_search input").val(t))},addRecord:function(e,t){var i,a,n,o,r,l,d,h,c,u,m=this,p=this.model,g="row"==p.selectionMode?this.selectedRowIndex():m._rowIndexOfLastSelectedCell,_=p.updatedRecords[g],f=p.taskIdMapping,b=p.updatedRecords,v=p.flatRecords,x=p.parentRecords,w=p.ids,y=this.dataSource(),C=0,S={};switch(m.clearSelection(),m.cancelEditCell(),(s.isNullOrUndefined(y)||s.isNullOrUndefined(y[0]))&&(this.dataSource([]),y=this.dataSource()),"[object Object]"!==Object.prototype.toString.call(e)&&(e={}),(g!==-1||t!==s.Gantt.AddRowPosition.AboveSelectedRow&&t!==s.Gantt.AddRowPosition.BelowSelectedRow&&t!==s.Gantt.AddRowPosition.Child)&&t||(t=s.Gantt.AddRowPosition.Top),e[f]&&(e[f]=p.ids.indexOf(e[f].toString())!=-1?null:isNaN(parseInt(e[f]))?null:parseInt(e[f])),m._updateAddData(e),m._isDataManagerUpdate&&(m._jsonData=m._$treegridHelper.ejTreeGrid("getUpdatedDataManagerData")),t){case s.Gantt.AddRowPosition.Top:if(C=0,n=null,i=m._createGanttRecord(e,C),i.index=i.taskId,S.data=e,S.currentRecord=i,!m._validateAddRecordPrecessorValue(S)&&m._isinAddnewRecord)return!1;v.splice(0,0,i),b.splice(0,0,i),w.splice(0,0,i.taskId.toString()),x.splice(0,0,i),m._isDataManagerUpdate?m._jsonData.splice(0,0,i.item):y.splice(0,0,i.item),a=0;break;case s.Gantt.AddRowPosition.Bottom:if(C=0,n=null,i=m._createGanttRecord(e,C),i.index=i.taskId,S.data=e,S.currentRecord=i,!m._validateAddRecordPrecessorValue(S)&&m._isinAddnewRecord)return!1;v.push(i),b.push(i),w.push(i.taskId.toString()),x.push(i),m._isDataManagerUpdate?m._jsonData.push(i.item):y.push(i.item),a=b.indexOf(i);break;case s.Gantt.AddRowPosition.AboveSelectedRow:if(C=_.level,n=_.parentItem,i=m._createGanttRecord(e,C,n),i.index=i.taskId,S.data=e,S.currentRecord=i,!m._validateAddRecordPrecessorValue(S)&&m._isinAddnewRecord)return!1;r=v.indexOf(_),l=b.indexOf(_),v.splice(r,0,i),b.splice(l,0,i),w.splice(r,0,i.taskId.toString()),s.isNullOrUndefined(n)?(x.splice(x.indexOf(_),0,i),m._isDataManagerUpdate?m._jsonData.splice(m._jsonData.indexOf(_.item),0,i.item):y.splice(y.indexOf(_.item),0,i.item)):(o=n.childRecords.indexOf(_),n.childRecords.splice(o,0,i),p.parentTaskIdMapping?(i.item[p.parentTaskIdMapping]=i.parentItem.taskId,m._isDataManagerUpdate?m._jsonData.push(i.item):y.push(i.item)):n.item[p.childMapping].splice(o,0,i.item)),a=l;break;case s.Gantt.AddRowPosition.BelowSelectedRow:if(C=_.level,n=_.parentItem,i=m._createGanttRecord(e,C,n),i.index=i.taskId,S.data=e,S.currentRecord=i,!m._validateAddRecordPrecessorValue(S)&&m._isinAddnewRecord)return!1;d=v.indexOf(_),_.hasChildRecords?(dataChildCount=m._$treegridHelper.ejTreeGrid("getChildCount",_,0),r=d+dataChildCount+1,l=b.indexOf(_)+m._getVisibleChildRecordCount(_,0,b)+1):(r=d+1,l=b.indexOf(_)+1),v.splice(r,0,i),b.splice(l,0,i),w.splice(r,0,i.taskId.toString()),s.isNullOrUndefined(n)?(x.splice(x.indexOf(_)+1,0,i),m._isDataManagerUpdate?m._jsonData.splice(m._jsonData.indexOf(_.item)+1,0,i.item):y.splice(y.indexOf(_.item)+1,0,i.item)):(o=n.childRecords.indexOf(_),n.childRecords.splice(o+1,0,i),p.parentTaskIdMapping?(i.item[p.parentTaskIdMapping]=i.parentItem.taskId,m._isDataManagerUpdate?m._jsonData.push(i.item):y.push(i.item)):n.item[p.childMapping].splice(o+1,0,i.item)),a=l;break;case s.Gantt.AddRowPosition.Child:if(C=_.level+1,n=_,i=m._createGanttRecord(e,C,n),i.index=i.taskId,S.data=e,S.currentRecord=i,!m._validateAddRecordPrecessorValue(S)&&m._isinAddnewRecord)return!1;d=v.indexOf(_),_.hasChildRecords?(dataChildCount=m._$treegridHelper.ejTreeGrid("getChildCount",_,0),r=d+dataChildCount+1,_.expanded||(h={},h.expanded=!0,h.data=_,m._isInAdd=!0,m.expanding(h),m._isInAdd=!1,b=m.getUpdatedRecords()),l=b.indexOf(_)+m._getVisibleChildRecordCount(_,0,b)+1):(_.hasChildRecords=!0,_.childRecords=[],_.expanded=!0,p.parentTaskIdMapping||(_.item[p.childMapping]=[]),_.isMilestone=!1,r=d+1,l=b.indexOf(_)+1,_.predecessor&&m._updatePredecessorOnIndentOutdent(_)),v.splice(r,0,i),b.splice(l,0,i),w.splice(r,0,i.taskId.toString()),s.isNullOrUndefined(n)||(o=n.childRecords.indexOf(_),n.childRecords.splice(o+1,0,i), p.parentTaskIdMapping?(i.item[p.parentTaskIdMapping]=i.parentItem.taskId,m._isDataManagerUpdate?m._jsonData.push(i.item):y.push(i.item)):n.item[p.childMapping].splice(o+1,0,i.item)),a=l}return m._deSelectRowItem(),m._$treegridHelper.ejTreeGrid("setUpdatedRecords",p.flatRecords,p.updatedRecords,p.ids,p.parentRecords,this.dataSource()),c={},c.requestType="save",c._cAddedRecord=c.addedRecord=i,c.index=a,m.actionComplete(c),p.enableWBS&&m.updateWBSdetails(),u=m._$treegridHelper.ejTreeGrid("instance"),p.enableVirtualization===!1&&(u.model.sortSettings.sortedColumns.length>0||u._searchString.length>0)&&(m._isRefreshAddedRecord=!0),"cell"==p.selectionMode?(g=p.updatedRecords.indexOf(i),m._$treegridHelper.ejTreeGrid("updateScrollBar",g)):m._$treegridHelper.ejTreeGrid("updateScrollBar"),!0},updateWBSdetails:function(e,t,i){var s,a,n,o,r,l,d,h,c,u=this,m=u.model,p=e?e:"row"==m.selectionMode?m.selectedItem:m.updatedRecords[u._rowIndexOfLastSelectedCell];newWBS=p.WBS,p.parentItem?(s=p.parentItem.childRecords,a=s.indexOf(p),o=s,r=o.length):m.flatRecords.length&&(l=m.flatRecords,d=l.filter(function(e){return e&&0==e.level}),o=d,a=o.indexOf(p),r=o.length),n=t?o.slice(a,r):o.slice(a+1,r),n.length&&(h=newWBS.lastIndexOf(".")!=-1?parseInt(newWBS.substr(newWBS.lastIndexOf(".")+1)):parseInt(newWBS),c=p.parentItem?p.parentItem.WBS:null,t&&!i?h--:t&&i?h=h:h++,u.reCalculateWBS(n,h,c))},deleteItem:function(){var e=this;e.cancelEditCell(),e._$treegridHelper.ejTreeGrid("deleteRow")},expandAllItems:function(){this.cancelEditCell(),this._expandAll()},collapseAllItems:function(){this._collapseAll()},indentItem:function(){var e,t,i=this,s=this.model,a=i.model.flatRecords,n=s.selectedItem,o=!0;return n&&(e=a.indexOf(n),0===e?o=!1:0===n.level?o=!0:(t=a[e-1],o=n.level-t.level!=1)),!!o&&void this._sendIndentRequest()},outdentItem:function(){this._sendOutdentRequest()},updateGanttColumns:function(e){var t=this,i=t.model;i.columns=e,t._columns=e},cancelEdit:function(){this.sendCancelRequest()},expandCollapseRecord:function(t){var i,a,n,o,r=this,l={},d=this.model;i=d.flatRecords[d.ids.indexOf(t.toString())],!s.isNullOrUndefined(i)&&i.hasChildRecords&&(l={},l.expanded=1!=i.expanded,a=r.getExpandStatus(i),a?(l.data=i,l.expanded?r.expanding(l):r.collapsing(l)):(i.expanded=l.expanded,n=d.currentViewData.indexOf(i),n==-1||d.enableVirtualization||(o=e(r.getRows()[n]),i.expanded?(o.find(".e-treegridcollapse").removeClass("e-treegridcollapse").addClass("e-treegridexpand"),o.removeClass("e-treegridrowcollapse").addClass("e-treegridrowexpand")):(o.find(".e-treegridexpand").removeClass("e-treegridexpand").addClass("e-treegridcollapse"),o.removeClass("e-treegridrowexpand").addClass("e-treegridrowcollapse")))))},saveEdit:function(){var e=this;e._$treegridHelper.ejTreeGrid("endEdit")},setSplitterIndex:function(t){var i,s=this,a=s.model,n=s.getColumns(),o=0,r=e("#ejTreeGrid"+s._id+"e-gridcontent");if(columnIndex=parseInt(t),columnIndex>-1&&columnIndexs._ganttWidth)for(o=0,i=0;i<=columnIndex;i++){if(!(o+n[i].width<=s._ganttWidth)){a.splitterSettings.index=t;break}o+=n[i].width,t=i}else a.splitterSettings.index=columnIndex;r.ejScroller("isHScroll")&&r.ejScroller("scrollLeft",0),s.setSplitterPosition(o.toString())}},setSplitterPosition:function(t){var i,a=this,n=(a.model,0);if(ganttWidth=parseInt(a._ganttWidth)-a._totalBorderWidth,isPercentage=!1,!s.isNullOrUndefined(t)){if(t.indexOf("%")!=-1?(o=parseInt(t),isPercentage=!0):(o=parseInt(t)/a._ganttWidth*100,isPercentage=!1),o=isNaN(o)?0:o,o<=100)o=o<0?0:o,n=100-o-900/ganttWidth,n<=0?(isPercentage?a.splitterPosition("100%"):a.splitterPosition(ganttWidth.toString()),o=100-900/ganttWidth,n=0):n>0&&(isPercentage?a.splitterPosition(Math.round(o)+"%"):a.splitterPosition(Math.round(o*a._ganttWidth/100).toString())),i=e("#e-ejSpliter"+a._id).ejSplitter("instance"),i.model.properties[0].paneSize=o+"%",i.model.properties[1].paneSize=n+"%",i.refresh(),a._$treegridHelper.ejTreeGrid("refreshScroller",Math.round(o*ganttWidth/100)),a._$ganttchartHelper.ejGanttChart("refreshScroller",i.model.properties[1].paneSize-1),a._clearContextMenu();else{var i=e("#e-ejSpliter"+a._id).ejSplitter("instance"),o=i.model.properties[0].paneSize,n=i.model.properties[1].paneSize;0==parseInt(n)?isPercentage?a.splitterPosition("100%"):a.splitterPosition(ganttWidth.toString()):isPercentage?a.splitterPosition(Math.round(parseInt(o)/ganttWidth*100)+"%"):a.splitterPosition(o.toString())}a._splitterPosition(a.splitterPosition())}},_showTooltip:function(e){var t=this;this.model.enableTaskbarTooltip=e,t._$ganttchartHelper.ejGanttChart("showTooltip",e)},_showEditingTooltip:function(e){var t=this;this.model.enableTaskbarDragTooltip=e,t._$ganttchartHelper.ejGanttChart("showEditingTooltip",e)},_ganttChartEditing:function(e){var t=this;t.model.allowGanttChartEditing=e,t._$ganttchartHelper.ejGanttChart("ganttChartEditing",e)},_resizeProgressbar:function(e){var t=this;t.model.enableProgressBarResizing=e,t._$ganttchartHelper.ejGanttChart("resizeProgressbar",e)},_milestoneTemplate:function(e){var t=this;t.model.milestoneTemplate=e,t._$ganttchartHelper.ejGanttChart("changeMilestoneTemplate",t.model.milestoneTemplate)},_taskbarTemplate:function(e){var t=this;t.model.taskbarTemplate=e,t._$ganttchartHelper.ejGanttChart("changeTaskbarTemplate",t.model.taskbarTemplate)},_parentTaskbarTemplate:function(e){var t=this;t.model.parentTaskbarTemplate=e,t._$ganttchartHelper.ejGanttChart("changeParentTaskbarTemplate",t.model.parentTaskbarTemplate)},_sendSortingRequest:function(e){var t,i,s=this;t=e.sortedColumns[0].field,i=e.sortedColumns[0].direction,s._$treegridHelper.ejTreeGrid("sortColumn",t,i)},_sortingRequest:function(e){var t=this;t.model;t.model.allowSorting=e,t._$treegridHelper.ejTreeGrid("sortSetting",e)},_columnIndex:function(e){var t=this;t._$treegridHelper.ejTreeGrid("columnIndex",e)},sendCancelRequest:function(){var t=this,i=e("#"+t._id+"_toolbarItems");t._$treegridHelper.ejTreeGrid("cancelEditCell"),t.model.toolbarSettings.toolbarItems.indexOf("cancel")!==-1&&t._disabledToolItems.push(e(i).find(".e-cancel").parent()[0]),t.model.toolbarSettings.toolbarItems.indexOf("save")!==-1&&t._disabledToolItems.push(e(i).find(".e-saveitem").parent()[0]),e(i).ejToolbar("disableItem",t._disabledToolItems),t._disabledToolItems=[]},_sendAddRequest:function(){var e=this,t=e._columns,i=t.length,s=0,a={},n={},o={};for(e._isinAddnewRecord=!0,s;s100?100:e[n.progressMapping]:0),!e[n.endDateMapping]&&n.endDateMapping&&(e[n.durationMapping]||(i=a._getDateFromFormat(n.scheduleStartDate),i.setDate(i.getDate()+4),e[n.endDateMapping]=s.format(i,this.model.dateFormat)))},_sendSaveRequest:function(t){var i,a,n,o,r,l,d,h,c,u,m,p,g,_,f,b,v,x={},w=document,y=this,C=y.model,S={};if(this._duplicate=!1,this._wrongenddate=!1,"Add"===t){if(i=w.getElementById(y._id+"AddForm"),a=i&&i.length,d="Add",h="#treegrid"+y._id+"predecessorAdd",o=e("#"+y._id+"taskId"+d),r=s.TreeGrid.getColumnByField(y._columns,"taskId"),y._cellEditColumn=r,r&&o.length>0&&(l=y.getCurrentEditCellData(o,r.dropdownData)),y.model.ids.indexOf(l)!=-1&&l?this._duplicate=!0:l&&(this._duplicate=!1),!this.addFormValidate())return!0}else if(i=w.getElementById(y._id+"EditForm"),a=i&&i.length,h="#treegrid"+y._id+"predecessoredit",d="",!this.editFormValidate())return!0;if(n=e(i).closest("div"),this._duplicate)return alert(y._alertTexts.idValidationAlert),!0;for(c=0;c0&&(y._cellEditColumn=y._columns[c],l=y.getCurrentEditCellData(o,y._columns[c].dropdownData),y._isinAddnewRecord===!1&&y._columns[c].mappingName===y.model.predecessorMapping&&(S.previousValue=y._updatePredecessorValue(x,l)),x[y._columns[c].mappingName]=l);if(date1=y._getDateFromFormat(x[C.startDateMapping]),date2=y._getDateFromFormat(x[C.endDateMapping]),u=0,date1&&date2&&(u=date2.getTime()-date1.getTime()),this._wrongenddate=u<0,this._wrongenddate)return alert(y._alertTexts.dateValidationAlert),!0;x[C.resourceInfoMapping]&&n.hasClass("e-addedrow")&&(m=[],e.each(x[C.resourceInfoMapping],function(e,t){m.push(t[C.resourceIdMapping])}),x[C.resourceInfoMapping]=m),x[C.taskIdMapping]||"Edit"!==t||(x[C.taskIdMapping]=y._editedDialogRecord.taskId),S.data=x;var T=[],D=!1;if(C.predecessorMapping&&("Edit"===t?(D=0===C.editDialogFields.length,T=e.grep(C.editDialogFields,function(e){return e.field===C.predecessorMapping})):"Add"===t&&(D=0===C.addDialogFields.length,T=e.grep(C.addDialogFields,function(e){return e.field===C.predecessorMapping}))),T.length>0||D){if(p=[],g=!0,e(h).ejTreeGrid("model.isEdit")&&e(h).ejTreeGrid("saveCell"),p=e(h).ejTreeGrid("option","dataSource"),e.each(p,function(e,t){t.id.length>0&&t.name.length&&t.type.length||(g=!1)}),!g)return alert(y._alertTexts.predecessorAddingValidationAlert),!0;var I,k=[],P=[],L=[{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"}];for(_=0;_0)for(a=u._idFromPredecessor(p),n=0;n0&&e.each(currentRecord.predecessor,function(e,t){currentRecord.taskId.toString()!==t.from&&(d.push(t.from.toString()),h=e)}),m.toString()===currentRecord.taskId.toString()||d.indexOf(m.toString())!==-1))return!1;if(r.push(i),s.isNullOrUndefined(currentRecord.predecessor)||!(currentRecord.predecessor.length>0))break;if(d.length>1?c=this._predecessorValidation(d,t):1==d.length&&(i=currentRecord.predecessor[h].from),c===!1)return!1}}return!0},_predecessorValidation:function(t,i){for(var a,n,o,r=this,l=i.currentRecord.taskId,d=0;d0&&e.each(currentRecord.predecessor,function(e,t){currentRecord.taskId.toString()!==t.from&&o.push(t.from.toString())}),l.toString()===currentRecord.taskId.toString()||o.indexOf(l.toString())!==-1))return!1;if(a.push(currentId),s.isNullOrUndefined(currentRecord.predecessor)||!(currentRecord.predecessor.length>0))break;currentId=currentRecord.predecessor[0].from}return!0},_sendCancelRequest:function(){var t=this,i=t.model,a={};i.dateFormat.indexOf("hh")!=-1?e("#"+t._id+"EditForm").find(".e-datepicker").ejDateTimePicker("destroy"):e("#"+t._id+"EditForm").find(".e-datepicker").ejDatePicker("destroy"),a.requestType=s.TreeGrid.Actions.Cancel,t._$treegridHelper.ejTreeGrid("processBindings",a),t._primaryKeyValues=[],t.model.currentData=null},_updatePredecessorValue:function(e,t){var i,s,a,n,o,r=this,l=0,d=[],h=0,c="row"==model.selectionMode?r.selectedItem():model.updatedRecords[r._rowIndexOfLastSelectedCell];for(i=c.predecessor,t.length>0&&(s=c._calculatePredecessor(t)),s&&(l=s.length),n=0,o=0,i&&(o=i.length),n=0;n0?o._getSelectedItem(t.ejDropDownList("model.selectedItems"),i):t.ejDropDownList("model.value");break;case s.TreeGrid.EditingType.Boolean:n=t.is(":checked");break;case s.TreeGrid.EditingType.DatePicker:a=t.ejDatePicker("model.value"),n=o._cellEditColumn&&!o._cellEditColumn.format?o.getFormatedDate(a):a;break;case s.TreeGrid.EditingType.DateTimePicker:a=t.ejDateTimePicker("model.value"),n=o._cellEditColumn&&!o._cellEditColumn.format?n=o.getFormatedDate(a):a;break;case s.TreeGrid.EditingType.Maskedit:n=t.ejMaskEdit("model.value")}return n}return null},_getSelectedItem:function(t,i){var s=0,a=t.length,n=[];if(i)for(s=0;s0){for(s=[],a=0;a1&&(a=h.getParentItem(e,u.level),a.childRecords.splice(a.childRecords.length,0,u),c.parentTaskIdMapping?u.item[c.parentTaskIdMapping]=a.taskId:a.item[c.childMapping].splice(a.childRecords.length,0,u.item),u.parentItem=a),u.parentItem.isMilestone&&(u.parentItem.isMilestone=!1),e.hasChildRecords=!!e.childRecords&&e.childRecords.length>0,u.level+=1,(_._searchString.length>0||_.model.sortSettings.sortedColumns.length>0)&&(g=!0),h.updateLevel(u,1,g),g||h.refreshGanttRecord(u),0===e.level&&c.parentRecords.indexOf(e)===-1&&c.parentRecords.push(e),u.level>0&&c.parentRecords.indexOf(u)!==-1&&(n=c.parentRecords.indexOf(u),c.parentRecords.splice(n,1)),u.parentItem&&h._updateParentItem(u),e.predecessor&&e.predecessor.length>0&&c.predecessorMapping&&e.hasChildRecords&&h._updatePredecessorOnIndentOutdent(e),g||h.refreshGanttRecord(e),h.getExpandStatus(u)||(o={},o.expanded=!0,o.data=u.parentItem,h.expanding(o)),h._$treegridHelper.ejTreeGrid("setUpdatedRecords",c.flatRecords,c.updatedRecords,c.ids,c.parentRecords,this.dataSource()),g&&(m.requestType="indent",h._$treegridHelper.ejTreeGrid("processBindings",m),r={},r.requestType=s.TreeGrid.Actions.Refresh,h._$treegridHelper.ejTreeGrid("sendDataRenderingRequest",r),h.model.updatedRecords=h.getUpdatedRecords(),h.model.currentViewData=h.getCurrentViewData(),h._$ganttchartHelper.ejGanttChart("setUpdatedRecords",c.currentViewData,c.updatedRecords,c.flatRecords,c.ids),h._$ganttchartHelper.ejGanttChart("refreshHelper",c.currentViewData,c.updatedRecords,h._totalCollapseRecordCount),h.updateAltRow(c.updatedRecords,0,1)),c.predecessorMapping&&(h._isValidationEnabled=!1,h._connectorlineIds=[],h._connectorLinesCollection=[],h._$ganttchartHelper.ejGanttChart("clearConnectorLines"),h._createConnectorLinesCollection()),l=c.updatedRecords.indexOf(u),d=h.getGanttChartRows(),m={rowElement:d.eq(l),data:h.model.selectedItem,recordIndex:l},h._$ganttchartHelper.ejGanttChart("selectRows",m.recordIndex),h._$treegridHelper.ejTreeGrid("selectRows",m.recordIndex),this.selectedItem(m.data),this.selectedRowIndex(m.recordIndex),c.allowSelection&&h.updateIndentOutdentOption(u),c.enableWBS){var f=u.parentItem.WBS,b=u.parentItem.childRecords.length,v=[u];h.reCalculateWBS(v,b,f),h.updateWBSdetails(u.parentItem)}p.data=u,p.requestType="indent",this._trigger("actionComplete",p)}},_updatePredecessorOnIndentOutdent:function(e){for(var t,i,s,a,n=this,o=e.predecessor.length,r=e.predecessor,l=[],d=0;d0&&(i+="+"+e[a].offset.toString()+"d")),s.push(i));return s.join(",")},getParentItem:function(e,t){var i=this;return e.parentItem.level===t?e.parentItem:i.getParentItem(e.parentItem,t)},getSubChangeIndex:function(e,t,i){for(var s,a=this,n=0;nt){i.parentItem&&a.model.updatedRecords[n].parentItem.taskId==i.parentItem.taskId&&(s=a.model.updatedRecords[n].index);break}return s},_nextSameLevelItem:function(e,t){var s,a=e.parentItem.level,n=t.indexOf(e);for(i=n;it[i].level){s=t[i];break}return s},_sendOutdentRequest:function(){var e,t,a,n,o,r,l,d,h,c,u,m,p,g,_,f=this,b=f.model,v=f.getCurrentData(),x={},w={};if(f.cancelEditCell(),s.isNullOrUndefined(v))alert(f._alertTexts.outdentAlert);else if(x.data=v,x.requestType="outdent",!f._trigger("actionBegin",x)){if(0===v.level)return;if(e=f._nextSameLevelItem(v,b.flatRecords),a=b.flatRecords.indexOf(v),n=v.parentItem,o=v.parentItem.childRecords.indexOf(v),r=v.parentItem.parentItem,l=r&&v.parentItem.parentItem.childRecords.indexOf(e),v.parentItem.childRecords.splice(o,1),b.parentTaskIdMapping||v.parentItem.item[b.childMapping].splice(o,1),0==v.parentItem.childRecords.length?(v.parentItem.childRecords=null,v.parentItem.expanded=!1,v.parentItem.hasChildRecords=!1):f._updateParentItem(v.parentItem.childRecords[0]),r?(l!=-1?r.childRecords.splice(l,0,v):r.childRecords.push(v),b.parentTaskIdMapping?v.item[b.parentTaskIdMapping]=r.taskId:l!=-1?r.item[b.childMapping].splice(l,0,v.item):r.item[b.childMapping].push(v.item),v.parentItem=r):(this.dataSource()instanceof s.DataManager?this.dataSource().dataSource.offline&&this.dataSource().dataSource.json?b.parentTaskIdMapping||this.dataSource().dataSource.json.push(v.item):f._isDataManagerUpdate&&(b.parentTaskIdMapping||(f._jsonData=f._$treegridHelper.ejTreeGrid("getUpdatedDatamanagerData"),f._jsonData.push(v.item))):b.parentTaskIdMapping||(e?(u=this.dataSource().indexOf(e.item),this.dataSource().splice(u,0,v.item)):this.dataSource().push(v.item)),v.parentItem=null,b.parentTaskIdMapping&&(v.item[b.parentTaskIdMapping]=null)),d=f._$treegridHelper.ejTreeGrid("getChildCount",v,0),h=b.flatRecords.splice(a,d+1),c=b.ids.splice(a,d+1),t=e?b.flatRecords.indexOf(e):b.flatRecords.length,v.hasChildRecords&&v.childRecords.length>0)for(i=0;i0&&b.predecessorMapping&&v.hasChildRecords&&f._updatePredecessorOnIndentOutdent(v),b.updatedRecords=b.enableVirtualization?f._$treegridHelper.ejTreeGrid("getExpandedRecords",b.flatRecords):b.flatRecords.slice(),f._$treegridHelper.ejTreeGrid("setUpdatedRecords",b.flatRecords,b.updatedRecords,b.ids,b.parentRecords,this.dataSource()),x.requestType="outdent",f._$treegridHelper.ejTreeGrid("processBindings",x),m={},m.requestType=s.TreeGrid.Actions.Refresh,f._$treegridHelper.ejTreeGrid("sendDataRenderingRequest",m),f.model.updatedRecords=f.getUpdatedRecords(),f.model.currentViewData=f.getCurrentViewData(),f._$ganttchartHelper.ejGanttChart("setUpdatedRecords",b.currentViewData,b.updatedRecords,b.flatRecords,b.ids),f.model.predecessorMapping&&(f._isValidationEnabled=!1,f._connectorlineIds=[],f._connectorLinesCollection=[],f._$ganttchartHelper.ejGanttChart("clearConnectorLines"),f._createConnectorLinesCollection()),f._$ganttchartHelper.ejGanttChart("refreshHelper",b.currentViewData,b.updatedRecords,f._totalCollapseRecordCount),f.updateAltRow(b.updatedRecords,0,1),p=b.updatedRecords.indexOf(v),g=f.getGanttChartRows(),x={data:f.model.selectedItem,recordIndex:p},f._$ganttchartHelper.ejGanttChart("selectRows",x.recordIndex),f._$treegridHelper.ejTreeGrid("selectRows",x.recordIndex),this.selectedItem(x.data),this.selectedRowIndex(x.recordIndex),b.allowSelection&&f.updateIndentOutdentOption(v),b.enableWBS&&(_=n.childRecords&&n.childRecords[o],_&&f.updateWBSdetails(_,!0),f.updateWBSdetails(n),_&&f.updateWBSdetails(_,!0,!0)),w.data=v,w.requestType="outdent",this._trigger("actionComplete",w)}},_refreshChildLevel:function(e){for(var t,i=this,s=0,a=e.childRecords,n=a.length,s=0;so||u.right0&&(l=p)),e(window).height()0&&(a=s.buildTag("div.e-innerContextmenu","",{display:"table",position:"absolute","border-width":"1px","border-style":"solid","z-index":"10034"},{id:this._id+"_SubContextMenu"+h}),n=s.buildTag("ul",e.render[l._id+"contextMenuTemplate"](c),{margin:"0px","padding-left":"0px"},{"data-icon":!1,type:"none","data-role":"list-divider"}),a.append(n),e(document.body).append(a),r=l._getSubContextMenuPosition(t,a),e(a).css({top:r.top,left:r.left}),o=a.find(".e-menuitem"),o.css({width:e(a).width()+2}),e(o).mouseenter(function(){e(this).hasClass("e-disable")||(l._showSubContextMenu(this,i),e(this).closest(".e-innerContextmenu").find(".e-contextmenu-mouseover").removeClass("e-contextmenu-mouseover"),e(this).addClass("e-contextmenu-mouseover"),l._activeMenuItemId=e(this).attr("id"))}),l._on(a,"contextmenu",function(e){e.preventDefault()}),e(o).click(function(){l._contextMenuClickHandler(this)}))},_removeContextMenu:function(t,i){var s,a,n=e("#"+this._id+"_SubContextMenu"+t.parentMenuId),o=e(n).find(".e-contextmenu-mouseover");e(o).length>0&&(s=i.filter(function(t){if(t.menuId==e(o).attr("id"))return!0}),s.length>0&&(a=i.filter(function(e){if(e.parentMenuId==s[0].menuId)return!0}),a.length>0&&this._removeContextMenu(a[0],i)),e("#"+this._id+"_SubContextMenu"+e(o).attr("id")).remove())},_getSubContextMenuPosition:function(t,i){var s,a,n,o,r=(this.model,e(i).width()),l=e(i).height(),d=this._$treegridHelper.ejTreeGrid("getOffsetRect",t),h={top:"",left:""},c=e(t).closest(".e-contextmenu");return 0==c.length&&(c=e(t).closest(".e-innerContextmenu")),a=e(c).width(),h.top=d.top-1,h.left=d.left+e(c).width()+1,s=h.left,n=this._$treegridHelper.ejTreeGrid("getOffsetRect",this.element[0]),n.bottom=n.top+this.element[0].offsetHeight,n.right=n.left+e(this.element).width(),(n.left>s||n.right0&&(h.left=s)),n.bottom0&&(h.top=o)),h},_contextMenuClickHandler:function(t){var i=e(t).attr("id"),s=this,a={};if(!e(t).hasClass("e-disable")&&0==e(t).find(".e-expander").length)switch(i){case"Task":a.requestType="contextMenuTaskDetails",s.contextMenuAction(a),s._clearContextMenu();break;case"Indent":a.requestType="contextMenuIndent",s.contextMenuAction(a),s._clearContextMenu(),s._$treegrid.focus();break;case"Outdent":a.requestType="contextMenuOutdent",s.contextMenuAction(a),s._clearContextMenu(),s._$treegrid.focus();break;case"Delete":a.requestType="contextMenuDelete",s.contextMenuAction(a),s._clearContextMenu(),s._$treegrid.focus();break;case"Above":a.requestType="save",a.position="Above",s.subContextMenuAction(a),s._clearContextMenu(),s._$treegrid.focus();break;case"Below":a.requestType="save",a.position="Below",s.subContextMenuAction(a),s._clearContextMenu(),s._$treegrid.focus();break;case"Open":a.requestType="contextMenuAdd",s.contextMenuAction(a),s._clearContextMenu(),s._$treegrid.focus();break;case"Add":s._setInitialData();break;default:a.data=s._contextMenuSelectedItem,s._triggerMenuEventHandler(i,a),s._clearContextMenu()}},_triggerMenuEventHandler:function(t,i){var a,n,o,r=this,l=r._contextMenuItems;s.isNullOrUndefined(l)||(a=l.filter(function(e){if(e.menuId.toString()===t)return!0}),a.length>0&&(n=a[0],i.menuId=t,o=n.eventHandler,o&&("string"==typeof o&&(o=s.util.getObject(o,window)),e.isFunction(o)&&(args=s.event("customContextMenuHandler",this.model,i),o.call(this,args)))))},_setInitialData:function(){var e=this,t=e.model;0==t.flatRecords.length&&(e.addRecord(),e._clearContextMenu())},updateConnectorLines:function(t,i){for(var s,a,n,o=this,r=t.length/2,l=0,l=0;l0?"#"+this._id+t:"#"+t);n.rules("add",i),a=e("#"+this._id+"EditForm").validate(),s.isNullOrUndefined(i.required)||(a.settings.messages.Name={},a.settings.messages.Name.required=s.TreeGrid.getColumnByField(proxy._columns,t).headerText+" is required")},_createConnectorLinesCollection:function(e){var t,i,s,a,n=this,o=this.model,r=o.currentViewData.length,l=n._predecessorsCollection,d=(l.length,o.enableVirtualization);if(o.enableVirtualization&&"Load"===e)for(r=o.updatedRecords.length,t=0;t1&&(n.isdrawn=!1),o=m[g.indexOf(n.from)],r=m[g.indexOf(n.to)],p.indexOf(o)!==-1&&p.indexOf(r)!=-1&&(c.enableVirtualization||o.isExpanded!==!1&&r.isExpanded!==!1)&&o&&r&&(u=h._createConnectorLineObject(o,r,n),u&&(h._connectorlineIds.length>0&&h._connectorlineIds.indexOf(u.ConnectorLineId)==-1?(h._connectorLinesCollection.push(u),h._connectorlineIds.push(u.ConnectorLineId)):0==h._connectorlineIds.length?(h._connectorLinesCollection.push(u),h._connectorlineIds.push(u.ConnectorLineId)):h._connectorlineIds.indexOf(u.ConnectorLineId)!=-1&&(d=h._connectorlineIds.indexOf(u.ConnectorLineId),h._connectorLinesCollection[d]=u),n.isdrawn=!0))}},_createConnectorLineObject:function(e,t,i){var s,a,n,o={},r=this,l=r.model,d=l.updatedRecords,h=d.indexOf(e),c=d.indexOf(t),u=0,m=0;if(h!==-1&&c!==-1){if(!l.enableVirtualization)if(n=0,c>h){for(u=0;uc){for(u=0;ua?s-a:a-s,o.Type=i.predecessorsType,o.ConnectorLineId="parent"+e.taskId+"child"+t.taskId,o.milestoneParent=!!e.isMilestone,o.milestoneChild=!!t.isMilestone,o}},_getDateAfterWeekendHolidays:function(e){var t,i=this.model,s=this._getStringHolidays(),a=new Date(e),n=!1;return a.setHours(0,0,0,0),t=this._getFormatedDate(a,i.dateFormat),s.indexOf(t)!=-1&&(e.setDate(e.getDate()+1),n=!0),i.includeWeekend===!1&&(0==e.getDay()?(e.setDate(e.getDate()+1),n=!0):6==e.getDay()&&(e.setDate(e.getDate()+2),n=!0)),n?this._getDateAfterWeekendHolidays(e):e},_getDateBeforeWeekendHolidays:function(e){var t,i=this.model,s=this._getStringHolidays(),a=new Date(e),n=!1;return a.setHours(0,0,0,0),t=this._getFormatedDate(a,i.dateFormat),s.indexOf(t)!=-1&&(e.setDate(e.getDate()-1),n=!0),i.includeWeekend===!1&&(0==e.getDay()?(e.setDate(e.getDate()-2),n=!0):6==e.getDay()&&(e.setDate(e.getDate()-1),n=!0)),n?this._getDateBeforeWeekendHolidays(e):e},_updateDateByOffset:function(e,t){var i,s,a=this;a._stringHolidays,this.model.includeWeekend;if(t<0?(t*=-1,i=-1):i=1,t)for(s=0;s0&&(e=this._getDateAfterWeekendHolidays(e)),e.setDate(e.getDate()+i);return i<0?this._getDateBeforeWeekendHolidays(e):this._getDateAfterWeekendHolidays(e)},_setStartDateByDurationEndDate:function(e){var t,i,a=this.model,n=(a.scheduleHeaderSettings.scheduleHeaderType,s.Gantt.ScheduleHeaderType,a.durationUnit),o=n==s.Gantt.DurationUnit.Day?e.duration-1:e.duration;if(e.isMilestone)e.startDate=e.endDate;else{for(t=new Date(e.endDate),i=0;i1&&(h=u._getPredecessorDate(t,v,i.predecessorsType),m.includeWeekend===!1&&u._setBeforeWeekend(h),t.startDate=new Date(h)),t.left=t._calculateLeft(u._projectStartDate,u._perDayWidth,u._holidaysList,m),t.width=t._calculateWidth(u._perDayWidth,u._holidaysList,m),t.progressWidth=t._calculateProgressWidth(t.width,t.status)}else i.offset=u._calculateOffset(r,o),t.predecessorsName=u._predecessorToString(t.predecessor,t),t.item[m.predecessorMapping]=t.predecessorsName;break;case"SF":if(r=new Date(e.startDate),l=new Date(t.endDate),_==s.Gantt.DurationUnit.Day&&r.setDate(r.getDate()-1),"week"!=g||"day"!=_||(m.enablePredecessorValidation||0!=p)&&0!=a||1==n){r=this._getDateBeforeWeekendHolidays(r),r=u._updateDateByOffset(r,p),t.endDate=new Date(r),this._setStartDateByDurationEndDate(t);var f=t.taskId.toString(),b=t.predecessor,v=b.filter(function(e){return e.to===f});v.length>0&&(h=u._getPredecessorDate(t,v,i.predecessorsType),_==s.Gantt.DurationUnit.Day&&h.setDate(h.getDate()-1),h=this._getDateBeforeWeekendHolidays(h),t.endDate=new Date(h),this._setStartDateByDurationEndDate(t)),t.left=t._calculateLeft(u._projectStartDate,u._perDayWidth,u._holidaysList,m),t.width=t._calculateWidth(u._perDayWidth,u._holidaysList,m),t.progressWidth=t._calculateProgressWidth(t.width,t.status)}else i.offset=u._calculateOffset(r,l),t.predecessorsName=u._predecessorToString(t.predecessor,t),t.item[m.predecessorMapping]=t.predecessorsName;break;case"FS":if(d=new Date(e.endDate),o=new Date(t.startDate),t.isMilestone||_==s.Gantt.DurationUnit.Day&&d.setDate(d.getDate()+1),"week"!=g||"day"!=_||(m.enablePredecessorValidation||0!=p)&&0!=a||1==n){if(d=this._getDateAfterWeekendHolidays(d),d=u._updateDateByOffset(d,p),t.startDate=new Date(d),u._editedTaskBarItem!==t){var b=t.predecessor,f=t.taskId.toString(),v=b&&b.filter(function(e){return e.to===f});v&&v.length>1&&(c=u._getPredecessorDate(t,v,i.predecessorsType),t.isMilestone||_==s.Gantt.DurationUnit.Day&&c.setDate(c.getDate()+1),c=this._getDateAfterWeekendHolidays(c),t.startDate=new Date(c))}t.left=t._calculateLeft(u._projectStartDate,u._perDayWidth,u._holidaysList,m),t.width=t._calculateWidth(u._perDayWidth,u._holidaysList,m),t.progressWidth=t._calculateProgressWidth(t.width,t.status)}else i.offset=u._calculateOffset(d,o),t.predecessorsName=u._predecessorToString(t.predecessor,t),t.item[m.predecessorMapping]=t.predecessorsName;break;case"FF":if(d=new Date(e.endDate),l=new Date(t.endDate),"week"!=g||"day"!=_||(m.enablePredecessorValidation||0!=p)&&0!=a||1==n){d=this._updateDateByOffset(d,p),t.endDate=new Date(d),this._setStartDateByDurationEndDate(t);var f=t.taskId.toString(),b=t.predecessor,v=b&&b.filter(function(e){return e.to===f});v&&v.length>1&&(c=u._getPredecessorDate(t,v,i.predecessorsType),c=this._getDateAfterWeekendHolidays(c),t.endDate=new Date(c),this._setStartDateByDurationEndDate(t)),t.left=t._calculateLeft(u._projectStartDate,u._perDayWidth,u._holidaysList,m),t.width=t._calculateWidth(u._perDayWidth,u._holidaysList,m),t.progressWidth=t._calculateProgressWidth(t.width,t.status)}else i.offset=u._calculateOffset(d,l),t.predecessorsName=u._predecessorToString(t.predecessor,t),t.item[m.predecessorMapping]=t.predecessorsName}t.parentItem&&u._updateParentItem(t),(u._isTreeGridRendered||u._isGanttChartRendered)&&u.refreshGanttRecord(t)}},_calculateOffset:function(e,t){var i,s,a=this,n=a.model,o=a._daydiff(e,t);return n.includeWeekend||(i=a._calculateWeekendCount(e,o),o=o>0?o-i:o+i),n.holidays.length&&(s=a._calculateHolidayCount(e,t),o=o>0?o-s:o+s),o},_getPredecessorDate:function(e,t,i){var s,a,n,o,r,l=null,d=this,h=d.model,c=null,u=h.flatRecords,m=h.ids,p=t.filter(function(t){if(t.to===e.taskId.toString()&&t.predecessorsType===i)return!0});if(p)for(s=p.length,a=0;ac.getTime()&&(c=r);return"FS"==i||"FF"==i?c:"SF"==i||"SS"==i?l:void 0},_setBeforeWeekend:function(e){0==e.getDay()?e.setDate(e.getDate()-2):6==e.getDay()&&e.setDate(e.getDate()-1)},_setAfterWeekend:function(e){0==e.getDay()?e.setDate(e.getDate()+1):6==e.getDay()&&e.setDate(e.getDate()+2)},_updateEditedGanttRecords:function(e){var t,i=this,s=i.model,a=e.data,n=new Date(a.startDate),o=!1;if("startDate"===e.columnName)this._stringHolidays&&this._stringHolidays.indexOf(a._getFormatedDate(n,s.dateFormat))!=-1&&n.setDate(n.getDate()+1),i.model.includeWeekend===!1&&(this._setAfterWeekend(n),this._stringHolidays&&this._stringHolidays.indexOf(a._getFormatedDate(n,s.dateFormat))!=-1&&n.setDate(n.getDate()+1)),a.startDate=new Date(n),a.left=a._calculateGanttRecordLeft(n,i._projectStartDate,i._perDayWidth),a.width=a._calculateWidth(i._perDayWidth,i._holidaysList,s),a.progressWidth=a._calculateProgressWidth(a.width,a.status),a.parentItem&&i._updateParentItem(a);else if("endDate"===e.columnName)t=new Date(a.endDate),n.getTime()<=t.getTime()?(this._stringHolidays&&this._stringHolidays.indexOf(a._getFormatedDate(t,s.dateFormat))!=-1&&(t.setDate(t.getDate()+1),6==t.getDay()&&t.setDate(t.getDate()+2)),s.includeWeekend===!1&&(0==t.getDay()?t.setDate(t.getDate()-2):6==t.getDay()&&t.setDate(t.getDate()-1)),n.getTime()==t.getTime()&&s.dateFormat.indexOf("hh")!=-1&&(a.isMilestone=!0),a.endDate=new Date(t),a._calculateDuration(n,t,s.includeWeekend,s.holidays,a.isMilestone,s),a.width=a._calculateTaskbarWidth(i._perDayWidth,s),a.progressWidth=a._calculateProgressWidth(a.width,a.status),a.parentItem&&i._updateParentItem(a)):(a.endDate=e.previousValue,a.item[s.endDateMapping]=e.previousValue),a.isMilestone=0===a.duration;else if("duration"==e.columnName){var r=a.duration,l=r-e.previousValue,d=i._calculateUpdatedDate(i._getDateFromFormat(a.endDate),l);a.isMilestone=0===r,a.endDate=d,a.width=a._calculateWidth(i._perDayWidth,i._holidaysList,s),a.progressWidth=a._calculateProgressWidth(a.width,a.status),s.endDateMapping&&(a.item[s.endDateMapping]=a.endDate),a.parentItem&&i._updateParentItem(a)}else"predecessor"==e.columnName?(o=!0,e.previousValue&&i._removeConnectorLine(e.previousValue,a),i._addConnectorLine(a)):"status"==e.columnName&&(a.status=a.status>100?100:a.status,a.progressWidth=i._getProgressWidth(a.width,a.status),a.parentItem&&a.parentItem&&i._updateParentItem(a));a.predecessor&&(o||i._$ganttchartHelper.ejGanttChart("updateConnectorLineOffset",a),i._isMileStoneEdited=a.isMilestone,i._updatedConnectorLineCollection=[],i._connectorlineIds=[],"predecessor"===e.columnName?i._validatePredecessor(a,e.previousValue):i._validatePredecessor(a),i._updatedConnectorLineCollection.length>0&&i._$ganttchartHelper.ejGanttChart("appendConnectorLine",i._updatedConnectorLineCollection)),i._isValidationEnabled=!1,i.refreshGanttRecord(a)},_removeConnectorLine:function(e,t){for(var i,s,a,n=this,o=this.model,r=0,l=e&&e.length,d=-1,h=o.flatRecords,c=o.ids,r=0;r=0&&s.predecessor.splice(d,1)),s&&a&&(i="parent"+s.taskId+"child"+a.taskId,n._$ganttchartHelper.ejGanttChart("removeConnectorline",i))},_addConnectorLine:function(e){var t,i,s,a=this,n=0,o=a.model,r=e.predecessor,l=o.flatRecords,d=o.ids;if(r)for(t=r.length,n=0;n0)for(r;r0&&t._connectorlineIds.indexOf(o.ConnectorLineId)==-1?(t._updatedConnectorLineCollection.push(o),t._connectorlineIds.push(o.ConnectorLineId)):0==t._connectorlineIds.length&&(t._updatedConnectorLineCollection.push(o),t._connectorlineIds.push(o.ConnectorLineId)),t._$ganttchartHelper.ejGanttChart("appendConnectorLine",t._updatedConnectorLineCollection))))},_updateGanttRecord:function(e){var t=this,i=t.model;e.left=e._calculateLeft(t._projectStartDate,t._perDayWidth,t._holidaysList,i),e.width=e._calculateWidth(t._perDayWidth,i.holidays,i),t.refreshGanttRecord(e),e.parentItem&&t._updateParentItem(e)},refreshGanttRecord:function(e){var t,i,a,n=this;n._isTreeGridRendered&&(n.model.currentViewData=n.getCurrentViewData(),t=n.model.currentViewData.indexOf(e),i=n._$treegridHelper.ejTreeGrid("instance"),i.model.allowSelection=n.model.allowSelection,s.TreeGrid.refreshRow(i,t),n._isGanttChartRendered&&n._$ganttchartHelper.ejGanttChart("refreshRow",t),a={},a.data=e,a.item=e.item,a.requestType="recordUpdate",n._trigger("actionComplete",a))},_updateParentItem:function(e,t){var i,a,n,o,r=this,l=e.parentItem,d=r.model,h=d.scheduleHeaderSettings.scheduleHeaderType,c=s.Gantt.ScheduleHeaderType,u=new Date(l.startDate),m=new Date(e.startDate),p=new Date(l.endDate),g=new Date(e.endDate);m.getTime()p.getTime()&&(dateDiff=r._daydiff(p,g),l.endDate=e.endDate,d.endDateMapping&&(l.item[d.endDateMapping]=l.endDate));for(var _,f=0,b=l.childRecords,v=b&&b.length,x=null,w=null,y=null,C=0,S=0,T=0,D=0,f=0;fy.getTime()&&(y=new Date(_.endDate),x=d.flatRecords.indexOf(_)),_.startDate.getTime()0?D/T*100:0,l.progressWidth=r._getProgressWidth(l.width,C),l.status=Math.round(C),d.progressMapping&&(l.item[d.progressMapping]=l.status),(r._isTreeGridRendered||r._isGanttChartRendered)&&r.refreshGanttRecord(l),l.parentItem&&r._updateParentItem(l)},_updatedRecordsDateByPredecessor:function(){for(var e=this,t=this.model,i=t.flatRecords,s=i.length,a=0;a0&&a._connectorlineIds.indexOf(d.ConnectorLineId)==-1?(a._updatedConnectorLineCollection.push(d),a._connectorlineIds.push(d.ConnectorLineId)):0==a._connectorlineIds.length?(a._updatedConnectorLineCollection.push(d),a._connectorlineIds.push(d.ConnectorLineId)):a._connectorlineIds.indexOf(d.ConnectorLineId)!=-1&&(s=a._connectorlineIds.indexOf(d.ConnectorLineId),a._updatedConnectorLineCollection[s]=d)));for(i=f.length,v=0;v0&&a._connectorlineIds.indexOf(d.ConnectorLineId)==-1?(a._updatedConnectorLineCollection.push(d),a._connectorlineIds.push(d.ConnectorLineId)):0==a._connectorlineIds.length?(a._updatedConnectorLineCollection.push(d),a._connectorlineIds.push(d.ConnectorLineId)):a._connectorlineIds.indexOf(d.ConnectorLineId)!=-1&&(s=a._connectorlineIds.indexOf(d.ConnectorLineId),a._updatedConnectorLineCollection[s]=d)),c&&a._validatePredecessor(c))}},_isOffsetChange:function(e,t,i){var a=this,n=a.model,o=!1;if(!n.enablePredecessorValidation)if(t&&t.length){var r=e.offset?parseInt(e.offset):0,l=t[i],d=l.offset?parseInt(l.offset):0;o=r!=d}else o=!s.isNullOrUndefined(t);return o},_calculateDateDifference:function(e,t){var i=t>=0?t:-1*t;return t>0?i-this._calculateWeekendCount(e,t):t+this._calculateWeekendCount(e,t)},_calculateWeekendCount:function(e,t){var i=t>=0?t:-1*t,s=0,a=0;if(t>0)for(a=0;at?e:t,l=0,d=0;d=o&&i._getDateFromFormat(a[d].day)<=r&&l++;return l},dateUpdate:function(e,t,i,s){return s||(s=0),new Date(e.getFullYear(),e.getMonth(),e.getDate()+t,e.getHours()+i,e.getMinutes()+s,e.getSeconds(),e.getMilliseconds())},_refreshChartAndGridRows:function(){var e,t=this,i=this.model;t._$treegridHelper.ejTreeGrid("processBindings"),e={},e.requestType=s.TreeGrid.Actions.Refresh,t._$treegridHelper.ejTreeGrid("sendDataRenderingRequest",e),t.model.updatedRecords=t.getUpdatedRecords(),t.model.currentViewData=t.getCurrentViewData(),collapsedRecordCount=t._$treegridHelper.ejTreeGrid("getCollapsedRecordCount"),t._totalCollapseRecordCount=collapsedRecordCount, height=(t.model.updatedRecords.length-collapsedRecordCount)*i.rowHeight,t._$ganttchartHelper.ejGanttChart("setUpdatedRecords",i.currentViewData,i.updatedRecords,i.flatRecords,i.ids),t._$ganttchartHelper.ejGanttChart("refreshHelper",i.currentViewData,i.updatedRecords,t._totalCollapseRecordCount),t._isInAdd||(t._$treegridHelper.ejTreeGrid("updateHeight"),t._$ganttchart.ejGanttChart("updateHeight",height),t._$ganttchartHelper.ejGanttChart("setCollapsedRecordCount",collapsedRecordCount),t._$ganttchartHelper.ejGanttChart("refreshGridLinesTable",t.model.updatedRecords.length-collapsedRecordCount),i.enableAltRow&&i.currentViewData.length>0&&s.TreeGrid.updateAltRow(t,i.currentViewData[0],0,0),i.predecessorMapping&&(t._isValidationEnabled=!1,t._connectorlineIds=[],t._connectorLinesCollection=[],t._$ganttchartHelper.ejGanttChart("clearConnectorLines"),t._createConnectorLinesCollection()))},_refreshGanttOnExpandCollapseAll:function(){var e=this,t={},i=this.model,a=0,n=0;if(i.enableVirtualization)t.requestType=s.TreeGrid.Actions.ExpandCollapse,e._$treegridHelper.ejTreeGrid("sendDataRenderingRequest",t),i.updatedRecords=e.getUpdatedRecords(),i.currentViewData=e.getCurrentViewData(),e._$ganttchartHelper.ejGanttChart("clearConnectorLines"),e._$ganttchartHelper.ejGanttChart("refreshHelper",e.model.currentViewData,e.model.updatedRecords),e._$treegridHelper.ejTreeGrid("refreshHeight");else{if(e._isRefreshAddedRecord)return e._refreshChartAndGridRows(),void(e._isRefreshAddedRecord=!1);a=e._$treegridHelper.ejTreeGrid("getCollapsedRecordCount"),e._totalCollapseRecordCount=a,n=(e.model.updatedRecords.length-a)*i.rowHeight,e._$ganttchartHelper.ejGanttChart("clearConnectorLines"),e._$treegridHelper.ejTreeGrid("updateHeight"),e._$ganttchart.ejGanttChart("updateHeight",n),e._$ganttchartHelper.ejGanttChart("setCollapsedRecordCount",a),e._$ganttchartHelper.ejGanttChart("refreshGridLinesTable",e.model.updatedRecords.length-a),i.enableAltRow&&i.currentViewData.length>0&&s.TreeGrid.updateAltRow(e,i.currentViewData[0],0,0)}i.predecessorMapping&&(e._isValidationEnabled=!1,e._connectorlineIds=[],e._connectorLinesCollection=[],e._createConnectorLinesCollection())},_collapseAll:function(){var e,t=this,i=t.model,a=0,n={},o=(i.enableVirtualization,t.getRows());for(t._$treegridHelper.ejTreeGrid("cancelEditCell"),t._gridRows=o,t._isInExpandCollapse=!0,t._isInExpandCollapseAll=!0,a=0;a0&&t._refreshGanttOnExpandCollapseAll(),t._isInExpandCollapse=!1,t._isInExpandCollapseAll=!1},_expandCollapseInnerLevelRecord:function(e,t){for(var i=this,a=e.childRecords.length,n={},o=0;o0&&t._refreshGanttOnExpandCollapseAll(),t._isInExpandCollapse=!1,t._isInExpandCollapseAll=!1},_getDateFromFormat:function(e){if(null!=e)return"object"==typeof e?new Date(e):e?null==s.parseDate(e,this.model.dateFormat)?new Date(e):s.parseDate(e,this.model.dateFormat):void 0},_getFormatedDate:function(e,t){return s.format(e,t)},_destroy:function(){var e=this;e.element.empty().removeClass("e-gantt-core e-gantt "+e.model.cssClass)},_updateToolbar:function(){var t,i=this,a=i.model;e("#"+i._id+"_toolbarItems").remove(),a.toolbarSettings.showToolbar&&(i._renderToolBar().insertBefore(e("#e-ejSpliter"+i._id)),i._updateToolbarOptions("")),i._totalBorderHeight="msie"==s.browserInfo().name&&s.browserInfo().version<9?a.toolbarSettings.showToolbar?3:2:a.toolbarSettings.showToolbar?1:0,i._$treegridHelper.ejTreeGrid("cancelEditCell");var n=e("#"+i._id+"_toolbarItems"),o=i.element.find(".e-ganttviewerbodyContianer"),r=i.element.find(".e-ganttviewerheaderContainer"),l="#ejTreeGrid"+i._id+"e-gridcontent",d=e("#e-ejSpliter"+i._id),h=e(i.element).height()-i._totalBorderHeight,c=h-r.height()-2-n.height(),u=o.ejScroller("option","scrollTop"),m=o.ejScroller("option","scrollLeft");o.ejScroller({height:c}),ganttHeight=h-n.height(),d.height(ganttHeight),e("#ejTreeGrid"+i._id).height(ganttHeight),e("#ejGanttChart"+i._id).height(ganttHeight),e(l).height(c),o.height(c),e(l).ejScroller("refresh"),o.ejScroller("option","scrollTop",u),o.ejScroller("option","scrollLeft",m),i._$treegridHelper.ejTreeGrid("updateViewPortHeight"),i._$ganttchartHelper.ejGanttChart("updateViewPortHeight"),i.model.enableVirtualization&&(i._$treegridHelper.ejTreeGrid("processBindings"),t={},t.requestType=s.TreeGrid.Actions.Refresh,i._$treegridHelper.ejTreeGrid("sendDataRenderingRequest",t),i._$ganttchartHelper.ejGanttChart("refreshHelper",i.model.currentViewData,i.model.updatedRecords),i._$ganttchartHelper.ejGanttChart("onScrollHelper",u)),i._clearContextMenu()}}),s.Gantt.EditingType={String:"stringedit",Boolean:"booleanedit",Numeric:"numericedit",Dropdown:"dropdownedit",DatePicker:"datepicker",DateTimePicker:"datetimepicker",Maskedit:"maskedEdit"},s.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"},s.Gantt.ScheduleHeaderType={Year:"year",Month:"month",Week:"week",Day:"day",Hour:"hour"},s.Gantt.minutesPerInterval={Auto:"auto",OneMinute:"oneMinute",FiveMinutes:"fiveMinutes",FifteenMinutes:"fifteenMinutes",ThirtyMinutes:"thirtyMinutes"},s.Gantt.DurationUnit={Day:"day",Hour:"hour",Minute:"minute"},s.Gantt.workingTimeScale={TimeScale8Hours:"TimeScale8Hours",TimeScale24Hours:"TimeScale24Hours"},s.Gantt.AddRowPosition={Top:"top",Bottom:"bottom",AboveSelectedRow:"aboveselectedrow",BelowSelectedRow:"belowselectedrow",Child:"child"},s.Gantt.BeginEditAction={DblClick:"dblClick",Click:"click"},s.Gantt.SelectionType={Single:"single",Multiple:"multiple"},s.Gantt.SelectionMode={Row:"row",Cell:"cell"},s.Gantt.Locale=s.Gantt.Locale||{},s.Gantt.Locale.default=s.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"},columnHeaderTexts:{taskId:"ID",taskName:"Task Name",startDate:"Start Date",endDate:"End Date",resourceInfo:"Resources",duration:"Duration",status:"Progress",predecessor:"Predecessors",type:"Type",offset:"Offset",baselineStartDate:"Baseline Start Date",baselineEndDate:"Baseline End Date",WBS:"WBS",WBSPredecessor:"WBS Predecessor"},editDialogTexts:{addFormTitle:"New Task",editFormTitle:"Edit Task",saveButton:"Save",deleteButton:"Delete",cancelButton:"Cancel",addPredecessor:"Add New",removePredecessor:"Remove"},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"},toolboxTooltipTexts:{addTool:"Add",editTool:"Edit",saveTool:"Update",deleteTool:"Delete",cancelTool:"Cancel",searchTool:"Search",indentTool:"Indent",outdentTool:"Outdent",expandAllTool:"ExpandAll",collapseAllTool:"CollapseAll",nextTimeSpanTool:"Next Timespan",prevTimeSpanTool:"Previous Timespan"},durationUnitTexts:{days:"days",hours:"hours",minutes:"minutes"},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"},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"}},s.Gantt.GanttRecord=function(){var e=this;e.taskId=null,e.taskName=null,e.startDate=null,e.endDate=null,e.duration=null,e.isMilestone=!1,e.status=null,e.predecessor=null,e.resourceInfo=null,e.parentItem=null,e.isSelected=!1,e.childRecords=null,e.hasChildRecords=!1,e.expanded=!1,e.level=0,e.left=0,e.width=0,e.progressWidth=0,e.item=null,e.baselineLeft=0,e.baselineWidth=0,e.baselineStartDate=null,e.baselineEndDate=null,e.isReadOnly=!1,e.hasFilteredChildRecords=!0},s.Gantt.GanttRecord.prototype={_calculateLeft:function(e,t,i,a){var n,o,r,l,d,h=this,c=0,u=new Date(h.startDate),m=new Date(h.endDate),p=m&&m.getHours(),g=m&&m.getMinutes(),_=m&&m.getSeconds(),f=a.scheduleHeaderSettings.scheduleHeaderType,b=s.Gantt.ScheduleHeaderType,v=s.Gantt.DurationUnit,x=0,w=a.workingTimeScale;if(m&&(p=m.getHours(),g=m.getMinutes(),_=m.getSeconds()),f==b.Hour&&a.durationUnit==v.Hour?(o=u.getHours()+h.duration,p=parseInt(o%24)>0?parseInt(o%24):0,x=p>0?parseInt(h.duration/24)+1:parseInt(h.duration/24)):a.durationUnit==v.Minute?(r=u.getMinutes()+h.duration+60*u.getHours(),g=parseInt(r%60)>0?parseInt(r%60):0,x=r>0?parseInt(r/1440)+1:parseInt(r/1440)):a.durationUnit==v.Hour?a.durationMapping&&!m?w==s.Gantt.workingTimeScale.TimeScale24Hours?(p=parseInt(h.duration%24)>0?parseInt(h.duration%24):0,x=p>0?parseInt(h.duration/24)+1:parseInt(h.duration/24)):w==s.Gantt.workingTimeScale.TimeScale8Hours&&(p=parseInt(h.duration%8)>0?parseInt(h.duration%8):0,x=p>0?parseInt(h.duration/8)+1:parseInt(h.duration/8)):w==s.Gantt.workingTimeScale.TimeScale24Hours?x=p>0?parseInt((h.duration+u.getHours())/24)+1:parseInt(h.duration/24):w==s.Gantt.workingTimeScale.TimeScale8Hours&&(a.dateFormat.indexOf("hh:")==-1&&u.setHours(8),x=h.duration%8!=0?Math.floor(h.duration/8)+1:Math.round(h.duration/8),u.getHours()>15&&a.durationMapping&&(remainDate=u.getHours()-0+h.duration,remainDate>24&&(x+=1))):x=parseInt(h.duration),null==m&&(m=new Date(h.startDate),m.setDate(m.getDate()+x)),0==a.includeWeekend){for(0==u.getDay()&&u.setDate(u.getDate()+1),6==u.getDay()&&u.setDate(u.getDate()-1),h._updateHoliday(u,i,a),l=new Date(u),d=0;d0&&m.setDate(m.getDate()+(x-1)));return 0==a.includeWeekend&&f==b.Hour&&(0==m.getDay()&&(p+=24),6==m.getDay()&&(p+=48)),p?w==s.Gantt.workingTimeScale.TimeScale8Hours&&a.durationUnit==v.Hour?p>0?p>24?m.setHours(8+p):m.setHours(p):m.setHours(17):m.setHours(p):w==s.Gantt.workingTimeScale.TimeScale8Hours&&a.durationUnit==v.Hour?m.setHours(17):(w==s.Gantt.workingTimeScale.TimeScale24Hours&&a.dateFormat.indexOf("hh")!=-1||w==s.Gantt.workingTimeScale.TimeScale24Hours&&a.durationUnit==v.Hour)&&f!=b.Hour&&f!=b.Week&&a.durationUnit!=v.Day&&m.setHours(24),g>0&&a.dateFormat.indexOf("hh")!=-1&&(m.setMinutes(g),m.setSeconds(_)),h.startDate=new Date(u),h.endDate=new Date(m),a.endDateMapping&&(h.item[a.endDateMapping]=h.endDate),a.startDateMapping&&(h.item[a.startDateMapping]=h.startDate),n=Math.round((u-e)/864e5),w==s.Gantt.workingTimeScale.TimeScale24Hours&&a.scheduleHeaderSettings.scheduleHeaderType!=s.Gantt.ScheduleHeaderType.Day?n=(u-e)/864e5:w==s.Gantt.workingTimeScale.TimeScale8Hours&&a.scheduleHeaderSettings.scheduleHeaderType==s.Gantt.ScheduleHeaderType.Day&&a.dateFormat.indexOf("hh")==-1?n=(u-e)/864e5:w!=s.Gantt.workingTimeScale.TimeScale24Hours&&w!=s.Gantt.workingTimeScale.TimeScale8Hours||a.scheduleHeaderSettings.scheduleHeaderType!=s.Gantt.ScheduleHeaderType.Day||a.dateFormat.indexOf("hh")==-1?w==s.Gantt.workingTimeScale.TimeScale8Hours&&a.roundOffDayworkingTime&&(n=Math.round((u-e)/864e5)):n=(u-e)/864e5,n*t},_calculateBaselineLeft:function(e,t,i,a,n){var o,r=this,l=new Date(r.baselineStartDate),d=new Date(r.baselineEndDate);return l&&d&&e?(r.isMilestone&&l.getTime()!=d.getTime()&&(this.baselineEndDate=r.item[n.baselineEndDateMapping]=new Date(l)),o=(l-e)/864e5,n.durationUnit!=s.Gantt.DurationUnit.Minute&&(o=Math.ceil(o)),o*t):0},_updateHoliday:function(e,t,i){var s,a=0,n=t&&t.length;if(n>0){for(a=0;a0){for(n=new Date(h),d=0;d=0&&(i=e.split("-"),s="-"),t=i[0].match(/(\d+|[A-z]+)/g),n={from:t[0],predecessorsType:t.length>1?t[1].toUpperCase():"FS",offset:i.length>1?s+""+i[1]:"",isdrawn:!1,to:o},a.push(n)}),a},_updateGanttRecord:function(e,t,i,s,a,n,o,r){var l=this,d=l.left%n,h=(l.left-d)/n;startDate=new Date(a),startDate.setDate(a.getDate()+h),0==startDate.getDay()?startDate.setDate(startDate.getDate()+1):6==startDate.getDay()&&startDate.setDate(startDate.getDate()+2),l.startDate=new Date(startDate),l.left=l._calculateLeft(a,n,s,o,t),l.width=l._calculateWidth(n,s,r,o),l.parentItem&&l._updateParentItem(l,e,t,i,s,a,n,o,r)},_calculateUpdatedDate:function(e,t){var i,s=this,a=0;if(t>0)for(a;a0?parseInt(d%24):0:(l=parseInt(_.getHours()+Math.round(p.duration)),b=parseInt(l%24)>0?parseInt(l%24):0,endDay=parseInt(l/24)),w=b>0?parseInt(l/24)+1:parseInt(l)/24;else if(i.durationUnit==T.Hour){if(i.workingTimeScale==s.Gantt.workingTimeScale.TimeScale24Hours)i.endDateMapping&&"dragging"!=n?f?(b=f.getHours(),v=f.getMinutes()):b=parseInt(p.duration%24)>0?parseInt(p.duration%24):0:(l=_.getHours()+p.duration,b=parseInt(l%24)>0?parseInt(l%24):0),w=b>0?parseInt((_.getHours()+parseInt(p.duration))/24)+1:parseInt(_.getHours()+p.duration)/24;else if(i.workingTimeScale==s.Gantt.workingTimeScale.TimeScale8Hours){i.endDateMapping&&"dragging"!=n?f?(b=f.getHours(),i.dateFormat.indexOf("hh:")==-1&&(b=16),v=f.getMinutes()):b=p._calculateTimeScale8Hour(_.getHours(),p.duration)%24:(l=_.getHours()+p.duration,b=parseInt(l%8)>0?parseInt(l%8):0,b=p._calculateTimeScale8Hour(_.getHours(),b)%24,"dragging"==n&&l>16&&i.durationMapping&&(b+=16));var D=p._calculateTimeScale8Hour(_.getHours(),p.duration),I=(p._dateUpdate(_,0,D-_.getHours()),p.duration%8>0?Math.floor(p.duration/8)+1:Math.round(p.duration/8));24-_.getHours()<8&&i.durationMapping&&(I+=1),w=b>0?Math.round(I):parseInt(p.duration)/8}}else i.durationUnit==T.Minute?(d=_.getMinutes()+p.duration+60*_.getHours(),i.endDateMapping&&"dragging"!=n&&"Resizing"!=n?f?(b=f.getHours(),v=f.getMinutes(),x=f.getSeconds()):v=parseInt(d%60)>0?parseInt(d%60):0:(d=_.getMinutes()+p.duration,v=parseInt(d%60)>0?parseInt(d%60):0,b=_.getHours()+parseInt(d/60),x=_.getSeconds()),h=parseInt((_.getMinutes()+p.duration)/1440),w=d>=0?parseInt(d/1440)+1:parseInt(d)/1440,i.durationMapping&&i.endDateMapping&&"dragging"!=n?w=w:(i.durationMapping||"dragging"==n||"Resizing"==n)&&(w-=h)):w=parseInt(p.duration);if(p.width>0&&(o=p.left+p.width,r=o%a,y=r/(a/24)),0===w)return void(p.endDate=p.startDate);if(e===!1&&C!=S.Hour)for(g=1;g=p.startDate&&m<=_&&(_.setDate(_.getDate()+1),e===!1&&(0==_.getDay()?_.setDate(_.getDate()+1):6==_.getDay()&&_.setDate(_.getDate()+2)));e===!1&&C!=S.Hour&&(0==_.getDay()?_.setDate(_.getDate()+1):6==_.getDay()&&_.setDate(_.getDate()+2)),y>0&&"minute"!=i.durationUnit&&_.setHours(y),b>=0&&(i.workingTimeScale==s.Gantt.workingTimeScale.TimeScale8Hours&&i.durationUnit==T.Hour?_.setHours(b):_.setHours(b)),i.dateFormat.indexOf("hh:")!=-1&&(_.setMinutes(v),_.setSeconds(x)),i.dateFormat.indexOf("hh:")!==-1&&i.workingTimeScale==s.Gantt.workingTimeScale.TimeScale8Hours&&i.scheduleHeaderSettings.scheduleHeaderType!=s.Gantt.ScheduleHeaderType.Day?_.setHours(17):i.workingTimeScale==s.Gantt.workingTimeScale.TimeScale24Hours&&i.durationUnit==T.Hour&&(b>0?_.setHours(b):_.setHours(24)),p.endDate=_,i.endDateMapping&&(p.item[i.endDateMapping]=p.endDate)},_calculateTimeScale8Hour:function(e,t){24-e>8&&(t=this.duration<8?this.duration:this.duration%8),(24-e<8||this.duration>8)&&(e=8),0==t&&(t=8);var i=e;do e>=8&&e<13||e>13&&e<=17?(i++,t--,e=24==e?0:e+1):(e=24==e?0:e+1,i++,t--);while(t>0);return i},_dateUpdate:function(e,t,i,s){return s||(s=0),new Date(e.getFullYear(),e.getMonth(),e.getDate()+t,e.getHours()+i,e.getMinutes()+s,e.getSeconds(),e.getMilliseconds())},_calculateDuration:function(e,t,i,a,n,o){var r,l,d,h,c,u=this,m=s.Gantt.DurationUnit;o.scheduleHeaderSettings.scheduleHeaderType,s.Gantt.ScheduleHeaderType;if(o.durationUnit==m.Hour){if(o.dateFormat.indexOf("hh:")==-1&&o.workingTimeScale==s.Gantt.workingTimeScale.TimeScale8Hours&&(e.setHours(8),t.setHours(16)),l=(t-e)/864e5,r=u._hourdiff(e,t),o.endDateMapping&&(l=l<1?.5:l),o.durationMapping&&(l=Math.round(l)),o.workingTimeScale==s.Gantt.workingTimeScale.TimeScale8Hours)return d=e.getHours()-8,0==e.getHours()&&(d+=8),u.duration=l>=1?r-16*l+d:r,e.getHours()>16&&(o.durationMapping&&(u.duration-=e.getHours()-16),o.endDateMapping&&(u.duration+=e.getHours()-16)),u.duration=Math.round(u.duration),o.durationMapping&&u.item&&(u.item[o.durationMapping]=u.duration),u.duration}else o.durationUnit==m.Minute?r=u._minutediff(e,t):(o.workingTimeScale==s.Gantt.workingTimeScale.TimeScale8Hours&&t.setHours(0),r=u._daydiff(e,t));for(offset=i===!1&&o.durationUnit!=m.Minute&&o.durationUnit!=m.Hour?u._calculateDateDifference(new Date(e),r):o.durationUnit!=m.Hour&&o.durationUnit!=m.Minute?r+1:r,h=0;h=e&&u._getDateFromFormat(a[h].day)<=t&&(o.durationUnit==m.Hour?offset-=24:offset--);o.workingTimeScale==s.Gantt.workingTimeScale.TimeScale24Hours||o.durationUnit==m.Hour?(c=offset-parseInt(offset,10),c*=10,offset=5==c?parseInt(offset,10)+.5:offset):offset=Math.round(offset),u.duration=s.isNullOrUndefined(n)?offset:n&&0==u._calculateDateDifference(new Date(e),r)?0:0==offset&&0==n?1:offset,u.duration%1!=0&&(u.duration=u.duration.toFixed(2)),o.durationMapping&&u.item&&(u.item[o.durationMapping]=u.duration)},_calculateDateDifference:function(e,t){var i=t>=0?t:-1*t;return t>0?i-this._calculateWeekendCount(e,t)+1:t+this._calculateWeekendCount(e,t)},_calculateWeekendCount:function(e,t){var i=t>=0?t:-1*t,s=0,a=0;if(t>0)for(a=0;a0?(t=e(this.getHeaderTable()).find("colgroup"),i=e(this.getContentTable()).find("colgroup")):(t=e(this.getHeaderTable()).find("colgroup")[0],i=e(this.getContentTable()).find("colgroup")[0]);var s=e(t).clone(),a=e(i).clone(),n=e(i).clone();e(i).remove(),e(t).remove(),this._frozenColumnsLength>0?(e(s[0]).prependTo(this.getHeaderTable()[0]),e(s[1]).prependTo(this.getHeaderTable()[1]),e(a[0]).prependTo(this.getContentTable()[0]),e(a[1]).prependTo(this.getContentTable()[1]),this._$footertableContent&&(e(this._$footertableContent).find("colgroup").remove(),e(n[0]).prependTo(this._$footertableContent[0]),e(n[1]).prependTo(this._$footertableContent[1])),this._$totalSummaryRowContainer&&"safari"==this.getBrowserDetails().browser&&this._$totalSummaryRowContainer.find("#e-movablefooter"+this._id).css("margin-left","auto"),"safari"==this.getBrowserDetails().browser&&this.getHeaderContent().find("#e-movableheader"+this._id).add(this.getContent().find("#e-movablecontainer"+this._id)).css("margin-left","auto"),e("#e-frozencontentdiv"+this._id).length&&e("#e-frozencontentdiv"+this._id).css("width","100%")):(e(s).prependTo(this.getHeaderTable()),e(a).prependTo(this.getContentTable()),this._$footertableContent&&(e(this._$footertableContent).find("colgroup").remove(),e(n).prependTo(this._$footertableContent)))},_detailColsRefresh:function(){this._$headerCols=this.getHeaderTable().children("colgroup").find("col"),this._$contentCols=this.getContentTable().children("colgroup").find("col");var e=this.model.columns.length;this._$headerCols.length>e&&this._$headerCols.splice(e-1,1),this._$contentCols.length>e&&this._$contentCols.splice(e-1,1)},gotoPage:function(e){if(this.model.allowPaging){var t,i=this,a=i.model,n={};s.isNullOrUndefined(e)?e=i._currentPage():e<=0?e=1:e>a.pageSettings.totalPages&&(e=a.pageSettings.totalPages),e=s.isNullOrUndefined(e)?i._currentPage():e,n.previousPage=this._currentPage(),this._currentPage(e),n.currentPage=e,a.allowPaging&&(n.requestType=s.TreeGrid.Actions.Paging),i._updateCurrentViewData(),i.renderRecords(n),i.updateHeight(),i._setScrollTop(),i.getScrollElement().ejScroller("refresh"),i._updateScrollCss(),t&&this._currentPage(n.previousPage),n.previousPage!=n.currentPage&&(i.clearSelection(-1),i.selectedRowIndex(-1),i.model.selectedItem=null,i._cancelSaveTools(),i._clearContextMenu())}},_pagerClickHandler:function(e){var t=this;if(this._prevPageNo!=e.currentPage)return t._isNextPage=!0,t._isRowEdit?t.cancelRowEditCell():t.model.isEdit&&t.cancelEditCell(),this.gotoPage(e.currentPage),!1},_init:function(){var e,t,i,s=this;if(s.model.isdesignMode){for(s.model.columns=[{field:"Column1",HeaderText:"Column1"},{field:"Column2",HeaderText:"Column2"},{field:"Column3",HeaderText:"Column3"},{field:"Column4",HeaderText:"Column4"}],s.model.childMapping="Children",e=[{Column1:"Value 1",Column2:"Value 2",Column3:"Value 3",Column4:"Value 4",Children:[]}],t=1;t<4;t++)i={Column1:"Value 1",Column2:"Value 2",Column3:"Value 3",Column4:"Value 4"},e[0].Children.push(i);this.dataSource(e),this.model.sizeSettings.height="250px",this.model.sizeSettings.width="600px"}s._trigger("load"),s._initPrivateProperties(),s._setCultureInfo(),s._processEditing(),s._initDatasource(),s.model.showColumnChooser&&s.model.showColumnOptions&&(s.columnAddDialogTemplate(),s._renderUpdateConfirmDialog()),s._createDragTooltipTemplate(),s._createTooltipTemplate()},updateAllowKeyboardNavigation:function(e){this.model.allowKeyboardNavigation=e},_refreshFooterSummaryRecords:function(){var t,i,a=this,n=this.model;n.showTotalSummary&&a._$footerContainer.length>0&&(this._frozenColumnsLength>0?(a._$footerContainer.html(this._renderSummaryByFrozenDesign()),this._renderFrozenSummary()):(t=s.buildTag("table.e-table#"+a._id+"summarye-table","",{top:"0px"},{cellspacing:"0px"}),i=s.buildTag("tbody"),t.append(a.getContentTable().find("colgroup").clone()).append(i),i.html(e.render[this._id+"_Template"](a._footerSummaryRecord)),a._$footerContainer.empty().append(t)),a._$footertableContent=a._$footerContainer.find(".e-table"))},_updateHeaderScrollLeft:function(e){var t=this;this.model;s.isNullOrUndefined(e)&&(e=t.getScrollElement().ejScroller("option","scrollLeft")),this._frozenColumnsLength>0?(t._$gridHeaderContainer.find("#e-movableheader"+this._id).scrollLeft(e),t.model.showTotalSummary&&t._$footerContainer&&t._$footerContainer.find("#e-movablefooter"+this._id).scrollLeft(e)):(t._$gridHeaderContainer.scrollLeft(e),t.model.showTotalSummary&&t._$footerContainer&&t._$footerContainer.scrollLeft(e))},updateColumns:function(e){var t=this,i=this.model;i.columns=e,t._refreshFrozenColumns()},updateToGanttColumns:function(){var t=this,i=t.model,s=i.columns,a=e("#"+t._id.replace("ejTreeGrid","")).data("ejGantt");a.updateGanttColumns(s)},_refreshFrozenColumns:function(){var t,i,a,n,o,r,l,d=this,h=this.model,c=!1;d._initFrozenColumns(),d._processEditing(),d._$gridHeaderContent.replaceWith(d._renderGridHeader()),d._addInitTemplate(),h.isFromGantt&&d._$gridContent.removeClass("e-borderbox"),this._frozenColumnsLength>0&&0==d._$frozenTableContent.length?(c=!0,t=d._$gridContent.css("width"),i=d._$gridContent.css("height"),d._$gridContent.ejScroller("destroy"),d._$gridContent.css("width",t),d._$gridContent.css("height",i),d._$gridContainer.html(d._renderByFrozenDesign()),d.setGridContentTable(d._$gridContainer.find(".e-table")),d._$gridContainer.find("#e-movablecontent"+d._id+",#e-movablecontentdiv"+d._id+",#e-frozencontentdiv"+d._id).css("height",d._$gridContainer.css("height")),d._renderScroller(!0)):d._$frozenTableContent.length>0&&0==this._frozenColumnsLength&&(c=!0,d._$gridContent.find("#e-movablecontainer"+d._id).ejScroller("destroy"),a=s.buildTag("table.e-table#"+d._id+"e-table","",{top:"0px",position:"relative"},{cellspacing:"0px"}),n=s.buildTag("tbody"),a.append(d.getHeaderTable().find("colgroup").clone()).append(n),d._$gridContainer.html(a),d.setGridContentTable(a),d._renderScroller(!0)),d._$frozenTableContent=e("#"+d._id+"frozene-table"),d._$movableTableContent=e("#"+d._id+"movablee-table"),d._$tableContent=e("#"+d._id+"e-table"),h.showTotalSummary&&d._$footerContainer.length>0&&d._refreshFooterSummaryRecords(),c&&d.onScrollHelper(0),o={},o.requestType=s.TreeGrid.Actions.Refresh,d._isRendered=!1,d.sendDataRenderingRequest(o),d.setWidthToColumns(),d._isRendered=!0,d._trigger("refresh"),this._eventBindings(),this._hideCollapsedDetailsRows(),d.getScrollElement().ejScroller("refresh"),d._updateScrollCss(),h.isFromGantt&&(r=d.getScrollElement(),l=r.ejScroller("isHScroll"),l?d._$gridContent.removeClass("e-borderbox"):d._$gridContent.addClass("e-borderbox")),h.showColumnChooser&&d._renderColumnChooserList(!0),d._updateHeaderScrollLeft(),h.isFromGantt&&(d._addEmptyColumntoGrid(),d.updateToGanttColumns())},freezePrecedingColumns:function(e){var t,i,a=this,n=this.model,o=n.columns,r=this.getColumnByField(e),l=o.indexOf(r);if(n.isEdit?this.saveCell():this._isRowEdit&&this._saveRow(),this._clearContextMenu(),this._removeDetailsRow(),this._clearColumnMenu(),s.isNullOrUndefined(r)||l==-1||0==l&&l<=this._frozenColumnsLength||(t=this._getFrozenColumnWidth(l),t+=18,t>this._gridWidth))return!1;for(i=0;ithis._gridWidth))&&(l.isFrozen=t,void n._refreshFrozenColumns())},_setModel:function(t){var i,a,n,o,r,l,d,h,c,u,m,p,g,_,f,b,v,x,w,y=this,C=y.model,S=C.allowPaging?y._updatedPageData:C.updatedRecords;for(i in t)switch(i){case"enableAltRow":C.enableAltRow=t[i],y._addInitTemplate(),y.renderRecords(b);break;case"allowFiltering":C.allowFiltering=t[i],y._initiateSetModel(),C.allowFiltering=t[i];var T=y.getScrollElement().ejScroller("instance"),D=T.scrollLeft(),I=T.scrollTop();y._$gridHeaderContent.replaceWith(y._renderGridHeader()),y._setWidthToHeaders(),y._viewPortHeight=y._getViewPortHeight(),y._frozenColumnsLength>0&&y._$gridContent.css("height",y._viewPortHeight),T.option("height",y._viewPortHeight),C.enableVirtualization&&(c=C.currentViewData.length,u=C.rowHeight,u+=C.showDetailsRow&&!C.showDetailsRowInfoColumn?C.detailsRowHeight:0,c*u0?(I-=y._viewPortHeight-(c-1)*u,I<0&&(I=0)):(y.processBindings(),y.renderRecords()))),C.showColumnChooser&&showColumnOptions&&y.columnAddDialogTemplate(),this.setWidthToColumns(),T.scrollY(I,!0),T.scrollX(D,!0),y._updateHeaderScrollLeft(D),y._updateScrollCss();break;case"enableResize":y.model.enableResize=t[i],C.enableResize?y._on(e(window),"resize",y._windowResize):y._off(e(window),"resize",y._windowResize);break;case"isResponsive":y.model.isResponsive=t[i],C.isResponsive?y._on(e(window),"resize",y._windowResize):y._off(e(window),"resize",y._windowResize);break;case"headerTextOverflow":C.headerTextOverflow=t[i],y._$gridHeaderContent.replaceWith(y._renderGridHeader()),y.updateViewPortHeight(),C.enableVirtualization&&(y.cancelRowEditCell(),y.processBindings(),a={},u=C.rowHeight,a.requestType=s.TreeGrid.Actions.Refresh,y.sendDataRenderingRequest(a),C.showDetailsRow&&C.detailsTemplate&&!C.showDetailsRowInfoColumn&&(u+=C.detailsRowHeight),C.currentViewData.length*u0?(y._$frozenTableContent.css({top:0}),y._$movableTableContent.css({top:0})):y._$tableContent.css({top:0})),r&&y.selectedRowIndex(S.indexOf(r)),b={},b.requestType=s.TreeGrid.Actions.Refresh,y.sendDataRenderingRequest(b),y._isRowEdit=C.isEdit=!1,y._cancelSaveTools(),y._clearColumnMenu(),y._clearContextMenu(),this._removeDetailsRow();break;case"allowColumnResize":C.allowColumnResize=t[i],C.allowColumnResize&&(y._resizer=new s.gridFeatures.gridResize(y)),y._enableColumnResizeEvents();break;case"allowSorting":C.allowSorting=t[i],y.sortSetting(t[i]),C.showColumnChooser&&showColumnOptions&&y.columnAddDialogTemplate();break;case"allowPaging":if(C.allowPaging){y.element.append(y._renderGridPager()),y.element.append(y.element.find(".e-pager").first()),y.element.find(".e-pager").css({width:y._$gridContent.width()});var T=y.getScrollElement().ejScroller("instance"),D=T.scrollLeft(),I=T.scrollTop();y._viewPortHeight=y._getViewPortHeight(),T.option("height",y._viewPortHeight),T.scrollY(I,!0),T.scrollX(D,!0),y.gotoPage()}else y.element.find(".e-pager").first().remove(),C.pageSettings.totalRecordsCount>0?y._refreshDataSource():y.processBindings();break;case"dragTooltip":l=t[i].tooltipItems,l&&!e.isArray(l)&&(l=l.length>0?l.split(","):[],t[i].tooltipItems=l),e.extend(C.dragTooltip,t[i]),y._createDragTooltipTemplate(),y.refreshContent();break;case"allowDragAndDrop":C.allowDragAndDrop=t[i],d=jQuery.uaMatch(navigator.userAgent),C.allowDragAndDrop?(y._on(y.element,"mousedown",".e-treegridrows, .e-templatecell",y.dragRecord),y._on(e(document),"mouseup",y.dragMouseUp),"chrome"==d.browser.toLowerCase()&&(y._on(y.element,"touchstart",".e-treegridrows, .e-templatecell",y.dragRecord),e(document.body).bind("touchmove",function(e){e.preventDefault()}),e(document.body).bind("touchmove",e.proxy(y.dragToolTip,y)),y._on(y.element,"touchend",".e-treegridrows, .e-templatecell",y.dragMouseUp),y._on(y.element,"touchleave",".e-treegridrows, .e-templatecell",y.dragMouseUp),e(y._$bodyContainer).bind("touchend",e.proxy(y.dragMouseUp,y)),e(y._$bodyContainer).bind("touchleave",e.proxy(y.dragMouseUp,y)))):(y._off(y.element,"mousedown",".e-treegridrows, .e-templatecell",y.dragRecord),y._off(e(document),"mouseup",y.dragMouseUp),"chrome"==d.browser.toLowerCase()&&(y._off(y.element,"touchstart",".e-treegridrows, .e-templatecell",y.dragRecord),e(document.body).unbind("touchmove",function(e){e.preventDefault()}),e(document.body).unbind("touchmove",e.proxy(y.dragToolTip,y)),y._off(y.element,"touchend",".e-treegridrows, .e-templatecell",y.dragMouseUp),y._off(y.element,"touchleave",".e-treegridrows, .e-templatecell",y.dragMouseUp),e(y._$bodyContainer).unbind("touchend",e.proxy(y.dragMouseUp,y)),e(y._$bodyContainer).unbind("touchleave",e.proxy(y.dragMouseUp,y)))),y.refreshContent();break;case"sortSettings":e.extend(C.sortSettings,t[i]),y.refreshContent(),h={},h.requestType=s.TreeGrid.Actions.Refresh,y.sendDataRenderingRequest(h);break;case"allowSelection":C.allowSelection=t[i],C.allowSelection||(y.clearSelection(-1),y.selectedRowIndex(-1),y.model.selectedItem=null,y._cancelSaveTools());break;case"selectionType":y.clearSelection(-1),y.selectedRowIndex(-1),y.model.selectedItem=null,y._cancelSaveTools(),C.selectionType=t[i];break;case"selectionMode":y.clearAllSelection(),C.selectionMode=t[i],C.showColumnChooser&&showColumnOptions&&y.columnAddDialogTemplate();break;case"showSummaryRow":C.showSummaryRow=t[i],C.showSummaryRow?(y._createSummaryRow(),h={},h.requestType=s.TreeGrid.Actions.Refresh,y.sendDataRenderingRequest(h)):(e(y.element).find(".e-summaryrow").hide(),C.updatedRecords=e(C.updatedRecords).not(C.summaryRowRecords).get()),y.updateCollapsedRecordCount(),y.updateHeight();break;case"showTotalSummary":C.showTotalSummary=t[i],C.showTotalSummary?(y._createTotalSummaryRow(),y._setWidthToFooters(),y._viewPortHeight=y._getViewPortHeight(),y._viewPortHeight-=e(y._$totalSummaryRowContainer).height()):(e(y.element).find(".e-footersummaryrowdiv").remove(),y._viewPortHeight=y._getViewPortHeight());var T=y.getScrollElement().ejScroller("instance"),D=T.scrollLeft(),I=T.scrollTop();y._frozenColumnsLength>0&&y._$gridContent.css("height",y._viewPortHeight),T.option("height",y._viewPortHeight),C.enableVirtualization&&(c=C.currentViewData.length,u=C.rowHeight,u+=C.showDetailsRow&&!C.showDetailsRowInfoColumn?C.detailsRowHeight:0,c*u0?(I-=y._viewPortHeight-(c-1)*u,I<0&&(I=0)):(y.processBindings(),y.renderRecords()))),T.scrollY(I,!0),T.scrollX(D,!0),y._updateHeaderScrollLeft(D),y._updateScrollCss();break;case"selectedRowIndex":this.isEdit||this._isRowEdit?this.selectedRowIndex(S.indexOf(y._prevSelectedItem)):(this.selectedRowIndex()>=0&&!s.isNullOrUndefined(this.selectedRowIndex())&&C.allowSelection&&S.length>this.selectedRowIndex()&&this.getExpandStatus(S[this.selectedRowIndex()])?(m=this.selectedRowIndex(),y._rowSelectingEventTrigger(this._previousIndex,m)||(C.showSummaryRow&&(p=e(S).not(C.summaryRowRecords).get(),g=p[m],m=S.indexOf(g)),y.selectRows(m),y._rowSelectedEventTrigger(m))):(y.clearSelection(-1),y.selectedRowIndex(-1),y.model.selectedItem=null,y._previousIndex=-1),y._cancelSaveTools());break;case"selectedCellIndexes":C.allowSelection&&"cell"==C.selectionMode&&y.selectCells(t[i]);break;case"editSettings":e.extend(C.editSettings,t[i]),y._processEditing(),y._enableEditingEvents(),y._updateToolbarItems();break;case"allowKeyboardNavigation":C.allowKeyboardNavigation=t[i];break;case"dataSource":y._isRowEdit||y.model.isEdit||y._refreshDataSource();break;case"columns":C.columns=t[i].slice(0),y._refreshFrozenColumns();break;case"rowHeight":C.rowHeight=t[i],y._addInitTemplate(),y.renderRecords(b),y.updateHeight();break;case"treeColumnIndex":y.columnIndex(t[i]);break;case"showColumnChooser":C.showColumnChooser=t[i],y._$gridHeaderContent.replaceWith(y._renderGridHeader()),y.setWidthToColumns(),y.getScrollElement().ejScroller("refresh"),y._updateScrollCss(),C.showColumnChooser?y._renderColumnChooser():(y._clearColumnMenu(),e("#"+y._id+"ccDiv_wrapper").remove()),C.isFromGantt&&y._addEmptyColumntoGrid();break;case"showColumnOptions":C.showColumnOptions=t[i],y._$gridHeaderContent.replaceWith(y._renderGridHeader()),y.setWidthToColumns(),y.getScrollElement().ejScroller("refresh"),y._updateScrollCss(),C.showColumnChooser&&C.showColumnOptions?(y.columnAddDialogTemplate(),y._renderUpdateConfirmDialog()):(y._clearColumnMenu(),e("#"+y._id+"ccDiv_wrapper").remove()),C.isFromGantt&&y._addEmptyColumntoGrid();break;case"locale":y._clearContextMenu(),y._clearColumnMenu(),y._removeDetailsRow(),C.locale=t[i],y._setCultureInfo(),y._processEditing(),y._addInitTemplate(),y.refreshContent(),y._$gridHeaderContent.replaceWith(y._renderGridHeader()),y.renderRecords(b),y.setWidthToColumns(),y.getScrollElement().ejScroller("refresh"),y._updateScrollCss(),C.showColumnChooser&&y._renderColumnChooserList(!0),C.toolbarSettings.showToolbar&&y._updateToolbar(),C.allowPaging&&y.getPager().ejPager("option",t[i]).ejPager("refreshPager");break;case"toolbarSettings":e.extend(y.model.toolbarSettings,t[i]),y._updateToolbar();break;case"contextMenuSettings":e.extend(y.model.contextMenuSettings,t[i]),C.contextMenuSettings.showContextMenu||y._clearContextMenu(),this._removeDetailsRow();break;case"enableCollapseAll":C.enableCollapseAll=t[i],C.enableCollapseAll?y.collapseAll():y._expandAll();break;case"showDetailsRow":C.showDetailsRow=t[i],this._updateDetailsRowProperties("showDetailsRow");break;case"detailsRowHeight":C.detailsRowHeight=t[i],this._updateDetailsRowProperties("detailsRowHeight");break;case"detailsTemplate":C.detailsTemplate=t[i],this._updateDetailsRowProperties("detailsTemplate");break;case"showDetailsRowInfoColumn":C.showDetailsRowInfoColumn=t[i],this._updateDetailsRowProperties("showDetailsRowInfoColumn");break;case"altRowTemplateID":this._initiateSetModel(),C.altRowTemplateID=t[i],y._addInitTemplate(),y.renderRecords(b),this.updateHeight();break;case"rowTemplateID":this._initiateSetModel(),C.rowTemplateID=t[i],y._addInitTemplate(),y.renderRecords(b),this.updateHeight();break;case"pageSettings":this._initiateSetModel(),C.allowPaging&&(e.extend(C.pageSettings,t[i]),this.getPager().ejPager("option",C.pageSettings).ejPager("refreshPager"),t[i].totalRecordsCount>0?y._refreshDataSource():y.gotoPage());break;case"sizeSettings":this._initiateSetModel(),e.extend(C.sizeSettings,t[i]),this._calculateDimensions(),this._getViewPortHeight()<=0&&(C.sizeSettings.height="450px",this._updateElementHeight()),this._windowResize();break;case"showGridCellTooltip":C.showGridCellTooltip=t[i];break;case"showGridExpandCellTooltip":C.showGridExpandCellTooltip=t[i];break;case"allowMultiSorting":C.allowMultiSorting=t[i];break;case"query":y=this,C.query=s.isNullOrUndefined(t[i])?s.Query():t[i],y._refreshDataSource();break;case"filterSettings":if(C.allowFiltering){for(b={},e.extend(y.model.filterSettings,t[i]),_=y.model.filterSettings,f=s.isNullOrUndefined(_.filterBarMode)?"immediate":_.filterBarMode,v=e.extend([],_.filteredColumns),x=0;x0?e(t.getTreeGridRows()[0]).add(t.getTreeGridRows()[1]).filter("tr.collapsedrowexpandeddetailsrow").css("display","none"):e(t.getTreeGridRows()).filter("tr.collapsedrowexpandeddetailsrow").css("display","none"))},_updateToolbar:function(){var t=this,i=t.model,s=t.getScrollElement().ejScroller("instance"),a=s.scrollLeft(),n=s.scrollTop();e("#"+t._id+"_toolbarItems").remove(),i.toolbarSettings.showToolbar&&t._renderToolbarTemplate().insertBefore(e("#"+t._id+"e-gridheader")),i.isEdit&&t.cancelEditCell(),t._isRowEdit&&(t.cancelRowEditCell(),t._cancelSaveTools()),t._viewPortHeight=t._getViewPortHeight(),t._frozenColumnsLength>0&&t._$gridContent.css("height",t._viewPortHeight),s.option("height",t._viewPortHeight),i.enableVirtualization&&(t.processBindings(),t.renderRecords()),s.option("scrollTop",n),s.option("scrollLeft",a),t._clearContextMenu(),this._removeDetailsRow()},_refreshDataSource:function(){var t,i,a=this,n=this.model;(a._isRowEdit||a.model.isEdit)&&a.cancelRowEditCell(),a.resetModelCollections(),a._createdAt="load",this.dataSource()instanceof s.DataManager?(t=this.dataSource().executeQuery(n.query),t.done(s.proxy(function(t){if(a._retrivedData=a.dataSource().dataSource.offline?a.dataSource().dataSource.json:t.result,n.idMapping&&n.parentIdMapping){var i=t.result.slice(0),o=[];e.each(i,function(e,t){o.push(jQuery.extend(!0,{},t))}),a._reconstructDatasource(o)}else a._reconstructDatasource(t.result);a._createRecords(a.secondaryDatasource),args={},args.requestType=s.TreeGrid.Actions.RefreshDataSource,a._ensureDataSource(args),a.selectedRowIndex()!==-1&&a.selectedRowIndex()0&&n.parentIdMapping.length>0&&(i=this.dataSource().slice(0),a._reconstructDatasource(i),a._createRecords(a.secondaryDatasource)):0===n.flatRecords.length&&null!==this.dataSource()&&a._createRecords(this.dataSource()),args={},args.requestType=s.TreeGrid.Actions.RefreshDataSource,a._ensureDataSource(args),this.selectedRowIndex()!==-1&&this.selectedRowIndex()0,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=e(),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._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 s.DataManager?t.dataSource():null!=t.dataSource()?s.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,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.localizedLabels=t._getLocalizedLabels(),t._gridRecordsCount=t.model.pageSettings.totalRecordsCount,t._gridPager=null,t._summaryRowsCount=0,t._updatedPageData=[],t._isNextPage=!1},_calculateDimensions:function(){var e,t,i=this,a=this.model;if(a.isFromGantt||(a.sizeSettings.width&&i.element.css("width",a.sizeSettings.width),a.sizeSettings.height?i.element.css("height",a.sizeSettings.height):i.element[0].style.height?a.sizeSettings.height=i.element[0].style.height:i.element.height(450)),i._gridHeight=i.element.height(),i._gridWidth=i.element.width(),this._frozenColumnsLength>0){for(e=0,t=0;t<=this._frozenColumnsLength;t++)a.columns[t]&&(e+=s.isNullOrUndefined(a.columns[t].width)?150:parseInt(a.columns[t].width));i._gridWidth0&&(o.columns.length&&o.columns.length==t.length&&(i=t.splice(t.length-1,1),i[0].isFrozen=!1),o.columns=e.merge(e.merge([],t),i)),this._frozenColumns=t,this._unFrozenColumns=i,0==a&&this._frozenColumns[0]&&(this._frozenColumns[0].visible=!0), 0==n&&this._unFrozenColumns[0]&&(this._unFrozenColumns[0].visible=!0),l&&(o.treeColumnIndex=o.columns.indexOf(l)),this._frozenColumnsLength=t.length,o.scrollSettings.frozenColumns=this._frozenColumnsLength},_checkDataBinding:function(){var t=this,i=t.model;t._createdAt=null,t.element.addClass("e-treegrid-core"),t.element.attr("tabindex","0"),t._renderToolbar(),t.model.showColumnChooser&&t._renderColumnChooser(),t._renderAfterColumnInitialize(),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(),t._initGridRender(),t._$gridContent=e("#"+t._id+"e-gridcontent"),t._$gridContainer=e("#"+t._id+"e-gridcontainer"),t._$tableContent=e("#"+t._id+"e-table"),t._$frozenTableContent=e("#"+t._id+"frozene-table"),t._$movableTableContent=e("#"+t._id+"movablee-table"),t._$gridContent.css({height:t._viewPortHeight+"px"}),t.element.find(".e-pager").css({width:t._$gridContent.width()}),t.updateHeight(),t._wireEvents(),t.setWidthToColumns(),i.showTotalSummary&&(t._createTotalSummaryRow(),(!i.allowPaging||i.sizeSettings.height)&&(t._viewPortHeight=t._viewPortHeight-t._$totalSummaryRowContainer.height())),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()},getUpdatedDataManagerData:function(){var e=this;return e._jsonData},_checkDataManagerUpdate:function(){var e=this,t=this.dataSource();e._isDataManagerUpdate=!1,e._jsonData=null,t instanceof s.DataManager&&(t.dataSource.offline&&t.dataSource.json?(e._isDataManagerUpdate=!0,e._jsonData=t.dataSource.json):t.dataSource.offline||(e._isDataManagerUpdate=!0,e._jsonData=e._retrivedData))},_initDatasource:function(){var t,i,a,n=this,o=n.model;o.isFromGantt?n._checkDataBinding():this.dataSource()instanceof s.DataManager?(t=this.dataSource().executeQuery(o.query),t.done(s.proxy(function(t){if(n._retrivedData=n.dataSource().dataSource.offline?n.dataSource().dataSource.json:t.result,o.idMapping&&o.parentIdMapping){var i=t.result.slice(0),s=[];e.each(i,function(e,t){s.push(jQuery.extend(!0,{},t))}),n._reconstructDatasource(s)}else n._reconstructDatasource(t.result);n._createRecords(n.secondaryDatasource),n._checkDataBinding()}))):this.dataSource()?(n._retrivedData=n.dataSource(),o.idMapping&&o.parentIdMapping?(i=this.dataSource().slice(0),a=[],e.each(i,function(e,t){a.push(jQuery.extend(!0,{},t))}),n._reconstructDatasource(a),n._createRecords(n.secondaryDatasource)):0===o.flatRecords.length&&null!==this.dataSource()&&n._createRecords(this.dataSource()),n._checkDataBinding()):n._checkDataBinding()},_reconstructDatasource:function(e){for(var t,i=this,a=i.model,n=[],o=0;o0?(e[o][a.childMapping]=t,i.secondaryDatasource.push(e[o])):!s.isNullOrUndefined(e[o][a.parentIdMapping])||t&&t.length>0?t&&t.length>0&&!s.isNullOrUndefined(t[0][a.parentIdMapping])?i._appendChildDataItems(i.secondaryDatasource,t):s.isNullOrUndefined(e[o][a.parentIdMapping])&&0==t.length&&i.secondaryDatasource.push(e[o]):i.secondaryDatasource.push(e[o]),t&&t.length>0?(i._datasourceChildItems=i._reconstructDatasource(t),s.isNullOrUndefined(e[o][a.childMapping])&&(e[o][a.childMapping]=i._datasourceChildItems,i._getParentIndex(e)),i._datasourceChildItems=[]):s.isNullOrUndefined(e[o][a.parentIdMapping])||n.push(e[o]);if(n&&n.length>0)return n},_appendChildDataItems:function(e,t){for(var i=this,a=i.model,n=0;n0&&i._appendChildDataItems(e[n],t);s.isNullOrUndefined(e.length)&&e&&(e[a.idMapping]===t[0][a.parentIdMapping]?e[a.childMapping]=t:!s.isNullOrUndefined(e[a.childMapping])&&e[a.childMapping].length>0&&i._appendChildDataItems(e[a.childMapping],t))},_getParentIndex:function(e){var t,i,a,n=this,o=n.model,r=n.secondaryDatasource,l=0;for(e.length>0&&(l=e[0][o.parentIdMapping]),t=0;t0&&this._removeDetailsRow(),w&&"number"!=typeof w&&w.indexOf("%")!=-1||y.indexOf("%")!=-1){var S=w?w:y,T=e(g.element).parent().width()?e(g.element).parent().width():e(g.element).width(),D=T/100*parseInt(S);t=D}else t=e(g.element).width();if(g._gridWidth=t,g._frozenColumnsLength>0){for(a=0,n=0;n<=g._frozenColumnsLength;n++)a+=g.columnsWidthCollection[n];t0&&(g._$gridContent.css("width",t),g._$gridContent.css("height",i-e(f).outerHeight()-v.outerHeight()),c=t-this._getFrozenColumnWidth()-1),g.getScrollElement().ejScroller({width:c,height:i-e(f).outerHeight()-v.outerHeight()}),g._updateScrollCss(),e(f).hasClass("e-scrollcss")&&g.getScrollElement().children(".e-vscrollbar").length>0?e(f).width(t-17):e(f).width(t),g._$totalSummaryRowContainer&&(g._$totalSummaryRowContainer.height()>=90&&g._$totalSummaryRowContainer.hasClass("e-scroller")?g._$totalSummaryRowContainer.ejScroller("refresh"):e(b).hasClass("e-scrollcss")&&g.getScrollElement().children(".e-vscrollbar").length>0?e(b).width(t-17):e(b).width(t)),_.toolbarSettings.showToolbar&&v.length>0&&(v.width(t),v.children(".e-ul:first-child").width(t)),g.getScrollElement().ejScroller("refresh"),g.updateViewPortHeight(),_.showTotalSummary&&(g._viewPortHeight=g._viewPortHeight-g._$totalSummaryRowContainer.height()),g.getScrollElement().ejScroller("option","scrollTop",d),g.getScrollElement().ejScroller("option","scrollLeft",h),g._updateHeaderScrollLeft(),_.enableVirtualization&&(g.cancelRowEditCell(),g.processBindings(),u={},m=_.rowHeight,u.requestType=s.TreeGrid.Actions.Refresh,g.sendDataRenderingRequest(u),_.showDetailsRow&&_.detailsTemplate&&!_.showDetailsRowInfoColumn&&(m+=_.detailsRowHeight),_.currentViewData.length*m0&&b._removeChildItem(a),C instanceof s.DataManager?C.dataSource.offline&&C.dataSource.json?(c=C.dataSource.json.indexOf(a.item),c!==-1&&C.dataSource.json.splice(c,1)):b._isDataManagerUpdate&&(c=b._jsonData.indexOf(a.item),c!==-1&&b._jsonData.splice(c,1)):(c=C.indexOf(a.item),c!==-1&&C.splice(c,1))):C instanceof s.DataManager?C.dataSource.offline&&C.dataSource.json?(o=C.dataSource.json.indexOf(a.item),o!==-1&&C.dataSource.json.splice(o,1)):b._isDataManagerUpdate&&(o=b._jsonData.indexOf(a.item),b._jsonData.splice(o,1)):(o=C.indexOf(a.item),o!==-1&&C.splice(o,1)),v.selectedItem=null,this.selectedRowIndex(-1),!v.isFromGantt&&a.parentItem&&0==a.parentItem.childRecords.length&&(a.parentItem.expanded=!1,a.parentItem.hasChildRecords=!1),v.showSummaryRow&&b._updateSummaryRow(t),v.showTotalSummary&&b._updateTotalSummaryRow(t)),t&&"filtering"==t.requestType||v.allowFiltering&&!v.isFromGantt&&w.length){if(v.showSummaryRow&&(v.updatedRecords=e(v.updatedRecords).not(v.summaryRowRecords).get(),v.flatRecords=e(v.flatRecords).not(v.summaryRowRecords).get()),v.allowFiltering&&!v.isFromGantt&&w.length){for(m=w[0],m.value==b._dropDownListBlanksText?(u=s.Predicate(m.field,"equal",null),u=u.or(m.field,"equal","")):u=m.isComplex?m:s.Predicate(m.field,m.operator,m.value,!m.matchcase),p=1;p0&&b._sortingRecords()}else v.updatedRecords=v.enableVirtualization?b.getExpandedRecords(v.flatRecords):v.flatRecords.slice(),b._updateHasFilteredChildRecordsStatus(v.updatedRecords),v.allowPaging&&v.pageSettings.pageSizeMode===s.TreeGrid.PageSizeMode.Root&&(v.parentRecords=b._getParentRecords(v.updatedRecords,b,!0));v.showSummaryRow&&b._createSummaryRow(t),v.showTotalSummary&&b._updateTotalSummaryRow(t),b.updateCollapsedRecordCount(),b.updateHeight(),y=!0,v.enableAltRow&&b.updateAltRow()}v.allowSearching&&b._searchString.length||t&&"searching"===t.requestType?(b._queryManagar.search(b._searchString,b.getColumnFieldNames(),s.FilterOperators.contains,!0),b._filteredRecords=v.flatRecords.filter(function(e){return e.hasChildRecords===!1}),g=new s.DataManager(b._filteredRecords),b._tempfilteredrecords=g.executeLocal(b._queryManagar).result,b._updateFilteredRecords(b._tempfilteredrecords),v.updatedRecords=b._filteredRecords,v.allowSorting&&v.sortSettings.sortedColumns.length>0&&b._sortingRecords(),b.updateCollapsedRecordCount(),b.updateHeight(),y=!0,v.enableAltRow&&b.updateAltRow(),b.clearSelection()):(v.allowSorting&&x.length>0||t&&"sorting"==t.requestType)&&(b._sortingRecords(),v.showSummaryRow&&b._createSummaryRow(t),y||(b.updateCollapsedRecordCount(),b.updateHeight(),y=!0)),t&&("outdent"===t.requestType||"indent"===t.requestType)&&(t={},t.requestType=s.TreeGrid.Actions.Refresh,y=!0),y||(b._zerothLevelParentRecords=v.parentRecords.slice(),v.updatedRecords=v.enableVirtualization?v.enableCollapseAll&&!t?b._zerothLevelParentRecords:b.getExpandedRecords(v.flatRecords):v.flatRecords.slice(),b.updateCollapsedRecordCount(),b.updateHeight()),t||(t={},t.requestType=v.allowPaging?s.TreeGrid.Actions.Paging:s.TreeGrid.Actions.Refresh,t.inital=!0),v.allowPaging&&"delete"==t.requestType&&(_={},_.totalRecordsCount=b.getExpandedRecords(v.flatRecords).length,b.getPager().ejPager("option",_).ejPager("refreshPager"),f=f=this.getPager().ejPager("model"),b._currentPage()>f.totalPages&&b._currentPage(f.totalPages)),b._updateCurrentViewData(),(v.isFromGantt||"save"!==t.requestType)&&"sorting"!==t.requestType&&"searching"!==t.requestType&&"delete"!==t.requestType&&"refreshDataSource"!==t.requestType&&"filtering"!==t.requestType&&"dragAndDrop"!==t.requestType&&(t.inital||"paging"!==t.requestType)||(b._isRefreshAddedRecord=!1,b.renderRecords(t),b._setScrollTop(),b.getScrollElement().ejScroller("refresh"),b._updateScrollCss())},_removeChildItem:function(e){for(var t,i,a=this,n=0;n=0&&i.field,fieldName&&(r.editSettings.allowEditing&&r.editSettings.editMode==s.TreeGrid.EditMode.CellEditing&&o.cellEdit(o._cellEditingDetails.rowIndex,fieldName),o._editAddTools()))):"rowediting"==r.editSettings.editMode.toLowerCase()&&o._editRow(l),o._clearContextMenu();break;case"Save":"cellediting"==r.editSettings.editMode.toLowerCase()?o._isRowEdit?o._endEdit():o.saveCell():"rowediting"==r.editSettings.editMode.toLowerCase()&&o._saveRow(),o._clearContextMenu(),e(o.element).focus();break;case"Cancel":a=o.model.editSettings.editMode,"cellediting"==a.toLowerCase()?o._isRowEdit?o.cancelRowEditCell():r.isEdit&&o.cancelEditCell():"rowediting"==a.toLowerCase()&&o.cancelRowEditCell(),o._clearContextMenu(),e(o.element).focus();break;default:n={},n.data=h,n.menuId=t,o._triggerMenuEventHandler(t,n),o._clearContextMenu()}r.enableAltRow&&r.currentViewData[0]&&s.TreeGrid.updateAltRow(o,r.currentViewData[0],0,0)},_setCultureInfo:function(){var e=this,t=e.model,i=t.locale,a=e.localizedLabel,n=s.TreeGrid.Locale.default;a=t.predecessorTable?s.Gantt.Locale[i]:s.TreeGrid.Locale[i],e._toolboxTooltipTexts=a&&a.toolboxTooltipTexts?a.toolboxTooltipTexts:n.toolboxTooltipTexts,e._contextMenuTexts=a&&a.contextMenuTexts?a.contextMenuTexts:n.contextMenuTexts,e.model.isFromGantt?(e._columnMenuTexts=e.model.columnMenuTexts,e._deleteColumnText=e.model.deleteColumnText,e._okButtonText=e.model.okButtonText,e._cancelButtonText=e.model.cancelButtonText,e._columnDialogTexts=e.model.columnDialogTexts,e._columnDialogTitle=e.model.columnDialogTitle,e._confirmDeleteText=e.model.confirmDeleteText):(e._columnMenuTexts=a&&a.columnMenuTexts?a.columnMenuTexts:n.columnMenuTexts,e._columnDialogTexts=a&&a.columnDialogTexts?a.columnDialogTexts:n.columnDialogTexts,e._columnDialogTitle=a&&a.columnDialogTitle?a.columnDialogTitle:n.columnDialogTitle,e._deleteColumnText=a&&a.deleteColumnText?a.deleteColumnText:n.deleteColumnText,e._okButtonText=a&&a.okButtonText?a.okButtonText:n.okButtonText,e._cancelButtonText=a&&a.cancelButtonText?a.cancelButtonText:n.cancelButtonText,e._confirmDeleteText=a&&a.confirmDeleteText?a.confirmDeleteText:n.confirmDeleteText,e._dropDownListBlanksText=a&&a.dropDownListBlanksText?a.dropDownListBlanksText:n.dropDownListBlanksText,e._dropDownListClearText=a&&a.dropDownListClearText?a.dropDownListClearText:n.dropDownListClearText,e._trueText=a&&a.trueText?a.trueText:n.trueText,e._falseText=a&&a.falseText?a.falseText:n.falseText,e.model.emptyRecordText=a&&a.emptyRecord?a.emptyRecord:n.emptyRecord)},_createNewRowInstance:function(e){var t=[];for(var i in e)t.push(i);return t},refresh:function(e,t){var i,a=this,n=a.model;s.isNullOrUndefined(e)?(i={},i.requestType=s.TreeGrid.Actions.Refresh,this.sendDataRenderingRequest(i)):(a.resetModelCollections(),n.dataSource=e,n.query=t,a.element.ejTreeGrid("destroy").ejTreeGrid(n))},_getNewIndex:function(){var e=this;return e._maxRowIndex+=1,e._maxRowIndex},_addRecord:function(t,i,a){var n,o,r,l,d,h,t,c,u,m=this;(m.model.isEdit||m._isRowEdit)&&m.cancelRowEditCell();var p,g,_,f=this.model,b=this.selectedRowIndex(),v=f.updatedRecords,x=f.flatRecords,w=f.parentRecords,y="row"==f.selectionMode?this.selectedItem():v[m._rowIndexOfLastSelectedCell],C=f.columns,S=this.dataSource(),T=0,D=-1,I=!1,k=!1,P=this._getNewIndex();if("array"===e.type(S)||S instanceof s.DataManager||(this.dataSource([]),S=this.dataSource()),(b===-1&&m._rowIndexOfLastSelectedCell==-1&&(i===s.TreeGrid.RowPosition.Above||i===s.TreeGrid.RowPosition.Below||i===s.TreeGrid.RowPosition.Child)||!i||f.selectedItems.length>1)&&(i=s.TreeGrid.RowPosition.Top),s.isNullOrUndefined(t)){for(t={},n=0;nc&&(m._currentPage(this._currentPage()+1),D=0)):i==s.TreeGrid.RowPosition.Top&&(m._currentPage()>1||m._currentPage()<1)?(m._currentPage(1),D=0):i==s.TreeGrid.RowPosition.Bottom&&m._currentPage()0||f.filterSettings.filteredColumns.length>0)&&(m._isRefreshAddedRecord=!0),f.allowPaging&&(v=m._updatedPageData),f.allowSelection&&"row"==f.selectionMode&&(u=I?v.indexOf(p):b,m._rowSelectingEventTrigger(this._previousIndex,u)||(m.selectRows(u),m._rowSelectedEventTrigger(u))),"cell"==f.selectionMode&&(m._rowIndexOfLastSelectedCell=v.indexOf(p)),m.updateScrollBar(),"isEditRow"==a?m._editRow(v.indexOf(p),p):(s.TreeGrid.refreshRow(m,f.currentViewData.indexOf(p)),m._cancelSaveTools(),f.enableAltRow&&s.TreeGrid.updateAltRow(m,m.model.currentViewData[0],0,0)),p.parentItem&&i==s.TreeGrid.RowPosition.Child&&(1==p.parentItem.childRecords.length||!p.parentItem.hasFilteredChildRecords)&&(p.parentItem.hasFilteredChildRecords=!0,s.TreeGrid.refreshRow(m,f.currentViewData.indexOf(p.parentItem)))},_validateIdValue:function(t){var i=this,s=i.model,a=[],n=s.flatRecords;return a=e.map(n,function(e){if(e[s.idMapping]==t)return e}),!!a.length},addRow:function(e,t){var i=this,s=i.model;if(i._cancelEditState(),e)if(s.idMapping&&s.parentIdMapping){if(!e[s.idMapping]||i._validateIdValue(e[s.idMapping]))return!1;i._isPublicAdd=!0,i._addRecord(e,t),i._isPublicAdd=!1}else i._addRecord(e,t);else i._addRecord(null,t,"isEditRow")},_startAdd:function(){var e=this,t=this.model;e._addRecord(null,t.editSettings.rowPosition,"isEditRow")},_getRecordIndexByItem:function(e,t){var i=s.DataManager(t).executeLocal(s.Query().where("item",s.FilterOperators.equal,e));return i.length>0?t.indexOf(i[0]):-1},_expandRecord:function(e){for(var t=e.parentItem,i={};null!=t;)0==t.expanded&&(i.expanded=!0,i.data=t,this._isInExpandCollapseAll=!!t.parentItem,s.TreeGrid.sendExpandCollapseRequest(this,i)),t=t.parentItem},scrollOffset:function(e,t){var i=this._$gridContent.data("ejScroller"),s=this.model;s.isEdit?this.saveCell():this._isRowEdit&&this._saveRow(),("number"==typeof t||"number"==typeof parseInt(t))&&(t=parseInt(t),t>=0&&this.getMaxScrollHeight()>t&&i.scrollY(t,!0)),("number"==typeof e||"number"==typeof parseInt(e))&&(e=parseInt(e),e>=0&&this.getMaxScrollWidth()>e&&i.scrollX(e,!0))},getScrollTopOffset:function(){return this.getScrollElement().ejScroller("model.scrollTop")},getScrollLeftOffset:function(){return this.getScrollElement().ejScroller("model.scrollLeft")},scrollToTop:function(){var e,t,i=this.model,s=-1;i.isEdit?this.saveCell():this._isRowEdit&&this._saveRow(),e=this.getExpandedRecords(i.updatedRecords),e.length>0&&(s=0,t=e[0],s=i.updatedRecords.indexOf(t),i.allowSelection&&!this._rowSelectingEventTrigger(this.selectedRowIndex(),s)&&(this.selectRows(s),this._rowSelectedEventTrigger(s)),this.updateScrollBar(s))},scrollToBottom:function(){var e,t,i=this.model,s=-1;i.isEdit?this.saveCell():this._isRowEdit&&this._saveRow(),e=this.getExpandedRecords(i.updatedRecords),e.length>0&&(s=e.length-1,t=e[s],s=i.updatedRecords.indexOf(t),i.allowSelection&&!this._rowSelectingEventTrigger(this.selectedRowIndex(),s)&&(this.selectRows(s),this._rowSelectedEventTrigger(s)),this.updateScrollBar(s))},_editAddTools:function(){var t,i,s=this,a=s.model,n=e("#"+s._id+"_toolbarItems"),o=s.model.editSettings;toolbarItems=a.toolbarSettings.toolbarItems,t=[],o.allowAdding&&toolbarItems.indexOf("add")!==-1&&!e(n).find(".e-addnew").parent("li").hasClass("e-disable")&&t.push(e(n).find(".e-addnew").parent()[0]),o.allowEditing&&toolbarItems.indexOf("edit")!==-1&&!e(n).find(".e-edit").parent("li").hasClass("e-disable")&&t.push(e(n).find(".e-edit").parent()[0]),o.allowDeleting&&toolbarItems.indexOf("delete")!==-1&&!e(n).find(".e-delete").parent("li").hasClass("e-disable")&&"click"!=a.editSettings.beginEditAction&&t.push(e(n).find(".e-delete").parent()[0]),t.forEach(function(t){e(n).ejToolbar("disableItem",t)}),i=[],toolbarItems.indexOf("cancel")!==-1&&i.push(e(n).find(".e-cancel").parent()[0]),toolbarItems.indexOf("update")!==-1&&i.push(e(n).find(".e-save").parent()[0]),"click"==a.editSettings.beginEditAction&&i.push(e(n).find(".e-delete").parent()[0]),i.forEach(function(t){e(n).ejToolbar("enableItem",t)})},_cancelSaveTools:function(){var t,i,s=this,a=s.model,n=s.model.editSettings,o=e("#"+s._id+"_toolbarItems"),r=[],l=a.toolbarSettings.toolbarItems;a.isFromGantt?(o=e("#"+s._id.replace("ejTreeGrid","")+"_toolbarItems"),t=[],n.allowAdding&&l.indexOf("add")!==-1&&t.push(e(o).find(".e-addnewitem").parent()[0]),n.allowEditing&&l.indexOf("edit")!==-1&&a.allowSelection&&"click"!=n.beginEditAction&&s.selectedRowIndex()!=-1&&t.push(e(o).find(".e-edititem").parent()[0]),n.allowDeleting&&l.indexOf("delete")!==-1&&a.allowSelection&&s.selectedRowIndex()!=-1&&t.push(e(o).find(".e-deleteitem").parent()[0]),e(o).ejToolbar("enableItem",t),i=[],l.indexOf("cancel")!==-1&&i.push(e(o).find(".e-cancel").parent()[0]),l.indexOf("update")!==-1&&i.push(e(o).find(".e-saveitem").parent()[0]),i.forEach(function(t){e(o).ejToolbar("disableItem",t)})):(t=[],i=[],n.allowAdding&&l.indexOf("add")!==-1&&t.push(e(o).find(".e-addnew").parent()[0]),n.allowEditing&&l.indexOf("edit")!==-1&&(s.selectedRowIndex()!=-1&&a.allowSelection&&1==a.selectedItems.length&&"click"!=n.beginEditAction?t.push(e(o).find(".e-edit").parent()[0]):e(o).find(".e-edit").parent("li").hasClass("e-disable")||i.push(e(o).find(".e-edit").parent()[0])),n.allowDeleting&&l.indexOf("delete")!==-1&&(s.selectedRowIndex()!=-1&&a.allowSelection&&a.selectedItems.length>0?t.push(e(o).find(".e-delete").parent()[0]):e(o).find(".e-delete").parent("li").hasClass("e-disable")||i.push(e(o).find(".e-delete").parent()[0])),r=s._getParentRecords(a.updatedRecords,s),r.length<=0?(l.indexOf("expandAll")===-1||e(o).find(".e-expandall").parent("li").hasClass("e-disable")||i.push(e(o).find(".e-expandall").parent()[0]),l.indexOf("collapseAll")===-1||e(o).find(".e-collapseall").parent("li").hasClass("e-disable")||i.push(e(o).find(".e-collapseall").parent()[0])):(l.indexOf("expandAll")!==-1&&t.push(e(o).find(".e-expandall").parent()[0]), l.indexOf("collapseAll")!==-1&&t.push(e(o).find(".e-collapseall").parent()[0])),"click"==n.beginEditAction&&("click"!=n.beginEditAction||a.isEdit)||(l.indexOf("cancel")===-1||e(o).find(".e-cancel").parent("li").hasClass("e-disable")||i.push(e(o).find(".e-cancel").parent()[0]),l.indexOf("update")===-1||e(o).find(".e-save").parent("li").hasClass("e-disable")||i.push(e(o).find(".e-save").parent()[0])),i.forEach(function(t){e(o).ejToolbar("disableItem",t)}),t.forEach(function(t){e(o).ejToolbar("enableItem",t)}))},_checkIsEmptyRow:function(e){var t,i;for(t in e)if(i=e[t]," "!==i&&null!==i&&""!==i&&i!==!1)return!1;return!0},_beginEdit:function(){var e=this;e._trigger("beginEdit",args),e._isinBeginEdit=!0},_endEdit:function(){var t,i,a=this;a._isinBeginEdit=!1,t=this.selectedRowIndex(),i=s.TreeGrid.getRowByIndex(a,t),e("tr").hasClass("e-addedrow")||e("tr").hasClass("e-rowedit")?a._saveRow():a.saveCell()},_refreshTreeGridOnExpandCollapseAll:function(e){var t,i=this,a=this.model;if(a.enableVirtualization)a.enableAltRow&&i.updateAltRow(),i.sendDataRenderingRequest(e),i._setScrollTop(),i.updateHeight();else{if(a.allowPaging&&(t={},t.totalRecordsCount=this.getExpandedRecords(a.updatedRecords).length,i.getPager().ejPager("option",t).ejPager("refreshPager"),pagerModel=this.getPager().ejPager("model"),i._currentPage(pagerModel.currentPage),t.requestType="paging",i.processBindings(t)),i._isRefreshAddedRecord)return i.processBindings(),this.renderRecords(),void(i._isRefreshAddedRecord=!1);i.updateHeight(),a.enableAltRow&&a.currentViewData.length>0&&s.TreeGrid.updateAltRow(i,i.model.currentViewData[0],0,0)}},_expandCollapseInnerLevelRecord:function(e,t){for(var i=this,a=e.childRecords.length,n={},o=0;o0&&t._refreshTreeGridOnExpandCollapseAll(n),t._isInExpandCollapseAll=!1},_refreshToolBar:function(){var t=e("#"+this._id+"_toolbarItems");t.find("li").removeClass("e-hover")},_renderToolbar:function(){var e=this,t=e.model;if(!t.isFromGantt){var e=this,i=e.element,t=e.model;e.model.toolbarSettings.showToolbar&&(0==e.model.toolbarSettings.toolbarItems.length&&(e.model.toolbarSettings.toolbarItems=[s.TreeGrid.ToolbarItems.Add,s.TreeGrid.ToolbarItems.Edit]),i.append(e._renderToolbarTemplate()))}},_renderToolbarTemplate:function(){var t,i,a=this,n=a.model,o=s.buildTag("div.e-treegridtoolbar#"+a._id+"_toolbarItems","",{height:"36px",border:"1px solid"},{unselectable:"on"}),r=s.buildTag("ul","",{width:a._gridWidth,"box-sizing":" "},{unselectable:"on"});return!s.isNullOrUndefined(n.toolbarSettings.toolbarItems)&&n.toolbarSettings.toolbarItems.length&&a._renderLi(r),o.append(r),t=s.buildTag("ul","",{},{unselectable:"on"}),o.append(t),i={},i.click=a._toolBarClick,i.cssClass="",i.rtl=!1,i.itemSeparator=!1,i.itemLeave=a._toolbarItemLeave,i.width=a._gridWidth,i.fields={id:"",tooltipText:"",imageUrl:"",text:"",imageAttributes:"",spriteCSS:"",htmlAttributes:""},o.ejToolbar(i),o.ejToolbar("disableItem",a._disabledToolItems),a._disabledToolItems=e(),o},_renderLi:function(e){var t,i=this,a=i.model.toolbarSettings.toolbarItems,n=a.length,o=0;for(o;o')),a},_getIndentCol:function(){return s.buildTag("col","",{width:"35px"})},_renderGridHeader:function(){var e,t,i=this,a=i.model,n=(document,s.buildTag("div.e-gridheadercontainer","",{overflow:"hidden"},{unselectable:"on"})),o=a.isFromGantt?s.buildTag("div.e-gridheader#"+i._id+"e-gridheader","",{"border-left-style":"solid","border-left-width":"1px"},""):s.buildTag("div.e-gridheader#"+i._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:i._gridWidth},"");return i.setGridHeaderContent(o),i._$gridHeaderContainer=n,i._hiddenColumns=[],i._visibleColumns=[],i.columnsWidthCollection=[],this._frozenColumnsLength>0?(e=s.buildTag("div.e-frozenheaderdiv#e-frozenheaderdiv"+i._id,this._renderGridHeaderInternalDesign(a.columns.slice(0,this._frozenColumnsLength),!1)),t=s.buildTag("div.e-movableheader#e-movableheader"+i._id,s.buildTag("div.e-movableheaderdiv#e-movableheaderdiv"+i._id,this._renderGridHeaderInternalDesign(this.model.columns.slice(this._frozenColumnsLength),!0))),n.append(e).append(t)):n.append(this._renderGridHeaderInternalDesign(this.model.columns,!0)),o.html(n),this.setGridHeaderTable(this.getHeaderContent().find(".e-table")),o},getPager:function(){return this._gridPager},setTreeGridPager:function(e){this._gridPager=e},_renderGridPager:function(){var t,i,a=this,n=e(document.createElement("div")),o={},r=a.model.pageSettings;return r.click=e.proxy(a._pagerClickHandler,a),r.totalRecordsCount=a._gridRecordsCount,e.extend(o,r),o.locale=a.model.locale,a._currentPage()<0&&a._currentPage(1),o.currentPage=a._currentPage(),o.masterObject=a,a.setTreeGridPager(n),n.ejPager(o),n.ejPager("refreshPager"),o=n.ejPager("model"),r.totalPages=o.totalPages,a._currentPage()!==o.currentPage&&a._currentPage(o.currentPage),!s.isNullOrUndefined(r.template)&&r.template.length>0&&(n.children().remove(),t=s.buildTag("div.e-pagercontainer"),i=this._createTemplateElement(r,!0),t.append(i.innerHTML),n.append(t)),n},_renderGridHeaderInternalDesign:function(t,i){var n,o,r,l,d,h,c=this,u=c.model,m=document,p=s.buildTag("table.e-table","",{},{cellspacing:"0px","border-spacing":"0px"}),g=s.buildTag("thead"),_=(s.buildTag("tbody.e-hide"),s.buildTag("tr.e-columnheader")),f=e(m.createElement("colgroup")),b=e(m.createElement("tr")),v=0,x=t.length;for((u.allowSorting||u.showColumnChooser)&&_.css({cursor:"pointer"}),"wrap"===u.headerTextOverflow?c.element.addClass("e-wrap"):c.element.removeClass("e-wrap"),v;v',{},{})),f.append(this._getIndentCol())),this.model.allowFiltering&&!c.model.isFromGantt&&(d=this._renderFiltering(t,i)),g.append(_),d&&g.append(d),p.append(f).append(g),p},_initGridRender:function(){var e=this;e._addInitTemplate(),e._renderGrid(),e.model.allowColumnResize&&(e._resizer=new s.gridFeatures.gridResize(e))},_summaryRow:function(){var e=this,t=e.model;t.showSummaryRow&&e._createSummaryRow(),t.showTotalSummary&&(e._createTotalSummaryRow(),e._viewPortHeight=e._viewPortHeight-e._$totalSummaryRowContainer.height())},_renderGrid:function(){var e=this;e._renderGridContent().insertAfter(e.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(e.render[this._id+"_JSONFrozenTemplate"](this._footerSummaryRecord)),this._$footerContainer.find("#e-movablefooterdiv"+this._id+" .e-table tbody").html(e.render[this._id+"_Template"](this._footerSummaryRecord))},_renderSummaryByFrozenDesign:function(){var t=e(document.createElement("div")),i=this._getMetaColGroup().find("col"),a={};return a.colgroup1=t.append(s.buildTag("colgroup").append(i.splice(0,this._frozenColumnsLength))).html(),a.colgroup2=t.html(s.buildTag("colgroup").append(i)).html(),e.templates[this._id+"_FrozenSummaryTemplate"]||this.addFrozenSummaryTemplate(),e.render[this._id+"_FrozenSummaryTemplate"](a)},addFrozenSummaryTemplate:function(){var t="
    {{:colgroup1}}
    {{:colgroup2}}
    ",i={};i[this._id+"_FrozenSummaryTemplate"]=t,e.templates(i)},_createTotalSummaryRow:function(){var t,i,a,n,o,r,l,d=this,h=d.model,c=(h.flatRecords,h.summaryRows),u=c.length,m=h.updatedRecords,p=(h.parentRecords,h.columns),g=s.buildTag("tbody");for(d._footerSummaryRecord=[],d._footerSummaryRows=[],e("#"+d._id+"-footersummaryrow").remove(),t=s.buildTag("div.e-footersummaryrowdiv#"+d._id+"-footersummaryrow","",{overflow:"hidden",cursor:"default"}),i=s.buildTag("div.e-footercontainer#e-footercontainer"+d._id,"",{overflow:"hidden"}),d._flatChildRecords=h.showSummaryRow?e(h.updatedRecords).not(h.summaryRowRecords).get():m,a=1;a<=u;a++){for(n={},o=0;o0?(i.html(this._renderSummaryByFrozenDesign()),this._renderFrozenSummary()):(l=s.buildTag("table.e-table#"+d._id+"summarye-table","",{top:"0px"},{cellspacing:"0px"}),l.append(d.getContentTable().find("colgroup").clone()).append(g),g.html(e.render[this._id+"_Template"](d._footerSummaryRecord)),i.append(l)),d._$totalSummaryRowContainer=t,d._$footertableContent=i.find(".e-table"),t.append(i),h.allowPaging?d.element.append(e("#"+this._id+"Pager").before(t)):d.element.append(t),d._flatChildRecords=[],this._setWidthToFooters(),this._$totalSummaryRowContainer.height()<90?d.isVScroll()&&d._$totalSummaryRowContainer.addClass("e-scrollcss"):d._$totalSummaryRowContainer.ejScroller({height:90})},_getFooterRows:function(){var t=e();return this.model.showTotalSummary&&this._$footertableContent&&(t=this._$footertableContent.get(0).rows,this._frozenColumnsLength>0&&(t=[t,this._$footertableContent.get(1).rows])),e(t)},_setWidthToFooters:function(){var e,t,i,s=this._gridWidth;if(this._frozenColumnsLength>0){for(e=0,i=0;i0&&(t=this._frozenColumnsLength>0?[e(this.getTreeGridRows()[0]).not(".e-summaryrow"),e(this.getTreeGridRows()[1]).not(".e-summaryrow")]:e(this.getTreeGridRows()).not(".e-summaryrow")),t},_createSummaryRow:function(t){var i,a,n,o,r,l,d,h,c,u,m=this,p=m.model,g={},_=p.summaryRows,f=_.length,b=p.columns;if(!t||"dragAndDrop"!=t.requestType&&"addNewRow"!=t.requestType&&"sorting"!=t.requestType)i=m._parentRecords;else if(i=m._getParentRecords(p.updatedRecords,m),"dragAndDrop"==t.requestType)for(n=0;n0&&(t.model.enableVirtualization||t.model.allowPaging&&t.model.showSummaryRow?(o.indexOf(a)==-1&&o.push(a),t._getInnerParentRecords(a,t,o)):o.push(a));return o},_getChildRecordsLength:function(e,t){for(var i,s=this,a=t.length,n=0;ni&&(i=r,s=n[t])}return s},_getMinDate:function(e,t){for(var i=new Date(e[0][t]),s=i.getTime(),a=e[0][t],n=0;n0?l._frozenColumnsLength>columnIndex?t.rowElement=e(l.getRows()[0][recordindex]):(t.rowElement=e(l.getRows()[1][recordindex]),columnIndex-=l._frozenColumnsLength):t.rowElement=e(l.getRows()[recordindex]),t.cellElement=t.rowElement.find(".e-rowcell").eq(columnIndex),value=l._getSummaryValues(f,l._flatChildRecords),r[_]=b+value+v,t.cellElement.empty().html(b+value+v),h.push(r)}}),l._flatChildRecords=[],l._summaryRowCount=c.length}},_updateTotalSummaryRow:function(t){var i,a,n;if("dragAndDrop"!=t.requestType&&!t.isDragAndDropDelete){var o,r,l,d=this,h=d.model,c=h.summaryRows,u=c.length;if(0==h.updatedRecords.length)return void e("#"+d._id+"-footersummaryrow").hide();for(e("#"+d._id+"-footersummaryrow").show(),i=0;i0?this._frozenColumnsLength>b?t.rowElement=this._getFooterRows()[0][f]:(t.rowElement=this._getFooterRows()[1][f],b-=this._frozenColumnsLength):t.rowElement=this._getFooterRows()[f],t.cellElement=t.rowElement.childNodes[b],n=e(h.updatedRecords).not(h.summaryRowRecords).get(),value=d._getSummaryValues(m,n),l[_]=p+value+g,t.cellElement.innerHTML=p+value+g}}}},_updateAfterDeleteRecord:function(t){var i,a,n,o,r,l=this,d=l.model,h=[];if(deletedRecord=t.data,deletedRecord.parentItem&&(a=l._getpRecords(deletedRecord,l)),!s.isNullOrUndefined(a))for(n=0;n0?l._frozenColumnsLength>_?t.tr=e(l.getRows()[0][g]):(t.tr=e(l.getRows()[1][g]),_-=l._frozenColumnsLength):t.tr=e(l.getRows()[g]),t.tr=e(l.getRows()[g]),t.cellElement=t.tr.find(".e-rowcell").eq(_),value=l._getSummaryValues(m,l._flatChildRecords),r[p]=f+value+b,t.cellElement.empty().html(f+value+b)}h.push(r)}}),l._flatChildRecords=[])},_getpRecords:function(e){var t=[];do e=e.parentItem,t.push(e);while(e.parentItem);return t},_renderGridContent:function(){var t,i,a=this,n=document,o=a.model,r=e(n.createElement("tbody")),l=s.buildTag("div.e-gridcontent#"+a._id+"e-gridcontent","",{height:a._viewPortHeight}),d=s.buildTag("div.e-gridcontainer#"+a._id+"e-gridcontainer","",{},{});return $scrolllerContentDiv=s.buildTag("div",{},{width:"auto",height:"auto"}),$scrolllerContentDiv.append(d),(o.enableVirtualization||o.allowPaging)&&d.css({height:a._totalHeight}),this._frozenColumnsLength>0?(d.html(a._renderByFrozenDesign()),a.setGridContentTable(d.find(".e-table"))):(t=s.buildTag("table.e-table#"+a._id+"e-table","",{top:"0px",position:"relative"},{cellspacing:"0px"}),t.append(a.getHeaderTable().find("colgroup").clone()).append(r),d.html(t),a.setGridContentTable(t)),l.html($scrolllerContentDiv),a._$gridContent=l,null===this.dataSource()||0==this.model.currentViewData.length?this._frozenColumnsLength>0?(i=s.buildTag("td",o.emptyRecordText,{},{colSpan:this._frozenColumns.length}),d.find("#e-frozencontentdiv"+a._id+" .e-table tbody").append(e(n.createElement("tr")).append(i)), i=s.buildTag("td",o.emptyRecordText,{visibility:"hidden"},{colSpan:this._unFrozenColumns.length}),d.find("#e-movablecontentdiv"+a._id+" .e-table tbody").append(e(n.createElement("tr")).append(i))):(i=s.buildTag("td",o.emptyRecordText,{},{colSpan:o.columns.length}),r.append(e(n.createElement("tr")).append(i)),d.css("height",o.rowHeight)):a.renderRecords(),o.isFromGantt?l.css({"border-left-style":"solid","border-left-width":"1px"}):l.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"}),l},_initialEndRendering:function(){var t,i,s=this,a=s.model,n=(s.getExpandedRecords(a.updatedRecords),s.selectedRowIndex()),o=s.selectedCellIndexes();a.allowSelection&&("row"!=a.selectionMode||n==-1||a.isFromGantt||(a.showSummaryRow&&(t=e(a.updatedRecords).not(a.summaryRowRecords).get(),i=t[n],n=a.updatedRecords.indexOf(i)),s._rowSelectingEventTrigger(this._previousIndex,n)||(s.selectRows(n),s._cancelSaveTools(),s._rowSelectedEventTrigger(n))),"cell"==a.selectionMode&&o.length>0&&(s.selectedRowIndex(-1),s.selectCells(o),s._cancelSaveTools())),s._isRendered=!0,s._trigger("refresh"),s._eventBindings(),s._hideCollapsedDetailsRows()},_addCellEditTemplate:function(){for(var e,t=this,i=t.model,a=i.columns,n=0,o=s.buildTag("div","",{display:"none"},{id:t._id+"_CellEditTemplate"}),r=a&&a.length,n=0;n0&&(s._currentRecordIndex!=e.index&&s._getSelectedCellsinARow(e.index,o),s._selectedCellsinARow.length>0&&(i=s._selectedCellsinARow.map(function(e){return e.cellIndex}).indexOf(n),i!=-1&&s._selectedCellsinARow[i].cellIndex==n))?"selectingcell":""},_getSelectedCellsinARow:function(e,t){var i=this;i._selectedCellsinARow=[],t.forEach(function(t){t.data.index==e&&i._selectedCellsinARow.push(t)}),i._currentRecordIndex=e},_getrowName:function(){var e=this;return"gridrowIndex"+(e.data.index.toString()+"level"+e.data.level.toString())},_getDetailsColSpan:function(e){var t=this.model,i=[];return this._frozenColumnsLength>0?e?(i=this._frozenColumns.filter(function(e){return e.visible!==!1}),i.length):(i=this._unFrozenColumns.filter(function(e){return e.visible!==!1}),i.length):t.showDetailsRowInfoColumn?this._visibleColumns.length+1:this._visibleColumns.length},_getDetailsExpandStatus:function(e){var t=this;return!(!t.getExpandStatus(e)||!e.isDetailsExpanded)},_createDetailsRowTemplate:function(t){var i,s,a,n,o=this,r=this.model,l={};return l["_"+o._id+"getDetailsColSpan"]=e.proxy(o._getDetailsColSpan,o),l["_"+o._id+"getDetailsExpandStatus"]=e.proxy(o._getDetailsExpandStatus,o),l["_"+o._id+"getExpandStatus"]=e.proxy(o.getExpandStatus,o),e.views.helpers(l),i="{{if !isSummaryRow && !footerSummaryRowRecord}}
    ",s="",r.detailsTemplate&&r.detailsTemplate.length>0&&(s=document.getElementById(r.detailsTemplate)?e("#"+r.detailsTemplate)[0].innerHTML:r.detailsTemplate),t||(e("#treeGridDetailsRowTemplateElement"+o._id).remove(),a=this._createDetailRowTemplateElement(s),i+="{{:~_treeGridTemplating('"+a.id+"')}}"),i+="
    ",i+="{{/if}}",t||(n={},n[o._id+"_detailRowTemplate"]=i,e.templates(n)),i},_SelectState:function(){var e=this.model;return!!e.allowSelection},_addInitTemplate:function(){var t,i,n,o,r,l,d,h,c,u,m,p,g,_,f,b,v,x,w,y,C=this,S=C.model,T=S.columns,D=0,I=T.length,k={};if(0===T.length)return!1;if(this._frozenColumnsLength>0&&(this.addFrozenTemplate(),S.showTotalSummary&&this.addFrozenSummaryTemplate()),k["_"+C._id+"rowClassName"]=s.TreeGrid._getrowClassName,k["_"+C._id+"SummaryRowtdClassName"]=s.TreeGrid._getSummaryRowtdClassName,k["_"+C._id+"isSelectedCell"]=e.proxy(C._getSelectedCellClass,C),k["_"+C._id+"summaryTitle"]=C._getSummaryTitle,k["_"+C._id+"rowName"]=C._getrowName,k.getState=C._getState,k.SelectState=e.proxy(C._SelectState,C),k["_"+C._id+"expandStatus"]=e.proxy(C._getExpandStatusRecord,C),k["_"+C._id+"cellValue"]=C._getCellValue,k["_"+C._id+"TemplateCellValue"]=e.proxy(C._getTemplateCellValue,C),k["_"+C._id+"isTreeColumnIndex"]=e.proxy(C._isTreeColumnIndex,C),k["_"+C._id+"getIndentWidth"]=e.proxy(C._getIndentWidth,C),k["_"+C._id+"checkColumn"]=e.proxy(C._getCellColumn,C),k["_"+C._id+"formatting"]=e.proxy(C.formatting,C),k._treeGridTemplating=s.proxy(C._gridTemplate,null,C),e.views.helpers(k),S.rowTemplateID.length>0||S.altRowTemplateID.length>0){var P=s.buildTag("tbody","",{},{}),L=s.buildTag("tbody","",{},{}),R="",M="",O=S.altRowTemplateID.length>0?e("#"+S.altRowTemplateID)[0].innerHTML:e("#"+S.rowTemplateID)[0].innerHTML,E=S.rowTemplateID.length>0?e("#"+S.rowTemplateID)[0].innerHTML:e("#"+S.altRowTemplateID)[0].innerHTML;if(e(P[0]).html(O),e(L[0]).html(E),L[0].childNodes.length>0)for(r=0;r0))for(l=0,d=0;d{{:~_"+C._id+"summaryTitle()}}{{/if}}"),l==S.treeColumnIndex?(p="
    {{if !~getState() || !hasChildRecords }}
    {{/if}}
    {{if ~getState() && hasChildRecords}}
    {{/if}}
    ",R+=""+p+"{{else}}'>{{/if}}{{if !isSummaryRow && !footerSummaryRowRecord}}"+h.innerHTML+"{{else}}"+m+"{{/if}}",R+=s.isNullOrUndefined(i.format)?"{{if isSummaryRow || footerSummaryRowRecord}}{{:~_"+C._id+"TemplateCellValue(#data,'"+t+"')}}{{/if}}":"{{if isSummaryRow || footerSummaryRowRecord}}{{:~_"+C._id+"formatting('"+i.format+"',~_"+C._id+"TemplateCellValue(#data,'"+t+"'),'"+this.model.locale+"')}}{{/if}}",R+="
    "):(R+="{{if !isSummaryRow && !footerSummaryRowRecord}}"+h.innerHTML+"{{else}}"+m+"{{/if}}",R+=s.isNullOrUndefined(i.format)?"{{if isSummaryRow || footerSummaryRowRecord}}{{:~_"+C._id+"TemplateCellValue(#data,'"+t+"')}}{{/if}}":"{{if isSummaryRow || footerSummaryRowRecord}}{{:~_"+C._id+"formatting('"+i.format+"',~_"+C._id+"TemplateCellValue(#data,'"+t+"'),'"+this.model.locale+"')}}{{/if}}",R+=""),this._frozenColumnsLength>0&&this._frozenColumnsLength==l+1&&(o="",o+=R,o+="",R=""),l++));if(P[0].childNodes.length>0)for(r=0;r{{:~_"+C._id+"summaryTitle()}}{{/if}}"),l==S.treeColumnIndex?(p="
    {{if !~getState() || !hasChildRecords }}
    {{/if}}
    {{if ~getState() && hasChildRecords}}
    {{/if}}
    ",M+=""+p+"{{else}}'>{{/if}}{{if !isSummaryRow && !footerSummaryRowRecord}}"+h.innerHTML+"{{else}}"+m+"{{/if}}",M+=s.isNullOrUndefined(i.format)?"{{if isSummaryRow || footerSummaryRowRecord}}{{:~_"+C._id+"TemplateCellValue(#data,'"+t+"')}}{{/if}}":"{{if isSummaryRow || footerSummaryRowRecord}}{{:~_"+C._id+"formatting('"+i.format+"',~_"+C._id+"TemplateCellValue(#data,'"+t+"'),'"+this.model.locale+"')}}{{/if}}",M+="
    "):(M+="{{if !isSummaryRow && !footerSummaryRowRecord}}"+h.innerHTML+"{{else}}"+m+"{{/if}}",M+=s.isNullOrUndefined(i.format)?"{{if isSummaryRow || footerSummaryRowRecord}}{{:~_"+C._id+"TemplateCellValue(#data,'"+t+"')}}{{/if}}":"{{if isSummaryRow || footerSummaryRowRecord}}{{:~_"+C._id+"formatting('"+i.format+"',~_"+C._id+"TemplateCellValue(#data,'"+t+"'),'"+this.model.locale+"')}}{{/if}}",M+=""),this._frozenColumnsLength>0&&this._frozenColumnsLength==l+1&&(g="",g+=M,g+="",M=""),l++));S.showDetailsRow&&S.detailsTemplate&&S.showDetailsRowInfoColumn&&(M+="{{if !isSummaryRow && !footerSummaryRowRecord}}
    {{/if}}",R+="{{if !isSummaryRow && !footerSummaryRowRecord}}
    {{/if}}"),_="{{if isAltRow}}"+M+"{{else}}"+R+"{{/if}}",w="{{if isAltRow}}"+o+"{{else}}"+g+"{{/if}}"}else{for(_="{{:~_"+C._id+"summaryTitle()}}{{/if}}"),i.isTemplateColumn){_+="e-templaterow ";var u=i.templateID,A=i.template,j=i.angularTemplate;j?(e("#"+C._id+i.headerText+D+"_Template").remove(),x=this._createTemplateElement(i),n="{{if !isSummaryRow && !footerSummaryRowRecord}}{{:~_treeGridTemplating('"+x.id+"')}}{{else}}"+m+"{{/if}}",n+=s.isNullOrUndefined(i.format)?"{{if isSummaryRow || footerSummaryRowRecord}}{{:~_"+C._id+"TemplateCellValue(#data,'"+t+"')}}{{/if}}":"{{if isSummaryRow || footerSummaryRowRecord}}{{:~_"+C._id+"formatting('"+i.format+"',~_"+C._id+"TemplateCellValue(#data,'"+t+"'),'"+this.model.locale+"')}}{{/if}}",n+=""):u?(n="{{if !isSummaryRow && !footerSummaryRowRecord}}"+e("#"+u)[0].innerHTML+"{{else}}"+m+"{{/if}}",n+=s.isNullOrUndefined(i.format)?"{{if isSummaryRow || footerSummaryRowRecord}}{{:~_"+C._id+"TemplateCellValue(#data,'"+t+"')}}{{/if}}":"{{if isSummaryRow || footerSummaryRowRecord}}{{:~_"+C._id+"formatting('"+i.format+"',~_"+C._id+"TemplateCellValue(#data,'"+t+"'),'"+this.model.locale+"')}}{{/if}}",n+=""):A&&(n="{{if !isSummaryRow && !footerSummaryRowRecord}}"+A+"{{else}}"+m+"{{/if}}",n+=s.isNullOrUndefined(i.format)?"{{if isSummaryRow || footerSummaryRowRecord}}{{:~_"+C._id+"TemplateCellValue(#data,'"+t+"')}}{{/if}}":"{{if isSummaryRow || footerSummaryRowRecord}}{{:~_"+C._id+"formatting('"+i.format+"',~_"+C._id+"TemplateCellValue(#data,'"+t+"'),'"+this.model.locale+"')}}{{/if}}",n+="")}else D===S.treeColumnIndex?(n="{{if !isSummaryRow && !footerSummaryRowRecord}}
    {{if hasChildRecords && hasFilteredChildRecords}}
    {{if !~getState() || !hasChildRecords}}
    {{/if}}
    {{else !hasChildRecords || (!hasFilteredChildRecords && hasChildRecords)}}
    {{if !~getState() || !hasChildRecords}}
    {{/if}}
    {{/if}}{{if ~getState() && hasChildRecords}}
    {{/if}}
    {{/if}}",s.isNullOrUndefined(i.format)?(n+="{{:#data['"+t+"']}}"+m+"{{if !isSummaryRow && !footerSummaryRowRecord}}
    {{/if}}",m=""):n+="{{:~_"+C._id+"formatting('"+i.format+"',~_"+C._id+"TemplateCellValue(#data,'"+t+"'),'"+this.model.locale+"')}}"):S.isFromGantt&&i.mappingName===S.resourceInfoMapping?(k={},k["_"+C._id+"resourceName"]=C._getResourceName,e.views.helpers(k),n="{{:~_"+C._id+"resourceName('"+C._id+"Object','"+S.resourceNameMapping+"','"+t+"')}}"):S.isFromGantt&&i.mappingName===S.predecessorMapping?(k={},k["_"+C._id+"predecessor"]=C._getPredecessorsValue,e.views.helpers(k),n="{{:~_"+C._id+"predecessor('"+C._id+"Object','"+S.predecessorMapping+"','"+t+"')}}"):(n=""+m,n+=s.isNullOrUndefined(i.format)?"{{:~_"+C._id+"TemplateCellValue(#data,'"+t+"')}}":"{{:~_"+C._id+"formatting('"+i.format+"',~_"+C._id+"TemplateCellValue(#data,'"+t+"'),'"+this.model.locale+"')}}",n+="",m="");f+=n}this._frozenColumnsLength>0&&this._frozenColumnsLength==D+1&&(w="",w+=f,w+="",f="")}S.showDetailsRow&&S.detailsTemplate&&S.showDetailsRowInfoColumn&&(f+="{{if !isSummaryRow && !footerSummaryRowRecord}}
    {{/if}}"),_+="{{if expanded && hasFilteredChildRecords}}e-treegridrowexpand {{else hasChildRecords && hasFilteredChildRecords}} e-treegridrowcollapse {{/if}} 'style='background-color:{{if rowBackgroundColor }}{{:rowBackgroundColor}}{{else}}none{{/if}}; height:"+S.rowHeight+"px;display:{{:~_"+C._id+"expandStatus(#data)}}'role='row'>",w=_+w,_+=f,_+=S.isFromGantt?"":""}S.showDetailsRow&&S.detailsTemplate&&(_+="{{if isDetailsExpanded}}"+C._createDetailsRowTemplate()+"{{/if}}",w+="{{if isDetailsExpanded}}"+C._createDetailsRowTemplate(!0)+"{{/if}}"),y={},y[C._id+"_Template"]=_,y[C._id+"_JSONFrozenTemplate"]=w,e.templates(y)},_gridTemplate:function(e,t){return e._renderEjTemplate("#"+t,this.data,this.data.index)},_getIndentWidth:function(e){var t=e.level;return 20*t+"px"},_createDetailRowTemplateElement:function(t){var i=document.createElement("script");return i.id=("treeGridDetailsRowTemplateElement"+this._id).split("").join(""),i.type="text/x-template",i.text=t,e("body").append(i),i},_createRowTemplateElement:function(t,i){var s=document.createElement("script");return s.id=i,s.type="text/x-template",s.text=t,e("body").append(s),s},_createTemplateElement:function(t,i){var s=i?"Pager":t.headerText+e.inArray(t,this.model.columns)+"_Template",a=document.createElement("script");return a.id=("treeGrid"+s).split(" ").join(""),a.type="text/x-template",a.text=e(t.angularTemplate?t.angularTemplate:t.template).html(),e("body").append(a),a},_getTemplateCellValue:function(t,i){var a,n,o,r,l,d,h=this,c=h.getColumnByField(i),u=c.editType,m=t[i];if(m=m||0===m?m:t.item&&t.item[i],u==s.TreeGrid.EditingType.Dropdown)if(o=c.editParams,m=m?m:"",o&&o.fields?(n=o.fields.text?o.fields.text:"text",a=o.fields.value?o.fields.value:"value"):(a="value",n="text"),o&&o.showCheckbox){if(cellValueCollection=m.split(","),r=cellValueCollection.length,m="",c.dropdownData)for(l=0;l0)for(n;n0&&n.pageSettings.pageSizeMode===s.TreeGrid.PageSizeMode.Root&&(l=n.pageSettings.totalRecordsCount0&&n.pageSettings.pageSizeMode!==s.TreeGrid.PageSizeMode.Root&&n.pageSettings.totalRecordsCount<=r.length&&(i=n.pageSettings.totalRecordsCount,n.flatRecords=r.slice(0,i),n.flatRecords[i-1].hasChildRecords&&(n.flatRecords[i-1].hasChildRecords=!1,n.flatRecords[i-1].expanded=!1,n.flatRecords[i-1].childRecords=null,n.flatRecords[i-1].hasFilteredChildRecords=!1)),a._maxRowIndex=this.model.flatRecords.length},_createRecord:function(t,i,n,o){var r,l,d=this,h=t[d.model.childMapping],c=this.model;return r=e.extend({},t),c.parentIdMapping&&"load"===d._createdAt?(l=s.DataManager(d._retrivedData).executeLocal(s.Query().where(c.idMapping,s.FilterOperators.equal,r[c.idMapping])),r.item=l[0]):this.dataSource()instanceof s.DataManager&&this.dataSource().dataSource.json&&this.dataSource().dataSource.offline&&"load"===d._createdAt?(l=s.DataManager(d._retrivedData).executeLocal(s.Query().where(c.idMapping,s.FilterOperators.equal,r[c.idMapping])),r.item=l.length>0?l[0]:t):r.item=t,r.parentItem=n,r.childRecords=h&&h.length>0&&d._createChildRecords(h,i+1,r),r.hasChildRecords=!!(h&&h.length>0),r.expanded=o!==a&&h!==a?o:!!h&&h.length>0,r.dragState=!0,r.isSelected=!1,r.hasFilteredChildRecords=!0,r.level=i,r.cellBackgroundColor=null,r.rowBackgroundColor=null,r.treeMappingName=[],r.isDetailsExpanded=!(!c.showDetailsRow||!c.detailsTemplate)&&!c.showDetailsRowInfoColumn,delete r[c.childMapping],r},_createChildRecords:function(e,t,i){var s,a,n=this,o=n.model,r=[],l=0,d=e.length,h=null;for(!o.isFromGantt&&o.enableCollapseAll&&(s=!1),l=0;l0&&(posx=t.originalEvent.changedTouches[0].pageX,posy=t.originalEvent.changedTouches[0].pageY),posx+200>a._windowWidth&&(posx-=posx+200-a._windowWidth),posy+n.rowHeight>a._windowHeight&&(posy-=posy+n.rowHeight-a._windowHeight),a.model.isFromGantt)var l=e(document).find(".e-ganttviewerbodyContianer"),d=l.ejScroller("isVScroll"),s=d?l.find(".e-content").get(0).scrollHeight-1:0;else s=a.isVScroll()?a._$gridContent.find(".e-content").get(0).scrollHeight-1:0;posy>a._viewPortHeight+r||posya._viewPortHeight+r&&s>a._scrollTop+a._viewPortHeight?_timerDragDown||(_timerDragDown=window.setInterval(function(){s>a._scrollTop+a._viewPortHeight&&(i=a._scrollTop,i+=n.rowHeight,a.model.isFromGantt?l.ejScroller("scrollY",i,!0):a.getScrollElement().ejScroller("scrollY",i,!0))},100)):_timerDragDown&&(_timerDragDown=window.clearInterval(_timerDragDown)),posy0?_timerDragUp||(_timerDragUp=window.setInterval(function(){a._scrollTop>0&&(i=a._scrollTop,i-=n.rowHeight,i<0&&(i=0),a.model.isFromGantt?l.ejScroller("scrollY",i,!0):a.getScrollElement().ejScroller("scrollY",i,!0))},100)):_timerDragUp&&(_timerDragUp=window.clearInterval(_timerDragUp))):(_timerDragDown&&(_timerDragDown=window.clearInterval(_timerDragDown)),_timerDragUp&&(_timerDragUp=window.clearInterval(_timerDragUp)))}},_dragRowSelection:function(t){var i,s=this,a=this.model,n=a.allowPaging?s._updatedPageData:a.updatedRecords,o=e(t.target),r=o.closest("tr"),l=s.getIndexByRow(r),d=-1;l!=-1&&"row"==a.selectionMode&&(record=a.currentViewData[l],record.isSummaryRow||(d=n.indexOf(record)),i={rowElement:r,recordIndex:this.selectedRowIndex()},s._trigger("rowSelecting",i)||(a.selectedItem=record,s._rowDragIndexes=[],s._rowDragIndexes.push(d),this.selectedRowIndex(d),s.selectRows(this.selectedRowIndex()),i={rowElement:r,data:a.selectedItem,target:"ejTreeGrid",recordIndex:s.selectedRowIndex()},s.model.isFromGantt&&s._trigger("rowSelected",i)))},getRange:function(t,i,s){var a=this,n=a.model;roundOff=0,rowHeight=s[0].offsetHeight,m=a.getOffsetRect(e("#"+a._id)[0]),height=a._$gridHeaderContainer.height()+m.top,rowHeight+=a._detailsRowHeight,n.toolbarSettings.showToolbar&&(height+=e("#"+a._id+"_toolbarItems").height()),0!=a._scrollTop&&(roundOff=rowHeight-a._scrollTop%rowHeight);var o=i*rowHeight+height+roundOff+7,r=o+s[0].offsetHeight,l=r-o,d=l/3,h=o+d,c=h+d,u=c+d,m={topRowSegment:h,middleRowSegment:c,bottomRowSegment:u};return m},_childValidation:function(e){var t,i,s=this,a=s._draggedRecord,n=a.parentItem;n&&(i=n.childRecords,t=i.indexOf(this._draggedRecord),e==n&&t!=-1&&(this._childItem=!0))},_isColumnHidable:function(e){var t=(this.model,[]),i=[],s=!0;return t=this._frozenColumns.filter(function(e){return 1==e.visible}),i=this._unFrozenColumns.filter(function(e){return 1==e.visible}),1==t.length&&t[0].field==e.field&&(s=!1),1==i.length&&i[0].field==e.field&&(s=!1),s},_updateColumnMenuVisibility:function(){var t,i=this.model,s=[],a=[];i.showColumnChooser&&(s=this._frozenColumns.filter(function(e){return 1==e.visible}),a=this._unFrozenColumns.filter(function(e){return 1==e.visible}),1==s.length&&(t=e("#"+this._id+"_columnMenu_"+s[0].field).data("ejCheckBox"),t&&t.option("enabled",!1)),1==a.length&&(t=e("#"+this._id+"_columnMenu_"+a[0].field).data("ejCheckBox"),t&&t.option("enabled",!1)))},_renderToolTip:function(t,i,a){var n,o,r,l,d,h,c,u,m,p,g,_,f,b=this,v=e(t.target),x=this.model,w=[],y=(document,b.model.columns),C=x.dragTooltip.tooltipItems.length,S=v.closest("tr"),T=b.getIndexByRow(S),w={},D=x.allowPaging?b._updatedPageData:x.updatedRecords;b._insertAbove=!1,b._insertAsChild=!1,b._insertBelow=!1,b._childItem=!1,b._currentRecord=x.currentViewData[T],n=b._draggedRecord,b._frozenColumnsLength>0&&T!=-1&&(c=S.index(),h=S.closest(".e-movablecontentdiv").length>0?e(b._gridRows[0])[T]:e(b._gridRows[1])[T],S=S.add(h)),e(".intend").find(".e-icon").css({display:"none"}),e(".intendparent").find(".e-icon").css({display:"none"}),e(".e-treegridexpand").css({display:"inline-block"}),e(".e-treegridcollapse").css({display:"inline-block"}),x.rowTemplateID?(l=D,c=D.indexOf(b._currentRecord)):(l=b.getExpandedRecords(D),b.getVisibleRange(),currentViewData=l.slice(b._visibleRange.top,b._visibleRange.bottom),0!=b._scrollTop?(d=D.indexOf(b._draggedRecord)-1,c=currentViewData.indexOf(b._currentRecord)-1):(d=D.indexOf(b._draggedRecord),c=currentViewData.indexOf(b._currentRecord)));var I=D.indexOf(b._currentRecord),k=b._currentRecord&&b._checkPrevNextRecord(b._draggedRecord,I,b._currentRecord.level,"next"),P=b._currentRecord&&b._checkPrevNextRecord(b._draggedRecord,I,b._currentRecord.level,"prev");w=b.getRange(b._currentRecord,c,S),t.originalEvent.pageX||t.originalEvent.pageY?(posx=this.getOffsetRect(b._$gridContent[0]).left,posy=t.originalEvent.pageY):t.originalEvent.clientX||t.originalEvent.clientY?(posx=t.originalEvent.clientX+document.body.scrollLeft+document.documentElement.scrollLeft,posy=t.originalEvent.clientY+document.body.scrollTop+document.documentElement.scrollTop):t.originalEvent&&t.originalEvent.changedTouches&&t.originalEvent.changedTouches.length>0&&(posx=t.originalEvent.changedTouches[0].pageX,posy=t.originalEvent.changedTouches[0].pageY),posx+200>b._windowWidth&&(posx-=posx+200-b._windowWidth),posy+x.rowHeight>b._windowHeight&&(posy-=posy+x.rowHeight-b._windowHeight);var L=posy<=w.topRowSegment,R=posy>w.topRowSegment&&posy<=w.middleRowSegment,M=posy>w.middleRowSegment&&posy<=w.bottomRowSegment;if(b._currentRecord&&(b.data=b._currentRecord,u=this._getrowName(),b._childValidation(b._currentRecord),b._currentRecord.parentItem?b._currentRecord.hasChildRecords&&(b._currentRecord.expanded?S.find(".e-treegridexpand").css({display:"inline-block"}):S.find(".e-treegridcollapse").css({display:"inline-block"})):!b._currentRecord.hasChildRecords||L&&P||R&&b._childItem||M&&k||(b._currentRecord.expanded?S.find(".e-treegridexpand").css({display:"none"}):S.find(".e-treegridcollapse").css({display:"none"})),1==b._currentRecord.dragState&&0!=a.canDrop?L&&!P?(e(b.element).find("."+u).find(".aboveIcon").css({display:"block"}),b._insertAbove=!0):R&&0==b._childItem?(e(b.element).find("."+u).find(".childIcon").css({display:"block"}),b._insertAsChild=!0):M&&!k&&(e(b.element).find("."+u).find(".belowIcon").css({display:"block"}),b._insertBelow=!0):(e(b.element).find("."+u).find(".cancelIcon").css({display:"block"}),b.cancelDrop=!0)),m=b._$gridContainer[0].scrollWidth,tooltiptable=s.buildTag("table","",{padding:"1",width:"100%","border-collapse":"collapse"},{cellspacing:"1"}),b.model.dragTooltip.showTooltip)if(b.model.dragTooltip.tooltipTemplate||0!=b.model.dragTooltip.tooltipItems.length)if(0!=C)if(0==b._dragTooltip){for(f=s.buildTag("tbody","",{},{}),tooltiptr=s.buildTag("tr.e-dragtooltipbackground","",{},{}),p=0;p"+f[0].innerHTML+"",b._dragTooltip=!0):e(b._dragmouseOverTooltip).css({top:posy+10+"px",left:posx+15+"px",position:"absolute","z-index":"5",padding:"0","border-right":"0","border-bottom":"0","border-radius":"3px",height:"auto"}));else 0==b._dragTooltip?(f=s.buildTag("tbody","",{},{}),i.find(".e-treegridexpand").css({display:"none"}),i.find("td.e-detailsrowcell").css({display:"none"}),i.find(".e-treegridcollapse").css({display:"none"}),e(i.find(".intend")).css({width:0}),i.find(".e-intend").removeClass("e-intend"),i.find(".e-rowcell ").removeClass("e-rowcell ").addClass("e-dragrowcell"),i.addClass("e-dragtooltipbackground"),x.isFromGantt&&i.find("td:last").remove(),2==i.length&&this._frozenColumnsLength>0&&(e(i[0]).append(e(i[1].childNodes)),i.splice(1,1)),f.append(i),tooltiptable.append(f),b._dragmouseOverTooltip=s.buildTag("div.e-tooltipgantt#tooltiptreegrid"+b._id,tooltiptable,{top:posy+10+"px",left:posx+15+"px",position:"absolute","z-index":"5",padding:"0","border-radius":"3px","border-right":"0","border-bottom":"0",width:m},{}),e(b._dragmouseOverTooltip).addClass("e-dragtooltipbackground").addClass("e-dragrowcell"),e(document.body).append(b._dragmouseOverTooltip),b._dragTooltip=!0):e(b._dragmouseOverTooltip).css({top:posy+10+"px",left:posx+15+"px",position:"absolute","z-index":"5",padding:"0","border-radius":"3px","border-right":"0","border-bottom":"0",width:m})},_checkPrevNextRecord:function(e,t,i,s){var a=this,n=a.model,o=n.allowPaging?a._updatedPageData:n.updatedRecords,r=t;for("next"==s?t++:t--;o[t];){if(o[t].level==i)return o[t]==e&&e.parentItem==o[r].parentItem;"next"==s?t++:t--}return!1},_createDragTooltipTemplate:function(){var t,i,s,a=this,n=a.model.dragTooltip.tooltipTemplate;n&&(i=n.charAt(0),t="#"==i?e(a.model.dragTooltip.tooltipTemplate)[0].innerHTML:a.model.dragTooltip.tooltipTemplate),s={},s[a._id+"dragtooltipTemplate"]=t,e.templates(s)},_updateDragStateFalse:function(e,t){var i,s,a,n=this;if(e.dragState=!1,e.hasChildRecords)for(s=e.childRecords.length,a=0;a0&&(l=e(l[0]).add(l[1])),l.find(".e-selectionbackground").removeClass("e-selectionbackground").removeClass("e-active");d.model.allowSelection&&d._dragRowSelection(t),n=d.getIndexByRow(u),updatedRecords=model.allowPaging?d._updatedPageData:model.updatedRecords,n!=-1?(o=d.model.currentViewData[n],u=s.TreeGrid.getRowByIndex(d,d._currentIndex),r=u.clone(),r.find(".e-hide").remove(),h.targetRowIndex=n,h.targetRow=o,h.canDrop=!0,h.draggedRow=d._draggedRecord,h.draggedRowIndex=updatedRecords.indexOf(d._draggedRecord),d._trigger("rowDrag",h),d._renderToolTip(t,r,h),h.targetRow.isSummaryRow?(d._draggedRecord.canDrop=!1,e(".intend").find(".e-icon").css({display:"none"}),e(".intendparent").find(".e-icon").css({display:"none"})):d._draggedRecord.canDrop=0!=h.canDrop):d._draggedRecord&&d._dragMouseDown&&(o=null,u=s.TreeGrid.getRowByIndex(d,d._currentIndex),r=u.clone(),h.targetRowIndex=null,h.targetRow=null,h.canDrop=!0,h.draggedRow=d._draggedRecord,h.draggedRowIndex=d._draggedRecord.index,d._trigger("rowDrag",h),d._renderToolTip(t,r,h))}},dragMouseUp:function(t){var a,n,o,r,l,d,h,c,u,m,p,g=e(t.target),_=0,f={},b={},v=this,x=v.model,w=v._draggedRecord,y=(v._currentRecord,g.closest("tr")),C=x.selectedItems.length;if(_timerDragDown&&(_timerDragDown=window.clearInterval(_timerDragDown)),_timerDragUp&&(_timerDragUp=window.clearInterval(_timerDragUp)),v._off(v.element,"mousemove",".e-treegridrows",v.dragToolTip),v._off(v.element,"mousemove",".e-templatecell ",v.dragToolTip),v._off(e(document),"mousemove",v._mouseout),v._dragMouseDown=!1,a=!!s.isNullOrUndefined(w)||w.canDrop,e(v._dragmouseOverTooltip).remove(),v._dragTooltip=!1,e(".intend").find(".e-icon").css({display:"none"}),e(".intendparent").find(".e-icon").css({display:"none"}),1!=this.cancelDrop||s.isNullOrUndefined(w)||null!=w.parentItem||(w.expanded?y.find(".e-treegridexpand").css({display:"inline-block"}):y.find(".e-treegridcollapse").css({display:"inline-block"})),v._dragMouseLeave=!0,1!=g.closest("div#"+v._id).length||s.isNullOrUndefined(w)||0!=v._dropCancel)v._updateDragStateTrue(w);else{if(v._dragMouseDown=!1,!x.allowDragAndDrop||!a)return v._updateDragStateTrue(w),0;if(v._dragMouseLeave=!1,v._dragMouseDown=!1,o=v.getIndexByRow(y),o!=v._currentIndex&&o!=-1)if(v._droppedRecord=x.currentViewData[o],droppedRecord=v._droppedRecord,f.previousItem=w,r=x.flatRecords,f.previousItemIndex=r.indexOf(f.previousItem),f.previousParentItem=w.parentItem,s.isNullOrUndefined(w.parentItem)||(f.parentChildState=w.parentItem.hasChildRecords,f.parentExpandedState=w.parentItem.expanded),b.targetRow=e.extend({},v._droppedRecord),b.targetRowIndex=x.updatedRecords.indexOf(droppedRecord),b.draggedRow=e.extend({},v._draggedRecord),b.draggedRowIndex=x.updatedRecords.indexOf(w),f.hasChildRecords=droppedRecord.hasChildRecords,f.expanded=droppedRecord.expanded,f.childIndex=f.previousParentItem?f.previousParentItem.childRecords.indexOf(w):0,f.previousLevel=w.level,l=[],1==droppedRecord.dragState){if(v._updateDragStateTrue(w),1==v._insertAbove||1==v._insertBelow||1==v._insertAsChild){for(v._cancelSaveTools(),i=0;i0&&s.TreeGrid.updateAltRow(v,v.model.currentViewData[0],0,0),b.cancel&&v._revertDragging(f),x.enableWBS&&!b.cancel){w.parentItem?u=w.parentItem.childRecords:(m=x.flatRecords,p=m.filter(function(e){return e&&0==e.level}),u=p);var S=u.indexOf(w),T=u.slice(S,u.length),D=w.parentItem?w.parentItem.WBS:null,I=S+1;v.reCalculateWBS(T,I,D)}x.allowSelection&&("row"==x.selectionMode&&v._selectDraggedRow(y),"cell"==x.selectionMode&&v.updateScrollBar(x.updatedRecords.indexOf(v._draggedRecord)))}else v._updateDragStateTrue(w);else v._updateDragStateTrue(w),v._cancelSaveTools()}s.isNullOrUndefined(v._currentRecord)||null==v._currentRecord.parentItem&&(y=s.TreeGrid.getRowByIndex(v,x.updatedRecords.indexOf(v._currentRecord)),v._currentRecord.expanded?y.find(".e-treegridexpand").css({display:"inline-block"}):y.find(".e-treegridcollapse").css({display:"inline-block"})),x.showSummaryRow&&"dragAndDrop"==f.requestType&&1!=v._insertAsChild&&v._updateSummaryRow(f),v._dropCancel=!1,v._resetPrivateProperties(),v._cancelSaveTools()},_resetPrivateProperties:function(){_timerDragDown&&(_timerDragDown=window.clearInterval(_timerDragDown)),_timerDragUp&&(_timerDragUp=window.clearInterval(_timerDragUp));var e=this;e.cancelDrop=!1,e._draggedRecord=null,e._dragMouseDown=!1,_timerDragDown=null,_timerDragUp=null,e._childItem=!1,e._dragMouseLeave=!1,e._currentRecord=null,e._currentIndex=null,e._droppedRecord=null,e._insertAsChild=!1,e._insertAbove=!1,e._insertBelow=!1},_selectDraggedRow:function(){var e,t=this,i=t.model,s=i.allowPaging?t._updatedPageData:i.updatedRecords;e=i.isFromGantt?s.map(function(e){return e.taskId}).indexOf(t._draggedRecord.taskId):s.indexOf(t._draggedRecord),t.element.focus(),i.allowSelection&&!t._rowSelectingEventTrigger(this.selectedRowIndex(),e)&&(t.selectRows(e),t._rowSelectedEventTrigger(e))},_addChildItem:function(e){for(var t,i=this,a=0,a=e.childRecords.length,n=0;n0&&s.TreeGrid.updateAltRow(t,i.currentViewData[0],0,0)},_updateChildRecord:function(e,t){var i,s,a,n=this,o=n.model;if(!e.hasChildRecords)return 0;for(s=e.childRecords.length,a=0;a0&&c.model.enableAltRow&&s.TreeGrid.updateAltRow(c,c.model.currentViewData[0],0,0)}},_validateFilterValue:function(e){var t,i,n=this;switch(this._predicate="and",this._currentFilterColumn.filterEditType){case"numericedit":this._operator=s.FilterOperators.equal;break;case"datepicker":this._operator=s.FilterOperators.equal,t=""==this._currentFilterColumn.format||this._currentFilterColumn.format==a?s.preferredCulture().calendar.patterns.d:this._currentFilterColumn.format.split(":")[1].replace("}",""),""!=this._currentFilterbarValue&&(this._currentFilterbarValue=s.format(e,t));break;case"datetimepicker":this._operator=s.FilterOperators.equal,t=""==this._currentFilterColumn.format||this._currentFilterColumn.format==a?s.preferredCulture().calendar.patterns.f:this._currentFilterColumn.format.split(":")[1].replace("}",""),""!=this._currentFilterbarValue&&(this._currentFilterbarValue=s.format(e,t));break;case"stringedit":this._operator=s.FilterOperators.startsWith;break;case"dropdownedit":i=this._currentFilterColumn,this._operator="dropdownedit"==i.editType&&i.editParams&&i.editParams.showCheckbox?s.FilterOperators.contains:s.FilterOperators.equal;break;case"booleanedit":1==n._searchString||"1"==n._searchString?n._searchString=!0:("false"==n._searchString||"0"==n._searchString)&&(n._searchString=!1),this._operator=s.FilterOperators.equal;break;default:this._operator=s.FilterOperators.equal}},_mouseHover:function(t){var i,a,n,o,r,l;if(t.preventDefault(),i=this,a=i.model,a.showGridCellTooltip&&1!=this._dragMouseDown){var d,l,h,c,u,m,p,g=e(t.target),i=this,_=0,f=0,b=(i.getRows(),g.closest("tr")),v=g.closest("td.e-rowcell"),x=this.getIndexByRow(b),w=a.currentViewData[x],y=a.columns;x>=0&&(columnIndex=i.getCellIndex(t),i._cellMouseLeave(),t||(t=window.event),t.originalEvent.pageX||t.originalEvent.pageY?(_=t.originalEvent.pageX,f=t.originalEvent.pageY):(t.originalEvent.clientX||t.originalEvent.clientY)&&(_=t.originalEvent.clientX+document.body.scrollLeft+document.documentElement.scrollLeft,f=t.originalEvent.clientY+document.body.scrollTop+document.documentElement.scrollTop),w&&(columnIndex!=a.treeColumnIndex?h=v.children().length?v.children().clone():v.clone():v.find(".e-cell").length>0?h=v.find(".e-cell").clone():v.hasClass("e-summaryrowcell")&&(v.find(".e-summarytitle").length>0?h=v.find(".e-summarytitle").clone():(h=v.clone(),e(h).css({cssText:"padding-left: 0px;"}))),d=s.buildTag("table.e-tooltiptable","",{padding:"0"},{cellspacing:"1"}),(!a.showGridExpandCellTooltip||a.showGridExpandCellTooltip&&columnIndex==i.model.treeColumnIndex)&&(l=s.buildTag("tbody",h,{},{})),d.append(l),n=e(h).text().replace(/[ \t\r]+/g,"").length>0,l&&0==e(v).find("#"+i._id+"EditForm").length&&(a.cellTooltipTemplate?a.cellTooltipTemplate&&(o=e("#"+this._id+"detailscellwrapper").length>0?110:5,r={},r.record=w,r.column=y[columnIndex],i._mouseOverTooltip=s.buildTag("div.e-tooltipgantt#tooltipgantt"+i._id,"",{top:f+10+"px",left:_+15+"px",position:"absolute","z-index":o,padding:"0","border-radius":"3px"},{}),i.tooltipState="Template",l=s.buildTag("tbody",e.render[i._id+"tooltipTemplate"](r),{},{}),i._mouseOverTooltip[0].innerHTML=""+l[0].innerHTML+"
    ",i._tooltipTimer=setTimeout(function(){var t,s;e(document.body).append(i._mouseOverTooltip),a.isFromGantt?(t=e("#"+i._id.replace("ejTreeGrid","")),s=i.getOffsetRect(t[0]),m=e(t).width()+s.left,p=e(t).height()+s.top):(s=i.getOffsetRect(i.element[0]),m=e(i.element).width()+s.left,p=e(i.element).height()+s.top),c=e(i._mouseOverTooltip).width(),u=e(i._mouseOverTooltip).height(),_+c+15>=m&&(_=_-c-15),f+u+10>=p&&(f=f-u-10),e(i._mouseOverTooltip).css({top:f,left:_})},700)):(!a.showGridExpandCellTooltip&&n||a.showGridExpandCellTooltip&&n)&&(o=e("#"+this._id+"detailscellwrapper").length>0?110:5,i._mouseOverTooltip=s.buildTag("div.e-tooltipgantt#tooltipgantt"+i._id,d,{top:f+10+"px",left:_+15+"px",position:"absolute","z-index":o,padding:"0","border-radius":"3px"},{}),i._tooltipTimer=setTimeout(function(){var t,s;e(document.body).append(i._mouseOverTooltip),a.isFromGantt?(t=e("#"+i._id.replace("ejTreeGrid","")),s=i.getOffsetRect(t[0]),m=e(t).width()+s.left,p=e(t).height()+s.top):(s=i.getOffsetRect(i.element[0]),m=e(i.element).width()+s.left,p=e(i.element).height()+s.top),c=e(i._mouseOverTooltip).width(),u=e(i._mouseOverTooltip).height(),_+c+15>=m&&(_=_-c-15),f+u+10>=p&&(f=f-u-10),e(i._mouseOverTooltip).css({top:f,left:_})},700)))))}},_cellMouseLeave:function(){var t=this;null!=t._mouseOverTooltip&&(e("#tooltipgantt").remove(),window.clearTimeout(t._tooltipTimer),e(t._mouseOverTooltip).remove())},disableTooltip:function(){this._cellMouseLeave()},_createTooltipTemplate:function(){var t,i,s,a=this,n=(a.model.columnHeaderTexts,{_getTaskName:a._tooltipTaskName}),o=a.model.cellTooltipTemplate,r=null;e.views.helpers(n),i="",o?(i=document.getElementById(o)?e("#"+o)[0].innerHTML:o, r=i):(r="",t="{{if ~_getTaskName()}}{{:ttiptaskname}}{{/if}}",r+=t,r+=""),s={},s[a._id+"tooltipTemplate"]=r,e.templates(s)},_tooltipTaskName:function(){return this.data.ttiptaskname},_onScroll:function(t){var i,s=this;this.model;return s._popupHide(),s._clearContextMenu(),e("#"+this._id+"detailscellwrapper").length>0&&this._removeDetailsRow(),s.model.showGridCellTooltip&&s._cellMouseLeave(),s.isVScroll()||s.model.isFromGantt||"wheel"!==t.source?(t.scrollLeft!=a&&(s._scrollLeft=t.scrollLeft,i=Math.abs(s._scrollLeft-s._prevScrollLeft)),i&&(s._updateHeaderScrollLeft(s._scrollLeft),s._prevScrollLeft=s._scrollLeft),void(t.scrollTop!=a&&(s.model.isEdit?(s.cancelEditCell(),e(s.element).focus()):s._isRowEdit&&(s.cancelRowEditCell(),e(s.element).focus()),s._scrollTop=t.scrollTop,s._vScrollDist=Math.abs(s._scrollTop-s._prevScrollTop),s.model.enableVirtualization&&(s._vScrollDir=s._prevScrollTop<=s._scrollTop?1:-1,s._vScrollDist&&(s._updateCurrentViewData(),s._prevScrollTop=s._scrollTop)),s._scrollTop=t.scrollTop,this._frozenColumnsLength&&s.getContent().find("#e-frozencontainer"+s._id).scrollTop(s._scrollTop)))):void(t.cancel=!0)},_saveRow:function(){var t,a,n=this,o=n.model,r=e("#"+n._id+"EditForm"),l=e("#"+n._id+"EditFrozenForm"),d=(l.add(r).find("td"),this.getIndexByRow(r.closest("tr"))),h=r.closest("tr").hasClass("e-addedrow"),c=o.columns,u=c.length,m=o.currentViewData[d],p={},g={},_={};if(n.element[0].focus(),!(r.length<=0)||d!=-1){for(i=0;i0&&o.enableAltRow&&!o.enableVirtualization&&s.TreeGrid.updateAltRow(n,o.currentViewData[0],0,0),o.showSummaryRow&&(_.editType="rowedit","addNewRow"==_.requestType&&"child"==o.editSettings.rowPosition&&n._createAndRenderSummaryRecords(_),n._updateSummaryRow(_)),o.showTotalSummary&&(_.editType="rowedit",n._updateTotalSummaryRow(_)),n._cancelSaveTools(),a=c.filter(function(e){if("dropdownedit"==e.filterEditType&&"dropdownedit"!=e.editType)return!0}),o.allowFiltering&&a.length&&n._resizeFilteringElements()}},_excludeDetailRows:function(){var t=e(),i=this.model;return this.getTreeGridRows()&&this.getTreeGridRows().length>0&&(t=i.showDetailsRow&&i.detailsTemplate?this._frozenColumnsLength>0?[e(this.getTreeGridRows()[0]).not(".e-detailsrow"),e(this.getTreeGridRows()[1]).not(".e-detailsrow")]:e(this.getTreeGridRows()).not(".e-detailsrow"):this._frozenColumnsLength>0?[e(this.getTreeGridRows()[0]),e(this.getTreeGridRows()[1])]:e(this.getTreeGridRows())),t},getIndexByRow:function(t){var i=this._excludeDetailRows(),s=-1;return this._frozenColumnsLength>0?(s=e(i[0]).index(t),s==-1&&(s=e(i[1]).index(t)),s):i.index(t)},getTreeGridRows:function(){return this._gridRows},_keyDown:function(e){var t=this;e.shiftKey&&t._shiftKeyFirstElementDetails.firstElementRowIndex==-1&&(t._shiftKeyFirstElementDetails.firstElementRowIndex=t._focusingRowIndex,t._shiftKeyFirstElementDetails.firstElementCellIndex=t._cellIndex)},_onClick:function(t){var i,a,n,o,r=this,l=r.model,d=e(t.target),h={},c=-1,u=l.allowPaging?r._updatedPageData:l.updatedRecords;if(d.closest(".e-treegrid").attr("id")!==this._id)return!1;if(r._clearContextMenu(),this._removeDetailsRow(t),r._cellIndex=r.getCellIndex(t),this.getHeaderTable().find(".e-cancel").addClass("e-hide"),("click"==l.editSettings.beginEditAction||d.hasClass("e-treegridexpand")||d.hasClass("e-treegridcollapse"))&&(c=r.getRowIndex(t),"cellediting"==l.editSettings.editMode.toLowerCase()&&(r._cellEditingDetails.rowIndex=c),a=l.currentViewData&&l.currentViewData[c]),r._saveCellHandler(t),!d.hasClass("e-summaryrowcell")&&!d.hasClass("e-footersummaryrowcell")&&!d.hasClass("e-summarytitle")){if(d.hasClass("e-treegridexpand")||d.hasClass("e-treegridcollapse")&&c!=-1){var m,p=d.closest("tr"),g=u.indexOf(a),h={};h.data=b,h.data=a,h.recordIndex=g,h.expanded=!p.hasClass("e-treegridrowexpand"),0!=e("#"+r._id+"EditForm").length||!d.hasClass("e-rowcell")&&d.closest(".e-rowcell").hasClass("e-templatecell")?r._cancelEditState():r.element[0].focus(),m=h.expanded?r._trigger("expanding",h):r._trigger("collapsing",h),m||l.isFromGantt||(r._isRefreshAddedRecord?(h.data.expanded=h.expanded,r.updateExpandStatus(h.data,h.expanded),r.refreshContent(),r.renderRecords(),r._isRefreshAddedRecord=!1):s.TreeGrid.sendExpandCollapseRequest(r,h))}else if((d.hasClass("e-rowcell")||d.parent().hasClass("e-rowcell")||d.closest("td").hasClass("e-rowcell")||d.parent().hasClass("e-detailsrowcell")||d.hasClass("e-detailsrowcell")||d.closest("td").hasClass("e-rowcell")&&d.hasClass("e-cell"))&&(0==e("#"+r._id+"EditForm").length&&(d.hasClass("e-rowcell")||!d.closest(".e-rowcell").hasClass("e-templatecell"))&&r.element[0].focus(),l.allowSelection&&(i=r.getIndexByRow(d.closest("tr")),l.selectionMode==s.TreeGrid.SelectionMode.Row&&(l.selectionType==s.TreeGrid.SelectionType.Multiple&&(t.ctrlKey&&(r._multiSelectCtrlRequest=!0),t.shiftKey&&(i=r.getIndexByRow(d.closest("tr")),b=l.currentViewData[i],i=l.updatedRecords.indexOf(b),r._multiSelectShiftRequest=!0,r._rowSelectingEventTrigger(this.selectedRowIndex(),i)||(r.getRows()&&null!=r._prevSelectedItem?r.getExpandStatus(r._prevSelectedItem)?r.selectRows(l.updatedRecords.indexOf(r._prevSelectedItem),i):r.selectRows(i):r.getRows()&&null==r._prevSelectedItem&&r.selectRows(0,i),r._cancelSaveTools(),r._rowSelectedEventTrigger(i)))),r._multiSelectShiftRequest||0!=e("#"+r._id+"EditForm").length&&"click"!=l.editSettings.beginEditAction||(g=r.getIndexByRow(d.closest("tr")),g!=-1&&(b=l.currentViewData[g],i=l.allowPaging?r._updatedPageData.indexOf(b):l.updatedRecords.indexOf(b),r._rowSelectingEventTrigger(this.selectedRowIndex(),i)||(r.selectRows(i),r._cancelSaveTools(),r._rowSelectedEventTrigger(i)))),r._multiSelectShiftRequest=!1),l.selectionMode==s.TreeGrid.SelectionMode.Cell&&0==e("#"+r._id+"EditForm").length&&r._cellIndex!=-1&&i!=-1))){n=r._cellIndex>=r._frozenColumnsLength?1:0,targetRow=r._frozenColumnsLength>0?r.getRows()[n][i]:r.getRows()[i];var _,f=l.columns,b=l.currentViewData&&l.currentViewData[i],v=l.updatedRecords.indexOf(b),x=r._cellIndex>=r._frozenColumnsLength?r._cellIndex-r._frozenColumnsLength:r._cellIndex,w=targetRow.childNodes[x],y=(r._previousSelectedCellDetails.rowIndex,r._previousSelectedCellDetails.cellIndex,e(w).closest("td"));if(r._focusingRowIndex=v,i!=-1){if(b.isSummaryRow)return;h={rowIndex:v,cellIndex:x,rowElement:targetRow,cellElement:y[0]},o={rowIndex:v,cellIndex:x,cellElement:y[0],data:b},!r._cellSelectingEventTrigger(h)&&f[x].allowCellSelection&&("multiple"==l.selectionType&&(t.ctrlKey||t.shiftKey)?t.ctrlKey?(_=r._selectedCellDetails.map(function(e){return e.cellElement}).indexOf(y[0]),_==-1?(e(y[0]).addClass("selectingcell"),r._selectedCellDetails.push(o),l.selectedCellIndexes.push({rowIndex:o.rowIndex,cellIndex:o.cellIndex}),r._cellSelectedEventTrigger(h,r._previousSelectedCellDetails)):(e(y[0]).removeClass("selectingcell"),r._selectedCellDetails.splice(_,1),l.selectedCellIndexes.splice(_,1))):t.shiftKey&&(h={rowIndex:v,cellIndex:r._cellIndex},r._shiftKeySelectCells(h),r._rowIndexOfLastSelectedCell=v,r._focusingRowIndex=r._shiftKeyFirstElementDetails.firstElementRowIndex):(r._selectedCellDetails=[],l.selectedCellIndexes=[],e("#"+r._id).find(".selectingcell").removeClass("selectingcell"),e(y[0]).addClass("selectingcell"),r._selectedCellDetails.push(o),l.selectedCellIndexes.push({rowIndex:o.rowIndex,cellIndex:o.cellIndex}),r._cellSelectedEventTrigger(h,r._previousSelectedCellDetails),r._shiftKeyFirstElementDetails={firstElementRowIndex:-1,firstElementCellIndex:-1},r._updateSecondRowIndexBy=1),t.shiftKey||(r._previousSelectedCellDetails={rowElement:targetRow,cellElement:y[0],cellIndex:h.cellIndex,rowIndex:v},r._rowIndexOfLastSelectedCell=r._focusingRowIndex,r._isShiftKeyNavigation=!1)),r._cancelSaveTools(),r._lastSelectedCellIndex=r._cellIndex}}(d.hasClass("e-detailsrowcell")||d.parent("td").hasClass("e-detailsrowcell"))&&!d.closest("tr").hasClass("e-detailsrow")&&(t.ctrlKey||t.shiftKey||(r._isRowEdit?this._saveRow():r._detailsExpandCollapse(d))),r._isRowEdit&&d.focus(),d.closest("#"+r._id+"_ColumnMenu").hasClass("e-columnmenu")||r._clearColumnMenu(),"click"!=l.editSettings.beginEditAction||0!=d.closest("#"+r._id+"EditForm").length||r._isShiftKeyNavigation||r._editdblClickHandler(t)}},_removeInnerDetailRows:function(t,i){var a,n=e(".e-detailscellwrapperfly"),o=n.length,r=0,l=!1;for(r;r0&&e("#"+this._id+"detailscellwrapper").length>0){var r=(e("#"+this._id+"detailscellwrapper"),a.selectedItem),l={};if(l.rowData=r,!this._trigger("detailsHidden",l)||i)for(o;o0&&this._removeInnerDetailRows(e("#"+this._id+"detailscellwrapper")[0],i),this._triggerDetailRowHideEvent(e("#"+this._id+"detailscellwrapper"),i)},showHideDetailsRow:function(t){var i,a,n=this,o=this.model;n._isRowEdit&&this._saveRow(),o.isEdit&&this.saveCell(),o.showDetailsRow&&o.detailsTemplate&&o.showDetailsRowInfoColumn&&!s.isNullOrUndefined(t)&&t<=o.updatedRecords.length&&n.getExpandStatus(o.updatedRecords[t])&&(t!=this.selectedRowIndex()&&t!=-1&&e.inArray(t,n._selectedRowsIndexes==-1)&&o.allowSelection&&o.updatedRecords.length>t&&(n._rowSelectingEventTrigger(this.selectedRowIndex(),t)||(n.selectRows(t),n._rowSelectedEventTrigger(t))),this.updateScrollBar(t),i=e(s.TreeGrid.getRowByIndex(n,t)),i.length>0&&o.updatedRecords[t]&&n.getExpandStatus(o.updatedRecords[t])&&(a=e(i).find(".e-detailsrowcell"),e(a).length>0&&e(a).hasClass("e-detailsrowcell")&&(this.element.find(".e-detailsrowexpand")[0]!=a[0]&&this._removeDetailsRow(),this._detailsExpandCollapse(e(a)))))},_detailsExpandCollapse:function(t){var i,a,n,o,r,l,d,h,c,u,m,p,g=this,_=this.model;if(t.parent("td").hasClass("e-detailsrowcell")&&(t=t.parent("td")),i=t.closest("tr"),a=i.find(".e-detailsrowcell"),a.hasClass("e-detailsrowcollapse")){if(n=this.getIndexByRow(i),o=this.model.currentViewData[n],s.isNullOrUndefined(o)||o.isSummaryRow)return;for(var f=this.getOffsetRect(i[0]),b=e(e.render[g._id+"_detailRowTemplate"](o)),v=e(b).find(".e-detailscellwrapper").attr({id:this._id+"detailscellwrapper"}),x=g._gridWidth-(g.element.find(".e-scrollcss").length>0?18:0)-2,w=this.element.parents().filter(".e-detailscellwrapperfly"),y=this._id,C="";w.length>0;)C=w.attr("id").replace("detailscellwrapper",""),y+=","+C,w=e("#"+C).parents().filter(".e-detailscellwrapperfly");v.attr("parentTreeGridIds",y),r=this.getOffsetRect(g._$gridContent[0]),r.bottom=r.top+g._$gridContent[0].offsetHeight,l=f.top+i[0].offsetHeight,d=l+_.detailsRowHeight,(l>r.bottom||d>r.bottom)&&(h=f.top-_.detailsRowHeight,h>r.top&&(l=h)),v.removeClass("e-detailscellwrapper").addClass("e-detailscellwrapperfly"),c=g.getScrollElement().ejScroller("isHScroll")?g.getScrollElement().ejScroller("option","scrollLeft"):0,u=0,this._frozenColumnsLength>0&&(u=e(this.element).find("#e-frozencontentdiv"+this._id).width()),v.css({top:l,left:f.left+c-u,"z-index":100,position:"absolute",width:x}).appendTo("body"),this._trigger("refresh"),m={},m.detailsElement=v,m.data=o,m.rowIndex=this.selectedRowIndex(),this._trigger("detailsDataBound",m),p={},p.detailsElement=v,p.data=o,p.rowIndex=this.selectedRowIndex(),p.appendTarget=null,this._trigger("detailsShown",p)?this._removeInnerDetailRows(t):(a.find(".e-detailsinfoiconshow").removeClass("e-detailsinfoiconshow").addClass("e-detailsinfoiconhide"),a.removeClass("e-detailsrowcollapse").addClass("e-detailsrowexpand"),p.appendTarget&&(e(v).css({top:"auto",left:"auto",position:"auto"}),e(v).detach().appendTo(e("#"+p.appendTarget))))}else this._removeInnerDetailRows(t)},_onHeaderClick:function(t){var i,a,n,o,r,l=this,d=l.model;if(l._cellMouseLeave(),l._clearContextMenu(),this._removeDetailsRow(),e(t.target).is(".e-ascending, .e-descending")&&(t.target=t.target.parentNode),i=e(t.target),l.getHeaderTable().find(".e-columnheader").find(".e-headercellactive").removeClass("e-headercellactive"),i.closest(".e-headercelldiv")&&!i.hasClass("e-columnmenu-icon")){if(a=i.closest(".e-headercell").find(".e-headercelldiv").attr("ej-mappingname"),(!d.allowSorting||s.isNullOrUndefined(a)&&s.isNullOrUndefined(this.getColumnByField(a))||0==this.getColumnByField(a).allowSorting)&&(l.model.isEdit?l.saveCell():l._isRowEdit&&l._saveRow(),!i.hasClass("e-checkbox")))return!1;o=this.getColumnByField(a),n=i.closest(".e-headercell").find("span").hasClass("e-ascending")?s.sortOrder.Descending:s.sortOrder.Ascending,d.allowMultiSorting&&t.ctrlKey&&(l._multiSortRequest=!0),l._isRefreshAddedRecord=!1,l.sortColumn(o.headerText,n),l.model.isFromGantt&&this.selectedRowIndex()>=0&&(r={},r.data=l.model.selectedItem,r.target="ejTreeGrid",r.recordIndex=this.selectedRowIndex(),l._trigger("rowSelected",r))}return i.hasClass("e-columnmenu-icon")?i.data("isClicked")?(l._clearColumnMenu(),i.data("isClicked",!1)):(l._renderColumnMenu(t),e(".e-columnicon").data("isClicked",!1),i.data("isClicked",!0)):l._clearColumnMenu(),!!i.hasClass("e-checkbox")},_headerMouseDown:function(t){var i,s=this,a=s.model;s._cellMouseLeave(),a.allowColumnResize&&s._resizer._mouseDown(t),e(t.target).hasClass("headercelldiv")&&e(t.target).hasClass("headercell")&&(i=e(t.target).hasClass("headercelldiv")?e(t.target).parent():e(t.target),a.headerEffects&&i.addClass("headercellactive"))},_contentMouseDown:function(t){var i=e(t.target),s=this;(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"))&&(s._clearContextMenu(),s._clearColumnMenu())},_enableColumnResizeEvents:function(){var e=this;e.model.allowColumnResize?(e._on(e.element,"mousemove",e._mouseMove),e._on(e.element,"mouseup",e._mouseUp)):(e._off(e.element,"mousemove",e._mouseMove),e._off(e.element,"mouseup",e._mouseUp))},_mouseMove:function(t){var i=this,s=this.model;i.model.allowColumnResize&&(i._resizer._mouseMove(t),i._resizer._expand&&i._cancelEditState(),"col-resize"!==e(t.target).parent().css("cursor")&&(!s.allowSorting&&!s.showColumnChooser||e(t.target).closest("th").hasClass("e-detailheadercell")?i.getHeaderTable().find(".e-columnheader").css({cursor:"default"}):i.getHeaderTable().find(".e-columnheader").css({cursor:"pointer"})))},_mouseUp:function(t){var i=this,s=i.model;s.allowColumnResize&&((e(t.target).hasClass("e-headercelldiv")||e(t.target).hasClass("e-reSizeColbg"))&&(i.element.focus(),i._clearColumnMenu()),i._resizer._expand&&(i._resizer._mouseUp(t),s.isFromGantt?i.refreshScroller(i._$gridContent.width()):(i.getScrollElement().ejScroller("refresh"),i._updateHeaderScrollLeft()),i._updateScrollCss(),i._resizeFilteringElements()))},_resizeFilteringElements:function(){var e,t,i,a=this;if(a.model.allowFiltering)for(e={},t=a.model.columns.length,s.TreeGrid.Actions.Filter="filtering",e.requestType=s.TreeGrid.Actions.Filter,i=0;i0||a.hasClass(".e-gridcontent"))&&(n._isRowEdit?0==a.closest("form#"+n._id+"EditForm").length&&0==a.closest("form#"+n._id+"EditFrozenForm").length&&e("#"+n._id+"EditForm").length>0&&n._saveRow():0==a.closest(".e-popup").length&&0==a.closest(".e-rowcell").find("#"+n._id+"EditForm").length&&0==a.closest("form#"+n._id+"EditFrozenForm").length&&e("#"+n._id+"EditForm").length>0&&n.saveCell()),"row"!=o.selectedMode||!o.isFromGantt||!o.updatedRecords.length||s.isNullOrUndefined(i)||a.hasClass("e-treegridexpand")||a.hasClass("e-treegridcollapse")||this.selectedRowIndex()==i||n._rowSelectingEventTrigger(this.selectedRowIndex(),i)||(o.allowSelection&&n.selectRows(i),n._rowSelectedEventTrigger(i)))},_rightClick:function(t){t.preventDefault();var i,s,a,n=this,o=n.model,r=e(t.target),l=r[0].parentNode,d={},h=!1,c=o.allowPaging?n._updatedPageData:o.updatedRecords;if(r.closest(".e-treegrid").attr("id")!==this._id)return!1;if(n.model.contextMenuSettings.showContextMenu){if(n._clearContextMenu(),this._removeDetailsRow(),n.disableTooltip(),r.hasClass("e-summaryrowcell")||r.hasClass("e-summarytitle"))return;(r.hasClass("e-cell")||r.hasClass("e-treegridexpand"))&&(l=r.closest("tr")),i=r.closest("tr"),s=n.getIndexByRow(i),n.model.currentViewData=n.getCurrentViewData(),a=n.model.currentViewData[s],s=c.indexOf(a),d.data=a,d.recordIndex=s,o.isEdit?h=r.closest(".e-rowcell").find("form#"+n._id+"EditForm").length>0||r.closest(".e-rowcell").find("form#"+n._id+"EditFrozenForm").length>0:this._isRowEdit&&(h=r.closest(".e-rowedit").find("form#"+n._id+"EditForm").length>0||r.closest(".e-rowedit").find("form#"+n._id+"EditFrozenForm").length>0||r.closest(".e-addedrow").find("form#"+n._id+"EditForm").length>0||r.closest(".e-addedrow").find("form#"+n._id+"EditFrozenForm").length>0),h||(o.isEdit?this.saveCell():this._isRowEdit&&this._saveRow()),null==n.dataSource()||0==n.dataSource().length||h||0==o.flatRecords.length?(n._contextMenuItems=[],n._contextMenuItems=n._getContextMenuItems(),n._subContextMenuItems=[],n._updateContextmenuOption(s,a),n._clearContextMenu(),n._contextMenuItems.length>0&&n._renderContextMenu(t,s,a)):a&&(t.preventDefault(),n._contextMenuItems=[],n._contextMenuItems=n._getContextMenuItems(),n._subContextMenuItems=[],n._subContextMenuItems=n._getsubContextMenuItems(),n._updateContextmenuOption(s,a),n._clearContextMenu(),o.allowSelection&&("row"!=o.selectionMode||n._rowSelectingEventTrigger(this.selectedRowIndex(),s)||(n.selectRows(s),n._rowSelectedEventTrigger(s)),"cell"==o.selectionMode&&(selectCellIndex=n.getCellIndex(t),n.selectCells([{rowIndex:s,cellIndex:selectCellIndex}]),n._rowIndexOfLastSelectedCell=s)),n._contextMenuItems.length>0&&n._renderContextMenu(t,s,a),n._cancelSaveTools())}n._clearColumnMenu()},_editdblClickHandler:function(t){var i,a,n,o=this,r=o.model,l=e("#"+o._id+"EditForm"),d={},h=e(t.target),c=h.closest("tr"),u=o._cellEditingDetails;if("cell"==r.selectionMode&&(r.editSettings.editMode="cellEditing"),updatedRecords=r.allowPaging?o._updatedPageData:r.updatedRecords,!(h.hasClass("e-vhandle")||h.hasClass("e-vscrollbar")||h.hasClass("e-vup")||h.hasClass("e-vdown")||h.hasClass("e-vhandlespace")||h.hasClass("e-treegridexpand")||h.hasClass("e-treegridcollapse")||h.hasClass("e-hhandle")||h.hasClass("e-hscrollbar")||h.hasClass("e-hup")||h.hasClass("e-hdown")||h.hasClass("e-hhandlespace")||h.hasClass("e-summaryrowcell")||h.hasClass("e-footersummaryrowcell")||h.hasClass("e-summarytitle"))){if(h.closest(".e-treegrid").length&&h.closest(".e-treegrid").attr("id")!==this._id)return!1;if(h.hasClass("e-rowcell")||h.parent().hasClass("e-rowcell")||h.closest("td").hasClass("e-rowcell")||h.closest("td").hasClass("e-rowcell")&&h.hasClass("e-cell")){if("normal"===r.editSettings.editMode&&(d.requestType=s.TreeGrid.Actions.BeginEdit,o._trigger("actionBegin",d)),o._cellEditingDetails.cancelSave)return void(o._cellEditingDetails.cancelSave=!1);if(0===l.length&&null!==o.getRows()){if("cellediting"==r.editSettings.editMode.toLowerCase()){if(o.element.focus(),o._cellEditingDetails.columnIndex=o.getCellIndex(t),"click"!=r.editSettings.beginEditAction&&(o._cellEditingDetails.rowIndex=o.getRowIndex(t)),i=r.currentViewData[o._cellEditingDetails.rowIndex],i.summaryRow)return;if(r.selectedItem=i,0==r.columns[u.columnIndex].allowEditing)return;fieldName=o._cellEditingDetails.columnIndex>=0&&r.columns[o._cellEditingDetails.columnIndex].field,fieldName&&r.editSettings.allowEditing&&r.editSettings.editMode.toLowerCase()==s.TreeGrid.EditMode.CellEditing.toLowerCase()&&o.cellEdit(o._cellEditingDetails.rowIndex,fieldName)}else"rowediting"==r.editSettings.editMode.toLowerCase()&&(r.currentViewData=o.getCurrentViewData(),o.getCellIndex(t)!=-1&&o.getRowIndex(t)!=-1&&(a=o.getRowIndex(t),r.enableVirtualization&&(n="row"==r.selectionMode?r.selectedItem:r.updatedRecords[o._rowIndexOfLastSelectedCell],a=updatedRecords.indexOf(n)),o._editRow(a)));l=e("#"+o._id+"EditForm"),l.length>0&&o._editAddTools()}o.model.allowSelection||c.find(".e-active").removeClass("e-active").removeClass("e-selectionbackground"),o._clearContextMenu(),this._removeDetailsRow()}}},_popupHide:function(t){var s,a,n=this,o=n.model.columns,r=null,l=null,d=t&&e(t).closest("td");for(n.model.allowFiltering&&(d=t&&e(t).closest("td, th")),s=e("#"+n._id+"_ColumnMenu").length,s>0&&n._clearColumnMenu(),i=0;it._$gridContainer.height())return void t.getScrollElement().ejScroller("scrollY",0,!0);if(e.wheelDelta?(i=-e.wheelDelta/120,window.opera&&parseFloat(window.opera.version,10)<10&&(i=-i)):e.detail&&(i=e.detail/3),!i)return!1;var a=t.getScrollElement().ejScroller("option","scrollTop"),n=a+57*i,o=this.model.isFromGantt?parseInt(t.model.updatedRecords.length*model.rowHeight)-(t._viewPortHeight-18):this.getMaxScrollHeight();return n>o&&(n=o),n<0&&(n=0),t._updateScrollTop(n),!0},_getCollapsedParentItem:function(e){var t=e.parentItem;return t?this.getExpandStatus(t)===!0?t:this._getCollapsedParentItem(t):null},updateScrollBar:function(e){var t,i,s,a,n,o=this,r=o.model,l=0,d=r.rowHeight+o._detailsRowHeight,h=r.allowPaging?o._updatedPageData:r.updatedRecords,c="row"==r.selectionMode?this.selectedItem():h[o._rowIndexOfLastSelectedCell];r.allowPaging&&r.sizeSettings.height?(t=o._updatedPageData,i=t.indexOf(this.selectedItem())):(t=o.getExpandedRecords(h),i=e||0==e?t.indexOf(r.updatedRecords[e]):t.indexOf(c));var u,m=i*d,p=m+r.rowHeight,g=o.getScrollElement().children(".e-content").length;u=g?o.getScrollElement().children(".e-content").scrollTop():o.getScrollElement().scrollTop(),(o.getScrollElement().ejScroller("isHScroll")||o.element.find(".e-borderbox").length>0)&&(l=18),s=mt.length*d&&(m=t.length*d-o._viewPortHeight,a&&(m+=l)),n={requestType:"scroll",delta:m},g?o._updateScrollTop(m):(o.getScrollElement().scrollTop(n.delta),o._completeAction(n)),r.enableVirtualization&&o.element[0].focus())},_keyPressed:function(t,i){var a,n,o,r,l,d,h,c,u,m,p,g,_,f,b,v,x,w,y,C,S,T,D,I,k,P,L,R,M,O,E,A,j,N,z,F,B,H,V,U,W=this,G=this.model,Y=G.allowPaging?W._updatedPageData:G.updatedRecords,X=W.getExpandedRecords(G.updatedRecords);if(this._removeDetailsRow(),!G.allowKeyboardNavigation)return!1;if(r=!1,l=e(i),$form=e("#"+W._id+"EditForm"),"downArrow"!=t&&"upArrow"!=t&&"saveRequest"!=t&&"moveCellLeft"!=t&&"moveCellRight"!=t&&"cancelRequest"!=t&&"INPUT"==l.prop("tagName"))return!0;switch(G.isFromGantt?(d=e("#"+W._id.replace("ejTreeGrid","")+"_ContextMenu"),h=e("#"+W._id.replace("ejTreeGrid","")+"_SubContextMenu")):(d=e("#"+W._id+"_ContextMenu"),h=e("#"+W._id+"_SubContextMenu")),c=e("#"+W._id+"_ColumnMenu"),u=e("#"+W._id+"ccDiv_wrapper"),m="visible"==h.css("visibility"),p=u.is(":visible"),t){case"saveRequest":if(0==d.length&&0==c.length)(W._isRowEdit||W.model.isEdit)&&(l.blur(),W._endEdit(),W.element[0].focus()),"onEnter"==G.filterSettings.filterBarMode&&G.allowFiltering&&l.closest("th").hasClass("e-filterbarcell")&&W._filterBarHandler(i);else if(d.length)W._moveToNextMenuItem("save");else if(c.length&&(M=null,O=u.find("div.e-columnmenuselection"),p?M=O.data("column"):(L=c.find("div.e-columnmenuselection"),L.length>0&&(M=L[0].id)),!s.isNullOrUndefined(M)))switch(l=W._columnMenuTarget,g=e.trim(l.prev("div.e-headercelldiv").attr("ej-mappingname")),b=W.getColumnByField(g),M){case W._id+"_SortAscendingChooser":W.model.allowMultiSorting&&(W._multiSortRequest=!0),W.sortColumn(b.headerText,s.sortOrder.Ascending),W._multiSortRequest=!1;break;case W._id+"_SortDescendingChooser":W.model.allowMultiSorting&&(W._multiSortRequest=!0),W.sortColumn(b.headerText,s.sortOrder.Descending),W._multiSortRequest=!1;break;case W._id+"_FreezeColumnsChooser":b&&!e(W._id+"_FreezeColumnChooser").hasClass("e-disable")&&W.freezeColumn(b.field,!0);break;case W._id+"_UnfreezeColumnsChooser":b&&!e(W._id+"_UnfreezeColumnChooser").hasClass("e-disable")&&W.freezeColumn(b.field,!1);break;case W._id+"_FreezePrecedingColumnsChooser":b&&!e(W._id+"_FreezePrecedingColumnsChooser").hasClass("e-disable")&&W.freezePrecedingColumns(b.field);break;case W._id+"_ColumnLeftChooser":b&&!e(W._id+"_ColumnLeftChooser").hasClass("e-disable")&&W.insertColumnChooser(b,"left");break;case W._id+"_ColumnRightChooser":b&&!e(W._id+"_ColumnRightChooser").hasClass("e-disable")&&W.insertColumnChooser(b,"right");break;case W._id+"_DeleteColumnChooser":b&&!e(W._id+"_DeleteColumnChooser").hasClass("e-disable")&&(W._targetColumnIndex=G.columns.indexOf(b),W._updateConfirmDialog.ejDialog("open"),W._clearColumnMenu());break;case W._id+"_RenameColumnChooser":b&&!e(W._id+"_RenameColumnChooser").hasClass("e-disable")&&(W._targetColumnIndex=G.columns.indexOf(b),W._renderColumnRenameDialog(b),W._columnRenameDialog.ejDialog("open"),W._clearColumnMenu());break;default:O.find("span").hasClass("e-disable")||(E=O.find("span").attr("aria-checked"),"true"==E?W.hideColumn(M):W.showColumn(M))}break;case"cancelRequest":0==d.length&&0==c.length?($form.length>0&&(f=G.editSettings.editMode,"cellediting"==f.toLowerCase()?W._isRowEdit?W.cancelRowEditCell():W.cancelEditCell():"rowediting"==f.toLowerCase()&&W.cancelRowEditCell(),W._cancelSaveTools()),W.element[0].focus(),1==W._dragMouseDown&&(e(W._dragmouseOverTooltip).remove(),e(".intend").find(".e-icon").css({display:"none"}),e(".intendparent").find(".e-icon").css({display:"none"}),W._dropCancel=!0,W._dragMouseDown=!1)):(W._clearContextMenu(),W._clearColumnMenu());break;case"editRecord":if(0==d.length&&0==c.length&&(_=G.editSettings,f=_.editMode,_.allowEditing&&1==G.selectedItems.length))if("cellediting"==f.toLowerCase()){if(b=W.model.columns[W._cellIndex],s.isNullOrUndefined(b)||!b.visible||0==b.allowEditing)return;W._cellEditingDetails.rowIndex=this.selectedRowIndex(),W._cellEditingDetails.columnIndex=W._cellIndex,G.selectedItem=Y[this.selectedRowIndex()],W._cellEditingDetails.columnIndex>-1&&(W.updateScrollBar(),fieldName=b.field,fieldName&&W.cellEdit(W._cellEditingDetails.rowIndex,fieldName),W._editAddTools())}else"rowediting"!=f.toLowerCase()||W._isRowEdit||(v=W.selectedRowIndex(),v>=0&&(G.enableVirtualization&&W.updateScrollBar(),W._editRow(v)));break;case"topRowSelection":if(G.allowPaging&&0==d.length&&0==c.length){if(W._isRowEdit||W.model.isEdit)return!0;Y.length>0&&(x=0,Y[0].isSummaryRow&&(C=W._getNextRecord(x+1,Y,t),x=Y.indexOf(C)),W._rowSelectingEventTrigger(this.selectedRowIndex(),x)||(W.selectRows(x),W.element[0].focus(),W.updateScrollBar(),W._rowSelectedEventTrigger(x)))}break;case"nextPage":G.allowPaging&&(w=W._currentPage(),W.element[0].focus(),w0&&(y=Y.length-1,Y[y].isSummaryRow&&(C=W._getNextRecord(y-1,Y,t),y=Y.indexOf(C)),W._rowSelectingEventTrigger(this.selectedRowIndex(),y)||(W.selectRows(y),W.element[0].focus(),W.updateScrollBar(),W._rowSelectedEventTrigger(y)))}break;case"firstRowSelection":if(0==d.length&&0==c.length){if(W._isRowEdit||W.model.isEdit)return!0;Y.length>0&&("row"!=G.selectionMode||W._rowSelectingEventTrigger(this.selectedRowIndex(),0)?"cell"==G.selectionMode&&(V=W._focusingRowIndex,S={rowIndex:V,cellIndex:0},W._isShiftKeyNavigation=!1,W._cellIndex=0,W.selectCells([S])):(G.allowPaging&&W.gotoPage(1),W.selectRows(0),W.updateScrollBar(),W.element[0].focus(),W._rowSelectedEventTrigger(0)),W._cancelSaveTools())}break;case"lastRowSelection":if(0==d.length&&0==c.length){ if(W._isRowEdit||W.model.isEdit)return!0;Y.length>0&&(a=X.length-1,o=X[a],o.isSummaryRow&&(o=W._getNextRecord(a-1,X,t)),G.allowPaging&&o&&(W.gotoPage(G.pageSettings.totalPages),Y=W._updatedPageData),n=Y.indexOf(o),"row"!=G.selectionMode||W._rowSelectingEventTrigger(this.selectedRowIndex(),n)?"cell"==G.selectionMode&&(V=W._focusingRowIndex,U=G.columns,W._isShiftKeyNavigation=!1,W._cellIndex=U.length-1,S={rowIndex:V,cellIndex:W._cellIndex},W.selectCells([S])):(W.selectRows(n),W.element[0].focus(),W.updateScrollBar(),W._rowSelectedEventTrigger(n)),W._cancelSaveTools())}break;case"moveCellLeft":0==d.length&&0==c.length&&(W._isRowEdit?(previousElement=l.closest("td").prev("td"),this._frozenColumnsLength>0&&0==previousElement.length&&l.closest("#"+W._id+"EditForm").length>0&&(previousElement=e("#"+W._id+"EditFrozenForm").find("td").last()),previousElement.length&&W._focusElementsForRowEdit(previousElement)):G.editSettings.allowEditing&&"cellediting"==G.editSettings.editMode.toLowerCase()&&$form.length>0&&(l.blur(),r=W._moveCurrentCell("left")),G.allowSelection&&"cell"==G.selectionMode&&(0!=W._focusingRowIndex||0!=W._cellIndex)&&W._selectNextCell("left",t));break;case"moveCellRight":0==d.length&&0==c.length&&(W._isRowEdit?(nextElement=l.closest("td").next("td"),this._frozenColumnsLength>0&&0==nextElement.length&&l.closest("#"+W._id+"EditFrozenForm").length>0&&(nextElement=e($form).find("td").eq(0)),nextElement.length&&W._focusElementsForRowEdit(nextElement)):G.editSettings.allowEditing&&"cellEditing"==G.editSettings.editMode&&l&&$form.length>0&&(l.blur(),r=W._moveCurrentCell("right")),G.allowSelection&&"cell"==G.selectionMode&&(W._focusingRowIndex!=W.getRows().length-1||W._cellIndex!=F-1)&&W._selectNextCell("right",t));break;case"downArrow":if(G.allowSelection)if(0==d.length&&0==c.length){if(W._isRowEdit||W.model.isEdit)return!0;if(Y.length>0&&G.selectedItem&&W.selectedRowIndex()>-1&&"row"==G.selectionMode)a=Y.length-1,W.selectedRowIndex()!=a&&(j=Y[W.selectedRowIndex()],n=X.indexOf(j),o=X[n+1],o&&o.isSummaryRow&&(o=W._getNextRecord(n+1,X)),n=Y.indexOf(o),o&&n<=a&&!W._rowSelectingEventTrigger(this.selectedRowIndex(),n)&&(W.selectRows(n),W.updateScrollBar(),W.element[0].focus(),W._rowSelectedEventTrigger(W.selectedRowIndex()))),W._cancelSaveTools();else if("cell"==G.selectionMode&&W.selectedCellIndexes().length>0){var V=W._focusingRowIndex+1,B=W._cellIndex,$=G.updatedRecords.length;W._isShiftKeyNavigation=!1,V<$&&(j=Y[W._rowIndexOfLastSelectedCell],n=X.indexOf(j),o=X[n+1],o&&o.isSummaryRow&&(o=W._getNextRecord(n+1,X),V=Y.indexOf(o)),o&&(S={rowIndex:V,cellIndex:B},W._focusingRowIndex=V,W.updateScrollBar(),W.selectCells([S])))}}else d.length?W._moveToNextMenuItem("next"):c.length&&(p?(O=u.find("div.e-columnmenuselection"),T=O.next("div.e-columnMenuListDiv"),T.length>0&&(O.removeClass("e-columnmenuselection"),T.addClass("e-columnmenuselection"))):(L=c.find("div.e-columnmenuselection"),T=W._findNextColumnMenuItem(L,"next"),T.length>0&&(L.removeClass("e-columnmenuselection"),T.addClass("e-columnmenuselection"))));break;case"rightArrow":if(G.allowSelection)if(0==d.length&&0==c.length){if(W._isRowEdit||W.model.isEdit)return!0;var q,V=W.selectedRowIndex(),C=Y[V],H={};H.data=C,H.recordIndex=V,H.expanded=!0,C&&C.hasChildRecords&&!C.expanded&&W.selectedRowIndex()>=0&&(q=W._trigger("expanding",H),q||G.isFromGantt||s.TreeGrid.sendExpandCollapseRequest(W,H),G.enableVirtualization&&W.element[0].focus(),W.updateScrollBar()),W._cancelSaveTools(),G.allowSelection&&"cell"==G.selectionMode&&(W._focusingRowIndex!=W.getRows().length-1||W._cellIndex!=F-1)&&W._selectNextCell("right",t)}else d.length&&!m?W._moveToNextMenuItem("expand"):c.length&&!p&&(L=c.find("div.e-columnmenuselection"),D=u.find("div.e-columnMenuListDiv"),columnListPosX=W._columnListPosX,columnChooserListIndex=W._columnChooserListIndex,windowWidth=e(document).width(),L.length>0&&L[0].id==W._id+"_ColumnsChooser"&&(I=e("#"+W._id+"ccDiv").ejDialog("instance"),k=e("#"+W._id+"ccDiv_wrapper").width(),I.open(),windowWidth=0&&(q=W._trigger("collapsing",H),q||G.isFromGantt||s.TreeGrid.sendExpandCollapseRequest(W,H),G.enableVirtualization&&W.element[0].focus(),W.updateScrollBar()),W._cancelSaveTools(),G.allowSelection&&"cell"==G.selectionMode&&(0!=W._focusingRowIndex||0!=W._cellIndex)&&W._selectNextCell("left",t)}else d.length?W._moveToNextMenuItem("collapse"):c.length&&p&&e("#"+W._id+"ccDiv").ejDialog("close");break;case"upArrow":if(G.allowSelection)if(0==d.length&&0==c.length){if(W._isRowEdit||W.model.isEdit)return!0;if("row"==G.selectionMode&&this.selectedRowIndex()>0&&Y.length>0&&G.selectedItem)j=Y[W.selectedRowIndex()],n=X.indexOf(j),o=X[n-1],o.isSummaryRow&&(o=W._getNextRecord(n-1,X,t)),n=Y.indexOf(o),W._rowSelectingEventTrigger(this.selectedRowIndex(),n)||(W.selectRows(n),W.updateScrollBar(),W.element[0].focus(),W._rowSelectedEventTrigger(W.selectedRowIndex())),W._cancelSaveTools();else if("cell"==G.selectionMode){var V=W._focusingRowIndex-1,B=W._cellIndex,$=G.flatRecords.length;W._isShiftKeyNavigation=!1,V!=-1&&(j=Y[W._rowIndexOfLastSelectedCell],n=X.indexOf(j),o=X[n-1],o&&o.isSummaryRow&&(o=W._getNextRecord(n-1,X,t),V=Y.indexOf(o)),o&&(S={rowIndex:V,cellIndex:B},W._focusingRowIndex=V,W.selectCells([S]),W.updateScrollBar()))}}else d.length?W._moveToNextMenuItem("prev"):c.length&&(p?(O=u.find("div.e-columnmenuselection"),R=O.prev("div.e-columnMenuListDiv"),R.length>0&&(O.removeClass("e-columnmenuselection"),R.addClass("e-columnmenuselection"))):(L=c.find("div.e-columnmenuselection"),R=W._findNextColumnMenuItem(L,"prev"),R.length>0&&(L.removeClass("e-columnmenuselection"),R.addClass("e-columnmenuselection"))));break;case"deleteRecord":if(G.editSettings.allowDeleting&&0==d.length&&0==c.length){if(W._isRowEdit||W.model.isEdit)return!0;W.selectedRowIndex()>=0&&(W.deleteRow(),W._cancelSaveTools(),W.element[0].focus())}break;case"totalRowCollapse":if(0==d.length&&0==c.length){W.model.isFromGantt?(H={},H.requestType="collapseAll",W._trigger("expandAllCollapseAllRequest",H)):W.collapseAll();break}case"totalRowExpand":0==d.length&&0==c.length&&(W.model.isFromGantt?(H={},H.requestType="expandAll",W._trigger("expandAllCollapseAllRequest",H)):W._expandAll());break;case"spaceBar":M=null,c.length&&p&&(O=u.find("div.e-columnmenuselection"),M=O.data("column"),s.isNullOrUndefined(M)||O.find("span").hasClass("e-disable")||(E=O.find("span").attr("aria-checked"),"true"==E?W.hideColumn(M):W.showColumn(M)));break;case"shiftDownArrow":if(G.allowSelection&&"cell"==G.selectionMode&&"multiple"==G.selectionType){var $=G.updatedRecords.length,A=W._selectedCellDetails.length,j=Y[W._rowIndexOfLastSelectedCell];if(n=X.indexOf(j),o=X[n+1],o&&o.isSummaryRow&&(o=W._getNextRecord(n+1,X)),!o)return;if(nextRowIndex=Y.indexOf(o),W._focusingRowIndex>W._rowIndexOfLastSelectedCell){for(W._rowIndexOfLastSelectedCell=nextRowIndex,W._selectedCellDetails.sort(function(e,t){return parseFloat(e.rowIndex)-parseFloat(t.rowIndex)}),W._getSelectedCellsinARow(W._selectedCellDetails[0].data.index,W._selectedCellDetails),N=0;N0&&W._focusingRowIndex=0&&(H={rowIndex:nextRowIndex,cellIndex:W._lastSelectedCellIndex},W._rowIndexOfLastSelectedCell=nextRowIndex,W.updateScrollBar(),W._shiftKeySelectCells(H))}break;case"shiftRightArrow":G.allowSelection&&"cell"==G.selectionMode&&"multiple"==G.selectionType&&(F=G.columns.length,B=W._lastSelectedCellIndex+1,B0?e(o[0]).length:e(o).length;if(null!=a.queryCellInfo||null!=a.rowDataBound||a.detailsDataBound)for(n;n0&&(s=e(s[1])),this._trigger("detailsDataBound",{detailsElement:s,data:i}))},_cellEventTrigger:function(e,t,i){var s={cellElement:e,data:t,column:i};s.cellValue=s.column&&t[s.column.field],this._trigger("queryCellInfo",s)},_completeAction:function(t){var i,a,n=this,o=n.model,r=o.sortSettings.sortedColumns;if(o.isEdit=!1,(s.TreeGrid.Actions.Paging==t.requestType||o.allowPaging)&&this._refreshGridPager(),s.TreeGrid.Actions.Sorting==t.requestType&&o.allowSorting||s.TreeGrid.Actions.Refresh==t.requestType){if(o.allowSorting)for(n._multiSortRequest||(n.getHeaderTable().find(".e-columnheader").find(".e-headercelldiv").find(".e-ascending,.e-descending").remove(),n.getHeaderTable().find("[aria-sort]").removeAttr("aria-sort")),i=0;i0?r._renderFrozenRecords():(r.getContentTable().find("colgroup").first().replaceWith(r._getMetaColGroup()),a=r.getContentTable().children("tbody"),a.empty(),i.innerHTML=["",e.render[r._id+"_Template"](r.model.currentViewData),"
    "].join(""),r.getContentTable().get(0).replaceChild(i.firstChild.firstChild,r.getContentTable().get(0).lastChild),r._gridRows=r.getContentTable().get(0).rows,r.setGridRows(e(r.getContentTable().get(0).rows))),this._gridRows=this.getContentTable().get(0).rows,this._frozenColumnsLength>0&&(this._gridRows=[this._gridRows,this.getContentTable().get(1).rows]),r._$gridContent&&r._isRendered&&(r._trigger("refresh"),r._eventBindings(),this._hideCollapsedDetailsRows())}else r._frozenColumnsLength>0?(n=s.buildTag("td",l.emptyRecordText,{},{colSpan:this._frozenColumns.length}),o=document,r.getContent().find("#e-frozencontentdiv"+r._id+" .e-table tbody").empty().append(e(o.createElement("tr")).append(n)),n=s.buildTag("td",l.emptyRecordText,{visibility:"hidden"},{colSpan:this._unFrozenColumns.length}),r.getContent().find("#e-movablecontentdiv"+r._id+" .e-table tbody").empty().append(e(o.createElement("tr")).append(n)),r._$gridContainer.find("#e-movablecontentdiv"+r._id+",#e-frozencontentdiv"+r._id).css("height","30px")):(r.getContentTable().find("tbody").empty().append(r._getEmptyTbody()),r._$gridContainer&&r._$gridContainer.css({height:"30px"})),r._gridRows=null,r.setGridRows(null);(r.model.showGridCellTooltip||r.model.showGridExpandCellTooltip)&&r._cellMouseLeave(),r._completeAction(t)},_renderFrozenRecords:function(){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]);var t=this.getContentTable().children("tbody");t.empty(),temp=document.createElement("div"),temp.innerHTML=["",e.render[this._id+"_JSONFrozenTemplate"](this.model.currentViewData),"
    "].join(""),this.getContentTable().get(0).replaceChild(temp.firstChild.firstChild,this.getContentTable().get(0).lastChild),temp=document.createElement("div"),temp.innerHTML=["",e.render[this._id+"_Template"](this.model.currentViewData),"
    "].join(""),this.getContentTable().get(1).replaceChild(temp.firstChild.firstChild,this.getContentTable().get(1).lastChild),this.setGridContentTable(this.getContent().find(".e-table"))},_renderByFrozenDesign:function(){var t=e(document.createElement("div")),i=this._getMetaColGroup().find("col"),a={};return a.colgroup1=t.append(s.buildTag("colgroup").append(i.splice(0,this._frozenColumnsLength))).html(),a.colgroup2=t.html(s.buildTag("colgroup").append(i)).html(),e.render[this._id+"_FrozenTemplate"](a)},addFrozenTemplate:function(){var t="
    {{:colgroup1}}
    {{:colgroup2}}
    ",i={};i[this._id+"_FrozenTemplate"]=t,e.templates(i)},sortSetting:function(t){var i,s=this;if(ascendingIcon=e("#"+s._id).find(".e-ascending.e-icon"),descendingIcon=e("#"+s._id).find(".e-descending.e-icon"),s.model.allowSorting=t,ascendingIcon.length>0)for(i=0;i0)for(i=0;i=0&&parseInt(e)=0&&o._isRendered&&o.selectedRowIndex(o._sortedRecords.indexOf(this.selectedItem())),o._clearColumnMenu()}},clearSorting:function(){var e,t=this,i=t.model;i.sortSettings.sortedColumns=[],e={},e.requestType=s.TreeGrid.Actions.Sorting,t.processBindings(e)},deleteRow:function(e,t,i){var a,n,o,r,l,d,h,c,u,m=this,p={},g=m.model,_=t?1:g.selectedItems.length,f=g.allowPaging?m._updatedPageData:g.updatedRecords;if(!g.editSettings.allowDeleting)return!1;for(m._isEmptyRow&&"cell"==g.selectionMode&&(_=1),n=0,o=0;o<_;o++){if(p.data=g.isFromGantt&&t?f[i]:"row"==g.selectionMode?g.selectedItems[o]:f[m._rowIndexOfLastSelectedCell],a=p.data,m.model.enableWBS&&(d=!1,a&&a.parentItem?(r=a.parentItem.childRecords,l=r.indexOf(a)):g.flatRecords.length&&(h=g.flatRecords,c=h.filter(function(e){return e&&0==e.level}),r=c,l=r.indexOf(a)),l!=r.length-1&&(d=!0)),g.flatRecords.indexOf(p.data)!=-1){if(p.requestType=s.TreeGrid.Actions.Delete,m._selectedCellDetails=[],m.processBindings(p))return!0;m.model.allowPaging&&m.updateHeight(),n++,g.currentViewData.length>0&&g.enableAltRow&&s.TreeGrid.updateAltRow(m,g.currentViewData[0],0,0)}d&&(a.parentItem?u=r[l]:(r.splice(l,1),u=r[l]),m.updateWBSdetails(u))}g.selectedItems=[],g.selectedCellIndexes=[],m._prevSelectedItems=null},updateWBSdetails:function(e){var t,i,s,a,n,o,r,l,d,h=this,c=h.model,u=e,m=u.WBS;u.parentItem?(t=u.parentItem.childRecords,i=t.indexOf(u),a=t,n=a.length):c.flatRecords.length&&(o=c.flatRecords,r=o.filter(function(e){return e&&0==e.level}),a=r,i=a.indexOf(u),n=a.length),s=a.slice(i,n),s.length&&(l=m.lastIndexOf(".")!=-1?parseInt(m.substr(m.lastIndexOf(".")+1)):parseInt(m),d=u.parentItem?u.parentItem.WBS:null,l--,h.reCalculateWBS(s,l,d))},reCalculateWBS:function(e,t,i){var s,a,n=this,o=n.model,r=o.currentViewData;if(i)for(a=0;a0){for(e=0,i=0;ih&&r.eq(h).width(35),l.length>h&&l.eq(h).width(35),o.showTotalSummary&&this._$totalSummaryRowContainer&&(t=e(this.getHeaderTable()).find("colgroup"),i=e(t).clone(),this._frozenColumnsLength>0?this._$footertableContent&&(e(this._$footertableContent).find("colgroup").remove(),e(i[0]).prependTo(this._$footertableContent[0]),e(i[1]).prependTo(this._$footertableContent[1])):this._$footertableContent&&(e(this._$footertableContent).find("colgroup").remove(),e(i).prependTo(this._$footertableContent))),this._frozenColumnsLength>0&&(a=this._getFrozenColumnWidth(),this.getContent().find("#e-movablecontainer"+this._id).css("margin-left",a+"px"),this.getContent().find("#e-frozencontainer"+this._id).outerWidth(a),this.getScrollElement().data("ejScroller")&&(this.getScrollElement().ejScroller("option","width",this._gridWidth-a-this._totalBorderWidth-1),this.getScrollElement().ejScroller("option","scrollTop",n._scrollTop),this.getScrollElement().ejScroller("option","scrollLeft",n._scrollLeft)),this.getHeaderContent().find("#e-frozenheaderdiv"+this._id).next().css("margin-left",a+"px"),this.getHeaderContent().find("#e-frozenheaderdiv"+this._id).outerWidth(a).end().find("#e-movableheaderdiv"+this._id).css("width","100%"),this._$totalSummaryRowContainer&&(this._$totalSummaryRowContainer.find("#e-frozenfooterdiv"+this._id).width(d).next().css("margin-left",a+"px"),this._$totalSummaryRowContainer.find("#e-frozenfooterdiv"+this._id).outerWidth(a).end().find("#e-movablefooterdiv"+this._id).css("width","100%"),"safari"==this.getBrowserDetails().browser&&this._$totalSummaryRowContainer.find("#e-movablefooter"+this._id).css("margin-left","auto")),"safari"==this.getBrowserDetails().browser&&this.getHeaderContent().find("#e-movableheader"+this._id).add(this.getContent().find("#e-movablecontainer"+this._id)).css("margin-left","auto"))},cellEdit:function(t,i){var a,n,o,r,l=this,d=l.model,h=t,c=d.allowPaging?l._updatedPageData:d.updatedRecords,u="row"==d.selectionMode?this.selectedItem():c[l._rowIndexOfLastSelectedCell];return l.model.showGridCellTooltip&&l._cellMouseLeave(),l.model.isEdit&&l.saveCell(),a=e("#"+l._id+"EditForm"),a.length>0||!!u&&((!d.isFromGantt||"status"!==i&&"startDate"!==i&&"endDate"!==i&&"duration"!==i&&"predecessor"!==i||!u.hasChildRecords)&&"baselineStartDate"!==i&&"baselineEndDate"!==i&&"taskId"!==i&&(d.enableVirtualization&&(h=c.indexOf(u),t=d.currentViewData.indexOf(u)),n=s.TreeGrid.getRowByIndex(this,h),n&&e(n).find(".e-rowcell").length>0?(o=e(n),columnIndex=l.getColumnIndexByField(i),$targetTd=o.find(".e-rowcell").eq(columnIndex),column=l.model.columns[columnIndex],data=u,beginEditArgs={},args={validationRules:s.isNullOrUndefined(column.validationRules)?{}:e.extend(!0,{},column.validationRules),columnName:column.field,value:s.isNullOrUndefined(data[i])?data.item&&data.item[i]:data[i],data:data,columnObject:column,cell:$targetTd},isEditable=!0,d.isFromGantt&&"predecessor"===args.columnName&&(r=args.data.item[l.model.predecessorMapping],args.value=r?r:""),beginEditArgs.data=data,beginEditArgs.columnIndex=columnIndex,beginEditArgs.rowElement=o,beginEditArgs.cellElement=$targetTd,l._cellEventTrigger(o[0].cells[l._cellEditingDetails.columnIndex],data,args.columnObject),!l._trigger("beginEdit",beginEditArgs)&&(o.hasClass("e-insertedrow")&&!args.columnObject.isTemplateColumn&&(isEditable=!0),isEditable&&e.extend(l._cellEditingDetails,{rowIndex:t,cellValue:args.value,columnIndex:columnIndex,fieldName:i,cellEditType:args.columnObject.editType,data:data}),l._renderCellEditObject(args,$targetTd),o.hasClass("e-templaterow")||o.addClass("e-editedrow"),args.cell&&args.cell.addClass("e-editedcell"),l._cellEditingDetails&&"dropdownedit"==l._cellEditingDetails.cellEditType&&l.element[0].focus(),l._updateHorizontalScrollBar(i),!0)):void 0))},_updateHorizontalScrollBar:function(t){var i,s,a=this,n=a.getScrollElement(),o=n.ejScroller("isHScroll");if(o){var r,l=a.model,d=l.columns,h=(d.length,a.getColumnIndexByField(t)),c=0,u=0,m=0,p=0,g=n.find(".e-content").width(),_=n.ejScroller("option","scrollLeft"),f=e("#"+a._id+"EditForm"),b=[];if("cell"==l.selectionMode&&0==f.length?b=e("#"+a._id).find(".selectingcell"):(r=e(f).closest("tr.e-treegridrows"),b=e(r).find("td.e-rowcell")),a._frozenColumnsLength>0&&h_+g)&&(p=u<_?_-(_-u)-3:_+(m-(_+g)+3),n.ejScroller("option",{scrollLeft:p}),a._updateHeaderScrollLeft(p))}},updateAllowColumnResize:function(e){var t=this,i=t.model;i.allowColumnResize=e,i.allowColumnResize&&(t._resizer=new s.gridFeatures.gridResize(t)),t._enableColumnResizeEvents()},_validatePredecessorString:function(e){var t,i=this;return!(e.length>0)||(e.split(",").forEach(function(e){values=e.split("+"),offsetvalue="+",e.indexOf("-")>=0&&(values=e.split("-"),offsetvalue="-"),match=values[0].match(/(\d+|[A-z]+)/g),i.model.ids.indexOf(match[0])!=-1?match[1]&&("FS"==match[1].toUpperCase()||"FF"==match[1].toUpperCase()||"SF"==match[1].toUpperCase()||"SS"==match[1].toUpperCase()||(t=!1)):t=!1}),!(t!==a&&!t))},saveCell:function(){var t,i,a,n,o,r,l,d,h,c=this,u=c.model;if(e("#"+c._id+"EditForm").length>0){if(!c.editFormValidate())return!0;if(c._cellEditingDetails.columnIndex>=0){c.element[0].focus();var m,p,g=e("#"+c._id+"EditForm"),_=s.TreeGrid.getRowByIndex(this,u.updatedRecords.indexOf(c._cellEditingDetails.data)),f=g.closest("td"),b={},v=u.columns[c._cellEditingDetails.columnIndex],x=e("#"+c._id+c._cellEditingDetails.fieldName);if(b={columnName:v.field,value:c.getCurrentEditCellData(),data:c._cellEditingDetails.data,previousValue:c._cellEditingDetails.cellValue,columnObject:v,cellElement:f,rowElement:_},("datetimepicker"==c._cellEditingDetails.cellEditType||"dropdownedit"==c._cellEditingDetails.cellEditType||"datepicker"==c._cellEditingDetails.cellEditType)&&x.data("ejWidgets")&&x[x.data("ejWidgets")[0]]("destroy"),s.isNullOrUndefined(v.format)?"boolean"==b.columnObject.type?(t={},t[b.columnObject.field]=b.value,b.cellElement.empty().html(e(e.templates.Grid_JSONTemplate.render(t))[0].cells[c._cellEditingDetails.columnIndex].innerHTML)):b.cellElement.empty().html(b.value):(m=c.formatting(v.format,b.value,u.locale),b.cellElement.empty().html(m)),i=("datepicker"==c._cellEditingDetails.cellEditType||"datetimepicker"==c._cellEditingDetails.cellEditType)&&b.value instanceof Date&&b.previousValue instanceof Date?b.value.getTime()!==b.previousValue.getTime():b.value!==b.previousValue,u.isEdit=!1,a=c._cellEditingDetails.fieldName,!u.isFromGantt&&u.idMapping&&u.parentIdMapping&&a==u.idMapping&&c._validateIdValue(b.value)&&(b.value=b.previousValue,i=!1),u.isFromGantt&&"predecessor"===a){n={},o=c._validatePredecessorString(b.value),o?(n.predecessorString=b.value.split(","),n.currentRecord=b.data,n.requestType="validatePredecessor",c._trigger("actionComplete",n),r=n.result,r||(b.value=b.previousValue)):b.value=b.previousValue,b.value=b.value.toUpperCase();var w,y,C=[],S=[],T=[],D=0;for(b.previousValue=b.data.predecessor,S=b.previousValue,b.value.length>0&&(T=b.data._calculatePredecessor(b.value)),w=T.length,l=0,d=b.previousValue&&b.previousValue.length,l=0;l0?(u.allowSelection||(b.data.isSelected=!1),p=c._cellEditingDetails.columnIndex0){for(t=o.split(","),i=0;i"),a=s.preferredCulture[a]?a:"en-US",n=t,o=t.split("{0:"),d=t.split("}"),r=o[0],l=d[1],"string"==typeof i&&e.isNumeric(i)&&(i=Number(i)),t.indexOf("{0:")!=-1?(h=new RegExp("\\{0(:([^\\}]+))?\\}","gm"),c=h.exec(t),null!=c&&null!=i?null!=r&&null!=l?r+s.format(i,c[2],a)+l:s.format(i,c[2],a):null!=i?i:""):null!=this.data&&null==this.data.Value?(e.each(this.data,function(e,t){n=n.replace(new RegExp("\\{"+e+"\\}","gm"),t)}),n):this.data.Value},getColumnIndexByField:function(e){var t=this,i=t.model.columns,s=i.length,a=0;for(a;a0?"#"+n._id+t:"#"+t);o.rules("add",i),a=e("#"+n._id+"EditForm").validate({onsubmit:!1}),s.isNullOrUndefined(i.required)||(a.settings.messages[t]={},a.settings.messages[t].required=s.TreeGrid.getColumnByField(n.model.columns,t).headerText+" is required")},getFieldNameByHeaderText:function(e){var t=this;return s.isNullOrUndefined(t._fieldColumnNames[e])?null:t._fieldColumnNames[e]},clearSelection:function(t){var i,t,a,n,o,r,l,d,h=this,c=h.model,u=c.allowPaging?h._updatedPageData:c.updatedRecords;if((this.selectedRowIndex()!=-1||this.selectedRowIndex()==-1&&h._previousIndex!=-1)&&(i=this._frozenColumnsLength?e(h.getRows()[0]).add(h.getRows()[1]):h.getRows(),!s.isNullOrUndefined(t))){if(s.TreeGrid.getRowByIndex(h,t).find(".e-selectionbackground").removeClass("e-selectionbackground").removeClass("e-active"),a=u[t])a.isSelected=!1;else if(i&&i.find(".e-rowcell,.e-detailsrowcell").removeClass("e-selectionbackground").removeClass("e-active"),n=new s.DataManager(c.flatRecords),o=new s.Query,o.search(!0,["isSelected"],s.FilterOperators.Equals,!0),r=n.executeLocal(o),l=r&&r.length,l>0)for(d=0,d=0;d0?(t=i._filteredRecords.indexOf(s[a]),t!=-1&&(++i._removedCount,s[a].hasChildRecords&&s[a].expanded&&i.getChildRecordsCount(s[a]))):(++i._removedCount,s[a].hasChildRecords&&s[a].expanded&&i.getChildRecordsCount(s[a]));return i._removedCount},getExpandStatus:function(e){var t=e.parentItem;return null==t||t.expanded!==!1&&(!t.parentItem||t.parentItem.expanded!==!1&&this.getExpandStatus(t.parentItem))},getColumnFieldNames:function(){var e=[],t=this.model.columns,i=0,s=t.length;for(i;i0)for(index=0;index=c._frozenColumnsLength?1:0,d=t[index].cellIndex>=c._frozenColumnsLength?t[index].cellIndex-c._frozenColumnsLength:t[index].cellIndex,a=c._frozenColumnsLength>0?m[l][r]:m[r],!s.isNullOrUndefined(o)&&s.isNullOrUndefined(a)&&(a=e(e.render[c._id+"_Template"](o))[0]),n=a.childNodes[d],t[index].cellIndex!=-1&&g[t[index].cellIndex].allowCellSelection&&g[t[index].cellIndex].visible&&!c._cellSelectingEventTrigger({rowIndex:t[index].rowIndex,cellIndex:t[index].cellIndex,rowElement:a,cellElement:n})&&(e(n).addClass("selectingcell"),h={rowIndex:t[index].rowIndex,cellIndex:t[index].cellIndex,cellElement:n,data:o},currentCellIndex=c._selectedCellDetails.map(function(e){return e.cellElement}).indexOf(n),currentCellIndex==-1&&(c._selectedCellDetails.push(h),u.selectedCellIndexes.push({rowIndex:h.rowIndex,cellIndex:h.cellIndex})),c._cellSelectedEventTrigger({rowIndex:t[index].rowIndex,cellIndex:t[index].cellIndex,rowElement:a,cellElement:n},c._previousSelectedCellDetails),c._previousSelectedCellDetails={rowElement:a,cellElement:n,cellIndex:t[index].cellIndex,rowIndex:t[index].rowIndex},c._updateHorizontalScrollBar(g[t[index].cellIndex].field))));0==c._isShiftKeyNavigation&&(c._shiftKeyFirstElementDetails.firstElementRowIndex=c._focusingRowIndex,c._shiftKeyFirstElementDetails.firstElementCellIndex=c._cellIndex,c._rowIndexOfLastSelectedCell=h?h.rowIndex:c._rowIndexOfLastSelectedCell,c._lastSelectedCellIndex=c._cellIndex)},selectRows:function(t,i){var a,n,o,r,l,d,h,c=this,u=c.model,m=c.getRows();if(("cell"!=u.selectionMode||t==-1)&&!s.TreeGrid.getRowByIndex(c,t).hasClass("e-summaryrow")){if((u.editSettings.allowEditing||u.editSettings.allowAdding)&&!c._isRowEdit&&"click"!=u.editSettings.beginEditAction&&e("#"+c._id+"EditForm").length>0&&c.endEdit())return void(m=c.getRows());if(this._frozenColumnsLength>0&&(m=e(c.getRows()[0])),s.isNullOrUndefined(i)||s.isNullOrUndefined(t)){switch(t=s.isNullOrUndefined(t)?i:t,u.selectionType){case s.TreeGrid.SelectionType.Multiple:if(c._multiSelectCtrlRequest){a=u.updatedRecords[t],n=e.inArray(a,u.selectedItems),c._prevSelectedItem=u.updatedRecords[t],n!=-1&&(c.clearSelection(t),u.selectedItems.splice(n,1),a.isSelected=!1,u.selectedItem=u.selectedItems.length>0?u.selectedItems[u.selectedItems.length-1]:null),n==-1&&(u.selectedItems.push(a),u.allowSelection&&s.TreeGrid.getRowByIndex(c,t).attr("aria-selected","true").find(".e-rowcell,.e-detailsrowcell").addClass(" e-selectionbackground e-active").attr("tabindex","0"),a.isSelected=!0,u.selectedItem=u.updatedRecords[t]);break}case s.TreeGrid.SelectionType.Single:c.clearSelection(-1),u.selectedItem=null,updatedRecords=u.allowPaging?c._updatedPageData:u.updatedRecords,t<=updatedRecords.length-1&&(t!=-1&&u.selectedItems.push(updatedRecords[t]),c._prevSelectedItem=updatedRecords[t],u.allowSelection&&s.TreeGrid.getRowByIndex(c,t).find(".e-rowcell,.e-detailsrowcell").addClass(" e-selectionbackground e-active"),updatedRecords[t]&&(updatedRecords[t].isSelected=!0,u.selectedItem=updatedRecords[t]),c._prevSelectedItem&&c._prevSelectedItem!=u.selectedItem&&(c._prevSelectedItem.isSelected=!1))}u.selectedItems.length&&u.selectedItems.indexOf(updatedRecords[t])!=-1?(c._prevSelectedItem=updatedRecords[t],this.selectedRowIndex()!=t&&this.selectedRowIndex(t)):0!=u.selectedItems.length||c._prevSelectedItem||this.selectedRowIndex()==-1?this.selectedRowIndex(u.updatedRecords.indexOf(u.selectedItems[u.selectedItems.length-1])):this.selectedRowIndex(-1)}else if(u.selectionType==s.TreeGrid.SelectionType.Multiple)for(c.clearSelection(-1),c.selectedRowIndex(t),u.selectedItem=u.updatedRecords[t],o=0,r=t-i<0?u.updatedRecords.slice(t,i+1):u.updatedRecords.slice(i,t+1),o;o0&&(s=a.closest("td.e-rowcell"),n=s.index()),n!=-1&&this._frozenColumnsLength>0&&a.closest(".e-movablecontentdiv").length>0&&(n+=this._frozenColumnsLength),n)},getRowIndex:function(t){var i,s=this,a=e(t.target),n=s.getRows(),o=-1;this.model;return a.closest(".e-gridcontainer").length>0&&(this._frozenColumnsLength>0&&(a.closest(".e-frozencontentdiv").length>0?n=e(n[0]):a.closest(".e-movablecontentdiv").length>0&&(n=e(n[1]))),o=n.index(a),o==-1&&(i=a.closest("tr"),o=n.index(i))),o},_cancelEditState:function(e){var t,i=this;s.isNullOrUndefined(e)||(s.isNullOrUndefined(e.target)||e.stopImmediatePropagation(),t=i.getScrollElement().ejScroller("option","scrollLeft"),headerScrollLeft=0,headerScrollLeft=this._frozenColumnsLength>0?i._$gridHeaderContainer.find("#e-movableheader"+this._id).scrollLeft():i._$gridHeaderContainer.scrollLeft(),t!=headerScrollLeft&&(i.getScrollElement().ejScroller("option","scrollLeft",headerScrollLeft),i.model.showTotalSummary&&i._$footerContainer&&(this._frozenColumnsLength>0?i._$footerContainer.find("#e-movablefooter"+this._id).scrollLeft(headerScrollLeft):i._$footerContainer.scrollLeft(headerScrollLeft)))),i.model.isEdit?i.cancelEditCell():i._isRowEdit&&i.cancelRowEditCell()},cancelEditCell:function(){var t,i,s=this,a=s.model,n=s.model.selectedItem,o=s._cellEditingDetails.columnIndex,r={},l=a.columns[o];return!(!a.isFromGantt||a.isEdit)||(r={columnName:l.field,value:s.getCurrentEditCellData(),data:s._cellEditingDetails.data,previousValue:s._cellEditingDetails.cellValue,columnObject:l},this._frozenColumnsLength>0?this._frozenColumnsLength<=s._cellEditingDetails.columnIndex?(o=s._cellEditingDetails.columnIndex-this._frozenColumnsLength,t=e(s.getRows()[1])[s._cellEditingDetails.rowIndex],e(t).hasClass("e-editedrow")&&e(t).removeClass("e-editedrow"),i=t.cells[o],e(i).removeClass("e-editedcell").empty().html(e(e.render[s._id+"_Template"](n))[0].cells[o].innerHTML)):(t=e(s.getRows()[0])[s._cellEditingDetails.rowIndex],e(t).hasClass("e-editedrow")&&e(t).removeClass("e-editedrow"),i=t.cells[o],e(i).removeClass("e-editedcell").empty().html(e(e.render[s._id+"_JSONFrozenTemplate"](n))[0].cells[o].innerHTML)):(t=e(s.getRows())[s._cellEditingDetails.rowIndex],e(t).hasClass("e-editedrow")&&e(t).removeClass("e-editedrow"),i=t.cells[o],e(i).removeClass("e-editedcell").empty().html(e(e.render[s._id+"_Template"](n))[0].cells[o].innerHTML)),s._cellEventTrigger(e(i)[0],r.data,r.columnObject),s.model.isEdit=!1,s._cancelSaveTools(),void s._trigger("refresh"))},_destroyWidgetElements:function(){var t,s=this,a=this.model,n=a.columns,o=n.length;for(i=0;i0&&this._destroyWidgetElements(),t=e(o.closest("tr")),i=r.closest("tr"),rowIndex=s.getIndexByRow(t),data=a.currentViewData[rowIndex],(rowIndex!=-1||0!=o.length)&&(t.hasClass("e-addedrow")&&(s.model.editSettings.allowDeleting||(s.model.editSettings.allowDeleting=!0)),t.hasClass("e-editedrow")?(t.removeClass("e-editedrow").empty().html(e(e.render[s._id+"_Template"](data))[0].innerHTML),i.length>0&&i.removeClass("e-editedrow").empty().html(e(e.render[s._id+"_JSONFrozenTemplate"](data))[0].innerHTML)):t.hasClass("e-rowedit")?(t.removeClass("e-rowedit").empty().html(e(e.render[s._id+"_Template"](data))[0].innerHTML),i.length>0&&i.removeClass("e-rowedit").empty().html(e(e.render[s._id+"_JSONFrozenTemplate"](data))[0].innerHTML)):t.hasClass("e-addedrow")&&(s._isRefreshAddedRecord=!1,s._isEmptyRow=!0,s.deleteRow(),s._isEmptyRow=!1),a.isEdit=s._isRowEdit=!1,a.editSettings.allowDeleting=n,s._cancelSaveTools(),s._trigger("refresh"))},refreshRow:function(t){var i=this,a=i.model,n=a.updatedRecords[t],o=i.getIndexByRow(e("#"+i._id+"EditForm").closest("tr"));a.enableVirtualization&&(t=a.currentViewData.indexOf(n)),n&&t>-1&&(s.TreeGrid.refreshRow(this,t),o==t&&(i._isRowEdit=i.model.isEdit=!1,i._cancelSaveTools()))},_refreshDetailsRow:function(t){var i,s,a=this,n=this.model,o=a.model.currentViewData[t],r={};o&&(r=e(this._frozenColumnsLength>0?a.getRows()[1]:a.getRows()),i=e(r[t]).next("tr"),i.hasClass("e-detailsrow")&&(i.remove(),s=e(e.render[a._id+"_detailRowTemplate"](o)),e(r[t]).after(s),a.setGridRows(e(a.getContentTable().get(0).rows)),this._gridRows=this.getContentTable().get(0).rows,this._frozenColumnsLength>0&&(this._gridRows=[this._gridRows,this.getContentTable().get(1).rows]),a._trigger("refresh"),n.detailsDataBound&&this._trigger("detailsDataBound",{detailsElement:s,data:o})))},_refreshedCellEventTrigger:function(t){var i,s=this,a=this.model;if(null!=a.queryCellInfo||null!=a.rowDataBound||null!=a.detailsDataBound){null!=a.rowDataBound&&s._trigger("rowDataBound",{rowElement:t.rowElement,data:t.data});var n=t.rowElement.cells,o=e(t.rowElement).find(".e-rowcell"),r=0,l=n.length,d=null,h=s.model.columns;if(null!=a.queryCellInfo)for(r;r0&&(i=e(i[1])),this._trigger("detailsDataBound",{detailsElement:e(t.rowElement).next("tr"),data:t.data}))}},_refreshGridPager:function(){if(null!=this.getPager()){var e=this,t=e.model,i=this.getPager().ejPager("model"),s={};if(s.currentPage=this._currentPage(),0==t.currentViewData.length&&t.updatedRecords.length>0&&1!=i.totalPages)return void e.gotoPage(s.currentPage-1);s.totalRecordsCount=e._gridRecordsCount,this.getPager().ejPager("option",s).ejPager("refreshPager"),i=this.getPager().ejPager("model"),t.pageSettings.totalPages=i.totalPages,t.pageSettings.totalRecordsCount=i.totalRecordsCount}},_getVisibleChildRecordCount:function(e,t,i){var s,a,n,o=this;this.model;if(e.hasChildRecords)for(s=e.childRecords,a=s.length,n=0;n0;m&&(c=e(h.getRows()[1]),n=e(h.getRows()[0]),a=e.render[this._id+"_JSONFrozenTemplate"](i)),!s.isNullOrUndefined(c)&&c.length>0?c.length==t?(o=c.eq(t-1),m&&(r=n.eq(t-1)),e(o).next("tr").hasClass("e-detailsrow")?(e(o).next("tr").after(u),m&&e(r).next("tr").after(a)):(e(o).after(u),m&&e(r).after(a))):(c.eq(t).before(u),m&&n.eq(t).before(a)):this._frozenColumnsLength>0?h._renderFrozenRecords():(h.getContentTable().find("tbody").empty().append(h._getEmptyTbody()),l=document.createElement("div"),h.getContentTable().find("colgroup").first().replaceWith(h._getMetaColGroup()),d=h.getContentTable().children("tbody"),d.empty(),l.innerHTML=["",e.render[h._id+"_Template"](h.model.currentViewData),"
    "].join(""),h.getContentTable().get(0).replaceChild(l.firstChild.firstChild,h.getContentTable().get(0).lastChild)),this._gridRows=this.getContentTable().get(0).rows,this._frozenColumnsLength>0&&(this._gridRows=[this._gridRows,this.getContentTable().get(1).rows]),h.setGridRows(e(h.getContentTable().get(0).rows))},onScrollHelper:function(e){var t,i=this;i.getScrollElement().ejScroller("scrollY",e,!0),t=i.getScrollElement().ejScroller("isHScroll"),!t&&this.model.isFromGantt&&i.getScrollElement().scrollTop(e)},isVScroll:function(){return!!this.getScrollElement().hasClass("e-scroller")&&this.getScrollElement().ejScroller("isVScroll")},refreshScroller:function(e){var t,i,s,a,n=this;n._$gridContent.removeClass("e-borderbox"),t=n.getScrollElement().ejScroller("option","scrollTop"),i=n.getScrollElement().ejScroller("option","scrollLeft"),n.getScrollElement().ejScroller("option",{persist:!0}),n.getScrollElement().ejScroller("option",{width:e}),s=n.getMaxScrollWidth(),i>s&&(i=s>0?s:0),n._$gridContent.css("height",n._viewPortHeight),n.getScrollElement().ejScroller("refresh"),a=n.getScrollElement().ejScroller("isHScroll"),n.model.isFromGantt&&(a?n._$gridContent.removeClass("e-borderbox"):n._$gridContent.addClass("e-borderbox")),n.getScrollElement().ejScroller("option",{scrollTop:t}),n.getScrollElement().ejScroller("option",{scrollLeft:i}),n._$gridHeaderContainer.scrollLeft(i),a?this.getScrollElement().scrollTop(0):this.getScrollElement().scrollTop(t)},getMaxScrollHeight:function(){var e=this;return e.getScrollElement().children(".e-content").children().height()-this.getScrollElement().children(".e-content").height()},getMaxScrollWidth:function(){var e=this;return e.getScrollElement().children(".e-content").children(".e-gridcontainer").children(".e-table").width()-this.getScrollElement().children(".e-content").width()},refreshHeight:function(){var e=this;e.getScrollElement().ejScroller("refresh")},getColumnByHeaderText:function(e){for(var t=this,i=t.model.columns.length,s=t.model.columns,a=0;a0?u0&&(n=parseInt(e(d.getTreeGridRows()[0]).find(".e-detailscellwrapper").parent(".e-detailsrowcell").attr("colspan")),e(d.getTreeGridRows()[0]).find(".e-detailscellwrapper").parent(".e-detailsrowcell").attr("colspan",n-1))):(g=e(d.getRows()[1]),p=e(p[1]),_=!1,f=u-this._frozenColumnsLength,d._gridRows&&e(d.getTreeGridRows()[1]).find(".e-detailscellwrapper").parent(".e-detailsrowcell").length>0&&(n=parseInt(e(d.getTreeGridRows()[1]).find(".e-detailscellwrapper").parent(".e-detailsrowcell").attr("colspan")),e(d.getTreeGridRows()[1]).find(".e-detailscellwrapper").parent(".e-detailsrowcell").attr("colspan",n-1))):d._gridRows&&e(d.getTreeGridRows()).find(".e-detailscellwrapper").parent(".e-detailsrowcell").length>0&&(n=parseInt(e(d.getTreeGridRows()).find(".e-detailscellwrapper").parent(".e-detailsrowcell").attr("colspan")),e(d.getTreeGridRows()).find(".e-detailscellwrapper").parent(".e-detailsrowcell").attr("colspan",n-1)),g.each(function(){var t=e(this).children("td").eq(f);e(t).addClass("e-hide"),h.showSummaryRow&&e(t).hasClass("e-summaryrowcell")&&_&&d._updateSummaryRowTitleCell(i,t[0].parentElement)}),h.showTotalSummary&&(o=d._$footertableContent.find("colgroup").find("col"),e(o).eq(u).hide(),p.each(function(){var t=e(this).children("td").eq(f);e(t).addClass("e-hide"),e(t).hasClass("e-footersummaryrowcell")&&d._updateSummaryRowTitleCell(o,t[0].parentElement)})),d.getHeaderTable().addClass("e-table"),d.getContentTable().addClass("e-table"),r=d.getScrollElement(),h.isFromGantt&&(l=r.ejScroller("isHScroll"),l?r.removeClass("e-borderbox"):r.addClass("e-borderbox")),r.ejScroller("refresh"),d._updateScrollCss(),d._updateHeaderScrollLeft(),h.isFromGantt&&!r.ejScroller("isHScroll")&&r.scrollTop(r.data("ejScroller").scrollTop()),u=e.inArray(t,d._visibleColumns),u!=-1&&d._visibleColumns.splice(u,1),h.showColumnChooser&&(d._renderColumnChooserList(!0,t),d._updateColumnMenuVisibility()),d._addInitTemplate()}h.isFromGantt&&d.updateToGanttColumns()}},clearFilter:function(t){var i,a,n,o,r=this,l=r.model;if(s.isNullOrUndefined(t))for(i=l.filterSettings.filteredColumns,a=i&&i.length;i&&i.length>0;)r.clearFilter(i[0].field);else n=r.getColumnByField(t),o=e.grep(l.filterSettings.filteredColumns,function(e){return e.field===t}),n&&o.length>0&&("immediate"==l.filterBarMode&&"numericedit"==n.filterEditType||(r._searchString="",r._fieldName="",r.filterColumn(t,"equal","","and")),r._clearFilterElementValue(n))},getColumnByField:function(e){for(var t=this,i=t.model,s=i.columns,a=0;a0?u0&&(n=parseInt(e(d.getTreeGridRows()[0]).find(".e-detailscellwrapper").parent(".e-detailsrowcell").attr("colspan")),e(d.getTreeGridRows()[0]).find(".e-detailscellwrapper").parent(".e-detailsrowcell").attr("colspan",n+1))):(g=e(d.getRows()[1]),p=e(p[1]),_=!1,f=u-this._frozenColumnsLength,d._gridRows&&e(d.getTreeGridRows()[1]).find(".e-detailscellwrapper").parent(".e-detailsrowcell").length>0&&(n=parseInt(e(d.getTreeGridRows()[1]).find(".e-detailscellwrapper").parent(".e-detailsrowcell").attr("colspan")),e(d.getTreeGridRows()[1]).find(".e-detailscellwrapper").parent(".e-detailsrowcell").attr("colspan",n+1))):d._gridRows&&e(d.getTreeGridRows()).find(".e-detailscellwrapper").parent(".e-detailsrowcell").length>0&&(n=parseInt(e(d.getTreeGridRows()).find(".e-detailscellwrapper").parent(".e-detailsrowcell").attr("colspan")), e(d.getTreeGridRows()).find(".e-detailscellwrapper").parent(".e-detailsrowcell").attr("colspan",n+1)),g.each(function(){var t=e(this).children("td").eq(f);e(t).removeClass("e-hide"),h.showSummaryRow&&e(t).hasClass("e-summaryrowcell")&&_&&d._updateSummaryRowTitleCell(i,t[0].parentElement)}),h.showTotalSummary&&(o=d._$footertableContent.find("colgroup").find("col"),e(o).eq(u).show(),p.each(function(){var t=e(this).children("td").eq(f);e(t).removeClass("e-hide"),e(t).hasClass("e-footersummaryrowcell")&&d._updateSummaryRowTitleCell(o,t[0].parentElement)})),d._addInitTemplate(),r=d.getScrollElement(),h.isFromGantt&&(l=r.ejScroller("isHScroll"),l?r.removeClass("e-borderbox"):r.addClass("e-borderbox")),r.ejScroller("refresh"),d._updateScrollCss(),d._updateHeaderScrollLeft(),h.isFromGantt&&!r.ejScroller("isHScroll")&&r.scrollTop(r.data("ejScroller").scrollTop()),u=e.inArray(t,d._hiddenColumns),u!=-1&&d._hiddenColumns.splice(u,1),h.showColumnChooser&&(d._renderColumnChooserList(!0,t),d._updateColumnMenuVisibility())}h.isFromGantt&&d.updateToGanttColumns()},getHiddenColumns:function(){for(var e=this,t=(e.model,e._hiddenColumns),i=t.length,s=[],a=0;ae?s[e]:null},getVisibleColumns:function(){for(var e=this,t=(e.model,e._visibleColumns),i=t.length,s=[],a=0;a=this._gridRecordsCount?(d=this._gridRecordsCount-1,n=r.length):n=r.indexOf(l[d]),h>d&&(h=d-e),o=r.indexOf(l[h]),t._updatedPageData=this.getExpandedRecords(r.slice(o,n))}else a=this.getExpandedRecords(r),t._gridRecordsCount=i.enableVirtualization?r.length:a.length,n=t._currentPage()*e>t._gridRecordsCount?t._gridRecordsCount:t._currentPage()*e,o=t._currentPage()*e-e,o>n&&(o=n-e),t._updatedPageData=a.slice(o,n)},_updateCurrentViewData:function(){var e,t=this,i=t.model,a={},n=!1;i.enableVirtualization?(i.allowPaging?(t._updatePagerIndex(),t.getVisibleRange(),i.currentViewData=i.sizeSettings.height?t._updatedPageData.slice(t._visibleRange.top,t._visibleRange.bottom):t._updatedPageData):(t.getVisibleRange(),i.currentViewData=t.model.updatedRecords.slice(t._visibleRange.top,t._visibleRange.bottom)),0!==t._vScrollDist&&(e=t._scrollTop-t._offset,(t._prevRTop-t._visibleRange.top!=0||t._prevRBottom-t._visibleRange.bottom!=0)&&(a.requestType=s.TreeGrid.Actions.Refresh,t.sendDataRenderingRequest(a),n=!0),this._frozenColumnsLength>0?(t._$frozenTableContent.css({top:e}),t._$movableTableContent.css({top:e})):t._$tableContent.css({top:e}),t._prevRTop=t._visibleRange.top,t._prevRBottom=t._visibleRange.bottom)):i.allowPaging?(t._updatePagerIndex(),i.currentViewData=t._updatedPageData):i.currentViewData=t.model.updatedRecords.slice(),t._isEnterKeyPressed&&(t._isEnterKeyPressed=!1,i.allowSelection&&i.editSettings.allowEditing&&(n||(t._cellEditingDetails.rowIndex+=1),t._rowSelectingEventTrigger(this.selectedRowIndex(),t._cellEditingDetails.rowIndex)||(t.selectRows(t._cellEditingDetails.rowIndex),t._rowSelectedEventTrigger(t._cellEditingDetails.rowIndex)),t.cellEdit(t._cellEditingDetails.rowIndex,t.model.columns[t._cellEditingDetails.columnIndex].field)))},_getRowPosition:function(e){return Math.ceil(e/(this.model.rowHeight+this._detailsRowHeight))},_getMetaColGroup:function(){return this.getHeaderTable().find("colgroup").clone()},_getEmptyTbody:function(){var t=this,i=s.buildTag("td",t.model.emptyRecordText,{},{colSpan:t.model.columns.length});return e(document.createElement("tr")).append(i)},_addSortElementToColumn:function(t,i){var a=this,n=(this.model,s.TreeGrid.getColumnByField(a.model.columns,t)),o=e.inArray(n,a.model.columns),r=a.getHeaderTable().find("thead").find(".e-headercell").eq(o).find(".e-headercelldiv");r.find(".e-ascending,.e-descending").remove(),r.append(a._createSortElement().addClass("e-"+i).addClass("e-icon")),r.parent().attr("aria-sort",i)},_createSortElement:function(){return s.buildTag("span"," ")},_renderCellEditObject:function(t,i){var a,n,o,r=this,l=s.buildTag("form.#"+r._id+"EditForm","",{},{}),d=r._cellEditTemplate,h={},c=t.columnObject;o=t.value,"dropdownedit"==c.editType&&0==o&&(o=o.toString()),h[c.field]=o,columnIndex=r.getColumnIndexByField(c.field),columnIndex===r.model.treeColumnIndex?i.find(".e-cell").empty():i.empty(),n=d.find("#"+c.field+"_CellEdit").html(),a=e("predecessor"===c.field?e.templates(n).render(t.data):e.templates(n).render(h)),"SELECT"==a.get(0).tagName&&(a.val(h[c.field]),null==a.val()&&a.val(a.find("option").first().val())),l.append(a),columnIndex===r.model.treeColumnIndex?i.find(".e-cell").append(l):i.append(l),r._setoffsetWidth(),r._refreshEditForm(),e.isFunction(e.validator)&&!e.isEmptyObject(t.validationRules)&&(r._initValidator(),r.setValidationToField(c.field,t.validationRules)),r.model.isEdit=!0},_setoffsetWidth:function(){var t,i,s,a=this,n=a.model,o=e("#"+a._id+"EditForm"),r=e("#"+a._id+"EditFrozenForm"),l=0,d=a._cellEditingDetails.rowIndex;for(t="cellediting"!=n.editSettings.editMode.toLowerCase()||a._isRowEdit?r.add(o).find("tr").find(".e-rowcell"):o.closest("td"),i=t.length,l;l1?0==n.currentViewData[d].level&&n.currentViewData[d].hasChildRecords?t.get(l).offsetWidth-s[0].offsetWidth-s[2].offsetWidth:t.get(l).offsetWidth-s[0].offsetWidth-s[1].offsetWidth:t.get(l).offsetWidth},getIndexofresourceInfo:function(e){var t=this,i=t._cellEditingDetails.data,s=i.resourceInfo,a=0,n=s&&s.length,o=[];for(a;a0&&(l=new RegExp("\\{0(:([^\\}]+))?\\}","gm"),d=l.exec(r.format),D.dateFormat=d[2],t.val().length&&(D.value=s.format(new Date(t.val()),D.dateFormat),t.val(D.value))),s.isNullOrUndefined(r.editParams)||e.extend(D,r.editParams),T.dateFormat.indexOf("hh")==-1?t.ejDatePicker(D):t.ejDateTimePicker(D);break;case s.TreeGrid.EditingType.DateTimePicker:D={},D.width=i,D.height=I-5,D.locale=T.locale,D.cssClass=T.cssClass,D.displayDefaultDate=!0,D.dateTimeFormat=T.dateFormat,D.enableStrictMode=!0,D.change=function(e){this.option("value",e.value)},t.val().length&&(D.value=f.getDateFromFormat(t.val())),r.format!==a&&r.format.length>0&&(l=new RegExp("\\{0(:([^\\}]+))?\\}","gm"),d=l.exec(r.format),D.dateTimeFormat=d[2],D.value=s.format(new Date(t.val()),D.dateTimeFormat),t.val(D.value)),s.isNullOrUndefined(r.editParams)||e.extend(D,r.editParams),t.ejDateTimePicker(D);break;case s.TreeGrid.EditingType.Dropdown:f._isRowEdit?(c=r.dropdownData,u=r.field):(c=r.dropdownData,u=r.field),T.isFromGantt&&"resourceInfo"===u?t.ejDropDownList({width:i+"px",height:I-5,showCheckbox:!0,dataSource:c,fields:{id:T.resourceIdMapping,text:T.resourceNameMapping,value:T.resourceNameMapping},selectedItems:f.getIndexofresourceInfo(c)}):(_={},_.cssClass=T.cssClass,_.width=i,_.height=I-5,_.dataSource=c,s.isNullOrUndefined(r.editParams)||e.extend(_,r.editParams),t.ejDropDownList(_),m=t.ejDropDownList("instance"),m._setValue(t.attr("cellValue")));break;case s.TreeGrid.EditingType.String:t.outerWidth(i).height(T.rowHeight-9);break;case s.TreeGrid.EditingType.Boolean:_={},_.cssClass=T.cssClass,_.size="small",s.isNullOrUndefined(r.editParams)||e.extend(_,r.editParams),t.ejCheckBox(_),p=t.parent(".e-chkbox-wrap"),g=p.parent("form"),g.length>0?g.css("margin-left","45%"):p.css("margin-left","45%");break;case s.TreeGrid.EditingType.Maskedit:_={},_.locale=T.locale,_.cssClass=T.cssClass,_.width=i,_.height=I-5,s.isNullOrUndefined(r.editParams)||e.extend(_,r.editParams),t.ejMaskEdit(_)}t.is(":disabled")||x||t.is(":hidden")&&"object"!=typeof(t.data("ejDropDownList")||t.data("ejNumericTextbox")||t.data("ejDatePicker")||t.data("ejCheckBox"))||f._isEnterKeyPressed||(f._focusElements(t.closest("td")),x=!0)}},_initValidator:function(){var t=this;e("#"+t._id+"EditForm").validate({onclick:!1,onfocusout:!1,errorClass:"e-field-validation-error",errorElement:"div",wrapper:"div",errorPlacement:function(i,a){var n=a.closest("td"),o=e(i).addClass("e-error"),r=s.buildTag("div.e-errortail e-toparrow");n.find(".e-error").remove(),a.hasClass("e-numerictextbox")?o.insertAfter(a.closest(".e-numeric")):o.insertAfter(a),o.prepend(r),"normal"!=t.model.editSettings.editMode&&o.offset({left:a.offset().left}),o.fadeIn("slow")}})},_focusElements:function(e){var t,i,s,a=this;e.length&&(e.focus(),t=e.children(),t[0]&&("select"==t[0].tagName.toLowerCase()||"input"==t[0].tagName.toLowerCase()?(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("input,select").select().focus())),i=a.getScrollElement().children(".e-content").scrollLeft(),s=a.getScrollElement().ejScroller("option","scrollLeft"),a.getScrollElement().hasClass("e-scroller")&&i!=s&&a.getScrollElement().ejScroller("option","scrollLeft",i),a._updateHeaderScrollLeft(a.getScrollElement().children(".e-content").scrollLeft())},_focusElementsForRowEdit:function(e){if(e.length){var t=e.children();"select"==t[0].tagName.toLowerCase()||"input"==t[0].tagName.toLowerCase()?(t.focus().select(),t[0].focus()):t.find(".e-field.e-dropdownlist").length?t[0].focus():t.find("input:visible,select").first().select().focus()}},updateHeight:function(){var e=this,t=this.model,i=0,s=0;e._$gridContainer&&e._$gridContent&&(i=t.allowPaging?t.rowHeight*e._updatedPageData.length:t.enableVirtualization?t.updatedRecords.length*t.rowHeight:t.rowHeight*(t.updatedRecords.length-e.getCollapsedRecordCount()),t.showDetailsRow&&t.detailsTemplate&&!t.showDetailsRowInfoColumn&&(s=e._getExpandedDetailsRowHeight()),i+=s,0==i&&(0==t.currentViewData.length||0==t.flatRecords.length)&&(i=30),t.allowPaging&&!t.sizeSettings.height&&(e._viewPortHeight=i,e._gridHeight=i+e._getNonContentHeight(),e._summaryRowsCount>0&&t.showTotalSummary&&(e._gridHeight+=t.rowHeight),e.element.height(e._gridHeight),this._frozenColumnsLength>0?e._$gridContent.css("height",i):e.getScrollElement().ejScroller({height:i})),e._$gridContainer.css({height:i+"px",width:"auto"}),this._frozenColumnsLength&&e._$gridContainer.find("#e-movablecontentdiv"+e._id+",#e-frozencontentdiv"+e._id).css("height",i+"px"),e.getScrollElement().hasClass("e-scroller")&&(e.getScrollElement().ejScroller("refresh"),e._updateScrollCss()))},_setScrollTop:function(){var t=this,i=this.model,s=0,a=t._scrollTop,n=i.rowHeight,o=i.currentViewData.length,r=e(document).find(".e-ganttviewerbodyContianer");i.showDetailsRow&&i.detailsTemplate&&!i.showDetailsRowInfoColumn&&(n+=t._detailsRowHeight),i.allowPaging&&t._isNextPage&&(a=0,t._isNextPage=!1,t.getScrollElement().ejScroller("scrollY",a,!0)),0!==a&&(i.enableVirtualization?o*n0&&(s=a-(t._viewPortHeight-(o-1)*n),s<0&&(s=0)),i.isFromGantt?r.ejScroller("scrollY",s,!0):t.getScrollElement().ejScroller("scrollY",s,!0)):i.isFromGantt?r.ejScroller("scrollY",a,!0):t.getScrollElement().ejScroller("scrollY",a,!0))},getChildCount:function(e,t){var i,s,a=this;if(!e.hasChildRecords)return 0;for(s=0;s0&&(i.hasFilteredChildRecords=!!this._checkChildExsist(i,t)),i.parentItem&&(i.parentItem.hasFilteredChildRecords=!0))},_checkChildExsist:function(t,i){for(var s=t.childRecords,a=s.length,n=!1,o=0;o=0;o--)h._queryManagar.sortBy(c[o].field,c[o].direction);if(t.hasChildRecords)for(r=s.DataManager(t.childRecords),a=r.executeLocal(h._queryManagar).result,n=a.length,l=0;l=0;t--)i=l[t].field,r.isFromGantt&&("resourceInfo"===i?i="resourceNames":"predecessor"===i&&(i="predecessorsName")),o._queryManagar.sortBy(i,l[t].direction);return a=new s.DataManager(r.parentRecords),n=a.executeLocal(o._queryManagar).result,o._sortedRecords=[],o._storedIndex=-1,o._rowIndex=-1,o._createSortedRecords(n),o._tempsortedrecords=o._sortedRecords,o.model.updatedRecords=o._sortedRecords,r.allowPaging&&r.pageSettings.pageSizeMode===s.TreeGrid.PageSizeMode.Root&&(r.parentRecords=o._getParentRecords(o.model.updatedRecords,o,!0)),!0},_createSortedRecords:function(t){var i,a=this,n=a.model,o=a._sortedRecords,r=a.model.enableAltRow,n=this.model;t=e(t).not(n.summaryRowRecords).get(),e.each(t,function(t,l){var d,h;return l.isSummaryRow?(d=l.parentItem.childRecords.indexOf(l),void l.parentItem.childRecords.splice(d,1)):(a._searchString.length>0||n.filterSettings.filteredColumns.length>0?a._filteredRecords.length>0&&a._filteredRecords.indexOf(l)!==-1&&(a._storedIndex++,a._rowIndex++,r&&(l.isAltRow=a._rowIndex%2!=0),o[a._storedIndex]=l):(a._storedIndex++,a._rowIndex++,r&&(l.isAltRow=a._rowIndex%2!=0),o[a._storedIndex]=l),void(l.hasChildRecords&&l.expanded?(l.childRecords=e(l.childRecords).not(n.summaryRowRecords).get(),i=s.DataManager(l.childRecords),h=i.executeLocal(a._queryManagar).result,a._createSortedRecords(h)):!l.hasChildRecords||l.expanded||n.enableVirtualization||(l.childRecords=e(l.childRecords).not(n.summaryRowRecords).get(),a._setChildRecords(l,o))))})},_setChildRecords:function(e,t){var i,a,n=this,o=n.model,r=n.model.enableAltRow,l=e.childRecords.length;for(dataManager=s.DataManager(e.childRecords),i=dataManager.executeLocal(n._queryManagar).result,a=0;a0||o.filterSettings.filteredColumns.length>0?n._filteredRecords.length>0&&n._filteredRecords.indexOf(i[a])!==-1&&(n._storedIndex++,r&&(i[a].isAltRow=n._storedIndex%2!=0),t[n._storedIndex]=i[a],i[a].hasChildRecords&&this._setChildRecords(i[a],t)):(n._storedIndex++,r&&(i[a].isAltRow=n._storedIndex%2!=0),t[n._storedIndex]=i[a],i[a].hasChildRecords&&this._setChildRecords(i[a],t))},_updateSortedRecords:function(t){var i,a,n,o=this,r=0,l=t.length,d=this.model;for(r;r0?e.inArray(i,o._filteredRecords)!==-1&&e.inArray(i,o._sortedRecords)===-1&&o._sortedRecords.push(i):e.inArray(i,o._sortedRecords)===-1&&o._sortedRecords.push(i),i.hasChildRecords&&i.childRecords.length>0&&(a=s.DataManager(i.childRecords),n=a.executeLocal(o._queryManagar).result,o._updateSortedRecords(n)))},_removeSortElementFromColumn:function(t){var i=this,a=s.TreeGrid.getColumnByField(i.model.columns,t),n=e.inArray(a,i.model.columns),o=i.getHeaderTable().find("thead").find(".e-headercell").eq(n).find(".e-headercelldiv");o.find(".ascending,.descending").remove(),o.parent().removeAttr("aria-sort")},_addEmptyColumntoGrid:function(){var t=this;e(t.element).find(".e-gridheadercontainer table colgroup").append(s.buildTag("col","",{width:"auto"},{})),e(t.element).find(".e-gridheadercontainer table thead tr").append(s.buildTag("th.e-headercell"))},_updateScrollTop:function(e){var t,i={},s=this;i.requestType="scroll",i.delta=e,t=s.getScrollElement().ejScroller("isHScroll"),!t&&this.model.isFromGantt?s._$gridContent.scrollTop(e):s._$gridContent.scrollTop(0),s.getScrollElement().ejScroller("scrollY",e,!0),s.model.isFromGantt&&(s._completeAction(i),s.element[0].focus())},_selectNextCell:function(e,t){var i,s,a=this,n=a.model,o=n.columns,r=o.length,l=n.updatedRecords,d=d=a.getExpandedRecords(l);switch(a._isShiftKeyNavigation=!1,e){case"right":if(a._focusingRowIndex>=l.length-1&&a._cellIndex>=r-1)return;if(a._cellIndex+=1,a._cellIndex==r){if(a._cellIndex=0,i=l[a._rowIndexOfLastSelectedCell],selectingRowIndex=d.indexOf(i),currentSelectingRecord=d[selectingRowIndex+1],currentSelectingRecord&¤tSelectingRecord.isSummaryRow&&(currentSelectingRecord=a._getNextRecord(selectingRowIndex+1,d)),!currentSelectingRecord)return;a._focusingRowIndex=l.indexOf(currentSelectingRecord)}if(a._focusingRowIndex>=n.updatedRecords.length)return;(!o[a._cellIndex].visible||!o[a._cellIndex].allowCellSelection)&&$form.length<=0&&(a._cellIndex=a.getUpNextVisibleColumnIndex(a._cellIndex,t)),$form.length>0&&o[a._cellEditingDetails.columnIndex].allowCellSelection&&(a._cellIndex=a._cellEditingDetails.columnIndex),s={rowIndex:a._focusingRowIndex,cellIndex:a._cellIndex},a.selectCells([s]),a.updateScrollBar();break;case"left":if(a._cellIndex-=1,r=o.length,a._cellIndex<0){if(a._cellIndex=r-1,i=l[a._rowIndexOfLastSelectedCell],selectingRowIndex=d.indexOf(i),currentSelectingRecord=d[selectingRowIndex-1],currentSelectingRecord&¤tSelectingRecord.isSummaryRow&&(currentSelectingRecord=a._getNextRecord(selectingRowIndex-1,d,"upArrow")),!currentSelectingRecord)return;a._focusingRowIndex=l.indexOf(currentSelectingRecord)}if(a._focusingRowIndex<0)return;a._focusingRowIndex>=n.updatedRecords.length&&(a._focusingRowIndex=n.updatedRecords.length-1),(!o[a._cellIndex].visible||!o[a._cellIndex].allowCellSelection)&&$form.length<=0&&(a._cellIndex=a.getPreviousVisibleColumnIndex(a._cellIndex,t)),$form.length>0&&o[a._cellEditingDetails.columnIndex].allowCellSelection&&(a._cellIndex=a._cellEditingDetails.columnIndex),s={rowIndex:a._focusingRowIndex,cellIndex:a._cellIndex},a.selectCells([s]),a.updateScrollBar()}},_moveCurrentCell:function(t){var i,s,a,n=this,o=n._cellEditingDetails.rowIndex,r=n._cellEditingDetails.columnIndex,l=n.model,d=l.allowPaging?n._updatedPageData:l.updatedRecords;if(o==-1&&r==-1)return!1;switch(n.model.isEdit&&(n.saveCell(),n.model.isEdit=!1),l.enableVirtualization&&!l.allowPaging&&(i=l.currentViewData[o],n._cellEditingDetails.rowIndex=o=l.updatedRecords.indexOf(i)),t){case"right":var h,c,u,m=l.columns,p=m.length,g=n.getHiddenColumns(),_=e.extend([],m);if(g&&g.forEach(function(e){_.splice(_.indexOf(e),1)}),c=_.indexOf(m[r]),u=_.length,o==d.length-1&&c==u-1)return!0;if(c==u-1){for(h=0;!m[h].visible;)h++;if(n._cellEditingDetails.columnIndex=h,n._getNextRow(t,o,n))return!0}else{for(h=r+1;!m[h].visible;)h++;n._cellEditingDetails.columnIndex=h}for(;0==l.columns[h].allowEditing||!m[h].visible;)if(h+1!=l.columns.length)n._cellEditingDetails.columnIndex=++h;else if(n._cellEditingDetails.columnIndex=h=0,n._getNextRow(t,o,n))return!0;n.updateScrollBar(),n.cellEdit(n._cellEditingDetails.rowIndex,l.columns[n._cellEditingDetails.columnIndex].field),n._editAddTools();break;case"left":var f,c,u,m=l.columns,p=m.length,g=n.getHiddenColumns(),_=e.extend([],m);if(g&&g.forEach(function(e){_.splice(_.indexOf(e),1)}),c=_.indexOf(m[r]),u=_.length,0==o&&0==c)return!0;if(0==c){for(f=l.columns.length-1;!m[f].visible;)f--;if(n._cellEditingDetails.columnIndex=f,n._getNextRow(t,o,n))return!0}else{for(f=r-1;!m[f].visible;)f--;n._cellEditingDetails.columnIndex=f}for(;0==l.columns[f].allowEditing||!m[f].visible;)if(f-1!=-1)n._cellEditingDetails.columnIndex=--f;else if(n._cellEditingDetails.columnIndex=f=p-1,n._getNextRow(t,o,n))return!0;n.updateScrollBar(),n.cellEdit(n._cellEditingDetails.rowIndex,l.columns[n._cellEditingDetails.columnIndex].field),n._editAddTools();break;case"up":if(0==o)return!0;n._cellEditingDetails.rowIndex=o-1,n.selectRows(n._cellEditingDetails.rowIndex),n._rowSelectedEventTrigger(n._cellEditingDetails.rowIndex),n.cellEdit(n._cellEditingDetails.rowIndex,l.columns[n._cellEditingDetails.columnIndex].field);break;case"down":if(o+1==n.model.updatedRecords.length&&(n.element.focus(),n._isEnterKeyPressed=!0),l.showSummaryRow&&o+1==l.updatedRecords.length-l.summaryRows.length&&(n._isEnterKeyPressed=!0),n._isEnterKeyPressed)n._isEnterKeyPressed=!1;else{if(n.model.updatedRecords.length>o+1)if(l.enableVirtualization){if(a=l.updatedRecords[o+1],a&&a.isSummaryRow&&(a=n._getNextRecord(o+1,l.updatedRecords)),s=l.updatedRecords.indexOf(a),s==-1)return!0;n._cellEditingDetails.rowIndex=s}else{var b=l.updatedRecords[o],v=n.getExpandedRecords(l.updatedRecords),a=v[v.indexOf(b)+1];if(a&&a.isSummaryRow&&(a=n._getNextRecord(o+1,v)),s=l.updatedRecords.indexOf(a),o==v.length-1&&r==l.columns.length-1||s==-1)return!0;n._cellEditingDetails.rowIndex=s}n._rowSelectingEventTrigger(n.selectedRowIndex(),n._cellEditingDetails.rowIndex)||(n.selectRows(n._cellEditingDetails.rowIndex),n._rowSelectedEventTrigger(n._cellEditingDetails.rowIndex)),n.updateScrollBar(),args={},args.requestType="scroll",args.delta=n._$gridContent.children(".e-content").scrollTop(),n._trigger("actionComplete",args),n.cellEdit(n._cellEditingDetails.rowIndex,l.columns[n._cellEditingDetails.columnIndex].field),n._editAddTools()}}return!1},_getNextRecord:function(e,t,i){do nextRecord=t[e],"upArrow"==i||"lastRowSelection"==i||"bottomRowSelection"==i?e--:e++;while(nextRecord&&nextRecord.isSummaryRow);return nextRecord},_getNextRow:function(e,t,i){var s,a,n,o=i.model,r=o.allowPaging?i._updatedPageData:o.updatedRecords;if(s="right"==e?1:-1,o.enableVirtualization){if(a=o.updatedRecords[t+s],a&&a.isSummaryRow&&(n=s>0?"":"lastRowSelection",a=i._getNextRecord(t+s,o.updatedRecords,n)),o.allowPaging&&a&&(index=r.indexOf(a),index<0&&1==s?i.gotoPage(i._currentPage()+1):index<0&&s==-1&&i.gotoPage(i._currentPage()-1)),index=r.indexOf(a),index==-1)return!0;i._cellEditingDetails.rowIndex=index}else{var l=r[t],d=i.getExpandedRecords(o.updatedRecords),a=d[d.indexOf(l)+s];if(a&&a.isSummaryRow&&(n=s>0?"":"lastRowSelection",a=i._getNextRecord(t+s,d,n)),o.allowPaging&&a&&(index=r.indexOf(a),index<0&&1==s?i.gotoPage(i._currentPage()+1):index<0&&s==-1&&i.gotoPage(i._currentPage()-1)),index=r.indexOf(a),index==-1)return!0;i._cellEditingDetails.rowIndex=index}o.allowSelection&&"cell"==o.selectionMode?o.selectedItem=o.updatedRecords[i._cellEditingDetails.rowIndex]:i._rowSelectingEventTrigger(i.selectedRowIndex(),i._cellEditingDetails.rowIndex)||(i.selectRows(i._cellEditingDetails.rowIndex),i._rowSelectedEventTrigger(i._cellEditingDetails.rowIndex))},_findColumnsWidth:function(){for(var e=this,t=e.model.columns.length,i=e.getHeaderTable().find("colgroup").find("col"),s=0;s0?this.element.find("#e-movablecontainer"+this._id):this._$gridContent},_getFrozenColumnWidth:function(e){var t,i=0,e=s.isNullOrUndefined(e)?this._frozenColumnsLength:e,a=s.isNullOrUndefined(e)?this._frozenColumns:this.model.columns;if(e>0)for(t=0;t0&&(a._$gridContent.css("width",l-a._totalBorderWidth),l=l-this._getFrozenColumnWidth()-1),a.getScrollElement().ejScroller({enableTouchScroll:!1,height:a.model.isFromGantt?0:r,width:a.model.isFromGantt?l:l-a._totalBorderWidth,scroll:e.proxy(a._onScroll,a)})}else a.getScrollElement().ejScroller("refresh");a.getScrollElement().ejScroller("model.keyConfigs",{up:"",down:"",left:"",right:""}),s.isNullOrUndefined(t)&&a._updateScrollCss(),i=a.getScrollElement().ejScroller("isHScroll"),n.allowPaging&&!n.sizeSettings.height&&i&&(a._gridHeight=a._gridHeight+18,a.element.height(a._gridHeight),a.getScrollElement().ejScroller("refresh")),a.model.isFromGantt&&(i?a._$gridContent.removeClass("e-borderbox"):a._$gridContent.addClass("e-borderbox")),!this.mobileDevice()&&"safari"==this.getBrowserDetails().browser&&this._frozenColumnsLength>0&&(this.getHeaderContent().find("#e-movableheader"+a._id).add(this.getContent().find("#e-movablecontainer"+a._id)).css("margin-left","auto"),this._$totalSummaryRowContainer&&this._$totalSummaryRowContainer.find("#e-movablefooter"+a._id).css("margin-left","auto")),this._frozenColumnsLength>0&&(a._$gridContent.height(r),a.getContent().find("#e-frozencontainer"+a._id).height(a.getContent().find("#e-movablecontent"+a._id).height()))},_destroy:function(){var e=this;e.element.empty().removeClass("e-treegrid-core e-treegrid "+e.model.cssClass)},collapseAll:function(){var e=this,t=e.model,i=0,a={};t.enableVirtualization,e.getRows();for((e._isRowEdit||e.model.isEdit)&&(e._isRowEdit?e.cancelRowEditCell():e.cancelEditCell(),e.selectRows(-1),e._cancelSaveTools()),a.requestType=s.TreeGrid.Actions.ExpandCollapse,e._isInExpandCollapseAll=!0,i=0;i0&&e._refreshTreeGridOnExpandCollapseAll(a),e._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(){e(".e-contextmenu").remove(),e(".e-innerContextmenu").remove()},_renderContextMenu:function(t,i,n){var o,r,l,d,h,c,u,m,p=this,g=(p.model,{});if(p._contextMenuSelectedIndex=i,p._contextMenuSelectedItem=n,p._contextMenuEvent=t,t||(t=window.event),t.pageX||t.pageY?(l=o=t.pageX,r=t.pageY):(t.clientX||t.clientY)&&(l=o=t.clientX+document.body.scrollLeft+document.documentElement.scrollLeft,r=t.clientY+document.body.scrollTop+document.documentElement.scrollTop),c=this.getOffsetRect(p.element[0]),c.bottom=c.top+this.element[0].offsetHeight,c.right=c.left+e(this.element).width(),g.targetElement=t,g.item=n,g.index=i,g.columnIndex=p.getCellIndex(t),g.requestType="ContextMenuOpen",g.contextMenuItems=p._contextMenuItems,p._trigger("contextMenuOpen",g))return!1;p._activeMenuItemId=null,p._contextMenuItems=g.contextMenuItems,d=s.buildTag("div.e-contextmenu","",{display:"table",position:"absolute","border-width":"1px","border-style":"solid","z-index":"10033"},{id:p._id+"_ContextMenu"}),u=g.contextMenuItems.filter(function(e){if(null==e.parentMenuId||e.parentMenuId==a)return!0}),h=s.buildTag("ul",e.render[p._id+"contextMenuTemplate"](u),{margin:"0px","padding-left":"0px"},{"data-icon":!1,type:"none","data-role":"list-divider"}),d.append(h),e(document.body).append(d);var _=(e(d).height(),e(d).width()),f=d.find(".e-menuitem");f.eq(0);(c.left>o||c.right0&&(r=m)),d.css({left:o+"px",top:r+"px"}),f.css({width:_+2}),e(p.element).focus(),e(d).css({height:"auto"}),p._on(d,"contextmenu",function(e){e.preventDefault()}),e(f).click(function(){p._contextMenuClickHandler(this)}),e(f).mouseenter(function(){e(this).hasClass("e-disable")||(d.find(".e-contextmenu-mouseover").removeClass("e-contextmenu-mouseover"),e(this).addClass("e-contextmenu-mouseover"),p._activeMenuItemId=e(this).attr("id"),p._showSubContextMenu(this,g.contextMenuItems))}),t.preventDefault()},_showSubContextMenu:function(t,i){var a,n,o,r,l=(this.model,this),d=[],h=e(t).attr("id"),c=[];c=i.filter(function(e){return e.menuId==h&&(d=e),e.parentMenuId==h||void 0}),d.parentMenuId||e(".e-innerContextmenu").remove(),d.parentMenuId&&this._removeContextMenu(d,i),c.length>0&&(a=s.buildTag("div.e-innerContextmenu","",{display:"table",position:"absolute","border-width":"1px","border-style":"solid","z-index":"10034"},{id:this._id+"_SubContextMenu"+h}),n=s.buildTag("ul",e.render[l._id+"contextMenuTemplate"](c),{margin:"0px","padding-left":"0px"},{"data-icon":!1,type:"none","data-role":"list-divider"}),a.append(n),e(document.body).append(a),r=l._getSubContextMenuPosition(t,a),e(a).css({top:r.top,left:r.left}),o=a.find(".e-menuitem"),o.css({width:e(a).width()+2}),e(o).mouseenter(function(){e(this).hasClass("e-disable")||(l._showSubContextMenu(this,i),e(this).closest(".e-innerContextmenu").find(".e-contextmenu-mouseover").removeClass("e-contextmenu-mouseover"),e(this).addClass("e-contextmenu-mouseover"),l._activeMenuItemId=e(this).attr("id"))}),l._on(a,"contextmenu",function(e){e.preventDefault()}),e(o).click(function(){l._contextMenuClickHandler(this)}))},_removeContextMenu:function(t,i){var s,a,n=e("#"+this._id+"_SubContextMenu"+t.parentMenuId),o=e(n).find(".e-contextmenu-mouseover");e(o).length>0&&(s=i.filter(function(t){if(t.menuId==e(o).attr("id"))return!0}),s.length>0&&(a=i.filter(function(e){if(e.parentMenuId==s[0].menuId)return!0}),a.length>0&&this._removeContextMenu(a[0],i)),e("#"+this._id+"_SubContextMenu"+e(o).attr("id")).remove())},_getSubContextMenuPosition:function(t,i){var s,a,n,o,r=(this.model,e(i).width()),l=e(i).height(),d=this.getOffsetRect(t),h={top:"",left:""},c=e(t).closest(".e-contextmenu");return 0==c.length&&(c=e(t).closest(".e-innerContextmenu")),a=e(c).width(),h.top=d.top-1,h.left=d.left+e(c).width()+1,s=h.left,n=this.getOffsetRect(this.element[0]),n.bottom=n.top+this.element[0].offsetHeight,n.right=n.left+e(this.element).width(),(n.left>s||n.right0&&(h.left=s)),n.bottom0&&(h.top=o)),h},_contextMenuClickHandler:function(t){var i=e(t).attr("id"),s=this;if(!e(t).hasClass("e-disable")&&0==e(t).find(".e-expander").length)switch(i){case"Delete":s._contextMenuOperations("Delete");break;case"Above":s._contextMenuOperations("Above");break;case"Below":s._contextMenuOperations("Below");break;case"Add":s._contextMenuOperations("Add");break;case"Edit":s._contextMenuOperations("Edit");break;case"Save":s._contextMenuOperations("Save");break;case"Cancel":s._contextMenuOperations("Cancel");break;default:s._contextMenuOperations(i)}},_triggerMenuEventHandler:function(t,i){var a,n,o,r=this,l=r._contextMenuItems;s.isNullOrUndefined(l)||(a=l.filter(function(e){if(e.menuId.toString()===t)return!0}),a.length>0&&(n=a[0],o=n.eventHandler,o&&("string"==typeof o&&(o=s.util.getObject(o,window)),e.isFunction(o)&&(args=s.event("customContextMenuHandler",this.model,i),o.call(this,args)))))},_createContextMenuTemplate:function(){var t,i,s,a=this,n={};n["_"+a._id+"getHeaderName"]=e.proxy(a._getHeaderName,a),e.views.helpers(n),t="
  • ",i="
    {{if iconPath}}
    {{else}}{{/if}}
    {{:headerText}}
    {{if ~_"+a._id+"getHeaderName(#data)}}
    {{/if}}",t+=i,t+="
  • ",s={},s[a._id+"contextMenuTemplate"]=t,e.templates(s)},_getHeaderName:function(e){var t=this._contextMenuItems.filter(function(t){if(null!=e.menuId&&e.menuId==t.parentMenuId)return!0});return t.length>0},_getColumnId:function(e){return e.name.replace(/\s/g,"")},_updateContextmenuOption:function(t){var s,n;if(Array.prototype.clean=function(e){for(var t=0;t0?n?(l=s.buildTag("form.#"+f._id+"EditFrozenForm","",{margin:"-2px"},{}),d.append(f._$gridHeaderContainer.find("#e-frozenheaderdiv"+f._id).find("colgroup").clone())):(l=s.buildTag("form.#"+f._id+"EditForm","",{margin:"-2px"},{}),d.append(f._$gridHeaderContainer.find("#e-movableheaderdiv"+f._id).find("colgroup").clone())):(l=s.buildTag("form.#"+f._id+"EditForm","",{margin:"-2px"},{}),d.append(f.getHeaderTable().find("colgroup").clone())),!n&&_.showDetailsRow&&_.showDetailsRowInfoColumn&&_.detailsTemplate&&(h=i.find("td.e-detailsrowcell")),i.empty(),o?(i.addClass("e-addedrow"),i.next("tr").hasClass("e-detailsrow")&&i.next("tr").remove()):i.addClass("e-rowedit"),v=t.filter(function(e){return!(e.visible===!1)}),r=s.buildTag("td","",{},{colspan:h?v.length+1:v.length}),c=_.allowSelection?s.buildTag("tr.e-treegridrows e-selectionbackground e-active",{height:b},{}):s.buildTag("tr.e-treegridrows",{height:b},{}),$tbody=s.buildTag("tbody"),$cellEditTemplate=f._cellEditTemplate,u=t.length,m=0;m0?(o._appendEditTemplateRow(o._frozenColumns,e(a[0]),t,!0,i),o._appendEditTemplateRow(o._unFrozenColumns,e(a[1]),t,!1,i)):o._appendEditTemplateRow(r.columns,e(a),t,!1,i),o._isRowEdit=!0,o._setoffsetWidth(),o._editAddTools(),o._refreshEditForm(),void(r.selectedItem=r.updatedRecords[t]))},_renderColumnChooser:function(){var t=this,i=s.buildTag("div.e-columnSelector","","",{id:this._id+"ccDiv"});e("#"+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",position:{X:1,Y:1},enableAnimation:!1,minWidth:"0px",minHeight:"0px"}),e("#"+t._id+"ccDiv_wrapper").removeClass("e-dialog").removeClass("e-shadow").find("div.e-dialog-scroller").css("height","100%").removeClass("e-widget-content")},_renderColumnChooserList:function(t,i){for(var a,n,o=this,r=o.model.columns.length,l=o.model.columns,d=s.buildTag("div","",{"margin-left":"0px",width:"auto"}),h=0;h
    {{:name}}
    {{if (menuId =='Columns')}}
    {{/if}}{{if menuId == 'RenameColumn' || menuId == 'SortDescending'}}
    {{/if}}
    ",s={};s[t._id+"columnMenuTemplate"]=i,e.templates(s)},_renderColumnMenu:function(t){var i,n,o,r,l,d,h,c,u,m,p,g,_,f=this,b=f.model,v=columnListPosX=posY=0,x=e(t.target),w=S=0,y=[],C=0,w=x[0].offsetWidth,S=x[0].offsetHeight,T=f._columnMenuTexts,D=e.trim(x.prev("div.e-headercelldiv").attr("ej-mappingname")),I=f.getColumnByField(D),k=I.allowSorting==a||I.allowSorting;f._clearColumnMenu(),f._columnMenuTarget=x,b.isEdit?this.saveCell():this._isRowEdit&&this._saveRow(),b.showColumnChooser&&b.showColumnOptions&&(i=f._enableDisableInsertLabel(),y.push({name:T.insertColumnLeft,icon:"e-column-insertleft-icon",menuId:"ColumnLeft",enabled:i}),y.push({name:T.insertColumnRight,icon:"e-column-insertright-icon",menuId:"ColumnRight",enabled:i}),y.push({name:T.deleteColumn,icon:"e-column-delete-icon",menuId:"DeleteColumn",enabled:f._enableDisableDEL(I)}),y.push({name:T.renameColumn,icon:"e-column-rename-icon",menuId:"RenameColumn"})),b.allowSorting&&k&&(y.push({name:T.sortAscendingText,icon:"e-columnmenu-ascending",menuId:"SortAscending"}),y.push({name:T.sortDescendingText,icon:"e-columnmenu-descending",menuId:"SortDescending"})),b.showColumnChooser&&(C=y.length,y.push({name:T.columnsText,icon:"e-columnchooser-icon",menuId:"Columns"})),b.isFromGantt||(I.allowFreezing||f._allowFreezingDefault&&s.isNullOrUndefined(I.allowFreezing))&&(o=!1,f._frozenColumnsLength!=b.columns.length-1||I.isFrozen||(n=!0),r=this._getFrozenColumnWidth(),l=b.columns.indexOf(I),r=r+this.columnsWidthCollection[l]+18,r>this._gridWidth&&(n=!0),y.push({name:T.freezeText,icon:"e-freezecolumn-icon",menuId:"FreezeColumns",enabled:!n&&!I.isFrozen}),y.push({name:T.unfreezeText,icon:"e-unfreezecolumn-icon",menuId:"UnfreezeColumns",enabled:1==I.isFrozen}),0!=b.columns.indexOf(I)&&b.columns.indexOf(I)>this._frozenColumnsLength&&(o=!0),r=this._getFrozenColumnWidth(l),r+=18,r>this._gridWidth&&(o=!1),y.push({name:T.freezePrecedingColumnsText,icon:"e-freezecolumnbefore-icon",menuId:"FreezePrecedingColumns",enabled:o})),d=f.getOffsetRect(x[0]),h=f.getOffsetRect(f.element[0]),posY=f.model.isFromGantt?d.top+S:d.top+S,f._columnChooserListIndex=C;var P=s.buildTag("div.e-columnmenu","",{"border-width":"1px","border-style":"solid",display:"table",position:"absolute",top:posY,"z-index":"10033"},{id:f._id+"_ColumnMenu"}),L=s.buildTag("ul","",{padding:"0px",margin:"0px"},{}),R=e.render[f._id+"columnMenuTemplate"](y);L.append(R),P.append(L),e(document.body).append(P),c=P.height(),u=P.width(),v=d.left+w-u,v<=h.left&&(v=h.left),columnListPosX=v+u+4,f._columnListPosX=columnListPosX,P.css({left:v}),P.find(".e-columnmenuitem").css({width:u}),m=b.isFromGantt?e(this.element).closest(".e-gantt"):e(this.element),p=this.getOffsetRect(m[0]),p.bottom=p.top+m[0].offsetHeight,p.right=p.left+e(m).width(),e("#"+f._id+"_ColumnsChooser").mouseenter(function(){var t;f._updateColumnMenuVisibility();var i=e("#"+f._id+"ccDiv").ejDialog("instance"),s=e("#"+f._id+"ccDiv_wrapper"),a=s.find("div.e-columnMenuListDiv");i.open(),p.right0)||(e=this._getFrozenColumnWidth(),e+=250,!(e>this._gridWidth))},insertColumnChooser:function(t,i){var a,n=this,o=n.model;0===e("#"+n._id+"_dialogColumnAdd").length&&(a=s.buildTag("div.e-dialog e-dialog-content e-shadow e-widget-content","",{display:"none"},{id:n._id+"_dialogColumnAdd"}),n.element.append(a),n._on(e("#"+n._id+"_dialogColumnAdd"),"click keypress","#ColumnAddDialog_"+n._id+"_Ok ,#ColumnAddDialog_"+n._id+"_Cancel",n._buttonClick)),n.renderColumnAddDialog(),n._targetColumnIndex=o.columns.indexOf(t),n._insertPosition=i},renameColumn:function(e,t){var i=this,s=i.model,a=s.columns;a[e].headerText=t,i._refreshFrozenColumns()},_renderColumnRenameDialog:function(t){var i=this,a=s.buildTag("div","",{},{unselectable:"on"}),n=s.buildTag("form","",{height:"auto",width:"auto","font-size":"14px"},{id:i._id+"ColumnRenameForm",onsubmit:"return false"});$buttons=s.buildTag("span.e-buttons"," "),btnDiv=s.buildTag("div","",{"margin-top":"20px",float:"right","margin-bottom":"15px","margin-right":"15px"},{class:"e-editform-btn"}),$innerTable=s.buildTag("table","",{outline:"none"},{unselectable:"on"}),$inTr1=s.buildTag("tr"),$inTd=s.buildTag("td.editLabel","",{outline:"none"},{unselectable:"on"}),$inTd.append(""),$inTr1.append($inTd),$innerTable.append($inTr1),$inTr2=s.buildTag("tr"),$inTd2=s.buildTag("td.e-editValue"),$input=s.buildTag("input.e-field e-ejinputtext","",{},{value:t.headerText,id:i._id+"RenameHeaderText",name:t.field,dialog:"RenameHeaderText",style:"height:25px;width:210px;"}),$inTd2.html($input),$inTr2.append($inTd2),$innerTable.append($inTr2),n.append($innerTable),a.append(n),i._columnRenameDialog=s.buildTag("div","","",{title:"Rename Column"},{id:+i._id+"ColumnRenameDialog"}),btnDiv.append($buttons),i._columnRenameDialog.append(a).append(btnDiv),i.element.append(i._columnRenameDialog),$buttons.find("input").ejButton({cssClass:i.model.cssClass,showRoundedCorner:!0,size:"mini",click:e.proxy(i._triggerRenameColumn,i)}),i._columnRenameDialog.ejDialog({width:"auto",minHeight:0,minWidth:0,showOnInit:!1,enableResize:!1,enableModal:!0}),$input.focus().select()},_triggerRenameColumn:function(e){var t,i,s=this;e!==a&&e.model.text==s._okButtonText&&(t=s._columnRenameDialog.find("#"+s._id+"RenameHeaderText"),i=t.val(),s.renameColumn(s._targetColumnIndex,i)),s._columnRenameDialog.ejDialog("close")},renderColumnAddDialog:function(){var t,i,s,a,n=this,o=n.model,r=o.columnDialogFields,l={};if(l.requestType="openColumnAddDialog",r.length)for(l.data={},t=0;t':"allowFilteringBlankContent"==e||"visible"==e?t=' ':"allowCellSelection"==e?t=' ':"allowCellSelection"==e?t=' ':"width"==e&&(t=s.buildTag("input.e-numerictextbox e-field","",{},{type:"text",value:"{{:#data."+e+"}}",id:i._id+e+"ColumnAdd",name:e,dialog:"ColumnAdd"}),t.attr("edittype","numericedit")),t},columnAddDialogTemplate:function(){var t,i,a,n=this,o=n.model,r=o.columns,l=r.length;if(0!=l){for(n.setAddColumnFields(),i=s.buildTag("div","",{},{unselectable:"on"}),$form=s.buildTag("form","",{height:"auto",width:"auto","font-size":"14px"},{id:n._id+"ColumnAddForm"}),$table=s.buildTag("table","",{width:"500px"},{unselectable:"on"}),$tr=s.buildTag("tr"),a=0;a"+n._addColumnFieldsTxt[a]+""),$inTr.append($inTd),$innerTable.append($inTr),$inTr2=s.buildTag("tr"),$inTd2=s.buildTag("td.e-editValue"),t=n.setColumnCelEditType(n._addColumnFields[a]),$inTd2.html(t),$inTr2.append($inTd2),$innerTable.append($inTr2),$td.append($innerTable),$tr.append($td)):($table.append($tr),$tr=$tempTr=s.buildTag("tr"),a--);$table.append($tr),$tr2=s.buildTag("tr"), o.showColumnChooser&&($td=s.buildTag("td","",{"text-align":"left",padding:"10px 15px 0","font-weight":"normal",outline:"none"},{colspan:2,unselectable:"on"}),$innerTable=s.buildTag("table#"+n._id+"dropdownDataTable","",{width:"100%",outline:"none"},{unselectable:"on"}),$inTr3=s.buildTag("tr"),$inTd3=s.buildTag("td.editLabel","",{outline:"none"},{unselectable:"on"}),$inTd3.append(""),$inTr3.append($inTd3),$innerTable.append($inTr3),$inTr=s.buildTag("tr"),$inTd=s.buildTag("td.editLabel","",{outline:"none"},{unselectable:"on"}),$inTd.append(""+n._columnDialogTexts.addData+"        "+n._columnDialogTexts.deleteData+""),$inTr.append($inTd),$innerTable.append($inTr),$inTr2=s.buildTag("tr"),$inTd2=s.buildTag("td.e-editValue"),$preDiv=s.buildTag("div#treegrid"+n._id+"dropdownData","",{width:"100%",height:"150px"},{}),$inTd2.append($preDiv),$inTr2.append($inTd2),$innerTable.append($inTr2),$td.append($innerTable),$tr2.append($td),$table.append($tr2)),$form.append($table),i=n.renderColumnAddDialogButton($form,i),e.templates(n._id+"_ColumnAddTemplate",i.html())}},renderColumnAddDialogButton:function(e,t){var i,a,n,o="ColumnAddDialog_",r=this,l=r.model,d=s.buildTag("input","",{"border-radius":"3px"},{type:"button",id:o+r._id+"_Ok"}),h=r._okButtonText;return d.ejButton({cssClass:l.cssClass,text:h,width:"70"}),i=r._cancelButtonText,a=s.buildTag("input","",{"margin-left":"20px","border-radius":"3px"},{type:"button",id:o+r._id+"_Cancel"}),a.ejButton({cssClass:l.cssClass,text:i,width:"70"}),n=s.buildTag("div","",{"margin-top":"20px",float:"right","margin-bottom":"15px","margin-right":"15px"},{class:"e-editform-btn"}),n.append(d),n.append(a),e.appendTo(t),n.appendTo(t),t},_buttonClick:function(t){var i,n,o,r,l;if(t.keyCode!==a&&13!=t.keyCode)return!0;var d,h,c=this,u=c.model,m=u.treeColumnIndex,p=!1,g={},_=c._addColumnFields,f=u.columns,b={};if(t.target.id=="ColumnAddDialog_"+c._id+"_Ok"){for(i=document.getElementById(c._id+"ColumnAddForm"),c.clearSelection(),o=0;o<_.length;o++)if(r=_[o],d=e(i).find("#"+c._id+r+"ColumnAdd"),"editType"==r||"filterEditType"==r||"textAlign"==r||"headerTextAlign"==r){if(n=d.data("ejDropDownList"),g[r]=n._selectedValue,"editType"==r&&"dropdownedit"==g[r]){var v=e(i).find("#treegrid"+c._id+"dropdownData"),x=v.data("ejTreeGrid"),w=x.model.dataSource;w.length>0&&(g.dropdownData=w)}}else"allowCellSelection"==r||"allowSorting"==r||"allowFiltering"==r||"allowFilteringBlankContent"==r||"visible"==r||"isFrozen"==r||"allowFreezing"==r?(ch=d.data("ejCheckBox"),g[r]=ch._isChecked):""!=d.val()||"headerText"!=r&&"field"!=r?g[r]=d.val():"field"==r?g[r]="Column"+(u.columns.length+1):"headerText"==r&&(g[r]="Column "+(u.columns.length+1));"left"==c._insertPosition?h=c._targetColumnIndex:"right"==c._insertPosition&&(h=c._targetColumnIndex+1),h<=m&&(u.treeColumnIndex=m+1),u.isFromGantt||h<=c._frozenColumnsLength-1&&(p=!0),l={},l=u.isFromGantt?{field:g.field,headerText:g.headerText,editType:g.editType,allowSorting:s.isNullOrUndefined(g.allowSorting)?null:g.allowSorting,visible:0!=g.visible,width:g.width?g.width:150,textAlign:g.textAlign?g.textAlign:"left",headerTextAlign:g.headerTextAlign?g.headerTextAlign:"left",dropdownData:g.dropdownData?g.dropdownData:null,allowCellSelection:s.isNullOrUndefined(g.allowCellSelection)?null:g.allowCellSelection}:{field:g.field,headerText:g.headerText,editType:g.editType,filterEditType:g.filterEditType?g.filterEditType:"stringedit",allowFiltering:s.isNullOrUndefined(g.allowFiltering)?null:g.allowFiltering,allowFilteringBlankContent:s.isNullOrUndefined(g.allowFilteringBlankContent)?null:g.allowFilteringBlankContent,allowSorting:s.isNullOrUndefined(g.allowSorting)?null:g.allowSorting,visible:0!=g.visible,width:g.width?g.width:150,textAlign:g.textAlign?g.textAlign:"left",headerTextAlign:g.headerTextAlign?g.headerTextAlign:"left",isFrozen:1==g.isFrozen||1==p,allowFreezing:s.isNullOrUndefined(g.allowFreezing)?null:g.allowFreezing,dropdownData:g.dropdownData?g.dropdownData:null,allowCellSelection:s.isNullOrUndefined(g.allowCellSelection)?null:g.allowCellSelection},b.requestType="insertColumn",b.columnObject=l,b.insertIndex=h,c._trigger("actionComplete",b)||(f.splice(b.insertIndex,0,b.columnObject),c._refreshFrozenColumns()),e("#"+c._id+"_dialogColumnAdd").ejDialog("close")}else t.target.id=="ColumnAddDialog_"+c._id+"_Cancel"&&e("#"+c._id+"_dialogColumnAdd").ejDialog("close");return!1},_refreshColumnAddForm:function(){var t,i,a,n,o,r,l,d,h,c,u,m,p=this,g=e("#"+p._id+"ColumnAddForm"),_=g.find("input,select"),f=0,b=!1,v=_.length,x=p.model,w={},y=[];p.model.rowHeight;for(f;f "),o=s.buildTag("div","",{"margin-top":"20px",float:"right","margin-bottom":"15px","margin-right":"15px"},{class:"e-editform-btn"});o.append(n),t._updateConfirmDialog=s.buildTag("div","","",{title:i},{id:+t._id+"ConfirmDialog"}),t._updateConfirmDialog.append(a).append(o),t.element.append(t._updateConfirmDialog),n.find("input").ejButton({cssClass:t.model.cssClass,showRoundedCorner:!0,size:"mini",click:e.proxy(t._triggerUpdateConfirm,t)}),t._updateConfirmDialog.ejDialog({width:"auto",minHeight:0,minWidth:0,showOnInit:!1,enableResize:!1,enableModal:!0})},_triggerUpdateConfirm:function(e){var t=this;e!==a&&e.model.text==t._okButtonText&&t._updateConfirmDialog.find(".e-content").text()==t._deleteColumnText&&t.deleteColumn(t._targetColumnIndex),t._updateConfirmDialog.ejDialog("close")},deleteColumn:function(t){var i,s,a=this,n=a.model,o=n.columns,r=n.sortSettings&&n.sortSettings.sortedColumns.length?n.sortSettings.sortedColumns:null;i=o.splice(t,1),r&&(s=e.grep(r,function(e){return e.field==i[0].field}),s.length&&r.splice(r.indexOf(s[0]),1)),a._targetColumnIndex<=n.treeColumnIndex&&(n.treeColumnIndex=n.treeColumnIndex-1),a._refreshFrozenColumns()},getOffsetRect:function(e){var t=e.getBoundingClientRect(),i=document.body,s=document.documentElement,a=window.pageYOffset||s.scrollTop||i.scrollTop,n=window.pageXOffset||s.scrollLeft||i.scrollLeft,o=s.clientTop||i.clientTop||0,r=s.clientLeft||i.clientLeft||0,l=t.top+a-o,d=t.left+n-r;return{top:Math.round(l),left:Math.round(d)}},_moveToNextMenuItem:function(t){var i,s,a,n,o,r,l=this.model,d={};switch(l.isFromGantt?(i=e("#"+this._id.replace("ejTreeGrid","")).data("ejGantt"),a=e("#"+this._id.replace("ejTreeGrid","")+"_ContextMenu")):(i=this,a=e("#"+this._id+"_ContextMenu")),s=e("#"+i._activeMenuItemId),t){case"next":0==s.length?d=a.find("div.e-menuitem:not(.e-disable)").first():(d=s.closest("li").next("li").find("div.e-menuitem"),d.length>0&&d.hasClass("e-disable")&&(d=this._findContextMenuItem(d,"next"))),o=e("#"+i._id+"_SubContextMenu"+i._activeMenuItemId),o.remove();break;case"prev":d=this._findContextMenuItem(s,"prev"),o=e("#"+i._id+"_SubContextMenu"+i._activeMenuItemId),o.remove();break;case"expand":s.length>0&&(i._showSubContextMenu(s[0],i._contextMenuItems),r=e("#"+i._id+"_SubContextMenu"+i._activeMenuItemId),r.length>0&&(d=r.find("div.e-menuitem:not(.e-disable)").first()));break;case"collapse":r=e(s).closest(".e-innerContextmenu"),r.length>0&&(n=r.attr("id").replace(i._id+"_SubContextMenu",""),d=e("#"+n),o=e("#"+i._id+"_SubContextMenu"+i._activeMenuItemId),o.remove(),r.remove());break;case"save":s.length>0&&(0==e("#"+i._activeMenuItemId).find(".e-expander").length?(l.isFromGantt?i._contextMenuClickHandler(e("#"+i._activeMenuItemId)):i._contextMenuOperations(i._activeMenuItemId),i._clearContextMenu()):(i._showSubContextMenu(s[0],i._contextMenuItems),r=e("#"+i._id+"_SubContextMenu"+i._activeMenuItemId),r.length>0&&(d=r.find("div.e-menuitem:not(.e-disable)").first())))}d.length>0&&(("next"==t||"prev"==t)&&s.removeClass("e-contextmenu-mouseover"),d.addClass("e-contextmenu-mouseover"),i._activeMenuItemId=e(d).attr("id"))},_findNextColumnMenuItem:function(e,t){var i=this;return"next"===t?(nextItem=e.closest("li").next("li").find("div.e-columnmenuitem"),nextItem.length>0&&nextItem.hasClass("e-disable")?i._findNextColumnMenuItem(nextItem,"next"):nextItem):(prevItem=e.closest("li").prev("li").find("div.e-columnmenuitem"),prevItem.length>0&&prevItem.hasClass("e-disable")?i._findNextColumnMenuItem(prevItem,"prev"):prevItem)},_findContextMenuItem:function(e,t){var i=this;return"next"===t?(nextItem=e.closest("li").next("li").find("div.e-menuitem"),nextItem.length>0&&nextItem.hasClass("e-disable")?i._findContextMenuItem(nextItem,"next"):nextItem):(prevItem=e.closest("li").prev("li").find("div.e-menuitem"),prevItem.length>0&&prevItem.hasClass("e-disable")?i._findContextMenuItem(prevItem,"prev"):prevItem)}}),s.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"},s.TreeGrid.SelectionType={Single:"single",Multiple:"multiple"},s.TreeGrid.EditMode={CellEditing:"cellEditing",RowEditing:"rowEditing"},s.TreeGrid.PageSizeMode={All:"all",Root:"root"},s.TreeGrid.RowPosition={Top:"top",Bottom:"bottom",Above:"aboveSelectedRow",Below:"belowSelectedRow",Child:"child"},s.TreeGrid.BeginEditAction={DblClick:"dblClick",Click:"click"},s.TreeGrid.EditingType={String:"stringedit",Boolean:"booleanedit",Numeric:"numericedit",Dropdown:"dropdownedit",DatePicker:"datepicker",DateTimePicker:"datetimepicker",Maskedit:"maskedit"},s.TreeGrid.ContextMenuItems={Add:"add",Edit:"edit",Delete:"delete"},s.TreeGrid=s.TreeGrid||{},s.TreeGrid._initCellEditType=function(t,i,a,n,o){var r,l,d,h,c,u=t,m=u.model,p=m.columns,g=p[n],o=o?o:"";switch(s.isNullOrUndefined(p[n].editType)&&(g.editType="stringedit"),g.editType){case"stringedit":m.isFromGantt?(r={},r["_"+a+"cellValue"]=s.TreeGrid._getCellValue,"predecessor"===g.field&&(r["_"+a+"predecessorCell"]=s.Gantt._getPredecessorsValue),e.views.helpers(r),l="predecessor"===g.field?s.buildTag("input.e-field e-ejinputtext","",{},{value:"{{:~_"+a+"predecessorCell('"+m.predecessorMapping+"')}}",id:a+g.field+o,name:g.field,dialog:o}):s.buildTag("input.e-field e-ejinputtext","",{},{value:"{{:~_"+u._id+"cellValue('"+p[n].field+"')}}",id:a+m.columns[n].field+o,name:m.columns[n].field,dialog:o})):l=s.buildTag("input.e-field e-ejinputtext","",{},{value:"{{:#data['"+g.field+"']}}",id:a+g.field+o,name:g.field,dialog:o}),l.attr("edittype",p[n].editType),i.html(l);break;case"maskedit":l=s.buildTag("input.e-field e-maskedit","",{},{value:"{{:~_"+u._id+"cellValue('"+p[n].field+"')}}",id:a+g.field+o,name:g.field,dialog:o}),l.attr("edittype",p[n].editType),i.html(l);break;case"booleanedit":i.html("{{if true===~_"+u._id+'cellValue("'+p[n].field+'")}} {{else}} {{/if}}');break;case"numericedit":d=s.buildTag("input.e-numerictextbox e-field","",{},{type:"text",value:"{{:~_"+u._id+"cellValue('"+p[n].field+"')}}",id:a+p[n].field+o,name:p[n].field,dialog:o}),d.attr("edittype",p[n].editType),i.append(d);break;case"datepicker":h=s.buildTag("input.e-datepicker e-field","",{},{type:"text",value:"{{:~_"+u._id+"cellValue('"+p[n].field+"')}}",id:a+p[n].field+o,name:p[n].field,dialog:o}),h.attr("edittype",p[n].editType),i.append(h);break;case"datetimepicker":h=s.buildTag("input.e-datetimepicker e-field","",{},{type:"text",value:"{{:~_"+u._id+"cellValue('"+p[n].field+"')}}",id:a+p[n].field+o,name:p[n].field,dialog:o}),h.attr("edittype",p[n].editType),i.append(h);break;case"dropdownedit":c=s.buildTag("input.e-field e-dropdownlist","",{},{type:"text",id:a+p[n].field+o,name:p[n].field,dialog:o}),c.attr("edittype",p[n].editType).attr("cellValue","{{:~_"+u._id+"cellValue('"+p[n].field+"')}}"),i.append(c)}},s.TreeGrid._getCellValue=function(e){var t=this.data[e];return t?t:this.data.item&&this.data.item[e]},s.TreeGrid.ToolbarItems={Add:"add",Edit:"edit",Delete:"delete",Update:"update",Cancel:"cancel",ExpandAll:"expandAll",CollapseAll:"collapseAll",PdfExport:"pdfExport"},s.TreeGrid.SummaryType={Sum:"sum",Average:"average",Maximum:"maximum",Minimum:"minimum",Count:"count",MinimumDate:"minimumDate",MaximumDate:"maximumDate",TrueCount:"trueCount",FalseCount:"falseCount"},s.TreeGrid.SelectionMode={Row:"row",Cell:"cell"},s.TreeGrid.Locale=s.TreeGrid.Locale||{},s.TreeGrid.Locale.default=s.TreeGrid.Locale["en-US"]={toolboxTooltipTexts:{addTool:"Add",editTool:"Edit",updateTool:"Update",deleteTool:"Delete",cancelTool:"Cancel",expandAllTool:"ExpandAll",collapseAllTool:"CollapseAll",pdfExportTool:"PDF Export"},contextMenuTexts:{addRowText:"Add Row",editText:"Edit",deleteText:"Delete",saveText:"Save",cancelText:"Cancel",aboveText:"Above",belowText:"Below"},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"},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"},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",dropDownListBlanksText:"(Blanks)",dropDownListClearText:"(Clear Filter)",trueText:"True",falseText:"False",emptyRecord:"No records to display"},s.TreeGrid._getrowClassName=function(){var e="gridrowIndex",t=this;return t.data.parentItem&&(e+=t.data.parentItem.index.toString()),e+="level",e+=t.data.level.toString(),t.data.isSummaryRow&&(e+=" ",e+="e-summaryrow"),t.data.footerSummaryRowRecord&&(e+=" ",e+="e-footersummaryrow"),e},s.TreeGrid._getSummaryRowtdClassName=function(){proxy=this;var e="";return proxy.data.isSummaryRow&&(e+=" ",e+="e-summaryrowcell"),proxy.data.footerSummaryRowRecord&&(e+=" ",e+="e-footersummaryrowcell"),e},s.TreeGrid.getColumnByField=function(e,t){var i=0;for(i;i0&&(b.find(".e-treegridcollapse").removeClass("e-treegridcollapse").addClass("e-treegridexpand"),b.removeClass("e-treegridrowcollapse").addClass("e-treegridrowexpand")),l._expandedRecordsCount+=l._isFromGantt||l._frozenColumnsLength>0?_.length/2:_.length,_.css({display:"table-row"}),g.filter("tr.e-detailsrowexpanded").css("display","table-row"),(l._isFromGantt||l._frozenColumnsLength>0)&&(m/=2),u;u0?e(l.getRows()[0]).index(n):l.getRows().index(n),r!==-1&&(o=l._isFromGantt?l.model.updatedRecords[r]:l.model.updatedRecords[r],o.isExpanded=!0,o.expanded&&s.TreeGrid.expandRecord(l,o,a))},s.TreeGrid.collapseRecord=function(t,i,a){var n,o,r,l=t,d=l.model,h=".gridrowIndex"+i.index.toString()+"level"+(i.level+1).toString(),c=".detailsrowgridrowIndex"+i.index.toString()+"level"+(i.level+1).toString(),u=e(l.element).find(h),m=0,p=u.length,g=e(l.element).find(c),_=e(l.element).find(h);l.getRows();for(l._collapsedRecordCount+=l._isFromGantt||l._frozenColumnsLength>0?_.length/2:_.length,_.css({display:"none"}),g.css({display:"none"}),(l._isFromGantt||l._frozenColumnsLength>0)&&(p/=2),m;m0?e(l.getRows()[0]).index(n):l.getRows().index(n),o!==-1&&(r=d.allowPaging?l._updatedPageData[o]:l.getUpdatedRecords()[o],r.expanded&&s.TreeGrid.collapseRecord(l,r,a))},s.TreeGrid.updateAltRow=function(t,i,s,a){var n,o,r,l=t,d=0,h=l.model,c=h.currentViewData,u=c.length,m=i.isAltRow,p=l.getRows();if(o=l._frozenColumnsLength?l.getRows()[0]:l.getRows(),!h.rowTemplateID&&!h.altRowTemplateID)for(d=s+a;d0?(n=e(l.getRows()[0][i]),a=e(l.getRows()[1][i]),d.showDetailsRow&&d.detailsTemplate&&h.isDetailsExpanded&&(o=n.next("tr"),o.hasClass("e-detailsrow")&&(o.remove(),a.next("tr").remove())),n.replaceWith(e(e.render[l._id+"_JSONFrozenTemplate"](h))),a.replaceWith(e(e.render[l._id+"_Template"](h)))):(a=e(l.getRows()[i]),d.showDetailsRow&&d.detailsTemplate&&h.isDetailsExpanded&&(o=a.next("tr"),o.hasClass("e-detailsrow")&&o.remove()),d.allowSelection||(h.isSelected=!1),a.replaceWith(e(e.render[l._id+"_Template"](h)))),l.setGridRows(e(l.getContentTable().get(0).rows)),l._gridRows=l.getContentTable().get(0).rows,l._frozenColumnsLength>0&&(l._gridRows=[l._gridRows,l.getContentTable().get(1).rows]),r=s.TreeGrid.getRowByIndex(l,d.updatedRecords.indexOf(d.currentViewData[i])),l._trigger("refresh"),l._rowEventTrigger(r,h))},s.TreeGrid.getRowByIndex=function(t,i,a){var n,o,r,l,d;try{return n="ejTreeGrid"==t.pluginName?t:t._$treegridHelper.data("ejTreeGrid"),o=n.getRows(),r=n.model,updatedRecords=r.allowPaging?n._updatedPageData:r.updatedRecords,$row=e(),n.model.enableVirtualization&&(l=updatedRecords[i],i=n.model.currentViewData.indexOf(l)),s.isNullOrUndefined(a)?n._frozenColumnsLength>0?(o[0][i]&&($row.push(o[0][i]),$row.push(o[1][i])),$row):e(o[i]):(n.model.enableVirtualization&&(d=updatedRecords[a],a=n.model.currentViewData.indexOf(d)),n._frozenColumnsLength>0?($row.push(e(o[0]).slice(i,a)),$row.push(e(o[1]).slice(i,a)),$row):e(o.slice(i,a)))}catch(t){return e()}}}(jQuery,Syncfusion),function(e,t,s){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:[{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",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:null,cssClass:null,buttonSettings:{},splitButtonSettings:{},toggleButtonSettings:{},dropdownSettings:{}}],defaults:{}}]}]}],contextualTabs:[{backgroundColor:null,borderColor:null,tabs:[]}],tabSelect:null,tabClick:null,tabAdd:null,tabRemove:null,beforeTabRemove:null,tabCreate:null,create:null,groupClick: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,locale:"en-US",destory:null},dataTypes:{tabs:"array",contextualTabs:"array",disabledItemIndex:"data",enabledItemIndex:"data",selectedItemIndex:"number"},_destroy:function(){var t,i,s,a,n;for(a=this._applicationTab.find(".e-menu"),a.length>0&&a.data("ejMenu").destroy(),this.element.find(".e-rbncustomelement,.e-backstagetabarea,.e-gallerymenu").hide(),t=this.element.find(".e-gallerymenu"),n=0;n0&&this._tabObj.model.disabledItemIndex.indexOf(this.model.selectedItemIndex)===-1&&this._ribbonTabs.eq(this.model.selectedItemIndex).is(":visible")&&this._tabObj.option({selectedItemIndex:this.model.selectedItemIndex});break;case"disabledItemIndex":var s,u,m=this.model.disabledItemIndex.length,p=this.model.disabledItemIndex,g=this.element.find(".e-link");for(this.model.disabledItemIndex.push(0),this._tabObj.option({disabledItemIndex:this.model.disabledItemIndex}),o=0;o0)for(h=0;h0&&e(o).length>0&&e(n).height(e(o).parent().height()),this.element.find(".e-rbncustomelement,.e-backstagetabarea,.e-gallerymenu").show(),this._createQuickAccessBar()},_createQuickAccessBar:function(){var i,s,a,n,o,r;if(this.model.showQAT){for(i=t.buildTag("div.e-splitbtnqatdiv").attr("title",this.localizedLabels.CustomizeQuickAccess),s=t.buildTag("button#"+this._id+"_qatsplitbtn").addClass("e-splitbtnqat"),i.append(s.ejButton({size:"normal",type:"button",contentType:"imageonly",height:30,width:14,prefixIcon:"e-ribbon e-qatexpand",click:e.proxy(this._onQatExpandBtnClick,this)})),this._qAccessBar.append(i),a=t.buildTag("ul.e-rbnqatmenu","
    "+this.localizedLabels.CustomizeQuickAccess+"
    ").click(e.proxy(this._onQatMenuClick,this)),n=0;n"+this._qatControlsName[n].text+"

    ").appendTo(a).attr("title",this.localizedLabels.RemoveFromQuickAccessToolbar),"menu"==this._qatControlsName[n].qAccess&&o.addClass("e-addmenuli").removeClass("e-removemenuli").attr("title",this.localizedLabels.AddToQuickAccessToolbar);r="",r=this.model.showBelowQAT?"
  • "+this.localizedLabels.ShowAboveTheRibbon+"
  • ":"
  • "+this.localizedLabels.ShowBelowTheRibbon+"
  • ",a.append("
  • "+this.localizedLabels.MoreCommands+"
  • "+r),this._qAccessBar.append(a.hide())}},_tooltip:function(t){var i=this.element.find(".e-controlclicked");(i.length<=0||e(i).find(".e-ribbonbtn").length>0)&&(this.element.find("#"+t.data.ribbonId+"_resize").is(":visible")||this.element.find(".e-gallexpandcontent").is(":visible")?(e(t.target).parents(".e-resizediv").length>0||e(t.target).parents(".e-gallexpandcontent").length>0)&&this._toolTipShow(t):this._toolTipShow(t))},_toolTipShow:function(i){var s,a,n,o,r,l,d,h,c,u,m,p,g,_,f,b=this.element.find("#"+i.data.ribbonId+"_tooltip");b.find(".e-tooltiptitle").length<=0&&(h=t.buildTag("div#"+i.data.ribbonId+"_toolTip_title").addClass("e-tooltiptitle"),b.prepend(h)),b.removeClass("e-tooltipdivwithimg"),l=b.find(".e-tooltiptitle"),l.children().remove(),e(i.target).hasClass("e-rarrowup-2x")&&!t.isNullOrUndefined(this.model.expandPinSettings.toolTip)&&e(e(i.target).parent()).attr("title",this.model.expandPinSettings.toolTip),!e(i.target).hasClass("e-rarrowup-2x")||t.isNullOrUndefined(this.model.expandPinSettings.customToolTip.title)&&t.isNullOrUndefined(this.model.expandPinSettings.customToolTip.content)||(p=i.data.value.expandObj),e(i.target).hasClass("e-ribbonpinicon")&&!t.isNullOrUndefined(this.model.collapsePinSettings.toolTip)?e(e(i.target).parent()).attr("title",this.model.collapsePinSettings.toolTip):!e(i.target).hasClass("e-ribbonpinicon")||t.isNullOrUndefined(this.model.collapsePinSettings.customToolTip.title)&&t.isNullOrUndefined(this.model.collapsePinSettings.customToolTip.content)?e(i.target).hasClass("e-rarrowup-2x")||e(i.target).hasClass("e-ribbonpinicon")||(p=i.data.value):p=i.data.value.collapseObj,t.isNullOrUndefined(p)||t.isNullOrUndefined(p.customToolTip.title)?l.remove():l.append(p.customToolTip.title),t.isNullOrUndefined(p)||t.isNullOrUndefined(p.customToolTip.content)||(l.children().length<=0&&l.empty().append(""+p.customToolTip.title+""),r=b.find(".e-tooltipdesc"),r.children().remove(),r.append(p.customToolTip.content),r.children().length<=0&&r.empty().append("
    "+p.customToolTip.content+"
    "),t.isNullOrUndefined(p)||t.isNullOrUndefined(p.customToolTip.prefixIcon)?r.children().addClass("e-tooltipcontent"):(r.prepend(""),r.find(".e-tooltipimg").addClass(p.customToolTip.prefixIcon),r.children().not("."+p.customToolTip.prefixIcon).addClass("e-tooltipcntwithimg"),b.addClass("e-tooltipdivwithimg"))),t.isNullOrUndefined(p)||(a=this.element.find("#"+i.delegateTarget.id).offset(),s=this.element.find("#"+i.delegateTarget.id),b.stop(!0).delay(700).show(0).addClass("e-rbntooltipshadow"),o=this.element.find("#"+i.data.ribbonId+"_resize"),d=e(i.target).parents(".e-gallexpandcontent"),this.element.css({position:"relative"}),c=this.element.width()+this.element.offset().left-(a.left+parseInt(e(b).width(),10)),a.left=c<=0?a.left+c-this.element.offset().left:a.left-this.element.offset().left,m=this.element.find(".e-active-content"),u=m.is(":visible")?this._tabUl.height()+m.height():this._tabUl.height(),o.is(":visible")&&!d.is(":visible")?(b.offset({left:a.left}),n=s.parents(".e-galleryrow").length>0?u+s.position().top+s.parents(".e-galleryrow").height():u+s.position().top+s.height(),b.css({top:n})):d.is(":visible")?(g=s.parents(".e-galleryrow").length>0?s.parents(".e-galleryrow"):s.parents(".e-galleryexpanderrow").length>0?s.parents(".e-galleryexpanderrow"):s,n=e(d).parents(".e-resizediv").length>0?g.height()+u+s.position().top+12:g.height()+this._tabUl.height()+s.position().top+12,b.offset({left:a.left}),b.css({top:n})):e(i.target).parents(".e-qatooldiv").length>0||e(i.target).hasClass("e-qatooldiv")?(_=this.element.find(".e-qaresizediv"),f=this.element.find(".e-rbnquickaccessbar"),f.hasClass("e-rbnabove")&&_.length>0?_.is(":visible")&&b.offset({top:_.height()+f.height()+4,left:a.left}):f.hasClass("e-rbnabove")?b.offset({top:f.height()+4,left:a.left}):(n=_.is(":visible")?f.height()+_.height()+u+4:u+f.height()+4,b.offset({top:n,left:a.left}))):(n=u+3,b.offset({top:n,left:a.left})))},_toolTipOut:function(e){var t=this.element.find("#"+e.data.ribbonId+"_tooltip");t.hide(0),t.css({top:"",left:""}),t.find(".e-tooltiptitle").children().remove(),t.find(".e-tooltipdesc").children().remove()},_onGroupClick:function(i){var s,a,n,o,r,l;this._toolTipCustomization(i),parentElem=e(i.target).parents(".e-resizebtnselect"),this.element.find(".e-resizebtnselect").removeClass("e-resizebtnselect e-active"),e(i.target).hasClass("e-resizebtnselect")?e(i.target).removeClass("e-resizebtnselect e-active"):parentElem.length>0?parentElem.removeClass("e-resizebtnselect e-active"):(parentElem=e(i.target).parents(".e-resizebtn"),parentElem.length>0?parentElem.addClass("e-resizebtnselect e-active"):e(i.target).hasClass("e-resizebtn")&&e(i.target).addClass("e-resizebtnselect e-active")),this.model.showQAT&&(e(i.target).hasClass("e-togglebutton e-btn")||e(i.target).parents(".e-togglebutton.e-btn").length>0)&&(a=e(i.target),e(i.target).parents(".e-togglebutton.e-btn").length>0&&(a=e(i.target).parents(".e-togglebutton.e-btn")),s=a.parent().siblings().attr("id")+"_qatEle",this._rbnToggleBtnCustomization(i,s)),0===e(i.target).parents(".e-ribbongallerycontrol").length&&(this._trigger("groupClick",i),i.cancel||!t.raiseWebFormsServerEvents||t.isNullOrUndefined(this.model.serverEvents)||this.model.serverEvents.indexOf("groupClick")!=-1&&(n=e.extend(!0,{},this.model),o=i.target.id?i.target.id:i.target.parentNode.id,r={model:n,originalEventType:"groupClick",id:o},l={model:n,id:o},t.raiseWebFormsServerEvents("groupClick",r,l)))},_onResizeDivClick:function(t){if(this._toolTipCustomization(t),this.model.showQAT&&(e(t.target).hasClass("e-togglebutton e-btn")||e(t.target).parents(".e-togglebutton.e-btn").length>0)){var i,s=e(t.target);e(t.target).parents(".e-togglebutton.e-btn").length>0&&(s=e(t.target).parents(".e-togglebutton.e-btn")),i=s.parent().siblings().attr("id")+"_qatEle",this._rbnToggleBtnCustomization(t,i)}},_toolTipCustomization:function(t){var i=e(t.target).parents(".e-controlpadding");e(i).find(".e-ribbongallerycontrol").length<=0&&e(t.target).find(".e-disable").length<=0&&!e(t.target).hasClass("e-disable")&&(this.element.find(".e-tooltipdiv").hide(0),e(i).hasClass("e-controlclicked")?e(i).removeClass("e-controlclicked"):e(i).addClass("e-controlclicked"))},_onTabClick:function(t){var i,s,a=this.element.find(".e-rarrowup-2x"),n=this.element.find("li.e-active"),o=this.element.find(".e-collapseactive"),r=this.element.find(".e-active-content");n.length>0?(n.removeClass("e-active"),n.children().removeClass("e-active"),r.removeClass("e-active-content").hide()):o.length>0&&(t.activeHeader.textContent===o.find(".e-link").text()?(o.addClass("e-active").removeClass("e-collapseactive"),r.removeClass("e-collapse-content").slideDown("fast","swing",e.proxy(this._ribExpand,this))):(i=this.element.find(".e-link"),o.removeClass("e-collapseactive"),this.element.find(".e-collapse-content").removeClass("e-collapse-content"),r.removeClass("e-active-content"),s=i.eq(t.activeIndex).attr("href"),i.eq(t.activeIndex).addClass("e-active"),e(s).slideDown("fast","swing",e.proxy(this._ribExpand,this)))),a.length>0&&this.element.find(".e-collapsed").length>0&&this._addRibbonPin(),this._initialRender||this._trigger("tabClick",t),this._clickValue="click"},_onTabSelect:function(i){var s,a,n,o=this.element.find("li.e-active"),r=this.element.find(".e-expandcollapse");if(this.model.selectedItemIndex=i.activeIndex,o.hasClass("e-disable")||(s=this.element.find(".e-link"),a=s.eq(i.activeIndex).attr("href"),n=e(a).find("#"+this._id+"_disabled"),n&&this.element.find("#"+this._id+"_disabled").hide()),r.length>0&&r.appendTo(this.element.find(".e-active-content")),this._ribbonResize(),!this._initialRender&&(this._trigger("tabSelect",i),e(".e-menu-wrap").children(".e-split:visible").length>0&&e(e(".e-menu-wrap").children(".e-split")).css("display","none"),e(".e-rbn-ddl").parent(".e-ddl-popup:visible").length>0&&e(e(".e-rbn-ddl").parent(".e-ddl-popup:visible")).css("display","none"),e(".e-popupWrapper").parent(".e-colorpicker.e-ribbon:visible").length>0&&e(e(".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 l=e.extend(!0,{},this.model),d={model:l,originalEventType:"tabSelect",activeIndex:i.activeIndex,prevActiveIndex:i.prevActiveIndex},h={model:l,activeIndex:i.activeIndex,prevActiveIndex:i.prevActiveIndex};t.raiseWebFormsServerEvents("tabSelect",d,h)}this._initialRender=!1},_create:function(e){this._trigger("tabCreate",e)},_onGalMoveUpClick:function(t){var i=this.element.find("#"+t.data.galleryId),s=i.find(".e-gallerycontent").children(":visible").first().prev();this.element.find(".e-gallexpandcontent:visible").length>0&&this._ribbonGalleryShow(),s.length>0&&(i.find(".e-gallerycontent").children(":visible").last().hide(),s.show().width(i.find(".e-galleryrow").first().width()),e(s).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),s=i.find(".e-gallerycontent").children(":visible").last().next();this.element.find(".e-gallexpandcontent:visible").length>0&&this._ribbonGalleryShow(),s.length>0&&(i.find(".e-gallerycontent").children(":visible").first().hide(),s.show().width(i.find(".e-galleryrow").first().width()),e(s).hasClass("e-grylastrow")&&i.find(".e-movedowndiv").addClass("e-disablegrymovebtn"),i.find(".e-moveupdiv").removeClass("e-disablegrymovebtn"))},_onQatMenuItemClick:function(t){var i={target:e(t.target),cancel:!1,text:e(t.target).text()};this._trigger("qatMenuItemClick",i)},_onQatResizeBtnClick:function(t){var i,s=this.element.find(".e-qaresizediv"),a=this.element.find(".e-qaresizebtn");a.hasClass("e-active")?a.removeClass("e-tbtn e-active"):a.addClass("e-tbtn e-active"),s.is(":hidden")?(e(t.e.currentTarget).position().left+s.width()>this.element.width()?(i=e(t.e.currentTarget).position().left+s.width()-this.element.width(),s.show().css({left:e(t.e.currentTarget).position().left-i})):s.show().css({top:this._qAccessBar.height(),left:e(t.e.currentTarget).position().left}),this._qAccessBar.hasClass("e-rbnbelow")?s.css({top:this.element.height()}):s.css({top:this._qAccessBar.height()})):s.hide().css({top:"",left:""})},_onQatExpandBtnClick:function(t){var i,s=0,a=this.element.find(".e-splitbtnqat"),n=this.element.find(".e-qaresizediv"),o=this.element.find(".e-rbnqatmenu"),r=e(t.e.currentTarget);a.hasClass("e-active")?a.removeClass("e-tbtn e-active"):a.addClass("e-tbtn e-active"),n.length>0&&n.is(":visible")?(i=n.position().left+r.position().left+o.width(),i>this.element.width()&&(s=i-this.element.width()),o.show().css({top:n.height()-6,left:n.position().left+r.position().left-(s+6)})):(i=r.position().left+o.width(),i>this.element.width()&&(s=i-this.element.width()),o.show().css({left:r.position().left-s}))},_onQatClick:function(t){if(this.model.showQAT&&(e(t.target).hasClass("e-togglebutton e-btn")||e(t.target).parents(".e-togglebutton.e-btn").length>0)){var i,s=e(t.target);e(t.target).parents(".e-togglebutton.e-btn").length>0&&(s=e(t.target).parents(".e-togglebutton.e-btn")),i=s.parents(".e-qatooldiv").attr("id").slice(0,-7),this._rbnToggleBtnCustomization(t,i)}},_rbnToggleBtnCustomization:function(e,t){var i,s,a=this.element.find("#"+t+":input.e-togglebutton.e-chkbx-hidden"),n=a.siblings().find(".e-togglebutton");this._rbnToggleBtnAction&&(this._rbnToggleBtnAction=!1,s=a.data("ejToggleButton"),i=s.model.click,s.model.click="",n.click(),s.model.click=i),this._rbnToggleBtnAction=!0},_onQatMenuClick:function(t){var i,s=this.element.find(".e-rbnquickaccessbar"),a=e(t.target),n=a.parents(".e-qatmenuli");(a.hasClass("e-qatmenuli")||n.length>0)&&(n.length>0&&(a=n),a.attr("id")&&(i=this.element.find("#"+this._id+"_"+a.attr("id").slice(0,-7)+"_qatEle").parents(".e-qatooldiv"),i.is(":visible")?(i.hide(),a.addClass("e-addmenuli").removeClass("e-removemenuli").attr("title",this.localizedLabels.AddToQuickAccessToolbar)):(i.show(),a.removeClass("e-addmenuli").addClass("e-removemenuli").attr("title",this.localizedLabels.RemoveFromQuickAccessToolbar))),a.hasClass("e-rbnshowbelow")?(this.element.append(s.removeClass("e-rbnabove").addClass("e-rbnbelow")).removeClass("e-rbnwithqatabove").addClass("e-rbnwithqatbelow"),a.addClass("e-rbnshowabove").removeClass("e-rbnshowbelow").text(this.localizedLabels.ShowAboveTheRibbon),this.model.showBelowQAT=!0):a.hasClass("e-rbnshowabove")&&(this.element.prepend(s.removeClass("e-rbnbelow").addClass("e-rbnabove")).removeClass("e-rbnwithqatbelow").addClass("e-rbnwithqatabove"),a.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);e(t.target).hasClass("e-gallerybtn")?(i.find(".e-galleryselect").removeClass("e-galleryselect"),e(t.target).addClass("e-galleryselect")):e(t.target).parents(".e-gallerybtn")&&(i.find(".e-galleryselect").removeClass("e-galleryselect"),e(t.target).parents(".e-gallerybtn").addClass("e-galleryselect"))},_onExpandContentClick:function(t){var i=this.element.find("#"+t.data.galleryId);e(t.target).hasClass("e-gallerybtn")?(i.parent().find(".e-galleryselect").removeClass("e-galleryselect"),e(t.target).addClass("e-galleryselect")):e(t.target).parents(".e-gallerybtn")&&(i.parent().find(".e-galleryselect").removeClass("e-galleryselect"),e(t.target).parents(".e-gallerybtn").addClass("e-galleryselect"))},_onExpandGalleryClick:function(i){var s,a,n,o,r,l=this.element.find("#"+i.data.galleryId),d=i.data.expandedColumns;for(this.element.find(".e-gallexpandcontent:visible").length>0&&this._ribbonGalleryShow(),t.isNullOrUndefined(i.data.expandedColumns)&&(d=i.data.columns),s=Math.floor(l.find(".e-galleryrow").children().length/d),l.find(".e-galleryrow").children().length%d>0&&++s,a=1;a<=s;a++){for(n=t.buildTag("div#"+l.attr("id")+"_galleryExpanderRow_"+a).addClass("e-galleryexpanderrow").click({model:l},e.proxy(this._onGalleryItemClick,this)),o=0;o
    ");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("#"+l.attr("id")).parent().find(".e-gallexpandcontent").show(),this.element.find("#"+l.attr("id")).parent().find(".e-expandercontent").height()>160&&this.element.find("#"+l.attr("id")).parent().find(".e-gallscrollcontent").ejScroller({height:160})},_onGalleryItemClick:function(i){var s,a,n,o,r;s={target:i.target,galleryModel:i.data.model,cancel:!1},e(s.target).hasClass("e-galleryexpanderrow")||(this._trigger("galleryItemClick",s),i.preventDefault(),t.raiseWebFormsServerEvents&&!t.isNullOrUndefined(this.model.serverEvents)&&this.model.serverEvents.indexOf("galleryItemClick")!=-1&&(a=e.extend(!0,{},this.model),n=s.target.id?s.target.id:s.target.parentNode.id,o={model:a,originalEventType:"galleryItemClick",id:n},r={model:i.data.model,id:n},t.raiseWebFormsServerEvents("galleryItemClick",o,r)))},_ribbonKeyDown:function(e){(40===e.keyCode||39===e.keyCode)&&this._tabUl.find(".e-tab:visible,.e-contextualtabset:visible").length===this._tabObj.model.selectedItemIndex&&e.stopImmediatePropagation()},_OnKeyDown:function(t){var i,s;27===t.keyCode&&(i=this.element.find(".e-resizediv"),this.element.find(".e-ribbonbackstagepage").is(":visible")?this.hideBackstage():e(".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"),s=this.element.find("#"+this._id+"_modelDiv"),s.is(":visible")&&s.css("display","none"))},_ribCollapse:function(e){var e={clickType:this._clickValue};null==this._clickValue&&(e={clickType:"click"}),this._clickValue=null,this._trigger("collapse",e)},_ribExpand:function(e){this.element.find(".e-ribbonpin").length>0&&this._tabContents.width(this.element.width());var e={clickType:this._clickValue};null==this._clickValue&&(e={clickType:"click"}),this._clickValue=null,this._trigger("expand",e)},collapse:function(){var t=this.element.find(".e-active-content"),i=this.element.find("#"+this._id+"_togglebutton");t.slideUp("fast","swing",e.proxy(this._ribCollapse,this)),this.element.find("li.e-active").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"),i=this.element.find("#"+this._id+"_togglebutton");t.slideDown("fast","swing",e.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._ribbonResize(),this._addRibbonPin()},_addRibbonPin:function(){if(this.element.find(".e-ribbonpinicon").length<=0){var e=(this.element.find(".e-expandcollapse"),this.element.find(".e-rarrowup-2x"));e.parent().removeClass("e-collapsed").addClass("e-expanded e-ribbonpin"),e.removeClass("e-rarrowup-2x").addClass("e-ribbonpinicon"),this._isCollapsed=!1}this._tabContents.css({position:"absolute"}).width(this.element.width())},_removeRibbonPin:function(){var e=this.element.find("#"+this._id+"_togglebutton");this._tabContents.css({position:"",width:""}),e.removeClass("e-ribbonpin"),e.find("span").removeClass("e-ribbonpinicon").addClass("e-rarrowup-2x")},_onRbnPinDivClick:function(){this._removeRibbonPin()},_onGroupExpandClick:function(e){this._trigger("groupExpand",e)},_onBackStageItemClick:function(i){var s,a,n,o,r;i.preventDefault(),e(i.target).hasClass("e-backstagebutton")&&this.element.find(".e-ribbonbackstagepage").hide(),this.element.find(".e-backstageactive-content").removeClass("e-backstageactive-content").hide(),this.element.find(".e-backstageactive").removeClass("e-backstageactive"),this.element.find(i.data.contentDivId).addClass("e-backstageactive-content").show(),e(i.target).hasClass("e-backstageli")?e(i.target).addClass("e-backstageactive"):e(i.target).parents(".e-backstageli").addClass("e-backstageactive"),s=this.element.find(".e-ribbonbackstagetop").height(),this.element.find(".e-backstagescrollcontent").ejScroller({height:0}),r=i.data.height,this._backStageHeightCalculate(r,s),n=t.isNullOrUndefined(e(i.target).text())?e(i.target).children("a").text():e(i.target).text(),a=t.isNullOrUndefined(e(i.target).attr("id"))?e(i.target).parent().attr("id"):e(i.target).attr("id"),o={id:a,text:n,target:i.target,type:"backstageItemClick",cancel:!1},this.element.find(".e-backstagetitlecontent").text("").append(n),this._trigger("backstageItemClick",o)},_onBackStageTopIcon:function(){this.hideBackstage()},_backStageHeightCalculate:function(e,i){t.isNullOrUndefined(e)||(e.toString().endsWith("%")?e=this.element.find(".e-ribbonbackstagepage").height():e.toString().endsWith("px")&&(e=parseInt(e,10)),"100%"!=this.model.applicationTab.backstageSettings.height&&(this.element.find(".e-backstageactive-content").height()>e-i?this.element.find(".e-backstagescrollcontent").ejScroller({height:e-i}):t.isNullOrUndefined(e)&&this.element.find(".e-backstageactive-content").height()>this.element.height()-i&&this.element.find(".e-backstagescrollcontent").ejScroller({height:this.element.height()-i})))},_onApplicationTabClick:function(){this.showBackstage()},showBackstage:function(){var i,s,a,n,o,r,l,d,h;d=this.element.find(".e-ribbonbackstagebody"),h=this.element.find(".e-backstageheader"),n=this.model.applicationTab.backstageSettings.height,this.model.applicationTab.type===t.Ribbon.ApplicationTabType.Backstage&&(t.isNullOrUndefined(n)?(this.element.find(".e-ribbonbackstagepage").height(this.element.height()).width(this.element.width()),d.height(this.element.height()-100),h.height(this.element.height()-100)):(d.height(n-100),h.height(n-100)),this.element.css({position:"relative"}),this.element.find(".e-ribbonbackstagepage").show(),i=this.element.find(".e-backstageheader").width(),this.element.find(".e-backstagetopcontent").width(i),this.element.find(".e-backstageheader").width(i),l=this.element.find(".e-backstageli"),l.width(l.width()),a=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"),l.first().addClass("e-backstageactive"),this.element.find(".e-backstagecontent").first().addClass("e-backstageactive-content").show(),this.element.find(".e-backstagescrollcontent").ejScroller({height:0}),this._backStageHeightCalculate(n,a),o=this.element.find(".e-backstageli").first(),r=t.isNullOrUndefined(e(o).text())?e(o).children("a").text():e(o).text(),s={id:e(o).attr("id"),text:r,target:e(o).children(),type:"backstageItemClick",cancel:!1},this.element.find(".e-backstagetitlecontent").text("").append(r),this._trigger("backstageItemClick",s))},hideBackstage:function(){this.element.find(".e-ribbonbackstagepage").hide()},_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()},_getLocalizedLabels:function(){return t.getLocalizedConstants(this.sfType,this.model.locale)},_customization:function(){var i,s,a,n,o,r,l,d,h,c,u,m,p,g,_,f,b={},v={};if(this._contextualTabs(),i="
    ',s=t.buildTag("li#"+this._id+"_expandCollapse.e-expandcollapse",i),this.element.find(".e-active-content").append(s),v.expandObj=this.model.expandPinSettings,v.collapseObj=this.model.collapsePinSettings,s.mouseover({value:v,ribbonId:this._id},e.proxy(this._tooltip,this)).mouseout({ribbonId:this._id},e.proxy(this._toolTipOut,this)),this.model.applicationTab.type===t.Ribbon.ApplicationTabType.Menu?(this._applicationTab.find(".e-link").hide(),this.model.applicationTab.menuSettings&&(b=this.model.applicationTab.menuSettings),this.model.applicationTab.menuItemID&&(e("#"+this.model.applicationTab.menuItemID).appendTo(this._applicationTab),e("#"+this.model.applicationTab.menuItemID).addClass("e-rbncustomelement").ejMenu(b)),e("#"+this._id+"_"+this.model.applicationTab.type.replace(/\s/g,"")).hide()):this._applicationTab.find(".e-link").text(this.model.applicationTab.backstageSettings.text),this._applicationTab.click(e.proxy(this._onApplicationTabClick,this)),this.element.find(".e-content").css("box-sizing","content-box"),this.model.applicationTab.type===t.Ribbon.ApplicationTabType.Backstage){for(_=this.model.applicationTab.backstageSettings.height,_.toString().endsWith("%")?_=e(document).height()*(parseInt(_.slice(0,-1),10)/100):_.toString().endsWith("px")&&(_=parseInt(_,10)),a=t.buildTag("div#"+this._id+"_BackStage").addClass("e-ribbonbackstagepage").height(_).width(this.model.applicationTab.backstageSettings.width).hide(),c=t.buildTag("div#"+this._id+"_BackStageBody").addClass("e-ribbonbackstagebody").height(_-50),o=t.buildTag("ul#"+this._id+"_BackStageHeader").addClass("e-backstageheader").height(_-50),f=0;f0&&n.hide(),this.model.applicationTab.backstageSettings.pages[f].contentID&&(e("#"+this.model.applicationTab.backstageSettings.pages[f].contentID).find("*").addClass("e-backstagechild"),e(n).append(e("#"+this.model.applicationTab.backstageSettings.pages[f].contentID).addClass("e-backstagetabarea"))),c.append(n));c.prepend(o),h=t.buildTag("div#"+this._id+"_BackStageTop").addClass("e-ribbonbackstagetop").height(100),u=t.buildTag("div#"+this._id+"_BackStageTopContent").addClass("e-backstagetopcontent").appendTo(h),m=t.buildTag("div#"+this._id+"_BackStageTitleContent").addClass("e-backstagetitlecontent").appendTo(h),p=t.buildTag("div#"+this._id+"_BackStageTopIcon","").addClass("e-backstagetopicon").click(e.proxy(this._onBackStageTopIcon,this)).appendTo(u),a.append(h),d=t.buildTag("div#"+this._id+"_backStageScrollContent","
    ").addClass("e-backstagescrollcontent"),d.children().append(c),a.append(d),this._applicationTab.addClass("e-backstagetab"),this._applicationTab.find("a").addClass("e-apptabanchor"),t.isNullOrUndefined(this.model.applicationTab.backstageSettings.headerWidth)||(u.width(this.model.applicationTab.backstageSettings.headerWidth),o.width(this.model.applicationTab.backstageSettings.headerWidth)),this.element.prepend(a)}},_conTabsRemove:function(){for(var t,i=this.element.find(".e-contextli,.e-contextliset"),s=0;s0){for(s=t.buildTag("li.e-contextliset"),this._contextualTabSet=this._tabUl.children(".e-contextualtabset").filter(function(){return e(this).text()===i.tabs[0].text}),this._contextualTabSet.before(s),this._tabUl.children(".e-contextualtabset").find("a").css("color",i.borderColor),a=t.buildTag("ul.e-contextual","",{background:i.backgroundColor,"border-top-color":i.borderColor}),o=0;o0?l.hide():this._tabText.filter(function(){return e(this).text()===t}).parent().hide(),e(r).hasClass("e-active-content")&&(e(r).hide(),e(r).removeClass("e-active-content"))),this._tabUl.find(".e-active").is(":hidden")&&(i=this._getVisibleItemIndex(this._tabText),i&&(s=this.element.find(".e-link").eq(i).attr("href"),e(this._tabText[i]).parent().hasClass("e-disable")?(e(this._tabText[a]).parent().removeClass("e-active"),e(this._tabText[i]).parent().addClass("e-active"),e(s).append(this.element.find("#"+this._id+"_disabled")),e(s).css("position","relative"),this.element.find("#"+this._id+"_disabled").show(),e(s).show(),this._tabObj.option("selectedItemIndex",i)):this._tabObj.option("selectedItemIndex",i),this._tabObj.model.selectedItemIndex=i,this.model.selectedItemIndex=i))},showTab:function(t){var i,s=(this._tabText.map(function(i){if(e(this).text()===t)return i})[0],this._tabText.filter(function(){return e(this).text()===t}).parent());i=this._tabText.filter(function(){return e(this).text()===t}).parents(".e-contextualtabset"),i.length>0?i.show():this._tabText.filter(function(){return e(this).text()===t}).parent().show(),s.hasClass("e-active")||s.addClass("e-select")},_getVisibleItemIndex:function(t){for(var i=1;i0&&(a={index:t},this._trigger("beforeTabRemove",a),this._ribbonTabs=this._tabUl.find(".e-link").parent(),s=this._ribbonTabs.eq(t).children().attr("href"),i=this._ribbonTabs.eq(t),i.hasClass("e-contextualtab")?i.parent().remove():i.hasClass("e-contextualtabset")&&0===i.siblings(".e-contextualtabset").length?i.parent().remove():i.remove(),e(s).remove(),this._tabObj.model.selectedItemIndex===t&&(this._ribbonTabs=this._tabUl.find(".e-link").parent(),i=this._ribbonTabs.eq(t),i.addClass("e-active"),s=i.children().attr("href"),e(s).addClass("e-active-content e-activetop").show()),a={removedIndex:t},this._trigger("tabRemove",a))},removeTabGroup:function(i,s){var a,n,o,r,l,d,h,c;if(a=e(e(".e-ribbon .e-content")[i]).find(".e-groupdiv"),n=this._tabUl.find(".e-select,.e-active").eq(i),e(n).hasClass("e-tab"))for(o=this.model.tabs[i-1].groups,d=0;d0?e(n).children().eq(a).before(h):e(n).append(h))},addTabGroupContent:function(i,s,a,n,o){var r,l,d,h,c,u,m,p,g,_,f,b,v=0;if(d=this._tabUl.find(".e-select,.e-active").eq(i),r=d.children("a").attr("href"),d.hasClass("e-tab"))for(f=0;f0?m.find(".e-controlpadding").eq(o).before(g.children()):m.append(g.children()),e(m).parent().height()>_&&this.element.find(".e-content").height(this.element.find(".e-content").height()+(e(m).parent().height()-_)),c.children().remove())},addTab:function(e,s,a){var n,o,r,l={id:e.replace(/\s/g,""),text:e,groups:s};this.model.tabs.length;if(t.isNullOrUndefined(a)&&(a=this._tabUl.find(".e-select,.e-active").length),a>0){for(this._conTabsRemove(),this._tabObj.addItem("#"+this._id+"_"+e.replace(/\s/g,""),e,a),this._contextualTabs(),this._tabUl.find(".e-select,.e-active").eq(a).addClass("e-tab"),this._tabUl.find(".e-select > a,.e-active > a ").eq(a).addClass("e-link"),this.model.tabs.splice(a-1,0,l),i=0;i<1;i++)for(tabs=this.model.tabs[a-1],j=0;j0){for(this._conTabsRemove(),s=0;s a ,.e-active > a ").eq(i).addClass("e-link"),++i;for(this.model.contextualTabs[0].tabs.length>0?this.model.contextualTabs.splice(i-1,0,e):this.model.contextualTabs[0]=e,this._contextualTabs(),s=0;s=1&&!t.isNullOrUndefined(this.model.tabs[0].id)&&!t.isNullOrUndefined(this.model.tabs[0].text))for(o=0;o0&&++I,P=1;P<=I;P++){for(L=t.buildTag("div#"+this._id+"_"+gallery.id+"_galleryrow_"+P).addClass("e-galleryrow").click({model:gallery},e.proxy(this._onGalleryItemClick,this)),1===P?L.addClass("e-gryfirstrow"):P===I&&L.addClass("e-grylastrow"),R=1;R<=gallery.columns;R++)M=k.find(".e-galleryrow").children().length+L.children().length,t.isNullOrUndefined(gallery.galleryItems[M])||(O=t.buildTag("button#"+gallery.id+"_galleryItem_"+(M+1),gallery.galleryItems[M].text,{},{type:"button"}).addClass("e-gallerybtn"),e.isEmptyObject(gallery.galleryItems[M].customToolTip)?t.isNullOrUndefined(gallery.galleryItems[M].toolTip)||O.attr("title",gallery.galleryItems[M].toolTip):O.mouseover({value:gallery.galleryItems[M],ribbonId:this._id},e.proxy(this._tooltip,this)).mouseout({ribbonId:this._id},e.proxy(this._toolTipOut,this)),N={},gallery.galleryItems[M].buttonSettings&&(N=gallery.galleryItems[M].buttonSettings),N.height=gallery.itemHeight<=65?gallery.itemHeight:65,N.width=gallery.itemWidth,O.ejButton(N),O.appendTo(L));D=gallery.itemHeight>65?1:k.height()/gallery.itemHeight,P>D&&L.hide(),L.appendTo(k)}this._gallery.append(k);var y=t.buildTag("div#"+this._id+"_"+gallery.id+"_PagesDiv").addClass("e-gallerymovediv"),C=t.buildTag("div#"+this._id+"_"+gallery.id+"_prevPage","").click({galleryId:this._gallery.attr("id"),rowCnt:D},e.proxy(this._onGalMoveUpClick,this)).addClass("e-moveupdiv e-disablegrymovebtn"),S=t.buildTag("div#"+this._id+"_"+gallery.id+"_nextPage","").click({galleryId:this._gallery.attr("id")},e.proxy(this._onGalMoveDownClick,this)).addClass("e-movedowndiv"),T=t.buildTag("div#"+this._id+"_"+gallery.id+"_expandGallery","").click({galleryId:this._gallery.attr("id"),columns:gallery.columns,expandedColumns:gallery.expandedColumns,itemWidth:gallery.itemWidth},e.proxy(this._onExpandGalleryClick,this)).addClass("e-expgallerydiv");y.append(C),y.append(S),y.append(T),this._gallery.append(y);var z=t.buildTag("div#"+this._id+"_"+gallery.id+"_ExpandContent").addClass("e-gallexpandcontent").hide(),F=t.buildTag("div#"+this._id+"_"+gallery.id+"_scrollContent","
    ").addClass("e-gallscrollcontent"),B=t.buildTag("div#"+this._id+"_"+gallery.id+"_ExpanderContent").addClass("e-expandercontent").click({galleryId:this._gallery.attr("id")},e.proxy(this._onExpandContentClick,this));if(F.children().append(B),z.append(F),!t.isNullOrUndefined(gallery.customGalleryItems)){for(E=t.buildTag("div#"+this._id+"_"+gallery.id+"_ExtraContent").addClass("e-extracontent").click({model:gallery},e.proxy(this._onGalleryItemClick,this)),A=0;A0&&(this.model.tabs[u]=i.tabs[c],++u);for(r=0;r0?this.collapse():(this._removeRibbonPin(),this.model.showQAT&&this._qAccessBar.show(),this._trigger("pinState",{action:"pin"})),this._clickValue="click")},_ribbonWindowResize:function(){(this.model.allowResizing||this.model.isResponsive)&&(this.element.find(".e-ribbonpin").length>0&&this.element.find(".e-active-content").is(":visible")?this.collapse():this._ribbonResize()),this.element.find(".e-ribbonpin").length>0&&this._tabContents.width(this.element.width())},_ribbonResize:function(){var i,s,a,n,o,r,l,d,h,c,u,m,p,g,_,f,b,v,x,w,y,C,S,T,D,I,k,P,L,R,M,O,E=0,A=[],j=this.element.find(".e-active-content"),N=this.element.find(".e-ribbonpin");if(v=this._tabUl.find("li.e-select:visible,li.e-active:visible"),x=this.element.find(".e-resizediv"),expandDiv=this.element.find(".e-expandcollapse"),g=this.element.find(".e-header"),N.length>0&&(this._removeRibbonPin(),expandDiv.children().addClass("e-ribbonpin")),g.is(":hidden")&&j.is(":hidden")&&this._resizeWidth<=this.element.width()+this.element.offset().left&&(g.show(),this._qAccessBar.show(),(this.element.find(".e-expandcollapse").children().hasClass("e-expanded")||g.find(".e-active").length>0)&&(N.length<=0?(j.show(),expandDiv.children().addClass("e-expanded").removeClass("e-collapsed")):N.length>0&&this.collapse())),b=g.find("li.e-select,li.e-active"),r=b.length,g.is(":visible")){for(D=r-1;D>0;D--)for(l=b.eq(D).children(),d=l.text().length-1,P=d;P>1;P--)v.length>0&&(n=v.last().offset().left,o=v.last().width(),this.element.width()+this.element.offset().left-30-(n+o)<=0&&(l.hasClass("e-resizeHead")?l.text(l.text().slice(0,-1)):l.text(l.text().slice(0,-1)).addClass("e-resizeHead")));w=g.find(".e-resizeHead"),r-1===w.length&&w.eq(0).text().length<=2&&v.length>0&&(n=v.last().offset().left,o=v.last().width(),this.element.width()+this.element.offset().left-30-(n+o)<=0&&(this._resizeWidth=this.element.width()+this.element.offset().left,g.hide(),this._qAccessBar.hide(),j.hide(),expandDiv.children().addClass("e-collapsed").removeClass("e-expanded")))}if(a=this._tabObj.model.selectedItemIndex,f=this.element.find(".e-content"),i=f.eq(a).attr("id"),h=f.eq(a).children(".e-groupdiv").length,s=f.eq(a).children(".e-groupdiv")[h-1],_=f.eq(a).children().eq(h-1).find(".e-resizebtn"),!t.isNullOrUndefined(s)){for(T=h-1;T>=0;T--)_=f.eq(a).children().eq(T).find(".e-resizebtn"),this.element.width()+this.element.offset().left-25-(s.offsetWidth+e(s).offset().left)<=0&&0===_.length&&this._createResizeBtn(a,T);this.element.width()+this.element.offset().left-25-(s.offsetWidth+e(s).offset().left)<=0&&h===f.eq(a).find(".e-resizebtn").length&&(this._resizeWidth=this.element.width()+this.element.offset().left,g.hide(),this._qAccessBar.hide(),j.hide(),expandDiv.children().addClass("e-collapsed").removeClass("e-expanded"))}for(this._qatResize(),x.is(":visible")&&(y=x.children().eq(0).attr("id"),y="#"+y.replace("_content",""),x.children().hide().appendTo(y),x.hide()),C=0;C0&&(n=v.last().offset().left,o=v.last().width()+15,this.element.width()+this.element.offset().left-30>=n+o&&(l.text().length===A[I].length?l.removeClass("e-resizeHead"):l.text(A[I].slice(0,l.text().length+1))));for(E=f.eq(a).find(".e-resizebtn").length,L=0;L1)for(R=1;Rc&&(M=m.parent().siblings(),m.parent().remove(),M.show(),M.not(".e-contentbottom").css("width",""))}this._qatResizeRemove(),p=this.element.find(".e-tooltipdiv"),p.hide(),p.find(".e-tooltiptitle").children().remove(),p.find(".e-tooltipdesc").children().remove(),this.element.find(".e-ribbonpin").length>0&&this.element.find(".e-active-content").is(":visible")&&(this._addRibbonPin(),this._tabContents.width(this.element.width())),this.element.find(".e-resizebtnselect").removeClass("e-resizebtnselect e-active"),this.model.showQAT&&(O=this.element.find(".e-rbnqatmenu"),O.is(":visible")&&O.hide().css({top:"",left:""}),this.element.find(".e-qaresizebtn,.e-splitbtnqat").removeClass("e-tbtn e-active"))},_qatResize:function(){var i,s,a,n,o;if(this.model.showQAT&&this._qAccessBar.is(":visible")){for(a=0;a0&&this._qAccessBar.is(":visible")&&this.model.showQAT){for(i.show(),e=this.element.find(".e-qaresizebtndiv"),t=0;t2?a+i.children().eq(0).width():a+i.width(),s>a&&(i.children().length>2?i.children().eq(0).insertBefore(e):(i.children().insertBefore(e),this.element.find(".e-qaresizebtndiv").remove(),i.remove()));i.hide()}},_createResizeBtn:function(i,s){var a,n,o,r,l,d=this.element.find(".e-content");o=d.eq(i).children(".e-groupdiv").eq(s),l=o.height(),a=o.find(".e-contentbottom").text(),r=o.children().not(".e-contentbottom"),n=r.width(),o.children().hide(),r.css("width",n);var h=t.buildTag("div#"+this._id+"_resizeDiv_"+a),c=t.buildTag("button#"+this._id+"_resizebtn_"+a,a,{},{type:"button"}).addClass("e-resizebtn"),u={target:d.eq(i).children(".e-groupdiv").eq(s).children()};c.ejButton({click:e.proxy(this._resizeBtnClick,u),contentType:t.ContentType.TextAndImage,imagePosition:t.ImagePosition.ImageBottom,prefixIcon:"e-ribbonresize"}),o.height(l),c.find("div").prepend("").height(l-5),c.appendTo(h),h.appendTo(d.eq(i).children(".e-groupdiv").eq(s))},_resizeBtnClick:function(){},_ribbonDocClick:function(i){var s,a,n,o,r,l,d,h=this.element.find(".e-gallexpandcontent");if(r=this.element.find("#"+this._id+"_modelDiv"),l=this.element.find(".e-active-content"),r.is(":visible")&&r.hide(),h.hasClass("e-gallerypopupshow")&&(h.removeClass("e-gallerypopupshow"),r.hide()),(e(".e-rbn-splitbtn").parents().hasClass("e-active")||this.element.find(".e-resizebtn").hasClass("e-resizebtnselect")||e(".e-ddl-popup.e-rbn-ddl:visible").length>0||this.element.find(".e-colorwidget").hasClass("e-active"))&&l.append(r.show().height("100%")),d=e(".e-ribbonpopup:visible"),d.length>0&&!d.hasClass("e-ribbonpopupshow")?(d.addClass("e-ribbonpopupshow"),l.append(r.show().height("100%"))):d.hasClass("e-ribbonpopupshow")&&d.removeClass("e-ribbonpopupshow"),(e(i.target).hasClass("e-expgallerydiv")||e(i.target).parents(".e-expgallerydiv").length>0)&&(h.addClass("e-gallerypopupshow"),l.append(r.show().height("100%"))),s=e(i.target).parents(".e-resizediv"),s.length<=0&&(e(i.target).hasClass("e-resizebtn")?s=e(i.target):t.isNullOrUndefined(e(i.target).parents(".e-resizebtn"))||(s=e(i.target).parents(".e-resizebtn"))),this.element.find(".e-resizediv").is(":visible")&&this.element.find(".e-resizediv .e-gallexpandcontent").is(":visible"))e(i.target).hasClass("e-gallerymoveicon")||e(i.target).hasClass("e-gallerymovediv")||e(i.target).hasClass("e-expgallerydiv")||e(i.target).hasClass("e-scrollbar")||e(i.target).parents().hasClass("e-scrollbar")?a=i.target:e(i.target).parents().hasClass("e-gallerymenu")&&(e(i.target).hasClass("e-haschild")||e(i.target).hasClass("aschild")||e(i.target).hasClass("e-arrows"))&&(a=i.target),t.isNullOrUndefined(a)&&(this._ribbonGalleryShow(),this.element.find(".e-resizediv").show().css("visibility",""),this.element.find(".e-resizediv .e-gallexpandcontent").hide().css("visibility",""));else if(s.length<=0){if(!e(i.target).parents(".e-content").length>0&&e(i.target).parents(".e-rbn-ddl").length>0||e(i.target).parents(".e-rbn-splitbtn").length>0||e(i.target).parents(".e-presetWrapper").length>0||e(i.target).parents(".e-ribbonpopup").length>0||e(i.target).parents(".e-colorpicker.e-ribbon:visible").length>0)return!1;this._resizeDivHide()}else e(s).hasClass("e-resizebtn")&&(this.element.find(".e-resizediv").is(":visible")?s.parent().siblings(".e-contentbottom").length<=0?this._resizeDivHide():(this._resizeDivHide(),this._resizeDivShow(s)):this._resizeDivShow(s));if(e(i.target).hasClass("e-gallerymoveicon")||e(i.target).hasClass("e-gallerymovediv")||e(i.target).hasClass("e-expgallerydiv")||e(i.target).hasClass("e-scrollbar")||e(i.target).parents().hasClass("e-scrollbar")?a=i.target:e(i.target).parents().hasClass("e-gallerymenu")&&(e(i.target).hasClass("e-haschild")||e(i.target).hasClass("aschild")||e(i.target).hasClass("e-arrows"))&&(a=i.target),t.isNullOrUndefined(a)&&this._ribbonGalleryShow(),n=this.element.find(".e-tooltipdiv"),disabled=e(i.target).find(".e-disable"),n.is(":visible")&&e(disabled).length<=0&&!e(i.target).hasClass("e-disable")&&n.hide(),(e(i.target).hasClass("e-backstagechild")||e(i.target).hasClass("e-ribbonbackstagepage")||e(i.target).hasClass("e-apptab")||e(i.target).parents(".e-ribbonbackstagepage").length>0||e(i.target).parents(".e-apptab").length>0)&&(a=i.target),t.isNullOrUndefined(a)&&this.element.find(".e-ribbonbackstagepage").hide(),!e(i.target).hasClass("e-disable-item")&&e(i.target).parents(".e-disable-item").length<=0&&this.element.find(".e-controlclicked").removeClass("e-controlclicked"),o=e(i.target).parents(".e-controlpadding"),o.length>0&&e(disabled).length<=0&&!e(i.target).hasClass("e-disable")&&e(o).find(".e-ribbongallerycontrol").length<=0&&e(o).addClass("e-controlclicked"),this.element.find(".e-ribbonpin").is(":visible")&&e(i.target).parents(".e-ribbon").length<=0&&!e(i.target).hasClass("e-scrollbar")&&!e(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 c=this.element.find(".e-rbnqatmenu"),u=this.element.find(".e-qaresizediv"),m=this.element.find(".e-splitbtnqat");!e(i.target).hasClass("e-splitbtnqatdiv")&&e(i.target).parents(".e-splitbtnqatdiv").length<=0&&e(i.target).parents(".e-rbnqatmenu").length<=0&&c.hide().css({top:"",left:""}),!e(i.target).hasClass("e-qaresizebtndiv")&&c.is(":hidden")&&e(i.target).parents(".e-qaresizediv").length<=0&&e(i.target).parents(".e-qaresizebtndiv").length<=0&&!e(i.target).hasClass("e-splitbtnqatdiv")&&e(i.target).parents(".e-splitbtnqatdiv").length<=0&&u.hide().css({top:"",left:""}),u.is(":hidden")&&this.element.find(".e-qaresizebtn").hasClass("e-active")&&!e(i.target).hasClass("e-qaresizebtndiv")&&e(i.target).parents(".e-qaresizebtndiv").length<=0&&e(i.target).parents(".e-rbnqatmenu").length<=0&&this.element.find(".e-qaresizebtn").removeClass("e-tbtn e-active"),m.hasClass("e-active")&&!e(i.target).hasClass("e-splitbtnqatdiv")&&e(i.target).parents(".e-splitbtnqatdiv").length<=0&&e(i.target).parents(".e-rbnqatmenu").length<=0&&m.removeClass("e-tbtn e-active")}},_ribbonGalleryShow:function(){var t,i,s,a,n,o,r=0;if(this.element.find(".e-gallexpandcontent:visible").length>0){for(t=0,i=0,gallery=this.element.find(".e-gallexpandcontent:visible").parent().find(".e-ribbongallery"),o=1;o<=gallery.find(".e-galleryrow").length;o++)"block"===gallery.find(".e-galleryrow").eq(o-1).css("display")&&(0===t&&(r=o-1),++t);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(),s=0;s0?gallery.find(".e-galleryrow").eq(s+o).show():(++i,gallery.find(".e-galleryrow").eq(s-i).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(s).append(gallery.parent().find(".e-galleryexpanderrow").children().eq(0));if(gallery.find(".e-galleryselect").length<=0)for(o=0;o0&&e(s).css({top:""}))},_resizeDivShow:function(t){var i,s,a,n,o=this.element.find(".e-resizediv");a=this.element.find("#"+t[0].id).parent().siblings(),i=a.not(".e-contentbottom").width()+a.parent().offset().left,this.element.css({position:"relative"}),e(o).css({left:""}),i>this.element.width()+this.element.offset().left?(s=a.parent().position().left-(i-(this.element.width()+this.element.offset().left)),n=parseInt(e(o).css("padding-left"),10)+parseInt(e(o).css("padding-right"),10),e(o).offset({left:s-n})):e(o).offset({left:a.parent().position().left}),this.element.find(".e-ribbonpin").length>0&&e(o).offset({top:this.element.height()+this.element.find(".e-active-content").height()}),e(o).width(a.not(".e-contentbottom").css("width")),e(o).append(a.show()).show(),this._on(e(document),"mousedown",this._rbndocumentClick)},_rbndocumentClick:function(t){this.element.find(".e-resizediv").is(":visible")&&e(t.target).parents(".e-resizediv").length<=0&&e(t.target).parents(".e-rbn-ddl").length<=0&&!e(t.target).hasClass("e-rbn-splitbtn")&&e(t.target).parents(".e-colorpicker.e-ribbon:visible").length<=0&&e(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 i,s;i=e(t.target).parents(".e-resizediv"),i.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(),e(this.element.find(".e-ribbonbackstagepage")).is(":visible")&&this.element.find(".e-ribbonbackstagepage").hide(),s=this.element.find(".e-tooltipdiv"),s.is(":visible")&&s.hide()},_onTabDblClick:function(t){this.element.find(".e-apptab .e-menu ul").is(":visible")||this.element.find(".e-ribbonbackstagepage").is(":visible")||(e(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)},_wireEvents:function(){this._on(e(document),"keydown",this._OnKeyDown),this._on(this.element,"keydown",this._ribbonKeyDown),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(e(window),"resize",this._ribbonWindowResize),this._on(e(document),"click",this._ribbonDocClick),this._on(e(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),function(e,t){t.kanbanFeatures=t.kanbanFeatures||{},t.kanbanFeatures.dragAndDrop={_addDragableClass:function(){this._dropped=!1,this._dragEle=this.element.find(".e-columnrow .e-kanbancard"),this.element.find(".e-kanbancontent div:first"),this._dropEle=this.element.find(".e-columnrow .e-rowcell"),this._dropEle.addClass("e-droppable"),this._dragEle.addClass("e-draggable e-droppable"),this._enableDragDrop(),this._on(this.element,"mouseup",e.proxy(this.element.focus(),this))},_enableDragDrop:function(){this._drag(),e(this.element).find(".e-kanbancontent").ejDroppable({accept:e(this.element).find("div.e-kanbancard"),drop:function(t,i){e(i.helper).hide()}})},_selectedPrevCurrentCards:function(){var e,t;this._previousRowCellIndex.length>0&&(e=this._getCardbyIndexes(this._previousRowCellIndex),this._pCardId=e.attr("id")),this._previousRowCellIndex=this._currentRowCellIndex,this._pCardId=this._cCardId,this._currentRowCellIndex.length>0&&(t=this._getCardbyIndexes(this._currentRowCellIndex),this._cCardId=t.attr("id"))},_getPriorityIndex:function(e){for(var i=null,s=0;s0||null!=this._searchBar&&this._searchBar.find(".e-cancel").length>0)?(u=this._columnDataOndrop(i,p),m=u.length>0):m=e(i).children(".e-kanbancard").length>1,this.model.selectionType==t.Kanban.SelectionType.Multiple&&this._getSelectedCards(s).length>0&&e(s).hasClass("e-cardselection")&&(s=this._getSelectedCards(s)),r=0;r0||null!=this._searchBar&&this._searchBar.find(".e-cancel").length>0?u[u.length-1][p]:this._getPriorityIndex(i.find(".e-kanbancard").last()), n=this._getPriorityIndex(e(h)),a>=n&&(n=++a),this._removeFromPriorirtyCollec(e(h).attr("id")),this._priorityCollection.push({primaryKey:e(h).attr("id"),dropKey:n}),c=this._getKanbanCardData(this._currentJsonData,e(h)[0].id)[0],t.isNullOrUndefined(n)||(c[p]=n,u.push(c))),e(i).append(h));this._updateDropAction(i,s)},_selectionOnRerender:function(){var i,s,a,n,o,r,l,d,h,c=!0;if(this.model.selectionType==t.Kanban.SelectionType.Single)this._selectedCards.length>0&&(o=e(this._selectedCards[0]),r=this.element.find("#"+o[0].id),r.hasClass("e-kanbancard")?(s=e(r).parents(".e-columnrow"),a=e(r).parents(".e-rowcell"),this._selectedCards=[],this._selectedCards=r.addClass("e-cardselection"),this._currentRowCellIndex=this._previousRowCellIndex=[],this._currentRowCellIndex.push([s.index(),[a.index()],[a.find(".e-kanbancard").index(a.find("#"+o[0].id))]]),this._currentRowCellIndex=this._previousRowCellIndex,this.selectedRowCellIndexes=[],this.selectedRowCellIndexes.push({rowIndex:this._currentRowCellIndex[0][0],cellIndex:this._currentRowCellIndex[0][1][0],cardIndex:this._currentRowCellIndex[0][2][0]})):(this._selectedCards=this._selectedCardData=this.selectedRowCellIndexes=[],this._currentRowCellIndex=this._previousRowCellIndex=[]));else{for(n=0;n1)for(l=0;l=0&&(this.selectedRowCellIndexes[0].rowIndex=this._currentRowCellIndex[0][0]=i,this._previousRowCellIndex.length>0&&(this._previousRowCellIndex[0][0]=i))},_updateDropAction:function(i,s){var a,n,o,r,l,d,h,c,u,m;for(a=e(i).hasClass("e-rowcell")?i:e(i).closest("td.e-rowcell"),this._selectedCardData=[],n=0;n0)for(l=0;l0&&(this._dataManager instanceof t.DataManager&&!this._dataManager.dataSource.offline||this._dataSource().adaptor instanceof t.remoteSaveAdaptor)&&(m=this,u={added:[],deleted:[],changed:[]},u.changed=this._bulkUpdateData,e("#"+this._id).data("ejWaitingPopup").show(),c=this._dataManager.saveChanges(u,this.model.fields.primaryKey,this.model.query._fromTable),e.isFunction(c.promise)&&(c.done(function(){m._updateDataOndrop(m._bulkUpdateData)}),c.fail(function(e){var t={error:e.error};m._updateDataOndrop(m._failBulkData),m._trigger("actionFailure",t)}))),(!t.isNullOrUndefined(s[0].length)&&s[0].length>1||s.length>1||1==s.length&&e(s).hasClass("e-cardselection"))&&(this._previousRowCellIndex=t.isNullOrUndefined(this._pCardId)?[]:this._updateRowCellIndexes(this._pCardId,this._previousRowCellIndex),this._currentRowCellIndex=t.isNullOrUndefined(this._cCardId)?[]:this._updateRowCellIndexes(this._cCardId,this._currentRowCellIndex),this._selectionOnRerender(),t.isNullOrUndefined(this._pCardId)&&(this._previousRowCellIndex=this._currentRowCellIndex),this.model.selectionType==t.Kanban.SelectionType.Single?this.selectedRowCellIndexes=this._currentRowCellIndex:this._updateSelectedCardIndexes(i)),this._priorityCollection=[]},_updateDataOndrop:function(t){for(var i,s=0;s0&&this._renderSingleCard(i,t[s]);this._failBulkData=[],this._bulkUpdateData=[],this.refresh(!0),e("#"+this._id).data("ejWaitingPopup").hide()},_getKanbanCardData:function(e,i){return new t.DataManager(e).executeLocal((new t.Query).where(this.model.fields.primaryKey,t.FilterOperators.equal,i))},_getPriorityKey:function(e){var t=this._getKanbanCardData(this._currentJsonData,e);return t[0][this.model.fields.priority]},_dropAsSibling:function(i,s,a){var n,o,r,l,d,h,c,u,m,p,g,_,f,b,v,x,w,y,C,S,T,D=0,I=0,k=0,P=[],L=this.model.fields.priority;for(t.isNullOrUndefined(this._filterToolBar)||(m=this._filterToolBar.find(".e-select")),p=this.model.fields.primaryKey,this._selectedPrevCurrentCards(),L&&(!t.isNullOrUndefined(this._filterToolBar)&&m.length>0||null!=this._searchBar&&this._searchBar.find(".e-cancel").length>0)&&(P=this._columnDataOndrop(i,L)),e(i).hasClass("e-targetclone")&&(h=e(i).prevAll(".e-kanbancard")[0],c=e(i).nextAll(".e-kanbancard")[0],e(i).hasClass("e-targetappend")?(a=!0,i=h,t.isNullOrUndefined(i)&&(i=c)):(a=!1,i=c,t.isNullOrUndefined(i)&&(i=h))),d=i,this.model.selectionType==t.Kanban.SelectionType.Multiple&&this._getSelectedCards(s).length>0&&e(s).hasClass("e-cardselection")&&(s=this._getSelectedCards(s)),g=0;g0&&s[g][f-1]!=d?i=s[g][f-1]:0==f&&g>0&&s[g-1]!=d&&(i=s[g-1])),b!=d&&(a?e(b).insertAfter(i):e(b).insertBefore(i),L&&(!t.isNullOrUndefined(this._filterToolBar)&&m.length>0||null!=this._searchBar&&this._searchBar.find(".e-cancel").length>0)&&(v=this._getKanbanCardData(P,e(i).attr("id")),S=P.indexOf(v[0]),a?P.splice(S+1,0,this._getKanbanCardData(this._currentJsonData,e(b)[0].id)[0]):P.splice(S,0,this._getKanbanCardData(this._currentJsonData,e(b)[0].id)[0]),u=e(b)[0].id)),L)){if(!t.isNullOrUndefined(this._filterToolBar)&&m.length>0||null!=this._searchBar&&this._searchBar.find(".e-cancel").length>0)for(C=this._getKanbanCardData(P,e(i).attr("id")),D=C[0][L],C=this._getKanbanCardData(P,u),l=[],w=P.indexOf(C[0]);w0||null!=this._searchBar&&this._searchBar.find(".e-cancel").length>0?(r=y[L],!a&&parseInt(e(b)[0].id)==y[L]&&D=0&&(I=P[S-1][L]),C=this._getKanbanCardData(P,y[p]),S=x=P.indexOf(C[0]),S+10&&(I=this._getPriorityIndex(o.eq(0))),n=e(y).nextAll(".e-kanbancard"),n.length>0&&(k=this._getPriorityIndex(n.eq(0)))),!(!isNaN(I)&&I0||null!=this._searchBar&&this._searchBar.find(".e-cancel").length>0?(a||parseInt(e(b)[0].id)!=y[p]?r=++D:!a&&parseInt(e(b)[0].id)==y[p]&&D0)for(e(t).hasClass("e-rowcell")?s=e(t).index():(t=this.element.find("#"+e(t).attr("id")),s=e(t).parents(".e-rowcell").index()),i=e(t).parents(".e-columnrow"),e.inArray(s,this.selectedRowCellIndexes[0].cellIndex)==-1&&this.selectedRowCellIndexes[0].cellIndex.push(s),a=0;a0)for(this.selectedRowCellIndexes[0].cardIndex.splice(a,1),this.element.find(".e-targetclone").remove(),o=0;o0?this.selectedRowCellIndexes[0].cardIndex[a].push(e(n[o]).index()):this.selectedRowCellIndexes[0].cardIndex.splice(a,0,[e(n[0]).index()]);else this.selectedRowCellIndexes[0].cellIndex.splice(a,1),this.selectedRowCellIndexes[0].cardIndex.splice(a,1),--a},_updateDropData:function(i,s,a){var n,o,r,l,d,h,c,u,m;if(!t.isNullOrUndefined(this.model.fields.primaryKey)){if(o=this.model.fields.priority,r=this.model.fields.primaryKey,t.isNullOrUndefined(a)&&(a=e(i).attr("id")),n=e(i).hasClass("e-rowcell")?e(i):e(i).parents(".e-rowcell"),n.index()<0&&(n=this.element.find("#"+e(i).attr("id")).parents(".e-rowcell")),l=this._getKanbanCardData(this._currentJsonData,a),(this._dataManager instanceof t.DataManager&&!this._dataManager.dataSource.offline||this._dataSource().adaptor instanceof t.remoteSaveAdaptor)&&this._failBulkData.push(e.extend(!0,{},l[0])),l.length>0&&(l[0][this.model.keyField]=this.model.columns[n.index()].key,this.model.fields.swimlaneKey&&(l[0][this.model.fields.swimlaneKey]=e(i).parents("tr.e-columnrow").prev().find("div.e-slkey").html())),this._dropped=!0,o&&this._priorityCollection.length>0){for(c=0;c0&&(l[0][o]=d.dropKey),!t.isNullOrUndefined(this._filterToolBar)&&this._filterToolBar.find(".e-select").length>0&&!t.isNullOrUndefined(d)||null!=this._searchBar&&this._searchBar.find(".e-cancel").length>0)for(u=0;u0?this._initialData[u]=l[0]:this._initialData[u][o]=d.dropKey,h=this._initialData[u];break}}if(l.length>0){if(e(s).hasClass("e-cardselection")){for(u=0;u0?e(t.target).closest(".e-kanbancard")[0]:t.target,m._dropEle.removeClass("e-dropping e-dragged"),a={data:t.dragData,draggedElement:t.dragEle,dropTarget:e(d),event:t.event},!m._trigger("cardDragStop",a)&&(o=e(t.element).parents(".e-columnrow"),n=o.find(".e-cardselection"),r=o.find(".e-rowcell"),l=m.element.find(".e-targetclone"),l.is(":visible")?"TD"==d.nodeName&&e(d).parent().hasClass("e-columnrow")&&l.is(":visible")||l.siblings().length<=0||2==e(d).parent().children().length&&e(e(d).siblings()[0]).hasClass("e-shrinkheader")?(h=e(d).children().last(),h.hasClass("e-targetclone")&&(h=h.prev()),c=l.siblings().not(".e-shrinkheader"),(0==e(d).children().length||c.length<=0||e(h).offset().top+e(h).height()1)&&m._dropAsSibling(e(d),e(t.element),s):m._removeKanbanCursor(),m.element.find(".e-targetclone").remove(),r.height(o.find(d).parents(".e-rowcell").height()-m._tdHeightDiff),m._on(m.element,"mouseenter mouseleave",".e-columnrow .e-kanbancard",m._cardHover),e(i).length>0&&e(i).remove(),this._renderLimit(),this._totalCount(),this._eventBindings(),this.model.minWidth&&this.model.isResponsive&&this._kanbanWindowResize(),u=this.element.find("#"+t.element.attr("id")),e(u).hasClass("e-cardselection")&&(u=e(u).parents(".e-columnrow").find(".e-cardselection:visible")),a.draggedElement=u,!m._trigger("cardDrop",a))},_getCursorElement:function(t){var i=e(t.target).closest(".dragClone"),s=t.event;return i.length>0&&(i.hide(),t.target="touchmove"==s.type||"touchstart"==s.type||"touchend"==s.type?document.elementFromPoint(s.originalEvent.changedTouches[0].pageX,s.originalEvent.changedTouches[0].pageY):document.elementFromPoint(s.clientX,s.clientY),i.show()),t.target},_getSelectedCards:function(t){for(var i,s=0;s1)for(i=0;ii+t-10?(u.element.removeClass("e-view-horizontal"),_=window.setInterval(function(){o.width()+o.offset().left<=r.offset().left&&!u.element.hasClass("e-view-horizontal")?p.scrollX(p.scrollLeft()+5,!0):_&&(_=window.clearInterval(_))},100)):a-100&&(g=window.setInterval(function(){o.offset().left>=l.offset().left+l.width()&&!u.element.hasClass("e-view-horizontal")?p.scrollX(p.scrollLeft()-5,!0):g&&(g=window.clearInterval(g))},100))):(u.element.addClass("e-view-horizontal"),_&&(_=window.clearInterval(_)),g&&(g=window.clearInterval(g))),n>s+u._headerContent.height()+(m.height()-15)?(u.element.removeClass("e-view-vertical"),b=window.setInterval(function(){d.height()+d.offset().top<=h.offset().top&&!u.element.hasClass("e-view-vertical")?p.scrollY(p.scrollTop()+5,!0):b&&(b=window.clearInterval(b))},100)):n-100&&(u.element.removeClass("e-view-vertical"),f=window.setInterval(function(){b&&(b=window.clearInterval(b)),d.offset().top>=c.offset().top+c.height()&&!u.element.hasClass("e-view-vertical")?p.scrollY(p.scrollTop()-5,!0):f&&(f=window.clearInterval(f))},100)):(u.element.addClass("e-view-vertical"),b&&(b=window.clearInterval(b)),f&&(f=window.clearInterval(f)))},_changeKanbanCursor:function(t,i,s){var a,n,o=e(t).parents(".e-kanbancard"),r=e(t).hasClass("e-kanbancard");o.length>0||r?(n=r?e(t):o,n[0].style.cursor="not-allowed"):(0==e(t).parents(".e-columnrow").has(s.element).length||e(t).parents(".e-swimlanerow").length>0)&&(document.body.style.cursor="not-allowed"),a=e(i).find(".e-kanbancard"),a.length>0&&(a[0].style.cursor="not-allowed")},_removeKanbanCursor:function(){document.body.style.cursor="",this.element.find(".e-kanbancard").css("cursor","")},_drag:function(){var i,s,a,n,o,r=this,l=null,d=null,h=null,c=null,u=null,m=[];null!=this.element&&(h=this.element.find(".e-kanbancontent div:first")),e(this.element).find(".e-kanbancontent div.e-kanbancard").not(".e-js").ejDraggable({dragArea:h,clone:!0,cursorAt:{left:-20,top:-20},dragStart:function(s){var n,h;for(r._off(r.element,"mouseenter mouseleave",".e-columnrow .e-kanbancard"),o=r.element.find(".e-draggedcard"),d=e(s.element).hasClass("e-cardselection")?e(s.element).parents(".e-columnrow").find(".e-cardselection:visible"):e(s.element),d.length>1&&(n=t.buildTag("div.e-dragmultiple"),n.append(d.length+" Cards"),o.children().remove(),o.append(n).css("width","90px")),h=0;h0&&e(".e-kanban-context").css("visibility","hidden"),r._kTouchBar.hide(),(r.model.allowScrolling||r.model.isResponsive)&&r._kanbanAutoScroll(t),e(t.target).closest(".dragClone").length>0&&(t.target=c,clearTimeout(u),u=setTimeout(function(){t.target=r._getCursorElement(t)},10)),e(t.target).hasClass("e-targetclone")||e(t.target).hasClass("e-rowcell")||e(n).remove(),i=e(t.target).closest(".e-kanbancard").length>0?e(t.target).closest(".e-kanbancard")[0]:t.target,h=e(t.element).closest("td.e-rowcell").addClass("e-dragged"),h.siblings().addClass("e-dropping"),a={draggedElement:d,data:m,dragTarget:i,event:t.event},c=o=e(i).closest("td.e-rowcell"),p=o.parents(".e-columnrow").find(".e-cardselection"),o&&o.hasClass("e-droppable")&&e(o).parent().has(t.element).length>0&&(i!=t.element[0]||p.length>1)?(document.body.style.cursor="",e(n).parents(".e-rowcell").index()!=o.index()&&e(n).remove(),o.find(".e-kanbancard").removeClass("e-hover"),g=o.children().last(),g.hasClass("e-shrinkheader")&&(g=g.prev()),e(i).hasClass("e-rowcell")&&(t.element[0]!=g[0]||p.length>1)&&!e(i).hasClass("e-shrink")?(0==g.length||0==o.children().length||g.offset().top+g.height()=t.event.pageY?e(i).prev()[0]!=t.element[0]||p.length>1?e(i).hasClass("e-targetclone")||(r._removeKanbanCursor(),e(n).insertBefore(e(i)).height(e(t.element[0]).height()).width(e(i).width()).removeClass("e-targetappend")):r._changeKanbanCursor(i,l,t):e(i).next()[0]!=t.element[0]||p.length>1?(_=e(i).parents(".e-rowcell").height(),e(i).hasClass("e-targetclone")||(s=!0,r._removeKanbanCursor(),e(n).insertAfter(e(i)).height(e(t.element[0]).height()).width(e(i).width()).addClass("e-targetappend"))):r._changeKanbanCursor(i,l,t),_0&&(n=c.parents(".e-kanbancard").attr("id")),a=t.DataManager(this._currentJsonData),u=u.where(this.model.fields.primaryKey,t.FilterOperators.equal,parseInt(n,10)),this._currentData=a.executeLocal(u),p.addClass("e-editedrow")),m.innerHTML=e.render[this._id+"_dialogEditingTemplate"](this._currentData),this._setKanbanDdlValue(p),s=e("#"+this._id+"_dialogEdit"),s.html(e(m)),o={},o.cssClass=this.model.cssClass,o.enableRTL=this.model.enableRTL,o.width="auto",o.content="#"+this._id,o.close=e.proxy(this.cancelEdit,this),o.open=e.proxy(this._onKbnDialogOpen,this),o.enableModal=!0,o.enableResize=!1,i.requestType==t.Kanban.Actions.Add?t.isNullOrUndefined(this.model.fields.title)||e.isEmptyObject(this._newData)?o.title=this.localizedLabels.AddFormTitle:(r=this.model.fields.title,o.title=this.localizedLabels.EditFormTitle+this._newData[r]):(r=this.model.fields.primaryKey,t.isNullOrUndefined(this.model.fields.title)||(r=this.model.fields.title),o.title=this.localizedLabels.EditFormTitle+this._currentData[0][r]),s.ejDialog(o),s.ejDialog("open"),h.attr("data-id",n),l=this.element.find("#"+this._id+"_dialogEdit_wrapper"),l.css("left","0"),d=self!=parent?"chrome"==t.browserInfo().name?e(window).scrollTop():-e(window.frameElement).offset().top:e(window).scrollTop(),l.css("top",d),l.hide(),this.initValidator(),this.setValidation()},_onKbnDialogOpen:function(){var t,i,s,a,n,o,r,l,d,h,c,u=this.element.find("#"+this._id+"_dialogEdit_wrapper");for(u.css("position","absolute"),s=e(this.element)[0],a=s.offsetTop,n=s.offsetLeft,o=s.offsetWidth,r=s.offsetHeight,window.pageYOffset>a?(t=a+r>window.pageYOffset+window.innerHeight?Math.max(0,(window.innerHeight-u.outerHeight())/2):Math.max(0,(a+r-window.pageYOffset-u.outerHeight())/2),t=window.pageYOffset+t):(t=a+r>window.pageYOffset+window.innerHeight?Math.max(0,(window.innerHeight-(a-window.pageYOffset)-u.outerHeight())/2):Math.max(0,(r-u.outerHeight())/2),t=a+t),window.pageXOffset>n?(i=n+o>window.pageXOffset+window.innerWidth?Math.max(0,(window.innerWidth-u.outerWidth())/2):Math.max(0,(n+o-window.pageXOffset-u.outerWidth())/2),i=window.pageXOffset+i):(i=n+o>window.pageXOffset+window.innerWidth?Math.max(0,(window.innerWidth-(n-window.pageXOffset)-u.outerWidth())/2):Math.max(0,(o-u.outerWidth())/2),i=n+i),u.css("top",t+"px"),u.css("left",i+"px"),u.show(),l=e(this._editForm).find("input,select,div.e-field,textarea.e-field"),d=!1,h=0;h0&&this.element.find("#"+this._id+"_dialogEdit").data("ejDialog")._resetScroller()},_focusKbnDialogEle:function(e){if(e.length)if("select"==e[0].tagName.toLowerCase()&&!e.hasClass("e-field e-dropdownlist")||"input"==e[0].tagName.toLowerCase()||"textarea"==e[0].tagName.toLowerCase()&&!e.hasClass("e-numerictextbox"))if(e.hasClass("e-rte")){ var t=e.data("ejRTE");t.focus(),t.selectAll()}else e.focus().select(),e[0].focus();else e.hasClass("e-field e-dropdownlist")?e.closest(".e-ddl").focus():e.hasClass("e-numerictextbox")?e.siblings("input:visible").first().select().focus():e.find("input:visible,select").first().select().focus()},_cardDblClickHandler:function(t){this._cardEditClick=!0,this._dblArgs=t,this.startEdit(e(t.target).closest(".e-kanbancard"))},_cellDblClickHandler:function(t){e(t.target).hasClass("e-rowcell")&&(this._isAddNewClick=!0,this._newCard=e(t.target),this.addCard())},endEdit:function(){var i,s,a,n,o,r,l,d,h,c,u,m;if(this.model.editSettings.allowEditing||this.model.editSettings.allowAdding){if(i=this.element.find(".e-kanbandialog"),a={},!this.editFormValidate())return!0;for(n=document.getElementById(this._id+"EditForm"),o=e(n),r=o.closest("div"),t.isNullOrUndefined(i.attr("data-id"))?(s=this._currentJsonData[this._currentJsonData.length-1][this.model.fields.primaryKey]+1,a[this.model.fields.primaryKey]=s):s=parseInt(i.attr("data-id")),l=0;l0?o.find("#"+this._id+"_"+l):o.find("#"+l),a.attr("name")||a.attr("name",i),a.rules("add",s),r=e("#"+this._id+"EditForm").validate(),r.settings.messages[i]=r.settings.messages[i]||{},t.isNullOrUndefined(s.required)||(n=t.isNullOrUndefined(s.messages&&s.messages.required)?e.validator.messages.required:s.messages.required,0==n.indexOf("This field")&&(n=n.replace("This field",i)),r.settings.messages[i].required=n)},editFormValidate:function(){return!e.isFunction(e.validator)||e("#"+this._id+"EditForm").validate().form()},_addDialogEditingTemplate:function(){var i,s,a,n,o,r,l,d,h,c,u,m,p,g,_,f,b,v,x,w,y,C;if(0!=this.model.columns.length){if(i=t.buildTag("div"),s=t.buildTag("form.kanbanform","",{},{id:this._id+"EditForm"}),a=t.buildTag("table","",{},{cellspacing:"14px"}),t.isNullOrUndefined(this.model.editSettings.editMode)&&(this.model.editSettings.editMode=t.Kanban.EditMode.Dialog),this.model.editSettings.editMode==t.Kanban.EditMode.Dialog)for(c=0;c"+m+""),t.isNullOrUndefined(u.editType)&&(u.editType="stringedit"),t.isNullOrUndefined(m)||(m=m.replace(/[^a-z0-9\s_]/gi,"")),u.editType){case"stringedit":this.model.fields.primaryKey==m?r.html(t.buildTag("input.e-field e-ejinputtext e-disable","",{},{value:"{{html:#data['"+m+"']}}",id:this._id+"_"+m,name:m,disabled:"disabled"})):r.html(t.buildTag("input.e-field e-ejinputtext","",{},{value:"{{html:#data['"+m+"']}}",id:this._id+"_"+m,name:m}));break;case"numericedit":r.html(t.buildTag("input.e-numerictextbox e-field","",{},{type:"text",value:"{{:#data['"+m+"']}}",id:this._id+"_"+m,name:m}));break;case"dropdownedit":if(p=[],t.isNullOrUndefined(u.dataSource))for(x=(new t.Query).where(t.Predicate.or(this.keyPredicates)).select(u.field),t.isNullOrUndefined(this._dropDownManager)||!this._dataManager.dataSource.offline&&this._dataManager.dataSource.json.length?b=this._dataManager.executeLocal(x):(this._dataManager.adaptor instanceof t.JsonAdaptor&&u.field.indexOf(".")!=-1&&(w=u.field.replace(/\./g,t.pvt.consts.complexPropertyMerge),x=(new t.Query).select(w)),b=this._dropDownManager.executeLocal(x)),v=t.dataUtil.mergeSort(t.distinct(b)),y=0;y",g.render(p),""].join(""):"",r.find("select,input").prop({id:this._id+"_"+m,name:m}).addClass("e-field e-dropdownlist");break;case"rteedit":r.html(t.buildTag("textarea.e-field e-rte","{{html:#data['"+m+"']}}",{},{id:this._id+"_"+m,name:m}));break;case"textarea":r.html(t.buildTag("textarea.e-field e-kanbantextarea e-ejinputtext","{{html:#data['"+m+"']}}",{},{id:this._id+"_"+m,name:m}));break;case"datepicker":case"datetimepicker":r.html(t.buildTag("input.e-"+u.editType+" e-field","",{},{type:"text",value:"{{:#data['"+m+"']}}",id:this._id+"_"+m,name:m}))}a.append(n),s.append(a),s.appendTo(i)}else this.model.editSettings.editMode==t.Kanban.EditMode.DialogTemplate&&null!=this.model.editSettings.dialogTemplate&&(C=this.model.editSettings.dialogTemplate),s.html(e(C).html()),s.appendTo(i);l=t.buildTag("input.e-save","",{},{type:"button",id:this._id+"_Save"}),l.ejButton({text:this.localizedLabels.SaveButton,width:"100"}),d=t.buildTag("input.e-cancel","",{"margin-left":"15px","margin-right":"13px"},{type:"button",id:this._id+"_Cancel"}),d.ejButton({text:this.localizedLabels.CancelButton,width:"100"}),h=t.buildTag("div#"+this._id+"_EditBtnDiv","",{},{class:"e-kanban-editdiv"}),h.append(l),h.append(d),s.append(h),e.templates(this._id+"_dialogEditingTemplate",i.html())}}}}(jQuery,Syncfusion),function(e,t){t.widget("ejKanban","ej.Kanban",{_rootCSS:"e-kanban",element:null,_requiresID:!0,validTags:["div"],model:null,observables:["dataSource"],_tags:[{tag:"columns",attr:["headerTemplate","headerText","key","isCollapsed","visible","constraints.type","constraints.min","constraints.max"]},{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"]}],_dataSource:t.util.valueFunction("dataSource"),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",selectedGroupExpand:"alt+40",selectedGroupCollapse:"alt+38",selectedColumnCollapse:"ctrl+37",selectedColumnExpand:"ctrl+39",multiSelectionByUpArrow:"shift+38",multiSelectionByDownArrow:"shift+40",multiSelectionByLeftArrow:"shift+37",multiSelectionByRightArrow:"shift+39"},defaults:{htmlAttributes:{},cssClass:"",dataSource:null,tooltipSettings:{enable:!1,template:null},swimlaneSettings:{showCount:!0},currentViewData:null,allowSelection:!0,selectionType:"single",allowDragAndDrop:!0,allowKeyboardNavigation:!1,allowToggleColumn:!1,allowTitle:!1,enableTotalCount:!1,allowSearching:!1,allowHover:!0,allowScrolling:!1,enableRTL:!1,enableTouch:!0,stackedHeaderRows:[],filterSettings:[],scrollSettings:{width:"auto",height:0,allowFreezeSwimlane:!1},keyField:null,cardSettings:{colorMapping:{},template:null},columns:[],contextMenuSettings:{enable:!1,menuItems:[{menuItem:"Add Card"},{menuItem:"Edit Card"},{menuItem:"Delete Card"},{menuItem:"Top of Row"},{menuItem:"Bottom of Row"},{menuItem:"Move Up"},{menuItem:"Move Down"},{menuItem:"Move Left"},{menuItem:"Move Right"},{menuItem:"Move Swimlane"},{menuItem:"Hide Column"},{menuItem:"Visible Columns"}],customMenuItems:[]},fields:{primaryKey:null,color:null,tag:null,imageUrl:null,content:null,swimlaneKey:null},editSettings:{editItems:[],allowEditing:!1,allowAdding:!1,dialogTemplate:null},searchSettings:{fields:[],key:"",operator:"contains",ignoreCase:!0},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},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"}},_destroy:function(){var i,s,a,n;if(this.element.off(),this.element.find(".e-kanbanheader").find(".e-headercontent").add(this.getContent().find(".e-content")).unbind("scroll"),t.isNullOrUndefined(this._filterToolBar)||this._filterToolBar.ejToolbar("destroy"),!t.isNullOrUndefined(this._editForm)){for(i=this._editForm.find(".e-field"),n=0;n")),this.element.find(".e-kanbantooltip").hide()),this.initialRender=!1},_render:function(){this.element.addClass(this.model.cssClass+"e-widget"),this._renderContent().insertAfter(this.element.children(".e-kanbanheader")),this._renderLimit(),this._enableDragandScroll(),this.initialRender&&this._addLastRow()},_renderLimit:function(){for(var i,s,a,n,o,r="",l=0;ln?(r.addClass("e-deceed"),h&&e(s).addClass("e-deceed")):(r.removeClass("e-deceed"),h&&e(s).removeClass("e-deceed"))),d&&(i.constraints.max0?(o=this.getHeaderContent().find(".e-columnheader").not(".e-stackedHeaderRow").find(".e-headercell")[r],e(o).hasClass("e-exceed")?e(o).removeClass("e-exceed"):e(o).hasClass("e-deceed")&&e(o).removeClass("e-deceed"),n!=-1&&e(a).text(e(a).text().slice(n+3)),e(a).text(e(e(this.element.find(".e-columnrow")).find("td[ej-mappingkey="+s.key+"] > div.e-kanbancard")).length+" "+this.localizedLabels.FilterOfText+" "+e(a).text())):t.isNullOrUndefined(s.constraints)?e(a).text(e(a).text().slice(n+3)):this._renderLimit())},_enableDragandScroll:function(){this.model.allowDragAndDrop&&t.kanbanFeatures.dragAndDrop&&this._addDragableClass(),this.model.allowScrolling&&(this.initialRender?(t.isNullOrUndefined(this.model.fields.swimlaneKey)||(this._swimlaneRows=this.element.find(".e-swimlanerow")),this._renderScroller()):this._refreshScroller({requestType:"refresh"})),this.model.enableTotalCount&&this._totalCount()},_refreshScroller:function(e){var i=this.getContent().first();t.isNullOrUndefined(i.data("ejScroller"))||("beginedit"==e.requestType&&this.getScrollObject().scrollY(0,!0),i.ejScroller("refresh"),i.ejScroller("model.enableRTL",this.model.enableRTL),i.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.element.find(".e-kanbanheader").removeClass("e-scrollcss"))},_renderHeader:function(){var i,s,a,n,o,r,l,d,h,c,u,m,p=t.buildTag("div.e-kanbanheader"),g=t.buildTag("div"),_=e(document.createElement("colgroup"));t.isNullOrUndefined(this.model.fields.swimlaneKey)||p.addClass("e-slheader"),this.model.allowScrolling&&g.addClass("e-headercontent"),p.append(g);var f=t.buildTag("table.e-table","",{},{cellspacing:"0.25px",role:"kanban"}),b=t.buildTag("thead"),v=t.buildTag("tbody.e-hide",{});for(i=0;i0&&(e=t.buildTag("ul"),i=t.buildTag("li","",{},{class:"e-quickfilter"},{tabindex:"0"}),i.append(""),e.append(i)),s=0;s0))return;o?n.html(e(i.target).text()).removeClass("e-tooltiptemplate"):(n.addClass("e-tooltiptemplate"),a=t.DataManager(this._currentJsonData),s=a.executeLocal((new t.Query).where(this.model.fields.primaryKey,t.FilterOperators.equal,e(i.currentTarget).attr("id"))),n.html(e(this.model.tooltipSettings.template).render(s[0])));var r=i.pageX,l=i.pageY,d=e(this.element.find(".e-kanbantooltip"));r=r+d.width()0&&s.remove(),e(this.getHeaderTable().find(".e-columnheader").before(t));this.model.allowScrolling&&this._refreshScroller({requestType:"refresh"})},showColumns:function(e){var t,i="_visibleColumns";t="string"==typeof e?this.getColumnByHeaderText(e):this.getColumnByHeaderText(e[0]),this._showExpandColumns(t,e,"_hiddenColumns",i),this._showhide(this[i],"show"),this._renderLimit(),this._totalCount(),this.model.stackedHeaderRows.length>0&&this._refreshStackedHeader()},_hideCollapseColumns:function(i,s,a,n){var o,r;if(!t.isNullOrUndefined(i))if(e.isArray(s))for(o=0;oa)s="string"==typeof t?this.getColumnByHeaderText(t):this.getColumnByHeaderText(t[0]),this._hideCollapseColumns(s,t,n,"_visibleColumns"),this._showhide(this[n],"hide"),this.model.stackedHeaderRows.length>0&&this._refreshStackedHeader();else{if(1==this._visibleColumns.length)return;this._visibleColumns[0]==t?this._expandColumns(this._visibleColumns[1]):this._expandColumns(this._visibleColumns[0]),this.hideColumns(t)}this._renderLimit(),this._totalCount(),this._stackedHeadervisible()},_showhide:function(i,s){var a,n,o,r,l,d=0,h=this.model.columns;n="show"===s?"_visibleColumns":"_hiddenColumns";var c,u=this.getHeaderTable().find("thead"),m=u.find("tr").not(".e-stackedHeaderRow").find(".e-headercell"),p=this.getHeaderTable().find("colgroup").find("col"),g=this.getContentTable().find("colgroup").find("col"),_=this._columnRows;for(a=0;a0&&this._refreshStackedHeader()},_toggleField:function(t){var i,s,a,n=0;if(e.isArray(t)){for(s=0;s0&&this._refreshStackedHeader())},_onToolbarClick:function(t){var i,s,a,n,o,r=e(this.itemsContainer).closest(".e-kanban"),l=r.ejKanban("instance"),d=t.currentTarget,h=t.target;if("INPUT"==h.tagName&&(13==t.keyCode||e(h).parent().next().hasClass("e-cancel"))&&(13==t.keyCode&&""!=e(h).val()?(this.searchCards(e(h).val()),o=this._searchBar.find(".e-toolbaricons"),o.removeClass("e-searchfind").addClass("e-cancel")):0==e(h).val().length&&(this.clearSearch(),o=this._searchBar.find(".e-toolbaricons"),o.removeClass("e-cancel").addClass("e-searchfind"))),void 0==t.event||e(d).hasClass("e-quickfilter"))return!1;for(i=e(d).text(),s=0;s0&&(this._initialData=this._currentJsonData),this._processBindings(s))},_filterHandler:function(i,s){var a,n,o,r={};for(r.requestType=t.Kanban.Actions.Filtering,r.currentFilterObject=[],r.filterCollection=this._filterCollection,r.currentFilterObject.push(i),this._initialData=this._currentJsonData,a=0;a0&&(this._originalScrollWidth=this.model.scrollSettings.width),"string"==typeof this.model.scrollSettings.height?this._originalScrollHeight=this.getContent().height():this.model.scrollSettings.height>0&&(this._originalScrollHeight=this.model.scrollSettings.height),this.model.minWidth&&this.model.isResponsive&&(e(window).bind("resize",e.proxy(this._kanbanWindowResize,this)),this._kanbanWindowResize())},_renderResponsiveKanban:function(e,i,s,a,n){var o;e?(this.model.scrollSettings.width=t.isNullOrUndefined(this._originalScrollWidth)?Math.min(s,n):Math.min(this._originalScrollWidth,Math.min(s,n)),o=Math.min(a,i),o=t.isNullOrUndefined(this._originalScrollHeight)?o:Math.min(this._originalScrollHeight,a),this.model.scrollSettings.height=o,this._renderScroller()):(this.model.scrollSettings.width="100%",t.isNullOrUndefined(this._originalScrollWidth)||(this.model.scrollSettings.width=Math.min(this._originalScrollWidth,s)),o=this.element.outerHeight(),t.isNullOrUndefined(this._originalScrollHeight)||(o=Math.min(this._originalScrollHeight,a)),this.model.scrollSettings.height=o,this._renderScroller())},_kanbanWindowResize:function(){var t,i,s,a,n,o=this.element.find(".e-kanbantoolbar");this.model.scrollSettings.width=this._originalScrollWidth,this.element.outerWidth("100%"),this.getContentTable().width("100%"),this.getHeaderTable().width("100%"),t=this.element.outerWidth(),i=e(window).width()-this.element.offset().left,s=e(window).height()-this.element.offset().top,o.length>0&&(s-=o.outerHeight()+25),a=this._headerContent.outerHeight()+this.getContentTable().height(),n=this.model.minWidth>t||i<=t||s<=a,this._renderResponsiveKanban(n,a,t,s,i)},_renderScroller:function(){var i,s,a,n,o,r;this.model.scrollSettings||(this.model.scrollSettings={}),"string"==typeof this._originalScrollWidth&&(this.element.css("width","auto"),i=this.element.width(),("auto"==this.model.scrollSettings.width||"auto"==this._originalScrollWidth)&&(this._originalScrollWidth="100%"),this.model.scrollSettings.width=i*(parseFloat(this._originalScrollWidth)/100)),"string"==typeof this.model.scrollSettings.height&&(s=this.element.height(),"auto"==this.model.scrollSettings.height&&(this.model.scrollSettings.height="100%"),this.model.scrollSettings.height=s*(parseFloat(this.model.scrollSettings.height)/100)),(this.model.scrollSettings.width||this.model.width)&&this.element.width(this.model.scrollSettings.width||this.model.width),a=0!=this.model.scrollSettings.height?this.model.scrollSettings.height-this.getHeaderTable().height()-(!t.isNullOrUndefined(this._filterToolBar)&&this._filterToolBar.height()):this.model.scrollSettings.height,n=this.getContent().attr("tabindex","0"),this.element.addClass("e-kanbanscroll"),n.ejScroller({enableRTL:this.model.enableRTL,height:a,width:this.model.scrollSettings.width,thumbStart:function(t){var i=e(t.originalEvent.target);return i.hasClass("e-kanbancard")||i.parents(".e-kanbancard").hasClass("e-kanbancard"),!1},scroll:e.proxy(this._freezeSwimlane,this)}),this.getContent().ejScroller("isVScroll")?(this.element.find(".e-kanbanheader").addClass("e-scrollcss"),this.getHeaderContent().find("div").first().addClass("e-headercontent")):this.element.find(".e-kanbanheader").removeClass("e-scrollcss"),(this.model.scrollSettings.width||this.model.width)&&this.element.width(this.model.scrollSettings.width||this.model.width),o=this.getContent().data("ejScroller"),r=o&&o.isVScroll()?"addClass":"removeClass",this.getHeaderContent().find(".e-headercontent")[r]("e-hscrollcss"),this._refreshHeaderScroller()},_freezeSwimlane:function(e){var i,s,a,n,o,r,l,d,h,c,u,m,p;this._freezeSwimlaneRow=this.element.find(".e-freezeswimlanerow"),this.model.scrollSettings.allowFreezeSwimlane||this._freezeSwimlaneRow.remove(),this.model.scrollSettings.allowFreezeSwimlane&&!t.isNullOrUndefined(this.model.fields.swimlaneKey)&&(t.isNullOrUndefined(e.scrollLeft)||0!=this._freezeSwimlaneRow.length)&&(this._freezeSwimlaneRow.length<=0?(this._freezeSwimlaneRow=t.buildTag("div.e-freezeswimlanerow e-swimlanerow","
    ",{}),i=this._headerContent.offset().top+this._headerContent.height(),this._freezeSwimlaneRow.appendTo(this.element).css({top:i}),s=this._swimlaneRows.eq(0),this._freezeSwimlaneRow.children().append(s.find(".e-slkey,.e-slcount").clone()),this._freezeSwimlaneRow.width(this._headerContent.width()-1).height(s.height()),this._freezeSlOrder=0,a=t.buildTag("table.e-table e-freeze-table","",{},{cellspacing:"0.25px"}),a.append(this.getContentTable().find("colgroup").clone()),n=t.buildTag("tbody"),a.append(n),n.append(this.getContentTable().find(".e-columnrow").eq(0).clone().removeClass("e-columnrow").addClass("e-collapsedrow")),o=n.find("td"),o.removeClass("e-droppable").removeAttr("ej-mappingkey").height(0),o.children().remove(),this._freezeSwimlaneRow.append(a)):(r=this.getContent().offset().top+this._freezeSwimlaneRow.height(),u=this._swimlaneRows.eq(this._freezeSlOrder),c=this._swimlaneRows.eq(this._freezeSlOrder+1),m=this._swimlaneRows.eq(this._freezeSlOrder-1),l=c.offset().top+c.height(),d=u.offset().top+u.height(),h=m.offset().top+m.height(),p=this.element.find(".e-freezeswimlanerow >div"),this._freezeScrollTop>e.scrollTop&&(d=d,r>=l&&(l=r+1)),this._freezeScrollTop=l?(p.children().remove(),p.append(c.find(".e-slkey,.e-slcount").clone()),++this._freezeSlOrder):rh&&this._freezeSlOrder>0&&(p.children().remove(),p.append(m.find(".e-slkey,.e-slcount").clone()),--this._freezeSlOrder),0==e.scrollTop&&this._freezeSwimlaneRow.remove(),t.isNullOrUndefined(e.scrollLeft)||(p.css({left:-e.scrollLeft}),this._freezeSwimlaneRow.find("table").css({left:-e.scrollLeft}))),this._freezeScrollTop=e.scrollTop)},_refreshHeaderScroller:function(){this.getContent().find(".e-content").scroll(t.proxy(function(t){this.getHeaderContent().find("div").first().scrollLeft(e(t.currentTarget).scrollLeft())},this)),this.element.find(".e-kanbanheader").find(".e-headercontent").scroll(t.proxy(function(t){var i=e(t.currentTarget);this.getContent().find(".e-content").first().scrollLeft(i.scrollLeft())},this))},_setWidthToColumns:function(){for(var e=this.getContentTable().children("colgroup").find("col"),i=this.getHeaderTable().children("colgroup").find("col"),s=this._originalWidth-50*this._collapsedColumns.length,a=0;a0||this.model.allowSearching)&&this.element.append(this._renderToolBar()),i=this.model.columns,i&&i.length&&(this.element.append(this._renderHeader()),this._stackedHeadervisible()),e.isFunction(e.fn.ejWaitingPopup)&&(this.element.ejWaitingPopup({showOnInit:!1}),e("#"+this._id+"_WaitingPopup").addClass("e-kanbanwaitingpopup")),this.model.contextMenuSettings.enable&&this.element.append(this._renderContext()),this._dataSource()instanceof t.DataManager?(this.element.ejWaitingPopup("show"),void 0!=this._dataSource().ready?(s=this,this._dataSource().ready.done(function(e){s._initDataSource(),s.model.dataSource=t.DataManager(e.result)})):(this.element.ejWaitingPopup("show"),this._initDataSource())):(this._trigger("actionBegin"),this._ensureDataSource(),this._initKanbanRender(),this._enableKanbanRTL()))},_ensureDataSource:function(i){var s,a,n,o,r,l,d,h,c,u,m,p;if(null==this._dataSource()&&!(this._dataSource()instanceof t.DataManager)){if(t.isNullOrUndefined(i)||"add"!=i.requestType)return;this.dataSource([])}if(this.model.query.requiresCount(),s=this.model.query,a=s.clone(),this._dataSource()instanceof t.DataManager||(this._currentJsonData=this.model.currentViewData=this._dataSource()),this.model.filterSettings.length&&!t.isNullOrUndefined(i)&&i.requestType==t.Kanban.Actions.Filtering||!t.isNullOrUndefined(i)&&i.requestType==t.Kanban.Actions.Search||this.model.searchSettings.key.length){for(s.queries=s.queries.slice(s.queries.length),0!=this.model.searchSettings.key.length&&(o=this.model.searchSettings,0==o.fields.length&&(t.isNullOrUndefined(this.model.fields.content)||o.fields.push(this.model.fields.content),t.isNullOrUndefined(this.model.fields.swimlaneKey)||o.fields.push(this.model.fields.swimlaneKey),t.isNullOrUndefined(this.model.fields.primaryKey)||o.fields.push(this.model.fields.primaryKey),t.isNullOrUndefined(this.model.fields.title)||o.fields.push(this.model.fields.title)),s.search(o.key,o.fields,o.operator||"contains",o.ignoreCase)),r=0;r0)&&(this._filteredRecordsCount=null,this._filteredRecords=[])}this._isLocalData&&(this.model.editSettings.allowEditing||this.model.editSettings.allowAdding)&&(!t.isNullOrUndefined(this._cModifiedData)||!t.isNullOrUndefined(this._cAddedRecord))&&(t.isNullOrUndefined(this._cAddedRecord)?(s=s.where(this.model.fields.primaryKey,t.FilterOperators.equal,i.primaryKeyValue),l=this._dataManager.executeLocal(s),d=this._dataSource()instanceof t.DataManager?e.extend(this._dataSource().dataSource.json[e.inArray(l.result[0],this._dataSource().dataSource.json)],this._cModifiedData):e.extend(this._dataSource()[e.inArray(l.result[0],this._dataSource())],this._cModifiedData),i.data=d):(h=this._cAddedRecord,this._cAddedRecord=null,this._dataSource()instanceof t.DataManager?this._dataSource().dataSource.json.push(h):this._dataSource(void 0,!0).splice(this._dataSource().length,0,h)),s.queries=a.queries),i&&i.requestType==t.Kanban.Actions.Delete&&!t.isNullOrUndefined(this._cDeleteData)&&this._isLocalData&&(this._dataSource()instanceof t.DataManager?(c=e.inArray(this._cDeleteData[0],this._dataSource().dataSource.json),this._dataSource().dataSource.json.splice(c,1)):(c=e.inArray(this._cDeleteData[0],this._dataSource()),this._dataSource(void 0,!0).splice(c,1))),this._cloneQuery=s.clone(),this._isLocalData&&(u=this._dataManager.dataSource.json,m=this._dataSource().dataSource,!t.isNullOrUndefined(m)&&this._dataSource()instanceof t.DataManager&&(this._dataManager.dataSource.json=u!=m.json?m.json:u),p=this._dataManager.executeLocal(s),this.model.currentViewData=this._currentJsonData=p.result,this._recordsCount=p.count)},clearSearch:function(){this.element.find(".e-kanbantoolbar #"+this._id+"_toolbarItems_search").val(""),this.searchCards(""),e.extend(this.model.searchSettings,this.defaults.searchSettings)},_addColumnFilters:function(){for(var e=this.model.columns,i=[],s=this.model.query,a=0;a0&&s.where(t.Predicate.or(i)),this.keyPredicates=i},sendDataRenderingRequest:function(e){this._templateRefresh&&(this.refreshTemplate(),this._templateRefresh=!1);var i=this.model.query,s=i.clone();if(null!=this.model.currentViewData&&this.model.currentViewData.length){switch(e.requestType){case t.Kanban.Actions.Save:this._updateGroup(e.primaryKeyValue,e.data);case t.Kanban.Actions.Delete:case t.Kanban.Actions.Refresh:case t.Kanban.Actions.Search:case t.Kanban.Actions.Filtering:case t.Kanban.Actions.Cancel:this.getContentTable().find("colgroup").first().replaceWith(this._getMetaColGroup()),t.isNullOrUndefined(this.model.fields.swimlaneKey)||(i=i.group(this.model.fields.swimlaneKey),this.model.currentViewData.GROUPGUID||(this.model.currentViewData=new t.DataManager(this.model.currentViewData).executeLocal(i).result)),this._renderAllCard(),this._eventBindings();break;case t.Kanban.Actions.BeginEdit:case t.Kanban.Actions.Add:this._editAdd(e)}i.queries=s.queries}else this.getContentTable().find("tbody").empty().first().append(this._getEmptyTbody());this._renderComplete(e),(t.Kanban.Actions.BeginEdit==e.requestType||t.Kanban.Actions.Add==e.requestType)&&this.model.editSettings.editMode==t.Kanban.EditMode.Dialog&&this._refreshEditForm(e),this._newData=null},_eventBindings:function(){var t,i,s,a,n,o;if(this._kanbanRows=this.getContentTable().get(0).rows,t=e(this._kanbanRows).not(".e-swimlanerow"),0!=this._currentJsonData.length&&null!=this.model.queryCellInfo)for(i=0;i1&&"save"==i.requestType&&"edit"==i.action&&(this._editForm=this._editForm[0]),e(this._editForm).find("select.e-dropdownlist").ejDropDownList("destroy"),e(this._editForm).find("textarea.e-rte").ejRTE("destroy"),e(this._editForm).find(".e-datepicker").ejDatePicker("destroy"),e(this._editForm).find(".e-datetimepicker").ejDateTimePicker("destroy"),e(this._editForm).find(".e-numerictextbox").ejNumericTextbox("destroy"),e(this._editForm).addClass("e-formdestroy")),i&&i.requestType==t.Kanban.Actions.Delete&&i.div.remove(),this._dataSource()instanceof t.DataManager&&i.requestType!=t.Kanban.Actions.BeginEdit&&i.requestType!=t.Kanban.Actions.Cancel&&i.requestType!=t.Kanban.Actions.Add){this.element.ejWaitingPopup("show");var s=this._queryPromise=this._dataSource().executeQuery(this.model.query),a=this;a._dataSource().ready?a._dataSource().ready.done(function(){a._processDataRequest(a,i,s)}):a._processDataRequest(a,i,s)}else this.sendDataRenderingRequest(i)},_processDataRequest:function(e,i,s){s.done(t.proxy(function(t){e.element.ejWaitingPopup("hide"),e._currentJsonData=e.model.currentViewData=null==t.result?[]:t.result,e._processData(t,i)})),s.fail(t.proxy(function(t){e.element.ejWaitingPopup("hide"),i.error=t.error,t=[],e.model.currentViewData=[],e._processData(t,i),e._trigger("actionFailure",i)}))},_processData:function(e,i){t.isNullOrUndefined(this.model.filterSettings)||("filtering"==i.requestType||this.model.filterSettings.length>0&&i.requestType==t.Kanban.Actions.Refresh)&&(this._filteredRecordsCount=e.count),this.sendDataRenderingRequest(i)},_renderComplete:function(i){"beginedit"!=i.requestType&&this._setWidthToColumns(),(i.requestType==t.Kanban.Actions.Save||i.requestType==t.Kanban.Actions.Cancel)&&(this._isAddNew=!1),(t.Kanban.Actions.Delete==i.requestType||t.Kanban.Actions.Save==i.requestType)&&this._editEventTrigger(i),this._tableBEle=this.getContentTable().get(0),this._kanbanRows=this._tableBEle.rows,this._columnRows=e(this._kanbanRows).not(".e-swimlanerow"),this.model.allowScrolling&&!this.initialRender&&this.getContentTable().find("tr:last").find("td").addClass("e-lastrowcell"),this._trigger("actionComplete",i),!this.initialRender&&this.model.allowScrolling&&(i.requestType==t.Kanban.Actions.Add||i.requestType==t.Kanban.Actions.Cancel||i.requestType==t.Kanban.Actions.Save||i.requestType==t.Kanban.Actions.Delete||i.requestType==t.Kanban.Actions.Filtering||i.requestType==t.Kanban.Actions.Refresh)&&this._refreshScroller(i),(i.requestType==t.Kanban.Actions.Cancel||i.requestType==t.Kanban.Actions.Delete)&&(this._renderLimit(),this._totalCount()),i.requestType==t.Kanban.Actions.Filtering&&this._filterLimitCard(i),this.model.allowDragAndDrop&&t.kanbanFeatures.dragAndDrop&&this._addDragableClass()},_totalCount:function(){for(var t,i=0;i0&&(!a.shiftKey&&!a.ctrlKey||this.model.selectionType==t.Kanban.SelectionType.Single)&&!t.isNullOrUndefined(this.model.fields.swimlaneKey)&&(this._cardSelection([[this._columnRows.index(v.closest("tr.e-columnrow")),[v.closest("tr.e-columnrow").find("td.e-rowcell").index(v.closest("td.e-rowcell"))],[0]]],v,a),0==this.element.find(".e-cardselection").closest("tr:visible").length&&this.toggleSwimlane(e(this._columnRows[this.selectedRowCellIndexes[0].rowIndex]).prev().prev(".e-swimlanerow").find(".e-slcollapse"))));m.find(".e-kanbancard:visible").length>0?(r=m.find(".e-kanbancard"),r.eq(l).length>0?this._cardSelection([[o.rowIndex,[i+1],[l]]],e(r[l]),a):this._cardSelection([[o.rowIndex,[i+1],[r.length-1]]],e(r[r.length-1]),a),(a.shiftKey||a.ctrlKey)&&this.model.selectionType!=t.Kanban.SelectionType.Single||t.isNullOrUndefined(this.model.fields.swimlaneKey)||0==this.element.find(".e-cardselection").closest("tr.e-columnrow:visible").length&&this.toggleSwimlane(e(this._columnRows[this.selectedRowCellIndexes[0].rowIndex]).prev().prev(".e-swimlanerow").find(".e-slcollapse"))):this._moveCurrentCard(i+1,s,a)}else if("left"==s){if(0!=f.index(b)&&(v=f.eq(f.index(b)-1)),0==i){if(!a.shiftKey&&!a.ctrlKey&&!t.isNullOrUndefined(this.model.fields.swimlaneKey)){if(this.toggleSwimlane(e(c).prev().find(".e-slexpand")),t.isNullOrUndefined(v))return;(v.length>0&&!a.shiftKey&&!a.ctrlKey||this.model.selectionType==t.Kanban.SelectionType.Single)&&(this._cardSelection([[this._columnRows.index(v.closest("tr.e-columnrow")),[v.closest("tr.e-columnrow").find("td.e-rowcell").index(v.closest("td.e-rowcell"))],[0]]],v,a),0==this.element.find(".e-cardselection").closest("tr.e-columnrow:visible").length&&this.toggleSwimlane(e(this._columnRows[this.selectedRowCellIndexes[0].rowIndex]).prev().prev(".e-swimlanerow").find(".e-slcollapse")))}return}p.find(".e-kanbancard:visible").length>0?(r=p.find(".e-kanbancard"),r.eq(l).length>0?this._cardSelection([[o.rowIndex,[i-1],[l]]],e(r[l]),a):this._cardSelection([[o.rowIndex,[i-1],[r.length-1]]],e(r[r.length-1]),a),(a.shiftKey||a.ctrlKey)&&this.model.selectionType!=t.Kanban.SelectionType.Single||t.isNullOrUndefined(this.model.fields.swimlaneKey)||0==this.element.find(".e-cardselection").closest("tr.e-columnrow:visible").length&&this.toggleSwimlane(e(this._columnRows[this.selectedRowCellIndexes[0].rowIndex]).prev().prev(".e-swimlanerow").find(".e-slexpand"))):this._moveCurrentCard(i-1,s,a)}},_keyPressed:function(i,s,a){var n,o,r,l,d;switch(n=this.element.find(".e-cardselection"),o=this.element.find(".e-kanbancard:visible"),r=this.selectedRowCellIndexes[0],a.shiftKey=!1,a.ctrlKey=!1,d=!t.isNullOrUndefined(this.model.fields.swimlaneKey),i){case"editCard":n.length>0&&this.model.editSettings.allowEditing&&(l=r.cellIndex,n=this._columnRows.eq(r.rowIndex).find("td.e-rowcell").eq(l[l.length-1]).find(".e-kanbancard").eq(r.cardIndex[l.length-1]),this.startEdit(n));break;case"insertCard":this.model.editSettings.allowAdding&&this.addCard();break;case"swimlaneExpandAll":this.expandAll();break;case"swimlaneCollapseAll":this.collapseAll();break;case"downArrow":n.length>0&&document.activeElement.id==this._id&&this._moveCurrentCard(r.rowIndex,"down",a);break;case"upArrow":n.length>0&&document.activeElement.id==this._id&&this._moveCurrentCard(r.rowIndex,"up",a);break;case"leftArrow":n.length>0&&document.activeElement.id==this._id&&this._moveCurrentCard(r.cellIndex[r.cellIndex.length-1],"left",a);break;case"rightArrow":n.length>0&&document.activeElement.id==this._id&&this._moveCurrentCard(r.cellIndex[r.cellIndex.length-1],"right",a);break;case"multiSelectionByDownArrow":a.ctrlKey=!0,n.length>0&&this._moveCurrentCard(r.rowIndex,"down",a);break;case"multiSelectionByUpArrow":a.ctrlKey=!0,n.length>0&&this._moveCurrentCard(r.rowIndex,"up",a);break;case"multiSelectionByRightArrow":a.shiftKey=!0,n.length>0&&this._moveCurrentCard(r.cellIndex[r.cellIndex.length-1],"right",a);break;case"multiSelectionByLeftArrow":a.shiftKey=!0,n.length>0&&this._moveCurrentCard(r.cellIndex[r.cellIndex.length-1],"left",a);break;case"firstCardSelection":this.clearSelection(),o.eq(0).addClass("e-cardselection"),n=this.element.find(".e-cardselection"),this.model.selectionType==t.Kanban.SelectionType.Multiple?this.selectedRowCellIndexes.push({ cardIndex:[[e(this._columnRows).find(".e-cardselection").index()]],cellIndex:[n.parent().index()],rowIndex:e(this._columnRows).index(n.parents(".e-columnrow"))}):this.selectedRowCellIndexes.push({cardIndex:[e(this._columnRows).find(".e-cardselection").index()],cellIndex:[n.parent().index()],rowIndex:e(this._columnRows).index(n.parents(".e-columnrow"))});break;case"lastCardSelection":this.clearSelection(),o.eq(o.length-1).addClass("e-cardselection"),n=this.element.find(".e-cardselection"),this.model.selectionType==t.Kanban.SelectionType.Multiple?this.selectedRowCellIndexes.push({cardIndex:[[e(this._columnRows).find(".e-cardselection").index()]],cellIndex:[n.parent().index()],rowIndex:e(this._columnRows).index(n.parents(".e-columnrow"))}):this.selectedRowCellIndexes.push({cardIndex:[e(this._columnRows).find(".e-cardselection").index()],cellIndex:[n.parent().index()],rowIndex:e(this._columnRows).index(n.parents(".e-columnrow"))});break;case"cancelRequest":e("#"+this._id+"_dialogEdit:visible").length>0?this.cancelEdit():n.length>0&&this.clearSelection();break;case"saveRequest":e("#"+this._id+"_dialogEdit:visible").length>0&&this.endEdit();break;case"deleteCard":n.length>0&&!e("#"+this._id+"_dialogEdit:visible").length>0&&!t.isNullOrUndefined(this.model.fields.primaryKey)&&this.deleteCard(n.attr("id"));break;case"selectedGroupExpand":n.length>0&&d&&(n.is(":visible")||this.toggleSwimlane(e(this._columnRows[this.selectedRowCellIndexes[0].rowIndex]).prev().prev(".e-swimlanerow").find(".e-slexpandcollapse")));break;case"selectedGroupCollapse":n.length>0&&d&&n.is(":visible")&&this.toggleSwimlane(e(this._columnRows[this.selectedRowCellIndexes[0].rowIndex]).prev().find(".e-slexpandcollapse"));break;case"selectedColumnCollapse":n.length>0&&this.toggleColumn(this.model.columns[this.selectedRowCellIndexes[0].cellIndex[0]].headerText);break;case"selectedColumnExpand":0!=this._collapsedColumns.length&&this.toggleColumn(this._collapsedColumns[this._collapsedColumns.length-1]);break;case"focus":this.element.find(".e-cardselection").focus()}},_editEventTrigger:function(e){if(e.requestType==t.Kanban.Actions.Save||e.requestType==t.Kanban.Actions.Delete){var i={data:e.data,action:void 0!==e.action?e.action:e.requestType};this._trigger("end"+i.action.charAt(0).toUpperCase()+i.action.slice(1),i)}},_createTemplate:function(t,i){var s=document.createElement("script");return s.id=this._id+i+"_Template",s.type="text/x-jsrender",s.text=t,e("body").append(s),s},_addInitTemplate:function(){var i=this,s={},a=!t.isNullOrUndefined(i.model.keyField),n="msie"==t.browserInfo().name&&8==parseInt(t.browserInfo().version,10),o=this.model.allowToggleColumn;this._slTemplate="",s[i._id+"Object"]=this,s["_"+i._id+"columnKeys"]=this._getColumnKeyItems,s["_"+i._id+"tagItems"]=this._gettagItems,s["_"+i._id+"colorMaps"]=this._getColorMaps,s["_"+i._id+"getId"]=this._removeIdSymbols,s["_"+i._id+"getData"]=this._columnData,s["_"+i._id+"getCardCount"]=this._columnCardcount,s["_"+i._id+"getStatus"]=this._columnStatus,e.views.helpers(s),this.model.fields.swimlaneKey&&(this._slTemplate+="{{for dataSource ~columns=columns ~ds=dataSource}}",this._slTemplate+="
    {{:key}}
    {{if "+this.model.swimlaneSettings.showCount+"}}
    "+i.localizedLabels.SwimlaneCaptionFormat+"
    {{/if}}"),this._slTemplate+="",this._slTemplate+=this.model.fields.swimlaneKey?"{{for ~columns ~items=#data.items}}":"{{for columns}}",this._slTemplate+="{{if "+a+"}}{{for ~_"+i._id+"columnKeys('"+i._id+"Object')}}",this._slTemplate+=this._cardCustomization()+"{{/for}}{{/if}}
    {{:headerText}}
    [
    {{:~_"+i._id+"getCardCount(~root.dataSource,key,#parent.parent.index) }}
    ]
    {{/for}}",this.model.fields.swimlaneKey&&(this._slTemplate+="{{/for}}"),this.templates[this._id+"_JSONTemplate"]=e.templates(this._createTemplate(this._slTemplate,"_swinlaneContent")),this.templates[this._id+"_cardTemplate"]=e.templates(this._createTemplate(this._cardTemplate,"_cardTemplate")),e.templates(this.templates)},_cardCustomization:function(){var i=this,s=this.model.allowToggleColumn,a=!!this.model.cardSettings.template,n=!!this.model.fields.imageUrl,o=this.model.fields,r=(!t.isNullOrUndefined(o.title),o.title?o.title:o.primaryKey?o.primaryKey:null),l=o.tag||o.content;return this._cardTemplate="
    {{if "+a+"}}"+e(i.model.cardSettings.template).html()+"{{else}}{{if "+i.model.allowTitle+"}}
    {{:"+r+"}}
    {{/if}}
    {{if "+l+"}}
    {{:"+o.content+"}}
    {{if "+o.tag+"}}{{for ~_"+i._id+"tagItems("+o.tag+")}}{{:#data}}{{/for}}{{/if}}
    {{/if}}
    {{if "+n+" }}
    {{if "+o.imageUrl+"}}{{else}}
    {{/if}}{{/if}}
    {{/if}}
    ",this._cardTemplate},_removeIdSymbols:function(e){return e.replace(/[-\s']/g,"_")},_columnStatus:function(e){var t=this.getRsc("helpers",e),i=t.getBrowserDetails();return"msie"==i.browser},_columnCardcount:function(e,i,s){var a,n=0;if(t.isNullOrUndefined(s)){for(a=0;a"+e[t]+"");return i.concat("")},_kbnTouchClick:function(i){this.model.selectionType==t.Kanban.SelectionType.Multiple&&this._kTouchBar.is(":visible")&&!e(i.target).hasClass("e-cardselection")&&e(i.target).parents(".e-cardselection").length<=0&&!e(i.target).hasClass("e-cardtouch")&&e(i.target).parents(".e-cardtouch").length<=0&&!this._kTouchBar.find(".e-cardtouch").hasClass("e-spanclicked")&&this._kTouchBar.hide()},_clickHandler:function(i){var s,a=e(i.target),n=a.hasClass("e-rowcell")?a.index():a.closest(".e-rowcell").index(),o=this.getIndexByRow(a.closest("tr.e-columnrow"));s=a.closest(".e-kanbancard"),(a.hasClass("e-cardexpand")||a.hasClass("e-cardcollapse")||a.hasClass("e-expandcollapse"))&&this.toggleCard(a),(a.closest(".e-clexpand").length||a.closest(".e-clcollapse").length||a.closest(".e-shrink").length||a.closest(".e-stackedHeaderRow").length)&&this.model.allowToggleColumn&&this.toggleColumn(a),!t.isNullOrUndefined(this.model.fields.swimlaneKey)&&(a.hasClass("e-slexpandcollapse")||a.hasClass("e-slexpand")||a.hasClass("e-slcollapse"))&&this.toggleSwimlane(a),this.model.allowSelection&&s.length>0&&a.closest(".e-expandcollapse").length<=0&&(this.model.selectionType==t.Kanban.SelectionType.Single?this._cardSelection([[o,[n],[s.index()]]],s,i):this.model.selectionType==t.Kanban.SelectionType.Multiple&&(i.shiftKey||i.ctrlKey||this._enableMultiTouch?(0==this._currentRowCellIndex.length||o==this._currentRowCellIndex[0][0])&&this._cardSelection([[o,[n],[s.index()]]],s,i):this._cardSelection([[o,[n],[s.index()]]],s,i))),s.length>0&&this._cardClick(a,s),a.attr("id")==this._id+"_Cancel"&&this.cancelEdit(),a.attr("id")==this._id+"_Save"&&this.endEdit(),a.hasClass("e-cardtouch")&&(a.hasClass("e-spanclicked")?(a.removeClass("e-spanclicked"),this._enableMultiTouch=!1,this._kTouchBar.hide()):(a.addClass("e-spanclicked"),this._enableMultiTouch=!0))},toggleCard:function(t){var i,s;if("string"==typeof t||"number"==typeof t)i=this.element.find("div.e-kanbancard[id="+t+"]"),this._toggleCardByTarget(e(i).find(".e-cardheader .e-icon"));else if("object"==typeof t&&"DIV"!=t[0].nodeName)for(s=0;s0)this._toggleField(l[a.index()].headerText);else if(t.closest(".e-shrink").find(".e-shrinkheader").length>0)for(n=0;n0)for(i=t.closest(".e-stackedHeaderCell"),n=0;n0&&!e(s).hasClass("e-cardselection")&&(this._previousRowCellIndex=[[this._currentRowCellIndex[0][0],[this._currentRowCellIndex[0][1][0]],[this._currentRowCellIndex[0][2][0]]]]),t.isNullOrUndefined(s.attr("id"))||(r=t.DataManager(this._currentJsonData),g=r.executeLocal((new t.Query).where(this.model.fields.primaryKey,t.FilterOperators.equal,s.attr("id")))),t.isNullOrUndefined(this._previousRowCellIndex)||0==this._previousRowCellIndex.length||(p=this._getCardbyIndexes(this._previousRowCellIndex)),o={currentCell:n,target:s,cellIndex:i[0][1][0],cardIndex:i[0][2][0],data:g,previousRowCellIndex:this._previousRowCellIndex,previousCard:p,selectedCardsData:this._selectedCardData},!this._trigger("beforeCardSelect",o)){if(e(s).hasClass("e-cardselection")||(this.model.selectionType!=t.Kanban.SelectionType.Multiple||this._kTouchBar.find(".e-cardtouch").hasClass("e-spanclicked")||this._kTouchBar.hide(),"touch"!=a.pointerType||this._kTouchBar.find(".e-cardtouch").hasClass("e-spanclicked")||this.model.selectionType!=t.Kanban.SelectionType.Multiple||(l=e(s).offset(),this._kTouchBar.show(),this._kTouchBar.offset({top:l.top,left:l.left}))),this.model.selectionType==t.Kanban.SelectionType.Multiple&&a.shiftKey){var _,f,b=0,v=0,x=s,w=[];for(t.isNullOrUndefined(p)?f=s.parents(".e-columnrow").find(".e-kanbancard"):(_=p.parents(".e-columnrow"),_.find(".e-cardselection").not(p).removeClass("e-cardselection"),f=_.find(".e-kanbancard"),b=f.index(p)),this._selectedCards=[],this._selectedCardData=[],this.selectedRowCellIndexes=[];v<=0;)c=[],d=e(f[b]).parents(".e-columnrow"),h=e(f[b]).parents(".e-rowcell"),e(f[b]).addClass("e-cardselection"),w.push(f[b]),this._selectedCardData.push(this._getKanbanCardData(this._currentJsonData,f[b].id)[0]),c=[[this.element.find(".e-columnrow").index(d),[h.index()],[h.find(e(f[b])).index()]]],f[b].id==x.attr("id")&&(v=1),this._pushIntoSelectedArray(c),t.isNullOrUndefined(p)?++b:i[0][1][0]0?l.removeClass("e-vscroll-area"):l.addClass("e-vscroll-area"))}},expandAll:function(){var t,i=this.element.find(".e-swimlanerow .e-slcollapse");if(0!=i.length)for(t=0;t0)&&(this.model.allowHover&&("mouseenter"==i.type?t.isNullOrUndefined(a)||n.index()!=-1&&n.addClass("e-hover"):a.find(".e-kanbancard").removeClass("e-hover")),!1)},columns:function(i,s,a){var n,o,r,l,d;if(!t.isNullOrUndefined(i)){for(n=!1,"string"==typeof i?(i=[i],n=!0):i instanceof Array&&i.length&&"string"==typeof i[0]&&(n=!0),o=0;o0&&!t.isNullOrUndefined(this.model.fields.primaryKey)&&this.startEdit(n);break;case"Hide Column":a.closest(".e-headercell").find(".e-headercelldiv").length>0&&this.hideColumns(a.closest(".e-headercell").find(".e-headercelldiv").text());break;case"Delete Card":!t.isNullOrUndefined(this.model.fields.primaryKey)&&n.length>0&&this.deleteCard(n.attr("id"));break;case"Move Right":o>0&&this._dropToColumn(e(this._contexttarget).closest("td.e-rowcell").next(),n);break;case"Move Left":o>0&&this._dropToColumn(e(this._contexttarget).closest("td.e-rowcell").prev(),n);break;case"Move Up":o>0&&this._dropAsSibling(n.prev(),n,!1);break;case"Move Down":o>0&&this._dropAsSibling(n.next(),n,!0);break;case"Top of Row":o>0&&this._dropAsSibling(a.closest("td.e-rowcell").find(".e-kanbancard").first(),n,!1);break;case"Bottom of Row":o>0&&this._dropAsSibling(a.closest("td.e-rowcell").find(".e-kanbancard").last(),n,!0);break;case"Move Swimlane":s!=i.text&&o>0&&(r=a.closest(".e-kanbancard").attr("id"),l=new t.DataManager(this._currentJsonData).executeLocal((new t.Query).where(this.model.fields.primaryKey,"equal",r))[0],l[this.model.fields.swimlaneKey]=i.text,this.updateCard(r,l));break;case"Visible Columns":s!=i.text&&(d=e(i.element.parentElement).find("li").index(i.element),this.model.columns[d].visible?(this.hideColumns(i.text),e(e(i.element).find("input.e-checkbox")).ejCheckBox({checked:!1})):(this.showColumns(i.text),e(e(i.element).find("input.e-checkbox")).ejCheckBox({checked:!0})))}},_menu:function(i){var s,a,n,o,r,l,d,h,c,u,m,p,g,_,f;if(s=this._conmenu.element,this._contexttarget=i.target,a=e(i.target),n=e(this._contexttarget).closest("td.e-rowcell"),o=e(this._contexttarget).closest("tr.e-columnrow"),r=a.closest(".e-rowcell"),l=e(a).closest(".e-kanbancard"),d=this.model.contextMenuSettings.menuItems,s.css("visibility","visible"),s.find("li").hide(),a.closest(".e-kanban").attr("id")!==this._id)return void s.css("visibility","hidden");if(s.find(".e-customitem").length>0)for(h=this.model.contextMenuSettings.customMenuItems,c=s.find(".e-customitem"),m=0;m0?(e(c[m]).show(),e(c[m]).find("li").length>0&&e(c[m]).find("li").show()):e(c[m]).hide();break;case"header":this.getHeaderContent().find(a).length>0?(e(c[m]).show(),e(c[m]).find("li").length>0&&e(c[m]).find("li").show()):e(c[m]).hide();break;case"all":e(c[m]).show(),e(c[m]).find("li").length>0&&e(c[m]).find("li").show()}if(this.getContentTable().find(a).length>0){if(0==r.length)return void s.css("visibility","hidden");if(e(a).closest(".e-swimlanerow").length>0)return void s.css("visibility","hidden");if(l.length>0)return _=e(a).closest("td.e-rowcell").find(".e-kanbancard"),g=_.index(l),p=_.length,e(s.find("li").not(".e-customitem")).hide(),e(s.find(".e-customitem li")).show(),!t.isNullOrUndefined(this.model.fields.primaryKey)&&this.model.editSettings.allowEditing&&s.find(".e-content.e-cardedit").show(),g>1&&s.find(".e-move.e-up").show(),g!=p-1&&s.find(".e-row.e-bottom").show(),0!=g&&s.find(".e-row.e-top").show(),p-1-g>1&&s.find(".e-move.e-down").show(),n.next().length>0&&s.find(".e-move.e-right").show(),n.prev().length>0&&s.find(".e-move.e-left").show(),t.isNullOrUndefined(this.model.fields.primaryKey)||s.find(".e-content.delete").show(),void(this.model.fields.swimlaneKey&&this.model.fields.primaryKey&&!s.find(".e-move.e-swimlane.e-target").length>0&&(s.find(".e-move.e-swimlane").show(),s.find(".e-move.e-swimlane").find("li").show(),s.find(".e-move.e-swimlane").find("li").eq(this._columnRows.index(o)).hide()));if(r.length>0)return e(s.find("li").not(".e-customitem")).hide(),e(s.find(".e-customitem li")).show(),void(this.model.editSettings.allowAdding&&s.find(".e-add").show())}else{if(!(this.getHeaderContent().find(a).length>0))return void s.css("visibility","hidden");if(f=s.find(".e-column"),!(e(a).closest(".e-headercell").not(".e-stackedHeaderCell").length>0))return void s.css("visibility","hidden");for(e(s.find("li").not(".e-customitem")).hide(),e(s.find(".e-customitem li")).show(),e(s.find("li.e-haschild").find("li")).show(),f.show(),u=0;u",e.render[this._id+"_JSONTemplate"]({columns:this.model.columns,dataSource:this.model.currentViewData}),""].join(""),t.isNullOrUndefined(i.firstChild)||t.isNullOrUndefined(i.firstChild.lastChild)||this.getContentTable().get(0).replaceChild(i.firstChild.lastChild,this.getContentTable().get(0).lastChild),this._cardCollapse(),this._selectionOnRerender()},_renderSingleCard:function(i,s){var a,n,o,r,l,d=this.element.find("div[id='"+i+"']"),h=this,c="";if(this._dropped?(r=e.render[this._id+"_cardTemplate"](s),"msie"==t.browserInfo().name&&"8.0"==t.browserInfo().version?e(d).after(r):e(d).replaceWith(r)):(t.isNullOrUndefined(h.model.fields.swimlaneKey)?c=this.element.find(".e-columnrow:first"):(n=this._removeIdSymbols(s[h.model.fields.swimlaneKey]),o=this.element.find("tr[id='"+n+"']"),o.length>0&&(c=o.next())),a=e(c).find("td.e-rowcell[ej-mappingkey='"+s[h.model.keyField]+"']"),e(d).remove(),a.length>0&&e(a).append(e.render[this._id+"_cardTemplate"](s))),!t.isNullOrUndefined(h.model.swimlaneTemplate)){var u=this.element.find("tr[id='"+this._removeIdSymbols(s[h.model.fields.swimlaneKey])+"']"),m=u.find("td .e-count"),p=u.next().find("td");for(l=0;l0)for(t=this.element.find(".e-kanbancard"),i=0;i0?(this.element.find(".e-kanbantoolbar").remove(),this.model._filterCollection=[],this._renderToolBar().insertBefore(this.element.find(".e-kanbanheader").first())):(this.element.find(".e-kanbantoolbar").remove(),this.model.filterSettings=[],this.model._filterCollection=[],this.refresh());break;case"allowHover":this.model.allowHover=i[s],this._enableCardHover();break;case"enableRTL":this.model.enableRTL=i[s],this._enableKanbanRTL(),this.refresh(!0),this._refreshScroller({requestType:"refresh"});break;case"tooltipSettings":e.extend(this.model.tooltipSettings,i[s]),!t.isNullOrUndefined(this.model.tooltipSettings)&&this.model.tooltipSettings.enable?(this._on(this.element,"mouseover",".e-kanbancard",e.proxy(this._showToolTip,this)),this._on(this.element,"mouseout",".e-kanbancard",e.proxy(this._hideToolTip,this))):(this._off(this.element,"mouseover",".e-kanbancard",e.proxy(this._showToolTip,this)),this._off(this.element,"mouseout",".e-kanbancard",e.proxy(this._hideToolTip,this)));break;case"allowScrolling":case"scrollSettings":if(a=this.getContent(),"allowScrolling"!=s){if(!t.util.isNullOrUndefined(i.scrollSettings)){if(e.isEmptyObject(i.scrollSettings))break;e.extend(this.model.scrollSettings,i.scrollSettings)}t.util.isNullOrUndefined(i.allowScrolling)||(this.model.allowScrolling=i.allowScrolling),t.util.isNullOrUndefined(a.data("ejScroller"))||a.ejScroller("destroy"),this.model.allowScrolling?(this.getHeaderContent().find("div").first().addClass("e-headercontent"),this._originalScrollWidth=this.model.scrollSettings.width,this._renderScroller()):(this.element.children(".e-kanbanheader").removeClass("e-scrollcss"),0==this.element.get(0).style.width.length&&this.element.css("width","auto"))}break;case"allowFreezeSwimlane":this.model.scrollSettings.allowFreezeSwimlane=i[s],i[s]?this.getContent().data("ejScroller").scrollY(0):this._freezeSwimlaneRow.remove();break;case"dataSource":a=this.element.find(".e-kanbancontent").first(),this._refreshDataSource(this._dataSource()),this._addLastRow();break;case"editSettings":e.extend(this.model.editSettings,i[s]),this._processEditing(),this._tdsOffsetWidth=[],e("#"+this._id+"_dialogEdit").data("ejDialog")&&e("#"+this._id+"_dialogEdit").ejDialog("destroy"),e("#"+this._id+"_dialogEdit_wrapper,#"+this._id+"_dialogEdit").remove(),(this.model.editSettings.allowEditing||this.model.editSettings.allowAdding)&&this.element.append(this._renderDialog()),this._enableEditingEvents();break;case"allowSelection":i[s]&&(this._off(this.element,"click",this._clickHandler),this._on(this.element,"click",this._clickHandler));break;case"query":this.model.query=e.extend(!0,{},i[s]);break;case"stackedHeaderRows":"stackedHeaderRows"==s&&(this.model.stackedHeaderRows=i[s]),this.model.stackedHeaderRows.length>0?this._refreshStackedHeader():(this.element.find(".e-stackedHeaderRow").remove(),this.model.stackedHeaderRows=[]);break;case"template":this.model.cardSettings.template=i[s],this.element.find(".e-kanbancard").remove(),this.refreshTemplate(),this._renderAllCard(),this._enableDragandScroll();break;case"allowToggleColumn":this.model.allowToggleColumn=i[s],this.refreshTemplate(),this.getHeaderContent().replaceWith(this.getHeaderContent(),this._renderHeader()),this.sendDataRenderingRequest({requestType:t.Kanban.Actions.Refresh}),this.model.allowToggleColumn||this.element.find(".e-shrinkheader").not(".e-hide").addClass("e-hide");break;case"locale":this.model.locale=i[s],o=this.model,o.query.queries=o.query.queries.slice(0,o.query.queries.length-1),this.element.ejKanban("destroy").ejKanban(o)}},_getLocalizedLabels:function(){return t.getLocalizedConstants(this.sfType,this.model.locale)}}),t.kanbanFeatures.dragAndDrop&&e.extend(t.Kanban.prototype,t.kanbanFeatures.dragAndDrop),t.kanbanFeatures.edit&&e.extend(t.Kanban.prototype,t.kanbanFeatures.edit),t.Kanban.Locale=t.Kanban.Locale||{},t.Kanban.Locale.default=t.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"},t.Kanban.Actions={Filtering:"filtering",BeginEdit:"beginedit",Edit:"edit",Save:"save",Add:"add",Delete:"delete",Cancel:"cancel",Refresh:"refresh",Search:"searching"},t.Kanban.EditingType={String:"stringedit",Numeric:"numericedit",Dropdown:"dropdownedit",DatePicker:"datepicker",DateTimePicker:"datetimepicker",TextArea:"textarea",RTE:"rteedit"},t.Kanban.EditMode={Dialog:"dialog",DialogTemplate:"dialogtemplate"},t.Kanban.Type={Column:"column",Swimlane:"swimlane"},t.Kanban.Target={Header:"header",Content:"content",All:"all"},t.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"},t.Kanban.SelectionType={Single:"single",Multiple:"multiple"}}(jQuery,Syncfusion),function(e,t,i){t.widget("ejReportViewer","ej.ReportViewer",{_rootCSS:"e-reportviewer",element:null,model:null,validTags:["div"],defaults:{reportServiceUrl:"",reportPath:"",reportServerUrl:"",dataSources:[],parameters:[],exportSettings:{exportOptions:15,excelFormat:"excel97to2003",wordFormat:"doc"},toolbarSettings:{items:1023,showToolbar:!0,templateId:"",click:"",showTooltip:!0},locale:"en-US",printMode:!1,renderMode:3,printOption:"Default",enablePageCache:!1,pageSettings:{orientation:null,paperSize:null},processingMode:"remote",zoomFactor:1,isResponsive:!0,reportLoaded:null,renderingBegin:null,renderingComplete:null,reportError:null,reportExport:null,drillThrough:null,reportPrint:null,viewReportClick:null,destroy:null},dataTypes:{dataSources:"array",parameters:"array",toolbarSettings:{showToolbar:"boolean"}},_dataSources:null,_svg:!0,_authenticationToken:null,_refresh:!1,_isToolbarClick:!1,_printMode:!1,_pageSetup:!1,_pageModel:null,_currentPage:1,_pageLayoutPage:1,_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:{},_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(e){var t=!1,i=!1;for(var s in e)switch(s){case"reportPath":case"reportServerUrl":case"reportServiceUrl":t=!0;break;case"dataSources":case"parameters":this._refresh=!0,this.doAjaxPost("POST",this._actionUrl,JSON.stringify({reportAction:this._reportAction.setParameters,parameters:e.parameters}),"_setParameters");break;case"processingMode":i=!0;break;case"zoomFactor":this._zoomContainer(e[s],!1);break;case"printMode":this._updatePreviewLayout(e[s],!1);break;case"toolbarSettings":this._updateToolbarmodel();break;case"locale":this._setCultureInfo();break;case"renderMode":this._reInit()}i&&!t&&this.doAjaxPost("POST",this._actionUrl,JSON.stringify({reportAction:this._reportAction.getDataSourceCredential,dataSources:this.model.dataSources,parameters:this.model.parameters}),"_getDataSourceCredential"),t&&this.doAjaxPost("POST",this._actionUrl,JSON.stringify({reportAction:this._reportAction.clearCache}),"_reportReload")},_reInit:function(){this._destroy(),this._init()},_destroyEJObjects:function(t){for(var i,s,a,n,o=0;o0&&this._destroyEJObjects(n),n=null,a.destroy()))},_destroy:function(){var t=this.element.find(".e-js");t&&t.length>0&&this._destroyEJObjects(t),t=null,this._clearPageCache(),e("#"+this._id+"_exportForm").remove(),e("#"+this._id+"_toolbar_exportListTip").remove(),e("#"+this._id+"_toolbar_fittoPagePopup").remove(),e("#"+this._id+"_rptTooltip").remove(),e(this.element).find(".e-reportviewer-viewer").remove(),e("#"+this._id+"_pageInfoPopup").remove(),e("#"+this._id+"_printPageIframe").remove(),this.doAjaxPost("POST",this._actionUrl,JSON.stringify({reportAction:this._reportAction.clearCache}),"_clearCurrentServerCache")},_init:function(){this._svg=!!window.SVGSVGElement,this._actionUrl=this.model.reportServiceUrl+"/PostReportAction",this._authenticationToken=this._getAuthenticationToken(),this._renderViewer(),this._initViewer(),this._on(e(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"),this._browserInfo=t.browserInfo()},_initViewer:function(){var e,i;this._wireEvents(),this._initToolbar(),this._clearPageCache(),this._currentPage=1,this._pageLayoutPage=this._currentPage,this.model.pageSettings.paperSize&&(this._paperName=this.model.pageSettings.paperSize,e=this._getPaperSize(this.model.pageSettings.paperSize),this._paperOrientation="Landscape"==this.model.pageSettings.orientation?"Landscape":"Portrait","Landscape"==this.model.pageSettings.orientation?(this._paperSetup.paperHeight=e.width,this._paperSetup.paperWidth=e.height):(this._paperSetup.paperHeight=e.height,this._paperSetup.paperWidth=e.width)),this._refresh||(this._preZoomVal=1,this._zoomLevel=2),this._isDocumentMap=!1,this._printMode=this.model.printMode,this._isPageDocMap=!1,this._pageDocMapFlag=!1,i=this.model.toolbarSettings,i.templateId||(this._showToolbar(i.showToolbar),this._showPrintButton(i.items&t.ReportViewer.ToolbarItems.Print),this._showRefreshButton(i.items&t.ReportViewer.ToolbarItems.Refresh),this._showZoomControl(i.items&t.ReportViewer.ToolbarItems.Zoom),this._showFittoPage(i.items&t.ReportViewer.ToolbarItems.FittoPage),this._showExportControls(i.items&t.ReportViewer.ToolbarItems.Export),this._showPrintPageSetupButton(i.items&t.ReportViewer.ToolbarItems.PageSetup),this._showExportList(),this._showPageNavigationControls(i.items&t.ReportViewer.ToolbarItems.PageNavigation),this._showParameterBlock(i.items&t.ReportViewer.ToolbarItems.Parameters),this._showPreviewButton(i.items&t.ReportViewer.ToolbarItems.PrintLayout),this._showDrillThrough(this._parents.length>0),this._showDocumentMap(!1)),this._showViewerBlock(!1),this._setContainerSize(),this._showloadingIndicator(!0)},_renderPageInfoPopup:function(){var i,s,a=e("#"+this._id+"_pageInfoPopup");a.length>0||(a=t.buildTag("div.e-reportviewer-pagepopupinfo","",{"WHITE-SPACE":"nowrap"},{id:this._id+"_pageInfoPopup"}),i=t.buildTag("input.e-reportviewer-pagenumber e-reportviewer-elementalignments ejinputtext","",{},{type:"text",value:this._currentPage,id:this._id+"_popupPageNo"}),i.css("height","25.5px"),i.css("width","25px"),i.css("background-color","black"),i.css("color","white"),i.css("border-color","black"),s=t.buildTag("span.e-reportviewer-popuptotalpage","",{},{}),s.append(" / "+this._pageModel.TotalPages),a.append(i),a.append(s),e("body").append(a),this._on(e("#"+this._id+"_popupPageNo"),"click",this._popupClick),this._on(e("#"+this._id+"_popupPageNo"),"keypress",this._onkeyPress)),"block"==a.css("display")?(a.stop().fadeIn(),a.stop().fadeOut(3e3),a.hide(3e3)):(a.show(),a.stop().fadeIn(),a.stop().fadeOut(3e3),a.hide(3e3));var n=e("#"+this._id+"_viewerContainer"),o=n.offset().left+n.width()/2-a.width()/2,r=n.offset().top+n.height()/2-a.height()/2;a.css({left:o,top:r}),this._updatePageNo()},_renderToolTip:function(){var i=t.buildTag("div.e-reportviewer-tbdiv e-reportviewer-tooltip","",{display:"none"},{id:this._id+"_rptTooltip"}),s=t.buildTag("span.e-reportviewer-headerspan","",{display:"block"},{id:this._id+"_rptTooltip_Header"}),a=t.buildTag("span.e-reportviewer-contentspan","",{display:"block"},{id:this._id+"_rptTooltip_Content"});i.append(s),i.append(a),e("body").append(i)},_renderToolBar:function(i){var s,a,n,o,r,l,d;this.model.toolbarSettings.templateId?(d=e("#"+this.model.toolbarSettings.templateId),i.append(d),d.ejToolbar({enableSeparator:!0,height:d.height(),click:this.model.toolbarSettings.click}),d.css("display","block")):(s=t.buildTag("div.e-reportviewer-toolbarcontainer .e-reportviewer-viewer","",{width:"100%"},{id:this._id+"_toolbarContainer"}),i.append(s),this._isDevice?(a=t.buildTag("ul.e-reportviewer-toolbarul","",{}),this._appendToolbarItems(a,"export"),this._appendToolbarItems(a,"gotoparent"),this._appendToolbarItems(a,"zoomin"),this._appendToolbarItems(a,"zoomout"),this._appendToolbarItems(a,"pagefit"),this._appendToolbarItems(a,"refresh"),this._appendToolbarItems(a,"documentmap"),this._appendToolbarItems(a,"parameter"),s.append(a)):(n=t.buildTag("ul.e-reportviewer-toolbarul","",{}),this._appendToolbarItems(n,"print"),this._appendToolbarItems(n,"export"),this._appendToolbarItems(n,"preview"),this._appendToolbarItems(n,"pagesetup"),s.append(n),o=t.buildTag("ul.e-reportviewer-toolbarul","",{}),this._appendToolbarItems(o,"gotofirst"),this._appendToolbarItems(o,"gotoprevious"),this._appendToolbarItems(o,"gotopage"),this._appendToolbarItems(o,"gotonext"),this._appendToolbarItems(o,"gotolast"),this._appendToolbarItems(o,"gotoparent"),s.append(o),r=t.buildTag("ul.e-reportviewer-toolbarul","",{}),this._appendToolbarItems(r,"zoomin"),this._appendToolbarItems(r,"zoomout"),this._appendToolbarItems(r,"zoom"),this._appendToolbarItems(r,"pagefit"),s.append(r),l=t.buildTag("ul.e-reportviewer-toolbarul","",{}),this._appendToolbarItems(l,"refresh"),this._appendToolbarItems(l,"documentmap"),this._appendToolbarItems(l,"parameter"),s.append(l),e("#"+this._id+"_toolbar_zoomSelection").ejDropDownList({height:"27px",width:"75px",change:this._zoomValChange,selectedItem:2})),s.ejToolbar({enableSeparator:!this._isDevice,click:e.proxy(this._toolbarClick,this)}))},_appendToolbarItems:function(e,i){var s,a,n,o,r,l,d,h,c,u,m,p,g,_,f,b,v,x,w,y,C=t.ReportViewer.Locale[this.model.locale]?t.ReportViewer.Locale[this.model.locale]:t.ReportViewer.Locale["en-us"];switch(i){case"print":s=t.buildTag("li.e-reportviewer-toolbarli","",{},{}),a=t.buildTag("span.e-reportviewer-icon e-reportviewer-print","",{},{id:this._id+"_toolbar_Print"}),s.append(a);break;case"export":s=t.buildTag("li.e-reportviewer-toolbarli","",{},{}),_=t.buildTag("span.e-reportviewer-icon e-reportviewer-export","",{},{id:this._id+"_ejtb_export"}),s.append(_);break;case"pagesetup":s=t.buildTag("li.e-reportviewer-toolbarli","",{},{}),n=t.buildTag("span.e-reportviewer-icon e-reportviewer-pagesetup","",{},{id:this._id+"_ejtb_PageSetup"}),s.append(n);break;case"gotofirst":s=t.buildTag("li.e-reportviewer-toolbarli","",{},{}),o=t.buildTag("span.e-reportviewer-icon e-reportviewer-gotofirst","",{}),s.append(o);break;case"gotolast":s=t.buildTag("li.e-reportviewer-toolbarli","",{},{}),r=t.buildTag("span.e-reportviewer-icon e-reportviewer-gotolast","",{}),s.append(r);break;case"gotonext":s=t.buildTag("li.e-reportviewer-toolbarli","",{},{}),l=t.buildTag("span.e-reportviewer-icon e-reportviewer-gotonext","",{}),s.append(l);break;case"gotoprevious":s=t.buildTag("li.e-reportviewer-toolbarli","",{},{}),d=t.buildTag("span.e-reportviewer-icon e-reportviewer-gotoprevious","",{}),s.append(d);break;case"gotoparent":s=t.buildTag("li.e-reportviewer-toolbarli","",{},{}),h=t.buildTag("span.e-reportviewer-icon e-reportviewer-gotoparent","",{}),s.append(h);break;case"gotopage":s=t.buildTag("div.e-reportviewer-tbpage","",{display:"block"},{}),c=t.buildTag("input.e-reportviewer-pagenumber e-reportviewer-elementalignments ejinputtext","",{},{type:"text",value:"0",id:this._id+"_txtpageNo","data-role":"none"}),u=t.buildTag("span.e-reportviewer-labelpageno","",{},{}),s.append(c),s.append(u);break;case"zoomin":s=t.buildTag("li.e-reportviewer-toolbarli","",{},{}),m=t.buildTag("span.e-reportviewer-icon e-reportviewer-zoomin","",{},{id:this._id+"_toolbar_zoomin"}),s.append(m);break;case"zoomout":s=t.buildTag("li.e-reportviewer-toolbarli","",{},{}),p=t.buildTag("span.e-reportviewer-icon e-reportviewer-zoomout","",{},{id:this._id+"_toolbar_zoomout"}),s.append(p);break;case"zoom":s=t.buildTag("div.e-reportviewer-ejdropdownlist","",{},{}),g=t.buildTag("select.e-reportviewer-tbdiv e-reportviewer-zoomlist","",{},{id:this._id+"_toolbar_zoomSelection","data-role":"none"}),g.append(""),g.append(""),g.append(""),g.append(""),g.append(""),g.append(""),g.append(""),s.append(g);break;case"pagefit":s=t.buildTag("li.e-reportviewer-toolbarli","",{},{}),_=t.buildTag("span.e-reportviewer-icon e-reportviewer-pagefit","",{},{id:this._id+"_ejtb_fittopage"}),s.append(_);break;case"preview":s=t.buildTag("li.e-reportviewer-toolbarli","",{},{id:this._id+"_ejtb_preview"}),f=t.buildTag("span.e-reportviewer-icon e-reportviewer-preview","",{},{}),s.append(f);break;case"refresh":s=t.buildTag("li.e-reportviewer-toolbarli","",{},{}),b=t.buildTag("span.e-reportviewer-icon e-reportviewer-refresh","",{},{id:this._id+"_toolbar_refresh"}),s.append(b);break;case"documentmap":s=t.buildTag("li.e-reportviewer-toolbarli","",{},{id:this._id+"_ejtb_documentmap"}),v=t.buildTag("span.e-reportviewer-icon e-reportviewer-documentmap","",{}),s.append(v);break;case"parameter":s=t.buildTag("li.e-reportviewer-toolbarli","",{},{id:this._id+"_ejtb_parameter"}),x=t.buildTag("span.e-reportviewer-icon e-reportviewer-parameter","",{}),s.append(x);break;case"pdf":s=t.buildTag("li.e-reportviewer-popupli e-pdf","",{},{id:this._id+"_pdf"}),s.append(C.toolbar.exportformat.Pdf);break;case"xls":s=t.buildTag("li.e-reportviewer-popupli e-excel","",{},{id:this._id+"_xls"}),s.append(C.toolbar.exportformat.Excel);break;case"word":s=t.buildTag("li.e-reportviewer-popupli e-word","",{},{id:this._id+"_word"}),s.append(C.toolbar.exportformat.Word);break;case"html":s=t.buildTag("li.e-reportviewer-popupli e-html","",{},{id:this._id+"_html"}),s.append(C.toolbar.exportformat.Html);break;case"fittopage":s=t.buildTag("li.e-reportviewer-popupli","",{},{id:this._id+"_fittoPage"});break;case"fittopagewidth":s=t.buildTag("li.e-reportviewer-popupli e-fitpagewidth","",{"padding-right":"5px"},{id:this._id+"_pageWidth",isSelect:"false"}),w=t.buildTag("span.e-reportviewer-icon e-reportviewer-emptyconetent","",{"padding-right":"4px",cursor:"pointer"},{id:this._id+"Pagewidthspan",fitType:"PAGEWIDTH"}),s.append(w),s.append(C.toolbar.fittopage.pageWidth);break;case"fittowholepage":s=t.buildTag("li.e-reportviewer-popupli e-fitpageheight","",{"padding-right":"5px"},{id:this._id+"_pageHeight",isSelect:"false"}),y=t.buildTag("span.e-reportviewer-icon e-reportviewer-emptyconetent","",{"padding-right":"4px",cursor:"pointer"},{id:this._id+"pageheightSpan",fitType:"WHOLEPAGE"}),s.append(y),s.append(C.toolbar.fittopage.pageHeight)}e.append(s)},_renderToolTipExport:function(){var e=t.buildTag("div.e-reportviewer-tbdiv e-reportviewer-icon e-reportviewer-exporttip","",{display:"none"},{id:this._id+"_toolbar_exportListTip"});return this._appendToolbarItems(e,"pdf"),this._appendToolbarItems(e,"xls"),this._appendToolbarItems(e,"word"),this._appendToolbarItems(e,"html"),e},_renderPageFitPopup:function(){var e=t.buildTag("div.e-reportviewer-tbdiv e-reportviewer-icon e-reportviewer-fittopagetip","",{display:"none"},{id:this._id+"_toolbar_fittoPagePopup"});return this._appendToolbarItems(e,"fittopagewidth"),this._appendToolbarItems(e,"fittowholepage"),e},_renderFitopagePopup:function(){var t=e("#"+this._id+"_pageviewOuterline"),i=e("#"+this._id+"_viewerContainer"),s=e("#"+this._id+"_pageWidth"),a=e("#"+this._id+"_pageHeight"),n=i.width(),o=i.height(),r=t.width(),l=t.height();o>l&&"false"==a.attr("isSelect")?a.css("opacity","0.4"):a.css("opacity","1"),n>r&&"false"==s.attr("isSelect")?s.css("opacity","0.4"):s.css("opacity","1")},_showPrintPageSetupButton:function(t){t?e("#"+this._id+"_toolbarContainer").find(".e-reportviewer-pagesetup").parent().css("display","block"):e("#"+this._id+"_toolbarContainer").find(".e-reportviewer-pagesetup").parent().css("display","none")},_renderPrintPageSetup:function(){var i,s,a,n,o,r,l=t.ReportViewer.Locale[this.model.locale]?t.ReportViewer.Locale[this.model.locale]:t.ReportViewer.Locale["en-us"],d=null,h=null,c=t.buildTag("div","",{"padding-left":"20px"},{id:this._id+"_printPageSetup"}),u=t.buildTag("div","",{"padding-bottom":"10px"},{id:this._id+"_paperSetup"}),m=t.buildTag("div","",{},{id:this._id+"_printAlignSetup"}),p=t.buildTag("div","",{},{id:this._id+"_defaultSetup"}),g=e("#"+this._id+".e-reportviewer")[0].getBoundingClientRect();"msie"==this._browserInfo.name&&8==this._browserInfo.version?(d=g.right,h=g.bottom):(d=g.width,h=g.height),c.ejDialog({width:348,position:{X:g.left+d/3+20,Y:(g.top+h/2)/2},enableModal:!1,title:l.toolbar.pagesetup.headerText,enableResize:!1,enablePersistance:!1,close:e.proxy(this._pageSettingClose,this)}),i=t.buildTag("div","",{"font-weight":"bold"},{id:this._id+"_paperSizeLabel"}),s=t.buildTag("div.e-reportviewer-ejdropdownlist","",{width:"315px","padding-bottom":"10px"},{}),i.append(" "+l.pagesetupDialog.paperSize),u.append(i),$paperSizeDDl=t.buildTag("select","",{},{id:this._id+"_PaperSize"}),$paperSizeDDl.append(''),$paperSizeDDl.append(''),$paperSizeDDl.append(''),$paperSizeDDl.append(''),$paperSizeDDl.append(''),$paperSizeDDl.append(''),$paperSizeDDl.append(''),$paperSizeDDl.append(''),$paperSizeDDl.append(''),$paperSizeDDl.append(''),$paperSizeDDl.append(''),s.append($paperSizeDDl),$paperSizeDDl.ejDropDownList({width:"95%",height:"26px",selectedIndex:10,watermarkText:"Select Option",change:e.proxy(this._setUpChange,this),enableIncrementalSearch:!0}),u.append(s);var _=t.buildTag("div","",{float:"left",width:"100%","padding-left":"4px","padding-bottom":"20px","padding-top":"5px"},{}),f=t.buildTag("div","",{float:"left",width:"15%","margin-top":"4px","margin-left":"20px"},{id:this._id+"_widthLabel"}),b=t.buildTag("div","",{float:"left",width:"25%"},{}),v=t.buildTag("div","",{float:"left",width:"17%","margin-top":"4px"},{id:this._id+"_heightLabel"}),x=t.buildTag("div","",{float:"left",width:"25%"},{}),w=t.buildTag("div","",{float:"left",width:"5%","margin-top":"4px","font-weight":"bold"},{id:this._id+"_heightUnitLabel"}),y=t.buildTag("div","",{float:"left",width:"5%","margin-top":"4px","font-weight":"bold"},{id:this._id+"_widthUnitLabel"}),C=t.buildTag("input.e-reportviewer-textbox","",{"margin-right":"5px"},{type:"text",id:this._id+"_paperHeight"}),S=t.buildTag("input.e-reportviewer-textbox","",{},{type:"text",id:this._id+"_paperWidth"});x.append(C),b.append(S),v.append(l.pagesetupDialog.height+" "),w.append(l.pagesetupDialog.unit+" "),f.append(l.pagesetupDialog.width+" "),y.append(l.pagesetupDialog.unit+" "),_.append(v),_.append(x),_.append(w),_.append(f),_.append(b),_.append(y),u.append(_),C.ejNumericTextbox({enableStrictMode:!0,width:"75px",minValue:1,enable:!1}),S.ejNumericTextbox({enableStrictMode:!0,width:"75px",minValue:1,enable:!1});var T=t.buildTag("div","",{"padding-top":"10px","font-weight":"bold"},{id:this._id+"_marginheader"}),D=t.buildTag("div","",{"padding-top":"10px","padding-left":"5px"},{}),I=t.buildTag("div","",{float:"left",width:"100%"},{}),k=t.buildTag("div","",{float:"left",width:"17%","margin-top":"4px"},{id:this._id+"_topLabel"}),P=t.buildTag("div","",{float:"left",width:"25%"},{}),L=t.buildTag("div","",{float:"left",width:"5%","margin-top":"4px","font-weight":"bold"},{id:this._id+"_topUnitLabel"}),R=t.buildTag("div","",{float:"left",width:"15%","margin-top":"4px","margin-left":"20px"},{id:this._id+"_rightLabel"}),M=t.buildTag("div","",{float:"left",width:"25%"},{}),O=t.buildTag("div","",{float:"left",width:"5%","margin-top":"4px","font-weight":"bold"},{id:this._id+"_rightUnitLabel"}),E=t.buildTag("div","",{float:"left",width:"100%","padding-top":"12px","padding-bottom":"18px"},{}),A=t.buildTag("div","",{float:"left",width:"17%","margin-top":"4px"},{id:this._id+"_bottomLabel"}),j=t.buildTag("div","",{float:"left",width:"25%"},{}),N=t.buildTag("div","",{float:"left",width:"5%","margin-top":"4px","font-weight":"bold"},{id:this._id+"_bottomUnitLabel"}),z=t.buildTag("div","",{float:"left",width:"15%","margin-top":"4px","margin-left":"20px"},{id:this._id+"_leftLabel"}),F=t.buildTag("div","",{float:"left",width:"25%"},{}),B=t.buildTag("div","",{float:"left",width:"5%","margin-top":"4px","font-weight":"bold"},{id:this._id+"_leftUnitLabel"});T.append(" "+l.pagesetupDialog.margins),m.append(T);var H=t.buildTag("input.e-reportviewer-textbox","",{"margin-right":"5px"},{type:"text",id:this._id+"_paperMarginTop"}),V=t.buildTag("input.e-reportviewer-textbox","",{},{type:"text",id:this._id+"_paperMarginRight"}),U=t.buildTag("input.e-reportviewer-textbox","",{"margin-right":"5px"},{type:"text",id:this._id+"_paperMarginBottom"}),W=t.buildTag("input.e-reportviewer-textbox","",{},{type:"text",id:this._id+"_paperMarginLeft"});k.append(l.pagesetupDialog.top+" "),L.append(l.pagesetupDialog.unit+" "),P.append(H),R.append(l.pagesetupDialog.right+" "),O.append(l.pagesetupDialog.unit+" "),M.append(V),I.append(k),I.append(P),I.append(L),I.append(R),I.append(M),I.append(O),D.append(I),A.append(l.pagesetupDialog.bottom+" "),N.append(l.pagesetupDialog.unit+" "),j.append(U),z.append(l.pagesetupDialog.left+" "),B.append(l.pagesetupDialog.unit+" "),F.append(W),E.append(A),E.append(j),E.append(N),E.append(z),E.append(F),E.append(B),D.append(E),m.append(D),H.ejNumericTextbox({width:"75px",minValue:0,maxValue:22}),V.ejNumericTextbox({width:"75px",minValue:0,maxValue:22}),U.ejNumericTextbox({width:"75px",minValue:0,maxValue:22}),W.ejNumericTextbox({width:"75px",minValue:0,maxValue:22}),a=t.buildTag("div","",{"padding-top":"10px","font-weight":"bold"},{id:this._id+"_orientationLabel"}),a.append(" "+l.pagesetupDialog.orientation),m.append(a);var G=t.buildTag("div","",{width:"100%","padding-left":"5px","padding-top":"5px"},{}),Y=t.buildTag("div","",{width:"50%",float:"left"},{}),X=t.buildTag("div","",{float:"left","margin-top":"2px"},{}),$=t.buildTag("div","",{float:"left"},{id:this._id+"_portraitLabel"}),q=t.buildTag("input","",{},{type:"radio",id:this._id+"_portrait",value:"Portrait"});X.append(q),$.append(" "+l.pagesetupDialog.portrait),Y.append(X),Y.append($),G.append(Y),q.ejRadioButton({change:e.proxy(this._orientationChanged,this),name:"orientation",checked:!0});var K=t.buildTag("div","",{width:"50%",float:"left"},{}),Q=t.buildTag("div","",{float:"left","margin-top":"2px"},{}),Z=t.buildTag("div","",{float:"left"},{id:this._id+"_landscapeLabel"}),J=t.buildTag("input","",{},{type:"radio",id:this._id+"_landscape",value:"Landscape"});Q.append(J),Z.append(" "+l.pagesetupDialog.landscape),K.append(Q),K.append(Z),G.append(K),m.append(G),J.ejRadioButton({change:e.proxy(this._orientationChanged,this),name:"orientation"}),n=t.buildTag("div","",{"padding-top":"10px",float:"right","padding-right":"13px","padding-bottom":"10px"},{}),o=t.buildTag("input.e-reportviewer-viewreportbutton e-btn","",{"margin-left":"50px","margin-top":"10px","min-width":"65px"},{type:"button",value:l.pagesetupDialog.doneButton,id:this._id+"_Submit"}),o.ejButton({showRoundedCorner:!0,height:30,click:e.proxy(this._pageSetupSubmit,this)}),r=t.buildTag("input.e-reportviewer-viewreportbutton e-btn","",{"margin-left":"10px","margin-top":"10px","min-width":"65px"},{type:"button",value:l.pagesetupDialog.cancelButton,id:this._id+"_Cancel"}),r.ejButton({showRoundedCorner:!0,height:30,click:e.proxy(this._pageSetupCancel,this)}),n.append(o),n.append(r),p.append(n),c.append(u),c.append(m),c.append(p),"msie"==this._browserInfo.name?e("#"+this._id+"_PaperSize_input").css("margin-top","-2px"):("opera"==this._browserInfo.name||"webkit"==this._browserInfo.name||"chrome"==this._browserInfo.name||"mozilla"==this._browserInfo.name)&&e("#"+this._id+"_PaperSize_input").css("padding-bottom","3px")},_renderViewerBlockinDevice:function(e){var i=t.buildTag("div.e-reportviewer-viewer e-reportviewer-viewerblock e-reportviewer-blockstyle","",{},{id:this._id+"_viewBlockContainer"});e.append(i);var s=t.buildTag("div.e-reportviewer-viewerblockcellcontent","",{margin:"1px",padding:"1px",width:"99%",height:"99%",display:"inline-table"}),a=t.buildTag("div.e-reportviewer-viewerblockcontent","",{width:"100%",height:"auto"}),n=t.buildTag("div.e-reportviewer-viewreport","",{width:"100%",height:"30px","border-left":"0px",padding:"10px 0"}),o=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 n.append(o),s.append(a),s.append(n),o.ejButton({showRoundedCorner:!0}),i.append(s),i},_renderViewerBlockinWeb:function(e){var i=t.buildTag("div.e-reportviewer-viewer e-reportviewer-viewerblock","",{},{id:this._id+"_viewBlockContainer"});e.append(i);var s=t.buildTag("table.e-reportviewer-viewerblockcellcontent","",{margin:"1px",padding:"5px 5px 10px"}),a=t.buildTag("tr","",{width:"100%"}),n=t.buildTag("td.e-reportviewer-viewerblockcontent","",{}),o=t.buildTag("td.e-reportviewer-viewreport","",{}),r=t.buildTag("input.e-reportviewer-viewreportbutton e-btn","",{"margin-top":"4px"},{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 r.ejButton({height:30}),o.append(r),a.append(n),a.append(o),s.append(a),r.ejButton({showRoundedCorner:!0}),i.append(s),i},_renderViewerContainer:function(e){var i,s=t.buildTag("div","",{},{id:this._id+"_reportviewerContainer"});e.append(s);var a=t.buildTag("div.e-reportviewer-viewer e-reportviewer-scrollcontainer e-reportviewer-viewercontainer","",{height:"100%",width:"100%","font-size":"8pt"},{id:this._id+"_viewerContainer"}),n=t.buildTag("div","",{margin:"0px",height:"99.8%",width:"100%"},{id:this._id+"_loadingIndicator"}),o=t.buildTag("div","",{margin:"0px",height:"99.8%",width:"100%","background-color":"rgba(164, 183, 216, 0.18)",display:"block"},{id:this._id+"_loadingIndicatorBackView"}),r=t.buildTag("div.e-reportviewer-pageviewcontainer","",{},{id:this._id+"_pageviewOuterContainer"}),l=t.buildTag("div.e-reportviewer-pageouterline","",{},{id:this._id+"_pageviewOuterline"}),d=t.buildTag("div.e-reportviewer-pageview","",{"background-color":"#FFFFFF"},{id:this._id+"_pageviewContainer"}),h=t.buildTag("div","",{position:"relative","background-color":"transparent"},{id:this._id+"_pageviewheaderContainer"}),c=t.buildTag("div","",{position:"relative","background-color":"transparent"},{id:this._id+"_pageviewbodyContainer"}),u=t.buildTag("div","",{position:"relative","background-color":"transparent"},{id:this._id+"_pageviewfooterContainer"}),m=t.buildTag("div.pageHeaderBorder","",{position:"relative","background-color":"#FFFFFF"}),p=t.buildTag("div.pageBodyBorder","",{position:"relative","background-color":"#FFFFFF"}),g=t.buildTag("div.pageFooterBorder","",{position:"relative","background-color":"#FFFFFF"});return m.append(h),p.append(c),g.append(u),d.append(m),d.append(p),d.append(g),n.append(o),a.append(n),l.append(d),r.append(l),a.append(r),this._isDevice?this._renderViewerBlockinDevice(a):(i=t.buildTag("div.e-reportviewer-documentmapcontainer","",{},{id:this._id+"_documentmapContainer"}),s.append(i)),s.append(a),s},_renderViewer:function(){var e=this.element.height(),i=this.element.width(),s=t.buildTag("div.e-reportviewer-viewer","",{});this.element[0].style.height||0==this.element[0].parentElement.clientHeight||(this._isHeight=!0),this.element[0].style.width||0==this.element[0].parentElement.clientWidth||(this._isWidth=!0),0===e&&0!=this.element[0].parentElement.clientHeight&&this.element.height(this.element[0].parentElement.clientHeight),0===i&&0!=this.element[0].parentElement.clientWidth&&this.element.width(this.element[0].parentElement.clientWidth),this.element.append(s),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),this._renderToolBar(s),this._isDevice||(this._renderViewerBlockinWeb(s),this._renderToolTip()),this._renderViewerContainer(s)},_renderCredentialBlock:function(i){for(var s,a,n,o,r,l,d=t.buildTag("table","",{},{}),h=0;h'),a=t.buildTag("tr","",{},{}),this._appendCredentialItems(a,"namelbl",c),n=t.buildTag("tr","",{},{}),this._appendCredentialItems(n,"nametxt",c),o=t.buildTag("tr","",{},{}),this._appendCredentialItems(o,"passwdlbl",c),r=t.buildTag("tr","",{},{}),this._appendCredentialItems(r,"passwdtxt",c),d.append(a),d.append(n),d.append(o),d.append(r),d.append('')):(s=t.buildTag("tr","",{},{}),this._appendCredentialItems(s,"namelbl",c),this._appendCredentialItems(s,"nametxt",c),s.append(t.buildTag("td.e-reportviewer-viewerblockcellcontent","",{width:"7px"},{})),this._appendCredentialItems(s,"passwdlbl",c),this._appendCredentialItems(s,"passwdtxt",c),d.append(u),d.append(''),d.append(s),d.append(''))}this._wiredViewClickEvent(i),l=e("#"+this._id+"_viewBlockContainer").find(".e-reportviewer-viewerblockcontent"),l.append(d)},_wiredViewClickEvent:function(t){this._on(e("#"+this._id+"_viewReportClick"),"click",{ds:t},this._viewReportCredentialClick)},_unwiredViewClickEvent:function(){this._off(e("#"+this._id+"_viewReportClick"),"click",this._viewReportCredentialClick)},_appendCredentialItems:function(e,i,s){var a,n,o;switch(i){case"namelbl":a=t.buildTag("td.e-reportviewer-viewerblockcellcontent","",{},{}),a.append("Login Name ");break;case"nametxt":a=t.buildTag("td.e-reportviewer-viewerblockcellcontent","",{},{}),n=t.buildTag("input.e-reportviewer-textbox","",{},{type:"text",autocomplete:"off",id:s.ControlId+"_loginName"}),a.append(n);break;case"passwdlbl":a=t.buildTag("td.e-reportviewer-viewerblockcellcontent","",{},{}),a.append("Password ");break;case"passwdtxt":a=t.buildTag("td.e-reportviewer-viewerblockcellcontent","",{},{}),o=t.buildTag("input.e-reportviewer-textbox","",{},{type:"password",autocomplete:"off",id:s.ControlId+"_password"}),a.append(o)}e.append(a)},_viewReportCredentialClick:function(t){for(var i=t.data.ds,s=[],a=0;a0){if(s=e("#"+this._id+"_viewBlockContainer").find(".e-reportviewer-viewerblockcontent"),a=this._onRenderingBegin({reportParameters:e.extend(!0,{},i),parameterBlock:e("#"+this._id+"_viewBlockContainer")}),!a)for(s.html(u),n=0;n'),r=t.buildTag("tr","",{},{}),u.append(r),d=t.buildTag("td.e-reportviewer-viewerblockcellcontent","",{},{}),d.append(o.Promt+"  "),r.append(d),r=t.buildTag("tr","",{},{}),u.append(r),h=t.buildTag("td.e-reportviewer-viewerblockcellcontent","",{"min-width":"130px","max-width":"185px"},{}),r.append(h),l=t.buildTag("div","",{width:"100%",display:"flex","white-space":"nowrap"},{id:o.ControlId+"_div"}),h.append(l)):(n%2==0?(u.append(''),r=t.buildTag("tr","",{},{}),u.append(r)):(c=t.buildTag("td","",{width:"15px"},{}),r.append(c)),d=t.buildTag("td.e-reportviewer-viewerblockcellcontent","",{},{}),d.append(o.Promt+"  "),r.append(d),h=t.buildTag("td.e-reportviewer-viewerblockcellcontent","",{"min-width":"130px","max-width":"185px"},{}),r.append(h),l=t.buildTag("div","",{width:"100%",display:"flex","white-space":"nowrap"},{id:o.ControlId+"_div"}),h.append(l)),this._renderParameterElements(o,l)}else this._showParameterBlock(!1);return u.append(''),this._onRenderingComplete({reportParameters:e.extend(!0,{},i)}),this._on(e("#"+this._id+"_viewReportClick"),"click",{params:i},this._viewReportParamsClick),a},_renderParameterElements:function(i,s){var a,n,o,r,l,d,h,c,u,m,p,g,_,f,b,v,x,w;if(i.IsMultiValue){if(r=[],l=t.buildTag("select","",{},{id:i.ControlId,name:i.Name,"sf-name":i.Name}),i.AvailableLabels){for(o=e('"'),l.append(o),d=e.extend(i.DefaultValuesfields,!0),i.Values&&i.Values.length>0&&(d=i.Values),h=0;h'+i.AvailableLabels[h]+""),jQuery.inArray(i.AvailableValues[h],d)!=-1&&r.push(h+1),l.append(o);i.AvailableValues.length==r.length&&r.push(0),s.append(l),l.ejDropDownList({width:"95%",height:"26px",showCheckbox:!0,selectedIndices:r,watermarkText:"Select Option",change:i.IsDependent?this._paramsChangeEvent:"",checkChange:this._selectionChanged})}else if(i.DefaultValues){for(o=e('"'),l.append(o),d=e.extend(i.DefaultValuesfields,!0),i.Values&&i.Values.length>0&&(d=i.Values),h=0;h'+i.DefaultValues[h]+""),jQuery.inArray(i.DefaultValues[h],d)!=-1&&r.push(h+1),l.append(o);i.DefaultValues.length==r.length&&r.push(0),s.append(l),l.ejDropDownList({width:"95%",height:"26px",showCheckbox:!0,selectedIndices:r,watermarkText:"Select Option",change:i.IsDependent?this._paramsChangeEvent:"",checkChange:this._selectionChanged})}}else if(null!=i.AvailableValues){var y=t.buildTag("select","",{},{id:i.ControlId,name:i.Name,data:"select","sf-name":i.Name}),C=9999,S=!1;for(h=0;h'+i.AvailableLabels[h]+""),i.AvailableLabels[h]==i.Label&&(C=h),y.append(o)):"Select a value"==i.AvailableLabels[h]&&(S=!0);S&&(C-=1),s.append(y),c={width:"95%",height:"26px",watermarkText:"Select a Value",change:i.IsDependent?this._paramsChangeEvent:"",enableIncrementalSearch:!0},9999!=C&&(c.selectedIndex=C),y.ejDropDownList(c)}else"DateTime"==i.DataType?(u=t.buildTag("input.e-reportviewer-textbox e-reportviewer-DateTime","",{},{type:"text",id:i.ControlId,maxlength:"256",name:i.Name}),s.append(u),m=i.Label.indexOf("-")?i.Label.replace(/\-/g,"/"):i.Label,u.ejDatePicker({width:i.IsNullable?"75%":"95%",height:"26px",value:null!=i.Label&&i.Label.length>0?new Date(m?m:i.Label):null,change:i.IsDependent?this._paramsChangeEvent:"",locale:this.model.locale}),i.IsNullable&&(a=t.buildTag("span","",{"WHITE-SPACE":"nowrap",display:"block"},{}),n=t.buildTag("input","",{},{type:"checkbox",name:"chkDateTime",id:i.ControlId+"~chk",value:this._id}),a.append(n),a.append(" Null"),s.append(" "),s.append(a),null!=i.Label&&i.Label.length>0?n.ejCheckBox({change:this._paramNullChange}):(n.ejCheckBox({change:this._paramNullChange,checked:!0}),this._paramElementDisable(i.ControlId,"chkDateTime",!0)))):"Boolean"==i.DataType?(p=t.buildTag("table","",{},{}),g=t.buildTag("tr","",{},{}),p.append(g),_=!1,null!=i.Label&&i.Label.length>0&&"true"==i.Label.toLowerCase()&&(_=!0),f=t.buildTag("td","",{},{}),b=t.buildTag("input","",{},{type:"radio",name:i.Name,id:i.ControlId+"_01"}),f.append(b),f.append(" True"),b.ejRadioButton({checked:_}),g.append(f),g.append(""),v=t.buildTag("td","",{},{}),x=t.buildTag("input","",{},{type:"radio",name:i.Name,id:i.ControlId+"_02"}),v.append(x),v.append(" False"),null!=i.Label&&i.Label.length>0&&(_=!_),x.ejRadioButton({checked:_}),g.append(v),s.append(p),i.IsNullable&&(a=t.buildTag("span","",{"WHITE-SPACE":"nowrap",display:"block"},{}),n=t.buildTag("input","",{},{type:"checkbox",name:"chkRadio",id:i.ControlId+"~chk",value:this._id}),a.append(n),a.append(" Null"),s.append(" "),s.append(a),n.ejCheckBox({change:this._paramNullChange}),null!=i.Label&&i.Label.length>0?n.ejCheckBox({change:this._paramNullChange}):(n.ejCheckBox({change:this._paramNullChange,checked:!0}),this._paramElementDisable(i.ControlId,"chkRadio",!0)))):(w=t.buildTag("input.e-reportviewer-textbox","",{},{type:"text",autocomplete:"off",id:i.ControlId,maxlength:"256",name:i.Name,value:i.Label}),s.append(w),i.IsNullable?(w.css("width","75%"),a=t.buildTag("span","",{"WHITE-SPACE":"nowrap",display:"block"},{}),n=t.buildTag("input","",{},{type:"checkbox",name:"chkTextbox",id:i.ControlId+"~chk",value:this._id}),a.append(n),a.append(" Null"),s.append(" "),s.append(a),n.ejCheckBox({change:this._paramNullChange}),null!=i.Label&&i.Label.length>0?n.ejCheckBox({change:this._paramNullChange}):(n.ejCheckBox({change:this._paramNullChange,checked:!0}),this._paramElementDisable(i.ControlId,"chkTextbox",!0))):w.css("width","96%"),i.IsDependent&&this._on(w,"change",this._paramsChangeEvent))},_selectionChanged:function(){var e,t=this._activeItem;if(0==this.selectedIndexValue&&"Select All"==this.selectedTextValue)if(this.checkedStatus)for(e=1;eReport Viewer encountered some issues loading this report. Please click here to see the error details
    "),s.append(a),e("#"+this._id+"_viewBlockContainer").append(s),this._on(e("#"+this._id+"_viewBlockContainer_errmsg"),"click",{err:i},this._errorPopupblock)},_errorPopupblock:function(e){alert(e.data.err)},_resetExceptionBlock:function(){e("#"+this._id+"_viewBlockContainer table.errmsg").remove()},_renderExcpetion:function(e){this._showloadingIndicator(!1),this._renderExceptionBlock(e),this._showViewerBlock(!0)},_showExceptionResult:function(e,t){e||(this._isDevice?alert(t):(this._renderExceptionBlock(t),this._showViewerBlock(!0)))},_setContainerSize:function(){var t,i,s,a=e("#"+this._id).height(),n=0;this._isDevice||(t=e("#"+this._id+"_viewBlockContainer"),"block"==t.css("display").toLowerCase()&&(n=e("#"+this._id+"_viewBlockContainer").height())),i=this.model.toolbarSettings.templateId?e("#"+this.model.toolbarSettings.templateId).height():e("#"+this._id+"_toolbarContainer").height(),s=a-n-i-4,e("#"+this._id+"_viewerContainer").css({height:s+"px"})},_setPageSize:function(t,i,s,a){var n,o=null,r=null,l=t+s+a+3;e("#"+this._id+"_pageviewContainer").css({width:i+"px",height:l+"px"}),e("#"+this._id+"_pageviewheaderContainer").css({width:i+"px",height:s+"px"}),e("#"+this._id+"_pageviewfooterContainer").css({width:i+"px",height:a+"px"}),e("#"+this._id+"_pageviewbodyContainer").css({height:t+"px",width:i+"px"}),n=e("#"+this._id+"_pageviewContainer")[0].getBoundingClientRect(),"msie"==this._browserInfo.name&&8==this._browserInfo.version?(o=n.right,r=n.bottom):(o=n.width,r=n.height),e("#"+this._id+"_pageviewOuterline").css({width:o+"px",height:r+"px"})},_renderPageModels:function(t){e("#"+this._id+"_pageviewheaderContainer").empty(),e("#"+this._id+"_pageviewfooterContainer").empty(),e("#"+this._id+"_pageviewbodyContainer").empty(),t&&(t.ReportStyleModel&&this._applyPageStyle(e("#"+this._id+"_pageviewContainer"),t.ReportStyleModel,!1),t.HeaderStyleModel&&this._applyPageStyle(e("#"+this._id+"_pageviewContainer .pageHeaderBorder"),t.HeaderStyleModel,!1),t.FooterStyleModel&&this._applyPageStyle(e("#"+this._id+"_pageviewContainer .pageFooterBorder"),t.FooterStyleModel,!1),t.BodyStyleModel&&this._applyPageStyle(e("#"+this._id+"_pageviewContainer .pageBodyBorder"),t.BodyStyleModel,!1),t.HeaderModel&&t.HeaderModel.length>0&&this._renderPageControls(t.HeaderModel,e("#"+this._id+"_pageviewheaderContainer"),!1,null),t.FooterModel&&t.FooterModel.length>0&&this._renderPageControls(t.FooterModel,e("#"+this._id+"_pageviewfooterContainer"),!1,null),t.PageModel&&t.PageModel.length>0&&this._renderPageControls(t.PageModel,e("#"+this._id+"_pageviewbodyContainer"),!1,null)),e(".txtToggle_"+this._id).length>0&&this._drillAction(),e(".drillAction_"+this._id).length>0&&this._drillThroughAction(),e(".txtSorting_"+this._id).length>0&&this._sortingAction(),this._isDocumentMap&&!this._printMode&&(this._documentMapAction(),this._isDocumentMap=!1,this._pageDocMapFlag=!0),this._parentPageXY&&(e("#"+this._id+"_viewerContainer").animate({scrollTop:this._parentPageXY.y,scrollLeft:this._parentPageXY.x},1e3),this._parentPageXY=null),this._isDevice&&this._renderPageInfoPopup(),this.model.printMode?e("#"+this._id+"_pageviewContainer").css({"padding-left":this._pageModel.MarginLeft,"padding-top":this._pageModel.MarginTop,"padding-right":this._pageModel.MarginRight,"padding-bottom":this._pageModel.MarginBottom}):e("#"+this._id+"_pageviewContainer").css("padding","0px")},_applyPageStyle:function(e,t,i){var s=i?"PrintImage":"GetResource";t.BackgroundColor&&e.css("background-color",t.BackgroundColor),t.BackgroundSrc&&e.css("background-image","url("+this.model.reportServiceUrl+"/"+s+"/?key="+t.BackgroundSrc+"&resourcetype=sfimg&isPrint="+i+")"),t.Border&&this._applyBorderStyle(t.Border,e)},_renderPageControls:function(e,i,s,a){var n,o,r,l,d=t.buildTag("div","",{},{});for(i.html(d),n=0;n0){for(p=t.buildTag("tr","",{padding:"0px",margin:"0px",height:"0px",visibility:"collapse"},{}),h.append(p),g=0;g1&&x.attr("rowspan",R),M>1&&x.attr("colspan",M)):x.css("display","none")}}},_renderTextBoxControl:function(e,i,s,a,n){var o,r,l,d,h,c=this._controlKeyGenerator(this._id+"_"+e.Name,s,a,n),u=t.buildTag("div","",{},{id:c,title:e.ToolTip}),m={};if(i?i&&("opera"==this._browserInfo.name||"webkit"==this._browserInfo.name?(m["word-wrap"]="break-word",m["white-space"]="pre-wrap"):"msie"==this._browserInfo.name&&(m["word-wrap"]="break-word",m["white-space"]="pre-wrap"),e.CanGrow||(m.overflow="hidden")):(m.position="absolute",m.top=e.Top,m.left=e.Left,m.width=e.Width,m.height=e.Height,this._applyTextStyle(e,u,null,null,null)),o=a?"PrintImage":"GetResource",e.BackgroundSrc&&(m["background-image"]="url("+this.model.reportServiceUrl+"/"+o+"/?key="+e.BackgroundSrc+"&resourcetype=sfimg&isPrint="+a+")"),e.ToggleInfo&&!a){var p=e.IsToggle?"e-reportviewer-collapsetoggle":"e-reportviewer-expandtoggle",g=t.buildTag("div."+p+" txtToggle_"+this._id,"",{display:"block",width:"14px",height:"14px","margin-Top":"1px"},{}),_={};"msie"==this._browserInfo.name?(_["margin-right"]="1px", _.float="left"):("opera"==this._browserInfo.name||"webkit"==this._browserInfo.name||"chrome"==this._browserInfo.name||"mozilla"==this._browserInfo.name)&&(_.display="table",_["margin-right"]="2px",_.float="left"),g.data("drillObj",e.ToggleInfo),g.css(_),u.append(g),m.display="msie"==this._browserInfo.name?"inline-block":"flex",m["word-wrap"]="inherit",m["white-space"]="inherit"}if("Default"!=e.WritingMode&&"Vertical"==e.WritingMode&&("msie"==this._browserInfo.name?m["writing-mode"]="tb-rl":m.transform="rotate(90deg)"),e.ActionInfo&&(u.data("actionObj",e.ActionInfo),u.addClass("drillAction_"+this._id+" e-reportviewer-drillhover")),e.Paragraphval)for(r=0;r=1?1==v.ListLevel||4==v.ListLevel||7==v.ListLevel?(b.display="list-item",b["list-style-type"]="decimal"):2==v.ListLevel||5==v.ListLevel||8==v.ListLevel?(b.display="list-item",b["list-style-type"]="lower-roman"):(3==v.ListLevel||6==v.ListLevel||9==v.ListLevel)&&(b.display="list-item",b["list-style-type"]="lower-alpha"):"Bulleted"==v.ListStyle&&v.ListLevel>=1&&(b.display="list-item",b["list-style-type"]=v.ListStyle),f.css(b),u.append(f)}return e.Sorting&&(d="sortingUpDown",d="UpDown"==e.Sorting.Sorting?"sortingUpDown":"Up"==e.Sorting.Sorting?"sortingUp":"sortingDown",h=t.buildTag("div.e-reportviewer-"+d+" 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:e.Width-14<0?"80%":e.Width-14+"px",top:"10%"},{}),h.data("sortingObj",e.Sorting),u.append(h),m.position="relative"),u.css(m),u},_renderChartControl:function(i,s,a,n,o,r,l){var d,h,c,u,m,p,g,_,f,b,v,x,w,y,C,S,T,D,I,k,P,L,R,M;if(i.ChartAreas){var O=i.Height,E=i.Width,A="chartCtrl",j=this._controlKeyGenerator(this._id+"_"+i.Name,o,r,l),N=t.buildTag("div","",{},{id:j,title:i.ToolTip});for(n.append(N),N.css("position","absolute"),i.ChartStyle&&(i.ChartStyle.Border&&this._applyBorderStyle(i.ChartStyle.Border,N),i.ChartStyle.FillStyle&&(N.css("background-color",i.ChartStyle.FillStyle.BackgroundColor),this._applyBackgroundGradientStyle(i.ChartStyle.FillStyle,N)),f=r?"PrintImage":"GetResource",i.BackgroundImge&&N.css({"background-image":"url("+this.model.reportServiceUrl+"/"+f+"/?key="+i.BackgroundImge+"&resourcetype=sfimg&isPrint="+r+")","background-size":"100% 100%"})),s&&(A=o,O=a.height,d=parseFloat(N.css("border-left-width"),10)+parseFloat(N.css("border-right-width"),10),h=parseFloat(N.css("border-top-width"),10)+parseFloat(N.css("border-bottom-width"),10),E-=d,O-=h,N.css("position","relative")),c=O/i.ChartAreas.length,i.Top&&N.css("top",i.Top),i.Left&&N.css("left",i.Left),E&&N.css("width",E),O&&N.css("height",O),u=0;u0&&(b=i.ChartTiles[u],b.Caption&&b.Visible&&(g.model.title.text=b.Caption,b.Style&&(b.Style.Color&&(g.model.title.font.color=b.Style.Color),b.Style.Font&&(b.Style.Font.FontFamily&&(g.model.title.font.fontFamily=b.Style.Font.FontFamily),b.Style.Font.FontStyle&&(g.model.title.font.fontStyle=b.Style.Font.FontStyle),b.Style.Font.FontWeight&&(g.model.title.font.fontWeight=b.Style.Font.FontWeight),0!=b.Style.Font.FontSize&&(g.model.title.font.size=b.Style.Font.FontSize+"px"))))),v=0;v0&&(g.model.pointRegionClick=this._drillThroughClick,g.ejreportid=this._id,p.data(g._id+"actionObj_Series"+v,x),g.model.pointRegionMouseMove=function(i){return!t.isNullOrUndefined(e("#"+this._id).data(this._id+"actionObj_Series"+i.data.region.SeriesIndex))&&void e("#"+this._id+"_svg_Series"+i.data.region.SeriesIndex+"_Point"+i.data.region.Region.PointIndex).css("cursor","pointer")}),F.visibility=z.Visibility?"visible":"hide",F.tooltip.format=" x: #point.x#
    y: #point.y#",F.tooltip.visible=!0,F.enableAnimation=!1,i.CustomPaletteColors&&i.ColorPalette&&"Custom"==i.ColorPalette&&(F.fill=i.CustomPaletteColors[v]),z.Style&&z.Style.Border&&z.Style.Border.Default&&(z.Style.Border.Default.BorderBrush&&(F.border.color=z.Style.Border.Default.BorderBrush),0!=z.Style.Border.Default.Thickness&&(F.border.width=z.Style.Border.Default.Thickness),"Dashed"==z.Style.Border.Default.BorderStyle?F.border.dashArray="2,4":"Dotted"==z.Style.Border.Default.BorderStyle&&(F.border.dashArray="2,2")),z.DataPointsStyle&&z.DataPointsStyle.length>0&&("scatter"==z.Type?(T=z.DataPointsStyle[0],F.marker.shape=T.ChartMarker&&T.ChartMarker.MarkerType?T.ChartMarker.MarkerType:"Circle",T.ChartMarker.Color&&(F.marker.fill=T.ChartMarker.Color),T.ChartMarker.BorderColor&&(F.marker.border.color=T.ChartMarker.BorderColor),T.ChartMarker.Borderwidth&&(F.marker.border.width=0==T.ChartMarker.Borderwidth?2:T.ChartMarker.Borderwidth),F.marker.size.height=T.ChartMarker.Size?F.marker.size.width=parseInt(0==T.ChartMarker.Size||T.ChartMarker.Size<6)?6:T.ChartMarker.Size:F.marker.size.width=10,F.marker.visible=!0):(T=z.DataPointsStyle[0],T.ChartMarker&&(T.ChartMarker.MarkerType&&(F.marker.shape=T.ChartMarker.MarkerType),T.ChartMarker.Color&&(F.marker.fill=T.ChartMarker.Color),T.ChartMarker.BorderColor&&(F.marker.border.color=T.ChartMarker.BorderColor),T.ChartMarker.Borderwidth&&(F.marker.border.width=0==T.ChartMarker.Borderwidth?2:T.ChartMarker.Borderwidth),T.ChartMarker.Size&&(F.marker.size.height=F.marker.size.width=parseInt(0==T.ChartMarker.Size||T.ChartMarker.Size<6)?6:T.ChartMarker.Size)),F.marker.visible=!!(z.Visibility&&T.ChartMarker&&T.ChartMarker.MarkerType),z.PointValues.length>0&&z.PointValues[0].ChartDataLabel&&(F.marker.dataLabel.visible=!1,D=z.PointValues[0].ChartDataLabel,F.marker.dataLabel.visible=D.Visible,D.Visible&&(F.marker.dataLabel.connectorLine.type="line",F.marker.dataLabel.connectorLine.width=.5,F.marker.dataLabel.textPosition=D.Position&&"Default"==D.Position?"top":D.Position,F.marker.dataLabel.font.color=D.TextColor?D.TextColor:"Black",D.Font&&(F.marker.dataLabel.font.fontFamily=D.Font.FontFamily,F.marker.dataLabel.font.fontStyle=D.Font.FontStyle,F.marker.dataLabel.font.fontWeight=D.Font.FontWeight,F.marker.dataLabel.font.size=D.Font.FontSize+"px"),D.BorderStyle&&"None"!=D.BorderStyle&&(F.marker.dataLabel.border.color=D.BorderColor,F.marker.dataLabel.border.width=D.BorderWidth,F.marker.dataLabel.shape="Rectangle"),D.BackGroundColor&&"Transparent"!=D.BackGroundColor&&(F.marker.dataLabel.fill=D.BackGroundColor,F.marker.dataLabel.shape="Rectangle"))))),g.model.series.push(F)}if(i.ChartLegends&&i.ChartLegends.length>0?(I=i.ChartLegends[0],g.model.legend.visible=I.Visibilty,I.Alignment&&(g.model.legend.alignment=I.Alignment),I.Position&&(g.model.legend.position=I.Position),I.Style&&(I.Style.Color&&(g.model.legend.font.color=I.Style.Color),I.Style.Font&&(I.Style.Font.FontFamily&&(g.model.legend.font.fontFamily=I.Style.Font.FontFamily),I.Style.Font.FontStyle&&(g.model.legend.font.fontStyle=I.Style.Font.FontStyle),I.Style.Font.FontWeight&&(g.model.legend.font.fontWeight=I.Style.Font.FontWeight),0!=I.Style.Font.FontSize&&(g.model.legend.font.size=I.Style.Font.FontSize+"px")),I.Style.Border&&I.Style.Border.Default&&(I.Style.Border.Default.BorderBrush&&(g.model.legend.border.color="Default"==I.Style.Border.Default.BorderStyle?"transparent":I.Style.Border.Default.BorderBrush),0!=I.Style.Border.Default.Thickness&&(g.model.legend.border.width=I.Style.Border.Default.Thickness)))):g.model.legend.visible=!1,g.model.series.length>0&&"polar"!=g.model.series[0].type&&"radar"!=g.model.series[0].type){for(k=0;k0)for(l=0;l0)for(l=0;l0){for(m=0;m0)for(g=0;g0&&i.MapModelData[0].ShapeActionInfo&&(p.ejreportid=this._id,p.model.shapeSelected=this._drillThroughClick,f.enableSelection=!0,f.enableMouseHover=!0,p.model.mouseover=function(t){t.originalEvent.data&&t.originalEvent.data.ShapeActionInfo&&e(t.originalEvent.shape).css("cursor","pointer")}),_.ShapeSettings&&(b=e.extend(!0,{},f.shapeSettings),b.colorValuePath=_.ShapeSettings.ShapeColorValuePath,b.valuePath=_.ShapeSettings.ShapeValuePath,_.ShapeColorMappings&&_.ShapeColorMappings.length>1?b.colorMappings={equalColorMapping:_.ShapeColorMappings}:(b.autoFill=!0,b.colorPalette="palette1"),f.shapeSettings=b),_.MapCenterPointRules&&_.MapCenterPointRules.length>0&&_.MapCenterPointRules.MapSizeRule&&(v=e.extend(!0,{},f.bubbleSettings),v.maxValue=_.BubbleSettings.MaxSize,v.minValue=_.BubbleSettings.MinSize,v.colorValuePath=null==_.BubbleSettings.ColorValuePath?"Value":_.BubbleSettings.ColorValuePath,v.valuePath=_.BubbleSettings.ValuePath,_.BubbleColorMappings&&_.BubbleColorMappings.length>1&&(v.colorMappings={equalColorMapping:_.BubbleColorMappings}),f.bubbleSettings=v),_.MapPolygonTemplate&&(x=e.extend(!0,{},f.labelSettings),x.showLabels=!0,_.ShapeSettings&&(x.labelPath=_.ShapeSettings.LabelPath),x.enableSmartLabel=!1,f.labelSettings=x),y.MapLegends&&y.MapLegends.length>0&&(w=e.extend(!0,{},f.legendSettings),w.showLegend=!0,f.legendSettings=w),p.model.layers[g]=f;p.refresh(),u.css("position","relative")}},_renderGaugeControl:function(e,i,s,a,n,o,r){var l,d,h,c,u,m,p,g=e.GaugePanel,_=this._controlKeyGenerator(this._id+"_"+e.Name,n,o,r),f=t.buildTag("div","",{},{id:_});a.append(f),f.css("position","absolute"),l=e.Height,d=e.Width,e.Top&&f.css("top",e.Top),e.Left&&f.css("left",e.Left),h="Horizontal",c=0,g.RadialGauges&&g.RadialGauges.length>0&&(c+=g.RadialGauges.length),g.LinearGauges&&g.LinearGauges.length>0&&(c+=g.LinearGauges.length),g.Indicator&&g.Indicator.length>0&&(c+=g.Indicator.length),u=o?"PrintImage":"GetResource",g.GaugeFrame&&g.GaugeFrame.FrameImage&&f.css("background-image","url("+this.model.reportServiceUrl+"/"+u+"/?key="+g.GaugeFrame.FrameImage+"&resourcetype=sfimg&isPrint="+o+")"),g.Border&&this._applyBorderStyle(g.Border,f),i&&(_parentID=n,l=s.height,m=parseFloat(f.css("border-left-width"),10)+parseFloat(f.css("border-right-width"),10),p=parseFloat(f.css("border-top-width"),10)+parseFloat(f.css("border-bottom-width"),10),d-=m,l-=p),0!=c&&(l>d?(l/=c,h="Vertical"):d/=c),g.GaugeLabel&&this._renderGaugeLabels(g.GaugeLabel,f,e.Name,n,o,r),g.RadialGauges&&g.RadialGauges.length>0&&this._renderRadialGauge(g.RadialGauges,f,e.Name,h,d,l,n,o,r),g.LinearGauges&&g.LinearGauges.length>0&&this._renderLinearGauge(g.LinearGauges,f,e.Name,h,d,l,n,o,r),g.Indicator&&g.Indicator.length>0&&this._renderIndicator(g.Indicator,f,e.Name,d,l,n,o,r),i?f.css({position:"relative",width:d,height:l,"background-color":g.BackgroundColor}):f.css({width:e.Width,height:e.Height,"background-color":g.BackgroundColor})},_renderIndicator:function(e,i,s,a,n,o,r,l){function d(e,t,i){var s=document.createElementNS(c,t);for(var a in i)i.hasOwnProperty(a)&&s.setAttribute(a,i[a]);e.appendChild(s)}for(var h,c="http://www.w3.org/2000/svg",u=0;u=w&&(x=C,w=y),_.IndicatorData.Value>=x&&_.IndicatorData.Value<=w){var S=_.IndicatorState[h].FillColor,T="display: block;",D=17,I=17;switch(v){case"ArrowDown":d(p,"path",{fill:S,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"}),D=16,I=19,T+="margin-left:.5px;";break;case"ArrowDownIncline":d(p,"path",{fill:S,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"}),D=I=16,T+="margin-left:.5px;";break;case"ArrowSide":d(p,"path",{fill:S,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"}),T+="margin-left:.5px;";break;case"ArrowUp":d(p,"path",{fill:S,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"}),D=16,T+="margin-left:.5px;";break;case"ArrowUpIncline":d(p,"path",{fill:S,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"}),D=15,I=16,T+="margin-left:.5px;";break;case"BoxesAllFilled":d(p,"path",{fill:S,stroke:"lightgray",d:"M2.031005859375,7.5L8.031005859375,7.5 8.031005859375,1.5 2.031005859375,1.5 2.031005859375,7.5z"}),d(p,"path",{fill:S,stroke:"lightgray",d:"M8.96798706054688,7.5L14.9679870605469,7.5 14.9679870605469,1.5 8.96798706054688,1.5 8.96798706054688,7.5z"}),d(p,"path",{fill:S,stroke:"lightgray",d:"M2.031005859375,14.43701171875L8.031005859375,14.43701171875 8.031005859375,8.43798828125 2.031005859375,8.43798828125 2.031005859375,14.43701171875z"}),d(p,"path",{fill:S,stroke:"lightgray",d:"M8.96798706054688,14.43701171875L14.9679870605469,14.43701171875 14.9679870605469,8.43798828125 8.96798706054688,8.43798828125 8.96798706054688,14.43701171875z"}),T+="margin-top:2.5px;";break;case"BoxesNoneFilled":d(p,"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"}),d(p,"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"}),d(p,"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"}),d(p,"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"}),I=16;break;case"BoxesOneFilled":d(p,"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"}),d(p,"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"}),d(p,"path",{fill:S,stroke:"lightgray",d:"M2.031005859375,14.43701171875L8.031005859375,14.43701171875 8.031005859375,8.43798828125 2.031005859375,8.43798828125 2.031005859375,14.43701171875z"}),d(p,"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"}),I=16;break;case"BoxesThreeFilled":d(p,"path",{fill:S,stroke:"lightgray",d:"M2.031005859375,7.5L8.031005859375,7.5 8.031005859375,1.5 2.031005859375,1.5 2.031005859375,7.5z"}),d(p,"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"}),d(p,"path",{fill:S,stroke:"lightgray",d:"M2.031005859375,14.43701171875L8.031005859375,14.43701171875 8.031005859375,8.43798828125 2.031005859375,8.43798828125 2.031005859375,14.43701171875z"}),d(p,"path",{fill:S,stroke:"lightgray",d:"M8.96798706054688,14.43701171875L14.9679870605469,14.43701171875 14.9679870605469,8.43798828125 8.96798706054688,8.43798828125 8.96798706054688,14.43701171875z"}),I=16;break;case"BoxesTwoFilled":d(p,"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"}),d(p,"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"}),d(p,"path",{fill:S,stroke:"lightgray",d:"M2.031005859375,14.43701171875L8.031005859375,14.43701171875 8.031005859375,8.43798828125 2.031005859375,8.43798828125 2.031005859375,14.43701171875z"}),d(p,"path",{fill:S,stroke:"lightgray",d:"M8.96798706054688,14.43701171875L14.9679870605469,14.43701171875 14.9679870605469,8.43798828125 8.96798706054688,8.43798828125 8.96798706054688,14.43701171875z"}),I=16;break;case"Circle":d(p,"path",{fill:S,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"}),D=I=17,T+="margin-left:0.5px;";break;case"Flag":d(p,"path",{fill:S,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" }),D=16,I=15;break;case"QuartersAllFilled":d(p,"path",{fill:S,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"}),T+="margin-left:0.5px;";break;case"QuartersNoneFilled":d(p,"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"}),T+="margin-left:0.5px;";break;case"QuartersOneFilled":d(p,"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"}),d(p,"path",{fill:S,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"}),T+="margin-top:0.5px;";break;case"QuartersThreeFilled":d(p,"path",{fill:S,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"}),d(p,"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"}),T+="margin-top:0.5px;";break;case"QuartersTwoFilled":d(p,"path",{fill:S,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"}),d(p,"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"}),T+="margin-top:0.5px;margin-left:0.5px;";break;case"SignalMeterFourFilled":d(p,"path",{fill:S,stroke:"lightgray",d:"M3.44400024414063,17.3070068359375L1.53201293945313,17.3070068359375 1.53201293945313,11.5700073242188 3.44400024414063,11.5700073242188 3.44400024414063,17.3070068359375z"}),d(p,"path",{fill:S,stroke:"lightgray",d:"M7.14999389648438,17.3070068359375L5.23699951171875,17.3070068359375 5.23699951171875,9.65701293945313 7.14999389648438,9.65701293945313 7.14999389648438,17.3070068359375z"}),d(p,"path",{fill:S,stroke:"lightgray",d:"M10.8550109863281,17.3070068359375L8.9429931640625,17.3070068359375 8.9429931640625,5.83200073242188 10.8550109863281,5.83200073242188 10.8550109863281,17.3070068359375z"}),d(p,"path",{fill:S,stroke:"lightgray",d:"M14.56201171875,17.3070068359375L12.6489868164063,17.3070068359375 12.6489868164063,2.00698852539063 14.56201171875,2.00698852539063 14.56201171875,17.3070068359375z"}),I=19,T+="margin-top:-10px;;margin-left:0.5px;";break;case"SignalMeterNoneFilled":d(p,"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"}),d(p,"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"}),d(p,"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"}),d(p,"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"}),I=19,T+="margin-top:-10px;;margin-left:0.5px;";break;case"SignalMeterThreeFilled":d(p,"path",{fill:S,stroke:"lightgray",d:"M3.44400024414063,17.3070068359375L1.53201293945313,17.3070068359375 1.53201293945313,11.5700073242188 3.44400024414063,11.5700073242188 3.44400024414063,17.3070068359375z"}),d(p,"path",{fill:S,stroke:"lightgray",d:"M7.14999389648438,17.3070068359375L5.23699951171875,17.3070068359375 5.23699951171875,9.65701293945313 7.14999389648438,9.65701293945313 7.14999389648438,17.3070068359375z"}),d(p,"path",{fill:S,stroke:"lightgray",d:"M10.8550109863281,17.3070068359375L8.9429931640625,17.3070068359375 8.9429931640625,5.83200073242188 10.8550109863281,5.83200073242188 10.8550109863281,17.3070068359375z"}),d(p,"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"}),I=19,T+="margin-top:-10px;;margin-left:0.5px;";break;case"SignalMeterOneFilled":d(p,"path",{fill:S,stroke:"lightgray",d:"M3.44400024414063,17.3070068359375L1.53201293945313,17.3070068359375 1.53201293945313,11.5700073242188 3.44400024414063,11.5700073242188 3.44400024414063,17.3070068359375z"}),d(p,"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"}),d(p,"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"}),d(p,"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"}),I=19,T+="margin-top:-10px;;margin-left:0.5px;";break;case"SignalMeterTwoFilled":d(p,"path",{fill:S,stroke:"lightgray",d:"M3.44400024414063,17.3070068359375L1.53201293945313,17.3070068359375 1.53201293945313,11.5700073242188 3.44400024414063,11.5700073242188 3.44400024414063,17.3070068359375z"}),d(p,"path",{fill:S,stroke:"lightgray",d:"M7.14999389648438,17.3070068359375L5.23699951171875,17.3070068359375 5.23699951171875,9.65701293945313 7.14999389648438,9.65701293945313 7.14999389648438,17.3070068359375z"}),d(p,"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"}),d(p,"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"}),I=19,T+="margin-top:-10px;;margin-left:0.5px;";break;case"StarQuartersAllFilled":d(p,"path",{fill:S,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":d(p,"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":d(p,"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"}),d(p,"path",{fill:S,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":d(p,"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"}),d(p,"path",{fill:S,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":d(p,"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"}),d(p,"path",{fill:S,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":d(p,"path",{fill:S,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"}),T+="margin-top:1px;margin-left:0.5px;";break;case"ThreeSignsDiamond":d(p,"path",{fill:S,stroke:"lightgray",d:"M1.08401489257813,8.01901245117188L8.10400390625,15.1589965820313 15.2929992675781,8.01901245117188 8.10400390625,0.878997802734375 1.08401489257813,8.01901245117188z"}),D=16,T+="margin-top:3px;margin-left:1px;";break;case"ThreeSignsTriangle":d(p,"path",{fill:S,stroke:"lightgray",d:"M0.83099365234375,14.2340087890625L15.7950134277344,14.2340087890625 8.31298828125,1.27499389648438 0.83099365234375,14.2340087890625z"}),T+="margin-top:1px;";break;case"ThreeSymbolCheck":d(p,"path",{fill:S,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"}),d(p,"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"}),T+="margin-top:1px;margin-left:0.5px;";break;case"ThreeSymbolCross":d(p,"path",{fill:S,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"}),d(p,"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"}),T+="margin-top:3px;margin-left:1px;";break;case"ThreeSymbolExclamation":d(p,"path",{fill:S,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"}),d(p,"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"}),d(p,"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"}),T+="margin-top:3px;margin-left:1px;";break;case"ThreeSymbolUnCircledCheck":d(p,"path",{fill:S,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"}),D=I=16,T+="margin-top:3px;margin-left:.5px;";break;case"ThreeSymbolUnCircledCross":d(p,"path",{fill:S,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"}),D=I=16,T+="margin-top:5px;margin-left:1.5px;";break;case"ThreeSymbolUnCircledExclamation":d(p,"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"}),d(p,"path",{fill:S,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"}),d(p,"path",{fill:S,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"}),T+="margin-top:1px;margin-left:1px;";break;case"TrafficLight":d(p,"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"}),d(p,"path",{fill:S,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"}),D=I=18,T+="margin-top:3px;margin-left:.5px;";break;case"TrafficLightUnrimmed":d(p,"path",{fill:S,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"}),T+="margin-top:3px;margin-left:.5px;";break;case"TriangleDash":d(p,"path",{fill:S,stroke:"lightgray",d:"M13.9800109863281,7.56300354003906L0.501007080078125,7.56300354003906 0.501007080078125,4.67400360107422 13.9800109863281,4.67400360107422 13.9800109863281,7.56300354003906z"}),D=15,I=9;break;case"TriangleDown":d(p,"path",{fill:S,stroke:"lightgray",d:"M14.06201171875,0.788002014160156L7.60501098632813,7.15699768066406 1.14801025390625,0.788002014160156 14.06201171875,0.788002014160156z"}),D=15,I=9,T+="margin-top:3px;margin-left:.5px;";break;case"TriangleUp":d(p,"path",{fill:S,stroke:"lightgray",d:"M0.89599609375,7.30400085449219L7.35198974609375,0.93499755859375 13.8089904785156,7.30400085449219 0.89599609375,7.30400085449219z"}),D=15,I=9,T+="margin-top:3px;margin-left:.5px;"}b.css({width:D+"px",height:I+"px"}),m.setAttributeNS(null,"style",T),m.appendChild(p);break}}b.append(m),f.append(b),i.append(f);var k=b.width(),P=b.height(),L=k0)for(g=M.ScaleProperties.length,_=0;_0)for(v=b.pointers[0],b.pointers.pop(b.pointers[0]),x=f.RadialPointer.length,w=0;w0)for(S=b.ranges[0],b.ranges.pop(b.ranges[0]),T=f.Range.length,D=0;D"),e(u.contextEl.canvas).remove()),E.css({width:o,height:r,float:"Horizontal"==n?"left":"top"})}},_renderLinearGauge:function(i,s,a,n,o,r,l,d,h){for(var c,u,m,p,g,_,f,b,v,x,w,y,C,S,T,D,I,k,P,L,R=0;Rr?"Horizontal":"Vertical",c.ScaleProperties&&c.ScaleProperties.length>0){for(g=c.ScaleProperties.length,_=0;_0)for("thermometer"!=f.PointerType?(v=e.extend(!0,{},b.markerPointers[0]),b.markerPointers.pop(b.markerPointers[0])):(v=e.extend(!0,{},b.barPointers[0]),b.barPointers.pop(b.barPointers[0])),x=f.LinearPointer.length,w=0;w0)for(S=e.extend(!0,{},b.ranges[0]),b.ranges.pop(b.ranges[0]),T=f.Range.length,D=0;D"),e(m.contextEl.canvas).remove()),O.css({width:"Horizontal"==n?o-2*M.FrameWidth-3:o-2*M.FrameWidth,height:"Horizontal"==n?r-2*M.FrameWidth:r-2*M.FrameWidth-3,float:"Horizontal"==n?"left":"top","border-color":null!=M.FrameColor?M.FrameColor:"Transparent","border-width":M.FrameWidth,"border-style":"solid","background-color":c.BackgroundColor})}}},_renderLineControl:function(e,i,s,a){var n,o,r,l,d="http://www.w3.org/2000/svg",h=this._controlKeyGenerator(this._id+"_"+e.Name,i,s,a),c=t.buildTag("div","",{},{id:h}),u={};return u.position="absolute",u.top=e.Top,u.left=e.Left,u.width=0==e.Width?"11.00064":e.Width,u.height=0==e.Height?"16.00128":e.Height,c.css(u),this._svg?(n=document.createElementNS(d,"svg"),n.setAttributeNS(null,"width",0==e.Width?"11.00064":e.Width),n.setAttributeNS(null,"height",0==e.Height?"16.00128":e.Height),o=document.createElementNS(d,"line"),o.setAttributeNS(null,"x1",0==e.X1?e.LineWidth:e.X1-e.LineWidth),o.setAttributeNS(null,"y1",0==e.Y1?e.LineWidth:e.Y1-e.LineWidth),o.setAttributeNS(null,"x2",0==e.X2?e.LineWidth:e.X2-e.LineWidth),o.setAttributeNS(null,"y2",0==e.Y2?e.LineWidth:e.Y2-e.LineWidth),o.setAttributeNS(null,"stroke",e.LineColor),o.setAttributeNS(null,"stroke-width",e.LineWidth),o.setAttributeNS(null,"shape-rendering","crispEdges"),"Dashed"==e.LineStyle?o.setAttributeNS(null,"stroke-dasharray",""+2*e.LineWidth+","+2*e.LineWidth):"Dotted"==e.LineStyle&&o.setAttributeNS(null,"stroke-dasharray",e.LineWidth),n.appendChild(o),c.append(n)):(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; } ",r=document.createElement(""),l=document.createElement("v:stroke"),"Dotted"==e.LineStyle?l.setAttribute("dashstyle","dot"):"Dashed"==e.LineStyle?l.setAttribute("dashstyle","dash"):l.setAttribute("dashstyle","solid"),l.outerHTML=l.outerHTML,r.appendChild(l),r.style.position="absolute",r.style.width=e.Width,r.style.height=e.Height,r.style.visibility="visible",c.append(r)),c},_renderSubReportControl:function(e,i,s,a,n,o){var r,l,d,h,c=this._controlKeyGenerator(this._id+"_"+e.Name,a,n,o),u=t.buildTag("div","",{},{id:c,title:e.ToolTip});if(s.append(u),u.css("position",i?"relative":"absolute"),u.css("top",e.Top),u.css("left",e.Left),u.css("width",e.Width),u.css("height",e.Height),u.css("background-color",e.BackgroundColor),e.Padding&&(e.Padding.Left&&u.css("padding-left",e.Padding.Left),e.Padding.Right&&u.css("padding-right",e.Padding.Right),e.Padding.Top&&u.css("padding-top",e.Padding.Top),e.Padding.Bottom&&u.css("padding-bottom",e.Padding.Bottom)),e.Style&&(e.Style.Font&&(e.Style.Font.FontFamily&&u.css("font-family",e.Style.Font.FontFamily),e.Style.Font.FontSize&&u.css("font-size",e.Style.Font.FontSize),e.Style.Font.FontStyle&&u.css("font-style",e.Style.Font.FontStyle),e.Style.Font.FontWeight&&u.css("font-weight",e.Style.Font.FontWeight)),u.css("color",e.Style.TextColor?e.Style.TextColor:"black"),e.Style.TextDecoration&&u.css("text-decoration",e.Style.TextDecoration)),e.LineHeight&&u.css("line-height",e.LineHeight),e.TextAlign&&u.css("text-align",e.TextAlign),e.VerticalAlign&&u.css("vertical-align",e.VerticalAlign),e.Border&&!i&&this._applyBorderStyle(e.Border,u),e.ReportItemModels&&e.ReportItemModels.length>0)for(r=0;r0?(t=this._onReportError({errmsg:i.errmsg}),this._showExceptionResult(t,i.errmsg)):this._resetExceptionBlock(),i.pgmodel&&i.pgmodel.PageData&&(this._pageModel=i.pgmodel,this._isToolbarClick||this._enableToolbarItems(),this._onRenderingBegin(),this._gotoPage(this._currentPage),this._pageLayoutPage=this._currentPage,this.model.enablePageCache&&this._storePageCache(this._currentPage),this._onRenderingComplete(),this._refresh=!1),i.pgsetting&&this._updatePageSetup(i.pgsetting)}},_getPreviewModel:function(e){this._showNavigationIndicator(!1),this._showloadingIndicator(!1),e&&(e.isDocumentMap&&(this._isDocumentMap=e.isDocumentMap,this._isPageDocMap=this._isDocumentMap,this._pageDocMapFlag=!1),e.pgmodel&&e.pgmodel.PageData&&(this._pageModel=e.pgmodel,this._isToolbarClick||(this._selectPreviewToolItem(!0),this._enableToolbarItems()),this._gotoPage(this._currentPage),this._refresh=!1,this._initialPageSetup(e)))},_getPrintModel:function(e){e&&e.PageData&&e.PageData.length>0&&("None"==this.model.printOption?this._renderSilentPrinting(e):this._printReport(e))},_documentMapModel:function(e){e&&e.indexOf("
      ")!=-1&&(this._showDocumentMap(this.model.toolbarSettings.items&t.ReportViewer.ToolbarItems.DocumentMap),this._containerSplit(e))},_drillThroughModel:function(t){var i={x:e("#"+this._id+"_viewerContainer").scrollLeft(),y:e("#"+this._id+"_viewerContainer").scrollTop()},s=this._cloneReportViewerProperties();this._parents.push({pagePos:i,parentPro:s}),this._setInitialization(),this._authenticationToken=s._childReportAuthentication,this._unwireEvents(),this._initViewer(),this._reportLoaded(t)},_gotoParentReportModel:function(){this._setParentReportViewerProperties();var e=this._currentPage;this._unwireEvents(),this._initViewer(),this._currentPage=e,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 s,a,n,o,r,l,d=i,h=d.PaperHeight,c=d.PaperWidth,u=d.MarginTop,m=d.MarginLeft,p=e("head").find("link"),g="msie"==this._browserInfo.name&&parseInt(this._browserInfo.version)<=9,_="Default"==this.model.printOption?window.open("","pint","tabbar=no,scrollbars = yes,resizable = yes"):window.open("","_blank"),f="",b=!0;if(null!=_){for(_.document.write(""),_.printDelay=500,b=this._onReportPrint({printWind:_,isStyleLoad:!0}),s="msie"===this._browserInfo.name?'':"",b?(a="",p.each(function(t,i){e(i).attr("href",i.href),a+=i.outerHTML}),_.document.write(""+a+f+""+s)):_.document.write(""+f+""+s),n=0;n'),r=this._renderPrintContainer(o,u,m,n),_.document.write(r),_.document.write(""),g?g&&n"):_.document.write("

      "));l=_.printDelay&&_.printDelay===parseInt(_.printDelay,10)?_.printDelay:500,_.document.write(""),_.document.close(),_.focus(),setTimeout(function(){t.isNullOrUndefined(_.window)||(_.print(),setTimeout(function(){_.close()},300))},l)}},_renderSilentPrinting:function(i){var s,a,n,o,r,l,d,h=i,c=h.PaperHeight,u=h.PaperWidth,m=h.MarginTop,p=h.MarginLeft,g=e("head").find("link"),_="msie"==this._browserInfo.name&&parseInt(this._browserInfo.version)<=9,f="",b=e("#"+this._id+"_printPageIframe");if(b.length>0||(b=e(''),b.css({height:".0001px",width:".0001px",backgroundColor:"Transparent",border:"none"}),e("body").append(b)),s=b[0].contentWindow?b[0].contentWindow:b[0].contentDocument.document?b[0].contentDocument.document:b[0].contentDocument,null!=s){for(s.document.open(),s.document.write(""),s.printDelay=500,isCssLoad=this._onReportPrint({printFrame:s,isStyleLoad:!0}),a="msie"===this._browserInfo.name?'':"",isCssLoad?(n="",g.each(function(t,i){e(i).attr("href",i.href),n+=i.outerHTML}),s.document.write(""+n+f+""+a)):s.document.write(""+f+""+a),o=0;o'),l=this._renderPrintContainer(r,m,p,o),s.document.write(l),s.document.write(""),_?_&&o"):s.document.write("

      "));d=s.printDelay&&s.printDelay===parseInt(s.printDelay,10)?s.printDelay:500,s.document.write(""),s.document.close(),s.focus(),setTimeout(function(){t.isNullOrUndefined(s.window)||(s.print(),setTimeout(function(){s.window.close()},300))},d)}},_renderPrintContainer:function(i,s,a,n){var o,r,l,d,h,c,u,m,p=document.createElement("div");return document.body.appendChild(p),e(p).css({overflow:"auto",width:"1px",height:"1px"}),o=t.buildTag("div","",{position:"relative","background-color":"transparent"}),e(p).append(o),r=t.buildTag("div","",{position:"relative","background-color":"transparent",width:i.Width+"px",height:i.HeaderHeight+"px"},{}),l=t.buildTag("div.pageHeaderBorder","",{position:"relative","background-color":"#FFFFFF",left:a,top:s}),l.append(r),o.append(l),d=t.buildTag("div","",{position:"relative","background-color":"transparent",width:i.Width+"px",height:i.Height+"px"},{}),h=t.buildTag("div.pageBodyBorder","",{position:"relative","background-color":"#FFFFFF",left:a,top:s}),h.append(d),o.append(h),c=t.buildTag("div","",{position:"relative","background-color":"transparent",width:i.Width+"px",height:i.FooterHeight+"px"},{}),u=t.buildTag("div.pageFooterBorder","",{position:"relative","background-color":"#FFFFFF",left:a,top:s}),u.append(c),o.append(u),i.ReportStyleModel&&this._applyPageStyle(o,i.ReportStyleModel,!0),i.HeaderStyleModel&&this._applyPageStyle(l,i.HeaderStyleModel,!0),i.FooterStyleModel&&this._applyPageStyle(u,i.FooterStyleModel,!0),i.BodyStyleModel&&this._applyPageStyle(h,i.BodyStyleModel,!0),i.HeaderModel&&i.HeaderModel.length>0&&this._renderPageControls(i.HeaderModel,r,!0,"Print"+n),i.FooterModel&&i.FooterModel.length>0&&this._renderPageControls(i.FooterModel,c,!0,"Print"+n),i.PageModel&&i.PageModel.length>0&&this._renderPageControls(i.PageModel,d,!0,"Print"+n),m=p.innerHTML.replace(/PrintImage/g,"GetResource"),document.body.removeChild(p),m},_showPrintButton:function(t){t?e("#"+this._id+"_toolbar_Print").parent().css("display","block"):e("#"+this._id+"_toolbar_Print").parent().css("display","none")},_exportMenuClick:function(t){var i,s=e(t.target);s&&(s.hasClass("e-pdf")?i="PDF":s.hasClass("e-word")?i="Word_"+this.model.exportSettings.wordFormat:s.hasClass("e-excel")?i="Excel_"+this.model.exportSettings.excelFormat:s.hasClass("e-html")&&(i="Html"),this._exportReport(i))},_exportReport:function(t){var i,s,a,n,o,r,l,d=null;t&&t.length>0&&(i=this.model.reportServiceUrl+"/PostReportAction",e("#"+this._id+"_exportForm").length>0?(s=e("#"+this._id+"_exportForm"),s.attr("action",i),e("#"+this._id+"_exportKey").val(this._authenticationToken),e("#"+this._id+"_exportRes").val(t),d={exportAction:s},this._onReportExport(d),s.submit()):(a=document.createElement("form"),e(a).attr({id:this._id+"_exportForm",method:"post",action:i,"data-ajax":"false"}),n=document.createElement("input"),e(n).attr({type:"hidden",id:this._id+"_exportKey",name:"controlID",value:this._authenticationToken}),o=document.createElement("input"),e(o).attr({type:"hidden",id:this._id+"_exportRes",name:"resourcetype",value:t}),r=document.createElement("input"),e(r).attr({type:"hidden",id:this._id+"_exportPrint",name:"isPrint",value:!1}),l=document.createElement("input"),e(l).attr({type:"hidden",id:this._id+"_exportfileName",name:"reportName",value:""}),e(a).append(n),e(a).append(o),e(a).append(r),e(a).append(l),e("body").append(a),e(a).hide(),d={exportAction:a},this._onReportExport(d),e(a).submit())),e("#"+this._id+"_toolbar_exportListTip").hide()},_showExportList:function(){this.model.exportSettings.exportOptions&t.ReportViewer.ExportOptions.Html?e("#"+this._id+"_html").css("display","block"):e("#"+this._id+"_html").css("display","none"),this.model.exportSettings.exportOptions&t.ReportViewer.ExportOptions.Word?e("#"+this._id+"_word").css("display","block"):e("#"+this._id+"_word").css("display","none"),this.model.exportSettings.exportOptions&t.ReportViewer.ExportOptions.Excel?e("#"+this._id+"_xls").css("display","block"):e("#"+this._id+"_xls").css("display","none"),this.model.exportSettings.exportOptions&t.ReportViewer.ExportOptions.Pdf?e("#"+this._id+"_pdf").css("display","block"):e("#"+this._id+"_pdf").css("display","none")},_showExportControls:function(t){t?e("#"+this._id+"_toolbarContainer .e-reportviewer-export").parent().css("display","block"):e("#"+this._id+"_toolbarContainer .e-reportviewer-export").parent().css("display","none")},_showTooltip:function(){var t,i,s=e("#"+this._id+"_toolbar_exportListTip");s.length>0||(s=this._renderToolTipExport(),e("body").append(s),this._showExportList(),this._on(e("#"+this._id+"_toolbar_exportListTip .e-reportviewer-popupli"),"click",this._exportMenuClick)),"block"==s.css("display")?s.css("display","none"):s.css("display","block"),t=e("#"+this._id+"_toolbarContainer .e-reportviewer-export").height(),i=e(e("#"+this._id+"_toolbarContainer .e-reportviewer-export")[0]).offset(),s.css({top:i.top+t-3,left:i.left-5})},_updatePageNavigation:function(t,i){t>1&&t0&&(this._currentPage=1,this._refresh=!1,this.model.enablePageCache&&this._pageContains(this._currentPage)?this._gotoRenderPage():this.doAjaxPost("POST",this._actionUrl,JSON.stringify({reportAction:this._reportAction.getPageModel,refresh:this._refresh,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.model.enablePageCache&&this._pageContains(this._currentPage)?this._gotoRenderPage():this.doAjaxPost("POST",this._actionUrl,JSON.stringify({reportAction:this._reportAction.getPageModel,refresh:this._refresh,pageindex:this._currentPage,pageInit:this._isToolbarClick,isPrint:this._printMode}),this._printMode?"_getPreviewModel":"_getPageModel"))},_gotoNextPage:function(){this._pageModel&&this._pageModel.TotalPages&&this._currentPage1&&(this._currentPage=this._currentPage-1,this._refresh=!1,this.model.enablePageCache&&this._pageContains(this._currentPage)?this._gotoRenderPage():this.doAjaxPost("POST",this._actionUrl,JSON.stringify({reportAction:this._reportAction.getPageModel,refresh:this._refresh,pageindex:this._currentPage,pageInit:this._isToolbarClick,isPrint:this._printMode}),this._printMode?"_getPreviewModel":"_getPageModel"))},_gotoPageNo:function(e){if(this._pageModel&&this._pageModel.TotalPages){var t=parseInt(e);t>=1&&t<=this._pageModel.TotalPages&&this._currentPage!=t&&(this._currentPage=t,this._refresh=!1,this.model.enablePageCache&&this._pageContains(this._currentPage)?this._gotoRenderPage():this.doAjaxPost("POST",this._actionUrl,JSON.stringify({reportAction:this._reportAction.getPageModel,refresh:this._refresh,pageindex:this._currentPage,pageInit:this._isToolbarClick,isPrint:this._printMode}),this._printMode?"_getPreviewModel":"_getPageModel"))}},_gotoPage:function(t){var i,s,a;this._pageModel&&this._pageModel.PageData&&this._pageModel.PageData.length>0&&(i=parseInt(t),this._updatePageNavigation(i,this._pageModel.TotalPages),this._pageModel.TotalPages>0&&this._pageModel.TotalPages&&(e("#"+this._id+"_toolbarContainer span.e-reportviewer-labelpageno").html(" / "+this._pageModel.TotalPages),e("#"+this._id+"_txtpageNo").val(i)),s=e("#"+this._id+"_viewerContainer").find(".e-js"),s&&s.length>0&&this._destroyEJObjects(s),s=null,a=this._pageModel.PageData[0],this._renderPageModels(a),a&&this._setPageSize(a.Height,a.Width,a.HeaderHeight,a.FooterHeight))},_onkeyPress:function(t){if(13==t.keyCode)try{var i=parseInt(e(t.currentTarget).val());this._gotoPageNo(i)}catch(e){}},_showPageNavigationControls:function(t){t?e("#"+this._id+"_txtpageNo").parents(".e-reportviewer-toolbarul").css("display","block"):e("#"+this._id+"_txtpageNo").parents(".e-reportviewer-toolbarul").css("display","none")},_showPrintPageSetup:function(){var t,i,s=e("#"+this._id+"_printPageSetup");s.length>0?t=e("#"+this._id+"_printPageSetup").data("ejDialog"):(s=this._renderPrintPageSetup(),this._bindPageSetupModel(),e("body").append(s)),t&&t.model&&(i=t.isOpen(),i?e("#"+this._id+"_printPageSetup").ejDialog("close"):(e("#"+this._id+"_printPageSetup").ejDialog("open"),this._bindPageSetupModel())),this._enableToolbarContents(!1)},_pageSettingClose:function(){this._enableToolbarContents(!0)},_updatePageSetup:function(e){t.isNullOrUndefined(e)||(this._paperSetup.paperHeight=(e.PaperHeight/96).toFixed(2),this._paperSetup.paperWidth=(e.PaperWidth/96).toFixed(2),this._paperSetup.MarginTop=(e.MarginTop/96).toFixed(2),this._paperSetup.MarginRight=(e.MarginRight/96).toFixed(2),this._paperSetup.MarginBottom=(e.MarginBottom/96).toFixed(2),this._paperSetup.MarginLeft=(e.MarginLeft/96).toFixed(2),this._paperOrientation=parseInt(this._paperSetup.paperHeight)h&&(u=this._preZoomVal),r>d&&(c=this._preZoomVal),this._applyPageTransform(n,c,u,t),o.css({width:i,height:s})):"wholepage"==t?lt.scalY?t.scalY:t.scalX;e("#"+this._id+"_toolbar_zoomSelection_input").val(Math.round(100*a)+"%"),e("#"+this._id+"_toolbar_zoomSelection_popup li").removeClass("e-active")}else i?(e("#"+this._id+"_toolbar_zoomSelection_input").val(Math.round(100*t.scalX)+"%"),e("#"+this._id+"_toolbar_zoomSelection_popup li").removeClass("e-active")):(e("#"+this._id+"_toolbar_zoomSelection_input").val(Math.round(100*t.scalY)+"%"),e("#"+this._id+"_toolbar_zoomSelection_popup li").removeClass("e-active"))},_pageFitMenuClick:function(t){var i;if(i=e(t.target).hasClass("e-reportviewer-icon")?e(t.target).attr("fitType"):t.target.className){var s,a=e("#"+this._id+"_pageWidth"),n=a.find("span.e-reportviewer-icon"),o=e("#"+this._id+"_pageHeight"),r=o.find("span.e-reportviewer-icon"),l=e("#"+this._id+"_viewerContainer"),d=e("#"+this._id+"_pageviewOuterline"),h=e("#"+this._id+"_pageviewContainer"),c=l.width(),u=l.height(),m=d.width(),p=d.height(),g=h.width(),_=(e("#"+this._id+"_toolbar_zoomSelection").data("ejDropDownList"),i);switch(_){case"FITTOPAGE":s=this._fitToPage("fitToPage"),this._applyDropDownVal(s,!1,!0);break;case"PAGEWIDTH":case"e-reportviewer-popupli e-fitpagewidth":if("true"==a.attr("isSelect"))"true"==o.attr("isSelect")?(s=this._fitToPage("fitToPage"),this._applyDropDownVal(s,!1,!0)):(this._resetPage(),this._selectDropDownIndex(this._zoomLevel)),n.removeClass("e-reportviewer-pagefittopage"),n.addClass("e-reportviewer-emptyconetent"),a.attr("isSelect","false");else{if(c>m)return void("true"==o.attr("isSelect")&&m!=g&&(s=this._fitToPage("fitToWidth"),this._applyDropDownVal(s,!0,!1),a.attr("isSelect","true"),n.addClass("e-reportviewer-pagefittopage"),n.removeClass("e-reportviewer-emptyconetent"),r.addClass("e-reportviewer-emptyconetent"),r.removeClass("e-reportviewer-pagefittopage"),o.attr("isSelect","false")));"true"==o.attr("isSelect")?(s=this._fitToPage("fitToPage"),this._applyDropDownVal(s,!1,!0)):(s=this._fitToPage("fitToWidth"),this._applyDropDownVal(s,!0,!1)),a.attr("isSelect","true"),n.addClass("e-reportviewer-pagefittopage"),n.removeClass("e-reportviewer-emptyconetent")}break;case"WHOLEPAGE":case"e-reportviewer-popupli e-fitpageheight":if("true"==o.attr("isSelect"))"true"==a.attr("isSelect")?(s=this._fitToPage("fitToWidth"),this._applyDropDownVal(s,!0,!1)):(this._resetPage(),this._selectDropDownIndex(this._zoomLevel)),r.addClass("e-reportviewer-emptyconetent"),r.removeClass("e-reportviewer-pagefittopage"),o.attr("isSelect","false");else{if(u>p)return;s=this._fitToPage("fitToPage"),this._applyDropDownVal(s,!1,!0),r.addClass("e-reportviewer-pagefittopage"),r.removeClass("e-reportviewer-emptyconetent"),o.attr("isSelect","true"),n.removeClass("e-reportviewer-pagefittopage"),n.addClass("e-reportviewer-emptyconetent"),a.attr("isSelect","false")}}e("#"+this._id+"_toolbar_fittoPagePopup").hide()}},_showFitToPagetip:function(){var t,i,s=e("#"+this._id+"_toolbar_fittoPagePopup");s.length>0||(s=this._renderPageFitPopup(),e("body").append(s),this._on(e("#"+this._id+"_toolbar_fittoPagePopup li.e-reportviewer-popupli"),"click",this._pageFitMenuClick)),"block"==s.css("display")?s.css("display","none"):(s.css("display","block"),this._renderFitopagePopup()),t=e("#"+this._id+"_toolbarContainer .e-reportviewer-pagefit").height(),i=e(e("#"+this._id+"_toolbarContainer .e-reportviewer-pagefit")[0]).offset(),s.css({top:i.top+t-3,left:i.left-5})},_zoomValChange:function(t){var i=e(this.element).closest(".e-reportviewer"),s=i.ejReportViewer("instance"),a=parseInt(t.value)/100;s._zoomLevel=t.itemId,s._zoomContainer(a,!1)},_zoomIn:function(){if(this._zoomLevel>=6?this._zoomLevel=6:this._zoomLevel++,this._isDevice)this._mobileLayoutZoomChange();else{var t=e("#"+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=e("#"+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 s,a,n=i,o=e("#"+this._id+"_viewerContainer"),r=e("#"+this._id+"_pageviewContainer"),l=e("#"+this._id+"_pageviewOuterline");t&&(this._zoomVal=this._zoomVal+n),s=r.width(),a=r.height(),this.model.printMode&&(s+=this._pageModel.MarginLeft+this._pageModel.MarginRight,a+=this._pageModel.MarginTop+this._pageModel.MarginBottom),this._applyPageTransform(r,this._zoomVal,this._zoomVal),l.css({width:s*this._zoomVal,height:a*this._zoomVal}),this.model.printMode||(o.width()t?this._zoomOutContainer(i,s):this._zoomInContainer(i,s),void(this._preZoomVal=t))},_setZoomScrollerIE:function(t){if("msie"==this._browserInfo.name&&this._pageModel&&this._pageModel.PageData&&this._pageModel.PageData.length>0){var i=e("#"+this._id+"_viewerContainer"),s=this._pageModel.PageData[0],a=s.Height,n=s.Width,o=s.HeaderHeight,r=s.FooterHeight,l=a+o+r,d=i.height(),h=i.width();l*=t,n*=t,i.css({overflow:"hidden"}),i.css({"overflow-x":"Auto"}),i.css({"overflow-y":"Auto"}),l0)for(a=0;a0&&(this._pageCache[t]=e.extend(!0,{},this._pageModel))},_retrievePageCache:function(e){return this._pageCache[e]},_pageContains:function(e){var i=this._pageCache[e];return!t.isNullOrUndefined(i)},_clearPageCache:function(){this._pageCache={}},_itemfadeToggle:function(e){e.fadeToggle()},_popupClick:function(){var t=e("#"+this._id+"_pageInfoPopup");t.fadeIn(),t.finish()},_containerScrollStop:function(){var t=e("#"+this._id+"_pageInfoPopup");t.finish().fadeIn(),t.finish().fadeOut(3e3)},_viewerClick:function(){if(this._isDevice){var t=e("#"+this._id+"_pageInfoPopup");t.finish().fadeIn(1e3),t.finish().fadeOut(3e3),t.hide(4e3),e("#"+this._id+"_documentmapContainer").css("display","none")}e("#"+this._id+"_toolbar_exportListTip").css("display","none")},_pinchAndSwipe:function(e){switch(e.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=e(t.target),s=this._orginY=i.scrollTop();if(this._orginX=i.scrollLeft(),this._isDevice)if(s+i.innerHeight()>=i[0].scrollHeight){if(i.scrollTop(2),!this._pageModel||this._currentPage==this._pageModel.TotalPages)return;this._gotoNextPage(),this._updatePageNo()}else if(0==s){if(i.scrollTop(2),!this._pageModel||1==this._currentPage)return;this._gotoPreviousPage(),this._updatePageNo()}},_showViewerBlock:function(t){if(t){e("#"+this._id+"_viewBlockContainer").css("display","block");var i=e("#"+this._id+"_viewBlockContainer .e-reportviewer-viewerblockcellcontent").find("table");this._selectparamToolItem(i.is("[isviewclick]"))}else e("#"+this._id+"_viewBlockContainer").css("display","none");this._isDevice&&e("#"+this._id+"_viewBlockContainer.e-reportviewer-blockstyle").css("z-index",t?"10":"0")},_showNavigationIndicator:function(t){e("#"+this._id+"_viewerContainer").ejWaitingPopup({showOnInit:t}),e("#"+this._id+"_viewerContainer_WaitingPopup").addClass("e-reportviewer-waitingpopup")},_showloadingIndicator:function(t){t?(e("#"+this._id+"_loadingIndicator").css("display","block"),e("#"+this._id+"_pageviewOuterContainer").css("display","none")):(e("#"+this._id+"_loadingIndicator").css("display","none"),e("#"+this._id+"_pageviewOuterContainer").css("display","block")),e("#"+this._id+"_loadingIndicator").ejWaitingPopup({showOnInit:t}),e("#"+this._id+"_loadingIndicator_WaitingPopup").addClass("e-reportviewer-waitingpopup")},_isMobileDevice:function(){return/windows phone|android|iphone/i.test(navigator.userAgent.toLowerCase())},_getAuthenticationToken:function(){function e(){function e(){return(65536*(1+Math.random())|0).toString(16).substring(1)}return(e()+e()+"-"+e()+"-"+e()+"-"+e()+"-"+e()+e()+e()).toUpperCase()}return e()+"^"+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 i,s,a=t._isWidth?t.element[0].parentElement.style.width:t.element[0].style.width,n=t._isHeight?t.element[0].parentElement.style.height:t.element[0].style.height,o=e(t.element).height(),r=e(t.element).width();n.indexOf("%")!=-1?(t._isPercentHeight=parseInt(n),i=t._isHeight?e(t.element).parent().height():o,o=t._isHeight?i:i/100*t._isPercentHeight):0!=t.element[0].parentElement.clientHeight&&t._isPercentHeight!=-1?o=t._isHeight?t.element[0].parentElement.clientHeight:t.element[0].parentElement.clientHeight/100*t._isPercentHeight:t._isHeight&&0!=t.element[0].parentElement.clientHeight&&(o=t.element[0].parentElement.clientHeight),t.element.height(o),a.indexOf("%")!=-1?(t._isPercentWidth=parseInt(a),s=t._isWidth?e(t.element).parent().width():r,r=t._isWidth?s:s/100*t._isPercentWidth):0!=t.element[0].parentElement.clientWidth&&t._isPercentWidth!=-1?r=t._isWidth?t.element[0].parentElement.clientWidth:t.element[0].parentElement.clientWidth/100*t._isPercentWidth:t._isWidth&&0!=t.element[0].parentElement.clientWidth&&(r=t.element[0].parentElement.clientWidth),t.element.width(r),t._setContainerSize()},200))},_showViewerPage:function(t){t?e("#"+this._id+"_pageviewOuterline").css("display","block"):e("#"+this._id+"_pageviewOuterline").css("display","none"),this._isDevice&&e("#"+this._id+"_pageviewOuterline").css("z-index",t?"10":"0")},_updatePageNo:function(){e("#"+this._id+"_popupPageNo").val(this._currentPage),e("#"+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 e.extend(!0,{},this._reporDataSets)},getParameters:function(){return e.extend(!0,{},this._reportParameters)},gotoPageIndex:function(e){this._gotoPageNo(e)},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(e){this._exportReport(e)},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(e){return this._trigger("renderingBegin",e)},_onRenderingComplete:function(e){this._trigger("renderingComplete",e)},_onReportError:function(e){return this._trigger("reportError",e)},_onViewReportClick:function(e){return this._trigger("viewReportClick",e)},_onDrillThrough:function(e){return this._trigger("drillThrough",e)},_onReportExport:function(e){this._trigger("reportExport",e)},_onReportPrint:function(e){return this._trigger("reportPrint",e),e.isStyleLoad}}),t.ReportViewer.ExportOptions={Excel:1,Html:2,Pdf:4,Word:8,All:15},t.ReportViewer.ExcelFormats={Excel97to2003:"excel97to2003",Excel2007:"excel2007",Excel2010:"excel2010",Excel2013:"excel2013"},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"},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"},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(e,t,i){t.widget("ejPdfViewer","ej.PdfViewer",{_rootCSS:"e-pdfviewer",_requiresID:!0,element:null,model:null,validTags:["div"],defaults:{serviceUrl:"",hyperlinkOpenState:1,toolbarSettings:{toolbarItem:7,showTooltip:!0},enableHyperlink:!0,pdfService:1,locale:"en-US",pageChange:"",documentLoad:"",beforePrint:"",afterPrint:"",zoomchange:""},_isToolbarClick:!1,_pageModel:null,_currentPage:1,_zoomLevel:2,_preZoomVal:1,_fitType:null,_higherZoomIndex:0,_lowerZoomIndex:0,_actionUrl:null,_isDevice:!1,_zoomVal:1,_currentPageBackup:0,_zoomValBackup:0,_zoomLevelBackup:0,_fitTypeBackup:null,_scrollTop:0,_isPrinting:!1,_isContainImage:!1,_isPercentHeight:-1,_isPercentWidth:-1,_isHeight:!1,_isWidth:!1,_isPrintHidden:!1,_isNavigationHidden:!1,_isMagnificationHidden:!1,_viewerAction:{getPageModel:"GetPageModel"},_scrollTimer:null,_isDestroyed:!1,_pdfService:null,_toolbar:null,_printIframe:null,_currentPrintPage:0,_abortPrinting:!1,pageCount:0,currentPageNumber:this._currentPage,zoomPercentage:100,fileName:this._pdfFileName,_init:function(){if(this._actionUrl=this.model.serviceUrl+"/PostViewerAction",this._renderViewer(),this._initViewer(),this._on(e(window),"resize",this._viewerResize),this._getPdfService(this.model.pdfService),this.model.serviceUrl){var i={};i.viewerAction="GetPageModel",i.controlId=this._id,i.pageindex="1",i.isInitialLoading="true",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(e){this._pdfService=1==e?t.PdfViewer.PdfService.Local:t.PdfViewer.PdfService.Remote},_initViewer:function(){this._wireEvents(),this._initToolbar(),this._currentPage=1;var e=this.model.toolbarSettings;e.templateId||(this._showToolbar(!0),this._showPrintButton(e.toolbarItem&t.PdfViewer.ToolbarItems.PrintTools),this._showZoomControl(e.toolbarItem&t.PdfViewer.ToolbarItems.MagnificationTools),this._showFittoPage(e.toolbarItem&t.PdfViewer.ToolbarItems.MagnificationTools),this._showPageNavigationControls(e.toolbarItem&t.PdfViewer.ToolbarItems.PageNavigationTools)),this._showViewerBlock(!1),this._setContainerSize(),this._showloadingIndicator(!0)},_destroy:function(){this._isDestroyed=!0,e("#"+this._id+"_toolbarContainer span.e-pdfviewer-labelpageno").html(" / 0"),e("#"+this._id+"_txtpageNo").val(0),clearTimeout(this._scrollTimer),this._unwireEvents();for(var t=this._canvascount;t>=1;)e("#"+this._id+"pageDiv_"+t).remove(),e("#hyperlinkcanvas_"+t).remove(),t--;e("#"+this._id+"_pageviewContainer").remove(),e("#"+this._id+"_toolbarContainer").remove(),e("#"+this._id+"_viewerContainer").remove(),e("#"+this._id+"_viewBlockContainer").remove(),e("#"+this._id+"_toolbar_zoomSelection_popup_wrapper").remove(),e("#"+this._id+"_rptTooltip").remove(),e("#"+this._id+"_loadingIndicator_WaitingPopup").remove(),e("#"+this._id+"_viewerContainer_WaitingPopup").remove(),e("#"+this._id+"_WaitingPopup").remove(),e(this.element).find(".e-pdfviewer-viewer").remove(),this._renderedCanvasList.length=0,this._raiseClientEvent("destroy",null)},_renderToolTip:function(){var i=t.buildTag("div.e-pdfviewer-tbdiv e-pdfviewer-tooltip","",{display:"none"},{id:this._id+"_rptTooltip"}),s=t.buildTag("span.e-pdfviewer-headerspan","",{display:"block"},{id:this._id+"_rptTooltip_Header"}),a=t.buildTag("span.e-pdfviewer-contentspan","",{display:"block"},{id:this._id+"_rptTooltip_Content"});i.append(s),i.append(a),e("body").append(i)},_renderToolBar:function(i){var s,a,n,o,r,l;this.model.toolbarSettings.templateId?(l=document.getElementById(this.model.toolbarSettings.templateId),i.append(l),l.ejToolbar({enableSeparator:!0,height:l.height(),click:this.model.toolbarSettings.click}),l.css("display","block")):(s=t.buildTag("div.e-pdfviewer-toolbarcontainer .e-pdfviewer-viewer","",{width:"100%"},{id:this._id+"_toolbarContainer"}),i.append(s),this._isDevice?(a=t.buildTag("ul.e-pdfviewer-toolbarul","",{}),this._appendToolbarItems(a,"zoomin"),this._appendToolbarItems(a,"zoomout"),this._appendToolbarItems(a,"fitWidth"),this._appendToolbarItems(a,"fitPage"),s.append(a)):(n=t.buildTag("ul.e-pdfviewer-toolbarul","",{}),this._appendToolbarItems(n,"print"),s.append(n),o=t.buildTag("ul.e-pdfviewer-toolbarul","",{}),this._appendToolbarItems(o,"gotofirst"),this._appendToolbarItems(o,"gotoprevious"),this._appendToolbarItems(o,"gotopage"),this._appendToolbarItems(o,"gotonext"),this._appendToolbarItems(o,"gotolast"),s.append(o),r=t.buildTag("ul.e-pdfviewer-toolbarul","",{}),this._appendToolbarItems(r,"zoomin"),this._appendToolbarItems(r,"zoomout"),this._appendToolbarItems(r,"zoom"),this._appendToolbarItems(r,"fitWidth"),this._appendToolbarItems(r,"fitPage"),s.append(r),e("#"+this._id+"_toolbar_zoomSelection").ejDropDownList({height:"27px",width:"75px",cssClass:"e-pdfviewer-ddl",change:this._zoomValChange,selectedItem:2})),s.ejToolbar({enableSeparator:!this._isDevice,click:e.proxy(this._toolbarClick,this)}),this._toolbar=e("#"+this._id+"_toolbarContainer").data("ejToolbar"))},_appendToolbarItems:function(e,i){var s,a,n,o,r,l,d,h,c,u,m,p,g;t.PdfViewer.Locale[this.model.locale]?t.PdfViewer.Locale[this.model.locale]:t.PdfViewer.Locale.default;switch(i){case"print":s=t.buildTag("li.e-pdfviewer-toolbarli","",{},{id:this._id+"_pdfviewer_toolbar_Print"}),a=t.buildTag("span.e-pdfviewer-icon e-pdfviewer-print","",{},{id:this._id+"_toolbar_Print"}),s.append(a);break;case"gotofirst":s=t.buildTag("li.e-pdfviewer-toolbarli","",{},{id:this._id+"_pdfviewer_toolbar_gotofirst"}),n=t.buildTag("span.e-pdfviewer-icon e-pdfviewer-gotofirst","",{}),s.append(n);break;case"gotolast":s=t.buildTag("li.e-pdfviewer-toolbarli","",{},{id:this._id+"_pdfviewer_toolbar_gotolast"}),o=t.buildTag("span.e-pdfviewer-icon e-pdfviewer-gotolast","",{}),s.append(o);break;case"gotonext":s=t.buildTag("li.e-pdfviewer-toolbarli","",{},{id:this._id+"_pdfviewer_toolbar_gotonext"}),r=t.buildTag("span.e-pdfviewer-icon e-pdfviewer-gotonext","",{}),s.append(r);break;case"gotoprevious":s=t.buildTag("li.e-pdfviewer-toolbarli","",{},{id:this._id+"_pdfviewer_toolbar_gotoprevious"}),l=t.buildTag("span.e-pdfviewer-icon e-pdfviewer-gotoprevious","",{}),s.append(l);break;case"gotopage":s=t.buildTag("div.e-pdfviewer-tbpage","",{display:"block"},{}),d=t.buildTag("input.e-pdfviewer-pagenumber e-pdfviewer-elementalignments ejinputtext","",{},{type:"text",value:"0",id:this._id+"_txtpageNo","data-role":"none"}),h=t.buildTag("span.e-pdfviewer-labelpageno","",{},{}),s.append(d),s.append(h);break;case"zoomin":s=t.buildTag("li.e-pdfviewer-toolbarli","",{},{id:this._id+"_pdfviewer_toolbar_zoomin"}),c=t.buildTag("span.e-pdfviewer-icon e-pdfviewer-zoomin","",{},{id:this._id+"_toolbar_zoomin"}),s.append(c);break;case"zoomout":s=t.buildTag("li.e-pdfviewer-toolbarli","",{},{id:this._id+"_pdfviewer_toolbar_zoomout"}),u=t.buildTag("span.e-pdfviewer-icon e-pdfviewer-zoomout","",{},{id:this._id+"_toolbar_zoomout"}),s.append(u);break;case"zoom":s=t.buildTag("div.e-pdfviewer-ejdropdownlist","",{},{id:this._id+"_pdfviewer_toolbar_zoom"}),m=t.buildTag("select.e-pdfviewer-tbdiv e-pdfviewer-zoomlist","",{},{id:this._id+"_toolbar_zoomSelection","data-role":"none"}),m.append(""),m.append(""),m.append(""),m.append(""),m.append(""),m.append(""),m.append(""),s.append(m);break;case"fitWidth":s=t.buildTag("li.e-pdfviewer-toolbarli","",{},{id:this._id+"_pdfviewer_toolbar_fitWidth"}),p=t.buildTag("span.e-pdfviewer-icon e-pdfviewer-fitwidth","",{},{id:this._id+"_fitWidth"}),s.append(p);break;case"fitPage":s=t.buildTag("li.e-pdfviewer-toolbarli","",{},{id:this._id+"_pdfviewer_toolbar_fitPage"}),g=t.buildTag("span.e-pdfviewer-icon e-pdfviewer-fitpage","",{},{id:this._id+"_fitPage"}),s.append(g)}e.append(s)},_renderViewerBlockinWeb:function(e){var i=t.buildTag("div.e-pdfviewer-viewer e-pdfviewer-viewerblock","",{},{id:this._id+"_viewBlockContainer"});e.append(i);var s=t.buildTag("table.e-pdfviewer-viewerblockcellcontent","",{margin:"1px",padding:"5px 5px 10px"}),a=t.buildTag("tr","",{width:"100%"}),n=t.buildTag("td.e-pdfviewer-viewerblockcontent","",{});return a.append(n),s.append(a),i.append(s),i},_renderViewerContainer:function(e){var i=t.buildTag("div","",{},{id:this._id+"_pdfviewerContainer"});e.append(i);var s=t.buildTag("div.e-pdfviewer-viewer e-pdfviewer-scrollcontainer e-pdfviewer-viewercontainer","",{height:"100%",width:"100%","font-size":"8pt"},{id:this._id+"_viewerContainer"}),a=t.buildTag("div","",{margin:"0px",height:"99.8%",width:"100%"},{id:this._id+"_loadingIndicator"}),n=t.buildTag("div","",{margin:"0px",height:"99.8%",width:"100%","background-color":"rgba(164, 183, 216, 0.18)",display:"block"},{id:this._id+"_loadingIndicatorBackView"}),o=t.buildTag("div","",{},{id:this._id+"_pageviewContainer"});return a.append(n),s.append(a),s.append(o),this._isDevice&&this._renderViewerBlockinDevice(s),i.append(s),i},_renderViewer:function(){var e=this.element.height(),i=this.element.width(),s=t.buildTag("div.e-pdfviewer-viewer","",{});this.element[0].style.height||0==this.element[0].parentElement.clientHeight||(this._isHeight=!0),this.element[0].style.width||0==this.element[0].parentElement.clientWidth||(this._isWidth=!0),0===e&&0!=this.element[0].parentElement.clientHeight&&this.element.height(this.element[0].parentElement.clientHeight),0===i&&0!=this.element[0].parentElement.clientWidth&&this.element.width(this.element[0].parentElement.clientWidth),this.element.append(s),this._renderToolBar(s),this._isDevice||(this._renderViewerBlockinWeb(s),this._renderToolTip()),this._renderViewerContainer(s)},_setContainerSize:function(){var t,i,s,a=document.getElementById(this._id).clientHeight,n=0;this._isDevice||(t=e("#"+this._id+"_viewBlockContainer"),"block"==t.css("display").toLowerCase()&&(n=t.height())),i=this.model.toolbarSettings.templateId?e("#"+this.model.toolbarSettings.templateId).height():e("#"+this._id+"_toolbarContainer").height(),s=a-n-i-4,e("#"+this._id+"_viewerContainer").css({height:s+"px"})},_setPageSize:function(t,i,s){s=0;var a=(e("#"+this._id+"_pageviewContainer")[0].getBoundingClientRect(),this);this._renderPreviousPage=!1,e("#"+this._id+"_viewerContainer").unbind("scroll").on("scroll",function(){a._computeCurrentPage(t)}),this._scrollTimer=setInterval(function(){a._pageviewscrollchanged(t)},500),a._backgroundPage=1,this._previousZoom=1,a._previousPage=a._currentPage,this._pageLocation=[],this._renderedCanvasList=[],this._pageContents=[],this._pageLocation[1]=0,this._canvascount=this._totalPages,this._designPageCanvas()},_designPageCanvas:function(){for(var i,s,a,n=0,o=e("#"+this._id+"_pageviewContainer"),r=1;r<=this._totalPages;r++){i=(this.element.width()-this._pageSize[r-1].PageWidth)/2,i<0&&(i=0),s=t.buildTag("div","",{},{id:this._id+"pageDiv_"+r}),o.append(s),s.css("position","absolute"),s.css("top",n),s.css("left",i+"px"),this._pageLocation[r]=n;var l=document.createElement("canvas");l.id="pagecanvas_"+r,l.height=this._pageSize[r-1].PageHeight,l.style.backgroundColor="white",l.width=this._pageSize[r-1].PageWidth,s.append(l),a=document.createElement("div"),a.id="hyperlinkcanvas_"+r,a.style.height=l.height+"px",a.style.width=l.width+"px",a.style.position="absolute",a.style.left=0,a.style.top=0,a.style.backgroundColor="transparent",a.style.opacity="0.2",a.style.zIndex="2",s.append(a),e("#pagecanvas_"+r).css("box-shadow","0px 0px 0px 1px #000000"),e("#"+this._id+"pageDiv_"+r).ejWaitingPopup({showOnInit:!0}),e("#"+this._id+"pageDiv_"+r+"_WaitingPopup").appendTo(e("#"+this._id+"pageDiv_"+r)).css({top:0,left:0,"background-color":"#dbdbdb"}),n=parseFloat(n)+parseFloat(this._pageSize[r-1].PageHeight)+8}this._cummulativeHeight=n},_computeCurrentPage:function(t){var i,s,a,n=0,o=0,r=document.getElementById(this._id+"_viewerContainer"),l=r.scrollTop;1!=this._zoomVal&&(l+=this._currentPage*(8-8*this._zoomVal));var d=0,h=0,c={currentPageNumber:0};for(i=0;il){o=i,s=parseFloat(n)-parseFloat(l),a=this.element[0].parentElement.clientHeight-s,a>s&&(o=parseFloat(o)+1,this._renderPreviousPage=!0),this._renderPreviousPage=!1;break}n=parseFloat(n)+parseFloat(t*this._zoomVal)+8,o=i+1}e("#"+this._id+"_toolbarContainer span.e-pdfviewer-labelpageno").html(" / "+this._totalPages),d=document.getElementById(this._id+"_txtpageNo").value,e("#"+this._id+"_txtpageNo").val(o),this._updatePageNavigation(o,this._totalPages),h=document.getElementById(this._id+"_txtpageNo").value,c.currentPageNumber=h,d!=h&&this._raiseClientEvent("pageChange",c),this._currentPage=o},_pageviewscrollchanged:function(){var i,s,a,n,o=0,r=e("#"+this._id+"_viewerContainer").scrollTop();r==this._previousPosition&&(o=this._currentPage,this._totalPages&&this._previousPage!=o&&(i=parseInt(o),this._previousPage=o,i>=1&&i<=this._totalPages&&(""==this._jsondata||null==this._jsondata?(this._showloadingIndicator(!0),e("#"+this._id+"_toolbarContainer span.e-pdfviewer-labelpageno").html(""),e("#"+this._id+"_txtpageNo").val("0")):(e("#"+this._id+"_toolbarContainer span.e-pdfviewer-labelpageno").html(" / "+this._totalPages),e("#"+this._id+"_txtpageNo").val(i)),this._currentPage=i,this._updatePageNavigation(this._currentPage,this._totalPages),this._renderedCanvasList.indexOf(parseInt(this._currentPage))!=-1||this._scrollTriggered||this._pageContents[parseInt(this._currentPage)]||(this._scrollTriggered=!0,a={},a.viewerAction=this._viewerAction.getPageModel,a.pageindex=this._currentPage.toString(),this._pdfService==t.PdfViewer.PdfService.Local?this._doAjaxPostscroll("POST",this._actionUrl,JSON.stringify(a)):this._doAjaxPostscroll("POST",this.model.serviceUrl,JSON.stringify({jsonResult:a})))))),this._renderedCanvasList.indexOf(parseInt(this._currentPage))==-1&&!this._scrollTriggered&&this._currentPage<=this._totalPages&&(this._pageContents[parseInt(this._currentPage)]?(n=this._pageContents[parseInt(this._currentPage)],this._drawPdfPage(n)):(this._scrollTriggered=!0,a={},a.viewerAction=this._viewerAction.getPageModel,a.pageindex=this._currentPage.toString(),this._pdfService==t.PdfViewer.PdfService.Local?this._doAjaxPostscroll("POST",this._actionUrl,JSON.stringify(a)):this._doAjaxPostscroll("POST",this.model.serviceUrl,JSON.stringify({jsonResult:a})))),s=parseInt(this._currentPage)+1,this._renderPreviousPage?this._renderedCanvasList.indexOf(parseInt(this._currentPage)-1)==-1&&!this._scrollTriggered&&parseInt(this._currentPage)-1>0?this._pageContents[parseInt(this._currentPage)-1]?(n=this._pageContents[parseInt(this._currentPage)-1],this._drawPdfPage(n)):(this._scrollTriggered=!0,a={},a.viewerAction=this._viewerAction.getPageModel,a.pageindex=(parseInt(this._currentPage)-1).toString(),this._pdfService==t.PdfViewer.PdfService.Local?this._doAjaxPostscroll("POST",this._actionUrl,JSON.stringify(a)):this._doAjaxPostscroll("POST",this.model.serviceUrl,JSON.stringify({jsonResult:a}))):this._renderedCanvasList.indexOf(parseInt(s))==-1&&!this._scrollTriggered&&s<=this._totalPages&&(this._pageContents[parseInt(s)]?(n=this._pageContents[parseInt(s)],this._drawPdfPage(n)):(this._scrollTriggered=!0,a={},a.viewerAction=this._viewerAction.getPageModel,a.pageindex=s.toString(),this._pdfService==t.PdfViewer.PdfService.Local?this._doAjaxPostscroll("POST",this._actionUrl,JSON.stringify(a)):this._doAjaxPostscroll("POST",this.model.serviceUrl,JSON.stringify({jsonResult:a})))):this._renderedCanvasList.indexOf(parseInt(s))==-1&&!this._scrollTriggered&&s<=this._totalPages?this._pageContents[parseInt(s)]?(n=this._pageContents[parseInt(s)],this._drawPdfPage(n)):(this._scrollTriggered=!0,a={},a.viewerAction=this._viewerAction.getPageModel,a.pageindex=s.toString(),this._pdfService==t.PdfViewer.PdfService.Local?this._doAjaxPostscroll("POST",this._actionUrl,JSON.stringify(a)):this._doAjaxPostscroll("POST",this.model.serviceUrl,JSON.stringify({jsonResult:a}))):this._renderedCanvasList.indexOf(parseInt(this._currentPage)-1)==-1&&!this._scrollTriggered&&parseInt(this._currentPage)-1>0&&(this._pageContents[parseInt(this._currentPage)-1]?(n=this._pageContents[parseInt(this._currentPage)-1],this._drawPdfPage(n)):(this._scrollTriggered=!0,a={},a.viewerAction=this._viewerAction.getPageModel,a.pageindex=(parseInt(this._currentPage)-1).toString(),this._pdfService==t.PdfViewer.PdfService.Local?this._doAjaxPostscroll("POST",this._actionUrl,JSON.stringify(a)):this._doAjaxPostscroll("POST",this.model.serviceUrl,JSON.stringify({jsonResult:a})))),this._previousPosition=r},_doAjaxPostscroll:function(t,i,s){var a=this;e.ajax({type:t,url:i,crossDomain:!0,contentType:"application/json; charset=utf-8",dataType:"json",data:s,traditional:!0,success:function(e){a._drawPdfPage(e),a._scrollTriggered=!1},error:function(e){0!=e.readyState&&alert("Exception"+e.responseText)}})},_drawPdfPage:function(s){var a,n,o,r,l,d,h,c,u,m,p,g,_=s;s=this._pdfService==t.PdfViewer.PdfService.Local?JSON.parse(s):JSON.parse(s.d),this._renderedCanvasList.push(parseInt(s.currentpage)),a=parseInt(s.currentpage),this._showPageLoadingIndicator(a,!0),this._pageimageList=s.imagestream,this._pageContents[parseInt(s.currentpage)]=_,this._pageCompleted=this._pageimageList.pagecompleted,e("#hyperlinkcanvas_"+a).children().length>0&&(document.getElementById("hyperlinkcanvas_"+a).innerHTML="");var f=s.linkannotation,b=s.annotpagenum,v=this;if(this.model.enableHyperlink)for(n=0;n>4&15,1))+t.substr(15&e,1)},_doAjaxPost:function(t,i,s,a){var n=this,o=a;e.ajax({type:t,url:i,crossDomain:!0,contentType:"application/json; charset=utf-8",dataType:"json",data:s,traditional:!0,success:function(e){n[o](e),n._raiseClientEvent("documentLoad",null)},error:function(e){if("_clearCurrentServerCache"!=o){if(0==e.readyState)return;alert("Exception"+e.responseText)}}})},_raiseClientEvent:function(i,s){var a,n=this.model[i],o=[];o=null===s?"":s,n&&("string"==typeof n&&(n=t.util.getObject(n,window)),e.isFunction(n)&&("pageChange"==i?a={currentPageNumber:parseInt(s.currentPageNumber)}:"zoomChange"==i?a={previousZoomPercentage:s.previousZoomPercentage,currentZoomPercentage:s.currentZoomPercentage}:"hyperlinkClick"==i&&(a={hyperlink:s.hyperlink}),this._trigger(i,a)))},_getPageModel:function(i){this._jsondata=i,(""==i||null==i)&&(this._showloadingIndicator(!0),e("#"+this._id+"_toolbarContainer span.e-pdfviewer-labelpageno").html(""),e("#"+this._id+"_txtpageNo").val("0"));var s;s=this._pdfService==t.PdfViewer.PdfService.Local?JSON.parse(i):JSON.parse(i.d),s&&(this._pageWidth=s.pagewidth,this._pageHeight=s.pageheight,this._imageUrl=s.imageurl,this._pageSize=s.pagesize,this._totalPages=s.pagecount,this.pageCount=this._totalPages,this._pdfFileName=s.filename,this.fileName=this._pdfFileName,this._currentPage=s.currentpage,this.currentPageNumber=this._currentPage,this._isToolbarClick||this._enableToolbarItems(),this._gotoPage(this._currentPage),this._drawPdfPage(i),this._showNavigationIndicator(!1),this._showloadingIndicator(!1))},_print:function(){this._abortPrinting=!1,this._raiseClientEvent("beforePrint",null),this._showPrintLoadingIndicator(!0),this._setViewerForPrint(),this._scrollPageByPage()},_setViewerForPrint:function(){this._currentPageBackup=this._currentPage,this._scrollTop=e("#"+this._id+"_viewerContainer").scrollTop(),this._zoomValBackup=this._zoomVal,this._zoomLevelBackup=this._zoomLevel,1!=this._zoomVal&&(this._zoomVal=1,this._zoomLevel=2,this._fitTypeBackup=this._fitType,this._zoomContainer(this._zoomVal,!1))},_scrollPageByPage:function(){var e,t,i,s;for(this._isPrinting=!0,e=1;e<=this._totalPages&&(this._scrollTriggered=!1,!(t=this._scrollToPageNo(e)));e++);this._isPrinting=!1,t||(i=navigator.userAgent,i.indexOf("Chrome")!=-1||i.indexOf("Safari")!=-1||i.indexOf("Firefox")!=-1?(s=this,setTimeout(function(){s._printPages()},1e3)):this._printPages(),this._raiseClientEvent("afterPrint",null))},_scrollToPageNo:function(e){var t,i;this._currentPage;if(this._totalPages&&(t=parseInt(e),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 e,i;if(this._renderedCanvasList.indexOf(parseInt(this._currentPage))==-1&&!this._scrollTriggered&&this._currentPage<=this._totalPages)return this._pageContents[parseInt(this._currentPage)]?(i=this._pageContents[parseInt(this._currentPage)],this._printPdfPages(i),!1):(this._scrollTriggered=!0,e={},e.viewerAction=this._viewerAction.getPageModel,e.pageindex=this._currentPage.toString(),this._pdfService==t.PdfViewer.PdfService.Local?this._doAjaxPostPrint("POST",this._actionUrl,JSON.stringify(e)):this._doAjaxPostPrint("POST",this.model.serviceUrl,JSON.stringify({jsonResult:e})),!0)},_printPages:function(){var t,i,s,a,n,o,r,l=navigator.userAgent,d=this,h=this._printIframe;for(h.name="printFrame",h.style.position="absolute",h.style.top="-100000000px",document.body.appendChild(h),t=h.contentWindow?h.contentWindow:h.contentDocument.document?h.contentDocument.document:h.contentDocument,t.document.open(),l.indexOf("Edge")==-1&&(l.indexOf("Chrome")!=-1||l.indexOf("Safari")!=-1||l.indexOf("Firefox")!=-1)?(t.document.write(""),t.document.write("
      ")):t.document.write("
      "),i=1;i<=d._totalPages;i++)s=document.getElementById("pagecanvas_"+i),a=s.toDataURL(),l.indexOf("Firefox")==-1&&d._pageSize[i-1].PageWidth>d._pageSize[i-1].PageHeight&&(n=s.getContext("2d"),o=new Image,n.clearRect(0,0,s.width,s.height),s.width=d._pageSize[i-1].PageHeight,s.height=d._pageSize[i-1].PageWidth,n.save(),n.translate(s.width/2,s.height/2),n.rotate(-Math.PI/2),o.src=a,n.drawImage(o,-o.width/2,-o.height/2),n.restore()),l.indexOf("Edge")==-1&&(l.indexOf("Chrome")!=-1||l.indexOf("Safari")!=-1||l.indexOf("Firefox")!=-1)?l.indexOf("Chrome")!=-1||l.indexOf("Safari")!=-1?t.document.write('

      '):t.document.write('

      '):t.document.write('
      ');if(t.document.write("
      "),navigator.userAgent.match("Firefox")?window.frames.printFrame.close():t.document.close(),l.indexOf("Edge")==-1)if(l.indexOf("Chrome")!=-1||l.indexOf("Safari")!=-1||l.indexOf("Firefox")!=-1)d=this,setTimeout(function(){window.frames.printFrame.focus(),window.frames.printFrame.print(),document.body.removeChild(h)},500);else{r=e("iframe")[0];try{r.contentWindow.document.execCommand("print",!1,null)}catch(e){r.contentWindow.print()}}else{r=e("iframe")[0];try{r.contentWindow.document.execCommand("print",!1,null)}catch(e){r.contentWindow.print()}}this._restoreViewer()},_printCancel:function(){this._abortPrinting=!0,this._restoreViewer(),this._raiseClientEvent("afterPrint",null)},_restoreViewer:function(){var e,t,i,s;for(this._currentPage=this._currentPageBackup,this._zoomVal=this._zoomValBackup,this._zoomLevel=this._zoomLevelBackup,e=1;e<=this._totalPages;e++)t=document.getElementById("pagecanvas_"+e),this._pageSize[e-1].PageWidth>this._pageSize[e-1].PageHeight&&(t.width=this._pageSize[e-1].PageWidth,t.height=this._pageSize[e-1].PageHeight,this._renderedCanvasList.length=0);null==this._fitTypeBackup?this._zoomContainer(this._zoomVal,!1):(i=this._fitToPage(this._fitTypeBackup),this._applyDropDownVal(i,!0,!1),this._updatePageFitModel(this._fitType)),s=document.getElementById(this._id+"_viewerContainer"),s.scrollTop=this._scrollTop,this._showPrintLoadingIndicator(!1)},_doAjaxPostPrint:function(i,s,a){var n,o,r=JSON.parse(a);this._pdfService==t.PdfViewer.PdfService.Local?this._currentPrintPage=r.pageindex:(n=r.jsonResult,this._currentPrintPage=n.pageindex),o=this,e.ajax({type:i,url:s,crossDomain:!0,contentType:"application/json; charset=utf-8",dataType:"json",data:a,traditional:!0,success:function(e){var i,s;o._printPdfPages(e),o._scrollTriggered=!1,o._abortPrinting||(parseFloat(o._currentPrintPage)1&&e0){this._currentPage=1;var e=document.getElementById(this._id+"_viewerContainer");e.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 e=document.getElementById(this._id+"_viewerContainer");e.scrollTop=parseFloat(this._pageLocation[this._currentPage]*this._zoomVal),this._pageviewscrollchanged(this._pageHeight),this._updatePageNavigation(this._currentPage,this._totalPages)}},_gotoNextPage:function(){if(this._totalPages&&this._currentPage1){this._currentPage=this._currentPage-1;var e=document.getElementById(this._id+"_viewerContainer");e.scrollTop=parseFloat(this._pageLocation[this._currentPage]*this._zoomVal),this._pageviewscrollchanged(this._pageHeight),this._updatePageNavigation(this._currentPage,this._totalPages)}},_gotoPageNo:function(e){var t,i,s={currentPageNumber:0},a=e,n=this._currentPage;this._totalPages&&(t=parseInt(e),t>=1&&t<=this._totalPages&&this._currentPage!=t&&(this._currentPage=t,i=document.getElementById(this._id+"_viewerContainer"),i.scrollTop=parseFloat(this._pageLocation[this._currentPage]*this._zoomVal),this._pageviewscrollchanged(this._pageHeight),this._updatePageNavigation(this._currentPage,this._totalPages))),n!=a&&(s.currentPageNumber=a,this._raiseClientEvent("pageChange",s))},_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&&(e("#"+this._id+"_toolbarContainer span.e-pdfviewer-labelpageno").html(" / "+this._totalPages),e("#"+this._id+"_txtpageNo").val(i))},_allowOnlyNumbers:function(e){return!(e.which<48||e.which>57)||8==e.which||13==e.which},_onkeyPress:function(t){if(13==t.which)try{var i=parseInt(e(t.currentTarget).val());i>0&&i<=this.pageCount?this._gotoPageNo(i):e(t.currentTarget).val(this.currentPageNumber)}catch(e){}},_showPageNavigationControls:function(t){t?(e("#"+this._id+"_txtpageNo").parents(".e-pdfviewer-toolbarul").css("display","block"),e("#"+this._id+"_toolbar_Print").parent().parents(".e-pdfviewer-toolbarul").css("border-right-width","1px"),this._isNavigationHidden=!1):(e("#"+this._id+"_txtpageNo").parents(".e-pdfviewer-toolbarul").css("display","none"),this._isNavigationHidden=!0,!this._isPrintHidden&&this._isNavigationHidden&&this._isMagnificationHidden&&e("#"+this._id+"_toolbar_Print").parent().parents(".e-pdfviewer-toolbarul").css("border-right-width","0px"))},_showFittoPage:function(t){t?(e("#"+this._id+"_fitWidth").parents("li.e-pdfviewer-toolbarli").css("display","block"),e("#"+this._id+"_fitPage").parents("li.e-pdfviewer-toolbarli").css("display","block")):(e("#"+this._id+"_fitWidth").parents("li.e-pdfviewer-toolbarli").css("display","none"),e("#"+this._id+"_fitPage").parents("li.e-pdfviewer-toolbarli").css("display","none"))},_resetPage:function(){var t=e("#"+this._id+"_pageviewContainer"),i=e("#"+this._id+"_pageviewOuterline");i.css({width:t.width(),height:t.height()}),i.css({width:t[0].getBoundingClientRect().width,height:t[0].getBoundingClientRect().height})},_applyFitToWidth:function(){_scaleXY=this._fitToPage("fitToWidth"),this._applyDropDownVal(_scaleXY,!0,!1),this._updatePageFitModel(this._fitType)},_applyFitToPage:function(){_scaleXY=this._fitToPage("fitToPage"),this._applyDropDownVal(_scaleXY,!1,!0),this._updatePageFitModel(this._fitType)},_updatePageFitModel:function(e){"fitToWidth"==e?(this._toolbar.disableItemByID(this._id+"_pdfviewer_toolbar_fitWidth"),this._toolbar.enableItemByID(this._id+"_pdfviewer_toolbar_fitPage")):"fitToPage"==e&&(this._toolbar.disableItemByID(this._id+"_pdfviewer_toolbar_fitPage"),this._toolbar.enableItemByID(this._id+"_pdfviewer_toolbar_fitWidth"))},_fitToPage:function(t){this._resetPage();var i=e("#"+this._id+"_viewerContainer"),s=(e("#"+this._id+"_pageviewContainer"),e("#"+this._id+"_pageviewOuterline"),i.width()),a=i.height(),n=this._pageWidth,o=this._pageHeight,r=1,l=1;return"fitToPage"==t?(r=(s-40)/n,l=a/o,a>o&&(l=this._preZoomVal),s>n&&(r=this._preZoomVal),r=l,this._zoomVal=r,this._zoomInContainer(),this._calculateZoomLevel(this._zoomVal)):"fitToWidth"==t&&(r=(s-40)/n,l=r,this._zoomVal=r,this._zoomInContainer(),this._calculateZoomLevel(this._zoomVal)),this._fitType=t,this._updateZoomButtons(),{scalX:r,scalY:l}},_selectDropDownIndex:function(t){var i=e(e("#"+this._id+"_toolbar_zoomSelection_popup li")[t]);i.addClass("e-active"),e("#"+this._id+"_toolbar_zoomSelection_input").val(i.text())},_applyDropDownVal:function(t,i,s){if(s){var a=t.scalX>t.scalY?t.scalY:t.scalX;e("#"+this._id+"_toolbar_zoomSelection_hidden").val(Math.round(100*a)+"%"),e("#"+this._id+"_toolbar_zoomSelection_popup li").removeClass("e-active")}else i?(e("#"+this._id+"_toolbar_zoomSelection_hidden").val(Math.round(100*t.scalX)+"%"),e("#"+this._id+"_toolbar_zoomSelection_popup li").removeClass("e-active")):(e("#"+this._id+"_toolbar_zoomSelection_hidden").val(Math.round(100*t.scalY)+"%"),e("#"+this._id+"_toolbar_zoomSelection_popup li").removeClass("e-active"))},_showFitToPagetip:function(){var t,i,s=e("#"+this._id+"_toolbar_fittoPagePopup");s.length>0||(s=this._renderPageFitPopup(),e("body").append(s),this._on(e("#"+this._id+"_toolbar_fittoPagePopup li.e-pdfviewer-popupli"),"click",this._pageFitMenuClick)),"block"==s.css("display")?s.css("display","none"):s.css("display","block"),t=e("#"+this._id+"_toolbarContainer .e-pdfviewer-pagefit")[0].getBoundingClientRect(),i=e(e("#"+this._id+"_toolbarContainer .e-pdfviewer-pagefit")[0]).offset(),s.css({top:i.top+t.height-3,left:i.left-5})},_zoomValChange:function(t){var s,a=e(this.element).closest(".e-pdfviewer"),n=a.ejPdfViewer("instance");if(t.value!=i)s=parseInt(t.value)/100,n._zoomLevel=t.itemId,n._zoomContainer(s,!1);else if(t.target.innerHTML!=i){var o=t.target.innerHTML,o=o.substring(0,o.length-1),s=parseInt(o)/100;n._zoomContainer(s,!1)}},_zoomIn:function(){if(this._zoomLevel>=6?this._zoomLevel=6:this._zoomLevel++,this._isDevice)this._mobileLayoutZoomChange();else{var t=e("#"+this._id+"_toolbar_zoomSelection").data("ejDropDownList");t._selectItemByIndex(this._zoomLevel)}},_zoomOut:function(){if(this._zoomLevel<=0?this._zoomLevel=0:this._zoomLevel--,this._isDevice)this._mobileLayoutZoomChange();else{var t=e("#"+this._id+"_toolbar_zoomSelection").data("ejDropDownList");t._selectItemByIndex(this._zoomLevel)}},_zoomInContainer:function(t,i){var s,a,n,o,r,l,d,h,c=i,u=e("#"+this._id+"_viewerContainer"),m=e("#"+this._id+"_pageviewContainer");t&&(this._zoomVal=this._zoomVal+c);var p=(m.width(),m.height(),{currentZoomPercentage:0,previousZoomPercentage:0}),g=document.getElementById(this._id+"_viewerContainer"),_=g.scrollTop,f=_/this._previousZoom*this._zoomVal;"scale("+this._zoomVal+","+this._zoomVal+")";for(s=1;s<=this._totalPages;s++)a=(this.element.width()-this._pageSize[s-1].PageWidth*this._zoomVal)/2,a<0&&(a=0),n=document.getElementById("pagecanvas_"+s),o=n.getContext("2d"),n.height=this._pageSize[s-1].PageHeight*this._zoomVal,n.width=this._pageSize[s-1].PageWidth*this._zoomVal,o.clearRect(0,0,n.clientWidth,n.clientHeight),r=e("#"+this._id+"pageDiv_"+s),r[0].style.top=this._pageLocation[s]*this._zoomVal+"px",r[0].style.left=a+"px",l=document.getElementById("hyperlinkcanvas_"+s),l.style.height=n.height+"px",l.style.width=n.width+"px",l.style.position="absolute",l.style.left=0,l.style.top=0,l.style.backgroundColor="transparent",l.style.opacity="0.2",l.style.zIndex="2",e("#"+this._id+"pageDiv_"+s+"_WaitingPopup").css({display:"block",height:n.height+"px",width:n.width+"px"}),d=document.getElementById(this._id+"pageDiv_"+s+"_WaitingPopup"),h=d.childNodes[0],h.style.top=(n.height-h.clientHeight)/2+"px";this._renderedCanvasList.length=0,this._zoomVal<1?u.css({"-ms-scroll-limit-y-max":this._cummulativeHeight*this._zoomVal-this.element.height()+50+"px"}):u.css({"-ms-scroll-limit-y-max":""}),g.scrollTop=f,this._eventpreviouszoomvalue=this._preZoomVal,this._eventzoomvalue=this._zoomVal,this._preZoomVal=this._zoomVal,this._previousZoom=this._zoomVal,p.previousZoomPercentage=Math.round(100*this._eventpreviouszoomvalue),p.currentZoomPercentage=Math.round(100*this._eventzoomvalue),this._raiseClientEvent("zoomChange",p),this.zoomPercentage=Math.round(100*this._zoomVal)},_zoomOutContainer:function(t,i){var s,a,n,o,r,l,d,h,c=i,u=e("#"+this._id+"_viewerContainer"),m=e("#"+this._id+"_pageviewContainer");t&&(this._zoomVal=this._zoomVal+c);var p=(m.width(),m.height(),{currentZoomPercentage:0,previousZoomPercentage:0}),g=document.getElementById(this._id+"_viewerContainer"),_=g.scrollTop,f=_/this._previousZoom*this._zoomVal;"scale("+this._zoomVal+","+this._zoomVal+")";for(s=1;s<=this._totalPages;s++)a=(this.element.width()-this._pageSize[s-1].PageWidth*this._zoomVal)/2,a<0&&(a=0),n=document.getElementById("pagecanvas_"+s),o=n.getContext("2d"),n.height=this._pageSize[s-1].PageHeight*this._zoomVal,n.width=this._pageSize[s-1].PageWidth*this._zoomVal,o.clearRect(0,0,n.clientWidth,n.clientHeight),r=e("#"+this._id+"pageDiv_"+s),r[0].style.top=this._pageLocation[s]*this._zoomVal+"px",r[0].style.left=a+"px",l=document.getElementById("hyperlinkcanvas_"+s),l.style.height=n.height+"px",l.style.width=n.width+"px",l.style.position="absolute",l.style.left=0,l.style.top=0,l.style.backgroundColor="transparent",l.style.opacity="0.2",l.style.zIndex="2",e("#"+this._id+"pageDiv_"+s+"_WaitingPopup").css({display:"block",height:n.height+"px",width:n.width+"px"}),d=document.getElementById(this._id+"pageDiv_"+s+"_WaitingPopup"),h=d.childNodes[0],h.style.top=(n.height-h.clientHeight)/2+"px";this._renderedCanvasList.length=0,this._zoomVal<1?u.css({"-ms-scroll-limit-y-max":this._cummulativeHeight*this._zoomVal-this.element.height()+50+"px"}):u.css({"-ms-scroll-limit-y-max":""}),g.scrollTop=f,this._eventpreviouszoomvalue=this._preZoomVal,this._eventzoomvalue=this._zoomVal,this._previousZoom=this._zoomVal,p.previousZoomPercentage=Math.round(100*this._eventpreviouszoomvalue),p.currentZoomPercentage=Math.round(100*this._eventzoomvalue),this._raiseClientEvent("zoomChange",p),this.zoomPercentage=Math.round(100*this._zoomVal)},_zoomContainer:function(e,t){this._fitType=null,this._zoomVal=e,this._toolbar.enableItemByID(this._id+"_pdfviewer_toolbar_fitPage"),this._toolbar.enableItemByID(this._id+"_pdfviewer_toolbar_fitWidth");var i=Math.abs(this._preZoomVal-e);return 0!=i&&(this._preZoomVal>e?this._zoomOutContainer(t,i):this._zoomInContainer(t,i),this._preZoomVal=e,void this._updateZoomButtons())},_calculateZoomLevel:function(e){for(var t,i=document.getElementById(this._id+"_toolbar_zoomSelection_popup").getElementsByTagName("li"),s=[],a=0;an))return t;r=t-1}this._lowerZoomIndex=r,this._higherZoomIndex=o},_applyLowerZoomIndex:function(e){("fitToWidth"==e||"fitToPage"==e)&&(this._zoomLevel=this._lowerZoomIndex),this._fitType=null},_applyHigherZoomIndex:function(e){("fitToWidth"==e||"fitToPage"==e)&&(this._zoomLevel=this._higherZoomIndex),this._fitType=null},_updateZoomButtons:function(){.5==this._zoomVal?(this._toolbar.disableItemByID(this._id+"_pdfviewer_toolbar_zoomout"),this._toolbar.enableItemByID(this._id+"_pdfviewer_toolbar_zoomin")):4==this._zoomVal?(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?(e("#"+this._id+"_txtpageNo").parents(".e-pdfviewer-toolbarul").css("border-right-width","1px"),e("#"+this._id+"_toolbar_zoomin").parents("li.e-pdfviewer-toolbarli").css("display","block"),e("#"+this._id+"_toolbar_zoomout").parents("li.e-pdfviewer-toolbarli").css("display","block"),e("#"+this._id+"_toolbar_zoomSelection").parents("div.e-pdfviewer-ejdropdownlist").css("display","block"),e("#"+this._id+"_toolbar_Print").parent().parents(".e-pdfviewer-toolbarul").css("border-right-width","1px"),this._isMagnificationHidden=!1):(e("#"+this._id+"_txtpageNo").parents(".e-pdfviewer-toolbarul").css("border-right-width","0px"),e("#"+this._id+"_toolbar_zoomin").parents("li.e-pdfviewer-toolbarli").css("display","none"),e("#"+this._id+"_toolbar_zoomout").parents("li.e-pdfviewer-toolbarli").css("display","none"),e("#"+this._id+"_toolbar_zoomSelection").parents("div.e-pdfviewer-ejdropdownlist").css("display","none"),this._isMagnificationHidden=!0,!this._isPrintHidden&&this._isNavigationHidden&&this._isMagnificationHidden&&e("#"+this._id+"_toolbar_Print").parent().parents(".e-pdfviewer-toolbarul").css("border-right-width","0px"))},_wireEvents:function(){this.model.toolbarSettings.templateId||(this._on(e("#"+this._id+"_txtpageNo"),"keypress",this._allowOnlyNumbers),this._on(e("#"+this._id+"_txtpageNo"),"keypress",this._onkeyPress),this._on(e("#"+this._id+"_txtpageNo"),"click ",this._onToolbarItemClick),this._on(e("#"+this._id+"_zoomSelection"),"change",this._zoomValChange),this._on(e("#"+this._id+"_toolbar_zoomSelection_popup"),"click",this._zoomValChange),this._on(e("#"+this._id+"_toolbar_zoomSelection_container"),"click ",this._onToolbarItemClick)),this._on(e("#"+this._id+"_toolbarContainer li,#"+this._id+"_toolbarContainer .e-pdfviewer-ejdropdownlist,#"+this._id+"_toolbarContainer .e-pdfviewer-tbpage"),"mouseover",this._showIconToolTip),this._on(e("#"+this._id+"_toolbarContainer li,#"+this._id+"_toolbarContainer .e-pdfviewer-ejdropdownlist,#"+this._id+"_toolbarContainer .e-pdfviewer-tbpage"),"mouseout",this._hideIconToolTip)},_unwireEvents:function(){this.model.toolbarSettings.templateId||(this._on(e("#"+this._id+"_txtpageNo"),"keypress",this._allowOnlyNumbers),this._off(e("#"+this._id+"_txtpageNo"),"keypress",this._onkeyPress),this._off(e("#"+this._id+"_txtpageNo"),"click ",this._onToolbarItemClick),this._off(e("#"+this._id+"_zoomSelection"),"change",this._zoomValChange),this._off(e("#"+this._id+"_toolbar_zoomSelection_popup"),"click",this._zoomValChange),this._off(e("#"+this._id+"_toolbar_zoomSelection_container"),"click ",this._onToolbarItemClick)),this._off(e("#"+this._id+"_toolbarContainer li,#"+this._id+"_toolbarContainer .e-pdfviewer-ejdropdownlist,#"+this._id+"_toolbarContainer .e-pdfviewer-tbpage"),"mouseover",this._showIconToolTip),this._off(e("#"+this._id+"_toolbarContainer li,#"+this._id+"_toolbarContainer .e-pdfviewer-ejdropdownlist,#"+this._id+"_toolbarContainer .e-pdfviewer-tbpage"),"mouseout",this._hideIconToolTip)},_onToolbarItemClick:function(t){t.target.id==this._id+"_txtpageNo"&&e("#"+this._id+"_txtpageNo").select(),e("#"+this._id+"_rptTooltip").css("display","none")},_toolbarClick:function(t){var i,s,a=(t.target,t.target);if(this._isToolbarClick)if(e("#"+this._id+"_rptTooltip").css("display","none"),e(a).hasClass("e-pdfviewer-toolbarli")&&(a=e(a).find("span")),e(a).hasClass("e-pdfviewer-print"))this._print();else if(e(a).hasClass("e-pdfviewer-gotofirst")&&!e(a).hasClass("e-pdfviewer-disabled"))this._gotoFirstPage();else if(e(a).hasClass("e-pdfviewer-gotolast")&&!e(a).hasClass("e-pdfviewer-disabled"))this._gotoLastPage();else if(e(a).hasClass("e-pdfviewer-gotonext")&&!e(a).hasClass("e-pdfviewer-disabled"))this._gotoNextPage();else if(e(a).hasClass("e-pdfviewer-gotoprevious")&&!e(a).hasClass("e-pdfviewer-disabled"))this._gotoPreviousPage();else if(e(a).hasClass("e-pdfviewer-zoomin"))this._applyLowerZoomIndex(this._fitType), this._zoomIn();else if(e(a).hasClass("e-pdfviewer-zoomout"))this._applyHigherZoomIndex(this._fitType),this._zoomOut();else if(e(a).hasClass("e-pdfviewer-fitpage")||e(a).hasClass("e-pdfviewer-fitwidth"))switch(i=a,s=e(i).attr("id")){case this._id+"_fitWidth":this._applyFitToWidth();break;case this._id+"_fitPage":this._applyFitToPage()}},_showToolbar:function(t){t?e("#"+this._id+"_toolbarContainer").css("display","block"):e("#"+this._id+"_toolbarContainer").css("display","none")},_initToolbar:function(){if(this._isToolbarClick=!1,!this.model.toolbarSettings.templateId&&!this._isDevice){var t=e("#"+this._id+"_toolbar_zoomSelection").data("ejDropDownList");t._selectItemByIndex(2),t.disable(),e("#"+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||(e("#"+this._id+"_txtpageNo").removeAttr("disabled"),e("#"+this._id+"_toolbar_zoomSelection").data("ejDropDownList").enable())},_showIconToolTip:function(t){"none"==e("#"+this._id+"_rptTooltip").css("display")&&this._showTooltipContent(t)},_hideIconToolTip:function(){e("#"+this._id+"_rptTooltip").css("display","none")},_viewpopupBlockNone:function(e){return"block"!=e.css("display")},_showTooltipContent:function(t){var i,s,a,n,o,r,l,d=t.target;if(this.model.toolbarSettings.showTooltip&&!this._isDevice){if(a=!0,e(d).hasClass("e-pdfviewer-toolbarli")&&(d=e(d).find("span")),n=e(d).prev(),e(d).hasClass("e-pdfviewer-print"))i=e("#"+this._id+"_toolbarContainer .e-pdfviewer-print")[0].getBoundingClientRect(),s=this._getTootipText("print");else if(e(d).hasClass("e-pdfviewer-gotofirst")||e(n).hasClass("e-pdfviewer-gotofirst"))i=e("#"+this._id+"_toolbarContainer .e-pdfviewer-gotofirst")[0].getBoundingClientRect(),s=this._getTootipText("first");else if(e(d).hasClass("e-pdfviewer-gotolast")||e(n).hasClass("e-pdfviewer-gotolast"))i=e("#"+this._id+"_toolbarContainer .e-pdfviewer-gotolast")[0].getBoundingClientRect(),s=this._getTootipText("last");else if(e(d).hasClass("e-pdfviewer-gotonext")||e(n).hasClass("e-pdfviewer-gotonext"))i=e("#"+this._id+"_toolbarContainer .e-pdfviewer-gotonext")[0].getBoundingClientRect(),s=this._getTootipText("next");else if(e(d).hasClass("e-pdfviewer-gotoprevious")||e(n).hasClass("e-pdfviewer-gotoprevious"))i=e("#"+this._id+"_toolbarContainer .e-pdfviewer-gotoprevious")[0].getBoundingClientRect(),s=this._getTootipText("previous");else if(e(d).hasClass("e-pdfviewer-zoomin")||e(n).hasClass("e-pdfviewer-zoomin"))i=e("#"+this._id+"_toolbarContainer .e-pdfviewer-zoomin")[0].getBoundingClientRect(),s=this._getTootipText("zoomin");else if(e(d).hasClass("e-pdfviewer-zoomout")||e(n).hasClass("e-pdfviewer-zoomout"))i=e("#"+this._id+"_toolbarContainer .e-pdfviewer-zoomout")[0].getBoundingClientRect(),s=this._getTootipText("zoomout");else if(e(d).hasClass("e-pdfviewer-tbpage")||e(d).hasClass("e-pdfviewer-pagenumber")||e(d).hasClass("e-pdfviewer-labelpageno"))i=e("#"+this._id+"_toolbarContainer .e-pdfviewer-tbpage")[0].getBoundingClientRect(),s=this._getTootipText("pageIndex");else if(e(d).hasClass("e-pdfviewer-ejdropdownlist")||e(d).hasClass("e-dropdownlist")||e(d).hasClass("e-select")||e(d).hasClass("e-down-arrow"))i=e("#"+this._id+"_toolbarContainer .e-pdfviewer-ejdropdownlist")[0].getBoundingClientRect(),s=this._getTootipText("zoom"),a=this._viewpopupBlockNone(e("#"+this._id+"_toolbar_zoomSelection_popup_list_wrapper"));else if(e(d).hasClass("e-pdfviewer-fitwidth")||e(d).hasClass("e-pdfviewer-fitpage")||e(n).hasClass("e-pdfviewer-fitwidth")||e(n).hasClass("e-pdfviewer-fitpage"))switch(o=d,r=e(o).attr("id")){case this._id+"_fitWidth":i=e("#"+this._id+"_toolbarContainer .e-pdfviewer-fitwidth")[0].getBoundingClientRect(),s=this._getTootipText("fittoWidth");break;case this._id+"_fitPage":i=e("#"+this._id+"_toolbarContainer .e-pdfviewer-fitpage")[0].getBoundingClientRect(),s=this._getTootipText("fittopage");break;default:l=e(o).prev(),e(l).hasClass("e-pdfviewer-fitwidth")?(i=e("#"+this._id+"_toolbarContainer .e-pdfviewer-fitwidth")[0].getBoundingClientRect(),s=this._getTootipText("fittoWidth")):e(l).hasClass("e-pdfviewer-fitpage")&&(i=e("#"+this._id+"_toolbarContainer .e-pdfviewer-fitpage")[0].getBoundingClientRect(),s=this._getTootipText("fittopage"))}s&&a&&(e("#"+this._id+"_rptTooltip_Header").html(s.header),e("#"+this._id+"_rptTooltip_Content").html(s.content),e("#"+this._id+"_rptTooltip").css({top:i.top+i.height+5,left:i.left+i.width/2,display:"block",position:"fixed"}))}},_getTootipText:function(e){var i=t.PdfViewer.Locale[this.model.locale]?t.PdfViewer.Locale[this.model.locale]:t.PdfViewer.Locale.default,s="",a="";switch(e){case"print":s=i.toolbar.print.headerText,a=i.toolbar.print.contentText;break;case"first":s=i.toolbar.first.headerText,a=i.toolbar.first.contentText;break;case"previous":s=i.toolbar.previous.headerText,a=i.toolbar.previous.contentText;break;case"next":s=i.toolbar.next.headerText,a=i.toolbar.next.contentText;break;case"last":s=i.toolbar.last.headerText,a=i.toolbar.last.contentText;break;case"zoomin":s=i.toolbar.zoomIn.headerText,a=i.toolbar.zoomIn.contentText;break;case"zoomout":s=i.toolbar.zoomOut.headerText,a=i.toolbar.zoomOut.contentText;break;case"pageIndex":s=i.toolbar.pageIndex.headerText,a=i.toolbar.pageIndex.contentText;break;case"zoom":s=i.toolbar.zoom.headerText,a=i.toolbar.zoom.contentText;break;case"fittoWidth":s=i.toolbar.fitToWidth.headerText,a=i.toolbar.fitToWidth.contentText;break;case"fittopage":s=i.toolbar.fitToPage.headerText,a=i.toolbar.fitToPage.contentText}return{header:s,content:a}},_setInitialization:function(){this._jsondata,this._canvascount=0,this._fileName="",this._isToolbarClick=!1,this._pageModel=null,this._currentPage=1,this._zoomLevel=2,this._pageImageStream=null,this._pageimageList,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._pagePrinted=!1,this._printingPage=1,this._printingTimer,this._previousZoom=1,this._renderPreviousPage=!1,this._pageSize,this._eventpreviouszoomvalue,this._eventzoomvalue,this._pdfFileName},_showViewerBlock:function(t){if(t){e("#"+this._id+"_viewBlockContainer").css("display","block");var i=e("#"+this._id+"_viewBlockContainer .e-pdfviewer-viewerblockcellcontent").find("table");this._selectparamToolItem(i.is("[isviewclick]"))}else e("#"+this._id+"_viewBlockContainer").css("display","none");this._isDevice&&e("#"+this._id+"_viewBlockContainer.e-pdfviewer-blockstyle").css("z-index",t?"10":"0")},_showNavigationIndicator:function(t){e("#"+this._id+"_viewerContainer").ejWaitingPopup({showOnInit:t}),e("#"+this._id+"_viewerContainer_WaitingPopup").addClass("e-pdfviewer-waitingpopup")},_showloadingIndicator:function(t){t?(e("#"+this._id+"_loadingIndicator").css("display","block"),e("#"+this._id+"_pageviewOuterContainer").css("display","none")):(e("#"+this._id+"_loadingIndicator").css("display","none"),e("#"+this._id+"_pageviewOuterContainer").css("display","block")),e("#"+this._id+"_loadingIndicator").ejWaitingPopup({showOnInit:t}),e("#"+this._id+"_loadingIndicator_WaitingPopup").addClass("e-pdfviewer-waitingpopup")},_showPrintLoadingIndicator:function(t){e("#"+this._id).ejWaitingPopup({showOnInit:t,text:"Preparing document for printing...",cssClass:"e-pdfviewer-waitingpopup-print"})},_viewerResize:function(){var t=this;this.resizeTO&&clearTimeout(this.resizeTO),this.resizeTO=setTimeout(function(){var i,s,a=t._isWidth?t.element[0].parentElement.style.width:t.element[0].style.width,n=t._isHeight?t.element[0].parentElement.style.height:t.element[0].style.height,o=e(t.element).height(),r=e(t.element).width();n.indexOf("%")!=-1?(t._isPercentHeight=parseInt(n),i=t._isHeight?e(t.element).parent().height():o,o=t._isHeight?i:i/100*t._isPercentHeight):0!=t.element[0].parentElement.clientHeight&&t._isPercentHeight!=-1?o=t._isHeight?t.element[0].parentElement.clientHeight:t.element[0].parentElement.clientHeight/100*t._isPercentHeight:t._isHeight&&0!=t.element[0].parentElement.clientHeight&&(o=t.element[0].parentElement.clientHeight),t.element.height(o),a.indexOf("%")!=-1?(t._isPercentWidth=parseInt(a),s=t._isWidth?e(t.element).parent().width():r,r=t._isWidth?s:s/100*t._isPercentWidth):0!=t.element[0].parentElement.clientWidth&&t._isPercentWidth!=-1?r=t._isWidth?t.element[0].parentElement.clientWidth:t.element[0].parentElement.clientWidth/100*t._isPercentWidth:t._isWidth&&0!=t.element[0].parentElement.clientWidth&&(r=t.element[0].parentElement.clientWidth),t.element.width(r),t._setContainerSize(),t._applyLeftPosition()},200)},_applyLeftPosition:function(){for(var e,t,i=1;i<=this._totalPages;i++)e=(this.element.width()-this._pageSize[i-1].PageWidth*this._zoomVal)/2,e<0&&(e=0),t=document.getElementById(this._id+"pageDiv_"+i),t.style.left=e+"px"},goToPage:function(e){this._gotoPageNo(e)},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(e){this._showPrintButton(e)},showPageNavigationTools:function(e){this._showPageNavigationControls(e)},showMagnificationTools:function(e){this._showZoomControl(e),this._showFittoPage(e)},showToolbar:function(e){this._showToolbar(e)},load:function(s){var a,n,o,r;if(this._showloadingIndicator(!0),this._fitType=null,this._toolbar.enableItemByID(this._id+"_pdfviewer_toolbar_fitPage"),this._toolbar.enableItemByID(this._id+"_pdfviewer_toolbar_fitWidth"),this._zoomVal=1,e("#"+this._id+"_toolbar_zoomSelection_hidden").val("100%"),this._initToolbar(),s)for(a=this._canvascount;a>=1;)e("#"+this._id+"pageDiv_"+a).remove(),a--;n={},n.viewerAction="GetPageModel",n.controlId=this._id,n.pageindex="1",n.isInitialLoading="true",o=s.split("base64,")[1],o==i?(this._fileName=s,n.newFileName=this._fileName,this._pdfService==t.PdfViewer.PdfService.Local?this._doAjaxPost("POST",this._actionUrl,JSON.stringify(n),"_getPageModel"):this._doAjaxPost("POST",this.model.serviceUrl,JSON.stringify({jsonResult:n}),"_getPageModel")):(r=this.model.serviceUrl,n.uploadedFile=o,this._pdfService==t.PdfViewer.PdfService.Local?(r=this.model.serviceUrl+"/FileUploadPostAction",this._doAjaxPost("POST",r,JSON.stringify(n),"_getPageModel")):(r=r.replace("PostViewerAction","FileUploadPostAction"),this._doAjaxPost("POST",r,JSON.stringify({jsonResult:n}),"_getPageModel")))},fitToPage:function(){this._applyFitToPage()},fitToWidth:function(){this._applyFitToWidth()},zoomIn:function(){this._applyLowerZoomIndex(this._fitType),this._zoomIn()},zoomOut:function(){this._applyHigherZoomIndex(this._fitType),this._zoomOut()},zoomTo:function(t){t<50?t=50:t>400&&(t=400);var i=parseInt(t)/100;this._zoomContainer(i,!1),e("#"+this._id+"_toolbar_zoomSelection_hidden").val(t+"%")}}),t.PdfViewer.ToolbarItems={MagnificationTools:1,PageNavigationTools:2,PrintTools:4,All:7},t.PdfViewer.PdfService={Local:1,Remote:2},t.PdfViewer.LinkTarget={Default:1,NewTab:2,NewWindow: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."},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."}}}}(jQuery,Syncfusion),function(e,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:null,progressbarTemplate:null,parenttaskbarTemplate:null,parentprogressbarTemplate:null,flatRecords:[],updatedRecords:[],ids:[],currentViewData:[],scheduleWeeks:[],scheduleYears:[],scheduleMonths:[],scheduleDays:[],scheduleHours:[],projectStartDate:null,projectEndDate:null,tooltipTemplate:"",tooltipTemplateId:"",progressbarTooltipTemplateId:"",taskbarEditingTooltipTemplateId:"",taskbarEditingTooltipTemplate:"",progressbarTooltipTemplate:"",showTaskNames:!0,showProgressStatus:!0,showResourceNames:!0,enableRowHover:!1,includeWeekend:!1,allowZooming:!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"},workingTimeScale:"TimeScale8Hours",roundOffDayworkingTime:!0,durationUnit:"day",localizedDays:null,localizedMonths:null,columnHeaderTexts:null,predecessorEditingTexts:null,enablePredecessorEditing:!0},updateHighlightWeekends:function(e){var t=this;t.model.highlightWeekends=e,1==t.model.highlightWeekends?t._renderWeekends():t._$weekendContainer.remove()},updateWeekendBackground:function(e){var t=this;t.model.weekendBackground=e,t._$weekendContainer.remove(),t._renderWeekends()},showTooltip:function(e){var t=this;t.model.enableTaskbarTooltip=e,t._createTaskbarTemplate(),t._refresh()},showEditingTooltip:function(e){var t=this;t.model.enableTaskbarDragTooltip=e,t._createTaskbarTemplate(),t._refresh()},updateConnectorLineBackground:function(e){var t=this;t.model.connectorLineBackground=e,t._createConnectorLineTemplate()},updateConnectorlineWidth:function(e){var t=this;t.model.connectorlineWidth=parseInt(e),t._createConnectorLineTemplate()},updateTaskbarBackground:function(e){var t=this;t.model.taskbarBackground=e,this._createTaskbarTemplate(),this._refresh()},updateProgressbarBackground:function(e){this.model.progressbarBackground=e,this._createTaskbarTemplate(),this._refresh()},updateParentTaskbarBackground:function(e){this.model.parentTaskbarBackground=e,this._createTaskbarTemplate(),this._refresh()},updateParentProgressbarBackground:function(e){this.model.parentProgressbarBackground=e,this._createTaskbarTemplate(),this._refresh()},updateRenderTaskNames:function(e){var t=this;t.model.showTaskNames=e,t._createTaskbarTemplate(),t._refresh()},updateRendeProgressStatus:function(e){var t=this;t.model.showProgressStatus=e,t._createTaskbarTemplate(),t._refresh()},updateRenderResourceNames:function(e){var t=this;t.model.showResourceNames=e,t._createTaskbarTemplate(),t._refresh()},changeMilestoneTemplate:function(e){var t=this;t.model.milestoneTemplate=e,t._createTaskbarTemplate(),t._refresh()},changeTaskbarTemplate:function(e){var t=this;t.model.taskbarTemplate=e,t._createTaskbarTemplate(),t._refresh()},changeParentTaskbarTemplate:function(e){var t=this;t.model.parentTaskbarTemplate=e,t._createTaskbarTemplate(),t._refresh()},ganttChartEditing:function(e){var t=this;t.model.allowGanttChartEditing=e},resizeProgressbar:function(e){var t=this;t.model.enableProgressBarResizing=e},updateAllowKeyboardNavigation:function(e){this.model.allowKeyboardNavigation=e},updateProgressbarHeight:function(e){var t=this;this.model.progressbarHeight=e,t._createTaskbarTemplate(),t._refresh()},updateBaselineColor:function(e){var t=this;this.model.baselineColor=e,t._createTaskbarTemplate(),t._refresh()},updateRenderBaseline:function(e){var t=this;this.model.renderBaseline=e,t._createTaskbarTemplate(),t._refresh(),t._createConnectorLineTemplate()},_getYearWidth:function(){for(var e=0,t=0,e=0;es));return a},_getHeight:function(){return this._containerHeight},_setHeight:function(e){this._containerHeight=e},getGanttChartRows:function(){return this._ganttChartRows},getUpdatedRecords:function(){return this.model.flatRecords},setUpdatedRecords:function(e,t,i,s){var a=this;a.model.currentViewData=e,a.model.updatedRecords=t,a.model.flatRecords=i,a.model.ids=s},_getFormatedDate:function(e,i){return t.format(e,i)},_getViewportHeight:function(){var e=this,t=e._$headerContainer;return e.element.height()-t.height()-parseFloat(t.css("border-bottom-width"))},updateViewPortHeight:function(){var e=this;e._viewportHeight=e._getViewportHeight()},_init:function(){var s,a,n=this,o=n.model,r=o.scheduleHeaderSettings.scheduleHeaderType;n.element.addClass("e-ganttchart-core"),n.element.attr("tabindex","0"),n._initPrivateProperties(),n._initialize(),n._renderGanttChart(),n._$bodyContainerParent.append(n._$bodyContainer),n._$bodyContainer.append(n._$bodyContent),n._$ganttChartContainer.append(n._$bodyContainerParent),e(n._$bodyContainer).css({height:n._viewportHeight+"px"}),n.model.enableVirtualization&&e(n._$bodyContent).css({height:o.rowHeight*o.updatedRecords.length+"px"}),"week"==r?e(n._$bodyContent).css({width:o.scheduleWeeks.length*n._scheduleWeekWidth+"px"}):"year"==r?e(n._$bodyContent).css({width:n._scheduleYearWidth+"px"}):"month"==r?e(n._$bodyContent).css({width:n._scheduleMonthWidth+"px"}):"day"==r?e(n._$bodyContent).css({width:o.scheduleDays.length*o.perHourWidth*24+"px"}):"hour"==r&&e(n._$bodyContent).css({width:o.scheduleHours.length*o.perMinuteWidth*n._totalInterval+"px"}),n.createGridLinesTable(),n.renderGanttRecords(),s=t.buildTag("div"),s.append(n._$bodyContent),n._$bodyContainer.append(s),n._$bodyContainer.ejScroller({width:n.element.width()-1,enableTouchScroll:!1,height:n._getViewportHeight(),scroll:function(e){var t=e.scrollTop;e.requestType="scroll",e.delta=t,t!=i?n.onScrollHelper(t,!0)===!1&&(e.cancel=!0):n._handleScroll(e)}}),n._$bodyContainer.ejScroller("model.keyConfigs",{up:"",down:"",left:"",right:""}),n._$bodyContainer.ejScroller("refresh"),a=n._$bodyContainer.ejScroller("isHScroll"),a?n._$bodyContainer.find("div.e-content").removeClass("e-borderbox"):n._$bodyContainer.find("div.e-content").addClass("e-borderbox"),n._wireEvents()},reRenderGanttChart:function(t,i){var s=this,a=s.model,n=a.scheduleHeaderSettings.scheduleHeaderType;s._wireEvents(),a.perDayWidth=t,a.flatRecords=i,s._scheduleWeekWidth=s._getWeekWidth(),s._scheduleYearWidth=s._getYearWidth(),s._scheduleMonthWidth=s._getMonthWidth(),e(s._$headerContainer).empty(),e(s._$scheduleDiv).empty(),s._renderGanttChart(),s._$bodyContainerParent.append(s._$bodyContainer),s._$bodyContainer.append(s._$bodyContent),s._$ganttChartContainer.append(s._$bodyContainerParent),"week"==n?e(s._$bodyContent).css({width:a.scheduleWeeks.length*s._scheduleWeekWidth+"px"}):"year"==n?e(s._$bodyContent).css({width:s._scheduleYearWidth+"px"}):"month"==n?e(s._$bodyContent).css({width:s._scheduleMonthWidth+"px"}):"day"==n?e(s._$bodyContent).css({width:a.scheduleDays.length*a.perHourWidth*24+"px"}):"hour"==n&&e(s._$bodyContent).css({width:a.scheduleHours.length*a.perMinuteWidth*s._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._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._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=e(window).width(),t._windowHeight=e(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 e=this;e._scheduleWeekWidth=e._getWeekWidth(),e._numOfWeeks=e._getNumberOftWeeks(this.model.projectStartDate,this.model.projectEndDate),e._scheduleYearWidth=e._getYearWidth(),e._scheduleMonthWidth=e._getMonthWidth(),e._totalWeekWidth=e._scheduleWeekWidth*e._numOfWeeks.length,e._balanceWidth=e._totalWeekWidth-e._scheduleMonthWidth,e._scheduleMonthWidth+=e._balanceWidth},_initialize:function(){var e=this;e._$ganttChartContainer=t.buildTag("div.e-ganttviewercontainer#ganttviewercontainer"+e._id,"",{width:"100%"},{}),e._$headerContainer=t.buildTag("div.e-ganttviewerheaderContainer#ganttviewerheaderContainer"+e._id,"",{"border-right-style":"solid","border-right-width":"1px"},{}),e._$bodyContainer=t.buildTag("div.e-ganttviewerbodyContianer#ganttviewerbodyContianer"+e._id,"",{"-ms-touch-action":"none","touch-action":"none"},{}),e._$bodyContainerParent=t.buildTag("div.e-ganttviewerbodyContianerparent#ganttviewerbodyContianerParent"+e._id,"",{"-ms-touch-action":"none","touch-action":"none","border-right-style":"solid","border-right-width":"1px","box-sizing":"border-box",width:"auto",height:"auto"},{}),e._$bodyContent=t.buildTag("div.e-ganttviewerbodyContent#ganttviewerbodyContent"+e._id,"",{},{}),e._$dependencyViewContainer=t.buildTag("div.e-ganttviewerbodyContianer-dependencyViewContainer#dependencyViewContainer"+e._id,"",{"z-index":"4",position:"absolute"},{}),e._$secondaryCanvas=t.buildTag("div.e-ganttviewerbodyContianer-secondaryCanvas","",{"z-index":"3",position:"absolute"},{}),e._$stripLineContainer=t.buildTag("div.e-ganttviewerbodyContianer-stripLines","",{"z-index":"6",position:"absolute"},{}),e._$weekendsContainer=t.buildTag("div.e-ganttviewerbodyContianer-weekendsContainer","",{"z-index":"1",position:"absolute"},{}),e._$ganttViewTable=t.buildTag("table.e-ganttviewerbodyContianer-ganttViewTable#ganttViewTable"+e._id,"",{"z-index":"5",position:"absolute"},{cellspacing:"0px"}),e._$scheduleDiv=t.buildTag("div.e-gantt-schedule-container#gantt-schedule"+e._id,"",{},{})},_getScheduleLength:function(e){var t=this,i=t.model;switch(e){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,s,a,n,o=this,r=o.model,l=r.scheduleHeaderSettings.scheduleHeaderType;if(o._createSchedule(o._getDateType(r.scheduleStartDate),o._getDateType(r.scheduleEndDate)),o._viewportHeight=o._getViewportHeight(),o._$ganttViewTable.css("width",o._getScheduleLength(l)+"px"),i=t.buildTag("colgroup","",{},{}),s=e(document.createElement("col")),s.css("width",o._getScheduleLength(l)+"px"),i.append(s),o._$ganttViewTable.append(i),o._createTooltipTemplate(),o._createEditingTooltipTemplate(),o._createProgressbarTooltipTemplate(),o._createTaskbarTemplate(),o._createConnectorLineTemplate(),o._updateCurrentViewData(),1==o.model.highlightWeekends&&r.scheduleHeaderSettings.scheduleHeaderType==t.Gantt.ScheduleHeaderType.Week&&o._renderWeekends(),o._$stripLineContainer.empty(),null!=o.model.stripLines&&this._renderStripLines(o.model.stripLines),o._$secondaryCanvas.empty(),null!=o.model.holidays)for(a=o.model.holidays.length,n=0;n"+h.stripLines[o[1]].day+""+h.stripLines[o[1]].label+"",{},{}), r.append(l),h.tooltipTemplate?("object"!=typeof h.tooltipTemplate?(s=e.parseHTML(h.tooltipTemplate),d._mouseHoverTooltip=s[0]):(a=e(h.tooltipTemplate)[0].innerHTML,s=e.parseHTML(a),d._mouseHoverTooltip=s[1]),e(d._mouseHoverTooltip).css({position:"absolute"}),e(d._mouseHoverTooltip).addClass("customTooltip"),d._mouseHoverTooltip.innerHTML=""+r[0].innerHTML+"
      "):d._mouseHoverTooltip=t.buildTag("div.e-tooltipgantt#tooltipgantt"+d._id,r,{position:"absolute","z-index":"6"},{}),setTimeout(function(){e(document.body).append(d._mouseHoverTooltip),d._updateTooltipPosition(d._mouseHoverTooltip,u,m)},700))},_tooltipMouseup:function(){var e=this;null==e._mouseTarget||t.isTouchDevice()||e._handleMouseUp(e._mouseTarget)},_clearTooltip:function(){var t=this;t._mouseHoverTooltip&&e(t._mouseHoverTooltip).remove(),t._taskbarEditingTooltipID&&e(t._taskbarEditingTooltipID).remove(),t._progressBarTooltipID&&e(t._progressBarTooltipID).remove(),e(".e-editingtooltip").remove(),e("#tooltipgantt").remove(),e(".e-progressbartooltip").remove(),t._mouseHoverTooltip=null},_mouseWheel:function(e){if(this.model.allowZooming){var t=this,i={},s=null;if(e=e.originalEvent,e.preventDefault(),e.wheelDelta?s=-e.wheelDelta/120:e.detail&&(s=e.detail/3),!s)return;i.requestType="scroll",i.delta=s,t._enbleZooming(i)}},_resizerrightOver:function(e){var t=this,i=e.target,s=i.parentNode;1==t.model.allowGanttChartEditing&&(0==this._mouseDown&&(e.target.style.cursor="w-resize"),t._setEditingElements(s))},_resizerrightLeave:function(){var e=this;1==e.model.allowGanttChartEditing&&e._removeEditingElements()},_resizerleftOver:function(e){var t=this,i=e.target,s=i.parentNode;1==t.model.allowGanttChartEditing&&(0==this._mouseDown&&(e.target.style.cursor="e-resize"),t._setEditingElements(s))},_resizerleftLeave:function(){var e=this;1==e.model.allowGanttChartEditing&&e._removeEditingElements()},_progressresizerOver:function(t){var i=this,s=t.target,a=s.parentNode;1==i.model.allowGanttChartEditing&&(i.model.enableProgressBarResizing?(0==i._mouseDown&&e(s).prev(".e-gantt-childtaskbar").has(".e-gantt-childtaskbar-progress").length>0&&(s.style.cursor="col-resize"),i._setEditingElements(a)):s.style.cursor="move")},_progressresizerLeave:function(){var e=this;1==e.model.allowGanttChartEditing&&e._removeEditingElements()},_secondMouseOverConnectorPoint:function(t,i){var s,a,n,o,r,l=this;if(l._mouseDown&&l._falseLine||i&&l._falseLine){var d,h,c,u=e(t.target),m=l.getGanttChartRows(),s=u.closest("tr.e-ganttrowcell"),a=m.index(s),n=l.model.currentViewData[a],p=l._editingItem,g=n;if("Start"===l._prevItem.predecessorTarget?d=p.taskId+"S":"Finish"===l._prevItem.predecessorTarget&&(d=p.taskId+"F"),u.hasClass("e-connectorpoint-left")?(d+="S",c="Start"):u.hasClass("e-connectorpoint-right")&&(d+="F",c="Finish"),$table=l._predecessorTooltip.find("table"),$td=$table.find("tbody").find("tr:eq(1)").find("td:eq(2)").text(g.taskName),$td=$table.find("tbody").find("tr:eq(1)").find("td:eq(3)").text(c),o={},o.requestType="validatePredecessor",o.fromItem=p,o.toItem=g,h=o.toItem.item[l.model.predecessorMapping]?o.toItem.item[l.model.predecessorMapping]+","+d:d,o.predecessor=d,o.currentRecord=g,o.predecessorString=[],o.predecessorString.push(h),r=l._completeAction(o),$td=$table.find("tbody").find("tr:eq(0)").find("td:eq(0)"),r?($td.removeClass(),$td.addClass("e-predecessor-true")):($td.removeClass(),$td.addClass("e-predecessor-false")),i)return o}},_dragLeftOver:function(t){var i=this,s=t.target,a=s.parentNode;i.model.predecessorMapping&&i.model.allowGanttChartEditing&&i.model.enablePredecessorEditing&&(0==this._mouseDown&&(s.style.cursor="pointer"),i._setEditingElements(a)),e(a).hasClass("e-parentContainer")||i._secondMouseOverConnectorPoint(t)},_dragLeftLeave:function(){var e=this;1==e.model.allowGanttChartEditing&&e.model.enablePredecessorEditing&&e._removeEditingElements()},_dragRightOver:function(t){var i=this,s=t.target,a=s.parentNode;i.model.predecessorMapping&&i.model.allowGanttChartEditing&&i.model.enablePredecessorEditing&&(0==this._mouseDown&&(s.style.cursor="pointer"),i._setEditingElements(a)),e(a).hasClass("e-parentContainer")||i._secondMouseOverConnectorPoint(t)},_dragRightLeave:function(){var e=this;1==e.model.allowGanttChartEditing&&e.model.enablePredecessorEditing&&e._removeEditingElements()},_setEditingElements:function(t){var i,s=this;return!(!s._editingTarget||s._editPredecessor||0!=e(t).find(s._editingTarget).length)||(e(t).hasClass("e-childContainer")&&(s._leftResizerGripper=t.querySelector(".taskbarresizer-left"),s._rightResizerGripper=t.querySelector(".taskbarresizer-right"),i=t.querySelector(".progressbarresizer-right"),s._progressHandle=i&&i.firstChild,s._progressHandleChild=i&&i.childNodes[1],e(s._leftResizerGripper).addClass("gripper"),e(s._rightResizerGripper).addClass("gripper"),s.model.progressMapping&&(e(s._progressHandle).addClass("e-progresshandle"),e(s._progressHandleChild).addClass("e-progresshandleafter"))),void(s.model.enablePredecessorEditing&&(e(t).hasClass("e-childContainer")&&s.model.predecessorMapping&&!s._falseLine?(s._leftConnectorPoint=t.querySelector(".e-connectorpoint-left"),s._rightConnectorPoint=t.querySelector(".e-connectorpoint-right"),e(s._leftConnectorPoint).addClass("e-connectorpoint-hover"),e(s._rightConnectorPoint).addClass("e-connectorpoint-hover")):e(t).hasClass("e-gantt-milestone-container")&&s.model.predecessorMapping&&!s._falseLine?(s._leftConnectorPoint=t.querySelector(".e-connectorpoint-left"),s._rightConnectorPoint=t.querySelector(".e-connectorpoint-right"),e(s._leftConnectorPoint).addClass("e-connectorpoint-hover"),e(s._rightConnectorPoint).addClass("e-connectorpoint-hover")):e(t).hasClass("e-childContainer")&&s.model.predecessorMapping&&s._falseLine?(s._childLeftConnectorPoint=t.querySelector(".e-connectorpoint-left"),s._childRightConnectorPoint=t.querySelector(".e-connectorpoint-right"),e(s._childLeftConnectorPoint).addClass("e-connectorpoint-hover"),e(s._childRightConnectorPoint).addClass("e-connectorpoint-hover")):e(t).hasClass("e-gantt-milestone-container")&&s.model.predecessorMapping&&s._falseLine?(s._childLeftConnectorPoint=t.querySelector(".e-connectorpoint-left"),s._childRightConnectorPoint=t.querySelector(".e-connectorpoint-right"),e(s._childLeftConnectorPoint).addClass("e-connectorpoint-hover"),e(s._childRightConnectorPoint).addClass("e-connectorpoint-hover")):e(t).hasClass("e-parentContainer")&&s.model.predecessorMapping&&!s._falseLine&&(s._leftConnectorPoint=t.querySelector(".e-connectorpoint-left"),s._rightConnectorPoint=t.querySelector(".e-connectorpoint-right"),e(s._leftConnectorPoint).addClass("e-connectorpoint-hover"),e(s._rightConnectorPoint).addClass("e-connectorpoint-hover")))))},_removeEditingElements:function(){var t=this;e(t._leftResizerGripper).removeClass("gripper"),e(t._rightResizerGripper).removeClass("gripper"),t.model.progressMapping&&(e(t._progressHandle).removeClass("e-progresshandle"),e(t._progressHandleChild).removeClass("e-progresshandleafter")),t.model.enablePredecessorEditing&&(t.model.predecessorMapping&&0==t._mouseDown&&(e(t._leftConnectorPoint).removeClass("e-connectorpoint-hover"),e(t._rightConnectorPoint).removeClass("e-connectorpoint-hover"),t._leftConnectorPoint=null,t._rightConnectorPoint=null),(t.model.predecessorMapping&&null!==t._leftConnectorPoint&&1==t._mouseDown||t._childLeftConnectorPoint)&&(e(t._childLeftConnectorPoint).removeClass("e-connectorpoint-hover"),e(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 e=this;e._$bodyContainer.ejScroller("refresh")},_mousedown:function(i){var s,a,n;if(2==i.which||3==i.which)return!1;s=this,s._clearTooltip(),s._mouseDown=!0,args={};var o=e(i.target),r=s.getGanttChartRows(),l=o.closest("tr.e-ganttrowcell"),d=r.index(l),h=s.model.currentViewData[d],c=(h.parentItem,o[0].parentNode),u=(jQuery.uaMatch(navigator.userAgent),this.model);return t.isNullOrUndefined(h)?void 0:(s._editingItem=h,s._editingTarget=o,c=e(c).hasClass("progressbarresizer-right")?c.parentNode:e(c).hasClass("e-gantt-childtaskbar-progress")?e(c).closest("div.e-childContainer"):e(c).hasClass("progressbarhandler")?o.closest(".e-childContainer")[0]:e(c).closest("div.e-childContainer,div.e-parentContainer,.e-gantt-milestone,div.e-gantt-milestone-container"),(e(c).hasClass("e-childContainer")||e(c).hasClass("e-gantt-milestone")||e(c).hasClass("e-parentContainer")||e(c).hasClass("e-gantt-milestone-container"))&&(e(l).addClass("e-editmode"),s._mouseTarget=i),s.model.allowGanttChartEditing&&(e(c).hasClass("e-childContainer")||e(c).hasClass("e-gantt-milestone")||e(c).hasClass("e-gantt-milestone-container")||e(c).hasClass("e-parentContainer"))&&(("e-resize"==i.target.style.cursor&&(e(c).hasClass("e-childContainer")||e(c).hasClass("e-gantt-milestone"))||"touchstart"==i.type&&"taskbarresizer-left"==i.target.className)&&(s._updateEditingType(),s._leftResizing=!0),("w-resize"==i.target.style.cursor&&(e(c).hasClass("e-childContainer")||e(c).hasClass("e-gantt-milestone"))||"touchstart"==i.type&&"taskbarresizer-right"==i.target.className)&&(s._updateEditingType(),s._rightResizing=!0),a=e(i.target).closest(".progressbarresizer-right"),(("col-resize"==i.target.style.cursor||a.length&&"col-resize"==a[0].style.cursor)&&(e(c).hasClass("e-childContainer")||e(c).hasClass("e-gantt-milestone"))||"touchstart"==i.type&&"progressbarresizer-right"==i.target.className)&&(s._updateEditingType(),s._progressResizing=!0),n=e(i.target).closest("[style*='cursor: move']"),("move"==i.target.style.cursor||n.length&&"move"==n[0].style.cursor)&&(e(c).hasClass("e-childContainer")||e(c).hasClass("e-gantt-milestone")||e(c).hasClass("e-gantt-milestone-container"))&&(s._updateEditingType(),s._allowDragging=!0),""==i.target.style.cursor&&(n.length&&""==n[0].style.cursor||0==n.length)&&(e(c).hasClass("e-childContainer")||e(c).hasClass("e-gantt-milestone")||e(c).hasClass("e-gantt-milestone-container"))&&(s._updateEditingType(),"taskbarresizer-left e-icon"==i.target.className||"taskbarresizer-left e-icon gripper"==i.target.className?s._leftResizing=!0:"taskbarresizer-right e-icon"==i.target.className||"taskbarresizer-right e-icon gripper"==i.target.className?s._rightResizing=!0:"progressbarhandler e-progresshandle"==i.target.className||"e-progresshandler-element"==i.target.className||"e-progresshandlerafter-element"==i.target.className||"progressbarresizer-right"==i.target.className?s._progressResizing=!0:("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"==i.target.className||e(i.target).hasClass("e-gantt-milestone")||e(i.target).closest(".e-gantt-milestone").length>0||e(i.target).closest(".e-gantt-childtaskbar").length>0)&&(s._allowDragging=!0)),s.model.enablePredecessorEditing&&("pointer"==i.target.style.cursor&&(e(c).hasClass("e-childContainer")||e(c).hasClass("e-gantt-milestone")||e(c).hasClass("e-gantt-milestone-container")||e(c).hasClass("e-parentContainer"))||"touchstart"==i.type&&("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"==i.target.className))&&(s._updateEditingType(),s._editPredecessor=!0,o.hasClass("e-connectorpoint-left")||o.hasClass("e-connectorpoint-left e-connectorpoint-hover")?s._prevItem.predecessorTarget="Start":(o.hasClass("e-connectorpoint-right")||o.hasClass("e-connectorpoint-right e-connectorpoint-hover"))&&(s._prevItem.predecessorTarget="Finish")),i||(i=window.event),"msie"==t.browserInfo().name&&t.browserInfo().version<9&&(i.originalEvent.pageX=i.originalEvent.clientX,i.originalEvent.pageY=i.originalEvent.clientY),i.originalEvent.pageX||i.originalEvent.pageY?(s._currMousePosX=i.originalEvent.pageX,s._currMousePosY=i.originalEvent.pageY,s.dragPosX=i.originalEvent.pageX):i.originalEvent.clientX||i.originalEvent.clientY?s.dragPosX=i.originalEvent.clientX+document.body.scrollLeft+document.documentElement.scrollLeft:i.originalEvent&&i.originalEvent.changedTouches&&i.originalEvent.changedTouches.length>0&&(s._currMousePosX=i.originalEvent.changedTouches[0].pageX,s._currMousePosY=i.originalEvent.changedTouches[0].pageY,s.dragPosX=i.originalEvent.changedTouches[0].pageX),s._prevItem.left=h.left,s._prevItem.status=h.status,s._prevItem.duration=h.duration,s._prevItem.startDate=h.startDate,s._prevItem.endDate=h.endDate,s._prevItem.width=h.width,s._parentCollectionPreviousValues=s._getParentCollectionPreviousValues(h),s.model.enablePredecessorEditing&&(s._connectorPointX=s._currMousePosX-s._$bodyContent.offset().left,s._connectorPointY=s._currMousePosY-s._$bodyContent.offset().top),e(s._$bodyContainer).bind("mousemove",e.proxy(s.handleMouseMove,s))),!e(c).hasClass("e-parentContainer")||o.hasClass("e-connectorpoint-left")||o.hasClass("e-connectorpoint-right")?s._appendTooltip(o,d):s._allowExpandCollapse&&h&&h.hasChildRecords&&(recordIndex=u.updatedRecords.indexOf(h),s._trigger("cancelEditCell"),u.selectedRowIndex!==recordIndex&&u.allowSelection&&(s._rowSelectingEventTrigger(u.selectedRowIndex,recordIndex)||(s.selectRows(recordIndex),s._rowSelectedEventTrigger(recordIndex))),s._expandCollapse(d)),s._trigger("clearColumnMenu"),!1)},_getParentCollectionPreviousValues:function(e){var i=e,s={},a=[];do parentItem=i.parentItem,t.isNullOrUndefined(parentItem)||(s.left=parentItem.left,s.status=parentItem.status,s.duration=parentItem.duration,s.startDate=parentItem.startDate,s.endDate=parentItem.endDate,s.width=parentItem.width,s.index=parentItem.index,a.push(s),i=parentItem,s={});while(i.parentItem);return a},handleMouseMove:function(e){this._updateOnmouseMove(e)},_handleMouseUp:function(i){var s,a,n,o,r,l,d,h,c,u=this,m={},p=u.getGanttChartRows(),g=0,_=u._posX1,f=u._posY1;t.isNullOrUndefined(i.pageX)?(o=i.originalEvent.changedTouches[0].pageX,r=i.originalEvent.changedTouches[0].pageY):(o=i.pageX,r=i.pageY),(e(i.target).hasClass("e-connectorpoint-left")||e(i.target).hasClass("e-connectorpoint-right"))&&u._falseLine&&!e(i.target).parent().hasClass("e-parentContainer")&&(u._trigger("cancelEditCell"),h=u._secondMouseOverConnectorPoint(i,!0),h.predecessorValidation&&(h.requestType="drawConnectorLine",u._completeAction(h))),null!=u._editingTarget&&null!=u._editingItem&&(s=u._editingTarget,a=s.closest("tr.e-ganttrowcell"),g=p.index(a),n=u._editingItem,e(a).hasClass("e-editmode")&&(e(a).removeClass("e-editmode"),u._mouseTarget=null)),e("#ganttviewerbodyContianer"+u._id).unbind("mousemove"),u._mouseDown=!1,u._clearTooltip(),_!=o||f!=r?(u._editingTarget=null,u._editingItem=null,u._$ganttChartContainer[0].style.cursor="auto",u._allowExpandCollapse=!0,null!=n&&(u._allowDragging||u._leftResizing||u._rightResizing||u._progressResizing)&&(m.editingFields={startdate:n.startDate,enddate:n.endDate,progress:n.status,duration:n.duration},m.data=n,m.previousData=u._prevItem,m.dragging=u._allowDragging,m.leftResizing=u._leftResizing,m.rightResizing=u._rightResizing,m.progressResizing=u._progressResizing,u._taskbarEdited(m)),m.cancel&&(u._getPrevItem(n,g),n.parentItem&&u._getParentPreviousValue(),u.model.predecessorMapping&&(m.dragging||m.rightResizing||m.leftResizing)&&(m.requestType="updateConnectors",m.ganttRecord=n,u._trigger("actionComplete",m))),u._updateEditingType(),u._falseLine&&u._falseLine.remove(),u._falseLine=null,u._predecessorTooltip&&u._predecessorTooltip.remove(),u._predecessorTooltip=null,e(u._leftConnectorPoint).removeClass("e-connectorpoint-hover"),e(u._rightConnectorPoint).removeClass("e-connectorpoint-hover"),e(u._childRightConnectorPoint).removeClass("e-connectorpoint-hover"),e(u._childLeftConnectorPoint).removeClass("e-connectorpoint-hover"),u._leftConnectorPoint=null,u._rightConnectorPoint=null,u._childRightConnectorPoint=null,u._childLeftConnectorPoint=null,u._trigger("clearColumnMenu")):(u._newXYPos=!1,u._$ganttChartContainer[0].style.cursor="auto",u._allowDragging=!1,n&&u.model.enableTaskbarTooltip&&(u._predecessorTooltip&&u._predecessorTooltip.remove(),u._predecessorTooltip=null,l={ttipstartDate:this._getFormatedDate(n.startDate,this.model.dateFormat),ttipendDate:this._getFormatedDate(n.endDate,this.model.dateFormat),ttipduration:n.duration,ttipprogress:n.status.toString(),ttiptaskname:n.taskName},d=t.buildTag("table.e-tooltiptable","",{},{cellspacing:"5"}),u.model.tooltipTemplate||u.model.tooltipTemplateId?u.model.tooltipTemplate?(u._mouseHoverTooltip=t.buildTag("div.e-tooltipgantt#tooltipgantt"+u._id,"",{position:"absolute","z-index":"7","border-radius":"5px"},{}),u.tooltipState="Template",c=t.buildTag("tbody",e.render[u._id+"tooltipTemplate"](n),{},{}),u._mouseHoverTooltip[0].innerHTML=""+c[0].innerHTML+"
      ",u._tooltipTimer=setTimeout(function(){e(document.body).append(u._mouseHoverTooltip),u._updateTooltipPosition(u._mouseHoverTooltip,o,r+20)},300)):u.model.tooltipTemplateId&&(u._mouseHoverTooltip=t.buildTag("div.e-tooltipgantt#tooltipgantt"+u._id,"",{position:"absolute","z-index":"7","border-radius":"5px"},{}),u.tooltipState="TemplateID",c=t.buildTag("tbody",e.render[u._id+"tooltipTemplate"](n),{},{}),u._mouseHoverTooltip[0].innerHTML=""+c[0].innerHTML+"
      ",u._tooltipTimer=setTimeout(function(){e(document.body).append(u._mouseHoverTooltip),u._updateTooltipPosition(u._mouseHoverTooltip,o,r+20)},300)):(u.tooltipState="",c=t.buildTag("tbody",e.render[u._id+"tooltipTemplate"](l),{},{}),d.append(c),u._mouseHoverTooltip=t.buildTag("div.e-tooltipgantt#tooltipgantt"+u._id,d,{position:"absolute","z-index":"7","border-radius":"5px"},{}),u._mouseHoverTooltip.innerHTML=""+d[0].innerHTML+"
      ",u._tooltipTimer=setTimeout(function(){e(document.body).append(u._mouseHoverTooltip),u._updateTooltipPosition(u._mouseHoverTooltip,o,r+20)},300)),e(u._mouseHoverTooltip).addClass("customTooltip"),u._trigger("clearColumnMenu")))},getChildCount:function(e,t){var i,s,a=this;if(!e.hasChildRecords)return 0;for(s=0;s0)&&(e=18),s=lt.length*o.rowHeight&&(l=t.length*o.rowHeight-n._viewportHeight,a&&(l+=e)),n._$bodyContainer.ejScroller("scrollY",l,!0),o.enableVirtualization&&n.element[0].focus())}},getExpandedRecords:function(e){var t=this;return e.filter(function(e){return 1==t._getExpandStatus(e)})},_keyPressed:function(e,t,i,s){var a,n,o=this,r=this.model,l=r.updatedRecords,d=o.getExpandedRecords(l);if(s.stopImmediatePropagation(),s.preventDefault(),!r.allowKeyboardNavigation)return!0;switch(e){case"downArrow":l.length>0&&r.selectedItem&&(lastRowIndex=l.length-1,r.selectedRowIndex!=lastRowIndex&&(a=d.indexOf(r.selectedItem),n=d[a+1],a=l.indexOf(n),n&&a<=lastRowIndex&&!o._rowSelectingEventTrigger(r.selectedRowIndex,a)&&(o.selectRows(a),o.element[0].focus(),o.updateScrollBar(),o._rowSelectedEventTrigger(r.selectedRowIndex))));break;case"upArrow":0!==r.selectedRowIndex&&l.length>0&&r.selectedItem&&(a=d.indexOf(r.selectedItem),n=d[a-1],a=l.indexOf(n),o._rowSelectingEventTrigger(r.selectedRowIndex,a)||(o.selectRows(a),o.element[0].focus(),o.updateScrollBar(),o._rowSelectedEventTrigger(r.selectedRowIndex)));break;case"firstRowSelection":l.length>0&&(o._rowSelectingEventTrigger(r.selectedRowIndex,0)||(o.selectRows(0),o.element[0].focus(),o.updateScrollBar(),o._rowSelectedEventTrigger(0)));break;case"lastRowSelection":l.length>0&&(lastRowIndex=d.length-1,n=d[lastRowIndex],a=l.indexOf(n),o._rowSelectingEventTrigger(r.selectedRowIndex,a)||(o.selectRows(a),o.element[0].focus(),o.updateScrollBar(),o._rowSelectedEventTrigger(a)));break;case"rightArrow":var h,c=o.model.selectedRowIndex,u=o.model.updatedRecords[c],m={};m.data=u,m.recordIndex=c,m.expanded=!0,u&&(o._rowSelectingEventTrigger()||!u.hasChildRecords||u.expanded||(c>=0&&(h=o._trigger("expanding",m)),r.enableVirtualization&&o.element[0].focus()));break;case"leftArrow":var h,c=o.model.selectedRowIndex,u=o.model.updatedRecords[c],m={};m.data=u,m.recordIndex=c,m.expanded=!1,u&&!o._rowSelectingEventTrigger()&&u.hasChildRecords&&u.expanded&&(c>=0&&o._trigger("collapsing",m),r.enableVirtualization&&o.element[0].focus());break;case"deleteRecord":r.editSettings.allowDeleting&&r.selectedRowIndex>=0&&(o._trigger("deleteRow"),o.element[0].focus());break;case"totalRowCollapse":m={},m.requestType="collapseAll",o._trigger("expandAllCollapseAllRequest",m);break;case"totalRowExpand":m={},m.requestType="expandAll",o._trigger("expandAllCollapseAllRequest",m)}return!0},_rowSelectingEventTrigger:function(e,t){var i=this,s=i.model,a={};if("row"==s.selectionMode)return a.previousIndex=e,a.recordIndex=t,i._trigger("rowSelecting",a)},_rowSelectedEventTrigger:function(e){var t,i=this;"row"==i.model.selectionMode&&(t={data:i.model.selectedItem,target:"ejGanttChart",recordIndex:e},i._trigger("rowSelected",t))},_updateEditingType:function(){var e=this;e._leftResizing=!1,e._allowDragging=!1,e._rightResizing=!1,e._progressResizing=!1,e._editPredecessor=!1},_getHolidaysCount:function(e,t){for(var i=this,s=this.model.holidays,a=0,n=0;n=e&&i._getDateFromFormat(s[n].day)<=t&&(a+=1);return a},updateConnectorLineOffset:function(e){var t,i,s,a,n,o,r,l,d,h=this.model,c=e.predecessor,u=[],m=h.includeWeekend;if(c){for(l=0;lt.left+t.width?(r=(o.left-(t.left+t.width))/this.model.perDayWidth,r>=0&&(c[l].offset=Math.round(r))):c[l].offset=0,c[l].offset>0?(m||(d=this._calculateWeekendDays(s,new Date(a)),c[l].offset-=d),c[l].offset-=this._getHolidaysCount(s,a)):c[l].offset<0&&(m||(d=this._calculateWeekendDays(new Date(a),s),c[l].offset+=d),c[l].offset+=this._getHolidaysCount(a,s))),"SS"==c[l].predecessorsType&&(o.leftt.left?(r=(o.left-t.left)/this.model.perDayWidth,c[l].offset=Math.round(r)):c[l].offset=0,c[l].offset>0?(m||(d=this._calculateWeekendDays(i,new Date(a)),c[l].offset-=d),c[l].offset-=this._getHolidaysCount(i,a)):c[l].offset<0&&(m||(d=this._calculateWeekendDays(new Date(a),i),c[l].offset+=d),c[l].offset+=this._getHolidaysCount(a,i))),"SF"==c[l].predecessorsType&&(o.left+o.widtht.left?(r=(o.left+o.width-t.left)/this.model.perDayWidth,c[l].offset=Math.round(r)):c[l].offset=0,c[l].offset>0?(m||(d=this._calculateWeekendDays(i,new Date(n)),c[l].offset-=d),c[l].offset-=this._getHolidaysCount(i,n)):c[l].offset<0&&(m||(d=this._calculateWeekendDays(new Date(n),i),c[l].offset+=d),c[l].offset+=this._getHolidaysCount(n,i))),"FF"==c[l].predecessorsType&&(o.left+o.widtht.left+t.width?(r=(o.left+o.width-(t.left+t.width))/this.model.perDayWidth,c[l].offset=Math.round(r)):c[l].offset=0,c[l].offset>0?(m||(d=this._calculateWeekendDays(s,new Date(n)),c[l].offset-=d),c[l].offset-=this._getHolidaysCount(s,n)):c[l].offset<0&&(m||(d=this._calculateWeekendDays(new Date(n),s),c[l].offset+=d),c[l].offset+=this._getHolidaysCount(n,s))),c[l].offset<0?u.push(c[l].from+""+c[l].predecessorsType+c[l].offset+"d"):c[l].offset>=1?u.push(c[l].from+""+c[l].predecessorsType+"+"+c[l].offset+"d"):u.push(c[l].from+""+c[l].predecessorsType));u.length>0&&(e.item[h.predecessorMapping]=u.join(","))}},_calculateWeekendDays:function(e,t){var i=0;for(e=new Date(e);ea._mousePosX?(a._mousePosX=a.dragPosX-a._mousePosX,s.left>0&&(s.left-=a._mousePosX,s.width+=a._mousePosX)):(a._mousePosX-=a.dragPosX,s.left+30o._mousePosX?(o._mousePosX=o.dragPosX-o._mousePosX,s.left>0&&(s.progressWidth-=o._mousePosX)):(o._mousePosX-=o.dragPosX,s.progressWidth+=o._mousePosX),this.dragPosX=t.isNullOrUndefined(i.originalEvent.pageX)?i.originalEvent.targetTouches[0].pageX:i.originalEvent.pageX,s.progressWidth=s.progressWidth>s.width?s.width:s.progressWidth,s.progressWidth=s.progressWidth<0?0:s.progressWidth,a=s.width-s.progressWidth,n=a<=4?4-a:0,e(o._progressbarItem).css({width:s.progressWidth+"px","border-top-right-radius":n+"px","border-bottom-right-radius":n+"px"}),e(o._progressResizer).css({left:s.left+s.progressWidth-10+"px"}),e(o._progressHandle).addClass("e-progresshandle"),e(o._progressHandleChild).addClass("e-progresshandleafter")},_enableRightResizing:function(i,s){var a=this,n=this.model;i.target.style.cursor="w-resize",e(a._leftResizer).addClass("gripper"),e(a._rightResizer).addClass("gripper"),a.dragPosX>a._mousePosX?(a._mousePosX=a.dragPosX-a._mousePosX,s.left>0&&(s.width-=a._mousePosX)):(a._mousePosX-=a.dragPosX,s.width+=a._mousePosX),this.dragPosX=t.isNullOrUndefined(i.originalEvent.pageX)?i.originalEvent.targetTouches[0].pageX:i.originalEvent.pageX,s.width=n.scheduleHeaderSettings.scheduleHeaderType==t.Gantt.ScheduleHeaderType.Day?s.widtha._mousePosX?(a._mousePosX=a.dragPosX-a._mousePosX,s.left>0&&(s.left-=a._mousePosX)):(a._mousePosX-=a.dragPosX,s.left+=a._mousePosX),this.dragPosX=t.isNullOrUndefined(i.originalEvent.pageX)?i.originalEvent.targetTouches[0].pageX:i.originalEvent.pageX,s.left=s.left<0?0:s.left,e(a._taskbarItem).css({left:s.left+"px"}),e(a._rightResizer).css({left:s.left+s.width-a._resizerRightAdjust+"px"}),e(a._leftResizer).css({left:s.left+2+"px"}),e(a._progressResizer).css({left:s.left+s.progressWidth-10+"px"}),e(a._tasknameContainer).css({left:s.left+"px",width:s.width+"px"}),e(a._leftConnectorPoint).css({left:s.left-a._connectorPointWidth+"px"}),e(a._rightConnectorPoint).css({left:s.left+s.width+"px"})},_appendTooltip:function(i,s){var a,n,o,r,l,d=this,h=e(i),c=this.model,u=d.model.currentViewData[s],m=d.model.columnHeaderTexts,p=d.model.predecessorEditingTexts;null!=u&&(o=h[0],e(h[0]).hasClass("progressbarresizer-right")&&(o=h.closest(".e-childContainer")[0]),(e(o).hasClass("e-parentContainer")||e(o).hasClass("e-childContainer"))&&(d._editingContainer=o,d._leftResizer=d._editingContainer.querySelector(".e-connectorpoint-left"),d._taskbarItem=d._editingContainer.querySelector(".taskbarresizer-left"),d._progressbarItem=d._editingContainer.querySelector(".e-gantt-childtaskbar"),d._progressResizer=d._editingContainer.querySelector(".e-gantt-childtaskbar-progress"),d._rightResizer=d._editingContainer.querySelector(".progressbarresizer-right")),this.model.enableTaskbarDragTooltip&&!h.hasClass("e-parentContainer")&&(1==this._progressResizing?(d._$ganttChartContainer[0].style.cursor="col-resize",n=t.buildTag("table.e-tooltiptable","",{},{cellspacing:"2px",cellpadding:"2px"}),l=t.buildTag("tbody","",{},{}),l[0].innerHTML=""+m.status+" : "+u.status+"%",n.append(l),d.model.progressbarTooltipTemplate?(d._progressBarTooltipID=t.buildTag("div.e-progressbartooltip#progressbartooltip"+d._id,"",{position:"absolute","z-index":"7"},{}),l=t.buildTag("tbody",e.render[d._id+"progressbarTooltipTemplate"](u),{},{}),d._progressBarTooltipID[0].innerHTML=""+l[0].innerHTML+"
      "):d.model.progressbarTooltipTemplateId?(d._progressBarTooltipID=t.buildTag("div.e-progressbartooltip#progressbartooltip"+d._id,"",{position:"absolute","z-index":"7"},{}),l=t.buildTag("tbody",e.render[d._id+"progressbarTooltipTemplate"](u),{},{}),d._progressBarTooltipID[0].innerHTML=""+l[0].innerHTML+"
      "):d._progressBarTooltipID=t.buildTag("div.e-progressbartooltip#progressbartooltip"+d._id,n,{position:"absolute","z-index":"7"},{onselectstart:"return false"}),d._progressBarTooltipID&&(e(document.body).append(d._progressBarTooltipID),d._updateTooltipPosition(d._progressBarTooltipID,d._currMousePosX,d._currMousePosY,!0))):this._editPredecessor===!0&&d.model.enablePredecessorEditing?null===d._predecessorTooltip&&(d._predecessorTooltip=t.buildTag("div.e-tooltipganttpredecessor#predecessortooltip"+d._id,"",{ top:d._currMousePosY+10+"px",left:d._currMousePosX+10+"px",position:"absolute","z-index":"7"},{onselectstart:"return false"}),n=t.buildTag("table.e-tooltiptable","",{},{cellspacing:"2px",cellpadding:"2px"}),l=t.buildTag("tbody","",{},{}),r=""+p.fromText+":"+u.taskName+""+d._prevItem.predecessorTarget+" "+p.toText+":",e(l).html(r),n.append(l),d._predecessorTooltip.append(n),e(document.body).append(d._predecessorTooltip),d._updateTooltipPosition(d._predecessorTooltip,d._currMousePosX,d._currMousePosY)):(1==d._leftResizing||1==d._rightResizing||1==d._allowDragging)&&(1==d._leftResizing?(d._$ganttChartContainer[0].style.cursor="e-resize",a={ttipstartDate:this._getFormatedDate(u.startDate,c.dateFormat),ttipduration:u.duration}):1==d._rightResizing?(d._$ganttChartContainer[0].style.cursor="w-resize",a={ttipendDate:this._getFormatedDate(u.endDate,c.dateFormat),ttipduration:u.duration}):1==d._allowDragging&&(d._$ganttChartContainer[0].style.cursor="move",a={ttipstartDate:this._getFormatedDate(u.startDate,c.dateFormat),ttipendDate:this._getFormatedDate(u.endDate,c.dateFormat)}),n=t.buildTag("table.e-tooltiptable","",{},{cellspacing:"2px",cellpadding:"2px"}),d.model.taskbarEditingTooltipTemplate?(d._taskbarEditingTooltipID=t.buildTag("div.e-editingtooltip#editingtooltip"+d._id,"",{position:"absolute","z-index":"7"},{}),d.tooltipState="editingTemplateID",l=t.buildTag("tbody",e.render[d._id+"editingTooltipTemplate"](u),{},{}),d._taskbarEditingTooltipID[0].innerHTML=""+l[0].innerHTML+"
      "):d.model.taskbarEditingTooltipTemplateId?(d._taskbarEditingTooltipID=t.buildTag("div.e-editingtooltip#editingtooltip"+d._id,"",{position:"absolute","z-index":"7"},{}),d.tooltipState="editingTemplate",l=t.buildTag("tbody",e.render[d._id+"editingTooltipTemplate"](u),{},{}),d._taskbarEditingTooltipID[0].innerHTML=""+l[0].innerHTML+"
      "):(d.tooltipState="",a&&(l=t.buildTag("tbody",e.render[d._id+"editingTooltipTemplate"](a),{},{}),n.append(l)),d._taskbarEditingTooltipID=t.buildTag("div.e-editingtooltip#editingtooltip"+d._id,n,{position:"absolute","z-index":"7"},{})),d._taskbarEditingTooltipID&&(e(document.body).append(d._taskbarEditingTooltipID),d._updateTooltipPosition(d._taskbarEditingTooltipID,d._currMousePosX,d._currMousePosY,!0)))))},_setItemPosition:function(t){var i=this;e(i._leftResizer).css({left:t.left+2+"px"}),e(i._rightResizer).css({left:t.left+t.width-i._resizerRightAdjust+"px"}),e(i._taskbarItem).css({left:t.left+"px",width:t.width+"px"}),e(i._progressbarItem).css({width:t.progressWidth+"px"}),e(i._progressResizer).css({left:t.left+t.progressWidth-10+"px"}),e(i._tasknameContainer).css({left:t.left+"px",width:t.width+"px"}),e(i._leftConnectorPoint).css({left:t.left-i._connectorPointWidth+"px"}),e(i._rightConnectorPoint).css({left:t.left+t.width+"px"})},_getTemplate:function(t){var i,s;return"object"!=typeof t?(i=e.parseHTML(this.model.tooltipTemplate),i[0]):(s=e(t)[0].innerHTML,i=e.parseHTML(s),i[1])},_updateOnmouseMove:function(i){var s,a=this,n={},o=a._editingTarget?a._editingTarget:null,r=a.getGanttChartRows(),l=o?o.closest("tr.e-ganttrowcell"):null,d=r.index(l),h=a._editingItem,c=o?o[0].parentNode:null;a._newXYPos=!0,c=e(c).hasClass("progressbarresizer-right")?c.parentNode:e(c).hasClass("e-gantt-childtaskbar-progress")?e(c).closest("div.e-childContainer")[0]:e(c).hasClass("progressbarhandler")?o.closest(".e-childContainer")[0]:e(c).closest("div.e-childContainer,div.e-parentContainer,.e-gantt-milestone,div.e-gantt-milestone-container")[0],null!=h&&(a._trigger("cancelEditCell"),n.editingFields={startdate:h.startDate,enddate:h.endDate,progress:h.status,duration:h.duration},n.rowData={rowData:h},a._taskbarEditing(n),n.cancel||(i||(i=window.event),"msie"==t.browserInfo().name&&t.browserInfo().version<9&&(i.originalEvent.pageX=i.originalEvent.clientX,i.originalEvent.pageY=i.originalEvent.clientY),i.originalEvent.pageX||i.originalEvent.pageY?(a._mousePosX=i.originalEvent.pageX,s=i.originalEvent.pageY):i.originalEvent.clientX||i.originalEvent.clientY?(a._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)&&(a._mousePosX=i.originalEvent.targetTouches[0].pageX,s=i.originalEvent.targetTouches[0].pageY),o.hasClass("e-gantt-milestone")||e(c).hasClass("e-gantt-milestone")?e(l).hasClass("e-editmode")&&this._editMilestone(i):(e(c).hasClass("e-childContainer")&&(a._editingContainer=c,a._leftResizer=a._editingContainer.querySelector(".taskbarresizer-left"),a._taskbarItem=a._editingContainer.querySelector(".e-gantt-childtaskbar"),a._progressbarItem=a._editingContainer.querySelector(".e-gantt-childtaskbar-progress"),a._progressResizer=a._editingContainer.querySelector(".progressbarresizer-right"),a._rightResizer=a._editingContainer.querySelector(".taskbarresizer-right"),a.model.predecessorMapping&&a.model.enablePredecessorEditing&&(a._leftConnectorPoint=c.querySelector(".e-connectorpoint-left"),a._rightConnectorPoint=c.querySelector(".e-connectorpoint-right"),e(a._leftConnectorPoint).addClass("e-connectorpoint-hover"),e(a._rightConnectorPoint).addClass("e-connectorpoint-hover"))),e(l).hasClass("e-editmode")&&(e(c).hasClass("e-parentContainer")||e(c).hasClass("e-gantt-milestone-container")||e(c).hasClass("e-childContainer"))&&(1==a._leftResizing?(a._enableLeftResizing(i,h),a._updateEditedItem(h,"leftResizing")):1==a._progressResizing&&a.model.enableProgressBarResizing&&a.model.progressMapping?((a._editingTarget.hasClass("e-progresshandlerafter-element")||a._editingTarget.hasClass("progressbarhandler e-progresshandle")||a._editingTarget.hasClass("e-progresshandler-element")||a._editingTarget.hasClass("progressbarresizer-right"))&&a._editingTarget.prev(".e-gantt-childtaskbar").find(".e-tasklabel").text(""),a._enableProgressResizing(i,h),a._updateEditedItem(h,"progressResizing")):1==a._rightResizing?(a._enableRightResizing(i,h),a._updateEditedItem(h,"rightResizing")):1==a._allowDragging?(a._enableDragging(i,h),a._updateEditedItem(h,"dragging")):1==a._editPredecessor&&a._drawFalseLine(i,h))),a._clearTooltip(),a._appendTooltip(o,d)))},_editMilestone:function(i){var s=this,a=s._editingTarget,n=a.hasClass("milestone-top")||a.hasClass("milestone-bottom")?a[0].parentNode:a.closest(".e-gantt-milestone"),o=s.getGanttChartRows(),r=a.closest("tr.e-ganttrowcell"),l=o.index(r),d=s._editingItem;null!=d&&(i||(i=window.event),i.originalEvent.pageX||i.originalEvent.pageY?s._mousePosX=i.originalEvent.pageX:i.originalEvent.clientX||i.originalEvent.clientY?s._mousePosX=i.originalEvent.clientX+document.body.scrollLeft+document.documentElement.scrollLeft:(i.originalEvent.touches[0].pageX||i.originalEvent.touches[0].pageY)&&(s._mousePosX=i.originalEvent.targetTouches[0].pageX,posy=i.originalEvent.targetTouches[0].pageY),i.target.style.cursor="move",s.dragPosX>s._mousePosX?(s._mousePosX=s.dragPosX-s._mousePosX,d.left>0&&(d.left-=s._mousePosX)):(s._mousePosX-=s.dragPosX,d.left+=s._mousePosX),this.dragPosX=t.isNullOrUndefined(i.originalEvent.pageX)?i.originalEvent.targetTouches[0].pageX:i.originalEvent.pageX,d.left=d.left<0?0:d.left,e(n).css({left:d.left+"px"}),e(s._leftConnectorPoint).css({left:d.left-s._connectorPointWidth+"px"}),e(s._rightConnectorPoint).css({left:d.left+s._milesStoneWidth+"px"}),s._updateEditedItem(d,"dragging"),s._appendTooltip(a,l))},_updateEditedItem:function(e,i){var s,a,n,o,r,l,d,h,c,u,m,p,g,_,f,b,v,x=this,w=x.model,y=w.scheduleHeaderSettings.scheduleHeaderType,C=t.Gantt.ScheduleHeaderType,S=t.Gantt.DurationUnit,T=e._getFormatedDate(w.projectStartDate,w.dateFormat),T=e._getDateFromFormat(T,w.dateFormat);e.startDate.getHours(),e.startDate.getMinutes();switch(i){case"dragging":s=e.left%w.perDayWidth,a=(e.left-s)/w.perDayWidth,n=0,s>0&&w.workingTimeScale!=t.Gantt.workingTimeScale.TimeScale24Hours&&(n=y==C.Day?s>w.perDayWidth/2+3*w.perHourWidth?1:0:s>=w.perDayWidth/2?1:0),_=Math.round(s/(w.perDayWidth/24)),d=Math.round(s/w.perMinuteWidth),y==C.Day||y==C.Week?(T.setDate(T.getDate()+a+n),w.workingTimeScale==t.Gantt.workingTimeScale.TimeScale24Hours?w.durationUnit==S.Minute&&w.dateFormat.indexOf("hh:")!=-1?T.setMinutes(d):w.durationUnit==S.Hour&&w.dateFormat.indexOf("hh:")!=-1&&T.setHours(_):(T.setHours(_),T.getHours()>8&&T.getHours()<16?T.setHours(_):T.setHours(8))):y==C.Hour?(d=s/(w.perDayWidth/1440),T.setMinutes(d),T.setDate(T.getDate()+a+n)):w.dateFormat.indexOf("hh:")!==-1&&w.workingTimeScale==t.Gantt.workingTimeScale.TimeScale8Hours?(_=Math.round(s/(w.perDayWidth/9)),T.setHours(8+_),T.setDate(T.getDate()+a+n)):(T.setDate(T.getDate()+a+n),w.durationUnit==S.Hour?T.setHours(_):w.durationUnit==S.Minute&&T.setMinutes(d)),e.startDate=new Date(T),e._calculateEndDate(w.includeWeekend,w.holidays,w,w.perDayWidth,i),w.startDateMapping&&(e.item[w.startDateMapping]=e.startDate),w.endDateMapping&&(e.item[w.endDateMapping]=e.endDate);break;case"leftResizing":h="Resizing",s=e.left%w.perDayWidth,a=(e.left-s)/w.perDayWidth,n=0,s>0&&w.workingTimeScale!=t.Gantt.workingTimeScale.TimeScale24Hours&&(n=y==C.Day?s>w.perDayWidth/2+3*w.perHourWidth?1:0:s>=w.perDayWidth/2?1:0),_=Math.round(s/(w.perDayWidth/24)),d=Math.round(s/w.perMinuteWidth),T.setDate(T.getDate()+a+n),y==C.Day||y==C.Week&&w.dateFormat.indexOf("hh")!=-1?w.workingTimeScale==t.Gantt.workingTimeScale.TimeScale24Hours?w.durationUnit==S.Minute?T.setMinutes(d):w.durationUnit==S.Hour&&T.setHours(_):_>=8&&_<=15?T.setHours(_):(T.setDate(T.getDate()-1),T.setHours(15)):y==C.Hour?(d=s/(w.perDayWidth/1440),T.setMinutes(d)):w.dateFormat.indexOf("hh:")!==-1&&w.workingTimeScale==t.Gantt.workingTimeScale.TimeScale8Hours?(_=Math.round(s/(w.perDayWidth/9)),T.setHours(8+_)):w.durationUnit==S.Hour?T.setHours(_):w.durationUnit==S.Minute&&T.setMinutes(d),e.startDate=new Date(T),e._calculateDuration(T,new Date(e.endDate),w.includeWeekend,w.holidays,!1,w),e.startDate.getTime()==e.endDate.getTime()&&t.isNullOrUndefined(e.isMilestone)&&0==e.isMilestone&&0==e.duration&&(e.duration=1),w.startDateMapping&&(e.item[w.startDateMapping]=e.startDate),w.durationMapping&&(e.item[w.durationMapping]=e.duration);break;case"rightResizing":h="Resizing",a=e.width/w.perDayWidth,o=e.width%w.perDayWidth,r=new Date(e.startDate),n=0,o>0&&"TimeScale24Hours"!=w.workingTimeScale&&(n=y==C.Day?o>w.perDayWidth/2+3*w.perHourWidth?1:0:o>=w.perDayWidth/2?1:0);var D=e.left+e.width,I=D%w.perDayWidth,_=Math.round(I/(w.perDayWidth/24)),d=Math.round(I/(w.perDayWidth/1440));if(y==C.Day&&w.dateFormat.indexOf("hh")==-1){var p=e.left%w.perDayWidth/w.perHourWidth,k=(e.left+e.width)%w.perDayWidth/w.perHourWidth,m=Math.round(I%w.perHourWidth);l=a<1?e._dateUpdate(r,0,k):e._dateUpdate(r,Math.ceil(a-1+n),k),r.setHours(p)}else y==C.Week?(p=e.left/(w.perDayWidth/24),m=D/(w.perDayWidth/24),m-=p,c=a+n,c=Math.floor(c),w.dateFormat.indexOf("hh")!=-1?w.durationUnit==S.Hour?l=e._dateUpdate(r,0,m,d%(60*m)):w.durationUnit==S.Minute?l=e._dateUpdate(r,c,0,d):w.durationUnit==S.Day&&w.roundOffDayworkingTime?(r.setHours(0),r.setMinutes(0),l=e._dateUpdate(r,c,0,0)):l=e._dateUpdate(r,c,0):l=e._dateUpdate(r,a-1+n,0)):y==C.Hour&&w.dateFormat.indexOf("hh")!=-1?(p=Math.round(e.left%w.perDayWidth/(w.perDayWidth/1440)),u=Math.round(D/(w.perDayWidth/1440)),u-=p,u%=1440,l=e._dateUpdate(r,a,0,u)):y==C.Day&&w.dateFormat.indexOf("hh")!=-1?w.durationUnit==S.Hour?(p=e.left/w.perHourWidth,m=Math.round(D/w.perHourWidth),m-=p,l=e._dateUpdate(r,0,m)):(p=e.left/w.perMinuteWidth,g=Math.round(D/w.perMinuteWidth),g-=p,l=e._dateUpdate(r,0,0,g)):l=w.durationUnit==S.Hour&&w.dateFormat.indexOf("hh")!=-1?e._dateUpdate(r,a-1+n,_):w.durationUnit==S.Minute&&w.dateFormat.indexOf("hh")!=-1?e._dateUpdate(r,a+n,0,d):e._dateUpdate(r,a+n,0);if(y==C.Day||y==C.Week&&w.dateFormat.indexOf("hh")!=-1?w.workingTimeScale!=t.Gantt.workingTimeScale.TimeScale24Hours&&(w.durationUnit==S.Hour?(l.setHours(Math.round(_)),l.getHours()>16?l.setHours(Math.round(33)):l.getHours()<8&&l.setHours(Math.round(9))):l.setHours(17)):w.dateFormat.indexOf("hh:")!=-1&&w.workingTimeScale==t.Gantt.workingTimeScale.TimeScale8Hours&&(_=Math.round(I/(w.perDayWidth/9)),l.setHours(Math.round(8+_))),e.endDate=new Date(l),w.holidays&&w.holidays.length)for(f=0,b=w.holidays.length,f=0;f0){var n=this,o=n._getOffsetRect(n._$bodyContainer[0]),r=o.top+n._$bodyContainer.height(),l=o.left+n._$bodyContainer.width(),d=n.model.rowHeight;t+e.width()+d>l?(a=t-e.width()-d,e.css("left",a+"px")):s?e.css("left",t+"px"):e.css("left",t+15+"px"),s||i+e.height()+d>r?(a=i-e.height()-d,e.css("top",a+"px")):e.css("top",i+10+"px")}},_mouseHover:function(i){var s,a,n,o,r,l=e(i.target),d=this,h=0,c=0,u=d.getGanttChartRows(),m=l.closest("tr.e-ganttrowcell"),p=l[0].parentNode,g=u.index(m),_=d.model.currentViewData[g];return"e-parentContainer"==i.target.className||"e-gantt-milestone-container"==i.target.className||"e-childContainer"==i.target.className||(p=e(p).hasClass("e-gantt-childtaskbar-progress")?e(p).closest("div.e-childContainer")[0]:l.hasClass("e-tasklabel")?l.closest(".e-childContainer")[0]:e(p).closest("div.e-childContainer,div.e-parentContainer,.e-gantt-milestone,div.e-gantt-milestone-container")[0],d._clearTooltip(),d._newXYPos||(d._newXYPos=!0,d._mouseLeave()),void(0==d._rightResizing&&0==d._leftResizing&&0==d._progressResizing&&0==d._mouseDown&&(d.model.allowGanttChartEditing&&(l.is(".e-gantt-childtaskbar,.e-tasklabel")||l.closest(".e-gantt-childtaskbar").length)&&(i.target.style.cursor="move"),("mouseenter"==i.type||"mousemove"==i.type||"touchstart"==i.type)&&(i||(i=window.event),"msie"==t.browserInfo().name&&t.browserInfo().version<9&&(i.originalEvent.pageX=i.originalEvent.clientX,i.originalEvent.pageY=i.originalEvent.clientY),i.originalEvent.pageX||i.originalEvent.pageY?(h=i.originalEvent.pageX,c=i.originalEvent.pageY):i.originalEvent.clientX||i.originalEvent.clientY?(h=i.originalEvent.clientX+document.body.scrollLeft+document.documentElement.scrollLeft,c=i.originalEvent.clientY+document.body.scrollTop+document.documentElement.scrollTop):i.originalEvent&&i.originalEvent.changedTouches&&i.originalEvent.changedTouches.length>0&&(h=i.originalEvent.changedTouches[0].pageX,c=i.originalEvent.changedTouches[0].pageY),d._posX1=h,d._posY1=c,e(p).hasClass("e-childContainer")&&d.model.allowGanttChartEditing&&(d._leftResizerGripper=p.querySelector(".taskbarresizer-left"),d._rightResizerGripper=p.querySelector(".taskbarresizer-right"),s=p.querySelector(".progressbarresizer-right"),d._progressHandle=s&&s.firstChild,d._progressHandleChild=s&&s.childNodes[1],e(d._leftResizerGripper).addClass("gripper"),e(d._rightResizerGripper).addClass("gripper"),d.model.progressMapping&&(e(d._progressHandle).addClass("e-progresshandle"),e(d._progressHandleChild).addClass("e-progresshandleafter"))),e(p).hasClass("e-childContainer")&&d.model.predecessorMapping&&d.model.allowGanttChartEditing&&d.model.enablePredecessorEditing?(d._leftConnectorPoint=p.querySelector(".e-connectorpoint-left"),d._rightConnectorPoint=p.querySelector(".e-connectorpoint-right"),e(d._leftConnectorPoint).addClass("e-connectorpoint-hover"),e(d._rightConnectorPoint).addClass("e-connectorpoint-hover")):(e(p).hasClass("e-gantt-milestone")||e(p).hasClass("e-gantt-milestone-container"))&&d.model.predecessorMapping&&d.model.allowGanttChartEditing&&d.model.enablePredecessorEditing&&(o=p.parentNode,d._leftConnectorPoint=o.querySelector(".e-connectorpoint-left"),d._rightConnectorPoint=o.querySelector(".e-connectorpoint-right"),e(d._leftConnectorPoint).addClass("e-connectorpoint-hover"),e(d._rightConnectorPoint).addClass("e-connectorpoint-hover")),_&&d.model.enableTaskbarTooltip&&!t.isTouchDevice()&&(a={ttipstartDate:this._getFormatedDate(_.startDate,this.model.dateFormat),ttipendDate:this._getFormatedDate(_.endDate,this.model.dateFormat),ttipduration:_.duration,ttipprogress:_.status.toString(),ttiptaskname:_.taskName},n=t.buildTag("table.e-tooltiptable","",{},{cellspacing:"5"}),d.model.tooltipTemplate||d.model.tooltipTemplateId?d.model.tooltipTemplate?(d._mouseHoverTooltip=t.buildTag("div.e-tooltipgantt#tooltipgantt"+d._id,"",{position:"absolute","z-index":"7","border-radius":"5px"},{}),d.tooltipState="Template",r=t.buildTag("tbody",e.render[d._id+"tooltipTemplate"](_),{},{}),d._mouseHoverTooltip[0].innerHTML=""+r[0].innerHTML+"
      ",d._tooltipTimer=setTimeout(function(){e(document.body).append(d._mouseHoverTooltip),d._updateTooltipPosition(d._mouseHoverTooltip,h,c)},700)):d.model.tooltipTemplateId&&(d._mouseHoverTooltip=t.buildTag("div.e-tooltipgantt#tooltipgantt"+d._id,"",{position:"absolute","z-index":"7","border-radius":"5px"},{}),d.tooltipState="TemplateID",r=t.buildTag("tbody",e.render[d._id+"tooltipTemplate"](_),{},{}),d._mouseHoverTooltip[0].innerHTML=""+r[0].innerHTML+"
      ",d._tooltipTimer=setTimeout(function(){e(document.body).append(d._mouseHoverTooltip),d._updateTooltipPosition(d._mouseHoverTooltip,h,c)},700)):(d.tooltipState="",r=t.buildTag("tbody",e.render[d._id+"tooltipTemplate"](a),{},{}),n.append(r),d._mouseHoverTooltip=t.buildTag("div.e-tooltipgantt#tooltipgantt"+d._id,n,{position:"absolute","z-index":"7","border-radius":"5px"},{}),d._mouseHoverTooltip.innerHTML=""+n[0].innerHTML+"
      ",d._tooltipTimer=setTimeout(function(){e(document.body).append(d._mouseHoverTooltip),d._updateTooltipPosition(d._mouseHoverTooltip,h,c)},700)),e(d._mouseHoverTooltip).addClass("customTooltip"))))))},_createEditingTooltipTemplate:function(){var t,i,s,a=this,n=a.model.columnHeaderTexts,o=a.model.durationUnitTexts,r={_getStartDate:a._tooltipStartDate,_getEndDate:a._tooltipEndDate,_getDuration:a._tooltipDuration,_getTaskName:a._tooltipTaskName,_getProgress:a._tooltipProgress},l=a._getDurationUnits(),d=a.model.taskbarEditingTooltipTemplateId,h=a.model.taskbarEditingTooltipTemplate;e.views.helpers(r),d?i=e("#"+d)[0].innerHTML:h?i=h:(i="",t="{{if ~_getTaskName()}}{{:ttiptaskname}}{{/if}}{{if ~_getStartDate()}}"+n.startDate+":{{:ttipstartDate}} {{/if}}{{if ~_getEndDate()}}"+n.endDate+":{{:ttipendDate}}{{/if}}{{if ~_getDuration()}}"+n.duration+":{{:ttipduration}} "+o[l]+"{{/if}}{{if ~_getProgress()}}"+n.status+":{{:ttipprogress}}%{{/if}}",i+=t,i+=""),s={},s[a._id+"editingTooltipTemplate"]=i,e.templates(s)},_createProgressbarTooltipTemplate:function(){var t,i,s=this,a=s.model.progressbarTooltipTemplateId;s.model.progressbarTooltipTemplate;a?t=e("#"+s.model.progressbarTooltipTemplateId)[0].innerHTML:s.model.progressbarTooltipTemplate&&(t=s.model.progressbarTooltipTemplate),i={},i[s._id+"progressbarTooltipTemplate"]=t,e.templates(i)},_createTooltipTemplate:function(){var t,i,s,a=this,n=a.model.columnHeaderTexts,o=a.model.durationUnitTexts,r={_getStartDate:a._tooltipStartDate,_getEndDate:a._tooltipEndDate,_getDuration:a._tooltipDuration,_getTaskName:a._tooltipTaskName,_getProgress:a._tooltipProgress,_getDurationUnit:a._getDurationUnits},l=a._getDurationUnits(),d=a.model.tooltipTemplateId;a.model.tooltipTemplate;e.views.helpers(r),d?i=e("#"+a.model.tooltipTemplateId)[0].innerHTML:a.model.tooltipTemplate?i=a.model.tooltipTemplate:(i="",t="{{if ~_getTaskName()}}{{:ttiptaskname}}{{/if}}{{if ~_getStartDate()}}"+n.startDate+":{{:ttipstartDate}} {{/if}}{{if ~_getEndDate()}}"+n.endDate+":{{:ttipendDate}}{{/if}}{{if ~_getDuration()}}"+n.duration+":{{:ttipduration}} "+o[l]+"{{/if}}{{if ~_getProgress()}}"+n.status+":{{:ttipprogress}}%{{/if}}",i+=t,i+=""),s={},s[a._id+"tooltipTemplate"]=i,e.templates(s)},_tooltipTaskName:function(){return this.data.ttiptaskname},_tooltipProgress:function(){return this.data.ttipprogress},_tooltipStartDate:function(){return this.data.ttipstartDate},_tooltipEndDate:function(){return this.data.ttipendDate},_tooltipDuration:function(){return this.data.ttipduration},_getDurationUnits:function(){var e=this;return e.model.durationUnit==t.Gantt.DurationUnit.Hour?"hours":e.model.durationUnit==t.Gantt.DurationUnit.Minute?"minutes":"days"},_cellClickHandler:function(t){var i,s,a=e(t.target),n=a.closest("tr.e-ganttrowcell"),o=this,r=this.model,l=o.getGanttChartRows();if(s=l.index(a.parent()),s==-1&&(s=l.index(n)),s!=-1&&r.allowSelection){if(i=r.currentViewData[s],s=r.updatedRecords.indexOf(i),"row"==r.selectionMode){if(o._rowSelectingEventTrigger(r.selectedRowIndex,s))return;o.selectRows(s),o.element[0].focus(),o._rowSelectedEventTrigger(s)}"cell"==r.selectionMode&&(o.model.selectedItem=i)}},getRowByIndex:function(i,s){var a,n;try{var o=this,r=o.getGanttChartRows(),l=e(r);e();return o.model.enableVirtualization&&(a=o.model.updatedRecords[i],i=o.model.currentViewData.indexOf(a)),t.isNullOrUndefined(s)?(o.model.enableVirtualization&&(n=o.model.updatedRecords[s],s=o.model.currentViewData.indexOf(n)),e(r[i])):e(l.slice(i,s))}catch(t){return e()}},selectRows:function(e){var t,i,s=this,a=s.getGanttChartRows();model.allowSelection&&"cell"!=model.selectionMode&&(s.prevSelectedItem&&(s.prevSelectedItem.isSelected=!1),a.removeClass("e-gantt-mouseclick"),i=s.getRowByIndex(e),s.model.allowSelection&&i.addClass("e-gantt-mouseclick"),s.model.selectedRowIndex=e,t=s.model.updatedRecords[e],t&&(t.isSelected=!0),s.model.selectedItem=t,s.prevSelectedItem=t)},updateSelectedItem:function(t){var i=this,s=e(i.getGanttChartRows());s.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 i,s=this;s.model.enableRowHover&&(i=s.getGanttChartRows(),i.removeClass("e-gantt_mousehover").addClass("e-gantt_mouseleave"),e(i[t]).addClass("e-gantt_mousehover").removeClass("e-gantt_mouseleave"))},_rowHover:function(t){var i,s,a,n=this,o=e(t.target),r={};return!!n.model.enableRowHover&&(i=e(n.getGanttChartRows()),s=i.index(o.parent()),s==-1&&(a=o.closest("tr.e-ganttrowcell"),s=i.index(a)),r.index=s,"mouseenter"==t.type?(r.reason="mouseenter",n.addRowHover(s)):(r.reason="mouseleave",n.removeRowHover()),n._trigger("rowHover",r),!1)},addRowHover:function(t){var i=this.getGanttChartRows();null!=t&&t!=-1&&e(i[t]).addClass("e-enablerowhover")},removeRowHover:function(){var e=this.getGanttChartRows();e.removeClass("e-enablerowhover")},updateHeight:function(i){var s,a=this,n=a.model;a._setScrollTop(),a._containerHeight=i,e("#ganttviewerbodyContent"+a._id).css({height:a._containerHeight+"px"}),n.stripLines&&e(a.element).find(".e-stripline,.e-stripLines").css({height:i+"px"}),n.holidays&&e(a.element).find(".e-holidays,.e-holiday").css({height:i+"px"}),e(".e-secondary_canvas").css({height:i+"px"}),e(a.element).find(".e-weekends").css({height:i+"px"}),s=".e-holiday-label","msie"==t.browserInfo().name&&t.browserInfo().version<9&&(s=".e-holiday-label-ie8"),i0&&(s=e(m).find(".e-gantt-milestone-container").closest("div")[0]),e(m).find(".e-baselinebar").closest("div").length>0&&(a=e(m).find(".e-baselinebar").closest("div")[0]),e(m).find(".e-parentContainer").closest("div").length>0){var i=e(m).find(".e-parentContainer").closest("div")[0],p=i.querySelector(".e-gantt-parenttaskbar-innerdiv"),g=i.querySelector(".e-gantt-parenttaskbar-progress"),_=p.style,f=g&&g.style;_.backgroundColor!=t.parentTaskbarBackground&&(_.backgroundColor=t.parentTaskbarBackground),f&&f.backgroundColor!=t.parentProgressbarBackground&&(f.backgroundColor=t.parentProgressbarBackground),_.borderColor!=t.parentTaskbarBorder&&(_.borderColor=t.parentTaskbarBorder),f&&f.borderColor!=t.parentProgressbarBorder&&(f.borderColor=t.parentProgressbarBorder)}else if(e(m).find(".e-childContainer").closest("div").length>0){var i=e(m).find(".e-childContainer").closest("div")[0],b=i.querySelector(".e-gantt-childtaskbar"),v=i.querySelector(".e-gantt-childtaskbar-progress"),x=b.style,w=v&&v.style,y=v&&v.querySelector(".e-tasklabel"),C=y&&y.style;x.backgroundColor!=t.taskbarBackground&&(x.backgroundColor=t.taskbarBackground),v&&w.backgroundColor!=t.progressbarBackground&&(w.backgroundColor=t.progressbarBackground),x.borderColor!=t.taskbarBorder&&(x.borderColor=t.taskbarBorder),v&&w.borderColor!=t.progressbarBorder&&(w.borderColor=t.progressbarBorder),C&&C.color!=t.taskbarTextColor&&(C.color=t.taskbarTextColor)}e(s).length>0&&(n=s.querySelector(".e-gantt-milestone.milestone-top"),o=s.querySelector(".e-gantt-milestone.milestone-bottom"),n&&o?(r=n.style,l=o.style,l.borderBottomColor!=t.milestoneBackground&&r.borderTopColor!=t.milestoneBackground&&(l.borderTopColor=t.milestoneBackground,r.borderBottomColor=t.milestoneBackground)):this.model.milestoneTemplate&&(d=s.querySelector(".e-gantt-milestone"),d.style.backgroundColor!=t.milestoneBackground&&(d.style.backgroundColor=t.milestoneBackground))),e(a).hasClass("e-baselinebar")&&(h=a.style,h.backgroundColor!=t.baselineBackground&&(h.backgroundColor=t.baselineBackground))}},_expandCollapse:function(e){var t=this,i={},s=t.model.currentViewData[e];i.data=s,i.recordIndex=t.model.updatedRecords&&t.model.updatedRecords.indexOf(s),i.source="ganttChart",i.expanded=!s.expanded,s&&(i.expanded?t._trigger("expanding",i):t._trigger("collapsing",i))},_getExpandStatus:function(e){var t=e.parentItem;return null==t||t.expanded!==!1&&(!t.parentItem||t.parentItem.expanded!==!1&&this._getExpandStatus(t.parentItem))},onScrollHelper:function(e,t){var i,s,a=this;return!!a._$bodyContainer.ejScroller("isVScroll")&&(a._mouseLeave(),t||a._$bodyContainer.ejScroller("option","scrollTop",e),i=parseInt(a.model.updatedRecords.length*a.model.rowHeight)-(a._viewportHeight-18),e>i&&(e=i),e<0&&(e=0),s={scrollTop:e},void a._handleScroll(s))},_handleScroll:function(e){var t,s,a=this,e=e||{},n=a._$headerContainer,o=(a._$bodyContainer,a._prevLeft);e.scrollTop!==i&&(a._scrollTop=e.scrollTop),e.scrollLeft!==i&&(o=e.scrollLeft),t=o-a._prevLeft,s=a._scrollTop-a._prevScrollTop,t?n.scrollLeft(o):n.scrollLeft(a._prevLeft), a.model.enableVirtualization&&(a._vscrollDist=Math.abs(a._scrollTop-a._prevScrollTop),a._vscrollDist&&(a._vScrollDir=a._prevScrollTop<=a._scrollTop?1:-1,a._updateCurrentViewData(),a.renderGanttRecords(),a._prevScrollTop=a._scrollTop)),e.requestType="scroll",e.delta=a._scrollTop,a._prevLeft=o,a._prevScrollTop=a._scrollTop,0===t&&0!==s&&a._completeAction(e)},refreshHelper:function(e,t,s){var a=this;a.model.currentViewData=e,a.model.updatedRecords=t,a._totalCollapsedRecordCount=s!=i?s:0,t&&(a._refresh(),a._setHeight(t.length*a.model.rowHeight),a.updateHeight((t.length-a._totalCollapsedRecordCount)*a.model.rowHeight))},_setScrollTop:function(){var e,t=this,i=this.model,s=t._scrollTop;i.enableVirtualization&&0!==s&&t.model.currentViewData.length*t.model.rowHeight0&&(l=e(i).find(".e-gantt-milestone-container").closest("div")[0]),e(i).find(".e-baselinebar").closest("div").length>0&&(h=e(i).find(".e-baselinebar").closest("div")[0]),e(r).hasClass("e-parentContainer")?(o=r.querySelector(".e-connectorpoint-left"),n=r.querySelector(".e-gantt-parenttaskbar-innerdiv")):e(r).hasClass("e-childContainer")&&(a=r.querySelector(".e-gantt-childtaskbar"),s=r.querySelector(".e-gantt-childtaskbar-progress"),d=s&&s.querySelector(".e-tasklabel")),u.data=this.model.currentViewData[t],u.taskbar=i,u.taskbarBackground=null!=a?a.style.backgroundColor:null,u.progressbarBackground=null!=s?s.style.backgroundColor:null,u.parentTaskbarBackground=null!=o?o.style.backgroundColor:null,u.parentProgressbarBackground=null!=n?n.style.backgroundColor:null,u.parentProgressbarBorder=null!=n?n.style.border:null,u.progressbarBorder=null!=s?s.style.border:null,u.taskbarBorder=null!=a?a.style.border:null,u.parentTaskbarBorder=null!=o?o.style.border:null,u.taskbarTextColor=null!=d?d.style.color:null,u.baselineBackground=null!=h?h.style.backgroundColor:null,u.milestoneBackground=null!=l?l.style.backgroundColor:null,this._queryTaskbarinfo(u))},refreshScroller:function(e){var t,i,s,a,n,o=this;o._$bodyContainer.find("div.e-content").removeClass("e-borderbox"),i=o._$bodyContainer.ejScroller("option","scrollTop"),s=o._$bodyContainer.ejScroller("option","scrollLeft"),o._$bodyContainer.ejScroller("option",{width:e}),o._$bodyContainer.ejScroller("refresh"),t=o.getMaxScrollWidth(),s>t&&(s=t>0?t:0),a=o._$bodyContainer.ejScroller("isHScroll"),a?o._$bodyContainer.find("div.e-content").removeClass("e-borderbox"):o._$bodyContainer.find("div.e-content").addClass("e-borderbox"),n=o._$bodyContainer.ejScroller("isVScroll"),n&&o._$bodyContainer.ejScroller("scrollY",i,!0),o._$bodyContainer.ejScroller("option","scrollLeft",s),o._$headerContainer.scrollLeft(s)},getMaxScrollWidth:function(){var e=this;return e._$bodyContainer.children(".e-content").children().width()-e._$bodyContainer.children(".e-content").width()},refreshStripLines:function(e){var t=this;e&&(this.model.stripLines=e),t._$stripLineContainer.empty(),this._renderStripLines(this.model.stripLines)},refreshHolidays:function(e){var t,i,s=this;if(e&&(s.model.holidays=e),s._$secondaryCanvas.empty(),null!=s.model.holidays)for(t=s.model.holidays.length,i=0;i0&&(r=e(t).find(".e-gantt-milestone-container").closest("div")[0]),e(t).find(".e-baselinebar").closest("div").length>0&&(d=e(t).find(".e-baselinebar").closest("div")[0]),e(o).hasClass("e-parentContainer")?(n=o.querySelector(".e-connectorpoint-left"),a=o.querySelector(".e-gantt-parenttaskbar-innerdiv")):e(o).hasClass("e-childContainer")&&(s=o.querySelector(".e-gantt-childtaskbar"),i=o.querySelector(".e-gantt-childtaskbar-progress"),l=i&&i.querySelector(".e-tasklabel")),m.data=this.model.currentViewData[h],m.taskbar=t,m.taskbarBackground=null!=s?s.style.backgroundColor:null,m.progressbarBackground=null!=i?i.style.backgroundColor:null,m.parentTaskbarBackground=null!=n?n.style.backgroundColor:null,m.parentProgressbarBackground=null!=a?a.style.backgroundColor:null,m.parentProgressbarBorder=null!=a?a.style.border:null,m.progressbarBorder=null!=i?i.style.border:null,m.taskbarBorder=null!=s?s.style.border:null,m.parentTaskbarBorder=null!=n?n.style.border:null,m.taskbarTextColor=null!=l?l.style.color:null,m.baselineBackground=null!=d?d.style.backgroundColor:null,m.milestoneBackground=null!=r?r.style.backgroundColor:null,this._queryTaskbarinfo(m))},_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),0!==t._vscrollDist&&(i=t._scrollTop-t._rowMargin),e("#ganttViewTable"+t._id).css({top:i+"px"}),e("#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 e=this;e._refresh(),e._$ganttViewTable.append(e._$ganttViewTablebody),e._$bodyContent.append(e._$ganttViewTable)},_getRenderedRowRange:function(){var e,t,i=this;return i._getVisibleRowRange(),e=i._visibleRange.top,t=i._visibleRange.bottom,i._renderedRange={top:e,bottom:t},i._renderedRange},_getVisibleRowRange:function(){var e,t,i,s=this,a=s._scrollTop/s.model.rowHeight,n=a-Math.floor(a);s._rowMargin=n*s.model.rowHeight,e=Math.floor(a),i=s.model.updatedRecords.length,t=s._getrowposition(s._scrollTop+s._viewportHeight),e=Math.max(0,e),t=Math.min(i,t),s._visibleRange={top:e,bottom:t}},_getrowposition:function(e){return Math.ceil(e/this.model.rowHeight)},_getDateType:function(e){if(null!=e){if("object"==typeof e)return e;var t=new RegExp("\\-","g"),i=new RegExp("\\.","g");return e=e.replace(t,"/"),e=e.replace(i,"/"),new Date(e)}return null},_getDateFromFormat:function(e){return"object"==typeof e?new Date(e):e?null==t.parseDate(e,this.model.dateFormat)?new Date(e):t.parseDate(e,this.model.dateFormat):void 0},_createScheduleTopDayTemplate:function(){var t,i,s=this,a=s.model,n=""==a.scheduleHeaderSettings.dayHeaderFormat&&"day"==a.scheduleHeaderSettings.scheduleHeaderType?"ddd":a.scheduleHeaderSettings.dayHeaderFormat,o={renderDayTop:e.proxy(s._getDaySplit,s)};e.views.helpers(o),t="",td="
      {{:~renderDayTop('"+n+"',#data)}}
      ",t+=td,t+="",i={},i[s._id+"ScheduleTopDayTemplate"]=t,e.templates(i)},_getDaySplit:function(e,i){var s=new Date(i),a=this,n=a.model;switch(e){case"D":case"d":return s.getDate();case"DD":case"dd":return("0"+s.getDate()).slice(-2);case"DDD":case"ddd":case"DDDD":case"dddd":return t.format(s,e,n.locale)}return t.format(s,e,n.locale)},_createScheduleTopMonthTemplate:function(){var t,i,s,a=this,n=a.model,o=n.scheduleHeaderSettings.monthHeaderFormat,r={renderMonthTop:e.proxy(a._getMonthsplit,a),setMonthWidth:e.proxy(a._setMonthWidth,a),isLastMonth:e.proxy(a._checkLastMonthWidth,a)};e.views.helpers(r),i="",t="
      {{:~renderMonthTop('"+o+"',#data)}}
      {{if ~isLastMonth(#data)}}
      {{/if}}",i+=t,i+="",s={},s[a._id+"ScheduleTopMonthTemplate"]=i,e.templates(s)},_setMonthWidth:function(e){var i,s,a;return i="object"==typeof e?new Date(e):t.parseDate(e,"MM/dd/yyyy"),s=new Date(i.getFullYear(),i.getMonth()+1,0),a=s.getDate(),31==a?31*this.model.perDayWidth:30==a?30*this.model.perDayWidth:28==a?28*this.model.perDayWidth:29==a?29*this.model.perDayWidth:void 0},_checkLastMonthWidth:function(e){var t=this;return e==t.model.scheduleMonths[t.model.scheduleMonths.length-1]&&t._balanceWidth>0},_getMonthsplit:function(e,i){var s=new Date(i),a=this,n=a.model;return t.format(s,e,n.locale)},_createScheduleYearTemplate:function(){var t,i,s,a=this,n=a.model,o=n.scheduleHeaderSettings.yearHeaderFormat,r={renderYear:e.proxy(a._getYearsplit,a),getYearWidth:e.proxy(a._getTemplateYearWidth,a)};e.views.helpers(r),i="",t="
      {{:~renderYear('"+o+"',#data)}}
      ",i+=t,i+="",s={},s[a._id+"ScheduleYearTemplate"]=i,e.templates(s)},_getYearsplit:function(e,i){var s=new Date(i),a=this,n=a.model;return t.format(s,e,n.locale)},_getTemplateYearWidth:function(e){var t=e.getFullYear();return 1===new Date(t,1,29).getMonth()?366*this.model.perDayWidth:365*this.model.perDayWidth},_createScheduleWeekTemplate:function(){var t,i,s,a=this,n=a.model,o=n.scheduleHeaderSettings.weekHeaderFormat,r={renderWeek:e.proxy(a._getWeeksplit,a)};e.views.helpers(r),i="",t="
      {{:~renderWeek('"+o+"',#data)}}
      ",i+=t,i+="",s={},s[a._id+"ScheduleWeekTemplate"]=i,e.templates(s)},_getWeeksplit:function(e,i){var s,a=new Date(i),n=this,o=n.model;return s=t.format(a,e,o.locale),s.toLowerCase().replace(/(-(\w)|(^| )(\w)|:(\w)|,(\w)|\/(\w)|\.(\w))/g,function(e){return e.toUpperCase()})},_createScheduleHourTemplate:function(){var t,i,s,a=this,n=a.model,o=n.scheduleHeaderSettings.hourHeaderFormat,r={renderHour:e.proxy(a._getHourTemplate,a)};e.views.helpers(r),i="",t="
      {{:~renderHour('"+o+"',#data)}}
      ",i+=t,i+="",s={},s[a._id+"scheduleHourTemplate"]=i,e.templates(s)},_createScheduleTopHourTemplate:function(){var t,i,s,a,n=this,o=n.model,r=o.minuteInterval,l=o.scheduleHeaderSettings.hourHeaderFormat,d={renderHour:e.proxy(n._getHourTemplate,n)};30==r&&(i=2),15==r&&(i=4),5==r&&(i=12),1==r&&(i=60),n._totalInterval=i,e.views.helpers(d),s="",t="
      {{:~renderHour('"+l+"',#data)}}
      ",s+=t,s+="",a={},a[n._id+"ScheduleTopHourTemplate"]=s,e.templates(a)},_createMinuteTemplate:function(){var t,i,s,a=this,n=a.model,o=n.scheduleHeaderSettings.minuteHeaderFormat,r={renderHour:e.proxy(a._getHourTemplate,a)};e.views.helpers(r),i="",t="
      {{:~renderHour('"+o+"',#data)}}
      ",i+=t,i+="",s={},s[a._id+"scheduleMinuteTemplate"]=i,e.templates(s)},_getHourTemplate:function(e,i){var s=new Date(i),a=this,n=a.model;return t.format(s,e,n.locale)},_createScheduleBottomWeekTemplate:function(){var t,i,s,a=this,n=a.model,o=n.scheduleHeaderSettings.weekHeaderFormat,r={renderWeek:e.proxy(a._getMonthWeekTemplate,a)};e.views.helpers(r),i="",t="
      {{:~renderWeek('"+o+"',#data)}}
      ",i+=t,i+="",s={},s[a._id+"ScheduleBottomWeekTemplate"]=i,e.templates(s)},_getMonthWeekTemplate:function(e,i){var s=new Date(i),a=this,n=a.model;switch(e){case"d":case"dd":case"ddd":default:return t.format(s,e,n.locale)}},_createScheduleMonthTemplate:function(){var t,i,s,a=this,n=a.model,o=n.scheduleHeaderSettings.monthHeaderFormat,r={renderMonth:e.proxy(a._getMonthTemplate,a),getMonthWidth:e.proxy(a._setMonthWidthYearMode,a)};e.views.helpers(r),i="",t="
      {{:~renderMonth('"+o+"',0,#data)}}
      {{:~renderMonth('"+o+"',1,#data)}}
      {{:~renderMonth('"+o+"',2,#data)}}
      {{:~renderMonth('"+o+"',3,#data)}}
      {{:~renderMonth('"+o+"',4,#data)}}
      {{:~renderMonth('"+o+"',5,#data)}}
      {{:~renderMonth('"+o+"',6,#data)}}
      {{:~renderMonth('"+o+"',7,#data)}}
      {{:~renderMonth('"+o+"',8,#data)}}
      {{:~renderMonth('"+o+"',9,#data)}}
      {{:~renderMonth('"+o+"',10,#data)}}
      {{:~renderMonth('"+o+"',11,#data)}}
      ",i+=t,i+="",s={},s[a._id+"ScheduleMonthTemplate"]=i,e.templates(s)},_getMonthTemplate:function(e,i,s){var a=new Date(s),n=this,o=n.model;switch(a.setMonth(a.getMonth()+i),e){case"M":case"m":return("0"+a.getDate()).slice(-2);case"MM":case"mm":return a.getDate();case"MMM":case"mmm":case"MMMM":case"mmmm":return t.format(a,e,o.locale);default:return t.format(a,e,o.locale)}},_setMonthWidthYearMode:function(e,t){var i,s,a=new Date(t);return a.setMonth(a.getMonth()+e),i=new Date(a.getFullYear(),a.getMonth()+1,0),s=i.getDate(),31==s?31*this.model.perDayWidth:30==s?30*this.model.perDayWidth:28==s?28*this.model.perDayWidth:29==s?29*this.model.perDayWidth:void 0},_createScheduleDayTemplate:function(){var t,i,s,a=this,n=a.model,o=""==n.scheduleHeaderSettings.dayHeaderFormat&&"day"==n.scheduleHeaderSettings.scheduleHeaderType?"ddd":n.scheduleHeaderSettings.dayHeaderFormat,r={renderDay:e.proxy(a._getDayTemplate,a)};e.views.helpers(r),i="",t="
      {{:~renderDay('"+o+"',0,#data)}}
      {{:~renderDay('"+o+"',1,#data)}}
      {{:~renderDay('"+o+"',2,#data)}}
      {{:~renderDay('"+o+"',3,#data)}}
      {{:~renderDay('"+o+"',4,#data)}}
      {{:~renderDay('"+o+"',5,#data)}}
      {{:~renderDay('"+o+"',6,#data)}}
      ",i+=t,i+="",s={},s[a._id+"_CustomTemplate1"]=i,e.templates(s)},_getDayTemplate:function(e,i,s){var a=new Date(s),n=this,o=n.model;switch(a.setDate(a.getDate()+i),e){case"D":case"d":return a.getDate();case"DD":case"dd":return("0"+a.getDate()).slice(-2);case"DDD":case"ddd":case"DDDD":case"dddd":return t.format(a,e,o.locale);case"":return e="ddd",t.format(a,e,o.locale)[0].toUpperCase();default:return t.format(a,e,o.locale).toUpperCase()}},_createSchedule:function(i,s){var a,n,o,r,l,d,h,c=this,u=c.model,m=u.scheduleHeaderSettings.scheduleHeaderType;i=null==i?new Date:i,s=null==s?new Date(null):s,c._createScheduleWeekTemplate(),c._createScheduleYearTemplate(),c._createScheduleTopMonthTemplate(),c._createScheduleTopDayTemplate(),c._createScheduleTopHourTemplate(),h=t.buildTag("table.e-schedule-headerrow-week","",{display:"block"},{"cell-spacing":"0"}),a=t.buildTag("colgroup","",{},{}),n=e(document.createElement("col")),n.css("width",c._getScheduleLength(m)+"px"),a.append(n),o=t.buildTag("thead.e-ejganttschedule","",{display:"block","border-collapse":"collapse"},{}),"week"==m?r=t.buildTag("tr",e.render[this._id+"ScheduleWeekTemplate"](c.model.scheduleWeeks),{},{}):"year"==m?r=t.buildTag("tr",e.render[this._id+"ScheduleYearTemplate"](c.model.scheduleYears),{},{}):"month"==m?r=t.buildTag("tr",e.render[this._id+"ScheduleTopMonthTemplate"](c.model.scheduleMonths),{},{}):"day"==m?r=t.buildTag("tr",e.render[this._id+"ScheduleTopDayTemplate"](c.model.scheduleDays),{},{}):"hour"==m&&(r=t.buildTag("tr",e.render[this._id+"ScheduleTopHourTemplate"](c.model.scheduleHours),{},{})),l=t.buildTag("th.schedule","",{},{}),d=t.buildTag("div.schedule","",{width:"20px"},{}),l.append(d),r.append(l),o.append(r),h.append(a),h.append(o),c._$scheduleDiv.append(h),r=null,c._createScheduleDayTemplate(),c._createScheduleMonthTemplate(),c._createScheduleBottomWeekTemplate(),c._createMinuteTemplate(),c._createScheduleHourTemplate(),h=t.buildTag("table.e-schedule-headerrow-day","",{display:"block","border-collapse":"collapse"},{"cell-spacing":"0"}),o=t.buildTag("thead.e-ejganttschedule","",{display:"block","border-collapse":"collapse"},{}),"week"==m&&(r=t.buildTag("tr",e.render[this._id+"_CustomTemplate1"](u.scheduleWeeks),{},{})),"year"==m&&(r=t.buildTag("tr",e.render[this._id+"ScheduleMonthTemplate"](u.scheduleYears),{},{})),"month"==m&&(r=t.buildTag("tr",e.render[this._id+"ScheduleBottomWeekTemplate"](c._numOfWeeks),{},{})),"day"==m&&(r=t.buildTag("tr",e.render[this._id+"scheduleHourTemplate"](c._getScheduleHours()),{},{})),"hour"==m&&(r=t.buildTag("tr",e.render[this._id+"scheduleMinuteTemplate"](c._getScheduleMinutes()),{},{})),l=t.buildTag("th.schedule","",{},{}),d=t.buildTag("div.schedule","",{width:"20px"},{}),l.append(d),r.append(l),o.append(r),h.append(a),h.append(o),c._$scheduleDiv.append(h),c._$headerContainer.append(c._$scheduleDiv),c._$ganttChartContainer.append(c._$headerContainer),e("#"+c._id).append(c._$ganttChartContainer)},_getScheduleHours:function(){var e=this,t=e.model,i=new Date(e.model.projectStartDate),s=new Date(t.projectEndDate);e._scheduleHours=[],s.setHours(24);do e._scheduleHours.push(new Date(i)),i.setHours(i.getHours()+1);while(!(i.getTime()>=s.getTime()));return e._scheduleHours},_getScheduleMinutes:function(){var e=this,t=e.model,i=new Date(e.model.projectStartDate),s=new Date(t.projectEndDate);s.setMinutes(60),i.setMinutes(0),e._scheduleMinutes=[];do e._scheduleMinutes.push(new Date(i)),i.setMinutes(i.getMinutes()+t.minuteInterval);while(!(i.getTime()>=s.getTime()));return e._scheduleMinutes},createGridLinesTable:function(){var i,s,a,n,o,r,l=this,d=l.model,h=d.scheduleHeaderSettings.scheduleHeaderType;switch(i=t.buildTag("table.e-ganttgridLinesTable#ganttgridLinesTable"+l._id,"",{"z-index":"2",position:"absolute"},{cellspacing:"0px"}),n=t.buildTag("colgroup","",{},{}),o=e(document.createElement("col")),h){case"week":s=d.scheduleWeeks.length,i.css("width",s*l._scheduleWeekWidth+"px"),o.css("width",s*this._scheduleWeekWidth+"px");break;case"year":s=d.scheduleYears.length,i.css("width",l._scheduleYearWidth+"px"),o.css("width",this._scheduleYearWidth+"px");break;case"month":s=d.scheduleMonths.length,i.css("width",l._scheduleMonthWidth+"px"),o.css("width",this._scheduleMonthWidth+"px");break;case"day":s=d.scheduleDays.length,i.css("width",s*l.model.perHourWidth*24+"px"),o.css("width",s*l.model.perHourWidth*24+"px");break;case"hour":s=d.scheduleHours.length,i.css("width",s*l.model.perMinuteWidth*l._totalInterval+"px"),o.css("width",s*l.model.perMinuteWidth*l._totalInterval+"px")}n.append(o),i.append(n),a=l._createGridLinesTableRow(d.updatedRecords.length),r=t.buildTag("tbody.e-gantt-viewer-gridLinesTablebody#gridLinesTablebody"+l._id,a,{},{}),l._$gridLinesTablebody=r,i.append(l._$gridLinesTablebody),l._$bodyContent.append(i)},_createGridLinesTableRow:function(e){for(var t="",i=0;i";return t},_SelectState:function(){var e=this.model;return!!e.allowSelection},_getFontSize:function(){var e,t,i=this,s=i.model,a=s.rowHeight;return e=.75*(a-10),t=e%1,.5==t?e:t<.5?Math.floor(e):Math.ceil(e)},_getMargin:function(){var e,t,i=this,s=i.model.rowHeight;return e=s*(1/6),t=e%1,t<.5?Math.floor(e):Math.ceil(e)},_getResizerLeftAdjust:function(){var e,t,i=this,s=i.model.rowHeight,a=i._fontSize,n=i._resizerMargin;return e=s-10-(a+n),t=e%1,t<.5?Math.floor(e):Math.ceil(e)},_createTaskbarTemplate:function(){var i,s,a,n,o,r,l,d,h,c,u,m,p,g=this,_=g.model,f=_.scheduleHeaderSettings.scheduleHeaderType,b=4,v=0,x=0,w=0,y=0,C=0,S=_.baselineColor,T=_.taskbarTemplate,D=!1,I=!1,k=_.parentTaskbarTemplate,P=!1,L=_.milestoneTemplate,R=!1,M="",O={_SelectState:e.proxy(g._SelectState,g),_getType:g._getTypedata,_expander:g._addRecordExpandCollapse,_milestoneMapping:g._isMilestone,_resources:e.proxy(g._getResourceInfo,g),_rowClassName:t.TreeGrid._getrowClassName,_expandStatus:e.proxy(g._getExpandStatusRecord,g),_borderRadius:g._getBorderRadius};g._fontSize=g._getFontSize(),g._resizerRightAdjust=.8*g._fontSize,g._resizerMargin=g._getMargin(), g._resizerLeftAdjust=g._getResizerLeftAdjust(),"week"==f?i=_.scheduleWeeks.length*g._scheduleWeekWidth:"year"==f?i=g._scheduleYearWidth:"month"==f?i=g._scheduleMonthWidth:"day"==f?i=_.scheduleDays.length*_.perHourWidth*24:"hour"==f&&(i=_.scheduleHours.length*_.perMinuteWidth*g._totalInterval),_.renderBaseline?(a=_.rowHeight-b-5,v=0):a=_.rowHeight-10,x=Math.floor((_.rowHeight-6)/2),g._milesStoneWidth=2*x,g._connectorPointWidth=w=a/2,y=w/2,C=w-w/2+5,e.views.helpers(O),_.progressMapping||(this.model.showProgressStatus=!1),_.resourceInfoMapping||(_.showResourceNames=!1),T&&(h=t.buildTag("div","",{},{}),c=T.charAt(0),D=!0,r="",n="#"==T.charAt(0)?e(T)[0].innerHTML:T,n=n.replace(/src/gi,g._id+"src"),e(h[0]).html(n),e(h[0].childNodes).each(function(){var i,s,n,o,l;e(this).hasClass("e-gantt-template-taskbar")?(i="e-gantt-childtaskbar "+e(this).attr("class"),e(this).css({height:a+"px","margin-top":"5px"}).attr("class",i),s="",e(this.childNodes).each(function(){var t,i,n;e(this).hasClass("e-gantt-template-progressbar")?(I=!0,t="e-gantt-childtaskbar-progress "+e(this).attr("class"),e(this).css({height:_.progressbarHeight*(a/100)+"px",position:"absolute",top:"-1px",left:"-1px"}).attr("class",t),i=this.outerHTML,n=i.indexOf("style"),i=i.substr(0,n+7)+"border-style:{{if progressWidth}}solid{{else}}none{{/if}};width:{{:progressWidth}}px;"+i.substr(n+7),s+=i):s+="#comment"==this.nodeName?"":"#text"==this.nodeName?this.textContent?this.textContent.replace(/(\r\n|\n|\r)/gm,""):this.nodeValue.replace(/(\r\n|\n|\r)/gm,""):this.outerHTML}),n=e(this).clone().empty()[0].outerHTML,o=n.indexOf("style"),n=n.substr(0,o+7)+"left:{{:left}}px;width:{{:width}}px;"+n.substr(o+7),l="msie"==t.browserInfo().name&&t.browserInfo().version<9?n.indexOf(""):n.indexOf(""),n=n.substr(0,l)+s+n.substr(l),r+=n):r+="#comment"==this.nodeName?"":this.textContent?this.textContent.replace(/(\r\n|\n|\r)/gm,""):this.nodeValue.replace(/(\r\n|\n|\r)/gm,"")}),r=r.replace(RegExp((g._id+"src").toLowerCase(),"g"),"src")),k&&(h=t.buildTag("div","",{},{}),l=k.charAt(0),P=!0,d="",o="#"==l?e(k)[0].innerHTML:k,k=k.replace(/src/gi,g._id+"src"),e(h[0]).html(o),e(h[0].childNodes).each(function(){var i,s,n,o,r;e(this).hasClass("e-gantt-template-taskbar")?(i="e-gantt-parenttaskbar-innerdiv "+e(this).attr("class"),e(this).css({height:a+"px","margin-top":"5px"}).attr("class",i),s="",e(this.childNodes).each(function(){var t,i,n;e(this).hasClass("e-gantt-template-progressbar")?(t="e-gantt-parenttaskbar-progress "+e(this).attr("class"),e(this).css({height:_.progressbarHeight*(a/100)+"px",top:"-1px",left:"-1px",position:"absolute","z-index":"3"}).attr("class",t),i=this.outerHTML,n=i.indexOf("style"),i=i.substr(0,n+7)+"border-style:{{if progressWidth}}solid{{else}}none{{/if}};width:{{:progressWidth}}px;"+i.substr(n+7),s+=i):s+="#comment"==this.nodeName?"":"#text"==this.nodeName?this.textContent?this.textContent.replace(/(\r\n|\n|\r)/gm,""):this.nodeValue.replace(/(\r\n|\n|\r)/gm,""):this.outerHTML}),n=e(this).clone().empty()[0].outerHTML,o=n.indexOf("style"),n=n.substr(0,o+7)+"left:{{:left}}px;width:{{:width}}px;"+n.substr(o+7),r="msie"==t.browserInfo().name&&t.browserInfo().version<9?n.indexOf(""):n.indexOf(""),n=n.substr(0,r)+s+n.substr(r),d+=n):d+="#comment"==this.nodeName?"":this.textContent?this.textContent.replace(/(\r\n|\n|\r)/gm,""):this.nodeValue.replace(/(\r\n|\n|\r)/gm,"")}),d=d.replace(RegExp((g._id+"src").toLowerCase(),"g"),"src")),L&&(h=t.buildTag("div","",{},{}),c=L.charAt(0),R=!0,T="#"==c?e(L)[0].innerHTML:L,T=T.replace(/src/gi,g._id+"src"),e(h[0]).html(T),e(h[0].childNodes).each(function(){var t,i,s;e(this).hasClass("e-gantt-template-milestone")?(t="e-gantt-milestone "+e(this).attr("class"),e(this).css({width:_.rowHeight-6+"px","margin-top":"3px",position:"absolute","z-index":"3"}).attr("class",t),i=this.outerHTML,s=i.indexOf("style"),i=i.substr(0,s+7)+"left:{{:left}}px;"+i.substr(s+7),M+=i):M+="#comment"==this.nodeName?"":this.textContent?this.textContent.replace(/(\r\n|\n|\r)/gm,""):this.nodeValue.replace(/(\r\n|\n|\r)/gm,"")}),M=M.replace(RegExp((g._id+"src").toLowerCase(),"g"),"src")),u="",m="{{:~_borderRadius()}}",s="{{if ~_getType()}}{{if "+this.model.showTaskNames+" && left > 0}}
      {{:taskName}}
      {{/if}}
      {{if "+P+"}}"+d+"{{else}}
      {{/if}}
      {{if "+this.model.renderBaseline+" && baselineStartDate && baselineEndDate }}
      {{/if}}{{if "+this.model.showResourceNames+"}}
      {{:~_resources(#data)}}
      {{/if}}{{else ~_milestoneMapping()}}{{if "+this.model.showTaskNames+" && left > 0}}
      {{:taskName}}
      {{/if}}
      {{if "+R+"}}"+M+"{{else}}
      {{/if}}
      {{if "+this.model.renderBaseline+" && baselineStartDate && baselineEndDate}}
      {{/if}}{{if "+this.model.showResourceNames+"}}
      {{:~_resources(#data)}}
      {{/if}}{{else}}{{if "+this.model.showTaskNames+" && left > 0}}
      {{:taskName}}
      {{/if}}
      {{if "+D+"}}"+r+"{{else}}
      {{if "+this.model.showProgressStatus+"}}{{:status}}%{{/if}}
      {{/if}}{{if "+(!D||I)+"}}
      {{/if}}
      {{if "+this.model.renderBaseline+" && baselineStartDate && baselineEndDate }}
      {{/if}}{{if "+this.model.showResourceNames+"}}
      {{:~_resources(#data)}}
      {{/if}}{{/if}}",u+=s,u+="",p={},p[this._id+"_CustomTemplate2"]=u,e.templates(p)},_getResourceInfo:function(e){var t,i,s=null;if(null!=e.resourceInfo){if(t=e.resourceInfo.length,t>0){for(i=0;i4?4:o.model.connectorlineWidth,l=o.model.connectorLineBackground,d={_getWidthVal:o._getWidth,_getTop:o._getPredecessorTop,_getPosition:o._getParentPosition,_setContainerWidthSSType2:o._getContainerWidthSSType2,_setInnerChildWidthSSType2:o._getInnerChildWidthSSType2,_setInnerElementLeftSSType2:o._getInnerElementLeftSSType2,_setInnerElementWidthSSType2:o._getInnerElementWidthSSType2,_isMilestone:o._isTaskMilestone,_isMilestoneParent:o._isMilestoneParent};o.model.renderBaseline?(t=0,i=o.model.rowHeight/2-t):i=o.model.rowHeight/2,e.views.helpers(d),s="
      ",a="{{if ~_getPosition()=='FSType1'}}
      {{else ~_getPosition()=='FSType2'}}
      {{else ~_getPosition()=='FSType3'}}
      {{else ~_getPosition()=='FSType4'}}
      {{else ~_getPosition()=='SSType4'}}
      {{else ~_getPosition()=='SSType3'}}
      {{else ~_getPosition()=='SSType2'}}
      {{else ~_getPosition()=='SSType1'}}
      {{else ~_getPosition()=='FFType1'}}
      {{else ~_getPosition()=='FFType2'}}
      {{else ~_getPosition()=='FFType3'}}
      {{else ~_getPosition()=='FFType4'}}
      {{else ~_getPosition()=='SFType4'}}
      {{else ~_getPosition()=='SFType3'}}
      {{else ~_getPosition()=='SFType1'}}
      {{else ~_getPosition()=='SFType2'}}
      {{/if}}", s+=a,s+="
      ",n={},n[this._id+"ConnectorLineTemplate"]=s,e.templates(n)},_isTaskMilestone:function(){return!!this.data.milestoneChild},_isMilestoneParent:function(){return!!this.data.milestoneParent},_getInnerChildWidthSSType2:function(){return 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.ParentTop>this.data.ChildTop},_getParentPosition:function(){if(this.data.ParentTop=this.data.ParentLeft+this.data.ParentWidth?"FFType2":"FFType1";if(this.data.ParentLeftthis.data.ParentLeft+this.data.ParentWidth+25){if("FS"==this.data.Type)return"FSType1";if("SF"==this.data.Type)return"SFType1";if("SS"==this.data.Type)return"SSType2";if("FF"==this.data.Type)return"FFType2"}else if(this.data.ParentLeftthis.data.ChildLeft){if(this.data.ParentLeft>this.data.ChildLeft+this.data.ChildWidth+25&&"SF"==this.data.Type)return"SFType2";if(this.data.ParentLeft>this.data.ChildLeft){if("SS"==this.data.Type)return"SSType1";if("SF"==this.data.Type)return"SFType1";if("FF"==this.data.Type)return"FFType1"}else if(this.data.ChildLeft+this.data.ChildWidth>this.data.ParentLeft+this.data.ParentWidth&&"FF"==this.data.Type)return"FFType2";if("FS"==this.data.Type)return"FSType2";if("SS"==this.data.Type)return"SSType2";if("FF"==this.data.Type)return"FFType1";if("SF"==this.data.Type)return"SFType1"}else if(this.data.ParentLeftthis.data.ChildTop)if(this.data.ParentLeftthis.data.ParentLeft+this.data.ParentWidth){if("FS"==this.data.Type)return this.data.milestoneParent&&this.data.ChildLeft==(this.data.milestoneParent?this.data.ParentLeft+this.data.ParentWidth+4:this.data.ParentLeft+this.data.ParentWidth)?"FSType3":"FSType4";if(this.data.ParentLeftthis.data.ParentLeft+this.data.ParentWidth){if("SS"==this.data.Type)return"SSType4";if("FF"==this.data.Type)return"FFType4";if("SF"==this.data.Type)return"SFType4"}else if(this.data.ChildLeft+this.data.ChildWidth>this.data.ParentLeft+this.data.ParentWidth&&"FF"==this.data.Type)return"FFType4"}else if(this.data.ParentLeftthis.data.ChildLeft){if(this.data.ChildLeft+this.data.ChildWidth<=this.data.ParentLeft+this.data.ParentWidth){if("FF"==this.data.Type)return"FFType3";if("SF"==this.data.Type)return this.data.ChildLeft+this.data.ChildWidththis.data.ParentLeft+this.data.ParentWidth){if("FF"==this.data.Type)return"FFType4";if("SF"==this.data.Type)return"SFType4";if("SS"==this.data.Type)return this.data.ChildLeft<=this.data.ParentLeft?"SSType3":"SSType4"}if("FS"==this.data.Type)return"FSType3"}else if(this.data.ParentLeft30?30:e[u].lineWidth,i=t.buildTag("div.e-stripline#stripline"+[u],"",{left:n+"px",width:"1px",height:r+"px","border-left-width":e[u].lineWidth+"px","border-left-color":e[u].lineColor,"border-left-style":e[u].lineStyle},{}),s=t.buildTag("span.e-striplinespan",e[u].label,{"background-color":e[u].lineColor},{}),e[u].day&&e[u].day.length>0&&(e[u].label&&e[u].label.length>0&&i.append(s),c.append(i));o._$stripLineContainer.append(c),o._$bodyContent.append(o._$stripLineContainer)},_getProgressWidth:function(e,t){return e*t/100},_getProgressPercent:function(e,t){return Math.ceil((t/e*100).toFixed(2))},_renderHoliday:function(e){var i,s,a,n,o,r,l=this,d=(l.model.scheduleHeaderSettings.scheduleHeaderType,this._getDateFromFormat(e.day)),h=(l.model.scheduleWeeks.length,l.model.scheduleMonths.length,l.model.scheduleYears.length,l.model.scheduleDays.length,0),c=l.model.updatedRecords.length;h=(d-this._getDateFromFormat(l.model.projectStartDate))/864e5*this.model.perDayWidth,o=c*this.model.rowHeight,i=null!=e.label?e.label.length:0,null==e.background&&(e.background="white"),r=".e-holiday-label","msie"==t.browserInfo().name&&t.browserInfo().version<9&&(r=".e-holiday-label-ie8"),s="day"!=l.model.scheduleHeaderSettings.scheduleHeaderType?t.buildTag("div"+r,e.label,{top:l._getHolidayLabelHeight(i)+"px"},{}):t.buildTag("div"+r,e.label,{bottom:l._getHolidayLabelHeight(i)+"px"},{}),a=t.buildTag("div.e-secondary-canvas-holiday"),n=t.buildTag("div.e-holidays","",{left:h+"px",width:l.model.perDayWidth+"px",height:o+"px","background-color":e.background},{}),null!=e.label&&n.append(s),a.append(n),l._$secondaryCanvas.append(a),l._$bodyContent.append(l._$secondaryCanvas)},_getHolidayLabelHeight:function(){var e=this,t=e.model,i=e._getHeight(),s=t.updatedRecords.length*e.model.rowHeight;return i>0?i/2:e._viewportHeight=t?l+1:l,r[l]=this.createArray(o),a=0;a=i?a+1:a,r[l][a]=e[s][n];return r},getDeterminant:function(e){var t,i,s,a=e.length,n=0;if(a<2)n=e[0][0];else for(t=1,i=0;i0?-1:1;return n},transform:function(e,t,i){var s=this.getIdentity();return s[3][0]=e,s[3][1]=t,s[3][2]=i,s},turn:function(e){var t=this.getIdentity();return t[0][0]=Math.cos(e),t[2][0]=-Math.sin(e),t[0][2]=Math.sin(e),t[2][2]=Math.cos(e),t},tilt:function(e){var t=this.getIdentity();return t[1][1]=Math.cos(e),t[2][1]=Math.sin(e),t[1][2]=-Math.sin(e),t[2][2]=Math.cos(e),t},transposed:function(e){for(var t,i=this.getIdentity(),s=0;se.Plane.D){if(null!=e.Front&&this.drawBspNode3D(e.Front,t,s,a),this.draw3DElement(e,a),null!=e.Back){e=e.Back;continue}}else if(null!=e.Back&&this.drawBspNode3D(e.Back,t,s,a),this.draw3DElement(e,a),null!=e.Front){e=e.Front;continue}break}}},t.BSPTreeBuilder.prototype={EPSILON:5e-4,Polygon:[],add:function(e){return ej.Ej3DRender.Polygons.push(e),ej.Ej3DRender.Polygons.length-1},remove:function(e){ej.Ej3DRender.Polygons.splice(e,1)},clear:function(){ej.Ej3DRender.Polygons=[]},count:function(){return ej.Ej3DRender.Polygons.length},getNext:function(e,t){return e>=t?e-t:e<0?e+t:e},getNodeCount:function(e){return null==e?0:1+this.getNodeCount(e.Back)+this.getNodeCount(e.Front)},vector3DIndexClassification:function(e,t,i){return{index:t,result:i,vector:e,isCuttingBackPoint:!1,cuttingBackPairIndex:null,alreadyCuttedBack:!1,isCuttingFrontPoint:!1,cuttingFrontPairIndex:null,alreadyCuttedFront:!1}},classifyPoint:function(e,i){var s="OnPlane",a=-i.D-t.vector3D.prototype.vector3dAND(e,i.normal);return a>this.EPSILON?s="OnBack":a<-this.EPSILON&&(s="OnFront"),s},classifyPolygon:function(e,i){var s,a,n,o=i.Points;if(null==o)return"Unknown";var r=0,l=0,d=0,h=e.normal,c=e.D;for(s=0,a=o.length;sthis.EPSILON?r++:n<-this.EPSILON?l++:d++,!(r>0&&l>0));s++);return d==o.length?"OnPlane":l+d==o.length?"ToRight":r+d==o.length?"ToLeft":"Unknown"},splitPolygon:function(t,s){var a,o,r,l,d,h,c,u,m=[],p=[];if(null!=t.Points){var l,g,_=[],f=[],b=[],v=t.Points.length;for(h=0;h2&&(d=n.polygon3D(l,t),m.push(e.extend({},d))));for(h=0;h2&&(u=n.polygon3D(g,t),p.push(e.extend({},u))))}}else m.push(t),p.push(t);return{BackP:m,FrontP:p}},cutOutFrontPolygon:function(e,t){var i,s,a,n,o,r;for(points=[],i=t;;)if(i.alreadyCuttedFront=!0,points.push(i.vector),s=e[i.CuttingFrontPairIndex],i.CuttingFrontPoint)if(s.alreadyCuttedFront)if(a=e[this.getNext(i.index-1,e.length)],n=e[this.getNext(i.index+1,e.length)],"OnFront"!=a.result||a.alreadyCuttedFront){if("OnFront"!=n.result||n.alreadyCuttedFront)return points;i=n}else i=a;else i=s;else if(o=e[this.getNext(i.index-1,e.length)],r=e[this.getNext(i.index+1,e.length)],"OnBack"==o.result||o.alreadyCuttedFront){if("OnBack"==r.result||r.alreadyCuttedFront)return points;i=r}else i=o;return points},cutOutBackPolygon:function(e,t){for(var i,s,a,n=[],o=t;;)if(o.alreadyCuttedBack=!0,n.push(o.vector),i=e[o.CuttingBackPairIndex],o.CuttingBackPoint)if(i.alreadyCuttedBack)if(s=e[this.getNext(o.index-1,e.length)],a=e[this.getNext(o.index+1,e.length)],"OnBack"!=s.result||s.alreadyCuttedBack){if("OnBack"!=a.result||a.alreadyCuttedBack)return n;o=a}else o=s;else o=i;else if(s=e[this.getNext(o.index-1,e.length)],a=e[this.getNext(o.index+1,e.length)],"OnFront"==s.result||s.alreadyCuttedBack){if("OnFront"==a.result||a.alreadyCuttedBack)return n;o=a}else o=s;return n},build:function(){var e,t,i,s,a,n,o,r,l,d,h,c;if(arguments[0]){if(e=arguments[0],e.length<1)return null;for(t={Back:null,Front:null,Plane:null},i=e[0],t.Plane=i,s=[],a=[],n=1,o=e.length;n0&&(t.Back=this.build(s)),a.length>0&&(t.Front=this.build(a)),t}return this.build(ej.Ej3DRender.Polygons)}},t.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(e,t,i,s,a,n,o,r){var l,d;return 3!=arguments.length?2==arguments.length?(e=arguments[0],this.calcNormal(e[0],e[1],e[2]),this.vectorPoints=e,this.calcNormal(this.vectorPoints),d=arguments[1],d.Normal=this.normal,d.normal=this.normal,d.Points=e,d.VectorPoints=this.vectorPoints,d.IsSplitted=!0,d.d=this.d,d.D=this.d,d):(this.calcNormal(e[0],e[1],e[2]),this.vectorPoints=e,this.calcNormal(this.vectorPoints),l={Tag:"path",Parent:arguments[arguments.length-1]},d={Normal:this.normal,normal:this.normal,Points:e,VectorPoints:this.vectorPoints,Index:i,Tag:t,Name:r?r:null,StrokeThickness:a,Opacity:n,Fill:o,d:this.d,D:this.d},1!=arguments.length&&(d.Element=l),d):void this.calcNormal(arguments[0],arguments[1],arguments[2])},createLine:function(e,t,s,a,n,o){var r=e.width,l=[];return l[0]=i.vector3D(t,s,o),l[1]=i.vector3D(t+r,n+r,o),l[2]=i.vector3D(a,n,o),this.line3D(e,l)},createPolyline:function(e,t){if(2==e.length){var s=e[1];e.push(i.vector3D(s.x,s.y,s.z))}return this.polyLine3D(t,e)},polyLine3D:function(e,t){var i=this.polygon3D(t);return i.element=e,i},line3D:function(e,t){var i=this.polygon3D(t);return i.element=e,i},text3D:function(e,t){var i=this.polygon3D(t);return i.element=e,i},createBox:function(e,t,s,a,n,r,l,d,h,c,u,m){var m,p=[],g=[i.vector3D(e.x,e.y,e.z),i.vector3D(t.x,e.y,e.z),i.vector3D(t.x,t.y,e.z),i.vector3D(e.x,t.y,e.z)],_=[i.vector3D(e.x,e.y,t.z),i.vector3D(t.x,e.y,t.z),i.vector3D(t.x,t.y,t.z),i.vector3D(e.x,t.y,t.z)],f=[i.vector3D(e.x,e.y,t.z),i.vector3D(t.x,e.y,t.z),i.vector3D(t.x,e.y,e.z),i.vector3D(e.x,e.y,e.z)],b=[i.vector3D(e.x,t.y,t.z),i.vector3D(t.x,t.y,t.z),i.vector3D(t.x,t.y,e.z),i.vector3D(e.x,t.y,e.z)],v=[i.vector3D(e.x,e.y,e.z),i.vector3D(e.x,e.y,t.z),i.vector3D(e.x,t.y,t.z),i.vector3D(e.x,t.y,e.z)],x=[i.vector3D(t.x,e.y,e.z),i.vector3D(t.x,e.y,t.z),i.vector3D(t.x,t.y,t.z),i.vector3D(t.x,t.y,e.z)];return arguments[10]?(p[0]=this.polygon3D(g,s,a,r,d,h,l,"_0_"+u,m),p[1]=this.polygon3D(_,s,a,r,d,h,l,"_1_"+u,m),p[2]=this.polygon3D(f,s,a,r,d,h,l,"_2_"+u,m),p[3]=this.polygon3D(b,s,a,r,d,h,l,"_3_"+u,m),p[4]=this.polygon3D(v,s,a,r,d,h,l,"_4_"+u,m),p[5]=this.polygon3D(x,s,a,r,d,h,l,"_5_"+u,m)):(m=arguments[arguments.length-1],p[0]=this.polygon3D(g,s,a,r,d,h,l,"_0_"+a,m),p[1]=this.polygon3D(_,s,a,r,d,h,l,"_1_"+a,m),p[2]=this.polygon3D(f,s,a,r,d,h,l,"_2_"+a,m),p[3]=this.polygon3D(b,s,a,r,d,h,l,"_3_"+a,m),p[4]=this.polygon3D(v,s,a,r,d,h,l,"_4_"+a,m),p[5]=this.polygon3D(x,s,a,r,d,h,l,"_5_"+a,m)),c?(o.addVisual(p[0]),o.addVisual(p[1]),o.addVisual(p[2]),o.addVisual(p[3]),o.addVisual(p[4]),o.addVisual(p[5])):(o.addVisual(p[5]),o.addVisual(p[4]),o.addVisual(p[0]),o.addVisual(p[1]),o.addVisual(p[2]),o.addVisual(p[3])),p},updateBox:function(e,t,s,a){e.Length<6||(this.update([i.vector3D(t.x,t.y,t.z),i.vector3D(s.x,t.y,t.z),i.vector3D(s.x,s.y,t.z),i.vector3D(t.x,s.y,t.z)],e[0],a),this.update([i.vector3D(t.x,t.y,s.z),i.vector3D(s.x,t.y,s.z),i.vector3D(s.x,s.y,s.z),i.vector3D(t.x,s.y,s.z)],e[1],a),this.update([i.vector3D(t.x,t.y,s.z),i.vector3D(s.x,t.y,s.z),i.vector3D(s.x,t.y,t.z),i.vector3D(t.x,t.y,t.z)],e[2],a),this.update([i.vector3D(t.x,s.y,s.z),i.vector3D(s.x,s.y,s.z),i.vector3D(s.x,s.y,t.z),i.vector3D(t.x,s.y,t.z)],e[3],a),this.update([i.vector3D(t.x,t.y,t.z),i.vector3D(t.x,t.y,s.z),i.vector3D(t.x,s.y,s.z),i.vector3D(t.x,s.y,t.z)],e[4],a),this.update([i.vector3D(s.x,t.y,t.z),i.vector3D(s.x,t.y,s.z),i.vector3D(s.x,s.y,s.z),i.vector3D(s.x,s.y,t.z)],e[5],a))},calcNormal:function(){var e,t;if(arguments.length>=3){var s=arguments[0],a=arguments[1],n=arguments[2],o=i.vector3DMinus(s,a),r=i.vector3DMinus(n,a),l=i.vector3DMultiply(o,r),d=i.getLength(l);d0&&(n=e(s.chartObj.chart3D).find("#"+s.chartObj.svgObject.id+"_"+i.Name)[0],s.chartObj.svgRenderer._setAttr(e(n),{d:direction}))}}};var t=new ej.Ej3DRender,i=new t.vector3D,s=new t.matrix3D,a=new t.BSPTreeBuilder,n=new t.polygon3D,o=new t.Graphics3D}(jQuery),ej.Ej3DAxisRenderer=function(){},ej.Ej3DSeriesRender=function(){},ej.Ej3DChart=function(){},ej.series3DTypes={},function(e){ej.Ej3DAxisRenderer.prototype={_drawAxes:function(e,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._drawAxisTitle(t))},_drawAxisTitle:function(t){var i,s,a,n;if(t.title.visible)if(i=t._opposed,"horizontal"==t.orientation.toLowerCase()){var o=this.model.elementSpacing+t._LableMaxWidth.height,r=ej.EjSvgRender.utils._measureText(t.title.text,t.width,t.title.font).height/2,l=e.extend({},ej.EjSvgRender.commonChartEventArgs);l.data={Text:t.title.text,location:{x:t.width/2,y:o+r+t.majorTickLines.size+t.axisLine.width+this.model.wallSize},axes:t},this._trigger("axesTitleRendering",l),s=l.data.location.x+t.x,a=i?t.y-l.data.location.y:l.data.location.y+t.y,element={Width:r.width,Height:r.height,Label:l.data,TextAnchor:"middle",tag:"text",font:t.title.font,id:this.svgObject.id+"axisTitle",child:this.chart3D},this.graphics.addVisual(this.polygon.createTextElement(this.vector.vector3D(s,a,0),element,10,10))}else{var d=ej.EjSvgRender.utils._measureText(t.title.text,t.height,t.title.font),s=i?t.x+(3*this.model.elementSpacing+t._LableMaxWidth.width+t.majorTickLines.size+t.axisLine.width):t.x-(3*this.model.elementSpacing+t._LableMaxWidth.width+t.majorTickLines.size+t.axisLine.width+this.model.wallSize),l=e.extend({},ej.EjSvgRender.commonChartEventArgs);l.data={Text:t.title.text,location:{x:d.width/2,y:0},axes:t},this._trigger("axesTitleRendering",l),a=l.data.location.y+(t.y+t.height)+t.height/-2,n=i?90:-90,element={Width:d.width,Height:d.height,Angle:-90,Label:l.data,TextAnchor:"middle",tag:"text",font:t.title.font,id:this.svgObject.id+"_YAxisTitle",child:this.chart3D},this.graphics.addVisual(this.polygon.createTextElement(this.vector.vector3D(s,a,0),element,10,10))}},_drawAxisLabel:function(e,t){for(var i=e.visibleLabels.length,s=this.model.m_AreaBounds,a=e._opposed,n=t.axes[e.name]._validCross,o=n?e.y:s.Y+(!a&&s.Height),r=n?e.x:s.X+(a&&s.Width),l=0;l0&&d2?this.model.depth-2:1,w=x?t.y:this.model.m_AreaBounds.Y+(!b&&this.model.m_AreaBounds.Height),d={opacity:t.majorGridLines.opacity,width:t.majorGridLines.width,stroke:t.majorGridLines.color,child:this.chart3D,tag:"line"};if(d.id=this.svgObject.id+t.name+"_gridlines_"+a,this.graphics.addVisual(this.polygon.createLine(d,m,g,p,_,n)),s=e.extend({},d),s.id=this.svgObject.id+t.name+"_parallelGridlines_"+a,c=this.polygon.createLine(s,p,0,p,-n,w),this.polygon.transform(this.matrixobj.tilt(parseFloat(Math.PI/2)),c),this.graphics.addVisual(c),t.minorGridLines.visible&&t.minorTicksPerInterval>0&&a2?this.model.depth-2:1,d={opacity:t.majorGridLines.opacity,width:t.majorGridLines.width,stroke:t.majorGridLines.color,axisName:t.name,child:this.chart3D,tag:"line"},d.id=this.svgObject.id+t.name+"_gridlines_"+a,this.graphics.addVisual(this.polygon.createLine(d,m,g,p,_,n)),o=x?t.x:this.model.m_AreaBounds.X+(b&&this.model.m_AreaBounds.Width+1),h=e.extend({},d),h.id=this.svgObject.id+t.name+"_parallelGridlines_"+a,c=this.polygon.createLine(h,-n,_,0,_,o),this.polygon.transform(this.matrixobj.turn(parseFloat(-Math.PI/2)),c),this.graphics.addVisual(c),t.minorGridLines.visible&&t.minorTicksPerInterval>0&&a90&&t<270)^(i>90&&i<270))},createSector:function(e,t,i,s){var a,n,o,r,l,d,h,c,u,m,p,g=parseInt(Math.ceil(e.ActualEndValue/6)),_=Math.PI/180,f=0,b=[],v=t.chartObj.model.depth;if(g<1)return null;var x=[],w=e.ActualEndValue/g,y=[],C=[];for(u=0;u0){for(d=[],u=0;u0)for(u=g;u>-1;u--)h.push(t.chartObj.vector.vector3D(C[u].X,C[u].Y,0)),c.push(t.chartObj.vector.vector3D(C[u].X,C[u].Y,v));else h.push(e.Center),c.push(t.chartObj.vector.vector3D(e.Center.x,e.Center.y,v));return x[0]=[],x[0].push(t.chartObj.polygon.polygon3D(h,this,e.index,i.borderColor,i.borderWidth,i.opacity,i.interior,f.toString()+"_Region_Series_"+s+"_Point_"+e.index,t.chartObj.chart3D)),f++,x[0].push(t.chartObj.polygon.polygon3D(c,this,e.index,i.borderColor,i.borderWidth,i.opacity,i.interior,f.toString()+"_Region_Series_"+s+"_Point_"+e.index,t.chartObj.chart3D)),f++,e.inSideRadius>0?(m=[t.chartObj.vector.vector3D(y[0].X,y[0].Y,0),t.chartObj.vector.vector3D(y[0].X,y[0].Y,v),t.chartObj.vector.vector3D(C[0].X,C[0].Y,v),t.chartObj.vector.vector3D(C[0].X,C[0].Y,0)],p=[t.chartObj.vector.vector3D(y[g].X,y[g].Y,0),t.chartObj.vector.vector3D(y[g].X,y[g].Y,v),t.chartObj.vector.vector3D(C[g].X,C[g].Y,v),t.chartObj.vector.vector3D(C[g].X,C[g].Y,0)],x[2]=[],x[2].push(t.chartObj.polygon.polygon3D(m,this,e.index,i.borderColor,i.borderWidth,i.opacity,i.interior,f.toString()+"_Region_Series_"+s+"_Point_"+e.index,t.chartObj.chart3D)),f++,x[2].push(t.chartObj.polygon.polygon3D(p,this,e.index,i.borderColor,i.borderWidth,i.opacity,i.interior,f.toString()+"_Region_Series_"+s+"_Point_"+e.index,t.chartObj.chart3D)),f++):(m=[t.chartObj.vector.vector3D(y[0].X,y[0].Y,0),t.chartObj.vector.vector3D(y[0].X,y[0].Y,v),t.chartObj.vector.vector3D(e.Center.x,e.Center.y,v),t.chartObj.vector.vector3D(e.Center.x,e.Center.y,0)],p=[t.chartObj.vector.vector3D(y[g].X,y[g].Y,0),t.chartObj.vector.vector3D(y[g].X,y[g].Y,v),t.chartObj.vector.vector3D(e.Center.x,e.Center.y,v),t.chartObj.vector.vector3D(e.Center.x,e.Center.y,0)],x[2]=[],x[2].push(t.chartObj.polygon.polygon3D(m,this,e.index,i.borderColor,i.borderWidth,i.opacity,i.interior,f.toString()+"_Region_Series_"+s+"_Point_"+e.index,t.chartObj.chart3D)),f++,x[2].push(t.chartObj.polygon.polygon3D(p,this,e.index,i.borderColor,i.borderWidth,i.opacity,i.interior,f.toString()+"_Region_Series_"+s+"_Point_"+e.index,t.chartObj.chart3D)),f++),x},createPolygons:function(t,i,s){var a,n,o,r,l,d,h,c,u,m,p=[],g=e.inArray(t,i.chartObj.model._visibleSeries);for(a=t.segments&&s?t.segments:this.createPoints(t,i),l=a.length,h=0;h0?b.X-Math.sin(v)*h:b.X+Math.sin(v)*h,f=-n.height/3):x=s.y>0?b.Y+Math.sin(v)*h:b.Y+Math.sin(-v)*h}o=this._getSegmentDepth(t),"none"==t.marker.dataLabel.shape.toLowerCase()||s.marker.dataLabel.template||""==m.data.Text||(r={tag:"dataLabel",series:t,point:s,pointIndex:i,id:this.chartObj.svgObject.id+u+"_DataLabel"+i,child:this.chartObj.chart3D},this.chartObj.graphics.addVisual(this.chartObj.polygon.createTextElement(this.chartObj.vector.vector3D(w,x,s.symbolLocation.z?s.symbolLocation.z:0),r,0,-n.height))),a=s.marker.dataLabel.template?"template":"text",r={Width:n.width,Height:n.height,Label:m.data,TextAnchor:"middle",tag:a,font:t.marker.dataLabel.font,Angle:t.marker.dataLabel.angle,id:this.chartObj.svgObject.id+"_SeriesText"+i+u,child:this.chartObj.chart3D},"none"!=this.chartObj.model.AreaType?(t.marker.dataLabel.connectorLine.height&&t.marker.dataLabel.connectorLine.height>0&&(l=[],l.push({x:b.X,y:b.Y+f,z:s.symbolLocation.z}),l.push({x:w,y:x+f,z:s.symbolLocation.z}),this.drawLineSegment(l,i,t)),this.chartObj.graphics.addVisual(this.chartObj.polygon.createTextElement(this.chartObj.vector.vector3D(w,x,s.symbolLocation.z),r,0,-n.height))):("inside"!=t.labelPosition.toLowerCase()&&this.updateConnectorLine(s,i,t,b,h),d={x:t.actualWidth,y:t.actualHeight},this.chartObj.graphics.addVisual(this.chartObj.polygon.createTextElement(this.chartObj.vector.vector3D(b.X,b.Y,-1),r,0,-n.height)))},updateConnectorLine:function(e,t,i,s,a){var n,o=[],r=e.symbolLocation,l=r.center.x+Math.cos(r.angle)*r.radius,d=r.center.y+Math.sin(r.angle)*r.radius;o.push({x:l,y:d}),n=r.radius+a,l=r.center.x+Math.cos(r.angle)*n,d=r.center.y+Math.sin(r.angle)*n,o.push({x:l,y:d}),"bezier"==i.marker.dataLabel.connectorLine.type&&(o=this.getBezierApproximation(o,256,i)),this.drawLineSegment(o,t,i)},getBezierApproximation:function(e,t,i){for(var s,a=[],n=0;n<=t;n++)s=n/t,a.push(this.GetBezierPoint(s,e,0,e.length,i));return a},drawLineSegment:function(t,i,s){for(var a=[],n=0;n1){for(i=seriesIndex;i=g&&c<=_||u>=g&&u<=_){n=i.Top<0?i.Top>m?i.Top:m:t.yAxis.valueType&&"logarithmic"==t.yAxis.valueType.toLowerCase()?i.Top:i.Topg?i.Left:g,n,a.chartObj),b=ej.EjSvgRender.utils.Transform3DToVisible(t,_>i.Right?i.Right:_,m>i.Bottom?m:i.Bottom,a.chartObj),v=a.chartObj.vector.vector3D(Math.min(f.X,b.X),Math.min(f.Y,b.Y),i.StartDepth),x=a.chartObj.vector.vector3D(Math.max(f.X,b.X),Math.max(f.Y,b.Y),i.EndDepth),w=a.chartObj.setStyle(a,t,l,s);w.interior.indexOf("url")>=0&&(w.interior=a.chartObj.model.seriesColors[l][0].color),o="Region_Series_"+l+"_Point_"+s,i.plans?a.chartObj.polygon.updateBox(i.plans,v,x,a):i.plans=a.chartObj.polygon.createBox(v,x,this,s,null,w.borderColor,w.interior,w.borderWidth,w.opacity,a.chartObj.model.requireInvertedAxes,o,a.chartObj.chart3D)}},_setData:function(){var e=arguments;point=arguments[arguments.length-1],sender=arguments[arguments.length-2],point.Left=e[0],point.Bottom=e[3],point.Top=e[1],point.Right=e[2],point.StartDepth=e[4],point.EndDepth=e[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(e,t,i){var s,a,n,o=t.chartObj._getXValues(e._visiblePoints),r=t.chartObj._getYValues(e._visiblePoints);if(null!=o)for(s=t.getSideBySideInfo(e,i),a=t._getSegmentDepth(e),crossValue=t.chartObj._getXCrossValue(e,e.xAxis,i),median=s.Delta/2,visiblePoints=e._visiblePoints,n=0;n0?(t.d=this.changePathValue(t.d),this.applyVMLStyle(e("#"+t.id),t)):(t.d=this.changePathValue(t.d),n=document.createElement("v:shape"),o=e(n),this.applyVMLStyle(o,t),o.appendTo(i))},createLegendSvg:function(e){var t=document;return this._rootId=jQuery(e).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 s,a;t.points.split(" ");e("#"+t.id).length>0?(t.points=this.changePathValue(t.points),this.applyVMLStyle(e("#"+t.id),t)):(t.points=this.changePathValue(t.points),s=document.createElement("v:polyline"),a=e(s),this.applyVMLStyle(a,t),a.appendTo(i))},setFillAttribute:function(t,i){var s,a,n=document.createElement("v:fill"),o=i["fill-opacity"]?i["fill-opacity"]:i.opacity;o=ej.util.isNullOrUndefined(o)?i.opacity?i.opacity:1:o,s=i.fill,"none"==s||ej.util.isNullOrUndefined(s)?o=.1:s.match("gradient")?(a=s.replace("gradient",""),n.setAttribute("type","gradient"),n.setAttribute("colors",a)):e(t).attr("fillcolor",s),n.setAttribute("opacity",o),e(n).appendTo(t)},setStrokeAttribute:function(t,i){var s,a,n=i.stroke;"transparent"==n&&(i.opacity=.1),i.name&&e(t).attr("name",i.name),s=i.opacity,s&&(a=document.createElement("v:stroke"),a.setAttribute("opacity",s),e(a).appendTo(t))},changePathValue:function(e){var t,i,s;if(!e.d){for(t=e.split(" "),i=0;i0)s=t.x1+","+t.y1,a=t.x2+","+t.y2,e(t).attr("from",s).attr("to",a),this.applyVMLStyle(e("#"+t.id),t);else{var n=document.createElement("v:line"),o=e(n),s=t.x1+","+t.y1,a=t.x2+","+t.y2;o.attr("from",s).attr("to",a),this.applyVMLStyle(o,t),o.appendTo(i)}},drawCircle:function(t,i){if(e("#"+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(e("#"+t.id),t);else{var s=document.createElement("v:oval"),a=e(s);t.x=t.cx-t.r,t.y=t.cy-t.r,t.width=t.height=2*t.r,this.applyVMLStyle(a,t),0==e("#"+t.id).length&&a.appendTo(i)}},drawEllipse:function(t,i){if(e("#"+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(e("#"+t.id),t);else{var s=document.createElement("v:oval"),a=e(s);t.x=t.cx-t.rx,t.y=t.cy-t.ry,t.width=2*t.rx,t.height=2*t.ry,this.applyVMLStyle(a,t),a.appendTo(i)}},drawRect:function(t,i){if(e("#"+t.id).length>0)this.applyVMLStyle(e("#"+t.id),t);else{var s=document.createElement("v:rect"),a=e(s);this.applyVMLStyle(a,t),a.appendTo(i)}},_getAttrVal:function(t,i,s){i="x"==i?"left":i,i="y"==i?"top":i; var a=e(t).attr(i),n=a?a:e(t).css(i);return null!=n?n:s},_setAttr:function(t,i){var s,a,n;i.transform&&(s=i.transform,a=s.slice(s.indexOf("(")+1,s.indexOf(")")).split(","),i.x=a[0],i.y=a[1]),n=e(t),n.length>0&&this.changeVMLStyle(n,i)},createGradientElement:function(e,t){var i,s,a,n;if("[object Array]"==Object.prototype.toString.call(t))for(i="gradient ",s="",a=0,n=t.length-1;a0?t["font-size"]+"px":t["font-size"],n={size:a,fontStyle:t["font-style"],fontFamily:t["font-weight"]},o=ej.EjSvgRender.utils._measureText(i,null,n);e(s).css("white-space","nowrap"),"middle"===t["text-anchor"]?t.x=Math.round(t.x-o.width/2):"end"===t["text-anchor"]&&(t.x=Math.round(t.x-o.width)),t.y=Math.round(t.y-n.size.replace("px","")),this.applyVMLStyle(s,t)},drawText:function(t,i,s,a){var n,o,r,l,d,h,c,u,m,p=document,g=e("#"+t.id);if(g.length>0)this._textAttrReplace(t,i,a,g);else if(t.id.indexOf("YAxisTitle")>0&&!this.isdocmode8)t.on=!0,n=document.createElement("v:line"),n.style.behavior="url(#default#VML)",n.style.display="inline-block",o=ej.EjSvgRender.utils._measureText(i,null,null),n.setAttribute("to",(t.x-1).toString()+","+(t.y-o.width/2).toString()),n.setAttribute("from",t.x.toString()+","+t.y.toString()),r=document.createElement("v:path"),r.setAttribute("textpathok",!0),l=document.createElement("v:textpath"),l.setAttribute("on",!0),l.setAttribute("string",i),l.style["font-style"]=t["font-style"],l.style["font-size"]=t["font-size"],l.style["font-family"]=t["font-family"],n.appendChild(r),n.appendChild(l),e(n).appendTo(s);else{if(d=p.createElement("span"),h=e(d),"array"==jQuery.type(i))for(this.setSpanAttr(t,i,h),c=0;c0&&n.length==i.length)for(o=0;o0&&this.ctx.stroke(),this.ctx.restore(),this.ctx=s}},drawRect:function(e,t){var i=this.ctx,s=e.rx;this.ctx=t&&t.canvas?t:this.ctx,this.ctx.save(),this.ctx.beginPath(),this.ctx.globalAlpha=e.opacity,this.ctx.lineWidth=e["stroke-width"],dashArray=!!e["stroke-dasharray"]&&e["stroke-dasharray"].split(","),dashArray&&this.ctx.setLineDash(dashArray),this.ctx.strokeStyle=e.stroke,this.ctx.rect(e.x,e.y,e.width,e.height),null!=s&&s>=0?this.drawCornerRadius(e):("none"==e.fill&&(e.fill="transparent"),this.ctx.fillStyle=e.fill,this.ctx.fillRect(e.x,e.y,e.width,e.height),this.ctx.stroke()),e.id.indexOf("Series")>=0&&this.ctx.clip(),this.ctx.restore(),this.ctx=i},drawCornerRadius:function(e){var t=e.rx,i=e.x,s=e.y,a=e.width,n=e.height;"none"==e.fill&&(e.fill="transparent"),this.ctx.fillStyle=e.fill,a<2*t&&(t=a/2),n<2*t&&(t=n/2),this.ctx.beginPath(),this.ctx.moveTo(i+a-t,s),this.ctx.arcTo(i+a,s,i+a,s+n,t),this.ctx.arcTo(i+a,s+n,i,s+n,t),this.ctx.arcTo(i,s+n,i,s,t),this.ctx.arcTo(i,s,i+a,s,t),this.ctx.closePath(),this.ctx.fill(),this.ctx.stroke()},createGradientElement:function(e,t){var i,s,a,n,o,r=this.ctx;if("[object Array]"==Object.prototype.toString.call(t)){for(s=r.createLinearGradient(0,0,0,this.svgObj.height),a=0;a<=t.length-1;a++)n=t[a].color,o=t[a].colorStop.slice(0,-1),o=parseInt(o)/100,s.addColorStop(o,n);i=s}else i=t;return i},drawLine:function(e){this.ctx.save(),this.ctx.beginPath(),this.ctx.lineWidth=e["stroke-width"],this.ctx.strokeStyle=e.stroke,this.ctx.moveTo(e.x1,e.y1),this.ctx.lineTo(e.x2,e.y2),this.ctx.stroke(),this.ctx.restore()},drawText:function(e,t){var i;ej.util.isNullOrUndefined(e["font-weight"])||"regular"!=e["font-weight"].toLowerCase()||(e["font-weight"]="normal");var s=e["font-style"].toLowerCase()+" "+e["font-weight"]+" "+e["font-size"]+" "+e["font-family"],a=e["text-anchor"],n=void 0!==e.opacity?e.opacity:1;"middle"==a&&(a="center"),e.lgndCtx?(this.lgndCtx.save(),this.lgndCtx.fillStyle=e.fill,this.lgndCtx.font=s,this.lgndCtx.textAlign=a,this.lgndCtx.globalAlpha=n,"middle"==e["dominant-baseline"]&&(this.lgndCtx.textBaseline="center"),e.labelRotation?(this.lgndCtx.translate(e.x,e.y),this.lgndCtx.rotate(e.labelRotation*Math.PI/180),this.lgndCtx.fillText(t,0,0)):this.lgndCtx.fillText(t,e.x,e.y),this.lgndCtx.restore()):(this.ctx.save(),this.ctx.fillStyle=e.fill,this.ctx.font=s,this.ctx.textAlign=a,this.ctx.globalAlpha=n,e.baseline&&(this.ctx.textBaseline=e.baseline),e.labelRotation?(i=0,90==e.labelRotation&&e.id.indexOf("XLabel")!=-1&&(i=this.ctx.measureText(t).width),this.ctx.translate(e.x+i/2,e.y),this.ctx.rotate(e.labelRotation*Math.PI/180),this.ctx.fillText(t,0,0)):this.ctx.fillText(t,e.x,e.y),this.ctx.restore())},drawZoomRect:function(t,i){var s={left:this.svgObj.offsetLeft,top:this.svgObj.offsetTop},a=e("
      "),n=i.model.m_AreaBounds;t.xs.left+e(this.svgObj).width()-20?(width=this.prevWidth,x=this.prevX):(width=this.prevWidth=t.width,x=this.prevX=t.x+s.left),t.ys.top+n.Y+n.Height?(height=this.prevHeight,y=this.prevY):(height=this.prevHeight=t.height,y=this.prevY=t.y+s.top),e(a).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(this._rootId).appendChild(a[0])},zoomButton:function(t,i){var s,a,n,o,r,l,d,h,c;s="zoom"==i?"_Zoom":"zoomIn"==i?"_ZoomIn":"_ZoomOut",a={left:this.svgObj.offsetLeft,top:this.svgObj.offsetTop},e("#"+t.zoomId).length<=0?(c=e("
      "),e(c).css({width:t.width,height:t.height,top:t.top+a.top,left:t.left+a.left,"background-color":t.fill,"border-style":"solid",position:"absolute","border-radius":"0.4em","border-color":t.fill,"box-sizing":"content-box"}),n="http://www.w3.org/2000/svg",o=document.createElementNS(n,"svg"),o.setAttribute("id",t.zoomId),o.setAttribute("width",25),o.setAttribute("height",25),"zoom"==i?(r="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",l="translate(-3,-3)"):"zoomIn"==i?(r="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",l="translate(4,4) scale(0.6)"):(r="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",l="translate(4,4) scale(0.6)"),d={id:s+"Path",fill:"#FFFFFF",transform:l,d:r},h=document.createElementNS(n,"path"),e(h).attr(d).appendTo(o),c[0].appendChild(o),document.getElementById(this._rootId).appendChild(c[0])):(c=document.getElementById(this.svgObj.id+s+"Btn"),e(c).css({top:t.top+a.top,left:t.left+a.left-20}))},panButton:function(t){var i,s,a,n,o,r={left:this.svgObj.offsetLeft,top:this.svgObj.offsetTop};e("#"+t.panId).length<=0?(o=e("
      "),e(o).css({width:t.width,height:t.height,top:t.top+r.top,left:t.left+r.left,"background-color":t.fill,"border-style":"solid",position:"absolute","border-radius":"0.4em","border-color":t.fill,"box-sizing":"content-box"}),i="http://www.w3.org/2000/svg",s=document.createElementNS(i,"svg"),s.setAttribute("id",t.panId),s.setAttribute("width",25),s.setAttribute("height",25),a={id:"panPath",fill:"#FFFFFF",transform:"translate(-3,-3)"},a.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",n=document.createElementNS(i,"polygon"),e(n).attr(a).appendTo(s),o[0].appendChild(s),document.getElementById(this._rootId).appendChild(o[0])):(o=document.getElementById(this.svgObj.id+"_PanBtn"),e(o).css({top:t.top+r.top,left:t.left+r.left-10}))},resetZoom:function(t){var i,s,a,n,o,r,l,d,h,c,u,m={left:this.svgObj.offsetLeft,top:this.svgObj.offsetTop};e("#"+t.resetZoomId).length<=0?(u=e("
      "),e(u).css({width:t.width,height:t.height,top:t.top+m.top,left:t.left+m.left,"background-color":t.fill,"border-style":"solid","border-radius":"0.4em",position:"absolute","border-color":t.fill,"box-sizing":"content-box"}),i="http://www.w3.org/2000/svg",s=document.createElementNS(i,"svg"),s.setAttribute("id",t.resetZoomId),s.setAttribute("width",25),s.setAttribute("height",25),a={id:"p1",fill:"#FFFFFF",transform:"translate(-3,-3)"},a.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",n=document.createElementNS(i,"polygon"),e(n).attr(a).appendTo(s),o={id:"p2",fill:"#FFFFFF",transform:"translate(-3,-3)"},o.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",r=document.createElementNS(i,"polygon"),e(r).attr(o).appendTo(s),l={id:"p3",fill:"#FFFFFF",transform:"translate(-3,-3)"},l.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",d=document.createElementNS(i,"polygon"),e(d).attr(l).appendTo(s),h={id:"p4",fill:"#FFFFFF",transform:"translate(-3,-3)"},h.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",c=document.createElementNS(i,"polygon"),e(c).attr(h).appendTo(s),u[0].appendChild(s),document.getElementById(this._rootId).appendChild(u[0])):(u=document.getElementById(this.svgObj.id+"_ResetZoom"),e(u).css({top:t.top+m.top,left:t.left+m.left}))},drawCrosshairLine:function(t){var i=e("
      ");e(i).css({width:t.width,height:t.height,left:t.left,top:t.top,"border-style":"solid",opacity:.5,visibility:"visible","border-color":t.stroke,"border-width":t["stroke-width"],"z-index":100}),document.getElementById(this._rootId).appendChild(i[0])},drawCrosshairlabel:function(t,i,s){var a,n={left:this.svgObj.offsetLeft,top:this.svgObj.offsetTop};e("#"+t.id).length>0?(a=document.getElementById(t.id),e(a).css({width:t.width-5,height:t.height-5,left:i.x+n.left-5,top:i.y+n.top-15,visibility:"visible",display:t.display}),document.getElementById(t.id).textContent=s):(a=e("
      "),e(a).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(a[0]))},draw_tooltip:function(t,i,s,a,n){var o,r,l,d,h,c,u,m,p=document.getElementById(this._rootId+"_canvas"),g={left:p.offsetLeft,top:p.offsetTop},_=a["stroke-width"].split("px");for(e("#secondCanvas").length?o=document.getElementById("secondCanvas"):(o=document.createElement("canvas"),e(document).find("#container").append(o),e(o).attr({id:"secondCanvas",width:p.width,height:p.height,top:g.top,left:g.left}),e(o).css({width:p.width,height:p.height,top:g.top,left:g.left,position:"absolute"})),r=o.getContext("2d"),r.lineWidth=_[0],r.beginPath(),l=a.points.split(" "),m=0;m0)if(l=document.getElementById(t.id),e(l).css({left:t.x+d.left,top:t.y+d.top,visibility:"visible","border-box":"content-box","background-color":t.fill,color:i.fill,"border-color":t.stroke,"border-width":t["stroke-width"]}),"array"==jQuery.type(s)){for(n=0,o="",r=0;r";e("#"+t.id).html(o)}else e("#"+t.id).html(s);else l=e("
      "),e(l).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-a-2*t["stroke-width"],"background-color":t.fill,"border-style":"solid","text-align":"center",padding:"0px","padding-top":a/2+"px","padding-bottom":a/2+"px","border-color":t.stroke,"border-width":t["stroke-width"],opacity:t["fill-opacity"]}),document.getElementById(this._rootId).appendChild(l[0])},trackSymbol:function(t,i,s,a,n){var o,r,l,d,h,c,u,m,p=n.model.m_AreaBounds;if(i.startX>=p.X&&i.startX<=p.X+p.Width&&i.startY>=p.Y&&i.startY<=p.Y+p.Height){if(o=t.SeriesIndex,r=t.PointIndex,"bubble"==n.model.series[o].type.toLowerCase()){var g=n.model.series[o].points[r];2*g.radius+15;t.Style.BorderColor=t.Style.Color}if("scatter"==n.model.series[o].type.toLowerCase()&&ej.util.isNullOrUndefined(a))l={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(l,null);else{d=e(e("#canvas_trackSymbol").length>0?"#canvas_trackSymbol":"
      ");var _={left:Math.round(e(this.svgObj).offset().left),top:Math.round(e(this.svgObj).offset().top)},f=e("
      "),b=i.startX+_.left-t.ShapeSize.width,v=i.startY+_.top-t.ShapeSize.height;switch(e(f).css({left:b,top:v,"box-sizing":"content-box",position:"absolute",visibility:"visible",opacity:t.Style.Opacity,"z-index":200}),h=t.ShapeSize,t.symbol=f,c={},s.toLowerCase()){case"circle":e(f).css({width:t.ShapeSize.width+"px",height:t.ShapeSize.height+"px",left:b+t.ShapeSize.width/2-t.Style.BorderWidth+"px",top:v+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":e(f).css({width:t.ShapeSize.width,height:t.ShapeSize.height,left:b+t.ShapeSize.width/2-t.Style.BorderWidth/2,top:v+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":m="M "+(i.startX+-h.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",c.direction=m,this.drawSvgShape(t,c);break;case"triangle":m="M "+(i.startX+-h.width/2)+" "+(i.startY+h.height/2)+" L "+i.startX+" "+(i.startY+-h.height/2)+" L "+(i.startX+h.width/2)+" "+(i.startY+h.height/2)+" L "+(i.startX+-h.width/2)+" "+(i.startY+h.height/2)+"z",c.direction=m,this.drawSvgShape(t,c);break;case"invertedtriangle":var m="M "+(i.startX+-h.width/2)+" "+(i.startY+h.height/2)+" L "+i.startX+" "+(i.startY+-h.height/2)+" L "+(i.startX+h.width/2)+" "+(i.startY+h.height/2)+" L "+(i.startX+-h.width/2)+" "+(i.startY+h.height/2)+"z",x=i.startX,w=i.startY,y="rotate(180,"+x+","+w+")";c.direction=m,c.rotate=y,this.drawSvgShape(t,c);break;case"cross":m="M "+(i.startX+-h.width/2)+" "+i.startY+" L "+(i.startX+h.width/2)+" "+i.startY+" M "+i.startX+" "+(i.startY+h.height/2)+" L "+i.startX+" "+(i.startY+-h.height/2)+"z",c.direction=m,this.drawSvgShape(t,c);break;case"star":m="M "+(i.startX+h.width/3)+" "+(i.startY+-h.height/2)+" L "+(i.startX+-h.width/2)+" "+(i.startY+h.height/6)+" L "+(i.startX+h.width/2)+" "+(i.startY+h.height/6)+" L "+(i.startX+-h.width/3)+" "+(i.startY+-h.height/2)+" L "+i.startX+" "+(i.startY+h.height/2)+" L "+(i.startX+h.width/3)+" "+(i.startY+-h.height/2)+"z",c.direction=m,this.drawSvgShape(t,c);break;case"hexagon":m="M "+(i.startX+-h.width/2)+" "+i.startY+" L "+(i.startX+-h.width/4)+" "+(i.startY+-h.height/2)+" L "+(i.startX+h.width/4)+" "+(i.startY+-h.height/2)+" L "+(i.startX+h.width/2)+" "+i.startY+" L "+(i.startX+h.width/4)+" "+(i.startY+h.height/2)+" L "+(i.startX+-h.width/4)+" "+(i.startY+h.height/2)+" L "+(i.startX+-h.width/2)+" "+i.startY+"z",c.direction=m,this.drawSvgShape(t,c);break;case"wedge":m="M "+(i.startX-h.width)+" "+i.startY+" L "+(i.startX+h.width)+" "+(i.startY+-h.height/2)+" L "+(i.startX+3*(h.width/4))+" "+i.startY+" L "+(i.startX+h.width)+" "+(i.startY+h.height/2)+" L "+(i.startX-h.width)+" "+i.startY+"z",c.direction=m,this.drawSvgShape(t,c);break;case"trapezoid":m="M "+(i.startX+-h.width/2)+" "+i.startY+" L "+(i.startX+-h.width/2)+" "+(i.startY+-h.height/4)+" L "+(i.startX+-h.width/2+h.width)+" "+(i.startY+-h.height/2)+" L "+(i.startX+-h.width/2+h.width)+" "+(i.startY+h.height/2)+" L "+(i.startX+-h.width/2)+" "+(i.startY+h.height/4)+" L "+(i.startX+-h.width/2)+" "+i.startY+"z",c.direction=m,this.drawSvgShape(t,c);break;case"uparrow":m="M "+(i.startX-h.width/2+h.width/4)+" "+(i.startY-h.height/2+h.height)+" L "+(i.startX-h.width/2+h.width/4)+" "+(i.startY-h.height/2+h.height/2)+" L "+(i.startX-h.width/2)+" "+(i.startY-h.height/2+h.height/2)+" L "+i.startX+" "+(i.startY-h.height/2)+" L "+(i.startX+h.width/2)+" "+(i.startY-h.height/2+h.height/2)+" L "+(i.startX+h.width/2-h.width/4)+" "+(i.startY-h.height/2+h.height/2)+" L "+(i.startX+h.width/2-h.width/4)+" "+(i.startY-h.height/2+h.height)+" L "+(i.startX-h.width/2+h.width/4)+" "+(i.startY-h.height/2+h.height)+"z",c.direction=m,this.drawSvgShape(t,c);break;case"downarrow":m="M "+(i.startX-h.width/2+h.width/4)+" "+(i.startY-h.height/2)+" L "+(i.startX+h.width/2-h.width/4)+" "+(i.startY-h.height/2)+" L "+(i.startX+h.width/2-h.width/4)+" "+(i.startY-h.height/2+h.height/2)+" L "+(i.startX+h.width/2)+" "+(i.startY-h.height/2+h.height/2)+" L "+i.startX+" "+(i.startY-h.height/2+h.height)+" L "+(i.startX-h.width/2)+" "+(i.startY-h.height/2+h.height/2)+" L "+(i.startX-h.width/2+h.width/4)+" "+(i.startY-h.height/2+h.height/2)+" L "+(i.startX-h.width/2+h.width/4)+" "+(i.startY-h.height/2)+"z",c.direction=m,this.drawSvgShape(t,c);break;case"leftarrow":m="M "+(i.startX-h.width/2+h.width)+" "+(i.startY+h.height/4)+" L "+(i.startX-h.width/2+h.width)+" "+(i.startY+-h.height/4)+" L "+(i.startX-h.width/2+h.width/2)+" "+(i.startY+-h.height/4)+" L "+(i.startX-h.width/2+h.width/2)+" "+(i.startY+-h.height/2)+" L "+(i.startX-h.width/2)+" "+i.startY+" L "+(i.startX-h.width/2+h.width/2)+" "+(i.startY+h.height/2)+" L "+(i.startX-h.width/2+h.width/2)+" "+(i.startY+h.height/4)+" L "+(i.startX-h.width/2+h.width)+" "+(i.startY+h.height/4)+"z",c.direction=m,this.drawSvgShape(t,c);break;case"rightarrow":m="M "+(i.startX-h.width/2)+" "+(i.startY+h.height/4)+" L "+(i.startX-h.width/2)+" "+(i.startY+-h.height/4)+" L "+(i.startX-h.width/2+h.width/2)+" "+(i.startY+-h.height/4)+" L "+(i.startX-h.width/2+h.width/2)+" "+(i.startY+-h.height/2)+" L "+(i.startX-h.width/2+h.width)+" "+i.startY+" L "+(i.startX-h.width/2+h.width/2)+" "+(i.startY+h.height/2)+" L "+(i.startX-h.width/2+h.width/2)+" "+(i.startY+h.height/4)+" L "+(i.startX-h.width/2)+" "+(i.startY+h.height/4)+"z",c.direction=m,this.drawSvgShape(t,c);break;case"pentagon":var C=Math.sqrt(h.height*h.height+h.width*h.width)/2,S=ej.EjSvgRender.utils._getStringBuilder();for(u=0;u<=5;u++){var T=72*u,D=Math.PI/180*T,I=C*Math.cos(D),k=C*Math.sin(D);0==u?S.append("M "+(i.startX+I)+" "+(i.startY+k)+" "):S.append("L "+(i.startX+I)+" "+(i.startY+k)+" ")}S.append("z"),m=S.toString(),c.direction=m,this.drawSvgShape(t,c);break;case"ellipse":e(f).css({width:t.ShapeSize.width,height:t.ShapeSize.height/2,"border-style":"solid",left:b+t.ShapeSize.height/2-t.Style.BorderWidth/2,top:i.startY+_.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":e(f).css({width:t.ShapeSize.width,height:0,"border-style":"solid",left:b+t.ShapeSize.width/2,top:i.startY+_.top-1,"border-color":t.Style.BorderColor,"border-width":"2px","border-box":"content-box"});break;case"vertline":e(f).css({width:0,height:t.ShapeSize.height,"border-style":"solid",left:i.startX+_.left-1,top:v+t.ShapeSize.height/2-2,"border-color":t.Style.BorderColor,"border-width":"2px","border-box":"content-box"});break;default:e(f).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"})}d[0].appendChild(f[0]),document.getElementById(this._rootId).appendChild(d[0])}}},drawSvgShape:function(t,i){var s,a,n=document.getElementById(this._rootId+"_canvas"),o=e(n).offset(),r={left:Math.round(o.left),top:Math.round(o.top)},l="http://www.w3.org/2000/svg",d=document.createElementNS(l,"svg");d.setAttribute("id","mySVG"),d.setAttribute("width",e(n).width()),d.setAttribute("height",e(n).height()),e(t.symbol).css({left:r.left+"px",top:r.top+"px"}),s={id:"svgPath","fill-opacity":t.Style.Opacity,"stroke-width":t.Style.BorderWidth,fill:t.Style.Color,transform:i.rotate,stroke:t.Style.BorderColor},s.d=i.direction,a=document.createElementNS(l,"path"),e(a).attr(s).appendTo(d),t.symbol[0].appendChild(d)},drawCircle:function(e,t){var i,s,a;e.lgndCtx?(a=this.lgndCtx,this.lgndCtx=void 0!=t?t:this.lgndCtx,this.lgndCtx.save(),this.lgndCtx.beginPath(),this.lgndCtx.arc(e.cx,e.cy,e.r,0,2*Math.PI),this.lgndCtx.fillStyle=e.fill,this.lgndCtx.globalAlpha=e.opacity,this.lgndCtx.fill(),this.lgndCtx.lineWidth=e["stroke-width"],this.lgndCtx.strokeStyle=e.stroke,this.lgndCtx.stroke(),this.lgndCtx.restore(),this.lgndCtx=a):(i=this.ctx,this.ctx=void 0!=t?t:this.ctx,this.ctx.save(),this.ctx.beginPath(),this.ctx.arc(e.cx,e.cy,e.r,0,2*Math.PI),this.ctx.fillStyle=e.fill,this.ctx.globalAlpha=e.opacity,this.ctx.fill(),this.ctx.lineWidth=e["stroke-width"],s=!!e["stroke-dasharray"]&&e["stroke-dasharray"].split(","),s&&this.ctx.setLineDash(s),this.ctx.strokeStyle=e.stroke,this.ctx.stroke(),this.ctx.restore(),this.ctx=i)},drawPolyline:function(e){var t,i;for(this.ctx.save(),this.ctx.beginPath(),t=e.points.split(" "),i=0;i0){i=0;do i++;while($(document).find("#"+this._rootId+"_svg"+i).length>0);t=this._rootId+"_svg"+i}this.svgObj.setAttribute("id",t)},function(e){function t(e,t,i,s){var a=s*Math.PI/180,n=e+i*Math.cos(a),o=t+i*Math.sin(a);return[n,o]}ej.EjSvgRender.prototype={drawPath:function(t,i){if(e("#"+t.id).length>0)e("#"+t.id).attr(t);else{var s=document.createElementNS(this.svgLink,"path");e(s).attr(t).appendTo(i)}},createLegendSvg:function(e){return this.svgLink="http://www.w3.org/2000/svg",this.legendsvgObj=document.createElementNS(this.svgLink,"svg"),this._rootId=jQuery(e).attr("id"),this.legendsvgObj.setAttribute("id","legend_"+this._rootId+"_svg"),this.legendsvgObj},drawPolyline:function(t,i){if(e("#"+t.id).length>0)e("#"+t.id).attr(t);else{var s=document.createElementNS(this.svgLink,"polyline");e(s).attr(t).appendTo(i)}},drawLine:function(t,i){if(e("#"+t.id).length>0)e("#"+t.id).attr(t);else{var s=document.createElementNS(this.svgLink,"line");e(s).attr(t),e(s).appendTo(i)}},drawPolygon:function(t,i){if(e("#"+t.id).length>0)e("#"+t.id).attr(t);else{var s=document.createElementNS(this.svgLink,"polygon");e(s).attr(t),e(s).appendTo(i)}},drawCircle:function(t,i){if(e("#"+t.id).length>0)e("#"+t.id).attr(t);else{var s=document.createElementNS(this.svgLink,"circle");e(s).attr(t).appendTo(i)}},drawEllipse:function(t,i){if(e("#"+t.id).length>0)e("#"+t.id).attr(t);else{var s=document.createElementNS(this.svgLink,"ellipse");e(s).attr(t).appendTo(i)}},drawRect:function(t,i){ if(e("#"+t.id).length>0)e("#"+t.id).attr(t);else{var s=document.createElementNS(this.svgLink,"rect");e(s).attr(t).appendTo(i)}},createGradientElement:function(e,t,i,s,a,n,o){var r,l,d;return"[object Array]"==Object.prototype.toString.call(t)?(l={id:this.svgObj.id+"_"+e+"Gradient",x1:i+"%",y1:s+"%",x2:a+"%",y2:n+"%"},d="#"+this.svgObj.id+"_"+e+"Gradient",this.drawGradient(l,t,o),r="url(#"+this.svgObj.id+"_"+e+"Gradient)"):r=t,r},drawGradient:function(t,i,s){var a,n,o=this.createDefs(),r=document.createElementNS(this.svgLink,"linearGradient");for(e(r).attr(t),a=0;a0)this._textAttrReplace(t,i,a);else{if(n=document.createElementNS(this.svgLink,"text"),o=e(n),"array"==jQuery.type(i))for(r=0,o.attr(t),l=0;l0&&a.length==i.length)for(o=0;o").attr("id","template_group_"+u),o.css("position","relative").css("z-index",1e3),r=e("#"+s.marker.dataLabel.template).clone(),e(r).attr("id",s.marker.dataLabel.template+"_"+m+"_"+i+"_"+u),l=e(r),l.css("position","absolute"),t.count=1,d={series:s,point:t},l.html(l.html().parseTemplate(d)),h="cartesianaxes"!=c&&s.enableAnimation&&"pyramid"!=s.type.toLowerCase()&&"funnel"!=s.type.toLowerCase()?"none":"block",l.css("display",h).appendTo(e(o)),e(o).appendTo("#"+u),t.size={height:l.height(),width:l.width()},a?((ej.util.isNullOrUndefined(s.LeftLabelMaxHeight)||s.LeftLabelMaxHeight0&&t.xValue){var i=t.xValue-o[e-1].xValue;0!=i&&(n=Math.min(n,i))}}))}),n==Number.MAX_VALUE&&(n=1),n},_getSeriesMaxLabel:function(t){var i,s,a,n,o={width:0,height:0},r=e(this.svgObject).width(),l=[];if(t.labels.length>0){for(s=0;so?o:C.width),C.rows=1,C.maxWidth=C.width,C.maxHeight=C.height,!D&&(E||k)&&(r=0,"rotate45"==k?r=45:"rotate90"==k&&(r=90),E=null!=E||"vertical"==R?E:r,t.rotationValue=E,E)){if(S=ej.isNullOrUndefined(S)?"":S,labeltextWidth=this._measureText(S,e(this.svgObject).width(),t.font,t.labelRotation),t.enableTrim&&labeltextWidth.width>o&&""!=S)for(h=S,l=1;l=o){h=h.toString().substring(0,l-1)+"... ",S=h;break}maxSize=this.rotatedLabel(t,s,E,S),t.labelIntersectAction&&"multiplerows"==t.labelIntersectAction.toLowerCase()&&(A=C.height+maxSize.height),C.height=maxSize.height,C.width=maxSize.width}if(t.labelIntersectAction)if("wrap"==k||"wrapbyword"==k)P=P?P:ej.datavisualization.Chart.LabelPlacement.BetweenTicks,c=t.labels.length>1&&"betweenticks"==P.toLowerCase()?-.5:0,u=t.labels.length>1&&c<0?1+c:N[1].Value,u=O?parseFloat(u.toFixed(O)):parseFloat(u.toFixed(0==ej.EjSvgRender.utils._decimalPlaces(I.interval)?1:ej.EjSvgRender.utils._decimalPlaces(I.interval))),m=Math.ceil((u-I.min)/(I.max-I.min)*t.length),p=Math.round(C.width/m),C.rows=E?p-T:p+T,C.height=C.height+p*C.height;else if("multiplerows"==k){var F=s._getLegendSpace(),B=s.model.border.width,H=(s.model._axes[1],e(s.svgObject).width()-s.model.margin.left-s.model.margin.right),V=""!=t.title.text&&t.visible?this._measureText(t.title.text,H,t.title.font).height+2*s.model.elementSpacing:0,U=s.model.elementSpacing+V+t.majorTickLines.size+t.axisLine.width,W=s._getYValues(s.model._visibleSeries[0].points),G=Math.max.apply(Math,W),Y=s.model._axes[1],n=this._measureText(G,e(this.svgObject).width(),Y.font,Y.labelRotation),X=F.rightLegendWidth+U+n.width+s.model.margin.right+s.model.margin.left+2*B,$=e(s.svgObject).width()-X;if(M){for(g=0,a=0;aK-d/2&&!ej.util.isNullOrUndefined(_.y))g=_.y+q,_.y+=q,b+1==j.length&&(f=!0);else if(v+1==j[b].length){f=!0;break}}_.y=g,p=g/q-1,void 0==j[p]&&(j[p]=[]),j[p].push(_)}A=j.length*q,C.height=C.height>A?C.height:A,C.rows=L?Math.round((A+q)/q):Math.round(A/q),C.rows=E?C.rows-1:C.rows,C.rows<1&&(C.rows=1)}if(!M){for(x=0,a=0;aK-q/2&&t.visibleLabels[i].y==_.y&&(x=_.y+d,_.y=x);y=x}C.width=C.width+y+5}}}return C},rotatedLabel:function(e,t,i,s){var a={"font-size":e.font.size,transform:"rotate("+i+",0,0)","font-family":e.font.fontFamily,"font-style":e.font.fontStyle,rotateAngle:"rotate("+i+"deg)","text-anchor":"middle"},n=t.svgRenderer.createText(a,s),o=Math.ceil(this._measureBounds(n,t).height),r=Math.ceil(this._measureBounds(n,t).width);return{height:o,width:r}},_getTransform:function(e,t,i){var s,a,n,o;return i?(s=t.x,a=e.y,n=t.width,o=e.height):(s=e.x,a=t.y,n=e.width,o=t.height),{x:s,y:a,width:n,height:o}},_measureText:function(t,i,s){var a,n,o,r,l,d=e(document).find("#measureTex");e("#measureTex").css("display","block"),0==d.length?(a=document.createElement("text"),e(a).attr({id:"measureTex"}),document.body.appendChild(a)):a=d[0];var h=null,c=null,u=null,m=null;if("string"==typeof t&&(t.indexOf("<")>-1||t.indexOf(">")>-1)){for(n=t.split(" "),o=0;o")==-1&&(n[o]=n[o].replace(/[<>]/g,"&"));t=n.join(" ")}return a.innerHTML=t,void 0!=s&&void 0==s.size&&(r=s,r=r.split(" "),h=r[0],c=r[1],u=r[2],m=r[3]),null!=s&&(a.style.fontSize=s.size>0?s.size+"px":s.size?s.size:c,a.style.fontStyle&&(a.style.fontStyle=s.fontStyle?s.fontStyle:h),a.style.fontFamily=s.fontFamily?s.fontFamily:u,window.navigator.userAgent.indexOf("MSIE 8.0")==-1&&(a.style.fontWeight=s.fontWeight?s.fontWeight:m)),a.style.backgroundColor="white",a.style.position="absolute",a.style.top=-100,a.style.left=0,a.style.visibility="hidden",a.style.whiteSpace="nowrap",i&&(a.style.maxwidth=i+"px"),l={width:a.offsetWidth,height:a.offsetHeight},e("#measureTex").css("display","none"),l},_trimText:function(e,t,i){var s,a,n,o;for(a=e.toString(),n=a.length,o=1;o=t)return a.substring(0,o-1)+"... ";return e},_measureBounds:function(t,i){i.model.enableCanvasRendering?e(document.body).append(t):(i.svgRenderer.append(t,i.svgObject),i.svgRenderer.append(i.svgObject,i.element));var s=t.getBoundingClientRect(),a={left:s.left,right:s.right,top:s.top,bottom:s.bottom,width:s.right-s.left,height:s.bottom-s.top};return e(t).remove(),a},_drawAxesBoundsClipPath:function(t,i,s){var a,n=e(t),o=this._getTransform(i.xAxis,i.yAxis,s.model.requireInvertedAxes),r="polaraxes"==s.model.AreaType?e(s.svgObject).width():o.width,l="polaraxes"==s.model.AreaType?e(s.svgObject).height():o.height,d=s.model.requireInvertedAxes?i.yAxis.plotOffset:i.xAxis.plotOffset,h=s.model.requireInvertedAxes?i.xAxis.plotOffset:i.yAxis.plotOffset;"polaraxes"==s.model.AreaType?(a={id:t?t.id+"_ClipRect":"",cx:s.model.centerX,cy:s.model.centerY,r:s.model.Radius,fill:"white","stroke-width":1,stroke:"transparent"},s.svgRenderer.drawCircularClipPath(a,t)):(a={id:t?t.id+"_ClipRect":"",x:0-d,y:0-h,width:r+2*d,height:l+2*h,fill:"white","stroke-width":1,stroke:"transparent"},s.svgRenderer.drawClipPath(a,t)),n.attr("clip-path","url(#"+a.id+")")},_getStringBuilder:function(){var e=[],t=0;return{append:function(i){return e[t++]=i,this},remove:function(t,i){return e.splice(t,i||1),this},insert:function(t,i){return e.splice(t,0,i),this},toString:function(t){return e.join(t||"")}}},_addRegion:function(t,i,s,a,n){var o,r=s.type,l=e.inArray(s,t.model._visibleSeries);l>=0&&(o={SeriesIndex:l,Region:{PointIndex:n,Bounds:i},type:r},t.model.chartRegions.push(o))},AddRegion:function(e,t,i){if(i){var s={isStripLine:i,Region:{Bounds:t}};e.model.chartRegions.push(s)}},_getSvgXY:function(e,t,i,s){var a,n;return s.model.requireInvertedAxes?(a=e+i.yAxis.x,n=t+i.xAxis.y):(a=e+i.xAxis.x,n=t+i.yAxis.y),{X:a,Y:n}},_getPoint:function(e,t){var i=e.xValue,s=e.YValues[0],a="logarithmic"==t.xAxis._valueType?ej.EjSvgRender.utils._logBase(0==i?1:i,t.xAxis.logBase):i,n="logarithmic"==t.yAxis._valueType?ej.EjSvgRender.utils._logBase(0==s?1:s,t.xAxis.logBase):s;return t._isTransposed?(a=(1-this._getPointXY(a,t.xAxis.visibleRange,t.xAxis.isInversed))*t.xAxis.height,n=this._getPointXY(n,t.yAxis.visibleRange,t.yAxis.isInversed)*t.yAxis.width,e.location={X:n,Y:a},e.location):(a=this._getPointXY(a,t.xAxis.visibleRange,t.xAxis.isInversed)*t.xAxis.width,n=(1-this._getPointXY(n,t.yAxis.visibleRange,t.yAxis.isInversed))*t.yAxis.height,e.location={X:a,Y:n},e.location)},_getPointXY:function(e,t,i){var s=0;return s=(e-t.min)/t.delta,i?1-s:s},_dateTimeLabelFormat:function(e){var t="d";return"years"==e.toLowerCase()?t="MMM, yyyy":"months"==e.toLowerCase()?t="dd, MMM":"days"==e.toLowerCase()?t="MM/dd/yyyy":"hours"==e.toLowerCase()?t="dd, hh:mm":"seconds"==e.toLowerCase()||"minutes"==e.toLowerCase()?t="hh:mm:ss":"milliseconds"==e.toLowerCase()&&(t="hh:mm:ss:tt"),t},_getFontString:function(e){return null==e&&(e={}),e.FontFamily||(e.FontFamily="Arial"),e.FontStyle||(e.FontStyle="Normal"),e.Size||(e.Size="12px"),e.FontStyle+" "+e.Size+" "+e.FontFamily},_valueToVector:function(e,t){return this._coefficientToVector(this._valueToPolarCoefficient(e,t))},TransformToVisible:function(e,t,i,s){t="logarithmic"==e.xAxis._valueType&&t>0?Math.log(t,e.xAxis.logBase):t,i="logarithmic"==e.xAxis._valueType&&i>0?Math.log(i,e.yAxis.logBase):i;var a=s.model.Radius*this._valueToCoefficient(e.yAxis,i),n=this._valueToVector(e.xAxis,t);return{X:s.model.centerX+a*n.X,Y:s.model.centerY+a*n.Y}},Transform3DToVisible:function(e,t,i,s){var a,n;if(null!=e.xAxis&&null!=e.yAxis){if(a=e.xAxis._valueType.toLowerCase(),n="logarithmic"==a,t=t=n&&t>0?math.log(t,xlogarithmicBase):t,i=i,s.model.requireInvertedAxes){var o=s.model.m_AreaBounds.X,r=s.model.m_AreaBounds.Y,l=o+e.yAxis.width*ej.EjSvgRender.utils._valueToCoefficient(e.yAxis,i,s),d=r+e.xAxis.height*(1-ej.EjSvgRender.utils._valueToCoefficient(e.xAxis,t,s));return{X:l,Y:d}}var o=e.xAxis.x,r=e.yAxis.y,t=o+Math.round(e.xAxis.width*ej.EjSvgRender.utils._valueToCoefficient(e.xAxis,t,s)),i=r+Math.round(e.yAxis.height*(1-ej.EjSvgRender.utils._valueToCoefficient(e.yAxis,i,s)));return{X:t,Y:i}}return new Point(0,0)},_valueToPolarCoefficient:function(e,t){var i,s,a=e.visibleRange.min;return"category"!=e._valueType?(i=e.visibleRange.max-e.visibleRange.interval-e.visibleRange.min,s=e.visibleLabels.length-1):(i=e.visibleRange.delta,s=e.visibleLabels.length),result=(t-a)/i,result*=1-1/s,e.isInversed?result:1-result},_coefficientToVector:function(e){var t=Math.PI*(1.5-2*e);return{X:Math.cos(t),Y:Math.sin(t)}},_valueToCoefficient:function(e,t,i){var s;return s=i&&"polaraxes"==i.model.AreaType?t:e._valueType&&"logarithmic"==e._valueType.toLowerCase()?ej.EjSvgRender.utils._logBase(0==t?1:t,e.logBase):t,s=(s-e.visibleRange.min)/e.visibleRange.delta,e.isInversed?1-s:s},_getBoundingClientRect:function(t,i,s,a){var n,o,r,l,d=t.getBoundingClientRect(),h=e("#"+i.svgObject.id)[0].getBoundingClientRect();return a?(n=this._getTransform(s.xAxis,s.yAxis,!0).x,o=this._getTransform(s.xAxis,s.yAxis,!0).y):(n=this._getTransform(s.xAxis,s.yAxis,!1).x,o=this._getTransform(s.xAxis,s.yAxis,!1).y),r=d.left-(n+h.left),l=d.top-(o+h.top),{x:r,y:l,width:d.right-d.left,height:d.bottom-d.top}},_minMax:function(e,t,i){return e>i?i:e=t.min)},_logBase:function(e,t){return Math.log(e)/Math.log(t)},_correctRect:function(e,t,i,s){return{X:Math.min(e,i),Y:Math.min(t,s),Width:Math.abs(i-e),Height:Math.abs(s-t)}},_getValuebyPoint:function(e,t,i){var s=this.chartObj.model.requireInvertedAxes?i.xAxis.height:i.xAxis.width,a=this.chartObj.model.requireInvertedAxes?i.yAxis.width:i.yAxis.height,n=i.xAxis.isInversed?1-e/s:e/s,o=i.yAxis.isInversed?1-t/a:t/a;return n=n*i.xAxis.visibleRange.delta+i.xAxis.visibleRange.min,o=o*i.yAxis.visibleRange.delta+i.yAxis.visibleRange.min,n="logarithmic"==i.xAxis._valueType?Math.pow(i.xAxis.logBase,n):n,o="logarithmic"==i.yAxis._valueType?Math.pow(i.yAxis.logBase,o):o,{PointX:n,PointY:o}}},ej.EjSvgRender.chartTransform3D={ToRadial:Math.PI/180,transform3D:function(e){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:e,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(e){this.setCenter(this.vector.vector3D(e.mViewport.Width/2,e.mViewport.Height/2,e.Depth/2),e),this.setViewMatrix(this.matrixobj.transform(0,0,e.Depth),e),this.setViewMatrix(this.matrixobj.getMatrixMultiplication(e.viewMatrix,this.matrixobj.turn(-this.ToRadial*e.Rotation)),e),this.setViewMatrix(this.matrixobj.getMatrixMultiplication(e.viewMatrix,this.matrixobj.tilt(-this.ToRadial*e.Tilt)),e),this.updatePerspective(e.PerspectiveAngle,e),e.needUpdate=!0},updatePerspective:function(e,t){var i=(t.mViewport.Width+t.mViewport.Height)*Math.tan(this.degreeToRadianConverter((180-Math.abs(e%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(e){return e*Math.PI/180},toScreen:function(e,t){return e=this.matrixobj.getMatrixVectorMutiple(this.result(t),e),{x:e.x,y:e.y}},setViewMatrix:function(e,t){t.viewMatrix!=e&&(t.viewMatrix=e,t.needUpdate=!0)},setCenteredMatrix:function(e,t){t.viewMatrix!=e&&(t.centeredMatrix=e,t.needUpdate=!0)},result:function(e){return e.needUpdate?(e.resultMatrix=this.matrixobj.getMatrixMultiplication(this.matrixobj.getInvertal(e.centeredMatrix),e.Perspective),e.resultMatrix=this.matrixobj.getMatrixMultiplication(e.resultMatrix,e.viewMatrix),e.resultMatrix=this.matrixobj.getMatrixMultiplication(e.resultMatrix,e.centeredMatrix),e.needUpdate=!1,e.resultMatrix):e.resultMatrix},setCenter:function(e,t){t.centeredMatrix=this.matrixobj.transform(-e.x,-e.y,-e.z),t.needUpdate=!0},toPlane:function(e,t,i){var s=this.vector.vector3D(e.x,e.y,0),a=this.vector.vector3DPlus(s,vector.vector3D(0,0,1));return s=this.vector.vector3DMultiply(i.centeredMatrix,s),a=this.vector.vector3DMultiply(i.centeredMatrix,a),s=this.vector.vector3DMultiply(this.matrixobj.getInvertal(i.Perspective),s),a=this.vector.vector3DMultiply(this.matrixobj.getInvertal(i.Perspective),a),s=this.polygon.getPoint(s,this.vector.vector3DMinus(a-s)),s=this.vector.vector3DMultiply(this.matrixobj.getInvertal(i.viewMatrix),s),this.vector.vector3DMultiply(this.matrixobj.getInvertal(i.centeredMatrix),s)}},ej.EjSvgRender.chartSymbol={_drawSeriesType:function(e,t,i){var s=i.model.series[t.SeriesIndex].type.toLowerCase(),a=i.legendItem.drawType;switch(s=ej.util.isNullOrUndefined(a)?s:a){case ej.datavisualization.Chart.Type.Line:return ej.util.isNullOrUndefined(a)?this._drawLine(e,t,i,i.gLegendItemEle):this._drawStraightLine(e,t,i,i.gLegendItemEle);case ej.datavisualization.Chart.Type.StepLine:return this._drawStepLine(e,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(e,t,i,i.gLegendItemEle);case ej.datavisualization.Chart.Type.StepArea:return this._drawStepArea(e,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(e,t,i,i.gLegendItemEle);case ej.datavisualization.Chart.Type.Pie:return this._drawPie(e,t,i,i.gLegendItemEle);case ej.datavisualization.Chart.Type.Doughnut:return this._drawDoughnut(e,t,i,i.gLegendItemEle);case ej.datavisualization.Chart.Type.Hilo:return this._drawHilo(e,t,i,i.gLegendItemEle);case ej.datavisualization.Chart.Type.HiloOpenClose:return this._drawHiloOpenClose(e,t,i,i.gLegendItemEle);case ej.datavisualization.Chart.Type.Candle:return this._drawCandle(e,t,i,i.gLegendItemEle);case ej.datavisualization.Chart.Type.Pyramid:return this._drawPyramid(e,t,i,i.gLegendItemEle);case ej.datavisualization.Chart.Type.Funnel:return this._drawFunnel(e,t,i,i.gLegendItemEle);case ej.datavisualization.Chart.Type.Spline:return this._drawSpline(e,t,i,i.gLegendItemEle);case ej.datavisualization.Chart.Type.SplineArea:return this._drawSplineArea(e,t,i,i.gLegendItemEle);case ej.datavisualization.Chart.Type.RangeColumn:return this._drawRangeColumn(e,t,i,i.gLegendItemEle);case ej.datavisualization.Chart.Type.Bubble:case ej.datavisualization.Chart.Type.Scatter:return this._drawCircle(e,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(e,t,i,i.gLegendItemEle);default:return this._drawRectangle(e,t,i,i.gLegendItemEle)}},_drawCircle:function(e,t,i,s){var a=i.svgRenderer,n=(i.svgObject,t.ShapeSize),o=Math.sqrt(n.height*n.height+n.width*n.width)/2,r=t.Style,l={id:t.ID,cx:e.startX,cy:e.startY,r:o,fill:r.Color,"stroke-width":r.BorderWidth,stroke:r.BorderColor,opacity:r.Opacity,visibility:r.Visibility,lgndCtx:t.context};return a.drawCircle(l,s),e.startX-o},_drawLeftArrow:function(e,t,i,s){var a,n,o=i.svgRenderer,r=(i.svgObject,t.ShapeSize);a="M "+(e.startX-r.width/2+r.width)+" "+(e.startY+r.height/4)+" L "+(e.startX-r.width/2+r.width)+" "+(e.startY+-r.height/4)+" L "+(e.startX-r.width/2+r.width/2)+" "+(e.startY+-r.height/4)+" L "+(e.startX-r.width/2+r.width/2)+" "+(e.startY+-r.height/2)+" L "+(e.startX-r.width/2)+" "+e.startY+" L "+(e.startX-r.width/2+r.width/2)+" "+(e.startY+r.height/2)+" L "+(e.startX-r.width/2+r.width/2)+" "+(e.startY+r.height/4)+" L "+(e.startX-r.width/2+r.width)+" "+(e.startY+r.height/4)+" z",n={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:a},o.drawPath(n,s)},_drawRightArrow:function(e,t,i,s){var a,n,o=i.svgRenderer,r=(i.svgObject,t.ShapeSize);a="M "+(e.startX-r.width/2)+" "+(e.startY+r.height/4)+" L "+(e.startX-r.width/2)+" "+(e.startY+-r.height/4)+" L "+(e.startX-r.width/2+r.width/2)+" "+(e.startY+-r.height/4)+" L "+(e.startX-r.width/2+r.width/2)+" "+(e.startY+-r.height/2)+" L "+(e.startX-r.width/2+r.width)+" "+e.startY+" L "+(e.startX-r.width/2+r.width/2)+" "+(e.startY+r.height/2)+" L "+(e.startX-r.width/2+r.width/2)+" "+(e.startY+r.height/4)+" L "+(e.startX-r.width/2)+" "+(e.startY+r.height/4)+" z",n={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:a},o.drawPath(n,s)},_drawUpArrow:function(e,t,i,s){var a,n,o=i.svgRenderer,r=(i.svgObject,t.ShapeSize);a="M "+(e.startX-r.width/2+r.width/4)+" "+(e.startY-r.height/2+r.height)+" L "+(e.startX-r.width/2+r.width/4)+" "+(e.startY-r.height/2+r.height/2)+" L "+(e.startX-r.width/2)+" "+(e.startY-r.height/2+r.height/2)+" L "+e.startX+" "+(e.startY-r.height/2)+" L "+(e.startX+r.width/2)+" "+(e.startY-r.height/2+r.height/2)+" L "+(e.startX+r.width/2-r.width/4)+" "+(e.startY-r.height/2+r.height/2)+" L "+(e.startX+r.width/2-r.width/4)+" "+(e.startY-r.height/2+r.height)+" L "+(e.startX-r.width/2+r.width/4)+" "+(e.startY-r.height/2+r.height)+" z",n={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:a},o.drawPath(n,s)},_drawDownArrow:function(e,t,i,s){var a,n,o=i.svgRenderer,r=(i.svgObject,t.ShapeSize);a="M "+(e.startX-r.width/2+r.width/4)+" "+(e.startY-r.height/2)+" L "+(e.startX+r.width/2-r.width/4)+" "+(e.startY-r.height/2)+" L "+(e.startX+r.width/2-r.width/4)+" "+(e.startY-r.height/2+r.height/2)+" L "+(e.startX+r.width/2)+" "+(e.startY-r.height/2+r.height/2)+" L "+e.startX+" "+(e.startY-r.height/2+r.height)+" L "+(e.startX-r.width/2)+" "+(e.startY-r.height/2+r.height/2)+" L "+(e.startX-r.width/2+r.width/4)+" "+(e.startY-r.height/2+r.height/2)+" L "+(e.startX-r.width/2+r.width/4)+" "+(e.startY-r.height/2)+" z",n={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:a},o.drawPath(n,s)},_drawCross:function(e,t,i,s){var a,n,o=i.svgRenderer,r=(i.svgObject,t.ShapeSize);a="M "+(e.startX+-r.width/2)+" "+e.startY+" L "+(e.startX+r.width/2)+" "+e.startY+" M "+e.startX+" "+(e.startY+r.height/2)+" L "+e.startX+" "+(e.startY+-r.height/2),n={id:t.ID,opacity:t.Style.Opacity,"stroke-width":t.Style.BorderWidth,stroke:t.Style.Color,visibility:t.Style.Visibility,lgndCtx:t.context,d:a},o.drawPath(n,s)},_drawHorizLine:function(e,t,i,s){var a,n,o=i.svgRenderer,r=(i.svgObject,t.ShapeSize);a="M "+(e.startX+-r.width/2)+" "+e.startY+" L "+(e.startX+r.width/2)+" "+e.startY,n={id:t.ID,opacity:t.Style.Opacity,"stroke-width":t.Style.BorderWidth,stroke:t.Style.Color,visibility:t.Style.Visibility,lgndCtx:t.context,d:a},o.drawPath(n,s)},_drawVertLine:function(e,t,i,s){var a,n,o=i.svgRenderer,r=(i.svgObject,t.ShapeSize);a="M "+e.startX+" "+(e.startY+r.height/2)+" L "+e.startX+" "+(e.startY+-r.height/2),n={id:t.ID,opacity:t.Style.Opacity,"stroke-width":t.Style.BorderWidth,stroke:t.Style.Color,visibility:t.Style.Visibility,lgndCtx:t.context,d:a},o.drawPath(n,s)},_drawTriangle:function(e,t,i,s){var a,n,o=i.svgRenderer,r=(i.svgObject,t.ShapeSize);a="M "+(e.startX+-r.width/2)+" "+(e.startY+r.height/2)+" L "+e.startX+" "+(e.startY+-r.height/2)+" L "+(e.startX+r.width/2)+" "+(e.startY+r.height/2)+" L "+(e.startX+-r.width/2)+" "+(e.startY+r.height/2)+" z",n={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:a},o.drawPath(n,s)},_drawInvertedTriangle:function(e,t,i,s){var a=i.svgRenderer,n=(i.svgObject,t.ShapeSize),o="M "+(e.startX+n.width/2)+" "+(e.startY-n.height/2)+" L "+e.startX+" "+(e.startY+n.height/2)+" L "+(e.startX-n.width/2)+" "+(e.startY-n.height/2)+" L "+(e.startX+n.width/2)+" "+(e.startY-n.height/2)+" z",r=(e.startX,e.startY,{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:o});a.drawPath(r,s)},_drawHexagon:function(e,t,i,s){var a,n,o=i.svgRenderer,r=(i.svgObject,t.ShapeSize);a="M "+(e.startX+-r.width/2)+" "+e.startY+" L "+(e.startX+-r.width/4)+" "+(e.startY+-r.height/2)+" L "+(e.startX+r.width/4)+" "+(e.startY+-r.height/2)+" L "+(e.startX+r.width/2)+" "+e.startY+" L "+(e.startX+r.width/4)+" "+(e.startY+r.height/2)+" L "+(e.startX+-r.width/4)+" "+(e.startY+r.height/2)+" L "+(e.startX+-r.width/2)+" "+e.startY+" z",n={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:a},o.drawPath(n,s)},_drawWedge:function(e,t,i,s){var a,n,o=i.svgRenderer,r=(i.svgObject,t.ShapeSize);a="M "+(e.startX-r.width)+" "+e.startY+" L "+(e.startX+r.width)+" "+(e.startY+-r.height/2)+" L "+(e.startX+3*(r.width/4))+" "+e.startY+" L "+(e.startX+r.width)+" "+(e.startY+r.height/2)+" L "+(e.startX-r.width)+" "+e.startY+" z",n={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:a},o.drawPath(n,s)},_drawPentagon:function(e,t,i,s){for(var a,n,o=i.svgRenderer,r=(i.svgObject,t.ShapeSize),l=Math.sqrt(r.height*r.height+r.width*r.width)/2,d=ej.EjSvgRender.utils._getStringBuilder(),h=0;h<=5;h++){var c=72*h,u=Math.PI/180*c,m=l*Math.cos(u),p=l*Math.sin(u);0==h?d.append("M "+(e.startX+m)+" "+(e.startY+p)+" "):d.append("L "+(e.startX+m)+" "+(e.startY+p)+" ")}d.append("z"),a=d.toString(),n={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:a},o.drawPath(n,s)},_drawStar:function(e,t,i,s){var a,n,o=i.svgRenderer,r=t.ShapeSize;i.svgObject;a="M "+(e.startX+r.width/3)+" "+(e.startY+-r.height/2)+" L "+(e.startX+-r.width/2)+" "+(e.startY+r.height/6)+" L "+(e.startX+r.width/2)+" "+(e.startY+r.height/6)+" L "+(e.startX+-r.width/3)+" "+(e.startY+-r.height/2)+" L "+e.startX+" "+(e.startY+r.height/2)+" L "+(e.startX+r.width/3)+" "+(e.startY+-r.height/2)+" z",n={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:a},o.drawPath(n,s)},_drawRectangle:function(e,t,i,s){var a,n,o=i.svgRenderer,r=(i.svgObject,t.ShapeSize);a="M "+(e.startX+-r.width/2)+" "+(e.startY+-r.height/2)+" L "+(e.startX+r.width/2)+" "+(e.startY+-r.height/2)+" L "+(e.startX+r.width/2)+" "+(e.startY+r.height/2)+" L "+(e.startX+-r.width/2)+" "+(e.startY+r.height/2)+" L "+(e.startX+-r.width/2)+" "+(e.startY+-r.height/2)+" z",n={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:a},o.drawPath(n,s)},_drawTrapezoid:function(e,t,i,s){var a,n,o=i.svgRenderer,r=(i.svgObject,t.ShapeSize);a="M "+(e.startX+-r.width/2)+" "+e.startY+" L "+(e.startX+-r.width/2)+" "+(e.startY+-r.height/4)+" L "+(e.startX+-r.width/2+r.width)+" "+(e.startY+-r.height/2)+" L "+(e.startX+-r.width/2+r.width)+" "+(e.startY+r.height/2)+" L "+(e.startX+-r.width/2)+" "+(e.startY+r.height/4)+" L "+(e.startX+-r.width/2)+" "+e.startY+" z",n={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:a},o.drawPath(n,s)},_drawDiamond:function(e,t,i,s){var a,n,o=i.svgRenderer,r=(i.svgObject,t.ShapeSize);a="M "+(e.startX+-r.width/2)+" "+e.startY+" L "+e.startX+" "+(e.startY+-r.height/2)+" L "+(e.startX+r.width/2)+" "+e.startY+" L "+e.startX+" "+(e.startY+r.height/2)+" L "+(e.startX+-r.width/2)+" "+e.startY+" z",n={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:a},o.drawPath(n,s)},_drawEllipse:function(e,t,i,s){var a=i.svgRenderer,n=(i.svgObject,t.ShapeSize),o=e.startX,r=e.startY,l={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:o,cy:r,rx:n.width,ry:n.height/2};a.drawEllipse(l,s)},_drawImage:function(e,t,i,s){var a=i.svgRenderer,n=i.svgObject,o=t.ShapeSize,r=e.startX+-o.width/2,l=e.startY+-o.width/2,d=o.width,h=o.height,c={id:n.id+"_image"+t.PointIndex,height:h,width:d,href:t.Imageurl,x:r,y:l,visibility:"visible",lgndCtx:t.context};a.drawImage(c,s)},_drawStraightLine:function(e,t,i,s){var a,n,o=i.svgRenderer,r=(i.svgObject,t.ShapeSize),l=t.ElementSpace;return a="M "+(e.startX+-r.width/2+-l/4)+" "+(e.startY+r.height/10)+" L "+(e.startX+r.width/2+l/4)+" "+(e.startY+r.height/10),n={id:t.ID,fill:t.Style.Color,"stroke-width":2*t.Style.BorderWidth,stroke:t.Style.Color,opacity:t.Style.Opacity,visibility:t.Style.Visibility,d:a,lgndCtx:!0},o.drawPath(n,s),e.startX+-r.width/2+-l/4},_drawLine:function(e,t,i,s){var a,n,o=i.svgRenderer,r=(i.svgObject,t.ShapeSize),l=t.ElementSpace;if(i.model.enableCanvasRendering===!0){a="M "+(e.startX+-r.width/2+-l/4)+" "+(e.startY+r.height/10)+" L "+(e.startX-Math.floor(r.width/3))+" "+(e.startY+r.height/10)+" M "+(e.startX+Math.floor(r.width/3))+" "+(e.startY+r.height/10)+" L "+(e.startX+r.width/2+l/4)+" "+(e.startY+r.height/10);var n={id:t.ID,fill:t.Style.Color,"stroke-width":2*t.Style.BorderWidth,stroke:t.Style.Color,opacity:t.Style.Opacity,visibility:t.Style.Visibility,d:a,lgndCtx:!0},d="M "+(e.startX-Math.floor(r.width/3))+" "+(e.startY+r.height/10)+" a "+Math.floor(r.width/3)+" "+Math.floor(r.width/3)+" 0 1 0 "+2*Math.floor(r.width/3)+" 0 a"+Math.floor(r.width/3)+" "+Math.floor(r.width/3)+" 0 1 0 "+-2*Math.floor(r.width/3)+" 0",h={id:t.ID,fill:"transparent","stroke-width":2*t.Style.BorderWidth,stroke:t.Style.Color,opacity:t.Style.Opacity,visibility:t.Style.Visibility,d:d,lgndCtx:!0};o.drawPath(n,s),o.drawPath(h,s)}else a="M "+(e.startX+-r.width/2+-l/4)+" "+(e.startY+r.height/10)+" L "+(e.startX-Math.floor(r.width/3))+" "+(e.startY+r.height/10)+" M "+(e.startX+Math.floor(r.width/3))+" "+(e.startY+r.height/10)+" L "+(e.startX+r.width/2+l/4)+" "+(e.startY+r.height/10)+" M "+(e.startX-Math.floor(r.width/3))+" "+(e.startY+r.height/10)+" a "+Math.floor(r.width/3)+" "+Math.floor(r.width/3)+" 0 1 0 "+2*Math.floor(r.width/3)+" 0 a"+Math.floor(r.width/3)+" "+Math.floor(r.width/3)+" 0 1 0 "+-2*Math.floor(r.width/3)+" 0",n={id:t.ID,fill:"transparent","stroke-width":2*t.Style.BorderWidth,stroke:t.Style.Color,opacity:t.Style.Opacity,visibility:t.Style.Visibility,d:a,lgndCtx:!0},o.drawPath(n,s);return e.startX+-r.width/2+-l/4},_drawColumn:function(e,t,i,s){var a,n,o=i.svgRenderer,r=(i.svgObject,t.ShapeSize),l=t.ElementSpace;return a="M "+(e.startX-3*(r.width/5))+" "+(e.startY-r.height/5)+" L "+(e.startX+3*(-r.width/10))+" "+(e.startY-r.height/5)+" L "+(e.startX+3*(-r.width/10))+" "+(e.startY+r.height/2)+" L "+(e.startX-3*(r.height/5))+" "+(e.startY+r.height/2)+" Z M "+(e.startX+-r.width/10-r.width/20)+" "+(e.startY-r.height/4-l/2)+" L "+(e.startX+r.width/10+r.width/20)+" "+(e.startY-r.height/4-l/2)+" L "+(e.startX+r.width/10+r.width/20)+" "+(e.startY+r.height/2)+" L "+(e.startX+-r.width/10-r.width/20)+" "+(e.startY+r.height/2)+" Z M "+(e.startX+3*(r.width/10))+" "+e.startY+" L "+(e.startX+3*(r.width/5))+" "+e.startY+" L "+(e.startX+3*(r.width/5))+" "+(e.startY+r.height/2)+" L "+(e.startX+3*(r.width/10))+" "+(e.startY+r.height/2)+" Z",n={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:a,lgndCtx:!0},o.drawPath(n,s),e.startX-3*(r.width/5)},_drawRangeColumn:function(e,t,i,s){var a,n,o=i.svgRenderer,r=(i.svgObject,t.ShapeSize),l=t.ElementSpace;return a="M "+(e.startX+-r.width/5)+" "+(e.startY+r.height/2+l/4)+" L "+(e.startX+-r.width/5)+" "+(e.startY-r.height/2-l/4)+" L "+(e.startX+r.width/2)+" "+(e.startY+-r.height/2+-l/4)+" L "+(e.startX+r.width/2)+" "+(e.startY+r.height/2+l/4)+" Z",n={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:a,lgndCtx:!0},o.drawPath(n,s),e.startX+-r.width/5},_drawBar:function(e,t,i,s){var a,n,o=i.svgRenderer,r=(i.svgObject,t.ShapeSize),l=t.ElementSpace;return a="M "+(e.startX+-r.width/2+-l/4)+" "+(e.startY-3*(r.height/5))+" L "+(e.startX+3*(r.width/10))+" "+(e.startY-3*(r.height/5))+" L "+(e.startX+3*(r.width/10))+" "+(e.startY-3*(r.height/10))+" L "+(e.startX-r.width/2+-l/4)+" "+(e.startY-3*(r.height/10))+" Z M "+(e.startX+-r.width/2+-l/4)+" "+(e.startY-r.height/5+l/20)+" L "+(e.startX+r.width/2+l/4)+" "+(e.startY-r.height/5+l/20)+" L "+(e.startX+r.width/2+l/4)+" "+(e.startY+r.height/10+l/20)+" L "+(e.startX-r.width/2+-l/4)+" "+(e.startY+r.height/10+l/20)+" Z M "+(e.startX-r.width/2+-l/4)+" "+(e.startY+r.height/5+l/10)+" L "+(e.startX+-r.width/4)+" "+(e.startY+r.height/5+l/10)+" L "+(e.startX+-r.width/4)+" "+(e.startY+r.height/2+l/10)+" L "+(e.startX-r.width/2+-l/4)+" "+(e.startY+r.height/2+l/10)+" Z",n={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:a,lgndCtx:!0},o.drawPath(n,s),e.startX+-r.width/2+-l/4},_drawStepLine:function(e,t,i,s){var a,n,o=i.svgRenderer,r=(i.svgObject,t.ShapeSize),l=t.ElementSpace;return a="M "+(e.startX+-r.width/2-l/4)+" "+(e.startY+r.height/2)+" L "+(e.startX+-r.width/2+r.width/10)+" "+(e.startY+r.height/2)+" L "+(e.startX+-r.width/2+r.width/10)+" "+e.startY+" L "+(e.startX+-r.width/10)+" "+e.startY+" L "+(e.startX+-r.width/10)+" "+(e.startY+r.height/2)+" L "+(e.startX+r.width/5)+" "+(e.startY+r.height/2)+" L "+(e.startX+r.width/5)+" "+(e.startY+-r.height/2)+" L "+(e.startX+r.width/2)+" "+(e.startY+-r.height/2)+"L "+(e.startX+r.width/2)+" "+(e.startY+r.height/2)+" L"+(e.startX+r.width/2+l/4)+" "+(e.startY+r.height/2),n={id:t.ID,fill:"transparent","stroke-width":t.Style.BorderWidth,stroke:t.Style.Color,opacity:t.Style.Opacity,visibility:t.Style.Visibility,d:a,lgndCtx:!0},o.drawPath(n,s),e.startX+-r.width/2-l/4},_drawSpline:function(e,t,i,s){var a,n,o=i.svgRenderer,r=(i.svgObject,t.ShapeSize);return a="M "+(e.startX-r.width/2)+" "+(e.startY+r.height/5)+" Q "+e.startX+" "+(e.startY-r.height)+" "+e.startX+" "+(e.startY+r.height/5)+" M "+e.startX+" "+(e.startY+r.height/5)+" Q "+(e.startX+r.width/2)+" "+(e.startY+r.height/2)+" "+(e.startX+r.width/2)+" "+(e.startY-r.height/2),n={id:t.ID,fill:"transparent","stroke-width":2*t.Style.BorderWidth,stroke:t.Style.Color,opacity:t.Style.Opacity,visibility:t.Style.Visibility,d:a,lgndCtx:!0},o.drawPath(n,s),e.startX-r.width/2},_drawSplineArea:function(e,t,i,s){var a,n,o=i.svgRenderer,r=(i.svgObject,t.ShapeSize);return a="M "+(e.startX-r.width/2)+" "+(e.startY+r.height/5)+" Q "+e.startX+" "+(e.startY-r.height)+" "+e.startX+" "+(e.startY+r.height/5)+" Z M "+e.startX+" "+(e.startY+r.height/5)+" Q "+(e.startX+r.width/2)+" "+(e.startY+r.height/2)+" "+(e.startX+r.width/2)+" "+(e.startY-r.height/2)+" Z",n={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:a,lgndCtx:!0},o.drawPath(n,s),e.startX-r.width/2},_drawArea:function(e,t,i,s){var a,n,o=i.svgRenderer,r=(i.svgObject,t.ShapeSize),l=t.ElementSpace;return a="M "+(e.startX-r.width/2-l/4)+" "+(e.startY+r.height/2)+" L "+(e.startX+-r.width/4+-l/8)+" "+(e.startY-r.height/2)+" L "+e.startX+" "+(e.startY+r.height/4)+" L "+(e.startX+r.width/4+l/8)+" "+(e.startY+-r.height/2+r.height/4)+" L "+(e.startX+r.height/2+l/4)+" "+(e.startY+r.height/2)+" Z",n={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:a,lgndCtx:!0},o.drawPath(n,s),e.startX-r.width/2-l/4},_drawStepArea:function(e,t,i,s){var a,n,o=i.svgRenderer,r=(i.svgObject,t.ShapeSize),l=t.ElementSpace;return a="M "+(e.startX+-r.width/2+-l/4)+" "+(e.startY+r.height/2)+" L "+(e.startX+-r.width/2+-l/4)+" "+(e.startY+-r.height/2)+" L "+(e.startX-r.width/4)+" "+(e.startY-r.height/2)+" L "+(e.startX-r.width/4)+" "+(e.startY-r.height/4)+" L "+(e.startX+r.width/4)+" "+(e.startY-r.height/4)+" L "+(e.startX+r.width/4)+" "+e.startX+" L "+(e.startX+r.width/2+l/4)+" "+e.startY+" L "+(e.startX+r.width/2+l/4)+" "+(e.startY+r.height/2)+" Z",n={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:a,lgndCtx:!0},o.drawPath(n,s),e.startX+-r.width/2+-l/4},_drawPyramid:function(e,t,i,s){var a,n,o=i.svgRenderer,r=(i.svgObject,t.ShapeSize),l=t.ElementSpace;return a="M "+(e.startX+-r.width/2+-l/4)+" "+(e.startY+r.height/2+l/8)+" L "+e.startX+" "+(e.startY+-r.height/2+-l/8)+" L "+(e.startX+r.width/2+l/4)+" "+(e.startY+r.height/2+l/8)+" Z",n={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:a,lgndCtx:!0},o.drawPath(n,s),e.startX+-r.width/2+-l/4},_drawFunnel:function(e,t,i,s){var a,n,o=i.svgRenderer,r=(i.svgObject,t.ShapeSize),l=t.ElementSpace;return a="M "+(e.startX+-r.width/2+-l/5)+" "+(e.startY+-r.height/2+-l/4)+" L "+(e.startX+-r.width/5)+" "+(e.startY+r.height/4)+" L "+(e.startX+-r.width/5)+" "+(e.startY+r.height/2+l/4)+" L "+(e.startX+r.width/5)+" "+(e.startY+r.height/2+l/4)+" L "+(e.startX+r.width/5)+" "+(e.startY+r.height/4)+" L "+(e.startX+r.width/2+l/5)+" "+(e.startY+-r.height/2+-l/4)+" Z",n={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:a,lgndCtx:!0},o.drawPath(n,s),e.startX+-r.width/2+-l/5},_drawCandle:function(e,t,i,s){var a,n,o=i.svgRenderer,r=(i.svgObject,t.ShapeSize),l=t.ElementSpace;return a="M "+(e.startX+-r.width/2)+" "+(e.startY+r.height/4+l/8)+" L "+(e.startX+r.width/2)+" "+(e.startY+r.height/4+l/8)+" L "+(e.startX+r.width/2)+" "+(e.startY+-r.height/2+l/8)+" L "+(e.startX+-r.width/2)+" "+(e.startY+-r.height/2+l/8)+" Z M "+e.startX+" "+(e.startY+-r.height/2+l/8)+" L "+e.startX+" "+(e.startY+-r.height/2+-l/4)+" M "+e.startX+" "+(e.startY+r.height/4+l/8)+" L "+e.startX+" "+(e.startY+r.height/4+l/2),n={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:a,lgndCtx:!0},o.drawPath(n,s),e.startX+-r.width/2},_drawHilo:function(e,t,i,s){var a,n,o=i.svgRenderer,r=(i.svgObject,t.ShapeSize),l=t.ElementSpace;return a="M "+(e.startX+r.width/2)+" "+(e.startY+r.height/2+l/4)+" L "+(e.startX+r.width/2)+" "+(e.startY+-r.height/2+-l/4),n={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:a,lgndCtx:!0},o.drawPath(n,s),e.startX+r.width/2},_drawHiloOpenClose:function(e,i,s,a){var n,o,r=s.svgRenderer,l=(s.svgObject,i.ShapeSize),d=(t(18,12,4.0710678118654755,270),i.ElementSpace);return n="M "+e.startX+" "+(e.startY-3*(l.height/10))+" L "+(e.startX-l.width/2-d/4)+" "+(e.startY-3*(l.height/10))+" M "+e.startX+" "+(e.startY-l.height/2-d/4)+" L "+e.startX+" "+(e.startY+l.height/2+d/4)+" M "+e.startX+" "+(e.startY+3*(l.height/10))+" L "+(e.startX+l.width/2+d/4)+" "+(e.startY+3*(l.height/10)),o={id:i.ID,fill:"transparent","stroke-width":i.Style.BorderWidth,stroke:i.Style.Color,opacity:i.Style.Opacity,visibility:i.Style.Visibility,d:n,lgndCtx:!0},r.drawPath(o,a),e.startX-l.width/2},_drawDoughnut:function(e,i,s,a){var n,o,r=s.svgRenderer,l=(s.svgObject,i.ShapeSize),d=i.ElementSpace,h=Math.sqrt(l.height*l.width)/2;h+=d/5;var c=t(e.startX,e.startY,h,270),u=t(e.startX+l.width/10,e.startY,h,270),d=i.ElementSpace;return path="M "+e.startX+" "+e.startY+" L "+(e.startX+h)+" "+e.startY+" A "+h+" "+h+" 0 1 1 "+c[0]+" "+c[1]+" Z M "+(e.startX+l.width/10)+" "+(e.startY-l.height/10)+" L"+(e.startX+h)+" "+(e.startY-l.height/10)+" A "+h+" "+h+" 0 0 0 "+u[0]+" "+u[1]+" Z",n={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},o={id:i.ID,cx:e.startX,cy:e.startY,r:h/2,lgndCtx:!0,fill:"white","stroke-width":i.Style.BorderWidth,stroke:i.Style.BorderColor,opacity:i.Style.Opacity,visibility:i.Style.Visibility},r.drawPath(n,a),r.drawCircle(o,a),e.startX-h},_drawPie:function(e,i,s,a){var n,o=s.svgRenderer,r=(s.svgObject,i.ShapeSize),l=i.ElementSpace,d=Math.sqrt(r.height*r.width)/2;d+=l/5;var h=t(e.startX,e.startY,d,270),c=t(e.startX+r.width/10,e.startY,d,270),l=i.ElementSpace;return path="M "+e.startX+" "+e.startY+" L "+(e.startX+d)+" "+e.startY+" A "+d+" "+d+" 0 1 1 "+h[0]+" "+h[1]+" Z M "+(e.startX+r.width/10)+" "+(e.startY-r.height/10)+" L"+(e.startX+d)+" "+(e.startY-r.height/10)+" A "+d+" "+d+" 0 0 0 "+c[0]+" "+c[1]+" Z",n={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},o.drawPath(n,a),e.startX-d}},ej.EjSvgRender.seriesPalette={defaultMetro:["#E94649","#F6B53F","#6FAAB0","#C4C24A","#FB954F","#005277","#8BC652","#69D2E7","#E27F2D","#6A4B82"],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:{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"},axisLine:{color:"#8E8E8E"},font:{color:"#282828"},title:{font:{color:"#282828"}},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:"#282828"},title:{font:{color:"#282828"}},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"},axisLine:{color:"#8E8E8E"},font:{color:"#282828"},title:{font:{color:"#282828"}},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:"#282828"},title:{font:{color:"#282828"}},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:"#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:{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"},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"},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"},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"},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:{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"},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"},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"},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"},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:{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"},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"},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"},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"},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}},e.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(e,t,i,s){for(var a,n,o=ej.DataManager(e.model._visibleSeries,ej.Query().sortBy("_zOrder")).executeLocal(),r=!1,l=o.length,d=(s.orientation.toLowerCase(),0);d0&&s[0].points.length>0||this.chartObj.model.indicators[0]._points.length>0){var w,y,C,S,T,D,I,k,P={maxX:null,minX:null},L={maxY:null,minY:null},R=P.maxX,M=P.minX,O=L.maxY,E=L.minY;for(l=0;l0&&(T=s[l].visibility.toLowerCase(),D=s[l].points.length,"visible"===T&&D>0))if("horizontal"==v&&!t.model.requireInvertedAxes||"vertical"==v&&t.model.requireInvertedAxes){for(C=w=s[l]._visiblePoints[0].xValue,c=0;cu&&(C=u),w0&&(R=s[l].maxX,M=s[l].minX),M>s[l].minX&&(M=s[l].minX),Ru.YValues[m]&&(y=u.YValues[m]),Su.YValues[0]&&(y=u.YValues[0]),S0&&(O=s[l].maxY,E=s[l].minY),E>s[l].minY&&(E=s[l].minY),Og.min||null==E)&&(E=g.min),(Og.min&&(E=g.min),Og.min||null==E)&&(E=g.min),(O0?E=0:(E=0,O+=1)),_=O-E,i.range="double"==a?this._getDoubleAutoRange(i,E,O,_):this._getLogAutoRange(i,E,O,_))}else i.setRange?(min=null==i.range.min||void 0==i.range.min?0:i.range.min,max=null==i.range.max||void 0==i.range.max?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};f=e.extend({},ej.EjSvgRender.commonChartEventArgs),f.data={range:i.range,axis:i},this.chartObj._trigger("axesRangeCalculate",f),b=f.data.range,i.range={min:b.min,max:b.max,interval:b.interval,delta:b.max-b.min}},_calculateTrendLineRange:function(e,t,i){for(var s,a,n,o,r,l,d,h=i.length,c=0;c1&&(r=o.points.length-1,t.range.min=t.range.min>o.minY?o.minY:t.range.min,t.range.max=t.range.max0)&&"polaraxes"!=this.chartObj.model.AreaType&&!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,a=t.actualRange,t.isInversed?(n=t.actualRange.max-t.zoomPosition*t.actualRange.delta,o=n-t.zoomFactor*t.actualRange.delta):(n=t.actualRange.min+t.zoomPosition*t.actualRange.delta,o=n+t.zoomFactor*t.actualRange.delta),na.max&&(n-=o-a.max,o=a.max),r=new Date(n),l=new Date(o),n==o&&(r=new Date(Date.parse(r)-2592e6),l=new Date(Date.parse(l)+2592e6));var d=Math.min(r.getTime(),l.getTime()),h=Math.max(r.getTime(),l.getTime()),c=t.enableAutoIntervalOnZooming?this.calculateDateTimeNiceInterval(t,r,l):{interval:t._interval,intervalType:t._intervalType},u=this._increaseDateTimeInterval(r,c.interval,c.intervalType).getTime()-d;if(s)return{min:d,max:h,interval:u};t._intervalType=c.intervalType,t.visibleRange.min=d,t.visibleRange.max=h,t.visibleRange.interval=u,t.visibleRange.delta=Math.abs(t.visibleRange.max-t.visibleRange.min),t._interval=c.interval}},_calculateAxisLabels:function(t){for(var i,s,a=t.enableAutoIntervalOnZooming?t.visibleRange.min:t.actualRange.min,n=this.chartObj.zoomed||t.zoomed||!t.setRange?this.AlignRangeStart(new Date(a),t._interval,t._intervalType).getTime():t.visibleRange.min;n<=t.visibleRange.max;)n>=t.visibleRange.min&&n<=t.visibleRange.max&&(i=ej.format(new Date(n),t.labelFormat?t.labelFormat:ej.EjSvgRender.utils._dateTimeLabelFormat(t._intervalType)),s=e.extend({},ej.EjSvgRender.commonChartEventArgs),s.data={label:{Text:i,Value:n},axis:t},this.chartObj._trigger("axesLabelRendering",s),t.visibleLabels.push({Value:n,Text:s.data.label.Text})),n=this._increaseDateTimeInterval(new Date(n),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(e,t,i){var s,a,n,o,r=Math.abs((t.getTime()-i.getTime())/864e5),l=this.calculateNumericNiceInterval(r/365,e,"years");return l>=1?{interval:l,intervalType:"Years"}:(l=this.calculateNumericNiceInterval(r/30,e,"months"),l>=1?{interval:l,intervalType:"Months"}:(l=this.calculateNumericNiceInterval(r,e,"days"),l>=1?{interval:l,intervalType:"Days"}:(s=24*r,l=this.calculateNumericNiceInterval(s,e,"hours"),l>=1?{interval:l,intervalType:"Hours"}:(a=1440*r,l=this.calculateNumericNiceInterval(a,e,"minutes"),l>=1?{interval:l,intervalType:"Minutes"}:(n=86400*r,l=this.calculateNumericNiceInterval(n,e,"seconds"),l>=1?{interval:l,intervalType:"Seconds"}:(o=864e5*r,l=this.calculateNumericNiceInterval(o,e,"milliseconds"),l>=1?{interval:l,intervalType:"Milliseconds"}:void 0))))))},calculateNumericNiceInterval:function(e,t,i){var s,a,n,o,r=this.GetActualDesiredIntervalsCount(t,t.length),l=e/r;if("double"==t._valueType&&null!=t.desiredIntervals)return l;for(s=Math.pow(10,Math.floor(ej.EjSvgRender.utils._logBase(l,10))),a=[10,5,2,1],n=0;n0&&i[0].points.length>0||this.chartObj.model.indicators[0]._points.length>0){for(l={maxX:null,minX:null},d={maxY:null,minY:null},c=0;c0&&"visible"===i[c].visibility.toLowerCase()&&i[c].points.length>0){for(r=a=i[c].points[0].xValue,o=n=i[c].points[0].YValues[0],u=0;ui[c].points[u].xValue&&(r=i[c].points[u].xValue),ai[c].points[u].YValues[0]&&(n=i[c].points[u].YValues[0]),oi[c].minX&&(l.minX="number"!=typeof i[c].minX?i[c].minX:l.minX),(l.maxX=null==l.maxX&&"number"!=typeof i[c].maxX?i[c].maxX:l.maxX)i[c].minY&&(d.minY=i[c].minY),d.maxYnew Date(m.min)||null==l.minX)&&(l.minX=new Date(m.min)),(l.maxX=a&&(s-=d),s%d<0&&(s=s-d-s%d)):(s=o<5/6*r?0:o-(r-o)/2,s%d>0&&(s-=s%d)),n=r>0?r+(r-o)/20:r-(r-o)/20,a=d-n%d,.365*d>=a&&(n+=d),n%d>0&&(n=n+d-n%d),s<=0&&(d=this.calculateNumericNiceInterval(n-s,t),n=Math.ceil(n/d)*d),o=t.roundingPlaces?parseFloat(s.toFixed(t.roundingPlaces)):parseFloat(s.toFixed(0==ej.EjSvgRender.utils._decimalPlaces(d)?1:ej.EjSvgRender.utils._decimalPlaces(d))),r=t.roundingPlaces?parseFloat(n.toFixed(t.roundingPlaces)):parseFloat(n.toFixed(0==ej.EjSvgRender.utils._decimalPlaces(d)?1:ej.EjSvgRender.utils._decimalPlaces(d)))):("additional"==l||"round"==l)&&(o=Math.floor(o/d)*d,r=Math.ceil(r/d)*d,"additional"==l&&(o-=d,r+=d))),t.actualRange.min=o,t.actualRange.max=r,t.actualRange.interval=d,t.range.min=o,t.range.max=r,t.range.interval=d,t.actualRange.delta=r-o,this._calculateVisibleRange(t)},_calculateVisibleRange:function(t,i,s){var a,n,o;if(this.chartObj=i?i:this.chartObj,t.visibleRange=s?t.visibleRange:e.extend(!0,{},t.actualRange),(t.zoomFactor<1||t.zoomPosition>0)&&"polaraxes"!=this.chartObj.model.AreaType&&!this.chartObj.model.disableZoom){a=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?(n=t.actualRange.max-t.zoomPosition*t.actualRange.delta,o=n-t.zoomFactor*t.actualRange.delta):(n=t.actualRange.min+t.zoomPosition*t.actualRange.delta,o=n+t.zoomFactor*t.actualRange.delta),na.max&&(n-=o-a.max,o=a.max);var r=Math.abs(o-n),l=t.enableAutoIntervalOnZooming?this.calculateNumericNiceInterval(r,t):t.actualRange.interval,d=ej.util.isNullOrUndefined(t.roundingPlaces)?0==ej.EjSvgRender.utils._decimalPlaces(l)?1:ej.EjSvgRender.utils._decimalPlaces(l):t.roundingPlaces;if(l=parseFloat(l.toFixed(d)),s)return{min:Math.min(n,o),max:Math.max(n,o),delta:r,interval:l};t.visibleRange.min=Math.min(n,o),t.visibleRange.max=Math.max(n,o),t.visibleRange.delta=r,t.visibleRange.interval=l,t.zoomed=null===this.chartObj.zoomed||void 0===this.chartObj.zoomed||this.chartObj.zoomed}},_calculateAxisLabels:function(t,i){for(var s,a,n,o,r=i.roundingPlaces,l=t.zoomed||i.zoomed||i.padding?i.visibleRange.min-i.visibleRange.min%i.visibleRange.interval:i.visibleRange.min;l<=i.visibleRange.max;l+=i.visibleRange.interval)ej.EjSvgRender.utils._inside(l,i.visibleRange)&&(a=l.toString().split(0).length-1>10?10:20,l=parseFloat(l.toFixed(!r&&r>a?r:a)),o=r?parseFloat(l.toFixed(r)):parseFloat(l.toFixed(0==ej.EjSvgRender.utils._decimalPlaces(i.visibleRange.interval)?1:ej.EjSvgRender.utils._decimalPlaces(i.visibleRange.interval))),s=i.labelFormat,o=s?null!=s.match("{value}")?s.replace("{value}",o):ej.format(o,s):i.isStacked100?o+"%":o,n=e.extend({},ej.EjSvgRender.commonChartEventArgs),n.data={label:{Text:o,Value:l},axis:i},t._trigger("axesLabelRendering",n),i.visibleLabels.push({Value:l,Text:n.data.label.Text}));i._LableMaxWidth=ej.EjSvgRender.utils._getMaxLabelWidth(i,this.chartObj)},_calculateRanges:function(e,t,i,s){this.chartObj=e,this._calculateRange(e,t,i,s),e.model._drawTrendline&&this._calculateTrendLineRange(e,t,i),this._calculatePadding(e,t,t.range),t.maximumLabels>0&&this._calculateAxisLabels(e,t)}}),ej.axisTypes.double=s,a=t(ej.EjAxisRenderer,{_getRoundValue:function(e,t,i){return(i?Math.ceil(e/t):Math.floor(e/t))*t},calculateLogNiceInterval:function(e,t){for(var i,s=this.GetActualDesiredIntervalsCount(t,t.length),a=e,n=Math.pow(10,Math.floor(ej.EjSvgRender.utils._logBase(a,10))),o=[10,5,2,1],r=0;r0)&&"polaraxes"!=this.chartObj.model.AreaType&&!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,a=t.actualRange,t.isInversed?(n=t.actualRange.max-t.zoomPosition*t.actualRange.delta,o=n-t.zoomFactor*t.actualRange.delta):(n=t.actualRange.min+t.zoomPosition*t.actualRange.delta,o=n+t.zoomFactor*t.actualRange.delta),na.max&&(n-=o-a.max,o=a.max);var r=Math.abs(o-n),l=t.enableAutoIntervalOnZooming?this.calculateLogNiceInterval(r,t):t.visibleRange.interval,d=ej.util.isNullOrUndefined(t.roundingPlaces)?0==ej.EjSvgRender.utils._decimalPlaces(t.visibleRange.interval)?1:ej.EjSvgRender.utils._decimalPlaces(t.visibleRange.interval):t.roundingPlaces;if(l=parseFloat(t.visibleRange.interval.toFixed(d)),s)return{min:Math.min(n,o),max:Math.max(n,o),interval:l};t.visibleRange.interval=l,t.visibleRange.min=Math.min(n,o),t.visibleRange.max=Math.max(n,o),t.visibleRange.delta=r,t.zoomed=null===this.chartObj.zoomed||void 0===this.chartObj.zoomed||this.chartObj.zoomed}},_calculateAxisLabels:function(t,i){for(var s,a,n,o,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)&&(s=i.labelFormat?i.labelFormat.match("{value}"):null,a=Math.pow(i.logBase,r),a=i.roundingPlaces?parseFloat(a.toFixed(i.roundingPlaces)):parseFloat(a.toFixed(0==ej.EjSvgRender.utils._decimalPlaces(i.visibleRange.interval)?1:ej.EjSvgRender.utils._decimalPlaces(i.visibleRange.interval))),n=i.labelFormat?null!=s?i.labelFormat.replace("{value}",a):ej.format(a,i.labelFormat):a,o=e.extend({},ej.EjSvgRender.commonChartEventArgs),o.data={label:{Text:n,Value:r},axis:i},t._trigger("axesLabelRendering",o),i.visibleLabels.push({Value:r,Text:o.data.label.Text}));i._LableMaxWidth=ej.EjSvgRender.utils._getMaxLabelWidth(i,this.chartObj)},_calculateRanges:function(e,t,i,s){this.chartObj=e,this._calculateLogRange(e,t,i,s),e.model._drawTrendline&&this._calculateTrendLineRange(e,t,i),this._calculateLogPadding(e,t,t.actual_Range),this._calculateAxisLabels(e,t)}}),ej.axisTypes.logarithmic=a,n=t(ej.EjAxisRenderer,{_calculateCategoryRange:function(t,i){var s,a,n,o,r,l,d=void 0==this.chartObj.model.legendCollapsed?!this.chartObj.zoomed:this.chartObj.model.legendCollapsed;if(!this.chartObj.model.excludeDataUpdate||d){var h,c,u,m,p={maxX:null,minX:0},g=[],_=t.isIndexed;if(i.length>0&&i[0].points.length>0||this.chartObj.model.indicators[0]._points.length>0){for(s=0;sr.min||null==p.minX)&&(p.minX=r.min),(p.maxX0?(u=l-1,c=this._calculateActualInterval(u,t),t.range={min:0,max:l-1,interval:c,Delta:u}):t.range||(t.range={min:0,max:6,interval:1,Delta:6})}},_calculateActualInterval:function(e,t){return null==t.categoryInterval?Math.max(1,Math.floor(e/this.GetActualDesiredIntervalsCount(t,t.length))):t.categoryInterval},_applyRangePadding:function(e){var t,i;this.chartObj.zoomed||this.chartObj._scrollBarEnabled||(t=0,"polaraxes"!==this.chartObj.model.AreaType&&(t=null===e.labelPlacement||void 0===e.labelPlacement?-.5:"betweenticks"==e.labelPlacement.toLowerCase()?-.5:0),t<0?(e.range.min=e.range.min+t,e.range.max=e.range.max-t,e.range.delta=e.range.max-e.range.min,e.actualRange=e.range):(i=_sideBySeriesPadding(this.chartObj,e.range.min,e.range.max,e),e.range.min=i.startPadding,e.range.max=i.endPadding,e.range.delta=e.range.max-e.range.min,e.actualRange=e.range)),this._calculateVisibleRange(e)},_calculateVisibleRange:function(t,i,s){var a,n,o,r;if(this.chartObj=i?i:this.chartObj,t.visibleRange=s?t.visibleRange:e.extend(!0,{},t.actualRange),(t.zoomFactor<1||t.zoomPosition>0)&&"polaraxes"!=this.chartObj.model.AreaType&&!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,a=t.actualRange,t.isInversed?(n=t.actualRange.max-t.zoomPosition*t.actualRange.delta,o=n-t.zoomFactor*t.actualRange.delta):(n=t.actualRange.min+t.zoomPosition*t.actualRange.delta,o=n+t.zoomFactor*t.actualRange.delta),na.max&&(n-=o-a.max,o=a.max);var r=Math.abs(o-n),l=this._calculateActualInterval(r,t),d=Math.min(n,o),h=Math.max(n,o);if(s)return{min:d,max:h,interval:l};r=Math.abs(o-n),t.visibleRange.interval=l,t.visibleRange.min=d,t.visibleRange.max=h,t.visibleRange.delta=r,t.zoomed=null===this.chartObj.zoomed||void 0===this.chartObj.zoomed||this.chartObj.zoomed}},_calculateAxisLabels:function(t){for(var i,s,a=t.visibleRange.interval,n=t.visibleRange.min-t.visibleRange.min%t.range.interval;n<=t.visibleRange.max;n+=a)ej.EjSvgRender.utils._inside(n,t.visibleRange)&&(i=Math.round(n),t.visibleLabels.push({Value:i,Text:ej.EjSvgRender.utils._getLabelContent(i,t)}),s=e.extend({},ej.EjSvgRender.commonChartEventArgs),s.data={label:t.visibleLabels[t.visibleLabels.length-1],axis:t},this.chartObj._trigger("axesLabelRendering",s),t.visibleLabels[t.visibleLabels.length-1]=s.data.label);t._LableMaxWidth=ej.EjSvgRender.utils._getMaxLabelWidth(t,this.chartObj)},_calculateRanges:function(e,t,i){this.chartObj=e,this._calculateCategoryRange(t,i),e.model._drawTrendline&&this._calculateTrendLineRange(e,t,i),this._applyRangePadding(t),this._calculateAxisLabels(t)}}),ej.axisTypes.category=n,ej.EjAxisRenderer.prototype={_drawGridLines:function(e,t,i){"cartesianaxes"==this.model.AreaType?"horizontal"==t.orientation.toLowerCase()?this._drawXAxisGridLine(e,t,i):this._drawYAxisGridLine(e,t,i):"horizontal"==t.orientation.toLowerCase()&&0==e?(this._drawPolarGridLine(t),this._drawPolarLabels(t)):1==e&&this._drawPolarCircle(t)},_drawAxes:function(e,t){"cartesianaxes"==this.model.AreaType&&(t.visible&&"horizontal"==t.orientation.toLowerCase()&&(this._drawXAxisLabels(e,t),this._drawXTitle(e,t)),t.visible&&"vertical"==t.orientation.toLowerCase()&&(this._drawYAxisLabels(e,t),this._drawYTitle(e,t)))},_getSharpPath:function(e){return e%2==0?0:.5},_drawAxisLine:function(t){var i,s,a=this.svgRenderer.createGroup({id:this.svgObject.id+"_YAxisLine"}),n=ej.EjSvgRender.utils._getStringBuilder(),o=this.model.centerX,r=this.model.centerY,l=this.model.centerX,d=this.model.centerY-this.model.Radius,h="M "+o+" "+r+" L "+l+" "+d;if(t.visible&&t.axisLine.visible&&(i={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:h},this.svgRenderer.drawPath(i,a),e(a).appendTo(this.gPolarAxisEle)),t.visible&&t.majorTickLines.visible){for(a=this.svgRenderer.createGroup({id:this.svgObject.id+"_YAxisMajorTicks"}),s=0;sthis.model.centerX?"start":"middle",b=ej.EjSvgRender.utils._measureText(p,this.model.m_AreaBounds.Height,t.font);.25==s?(g-=this.model.elementSpacing/2,_+=b.height/4):.5==s?_+=b.height:.75==s?(g+=this.model.elementSpacing/2,_+=b.height/4):1==s||0==s?_-=b.height/2:.25o&&(p="")),n={id:this.svgObject.id+"_"+t.name+"_XLabel_"+i,x:g,y:_,fill:u.color,"font-size":u.size,"font-family":u.fontFamily,"font-style":u.fontStyle,"font-weight":u.fontWeight,opacity:u.opacity,"text-anchor":f},this.svgRenderer.drawText(n,p,h),l="middle"==f?n.x-b.width/2:"end"==f?n.x-b.width:n.x,r={x:l,y:n.y,width:b.width,height:b.height},t.visibleLabels[i].region={bounds:r,labelText:p}}e(h).appendTo(this.gXaxisEle)},_drawPolarCircle:function(t){var i,s,a,n,o,r,l,d,h,c,u,m;if(t.majorGridLines.visible)if(i=ej.EjSvgRender.utils._getStringBuilder(),s=this.svgRenderer.createGroup({id:this.svgObject.id+"_YAxisGrid"}),this.model.isPolar)for(a=0;a0&&"betweenticks"==i.labelPlacement.toLowerCase()?-.5:0,u=i.visibleLabels.length,i._valueType.toLowerCase()==ej.datavisualization.Chart.ValueType.Category&&c<0&&(u=u>0?i.visibleLabels.length+1:u),m=0;m0&&c<0?r+c:r,p=i.roundingPlaces?parseFloat(p.toFixed(i.roundingPlaces)):parseFloat(p.toFixed(0==ej.EjSvgRender.utils._decimalPlaces(i.visibleRange.interval)?1:ej.EjSvgRender.utils._decimalPlaces(i.visibleRange.interval))),ej.EjSvgRender.utils._inside(p,i.visibleRange)){if(i.hidePartialLabels&&(0==m||m==u-1))continue;if(i.minorGridLines.visible||i.minorTickLines.visible)if(g=this._getSharpPath(i.minorTickLines.width),_=this._getSharpPath(i.minorGridLines.width),"logarithmic"==i._valueType){x=p;var L=i.visibleRange.max,R=i.visibleRange.min,M=Math.pow(i.logBase,x-i.visibleRange.interval),O=Math.pow(i.logBase,x),E=(O-M)/(i.minorTicksPerInterval+1),A=M+E;for(x=ej.EjSvgRender.utils._logBase(A,i.logBase),v=0;vR&&(o=Math.ceil((x-R)/(L-R)*i.width),i.minorTickLines&&i.minorTickLines.visible&&(b=Math.floor(o+k),f="inside"!=i.tickLinesPosition&&"inside"!=i.labelPosition||"inside"!=i.tickLinesPosition&&"inside"==i.labelPosition?P?Math.floor(l-i.minorTickLines.size):Math.floor(i.minorTickLines.size+l):P?Math.floor(l+i.minorTickLines.size):l-Math.floor(i.minorTickLines.size),D.append("M "+(b+g)+" "+(f+g)+" L "+(b+g)+" "+(l+g)+" ")))}else for(v=0,x=p;vi.visibleRange.min&&(o=Math.ceil((x-i.visibleRange.min)/(i.visibleRange.max-i.visibleRange.min)*i.width),i.minorTickLines&&i.minorTickLines.visible&&(f="inside"!=i.tickLinesPosition&&"inside"!=i.labelPosition||"inside"!=i.tickLinesPosition&&"inside"==i.labelPosition?P?Math.floor(l-i.minorTickLines.size):Math.floor(i.minorTickLines.size+l):P?Math.floor(l+i.minorTickLines.size):Math.floor(l-i.minorTickLines.size),w=Math.floor(o+k),D.append("M "+(w+g)+" "+(f+g)+" L "+(w+g)+" "+(l+g)+" ")));if(i.majorTickLines.visible||i.majorGridLines.visible){var j=this._getSharpPath(i.majorTickLines.width),N=(this._getSharpPath(i.majorGridLines.width),this.pointX=Math.ceil(ej.EjSvgRender.utils._getPointXY(p,i.visibleRange,i.isInversed)*i.width));i.majorTickLines.visible&&(y=i.majorTickLines.size+i.axisLine.width/2,C="inside"==i.tickLinesPosition&&"inside"==i.labelPosition||"inside"==i.tickLinesPosition&&"inside"!=i.labelPosition?P?l+y:l-y:P?l-y:y+l+(i.zoomFactor<1&&this.model.zooming.enableScrollbar&&0==t?this.model.scrollerSize:0),I.append("M "+(Math.floor(N+k)+j)+" "+(Math.floor(C)+j)+" L "+(Math.floor(N+k)+j)+" "+(Math.floor(l+(P?-i.axisLine.width/2:i.axisLine.width/2))+j)+" "))}}i.minorTickLines.visible&&i.visible&&i.minorTicksPerInterval>0&&(n=D.toString(),S={id:this.svgObject.id+"_XAxisMinorTicks_"+t,fill:"none","stroke-width":i.minorTickLines.width,stroke:i.minorTickLines.color,d:n},s?this.svgRenderer.drawPath(S,s):this.svgRenderer.drawPath(S,h)),i.majorTickLines.visible&&i.visible&&(a=I.toString(),T={id:this.svgObject.id+"_XAxisMajorTicks_"+t,fill:"none","stroke-width":i.majorTickLines.width,stroke:i.majorTickLines.color,d:a},s?this.svgRenderer.drawPath(T,s):this.svgRenderer.drawPath(T,h)),"inside"==i.tickLinesPosition?e(h).appendTo(this.gXaxisEle):e(s).appendTo(this.gXaxisEle)},_drawXAxisGridLine:function(t,i,s){var a,n,o,r,l,d,h,c,u,m,p,g,_,f,b,v,x,w,y,C,S,T,D=ej.EjSvgRender.utils._getStringBuilder(),I=ej.EjSvgRender.utils._getStringBuilder(),k=[],P=i._opposed,L=Math.floor(i.x),R=Math.floor(i.x+i.width),M=this.svgRenderer.createGroup({id:this.svgObject.id+"_XAxisGrid_"+t}),O=this.svgRenderer.createGroup({id:this.svgObject.id+"_XAxisAlternateGridBand_"+t});if(!(0!=t&&"inside"==i.labelPosition&&"inside"==i.tickLinesPosition&&i.y!=this.model.m_AreaBounds.Height+this.model.m_AreaBounds.Y&&i.y!=this.model.m_AreaBounds.Y||"inside"==i.labelPosition&&"inside"!=i.tickLinesPosition&&i.y!=this.model.m_AreaBounds.Height+this.model.m_AreaBounds.Y&&i.y!=this.model.m_AreaBounds.Y)?0==t||"inside"==i.labelPosition||"inside"!=i.tickLinesPosition||i.y==this.model.m_AreaBounds.Height+this.model.m_AreaBounds.Y||i.y==this.model.m_AreaBounds.Y?(l=Math.floor(i.y),d=Math.floor(i.y)):(l=P?Math.floor(i.y-i.majorTickLines.size):Math.floor(i.y+i.majorTickLines.size),d=P?Math.floor(i.y-i.majorTickLines.size):Math.floor(i.y+i.majorTickLines.size)):(l=P?Math.floor(i.y-i._LableMaxWidth.height):Math.floor(i.y+i._LableMaxWidth.height),d=P?Math.floor(i.y-i._LableMaxWidth.height):Math.floor(i.y+i._LableMaxWidth.height)),i.visible&&i.axisLine.visible){var E=i.axisLine.offset>0?i.axisLine.offset:0,A=this._getSharpPath(i.axisLine.width),j={id:this.svgObject.id+"_XAxisLine_"+t,x1:L-i.plotOffset+A+E,y1:l+A,x2:R+i.plotOffset-E+A,y2:d+A,"stroke-dasharray":i.axisLine.dashArray,"stroke-width":i.axisLine.width,stroke:i.axisLine.color,opacity:i.axisLine.opacity||1};s.axes[i.name]._lineOption=[j,this.gXaxisEle]}else s.axes[i.name]._lineOption=[null,this.gXaxisEle];for(i.labelPlacement=i.labelPlacement?i.labelPlacement:ej.datavisualization.Chart.LabelPlacement.BetweenTicks,h=i.labels.length>0&&"betweenticks"==i.labelPlacement.toLowerCase()?-.5:0,c=i.visibleLabels.length,i._valueType.toLowerCase()==ej.datavisualization.Chart.ValueType.Category&&h<0&&(c=c>0?i.visibleLabels.length+1:c),x=0;x0&&h<0?r+h:r,u=i.roundingPlaces?parseFloat(u.toFixed(i.roundingPlaces)):parseFloat(u.toFixed(0==ej.EjSvgRender.utils._decimalPlaces(i.visibleRange.interval)?1:ej.EjSvgRender.utils._decimalPlaces(i.visibleRange.interval))),ej.EjSvgRender.utils._inside(u,i.visibleRange)){if(i.hidePartialLabels&&(0==x||x==c-1))continue;if(i.minorGridLines.visible||i.minorTickLines.visible)if(m=this._getSharpPath(i.minorTickLines.width),p=this._getSharpPath(i.minorGridLines.width),"logarithmic"==i._valueType){f=u;var N=i.visibleRange.max,z=i.visibleRange.min,F=Math.pow(i.logBase,f-i.visibleRange.interval),B=Math.pow(i.logBase,f),H=(B-F)/(i.minorTicksPerInterval+1),V=F+H;for(f=ej.EjSvgRender.utils._logBase(V,i.logBase),_=0;_z&&(o=Math.ceil((f-z)/(N-z)*i.width),i.minorGridLines&&i.minorGridLines.visible&&(g=Math.floor(o+L),D.append("M "+(g+p)+" "+(l+p)+" L "+(g+p)+" "+(Math.floor(P?this.model.m_AreaBounds.Y+this.model.m_AreaBounds.Height:this.model.m_AreaBounds.Y)+p)+" "))),V+=H,f=ej.EjSvgRender.utils._logBase(V,i.logBase)}else for(_=0,f=u;_i.visibleRange.min&&(o=Math.ceil((f-i.visibleRange.min)/(i.visibleRange.max-i.visibleRange.min)*i.width),i.minorGridLines&&i.minorGridLines.visible&&D.append("M "+(Math.floor(o+L)+p)+" "+(l+p)+" L "+(Math.floor(o+L)+p)+" "+(Math.floor(P?this.model.m_AreaBounds.Y+this.model.m_AreaBounds.Height:this.model.m_AreaBounds.Y)+p)+" "));if(i.majorTickLines.visible||i.majorGridLines.visible){var U=(this._getSharpPath(i.majorTickLines.width),this._getSharpPath(i.majorGridLines.width)),W=this.pointX=Math.ceil(ej.EjSvgRender.utils._getPointXY(u,i.visibleRange,i.isInversed)*i.width),G=Math.floor(W+L);if(i.zoomed&&(k[0]=i.x),0==x&&G==Math.floor(this.model.m_AreaBounds.X)){k.push(G+U);continue}if(x==c-1&&"transparent"!=this.model.chartArea.border.color&&this.model.chartArea.border.width>0){if(G==Math.floor(this.model.m_AreaBounds.X+this.model.m_AreaBounds.Width))continue;i.zoomed&&(k[c]=G+U)}if(i.majorGridLines.visible&&I.append("M "+(G+U)+" "+(Math.floor(this.model.m_AreaBounds.Y+this.model.m_AreaBounds.Height)+U)+" L "+(G+U)+" "+(Math.floor(this.model.m_AreaBounds.Y)+U)+" "),"category"!=i._valueType.toLowerCase()&&x==c-1)continue;k.push(G+U)}}if("transparent"!=i.alternateGridBand.odd.fill||"transparent"!=i.alternateGridBand.even.fill){for(b=this.model.m_AreaBounds.Height,x=1;x0&&(n=D.toString(),S={id:this.svgObject.id+"_XAxisMinorGridLines_"+t,fill:"none","stroke-width":i.minorGridLines.width,stroke:i.minorGridLines.color,"stroke-dasharray":i.minorGridLines.dashArray,d:n},this.svgRenderer.drawPath(S,M)),a=I.toString(),i.majorGridLines.visible&&(T={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:a},""!=T.d&&this.svgRenderer.drawPath(T,M)),e(M).appendTo(this.svgObject)},_drawYAxisTickLine:function(t,i,s){var a,n,o,r,l,d,h,c,u,m,p,g,_,f,b,v,x,w,y="",C="",S=0,T=i._opposed;1!=t&&("inside"==i.labelPosition&&"inside"==i.tickLinesPosition||"inside"==i.labelPosition&&"inside"!=i.tickLinesPosition)&&i.x!=this.model.m_AreaBounds.Width+this.model.m_AreaBounds.X&&i.x!=this.model.m_AreaBounds.X?(n=T?Math.floor(i.x+i._LableMaxWidth.width+this.model.elementSpacing):Math.floor(i.x-i._LableMaxWidth.width-this.model.elementSpacing),o=T?Math.floor(i.x+i._LableMaxWidth.width+this.model.elementSpacing):Math.floor(i.x-i._LableMaxWidth.width-this.model.elementSpacing)):1==t||"inside"==i.labelPosition||"inside"!=i.tickLinesPosition||i.x==this.model.m_AreaBounds.Width+this.model.m_AreaBounds.X||i.x==this.model.m_AreaBounds.X?(n=Math.floor(i.x),o=Math.floor(i.x)):(n=Math.floor(i.x+i.majorTickLines.size),o=Math.floor(i.x+i.majorTickLines.size));var D=Math.floor(i.y+i.height),I=(Math.floor(i.y),ej.EjSvgRender.utils._getStringBuilder()),k=ej.EjSvgRender.utils._getStringBuilder();this.svgRenderer.createGroup({id:this.svgObject.id+"_YAxisTicklines_"+t});for(i.labelPlacement=i.labelPlacement?i.labelPlacement:ej.datavisualization.Chart.LabelPlacement.BetweenTicks,r=i.labels.length>0&&"betweenticks"==i.labelPlacement.toLowerCase()?-.5:0,l=i.visibleLabels.length,i._valueType.toLowerCase()==ej.datavisualization.Chart.ValueType.Category&&r<0&&(l=l>0?i.visibleLabels.length+1:l),d=0;d0&&r<0?a+r:a,h=i.roundingPlaces?parseFloat(h.toFixed(i.roundingPlaces)):parseFloat(h.toFixed(0==ej.EjSvgRender.utils._decimalPlaces(i.visibleRange.interval)?1:ej.EjSvgRender.utils._decimalPlaces(i.visibleRange.interval))),ej.EjSvgRender.utils._inside(h,i.visibleRange)){if(i.hidePartialLabels&&(0==d||d==i.visibleLabels.length-1))continue;if(i.minorGridLines.visible||i.minorTickLines.visible)if(u=this._getSharpPath(i.minorTickLines.width),m=this._getSharpPath(i.minorGridLines.width),"logarithmic"==i._valueType){g=h;var P=i.visibleRange.max,L=i.visibleRange.min,R=Math.pow(i.logBase,g-i.visibleRange.interval),M=Math.pow(i.logBase,g),O=(M-R)/(i.minorTicksPerInterval+1),E=R+O;for(g=ej.EjSvgRender.utils._logBase(E,i.logBase),p=0;pL&&(c=Math.ceil((g-L)/(P-L)*i.height),i.minorTickLines&&i.minorTickLines.visible&&i.minorTickLines.visible&&(_="inside"!=i.tickLinesPosition&&"inside"!=i.labelPosition||"inside"!=i.tickLinesPosition&&"inside"==i.labelPosition?T?i.minorTickLines.size:-i.minorTickLines.size:T?-i.minorTickLines.size:i.minorTickLines.size,I.append("M "+(Math.floor(_+n)+u)+" "+(Math.floor(c*-1+D)+u)+" L "+(n+u)+" "+(Math.floor(c*-1+D)+u)+" "))),E+=O,g=ej.EjSvgRender.utils._logBase(E,i.logBase)}else for(p=0,g=h;pi.visibleRange.min&&(c=(g-i.visibleRange.min)/i.visibleRange.delta*i.height,i.minorTickLines.visible&&(_="inside"!=i.tickLinesPosition&&"inside"!=i.labelPosition||"inside"!=i.tickLinesPosition&&"inside"==i.labelPosition?T?i.minorTickLines.size:-i.minorTickLines.size:T?-i.minorTickLines.size:i.minorTickLines.size,I.append("M "+(Math.floor(_+n)+u)+" "+(Math.floor(c*-1+D)+u)+" L "+(n+u)+" "+(Math.floor(c*-1+D)+u)+" ")));(i.majorTickLines.visible||i.majorGridLines.visible)&&(f=this._getSharpPath(i.minorTickLines.width),b=this._getSharpPath(i.majorGridLines.width),i.majorTickLines.visible&&(S=ej.EjSvgRender.utils._getPointXY(h,i.visibleRange,i.isInversed)*i.height,"inside"!=i.tickLinesPosition&&"inside"!=i.labelPosition||"inside"!=i.tickLinesPosition&&"inside"==i.labelPosition?v=T?i.majorTickLines.size+i.axisLine.width/2:-(i.majorTickLines.size+i.axisLine.width/2)-(i.zoomFactor<1&&this.model.zooming.enableScrollbar&&1==t?this.model.scrollerSize:0):("inside"==i.tickLinesPosition&&"inside"!=i.labelPosition||"inside"==i.tickLinesPosition&&"inside"==i.labelPosition)&&(v=T?-(i.majorTickLines.size+i.axisLine.width/2):i.majorTickLines.size+i.axisLine.width/2),k.append("M "+(Math.floor(v+n)+f)+" "+(Math.floor(S*-1+D)+f)+" L "+(Math.floor(n+(T?i.axisLine.width/2:i.axisLine.width/2))+f)+" "+(Math.floor(S*-1+D)+f)+" ")))}i.minorTickLines.visible&&i.visible&&i.minorTicksPerInterval>0&&(C=I.toString(),x={id:this.svgObject.id+"_YAxisMinorTicks_"+t,fill:"none","stroke-width":i.minorTickLines.width,stroke:i.minorTickLines.color,d:C},this.svgRenderer.drawPath(x,s)),i.majorTickLines.visible&&i.visible&&(y=k.toString(),w={id:this.svgObject.id+"_YAxisMajorTicks_"+t,fill:"none","stroke-width":i.majorTickLines.width,stroke:i.majorTickLines.color,d:y},this.svgRenderer.drawPath(w,s)),e(s).appendTo(this.gYaxisEle)},_drawYAxisGridLine:function(t,i,s){var a,n,o,r,l,d,h,c,u,m,p,g,_,f,b,v,x,w,y,C,S,T,D="",I="",k=0,P=Math.floor(i.y+i.height),L=Math.floor(i.y),R=i._opposed,M=[],O=i.name.replace(/[^a-zA-Z0-9]/g,"");1!=t&&("inside"==i.labelPosition&&"inside"==i.tickLinesPosition||"inside"==i.labelPosition&&"inside"!=i.tickLinesPosition)&&i.x!=this.model.m_AreaBounds.Width+this.model.m_AreaBounds.X&&i.x!=this.model.m_AreaBounds.X?(n=R?Math.floor(i.x+i._LableMaxWidth.width+this.model.elementSpacing):Math.floor(i.x-i._LableMaxWidth.width-this.model.elementSpacing),o=R?Math.floor(i.x+i._LableMaxWidth.width+this.model.elementSpacing):Math.floor(i.x-i._LableMaxWidth.width-this.model.elementSpacing)):1==t||"inside"==i.labelPosition||"inside"!=i.tickLinesPosition||i.x==this.model.m_AreaBounds.Width+this.model.m_AreaBounds.X||i.x==this.model.m_AreaBounds.X?(n=Math.floor(i.x),o=Math.floor(i.x)):(n=R?Math.floor(i.x+i.majorTickLines.size):Math.floor(i.x-i.majorTickLines.size),o=R?Math.floor(i.x+i.majorTickLines.size):Math.floor(i.x-i.majorTickLines.size));var E=ej.EjSvgRender.utils._getStringBuilder(),A=ej.EjSvgRender.utils._getStringBuilder(),j=this.svgRenderer.createGroup({id:this.svgObject.id+"_YAxisGrid_"+t}),N=this.svgRenderer.createGroup({id:this.svgObject.id+"_YAxisAlternateGridBand_"+t});if(i.visible&&i.axisLine.visible){var z=i.axisLine.offset>0?i.axisLine.offset:0,F=this._getSharpPath(i.axisLine.width),B={id:this.svgObject.id+O+"_YAxisLine_"+t,x1:n+F,y1:L-i.plotOffset+z+F,x2:o+F,y2:P+i.plotOffset-z+F,"stroke-width":i.axisLine.width,"stroke-dasharray":i.axisLine.dashArray,stroke:i.axisLine.color,opacity:i.axisLine.opacity||1};s.axes[i.name]._lineOption=[B,this.gYaxisEle]}else s.axes[i.name]._lineOption=[null,this.gYaxisEle];for(i.axisBottomLine&&i.axisBottomLine.visible&&(r={id:this.svgObject.id+O+"_YAxisBottomLine_"+t,x1:this.model.m_AreaBounds.X,y1:P,x2:this.model.m_AreaBounds.X+this.model.m_AreaBounds.Width,y2:P,"stroke-width":i.axisBottomLine.width,stroke:i.axisBottomLine.color},this.svgRenderer.drawLine(r,j)),i.labelPlacement=i.labelPlacement?i.labelPlacement:ej.datavisualization.Chart.LabelPlacement.BetweenTicks,l=i.labels.length>0&&"betweenticks"==i.labelPlacement.toLowerCase()?-.5:0,d=i.visibleLabels.length,x=0;x0&&l<0?a+l:a,h=i.roundingPlaces?parseFloat(h.toFixed(i.roundingPlaces)):parseFloat(h.toFixed(0==ej.EjSvgRender.utils._decimalPlaces(i.visibleRange.interval)?1:ej.EjSvgRender.utils._decimalPlaces(i.visibleRange.interval))),ej.EjSvgRender.utils._inside(h,i.visibleRange)){if(i.hidePartialLabels&&(0==x||x==i.visibleLabels.length-1))continue;if(i.minorGridLines.visible||i.minorTickLines.visible)if(u=this._getSharpPath(i.minorTickLines.width),m=this._getSharpPath(i.minorGridLines.width),"logarithmic"==i._valueType){g=h;var H=i.visibleRange.max,V=i.visibleRange.min,U=Math.pow(i.logBase,g-i.visibleRange.interval),W=Math.pow(i.logBase,g),G=(W-U)/(i.minorTicksPerInterval+1),Y=U+G;for(g=ej.EjSvgRender.utils._logBase(Y,i.logBase),p=0;pV&&(c=Math.ceil((g-V)/(H-V)*i.height),i.minorGridLines.visible&&E.append("M "+(Math.floor(this.model.m_AreaBounds.X)+m)+" "+(Math.floor(c*-1+P)+m)+" L "+(Math.floor(this.model.m_AreaBounds.Width+this.model.m_AreaBounds.X)+m)+" "+(Math.floor(c*-1+P)+m)+" ")),Y+=G,g=ej.EjSvgRender.utils._logBase(Y,i.logBase)}else for(p=0,g=h;pi.visibleRange.min&&(c=(g-i.visibleRange.min)/i.visibleRange.delta*i.height,i.minorGridLines.visible&&E.append("M "+(Math.floor(this.model.m_AreaBounds.X)+m)+" "+(Math.floor(c*-1+P)+m)+" L "+(Math.floor(this.model.m_AreaBounds.Width+this.model.m_AreaBounds.X)+m)+" "+(Math.floor(c*-1+P)+m)+" "));if((i.majorTickLines.visible||i.majorGridLines.visible)&&(_=this._getSharpPath(i.minorTickLines.width),f=this._getSharpPath(i.majorGridLines.width),i.majorGridLines.visible)){k=ej.EjSvgRender.utils._getPointXY(h,i.visibleRange,i.isInversed)*i.height;var X=Math.floor(this.model.m_AreaBounds.X)+f,$=Math.floor(k*-1+P),q=Math.floor(this.model.m_AreaBounds.Width+this.model.m_AreaBounds.X)+f;if(0==x){if($==Math.floor(this.model.m_AreaBounds.Y+this.model.m_AreaBounds.Height))continue;i.zoomed&&(M[0]=$+f)}if(x==i.visibleLabels.length-1&&"transparent"!=this.model.chartArea.border.color&&this.model.chartArea.border.width>0&&$==Math.floor(this.model.m_AreaBounds.Y)){M.push($+f);continue}if(A.append("M "+X+" "+($+f)+" L "+q+" "+($+f)+" "),0==x)continue;M.push($+f)}}if("transparent"!=i.alternateGridBand.odd.fill||"transparent"!=i.alternateGridBand.even.fill){for(b=this.model.m_AreaBounds.Width,i.zoomed&&(M[M.length]=i.y),x=1;x0&&(I=E.toString(),S={id:this.svgObject.id+"_YAxisMinorGridLines_"+t,fill:"none","stroke-width":i.minorGridLines.width,stroke:i.minorGridLines.color,"stroke-dasharray":i.minorGridLines.dashArray,d:I},this.svgRenderer.drawPath(S,j)),D=A.toString(),i.majorGridLines.visible&&(T={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:D},""!=T.d&&this.svgRenderer.drawPath(T,j)),e(j).appendTo(this.svgObject)},_drawXAxisLabels:function(t,i){var s,a,n,o,r,l,d,h,c,u,m,p,g,_,f,b,v,x,w,y,C,S,T,D,I,k=this.svgRenderer.createGroup({id:this.svgObject.id+"_XAxisLabels_"+t,cursor:"default"}),P=(this.svgRenderer.createGroup({id:this.svgObject.id+"_XAxisLabels_"+t,cursor:"default"}),[]),L=i.name.replace(/[^a-zA-Z0-9]/g,""),R=this.model._xScroll,M=i._opposed;for(i.y=0!=t&&("inside"==i.labelPosition&&"inside"==i.tickLinesPosition||"inside"==i.labelPosition&&"inside"!=i.tickLinesPosition)&&i.y!=this.model.m_AreaBounds.Height+this.model.m_AreaBounds.Y&&i.y!=this.model.m_AreaBounds.Y?M?Math.floor(i.y-i._LableMaxWidth.height):Math.floor(i.y+i._LableMaxWidth.height):0==t||"inside"==i.labelPosition||"inside"!=i.tickLinesPosition||i.y==this.model.m_AreaBounds.Height+this.model.m_AreaBounds.Y||i.y==this.model.m_AreaBounds.Y?Math.floor(i.y):M?Math.floor(i.y-i.majorTickLines.size):Math.floor(i.y+i.majorTickLines.size),n=0;nz?(otherLabel=trimLabel=ee,ae=!1):(trimLabel=o,ae=!0),l=trimLabel.displayText=trimLabel.Text.toString(),h=1;hd&&""!=r)){for(h=1;h=d){if(r=r.toString().substring(0,h-1)+"... ",o.displayText=r,n==i.visibleLabels.length-1&&N+i.x+z/2>J&&d==O){d-=z/2,h=1;continue}break}o.displayText=r}if(c=ej.EjSvgRender.utils._measureText(o.displayText,j,G),u=c.width/2,!ej.util.isNullOrUndefined(o.Text)){if(m=N+i.x-u,"inside"==i.labelPosition&&"inside"==i.tickLinesPosition||"inside"==i.labelPosition&&"inside"!=i.tickLinesPosition&&"multiplerows"==i.labelIntersectAction?p=M?i.y+i.majorTickLines.size+F/2+W/2+H/(2*V)-5:i.y-i.majorTickLines.size-W/2-H/(2*V)+5:"inside"==i.labelPosition&&"inside"!=i.tickLinesPosition?p=M?i.y+F/2+W/2+H/(2*V)-5:i.y-W/2-H/(2*V)+5:"inside"!=i.labelPosition&&"inside"!=i.tickLinesPosition||"inside"!=i.labelPosition&&"inside"==i.tickLinesPosition&&"multiplerows"==i.labelIntersectAction?(p=M?i.y-i.majorTickLines.size+F/2-W/2-H/(2*V)-5:i.y+i.majorTickLines.size+W/2+H/(2*V)+5,p+=R&&!M?this.model.scrollerSize:0):"inside"!=i.labelPosition&&"inside"==i.tickLinesPosition&&(p=M?i.y+F/2-W/2-H/(2*V)-5:i.y+W/2+H/(2*V)+5,p+=R&&!M?this.model.scrollerSize:0),"inside"==i.labelPosition&&"inside"!=i.tickLinesPosition?(90==i.labelRotation||"rotate90"==i.labelIntersectAction)&&(p=M?p:p-i.majorTickLines.size):"inside"!=i.labelPosition&&"inside"==i.tickLinesPosition?(90==i.labelRotation||"rotate90"==i.labelIntersectAction)&&(p=M?p-i.majorTickLines.size:p-i.majorTickLines.size):"inside"==i.labelPosition&&"inside"==i.tickLinesPosition&&(90==i.labelRotation||"rotate90"==i.labelIntersectAction)&&(p=M?p:p-i.majorTickLines.size),g={id:this.svgObject.id+"_"+L+"_XLabel_"+n,x:m,y:p,fill:G.color,"font-size":G.size,"font-family":G.fontFamily,"font-style":G.fontStyle,"font-weight":G.fontWeight,opacity:G.opacity},i.edgeLabelPlacement)switch(_=i.edgeLabelPlacement.toLowerCase(),f=i.visibleLabels.length-1,_){case"shift":0==n?g.xi.x+i.width&&(b=g.x+c.width-(i.x+i.width),g.x=m=g.x-b,this.diff=b,this.edgeLabel=!0);break;case"hide":(0==n&&g.xQ+Z)&&(r="")}if(0==$||U||this.labelRotation(i,m+u,p,g,o,$),i.labelIntersectAction||i.enableTrim){if(this.diff=ej.util.isNullOrUndefined(this.diff)?0:this.diff,v=i.labelIntersectAction.toLowerCase(),"none"==v&&!i.enableTrim){this.svgRenderer.drawText(g,r,k),i.visibleLabels[n].region=this.calculateRegion(r,G,g,o),this.model.xAxisLabelRegions.push(i.visibleLabels[n].region),"inside"==i.labelPosition?e(k).appendTo(this.gXaxisTickEle):e(k).appendTo(this.gXaxisEle);continue}if("wrap"==v||"wrapbyword"==v){var ne=this.rowscalculation(r.toString(),j,i,O,g),q=ne.length,oe="";for(g.y="inside"!=i.labelPosition?M?g.y+F:g.y-F:M?g.y-F:g.y-F*q,C=0;CN-y)&&(o.displayText=r="")}else if("multiplerows"==v){for(C=0;CN-z){if(M){I="inside"!=i.labelPosition?g.y-F:g.y+F,g.y=I,C+1==P.length&&(K=!0),q++;break}I="inside"!=i.labelPosition?g.y+F:g.y-F,g.y=I,C+1==P.length&&(K=!0),q++;break}if(T+1==P[C].length){K=!0;break}}void 0==I?(void 0==P[0]&&(P[0]=[]),P[0].push(o)):(void 0==P[q]&&(P[q]=[]),P[q].push(o))}}this.edgeLabel||this.zoomed||i.zoomed||$||"rotate90"==Y||"rotate45"==Y||!(N+i.x+z/2>e(this.svgObject).width())||(e(g).attr("x",e(this.svgObject).width()-2),e(g).attr("text-anchor","end")),i.visibleLabels[n].y=g.y,this.model.enableCanvasRendering&&"inside"==i.labelPosition&&("rotate45"==i.labelIntersectAction||"rotate90"==i.labelIntersectAction)&&(g.y=g.y-z),this.svgRenderer.drawText(g,r,k),i.visibleLabels[n].region=this.calculateRegion(r,G,g,o),this.model.xAxisLabelRegions.push(i.visibleLabels[n].region)}}e(k).appendTo(this.gXaxisEle)},calculateRegion:function(e,t,i,s){var a=ej.EjSvgRender.utils._measureText(e,null,t),n={x:i.x,y:i.y,width:a.width, height:a.height};return{bounds:n,trimText:e,labelText:s.Text}},rowscalculation:function(e,t,i,s,a){var n,o,r,l,d,h,c=ej.EjSvgRender.utils._measureText,u=i.font,m=c(e,t,u),p=m.width,g=p/2,_=e.toString(),f=_.length,b=[],v=0,x=i.labelIntersectAction,w=e.split(" "),y=w.length;if(this.edgeLabel&&(s=0==v?s-this.diff:s),p>s&&(a.x=a.x+g,line=0,this.edgeLabel&&(a.x=0==v?a.x-this.diff:a.x+this.diff)),"wrap"==x){if(p>s)for(n=1;n<=_.length;n++)e=_.substring(0,n),p=c(e,t,u).width,p>s&&(line+=1,e=_.substring(0,n-1),b[v]=e,_=_.slice(n-1,f),currentTextCollextion=_.split(" "),_=w.indexOf(currentTextCollextion[0])>-1?_:"-"+_,o=c(e,t,u).width,1==line&&(a.x=a.x-o/2),v++,n=0);b[v]=e}else{for(r=0,v=0;vs){for(;v0)){r=Math.max(r,d);break}l=l.concat(" "+w[v+1]),v++}b.push(l)}else{if(!(p>s)){b.push(e);break}l=ej.EjSvgRender.utils._trimText(l,s,u),o=c(l,t,u).width,r=Math.max(r,o),b.push(l)}a.x=a.x-r/2}return b},labelRotation:function(t,i,s,a,n,o,r){var l,d,h,c=t._opposed,u=n.displayText?n.displayText:n.Text,m=o>360?o-360:o<-360?o+360:o,p="rotate("+m+","+i+","+s+")";e(a).attr("transform",p),e(a).attr("labelRotation",m),l=this.svgRenderer.createText(a,u),d=Math.ceil(ej.EjSvgRender.utils._measureBounds(l,this).height-ej.EjSvgRender.utils._measureText(u,null,t.font).height),d=t._LableMaxWidth.height-d-ej.EjSvgRender.utils._measureText(u,null,t.font).height,h="inside"!=t.labelPosition?c?d/2:-d/2:c?-d/2:d/2,p="rotate("+m+","+i+","+(s+h)+")",this.edgeLabel&&90==o&&(s=0==r?a.y+this.diff:a.y-this.diff),e(a).attr({transform:p,y:s+h})},_drawYAxisLabels:function(t,i){var s,a,n,o,r,l,d,h,c,u,m,p,g,_,f,b,v,x,w,y,C=i.name.replace(/[^a-zA-Z0-9]/g,""),S=this.svgRenderer.createGroup({id:this.svgObject.id+"_YAxisLabels_"+t,cursor:"default"}),T=i._opposed,D=(this.model.requireInvertedAxes,this.model._yScroll);for(i.x=1!=t&&("inside"==i.labelPosition&&"inside"==i.tickLinesPosition||"inside"==i.labelPosition&&"inside"!=i.tickLinesPosition)&&i.x!=this.model.m_AreaBounds.Width+this.model.m_AreaBounds.X&&i.x!=this.model.m_AreaBounds.X?T?Math.floor(i.x+i._LableMaxWidth.width+this.model.elementSpacing):Math.floor(i.x-i._LableMaxWidth.width-this.model.elementSpacing):1==t||i.x==this.model.m_AreaBounds.Width+this.model.m_AreaBounds.X&&i.x!=this.model.m_AreaBounds.X||"inside"==i.labelPosition||"inside"!=i.tickLinesPosition?Math.floor(i.x):T?Math.floor(i.x+i.majorTickLines.size):Math.floor(i.x-i.majorTickLines.size),r=0;ri.y+i.height&&(_=m.y-(i.y+i.height),m.y=u=m.y-_,this.diff=_,this.edgeLabel=!0):r==g&&m.y-P/2i.y+i.height||r==g&&m.y-P/2360?F-360:F<-360?F+360:F,H="rotate("+B+","+h+","+u+")";e(m).attr("transform",H),e(m).attr("labelRotation",B),f=this.svgRenderer.createText(m,j),b=Math.ceil(ej.EjSvgRender.utils._measureBounds(f,this).width-ej.EjSvgRender.utils._measureText(j,null,i.font).width),v="inside"!=i.labelPosition?T?b/2:-b/2:T?-b/2:b/2,H="rotate("+B+","+(h+v)+","+u+")",e(m).attr({transform:H,x:h+v})}if(i.labelIntersectAction||i.enableTrim){if("none"==w&&!i.enableTrim){this.svgRenderer.drawText(m,l.Text,S),s=ej.EjSvgRender.utils._measureText(j,null,L),o=i.opposedPosition?m.x:m.x-s.width,n={x:o,y:m.y,width:s.width,height:s.height},a={bounds:n,trimText:j,labelText:l.Value},i.visibleLabels[r].region={bounds:n,trimText:j,labelText:l.Text},this.model.yAxisLabelRegions.push(a);continue}if(i.enableTrim&&z>A&&""!=j){for(x=1;x=A){j=j.toString().substring(0,x-1)+"...";break}l.displayText=j}for(w=i.labelIntersectAction.toLowerCase(),y=0;ym.y-P/4:Ym.y-P/4:Y0||isNaN(_)))for(s=_?_:i.width-2*this.model.elementSpacing;h.width>s;)if(m=this.trimText(m,m.length,"..."),h=ej.EjSvgRender.utils._measureText(m,i.width,i.title.font),"..."==m){m="";break}if(a=e.extend({},ej.EjSvgRender.commonChartEventArgs),n=this.model.elementSpacing+i._LableMaxWidth.height+c+i.majorTickLines.size+i.axisLine.width,"inside"!=i.tickLinesPosition||"inside"!=i.labelPosition||0!=t&&i.y!=this.model.m_AreaBounds.Height+this.model.m_AreaBounds.Y&&i.y!=this.model.m_AreaBounds.Y?0!=t&&i.y!=this.model.m_AreaBounds.Width+this.model.m_AreaBounds.X&&i.y!=this.model.m_AreaBounds.X||"inside"==i.tickLinesPosition||"inside"!=i.labelPosition?0!=t&&i.y!=this.model.m_AreaBounds.Width+this.model.m_AreaBounds.X&&i.y!=this.model.m_AreaBounds.X||"inside"!=i.tickLinesPosition||"inside"==i.labelPosition?("inside"!=i.tickLinesPosition&&"inside"!=i.labelPosition||1!=t)&&(n=this.model.elementSpacing+i._LableMaxWidth.height+c+i.majorTickLines.size+i.axisLine.width):n=this.model.elementSpacing+i._LableMaxWidth.height+c+i.axisLine.width:n=this.model.elementSpacing+c+i.majorTickLines.size+i.axisLine.width:n=this.model.elementSpacing+c+i.axisLine.width,a.data={title:i.title.text,location:{x:i.width/2,y:n},axes:i},this._trigger("axesTitleRendering",a),o={id:this.svgObject.id+"_XAxisTitle_"+t,x:a.data.location.x+i.x,y:(u?i.y-a.data.location.y:(g?this.model.scrollerSize:0)+(a.data.location.y+i.y))+h.height/3.5,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":"middle"},this.model.enableCanvasRendering){var f=jQuery.uaMatch(navigator.userAgent),b=!!navigator.userAgent.match(/Trident\/7\./),v=f.browser.toLowerCase();"msie"==v||b||(o.y=u?o.y+c/2+1:o.y+c/2+("mozilla"==v?1:-2))}e(this.svgObject).find("#"+this.svgObject.id+"_XAxisTitle_"+t).length>0?e(this.svgObject).find("#"+this.svgObject.id+"_XAxisTitle_"+t).attr(o):p?p&&(ej.util.isNullOrUndefined(_)||_>0||isNaN(_))&&(r={X:o.x-h.width/2,Y:o.y,Width:h.width,Height:h.height},l={Bounds:r,trimText:m,labelText:i.title.text},this.model.xAxisTitleRegion.push(l),this.svgRenderer.drawText(o,m,d)):this.svgRenderer.drawText(o,a.data.title,d),e(d).appendTo(this.gXaxisEle)}},_drawYTitle:function(t,i){var s,a,n,o,r;if(""!=i.title.text&&i.title.text&&i.title.visible){var l=i._opposed,d=this.svgRenderer.createGroup({id:this.svgObject.id+"_YAxisTitleGroup_"+t,cursor:"default"}),h=ej.EjSvgRender.utils._measureText(i.title.text,i.height,i.title.font);"inside"!=i.tickLinesPosition||"inside"!=i.labelPosition||1!=t&&i.x!=this.model.m_AreaBounds.Width+this.model.m_AreaBounds.X&&i.x!=this.model.m_AreaBounds.X?1!=t&&i.x!=this.model.m_AreaBounds.Width+this.model.m_AreaBounds.X&&i.x!=this.model.m_AreaBounds.X||"inside"==i.tickLinesPosition||"inside"!=i.labelPosition?1!=t&&i.x!=this.model.m_AreaBounds.Width+this.model.m_AreaBounds.X&&i.x!=this.model.m_AreaBounds.X||"inside"!=i.tickLinesPosition||"inside"==i.labelPosition?("inside"!=i.tickLinesPosition&&"inside"!=i.labelPosition||1!=t)&&(s=l?i.x+(3*this.model.elementSpacing+i._LableMaxWidth.width+i.majorTickLines.size+i.axisLine.width):i.x-(3*this.model.elementSpacing+i._LableMaxWidth.width+i.majorTickLines.size+i.axisLine.width)):s=l?i.x+(3*this.model.elementSpacing+i._LableMaxWidth.width+i.axisLine.width):i.x-(3*this.model.elementSpacing+i._LableMaxWidth.width+i.axisLine.width):s=l?i.x+(3*this.model.elementSpacing+i.majorTickLines.size+i.axisLine.width):i.x-(3*this.model.elementSpacing+i.majorTickLines.size+i.axisLine.width):s=l?i.x+(3*this.model.elementSpacing+i.axisLine.width-5):i.x-(3*this.model.elementSpacing+i.axisLine.width);var c=i.title.text,u=i.title.enableTrim,m=(this.model.requireInvertedAxes,this.model._yScroll),p=i.title.maximumTitleWidth,g=ej.EjSvgRender.utils._measureText(c,i.height,i.title.font);if(u&&(ej.util.isNullOrUndefined(p)||p>0||isNaN(p)))for(a=p?p:i.height-2*this.model.elementSpacing;g.width>a;)if(c=this.trimText(c,c.length,"..."),g=ej.EjSvgRender.utils._measureText(c,i.height,i.title.font),"..."==c){c="";break}s=i.opposedPosition?s:s-(m?this.model.scrollerSize:0),8===document.documentMode&&(s=l?s+g.width/2-this.model.elementSpacing:s-g.width/2+this.model.elementSpacing),n=e.extend({},ej.EjSvgRender.commonChartEventArgs),n.data={title:i.title.text,location:{x:h.width/2,y:0},axes:i},this._trigger("axesTitleRendering",n);var _=n.data.location.y+(i.y+i.height)+i.height/-2,f=l?90:-90,b={id:this.svgObject.id+"_YAxisTitle_"+t,x:s,y:_,fill:i.title.font.color,labelRotation:f,transform:"rotate("+f+","+s+","+_+")","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":"middle","dominant-baseline":"middle"};if(this.model.enableCanvasRendering){var v=jQuery.uaMatch(navigator.userAgent),x=!!navigator.userAgent.match(/Trident\/7\./),w=v.browser.toLowerCase();"msie"==w||x||(b.x=l?b.x-h.height/4+1:b.x+h.height/4+("mozilla"==w?1:-2))}e(this.svgObject).find("#"+this.svgObject.id+"_YAxisTitle_"+t).length>0?e(this.svgObject).find("#"+this.svgObject.id+"_YAxisTitle_"+t).attr(b):u?u&&(ej.util.isNullOrUndefined(p)||p>0||isNaN(p))&&(o=this.svgRenderer.vmlNamespace?{X:b.x-g.width/2,Y:b.y+g.height/2,Width:g.width,Height:g.height}:{X:b.x-g.height/2,Y:b.y+g.width/2,Width:g.height/2,Height:g.width},r={Bounds:o,trimText:c,labelText:i.title.text},this.model.yAxisTitleRegion.push(r),this.svgRenderer.drawText(b,c,d)):this.svgRenderer.drawText(b,n.data.title,d),e(d).appendTo(this.gYaxisEle)}}},ej.EjStripline.prototype={_drawStripline:function(e,t){var i,s,a,n,o,r,l,d,h,c,u,m,p,g,_=t.starte.range.max?e.range.max:t.end,b=0,v=0,x=0,w=0,y=0,C=0,S=0,T=0,D=0,I=0;if(t.visible&&(this.model._stripeline=!0,i="over"==t.zIndex?this.gStriplineOver:this.gStriplineBehind,i=ej.util.isNullOrUndefined(i)?"":i,s=!0,"horizontal"==e.orientation.toLowerCase()?(a=0,t.startFromAxis?(n=ej.util.isNullOrUndefined(t.offset)?e.visibleRange.min:e.visibleRange.min+t.offset,a=(n-e.visibleRange.min)/e.visibleRange.delta*e.width+e.x,T=(n+(ej.util.isNullOrUndefined(t.width)?0:t.width)-e.visibleRange.min)/e.visibleRange.delta*e.width):ej.util.isNullOrUndefined(_)&&(ej.util.isNullOrUndefined(f)||ej.util.isNullOrUndefined(t.width))?s=!1:(_="date"==jQuery.type(_)?_.getTime():_,ej.util.isNullOrUndefined(f)||"date"!=jQuery.type(f)||(f=f.getTime()),a=ej.EjSvgRender.utils._getPointXY(_,e.visibleRange,e.isInversed)*e.width+e.x,o=ej.EjSvgRender.utils._getPointXY(f,e.visibleRange,e.isInversed)*e.width+e.x,r=ej.EjSvgRender.utils._getPointXY(_+(ej.util.isNullOrUndefined(t.width)?0:t.width),e.visibleRange,e.isInversed)*e.width+e.x,T=(e.isInversed?or)?Math.abs(a-o):Math.abs(a-r)),S=T,v=this.chart.model.m_AreaBounds.Height,b=e.isInversed?a-T:a,w=this.chart.model.m_AreaBounds.Y,x=-90,l=ej.EjSvgRender.utils._measureText(t.text,null,t.font).height,"middletop"==t.textAlignment?(D=b+l,I=Math.abs(w+v/2)):"middlecenter"==t.textAlignment?(D=Math.floor(b+S/2)+l/3,I=Math.abs(w+v/2)):"middlebottom"==t.textAlignment&&(D=b+S-l,I=Math.abs(w+v/2))):(t.startFromAxis?(d=ej.util.isNullOrUndefined(t.offset)?e.visibleRange.min:e.visibleRange.min+t.offset,y=e.y+e.height-(d-e.visibleRange.min)/e.visibleRange.delta*e.height,T=(d+(ej.util.isNullOrUndefined(t.width)?0:t.width)-e.visibleRange.min)/e.visibleRange.delta*e.height,C=T):ej.util.isNullOrUndefined(_)&&(ej.util.isNullOrUndefined(f)||ej.util.isNullOrUndefined(t.width))?s=!1:(_="date"==jQuery.type(_)?_.getTime():_,ej.util.isNullOrUndefined(f)||"date"!=jQuery.type(f)||(f=f.getTime()),y=e.y+e.height-ej.EjSvgRender.utils._getPointXY(_,e.visibleRange,e.isInversed)*e.height,h=e.y+e.height-ej.EjSvgRender.utils._getPointXY(ej.util.isNullOrUndefined(f)?0:f,e.visibleRange,e.isInversed)*e.height,c=e.y+e.height-ej.EjSvgRender.utils._getPointXY(_+(ej.util.isNullOrUndefined(t.width)?0:t.width),e.visibleRange,e.isInversed)*e.height,C=(e.isInversed?h>c:h=i&&Math.ceil(t.Height)>=s&&(a=!0),a},drawLegendTitle:function(){var e,t=this.chartObj,i=t.model,s=i.legend,a=i.LegendBounds,n=i.elementSpacing,o=s.title,r=ej.EjSvgRender.utils._measureText,l=o.font,d=a.Width,h=r(o.text,null,l),c=h.width,u=h.height,m=o.textAlignment.toLowerCase(),p=0,g=n+u/2;switch(m){case"far":p=d-c-p;break;case"center":p=d/2-c/2}p<0&&(p=0,d=c),dP.height?L:P.height)/2},M=t.PointIndex,O=t.SeriesIndex,E=M?M:O,A=g.series[O],j=p.svgObject,N=t.LegendStyle,z=(jQuery.uaMatch(navigator.userAgent),!!navigator.userAgent.match(/Trident\/7\./),A.type.toLowerCase());for(name in D)if(t.Shape.toLowerCase()==name.toLowerCase()){l="seriestype"==name.toLowerCase()?"SeriesType":name;break}if("SeriesType"==l&&(("radar"==z||"polar"==z)&&(d=A.drawType,l=d.capitalizeFirstString()),"scatter"==z&&(d=A.marker.shape,l=d.capitalizeFirstString()),t.drawType&&(l="SeriesType"),p.vmlRendering&&("pie"==z||"doughnut"==z)&&(l="Circle")),"None"==l&&(l="pie"==z||"doughnut"==z?"Circle":"Rectangle"),E=ej.util.isNullOrUndefined(M)?O:M,p.gLegendItemEle=S.createGroup({id:j.id+"_Legend"+E,cursor:"pointer"}),t.CommonEventArgs.data.gLegendItemEle=p.gLegendItemEle,o=e.extend(!0,{},t.CommonEventArgs.data),o.model=p.model,r=o.style,!t.CommonEventArgs.cancel){if(startLocation=C.chartSymbol["_draw"+l](R,r,o,p.gLegendItemEle),a=N.Color&&"gray"!==N.Color.toString().toLowerCase()&&I?T.color:N.Color&&"gray"!==N.Color.toLowerCase()?T.color:"gray",n=t,u=n.Text.length,("seriestype"==_.shape||"seriesType"==_.shape)&&(i+=x/2),m={id:this.chartObj.svgObject.id+"_LegendItemText"+E,x:P.width+i+x/2,y:R.startY,fill:a,"font-size":T.size,"font-style":T.fontStyle,"font-family":T.fontFamily,"font-weight":T.fontWeight,"text-anchor":"start",lgndCtx:!0},m.y=R.startY+L/4,"wrap"==f||"wrapandtrim"==f)for(m.y=m.y-L,k=0;k0?u.itemPadding:0,j=10,N=10,z=""==S.text?0:k(S.text,O-P.left-P.right,S.font).height+v,F=c._titleLocation?c._titleLocation.Y:0+z,B=k(D.text,null,D.font),H=B.height,V=B.width,U=c._rowDefinitions,W=0,G=c._columnDefinitions,Y=this.sumofArray(U.farSizes),X=this.sumofArray(U.nearSizes),$=(this.sumofArray(G.farSizes),this.sumofArray(G.nearSizes)),q=!1,K=c.m_AreaBounds,Q=u.enableScrollbar,Z=e(h.legendContainer),J=e("#ScrollerParent_vertical_"+h._id).length>0?18:0,ee=e("#ScrollerParent_horizontal_"+h._id).length>0?18:0,te=e(h.legendSvgContainer),ie=1.2,se=10,ae=10,ne=parseInt(C)*ie;if(subTitleTextHeight=parseInt(T)*ie,c.legend.border&&!S.text&&(subTitleTextHeight=0,ae=5),"right"==f||"left"==f?j=10:N=Q?E>200?10:E>100?5:0:10,m.Height+=H,p.Height+=H,u.visible){if("custom"!=f){if("cartesianaxes"==_)switch(f){case"bottom":p.Y=K.Y+K.Height+$-v/2+ee;break;case"top":p.Y=0==F?L+v:ne+se+subTitleTextHeight+ae+v;break;case"right":p.X=K.X+K.Width+Y+2*v;break;case"left":p.X=K.X-X-g.Width-v/2-2*I-J}else switch(f){case"bottom":p.Y=E-(g.Height+I)-2*v;break;case"top":p.Y=0==F?L+v:ne+se+subTitleTextHeight+ae+v;break;case"right":p.X=O-g.Width-2*v;break;case"left":p.X=L+2*v}if(!c.enable3D&&"cartesianaxes"==_&&null!=t._crossAxisOverlap)for(a=0,n=c._axes.length;ap.Y?p.Y+=oe.y+re-p.Y:"left"==f&&!le&&oe._opposed&&oe.x-rep.X&&(p.X-=p.X+p.Width-oe.x+re)}if("left"==f||"right"==f)if(Q)switch(b){case"center":p.Y=K.Height/2-g.Height/2+K.Y-I;break;case"near":p.Y=K.Y;break;case"far":p.Y=K.Y+K.Height-g.Height-2*I}else switch(b){case"center":p.Y=E/2-(g.Height+2*I)/2+v/2;break;case"near":p.Y=L+2*v;break;case"far":p.Y=E-(g.Height+I)-2*v}else switch(b){case"center":p.X=O/2-(g.Width+2*I)/2+v/2;break;case"near":p.X=L+2*v;break;case"far":p.X=O-(g.Width+I)-2*v}}else p.Y=u.location.y=K.Height)for(o=2*I,l=0;lK.Height){g.Height=K.Height-2*I,p.Y=K.Y;break}}else if(2*I+g.Width>=O)for(r=2*I,l=0;lO){g.Width=O-2*I-g.vScrollSize-2*L,p.X=O/2-(g.Width+2*I)/2+v/2;break}for(h.legendSvgContainer.height=p.Height,h.legendSvgContainer.width=Math.max(V,p.Width),currentX=i=j,currentY=s=N,""!=D.text&&D.text&&(this.drawLegendTitle(),currentY=s=N+H),l=0;lp.Height+s&&(currentY=s,currentX+=W+A),this.drawLegendItem(R[l],currentX,currentY),currentY+=R[l].Bounds.Height+A,W=Math.max(W,R[l].Bounds.Width)):(currentX+R[l].Bounds.Width>p.Width+i&&(currentX=j,currentY+=R[l].Bounds.Height+A),this.drawLegendItem(R[l],currentX,currentY),currentX+=R[l].Bounds.Width+A);var de=h.legendContainer[0].offsetLeft,he=e("#"+h._id).offset(),ce=h.vmlRendering?de<=0?p.X:de-he.left:e(h.svgObject).offset().left-he.left,ue=h.vmlRendering?ce:p.X+(ce<=0?0:ce);Z.attr("style",""),u._ejScroller&&e("#"+Z[0].id).ejScroller("instance").destroy(),Z.show(),Z.css({position:"absolute",background:u.background,left:ue,top:p.Y,width:g.Width,height:g.Height,"border-width":u.border.width,"border-color":u.border.color,"border-style":"solid"}),te.css({height:p.Height,width:p.Width}),p.Height=p.Height-(20-2*N),d=this.legendRectSpace(p,g),Q&&(u._ejScroller?!d&&(p.Width>Math.ceil(g.Width)||p.Height>Math.ceil(g.Height))?(e("#"+Z[0].id).ejScroller({scrollTop:h.scrolltop,scrollLeft:h.scrollleft,height:g.Height,width:g.Width}),q=!0,p.Height>Math.ceil(g.Height)&&0==g.vScrollSize&&(vScrollSize=Z[0].offsetWidth+5*I-Z[0].clientWidth,Z.css({width:g.Width+vScrollSize}))):u._ejScroller=!1:!d&&p.Width>Math.ceil(g.Width)&&p.Height>Math.ceil(g.Height)?(Z.css({overflow:"scroll"}),q=!0):(!d&&p.Height>Math.ceil(g.Height)&&g.vScrollSize>=0&&(Z[0].style.overflowY="scroll",Z[0].style.overflowX="hidden",0==g.vScrollSize&&(vScrollSize=Z[0].offsetWidth-2*I-Z[0].clientWidth,Z.css({width:g.Width+vScrollSize})),q=!0),!d&&p.Width>Math.ceil(g.Width)&&g.hScrollSize>=0&&(Z[0].style.overflowX="scroll",Z[0].style.overflowY="hidden",0==g.hScrollSize&&(hScrollSize=Z[0].offsetHeight-2*I-Z[0].clientHeight,Z.css({height:g.Height+hScrollSize})),q=!0))),h.svgRenderer.append(h.gLegendEle,h.legendSvgContainer),q||Z.css({width:g.Width-g.vScrollSize,height:g.Height-g.hScrollSize}),u._ejScroller||(void 0!=h.scrolltop&&Z.scrollTop(h.scrolltop),void 0!=h.scrollleft&&Z.scrollLeft(h.scrollleft))}else Z.hide()}}}(jQuery),ej.seriesTypes={},ej.EjSeriesRender=function(){},ej.indicatorTypes={},ej.EjIndicatorRender=function(){},ej.trendlineTypes={},ej.EjTrendLineRenderer=function(){},function(e){function t(t,i){var s=function(){};return s.prototype=new t,e.extend(s.prototype,i),s}ej.EjTrendLineRenderer.prototype={draw:function(t,i,s){var a,n;return this.chartObj=s,a=e.inArray(t,i.trendlines),t.xAxis=i.xAxis,t.yAxis=i.yAxis,n=t.type.toLowerCase(),"linear"==n||"movingaverage"==n?this.calculateLineDirection(t,i,a):this.calculateSplineDirection(t,i,a),!1},calculateSplineDirection:function(e,t,i){for(var s,a="",n=ej.EjSvgRender.utils._getStringBuilder(),o=!0,r=e.points,l=ej.EjSeriesRender.prototype.naturalSpline(r),d=null,h=null,c=-1,u=r.length,m=0;m6?6:t.polynomialOrder,a>1&&(this.updateTrendSource(e,t),this.calculatePolynomialTrendline(e,t,i));break;case"movingaverage":this.updateMovingAverageTrendSource(e,t),this.calculateMovingAverageTrendline(e,t,i)}return e.points.length>1&&this.calculateTrendLineRange(t,i),!1},updateTrendSource:function(e,t){var i,s=e.points,a=s.length;for(t.xPoints=[],t.xValues=[],t.yValues=[],i=0;i1&&("datetime"==i._valueType?(s=this._increaseDateTimeInterval(t.xPoints[0],-t.backwardForecast,i._intervalType),a=this._increaseDateTimeInterval(t.xPoints[r-1],t.forwardForecast,i._intervalType)):(s=t.xPoints[0]-t.backwardForecast,a=t.xPoints[r-1]+t.forwardForecast),n=t.slope*(1-(r-1)*t.backwardForecast/(e.maxX-e.minX))+t._intercept,o=t.slope*(r+(r-1)*t.forwardForecast/(e.maxX-e.minX))+t._intercept,t.points.push({x:s,xValue:s,y:n,YValues:[],visible:!0}),t.points.push({x:a,xValue:a,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(e,t){var i,s,a=e.points.length;for(e.minY=e.points[0].y,e.maxY=e.points[a-1].y,t.setRange||(e.backwardForecast>0&&"category"!=t._valueType&&a>1&&(t.range.min=t.range.min>e.points[0].x?e.points[0].x:t.range.min,t.visibleRange.min=t.range.min),e.forwardForecast>0&&a>1&&(t.range.max=t.range.max1){"datetime"==i._valueType?(s=this._increaseDateTimeInterval(t.xPoints[0],-t.backwardForecast,i._intervalType),o=s.getTime(),a=t.xPoints[h-1],r=a.getTime(),n=this._increaseDateTimeInterval(t.xPoints[d-1],t.forwardForecast,i._intervalType),l=n.getTime()):(s=o=t.xPoints[0]-t.backwardForecast,a=r=t.xPoints[h-1],n=l=t.xPoints[d-1]+t.forwardForecast);var c=t._intercept*Math.exp(t.slope*(1-(d-1)*t.backwardForecast/(e.maxX-e.minX))),u=t._intercept*Math.exp(t.slope*h),m=t._intercept*Math.exp(t.slope*(d+(d-1)*t.forwardForecast/(e.maxX-e.minX)));t.points.push({x:s,xValue:o,y:c,YValues:[],visible:!0}),t.points.push({x:a,xValue:r,y:u,YValues:[],visible:!0}),t.points.push({x:n,xValue:l,y:m,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=t(ej.EjTrendLineRenderer,{updateLogarithmicTrendSource:function(e,t){var i,s=e.points,a=s.length;for(t.xPoints=[],t.xValues=[],t.yValues=[],i=0;i1){"datetime"==i._valueType?(s=this._increaseDateTimeInterval(t.xPoints[0],-t.backwardForecast,i._intervalType),o=s.getTime(),a=t.xPoints[h-1],r=a.getTime(),n=this._increaseDateTimeInterval(t.xPoints[d-1],t.forwardForecast,i._intervalType),l=n.getTime()):(s=o=t.xPoints[0]-t.backwardForecast,a=r=t.xPoints[h-1],n=l=t.xPoints[d-1]+t.forwardForecast);var c=t._intercept+t.slope*Math.log(1)-(1-(d-1)*t.backwardForecast/(e.maxX-e.minX)),u=t._intercept+t.slope*Math.log(h),m=t._intercept+t.slope*Math.log(d+(d-1)*t.forwardForecast/(e.maxX-e.minX));t.points.push({x:s,xValue:o,y:c,YValues:[],visible:!0}),t.points.push({x:a,xValue:r,y:u,YValues:[],visible:!0}),t.points.push({x:n,xValue:l,y:m,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=t(ej.EjTrendLineRenderer,{updatePowerTrendSource:function(e,t){var i,s=e.points,a=s.length;for(t.xPoints=[],t.xValues=[],t.yValues=[],i=0;i1){"datetime"==i._valueType?(s=this._increaseDateTimeInterval(t.xPoints[0],-t.backwardForecast,i._intervalType),o=s.getTime(),a=t.xPoints[h-1],r=a.getTime(),n=this._increaseDateTimeInterval(t.xPoints[d-1],t.forwardForecast,i._intervalType),l=n.getTime()):(s=o=t.xPoints[0]-t.backwardForecast,a=r=t.xPoints[h-1],n=l=t.xPoints[d-1]+t.forwardForecast);var c=t._intercept*Math.pow(1,t.slope)-(1-(d-1)*t.backwardForecast/(e.maxX-e.minX)),u=t._intercept*Math.pow(h,t.slope),m=t._intercept*Math.pow(d+(d-1)*t.forwardForecast/(e.maxX-e.minX),t.slope);t.points.push({x:s,xValue:o,y:c,YValues:[],visible:!0}),t.points.push({x:a,xValue:r,y:u,YValues:[],visible:!0}),t.points.push({x:n,xValue:l,y:m,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=t(ej.EjTrendLineRenderer,{calculatePolynomialTrendline:function(e,t,i){var s,a,n,o,r,l,d,h,c,u,m=t.polynomialOrder;for(t.polynomialSlopes=new Array(m+1),s=t.xValues.length,c=0;cd&&(r=a.getTime())),n=this.getPolynomialYValue(o,d)),(1==s||s==o.length||"category"==t._valueType||l>d)&&(i.points.push({x:a,xValue:r,y:n,YValues:[],visible:!0}),i.points[i.points.length-1].YValues[0]=i.points[i.points.length-1].y)}return!1},getPolynomialYValue:function(e,t){for(var i=0,s=0;s=g&&(g=Math.abs(e[a][o]),l=a,_=o);if(++m[_],l!=_){for(a=0;a=0;--r)if(u[r]!=c[r])for(l=0;l=d?d-1:t.period;for(h=h<2?2:h,t.points=[],i=0;i0)for(l=0;lp.chartObj.model.m_AreaBounds.Width?p.chartObj.model.m_AreaBounds.Width-C.X:C.Width,n=Math.min(0,C.Width),o=Math.min(0,C.Height),C.Width<1e-4&&(C.Width=1e-4),(0==n||0==o)&&C.Width>0&&(options={id:this.chartObj.svgObject.id+"_"+h+"_"+d.name,x:C.X+p.chartObj.canvasX,y:C.Y+p.chartObj.canvasY,width:C.Width,height:C.Height,fill:m[a].fill?m[a].fill:i.fill,"stroke-width":d.border.width,plot:b<0?"negative":"positive",opacity:d.histogram.opacity,stroke:m[a].fill?m[a].fill:d.border.color},this.chartObj.svgRenderer.drawRect(options,this.gIndicatorGroupEle),l=ej.EjSvgRender.utils._getSvgXY(C.X,C.Y,d,p.chartObj),r={X:l.X,Y:l.Y,Width:C.Width,Height:C.Height},this._addRegion(p.chartObj,r,d,f,_))}}this.chartObj.svgRenderer.append(this.gIndicatorGroupEle,this.chartObj.gIndicatorEle)},_addRegion:function(e,t,i,s,a){var n,o=i.type;i.index>=0&&(n={SeriesIndex:i.index,Region:{PointIndex:a,Bounds:t},type:o,isIndicator:!0},e.model.chartRegions.push(n))},calculateSegment:function(t,i){var s,a,n,o,r,l,d,h,c,u;if(this.chartObj=i,t.segment=[],t.xRange={},t.yRange={},t.period=parseInt(t.period),t.period0){for(s=e.extend(!0,{},t),s.name="upperseries",s.fill=t.upperLine.fill,s.width=t.upperLine.width,s.type="line",a=0;ap?g+=m-p:mp?(g=(g*(f-1)+(m-p))/f,_=_*(f-1)/f):mt.xRange.min&&(e.model.indicatorRange[t.xAxisName].min=t.xRange.min),e.model.indicatorRange[t.xAxisName].maxt.yRange.min&&(e.model.indicatorRange[t.yAxisName].min=t.yRange.min),e.model.indicatorRange[t.yAxisName].max=0&&f<=_&&f>0){for(x=this.calculateEMA(t._points,f,!0),w=this.calculateEMA(t._points,_,!0),r=0;rp?t.yRange.max:p,t.segment.push(a);break;case"histogram":c=Math.min.apply(Math,S),u=Math.max.apply(Math,S),t.yRange.min=t.yRange.minu?t.yRange.max:u,t.segment.push(l);break;case"both":c=Math.min.apply(Math,S),u=Math.max.apply(Math,S),t.yRange.min=t.yRange.minu?t.yRange.max:u,t.segment.push(l),t.yRange.min=Math.min.apply(Math,y),t.yRange.max=Math.max.apply(Math,y),t.segment.push(s),m=Math.min.apply(Math,C),p=Math.max.apply(Math,C),t.yRange.min=t.yRange.minp?t.yRange.max:p,t.segment.push(a)}this.calculateIndicatorRange(i,t)}},calculateEMA:function(e,t,i){var s,a,n=0,o=0,r=e.length,l=[],d=[],h=2/(t+1);if(i){for(s=0;s=m;){for(l=0,r=0;r=c-1&&(t._points[a].YValues[0]=t._points[a].y=d[a-(c-1)]);for(trendSeries.points=e.extend(!0,[],t._points),xValues=i._getXValues(trendSeries.points),n=[],o=c,r=0;o=e+i&&a(e,i,s)}function a(e,i,s){for(var a,n,o,r,l,d,h=e+(i-1),c=[],u=[],m=0;m=h;){for(d=0,o=e-1;oe&&o(e,i,s)}function o(e,i,s){for(var a,n,o,r=e+i,l=[],d=[],h=0,c=0,u=0;ut._points.length||f>t._points.length||_>t._points.length)){for(r=e.extend(!0,{},t),r.name="upperseries",r.type="line",r.fill=t.upperLine.fill,r.width=t.upperLine.width,l=0;l0){for(_=0;_=C-1&&_=0?(a=t._points[_].close-t._points[_-C].close,b+=a,s=b/y,S[_]=s,T[_]=Math.pow(t._points[_].close-s,2),v+=T[_]-T[_-C]):(S[_]=s,T[_]=Math.pow(t._points[_].close-s,2),v+=T[_]);var I=Math.sqrt(v/y),k=S[_]-w*I,P=S[_]+w*I;if(_+1==C)for(n=0;n=C-1?(t._points[r].YValues.length=1,t._points[r].YValues[0]=t._points[r].y=D[r].ub):t._points[r].YValues[0]=t._points[r].y=null;for(o.points=e.extend(!0,[],t._points),l=i._getXValues(o.points),d=[],_=C;_=C-1?(t._points[c].YValues.length=1,t._points[c].YValues[0]=t._points[c].y=D[c].lb):t._points[c].YValues[0]=t._points[c].y=null;for(h.points=e.extend(!0,[],t._points),l=i._getXValues(h.points),u=[],_=C;_=C-1?(t._points[p].YValues.length=1,t._points[p].YValues[0]=t._points[p].y=D[p].mb):t._points[p].YValues[0]=t._points[p].y=null;for(m.points=e.extend(!0,[],t._points),l=i._getXValues(m.points),g=[],_=C;_t._points.length)){for(c=0;c0&&(n=Math.abs(t._points[c].high-t._points[c-1].close),o=Math.abs(t._points[c].low-t._points[c-1].close)),u=Math.max(a,n,o),p+=u,m=p/g,s[c]={X:t._points[c].X,YValues:m};for(c=g;c=g-1?(t._points[l].YValues.length=1,t._points[l].YValues[0]=t._points[l].y=s[l].YValues):t._points[l].YValues[0]=t._points[l].y=null;for(r.points=e.extend(!0,[],t._points),d=i._getXValues(r.points),h=[],c=g;c=f;){for(g=0,l=0;l=f;){for(d=0,l=0;l0&&a=0;s--)o[s]=o[s]*o[s+1]+r[s];return o},getBezierControlPoints:function(e,t,i,s,a){var n,o,r=1/3,l=t.xValue-e.xValue;l*=l;var d=2*e.xValue+t.xValue,h=e.xValue+2*t.xValue,c=2*e.YValues[a]+t.YValues[a],u=e.YValues[a]+2*t.YValues[a],m=r*(c-r*l*(i+.5*s)),p=r*(u-r*l*(.5*i+s));return n={xValue:d*r,YValues:[m]},o={xValue:h*r,YValues:[p]},{controlPoint1:n,controlPoint2:o}},improveChartPerformance:function(e){for(var t,i,s,a=[],n=e.xAxis.visibleRange,o=e.yAxis.visibleRange,r=e.points,l=this.chartObj.model.m_AreaBounds,d=n.max-n.min,h=o.max-o.min,c=Math.abs(1*d/l.Width),u=Math.abs(1*h/l.Height),m=r[0]&&r[0].X>c?0:c,p=r[0]&&r[0].y>u?0:u,g=0,_=0,f=r.length,b=0,v=0;v=c||Math.abs(p-_)>=u)&&(a[b]=s,m=g,p=_,b++);return t=this._calculateEmptyPoints(e,a),e._visiblePoints=e._visiblePoints?e._visiblePoints:t,t},_isVisiblePoints:function(e){for(var t,i,s=e.points,a=ej.util.isNullOrUndefined,n=s.length,o=0;oo&&d[n]r&&(h[h.length]=d[n]%360<0?d[n]%360+360:d[n]%360);if(1==this.chartObj.model.centerCount){var m=this.chartObj.model.circularRadius[l],p=2*Math.PI*(o-90)/360,g=2*Math.PI*(r-90)/360,_={x:this.chartObj.model.circleCenterX[l],y:this.chartObj.model.circleCenterY[l]},f={x:this.chartObj.model.circleCenterX[l]+m*Math.cos(p),y:this.chartObj.model.circleCenterY[l]+m*Math.sin(p)},b={x:this.chartObj.model.circleCenterX[l]+m*Math.cos(g),y:this.chartObj.model.circleCenterY[l]+m*Math.sin(g)};switch(h.length){case 0:var v=Math.abs(_.x-f.x)>Math.abs(_.x-b.x)?f.x:b.x,x=Math.abs(_.y-f.y)>Math.abs(_.y-b.y)?f.y:b.y,a={x:(_.x+v)/2,y:(_.y+x)/2};this.chartObj.model.circleCenterX[l]=this.chartObj.model.circleCenterX[l]+(this.chartObj.model.circleCenterX[l]-a.x),this.chartObj.model.circleCenterY[l]=this.chartObj.model.circleCenterY[l]+(this.chartObj.model.circleCenterY[l]-a.y);break;case 1:switch(i=2*Math.PI*(h[0]-90)/360,s={x:this.chartObj.model.circleCenterX[l]+m*Math.cos(i),y:this.chartObj.model.circleCenterY[l]+m*Math.sin(i)},h[0]){case 0:case 360:w={x:f.x,y:s.y},y={x:b.x,y:_.y};break;case 90:w={x:_.x,y:b.y},y={x:s.x,y:f.y};break;case 180:w={x:b.x,y:_.y},y={x:f.x,y:s.y};break;case 270:w={x:s.x,y:f.y},y={x:_.x,y:b.y}}a={x:(w.x+y.x)/2,y:(w.y+y.y)/2},this.chartObj.model.circleCenterX[l]=this.chartObj.model.circleCenterX[l]+(this.chartObj.model.circleCenterX[l]-a.x>=m?0:this.chartObj.model.circleCenterX[l]-a.x),this.chartObj.model.circleCenterY[l]=this.chartObj.model.circleCenterY[l]+(this.chartObj.model.circleCenterY[l]-a.y>=m?0:this.chartObj.model.circleCenterY[l]-a.y);break;case 2:var w,y,C=2*Math.PI*(h[0]-90)/360,i=2*Math.PI*(h[1]-90)/360,s={x:this.chartObj.model.circleCenterX[l]+m*Math.cos(i),y:this.chartObj.model.circleCenterY[l]+m*Math.sin(i)},S={x:this.chartObj.model.circleCenterX[l]+m*Math.cos(C),y:this.chartObj.model.circleCenterY[l]+m*Math.sin(C)};w=90==h[0]&&180==h[1]||270==h[0]&&0==h[1]?{x:S.x,y:s.y}:{x:s.x,y:S.y},y=90==h[0]||270==h[0]?{x:this.getMinMaxValue(f,b,h[0]),y:this.getMinMaxValue(f,b,h[1])}:{x:this.getMinMaxValue(f,b,h[1]),y:this.getMinMaxValue(f,b,h[0])},a={x:Math.abs(w.x-y.x)/2>=m?0:(w.x+y.x)/2,y:Math.abs(w.y-y.y)/2>=m?0:(w.y+y.y)/2},this.chartObj.model.circleCenterX[l]=this.chartObj.model.circleCenterX[l]+(0==a.x?0:this.chartObj.model.circleCenterX[l]-a.x>=m?0:this.chartObj.model.circleCenterX[l]-a.x),this.chartObj.model.circleCenterY[l]=this.chartObj.model.circleCenterY[l]+(0==a.y?0:this.chartObj.model.circleCenterY[l]-a.y>=m?0:this.chartObj.model.circleCenterY[l]-a.y)}}for(n=0;n1&&this.chartObj.model._visibleSeries[l+1].startAngle==o&&this.chartObj.model._visibleSeries[l+1].endAngle==r&&(this.chartObj.model.circleCenterX[l]=this.chartObj.model.circleCenterX[l+1],this.chartObj.model.circleCenterY[l]=this.chartObj.model.circleCenterY[l+1]),this.chartObj.model.startX[n]=this.chartObj.model.startX[n]-(c-this.chartObj.model.circleCenterX[l]),this.chartObj.model.startY[n]=this.chartObj.model.startY[n]-(u-this.chartObj.model.circleCenterY[l])},calculatingSliceAngle:function(t){var i,s,a,n,o,r,l,d,h,c,u,m=this.chartObj,p=m.model,g=p.legend,_=e.inArray(t,p._visibleSeries),f=g.position.toLowerCase(),b=p.LegendActualBounds,v=t._visiblePoints,x=v.length,w=0,y=0,C=g.border.width,S=p.border.width,T=p.margin,D=p.elementSpacing,I=0;for(p.arcData=[],t.rightsidePoints=[],t.leftsidePoints=[],t.labels=[],p.sumofYValues=0,p.midPoint=0,u=0;ue.Bottom||t.Left>e.Right)},IntersectWith:function(t,s,a,n,o){var r,l,d;if((ej.util.isNullOrUndefined(t.model.rightsidebounds[o])||ej.util.isNullOrUndefined(t.model.leftsidebounds[o]))&&(t.model.leftsidebounds[o]=[],t.model.rightsidebounds[o]=[],t.model.leftsidebounds[o].points=[],t.model.rightsidebounds[o].points=[]),"outsideExtended"==n){for(i=o;i0)for(r=t.model.bounds[i].points.left.length,l=r-1;l>=0&&!ej.util.isNullOrUndefined(t.model.bounds[i].points.left[l]);l--)t.model.leftsidebounds[i].points[l]=t.model.bounds[i].points.left[l];else if(!ej.util.isNullOrUndefined(t.model.bounds[i].points.right)&&t.model.bounds[i].points.right.length>0)for(r=t.model.bounds[i].points.right.length,k=0;k0||o>=0)for(i=o;i0&&(bounds=t.model.leftsidebounds[i].points,bounds.length>0))for(l=bounds.length-1;l>=0;l--)if(d=bounds[l],!(ej.util.isNullOrUndefined(d)&&d!=a)){if(d.SeriesIndex==a.SeriesIndex&&d.PointIndex==a.PointIndex){if("outside"==s.smartLabelPosition)continue;break}if(this.isIntersec(d,a))return!0}for(i=o;i0)for(l=bounds.length-1;l>=0;l--)if(d=bounds[l],!(ej.util.isNullOrUndefined(d)&&d!=a)){if(d.SeriesIndex==a.SeriesIndex&&d.PointIndex==a.PointIndex){if("outside"==s.smartLabelPosition)continue;break}if(this.isIntersec(d,a))return!0}return!1},_calculateArcData:function(e,t,i,s,a){var n,o,r=(s._visiblePoints,i.actualIndex),l=e,d=-.5*Math.PI,h=i.startAngle+d,c=i.endAngle+d-1e-6,u=s.endAngle-s.startAngle,m=c-h0?1:0,m=b?c-h-1*Math.PI?0:1,v=l.model.circularRadius[a],x=l.model.innerRadius[a];r!=s.explodeIndex&&!s.explodeAll||l.vmlRendering?(_=l.model.circleCenterX[a],f=l.model.circleCenterY[a]):(_=l.model.circleCenterX[a]+Math.cos(p)*s.explodeOffset,f=l.model.circleCenterY[a]+Math.sin(p)*s.explodeOffset);var w=_+v*Math.cos(h),y=f+v*Math.sin(h),C=_+v*Math.cos(c),S=f+v*Math.sin(c);if("doughnut"==s.type.toLowerCase()){var T=_+x*Math.cos(h),D=f+x*Math.sin(h),I=_+x*Math.cos(c),k=f+x*Math.sin(c),P=b?0:1;h<0&&6==Math.round(i.endAngle-i.startAngle)&&(I-=.01,C-=.01),g="M "+w+" "+y+" A "+v+" "+v+" 0 "+m+" "+b+" "+C+" "+S+" L "+I+" "+k+" A "+x+" "+x+" 1 "+m+" "+P+" "+T+" "+D+" z"}else(i.endAngle-i.startAngle).toFixed(4)==(2*Math.PI).toFixed(4)?(n=_,o=f,g="M "+w+" "+y+" A "+v+" "+v+" 0 "+m+" "+b+" "+C+" "+S):g="M "+w+" "+y+" A "+v+" "+v+" 0 "+m+" "+b+" "+C+" "+S+" L "+_+" "+f+" z";return{Direction:g,centerX:n,centerY:o}},getXCordinate:function(e,t,i){return e+t*Math.cos(i)},getYCordinate:function(e,t,i){return e+t*Math.sin(i)},getDoubleRange:function(e,t){var i,s;e>t?(i=t,s=e):(i=e,s=t);var a=s-i,n=(i+s)/2,o=isNaN(i)||isNaN(s);return{Start:i,End:s,Delta:a,Median:n,IsEmpty:o}},isDependentSeries:function(e){var t=e.type.toLowerCase(),i=this.chartObj.model.requireInvertedAxes;return!i||i&&e.isTransposed?t.indexOf("bar")!=-1&&!e._isTransposed||t.indexOf("column")!=-1||t.indexOf("waterfall")!=-1||t.indexOf("hilo")!=-1||t.indexOf("candle")!=-1:t.indexOf("bar")!=-1},getPointXYOrgin:function(e,t,i,s){var a,n,o=s.model.requireInvertedAxes;return i.isTransposed&&o||i._isTransposed?(a=(1-ej.EjSvgRender.utils._valueToCoefficient(i.xAxis,e))*i.xAxis.height,n=ej.EjSvgRender.utils._valueToCoefficient(i.yAxis,t)*i.yAxis.width,{X:n,Y:a}):(a=ej.EjSvgRender.utils._valueToCoefficient(i.xAxis,e)*i.xAxis.width,n=(1-ej.EjSvgRender.utils._valueToCoefficient(i.yAxis,t))*i.yAxis.height,{X:a,Y:n})},getRectangle:function(e,t,i,s,a,n){var o=this.getPointXYOrgin(e,t,a,n),r=this.getPointXYOrgin(i,s,a,n);return ej.EjSvgRender.utils._correctRect(o.X,o.Y,r.X,r.Y)},calculateSides:function(e,t){var i=e.xValue+t.Start,s=e.xValue+t.End;return{x1:i,x2:s}},_getSeriesPosition:function(e){var t,i,s,a,n,o,r,l;if(ej.util.isNullOrUndefined(e.position)||this.chartObj.model.legendCollapsed){for(s=0,a=[],n=0;n0&&u[0].columnWidth,k=0;kh+1){var S=r[h+1],g=ej.EjSvgRender.utils._getPoint(l,n),_=ej.EjSvgRender.utils._getPoint(S,n),x=this.chartObj;a.append("M "+(g.X+x.canvasX)+" "+(g.Y+x.canvasY)+" L "+(_.X+x.canvasX)+" "+(_.Y+x.canvasY)+" ")}l=d,h=c}else l=null;s=a.toString(),this._drawLinePath(n,o,s)}this.chartObj.svgRenderer.append(this.gSeriesGroupEle,this.chartObj.gSeriesEle)},doCircularAnimation:function(t,i,s,a){var n,o,r,l,d=i.type.toLowerCase();("pie"==d||"doughnut"==d)&&(n=this,l=i.points[0]?i.points[0].startAngle:0,e.each(i.visiblePoints,function(s,h){o=h.startAngle,r=h.endAngle,t.model._radius=t.model.circularRadius[a],h.startAngle=0,h.endAngle=h.startAngle,t.model.Radius=0;var c=e(t.gSeriesEle).find("#"+t.svgObject.id+"_SeriesGroup_"+a)[0].childNodes[s];"pie"==d?e(c).each(function(){this.StartAngle=l,this.EndAngle=l}).animate({StartAngle:o,EndAngle:r,pieRadius:t.model._radius},{duration:1200,queue:!1,step:function(o,r){if("StartAngle"===r.prop.toString()?(h.startAngle=o,h.endAngle=h.startAngle):"pieRadius"==r.prop.toString()&&t.model?t.model.Radius=o:h.endAngle=o,t.model){var l=n._calculateArcData(t,s,h,i,a);t.svgRenderer._setAttr(e(c),{d:l.Direction}),t.model.Radius=t.model._radius}},complete:function(){n.circularAnimationComplete(s,t,i)}}):e(c).each(function(){this.StartAngle=l,this.EndAngle=l}).animate({StartAngle:o,EndAngle:r},{duration:1200,queue:!1,step:function(o,r){if("StartAngle"===r.prop.toString()?(h.startAngle=o,h.endAngle=h.startAngle):h.endAngle=o,t.model){var l=n._calculateArcData(t,s,h,i,a);t.svgRenderer._setAttr(e(c),{d:l.Direction}),t.model.Radius=t.model._radius}},complete:function(){n.circularAnimationComplete(s,t,i)}})}))},circularAnimationComplete:function(t,i,s){var a,n,o,r=e.inArray(s,i.model._visibleSeries);if(i.svgRenderer._setAttr(e(i.gSeriesEle).find("#"+i.gSeriesTextEle[r].id),{visibility:"visible"}),i.gSymbolGroupEle&&i.svgRenderer._setAttr(e(i.gSeriesEle).find("#"+i.gSymbolGroupEle[r].id),{visibility:"visible"}),i.gDataLabelEle&&i.svgRenderer._setAttr(e(i.gSeriesEle).find("#"+i.gDataLabelEle[r].id),{visibility:"visible"}),s.marker.dataLabel.template)for(o=e(i.element[0].childNodes[0].childNodes),n=0;n-1?h.replace("{value}",c):ej.format(c,h):c,m=this.chartObj,p=m.model,g=e.inArray(t,p._visibleSeries),_=e.extend(!0,{},t.marker,s.marker),f=_.dataLabel,b=f.font,v=f.textPosition.toLowerCase(),x=t.type.toLowerCase(),w=ej.util.isNullOrUndefined(b.size)?"11px":b.size,y=ej.util.isNullOrUndefined(b.fontStyle)?"Normal":b.fontStyle,C=ej.util.isNullOrUndefined(b.fontFamily)?"Segoe UI":b.fontFamily,S={size:w,fontStyle:y,fontFamily:C},T=ej.EjSvgRender.utils._measureText(u,null,S),D=this.textPosition(t,g,s,T,x,a,n,o,i,r),I=e.extend({},ej.EjSvgRender.commonChartEventArgs);I.data={text:u,location:{x:D.x+m.canvasX,y:D.y+m.canvasY},seriesIndex:g,pointIndex:i},m._trigger("displayTextRendering",I);var k=void 0==_.dataLabel.offset.y?_.dataLabel.offset:_.dataLabel.offset.y,P=_.dataLabel.offset.x,T=ej.EjSvgRender.utils._measureText(I.data.text,null,S);if(I.data.location.y="bottom"==v?I.data.location.y+k:I.data.location.y-k,P&&(I.data.location.x=I.data.location.x+P),!I.cancel){var L={id:m.svgObject.id+"_SeriesText"+i+g,x:I.data.location.x,y:I.data.location.y,fill:b.color,"font-size":b.size,"font-family":b.fontFamily,"font-style":b.fontStyle,"font-weight":b.fontWeight,opacity:b.opacity,"text-anchor":"middle"},R=f.margin,M=T.width+R.left+R.right,O=T.height+R.top+R.bottom,E={X:I.data.location.x,Y:I.data.location.y};if(ej.util.isNullOrUndefined(f.template)){l=f.shape?f.shape:"None",e.each(p.symbolShape,function(e){l.toLowerCase()==e.toLowerCase()&&(d=e)});var A=I.data.location.x-R.left/2+R.right/2,j=I.data.location.y-R.top/2-O/R.top+R.bottom/2,N=f.angle,z=N>360?N-360:N<-360?N+360:N;p.enableCanvasRendering&&N%360!=0&&(L.y-=T.height/4,L.baseline="middle"),t._enableSmartLabels&&(s.dataLabel={textX:L.x,textY:L.y,x:A,y:j,width:M,height:O},s.margin={top:R.top,bottom:R.bottom}),s.y!=s.low||void 0===s.y&&void 0===s.low?(s.textOptions=L,s.textOptions.angle=z,s.drawText=I.data.text,s.index=i,s.xPos=A,s.yPos=j,s.seriesIndex=g,s.width="None"==d?T.width:M,s.height="None"==d?T.height:O,s.symbolName=d):(s.xPosLow=A,s.yPosLow=j,s.widthLow="None"==d?T.width:M,s.heightLow="None"==d?T.height:O,s.textOptionsLow=L,s.textOptionsLow.angle=z,s.drawTextLow=I.data.text)}else E.X-=m.canvasX,E.Y-=m.canvasY,this.drawLabelTemplate(t,s,i,E,m)}},updateSmartLabelPosition:function(t,i,s,a,n,o,r,l,d,h){var c,u,m,p,g,_,f,b,v,x,w,y,C,S,T,D=[],I=d,P=I.model,L=P.legend,R=P.LegendActualBounds,M=L.position.toLowerCase(),O=new(ej.seriesTypes[t.type.toLowerCase()]),E="",A="",j=a.connector.connectorX,N=a.connector.connectorY,z=a.midPoint.midX,F=a.midPoint.midY,B=(a.doughnutMidPoint.dMidX, a.doughnutMidPoint.dMidY,o.startX),H=o.startY,V=e.extend(!0,{},t.marker,i.marker),U=V.dataLabel.template?0:4,W=n,G=t.startAngle>t.endAngle?-.01:.01,Y=V.dataLabel.connectorLine.type.toLowerCase(),X=(t.type.toLowerCase(),P.circularRadius[h]);if(ej.util.isNullOrUndefined(P.bounds[h])&&(P.bounds[h]=[],P.bounds[h].points=[],"outsideextended"==t.labelPosition.toLowerCase()&&(P.bounds[h].points.left=[],P.bounds[h].points.right=[])),"inside"==t.labelPosition.toLowerCase()&&ej.util.isNullOrUndefined(i.smartLabelPosition)){positionX=(z+B)/2,positionY=(F+H)/2,positionX=(z+positionX)/2,positionY=(F+positionY)/2,q=i.isIntersected&&P.bounds[h].points[s]?P.bounds[h].points[s]:z>B?{X:positionX,Y:positionY,Left:positionX,Top:positionY,Right:positionX+l.width,Bottom:positionY+l.height,SeriesIndex:h,PointIndex:s}:{X:positionX,Y:positionY,Left:positionX-l.width,Top:positionY,Right:positionX,Bottom:positionY+l.height,SeriesIndex:h,PointIndex:s};do u=!1,this.IntersectWith(I,i,q,"inside",h)&&(m=q.Left,W+=G,i.isIntersected=!0,q.Angle=W,z>B?(q.X=q.Left=O.getXCordinate(B,X+r,W),q.Right=q.X+l.width):(q.X=q.Right=O.getXCordinate(B,X+r,W),q.Left=q.Right-l.width),q.Y=q.Top=O.getYCordinate(H,X+r,W),q.Bottom=q.Y+l.height,u=!0);while(u);z>B&&q.XB?{X:j,Y:N,Left:j,Top:N,Right:j+l.width,Bottom:N+l.height,SeriesIndex:h,PointIndex:s}:{X:j,Y:N,Left:j-l.width,Top:N,Right:j,Bottom:N+l.height,SeriesIndex:h,PointIndex:s};do u=!1,this.IntersectWith(I,i,q,"outside",h)&&(m=q.Left,W+=G,i.isIntersected=!0,z>B?(q.X=q.Left=O.getXCordinate(B,X+r,W),q.Right=q.X+l.width):(q.X=q.Right=O.getXCordinate(B,X+r,W),q.Left=q.Right-l.width),q.Y=q.Top=O.getYCordinate(H,X+r,W),q.Bottom=q.Y+l.height,u=!0);while(u);z>B&&q.X0&&(z0?x-X-2*b+v:t.LeftLabelMaxWidth>_?_:t.LeftLabelMaxWidth+v)-l.width/2,w=D[1].X-t.LeftLabelMaxWidth,C=x-X-2*b-t.LeftLabelMaxWidth>0?b:t.LeftLabelMaxWidth>_?0:w>3*(b/2)?b:w/2,connectorLineEdge=+l.width/2):(y=L.visible&&"right"==M?P.margin.right+R.Width:0,z=(x+X+2*b+t.RightLabelMaxWidthe(I.svgObject).width()?_:e(I.svgObject).width()-t.RightLabelMaxWidth-y)+l.width/2,w=e(I.svgObject).width()-t.RightLabelMaxWidth-D[1].X,C=x+X+2*b+t.RightLabelMaxWidthe(I.svgObject).width()?0:w>3*(b/2)?b:w/2,connectorLineEdge=-l.width/2),S=Math.sqrt(Math.pow(_-z,2)+Math.pow(f-F,2))/10,T=zD[2].X&&(D[2].X=D[1].X),x>D[0].X&&D[1].XD[D.length-2].X&&(D[D.length-2].X=D[D.length-1].X)):(P.bounds[h].points.right[i.index]=q,D[D.length-1].X0&&(b0?g.model.centerX-P-2*u+m:t.LeftLabelMaxWidth>labelX?labelX:t.LeftLabelMaxWidth:g.model.centerX+P+2*u+t.RightLabelMaxWidthe(g.svgObject).width()?labelX:e(g.svgObject).width()-t.RightLabelMaxWidth,p.push({X:b,Y:v}),f=ej.EjSvgRender.utils._getStringBuilder(),"bezier"!=D.dataLabel.connectorLine.type.toLowerCase()||g.vmlRendering){for(k=0;kg.Width&&"insideoverlap"==a._labelPlacement||"right"==t.model.legend.position&&p.template&&a.xPos+a.width>g.Width+t.model.LegendActualBounds.Width)&&(h=!1,a.drawTextacc=""):(a.yPos-o<0||a.xPos-n>g.Width&&"insideoverlap"==a._labelPlacement||"right"==t.model.legend.position&&p.template&&a.xPos+a.width>g.Width+t.model.LegendActualBounds.Width)&&(h=!1,a.drawTextacc=""),("outside"==u||"insideoverlap"==a._labelPlacement)&&h&&(c=this.drawConnectorLines(s,a,i,t)),p.template&&(r=e("#"+a.id),h?(l="insidenooverlap"==a._labelPlacement?a.textOptionsacc.x+t.pyrX-a.width/2:a.textOptionsacc.x+t.pyrX,d="insidenooverlap"==a._labelPlacement?a.textOptionsacc.y+t.pyrY:a.textOptionsacc.y+t.pyrY-t.model.elementSpacing,r.css("left",l).css("top",d),r.css("height",a.height).css("overflow","hidden")):r.css("display","none")),{xPos:a.xPos,yPos:a.yPos,textOptionsacc:a.textOptionsacc,connectorDirection:c.connectorDirection,bezierPath:c.bezierdir,drawTextacc:a.drawTextacc}},compareDataLabels:function(t,i,s,a,n){for(var o,r,l,d,h,c,u,m,p=e.extend(!0,{},a.marker,t.marker),g=p.dataLabel,_=n.model.elementSpacing,f=p.dataLabel.margin,b=a._visiblePoints.length,v=a.labelPosition.toLowerCase(),x=n.model.enableCanvasRendering?n.pyrX:0,w=n.model.enableCanvasRendering?n.pyrY:0,y=0,C=s.length;y360?c-360:c<-360?c+360:c,m="rotate("+u+","+t.textOptionsacc.x+","+t.textOptionsacc.y+")",e(t.textOptionsacc).attr("transform",m),e(t.textOptionsacc).attr("labelRotation",c),e(t.textOptionsacc).attr({transform:m}),("inside"==v||"outsideextended"==v)&&(t.yPos=t.yPos+_/4,t.textOptionsacc.y=t.textOptionsacc.y+t.height/4+f.top/2-f.bottom/2),s[s.length]=t},calculateInsideConnectorLines:function(t,i,s,a){var n,o=i.Polygon,r=e.extend(!0,{},s.marker,i.marker),l=r.dataLabel,d=l.font,h=a.model.enableCanvasRendering?a.pyrX:0,c=a.model.enableCanvasRendering?a.pyrY:0,u=70,m=ej.EjSvgRender.utils._measureText(i.drawTextacc,null,d),p=l.template?{x:i.xPos,y:i.yPos}:{x:i.xPos+m.width/2-h,y:i.yPos-i.height/2-c},g=a.isPointInPolygon(o,p);g?i._labelPlacement="insidenooverlap":(i._labelPlacement="insideoverlap",i.textOptionsacc["text-anchor"]="start",n=i.startX+ut.yPos+t.height||e.xPos+e.width/2t.xPos+t.width),s&&"pyramid"==o?(n=e.yPos+e.height-t.yPos,a=e.xPos+e.width-t.xPos):s&&"funnel"==o&&(n=e.yPos-(t.yPos+t.height),a=e.xPos+e.width-t.xPos),{state:s,height:n,width:a}},trimText:function(e,t,i){t--;var s=t-i.length;return trimmedText=e.substr(0,s),trimmedText+i},trimfunction:function(e,t,i,s,a,n){for(var e,i;t360?m-360:m<-360?m+360:m,g="rotate("+p+","+l+","+d+")";e(u).attr("transform",g),e(u).attr("labelRotation",m),e(u).attr({transform:g})}return u},labelTrim:function(e,t,i,s,a,n,o,r,l){var d,h,c,u,m,p,g=-.5*Math.PI,_=(.5*Math.PI,this.calculatePosition(e,t,i,a,n)),f=e.model.series[l].startAngle,b=e.model.series[l].endAngle,v=(e.model.chartRegions.length0?(ej.util.isNullOrUndefined(e.firstStartAngle[0])&&e.firstStartAngle.push(d),d=e.firstStartAngle[0]<0?2*Math.PI+d:d,h=e.firstStartAngle[0]<0?2*Math.PI+h:h):(d=d<0?2*Math.PI+d:d,h=h<0?2*Math.PI+h:h),d-=p,h-=p,f<0&&(b>0||null==b)&&(d=d<0?2*Math.PI+d:d,h=h<=0?2*Math.PI+h:h),c=e.model.circleCenterX[l]=d&&b<=h&&f>=d&&f<=h&&c<=e.model.circularRadius[l]&&c>0)u=!0;else for(u=!1;!u;){if(s=this.trimText(s,s.length,v),s==v){s="";break}datalabeltWidth=ej.EjSvgRender.utils._measureText(s,null,r),m=this.calculatePosition(e,t,datalabeltWidth.width,a,n),startangle=(Math.atan2(m.rightEndY,m.rightEndX)-g-p)%(2*Math.PI),startangle<0&&(startangle=2*Math.PI+startangle),b=(Math.atan2(m.leftEndY,m.leftEndX)-g-p)%(2*Math.PI),b<0&&(b=2*Math.PI+b),c=e.model.circleCenterX[l]=d&&b<=h&&startangle>=d&&startangle<=h&&c<=e.model.circularRadius[l]&&c>0&&(u=!0)}return s},drawDataLabelAcc:function(t,i,s,a,n){var o,r,l,d,h,c,u,m,p,g,_,f,b,v,x,w,y,C,S=a.marker;if(a.visible&&(S&&S.dataLabel&&S.dataLabel.visible||(!S||!S.dataLabel)&&i.marker.dataLabel.visible)){var T,D,I,k,P,L,R,M=t,O=i.type.toLowerCase(),E=new ej.seriesTypes[O],A=ej.util.isNullOrUndefined,j=i.labelPosition.toLowerCase(),N=M.model,z=N.title,F=ej.EjSvgRender.utils._measureText,B=N.elementSpacing,H=i.marker,V=H.dataLabel,U=V.margin,W=V.font,G=V.connectorLine,Y=G.type.toLowerCase(),X=N.legend,$=X.position.toLowerCase(),q=N.LegendActualBounds,K=A(a.text)?a.y:a.text,Q=0,Z=0;if(("pyramid"==O||"funnel"==O)&&"outsideextended"==j&&(j="inside"),I=e.extend({},ej.EjSvgRender.commonChartEventArgs),I.data={text:K,series:i,pointIndex:s},M._trigger("displayTextRendering",I),D={size:W.size,fontStyle:W.fontStyle,fontFamily:W.fontFamily},k=F(I.data.text,null,D),P=k.width+U.left+U.right,L=k.height+U.top+U.bottom,"pyramid"==O||"funnel"==O){var J=N.title.text?F(N.title.text,e(this.svgObject).width()-N.margin.left-N.margin.right,N.title.font):0,ee=M.model.title.subTitle.text?ej.EjSvgRender.utils._measureText(M.model.title.subTitle.text,e(this.svgObject).width()-M.model.margin.left-M.model.margin.right,M.model.title.subTitle.font):0,l=""===M.model.title.subTitle.text?0:ee.height,te=B+N.margin.left+("left"===$)?q.Width:0,ie=("top"===$?q.Height:0)+(N.title.text?N._titleLocation.Y+J.height+l:N.margin.top+B);P+=10,o={X:a.xLocation+M.pyrX,Y:a.yLocation+M.pyrY},Q=a.xLocation,Z=a.yLocation,r=a.marker?a.marker:H,r=e.extend(!0,{},H,r),T=a.connectorLine,symbolPos={positionX:Q,positionY:Z}}if("pyramid"!=O&&"funnel"!=O){var se,ae,ne,_,oe,re,le,de,he,ce,ue,me,pe,ge,_e=-.5*Math.PI,fe=a.midAngle+_e,J=N.title.text?F(N.title.text,e(this.svgObject).width()-N.margin.left-N.margin.right,N.title.font):0,ee=M.model.title.subTitle.text?ej.EjSvgRender.utils._measureText(M.model.title.subTitle.text,e(this.svgObject).width()-M.model.margin.left-M.model.margin.right,M.model.title.subTitle.font):0,l=""===M.model.title.subTitle.text?0:ee.height,be=N.circularRadius[n];re=A(G.height)?F(I.data.text,null,W).height:G.height,i._visiblePoints[s].actualIndex!=i.explodeIndex&&!i.explodeAll||M.vmlRendering?(le=N.circleCenterX[n],de=N.circleCenterY[n]):(le=N.circleCenterX[n]+Math.cos(fe)*i.explodeOffset,de=N.circleCenterY[n]+Math.sin(fe)*i.explodeOffset),he=E.getXCordinate(le,be,fe),ce=E.getYCordinate(de,be,fe),ue=E.getXCordinate(le,N.innerRadius[n],fe),me=E.getYCordinate(de,N.innerRadius[n],fe),pe=this.getXCordinate(le,be+re,fe),ge=this.getYCordinate(de,be+re,fe),V.template?size=a.size:(r=a.marker?a.marker:H,r=e.extend(!0,{},H,r),shape=r.dataLabel.shape,size=F(I.data.text,e(M.svgObject).width(),W),"none"!=shape.toLowerCase()&&(size.height=size.height+U.top+U.bottom,size.width=size.width+U.left+U.right)),se={midX:he,midY:ce},ae={dMidX:ue,dMidY:me},ne={connectorX:pe,connectorY:ge},_={midPoint:se,doughnutMidPoint:ae,connector:ne},oe={startX:le,startY:de},i._enableSmartLabels?(position=E.updateSmartLabelPosition(i,a,s,_,fe,oe,re,size,t,n),Q=position.positionX,Z=position.positionY,symbolPos={positionX:Q,positionY:Z,isInterSected:position.isInterSected},T=position.connectorDirection):(position=E.updateLabelPosition(i,a,s,_,fe,oe,re,size,t,n),Q=position.positionX,Z=position.positionY,T=position.connectorDirection)}var ve,xe="inside"!=j&&"insidenooverlap"!=j||("pyramid"==O||"funnel"==O)&&"outside"==j?Qa?"":y):(a=0==w?v+l:w+l,y=gn&&(y=""),y},drawBezierSegment:function(e,t,i,s,a){for(var n,o,r,l=ej.EjSvgRender.utils._getStringBuilder(),d=new(ej.seriesTypes[t.type.toLowerCase()]),h=0;h<=16;h++)n=h/16,o=d.GetBezierPoint(n,e,0,e.length,t),l.append(o.X+","+o.Y+" ");return r={id:s.svgObject.id+"_bezierLine_series"+a+"_point"+i,stroke:t.marker.dataLabel.connectorLine.color?t.marker.dataLabel.connectorLine.color:s.model.pointColors[i],"stroke-width":t.marker.dataLabel.connectorLine.width,fill:"none",points:l.toString()},t._enableSmartLabels?r:void s.svgRenderer.drawPolyline(r,s.gConnectorEle)},GetBezierPoint:function(e,t,i,s,a){var n=new(ej.seriesTypes[a.type.toLowerCase()]);if(1==s)return t[i];var o=n.GetBezierPoint(e,t,i,s-1,a),r=n.GetBezierPoint(e,t,i+1,s-1,a),l=o.X?o.X:o.x,d=o.Y?o.Y:o.y,h=r.X?r.X:r.x,c=r.Y?r.Y:r.y,u=(1-e)*l+e*h,m=(1-e)*d+e*c;return o.x?{x:u,y:m}:{X:u,Y:m}},drawLabelTemplate:function(t,i,s,a,n){var o,r,l,d,h,c,u,m,p,g;n&&(this.chartObj=n);var _,f,b,v=e.inArray(t,this.chartObj.model._visibleSeries),x=this.chartObj.model.AreaType,w=this.chartObj.model.series[v],y=0,C=0,S=this.chartObj._id,T=e.extend(!0,{},t.marker,i.marker),D={interior:T.dataLabel.fill,opacity:T.dataLabel.opacity,borderColor:T.dataLabel.border.color,borderWidth:T.dataLabel.border.width};this.chartObj.model.chartRegions[s]?this.chartObj.model.chartRegions[s].type:"";if("none"!=x||this.chartObj.model.enable3D){if(o=0!=e("#template_group_"+S).length?e("#template_group_"+S):e("
      ").attr("id","template_group_"+S),o.css("position","relative").css("z-index",1e3),0==e("#"+T.dataLabel.template).length)return;r=e("#"+T.dataLabel.template).clone(),e(r).attr("id",T.dataLabel.template+"_"+v+"_"+s+"_"+S),l=e(r),l.css("position","absolute"),d=i.x,i.dataLabeltemplate=!0,i.id=T.dataLabel.template+"_"+v+"_"+s+"_"+S,"datetime"==t.xAxis._valueType.toLowerCase()&&(i.x=ej.format(new Date(i.xValue),ej.util.isNullOrUndefined(t.xAxis.labelFormat)?ej.EjSvgRender.utils._dateTimeLabelFormat(t.xAxis._intervalType):t.xAxis.labelFormat)),"category"==t.xAxis._valueType.toLowerCase()&&(i.x=ej.EjSvgRender.utils._getLabelContent(s,t.xAxis)),i.count=1,h={series:t,point:i},l.html(l.html().parseTemplate(h)),i.x=d,c="cartesianaxes"!=x&&t.enableAnimation&&"pyramid"!=t.type.toLowerCase()&&"funnel"!=t.type.toLowerCase()?"none":"block",l.css("display",c).appendTo(e(o)),e(o).appendTo("#chartContainer_"+S),u=this.chartObj.model.m_AreaBounds,"cartesianaxes"!=x||this.chartObj.model.enable3D||(y=u.X+(this.chartObj.model.requireInvertedAxes?w.yAxis.plotOffset:w.xAxis.plotOffset),C=w.yAxis.y),f=l.width()/2,b=l.height(),_=ej.util.isNullOrUndefined(D)&&D.interior?D.interior:"none"==x?this.chartObj.model.pointColors[s]:this.chartObj.model.seriesColors[v]}else _=ej.util.isNullOrUndefined(D)&&D.interior?D.interior:this.chartObj.model.pointColors[s],f=this.chartObj.model.circleCenterX[v]>a.X?i.size.width:0,l=e("#template_group_"+S).find("#"+T.dataLabel.template+"_"+v+"_"+s+"_"+S),i.id=T.dataLabel.template+"_"+v+"_"+s+"_"+S,b=this.chartObj.model.enable3D?0:i.size.height/2;("hilo"==w.type||"hiloopenclose"==w.type||"candle"==w.type)&&(_=w._visiblePoints[s]._hiloFill),_="array"==jQuery.type(_)?_[0].color:_,w.type.indexOf("bar")!=-1?(m=a.X+y-f,p=a.Y+(this.chartObj.model.enable3D?0:u.Y)-b+w.xAxis.plotOffset):(m=a.X+y-f,p=C+a.Y-b),g=l[0].style.backgroundColor,l.css("left",m).css("top",p).css("background-color",""!=g?g:_).css("display","block").css("cursor","default"),"cartesianaxes"!=this.chartObj.model.AreaType?(i.xPos=m-this.chartObj.pyrX,i.yPos=p-this.chartObj.pyrY,i.textOptionsacc={x:m-this.chartObj.pyrX,y:p-this.chartObj.pyrY}):i.y==i.low?(i.xPosLow=m,i.yPosLow=p,i.textOptionsLow={x:m,y:p},i.dataLabelLow={textX:m,textY:p,x:m,y:p}):(i.xPos=m,i.yPos=p,i.seriesIndex=v,i.textOptions={x:m,y:p},i.dataLabel={textX:m,textY:p,x:m,y:p},i.margin={top:0,bottom:0,left:0,right:0}),i.height=l.outerHeight(),i.width=l.outerWidth(),"cartesianaxes"==x&&(m>y+u.Width||p+b>u.Y+u.Height||this.chartObj.zoomed&&(my+u.Width||p>C+u.Height))&&l.remove()},animateLabelTemplate:function(t){for(var i,s=e.inArray(t,this.chartObj.model._visibleSeries),a=t._visiblePoints.length,n=0;nT&&!t.yAxis.isInversed||s.yT&&!t.yAxis.isInversed||s.yT&&t.yAxis.isInversed||s.y=p&&S?o+I-a.width:o-I+C.left:"middle"==x?o=o=p&&S?o+I/2-a.width/2:o-I/2-a.width/2:o=p&&S?o-=y+a.width/1:o+=y+a.width/1):"bottom"==x?s.y>0&&!t.yAxis.isInversed||s.y<0&&t.yAxis.isInversed?o=C.left+a.width/4:o+=I-a.height-C.right:"middle"==x?s.y>0&&!t.yAxis.isInversed||s.y<0&&t.yAxis.isInversed?o-=I/2+a.width/2:o+=I/2:s.y>=0&&!t.yAxis.isInversed||s.y<0&&t.yAxis.isInversed?o+=y+a.width/1:o-=y+a.width/1,b&&"far"==b?o+="bottom"==x?a.width-a.width/4:y+a.width:b&&"near"==b?o-="bottom"==x?a.width/4:a.width+y:o+=a.width/4,v&&"near"==v?r+=k/2:v&&"far"==v&&(r-=k/2)}else if("rangecolumn"==D){var c=this.chartObj.model.chartRegions[w].Region.Bounds,P=0,L=0;s.high!=s.y&&(P=c.Height,L=c.Width),this.chartObj.model.requireInvertedAxes?"top"==x?o=o-L+(y+a.width/1):"bottom"==x?o=o-L-(2*a.width+y):"middle"==x&&(o-=L):"top"==x?r=r+P-(y+a.height/1):"bottom"==x?r=r+P+(2*a.height+y):"middle"==x&&(r+=P),b&&"far"==b.toLowerCase()?o+=c.Width/2:b&&"near"==b.toLowerCase()&&(o-=c.Width/2),v&&"near"==v.toLowerCase()?r+=a.height+y:v&&"far"==v.toLowerCase()&&(r-=y+a.height/2)}else if("waterfall"==n){var c=this.chartObj.model.chartRegions[w].Region.Bounds,k=c.Height,I=c.Width,R=s.waterfallSum<0||!s.showIntermediateSum&&!s.showTotalSum&&s.y<0;switch(x){case"bottom":t.isTransposed?o=t.yAxis.isInversed?o+I-(y+a.height/1)-(R?I:0):o-I+(y+a.height/1)+(R?I:0):r=t.yAxis.isInversed?r-a.height+C.bottom+(R?k:0):r+k-C.bottom-(R?k:0);break;case"middle":t.isTransposed?o=t.yAxis.isInversed?o+I/2-(R?I:0):o-(I/2+a.width/4)+(R?I:0):r=t.yAxis.isInversed?r-k/2+(R?k:0):r+(k/2+a.height/4)-(R?k:0);break;default:t.isTransposed?o=t.yAxis.isInversed?o-(y+a.height/1)-(R?I:0):o+(y+a.height/1)+(R?I:0):r=t.yAxis.isInversed?r+(y+a.height/1)+(R?k:0):r-(y+a.height/1)-(R?k:0)}b&&"far"==b?o+=I/2:b&&"near"==b&&(o-=I/2),v&&"near"==v?r+="bottom"==x?a.height/3:a.height+y:v&&"far"==v&&(r-="bottom"==x?a.height/3:y+a.height/2); }else"polar"==n||"radar"==n?(r+=a.height/4,"bottom"==x?r+=a.height:"top"==x&&(r-=a.height),b&&"far"==b?o+=a.width:b&&"near"==b&&(o-=a.width),v&&"near"==v?r+=a.height/2:v&&"far"==v&&(r-=a.height/2)):("rangearea"==D&&s.high!=s.y&&(g=this.chartObj.model.chartRegions[w].Region.Bounds.region.length,r=this.chartObj.model.chartRegions[w].Region.Bounds.region[g-1].Y,o=this.chartObj.model.chartRegions[w].Region.Bounds.region[g-1].X),this.chartObj.model.requireInvertedAxes?"top"==x?o+=2*a.width+y:"bottom"==x&&(o-=y+a.width/1):"bottom"==x?r+=2*a.height+y:"top"==x&&(r-=y+a.height/1),b&&"far"==b?o+=a.width+y:b&&"near"==b&&(o-=a.width+y),v&&"near"==v?r+=a.height+y:v&&"far"==v&&(r-=y+a.height/2));return{x:o,y:r}},changeCrossHairSymbol:function(t,i,s,a,n){var o,r,l,d;return ej.util.isNullOrUndefined(i)||(o={},t=e.extend(!0,{},n.marker,t),o=e.extend(!0,{},this.chartObj.model.crosshair.marker,o),r=n.points[s],l=n.type.toLowerCase(),ej.util.isNullOrUndefined(o.shape)&&(o.shape=t.shape,"bubble"==l&&(o.border.color=r.border&&r.border.color?r.border.color:n.border.color,o.border.width=r.border&&r.border.width?r.border.width:n.border.width)),(!this.chartObj.model.crosshair.visible||ej.util.isNullOrUndefined(o.fill))&&"bubble"!=n.type.toLowerCase()&&"scatter"!=n.type.toLowerCase()&&(o.fill="cross"==o.shape.toLowerCase()||"horizline"==o.shape.toLowerCase()||"vertline"==o.shape.toLowerCase()?"array"==jQuery.type(this.chartObj.model.seriesColors[a])?this.chartObj.model.seriesColors[a][0].color:this.chartObj.model.seriesColors[a]:t.border.color),"bubble"!=n.type.toLowerCase()||this.chartObj.model.enableCanvasRendering?(o.size.width<=t.size.width&&(o.size.width=t.size.width+2),o.size.height<=t.size.height&&(o.size.height=t.size.height+2),(ej.util.isNullOrUndefined(o.border.color)||!this.chartObj.model.crosshair.visible)&&(ej.util.isNullOrUndefined(t.fill)?"scatter"==l?(o.border.color=r.border&&r.border.color?r.border.color:n.border.color,o.border.width=r.border&&r.border.width?r.border.width:n.border.width):o.border.color=r.fill?r.fill:"array"==jQuery.type(this.chartObj.model.seriesColors[a])?this.chartObj.model.seriesColors[a][0].color:this.chartObj.model.seriesColors[a]:o.border.color="array"==jQuery.type(t.fill)?t.fill._gradientStop[0].color:t.fill)):(d=e(this.chartObj.gSeriesEle).find("#"+this.chartObj.svgObject.id+"_Series"+a+"_Point"+s)[0].getBoundingClientRect(),o.size.width=(d.right-d.left)/2+15,o.size.height=(d.bottom-d.top)/2+15)),n._trackMarker=o,o},dataLabelSymbol:function(t,i,s,a,n,o,r,l,d,h){var c,u,m,p=d;if("None"!=l){c=i._visiblePoints[s],u={startX:a,startY:n},d.model.enable3D||(m=h?h:p.gDataLabelEle[t]),m=p.model.enableCanvasRendering?null:m;var g=e.extend(!0,{},i.marker,c.marker),_={interior:g.dataLabel.fill,opacity:g.dataLabel.opacity,borderColor:g.dataLabel.border.color,borderWidth:g.dataLabel.border.width},f={style:_,gradientName:"symbol",symbolEle:m,width:o,height:r,point:c,location:u,seriesIndex:t,pointIndex:s,element:g,symbolName:l,id:p.svgObject.id+"_dataLabel_series"+t+"_"+s};this.drawSymbolStyle(f,p)}},drawSymbolStyle:function(t,i){var s,a,n,o,r,l,d,h,c,u,m=i,p=t.style,g=t.gradientName,_=t.symbolEle,f=t.width,b=(t.dashArray,t.height),v=t.point,x=t.location,w=t.seriesIndex,y=t.visibility,C=t.pointIndex,S=t.element,T=t.symbolName,D=t.trackSymbol,I=m.model.enableCanvasRendering,k="polaraxes"==m.model.AreaType,P=m.model.series[w];if(null!=p&&(""!=p.borderColor&&(s=p.borderColor?p.borderColor:"transparent"),n=p.opacity,a=p.borderWidth<0?0:p.borderWidth),o=null,p.interior?o=ej.util.isNullOrUndefined(p.interior._gradientStop)?p.interior:p.interior._gradientStop:v.fill?o="array"==jQuery.type(v.fill)?v.fill[0].color:v.fill:(r=m.model.pointColors,o="none"!=m.model.AreaType?"waterfall"==P.type.toLowerCase()&&P.positiveFill&&(v.y>0||v.waterfallSum>0)?P.positiveFill:m.model.seriesColors[w]:"array"==jQuery.type(r[C])?r[C][0].color:r[C]),m.symbolColorName=m.svgRenderer.createGradientElement(g+w,o,0,0,0,e(m.svgObject).height(),_),l={dashArray:t.dashArray,ShapeSize:{width:f,height:b},Style:{BorderColor:s,BorderWidth:a,Opacity:n,Visibility:y,Color:m.symbolColorName},PointIndex:C,SeriesIndex:w,Imageurl:S.imageUrl,Image:S.image,ID:t.id},d=e.extend({},ej.EjSvgRender.commonChartEventArgs),d.data={location:x,style:l},m._trigger("symbolRendering",d),!d.cancel)if(I)x.startY=m.model.requireInvertedAxes?x.startY:x.startY+(P.yAxis.y?P.yAxis.y-m.canvasY:0),d.data.location.startY=x.startY,ej.util.isNullOrUndefined(D)?"cartesianaxes"==m.model.AreaType?(_=m.svgRenderer.ctx,m.svgRenderer.ctx.save(),m.svgRenderer.ctx.beginPath(),m.model.requireInvertedAxes?m.svgRenderer.ctx.rect(P.yAxis.x,P.xAxis.y,P.yAxis.width,P.xAxis.height):m.svgRenderer.ctx.rect(P.xAxis.x,P.yAxis.y,P.xAxis.width,P.yAxis.height),m.svgRenderer.ctx.clip(),ej.EjSvgRender.chartSymbol["_draw"+T](d.data.location,d.data.style,m,_),m.svgRenderer.ctx.restore()):(I&&k&&(m.svgRenderer.ctx.save(),m.svgRenderer.ctx.beginPath(),m.svgRenderer.ctx.arc(m.model.centerX,m.model.centerY,m.model.Radius,0,2*Math.PI,!1),m.svgRenderer.ctx.clip()),ej.EjSvgRender.chartSymbol["_draw"+T](d.data.location,d.data.style,m,_),I&&k&&m.svgRenderer.ctx.restore()):(h=d.data.style.PointIndex,c=d.data.style.SeriesIndex,m.model.series[c].highlightSettings.enable||0==e("#"+m._id+"_selection_"+c+"_"+h+"_canvas").length&&m.svgRenderer.trackSymbol(d.data.style,d.data.location,T,D,m));else{var L,h=d.data.style.PointIndex,c=d.data.style.SeriesIndex,R=P.type;P.highlightSettings.enable&&D&&!m.model.crosshair.visible?(p=e.extend(!0,d.data.style),u=P.highlightSettings,p.Style.Color="none"==u.pattern.toLowerCase()||""==u.pattern?""!=u.color?u.color:p.Style.Color:"url(#"+u.pattern.toLowerCase()+"_Highlight_2D)",p.Style.Opacity=u.opacity,p.Style.BorderColor=u.border.color,p.Style.BorderWidth=u.border.width,L="bubble"==R?e("#"+this.chartObj.svgObject.id+"_Series"+c+"_Point"+h).attr("class"):e("#"+this.chartObj.svgObject.id+"_Series"+c+"_Point"+h+"_symbol").attr("class"),L!="SelectionStyleseries"+c&&ej.EjSvgRender.chartSymbol["_draw"+T](d.data.location,p,m,m.model.enable3D?i.chart3D:_)):(L="scatter"==R?e("#"+m.svgObject.id+"_Series"+c+"_Point"+h+"_symbol").attr("class"):e("#"+m.svgObject.id+"_Series"+c+"_Point"+h).attr("class"),L!="SelectionStyleseries"+c&&ej.EjSvgRender.chartSymbol["_draw"+T](d.data.location,d.data.style,m,m.model.enable3D?i.chart3D:_))}!i.chart3D&&"none"==m.model.AreaType&&e(_).children().not("defs").length>m.model._visibleSeries[w]._visiblePoints.length&&e(_.childNodes[t.pointIndex]).replaceWith(e(_.childNodes[e(_.childNodes).length-1]))},drawSymbol:function(t,i,s,a,n,o,r){var l,d,h,c,u;ej.util.isNullOrUndefined(this.chartObj)&&(this.chartObj=o);var m=i._visiblePoints[s],p=i.type.toLowerCase(),g="bubble"==p||"scatter"==p?i.border.dashArray:"",_="None",f=this.changeCrossHairSymbol(m.marker?m.marker:i.marker,r,s,t,i),b=f?f:e.extend(!0,{},i.marker,m.marker);if(e.each(this.chartObj.model.symbolShape,function(e){b.shape.toLowerCase()==e.toLowerCase()&&(_=e)}),"None"!=_){if(l="cartesianaxes"==this.chartObj.model.AreaType?{startX:a+this.chartObj.canvasX,startY:n+this.chartObj.canvasY}:{startX:a,startY:n},"scatter"==p)var v=m.border&&m.border.color?m.border.color:i.border.color,x=m.border&&m.border.width?m.border.width:i.border.width,d={interior:b.fill,opacity:b.opacity,borderColor:v,borderWidth:x};else d={interior:b.fill,opacity:b.opacity,borderColor:b.border.color,borderWidth:b.border.width};var w=r?this.chartObj.gTrackerEle:this.chartObj.gSymbolGroupEle[t],y=r?this.chartObj.svgObject.id+"_trackSymbol_"+t+"_"+s:this.chartObj.svgObject.id+"_Series"+t+"_Point"+s+"_symbol",C=r?"TrackSymbol":"symbol",S=b.size.width,T=b.size.height,D={style:d,gradientName:C,symbolEle:w,width:S,height:T,point:m,location:l,seriesIndex:t,pointIndex:s,element:b,visibility:m.visible?"visible":"hidden",symbolName:_,trackSymbol:r,id:y,dashArray:g};this.drawSymbolStyle(D,this.chartObj,r),"scatter"==i.type.toLowerCase()&&(h=i.xAxis.x,c=i.yAxis.y,this.chartObj.model.enableCanvasRendering&&(h=0,c=0),u={X:h+l.startX-T/2,Y:c+l.startY-S/2,Height:T,Width:S},ej.EjSvgRender.utils._addRegion(this.chartObj,u,i,null,s))}},chartAreaType:"cartesianAxes",requireInvertedAxes:!1,stackingSeries:!1,hiloTypes:!1},ej.ejLineSeries=t(ej.EjSeriesRender),ej.seriesTypes.line=ej.ejLineSeries,ej.ejStepLineSeries=t(ej.EjSeriesRender,{draw:function(e,t){var i,s,a=this.chartObj=e;t.animationType="path";var n=ej.EjSvgRender.utils._getStringBuilder(),o=t,r=this.setLineSeriesStyle(o);o.sorting&&(o.points=ej.DataManager(o.points,ej.Query().sortBy("xValue")).executeLocal());var l,d,h,c,u,m=this.improveChartPerformance(o),p=null,g="M",_=-1;for(s=0;s_+1&&(d={xValue:m[_+1].xValue,YValues:[p.YValues[0]]},h=ej.EjSvgRender.utils._getPoint(p,o),c=ej.EjSvgRender.utils._getPoint(d,o),u=ej.EjSvgRender.utils._getPoint(m[_+1],o),a=this.chartObj,n.append(g+" "+(h.X+a.canvasX)+" "+(h.Y+a.canvasY)+" L "+(c.X+a.canvasX)+" "+(c.Y+a.canvasY)+" L "+(u.X+a.canvasX)+" "+(u.Y+a.canvasY)+" ")),g="L"),p=l,_=s):(p=null,g="M");i=n.toString(),this._drawLinePath(o,r,i),this.chartObj.svgRenderer.append(this.gSeriesGroupEle,this.chartObj.gSeriesEle)}}),ej.ejStepAreaSeries=t(ej.EjSeriesRender,{draw:function(e,t,i){var s,a,n,o,r;this.chartObj=e,t.animationType="path";var l,d=this.chartObj.model.requireInvertedAxes,h=ej.EjSvgRender.utils._getStringBuilder(),c=t,u=this.setAreaSeriesStyle(c);c.sorting&&(c.points=ej.DataManager(c.points,ej.Query().sortBy("xValue")).executeLocal());var m,p=this.improveChartPerformance(c),g=0,_=null;"category"==c.xAxis._valueType.toLowerCase()&&"onticks"!=c.xAxis.labelPlacement.toLowerCase()&&(g=.5);var f=ej.EjSeriesRender.prototype.getOrigin(this,c,i),b=null,v=!0,x=this.chartObj;for(s=0;s<=p.length;s++)s0?(m={xValue:p[s].xValue+g,YValues:[p[s].y]},r=ej.EjSvgRender.utils._getPoint(m,c),d?h.append("L "+(r.X+x.canvasX)+" "+(r.Y+x.canvasY)+" L "+(r.Y+x.canvasX)+" "+(a.X+x.canvasY)+" "):h.append("L "+(r.X+x.canvasX)+" "+(r.Y+x.canvasY)+" L "+(r.X+x.canvasX)+" "+(a.Y+x.canvasY)+" ")):d?h.append("L "+(r.Y+x.canvasX)+" "+(a.X+x.canvasY)+" "):h.append("L "+(r.X+x.canvasX)+" "+(a.Y+x.canvasY)+" "),b=null,_=null,v=!0)),b&&(point2=r,_=m)):(b=null,_=null,v=!0):p[s-1].visible&&g>0&&(m={xValue:p[s-1].xValue+g,YValues:[p[s-1].y]},r=ej.EjSvgRender.utils._getPoint(m,c),d?h.append("L "+(r.X+x.canvasX)+" "+(r.Y+x.canvasY)+" L "+(r.Y+x.canvasX)+" "+(a.X+x.canvasY)+" "):h.append("L "+(r.X+x.canvasX)+" "+(r.Y+x.canvasY)+" L "+(r.X+x.canvasX)+" "+(a.Y+x.canvasY)+" "));l=h.toString(),this.drawAreaPath(c,u,l),this.chartObj.svgRenderer.append(this.gSeriesGroupEle,this.chartObj.gSeriesEle)}}),ej.seriesTypes.steparea=ej.ejStepAreaSeries,ej.seriesTypes.stepline=ej.ejStepLineSeries,ej.ejColumnSeries=t(ej.EjSeriesRender,{draw:function(t,i,s){var a,n,o,r,l,d,h,c,u,m,p;this.chartObj=t,a=this.chartObj.model.requireInvertedAxes,i.animationType="rect";var g,_=i,f=e.inArray(_,this.chartObj.model._visibleSeries),b=ej.EjSeriesRender.prototype.getOrigin(this,_,s),v=this.getSideBySideInfo(_,s),x=this._isVisiblePoints(_),w=ej.EjSvgRender.utils._getTransform(_.xAxis,_.yAxis,a),y={id:this.chartObj.svgObject.id+"_SeriesGroup_"+f,transform:"translate("+w.x+","+w.y+")"};for(this.gSeriesGroupEle=this.chartObj.svgRenderer.createGroup(y),n=this,o=0;on.chartObj.model.m_AreaBounds.Width?n.chartObj.model.m_AreaBounds.Width-I.X:I.Width,c=Math.min(0,I.Width),u=Math.min(0,I.Height),(0==c||0==u)&&I.Width>0&&(i={id:n.chartObj.svgObject.id+"_Series"+f+"_Point"+r,x:I.X+n.chartObj.canvasX,y:I.Y+n.chartObj.canvasY,width:I.Width,height:I.Height,fill:D.interior,"stroke-width":D.borderWidth,plot:d<0?"negative":"positive",opacity:D.opacity,stroke:D.borderColor,"stroke-dasharray":D.dashArray},n.chartObj.svgRenderer.drawRect(i,n.gSeriesGroupEle),p=ej.EjSvgRender.utils._getSvgXY(I.X,I.Y,_,n.chartObj),m={X:p.X,Y:p.Y,Width:I.Width,Height:I.Height},ej.EjSvgRender.utils._addRegion(n.chartObj,m,_,l,r)),l.symbolLocation=a?{X:d<(_.xAxis._crossValue||0)&&!_.yAxis.isInversed||_.yAxis.isInversed&&d>(_.xAxis._crossValue||0)?I.X:I.X+I.Width,Y:I.Y+I.Height/2}:{X:I.X+I.Width/2,Y:d<(_.xAxis._crossValue||0)&&!_.yAxis.isInversed||_.yAxis.isInversed&&d>(_.xAxis._crossValue||0)?I.Y+I.Height:I.Y}}this.chartObj.svgRenderer.append(this.gSeriesGroupEle,this.chartObj.gSeriesEle)},isRegion:!0}),ej.seriesTypes.column=ej.ejColumnSeries,ej.ejStackingColumnSeries=t(ej.EjSeriesRender,{draw:function(t,i,s){var a,n,o,r,l,d;this.chartObj=t,i.animationType="rect";var h=this.chartObj.model.requireInvertedAxes,c=i,u=e.inArray(c,this.chartObj.model._visibleSeries),m=this.getSideBySideInfo(c,s),p=this._isVisiblePoints(c),g=ej.EjSvgRender.utils._getTransform(c.xAxis,c.yAxis,h),_={id:this.chartObj.svgObject.id+"_SeriesGroup_"+u,transform:"translate("+g.x+","+g.y+")"};for(this.gSeriesGroupEle=this.chartObj.svgRenderer.createGroup(_),a=this,n=0;na.chartObj.model.m_AreaBounds.Width?a.chartObj.model.m_AreaBounds.Width-T.X:T.Width,o=Math.min(0,T.Width),r=Math.min(0,T.Height),(0==o||0==r)&&T.Width>0&&(i={id:a.chartObj.svgObject.id+"_Series"+u+"_Point"+f,x:T.X+a.chartObj.canvasX,y:T.Y+a.chartObj.canvasY,width:T.Width,height:T.Height,fill:S.interior,"stroke-width":S.borderWidth,plot:x<0?"negative":"positive",opacity:S.opacity,stroke:S.borderColor,"stroke-dasharray":S.dashArray},a.chartObj.svgRenderer.drawRect(i,a.gSeriesGroupEle),d=ej.EjSvgRender.utils._getSvgXY(T.X,T.Y,c,a.chartObj),l={X:d.X,Y:d.Y,Width:T.Width,Height:T.Height},ej.EjSvgRender.utils._addRegion(a.chartObj,l,c,b,f)),b.symbolLocation=h?{X:x<(c.xAxis._crossValue||0)&&!c.yAxis.isInversed||c.yAxis.isInversed&&x>(c.xAxis._crossValue||0)?T.X:T.X+T.Width,Y:T.Y+T.Height/2}:{X:T.X+T.Width/2,Y:x<(c.xAxis._crossValue||0)&&!c.yAxis.isInversed||c.yAxis.isInversed&&x>(c.xAxis._crossValue||0)?T.Y+T.Height:T.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=t(ej.EjSeriesRender,{draw:function(t,i,s){var a,n,o,r,l,d,h;this.chartObj=t,i.animationType="rect";var c=this.chartObj.model.requireInvertedAxes,u=i,m=e.inArray(u,this.chartObj.model._visibleSeries),p=this.getSideBySideInfo(u,s),g=this._isVisiblePoints(u),_=ej.EjSvgRender.utils._getTransform(u.xAxis,u.yAxis,c),f={id:this.chartObj.svgObject.id+"_SeriesGroup_"+m,transform:"translate("+_.x+","+_.y+")"};for(this.gSeriesGroupEle=this.chartObj.svgRenderer.createGroup(f),a=this,n=0;no?o-D.X:D.Width,r=Math.min(0,D.Width),l=Math.min(0,D.Height),(0==r||0==l)&&(i={id:a.chartObj.svgObject.id+"_Series"+m+"_Point"+b,x:D.X+a.chartObj.canvasX,y:D.Y+a.chartObj.canvasY,width:D.Width,height:D.Height,fill:T.interior,"stroke-width":T.borderWidth,opacity:T.opacity,stroke:T.borderColor,"stroke-dasharray":T.dashArray},a.chartObj.svgRenderer.drawRect(i,a.gSeriesGroupEle,_.y),h=ej.EjSvgRender.utils._getSvgXY(D.X,D.Y,u,a.chartObj),d={X:h.X,Y:h.Y,Width:D.Width,Height:D.Height},ej.EjSvgRender.utils._addRegion(a.chartObj,d,u,v,b)),"waterfall"==u.type.toLowerCase()&&(x=v.waterfallSum?v.waterfallSum:v.y),v.symbolLocation=c?{X:x<0&&!u.yAxis.isInversed||u.yAxis.isInversed&&x>0?D.X:D.X+D.Width,Y:D.Y+D.Height/2}:{X:D.X+D.Width/2,Y:x<0&&!u.yAxis.isInversed||u.yAxis.isInversed&&x>0?D.Y+D.Height:D.Y}}}this.chartObj.svgRenderer.append(this.gSeriesGroupEle,this.chartObj.gSeriesEle)},hiloTypes:!0,isRegion:!0}),ej.seriesTypes.rangecolumn=ej.ejRangeColumnSeries,ej.ejWaterfallSeries=t(ej.EjSeriesRender,{draw:function(t,i,s){var a,n,o,r,l,d,h,c,u,m,p,g;ej.ejRangeColumnSeries.prototype.draw.call(this,t,i,s),i.animationType="rect";var _=this.chartObj.model.chartRegions,f=[],b=(this.chartObj.model.m_AreaBounds,e.inArray(i,this.chartObj.model._visibleSeries));for(i.index=b,a=0,n=0;a<_.length;a++)b==_[a].SeriesIndex&&(f[n]=_[a],n+=1);for(o={id:this.chartObj.svgObject.id+"_SeriesGroup_waterfallLine_"+b},this.connectorLineGroup=this.chartObj.svgRenderer.createGroup(o),g=0;g=0&&(p={id:this.chartObj.svgObject.id+"_waterFall_"+b+"_connectorLine_"+g,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(p,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=t(ej.EjSeriesRender,{draw:function(t,i,s){var a,n,o,r,l,d;this.chartObj=t,i.animationType="rect";var h=this.chartObj.model.requireInvertedAxes,c=i,u=e.inArray(c,this.chartObj.model._visibleSeries),m=this.getSideBySideInfo(c,s),p=this._isVisiblePoints(c),g=ej.EjSvgRender.utils._getTransform(c.xAxis,c.yAxis,h),_={id:this.chartObj.svgObject.id+"_SeriesGroup_"+u,transform:"translate("+g.x+","+g.y+")"};for(this.gSeriesGroupEle=this.chartObj.svgRenderer.createGroup(_),a=this,n=0;na.chartObj.model.m_AreaBounds.Width?a.chartObj.model.m_AreaBounds.Width-T.X:T.Width),o=Math.min(0,T.Width),r=Math.min(0,T.Height),(0==o||0==r)&&(i={id:a.chartObj.svgObject.id+"_Series"+u+"_Point"+f,x:T.X+a.chartObj.canvasX,y:T.Y+a.chartObj.canvasY,width:T.Width,height:T.Height,fill:S.interior,"stroke-width":S.borderWidth,opacity:S.opacity,stroke:S.borderColor,"stroke-dasharray":S.dashArray},a.chartObj.svgRenderer.drawRect(i,a.gSeriesGroupEle),d=ej.EjSvgRender.utils._getSvgXY(T.X,T.Y,c,a.chartObj),l={X:d.X,Y:d.Y,Width:T.Width,Height:T.Height},ej.EjSvgRender.utils._addRegion(a.chartObj,l,c,b,f)),b.symbolLocation=h?{X:v<(c.yAxis._crossValue||0)&&!c.yAxis.isInversed||c.yAxis.isInversed&&v>(c.yAxis._crossValue||0)?T.X:T.X+T.Width,Y:T.Y+T.Height/2}:{X:T.X+T.Width/2,Y:v<(c.yAxis._crossValue||0)&&!c.yAxis.isInversed||c.yAxis.isInversed&&v>(c.yAxis._crossValue||0)?T.Y+T.Height:T.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=t(ej.EjSeriesRender,{draw:function(t,i,s){var a,n,o,r,l,d;this.chartObj=t,i.animationType="rect";var h=this.chartObj.model.requireInvertedAxes,c=i,u=e.inArray(c,this.chartObj.model._visibleSeries),m=ej.EjSeriesRender.prototype.getOrigin(this,c,s),p=(e.extend(!0,{},this.chartObj.model.seriesStyle,c.style),this.getSideBySideInfo(c,s)),g=this._isVisiblePoints(c),_=ej.EjSvgRender.utils._getTransform(c.xAxis,c.yAxis,h),f={id:this.chartObj.svgObject.id+"_SeriesGroup_"+u,transform:"translate("+_.x+","+_.y+")"};for(this.gSeriesGroupEle=this.chartObj.svgRenderer.createGroup(f),a=this,n=0;na.chartObj.model.m_AreaBounds.Width?a.chartObj.model.m_AreaBounds.Width-D.X:D.Width),o=Math.min(0,D.Width),r=Math.min(0,D.Height),(0==o||0==r)&&(i={id:a.chartObj.svgObject.id+"_Series"+u+"_Point"+b,x:D.X+a.chartObj.canvasX,y:D.Y+a.chartObj.canvasY,width:D.Width,height:D.Height,fill:T.interior,"stroke-width":T.borderWidth,plot:x<0?"negative":"positive",opacity:T.opacity,stroke:T.borderColor,"stroke-dasharray":T.dashArray},a.chartObj.svgRenderer.drawRect(i,a.gSeriesGroupEle),d=ej.EjSvgRender.utils._getSvgXY(D.X,D.Y,c,a.chartObj),l={X:d.X,Y:d.Y,Width:D.Width,Height:D.Height},ej.EjSvgRender.utils._addRegion(a.chartObj,l,c,v,b)),v.symbolLocation=h?{X:x<(c.xAxis._crossValue||0)&&!c.yAxis.isInversed||c.yAxis.isInversed&&x>(c.xAxis._crossValue||0)?D.X:D.X+D.Width,Y:D.Y+D.Height/2}:{X:D.X+D.Width/2,Y:x<(c.xAxis._crossValue||0)&&!c.yAxis.isInversed||c.yAxis.isInversed&&x>(c.xAxis._crossValue||0)?D.Y+D.Height:D.Y}}}this.chartObj.svgRenderer.append(this.gSeriesGroupEle,this.chartObj.gSeriesEle)},requireInvertedAxes:!0,isRegion:!0}),ej.seriesTypes.bar=ej.ejBarSeries,ej.ejStackingAreaSeries=t(ej.EjSeriesRender,{draw:function(e,t){var i;this.chartObj=e,t.animationType="path";var s,a=ej.EjSvgRender.utils._getStringBuilder(),n=t,o=this.setAreaSeriesStyle(n),r=this._isVisiblePoints(n),l=Math.max(t.yAxis.visibleRange.min,n.stackedValue.StartValues[0]),d=this.chartObj.canvasX,h=this.chartObj.canvasY,c={xValue:r[0].xValue,YValues:[l]},u=ej.EjSvgRender.utils._getPoint(c,n);for(a.append("M "+(u.X+d)+" "+(u.Y+h)+" "),i=0;ii+1&&(m={xValue:r[i].xValue,YValues:[n.stackedValue.EndValues[i]]},g=r[i].location=ej.EjSvgRender.utils._getPoint(m,n),r[i+1].visible?(p={xValue:r[i+1].xValue,YValues:[n.stackedValue.EndValues[i+1]]},r[i+1].YValues[0]=p.YValues[0],_=r[i+1].location=ej.EjSvgRender.utils._getPoint(p,n)):(p={xValue:r[i].xValue,YValues:[l]},_=ej.EjSvgRender.utils._getPoint(p,n)),i>0&&!r[i-1].visible&&(previouspoint=ej.EjSvgRender.utils._getPoint({xValue:r[i-1].xValue,YValues:[l]},n),a.append("L "+(previouspoint.X+d)+" "+(previouspoint.Y+h)+" L "+(g.X+d)+" "+(previouspoint.Y+h)+" ")),a.append("L "+(g.X+d)+" "+(g.Y+h)+" L "+(_.X+d)+" "+(_.Y+h)+" "));for(i=n.stackedValue.StartValues.length-1;i>0;i--)if(r[i].visible){var m={xValue:r[i].xValue,YValues:[n.stackedValue.StartValues[i]]},p={xValue:r[i-1].xValue,YValues:[n.stackedValue.StartValues[i-1]]},g=ej.EjSvgRender.utils._getPoint(m,n),_=ej.EjSvgRender.utils._getPoint(p,n);this.chartObj.model.enableCanvasRendering?a.append("L "+(g.X+d)+" "+(g.Y+h)+" L "+(_.X+d)+" "+(_.Y+h)+" "):a.append(g.X+" "+g.Y+" "+_.X+" "+_.Y+" ")}s=a.toString(),this.drawAreaPath(n,o,s),this.chartObj.svgRenderer.append(this.gSeriesGroupEle,this.chartObj.gSeriesEle)},stackingSeries:!0}),ej.seriesTypes.stackingarea=ej.ejStackingAreaSeries,ej.seriesTypes.stackingarea100=ej.ejStackingAreaSeries,ej.ejAreaSeries=t(ej.EjSeriesRender,{draw:function(e,t,i){var s,a,n,o,r,l,d;this.chartObj=e,t.animationType="path";var h=ej.EjSvgRender.utils._getStringBuilder(),c=t,u=this.setAreaSeriesStyle(c),m=this.chartObj;c.sorting&&(c.points=ej.DataManager(c.points,ej.Query().sortBy("xValue")).executeLocal());var p,g=this._isVisiblePoints(c),_=ej.EjSeriesRender.prototype.getOrigin(this,c,i),f=[];for(f[0]=m.canvasX,f[1]=m.canvasY,a=0;aa+1?(p||(p={xValue:g[a].xValue,YValues:[_]},r=ej.EjSvgRender.utils._getPoint(p,c),h.append("M "+r.X+" "+r.Y+" ")),r=ej.EjSvgRender.utils._getPoint(g[a],c),h.append("L "+r.X+" "+r.Y+" "),g[a+1].visible||(point={xValue:g[a].xValue,YValues:[_]},n=ej.EjSvgRender.utils._getPoint(point,c),o=ej.EjSvgRender.utils._getPoint(p,c),h.append("L "+n.X+" "+n.Y+" L "+o.X+" "+o.Y+" "),p=null)):g[a-1]&&g[a-1].visible&&(r=ej.EjSvgRender.utils._getPoint(g[a],c),h.append("L "+r.X+" "+r.Y+" ")));l={xValue:g[g.length-1].xValue,YValues:[_]},d=ej.EjSvgRender.utils._getPoint(l,c),g.length>1&&h.append("L "+d.X+" "+d.Y+" "),s=h.toString(),this.drawAreaPath(c,u,s,f),this.chartObj.svgRenderer.append(this.gSeriesGroupEle,this.chartObj.gSeriesEle)}}),ej.seriesTypes.area=ej.ejAreaSeries,ej.ejRangeAreaSeries=t(ej.EjSeriesRender,{draw:function(t,i){var s,a,n,o,r,l,d,h,c,u,m,p;this.chartObj=t,i.animationType="path";var g=ej.EjSvgRender.utils._getStringBuilder(),_=i,f=this.setAreaSeriesStyle(_),b=e.inArray(_,this.chartObj.model._visibleSeries);for(_.points=ej.DataManager(_.points,ej.Query().sortBy("xValue")).executeLocal(),a=this._isVisiblePoints(_),n=[],n[0]=this.chartObj.canvasX,n[1]=this.chartObj.canvasY,r=[],p=0;p=0&&a[h].visible;h--)l=a[h].low,c={xValue:a[h].xValue,YValues:[l]},u=ej.EjSvgRender.utils._getPoint(c,_),g.append("L "+u.X+" "+u.Y+" "),r[h].region.push({X:u.X,Y:u.Y}),0!=h&&r[h-1].region.push({X:u.X,Y:u.Y});o=null}for(p=a.length-1;p>=0;p--)if(a[p].visible)l=a[p].low,c={xValue:a[p].xValue,YValues:[l]},u=ej.EjSvgRender.utils._getPoint(c,_),g.append("L "+u.X+" "+u.Y+" "),r[p].region.push({X:u.X,Y:u.Y}),0!=p&&r[p-1].region.push({X:u.X,Y:u.Y});else{if(a.length>p&&a[p].visible){u=ej.EjSvgRender.utils._getPoint(a[p],_),g.append("L "+u.X+" "+u.Y+" ");break}if(p!=a.length-1){for(m=0,k=p-1;k>=0;k--)if(a[k].visible)m++;else if(!a[k].visible)break;p-=m}}for(s=g.toString(),p=0;p1){for(i=w;ej.util.isNullOrUndefined(y.zOrder)?i=0;ej.util.isNullOrUndefined(y.zOrder)?i++:i--)if(!ej.util.isNullOrUndefined(this.chartObj.model.circularRadius[i])){this.chartObj.model.circularRadius[w]=this.chartObj.model.circularRadius[i]*y._pieCoefficient;break}}else this.chartObj.model.circularRadius[w]=.5*y._pieCoefficient*Math.min(x.width,x.height);if(a=Math.min(x.width,x.height),a<0)return a;for(n=Math.abs(f.endAngle-f.startAngle),n<270&&this.pieDoughnutCenter(f),o={id:this.chartObj.svgObject.id+"_SeriesGroup_"+w},this.gSeriesGroupEle=this.chartObj.svgRenderer.createGroup(o),r=f.enableAnimation&&!f._animatedSeries?"hidden":"visible",l={id:this.chartObj.svgObject.id+"_TextGroup_"+w,visibility:r},this.chartObj.gSeriesTextEle||(this.chartObj.gSeriesTextEle=[]),this.chartObj.gSeriesTextEle[w]=this.chartObj.svgRenderer.createGroup(l),d={id:this.chartObj.svgObject.id+"_symbolGroup_"+w,visibility:r},this.chartObj.gSymbolGroupEle||(this.chartObj.gSymbolGroupEle=[]),this.chartObj.gSymbolGroupEle[w]=this.chartObj.svgRenderer.createGroup(d),h={id:this.chartObj.svgObject.id+"_connectorGroup_"+w,visibility:r},this.chartObj.gConnectorEle||(this.chartObj.gConnectorEle=[]),this.chartObj.gConnectorEle[w]=this.chartObj.svgRenderer.createGroup(h),c={id:this.chartObj.svgObject.id+"_DataLabel_"+w,visibility:r},this.chartObj.gDataLabelEle||(this.chartObj.gDataLabelEle=[]),this.chartObj.gDataLabelEle[w]=this.chartObj.svgRenderer.createGroup(c),u=0;u1){for(i=C;ej.util.isNullOrUndefined(S.zOrder)?i=0;ej.util.isNullOrUndefined(S.zOrder)?i++:i--)if(!ej.util.isNullOrUndefined(this.chartObj.model.circularRadius[i])){this.chartObj.model.circularRadius[C]=this.chartObj.model.circularRadius[i]*S._doughnutSize;break}}else this.chartObj.model.circularRadius[C]=.5*S._doughnutSize*Math.min(w.width,w.height);if(a=Math.min(w.width,w.height),a<0)return a;n=Math.abs(b.endAngle-b.startAngle),n<270&&this.pieDoughnutCenter(b),this.chartObj.model.innerRadius[C]=S._doughnutCoefficient*this.chartObj.model.circularRadius[C];var C=(ej.util.isNullOrUndefined(this.chartObj.model.roundingPlaces)?2:this.chartObj.model.roundingPlaces,e.inArray(b,this.chartObj.model._visibleSeries)),T={id:this.chartObj.svgObject.id+"_SeriesGroup_"+C};if(this.gSeriesGroupEle=this.chartObj.svgRenderer.createGroup(T),o=b.enableAnimation&&!b._animatedSeries?"hidden":"visible",r={id:this.chartObj.svgObject.id+"_TextGroup_"+C,visibility:o},this.chartObj.gSeriesTextEle||(this.chartObj.gSeriesTextEle=[]),this.chartObj.gSeriesTextEle[C]=this.chartObj.svgRenderer.createGroup(r),l={id:this.chartObj.svgObject.id+"_symbolGroup_"+C,visibility:o},this.chartObj.gSymbolGroupEle||(this.chartObj.gSymbolGroupEle=[]),this.chartObj.gSymbolGroupEle[C]=this.chartObj.svgRenderer.createGroup(l),d={id:this.chartObj.svgObject.id+"_connectorGroup_"+C,visibility:o},this.chartObj.gConnectorEle||(this.chartObj.gConnectorEle=[]),this.chartObj.gConnectorEle[C]=this.chartObj.svgRenderer.createGroup(d),h={id:this.chartObj.svgObject.id+"_DataLabel_"+C,visibility:o},this.chartObj.gDataLabelEle||(this.chartObj.gDataLabelEle=[]),this.chartObj.gDataLabelEle[C]=this.chartObj.svgRenderer.createGroup(h),b._doughnutSize>0&&S._doughnutCoefficient>=0&&b._doughnutSize<=1&&S._doughnutCoefficient<=1)for(c=0;c=0?e.gapRatio<=1?e.gapRatio:1:0,o=1/(a.sumofYValues*(1+n/(1-n))),r=e._visiblePoints.length;for(t=0;t=0?e.gapRatio<=1?e.gapRatio:1:0,h=d/(a-1),c=this.getSurfaceHeight(0,n.sumofYValues);for(i=0;i=0)return o=Math.sqrt(n),s=(-t-o)/(2*e),a=(-t+o)/(2*e),Math.max(s,a)}else if(0!=t)return s=-i/t,a=-i/t,Math.max(s,a);return!1},chartAreaType:"None"}),ej.seriesTypes.pyramid=ej.ejPyramidSeries,ej.ejFunnelSeries=t(ej.EjSeriesRender,{draw:function(t,i){var s,a,n,o,r,l,d,h,c,u,m,p,g,_,f,b,v;this.chartObj=t;var x,w=t.model,y=w.legend,C=y.position.toLowerCase(),S=w.LegendActualBounds,T=this,D=i,I=this._calculateVisiblePoints(D).visiblePoints,k=I.length,P=[],L=D.marker,R=y.border.width,M=[],O=0,E=w.border.width,A=w.title.text?ej.EjSvgRender.utils._measureText(w.title.text,e(this.svgObject).width()-w.margin.left-w.margin.right,w.title.font):0,j=w.title.subTitle.text?ej.EjSvgRender.utils._measureText(w.title.subTitle.text,e(this.svgObject).width()-w.margin.left-w.margin.right,w.title.subTitle.font):0,N=w.margin.left+w.elementSpacing+w.elementSpacing+w.margin.right+2*E+("right"===C||"left"===C?S.Width+2*R:0),z=(w.title.text?w._titleLocation.Y+A.height:w.elementSpacing)+w.margin.top+2*E+w.elementSpacing+w.elementSpacing+("top"===C||"bottom"===C?S.Height+2*R+w.elementSpacing:0);if(L.visible&&"none"!=L.shape&&"outside"==D.labelPosition&&(N+=L.margin.left+L.margin.right),w.chartRegions=[],w.sumofYValues=0,"outside"===D.labelPosition.toLowerCase()){for(p=0;p=0?D.gapRatio<=1?D.gapRatio:1:0,V=1/(m.sumofYValues*(1+H/(1-H))),U=H/k;for(p=k-1;p>=0;p--)(D._visiblePoints[p].visible||D._visiblePoints[p].gapMode)&&(g=V*D._visiblePoints[p].YValues[0],m.funnelData[p]={CurrY:u,Height:g},u+=g+U);for(r=0;rz-L||z==L?R:R+(F-R)*((z-L-_)/(z-L)),h=F/2-P/2,m=h+P,p>=z-L?(l=h=d=F/2-R/2,c=m=u=F/2+R/2):_>z-L&&(d=h=F/2-P/2,u=m=d+P,g=z-L),C={x:U+W+l,y:p},S={x:U+W+c,y:p},D={x:U+W+m,y:_},I={x:U+W+h,y:_},T={x:U+W+m,y:_},k={x:U+W+h,y:_},g&&(T={x:U+W+u,y:g},k={x:U+W+d,y:g}),a="M "+C.x+" "+C.y+" L "+S.x+" "+S.y+" L "+T.x+" "+T.y+" L "+D.x+" "+D.y+" L "+I.x+" "+I.y+" L "+k.x+" "+k.y+" z",n=[{x:C.x,y:C.y},{x:S.x,y:S.y},{x:T.x,y:T.y},{x:D.x,y:D.y},{x:I.x,y:I.y},{x:k.x,y:k.y}],(E&&E.dataLabel&&E.dataLabel.visible||(!E||!E.dataLabel)&&A.dataLabel.visible)&&(w=(S.x+T.x)/2,y=(S.y+T.y)/2,"outside"===t.labelPosition.toLowerCase()?(v=(S.x+T.x)/2,x=(S.y+T.y)/2,s=("left"==H||"right"==H?M.LegendActualBounds.Width:0)+B+M.margin.left,o=ej.util.isNullOrUndefined(A.dataLabel.connectorLine.height)?t._enableSmartLabels?e(this.chartObj.svgObject).width()-(s+v+U+2*B):e(this.chartObj.svgObject).width()-(v+M.textSize+B):A.dataLabel.connectorLine.height,f=this.getXCordinate(v,o,0),b=this.getYCordinate(x,o,0),r="M "+v+" "+x+" L "+f+" "+b,v=f,x=b):(v=(C.x+S.x)/2,x=(C.y+D.y)/2)),{Direction:a,PositionX:v,PositionY:x,Connector:r,Line1:C,Line2:S,Line3:T,Line4:D,Line5:I,Line6:k,startX:w,startY:y,Polygon:n}},chartAreaType:"None"}),ej.seriesTypes.funnel=ej.ejFunnelSeries,ej.ejPolarSeries=t(ej.EjSeriesRender,{draw:function(e,t){var i,s,a,n,o;this.chartObj=e;var r=t,l=(this._isVisiblePoints(r),this.setLineSeriesStyle(r));if("column"==r.drawType.toLowerCase()){i=r.xAxis.visibleRange,i.interval=1,s="category"==r.xAxis._valueType?i.max:i.max-1,this.chartObj.model.sumofYValues=0,a=i.interval,n=i.min;do this.chartObj.model.sumofYValues+=i.interval,n+=i.interval;while(n<=s)}o=this._calculatePolarAxesSegment(r),"area"==r.drawType.toLowerCase()?this.drawAreaPath(r,l,o):"line"==r.drawType.toLowerCase()&&this._drawLinePath(r,l,o),this.chartObj.svgRenderer.append(this.gSeriesGroupEle,this.chartObj.gSeriesEle)},chartAreaType:"PolarAxes"}),ej.seriesTypes.polar=ej.ejPolarSeries,ej.ejRadarSeries=t(ej.EjSeriesRender,{draw:function(e,t){var i,s,a,n,o;this.chartObj=e;var r=t,l=(this._isVisiblePoints(r),this.setLineSeriesStyle(r));if("column"==r.drawType.toLowerCase()){i=r.xAxis.visibleRange,i.interval=1,s="category"==r.xAxis._valueType?i.max:i.max-1,this.chartObj.model.sumofYValues=0,a=i.interval,n=i.min;do this.chartObj.model.sumofYValues+=i.interval,n+=i.interval;while(n<=s)}o=this._calculatePolarAxesSegment(r),"area"==r.drawType.toLowerCase()?this.drawAreaPath(r,l,o):"line"==r.drawType.toLowerCase()&&this._drawLinePath(r,l,o),this.chartObj.svgRenderer.append(this.gSeriesGroupEle,this.chartObj.gSeriesEle)},doAnimation:function(t,i){var s,a,n=i.chartObj;t.regionAdded=!0,n.model._radius=n.model.Radius,n.model.Radius=0,seriesRender=i,s=e.inArray(t,n.model._visibleSeries),a=e(n.gSeriesEle).find("#"+seriesRender.gSeriesGroupEle.id)[0].childNodes[0],e(a).animate({Radius:n.model._radius},{duration:1200,queue:!1,step:function(i){n.model.Radius=i;var s=seriesRender._calculatePolarAxesSegment(t);"column"!=t.drawType.toLowerCase()&&n.svgRenderer._setAttr(e(a),{d:s}),n.model.Radius=n.model._radius},complete:function(){t.regionAdded=!1,n.svgRenderer._setAttr(e(n.gSeriesEle).find("#"+n.svgObject.id+"_TextGroup_"+s),{visibility:"visible"}),n.svgRenderer._setAttr(e(n.gSeriesEle).find("#"+n.svgObject.id+"_symbolGroup_"+s),{visibility:"visible"}),n.svgRenderer._setAttr(e(n.gSeriesEle).find("#"+n.svgObject.id+"_DataLabel_"+s),{visibility:"visible"}),n.model.AnimationComplete=!0;var i=e.extend({},ej.EjSvgRender.commonChartEventArgs);i.data={series:t},n._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(e,t){t.count>0?$.each(t,function(t,i){str=str.replace(new RegExp("\\#"+e+"."+t+"\\#","gm"),i)}):str=str.replace(new RegExp("\\#"+e+"\\#","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(e){this._gradientStop=[];for(var t=0;t").attr("id","legend_"+this._id).css("height","0px"),this.scrollerContainer=$("
      ").attr("id","legend_Scroller"+this._id).css("height","0px"),this.chartContainer=$("
      ").css("position","relative").attr("id","chartContainer_"+this._id),this.svgRenderer.append(this.legendSvgContainer,this.scrollerContainer),$(this.scrollerContainer).appendTo(this.legendContainer),$(this.legendContainer).appendTo(this.chartContainer),$(this.chartContainer).appendTo(this.element)):(this.svgRenderer=new ej.EjSvgRender(this.element),this.legendSvgContainer=this.svgRenderer.createLegendSvg(this.element),this.legendContainer=$("
      ").attr("id","legend_"+this._id).css("height","0px"),this.scrollerContainer=$("
      ").attr("id","legend_Scroller"+this._id).css("height","0px"),this.chartContainer=$("
      ").css("position","relative").attr("id","chartContainer_"+this._id),this.svgRenderer.append(this.legendSvgContainer,this.scrollerContainer),$(this.scrollerContainer).appendTo(this.legendContainer),$(this.legendContainer).appendTo(this.chartContainer),$(this.chartContainer).appendTo(this.element),this.legendContainer.find("svg").attr("class","e-designerhide")),this._createChart(),$(this.svgObject).appendTo(this.element)):(this.model.enableCanvasRendering=!1,this.svgRenderer=new ej.EjVmlRender(this.element),this.legendSvgContainer=this.svgRenderer.createLegendSvg(this.element),this.legendContainer=$("
      ").attr("id","legend_"+this._id).css("height","0px"),this.ScrollerContainer=$("
      ").attr("id","legend_Scroller"+this._id).css("height","0px"),this.chartContainer=$("
      ").css("position","relative").attr("id","chartContainer_"+this._id),this.svgRenderer.append(this.legendSvgContainer,this.ScrollerContainer),$(this.ScrollerContainer).appendTo(this.legendContainer),$(this.legendContainer).appendTo(this.chartContainer),$(this.chartContainer).appendTo(this.element),this._createChart(),$(this.svgObject).appendTo(this.chartContainer)),!0},setSvgSize:function(e){var t,i,s=e,a=$(s.element).height(),n=450,o=ej.isTouchDevice()?250:600,r=$(s.element).width();$(s.chartContainer).height();s.model.size.width?(t=s.model.size.width,o="string"==typeof t&&t.indexOf("%")!=-1?r/100*parseInt(t):parseInt(t)):r>0&&(o=r), $(s.svgObject).width(o),s.model.size.height?(i=s.model.size.height,n="string"==typeof i&&i.indexOf("%")!=-1?this.vmlRendering?n:a/100*parseInt(i):parseInt(i)):a>0?n=a:$(s.svgObject).css("display","block"),$(s.svgObject).height(n),s.svgObject.width=o,s.svgObject.height=n},setModelProperties:function(e){var t,i,s,a,n;if(this.setSvgSize(this),this.svgWidth=$(this.svgObject).width(),this.svgHeight=$(this.svgObject).height(),this.chartCross={visible:e?this.chartCross.visible:this.model.crosshair.visible,mArea:this.model.crosshair.type},this.serAnimation=[],this.model.series&&!e)for(this.model._drawTrendline=!1,s=0;s=0||i.indexOf("lime")>=0||i.indexOf("saffron")>=0)&&i.indexOf("gradient")==-1&&i.indexOf("dark")==-1?e[i]=$.extend(!0,{},e.flatlight,e[i]):(i.indexOf("azuredark")>=0||i.indexOf("limedark")>=0||i.indexOf("saffrondark"))>=0&&i.indexOf("gradient")==-1?e[i]=$.extend(!0,{},e.flatdark,e[i]):(i.indexOf("azure")>=0||i.indexOf("lime")>=0||i.indexOf("saffron")>=0)&&i.indexOf("gradient")>=0&&i.indexOf("dark")==-1?e[i]=$.extend(!0,{},e.gradientlight,e[i]):(i.indexOf("azuredark")>=0||i.indexOf("limedark")>=0||i.indexOf("saffrondark")>=0)&&i.indexOf("gradient")>=0?e[i]=$.extend(!0,{},e.gradientdark,e[i]):e[i]||(i="flatlight"),this.model=this.model._themeChanged?ej.copyObject({},this.model,e[i]):ej.copyObject({},e[i],this.model)},_drawBackInterior:function(){if(this.model.backInterior&&this.model.backInterior._gradientStop){var e={id:this.svgObject.id+"_backGradient",x1:"0%",y1:"0%",x2:"0%",y2:$(this.svgObject).height()+"%"};this.svgRenderer.drawGradient(e,this.model.backInterior._gradientStop)}},_drawBackImage:function(){var e={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(e,this.svgObject)},_getDataType:function(e){var t=typeof e;return"number"===t||"string"===t?t:"date"==jQuery.type(e)?"date":null==e&&null},addedXYValues:function(e){var t,i,s,a,n,o,r,l,d,h;if(e=!!e&&e,t=this.model.series[0].type.toLowerCase(),"cartesianAxes"==ej.seriesTypes[t].prototype.chartAreaType?this.model.AreaType="cartesianaxes":"None"==ej.seriesTypes[t].prototype.chartAreaType?this.model.AreaType="none":(this.model.isPolar="polar"==t,this.model.AreaType="polaraxes"),!e){for(s=0;s0||g.y>0&&!g.showIntermediateSum&&!g.showTotalSum)&&(n=t.positiveFill?t.positiveFill:a):n=h?h:a,c=n?n:this.model.seriesColors[i],u=e.chartObj.model.requireInvertedAxes?this.svgRenderer.createGradientElement(e.getSeriesName(t)+"_"+i+s,c,0,0,100,0,e.gSeriesGroupEle):this.svgRenderer.createGradientElement(e.getSeriesName(t)+"_"+i+s,c,0,0,0,100,e.gSeriesGroupEle)):(m=this.model.pointColors,n=g.fill?g.fill:"array"==jQuery.type(m[s])?m[s][0].color:m[s],p=this.svgRenderer.createGradientElement(e.getSeriesName(t)+s,n,0,0,0,$(e.svgObject).height()||parseFloat(this.model.size.height),e.chartObj.gSeriesEle)),o=_&&_.color?_.color:f.color,r=_&&_.width?_.width:f.width,d=g.opacity?g.opacity:t.opacity,width=g.width?g.width:t.width,l=_&&_.dashArray?_.dashArray:f.dashArray,{interior:u?u:p,borderColor:o,borderWidth:r,width:width,opacity:d,dashArray:l}},colorNameToHex:function(e){var t=e,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 Array]"==Object.prototype.toString.call(t)?t:"undefined"!=typeof i[t.toLowerCase()]?i[t.toLowerCase()]:t},_setCulture:function(e){this.culture=ej.preferredCulture(e)},draw:function(e){var t,i,s,a,n,o,r,l,d,h,c,u,m,p,g,_,f,b,v,x,w,y,C,S,T,D,I,k,P,L,R,M,O,E,A,j,N,z;for(this.removeMultiRect(),t={},t.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=e,this.model.yAxisLabelRegions=[],this.model.xAxisLabelRegions=[],this.model.minhightwidth=!1,e||(this.model._visibleSeries=[]),this.model.stackedValue={},this._setCulture(this.model.locale),i=this.model.series.length,this.model._sideBySideSeriesPlacement=ej.util.isNullOrUndefined(this.model.sideBySideSeriesPlacement)?!this.model.enable3D:this.model.sideBySideSeriesPlacement,N=0;N0&&this.addedXYValues(e),this.model.AreaType=this.model.AreaType||"cartesianaxes",this._isEjScroller(),a=$.extend({},ej.EjSvgRender.commonChartEventArgs),a.data={},this._trigger("preRender",a),this.gLegendEle=this.svgRenderer.createGroup({id:this.svgObject.id+"_Legend"}),this.gTitleEle=this.svgRenderer.createGroup({id:this.svgObject.id+"_ChartTitle"}),this.gSubTitleEle=this.svgRenderer.createGroup({id:this.svgObject.id+"_ChartsubTitle"}),this._createAxisLabelAndRange(),N=0;N0)for(N=0;N0&&(_=o.type.toLowerCase(),l=new ej.indicatorTypes[_],l.calculateSegment(o,this));for(g=0;g0,N=0;N").attr("id","annotation_group_"+T),i.css({position:"absolute",left:"0px",top:"0px"}),s=e.content,a=$("#"+s),"SCRIPT"==a.get(0).tagName&&(a=$($("#"+s)[0].innerHTML)),n=a.clone(),o="annotation_"+T+"_"+s+"_"+t,$(n).attr("id",o),r=$(n),r.css({position:"absolute","z-index":2e3});var B=e.region.toLowerCase(),H=e.coordinateUnit.toLowerCase(),V="string"==typeof e.x||"object"==typeof e.x?Date.parse(e.x):e.x,U=e.y,W=e.horizontalAlignment.toLowerCase(),G=e.verticalAlignment.toLowerCase();if("pixels"==H)"series"==B?R+P+O>V+P&&M+L+E>U+L&&(l=V+P,d=U+L):"chart"==B&&$(this.svgObject).width()>V&&$(this.svgObject).height()>U&&(l=V,d=U),r.css({left:l,top:d}),D=!0;else if("points"==H)if(point={x:V,y:U},"polaraxes"==this.model.AreaType)g=this.model._axes[0],_=this.model._axes[1],V>=g.visibleRange.min&&V<=g.visibleRange.max&&U>=_.visibleRange.min&&U<=_.visibleRange.max&&(h=this.TransformToVisibleAnnotation(g,_,V,U,this),r.css({left:h.X,top:h.Y}),D=!0);else if("pyramid"==k||"funnel"==k)c=I.points[V],r.css({left:c.xLocation+this.pyrX,top:c.yLocation+this.pyrY}),D=!0;else if("pie"==k||"doughnut"==k){c=I._visiblePoints[V];var Y,X,q=V,K=new ej.seriesTypes[k],Q=c?c.currentMidAngle:0;q!=I.explodeIndex&&!I.explodeAll||chartObj.vmlRendering?(Y=N,X=z):(Y=N+Math.cos(Q)*I.explodeOffset,X=z+Math.sin(Q)*I.explodeOffset),u=K.getXCordinate(Y,j,Q),m=K.getYCordinate(X,j,Q),positionX=(u+Y)/2,positionY=(m+X)/2,positionX=(u+positionX)/2,positionY=(m+positionY)/2,r.css({left:positionX,top:positionY}),D=!0}else{var Z=e.xAxisName,J=e.yAxisName,ee=this.model._axes.length;for(p=0;p0?Math.log(i,e.logBase):i,s="logarithmic"==e._valueType&&s>0?Math.log(s,t.logBase):s;var n=a.model.Radius*ej.EjSvgRender.utils._valueToCoefficient(t,s,this),o=ej.EjSvgRender.utils._valueToVector(e,i);return{X:a.model.centerX+n*o.X,Y:a.model.centerY+n*o.Y}},_getAnnotationPoint:function(e,t,i){var s=(this.model.requireInvertedAxes,e.x),a=e.y,n="logarithmic"==t._valueType?ej.EjSvgRender.utils._logBase(0==s?1:s,t.logBase):s,o="logarithmic"==i._valueType?ej.EjSvgRender.utils._logBase(0==a?1:a,t.logBase):a;return n=ej.EjSvgRender.utils._getPointXY(n,t.visibleRange,t.isInversed)*t.width,o=(1-ej.EjSvgRender.utils._getPointXY(o,i.visibleRange,i.isInversed))*i.height,e.location={X:n,Y:o},e.location},indicatorRender:function(){var e,t,i,s,a,n,o,r,l;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),t=0;t0;t++){for(i=this.model.indicators[t],a=0;a-1?P.animateStackingRect(n[c],e,p,u):P.animateRect(n[c],e,p,u);i=s=t=500;break;case"path":r=$(u.gSeriesEle).find("#"+f+"_ClipRect").children(),P._doLineAnimation(u,r),i=2e3/v,s=2e3/w,t=2e3/T;break;case"scatter":for(c=0;c0&&e.AnimationComplete&&!this.vmlRendering&&!this.model.enableCanvasRendering){if(n.svgRenderer._setAttr($(n.gSeriesEle).find("#"+n.gSeriesTextEle[i].id),{visibility:"visible"}),n.gSymbolGroupEle&&n.svgRenderer._setAttr($(n.gSeriesEle).find("#"+n.gSymbolGroupEle[i].id),{visibility:"visible"}),e.marker.dataLabel.template)for(s=$(n.element[0].childNodes[0].childNodes),a=0;a0&&this.svgRenderer.append(this.gDataLabelEle[e],this.gSeriesEle),this.gSeriesTextEle[e].childNodes.length>0&&this.svgRenderer.append(this.gSeriesTextEle[e],this.gSeriesEle))),this.vmlRendering||"visible"!=t.visibility||this.model.enableCanvasRendering||this.model.enable3D||(this.svgRenderer.append(this.gSeriesEle,this.svgObject),this.svgRenderer.append(this.svgObject,this.element))},_accSeriesDraw:function(e,t,i){var s,a,n,o=this,r=ej.DataManager(this.model._visibleSeries,ej.Query().sortBy("_zOrder")).executeLocal(),l=$.inArray(r[e],this.model._visibleSeries);this.model._visibleSeries[l]=r[e]=$.extend(!0,t,r[e]),s=$.extend({},ej.EjSvgRender.commonChartEventArgs),s.data={series:t},this._trigger("seriesRendering",s),a=new(ej.seriesTypes[i.toLowerCase()]),n=a.draw(o,t),n||(this.model.minhightwidth=!0,o._animationElements(t,a,l))},seriesRender:function(e){var t,i,s,a,n,o,r,l,d,h,c,u,m,p,g,_,f,b,v,x,w,y,C,S,T,D,I,k,P,L,R,M,O,E,A,j,N,z,F,B,H,V;if(this.model.allPoints=[],this.model.markerRegion=[],this.model.circleCenterX=[],this.model.circleCenterY=[],this.model.startX=[],this.model.startY=[],this.model.centerCount=0,!e)for(e={_crossAxisOverlap:!1,axes:{}},F=0;F0&&$(this.svgObject).find("#"+this.svgObject.id+"_SeriesCollection").remove();var U={id:this.svgObject.id+"_SeriesCollection","clip-path":"url(#"+this.svgObject.id+"_ChartAreaClipRect)"},W=this.model.enable3D,G=this.model.AreaType,Y=this.model.enableCanvasRendering,X=this.model._axes.length;for(this.gSeriesEle=this.svgRenderer.createGroup(U),D=ej.DataManager(this.model._visibleSeries,ej.Query().sortBy("_zOrder")).executeLocal(),i=D.length,F=0;F0&&"none"==G;n--)w=n-1,s=D[n-1],a=s.visibility.toLowerCase(),b=s.type.toLowerCase(),"visible"!==a||W||"pie"!=b&&"doughnut"!=b?"none"!=G||"visible"!==a||Y||ej.Ej3DChart.prototype.renderSeries(this,s):this._accSeriesDraw(w,s,b);for(o=0;oh.Width||u+p.height/2>h.Height||u-p.height/2<0)&&(p.hide=!0);for(f=t.model.m_AreaBounds.X,F=0;F=0;v--)x=this.model._visibleSeries[v],b=x.type.toLowerCase(),("pie"==b||"doughnut"==b)&&this.model.minhightwidth&&this._appendConnectorElements(v);for(N=this.model._visibleSeries.length,v=i-1;v>=0;v--)x=this.model._visibleSeries[v],b=x.type.toLowerCase(),("pie"==b||"doughnut"==b)&&this.model.minhightwidth&&this._appendDataLabelElement(v)}for(N=this.model._visibleSeries.length,y=0;y1&&x.enableAnimation&&!this.vmlRendering&&(!x._animatedTrendline||P._previousType!=P.type)&&(P._previousType=P.type,E=$(this.svgObject).find("#"+this.svgObject.id+"_TrendGroup_"+F+"_"+M+"_ClipRect").children(),ej.EjSeriesRender.prototype._doLineAnimation(this,E),x._animatedTrendline=O-1==F));for(N=this.model._visibleSeries.length,z=this.svgObject.id,F=0;F0&&j.length>0&&j.insertAfter(A),A.length>0&&Q.length>0&&Q.insertAfter(A)}this.model.AnimationComplete=!0,B=$.extend({},ej.EjSvgRender.commonChartEventArgs),B.data={series:R},this._trigger("animationComplete",B),Y&&(this.svgRenderer.append(this.svgObject,this.element),this.panning&&$("#"+this._id+"_canvas").css({cursor:"pointer"})),W&&!Y&&(this.svgRenderer.append(this.chart3D,this.svgObject),H={Width:$(this.svgObject).width(),Height:$(this.svgObject).height()},this.graphics.prepareView(this.model.perspectiveAngle,this.model.depth,this.model.rotation,this.model.tilt,H),this.graphics.view(this.svgObject,this)),this.svgRenderer.vmlNamespace&&this.svgRenderer.append(this.gSeriesEle,this.svgObject),"polaraxes"==G&&this.svgRenderer.append(this.gPolarAxisEle,this.svgObject),$(this.svgObject).find("#"+this.svgObject.id+"_StriplineOver").length>0&&(V=$(this.svgObject).find("#"+this.svgObject.id+"_StriplineOver").detach(),V.appendTo(this.svgObject)),this._renderScrollbar(),this.legendRender.drawLegend(e),t.model.initSeriesRender=!0},_scrollChanged:function(e){this.model._axes[e.model.index]._scrollLeft=e.scrollLeft,this.model._axes[e.model.index]._scrollTop=e.scrollTop,this.model.disableZoom||this._scrollRedraw()},_renderScrollbar:function(){for(var e,t,i,s,a,n,o,r=this.model.scrollerSize,l=$("#"+this._id).offset(),d=$(this.svgObject).offset().left-l.left,h=0;h0)&&m))if(t="horizontal"==u?c.columnIndex:c.rowIndex,i="horizontal"==u?c.width:r,s="vertical"==u?c.height:r,a=c.x+("vertical"==u?-r:0)+(d<=0?0:d),n=c.y+("horizontal"==u?c.height:0),o="horizontal"==u?c.width:c.height,c.enableScrollbar&&(c.zoomFactor=c.maxPointLength/c.virtualPointLength,0==$("#ScrollerParent_"+u+"_"+t+"_"+this._id).length&&(c.zoomPosition=c.isInversed?1-c.zoomPosition:c.zoomPosition)),value=o/c.zoomFactor,"horizontal"==u?(divWidth=value,divHeight=r,c._previousXScrollValue=c._scrollLeft=value*c.zoomPosition,c._previousYScrollValue=c._scrollTop=0):(divWidth=r,divHeight=value,c._previousYScrollValue=c._scrollTop=value-value*c.zoomPosition-o,c._previousXScrollValue=c._scrollLeft=0),this.element.find("#ScrollerParent_"+u+"_"+t+"_"+this._id).hasClass("e-scroller"))$("#ScrollerParent_"+u+"_"+t+"_"+this._id).css({width:i,height:s,left:a,top:n}),$("#ScrollerParent_"+u+"_"+t+"_"+this._id).find("#"+this._id+"_"+u+"_Scroller").css({height:divHeight,width:divWidth,top:a,left:n}),e=$("#ScrollerParent_"+u+"_"+t+"_"+this._id).ejScroller("instance"),(e.scrollLeft()!=c._scrollLeft||e.scrollTop()!=c._scrollTop||e.model.width!=i||e.model.height!=s)&&(e.model.scrollLeft=c._scrollLeft,e.model.scrollTop=c._scrollTop,e.model.width=i,e.model.height=s,e.refresh());else{var p=$("
      ").attr("id","ScrollerParent_"+u+"_"+t+"_"+this._id).css({position:"absolute",height:s,width:i,left:a,top:n}),g=$("
      ").attr("id","Scroller_"+u+"_"+this._id).css("height","0px","z-index",1e4),_=$("
      ").attr("id",this._id+"_"+u+"_Scroller").css({height:divHeight,width:divWidth,top:a,left:n});$(_).appendTo(g),$(g).appendTo(p),$(p).appendTo(this.chartContainer),$(p).ejScroller({width:i,scrollTop:c._scrollTop,scrollLeft:c._scrollLeft,height:s,orientation:u,index:h,scroll:$.proxy(this._scrollChanged,this)})}}},_scrollRedraw:function(){var e=this,t=!1;$.each(this.model._axes,function(i,s){if(void 0!=s._scrollLeft&&s._scrollLeft!=s._previousXScrollValue||void 0!=s._scrollTop&&s._scrollTop!=s._previousYScrollValue){var a=void 0!=s._scrollLeft?s._scrollLeft-s._previousXScrollValue:0,n=void 0!=s?s._scrollTop-s._previousYScrollValue:0,o=(e.model.requireInvertedAxes,s.orientation.toLowerCase()),r=0,l=0,d=Math.max(1/ej.EjSvgRender.utils._minMax(s.zoomFactor,0,1),1);"horizontal"==o?r=a:l=n,e.translate(s,r,l,d);var h=new(ej.axisTypes[s._valueType.toLowerCase()]),c=h._calculateVisibleRange(s,e,!0),u=$.extend({},ej.EjSvgRender.commonChartEventArgs);u.data={axis:s,zoomFactor:s.zoomFactor,zoomPosition:s.zoomPosition,oldRange:s.visibleRange,newRange:c},e._trigger("scrollChanged",u),t=!0}ej.util.isNullOrUndefined(s._scrollLeft)?s._previousYScrollValue=s._scrollTop:s._previousXScrollValue=s._scrollLeft}),!this.model.disableZoom&&t&&this.redraw(!0)},_renderTrendline:function(e,t){var i,s,a,n,o,r,l,d,h,c,u,m,p,g,_,f=$.inArray(t,e.model.series),b=t.xAxis.x,v=t.yAxis.y,x="translate("+b+","+v+")",w={id:e.svgObject.id+"_TrendlinesGroup_"+f,"clip-path":"url(#"+e.svgObject.id+"_TrendlinesGroup_"+f+"_ClipRect)"},y=t.trendlines,C="",S=y.length;for(e.gTrendlinesGroupEle||(e.gTrendlinesGroupEle=[]),e.gTrendlinesGroupEle[f]=e.svgRenderer.createGroup(w),l=0;l1){switch(u={id:e.svgObject.id+"_TrendGroup_"+f+"_"+l,transform:x,"clip-path":"url(#"+e.svgObject.id+"_TrendGroup_"+f+"_"+l+"_ClipRect)"},t.gTrendGroupEle=null,t.gTrendGroupEle=e.svgRenderer.createGroup(u),m=r.type.toLowerCase(),o=new ej.trendlineTypes[m],d=r.slope,h=r._intercept,m){case"linear":C="y = "+d.toFixed(4)+"x + "+h.toFixed(4);break;case"exponential":C="y = "+h.toFixed(3)+"e^"+d.toFixed(4)+"x";break;case"logarithmic":C="y = "+d.toFixed(3)+"ln(x) + "+h.toFixed(4);break;case"power":C="y = "+h.toFixed(3)+"x^"+d.toFixed(4);break;case"polynomial":for(a=r.polynomialSlopes,n=a.length,C="y = ",i=n-1;i>=0;i--)c=a[i],C+=c>0?"+"+c:"-"+Math.abs(c),0!=i&&(C+="x^"+i+" ")}r.equation=C,p=$.extend({},ej.EjSvgRender.commonChartEventArgs),g=r.points[0],_=r.points[r.points.length-1],p.data={series:t,trendline:r,forwardForecastPoints:_,backwardForecastPoints:g},this._trigger("trendlineRendering",p),e.model.enableCanvasRendering?(this.svgRenderer.ctx.save(),this.svgRenderer.ctx.beginPath(),this.svgRenderer.ctx.rect(e.model.m_AreaBounds.X,t.yAxis.y,t.xAxis.width,t.yAxis.height),this.svgRenderer.ctx.clip(),this.svgRenderer.ctx.beginPath(),o.draw(r,t,e),this.svgRenderer.ctx.restore()):(o.draw(r,t,e),s=t.gTrendGroupEle,s&&ej.EjSvgRender.utils._drawAxesBoundsClipPath(s,t,this))}},_renderStripline:function(e){var t,i,s,a;for($.extend(ej.EjStripline.prototype,this),this.chartstripline=new ej.EjStripline(this),t=this.chartstripline,this.model._stripeline=!1,i=0;i0&&(c=this.gConnectorEle[m],ej.EjSvgRender.utils._drawAxesBoundsClipPath(c,e,this))):(c=this.gSymbolGroupEle[m],ej.EjSvgRender.utils._drawAxesBoundsClipPath(c,e,this),this.svgRenderer.append(c,this.gSeriesEle),(e.tooltip.visible||"scatter"==f)&&(u=this.model.enableCanvasRendering?this.model.series[m].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(r,e,t)},renderErrorBar:function(e,t){var i,s,a,n,o,r,l,d,h,c,u,m,p,g,_,f,b,v,x,w,y,C,S,T,D,I,k,P,L,R,M,O,E,A,j,N,z,F,B,H,V,U,W,G,Y,X,q,K,Q,Z,J,ee,te,ie,se,ae,ne,oe,re,le,de,he,ce,ue,me,pe,ge,_e,fe,be=this,ve=be.model,xe=t,we=xe._visiblePoints,ye=we.length,Ce=be.canvasX,Se=be.canvasY,Te=$.inArray(xe,ve._visibleSeries),De=null,Ie=ej.EjSvgRender.utils._getTransform(xe.xAxis,xe.yAxis,ve.requireInvertedAxes),ke=ve.requireInvertedAxes,Pe=be.svgObject.id,Le=be.model.m_AreaBounds,De="translate("+Ie.x+","+Ie.y+")";for(b={id:Pe+"_ErrorBarGroup_"+Te,transform:De,"clip-path":"url(#"+Pe+"_ChartAreaClipRect)"},ej.util.isNullOrUndefined(be.gErrorBarGroupEle)&&(be.gErrorBarGroupEle=[]),f=be.gErrorBarGroupEle[Te]=be.svgRenderer.createGroup(b),commonEventArgs=$.extend({},ej.EjSvgRender.commonChartEventArgs),commonEventArgs.data={errorBar:e},this._trigger("errorBarRendering",commonEventArgs),v=commonEventArgs.data.errorBar,i=v.type,s=v.mode,a=v.direction,n=v.fill,o=v.cap,r=v.cap.fill,l=v.cap.width,d=v.cap.length,c=v.verticalErrorValue,u=v.horizontalErrorValue,m=v.verticalPositiveErrorValue,p=v.verticalNegativeErrorValue,g=v.horizontalPositiveErrorValue,_=v.horizontalNegativeErrorValue,h=0;h-1?y.symbolLocation:y.location,ej.util.isNullOrUndefined(I)&&(I=ej.EjSvgRender.utils._getPoint(y,xe)),N=I.X,z=I.Y,i){case"fixedValue":oe=y,("vertical"==s||"both"==s)&&(oe.YValues[0]=C+c,k=ej.EjSvgRender.utils._getPoint(oe,xe),oe.YValues[0]=C-c,P=ej.EjSvgRender.utils._getPoint(oe,xe),ke?k.Y=P.Y=I.Y:k.X=P.X=I.X),("horizontal"==s||"both"==s)&&(oe.YValues[0]=C,oe.xValue=S,oe.xValue=S+u,L=ej.EjSvgRender.utils._getPoint(oe,xe),oe.xValue=S-u,R=ej.EjSvgRender.utils._getPoint(oe,xe)),oe.YValues[0]=C,oe.xValue=S;break;case"percentage":re=y,le=c/100*C,de=u/100*S,("vertical"==s||"both"==s)&&(re.YValues[0]=C+le,k=ej.EjSvgRender.utils._getPoint(re,xe),re.YValues[0]=C-le,P=ej.EjSvgRender.utils._getPoint(re,xe),ke?k.Y=P.Y=I.Y:k.X=P.X=I.X),("horizontal"==s||"both"==s)&&(re.YValues[0]=C,re.xValue=S,re.xValue=S+de,L=ej.EjSvgRender.utils._getPoint(re,xe),re.xValue=S-de,R=ej.EjSvgRender.utils._getPoint(re,xe)),re.YValues[0]=C,re.xValue=S;break;case"standardDeviation":he=y,M=be.meanCalculation(s,we),O=M.verMean,E=M.horMean,A=M.verStandSquareRoot,j=M.horStandSquareRoot,("vertical"==s||"both"==s)&&(F=c*A,he.YValues[0]=O,H=ej.EjSvgRender.utils._getPoint(he,xe),C=he.YValues[0],he.YValues[0]=C+F,k=ej.EjSvgRender.utils._getPoint(he,xe),he.YValues[0]=C-F,P=ej.EjSvgRender.utils._getPoint(he,xe),ke?H.Y=k.Y=P.Y=I.Y:H.X=k.X=P.X=I.X,H.X=H.X+Ce,H.Y=H.Y+Se),("horizontal"==s||"both"==s)&&(B=u*j,he.xValue=E,V=ej.EjSvgRender.utils._getPoint(he,xe),ke?V.X=I.X:V.Y=I.Y,he.YValues[0]=T,S=he.xValue,he.xValue=S+B,L=ej.EjSvgRender.utils._getPoint(he,xe),he.xValue=S-B,R=ej.EjSvgRender.utils._getPoint(he,xe),V.X=V.X+Ce,V.Y=V.Y+Se),he.YValues[0]=T,he.xValue=D;break;case"standardError":ce=y,M=be.meanCalculation(s,we),A=M.verStandSquareRoot,j=M.horStandSquareRoot,("vertical"==s||"both"==s)&&(F=c*A,U=F/Math.sqrt(ye),ce.YValues[0]=C+U,k=ej.EjSvgRender.utils._getPoint(ce,xe),ce.YValues[0]=C-U,P=ej.EjSvgRender.utils._getPoint(ce,xe),ke?k.Y=P.Y=I.Y:k.X=P.X=I.X),("horizontal"==s||"both"==s)&&(B=u*j,W=B/Math.sqrt(ye),ce.YValues[0]=C,ce.xValue=S,ce.xValue=S+W,L=ej.EjSvgRender.utils._getPoint(ce,xe),ce.xValue=S-W,R=ej.EjSvgRender.utils._getPoint(ce,xe)),ce.YValues[0]=C,ce.xValue=S,h=w;break;case"custom":ue=y,("vertical"==s||"both"==s)&&(ue.YValues[0]=C+m,k=ej.EjSvgRender.utils._getPoint(ue,xe),ue.YValues[0]=C-p,P=ej.EjSvgRender.utils._getPoint(ue,xe),ke?k.Y=P.Y=I.Y:k.X=P.X=I.X),("horizontal"==s||"both"==s)&&(ue.YValues[0]=C,ue.xValue=S,ue.xValue=S+g,L=ej.EjSvgRender.utils._getPoint(ue,xe),ue.xValue=S-_,R=ej.EjSvgRender.utils._getPoint(ue,xe)),ue.YValues[0]=C,ue.xValue=S}1==o.visible&&(("vertical"==s||"both"==s)&&(G={verHighvalue:k,verLowvalue:P}),("horizontal"==s||"both"==s)&&(Y={horHighvalue:L,horLowvalue:R}),me=be.renderCap(o,s,G,Y,ke),X=me.verHighCapX1,q=me.verHighCapX2,K=me.verLowCapX1,Q=me.verLowCapX2,Z=me.horHighCapY1,J=me.horHighCapY2,ee=me.horLowCapY1,te=me.horLowCapY2),N+=Ce,z+=Se,("vertical"==s||"both"==s)&&(k.X=k.X+Ce,k.Y=k.Y+Se,P.X=P.X+Ce,P.Y=P.Y+Se),("horizontal"==s||"both"==s)&&(L.X=L.X+Ce,L.Y=L.Y+Se,R.X=R.X+Ce,R.Y=R.Y+Se),"both"==a?(("vertical"==s||"both"==s)&&("standardDeviation"!=i?ie="M "+N+" "+z+" L "+k.X+" "+k.Y+" M "+N+" "+z+" L "+P.X+" "+P.Y+" ":"standardDeviation"==i&&(ie="M "+H.X+" "+H.Y+" L "+k.X+" "+k.Y+" M "+H.X+" "+H.Y+" L "+P.X+" "+P.Y+" "),se=ke?o.visible?"M "+k.X+" "+k.Y+" L "+k.X+" "+X+" M "+k.X+" "+k.Y+" L "+k.X+" "+q+" M "+P.X+" "+P.Y+" L "+P.X+" "+K+" M "+P.X+" "+P.Y+" L "+P.X+" "+Q+" ":"":o.visible?"M "+k.X+" "+k.Y+" L "+X+" "+k.Y+" M "+k.X+" "+k.Y+" L "+q+" "+k.Y+" M "+P.X+" "+P.Y+" L "+K+" "+P.Y+" M "+P.X+" "+P.Y+" L "+Q+" "+P.Y+" ":"",pe=ie,ge=se),("horizontal"==s||"both"==s)&&("standardDeviation"!=i?ae="M "+N+" "+z+" L "+L.X+" "+L.Y+" M "+N+" "+z+" L "+R.X+" "+R.Y+" ":"standardDeviation"==i&&(ae="M "+V.X+" "+V.Y+" L "+L.X+" "+L.Y+" M "+V.X+" "+V.Y+" L "+R.X+" "+R.Y+" "),ne=ke?o.visible?"M "+L.X+" "+L.Y+" L "+Z+" "+L.Y+" M "+L.X+" "+L.Y+" L "+J+" "+L.Y+" M "+R.X+" "+R.Y+" L "+ee+" "+R.Y+" M "+R.X+" "+R.Y+" L "+te+" "+R.Y+" ":"":o.visible?"M "+L.X+" "+L.Y+" L "+L.X+" "+Z+" M "+L.X+" "+L.Y+" L "+L.X+" "+J+" M "+R.X+" "+R.Y+" L "+R.X+" "+ee+" M "+R.X+" "+R.Y+" L "+R.X+" "+te+" ":"",pe=ae,ge=ne),"both"==s&&(ae+=ie,ne+=se,pe=ae,ge=ne)):"plus"==a?(("vertical"==s||"both"==s)&&("standardDeviation"!=i?ie="M "+N+" "+z+" L "+k.X+" "+k.Y+" ":"standardDeviation"==i&&(ie="M "+H.X+" "+H.Y+" L "+k.X+" "+k.Y+" "),se=ke?o.visible?"M "+k.X+" "+k.Y+" L "+k.X+" "+X+" M "+k.X+" "+k.Y+" L "+k.X+" "+q+" ":"":o.visible?"M "+k.X+" "+k.Y+" L "+X+" "+k.Y+" M "+k.X+" "+k.Y+" L "+q+" "+k.Y+" ":"",pe=ie,ge=se),("horizontal"==s||"both"==s)&&("standardDeviation"!=i?ae="M "+N+" "+z+" L "+L.X+" "+L.Y+" ":"standardDeviation"==i&&(ae="M "+V.X+" "+V.Y+" L "+L.X+" "+L.Y+" "),ne=ke?o.visible?"M "+L.X+" "+L.Y+" L "+Z+" "+L.Y+" M "+L.X+" "+L.Y+" L "+J+" "+L.Y+" ":"":o.visible?"M "+L.X+" "+L.Y+" L "+L.X+" "+Z+" M "+L.X+" "+L.Y+" L "+L.X+" "+J+" ":"",pe=ae,ge=ne),"both"==s&&(ae+=ie,ne+=se,pe=ae,ge=ne)):(("vertical"==s||"both"==s)&&("standardDeviation"!=i?ie="M "+N+" "+z+" L "+P.X+" "+P.Y+" ":"standardDeviation"==i&&(ie="M "+H.X+" "+H.Y+" L "+P.X+" "+P.Y+" "),se=ke?o.visible?"M "+P.X+" "+P.Y+" L "+P.X+" "+K+" M "+P.X+" "+P.Y+" L "+P.X+" "+Q+" ":"":o.visible?"M "+P.X+" "+P.Y+" L "+K+" "+P.Y+" M "+P.X+" "+P.Y+" L "+Q+" "+P.Y+" ":"",pe=ie,ge=se),("horizontal"==s||"both"==s)&&("standardDeviation"!=i?ae="M "+N+" "+z+" L "+R.X+" "+R.Y+" ":"standardDeviation"==i&&(ae="M "+V.X+" "+V.Y+" L "+R.X+" "+R.Y+" "),ne=ke?o.visible?"M "+R.X+" "+R.Y+" L "+ee+" "+R.Y+" M "+R.X+" "+R.Y+" L "+te+" "+R.Y+" ":"":o.visible?"M "+R.X+" "+R.Y+" L "+R.X+" "+ee+" M "+R.X+" "+R.Y+" L "+R.X+" "+te+" ":"", pe=ae,ge=ne),"both"==s&&(ae+=ie,ne+=se,pe=ae,ge=ne)),_e={id:be.svgObject.id+"_ErrorBar_"+Te+"_Point"+w,d:pe,stroke:n,"stroke-width":e.width,opacity:e.opacity},fe={id:be.svgObject.id+"_ErrorBarCap_"+Te+"_Point"+w,d:ge,stroke:r,"stroke-width":l},be.model.enableCanvasRendering?(this.svgRenderer.ctx.rect(Le.X,Le.Y,Le.Width,Le.Height),this.svgRenderer.ctx.clip(),be.svgRenderer.drawPath(_e,null),be.svgRenderer.drawPath(fe,null)):(be.svgRenderer.drawPath(_e,errorBarPointGroup),be.svgRenderer.drawPath(fe,errorBarPointGroup),be.svgRenderer.append(errorBarPointGroup,f))}be.svgRenderer.append(f,be.gSeriesEle),ej.EjSvgRender.utils._drawAxesBoundsClipPath(f,xe,be)},meanCalculation:function(e,t){for(var i,s,a,n,o,r,l,d,h,c,u,m,p,g,_,f,b,v,x=temp1=0,w=t.length,y=0;y-_/2&&(p=b-_/2,c.textOptions.x=c.xPos=b+Math.abs(p)+10,c.newConnectorFlag=!0),b+_/2>g.Width&&b+_/2g.Height&&v+f/2-f/2&&(p=v-f/2,c.yPos=c.yPos+Math.abs(p)+10,c.textOptions.y=c.yPos+5,c.newConnectorFlag=!0);for(a=0;axPosition+g.Width||d+_g.Y+g.Height||this.zoomed&&(dxPosition+g.Width||h>yPosition+g.Height))&&l.remove())):this.storeDataLabelPositions(c))},storeDataLabelPositions:function(e){var t=e.position,i=this.posObj;switch(t){case"top":i.top[this.processCount-1]=e,this.processCount=1;break;case"rightTop":i.rightTop[this.processCount-1]=e,this.processCount=1;break;case"right":i.right[this.processCount-1]=e,this.processCount=1;break;case"rightBottom":i.rightBottom[this.processCount-1]=e,this.processCount=1;break;case"bottom":i.bottom[this.processCount-1]=e,this.processCount=1;break;case"left":i.left[this.processCount-1]=e,this.processCount=1;break;case"leftBottom":i.leftBottom[this.processCount-1]=e,this.processCount=1;break;case"leftTop":i.leftTop[this.processCount-1]=e}},cartesianColumnSmartLabels:function(e,t){var i,s,a,n=t.length;for(connectorFlag=!1,this.processCount=1,i=0;i1&&this.resetValues(o),collide.marker?(this.prevLabel=collide.markerRegion,this.processCount=1):ej.util.isNullOrUndefined(this.prevLabel)?(this.prevLabel=n,this.processCount=1):(checkCollide=this.isCollide(this.prevLabel,o),checkCollide.state||(this.prevLabel=n,this.processCount=1)),this.resetValues(o),s>1&&l.right[this.processCount-2]?(n=l.right[this.processCount-2],o.textOptions.x=o.xPos=n.xPos+(n.width/2+o.width/2+a)):o.textOptions.x=o.xPos=this.prevLabel.xPos+(this.prevLabel.width/2+o.width/2+a),i+=1,o.position="right",this.compareDataLabels(e,t,i,this.processCount);break;case 1:this.resetValues(o),o.textOptions.x=o.xPos=this.prevLabel.xPos+this.prevLabel.width/2+o.width/2+a,s>1&&l.rightBottom[this.processCount-2]?(n=l.rightBottom[this.processCount-2],o.textOptions.y=o.yPos=n.yPos+this.canvasY+n.height+a):o.textOptions.y=o.yPos=o.location.Y+this.canvasY+o.height+a/2,o.textOptions.y=o.textOptions.y+a/2+o.margin.top/2-o.margin.bottom/2,o.position="rightBottom",i+=1,this.compareDataLabels(e,t,i,this.processCount);break;case 2:this.resetValues(o),o.textOptions.y=o.yPos=o.location.Y+this.canvasY+o.height+a/2,s>1&&l.bottom[this.processCount-2]?(n=l.bottom[this.processCount-2],o.textOptions.y=o.yPos=n.yPos+o.height+a):o.textOptions.y=o.yPos=o.location.Y+this.canvasY+o.height+a/2,o.textOptions.y=o.textOptions.y+a/2+o.margin.top/2-o.margin.bottom/2,o.position="bottom",i+=1,this.compareDataLabels(e,t,i,this.processCount);break;case 3:this.resetValues(o),o.textOptions.x=o.xPos=this.prevLabel.xPos-this.prevLabel.width/2-o.width/2-a,s>1&&l.leftBottom[this.processCount-2]?(n=l.leftBottom[this.processCount-2],o.textOptions.y=o.yPos=n.yPos+this.canvasY+n.height+a):o.textOptions.y=o.yPos=o.location.Y+this.canvasY+o.height+a/2,o.textOptions.y=o.textOptions.y+a/2+o.margin.top/2-o.margin.bottom/2,o.position="leftBottom",i+=1,this.compareDataLabels(e,t,i,this.processCount);break;case 4:this.resetValues(o),s>1&&l.left[this.processCount-2]?(n=l.left[this.processCount-2],o.textOptions.x=o.xPos=n.xPos-n.width/2-o.width/2-a):o.textOptions.x=o.xPos=this.prevLabel.xPos-this.prevLabel.width/2-o.width/2-a,o.position="left",i+=1,this.compareDataLabels(e,t,i,this.processCount);break;case 5:this.resetValues(o),o.textOptions.x=o.xPos=this.prevLabel.xPos-this.prevLabel.width/2-o.width/2-a,s>1&&l.leftTop[this.processCount-2]?(n=l.leftTop[this.processCount-2],o.textOptions.y=o.yPos=n.yPos-(o.height+a)):o.textOptions.y=o.yPos=this.prevLabel.yPos-o.height-a,o.textOptions.y=o.textOptions.y+a/2+o.margin.top/2-o.margin.bottom/2,o.position="leftTop",i+=1,this.compareDataLabels(e,t,i,this.processCount);break;case 6:this.resetValues(o),s>1&&l.top[s-2]?(n=l.top[s-2],o.textOptions.y=o.yPos=n.yPos-(o.height+a)):o.textOptions.y=o.yPos=this.prevLabel.yPos-this.processCount*(o.height+a),o.textOptions.y=o.textOptions.y+a/2+o.margin.top/2-o.margin.bottom/2,i+=1,o.position="top",this.compareDataLabels(e,t,i,this.processCount);break;case 7:this.resetValues(o),o.textOptions.x=o.xPos=this.prevLabel.xPos+this.prevLabel.width/2+o.width/2+a,s>1&&l.rightTop[this.processCount-2]?(n=l.rightTop[this.processCount-2],o.textOptions.y=o.yPos=n.yPos-o.height-a):o.textOptions.y=o.yPos=this.prevLabel.yPos-o.height-a,o.textOptions.y=o.textOptions.y+a/2+o.margin.top/2-o.margin.bottom/2,o.position="rightTop",i+=1,this.compareDataLabels(e,t,i,this.processCount);break;case 8:i=0,this.processCount+=1,this.compareDataLabels(e,t,i,this.processCount)}},drawConnectorLines:function(e,t,i){var s,a=!1,n=!0,o=i.xPos,r=i.yPos,l=this.model.m_AreaBounds,d=i.location?i.location:i.symbolLocation;if(d.Y>i.textOptions.y?s=i.textOptions.y:(a=!0,s=i.textOptions.y-i.height/2),i.dataLabeltemplate?(s=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>l.Width||o+i.width<0||r-i.height>l.Height||r+i.height<0)&&(n=!1),n){var h="M "+(d.X+this.canvasX)+" "+(d.Y+this.canvasY)+" L "+i.textOptions.x+" "+s,c=this.model.series[e].marker.dataLabel.connectorLine,u=ej.util.isNullOrUndefined(c.color)?this.model.series[e].fill:c.color,m={id:this.svgObject.id+"_dataLabelConnectorLine_series"+e+"_"+t,stroke:u,"stroke-width":c.width,d:h};this.model.series[e].connectorLines=!0,this.svgRenderer.drawPath(m,this.gConnectorEle[e])}},resetValues:function(e){e.textOptions.y=e.dataLabel.textY,e.yPos=e.dataLabel.y,e.textOptions.x=e.dataLabel.textX,e.xPos=e.dataLabel.x},isCollide:function(e,t){var i,s=0,a=0,n=!1,o=!1,r=e.seriesIndex?this.model.series[e.seriesIndex].marker.dataLabel.border.width:0;r+=t.seriesIndex?this.model.series[t.seriesIndex].marker.dataLabel.border.width:0;var l=this.model.series,d=l[e.seriesIndex],h=l[t.seriesIndex],c=e.xPos,u=e.yPos,m=t.xPos,p=t.yPos;if(e.xPos+=d.xAxis.x,e.yPos+=d.yAxis.y,t.xPos+=h.xAxis.x,t.yPos+=h.yAxis.y,e!=t&&(n=!(e.yPos+e.heightt.yPos+t.height||e.xPos+e.width/2+rt.xPos+t.width/2),n&&(a=e.yPos+e.height-t.yPos,s=e.xPos+e.width-t.xPos),e.xPos=c,e.yPos=u),!n)for(i=0;it.yPos+t.height||e.xPos+e.widtht.xPos+t.width)));i++);return e.xPos=c,e.yPos=u,t.xPos=m,t.yPos=p,{state:n,marker:o,markerRegion:e,width:s,height:a}},drawAccDisplayText:function(e,t,i){var s,a,n,o,r=this,l=t._visiblePoints.length;if(r.firstStartAngle=[],"pyramid"!=t.type.toLowerCase()&&"funnel"!=t.type.toLowerCase()&&(t.leftsidePoints.length>0||t.rightsidePoints.length>0)){for(s=t.rightsidePoints.length,a=t.leftsidePoints.length,o=0;o=0;n--)t.leftsidePoints[n].index=n,e.drawDataLabelAcc(r,t,t.leftsidePoints[n].pointIndex,t.leftsidePoints[n],i)}else for(o=0;o=0;"pie"!=i||"doughnut"!=i?o++:o--)if(t.model.series[o].dataSource&&"hidden"==t.model.series[o].visibility){a=!1;break}a&&t.draw()}),s.fail(function(){var i,s;for(e.visibility="visible",$(t.svgObject).empty(),$(t.legendSvgContainer).empty(),i=!0,s=0;s0&&(t.points.length=0);var w,y,C=[],S=(t.dataSource,t.xName),T=t.yName,D=t.pointColorMappingName,I=t.marker.dataLabel.textMappingName,k=[],P=[],L=t.type.toLowerCase(),R=e.length;for(i=0;i1?(t.points[x].high=t.points[x].YValues[0]=s[0][x],t.points[x].low=t.points[x].YValues[1]=s[1][x],"hilo"!=L&&"rangecolumn"!=L&&"waterfall"!=L&&y>3&&(t.points[x].open=t.points[x].YValues[2]=s[2][x],t.points[x].close=t.points[x].YValues[3]=s[3][x],t.volume&&(t.points[x].volume=t.points[x].YValues[4]=s[4][x]))):t.points[x].YValues[0]=s[0][x]},bindTo:function(e){var t,i,s,a,n,o,r;for($("#"+this.svgObject.id+"_CrosshairVertical").remove(),$("#"+this.svgObject.id+"_CrosshairHorizontal").remove(),$(document).find('[id*="_TrackToolTip"]').remove(),$("#template_group_"+this._id).remove(),this.model.primaryXAxis._valueType=null,this.model.primaryXAxis.position=null,this.model.primaryYAxis._valueType=null,this.model.primaryYAxis.position=null,this.model.requireInvertedAxes=!1,t=this.model.series.length,i=this.model.axes.length,r=0;r0&&this._processJsonData(o[r].dataSource,o[r]));$(this.svgObject).width()>0&&this.draw(e)}},calculateHeight:function(e){var t=$(e.svgObject),i=e.model.size.height,s=$(e.element).height(),a=s/100*parseInt(i);return t.height(a),a},calculateWidth:function(e){var t=$(e.svgObject),i=e.model.size.width,s=$(e.element).width(),a=s/100*parseInt(i);return t.width(a),a},selectedStyle:function(e){for(var t=$("#"+e._id).find('[class*="Selection"]'),i=[],s=0;s0&&(i.pattern=$("[id $= Def ]")),i},chartResize:function(){var e,t,i,s=this,a=$(s.svgObject),n=this.selectedStyle(s);this.removeMultiRect(),this.model.enableCanvasRendering&&($("[id*="+this._id+"_Selection_]").remove(),$("#canvas_trackSymbol").remove(),e=s.svgObject.getContext("2d"),e.clearRect(0,0,this.svgRenderer.svgObj.width,this.svgRenderer.svgObj.height),"string"==typeof s.model.size.width&&s.model.size.width.indexOf("%")!=-1?(t=s.calculateWidth(s),this.svgRenderer.svgObj.width=t):this.svgRenderer.svgObj.width=$("#"+this._id).width(),"string"==typeof s.model.size.height&&s.model.size.height.indexOf("%")!=-1?(i=s.calculateHeight(s),this.svgRenderer.svgObj.height=i):this.svgRenderer.svgObj.height=ej.util.isNullOrUndefined(this.model.size.height)?"450":parseInt($(s.element).height())),this.resizeTO&&clearTimeout(this.resizeTO),this.resizeTO=setTimeout(function(){var e,t;if(!ej.util.isNullOrUndefined(s.model)&&("string"==typeof s.model.size.width&&s.model.size.width.indexOf("%")!=-1?s.calculateWidth(s):a.width($(s.element).width()),"string"==typeof s.model.size.height&&s.model.size.height.indexOf("%")!=-1?s.calculateHeight(s):a.height($(s.element).height()),$(s.svgObject).width()>0)){for($(s.svgObject).empty(),$(s.legendSvgContainer).empty(),$("#template_group_"+s._id).remove(),$("#annotation_group_"+s._id).remove(),s.disableAnimation(),e=0;e=1){var s=this.calZoomFactors(e,t,i.zoomFactor,i.zoomPosition);if(i.zoomPosition!=s.zoomMPosition||i.zoomFactor!=s.zoomMFactor)return this.zoomed=!0,i.zoomPosition=s.zoomMPosition,i.zoomFactor=s.zoomMPosition+s.zoomMFactor>1?1-s.zoomMPosition:s.zoomMFactor,!0}return!1},enableAnimation:function(){for(var e,t=0;t=0;a--)switch(i=e[a],s=t-a,i){case"reset":this.resetZoomButton(s);break;case"pan":this.panButton(s);break;case"zoom":case"zoomIn":case"zoomOut":this.zoomButton(s,i);break;default:t-=1}},chartMouseWheel:function(e){var t,i,s,a,n,o,r;if($("#"+this.svgObject.id+"_TrackToolTip").hide(),this.model.zooming.enableMouseWheel&&"cartesianaxes"==this.model.AreaType&&!this.model.enable3D&&!this.vmlRendering){t=this,this.zoomed=!1;var l=!1,d="#"+t.svgObject.id,r=jQuery.uaMatch(navigator.userAgent),h=!!navigator.userAgent.match(/Trident\/7\./),c=e.originalEvent.wheelDelta,u="mozilla"==r.browser.toLowerCase()?h?c/120>0?1:-1:-e.originalEvent.detail/3>0?1:-1:c/120>0?1:-1;for(s=0;s=0||c.indexOf("vertical")>=0)for(l=0;l=0?this.model._axes[l].opposedPosition?i:i+a:i,this.mousemoveX>=i&&this.mousemoveX<=i+a&&(this.vmlRendering?this.mousemoveY<=s+n&&this.mousemoveY>=s:this.mousemoveY>=s-n&&this.mousemoveY<=s)))return{location:{x:this.mousemoveX,y:this.mousemoveY},index:d,axis:this.model._axes[l],text:t.labelText}},getLegendData:function(e){var t=this.calMousePosition(e),i=this.model.legend._ejScroller,s=i?$("#legend_"+this._id).ejScroller("instance").model.scrollTop:$("#legend_"+this._id).scrollTop(),a=i?$("#legend_"+this._id).ejScroller("instance").model.scrollLeft:$("#legend_"+this._id).scrollLeft();this.scrolltop=s,this.scrollleft=a,this.mousemoveX=t.X+a,this.mousemoveY=t.Y+s;var n,o=this.mousemoveX,r=this.mousemoveY,l=this._id;return!(!(!ej.util.isNullOrUndefined(e.target.id)&&this.svgRenderer._getAttrVal($(e.target).parents(":eq(1)"),"id")==this.svgObject.id+"_Legend"||this.model.enableCanvasRendering||this.vmlRendering)||($.each(this.model.legendRegion,function(e,t){o>=t.Bounds.LegendBound.X+t.Bounds.ItemBound.X&&o<=t.Bounds.LegendBound.X+t.Bounds.ItemBound.X+t.Bounds.ItemBound.Width&&(r>=t.Bounds.LegendBound.Y+t.Bounds.ItemBound.Y-t.Bounds.ItemBound.Height/4&&r<=t.Bounds.LegendBound.Y+t.Bounds.ItemBound.Y+t.Bounds.ItemBound.Height?(n=t,$("#legend_"+l+"_canvas").css("cursor","pointer")):$("#legend_"+l+"_canvas").css("cursor","default"))}),ej.util.isNullOrUndefined(n)))&&{legendItem:n,series:this.model._visibleSeries[n.LegendItem.SeriesIndex]}},get3DSeriesPoint:function(e){var t,i,s,a=this.mousemoveX,n=this.mousemoveY,o="polaraxes"==this.model.AreaType?0:this.model.m_AreaBounds.X,r="polaraxes"==this.model.AreaType?0:this.model.m_AreaBounds.Y,l="polaraxes"==this.model.AreaType?$(this.svgObject).width():this.model.m_AreaBounds.Width,d="polaraxes"==this.model.AreaType?$(this.svgObject).height():this.model.m_AreaBounds.Height; if(a>o&&ar&&n1))return index=$(e.target)[0].id.match(/(\d+)/g),pointIndex=parseInt(index[index.length-1]),seriesIndex=parseInt(index[index.length-2]),i={},i.Region={},i.Region.PointIndex=pointIndex,i.SeriesIndex=seriesIndex,s={},s.pointIndex=pointIndex,region={region:i,pointData:s,location:{x:a,y:n}}},GetSeriesPoint:function(e){for(var t,i,s,a,n,o,r,l,d=this.mousemoveX,h=this.mousemoveY,c=this,u=c.model.indicators,m=c.model._visibleSeries,p=0;pg&&d_&&h<_+b&&$.each(this.model.chartRegions,function(s,a){var n,o,r,u,p,g,_,f,b,v,x,w,y,C;if(ej.util.isNullOrUndefined(a.SeriesIndex)){if(i=c.model.chartRegions,_={},!a.isStripLine){var S=a.length,T=c.model.requireInvertedAxes,D=T?c.model.series[a[S-1].SeriesIndex]._xAxisName:c.model.series[a[S-1].SeriesIndex]._yAxisName;for(b=0;b=o&&E<=r&&(s=u.PointIndex,t=Math.sqrt(Math.pow(Math.abs(I),2)+Math.pow(Math.abs(k),2)),t<=u.Radius&&t>L&&(p={Region:{PointIndex:s},SeriesIndex:a.SeriesIndex,type:a.type},l=p))}else if("radar"==n.type.toLowerCase()&&(u=a.Region.Bounds,u.Line1)){line1=u.Line1,line2=u.Line2,line3=u.Line3;for(var w=[{x:line1.x,y:line1.y},{x:line2.x,y:line2.y},{x:line3.x,y:line3.y}],y={x:d,y:h},C=!1,A=!1,v=-1,j=w.length,x=j-1;++v=a.Region.Bounds.X&&d<=a.Region.Bounds.X+a.Region.Bounds.Width&&h>a.Region.Bounds.Y&&h0)||"pyramid"!=s[0].Series.type.toLowerCase()&&"funnel"!=s[0].Series.type.toLowerCase())return $.each(c.model.chartRegions,function(e,i){var s,a,o,r,u,m,p,g,_,f,b,v=-.5*Math.PI,x=i.SeriesData,w=i.Region,y="doughnut"==c.model._visibleSeries[i.SeriesIndex].type.toLowerCase()?x.DRadius:0;s=d-x.CenterX,a=h-x.CenterY;var C=c.model._visibleSeries[i.SeriesIndex],S=C.startAngle,T=C.endAngle;if(S=S<0?S+360:S,T=T<0?T+360:T,o=C.endAngle-C.startAngle,o<0){for(T/=360,r=T?2*Math.PI*(T<0?1+T:T):0,u=(Math.atan2(a,s)-v-r)%(2*Math.PI),u<0&&(u=2*Math.PI+u),n=[],m=0;m=0&&C.endAngle<=0&&(p=p<=0?2*Math.PI+p:p,g=g<0?2*Math.PI+g:g),u<=p&&u>=g){n.push(w[m]);break}}else for(r=S?2*Math.PI*(c.model.itemCurrentXPos<0?1+c.model.itemCurrentXPos:c.model.itemCurrentXPos):0,u=(Math.atan2(a,s)-v-r)%(2*Math.PI),u<0&&(u=2*Math.PI+u),n=[],m=0;m-1||null==C.endAngle)&&(p=p<0?2*Math.PI+p:p,g=g<=0?2*Math.PI+g:g),u>=p&&u<=g){n.push(w[m]);break}n.length>0&&(_=C.explodeAll||C.explodeIndex==n[0].PointIndex,_?(f=d-n[0].StartX,b=h-n[0].StartY,n.length>0&&(t=Math.sqrt(Math.pow(Math.abs(f),2)+Math.pow(Math.abs(b),2)),t<=x.Radius&&t>y&&(w.PointIndex=n[0].PointIndex,w.SeriesIndex=n[0].SeriesIndex,l={region:i,pointData:n,location:{x:d,y:h}}))):(t=Math.sqrt(Math.pow(Math.abs(s),2)+Math.pow(Math.abs(a),2)),t<=x.Radius&&t>y&&(w.PointIndex=n[0].PointIndex,w.SeriesIndex=n[0].SeriesIndex,l={region:i,pointData:n,location:{x:d,y:h}})))}),l;if(a=$(e.target)[0].nodeName,("path"==a||"shape"==a)&&$($(e.target).parent())[0].id==c.svgObject.id+"_SeriesGroup_"+s[0].SeriesIndex)return i=c.model.chartRegions[0],index=$(e.target)[0].id.match(/(\d+)/g),index=parseInt(index[index.length-1]),i.Region.PointIndex=index,n={},n.pointIndex=index,l={region:i,pointData:n,location:{x:d,y:h}};i=s[0];var v,x=this.pyrX,w=this.pyrY,n={};for(p=0;p0?{x:e.pageX,y:e.pageY}:!ej.util.isNullOrUndefined(e.originalEvent.pageX)&&e.originalEvent.pageX>0?{x:e.originalEvent.pageX,y:e.originalEvent.pageY}:void 0==e.originalEvent.changedTouches?{x:0,y:0}:!ej.util.isNullOrUndefined(e.originalEvent.changedTouches[0].pageX)&&e.originalEvent.changedTouches[0].pageX>0?{x:e.originalEvent.changedTouches[0].pageX,y:e.originalEvent.changedTouches[0].pageY}:void 0},calMousePosition:function(e){var t,i,s,a=jQuery.uaMatch(navigator.userAgent),n=this.mousePosition(e);return e.pageX=n.x,e.pageY=n.y,s=a.browser.toLowerCase(),t=e.pageX-$(this.svgObject).offset().left,i=e.pageY-$(this.svgObject).offset().top,{X:t,Y:i}},cancelEvent:function(e){e.stopPropagation();var t=jQuery.uaMatch(navigator.userAgent);return"chrome"==t.browser&&(this.model.zooming.enable||this.model.crosshair.visible)&&e.preventDefault(),this.model.enable3D&&(e.preventDefault(),e.stopPropagation()),e.returnValue=!1,e.cancelBubble=!0,!1},resetZoom:function(){var e=this,t="#"+this.svgObject.id;$(".tooltipDiv").remove(),e.zoomed&&($.each(this.model._axes,function(e,t){t.zoomFactor=1,t.zoomPosition=0}),e.model.primaryXAxis.zoomFactor=1,e.model.primaryYAxis.zoomFactor=1,e.model.primaryXAxis.zoomPosition=0,e.model.primaryYAxis.zoomPosition=0,$("#"+e._id+"_canvas").css({cursor:"default"}),$("#"+e._id+"_ResetZoom").remove(),$("#"+e._id+"_PanBtn").remove(),$("#"+e._id+"_ZoomBtn").remove(),$("#"+e._id+"_ZoomInBtn").remove(),$("#"+e._id+"_ZoomOutBtn").remove(),$(t+"_ResetZoom").remove(),$(t+"_PanBtn").remove(),$(t+"_ZoomBtn").remove(),$(t+"_ZoomInBtn").remove(),$(t+"_ZoomOutBtn").remove(),e.zoomed=!1,e.zooming=!1,e.panning=!1,e.resetZooming=!0,e.enableTrackBall(),e.redraw(),e.enableAnimation(),e.svgRenderer._setAttr($(e.svgObject).find(t+"_XAxis,"+t+"_ChartArea,"+t+"_YAxis,"+t+"_SeriesCollection"),{cursor:"default"}))},startZoomInOut:function(e){var t,i,s,a,n,o,r=e.target.id.indexOf("ZoomIn")>-1?"zoomIn":"zoomOut";for(this.drag=!1,this.zoomed=!0,t=this.model.zooming.type.toLowerCase(),i="zoomIn"==r?.2:-.2,o=0;o=1&&(s.zoomFactor=1,s.zoomPosition=0,$(document).find('[id*="ScrollerParent_"]').remove());this.redraw(!0)},startZoom:function(){var e,t=this,i="#"+this.svgObject.id;$(".tooltipDiv").remove(),e=this.model.theme.toLowerCase().indexOf("dark")>=0?"#000000":" #FFFFFF",t.svgRenderer._setAttr($(i+"_ZoomBtn"),{selected:"true"}),t.svgRenderer._setAttr($(i+"_ZoomPath"),{fill:"#14B9FF"}),t.svgRenderer._setAttr($(i+"_ZoomIcon"),{fill:"#FFFFFF"}),t.svgRenderer._setAttr($(i+"_PanPath"),{fill:"#B7B7B7"}),t.svgRenderer._setAttr($(i+"_panIcon"),{fill:e}),$(i+"_ZoomBtn").css({"border-color":"#14B9FF","background-color":"#14B9FF"}),$(i+"_PanBtn").css({"border-color":"#B7B7B7","background-color":"#B7B7B7"}),$("#"+t._id+"_canvas").css({cursor:"default"}),this._cursorToDefault(),t.panning=!1,t.enableTrackBall()},startPan:function(){var e,t=this,i="#"+this.svgObject.id;$(".tooltipDiv").remove(),e=this.model.theme.toLowerCase().indexOf("dark")>=0?"#000000":" #FFFFFF",t.svgRenderer._setAttr($(i+"_ZoomBtn"),{selected:"false"}),t.svgRenderer._setAttr($(i+"_PanBtn"),{selected:"true"}),t.svgRenderer._setAttr($(i+"_ZoomPath"),{fill:"#B7B7B7"}),t.svgRenderer._setAttr($(i+"_ZoomIcon"),{fill:e}),t.svgRenderer._setAttr($(i+"_PanPath"),{fill:"#14B9FF"}),t.svgRenderer._setAttr($(i+"_panIcon"),{fill:"#FFFFFF"}),$(i+"_ZoomBtn").css({"border-color":"#B7B7B7","background-color":"#B7B7B7"}),$(i+"_PanBtn").css({"border-color":"#14B9FF","background-color":"#14B9FF"}),$("#"+t._id+"_canvas").css({cursor:"pointer"}),this._cursorToPointer(),t.panning=!0,t.disableTrackBall()},zoomButton:function(e,t){var i,s,a,n;i="zoom"==t?"_Zoom":"zoomIn"==t?"_ZoomIn":"_ZoomOut";var o=5*e+5,r=this.model.m_AreaBounds.X+(this.model.m_AreaBounds.Width-32*e-o),l=this.model.m_AreaBounds.Y+this.model.m_AreaBounds.Height+(this.model.elementSpacing-this.model.m_AreaBounds.Height),d=this.model.theme.toLowerCase().indexOf("dark")>=0?"#000000":" #FFFFFF",h=this.svgRenderer.createGroup({id:this.svgObject.id+i+"Btn",transform:"translate("+r+","+l+")",selected:"true"}),c={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||"zoomIn"==t||"zoomOut"==t?"#b7b7b7":"#14B9FF",zoomId:this._id+i+"Btn",width:27,height:27,left:r,top:l};"zoom"==t?(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",a=""):"zoomIn"==t?(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",a="translate(7,7) 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",a="translate(7,7) scale(0.6)"),this.model.enableCanvasRendering?(this.svgRenderer.zoomButton(c,t),"zoom"==t?this._on($("#"+this.svgObject.id+i+"Btn"),"touchstart click",this.startZoom):this._on($("#"+this.svgObject.id+i+"Btn"),"touchstart click",this.startZoomInOut)):(this.svgRenderer.drawPath(c,h),n={id:this._id+i+"Icon",d:s,transform:a,fill:this.panning||"zoomIn"==t||"zoomOut"==t?d:"#FFFFFF"},this.svgRenderer.drawPath(n,h),this.svgRenderer.append(h,this.svgObject),"zoom"==t?this._on($(h),"touchstart click",this.startZoom):this._on($(h),"touchstart click",this.startZoomInOut))},panButton:function(e){var t,i=5*e+5,s=this.model.m_AreaBounds.X+(this.model.m_AreaBounds.Width-32*e-i),a=this.model.m_AreaBounds.Y+this.model.m_AreaBounds.Height+(this.model.elementSpacing-this.model.m_AreaBounds.Height),n=this.model.theme.toLowerCase().indexOf("dark")>=0?"#000000":" #FFFFFF",o=this.svgRenderer.createGroup({id:this.svgObject.id+"_PanBtn",transform:"translate("+s+","+a+")",selected:"false"}),r={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:27,height:27,left:s,top:a};this.model.enableCanvasRendering?(this.svgRenderer.panButton(r),this._on($("#"+this.svgObject.id+"_PanBtn"),"touchstart click",this.startPan)):(this.svgRenderer.drawPath(r,o),t={id:this._id+"_panIcon",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",fill:this.panning?"#FFFFFF":n},this.svgRenderer.drawPolygon(t,o),this.svgRenderer.append(o,this.svgObject),this._on($(o),"touchstart click",this.startPan))},resetZoomButton:function(e){var t,i,s,a,n=5*e+5,o=this.model.m_AreaBounds.X+(this.model.m_AreaBounds.Width-(32*e+n)),r=this.model.m_AreaBounds.Y+this.model.m_AreaBounds.Height+(this.model.elementSpacing-this.model.m_AreaBounds.Height),l=this.svgRenderer.createGroup({id:this.svgObject.id+"_ResetZoom",transform:"translate("+o+","+r+")",selected:"false"}),d=this.model.theme.toLowerCase().indexOf("dark")>=0?"#000000":" #FFFFFF",h={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:27,height:27,left:o,top:r};this.model.enableCanvasRendering?(this.svgRenderer.resetZoom(h),this._on($("#"+this.svgObject.id+"_ResetZoom"),"touchstart click",this.resetZoom)):(this.svgRenderer.drawPath(h,l),t={id:this._id+"_ptIcon",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",fill:d},this.svgRenderer.drawPolygon(t,l),i={id:this._id+"_ptIcon1",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",fill:d},this.svgRenderer.drawPolygon(i,l),s={id:this._id+"_ptIcon2",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",fill:d},this.svgRenderer.drawPolygon(s,l),a={id:this._id+"_ptIcon3",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",fill:d},this.svgRenderer.drawPolygon(a,l),this.svgRenderer.append(l,this.svgObject),this._on($(l),"touchstart click",this.resetZoom))},doZoom:function(e,t,i){var s,a,n,o,r,l=this;if(this.model._chartAreaZoom=!0,$(".tooltipDiv").remove(),l.model.enableCanvasRendering)var d=$("#"+this.svgObject.id+"_ZoomArea")[0].getClientRects()[0],h=$("#"+this.svgObject.id)[0].getClientRects()[0],s=d.left-h.left-$(document).scrollLeft(),a=d.top-h.top-$(document).scrollTop();else s=parseFloat(l.svgRenderer._getAttrVal($(e),"x")),a=parseFloat(l.svgRenderer._getAttrVal($(e),"y"));for($("#"+this.svgObject.id+"_ZoomArea").remove(),this.drag=!1,this.zoomed=!0,o=0;o=C[o].xValue&&f.min<=C[o].y&&f.max>=C[o].y&&(v[n]._hiloTypes?"rangearea"==p||"rangecolumn"==p||"waterfall"==p||"hilo"==p?w.push({XValue:C[o].x,High:C[o].high,Low:C[o].low}):w.push({XValue:C[o].x,High:C[o].high,Low:C[o].low,Open:C[o].open,Close:C[o].close}):w.push({XValue:C[o].x,YValue:C[o].y}));0!=w.length&&y.push({selectedData:w}),w=[]}r=$.extend({},ej.EjSvgRender.commonChartEventArgs),r.data={},r.data.series=y,this._trigger("zoomed",r),this.disableAnimation(),this.model.legendCollapsed=!1,this.redraw(!0),this._enableZoomingButtons()},_cursorToDefault:function(){var e="#"+this.svgObject.id;this.svgRenderer._setAttr($(this.svgObject).find(e+"_XAxis,"+e+"_ChartArea,"+e+"_YAxis,"+e+"_SeriesCollection,"+e+"_StriplineBehind,"+e+"_StriplineOver"),{cursor:"default"})},_cursorToPointer:function(){var e="#"+this.svgObject.id;this.svgRenderer._setAttr($(this.svgObject).find(e+"_XAxis,"+e+"_ChartArea,"+e+"_YAxis,"+e+"_SeriesCollection,"+e+"_StriplineBehind,"+e+"_StriplineOver"),{cursor:"pointer"})},removeMultiRect:function(){$(this.parentgEle).empty(),this.model.selectedDataCollection=[]},multiSelectDataCalculation:function(){for(var e,t,i,s,a,n,o,r,l,d,h,c,u,m,p,g,_,f,b,v,x,w,y,C,S,T,D,I=[],k=this.selectedRectIndex,P=this.oldRectX[k],L=this.oldRectY[k],R=this.oldRectWidth[k],M=this.oldRectHeight[k],O=1,E=0,A=this.model.series,j=A.length,N=this.multiAxis,z=N.length,F=this.multiSelectType,B=(this.model.AreaType.toLowerCase(),0);B0)&&(p="logarithmic"==n.valueType?n.visibleRange:n.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,n.isInversed?(g=n.actualRange.max-this.selectPosition*n.actualRange.delta,_=g-this.selectFactor*n.actualRange.delta,y=!0):(g=Math.abs(n.actualRange.min+this.selectPosition*n.actualRange.delta),_=g+this.selectFactor*n.actualRange.delta),gp.max&&(g-=_-p.max,_=p.max),"logarithmic"==n.valueType&&(g=Math.pow(10,g),_=Math.pow(10,_)),n.visibleRange.min=Math.min(g,_),n.visibleRange.max=Math.max(g,_));switch(u=D._visiblePoints,m=D.type.toLowerCase(),S=D.isTransposed,l=D.xAxis.visibleRange.min,d=D.xAxis.visibleRange.max,h=D.yAxis.visibleRange.min,c=D.yAxis.visibleRange.max,ej.util.isNullOrUndefined(I)&&(I=[]),F){case"x":for(i=0;i=0?m.indexOf("stacking")>=0?(C=D.stackedValue.EndValues[i],!f&&c>=C&&h<=C&&I.push(u[i])):"waterfall"==m&&!f&&c>=u[i].YValues[0]&&h<=u[i].YValues[0]?I.push(u[i]):!f&&c>=w&&h<=w&&I.push(u[i]):!f&&d>=x&&l<=x&&I.push(u[i]):S&&m.indexOf("bar")>=0?!f&&l<=x&&d>=x&&I.push(u[i]):m.indexOf("bar")>=0||D.isTransposed&&!(m.indexOf("bar")>=0)?m.indexOf("stacking")>=0?(C=D.stackedValue.EndValues[i],!f&&h<=C&&c>=C&&I.push(u[i])):"waterfall"==m&&!f&&h<=u[i].YValues[0]&&c>=u[i].YValues[0]?I.push(u[i]):!f&&h<=w&&c>=w&&I.push(u[i]):!f&&l<=x&&d>=x&&I.push(u[i]);break;case"y":for(i=0;i=0?!f&&d>=x&&l<=x&&I.push(u[i]):m.indexOf("stacking")>=0?(C=D.stackedValue.EndValues[i],!f&&h<=C&&c>=C&&I.push(u[i])):"waterfall"==m&&!f&&c>=u[i].YValues[0]&&h<=u[i].YValues[0]?I.push(u[i]):!f&&c>=w&&h<=w&&I.push(u[i]):S&&m.indexOf("bar")>=0?m.indexOf("stacking")>=0?(C=D.stackedValue.EndValues[i],!f&&h<=C&&c>=C&&I.push(u[i])):"waterfall"==m&&!f&&h<=u[i].YValues[0]&&c>=u[i].YValues[0]?I.push(u[i]):!f&&h<=w&&c>=w&&I.push(u[i]):m.indexOf("bar")>=0||D.isTransposed&&!(m.indexOf("bar")>=0)?!f&&l<=x&&d>=x&&I.push(u[i]):m.indexOf("stacking")>=0?(C=D.stackedValue.EndValues[i],!f&&h<=C&&c>=C&&I.push(u[i])):"waterfall"==m&&!f&&h<=u[i].YValues[0]&&c>=u[i].YValues[0]?I.push(u[i]):!f&&h<=w&&c>=w&&I.push(u[i]);break;case"xy":for(i=0;i=0?(C=D.stackedValue.EndValues[i],!f&&d>=x&&l<=x&&h<=C&&c>=C&&I.push(u[i])):"waterfall"==m&&!f&&d>=x&&l<=x&&h<=u[i].YValues[0]&&c>=u[i].YValues[0]?I.push(u[i]):!f&&d>=x&&l<=x&&h<=w&&c>=w&&I.push(u[i])}}D.xAxis.visibleRange=b,D.yAxis.visibleRange=v}s=this.currentIndex,ej.util.isNullOrUndefined(this.model.selectedDataCollection)&&(this.model.selectedDataCollection=[]),this.removeRect?this.model.selectedDataCollection.splice(s,1):this.rectPan||this.resize?(this.model.selectedDataCollection[s]=0,this.model.selectedDataCollection[s]=I):this.model.selectedDataCollection[this.model.selectedDataCollection.length]=I,a=$.extend({},ej.EjSvgRender.commonChartEventArgs),a.data={},a.data.selectedData=I,a.data.selectedDataCollection=this.model.selectedDataCollection,this._trigger("rangeSelected",a)},multiSelectMouseUp:function(e){var t,i,s,a,n,o,r,l,d,h;if(this._isMultiSelect&&"range"==this.multiSelectMode){var c,u,m,p=this.svgObject.id,g=this.selectedRectIndex,_="#"+p+"_selectRect",f=parseInt($(_+g).attr("width")),b=parseInt($(_+g).attr("height")),v=parseInt($(_+g).attr("x")),x=parseInt($(_+g).attr("y"));if((this.multiSelectDraw||!this.removeRect||!this.resize||!this.rectPan)&&f>0&&b>0){for(t={id:p+"_resize_rightRect"+g,x:v+f-5,y:x+10,width:10,height:b-20>0?b-20:0,fill:"transparent",stroke:"transparent","stroke-width":2,cursor:"e-resize"},this.svgRenderer.drawRect(t,this.gEle),i={id:p+"_resize_bottomRect"+g,x:v,y:x+b-5,width:f-10>0?f-10:0,height:10,fill:"transparent",stroke:"transparent","stroke-width":2,cursor:"s-resize"},this.svgRenderer.drawRect(i,this.gEle),s={id:p+"_resize_leftRect"+g,x:v-5,y:x,width:10,height:b,fill:"transparent",stroke:"transparent","stroke-width":2,cursor:"w-resize"},this.svgRenderer.drawRect(s,this.gEle),a={id:p+"_resize_topRect"+g,x:v,y:x-5,width:f-10>0?f-10:0,height:10,fill:"transparent",stroke:"transparent","stroke-width":2,cursor:"n-resize"},this.svgRenderer.drawRect(a,this.gEle),n={id:p+"_resize_bottomRightCornerCircle"+g,cx:v+f,cy:x+b,r:10,fill:"transparent",stroke:"transparent","stroke-width":2,cursor:"se-resize"},this.svgRenderer.drawCircle(n,this.gEle),o={id:p+"_closeTopRightCornerCircle"+g,cx:v+f,cy:x,r:10,fill:"white",stroke:"#2988d6","stroke-width":2,cursor:"pointer"},this.svgRenderer.drawCircle(o,this.gEle),r={id:p+"_closePath"+g,x1:v+f-4,y1:x-4,x2:v+f+4,y2:x+4,stroke:"#2988d6","stroke-width":2,cursor:"pointer"},this.svgRenderer.drawLine(r,this.gEle),l={id:p+"_closePathOpposite"+g,x1:v+f+4,y1:x-4,x2:v+f-4,y2:x+4,stroke:"#2988d6","stroke-width":2,cursor:"pointer"},this.svgRenderer.drawLine(l,this.gEle),c=[16,10,4,10,4,4],u=[4,4,4,10,10,16],m=["a","b","c","d","e","f"],d=0;d<6;d++)h={id:p+"_gripCircle_"+m[d]+g,cx:v+f-c[d],cy:x+b-u[d],r:.4,stroke:"#5B5B5B","stroke-width":2},this.svgRenderer.drawCircle(h,this.gripCollection);null!=this.gripCollection&&$(this.gripCollection).appendTo(this.gEle),$("#"+p+"_gripCollection"+g).css({visibility:"hidden"})}ej.util.isNullOrUndefined(this.oldRectX)&&(this.oldRectX=[],this.oldRectY=[],this.oldRectWidth=[],this.oldRectHeight=[],this.oldReRightRectX=[],this.oldReTopRectY=[],this.oldReBottomRectY=[]),this.oldRectX[g]=parseInt($(_+g).attr("x")),this.oldRectY[g]=parseInt($(_+g).attr("y")),this.oldRectWidth[g]=parseInt($(_+g).attr("width")),this.oldRectHeight[g]=parseInt($(_+g).attr("height")),this.oldReRightRectX[g]=parseInt($("#"+p+"_resize_rightRect"+g).attr("x")),this.oldReTopRectY[g]=parseInt($("#"+p+"_resize_topRect"+g).attr("y")),this.oldReBottomRectY[g]=parseInt($("#"+p+"_resize_bottomRect"+g).attr("y")),this.oldMultiSelectType=this.multiSelectType,(this.resize||this.rectPan)&&(this.resize&&$("#"+this.svgObject.id+"_gripCollection"+g).attr({transform:""}),$("#"+p+"_closeTopRightCornerCircle"+g).css({display:"inline"}),$("#"+p+"_closePath"+g).css({display:"inline"}),$("#"+p+"_closePathOpposite"+g).css({display:"inline"}),$("#"+p+"_resize_rightRect"+g).css({cursor:"e-resize"}),$("#"+p+"_resize_leftRect"+g).css({cursor:"w-resize"}),$("#"+p+"_resize_bottomRect"+g).css({cursor:"s-resize"}),$("#"+p+"_resize_topRect"+g).css({cursor:"n-resize"})),this.drag=!1,this.removeRect&&($("#"+p+"_selectedRectGroup"+g).remove(),this.parentgEle.childNodes.length<=0&&$(this.parentgEle).remove()),(this.multiSelectDraw||this.removeRect||this.resize||this.rectPan)&&f>0&&b>0&&(this.multiSelectDraw=!1,this.multiSelectDataCalculation(e)),this.resize&&(this.resize=!1),this.rectPan&&(this.rectPan=!1),this.removeRect=!1,this.enableTrackBall()}},chartMouseUp:function(e){var t,i,s,a,n,o,r,l,d=this.model;if(this._scrollBarEnabled)for(this.model.disableZoom&&this._scrollRedraw(),this._scrollBarEnabled=!1,s=0;s0&&u>0?a.doZoom(n,c,u):this.drag=!1,a.panning||this.enableTrackBall()}o=this.svgObject.id,r=ej.util.isNullOrUndefined(e.target.parentNode)?"":e.target.parentNode.id,(r==o+"_ResetZoom"||r==o+"_ZoomBtn"||e.target.id==o+"_ResetZoom"||e.target.id==o+"_ZoomBtn")&&(this.panning=!1,this.model._chartAreaZoom=!1),(ej.isTouchDevice()||d.zooming.enableDeferredZoom)&&this.panning&&this.doPan&&"cartesianaxes"==d.AreaType&&(l={x:this.oPreviousCoords.x-this.currentPageX,y:this.oPreviousCoords.y-this.currentPageY},this.oPreviousCoords={x:this.currentPageX,y:this.currentPageY},$.each(d._axes,function(e,t){var i=Math.max(1/ej.EjSvgRender.utils._minMax(t.zoomFactor,0,1),1);a.translate(t,l.x,l.y,i)}),this.model.legendCollapsed=!1,this.redraw(!0),this._cursorToPointer(),this._enableZoomingButtons()),this.doPan&&(this.doPan=!1),this.rotateActivate=!1},multiSelectMouseDown:function(evt){var i,matched,k;this.disableTrackBall();var seriesCollection=this.model.series,seriesCollectionLength=seriesCollection.length,id,mouseDownCords,containerSvg=this.svgObject.id,selectMode=seriesCollection.some(function(e){return"range"==e.selectionSettings.mode.toLowerCase()});for(this._isMultiSelect=seriesCollection.some(function(e){return 1==e.selectionSettings.enable}),selectMode&&(this.multiSelectMode="range"),i=0;i=0&&(id=evt.target.id.split("resize")[1].match(/\d+/)[0],this.selectedRectIndex=eval(id),this.multiSelectMouseDownId=evt.target.id,this.resize=!0),evt.target.id.indexOf("close")>=0&&(id=evt.target.id.split("close")[1].match(/\d+/)[0],this.selectedRectIndex=eval(id),this.removeRect=!0),evt.target.id.indexOf(this.svgObject.id+"_selectRect")>=0&&(matchStr=this.svgObject.id+"_selectRect",this.selectedRectIndex=parseInt(evt.target.id.substr(matchStr.length))),evt.target.id==containerSvg+"_selectRect"+this.selectedRectIndex&&(this.rectPan=!0,this.PreviousCoords={X:evt.pageX,Y:evt.pageY}),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;kaxis.Location.X1&&mouseMoveXaxis.Location.Y2&&this.multiAxis.push(axis)}},chartMouseDown:function(e){var t,i,s,a,n,o,r;if(this.cancelEvent(e),t=this.model,i=e.target.classList?e.target.classList[0]:"", i&&(i.indexOf("e-v")||i.indexOf("e-h")))for(this._scrollBarEnabled=!0,this.panning=this.zoomed?this.zoomed:this.panning,n=0;n=d&&l.X=c&&this.multiSelectMouseDown(e),o=this.svgRenderer._getAttrVal($(e.target).parent(),"id"),o==this.svgObject.id+"_ResetZoom"||o==this.svgObject.id+"_PanBtn"||void 0==o||!this.model.zooming.enable||this.model.disableZoom||this.panning||"cartesianaxes"!=this.model.AreaType?(this.panning||"e-hhandle e-box"==$(e.target)[0].className)&&(r=this.calMousePosition(e),this.mousePanX=r.X,this.mousePanY=r.Y,this.mousePanX>=t.m_AreaBounds.X&&this.mousePanX=t.m_AreaBounds.Y&&(this.doPan=!0,this.oPreviousCoords={x:e.pageX,y:e.pageY})):(this.mouseDownX=l.X,this.mouseDownY=l.Y,this.mouseDownX>=this.model.m_AreaBounds.X&&this.mouseDownX=t.m_AreaBounds.Y&&(this.drag=!0,this.disableTrackBall()))}this.model.enable3D&&this.model.enableRotation&&(this.rotateActivate=!0)},chartMouseLeave:function(e){this.cancelEvent(e),$("#"+this.svgObject.id+"_TrackToolTip").hide(),$(".tooltipDiv").hasClass(this.svgObject.id)&&$(".tooltipDiv").remove(),$("[id*=_TrackSymbol]").remove(),this._removeTrackBall(),this._removeHighlight(),$("#"+this._id+"_tooltip").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:e.target.id,pageX:e.pageX,pageY:e.pageY},this._trigger("chartMouseLeave",t)},chartTouchClick:function(e){this.cancelEvent(e),e=e.originalEvent.touches[0],this._doClick(e)},_doClick:function(e){var t,i,s,a,n,o,r,l,d,h,c,u,m,p,g,_,f,b,v,x,w,y,C,S;this._removeHighlight(),this.model._selectedData||(this.model._selectedData=[]),this.model.clusterPoints=[],this.model._isStateChaged=!1;var _,x,T,D,I=(e.target.id,this.svgObject.id,this.model._visibleSeries),k=this.isZoomButtonHovered(e.target);for(targetid=e.target.id,seriesLength=I.length,u=0;u1?(_=p.legendItem.LegendItem.SeriesIndex,f=p.legendItem.LegendItem.TrendLineIndex,ej.util.isNullOrUndefined(f)?(p.series.visibility="visible"===p.series.visibility.toLowerCase()?"hidden":"visible",this.model.series[_].visibility=p.series.visibility,this._notifyArrayChange&&this._notifyArrayChange("series["+_+"]visibility",p.series.visibility)):(b=p.series.trendlines[f].visibility.toLowerCase(),b="visible"===b?"hidden":"visible",this.model.series[_].trendlines[f].visibility=b,this._notifyArrayChange&&this._notifyArrayChange("series["+_+"].trendlines["+f+"].visibility",b))):(v=p.series.visiblePoints[p.legendItem.LegendItem.PointIndex]._visibility,x=p.series.visiblePoints[p.legendItem.LegendItem.PointIndex].actualIndex,p.series.points[x]._visibility="visible"===v?"hidden":"visible"),this.model.enableCanvasRendering&&(w=document.getElementById(this._id).getClientRects()[0],this.svgRenderer.ctx.clearRect(0,0,w.width,w.height),$("#"+this._id).find('[id*="canvas_symbol"]').remove()),$(this.svgObject).empty(),$(this.legendSvgContainer).empty(),y=0;y=0){var E=targetid.lastIndexOf("_"),A=targetid.substr(E+1,targetid.length),j=parseInt(A),S=$.extend({},ej.EjSvgRender.commonChartEventArgs);S.data={location:{x:this.mousemoveX,y:this.mousemoveY},contentData:this.model.annotations[j],pageX:e.pageX,pageY:e.pageY},this._trigger("annotationClick",S)}s=!ej.isNullOrUndefined(_)&&this.model._visibleSeries[_].selectionSettings.enable,ej.isNullOrUndefined(_)||p||!s||(t="multiple"==I[_].selectionSettings._currentType.toLowerCase(),i=I[_].selectionSettings.mode,"range"!=i.toLowerCase()&&this.segmentSelection(e,p,_,x,D,I)),S=$.extend({},ej.EjSvgRender.commonChartEventArgs),S.data={location:{x:this.mousemoveX,y:this.mousemoveY},size:{height:this.model.svgHeight,width:this.model.svgWidth},id:targetid,pageX:e.pageX,pageY:e.pageY},this._trigger("chartClick",S)},getTargetId:function(e,t,i){var s,a=this.model._visibleSeries[e].type.toLowerCase(),n=a.indexOf("area")!=-1||a.indexOf("line")!=-1||a.indexOf("scatter")!=-1;return this.model.enable3D?$("[id*=_Region_Series_"+e+"_Point_"+t+"]").each(function(){s=this.id}):"series"!=i||"none"==this.model.AreaType?n?$("[id*="+this.svgObject.id+"_Series"+e+"_Point"+t+"_symbol]").each(function(){s=this.id}):$("#"+this.svgObject.id+"_Series"+e+"_Point"+t).each(function(){s=this.id}):$("[id*="+this.svgObject.id+"_Series"+e+"]").each(function(){s=this.id}),s},findCanvasSelection:function(e,t,i){var s;return s="point"==i?$("#"+this._id+"_Selection_series"+e+"_point_"+t+"_canvas").length:"series"==i?$("#"+this._id+"_Selection_series"+e+"_canvas").length:$("#"+this._id+"_Selection_Cluster_point_"+t+"_canvas").length,1==s},segmentSelection:function(e,t,i,s,a){var n,o,r,l,d,h,a,c,u,m,p,g,_,f,b,v,x,w,y,C,S,T,D,I=this.model._visibleSeries,k=I[i],P=k.selectionSettings,L=(P.enable,"multiple"==P._currentType.toLowerCase()),R=P.mode,M=!1,O=this;if(!ej.isNullOrUndefined(s)&&"cluster"==R){for(f=[],x=I[i]._visiblePoints[s].xValue,w=0,y=I.length;w=0||o.indexOf(this.svgObject.id+"_symbolGroup")>=0,o.indexOf(this.svgObject.id+"_TrackSymbol_")>=0&&(l=!0,M=!0)))),this.model.enableCanvasRendering?r=this.findCanvasSelection(i,s,R):(_=$("#"+n).attr("class")?$("#"+n).attr("class"):"",r=_.indexOf("Selection")!=-1,this.model.enable3D&&(_=$("[id*=_Region_Series_"+i+"_Point_"+s+"]").attr("class")?$("[id*=_Region_Series_"+i+"_Point_"+s+"]").attr("class"):"",r=_.indexOf("Selection")!=-1)),(r||!L||L)&&(this.removeSelection(i,s,I,R,L,t,r),a=this.model._selectedData,c=a.length,c>0&&!this.model._isStateChaged))if(L){if(r)for(T=0;T0)if(L)this.model._selectedData.push({event:e,legendData:t,SeriesIndex:i,PointIndex:s,data:a});else{for(T=0;T=d.x||0==a.X)&&(a.Y+d.y>=d.y||0==a.Y)?this.model.crosshair.visible||"bubble"==r||"scatter"==r?($("#"+this.svgObject.id+"_TrackSymbol_"+t+"_"+i).remove(),n="canvas_trackSymbol_"+t+"_"+i,$("#"+this._id).find("[id*="+n+"]").remove(),o={"clip-path":"url(#"+this.svgObject.id+"_TrackSymbolClipRect_"+t+"_"+i+")",id:this.svgObject.id+"_TrackSymbol_"+t+"_"+i,transform:"translate("+d.x+","+d.y+")"},this.gTrackerEle=this.svgRenderer.createGroup(o)):this.gTrackerEle=null:($("#"+this.svgObject.id+"_TrackSymbol_"+t+"_"+i).remove(),o={id:this.svgObject.id+"_TrackSymbol_"+t+"_"+i},this.gTrackerEle=this.svgRenderer.createGroup(o),this.model.enableCanvasRendering||("polaraxes"==this.model.AreaType?this.gTrackerEle.setAttribute("clip-path","url(#"+this.svgObject.id+"_SeriesGroup_"+t+"_ClipRect)"):(this.gTrackerEle.setAttribute("clip-path","url(#"+this.svgObject.id+"_TrackSymbolClipRect_"+t+")"),this.gTrackerEle.setAttribute("transform","translate("+d.x+","+d.y+")")))),this.model.crosshair.marker.visible&&!e.isIndicator&&e._visiblePoints[i].visible&&l.drawSymbol(t,e,i,a.X,a.Y,this,s),this.gTrackerEle&&$("#"+this.gTrackerEle.id).length<1&&this.svgRenderer.append(this.gTrackerEle,this.svgObject))},getClosesPointXY:function(e,t,i,s,a){var n,o,r,l,d,h,c,u,m,p=ej.EjSvgRender.utils._getTransform(i.xAxis,i.yAxis,this.model.requireInvertedAxes),g=i._visiblePoints?i._visiblePoints.length:0,_=i.marker?i.marker.size:{height:6,width:6};if(a<=p.y+p.height&&p.y<=a&&p.x<=s&&s<=p.x+p.width)for(m=0;ml.X+p.x-_.width/2&&sl.Y+p.y-_.height/2&&a=a-.5&&t<=n+.5)for(i=0;i"),$(document.body).append(r),$(".tooltipDiv").addClass(this.svgObject.id)):($(".tooltipDiv").css("display","block"),this.tooltipFirst=!1),null!=i.tooltip.template?(l=$("#"+i.tooltip.template).clone(),$(".tooltipDiv")[0].innerHTML="",$(l).css("display","block").appendTo(r),i.count=1,g.count=1,d=this.getSeriesColor(g,e.SeriesIndex,i),d?$(r).css("background-color","array"==jQuery.type(d)?d[0].color:d):$(r).css("background-color",this.model.pointColors[e.Region.PointIndex]),h={series:i,point:g},ej.util.isNullOrUndefined(o.data.currentText)?$(r).html($(r).html().parseTemplate(h)):$(r).html(o.data.currentText)):$(r).html(o.data.ToolTip);var f=this.model.m_AreaBounds,b=t.pageX+_,v=t.pageY+_,x=$(r).width(),w=($(r).height(),document.getElementById(this.svgObject.id).getClientRects()[0]);(void 0===b||null===b)&&(b=t.pageX+_),(void 0===v||null===v)&&(v=t.pageY+_),$(r).css("left",b),$(r).css("top",v),c=$(r)[0].getBoundingClientRect(),c.right>f.X+f.Width+w.left&&(u=b-x,$(r).css("left",u+$(document).scrollLeft())),c.bottom>f.Y+f.Height+w.top&&(u=c.bottom-(f.Y+f.Height+w.top),$(r).css("top",c.top-u+$(document).scrollTop())),m=i.tooltip,m.enableAnimation&&$(r).css({"transition-property":"left,top","-moz-transition-property":"left,top","-webkit-transition-property":"left,top","-o-transition-property":"left,top","transition-duration":m.duration,"-moz-transition-duration":m.duration,"-webkit-transition-duration":this.tooltipFirst?"0s":m.duration,"-o-transition-duration":m.duration}),c=$(r)[0].getBoundingClientRect(),c.top1&&("series"==S||s))for(p=0,g=e.model.chartRegions.length;p1)for(l=0;l0)for(y=j[0].Region.length,l=0;l1))if(E=i._visiblePoints,ctx=this.createCanvasElement(e._id+"_Selection_series"+z+"_canvas",e.svgWidth,e.svgHeight,M),S="none"==k||""==k?F:this.canvasPattern(ctx,e,t,F,r),this.createRect(e,ctx),R.indexOf("column")!=-1||R.indexOf("bar")!=-1)for(l=0;l0?(O.push(u[0]),E.push(C[u[0].SeriesIndex]._visiblePoints[n])):E.push(C[p]._visiblePoints[n]);for(this.selectedPoint=n,g=[],_=[],ctx=this.createCanvasElement(e._id+"_Selection_Cluster_point_"+n+"_canvas",e.svgWidth,e.svgHeight,M),this.createRect(e,ctx),l=0,len=C.length;l1?e.model.pointColors[u]:e.model.pointColors[i],c={opacity:s,stroke:a,lineWidth:n,color:o,x:r[u].StartX,y:r[u].StartY,radius:e.model.circularRadius[r[u].SeriesIndex],innerRadius:e.model.innerRadius[r[u].SeriesIndex],startAngle:r[u].StartAngle,endAngle:r[u].EndAngle,type:l},this.highlightSegment(d,c)},canvasHighlightMarker:function(e,t,i,s,a,n,o){var r,l,d,h,c,u=s,m=u.pattern.toLowerCase(),p=t.type.toLowerCase(),g={},_=""!=u.color?u.color:e.model.seriesColors[t.seriesIndex];for(color="none"==m||""==m?_:this.canvasPattern(a,e,n,_,u),g.Style={},g.Style.BorderColor=u.border.color,g.Style.Opacity=u.opacity,g.Style.BorderWidth=u.border.width,c=0;c1?e.model.legendRegion[t.seriesIndex]:e.model.legendRegion[t.pointIndex];var d={startX:legendRegion.Bounds.LegendBound.X+legendRegion.Location.startX,startY:legendRegion.Bounds.LegendBound.Y+legendRegion.Location.startY},h={svgRenderer:e.svgRenderer,svgObject:e.svgObject},c={SeriesIndex:r, Style:{Color:n,Opacity:i.opacity,Visibility:!0,BorderWidth:0,BorderColor:n},context:!0,ShapeSize:legendRegion.Style.ShapeSize};"seriestype"==legendRegion.SymbolShape.toLowerCase()?(e.legendItem=legendRegion.LegendItem,ej.EjSvgRender.chartSymbol["_draw"+legendRegion.SymbolShape](d,c,e)):ej.EjSvgRender.chartSymbol["_draw"+legendRegion.SymbolShape](d,c,h,legendCtx)}},createCanvasElement:function(e,t,i,s){svgObj=document.createElement("canvas"),_rootId=jQuery(this.element).attr("id"),svgObj.setAttribute("id",e),svgObj.height=i,svgObj.width=t,this.svgRenderer.append(svgObj,this.element);var a=document.getElementById(e);return a.style.left=s.left+$(document).scrollLeft()+"px",a.style.top=s.top+$(document).scrollTop()+"px",a.style.position="absolute",svgObj.getContext("2d")},highlightSegment:function(e,t){e.save(),e.beginPath(),"pie"==t.type?(e.moveTo(t.x,t.y),e.arc(t.x,t.y,t.radius,t.startAngle-1.57,t.endAngle-1.57,!1)):(e.arc(t.x,t.y,t.radius,t.startAngle-1.57,t.endAngle-1.57,!1),e.arc(t.x,t.y,t.innerRadius,t.endAngle-1.57,t.startAngle-1.57,!0)),e.fillStyle=t.color,e.globalAlpha=t.opacity,e.fill(),e.lineWidth=t.lineWidth,e.strokeStyle=t.stroke,e.clip(),e.stroke(),e.closePath(),e.restore()},canvasPattern:function(e,t,i,s,a){var n=a,o=(n.name,n.pattern.toLowerCase()),r=s,l=n.opacity,d=(n.border.color,n.border.width,document.createElement("canvas")),h=d.getContext("2d"),c=[];switch(o){case"chessboard":c[0]={x:0,y:0,width:10,height:10,fill:"white",stroke:"white",opacity:l,name:"rect"},c[1]={x:0,y:0,width:5,height:5,fill:r,opacity:l,name:"rect"},c[2]={x:5,y:5,width:5,height:5,fill:r,opacity:l,name:"rect"},d.width=10,d.height=10,this.loadPattern(t,c,"",h);break;case"pacman":c[0]={name:"rect",x:0,y:0,width:18,height:18,transform:"translate(0,0)",fill:"white",opacity:l},c[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:r,fill:r},d.width=18,d.height=18,this.loadPattern(t,c,"",h);break;case"crosshatch":c[0]={x:0,y:0,width:8,height:8,fill:"white",stroke:s,opacity:l,name:"rect"},c[1]={d:"M 0 0 L 8 8 Z","stroke-width":1,stroke:r,name:"path"},c[2]={d:"M 8 0 L 0 8 Z","stroke-width":1,stroke:r,name:"path"},d.width=8,d.height=8,this.loadPattern(t,c,"",h);break;case"dots":c[0]={x:0,y:0,width:7,height:7,transform:"translate(0,0)",fill:"white",opacity:l,name:"rect"},c[1]={cx:3,cy:3,r:2,"stroke-width":1,fill:r,name:"circle"},d.width=7,d.height=7,this.loadPattern(t,c,"",h);break;case"diagonalforward":c[0]={x:0,y:0,width:6,height:6,fill:"white",stroke:s,opacity:l,name:"rect"},c[1]={d:"M 3 -3 L 9 3 M 6 6 L 0 0 M 3 9 L -3 3","stroke-width":2,stroke:r,name:"path"},d.width=6,d.height=6,this.loadPattern(t,c,"",h);break;case"diagonalbackward":c[0]={x:0,y:0,width:6,height:6,"stroke-width":2,fill:"white",stroke:s,opacity:l,name:"rect"},c[1]={d:"M 3 -3 L -3 3 M 0 6 L 6 0 M 9 3 L 3 9","stroke-width":2,stroke:r,name:"path"},d.width=6,d.height=6,this.loadPattern(t,c,"",h);break;case"grid":c[0]={name:"rect",x:0,y:0,width:6,height:6,transform:"translate(0,0)",fill:"white",opacity:l},c[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:r},d.width=6,d.height=6,this.loadPattern(t,c,"",h);break;case"turquoise":c[0]={name:"rect",x:0,y:0,width:17,height:17,transform:"translate(0,0)",fill:"white",opacity:l},c[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:r,fill:r},c[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:r,fill:r},c[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:r,fill:r},c[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:r,fill:r},c[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:r,fill:r},c[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:r,fill:r},c[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:r,fill:r},d.width=17,d.height=17,this.loadPattern(t,c,"",h);break;case"star":c[0]={name:"rect",x:0,y:0,width:21,height:21,transform:"translate(0,0)",fill:"white",opacity:l},c[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:r,fill:r},d.width=21,d.height=21,this.loadPattern(t,c,"",h);break;case"triangle":c[0]={name:"rect",x:0,y:0,width:10,height:10,fill:"white",opacity:l},c[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:r,fill:r},d.width=10,d.height=10,this.loadPattern(t,c,"",h);break;case"circle":c[0]={name:"rect",x:0,y:0,width:9,height:9,transform:"translate(0,0)",fill:"white",opacity:l},c[1]={name:"circle",cx:5.125,cy:3.875,r:3.625,"stroke-width":1,fill:r},d.width=9,d.height=9,this.loadPattern(t,c,"",h);break;case"tile":c[0]={name:"rect",x:0,y:0,width:18,height:18,transform:"translate(0,0)",fill:"white",opacity:l},c[1]={name:"path",d:"M 0 9 L 0 0 L 9 0 z","stroke-width":1,stroke:r,fill:r},c[2]={name:"path",d:"M 9 9 L 9 0 L 18 0 z","stroke-width":1,stroke:r,fill:r},c[3]={name:"path",d:"M 0 18 L 0 9 L 9 9 z","stroke-width":1,stroke:r,fill:r},c[4]={name:"path",d:"M 9 18 L 9 9 L 18 9 z","stroke-width":1,stroke:r,fill:r},d.width=18,d.height=18,this.loadPattern(t,c,"",h);break;case"horizontaldash":c[0]={name:"rect",x:0,y:0,width:12,height:12,transform:"translate(0,0)",fill:"white",opacity:l},c[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:r,fill:r},d.width=12,d.height=12,this.loadPattern(t,c,"",h);break;case"verticaldash":c[0]={name:"rect",x:0,y:0,width:12,height:12,transform:"translate(0,0)",fill:"white",opacity:l},c[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:r,fill:r},d.width=12,d.height=12,this.loadPattern(t,c,"",h);break;case"rectangle":c[0]={x:0,y:0,name:"rect",width:12,height:12,fill:"white",opacity:l},c[1]={name:"rect",x:1,y:2,width:4,height:9,fill:r,opacity:l},c[2]={name:"rect",x:7,y:2,width:4,height:9,fill:r,opacity:l},d.width=12,d.height=12,this.loadPattern(t,c,"",h);break;case"box":c[0]={x:0,y:0,name:"rect",width:13,height:13,fill:"white",opacity:l},c[1]={name:"rect",x:1.5,y:1.5,width:10,height:9,fill:r,opacity:l},d.width=10,d.height=10,this.loadPattern(t,c,"",h);break;case"horizontalstripe":c[0]={name:"rect",x:0,y:0,width:10,height:12,transform:"translate(0,0)",fill:"white",opacity:l},c[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:r,fill:r},d.width=10,d.height=12,this.loadPattern(t,c,"",h);break;case"verticalstripe":c[0]={name:"rect",x:0,y:0,width:12,height:10,transform:"translate(0,0)",fill:"white",opacity:l},c[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:r,fill:r},d.width=12,d.height=10,this.loadPattern(t,c,"",h);break;case"bubble":c[0]={name:"rect",x:0,y:0,width:20,height:20,transform:"translate(0,0)",fill:"#ffffff",opacity:l},c[1]={name:"circle",cx:5.217,cy:11.325,r:3.429,"stroke-width":1,fill:"#D0A6D1"},c[2]={name:"circle",cx:13.328,cy:6.24,r:4.884,"stroke-width":1,fill:r},c[3]={name:"circle",cx:13.277,cy:14.66,r:3.018,"stroke-width":1,fill:"#D0A6D1"},d.width=20,d.height=20,this.loadPattern(t,c,"",h);break;case"custom":d=document.getElementById(n.customPattern)}return e.createPattern(d,"repeat")},foundClasses:function(e){var t=[];return $("[id*="+e+"]").each(function(){var e=$(this).attr("class")?$(this).attr("class"):"";e.indexOf("Selection")>=0&&t.push(e)}),t},selection:function(e,t,i,s,a,n,o,r,l,d){var h,c,u,m,p,g,_,f,b,v,x,w,y,C,S=this.model.clusterPoints,T=(S?S.length:0,this.model._visibleSeries),D=T.length,I="none"==this.model.AreaType&&1==D?o:n,P=i.selectionSettings,L=("multiple"==this.model._visibleSeries[n].selectionSettings._currentType.toLowerCase(),"series"+n),R=!1,M=($("#"+l).attr("name"),P.pattern.toLowerCase()),O=P.mode;if(r&&(h=r.indexOf(this.svgObject.id+"_SeriesGroup_")>=0||r.indexOf(this.svgObject.id+"_Chart3D")>=0),("none"!=this.model.AreaType||"none"==this.model.AreaType&&"series"==O&&D>1)&&$("style").each(function(){$(this).html().indexOf(".SelectionStyle"+L)>-1&&(R=!0)}),!e.vmlRendering&&this.model.enable3D)"series"!=O&&!a||"none"==this.model.AreaType&&("none"!=this.model.AreaType||1==D)?"cluster"==O&&"none"!=e.model.AreaType?this.highlightCluster(e,n,o,"Selection",L,P,t,d):"none"==this.model.AreaType?(this.highlightPoint(e,n,o,"Selection",L+I,P,t,d),$("#"+this.svgObject.id+"_LegendItemShape"+I).attr("class","Selection"+L+I+"Style"+L+I+"1")):(this.highlightPoint(e,n,o,"Selection",L,P,t,d),$("#"+this.svgObject.id+"_LegendItemShape"+I).attr("class","Selection"+L+"Style"+L+"1")):(this.highlightSeries(e,n,o,"Selection",L,P,t,a,d),$("#"+this.svgObject.id+"_LegendItemShape"+I).attr("class","Selection"+L+"Style"+L+"1"));else{if("cluster"!=O||a||"none"==e.model.AreaType){p={},p.name="2D",p.index="none"==this.model.AreaType?I:n,p.api="Selection",p.color=""!=P.color?P.color:a?"none"==this.model.AreaType?this.model.pointColors[I]:this.model.seriesColors[I]:$("#"+l).attr("fill"),"[object Array]"===Object.prototype.toString.call(p.color)&&(p.color=p.color[1].color);var f="none"==M||e.vmlRendering||""==M?P.color:this.pattern(e,t,p,P),g=P.opacity,_=P.border.color,b=P.border.width;R||("none"==this.model.AreaType&&("series"==O||a&&1==D||"series"!=O&&!a)?($("style").each(function(){$(this).html().indexOf(".SelectionStyle"+L+"Point"+I)>-1&&(R=!0)}),R||(this.createStyle(e,"Selection",L+"Point"+I,g,f,_,b),this.createStyle(e,"SelectionLegend",L+"Point"+I,g,f,"transparent",0))):("none"==this.model.AreaType&&D>1||"none"!=this.model.AreaType)&&(this.createStyle(e,"Selection",L,g,f,_,b),this.createStyle(e,"SelectionLegend",L,g,f,"transparent",0)))}if(("series"==O||a)&&("none"==e.model.AreaType&&D>1||"none"!=e.model.AreaType)){if(!h)for(c=$("#"+r).childNodes?$("#"+r).childNodes:[],u=0;u=0&&(v=this.GetSeriesPoint(t),o=v.region.Region.PointIndex),k=0;k-1&&(x=!0)}),x||(this.createStyle(e,"Selection",L,g,f,_,b),this.createStyle(e,"SelectionLegend",L,g,f,"transparent",0)),y=$("#"+m+S[k].seriesIndex+"_Point"+S[k].pointIndex).attr("name")?"SelectionPathStyle"+L:"SelectionStyle"+L,$("#"+m+S[k].seriesIndex+"_Point"+S[k].pointIndex).attr("class",y),$("#"+m+S[k].seriesIndex+"_Point"+S[k].pointIndex+"_symbol").attr("class",y),"hidden"!=e.model._visibleSeries[w].visibility&&$("#"+this.svgObject.id+"_LegendItemShape"+k).not("[class*='Highlight']").attr("class","SelectionLegendStyle"+L)}s&&($("#"+this.svgObject.id+"_Series"+k+"_Point"+o).attr("class","SelectionStyle"+L),$("#"+this.svgObject.id+"_Series"+k+"_Point"+o+"_symbol").attr("class","SelectionStyle"+L),$("#"+r).remove())}else $("#"+l).attr("name")||l==e.svgObject.id+"_Series"+I||"none"==e.model.AreaType?($("#"+l).attr("class","SelectionStyle"+L+"Point"+I),$("#"+this.svgObject.id+"_LegendItemShape"+I).attr("class","SelectionLegendStyle"+L+"Point"+I),s&&$("#"+r).remove()):($("#"+l).attr("class","SelectionStyle"+L),$("#"+this.svgObject.id+"_LegendItemShape"+I).attr("class","SelectionLegendStyle"+L),$("#"+l+"_symbol").attr("class","SelectionStyle"+L),s&&($("#"+l+"_symbol").attr("class","SelectionStyle"+L),$("#"+r).remove())),C=$("#"+l).attr("name"),void 0!=C&&("candle"==C||C.indexOf("hilo")>=0)&&($("[id*="+l+"]").attr("class","SelectionStyle"+L),$("#"+this.svgObject.id+"_LegendItemShape"+I).attr("class","SelectionLegendStyle"+L))}},removeSelection:function(e,t,s,a,n,o,r){var l,d=s.length,h=this.model.clusterPoints,c=h?h.length:0;if(("series"==a||o)&&("none"!=this.model.AreaType||"none"==this.model.AreaType&&d>1))for(i=0;i1?$("#"+this.svgObject.id+"_LegendItemShape"+e).attr("class",""):$("#"+this.svgObject.id+"_LegendItemShape"+t).attr("class",""),this.model._visibleSeries.length>1?$("#"+this._id+"_Selection_Legend"+e+"_canvas").remove():$("#"+this._id+"_Selection_Legend"+t+"_canvas").remove()):($("[id*="+this._id+"_Selection_series]").remove(),$("[id*="+this._id+"_Selection_Legend]").remove(),$("[id*=_Region_Series_"+e+"_Point_]").attr("class",""),$("[id*="+this.svgObject.id+"_Series"+e+"_Point]").attr("class",""),this.model._visibleSeries.length>1?$("[id*="+this.svgObject.id+"_LegendItemShape"+e+"]").attr("class",""):$("[id*="+this.svgObject.id+"_LegendItemShape]").attr("class","")))},createStyle:function(e,t,i,s,a,n,o){var r,l,d,h;e.vmlRendering?(r=document.createElement("style"),r.id=t+"Segment",s*=100,l="."+t+"Style"+i+" {filter: alpha(opacity="+s+");}."+t+"PathStyle"+i+" {filter: alpha(opacity="+s+");}",r.setAttribute("type","text/css"),r.styleSheet?r.styleSheet.cssText=l:(d=document.createTextNode(l),r.appendChild(d)),h=document.getElementsByTagName("head")[0],h.appendChild(r)):($("").appendTo("body"),$("").appendTo("body"))},highlightPoint:function(e,t,i,s,a,n,o){for(var r,l,d,h="_Region_Series_"+t+"_Point_"+i,c=$(this.svgObject).find("[id$="+h+"],[id*="+h+"back],[id*="+h+"front]"),u=0;u=0||C.indexOf(this.svgObject.id+"_Chart3D")>=0,T=($("#"+y).attr("name"),f.pattern.toLowerCase()),D=e.model._visibleSeries.length;if("none"==e.model.AreaType&&1==D&&(e.model.enable3D?w=s?s.legendItem.LegendItem.PointIndex:_.region.Region.PointIndex:(a=s?this.svgObject.id+"_LegendItemShape":this.svgObject.id+"_Series"+b+"_Point",n=s?this.svgObject.id+"_LegendItemShape"+s.legendItem.LegendItem.PointIndex:y,pointIndex=n.substr(a.length),w=pointIndex)),$("style").each(function(){$(this).html().indexOf(".HighlightStyle"+v)>-1&&(x=!0)}),e.model.enable3D&&!e.vmlRendering)"series"!=f.mode&&!s||("none"!=e.model.AreaType||1==D)&&"none"==e.model.AreaType?"cluster"==f.mode&&"none"!=e.model.AreaType?this.highlightCluster(e,b,_.pointData.pointIndex,"Highlight",v,f,t):(pointIndex=_?_.pointData.pointIndex:w,this.highlightPoint(e,b,pointIndex,"Highlight",v+pointIndex,f,t),$("#"+this.svgObject.id+"_LegendItemShape"+w).not("[class*='Selection']").attr("class","Highlight"+v+pointIndex+"Style"+v+pointIndex+"1")):(this.highlightSeries(e,b,w,"Highlight",v,f,t,s),$("#"+this.svgObject.id+"_LegendItemShape"+w).not("[class*='Selection']").attr("class","Highlight"+v+"Style"+v+"1"));else{if(f.mode||"none"==this.model.AreaType){o={},o.name="2D",o.index=b,o.api="Highlight",o.color=""!=f.color?f.color:s?"none"==this.model.AreaType?this.model.pointColors[w]:this.model.seriesColors[w]:$("#"+y).attr("fill"),"[object Array]"===Object.prototype.toString.call(o.color)&&(o.color=o.color[1].color);var I="none"==T||e.vmlRendering||""==T?f.color:this.pattern(e,t,o,f),P=f.opacity,L=f.border.color,R=f.border.width;x||(this.createStyle(e,"Highlight",v,P,I,L,R),this.createStyle(e,"HighlightLegend",v,P,I,"transparent",0))}if(r=s?$("#"+this.svgObject.id+"_LegendItemShape"+w).attr("class"):$("#"+y).attr("class"),r=r?r:"",r.indexOf("Selection")==-1)if("series"!=f.mode&&!s||("none"!=e.model.AreaType||1==D)&&"none"==e.model.AreaType)if("cluster"==f.mode&&"none"!=e.model.AreaType&&_){for(l=this.svgObject.id+"_Series",d=[],w=y.match(/(\d+)/g),pointIndex=parseInt(w[w.length-1]),c=e.model._visibleSeries[b]._visiblePoints[pointIndex].xValue,u=0,m=e.model._visibleSeries.length;u=0)&&($("[id*="+y+"]").attr("class","HighlightStyle"+v),$("#"+this.svgObject.id+"_LegendItemShape"+w).not("[class*='Selection']").attr("class","HighlightLegendStyle"+v));else $("[id*="+this.svgObject.id+"_Series"+w+"]").each(function(){if(this.parentNode.id==e.svgObject.id+"_SeriesGroup_"+w||this.parentNode.id==e.svgObject.id+"_symbolGroup_"+w){var t=$(this).attr("class"),i=$(this).attr("name")?"HighlightPathStyle"+v:"HighlightStyle"+v;t!="SelectionStyle"+v&&t!="SelectionStyleClusterSeries"+b&&t!="SelectionPathStyle"+v&&C.indexOf(e.svgObject.id+"_symbolGroup_"+w)<=0&&$(this).attr("class",i)}}),$("#"+this.svgObject.id+"_LegendItemShape"+w).not("[class*='Selection']").attr("class","HighlightLegendStyle"+v)}},dStyle:function(e,t,i,s,a){var n,o,r=ej.Ej3DRender.prototype.polygon3D.prototype,l=a,d=e.api,h=e.seriesName,c=l.opacity;return t=i.colorNameToHex(t),t="XLight"==e.name?r.applyXLight(t,i):"ZLight"==e.name?r.applyZLight(t,i):t,n={},n.name=e.name,n.color=t,n.api=d,t="none"==l.pattern?t:this.pattern(i,s,n,l),document.getElementById(d+"Segment"+h)?(o=document.getElementById(d+"Segment"+h),o.innerHTML=o.innerHTML+"."+d+"Style"+h+e.index+" { fill:"+t+";opacity:"+c+" }"):(o=document.createElement("style"),o.id=d+"Segment"+h,o.type="text/css",o.innerHTML="."+d+"Style"+h+e.index+" { fill:"+t+";opacity:"+c+" }",document.getElementsByTagName("head")[0].appendChild(o)),d+"Style"+h+e.index},pattern:function(e,t,i,s){var a,n,o,r,l,d=s,h=i.api,c=d.pattern.toLowerCase(),u=i.color,m=""!=d.opacity?d.opacity:$("#"+t.target.id).attr("opacity"),p="#ffffff";switch(document.getElementById(h+"Def")?n=$("#"+h+"Def")[0]:(a={id:h+"Def"},n=e.svgRenderer.createPattern(a,"svg"),e.svgRenderer.append(n,e.svgObject)),e.model.enable3D&&(p="XLight"==i.name?"#595959":"ZLight"==i.name?"#737373":"#808080"),"#"+c+"_"+h+"_"+i.name+"_"+i.index&&$("#"+c+"_"+h+"_"+i.name+"_"+i.index).remove(),o=[],c){case"chessboard":return r={id:c+"_"+h+"_"+i.name+"_"+i.index,patternUnits:"userSpaceOnUse",x:0,y:0,width:10,height:10},l=e.svgRenderer.createPattern(r,"pattern"),o[0]={x:0,y:0,width:10,height:10,fill:p,opacity:m,name:"rect"},o[1]={x:0,y:0,width:5,height:5,fill:u,opacity:m,name:"rect"},o[2]={x:5,y:5,width:5,height:5,fill:u,opacity:m,name:"rect"},this.loadPattern(e,o,l),n.appendChild(l),"url(#"+c+"_"+h+"_"+i.name+"_"+i.index+")";case"pacman":return r={id:c+"_"+h+"_"+i.name+"_"+i.index,patternUnits:"userSpaceOnUse",width:"17.917",height:"18.384"},l=e.svgRenderer.createPattern(r,"pattern"),o[0]={name:"rect",x:0,y:0,width:17.917,height:18.384,transform:"translate(0,0)",fill:p,opacity:m},o[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:u,fill:u},this.loadPattern(e,o,l),n.appendChild(l),"url(#"+c+"_"+h+"_"+i.name+"_"+i.index+")";case"crosshatch":return r={id:c+"_"+h+"_"+i.name+"_"+i.index,patternUnits:"userSpaceOnUse",width:"8",height:"8"},l=e.svgRenderer.createPattern(r,"pattern"),o[0]={x:0,y:0,width:8,height:8,transform:"translate(0,0)",fill:p,opacity:m,name:"rect"},o[1]={d:"M0 0L8 8ZM8 0L0 8Z","stroke-width":1,stroke:u,name:"path"},this.loadPattern(e,o,l),n.appendChild(l),"url(#"+c+"_"+h+"_"+i.name+"_"+i.index+")";case"dots":return r={id:c+"_"+h+"_"+i.name+"_"+i.index,patternUnits:"userSpaceOnUse",width:"6",height:"6"},l=e.svgRenderer.createPattern(r,"pattern"),o[0]={x:0,y:0,width:7,height:7,transform:"translate(0,0)",fill:p,opacity:m,name:"rect"},o[1]={cx:3,cy:3,r:2,"stroke-width":1,fill:u,name:"circle"},this.loadPattern(e,o,l),n.appendChild(l),"url(#"+c+"_"+h+"_"+i.name+"_"+i.index+")";case"diagonalforward":return r={id:c+"_"+h+"_"+i.name+"_"+i.index,patternUnits:"userSpaceOnUse",width:"6",height:"6"},l=e.svgRenderer.createPattern(r,"pattern"),o[0]={x:0,y:0,width:6,height:6,transform:"translate(0,0)",fill:p,opacity:m,name:"rect"},o[1]={d:"M 3 -3 L 9 3 M 6 6 L 0 0 M 3 9 L -3 3","stroke-width":2,stroke:u,name:"path"},this.loadPattern(e,o,l),n.appendChild(l),"url(#"+c+"_"+h+"_"+i.name+"_"+i.index+")";case"diagonalbackward":return r={id:c+"_"+h+"_"+i.name+"_"+i.index,patternUnits:"userSpaceOnUse",width:"6",height:"6"},l=e.svgRenderer.createPattern(r,"pattern"),o[0]={x:0,y:0,width:6,height:6,transform:"translate(0,0)",fill:p,opacity:m,name:"rect"},o[1]={d:"M 3 -3 L -3 3 M 0 6 L 6 0 M 9 3 L 3 9","stroke-width":2,stroke:u,name:"path"},this.loadPattern(e,o,l),n.appendChild(l),"url(#"+c+"_"+h+"_"+i.name+"_"+i.index+")";case"grid":return r={id:c+"_"+h+"_"+i.name+"_"+i.index,patternUnits:"userSpaceOnUse",width:"6",height:"6"},l=e.svgRenderer.createPattern(r,"pattern"),o[0]={name:"rect",x:0,y:0,width:6,height:6,transform:"translate(0,0)",fill:p,opacity:m},o[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:u},this.loadPattern(e,o,l),n.appendChild(l),"url(#"+c+"_"+h+"_"+i.name+"_"+i.index+")"; case"turquoise":return r={id:c+"_"+h+"_"+i.name+"_"+i.index,patternUnits:"userSpaceOnUse",width:"17",height:"17"},l=e.svgRenderer.createPattern(r,"pattern"),o[0]={name:"rect",x:0,y:0,width:17,height:17,transform:"translate(0,0)",fill:p,opacity:m},o[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:u,fill:u},o[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:u,fill:u},o[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:u,fill:u},o[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:u,fill:u},o[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:u,fill:u},o[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:u,fill:u},o[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:u,fill:u},this.loadPattern(e,o,l),n.appendChild(l),"url(#"+c+"_"+h+"_"+i.name+"_"+i.index+")";case"star":return r={id:c+"_"+h+"_"+i.name+"_"+i.index,patternUnits:"userSpaceOnUse",width:"21",height:"21"},l=e.svgRenderer.createPattern(r,"pattern"),o[0]={name:"rect",x:0,y:0,width:21,height:21,transform:"translate(0,0)",fill:p,opacity:m},o[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:u,fill:u},this.loadPattern(e,o,l),n.appendChild(l),"url(#"+c+"_"+h+"_"+i.name+"_"+i.index+")";case"triangle":return r={id:c+"_"+h+"_"+i.name+"_"+i.index,patternUnits:"userSpaceOnUse",width:"10",height:"10"},l=e.svgRenderer.createPattern(r,"pattern"),o[0]={name:"rect",x:0,y:0,width:10,height:10,transform:"translate(0,0)",fill:p,opacity:m},o[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:u,fill:u},this.loadPattern(e,o,l),n.appendChild(l),"url(#"+c+"_"+h+"_"+i.name+"_"+i.index+")";case"circle":return r={id:c+"_"+h+"_"+i.name+"_"+i.index,patternUnits:"userSpaceOnUse",width:"9",height:"9"},l=e.svgRenderer.createPattern(r,"pattern"),o[0]={name:"rect",x:0,y:0,width:9,height:9,transform:"translate(0,0)",fill:p,opacity:m},o[1]={name:"circle",cx:5.125,cy:3.875,r:3.625,"stroke-width":1,fill:u},this.loadPattern(e,o,l),n.appendChild(l),"url(#"+c+"_"+h+"_"+i.name+"_"+i.index+")";case"tile":return r={id:c+"_"+h+"_"+i.name+"_"+i.index,patternUnits:"userSpaceOnUse",width:"18",height:"18"},l=e.svgRenderer.createPattern(r,"pattern"),o[0]={name:"rect",x:0,y:0,width:18,height:18,transform:"translate(0,0)",fill:p,opacity:m},o[1]={name:"path",d:"M0,9L0 0 9 0 z","stroke-width":1,stroke:u,fill:u},o[2]={name:"path",d:"M9,9L9 0 18 0 z","stroke-width":1,stroke:u,fill:u},o[3]={name:"path",d:"M0,18L0 9 9 9 z","stroke-width":1,stroke:u,fill:u},o[4]={name:"path",d:"M9,18L9 9 18 9 z","stroke-width":1,stroke:u,fill:u},this.loadPattern(e,o,l),n.appendChild(l),"url(#"+c+"_"+h+"_"+i.name+"_"+i.index+")";case"horizontaldash":return r={id:c+"_"+h+"_"+i.name+"_"+i.index,patternUnits:"userSpaceOnUse",width:"12",height:"12"},l=e.svgRenderer.createPattern(r,"pattern"),o[0]={name:"rect",x:0,y:0,width:12,height:12,transform:"translate(0,0)",fill:p,opacity:m},o[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:u,fill:u},this.loadPattern(e,o,l),n.appendChild(l),"url(#"+c+"_"+h+"_"+i.name+"_"+i.index+")";case"verticaldash":return r={id:c+"_"+h+"_"+i.name+"_"+i.index,patternUnits:"userSpaceOnUse",width:"12",height:"12"},l=e.svgRenderer.createPattern(r,"pattern"),o[0]={name:"rect",x:0,y:0,width:12,height:12,transform:"translate(0,0)",fill:p,opacity:m},o[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:u,fill:u},this.loadPattern(e,o,l),n.appendChild(l),"url(#"+c+"_"+h+"_"+i.name+"_"+i.index+")";case"rectangle":return r={id:c+"_"+h+"_"+i.name+"_"+i.index,patternUnits:"userSpaceOnUse",x:0,y:0,width:12,height:12},l=e.svgRenderer.createPattern(r,"pattern"),o[0]={name:"rect",width:12,height:12,fill:p,opacity:m},o[1]={name:"rect",x:1,y:2,width:4,height:9,fill:u,opacity:m},o[2]={name:"rect",x:7,y:2,width:4,height:9,fill:u,opacity:m},this.loadPattern(e,o,l),n.appendChild(l),"url(#"+c+"_"+h+"_"+i.name+"_"+i.index+")";case"box":return r={id:c+"_"+h+"_"+i.name+"_"+i.index,patternUnits:"userSpaceOnUse",x:0,y:0,width:10,height:10},l=e.svgRenderer.createPattern(r,"pattern"),o[0]={name:"rect",width:13,height:13,fill:p,opacity:m},o[1]={name:"rect",x:1.5,y:1.5,width:10,height:9,fill:u,opacity:m},this.loadPattern(e,o,l),n.appendChild(l),"url(#"+c+"_"+h+"_"+i.name+"_"+i.index+")";case"horizontalstripe":return r={id:c+"_"+h+"_"+i.name+"_"+i.index,patternUnits:"userSpaceOnUse",width:"10",height:"12"},l=e.svgRenderer.createPattern(r,"pattern"),o[0]={name:"rect",x:0,y:0,width:10,height:12,transform:"translate(0,0)",fill:p,opacity:m},o[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:u,fill:u},this.loadPattern(e,o,l),n.appendChild(l),"url(#"+c+"_"+h+"_"+i.name+"_"+i.index+")";case"verticalstripe":return r={id:c+"_"+h+"_"+i.name+"_"+i.index,patternUnits:"userSpaceOnUse",width:"12",height:"10"},l=e.svgRenderer.createPattern(r,"pattern"),o[0]={name:"rect",x:0,y:0,width:12,height:10,transform:"translate(0,0)",fill:p,opacity:m},o[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:u,fill:u},this.loadPattern(e,o,l),n.appendChild(l),"url(#"+c+"_"+h+"_"+i.name+"_"+i.index+")";case"bubble":return r={id:c+"_"+h+"_"+i.name+"_"+i.index,patternUnits:"userSpaceOnUse",width:"20",height:"20"},l=e.svgRenderer.createPattern(r,"pattern"),o[0]={name:"rect",x:0,y:0,width:20,height:20,transform:"translate(0,0)",fill:p,opacity:m},o[1]={name:"circle",cx:5.217,cy:11.325,r:3.429,"stroke-width":1,fill:"#D0A6D1"},o[2]={name:"circle",cx:13.328,cy:6.24,r:4.884,"stroke-width":1,fill:u},o[3]={name:"circle",cx:13.277,cy:14.66,r:3.018,"stroke-width":1,fill:"#D0A6D1"},this.loadPattern(e,o,l),n.appendChild(l),"url(#"+c+"_"+h+"_"+i.name+"_"+i.index+")";case"custom":return"url(#"+d.customPattern+")"}},loadPattern:function(e,t,i,s){for(var a,n=0;nR.region.SeriesIndex&&!(i._zOrder=x.x||0==v.X)&&Math.abs(v.Y-(x.y+x.height))<=x.y+x.height&&(Math.abs(v.Y-(x.y+x.height))>=x.y||0==v.Y)&&(h.cancel||(0==$(e.svgObject).find("#"+e.svgObject.id+"_TrackToolTip").length&&(p={id:e.svgObject.id+"_TrackToolTip",transform:"translate("+x.x+","+x.y+")"},e.gTransToolEle=e.svgRenderer.createGroup(p)),e.svgRenderer._setAttr($(e.svgObject).find("#"+e.svgObject.id+"_TrackToolTip"),{transform:"translate("+x.x+","+x.y+")",visibility:"visible"}),ej.util.isNullOrUndefined(i.tooltip.template)?(L=!0,$(".tooltipDiv").remove(),e.displayShowTooltip(v,d.point,i,d.index)):(L=!0,$("#"+e.svgObject.id).find("#"+e.svgObject.id+"_TrackToolTip").attr("visibility","hidden"),g={SeriesIndex:s,Region:{PointIndex:d.index}},e.createTooltip(g,t,i))))))}if($(".tooltipDiv").hasClass(this.svgObject.id)||$(".tooltipDiv").remove(),R&&ej.util.isNullOrUndefined(R.region.isStripLine)){if("none"==this.model.AreaType&&this.model._visibleSeries[R.region.SeriesIndex].explode&&(this.model._visibleSeries[R.region.SeriesIndex].enableAnimation?(this.model.AnimationComplete||this.model.enableCanvasRendering)&&this.pieExplosion(R,t):this.model.enable3D||this.pieExplosion(R,t)),R.region.isIndicator?(H=this.model.indicators[R.region.SeriesIndex],_=H.segment[0]._visiblePoints[R.region.Region.PointIndex],H.fill=H.segment[0].fill):(H=this.model._visibleSeries[R.region.SeriesIndex],_=this.model._visibleSeries[R.region.SeriesIndex]._visiblePoints[R.region.Region.PointIndex]),_&&("bubble"==H.type.toLowerCase()||"scatter"==H.type.toLowerCase()||"polaraxes"==this.model.AreaType)){for(I=0;Ij[R].xAxis.y&&e.mousemoveYj[R].xAxis.x&&e.mousemoveX=j[R].yAxis.visibleRange.min&&l.point[0].xValue>=d.min&&l.point[0].xValue<=d.max&&r))for(L=0;Ls.xAxis.y&&e.mousemoveYs.xAxis.x&&e.mousemoveX=s.yAxis.visibleRange.min&&l.point[0].xValue>=d.min&&l.point[0].xValue<=d.max)if(r)for(L=0;Lp?_:_>=g?g:p,+$("#"+e.svgObject.id+"_Tracker").css("top",m)):(p=h.left+s.xAxis.x,g=s.xAxis.width+h.left+s.xAxis.x,_=i.X+s.xAxis.x+h.left,u=_<=g&&_>p?_:_>g?g:p,$("#"+e.svgObject.id+"_Tracker").css("left",u))),$("#"+this._id).find('[id*="canvas_Tracker"]').css("visibility","visible")),f=ej.EjSvgRender.utils._getTransform(s.xAxis,s.yAxis,E),b={transform:"translate("+f.x+","+f.y+")",id:e.svgObject.id+"_TrackToolTip_"+n},e.gTransToolEle=e.svgRenderer.createGroup(b),v=this.model.prePoint,ej.util.isNullOrUndefined(v)||v.pointIndex[0]!=l.index[0]||!$("#"+e.svgObject.id+"_trackSymbol_"+n+"_"+l.index))if(ej.util.isNullOrUndefined(x)&&(null!=this.model.crosshair.tooltipTemplate&&$(document).find('[id*="_TrackToolTipTemplate_"]').attr("visibility","hidden"),e.gTransToolEle&&e.gTrackerEle&&($(this.svgObject).find('[id*="_TrackSymbol_"],[id*="_TrackToolTip"]').attr("visibility","hidden"),$("#"+this._id).find('[id*="canvas_trackSymbol"]').css("visibility","hidden")),x=l),e.drawTrackerSymbol(s,n,l.index[L],!0,i),e.model.crosshair.tooltipTemplate)I=document.getElementById(this.svgRenderer.svgObj.id).getClientRects()[0],e.displayTemplateTooltip(T,D,i,l.point[L],s,n,l.index[L],I);else{var W,w=this.getTooltipFormat(l.point[L],s,n,R,s.tooltip.format,R),y=s.tooltip.font?s.tooltip.font:s.font,C=ej.EjSvgRender.utils._measureText(w.text,null,y),S=z.length-1,U=E?C.height:C.width,V=V>U?V:U,G=Math.ceil(w.text.toString().split("
      ").length/2);if(this.model.tooltipPadding=Number(y.size.toString().replace(/px/i,""))/3,W=this.model.tooltipPadding+2*s.tooltip.border.width,E?F.push({Start:z[S].X-W-C.width/2,End:z[S].X+W+C.width/2}):F.push({Start:z[S].Y-W*G-C.height/2,End:z[S].Y+W*G+C.height/2}),B.push({Point:z[S],ClosestPoint:l.point[L],Series:s,ClosestPointIndex:l.index[L],Tgap:0,StEnd:F[S],TextArea:C,ReqInvertAxis:E}),B.length==H)for(V+=2*W,B=E?B.sort(function(e,t){return e.Point.X-t.Point.X}):B.sort(function(e,t){return e.Point.Y-t.Point.Y}),this.SmartTooltipPosition(B),R=0;R=r.y&&t.y<=r.y+r.height&&(r.x=r.x&&t.x<=r.x+r.width&&(r.yb.left?v.offsetLeft:b.left,top:v.offsetTop>b.top?v.offsetTop:b.top};0==$("#"+e.svgObject.id+"_CrosshairVertical").length?(h={id:e.svgObject.id+"_CrosshairVertical",fill:"none","stroke-width":e.model.crosshair.line.width,stroke:e.model.crosshair.line.color,"clip-path":"url(#"+this.svgObject.id+"_ChartAreaClipRect)",d:_},e.model.enableCanvasRendering?(h.width=0,h.height=g,h.top=p+x.top,h.left=u+x.left,e.svgRenderer.drawCrosshairLine(h,e.svgObject)):e.svgRenderer.drawPath(h,e.svgObject)):(e.svgRenderer._setAttr($(e.svgObject).find("#"+e.svgObject.id+"_CrosshairVertical"),{d:_}),e.model.enableCanvasRendering&&$("#"+e.svgObject.id+"_CrosshairVertical").css("left",this.mousemoveX+x.left).css("top",p+x.top).css("height",g),$("#"+e.svgObject.id+"_CrosshairVertical").css("visibility","visible")),0==$("#"+e.svgObject.id+"_CrosshairHorizontal").length?(c={id:e.svgObject.id+"_CrosshairHorizontal",fill:"none","stroke-width":e.model.crosshair.line.width,stroke:e.model.crosshair.line.color,"clip-path":"url(#"+this.svgObject.id+"_ChartAreaClipRect)",d:f},e.model.enableCanvasRendering?(c.top=p+x.top,c.left=u+x.left,c.width=m,c.height=0,e.svgRenderer.drawCrosshairLine(c,e.svgObject)):e.svgRenderer.drawPath(c,e.svgObject)):(e.svgRenderer._setAttr($(e.svgObject).find("#"+e.svgObject.id+"_CrosshairHorizontal"),{d:f}),$("#"+e.svgObject.id+"_CrosshairHorizontal").css("visibility","visible"),e.model.enableCanvasRendering&&$("#"+e.svgObject.id+"_CrosshairHorizontal").css("top",this.mousemoveY+x.top).css("left",u+x.left).css("width",m)),0==$("#"+e.svgObject.id+"_AxisCrossToolTip").length?(l={id:e.svgObject.id+"_AxisCrossToolTip",visibility:"visible"},e.gTrackAxisEle=e.svgRenderer.createGroup(l),e.svgRenderer.append(e.gTrackAxisEle,e.svgObject)):this.svgRenderer._setAttr($(e.gTrackAxisEle),{visibility:"visible"}),$.each(e.model._axes,function(i,s){var a,n,o,r,l,h=s._valueType.toLowerCase();"horizontal"==s.orientation.toLowerCase()&&s.crosshairLabel.visible?e.mousemoveX<=s.x+s.width&&s.x<=e.mousemoveX?(a="category"==s._valueType&&"betweenticks"==s.labelPlacement.toLowerCase()?.5:0,n=(Math.abs(e.mousemoveX-(s.isInversed?s.x+s.width:s.x))/s.width*s.visibleRange.delta+s.visibleRange.min+a).toFixed(2).replace(new RegExp("\\.0{2}"),""),"logarithmic"==h&&(n=Math.pow(s.logBase,n).toFixed(2).replace(new RegExp("\\.0{2}"),"")),"datetime"==h&&(n=ej.format(new Date(Math.floor(n)),ej.util.isNullOrUndefined(s.labelFormat)?ej.EjSvgRender.utils._dateTimeLabelFormat(s._intervalType):s.labelFormat)),"category"==h&&(n=ej.EjSvgRender.utils._getLabelContent(n,s)),o={X:e.mousemoveX,Y:s.y},e.displayAxisTooltip(o,n,s,i,t),$("#"+e.svgObject.id+"_AxisToolTipText_"+i).show(),$("#"+e.svgObject.id+"_AxisToolTipRect_"+i).show()):($("#"+e.svgObject.id+"_AxisToolTipText_"+i).hide(),$("#"+e.svgObject.id+"_AxisToolTipRect_"+i).hide()):"vertical"==s.orientation.toLowerCase()&&s.crosshairLabel.visible&&(e.mousemoveY<=s.y+s.height&&s.y<=e.mousemoveY?(r=(Math.abs(1-Math.abs(e.mousemoveY-(s.isInversed?s.y+s.height:s.y))/s.width/s.height)*s.visibleRange.delta+s.visibleRange.min).toFixed(d).replace(new RegExp("\\.0{"+d+"}"),""),"logarithmic"==h&&(r=Math.pow(s.logBase,r).toFixed(2).replace(new RegExp("\\.0{2}"),"")),"datetime"==h&&(r=ej.format(new Date(Math.floor(r)),ej.util.isNullOrUndefined(s.labelFormat)?ej.EjSvgRender.utils._dateTimeLabelFormat(s._intervalType):s.labelFormat)),"category"==h&&(r=ej.EjSvgRender.utils._getLabelContent(r,s)),l={X:s.x,Y:e.mousemoveY},e.displayAxisTooltip(l,r,s,i,t),$("#"+e.svgObject.id+"_AxisToolTipText_"+i).show(),$("#"+e.svgObject.id+"_AxisToolTipRect_"+i).show()):($("#"+e.svgObject.id+"_AxisToolTipText_"+i).hide(),$("#"+e.svgObject.id+"_AxisToolTipRect_"+i).hide()))})}},chartTouchMove:function(e){this.cancelEvent(e),e=e.originalEvent.touches[0],this.chartInteractiveBehavior(e)},isZoomButtonHovered:function(e){if(null!=e.parentNode){var t=e.parentNode.id,i=e.id;if(i.indexOf("_ZoomInBtn ")==-1&&i.indexOf("ZoomOutBtn")==-1&&i.indexOf("_ZoomBtn")==-1&&i.indexOf("_ResetZoom")==-1&&i.indexOf("_PanBtn")==-1&&t.indexOf("_ZoomInBtn")==-1&&t.indexOf("_ZoomOutBtn")==-1&&t.indexOf("_ZoomBtn")==-1&&t.indexOf("_ResetZoom")==-1&&t.indexOf("_PanBtn")==-1)return!1}return!0},chartInteractiveBehavior:function(e){var t,i,s,a,n,o,r,l,d=this.calMousePosition(e);if(this.mousemoveX=d.X,this.mousemoveY=d.Y,t="#"+this.svgObject.id,this.mouseWheelCoords&&(i=Math.abs(this.mouseWheelCoords.x-e.pageX),s=Math.abs(this.mouseWheelCoords.y-e.pageY),(i>0||s>0)&&!this.panning?this.enableTrackBall():this.disableTrackBall()),a=this,null!=e.target.parentNode)var h=e.target.parentNode.id,o=e.target.id,c=h.indexOf(this.svgObject.id+"_SeriesGroup_")>=0||h.indexOf(this.svgObject.id+"_symbolGroup_")>=0||h.indexOf(this.svgObject.id+"_TrackSymbol_")>=0||h.indexOf(this.svgObject.id+"_Chart3D")>=0;"cartesianaxes"==a.model.AreaType&&this.mousemoveX>=this.model.m_AreaBounds.X&&this.mousemoveX=this.model.m_AreaBounds.Y&&this.model.initSeriesRender?(n={x:a.mousemoveX,y:a.mousemoveY},o=a.svgRenderer._getAttrVal($(e.target).parent(),"id"),void 0==o||o!=a.svgRenderer._getAttrVal($(this.svgObject).find(t+"_ZoomBtn"),"id")&&o!=a.svgRenderer._getAttrVal($(this.svgObject).find(t+"_ResetZoom"),"id")&&o!=a.svgRenderer._getAttrVal($(this.svgObject).find(t+"_PanBtn"),"id")?this.enableTrackBall():this.disableTrackBall(),this.model.crosshair.visible||this.isZoomButtonHovered(e.target)||this.model.commonSeriesOptions.highlightSettings.enable?(r=this.model.prevPoint,r&&(this.model.enableCanvasRendering?$("#canvas_trackSymbol").remove():(l=ej.EjSvgRender.utils._getPoint(r.point,r.series),a.drawTrackerSymbol(r.series,r.seriesIndex,r.pointIndex,null,l)),this.model.prevPoint=null),$("#"+a.svgObject.id).find("#"+a.svgObject.id+"_TrackToolTip").attr("visibility","hidden"),$("#"+a.svgObject.id+"_TrackToolTip").hide(),$(".tooltipDiv").css("display","none")):this.tooltip(a,e),this.model.enable3D||(this.chartCrossHair(a,n),this.chartAreaCrossHair(a,n))):"none"!=a.model.AreaType&&"polaraxes"!=a.model.AreaType||this.isZoomButtonHovered(e.target)?($("#"+a.svgObject.id).find("#"+a.svgObject.id+"_TrackToolTip").attr("visibility","hidden"),$("#"+a.svgObject.id+"_TrackToolTip").hide(),$(".tooltipDiv").css("display","none"),this._removeTrackBall()):this.tooltip(a,e),this.model.crosshair.visible||(this.model.enableCanvasRendering?this.highlightCanvas(this,e):this.highlightSvg(a,h,c,e))},highlightSvg:function(e,t,i,s){var a,n,o,r;void 0!=t&&(a=this.svgObject.id+"_SeriesGroup_",n=t.substr(a.length),t.indexOf(this.svgObject.id+"_symbolGroup_")>=0&&(a=this.svgObject.id+"_symbolGroup_",n=t.substr(a.length))),o=this.GetSeriesPoint(s),n=void 0!=o?o.region.SeriesIndex:n,r=this.model.series[n],i&&r&&r.highlightSettings.enable&&this.highlight(e,s,r)},highlightCanvas:function(e,t){for(var i,s,a,n,o,r,l,d=0;d=n+s||i>=o+a?($("#"+e+"_resize_rightRect"+r).css({cursor:"default"}),$("#"+e+"_resize_leftRect"+r).css({cursor:"default"}),$("#"+e+"_resize_bottomRect"+r).css({cursor:"default"}),$("#"+e+"_resize_topRect"+r).css({cursor:"default"}),$("#"+e+"_resize_bottomRightCornerCircle"+r).css({cursor:"default"})):(t>=s||i>=a||t<=n+s||i<=o+a)&&($("#"+e+"_resize_rightRect"+r).css({cursor:"e-resize"}),$("#"+e+"_resize_leftRect"+r).css({cursor:"w-resize"}),$("#"+e+"_resize_bottomRect"+r).css({cursor:"s-resize"}),$("#"+e+"_resize_topRect"+r).css({cursor:"n-resize"}),$("#"+e+"_resize_bottomRightCornerCircle"+r).css({cursor:"se-resize"}))},multiSelectMouseMove:function(evt){var q,rectOptions,translate;if(this._isMultiSelect&&"range"==this.multiSelectMode){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;qareaBounds.X+areaBounds.Width&&(currentX=areaBounds.X+areaBounds.Width),currentY=mouseMoveYareaBounds.Y+areaBounds.Height?areaBounds.Y+areaBounds.Height:mouseMoveY,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),null!=this.gEle&&($(this.gEle).appendTo(this.parentgEle),0==this.selectedRectIndex&&(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=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=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=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=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=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)switch($("#"+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-=modifiedX,rectY-=modifiedY,this.PreviousCoords.X=evt.pageX,this.PreviousCoords.Y=evt.pageY,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})}}},chartMouseMove:function(e){function t(t){var i,s=O._id;$("#"+s+"_tooltip").length<=0?(i=$("
      ").attr("id",s+"_tooltip"),$(i).html(" "+t+" "),$(document.body).append(i),$(i).css({left:e.pageX+10,top:e.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"})):$("#"+s+"_tooltip").css({left:e.pageX+10,top:e.pageY+10})}var i,s,a,n,o,r,l,d,h,c,u,m,p,g,_,f,b,v,x,w,y,C,S,T,D,I,k=this.GetSeriesPoint(e),P=this.model,L=e.target.classList;if("cartesianaxes"!=this.multiSelectAreaType||P.zooming.enable||P.enableCanvasRendering||this.multiSelectMouseMove(e),P.enableCanvasRendering&&k||($("[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._scrollBarEnabled&&(ej.util.isNullOrUndefined(L)||"e-hhandle"!=L[0]&&"e-vhandle"!=L[0])&&this.cancelEvent(e),this.rotateActivate&&this.oPreviousCoords){if(i=this.oPreviousCoords.Y-this.mousemoveY,s=this.oPreviousCoords.X-this.mousemoveX,s||i)for(this.model.tilt-=i,this.model.rotation+=s,a=this.selectedStyle(this),$(this.chart3D).empty(),$("#template_group_"+this._id).empty(),n={Width:$(this.svgObject).width(),Height:$(this.svgObject).height()},this.graphics.view(this.svgObject,this,this.model.rotation,this.model.tilt,n,this.model.perspectiveAngle,this.model.depth),this.svgRenderer.append(this.chart3D,this.svgObject),this.svgRenderer.append(this.gTransToolEle,this.svgObject),g=0;gz.X+z.Width&&(T=z.X+z.Width),D=this.mousemoveYz.Y+z.Height?z.Y+z.Height:this.mousemoveY,"x"==P.zooming.type.toLowerCase()?(E=Math.abs(T-this.mouseDownX),A=z.Height,j=T>this.mouseDownX?this.mouseDownX:T,N=z.Y):"y"==P.zooming.type.toLowerCase()?(E=z.Width,A=Math.abs(D-this.mouseDownY),j=z.X,N=D>this.mouseDownY?this.mouseDownY:D):(E=Math.abs(T-this.mouseDownX),A=Math.abs(D-this.mouseDownY),j=T>this.mouseDownX?this.mouseDownX:T,N=D>this.mouseDownY?this.mouseDownY:D),$(this.svgObject).css({"-moz-user-select":"-moz-none","-khtml-user-select":"none","-webkit-user-select":"none","-ms-user-select":"none","user-select":"none"}),this.zooming=!0,r={id:this.svgObject.id+"_ZoomArea",x:j,y:N,width:E,height:A,fill:"rgba(69,114,167,0.25)","stroke-width":1,stroke:"rgba(69,114,167,0.25)","clip-path":"url(#"+this.svgObject.id+"_ChartAreaClipRect)"},this.model.enableCanvasRendering?this.svgRenderer.drawZoomRect(r,this):this.svgRenderer.drawRect(r,this.svgObject)}if(l=P.zooming.enableDeferredZoom,this.panning&&this.doPan&&"cartesianaxes"==P.AreaType&&!this._scrollBarEnabled)if(this.currentPageX=e.pageX,this.currentPageY=e.pageY,$("#"+this._id+"_canvas").css({cursor:"pointer"}),ej.isTouchDevice()||l){if(ej.isTouchDevice()||l){for(h=0;h0;C++)c=this.model.indicators[C],F=ej.EjSvgRender.utils._getTransform(c.xAxis,c.yAxis,this.model.requireInvertedAxes),B=e.pageX-this.oPreviousCoords.x+F.x,H=e.pageY-this.oPreviousCoords.y+F.y,V="translate("+B+","+H+")",$("#"+this.svgObject.id+"_indicatorGroup_"+C).attr("transform",V)}}else d={x:this.oPreviousCoords.x-e.pageX,y:this.oPreviousCoords.y-e.pageY},this.oPreviousCoords={x:e.pageX,y:e.pageY},$.each(this.model._axes,function(e,t){var i=Math.max(1/ej.EjSvgRender.utils._minMax(t.zoomFactor,0,1),1);O.translate(t,d.x,d.y,i)}),this.redraw(!0),this._cursorToPointer(),this._enableZoomingButtons();var U=e.target.id,o=this._id,W=ej.util.isNullOrUndefined(e.target.parentNode)?"":e.target.parentNode.id;W==o+"_svg_ResetZoom"?t("Reset"):W==o+"_svg_PanBtn"?t("Pan"):W==o+"_svg_ZoomBtn"?t("Zoom"):W==o+"_svg_ZoomInBtn"?t("Zoom In"):W==o+"_svg_ZoomOutBtn"&&t("Zoom Out"),u=this.getAxisLabelData(e),u&&(I=$.extend({},ej.EjSvgRender.commonChartEventArgs),I.data=u,this._trigger("axisLabelMouseMove",I));var G=this.svgObject.id,Y=this.model.hAxes,X=this.model.vAxes;if(U.indexOf("_YLabel_")>=0){for(p=0;p=0){m=X[p];break}if(m&&m.enableTrim)for(visibleLabelsLength=m.visibleLabels.length,g=0;g=0){for(p=0;p=0){m=Y[p];break}if(m&&(m.enableTrim||"trim"==m.labelIntersectAction.toLowerCase()||"wrap"==m.labelIntersectAction.toLowerCase()||"wrapbyword"==m.labelIntersectAction.toLowerCase()))for(visibleLabelsLength=m.visibleLabels.length,g=0;g0&&$(this.svgObject).find(o+"_ResetZoom,"+o+"_PanBtn,"+o+"_ZoomBtn").appendTo(this.svgObject),x=this.getLegendData(e))if(w=$.extend({},ej.EjSvgRender.commonChartEventArgs),w.data=x,x.series.highlightSettings.enable&&(this.model.enableCanvasRendering?(y=$.extend({},x.series),y.seriesIndex=x.legendItem.LegendItem.SeriesIndex,y.pointIndex=x.legendItem.LegendItem.PointIndex,C="none"==this.model.AreaType?y.pointIndex:y.seriesIndex,0==$("#"+O._id+"_Selection_Legend"+C+"_canvas").length&&($("[id*="+this._id+"_Highlight_]").remove(),this.canvasHighlight(O,e,y,x))):this.highlight(O,e,x.series,x)),this._trigger("legendItemMouseMove",w),P.enableCanvasRendering){var q=this.calMousePosition(e),K=q.X,Q=q.Y;$(this.legendContainer).children().css({cursor:"pointer"}),K>=P.LegendBounds.X&&K<=P.LegendBounds.X+P.LegendViewerBounds.Width&&Q<=this.model.LegendBounds.Y+P.LegendViewerBounds.Height&&Q>=P.LegendBounds.Y&&this._textTooltip(e,P.legendTextRegion)}else this._textTooltip(e,this.model.legendTextRegion);else P.enableCanvasRendering&&$(this.legendContainer).children().css("cursor","default");P.enableCanvasRendering&&(U.indexOf("_ResetZoom")!=-1||W.indexOf("_ResetZoom")!=-1?t("Reset"):U.indexOf("_PanBtn")!=-1||W.indexOf("_PanBtn")!=-1?t("Pan"):U.indexOf("_ZoomBtn")!=-1||W.indexOf("_ZoomBtn")!=-1?t("Zoom"):U.indexOf("_ZoomInBtn")!=-1||W.indexOf("_ZoomInBtn")!=-1?t("Zoom In"):(U.indexOf("_ZoomOutBtn")!=-1||W.indexOf("_ZoomOutBtn")!=-1)&&t("Zoom Out"),this._textTooltip(e,this.model.xAxisLabelRegions),this._textTooltip(e,this.model.yAxisLabelRegions)),S=this,P.xAxisTitleRegion&&(T=this.mousemoveX,D=this.mousemoveY,$.each(P.xAxisTitleRegion,function(t,i){T>=i.Bounds.X&&T<=i.Bounds.X+i.Bounds.Width&&D>=i.Bounds.Y-i.Bounds.Height&&D<=i.Bounds.Y&&i.trimText!=i.labelText&&S.showAxisTooltip(e.pageX,e.pageY,i.labelText)})),this.model.yAxisTitleRegion&&(T=this.mousemoveX,D=this.mousemoveY,$.each(this.model.yAxisTitleRegion,function(t,i){T>=i.Bounds.X&&T<=i.Bounds.X+i.Bounds.Width&&D>=i.Bounds.Y-i.Bounds.Height&&D<=i.Bounds.Y&&i.trimText!=i.labelText&&S.showAxisTooltip(e.pageX,e.pageY,i.labelText)})),I=$.extend({},ej.EjSvgRender.commonChartEventArgs),I.data={location:{x:this.mousemoveX,y:this.mousemoveY},size:{height:this.model.svgHeight,width:this.model.svgWidth},id:e.target.id,pageX:e.pageX,pageY:e.pageY},this._trigger("chartMouseMove",I)},_hideTooltip:function(){$("#"+this.svgObject.id).find("#"+this.svgObject.id+"_TrackToolTip").attr("visibility","hidden"),$("#"+this.svgObject.id+"_TrackToolTip").attr("visibility","hidden").hide(),$(".tooltipDiv").css("display","none")},_removeHighlight:function(){$("[id*=HighlightSegment]").remove(),$("[id*=HighlightPath]").remove(),$("[id*=HighlightLegendSegment]").remove(),$("[id*=HighlightLegendPath]").remove(),$("[id*=HighlightDef]").remove(),$("[id*=Highlightseries]").remove(),$("[id*="+this._id+"_Highlight_]").remove()},_removeSelection:function(){$("[id*="+this._id+"_SelectionCluster_Legend]").remove(),$("[id*="+this._id+"_Selection_series]").remove(),$("[id*="+this._id+"_Selection_Cluster]").remove(),$("[id*=SelectionSegment]").remove(),$("[id*=SelectionPath]").remove(),$("[id*=SelectionLegend]").remove(),$("[id*=SelectionDef]").remove(),$("[id*=Selectionseries]").remove(),$("[id*="+this._id+"_Selection_]").remove()},datalabelTooltip:function(e,t,i){var s=this.calMousePosition(e);this.mousemoveX=s.X,this.mousemoveY=s.Y;var a,n,o,r,l,d,h,c=this._id,u=this.mousemoveX,m=this.mousemoveY,p=this.vmlRendering,g=this.model.elementSpacing,_=this;ej.util.isNullOrUndefined(this.accDataLabelRegion[t])||$.each(this.accDataLabelRegion[t],function(t,s){a=s.bounds.minX,n=s.bounds.minY,o=s.bounds.maxX,r=s.bounds.maxY,p&&(a=s.bounds.minX+s.bounds.width/2,o=s.bounds.maxX+s.bounds.width/2,n=s.bounds.minY,r=s.bounds.maxY),u>=a&&u<=o&&m>=n&&m<=r&&(l=$("
      ").attr("id",c+"_tooltip"),s.trimmedText!=s.text&&($("#container_svg_TrackToolTip").hide(),$("#container_canvas_TrackToolTip").hide(),$(l).html(s.text),$(document.body).append(l),d=ej.EjSvgRender.utils._measureText(s.text,s.text.length,s.font).width,$(l).css({top:e.pageY+g,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"}),("pyramid"==s.type||"funnel"==s.type)&&(h=_.model.m_AreaBounds.Width+_.model.m_AreaBounds.X-e.pageX,h>d?$(l).css({left:e.pageX+g}):(left=e.pageX-d+2*g,$(l).css({left:left}))),("pie"==s.type||"doughnut"==s.type)&&(a>s.bounds.centerX?(h=_.svgWidth-_.model.margin.left-_.model.margin.right-u,h").attr("id",s+"_tooltip");$(a).html(" "+i+" "),$(document.body).append(a),$(a).css({left:e+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(e,t){var i,s,a=this,n=this.calMousePosition(e),o=this.model.legend._ejScroller,r=o?$("#legend_"+this._id).ejScroller("instance").model.scrollTop:$("#legend_"+this._id).scrollTop(),l=o?$("#legend_"+this._id).ejScroller("instance").model.scrollLeft:$("#legend_"+this._id).scrollLeft(),d=n.X,h=n.Y,c=d,u=h,m=this._id,p=a.model,g=p.legend,_=g.enableScrollbar;g.textOverflow.toLowerCase();(_||o)&&(c=d+l,u=h+r),$.each(t,function(t,a){c>=a.bounds.x&&c<=a.bounds.x+a.bounds.width&&u>=a.bounds.y-a.bounds.height/3&&u<=a.bounds.y&&($("#"+m+"_tooltip").remove(),s=$("
      ").attr("id",m+"_tooltip"),i="array"==jQuery.type(a.trimText)?a.trimText.join(" "):a.trimText,i!=a.labelText&&($(s).html(" "+a.labelText+" "),$(document.body).append(s),$(s).css({left:e.pageX+10,top:e.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(e){var t,i,s,a,n,o;this.model.explode=!0;var r,l,d=e,h=d.region.Series,c=d.region.SeriesIndex,u=new(ej.seriesTypes[h.type.toLowerCase()]),m=h.explodeIndex;h.labelPosition.toLowerCase();if(currentExplodePoint={SeriesIndex:d.pointData[0].SeriesIndex,PointIndex:d.pointData[0].PointIndex},m!=d.region.Series._visiblePoints[d.pointData[0].PointIndex].actualIndex&&!d.region.Series.explodeAll){if(h.explodeIndex=d.region.Series._visiblePoints[d.pointData[0].PointIndex].actualIndex,!ej.util.isNullOrUndefined(this.model.explodeValue)&&this.model.explodeValue!=currentExplodePoint){for(this.model.explodeValue.SeriesIndex!=d.region.SeriesIndex&&(h=this.model._visibleSeries[this.model.explodeValue.SeriesIndex]),t=u._calculateArcData(this,this.model.explodeValue.PointIndex,h._visiblePoints[this.model.explodeValue.PointIndex],h,this.model.explodeValue.SeriesIndex),r=this.svgObject.id+"_SeriesGroup_"+this.model.explodeValue.SeriesIndex,l=$(this.gSeriesEle).children("#"+r)[0],i=$(l).children(),s=0;s"),$(document.body).append(p)):($(document).find('[id*="_TrackToolTipTemplate_"]').css("display","block"),p=$("#"+this.svgObject.id+"_TrackToolTipTemplate_"+n),p.empty()),this.svgRenderer._setAttr($(p),{id:this.svgObject.id+"_TrackToolTipTemplate_"+n}),null!=this.model.crosshair.tooltipTemplate&&(l=$("#"+this.model.crosshair.tooltipTemplate).clone(),$(l).css("display","block").appendTo(p),a.count=1,u.count=1,d=this.getSeriesColor(u,n,a),$(p).css("background-color","array"==jQuery.type(d)?d[0].color:d),h={series:a,point:u},$(p).html($(p).html().parseTemplate(h))),f-=parseFloat($(p).css("height"))/2,c=parseFloat($(p).css("width")),_+c>g+this.model.m_AreaBounds.Width&&(_=i.X+e+g-this.model.crosshair.marker.size.width-m-c),$(p).css("left",_),$(p).css("top",f)},displayAxisTooltip:function(e,t,i,s,a){var n,o,r,l,d;for("double"==i._valueType.toLowerCase()&&(n=i.labelFormat?i.labelFormat.match("{value}"):null,t=i.labelFormat?null!=n?"${value}"==i.labelFormat?i.labelFormat.replace("{value}","$"+Number(t)):i.labelFormat.replace("{value}",Number(t)):ej.format(Number(t),i.labelFormat):t),o=0,r=0;ro&&(o=this.model._axes[r].majorTickLines.size);var h=i._opposed,c=h?o+10+(i.x+i.width):i.x+i.width,u=$("#ScrollerParent_vertical_"+i.rowIndex+"_"+this._id).length>0,m=$("#ScrollerParent_horizontal_"+i.columnIndex+"_"+this._id).length>0;if(e.X>=0&&e.X<=c){var p=e.X,g=e.Y,_=5,f=$.extend({},ej.EjSvgRender.commonChartEventArgs);f.data={axisIndex:s,chartAxis:i,currentTrackText:t,location:a},this._trigger("trackAxisToolTip",f),l=f.data.currentTrackText,d=ej.EjSvgRender.utils._measureText(l,null,i.crosshairLabel.font),"horizontal"==i.orientation.toLowerCase()&&(p-=d.width/2,"inside"==i.labelPosition||(h?a.yi.y)?(0==h&&(g=i.y-d.height+_+o-(m?this.model.scrollerSize:0)),1==h&&(g=i.y+d.height+_-o)):(1==h&&(g=i.y-d.height/2+_-o),0==h&&(g=i.y+d.height-_+o)),g+=m&&!i.opposedPosition?this.model.scrollerSize:0),!h&&p+d.width>this.model.m_AreaBounds.Width+this.model.m_AreaBounds.X&&(p=this.model.m_AreaBounds.Width+this.model.m_AreaBounds.X-d.width+_+this.model.elementSpacing),"vertical"==i.orientation.toLowerCase()&&(g=e.Y+d.height/4,"inside"==i.labelPosition||!h&&a.xy.y||a.xy.x?(this.svgRenderer._setAttr($("#"+this.svgObject.id+"_AxisToolTipRect_"+s),{display:"block"}),this.svgRenderer._setAttr($("#"+this.svgObject.id+"_AxisToolTipText_"+s),{display:"block"}),w.display="block"):(this.svgRenderer._setAttr($("#"+this.svgObject.id+"_AxisToolTipRect_"+s),{display:"none"}),this.svgRenderer._setAttr($("#"+this.svgObject.id+"_AxisToolTipText_"+s),{display:"none"}),w.display="none"),this.model.enableCanvasRendering?this.svgRenderer.drawCrosshairlabel(w,b,f.data.currentTrackText):(this.svgRenderer.drawRect(w,this.gTrackAxisEle),this.svgRenderer.drawText(b,f.data.currentTrackText,this.gTrackAxisEle))}},displayTooltip:function(e,t,i,s,a,n){for(var o,r,l,d,h=$.inArray(i,this.model._visibleSeries),c={X1:this.model.m_AreaBounds.X,Y1:this.model.m_AreaBounds.Y+this.model.m_AreaBounds.Height,X2:this.model.m_AreaBounds.X+this.model.m_AreaBounds.Width,Y2:this.model.m_AreaBounds.Y},u=this.model._axes,m=i._xAxisName,p=i._yAxisName,g=0,_=u.length;g<_;g++)m==u[g].name?i._isTransposed?(c.Y1=u[g].Location.Y1,c.Y2=u[g].Location.Y2):(c.X1=u[g].Location.X1,c.X2=u[g].Location.X2):p==u[g].name&&(i._isTransposed?(c.X1=u[g].Location.X1,c.X2=u[g].Location.X2):(c.Y1=u[g].Location.Y1,c.Y2=u[g].Location.Y2));if(e.X>=c.X1&&e.X<=c.X2&&e.Y>=c.Y2&&e.Y<=c.Y1){var f=this.model.requireInvertedAxes,b=e.X+(i.isIndicator?0:ej.util.isNullOrUndefined(i._trackMarker)?i.marker.size.width:i._trackMarker.size.width)+T+1,v=e.Y,x=i.tooltip.format,w=ej.util.isNullOrUndefined(i.yAxis.roundingPlaces)?2:i.yAxis.roundingPlaces,y=this.getTooltipFormat(t,i,h,s,x,w),C=(i.name?i.name.replace(" ",""):"series"+h, $.extend({},ej.EjSvgRender.commonChartEventArgs));if(C.data={Location:{X:b,Y:v},Series:i,serIndex:h,pointIndex:s,currentText:y.text},this._trigger("trackToolTip",C),C.cancel)$("#"+this.svgObject.id+"_gTooltip_"+h+"_"+s).attr("visibility","hidden"),$("#"+this.svgObject.id+"_gTooltip_"+h+"_"+s).css("visibility","hidden");else{b=C.data.Location.X,v=C.data.Location.Y;var S,T=this.model.tooltipPadding,D=a,I=i.tooltip,k=I.font?$.extend(!1,i.font,{},I.font):i.font,P=ej.EjSvgRender.utils._measureText(C.data.currentText,i.xAxis.width,k),L=this.getSeriesColor(t,h,i),R=this.getTooltipOptions(L,i),M=(R.rectBColor,R.rectFColor,R.rectTextColor,P.width+2*T),O=P.height+2*T,E=f?M/10:30*O/100,A=3+this.model.crosshair.marker.border.width+(f?this.model.crosshair.marker.size.height:this.model.crosshair.marker.size.width)/2,j=A+10,E=0==Math.abs(a)?E:E/2,N=f?i.yAxis.width:i.xAxis.width,z=f?a+e.X-M/2:a+e.Y-O/2,F=f?a+e.X+M/2:a+e.Y+O/2,B=f?this.model.m_AreaBounds.X:this.model.m_AreaBounds.Y,H=f?this.model.m_AreaBounds.X+this.model.m_AreaBounds.Width:this.model.m_AreaBounds.Y+this.model.m_AreaBounds.Height,V=[];if(z>=B&&F<=H){if(f)if(e.Y-j-n=N){var U=e.X-j,W=e.Y-E+D,G=e.X,Y=e.Y,X=Math.atan2(W-Y,U-G),q=G+(0==a?-A:A*Math.cos(X)),K=Y+(0==a?0:A*Math.sin(X));S=e.X-j+" "+(e.Y-E+D)+" "+q+" "+K+" "+(e.X-j)+" "+(e.Y+E+D)+" "+(e.X-j)+" "+(e.Y+D+O/2)+" "+(e.X-M-j)+" "+(e.Y+D+O/2)+" "+(e.X-M-j)+" "+(e.Y+D-O/2)+" "+(e.X-j)+" "+(e.Y+D-O/2)+" "+(e.X-j)+" "+(e.Y-E+D),V.push({X:e.X-j-M+T,Y:e.Y+D+O/2})}else{var U=e.X+j,W=e.Y-E+D,G=e.X,Y=e.Y,X=Math.atan2(W-Y,U-G),q=G+(0==a?A:A*Math.cos(X)),K=Y+(0==a?0:A*Math.sin(X));S=e.X+j+" "+(e.Y+D-E)+" "+q+" "+K+" "+(e.X+j)+" "+(e.Y+D+E)+" "+(e.X+j)+" "+(e.Y+D+O/2)+" "+(e.X+j+M)+" "+(e.Y+D+O/2)+" "+(e.X+j+M)+" "+(e.Y+D-O/2)+" "+(e.X+j)+" "+(e.Y+D-O/2)+" "+(e.X+j)+" "+(e.Y-E+D),V.push({X:e.X+j+T,Y:e.Y+D+O/2})}o=L,"object"==typeof o&&(o=L[1].color);var _,Q={id:this.svgObject.id+"_gTooltip_"+h+"_"+s,fill:o,"stroke-width":"0px",stroke:i.fill,"fill-opacity":I.opacity?I.opacity:.85,points:S,visibility:"visible"},Z=C.data.currentText,J=Z,ee=ej.EjSvgRender.utils._measureText(Z,i.xAxis.width,k).height;C.data.currentText.indexOf("
      ")>=0&&(Z=C.data.currentText.split("
      "),J=Z[0],f?e.Y-j-n=N?V.push({X:e.X-M-j+T,Y:e.Y+D-O/2+ee/Z.length}):V.push({X:e.X+j+T,Y:e.Y+D-O/2+ee/Z.length}),ee=0),_=V.length-1,ee=f?ee:-ee,r={id:this.svgObject.id+"_ToolTipText_"+h+"_"+s,x:V[_].X,y:V[_].Y+ee/2,fill:"white","font-size":k.size,"font-family":k.fontFamily,"font-style":k.fontStyle,"font-weight":k.fontWeight,"text-anchor":"start"},this.model.enableCanvasRendering?this.svgRenderer.draw_tooltip(r,Z,T,Q,k):(l=this.svgRenderer.createGroup({id:this.svgObject.id+"_gTooltip_"+h+"_"+s}),this.svgRenderer.drawPolyline(Q,l),this.svgRenderer.drawText(r,Z,l,k)),$("#"+this.svgObject.id+"_gTooltip_"+h+"_"+s).attr("visibility","visible"),$("#"+this.svgObject.id+"_gTooltip_"+h+"_"+s).css("visibility","visible")}}0==$("#"+this.svgObject.id+"_TrackToolTip_"+h).length&&this.svgRenderer.append($(l),this.svgObject)}else $("#"+this.svgObject.id+"_TrackToolTip_"+h).remove(),d="_trackSymbol_"+h+"_"+s,$("#"+this._id).find("[id*="+d+"]").css("visibility","hidden")},SmartTooltipPosition:function(e){for(var t=[],i=e.length,s=[],a=0;a=e[o+1].Start){if(g=e[o+1].End-e[o+1].Start+d,h+=g,c++,c-1==p-1||o==p-1){for(i=(h-u)/2,s=(t[m]+t[o+1])/2,a=e[m].End-e[m].Start,e[m].Start=s-i,e[m].End=e[m].Start+a,r=m;r>0&&e[r].Start<=e[r-1].End+d;r--)n=e[r-1].End-e[r-1].Start,e[r-1].Start=e[r].Start-n-d,e[r-1].End=e[r-1].Start+n;for(l=m+1;l<=m+c;l++)a=e[l].End-e[l].Start,e[l].Start=e[l-1].End+d,e[l].End=e[l].Start+a}}else{if(c=o>0?c:0,c>0){for(i=(h-u)/2,s=(t[m]+t[o])/2,a=e[m].End-e[m].Start,e[m].Start=s-i,e[m].End=e[m].Start+a,r=m;r>0&&e[r].Start<=e[r-1].End+d;r--)n=e[r-1].End-e[r-1].Start,e[r-1].Start=e[r].Start-n-d,e[r-1].End=e[r-1].Start+n;for(l=m+1;l<=m+c;l++)a=e[l].End-e[l].Start,e[l].Start=e[l-1].End+d,e[l].End=e[l].Start+a;c=0}g=e[o+1].End-e[o+1].Start+d,h=e[o+1].Start+g,u=e[o+1].Start,m=o+1}},getTooltipOptions:function(e,t){var i,s,a,n,o,r;return this.model.theme.indexOf("gradient")>=0?(i="array"==jQuery.type(e)?e[0].color:e,s="white",o="#333333",a=5,n=5):(r=t.type.toLowerCase(),r.indexOf("column")==-1&&r.indexOf("waterfall")==-1&&r.indexOf("bar")==-1&&"rangearea"!=r&&"none"!=this.model.AreaType?(s="array"==jQuery.type(e)?e[0].color:e,i="transparent",o="white"):(i="#333333",s="white",o="#333333"),a=0,n=0),{rectBColor:i,rectFColor:s,rectTextColor:o,rectX:a,rectY:n}},getSeriesColor:function(e,t,i){return!i||i.isIndicator||i.isTrendLine?i.fill:e._hiloFill?e._hiloFill._gradientStop?e._hiloFill._gradientStop[0].color:e._hiloFill:e.fill?e.fill._gradientStop?e.fill._gradientStop[0].color:e.fill:"waterfall"==i.type.toLowerCase()&&i.positiveFill&&(e.y>0&&!e.showIntermediateSum&&!e.showTotalSum||e.waterfallSum>0)?i.positiveFill:this.model.seriesColors[t]},getTooltipFormat:function(e,t,i,s,a){var n,o,r,l,d,h=$.extend(!0,{},e),c=this.model.AreaType,u=t.xAxis,m=t.yAxis,p=u._valueType.toLowerCase(),g=ej.util.isNullOrUndefined,_=u.labelFormat,f=m.labelFormat,b=ej.EjSvgRender.utils._dateTimeLabelFormat,v=(ej.EjSvgRender.utils._decimalPlaces,!1),x=!1;for(t.count=1,h.count=1;a.indexOf("ej.format(")>=0;)substr=a.substring(a.indexOf("ej.format("),a.indexOf(")")+1),d=substr.substring(substr.indexOf("(")+1,substr.indexOf(",")),"#point.x#"==d?(v=!0,n=substr.substring(substr.indexOf(",")+1,substr.indexOf(")"))):"#point.y#"==d?(x=!0,o=substr.substring(substr.indexOf(",")+1,substr.indexOf(")"))):(globalizeformat=substr.substring(substr.indexOf(",")+1,substr.indexOf(")")),subStr1=d.substring(d.indexOf("#")+1),val=subStr1.substring(subStr1.indexOf(".")+1,subStr1.indexOf("#")),h.hasOwnProperty(val)&&h[val]&&(h[val]=ej.format(h[val],globalizeformat))),a=a.replace(substr,d);return"cartesianaxes"==c?"datetime"==p.toLowerCase()?(h.x=ej.format(new Date(h.xValue),g(_)?b(t.xAxis._intervalType):t.xAxis.labelFormat),h.x=v?ej.format(new Date(h.xValue),n):h.x):"category"==p.toLowerCase()?h.x=this.model.primaryXAxis.isIndexed?h.x?h.x:"undefined":ej.EjSvgRender.utils._getLabelContent(h.xValue,t.xAxis):(h.x=v?ej.format(h.x,n):h.x,r=_?_.match("{value}"):null,h.x=_?null!=r?"${value}"==_?_.replace("{value}","$"+h.x):_.replace("{value}",h.x):v?h.x:ej.format(Number(h.x),_):h.x):"date"==p&&(h.x=ej.format(new Date(h.xValue),b("days")),h.x=v?ej.format(new Date(h.xValue),n):h.x),h.y=h.waterfallSum?h.waterfallSum:h.y,h.y=x?ej.format(h.y,o):h.y,r=f?f.match("{value}"):null,h.y=f?null!=r?"${value}"==f?f.replace("{value}","$"+h.y):f.replace("{value}",h.y):x?h.y:ej.format(Number(h.y),f):h.y,l={series:t,point:h},a=a.parseTemplate(l),{data:h,text:a}},displayShowTooltip:function(e,t,i,s){var a,n,o,r,l,d,h,c,u,m,p,g=this.model.requireInvertedAxes;if(t.visible){$(".ejTooltip").not("#"+this.svgObject.id+"_TrackToolTip").remove();var _,f,b,v,x,w,y,C=i.isIndicator||i.isTrendLine?0:$.inArray(i,this.model._visibleSeries),S=7,T=i.tooltip.format,D=document.getElementById(this.svgObject.id).getClientRects()[0],I=this.model.m_AreaBounds,k=i.type.toLowerCase();switch(this.model.AreaType){case"cartesianaxes":x=e.X+(i.isIndicator||i.isTrendLine?0:ej.util.isNullOrUndefined(i._trackMarker)?i.marker.size.width:i._trackMarker.size.width)+("column"==k||"bar"==k||"stackingbar"==k||"stackingcolumn"==k||"waterfall"==k||"rangecolumn"==k?I.X:g?i.yAxis.x:i.xAxis.x),w=e.Y+(k.indexOf("column")!=-1||k.indexOf("waterfall")!=-1||k.indexOf("bar")!=-1||k.indexOf("rangearea")!=-1||"scatter"==k||"bubble"==k?I.Y:g?i.xAxis.y:i.yAxis.y),b=this.getSeriesColor(t,C,i);break;case"polaraxes":x=e.X+S+(ej.util.isNullOrUndefined(i._trackMarker)?i.marker.size.width:i._trackMarker.size.width),w=e.Y,b=this.getSeriesColor(t,C,i);break;case"none":x=e.X+i.marker.size.width+S,w=e.Y,b=this.model.pointColors[s]}y=this.getTooltipFormat(t,i,C,s,T),v=ej.EjSvgRender.utils._measureText(y.text);var P,L=this.getTooltipOptions(b,i),R=L.rectBColor,M=L.rectFColor,O=L.rectTextColor,E=L.rectX,A=L.rectY,n=i.tooltip,S=5;if(P=$(null==document.getElementById(this.svgObject.id+"_TrackToolTip")?"
      ":"#"+this.svgObject.id+"_TrackToolTip"),a=!!navigator.userAgent.match(/Trident\/7\./),!ej.isTouchDevice()||a||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(),f||(f=$("#"+this._id)[0].offsetParent.style.zIndex),n={top:w+$(document).scrollTop(),left:x+$(document).scrollLeft(),"background-color":n.fill?n.fill:M,"border-style":"solid",position:"absolute","border-color":n.border.color?n.border.color:R,"border-width":n.border.width||0==n.border.width?n.border.width:1,opacity:n.opacity,"z-index":f+1e4,"border-radius":(n.rx?n.rx:E).toString()+"px "+(n.ry?n.ry:A).toString()+"px","padding-left":"5px","padding-right":"5px","padding-top":"2px","padding-bottom":"2px"},$(P).css(n),o=$.extend({},ej.EjSvgRender.commonChartEventArgs),o.data={seriesIndex:C,pointIndex:s,currentText:y.text,isTrendLine:i.isTrendLine,trendlineIndex:i.trendlineIndex},this._trigger("toolTipInitialize",o),!o.cancel){var j=0,N=i.tooltip,z=N.font?$.extend(!1,i.font,{},N.font):i.font,F={top:w+$(document).scrollTop(),left:x+$(document).scrollLeft(),color:N.font&&N.font.color?z.color:O,"font-size":z.size,"font-family":z.fontFamily,"font-style":z.fontStyle,"font-weight":z.fontWeight,"align-self":"baseline"};for($(P).css(F),null==document.getElementById(this.svgObject.id+"_TrackToolTip")&&$(document.body).append(P[0]),r=_=o.data.currentText,$("#"+this.svgObject.id+"_TrackToolTip").html(r),l=0,d=0,r=o.data.currentText.split("
      "),h=0;h=B+i.xAxis.x&&(u=document.getElementById(this.svgObject.id).getClientRects()[0],m=x-(d+2*S+(i.isIndicator||i.isTrendLine?0:ej.util.isNullOrUndefined(i._trackMarker)?i.marker.visible?i.marker.size.width:0:i._trackMarker.size.width)+2*S),$("#"+this.svgObject.id+"_TrackToolTip").css("left",m+u.left-S+$(document).scrollLeft())),V=$("#"+this.svgObject.id+"_TrackToolTip")[0].getBoundingClientRect(),(V.bottom>=i.yAxis.y+H+D.top||V.bottom>=i.xAxis.y+H+D.top)&&(p=w-(V.bottom-V.top+(i.isIndicator||i.isTrendLine?0:ej.util.isNullOrUndefined(i._trackMarker)?i.marker.visible?i.marker.size.height:0:i._trackMarker.size.height))+S+D.top,$("#"+this.svgObject.id+"_TrackToolTip").css("top",p+$(document).scrollTop())),V=$("#"+this.svgObject.id+"_TrackToolTip")[0].getBoundingClientRect(),V.left<0&&$("#"+this.svgObject.id+"_TrackToolTip").css("left",x),V.topt.right+a&&$("#"+e.target.id).css("left",e.clientX-(i.right-i.left)-a)},_initializeSeriesColors:function(){var e,t,i,s,a,n,o,r,l,d,h,c=this,u=c.model.palette?c.model.palette:c.model.colors,m=u.length,p=c.model.AreaType;if(c.model.seriesColors=[],c.model.seriesBorderColors=[],c.model.pointColors=[],c.model.pointBorderColors=[],n=c.model._visibleSeries.length,o=c.model._visibleSeries,"none"!=p)e=c.model._visibleSeries,t=c.model.seriesColors,i=c.model.seriesBorderColors;else{for(l=0,h=0;hl?(l=c.model._visibleSeries[h].points.length,r=c.model._visibleSeries[h].points):c.model._visibleSeries[h].points.length==l&&(r=c.model._visibleSeries[h].points);e=r,t=c.model.pointColors,i=c.model.pointBorderColors}if("none"==p&&n>1)for(d=0;d0&&this._initializeTrendlinesColors(a,t[h]),ej.util.isNullOrUndefined(s.border)||ej.util.isNullOrUndefined(s.border.color)||""==s.border.color?(i[h]=c.model.seriesBorderDefaultColors[h%10],"none"!=p&&(s.border.color=i[h])):i[h]=s.border.color,s.dataPoint=s.points},_initializeTrendlinesColors:function(e,t){for(var i in e)(ej.util.isNullOrUndefined(e[i].fill)||""==e[i].fill)&&(e[i].fill=t)},_createAxisLabelAndRange:function(){for(var e,t,i,s,a,n,o=0,r=this.model.series.length,l=0;l0?(x[h][o]=null==x[h][o],_-=x[h][o]&&y,g=u[h][series._visiblePoints[o].xValue],u[h][series._visiblePoints[o].xValue]+=_,C=gMath.min.apply(0,p.StartValues)&&(s.min=Math.min.apply(0,p.StartValues)),s.max0?(p=x[C][series.points[h].xValue],S[C][h]=null==S[C][h],m-=S[C][h]&&D,u=pD?D-g:0,c=g,w[C][series.points[h].xValue]+=m),r.StartValues[h]=c+u,r.EndValues[h]=c+m,r.EndValues[h]>100&&(r.EndValues[h]=100),series.points[h].YValues=[r.EndValues[h]];r.stackedSeries=!1,this.model.stackedValue[t.name].push(r),this.model.stackedValue[t.name].min>Math.min.apply(0,r.StartValues)&&(this.model.stackedValue[t.name].min=Math.min.apply(0,r.StartValues)),this.model.stackedValue[t.name].maxMath.min.apply(0,r.EndValues)&&(this.model.stackedValue[t.name].min=-100),series.stackedValue=r}}},_legendItemBounds:function(e,t,i){var s,a,n,o=this.model.legend,r=o.position.toLowerCase(),l=(o.itemPadding,0),d=0;return ej.util.isNullOrUndefined(o.columnCount)&&o.rowCount?(a=o.rowCount,n=Math.ceil(e/a),l=t*n,d=i*a):ej.util.isNullOrUndefined(o.rowCount)&&o.columnCount?(a=Math.ceil(e/o.columnCount),s=o.columnCount,l=t*s,d=i*a):o.rowCount&&o.columnCount&&(o.columnCounto.rowCount?"top"===r||"bottom"===r||"custom"===r?(a=Math.ceil(e/o.columnCount),s=o.columnCount,l=t*s,d=i*a):(a=Math.ceil(e/o.columnCount),n=Math.ceil(e/a),s=o.columnCount,l=t*s,d=i*a):"top"===r||"bottom"===r||"custom"===r?(a=Math.ceil(e/o.columnCount),s=Math.ceil(e/o.rowCount),l=t*o.columnCount,d=i*s):(a=o.rowCount,n=Math.ceil(e/a),l=t*n,d=i*a)),d+=this.model.elementSpacing,{LegendWidth:l,LegendHeight:d}},_isEjScroller:function(){var e=this,t=e.model,i=$(e.legendContainer),s=t.legend;s._ejScroller=!ej.util.isNullOrUndefined($("#"+i[0].id).ejScroller)&&s.enableScrollbar},_rowsCalculation:function(e,t){for(var i,s,a,n=this,o=n.model,r=o.legend,l=[],d=e.legendItem.Text.toString(),h=d.split(" "),c=t,u=e.legendItem.LegendStyle.Font,m=r.textOverflow.toLowerCase(),p=h.length,g=0;g0);)i=i.concat(" "+h[g+1]),g++;l.push(i)}else"wrapandtrim"==m?(i=ej.EjSvgRender.utils._trimText(i,c,u),l.push(i),this.model._legendMaxWidth=c):(l.push(i),this.model._legendMaxWidth=Math.max(this.model._legendMaxWidth,s));return this.model._legendMaxHeight=Math.max(this.model._legendMaxHeight,l.length),l},_triggerLegendEvent:function(e,t,i){var s,a,n,o=this,r=o.model,l=r.legend,d=r.AreaType,h=l.itemStyle,c=h.border,u=r.elementSpacing,m=l.textWidth,p=ej.EjSvgRender,g=o.svgRenderer,_=r._visibleSeries.length,f=o.svgObject,u=r.elementSpacing,b=l.textOverflow.toLowerCase(),v={BorderColor:c.color,BorderWidth:c.width,Opacity:l.opacity,Color:t,Font:l.font};return commonEventArgs=$.extend({},p.commonChartEventArgs),commonEventArgs.data={svgRenderer:g,svgObject:f,symbolShape:l.shape,legendItem:{Text:e,Shape:l.shape,LegendStyle:v,SeriesIndex:"none"==d&&1==_?0:i},style:{ShapeSize:h,ElementSpace:u,Style:v,ID:o.svgObject.id+"_LegendItemShape"+i,SeriesIndex:"none"==d&&1==_?0:i,context:!0},gLegendItemEle:o.gLegendItemEle},o._trigger("legendItemRendering",commonEventArgs),s=commonEventArgs.data.legendItem.Text,a=commonEventArgs.data.legendItem.LegendStyle.Font,n=ej.EjSvgRender.utils._measureText(s,null,a).width,"trim"==b?n>m&&(s=ej.EjSvgRender.utils._trimText(s,m,a),this.model._legendMaxWidth=m):("wrap"==b||"wrapandtrim"==b)&&(s=this._rowsCalculation(commonEventArgs.data,m)),{commonEventArgs:commonEventArgs,legendItem:s}},_calculateLegendBounds:function(){var e,t,i;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 s,a,n,o,r,l,d,h,c,u,m,p,g,_,f,b,v,x,w,y,C,S=this,T=S.model,D=Math,I=D.max,k=D.min,P=D.abs,L=T.legend,R=10,M=L.size.height,O=L.size.width,E=L.itemPadding>0?L.itemPadding:0,A=L.position.toLowerCase(),j=0,N=0,z=T.svgHeight,F=T.svgWidth,B=0,H=0,V=0,U=0,W=1,G={},Y=[],X=T.AreaType,q=T._visibleSeries,K=L.rowCount,Q=L.columnCount,Z=T.elementSpacing,J=ej.EjSvgRender.utils._measureText(L.title.text,null,L.title.font),ee=0,te=0,ie=T.border.width,se=L.border.width,ae=L.textOverflow.toLowerCase(),ne=z-(4*Z+2*ie+2*L.border.width),oe=F-(4*Z+2*ie+2*se);if(q&&L.visible&&0!=q.length){if(x=q[0].type.toLowerCase(),"none"==X&&1==q.length||"pyramid"==x||"funnel"==x)for(p=q[0],m=ej.EjSeriesRender.prototype._calculateVisiblePoints(p).legendPoints,g=m.length,t=0;t0?this.model._legendMaxWidth+E+C:b.Width,B),H=I("wrap"==ae||"wrapandtrim"==ae?b.Height*this.model._legendMaxHeight:b.Height,H);for(U=H+2*Z,V=B,(Q||K)&&(legendBounds=S._legendItemBounds(Y.length,B+E,H+E),V=legendBounds.LegendWidth,U=legendBounds.LegendHeight,"top"===A||"bottom"===A||"custom"===A?U=U-E+Z:V-=E),i=0;ioe&&0!=i?(j-=b.Width+E,V=I(V,j),j=b.Width+E,W++,U+=H+E):V=I(V,j),N=I(N,H)):(N+=b.Height+E,N>ne?(N-=b.Height+E,U=I(U,N),N=b.Height+E,V+=B+E):U=I(U,N),j=I(j,B))),v="visible"==s.visibility.toLowerCase()?S.svgRenderer.createGradientElement("legend"+i,Y[i].fill,0,0,0,ne,S.gLegendEle):"gray",s.CommonEventArgs.data.legendItem.LegendStyle.Color=v,n=K||Q?{Width:B,Height:H}:b,s.isTrendLine&&(s.TrendLineIndex=s.trendLineIndex,c=p.trendlines[s.trendLineIndex].type.toLowerCase(),s.CommonEventArgs.data.legendItem.drawType=s.drawType="linear"==c||"movingaverage"==c?"line":"spline"),Y[i].Bounds=n,T.legendCollection.push(s);"top"===A||"bottom"===A||"custom"===A?(V=J.width>V-E?J.width+2*R+E:V+2*R,j+=R,N+=2*R,T.LegendBounds={Width:I(V,j)-E,Height:I(U,N),Rows:W}):(V=J.width>V?J.width+2*R:V+2*R,j+=R,N+=R,T.LegendBounds={Width:I(V,j),Height:I(U,N)+R-E,Columns:W}),T.LegendViewerBounds={Width:"0",Height:"0"},""==M||null==M?(o=P("left"==A||"right"==A||"custom"==A?z:z/100*parseInt("20%")),T.LegendViewerBounds.Height=k(o,T.LegendBounds.Height)):T.LegendViewerBounds.Height=M.indexOf("%")!=-1?P(z/100*parseInt(M)):parseInt(M),""==O||null==O?(r=P("top"==A||"bottom"==A||"custom"==A?F:F/100*parseInt("20%")),T.LegendViewerBounds.Width=k(r,T.LegendBounds.Width)):T.LegendViewerBounds.Width=O.indexOf("%")!=-1?P(F/100*parseInt(O)):parseInt(O)}else T.LegendBounds={Width:0,Height:0},T.LegendViewerBounds={Width:0,Height:0};legendContainer=$(S.legendContainer),legendSvgContainer=$(S.legendSvgContainer),L.enableScrollbar?(T.LegendActualBounds=T.LegendViewerBounds,legendContainer.removeAttr("style"),legendContainer.css({visibility:"hidden",width:T.LegendViewerBounds.Width,height:T.LegendViewerBounds.Height}),legendSvgContainer.css({height:T.LegendBounds.Height,width:T.LegendBounds.Width}),L._ejScroller?$("#"+legendContainer[0].id).ejScroller({width:T.LegendViewerBounds.Width,height:T.LegendViewerBounds.Height}):legendContainer.css({overflow:"scroll"}),T.LegendBounds.Width>T.LegendViewerBounds.Width&&T.LegendBounds.Height>T.LegendViewerBounds.Height?L._ejScroller?(te=$(".e-hscrollbar").height(),ee=$(".e-vscrollbar").width()):(legendContainer.css({overflow:"scroll"}),te=legendContainer[0].offsetHeight-2*se-legendContainer[0].clientHeight,ee=legendContainer[0].offsetWidth-2*se-legendContainer[0].clientWidth):T.LegendBounds.Width>T.LegendViewerBounds.Width?L._ejScroller?(te=$(".e-hscrollbar").height(),ee=0):(legendContainer[0].style.overflowX="scroll",legendContainer[0].style.overflowY="hidden",te=legendContainer[0].offsetHeight-2*se-legendContainer[0].clientHeight,ee=0):T.LegendBounds.Height>T.LegendViewerBounds.Height&&(L._ejScroller?(te=0,ee=$(".e-vscrollbar").width()):(legendContainer[0].style.overflowY="scroll",legendContainer[0].style.overflowX="hidden",te=0,ee=legendContainer[0].offsetWidth-2*se-legendContainer[0].clientWidth))):(T.LegendActualBounds=T.LegendBounds,""!=O&&null!=O&&(T.LegendActualBounds.Width=parseInt(O)),""!=M&&null!=M&&(T.LegendActualBounds.Height=parseInt(M))),T.LegendActualBounds.Height+=Math.abs(te),T.LegendActualBounds.Width+=Math.abs(ee),T.LegendActualBounds.hScrollSize=te,T.LegendActualBounds.vScrollSize=ee},GetPointXYOrgin:function(e,t,i,s){var a=(e-i)/(this.model.axes.PrimaryXaxis.visibleRange.max-i)*this.model.m_AreaBounds.Width,n=(t-s)/(this.model.axes.PrimaryYaxis.visibleRange.max-s)*(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:a,Y:n}},_drawChartAreaRect:function(){var e,t,i,s=this.model.background&&this.model.background._gradientStop?"url(#"+this.svgObject.id+"_backGradient)":this.model.background;this.model.backGroundImageUrl&&(s="transparent"),e=this.model.border,t={id:this.svgObject.id+"_SvgRect",x:e.width/2,y:e.width/2,width:$(this.svgObject).width()-2*e.width,height:$(this.svgObject).height()-2*e.width,fill:s,opacity:e.opacity,"stroke-width":e.width,stroke:e.color},this.svgRenderer.drawRect(t,this.svgObject),this.model.backGroundImageUrl&&this._drawBackImage(),"cartesianaxes"!=this.model.AreaType||this.model.enable3D||(i={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},this.svgRenderer.drawRect(i,this.svgObject))},axesIndexCount:function(e,t){for(var i,s=[],a=0;at)for(t=o,i=0;i=this.model.m_AreaBounds.Y;o-=n)r.push(o);return r},_calColumnSize:function(){var e,t,i,s,a,n,o,r,l=[],d=this.model.m_AreaBounds.X,h=this.model.m_AreaBounds.Width,c=0,u=this.model._columnDefinitions;if(null!=u[0].columnDefinitions)for(e=0,t=u.length;e=m+C.columnSpan?m+C.columnSpan:m+1,_=c[i],D||0!=f||(d=v),D&&0==b&&(h=x)}else _=c[m+1],d=!0,h=!0;C.Location={},C.Location.X1=g+C.plotOffset,C.Location.Y1=S,C.Location.X2=_-C.plotOffset,C.Location.Y2=S,C.x=C.Location.X1,C.y=C.Location.Y1,C.width=C.Location.X2-C.Location.X1,C.height=C.Location.Y2-C.Location.Y1}}for(d=!0,h=!0,s=this._calRowSize(),a=this.model._rowDefinitions,m=0,n=a.length;m=m+z.rowSpan?m+z.rowSpan:m+1,k=s[l],D||0!=P||(d=R),D&&0==L&&(h=M)}else k=s[m+1],d=!0,h=!0;z.Location={},z.Location.X1=N,z.Location.Y1=I-z.plotOffset,z.Location.X2=N,z.Location.Y2=k+z.plotOffset,z.x=z.Location.X1,z.y=z.Location.Y2,z.height=z.Location.Y1-z.Location.Y2,z.width=z.axisLine.width}}},_validateCrossing:function(e){if(e._opposedPosition=!1,null!=e.crossesAt){var t=this._getCrossAxis(this.model._axes,"horizontal"==e.orientation.toLowerCase(),e.crossesInAxis);return e._crossValue=this._getCrossValue(e,t,t._valueType),((t.isInversed?!e.opposedPosition:e.opposedPosition)?e._crossValue<=t.visibleRange.min:e._crossValue>=t.visibleRange.max)&&(e._opposedPosition=!0),t.visibleRange.mine._crossValue}return!1},_axisCrossing:function(e,t,i){var s="horizontal"==e.orientation.toLowerCase(),a=this._getCrossAxis(this.model._axes,s,e.crossesInAxis),n=e._crossValue,o=Math.abs((a.isInversed?a.visibleRange.max:a.visibleRange.min)-n);this._locateAxis(e,a,s,o),t||(i._crossAxisOverlap=this._avoidOverlapping(e,this.model.m_AreaBounds,s,e.opposedPosition,i)||i._crossAxisOverlap)},_locateAxis:function(e,t,i,s){var a=(i?t.height:t.width)*s/t.visibleRange.delta;i?e.y=t.y+t.height-a:e.x=t.x+a},_avoidOverlapping:function(e,t,i,s,a){var n=0,o=a.axes[e.name]._bounds;if(i){if(!s&&e.y+o>t.Y+t.Height)return t.Height-=n=e.y+o-t.Y-t.Height,this._recalculateSpace(e,i,s,n),!0;if(s&&e.y-ot.X+t.Width)return t.Width-=n=e.x+o-t.X-t.Width,this._recalculateSpace(e,i,s,n),!0}},_recalculateSpace:function(e,t,i,s){var a,n,o,r,l,d,h,c;if(t){for(n=this.model._rowDefinitions,o=i?n.length-1:0,l=0,d=n[o].axis.length;l0)for(t=0;t0)for(r=0;r=o&&e[l].axis.splice(o,0,s)},_axisFilter:function(e,t){var i=[];return e.filter(function(e){for(var s=ej.DataManager(e.axis,ej.Query().where(t,">",1)).executeLocal(),a=0,n=s.length;a2*l?o-l:o:"vertical"==axis.orientation.toLowerCase()&&("polaraxes"!=this.model.AreaType?(i=ej.util.isNullOrUndefined(this.model.rowDefinitions)?[]:this.model.rowDefinitions[axis.rowIndex],s=d,i&&(i.unit=void 0==i.unit?"percentage":i.unit,i.rowHeight=void 0==i.rowHeight?100:i.rowHeight,"percentage"==i.unit.toLowerCase()?(a=this._axisRowDefinitionSize(this.model.rowDefinitions),s=Math.floor(d*(i.rowHeight/a))):s=i.rowHeight),axis.length=axis.rowSpan?axis.rowSpan*s:s):axis.length=l/2)},_axisRowDefinitionSize:function(e){var t,i=0;if(e)for(t=0;t100?i:100},_axisColumnDefinitionSize:function(e){var t,i=0;if(e)for(t=0;t100?i:100},_axisMeasure:function(e,t,i,s){var a,n,o=0,r=0;return e.axisLine.width=e.axisLine.width<0?0:e.axisLine.width,e.majorTickLines.size=e.majorTickLines.size<0?0:e.majorTickLines.size,a=!this.model.enable3D&&e.axisLine.visible&&e.axisLine.width,n=ej.EjSvgRender.utils._measureText(e.title.text,t,e.title.font),"vertical"==i?(r=e._LableMaxWidth.width,o=""!=e.title.text&&e.title.visible&&e.visible?8===document.documentMode?n.width:n.height+2*this.model.elementSpacing:0):(r=e._LableMaxWidth.height,o=""!=e.title.text&&e.title.visible&&e.visible?n.height+this.model.elementSpacing:0),e.AxisMaxWidth=0==s&&"inside"==e.tickLinesPosition&&"inside"==e.labelPosition?o+a+this.model.elementSpacing:0==s&&"inside"==e.tickLinesPosition&&"inside"!=e.labelPosition?o+a+this.model.elementSpacing+r:0==s&&"inside"!=e.tickLinesPosition&&"inside"==e.labelPosition?o+a+this.model.elementSpacing+e.majorTickLines.size:o+a+this.model.elementSpacing+e.majorTickLines.size+r,e.AxisMaxWidth},_arraySum:function(e){for(var t=0,i=0;i").attr("id","legend_"+this._id).css("height","0px"),this.scrollerContainer=e("
      ").attr("id","legend_Scroller"+this._id).css("height","0px"),this.legendSvgContainer=this.svgRenderer.createLegendCanvas(this.element),this.svgRenderer.append(this.legendSvgContainer,this.scrollerContainer),e(this.scrollerContainer).appendTo(this.legendContainer),e(this.legendContainer).appendTo(this.chartContainer)):this.svgObject.id.indexOf("_canvas")!=-1?(this._removeZoomkit(),e(this.svgObject).remove(),this.svgRenderer=new t.EjSvgRender(this.element),this.svgObject=this.svgRenderer.svgObj,this.canvasX=this.canvasY=0,e(this.scrollerContainer).remove(),e(this.legendSvgContainer).remove(),e(this.legendContainer).remove(),this.legendContainer=e("
      ").attr("id","legend_"+this._id).css("height","0px"),this.scrollerContainer=e("
      ").attr("id","legend_Scroller"+this._id).css("height","0px"),this.legendSvgContainer=this.svgRenderer.createLegendSvg(this.element),this.svgRenderer.append(this.legendSvgContainer,this.scrollerContainer),e(this.scrollerContainer).appendTo(this.legendContainer),e(this.legendContainer).appendTo(this.chartContainer)):(e(this.svgObject).empty(),e(this.legendSvgContainer).empty()),e("#annotation_group_"+this._id).remove(),i||(this.model.canResize||this.model.isResponsive?this.bindResizeEvents():this.removeResizeEvents()),this.bindTo(i)},export:function(e,i,s){var a,n=this.model.exportSettings,e=t.util.isNullOrUndefined(e)?n.type:e.toLowerCase(),i=t.util.isNullOrUndefined(i)?n.action:i.toLowerCase();return"xlsx"==e?this.excelExport(e,i,s):a="svg"==e?this.svgExport():this.imageExport(),a},excelExport:function(i,s,a){var n,o,r,l,d,h=e.extend(!0,{},this.model),c=this.model.exportSettings,a=t.util.isNullOrUndefined(i)?c.multipleExport:a,u={action:s,method:"post"},m=t.buildTag("form","",null,u),p=this;if(this._ignoreOnExport)for(n=h.series,o=0;o").append(e("#"+o).clone()).html(),position=e("#legend_"+this._id).position(),element=e("#"+o+"_Legend").attr("transform","translate("+position.left+","+position.top+")"),legend=e("
      ").append(e("#legend_"+o).clone()).html(),exporting=this.model.exportSettings,angle=exporting.angle,content='',chartWidth=e("#"+this._id).width(),chartHeight=e("#"+this._id).height(),content=0==angle?content+svg.toString()+legend.toString()+"":90==angle?content+''+svg.toString()+legend.toString()+"":angle==-90?content+''+svg.toString()+legend.toString()+"":content+''+svg.toString()+legend.toString()+"",content=encodeURIComponent(content),e("#"+o+"_Legend").removeAttr("transform"),"client"==exporting.mode?content:void(t.raiseWebFormsServerEvents?this.raiseWebServerEvents(content):"server"==exporting.mode&&(i={action:exporting.action,method:"post"},s=t.buildTag("form","",null,i),chartModel={name:"ChartModel",type:"hidden",value:JSON.stringify(r)},input1=t.buildTag("input","",null,chartModel),a={name:"Data",type:"hidden",value:content},n=t.buildTag("input","",null,a),s.append(n).append(input1).append(this),e("body").append(s),s.submit()))},raiseWebServerEvents:function(i,s){var a=e.extend(!0,{},this.model),n=this.model.exportSettings,s=t.util.isNullOrUndefined(s)?"exporting":s;args={model:a,originalEventType:s},clientArgs={Data:i,Format:n.type,Orientation:n.orientation,FileName:n.fileName},t.raiseWebFormsServerEvents(s,args,clientArgs)},animate:function(e){var t,i,s,a;if(e)if(e.constructor===Array)for(a=0;a15?(this.startX=this._startX-e,this.offsetLeftX=this.startX,this._offsetRightX=this.startX+this.rectWidth,this.offsetRightX=this._offsetRightX,this.endX=this.scrollWidth-this.offsetRightX):(this.startX=15,this.offsetLeftX=this.startX,this._offsetRightX=this.startX+this.rectWidth,this.offsetRightX=this._offsetRightX,this.endX=this.scrollWidth-this.offsetRightX)},_calculateScrollRightMove:function(e){this._offsetRightX+Math.abs(e)=p?t:p,t=t>=p&&ta.min?n:a.min,"datetime"==d?(r=this.startDateTime,l=this.endDateTime,this.endDateTime=o=new Date(n),n=this.startDateTime):(r=parseInt(this.startValue),l=parseInt(this.endValue),this.endValue=o=Math.ceil(n),n=this.startValue)):(n=a.min+i*a.delta,n=n>a.min?n:a.min,"datetime"==d?(r=this.startDateTime,l=this.endDateTime,this.startDateTime=n=new Date(n),o=this.endDateTime):(r=parseInt(this.startValue),l=parseInt(this.endValue),this.startValue=n=Math.ceil(n),o=this.endValue)),c=e.extend({},ej.EjSvgRender.commonChartEventArgs),c.data={zoomPosition:i,zoomFactor:s,oldRange:{start:r,end:l},newRange:{start:n,end:o}},this._scrollChanged=!0,this.scrollZoomPos=i,this.scrollZoomFact=s,c;if(this.rightScrollbarClicked)return a=this._scrollRange,s=this.rectWidth/(this.scrollWidth-m),i=this.scrollZoomPos,d=this.model.valueType.toLowerCase(),this.model.enableRTL?(o=a.min+i*a.delta,"datetime"==d?(r=this.startDateTime,l=this.endDateTime,this.startDateTime=n=new Date(o),o=this.endDateTime):(r=parseInt(this.startValue),l=parseInt(this.endValue),this.startValue=n=Math.ceil(o),o=this.endValue)):(h=a.min+i*a.delta,o=h+s*a.delta,"datetime"==d?(r=this.startDateTime,l=this.endDateTime,this.endDateTime=o=new Date(o),n=this.startDateTime):(h=a.max-i*a.delta,o=h-s*a.delta,r=parseInt(this.startValue),l=parseInt(this.endValue),this.endValue=o=Math.ceil(o),n=this.startValue)),c=e.extend({},ej.EjSvgRender.commonChartEventArgs),c.data={zoomPosition:this.scrollZoomPos?this.scrollZoomPos:0,zoomFactor:s,oldRange:{start:r,end:l},newRange:{start:n,end:o}},this._scrollChanged=!0,this.scrollZoomFact=s,c;if(this.scrollRectClicked){if(u=this.mouseDownPos-t,u>0&&this.offsetLeftX>=0)return this.scrollbarContainer._calculateScrollLeftMove.call(this,u),this.scrollbarContainer._calculateRange.call(this,this.startX,this.offsetRightX);if(u<0)return this.scrollbarContainer._calculateScrollRightMove.call(this,u),this.scrollbarContainer._calculateRange.call(this,this._startX,this.offsetRightX)}},_scrollbarMove:function(t){var i,s,a;if(this.moveClientX=t.clientX,this.moveClientX!=this.downClientX){var n,o,r=8,l=34,d=this.model.padding||0,h=jQuery.uaMatch(navigator.userAgent);n=this.svgSupport&&"[object TouchEvent]"!==t.originalEvent.toString()&&"msie"!=h.browser.toLowerCase()||!this.svgSupport?this.calMousePosition(t).X-d:this.calTouchPosition(t).X-d,this.mouseX=n,i=this._id,this.leftScrollbarClicked&&((n>l||n>23)&&nthis.offsetRightX-l&&(this.rectWidth=42.89984101748814)),this.rightScrollbarClicked&&(n<=this.scrollWidth-l||n<=this.scrollWidth-23)&&n>this.offsetLeftX+l&&(this.rectWidth=n-this.offsetLeftX+r,o=this.offsetLeftX+this.rectWidth/2-7.5,e("#"+i+"_scrollbarRightHeader").attr("cx",n),e("#"+i+"_rightHeaderHideRect").attr("x",n-7.5),e("#"+i+"_scrollbarSelect").attr("width",this.rectWidth),e("#"+i+"_scrollbarCenterLine").attr("transform","translate("+o+")"),e("#"+i+"_scrollbarRightHeader").css("left",n),e("#"+i+"_rightHeaderHideRect").css("left",n-7.5),e("#"+i+"_scrollbarSelect").css("width",this.rectWidth),e("#"+i+"_scrollbarCenterLine").css("left",o),this.offsetRightX=n+r,this.endX=this.scrollWidth-n-r,this.scrollbarContainer._calculateScrollPosition.call(this,n),this.scrollbarContainer._scrollStartArgs.call(this),this.scrollbarContainer._scrollChangeArgs.call(this)),this.scrollRectClicked&&(s=this.mouseDownPos-n,s>0&&this.offsetLeftX>=0&&(this.scrollbarContainer._calculateScrollLeftMove.call(this,s),this.scrollbarContainer._setScrollPosition.call(this,this.startX,this.offsetRightX),this.offsetLeftX>15&&(this.scrollbarContainer._scrollStartArgs.call(this),this.scrollbarContainer._scrollChangeArgs.call(this))),s<0&&(this.scrollbarContainer._calculateScrollRightMove.call(this,s),this.scrollbarContainer._setScrollPosition.call(this,this._startX,this._startX+this.rectWidth),this.offsetRightX-1&&navigator.vendor.toLowerCase().indexOf("google")>-1,(!o||o&&(this.leftScrollbarClicked||this.rightScrollbarClicked)&&this.downClientX!=this.moveClientX||this.scrollRectClicked||this.leftArrowClicked||this.rightArrowClicked)&&(!this.leftScrollbarClicked&&!this.rightScrollbarClicked||(this.leftScrollbarClicked||this.rightScrollbarClicked)&&Math.ceil(this.rectWidth)!=Math.ceil(this.rectOldWidth)&&(Math.abs(this.rectWidth-this.rectOldWidth)>4||!this.rectOldWidth))&&(this._previousStart&&this._previousStart==a&&this._previousEnd==n||(this._trigger("scrollEnd",r),this._scrollStarted=!1,this._previousStart=a,this._previouEnd=n,this.rectOldWidth=this.rectWidth,this.scrollUpdate?this.scrollUpdate=!1:this.scrollbarContainer._appendScrollRange.call(this))))),this.leftScrollbarClicked=!1,this.rightScrollbarClicked=!1,this.scrollRectClicked=!1,this.leftArrowClicked=!1,this.rightArrowClicked=!1},_leftScrollbarDown:function(e){e.preventDefault(),this.leftScrollbarClicked=!0,this.downClientX=e.clientX},_rightScrollbarDown:function(e){e.preventDefault(),this.rightScrollbarClicked=!0,this.downClientX=e.clientX},_scrollSelectRectDown:function(e){var t,i,s;e.preventDefault(),t=jQuery.uaMatch(navigator.userAgent),i=this.model.padding||0,s=this.svgSupport&&"[object TouchEvent]"!==e.originalEvent.toString()&&"msie"!=t.browser.toLowerCase()||!this.svgSupport?this.calMousePosition(e).X-i:this.calTouchPosition(e).X-i,this.mouseDownPos=s,this._startX=this.startX=this.offsetLeftX,this._offsetRightX=this.offsetRightX,this.scrollRectClicked=!0},_scrollMouseWheel:function(e){e.preventDefault();var t=!!navigator.userAgent.match(/Trident\/7\./),i=e.originalEvent.wheelDelta,s=jQuery.uaMatch(navigator.userAgent),a="mozilla"==s.browser.toLowerCase()?t?i/120>0?1:-1:-e.originalEvent.detail/3>0?1:-1:i/120>0?1:-1,n=Math.max(1/ej.EjSvgRender.utils._minMax(this.scrollZoomFact,0,1),1),o=Math.max(n+.25*a,1);this.scrollbarContainer.doMouseWheelZoom.call(this,o,.5)},_scrollStartArgs:function(){if(this._scrollStarted=!0,""!=this.model.scrollStart){var t=e.extend({},ej.EjSvgRender.commonChartEventArgs);t.data={startRange:"datetime"==this.model.valueType?this.startDateTime:this.startValue,endRange:"datetime"==this.model.valueType?this.endDateTime:this.endValue},this._trigger("scrollStart",t)}},_scrollChangeArgs:function(){if(!this.model.enableDeferredUpdate||""!=this.model.scrollChanged){var e=this.scrollbarContainer._calculateRange.call(this,this.offsetLeftX,this.offsetRightX);""!=this.model.scrollChanged&&this._trigger("scrollChanged",e),this.model.enableDeferredUpdate||(this.scrollUpdate?this.scrollUpdate=!1:this.scrollbarContainer._appendScrollRange.call(this))}},_scrollEndArgs:function(e){var t,i,s,a,n,o,r;""!=this.model.scrollEnd&&(t=this.scrollbarContainer._calculateRange.call(this,e,this.offsetRightX),t&&this._scrollStarted&&(i=t.data.oldRange,s=t.data.newRange,"datetime"==this.model.valueType.toLowerCase()?(a=Date.parse(i.start),o=Date.parse(s.start),n=Date.parse(i.end),r=Date.parse(s.end)):(a=i.start,o=s.start,n=i.end,r=newdRange.end),(a!=o||n!=r||this.leftScrollbarClicked||this.rightScrollbarClicked)&&this._trigger("scrollEnd",t),this._scrollStarted=!1,this.scrollUpdate?this.scrollUpdate=!1:this.scrollbarContainer._appendScrollRange.call(this)))},doMouseWheelZoom:function(e,t){if(e>=1){var i=this.scrollbarContainer.calZoomFactors(e,t,this.scrollZoomFact,this.scrollZoomPos);this.scrollZoomPos!=i.zoomMPosition&&i.zoomMPosition+this.scrollZoomFact<=1&&this.scrollZoomPos>=0&&(i.zoomMPosition+this.scrollZoomFact>=1&&(i.zoomMPosition=1-this.scrollZoomFact),i.zoomMPosition<0&&(i.zoomMPosition=0),this.scrollZoomPos=i.zoomMPosition,this.startX=this.scrollZoomPos*this.scrollWidth+15,this.startX=this.startX+this.rectWidth+5>this.scrollWidth?this.scrollWidth-this.rectWidth-15:this.startX,this.offsetLeftX=this.startX,this._offsetRightX=this.startX+this.rectWidth,this.offsetRightX=this._offsetRightX,this.endX=this.scrollWidth-this.offsetRightX,this.scrollbarContainer._setScrollPosition.call(this,this.startX,this.offsetRightX),this.scrollbarContainer._calculateMouseWheelRange.call(this,this.startX,this.offsetRightX))}return!1},_calculateMouseWheelRange:function(){var t,i,s,a;this.scrollZoomFact=this.rectWidth/(this.scrollWidth-30),t=this._scrollRange,this.model.enableRTL?(s=t.max-this.scrollZoomPos*t.delta,i=s-this.scrollZoomFact*t.delta):(i=t.min+this.scrollZoomPos*t.delta,s=i+this.scrollZoomFact*t.delta),"datetime"==this.model.valueType?(this.startDateTime=i=new Date(i),this.endDateTime=s=new Date(s)):(this.startValue=i=Math.ceil(i),this.endValue=s=Math.ceil(s)),a=e.extend({},ej.EjSvgRender.commonChartEventArgs),a.data={zoomPosition:this.scrollZoomPos,zoomFactor:this.scrollZoomFact,oldRange:{start:this.model.scrollRangeSettings.start,end:this.model.scrollRangeSettings.end},newRange:{start:i,end:s}},this._scrollChanged=!0,this._scrollStarted=!1,this._trigger("scrollEnd",a),this.scrollUpdate?this.scrollUpdate=!1:this.scrollbarContainer._appendScrollRange.call(this)},calZoomFactors:function(e,t,i,s){var a,n;return 1==e?(a=1,n=0):(a=ej.EjSvgRender.utils._minMax(1/e,0,1),n=s+(i-a)*t),{zoomMFactor:a,zoomMPosition:n}},_leftArrowDown:function(){this.leftArrowClicked=!0,this._startX=this.startX=this.offsetLeftX,this._offsetRightX=this.offsetRightX,this.leftIncrement=5;var e=this;this.interval=setInterval(function(){e.scrollbarContainer.leftArrowRecursive.call(e)},50)},_leftArrowUp:function(){this.leftArrowClicked=!1,this.scrollbarContainer.leftArrowRecursive.call(this)},leftArrowRecursive:function(){if(this.leftArrowClicked){this._id;this.scrollbarContainer._calculateScrollLeftMove.call(this,this.leftIncrement),this._scrollStarted=!0,this.startX>15&&this.scrollbarContainer._scrollEndArgs.call(this,this.startX),this.scrollbarContainer._setScrollPosition.call(this,this.startX,this.offsetRightX),this.leftIncrement+=5}else clearInterval(this.interval),this.leftIncrement=0},_rightArrowDown:function(){this.rightArrowClicked=!0,this._startX=this.startX=this.offsetLeftX,this._offsetRightX=this.offsetRightX,this.rightIncrement=-5;var e=this;this.interval=setInterval(function(){e.scrollbarContainer.rightArrowRecursive.call(e)},50)},_rightArrowUp:function(){this.rightArrowClicked=!1,this.scrollbarContainer.rightArrowRecursive.call(this)},rightArrowRecursive:function(){if(this.rightArrowClicked){this._id;this.scrollbarContainer._calculateScrollRightMove.call(this,this.rightIncrement),this._scrollStarted=!0,this.offsetRightXthis.offsetRightX?(e=(e"),s=0,a=0;null!=this.model.scales[a];a++){for(null==this.model.scales[a].minimum&&(this.model.scales[a].minimum=this.minimum()),null==this.model.scales[a].maximum&&(this.model.scales[a].maximum=this.maximum()),n=0;null!=this.model.scales[a].pointers[n];n++)null==this.model.scales[a].pointers[n].value&&(this.model.scales[a].pointers[n].value=this.value());for(o=0;null!=this.model.scales[a].customLabels[o];o++)if(s++,null!=this.model.scales[a].customLabels[o].value&&0==i.GaugeEl.find("div").length)if(null!=this.model.scales[a].customLabels[o]&&null!=this.model.scales[a].customLabels[o].positionType&&"outer"==this.model.scales[a].customLabels[o].positionType)if(i.outerDiv=t.buildTag("div"),"bottom"==i.model.outerCustomLabelPosition)i.GaugeEl.append(i.canvasEl),i.GaugeEl.append(i.outerDiv),i.outerDiv.css("text-align","center");else if("top"!=i.model.outerCustomLabelPosition){r=t.buildTag("TABLE"),r.css("width","100%");var d=t.buildTag("TR"),h=t.buildTag("TD"),c=t.buildTag("td");"left"==i.model.outerCustomLabelPosition?(h.append(i.outerDiv),c.append(i.canvasEl)):(h.append(i.canvasEl),c.append(i.outerDiv)),d.append(h),d.append(c),r.append(d),i.GaugeEl.append(r),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);0==s&&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, this._isHalfCircle&&this._isHalfCircle())if(i.model.frame.halfCircleFrameEndAngle-i.model.frame.halfCircleFrameStartAngle>=180){if(0==i.model.frame.halfCircleFrameStartAngle)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(90==i.model.frame.halfCircleFrameStartAngle)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(180==i.model.frame.halfCircleFrameStartAngle)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(270==i.model.frame.halfCircleFrameStartAngle&&90==i.model.frame.halfCircleFrameEndAngle)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(0==i.model.frame.halfCircleFrameStartAngle)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(90==i.model.frame.halfCircleFrameStartAngle)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(180==i.model.frame.halfCircleFrameStartAngle)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(270==i.model.frame.halfCircleFrameStartAngle)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}l=i.canvasEl[0],"undefined"!=typeof G_vmlCanvasManager&&(l=window.G_vmlCanvasManager.initElement(l)),l&&l.getContext&&(i.contextEl=i.canvasEl[0].getContext("2d"))},_wireEvents:function(){this.startEv="mousedown",this.moveEv="mousemove",this.endEv="mouseup",this.scrollEv="wheel",this.onMouseMoveHandler=e.proxy(this._onMouseMove,this),this.onMouseUpHandler=e.proxy(this._onMouseUp,this),this.onMouseDownHandler=e.proxy(this._onMouseDown,this),this.onHoverOCustomLabel=e.proxy(this._onHoverOCustomLabel,this),this.onLeaveOCustomLabel=e.proxy(this._onLeaveOCustomLabel,this),(this.model.tooltip.showCustomLabelTooltip||this.model.tooltip.showLabelTooltip)&&(e(this.canvasEl).bind(this.moveEv,this.onMouseMoveHandler),e(this.canvasEl).bind(this.scrollEv,this.onMouseMoveHandler)),this.model.readOnly||e(this.canvasEl).bind(this.startEv,this.onMouseDownHandler),this.model.tooltip.showCustomLabelTooltip&&(e("."+this._id+"outercustomlbl").bind("mouseenter",this.onHoverOCustomLabel),e("."+this._id+"outercustomlbl").bind("mouseleave",this.onLeaveOCustomLabel))},_unWireEvents:function(){e(this.canvasEl).unbind(this.startEv,this.onMouseDownHandler)},_onHoverOCustomLabel:function(e){(null!=e.currentTarget.innerHTML||""!=e.currentTarget.innerHTML)&&this._showTooltip(e,e.currentTarget.innerHTML)},_onLeaveOCustomLabel:function(){this._hideTooltip()},_showTooltip:function(t,i){var s,a=i+"",n=e(".tooltipDiv");0==n.length&&(n=e("
      "),e(document.body).append(n)),""!=this.model.tooltip.templateID&&null!=this.model.tooltip.templateID?(s=e("#"+this.model.tooltip.templateID).clone(),e(".tooltipDiv")[0].innerHTML="",e(s).css("display","block").appendTo(n),e(n).css({"background-color":this.model.backgroundColor,border:"1px solid #bbbcbb","border-radius":"3px",color:"#565656"}),n.html(n.html().replace("#label#",a))):(e(n).html(a),e(n).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 o=10,r=t.pageX+o,l=t.pageY+o;r=r+e(n).width()360&&(h-=360);var c=h+d.width,u=h-d.width,m=Math.sqrt((n.x-a.x)*(n.x-a.x)+(n.y-a.y)*(n.y-a.y)),p=m<("far"==d.placement?i+d.width+d.distanceFromScale:"center"==d.placement?i-d.distanceFromScale:i-15-s-d.distanceFromScale)&&m>("far"==d.placement?i+d.distanceFromScale:"center"==d.placement?i-d.width-d.distanceFromScale:i-d.width-15-s-d.distanceFromScale),g="needle"==d.type?m<=d.length:p;r._isBetween(u,c,o)&&g&&(r._onMouseClick(h,l.value),r.activeElement=d,e(document).bind(r.moveEv,r.onMouseMoveHandler),e(document).bind(r.endEv,r.onMouseUpHandler))}))})},_onMouseUp:function(){this._mouseDown=!1,e(document).unbind(self.moveEv,self.onMouseMoveHandler),e(document).unbind(self.endEv,self.onMouseUpHandler),this._onMouseClickUp(this._getAngle(this.activeElement.value),this.activeElement.value),this.activeElement=null},_onMouseMove:function(i){var s,a,n;if(this._mouseDown&&!t.isNullOrUndefined(this.activeElement)){this._blockDefaultActions(i);var o={x:this.centerX,y:this.centerY},r={x:i.pageX-e(this.canvasEl).offset().left,y:i.pageY-e(this.canvasEl).offset().top},l=180*this._getCirucumferenceAngle(o,r)/Math.PI;lthis._savedPoints[a].startX&&n.Xthis._savedPoints[a].startY&&n.Yi.length?s:i,n=e('').css({font:t,display:"none",whiteSpace:"nowrap"}).appendTo(e("body")).text(a).width();return e("#test").remove(),n/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(e,t,i){return e+t*Math.cos(Math.PI*(i/180))},_getYCordinate:function(e,t,i){return e+t*Math.sin(Math.PI*(i/180))},_getAngle:function(e){var t;return t=e>=this.scaleEl[this.scaleIndex].minimum&&e<=this.scaleEl[this.scaleIndex].maximum?"clockwise"==this.scaleEl[this.scaleIndex].direction?e-this.scaleEl[this.scaleIndex].minimum:this.scaleEl[this.scaleIndex].maximum-e:"clockwise"==this.scaleEl[this.scaleIndex].direction?e<=this.scaleEl[this.scaleIndex].minimum?this.scaleEl[this.scaleIndex].minimum:this.scaleEl[this.scaleIndex].maximum:e<=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(e,t){var i,s,a,n,o=e.toString(),r=t.toString();return i=o.indexOf(".")>-1?o.length-o.indexOf(".")-1:0,s=r.indexOf(".")>-1?r.length-r.indexOf(".")-1:0,a=i>s?i:s,n=(e*Math.pow(10,a)-t*Math.pow(10,a))/Math.pow(10,a)},_getCirucumferenceAngle:function(e,t){return t.x>e.x?t.y>e.y?this._tangent(e,t):t.y==e.y?0:2*Math.PI+this._tangent(e,t):t.x==e.x?t.y==e.y?0:t.y>e.y?Math.PI/2:1.5*Math.PI:t.y==e.y?Math.PI:t.y>e.y?Math.PI+this._tangent(e,t):Math.PI+this._tangent(e,t)},_calcDistanceFactor:function(e,t,i){var s;return s=e>240&&e<=300||e>60&&e<=120?0:e>330&&e<=360||e>=0&&e<=30?.5*-i:e>30&&e<=60||e>300&&e<=330?-i/2:e>150&&e<=210?.5*i:i/2,"far"==t?-s:s},_tangent:function(e,t){var i=(t.y-e.y)/(t.x-e.x);return Math.atan(i)},_getValue:function(e){return"counterclockwise"==this.scaleEl[this.scaleIndex].direction?(e-this.scaleEl[this.scaleIndex].startAngle)/this.scaleEl[this.scaleIndex].sweepAngle*(this.scaleEl[this.scaleIndex].maximum-this.scaleEl[this.scaleIndex].minimum):(e-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 t,i,s,a,n=this;if(this.scaleEl=this.model.scales,e.each(this.model.scales,function(e,t){n.scaleIndex=e,t.showScaleBar&&n._setScaleCordinates(t)}),"rear"==this.model.rangeZOrder?(this._setRanges(),this._setTicks()):(this._setTicks(),this._setRanges()),this._setLabels(),this._subGauge(),this._setCustomLabel(),this._setPointers(),this.contextEl.putImageData||(this.model.enableAnimation=!1),null!=this.model.animationSpeed&&this.model.animationSpeed>0&&(t=this.model.animationSpeed/25,t>=0&&(i=navigator.userAgent.toLowerCase(),s=i.indexOf("msie")!=-1?parseInt(i.split("msie")[1]):0,this.model.enableAnimation&&9!=s))){for(a=0;ao&&i>n.currentValue[d]?(n.currentValue[d]=n.currentValue[d]+(n.model.scales[0].maximum-n.model.scales[0].minimum)/100,i>n.currentValue[d]?n.setPointerValue(0,d,n.currentValue[d]):n.setPointerValue(0,d,i),n.dt=now-delta%o):n.currentValue>=i&&(l[d]=!1);for(s=0;se?(e+=(s.model.scales[0].maximum-s.model.scales[0].minimum)/100,t>e?s.setPointerValue(0,0,e):s.setPointerValue(0,0,t)):e>=t&&window.clearInterval(s.timer),s._pointInterval(e,t,i,s)},i)},_setRanges:function(){var t=this;e.each(this.model.scales,function(i,s){s.showRanges&&(t.scaleIndex=i,null!=s.ranges&&(t.rangeEl=s.ranges,e.each(s.ranges,function(e,i){t.rangeIndex=e,t._setRangeCordinates(e,i)})))})},_setCustomLabel:function(){var t=this;e.each(this.model.scales,function(i,s){t.scaleIndex=i,null!=s.customLabels&&(t.customLabelEl=s.customLabels,e.each(s.customLabels,function(e,i){t.customLabelIndex=e,null!=t.model.scales[t.scaleIndex].customLabels[t.customLabelIndex]&&null!=t.model.scales[t.scaleIndex].customLabels[t.customLabelIndex].positionType&&"outer"==t.model.scales[t.scaleIndex].customLabels[t.customLabelIndex].positionType?t._setOuterCustomLabels(e,i):t._setCustomLabelCordinates(e,i)}))})},_subGauge:function(){var t=this;e.each(this.model.scales,function(i,s){t.scaleIndex=i,null!=s.subGauges&&(t.subGaugeEl=s.subGauges,e.each(s.subGauges,function(e,s){t.subGaugeIndex=i,t._setSubGauge(e,s)}))})},_setOuterCustomLabels:function(e,i){var s,a;this._customLblMaxSize=this._customLblMaxSize"),"center"==a?s.css({display:"inline-block",margin:"0 auto","max-width":this.model.width}):s.css({display:"inline-block","max-width":this.element.width()-this.model.width>10?this.element.width()-this.model.width:10}),s.css({color:i.color,overflow:"hidden","text-overflow":"ellipsis","white-space":"nowrap","font-size":null!=i.font&&null!=i.font.size?i.font.size:"12px","font-family":null!=i.font&&null!=i.font.fontFamily?i.font.fontFamily:"Arial","font-weight":null!=i.font&&null!=i.font.fontStyle?i.font.fontStyle:"Normal","text-align":a})},_setScaleCordinates:function(e){if(this.region={centerX:this._isHalfCircle()?this._getHalfCircleXPosition():this.centerX,centerY:this._isHalfCircle()?this._getHalfCircleYPosition():this.centerY,startAngle:e.startAngle,endAngle:e.startAngle+e.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:e.radius-e.size/2,strokeStyle:"transparent"==e.border.color?"rgba(0,0,0,0)":this._getColor(e,e.border.color),lineWidth:e.border.width,size:e.size,isFill:!0,opacity:isNaN(e.opacity)?1:e.opacity,isStroke:!0,shadowOffset:e.shadowOffset,fillStyle:"transparent"==e.backgroundColor?"rgba(0,0,0,0)":this._getColor(e,e.backgroundColor),counterClockwise:"clockwise"!=e.direction},e.maximum=this.scaleEl[this.scaleIndex].minimum;d-=o)(o==this.scaleEl[this.scaleIndex].minorIntervalValue&&d%this.scaleEl[this.scaleIndex].majorIntervalValue!=0||o==this.scaleEl[this.scaleIndex].majorIntervalValue)&&(d==this.scaleEl[this.scaleIndex].minimum&&(n=!0),l=this._getAngle(d),l=l>360?l-360:l,i=this._getXCordinate(this._isHalfCircle()?this._getHalfCircleXPosition():this.centerX,r,l),s=this._getYCordinate(this._isHalfCircle()?this._getHalfCircleYPosition():this.centerY,r,l),this.region={startX:i,startY:s},this.style={angle:t.angle+l,isStroke:!0,isFill:!1,lineHeight:a,lineWidth:t.width,strokeStyle:"transparent"==t.color?"rgba(0,0,0,0)":this._getColor(t,t.color)},this.model.drawTicks&&this._onDrawTicks(l,d),this._drawTickMark(this.region,this.style));n||(l=this._getAngle(this.scaleEl[this.scaleIndex].minimum),l=l>360?l-360:l,i=this._getXCordinate(this._isHalfCircle()?this._getHalfCircleXPosition():this.centerX,r,l),s=this._getYCordinate(this._isHalfCircle()?this._getHalfCircleYPosition():this.centerY,r,l),this.region={startX:i,startY:s},this.style={angle:t.angle+l,isStroke:!0,isFill:!1,lineHeight:a,lineWidth:t.width,strokeStyle:"transparent"==t.color?"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(e,t){var i,s,a,n,o,r,l,d,h;for(r="major"==t.type?this.scaleEl[this.scaleIndex].majorIntervalValue:this.scaleEl[this.scaleIndex].minorIntervalValue,o="major"==t.type?this.majorIntervalAngle=this.scaleEl[this.scaleIndex].sweepAngle/((this.scaleEl[this.scaleIndex].maximum-this.scaleEl[this.scaleIndex].minimum)/r):this.scaleEl[this.scaleIndex].sweepAngle/((this.scaleEl[this.scaleIndex].maximum-this.scaleEl[this.scaleIndex].minimum)/r),"far"==t.placement&&(l=this.scaleEl[this.scaleIndex].radius+this.scaleEl[this.scaleIndex].size/2+this.majorTickHeight+t.distanceFromScale),"center"==t.placement&&(l=this.scaleEl[this.scaleIndex].radius-10-t.distanceFromScale),"near"==t.placement&&(l=this.scaleEl[this.scaleIndex].radius-this.scaleEl[this.scaleIndex].size/2-10-this.majorTickHeight-t.distanceFromScale),this._labelRadius=l,d=this.scaleEl[this.scaleIndex].maximum;d>=this.scaleEl[this.scaleIndex].minimum;d=this._subtractDecimal(d,r))if(d==this.scaleEl[this.scaleIndex].minimum&&(i=!0),r==this.scaleEl[this.scaleIndex].minorIntervalValue&&d%this.scaleEl[this.scaleIndex].majorIntervalValue!=0||r==this.scaleEl[this.scaleIndex].majorIntervalValue){if(d==this.scaleEl[this.scaleIndex].minimum&&!t.includeFirstValue)continue;h=this._getAngle(d),h=h>360?h-360:h,s=this._getXCordinate(this._isHalfCircle()?this._getHalfCircleXPosition():this.centerX,l,h),a=this._getYCordinate(this._isHalfCircle()?this._getHalfCircleYPosition():this.centerY,l,h),this.region={startX:s,startY:a},this.style={placement:t.placement,textPositionAngle:h,angle:this.scaleEl[this.scaleIndex].labels[this.labelIndex].autoAngle?h+t.angle:t.angle,isStroke:!1,isFill:!0,textValue:d,opacity:t.opacity?t.opacity:1,font:this._getFontString(t,t.font),fillStyle:"transparent"==t.color?"rgba(0,0,0,0)":this._getColor(t,t.color)},this.model.drawLabels&&this._onDrawLabels(this.scaleEl[this.scaleIndex].labels[this.labelIndex].autoAngle?h+t.angle:t.angle,d),this._drawLabel(this.region,this.style,!1),this.model.tooltip.showLabelTooltip&&this._savedPoints.push({startX:s-10,startY:a-5,width:20,height:parseInt(t.font.size.replace(/\D/g,"")),value:d})}i||(h=this._getAngle(this.scaleEl[this.scaleIndex].minimum),h=h>360?h-360:h,s=this._getXCordinate(this._isHalfCircle()?this._getHalfCircleXPosition():this.centerX,l,h),a=this._getYCordinate(this._isHalfCircle()?this._getHalfCircleYPosition():this.centerY,l,h),this.region={startX:s,startY:a},this.style={angle:this.scaleEl[this.scaleIndex].labels[this.labelIndex].autoAngle?h+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:n,lineWidth:t.width,fillStyle:"transparent"==t.color?"rgba(0,0,0,0)":this._getColor(t,t.color)},this.model.drawLabels&&this._onDrawLabels(h,d),this._drawLabel(this.region,this.style,!1),this.model.tooltip.showLabelTooltip&&this._savedPoints.push({startX:s-10,startY:a-5,width:20,height:parseInt(t.font.size.replace(/\D/g,"")),value:d}),h=this._getAngle(d),h=h>360?h-360:h),this.contextEl.getImageData&&(this.labelImage=this.contextEl.getImageData(0,0,this.model.width,this.model.height))},_setRangeCordinates:function(e,i){if(i.startValue=this.scaleEl[this.scaleIndex].minimum?i.startValue:this.scaleEl[this.scaleIndex].minimum,g=i.endValue>this.scaleEl[this.scaleIndex].maximum?this.scaleEl[this.scaleIndex].maximum:i.endValue;m=this._getAngle((p+g)/2),r=this._getAngle(p),d=this._getAngle(g),l=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),h=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),c=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),s=this._getXCordinate(this._isHalfCircle()?this._getHalfCircleXPosition():this.centerX,l,r),a=this._getYCordinate(this._isHalfCircle()?this._getHalfCircleYPosition():this.centerY,l,r),n=this._getXCordinate(this._isHalfCircle()?this._getHalfCircleXPosition():this.centerX,l,d),o=this._getYCordinate(this._isHalfCircle()?this._getHalfCircleYPosition():this.centerY,l,d),r=180*this._getCirucumferenceAngle({ x:this._isHalfCircle()?this._getHalfCircleXPosition():this.centerX,y:this._isHalfCircle()?this._getHalfCircleYPosition():this.centerY},{x:s,y:a})/Math.PI,d=180*this._getCirucumferenceAngle({x:this._isHalfCircle()?this._getHalfCircleXPosition():this.centerX,y:this._isHalfCircle()?this._getHalfCircleYPosition():this.centerY},{x:n,y:o})/Math.PI,t.isNullOrUndefined(i.gradients)?u="transparent"==i.backgroundColor?"rgba(0,0,0,0)":this._getColor(i,i.backgroundColor):(u=this.contextEl.createRadialGradient(this.centerX,this.centerY,c,this.centerX,this.centerY,h),this._setGradientColor(this,u,i.gradients.colorInfo)),this.region={startX:s,startY:a,endX:n,endY:o,startAngle:r,endAngle:d},this.style={placement:i.placement,radius:"near"==i.placement?this.scaleEl[this.scaleIndex].radius-i.distanceFromScale:this.scaleEl[this.scaleIndex].radius+i.distanceFromScale,rangeStart:p,rangeEnd:g,startWidth:i.startWidth,isFill:!0,fillStyle:u,strokeStyle:"transparent"==i.border.color?"rgba(0,0,0,0)":i.border.color,opacity:isNaN(i.opacity)?1:i.opacity,counterClockwise:"clockwise"!=this.scaleEl[this.scaleIndex].direction,startRadius:h,endRadius:c,endWidth:i.endWidth,lineWidth:i.border.width,isStroke:!0},this.model.drawRange&&this._onDrawRange(this.region,this.style),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 s,a=e("div[id="+i.controlID+"]");a.length>0&&a.find("canvas").length&&(s=a.find("canvas")[0].getContext("2d"),this.contextEl.drawImage(s.canvas,i.position.x,i.position.y,i.width,i.height),a.css("display","none"),this.contextEl.getImageData&&(this.subGaugeImage=this.contextEl.getImageData(0,0,this.model.width,this.model.height)))},_setCustomLabelCordinates:function(e,i){this._customLblMaxSize=this._customLblMaxSize=i.startValue&&n.pointerEl[n.pointerIndex].value<=i.endValue&&(o=!0,!t.isNullOrUndefined(i.text)&&i.text.length>0&&(n.style.indicatorText=i.text,n.style.textColor="transparent"==i.textColor?"rgba(0,0,0,0)":i.textColor,n.style.font=s.font),n.style.strokeStyle="transparent"==i.borderColor?"rgba(0,0,0,0)":i.borderColor,n.style.fillStyle="transparent"==i.backgroundColor?"rgba(0,0,0,0)":i.backgroundColor,n._drawIndicatorFrame(s.type,n.region,n.style))}),o||s.type==t.datavisualization.CircularGauge.IndicatorType.Image||n._drawIndicatorFrame(s.type,n.region,n.style),this.contextEl.getImageData&&s.type!=t.datavisualization.CircularGauge.IndicatorType.Image&&(this.indicatorImage=this.contextEl.getImageData(0,0,this.model.width,this.model.height))},_drawIndicatorFrame:function(e,t,i){switch(e){case"circle":this._drawCircleFrame(t,i);break;case"roundedrectangle":case"rectangle":this._drawRectangleFrame(t,i);break;case"text":this._drawText(t,i)}},_drawScaleBar:function(e,t){this.contextEl.shadowColor="transparent"==t.strokeStyle?"rgba(0,0,0,0)":t.strokeStyle,t.shadowOffset&&(this.contextEl.shadowBlur=t.shadowOffset),this._contextOpenPath(t,this),e.endAngle-e.startAngle==0?this.contextEl.arc(e.centerX,e.centerY,e.startRadius,0*Math.PI,0*Math.PI,!1):(e.endAngle-e.startAngle)%360==0?(this.contextEl.arc(e.centerX,e.centerY,e.startRadius,0*Math.PI,2*Math.PI,!1),this.contextEl.arc(e.centerX,e.centerY,e.endRadius,2*Math.PI,0*Math.PI,!0)):(this.contextEl.arc(e.centerX,e.centerY,e.startRadius,Math.PI*(e.startAngle/180),Math.PI*(e.endAngle/180),!1),this.contextEl.arc(e.centerX,e.centerY,e.endRadius,Math.PI*(e.endAngle/180),Math.PI*(e.startAngle/180),!0)),this._contextClosePath(t,this)},_drawTickMark:function(e,t){this._contextOpenPath(t,this),this.contextEl.translate(e.startX,e.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(e,i,s){var a,n=0;t.isNullOrUndefined(s)||s||(a=this.model.scales[this.scaleIndex].labels[this.labelIndex].unitTextPosition,t.isNullOrUndefined(a)||"back"!=a.toString()?t.isNullOrUndefined(a)||"front"!=a.toString()||(i.textValue=this.model.scales[this.scaleIndex].labels[this.labelIndex].unitText+i.textValue):i.textValue=(i.textValue%1!=0?+i.textValue.toFixed(3):i.textValue)+this.model.scales[this.scaleIndex].labels[this.labelIndex].unitText,n=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(e.startX+n,e.startY),this.contextEl.lineTo(0,0),s||(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(e,t){this._contextOpenPath(t,this),this.contextEl.arc(e.centerX,e.centerY,t.radius,e.startAngle,e.endAngle,t.counterClockwise),this._contextClosePath(t,this),t.indicatorText&&this._drawText(e,t)},_drawHalfCircle:function(e,t){this._contextOpenPath(t,this),this.contextEl.lineJoin="round",this.contextEl.arc(e.centerX,e.centerY,t.radius,e.startAngle,e.endAngle,!1),this.contextEl.lineTo(e.hcCenterX,e.hcCenterY),this._contextClosePath(t,this)},_drawRectangleFrame:function(e,t){this._contextOpenPath(t,this),this.contextEl.translate(e.centerX,e.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(e,t)},_drawText:function(e,t){this.contextEl.beginPath(),this.contextEl.textAlign="center",this.contextEl.fillStyle="transparent"==t.textColor?"rgba(0,0,0,0)":t.textColor,this.contextEl.font=t.font,this.contextEl.fillText(t.indicatorText,e.textLocation.x,e.textLocation.y),this.contextEl.closePath()},_drawRange:function(e,t){var i;if(null==t.startWidth&&null==t.endWidth)this._contextOpenPath(t,this),this.contextEl.arc(this._isHalfCircle()?this._getHalfCircleXPosition():this.centerX,this._isHalfCircle()?this._getHalfCircleYPosition():this.centerY,t.startRadius,Math.PI*(e.startAngle/180),Math.PI*(e.endAngle/180),t.counterClockwise),this.contextEl.arc(this._isHalfCircle()?this._getHalfCircleXPosition():this.centerX,this._isHalfCircle()?this._getHalfCircleYPosition():this.centerY,t.endRadius,Math.PI*(e.endAngle/180),Math.PI*(e.startAngle/180),!t.counterClockwise),this._contextClosePath(t,this);else{var s=t.startWidth>t.endWidth?t.startWidth-t.endWidth:t.endWidth-t.startWidth,a="clockwise"==this.scaleEl[this.scaleIndex].direction?e.startAnglethis.scaleEl[this.scaleIndex].maximum?this.scaleEl[this.scaleIndex].maximum:i.value,i.value=i.value360?n-360:n,"needle"==i.type?("far"==i.placement&&(o=i.length+this.scaleEl[this.scaleIndex].size/2),"center"==i.placement&&(o=i.length),"near"==i.placement&&(o=i.length-this.scaleEl[this.scaleIndex].size/2)):(o=i.length,"far"==i.placement&&(s=this._getXCordinate(this._isHalfCircle()?this._getHalfCircleXPosition():this.centerX,this.scaleEl[this.scaleIndex].radius+this.scaleEl[this.scaleIndex].size/2+i.distanceFromScale,n),a=this._getYCordinate(this._isHalfCircle()?this._getHalfCircleYPosition():this.centerX,this.scaleEl[this.scaleIndex].radius+this.scaleEl[this.scaleIndex].size/2+i.distanceFromScale,n)),"center"==i.placement&&(s=this._getXCordinate(this._isHalfCircle()?this._getHalfCircleXPosition():this.centerX,this.scaleEl[this.scaleIndex].radius-this.scaleEl[this.scaleIndex].size/2-i.distanceFromScale,n),a=this._getYCordinate(this._isHalfCircle()?this._getHalfCircleYPosition():this.centerX,this.scaleEl[this.scaleIndex].radius-this.scaleEl[this.scaleIndex].size/2-i.distanceFromScale,n)),"near"==i.placement&&(s=this._getXCordinate(this._isHalfCircle()?this._getHalfCircleXPosition():this.centerX,this.scaleEl[this.scaleIndex].radius-this.scaleEl[this.scaleIndex].size/2-i.distanceFromScale-this.majorTickHeight-15,n),a=this._getYCordinate(this._isHalfCircle()?this._getHalfCircleYPosition():this.centerX,this.scaleEl[this.scaleIndex].radius-this.scaleEl[this.scaleIndex].size/2-i.distanceFromScale-this.majorTickHeight-15,n)),this._isHalfCircle&&this._isHalfCircle()||(this.model.height>this.model.width?a+=(this.model.height-this.model.width)/2:this.model.heightthis.model.radius&&(o=this.model.radius),this.region={startX:"needle"==i.type?this._isHalfCircle()?this._getHalfCircleXPosition():this.centerX:s,startY:"needle"==i.type?this._isHalfCircle()?this._getHalfCircleYPosition():this.centerY:a},t.isNullOrUndefined(i.gradients)?r="transparent"==i.backgroundColor?"rgba(0,0,0,0)":this._getColor(i,i.backgroundColor):(r=this.contextEl.createLinearGradient(0,0,0,i.width),this._setGradientColor(this,r,i.gradients.colorInfo)),this.style={width:i.width,isFill:!0,isStroke:!0,radius:0,showBackNeedle:i.showBackNeedle,backNeedleLength:i.backNeedleLength,angle:"needle"==i.type?n:"far"==i.placement?n:n+180,height:o,lineWidth:i.border.width,opacity:isNaN(i.opacity)?1:i.opacity,strokeStyle:"transparent"==i.border.color?"rgba(0,0,0,0)":this._getColor(i,i.border.color),fillStyle:r,imageUrl:i.imageUrl,type:i.type},this.model.drawPointers&&this._onDrawPointers(n,i.value),"needle"==i.type?(this._drawNeedlePointer(this.region,this.style,i),this._setPointerCap(i)):("roundedrectangle"==i.markerType&&(this.style.radius=5),this._drawMarkerType(i.markerType,this.region,this.style)),i.pointerValueText.showValue&&(s=this._getXCordinate(this._isHalfCircle()?this._getHalfCircleXPosition():this.centerX,this._labelRadius+i.pointerValueText.distance,n),a=this._getYCordinate(this._isHalfCircle()?this._getHalfCircleYPosition():this.centerY,this._labelRadius+i.pointerValueText.distance,n),this.region={startX:s,startY:a},this.style={angle:i.pointerValueText.autoAngle?i.pointerValueText.angle+n:i.pointerValueText.angle,textValue:i.value,fillStyle:"transparent"==i.pointerValueText.color?"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["+e+"]value",i.value),this.value(i.value)},_drawPointerValueText:function(e,t){this._contextOpenPath(t,this),this.contextEl.textAlign="center",this.contextEl.textBaseline="middle",this.contextEl.font=t.font,this.contextEl.translate(e.startX,e.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(e,i,s){switch(e){case"rectangle":this._drawRectangle(i,s,this),t.isNullOrUndefined(s.imageUrl)&&""==s.imageUrl||this._drawImagePointer(i,s,this);break;case"triangle":this._drawTriangle(i,s,this),t.isNullOrUndefined(s.imageUrl)&&""==s.imageUrl||this._drawImagePointer(i,s,this);break;case"ellipse":this._drawEllipse(i,s,this),t.isNullOrUndefined(s.imageUrl)&&""==s.imageUrl||this._drawImagePointer(i,s,this);break;case"diamond":this._drawDiamond(i,s,this),t.isNullOrUndefined(s.imageUrl)&&""==s.imageUrl||this._drawImagePointer(i,s,this);break;case"pentagon":this._drawPentagon(i,s,this),t.isNullOrUndefined(s.imageUrl)&&""==s.imageUrl||this._drawImagePointer(i,s,this);break;case"circle":this._drawCircle(i,s,this),t.isNullOrUndefined(s.imageUrl)&&""==s.imageUrl||this._drawImagePointer(i,s,this);break;case"slider":this._drawSlider(i,s,this),t.isNullOrUndefined(s.imageUrl)&&""==s.imageUrl||this._drawImagePointer(i,s,this);break;case"pointer":this._drawPointer(i,s,this),t.isNullOrUndefined(s.imageUrl)&&""==s.imageUrl||this._drawImagePointer(i,s,this);break;case"wedge":this._drawWedge(i,s,this),t.isNullOrUndefined(s.imageUrl)&&""==s.imageUrl||this._drawImagePointer(i,s,this);break;case"trapezoid":this._drawTrapezoid(i,s,this),t.isNullOrUndefined(s.imageUrl)&&""==s.imageUrl||this._drawImagePointer(i,s,this);break;case"roundedrectangle":this._drawRoundedRectangle(i,s,this),t.isNullOrUndefined(s.imageUrl)&&""==s.imageUrl||this._drawImagePointer(i,s,this);break;case"image":this._drawImagePointer(i,s,this)}},_drawNeedlePointer:function(e,t,i){"image"==this.pointerEl[this.pointerIndex].needleType?this._drawImagePointer(e,t,i):(this._contextOpenPath(t,this),this.contextEl.translate(e.startX,e.startY),this.contextEl.rotate(Math.PI*(t.angle/180)),this.contextEl.lineTo(0,-t.width/2),"triangle"==this.pointerEl[this.pointerIndex].needleType?this.contextEl.lineTo(t.height,0):"rectangle"==this.pointerEl[this.pointerIndex].needleType?(this.contextEl.lineTo(t.height,-t.width/2),this.contextEl.lineTo(t.height,t.width/2)):"trapezoid"==this.pointerEl[this.pointerIndex].needleType?(this.contextEl.lineTo(t.height,-t.width/4),this.contextEl.lineTo(t.height,t.width/4)):"arrow"==this.pointerEl[this.pointerIndex].needleType&&(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(e,t){var i=this,s=new Image,a=t.angle,n=e.startX,o=e.startY,r=t.width,l=t.height;t.type;s.onload=function(){i.contextEl.save(),i.contextEl.translate(n,o),i.contextEl.rotate(Math.PI*(a/180)),i.contextEl.drawImage(this,0,-l/2,r,l),i.contextEl.restore()},s.src=t.imageUrl},_setPointerCap:function(e){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="transparent"==this.scaleEl[this.scaleIndex].pointerCap.backgroundColor?"rgba(0,0,0,0)":this._getColor(this,this._getColor(e,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:"transparent"==this.scaleEl[this.scaleIndex].pointerCap.borderColor?"rgba(0,0,0,0)":this._getColor(this,this._getColor(e,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(e){switch(e){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()}},_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"rear"==this.model.rangeZOrder?this.scaleImage?this.scaleImage:this.outerImage:this.tickImage?this.tickImage:this._getTickImage()},_getLabelImage:function(){return"rear"==this.model.rangeZOrder?this.tickImage?this.tickImage:this._getTickImage():this.tickImage?this.rangeImage:this._getRangeImage()},_getTickImage:function(){return"rear"==this.model.rangeZOrder?this.rangeImage?this.rangeImage:this._getRangeImage():this.scaleImage?this.scaleImage:this.outerImage},getPointerValue:function(e,t){return e=this.scaleEl[e].minimum&&i<=this.scaleEl[e].maximum&&(this.scaleEl[e].pointers[t].value=i),this.contextEl.putImageData&&!this.isAndroid()?this._reDrawPointer():this._initialize())},setLabelAngle:function(e,t,i){ethis.scaleEl[e].minimum&&(this.scaleEl[e].maximum=t),this.contextEl.putImageData&&!this.isAndroid()?this._reDrawScale():this._initialize())},getMaximumValue:function(e){return ethis._customLblMaxSize?this._customLblMaxSize.toString()+"px":(parseFloat(this.model.scales[n].customLabels[o].font.size.match(/\d+/)[0])*a).toString()+"px"),t.isNullOrUndefined(this.model.scales[n].ticks[o])||(this.model.scales[n].ticks[o].height*=a),t.isNullOrUndefined(this.model.scales[n].pointers[o])||(this.model.scales[n].pointers[o].length*=a,this.model.scales[n].pointers[o].width*=a,this.model.scales[n].pointers[o].backNeedleLength*=a),t.isNullOrUndefined(this.model.scales[n].ranges[o])||(this.model.scales[n].ranges[o].distanceFromScale*=a,this.model.scales[n].ranges[o].size*=a),!t.isNullOrUndefined(this.model.scales[n].indicators[o])&&this.model.scales[n].showIndicators&&(this.model.scales[n].indicators[o].height*=a,this.model.scales[n].indicators[o].width*=a,this.model.scales[n].indicators[o].position.x*=a,this.model.scales[n].indicators[o].position.y*=a),!t.isNullOrUndefined(this.model.scales[n].subGauges[o])&&t.isNullOrUndefined(this.model.scales[n].subGauges[o].controlID)&&(this.model.scales[n].subGauges[o].height*=a,this.model.scales[n].subGauges[o].width*=a,this.model.scales[n].subGauges[o].position.x*=a);this.refresh(),0==_gaugeCount&&(initialDivWidth=window.innerWidth)}},_onDrawTicks:function(e,t){var i={index:this.tickIndex,element:this.tickEl[this.tickIndex],angle:parseInt(e)},s={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",s)},_onDrawLabels:function(e,t){var i={index:this.labelIndex,element:this.labelEl[this.labelIndex],angle:parseInt(e)},s={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",s)},_onDrawPointers:function(e,t){var i={index:this.pointerIndex,element:this.pointerEl[this.pointerIndex],angle:parseInt(e),pointerValue:t},s={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",s)},_onDrawRange:function(){var e={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",e)},_onDrawCustomLabel:function(){var e={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",e)},_onDrawIndicators:function(){var e={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",e)},_onDrawPointerCap:function(){var e={object:this,scaleElement:this.model.scales,position:this.region,style:this.style,context:this.contextEl};this._trigger("drawPointerCap",e)},_onRenderComplete:function(){var e={object:this,scaleElement:this.model.scales,context:this.contextEl};this._trigger("renderComplete",e)},_onMouseClick:function(e,t){var i={index:this.pointerIndex,element:this.pointerEl[this.pointerIndex],value:t,angle:parseInt(e)},s={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",s)},_onMouseClickMove:function(e,t){var i={index:this.pointerIndex,element:this.pointerEl[this.pointerIndex],value:t,angle:parseInt(e)},s={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",s)},_onMouseClickUp:function(e,t){var i={index:this.pointerIndex,element:this.pointerEl[this.pointerIndex],value:t,angle:parseInt(e)},s={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",s)},_setTheme:function(){var e=this.model.themeProperties[this.model.theme];this._setThemeColors(e)},_setThemeColors:function(e){var t,i,s,a,n,o,r=[],l=this.model.themeProperties;for(t in l)r.push(t);for(i=0;i=e&&i<=t:i>=t&&i<=e},_getColor:function(e,t){return"string"==typeof t?t:"rgba("+t.r+", "+t.g+","+t.b+", "+t.a/255+")"},_setGradientColor:function(t,i,s){var a=t;s.Name||"string"==typeof s?(i.addColorStop(0,this._getColor(t,s)),i.addColorStop(1,this._getColor(t,s))):e.each(s,function(e,s){i.addColorStop(NaN!=s.colorStop?s.colorStop:0,"string"==typeof s.color?s.color:a._getColor(t,s.color))})}}),function(){for(var e,t,i=0,s=["ms","moz","webkit","o"],a=0;a"),s=0,a=0;null!=this.model.scales[a];a++){for(null==this.model.scales[a].minimum&&(this.model.scales[a].minimum=this.minimum()),null==this.model.scales[a].maximum&&(this.model.scales[a].maximum=this.maximum()),n=0;null!=this.model.scales[a].markerPointers[n];n++)null==this.model.scales[a].markerPointers[n].value&&(this.model.scales[a].markerPointers[n].value=this.value());for(o=0;null!=this.model.scales[a].barPointers[o];o++)null==this.model.scales[a].barPointers[o].value&&(this.model.scales[a].barPointers[o].value=this.value());for(r=0;null!=this.model.scales[a].customLabels[r]&&1==this.model.scales[a].showCustomLabels;r++)if(s++,null!=this.model.scales[a].customLabels[r].value&&0==i.GaugeEl.find("div").length)if(null!=this.model.scales[a].customLabels[r]&&null!=this.model.scales[a].customLabels[r].positionType&&"outer"==this.model.scales[a].customLabels[r].positionType)if(i.outerDiv=t.buildTag("div"),"bottom"==i.model.outerCustomLabelPosition)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("top"!=i.model.outerCustomLabelPosition){l=t.buildTag("TABLE"),l.css("width","100%");var h=t.buildTag("TR"),c=t.buildTag("TD"),u=t.buildTag("td");"left"==i.model.outerCustomLabelPosition?(c.append(i.outerDiv),u.append(i.canvasEl)):(c.append(i.canvasEl),u.append(i.outerDiv)),h.append(c),h.append(u),l.append(h),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.GaugeEl.css({width:i.model.width}),i.outerDiv.css("text-align","center");else i.GaugeEl.append(i.canvasEl);0==s&&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,d=i.canvasEl[0],"undefined"!=typeof G_vmlCanvasManager&&(d=window.G_vmlCanvasManager.initElement(d)),d&&d.getContext&&(i.contextEl=i.canvasEl[0].getContext("2d"))},_drawFrameCircle:function(e,t,i){this._contextOpenPath(t,i),i.contextEl.arc(e.startX,e.startY,t.circleRadius,0,2*Math.PI,!0),this._contextClosePath(t,i),t.indicatorText&&i._drawText(e,t)},_drawFrameRectangle:function(e,t,i){this._contextOpenPath(t,i),i.contextEl.lineTo(e.startX+t.radius,e.startY),i.contextEl.lineTo(e.startX+t.width-t.radius,e.startY),i.contextEl.lineTo(e.startX+t.width,e.startY+t.height-t.radius),i.contextEl.lineTo(e.startX+t.radius,e.startY+t.height),this._contextClosePath(t,i),t.indicatorText&&i._drawText(e,t)},_drawFrameThermometer:function(e,t,i){var s="Vertical"==i.Model.orientation?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),"Vertical"==i.Model.orientation?"counterclockwise"==i.scaleEl[i.scaleIndex].direction?(i.contextEl.arc(e.startX+Math.cos(.25*Math.PI)*s,e.startY+t.height-Math.sin(.25*Math.PI)*s,s,Math.PI*-.25,1.25*Math.PI,!1),i.contextEl.lineTo(e.startX,e.startY+t.calDistance+t.width/2),t.topRounded?i.contextEl.arc(e.startX+t.width/2,e.startY+t.width/2,t.width/2,-Math.PI,0,!1):i.contextEl.lineTo(e.startX+t.width,e.startY+t.calDistance+t.width/2)):(i.contextEl.arc(e.startX+Math.cos(.25*Math.PI)*s,e.startY+Math.sin(.25*Math.PI)*s,s,.25*Math.PI,Math.PI*-1.25,!0),i.contextEl.lineTo(e.startX,e.startY+t.height-t.width/2),t.topRounded?i.contextEl.arc(e.startX+t.width/2,e.startY+t.height-t.width/2,t.width/2,-Math.PI,0,!0):i.contextEl.lineTo(e.startX+t.width,e.startY+t.height-t.width/2)):"counterclockwise"==i.scaleEl[i.scaleIndex].direction?(i.contextEl.arc(e.startX+t.width-s/4-Math.cos(.25*Math.PI)*s,e.startY+Math.sin(.25*Math.PI)*s,s,.75*Math.PI,1.25*Math.PI,!0),i.contextEl.lineTo(e.startX+t.height/2,e.startY),t.topRounded?i.contextEl.arc(e.startX+t.height/2,e.startY+t.height/2,t.height/2,1.5*Math.PI,.5*Math.PI,!0):i.contextEl.lineTo(e.startX+t.height/2,e.startY+t.height)):(i.contextEl.arc(e.startX+s/4+Math.cos(.25*Math.PI)*s,e.startY+Math.sin(.25*Math.PI)*s,s,.25*Math.PI,1.75*Math.PI,!1),i.contextEl.lineTo(e.startX+t.width-t.height/2,e.startY),t.topRounded?i.contextEl.arc(e.startX+t.width-t.height/2,e.startY+t.height/2,t.height/2,1.5*Math.PI,.5*Math.PI,!1):i.contextEl.lineTo(e.startX+t.width-t.height/2,e.startY+t.height)),this._contextClosePath(t,i)},_drawFrameRoundedRectangle:function(e,t,i){this._contextOpenPath(t,i),i.contextEl.lineTo(e.startX+t.radius,e.startY),i.contextEl.lineTo(e.startX+t.width-t.radius,e.startY),i.contextEl.quadraticCurveTo(e.startX+t.width,e.startY,e.startX+t.width,e.startY+t.radius),i.contextEl.lineTo(e.startX+t.width,e.startY+t.height-t.radius),i.contextEl.quadraticCurveTo(e.startX+t.width,e.startY+t.height,e.startX+t.width-t.radius,e.startY+t.height),i.contextEl.lineTo(e.startX+t.radius,e.startY+t.height),i.contextEl.quadraticCurveTo(e.startX,e.startY+t.height,e.startX,e.startY+t.height-t.radius),i.contextEl.lineTo(e.startX,e.startY+t.radius),i.contextEl.quadraticCurveTo(e.startX,e.startY,e.startX+t.radius,e.startY),this._contextClosePath(t,i),t.indicatorText&&this._drawText(e,t)},_contextOpenPath:function(e,t){t.contextEl.save(),t.contextEl.beginPath(),e.strokeStyle&&(t.contextEl.strokeStyle=e.strokeStyle),e.opacity!=i&&(t.contextEl.globalAlpha=e.opacity),e.lineWidth&&(t.contextEl.lineWidth=e.lineWidth),e.fillStyle&&(t.contextEl.fillStyle=e.fillStyle)},_contextClosePath:function(e,t){t.contextEl.closePath(),e.isFill&&t.contextEl.fill(),e.isStroke&&t.contextEl.stroke(),t.contextEl.restore()},_drawScales:function(){var t,i=this;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),e.each(this.Model.scales,function(e,t){i.scaleIndex=e,i._setScaleCordinates(t,t.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(),e.each(this.Model.scales,function(e,t){t.showBarPointers&&t.barPointers.length>1&&(i.model.enableAnimation=!1),t.showMarkerPointers&&t.markerPointers.length>1&&(i.model.enableAnimation=!1)}),this.contextEl.putImageData||(this.model.enableAnimation=!1),null!=this.model.animationSpeed&&this.model.animationSpeed>0&&(t=this.model.animationSpeed/25,t>=0&&this.model.enableAnimation&&this._animationFlag&&this._onAnimate(t))},_setTicks:function(){var t=this;e.each(this.Model.scales,function(i,s){s.showTicks&&(t.scaleIndex=i,null!=s.ticks&&(t.tickEl=s.ticks,e.each(s.ticks,function(e,i){t.tickIndex=e,t._setTicksCordinates(i,e)})))})},_setLabels:function(){var t=this;e.each(this.Model.scales,function(i,s){s.showLabels&&(t.scaleIndex=i,null!=s.labels&&(t.labelEl=s.labels,e.each(s.labels,function(e,i){t.labelIndex=e,t._setLabelCordinates(i,e)})))})},_setIndicators:function(){var t=this;e.each(this.Model.scales,function(i,s){t.scaleIndex=i,null!=s.indicators&&s.showIndicators&&(t.indicatorEl=s.indicators,e.each(s.indicators,function(e,i){t.indicatorIndex=e,t._drawIndicator(e,i)}))})},_setBarPointers:function(){var t=this;e.each(this.Model.scales,function(i,s){s.showBarPointers&&(t.scaleIndex=i,null!=s.barPointers&&(t.barPointerEl=s.barPointers,e.each(s.barPointers,function(e,i){t.barPointerIndex=e,s.opacity=0==t.scaleIndex&&0==t.barPointerIndex&&1==t.model.enableAnimation&&0==t._flagPointer&&1==t._animationFlag&&"thermometer"==t.model.scales[0].type?0:t._tempOpacity,t._drawScaleBarPointer(i,e),t._flagPointer=!0})))})},_setMarkerPointers:function(){var t=this;e.each(this.Model.scales,function(i,s){s.showMarkerPointers&&(t.scaleIndex=i,null!=s.markerPointers&&(t.markerPointerEl=s.markerPointers,e.each(s.markerPointers,function(e,i){t.markerPointerIndex=e,t._drawMarkerPointer(i,e),t.canvasEl.attr("aria-label",t.model.scales[t.scaleIndex].markerPointers[t.markerPointerIndex].value)})))})},_onAnimate:function(e){var t,i,s=this,a=s.model.scales[0].minimum,n=s.model.scales[0].barPointers[0].value,o=s.model.scales[0].markerPointers[0].value;t=setInterval(function(){n>a||a==s.model.scales[0].minimum?(a+=(s.model.scales[0].maximum-s.model.scales[0].minimum)/100,"thermometer"==s.scaleEl[0].type?(s.model.scales[0].barPointers[0].value=n>a?a:n,"undefined"!=s.contextEl.putImageData?s._setBarPointers():n>a?s.setBarPointerValue(0,0,a):s.setBarPointerValue(0,0,n)):n>a?s.setBarPointerValue(0,0,a):s.setBarPointerValue(0,0,n)):(s._animationFlag=!1,s.setBarPointerValue(0,0,n),window.clearInterval(t))},e),i=setInterval(function(){s.model.enableMarkerPointerAnimation&&(o>a||a==s.model.scales[0].minimum?(a+=(s.model.scales[0].maximum-s.model.scales[0].minimum)/100,"thermometer"==s.scaleEl[0].type?(s.model.scales[0].markerPointers[0].value=o>a?a:o,"undefined"!=s.contextEl.putImageData?s._setMarkerPointers():o>a?s.setPointerValue(0,0,a):s.setPointerValue(0,0,o)):o>a?s.setPointerValue(0,0,a):s.setPointerValue(0,0,o)):(s._animationFlag=!1,s.setPointerValue(0,0,o),window.clearInterval(i)))},e)},_setRange:function(){var t=this;e.each(this.Model.scales,function(i,s){t.scaleIndex=i,null!=s.ranges&&s.showRanges&&(t.rangeEl=s.ranges,e.each(s.ranges,function(e,i){t.rangeIndex=e,t._drawRange(i)}))})},_setCustomLabel:function(){var t=this;e.each(this.Model.scales,function(i,s){t.scaleIndex=i,null!=s.customLabels&&s.showCustomLabels&&(t.customLabelEl=s.customLabels,e.each(s.customLabels,function(e,i){t.customLabelIndex=e,null!=t.model.scales[t.scaleIndex].customLabels[t.customLabelIndex]&&null!=t.model.scales[t.scaleIndex].customLabels[t.customLabelIndex].positionType&&"outer"==t.model.scales[t.scaleIndex].customLabels[t.customLabelIndex].positionType?t._setOuterCustomLabelCordinates(e,i):t._setCustomLabelCordinates(e,i)}))})},_setOuterCustomLabelCordinates:function(e,i){var s,a;this._customLblMaxSize=this._customLblMaxSize"),"center"==a?s.css({display:"inline-block",margin:"0 auto","max-width":this.model.width}):s.css({display:"inline-block","max-width":this.element.width()-this.model.width>10?this.element.width()-this.model.width:10}),s.css({color:i.color,overflow:"hidden","text-overflow":"ellipsis","white-space":"nowrap","font-size":null!=i.font&&null!=i.font.size?i.font.size:"12px","font-family":null!=i.font&&null!=i.font.fontFamily?i.font.fontFamily:"Arial","font-weight":null!=i.font&&null!=i.font.fontStyle?i.font.fontStyle:"Normal","text-align":a})},_setScaleCordinates:function(e,t){var i,s,a,n;this.opacity=1,this.bottomRadius=Math.sqrt(e.width*e.width+e.width*e.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)},"Vertical"==this.Model.orientation?(this.scaleStartX[this.scaleIndex]=(this.bounds.width-e.width)*(e.position.x/100),this.scaleStartY[this.scaleIndex]=(this.bounds.height-e.length)*(e.position.y/100)):(this.scaleStartX[this.scaleIndex]=(this.bounds.width-e.length)*(e.position.x/100),this.scaleStartY[this.scaleIndex]=(this.bounds.height-e.width)*(e.position.y/100)),a="roundedrectangle"==t?5:0,i={startX:this.scaleStartX[this.scaleIndex],startY:this.scaleStartY[this.scaleIndex]},s={width:"Vertical"==this.Model.orientation?e.width:e.length,isStroke:!0,topRounded:!0,fillStyle:e.backgroundColor?"transparent"==e.backgroundColor?"rgba(0,0,0,0)":this._getColor(e,e.backgroundColor):"transparent"==this.Model.backgroundColor?"rgba(0,0,0,0)":this._getColor(e,this.Model.backgroundColor),lineWidth:e.border.width,radius:a,height:"Vertical"==this.Model.orientation?e.length:e.width,isFill:!0,strokeStyle:e.border.color?"transparent"==e.border.color?"rgba(0,0,0,0)":this._getColor(e,e.border.color):"transparent"==this.Model.borderColor?"rgba(0,0,0,0)":this._getColor(e,this.Model.borderColor)},e.maximumthis.scaleEl[this.scaleIndex].minorIntervalValue){for(a="majorinterval"==e.type?this.scaleEl[this.scaleIndex].majorIntervalValue:this.scaleEl[this.scaleIndex].minorIntervalValue,"near"==e.placement?t="Vertical"==this.Model.orientation?this.scaleStartX[this.scaleIndex]:this.scaleStartY[this.scaleIndex]:"far"==e.placement?t="Vertical"==this.Model.orientation?this.scaleStartX[this.scaleIndex]+this.scaleEl[this.scaleIndex].width:this.scaleStartY[this.scaleIndex]+this.scaleEl[this.scaleIndex].width:"center"==e.placement&&(t="Vertical"==this.Model.orientation?this.scaleStartX[this.scaleIndex]+this.scaleEl[this.scaleIndex].width/2:this.scaleStartY[this.scaleIndex]+this.scaleEl[this.scaleIndex].width/2),i="near"==e.placement?-e.height:e.height,n=this.scaleEl[this.scaleIndex].maximum;n>=this.scaleEl[this.scaleIndex].minimum;n-=a)(a==this.scaleEl[this.scaleIndex].minorIntervalValue&&n%this.scaleEl[this.scaleIndex].majorIntervalValue!=0||a==this.scaleEl[this.scaleIndex].majorIntervalValue)&&(s=this._getClockwiseLinePosition(n),this.region={lineChangePosition:s+("horizontal"==this.Model.orientation?e.distanceFromScale.x:e.distanceFromScale.y),lineStaticPosition:t+("horizontal"==this.Model.orientation?e.distanceFromScale.y:e.distanceFromScale.x)},this.style={lineHeight:i,angle:"Vertical"==this.Model.orientation?e.angle:e.angle+270,tickShape:e.TickShape,strokeStyle:e.color?"transparent"==e.color?"rgba(0,0,0,0)":this._getColor(e,e.color):"transparent"==this.Model.tickColor?"rgba(0,0,0,0)":this._getColor(e,this.Model.tickColor),lineWidth:e.width},this.Model.drawTicks&&this._onDrawTicks("Vertical"==this.Model.orientation?e.angle:e.angle+270,n),this._drawTickMark(this.region,this.style));this.contextEl.getImageData&&(this.tickImage=this.contextEl.getImageData(0,0,this.Model.width,this.Model.height))}},_drawTickMark:function(e,t){this.contextEl.beginPath(),this.contextEl.save(),this.contextEl.lineWidth=t.lineWidth,this.contextEl.strokeStyle=t.strokeStyle,"Vertical"==this.Model.orientation?this.contextEl.translate(e.lineStaticPosition,e.lineChangePosition):this.contextEl.translate(e.lineChangePosition,e.lineStaticPosition),this.contextEl.lineTo(0,0),"clockwise"==this.scaleEl[this.scaleIndex].direction?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(e,t){var i,s,a,n,o=e.toString(),r=t.toString();return i=o.indexOf(".")>-1?o.length-o.indexOf(".")-1:0,s=r.indexOf(".")>-1?r.length-r.indexOf(".")-1:0,a=i>s?i:s,n=(e*Math.pow(10,a)+t*Math.pow(10,a))/Math.pow(10,a)},_setLabelCordinates:function(e){var t,i,s,a,n,o;if(this.scaleEl[this.scaleIndex].majorIntervalValue>this.scaleEl[this.scaleIndex].minorIntervalValue)for("Vertical"==this.Model.orientation?(t=e.distanceFromScale.x,i=e.distanceFromScale.y):(t=e.distanceFromScale.y,i=e.distanceFromScale.x),n="major"==e.type?this.scaleEl[this.scaleIndex].majorIntervalValue:this.scaleEl[this.scaleIndex].minorIntervalValue,"near"==e.placement?(s="Vertical"==this.Model.orientation?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="Vertical"==this.Model.orientation?"right":"center"):"far"==e.placement?(s="Vertical"==this.Model.orientation?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="Vertical"==this.Model.orientation?"left":"center"):(this.contextEl.textAlign="center",s="Vertical"==this.Model.orientation?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),o=this.scaleEl[this.scaleIndex].minimum;o<=this.scaleEl[this.scaleIndex].maximum;o=this._addDecimal(o,n))(n==this.scaleEl[this.scaleIndex].minorIntervalValue&&o%this.scaleEl[this.scaleIndex].majorIntervalValue!=0||n==this.scaleEl[this.scaleIndex].majorIntervalValue)&&(a="counterclockwise"==this.scaleEl[this.scaleIndex].direction?this._getCounterClockwiseLinePosition(o):this._getClockwiseLinePosition(o),this.labelValue=o,this.region={lineChangePosition:a+i,lineStaticPosition:s+t},this.style={angle:"Vertical"==this.Model.orientation?e.angle:e.angle+270,fillStyle:e.textColor?"transparent"==e.textColor?"rgba(0,0,0,0)":this._getColor(e,e.textColor):"transparent"==this.Model.labelColor?"rgba(0,0,0,0)":this._getColor(e,this.Model.labelColor),opacity:isNaN(e.opacity)?1:e.opacity,font:this._getFontString(this,e.font),textValue:this.labelValue},this.Model.drawLabels&&this._onDrawLabels("Vertical"==this.Model.orientation?e.angle:e.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(e,i,s){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),"Vertical"==this.Model.orientation?(this.contextEl.translate(e.lineStaticPosition,e.lineChangePosition),this.model.tooltip.showLabelTooltip&&!s&&this._savedPoints.push({startX:e.lineStaticPosition+5,startY:e.lineChangePosition+10,width:15,height:15,value:i.textValue}),this.model.tooltip.showCustomLabelTooltip&&s&&this._savedPoints.push({startX:e.lineStaticPosition-35,startY:e.lineChangePosition+10,width:110,height:15,value:i.textValue})):(this.contextEl.translate(e.lineChangePosition,e.lineStaticPosition),this.model.tooltip.showLabelTooltip&&!s&&this._savedPoints.push({startX:e.lineChangePosition+10,startY:e.lineStaticPosition+10,width:15,height:15,value:i.textValue}),this.model.tooltip.showCustomLabelTooltip&&s&&this._savedPoints.push({startX:e.lineChangePosition-35,startY:e.lineStaticPosition+10,width:110,height:15,value:i.textValue})),this.contextEl.lineTo(0,0),"clockwise"==this.scaleEl[this.scaleIndex].direction?this.contextEl.rotate(Math.PI*(i.angle/180)):this.contextEl.rotate(-(Math.PI*(i.angle/180))),!t.isNullOrUndefined(s)&&!s){var a=this.model.scales[this.scaleIndex].labels[this.labelIndex].unitTextPlacement;t.isNullOrUndefined(a)||"back"!=a.toString()?t.isNullOrUndefined(a)||"front"!=a.toString()||(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(e,t){e.value=e.value>this.scaleEl[this.scaleIndex].maximum?this.scaleEl[this.scaleIndex].maximum:e.value,e.value=e.valuethis.scaleEl[this.scaleIndex].maximum?this.scaleEl[this.scaleIndex].maximum:e.value,e.value=e.valuethis.scaleEl[this.scaleIndex].minimum&&this.scaleEl[this.scaleIndex].minimumthis.scaleEl[this.scaleIndex].maximum?this.scaleEl[this.scaleIndex].maximum:e.endValue,this.rangePosition=e.placement,d=[{ColorStop:0,Color:"transparent"==this.Model.pointerGradient1?"rgba(0,0,0,0)":this.Model.pointerGradient1},{ColorStop:1,Color:"transparent"==this.Model.pointerGradient2?"rgba(0,0,0,0)":this.Model.pointerGradient2}],s="clockwise"==this.scaleEl[this.scaleIndex].direction?this._getClockwiseLinePosition(t):this._getCounterClockwiseLinePosition(t),a="clockwise"==this.scaleEl[this.scaleIndex].direction?this._getClockwiseLinePosition(i):this._getCounterClockwiseLinePosition(i),"Vertical"==this.Model.orientation?("far"==e.placement&&(n=this.scaleStartX[this.scaleIndex]+e.distanceFromScale+this.scaleEl[this.scaleIndex].width+this.scaleEl[this.scaleIndex].border.width),"near"==e.placement&&(n=this.scaleStartX[this.scaleIndex]+e.distanceFromScale),"center"==e.placement&&(n=e.startWidth>e.endWidth?this.scaleStartX[this.scaleIndex]+e.distanceFromScale+this.scaleEl[this.scaleIndex].width/2-e.startWidth/2:this.scaleStartX[this.scaleIndex]+e.distanceFromScale+this.scaleEl[this.scaleIndex].width/2-e.endWidth/2),r=this.contextEl.createLinearGradient(a,a,a,s),this.region={startX:n,startY:s,endY:a}):("far"==e.placement&&(o=this.scaleStartY[this.scaleIndex]+this.scaleEl[this.scaleIndex].width+e.distanceFromScale+this.scaleEl[this.scaleIndex].border.width),"near"==e.placement&&(o=this.scaleStartY[this.scaleIndex]+e.distanceFromScale),"center"==e.placement&&(o=e.startWidth>e.endWidth?this.scaleStartY[this.scaleIndex]+e.distanceFromScale+this.scaleEl[this.scaleIndex].width/2-e.startWidth/2:this.scaleStartY[this.scaleIndex]+e.distanceFromScale+this.scaleEl[this.scaleIndex].width/2-e.endWidth/2),r=this.contextEl.createLinearGradient(a,o,s,o),this.region={startX:s,startY:o,endX:a}),e.backgroundColor?l="transparent"==e.backgroundColor?"rgba(0,0,0,0)":this._getColor(e,e.backgroundColor):e.gradients?this._setGradientColor(this,r,e.gradients.colorInfo):this.Model.RangeInterior?this._setGradientColor(this,r,this.Model.RangeInterior.colorInfo):this._setGradientColor(this,r,d), this.style={startWidth:e.startWidth,lineWidth:e.border.width,isStroke:!0,isFill:!0,opacity:isNaN(e.opacity)?.4:e.opacity,endWidth:e.endWidth,fillStyle:e.backgroundColor?"transparent"==l?"rgba(0,0,0,0)":this._getColor(e,l):"transparent"==r?"rgba(0,0,0,0)":this._getColor(e,r),strokeStyle:e.border.color?"transparent"==e.border.color?"rgba(0,0,0,0)":this._getColor(e,e.border.color):"transparent"==this.Model.borderColor?"rgba(0,0,0,0)":this._getColor(e,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(e,t){this._contextOpenPath(t,this),"Vertical"==this.Model.orientation?(this.contextEl.lineTo(e.startX,e.startY),this.contextEl.lineTo(e.startX,e.endY),"near"==this.rangePosition?(this.contextEl.lineTo(e.startX-t.endWidth,e.endY),this.contextEl.lineTo(e.startX-t.startWidth,e.startY)):(this.contextEl.lineTo(e.startX+t.endWidth,e.endY),this.contextEl.lineTo(e.startX+t.startWidth,e.startY))):(this.contextEl.lineTo(e.startX,e.startY),this.contextEl.lineTo(e.endX,e.startY),"near"==this.rangePosition?(this.contextEl.lineTo(e.endX,e.startY-t.endWidth),this.contextEl.lineTo(e.startX,e.startY-t.startWidth)):(this.contextEl.lineTo(e.endX,e.startY+t.endWidth),this.contextEl.lineTo(e.startX,e.startY+t.startWidth))),this._contextClosePath(t,this)},_setCustomLabelCordinates:function(e,t){this._customLblMaxSize=this._customLblMaxSize=i.startValue&&r.markerPointerEl[r.markerPointerIndex].value<=i.endValue&&(l=!0,!t.isNullOrUndefined(i.text)&&i.text.length>0&&(r.style.indicatorText=i.text,r.style.textColor="transparent"==i.textColor?"rgba(0,0,0,0)":r._getColor(s,i.textColor),r.style.font=r._getFontString(r,s.font)),"text"!=s.type?(r.style.strokeStyle="transparent"==i.borderColor?"rgba(0,0,0,0)":r._getColor(s,i.borderColor),r.style.fillStyle="transparent"==i.backgroundColor?"rgba(0,0,0,0)":r._getColor(s,i.backgroundColor),r._drawFrame(s.type,r.region,r.style,r)):"text"==s.type&&r._drawText(r.region,r.style))}),l||"text"==s.type||this._drawFrame(s.type,r.region,r.style,r),this.contextEl.getImageData&&(this.indicatorImage=this.contextEl.getImageData(0,0,this.Model.width,this.Model.height))},_drawFrame:function(e,t,i){switch(e){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(e,t){this.contextEl.beginPath(),this.contextEl.textAlign="center",this.contextEl.fillStyle="transparent"==t.textColor?"rgba(0,0,0,0)":t.textColor,this.contextEl.font=t.font,this.contextEl.fillText(t.indicatorText,e.textLocation.x,e.textLocation.y),this.contextEl.closePath()},_drawTriangle:function(e,t,i){t=this._setPointerDimension(t,i),this._contextOpenPath(t,i),i.contextEl.translate(e.startX,e.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(e,t,i){t=this._setPointerDimension(t,i),this._contextOpenPath(t,i),i.contextEl.translate(e.startX,e.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(e,t,i){t=this._setPointerDimension(t,i),this._contextOpenPath(t,i),i.contextEl.translate(e.startX,e.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(e,t,i){t=this._setPointerDimension(t,i),this._contextOpenPath(t,i),i.contextEl.translate(e.startX,e.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(e,t,i){this._contextOpenPath(t,i),"horizontal"==i.Model.orientation&&"near"==i.markerPlacement?(i.contextEl.lineTo(e.startX+t.width-t.width/6,e.startY),i.contextEl.lineTo(e.startX,e.startY+t.height-t.height/3),i.contextEl.lineTo(e.startX+t.width,e.startY+t.height-t.height/3),i.contextEl.lineTo(e.startX+t.width/6,e.startY),i.contextEl.lineTo(e.startX+t.width/2,e.startY+t.height)):(i.contextEl.lineTo(e.startX+t.width/6,e.startY+t.height),i.contextEl.lineTo(e.startX+t.width,e.startY+t.height/3),i.contextEl.lineTo(e.startX,e.startY+t.height/3),i.contextEl.lineTo(e.startX+t.width-t.width/6,e.startY+t.height),i.contextEl.lineTo(e.startX+t.width/2,e.startY)),this._contextClosePath(t,i)},_drawPentagon:function(e,t,i){t=this._setPointerDimension(t,i),this._contextOpenPath(t,i),i.contextEl.translate(e.startX,e.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(e,t,i){t=this._setPointerDimension(t,i),this._contextOpenPath(t,i),i.contextEl.translate(e.startX,e.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(e,t,i){var s=Math.sqrt(t.height*t.height+t.width*t.width)/2;t=this._setPointerDimension(t,i),this._contextOpenPath(t,i),i.contextEl.translate(e.startX,e.startY),this._setContextRotation(t,i),i.contextEl.arc(s/2,0,s/2,0,2*Math.PI,!0),this._contextClosePath(t,i)},_drawTrapezoid:function(e,t,i){t=this._setPointerDimension(t,i),this._contextOpenPath(t,i),i.contextEl.translate(e.startX,e.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(e,t,i){t=this._setPointerDimension(t,i),this._contextOpenPath(t,i),i.contextEl.translate(e.startX,e.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(e,t,i){t=this._setPointerDimension(t,i),this._contextOpenPath(t,i),i.contextEl.translate(e.startX,e.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 s=new Image;e(s).load(function(){t.contextEl.drawImage(this,0,0,t.Model.width,t.Model.height),null!=t.Model.scales&&t._drawScales(),null!=t.Model.Items&&t._renderItems()}).attr("src",i)},_drawEllipse:function(e,t,i){var s=Math.sqrt(t.height*t.height+t.width*t.width)/2;t=this._setPointerDimension(t,i),this._contextOpenPath(t,i),i.contextEl.translate(e.startX,e.startY),this._setContextRotation(t,i),i.contextEl.scale(2,1),i.contextEl.arc(s/2,0,s/2,0,2*Math.PI,!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(e,i,s){e=this.scaleEl[e].minimum&&(this.scaleEl[e].markerPointers[i].value=s),this.contextEl.putImageData?(this.contextEl.putImageData(this._getMarkerPointerImage(),0,0),!t.isNullOrUndefined(this.outerDiv)&&this.model.scale[e].showCustomLabels&&this.outerDiv.empty(),this._setCustomLabel(),this._setMarkerPointers(),this._setIndicators()):this.initialize())},getPointerValue:function(e,t){return e=this.scaleEl[e].minimum&&(this.scaleEl[e].barPointers[t].value=i),this.contextEl.putImageData?"thermometer"==this.scaleEl[this.scaleIndex].type?this.initialize():this._reDrawBarPointer():this.initialize())},getBarPointerValue:function(e,t){return ethis.scaleEl[e].minimum&&(this.scaleEl[e].maximum=t),this.initialize())},getMaximumValue:function(e){return ethis._customLblMaxSize?this._customLblMaxSize.toString()+"px":(parseFloat(this.model.scales[n].customLabels[o].font.size.match(/\d+/)[0])*a).toString()+"px");this._render(),0==_linearGaugeCount&&(initialLinearDivWidth=window.innerWidth)}},_onDrawTicks:function(e,t){var i=({index:this.tickIndex,element:this.tickEl[this.tickIndex], angle:parseInt(e),value:t},{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(e){var t={index:this.labelIndex,element:this.labelEl[this.labelIndex],angle:parseInt(e),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(e){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:e};this._trigger("drawBarPointers",t)},_onDrawMarkerPointers:function(e,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(e)};this._trigger("drawMarkerPointers",i)},_onDrawRange:function(){var e={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",e)},_onDrawCustomLabel:function(){var e={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",e)},_onDrawIndicators:function(){var e={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",e)},onLoad:function(){var e={object:this,Model:this.Model,scaleElement:this.Model.scales,context:this.contextEl};this._trigger("load",e)},_onInit:function(){var e={object:this,Model:this.Model,scaleElement:this.Model.scales,context:this.contextEl};this._trigger("init",e)},_onRenderComplete:function(){var e={object:this,Model:this.Model,scaleElement:this.Model.scales,context:this.contextEl};this._trigger("renderComplete",e)},_onMouseClick:function(e){var t={index:this.markerPointerIndex,element:this.markerPointerEl[this.markerPointerIndex],value:e},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(e){var t={index:this.markerPointerIndex,element:this.markerPointerEl[this.markerPointerIndex],value:e},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(e){var t={index:this.markerPointerIndex,element:this.markerPointerEl[this.markerPointerIndex],value:e},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,"Vertical"==this.Model.orientation?this.scaleStartY[this.scaleIndex]="clockwise"==this.scaleEl[this.scaleIndex].direction?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]="clockwise"==this.scaleEl[this.scaleIndex].direction?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,"Vertical"==this.Model.orientation?this.scaleStartY[this.scaleIndex]="clockwise"==this.scaleEl[this.scaleIndex].direction?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]="clockwise"==this.scaleEl[this.scaleIndex].direction?this.scaleStartX[this.scaleIndex]+this.bottomRadius+this.scaleEl[this.scaleIndex].width/2:this.scaleStartX[this.scaleIndex]+this.scaleEl[this.scaleIndex].width/2},_getClockwiseLinePosition:function(e){var t;return t=(e-this.scaleEl[this.scaleIndex].minimum)/(this.scaleEl[this.scaleIndex].maximum-this.scaleEl[this.scaleIndex].minimum)*100,"Vertical"==this.Model.orientation?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(e){var t;return t=this.scaleEl[this.scaleIndex].maximum-e+this.scaleEl[this.scaleIndex].minimum,t=(t-this.scaleEl[this.scaleIndex].minimum)/(this.scaleEl[this.scaleIndex].maximum-this.scaleEl[this.scaleIndex].minimum)*100,"Vertical"==this.Model.orientation?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(e){var t,i;return t="Vertical"==this.Model.orientation?(e.y-this.scaleStartY[this.scaleIndex])/this.scaleEl[this.scaleIndex].length*100:(e.x-this.scaleStartX[this.scaleIndex])/this.scaleEl[this.scaleIndex].length*100,i=(t*(this.scaleEl[this.scaleIndex].maximum-this.scaleEl[this.scaleIndex].minimum)+this.scaleEl[this.scaleIndex].minimum)/100,"counterclockwise"==this.scaleEl[this.scaleIndex].direction?this.scaleEl[this.scaleIndex].maximum-i:this.scaleEl[this.scaleIndex].minimum+i},_getPointerXPosition:function(e){var t,i;return"Vertical"==this.Model.orientation?("far"==this.markerPlacement&&(t=this.scaleStartX[this.scaleIndex]+this.scaleEl[this.scaleIndex].width+this.scaleEl[this.scaleIndex].border.width/2+e.distanceFromScale,i=0),"near"==this.markerPlacement&&(t=this.scaleStartX[this.scaleIndex]+e.distanceFromScale,i=180),"center"==this.markerPlacement&&(t="circle"==e.type?this.scaleStartX[this.scaleIndex]+this.scaleEl[this.scaleIndex].width/2-Math.sqrt(e.length*e.length+e.width*e.width)/2+e.distanceFromScale:this.scaleStartX[this.scaleIndex]+this.scaleEl[this.scaleIndex].width/2-e.width/2+e.distanceFromScale,i=0)):("far"==this.markerPlacement&&(t=this.scaleStartY[this.scaleIndex]+this.scaleEl[this.scaleIndex].width+this.scaleEl[this.scaleIndex].border.width/2+e.distanceFromScale,i=90),"near"==this.markerPlacement&&(t=this.scaleStartY[this.scaleIndex]-this.scaleEl[this.scaleIndex].border.width/2+e.distanceFromScale,i=270),"center"==this.markerPlacement&&(t="circle"==e.type?this.scaleStartY[this.scaleIndex]+this.scaleEl[this.scaleIndex].width/2-Math.sqrt(e.length*e.length+e.width*e.width)/2+e.distanceFromScale:this.scaleStartY[this.scaleIndex]+this.scaleEl[this.scaleIndex].width/2-e.length/2+e.distanceFromScale,i=90)),{startx:t,angle:i}},_hexFromRGB:function(t,i,s){var a=[t.toString(16),i.toString(16),s.toString(16)];return e.each(a,function(e,t){1===t.length&&(a[e]="0"+t)}),a.join("").toUpperCase()},_setGradientColor:function(t,i,s){s.Name||"string"==typeof s?(i.addColorStop(0,s),i.addColorStop(1,s)):e.each(s,function(e,t){i.addColorStop(NaN!=t.colorStop?t.colorStop:0,"string"==typeof t.color?t.color:t.color)})},_getFontString:function(e,t){return t.fontStyle+" "+(null==t.size?"11px":t.size)+" "+t.fontFamily},_setPointerDimension:function(e,t){if(t.Model.orientation&&"horizontal"==t.Model.orientation){var i=e.width,s=e.height;e.height=i,e.width=s}return e},_setContextRotation:function(e,t){t.contextEl.rotate(Math.PI*(e.angle/180))},wireEvents:function(){this.startEv="mousedown",this.moveEv="mousemove",this.endEv="mouseup",this.scrollEv="wheel",this.onMouseMoveHandler=e.proxy(this._onMouseMove,this),this.onHoverOCustomLabel=e.proxy(this._onHoverOCustomLabel,this),this.onLeaveOCustomLabel=e.proxy(this._onLeaveOCustomLabel,this),this.model.readOnly||(this.onMouseDownHandler=e.proxy(this._onMouseDown,this)),(this.model.tooltip.showCustomLabelTooltip||this.model.tooltip.showLabelTooltip)&&(e(this.canvasEl).bind(this.moveEv,this.onMouseMoveHandler),e(this.canvasEl).bind(this.scrollEv,this.onMouseMoveHandler)),this.element.bind(this.startEv,this.onMouseDownHandler),this.model.tooltip.showCustomLabelTooltip&&(e("."+this._id+"outercustomlbl").bind("mouseenter",this.onHoverOCustomLabel),e("."+this._id+"outercustomlbl").bind("mouseleave",this.onLeaveOCustomLabel))},unWireEvents:function(){this.element.unbind(this.startEv,this.onMouseDownHandler)},_onHoverOCustomLabel:function(e){(null!=e.currentTarget.innerHTML||""!=e.currentTarget.innerHTML)&&this._showTooltip(e,e.currentTarget.innerHTML)},_onLeaveOCustomLabel:function(){this._hideTooltip()},_blockDefaultActions:function(e){e.cancelBubble=!0,e.returnValue=!1,e.preventDefault&&e.preventDefault(),e.stopPropagation&&e.stopPropagation()},_onMouseDown:function(t){var i,s,a,n,o,r;this._blockDefaultActions(t),this._mouseDown=!0,i={x:t.pageX-e(this.canvasEl).offset().left-(this.Model.frame.outerWidth+this.Model.frame.innerWidth),y:t.pageY-e(this.canvasEl).offset().top-(this.Model.frame.outerWidth+this.Model.frame.innerWidth)},r=this,e.each(this.Model.scales,function(t,l){r.scaleIndex=t,null!=l.markerPointers&&(r.markerPointerEl=l.markerPointers,e.each(l.markerPointers,function(t,l){s="clockwise"==r.scaleEl[r.scaleIndex].direction?r._getClockwiseLinePosition(l.value):r._getCounterClockwiseLinePosition(l.value),a=s+l.width,n=s-l.width,o=r._getPointerXPosition(l).startx;var d=r._isBetween(("horizontal"==r.Model.orientation?i.y:i.x)-l.width,("horizontal"==r.Model.orientation?i.y:i.x)+l.width,o);("horizontal"==r.Model.orientation?r._isBetween(n,a,i.x):r._isBetween(n,a,i.y))&&d&&(r.activeElement=l),null!=r.Model.scales[r.scaleIndex].barPointers[t]&&(r.activeBarElement=r.Model.scales[r.scaleIndex].barPointers[t]),r.model.mouseClick&&r._onMouseClick(l.value),r.onMouseMoveHandler=e.proxy(r._onMouseMove,r),r.onMouseUpHandler=e.proxy(r._onMouseUp,r),e(document).bind(r.moveEv,r.onMouseMoveHandler),e(document).bind(r.endEv,r.onMouseUpHandler)}))})},_isBetween:function(e,t,i){return e=e&&i<=t:i>=t&&i<=e},_onMouseUp:function(){this._mouseDown=!1,this.mouseMove=!1,e(document).unbind(self.moveEv,self.onMouseMoveHandler),e(document).unbind(self.endEv,self.onMouseUpHandler),this.model.mouseClickUp&&this._onMouseClickUp(this.activeElement.value),this.activeElement=null},_onMouseMove:function(i){var s,a,n,o;if(this._mouseDown&&!t.isNullOrUndefined(this.activeElement))this._blockDefaultActions(i),s={x:i.pageX-e(this.canvasEl).offset().left-(this.Model.frame.outerWidth+this.Model.frame.innerWidth),y:i.pageY-e(this.canvasEl).offset().top-(this.Model.frame.outerWidth+this.Model.frame.innerWidth)},this.activeElement.value=this._getValue(s),this.value(this.activeElement.value),this.model.mouseClickMove&&this._onMouseClickMove(this.activeElement.value),this.activeBarElement&&(this.activeBarElement.value=this._getValue(s)),this.contextEl.putImageData?this._reDrawBarPointer():this._init();else if(this.model.tooltip.showCustomLabelTooltip||this.model.tooltip.showLabelTooltip)for(a=!1,n=0;null!=this._savedPoints[n];n++)o={X:i.pageX-e(this.canvasEl).offset().left,Y:i.pageY-e(this.canvasEl).offset().top},o.X>this._savedPoints[n].startX&&o.Xthis._savedPoints[n].startY&&o.Y
      "),e(document.body).append(n)),""!=this.model.tooltip.templateID&&null!=this.model.tooltip.templateID?(s=e("#"+this.model.tooltip.templateID).clone(),e(".tooltipDiv")[0].innerHTML="",e(s).css("display","block").appendTo(n),e(n).css({"background-color":this.model.backgroundColor,border:"1px solid #bbbcbb","border-radius":"3px",color:"#565656"}),n.html(n.html().replace("#label#",a))):(e(n).html(a),e(n).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 o=10,r=t.pageX+o,l=t.pageY+o;r=r+e(n).width()"),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,s=t.canvasEl[0],"undefined"!=typeof G_vmlCanvasManager&&(s=window.G_vmlCanvasManager.initElement(s)),s&&s.getContext&&(t.contextEl=t.canvasEl[0].getContext("2d"))},_drawCustomImage:function(t,i){var s=new Image;e(s).load(function(){t.contextEl.drawImage(this,0,0,t.model.width,t.model.height),null!=t.model.Scales&&t._drawScales(),null!=t.model.items&&t._renderItems()}).attr("src",i)},_setSegmentCount:function(e){switch(e){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=[];null!=this.model.items&&e.each(this.model.items,function(e,i){t.push(i.characterSettings.count)})},_renderItems:function(){if(null!=this.model.items){this._setInnerPosition();var t=this;e.each(this.model.items,function(e,i){t._setSegmentCount(i.characterSettings.type),t.itemIndex=e,t.canvasEl.attr("aria-label",i.value),t._setShadow(e,i),i.enableCustomFont?t._setCustomFont(e,i):i.characterSettings.type.indexOf("matrix")!=-1?t._drawMatrixSegments(e,i):t._drawSegments(e,i)})}},_setGradientColor:function(t,i,s){s.Name||"string"==typeof s?(i.addColorStop(0,this._getColor(t,s)),i.addColorStop(1,this._getColor(t,s))):e.each(s,function(e,s){i.addColorStop(NaN!=s.colorStop?s.colorStop:0,"string"==typeof s.color?s.color:this._getColor(t,s.color))})},_getColor:function(e,t){return"string"==typeof t?t:"rgba("+t.R+", "+t.G+","+t.B+", "+t.A/255+")"},_drawMatrixSegments:function(t,i){var s,a,n,o,r,l=[],d=[];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*(2*this._SegmentCount[0]*this.radius+i.characterSettings.spacing+this._SegmentCount[0]*i.segmentSettings.spacing))*(i.position.x/100),a=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),n=0;no)return!1;d[e]==o&&l.push(parseInt(d[e+1]))}}),r=0;r4?this._value.length:4),this.characterSpace="sevensegment"==i.characterSettings.type?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),s=0;s0&&e.textAngle<120?t=e.subTitle._location.y-e._location.y:e.textPosition==e.indicator.textPosition&&e.textAlignment==e.indicator.textAlignment&&e.textAngle>0&&e.textAngle<120?t=e.indicator._location.y-e._location.y:e.textPosition==e.subTitle.textPosition&&e._location.y0&&e.textAngle<180?t=e.subTitle._location.y-e._location.y:e.textPosition==e.subTitle.textPosition&&e._location.y>e.subTitle._location.y&&e.textAngle>190&&e.textAngle<360?t=e._location.y-e.subTitle._location.y:e.textPosition==e.indicator.textPosition&&e._location.y0&&e.textAngle<180?t=e.indicator._location.y-e._location.y:e.textPosition==e.indicator.textPosition&&e._location.y>e.indicator._location.y&&e.textAngle>190&&e.textAngle<360&&(t=e._location.y-e.indicator._location.y),this._trim(e.displayText,e,t,isRotate=!0)},_indOverlap:function(e,t){var i,s=this.model.captionSettings.subTitle,a=this.model.captionSettings;return e.textPosition==s.textPosition&&e.textAlignment==s.textAlignment&&e.textAngle>190&&e.textAngle<360?i=t.y-s._location.y:e.textPosition==a.textPosition&&e.textAlignment==a.textAlignment&&e.textAngle>190&&e.textAngle<360?i=t.y-a._location.y:e.textPosition==s.textPosition&&e._location.y0&&e.textAngle<180?i=s._location.y-e._location.y:e.textPosition==s.textPosition&&e._location.y>s._location.y&&e.textAngle>190&&e.textAngle<360?i=e._location.y-s._location.y:e.textPosition==a.textPosition&&e._location.y0&&e.textAngle<180?i=a._location.y-e._location.y:e.textPosition==a.textPosition&&e._location.y>a._location.y&&e.textAngle>190&&e.textAngle<360&&(i=e._location.y-a._location.y),this._trim(e.displayText,e,i,isRotate=!0)},_subOverlap:function(e){var t,i=this.model.captionSettings.indicator,s=this.model.captionSettings;return e.textPosition==i.textPosition&&e.textAlignment==i.textAlignment&&e.textAngle>0&&e.textAngle<180?t=i._location.y-e._location.y:e.textPosition==s.textPosition&&e.textAlignment==s.textAlignment&&e.textAngle>190&&e.textAngle<360?t=e._location.y-s._location.y:e.textPosition==i.textPosition&&e._location.y0&&e.textAngle<180?t=i._location.y-e._location.y:e.textPosition==i.textPosition&&e._location.y>i._location.y&&e.textAngle>190&&e.textAngle<360?t=e._location.y-i._location.y:e.textPosition==s.textPosition&&e._location.y0&&e.textAngle<180?t=s._location.y-e._location.y:e.textPosition==s.textPosition&&e._location.y>s._location.y&&e.textAngle>190&&e.textAngle<360&&(t=e._location.y-s._location.y),this._trim(e.displayText,e,t,isRotate=!0)},rotatedLabel:function(e,i,s,a){var n={"font-size":e.size,transform:"rotate("+s+",0,0)","font-family":e.fontFamily,"font-style":e.fontStyle,rotateAngle:"rotate("+s+"deg)","text-anchor":"middle"},o=i.svgRenderer.createText(n,a);return Math.ceil(t.EjSvgRender.utils._measureBounds(o,i).width)},calcGap:function(e,t,i,s,a,n,o){var r;return e>=0&&e<=90?s+t.y>=o&&e>0?(r=o-t.y,a=!0):s+t.y<=o&&i+t.x>=n&&e>0?r=n-t.x:s+t.y<=o&&e>0?(r=o-t.y,a=!0):r=n-t.x:e>90&&e<180?s+t.y>=o?(r=o-t.y,a=!0):s+t.y<=o&&i+t.x>=n?r=t.x:i+t.x<=n?r=t.x:(r=o-t.y,a=!0):e>=180&&e<270?t.x-i>=0?(r=t.y,a=!0):t.y-s<=0&&t.x-i<=0?r=t.x:t.y-s<=0?(r=o-t.y,a=!0):r=t.x:i+t.x<=n?(r=t.y,a=!0):t.y-s>=0&&i+t.x>=n?r=n-t.x:i+t.x>=n?r=n-t.x:(r=t.y,a=!0),{trimSize:r,rotate:a}},_scaleLoc:function(){var e,i,s,a,n=this._scale,o=n.labelSettings.offset,r=n.majorTickSettings.size,l=this._scale.labelSettings,d=t.EjSvgRender.utils._measureText(l.labelPrefix+n.maximum+l.labelSuffix,null,l),h=this._orientation==t.datavisualization.BulletGraph.Orientation.Horizontal?d.height:d.width;switch(e=n.location.y,s=this.model.qualitativeRangeSize,a=this._tickPosition+this._tickPlacement+this._labelPosition+this._labelPlacement,"center"==this._tickPosition&&(r=r>s&&(r-s)/2),a){case"faroutsidebelowoutside":i=e+h+s+o+(r>o&&r-o);break;case"faroutsidebelowinside":i=e+r+s,e-=o+h>s&&o+h-s;break;case"faroutsideaboveoutside":i=e+r+s,e-=o+h;break;case"faroutsideaboveinside":i=e+r+s+(o+h>s+r?o+h-(s+r):0);break;case"farinsidebelowoutside":i=e+h+s+o,e-=r>s&&r-s;break;case"farinsidebelowinside":i=e+s,e=e-(r>s&&r-s)-(o+h>s+r&&o+h-r);break;case"farinsideaboveoutside":i=e+s,e=e-(o+h)-(r>o+h+s&&r-(o+h+s));break;case"farinsideaboveinside":i=e+s+(o+h>s&&h+o-s),e-=r>s&&r-s;break;case"nearoutsidebelowoutside":i=e+s+o+h,e-=r;break;case"nearoutsidebelowinside":i=e+s,e=e-r-(o+h>s+r&&o+h-(s+r));break;case"nearoutsideaboveoutside":i=e+s,e=e-r-(rs&&o+h-s),e-=r;break;case"nearinsidebelowoutside":i=e+s+(r>o+h+s?r-s:o+h);break;case"nearinsidebelowinside":i=e+s+(r>s&&r-s),e-=o+h>s&&o+h-s;break;case"nearinsideaboveoutside":i=e+(r>s?r:s),e=e-o-h;break;case"nearinsideaboveinside":i=e+s+(r>h+o?r-s:h+o-s);break;case"centeroutsidebelowoutside":i=e+s+(r>o+h?r:o+h),e-=r;break;case"centeroutsidebelowinside":i=e+s+r,e=e-r-(o+h>s+r&&o+h-(s+r));break;case"centeroutsideaboveoutside":i=e+s+r,e=e-r-(rs+r?o+h-s-r:r),e-=r;break;case"centerinsidebelowoutside":i=e+s+(r>o+h?r:o+h),e-=r;break;case"centerinsidebelowinside":i=e+s+r,e-=o+h-s>r?o+h-s:r;break;case"centerinsideaboveoutside":i=e+s+r,e=e-r-(rh+o?r:h+o-s),e-=r}return{x:n.location.x,y:e,height:i}},_displayText:function(i,s){var a,n,o,r=e.extend(!0,s),l=i.textAngle%360,d=i.text,h=i.font,c=this._scale,u=this._scale.labelSettings,m=t.EjSvgRender.utils._measureText(u.labelPrefix+c.minimum+u.labelSuffix,null,u).width,p=t.EjSvgRender.utils._measureText(d,null,h).width,g=t.EjSvgRender.utils.rotatedLabel(i,this,l,i.text),_=this.rotatedLabel(h,this,l,i.text),f=this.model.height,b=this.model.width,v=!1,x=this._scaleLoc();return i.textSpacing&&(p+=i.textSpacing,_+=i.textSpacing),this._orientation==t.datavisualization.BulletGraph.Orientation.Horizontal?(r.x<=x.x&&x.y<=r.y&&r.y<=x.height?b=c.location.x-m/2:r.x<=x.x&&r.y<=x.y&&l<90?f=x.y:r.x>=x.x&&r.x<=x.x+this.model.quantitativeScaleLength&&r.y<=x.y?f=x.y:r.y<=x.y&&r.x>=x.x+this.model.quantitativeScaleLength&&l>=90?f=x.y:r.x>=x.x+this.model.quantitativeScaleLength&&x.y<=r.y&&r.y<=x.height&&l<270?(b-=x.x+this.model.quantitativeScaleLength,r.x=r.x-(x.x+this.model.quantitativeScaleLength)):r.x<=x.x&&r.y>=x.height&&l>270?r.y=r.y-x.height:r.x>=x.x&&r.x<=x.x+this.model.quantitativeScaleLength&&r.y>=x.height?r.y=r.y-x.height:r.x>=x.x+this.model.quantitativeScaleLength&&r.y>=x.height&&l>=180&&l<270&&(r.y=r.y-x.height),a=this.calcGap(l,r,_,g,v,b,f),v=a.rotate,a=a.trimSize):(n=x.height-x.y,x.y=this.model.height-c.location.y-this.model.quantitativeScaleLength,x.height=x.y+this.model.quantitativeScaleLength,r.x<=x.x&&x.y<=r.y&&r.y<=x.height?b=c.location.x-m/2:r.x<=x.x&&r.y<=x.y&&l<90?f=x.y:r.x>=x.x&&r.x<=x.x+n&&r.y<=x.y?f=x.y:r.y<=x.y&&r.x>=x.x+n&&l>=90?f=x.y:r.x>=x.x+n&&x.y<=r.y&&r.y<=x.height&&l<=260?(b-=x.x+n,r.x=r.x-(x.x+n)):r.x<=x.x&&r.y>=x.height&&l>=280?r.y=r.y-x.height:r.x>=x.x&&r.x<=x.x+n&&r.y>=x.height?r.y=r.y-x.height:r.x>=x.x+n&&r.y>=x.height&&l>=180&&l<=260&&(r.y=r.y-x.height),a=this.calcGap(l,r,_,g,v,b,f),v=a.rotate,a=a.trimSize),o=d,this._trim(d,i,a,v)},_trim:function(e,i,s,a){var n,o,r,l=e,d=this.rotatedLabel(i.font,this,i.textAngle,e),h=t.EjSvgRender.utils._measureText(e,null,i.font).width;if(i.textSpacing&&(h+=i.textSpacing,d+=i.textSpacing),h>s&&""!=e){for(o=1;o<=e.toString().length;o++)if(e=l.toString().substring(0,o)+"... ",n=1==a?t.EjSvgRender.utils.rotatedLabel(i,this,i.textAngle,e):t.EjSvgRender.utils._measureText(e,null,i.font).width,i.textSpacing&&(n+=i.textSpacing),n>=s){e=e.toString().substring(0,o-1)+"... ",l=e;break}r=l.toString(0,e.toString.lenght-4),r!=l&&(l=e)}return l},_getVerticalScaleLocation:function(e){return{x:this._scale.location.y,y:this.model.height-this._scale.location.x-e}},_horizontalTextPositioning:function(e,i,s,a,n){var o=e.textPosition.toLowerCase(),r=i.alignment,s=this._scaleLoc(),l=this._scale.labelSettings,d=t.EjSvgRender.utils._measureText(l.labelPrefix+this._scale.maximum+l.labelSuffix,null,l).width;switch(o){case"left":i.x=s.x-i.width-i.padding-d/2,i.y=s.y+("center"==r?a.height/2+i.height/3:"far"==r?a.height:i.height),n[0].push(i);break;case"right":i.x=s.x+a.width+i.padding+d/2,i.y=s.y+("center"==r?a.height/2+i.height/3:"far"==r?a.height:i.height),n[1].push(i);break;case"top":i.x="center"==r?a.x+a.width/2-i.width/2:"near"==r?a.x:a.x+a.width-i.width,i.y=s.y-i.padding,n[2].push(i);break;case"bottom":i.x="center"==r?a.x+a.width/2-i.width/2:"near"==r?a.x:a.x+a.width-i.width,i.y=s.height+i.height/2+i.padding,n[3].push(i)}},_VerticalTextPositioning:function(e,t,i,s,a){var n=e.textPosition.toLowerCase(),o=t.alignment,r=this._scaleLoc();switch(n){case"left":t.x=r.y-t.width-t.padding,t.y=i.y+("center"==o?s.height/2+t.height/3:"far"==o?s.height:t.height),"near"==this._tickPosition&&"inside"==this._tickPlacement&&"above"==this._labelPosition&&"inside"==this._labelPlacement&&(t.x+=this._scale.majorTickSettings.size),a[0].push(t);break;case"right":t.x=r.height+t.padding,t.y=i.y+("center"==o?s.height/2+t.height/3:"far"==o?s.height:t.height),a[1].push(t);break;case"top":t.x=s.x-t.width/2+("center"==o?s.width/2:"far"==o&&s.width),t.y=s.y-t.padding-this._scale.labelSettings.size/2,a[2].push(t);break;case"bottom":t.x=s.x-t.width/2+("center"==o?s.width/2:"far"==o&&s.width),t.y=s.y+s.height+t.height+t.padding-t.height/3+this._scale.labelSettings.size/2,a[3].push(t)}},_positionTextGroup:function(e,t,i){for(var s=[[],[],[],[]],a="horizontal"==this._orientation,n=a?this._scaleLocation:this._getVerticalScaleLocation(i.width),o=a?i:{x:n.x,y:n.y,width:i.height,height:i.width},r=0;r=0;a--){if(this._isOverlapping(t[s],t[a])){switch(n){case 0:case 1:t[a].y>t[s].y?t[a].y=t[s].y+t[a].height+(t[a].padding>1?t[a].padding:1):t[s].y=t[a].y+t[s].height+(t[s].padding>1?t[s].padding:1);break;case 2:t[a].y=t[s].y-t[s].height-(t[a].padding>1?t[a].padding:1);break;default:t[s].y=t[a].y+t[a].height+(t[a].padding>1?t[a].padding:1)}i=!0;break}i=!1}while(i)}this._applyLeftRightAnchor([e[0],e[1]]),this._applyTopBottomAnchor([e[2],e[3]])},_locateTextGroup:function(e,t){for(var i=0;i1){for(t=0,i=0;i1){for(t=0,i=0;i1){for(t=0,i=0;it.x+t.width||e.y-e.height>t.y||e.y0&&a.select(s),this.model.fields.dataSource.dataSource.url.match(e.tableName+"$")||t.isNullOrUndefined(e.tableName)||a.from(e.tableName)}else a=e.query;return a},_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=e.extend(this.model.captionSettings,t)}},_drawBulletSymbol:function(e,i,s,a){var n,o,r,l,d,h,c,u,m,p,g,_="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);switch(e.toLowerCase()){case"circle":n=Math.min(i.height,i.width)/2,s.cx=i.x,s.cy=i.y,s.r=n,this.svgRenderer.drawCircle(s,a);break;case"leftarrow":s.d=_,this.svgRenderer.drawPath(s,a);break;case"rightarrow":s.d=_,s.transform="rotate(180,"+i.x+","+i.y+")",this.svgRenderer.drawPath(s,a);break;case"uparrow":s.d=_,s.transform="rotate(90,"+i.x+","+i.y+")",this.svgRenderer.drawPath(s,a);break;case"downarrow":s.d=_,s.transform="rotate(-90,"+i.x+","+i.y+")",this.svgRenderer.drawPath(s,a);break;case"cross":o="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),s.d=o,s.stroke=s.stroke?s.stroke:s.fill,this.svgRenderer.drawPath(s,a);break;case"horizontalline":r="M "+(i.x+-i.width/2)+" "+i.y+" L "+(i.x+i.width/2)+" "+i.y,s.d=r,s.stroke=s.stroke?s.stroke:s.fill,this.svgRenderer.drawPath(s,a);break;case"verticalline":l="M "+i.x+" "+(i.y+i.height/2)+" L "+i.x+" "+(i.y+-i.height/2),s.d=l,s.stroke=s.stroke?s.stroke:s.fill,this.svgRenderer.drawPath(s,a);break;case"triangle":d="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",s.d=d,this.svgRenderer.drawPath(s,a);break;case"invertedtriangle":d="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",s.d=d,s.transform="rotate(180,"+i.x+","+i.y+")",this.svgRenderer.drawPath(s,a);break;case"hexagon":h="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,s.d=h,this.svgRenderer.drawPath(s,a);break;case"wedge":c="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,s.d=c,this.svgRenderer.drawPath(s,a);break;case"pentagon":var n=Math.sqrt(i.height*i.height+i.width*i.width)/2,f=t.EjSvgRender.utils._getStringBuilder();for(u=0;u<=5;u++){var b=72*u,v=Math.PI/180*b,x=n*Math.cos(v),w=n*Math.sin(v);0==u?f.append("M "+(i.x+x)+" "+(i.y+w)+" "):f.append("L "+(i.x+x)+" "+(i.y+w)+" ")}s.d=f.toString(),this.svgRenderer.drawPath(s,a);break;case"star":m="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),s.d=m,this.svgRenderer.drawPath(s,a);break;case"rectangle":p="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),s.d=p,this.svgRenderer.drawPath(s,a);break;case"trapezoid":g="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,s.d=g,this.svgRenderer.drawPath(s,a);break;case"diamond":g="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,s.d=g,this.svgRenderer.drawPath(s,a);break;case"ellipse":s.cx=i.x,s.cy=i.y,s.rx=i.width/2,s.ry=i.height/2,this.svgRenderer.drawEllipse(s,a);break;case"image":s.x=i.x-i.width/2,s.y=i.y-i.height/2,s.width=i.width,s.height=i.height,s.href=this.model.captionSettings.indicator.symbol.imageURL,s.visibility="visible",this.svgRenderer.drawImage(s,a)}},_drawIndicator:function(){var i,s,a;this.model.captionSettings.indicator.visible&&(i=this.model.captionSettings.indicator,s=e.extend({},{indicatorSettings:this.model.captionSettings.indicator}),this.model.drawIndicator&&(this._trigger("drawIndicator",s),0==s.cancel&&(i=s.indicatorSettings,this.model.captionSettings.indicator=i)),a=t.EjSvgRender.utils._measureText(i.text,null,i.font),this._indicator={bounds:a,settings:i})},_indicatorTextOptions:function(e,t,i,s){var a=e._location?e._location:e.location;return{class:s,x:a.x+t.width+e.textSpacing,y:a.y-t.height/2+parseFloat(e.font.size)/3,fill:e.font.color,"font-size":e.font.size,"font-family":e.font.fontFamily,"font-style":e.font.fontStyle,"font-weight":e.font.fontWeight,"text-anchor":"start",opacity:e.font.opacity,transform:"rotate("+e.textAngle+","+t.x+","+t.y+")"}},_indicatorSymbolOptions:function(e,t){return{id:e.id+"_indicatorSymbol",stroke:t.symbol.border.color,fill:t.symbol.color,"stroke-width":t.symbol.border.width,opacity:t.symbol.opacity}},_textOptions:function(e,t){var i=e._location?e._location:e.location;return{class:t,x:i.x,y:i.y,fill:e.font.color,"font-size":e.font.size,"font-family":e.font.fontFamily,"font-style":e.font.fontStyle,"font-weight":e.font.fontWeight,"text-anchor":"start",opacity:e.font.opacity,cursor:"default",transform:"rotate("+e.textAngle+","+i.x+","+i.y+")"}},_drawScale:function(e,i){var s,a,n,o=this._scale._location?this._scale._location:this._scale.location;s=this._tickPosition==t.datavisualization.BulletGraph.TickPosition.Far||this._tickPosition==t.datavisualization.BulletGraph.TickPosition.Center?this._labelPosition==t.datavisualization.BulletGraph.LabelPosition.Below?o.y:o.y+this._scale.labelSettings.offset+this._scale.labelSettings.size:this._labelPosition==t.datavisualization.BulletGraph.LabelPosition.Below?o.y+this._scale.majorTickSettings.size:o.y+this._scale.labelSettings.offset+this._scale.labelSettings.size+this._scale.majorTickSettings.size,a=this._flowDirection==t.datavisualization.BulletGraph.FlowDirection.Forward?o.x:this._orientation==t.datavisualization.BulletGraph.Orientation.Horizontal?o.x-this._scale.labelSettings.offset:o.x,n={id:this.svgObject.id+"_SvgScale",x:a,y:s,width:this.model.quantitativeScaleLength,height:this.model.qualitativeRangeSize,fill:"transparent","stroke-width":0},this.svgRenderer.drawRect(n,i)},_drawMajorTicks:function(e,i){var s,a,n,o,r,l=0,d=this._scale.location,h="inside"==this._tickPlacement,c=this._scale.location.x,u=this.model.quantitativeScaleLength,m=(this._scale.labelSettings.offset,this.model.qualitativeRangeSize),p=this._scale.majorTickSettings.width,g=this._scale.majorTickSettings.size,_=this._orientation==t.datavisualization.BulletGraph.Orientation.Horizontal,f=this._flowDirection==t.datavisualization.BulletGraph.FlowDirection.Forward;this._labelPosition==t.datavisualization.BulletGraph.LabelPosition.Below;s=f?_?c+p/2:c+u+p/2:_?c+u-p/2:c+p/2,a="far"==this._tickPosition?d.y+m+(h?-g:0):"near"==this._tickPosition?d.y+(h?0:-g):d.y+m/2-g/2;var b=this._scale.minimum,v=this._scale.maximum,x=this._scale.interval;for(n=b;n<=v;n+=x)l++,n>=v&&(_&&!f?s+=p:s-=p),!_&&f&&(s=n>=v?s+p:n==b?s-p:s),this.model.applyRangeStrokeToTicks&&(strokeColor=this._bindingRangeStrokes(s-p/2)),o=this._majorTickLines(this._scale,s,a),!_&&f&&n==b&&(s+=p),this.model.drawTicks&&(data={majorTickSettings:this._scale.majorTickSettings,minorTickSettings:this._scale.minorTickSettings,minorTicksPerInterval:this._scale.minorTicksPerInterval,maximum:v,minimum:b,interval:x},this._trigger("drawTicks",data),o=this._majorTickLines(data,s,a)),r=this.svgRenderer.createLine(o),s=!f&&_||f&&!_?s-e:s+e,i.appendChild(r)},_majorTickLines:function(e,t,i){return{x1:t,y1:i,x2:t,y2:i+e.majorTickSettings.size,"stroke-width":e.majorTickSettings.width,stroke:this.model.applyRangeStrokeToTicks&&strokeColor?strokeColor:e.majorTickSettings.stroke}},_forwardStrokeBinding:function(e){if(e>=this._scale.location.x&&e<=this._rangeCollection[0]+this._scale.location.x)return this.model.qualitativeRanges[0].rangeStroke;for(var t=0;t<=this._rangeCollection.length-1;t++)if(e>=this._rangeCollection[t]+this._scale.location.x&&e<=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._scale.location.x&&e<=this._rangeCollection[0]+this._scale.location.x?this.model.qualitativeRanges[0].rangeStroke:void 0},_drawMinorTicks:function(i,s){var a,n,o,r,l,d,h,c,u,m,p=0,g=this._flowDirection==t.datavisualization.BulletGraph.FlowDirection.Forward,_=this._orientation==t.datavisualization.BulletGraph.Orientation.Horizontal,f="inside"==this._tickPlacement,b=this._scale.location.x,v=this.model.qualitativeRangeSize,x=(this._scale.labelSettings.offset,this._scale.majorTickSettings.size,this._scale.minorTickSettings.size),w=this._scale.minorTickSettings.width,y=this.model.quantitativeScaleLength;switch(a=g?_?b:b+y:_?b+y-w/2:b,this._tickPosition){case"far":o=this._scale.location.y+v,r=o+(f?-x:x);break;case"near":o=this._scale.location.y+(f?x:-x),r=this._scale.location.y;break;default:o=this._scale.location.y+v/2-x/2,r=o+x}var C=this._scale.maximum,S=this._scale.minimum,T=this._scale.interval,D=this._scale.minorTicksPerInterval;for(d=S;d<=C;d+=T){for(n=i/D,h=1;h<=D;h++)p++,l=!_&&g||_&&!g?a-n+n/(D+1):a+n-n/(D+1),!g&&_&&p>=(C-S)*D&&(l+=w/2),this.model.applyRangeStrokeToTicks&&(strokeColor=this._bindingRangeStrokes(l)),c=this._minorTickLines(this._scale,l,o,r),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=e.extend(this._scale,data),c=this._minorTickLines(data,l,o,r)),!g&&_?(u=y+b+1,l<=u&&l>=b+1&&(m=this.svgRenderer.createLine(c),s.appendChild(m))):g&&!_?(u=b+1,l>=u&&(m=this.svgRenderer.createLine(c),s.appendChild(m))):(u=y+b+1,l<=u&&(m=this.svgRenderer.createLine(c),s.appendChild(m))),n=i/D*(h+1);a=!g&&_||g&&!_?a-i:a+i}},_minorTickLines:function(e,t,i,s){return{x1:t,y1:i,x2:t,y2:s,"stroke-width":e.minorTickSettings.width,stroke:this.model.applyRangeStrokeToTicks&&strokeColor?strokeColor:e.minorTickSettings.stroke}},_drawLabels:function(e,i){var s,a,n,o,r,l,d,h=this._flowDirection==t.datavisualization.BulletGraph.FlowDirection.Forward,c=this._orientation==t.datavisualization.BulletGraph.Orientation.Horizontal,u=this._scale.location.x,m=this._scale.labelSettings.offset,p=this.model.quantitativeScaleLength;this._scale.majorTickSettings.width;s=h?c?u:u+p:c?u+p:u;var g=this._tickPosition+this._labelPlacement,_=this._labelPosition==t.datavisualization.BulletGraph.LabelPosition.Below,f=(this._scale.location.y,this.model.qualitativeRangeSize),b=this._scale.labelSettings.size;this._scale.majorTickSettings.size;switch(g){case"faroutside":case"centeroutside":a=_?this._scale.location.y+f+m+b:this._scale.location.y-m;break;case"farinside":case"centerinside":a=_?this._scale.location.y+f-m:this._scale.location.y+m+(c?b:0);break;case"nearoutside":a=_?this._scale.location.y+f+m+b:this._scale.location.y-m;break;case"nearinside":a=_?this._scale.location.y+f-m:this._scale.location.y+m+b}var v=this._scale.minimum,x=this._scale.maximum,w=this._scale.interval;"inside"==this._labelPlacement;for(n=v;n<=x;n+=w){var y=a,C=s,S=this._scale.labelSettings.font;if(S.size=b,o={width:0,height:0},c)transformText="rotate(0,"+C+","+y+")";else{switch(r=this._scale.labelSettings.labelPrefix+n+this._scale.labelSettings.labelSuffix,g){case"faroutside":case"centeroutside":_?y-=b:(o=t.EjSvgRender.utils._measureText(r,null,S),y-=o.width);break;case"farinside":case"centerinside":_&&(o=t.EjSvgRender.utils._measureText(r,null,S),y-=o.width);break;case"nearoutside":_?y-=b:(o=t.EjSvgRender.utils._measureText(r,null,S),y-=o.width);break;case"nearinside":_?(o=t.EjSvgRender.utils._measureText(r,null,S),y-=o.width):y-=b}C-=b/3,transformText="rotate(90,"+C+","+y+")"}this.model.applyRangeStrokeToLabels&&(strokeColor=this._bindingRangeStrokes(s)),l=this._labelOptions(this.model.quantitativeScaleSettings.labelSettings,C,y),this.model.drawLabels&&(d={font:this._scale.labelSettings.font,labelPrefix:this._scale.labelSettings.labelPrefix,labelSuffix:this._scale.labelSettings.labelSuffix,offset:m,size:b,stroke:this._scale.labelSettings.stroke},this._trigger("drawLabels",d),l=this._labelOptions(d,C,y)),s=h?c?s+e:s-e:c?s-e:s+e,this.svgRenderer.drawText(l,l.labelPrefix+n+l.labelSuffix,i)}},_labelOptions:function(e,i,s){return{x:i,y:s,"text-anchor":this._orientation==t.datavisualization.BulletGraph.Orientation.Horizontal?"middle":"start",fill:this.model.applyRangeStrokeToLabels&&strokeColor?strokeColor:e.stroke,"font-size":e.size+"px","font-family":e.font.fontFamily,"font-style":e.font.fontStyle,"font-weight":e.font.fontWeight,opacity:e.font.opacity,transform:transformText,labelPrefix:e.labelPrefix,labelSuffix:e.labelSuffix}},_drawQualitativeRanges:function(e){var i,s,a,n,o,r=this._scale.location.x,l=this._scale.location.y,d=this._flowDirection==t.datavisualization.BulletGraph.FlowDirection.Forward,h=this._orientation==t.datavisualization.BulletGraph.Orientation.Horizontal;this._scale.labelSettings.offset;this._rangeCollection=[];var c=(this._tickPosition+this._labelPlacement,this._labelPosition==t.datavisualization.BulletGraph.LabelPosition.Below,this.model.qualitativeRangeSize,this._scale.location.x),u=this._scale.minimum,m=this._scale.maximum,p=this.model.quantitativeScaleLength;for(s=this.model.qualitativeRanges.length-1;s>=0;s--)a={object:this,rangeIndex:s,rangeOptions:this.model.qualitativeRanges[s],rangeEndValue:this.model.qualitativeRanges[s].rangeEnd},this.model.drawQualitativeRanges&&this._trigger("drawQualitativeRanges",a),n=a.rangeEndValue,n=n>m?m:n,d?(r=h?c:c+(p-p/((m-u)/(m-u-(m-n)))),i=h?p/((m-u)/(m-u-(m-n))):p/((m-u)/(m-u-(m-n)))):(r=h?c+(p-p/((m-u)/(m-u-(m-n)))):c,i=h?p/((m-u)/(m-u-(m-n))):p/((m-u)/(m-u-(m-n)))),o={x:r,y:l,height:this.model.qualitativeRangeSize,width:i>0?i=n){var o,r,l,d=this._scale.location.x,h=this.model.quantitativeScaleLength,c=this._scale.maximum-this._scale.minimum,u=this._scale.maximum-e,m=this._flowDirection.toLowerCase()+this._orientation.toLowerCase();switch(i=null==i?"":i,s=this._scale.labelSettings.font,s.size=this._scale.labelSettings.size,a=t.EjSvgRender.utils._measureText(i.toString(),null,s).width,m){case"forwardhorizontal":case"backwardvertical":o=d+(n>0?0:h/c*Math.abs(n)),l=h/(c/(n>0?c-u:e)),e<0&&(l=Math.abs(l),o-=l),l=o+l0?h/(c/(c-u)):h/(c/e),e<0&&(l=Math.abs(l),o-=l),o0)for(n=this._dataCount-1;n>=0;n--)e=c?this.model.fields.dataSource[n][this.model.fields.featureMeasures]:t.isNullOrUndefined(this._scale.featureMeasures[n].value)?m:this._scale.featureMeasures[n].value,i=c?this.model.fields.dataSource[n][this.model.fields.category]:this._scale.featureMeasures[n].category,s=this._scale.location.y+this.model.qualitativeRangeSize/this._dataCount*h/2-this._scale.featuredMeasureSettings.width/2,a=this._scale.location.y+this.model.qualitativeRangeSize/this._dataCount*h/2+this._scale.featuredMeasureSettings.width/2-1,o=this._calculateFeatureMeasureBounds(e,i),o&&(r=this._featureBar(this._scale,o.pointX,s,o.Width,n),this.model.drawFeatureMeasureBar&&(d={featuredMeasureSettings:this._scale.featuredMeasureSettings},this._trigger("drawFeatureMeasureBar",d),r=this._featureBar(d,o.pointX,s,o.Width,n)),this.svgRenderer.drawRect(r,this._scaleGroup),transformText=u?"rotate(90,"+o.lPointX+","+(a-4)+")":"rotate(0,"+o.lPointX+","+a+")",l=this._drawcategory(this.model.quantitativeScaleSettings.labelSettings,o.lPointX,a),this.model.drawCategory&&(d={size:this.model.quantitativeScaleSettings.labelSettings.size,stroke:this.model.quantitativeScaleSettings.labelSettings.stroke,font:this.model.quantitativeScaleSettings.labelSettings.font,categoryValue:i},this._trigger("drawCategory",d),l=this._drawcategory(d,o.lPointX,a),i=d.categoryValue),t.isNullOrUndefined(i)||this.svgRenderer.drawText(l,i,this._scaleGroup),h+=2,this.value(e))},_drawcategory:function(e,t,i){return{x:t,y:i+this._scale.featuredMeasureSettings.width/2,"text-anchor":"middle",fill:e.stroke,"font-size":e.size+"px","font-family":e.font.fontFamily,"font-style":e.font.fontStyle,"font-weight":e.font.fontWeight,opacity:e.font.opacity,transform:transformText}},_featureBar:function(e,t,i,s,a){return{class:this.svgObject.id+"_FeatureMeasure",id:this.svgObject.id+"_FeatureMeasure_"+a,x:t,y:i,height:e.featuredMeasureSettings.width,width:s,fill:e.featuredMeasureSettings.stroke,onmouseover:"evt.target.setAttribute('opacity', '0.7')",onmouseout:"evt.target.setAttribute('opacity', '1')"}},_drawComparativeMeasureSymbol:function(){var e,i,s,a,n,o,r,l=1,d=this._flowDirection==t.datavisualization.BulletGraph.FlowDirection.Forward,h=this._orientation==t.datavisualization.BulletGraph.Orientation.Horizontal,c="function"==typeof this.model.comparativeMeasureValue?this._comparativeMeasureValue():this.model.comparativeMeasureValue;if(this._dataCount>0)for(n=this._dataCount-1;n>=0;n--)e=t.isNullOrUndefined(this.model.fields)||null==this.model.fields.dataSource?t.isNullOrUndefined(this._scale.featureMeasures[n].comparativeMeasureValue)?c:this._scale.featureMeasures[n].comparativeMeasureValue:this.model.fields.dataSource[n][this.model.fields.comparativeMeasure],e>=this._scale.minimum&&e<=this._scale.maximum&&(i=this._scale.location.y+this.model.qualitativeRangeSize/this._dataCount*l/2-this._scale.featuredMeasureSettings.width/2-this._scale.featuredMeasureSettings.width,s=this._scale.location.y+this.model.qualitativeRangeSize/this._dataCount*l/2-this._scale.featuredMeasureSettings.width/2+2*this._scale.featuredMeasureSettings.width,a=d?h?this._scale.location.x+this.model.quantitativeScaleLength/((this._scale.maximum-this._scale.minimum)/(this._scale.maximum-this._scale.minimum-(this._scale.maximum-e))):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-e)))):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-e)))):this._scale.location.x+this.model.quantitativeScaleLength/((this._scale.maximum-this._scale.minimum)/(this._scale.maximum-this._scale.minimum-(this._scale.maximum-e))),o=this._compareMeasure(this._scale,a,i,s,n,e),this.model.drawComparativeMeasureSymbol&&(r={comparativeMeasureSettings:this._scale.comparativeMeasureSettings},this._trigger("drawComparativeMeasureSymbol",r),o=this._compareMeasure(r,a,i,s,n,e)),this.svgRenderer.drawLine(o,this._scaleGroup),l+=2,this.comparativeMeasureValue(e))},_compareMeasure:function(e,t,i,s,a,n){return{class:this.svgObject.id+"_ComparativeMeasure",id:this.svgObject.id+"_ComparativeMeasure_"+a,x1:n==this._scale.maximum?t-e.comparativeMeasureSettings.width/2:n==this._scale.minimum?t+e.comparativeMeasureSettings.width/2:t,y1:i,x2:n==this._scale.maximum?t-e.comparativeMeasureSettings.width/2:n==this._scale.minimum?t+e.comparativeMeasureSettings.width/2:t,y2:s,"stroke-width":e.comparativeMeasureSettings.width,stroke:e.comparativeMeasureSettings.stroke}},_setTheme:function(e,i){var s,a,n,o=[];this._scale=this.model.quantitativeScaleSettings;for(s in e)o.push(s);for(a=0;a=0;s--)t=i[s],this._animateFeatureBar(t)},_doLineAnimation:function(){for(var t,i=e("."+this.svgObject.id+"_ComparativeMeasure"),s=2e3/i.length,a=i.length-1;a>=0;a--)t=i[a],e(t).attr("transform","scale(0)"),this._doLineSymbol(t,s,a)},_animateFeatureBar:function(i){var s,a,n=i.getBBox();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?(s=n.x+n.width,a=n.y+n.height):(s=n.x,a=n.y),e(i).animate({scale:1},{duration:1e3,step:function(t){scaleVal=t,e(i).attr("transform","translate("+s+" "+a+") scale("+t+",1) translate("+-s+" "+-a+")")}})},_doLineSymbol:function(t,i,s){var a=parseInt(s*i),n=t.getBBox(),o=n.x+n.width/2,r=n.y+n.height/2;e(t).delay(a).animate({scale:1},{duration:200,step:function(i){e(t).attr("transform","translate("+o+" "+r+") scale("+i+") translate("+-o+" "+-r+")")}})},bindEvents:function(){this.model.tooltipSettings.visible&&this._on(e(this.svgObject),"mousemove",this._bulletMouseMove),(this.model.enableResizing||this.model.isResponsive)&&(t.isTouchDevice()?this._on(e(window),"orientationchange",this._bulletResize):this._on(e(window),"resize",this._bulletResize))},isDevice:function(){return/mobile|tablet|android|kindle/i.test(navigator.userAgent.toLowerCase())},_bulletResize:function(){var t=this,i=e(t.svgObject);this.resizeTO&&clearTimeout(this.resizeTO),this.resizeTO=setTimeout(function(){t.isDevice()?(i.width(e(t.element).width()),i.height(e(t.element).height())):(t.svgWidth>e(this).width()?i.width(e(this).width()):i.width(t.svgWidth),t.svgHeight>e(this).height()?i.height(e(this).height()):i.height(t.svgHeight)),t.redraw()},500)},_bulletMouseMove:function(s){var a,n,o,r,l,d,h,c,u,m,p,g,_,f=e(".tooltipDiv");e("#tooltip").remove(),e(".tooltipDiv").remove(),l=e(s.target).attr("id"),d=e(s.target).attr("class");var b=this.model.captionSettings,f=e("
      "),v="";if(e(f).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"}),d==this.svgObject.id+"_Caption"?v=s.target.textContent==b.text?"":b.text:d==this.svgObject.id+"_SubTitle"?v=s.target.textContent==b.subTitle.text?"":b.subTitle.text:d==this.svgObject.id+"_Indicator"&&(v=s.target.textContent==b.indicator.text?"":b.indicator.text),""!=v)e(f).html(" "+v+" "),e(document.body).append(f);else if(this.model.tooltipSettings.enableCaptionTooltip&&(d==this.svgObject.id+"_Caption"||d==this.svgObject.id+"_SubTitle"||d==this.svgObject.id+"_Indicator")){var x=e("."+d).text(),u={Text:x},w=this.model.tooltipSettings.captionTemplate;0==e(".tooltipDiv").length&&(f=e("
      "),e(document.body).append(f),e(".tooltipDiv").addClass(this.svgObject.id)),""!=w&&null!=w?(m=document.getElementById(w),m=m?e(m).clone():e(w),e(m).css("display","block").appendTo(f),e(f).html(e(m).render(u))):e(f).html(x),e(f).css("font-size","12px"),g=s.clientX+e(document).scrollLeft()+10,_=s.clientY+e(document).scrollTop()+10,g=g+e(f).width()"),e(document.body).append(f),e(".tooltipDiv").addClass(this.svgObject.id)),""!=this.model.tooltipSettings.template&&null!=this.model.tooltipSettings.template?(m=e("#"+this.model.tooltipSettings.template).clone(),e(m).css("display","block").appendTo(f),e(f).html(e(m).render(u))):(p=t.isNullOrUndefined(u.category)?"":"
      Category : "+u.category,e(f).html("Current : "+u.currentValue+"
      Target : "+u.targetValue+p)),e(f).css("font-size","12px"),g=s.clientX+e(document).scrollLeft()+10,_=s.clientY+e(document).scrollTop()+10,g=g+e(f).width()this.minHeight?e(this.element).height()-s:this.minHeight,this.scrollWidth=this.newWidth-2*this.padding},_setTheme:function(e,i){var s=i.toLowerCase();this.model=t.copyObject({},this.model,e[s])},_setPositions:function(){var e=this.model.labelSettings.higherLevel,t=this.model.labelSettings.lowerLevel,i=e.position,s=t.position,a=e.visible,n=t.visible,o=e.labelPlacement,r=t.labelPlacement;"top"===i&&"bottom"===s?(this.centerPosition=this.minHighHeight+1,this.centerHeight=this.newHeight-this.minHighHeight-this.minLowHeight,this.bottomPosition=this.minHighHeight+this.centerHeight+1):"bottom"===i&&"bottom"===s?(this.centerPosition=0,this.centerHeight=this.newHeight-this.minHighHeight-this.minLowHeight,this.bottomPosition=this.minLowHeight+this.centerHeight+1):"bottom"===i&&"top"===s?(this.centerPosition=this.minLowHeight+1,topPosition=0,this.centerHeight=this.newHeight-this.minHighHeight-this.minLowHeight,this.bottomPosition=this.minLowHeight+this.centerHeight+1):"top"===i&&"top"===s&&(this.centerPosition=this.minLowHeight+this.minHighHeight+1,this.centerHeight=this.newHeight-this.minHighHeight-this.minLowHeight,this.bottomPosition=this.newHeight),a===!1&&n===!1?(this.centerPosition=0,this.centerHeight=this.newHeight,this.bottomPostion=this.newHeight):a===!1?(this.centerPosition=0,this.centerHeight=this.newHeight-this.minLowHeight,this.bottomPosition=this.newHeight):n===!1&&(this.centerPosition=this.minHighHeight+1,this.centerHeight=this.newHeight-this.minHighHeight,this.bottomPosition=this.minHighHeight+this.centerHeight+1),"outside"===o&&"outside"===r?(this.sliderPosition=this.centerPosition,this.sliderHeight=this.centerHeight):"outside"===o?(this.sliderPosition=this.centerPosition,this.sliderHeight=this.newHeight):"outside"===r?(this.sliderPosition=0,this.sliderHeight=this.centerHeight+this.minHighHeight):(this.sliderPosition=0,this.sliderHeight=this.newHeight); },redraw:function(){var i,s=this.model.scrollRangeSettings,a=this.model.rangeSettings,n=s.start,o=s.end;this.loadScrollbar=!1,this.model.enableScrollbar&&(this.scrollUpdate=!0,i=this._scrollRange,"datetime"==this.model.valueType.toLowerCase()&&(n=Date.parse(s.start),o=Date.parse(s.end),rangeStart=Date.parse(a.start),rangeEnd=Date.parse(a.end)),(!i||rangeStart0?this.newWidth-2*this.padding:0,height:this.newHeight,fill:"transparent","stroke-width":O.width,stroke:E,opacity:O.opacity};this.renderer.drawRect(A,this.svgDocument),c="numeric"==a?this.newHeight-o.border.width-this.minLowHeight:this.newHeight-o.border.width-this.minLowHeight-this.minHighHeight,u={id:this._rootId+"_Border",x:this.padding,y:this.sliderPosition,width:this.newWidth>0?this.newWidth-2*this.padding:0,height:this.sliderHeight,fill:this.naviback,"stroke-width":o.border.width,stroke:o.border.color,opacity:o.opacity,"stroke-dasharray":o.border.dashArray},this.renderer.drawRect(u,this.svgDocument),0==e("#"+this._rootId+"higherLevel").length&&(this.higherLevel=this.renderer.createGroup({id:this._rootId+"higherLevel"})),0==e("#"+this._rootId+"lowerLevel").length&&(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"}),m={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(m,this.leftTooltip),p=this.model.tooltipSettings.font,g={id:this._rootId+"_LeftToolText",x:5,fill:p.color,"font-size":p.size,"font-family":p.family,"font-style":p.style,"font-weight":p.weight,"text-anchor":"start",opacity:p.opacity,"dominant-baseline":"middle"},this.renderer.drawText(g,t.format(new Date(5e-4),"MMMM, yyyy"),this.leftTooltip),this.leftTxt=this.leftTooltip.childNodes[1],_={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(_,this.rightTooltip),this.renderer.drawText(g,t.format(new Date(5e-4),"MMMM, yyyy"),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)),"datetime"==this.model.valueType&&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"}),f={width:this.newWidth>0?this.newWidth-2*this.padding:0,height:this.sliderHeight,fill:this.unselectgrad,opacity:o.unselectedRegionOpacity,transform:"translate("+this.padding+","+this.sliderPosition+")"},this.renderer.drawRect(f,this.leftUnSelected),this.leftUnArea=this.leftUnSelected.firstChild,this.renderer.append(this.leftUnSelected,this.svgDocument),b={width:this.newWidth>0?this.newWidth-4-2*this.padding:0,height:this.sliderHeight,fill:this.selectedgrad,opacity:o.selectedRegionOpacity,transform:"translate("+this.padding+","+this.sliderPosition+")"},this.renderer.drawRect(b,this.gCenterSlider),this.centerSlider=this.gCenterSlider.firstChild,e(this.centerSlider).css("cursor","pointer"),this.renderer.append(this.gCenterSlider,this.svgDocument),v={width:"2",height:this.sliderHeight,fill:o.thumbStroke,opacity:"1",y:this.sliderPosition,transform:"translate("+this.padding+")"},x={id:"leftCircle"+this._id,cx:this.padding,cy:this.sliderPosition+this.sliderHeight/2,r:o.thumbRadius,"stroke-width":2,stroke:o.thumbStroke,fill:this.tbClr},this.renderer.drawRect(v,this.gLeftSlider),null==this.model.navigatorStyleSettings.leftThumbTemplate?(this.renderer.drawCircle(x,this.gLeftSlider),this.leftCircle=this.gLeftSlider.lastChild,e(this.leftCircle).css("cursor","pointer")):(T=!!document.getElementById(this.model.navigatorStyleSettings.leftThumbTemplate),e("#"+this._id+"thumbleft").length>0&&e("#"+this._id+"thumbleft").remove(),D=this._id,"none"==e("#"+D).css("transform")&&e("#"+D).css("transform","translate(0, 0)"),0!=e("#"+D+"template_group_").length?I=e("#"+D+"template_group_"):(I=e("
      ").attr("id",D+"template_group_"),e(I).css("position","relative")),k=e("
      ").attr("id",this._id+"thumbleft"),P=1==T?e("#"+this.model.navigatorStyleSettings.leftThumbTemplate)[0].innerHTML:this.model.navigatorStyleSettings.leftThumbTemplate,L=e(P),e(k).css("position","absolute"),L.appendTo(e(k)),e(k).appendTo(I),this.svgSupport?e(I).appendTo("#"+D):e(I).appendTo(this.svgDocument),R=this.sliderPosition+this.sliderHeight/2-L.height()/2,e(k).css("top",R).css("cursor","pointer").css("z-index","1")),this.leftSlider=this.gLeftSlider.firstChild,e(this.leftSlider).css("cursor","w-resize"),this.renderer.append(this.gLeftSlider,this.svgDocument),w=parseFloat(this.newWidth-2*this.padding),w=w<0?0:w,y={width:w,height:this.sliderHeight,fill:this.unselectgrad,opacity:o.unselectedRegionOpacity,transform:"translate("+this.padding+","+this.sliderPosition+")"},this.renderer.drawRect(y,this.rightUnSelected),this.rightUnArea=this.rightUnSelected.firstChild,this.renderer.append(this.rightUnSelected,this.svgDocument),C={width:"2",height:this.sliderHeight,fill:this.model.navigatorStyleSettings.thumbStroke,opacity:"1",transform:"translate("+parseFloat(this.newWidth-4-this.padding)+", "+this.sliderPosition+" )"},S={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(C,this.gRightSlider),null==this.model.navigatorStyleSettings.rightThumbTemplate?(this.renderer.drawCircle(S,this.gRightSlider),this.rightCircle=this.gRightSlider.lastChild,e(this.rightCircle).css("cursor","pointer")):(T=!!document.getElementById(this.model.navigatorStyleSettings.rightThumbTemplate),e("#"+this._id+"thumbright").length>0&&e("#"+this._id+"thumbright").remove(),D=this._id,0!=e("#"+D+"template_group_").length?I=e("#"+D+"template_group_"):(I=e("
      ").attr("id",D+"template_group_"),e(I).css("position","absolute")),k=e("
      ").attr("id",this._id+"thumbright"),P=1==T?e("#"+this.model.navigatorStyleSettings.rightThumbTemplate)[0].innerHTML:this.model.navigatorStyleSettings.rightThumbTemplate,L=e(P),e(k).css("position","absolute"),L.appendTo(e(k)),e(k).appendTo(I),this.svgSupport?e(I).appendTo("#"+D):e(I).appendTo(this.svgDocument),R=this.sliderPosition+this.sliderHeight/2-L.height()/2,e(k).css("top",R).css("cursor","pointer").css("z-index","1")),this.rightSlider=this.gRightSlider.firstChild,e(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),s!=i&&s.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(e(this.leftSlider),{transform:"translate("+this.padding+",0)"}):this.renderer._setAttr(e(this.leftSlider),{transform:"translate("+this.padding+","+this.sliderPosition+")"}),this.leftTooltip.setAttribute("opacity",0),this.rightTooltip.setAttribute("opacity",0)),this.model.tooltipSettings.visible&&this.svgSupport&&"ondemand"==this.model.tooltipSettings.tooltipDisplayMode&&(this.rightTooltip.setAttribute("opacity",0),this.leftTooltip.setAttribute("opacity",0)),this._scrollChanged=!this._scrollChanged&&this._scrollChanged,this.model.enableScrollbar?(this.loadScrollbar&&!this.scrollbarUpdate?(this.scrollbarContainer=new t.EjSvgScrollbarRender(this.element),this.scrollbarContainer._initializeScrollbarVariables.call(this),this.scrollbarContainer._renderScrollbar.call(this)):this.renderer.append(this.scrollsvgObj,this.element),this._bindevents()):(e(this.scrollsvgObj).remove(),this.scrollsvgObj=null,this.scrollZoomPos=null,this.scrollZoomFact=null)},eachInterval:"",_renderChart:function(t){var s,a,n,o=t.valueType.toLowerCase();t.enableScrollbar&&(s="datetime"==o?{min:this.startDateTime,max:this.endDateTime}:{min:this.startValue,max:this.endValue}),""!=t.dataSource&&""==t.series&&""==t.seriesSettings?e(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:s,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,a=t.series,""==a&&(a=[{dataSource:t.dataSource,xName:t.seriesSettings.xName,yName:t.seriesSettings.yName,type:"line",width:1.5,enableAnimation:!1}]),e(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:s,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:a,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"}),a=t.series,n=a.length,""==a&&(a=[{dataSource:t.seriesSettings.dataSource,xName:t.seriesSettings.xName,yName:t.seriesSettings.yName,type:"line",width:1.5,enableAnimation:!1}]),e(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:s,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:a,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=e(this.chartGView).data("ejChart"),this.renderer._setAttr(e(this.chartGView),{transform:"translate("+this.padding+","+this.sliderPosition+")",height:this.sliderHeight})},_init:function(){this._createSvg(this);var i,s=e.extend({},t.EjSvgRender.commonChartEventArgs);s.data={model:this.model},this._trigger("load",s),i=this.model.scrollRangeSettings,this.renderNavigator(this),this.model.enableScrollbar&&(this.scrollbarContainer=new t.EjSvgScrollbarRender(this.element),this.scrollbarContainer._initializeScrollbarVariables.call(this),this.scrollbarContainer._renderScrollbar.call(this)),(this.model.enableAutoResizing||this.model.isResponsive)&&(!this.model.enableScrollbar||this.model.enableScrollbar&&this.svgSupport)&&this._on(e(window),"resize",this.rangeChange),this._bindevents()},rangeChange:function(){var e;this.rangeResize=!0,clearTimeout(e),t.isNullOrUndefined(window.orientation)?this.renderNavigator():e=setTimeout(this.renderNavigator(),500),this.model.enableScrollbar&&this.scrollbarContainer._renderScrollbar.call(this)},isDevice:function(){return/mobile|android|kindle/i.test(navigator.userAgent.toLowerCase())},isWindows:function(){if(!(t.getBooleanVal(e("head"),"data-ej-android")||t.getBooleanVal(e("head"),"data-ej-ios")||t.getBooleanVal(e("head"),"data-ej-ios7")||t.getBooleanVal(e("head"),"data-ej-flat")))return this._windows()},_windows:function(){return/trident|windows phone/i.test(navigator.userAgent.toLowerCase())||t.getBooleanVal(e("head"),"data-ej-windows",!1)===!0},_bindevents:function(){var i=jQuery.uaMatch(navigator.userAgent),s=!!navigator.userAgent.match(/Trident\/7\./);if(window.navigator.msPointerEnabled&&!s)this._on(e("#"+this._id+"template_group_"),"MSPointerDown",this._grab),this._on(e("#"+this._id+"template_group_"),"MSPointerMove",this._drag),this._on(e("#"+this._id+"template_group_"),"MSPointerUp",this._drop),this._on(e(this.svgDocument),"MSPointerDown",this._grab),this._on(e(this.svgDocument),"MSPointerOut",this._leave),this._on(e(this.svgDocument),"MSPointerMove",this._drag),this._on(e(this.svgDocument),"MSPointerUp",this._drop),this._on(e(window),"MSPointerUp",this.mouseup),e(this.svgDocument).css("-ms-touch-action","none");else if(this.isDevice()){var a=navigator.userAgent.indexOf("Safari")!=-1&&navigator.userAgent.indexOf("Chrome")==-1,n=window.location!=window.parent.location,o=n?window.parent.navigator.userAgent.toLowerCase():window.navigator.userAgent.toLowerCase(),r=/mobile|tablet|android|kindle/i.test(o);t.isMobile()&&this.isWindows()||!r&&t.isMobile()&&a?(this._on(e("#"+this._id+"template_group_"),"mousedown",this._grab),this._on(e("#"+this._id+"template_group_"),"mousemove",this._drag),this._on(e("#"+this._id+"template_group_"),"mouseup",this._drop),this._on(e(this.svgDocument),"mousedown",this._grab),this._on(e(this.svgDocument),"mouseleave",this._leave),this._on(e(this.svgDocument),"mousemove",this._drag),this._on(e(this.svgDocument),"mouseup",this._drop),e(this.svgDocument).css("-ms-touch-action","none")):(this._on(e("#"+this._id+"template_group_"),"touchstart",this._grab),this._on(e("#"+this._id+"template_group_"),"touchmove",this._drag),this._on(e("#"+this._id+"template_group_"),"touchend",this._drop),this._on(e(this.svgDocument),"touchstart",this._grab),this._on(e(this.svgDocument),"touchmove",this._drag),this._on(e(this.svgDocument),"touchleave",this._leave),this._on(e(this.svgDocument),"touchend",this._drop))}else"chrome"==i.browser.toLowerCase()?(this._on(e("#"+this._id+"template_group_"),"touchstart",this._grab),this._on(e("#"+this._id+"template_group_"),"touchmove",this._drag),this._on(e("#"+this._id+"template_group_"),"touchend",this._drop),this._on(e("#"+this._id+"template_group_"),"mousedown",this._grab),this._on(e("#"+this._id+"template_group_"),"mousemove",this._drag),this._on(e("#"+this._id+"template_group_"),"mouseup",this._drop),this._on(e(this.svgDocument),"touchstart",this._grab),this._on(e(this.svgDocument),"touchmove",this._drag),this._on(e(this.svgDocument),"touchleave",this._leave),this._on(e(this.svgDocument),"touchend",this._drop),this._on(e(this.svgDocument),"mousedown",this._grab),this._on(e(this.svgDocument),"mouseout",this._leave),this._on(e(this.svgDocument),"mousemove",this._drag),this._on(e(this.svgDocument),"mouseup",this._drop)):(this._on(e("#"+this._id+"template_group_"),"mousedown",this._grab),this._on(e("#"+this._id+"template_group_"),"mousemove",this._drag),this._on(e("#"+this._id+"template_group_"),"mouseup",this._drop),this._on(e(this.svgDocument),"mousedown",this._grab),this._on(e(this.svgDocument),"mouseleave",this._leave),this._on(e(this.svgDocument),"mousemove",this._drag),this._on(e(this.svgDocument),"mouseup",this._drop));s&&e(this.svgDocument).css("touch-action","none"),this._on(e(window),"mouseup",this.mouseup)},_initializeVariables:function(e,t,s){var a,n,o,r,l,d,h;this.ismouseup=!1;var c=this.model.rangeSettings,u=this.model.labelSettings.style,m=this.model.labelSettings.lowerLevel.style,p=this.model.labelSettings.higherLevel.style;this.model.scrollRangeSettings;if(""==p&&(this.model.labelSettings.higherLevel.style=u),""==m?this.model.labelSettings.lowerLevel.style=u:m!=i&&m.horizontalAlignment==i&&(this.model.labelSettings.lowerLevel.style.horizontalAlignment="middle"),"numeric"==this.model.valueType&&"MM/dd/yyyy"==this.model.tooltipSettings.labelFormat&&(this.model.tooltipSettings.labelFormat="d"),""!=e.dataSource&&""!=e.xName&&""!=e.yName)if(a=t.length,a>0)for(n=0;n0)for(n=0;nl||new Date(n).getTime()h)&&(n=h))),this.model.enableRTL?"datetime"==s?(this.leftSliderPosition=(l-new Date(n).getTime())*t+o,this.rightSliderPosition=(l-new Date(a).getTime())*t+o,a=new Date(a),n=new Date(n)):(this.leftSliderPosition=(h-n)*t+o,this.rightSliderPosition=(h-a)*t+o):"datetime"==s?(this.leftSliderPosition=(new Date(a).getTime()-r)*t+o,this.rightSliderPosition=(new Date(n).getTime()-r)*t+o,a=new Date(a),n=new Date(n)):(this.leftSliderPosition=(a-d)*t+o,this.rightSliderPosition=(n-d)*t+o),this.setopacity="always"==this.model.tooltipSettings.tooltipDisplayMode?1:0,this.model.enableScrollbar?this.leftSliderPosition>=o+5&&this.leftSliderPositionthis.newWidth?(e(this.leftTooltip).hide(),e(this.gLeftSlider).hide()):(e(this.leftTooltip).hide(),e(this.gLeftSlider).hide(),e(this.leftUnSelected).hide()):this.setSliderPositions(this.leftSliderPosition,null,null),this.model.enableScrollbar?this.rightSliderPosition<=this.newWidth-o-5&&this.rightSliderPosition>o?this.setSliderPositions(null,null,this.rightSliderPosition):this.rightSliderPosition<0?(e(this.rightTooltip).hide(),e(this.gRightSlider).hide()):(e(this.rightTooltip).hide(),e(this.gRightSlider).hide(),e(this.rightUnSelected).hide()):this.setSliderPositions(null,null,this.rightSliderPosition),this.setopacity=1,this.model.enableDeferredUpdate&&(this._calculateSelectedData(),this._calculateSliderZoomFactPosition(),this._scrollChanged||("datetime"==s?this.startDateTime.getTime()===a.getTime()&&(this.endDateTime.getTime()===n.getTime()||this.rangeResize)||this._trigger("rangeChanged",this.model):this.startValue===a&&(this.endValue===n||this.rangeResize)||this._trigger("rangeChanged",this.model)),this.rangeResize=!1)},centerSliderWidth:"",zoomp:0,zoomf:1,setSliderPositions:function(s,a,n){var o,r,l,d,h,c,u,m,p,g=this.model.valueType,_=this.model.labelSettings.higherLevel.labelPlacement;if(o="inside"==_?0:this.centerPosition,null!=s&&s>=this.padding&&s=0?(this.leftTooltip.firstChild.setAttribute("d",this.leftd),this.renderer._setAttr(e(this.leftTooltip),{transform:"translate("+(s-m)+","+o+")"}),this.leftTxt.setAttribute("x",5)):s+mthis.newWidth-this.rightTooltip.lastChild.getBBox().width-15&&this.rightTooltip.getCTM().f<30&&this.renderer._setAttr(e(this.leftTooltip),{transform:"translate("+(s-m)+","+(o+30)+")"}),this.rightTooltip.getCTM().f>=30&&sthis.padding){if(n>this.newWidth-this.padding+1&&(n=this.newWidth-this.padding),this.rightSliderPosition=n,d=new Date(this.model.rangeSettings.start),r=this.model.enableRTL?this.newWidth-n:n,c=r/this.eachInterval+this.startDateTime.getTime()-this.padding/this.eachInterval,c="datetime"==g?new Date(c):r/this.eachInterval+this.startValue-this.padding/this.eachInterval,this.model.enableRTL?this.model.selectedRangeSettings.start=c:this.model.selectedRangeSettings.end=c,this.model.tooltipSettings.visible&&this.svgSupport&&this.rightTxt){this.rightTooltip.setAttribute("opacity",this.setopacity),this.rightTxt.textContent="datetime"==g?t.format(new Date(c),this.model.tooltipSettings.labelFormat):t.format(c,this.model.tooltipSettings.labelFormat);var f=t.EjSvgRender.utils._measureText(this.rightTxt.textContent,null,this.model.tooltipSettings.font),m=f.width+15,p=f.height,b="msie"!=this.brow?(p+6)/2:p/2+6;this.rightTxt.setAttribute("y",b),this.rightTxt.setAttribute("x",10),this.leftd="M 0 0 L 0 "+(p+6)+" L "+(m-6)+" "+(p+6)+" L "+(m-6)+" 6 L "+m+" 0 Z",this.rightd="M 0 0 L "+m+" 0 L "+m+" "+(p+6)+" L 6 "+(p+6)+" L 6 6 Z",n+m<=this.newWidth?(this.rightTooltip.firstChild.setAttribute("d",this.rightd),this.renderer._setAttr(e(this.rightTooltip),{transform:"translate("+n+","+o+")"})):n+m>=this.newWidth&&n-m>this.centerSlider.getCTM().e?(this.renderer._setAttr(e(this.rightTooltip),{transform:"translate("+(n-m)+","+o+")"}),this.rightTooltip.firstChild.setAttribute("d",this.leftd),this.rightTxt.setAttribute("x",5)):this.leftTooltip.getCTM().f<30?(this.renderer._setAttr(e(this.rightTooltip),{transform:"translate("+(n-m)+","+(o+30)+")"}),this.rightTooltip.firstChild.setAttribute("d",this.leftd)):(this.renderer._setAttr(e(this.rightTooltip),{transform:"translate("+(n-m)+","+o+")"}),this.rightTooltip.firstChild.setAttribute("d",this.leftd)),n=this.padding&&this.renderer._setAttr(e(this.rightTooltip),{transform:"translate("+n+","+(o+30)+")"}),this.leftTooltip.getCTM().f>=30&&n>this.leftTooltip.getCTM().e+m&&this.rightTooltip.getCTM().e>this.leftTooltip.getCTM().e+m&&(this.renderer._setAttr(e(this.leftTooltip),{transform:"translate("+this.leftTooltip.getCTM().e+","+o+")"}),this.rightTxt.setAttribute("x",5))}h=this.newWidth-n-this.padding-2,h=h<0?0:h,this.renderer._setAttr(e(this.rightUnArea),{width:h,transform:"translate("+parseFloat(n+2)+","+this.sliderPosition+")"}),this.renderer._setAttr(e(this.rightSlider),{transform:"translate("+n+","+this.sliderPosition+")"}),this.rightCircle!=i?this.svgSupport?this.renderer._setAttr(e(this.rightCircle),{cx:n}):this.renderer._setAttr(e(this.rightCircle),{transform:"translate("+parseFloat(n-10)+","+parseFloat(this.sliderPosition+this.sliderHeight/2)+")"}):(u=n-e("#"+this._id+"thumbright").width()/2,e("#"+this._id+"thumbright").css("left",u)),this.centerSliderWidth=parseFloat(this.rightSlider.getBoundingClientRect().left)-parseFloat(this.leftSlider.getBoundingClientRect().left),this.renderer._setAttr(e(this.centerSlider),{width:Math.abs(this.centerSliderWidth)}),this.model.zoomFactor=(this.rightSlider.getBoundingClientRect().left+parseFloat(this.renderer._getAttrVal(e(this.rightSlider),"width"))-this.leftSlider.getBoundingClientRect().left)/(this.newWidth-2*this.padding),e(this.rightTooltip).show(),e(this.gRightSlider).show(),e(this.rightUnSelected).show(); }else if(null!=a){var v=(this.renderer._getAttrVal(e(this.leftSlider),"width"),a),x=a+parseFloat(this.renderer._getAttrVal(e(this.centerSlider),"width")),d=new Date(this.model.rangeSettings.start);if(r=this.model.enableRTL?this.newWidth-v:v,v>=this.padding&&x<=this.newWidth-this.padding-2){if(c=r/this.eachInterval+this.startDateTime.getTime()-this.padding/this.eachInterval,"datetime"==g&&(c=new Date(c)),this.model.enableRTL?this.model.selectedRangeSettings.end=c:this.model.selectedRangeSettings.start=c,this.svgSupport?this.renderer._setAttr(e(this.leftSlider),{transform:"translate("+v+",0)"}):this.renderer._setAttr(e(this.leftSlider),{transform:"translate("+v+","+parseFloat(this.sliderPosition)+")"}),this.leftSliderPosition=v,this.leftCircle!=i?this.svgSupport?this.renderer._setAttr(e(this.leftCircle),{cx:v}):this.renderer._setAttr(e(this.leftCircle),{transform:"translate("+parseFloat(v-10)+","+parseFloat(this.sliderPosition+this.sliderHeight/2)+")"}):(u=v-e("#"+this._id+"thumbleft").width()/2,e("#"+this._id+"thumbleft").css("left",u)),this.model.tooltipSettings.visible&&this.svgSupport&&this.leftTxt){this.leftTooltip.setAttribute("opacity",this.setopacity),this.leftTxt.textContent="datetime"==g?t.format(new Date(c),this.model.tooltipSettings.labelFormat):t.format(c,this.model.tooltipSettings.labelFormat);var m=this.leftTooltip.lastChild.getBBox().width+15,p=this.leftTooltip.lastChild.getBBox().height,b="msie"!=this.brow?(p+6)/2:p/2+6;this.leftTxt.setAttribute("y",b),this.rightTxt.setAttribute("y",b),this.leftd="M 0 0 L 0 "+(p+6)+" L "+(m-6)+" "+(p+6)+" L "+(m-6)+" 6 L "+m+" 0 Z",this.rightd="M 0 0 L "+m+" 0 L "+m+" "+(p+6)+" L 6 "+(p+6)+" L 6 6 Z",v-m>=0?(this.leftTooltip.firstChild.setAttribute("d",this.leftd),this.renderer._setAttr(e(this.leftTooltip),{transform:"translate("+(v-m)+","+o+")"}),this.leftTxt.setAttribute("x",5)):(this.renderer._setAttr(e(this.leftTooltip),{transform:"translate("+v+","+o+")"}),this.leftTooltip.firstChild.setAttribute("d",this.rightd),this.leftTxt.setAttribute("x",10),this.leftSliderPosition+m>this.rightSlider.getCTM().e&&this.renderer._setAttr(e(this.leftTooltip),{transform:"translate("+v+","+(o+30)+")"}))}r=this.model.enableRTL?this.newWidth-x:x,c=r/this.eachInterval+this.startDateTime.getTime()-this.padding/this.eachInterval,c="datetime"==g?new Date(c):r/this.eachInterval+this.startValue-this.padding/this.eachInterval,this.model.enableRTL?this.model.selectedRangeSettings.start=c:this.model.selectedRangeSettings.end=c,this.renderer._setAttr(e(this.rightSlider),{transform:"translate("+x+","+this.sliderPosition+")"}),this.rightSliderPosition=x,this.rightCircle!=i?this.svgSupport?this.renderer._setAttr(e(this.rightCircle),{cx:x}):this.renderer._setAttr(e(this.rightCircle),{transform:"translate("+parseFloat(x-10)+","+parseFloat(this.sliderPosition+this.sliderHeight/2)+")"}):(u=x-e("#"+this._id+"thumbright").width()/2,e("#"+this._id+"thumbright").css("left",u)),this.model.tooltipSettings.visible&&this.svgSupport&&(this.rightTooltip.setAttribute("opacity",this.setopacity),this.rightTxt.textContent="datetime"==g?t.format(new Date(c),this.model.tooltipSettings.labelFormat):t.format(c,this.model.tooltipSettings.labelFormat),m=this.rightTooltip.lastChild.getBBox().width+15,p=this.rightTooltip.lastChild.getBBox().height,this.leftd="M 0 0 L 0 "+(p+6)+" L "+(m-6)+" "+(p+6)+" L "+(m-6)+" 6 L "+m+" 0 Z",this.rightd="M 0 0 L "+m+" 0 L "+m+" "+(p+6)+" L 6 "+(p+6)+" L 6 6 Z",x+m<=this.newWidth?(this.rightTooltip.firstChild.setAttribute("d",this.rightd),this.renderer._setAttr(e(this.rightTooltip),{transform:"translate("+x+","+o+")"}),this.rightTxt.setAttribute("x",10)):(this.renderer._setAttr(e(this.rightTooltip),{transform:"translate("+(x-m)+","+o+")"}),this.rightTooltip.firstChild.setAttribute("d",this.leftd),this.rightTxt.setAttribute("x",5),this.rightTooltip.getBoundingClientRect().leftthis.endDateTime?a:this.endDateTime,e=a-s,t=(new Date(o.start)-s)/e,i=(new Date(o.end)-new Date(o.start))/e):(s=""!=r.start?parseFloat(r.start):this.startValue,s=sthis.endValue?a:this.endValue,e=a-s,t=(parseFloat(o.start)-s)/e,i=(parseFloat(o.end)-parseFloat(o.start))/e),n.zoomPosition=t,n.zoomFactor=i},_calculateSelectedData:function(){var e,t=[],i=0;if(""!=this.model.dataSource)for(e=0;e=Date.parse(this.model.dataSource[e][this.model.xName])&&(t[i]=this.model.dataSource[e],i++);else if(""!=this.model.series&&""!=this.model.series[0].dataSource&&""!=this.model.series[0].dataSource)for(e=0;e=Date.parse(this.model.series[0].dataSource[e][this.model.series[0].xName])&&(t[i]=this.model.series[0].dataSource[e],i++);this.model.selectedData=t},calculateInterval:function(e,t){if(t._intervalType=t.intervalType?t.intervalType:"auto",t.visible===!0&&"datetime"==this.model.valueType&&this.calculateVisibleLabels(t,"lower",0),e.visible===!0&&"datetime"==this.model.valueType){if(e.intervalType&&"auto"!=e.intervalType.toLowerCase())e._intervalType=e.intervalType;else switch(t._intervalType){case"years":e._intervalType="years";break;case"quarters":e._intervalType="years";break;case"months":e._intervalType="quarters";break;case"weeks":e._intervalType="months";break;case"days":e._intervalType="weeks";break;case"hours":e._intervalType="days";break;case"minutes":e._intervalType="hours"}0==e.autoInterval?this.calculateVisibleLabels(e,"higher",0):this.calculateVisibleLabels(e,"higher",0)}t.visible===!0&&"numeric"==this.model.valueType&&this.setInterval(this)},calculateVisibleLabels:function(e,t,i){var s,a,n=e._intervalType;switch(n){case"auto":s=this.calculateDateTimeNiceInterval(this,this.startDateTime,this.endDateTime),a=s.intervalType.toLowerCase(),e._intervalType=a,e._interval=s.interval,this.calculateVisibleLabels(e,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(e){var t,i,s,a,n=this.endValue-this.startValue,o=e.model.rangePadding,r=this.startValue,l=this.calculateNumericInterval(e,n);for("additional"==o?(this.endValue=this.endValue+l,this.startValue=this.startValue-l,n=this.endValue-this.startValue):"normal"==o?(i=0,r<0?(r=0,i=this.startValue+this.startValue/20,s=l+i%l,.365*l>=s&&(i-=l),i%l<0&&(i=i-l-i%l)):(i=r<5/6*this.endValue?0:r-(this.endValue-r)/2,i%l>0&&(i-=i%l)),a=this.endValue+(this.endValue-r)/20,s=l-a%l,.365*l>=s&&(a+=l),a%l>0&&(a=a+l-a%l),l=this.calculateNumericInterval(e,a-i),this.startValue=i,this.endValue=a):"round"==o&&(this.startValue=Math.floor(this.startValue/l*l),this.endValue=Math.ceil(this.endValue/l*l)),t=e.startValue,count=0;t<=e.endValue;)this._insertNumericText(e,t),count++,t+=l;this.insertLabels(e,"lower")},calculateDateTimeNiceInterval:function(e,t,i){var s,a,n=Math.abs((t.getTime()-i.getTime())/864e5),o=this.calculateNumericInterval(e,n/365);return o>=1?{interval:o,intervalType:"Years"}:(o=this.calculateNumericInterval(e,n/90),o>=1?{interval:o,intervalType:"Quarters"}:(o=this.calculateNumericInterval(e,n/30),o>=1?{interval:o,interval1:o,intervalType:"Months"}:(o=this.calculateNumericInterval(e,n/7),o>=1?{interval:o,intervalType:"Weeks",intervalType1:"Weeks"}:(o=this.calculateNumericInterval(e,n),o>=1?{interval:o,intervalType:"Days"}:(s=24*n,o=this.calculateNumericInterval(e,s),o>=1?{interval:o,intervalType:"Hours"}:(a=1440*n,o=this.calculateNumericInterval(e,a),{interval:o,intervalType:"Minutes"}))))))},calculateNumericInterval:function(e,i){for(var s,a=this.GetDesiredIntervalsCount(e.newWidth),n=i/a,o=Math.pow(10,Math.floor(t.EjSvgRender.utils._logBase(n,10))),r=[10,5,2,1],l=0;l=t.newWidth?t.setHourInterval(t,i,1):this.insertLabels(t,i);break;case 1:for(;a<=t.endDateTime;)r=this._insertText(t,i,"hht",a,n,r,!1),o+=r,n++,a=a.addHours(1);o>=t.newWidth?t.setHourInterval(t,i,2):this.insertLabels(t,i);break;case 2:for(;a<=t.endDateTime;)r=this._insertText(t,i,"hh",a,n,r,!1),o+=r,n++,a=a.addHours(1);o>=t.newWidth?(e(t.lowerLevel).empty(),t.model.labelSettings.lowerLevel._intervalType="days",t.setDayInterval(t,i,0)):this.insertLabels(t,i)}},setMinuteInterval:function(t,i,s){t._higherTextNode=[],t._higherTotalValues=[],t._lowerTextNode=[],t._lowerTotalValues=[],"higher"===i?e("#higherLevel").children().empty():e("#lowerLevel").children().empty(),Date.prototype.addMinutes=function(e){var t=new Date(this.valueOf());return 0!==t.getMilliseconds()&&t.setMilliseconds(t.getMilliseconds()+(1e3-t.getMilliseconds())),0!==t.getSeconds()?t.setSeconds(t.getSeconds()+(60-t.getSeconds())):t.setMinutes(t.getMinutes()+e),t};var a=t.startDateTime,n=0,o=0,r=0;switch(s){case 0:for(;a<=t.endDateTime;)r=this._insertText(t,i,"mm",a,n,r,!1),o+=r,n++,a=a.addMinutes(1);o>=t.newWidth?(e(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=[],"higher"===i?e("#higherLevel").children().empty():e("#lowerLevel").children().empty()},_insertWeekText:function(e,i,s,a,n,o){var r,l,d,h=e.model.labelSettings.higherLevel.style.font,c=e.model.labelSettings.lowerLevel.style.font;return"higher"===i?(e._higherTotalValues[n]=0==n?0:a.getTime()-e.startDateTime.getTime(),r={id:this._rootId+"_higLabelBarText_"+n,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},e.renderer.drawText(r,s,e.higherLevel),e._higherTextNode[n]=e.higherLevel.childNodes[n],l={size:e.model.labelSettings.higherLevel.style.font.size,fontStyle:e.model.labelSettings.higherLevel.style.font.fontStyle,fontFamily:e.model.labelSettings.higherLevel.style.font.fontFamily},d=this.svgSupport?t.EjSvgRender.utils._measureText(e.higherLevel.childNodes[n].textContent,null,l):t.EjSvgRender.utils._measureText(e.higherLevel.childNodes[n].innerHTML,null,l),o=Math.max(o,d.width)):(e._lowerTotalValues[n]=0==n?0:a.getTime()-e.startDateTime.getTime(),r={id:this._rootId+"_LabelBarText_"+n,x:0,y:0,"text-anchor":"start","dominant-baseline":"middle","font-size":c.size,"font-family":c.family,"font-style":c.style,"font-weight":c.weight,fill:c.color},e.renderer.drawText(r,s,e.lowerLevel),e._lowerTextNode[n]=e.lowerLevel.childNodes[n],l={size:e.model.labelSettings.lowerLevel.style.font.size,fontStyle:e.model.labelSettings.lowerLevel.style.font.fontStyle,fontFamily:e.model.labelSettings.lowerLevel.style.font.fontFamily},d=this.svgSupport?t.EjSvgRender.utils._measureText(e.lowerLevel.childNodes[n].textContent,null,l):t.EjSvgRender.utils._measureText(e.lowerLevel.childNodes[n].innerHTML,null,l),o=Math.max(o,d.width)),o},setWeekInterval:function(e,i,s){this._emptyLabelBars(e,i),Date.prototype.getWeek=function(){var e,t=new Date(this.getTime());return t.setHours(0,0,0,0),t.setDate(t.getDate()+3-(t.getDay()+6)%7),e=new Date(t.getFullYear(),0,4),1+Math.round(((t.getTime()-e.getTime())/864e5-3+(e.getDay()+6)%7)/7)},Date.prototype.dayOfWeek=function(){return["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"][this.getDay()]},Date.prototype.addDays=function(e){var t=new Date(this.valueOf());return new Date(t.getFullYear(),t.getMonth(),t.getDate()+e)},Date.prototype.subDays=function(e){var t=new Date(this.valueOf());return new Date(t.getFullYear(),t.getMonth(),t.getDate()-e)};var a=e.startDateTime,n=0,o=0,r=0,l=this.model.locale;for(t.datavisualization.RangeNavigator.Locale[l]?t.datavisualization.RangeNavigator.Locale[l]:t.datavisualization.RangeNavigator.Locale["en-US"];"Monday"!=a.dayOfWeek();)a=a.subDays(1);switch(s){case 0:for(;a<=e.endDateTime;)r=this._insertWeekText(e,i,this._localizedLabels.intervals.week.longWeeks+a.getWeek()+t.format(a," MMMM, yyyy"),a,n,r),o+=r,n++,a=a.addDays(7);o>=e.newWidth?e.setWeekInterval(e,i,1):this.insertLabels(e,i);break;case 1:for(;a<=e.endDateTime;)r=this._insertWeekText(e,i,this._localizedLabels.intervals.week.longWeeks+a.getWeek()+t.format(a," MMM, yy"),a,n,r),o+=r,n++,a=a.addDays(7);o>=e.newWidth?e.setWeekInterval(e,i,2):this.insertLabels(e,i);break;case 2:for(;a<=e.endDateTime;)r=this._insertWeekText(e,i,this._localizedLabels.intervals.week.longWeeks+a.getWeek(),a,n,r),o+=r,n++,a=a.addDays(7);o>=e.newWidth?e.setWeekInterval(e,i,3):this.insertLabels(e,i);break;case 3:for(;a<=e.endDateTime;)r=this._insertWeekText(e,i,this._localizedLabels.intervals.week.shortWeeks+a.getWeek(),a,n,r),o+=r,n++,a=a.addDays(7);this.insertLabels(e,i)}},setDayInterval:function(t,i,s){t._higherTextNode=[],t._higherTotalValues=[],t._lowerTextNode=[],t._lowerTotalValues=[],"higher"===i?e("#higherLevel").children().empty():e("#lowerLevel").children().empty(),Date.prototype.addDays=function(){var e=new Date(this.valueOf());return new Date(e.getFullYear(),e.getMonth(),e.getDate()+1)};var a=t.startDateTime,n=0,o=0,r=0;switch(s){case 0:for(;a<=t.endDateTime;)r=this._insertText(t,i,"dddd, MMMM d, yyyy",a,n,r,!1),o+=r,n++,a=a.addDays();o>=t.newWidth?t.setDayInterval(t,i,1):this.insertLabels(t,i);break;case 1:for(;a<=t.endDateTime;)r=this._insertText(t,i,"ddd, MMM d, yy",a,n,r,!1),o+=r,n++,a=a.addDays();o>=t.newWidth?t.setDayInterval(t,i,2):this.insertLabels(t,i);break;case 2:for(;a<=t.endDateTime;)r=this._insertText(t,i,"dddd, d",a,n,r,!1),o+=r,n++,a=a.addDays();o>=t.newWidth?t.setDayInterval(t,i,3):this.insertLabels(t,i);break;case 3:for(;a<=t.endDateTime;)r=this._insertText(t,i,"MMM, d",a,n,r,!1),o+=r,n++,a=a.addDays();o>=t.newWidth?t.setDayInterval(t,i,4):this.insertLabels(t,i);break;case 4:for(;a<=t.endDateTime;)r=this._insertText(t,i,"dd",a,n,r,!1),o+=r,n++,a=a.addDays();this.insertLabels(t,i)}},setMonthInterval:function(t,i,s){t._higherTextNode=[],t._higherTotalValues=[],t._lowerTextNode=[],t._lowerTotalValues=[],"higher"===i?e("#higherLevel").children().empty():e("#lowerLevel").children().empty();var a=t.startDateTime,n=5,o=0,r=(new Date(t.startDateTime),0),l=0;switch(s){case 0:for(;a<=t.endDateTime;)l=this._insertText(t,i,"MMMM, yyyy",a,o,l,!1),r+=l,o++,a=a.addMonths();r+n>=t.newWidth?t.setMonthInterval(t,i,1):this.insertLabels(t,i);break;case 1:for(;a<=t.endDateTime;)l=this._insertText(t,i,"MMMM",a,o,l,!1),r+=l,o++,a=a.addMonths();r+n>=t.newWidth?t.setMonthInterval(t,i,2):this.insertLabels(t,i);break;case 2:for(;a<=t.endDateTime;)l=this._insertText(t,i,"MMM",a,o,l,!1),r+=l,o++,a=a.addMonths();r+n>=t.newWidth?t.setMonthInterval(t,i,3):this.insertLabels(t,i);break;case 3:for(;a<=t.endDateTime;)l=this._insertText(t,i,"MMM",a,o,l,!0),r+=l,o++,a=a.addMonths();this.insertLabels(t,i)}},_quarter:function(e,i,s,a,n,o,r){for(var l,d,h,c,u,m=e.startYear;m<=e.endYear;m++)if(l=null!=a?t.format(n,a):"",m===e.startYear)for(d=e.startMonth;d<=11&&n<=this.endDateTime;d++)h="higher"==i?{id:this._rootId+"_higLabelBarText_"+r,x:0,y:0,"text-anchor":"start","dominant-baseline":"middle","font-size":e.model.labelSettings.higherLevel.style.font.size,"font-family":e.model.labelSettings.higherLevel.style.font.fontFamily,"font-style":e.model.labelSettings.higherLevel.style.font.fontStyle,"font-weight":e.model.labelSettings.higherLevel.style.font.fontWeight,fill:e.model.labelSettings.higherLevel.style.font.color}:{id:this._rootId+"_LabelBarText_"+r,x:0,y:0,"text-anchor":"start","dominant-baseline":"middle","font-size":e.model.labelSettings.lowerLevel.style.font.size,"font-family":e.model.labelSettings.lowerLevel.style.font.fontFamily,"font-style":e.model.labelSettings.lowerLevel.style.font.fontStyle,"font-weight":e.model.labelSettings.lowerLevel.style.font.fontWeight,fill:e.model.labelSettings.lowerLevel.style.font.color},d>=0&&d<=2?("higher"==i?e.renderer.drawText(h,s+"1 "+l,e.higherLevel):e.renderer.drawText(h,s+"1 "+l,e.lowerLevel),n=new Date(n.setMonth(3)),k=2):d>=3&&d<=5?("higher"==i?e.renderer.drawText(h,s+"2 "+l,e.higherLevel):e.renderer.drawText(h,s+"2 "+l,e.lowerLevel),n=new Date(n.setMonth(6)),k=5):d>=6&&d<=8?("higher"==i?e.renderer.drawText(h,s+"3 "+l,e.higherLevel):e.renderer.drawText(h,s+"3 "+l,e.lowerLevel),n=new Date(n.setMonth(9)),k=8):d>=9&&d<=11&&("higher"==i?e.renderer.drawText(h,s+"4 "+l,e.higherLevel):e.renderer.drawText(h,s+"4 "+l,e.lowerLevel),n=new Date(n.setMonth(12)),k=11),"lower"===i?(e._lowerTotalValues[r]=d===e.startMonth?e.startDateTime.getTime()-e.startDateTime.getTime():new Date(e.startYear+"/"+parseInt(d+1)+"/1").getTime()-e.startDateTime.getTime(),d=k,e._lowerTextNode[r]=e.lowerLevel.childNodes[r],c={size:e.model.labelSettings.lowerLevel.style.font.size,fontStyle:e.model.labelSettings.lowerLevel.style.font.fontStyle,fontFamily:e.model.labelSettings.lowerLevel.style.font.fontFamily},u=t.EjSvgRender.utils._measureText(e.lowerLevel.childNodes[r].textContent,null,c),o+=u.width):(e._higherTotalValues[r]=d===e.startMonth?e.startDateTime.getTime()-e.startDateTime.getTime():new Date(e.startYear+"/"+parseInt(d+1)+"/1").getTime()-e.startDateTime.getTime(),d=k,e._higherTextNode[r]=e.higherLevel.childNodes[r],c={size:e.model.labelSettings.higherLevel.style.font.size,fontStyle:e.model.labelSettings.higherLevel.style.font.fontStyle,fontFamily:e.model.labelSettings.higherLevel.style.font.fontFamily},u=t.EjSvgRender.utils._measureText(e.higherLevel.childNodes[r].textContent,null,c),o+=u.width),r++;else if(m===e.endYear)for(d=0;d<=e.endMonth;d++)h="higher"==i?{id:this._rootId+"_higLabelBarText_"+r,x:0,y:0,"text-anchor":"start","dominant-baseline":"middle","font-size":e.model.labelSettings.higherLevel.style.font.size,"font-family":e.model.labelSettings.higherLevel.style.font.fontFamily,"font-style":e.model.labelSettings.higherLevel.style.font.fontStyle,"font-weight":e.model.labelSettings.higherLevel.style.font.fontWeight}:{id:this._rootId+"_LabelBarText_"+r,x:0,y:0,"text-anchor":"start","dominant-baseline":"middle","font-size":e.model.labelSettings.lowerLevel.style.font.size,"font-family":e.model.labelSettings.lowerLevel.style.font.fontFamily,"font-style":e.model.labelSettings.lowerLevel.style.font.fontStyle,"font-weight":e.model.labelSettings.lowerLevel.style.font.fontWeight},d>=0&&d<=2?("higher"==i?e.renderer.drawText(h,s+"1 "+l,e.higherLevel):e.renderer.drawText(h,s+"1 "+l,e.lowerLevel),n=new Date(n.setMonth(3)),k=2):d>=3&&d<=5?("higher"==i?e.renderer.drawText(h,s+"2 "+l,e.higherLevel):e.renderer.drawText(h,s+"2 "+l,e.lowerLevel),n=new Date(n.setMonth(6)),k=5):d>=6&&d<=8?("higher"==i?e.renderer.drawText(h,s+"3 "+l,e.higherLevel):e.renderer.drawText(h,s+"3 "+l,e.lowerLevel),n=new Date(n.setMonth(9)),k=8):d>=9&&d<=11&&("higher"==i?e.renderer.drawText(h,s+"4 "+l,e.higherLevel):e.renderer.drawText(h,s+"4 "+l,e.lowerLevel),n=new Date(n.setMonth(12)),k=11),"lower"===i?(e._lowerTotalValues[r]=new Date(e.endYear+"/"+parseInt(d+1)+"/1").getTime()-e.startDateTime.getTime(),d=k,e._lowerTextNode[r]=e.lowerLevel.childNodes[r],c={size:e.model.labelSettings.lowerLevel.style.font.size,fontStyle:e.model.labelSettings.lowerLevel.style.font.fontStyle,fontFamily:e.model.labelSettings.lowerLevel.style.font.fontFamily},u=t.EjSvgRender.utils._measureText(e.lowerLevel.childNodes[r].textContent,null,c),o+=u.width):(e._higherTotalValues[r]=new Date(e.endYear+"/"+parseInt(d+1)+"/1").getTime()-e.startDateTime.getTime(),d=k,e._higherTextNode[r]=e.higherLevel.childNodes[r],c={size:e.model.labelSettings.higherLevel.style.font.size,fontStyle:e.model.labelSettings.higherLevel.style.font.fontStyle,fontFamily:e.model.labelSettings.higherLevel.style.font.fontFamily},u=t.EjSvgRender.utils._measureText(e.higherLevel.childNodes[r].textContent,null,c),o+=u.width),r++;else for(d=0;d<=11;d++)h="higher"==i?{id:this._rootId+"_higLabelBarText_"+r,x:0,y:0,"text-anchor":"start","dominant-baseline":"middle","font-size":e.model.labelSettings.higherLevel.style.font.size,"font-family":e.model.labelSettings.higherLevel.style.font.fontFamily,"font-style":e.model.labelSettings.higherLevel.style.font.fontStyle,"font-weight":e.model.labelSettings.higherLevel.style.font.fontWeight}:{id:this._rootId+"_LabelBarText_"+r,x:0,y:0,"text-anchor":"start","dominant-baseline":"middle","font-size":e.model.labelSettings.lowerLevel.style.font.size,"font-family":e.model.labelSettings.lowerLevel.style.font.fontFamily,"font-style":e.model.labelSettings.lowerLevel.style.font.fontStyle,"font-weight":e.model.labelSettings.lowerLevel.style.font.fontWeight},d>=0&&d<=2?("higher"==i?e.renderer.drawText(h,s+"1 "+l,e.higherLevel):e.renderer.drawText(h,s+"1 "+l,e.lowerLevel),n=new Date(n.setMonth(3)),k=2):d>=3&&d<=5?("higher"==i?e.renderer.drawText(h,s+"2 "+l,e.higherLevel):e.renderer.drawText(h,s+"2 "+l,e.lowerLevel),n=new Date(n.setMonth(6)),k=5):d>=6&&d<=8?("higher"==i?e.renderer.drawText(h,s+"3 "+l,e.higherLevel):e.renderer.drawText(h,s+"3 "+l,e.lowerLevel),n=new Date(n.setMonth(9)),k=8):d>=9&&d<=11&&("higher"==i?e.renderer.drawText(h,s+"4 "+l,e.higherLevel):e.renderer.drawText(h,s+"4 "+l,e.lowerLevel),n=new Date(n.setMonth(12)),k=11),"lower"===i?(e._lowerTotalValues[r]=new Date(m+"/"+parseInt(d+1)+"/1").getTime()-e.startDateTime.getTime(),d=k,e._lowerTextNode[r]=e.lowerLevel.childNodes[r],c={size:e.model.labelSettings.lowerLevel.style.font.size,fontStyle:e.model.labelSettings.lowerLevel.style.font.fontStyle,fontFamily:e.model.labelSettings.lowerLevel.style.font.fontFamily},u=t.EjSvgRender.utils._measureText(e.lowerLevel.childNodes[r].textContent,null,c),o+=u.width):(e._higherTotalValues[r]=new Date(m+"/"+parseInt(d+1)+"/1").getTime()-e.startDateTime.getTime(),d=k,e._higherTextNode[r]=e.higherLevel.childNodes[r],c={size:e.model.labelSettings.higherLevel.style.font.size,fontStyle:e.model.labelSettings.higherLevel.style.font.fontStyle,fontFamily:e.model.labelSettings.higherLevel.style.font.fontFamily},u=t.EjSvgRender.utils._measureText(e.higherLevel.childNodes[r].textContent,null,c),o+=u.width),r++;return o},setQuarterInterval:function(i,s,a){i._higherTextNode=[],i._higherTotalValues=[],i._lowerTextNode=[],i._lowerTotalValues=[],"higher"===s?e("#higherLevel").children().empty():e("#lowerLevel").children().empty();var n=new Date(i.startDateTime),o=0,r=0,l=this.model.locale;t.datavisualization.RangeNavigator.Locale[l]?t.datavisualization.RangeNavigator.Locale[l]:t.datavisualization.RangeNavigator.Locale["en-US"];switch(a){case 0:r=this._quarter(i,s,this._localizedLabels.intervals.quarter.longQuarters,"yyyy",n,r,o),r>=i.newWidth-this.padding?i.setQuarterInterval(i,s,1):this.insertLabels(i,s);break;case 1:r=this._quarter(i,s,this._localizedLabels.intervals.quarter.longQuarters,"yy",n,r,o),r>=i.newWidth-this.padding?i.setQuarterInterval(i,s,2):this.insertLabels(i,s);break;case 2:r=this._quarter(i,s,this._localizedLabels.intervals.quarter.shortQuarters,"yyyy",n,r,o),r>=i.newWidth-this.padding?i.setQuarterInterval(i,s,3):this.insertLabels(i,s);break;case 3:r=this._quarter(i,s,this._localizedLabels.intervals.quarter.shortQuarters,null,n,r,o),this.insertLabels(i,s)}},_insertText:function(e,i,s,a,n,o,r){var l,d,h;return Date.prototype.addYears=function(e){var t=new Date(this.valueOf());return 0!==t.getMilliseconds()||0!==t.getSeconds()||0!==t.getMinutes()||0!==t.getHours()||0!==t.getDate()||0!==t.getMonth()?t=new Date(t.getFullYear()+1,0,1):t.setYear(t.getFullYear()+e),t},Date.prototype.addMonths=function(){var e=new Date(this.valueOf());return new Date(e.getFullYear(),e.getMonth()+1,1)},"higher"===i?(e._higherTotalValues[n]=a.getTime()-e.startDateTime.getTime(),l={id:this._rootId+"_higLabelBarText_"+n,x:0,y:0,"text-anchor":"start","dominant-baseline":"middle","font-size":e.model.labelSettings.higherLevel.style.font.size,"font-family":e.model.labelSettings.higherLevel.style.font.fontFamily,"font-style":e.model.labelSettings.higherLevel.style.font.fontStyle,"font-weight":e.model.labelSettings.higherLevel.style.font.fontWeight,fill:e.model.labelSettings.higherLevel.style.font.color},0==r?e.renderer.drawText(l,t.format(a,s),e.higherLevel):e.renderer.drawText(l,t.format(a,s).toString().substring(0,1),e.higherLevel),e._higherTextNode[n]=e.higherLevel.childNodes[n],d={size:e.model.labelSettings.higherLevel.style.font.size,fontStyle:e.model.labelSettings.higherLevel.style.font.fontStyle,fontFamily:e.model.labelSettings.higherLevel.style.font.fontFamily},h=this.svgSupport?t.EjSvgRender.utils._measureText(e.higherLevel.childNodes[n].textContent,null,d):t.EjSvgRender.utils._measureText(e.higherLevel.childNodes[n].innerHTML,null,d),o=Math.max(o,h.width)):(e._lowerTotalValues[n]=a.getTime()-e.startDateTime.getTime(),l={id:this._rootId+"_LabelBarText_"+n,x:0,y:0,"text-anchor":"start","dominant-baseline":"middle","font-size":e.model.labelSettings.lowerLevel.style.font.size,"font-family":e.model.labelSettings.lowerLevel.style.font.fontFamily,"font-style":e.model.labelSettings.lowerLevel.style.font.fontStyle,"font-weight":e.model.labelSettings.lowerLevel.style.font.fontWeight,fill:e.model.labelSettings.lowerLevel.style.font.color},0==r?e.renderer.drawText(l,t.format(a,s),e.lowerLevel):e.renderer.drawText(l,t.format(a,s).substring(0,1),e.lowerLevel),e._lowerTextNode[n]=e.lowerLevel.childNodes[n],d={size:e.model.labelSettings.lowerLevel.style.font.size,fontStyle:e.model.labelSettings.lowerLevel.style.font.fontStyle,fontFamily:e.model.labelSettings.lowerLevel.style.font.fontFamily},h=this.svgSupport?t.EjSvgRender.utils._measureText(e.lowerLevel.childNodes[n].textContent,null,d):t.EjSvgRender.utils._measureText(e.lowerLevel.childNodes[n].innerHTML,null,d),o=Math.max(o,h.width)),o},_insertNumericText:function(e,i){var s,a,n,o;e._lowerTotalValues[count]=i-e.startValue,s=e.model.labelSettings.style.font,a={id:this._rootId+"_LabelBarText_"+count,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},e.renderer.drawText(a,i,e.lowerLevel),e._lowerTextNode[count]=e.lowerLevel.childNodes[count],n={size:e.model.labelSettings.lowerLevel.style.font.size,fontStyle:e.model.labelSettings.lowerLevel.style.font.fontStyle,fontFamily:e.model.labelSettings.lowerLevel.style.font.fontFamily},o=this.svgSupport?t.EjSvgRender.utils._measureText(e.lowerLevel.childNodes[count].textContent,null,n):t.EjSvgRender.utils._measureText(e.lowerLevel.childNodes[count].innerHTML,null,n)},setYearInterval:function(e,t){var i=e.startDateTime;for(count=0;i<=e.endDateTime;)this._insertText(e,t,"yyyy",i,count,0,!1),count++,i=i.addYears(1);this.insertLabels(e,t)},_applyPadding:function(){for(var e=0;e0?s.newWidth-2*s.padding:0,height:s.minHighHeight,stroke:s.model.labelSettings.higherLevel.border.color,"stroke-width":s.model.labelSettings.higherLevel.border.width,fill:"transparent"},s.renderer.drawRect(_,s.higherLevel)):"top"==s.model.labelSettings.higherLevel.position?(_={x:this.padding,y:1,width:s.newWidth-2*s.padding,height:s.minHighHeight,stroke:s.model.labelSettings.higherLevel.border.color,"stroke-width":s.model.labelSettings.higherLevel.border.width,fill:"transparent"},s.renderer.drawRect(_,s.higherLevel)):(_={x:this.padding,y:s.bottomPosition,width:s.newWidth>0?s.newWidth-2*s.padding:0,height:s.minHighHeight,stroke:s.model.labelSettings.higherLevel.border.color,"stroke-width":s.model.labelSettings.higherLevel.border.width,fill:"transparent"},s.renderer.drawRect(_,s.higherLevel)),s._higherLineLeft=[],f=s.model.enableRTL?s.newWidth-(s._higherTotalValues[s._higherTextNode.length-1]*this.eachInterval+this.padding):s._higherTotalValues[y]*this.eachInterval+this.padding,s.model.enableRTL?(w=s._higherTextNode.length-1,r=!0):(w=0,r=!1),l=0;r?w>=0:wf&&(s._higherTextNode[r?w+1:w-1].textContent="")),s.renderer._setAttr(e(s._higherTextNode[w]),{x:h}),s.renderer._setAttr(e(s._higherTextNode[w]),{fill:s.model.labelSettings.higherLevel.style.font.color}),s._higherTextLeft[w]=h,"top"==s.model.labelSettings.higherLevel.position&&"top"==s.model.labelSettings.lowerLevel.position?(s._higherTextNode[w].setAttribute("y",s.minHighHeight-5),_={x1:f,y1:"0",x2:f,y2:s.centerPosition,stroke:s.model.labelSettings.higherLevel.gridLineStyle.color,"stroke-width":s.model.labelSettings.higherLevel.gridLineStyle.width,"stroke-dasharray":s.model.labelSettings.higherLevel.gridLineStyle.dashArray},0!=w&&s.renderer.drawLine(_,s.higherLevel)):"top"==s.model.labelSettings.higherLevel.position?(this.svgSupport?"msie"==p.browser.toLowerCase()?s._higherTextNode[w].setAttribute("y",s.centerPosition-5):s._higherTextNode[w].setAttribute("y",s.centerPosition-9):s.renderer._setAttr(e(s._higherTextNode[w]),{y:s.centerPosition/2-5}),_={x1:f,y1:"0",x2:f,y2:s.centerPosition,stroke:s.model.labelSettings.higherLevel.gridLineStyle.color,"stroke-width":s.model.labelSettings.higherLevel.gridLineStyle.width,"stroke-dasharray":s.model.labelSettings.higherLevel.gridLineStyle.dashArray},0!=w&&s.renderer.drawLine(_,s.higherLevel)):(s._higherTextNode[w].setAttribute("y",s.newHeight-5),_={x1:f,y1:this.bottomPosition,x2:f,y2:s.newHeight,stroke:s.model.labelSettings.higherLevel.gridLineStyle.color,"stroke-width":s.model.labelSettings.higherLevel.gridLineStyle.width,"stroke-dasharray":s.model.labelSettings.higherLevel.gridLineStyle.dashArray},0!=w&&s.renderer.drawLine(_,s.higherLevel)),(hC?"middle"===s.model.labelSettings.higherLevel.style.horizontalAlignment?s._higherTextNode[w].setAttribute("x",this.padding+(f-this.padding)/2-C/2):"left"===s.model.labelSettings.higherLevel.style.horizontalAlignment?s._higherTextNode[w].setAttribute("x",this.padding+10):s._higherTextNode[w].setAttribute("x",f-C-2):s.newWidth-fC?"middle"===s.model.labelSettings.higherLevel.style.horizontalAlignment?s._higherTextNode[w].setAttribute("x",b+(s.newWidth-b-this.padding)/2-C/2):"left"===s.model.labelSettings.higherLevel.style.horizontalAlignment?s._higherTextNode[w].setAttribute("x",b+10):s._higherTextNode[w].setAttribute("x",s.newWidth-C-2-this.padding):s.higherLevel.removeChild(s._higherTextNode[w])}else if(h+C>s.newWidth-this.padding&&"datetime"==n){h="middle"===s.model.labelSettings.higherLevel.style.horizontalAlignment?f+(s.newWidth-f-this.padding)/2-C/2:"left"===s.model.labelSettings.higherLevel.style.horizontalAlignment?f:s.newWidth-3*C/2,s._higherTextNode[w].setAttribute("x",h);continue}f=this.model.enableRTL?s.newWidth-(s._higherTotalValues[w-1]*this.eachInterval+this.padding):s._higherTotalValues[w+1]*this.eachInterval+this.padding,y++}for(u=0,m=s._higherLineLeft.length;u0?this.newWidth-2*s.padding:0,height:s.minLowHeight-1,stroke:s.model.labelSettings.lowerLevel.border.color,"stroke-width":s.model.labelSettings.lowerLevel.border.width,fill:"transparent"},s.renderer.drawRect(_,s.lowerLevel)):"top"===s.model.labelSettings.lowerLevel.position&&"bottom"===s.model.labelSettings.higherLevel.position?(_={x:this.padding,y:0,width:this.newWidth>0?this.newWidth-2*s.padding:0,height:s.minLowHeight-1,stroke:s.model.labelSettings.lowerLevel.border.color,"stroke-width":s.model.labelSettings.lowerLevel.border.width,fill:"transparent"},s.renderer.drawRect(_,s.lowerLevel)):"top"===s.model.labelSettings.higherLevel.position&&"top"===s.model.labelSettings.lowerLevel.position&&(_={x:this.padding,y:s.minHighHeight-1,width:this.newWidth>0?this.newWidth-2*s.padding:0,height:s.minLowHeight,stroke:s.model.labelSettings.lowerLevel.border.color,"stroke-width":s.model.labelSettings.lowerLevel.border.width,fill:"transparent"},s.renderer.drawRect(_,s.lowerLevel)),s.model.enableRTL?(w=s._lowerTextNode.length-1,r=!0):(w=0,r=!1);r?w>=0:wC?"middle"===s.model.labelSettings.lowerLevel.style.horizontalAlignment?s._lowerTextNode[w].setAttribute("x",this.padding+(f-this.padding)/2-C/2):"left"===s.model.labelSettings.lowerLevel.style.horizontalAlignment?s._lowerTextNode[w].setAttribute("x",this.padding+10):s._lowerTextNode[w].setAttribute("x",f-C-2):s.newWidth-fC?"middle"===s.model.labelSettings.lowerLevel.style.horizontalAlignment?s._lowerTextNode[w].setAttribute("x",b+(s.newWidth-b-this.padding)/2-C/2):"left"===s.model.labelSettings.lowerLevel.style.horizontalAlignment?s._lowerTextNode[w].setAttribute("x",b+10):s._lowerTextNode[w].setAttribute("x",s.newWidth-C-2-this.padding):s.lowerLevel.removeChild(s._lowerTextNode[w]),y--):(s.lowerLevel.removeChild(s._lowerTextNode[w]),y--):h+C>s.newWidth-this.padding&&"datetime"==n&&(h="middle"===s.model.labelSettings.lowerLevel.style.horizontalAlignment?f+(s.newWidth-f-this.padding)/2-C/2:"left"===s.model.labelSettings.lowerLevel.style.horizontalAlignment?f:s.newWidth-3*C/2,s._lowerTextNode[w].setAttribute("x",h)),f=this.model.enableRTL?s.newWidth-(s._lowerTotalValues[w-1]*this.eachInterval+this.padding):s._lowerTotalValues[w+1]*this.eachInterval+this.padding,y++;for(u=0,m=s._lowerLineLeft.length;u0&&this._processJsonData(this.model.dataSource,this.model)},_processJsonData:function(e,s){for(var a,n,o,r,l,d,h=[],c=[],u=0,m=0;m=R&&k<=M&&k+D.Height>=M){S="lowerLevel"==P,T="higherLevel"==P;break}if(h=!1,s.isSelection=!1,s.highlightRect&&(c=s.highlightRect.getBoundingClientRect(),u=s.centerSlider.getBoundingClientRect(),c.left>=u.left&&c.right<=u.right&&(h=!0)),!v.enable||!s.selectionRect||"leftslider"===n.parentNode.id||"rightslider"===n.parentNode.id||r==this._id+"thumbleft"||r==this._id+"thumbright"||(s.isSelection=!0,s.startX=s.mouseDownX),"leftslider"===n.parentNode.id||"rightslider"===n.parentNode.id||r==this._id+"thumbleft"||r==this._id+"thumbright"||n.parentNode.id==="highlightRect"+this._id&&h||"centerslider"===n.parentNode.id||S||T||s.isSelection)if(s.dragTarget=n.parentNode.id==="highlightRect"+this._id?e("#centerslider").children()[0]:n,s.grabbed=!0,s.edge=!1,m=s.dragTarget.parentNode.id,this.svgSupport&&(p=r==this._id+"thumbleft"||r==this._id+"thumbright"?{e:t.clientX,f:t.clientY}:s.dragTarget.getCTM(),s.grabPoint.x="mozilla"==i.browser.toLowerCase()||"webkit"==i.browser.toLowerCase()?s.mouseDownX+this.grabPadding-Number(p.e):s.mouseDownX+this.leftPadding-Number(p.e),s.grabPoint.y=s.trueCoords.y-Number(p.f)),f=!1,b=s.model.enableRTL,b&&(s._higherLineLeft.sort(function(e,t){return e-t}),s._lowerLineLeft.sort(function(e,t){return e-t})),"leftslider"!=m&&"rightslider"!=m&&"datetime"==s.model.valueType&&T){for(s.grabbed="centerslider"==s.dragTarget.parentNode.id,g=s.mouseDownX,_=0;_s._higherLineLeft[_]&&gs._higherLineLeft[_]&&(s.setSliderPositions(s._higherLineLeft[_],null,null),s.setSliderPositions(null,null,s.newWidth-s.padding),f=!0);b&&!f&&(s.setSliderPositions(0+s.padding,null,null),s.setSliderPositions(null,null,s._higherLineLeft[0]),f=!1)}else if("leftslider"!=m&&"rightslider"!=m&&"datetime"==s.model.valueType&&S){for(s.center=s.mouseDownX,s.grabbed="centerslider"==s.dragTarget.parentNode.id,g=s.mouseDownX,_=0;_s._lowerLineLeft[_]&&gs._lowerLineLeft[_]&&(s.setSliderPositions(s._lowerLineLeft[_],null,null),s.setSliderPositions(null,null,s.newWidth-s.padding),f=!0);b&&!f&&(s.setSliderPositions(0+s.padding,null,null),s.setSliderPositions(null,null,s._lowerLineLeft[0]),f=!1)}else s.isSelection&&(s.grabbed=!0)},_leave:function(){e("#highlightRect"+this._id).hide()},_drag:function(t){var i,s,a,n,o,r,l,d,h,c;t.preventDefault(),i=jQuery.uaMatch(navigator.userAgent),s=this,a=this.svgSupport&&"[object TouchEvent]"!==t.originalEvent.toString()&&"msie"!=i.browser.toLowerCase()?s.calMousePosition(t):this.svgSupport?s.calTouchPosition(t):s.calMousePosition(t),mouseX=s.mouseDownX=a.X,mouseY=s.mouseDownY=a.Y;var u,m,p,l,g=s.model.navigatorStyleSettings.highlightSettings,c=t.target.parentNode.id,_="leftslider"==c||"rightslider"==c||c==this._id+"thumbleft"||c==this._id+"thumbright",f=g.color;if(this.highlightGrad=this.renderer.createGradientElement("highlightGrad",f,150,0,150,100,this.svgDocument),e("#highlightRect"+this._id).hide(),!g.enable||_||this.isSelection||this._sliderHover||s.switched||(0==e("#highlightRect"+this._id).length&&(this.gHighlight=this.renderer.createGroup({id:"highlightRect"+this._id}),n={height:this.sliderHeight,fill:this.highlightGrad,opacity:g.opacity,stroke:g.border.color,"stroke-width":g.border.width},this.renderer.drawRect(n,this.gHighlight),this.highlightRect=this.gHighlight.firstChild,this.renderer.append(this.gHighlight,this.styleRect)),this.rect=this.highlightRect,s.startX=s.mouseDownX,this._highlight.call(this,s,t)),this.svgSupport&&s.GetTrueCoords(t),s.model.labelSettings.higherLevel.visible||s.model.labelSettings.lowerLevel.visible)for(o=s.labelRegions.length,r=0;r=mouseX&&u.Y<=mouseY&&u.Y+u.Height>=mouseY){e(s.rightUnSelected).css("cursor","pointer"),e(s.leftUnSelected).css("cursor","pointer");break}e(s.rightUnSelected).css("cursor","default"),e(s.leftUnSelected).css("cursor","default")}if(s.dragTarget){for((!s.edge&&s.dragTarget===s.leftSlider||s.dragTarget===s.rightSlider||s.dragTarget===s.highlightRect||s.dragTarget===s.centerSlider)&&this.svgSupport?"webkit"==i.browser.toLowerCase()||"mozilla"==i.browser.toLowerCase()?(l=s.mouseDownX-s.grabPoint.x,d=s.mouseDownY-s.grabPoint.y):(l=s.trueCoords.x-s.grabPoint.x,d=s.trueCoords.y-s.grabPoint.y):(l=s.mouseDownX,d=s.mouseDownY),h=s.dragTarget;h.parentNode;)h=h.parentNode,h.id==this._id+"thumbleft"?c=this._id+"thumbleft":h.id==this._id+"thumbright"&&(c=this._id+"thumbright");s.diff=s.leftSlider.getBoundingClientRect().left-s.rightSlider.getBoundingClientRect().left,s.leftdiff=s.rightSlider.getBoundingClientRect().left-this.padding,s.rightdiff=s.leftSlider.getBoundingClientRect().left-this.padding,"leftslider"===s.dragTarget.parentNode.id||c==this._id+"thumbleft"?(s.grabbed=!1,s.diff>=-1&&s.diff<=1&&0==s.switched&&s.rightdiff=1||s.diff<=-1)&&(s.switched=!1)),s.left=l):"rightslider"===s.dragTarget.parentNode.id||c==this._id+"thumbright"?(s.grabbed=!1,s.diff>=0&&s.diff<=1&&0==s.switched&&s.leftdiff>0?(s.target=s.leftSlider,s.switched=!0,s.edge=!0,s._grab(t),s._drag(t)):(l>=this.leftSliderPosition?(s.setSliderPositions(null,null,l),this.rightSliderPosition=l):(s.setSliderPositions(null,null,this.leftSliderPosition),this.rightSliderPosition=this.leftSliderPosition),(s.diff>=1||s.diff<=-1)&&(s.switched=!1)),s.right=l):"centerslider"!==s.dragTarget.parentNode.id&&s.dragTarget.parentNode.id!=="highlightRect"+this._id||s.isSelection?s.isSelection&&(this.rect=this.selectionRect,this._highlight.call(this,s,t),s.grabbed=!1):(e("#highlightRect"+this._id).hide(),ll+this.renderer._getAttrVal(e(s.dragTarget),"width")&&s.setSliderPositions(null,l,null))}},_highlight:function(i,s){var a,n,o,r,l,d,h,c=[],u=[],m=this.sliderHeight,p=i.startX>i.mouseDownX?i.mouseDownX:i.startX,g=i.startX==p?i.mouseDownX:i.startX,_=i.mouseDownY,f=(this.model.labelSettings.higherLevel.labelPlacement,this.model.labelSettings.lowerLevel.visible);targetId=s.target.parentNode.id,e.each(i.labelRegions,function(e,t){a=t.X,n=t.Y,o=t.Width,r="higherLevel"==t.LabelType,l=r?targetId.indexOf("higherLevel")<0&&f?t.Height:m:t.Height,p<=a+o&&a<=g&&n+l>=_&&(r?u.indexOf(t)>-1||u.push(t):c.indexOf(t)>-1||c.push(t))}),h=function(e){if(e.length>0){min=e[0].X,max=e[0].X,d=e[0],maximumRegion=e[0];for(var t=0;tmax&&(max=e[t].X,maximumRegion=e[t])}},h(u.length>0?u:c),t.isNullOrUndefined(d)||(e("#"+this.rect.parentNode.id).show(),this.renderer._setAttr(e(this.rect),{transform:"translate("+d.X+","+this.sliderPosition+")",width:maximumRegion.Width+maximumRegion.X-d.X}))},_drop:function(t){var s,a,n,o,r,l,d;if(this.dragTarget){if(s=t.target,this._sliderHover=!1,a=this,a.model.allowSnapping&&parseInt(a.leftSlider.getBoundingClientRect().left+2)=a._lowerLineLeft[d]&&r=a.snapValue+l/2?(a.snapValue=a._lowerLineLeft[d+1],"leftslider"===a.dragTarget.parentNode.id?a.setSliderPositions(a._lowerLineLeft[d+1],null,null):"rightslider"===a.dragTarget.parentNode.id?a.setSliderPositions(null,null,a._lowerLineLeft[d+1]):a.isSelection?(a.setSliderPositions(null,null,a._lowerLineLeft[d+1]+parseFloat(o.right-o.left)),a.setSliderPositions(a._lowerLineLeft[d+1],null,null)):"centerslider"!==a.dragTarget.parentNode.id||a.grabbed||(a.setSliderPositions(null,null,a._lowerLineLeft[d+1]+parseFloat(a.centerSlider.getAttribute("width"))),a.setSliderPositions(a._lowerLineLeft[d+1],null,null))):(a.snapValue=a._lowerLineLeft[d],"leftslider"===a.dragTarget.parentNode.id?a.setSliderPositions(a._lowerLineLeft[d],null,null):"rightslider"===a.dragTarget.parentNode.id?a.setSliderPositions(null,null,a._lowerLineLeft[d]):a.isSelection?(a.setSliderPositions(null,null,a._lowerLineLeft[d]+parseFloat(o.right-o.left)),a.setSliderPositions(a._lowerLineLeft[d],null,null)):"centerslider"!==a.dragTarget.parentNode.id||a.grabbed||(a.setSliderPositions(null,null,a._lowerLineLeft[d]+parseFloat(a.centerSlider.getAttribute("width"))),a.setSliderPositions(a._lowerLineLeft[d],null,null)))):d+1===a._lowerLineLeft.length&&r>=a._lowerLineLeft[d]&&(a.isSelection?(a.setSliderPositions(null,null,a._lowerLineLeft[d]+parseFloat(a.rect.getBoundingClientRect().width)),a.setSliderPositions(a._lowerLineLeft[d],null,null)):a.setSliderPositions(null,null,a.newWidth-a.padding));this.dragTarget=null,this.leftTooltip!=i&&"always"==this.model.tooltipSettings.tooltipDisplayMode?(this.leftTooltip.setAttribute("opacity",1),this.rightTooltip.setAttribute("opacity",1)):this.leftTooltip!=i&&"ondemand"==this.model.tooltipSettings.tooltipDisplayMode&&(this.leftTooltip.setAttribute("opacity",0),this.rightTooltip.setAttribute("opacity",0)),this.model.enableDeferredUpdate&&(this._calculateSelectedData(),(!a.grabbed||a.isSelection)&&(this._calculateSliderZoomFactPosition(),"datetime"==this.model.valueType?(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))),a.isSelection&&(a.isSelection=!1,this.renderer._setAttr(e(this.selectionRect),{fill:"transparent"}),this.renderer._setAttr(e(this.selectionRect),{stroke:"transparent"}))}this._setSelectedRange()},mouseup:function(e){null!=this.dragTarget&&(this._drop(e),null!=this.dragTarget&&(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(e){var t=this.svgDocument.currentScale,i=this.svgDocument.currentTranslate,s=jQuery.uaMatch(navigator.userAgent);"[object TouchEvent]"!==e.originalEvent.toString()&&"msie"!=s.browser.toLowerCase()?(this.trueCoords.x=(e.clientX-i.x)/t,this.trueCoords.y=(e.clientY-i.y)/t):"msie"==s.browser.toLowerCase()?(this.trueCoords.x=(e.originalEvent.clientX-i.x)/t,this.trueCoords.y=(e.originalEvent.clientY-i.y)/t):(this.trueCoords.x=(e.originalEvent.touches[0].clientX-i.x)/t,this.trueCoords.y=(e.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(e){e=e.toLowerCase();var t=/(chrome)[ \/]([\w.]+)/.exec(e)||/(webkit)[ \/]([\w.]+)/.exec(e)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(e)||/(msie) ([\w.]+)/.exec(e)||e.indexOf("compatible")<0&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(e)||[];return{browser:t[1]||"",version:t[2]||"0"}},function(e,t,s){t.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:{background:"white",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:[0,0],dockPosition:"centerleft"},enableLayerChangeAnimation:!1,enablePan:!0,baseMapIndex:0,shapeSelected:"",markerSelected:"",zoomedIn:"",onRenderComplete:"",panned:"",zoomedOut:"",mouseover:"",mouseleave:"",layers:[]},observables:["baseMapIndex","enablePan","enableResize","enableAnimation","zoomSettings.level","zoomSettings.minValue","zoomSettings.maxValue","zoomSettings.factor","zoomSettings.enableZoom","zoomSettings.enableZoomOnSelection","navigationControl.enableNavigation","navigationControl.orientation","navigationControl.absolutePosition","navigationControl.dockPosition"],_tags:[{tag:"layers",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","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"],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"}],enableZoom:t.util.valueFunction("zoomSettings.enableZoom"),enableZoomOnSelection:t.util.valueFunction("zoomSettings.enableZoomOnSelection"),zoomLevel:t.util.valueFunction("zoomSettings.level"),minZoom:t.util.valueFunction("zoomSettings.minValue"),zoomFactor:t.util.valueFunction("zoomSettings.factor"),maxZoom:t.util.valueFunction("zoomSettings.maxValue"),baseMapIndex:t.util.valueFunction("baseMapIndex"),enablePan:t.util.valueFunction("enablePan"),enableResize:t.util.valueFunction("enableResize"),enableAnimation:t.util.valueFunction("enableAnimation"),enableNavigation:t.util.valueFunction("navigationControl.enableNavigation"),orientation:t.util.valueFunction("navigationControl.orientation"),absolutePosition:t.util.valueFunction("navigationControl.absolutePosition"),dockPosition:t.util.valueFunction("navigationControl.dockPosition"),dataTypes:{layers:"array"},_destroy:function(){this._unWireEvents(),_isSVG?e(this.element).removeClass("e-datavisualization-map e-js").find("#svgDocument").remove():e(this.element).removeClass("e-datavisualization-map e-js").find("#rootGroup").remove()},_setModel:function(t){var i,s;for(i in t)switch(i){case"zoomSettings":this.enableZoom()&&this.zoom(this.zoomLevel());break;case"baseMapIndex":this.baseMapIndex(t[i]),s=this,this.enableAnimation()?(this.model.enableLayerChangeAnimation=!0,e(this._mapContainer).animate({opacity:0},500,function(){s.refresh()})):this.refresh();break;case"background":e(this._mapContainer).css("background-image",this.model.background)}},_layers:function(e,t){"shapeSettings.fill"==t||"shapeSettings.strokeThickness"==t||"shapeSettings.selectionColor"==t||"shapeSettings.highlightColor"==t?this.clearShapeSelection():"showMapItems"==t||"dataSource"==t?this.refreshLayers():this.refresh()},_layers_markers:function(){this.refreshMarkers()},_layers_subLayers:function(e,t){"showMapItems"==t||"dataSource"==t?this.refreshLayers():this.refresh()},_init:function(){var t=this;this._navigationStyle=null,this.navigationControlData=null,this._initPrivateProperties(),e.each(this.model.layers,function(e){t._layerInitialize(e)}),this._mapContainer=this.element,e(this._mapContainer).css({overflow:"hidden"}),8==document.documentMode&&e(this._mapContainer).css({overflow:"hidden",position:"relative"}),this.refresh(),this._trigger("onRenderComplete"),this._isRendered=!0,_isSVG&&e(this._svgDocument).pinchZoom(this._rootgroup,this)},_layerInitialize:function(t){var i=this;null!=this.model.layers[t]?e.each(this.model.layers,function(t,s){s=i._checkArrayObject(s,t);var a=new n;e.extend(a,s),e.extend(s,a),e.each(s.subLayers,function(t,s){s=i._checkArrayObject(s,t);var a=new n;e.extend(a,s),e.extend(s,a)})}):this.layers[0]=new n},_checkArrayObject:function(t,i){var s=this;return e.each(t,function(e,t){if(t instanceof Array)s._checkArrayObject(t,e);else if(null!=t&&"object"==typeof t){var a=new n;s._loadIndividualDefaultValues(t,a,"number"==typeof e?i:e)}}),t},_loadIndividualDefaultValues:function(t,i,s){var a=null,n=this;return e.each(i,function(e,t){if(s==e)return void(a=t)}),a instanceof Array&&(a=a[0]),e.each(t,function(e,t){t instanceof Array?n._checkArrayObject(t,s):null!=t&&"object"==typeof t&&n._loadIndividualDefaultValues(t,t,"number"==typeof e?s:e)}),e.extend(a,t),e.extend(t,a),t},_refreshWithAnimation:function(){this.model.layers[this.baseMapIndex()]._setMapItemsPositionWithAnimation(this);for(var e=0;e-256&&l<=this._width&&d>-256&&d=0&&r>=0&&(h=new a(o,r),h.left=l,h.top=d,h.src=b.layerType==t.datavisualization.Map.LayerType.Bing?this._getBingMap(h,b.key,b.bingMapType,f):this._urlTemplate.replace("level",this.zoomLevel()).replace("tileX",h.X).replace("tileY",h.Y),this.Tiles.push(h));for(c=e.extend(!0,[],this.Tiles),u=0;u0;d--)n=0,o=1<
      "),i=t.render(this.Tiles);this._mapContainer[0].children[0];this._tileDiv.html(i)},_generatePath:function(){var i,a,n,o=this.model.layers[this.baseMapIndex()],r="";for(this._polylineCount=0,this._pointscount=0,_isSVG=!!window.SVGSVGElement,o.layerType==t.datavisualization.Map.LayerType.Geometry?o!=s&&null!=o.shapeData&&(o._isBaseLayer=!0,this._isTileMap=!1,this._scale=this.zoomLevel(),r=this._readShapeData(o)):(this._isTileMap=!0,this._scale=Math.pow(2,this.zoomLevel()-this.zoomFactor())),i=0;i '+r+"",this._mapContainer.html(a),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"),n='
      '+r+"",this._mapContainer.html(n),this._tileDiv=this.element.find("#tileDiv"),this._bubblegroup=this._createGroup(!1,"bubbleGroup"),this._bubblegroup.style.position="absolute",this.element.append(this._bubblegroup)),(o.layerType==t.datavisualization.Map.LayerType.OSM||o.layerType==t.datavisualization.Map.LayerType.Bing)&&(this._urlTemplate=o.urlTemplate,null!=this.model.centerPosition?this._panTileMap(this._width,this._height,this.model.centerPosition):this._panTileMap(this._width,this._height,[0,0]),this._generateTiles(this.zoomLevel()),_isSVG&&e(this._svgDocument).css("position","relative")),_isSVG&&e(this._mapContainer).css("position","relative"),this._rootgroup=this.element.find("#rootGroup")[0],this._on(e(this.element),t.eventType.mouseDown,{map:this},this.dragDown),this._on(e(this.element),t.eventType.mouseMove,{map:this},this.dragMove),this._on(e(this.element),t.eventType.mouseUp,{map:this},this.dragUp)},_calculateBBox:function(e,t,i){var s,a,n,o,r,l,d,h=maxLatitude=minLongitude=maxLongitude=0,c=!1;if(null!=e&&e.length>0)for(r=0;r1?(n=coords[a][0],n.length<=2&&(n=coords[a])):n=coords[a],n.length>2)for(d=0;d0)for(r=0;r0)for(r=0;r0)for(k=0;k':(o='',a+=o);if(V.length>0){for(c=!0,k=0;k1)for(b=_,v=0;v1?(y=_[w][0],y.length<=2&&(y=_[w])):y=_[w],i=[],C=[],y.length>2)for(R=0;R=D[0][0]&&longitude<=D[1][0]&&latitude>=D[0][1]&&latitude<=D[1][1])&&(I=this._convertTileLatLongtoPointForShapes(latitude,longitude,D,M),c?(r=l=I.x,d=h=I.y,c=!1):(r=Math.min(r,I.x),l=Math.max(l,I.x),d=Math.min(d,I.y),h=Math.max(h,I.y)),_isSVG?C.push({x:I.x,y:I.y,lat:T.lat,lng:T.lng}):C.push({x:I.x,y:I.y,lat:T.lat,lng:T.lng}));if(w==p&&s._newBounds.push(this._findMidPointofPoylgon(C)),C.length>0)if(_isSVG){for(x+="M"+C[0].x+","+C[0].y,m=1;m':'':(V.splice(k,1),k--)}this._groupSize={minX:r,maxX:l,minY:d,maxY:h}}if(H.length>0)for(k=0;k':''}return E=[].concat(V,H),s._polygonData=e.merge(E,W),A+a}return s._polygonData=[],null},_createGroup:function(e,t){var i;return i=document.createElement(""),i.style.width=this._width+"px",i.style.height=this._height+"px",i.coordorigin="0 0",i.coordsize=this._width+" "+this._height,e&&(this._rootgroup=i,i.style.left="20px",i.style.top="20px"),i},_generatePaletteColorsForShape:function(e,t,i,s){null!=s&&(t.shapeSettings.highlightColor=s.highlightColor,t.shapeSettings.highlightStroke=s.highlightStroke,t.shapeSettings.selectionColor=s.SelectionColor,t.shapeSettings.selectionStroke=s.SelectionStroke),_isSVG?e.setAttribute("fill",i[t._prevPaletteIndex]):e.fillcolor=i[t._prevPaletteIndex],t._prevPaletteIndex=t._prevPaletteIndex+1,t._prevPaletteIndex>i.length-1&&(t._prevPaletteIndex=0)},_renderLayers:function(i,a){var n,o,r,l,d,h,c,u,m,p,g,_,f,b,v,x,w,y,C,S,T,D,I,k,P,L,R,M,O,E;i._prevPaletteIndex=0,i._initializeLocalValues(),null==i.selectedItems&&(i.selectedItems=[]);var A=(this._rootgroup,this._svgDocument),j=this,N=i;null!=N.legendSettings&&null!=N.shapeSettings.colorMappings&&(N.legendSettings.type==s||N.legendSettings.type==t.datavisualization.Map.LegendType.Layers)&&N._generateLegends(this),null!=N.legendSettings&&null!=N.bubbleSettings.colorMappings&&N.legendSettings.type==t.datavisualization.Map.LegendType.Bubbles&&N._generateBubbleLegends(this),null!=N.shapeSettings.colorMappings&&null!=N.shapeSettings.colorMappings.rangeColorMapping&&N.shapeSettings.colorMappings.rangeColorMapping.sort(this._orderByNameAscending),null!=N.bubbleSettings.colorMappings&&null!=N.bubbleSettings.colorMappings.rangeColorMapping&&N.bubbleSettings.colorMappings.rangeColorMapping.sort(this._orderByNameAscending);var z=0,F=0;if(null!=N.dataSource&&null!=N.bubbleSettings)for(null==N.bubbleSettings.colorValuePath&&(N.bubbleSettings.colorValuePath=N.bubbleSettings.valuePath),n=0;nF?F=o:o
      "),x[0].className=b,j._templateDiv.append(x),e(x).css({left:_.x,top:_.y}),w=null==N.mapItemsTemplate?e("
      ").render(f):e("#"+N.mapItemsTemplate).render(f),e(x).html(w),i._mapItems.push(x)),null!=N.shapeSettings.colorMappings?(null==N.shapeSettings.colorValuePath&&(N.shapeSettings.colorValuePath=N.shapeSettings.valuePath),y=j._reflection(f,N.shapeSettings.colorValuePath),null==y||N.shapeSettings.autoFill||((null!=N.legendSettings&&N.legendSettings.mode==t.datavisualization.Map.LegendMode.Interactive||N.shapeSettings.enableGradient)&&null!=N.shapeSettings.colorMappings.rangeColorMapping?(g.legendrect=N._updateLegendRange(y,N,p),C=N.shapeSettings.fill,g.legendrect!=s&&(C=g.legendrect.color),_isSVG?p.setAttribute("fill",C):p.fillcolor=C):N._fillColors(y,N.shapeSettings.colorMappings,p))):N.shapeSettings.autoFill||(_isSVG?p.setAttribute("fill",N.shapeSettings.fill):(p.fillcolor=N.shapeSettings.fill,p.strokecolor=N.shapeSettings.stroke)),N.bubbleSettings.showBubble&&null!=N.bubbleSettings&&null!=N.bubbleSettings.valuePath&&(_isSVG?D=document.createElementNS(j._svgns,"circle"):(S="bubble_"+v,T='',this._bubblegroup.innerHTML=this._bubblegroup.innerHTML+T,D=document.getElementById("bubble_"+v)),I=j._reflection(f,N.bubbleSettings.valuePath),k=j._reflection(f,N.bubbleSettings.colorValuePath),null!=N.bubbleSettings.colorMappings?N._fillColors(k,N.bubbleSettings.colorMappings,D):_isSVG?D.setAttribute("fill",N.bubbleSettings.color):(D.strokecolor=N.bubbleSettings.color,D.fillcolor=N.bubbleSettings.color),P=j._getRatioOfBubble(N.bubbleSettings.minValue,N.bubbleSettings.maxValue,I,z,F),_isSVG?(e(D).attr({cx:_.x,cy:_.y,"fill-opacity":N.bubbleSettings.bubbleOpacity,r:P,class:"mapBubble"}),j.enableAnimation()&&!this._isTileMap&&e(D).css("display","none")):e(D).css({height:2*P+"px",width:2*P+"px"}),1==N.bubbleSettings.showTooltip?(L=e("'),i=Math.abs(n._stopPoint.x-n._startPoint.x),s=Math.abs(n._stopPoint.y-n._startPoint.y),e(a).css({top:Math.min(n._startPoint.y,n._stopPoint.y),left:Math.min(n._startPoint.x,n._stopPoint.x), width:i,height:s,position:"absolute","z-index":100}),e(a).appendTo("#maps"))},dragUp:function(t){var i,s,a,n=t.data.map,o=Math.abs(n._stopPoint.x-n._startPoint.x),r=Math.abs(n._stopPoint.y-n._startPoint.y),l=n.model.layers[0],d=this._mapContainer;if(n.model.draggingOnSelection){for(e(".e-mapDragSelection").remove(),e(".e-mapDragSelection").css({display:"none"}),n.mouseClickable=!1,i=0;i=120?this._zoomingIn(i.x,i.y,t):this._zoomingOut(i.x,i.y,t)},_zoomingIn:function(e,t,i){var s,a,n,o=this;o.enableZoom()&&o.zoomLevel()>=o.minZoom()&&o.zoomLevel()<=o.maxZoom()&&(s=o._scale,a={x:e,y:t},o._prevScale=s,this._isTileMap?(this._tileZoom(o.zoomLevel()-o.zoomFactor(),o.zoomLevel(),a),n=o.zoomLevel(),o.zoomLevel(o.zoomLevel()+o.zoomFactor()),this._generateTiles(this.zoomLevel()),o._translatePoint.x=(o._tileTranslatePoint.x-.5*Math.pow(2,n))/Math.pow(2,n),o._translatePoint.y=(o._tileTranslatePoint.y-.5*Math.pow(2,n))/Math.pow(2,n),o._scale=Math.pow(2,n)):(o._prevPoint={x:o._translatePoint.x,y:o._translatePoint.y},o._translatePoint.x-=(o._width/o._scale-o._width/(o._scale+o.zoomFactor()))/(o._width/e),o._translatePoint.y-=(o._height/o._scale-o._height/(o._scale+o.zoomFactor()))/(o._height/t),o._scale=s+o.zoomFactor(),o.zoomLevel(o.zoomLevel()+o.zoomFactor())),o._trigger("zoomedIn",{originalEvent:i,zoomLevel:o.zoomLevel()}),o._applyTransform(o._scale,o._translatePoint),o._refrshLayers(),o._resizeShape(),o._updateSliderValue())},_zoomingOut:function(e,t,i){var s,a,n,o=this;o.enableZoom()&&(o.zoomLevel()>this.minZoom()?(s=o._scale,a={x:e,y:t},o._prevScale=s,o._isTileMap?(o._tileZoom(o.zoomLevel()+o.zoomFactor(),o.zoomLevel(),a),n=o.zoomLevel(),o.zoomLevel(o.zoomLevel()-o.zoomFactor()),o._generateTiles(o.zoomLevel()),o._translatePoint.x=(o._tileTranslatePoint.x-.5*Math.pow(2,o.zoomLevel()-o.zoomFactor()))/Math.pow(2,o.zoomLevel()-o.zoomFactor()),o._translatePoint.y=(o._tileTranslatePoint.y-.5*Math.pow(2,o.zoomLevel()-o.zoomFactor()))/Math.pow(2,o.zoomLevel()-o.zoomFactor()),o._scale=Math.pow(2,o.zoomLevel()-o.zoomFactor())):o._scale>1&&(o._prevPoint={x:o._translatePoint.x,y:o._translatePoint.y},o._translatePoint.x-=(o._width/o._scale-o._width/(o._scale-o.zoomFactor()))/(o._width/e),o._translatePoint.y-=(o._height/o._scale-o._height/(o._scale-o.zoomFactor()))/(o._height/t),o._scale=o._scale-o.zoomFactor(),o.zoomLevel(o.zoomLevel()-o.zoomFactor()),o._scale=o.zoomLevel()),o.zoomLevel()