MibewAPI.prototype.checkFunction=function(a,b){if("undefined"==typeofa["function"]||""==a["function"])throwError("Cannot call for function with no name");if(b)for(varc=0;c<this.interaction.reservedFunctionNames.length;c++)if(a["function"]==this.interaction.reservedFunctionNames[c])throwError("'"+a["function"]+"' is reserved function name");if("object"!=typeofa.arguments)throwError("There are no arguments in '"+a["function"]+"' function");vard=0,f=this.interaction.getObligatoryArguments(a["function"]),
e;a:for(eina.arguments)for(c=0;c<f.length;c++)if(e==f[c]){d++;continuea}if(d!=f.length)throwError("Not all obligatory arguments are set in '"+a["function"]+"' function");};
MibewAPI.prototype.checkPackage=function(a){if("undefined"==typeofa.signature)throwError("Missed package signature");if("undefined"==typeofa.proto)throwError("Missed protocol version");if(a.proto!=this.protocolVersion)throwError("Wrong protocol version");if("undefined"==typeofa.async)throwError("'async' flag is missed");if("boolean"!=typeofa.async)throwError("Wrong 'async' flag value");if("object"!=typeofa.requests||!(a.requestsinstanceofArray)||0==a.requests.length)throwError("Empty requests set");
for(varb=0;b<a.requests.length;b++)this.checkRequest(a.requests[b])};MibewAPI.prototype.getResultFunction=function(a,b){"undefined"==typeofb&&(b=null);varc=null,d;for(dina)if(a.hasOwnProperty(d)&&"result"==a[d]["function"]){if(null!==c)throwError("Function 'result' already exists in functions list");c=a[d]}if(!0===b&&null===c)throwError("There is no 'result' function in functions list");if(!1===b&&null!==c)throwError("There is 'result' function in functions list");returnc};
MibewAPIExecutionContext.prototype.getArgumentsList=function(a){varb=a.arguments,c=a.arguments.references,d,f,e;for(einc)if(c.hasOwnProperty(e)){f=c[e];if("undefined"==typeofthis.functionsResults[f-1])throwError("Wrong reference in '"+a["function"]+"' function. Function #"+f+" does not call yet.");if("undefined"==typeofb[e]||""==b[e])throwError("Wrong reference in '"+a["function"]+"' function. Empty '"+e+"' argument.");d=b[e];if("undefined"==typeofthis.functionsResults[f-1][d])throwError("Wrong reference in '"+
a["function"]+"' function. There is no '"+d+"' argument in #"+f+" function results");b[e]=this.functionsResults[f-1][d]}returnb};MibewAPIExecutionContext.prototype.getResults=function(){returnthis.returnValues};
MibewAPIExecutionContext.prototype.storeFunctionResults=function(a,b){varc;if(b.errorCode)this.returnValues.errorCode=b.errorCode,this.returnValues.errorMessage=b.errorMessage||"";elsefor(vardina.arguments["return"])if(a.arguments["return"].hasOwnProperty(d)){c=a.arguments["return"][d];if("undefined"==typeofb[d])throwError("Variable with name '"+d+"' is undefined in the results of the '"+a["function"]+"' function");this.returnValues[c]=b[d]}this.functionsResults.push(b)};