import{r as registerInstance,h,H as Host}from"./index-55faf181.js";import{i as injectNotifier}from"./index-7884b902.js";import{D as DataApiImpl}from"./dataApi-abfa358d.js";import{L as Logger}from"./utils-ee3626ab.js";import{A as AppConfig}from"./app-config-d490f9ae.js";import{M as Membership}from"./membership-61c4a2f7.js";import{g as getRouteParams}from"./route-8be91bee.js";import{g as getSessionData,i as isUserLoggedIn}from"./index-36f6c00a.js";import{C as CookieStorage}from"./cookie-93ea205f.js";import{T as Tunnel}from"./context-8273b228.js";import{d as dataApiEndpoint,K as KimlikApiMentornity,m as mentornityApiEndpoint,U as UyeApiMentornity}from"./uye-9ce5cbf6.js";import"./state-tunnel-04c0b67a.js";import"./kimlikApi-7350588e.js";import"./data-transfer-field-918730a3.js";import"./BaseField-461b6d0c.js";import"./filter-cbaa3d7d.js";import"./data-model-f5160369.js";import"./membership-config-a51a5232.js";import"./table-config-5c917348.js";import"./FieldModelGenerator-1ee7fda2.js";import"./index-6a1cf9c1.js";import"./index-403e215e.js";import"./date-ce777316.js";import"./index-083a6906.js";import"./index-fa1db470.js";import"./string-3065a411.js";import"./User-d2ee8b71.js";import"./index-d3bd30bd.js";import"./_commonjsHelpers-27f122dd.js";import"./spaces-460b4232.js";import"./table-list-view-config-8e775e94.js";import"./index-ebde6a66.js";import"./attachment-32decf79.js";import"./InterceptorHandler-6474bcf4.js";import"./view-config-39fd369a.js";import"./detail-view-config-dafcc086.js";import"./models-22fcdeab.js";import"./form-view-config-00abddd1.js";import"./ValidatorLength-f56a7c14.js";import"./actions-b9a0f808.js";import"./instance-46ab1e99.js";import"./list-fetch-state-623a5ba4.js";import"./index-da37d89d.js";import"./nested-395a4cd4.js";import"./time-zones-cf1e6113.js";var MentornityConsoleAppContextInjector=function(){function i(i){registerInstance(this,i)}i.prototype.componentWillLoad=function(){var i={"Session-Token":"NTdiMzY3NjBlNjNiY2UxZWViMDAwMDA0"};if(getSessionData().token){i["Authorization"]="Bearer "+getSessionData().token}this.storage=new CookieStorage;this.logger=new Logger("MentornityConsoleAppContextInjector").setLevel("debug");this.logger.infoGroup("componentWillLoad");this.apiData=new DataApiImpl(dataApiEndpoint,{Authorization:i["Authorization"]});this.apiKimlik=new KimlikApiMentornity(mentornityApiEndpoint,i);this.apiUye=new UyeApiMentornity(mentornityApiEndpoint,i)};i.prototype.componentDidLoad=function(){var i=this;if(!isUserLoggedIn()){return}var t=getRouteParams(location.pathname).membershipId;var e=function(t){return i.apiUye.getAppConfigOfMembership(t).then((function(t){i.appConfig=AppConfig.decode(t)}))};this.apiKimlik.getSession().then((function(o){i.user=o.user;i.apiUye.getMembershipsOfUser(o.user._id).then((function(o){var n=o.results;i.memberships=n;if(!n||n.length===0){return}if(t){i.membership=n.find((function(i){return i._id===t}));e(i.membership.config._id);return}i.membership=Membership.decode(n[0]);e(n[0].config._id)}))}))};i.prototype.invalidateAppContext=function(){this.logger.debug("invalidateAppContext")};i.prototype.render=function(){var i=this;return h(Host,null,h(Tunnel.Provider,{state:{apiAtama:this.apiAtama,apiData:this.apiData,apiKimlik:this.apiKimlik,apiUye:this.apiUye,logger:this.logger,storage:this.storage,appContextInvalidator:function(){return i.invalidateAppContext()},appConfig:this.appConfig,membership:this.membership,memberships:this.memberships,notifier:this.notifier,user:this.user,theme:this.theme}},h("slot",null)))};return i}();injectNotifier(MentornityConsoleAppContextInjector);export{MentornityConsoleAppContextInjector as mentornity_console_app_context_injector};