import{r as t,h as p,H as i}from"./p-cb5076d4.js";import{i as s}from"./p-bfaa9282.js";import{D as o}from"./p-2ce6bf5b.js";import{L as r}from"./p-7fb9a2f8.js";import{A as m}from"./p-a2aae1b0.js";import{M as a}from"./p-ecbaf6d8.js";import{g as e}from"./p-51389225.js";import{g as j,i as n}from"./p-9a45414f.js";import{C as d}from"./p-138d8bf9.js";import{T as f}from"./p-6194577d.js";import{d as c,K as h,m as b,U as l}from"./p-2850329f.js";import"./p-83f217d4.js";import"./p-06588791.js";import"./p-944da115.js";import"./p-eebad85b.js";import"./p-d343a062.js";import"./p-d50d0ec8.js";import"./p-c705c477.js";import"./p-4f99fb23.js";import"./p-0e4ae084.js";import"./p-8a308033.js";import"./p-0db2169b.js";import"./p-3b35e507.js";import"./p-1c5c6afa.js";import"./p-97c18602.js";import"./p-d27cb594.js";import"./p-56d4255d.js";import"./p-e929429b.js";import"./p-814af281.js";import"./p-cd2f59dd.js";import"./p-7f474e9b.js";import"./p-b0970d03.js";import"./p-234c1f97.js";import"./p-35c7f358.js";import"./p-27da9105.js";import"./p-2dde605b.js";import"./p-5b69721c.js";import"./p-61301881.js";import"./p-ad6da9fe.js";import"./p-6cf8ecf7.js";import"./p-c4bbdd1e.js";import"./p-5eec4552.js";import"./p-3bdf4c50.js";import"./p-f97ba04a.js";import"./p-453d48c4.js";const u=class{constructor(p){t(this,p)}componentWillLoad(){const t={"Session-Token":"NTdiMzY3NjBlNjNiY2UxZWViMDAwMDA0"};j().token&&(t.Authorization=`Bearer ${j().token}`),this.storage=new d,this.logger=new r("MentornityConsoleAppContextInjector").setLevel("debug"),this.logger.infoGroup("componentWillLoad"),this.apiData=new o(c,{Authorization:t.Authorization}),this.apiKimlik=new h(b,t),this.apiUye=new l(b,t)}componentDidLoad(){if(!n())return;const{membershipId:t}=e(location.pathname),p=t=>this.apiUye.getAppConfigOfMembership(t).then((t=>{this.appConfig=m.decode(t)}));this.apiKimlik.getSession().then((i=>{this.user=i.user,this.apiUye.getMembershipsOfUser(i.user._id).then((i=>{const s=i.results;if(this.memberships=s,s&&0!==s.length){if(t)return this.membership=s.find((p=>p._id===t)),void p(this.membership.config._id);this.membership=a.decode(s[0]),p(s[0].config._id)}}))}))}invalidateAppContext(){this.logger.debug("invalidateAppContext")}render(){return p(i,null,p(f.Provider,{state:{apiAtama:this.apiAtama,apiData:this.apiData,apiKimlik:this.apiKimlik,apiUye:this.apiUye,logger:this.logger,storage:this.storage,appContextInvalidator:()=>this.invalidateAppContext(),appConfig:this.appConfig,membership:this.membership,memberships:this.memberships,notifier:this.notifier,user:this.user,theme:this.theme}},p("slot",null)))}};s(u);export{u as mentornity_console_app_context_injector}