System.register(["./p-343b3b10.system.js","./p-2ec5164f.system.js","./p-0aeb0fcc.system.js","./p-fed348c1.system.js","./p-ebdd1444.system.js","./p-a56cdd14.system.js"],(function(t){"use strict";var e,n,r,i,o,s;return{setters:[function(t){e=t.r;n=t.h;r=t.H},function(t){i=t.p},function(t){o=t.S},function(t){s=t.D},function(){},function(){}],execute:function(){var c=function(){function t(t,e,n){if(n===void 0){n=""}this.devingenApi=t;this.workspaceId=e;this.productType=n}t.prototype.getInitialData=function(){return this.getData()};t.prototype.getData=function(){var t=this;var e=this,n=e.productType,r=e.workspaceId;return new Promise((function(e){t.devingenApi.getProducts({productType:n,workspaceId:r}).then((function(t){return e(t.results.sort((function(t,e){return t.name.localeCompare(e.name)})))}))}))};t.prototype.getQuickSearchText=function(){return""};t.prototype.isQuickSearchEnabled=function(){return false};t.prototype.setInitialData=function(t){};t.prototype.setQuickSearchText=function(t){};return t}();var a=t("devingen_product_root_kimlik",function(){function t(t){var r=this;e(this,t);this.renderSettingsForm=function(){if(!r.showSettingsForm){return null}return n("dvn-dialog",{shown:true,onDismiss:function(){return r.showSettingsForm=false},clip:false},n("doldurma-form",{fields:[new o("databaseProduct","Database",[],"","select").setDataProvider(new c(r.apiDevingen,r.product.workspace._id,"taban")).setDataAdapter(new s("name","_id")).require()],onSubmit:r.onSubmitEditSettingsForm,submitButtonLabel:"Save"}))};this.onSubmitEditSettingsForm=function(t){var e=t.detail.values;if(r.productSettings);else{r.apiDevingen.createProductSettingsKimlik(r.product._id,e.databaseProduct,"",{}).then((function(){r.fetchProductSettings();r.showSettingsForm=false})).catch((function(t){return r.error=t}))}}}t.prototype.componentWillLoad=function(){this.fetchProductSettings()};t.prototype.fetchProductSettings=function(){var t=this;this.apiDevingen.findProductSettingsKimlik(this.product._id).then((function(e){t.productSettings=e;t.fetchDatabaseProductSettings()})).catch((function(e){var n;console.log("ahoy",e);if(((n=e===null||e===void 0?void 0:e.data)===null||n===void 0?void 0:n.error)==="product-setting-not-found-for-product"){console.log(1);t.showSettingsForm=true}else{t.error=e}}))};t.prototype.fetchDatabaseProductSettings=function(){var t=this;this.apiDevingen.findProductSettingsTaban(this.productSettings.databaseProduct._id).then((function(e){return t.databaseProductSettings=e})).catch((function(e){console.log(e);t.error=e}))};t.prototype.render=function(){var t=this,e=t.error,o=t.databaseProductSettings;if(e){return n(r,null,n("div",{class:"d-flex justify-content-center"},n("devingen-error-card",{error:e,message:"Unexpected error occurred."})))}if(!o){return n(r,{class:"d-flex justify-content-center"},n("dvn-progress",{indefinite:true}),this.renderSettingsForm())}return n(r,{class:"d-flex flex-grow-1 flex-column"},n("kimlik-home",{apiEndpoint:"".concat(i.kimlik,"/").concat(o.databaseName),apiHeaders:this.apiHeaders}),this.renderSettingsForm())};return t}())}}}));