(function(){"use strict";u8.Crm.ApplicationLauncher=function(e){$.extend(this,u8.Crm.ApplicationLauncher.defaults,e)};u8.Crm.ApplicationLauncher.defaults={};u8.services.add("applicationLauncher",u8.Crm.ApplicationLauncher);u8.using({texts:["launcher_texts"]});$.extend(u8.Crm.ApplicationLauncher.prototype,{launchDesktopApp:function(e,n){var i=this;function t(t){if(u8.session.environment.isEnterpriseVersion){if(!t){return}if(e.CommandLineArgs){e.CommandLineArgs=i.prepareCommand(e.CommandLineArgs)}t.launchDesktop({appPath:e.ApplicationPath,appCommand:e.CommandLineArgs,appType:e.UseCommandLine?3:1,windowStyle:e.WindowStyle}).done(function(e){if(e===""){u8.services.notification.info($t("TXT_launcher_texts_0"))}else{u8.services.notification.error(e)}if(n){n.resolve(e)}})}}this.prepareLaunch(t,e.unittest)},launchWebApp:function(e,n){var i=this;var t=$.Deferred();function r(t){if(u8.session.environment.isEnterpriseVersion){if(!t){return}e.URL=i.prepareCommand(e.URL);t.launchWebApp({appPath:e.URL,appType:2}).done(function(e){if(e===""){u8.services.notification.info($t("TXT_launcher_texts_1"))}else{u8.services.notification.error(e)}if(n){n.resolve(e)}})}}this.prepareLaunch(r,e.unittest)},prepareLaunch:function(e,n){u8.session.createBrowserPlugin({fileMonitoringOptions:this.fileMonitoringOptions,action:"documents",__unitTest:n},function(n,i){e(i&&i.plugin)})},prepareCommand:function(e){e=e.replace(/{crm.repId}/g,u8.session.identity.repId);e=e.replace(/{crm.repName}/g,u8.session.identity.repName);e=e.replace(/{crm.userName}/g,u8.session.identity.userName);e=e.replace(/{crm.isSuperUser}/g,u8.session.identity.isSuperUser);e=e.replace(/{crm.orgGroupId}/g,u8.session.identity.orgGroupId);e=e.replace(/{crm.tenantName}/g,u8.session.identity.tenantName);e=e.replace(/{crm.tenantNo}/g,u8.session.identity.tenantNo);e=e.replace(/{crm.stationNumber}/g,u8.session.environment.stationNumber);e=e.replace(/{crm.vertical}/g,u8.session.environment.vertical);e=e.replace(/{crm.applicationName}/g,u8.session.environment.applicationName);e=e.replace(/{crm.isOfflineClient}/g,u8.session.environment.isOfflineClient);return e}})})();