"use strict";function IncAjaxEvent(){this.ResponseText="";this.StatusCode="";this.StatusText=""}IncAjaxEvent.Create=function(a){var b=new IncAjaxEvent();b.ResponseText=a.responseText;b.StatusCode=a.status;b.StatusText=a.statusText;return b};function IncSpecialBinds(){}IncSpecialBinds.Incoding="incoding";IncSpecialBinds.InitIncoding="initincoding";IncSpecialBinds.IncChangeUrl="incchangeurl";IncSpecialBinds.IncAjaxBefore="incajaxbefore";IncSpecialBinds.IncAjaxError="incajaxerror";IncSpecialBinds.IncAjaxComplete="incajaxcomplete";IncSpecialBinds.IncAjaxSuccess="incajaxsuccess";IncSpecialBinds.IncInsert="incinsert";IncSpecialBinds.DocumentBinds=[IncSpecialBinds.IncChangeUrl,IncSpecialBinds.IncAjaxBefore,IncSpecialBinds.IncAjaxError,IncSpecialBinds.IncAjaxComplete,IncSpecialBinds.IncAjaxSuccess,IncSpecialBinds.IncInsert];function AjaxAdapter(){this.params=function(b){var a=[];$(b).each(function(){var e=this.name;var f=this.selector;if(ExecutableHelper.IsNullOrEmpty(f)){a.push({name:e,value:f});return}var d=$.byName(e.replaceAll("[","\\[").replaceAll("]","\\]")).is("[type=checkbox],select,[type=radio]");var c=_.isArray(f)||f.toString().contains(",");if(_.isArray(f)||(c&&d)){$(f.toString().split(",")).each(function(){a.push({name:e,value:this})})}else{a.push({name:e,value:f})}});return a};this.request=function(a,b){$.extend(a,{headers:{"X-Requested-With":"XMLHttpRequest"},dataType:"JSON",success:function(d,f,c){$(document).trigger(jQuery.Event(IncSpecialBinds.IncAjaxSuccess),IncodingResult.Success(IncAjaxEvent.Create(c)));var e=new IncodingResult(d);b(e)},beforeSend:function(d,c){$(document).trigger(jQuery.Event(IncSpecialBinds.IncAjaxBefore),IncodingResult.Success(IncAjaxEvent.Create(d)))},complete:function(c,d){$(document).trigger(jQuery.Event(IncSpecialBinds.IncAjaxComplete),IncodingResult.Success(IncAjaxEvent.Create(c)))},error:function(c,e,d){$(document).trigger(jQuery.Event(IncSpecialBinds.IncAjaxError),IncodingResult.Success(IncAjaxEvent.Create(c)))},data:this.params(a.data)});return $.ajax(a)}}AjaxAdapter.Instance=new AjaxAdapter();function ExecutableHelper(){var getValAction=function(selector){if($(selector).is(":checkbox")){var onlyCheckbox=$(selector).filter(":checkbox");if(onlyCheckbox.length==1){return $(onlyCheckbox).is(":checked")}if(onlyCheckbox.length>1){var res=[];$(onlyCheckbox).each(function(){if(!$(this).is(":checked")){return true}res.push($(this).val());return true});return res}}else{if(($(selector).is("select")&&$(selector).length>1)){var res=[];$(selector).each(function(){var val=$(this).val();if(!ExecutableHelper.IsNullOrEmpty(val)){res.push(val)}});return res}else{if($(selector).is("select[multiple]")){var res=[];$($(selector).val()).each(function(){if(!ExecutableHelper.IsNullOrEmpty(this)){res.push(this)}});return res}else{if($(selector).is(":radio")){return $.byName($(selector).prop("name"),":checked").val()}else{if($(selector).is("select,textarea,input")){return $(selector).val()}}}}}var something=$(selector).val();return ExecutableHelper.IsNullOrEmpty(something)?$.trim($(selector).html()):something};this.self="";this.target="";this.event="";this.result="";this.TryGetVal=function(selector){if(ExecutableHelper.IsNullOrEmpty(selector)){return selector}if(selector instanceof jQuery){return selector.length!=0?getValAction(selector):""}var isPrimitiveType=(_.isNumber(selector)||_.isBoolean(selector)||_.isArray(selector)||_.isDate(selector)||_.isFunction(selector));var isObject=_.isObject(selector)&&!_.isElement($(selector)[0]);if((isPrimitiveType||isObject)&&!_.isString(selector)){return selector}selector=selector.toString();var isJqueryVariable=selector.startsWith("$(");var isSelector=(selector.startsWith("||")&&selector.endWith("||"));if(!isJqueryVariable&&!isSelector){return selector}if(isJqueryVariable){return this.TryGetVal(eval(selector))}var res;if(isSelector){var valueSelector=selector.substring(2,selector.length-2);valueSelector=valueSelector.substring(selector.indexOf("*")-1,selector.length);var isTypeSelector=function(type){return selector.startsWith("||{0}*".f(type))};if(isTypeSelector("ajax")||isTypeSelector("buildurl")){var options=$.parseJSON(valueSelector);if(!ExecutableHelper.IsNullOrEmpty(options.data)){for(var i=0;i1){var arrayVal=_.isArray(val)?val:val.split(",");$(arrayVal).each(function(){if(this.toString()!=""){$('option[value="{0}"]'.f(this)).closest("select").val(this.toString())}});return}if($(element).is(":radio")){$.byName($(element).prop("name"),'[value="{0}"]'.f(val)).prop("checked",true);return}if($(element).is("script,label,div,span,p")){$(element).html(val)}else{$(element).val(val)}}}ExecutableHelper.Instance=new ExecutableHelper();ExecutableHelper.IsData=function(d,c,b){if(ExecutableHelper.IsNullOrEmpty(c)){return b.call(d)}var a=false;$(!_.isArray(d)?[d]:d).each(function(){var e=this[c];if(b.call(ExecutableHelper.IsNullOrEmpty(e)?"":e)){a=true;return false}});return a};ExecutableHelper.Filter=function(c,b){var a;if(_.isArray(c)){a=[];$(c).each(function(){if(b.isSatisfied(this)){a.push(this)}})}else{a=b.isSatisfied(c)?c:{}}return a};ExecutableHelper.Compare=function(c,a,b){b=b.toString().toLowerCase();if(b=="isempty"){return ExecutableHelper.IsNullOrEmpty(c)}c=ExecutableHelper.IsNullOrEmpty(c)?"":c.toString().toUpperCase();a=ExecutableHelper.IsNullOrEmpty(a)?"":a.toString().toUpperCase();if(b=="equal"){return c===a}if(b=="notequal"){return c!==a}if(b=="iscontains"){return c.contains(a)}if(b=="lessthan"){return parseFloat(c)parseFloat(a)}if(b=="greaterthanorequal"){return parseFloat(c)>=parseFloat(a)}throw new IncClientException({message:"Can't compare by method {0}".f(b)},{})};ExecutableHelper.IsNullOrEmpty=function(b){var c=_.isUndefined(b)||_.isNull(b)||_.isNaN(b)||b=="undefined";if(c){return true}if(_.isString(b)){return _.isEmpty(b.toString())}if(_.isArray(b)){return b.length==0}if(_.isNumber(b)||_.isDate(b)||_.isBoolean(b)||_.isFunction(b)){return false}var a=false;$.eachProperties(b,function(){a=true});return !a};ExecutableHelper.RedirectTo=function(c){var b=decodeURIComponent(c);var d=decodeURIComponent(window.location.hash);var a=b.contains("#")&&d.replace("#","")==b.split("#")[1];if(a){$(document).trigger(jQuery.Event(IncSpecialBinds.IncChangeUrl));return}window.location=c};ExecutableHelper.UrlDecode=function(a){return decodeURIComponent(a)};ExecutableHelper.UrlEncode=function(c){if(ExecutableHelper.IsNullOrEmpty(c)){return c}var b=function(){return this.replaceAll("&","%26").replaceAll("?","%3F").replaceAll("/","%2F").replaceAll("=","%3D").replaceAll(":","%3A").replaceAll("@","%40").replaceAll("#","%23")};if(c instanceof Array){for(var a=0;a>0,f=arguments[2];while(e0?Math.max.apply(Math,this):0},min:function(){return this.length>0?Math.min.apply(Math,this):0},average:function(){return this.length>0?this.sum()/this.length:0},first:function(){return this.length>0?this[0]:""},last:function(){return this.length>0?this[this.length-1]:""},count:function(){return this.length},select:function(b){var a=[];$(this).each(function(){a.push(b(this))});return a}});function incodingExtend(c,a){var b=function(){};b.prototype=a.prototype;c.prototype=new b();c.prototype.constructor=c;c.superclass=a.prototype}$.fn.extend({maxZIndex:function(b){var c={inc:10,group:"*"};$.extend(c,b);var a=0;$(c.group).each(function(){var d=parseInt($(this).css("z-index"));a=d>a?d:a});return this.each(function(){a+=c.inc;$(this).css({"z-index":a})})},toggleProp:function(a){if(this.prop(a)){$(this).prop(a,false)}else{$(this).prop(a,true)}return this},toggleAttr:function(a){if(this.attr(a)){$(this).removeAttr(a)}else{this.attr(a,a)}return this},increment:function(a){return $(this).each(function(){var b=parseInt($(this).val());$(this).val((_.isNaN(b)?0:b)+parseInt(a))})}});$.extend({eachProperties:function(a,b){for(var c in a){var d=!_.isUndefined(c)||!_.isEmpty(c);if(d&&a.hasOwnProperty(c)){b.call(c)}}},byName:function(a,c){if(ExecutableHelper.IsNullOrEmpty(a)){a=""}var b='[name="{0}"]'.f(a.toString().replaceAll("[","\\[").replaceAll("]","\\]"));if(ExecutableHelper.IsNullOrEmpty(c)){return $(b)}else{return $(b+c)}},eachFormElements:function(b,c){var e="input,select,textarea";var f='[type="submit"],[type="reset"],[type="button"]';var a;if($(b).is("input,select")){a=b.length>1?b:[b]}else{var d=$(b).find(e).not(f);a=d.length>1?d:[d]}$(a).each(c)},url:function(a){return purl(a)}});(function(e,b){var a=/\+/g;function c(f){return decodeURIComponent(f.replace(a," "))}var d=e.cookie=function(n,m,r){if(m!==undefined){r=e.extend({},d.defaults,r);if(m===null){r.expires=-1}if(typeof r.expires==="number"){var o=r.expires,q=r.expires=new Date();q.setDate(q.getDate()+o)}m=d.json?JSON.stringify(m):String(m);return(b.cookie=[encodeURIComponent(n),"=",encodeURIComponent(m),r.expires?"; expires="+r.expires.toUTCString():"",r.path?"; path="+r.path:"",r.domain?"; domain="+r.domain:"",r.secure?"; secure":""].join(""))}var f=c;var p=b.cookie.split("; ");for(var k=0,h=p.length;k0){window.setTimeout(function(){b.target=b.getTarget();b.internalExecute(a)},b.timeOut);return}if(b.interval>0){ExecutableBase.IntervalIds[b.intervalId]=window.setInterval(function(){b.target=b.getTarget();b.internalExecute(a)},b.interval);return}b.internalExecute(a)},internalExecute:function(a){},isValid:function(b){var c=this;if(ExecutableHelper.IsNullOrEmpty(c.ands)){return true}var a=false;$(c.ands).each(function(){var d=false;$(this).each(function(){d=ConditionalFactory.Create(this,c).isSatisfied(b);if(!d){return false}});if(d){a=true;return false}});return a},tryGetVal:function(a){ExecutableHelper.Instance.self=this.self;ExecutableHelper.Instance.target=this.target;ExecutableHelper.Instance.event=this.event;return ExecutableHelper.Instance.TryGetVal(a)}};ExecutableBase.IntervalIds={};incodingExtend(ExecutableActionBase,ExecutableBase);function ExecutableActionBase(){}$.extend(ExecutableActionBase.prototype,{complete:function(a,f){if(!ExecutableHelper.IsNullOrEmpty(a.redirectTo)){ExecutableHelper.RedirectTo(a.redirectTo);return}var c=a.data;if(!ExecutableHelper.IsNullOrEmpty(this.jsonData.filterResult)){var e=ConditionalFactory.Create(this.jsonData.filterResult,this);c=ExecutableHelper.Filter(a.data,e)}var b=false;var d=function(){try{this.execute(c)}catch(g){if(g instanceof IncClientException){b=true;return false}console.log("Incoding exception: {0}".f(g.message?g.messsage:g));if(navigator.Ie8){return false}throw g}};$(a.success?f.success:f.error).each(d);$(f.complete).each(d);if(b){$(f.breakes).each(d)}}});incodingExtend(ExecutableDirectAction,ExecutableActionBase);function ExecutableDirectAction(){}ExecutableDirectAction.prototype.internalExecute=function(b){var a=ExecutableHelper.IsNullOrEmpty(this.jsonData.result)?IncodingResult.Empty:new IncodingResult(this.jsonData.result);this.complete(a,b)};incodingExtend(ExecutableEventAction,ExecutableActionBase);function ExecutableEventAction(){}ExecutableEventAction.prototype.internalExecute=function(a){this.complete(a.eventResult,a)};incodingExtend(ExecutableAjaxAction,ExecutableActionBase);function ExecutableAjaxAction(){}ExecutableAjaxAction.prototype.internalExecute=function(e){var f=this;var b=$.extend(true,{data:[]},this.jsonData.ajax);for(var d=0;d0?data[0]:{}}insertContent=insertObject.hasOwnProperty(current.jsonData.property)?insertObject[current.jsonData.property]:""}if(ExecutableHelper.ToBool(current.jsonData.prepare)){$(_.isArray(insertContent)?insertContent:[insertContent]).each(function(){var item=this;$.eachProperties(this,function(){item[this]=current.tryGetVal(item[this])})})}if(!ExecutableHelper.IsNullOrEmpty(current.jsonData.template)){var templateId=current.jsonData.template;if(templateId.startsWith("||ajax*")){var buildUrlKey="||buildurl*"+templateId.substring(7,templateId.length);templateId=current.tryGetVal(buildUrlKey)}insertContent=TemplateFactory.ToHtml(ExecutableInsert.Template,templateId,function(){return current.tryGetVal(current.jsonData.template)},insertContent)}if(ExecutableHelper.IsNullOrEmpty(insertContent)){insertContent=""}eval("$(current.target).{0}(insertContent.toString())".f(current.jsonData.insertType));IncodingEngine.Current.parse(current.target);$(document).trigger(jQuery.Event(IncSpecialBinds.IncInsert))};ExecutableInsert.Template=new IncHandlerbarsTemplate();incodingExtend(ExecutableTrigger,ExecutableBase);function ExecutableTrigger(){}ExecutableTrigger.prototype.internalExecute=function(b){var a=ExecutableHelper.IsNullOrEmpty(this.jsonData.property)?b:b.hasOwnProperty(this.jsonData.property)?b[this.jsonData.property]:"";$(this.target).trigger(this.jsonData.trigger,new IncodingResult({success:true,data:a,redirectTo:""}))};incodingExtend(ExecutableValidationParse,ExecutableBase);function ExecutableValidationParse(){}ExecutableValidationParse.prototype.internalExecute=function(){var a=$(this.target).is("form")?this.target:$(this.target).closest("form").first();$(a).removeData("validator").removeData("unobtrusiveValidation");$.validator.unobtrusive.parse(a);$("[data-val-equalto-other]",a).each(function(){var b="#"+$(this).data("val-equalto-other").replaceAll("*.","Input_");if($(b).length>0){$(this).rules("add",{required:true,equalTo:b})}})};incodingExtend(ExecutableValidationRefresh,ExecutableBase);function ExecutableValidationRefresh(){}ExecutableValidationRefresh.prototype.internalExecute=function(a){var b=this;$(a).each(function(){var f=this.name.toString();var e=$("[name]",b.target).filter(function(){return $(this).attr("name").toLowerCase()==f.toLowerCase()});var g=$("[data-valmsg-for]",b.target).filter(function(){return $(this).attr("data-valmsg-for").toLowerCase()==f.toLowerCase()});var d="input-validation-error";var h="field-validation-error";var c="field-validation-valid";if(ExecutableHelper.ToBool(this.isValid)){$(e).removeClass(d);$(g).removeClass(h).addClass(c)}else{$(e).addClass(d);$(g).removeClass(c).addClass(h).html(this.errorMessage)}});$($(b.target).is("form")?b.target:$("form",this.target)).validate().focusInvalid()};incodingExtend(ExecutableEval,ExecutableBase);function ExecutableEval(){}ExecutableEval.prototype.internalExecute=function(data){eval(this.jsonData.code)};incodingExtend(ExecutableEvalMethod,ExecutableBase);function ExecutableEvalMethod(){}ExecutableEvalMethod.prototype.internalExecute=function(data){var length=this.jsonData.args.length;var args="";for(var i=0;i0})};incodingExtend(ConditionalEval,ConditionalBase);function ConditionalEval(){}ConditionalEval.prototype.isInternalSatisfied=function(data){return eval(this.jsonData.code)};incodingExtend(ConditionalIs,ConditionalBase);function ConditionalIs(){}ConditionalIs.prototype.isInternalSatisfied=function(b){var c=this.tryGetVal(this.jsonData.left);var a=this.tryGetVal(this.jsonData.right);return ExecutableHelper.Compare(c,a,this.jsonData.method)};