import{r as e,c as t,h as i,H as s,g as n}from"./p-1ea36ff3.js";import{a,R as r}from"./p-b2c002e9.js";import"./p-cd1b0e39.js";import{R as o}from"./p-6eb29778.js";import{T as d}from"./p-681f800a.js";import{V as m}from"./p-a2aae1b0.js";import{t as c}from"./p-f3a4e693.js";import{D as l}from"./p-3b35e507.js";import{a as h}from"./p-234c1f97.js";import"./p-eebad85b.js";import"./p-d50d0ec8.js";let g=class{constructor(i){e(this,i),this.action=t(this,"action",7),this.meetingsByIdentifiers={}}async invalidate(e){this.fetchMeetings()}componentDidLoad(){this.fetchMeetings()}async fetchMeetings(){var e;const{pairConfig:t,userId:i,sessionUserId:s}=this,n=await this.apiTakvim.getMeetingsOfUser(null===(e=t.calendarConfig)||void 0===e?void 0:e._id,[s,i]),a={};n.results.forEach((e=>{a[e.meetingType]=e})),this.meetingsByIdentifiers=a}render(){const{shownMeetingConfig:e,size:t,userRefFieldId:n}=this;return i(s,{class:"mb-3"},t<a.Medium?this.renderList():i("dvn-card",{leaned:!0,bodyLeaned:!0,elevation:0},this.renderList()),i("dvn-dialog",{title:e?e.name:void 0,shown:!!e,onDismiss:()=>this.shownMeetingConfig=void 0},e&&i("dvn-markdown",{content:e.specifications[n].description})))}renderList(){const{i18n:e,meetingsByIdentifiers:t,pairConfig:s,size:n}=this,r=n<a.Medium?"atama-structured-pair-overview-meeting-row-intense":"atama-structured-pair-overview-meeting-row";return s.structure.meetingConfigs.map(((n,a)=>{const o=s.structure.meetingConfigs.length>a+2&&s.structure.meetingConfigs[a+1];return i(r,{i18n:e,meeting:t[n.id],meetingConfig:n,meetingOrder:a+1,nextCompleted:o&&!!t[o.id],onCreateMeeting:e=>this.action.emit({name:"create-meeting-with-config-only",data:{meetingConfig:e}}),onShowMeetingDetail:e=>{this.action.emit({name:"open-meeting-detail",data:{meeting:e}})},onShowMeetingConfigDetail:e=>{this.shownMeetingConfig=e}})}))}};g.style="atama-structured-pair-overview{display:block}";const p=[new l("startDate","Date").setDateFormat("DD MMM YYYY"),new o("guests","Guests","name","imageUrl","users",[new h("imageUrl"),new d("name","")],!1)],f=(e,t)=>{const{timeFormat:i}=e,s="12-hour"===i?"hh:mm A":"HH:mm",n=[{fieldId:"startDate",fieldDisplay:new l("startDate","Date").setDateFormat(t?"DD MMM":"DD MMMM YYYY, ddd"),timeZone:e.timeZone},{fieldId:"startHour",fieldDisplay:new l("startDate","Start").setDateFormat(s),timeZone:e.timeZone},{fieldId:"endHour",fieldDisplay:new l("endDate","End").setDateFormat(s),timeZone:e.timeZone}];return t||n.push({fieldId:"guests",imageShape:"circle"}),{hideHeader:!0,actionsWidth:t?48:64,actions:[{ui:{name:"open-meeting-detail-from-meeting-list",label:"Open",buttonType:"icon-button",iconName:"uil uil-arrow-right",view:"flat"},data:{type:"navigation",direction:"forward",placement:m.Page,viewId:"meeting-page",params:{conversionConfig:{"item._id":"meetingId"}}}}],fields:n,columns:{startHour:t?{weight:1}:{width:100},guests:{width:100}}}};let u=class{constructor(i){e(this,i),this.action=t(this,"action",7),this.isProgressing=!0,this.strings=c,this.onSizeChange=e=>{this.size=e}}componentWillLoad(){this.uiHelper=new r(this.el,this.onSizeChange),this.size=r.getSize(this.el.parentElement.clientWidth)}componentDidLoad(){this.fetchMeetings()}async invalidate(e){this.meetings=void 0,this.error=void 0,this.fetchMeetings()}async fetchMeetings(){const{calendarConfigId:e,guestIDs:t}=this,i=await this.apiTakvim.getMeetingsOfUser(e,t).catch((e=>{this.error=e})).finally((()=>this.isProgressing=!1));i&&(this.meetings=i.results)}render(){const{meetings:e,size:t,strings:n,userSettings:r}=this;if(!e)return i(s,{class:"mb-3"},i("div",{class:"progress-container"},i("dvn-progress",{indefinite:!0,tint:"primary"})));const o=t<a.Small;return i(s,{class:"mb-3"},0===e.length&&i("dvn-card",{elevation:0,leaned:!0},i("div",{class:"empty-message-container text-centered"},n.noItemInList)),i("dvn-list-view-table",{config:f(r,o),fields:p,items:e,isEndReached:!0,isProgressing:this.isProgressing,error:this.error?n.fetchingListFailed:void 0,onRetry:()=>this.fetchMeetings(),params:{}}))}get el(){return n(this)}};u.style="takvim-meeting-list{display:block}takvim-meeting-list .progress-container{display:-ms-flexbox;display:flex;height:100%;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;padding-bottom:1rem}";export{g as atama_structured_pair_overview,u as takvim_meeting_list}