Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

cronapi-js

Package Overview
Dependencies
Maintainers
1
Versions
272
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cronapi-js - npm Package Compare versions

Comparing version 2.6.3 to 2.6.6

2

dist/cronapi.min.js

@@ -1,1 +0,1 @@

(window.fixedTimeZone===void 0||null===window.fixedTimeZone)&&(window.fixedTimeZone=!0),(window.timeZone===void 0||null===window.timeZone)&&(window.timeZone="UTC"),(window.timeZoneOffset===void 0||null===window.timeZoneOffset)&&(window.timeZoneOffset=0),window.systemTimeZoneOffset=window.timeZoneOffset,window.fixedTimeZone||(window.timeZoneOffset=moment().utcOffset()),function(){'use strict';var _StringfromCharCode=String.fromCharCode;this.$evt=function(e){var t=this;t.$eval||(t=angular.element(event.target).scope()),t.$eval(e)}.bind(this),this.cronapi={},this.cronapi.toDate=function(e){return new Date(e)};var getDatasource=function(e){return"string"==typeof e?window[e]:e};this.cronapi.doEval=function(e){return e},this.cronapi.evalInContext=function(js){var result=eval("this.cronapi.doEval("+js+")");if(result){if(result.commands)for(var func,i=0;i<result.commands.length;i++)func=eval(result.commands[i].function),func.apply(this,result.commands[i].params);return result.value}},this.cronapi.client=function(pack){return{attr:function(){return this},run:function(){var bk;try{bk=eval("blockly."+pack)}catch(t){}return bk||(bk=eval(pack)),bk.apply(this,arguments)}.bind(this)}};var serverMap={};this.cronapi.server=function(e){var t=!1,a=!1,n=!0;return{attr:function(){return t=!0,this},toPromise:function(){return a=!0,this},notAsync:function(){return n=!1,this},run:function(){for(var o=e,r=0;r<arguments.length;r++)o+=arguments[r]+"";if(t){if(serverMap.hasOwnProperty(o))return"$$loading"==serverMap[o]?"":serverMap[o];serverMap[o]="$$loading"}var c=e.split("."),s=c[c.length-1];c.pop();var p,l,d=c.join("."),g=new Promise((e,t)=>{p=e,l=t}),m=function(e){this.safeApply(function(){t&&(serverMap[o]=e),p(e)})}.bind(this),u=function(e){this.safeApply(function(){t&&(serverMap[o]=e),l(e)}),e&&this.cronapi.$scope.Notification.error(e)}.bind(this),h=[d+":"+s];if(n){h.push(m),h.push(u);for(var r=0;r<arguments.length;r++)h.push(arguments[r]);if(this.cronapi.util.makeCallServerBlocklyAsync.apply(this,h),a)return g}else{for(var r=0;r<arguments.length;r++)h.push(arguments[r]);let e=this.cronapi.util.callServerBlockly.apply(this,h);return t&&(serverMap[o]=e),e}}.bind(this)}},this.cronapi.callFunction=function(name){return{call:function(){var ref;try{ref=eval(name)}catch(t){}return ref?ref.apply(this,arguments):void 0}.bind(this)}},this.cronapi.conversion={},this.cronapi.conversion.asciiToBinary=function(e){var t="";if(0<e.length)for(var a,n=0;n<e.length;n++){a=e.charCodeAt(n);for(var o=7;0<=o;o--)t+=1&a>>o}return t},this.cronapi.conversion.toBoolean=function(e){return this.cronapi.internal.parseBoolean(e)},this.cronapi.conversion.toBytes=function(e){return e?e.toString():""},this.cronapi.conversion.chrToAscii=function(e){return e?e.charCodeAt(0):null},this.cronapi.conversion.stringToJs=function(e){return this.cronapi.internal.stringToJs(e)},this.cronapi.conversion.stringToDate=function(value){var pattern=/^\s*(\d+)[\/\.-](\d+)[\/\.-](\d+)(\s(\d+):(\d+):(\d+))?\s*$/;if(value){if(value instanceof Date)return value;if(pattern.test(value)){var splited=pattern.exec(value),userLang=(navigator.language||navigator.userLanguage).split("-")[0];if("pt"==userLang||"en"==userLang){var functionToCall=eval("cronapi.internal."+userLang+"Date");return functionToCall(splited)}return new Date(value)}return new Date(value)}return null},this.cronapi.conversion.intToHex=function(e){return(+e).toString(16).toUpperCase()},this.cronapi.conversion.toLong=function(e){return parseInt(e)},this.cronapi.conversion.toString=function(e){if(e){var t=new String(e);return t.toString()}return""},this.cronapi.util={},this.cronapi.util.getApplicationName=function(){return $("#projectName").length?$("#projectName").val():$("h1:first").length&&$("h1:first").text().trim().length?$("h1:first").text().trim():""},this.cronapi.util.createPromise=function(){var e,t,a=new Promise((a,n)=>{e=a,t=n});return a.__functionToResolve=e,a.__functionToReject=t,a},this.cronapi.util.handleValueToPromise=function(e,t,a){"resolve"===e?t.__functionToResolve(a):t.__functionToReject(a)},this.cronapi.util.callServerBlocklyAsync=function(e,t,a,n){const o=()=>{const e=new WeakSet;return(t,a)=>{if("object"==typeof a&&null!==a){if(e.has(a))return;e.add(a)}return a}};var r="api/cronapi/call/body/#classNameWithMethod#/".replace("#classNameWithMethod#",e),c=this.cronapi.$scope.http,s=[];$(arguments).each(function(){s.push(this)});var p="";window.uToken&&(p=window.uToken);var l={fields:t,inputs:s.slice(4)},d=this.cronapi.internal.getAddressWithHostApp(r);let g;try{g=JSON.stringify(l)}catch(t){g=JSON.stringify(l,o())}$.ajax({type:"POST",url:d,dataType:"html",data:g,headers:{"Content-Type":"application/json","X-AUTH-TOKEN":p,toJS:!0,timezone:moment().utcOffset()},success:a,error:n})},this.cronapi.util.getScreenFields=function(){var fields={};for(var key in this.cronapi.$scope)this.cronapi.$scope[key]&&this.cronapi.$scope[key].constructor&&"DataSet"==this.cronapi.$scope[key].constructor.name&&(fields[key]={},fields[key].active=this.cronapi.$scope[key].active);var scope=this.cronapi.$scope,recursiveLookup=function(scope){var fieldValue;try{fieldValue=eval(scope.vars)}catch(t){}if(fieldValue&&0!==Object.keys(fieldValue).length){var keys=Object.keys(fieldValue);keys.forEach(function(e){void 0!==fieldValue[e]&&null!==fieldValue[e]&&(!fields.vars&&(fields.vars={}),fields.vars[e]=fieldValue[e])})}else if(scope&&scope.$parent)return recursiveLookup(scope.$parent)};for(var key in recursiveLookup(scope),this.cronapi.$scope.params)this.cronapi.$scope.params[key]&&(fields.params||(fields.params={}),fields.params[key]=this.cronapi.$scope.params[key]);return fields},this.cronapi.util.makeCallServerBlocklyAsync=function(blocklyWithFunction,callbackSuccess,callbackError){var fields=this.cronapi.util.getScreenFields(),paramsApply=[];paramsApply.push(blocklyWithFunction),paramsApply.push(fields),paramsApply.push(function(data){var result=this.cronapi.evalInContext(data);"string"==typeof callbackSuccess?eval(callbackSuccess)(result):callbackSuccess&&callbackSuccess(result)}.bind(this)),paramsApply.push(function(data,status,errorThrown){var message=this.cronapi.internal.getErrorMessage(data.responseText,errorThrown);"string"==typeof callbackError?eval(callbackError)(message):callbackError?callbackError(message):this.cronapi.$scope.Notification.error(message)}.bind(this)),$(arguments).each(function(e){3<=e&&paramsApply.push(this)}),this.cronapi.util.callServerBlocklyAsync.apply(this,paramsApply)},this.cronapi.util.callServerBlocklyNoReturn=function(){this.cronapi.util.callServerBlockly.apply(this,arguments)},this.cronapi.util.throwException=function(e){throw e},this.cronapi.util.createException=function(e){return e},this.cronapi.util.language=function(){var e=(window.navigator.userLanguage||window.navigator.language||"pt_br").replace("-","_");return e},this.cronapi.util.share=function(e,t,a){return navigator.share({title:e,text:t,url:a}).then(()=>console.log("Successful share")).catch(e=>console.log("Error sharing:",e)),value},this.cronapi.util.callServerBlockly=function(e){const t=()=>{const e=new WeakSet;return(t,a)=>{if("object"==typeof a&&null!==a){if(e.has(a))return;e.add(a)}return a}};for(var a="api/cronapi/call/body/#classNameWithMethod#/".replace("#classNameWithMethod#",e),n=[],o=this.cronapi.util.getScreenFields(),r={fields:o,inputs:n},c=1;c<arguments.length;c++)n.push(arguments[c]);var s="";window.uToken&&(s=window.uToken);var p=this.cronapi.internal.getAddressWithHostApp(a);let l;try{l=JSON.stringify(r)}catch(a){l=JSON.stringify(r,t())}var d,g=$.ajax({type:"POST",url:p,dataType:"html",data:l,async:!1,headers:{"Content-Type":"application/json","X-AUTH-TOKEN":s,toJS:!0,timezone:moment().utcOffset()}});if(200==g.status)d=g.responseJSON?g.responseJSON:this.cronapi.evalInContext(g.responseText);else{var m=this.cronapi.internal.getErrorMessage(g.responseText,g.statusText);throw this.cronapi.$scope.Notification.error(m),m}return d},this.cronapi.util.callServerBlocklyAsynchronous=function(e,t,a){if(""!=e&&"function"==typeof t){var a=[e,t,t],n=2;for(n;n<arguments.length;n++)a.push(arguments[n]);this.cronapi.util.makeCallServerBlocklyAsync.apply(this,a)}},this.cronapi.util.executeJavascriptNoReturn=function(value){eval(value)},this.cronapi.util.downloadFile=function(e){var t=this.cronapi.internal.getAddressWithHostApp(e);this.cronapi.screen.openUrl(t,"_blank",0,0)},this.cronapi.util.executeJavascriptNoReturn=function(value){eval(value)},this.cronapi.util.executeJavascriptReturn=function(value){return eval(value)},this.cronapi.util.openReport=function(e){this.cronapi.$scope.getReport(e)},this.cronapi.util.getURLFromOthers=function(e,t,a,n,o,r,c){var s=Object.create(o);s["Content-Type"]=t,$.ajax({method:e,url:a,data:n,headers:s}).success(r.bind(this)).error(c.bind(this))},this.cronapi.util.getUserToken=function(){return JSON.parse(window.localStorage.getItem("_u")).token},this.cronapi.util.setSessionStorage=function(e,t){window.sessionStorage.setItem(e,t)},this.cronapi.util.getSessionStorage=function(e){return window.sessionStorage.getItem(e)},this.cronapi.util.setLocalStorage=function(e,t){window.localStorage.setItem(e,t)},this.cronapi.util.getLocalStorage=function(e){return window.localStorage.getItem(e)},this.cronapi.util.executeAsynchronous=function(e){setTimeout(e,0)},this.cronapi.util.scheduleExecution=function(e,t,a,n,o){o=o||!0,o="true"===o||!0===o;var r=1;"seconds"===n?r=1e3:"minutes"===n?r=6e4:"hours"==n&&(r=36e5),t*=r,a*=r;var c=-1,s=setTimeout(function(){e(),c=setInterval(e,a)}.bind(this),t);o&&this.$on("$destroy",function(){try{clearTimeout(s)}catch(t){}try{clearInterval(c)}catch(t){}})},this.cronapi.util.openReport=function(e,t,a){this.cronapi.$scope.getReport(e,t,a)},this.cronapi.util.getCEP=function(e,t){if(this.cronapi.logic.isNullOrEmpty(e))throw new Error("Informe o CEP");if(e=e.replace(/\.|\-/g,"").split(" ").join(""),8>e.length)throw new Error("CEP inv\xE1lido");let a="https://viacep.com.br/ws/"+e+"/json/?callback=?";$.getJSON(a,t.bind(this))},this.cronapi.screen={},this.cronapi.screen.isInsertingMode=function(e){return e.inserting},this.cronapi.screen.isEditingMode=function(e){return e.editing},this.cronapi.screen.changeTitleScreen=function(e){window.document.title=e},this.cronapi.screen.fieldFromScreen=function(e){return e},this.cronapi.screen.changeValueOfField=function(e,t){try{this.__tempValue=t;var a=new Function("this."+e+" = this.__tempValue;");this.safeApply(a.bind(this))}catch(t){}},this.cronapi.screen.getValueOfField=function(field){try{if(field&&0<field.length){if(-1<field.indexOf(".active."))return eval(field);var scope=eval("this"),recursiveLookup=function(scope){var fieldValue;try{fieldValue=eval("scope."+field)}catch(t){}return void 0!==fieldValue||null!==fieldValue?fieldValue:scope&&scope.$parent?recursiveLookup(scope.$parent):""};return recursiveLookup(scope)}return""}catch(t){alert(t)}},this.cronapi.screen.createScopeVariable=function(e,t){this.cronapi.$scope.vars[e]=t},this.cronapi.screen.getScopeVariable=function(e){return this.cronapi.$scope.vars[e]},this.cronapi.screen.notify=function(e,t){(null==t||t==null)&&(t=""),this.cronapi.$scope.Notification({message:t.toString()},e)},this.cronapi.screen.datasourceFromScreen=function(e){return e},this.cronapi.screen.startInsertingMode=function(e){getDatasource(e).$apply(function(){getDatasource(e).startInserting()})},this.cronapi.screen.startEditingMode=function(e){getDatasource(e).$apply(new function(){getDatasource(e).startEditing()})},this.cronapi.screen.previusRecord=function(e){getDatasource(e).$apply(new function(){getDatasource(e).previous()})},this.cronapi.screen.nextRecord=function(e){getDatasource(e).$apply(new function(){getDatasource(e).next()})},this.cronapi.screen.firstRecord=function(e){getDatasource(e).$apply(new function(){var t=getDatasource(e);t.cursor=-1,t.next()})},this.cronapi.screen.lastRecord=function(e){getDatasource(e).$apply(new function(){var t=getDatasource(e);t.cursor=t.data.length-2,t.next()})},this.cronapi.screen.removeRecord=function(e){getDatasource(e).$apply(new function(){getDatasource(e).removeSilent()})},this.cronapi.screen.refreshActiveRecord=function(e){getDatasource(e).refreshActive()},this.cronapi.screen.hasNextRecord=function(e){return getDatasource(e).hasNext()},this.cronapi.screen.quantityRecords=function(e){return getDatasource(e).data.length},this.cronapi.screen.post=function(e){return getDatasource(e).postSilent()},this.cronapi.screen.filter=function(e,t){getDatasource(e).isOData()?getDatasource(e).search(t):getDatasource(e).filter("/"+t)},this.cronapi.screen.changeView=function(view,params){try{function decodeCharParam(value){if(value)for(var param in paramsStopEncode){var regex=eval("/"+param+"/g");value=value.replace(regex,paramsStopEncode[param])}return value}var queryString="",paramsStopEncode={};if(paramsStopEncode["%24"]="$","undefined"!=typeof params)for(var i in Object.keys(params)){var k=Object.keys(params[i])[0],paramValue=Object.values(params[i])[0];paramValue instanceof Date&&(paramValue=paramValue.toISOString());var v=paramValue+"";queryString&&(queryString+="&"),queryString+=decodeCharParam(encodeURIComponent(k))+"="+encodeURIComponent(v)}let existRoute=e=>{if(this.cronapi.$scope&&this.cronapi.$scope.$state){let t=this.cronapi.$scope.$state.get(),a=e.split("/").slice(2),n="views/"+a.join("/")+".view.html";t.forEach(t=>{let a=t.templateUrl;if(a instanceof Function){let e=/('|")[a-z0-9/.]+('|")/gim.exec(a.toString());null!==e&&void 0!==e&&e[0]&&(a=e[0].replace(/'/g,""))}a===n&&(e="#"+t.url)})}return e};var oldHash=window.location.hash;view=existRoute(view),window.location.hash=view+(queryString?"?"+queryString:"");var oldHashToCheck=oldHash+(-1<oldHash.indexOf("?")?"":"?"),viewToCheck=view+(-1<view.indexOf("?")?"":"?");0<=oldHashToCheck.indexOf(viewToCheck)&&window.location.reload()}catch(t){alert(t)}},this.cronapi.screen.openUrl=function(e,t,a,n){try{var o="_self",r="";t&&"true"==t.toString().toLowerCase()&&(o="_blank"),a&&(r+="width="+a+","),n&&(r+="height="+n+","),window.open(e,o,r)}catch(t){alert(t)}},this.cronapi.screen.getParam=function(e){try{for(var t,a=[],n=window.location.href.slice(window.location.href.indexOf("?")+1).split("&"),o=0;o<n.length;o++)t=n[o].split("="),a.push(t[0]),a[t[0]]=t[1];if(a[e]!==void 0)return decodeURIComponent(a[e])}catch(t){}return null},this.cronapi.screen.confimDialog=function(e){var t=confirm(e);return t},this.cronapi.screen.createDefaultModal=function(e,t,a,n,o,r,c){$("#modalTemplateTitle").text(e),$("#modalTemplateBody").text(t),$("#modalTemplateCancel").text(a),$("#modalTemplateSave").text(n),$("#modalTemplateClose").unbind("click"),$("#modalTemplateClose").click(c),$("#modalTemplateCancel").unbind("click"),$("#modalTemplateCancel").click(r),$("#modalTemplateSave").unbind("click"),$("#modalTemplateSave").click(o),this.cronapi.screen.showModal("modalTemplate")},this.cronapi.screen.showModal=function(e){let t=`#${e}`,a=$(":focus"),n=$(":hover");try{$(t).one("shown.bs.modal",function(){a.length&&($(this).data("lastFocused",a),$(this).data("lastFocusedClass","."+a.attr("class").split(" ").join("."))),n.length&&$(this).data("lastHovers",n);let e=$(this).find("input:not(:hidden)")[0];e&&e.focus()}).one("hidden.bs.modal",function(){let e,a=$(t).data("lastFocused"),n=!1;a&&a.length&&(e=$($(this).data("lastFocusedClass")),n=$("html").has(a).length?a.is(":visible"):e.is(":visible"));let o=function(e){return $(e[e.length-1]).closest("li:visible").find("a:first")},r=$(t).data("lastHovers");if(n)e.focus(),a.focus();else if($("html").has(a).length){let e=o(a);e.focus()}else if(r&&r.length){let e=o(r);e.focus()}}).modal({backdrop:"static",keyboard:!1})}catch(a){$(t).show()}},this.cronapi.screen.setActiveTab=function(e){this.cronapi.$scope.safeApply(function(){$("#"+e).attr("data-target")===void 0?$("[data-target=\"#"+e+"\"]").tab("show"):$("#"+e).tab("show")})},this.cronapi.screen.hideModal=function(t){try{$("#"+t).modal("hide")}catch(a){$("#"+t).hide()}},this.cronapi.screen.showIonicModal=function(e){$("#"+e).data("cronapp-modal")&&$("#"+e).data("cronapp-modal").remove(),this.cronapi.$scope.$ionicModal.fromTemplateUrl(e,{scope:this.cronapi.$scope,animation:"slide-in-up"}).then(function(t){$("#"+e).data("cronapp-modal",t),t.show()})},this.cronapi.screen.hideIonicModal=function(e){if($("#"+e).data("cronapp-modal")){var t=$("#"+e).data("cronapp-modal");t.remove(),$("#"+e).data("cronapp-modal",null)}},this.cronapi.screen.isShownIonicModal=function(e){if($("#"+e).data("cronapp-modal")){var t=$("#"+e).data("cronapp-modal");return t.isShown()}return!1},this.cronapi.screen.showLoading=function(){this.cronapi.$scope.$ionicLoading.show({content:"Loading",animation:"fade-in",showBackdrop:!0,maxWidth:200,showDelay:0})},this.cronapi.screen.hide=function(){this.cronapi.$scope.$ionicLoading.hide()},this.cronapi.screen.getHostapp=function(){return window.hostApp},this.cronapi.screen.searchIds=function(){},this.cronapi.screen.showComponent=function(e){$("#"+e).get(0).style.setProperty("display","block","important")},this.cronapi.screen.hideComponent=function(e){$("#"+e).get(0).style.setProperty("display","none","important")},this.cronapi.screen.disableComponent=function(e){let t;if(window.cordova)t=this.cronapi.$scope;else{let e=window.angular.element("body").injector();t=e.get("$rootScope")}let a=()=>{"$apply"!==t.$$phase&&"$digest"!==t.$$phase?$("#"+e).data("kendoComboBox")?$("#"+e).data("kendoComboBox").enable(!1):$("#"+e).data("kendoDropDownList")?$("#"+e).data("kendoDropDownList").enable(!1):$.each($("#"+e).find("*").addBack(),function(e,t){$(t).prop("disabled",!0)}):setTimeout(()=>a(),200)};a()},this.cronapi.screen.enableComponent=function(e){let t;if(window.cordova)t=this.cronapi.$scope;else{let e=window.angular.element("body").injector();t=e.get("$rootScope")}let a=()=>{"$apply"!==t.$$phase&&"$digest"!==t.$$phase?$("#"+e).data("kendoComboBox")?$("#"+e).data("kendoComboBox").enable(!0):$("#"+e).data("kendoDropDownList")?$("#"+e).data("kendoDropDownList").enable(!0):$.each($("#"+e).find("*").addBack(),function(e,t){$(t).prop("disabled",!1)}):setTimeout(()=>a(),200)};a()},this.cronapi.screen.focusComponent=function(e){this.cronapi.$scope.safeApply(function(){tinyMCE&&tinyMCE.get(e)!==void 0?tinyMCE.get(e).focus():$("#"+e).find("*").addBack().focus()})},this.cronapi.screen.changeAttrValue=function(e,t,a){$("#"+e).attr(t,a)},this.cronapi.screen.changeContent=function(e,t,a){if($("#"+e).html(t),!0===a||"true"===a){var n=angular.injector(["ng"]),o=this;n.invoke(["$compile",function(t){t(document.querySelector("#"+e))(o.cronapi.$scope)}])}},this.cronapi.screen.logout=function(){this.cronapi.$scope.logout!=null&&this.cronapi.$scope.logout()},this.cronapi.screen.refreshDatasource=function(e,t){!0==t||"true"==t?this[e].search(this[e].terms,this[e].caseInsensitive):this[e].search("",this[e].caseInsensitive)},this.cronapi.screen.loadMore=function(e){getDatasource(e).$apply(function(){getDatasource(e).nextPage()})},this.cronapi.screen.hasNextPage=function(e){return getDatasource(e).hasNextPage()},this.cronapi.screen.load=function(e){getDatasource(e).fetch({params:{}},void 0,void 0,{origin:"button"})},this.cronapi.dateTime={},this.cronapi.dateTime.formats=function(){var e=[];return e="pt_br"==this.cronapi.$translate.use()?["DD/MM/YYYY HH:mm:ss","DD/MM/YYYY","DD-MM-YYYY HH:mm:ss","DD-MM-YYYY"]:["MM/DD/YYYY HH:mm:ss","MM/DD/YYYY","MM-DD-YYYY HH:mm:ss","MM-DD-YYYY"],e.push("YYYY-MM-DDTHH:mm:ss"),e.push("HH:mm:ss"),e.push("MMMM"),e},this.cronapi.dateTime.getMomentObj=function(e){var t=moment;if(e instanceof moment)return e;if(e instanceof Date)return t(e).utcOffset(window.timeZoneOffset);var a=this.cronapi.dateTime.formats(),n=null;for(var o in a)if(n=t(e,a[o]),n.isValid())break;return n},this.cronapi.dateTime.getSecond=function(e){var t=this.cronapi.dateTime.getMomentObj(e);return t?t.get("second"):0},this.cronapi.dateTime.getMinute=function(e){var t=this.cronapi.dateTime.getMomentObj(e);return t?t.get("minute"):0},this.cronapi.dateTime.getHour=function(e){var t=this.cronapi.dateTime.getMomentObj(e);return t?t.get("hour"):0},this.cronapi.dateTime.getYear=function(e){var t=this.cronapi.dateTime.getMomentObj(e);return t?t.get("year"):0},this.cronapi.dateTime.getMonth=function(e){var t=this.cronapi.dateTime.getMomentObj(e);return t?t.get("month")+1:0},this.cronapi.dateTime.getDay=function(e){var t=this.cronapi.dateTime.getMomentObj(e);return t?t.get("date"):0},this.cronapi.dateTime.getSecondsBetweenDates=function(e,t){var a=this.cronapi.dateTime.getMomentObj(e),n=this.cronapi.dateTime.getMomentObj(t);return a.diff(n,"seconds")},this.cronapi.dateTime.getMinutesBetweenDates=function(e,t){var a=this.cronapi.dateTime.getMomentObj(e),n=this.cronapi.dateTime.getMomentObj(t);return a.diff(n,"minutes")},this.cronapi.dateTime.getHoursBetweenDates=function(e,t){var a=this.cronapi.dateTime.getMomentObj(e),n=this.cronapi.dateTime.getMomentObj(t);return a.diff(n,"hours")},this.cronapi.dateTime.getDaysBetweenDates=function(e,t){var a=this.cronapi.dateTime.getMomentObj(e),n=this.cronapi.dateTime.getMomentObj(t);return a.diff(n,"days")},this.cronapi.dateTime.getMonthsBetweenDates=function(e,t){var a=this.cronapi.dateTime.getMomentObj(e),n=this.cronapi.dateTime.getMomentObj(t);return a.diff(n,"months")},this.cronapi.dateTime.getYearsBetweenDates=function(e,t){var a=this.cronapi.dateTime.getMomentObj(e),n=this.cronapi.dateTime.getMomentObj(t);return a.diff(n,"years")},this.cronapi.dateTime.incSecond=function(e,t){var a=this.cronapi.dateTime.getMomentObj(e);return a.add("seconds",t).toDate()},this.cronapi.dateTime.incMinute=function(e,t){var a=this.cronapi.dateTime.getMomentObj(e);return a.add("minutes",t).toDate()},this.cronapi.dateTime.incHour=function(e,t){var a=this.cronapi.dateTime.getMomentObj(e);return a.add("hours",t).toDate()},this.cronapi.dateTime.incDay=function(e,t){var a=this.cronapi.dateTime.getMomentObj(e);return a.add("days",t).toDate()},this.cronapi.dateTime.incMonth=function(e,t){var a=this.cronapi.dateTime.getMomentObj(e);return a.add("months",t).toDate()},this.cronapi.dateTime.incYear=function(e,t){var a=this.cronapi.dateTime.getMomentObj(e);return a.add("years",t).toDate()},this.cronapi.dateTime.getNow=function(){var e=moment();return e.toDate()},this.cronapi.dateTime.formatDateTime=function(e,t){return this.cronapi.dateTime.getMomentObj(e).format(t)},this.cronapi.dateTime.newDate=function(e,t,a,n,o,r){var c=new Date;return c.setYear(e),c.setMonth(t-1),c.setDate(a),c.setHours(n),c.setMinutes(o),c.setSeconds(r),this.cronapi.dateTime.getMomentObj(c).toDate()},this.cronapi.dateTime.updateDate=function(e,t,a,n,o,r,c,s){var p=this.cronapi.dateTime.getMomentObj(e).toDate();if(p&&!isNaN(p.getTime()))p.setYear(t),p.setMonth(a-1),p.setDate(n),p.setHours(o),p.setMinutes(r),p.setSeconds(c),p.setMilliseconds(s);else return void this.cronapi.screen.notify("error",this.cronapi.i18n.translate("InvalidDate",[]));return this.cronapi.dateTime.getMomentObj(p).toDate()},this.cronapi.dateTime.updateNewDate=function(e,t,a){var n=this.cronapi.dateTime.getMomentObj(e).toDate();if(n&&!isNaN(n.getTime()))"year"===t?n.setYear(a):"month"===t?n.setMonth(a-1):"day"===t?n.setDate(a):"hour"===t?n.setHours(a):"minute"===t?n.setMinutes(a):"second"===t?n.setSeconds(a):"millisecond"===t?n.setMilliseconds(a):void 0;else return void this.cronapi.screen.notify("error",this.cronapi.i18n.translate("InvalidDate",[]));return this.cronapi.dateTime.getMomentObj(n).toDate()},this.cronapi.text={},this.cronapi.text.prompt=function(){return null},this.cronapi.text.newline=function(){return"\n"},this.cronapi.text.replaceAll=function(e,t,a,n){return this.cronapi.logic.isNull(e)||this.cronapi.logic.isNull(t)||this.cronapi.logic.isNull(n)?null:"-"===a?e.replace(t,n):e.replace(new RegExp(t,a),n)},this.cronapi.xml={},this.cronapi.xml.newXMLEmpty=function(){return $.parseXML("<?xml version=\"1.0\" encoding=\"UTF-8\"?><root></root>")},this.cronapi.xml.newXMLEmptyWithRoot=function(e){var t=$.parseXML("<?xml version=\"1.0\" encoding=\"UTF-8\"?><root></root>");return t.removeChild(t.firstElementChild),t.appendChild(e),t},this.cronapi.xml.newXMLElement=function(e,t){var a=document.createElement(e);return a.textContent=t,a},this.cronapi.xml.addXMLElement=function(e,t){try{var a=t.cloneNode(!0);return e.appendChild(a),!0}catch(t){return!1}},this.cronapi.xml.XMLHasRootElement=function(e){return!!(e&&e.getRootNode())},this.cronapi.xml.XMLGetRootElement=function(e){return e instanceof XMLDocument?e.firstElementChild:e.getRootNode()},this.cronapi.xml.XMLDocumentToText=function(e){if(e instanceof XMLDocument)return $($($(e.firstElementChild).context.outerHTML).removeAttr("xmlns"))[0].outerHTML;if(1<$(e).size()){var t="";return $.each($(e).toArray(),function(e,a){t+=$($(a)[0].outerHTML).removeAttr("xmlns")[0].outerHTML}),t}return $($($(e).context.outerHTML).removeAttr("xmlns"))[0].outerHTML},this.cronapi.xml.getChildren=function(e,t){return e instanceof XMLDocument?e.firstElementChild.toArray:t?t.localName?$(e).find(t.localName).toArray():$(e).find(t).toArray():$(e).children().toArray()},this.cronapi.xml.setAttribute=function(e,t,a){return!!t&&(e instanceof XMLDocument?(e.firstChild.setAttribute(t,a),!0):!!e&&(e.setAttribute(t,a),!0))},this.cronapi.xml.getAttributeValue=function(e,t){return t?e instanceof XMLDocument?e.firstChild.getAttribute(t)?e.firstChild.getAttribute(t):"":e&&t?e.getAttribute(t):"":""},this.cronapi.xml.getParentNode=function(e){return e instanceof XMLDocument?e.firstChild:e.parentNode},this.cronapi.xml.setElementContent=function(e,t){e instanceof XMLDocument&&(e.firstChild.textContent=t),e.textContent=t},this.cronapi.xml.getElementContent=function(e){return e instanceof XMLDocument?e.firstChild.innerText:e.innerText},this.cronapi.xml.removeElement=function(e,t){e instanceof XMLDocument?t?t instanceof HTMLUnknownElement?t.remove():$.each($(e.firstElementChild.children),function(e,a){a.localName==t&&a.remove()}):$.each($(e.firstElementChild.children),function(e,t){t.remove()}):t?t instanceof HTMLUnknownElement?t.remove():$.each($(e.children),function(e,a){a.localName==t&&a.remove()}):$.each($(e.children),function(e,t){t.remove()})},this.cronapi.xml.getElementName=function(e){return e instanceof XMLDocument?e.firstChild.localName:e.localName},this.cronapi.xml.renameElement=function(e,t){var a=e.outerHTML.replace(e.localName,t);a=a.replace("/"+e.localName,"/"+t),a=$(a).removeAttr("xmlns"),e.replaceWith(a[0])},this.cronapi.logic={},this.cronapi.logic.isNull=function(e){return null===e||"undefined"==typeof e||e==null},this.cronapi.logic.isEmpty=function(e){return""===e},this.cronapi.logic.isNullOrEmpty=function(e){return this.cronapi.logic.isNull(e)||this.cronapi.logic.isEmpty(e)},this.cronapi.logic.typeOf=function(e,t){return"array"===t?Array.isArray(e):!("object"===t&&Array.isArray(e))&&typeof e==t},this.cronapi.i18n={},this.cronapi.i18n.translate=function(e,t){if(e){for(var a,n=this.cronapi.$translate.instant(e),o=0;o<t.length;o++)if(a=t[o],null!=a&&"undefined"!=typeof a){var r=new RegExp("\\{"+o+"\\}","g");n=n.replace(r,a)}return n}},this.cronapi.internal={},this.cronapi.internal.focusFormInput=function(){let e=$($("form")[0]),t=$(e.find("input")[0]);if(t&&t.length){let e=setInterval(()=>{t.is(":visible")&&(t.focus(),clearInterval(e))},100)}},this.cronapi.internal.setFile=function(e,t){this.cronapi.internal.fileToBase64(t,function(t){this.cronapi.screen.changeValueOfField(e,t)}.bind(this))},this.cronapi.internal.fileToBase64=function(e,t){var a=new FileReader;a.readAsDataURL(e),a.onload=function(a){var e=a.target.result.substr(a.target.result.indexOf("base64,")+7);t(e)}},this.cronapi.internal.startCamera=function(e,t,a,n,o){if(window.cordova&&window.cordova.platformId&&"browser"!==window.cordova.platformId){var r=this;navigator.camera.getPicture(function(t){r.cronapi.screen.changeValueOfField(e,t)},function(e){console.error(e),r.cronapi.$scope.Notification.error(message)},{quality:parseInt(t),destinationType:Camera.DestinationType.DATA_URL,encodingType:Camera.EncodingType.PNG,correctOrientation:!0,allowEdit:"true"==a,targetWidth:parseInt(n),targetHeight:parseInt(o)})}else{function t(e,t){var a=window.innerWidth,n=window.innerHeight,o=0;return o=a/e,t*=o,e*=o,e>a&&(o=a/e,t*=o,e*=o),t>n&&(o=n/t,e*=o,t*=o),{width:e,height:t}}var c="<div class=\"camera-container\" style=\"margin-left:-$marginleft$;margin-top:-$margintop$\"> <button class=\"btn btn-success button button-balanced\" id=\"cronapiVideoCaptureOk\" style=\"position: absolute; z-index: 999999999;\"> <span class=\"glyphicon glyphicon-ok icon ion-checkmark-round\"></span> <span class=\"sr-only\">{{\"Upload.camera\" | translate}}</span> </button> <button class=\"btn btn-danger button button-assertive button-cancel-capture\" id=\"cronapiVideoCaptureCancel\" style=\"position: absolute; margin-left: 42px; z-index: 999999999;\"> <span class=\"glyphicon glyphicon-remove icon ion-android-close\"></span> <span class=\"sr-only\">{{\"Cancel\" | translate}}</span> </button> <video id=\"cronapiVideoCapture\" style=\"height: $height$; width: $width$;\" autoplay=\"\"></video> </div>",s=null;navigator.mediaDevices&&navigator.mediaDevices.getUserMedia&&navigator.mediaDevices.getUserMedia({video:!0}).then(function(a){s=a;var n=t(a.getTracks()[0].getSettings().width,a.getTracks()[0].getSettings().height),o=n.width,r=n.height;try{o=parseInt(o/2),r=parseInt(r/2)}catch(t){}c=c.split("$height$").join(n.height+"px").split("$width$").join(n.width+"px").split("$marginleft$").join(o+"px").split("$margintop$").join(r+"px");var p=$(c);p.prependTo("body");var l=document.getElementById("cronapiVideoCapture");p.find("#cronapiVideoCaptureCancel").on("click",function(){null!=s&&0<s.getTracks().length&&s.getTracks()[0].stop(),$(p).remove()}.bind(this)),p.find("#cronapiVideoCaptureOk").on("click",function(){this.cronapi.internal.captureFromCamera(e,n.width,n.height),null!=s&&0<s.getTracks().length&&s.getTracks()[0].stop(),$(p).remove()}.bind(this)),l.srcObject=a,l.onloadedmetadata=function(){l.play()}}.bind(this))}},this.cronapi.internal.downloadFileEntityMobile=function(t,a,n,o){var r,c,s=null;if(n)r=t.data[n][a],c=t.data[n];else try{r=t.active[a],c=t.active}catch(n){r=t[a],c=t}try{var s=JSON.parse(r)}catch(t){}if(s){var p=this.cronapi.internal.getAddressWithHostApp("/api/cronapi/filePreview/");window.open(p+s.path,"_system")}else if(r.startsWith("https://")||r.startsWith("http://"))window.open(r,"_system");else if(t.isOData())cronapi.internal.makeDownloadFromBytes(r,o);else{var l="/api/cronapi/downloadFile",d=t.entity.split("/"),g=d[d.length-1];if(-1<g.indexOf(":")){for(var m="",u=d[3].split("."),h=0;h<u.length-1;h++)m+=u[h]+".";var e=g.split(":");g=m+e[e.length-1]}l+="/"+g,l+="/"+a;var f=c,b=t.getKeyValues(f),y=0;for(var v in b)l=0==y?l+"/"+f[v]:l+":"+f[v],y++;var p=this.cronapi.internal.getAddressWithHostApp(l);window.open(p,"_system")}},this.cronapi.internal.captureFromCamera=function(e,t,a){var n=document.createElement("canvas");n.width=t,n.height=a;var o=n.getContext("2d"),r=document.getElementById("cronapiVideoCapture");o.drawImage(r,0,0,t,a);var c=n.toDataURL().substr(22);this.cronapi.screen.changeValueOfField(e,c)},this.cronapi.internal.castBinaryStringToByteArray=function(e){for(var t=e.length,a=new Uint8Array(t),n=0;n<t;n++)a[n]=e.charCodeAt(n);return a},this.cronapi.internal.castBase64ToByteArray=function(e){var t=window.atob(e);return this.cronapi.internal.castBinaryStringToByteArray(t)},this.cronapi.internal.castByteArrayToString=function(e){return _StringfromCharCode.apply(null,new Uint16Array(e))},this.cronapi.internal.generatePreviewDescriptionByte=function(data,fileInfo){var json;let fileInfoContent=eval(fileInfo);try{json=fileInfoContent?JSON.parse(fileInfoContent):JSON.parse(data)}catch(e){try{json=JSON.parse(window.atob(data))}catch(e){if(data&&data.match(/__odataFile_/g)){var file=eval(data);json=cronapi.internal.getJsonDescriptionFromFile(file)}else if(data&&(data.startsWith("http://")||data.startsWith("https://"))){json={};var urlSplited=data.split("/"),fullName=urlSplited[urlSplited.length-1].replace("?dl=0",""),fullNameSplited=fullName.split("."),extension="."+fullNameSplited[fullNameSplited.length-1];json.fileExtension=extension,json.name=fullName.replace(extension,""),json.contentType="file/"+extension.replace(".","")}else if(data&&this.cronapi.internal.isBase64(data)){var fileName="download",fileExtesion=this.cronapi.internal.getExtensionBase64(data),contentType=this.cronapi.internal.getContentTypeFromExtension(fileExtesion);fileName+=fileExtesion,json={},json.fileExtension=fileExtesion,json.name=fileName,json.contentType=contentType}}}if(json){25<json.name.length&&(json.name=json.name.substr(0,22)+"...");var result=("pt_br"==this.cronapi.$translate.use()?"<b>Nome:</b> <br/>":"<b>Name:</b> <br/>")+(void 0===json.contentType?"":json.name+"<br/>");return result+=void 0===json.contentType?"":"<b>Content-Type:</b> <br/>"+json.contentType+"<br/>",result+=""===json.fileExtension?"":"pt_br"==this.cronapi.$translate.use()?"<b>Extens\xE3o:</b> <br/>"+json.fileExtension+"<br/>":"<b>Extension:</b> <br/>"+json.fileExtension+"<br/>",result}},this.cronapi.internal.getContentTypeFromExtension=function(e){if(e)switch(e.toLowerCase()){case".png":return"image/png";case".jpg":return"image/jpeg";case".mp4":return"video/mp4";case".pdf":return"application/pdf";case".ico":return"image/vnd.microsoft.icon";case".rar":return"application/x-rar-compressed";case".rtf":return"application/rtf";case".txt":return"text/plain";case".zip":return"application/zip";case".srt":return"text/srt";default:return"unknown";}},this.cronapi.internal.getExtensionBase64=function(e){if(e){var t=e.substr(0,5);switch(t.toLocaleUpperCase()){case"IVBOR":return".png";case"/9J/4":return".jpg";case"AAAAF":return".mp4";case"JVBER":return".pdf";case"AAABA":return".ico";case"UMFYI":return".rar";case"E1XYD":return".rtf";case"U1PKC":return".txt";case"UESDB":return".zip";case"MQOWM":case"77U/M":return".srt";default:return"";}}return""},this.cronapi.internal.isBase64=function(e){try{return btoa(atob(e))==e}catch(e){return!1}},this.cronapi.internal.downloadUrl=function(e,t){let a=document.createElement("a");a.setAttribute("href",e),a.setAttribute("download",t);let n=document.createEvent("MouseEvents");n.initMouseEvent("click",!0,!0,window,1,0,0,0,0,!1,!1,!1,!1,0,null),a.dispatchEvent(n)},this.cronapi.internal.makeDownloadFromBytes=function(valueContent,fileInfo){var bytesOrFileInput,urlCreator=window.URL||window.webkitURL||window.mozURL||window.msURL,fileName="download";if(valueContent.match(/__odataFile_/g))bytesOrFileInput=eval(valueContent),fileName=bytesOrFileInput.name;else{fileName+=cronapi.internal.getExtensionBase64(valueContent);try{valueContent=window.atob(valueContent)}catch(t){}bytesOrFileInput=cronapi.internal.castBinaryStringToByteArray(valueContent)}let fileInfoDescription=eval(fileInfo);if(fileInfoDescription){let e=JSON.parse(fileInfoDescription);fileName=e.name}var url=urlCreator.createObjectURL(new Blob([bytesOrFileInput],{type:"application/octet-stream"}));cronapi.internal.downloadUrl(url,fileName)},this.cronapi.internal.downloadFileEntity=function(t,a,n,o){var r,c,s=null;if(n)r=t.data[n][a],c=t.data[n];else try{r=t.active[a],c=t.active}catch(n){r=t[a],c=t}try{var s=JSON.parse(r)}catch(t){}if(s)window.open("/api/cronapi/filePreview/"+s.path);else if(r.startsWith("https://")||r.startsWith("http://"))window.open(r);else if(t.isOData())cronapi.internal.makeDownloadFromBytes(r,o);else{var p="/api/cronapi/downloadFile",l=t.entity.split("/"),d=l[l.length-1];if(-1<d.indexOf(":")){for(var g="",m=l[3].split("."),u=0;u<m.length-1;u++)g+=m[u]+".";var e=d.split(":");d=g+e[e.length-1]}p+="/"+d,p+="/"+a;var h=JSON.parse(localStorage.getItem("_u"))||{},f=c,b=this.cronapi.internal.getAddressWithHostApp(p);this.$promise=this.cronapi.$scope.$http({method:"POST",url:b,data:f?JSON.stringify(f):null,responseType:"blob",headers:{"Content-Type":"application/json","X-AUTH-TOKEN":h.token}}).success(function(e,t,a){a=a();var n=a["x-filename"]||"download.bin",o=window.URL||window.webkitURL||window.mozURL||window.msURL;try{var r=o.createObjectURL(e);cronapi.internal.downloadUrl(r,n)}catch(e){console.log("Error downloading file"),console.log(e)}}.bind(this)).error(function(){console.log("Error downloading file")}.bind(this))}},this.cronapi.internal.uploadFileAjax=function(e,t,a){var n=new FormData;n.append("file",t);var o=JSON.parse(localStorage.getItem("_u"))||{},r=this.cronapi.internal.getAddressWithHostApp("/api/cronapi/uploadFile");this.$promise=this.cronapi.$scope.$http({method:"POST",url:r,data:n,headers:{"Content-Type":void 0,"X-AUTH-TOKEN":o.token},onProgress:function(e){if(e.lengthComputable){var t=0|100*(e.loaded/e.total),n=$("#"+a);if(0<n.length)if("bootstrapProgress"==n.data("type"))100>t?(n.show(),n.find(".progress-bar").css("width",t+"%")):(n.hide(),n.find(".progress-bar").css("width","0%"));else{var o=document.getElementById(a);o.value=o.innerHTML=t}}}}).success(function(t){this.cronapi.screen.changeValueOfField(e,t.jsonString)}.bind(this)).error(function(){alert("Error uploading file")}.bind(this))},this.cronapi.internal.getFieldFromActiveString=function(e){var t=/.active.([a-zA-Z0-9_-]*)/g,a=t.exec(e),n=a[1];return n},this.cronapi.internal.getJsonDescriptionFromFile=function(e){let t={};if(e){let a=e.name.split("."),n="."+a[a.length-1];t.fileExtension=n,t.name=e.name,t.contentType=e.type||"unknown"}return t},this.cronapi.internal.uploadFile=function(field,file,progressId,fileInfo){if(file){var regexForDatasource=/(.*?).active./g,groupDatasource=regexForDatasource.exec(field);if(groupDatasource){var datasource=eval(groupDatasource[1]);if(datasource.isOData()){let e=cronapi.internal.getFieldFromActiveString(field),t=datasource.getFieldSchema(e);if(t&&"Binary"==t.type){if(datasource.active["__odataFile_"+e]=file,datasource.active[e]=datasource.name+".active.__odataFile_"+e,fileInfo){let e=cronapi.internal.getJsonDescriptionFromFile(file),t=cronapi.internal.getFieldFromActiveString(fileInfo);datasource.active[t]=JSON.stringify(e)}return}}}this.cronapi.internal.uploadFileAjax(field,file,progressId)}},this.cronapi.object={},this.cronapi.object.getProperty=function(e,t){var a=t.split(".");if(1<a.length){var n=function(e,t,a){return a||(a=0),void 0===e[t[a]]&&(e[t[a]]={}),a++,a<t.length?n(e[t[a-1]],t,a):e[t[a-1]]};return n(e,a,0)}return e[t]},this.cronapi.object.setProperty=function(e,t,a){var n=t.split(".");if(1<n.length){var o=function(e,t,a,n){n||(n=0),e[t[n]]===void 0&&(e[t[n]]={}),n++,n<t.length?o(e[t[n-1]],t,a,n):e[t[n-1]]=a};o(e,n,a,0)}else e[t]=a},this.cronapi.object.createObjectFromString=function(e){return JSON.parse(e)},this.cronapi.object.createObjectLoginFromString=function(e,t){return JSON.parse(JSON.stringify({username:e,password:t}))},this.cronapi.object.serializeObject=function(e){return JSON.stringify(e)},this.cronapi.object.deleteProperty=function(e,t){delete e[t]},this.cronapi.object.newObject=function(){var e={};if(arguments&&0<arguments.length)for(var t,a=0;a<arguments.length;a++)t=arguments[a],t.name&&(e[t.name]=t.value);return e},this.cronapi.object.getObjectField=function(e,t){var a;return e&&t&&(a=e[t]),a},this.cronapi.json={},this.cronapi.json.createObjectFromString=function(e){return this.cronapi.object.createObjectFromString(e)},this.cronapi.json.setProperty=function(e,t,a){this.cronapi.object.setProperty(e,t,a)},this.cronapi.json.deleteProperty=function(e,t){this.cronapi.object.deleteProperty(e,t)},this.cronapi.json.getProperty=function(e,t){return this.cronapi.object.getProperty(e,t)},this.cronapi.cordova={},this.cronapi.cordova.vibrate=function(e){navigator.vibrate(e)},this.cronapi.cordova.device={},this.cronapi.cordova.device.getFirebaseToken=function(e,t){document.addEventListener("deviceready",function(){try{window.FirebasePlugin.getToken(e,t)}catch(a){console.error(a),t(a)}},!1)},this.cronapi.cordova.device.getFirebaseNotificationData=function(e,t){document.addEventListener("deviceready",function(){try{window.FirebasePlugin.onMessageReceived(function(t){e(t)},function(e){t(e)})}catch(t){console.warn(t)}try{window.FirebasePlugin.onNotificationOpen(function(t){e(t)},function(e){t(e)})}catch(t){console.warn(t)}},!1)},this.cronapi.cordova.device.getDeviceInfo=function(e){return window.device[e]},this.cronapi.cordova.geolocation={},this.cronapi.cordova.geolocation.getCurrentPosition=function(e,t){navigator.geolocation.getCurrentPosition(e,t)},this.cronapi.cordova.geolocation.watchPosition=function(e,t,a,n,o){return navigator.geolocation.watchPosition(e,t,{maximumAge:a,timeout:n,enableHighAccuracy:o})},this.cronapi.cordova.geolocation.clearWatchPosition=function(e){navigator.geolocation.clearWatch(e)},this.cronapi.cordova.camera={},this.cronapi.cordova.camera.getPicture=function(e,t,a,n,o,r){(o===void 0||null===o)&&(o=0),r=!0===r||"true"===r,navigator.camera.getPicture(e,t,{destinationType:+a,sourceType:+n,mediaType:+o,allowEdit:r})},this.cronapi.cordova.camera.qrCodeScanner=function(e,t,a,n){cordova.plugins.barcodeScanner.scan(function(e){a(e.text)},function(e){"Scan is already in progress"!==e&&n(e)},{preferFrontCamera:!1,showFlipCameraButton:!0,showTorchButton:!0,saveHistory:!0,prompt:t,resultDisplayDuration:500,formats:e,orientation:"portrait",disableAnimations:!0,disableSuccessBeep:!1})},this.cronapi.cordova.file={},this.cronapi.cordova.file.getDirectory=function(e){var t;return"0"==e?t=cordova.file.dataDirectory:(t=cordova.file.externalApplicationStorageDirectory,!t&&(t=cordova.file.externalDataDirectory),!t&&(t=cordova.file.syncedDataDirectory)),t},this.cronapi.cordova.file.removeFile=function(e,t,a){window.resolveLocalFileSystemURL(e,function(e){e.remove(function(e){t&&t(e)}.bind(this),a)}.bind(this),a)},this.cronapi.cordova.file.readFile=function(e,t,a,n){window.resolveLocalFileSystemURL(e,function(e){e.file(function(e){var a=new FileReader;switch(a.onloadend=function(){t(this.result)},n){case"ARRAYBUFFER":{a.readAsArrayBuffer(e);break}case"TEXT":{a.readAsText(e);break}case"BINARYSTRING":{a.readAsBinaryString(e);break}case"DATAURL":{a.readAsDataURL(e);break}default:a.readAsText(e);}}.bind(this),a)}.bind(this),a)},this.cronapi.cordova.file.createFile=function(e,t,a,n,o){e||getDirectory(0);window.resolveLocalFileSystemURL(e,function(r){console.log(e),r.getFile(t,{create:!0},function(e){e.createWriter(function(e){e.onwriteend=function(){console.log("Write of file \""+t+"\"\" completed.")},e.onerror=function(t){console.log("Write failed: "+t.toString())};var o=new Blob([a],{type:"text/plain"});e.write(o),n&&setTimeout(function(){n()}.bind(this),500)}.bind(this),o)}.bind(this),o)}.bind(this),o)},this.cronapi.cordova.file.createDirectory=function(e,t,a,n){window.resolveLocalFileSystemURL(e,function(){parentEntry.getDirectory(t,{create:!0},function(e){a&&a(e)}.bind(this),n)}.bind(this),n)},this.cronapi.cordova.storage={},this.cronapi.cordova.storage.setStorageItem=function(e,t){var a=window.localStorage;a?a.setItem(e,t):console.error("Local Storage not Found!")},this.cronapi.cordova.storage.getStorageItem=function(e){var t=window.localStorage;return t?t.getItem(e):void console.error("Local Storage not Found!")},this.cronapi.cordova.storage.removeStorageItem=function(e){var t=window.localStorage;t?t.removeItem(e):console.error("Local Storage not Found!")},this.cronapi.cordova.connection={},this.cronapi.cordova.connection.getConnection=function(){return navigator.connection.type},this.cronapi.cordova.connection.verifyConnection=function(e){return navigator.connection.type==e},this.cronapi.cordova.database={},this.cronapi.cordova.database.nameDefault="cronappDB",this.cronapi.cordova.database.openDatabase=function(e){let t=window.openDatabase;return window.sqlitePlugin&&(t=window.sqlitePlugin.openDatabase),t(e?e:this.cronapi.cordova.database.nameDefault,"1.0",e?e:this.cronapi.cordova.database.nameDefault,1e6)},this.cronapi.cordova.database.executeSql=function(e,t,a,n,o){var r=this.cronapi.cordova.database.openDatabase(e);r.transaction(function(e){e.executeSql(t,a,function(e,t){n.call(this,Object.values(t.rows))}.bind(this))}.bind(this),function(t){console.log(t),o(t)}.bind(this))},this.cronapi.cordova.database.executeMultipleSql=function(e,t,a,n){var o=this.cronapi.cordova.database.openDatabase(e);let r=[],c=t.split(";");for(let s in c){let e=c[s];if(!e)break;let t=new Promise((t,a)=>{o.transaction(function(n){n.executeSql(e.trim(),[],function(e,a){t(a)}.bind(this),function(e,t){a(t)}.bind(this))}.bind(this))});r.push(t)}Promise.all(r).then(function(e){a(e)}.bind(this)).catch(function(t){n(t)}.bind(this))},this.cronapi.cordova.database.openInAppBrowser=function(e){cordova.InAppBrowser&&cordova.InAppBrowser.open(e,"_blank","location=no")},this.cronapi.internal.ptDate=function(e){var t,a=e[1],n=e[2],o=e[3],r=e[5],c=e[6],s=e[7];return t=r?new Date(o,n-1,a,r,c,s):new Date(o,n-1,a,0,0,0),t},this.cronapi.internal.enDate=function(e){var t,a=e[1],n=e[2],o=e[3],r=e[5],c=e[6],s=e[7];return t=r?new Date(o,a-1,n,r,c,s):new Date(o,a-1,n,0,0,0),t},this.cronapi.internal.parseBoolean=function(e){return!!e&&("boolean"==typeof e?e:(e=e.toString().toLowerCase().trim(),"1"==e||"true"==e))},this.cronapi.internal.removeAccents=function(e){var t="";for(i=0;i<e.length;i++)t+=0<="\xE1\xE0\xE3\xE2\xE4\xE9\xE8\xEA\xEB\xED\xEC\xEE\xEF\xF3\xF2\xF5\xF4\xF6\xFA\xF9\xFB\xFC\xE7\xC1\xC0\xC3\xC2\xC4\xC9\xC8\xCA\xCB\xCD\xCC\xCE\xCF\xD3\xD2\xD5\xD6\xD4\xDA\xD9\xDB\xDC\xC7".search(e.substr(i,1))?"aaaaaeeeeiiiiooooouuuucAAAAAEEEEIIIIOOOOOUUUUC".substr("\xE1\xE0\xE3\xE2\xE4\xE9\xE8\xEA\xEB\xED\xEC\xEE\xEF\xF3\xF2\xF5\xF4\xF6\xFA\xF9\xFB\xFC\xE7\xC1\xC0\xC3\xC2\xC4\xC9\xC8\xCA\xCB\xCD\xCC\xCE\xCF\xD3\xD2\xD5\xD6\xD4\xDA\xD9\xDB\xDC\xC7".search(e.substr(i,1)),1):e.substr(i,1);return t},this.cronapi.internal.arrayRemove=function(e,t){var a=this.cronapi.internal.arrayIndexOf(e,t);-1!=a&&e.splice(a,1)},this.cronapi.internal.arrayIndexOf=function(e,t){var a=-1;return $(e).each(function(e){t==this&&(a=e)}),a},this.cronapi.internal.replaceAll=function(e,t,a){return e.toString().split(t).join(a)},this.cronapi.internal.getWindowHeight=function(){$(window).height()},this.cronapi.internal.getWindowWidth=function(){$(window).width()},this.cronapi.internal.getAddressWithHostApp=function(e){var t=window.hostApp||"";if(t=t.endsWith("/")?t.substr(0,t.length-1):t,e){var a=e.startsWith("/")?e.substr(1):e;t=""===t?a:t+"/"+a}return t},this.cronapi.internal.Url={encode:function(e){return e?escape(this.cronapi.internal.Url._utf8_encode(e)):""},decode:function(e){return e?this.cronapi.internal.Url._utf8_decode(unescape(e)):""},_utf8_encode:function(e){e=e.replace(/\r\n/g,"\n");for(var t,a="",o=0;o<e.length;o++)t=e.charCodeAt(o),128>t?a+=_StringfromCharCode(t):127<t&&2048>t?(a+=_StringfromCharCode(192|t>>6),a+=_StringfromCharCode(128|63&t)):(a+=_StringfromCharCode(224|t>>12),a+=_StringfromCharCode(128|63&t>>6),a+=_StringfromCharCode(128|63&t));return a},_utf8_decode:function(e){for(var t="",a=0,n=c1=c2=0;a<e.length;)n=e.charCodeAt(a),128>n?(t+=_StringfromCharCode(n),a++):191<n&&224>n?(c2=e.charCodeAt(a+1),t+=_StringfromCharCode((31&n)<<6|63&c2),a+=2):(c2=e.charCodeAt(a+1),c3=e.charCodeAt(a+2),t+=_StringfromCharCode((15&n)<<12|(63&c2)<<6|63&c3),a+=3);return t}},this.cronapi.internal.stringToJs=function(e){return(e+"").replace(/[\\"']/g,"\\$&").replace(/\u0000/g,"\\0")},this.cronapi.internal.getErrorMessage=function(e,t){try{var a=null;if("object"==typeof e?e.data&&("object"==typeof e.data?a=e.data:"string"==typeof e.data&&(a=JSON.parse(e.data))):"string"==typeof e&&(a=JSON.parse(e)),a&&a.error)return a.error}catch(t){}return t},this.cronapi.util.upload=function(e,t,a,n,o){this.UploadService.upload({description:t,id:e,filter:a,maxSize:n,multiple:o,scope:this})},this.cronapi.util.getBaseUrl=function(){return window.location.origin},this.cronapi.chart={},this.cronapi.chart.createChart=function(e,t,a,n){function o(){return l<p.length?l++:l=0,l}function r(){""==g.data.datasets[0].label&&(null==g.options.legend?(g.options.legend={},g.options.legend.display=!1):g.options.legend.display=!1)}function c(e){var t=[],a=4;for(Array.isArray(e[4])&&"object"==typeof e[4][0]&&("label"in e[4][0])&&("data"in e[4][0])&&(e=e[4],a=0),a;a<e.length;a++)e[a].label?e[a].options?(e[a].data?t.push(cronapi.chart.createDataset(e[a].label,e[a].data,e[a].options)):t.push(cronapi.chart.createDataset(e[a].label,e[a],null)),t.push(cronapi.chart.createDataset(e[a].label,e[a].data,e[a].options))):t.push(cronapi.chart.createDataset(e[a].label,e[a].data,null)):e[a].options?(e[a].data?t.push(cronapi.chart.createDataset(null,e[a].data,e[a].options)):t.push(cronapi.chart.createDataset(null,e[a],e[a].options)),t.push(cronapi.chart.createDataset(null,e[a].data,e[a].options))):e[a].data?t.push(cronapi.chart.createDataset(null,e[a].data,null)):t.push(cronapi.chart.createDataset(null,e[a],null));return t}function s(){null==g.options?(g.options={},g.options.scales={},g.options.scales.yAxes=[{ticks:{beginAtZero:!0}}]):null==g.options.scales&&(g.options.scales={},g.options.scales.yAxes=[{ticks:{beginAtZero:!0}}])}var p=["#FF5C00","#0E53A7","#48DD00","#FFD500","#7309AA","#CD0074","#00AF64","#BF8230","#F16D95","#A65000","#A65000","#AF66D5"],l=0,d=document.getElementById(e);d._chart&&d._chart.destroy(),d.getContext("2d");var g={};if(g.type=t,g.data=[],g.options={},g.data.labels=Array.isArray(a)?a:JSON.parse(a),g.data.datasets=[],Array.isArray(n))g.options=n;else if(""!=n&&null!=n)try{g.options=JSON.parse(n)}catch(t){g.options={},console.log(t)}else g.options={};switch(t){case"line":{g.data.datasets=c(arguments),$.each(g.data.datasets,function(e,t){t.fill=!1,t.backgroundColor=p[o()],t.borderColor=t.backgroundColor,s(),r()});break}case"bar":case"horizontalBar":{g.data.datasets=c(arguments),$.each(g.data.datasets,function(e,t){t.backgroundColor=p[o()],t.borderColor=t.backgroundColor}),s(),r();break}case"doughnut":case"pie":case"polarArea":{var m=c(arguments);$.each(m,function(e){var t={};t=m[e],t.backgroundColor=[],t.borderColor=[],$.each(t.data,function(){t.backgroundColor.push(p[o()])}),t.borderColor=t.backgroundColor,g.data.datasets.push(t),l=0});break}default:}var u=new Chart(d,g);d._chart=u},this.cronapi.chart.createDataset=function(e,t,a){var n={};return n.label=e?e:"",n.data=Array.isArray(t)?t:t?JSON.parse(t):[],n.options=Array.isArray(a)?a:JSON.parse(a),n},this.cronapi.social={},this.cronapi.social.gup=function(e,t){t||(t=location.href),e=e.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var a="[\\?&]"+e+"=([^&#]*)",n=new RegExp(a),o=n.exec(t);return null==o?null:o[1]},this.cronapi.social.login=function(e,t,a){var n;this.cronapi.screen.showLoading(),this.cronapi.logic.isNullOrEmpty(this.cronapi.screen.getHostapp())?(this.cronapi.screen.hide(),this.cronapi.screen.notify("error","HostApp is Required")):this.cronapi.util.getURLFromOthers("POST","application/x-www-form-urlencoded",this.cronapi.screen.getHostapp()+""+"auth",this.cronapi.object.createObjectFromString(["{ \"username\": \"",e,"\" , \"password\": \"",t,"\" } "].join("")),this.cronapi.object.createObjectFromString(["{ \"X-AUTH-TOKEN\": \"",a,"\" } "].join("")),function(e){n=e,this.cronapi.screen.hide(),this.cronapi.util.setLocalStorage("_u",this.cronapi.object.serializeObject(n)),this.cronapi.screen.changeView("#/app/logged/home",[])}.bind(this),function(e){n=e,"403"==this.cronapi.object.getProperty(n,"status")||"401"==this.cronapi.object.getProperty(n,"status")?this.cronapi.screen.notify("error",this.cronapi.i18n.translate("LoginViewInvalidpassword",[])):this.cronapi.screen.notify("error",this.cronapi.object.getProperty(n,"responseJSON.message")),this.cronapi.screen.hide()}.bind(this))},this.cronapi.social.sociaLogin=function(e,t){var a=this,n=window.hostApp+"signin/"+e+"/";if(window.cordova&&cordova.InAppBrowser){var o="";(!0===t||"true"===t)&&(o=",clearcache=yes");var r=cordova.InAppBrowser.open(n,"_blank","location=no"+o);r.addEventListener("loadstart",function(e){-1<e.url.indexOf("_ctk")&&(r.close(),a.cronapi.social.login.bind(a)("#OAUTH#","#OAUTH#",a.cronapi.social.gup("_ctk",e.url)))})}else window.location.href="signin/"+e+"/"},this.cronapi.screen.getSelectedRowsGrid=function(e){var t=[],a=$("[ng-model=\""+e+"\"]").children().data("kendoGrid");if(a){var n=a.select();n.each(function(){var e=a.dataItem(this);t.push(e)})}return t},this.cronapi.screen.back=function(){history.back()},this.cronapi.regex={},this.cronapi.regex.extractTextByRegex=function(e,t,a){if(this.cronapi.logic.isNull(e)||this.cronapi.logic.isNull(t))return[];let n=null;n=null!=a&&"-"!==a?new RegExp(t,a):new RegExp(t);let o,r=[],c=null;for(;(o=n.exec(e))&&!(null!=c&&c==o.index);){let e=[];for(i=1;i<o.length;i++)e.push(o[i]);c=o.index,r.push(e)}return r},this.cronapi.regex.validateTextWithRegex=function(e,t,a){return!(this.cronapi.logic.isNull(e)||this.cronapi.logic.isNull(t))&&(null!=a&&"-"!==a?new RegExp(t,a).test(e):new RegExp(t).test(e))},this.cronapi.chat={},this.cronapi.chat.chatUserObj=function(e,t,a){return{id:e,name:t,iconUrl:a}},this.cronapi.chat.chatAttachmentObj=function(e,t,a,n,o,r){return{contentType:"heroCard",content:{title:e,subtitle:t,text:a,images:[{url:n,alt:r}],buttons:Array.isArray(o)?o:[o]}}},this.cronapi.chat.chatSuggestedActionObj=function(e,t){return{title:e,value:t}},this.cronapi.chat.getChatUser=function(e){let t=$("#"+e+" .k-chat").data("kendoChat");return t.getUser()},this.cronapi.chat.postChatMessage=function(e,t){let a=$("#"+e+" .k-chat").data("kendoChat");a.postMessage(t)},this.cronapi.chat.renderChatMessage=function(e,t,a){let n=$("#"+e+" .k-chat").data("kendoChat");n.renderMessage({type:"text",text:t},a)},this.cronapi.chat.renderChatAttachments=function(e,t,a,n){let o=$("#"+e+" .k-chat").data("kendoChat");o.renderAttachments({attachments:Array.isArray(a)?a:[a],attachmentLayout:n},t)},this.cronapi.chat.renderChatSuggestedActions=function(e,t){let a=$("#"+e+" .k-chat").data("kendoChat");a.renderSuggestedActions(Array.isArray(t)?t:[t])},this.cronapi.chat.renderChatUserTypingIndicator=function(e,t){let a=$("#"+e+" .k-chat").data("kendoChat");a.renderUserTypingIndicator(t)},this.cronapi.chat.clearChatUserTypingIndicator=function(e,t){let a=$("#"+e+" .k-chat").data("kendoChat");a.clearUserTypingIndicator(t)},this.cronapi.chat.removeChatTypingIndicator=function(e){let t=$("#"+e+" .k-chat").data("kendoChat");t.removeTypingIndicator()}}.bind(window)();
(window.fixedTimeZone===void 0||null===window.fixedTimeZone)&&(window.fixedTimeZone=!0),(window.timeZone===void 0||null===window.timeZone)&&(window.timeZone="UTC"),(window.timeZoneOffset===void 0||null===window.timeZoneOffset)&&(window.timeZoneOffset=0),window.systemTimeZoneOffset=window.timeZoneOffset,window.fixedTimeZone||(window.timeZoneOffset=moment().utcOffset()),function(){'use strict';var _StringfromCharCode=String.fromCharCode;this.$evt=function(e){var t=this;t.$eval||(t=angular.element(event.target).scope()),t.$eval(e)}.bind(this),this.cronapi={},this.cronapi.toDate=function(e){return new Date(e)};var getDatasource=function(e){return"string"==typeof e?window[e]:e};this.cronapi.doEval=function(e){return e},this.cronapi.evalInContext=function(js){var result=eval("this.cronapi.doEval("+js+")");if(result){if(result.commands)for(var func,i=0;i<result.commands.length;i++)func=eval(result.commands[i].function),func.apply(this,result.commands[i].params);return result.value}},this.cronapi.client=function(pack){return{attr:function(){return this},run:function(){var bk;try{bk=eval("blockly."+pack)}catch(t){}return bk||(bk=eval(pack)),bk.apply(this,arguments)}.bind(this)}};var serverMap={};this.cronapi.server=function(e){var t=!1,a=!1,n=!0;return{attr:function(){return t=!0,this},toPromise:function(){return a=!0,this},notAsync:function(){return n=!1,this},run:function(){for(var o=e,r=0;r<arguments.length;r++)o+=arguments[r]+"";if(t){if(serverMap.hasOwnProperty(o))return"$$loading"==serverMap[o]?"":serverMap[o];serverMap[o]="$$loading"}var c=e.split("."),s=c[c.length-1];c.pop();var p,l,d=c.join("."),g=new Promise((e,t)=>{p=e,l=t}),m=function(e){this.safeApply(function(){t&&(serverMap[o]=e),p(e)})}.bind(this),u=function(e){this.safeApply(function(){t&&(serverMap[o]=e),l(e)}),e&&this.cronapi.$scope.Notification.error(e)}.bind(this),h=[d+":"+s];if(n){h.push(m),h.push(u);for(var r=0;r<arguments.length;r++)h.push(arguments[r]);if(this.cronapi.util.makeCallServerBlocklyAsync.apply(this,h),a)return g}else{for(var r=0;r<arguments.length;r++)h.push(arguments[r]);let e=this.cronapi.util.callServerBlockly.apply(this,h);return t&&(serverMap[o]=e),e}}.bind(this)}},this.cronapi.callFunction=function(name){return{call:function(){var ref;try{ref=eval(name)}catch(t){}return ref?ref.apply(this,arguments):void 0}.bind(this)}},this.cronapi.conversion={},this.cronapi.conversion.asciiToBinary=function(e){var t="";if(0<e.length)for(var a,n=0;n<e.length;n++){a=e.charCodeAt(n);for(var o=7;0<=o;o--)t+=1&a>>o}return t},this.cronapi.conversion.toBoolean=function(e){return this.cronapi.internal.parseBoolean(e)},this.cronapi.conversion.toBytes=function(e){return e?e.toString():""},this.cronapi.conversion.chrToAscii=function(e){return e?e.charCodeAt(0):null},this.cronapi.conversion.stringToJs=function(e){return this.cronapi.internal.stringToJs(e)},this.cronapi.conversion.stringToDate=function(value){var pattern=/^\s*(\d+)[\/\.-](\d+)[\/\.-](\d+)(\s(\d+):(\d+):(\d+))?\s*$/;if(value){if(value instanceof Date)return value;if(pattern.test(value)){var splited=pattern.exec(value),userLang=(navigator.language||navigator.userLanguage).split("-")[0];if("pt"==userLang||"en"==userLang){var functionToCall=eval("cronapi.internal."+userLang+"Date");return functionToCall(splited)}return new Date(value)}return new Date(value)}return null},this.cronapi.conversion.intToHex=function(e){return(+e).toString(16).toUpperCase()},this.cronapi.conversion.toLong=function(e){return parseInt(e)},this.cronapi.conversion.toString=function(e){if(e){var t=new String(e);return t.toString()}return""},this.cronapi.util={},this.cronapi.util.getApplicationName=function(){return $("#projectName").length?$("#projectName").val():$("h1:first").length&&$("h1:first").text().trim().length?$("h1:first").text().trim():""},this.cronapi.util.createPromise=function(){var e,t,a=new Promise((a,n)=>{e=a,t=n});return a.__functionToResolve=e,a.__functionToReject=t,a},this.cronapi.util.handleValueToPromise=function(e,t,a){"resolve"===e?t.__functionToResolve(a):t.__functionToReject(a)},this.cronapi.util.callServerBlocklyAsync=function(e,t,a,n){const o=()=>{const e=new WeakSet;return(t,a)=>{if("object"==typeof a&&null!==a){if(e.has(a))return;e.add(a)}return a}};var r="api/cronapi/call/body/#classNameWithMethod#/".replace("#classNameWithMethod#",e),c=this.cronapi.$scope.http,s=[];$(arguments).each(function(){s.push(this)});var p="";window.uToken&&(p=window.uToken);var l={fields:t,inputs:s.slice(4)},d=this.cronapi.internal.getAddressWithHostApp(r);let g;try{g=JSON.stringify(l)}catch(t){g=JSON.stringify(l,o())}$.ajax({type:"POST",url:d,dataType:"html",data:g,headers:{"Content-Type":"application/json","X-AUTH-TOKEN":p,toJS:!0,timezone:moment().utcOffset()},success:a,error:n})},this.cronapi.util.getScreenFields=function(){var fields={};for(var key in this.cronapi.$scope)this.cronapi.$scope[key]&&this.cronapi.$scope[key].constructor&&"DataSet"==this.cronapi.$scope[key].constructor.name&&(fields[key]={},fields[key].active=this.cronapi.$scope[key].active);var scope=this.cronapi.$scope,recursiveLookup=function(scope){var fieldValue;try{fieldValue=eval(scope.vars)}catch(t){}if(fieldValue&&0!==Object.keys(fieldValue).length){var keys=Object.keys(fieldValue);keys.forEach(function(e){void 0!==fieldValue[e]&&null!==fieldValue[e]&&(!fields.vars&&(fields.vars={}),fields.vars[e]=fieldValue[e])})}else if(scope&&scope.$parent)return recursiveLookup(scope.$parent)};for(var key in recursiveLookup(scope),this.cronapi.$scope.params)this.cronapi.$scope.params[key]&&(fields.params||(fields.params={}),fields.params[key]=this.cronapi.$scope.params[key]);return fields},this.cronapi.util.makeCallServerBlocklyAsync=function(blocklyWithFunction,callbackSuccess,callbackError){var fields=this.cronapi.util.getScreenFields(),paramsApply=[];paramsApply.push(blocklyWithFunction),paramsApply.push(fields),paramsApply.push(function(data){var result=this.cronapi.evalInContext(data);"string"==typeof callbackSuccess?eval(callbackSuccess)(result):callbackSuccess&&callbackSuccess(result)}.bind(this)),paramsApply.push(function(data,status,errorThrown){var message=this.cronapi.internal.getErrorMessage(data.responseText,errorThrown);"string"==typeof callbackError?eval(callbackError)(message):callbackError?callbackError(message):this.cronapi.$scope.Notification.error(message)}.bind(this)),$(arguments).each(function(e){3<=e&&paramsApply.push(this)}),this.cronapi.util.callServerBlocklyAsync.apply(this,paramsApply)},this.cronapi.util.callServerBlocklyNoReturn=function(){this.cronapi.util.callServerBlockly.apply(this,arguments)},this.cronapi.util.throwException=function(e){throw e},this.cronapi.util.createException=function(e){return e},this.cronapi.util.language=function(){var e=(window.navigator.userLanguage||window.navigator.language||"pt_br").replace("-","_");return e},this.cronapi.util.share=function(e,t,a){return navigator.share({title:e,text:t,url:a}).then(()=>console.log("Successful share")).catch(e=>console.log("Error sharing:",e)),value},this.cronapi.util.callServerBlockly=function(e){const t=()=>{const e=new WeakSet;return(t,a)=>{if("object"==typeof a&&null!==a){if(e.has(a))return;e.add(a)}return a}};for(var a="api/cronapi/call/body/#classNameWithMethod#/".replace("#classNameWithMethod#",e),n=[],o=this.cronapi.util.getScreenFields(),r={fields:o,inputs:n},c=1;c<arguments.length;c++)n.push(arguments[c]);var s="";window.uToken&&(s=window.uToken);var p=this.cronapi.internal.getAddressWithHostApp(a);let l;try{l=JSON.stringify(r)}catch(a){l=JSON.stringify(r,t())}var d,g=$.ajax({type:"POST",url:p,dataType:"html",data:l,async:!1,headers:{"Content-Type":"application/json","X-AUTH-TOKEN":s,toJS:!0,timezone:moment().utcOffset()}});if(200==g.status)d=g.responseJSON?g.responseJSON:this.cronapi.evalInContext(g.responseText);else{var m=this.cronapi.internal.getErrorMessage(g.responseText,g.statusText);throw this.cronapi.$scope.Notification.error(m),m}return d},this.cronapi.util.callServerBlocklyAsynchronous=function(e,t,a){if(""!=e&&"function"==typeof t){var a=[e,t,t],n=2;for(n;n<arguments.length;n++)a.push(arguments[n]);this.cronapi.util.makeCallServerBlocklyAsync.apply(this,a)}},this.cronapi.util.executeJavascriptNoReturn=function(value){eval(value)},this.cronapi.util.downloadFile=function(e){var t=this.cronapi.internal.getAddressWithHostApp(e);this.cronapi.screen.openUrl(t,"_blank",0,0)},this.cronapi.util.executeJavascriptNoReturn=function(value){eval(value)},this.cronapi.util.executeJavascriptReturn=function(value){return eval(value)},this.cronapi.util.openReport=function(e){this.cronapi.$scope.getReport(e)},this.cronapi.util.getURLFromOthers=function(e,t,a,n,o,r,c){if(n&&"application/x-www-form-urlencoded"===t){for(var s in n)if(n[s]instanceof Array){var p=n[s].toString();n[s]=`[${p}]`}}else n&&"application/json"===t&&(n=JSON.stringify(n));var l=Object.create(o);l["Content-Type"]=t,$.ajax({method:e,url:a,data:n,headers:l}).success(r.bind(this)).error(c.bind(this))},this.cronapi.util.getUserToken=function(){return JSON.parse(window.localStorage.getItem("_u")).token},this.cronapi.util.setSessionStorage=function(e,t){window.sessionStorage.setItem(e,t)},this.cronapi.util.getSessionStorage=function(e){return window.sessionStorage.getItem(e)},this.cronapi.util.setLocalStorage=function(e,t){window.localStorage.setItem(e,t)},this.cronapi.util.getLocalStorage=function(e){return window.localStorage.getItem(e)},this.cronapi.util.executeAsynchronous=function(e){setTimeout(e,0)},this.cronapi.util.scheduleExecution=function(e,t,a,n,o){o=o||!0,o="true"===o||!0===o;var r=1;"seconds"===n?r=1e3:"minutes"===n?r=6e4:"hours"==n&&(r=36e5),t*=r,a*=r;var c=-1,s=setTimeout(function(){e(),c=setInterval(e,a)}.bind(this),t);o&&this.$on("$destroy",function(){try{clearTimeout(s)}catch(t){}try{clearInterval(c)}catch(t){}})},this.cronapi.util.openReport=function(e,t,a){this.cronapi.$scope.getReport(e,t,a)},this.cronapi.util.getCEP=function(e,t){if(this.cronapi.logic.isNullOrEmpty(e))throw new Error("Informe o CEP");if(e=e.replace(/\.|\-/g,"").split(" ").join(""),8>e.length)throw new Error("CEP inv\xE1lido");let a="https://viacep.com.br/ws/"+e+"/json/?callback=?";$.getJSON(a,t.bind(this))},this.cronapi.screen={},this.cronapi.screen.isInsertingMode=function(e){return e.inserting},this.cronapi.screen.isEditingMode=function(e){return e.editing},this.cronapi.screen.changeTitleScreen=function(e){window.document.title=e},this.cronapi.screen.fieldFromScreen=function(e){return e},this.cronapi.screen.changeValueOfField=function(e,t){try{this.__tempValue=t;var a=new Function("this."+e+" = this.__tempValue;");this.safeApply(a.bind(this))}catch(t){}},this.cronapi.screen.getValueOfField=function(field){try{if(field&&0<field.length){if(-1<field.indexOf(".active."))return eval(field);var scope=eval("this"),recursiveLookup=function(scope){var fieldValue;try{fieldValue=eval("scope."+field)}catch(t){}return void 0!==fieldValue||null!==fieldValue?fieldValue:scope&&scope.$parent?recursiveLookup(scope.$parent):""};return recursiveLookup(scope)}return""}catch(t){alert(t)}},this.cronapi.screen.createScopeVariable=function(e,t){this.cronapi.$scope.vars[e]=t},this.cronapi.screen.getScopeVariable=function(e){return this.cronapi.$scope.vars[e]},this.cronapi.screen.notify=function(e,t){(null==t||t==null)&&(t=""),this.cronapi.$scope.Notification({message:t.toString()},e)},this.cronapi.screen.datasourceFromScreen=function(e){return e},this.cronapi.screen.startInsertingMode=function(e){getDatasource(e).$apply(function(){getDatasource(e).startInserting()})},this.cronapi.screen.startEditingMode=function(e){getDatasource(e).$apply(new function(){getDatasource(e).startEditing()})},this.cronapi.screen.previusRecord=function(e){getDatasource(e).$apply(new function(){getDatasource(e).previous()})},this.cronapi.screen.nextRecord=function(e){getDatasource(e).$apply(new function(){getDatasource(e).next()})},this.cronapi.screen.firstRecord=function(e){getDatasource(e).$apply(new function(){var t=getDatasource(e);t.cursor=-1,t.next()})},this.cronapi.screen.lastRecord=function(e){getDatasource(e).$apply(new function(){var t=getDatasource(e);t.cursor=t.data.length-2,t.next()})},this.cronapi.screen.removeRecord=function(e){getDatasource(e).$apply(new function(){getDatasource(e).removeSilent()})},this.cronapi.screen.refreshActiveRecord=function(e){getDatasource(e).refreshActive()},this.cronapi.screen.hasNextRecord=function(e){return getDatasource(e).hasNext()},this.cronapi.screen.quantityRecords=function(e){return getDatasource(e).data.length},this.cronapi.screen.post=function(e){return getDatasource(e).postSilent()},this.cronapi.screen.filter=function(e,t){getDatasource(e).isOData()?getDatasource(e).search(t):getDatasource(e).filter("/"+t)},this.cronapi.screen.changeView=function(view,params){try{function decodeCharParam(value){if(value)for(var param in paramsStopEncode){var regex=eval("/"+param+"/g");value=value.replace(regex,paramsStopEncode[param])}return value}var queryString="",paramsStopEncode={};if(paramsStopEncode["%24"]="$","undefined"!=typeof params)for(var i in Object.keys(params)){var k=Object.keys(params[i])[0],paramValue=Object.values(params[i])[0];paramValue instanceof Date&&(paramValue=paramValue.toISOString());var v=paramValue+"";queryString&&(queryString+="&"),queryString+=decodeCharParam(encodeURIComponent(k))+"="+encodeURIComponent(v)}let existRoute=e=>{if(this.cronapi.$scope&&this.cronapi.$scope.$state){let t=this.cronapi.$scope.$state.get(),a=e.split("/").slice(2),n="views/"+a.join("/")+".view.html";t.forEach(t=>{let a=t.templateUrl;if(a instanceof Function){let e=/('|")[a-z0-9/.]+('|")/gim.exec(a.toString());null!==e&&void 0!==e&&e[0]&&(a=e[0].replace(/'/g,""))}a===n&&(e="#"+t.url)})}return e};var oldHash=window.location.hash;view=existRoute(view),window.location.hash=view+(queryString?"?"+queryString:"");var oldHashToCheck=oldHash+(-1<oldHash.indexOf("?")?"":"?"),viewToCheck=view+(-1<view.indexOf("?")?"":"?");0<=oldHashToCheck.indexOf(viewToCheck)&&window.location.reload()}catch(t){alert(t)}},this.cronapi.screen.openUrl=function(e,t,a,n){try{var o="_self",r="";t&&"true"==t.toString().toLowerCase()&&(o="_blank"),a&&(r+="width="+a+","),n&&(r+="height="+n+","),window.open(e,o,r)}catch(t){alert(t)}},this.cronapi.screen.getParam=function(e){try{for(var t,a=[],n=window.location.href.slice(window.location.href.indexOf("?")+1).split("&"),o=0;o<n.length;o++)t=n[o].split("="),a.push(t[0]),a[t[0]]=t[1];if(a[e]!==void 0)return decodeURIComponent(a[e])}catch(t){}return null},this.cronapi.screen.confimDialog=function(e){var t=confirm(e);return t},this.cronapi.screen.createDefaultModal=function(e,t,a,n,o,r,c){$("#modalTemplateTitle").text(e),$("#modalTemplateBody").text(t),$("#modalTemplateCancel").text(a),$("#modalTemplateSave").text(n),$("#modalTemplateClose").unbind("click"),$("#modalTemplateClose").click(c),$("#modalTemplateCancel").unbind("click"),$("#modalTemplateCancel").click(r),$("#modalTemplateSave").unbind("click"),$("#modalTemplateSave").click(o),this.cronapi.screen.showModal("modalTemplate")},this.cronapi.screen.showModal=function(e){let t=`#${e}`,a=$(":focus"),n=$(":hover");try{$(t).one("shown.bs.modal",function(){a.length&&($(this).data("lastFocused",a),$(this).data("lastFocusedClass","."+a.attr("class").split(" ").join("."))),n.length&&$(this).data("lastHovers",n);let e=$(this).find("input:not(:hidden)")[0];e&&e.focus()}).one("hidden.bs.modal",function(){let e,a=$(t).data("lastFocused"),n=!1;a&&a.length&&(e=$($(this).data("lastFocusedClass")),n=$("html").has(a).length?a.is(":visible"):e.is(":visible"));let o=function(e){return $(e[e.length-1]).closest("li:visible").find("a:first")},r=$(t).data("lastHovers");if(n)e.focus(),a.focus();else if($("html").has(a).length){let e=o(a);e.focus()}else if(r&&r.length){let e=o(r);e.focus()}}).modal({backdrop:"static",keyboard:!1})}catch(a){$(t).show()}},this.cronapi.screen.setActiveTab=function(e){this.cronapi.$scope.safeApply(function(){$("#"+e).attr("data-target")===void 0?$("[data-target=\"#"+e+"\"]").tab("show"):$("#"+e).tab("show")})},this.cronapi.screen.hideModal=function(t){try{$("#"+t).modal("hide")}catch(a){$("#"+t).hide()}},this.cronapi.screen.showIonicModal=function(e){$("#"+e).data("cronapp-modal")&&$("#"+e).data("cronapp-modal").remove(),this.cronapi.$scope.$ionicModal.fromTemplateUrl(e,{scope:this.cronapi.$scope,animation:"slide-in-up"}).then(function(t){$("#"+e).data("cronapp-modal",t),t.show()})},this.cronapi.screen.hideIonicModal=function(e){if($("#"+e).data("cronapp-modal")){var t=$("#"+e).data("cronapp-modal");t.remove(),$("#"+e).data("cronapp-modal",null)}},this.cronapi.screen.isShownIonicModal=function(e){if($("#"+e).data("cronapp-modal")){var t=$("#"+e).data("cronapp-modal");return t.isShown()}return!1},this.cronapi.screen.showLoading=function(){this.cronapi.$scope.$ionicLoading.show({content:"Loading",animation:"fade-in",showBackdrop:!0,maxWidth:200,showDelay:0})},this.cronapi.screen.hide=function(){this.cronapi.$scope.$ionicLoading.hide()},this.cronapi.screen.getHostapp=function(){return window.hostApp},this.cronapi.screen.searchIds=function(){},this.cronapi.screen.showComponent=function(e){$("#"+e).get(0).style.setProperty("display","block","important")},this.cronapi.screen.hideComponent=function(e){$("#"+e).get(0).style.setProperty("display","none","important")},this.cronapi.screen.disableComponent=function(e){let t;if(window.cordova)t=this.cronapi.$scope;else{let e=window.angular.element("body").injector();t=e.get("$rootScope")}let a=()=>{"$apply"!==t.$$phase&&"$digest"!==t.$$phase?$("#"+e).data("kendoComboBox")?$("#"+e).data("kendoComboBox").enable(!1):$("#"+e).data("kendoDropDownList")?$("#"+e).data("kendoDropDownList").enable(!1):$.each($("#"+e).find("*").addBack(),function(e,t){$(t).prop("disabled",!0)}):setTimeout(()=>a(),200)};a()},this.cronapi.screen.enableComponent=function(e){let t;if(window.cordova)t=this.cronapi.$scope;else{let e=window.angular.element("body").injector();t=e.get("$rootScope")}let a=()=>{"$apply"!==t.$$phase&&"$digest"!==t.$$phase?$("#"+e).data("kendoComboBox")?$("#"+e).data("kendoComboBox").enable(!0):$("#"+e).data("kendoDropDownList")?$("#"+e).data("kendoDropDownList").enable(!0):$.each($("#"+e).find("*").addBack(),function(e,t){$(t).prop("disabled",!1)}):setTimeout(()=>a(),200)};a()},this.cronapi.screen.focusComponent=function(e){this.cronapi.$scope.safeApply(function(){tinyMCE&&tinyMCE.get(e)!==void 0?tinyMCE.get(e).focus():$("#"+e).find("*").addBack().focus()})},this.cronapi.screen.changeAttrValue=function(e,t,a){$("#"+e).attr(t,a)},this.cronapi.screen.changeContent=function(e,t,a){if($("#"+e).html(t),!0===a||"true"===a){var n=angular.injector(["ng"]),o=this;n.invoke(["$compile",function(t){t(document.querySelector("#"+e))(o.cronapi.$scope)}])}},this.cronapi.screen.logout=function(){this.cronapi.$scope.logout!=null&&this.cronapi.$scope.logout()},this.cronapi.screen.refreshDatasource=function(e,t){!0==t||"true"==t?this[e].search(this[e].terms,this[e].caseInsensitive):this[e].search("",this[e].caseInsensitive)},this.cronapi.screen.loadMore=function(e){getDatasource(e).$apply(function(){getDatasource(e).nextPage()})},this.cronapi.screen.hasNextPage=function(e){return getDatasource(e).hasNextPage()},this.cronapi.screen.load=function(e){getDatasource(e).fetch({params:{}},void 0,void 0,{origin:"button"})},this.cronapi.dateTime={},this.cronapi.dateTime.formats=function(){var e=[];return e="pt_br"==this.cronapi.$translate.use()?["DD/MM/YYYY HH:mm:ss","DD/MM/YYYY","DD-MM-YYYY HH:mm:ss","DD-MM-YYYY"]:["MM/DD/YYYY HH:mm:ss","MM/DD/YYYY","MM-DD-YYYY HH:mm:ss","MM-DD-YYYY"],e.push("YYYY-MM-DDTHH:mm:ss"),e.push("HH:mm:ss"),e.push("MMMM"),e},this.cronapi.dateTime.getMomentObj=function(e){var t=moment;if(e instanceof moment)return e;if(e instanceof Date)return t(e).utcOffset(window.timeZoneOffset);var a=this.cronapi.dateTime.formats(),n=null;for(var o in a)if(n=t(e,a[o]),n.isValid())break;return n},this.cronapi.dateTime.getSecond=function(e){var t=this.cronapi.dateTime.getMomentObj(e);return t?t.get("second"):0},this.cronapi.dateTime.getMinute=function(e){var t=this.cronapi.dateTime.getMomentObj(e);return t?t.get("minute"):0},this.cronapi.dateTime.getHour=function(e){var t=this.cronapi.dateTime.getMomentObj(e);return t?t.get("hour"):0},this.cronapi.dateTime.getYear=function(e){var t=this.cronapi.dateTime.getMomentObj(e);return t?t.get("year"):0},this.cronapi.dateTime.getMonth=function(e){var t=this.cronapi.dateTime.getMomentObj(e);return t?t.get("month")+1:0},this.cronapi.dateTime.getDay=function(e){var t=this.cronapi.dateTime.getMomentObj(e);return t?t.get("date"):0},this.cronapi.dateTime.getSecondsBetweenDates=function(e,t){var a=this.cronapi.dateTime.getMomentObj(e),n=this.cronapi.dateTime.getMomentObj(t);return a.diff(n,"seconds")},this.cronapi.dateTime.getMinutesBetweenDates=function(e,t){var a=this.cronapi.dateTime.getMomentObj(e),n=this.cronapi.dateTime.getMomentObj(t);return a.diff(n,"minutes")},this.cronapi.dateTime.getHoursBetweenDates=function(e,t){var a=this.cronapi.dateTime.getMomentObj(e),n=this.cronapi.dateTime.getMomentObj(t);return a.diff(n,"hours")},this.cronapi.dateTime.getDaysBetweenDates=function(e,t){var a=this.cronapi.dateTime.getMomentObj(e),n=this.cronapi.dateTime.getMomentObj(t);return a.diff(n,"days")},this.cronapi.dateTime.getMonthsBetweenDates=function(e,t){var a=this.cronapi.dateTime.getMomentObj(e),n=this.cronapi.dateTime.getMomentObj(t);return a.diff(n,"months")},this.cronapi.dateTime.getYearsBetweenDates=function(e,t){var a=this.cronapi.dateTime.getMomentObj(e),n=this.cronapi.dateTime.getMomentObj(t);return a.diff(n,"years")},this.cronapi.dateTime.incSecond=function(e,t){var a=this.cronapi.dateTime.getMomentObj(e);return a.add("seconds",t).toDate()},this.cronapi.dateTime.incMinute=function(e,t){var a=this.cronapi.dateTime.getMomentObj(e);return a.add("minutes",t).toDate()},this.cronapi.dateTime.incHour=function(e,t){var a=this.cronapi.dateTime.getMomentObj(e);return a.add("hours",t).toDate()},this.cronapi.dateTime.incDay=function(e,t){var a=this.cronapi.dateTime.getMomentObj(e);return a.add("days",t).toDate()},this.cronapi.dateTime.incMonth=function(e,t){var a=this.cronapi.dateTime.getMomentObj(e);return a.add("months",t).toDate()},this.cronapi.dateTime.incYear=function(e,t){var a=this.cronapi.dateTime.getMomentObj(e);return a.add("years",t).toDate()},this.cronapi.dateTime.getNow=function(){var e=moment();return e.toDate()},this.cronapi.dateTime.formatDateTime=function(e,t){return this.cronapi.dateTime.getMomentObj(e).format(t)},this.cronapi.dateTime.newDate=function(e,t,a,n,o,r){var c=new Date;return c.setYear(e),c.setMonth(t-1),c.setDate(a),c.setHours(n),c.setMinutes(o),c.setSeconds(r),this.cronapi.dateTime.getMomentObj(c).toDate()},this.cronapi.dateTime.updateDate=function(e,t,a,n,o,r,c,s){var p=this.cronapi.dateTime.getMomentObj(e).toDate();if(p&&!isNaN(p.getTime()))p.setYear(t),p.setMonth(a-1),p.setDate(n),p.setHours(o),p.setMinutes(r),p.setSeconds(c),p.setMilliseconds(s);else return void this.cronapi.screen.notify("error",this.cronapi.i18n.translate("InvalidDate",[]));return this.cronapi.dateTime.getMomentObj(p).toDate()},this.cronapi.dateTime.updateNewDate=function(e,t,a){var n=this.cronapi.dateTime.getMomentObj(e).toDate();if(n&&!isNaN(n.getTime()))"year"===t?n.setYear(a):"month"===t?n.setMonth(a-1):"day"===t?n.setDate(a):"hour"===t?n.setHours(a):"minute"===t?n.setMinutes(a):"second"===t?n.setSeconds(a):"millisecond"===t?n.setMilliseconds(a):void 0;else return void this.cronapi.screen.notify("error",this.cronapi.i18n.translate("InvalidDate",[]));return this.cronapi.dateTime.getMomentObj(n).toDate()},this.cronapi.text={},this.cronapi.text.prompt=function(){return null},this.cronapi.text.newline=function(){return"\n"},this.cronapi.text.replaceAll=function(e,t,a,n){return this.cronapi.logic.isNull(e)||this.cronapi.logic.isNull(t)||this.cronapi.logic.isNull(n)?null:"-"===a?e.replace(t,n):e.replace(new RegExp(t,a),n)},this.cronapi.xml={},this.cronapi.xml.newXMLEmpty=function(){return $.parseXML("<?xml version=\"1.0\" encoding=\"UTF-8\"?><root></root>")},this.cronapi.xml.newXMLEmptyWithRoot=function(e){var t=$.parseXML("<?xml version=\"1.0\" encoding=\"UTF-8\"?><root></root>");return t.removeChild(t.firstElementChild),t.appendChild(e),t},this.cronapi.xml.newXMLElement=function(e,t){var a=document.createElement(e);return a.textContent=t,a},this.cronapi.xml.addXMLElement=function(e,t){try{var a=t.cloneNode(!0);return e.appendChild(a),!0}catch(t){return!1}},this.cronapi.xml.XMLHasRootElement=function(e){return!!(e&&e.getRootNode())},this.cronapi.xml.XMLGetRootElement=function(e){return e instanceof XMLDocument?e.firstElementChild:e.getRootNode()},this.cronapi.xml.XMLDocumentToText=function(e){if(e instanceof XMLDocument)return $($($(e.firstElementChild).context.outerHTML).removeAttr("xmlns"))[0].outerHTML;if(1<$(e).size()){var t="";return $.each($(e).toArray(),function(e,a){t+=$($(a)[0].outerHTML).removeAttr("xmlns")[0].outerHTML}),t}return $($($(e).context.outerHTML).removeAttr("xmlns"))[0].outerHTML},this.cronapi.xml.getChildren=function(e,t){return e instanceof XMLDocument?e.firstElementChild.toArray:t?t.localName?$(e).find(t.localName).toArray():$(e).find(t).toArray():$(e).children().toArray()},this.cronapi.xml.setAttribute=function(e,t,a){return!!t&&(e instanceof XMLDocument?(e.firstChild.setAttribute(t,a),!0):!!e&&(e.setAttribute(t,a),!0))},this.cronapi.xml.getAttributeValue=function(e,t){return t?e instanceof XMLDocument?e.firstChild.getAttribute(t)?e.firstChild.getAttribute(t):"":e&&t?e.getAttribute(t):"":""},this.cronapi.xml.getParentNode=function(e){return e instanceof XMLDocument?e.firstChild:e.parentNode},this.cronapi.xml.setElementContent=function(e,t){e instanceof XMLDocument&&(e.firstChild.textContent=t),e.textContent=t},this.cronapi.xml.getElementContent=function(e){return e instanceof XMLDocument?e.firstChild.innerText:e.innerText},this.cronapi.xml.removeElement=function(e,t){e instanceof XMLDocument?t?t instanceof HTMLUnknownElement?t.remove():$.each($(e.firstElementChild.children),function(e,a){a.localName==t&&a.remove()}):$.each($(e.firstElementChild.children),function(e,t){t.remove()}):t?t instanceof HTMLUnknownElement?t.remove():$.each($(e.children),function(e,a){a.localName==t&&a.remove()}):$.each($(e.children),function(e,t){t.remove()})},this.cronapi.xml.getElementName=function(e){return e instanceof XMLDocument?e.firstChild.localName:e.localName},this.cronapi.xml.renameElement=function(e,t){var a=e.outerHTML.replace(e.localName,t);a=a.replace("/"+e.localName,"/"+t),a=$(a).removeAttr("xmlns"),e.replaceWith(a[0])},this.cronapi.logic={},this.cronapi.logic.isNull=function(e){return null===e||"undefined"==typeof e||e==null},this.cronapi.logic.isEmpty=function(e){return""===e},this.cronapi.logic.isNullOrEmpty=function(e){return this.cronapi.logic.isNull(e)||this.cronapi.logic.isEmpty(e)},this.cronapi.logic.typeOf=function(e,t){return"array"===t?Array.isArray(e):!("object"===t&&Array.isArray(e))&&typeof e==t},this.cronapi.i18n={},this.cronapi.i18n.translate=function(e,t){if(e){for(var a,n=this.cronapi.$translate.instant(e),o=0;o<t.length;o++)if(a=t[o],null!=a&&"undefined"!=typeof a){var r=new RegExp("\\{"+o+"\\}","g");n=n.replace(r,a)}return n}},this.cronapi.internal={},this.cronapi.internal.focusFormInput=function(){let e=$($("form")[0]),t=$(e.find("input")[0]);if(t&&t.length){let e=setInterval(()=>{t.is(":visible")&&(t.focus(),clearInterval(e))},100)}},this.cronapi.internal.setFile=function(e,t){this.cronapi.internal.fileToBase64(t,function(t){this.cronapi.screen.changeValueOfField(e,t)}.bind(this))},this.cronapi.internal.fileToBase64=function(e,t){var a=new FileReader;a.readAsDataURL(e),a.onload=function(a){var e=a.target.result.substr(a.target.result.indexOf("base64,")+7);t(e)}},this.cronapi.internal.startCamera=function(e,t,a,n,o){if(window.cordova&&window.cordova.platformId&&"browser"!==window.cordova.platformId){var r=this;navigator.camera.getPicture(function(t){r.cronapi.screen.changeValueOfField(e,t)},function(e){console.error(e),r.cronapi.$scope.Notification.error(message)},{quality:parseInt(t),destinationType:Camera.DestinationType.DATA_URL,encodingType:Camera.EncodingType.JPEG,correctOrientation:!0,allowEdit:"true"==a,targetWidth:parseInt(n),targetHeight:parseInt(o)})}else{function t(e,t){var a=window.innerWidth,n=window.innerHeight,o=0;return o=a/e,t*=o,e*=o,e>a&&(o=a/e,t*=o,e*=o),t>n&&(o=n/t,e*=o,t*=o),{width:e,height:t}}var c="<div class=\"camera-container\" style=\"margin-left:-$marginleft$;margin-top:-$margintop$\"> <button class=\"btn btn-success button button-balanced\" id=\"cronapiVideoCaptureOk\" style=\"position: absolute; z-index: 999999999;\"> <span class=\"glyphicon glyphicon-ok icon ion-checkmark-round\"></span> <span class=\"sr-only\">{{\"Upload.camera\" | translate}}</span> </button> <button class=\"btn btn-danger button button-assertive button-cancel-capture\" id=\"cronapiVideoCaptureCancel\" style=\"position: absolute; margin-left: 42px; z-index: 999999999;\"> <span class=\"glyphicon glyphicon-remove icon ion-android-close\"></span> <span class=\"sr-only\">{{\"Cancel\" | translate}}</span> </button> <video id=\"cronapiVideoCapture\" style=\"height: $height$; width: $width$;\" autoplay=\"\"></video> </div>",s=null;navigator.mediaDevices&&navigator.mediaDevices.getUserMedia&&navigator.mediaDevices.getUserMedia({video:!0}).then(function(a){s=a;var n=t(a.getTracks()[0].getSettings().width,a.getTracks()[0].getSettings().height),o=n.width,r=n.height;try{o=parseInt(o/2),r=parseInt(r/2)}catch(t){}c=c.split("$height$").join(n.height+"px").split("$width$").join(n.width+"px").split("$marginleft$").join(o+"px").split("$margintop$").join(r+"px");var p=$(c);p.prependTo("body");var l=document.getElementById("cronapiVideoCapture");p.find("#cronapiVideoCaptureCancel").on("click",function(){null!=s&&0<s.getTracks().length&&s.getTracks()[0].stop(),$(p).remove()}.bind(this)),p.find("#cronapiVideoCaptureOk").on("click",function(){this.cronapi.internal.captureFromCamera(e,n.width,n.height),null!=s&&0<s.getTracks().length&&s.getTracks()[0].stop(),$(p).remove()}.bind(this)),l.srcObject=a,l.onloadedmetadata=function(){l.play()}}.bind(this))}},this.cronapi.internal.downloadFileEntityMobile=function(t,a,n,o){var r,c,s=null;if(n)r=t.data[n][a],c=t.data[n];else try{r=t.active[a],c=t.active}catch(n){r=t[a],c=t}try{var s=JSON.parse(r)}catch(t){}if(s){var p=this.cronapi.internal.getAddressWithHostApp("/api/cronapi/filePreview/");window.open(p+s.path,"_system")}else if(r.startsWith("https://")||r.startsWith("http://"))window.open(r,"_system");else if(t.isOData())cronapi.internal.makeDownloadFromBytes(r,o);else{var l="/api/cronapi/downloadFile",d=t.entity.split("/"),g=d[d.length-1];if(-1<g.indexOf(":")){for(var m="",u=d[3].split("."),h=0;h<u.length-1;h++)m+=u[h]+".";var e=g.split(":");g=m+e[e.length-1]}l+="/"+g,l+="/"+a;var f=c,b=t.getKeyValues(f),y=0;for(var v in b)l=0==y?l+"/"+f[v]:l+":"+f[v],y++;var p=this.cronapi.internal.getAddressWithHostApp(l);window.open(p,"_system")}},this.cronapi.internal.captureFromCamera=function(e,t,a){var n=document.createElement("canvas");n.width=t,n.height=a;var o=n.getContext("2d"),r=document.getElementById("cronapiVideoCapture");o.drawImage(r,0,0,t,a);var c=n.toDataURL().substr(22);this.cronapi.screen.changeValueOfField(e,c)},this.cronapi.internal.castBinaryStringToByteArray=function(e){for(var t=e.length,a=new Uint8Array(t),n=0;n<t;n++)a[n]=e.charCodeAt(n);return a},this.cronapi.internal.castBase64ToByteArray=function(e){var t=window.atob(e);return this.cronapi.internal.castBinaryStringToByteArray(t)},this.cronapi.internal.castByteArrayToString=function(e){return _StringfromCharCode.apply(null,new Uint16Array(e))},this.cronapi.internal.generatePreviewDescriptionByte=function(data,fileInfo){var json;let fileInfoContent=eval(fileInfo);try{json=fileInfoContent?JSON.parse(fileInfoContent):JSON.parse(data)}catch(e){try{json=JSON.parse(window.atob(data))}catch(e){if(data&&data.match(/__odataFile_/g)){var file=eval(data);json=cronapi.internal.getJsonDescriptionFromFile(file)}else if(data&&(data.startsWith("http://")||data.startsWith("https://"))){json={};var urlSplited=data.split("/"),fullName=urlSplited[urlSplited.length-1].replace("?dl=0",""),fullNameSplited=fullName.split("."),extension="."+fullNameSplited[fullNameSplited.length-1];json.fileExtension=extension,json.name=fullName.replace(extension,""),json.contentType="file/"+extension.replace(".","")}else if(data&&this.cronapi.internal.isBase64(data)){var fileName="download",fileExtesion=this.cronapi.internal.getExtensionBase64(data),contentType=this.cronapi.internal.getContentTypeFromExtension(fileExtesion);fileName+=fileExtesion,json={},json.fileExtension=fileExtesion,json.name=fileName,json.contentType=contentType}}}if(json){25<json.name.length&&(json.name=json.name.substr(0,22)+"...");var result=("pt_br"==this.cronapi.$translate.use()?"<b>Nome:</b> <br/>":"<b>Name:</b> <br/>")+(void 0===json.contentType?"":json.name+"<br/>");return result+=void 0===json.contentType?"":"<b>Content-Type:</b> <br/>"+json.contentType+"<br/>",result+=""===json.fileExtension?"":"pt_br"==this.cronapi.$translate.use()?"<b>Extens\xE3o:</b> <br/>"+json.fileExtension+"<br/>":"<b>Extension:</b> <br/>"+json.fileExtension+"<br/>",result}},this.cronapi.internal.getContentTypeFromExtension=function(e){if(e)switch(e.toLowerCase()){case".png":return"image/png";case".jpg":return"image/jpeg";case".mp4":return"video/mp4";case".pdf":return"application/pdf";case".ico":return"image/vnd.microsoft.icon";case".rar":return"application/x-rar-compressed";case".rtf":return"application/rtf";case".txt":return"text/plain";case".zip":return"application/zip";case".srt":return"text/srt";default:return"unknown";}},this.cronapi.internal.getExtensionBase64=function(e){if(e){var t=e.substr(0,5);switch(t.toLocaleUpperCase()){case"IVBOR":return".png";case"/9J/4":return".jpg";case"AAAAF":return".mp4";case"JVBER":return".pdf";case"AAABA":return".ico";case"UMFYI":return".rar";case"E1XYD":return".rtf";case"U1PKC":return".txt";case"UESDB":return".zip";case"MQOWM":case"77U/M":return".srt";default:return"";}}return""},this.cronapi.internal.isBase64=function(e){try{return btoa(atob(e))==e}catch(e){return!1}},this.cronapi.internal.downloadUrl=function(e,t){let a=document.createElement("a");a.setAttribute("href",e),a.setAttribute("download",t);let n=document.createEvent("MouseEvents");n.initMouseEvent("click",!0,!0,window,1,0,0,0,0,!1,!1,!1,!1,0,null),a.dispatchEvent(n)},this.cronapi.internal.makeDownloadFromBytes=function(valueContent,fileInfo){var bytesOrFileInput,urlCreator=window.URL||window.webkitURL||window.mozURL||window.msURL,fileName="download";if(valueContent.match(/__odataFile_/g))bytesOrFileInput=eval(valueContent),fileName=bytesOrFileInput.name;else{fileName+=cronapi.internal.getExtensionBase64(valueContent);try{valueContent=window.atob(valueContent)}catch(t){}bytesOrFileInput=cronapi.internal.castBinaryStringToByteArray(valueContent)}let fileInfoDescription=eval(fileInfo);if(fileInfoDescription){let e=JSON.parse(fileInfoDescription);fileName=e.name}var url=urlCreator.createObjectURL(new Blob([bytesOrFileInput],{type:"application/octet-stream"}));cronapi.internal.downloadUrl(url,fileName)},this.cronapi.internal.downloadFileEntity=function(t,a,n,o){var r,c,s=null;if(n)r=t.data[n][a],c=t.data[n];else try{r=t.active[a],c=t.active}catch(n){r=t[a],c=t}try{var s=JSON.parse(r)}catch(t){}if(s)window.open("/api/cronapi/filePreview/"+s.path);else if(r.startsWith("https://")||r.startsWith("http://"))window.open(r);else if(t.isOData())cronapi.internal.makeDownloadFromBytes(r,o);else{var p="/api/cronapi/downloadFile",l=t.entity.split("/"),d=l[l.length-1];if(-1<d.indexOf(":")){for(var g="",m=l[3].split("."),u=0;u<m.length-1;u++)g+=m[u]+".";var e=d.split(":");d=g+e[e.length-1]}p+="/"+d,p+="/"+a;var h=JSON.parse(localStorage.getItem("_u"))||{},f=c,b=this.cronapi.internal.getAddressWithHostApp(p);this.$promise=this.cronapi.$scope.$http({method:"POST",url:b,data:f?JSON.stringify(f):null,responseType:"blob",headers:{"Content-Type":"application/json","X-AUTH-TOKEN":h.token}}).success(function(e,t,a){a=a();var n=a["x-filename"]||"download.bin",o=window.URL||window.webkitURL||window.mozURL||window.msURL;try{var r=o.createObjectURL(e);cronapi.internal.downloadUrl(r,n)}catch(e){console.log("Error downloading file"),console.log(e)}}.bind(this)).error(function(){console.log("Error downloading file")}.bind(this))}},this.cronapi.internal.uploadFileAjax=function(e,t,a){var n=new FormData;n.append("file",t);var o=JSON.parse(localStorage.getItem("_u"))||{},r=this.cronapi.internal.getAddressWithHostApp("/api/cronapi/uploadFile");this.$promise=this.cronapi.$scope.$http({method:"POST",url:r,data:n,headers:{"Content-Type":void 0,"X-AUTH-TOKEN":o.token},onProgress:function(e){if(e.lengthComputable){var t=0|100*(e.loaded/e.total),n=$("#"+a);if(0<n.length)if("bootstrapProgress"==n.data("type"))100>t?(n.show(),n.find(".progress-bar").css("width",t+"%")):(n.hide(),n.find(".progress-bar").css("width","0%"));else{var o=document.getElementById(a);o.value=o.innerHTML=t}}}}).success(function(t){this.cronapi.screen.changeValueOfField(e,t.jsonString)}.bind(this)).error(function(){alert("Error uploading file")}.bind(this))},this.cronapi.internal.getFieldFromActiveString=function(e){var t=/.active.([a-zA-Z0-9_-]*)/g.exec(e),a=t[1];return a},this.cronapi.internal.getJsonDescriptionFromFile=function(e){let t={};if(e){let a=e.name.split("."),n="."+a[a.length-1];t.fileExtension=n,t.name=e.name,t.contentType=e.type||"unknown"}return t},this.cronapi.internal.uploadFile=function(field,file,progressId,fileInfo){if(file){var regexForDatasource=/(.*?).active./g,groupDatasource=regexForDatasource.exec(field);if(groupDatasource){var datasource=eval(groupDatasource[1]);if(datasource.isOData()){let e=cronapi.internal.getFieldFromActiveString(field),t=datasource.getFieldSchema(e);if(t&&"Binary"==t.type){if(datasource.active["__odataFile_"+e]=file,datasource.active[e]=datasource.name+".active.__odataFile_"+e,fileInfo){let e=cronapi.internal.getJsonDescriptionFromFile(file),t=cronapi.internal.getFieldFromActiveString(fileInfo);datasource.active[t]=JSON.stringify(e)}return}}}this.cronapi.internal.uploadFileAjax(field,file,progressId)}},this.cronapi.object={},this.cronapi.object.getProperty=function(e,t){var a=t.split(".");if(1<a.length){var n=function(e,t,a){return a||(a=0),void 0===e[t[a]]&&(e[t[a]]={}),a++,a<t.length?n(e[t[a-1]],t,a):e[t[a-1]]};return n(e,a,0)}return e[t]},this.cronapi.object.setProperty=function(e,t,a){var n=t.split(".");if(1<n.length){var o=function(e,t,a,n){n||(n=0),e[t[n]]===void 0&&(e[t[n]]={}),n++,n<t.length?o(e[t[n-1]],t,a,n):e[t[n-1]]=a};o(e,n,a,0)}else e[t]=a},this.cronapi.object.createObjectFromString=function(e){return JSON.parse(e)},this.cronapi.object.createObjectLoginFromString=function(e,t){return JSON.parse(JSON.stringify({username:e,password:t}))},this.cronapi.object.serializeObject=function(e){return JSON.stringify(e)},this.cronapi.object.deleteProperty=function(e,t){delete e[t]},this.cronapi.object.newObject=function(){var e={};if(arguments&&0<arguments.length)for(var t,a=0;a<arguments.length;a++)t=arguments[a],t.name&&(e[t.name]=t.value);return e},this.cronapi.object.getObjectField=function(e,t){var a;return e&&t&&(a=e[t]),a},this.cronapi.json={},this.cronapi.json.createObjectFromString=function(e){return this.cronapi.object.createObjectFromString(e)},this.cronapi.json.setProperty=function(e,t,a){this.cronapi.object.setProperty(e,t,a)},this.cronapi.json.deleteProperty=function(e,t){this.cronapi.object.deleteProperty(e,t)},this.cronapi.json.getProperty=function(e,t){return this.cronapi.object.getProperty(e,t)},this.cronapi.cordova={},this.cronapi.cordova.vibrate=function(e){navigator.vibrate(e)},this.cronapi.cordova.device={},this.cronapi.cordova.device.getFirebaseToken=function(e,t){document.addEventListener("deviceready",function(){try{window.FirebasePlugin.getToken(e,t)}catch(a){console.error(a),t(a)}},!1)},this.cronapi.cordova.device.getFirebaseNotificationData=function(e,t){document.addEventListener("deviceready",function(){try{window.FirebasePlugin.onMessageReceived(function(t){e(t)},function(e){t(e)})}catch(t){console.warn(t)}try{window.FirebasePlugin.onNotificationOpen(function(t){e(t)},function(e){t(e)})}catch(t){console.warn(t)}},!1)},this.cronapi.cordova.device.getDeviceInfo=function(e){return window.device[e]},this.cronapi.cordova.geolocation={},this.cronapi.cordova.geolocation.getCurrentPosition=function(e,t){navigator.geolocation.getCurrentPosition(e,t)},this.cronapi.cordova.geolocation.watchPosition=function(e,t,a,n,o){return navigator.geolocation.watchPosition(e,t,{maximumAge:a,timeout:n,enableHighAccuracy:o})},this.cronapi.cordova.geolocation.clearWatchPosition=function(e){navigator.geolocation.clearWatch(e)},this.cronapi.cordova.camera={},this.cronapi.cordova.camera.getPicture=function(e,t,a,n,o,r){(o===void 0||null===o)&&(o=0),r=!0===r||"true"===r,navigator.camera.getPicture(e,t,{destinationType:+a,sourceType:+n,mediaType:+o,allowEdit:r})},this.cronapi.cordova.camera.qrCodeScanner=function(e,t,a,n){cordova.plugins.barcodeScanner.scan(function(e){a(e.text)},function(e){"Scan is already in progress"!==e&&n(e)},{preferFrontCamera:!1,showFlipCameraButton:!0,showTorchButton:!0,saveHistory:!0,prompt:t,resultDisplayDuration:500,formats:e,orientation:"portrait",disableAnimations:!0,disableSuccessBeep:!1})},this.cronapi.cordova.file={},this.cronapi.cordova.file.getDirectory=function(e){var t;return"0"==e?t=cordova.file.dataDirectory:(t=cordova.file.externalApplicationStorageDirectory,!t&&(t=cordova.file.externalDataDirectory),!t&&(t=cordova.file.syncedDataDirectory)),t},this.cronapi.cordova.file.removeFile=function(e,t,a){window.resolveLocalFileSystemURL(e,function(e){e.remove(function(e){t&&t(e)}.bind(this),a)}.bind(this),a)},this.cronapi.cordova.file.readFile=function(e,t,a,n){window.resolveLocalFileSystemURL(e,function(e){e.file(function(e){var a=new FileReader;switch(a.onloadend=function(){t(this.result)},n){case"ARRAYBUFFER":{a.readAsArrayBuffer(e);break}case"TEXT":{a.readAsText(e);break}case"BINARYSTRING":{a.readAsBinaryString(e);break}case"DATAURL":{a.readAsDataURL(e);break}default:a.readAsText(e);}}.bind(this),a)}.bind(this),a)},this.cronapi.cordova.file.createFile=function(e,t,a,n,o){e||getDirectory(0);window.resolveLocalFileSystemURL(e,function(r){console.log(e),r.getFile(t,{create:!0},function(e){e.createWriter(function(e){e.onwriteend=function(){console.log("Write of file \""+t+"\"\" completed.")},e.onerror=function(t){console.log("Write failed: "+t.toString())};var o=new Blob([a],{type:"text/plain"});e.write(o),n&&setTimeout(function(){n()}.bind(this),500)}.bind(this),o)}.bind(this),o)}.bind(this),o)},this.cronapi.cordova.file.createDirectory=function(e,t,a,n){window.resolveLocalFileSystemURL(e,function(){parentEntry.getDirectory(t,{create:!0},function(e){a&&a(e)}.bind(this),n)}.bind(this),n)},this.cronapi.cordova.storage={},this.cronapi.cordova.storage.setStorageItem=function(e,t){var a=window.localStorage;a?a.setItem(e,t):console.error("Local Storage not Found!")},this.cronapi.cordova.storage.getStorageItem=function(e){var t=window.localStorage;return t?t.getItem(e):void console.error("Local Storage not Found!")},this.cronapi.cordova.storage.removeStorageItem=function(e){var t=window.localStorage;t?t.removeItem(e):console.error("Local Storage not Found!")},this.cronapi.cordova.connection={},this.cronapi.cordova.connection.getConnection=function(){return navigator.connection.type},this.cronapi.cordova.connection.verifyConnection=function(e){return navigator.connection.type==e},this.cronapi.cordova.database={},this.cronapi.cordova.database.nameDefault="cronappDB",this.cronapi.cordova.database.openDatabase=function(e){let t=window.openDatabase;return window.sqlitePlugin&&(t=window.sqlitePlugin.openDatabase),t(e?e:this.cronapi.cordova.database.nameDefault,"1.0",e?e:this.cronapi.cordova.database.nameDefault,1e6)},this.cronapi.cordova.database.executeSql=function(e,t,a,n,o){var r=this.cronapi.cordova.database.openDatabase(e);r.transaction(function(e){e.executeSql(t,a,function(e,t){n.call(this,Object.values(t.rows))}.bind(this))}.bind(this),function(t){console.log(t),o(t)}.bind(this))},this.cronapi.cordova.database.executeMultipleSql=function(e,t,a,n){var o=this.cronapi.cordova.database.openDatabase(e);let r=[],c=t.split(";");for(let s in c){let e=c[s];if(!e)break;let t=new Promise((t,a)=>{o.transaction(function(n){n.executeSql(e.trim(),[],function(e,a){t(a)}.bind(this),function(e,t){a(t)}.bind(this))}.bind(this))});r.push(t)}Promise.all(r).then(function(e){a(e)}.bind(this)).catch(function(t){n(t)}.bind(this))},this.cronapi.cordova.database.openInAppBrowser=function(e){cordova.InAppBrowser&&cordova.InAppBrowser.open(e,"_blank","location=no")},this.cronapi.internal.ptDate=function(e){var t,a=e[1],n=e[2],o=e[3],r=e[5],c=e[6],s=e[7];return t=r?new Date(o,n-1,a,r,c,s):new Date(o,n-1,a,0,0,0),t},this.cronapi.internal.enDate=function(e){var t,a=e[1],n=e[2],o=e[3],r=e[5],c=e[6],s=e[7];return t=r?new Date(o,a-1,n,r,c,s):new Date(o,a-1,n,0,0,0),t},this.cronapi.internal.parseBoolean=function(e){return!!e&&("boolean"==typeof e?e:(e=e.toString().toLowerCase().trim(),"1"==e||"true"==e))},this.cronapi.internal.removeAccents=function(e){var t="";for(i=0;i<e.length;i++)t+=0<="\xE1\xE0\xE3\xE2\xE4\xE9\xE8\xEA\xEB\xED\xEC\xEE\xEF\xF3\xF2\xF5\xF4\xF6\xFA\xF9\xFB\xFC\xE7\xC1\xC0\xC3\xC2\xC4\xC9\xC8\xCA\xCB\xCD\xCC\xCE\xCF\xD3\xD2\xD5\xD6\xD4\xDA\xD9\xDB\xDC\xC7".search(e.substr(i,1))?"aaaaaeeeeiiiiooooouuuucAAAAAEEEEIIIIOOOOOUUUUC".substr("\xE1\xE0\xE3\xE2\xE4\xE9\xE8\xEA\xEB\xED\xEC\xEE\xEF\xF3\xF2\xF5\xF4\xF6\xFA\xF9\xFB\xFC\xE7\xC1\xC0\xC3\xC2\xC4\xC9\xC8\xCA\xCB\xCD\xCC\xCE\xCF\xD3\xD2\xD5\xD6\xD4\xDA\xD9\xDB\xDC\xC7".search(e.substr(i,1)),1):e.substr(i,1);return t},this.cronapi.internal.arrayRemove=function(e,t){var a=this.cronapi.internal.arrayIndexOf(e,t);-1!=a&&e.splice(a,1)},this.cronapi.internal.arrayIndexOf=function(e,t){var a=-1;return $(e).each(function(e){t==this&&(a=e)}),a},this.cronapi.internal.replaceAll=function(e,t,a){return e.toString().split(t).join(a)},this.cronapi.internal.getWindowHeight=function(){$(window).height()},this.cronapi.internal.getWindowWidth=function(){$(window).width()},this.cronapi.internal.getAddressWithHostApp=function(e){var t=window.hostApp||"";if(t=t.endsWith("/")?t.substr(0,t.length-1):t,e){var a=e.startsWith("/")?e.substr(1):e;t=""===t?a:t+"/"+a}return t},this.cronapi.internal.Url={encode:function(e){return e?escape(this.cronapi.internal.Url._utf8_encode(e)):""},decode:function(e){return e?this.cronapi.internal.Url._utf8_decode(unescape(e)):""},_utf8_encode:function(e){e=e.replace(/\r\n/g,"\n");for(var t,a="",o=0;o<e.length;o++)t=e.charCodeAt(o),128>t?a+=_StringfromCharCode(t):127<t&&2048>t?(a+=_StringfromCharCode(192|t>>6),a+=_StringfromCharCode(128|63&t)):(a+=_StringfromCharCode(224|t>>12),a+=_StringfromCharCode(128|63&t>>6),a+=_StringfromCharCode(128|63&t));return a},_utf8_decode:function(e){for(var t="",a=0,n=c1=c2=0;a<e.length;)n=e.charCodeAt(a),128>n?(t+=_StringfromCharCode(n),a++):191<n&&224>n?(c2=e.charCodeAt(a+1),t+=_StringfromCharCode((31&n)<<6|63&c2),a+=2):(c2=e.charCodeAt(a+1),c3=e.charCodeAt(a+2),t+=_StringfromCharCode((15&n)<<12|(63&c2)<<6|63&c3),a+=3);return t}},this.cronapi.internal.stringToJs=function(e){return(e+"").replace(/[\\"']/g,"\\$&").replace(/\u0000/g,"\\0")},this.cronapi.internal.getErrorMessage=function(e,t){try{var a=null;if("object"==typeof e?e.data&&("object"==typeof e.data?a=e.data:"string"==typeof e.data&&(a=JSON.parse(e.data))):"string"==typeof e&&(a=JSON.parse(e)),a&&a.error)return a.error}catch(t){}return t},this.cronapi.util.upload=function(e,t,a,n,o){this.UploadService.upload({description:t,id:e,filter:a,maxSize:n,multiple:o,scope:this})},this.cronapi.util.getBaseUrl=function(){return window.location.origin},this.cronapi.chart={},this.cronapi.chart.createChart=function(e,t,a,n){function o(){return l<p.length?l++:l=0,l}function r(){""==g.data.datasets[0].label&&(null==g.options.legend?(g.options.legend={},g.options.legend.display=!1):g.options.legend.display=!1)}function c(e){var t=[],a=4;for(Array.isArray(e[4])&&"object"==typeof e[4][0]&&("label"in e[4][0])&&("data"in e[4][0])&&(e=e[4],a=0),a;a<e.length;a++)e[a].label?e[a].options?(e[a].data?t.push(cronapi.chart.createDataset(e[a].label,e[a].data,e[a].options)):t.push(cronapi.chart.createDataset(e[a].label,e[a],null)),t.push(cronapi.chart.createDataset(e[a].label,e[a].data,e[a].options))):t.push(cronapi.chart.createDataset(e[a].label,e[a].data,null)):e[a].options?(e[a].data?t.push(cronapi.chart.createDataset(null,e[a].data,e[a].options)):t.push(cronapi.chart.createDataset(null,e[a],e[a].options)),t.push(cronapi.chart.createDataset(null,e[a].data,e[a].options))):e[a].data?t.push(cronapi.chart.createDataset(null,e[a].data,null)):t.push(cronapi.chart.createDataset(null,e[a],null));return t}function s(){null==g.options?(g.options={},g.options.scales={},g.options.scales.yAxes=[{ticks:{beginAtZero:!0}}]):null==g.options.scales&&(g.options.scales={},g.options.scales.yAxes=[{ticks:{beginAtZero:!0}}])}var p=["#FF5C00","#0E53A7","#48DD00","#FFD500","#7309AA","#CD0074","#00AF64","#BF8230","#F16D95","#A65000","#A65000","#AF66D5"],l=0,d=document.getElementById(e);if(d){d._chart&&d._chart.destroy(),d.getContext("2d");var g={};if(g.type=t,g.data=[],g.options={},g.data.labels=Array.isArray(a)?a:JSON.parse(a),g.data.datasets=[],Array.isArray(n))g.options=n;else if(""!=n&&null!=n)try{g.options=JSON.parse(n)}catch(t){g.options={},console.log(t)}else g.options={};switch(t){case"line":{g.data.datasets=c(arguments),$.each(g.data.datasets,function(e,t){t.fill=!1,t.backgroundColor=p[o()],t.borderColor=t.backgroundColor,s(),r()});break}case"bar":case"horizontalBar":{g.data.datasets=c(arguments),$.each(g.data.datasets,function(e,t){t.backgroundColor=p[o()],t.borderColor=t.backgroundColor}),s(),r();break}case"doughnut":case"pie":case"polarArea":{var m=c(arguments);$.each(m,function(e){var t={};t=m[e],t.backgroundColor=[],t.borderColor=[],$.each(t.data,function(){t.backgroundColor.push(p[o()])}),t.borderColor=t.backgroundColor,g.data.datasets.push(t),l=0});break}default:}var u=new Chart(d,g);d._chart=u}},this.cronapi.chart.createDataset=function(e,t,a){var n={};return n.label=e?e:"",n.data=Array.isArray(t)?t:t?JSON.parse(t):[],n.options=Array.isArray(a)?a:JSON.parse(a),n},this.cronapi.social={},this.cronapi.social.gup=function(e,t){t||(t=location.href),e=e.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var a="[\\?&]"+e+"=([^&#]*)",n=new RegExp(a),o=n.exec(t);return null==o?null:o[1]},this.cronapi.social.login=function(e,t,a){var n;this.cronapi.screen.showLoading(),this.cronapi.logic.isNullOrEmpty(this.cronapi.screen.getHostapp())?(this.cronapi.screen.hide(),this.cronapi.screen.notify("error","HostApp is Required")):this.cronapi.util.getURLFromOthers("POST","application/x-www-form-urlencoded",this.cronapi.screen.getHostapp()+""+"auth",this.cronapi.object.createObjectFromString(["{ \"username\": \"",e,"\" , \"password\": \"",t,"\" } "].join("")),this.cronapi.object.createObjectFromString(["{ \"X-AUTH-TOKEN\": \"",a,"\" } "].join("")),function(e){n=e,this.cronapi.screen.hide(),this.cronapi.util.setLocalStorage("_u",this.cronapi.object.serializeObject(n)),this.cronapi.screen.changeView("#/app/logged/home",[])}.bind(this),function(e){n=e,"403"==this.cronapi.object.getProperty(n,"status")||"401"==this.cronapi.object.getProperty(n,"status")?this.cronapi.screen.notify("error",this.cronapi.i18n.translate("LoginViewInvalidpassword",[])):this.cronapi.screen.notify("error",this.cronapi.object.getProperty(n,"responseJSON.message")),this.cronapi.screen.hide()}.bind(this))},this.cronapi.social.sociaLogin=function(e,t){var a=this,n=window.hostApp+"signin/"+e+"/";if(window.cordova&&cordova.InAppBrowser){var o="";(!0===t||"true"===t)&&(o=",clearcache=yes");var r=cordova.InAppBrowser.open(n,"_blank","location=no"+o);r.addEventListener("loadstart",function(e){-1<e.url.indexOf("_ctk")&&(r.close(),a.cronapi.social.login.bind(a)("#OAUTH#","#OAUTH#",a.cronapi.social.gup("_ctk",e.url)))})}else window.location.href="signin/"+e+"/"},this.cronapi.screen.getSelectedRowsGrid=function(e){var t=[],a=$("[ng-model=\""+e+"\"]").children().data("kendoGrid");if(a){var n=a.select();n.each(function(){var e=a.dataItem(this);t.push(e)})}return t},this.cronapi.screen.back=function(){history.back()},this.cronapi.regex={},this.cronapi.regex.extractTextByRegex=function(e,t,a){if(this.cronapi.logic.isNull(e)||this.cronapi.logic.isNull(t))return[];let n=null;n=null!=a&&"-"!==a?new RegExp(t,a):new RegExp(t);let o,r=[],c=null;for(;(o=n.exec(e))&&!(null!=c&&c==o.index);){let e=[];for(i=1;i<o.length;i++)e.push(o[i]);c=o.index,r.push(e)}return r},this.cronapi.regex.validateTextWithRegex=function(e,t,a){return!(this.cronapi.logic.isNull(e)||this.cronapi.logic.isNull(t))&&(null!=a&&"-"!==a?new RegExp(t,a).test(e):new RegExp(t).test(e))},this.cronapi.chat={},this.cronapi.chat.chatUserObj=function(e,t,a){return{id:e,name:t,iconUrl:a}},this.cronapi.chat.chatAttachmentObj=function(e,t,a,n,o,r){return{contentType:"heroCard",content:{title:e,subtitle:t,text:a,images:[{url:n,alt:r}],buttons:Array.isArray(o)?o:[o]}}},this.cronapi.chat.chatSuggestedActionObj=function(e,t){return{title:e,value:t}},this.cronapi.chat.getChatUser=function(e){let t=$("#"+e+" .k-chat").data("kendoChat");return t.getUser()},this.cronapi.chat.postChatMessage=function(e,t){let a=$("#"+e+" .k-chat").data("kendoChat");a.postMessage(t)},this.cronapi.chat.renderChatMessage=function(e,t,a){let n=$("#"+e+" .k-chat").data("kendoChat");n.renderMessage({type:"text",text:t},a)},this.cronapi.chat.renderChatAttachments=function(e,t,a,n){let o=$("#"+e+" .k-chat").data("kendoChat");o.renderAttachments({attachments:Array.isArray(a)?a:[a],attachmentLayout:n},t)},this.cronapi.chat.renderChatSuggestedActions=function(e,t){let a=$("#"+e+" .k-chat").data("kendoChat");a.renderSuggestedActions(Array.isArray(t)?t:[t])},this.cronapi.chat.renderChatUserTypingIndicator=function(e,t){let a=$("#"+e+" .k-chat").data("kendoChat");a.renderUserTypingIndicator(t)},this.cronapi.chat.clearChatUserTypingIndicator=function(e,t){let a=$("#"+e+" .k-chat").data("kendoChat");a.clearUserTypingIndicator(t)},this.cronapi.chat.removeChatTypingIndicator=function(e){let t=$("#"+e+" .k-chat").data("kendoChat");t.removeTypingIndicator()}}.bind(window)();
{
"name": "cronapi-js",
"version": "2.6.3",
"version": "2.6.6",
"description": "Public library for CronApp's users",

@@ -5,0 +5,0 @@ "main": "cronapi.js",

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc