import{r as p,h as t,H as i}from"./p-9f21f85f.js";import{i as s}from"./p-7b89f99a.js";import{D as o}from"./p-fb51892f.js";import{L as r,S as m}from"./p-c2c9e896.js";import{A as a}from"./p-2e3cec45.js";import{M as e}from"./p-3c7a3a90.js";import{g as j}from"./p-51389225.js";import{g as c,i as n}from"./p-a1d8623c.js";import{C as f}from"./p-84876749.js";import{T as h}from"./p-9db45c52.js";import{K as d,U as b}from"./p-32b6dc36.js";import{d as l,m as u}from"./p-499f0d68.js";import"./p-83f217d4.js";import"./p-e78d5616.js";import"./p-3968aca6.js";import"./p-105f7627.js";import"./p-d343a062.js";import"./p-7737f905.js";import"./p-0ff0ee91.js";import"./p-62d6b6a7.js";import"./p-0563ceba.js";import"./p-1e47e7bd.js";import"./p-31e77e7b.js";import"./p-825ab276.js";import"./p-6c8be41c.js";import"./p-9f31253b.js";import"./p-1187cc7c.js";import"./p-881a2bb8.js";import"./p-968ee2ec.js";import"./p-d27cb594.js";import"./p-902ec37a.js";import"./p-e929429b.js";import"./p-814af281.js";import"./p-03b520ca.js";import"./p-91c9569a.js";import"./p-a8c5be80.js";import"./p-6abc77c3.js";import"./p-efd6f539.js";import"./p-6af4d5e0.js";import"./p-5209de98.js";import"./p-19efc983.js";import"./p-bea38b23.js";import"./p-35c7f358.js";import"./p-0b1ac773.js";import"./p-ad6da9fe.js";import"./p-2da870dc.js";import"./p-38a21ba5.js";import"./p-6cf8ecf7.js";import"./p-a3d5ad34.js";import"./p-49638abf.js";import"./p-04501405.js";import"./p-e7b87b96.js";import"./p-56463912.js";import"./p-85ffb022.js";import"./p-d93d87fd.js";import"./p-33652948.js";import"./p-453d48c4.js";const A=class{constructor(t){p(this,t)}componentWillLoad(){const p={"Session-Token":"NTdiMzY3NjBlNjNiY2UxZWViMDAwMDA0"};c().token&&(p.Authorization=`Bearer ${c().token}`),this.storage=new f,this.logger=new r("MentornityConsoleAppContextInjector").setLevel("debug"),this.logger.infoGroup("componentWillLoad"),this.apiData=new o(l,{Authorization:p.Authorization}),this.apiKimlik=new d(u,p),this.apiUye=new b(u,p),this.apiSozluk=new m}componentDidLoad(){if(!n())return;const{membershipId:p}=j(location.pathname),t=p=>this.apiUye.getAppConfigOfMembership(p).then((p=>{this.appConfig=a.decode(p)}));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(p)return this.membership=s.find((t=>t._id===p)),void t(this.membership.config._id);this.membership=e.decode(s[0]),t(s[0].config._id)}}))}))}invalidateAppContext(){this.logger.debug("invalidateAppContext")}render(){return t(i,null,t(h.Provider,{state:{apiAtama:this.apiAtama,apiData:this.apiData,apiKimlik:this.apiKimlik,apiUye:this.apiUye,apiSozluk:this.apiSozluk,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}},t("slot",null)))}};s(A);export{A as mentornity_console_app_context_injector}