(()=>{function n(n,e,t){a.$inject=["$q","c8yBase","c8ySettings","c8yPermissions","c8yTenant"],o.$inject=["$scope"];var i={path:"configuration",icon:"sliders",view:{template:'<c8y-platform-configuration options-groups="optionsGroups"></c8y-platform-configuration>',controller:o},requiresAnyRole:["ROLE_OPTION_MANAGEMENT_READ"],showIf:["c8yTenant",function(n){return n.isCurrentUserTopTenant()}]};function o(n){n.optionsGroups=["passwordsOptions","twoFactorAuthenticationOptions","supportLinkOptions","passwordResetOptions","supportUserOptions","emailServerOptions","dataExportOptions","storageLimitOptions","suspendingTenantsOptions"]}var u="configuration",c=["credentials.email.password"];return{$get:a,init:function(){r(),e.addNavigation({name:t("Configuration"),parent:t("Settings"),path:i.path,icon:i.icon,showIfPermissions:{anyRole:i.requiresAnyRole},showIf:i.showIf})},hookViews:r};function r(){n.when("/".concat(i.path),i.view)}function a(r,n,a,e,t){var s;return r.all({eeTenant:t.isEnterpriseEditionTenant(),managementTenant:t.isCurrentUserTopTenant()}).then(function(n){var e=n.eeTenant;s=e&&!n.managementTenant}),{getConfiguration:function(){return a.listAllBy(u).then(function(n){var e={};return n.forEach(function(n){e[n.key]=n.value}),e})},saveConfiguration:function(n,e){return(n=>_.reduce(n,function(n,e){var t=_.constant(r.when()),i=_.isNull(e.newValue),o=""===e.newValue;return i||o&&(i=e.key,!s||!c.includes(i))?_.isUndefined(e.oldValue)||(t=a.deleteOption):t=a.updateOption,n.then(_.partial(t,{category:u,key:e.key,value:e.newValue}))},r.when()))(((n,o)=>(n=_.cloneDeep(n),_(n).map(function(n,e){var t,i=_.get(o,[e]);return t=_.isEqual(JSON.stringify(i),JSON.stringify(n))?t:{key:e,oldValue:i,newValue:n}}).filter().value()))(n,e))}}}}n.$inject=["c8yViewsProvider","c8yNavigatorProvider","gettext"],angular.module("c8y.platformConfiguration").provider("c8yPlatformConfigurationUi",n)})();