System.register(["./p-343b3b10.system.js","./p-ece63a69.system.js","./p-5f7bc72e.system.js","./p-a56cdd14.system.js","./p-da593370.system.js"],(function(e){"use strict";var t,i,s,n;return{setters:[function(e){t=e.r;i=e.h;s=e.H},function(e){n=e.A},function(){},function(){},function(){}],execute:function(){var o=function(){function e(e,t,i){var s=this;if(t===void 0){t={}}if(i===void 0){i={}}this.createBucket=function(e){return s.api.post("buckets",e)};this.getBuckets=function(){return s.api.get("buckets")};this.getBucket=function(e){return s.api.get("buckets/".concat(e))};this.getBucketVersionList=function(e){return s.api.get("buckets/".concat(e,"/versions"))};this.updateBucket=function(e,t){return s.api.put("buckets/".concat(e),t)};this.deleteBucket=function(e){return s.api.delete("buckets/".concat(e))};this.uploadFile=function(e,t,i){var n=new FormData;n.append(t,i);return s.api.post(e,n)};this.getFileList=function(e,t,i){var n={};if(i){n["bucket-version"]=i}return s.api.get("".concat(e,"/").concat(t),{},n)};this.deleteFileOrFolder=function(e,t){return s.api.delete("".concat(e,"/").concat(t))};this.api=new n(e,t);this.api.axios.defaults.params=i}return e}();var a=e("sepet_home",function(){function e(e){var i=this;t(this,e);this.showFileExplorer=false;this.fileExplorerPath="";this.showDeleteConfirmation=false;this.showItemForm=false;this.listKey=1;this.onClickAddNewItem=function(){return i.showItemForm=true};this.onConfirmDeleteItem=function(){i.isDeletePending=true;i.apiSepet.deleteBucket(i.selectedItem._id).then(i.invalidate).catch(i.onDeleteFail).finally((function(){return i.isDeletePending=false}))};this.onDeleteFail=function(e){var t,s,n,o;if(((t=e.data)===null||t===void 0?void 0:t.error)==="target-group-used-in-load-balancers"){i.deleteErrorMessage="Target group is being used by load balancers ".concat((s=e.data.loadBalancers)===null||s===void 0?void 0:s.map((function(e){return e.name})).join(", "),".")}else if(((n=e.data)===null||n===void 0?void 0:n.error)==="load-balancer-used-in-domains"){i.deleteErrorMessage="Load balancer is being used by domains ".concat((o=e.data.domains)===null||o===void 0?void 0:o.map((function(e){return e.domain})).join(", "),".")}};this.dismissItemFormDialog=function(){i.showItemForm=false;i.selectedItem=undefined};this.dismissDeleteConfirmationDialog=function(){i.showDeleteConfirmation=false;i.selectedItem=undefined;i.deleteErrorMessage=undefined};this.invalidate=function(){i.listKey+=1;i.showItemForm=false;i.showDeleteConfirmation=false;i.selectedItem=undefined;i.deleteErrorMessage=undefined}}e.prototype.componentWillLoad=function(){this.apiSepet=new o(this.apiEndpoint,this.apiHeaders,this.apiQueryParams)};e.prototype.onAction=function(e){e.stopImmediatePropagation();var t=e.detail;switch(t.name){case"open":{this.showFileExplorer=true;this.selectedItem=t.params.item;this.fileExplorerPath=this.selectedItem.folder;break}case"delete":{this.showDeleteConfirmation=true;this.selectedItem=t.params.item;break}case"edit":{this.showItemForm=true;this.selectedItem=t.params.item;break}}};e.prototype.render=function(){var e=this;var t=this.apiSepet;if(this.showFileExplorer){return i(s,{class:"d-flex flex-column",style:{minHeight:"calc(100vh - 50px)"}},i("sepet-file-explorer",{apiSepet:t,item:this.selectedItem,onDismissFileExplorer:function(){e.showFileExplorer=false;e.selectedItem=undefined;e.fileExplorerPath=""}}))}return i(s,{class:"d-flex flex-column",style:{minHeight:"calc(100vh - 50px)"}},i("div",{class:"container"},i("div",{class:"row"},i("div",{class:"col-sm-12"},i("div",{class:"d-flex align-items-center mb-3"},i("div",{class:"flex-grow-1"},"Buckets"),i("dvn-button",{onClick:this.onClickAddNewItem,leaned:true},"New Bucket"))))),i("sepet-bucket-list",{key:this.listKey,apiSepet:t}),this.showItemForm&&i("dvn-dialog",{shown:true,onDismiss:this.dismissItemFormDialog},i("sepet-bucket-form",{apiSepet:t,onChange:this.invalidate,item:this.selectedItem})),this.showDeleteConfirmation&&i("dvn-dialog",{shown:true,onDismiss:this.dismissDeleteConfirmationDialog,title:"Deletion"},i("p",null,"Are you sure to delete this item? This action cannot be undone."),this.deleteErrorMessage&&i("p",{class:"text-danger"},this.deleteErrorMessage),i("div",{slot:"actions"},i("dvn-button",{view:"flat",onClick:this.dismissDeleteConfirmationDialog},"Cancel"),i("dvn-button",{tint:"danger",disabled:this.isDeletePending,progressing:this.isDeletePending,onClick:this.onConfirmDeleteItem},"Yes, Delete"))))};return e}())}}}));