(()=>{function e(i,n,t){var o=this,c=t.defaultObject(),e=t.isDuplicate();function l(e){o.editingPolicy=_.cloneDeep(angular.copy(e))}_.assign(o,{$onChanges:function(e){e.id&&o.id&&(/\d+/.test(o.id)&&(e=>{n.detail(e).then(i.getResData).then(l)})(o.id),"new"===o.id)&&l(c);e.policy&&o.policy&&l(o.policy)},$onDestroy:function(){t.removeDuplicate()},$postLink:function(){e&&o.policyForm.$setDirty()},addRetentionRule:function(){o.editingPolicy.retentions.push({dataType:"*",fragmentType:"*",maximumAge:10,source:"*",type:"*",editable:void 0,isNew:!0})},addTenantOption:function(){o.editingPolicy.options.push({category:"",key:"",value:"",editable:void 0,isNew:!0})},ICON:t.ICON,onRemoveRetentionRule:function(e){_.pull(o.editingPolicy.retentions,e)},onRemoveTenantOption:function(e){_.pull(o.editingPolicy.options,e)},onSaveTitle:function(e){t.saveName(o.editingPolicy,e)},save:function(){n.save(o.editingPolicy).then(t.toList)},cancel:t.toList,remove:function(){t.removeConfirm(o.editingPolicy).then(t.toList)}})}e.$inject=["c8yBase","c8yTenantPolicies","c8yTenantPoliciesConfig"],angular.module("c8y.tenantPolicies").component("c8yTenantPolicyDetail",{templateUrl:":::PLUGIN_PATH:::/tenantPolicyDetail/tenantPolicyDetail.html",controller:e,controllerAs:"vm",bindings:{id:"<",policy:"<"}})})();