var __awaiter=this&&this.__awaiter||function(e,t,r,n){function i(e){return e instanceof r?e:new r((function(t){t(e)}))}return new(r||(r=Promise))((function(r,a){function o(e){try{c(n.next(e))}catch(e){a(e)}}function s(e){try{c(n["throw"](e))}catch(e){a(e)}}function c(e){e.done?r(e.value):i(e.value).then(o,s)}c((n=n.apply(e,t||[])).next())}))};var __generator=this&&this.__generator||function(e,t){var r={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},n,i,a,o;return o={next:s(0),throw:s(1),return:s(2)},typeof Symbol==="function"&&(o[Symbol.iterator]=function(){return this}),o;function s(e){return function(t){return c([e,t])}}function c(o){if(n)throw new TypeError("Generator is already executing.");while(r)try{if(n=1,i&&(a=o[0]&2?i["return"]:o[0]?i["throw"]||((a=i["return"])&&a.call(i),0):i.next)&&!(a=a.call(i,o[1])).done)return a;if(i=0,a)o=[o[0]&2,a.value];switch(o[0]){case 0:case 1:a=o;break;case 4:r.label++;return{value:o[1],done:false};case 5:r.label++;i=o[1];o=[0];continue;case 7:o=r.ops.pop();r.trys.pop();continue;default:if(!(a=r.trys,a=a.length>0&&a[a.length-1])&&(o[0]===6||o[0]===2)){r=0;continue}if(o[0]===3&&(!a||o[1]>a[0]&&o[1]<a[3])){r.label=o[1];break}if(o[0]===6&&r.label<a[1]){r.label=a[1];a=o;break}if(a&&r.label<a[2]){r.label=a[2];r.ops.push(o);break}if(a[2])r.ops.pop();r.trys.pop();continue}o=t.call(e,r)}catch(e){o=[6,e];i=0}finally{n=a=0}if(o[0]&5)throw o[1];return{value:o[0]?o[1]:void 0,done:true}}};import{r as registerInstance,h,H as Host}from"./index-ecdfb761.js";import{p as prod}from"./services-63217112.js";var DevingenProductApiKeysPage=function(){function e(e){var t=this;registerInstance(this,e);this.fetchProduct=function(){return __awaiter(t,void 0,void 0,(function(){var e,t;var r=this;return __generator(this,(function(n){switch(n.label){case 0:e=this.match.params.id;t=this;return[4,this.apiDevingen.getProduct(e).catch((function(e){return r.error=e}))];case 1:t.product=n.sent();return[2]}}))}))};this.renderHeader=function(){var e;return h("div",{class:"container"},h("div",{class:"row"},h("div",{class:"col d-flex align-items-center pt-2 pb-3"},h("h2",{class:"m-0"},(e=t.product)===null||e===void 0?void 0:e.name," / API Key Settings"))))};this.generatePredefinedScopes=function(){var e=t.product;switch(e.type){case"damga":return[{label:"Target Groups - Write",value:"dri:das:products:".concat(e._id,":damga:target-groups:*.write")}];case"sepet":return[{label:"Files - Write",value:"dri:das:products:".concat(e._id,":sepet:files:*.write")},{label:"Buckets - Write",value:"dri:das:products:".concat(e._id,":sepet:buckets:*.write")}]}}}e.prototype.componentWillLoad=function(){this.fetchProduct()};e.prototype.render=function(){var e=this.product;if(!e){return h("div",{class:"d-flex justify-content-center pt-3"},h("dvn-progress",{indefinite:true}))}var t={Authorization:this.apiKimlik.api.getDefaults().headers["Authorization"],"devingen-product-id":e._id};return h(Host,{class:"d-block"},this.renderHeader(),h("kimlik-home",{apiEndpoint:"".concat(prod.kimlik,"/").concat(prod.base),apiHeaders:t,shownTabs:["api-keys"],preSelectedTab:"api-keys",predefinedScopesForAPIKeys:this.generatePredefinedScopes(),allowCustomScopesForAPIKeys:false}))};return e}();export{DevingenProductApiKeysPage as devingen_product_api_keys_page};