//>>built
define("mill/jssupport/jsApplication/_ApplicationBase",["dojo/_base/declare","dojo/_base/lang","dojo/_base/array","mill/jssupport/session"],function(k,d,l,m){return mill.registerAlias("app._ApplicationBase",k("mill.jssupport.jsApplication._ApplicationBase",null,{appID:null,applicationName:null,pageTitle:null,sync:null,anonymousHandler:null,handler:null,anonymousData:null,handlerData:null,controlSets:null,translationPrefix:null,addTranslationPrefix:null,_dataByIdent:function(){var a=null,c=null;return function(b,
e,g){a||(a=this.getUniqBatchItems(this.anonymousBatchItems()));"anonymousHandler"!==b&&!c&&d.isFunction(this.handlerBatchItems)&&(c=this.getUniqBatchItems(this.handlerBatchItems()));var f=null;l.forEach("anonymousHandler"===b?a:c||[],function(h,n){h.queryIdent!==e||d.isFunction(g)&&!g.call(null,h)||(null!==f&&mill.fieldValue(mill.fieldValue(window,"console"),"error").call(null,'queryIdent "'+e+'" duplication error found.'),f=n)});b=this["anonymousHandler"===b?"anonymousData":"handlerData"];return"number"!==
typeof f||!b||d.isArray(b)&&!b.length?[]:b[f].data}}(),anonymousDataByIdent:function(a){return this._dataByIdent("anonymousHandler",a,null)},combinedTranslationIdent:function(a){return a&&this.translationPrefix?this.translationPrefix+"."+a:a},queryApplicationData:function(a){mill.batchJson({handler:this.anonymousHandler,sync:!0,fetchAll:!0,queries:[{className:"TJSApplication",methodName:"Load",params:{ApplicationName:this.applicationName}}],load:a})},translationPattern:function(){var a=["Office.GDPRText"];
this.translationPrefix&&a.push(this.translationPrefix+".*");this.addTranslationPrefix&&(d.isString(this.addTranslationPrefix)?a.push(this.addTranslationPrefix):d.isArray(this.addTranslationPrefix)&&(a=a.concat(this.addTranslationPrefix)));return a},anonymousBatchItems:function(){return[{queryIdent:"translations",className:"TLanguageTranslation",query:[{part:0,name:"Owner"},{part:0,name:"Translation"},{part:0,name:"Language$N"},{part:1,name:"Owner",value:this.translationPattern().join(";")}]},{queryIdent:"internetResources",
className:"TInternetResource",query:[{part:0,name:"Name"},{part:0,name:"Url"},{part:2,name:"Name"}]},{queryIdent:"layoutActions",className:"TJSApplication",methodName:"BuildLayoutActions",params:{ID:this.appID,RemoteUser:null}}]},queryAnonymousData:function(){mill.batchJson({handler:this.anonymousHandler,sync:!0,fetchAll:!0,queries:this.getUniqBatchItems(this.anonymousBatchItems()),load:function(a){this.anonymousData=Array.prototype.slice.call(a)}.bind(this)})},handlerBatchItems:function(){return[]},
queryHandlerData:function(){return mill.batchJson({handler:this.handler,headers:{"Disable-Basic-Auth":"yes"},sync:"boolean"===typeof this.sync?this.sync:!1,queries:this.getUniqBatchItems(this.handlerBatchItems()),load:function(a){this.handlerData=Array.prototype.slice.call(a)}.bind(this)})},getUniqBatchItems:function(a){return a.reduce(function(c,b){return c.filter(function(e){return e.queryIdent===b.queryIdent}).length?c:c.concat([b])},[])},getRemoteUser:function(){return m.getRemoteUserID()}}))});