var __awaiter=this&&this.__awaiter||function(e,t,n,i){function r(e){return e instanceof n?e:new n((function(t){t(e)}))}return new(n||(n=Promise))((function(n,a){function o(e){try{u(i.next(e))}catch(e){a(e)}}function s(e){try{u(i["throw"](e))}catch(e){a(e)}}function u(e){e.done?n(e.value):r(e.value).then(o,s)}u((i=i.apply(e,t||[])).next())}))};var __generator=this&&this.__generator||function(e,t){var n={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},i,r,a,o;return o={next:s(0),throw:s(1),return:s(2)},typeof Symbol==="function"&&(o[Symbol.iterator]=function(){return this}),o;function s(e){return function(t){return u([e,t])}}function u(o){if(i)throw new TypeError("Generator is already executing.");while(n)try{if(i=1,r&&(a=o[0]&2?r["return"]:o[0]?r["throw"]||((a=r["return"])&&a.call(r),0):r.next)&&!(a=a.call(r,o[1])).done)return a;if(r=0,a)o=[o[0]&2,a.value];switch(o[0]){case 0:case 1:a=o;break;case 4:n.label++;return{value:o[1],done:false};case 5:n.label++;r=o[1];o=[0];continue;case 7:o=n.ops.pop();n.trys.pop();continue;default:if(!(a=n.trys,a=a.length>0&&a[a.length-1])&&(o[0]===6||o[0]===2)){n=0;continue}if(o[0]===3&&(!a||o[1]>a[0]&&o[1]<a[3])){n.label=o[1];break}if(o[0]===6&&n.label<a[1]){n.label=a[1];a=o;break}if(a&&n.label<a[2]){n.label=a[2];n.ops.push(o);break}if(a[2])n.ops.pop();n.trys.pop();continue}o=t.call(e,n)}catch(e){o=[6,e];r=0}finally{i=a=0}if(o[0]&5)throw o[1];return{value:o[0]?o[1]:void 0,done:true}}};import{r as registerInstance,c as createEvent,h,H as Host}from"./index-ecdfb761.js";import{a as ResponsiveSize}from"./ui-dab47b5d.js";var atamaStructuredPairOverviewCss="atama-structured-pair-overview{display:block}";var AtamaStructuredPairOverview=function(){function e(e){registerInstance(this,e);this.action=createEvent(this,"action",7);this.meetingsByIdentifiers={}}e.prototype.invalidate=function(e){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){this.fetchMeetings();return[2]}))}))};e.prototype.componentDidLoad=function(){this.fetchMeetings()};e.prototype.fetchMeetings=function(){return __awaiter(this,void 0,void 0,(function(){var e,t,n,i,r,a,o;return __generator(this,(function(s){switch(s.label){case 0:t=this,n=t.pairConfig,i=t.userId,r=t.sessionUserId;return[4,this.apiTakvim.getMeetingsOfUser((e=n.calendarConfig)===null||e===void 0?void 0:e._id,[r,i])];case 1:a=s.sent();o={};a.results.forEach((function(e){o[e.meetingType]=e}));this.meetingsByIdentifiers=o;return[2]}}))}))};e.prototype.render=function(){var e=this;var t=this,n=t.shownMeetingConfig,i=t.size,r=t.userRefFieldId;var a=i<ResponsiveSize.Medium;return h(Host,{class:"mb-3"},a?this.renderList():h("dvn-card",{leaned:true,bodyLeaned:true,elevation:0},this.renderList()),h("dvn-dialog",{title:n?n.name:undefined,shown:!!n,onDismiss:function(){return e.shownMeetingConfig=undefined}},n&&h("dvn-markdown",{content:n.specifications[r].description})))};e.prototype.renderList=function(){var e=this;var t=this,n=t.i18n,i=t.meetingsByIdentifiers,r=t.pairConfig,a=t.size;var o=a<ResponsiveSize.Medium;var s=o?"atama-structured-pair-overview-meeting-row-intense":"atama-structured-pair-overview-meeting-row";return r.structure.meetingConfigs.map((function(t,a){var o=i[t.id];var u=r.structure.meetingConfigs.length>a+2&&r.structure.meetingConfigs[a+1];var c=u&&!!i[u.id];return h(s,{i18n:n,meeting:o,meetingConfig:t,meetingOrder:a+1,nextCompleted:c,onCreateMeeting:function(t){return e.action.emit({name:"create-meeting-with-config-only",data:{meetingConfig:t}})},onShowMeetingDetail:function(t){e.action.emit({name:"open-meeting-detail",data:{meeting:t}})},onShowMeetingConfigDetail:function(t){e.shownMeetingConfig=t}})}))};return e}();AtamaStructuredPairOverview.style=atamaStructuredPairOverviewCss;export{AtamaStructuredPairOverview as atama_structured_pair_overview};