import{r as e,h as i,H as t,g as s}from"./p-cb5076d4.js";import{C as r}from"./p-1c06ab51.js";import"./p-06588791.js";import"./p-944da115.js";import"./p-d343a062.js";import{c as a,f as o}from"./p-c4bbdd1e.js";import{g as n,M as p}from"./p-9043df2a.js";import{g as d,c as m,d as c,e as l,m as f,a as v}from"./p-3a5f9c0f.js";import{T as u}from"./p-0db2169b.js";import{C as g}from"./p-b13f2de3.js";import{D as w}from"./p-2dde605b.js";import{T as h}from"./p-4f99fb23.js";import{T as b}from"./p-f455c3c2.js";import{d as j,e as y,c as C,f as D,a as I}from"./p-84720732.js";import"./p-b3edc8b2.js";import"./p-814af281.js";import"./p-acad969c.js";import"./p-eebad85b.js";import"./p-0e4ae084.js";import"./p-8a308033.js";import"./p-3b35e507.js";import"./p-1c5c6afa.js";import"./p-97c18602.js";import"./p-b0970d03.js";import"./p-234c1f97.js";import"./p-d50d0ec8.js";import"./p-ecbaf6d8.js";import"./p-c705c477.js";import"./p-d27cb594.js";import"./p-56d4255d.js";import"./p-cb860bcb.js";import"./p-73aa5f56.js";import"./p-138d8bf9.js";import"./p-e929429b.js";import"./p-27da9105.js";function k(e){if(e)return b.decode({_id:"user-card-list-page-available-time-picker-view",table:n(e),successNavigationAction:{type:"navigation",direction:"forward",name:"open-meeting-detail-after-creation",params:{conversionConfig:{"item._id":"meetingId"}}}})}const T=class{constructor(i){e(this,i)}async componentWillLoad(){const{isZoomAuthenticated:e,language:i,timeFormat:t,timeZone:s,viewedUserRole:n}=this;r.setLocale(i),r.setTimeFormat(t),r.setTimeZone(s);const{context:v,headers:b}=d(this.groupId);this.mentornityCookieContext=v,this.user=m(v.userId),this.userSettings=c(t,s,i,e),this.membership=l(v.role),this.mentornityBridgeApi=new p(f,v,b);const k=a(f,b),T=await k.getOrganisationConfig(v.organisationId).catch((e=>this.error=e));if(!T)return;const U=o.decode(T);this.organisationConfig=U,this.mentornityBridgeApi.organisationConfig=U,this.pairOverviewViewConfig=function(e,i,t,s){if(!t)return null;const r=j(t,s,e.role),a=[...y(t,s,e.role,!0,4),{customViewTag:"mentornity-schedule-meeting-button-on-card"}],o=[],n=[{field:new u("search","Search")},...C([...D(t,s).filter((e=>!["title","bio"].includes(e.id))),...I(e.role,t)])];return n.forEach((e=>{var i;const t=e.fieldId||(null===(i=e.field)||void 0===i?void 0:i.id);t&&o.push({fieldId:t,width:"200px"})})),g.decode({_id:`${s}-card-list`,ui:{quickSearch:{fields:n,fieldUIConfigs:o},main:{cardViewConfig:{header:{cover:{size:100},image:{fieldId:"user.imageUrl",placeholderFieldId:"user.initials",size:72},title:{fieldId:"user.name"}},body:{fields:a}}}},table:{fields:r,roleName:s,name:`${s}-card-list`},query:{fields:a}})}(v,0,U,n),this.userDetailDialogViewConfig=function(e,i,t){if(!i)return;const s=j(i,t,e.role),r=y(i,t,e.role,!1),{organisationId:a}=e;return w.decode({table:h.decode({base:a,name:"mentee"===t?"mentees":"mentors"}),ui:{fields:s,cardConfig:{header:{title:{fieldId:"name"},actions:[{ui:{label:"Go to Profile Page",name:"go-to-profile-page"}}]},body:{fields:r}}}})}(v,U,n)}componentDidRender(){var e,i;null===(i=null===(e=this.el.querySelector("dvn-app-view-list-view-card"))||void 0===e?void 0:e.retainPosition)||void 0===i||i.call(e)}onAction(e){const i=e.detail;switch(i.name){case"schedule-meeting":this.userToCreateMeeting=i.params.item;break;case"view-details":this.userToViewDetails=i.params.item;break;case"go-to-profile-page":window.dispatchEvent(new CustomEvent("dvn.mentornity-user-card-list-wrapper.open-profile-page",{detail:{user:i.params.item}}));break;case"open-meeting-detail-after-creation":window.dispatchEvent(new CustomEvent("dvn.mentornity-user-card-list-wrapper.open-meeting-page",{detail:{meetingId:i.params.meetingId}}))}}render(){const{membership:e,mentornityBridgeApi:s,organisationConfig:r,pairOverviewViewConfig:a,viewedUserRole:o,user:n,userSettings:p,userToCreateMeeting:d,userToViewDetails:m,userDetailDialogViewConfig:c}=this;return a?i(t,{style:{display:"flex",flexDirection:"column",height:"100%",overflow:"hidden"}},i("mentornity-root-wrapper",null,i("dvn-app-view-list-view-card",{apiData:s,view:a}),d&&i("dvn-dialog",{raw:!0,shown:!0,onDismiss:()=>{this.userToCreateMeeting=void 0}},i("dvn-card-header",{title:this.userToCreateMeeting.name}),i("dvn-app-view-takvim-available-time-picker-view",{apiUye:s,apiTakvim:s,user:n,userSettings:p,membership:e,params:{viewedUserMembership:d,viewedUserMembershipConfig:v(o)},view:k(r)})),m&&i("dvn-dialog",{raw:!0,shown:!0,onDismiss:()=>this.userToViewDetails=void 0},i("dvn-app-view-detail-view-card",{apiData:s,id:"user-page",params:{itemId:m._id},view:c})))):i("div",{class:"d-flex justify-content-center pt-3"},i("dvn-progress",{indefinite:!0}))}get el(){return s(this)}};export{T as mentornity_user_card_list_wrapper}