System.register(["./p-343b3b10.system.js","./p-d3ef0b9c.system.js","./p-b195a819.system.js","./p-5f7bc72e.system.js","./p-a56cdd14.system.js","./p-da593370.system.js"],(function(e){"use strict";var i,t,s,n,l;return{setters:[function(e){i=e.r;t=e.h;s=e.F;n=e.H},function(e){l=e.K},function(){},function(){},function(){},function(){}],execute:function(){var o=[{label:"Users",value:"users"},{label:"API Keys",value:"api-keys"},{label:"SAML Configs",value:"saml-configs"}];var a={"api-keys":"API Key","saml-configs":"SAML Config"};var m=e("kimlik_home",function(){function e(e){var t=this;i(this,e);this.selectedTab="saml-configs";this.showDeleteConfirmation=false;this.showItemForm=false;this.listKey=1;this.onClickAddNewItem=function(){return t.showItemForm=true};this.onConfirmDeleteItem=function(){var e;if(t.selectedTab==="api-keys"){e=t.apiKimlik.deleteApiKey(t.selectedItem._id)}else if(t.selectedTab==="saml-configs"){e=t.apiKimlik.deleteSAMLConfig(t.selectedItem._id)}t.isDeletePending=true;e===null||e===void 0?void 0:e.then(t.invalidate).catch(t.onDeleteFail).finally((function(){return t.isDeletePending=false}))};this.onDeleteFail=function(e){t.deleteErrorMessage="Unexpected error."};this.dismissItemFormDialog=function(){t.showItemForm=false;t.selectedItem=undefined};this.dismissDeleteConfirmationDialog=function(){t.showDeleteConfirmation=false;t.selectedItem=undefined;t.deleteErrorMessage=undefined};this.invalidate=function(){t.listKey+=1;t.showItemForm=false;t.showDeleteConfirmation=false;t.selectedItem=undefined;t.deleteErrorMessage=undefined}}e.prototype.componentWillLoad=function(){this.apiKimlik=new l(this.apiEndpoint,this.apiHeaders)};e.prototype.onAction=function(e){e.stopImmediatePropagation();var i=e.detail;switch(i.name){case"delete":{this.showDeleteConfirmation=true;this.selectedItem=i.params.item;break}case"edit":{this.showItemForm=true;this.selectedItem=i.params.item;break}}};e.prototype.render=function(){var e=this;var i=this,l=i.apiKimlik,m=i.selectedTab;return t(n,{class:"d-flex flex-column",style:{minHeight:"calc(100vh - 50px)"}},t("div",{class:"container"},t("div",{class:"row"},t("div",{class:"col-sm-12"},t("div",{class:"d-flex align-items-center"},t("div",{class:"flex-grow-1"},t("dvn-menu",{orientation:"horizontal"},o.map((function(i){var s=i.label,n=i.value;return t("dvn-menu-item",{highlighted:n===m,onClick:function(){return e.selectedTab=n}},s)})))),a[m]&&t("dvn-button",{onClick:this.onClickAddNewItem},"New ",a[m]))))),m==="users"&&t(s,null,t("kimlik-user-list",{key:this.listKey,apiKimlik:l})),m==="api-keys"&&t(s,null,t("kimlik-api-key-list",{key:this.listKey,apiKimlik:l}),this.showItemForm&&t("dvn-dialog",{shown:true,onDismiss:this.dismissItemFormDialog},t("kimlik-api-key-form",{apiKimlik:l,onChange:this.invalidate,item:this.selectedItem}))),m==="saml-configs"&&t(s,null,t("kimlik-saml-config-list",{key:this.listKey,apiKimlik:l}),this.showItemForm&&t("dvn-dialog",{shown:true,onDismiss:this.dismissItemFormDialog},t("kimlik-saml-config-form",{apiKimlik:l,onChange:this.invalidate,item:this.selectedItem}))),this.showDeleteConfirmation&&t("dvn-dialog",{shown:true,onDismiss:this.dismissDeleteConfirmationDialog,title:"Deletion"},t("p",null,"Are you sure to delete this item? This action cannot be undone."),this.deleteErrorMessage&&t("p",{class:"text-danger"},this.deleteErrorMessage),t("div",{slot:"actions"},t("dvn-button",{view:"flat",onClick:this.dismissDeleteConfirmationDialog},"Cancel"),t("dvn-button",{tint:"danger",disabled:this.isDeletePending,progressing:this.isDeletePending,onClick:this.onConfirmDeleteItem},"Yes, Delete"))))};return e}())}}}));