@nylas/web-elements 2.5.8 → 2.5.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/dist/cdn/nylas-scheduler-editor/nylas-scheduler-editor.es.js +1310 -1310
  2. package/dist/cdn/nylas-scheduling/nylas-scheduling.es.js +1 -1
  3. package/dist/cjs/google-logo-icon.microsoft-logo-icon.nylas-editor-tabs.nylas-editor-tabs-group.nylas-list-configurations.nylas-select-event-type.entry.cjs.js.map +1 -1
  4. package/dist/cjs/google-logo-icon_6.cjs.entry.js +8 -7
  5. package/dist/cjs/google-logo-icon_6.cjs.entry.js.map +1 -1
  6. package/dist/cjs/nylas-scheduler-editor.cjs.entry.js +1 -1
  7. package/dist/cjs/nylas-scheduling.cjs.entry.js +1 -1
  8. package/dist/cjs/{version-COZSykqO.js → version-CN5nqWgI.js} +3 -3
  9. package/dist/cjs/{version-COZSykqO.js.map → version-CN5nqWgI.js.map} +1 -1
  10. package/dist/collection/components/scheduler-editor/nylas-editor-tabs/nylas-editor-tabs.js +7 -6
  11. package/dist/collection/components/scheduler-editor/nylas-editor-tabs/nylas-editor-tabs.js.map +1 -1
  12. package/dist/collection/version.js +1 -1
  13. package/dist/collection/version.js.map +1 -1
  14. package/dist/components/nylas-editor-tabs-group.js +1 -1
  15. package/dist/components/nylas-editor-tabs.js +1 -1
  16. package/dist/components/nylas-scheduler-editor.js +3 -3
  17. package/dist/components/nylas-scheduling.js +1 -1
  18. package/dist/components/{p-DC7TgSr7.js → p-2vIl9-lT.js} +10 -9
  19. package/dist/components/p-2vIl9-lT.js.map +1 -0
  20. package/dist/components/{p-Bkt_Yg_U.js → p-BfwqDqHx.js} +3 -3
  21. package/dist/components/{p-Bkt_Yg_U.js.map → p-BfwqDqHx.js.map} +1 -1
  22. package/dist/components/{p-Bx4lojq9.js → p-DwzjmWk7.js} +3 -3
  23. package/dist/components/{p-Bx4lojq9.js.map → p-DwzjmWk7.js.map} +1 -1
  24. package/dist/esm/google-logo-icon.microsoft-logo-icon.nylas-editor-tabs.nylas-editor-tabs-group.nylas-list-configurations.nylas-select-event-type.entry.js.map +1 -1
  25. package/dist/esm/google-logo-icon_6.entry.js +8 -7
  26. package/dist/esm/google-logo-icon_6.entry.js.map +1 -1
  27. package/dist/esm/nylas-scheduler-editor.entry.js +1 -1
  28. package/dist/esm/nylas-scheduling.entry.js +1 -1
  29. package/dist/esm/{version-CwWcFRQ4.js → version-zgIeli_M.js} +3 -3
  30. package/dist/esm/{version-CwWcFRQ4.js.map → version-zgIeli_M.js.map} +1 -1
  31. package/dist/nylas-web-elements/google-logo-icon.microsoft-logo-icon.nylas-editor-tabs.nylas-editor-tabs-group.nylas-list-configurations.nylas-select-event-type.entry.esm.js.map +1 -1
  32. package/dist/nylas-web-elements/nylas-web-elements.esm.js +1 -1
  33. package/dist/nylas-web-elements/{p-ebdd566e.entry.js → p-6aa41c34.entry.js} +2 -2
  34. package/dist/nylas-web-elements/p-acd75a32.entry.js +2 -0
  35. package/dist/nylas-web-elements/p-acd75a32.entry.js.map +1 -0
  36. package/dist/nylas-web-elements/{p-eb7101dd.entry.js → p-ec243a08.entry.js} +2 -2
  37. package/dist/nylas-web-elements/{p-CwWcFRQ4.js → p-zgIeli_M.js} +2 -2
  38. package/dist/nylas-web-elements/{p-CwWcFRQ4.js.map → p-zgIeli_M.js.map} +1 -1
  39. package/dist/types/version.d.ts +1 -1
  40. package/package.json +3 -3
  41. package/dist/components/p-DC7TgSr7.js.map +0 -1
  42. package/dist/nylas-web-elements/p-942c1486.entry.js +0 -2
  43. package/dist/nylas-web-elements/p-942c1486.entry.js.map +0 -1
  44. /package/dist/nylas-web-elements/{p-ebdd566e.entry.js.map → p-6aa41c34.entry.js.map} +0 -0
  45. /package/dist/nylas-web-elements/{p-eb7101dd.entry.js.map → p-ec243a08.entry.js.map} +0 -0
@@ -1,2 +1,2 @@
1
- import{h as e,F as t,r as i,c as n,H as s,a as o}from"./p-0EQQA0nE.js";import{N as a}from"./p-FlNKXp4j.js";import{n as r,L as l,i as c,f as d,h,a as g,j as f,k as u,l as p,m,c as b}from"./p-OpKyWV8q.js";import{E as y,v as _,u as w}from"./p-CwWcFRQ4.js";import{c as v}from"./p-_i6H-yQH.js";import{i as k,a as I,f as x,c as C,b as T}from"./p-B8tfyAQm.js";class S{constructor(){this.component=e=>{const t=y.Component;const i=`${e} Error`;return{endtime_not_in_future:(e='"endtime" can not be in the future')=>({title:i,message:e,category:t}),no_booking_info:(e="No booking info provided")=>({title:i,message:e,category:t}),no_timeslot_selected:(e="No timeslot selected")=>({title:i,message:e,category:t}),no_timezone_selected:(e="No timezone selected")=>({title:i,message:e,category:t}),no_booking_id:(e="No booking id provided")=>({title:i,message:e,category:t}),no_salt:(e="No salt provided")=>({title:i,message:e,category:t}),invalid_start_time:(e="Invalid start time")=>({title:i,message:e,category:t}),invalid_end_time:(e="Invalid end time")=>({title:i,message:e,category:t}),invalid_timezone:(e="Invalid timezone")=>({title:i,message:e,category:t}),no_config_id:(e="No configuration id provided")=>({title:i,message:e,category:t})}};this.api=e=>{const t=y.Api;const i=`${e} Error`;return{invalid_session:e=>({title:i,message:e,category:t}),general_error:e=>({title:i,message:e,category:t}),internal_error:e=>({title:i,message:e,category:t}),invalid_request_error:e=>({title:i,message:e,category:t}),timeslot_not_available:e=>({title:i,message:e,category:t}),provider_error:e=>({title:i,message:e,category:t}),not_found_error:e=>({title:i,message:e,category:t})}}}}class E{constructor({schedulerAPIURL:e,schedulerStore:t,sessionId:i,configId:n,slug:s,clientId:o}){this.errors=new S;this.schedulerStore=t;this.schedulerAPIURL=e;this.sessionId=i;this.configId=n;this.slug=s;this.clientId=o}getHeaders(){return this.sessionId?{Authorization:`Bearer ${this.sessionId}`}:{}}async makeAPIRequest(e,t,i,n={},s){try{const o=new URL(this.schedulerAPIURL);o.pathname=e;const a=await fetch(decodeURIComponent(o.toString()),{method:t,headers:{"Content-Type":"application/json",Origin:window.location.origin,"X-Source":"nylas-scheduling","X-Nylas-Web-Elements-Version":_,...this.clientId&&{"X-Nylas-Application-Public-Id":this.clientId},...n},body:i,signal:s});const r=await a.json();return r}catch(e){if(e.name==="AbortError"){throw e}return{error:{message:e.message,title:"API request failed",type:"api"}}}}getErrorMessage(e){let t=e?.message||e?.title||"Something went wrong";if(e?.type==="provider_error"){t=e?.provider_error?.error?.message||e?.provider_error?.error?.title||"Something went wrong"}return t}setConfigId(e){this.configId=e}setSchedulerAPIURL(e){if(e==="/"){e=new URL(window.location.href).origin}this.schedulerAPIURL=e}setSessionId(e){this.sessionId=e}selectDate(e){this.schedulerStore.set("selectedDate",e);this.schedulerStore.set("selectedTimeslot",null)}selectTime(e){this.schedulerStore.set("selectedTimeslot",e)}selectTimezone(e){this.schedulerStore.set("selectedTimezone",e)}selectLanguage(e){const t=r(e)||l.en;this.schedulerStore.set("selectedLanguage",t);c.changeLanguage(t)}async toggleAdditionalData(e){if(!e){await this.refetchAvailability()}this.schedulerStore.set("showBookingForm",e)}setParticipantName(e){const{bookingInfo:t}=this.schedulerStore.state;this.schedulerStore.set("bookingInfo",{...t,primaryParticipant:{...t?.primaryParticipant,name:e}})}setParticipantEmail(e){const{bookingInfo:t}=this.schedulerStore.state;this.schedulerStore.set("bookingInfo",{...t,primaryParticipant:{...t?.primaryParticipant,email:e}})}async refetchAvailability(){const e=new Date;const t=new Date(e.getFullYear(),e.getMonth(),1).getTime()/1e3;const i=t<e.getTime()/1e3?Math.floor(e.getTime()/1e3):t;const n=new Date(e.getFullYear(),e.getMonth()+1,1).getTime()/1e3;const s=await this.getAvailability(i,n);return s}async resetStoreStateAndFetchAvailability(){const e=new Date;const t=await this.refetchAvailability();const i=this.schedulerStore.get("availability").find((e=>{const t=d(e.start_time);return t?t>new Date:false}));let n=e;if(i){n=d(i.start_time)||e}this.schedulerStore.set("selectedDate",n);this.schedulerStore.set("eventInfo",null);this.schedulerStore.set("showBookingForm",false);this.schedulerStore.set("selectedTimeslot",null);return t}async setReschedule(e){this.schedulerStore.set("isLoading",true);const t=this.schedulerStore.state.eventInfo;if(t){this.schedulerStore.set("reschedulingEventInfo",t)}this.schedulerStore.set("rescheduleBookingId",e);await this.getUISettings();const i=await this.resetStoreStateAndFetchAvailability().finally((()=>{this.schedulerStore.set("isLoading",false)}));return i}async setCancel(e){this.schedulerStore.set("cancelBookingId",e)}async setReject(e){this.schedulerStore.set("rejectBookingId",e)}async resetCancel(){const e=await this.resetStoreStateAndFetchAvailability();this.schedulerStore.set("cancelBookingId","");this.schedulerStore.set("rejectBookingId","");this.schedulerStore.set("cancelledEventInfo",null);return e}async goBack(){this.schedulerStore.set("cancelBookingId","");return}async resetConfirm(){const e=await this.resetStoreStateAndFetchAvailability();this.schedulerStore.set("organizerConfirmationBookingId","");this.schedulerStore.set("confirmedEventInfo",undefined);return e}async bookTimeslot(e){this.schedulerStore.set("isLoading",true);const{selectedTimeslot:t,selectedTimezone:i,bookingInfo:n,selectedLanguage:s}=this.schedulerStore.state;if(!e&&!n){return{error:this.errors.component(c.t("createBookingErrorTitle")).no_booking_info()}}const o=e?.timeslot||t;if(!o){return{error:this.errors.component(c.t("createBookingErrorTitle")).no_timeslot_selected()}}const a=e&&e?.timezone?e?.timezone:i;const r=s||"en-US";if(!a){return{error:this.errors.component(c.t("createBookingErrorTitle")).no_timezone_selected()}}const l=[...this.schedulerStore.get("availabilityOrderEmails")];let d="";const h=o?.emails||[];const g={};Object.entries(n?.additionalFields||{}).forEach((([e,t])=>{g[e]=t.value}));const f=e?e?.primaryParticipant:n?.primaryParticipant;const u=e?e?.guests||[]:n?.guests||[];const p=e?e?.additionalFields:g;const m=this.getHeaders();const b=!this.sessionId&&this.configId?`?configuration_id=${this.configId}`:!this.sessionId&&this.slug&&this.clientId?`?slug=${this.slug}&client_id=${this.clientId}`:"";const y=`/v3/scheduling/bookings${b}`;if(l.length===0){const e=await this.makeAPIRequest(decodeURIComponent(y),"POST",JSON.stringify({additional_fields:p,additional_guests:u,guest:{...f},start_time:o.start_time.getTime()/1e3,end_time:o.end_time.getTime()/1e3,timezone:a,event_id:o?.event_id||undefined,master_id:o?.master_id||undefined,calendar_id:o?.calendar_id||undefined,email_language:this.getTwoLetterLanguageCode(r)}),m);this.schedulerStore.set("isLoading",false);if("data"in e){this.schedulerStore.set("eventInfo",e.data);return e}return{error:e.error}}while(l.length>0){d=l.shift();if(!h.includes(d)){continue}const e=await this.makeAPIRequest(decodeURIComponent(y),"POST",JSON.stringify({participants:d?[{email:d}]:undefined,additional_fields:p,additional_guests:u,guest:{...f},start_time:o.start_time.getTime()/1e3,end_time:o.end_time.getTime()/1e3,timezone:a,email_language:this.getTwoLetterLanguageCode(r)}),m);if("data"in e){this.schedulerStore.set("isLoading",false);this.schedulerStore.set("eventInfo",e?.data);return e}else if(e.error?.message?.startsWith("The selected timeslot is unavailable")){continue}else{this.schedulerStore.set("isLoading",false);const t=e.error?.type;let i=e.error;if(t&&t in this.errors.api(c.t("createBookingErrorTitle"))){const e=this.getErrorMessage(i);i=this.errors.api(c.t("createBookingErrorTitle"))[t](e)}return{error:i}}}this.schedulerStore.set("isLoading",false);return{error:this.errors.api(c.t("createBookingErrorTitle")).timeslot_not_available("The selected timeslot is unavailable")}}async getUISettings(e){this.schedulerStore.set("isLoading",true);const t=this.schedulerStore.get("rescheduleBookingId");const i=this.getHeaders();let n=!this.sessionId&&this.configId?`?configuration_id=${this.configId}`:!this.sessionId&&this.slug&&this.clientId?`?slug=${this.slug}&client_id=${this.clientId}`:"";if(t&&!!n){n+=`&booking_id=${t}`}else if(t){n+=`?booking_id=${t}`}const s=`/v3/scheduling/ui-settings${n}`;const o=await this.makeAPIRequest(s,"GET",undefined,i,e);if("error"in o){this.schedulerStore.set("isLoading",false);const e=o.error?.type;let t=o.error;if(e&&e in this.errors.api(c.t("getUISettingErrorTitle"))){t=this.errors.api(c.t("getUISettingErrorTitle"))[e](t?.message||t?.title||"Something went wrong")}return{error:t}}if("data"in o){this.schedulerStore.set("configSettings",o.data);this.clientId=o.data.app_client_id||this.clientId}this.schedulerStore.set("isLoading",false);return o}getTwoLetterLanguageCode(e){return e.split("-")[0]}getStartTimeWithMinBookingNotice(e){const t=this.schedulerStore.get("configSettings")?.scheduler;const i=t?.min_booking_notice;if(!i){return e}const n=(new Date).getTime();if(e<(n+i*60*1e3)/1e3){return Math.floor((n+i*60*1e3)/1e3)}else{return e}}getEndTimeForAvailableDaysInFuture(e){const t=new Date;const i=this.schedulerStore.get("configSettings")?.scheduler?.available_days_in_future;const n=Math.floor(h(t,i).getTime()/1e3);const s=Math.min(n,e);return s}async getAvailability(e=0,t=0,i){this.schedulerStore.set("isLoading",true);const n=new URLSearchParams;const s=new Date;const o=s.getTime();if(t&&t<o/1e3){this.schedulerStore.set("isLoading",false);const e=this.errors.component(c.t("getAvailabilityErrorTitle")).endtime_not_in_future();return{error:e}}if(!e){const t=new Date(s.getFullYear(),s.getMonth(),1);e=Math.floor(t.getTime()/1e3)}if(!t){const e=new Date(s.getFullYear(),s.getMonth()+1,0);t=Math.floor(e.getTime()/1e3)}t=this.getEndTimeForAvailableDaysInFuture(t);const a=this.getStartTimeWithMinBookingNotice(e);e=a;t=a>t?a+1:t;n.append("start_time",encodeURIComponent(e.toString()));n.append("end_time",encodeURIComponent(t.toString()));if(this.configId&&!this.sessionId){n.append("configuration_id",encodeURIComponent(this.configId))}else if(this.slug&&this.clientId&&!this.sessionId){n.append("slug",encodeURIComponent(this.slug));n.append("client_id",encodeURIComponent(this.clientId))}const r=this.schedulerStore.get("rescheduleBookingId");if(r){n.append("booking_id",encodeURIComponent(r))}const l=n.toString();const d=`/v3/scheduling/availability${l?`?${l}`:""}`;const h=this.getHeaders();const g=await this.makeAPIRequest(decodeURIComponent(d),"GET",undefined,h,i);if("error"in g){this.schedulerStore.set("availability",[]);this.schedulerStore.set("isLoading",false);const e=g.error?.type;let t=g.error;if(t?.message?.toLowerCase().includes("Failed to find a valid Grant")){const e=c.t("invalidGrantError");return{error:{title:c.t("invalidGrantErrorTitle"),message:e,category:y.Api}}}if(e&&e in this.errors.api(c.t("getAvailabilityErrorTitle"))){const i=this.getErrorMessage(t);t=this.errors.api(c.t("getAvailabilityErrorTitle"))[e](i)}return{error:t}}if("data"in g){const e=g.data?.time_slots?.map((e=>({...e,start_time:new Date(e.start_time*1e3),end_time:new Date(e.end_time*1e3)})))||[];const t=e.filter((e=>e.start_time.getTime()>o));const i=t.sort(((e,t)=>e.start_time.getTime()-t.start_time.getTime()));this.schedulerStore.set("availability",i);const n=g.data?.order||[];this.schedulerStore.set("availabilityOrderEmails",n)}this.schedulerStore.set("isLoading",false);return g}async cancelBooking(e,t){this.schedulerStore.set("isLoading",true);if(!e){return{error:this.errors.component(c.t("cancelBookingErrorTitle")).no_booking_id()}}const i=!this.sessionId&&this.configId?`?configuration_id=${this.configId}`:!this.sessionId&&this.slug&&this.clientId?`?slug=${this.slug}&client_id=${this.clientId}`:"";const n=`/v3/scheduling/bookings/${e}${i}`;const s=this.getHeaders();const o=await this.makeAPIRequest(decodeURIComponent(n),"DELETE",JSON.stringify({action:"cancel",cancellation_reason:t}),s);if("error"in o){this.schedulerStore.set("isLoading",false);const e=o.error?.type;let t=o.error;if(e&&e in this.errors.api(c.t("cancelBookingErrorTitle"))){const i=this.getErrorMessage(t);t=this.errors.api(c.t("cancelBookingErrorTitle"))[e](i)}return{error:t}}this.schedulerStore.set("cancelledEventInfo",{booking_id:e});this.schedulerStore.set("rescheduleBookingId","");this.schedulerStore.set("isLoading",false);return o}async rescheduleBooking(e,t){this.schedulerStore.set("isLoading",true);if(!e){return{error:this.errors.component(c.t("rescheduleBookingErrorTitle")).no_booking_id()}}const i=this.errors.api(c.t("rescheduleBookingErrorTitle"));const n=this.errors.component(c.t("rescheduleBookingErrorTitle"));const{bookingInfo:s,selectedTimeslot:o,selectedTimezone:a,selectedLanguage:r}=this.schedulerStore.state;const{startTime:l,endTime:d,timezone:h}=t;const g=l||o?.start_time;if(!g){return{error:n.invalid_start_time('Please pass "startTime" in data or set "selectedTimeslot" in the defaultSchedulerState.')}}const f=d||o?.end_time;if(!f){return{error:n.invalid_end_time('Please pass "endTime" in data or set "selectedTimeslot" in the defaultSchedulerState.')}}const u=this.schedulerStore.get("availabilityOrderEmails");let p="";if(u.length>0){const e=o?.emails||[];for(let t=0;t<u.length;t++){if(e.includes(u[t])){p=u[t];break}}}const m=h||a;if(!m){return{error:n.invalid_timezone('Please pass "timezone" in data or set "selectedTimezone" in the defaultSchedulerState.')}}const b=o?.event_id||undefined;const y=o?.master_id||undefined;const _=o?.calendar_id||undefined;const w={};Object.entries(s?.additionalFields||{}).forEach((([e,t])=>{w[e]=t.value}));const v=t?t?.primaryParticipant:s?.primaryParticipant;const k=t?t?.guests||[]:s?.guests||[];const I=t?t?.additionalFields:w;const x=!this.sessionId&&this.configId?`?configuration_id=${this.configId}`:!this.sessionId&&this.slug&&this.clientId?`?slug=${this.slug}&client_id=${this.clientId}`:"";const C=`/v3/scheduling/bookings/${e}${x}`;const T=this.getHeaders();const S=await this.makeAPIRequest(decodeURIComponent(C),"PATCH",JSON.stringify({start_time:g.getTime()/1e3,end_time:f.getTime()/1e3,timezone:m,additional_fields:I,guest:{...v},additional_guests:k,participants:p?[{email:p}]:undefined,email_language:this.getTwoLetterLanguageCode(r),event_id:b,master_id:y,calendar_id:_}),T);if("error"in S){this.schedulerStore.set("isLoading",false);const e=S.error?.type;let t=S.error;if(e&&e in i){const n=this.getErrorMessage(t);t=i[e](n)}return{error:t}}const E=this.schedulerStore.get("reschedulingEventInfo");if("data"in S){this.schedulerStore.set("eventInfo",S?.data);if(S.data?.booking_id){this.schedulerStore.set("rescheduleBookingId",S.data.booking_id)}}else if(E){this.schedulerStore.set("eventInfo",E)}else{const t={booking_id:e};this.schedulerStore.set("eventInfo",t)}this.schedulerStore.set("reschedulingEventInfo",undefined);this.schedulerStore.set("isLoading",false);return S}async updateBooking(e){this.schedulerStore.set("isLoading",true);const{bookingId:t,status:i,reason:n}=e;const s=this.schedulerStore.get("organizerConfirmationSalt");const o=i==="confirmed"?c.t("confirmBookingErrorTitle"):c.t("rejectBookingErrorTitle");if(!t){return{error:this.errors.component(o).no_booking_id()}}if(!s){return{error:this.errors.component(o).no_salt()}}const a=!this.sessionId&&this.configId?`?configuration_id=${this.configId}`:!this.sessionId&&this.slug&&this.clientId?`?slug=${this.slug}&client_id=${this.clientId}`:"";const r=`/v3/scheduling/bookings/${t}${a}`;const l=this.getHeaders();const d=await this.makeAPIRequest(decodeURIComponent(r),"PUT",JSON.stringify({status:i,cancellation_reason:n,salt:s}),l);if("error"in d){this.schedulerStore.set("isLoading",false);const e=d.error?.type;let t=d.error;if(e&&e in this.errors.api(o)){const i=this.getErrorMessage(t);t=this.errors.api(o)[e](i)}return{error:t}}if("data"in d&&i==="confirmed"){this.schedulerStore.set("confirmedEventInfo",d?.data)}else if("request_id"in d&&i==="cancelled"){this.schedulerStore.set("cancelledEventInfo",{booking_id:t})}this.schedulerStore.set("organizerConfirmationBookingId","");this.schedulerStore.set("isLoading",false);return d}async validateGroupEventTimeslot(e){this.schedulerStore.set("isLoading",true);const t=this.schedulerStore.get("configSettings")?.configuration_id;if(!t){return{error:this.errors.component(c.t("validateTimeslotErrorTitle")).no_config_id()}}const i=this.getHeaders();const n=`/v3/scheduling/configurations/${t}/group-events/validate-timeslot`;const s=await this.makeAPIRequest(decodeURIComponent(n),"POST",JSON.stringify({...e,start_time:e.start_time.getTime()/1e3,end_time:e.end_time.getTime()/1e3}),i);if("error"in s){this.schedulerStore.set("isLoading",false);const e=s.error?.type;let t=s.error;if(e&&e in this.errors.api(c.t("validateTimeslotErrorTitle"))){const i=this.getErrorMessage(t);t=this.errors.api(c.t("validateTimeslotErrorTitle"))[e](i)}this.refetchAvailability();return{error:t}}this.schedulerStore.set("selectedTimeslot",e);this.schedulerStore.set("showBookingForm",true);this.schedulerStore.set("isLoading",false);return s}}class L{constructor({schedulerAPIURL:e,nylasSchedulerStore:t,sessionId:i,configId:n,slug:s,clientId:o}){if(!e){throw new Error("schedulerAPIURL is required")}if(!t){throw new Error("nylasSchedulerStore is required")}if(!i&&!n&&!(s&&o)){throw new Error("sessionId is required for private configs. If using public config either pass a configurationId or a combination of slug and clientId.")}if(e==="/"){const t=new URL(window.location.href);e=t.origin}this.configId=n;this.sessionId=i;this.schedulerAPIURL=e;this.nylasSchedulerStore=t;this.slug=s;this.clientId=o}init(){g("NylasConnector init")}get schedulerStore(){return this.nylasSchedulerStore}setSchedulerAPIURL(e){if(e==="/"){e=new URL(window.location.href).origin}this.schedulerAPIURL=e;if(this._schedulerAPIConnector){this._schedulerAPIConnector.setSchedulerAPIURL(e)}}get scheduler(){if(this._schedulerAPIConnector){return this._schedulerAPIConnector}this._schedulerAPIConnector=new E({schedulerAPIURL:this.schedulerAPIURL,schedulerStore:this.schedulerStore,sessionId:this.sessionId,configId:this.configId,slug:this.slug,clientId:this.clientId});return this._schedulerAPIConnector}resetStores(){this.nylasSchedulerStore.reset()}}function B(e={}){const t={selectedDate:null,selectedLanguage:f()||l.en,selectedTimezone:Intl.DateTimeFormat().resolvedOptions().timeZone,selectedTimeslot:null,showBookingForm:false,availabilityOrderEmails:[],selectableDates:null,availability:[],eventDuration:0,state:"ready",eventInfo:null,cancelledEventInfo:null,isLoading:false,nylasBranding:true,...e};g(`[defaultNylasStoreState]: `,t);const i=v(t);i.onChange("availability",(e=>{g(`[availability]: `,e);const t=e.map((e=>e.start_time));g(`[selectableDates]: `,t);i.set("selectableDates",t);const n=e[0];if(!n)return;const s=Math.floor((n.end_time.getTime()-n.start_time.getTime())/6e4);g(`[durationMinutes]: `,s);i.set("eventDuration",s)}));i.reset=()=>{for(const e in t){const n=t[e];i.set(e,n)}};return i}const D=(i,n)=>{const s=i.isLoading;const o=i.showNotification;const a=i.nylasBranding;const r=i.version;return e(t,null,o&&e("nylas-notification",null),s&&e("div",{class:"loading"},e("div",{class:"left"},e("div",{class:"skeleton"})),e("div",{class:"right"},e("div",{class:"skeleton"}),e("div",{class:"skeleton"}),e("div",{class:"skeleton"}),e("div",{class:"skeleton"}),e("div",{class:"skeleton"}))),!s&&n,e("div",{key:"ns-footer",class:"footer",part:"ns_footer"},a&&e("a",{href:"https://scheduler.nylas.com?utm_source=powered-by-nylas-logoutm_medium=link&utm_campaign=get-scheduler&utm_id=get-scheduler",class:"powered-by-nylas",target:"_blank",rel:"noreferrer noopener"},"Powered by ",e("span",{class:"sr-only"},"Nylas"),e("nylas-logo",{"aria-hidden":true})),e("tooltip-component",null,e("info-icon",{slot:"tooltip-icon"}),e("span",{slot:"tooltip-content"},r))))};const z=(t,i)=>e("div",{class:"message-banner"},i);const R=':host{display:flex;flex-direction:column;overflow:visible;border-radius:var(--nylas-border-radius-2x);width:fit-content;background:var(--nylas-base-0);position:relative;box-shadow:0px 4px 8px 2px rgba(0, 0, 0, 0.05), 0px 8px 16px -2px rgba(0, 0, 0, 0.1);--nylas-primary:#2563eb;--nylas-error:#cc4841;--nylas-error-50:#ffeae8;--nylas-error-100:#ffc5bf;--nylas-error-200:#fecaca;--nylas-error-pressed:#992222;--nylas-wraning:#f06c00;--nylas-success:#16a392;--nylas-info:#2b8fc2;--nylas-base-0:#ffffff;--nylas-base-25:#fcfcfd;--nylas-base-50:#f8f9fc;--nylas-base-100:#eaecf5;--nylas-base-200:#d5d9eb;--nylas-base-300:#b3b8d8;--nylas-base-400:#717bbc;--nylas-base-500:#4e5ba6;--nylas-base-600:#3e4784;--nylas-base-700:#263f72;--nylas-base-800:#293056;--nylas-base-900:#101323;--nylas-base-950:#0e101b;--nylas-color-blue-100:#e0e6f9;--nylas-border-radius:0.25rem;--nylas-border-radius-2x:0.5rem;--nylas-border-radius-3x:0.75rem;--nylas-font-family:"Inter", sans-serif;--nylas-color-black:#000000;--nylas-color-grey-900:#2c2c2c;--nylas-color-grey-800:#4b4b4b;--nylas-color-grey-700:#6e6e6e;--nylas-color-grey-600:#8e8e8e;--nylas-color-grey-500:#b3b3b3;--nylas-color-grey-400:#cacaca;--nylas-color-grey-300:#e1e1e1;--nylas-color-grey-200:#eaeaea;--nylas-color-grey-100:#f5f5f5;--nylas-color-grey-50:#fbfcfe;--nylas-color-white:#ffffff;--nylas-color-red-900:#992222;--nylas-color-red-700:#cc4841;--nylas-color-red-500:#ff786a;--nylas-color-red-300:#ffa79e;--nylas-color-red-100:#ffc5bf;--nylas-color-red-50:#ffeae8;--nylas-color-blue-900:#213571;--nylas-color-blue-700:#314fa9;--nylas-color-blue-500:#4169e1;--nylas-color-blue-300:#bdccf9;--nylas-color-blue-100:#e0e6f9;--nylas-color-blue-50:#f6f8fd;--nylas-color-yellow-900:#7c6506;--nylas-color-yellow-700:#c29f09;--nylas-color-yellow-500:#f7c90b;--nylas-color-yellow-300:#f9de70;--nylas-color-yellow-100:#fceba9;--nylas-color-yellow-50:#fdf4ce;--nylas-color-green-900:#0e6b60;--nylas-color-green-700:#16a392;--nylas-color-green-500:#17c3b2;--nylas-color-green-300:#74dbd1;--nylas-color-green-100:#a2e7e0;--nylas-color-green-50:#d1f3f0;--nylas-color-purple-900:#643554;--nylas-color-purple-700:#954f7d;--nylas-color-purple-500:#c769a7;--nylas-color-purple-300:#dda5ca;--nylas-color-purple-100:#e0bdd6;--nylas-color-purple-50:#e9dde5;--nylas-color-sky-900:#20698f;--nylas-color-sky-700:#2b8fc2;--nylas-color-sky-500:#6dceff;--nylas-color-sky-300:#8fdaff;--nylas-color-sky-100:#b8e7ff;--nylas-color-sky-50:#d9f2ff;font-family:var(--nylas-font-family);font-optical-sizing:auto;font-style:normal;font-variation-settings:"slnt" 0}@media screen and (max-width: 768px){:host{width:auto;min-width:325px}}:root{font-family:inherit}.error{padding:8rem 12rem;color:var(--nylas-base-0);background-color:var(--nylas-error);margin:1.5rem;border-radius:var(--nylas-border-radius-2x)}.message-banner{text-align:right;color:var(--nylas-base-800);padding:1rem;border-bottom:1px solid var(--nylas-color-primary-200);margin:0}.loading{margin:1.5rem;display:flex;gap:1rem}.loading .skeleton{border-radius:var(--nylas-border-radius-2x);animation:pulsate 1.5s infinite}.loading .skeleton:nth-child(2){animation-delay:-100ms}.loading .skeleton:nth-child(3){animation-delay:-200ms}.loading .skeleton:nth-child(4){animation-delay:-300ms}.loading .skeleton:nth-child(5){animation-delay:-400ms}.loading .left .skeleton{height:100%;width:400px}.loading .right .skeleton{height:5rem;width:300px;margin-bottom:1rem}.loading .right .skeleton:last-child{margin-bottom:0}@keyframes pulsate{0%{background-color:var(--nylas-base-50)}50%{background-color:var(--nylas-base-100)}100%{background-color:var(--nylas-base-50)}}.select-date-page,.additional-data-page,.booked-event-page,.manual-confirmation-page,.cancelled-event-page,.cancel-flow-page{border-top-left-radius:var(--nylas-border-radius-2x);border-top-right-radius:var(--nylas-border-radius-2x)}.select-date-page,.additional-data-page{display:flex}@media screen and (max-width: 768px){.select-date-page,.additional-data-page{flex-direction:column}}.booked-event-page,.manual-confirmation-page{background-color:var(--nylas-base-50)}.cancelled-event-page,.manual-confirmation-page,.cancel-flow-page{padding:1rem;height:496px;display:flex;justify-content:center;align-items:center}.booked-event-page,.manual-confirmation-page,.cancelled-event-page,.cancel-flow-page{min-width:784px;background:var(--nylas-base-50)}@media screen and (max-width: 768px){.booked-event-page,.manual-confirmation-page,.cancelled-event-page,.cancel-flow-page{min-width:90%}}.left-panel{display:flex;flex-direction:column;min-width:424px;border-top-left-radius:inherit;background:var(--nylas-base-0);position:relative;padding:1rem 0 0 0;height:624px}@media screen and (max-width: 768px){.left-panel{border-top-right-radius:inherit;min-width:unset;height:auto}}@media screen and (max-width: 768px){.select-date-page .left-panel{height:624px}}.border{margin-left:-20px;margin-right:-20px;border-top-width:1px;height:0.5px;background-color:var(--nylas-base-200)}@media screen and (max-width: 768px){.border{display:none}}.right-panel{min-width:360px;width:360px;background-color:var(--nylas-base-50);height:624px;padding-top:16px;border-left:1px solid var(--nylas-base-200);border-top-right-radius:inherit}.right-panel.reschedule{border-top-right-radius:0px}@media screen and (max-width: 768px){.right-panel{border-top-right-radius:0px;width:inherit;min-width:unset;height:auto;border-left:none}}.right-panel h2{display:flex;margin:0;height:48px;gap:0.5rem;justify-content:center;align-items:center;width:auto;font-size:1.125rem;line-height:1.5rem;font-weight:500;text-align:center;color:var(--nylas-base-800)}.additional-data-page .left-panel{background-color:var(--nylas-base-50)}.additional-data-page .right-panel{background-color:var(--nylas-base-0)}nylas-selected-event-card{height:604px;padding:0 1rem}@media screen and (max-width: 768px){nylas-selected-event-card{height:250px}}.footer{display:flex;justify-content:flex-end;align-items:center;gap:8px;padding:16px;font-size:14px;font-weight:300;color:var(--nylas-base-500);border-top:1px solid var(--nylas-base-200);min-height:24px}.footer .powered-by-nylas{display:flex;align-items:center;text-decoration:none;color:var(--nylas-base-500)}.footer .powered-by-nylas:hover{color:var(--nylas-base-800)}.footer svg{fill:var(--nylas-base-500)}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0, 0, 0, 0);white-space:nowrap;border-width:0}.footer svg{margin-top:1px}nylas-selected-event-card::part(nsec__timezone){position:absolute;bottom:0}nylas-notification{margin:1.5rem;width:-webkit-fill-available;width:-moz-available;position:absolute}nylas-locale-switch{position:absolute;padding:18px 20px;bottom:0;width:-webkit-fill-available;width:-moz-available;border-top:1px solid var(--nylas-base-200)}@media screen and (max-width: 768px){nylas-locale-switch{height:auto}}nylas-date-picker{padding:0 20px}button-component#report-issue{width:auto;position:absolute;bottom:4px;left:16px}.language-feedback-container{width:auto;position:absolute;bottom:4px;left:16px;display:flex;gap:8px;align-items:center}.language-feedback-container button-component#report-issue{position:initial}nylas-feedback-form{position:absolute;top:0;height:100%;width:100%;display:flex;flex-direction:column;justify-content:center;align-items:center;background:rgba(0, 0, 0, 0.6);z-index:2;border-radius:inherit}';const $={title:c.t("genericErrorTitle"),category:y.Component};const U=class{constructor(e){i(this,e);this.init=n(this,"init",7);this.schedulerWillLoad=n(this,"schedulerWillLoad",7);this.schedulerDidLoad=n(this,"schedulerDidLoad",7);this.nylasSchedulerError=n(this,"nylasSchedulerError",7);this.nylasSchedulerInfo=n(this,"nylasSchedulerInfo",7);this.configSettingsLoaded=n(this,"configSettingsLoaded",7);this.bookingRefExtracted=n(this,"bookingRefExtracted",7);this.bookedEventInfo=n(this,"bookedEventInfo",7);this.initDeferred=false;this.mode="app";this.schedulerApiUrl="https://api.us.nylas.com";this.nylasBranding=true;this.eventOverrides={};this.showNotification=true;this.enableUserFeedback=true;this.automaticComponentRegistration=true;this.selectedDateLabel=`${c.t("noDateSelected")}`;this.language=navigator.language;this.showFeedbackModal=false;this.bookingInfoConfirmed=null;this.version=_}connectedCallback(){g(`[nylas-scheduler] connectedCallback`)}async componentWillLoad(){g(`[nylas-scheduler] Component will load`);this.version=_;await new Promise((e=>setTimeout(e,0)));if(this.enableUserFeedback&&!k()){I({dsn:"https://9d5731f1c77ca84c9ed3fb9b3ccf7ee1@o74852.ingest.us.sentry.io/4507889638178816",release:this.version,integrations:e=>[...e.filter((e=>false)),x({colorScheme:"system",autoInject:false})],autoSessionTracking:false,beforeSend:()=>null})}const e=this.schedulerWillLoad.emit(this.host);if("schedulerWillLoad"in this.eventOverrides){await this.eventOverrides.schedulerWillLoad(e,this.nylasSchedulerConnector);if(e.defaultPrevented){return}}const t=new URLSearchParams(window.location.search);const i=r(t.get("lang"))||r(t.get("language"));const n=i||this.defaultLanguage||r(this.bookingInfo?.language)||this.defaultSchedulerState?.selectedLanguage||f()||l.en;this.language=n;c.changeLanguage(n);this.stores={scheduler:B({bookingInfo:this.bookingInfo,nylasBranding:this.nylasBranding,themeConfig:this.themeConfig,hour12:this.hour12,...this.defaultSchedulerState,selectedLanguage:n})};this.baseProvider=new a(this.host,this.stores,this.automaticComponentRegistration,this.eventOverrides);this.refConfigId=this.configurationId;let s;try{if(this.rescheduleBookingRef){const[e,t,i]=u(this.rescheduleBookingRef);this.refConfigId=e;this.stores.scheduler.set("rescheduleBookingId",t);s=this.bookingRefExtracted.emit({configurationId:e,bookingId:t})}else if(this.cancelBookingRef){const[e,t,i]=u(this.cancelBookingRef);this.refConfigId=e;this.stores.scheduler.set("cancelBookingId",t);s=this.bookingRefExtracted.emit({configurationId:e,bookingId:t})}else if(this.organizerConfirmationBookingRef){const[e,t,i]=u(this.organizerConfirmationBookingRef);this.refConfigId=e;this.stores.scheduler.set("organizerConfirmationBookingId",t);this.stores.scheduler.set("organizerConfirmationSalt",i);s=this.bookingRefExtracted.emit({configurationId:e,bookingId:t,salt:i})}}catch(e){g(e);const t=this.rescheduleBookingRef||this.cancelBookingRef||this.organizerConfirmationBookingRef;this.nylasSchedulerError.emit({notification:{...this.getErrorObject({message:`Invalid booking reference: ${t}`})},host:this.host})}this.applyThemeConfig(this.themeConfig);if("bookingRefExtracted"in this.eventOverrides){await this.eventOverrides.bookingRefExtracted(s,this.nylasSchedulerConnector);if(s.defaultPrevented){return}}if(!this.checkIfSessionIdOrConfigIdExists(false)){this.initDeferred=true;return}const o=this.baseProvider?.getStore("scheduler");this.nylasSchedulerConnector=new L({schedulerAPIURL:this.schedulerApiUrl,sessionId:this.sessionId,configId:this.refConfigId,slug:this.slug,clientId:this.clientId,nylasSchedulerStore:o});const d=this.init.emit(this.host);if("init"in this.eventOverrides){await this.eventOverrides.init(d,this.nylasSchedulerConnector);if(d.defaultPrevented){return}}this.baseProvider?.componentWillLoad(this.nylasSchedulerConnector)}async componentDidLoad(){if(this.initDeferred){return}this.baseProvider?.componentDidLoad();await Promise.resolve();const e=this.schedulerDidLoad.emit(this.host);if("schedulerDidLoad"in this.eventOverrides){await this.eventOverrides.schedulerDidLoad(e,this.nylasSchedulerConnector);if(e.defaultPrevented){return}}if(!this.checkIfSessionIdOrConfigIdExists()){return}await this.performSchedulerDataFetch()}async performSchedulerDataFetch(){this.fetchAbortController?.abort();this.fetchAbortController=new AbortController;const{signal:e}=this.fetchAbortController;try{if(this.nylasSchedulerConnector){if(this.schedulerApiUrl){this.nylasSchedulerConnector.setSchedulerAPIURL(this.schedulerApiUrl)}if(this.sessionId){this.nylasSchedulerConnector.sessionId=this.sessionId;this.nylasSchedulerConnector.scheduler.setSessionId(this.sessionId)}}this.localizationChanged(this.localization);const t=await(this.nylasSchedulerConnector?.scheduler.getUISettings(e));if(e.aborted)return;if(!t||"error"in t){this.nylasSchedulerError.emit({notification:{...this.getErrorObject(t?.error)},host:this.host});return}else{if("data"in t&&t.data?.appearance){g("Appearance settings have been returned from the configuration used byt his scheduling page; please remember to grab them from the configSettingsLoaded event and apply them as desired.")}const i=this.configSettingsLoaded.emit({settings:t});if("configSettingsLoaded"in this.eventOverrides){await this.eventOverrides.configSettingsLoaded(i,this.nylasSchedulerConnector);if(e.aborted)return;if(i.defaultPrevented){return}}}const i=this.baseProvider?.getStore("scheduler");const n=i?.get("configSettings")?.scheduler?.available_days_in_future;const s=i?.get("selectedTimeslot");if(s&&s?.start_time){if(!this.isTimeslotValid(s)){return}if(i?.get("showBookingForm")){i?.set("selectedDate",s.start_time);return}}const o=d(i?.get("selectedDate"));const a=i?.get("availability");let r;if(a&&a.length>0){return}if(!o){const t=new Date;const{startTime:i,endTime:s,endTimeForAvailableDaysInFuture:o}=this.validateAvailableDaysInFuture(t,n||30);if(t.getTime()<o*1e3){r=await(this.nylasSchedulerConnector?.scheduler.getAvailability(i,s,e))}}else{const{startTime:t,endTime:i,endTimeForAvailableDaysInFuture:s}=this.validateAvailableDaysInFuture(o,n||30);if(o.getTime()<s*1e3){r=await(this.nylasSchedulerConnector?.scheduler.getAvailability(t,i,e))}}if(e.aborted)return;if(!r||"error"in r){this.nylasSchedulerError.emit({notification:{...this.getErrorObject(r?.error)},host:this.host})}if(!o){let e=new Date;const t=i?.get("availability").find((e=>{const t=d(e.start_time);return t?t>new Date:false}));if(t){e=d(t.start_time)||e}i?.set("selectedDate",e)}}catch(e){if(e.name==="AbortError")return;throw e}}hasValidAuthConfig(){return!!(this.sessionId||this.refConfigId||this.slug&&this.clientId)}async performDeferredInit(){if(!this.hasValidAuthConfig()||!this.initDeferred||!this.baseProvider){return}document.body.dispatchEvent(new CustomEvent("nylasSchedulerClearNotifications",{detail:{host:this.host},bubbles:true}));this.initDeferred=false;this.refConfigId=this.refConfigId||this.configurationId;this.baseProvider.eventOverrides=this.eventOverrides;const e=this.baseProvider.getStore("scheduler");this.nylasSchedulerConnector=new L({schedulerAPIURL:this.schedulerApiUrl,sessionId:this.sessionId,configId:this.refConfigId,slug:this.slug,clientId:this.clientId,nylasSchedulerStore:e});const t=this.init.emit(this.host);if("init"in this.eventOverrides){await this.eventOverrides.init(t,this.nylasSchedulerConnector);if(t.defaultPrevented){return}}await this.baseProvider.componentWillLoad(this.nylasSchedulerConnector);this.baseProvider.componentDidLoad();await Promise.resolve();const i=this.schedulerDidLoad.emit(this.host);if("schedulerDidLoad"in this.eventOverrides){await this.eventOverrides.schedulerDidLoad(i,this.nylasSchedulerConnector);if(i.defaultPrevented){return}}await this.performSchedulerDataFetch()}async authPropsChanged(e){if(e&&"bookingRefExtracted"in this.eventOverrides){await this.eventOverrides.bookingRefExtracted(e,this.nylasSchedulerConnector);if(e.defaultPrevented){return}}if(this.initDeferred&&this.hasValidAuthConfig()){this.performDeferredInit()}}configurationIdChanged(){if(!this.rescheduleBookingRef&&!this.cancelBookingRef&&!this.organizerConfirmationBookingRef){this.refConfigId=this.configurationId}this.authPropsChanged()}schedulerApiUrlChanged(){if(this.nylasSchedulerConnector&&this.schedulerApiUrl){this.nylasSchedulerConnector.setSchedulerAPIURL(this.schedulerApiUrl);document.body.dispatchEvent(new CustomEvent("nylasSchedulerClearNotifications",{detail:{host:this.host},bubbles:true}));this.stores?.scheduler.set("availability",[]);this.performSchedulerDataFetch()}}sessionIdChanged(){if(this.nylasSchedulerConnector&&this.sessionId){this.nylasSchedulerConnector.sessionId=this.sessionId;this.nylasSchedulerConnector.scheduler.setSessionId(this.sessionId);document.body.dispatchEvent(new CustomEvent("nylasSchedulerClearNotifications",{detail:{host:this.host},bubbles:true}));this.performSchedulerDataFetch()}this.authPropsChanged()}slugChanged(){this.authPropsChanged()}clientIdChanged(){this.authPropsChanged()}componentDisconnected(){this.baseProvider?.componentDisconnected()}bookingInfoChanged(e){this.stores?.scheduler.set("bookingInfo",e);if(e?.language&&!this.defaultLanguage){this.stores?.scheduler.set("selectedLanguage",r(e.language)||l.en)}}rescheduleBookingRefChanged(e){let t;if(e){try{const[i,n]=u(e);this.stores?.scheduler.set("rescheduleBookingId",n);this.refConfigId=i;this.nylasSchedulerConnector?.scheduler.setConfigId(i);t=this.bookingRefExtracted.emit({configurationId:i,bookingId:n})}catch(t){g(t);this.nylasSchedulerError.emit({notification:{...this.getErrorObject({message:`Invalid booking reference: ${e}`})},host:this.host})}}this.authPropsChanged(t)}cancelBookingRefChanged(e){let t;if(e){try{const[i,n]=u(e);this.stores?.scheduler.set("cancelBookingId",n);this.refConfigId=i;this.nylasSchedulerConnector?.scheduler.setConfigId(i);t=this.bookingRefExtracted.emit({configurationId:i,bookingId:n})}catch(t){g(t);this.nylasSchedulerError.emit({notification:{...this.getErrorObject({message:`Invalid booking reference: ${e}`})},host:this.host})}}this.authPropsChanged(t)}organizerConfirmationBookingRefChanged(e){let t;if(e){try{const[i,n,s]=u(e);this.stores?.scheduler.set("organizerConfirmationBookingId",n);this.stores?.scheduler.set("organizerConfirmationSalt",s);this.refConfigId=i;this.nylasSchedulerConnector?.scheduler.setConfigId(i);t=this.bookingRefExtracted.emit({configurationId:i,bookingId:n,salt:s})}catch(t){g(t);this.nylasSchedulerError.emit({notification:{...this.getErrorObject({message:`Invalid booking reference: ${e}`})},host:this.host})}}this.authPropsChanged(t)}localizationChanged(e){if(!e){return}Object.keys(e).forEach((t=>{if(!(t in l)){return}c.addResourceBundle(t,"translation",e[t],false,true)}))}defaultLanguageChanged(e){if(e){this.stores?.scheduler.set("selectedLanguage",e);c.changeLanguage(e)}}themeConfigChanged(e){this.baseProvider?.getStore("scheduler")?.set("themeConfig",e);this.applyThemeConfig(e)}languageChanged(e){const t=r(e.detail)||l.en;this.language=t;c.changeLanguage(t);this.stores?.scheduler?.set("selectedLanguage",t)}async registerComponentHandler(e){this.baseProvider?.registerComponent(e.detail)}async unregisterComponentHandler(e){this.baseProvider?.unregisterComponent(e.detail)}async monthChangedHandler(e){const t=e.detail;const i=this.nylasSchedulerConnector?.schedulerStore?.get("configSettings")?.scheduler?.available_days_in_future;const{startTime:n,endTime:s,endTimeForAvailableDaysInFuture:o}=this.validateAvailableDaysInFuture(t,i||30);if(e.defaultPrevented){return}if(n<o&&t.getTime()<o*1e3){const e=await(this.nylasSchedulerConnector?.scheduler.getAvailability(n,s));if(!e||"error"in e){this.nylasSchedulerError.emit({notification:{...this.getErrorObject(e?.error)},host:this.host})}const t=this.stores?.scheduler.get("selectableDates");if(t&&t.length>0){this.stores?.scheduler.set("selectedDate",t[0])}}}mapToBookingData(e){const t=this.stores?.scheduler.get("selectedTimeslot");const i=this.stores?.scheduler.get("selectedLanguage");const n=this.stores?.scheduler.get("selectedTimezone");const s=t?.start_time?new Date(t?.start_time).getTime()/1e3:"";const o=t?.end_time?new Date(t?.end_time).getTime()/1e3:"";return{additional_guests:e.guests,guest:{...e.primaryParticipant},additional_fields:{...e.additionalFields},start_time:s,end_time:o,email_language:i,timezone:n}}async bookButtonClickedHandler(e){if(e.defaultPrevented){return}const t=e.detail;const i=this.mapToBookingData(t);this.bookingInfoConfirmed=t;const n=this.nylasSchedulerConnector?.schedulerStore?.get("rescheduleBookingId");const s=n;if(s){const e=await(this.nylasSchedulerConnector?.scheduler.rescheduleBooking(s,t));if(!e||"error"in e){this.nylasSchedulerError.emit({notification:{...this.getErrorObject(e?.error)},host:this.host})}const n=e?.data;const o=this.bookedEventInfo.emit({...e,data:{...n,...i}});this.bookingInfoConfirmed={...this.bookingInfoConfirmed,...n};if("bookedEventInfo"in this.eventOverrides){await this.eventOverrides.bookedEventInfo(o,this.nylasSchedulerConnector)}return}const o=await(this.nylasSchedulerConnector?.scheduler.bookTimeslot(t));if(!o||"error"in o){this.nylasSchedulerError.emit({notification:{...this.getErrorObject(o?.error)},host:this.host})}const a=o?.data;const r=this.bookedEventInfo.emit({...o,data:{...a,...i}});this.bookingInfoConfirmed={...this.bookingInfoConfirmed,...a};if("bookedEventInfo"in this.eventOverrides){await this.eventOverrides.bookedEventInfo(r,this.nylasSchedulerConnector)}}dateSelectedHandler(e){const t=d(e.detail);this.selectedDateLabel=t?this.formatSelectedDateLabel(t):`${c.t("noDateSelected")}`}getSelectedLanguage(){const e=this.stores?.scheduler.get("selectedLanguage")||this.defaultLanguage||f()||l.en;return r(e)||l.en}getSelectedDateLocale(){const e=this.getSelectedLanguage();return p[e]||e||p[l.en]}formatSelectedDateLabel(e){return m(e.toLocaleDateString(this.getSelectedDateLocale(),{dateStyle:"full"}))}cancelBookedEventErrorHandler(e){this.nylasSchedulerError.emit({notification:{...this.getErrorObject(e.detail.error)},host:this.host})}cancelBookedEventValidationErrorHandler(e){this.nylasSchedulerError.emit({notification:{...this.getErrorObject(e.detail.error)},host:this.host})}rescheduleBookedEventErrorHandler(e){this.nylasSchedulerError.emit({notification:{...this.getErrorObject(e.detail.error)},host:this.host})}confirmBookingErrorHandler(e){this.nylasSchedulerError.emit({notification:{...this.getErrorObject(e.detail.error)},host:this.host})}feedbackModalClosedHandler(){this.showFeedbackModal=false}eventIsFullHandler(e){const t=e.detail.error;const i=e.detail.type;if(i==="error"){this.nylasSchedulerError.emit({notification:{...this.getErrorObject({message:t})},host:this.host})}else{this.nylasSchedulerInfo.emit({notification:{title:"Event is full",category:y.Component,type:w.Info,description:"The event you selected is full. Please try a different time.",id:(new Date).getTime().toString(),ttl:3e3},host:this.host})}}feedbackSubmittedHandler(e){C("Scheduling Page User Feedback",{extra:{configId:this.configurationId,slug:this.slug}});const t={message:e.detail.feedback};T(t,{includeReplay:true,captureContext:{tags:{"nylas-web-element":"nylas-scheduling","nylas-web-element-version":this.version,"nylas-config-id":this.configurationId,"nylas-slug":this.slug,"host-url":window.location.href},extra:{configId:this.configurationId,slug:this.slug,version:this.version}}});this.showFeedbackModal=false}async getNylasSchedulerStore(){return this.baseProvider?.getStore("scheduler")}async getNylasSchedulerConnector(){return this.nylasSchedulerConnector}async getRef(){return this.host}getErrorObject(e){return{title:e?.title||$.title,category:e?.category||$.category,type:w.Error,description:e?.message||"",id:(new Date).getTime().toString(),ttl:"none"}}checkIfSessionIdOrConfigIdExists(e=true){if(!this.sessionId&&!this.refConfigId&&!(this.slug&&this.clientId)){if(e){let e="";if(!this.sessionId){e+=c.t("sessionIdRequiredErrorMessage")}if(!this.sessionId&&!this.refConfigId&&!(this.slug&&this.clientId)){e=c.t("sessionIdRequiredErrorMessage")+" "+c.t("publicConfigErrorMessage")}this.nylasSchedulerError.emit({notification:{title:c.t("schedulingComponentErrorTitle"),category:y.Component,type:w.Error,description:e,id:(new Date).getTime().toString(),ttl:"none"},host:this.host})}return false}return true}isTimeslotValid(e){const t=new Date(e.start_time);if(t<new Date){this.nylasSchedulerError.emit({notification:{title:c.t("invalidTimeslotErrorTitle"),category:y.Component,type:w.Error,description:c.t("invalidTimeslotErrorMessage"),id:(new Date).getTime().toString(),ttl:"none"},host:this.host});return false}return true}validateAvailableDaysInFuture(e,t){const i=new Date;const n=new Date(e.getFullYear(),e.getMonth(),1).getTime()/1e3;const s=new Date(e.getFullYear(),e.getMonth()+1,1).getTime()/1e3;const o=Math.floor(h(i,t).getTime()/1e3);const a=Math.min(o,s);const r=n<i.getTime()/1e3?Math.floor(i.getTime()/1e3):n;return{startTime:r,endTime:a,endTimeForAvailableDaysInFuture:o}}applyThemeConfig(e){if(e){for(const[t,i]of Object.entries(e)){this.host.style.setProperty(`${t}`,i)}}}onFeedbackClick(e){e.preventDefault();this.showFeedbackModal=true}redirectToCustomUrl(e){window.location.assign(e)}nylasFormDropdownChangedHandler(e){const{name:t,value:i}=e.detail;if(t==="language"){const e=l[i];c.changeLanguage(e);this.stores?.scheduler?.set("selectedLanguage",e)}}render(){const t=this.mode==="app";const i=this.baseProvider?.getStore("scheduler");const n=i?.get("eventInfo");const o=i?.get("showBookingForm");const a=i?.get("cancelledEventInfo");const r=i?.get("cancelBookingId");const l=i?.get("selectedTimeslot");const h=i?.get("rescheduleBookingId");const g=i?.get("organizerConfirmationBookingId");const f=i?.get("rejectBookingId");const u=i?.get("confirmedEventInfo");const p=i?.get("nylasBranding")||this.nylasBranding;const m=d(i?.get("selectedDate"));const y=i?.get("configSettings")?.scheduler?.confirmation_redirect_url;const _=Object.keys(b).map((e=>({label:b[e],value:e})));const w=this.getSelectedLanguage();const v=m?this.formatSelectedDateLabel(m):`${c.t("noDateSelected")}`;if(t&&(r||f)&&!a){return e(s,null,e(D,{version:this.version,nylasBranding:p,isLoading:this.isLoading,showNotification:this.showNotification},e("div",{class:"cancel-flow-page",part:"cancel-flow-page"},e("nylas-cancel-booking-form",{selectedTimeslot:l,cancelBookingId:r,rejectBookingId:f,exportparts:"ncbf, ncbf__icon, ncbf__title, ncbf__description, ncbf__reason-textarea, ncbf__button-cta, ncbf__button-outline, ncbf__card"}))),e("div",{class:"language-feedback-container"},this.enableUserFeedback&&e("button-component",{id:"report-issue",variant:"basic",onClick:e=>this.onFeedbackClick(e)},e("feedback-icon",null)),e("select-dropdown",{name:"language",searchPlaceholder:c.t("search"),options:_,withChevron:false,themeConfig:this.themeConfig,defaultSelectedOption:_.find((e=>e.value==w)),exportparts:"sd_dropdown: nse__language-dropdown, sd_dropdown-button: nse__language-drop-button, sd_dropdown-content: nse__language-drop-content, sd_dropdown_label: nse__language-drop-label"},e("span",{slot:"select-icon"},e("translate-icon",{width:"20",height:"20"})))),this.showFeedbackModal&&e("nylas-feedback-form",null))}if(t&&g){return e(s,null,e(D,null,e("div",{class:"manual-confirmation-page",part:"manual-confirmation-page"},e("nylas-organizer-confirmation-card",{organizerConfirmationBookingId:g,exportparts:"nmcc, nmcc__title, nmcc__description, nmcc__button-cta, nmcc__button-outline"}))),e("div",{class:"language-feedback-container"},this.enableUserFeedback&&e("button-component",{id:"report-issue",variant:"basic",onClick:e=>this.onFeedbackClick(e)},e("feedback-icon",null)),e("select-dropdown",{name:"language",searchPlaceholder:c.t("search"),options:_,withChevron:false,themeConfig:this.themeConfig,defaultSelectedOption:_.find((e=>e.value==w)),exportparts:"sd_dropdown: nse__language-dropdown, sd_dropdown-button: nse__language-drop-button, sd_dropdown-content: nse__language-drop-content, sd_dropdown_label: nse__language-drop-label"},e("span",{slot:"select-icon"},e("translate-icon",{width:"20",height:"20"})))),this.showFeedbackModal&&e("nylas-feedback-form",null))}if(t&&a){return e(s,null,e(D,{version:this.version,nylasBranding:p,isLoading:this.isLoading,showNotification:this.showNotification},e("div",{class:"cancelled-event-page",part:"cancelled-event-page"},e("nylas-cancelled-event-card",{cancelledEventInfo:a,exportparts:"ncec, ncec__icon, ncec__title, ncec__description, ncec__button-outline, ncec__card"}))),e("div",{class:"language-feedback-container"},this.enableUserFeedback&&e("button-component",{id:"report-issue",variant:"basic",onClick:e=>this.onFeedbackClick(e)},e("feedback-icon",null)),e("select-dropdown",{name:"language",searchPlaceholder:c.t("search"),options:_,withChevron:false,themeConfig:this.themeConfig,defaultSelectedOption:_.find((e=>e.value==w)),exportparts:"sd_dropdown: nse__language-dropdown, sd_dropdown-button: nse__language-drop-button, sd_dropdown-content: nse__language-drop-content, sd_dropdown_label: nse__language-drop-label"},e("span",{slot:"select-icon"},e("translate-icon",{width:"20",height:"20"})))),this.showFeedbackModal&&e("nylas-feedback-form",null))}if(t&&u){return e(s,null,e(D,{version:this.version,nylasBranding:p,isLoading:this.isLoading,showNotification:this.showNotification},e("div",{class:"cancelled-event-page",part:"confirmed-event-page"},e("nylas-confirmed-event-card",{confirmedEventInfo:u,exportparts:"ncec, ncec__icon, ncec__title, ncec__description, ncec__button-outline, ncec__card"}))),e("div",{class:"language-feedback-container"},this.enableUserFeedback&&e("button-component",{id:"report-issue",variant:"basic",onClick:e=>this.onFeedbackClick(e)},e("feedback-icon",null)),e("select-dropdown",{name:"language",searchPlaceholder:c.t("search"),options:_,withChevron:false,themeConfig:this.themeConfig,defaultSelectedOption:_.find((e=>e.value==w)),exportparts:"sd_dropdown: nse__language-dropdown, sd_dropdown-button: nse__language-drop-button, sd_dropdown-content: nse__language-drop-content, sd_dropdown_label: nse__language-drop-label"},e("span",{slot:"select-icon"},e("translate-icon",{width:"20",height:"20"})))),this.showFeedbackModal&&e("nylas-feedback-form",null))}if(t&&n&&y){const e=this.bookingInfoConfirmed?.primaryParticipant;const t=this.bookingInfoConfirmed?.location;const i=this.bookingInfoConfirmed?.booking_ref;const s=this.bookingInfoConfirmed?.additionalFields||{};if(this.bookingInfo&&typeof this.bookingInfo?.additionalFields!=="undefined"){const e=this.bookingInfo.additionalFields;Object.keys(e).forEach((t=>{if(!s[t]&&e?.[t]){s[t]=e[t].value}}))}const o=this.stores?.scheduler.get("selectedTimeslot");const a=this.stores?.scheduler.get("selectedTimezone");const r=this.stores?.scheduler.get("selectedLanguage");const l=this.stores?.scheduler.get("configSettings");const c=this.configurationId?this.configurationId:l?.configuration_id;const d=window.location.search;const h=new URLSearchParams(d);h.set("booking_id",n.booking_id);e?.name&&h.set("name",e.name);e?.email&&h.set("email",e.email);o?.start_time&&h.set("start_time",(new Date(o.start_time).getTime()/1e3).toString());o?.end_time&&h.set("end_time",(new Date(o.end_time).getTime()/1e3).toString());a&&h.set("tz",a);r&&h.set("language",r);s&&h.set("additional_values",JSON.stringify(s));this.slug&&h.set("page_slug",this.slug);c&&h.set("config_id",c);t&&h.set("location",t);i&&h.set("booking_ref",i);const g=new URL(y,window.location.origin);h.forEach(((e,t)=>{g.searchParams.set(t,e)}));this.redirectToCustomUrl(g.toString());return}if(t&&n){return e(s,null,e(D,{version:this.version,nylasBranding:p,isLoading:this.isLoading,showNotification:this.showNotification},e("div",{class:"booked-event-page",part:"booked-event-page ns_booked-event-page"},e("nylas-booked-event-card",{selectedTimeslot:l,eventInfo:n,exportparts:"nbec, nbec__title, nbec__card, nbec__description, nbec__button-outline, nbec__cancel-cta, nbec__reschedule-cta"}))),e("div",{class:"language-feedback-container"},this.enableUserFeedback&&e("button-component",{id:"report-issue",variant:"basic",onClick:e=>this.onFeedbackClick(e)},e("feedback-icon",null)),e("select-dropdown",{name:"language",searchPlaceholder:c.t("search"),options:_,withChevron:false,themeConfig:this.themeConfig,defaultSelectedOption:_.find((e=>e.value==w)),exportparts:"sd_dropdown: nse__language-dropdown, sd_dropdown-button: nse__language-drop-button, sd_dropdown-content: nse__language-drop-content, sd_dropdown_label: nse__language-drop-label"},e("span",{slot:"select-icon"},e("translate-icon",{width:"20",height:"20"})))),this.showFeedbackModal&&e("nylas-feedback-form",null))}if(t&&(!n||!!h)&&!o){const t=this.host.querySelector('[slot="timeslot-picker-cta-label"]');return e(s,null,e(D,{version:this.version,nylasBranding:p,isLoading:this.isLoading,showNotification:this.showNotification},h&&e(z,null,`${c.t("rescheduleTitle")}`),e("div",{class:"select-date-page",part:"select-date-page ns_select-date-page"},e("div",{class:"left-panel",part:"ns_left-panel"},e("nylas-date-picker",{exportparts:"ndp, ndp__title, ndp__month-header, ndp__month-button, ndp__day, ndp__date, ndp__date--disabled, ndp__date--selected, ndp__date--current-day, ndp__date--current-month"}),e("nylas-locale-switch",{exportparts:"nls, nls__timezone, nls__timezone-dropdown, nls__timezone-drop-button, nls__timezone-drop-button-selected-label, nls__timezone-drop-content, nls__timezone-drop-label, nls__language, nls__language-dropdown, nls__language-drop-button, nls__language-drop-content, nls__language-drop-label"})),e("div",{class:`right-panel ${h?"reschedule":""}`,part:`ns_right-panel ${h?"ns_reschedule":""}`},e("h2",{part:"ns_right-panel__title"},e("calendar-icon",{part:"ns_right-panel__calendar-icon"}),e("span",{id:"selectedDate",part:"ns_right-panel__selected-date"},v)),e("nylas-timeslot-picker",{exportparts:"ntp, ntp__time-picker-wrapper, ntp__timeslots, ntp__timeslot, ntp__timeslot--selected, ntp__button-primary"},t&&e("span",{slot:"timeslot-picker-cta-label"},e("slot",{name:"timeslot-picker-cta-label"})))))),this.enableUserFeedback&&e("button-component",{id:"report-issue",variant:"basic",onClick:e=>this.onFeedbackClick(e)},e("feedback-icon",null)),this.showFeedbackModal&&e("nylas-feedback-form",null))}if(t&&!n&&o){return e(s,null,e(D,{version:this.version,nylasBranding:p,isLoading:this.isLoading,showNotification:this.showNotification},h&&e(z,null,`${c.t("rescheduleTitle")}`),e("div",{class:"additional-data-page",part:"additional-data-page ns_additional-data-page"},e("div",{class:"left-panel ns_left-panel",part:"ns_left-panel"},e("div",{class:"wrapper",part:"ns_left-panel__wrapper"},e("nylas-selected-event-card",{exportparts:"nsec, nsec__card, nsec__icon, nsec__date, nsec__time, nsec__timezone"}))),e("div",{class:`right-panel ${h?"reschedule":""}`,part:`ns_right-panel ${h?"ns_reschedule":""}`},e("nylas-booking-form",{exportparts:"nbf, nbf__input-textfield, nbf__button-ghost, nbf__button-outline, nbf__button-primary, nbf__input-wrapper, nbf__checkbox-component, nbf__radio-button-group, nbf__textarea-component, nbf__dropdown, nbf__dropdown-button, nbf__dropdown-content"})))),e("div",{class:"language-feedback-container"},this.enableUserFeedback&&e("button-component",{id:"report-issue",variant:"basic",onClick:e=>this.onFeedbackClick(e)},e("feedback-icon",null)),e("select-dropdown",{name:"language",searchPlaceholder:c.t("search"),options:_,withChevron:false,themeConfig:this.themeConfig,defaultSelectedOption:_.find((e=>e.value==w)),exportparts:"sd_dropdown: nse__language-dropdown, sd_dropdown-button: nse__language-drop-button, sd_dropdown-content: nse__language-drop-content, sd_dropdown_label: nse__language-drop-label"},e("span",{slot:"select-icon"},e("translate-icon",{width:"20",height:"20"})))),this.showFeedbackModal&&e("nylas-feedback-form",null))}return e(s,null,e("slot",null))}get host(){return o(this)}static get watchers(){return{configurationId:["configurationIdChanged"],schedulerApiUrl:["schedulerApiUrlChanged"],sessionId:["sessionIdChanged"],slug:["slugChanged"],clientId:["clientIdChanged"],bookingInfo:["bookingInfoChanged"],rescheduleBookingRef:["rescheduleBookingRefChanged"],cancelBookingRef:["cancelBookingRefChanged"],organizerConfirmationBookingRef:["organizerConfirmationBookingRefChanged"],localization:["localizationChanged"],defaultLanguage:["defaultLanguageChanged"],themeConfig:["themeConfigChanged"]}}};U.style=R;export{U as nylas_scheduling};
2
- //# sourceMappingURL=p-ebdd566e.entry.js.map
1
+ import{h as e,F as t,r as i,c as n,H as s,a as o}from"./p-0EQQA0nE.js";import{N as a}from"./p-FlNKXp4j.js";import{n as r,L as l,i as c,f as d,h,a as g,j as f,k as u,l as p,m,c as b}from"./p-OpKyWV8q.js";import{E as y,v as _,u as w}from"./p-zgIeli_M.js";import{c as v}from"./p-_i6H-yQH.js";import{i as k,a as I,f as x,c as C,b as T}from"./p-B8tfyAQm.js";class S{constructor(){this.component=e=>{const t=y.Component;const i=`${e} Error`;return{endtime_not_in_future:(e='"endtime" can not be in the future')=>({title:i,message:e,category:t}),no_booking_info:(e="No booking info provided")=>({title:i,message:e,category:t}),no_timeslot_selected:(e="No timeslot selected")=>({title:i,message:e,category:t}),no_timezone_selected:(e="No timezone selected")=>({title:i,message:e,category:t}),no_booking_id:(e="No booking id provided")=>({title:i,message:e,category:t}),no_salt:(e="No salt provided")=>({title:i,message:e,category:t}),invalid_start_time:(e="Invalid start time")=>({title:i,message:e,category:t}),invalid_end_time:(e="Invalid end time")=>({title:i,message:e,category:t}),invalid_timezone:(e="Invalid timezone")=>({title:i,message:e,category:t}),no_config_id:(e="No configuration id provided")=>({title:i,message:e,category:t})}};this.api=e=>{const t=y.Api;const i=`${e} Error`;return{invalid_session:e=>({title:i,message:e,category:t}),general_error:e=>({title:i,message:e,category:t}),internal_error:e=>({title:i,message:e,category:t}),invalid_request_error:e=>({title:i,message:e,category:t}),timeslot_not_available:e=>({title:i,message:e,category:t}),provider_error:e=>({title:i,message:e,category:t}),not_found_error:e=>({title:i,message:e,category:t})}}}}class E{constructor({schedulerAPIURL:e,schedulerStore:t,sessionId:i,configId:n,slug:s,clientId:o}){this.errors=new S;this.schedulerStore=t;this.schedulerAPIURL=e;this.sessionId=i;this.configId=n;this.slug=s;this.clientId=o}getHeaders(){return this.sessionId?{Authorization:`Bearer ${this.sessionId}`}:{}}async makeAPIRequest(e,t,i,n={},s){try{const o=new URL(this.schedulerAPIURL);o.pathname=e;const a=await fetch(decodeURIComponent(o.toString()),{method:t,headers:{"Content-Type":"application/json",Origin:window.location.origin,"X-Source":"nylas-scheduling","X-Nylas-Web-Elements-Version":_,...this.clientId&&{"X-Nylas-Application-Public-Id":this.clientId},...n},body:i,signal:s});const r=await a.json();return r}catch(e){if(e.name==="AbortError"){throw e}return{error:{message:e.message,title:"API request failed",type:"api"}}}}getErrorMessage(e){let t=e?.message||e?.title||"Something went wrong";if(e?.type==="provider_error"){t=e?.provider_error?.error?.message||e?.provider_error?.error?.title||"Something went wrong"}return t}setConfigId(e){this.configId=e}setSchedulerAPIURL(e){if(e==="/"){e=new URL(window.location.href).origin}this.schedulerAPIURL=e}setSessionId(e){this.sessionId=e}selectDate(e){this.schedulerStore.set("selectedDate",e);this.schedulerStore.set("selectedTimeslot",null)}selectTime(e){this.schedulerStore.set("selectedTimeslot",e)}selectTimezone(e){this.schedulerStore.set("selectedTimezone",e)}selectLanguage(e){const t=r(e)||l.en;this.schedulerStore.set("selectedLanguage",t);c.changeLanguage(t)}async toggleAdditionalData(e){if(!e){await this.refetchAvailability()}this.schedulerStore.set("showBookingForm",e)}setParticipantName(e){const{bookingInfo:t}=this.schedulerStore.state;this.schedulerStore.set("bookingInfo",{...t,primaryParticipant:{...t?.primaryParticipant,name:e}})}setParticipantEmail(e){const{bookingInfo:t}=this.schedulerStore.state;this.schedulerStore.set("bookingInfo",{...t,primaryParticipant:{...t?.primaryParticipant,email:e}})}async refetchAvailability(){const e=new Date;const t=new Date(e.getFullYear(),e.getMonth(),1).getTime()/1e3;const i=t<e.getTime()/1e3?Math.floor(e.getTime()/1e3):t;const n=new Date(e.getFullYear(),e.getMonth()+1,1).getTime()/1e3;const s=await this.getAvailability(i,n);return s}async resetStoreStateAndFetchAvailability(){const e=new Date;const t=await this.refetchAvailability();const i=this.schedulerStore.get("availability").find((e=>{const t=d(e.start_time);return t?t>new Date:false}));let n=e;if(i){n=d(i.start_time)||e}this.schedulerStore.set("selectedDate",n);this.schedulerStore.set("eventInfo",null);this.schedulerStore.set("showBookingForm",false);this.schedulerStore.set("selectedTimeslot",null);return t}async setReschedule(e){this.schedulerStore.set("isLoading",true);const t=this.schedulerStore.state.eventInfo;if(t){this.schedulerStore.set("reschedulingEventInfo",t)}this.schedulerStore.set("rescheduleBookingId",e);await this.getUISettings();const i=await this.resetStoreStateAndFetchAvailability().finally((()=>{this.schedulerStore.set("isLoading",false)}));return i}async setCancel(e){this.schedulerStore.set("cancelBookingId",e)}async setReject(e){this.schedulerStore.set("rejectBookingId",e)}async resetCancel(){const e=await this.resetStoreStateAndFetchAvailability();this.schedulerStore.set("cancelBookingId","");this.schedulerStore.set("rejectBookingId","");this.schedulerStore.set("cancelledEventInfo",null);return e}async goBack(){this.schedulerStore.set("cancelBookingId","");return}async resetConfirm(){const e=await this.resetStoreStateAndFetchAvailability();this.schedulerStore.set("organizerConfirmationBookingId","");this.schedulerStore.set("confirmedEventInfo",undefined);return e}async bookTimeslot(e){this.schedulerStore.set("isLoading",true);const{selectedTimeslot:t,selectedTimezone:i,bookingInfo:n,selectedLanguage:s}=this.schedulerStore.state;if(!e&&!n){return{error:this.errors.component(c.t("createBookingErrorTitle")).no_booking_info()}}const o=e?.timeslot||t;if(!o){return{error:this.errors.component(c.t("createBookingErrorTitle")).no_timeslot_selected()}}const a=e&&e?.timezone?e?.timezone:i;const r=s||"en-US";if(!a){return{error:this.errors.component(c.t("createBookingErrorTitle")).no_timezone_selected()}}const l=[...this.schedulerStore.get("availabilityOrderEmails")];let d="";const h=o?.emails||[];const g={};Object.entries(n?.additionalFields||{}).forEach((([e,t])=>{g[e]=t.value}));const f=e?e?.primaryParticipant:n?.primaryParticipant;const u=e?e?.guests||[]:n?.guests||[];const p=e?e?.additionalFields:g;const m=this.getHeaders();const b=!this.sessionId&&this.configId?`?configuration_id=${this.configId}`:!this.sessionId&&this.slug&&this.clientId?`?slug=${this.slug}&client_id=${this.clientId}`:"";const y=`/v3/scheduling/bookings${b}`;if(l.length===0){const e=await this.makeAPIRequest(decodeURIComponent(y),"POST",JSON.stringify({additional_fields:p,additional_guests:u,guest:{...f},start_time:o.start_time.getTime()/1e3,end_time:o.end_time.getTime()/1e3,timezone:a,event_id:o?.event_id||undefined,master_id:o?.master_id||undefined,calendar_id:o?.calendar_id||undefined,email_language:this.getTwoLetterLanguageCode(r)}),m);this.schedulerStore.set("isLoading",false);if("data"in e){this.schedulerStore.set("eventInfo",e.data);return e}return{error:e.error}}while(l.length>0){d=l.shift();if(!h.includes(d)){continue}const e=await this.makeAPIRequest(decodeURIComponent(y),"POST",JSON.stringify({participants:d?[{email:d}]:undefined,additional_fields:p,additional_guests:u,guest:{...f},start_time:o.start_time.getTime()/1e3,end_time:o.end_time.getTime()/1e3,timezone:a,email_language:this.getTwoLetterLanguageCode(r)}),m);if("data"in e){this.schedulerStore.set("isLoading",false);this.schedulerStore.set("eventInfo",e?.data);return e}else if(e.error?.message?.startsWith("The selected timeslot is unavailable")){continue}else{this.schedulerStore.set("isLoading",false);const t=e.error?.type;let i=e.error;if(t&&t in this.errors.api(c.t("createBookingErrorTitle"))){const e=this.getErrorMessage(i);i=this.errors.api(c.t("createBookingErrorTitle"))[t](e)}return{error:i}}}this.schedulerStore.set("isLoading",false);return{error:this.errors.api(c.t("createBookingErrorTitle")).timeslot_not_available("The selected timeslot is unavailable")}}async getUISettings(e){this.schedulerStore.set("isLoading",true);const t=this.schedulerStore.get("rescheduleBookingId");const i=this.getHeaders();let n=!this.sessionId&&this.configId?`?configuration_id=${this.configId}`:!this.sessionId&&this.slug&&this.clientId?`?slug=${this.slug}&client_id=${this.clientId}`:"";if(t&&!!n){n+=`&booking_id=${t}`}else if(t){n+=`?booking_id=${t}`}const s=`/v3/scheduling/ui-settings${n}`;const o=await this.makeAPIRequest(s,"GET",undefined,i,e);if("error"in o){this.schedulerStore.set("isLoading",false);const e=o.error?.type;let t=o.error;if(e&&e in this.errors.api(c.t("getUISettingErrorTitle"))){t=this.errors.api(c.t("getUISettingErrorTitle"))[e](t?.message||t?.title||"Something went wrong")}return{error:t}}if("data"in o){this.schedulerStore.set("configSettings",o.data);this.clientId=o.data.app_client_id||this.clientId}this.schedulerStore.set("isLoading",false);return o}getTwoLetterLanguageCode(e){return e.split("-")[0]}getStartTimeWithMinBookingNotice(e){const t=this.schedulerStore.get("configSettings")?.scheduler;const i=t?.min_booking_notice;if(!i){return e}const n=(new Date).getTime();if(e<(n+i*60*1e3)/1e3){return Math.floor((n+i*60*1e3)/1e3)}else{return e}}getEndTimeForAvailableDaysInFuture(e){const t=new Date;const i=this.schedulerStore.get("configSettings")?.scheduler?.available_days_in_future;const n=Math.floor(h(t,i).getTime()/1e3);const s=Math.min(n,e);return s}async getAvailability(e=0,t=0,i){this.schedulerStore.set("isLoading",true);const n=new URLSearchParams;const s=new Date;const o=s.getTime();if(t&&t<o/1e3){this.schedulerStore.set("isLoading",false);const e=this.errors.component(c.t("getAvailabilityErrorTitle")).endtime_not_in_future();return{error:e}}if(!e){const t=new Date(s.getFullYear(),s.getMonth(),1);e=Math.floor(t.getTime()/1e3)}if(!t){const e=new Date(s.getFullYear(),s.getMonth()+1,0);t=Math.floor(e.getTime()/1e3)}t=this.getEndTimeForAvailableDaysInFuture(t);const a=this.getStartTimeWithMinBookingNotice(e);e=a;t=a>t?a+1:t;n.append("start_time",encodeURIComponent(e.toString()));n.append("end_time",encodeURIComponent(t.toString()));if(this.configId&&!this.sessionId){n.append("configuration_id",encodeURIComponent(this.configId))}else if(this.slug&&this.clientId&&!this.sessionId){n.append("slug",encodeURIComponent(this.slug));n.append("client_id",encodeURIComponent(this.clientId))}const r=this.schedulerStore.get("rescheduleBookingId");if(r){n.append("booking_id",encodeURIComponent(r))}const l=n.toString();const d=`/v3/scheduling/availability${l?`?${l}`:""}`;const h=this.getHeaders();const g=await this.makeAPIRequest(decodeURIComponent(d),"GET",undefined,h,i);if("error"in g){this.schedulerStore.set("availability",[]);this.schedulerStore.set("isLoading",false);const e=g.error?.type;let t=g.error;if(t?.message?.toLowerCase().includes("Failed to find a valid Grant")){const e=c.t("invalidGrantError");return{error:{title:c.t("invalidGrantErrorTitle"),message:e,category:y.Api}}}if(e&&e in this.errors.api(c.t("getAvailabilityErrorTitle"))){const i=this.getErrorMessage(t);t=this.errors.api(c.t("getAvailabilityErrorTitle"))[e](i)}return{error:t}}if("data"in g){const e=g.data?.time_slots?.map((e=>({...e,start_time:new Date(e.start_time*1e3),end_time:new Date(e.end_time*1e3)})))||[];const t=e.filter((e=>e.start_time.getTime()>o));const i=t.sort(((e,t)=>e.start_time.getTime()-t.start_time.getTime()));this.schedulerStore.set("availability",i);const n=g.data?.order||[];this.schedulerStore.set("availabilityOrderEmails",n)}this.schedulerStore.set("isLoading",false);return g}async cancelBooking(e,t){this.schedulerStore.set("isLoading",true);if(!e){return{error:this.errors.component(c.t("cancelBookingErrorTitle")).no_booking_id()}}const i=!this.sessionId&&this.configId?`?configuration_id=${this.configId}`:!this.sessionId&&this.slug&&this.clientId?`?slug=${this.slug}&client_id=${this.clientId}`:"";const n=`/v3/scheduling/bookings/${e}${i}`;const s=this.getHeaders();const o=await this.makeAPIRequest(decodeURIComponent(n),"DELETE",JSON.stringify({action:"cancel",cancellation_reason:t}),s);if("error"in o){this.schedulerStore.set("isLoading",false);const e=o.error?.type;let t=o.error;if(e&&e in this.errors.api(c.t("cancelBookingErrorTitle"))){const i=this.getErrorMessage(t);t=this.errors.api(c.t("cancelBookingErrorTitle"))[e](i)}return{error:t}}this.schedulerStore.set("cancelledEventInfo",{booking_id:e});this.schedulerStore.set("rescheduleBookingId","");this.schedulerStore.set("isLoading",false);return o}async rescheduleBooking(e,t){this.schedulerStore.set("isLoading",true);if(!e){return{error:this.errors.component(c.t("rescheduleBookingErrorTitle")).no_booking_id()}}const i=this.errors.api(c.t("rescheduleBookingErrorTitle"));const n=this.errors.component(c.t("rescheduleBookingErrorTitle"));const{bookingInfo:s,selectedTimeslot:o,selectedTimezone:a,selectedLanguage:r}=this.schedulerStore.state;const{startTime:l,endTime:d,timezone:h}=t;const g=l||o?.start_time;if(!g){return{error:n.invalid_start_time('Please pass "startTime" in data or set "selectedTimeslot" in the defaultSchedulerState.')}}const f=d||o?.end_time;if(!f){return{error:n.invalid_end_time('Please pass "endTime" in data or set "selectedTimeslot" in the defaultSchedulerState.')}}const u=this.schedulerStore.get("availabilityOrderEmails");let p="";if(u.length>0){const e=o?.emails||[];for(let t=0;t<u.length;t++){if(e.includes(u[t])){p=u[t];break}}}const m=h||a;if(!m){return{error:n.invalid_timezone('Please pass "timezone" in data or set "selectedTimezone" in the defaultSchedulerState.')}}const b=o?.event_id||undefined;const y=o?.master_id||undefined;const _=o?.calendar_id||undefined;const w={};Object.entries(s?.additionalFields||{}).forEach((([e,t])=>{w[e]=t.value}));const v=t?t?.primaryParticipant:s?.primaryParticipant;const k=t?t?.guests||[]:s?.guests||[];const I=t?t?.additionalFields:w;const x=!this.sessionId&&this.configId?`?configuration_id=${this.configId}`:!this.sessionId&&this.slug&&this.clientId?`?slug=${this.slug}&client_id=${this.clientId}`:"";const C=`/v3/scheduling/bookings/${e}${x}`;const T=this.getHeaders();const S=await this.makeAPIRequest(decodeURIComponent(C),"PATCH",JSON.stringify({start_time:g.getTime()/1e3,end_time:f.getTime()/1e3,timezone:m,additional_fields:I,guest:{...v},additional_guests:k,participants:p?[{email:p}]:undefined,email_language:this.getTwoLetterLanguageCode(r),event_id:b,master_id:y,calendar_id:_}),T);if("error"in S){this.schedulerStore.set("isLoading",false);const e=S.error?.type;let t=S.error;if(e&&e in i){const n=this.getErrorMessage(t);t=i[e](n)}return{error:t}}const E=this.schedulerStore.get("reschedulingEventInfo");if("data"in S){this.schedulerStore.set("eventInfo",S?.data);if(S.data?.booking_id){this.schedulerStore.set("rescheduleBookingId",S.data.booking_id)}}else if(E){this.schedulerStore.set("eventInfo",E)}else{const t={booking_id:e};this.schedulerStore.set("eventInfo",t)}this.schedulerStore.set("reschedulingEventInfo",undefined);this.schedulerStore.set("isLoading",false);return S}async updateBooking(e){this.schedulerStore.set("isLoading",true);const{bookingId:t,status:i,reason:n}=e;const s=this.schedulerStore.get("organizerConfirmationSalt");const o=i==="confirmed"?c.t("confirmBookingErrorTitle"):c.t("rejectBookingErrorTitle");if(!t){return{error:this.errors.component(o).no_booking_id()}}if(!s){return{error:this.errors.component(o).no_salt()}}const a=!this.sessionId&&this.configId?`?configuration_id=${this.configId}`:!this.sessionId&&this.slug&&this.clientId?`?slug=${this.slug}&client_id=${this.clientId}`:"";const r=`/v3/scheduling/bookings/${t}${a}`;const l=this.getHeaders();const d=await this.makeAPIRequest(decodeURIComponent(r),"PUT",JSON.stringify({status:i,cancellation_reason:n,salt:s}),l);if("error"in d){this.schedulerStore.set("isLoading",false);const e=d.error?.type;let t=d.error;if(e&&e in this.errors.api(o)){const i=this.getErrorMessage(t);t=this.errors.api(o)[e](i)}return{error:t}}if("data"in d&&i==="confirmed"){this.schedulerStore.set("confirmedEventInfo",d?.data)}else if("request_id"in d&&i==="cancelled"){this.schedulerStore.set("cancelledEventInfo",{booking_id:t})}this.schedulerStore.set("organizerConfirmationBookingId","");this.schedulerStore.set("isLoading",false);return d}async validateGroupEventTimeslot(e){this.schedulerStore.set("isLoading",true);const t=this.schedulerStore.get("configSettings")?.configuration_id;if(!t){return{error:this.errors.component(c.t("validateTimeslotErrorTitle")).no_config_id()}}const i=this.getHeaders();const n=`/v3/scheduling/configurations/${t}/group-events/validate-timeslot`;const s=await this.makeAPIRequest(decodeURIComponent(n),"POST",JSON.stringify({...e,start_time:e.start_time.getTime()/1e3,end_time:e.end_time.getTime()/1e3}),i);if("error"in s){this.schedulerStore.set("isLoading",false);const e=s.error?.type;let t=s.error;if(e&&e in this.errors.api(c.t("validateTimeslotErrorTitle"))){const i=this.getErrorMessage(t);t=this.errors.api(c.t("validateTimeslotErrorTitle"))[e](i)}this.refetchAvailability();return{error:t}}this.schedulerStore.set("selectedTimeslot",e);this.schedulerStore.set("showBookingForm",true);this.schedulerStore.set("isLoading",false);return s}}class L{constructor({schedulerAPIURL:e,nylasSchedulerStore:t,sessionId:i,configId:n,slug:s,clientId:o}){if(!e){throw new Error("schedulerAPIURL is required")}if(!t){throw new Error("nylasSchedulerStore is required")}if(!i&&!n&&!(s&&o)){throw new Error("sessionId is required for private configs. If using public config either pass a configurationId or a combination of slug and clientId.")}if(e==="/"){const t=new URL(window.location.href);e=t.origin}this.configId=n;this.sessionId=i;this.schedulerAPIURL=e;this.nylasSchedulerStore=t;this.slug=s;this.clientId=o}init(){g("NylasConnector init")}get schedulerStore(){return this.nylasSchedulerStore}setSchedulerAPIURL(e){if(e==="/"){e=new URL(window.location.href).origin}this.schedulerAPIURL=e;if(this._schedulerAPIConnector){this._schedulerAPIConnector.setSchedulerAPIURL(e)}}get scheduler(){if(this._schedulerAPIConnector){return this._schedulerAPIConnector}this._schedulerAPIConnector=new E({schedulerAPIURL:this.schedulerAPIURL,schedulerStore:this.schedulerStore,sessionId:this.sessionId,configId:this.configId,slug:this.slug,clientId:this.clientId});return this._schedulerAPIConnector}resetStores(){this.nylasSchedulerStore.reset()}}function B(e={}){const t={selectedDate:null,selectedLanguage:f()||l.en,selectedTimezone:Intl.DateTimeFormat().resolvedOptions().timeZone,selectedTimeslot:null,showBookingForm:false,availabilityOrderEmails:[],selectableDates:null,availability:[],eventDuration:0,state:"ready",eventInfo:null,cancelledEventInfo:null,isLoading:false,nylasBranding:true,...e};g(`[defaultNylasStoreState]: `,t);const i=v(t);i.onChange("availability",(e=>{g(`[availability]: `,e);const t=e.map((e=>e.start_time));g(`[selectableDates]: `,t);i.set("selectableDates",t);const n=e[0];if(!n)return;const s=Math.floor((n.end_time.getTime()-n.start_time.getTime())/6e4);g(`[durationMinutes]: `,s);i.set("eventDuration",s)}));i.reset=()=>{for(const e in t){const n=t[e];i.set(e,n)}};return i}const D=(i,n)=>{const s=i.isLoading;const o=i.showNotification;const a=i.nylasBranding;const r=i.version;return e(t,null,o&&e("nylas-notification",null),s&&e("div",{class:"loading"},e("div",{class:"left"},e("div",{class:"skeleton"})),e("div",{class:"right"},e("div",{class:"skeleton"}),e("div",{class:"skeleton"}),e("div",{class:"skeleton"}),e("div",{class:"skeleton"}),e("div",{class:"skeleton"}))),!s&&n,e("div",{key:"ns-footer",class:"footer",part:"ns_footer"},a&&e("a",{href:"https://scheduler.nylas.com?utm_source=powered-by-nylas-logoutm_medium=link&utm_campaign=get-scheduler&utm_id=get-scheduler",class:"powered-by-nylas",target:"_blank",rel:"noreferrer noopener"},"Powered by ",e("span",{class:"sr-only"},"Nylas"),e("nylas-logo",{"aria-hidden":true})),e("tooltip-component",null,e("info-icon",{slot:"tooltip-icon"}),e("span",{slot:"tooltip-content"},r))))};const z=(t,i)=>e("div",{class:"message-banner"},i);const R=':host{display:flex;flex-direction:column;overflow:visible;border-radius:var(--nylas-border-radius-2x);width:fit-content;background:var(--nylas-base-0);position:relative;box-shadow:0px 4px 8px 2px rgba(0, 0, 0, 0.05), 0px 8px 16px -2px rgba(0, 0, 0, 0.1);--nylas-primary:#2563eb;--nylas-error:#cc4841;--nylas-error-50:#ffeae8;--nylas-error-100:#ffc5bf;--nylas-error-200:#fecaca;--nylas-error-pressed:#992222;--nylas-wraning:#f06c00;--nylas-success:#16a392;--nylas-info:#2b8fc2;--nylas-base-0:#ffffff;--nylas-base-25:#fcfcfd;--nylas-base-50:#f8f9fc;--nylas-base-100:#eaecf5;--nylas-base-200:#d5d9eb;--nylas-base-300:#b3b8d8;--nylas-base-400:#717bbc;--nylas-base-500:#4e5ba6;--nylas-base-600:#3e4784;--nylas-base-700:#263f72;--nylas-base-800:#293056;--nylas-base-900:#101323;--nylas-base-950:#0e101b;--nylas-color-blue-100:#e0e6f9;--nylas-border-radius:0.25rem;--nylas-border-radius-2x:0.5rem;--nylas-border-radius-3x:0.75rem;--nylas-font-family:"Inter", sans-serif;--nylas-color-black:#000000;--nylas-color-grey-900:#2c2c2c;--nylas-color-grey-800:#4b4b4b;--nylas-color-grey-700:#6e6e6e;--nylas-color-grey-600:#8e8e8e;--nylas-color-grey-500:#b3b3b3;--nylas-color-grey-400:#cacaca;--nylas-color-grey-300:#e1e1e1;--nylas-color-grey-200:#eaeaea;--nylas-color-grey-100:#f5f5f5;--nylas-color-grey-50:#fbfcfe;--nylas-color-white:#ffffff;--nylas-color-red-900:#992222;--nylas-color-red-700:#cc4841;--nylas-color-red-500:#ff786a;--nylas-color-red-300:#ffa79e;--nylas-color-red-100:#ffc5bf;--nylas-color-red-50:#ffeae8;--nylas-color-blue-900:#213571;--nylas-color-blue-700:#314fa9;--nylas-color-blue-500:#4169e1;--nylas-color-blue-300:#bdccf9;--nylas-color-blue-100:#e0e6f9;--nylas-color-blue-50:#f6f8fd;--nylas-color-yellow-900:#7c6506;--nylas-color-yellow-700:#c29f09;--nylas-color-yellow-500:#f7c90b;--nylas-color-yellow-300:#f9de70;--nylas-color-yellow-100:#fceba9;--nylas-color-yellow-50:#fdf4ce;--nylas-color-green-900:#0e6b60;--nylas-color-green-700:#16a392;--nylas-color-green-500:#17c3b2;--nylas-color-green-300:#74dbd1;--nylas-color-green-100:#a2e7e0;--nylas-color-green-50:#d1f3f0;--nylas-color-purple-900:#643554;--nylas-color-purple-700:#954f7d;--nylas-color-purple-500:#c769a7;--nylas-color-purple-300:#dda5ca;--nylas-color-purple-100:#e0bdd6;--nylas-color-purple-50:#e9dde5;--nylas-color-sky-900:#20698f;--nylas-color-sky-700:#2b8fc2;--nylas-color-sky-500:#6dceff;--nylas-color-sky-300:#8fdaff;--nylas-color-sky-100:#b8e7ff;--nylas-color-sky-50:#d9f2ff;font-family:var(--nylas-font-family);font-optical-sizing:auto;font-style:normal;font-variation-settings:"slnt" 0}@media screen and (max-width: 768px){:host{width:auto;min-width:325px}}:root{font-family:inherit}.error{padding:8rem 12rem;color:var(--nylas-base-0);background-color:var(--nylas-error);margin:1.5rem;border-radius:var(--nylas-border-radius-2x)}.message-banner{text-align:right;color:var(--nylas-base-800);padding:1rem;border-bottom:1px solid var(--nylas-color-primary-200);margin:0}.loading{margin:1.5rem;display:flex;gap:1rem}.loading .skeleton{border-radius:var(--nylas-border-radius-2x);animation:pulsate 1.5s infinite}.loading .skeleton:nth-child(2){animation-delay:-100ms}.loading .skeleton:nth-child(3){animation-delay:-200ms}.loading .skeleton:nth-child(4){animation-delay:-300ms}.loading .skeleton:nth-child(5){animation-delay:-400ms}.loading .left .skeleton{height:100%;width:400px}.loading .right .skeleton{height:5rem;width:300px;margin-bottom:1rem}.loading .right .skeleton:last-child{margin-bottom:0}@keyframes pulsate{0%{background-color:var(--nylas-base-50)}50%{background-color:var(--nylas-base-100)}100%{background-color:var(--nylas-base-50)}}.select-date-page,.additional-data-page,.booked-event-page,.manual-confirmation-page,.cancelled-event-page,.cancel-flow-page{border-top-left-radius:var(--nylas-border-radius-2x);border-top-right-radius:var(--nylas-border-radius-2x)}.select-date-page,.additional-data-page{display:flex}@media screen and (max-width: 768px){.select-date-page,.additional-data-page{flex-direction:column}}.booked-event-page,.manual-confirmation-page{background-color:var(--nylas-base-50)}.cancelled-event-page,.manual-confirmation-page,.cancel-flow-page{padding:1rem;height:496px;display:flex;justify-content:center;align-items:center}.booked-event-page,.manual-confirmation-page,.cancelled-event-page,.cancel-flow-page{min-width:784px;background:var(--nylas-base-50)}@media screen and (max-width: 768px){.booked-event-page,.manual-confirmation-page,.cancelled-event-page,.cancel-flow-page{min-width:90%}}.left-panel{display:flex;flex-direction:column;min-width:424px;border-top-left-radius:inherit;background:var(--nylas-base-0);position:relative;padding:1rem 0 0 0;height:624px}@media screen and (max-width: 768px){.left-panel{border-top-right-radius:inherit;min-width:unset;height:auto}}@media screen and (max-width: 768px){.select-date-page .left-panel{height:624px}}.border{margin-left:-20px;margin-right:-20px;border-top-width:1px;height:0.5px;background-color:var(--nylas-base-200)}@media screen and (max-width: 768px){.border{display:none}}.right-panel{min-width:360px;width:360px;background-color:var(--nylas-base-50);height:624px;padding-top:16px;border-left:1px solid var(--nylas-base-200);border-top-right-radius:inherit}.right-panel.reschedule{border-top-right-radius:0px}@media screen and (max-width: 768px){.right-panel{border-top-right-radius:0px;width:inherit;min-width:unset;height:auto;border-left:none}}.right-panel h2{display:flex;margin:0;height:48px;gap:0.5rem;justify-content:center;align-items:center;width:auto;font-size:1.125rem;line-height:1.5rem;font-weight:500;text-align:center;color:var(--nylas-base-800)}.additional-data-page .left-panel{background-color:var(--nylas-base-50)}.additional-data-page .right-panel{background-color:var(--nylas-base-0)}nylas-selected-event-card{height:604px;padding:0 1rem}@media screen and (max-width: 768px){nylas-selected-event-card{height:250px}}.footer{display:flex;justify-content:flex-end;align-items:center;gap:8px;padding:16px;font-size:14px;font-weight:300;color:var(--nylas-base-500);border-top:1px solid var(--nylas-base-200);min-height:24px}.footer .powered-by-nylas{display:flex;align-items:center;text-decoration:none;color:var(--nylas-base-500)}.footer .powered-by-nylas:hover{color:var(--nylas-base-800)}.footer svg{fill:var(--nylas-base-500)}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0, 0, 0, 0);white-space:nowrap;border-width:0}.footer svg{margin-top:1px}nylas-selected-event-card::part(nsec__timezone){position:absolute;bottom:0}nylas-notification{margin:1.5rem;width:-webkit-fill-available;width:-moz-available;position:absolute}nylas-locale-switch{position:absolute;padding:18px 20px;bottom:0;width:-webkit-fill-available;width:-moz-available;border-top:1px solid var(--nylas-base-200)}@media screen and (max-width: 768px){nylas-locale-switch{height:auto}}nylas-date-picker{padding:0 20px}button-component#report-issue{width:auto;position:absolute;bottom:4px;left:16px}.language-feedback-container{width:auto;position:absolute;bottom:4px;left:16px;display:flex;gap:8px;align-items:center}.language-feedback-container button-component#report-issue{position:initial}nylas-feedback-form{position:absolute;top:0;height:100%;width:100%;display:flex;flex-direction:column;justify-content:center;align-items:center;background:rgba(0, 0, 0, 0.6);z-index:2;border-radius:inherit}';const $={title:c.t("genericErrorTitle"),category:y.Component};const U=class{constructor(e){i(this,e);this.init=n(this,"init",7);this.schedulerWillLoad=n(this,"schedulerWillLoad",7);this.schedulerDidLoad=n(this,"schedulerDidLoad",7);this.nylasSchedulerError=n(this,"nylasSchedulerError",7);this.nylasSchedulerInfo=n(this,"nylasSchedulerInfo",7);this.configSettingsLoaded=n(this,"configSettingsLoaded",7);this.bookingRefExtracted=n(this,"bookingRefExtracted",7);this.bookedEventInfo=n(this,"bookedEventInfo",7);this.initDeferred=false;this.mode="app";this.schedulerApiUrl="https://api.us.nylas.com";this.nylasBranding=true;this.eventOverrides={};this.showNotification=true;this.enableUserFeedback=true;this.automaticComponentRegistration=true;this.selectedDateLabel=`${c.t("noDateSelected")}`;this.language=navigator.language;this.showFeedbackModal=false;this.bookingInfoConfirmed=null;this.version=_}connectedCallback(){g(`[nylas-scheduler] connectedCallback`)}async componentWillLoad(){g(`[nylas-scheduler] Component will load`);this.version=_;await new Promise((e=>setTimeout(e,0)));if(this.enableUserFeedback&&!k()){I({dsn:"https://9d5731f1c77ca84c9ed3fb9b3ccf7ee1@o74852.ingest.us.sentry.io/4507889638178816",release:this.version,integrations:e=>[...e.filter((e=>false)),x({colorScheme:"system",autoInject:false})],autoSessionTracking:false,beforeSend:()=>null})}const e=this.schedulerWillLoad.emit(this.host);if("schedulerWillLoad"in this.eventOverrides){await this.eventOverrides.schedulerWillLoad(e,this.nylasSchedulerConnector);if(e.defaultPrevented){return}}const t=new URLSearchParams(window.location.search);const i=r(t.get("lang"))||r(t.get("language"));const n=i||this.defaultLanguage||r(this.bookingInfo?.language)||this.defaultSchedulerState?.selectedLanguage||f()||l.en;this.language=n;c.changeLanguage(n);this.stores={scheduler:B({bookingInfo:this.bookingInfo,nylasBranding:this.nylasBranding,themeConfig:this.themeConfig,hour12:this.hour12,...this.defaultSchedulerState,selectedLanguage:n})};this.baseProvider=new a(this.host,this.stores,this.automaticComponentRegistration,this.eventOverrides);this.refConfigId=this.configurationId;let s;try{if(this.rescheduleBookingRef){const[e,t,i]=u(this.rescheduleBookingRef);this.refConfigId=e;this.stores.scheduler.set("rescheduleBookingId",t);s=this.bookingRefExtracted.emit({configurationId:e,bookingId:t})}else if(this.cancelBookingRef){const[e,t,i]=u(this.cancelBookingRef);this.refConfigId=e;this.stores.scheduler.set("cancelBookingId",t);s=this.bookingRefExtracted.emit({configurationId:e,bookingId:t})}else if(this.organizerConfirmationBookingRef){const[e,t,i]=u(this.organizerConfirmationBookingRef);this.refConfigId=e;this.stores.scheduler.set("organizerConfirmationBookingId",t);this.stores.scheduler.set("organizerConfirmationSalt",i);s=this.bookingRefExtracted.emit({configurationId:e,bookingId:t,salt:i})}}catch(e){g(e);const t=this.rescheduleBookingRef||this.cancelBookingRef||this.organizerConfirmationBookingRef;this.nylasSchedulerError.emit({notification:{...this.getErrorObject({message:`Invalid booking reference: ${t}`})},host:this.host})}this.applyThemeConfig(this.themeConfig);if("bookingRefExtracted"in this.eventOverrides){await this.eventOverrides.bookingRefExtracted(s,this.nylasSchedulerConnector);if(s.defaultPrevented){return}}if(!this.checkIfSessionIdOrConfigIdExists(false)){this.initDeferred=true;return}const o=this.baseProvider?.getStore("scheduler");this.nylasSchedulerConnector=new L({schedulerAPIURL:this.schedulerApiUrl,sessionId:this.sessionId,configId:this.refConfigId,slug:this.slug,clientId:this.clientId,nylasSchedulerStore:o});const d=this.init.emit(this.host);if("init"in this.eventOverrides){await this.eventOverrides.init(d,this.nylasSchedulerConnector);if(d.defaultPrevented){return}}this.baseProvider?.componentWillLoad(this.nylasSchedulerConnector)}async componentDidLoad(){if(this.initDeferred){return}this.baseProvider?.componentDidLoad();await Promise.resolve();const e=this.schedulerDidLoad.emit(this.host);if("schedulerDidLoad"in this.eventOverrides){await this.eventOverrides.schedulerDidLoad(e,this.nylasSchedulerConnector);if(e.defaultPrevented){return}}if(!this.checkIfSessionIdOrConfigIdExists()){return}await this.performSchedulerDataFetch()}async performSchedulerDataFetch(){this.fetchAbortController?.abort();this.fetchAbortController=new AbortController;const{signal:e}=this.fetchAbortController;try{if(this.nylasSchedulerConnector){if(this.schedulerApiUrl){this.nylasSchedulerConnector.setSchedulerAPIURL(this.schedulerApiUrl)}if(this.sessionId){this.nylasSchedulerConnector.sessionId=this.sessionId;this.nylasSchedulerConnector.scheduler.setSessionId(this.sessionId)}}this.localizationChanged(this.localization);const t=await(this.nylasSchedulerConnector?.scheduler.getUISettings(e));if(e.aborted)return;if(!t||"error"in t){this.nylasSchedulerError.emit({notification:{...this.getErrorObject(t?.error)},host:this.host});return}else{if("data"in t&&t.data?.appearance){g("Appearance settings have been returned from the configuration used byt his scheduling page; please remember to grab them from the configSettingsLoaded event and apply them as desired.")}const i=this.configSettingsLoaded.emit({settings:t});if("configSettingsLoaded"in this.eventOverrides){await this.eventOverrides.configSettingsLoaded(i,this.nylasSchedulerConnector);if(e.aborted)return;if(i.defaultPrevented){return}}}const i=this.baseProvider?.getStore("scheduler");const n=i?.get("configSettings")?.scheduler?.available_days_in_future;const s=i?.get("selectedTimeslot");if(s&&s?.start_time){if(!this.isTimeslotValid(s)){return}if(i?.get("showBookingForm")){i?.set("selectedDate",s.start_time);return}}const o=d(i?.get("selectedDate"));const a=i?.get("availability");let r;if(a&&a.length>0){return}if(!o){const t=new Date;const{startTime:i,endTime:s,endTimeForAvailableDaysInFuture:o}=this.validateAvailableDaysInFuture(t,n||30);if(t.getTime()<o*1e3){r=await(this.nylasSchedulerConnector?.scheduler.getAvailability(i,s,e))}}else{const{startTime:t,endTime:i,endTimeForAvailableDaysInFuture:s}=this.validateAvailableDaysInFuture(o,n||30);if(o.getTime()<s*1e3){r=await(this.nylasSchedulerConnector?.scheduler.getAvailability(t,i,e))}}if(e.aborted)return;if(!r||"error"in r){this.nylasSchedulerError.emit({notification:{...this.getErrorObject(r?.error)},host:this.host})}if(!o){let e=new Date;const t=i?.get("availability").find((e=>{const t=d(e.start_time);return t?t>new Date:false}));if(t){e=d(t.start_time)||e}i?.set("selectedDate",e)}}catch(e){if(e.name==="AbortError")return;throw e}}hasValidAuthConfig(){return!!(this.sessionId||this.refConfigId||this.slug&&this.clientId)}async performDeferredInit(){if(!this.hasValidAuthConfig()||!this.initDeferred||!this.baseProvider){return}document.body.dispatchEvent(new CustomEvent("nylasSchedulerClearNotifications",{detail:{host:this.host},bubbles:true}));this.initDeferred=false;this.refConfigId=this.refConfigId||this.configurationId;this.baseProvider.eventOverrides=this.eventOverrides;const e=this.baseProvider.getStore("scheduler");this.nylasSchedulerConnector=new L({schedulerAPIURL:this.schedulerApiUrl,sessionId:this.sessionId,configId:this.refConfigId,slug:this.slug,clientId:this.clientId,nylasSchedulerStore:e});const t=this.init.emit(this.host);if("init"in this.eventOverrides){await this.eventOverrides.init(t,this.nylasSchedulerConnector);if(t.defaultPrevented){return}}await this.baseProvider.componentWillLoad(this.nylasSchedulerConnector);this.baseProvider.componentDidLoad();await Promise.resolve();const i=this.schedulerDidLoad.emit(this.host);if("schedulerDidLoad"in this.eventOverrides){await this.eventOverrides.schedulerDidLoad(i,this.nylasSchedulerConnector);if(i.defaultPrevented){return}}await this.performSchedulerDataFetch()}async authPropsChanged(e){if(e&&"bookingRefExtracted"in this.eventOverrides){await this.eventOverrides.bookingRefExtracted(e,this.nylasSchedulerConnector);if(e.defaultPrevented){return}}if(this.initDeferred&&this.hasValidAuthConfig()){this.performDeferredInit()}}configurationIdChanged(){if(!this.rescheduleBookingRef&&!this.cancelBookingRef&&!this.organizerConfirmationBookingRef){this.refConfigId=this.configurationId}this.authPropsChanged()}schedulerApiUrlChanged(){if(this.nylasSchedulerConnector&&this.schedulerApiUrl){this.nylasSchedulerConnector.setSchedulerAPIURL(this.schedulerApiUrl);document.body.dispatchEvent(new CustomEvent("nylasSchedulerClearNotifications",{detail:{host:this.host},bubbles:true}));this.stores?.scheduler.set("availability",[]);this.performSchedulerDataFetch()}}sessionIdChanged(){if(this.nylasSchedulerConnector&&this.sessionId){this.nylasSchedulerConnector.sessionId=this.sessionId;this.nylasSchedulerConnector.scheduler.setSessionId(this.sessionId);document.body.dispatchEvent(new CustomEvent("nylasSchedulerClearNotifications",{detail:{host:this.host},bubbles:true}));this.performSchedulerDataFetch()}this.authPropsChanged()}slugChanged(){this.authPropsChanged()}clientIdChanged(){this.authPropsChanged()}componentDisconnected(){this.baseProvider?.componentDisconnected()}bookingInfoChanged(e){this.stores?.scheduler.set("bookingInfo",e);if(e?.language&&!this.defaultLanguage){this.stores?.scheduler.set("selectedLanguage",r(e.language)||l.en)}}rescheduleBookingRefChanged(e){let t;if(e){try{const[i,n]=u(e);this.stores?.scheduler.set("rescheduleBookingId",n);this.refConfigId=i;this.nylasSchedulerConnector?.scheduler.setConfigId(i);t=this.bookingRefExtracted.emit({configurationId:i,bookingId:n})}catch(t){g(t);this.nylasSchedulerError.emit({notification:{...this.getErrorObject({message:`Invalid booking reference: ${e}`})},host:this.host})}}this.authPropsChanged(t)}cancelBookingRefChanged(e){let t;if(e){try{const[i,n]=u(e);this.stores?.scheduler.set("cancelBookingId",n);this.refConfigId=i;this.nylasSchedulerConnector?.scheduler.setConfigId(i);t=this.bookingRefExtracted.emit({configurationId:i,bookingId:n})}catch(t){g(t);this.nylasSchedulerError.emit({notification:{...this.getErrorObject({message:`Invalid booking reference: ${e}`})},host:this.host})}}this.authPropsChanged(t)}organizerConfirmationBookingRefChanged(e){let t;if(e){try{const[i,n,s]=u(e);this.stores?.scheduler.set("organizerConfirmationBookingId",n);this.stores?.scheduler.set("organizerConfirmationSalt",s);this.refConfigId=i;this.nylasSchedulerConnector?.scheduler.setConfigId(i);t=this.bookingRefExtracted.emit({configurationId:i,bookingId:n,salt:s})}catch(t){g(t);this.nylasSchedulerError.emit({notification:{...this.getErrorObject({message:`Invalid booking reference: ${e}`})},host:this.host})}}this.authPropsChanged(t)}localizationChanged(e){if(!e){return}Object.keys(e).forEach((t=>{if(!(t in l)){return}c.addResourceBundle(t,"translation",e[t],false,true)}))}defaultLanguageChanged(e){if(e){this.stores?.scheduler.set("selectedLanguage",e);c.changeLanguage(e)}}themeConfigChanged(e){this.baseProvider?.getStore("scheduler")?.set("themeConfig",e);this.applyThemeConfig(e)}languageChanged(e){const t=r(e.detail)||l.en;this.language=t;c.changeLanguage(t);this.stores?.scheduler?.set("selectedLanguage",t)}async registerComponentHandler(e){this.baseProvider?.registerComponent(e.detail)}async unregisterComponentHandler(e){this.baseProvider?.unregisterComponent(e.detail)}async monthChangedHandler(e){const t=e.detail;const i=this.nylasSchedulerConnector?.schedulerStore?.get("configSettings")?.scheduler?.available_days_in_future;const{startTime:n,endTime:s,endTimeForAvailableDaysInFuture:o}=this.validateAvailableDaysInFuture(t,i||30);if(e.defaultPrevented){return}if(n<o&&t.getTime()<o*1e3){const e=await(this.nylasSchedulerConnector?.scheduler.getAvailability(n,s));if(!e||"error"in e){this.nylasSchedulerError.emit({notification:{...this.getErrorObject(e?.error)},host:this.host})}const t=this.stores?.scheduler.get("selectableDates");if(t&&t.length>0){this.stores?.scheduler.set("selectedDate",t[0])}}}mapToBookingData(e){const t=this.stores?.scheduler.get("selectedTimeslot");const i=this.stores?.scheduler.get("selectedLanguage");const n=this.stores?.scheduler.get("selectedTimezone");const s=t?.start_time?new Date(t?.start_time).getTime()/1e3:"";const o=t?.end_time?new Date(t?.end_time).getTime()/1e3:"";return{additional_guests:e.guests,guest:{...e.primaryParticipant},additional_fields:{...e.additionalFields},start_time:s,end_time:o,email_language:i,timezone:n}}async bookButtonClickedHandler(e){if(e.defaultPrevented){return}const t=e.detail;const i=this.mapToBookingData(t);this.bookingInfoConfirmed=t;const n=this.nylasSchedulerConnector?.schedulerStore?.get("rescheduleBookingId");const s=n;if(s){const e=await(this.nylasSchedulerConnector?.scheduler.rescheduleBooking(s,t));if(!e||"error"in e){this.nylasSchedulerError.emit({notification:{...this.getErrorObject(e?.error)},host:this.host})}const n=e?.data;const o=this.bookedEventInfo.emit({...e,data:{...n,...i}});this.bookingInfoConfirmed={...this.bookingInfoConfirmed,...n};if("bookedEventInfo"in this.eventOverrides){await this.eventOverrides.bookedEventInfo(o,this.nylasSchedulerConnector)}return}const o=await(this.nylasSchedulerConnector?.scheduler.bookTimeslot(t));if(!o||"error"in o){this.nylasSchedulerError.emit({notification:{...this.getErrorObject(o?.error)},host:this.host})}const a=o?.data;const r=this.bookedEventInfo.emit({...o,data:{...a,...i}});this.bookingInfoConfirmed={...this.bookingInfoConfirmed,...a};if("bookedEventInfo"in this.eventOverrides){await this.eventOverrides.bookedEventInfo(r,this.nylasSchedulerConnector)}}dateSelectedHandler(e){const t=d(e.detail);this.selectedDateLabel=t?this.formatSelectedDateLabel(t):`${c.t("noDateSelected")}`}getSelectedLanguage(){const e=this.stores?.scheduler.get("selectedLanguage")||this.defaultLanguage||f()||l.en;return r(e)||l.en}getSelectedDateLocale(){const e=this.getSelectedLanguage();return p[e]||e||p[l.en]}formatSelectedDateLabel(e){return m(e.toLocaleDateString(this.getSelectedDateLocale(),{dateStyle:"full"}))}cancelBookedEventErrorHandler(e){this.nylasSchedulerError.emit({notification:{...this.getErrorObject(e.detail.error)},host:this.host})}cancelBookedEventValidationErrorHandler(e){this.nylasSchedulerError.emit({notification:{...this.getErrorObject(e.detail.error)},host:this.host})}rescheduleBookedEventErrorHandler(e){this.nylasSchedulerError.emit({notification:{...this.getErrorObject(e.detail.error)},host:this.host})}confirmBookingErrorHandler(e){this.nylasSchedulerError.emit({notification:{...this.getErrorObject(e.detail.error)},host:this.host})}feedbackModalClosedHandler(){this.showFeedbackModal=false}eventIsFullHandler(e){const t=e.detail.error;const i=e.detail.type;if(i==="error"){this.nylasSchedulerError.emit({notification:{...this.getErrorObject({message:t})},host:this.host})}else{this.nylasSchedulerInfo.emit({notification:{title:"Event is full",category:y.Component,type:w.Info,description:"The event you selected is full. Please try a different time.",id:(new Date).getTime().toString(),ttl:3e3},host:this.host})}}feedbackSubmittedHandler(e){C("Scheduling Page User Feedback",{extra:{configId:this.configurationId,slug:this.slug}});const t={message:e.detail.feedback};T(t,{includeReplay:true,captureContext:{tags:{"nylas-web-element":"nylas-scheduling","nylas-web-element-version":this.version,"nylas-config-id":this.configurationId,"nylas-slug":this.slug,"host-url":window.location.href},extra:{configId:this.configurationId,slug:this.slug,version:this.version}}});this.showFeedbackModal=false}async getNylasSchedulerStore(){return this.baseProvider?.getStore("scheduler")}async getNylasSchedulerConnector(){return this.nylasSchedulerConnector}async getRef(){return this.host}getErrorObject(e){return{title:e?.title||$.title,category:e?.category||$.category,type:w.Error,description:e?.message||"",id:(new Date).getTime().toString(),ttl:"none"}}checkIfSessionIdOrConfigIdExists(e=true){if(!this.sessionId&&!this.refConfigId&&!(this.slug&&this.clientId)){if(e){let e="";if(!this.sessionId){e+=c.t("sessionIdRequiredErrorMessage")}if(!this.sessionId&&!this.refConfigId&&!(this.slug&&this.clientId)){e=c.t("sessionIdRequiredErrorMessage")+" "+c.t("publicConfigErrorMessage")}this.nylasSchedulerError.emit({notification:{title:c.t("schedulingComponentErrorTitle"),category:y.Component,type:w.Error,description:e,id:(new Date).getTime().toString(),ttl:"none"},host:this.host})}return false}return true}isTimeslotValid(e){const t=new Date(e.start_time);if(t<new Date){this.nylasSchedulerError.emit({notification:{title:c.t("invalidTimeslotErrorTitle"),category:y.Component,type:w.Error,description:c.t("invalidTimeslotErrorMessage"),id:(new Date).getTime().toString(),ttl:"none"},host:this.host});return false}return true}validateAvailableDaysInFuture(e,t){const i=new Date;const n=new Date(e.getFullYear(),e.getMonth(),1).getTime()/1e3;const s=new Date(e.getFullYear(),e.getMonth()+1,1).getTime()/1e3;const o=Math.floor(h(i,t).getTime()/1e3);const a=Math.min(o,s);const r=n<i.getTime()/1e3?Math.floor(i.getTime()/1e3):n;return{startTime:r,endTime:a,endTimeForAvailableDaysInFuture:o}}applyThemeConfig(e){if(e){for(const[t,i]of Object.entries(e)){this.host.style.setProperty(`${t}`,i)}}}onFeedbackClick(e){e.preventDefault();this.showFeedbackModal=true}redirectToCustomUrl(e){window.location.assign(e)}nylasFormDropdownChangedHandler(e){const{name:t,value:i}=e.detail;if(t==="language"){const e=l[i];c.changeLanguage(e);this.stores?.scheduler?.set("selectedLanguage",e)}}render(){const t=this.mode==="app";const i=this.baseProvider?.getStore("scheduler");const n=i?.get("eventInfo");const o=i?.get("showBookingForm");const a=i?.get("cancelledEventInfo");const r=i?.get("cancelBookingId");const l=i?.get("selectedTimeslot");const h=i?.get("rescheduleBookingId");const g=i?.get("organizerConfirmationBookingId");const f=i?.get("rejectBookingId");const u=i?.get("confirmedEventInfo");const p=i?.get("nylasBranding")||this.nylasBranding;const m=d(i?.get("selectedDate"));const y=i?.get("configSettings")?.scheduler?.confirmation_redirect_url;const _=Object.keys(b).map((e=>({label:b[e],value:e})));const w=this.getSelectedLanguage();const v=m?this.formatSelectedDateLabel(m):`${c.t("noDateSelected")}`;if(t&&(r||f)&&!a){return e(s,null,e(D,{version:this.version,nylasBranding:p,isLoading:this.isLoading,showNotification:this.showNotification},e("div",{class:"cancel-flow-page",part:"cancel-flow-page"},e("nylas-cancel-booking-form",{selectedTimeslot:l,cancelBookingId:r,rejectBookingId:f,exportparts:"ncbf, ncbf__icon, ncbf__title, ncbf__description, ncbf__reason-textarea, ncbf__button-cta, ncbf__button-outline, ncbf__card"}))),e("div",{class:"language-feedback-container"},this.enableUserFeedback&&e("button-component",{id:"report-issue",variant:"basic",onClick:e=>this.onFeedbackClick(e)},e("feedback-icon",null)),e("select-dropdown",{name:"language",searchPlaceholder:c.t("search"),options:_,withChevron:false,themeConfig:this.themeConfig,defaultSelectedOption:_.find((e=>e.value==w)),exportparts:"sd_dropdown: nse__language-dropdown, sd_dropdown-button: nse__language-drop-button, sd_dropdown-content: nse__language-drop-content, sd_dropdown_label: nse__language-drop-label"},e("span",{slot:"select-icon"},e("translate-icon",{width:"20",height:"20"})))),this.showFeedbackModal&&e("nylas-feedback-form",null))}if(t&&g){return e(s,null,e(D,null,e("div",{class:"manual-confirmation-page",part:"manual-confirmation-page"},e("nylas-organizer-confirmation-card",{organizerConfirmationBookingId:g,exportparts:"nmcc, nmcc__title, nmcc__description, nmcc__button-cta, nmcc__button-outline"}))),e("div",{class:"language-feedback-container"},this.enableUserFeedback&&e("button-component",{id:"report-issue",variant:"basic",onClick:e=>this.onFeedbackClick(e)},e("feedback-icon",null)),e("select-dropdown",{name:"language",searchPlaceholder:c.t("search"),options:_,withChevron:false,themeConfig:this.themeConfig,defaultSelectedOption:_.find((e=>e.value==w)),exportparts:"sd_dropdown: nse__language-dropdown, sd_dropdown-button: nse__language-drop-button, sd_dropdown-content: nse__language-drop-content, sd_dropdown_label: nse__language-drop-label"},e("span",{slot:"select-icon"},e("translate-icon",{width:"20",height:"20"})))),this.showFeedbackModal&&e("nylas-feedback-form",null))}if(t&&a){return e(s,null,e(D,{version:this.version,nylasBranding:p,isLoading:this.isLoading,showNotification:this.showNotification},e("div",{class:"cancelled-event-page",part:"cancelled-event-page"},e("nylas-cancelled-event-card",{cancelledEventInfo:a,exportparts:"ncec, ncec__icon, ncec__title, ncec__description, ncec__button-outline, ncec__card"}))),e("div",{class:"language-feedback-container"},this.enableUserFeedback&&e("button-component",{id:"report-issue",variant:"basic",onClick:e=>this.onFeedbackClick(e)},e("feedback-icon",null)),e("select-dropdown",{name:"language",searchPlaceholder:c.t("search"),options:_,withChevron:false,themeConfig:this.themeConfig,defaultSelectedOption:_.find((e=>e.value==w)),exportparts:"sd_dropdown: nse__language-dropdown, sd_dropdown-button: nse__language-drop-button, sd_dropdown-content: nse__language-drop-content, sd_dropdown_label: nse__language-drop-label"},e("span",{slot:"select-icon"},e("translate-icon",{width:"20",height:"20"})))),this.showFeedbackModal&&e("nylas-feedback-form",null))}if(t&&u){return e(s,null,e(D,{version:this.version,nylasBranding:p,isLoading:this.isLoading,showNotification:this.showNotification},e("div",{class:"cancelled-event-page",part:"confirmed-event-page"},e("nylas-confirmed-event-card",{confirmedEventInfo:u,exportparts:"ncec, ncec__icon, ncec__title, ncec__description, ncec__button-outline, ncec__card"}))),e("div",{class:"language-feedback-container"},this.enableUserFeedback&&e("button-component",{id:"report-issue",variant:"basic",onClick:e=>this.onFeedbackClick(e)},e("feedback-icon",null)),e("select-dropdown",{name:"language",searchPlaceholder:c.t("search"),options:_,withChevron:false,themeConfig:this.themeConfig,defaultSelectedOption:_.find((e=>e.value==w)),exportparts:"sd_dropdown: nse__language-dropdown, sd_dropdown-button: nse__language-drop-button, sd_dropdown-content: nse__language-drop-content, sd_dropdown_label: nse__language-drop-label"},e("span",{slot:"select-icon"},e("translate-icon",{width:"20",height:"20"})))),this.showFeedbackModal&&e("nylas-feedback-form",null))}if(t&&n&&y){const e=this.bookingInfoConfirmed?.primaryParticipant;const t=this.bookingInfoConfirmed?.location;const i=this.bookingInfoConfirmed?.booking_ref;const s=this.bookingInfoConfirmed?.additionalFields||{};if(this.bookingInfo&&typeof this.bookingInfo?.additionalFields!=="undefined"){const e=this.bookingInfo.additionalFields;Object.keys(e).forEach((t=>{if(!s[t]&&e?.[t]){s[t]=e[t].value}}))}const o=this.stores?.scheduler.get("selectedTimeslot");const a=this.stores?.scheduler.get("selectedTimezone");const r=this.stores?.scheduler.get("selectedLanguage");const l=this.stores?.scheduler.get("configSettings");const c=this.configurationId?this.configurationId:l?.configuration_id;const d=window.location.search;const h=new URLSearchParams(d);h.set("booking_id",n.booking_id);e?.name&&h.set("name",e.name);e?.email&&h.set("email",e.email);o?.start_time&&h.set("start_time",(new Date(o.start_time).getTime()/1e3).toString());o?.end_time&&h.set("end_time",(new Date(o.end_time).getTime()/1e3).toString());a&&h.set("tz",a);r&&h.set("language",r);s&&h.set("additional_values",JSON.stringify(s));this.slug&&h.set("page_slug",this.slug);c&&h.set("config_id",c);t&&h.set("location",t);i&&h.set("booking_ref",i);const g=new URL(y,window.location.origin);h.forEach(((e,t)=>{g.searchParams.set(t,e)}));this.redirectToCustomUrl(g.toString());return}if(t&&n){return e(s,null,e(D,{version:this.version,nylasBranding:p,isLoading:this.isLoading,showNotification:this.showNotification},e("div",{class:"booked-event-page",part:"booked-event-page ns_booked-event-page"},e("nylas-booked-event-card",{selectedTimeslot:l,eventInfo:n,exportparts:"nbec, nbec__title, nbec__card, nbec__description, nbec__button-outline, nbec__cancel-cta, nbec__reschedule-cta"}))),e("div",{class:"language-feedback-container"},this.enableUserFeedback&&e("button-component",{id:"report-issue",variant:"basic",onClick:e=>this.onFeedbackClick(e)},e("feedback-icon",null)),e("select-dropdown",{name:"language",searchPlaceholder:c.t("search"),options:_,withChevron:false,themeConfig:this.themeConfig,defaultSelectedOption:_.find((e=>e.value==w)),exportparts:"sd_dropdown: nse__language-dropdown, sd_dropdown-button: nse__language-drop-button, sd_dropdown-content: nse__language-drop-content, sd_dropdown_label: nse__language-drop-label"},e("span",{slot:"select-icon"},e("translate-icon",{width:"20",height:"20"})))),this.showFeedbackModal&&e("nylas-feedback-form",null))}if(t&&(!n||!!h)&&!o){const t=this.host.querySelector('[slot="timeslot-picker-cta-label"]');return e(s,null,e(D,{version:this.version,nylasBranding:p,isLoading:this.isLoading,showNotification:this.showNotification},h&&e(z,null,`${c.t("rescheduleTitle")}`),e("div",{class:"select-date-page",part:"select-date-page ns_select-date-page"},e("div",{class:"left-panel",part:"ns_left-panel"},e("nylas-date-picker",{exportparts:"ndp, ndp__title, ndp__month-header, ndp__month-button, ndp__day, ndp__date, ndp__date--disabled, ndp__date--selected, ndp__date--current-day, ndp__date--current-month"}),e("nylas-locale-switch",{exportparts:"nls, nls__timezone, nls__timezone-dropdown, nls__timezone-drop-button, nls__timezone-drop-button-selected-label, nls__timezone-drop-content, nls__timezone-drop-label, nls__language, nls__language-dropdown, nls__language-drop-button, nls__language-drop-content, nls__language-drop-label"})),e("div",{class:`right-panel ${h?"reschedule":""}`,part:`ns_right-panel ${h?"ns_reschedule":""}`},e("h2",{part:"ns_right-panel__title"},e("calendar-icon",{part:"ns_right-panel__calendar-icon"}),e("span",{id:"selectedDate",part:"ns_right-panel__selected-date"},v)),e("nylas-timeslot-picker",{exportparts:"ntp, ntp__time-picker-wrapper, ntp__timeslots, ntp__timeslot, ntp__timeslot--selected, ntp__button-primary"},t&&e("span",{slot:"timeslot-picker-cta-label"},e("slot",{name:"timeslot-picker-cta-label"})))))),this.enableUserFeedback&&e("button-component",{id:"report-issue",variant:"basic",onClick:e=>this.onFeedbackClick(e)},e("feedback-icon",null)),this.showFeedbackModal&&e("nylas-feedback-form",null))}if(t&&!n&&o){return e(s,null,e(D,{version:this.version,nylasBranding:p,isLoading:this.isLoading,showNotification:this.showNotification},h&&e(z,null,`${c.t("rescheduleTitle")}`),e("div",{class:"additional-data-page",part:"additional-data-page ns_additional-data-page"},e("div",{class:"left-panel ns_left-panel",part:"ns_left-panel"},e("div",{class:"wrapper",part:"ns_left-panel__wrapper"},e("nylas-selected-event-card",{exportparts:"nsec, nsec__card, nsec__icon, nsec__date, nsec__time, nsec__timezone"}))),e("div",{class:`right-panel ${h?"reschedule":""}`,part:`ns_right-panel ${h?"ns_reschedule":""}`},e("nylas-booking-form",{exportparts:"nbf, nbf__input-textfield, nbf__button-ghost, nbf__button-outline, nbf__button-primary, nbf__input-wrapper, nbf__checkbox-component, nbf__radio-button-group, nbf__textarea-component, nbf__dropdown, nbf__dropdown-button, nbf__dropdown-content"})))),e("div",{class:"language-feedback-container"},this.enableUserFeedback&&e("button-component",{id:"report-issue",variant:"basic",onClick:e=>this.onFeedbackClick(e)},e("feedback-icon",null)),e("select-dropdown",{name:"language",searchPlaceholder:c.t("search"),options:_,withChevron:false,themeConfig:this.themeConfig,defaultSelectedOption:_.find((e=>e.value==w)),exportparts:"sd_dropdown: nse__language-dropdown, sd_dropdown-button: nse__language-drop-button, sd_dropdown-content: nse__language-drop-content, sd_dropdown_label: nse__language-drop-label"},e("span",{slot:"select-icon"},e("translate-icon",{width:"20",height:"20"})))),this.showFeedbackModal&&e("nylas-feedback-form",null))}return e(s,null,e("slot",null))}get host(){return o(this)}static get watchers(){return{configurationId:["configurationIdChanged"],schedulerApiUrl:["schedulerApiUrlChanged"],sessionId:["sessionIdChanged"],slug:["slugChanged"],clientId:["clientIdChanged"],bookingInfo:["bookingInfoChanged"],rescheduleBookingRef:["rescheduleBookingRefChanged"],cancelBookingRef:["cancelBookingRefChanged"],organizerConfirmationBookingRef:["organizerConfirmationBookingRefChanged"],localization:["localizationChanged"],defaultLanguage:["defaultLanguageChanged"],themeConfig:["themeConfigChanged"]}}};U.style=R;export{U as nylas_scheduling};
2
+ //# sourceMappingURL=p-6aa41c34.entry.js.map
@@ -0,0 +1,2 @@
1
+ import{r as e,h as t,F as n,c as a,H as s,a as o}from"./p-0EQQA0nE.js";import{R as i}from"./p-D8VJgipo.js";import{a as r,i as l,r as c,s as d,v as p,D as b,w as f,C as y,x as h,g as u}from"./p-OpKyWV8q.js";import{E as g,u as m,v as _}from"./p-zgIeli_M.js";import{i as v,a as w,c as k,b as x,f as C}from"./p-B8tfyAQm.js";const E=".sc-google-logo-icon-h{display:flex}";const T=class{constructor(t){e(this,t);this.width="24";this.height="24"}render(){return t("svg",{key:"33a9865778f760760ebf770633523215edf516c3",width:this.width,height:this.height,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},t("g",{key:"7f9bd4b06f1b97de60c01c37c5c509e776b8d6e1","clip-path":"url(#clip0_959_12452)"},t("path",{key:"dbc7d5ff82edffd7b35da27fefe16ae304f42130",d:"M23.745 12.27C23.745 11.48 23.675 10.73 23.555 10H12.255V14.51H18.725C18.435 15.99 17.585 17.24 16.325 18.09V21.09H20.185C22.445 19 23.745 15.92 23.745 12.27Z",fill:"#4285F4"}),t("path",{key:"d1bf2e40b91f0fb9e0f3deb52fe0d33bc595ccd1",d:"M12.255 24C15.495 24 18.205 22.92 20.185 21.09L16.325 18.09C15.245 18.81 13.875 19.25 12.255 19.25C9.12504 19.25 6.47505 17.14 5.52505 14.29H1.54504V17.38C3.51504 21.3 7.56504 24 12.255 24Z",fill:"#34A853"}),t("path",{key:"d87d93140cf0e41444fb1a7d84b6e47fc861765e",d:"M5.52501 14.2901C5.27501 13.5701 5.145 12.8001 5.145 12.0001C5.145 11.2001 5.28501 10.4301 5.52501 9.71012V6.62012H1.545C0.725004 8.24012 0.255005 10.0601 0.255005 12.0001C0.255005 13.9401 0.725004 15.7601 1.545 17.3801L5.52501 14.2901Z",fill:"#FBBC05"}),t("path",{key:"6eb01c2c48e94e3c817afc121931de67bde47f90",d:"M12.255 4.75C14.025 4.75 15.605 5.36 16.855 6.55L20.275 3.13C18.205 1.19 15.495 0 12.255 0C7.56504 0 3.51504 2.7 1.54504 6.62L5.52505 9.71C6.47505 6.86 9.12504 4.75 12.255 4.75Z",fill:"#EA4335"})),t("defs",{key:"d8e80696c6090b414e6a5c42c31f3ec620bd65e0"},t("clipPath",{key:"deb809cb1b5ceda12780385926828c0c60cbe4db",id:"clip0_959_12452"},t("rect",{key:"ad65b33032861fcadb6ae9bd90938647cbc0e3b7",width:24,height:24,fill:"white"}))))}};T.style=E;const S=".sc-microsoft-logo-icon-h{display:flex}";const O=class{constructor(t){e(this,t);this.width="22";this.height="22"}render(){return t("svg",{key:"0452012e39d88b7e92b3607ea38d303844addb7b",width:this.width,height:this.height,viewBox:"0 0 22 22",fill:"none",xmlns:"http://www.w3.org/2000/svg"},t("path",{key:"2de410b921afe31ade8481f5b9c0379b3d7192e2",d:"M0.043457 0.043457H10.4782V10.4782H0.043457V0.043457Z",fill:"#F35325"}),t("path",{key:"9075a7a167fc9ab45e8430ccf7abcc90ea4f5130",d:"M11.5217 0.043457H21.9565V10.4782H11.5217V0.043457Z",fill:"#81BC06"}),t("path",{key:"20a99dda14586e9dccf6992c67ed5f6dd467099b",d:"M0.043457 11.5217H10.4782V21.9565H0.043457V11.5217Z",fill:"#05A6F0"}),t("path",{key:"0a9b9823f799591953e2cd972341b6bfe0a88eea",d:"M11.5217 11.5217H21.9565V21.9565H11.5217V11.5217Z",fill:"#FFBA08"}))}};O.style=S;var H;(function(e){e["EventInfo"]="eventInfo";e["Availability"]="availability";e["BookingOptions"]="bookingOptions";e["Communications"]="communications";e["Participants"]="participants";e["BookingForm"]="bookingForm";e["PageStyles"]="pageStyles"})(H||(H={}));function L({id:e,formState:a,activeTab:s,enableNotetaker:o,themeConfig:i},r){return t(n,null,t("div",{key:`event-info-${e}`,class:{hide:s!==H.EventInfo}},t("nylas-event-info",null,t("div",{slot:"inputs"},t("nylas-event-title",{name:"title",themeConfig:i,exportparts:"net, net__title, net__dropdown-content"}),t("nylas-event-duration",{name:"duration",themeConfig:i,exportparts:"ned, ned__error, ned__dropdown, ned__dropdown-button, ned__dropdown-content, ned__input_dropdown, ned__input_dropdown-input, ned__input_dropdown-content"}),t("nylas-event-location",{name:"location",themeConfig:i,exportparts:"nel, nel__location, nel__dropdown, nel__dropdown-button, nel__dropdown-content"}),t("nylas-event-description",{name:"description",themeConfig:i,exportparts:"nedesc, nedesc__textarea"}))),o&&t("nylas-notetaker-config",{name:"notetaker",conferencing:a.conferencing,themeConfig:i,exportparts:"nntc, nntc__header, nntc__section, nntc__section-title, nntc__content, nntc__input, nntc__textarea, nntc__checkbox"})),t("div",{key:`availability-${e}`,class:{hide:s!==H.Availability}},t("nylas-participant-booking-calendars",{participants:a.participants,name:"participant-booking-calendars",exportparts:"npbc, npbc__header, npbc__content, npbc__participant-container, npbc__participant-title"}),t("nylas-connected-calendars",{participants:a.participants,name:"connected-calendars",exportparts:"nccals, nccals__header, nccals__content, nccals__container, nccals__title, nccals__toggle-container, npbc__participant-toggle-container"}),t("nylas-only-specific-time-availability",{onlySpecificTimeAvailability:a.onlySpecificTimeAvailability,name:"only-specific-time-availability",exportparts:"osta, osta__header, osta__header-content, osta__header-title, osta__header-description, osta__toggle"}),a.onlySpecificTimeAvailability?null:t("nylas-availability-picker",{openHours:a.availability?.openHours,name:"availability",themeConfig:i,exportparts:"nap, nap__header, nap__select-timezone, nap__select-timezone-button, nap__select-timezone-dropdown-content, nap__availability, nap__day, nap__time-ranges, nap__time-range, nap__add-time-range, nap__time-picker-container, nap__time-picker-input, nap__time-picker-times"}),t("nylas-specific-time-availability-picker",{specificTimesAvailability:a.specificTimeAvailability,name:"specific-time-availability",themeConfig:i,exportparts:"nstap, nstap__header, nstap__content, nstap__availability, nstap__day, nstap__time-ranges, nstap__time-range, nstap__add-time-range, nstap__time-picker-container, nstap__time-picker-input, nstap__time-picker-times"})),t("div",{key:`booking-options-${e}`,class:{hide:s!==H.BookingOptions}},t("nylas-scheduling-method",{name:"availability-method",readOnly:true,themeConfig:i,exportparts:"nsm, nsm__header, nsm__input-label, nsm__dropdown, nsm__dropdown-button, nsm__dropdown-content"}),t("nylas-custom-booking-flow",{exportparts:"ncbflow, ncbflow__header, ncbflow__title, ncbflow__content"},t("div",{slot:"inputs"},t("nylas-booking-confirmation-type",{name:"confirmation-type",themeConfig:i,exportparts:"nbct, nbct__header, nbct__dropdown, nbct__dropdown-button, nbct__dropdown-content"}),t("nylas-booking-confirmation-redirect",{name:"confirmation-redirect",redirectUrl:a.redirectUrl,themeConfig:i,exportparts:"nbcr, nbcr__header, nbcr__dropdown, nbcr__dropdown-button, nbcr__dropdown-content, nbcr__input-textfield"}))),t("nylas-buffer-time",{name:"buffer-time",themeConfig:i,exportparts:"nbt, nbt__header, nbt__body, nbt__dropdown-before, nbt__dropdown-button-before, nbt__dropdown-content-before, nbt__dropdown-after, nbt__dropdown-button-after, nbt__dropdown-content-after, nbt__preview"}),t("nylas-event-limits",null,t("div",{slot:"inputs"},t("nylas-min-booking-notice",{name:"min-booking-notice",themeConfig:i,exportparts:"nmbn, nmbn__number-dropdown, nmbn__number-dropdown-button, nmbn__number-dropdown-content, nmbn__period-dropdown, nmbn__period-dropdown-button, nmbn__period-dropdown-content"}),t("nylas-limit-future-bookings",{name:"limit-future-bookings",themeConfig:i,exportparts:"nlfb, nlfb__number-dropdown, nlfb__number-dropdown-button, nlfb__number-dropdown-content, nlfb__period-dropdown, nlfb__period-dropdown-button, nlfb__period-dropdown-content"}),t("nylas-min-cancellation-notice",{name:"min-cancellation-notice",themeConfig:i,exportparts:"nmcn, nmcn__number-dropdown, nmcn__number-dropdown-button, nmcn__number-dropdown-content, nmcn__period-dropdown, nmcn__period-dropdown-button, nmcn__period-dropdown-content"}),t("nylas-cancellation-policy",{name:"cancellation-policy",exportparts:"ncpolicy, ncpolicy__textarea"}))),t("nylas-timeslot-interval",{name:"timeslot-interval",themeConfig:i,exportparts:"nti, nti__header, nti__input-label, nti__dropdown, nti__dropdown-button, nti__dropdown-content"}),t("nylas-customize-booking-settings",{name:"customize-booking-settings",themeConfig:i,exportparts:"ncbs, ncbs__header, ncbs__settings, ncbs__settings-div, ncbs__additional_guests, ncbs__cancellation_options, ncbs__rescheduling_options"})),t("div",{key:`communications-${e}`,class:{hide:s!==H.Communications}},t("nylas-disable-emails",{name:"disable-emails",themeConfig:i,exportparts:"nde, nde__toggle-label, nde_toggle-input, nde_toggle-slider"}),!a?.disableEmails&&t(n,null,t("nylas-confirmation-email",{name:"confirmation-email-template",themeConfig:i,exportparts:"nce, nce__tab-heading, nce__header, nce__body, nce__confirmation-email-toggle--container, nce__summary, nce__reminder-input_dropdown, nce__reminder-input_dropdown-input, nce__reminder-input_dropdown-content"}),t("nylas-reminder-emails",{name:"reminder-overrides",themeConfig:i,exportparts:"nre, nre__tab-heading, nre__header, nre__body, nre__confirmation-email-toggle--container, nre__summary, nrt, nrt__number-dropdown, nrt__number-dropdown-button, nrt__number-dropdown-content, nrt__period-dropdown, nrt__period-dropdown-button, nrt__period-dropdown-content, nrt__time-period-selector"}))),t("div",{key:`participants-${e}`,class:{hide:s!==H.Participants}},t("nylas-additional-participants",{name:"participants",themeConfig:i,exportparts:"nadtnlpart, nadtnlpart__title, nadtnlpart__subtitle, nadtnlpart__content, nadtnlpart__input_group, nadtnlpart__input_wrapper, nadtnlpart__input, nadtnlpart__remove-participant"}),t("nylas-participants-custom-availability",{participants:a.participants,name:"participant-custom-availability",themeConfig:i,exportparts:"npca, npca__header, npca__content, npca__participant-container, npca__participant-title, npca__participant-toggle--container, npca__toggle-label, npca__toggle-input, npca__toggle-slider"})),t("div",{key:`page-styles-${e}`,class:{hide:s!==H.PageStyles}},t("nylas-custom-event-slug",{name:"custom-event-slug",themeConfig:i,exportparts:"nces, nces__body, nces__header, nces__drawer-toggle--container, nces__input-textfield"}),t("nylas-page-name",{name:"page-name",themeConfig:i,exportparts:"npn, npn__body, npn__header, npn__drawer-toggle--container, npn__input-textfield"}),t("nylas-page-styling",{name:"page-styling",themeConfig:i,exportparts:"nps, nps__header, nps__drawer-toggle--container, nps__body, nps__title-input-textfield, nps__company-logo-input-textfield, nps__color-picker, nps__color-picker-button, nps__color-picker-button-label, nps__color-picker-selected-label, nps__submit-button-label-input-textfield, nps__message-textarea"},r)),t("div",{key:`booking-form-${e}`,class:{hide:s!==H.BookingForm}},t("nylas-booking-form-config",{name:"additional-fields",themeConfig:i,exportparts:"nbfc, nbfc__header, nbfc__add_field, nbfc__add_field-button, nbfc__add_field-content, nbfc__static_fields, nbfc__additional_fields, nbfc__form-field, nbfc__form-field-header, nbfc__form-field-content"})))}const z='.sc-nylas-editor-tabs-h{display:block;--nylas-primary:#2563eb;--nylas-error:#cc4841;--nylas-error-50:#ffeae8;--nylas-error-100:#ffc5bf;--nylas-error-200:#fecaca;--nylas-error-pressed:#992222;--nylas-wraning:#f06c00;--nylas-success:#16a392;--nylas-info:#2b8fc2;--nylas-base-0:#ffffff;--nylas-base-25:#fcfcfd;--nylas-base-50:#f8f9fc;--nylas-base-100:#eaecf5;--nylas-base-200:#d5d9eb;--nylas-base-300:#b3b8d8;--nylas-base-400:#717bbc;--nylas-base-500:#4e5ba6;--nylas-base-600:#3e4784;--nylas-base-700:#263f72;--nylas-base-800:#293056;--nylas-base-900:#101323;--nylas-base-950:#0e101b;--nylas-color-blue-100:#e0e6f9;--nylas-border-radius:0.25rem;--nylas-border-radius-2x:0.5rem;--nylas-border-radius-3x:0.75rem;--nylas-font-family:"Inter", sans-serif;--nylas-color-black:#000000;--nylas-color-grey-900:#2c2c2c;--nylas-color-grey-800:#4b4b4b;--nylas-color-grey-700:#6e6e6e;--nylas-color-grey-600:#8e8e8e;--nylas-color-grey-500:#b3b3b3;--nylas-color-grey-400:#cacaca;--nylas-color-grey-300:#e1e1e1;--nylas-color-grey-200:#eaeaea;--nylas-color-grey-100:#f5f5f5;--nylas-color-grey-50:#fbfcfe;--nylas-color-white:#ffffff;--nylas-color-red-900:#992222;--nylas-color-red-700:#cc4841;--nylas-color-red-500:#ff786a;--nylas-color-red-300:#ffa79e;--nylas-color-red-100:#ffc5bf;--nylas-color-red-50:#ffeae8;--nylas-color-blue-900:#213571;--nylas-color-blue-700:#314fa9;--nylas-color-blue-500:#4169e1;--nylas-color-blue-300:#bdccf9;--nylas-color-blue-100:#e0e6f9;--nylas-color-blue-50:#f6f8fd;--nylas-color-yellow-900:#7c6506;--nylas-color-yellow-700:#c29f09;--nylas-color-yellow-500:#f7c90b;--nylas-color-yellow-300:#f9de70;--nylas-color-yellow-100:#fceba9;--nylas-color-yellow-50:#fdf4ce;--nylas-color-green-900:#0e6b60;--nylas-color-green-700:#16a392;--nylas-color-green-500:#17c3b2;--nylas-color-green-300:#74dbd1;--nylas-color-green-100:#a2e7e0;--nylas-color-green-50:#d1f3f0;--nylas-color-purple-900:#643554;--nylas-color-purple-700:#954f7d;--nylas-color-purple-500:#c769a7;--nylas-color-purple-300:#dda5ca;--nylas-color-purple-100:#e0bdd6;--nylas-color-purple-50:#e9dde5;--nylas-color-sky-900:#20698f;--nylas-color-sky-700:#2b8fc2;--nylas-color-sky-500:#6dceff;--nylas-color-sky-300:#8fdaff;--nylas-color-sky-100:#b8e7ff;--nylas-color-sky-50:#d9f2ff}.scheduler-editor.sc-nylas-editor-tabs{display:flex;flex-direction:column;height:inherit}.scheduler-editor.sc-nylas-editor-tabs .form-contents.sc-nylas-editor-tabs{height:calc(100% - 80px);display:grid;grid-template-columns:minmax(224px, 25%) 1fr}@media screen and (max-width: 768px){.scheduler-editor.sc-nylas-editor-tabs .form-contents.sc-nylas-editor-tabs{display:table-column-group;height:auto}}.scheduler-editor.sc-nylas-editor-tabs .form-contents.sc-nylas-editor-tabs .tabs.sc-nylas-editor-tabs{display:flex;flex-direction:column;border-right:1px solid var(--nylas-base-200);background-color:var(--nylas-base-25)}@media screen and (max-width: 768px){.scheduler-editor.sc-nylas-editor-tabs .form-contents.sc-nylas-editor-tabs .tabs.sc-nylas-editor-tabs{border-right:none}}.scheduler-editor.sc-nylas-editor-tabs .form-contents.sc-nylas-editor-tabs .tabs.sc-nylas-editor-tabs .tab.sc-nylas-editor-tabs{display:flex;align-items:center;text-align:left;gap:0.5rem;padding:0.5rem 1rem;color:var(--nylas-base-900);background:var(--nylas-base-0);border:none;height:56px;font-family:var(--nylas-font-family);font-size:16px;font-weight:500;line-height:24px;cursor:pointer}.scheduler-editor.sc-nylas-editor-tabs .form-contents.sc-nylas-editor-tabs .tabs.sc-nylas-editor-tabs .tab.sc-nylas-editor-tabs:not(:first-of-type){margin-top:0.25rem}.scheduler-editor.sc-nylas-editor-tabs .form-contents.sc-nylas-editor-tabs .tabs.sc-nylas-editor-tabs .tab.sc-nylas-editor-tabs:last-of-type{margin-bottom:0.25rem}.scheduler-editor.sc-nylas-editor-tabs .form-contents.sc-nylas-editor-tabs .tabs.sc-nylas-editor-tabs .tab.active.sc-nylas-editor-tabs{font-weight:600;background:var(--nylas-base-0);color:var(--nylas-primary);border-left:4px solid var(--nylas-primary);box-shadow:0px 1px 2px 0px rgba(0, 0, 0, 0.0588235294);box-shadow:0px 1px 3px 0px rgba(0, 0, 0, 0.1019607843)}.scheduler-editor.sc-nylas-editor-tabs .form-contents.sc-nylas-editor-tabs .tabs.sc-nylas-editor-tabs .tab.hide.sc-nylas-editor-tabs{display:none}.scheduler-editor.sc-nylas-editor-tabs .form-contents.sc-nylas-editor-tabs .tab-content.sc-nylas-editor-tabs{max-width:692px;overflow-y:auto;overflow-x:hidden;transition:opacity 0.05s ease-in;opacity:0}.scheduler-editor.sc-nylas-editor-tabs .form-contents.sc-nylas-editor-tabs .tab-content.fadeIn.sc-nylas-editor-tabs{opacity:1}.scheduler-editor.sc-nylas-editor-tabs .form-contents.sc-nylas-editor-tabs .tab-content.sc-nylas-editor-tabs .hide.sc-nylas-editor-tabs{display:none}.scheduler-editor.sc-nylas-editor-tabs .form-contents.sc-nylas-editor-tabs .tab-content.sc-nylas-editor-tabs nylas-event-info.sc-nylas-editor-tabs,.scheduler-editor.sc-nylas-editor-tabs .form-contents.sc-nylas-editor-tabs .tab-content.sc-nylas-editor-tabs nylas-event-limits.sc-nylas-editor-tabs{width:inherit}.scheduler-editor.sc-nylas-editor-tabs .form-contents.sc-nylas-editor-tabs .tab-content.sc-nylas-editor-tabs nylas-event-info.sc-nylas-editor-tabs div[slot=inputs].sc-nylas-editor-tabs,.scheduler-editor.sc-nylas-editor-tabs .form-contents.sc-nylas-editor-tabs .tab-content.sc-nylas-editor-tabs nylas-event-limits.sc-nylas-editor-tabs div[slot=inputs].sc-nylas-editor-tabs{display:flex;flex-direction:column;gap:1rem}.scheduler-editor.sc-nylas-editor-tabs .form-contents.sc-nylas-editor-tabs .tab-content.sc-nylas-editor-tabs .tab-header.sc-nylas-editor-tabs{display:flex;flex-direction:column;margin:1rem 1rem 0.5rem;row-gap:4px}.scheduler-editor.sc-nylas-editor-tabs .form-contents.sc-nylas-editor-tabs .tab-content.sc-nylas-editor-tabs .tab-header.sc-nylas-editor-tabs h3.sc-nylas-editor-tabs{margin:0;font-size:16px;font-weight:600;line-height:20px;color:var(--nylas-base-900);text-align:left}.scheduler-editor.sc-nylas-editor-tabs .form-contents.sc-nylas-editor-tabs .tab-content.sc-nylas-editor-tabs .tab-header.sc-nylas-editor-tabs p.sc-nylas-editor-tabs{margin:0;font-size:0.875rem;font-weight:400;line-height:20px;color:var(--nylas-base-600);text-align:left}.footer.sc-nylas-editor-tabs{display:flex;justify-content:space-between;align-items:center;gap:1rem;min-height:80px;padding:0 1rem;border-top:1px solid var(--nylas-base-200)}@media screen and (max-width: 768px){.footer.sc-nylas-editor-tabs{flex-direction:column;height:auto}}@media screen and (max-width: 768px){.footer.sc-nylas-editor-tabs .preview.sc-nylas-editor-tabs{margin-top:1rem;width:100%}}.footer.sc-nylas-editor-tabs .buttons.sc-nylas-editor-tabs{display:flex;justify-content:flex-end;align-items:center;justify-self:flex-end;gap:1rem}@media screen and (max-width: 768px){.footer.sc-nylas-editor-tabs .buttons.sc-nylas-editor-tabs{flex-direction:column-reverse;width:100%}}.footer.sc-nylas-editor-tabs .buttons.sc-nylas-editor-tabs p.sc-nylas-editor-tabs{max-width:524px}.footer.sc-nylas-editor-tabs .buttons.sc-nylas-editor-tabs p.unsaved-changes.sc-nylas-editor-tabs{color:var(--nylas-base-600)}.footer.sc-nylas-editor-tabs .buttons.sc-nylas-editor-tabs p.saved-changes.sc-nylas-editor-tabs{color:var(--nylas-success)}.footer.sc-nylas-editor-tabs .buttons.sc-nylas-editor-tabs p.error.sc-nylas-editor-tabs{color:var(--nylas-error)}.footer.sc-nylas-editor-tabs .buttons.sc-nylas-editor-tabs p.error-full-width.sc-nylas-editor-tabs{max-width:660px}@media screen and (max-width: 768px){.footer.sc-nylas-editor-tabs .buttons.sc-nylas-editor-tabs button-component.sc-nylas-editor-tabs{width:100%}}.footer.sc-nylas-editor-tabs .buttons.sc-nylas-editor-tabs button.sc-nylas-editor-tabs{background:var(--nylas-primary);color:var(--nylas-base-0);height:48px;border:none;border-radius:var(--nylas-border-radius-2x);font-size:16px;line-height:24px;padding:0 1rem;cursor:pointer;width:148px}.footer.sc-nylas-editor-tabs .buttons.sc-nylas-editor-tabs button.sc-nylas-editor-tabs:hover{background:var(--nylas-base-600)}.footer.sc-nylas-editor-tabs .buttons.sc-nylas-editor-tabs button.sc-nylas-editor-tabs:active{background:var(--nylas-base-800)}.footer.sc-nylas-editor-tabs .buttons.sc-nylas-editor-tabs button.sc-nylas-editor-tabs:disabled{background:var(--nylas-base-300);cursor:not-allowed}.footer.sc-nylas-editor-tabs .buttons.sc-nylas-editor-tabs button.sc-nylas-editor-tabs span.sc-nylas-editor-tabs{display:flex;align-items:center;justify-content:center;gap:0.5rem}.footer.sc-nylas-editor-tabs .buttons.sc-nylas-editor-tabs button-component.save-changes.sc-nylas-editor-tabs{min-width:140px}button-component#report-issue.sc-nylas-editor-tabs{width:auto}nylas-feedback-form.sc-nylas-editor-tabs{position:absolute;top:0;height:100%;width:100%;display:flex;flex-direction:column;justify-content:center;align-items:center;background:rgba(0, 0, 0, 0.6);z-index:2;border-radius:inherit}';var F=undefined&&undefined.__decorate||function(e,t,n,a){var s=arguments.length,o=s<3?t:a===null?a=Object.getOwnPropertyDescriptor(t,n):a,i;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")o=Reflect.decorate(e,t,n,a);else for(var r=e.length-1;r>=0;r--)if(i=e[r])o=(s<3?i(o):s>3?i(t,n,o):i(t,n))||o;return s>3&&o&&Object.defineProperty(t,n,o),o};var N=undefined&&undefined.__metadata||function(e,t){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(e,t)};const j=class{constructor(t){e(this,t);this.schedulerConfigChanged=a(this,"schedulerConfigChanged",7);this.schedulerConfigCreated=a(this,"schedulerConfigCreated",7);this.cancelButtonClick=a(this,"cancelButtonClick",7);this.formSubmitted=a(this,"formSubmitted",7);this.previewButtonClicked=a(this,"previewButtonClicked",7);this.schedulerEditorFormUpdated=a(this,"schedulerEditorFormUpdated",7);this.nylasSchedulerError=a(this,"nylasSchedulerError",6);this.dismissNotification=a(this,"dismissNotification",7);this.schedulerPreviewLink="";this.mode="app";this.hideEditorTabs=[];this.enableUserFeedback=true;this.enableNotetaker=false;this.action="create";this.showFeedbackModal=false;this.activeTab=H.EventInfo;this.isLoading=false;this.hasUnsavedChanges=false;this.changesSaved=false;this.loaded=false;this.formState={};this.error={message:"",type:m.Error,category:g.Component,title:""};this.formSubmissionHandler=async e=>{e.preventDefault();const t=await this.formSubmitted.emit();r("[nylas-editor-tabs]","formSubmissionHandler",t);const n=this.formRef.checkValidity();if(!n||t.defaultPrevented){this.setError({message:this.formRef.validationMessage||l.t("fixFormErrors"),type:m.Error,category:g.Component,title:l.t("nylasEditorTabs.formErrorTitle")});return}this.isLoading=true;this.hasUnsavedChanges=false;const a=this.updateFormState();r("[nylas-editor-tabs]","formState",a);const{title:s,description:o,duration:i,availability:p,specificTimeAvailability:f,onlySpecificTimeAvailability:h,bookingCalendar:u,location:_,bookingType:v,buffer:w,availableDaysInFuture:k,minCancellationNotice:x,minBookingNotice:C,cancellationPolicy:E,timeslotInterval:T,additionalGuestsHidden:S,hideCancellationOptions:O,hideReschedulingOptions:H,participants:L,participantOpenHours:z,participantSpecificTimeAvailability:F,participantOnlySpecificTimeAvailability:N,additionalFields:j,participantCalendars:B,conferencing:P,participantBookingCalendars:I,reminders:R,emailTemplate:G,redirectUrl:$,availabilityMethod:J,slug:M,appearance:U,name:A,disableEmails:D,organizerLocale:V,notetaker:q}=a;const W=this.selectedConfiguration?.participants?.find((e=>e.is_organizer))||L?.find((e=>e.is_organizer));const Z=B&&W?.email?B[W?.email]:[];const Q=W?.booking?.calendar_id||u;const K=i?parseInt(i):30;const X=L&&L?.length>0?L:[{name:W?.name??this.currentUser?.name??"",email:W?.email??this.currentUser?.email??"",is_organizer:true,...W?.grant_id||this.selectedConfiguration?.participants?.find((e=>e.is_organizer))?.grant_id?{grant_id:W?.grant_id||this.selectedConfiguration?.participants?.find((e=>e.is_organizer))?.grant_id}:{},timezone:p?.timezone??Intl.DateTimeFormat().resolvedOptions().timeZone,availability:{calendar_ids:u&&u!==""?[u]:["primary"],open_hours:[]},booking:{calendar_id:u&&u!==""?u:"primary"}}];let Y=J?J:this.selectedConfiguration?.availability?.availability_rules?.availability_method??"collective";if(this.selectedEventType&&this.selectedEventType!==y.group){Y=this.selectedEventType===y.one_on_one?y.collective:this.selectedEventType}const ee={...this.selectedConfiguration?.id&&{id:this.selectedConfiguration.id},version:this.selectedConfiguration?.version??"1.0.0",slug:M,name:A,availability:{duration_minutes:K,interval_minutes:T?.interval??K,round_to:T?.roundTo,availability_rules:{default_specific_time_availability:f??[],only_specific_time_availability:h??false,availability_method:Y,buffer:w||{before:0,after:0},default_open_hours:p?.openHours??this.selectedConfiguration?.availability?.availability_rules?.default_open_hours??b,round_robin_group_id:this.selectedConfiguration?.availability?.availability_rules?.round_robin_group_id??""}},participants:[...X?X.map((e=>{const t=F?.[e.email]??e.specific_time_availability??[];let n=p?.timezone??Intl.DateTimeFormat().resolvedOptions().timeZone;if(z?.[e.email]?.length){n=z?.[e.email]?.[0]?.timezone}else if(t.length>0){const e=t.find((e=>e.timezone))?.timezone;if(e){n=e}}const a=t.map((e=>({...e,timezone:n})));if(e.is_organizer){const t=I?.[e.email]?I?.[e.email]:Q?Q:"primary";const s=B?.[e.email]?B?.[e.email]:Z?.length?Z:["primary"];const o=s.length===1&&s[0]==="primary";const i=e.grant_id||this.selectedConfiguration?.participants?.find((t=>t.email===e.email))?.grant_id;return{name:e.name??"",email:e.email,is_organizer:true,...i?{grant_id:i}:{},timezone:n,availability:{calendar_ids:o?[t]:s,open_hours:z?.[e.email]??e.availability?.open_hours??[]},specific_time_availability:a,only_specific_time_availability:N?.[e.email]??e.only_specific_time_availability??false,booking:{calendar_id:t}}}const s=I?.[e.email]?{calendar_id:I?.[e.email]}:e?.booking??undefined;const o=B?.[e.email]??e.availability?.calendar_ids??["primary"];const i=o.length===1&&o[0]==="primary";const r=e.grant_id||this.selectedConfiguration?.participants?.find((t=>t.email===e.email))?.grant_id;const l=Array.isArray(z?.[e.email])&&z[e.email].length>0;return{...e,...r?{grant_id:r}:{},timezone:n,availability:e.availability||l?{calendar_ids:i&&typeof s!=="undefined"?[s?.calendar_id]:o,open_hours:z?.[e.email]??e.availability?.open_hours??[]}:undefined,booking:s,specific_time_availability:a,only_specific_time_availability:N?.[e.email]??e.only_specific_time_availability??false}})):[]],event_booking:{title:s?.toString()??"",description:o?.toString()??"",location:_?.toString()??"",booking_type:v?.toString()??"booking",timezone:p?.timezone??Intl.DateTimeFormat().resolvedOptions().timeZone,conferencing:P,reminders:R,disable_emails:typeof D==="boolean"?D:false},scheduler:{cancellation_policy:E??"",available_days_in_future:k??30,min_cancellation_notice:x??0,min_booking_notice:C??60,hide_additional_guests:S??false,hide_cancellation_options:O??false,hide_rescheduling_options:H??false,additional_fields:j,email_template:G?{...G,organizer_locale:V||"en",logo:G.logo||""}:undefined,confirmation_redirect_url:$,notetaker_settings:q},appearance:U};const te=c(this.selectedConfiguration,d(ee||{}));const ne=te;if(this.isConfigRoundRobin(ne)){ne.participants=ne.participants.map((e=>({...e,is_organizer:undefined})))}const ae=e=>{this.isLoading=false;this.changesSaved=true;setTimeout((()=>{this.changesSaved=false}),5e3)};const se=this.checkForBookingFormErrors(ne);const oe=this.configurations?.find((e=>e.id===this.selectedConfiguration?.id))||{};const ie=this.checkForOrganizerConfirmationError(c(ne,oe));if(se||ie){return}this.schedulerConfigChanged.emit({config:ne,resetLoadingState:ae,action:this.action,host:this.host})};this.isConfigRoundRobin=e=>e?.availability?.availability_rules?.availability_method==="max-availability"||e.availability?.availability_rules?.availability_method==="max-fairness";this.checkForOrganizerConfirmationError=e=>{let t=false;let n="";const a=e.event_booking?.booking_type==="organizer-confirmation";const s=e.scheduler?.organizer_confirmation_url;if(a&&!s){n+="Organizer confirmation URL is required when using organizer confirmation booking type.";t=true}if(t){this.isLoading=false;this.host.setError({message:n,type:m.Error,category:g.Component,title:"Error:"})}return t};this.checkForBookingFormErrors=e=>{let t=false;let n="";const a=e.scheduler?.additional_fields;if(a){n="";Object.entries(a).forEach((e=>{const a=e[1];if(a.label===""){n+=l.t("nylasEditorTabs.bookingFormError_label",{type:a.type});t=true;return}if(a.options){for(const e of a.options){if(e.trim()===""){n+=l.t("nylasEditorTabs.bookingFormError_option",{label:a.label,type:a.type});t=true;break}}}}))}if(t){this.isLoading=false;this.host.setError({message:n,type:m.Error,category:g.Component,title:l.t("nylasEditorTabs.bookingFormError")})}return t}}configChangedHandler(e){r("[nylas-editor-tabs]","configChangedHandler",e,this.selectedConfiguration);this.formState={...this.getFormStateFromConfig(e)};if(e?.id){this.action="edit"}else{this.action="create"}}userChangedHandler(e){r("[nylas-editor-tabs]","userChangedHandler",e);if(e){this.formState={...this.getFormStateFromConfig(this.selectedConfiguration)}}}selectedLanguageChangedHandler(e,t){if(e===t)return;l.changeLanguage(e);if(this.error&&this.error.message){this.error={...this.error,message:l.t("fixFormErrors")};this.showErrorNotification(this.error)}}themeConfigChangedHandler(e,t){if(e===t)return;this.applyThemeConfig(e)}applyThemeConfig(e){if(e){for(const[t,n]of Object.entries(e)){this.host.style.setProperty(`${t}`,n)}}}async schedulerConfigCreatedEventHandler(e){const t=this.schedulerConfigCreated.emit(e);return t}async setError(e){this.error={message:e.message,type:e.type,category:e.category,title:e.title||l.t("genericErrorTitle")};if(this.error?.message){this.showErrorNotification(this.error)}}async resetError(){if(this.error?.message){this.dismissNotification.emit({id:this.error?.message.split(" ").join("-"),host:this.host})}this.error={message:"",type:m.Error,category:g.Component,title:""}}connectedCallback(){r("[nylas-editor-tabs]","connectedCallback");queueMicrotask((()=>{if(this.themeConfig){this.applyThemeConfig(this.themeConfig);this.host.setAttribute("data-themed","")}}))}componentWillLoad(){r("[nylas-editor-tabs]","componentWillLoad");this.formState=this.getFormStateFromConfig(this.selectedConfiguration)}componentDidLoad(){r("[nylas-editor-tabs]","componentDidLoad");if(this.enableUserFeedback&&!v()){w({dsn:"https://9d5731f1c77ca84c9ed3fb9b3ccf7ee1@o74852.ingest.us.sentry.io/4507889638178816",release:_,integrations:e=>[...e.filter((e=>false)),C({colorScheme:"system",autoInject:false})],autoSessionTracking:false,beforeSend:()=>null})}if(this.selectedConfiguration?.id){this.configChangedHandler(this.selectedConfiguration)}const e=this.host.querySelector("button.tab:not(.hide)")?.name;if(e){this.activeTab=e}this.loaded=true}disconnectedCallback(){r("[nylas-editor-tabs]","disconnectedCallback")}handleValueChanged(e){r("[nylas-editor-tabs]","handleValueChanged",e);const{name:t,value:n}=e.detail;r("name",t,"value",n);this.setFormState(n,t);this.formState={...this.formState};this.resetError();if(p.includes(t)){this.hasUnsavedChanges=true}this.schedulerEditorFormUpdated.emit({value:e.detail.value,name:e.detail.name})}feedbackModalClosedHandler(){this.showFeedbackModal=false}feedbackSubmittedHandler(e){k("Scheduler Editor User Feedback",{extra:{configId:this.selectedConfiguration?.id,slug:this.selectedConfiguration?.slug}});const t={message:e.detail.feedback};x(t,{includeReplay:true,captureContext:{tags:{"nylas-web-element":"nylas-scheduler-editor","nylas-web-element-version":_,"nylas-config-id":this.selectedConfiguration?.id,"nylas-slug":this.selectedConfiguration?.slug,"host-url":window.location.href},extra:{configId:this.selectedConfiguration?.id,slug:this.selectedConfiguration?.slug}}});this.showFeedbackModal=false}showErrorNotification(e){if(e.message){this.nylasSchedulerError.emit({notification:{title:e.title,category:e.category||g.Component,type:e.type||m.Error,description:e.message,id:e.message.split(" ").join("-"),ttl:"none"},host:this.host})}}getFormStateFromConfig(e){let t=e?.participants?.find((e=>e.is_organizer));if(!t&&e?.availability?.availability_rules?.availability_method!=="collective"){const n=e?.participants?.find((e=>e.email===this.currentUser?.email));if(n){t={...n,is_organizer:true}}}if(e?.appearance){r("[nylas-editor-tabs]","getFormStateFromConfig","Appearance settings have been returned from the given configuration; please remember to grab them from the configSettingsLoaded event and apply them as desired.")}return{title:e?.event_booking?.title??"",description:e?.event_booking?.description??"",duration:e?.availability?.duration_minutes?.toString()??"30",availability:{timezone:e?.event_booking?.timezone??Intl.DateTimeFormat().resolvedOptions().timeZone,openHours:e?.availability?.availability_rules?.default_open_hours??b},specificTimeAvailability:e?.availability?.availability_rules?.default_specific_time_availability??[],onlySpecificTimeAvailability:e?.availability?.availability_rules?.only_specific_time_availability??false,additionalFields:e?.scheduler?.additional_fields??{},conferencing:e?.event_booking?.conferencing??{},calendarIds:t?.availability?.calendar_ids??[],participants:t?(e?.participants??[]).map((e=>e.email===t.email?{...e,is_organizer:true}:e)):e?.participants??[],bookingCalendar:t?.booking?.calendar_id??t?.email??"",location:e?.event_booking?.location??"",bookingType:e?.event_booking?.booking_type??"booking",buffer:e?.availability?.availability_rules?.buffer??{before:0,after:0},cancellationPolicy:e?.scheduler?.cancellation_policy??"",availableDaysInFuture:e?.scheduler?.available_days_in_future??30,minCancellationNotice:e?.scheduler?.min_cancellation_notice??0,minBookingNotice:e?.scheduler?.min_booking_notice??60,timeslotInterval:{interval:e?.availability?.interval_minutes??e?.availability?.duration_minutes,roundTo:e?.availability?.round_to},additionalGuestsHidden:e?.scheduler?.hide_additional_guests??false,hideCancellationOptions:e?.scheduler?.hide_cancellation_options??false,hideReschedulingOptions:e?.scheduler?.hide_rescheduling_options??false,participantBookingCalendars:(e?.participants??[]).reduce(((e,t)=>{if(t.booking?.calendar_id){e[t.email]=t.booking.calendar_id}return e}),{}),participantCalendars:e?.participants?.reduce(((e,t)=>{e[t.email]=t.availability?.calendar_ids;return e}),{})??{},reminders:e?.event_booking?.reminders,emailTemplate:e?.scheduler?.email_template,redirectUrl:e?.scheduler?.confirmation_redirect_url,slug:e?.slug,appearance:e?.appearance,name:e?.name,disableEmails:e?.event_booking?.disable_emails,organizerLocale:e?.scheduler?.email_template?.organizer_locale,notetaker:e?.scheduler?.notetaker_settings?e.event_booking?.conferencing?.provider?e.scheduler.notetaker_settings:{...e.scheduler.notetaker_settings,enabled:false}:undefined}}setFormState(e,t){switch(t){case"title":this.formState.title=e.toString();break;case"description":this.formState.description=e.toString();break;case"duration":this.formState.duration=e.toString();break;case"availability":this.formState.availability=JSON.parse(e.toString());break;case"specific-time-availability":this.formState.specificTimeAvailability=JSON.parse(e.toString());break;case"only-specific-time-availability":{const{enableSpecificTimeAvailability:t}=JSON.parse(e.toString());this.formState.onlySpecificTimeAvailability=t;break}case"participants":this.formState.participants=JSON.parse(e.toString());break;case"booking-calendar":this.formState.bookingCalendar=e.toString();break;case"participant-booking-calendars":this.formState.participantBookingCalendars=JSON.parse(e.toString());break;case"location":this.formState.location=e.toString();break;case"conference":{const t=JSON.parse(e.toString());this.formState.conferencing=t;if(!t||!t.provider){const e=this.formState.notetaker?{...this.formState.notetaker,enabled:false}:{enabled:false};this.formState.notetaker=e;this.formState={...this.formState};this.schedulerEditorFormUpdated.emit({value:JSON.stringify(e),name:"notetaker"})}break}case"confirmation-type":this.formState.bookingType=e.toString();break;case"buffer-time":this.formState.buffer=JSON.parse(e.toString());break;case"limit-future-bookings":this.formState.availableDaysInFuture=parseInt(e.toString());break;case"min-cancellation-notice":this.formState.minCancellationNotice=parseInt(e.toString());break;case"min-booking-notice":this.formState.minBookingNotice=parseInt(e.toString());break;case"cancellation-policy":this.formState.cancellationPolicy=e.toString();break;case"timeslot-interval":this.formState.timeslotInterval=JSON.parse(e.toString());break;case"customize-booking-settings":{const t=JSON.parse(e.toString());this.formState.additionalGuestsHidden=t.additionalGuestsHidden;this.formState.hideCancellationOptions=t.hideCancellationOptions;this.formState.hideReschedulingOptions=t.hideReschedulingOptions;break}case"participant-custom-availability":{const t=JSON.parse(e.toString());this.formState.participantOpenHours=t;break}case"participant-custom-availability-specific-time":{const t=JSON.parse(e.toString());this.formState.participantSpecificTimeAvailability=t;break}case"participant-custom-availability-only-specific-time":{const t=JSON.parse(e.toString());this.formState.participantOnlySpecificTimeAvailability=t;break}case"additional-fields":this.formState.additionalFields=JSON.parse(e.toString());break;case"connected-calendars":this.formState.participantCalendars=JSON.parse(e.toString());break;case"confirmation-email-template":this.formState.emailTemplate=JSON.parse(e.toString());break;case"disable-emails":{const{disableEmails:t,organizerLocale:n}=JSON.parse(e.toString());this.formState.disableEmails=t;this.formState.organizerLocale=n;break}case"reminder-overrides":this.formState.reminders=JSON.parse(e.toString());break;case"confirmation-redirect":this.formState.redirectUrl=e.toString();break;case"availability-method":this.formState.availabilityMethod=e.toString();break;case"custom-event-slug":this.formState.slug=JSON.parse(e.toString());break;case"page-styling":this.formState.appearance=JSON.parse(e.toString());break;case"page-name":this.formState.name=JSON.parse(e.toString());break;case"notetaker":{const t=e.toString();if(t==="null"||t===""){this.formState.notetaker=undefined}else{this.formState.notetaker=JSON.parse(t)}break}}this.schedulerEditorFormUpdated.emit({value:e,name:t})}updateFormState(){const e=new FormData(this.formRef);e.forEach(((e,t)=>{this.setFormState(e,t)}));this.formState={...this.formState};return this.formState}setActiveTab(e,t){e.preventDefault();this.updateFormState();this.activeTab=t}hideTab(e){return this.hideEditorTabs?.includes(e)||false}onFeedbackClick(e){e.preventDefault();this.showFeedbackModal=true}render(){r("[nylas-editor-tabs]","render",this.formState);return t(s,{key:"bf708d7ec542c822eb749ffd4e8045ae9ae4d58e"},t("nylas-notification",{key:"da0ef8835e5a7c3c7a1e3eae096eea2ef7cdc744"}),t("form",{key:"7154f6f9f0e9bb735f1217864a985dc440347893",onSubmit:this.formSubmissionHandler,class:"scheduler-editor",ref:e=>this.formRef=e,noValidate:true},this.mode==="app"?t("div",{class:"form-contents",part:"editor__form-contents net__form-contents"},t("div",{class:"tabs",part:"editor__tabs net__tabs"},t("button",{name:H.EventInfo,class:{tab:true,active:this.activeTab==H.EventInfo,hide:this.hideTab(H.EventInfo)},part:"editortab__event-info net__tab-event-info",onClick:e=>this.setActiveTab(e,H.EventInfo)},t("calendar-info-icon",{width:"16",height:"16"}),l.t("eventInfoTab")),t("button",{name:H.Availability,class:{tab:true,active:this.activeTab==H.Availability,hide:this.hideTab(H.Availability)},part:"editortab__availability net__tab-availability",onClick:e=>this.setActiveTab(e,H.Availability)},t("calendar-patterns-icon",{width:"16",height:"16"}),l.t("availabilityTab")),t("button",{name:H.Participants,class:{tab:true,active:this.activeTab==H.Participants,hide:this.hideTab(H.Participants)},part:"editortab__participants net__tab-participants",onClick:e=>this.setActiveTab(e,H.Participants)},t("people-icon",{width:"16",height:"16"}),l.t("participantsTab")),t("button",{name:H.BookingOptions,class:{tab:true,active:this.activeTab==H.BookingOptions,hide:this.hideTab(H.BookingOptions)},part:"editortab__booking-options net__tab-booking-options",onClick:e=>this.setActiveTab(e,H.BookingOptions)},t("flow-icon",{width:"16",height:"16"}),l.t("bookingOptionsTab")),t("button",{name:H.BookingForm,class:{tab:true,active:this.activeTab=="bookingForm",hide:this.hideTab(H.BookingForm)},part:"editortab__booking-form net__tab-booking-form",onClick:e=>this.setActiveTab(e,H.BookingForm)},this.activeTab==H.BookingForm?t("calendar-agenda-fill-icon",{width:"16",height:"16"}):t("calendar-agenda-icon",{width:"16",height:"16"}),l.t("bookingFormTab")),t("button",{name:H.Communications,class:{tab:true,active:this.activeTab=="communications",hide:this.hideTab(H.Communications)},onClick:e=>this.setActiveTab(e,H.Communications),part:"editortab__communications net__tab-communications"},this.activeTab==H.Communications?t("envelope-fill-icon",{width:"16",height:"16"}):t("envelope-icon",{width:"16",height:"16"}),l.t("communicationsTab")),t("button",{name:H.PageStyles,class:{tab:true,active:this.activeTab=="pageStyles",hide:this.hideTab(H.PageStyles)},onClick:e=>this.setActiveTab(e,H.PageStyles),part:"editortab__page-styles net__tab-page-styles"},this.activeTab==H.PageStyles?t("paintbrush-fill-icon",{width:"16",height:"16"}):t("paintbrush-icon",{width:"16",height:"16"}),l.t("pageStylesTab"))),t("div",{class:{"tab-content":true,fadeIn:this.loaded},part:"editor__tab-content net__tab-content"},t(L,{formState:this.formState,activeTab:this.activeTab,currentUser:this.currentUser,calendars:this.calendars,id:this.selectedConfiguration?.id??"new",i18next:l,enableNotetaker:this.enableNotetaker,themeConfig:this.themeConfig}))):t("div",{class:"composable",key:this.selectedConfiguration?.id},t("slot",null)),t("div",{key:"9f8518398d98a211078b50c88f1c81315ed30328",class:"footer",part:"editor__footer net__footer"},t("div",{key:"cbf1648c8c98b4e48e43d21ba7d9031a329a4e10",class:"preview",part:"editor__footer-preview net__footer-preview"},this.enableUserFeedback&&t("button-component",{key:"a4f2c13221dade5425f1b59aa5274350a809ffc3",title:"Share your feedback",id:"report-issue",variant:"basic",onClick:e=>this.onFeedbackClick(e)},t("feedback-icon",{key:"f2f1fe27e3de4f09fe7eb00eede7f9abc90102c3"}))),t("div",{key:"a740aaeccc0f929cfa67ef8c0c703513ec9138ec",class:"buttons",part:"editor__footer-buttons net__footer-buttons"},t("p",{key:"ded5a9bed46eb1063e0062080fbc2f1eb91510fa",class:{"unsaved-changes":this.hasUnsavedChanges&&!this.changesSaved,"saved-changes":this.changesSaved,error:this.error?.message!=="","error-full-width":this.error?.message!==""&&this.action==="create"}},this.error?.message==""&&this.hasUnsavedChanges&&!this.changesSaved?l.t("unsavedChangesLabel"):this.error?.message==""&&this.changesSaved?`${l.t("changesSavedLabel")}!`:""),this.schedulerPreviewLink!==""&&this.action==="edit"&&t("button-component",{key:"335dcff1c0fa0e2049cf21f36e33427a9f30a8c1",title:"Preview",type:"button",disabled:this.isLoading,clickHandler:e=>{e.preventDefault();const t=this.previewButtonClicked.emit(this.host);if(!t.defaultPrevented){window.open(f(this.schedulerPreviewLink,this.selectedConfiguration),"_blank")}},variant:"basic"},t("eye-icon",{key:"2f8ef52ca16d73c357feb572c35d4f56f056a4d1"})),t("button-component",{key:"f56f62a0b795d5949cef307518b12ca9c7431cb5",type:"button",disabled:this.isLoading,clickHandler:e=>{e.preventDefault();this.cancelButtonClick.emit();this.host.resetError()},variant:"basic",part:"editor__footer-cancel net__footer-cancel"},l.t("cancelButton")),t("button-component",{key:"c04d198a70b9214461d92c380089048febe6113a",class:{"save-changes":this.action==="edit"},type:"submit",disabled:this.isLoading,part:"editor__footer-cta, net__footer-cta"},this.isLoading?t("span",null,l.t("savingButtonText"),t("loading-icon",null)," "):this.action==="create"?`${l.t("createButtonText")}`:`${l.t("saveChangesButtonText")}`)))),this.showFeedbackModal&&t("nylas-feedback-form",{key:"5c62eea9a45a9060762b43c7a328488653590979"}))}get host(){return o(this)}static get watchers(){return{selectedConfiguration:["configChangedHandler"],currentUser:["userChangedHandler"],selectedLanguage:["selectedLanguageChangedHandler"],themeConfig:["themeConfigChangedHandler"]}}};F([i({name:"nylas-editor-tabs",stateToProps:new Map([["schedulerConfig.calendars","calendars"],["schedulerConfig.selectedConfiguration","selectedConfiguration"],["schedulerConfig.currentUser","currentUser"],["schedulerConfig.configurations","configurations"],["schedulerConfig.selectedLanguage","selectedLanguage"],["schedulerConfig.selectedEventType","selectedEventType"],["schedulerConfig.themeConfig","themeConfig"]]),eventToProps:{schedulerConfigChanged:async(e,t)=>{const{resetLoadingState:n,host:a,action:s,config:o}=e.detail;const i=(o,i)=>{const[r,c]=o;if(!r&&c){a.setError({message:c.message||l.t("genericErrorTitle"),type:m.Error,category:g.Component,title:i})}else if(r&&!c&&s==="create"){a.schedulerConfigCreatedEventHandler({config:r,action:s,host:a});t.schedulerConfigStore.set("selectedEventType",undefined)}if(n){n(e)}};if(s==="edit"){const e=await t.schedulerConfig.updateConfiguration(o);i(e,l.t("nylasEditorTabs.updateConfigError"))}else{const e=await t.schedulerConfig.createConfiguration(o);i(e,l.t("nylasEditorTabs.createConfigError"))}},cancelButtonClick:async(e,t)=>{t.schedulerConfigStore.state.action=null;t.schedulerConfigStore.set("selectedEventType",undefined)},previewButtonClicked:async(e,t)=>{r("[nylas-editor-tabs]","previewButtonClicked",t)},formSubmitted:async(e,t)=>{r("[nylas-editor-tabs]","formSubmitted",t)},schedulerEditorFormUpdated:async(e,t)=>{r("[nylas-editor-tabs]","schedulerEditorFormUpdated",e)},schedulerConfigCreated:async(e,t)=>{r("[nylas-editor-tabs]","schedulerConfigCreated",e)}},localPropsToProp:new Map([["schedulerPreviewLink","schedulerPreviewLink"],["enableUserFeedback","enableUserFeedback"],["hideEditorTabs","hideEditorTabs"],["enableNotetaker","enableNotetaker"]]),fireRegisterEvent:true}),N("design:type",Function),N("design:paramtypes",[]),N("design:returntype",void 0)],j.prototype,"render",null);j.style=z;var B;(function(e){e["BookingOptions"]="bookingOptions";e["Communications"]="communications";e["BookingForm"]="bookingForm";e["PageStyles"]="pageStyles";e["CalendarView"]="calendarView"})(B||(B={}));function P({id:e,formState:a,activeTab:s},o){return t(n,null,s===B.CalendarView&&t("div",{key:`calendar-view-${e}`,class:{hide:s!==B.CalendarView,"calendar-view":true}},t("nylas-event-calendar",null)),t("div",{key:`booking-options-${e}`,class:{hide:s!==B.BookingOptions}},t("nylas-scheduling-method",{name:"availability-method",readOnly:true,exportparts:"nsm, nsm__header, nsm__input-label, nsm__dropdown, nsm__dropdown-button, nsm__dropdown-content"}),t("nylas-custom-booking-flow",{exportparts:"ncbflow, ncbflow__header, ncbflow__title, ncbflow__content"},t("div",{slot:"inputs"},t("nylas-booking-confirmation-type",{name:"confirmation-type",showComponent:false,exportparts:"nbct, nbct__header, nbct__dropdown, nbct__dropdown-button, nbct__dropdown-content"}),t("nylas-booking-confirmation-redirect",{name:"confirmation-redirect",redirectUrl:a.redirectUrl,exportparts:"nbcr, nbcr__header, nbcr__dropdown, nbcr__dropdown-button, nbcr__dropdown-content, nbcr__input-textfield"}))),t("nylas-event-limits",null,t("div",{slot:"inputs"},t("nylas-min-booking-notice",{name:"min-booking-notice",exportparts:"nmbn, nmbn__number-dropdown, nmbn__number-dropdown-button, nmbn__number-dropdown-content, nmbn__period-dropdown, nmbn__period-dropdown-button, nmbn__period-dropdown-content"}),t("nylas-min-cancellation-notice",{name:"min-cancellation-notice",exportparts:"nmcn, nmcn__number-dropdown, nmcn__number-dropdown-button, nmcn__number-dropdown-content, nmcn__period-dropdown, nmcn__period-dropdown-button, nmcn__period-dropdown-content"}),t("nylas-cancellation-policy",{name:"cancellation-policy",exportparts:"ncpolicy, ncpolicy__textarea"}))),t("nylas-customize-booking-settings",{showSettings:["hideCancellationOptions","hideReschedulingOptions"],name:"customize-booking-settings",exportparts:"ncbs, ncbs__header, ncbs__settings, ncbs__settings-div, ncbs__additional_guests, ncbs__cancellation_options, ncbs__rescheduling_options"})),t("div",{key:`communications-${e}`,class:{hide:s!==B.Communications}},t("nylas-disable-emails",{name:"disable-emails",exportparts:"nde, nde__toggle-label, nde_toggle-input, nde_toggle-slider"}),!a?.disableEmails&&t(n,null,t("nylas-confirmation-email",{name:"confirmation-email-template",exportparts:"nce, nce__tab-heading, nce__header, nce__body, nce__confirmation-email-toggle--container, nce__summary, nce__reminder-input_dropdown, nce__reminder-input_dropdown-input, nce__reminder-input_dropdown-content"}),t("nylas-reminder-emails",{name:"reminder-overrides",exportparts:"nre, nre__tab-heading, nre__header, nre__body, nre__confirmation-email-toggle--container, nre__summary, nrt, nrt__number-dropdown, nrt__number-dropdown-button, nrt__number-dropdown-content, nrt__period-dropdown, nrt__period-dropdown-button, nrt__period-dropdown-content, nrt__time-period-selector"}))),t("div",{key:`page-styles-${e}`,class:{hide:s!==B.PageStyles}},t("nylas-custom-event-slug",{name:"custom-event-slug",exportparts:"nces, nces__body, nces__header, nces__drawer-toggle--container, nces__input-textfield"}),t("nylas-page-name",{name:"page-name",requirePageName:true,exportparts:"npn, npn__body, npn__header, npn__drawer-toggle--container, npn__input-textfield"}),t("nylas-page-styling",{name:"page-styling",exportparts:"nps, nps__header, nps__drawer-toggle--container, nps__body, nps__title-input-textfield, nps__company-logo-input-textfield, nps__color-picker, nps__color-picker-button, nps__color-picker-button-label, nps__color-picker-selected-label, nps__submit-button-label-input-textfield, nps__message-textarea"},o)),t("div",{key:`booking-form-${e}`,class:{hide:s!==B.BookingForm}},t("nylas-booking-form-config",{name:"additional-fields",exportparts:"nbfc, nbfc__header, nbfc__add_field, nbfc__add_field-button, nbfc__add_field-content, nbfc__static_fields, nbfc__additional_fields, nbfc__form-field, nbfc__form-field-header, nbfc__form-field-content"})))}const I='.sc-nylas-editor-tabs-group-h{display:block;--nylas-primary:#2563eb;--nylas-error:#cc4841;--nylas-error-50:#ffeae8;--nylas-error-100:#ffc5bf;--nylas-error-200:#fecaca;--nylas-error-pressed:#992222;--nylas-wraning:#f06c00;--nylas-success:#16a392;--nylas-info:#2b8fc2;--nylas-base-0:#ffffff;--nylas-base-25:#fcfcfd;--nylas-base-50:#f8f9fc;--nylas-base-100:#eaecf5;--nylas-base-200:#d5d9eb;--nylas-base-300:#b3b8d8;--nylas-base-400:#717bbc;--nylas-base-500:#4e5ba6;--nylas-base-600:#3e4784;--nylas-base-700:#263f72;--nylas-base-800:#293056;--nylas-base-900:#101323;--nylas-base-950:#0e101b;--nylas-color-blue-100:#e0e6f9;--nylas-border-radius:0.25rem;--nylas-border-radius-2x:0.5rem;--nylas-border-radius-3x:0.75rem;--nylas-font-family:"Inter", sans-serif;--nylas-color-black:#000000;--nylas-color-grey-900:#2c2c2c;--nylas-color-grey-800:#4b4b4b;--nylas-color-grey-700:#6e6e6e;--nylas-color-grey-600:#8e8e8e;--nylas-color-grey-500:#b3b3b3;--nylas-color-grey-400:#cacaca;--nylas-color-grey-300:#e1e1e1;--nylas-color-grey-200:#eaeaea;--nylas-color-grey-100:#f5f5f5;--nylas-color-grey-50:#fbfcfe;--nylas-color-white:#ffffff;--nylas-color-red-900:#992222;--nylas-color-red-700:#cc4841;--nylas-color-red-500:#ff786a;--nylas-color-red-300:#ffa79e;--nylas-color-red-100:#ffc5bf;--nylas-color-red-50:#ffeae8;--nylas-color-blue-900:#213571;--nylas-color-blue-700:#314fa9;--nylas-color-blue-500:#4169e1;--nylas-color-blue-300:#bdccf9;--nylas-color-blue-100:#e0e6f9;--nylas-color-blue-50:#f6f8fd;--nylas-color-yellow-900:#7c6506;--nylas-color-yellow-700:#c29f09;--nylas-color-yellow-500:#f7c90b;--nylas-color-yellow-300:#f9de70;--nylas-color-yellow-100:#fceba9;--nylas-color-yellow-50:#fdf4ce;--nylas-color-green-900:#0e6b60;--nylas-color-green-700:#16a392;--nylas-color-green-500:#17c3b2;--nylas-color-green-300:#74dbd1;--nylas-color-green-100:#a2e7e0;--nylas-color-green-50:#d1f3f0;--nylas-color-purple-900:#643554;--nylas-color-purple-700:#954f7d;--nylas-color-purple-500:#c769a7;--nylas-color-purple-300:#dda5ca;--nylas-color-purple-100:#e0bdd6;--nylas-color-purple-50:#e9dde5;--nylas-color-sky-900:#20698f;--nylas-color-sky-700:#2b8fc2;--nylas-color-sky-500:#6dceff;--nylas-color-sky-300:#8fdaff;--nylas-color-sky-100:#b8e7ff;--nylas-color-sky-50:#d9f2ff}.scheduler-editor.sc-nylas-editor-tabs-group{display:flex;flex-direction:column;height:inherit;position:relative}.scheduler-editor.sc-nylas-editor-tabs-group div.return-to-calendar-view.sc-nylas-editor-tabs-group{display:flex;border-bottom:1px solid var(--nylas-base-200)}.scheduler-editor.sc-nylas-editor-tabs-group .form-contents.sc-nylas-editor-tabs-group{display:grid;grid-template-columns:minmax(224px, 25%) 1fr;height:auto;overflow-y:auto;min-height:calc(100% - 80px - 48px)}@media screen and (max-width: 768px){.scheduler-editor.sc-nylas-editor-tabs-group .form-contents.sc-nylas-editor-tabs-group{display:table-column-group;height:auto;min-height:calc(100% - 80px - 196px - 48px)}}.scheduler-editor.sc-nylas-editor-tabs-group .form-contents.sc-nylas-editor-tabs-group .tabs.sc-nylas-editor-tabs-group{display:flex;flex-direction:column;border-right:1px solid var(--nylas-base-200);background-color:var(--nylas-base-25)}.scheduler-editor.sc-nylas-editor-tabs-group .form-contents.sc-nylas-editor-tabs-group .tabs.sc-nylas-editor-tabs-group .tab.sc-nylas-editor-tabs-group{display:flex;align-items:center;text-align:left;gap:0.5rem;padding:0.5rem 1rem;color:var(--nylas-base-900);background:var(--nylas-base-0);border:none;height:56px;font-family:var(--nylas-font-family);font-size:16px;font-weight:500;line-height:24px;cursor:pointer}.scheduler-editor.sc-nylas-editor-tabs-group .form-contents.sc-nylas-editor-tabs-group .tabs.sc-nylas-editor-tabs-group .tab.sc-nylas-editor-tabs-group:not(:first-of-type){margin-top:0.25rem}.scheduler-editor.sc-nylas-editor-tabs-group .form-contents.sc-nylas-editor-tabs-group .tabs.sc-nylas-editor-tabs-group .tab.sc-nylas-editor-tabs-group:last-of-type{margin-bottom:0.25rem}.scheduler-editor.sc-nylas-editor-tabs-group .form-contents.sc-nylas-editor-tabs-group .tabs.sc-nylas-editor-tabs-group .tab.active.sc-nylas-editor-tabs-group{font-weight:600;background:var(--nylas-base-0);color:var(--nylas-primary);border-left:4px solid var(--nylas-primary);box-shadow:0px 1px 2px 0px rgba(0, 0, 0, 0.0588235294);box-shadow:0px 1px 3px 0px rgba(0, 0, 0, 0.1019607843)}.scheduler-editor.sc-nylas-editor-tabs-group .form-contents.sc-nylas-editor-tabs-group .tabs.sc-nylas-editor-tabs-group .tab.hide.sc-nylas-editor-tabs-group{display:none}@media screen and (max-width: 768px){.scheduler-editor.sc-nylas-editor-tabs-group .form-contents.sc-nylas-editor-tabs-group .tabs.sc-nylas-editor-tabs-group{border-right:none}}.scheduler-editor.sc-nylas-editor-tabs-group .form-contents.sc-nylas-editor-tabs-group .tab-content.sc-nylas-editor-tabs-group{max-width:692px;overflow-y:auto;overflow-x:hidden}.scheduler-editor.sc-nylas-editor-tabs-group .form-contents.sc-nylas-editor-tabs-group .tab-content.sc-nylas-editor-tabs-group .hide.sc-nylas-editor-tabs-group{display:none}.scheduler-editor.sc-nylas-editor-tabs-group .form-contents.sc-nylas-editor-tabs-group .tab-content.sc-nylas-editor-tabs-group .calendar-view.sc-nylas-editor-tabs-group{position:absolute;top:0;left:0;height:calc(100% - 80px);width:-webkit-fill-available;background:var(--nylas-base-0)}.scheduler-editor.sc-nylas-editor-tabs-group .form-contents.sc-nylas-editor-tabs-group .tab-content.sc-nylas-editor-tabs-group nylas-event-info.sc-nylas-editor-tabs-group,.scheduler-editor.sc-nylas-editor-tabs-group .form-contents.sc-nylas-editor-tabs-group .tab-content.sc-nylas-editor-tabs-group nylas-event-limits.sc-nylas-editor-tabs-group{width:inherit}.scheduler-editor.sc-nylas-editor-tabs-group .form-contents.sc-nylas-editor-tabs-group .tab-content.sc-nylas-editor-tabs-group nylas-event-info.sc-nylas-editor-tabs-group div[slot=inputs].sc-nylas-editor-tabs-group,.scheduler-editor.sc-nylas-editor-tabs-group .form-contents.sc-nylas-editor-tabs-group .tab-content.sc-nylas-editor-tabs-group nylas-event-limits.sc-nylas-editor-tabs-group div[slot=inputs].sc-nylas-editor-tabs-group{display:flex;flex-direction:column;gap:1rem}.scheduler-editor.sc-nylas-editor-tabs-group .form-contents.sc-nylas-editor-tabs-group .tab-content.sc-nylas-editor-tabs-group .tab-header.sc-nylas-editor-tabs-group{display:flex;flex-direction:column;margin:1rem 1rem 0.5rem;row-gap:4px}.scheduler-editor.sc-nylas-editor-tabs-group .form-contents.sc-nylas-editor-tabs-group .tab-content.sc-nylas-editor-tabs-group .tab-header.sc-nylas-editor-tabs-group h3.sc-nylas-editor-tabs-group{margin:0;font-size:16px;font-weight:600;line-height:20px;color:var(--nylas-base-900);text-align:left}.scheduler-editor.sc-nylas-editor-tabs-group .form-contents.sc-nylas-editor-tabs-group .tab-content.sc-nylas-editor-tabs-group .tab-header.sc-nylas-editor-tabs-group p.sc-nylas-editor-tabs-group{margin:0;font-size:0.875rem;font-weight:400;line-height:20px;color:var(--nylas-base-600);text-align:left}.footer.sc-nylas-editor-tabs-group{display:flex;justify-content:space-between;align-items:center;gap:1rem;min-height:80px;padding:0 1rem;border-top:1px solid var(--nylas-base-200)}@media screen and (max-width: 768px){.footer.sc-nylas-editor-tabs-group{flex-direction:column;height:auto;z-index:2}}.footer.sc-nylas-editor-tabs-group .preview.sc-nylas-editor-tabs-group{display:flex;gap:16px}@media screen and (max-width: 768px){.footer.sc-nylas-editor-tabs-group .preview.sc-nylas-editor-tabs-group{margin-top:1rem;width:100%}}.footer.sc-nylas-editor-tabs-group .preview.sc-nylas-editor-tabs-group button-component.page-settings-button.sc-nylas-editor-tabs-group{min-width:140px}.footer.sc-nylas-editor-tabs-group .buttons.sc-nylas-editor-tabs-group{display:flex;justify-content:flex-end;align-items:center;justify-self:flex-end;gap:1rem}@media screen and (max-width: 768px){.footer.sc-nylas-editor-tabs-group .buttons.sc-nylas-editor-tabs-group{flex-direction:column-reverse;width:100%}}.footer.sc-nylas-editor-tabs-group .buttons.sc-nylas-editor-tabs-group .footer-buttons__row.sc-nylas-editor-tabs-group{display:flex;gap:16px}@media screen and (max-width: 768px){.footer.sc-nylas-editor-tabs-group .buttons.sc-nylas-editor-tabs-group .footer-buttons__row.sc-nylas-editor-tabs-group{width:100%}.footer.sc-nylas-editor-tabs-group .buttons.sc-nylas-editor-tabs-group .footer-buttons__row.sc-nylas-editor-tabs-group button-component[title=Preview].sc-nylas-editor-tabs-group{width:48px}}.footer.sc-nylas-editor-tabs-group .buttons.sc-nylas-editor-tabs-group p.sc-nylas-editor-tabs-group{max-width:524px}.footer.sc-nylas-editor-tabs-group .buttons.sc-nylas-editor-tabs-group p.unsaved-changes.sc-nylas-editor-tabs-group{color:var(--nylas-base-600)}.footer.sc-nylas-editor-tabs-group .buttons.sc-nylas-editor-tabs-group p.saved-changes.sc-nylas-editor-tabs-group{color:var(--nylas-success)}.footer.sc-nylas-editor-tabs-group .buttons.sc-nylas-editor-tabs-group p.error.sc-nylas-editor-tabs-group{color:var(--nylas-error)}.footer.sc-nylas-editor-tabs-group .buttons.sc-nylas-editor-tabs-group p.error-full-width.sc-nylas-editor-tabs-group{max-width:660px}@media screen and (max-width: 768px){.footer.sc-nylas-editor-tabs-group .buttons.sc-nylas-editor-tabs-group button-component.sc-nylas-editor-tabs-group{width:100%}}.footer.sc-nylas-editor-tabs-group .buttons.sc-nylas-editor-tabs-group button.sc-nylas-editor-tabs-group{background:var(--nylas-primary);color:var(--nylas-base-0);height:48px;border:none;border-radius:var(--nylas-border-radius-2x);font-size:16px;line-height:24px;padding:0 1rem;cursor:pointer;width:148px}.footer.sc-nylas-editor-tabs-group .buttons.sc-nylas-editor-tabs-group button.sc-nylas-editor-tabs-group:hover{background:var(--nylas-base-600)}.footer.sc-nylas-editor-tabs-group .buttons.sc-nylas-editor-tabs-group button.sc-nylas-editor-tabs-group:active{background:var(--nylas-base-800)}.footer.sc-nylas-editor-tabs-group .buttons.sc-nylas-editor-tabs-group button.sc-nylas-editor-tabs-group:disabled{background:var(--nylas-base-300);cursor:not-allowed}.footer.sc-nylas-editor-tabs-group .buttons.sc-nylas-editor-tabs-group button.sc-nylas-editor-tabs-group span.sc-nylas-editor-tabs-group{display:flex;align-items:center;justify-content:center;gap:0.5rem}.footer.sc-nylas-editor-tabs-group .buttons.sc-nylas-editor-tabs-group button-component.save-changes.sc-nylas-editor-tabs-group{min-width:140px}button-component#report-issue.sc-nylas-editor-tabs-group{width:auto}nylas-feedback-form.sc-nylas-editor-tabs-group{position:absolute;top:0;height:100%;width:100%;display:flex;flex-direction:column;justify-content:center;align-items:center;background:rgba(0, 0, 0, 0.6);z-index:2;border-radius:inherit}';var R=undefined&&undefined.__decorate||function(e,t,n,a){var s=arguments.length,o=s<3?t:a===null?a=Object.getOwnPropertyDescriptor(t,n):a,i;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")o=Reflect.decorate(e,t,n,a);else for(var r=e.length-1;r>=0;r--)if(i=e[r])o=(s<3?i(o):s>3?i(t,n,o):i(t,n))||o;return s>3&&o&&Object.defineProperty(t,n,o),o};var G=undefined&&undefined.__metadata||function(e,t){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(e,t)};const $=class{constructor(t){e(this,t);this.schedulerConfigChanged=a(this,"schedulerConfigChanged",7);this.schedulerConfigCreated=a(this,"schedulerConfigCreated",7);this.cancelButtonClick=a(this,"cancelButtonClick",7);this.formSubmitted=a(this,"formSubmitted",7);this.previewButtonClicked=a(this,"previewButtonClicked",7);this.schedulerEditorFormUpdated=a(this,"schedulerEditorFormUpdated",7);this.groupEventCreateTriggered=a(this,"groupEventCreateTriggered",7);this.groupEventUpdateTriggered=a(this,"groupEventUpdateTriggered",7);this.groupEventDeleteTriggered=a(this,"groupEventDeleteTriggered",7);this.groupEventImportTriggered=a(this,"groupEventImportTriggered",7);this.saveGroupEventChangesError=a(this,"saveGroupEventChangesError",7);this.nylasSchedulerError=a(this,"nylasSchedulerError",6);this.dismissNotification=a(this,"dismissNotification",6);this.schedulerPreviewLink="";this.mode="app";this.hideEditorTabs=[];this.enableUserFeedback=true;this.action="create";this.showFeedbackModal=false;this.activeTab=B.CalendarView;this.isLoading=false;this.componentLoaded=false;this.hasUnsavedChanges=false;this.changesSaved=false;this.formState={};this.error={message:"",type:m.Error,category:g.Component,title:""};this.formSubmissionHandler=async e=>{e.preventDefault();const t=await this.formSubmitted.emit();r("[nylas-editor-tabs-group]","formSubmissionHandler",t);const n=this.formRef.checkValidity();if(!n||t.defaultPrevented){await this.host.setError({message:this.formRef.validationMessage||l.t("fixFormErrors"),type:m.Error,category:g.Component,title:l.t("nylasEditorTabs.formErrorTitle")});return}this.isLoading=true;this.hasUnsavedChanges=false;const a=this.updateFormState();r("[nylas-editor-tabs-group]","formState",a);const{title:s,description:o,bookingCalendar:i,location:p,bookingType:b,minCancellationNotice:f,minBookingNotice:h,cancellationPolicy:u,hideCancellationOptions:_,hideReschedulingOptions:v,additionalFields:w,conferencing:k,reminders:x,emailTemplate:C,redirectUrl:E,slug:T,appearance:S,name:O,eventCapacity:H,eventTimeslot:L,participants:z,disableEmails:F,organizerLocale:N}=a;const j={...this.selectedConfiguration?.id&&{id:this.selectedConfiguration.id},slug:T,name:O,type:this.selectedEventType===y.group?y.group:undefined,scheduler:{cancellation_policy:u??"",min_cancellation_notice:f??0,min_booking_notice:h??60,hide_cancellation_options:_??false,hide_rescheduling_options:v??false,additional_fields:w,email_template:C?{...C,organizer_locale:N||"en",logo:C.logo||""}:undefined,confirmation_redirect_url:E},appearance:S,group_booking:{booking_type:b?b:"booking",disable_emails:typeof F==="boolean"?F:false,reminders:x,conferencing:k,calendar_id:i||"primary",default_capacity:H||10}};const B=c(this.selectedConfiguration,d(j||{}));const P=B;delete P.availability;delete P.participants;delete P.event_booking;const I=e=>{this.isLoading=false;this.changesSaved=true;setTimeout((()=>{this.changesSaved=false}),3e3)};const R=this.checkForBookingFormErrors(P);if(R){return}const G={name:this.currentUser?.name??this.currentUser?.email??"",email:this.currentUser?.email??""};const $=this.calendars?.find((e=>e.is_primary))??this.calendars?.[0];const J=[{...G,is_organizer:true}];const M=!this.selectedConfiguration?.id?{title:s,description:o,location:!k?p:undefined,conferencing:!p?k:undefined,when:{start_time:L?.when?.start_time??0,end_time:L?.when?.end_time??0,start_timezone:L?.when?.start_timezone??"",end_timezone:L?.when?.end_timezone??""},recurrence:L?.recurrence??[],calendar_id:i||$?.id||"primary",participants:z?.length?z:J,organizer:G,capacity:H||10}:undefined;this.schedulerConfigChanged.emit({groupEvent:M||undefined,config:P,resetLoadingState:I,action:this.action,host:this.host})};this.checkForBookingFormErrors=e=>{let t=false;let n="";const a=e.scheduler?.additional_fields;if(a){n="";Object.entries(a).forEach((e=>{const a=e[1];if(a.label===""){n+=l.t("nylasEditorTabs.bookingFormError_label",{type:a.type});t=true;return}if(a.options){for(const e of a.options){if(e.trim()===""){n+=l.t("nylasEditorTabs.bookingFormError_option",{label:a.label,type:a.type});t=true;break}}}}))}if(t){this.isLoading=false;this.host.setError({message:n,type:m.Error,category:g.Component,title:l.t("nylasEditorTabs.bookingFormError")})}return t}}configChangedHandler(e){r("[nylas-editor-tabs-group]","configChangedHandler",e,this.selectedConfiguration);this.formState={...this.getFormStateFromConfig(e)};if(e?.id){this.action="edit"}else{this.action="create"}}selectedGroupEventChangedHandler(e){r("[nylas-editor-tabs-group]","selectedGroupEventChangedHandler",e,this.selectedConfiguration);this.formState={...this.formState,title:this.selectedGroupEvent?.event?.title,description:this.selectedGroupEvent?.event?.description,location:this.selectedGroupEvent?.event?.location,conferencing:this.selectedGroupEvent?.event?.conferencing,eventCapacity:this.selectedGroupEvent?.group_event_info?.capacity,participants:this.selectedGroupEvent?.group_event_info?.participants?.map((e=>({name:e.name,email:e.email,is_organizer:!!e.is_organizer}))),eventTimeslot:this.selectedGroupEvent?.event?.when?{when:{start_time:this.selectedGroupEvent?.event?.when?.start_time,end_time:this.selectedGroupEvent?.event?.when?.end_time,start_timezone:this.selectedGroupEvent?.event?.when?.start_timezone,end_timezone:this.selectedGroupEvent?.event?.when?.end_timezone},recurrence:this.selectedGroupEvent?.group_event_info?.rrule?this.selectedGroupEvent?.group_event_info?.rrule:[]}:undefined}}userChangedHandler(e){r("[nylas-editor-tabs-group]","userChangedHandler",e);if(e){this.formState={...this.getFormStateFromConfig(this.selectedConfiguration)}}}selectedLanguageChangedHandler(e,t){if(e===t)return;l.changeLanguage(e);if(this.error&&this.error.message){this.error={...this.error,message:l.t("fixFormErrors")};this.showErrorNotification(this.error)}}themeConfigChangedHandler(e,t){if(e===t)return;this.applyThemeConfig(e)}applyThemeConfig(e){if(e){for(const[t,n]of Object.entries(e)){this.host.style.setProperty(`${t}`,n)}}}async schedulerConfigCreatedEventHandler(e){const t=this.schedulerConfigCreated.emit(e);return t}async setError(e){this.error={message:e.message,type:e.type,category:e.category,title:e.title||l.t("genericErrorTitle")};if(this.error?.message){this.showErrorNotification(this.error)}}async resetError(){if(this.error?.message){this.dismissNotification.emit({id:this.error?.message.split(" ").join("-"),host:this.host})}this.error={message:"",type:m.Error,category:g.Component,title:""}}connectedCallback(){r("[nylas-editor-tabs-group]","connectedCallback");queueMicrotask((()=>{if(this.themeConfig){this.applyThemeConfig(this.themeConfig);this.host.setAttribute("data-themed","")}}))}componentWillLoad(){r("[nylas-editor-tabs-group]","componentWillLoad");this.formState=this.getFormStateFromConfig(this.selectedConfiguration)}componentDidLoad(){r("[nylas-editor-tabs-group]","componentDidLoad");if(this.enableUserFeedback&&!v()){w({dsn:"https://9d5731f1c77ca84c9ed3fb9b3ccf7ee1@o74852.ingest.us.sentry.io/4507889638178816",release:_,integrations:e=>[...e.filter((e=>false)),C({colorScheme:"system",autoInject:false})],autoSessionTracking:false,beforeSend:()=>null})}if(this.selectedConfiguration?.id){this.configChangedHandler(this.selectedConfiguration)}const e=this.host.querySelector("button.tab:not(.hide)")?.name;if(e&&this.hideEditorTabs?.includes(this.activeTab)){this.activeTab=e}this.updateFormState();this.componentLoaded=true}disconnectedCallback(){r("[nylas-editor-tabs-group]","disconnectedCallback")}handleValueChanged(e){r("[nylas-editor-tabs-group]","handleValueChanged",e);const{name:t,value:n}=e.detail;r("name",t,"value",n);this.setFormState(n,t);this.formState={...this.formState};if(h.includes(t)){this.hasUnsavedChanges=true}this.host.resetError();this.schedulerEditorFormUpdated.emit({value:e.detail.value,name:e.detail.name})}feedbackModalClosedHandler(){this.showFeedbackModal=false}feedbackSubmittedHandler(e){k("Scheduler Editor User Feedback");const t={message:e.detail.feedback};x(t,{includeReplay:true,captureContext:{tags:{"nylas-web-element":"nylas-scheduler-editor","nylas-web-element-version":_},extra:{configId:this.selectedConfiguration?.id,slug:this.selectedConfiguration?.slug}}});this.showFeedbackModal=false}importGroupEventHandler(e){this.groupEventImportTriggered.emit({groupEvent:e.detail,configId:this.selectedConfiguration?.id??"",host:this.host})}saveGroupEventChangesHandler(e){r("saveGroupEventChangesHandler",e.detail,this.selectedGroupEvent);const t=this.formRef.checkValidity();const n=this.getGroupEventDetailsFromFormState();this.resetError();if(!n.title){this.setError({message:l.t("nylasEditorTabsGroup.eventTitleRequired"),type:m.Error,category:g.Component,title:l.t("nylasEditorTabs.formErrorTitle")})}if(!n.when?.start_time||!n.when?.end_time){this.setError({message:l.t("nylasEditorTabsGroup.eventTimeRequired"),type:m.Error,category:g.Component,title:l.t("nylasEditorTabs.formErrorTitle")})}if(!n.participants?.length){this.setError({message:l.t("nylasEditorTabsGroup.participantsRequired"),type:m.Error,category:g.Component,title:l.t("nylasEditorTabs.formErrorTitle")})}if(n.participants?.length&&n.participants?.some((e=>!e.email))){this.setError({message:l.t("nylasEditorTabsGroup.participantEmailRequired"),type:m.Error,category:g.Component,title:l.t("nylasEditorTabs.formErrorTitle")})}if(this.error?.message!==""||!t){this.saveGroupEventChangesError.emit({error:this.error?.message??l.t("nylasEditorTabsGroup.errorOccured"),configId:this.selectedConfiguration?.id??"",host:this.host});return}this.groupEventUpdateTriggered.emit({groupEvent:n,chosenOption:e.detail.action,configId:this.selectedConfiguration?.id??"",host:this.host})}deleteGroupEventHandler(e){r("deleteGroupEventHandler",e.detail);const t=this.getGroupEventDetailsFromFormState();this.groupEventDeleteTriggered.emit({groupEvent:t,chosenOption:e.detail.action,configId:this.selectedConfiguration?.id??"",host:this.host})}createGroupEventHandler(e){const t=e.detail;const n={name:this.currentUser?.name??this.currentUser?.email??"",email:this.currentUser?.email??""};const a=this.calendars?.find((e=>e.is_primary))??this.calendars?.[0];const s=this.formState?.conferencing||t.conferencing;const o={title:t.title,description:t.description,location:!s?t.location:undefined,participants:t.participants,organizer:n,conferencing:!t.location?s:undefined,when:t.eventTimeslot.when,recurrence:t.eventTimeslot.recurrence,calendar_id:a?.id||"primary",capacity:t.eventCapacity};this.groupEventCreateTriggered.emit({groupEvent:o,configId:this.selectedConfiguration?.id??"",host:this.host})}showErrorNotification(e){this.nylasSchedulerError.emit({notification:{title:e.title,category:e.category||g.Component,type:e.type||m.Error,description:e.message,id:e.message.split(" ").join("-"),ttl:"none"},host:this.host})}getGroupEventDetailsFromFormState(){const e=this.calendars?.find((e=>e.is_primary))??this.calendars?.[0];const t={name:this.currentUser?.name??this.currentUser?.email??"",email:this.currentUser?.email??""};const n=[{...t,is_organizer:true}];const{title:a,description:s,bookingCalendar:o,location:i,conferencing:r,eventCapacity:l,eventTimeslot:c,participants:d}=this.formState;return{title:a,description:s,location:!r?i:undefined,conferencing:!i?r:undefined,when:{start_time:c?.when?.start_time??0,end_time:c?.when?.end_time??0,start_timezone:c?.when?.start_timezone??"",end_timezone:c?.when?.end_timezone??""},recurrence:c?.recurrence??[],calendar_id:o||e?.id||"primary",participants:d?.length?d:n,organizer:t,capacity:l||10}}getFormStateFromConfig(e){if(e?.appearance){r("Appearance settings have been returned from the given configuration; please remember to grab them from the configSettingsLoaded event and apply them as desired.")}return{additionalFields:e?.scheduler?.additional_fields??{},bookingType:e?.group_booking?.booking_type??"booking",cancellationPolicy:e?.scheduler?.cancellation_policy??"",minCancellationNotice:e?.scheduler?.min_cancellation_notice??0,minBookingNotice:e?.scheduler?.min_booking_notice??60,hideCancellationOptions:e?.scheduler?.hide_cancellation_options??false,hideReschedulingOptions:e?.scheduler?.hide_rescheduling_options??false,reminders:e?.group_booking?.reminders,emailTemplate:e?.scheduler?.email_template,redirectUrl:e?.scheduler?.confirmation_redirect_url,slug:e?.slug,appearance:e?.appearance,name:e?.name,bookingCalendar:e?.group_booking?.calendar_id,disableEmails:e?.group_booking?.disable_emails,organizerLocale:e?.scheduler?.email_template?.organizer_locale}}setFormState(e,t){switch(t){case"title":this.formState.title=e.toString();break;case"description":this.formState.description=e.toString();break;case"location":this.formState.location=e.toString();break;case"conference":this.formState.conferencing=JSON.parse(e.toString());break;case"confirmation-type":this.formState.bookingType=e.toString();break;case"min-cancellation-notice":this.formState.minCancellationNotice=parseInt(e.toString());break;case"min-booking-notice":this.formState.minBookingNotice=parseInt(e.toString());break;case"cancellation-policy":this.formState.cancellationPolicy=e.toString();break;case"customize-booking-settings":{const t=JSON.parse(e.toString());this.formState.hideCancellationOptions=t.hideCancellationOptions;this.formState.hideReschedulingOptions=t.hideReschedulingOptions;break}case"booking-calendar":this.formState.bookingCalendar=e.toString();break;case"event-capacity":this.formState.eventCapacity=parseInt(String(e));break;case"additional-fields":this.formState.additionalFields=JSON.parse(e.toString());break;case"confirmation-email-template":this.formState.emailTemplate=JSON.parse(e.toString());break;case"reminder-overrides":this.formState.reminders=JSON.parse(e.toString());break;case"confirmation-redirect":this.formState.redirectUrl=e.toString();break;case"custom-event-slug":r("custom-event-slug",e);this.formState.slug=JSON.parse(e.toString());break;case"page-styling":this.formState.appearance=JSON.parse(e.toString());break;case"page-name":this.formState.name=JSON.parse(e.toString());break;case"participants":{const t=JSON.parse(e.toString());this.formState.participants=t.map((e=>({name:e.name,email:e.email,is_organizer:e.is_organizer,...e.grant_id?{grant_id:e.grant_id}:{}})));break}case"event-timeslot":this.formState.eventTimeslot=JSON.parse(e.toString());break;case"disable-emails":{const{disableEmails:t,organizerLocale:n}=JSON.parse(e.toString());this.formState.disableEmails=t;this.formState.organizerLocale=n;break}}this.schedulerEditorFormUpdated.emit({value:e,name:t})}updateFormState(){const e=new FormData(this.formRef);e.forEach(((e,t)=>{this.setFormState(e,t)}));this.formState={...this.formState};return this.formState}setActiveTab(e,t){e.preventDefault();this.updateFormState();this.activeTab=t}hideTab(e){return this.hideEditorTabs?.includes(e)||false}onFeedbackClick(e){e.preventDefault();this.showFeedbackModal=true}render(){r("[nylas-editor-tabs-group]","render",this.formState);return t(s,{key:"5c43ab9753d143dc7106e2610d859018f16d7c8a"},t("nylas-notification",{key:"aad4b319b5a15d071c50104f5e5143e20a46a242"}),t("form",{key:"6be0f7f3f455c7fd3c238dabca0b28d2c8720470",onSubmit:this.formSubmissionHandler,class:"scheduler-editor",ref:e=>this.formRef=e,noValidate:true},this.mode==="app"?t("div",{class:"return-to-calendar-view",part:"editor__return-to-calendar-view net__return-to-calendar-view"},t("button-component",{id:"return-to-calendar-view-button",variant:"invisible",part:"nset__header__back-button",type:"button",onClick:e=>{this.setActiveTab(e,B.CalendarView)}},t("chevron-icon",{width:"16",height:"16"}),t("span",null,l.t("returnToCalendarView")))):null,this.mode==="app"?t("div",{class:"form-contents",part:"editor__form-contents net__form-contents"},t("div",{class:"tabs",part:"editor__tabs net__tabs"},t("button",{name:B.BookingOptions,class:{tab:true,active:this.activeTab==B.BookingOptions,hide:this.hideTab(B.BookingOptions)},part:"editortab__booking-options net__tab-booking-options",onClick:e=>this.setActiveTab(e,B.BookingOptions)},t("flow-icon",{width:"16",height:"16"}),l.t("bookingOptionsTab")),t("button",{name:B.BookingForm,class:{tab:true,active:this.activeTab==B.BookingForm,hide:this.hideTab(B.BookingForm)},part:"editortab__booking-form net__tab-booking-form",onClick:e=>this.setActiveTab(e,B.BookingForm)},this.activeTab==B.BookingForm?t("calendar-agenda-fill-icon",{width:"16",height:"16"}):t("calendar-agenda-icon",{width:"16",height:"16"}),l.t("bookingFormTab")),t("button",{name:B.Communications,class:{tab:true,active:this.activeTab==B.Communications,hide:this.hideTab(B.Communications)},onClick:e=>this.setActiveTab(e,B.Communications),part:"editortab__communications net__tab-communications"},this.activeTab==B.Communications?t("envelope-fill-icon",{width:"16",height:"16"}):t("envelope-icon",{width:"16",height:"16"}),l.t("communicationsTab")),t("button",{name:B.PageStyles,class:{tab:true,active:this.activeTab==B.PageStyles,hide:this.hideTab(B.PageStyles)},onClick:e=>this.setActiveTab(e,B.PageStyles),part:"editortab__page-styles net__tab-page-styles"},this.activeTab==B.PageStyles?t("paintbrush-fill-icon",{width:"16",height:"16"}):t("paintbrush-icon",{width:"16",height:"16"}),l.t("pageStylesTab"))),t("div",{class:"tab-content",part:"editor__tab-content net__tab-content"},t(P,{formState:this.formState,activeTab:this.activeTab,currentUser:this.currentUser,calendars:this.calendars,id:this.selectedConfiguration?.id??"new",i18next:l}))):t("div",{class:"composable",key:this.selectedConfiguration?.id},t("slot",null)),t("div",{key:"a33beeedc56376b9a421af7e996e478aca42de84",class:"footer",part:"editor__footer net__footer"},t("div",{key:"4fa919de1796a541b34dcfd8a835249b7613b5e4",class:"preview",part:"editor__footer-preview net__footer-preview"},this.enableUserFeedback&&t("button-component",{key:"a89bef04b5f00a893d0ce536889d27e691348a87",title:"Share your feedback",id:"report-issue",variant:"basic",onClick:e=>this.onFeedbackClick(e)},t("feedback-icon",{key:"3bd71fd8df54e8a322831fa920f8da73c4649a64"})),this.activeTab===B.CalendarView&&t("button-component",{key:"a2c9fa658b4ab9bec066702df7be4a98682bf148",class:"page-settings-button",title:"Go to page settings",id:"page-settings",variant:"basic",onClick:e=>this.setActiveTab(e,B.BookingOptions)},l.t("pageSettingsButton"))),t("div",{key:"685c81809fbe5a28e86f93a8a3b357148a72fd76",class:"buttons",part:"editor__footer-buttons net__footer-buttons"},t("p",{key:"a59e3c5f92c2b2a404c659cb5b2b5ce01362bb30",class:{"unsaved-changes":this.hasUnsavedChanges&&!this.changesSaved,"saved-changes":this.changesSaved,error:this.error?.message!=="","error-full-width":this.error?.message!==""&&this.action==="create"}},this.error?.message==""&&this.hasUnsavedChanges&&!this.changesSaved&&this.activeTab!==B.CalendarView?l.t("unsavedChangesLabel"):this.error?.message==""&&this.changesSaved?`${l.t("changesSavedLabel")}!`:""),t("div",{key:"932230c2a5f60e19abd0db90a55b3b251252b1bd",class:"footer-buttons__row"},this.schedulerPreviewLink!==""&&this.action==="edit"&&t("button-component",{key:"c875383a9d26d1695cc20b1d4c9676a070c3608f",title:"Preview",type:"button",disabled:this.isLoading,clickHandler:e=>{e.preventDefault();const t=this.previewButtonClicked.emit(this.host);if(!t.defaultPrevented){window.open(f(this.schedulerPreviewLink,this.selectedConfiguration),"_blank")}},variant:"basic"},t("eye-icon",{key:"1485e9f9ade7fd205cfab8195197b0d597e9c4bf"})),t("button-component",{key:"62167206c6a8bde1cbfae44c7d54cfb6ed0692ac",type:"button",disabled:this.isLoading,clickHandler:e=>{e.preventDefault();this.cancelButtonClick.emit();this.host.resetError()},variant:"basic",part:"editor__footer-cancel net__footer-cancel"},l.t("cancelButton")),t("button-component",{key:"e6ecfe240142f787ec5ac4ca5a1ff680b2ff3d3f",class:{"save-changes":this.action==="edit"},type:"submit",disabled:this.isLoading,part:"editor__footer-cta, net__footer-cta"},!this.componentLoaded?t("span",null,t("loading-icon",null)," "):this.isLoading?t("span",null,l.t("savingButtonText"),t("loading-icon",null)," "):this.action==="create"?`${l.t("createButtonText")}`:`${l.t("saveChangesButtonText")}`))))),this.showFeedbackModal&&t("nylas-feedback-form",{key:"449cab0589ff40203a33ed2bbee0e4a55458d557"}))}get host(){return o(this)}static get watchers(){return{selectedConfiguration:["configChangedHandler"],selectedGroupEvent:["selectedGroupEventChangedHandler"],currentUser:["userChangedHandler"],selectedLanguage:["selectedLanguageChangedHandler"],themeConfig:["themeConfigChangedHandler"]}}};R([i({name:"nylas-editor-tabs-group",stateToProps:new Map([["schedulerConfig.calendars","calendars"],["schedulerConfig.selectedConfiguration","selectedConfiguration"],["schedulerConfig.currentUser","currentUser"],["schedulerConfig.configurations","configurations"],["schedulerConfig.selectedLanguage","selectedLanguage"],["schedulerConfig.selectedEventType","selectedEventType"],["schedulerConfig.selectedGroupEvent","selectedGroupEvent"],["schedulerConfig.themeConfig","themeConfig"]]),eventToProps:{schedulerConfigChanged:async(e,t)=>{const{resetLoadingState:n,host:a,action:s,config:o,groupEvent:i}=e.detail;const r=(e,t)=>{const[n,o]=e;if(!n&&o){a.setError({message:o.message||l.t("genericErrorTitle"),type:m.Error,category:g.Component,title:t})}else if(n&&!o&&s==="create"){a.schedulerConfigCreatedEventHandler({config:n,action:s,host:a})}};if(s==="edit"){const a=await t.schedulerConfig.updateConfiguration(o);r(a,l.t("nylasEditorTabs.updateConfigError"));if(n){n(e)}}else{const a=await t.schedulerConfig.createConfiguration(o);r(a,l.t("nylasEditorTabs.createConfigError"));const[s,c]=a;const d=s?.id;if(d&&i){const e=await t.schedulerConfig.createGroupEvent(i,d);r(e,l.t("nylasEditorTabsGroup.createGroupEventError"))}if(n){n(e)}}},cancelButtonClick:async(e,t)=>{t.schedulerConfigStore.state.action=null;t.schedulerConfigStore.set("selectedEventType",undefined);t.schedulerConfigStore.set("selectedGroupEvent",undefined);t.schedulerConfigStore.set("groupEvents",[])},previewButtonClicked:async(e,t)=>{r("[nylas-editor-tabs-group]","previewButtonClicked",t)},formSubmitted:async(e,t)=>{r("[nylas-editor-tabs-group]","formSubmitted",t)},schedulerEditorFormUpdated:async(e,t)=>{r("[nylas-editor-tabs-group]","schedulerEditorFormUpdated",e)},schedulerConfigCreated:async(e,t)=>{r("[nylas-editor-tabs-group]","schedulerConfigCreated",e)},groupEventUpdateTriggered:async(e,t)=>{const{groupEvent:n,host:a,chosenOption:s,configId:o}=e.detail;const i=await t.schedulerConfig.updateGroupEvent(n,s,o);const[r,c]=i;if(!r&&c){a.setError({message:c.message||l.t("genericErrorTitle"),type:m.Error,category:g.Component,title:l.t("nylasEditorTabsGroup.updateGroupEventError")})}},groupEventDeleteTriggered:async(e,t)=>{const{groupEvent:n,chosenOption:a,configId:s,host:o}=e.detail;const i=await t.schedulerConfig.deleteGroupEvent(n,a,s);const[r,c]=i;if(!r&&c){o.setError({message:c.message||l.t("genericErrorTitle"),type:m.Error,category:g.Component,title:l.t("nylasEditorTabsGroup.deleteGroupEventError")})}},groupEventCreateTriggered:async(e,t)=>{const{groupEvent:n,configId:a,host:s}=e.detail;const o=await t.schedulerConfig.createGroupEvent(n,a);const[i,r]=o;if(!i&&r){s.setError({message:r.message||l.t("genericErrorTitle"),type:m.Error,category:g.Component,title:l.t("nylasEditorTabsGroup.createGroupEventError")})}},groupEventImportTriggered:async(e,t)=>{const{groupEvent:n,configId:a,host:s}=e.detail;const o=await t.schedulerConfig.importGroupEvent([n],a);const[i,r]=o;if(!i&&r){s.setError({message:r.message||l.t("genericErrorTitle"),type:m.Error,category:g.Component,title:l.t("nylasEditorTabsGroup.importGroupEventError")})}if(i&&i.import_failed&&i.import_failed.length>0){const e=i.import_failed.map((e=>e.reason)).join("\n");s.setError({message:e,type:m.Error,category:g.Component,title:l.t("nylasEditorTabsGroup.importGroupEventError")});setTimeout((()=>{s.resetError()}),5e3)}},saveGroupEventChangesError:async(e,t)=>{const{error:n,host:a}=e.detail;r("[nylas-editor-tabs-group]","saveGroupEventChangesError",n,a)}},localPropsToProp:new Map([["schedulerPreviewLink","schedulerPreviewLink"],["enableUserFeedback","enableUserFeedback"],["hideEditorTabs","hideEditorTabs"]]),fireRegisterEvent:true}),G("design:type",Function),G("design:paramtypes",[]),G("design:returntype",void 0)],$.prototype,"render",null);$.style=I;const J=':host{display:grid;grid-auto-flow:row;width:100%;font-family:inherit;font-optical-sizing:auto;--nylas-primary:#2563eb;--nylas-error:#cc4841;--nylas-error-50:#ffeae8;--nylas-error-100:#ffc5bf;--nylas-error-200:#fecaca;--nylas-error-pressed:#992222;--nylas-wraning:#f06c00;--nylas-success:#16a392;--nylas-info:#2b8fc2;--nylas-base-0:#ffffff;--nylas-base-25:#fcfcfd;--nylas-base-50:#f8f9fc;--nylas-base-100:#eaecf5;--nylas-base-200:#d5d9eb;--nylas-base-300:#b3b8d8;--nylas-base-400:#717bbc;--nylas-base-500:#4e5ba6;--nylas-base-600:#3e4784;--nylas-base-700:#263f72;--nylas-base-800:#293056;--nylas-base-900:#101323;--nylas-base-950:#0e101b;--nylas-color-blue-100:#e0e6f9;--nylas-border-radius:0.25rem;--nylas-border-radius-2x:0.5rem;--nylas-border-radius-3x:0.75rem;--nylas-font-family:"Inter", sans-serif;--nylas-color-black:#000000;--nylas-color-grey-900:#2c2c2c;--nylas-color-grey-800:#4b4b4b;--nylas-color-grey-700:#6e6e6e;--nylas-color-grey-600:#8e8e8e;--nylas-color-grey-500:#b3b3b3;--nylas-color-grey-400:#cacaca;--nylas-color-grey-300:#e1e1e1;--nylas-color-grey-200:#eaeaea;--nylas-color-grey-100:#f5f5f5;--nylas-color-grey-50:#fbfcfe;--nylas-color-white:#ffffff;--nylas-color-red-900:#992222;--nylas-color-red-700:#cc4841;--nylas-color-red-500:#ff786a;--nylas-color-red-300:#ffa79e;--nylas-color-red-100:#ffc5bf;--nylas-color-red-50:#ffeae8;--nylas-color-blue-900:#213571;--nylas-color-blue-700:#314fa9;--nylas-color-blue-500:#4169e1;--nylas-color-blue-300:#bdccf9;--nylas-color-blue-100:#e0e6f9;--nylas-color-blue-50:#f6f8fd;--nylas-color-yellow-900:#7c6506;--nylas-color-yellow-700:#c29f09;--nylas-color-yellow-500:#f7c90b;--nylas-color-yellow-300:#f9de70;--nylas-color-yellow-100:#fceba9;--nylas-color-yellow-50:#fdf4ce;--nylas-color-green-900:#0e6b60;--nylas-color-green-700:#16a392;--nylas-color-green-500:#17c3b2;--nylas-color-green-300:#74dbd1;--nylas-color-green-100:#a2e7e0;--nylas-color-green-50:#d1f3f0;--nylas-color-purple-900:#643554;--nylas-color-purple-700:#954f7d;--nylas-color-purple-500:#c769a7;--nylas-color-purple-300:#dda5ca;--nylas-color-purple-100:#e0bdd6;--nylas-color-purple-50:#e9dde5;--nylas-color-sky-900:#20698f;--nylas-color-sky-700:#2b8fc2;--nylas-color-sky-500:#6dceff;--nylas-color-sky-300:#8fdaff;--nylas-color-sky-100:#b8e7ff;--nylas-color-sky-50:#d9f2ff}.header{display:flex;align-items:center;justify-content:space-between;margin-bottom:1rem;gap:1rem}@media screen and (max-width: 768px){.header{flex-direction:column;gap:0.5rem;align-items:unset}}.header h2{margin:0;font-size:1.25rem;color:var(--nylas-base-900);font-weight:600}.header p{margin:0;font-size:16px;color:var(--nylas-base-700)}.header .actions{justify-self:end}@media screen and (max-width: 768px){.header .actions{width:100%}}.configurations{border:1px solid var(--nylas-base-200);border-radius:var(--nylas-border-radius-2x);background:var(--nylas-base-0);height:100%;display:flex;flex-direction:column;position:relative;overflow-y:hidden}.configurations .table-container{overflow-y:auto;flex:1}@media screen and (max-width: 768px){.configurations .table-container{min-height:624px}}.configurations .table-container table{width:100%;border-spacing:0;border-collapse:collapse;font-family:inherit;height:max-content}.configurations .table-container table.no-configurations{height:100%}.configurations .table-container table tr{color:var(--nylas-base-800);border-bottom:1px solid var(--nylas-base-200);font-family:inherit}.configurations .table-container table tr.hide{display:none}.configurations .table-container table th{font-weight:600;text-transform:uppercase;font-size:14px;line-height:20px}.configurations .table-container table tr.no-configurations td>div{display:flex;height:100%;justify-content:center;align-items:center;flex-direction:column;padding:var(--nylas-border-radius-3x)}.configurations .table-container table tr.no-configurations td>div h3{margin:0 0 1rem 0;color:var(--nylas-base-700)}.configurations .table-container table tr.no-configurations td>div p{margin:0 0 1rem 0;color:var(--nylas-base-600)}.configurations .table-container table tr.no-configurations td>div calendar-icon{margin-bottom:1rem;color:var(--nylas-base-200)}.configurations .table-container table th,.configurations .table-container table td{text-align:left;padding:1rem;font-family:inherit}.configurations .table-container table .actions{display:flex;justify-content:flex-end;gap:1rem;text-align:right}.configurations .table-container table .actions button-component.edit-button{min-width:98px}@media screen and (max-width: 768px){.configurations .table-container table .actions{flex-direction:column;gap:0.5rem}}.configurations .table-container table .actions select-dropdown.last::part(sd_dropdown-content){bottom:54px}.configurations .table-container table .title{width:100%;max-width:300px}@media screen and (max-width: 768px){.configurations .table-container table .title{max-width:96px}}.configurations .table-container table .title div{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.configurations .table-container table .title div.config-event-title{font-weight:600}.configurations .table-container table .title div.config-event-description{font-size:0.75rem}.configurations .pagination{padding:1rem;position:sticky;top:100%;display:flex;justify-content:flex-end;gap:0.5rem;background:var(--nylas-base-0);width:calc(100% - 2rem);z-index:2}.configurations .pagination td.arrows{display:flex;justify-content:flex-end;gap:0.5rem}.configurations .pagination button{display:flex;flex-direction:row;justify-content:center;align-items:center;height:3vh;width:3vh;min-width:3em;min-height:3em;cursor:pointer;border-radius:var(--nylas-border-radius-2x);border:1px solid var(--nylas-base-300);background-color:transparent;color:var(--nylas-base-800);cursor:pointer}.configurations .pagination button:hover:not(:disabled){border:1px solid var(--nylas-primary)}.configurations .pagination button:active{border:1px solid var(--nylas-base-800)}.configurations .pagination button:disabled{border:1px solid var(--nylas-base-100);background-color:transparent;color:var(--nylas-base-300);cursor:not-allowed}.configurations .pagination button.right{transform:rotate(180deg)}.error-container{margin-top:1.5rem}.error-container .error{color:var(--nylas-error);padding:0.5rem 0;margin:1rem 0 0}button-component#copy button{width:108px}select-dropdown{width:auto;color:inherit}select-dropdown::part(sd_dropdown-button){display:block;height:48px;padding:0px 16px 8px}@media screen and (max-width: 768px){select-dropdown::part(sd_dropdown-button){width:92px}}select-dropdown::part(sd_dropdown-content){width:120px;right:0}select-dropdown::part(sd_dropdown-labelhtml){display:flex;gap:0.5rem;align-items:center;color:var(--nylas-base-900)}select-dropdown::part(sd_dropdown-labelhtml):hover{color:var(--nylas-primary)}.card-wrapper{position:absolute;top:0;left:0;height:calc(100% + 4rem);width:-webkit-fill-available;width:-moz-available;width:fill-available;display:flex;flex-direction:column;justify-content:center;align-items:center;background:rgba(0, 0, 0, 0.6);z-index:2;border-radius:var(--nylas-border-radius-2x)}@media screen and (max-width: 768px){.card-wrapper{justify-content:start;height:100%}}.card-modal{background:var(--nylas-base-0);display:flex;flex-direction:column;font-family:var(--nylas-font-family);background-color:var(--nylas-base-0);color:var(--nylas-base-900);border-radius:var(--nylas-border-radius-3x);padding:32px;width:562px;box-shadow:0px 1px 4px rgba(0, 0, 0, 0.1), 0px 3px 6px rgba(0, 0, 0, 0.06)}@media screen and (max-width: 768px){.card-modal{width:auto;border-radius:0px}}.description.title-desc{margin-bottom:2rem}.description p{margin:0;font-size:18px;color:var(--nylas-base-600)}.footer{margin-top:1rem;padding-top:1rem;display:flex;justify-content:flex-end;gap:0.5rem;box-sizing:border-box;background-color:var(--nylas-base-25);width:100%;border-radius:0 0 var(--nylas-border-radius-2x) var(--nylas-border-radius-2x)}.close-button{width:100%;display:flex;justify-content:flex-end}.close-button button-component button{padding:0;height:auto}.close-button button-component button:hover{background-color:transparent !important}button-component{--dot-color:var(--nylas-base-700)}';var M=undefined&&undefined.__decorate||function(e,t,n,a){var s=arguments.length,o=s<3?t:a===null?a=Object.getOwnPropertyDescriptor(t,n):a,i;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")o=Reflect.decorate(e,t,n,a);else for(var r=e.length-1;r>=0;r--)if(i=e[r])o=(s<3?i(o):s>3?i(t,n,o):i(t,n))||o;return s>3&&o&&Object.defineProperty(t,n,o),o};var U=undefined&&undefined.__metadata||function(e,t){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(e,t)};const A=class{constructor(t){e(this,t);this.initListConfigurations=a(this,"initListConfigurations",7);this.createButtonClick=a(this,"createButtonClick",7);this.editButtonClick=a(this,"editButtonClick",7);this.deleteButtonClick=a(this,"deleteButtonClick",7);this.nylasSchedulerError=a(this,"nylasSchedulerError",6);this.dismissNotification=a(this,"dismissNotification",6);this.configurations=[];this.schedulerPreviewLink="";this.state="loading";this.error={message:"",type:m.Error,category:g.Component,title:""};this.currentCursor=null;this.previousCursors=[];this.disableNextPageButton=false;this.deleteConfigurationId="";this.showDeleteButtonLoading=false;this.editButtonLoadingId=""}listConfigurationsNextCursorChangedHandler(e,t){if(!e||e===t){if(e===null){this.disableNextPageButton=true}return}this.disableNextPageButton=false;this.currentCursor=e}selectedLanguageChangedHandler(e,t){if(e===t)return;l.changeLanguage(e)}themeConfigChangedHandler(e,t){if(e===t)return;this.applyThemeConfig(e)}connectedCallback(){r("[nylas-list-configurations]","connectedCallback");queueMicrotask((()=>{if(this.themeConfig){this.applyThemeConfig(this.themeConfig);this.host.setAttribute("data-themed","")}}))}componentWillLoad(){r("[nylas-list-configurations]","componentWillLoad");if(this.configurations&&this.configurations.length>0){this.state="loaded"}}componentDidLoad(){r("[nylas-list-configurations]","componentDidLoad");this.initListConfigurations.emit({host:this.host})}disconnectedCallback(){r("[nylas-list-configurations]","disconnectedCallback")}applyThemeConfig(e){if(e){for(const[t,n]of Object.entries(e)){this.host.style.setProperty(`${t}`,n)}}}async handleNylasFormDropdownChanged(e){r("[nylas-list-configurations]","handleNylasFormDropdownChanged",e.detail);const{value:t}=e.detail;const[n,a]=t.split("-");e.preventDefault();switch(n){case"delete":this.deleteConfigurationId=this.configurations[a]?.id;break;case"preview":window.open(f(this.schedulerPreviewLink,this.configurations[a]),"_blank");break;case"copy":await navigator.clipboard.writeText(f(this.schedulerPreviewLink,this.configurations[a]));break}}async registerCallback(){this.initListConfigurations.emit({host:this.host})}async getState(){return this.state}async setState(e){this.state=e}async setError(e){this.error={message:e.message,type:e.type,category:e.category,title:e.title||l.t("genericErrorTitle")};if(this.error?.message){this.showErrorNotification(this.error)}}async hideDeleteConfirmation(){this.deleteConfigurationId="";this.showDeleteButtonLoading=false}async hideEditButtonLoading(){this.editButtonLoadingId=""}showErrorNotification(e){this.nylasSchedulerError.emit({notification:{id:e.message.split(" ").join("-"),type:e.type||m.Error,title:e.title,category:e.category||g.Component,description:e.message,ttl:"none"},host:this.host})}closeModal(e){e.preventDefault();this.deleteConfigurationId=""}handleConfirmDeleteButtonClicked(e){e.preventDefault();this.showDeleteButtonLoading=true;const t=this.configurations.find((e=>e.id===this.deleteConfigurationId));if(t&&t?.id){this.deleteButtonClick.emit({host:this.host,configuration:t})}}getDurationString(e){if(!e)return"—";const t=Math.floor(e/60);const n=e%60;return`${t?t:""} ${t?`${t>1?"hours":"hour"}`:""} ${n?n:""} ${n?`${n>1?"mins":"min"}`:""}`}getActionLabelHTML(e){const n={display:"inline-flex",alignItems:"center",gap:"0.5rem"};const a={color:"var(--nylas-error)"};switch(e){case"preview":return t("span",{style:n},t("eye-icon",{width:"16",height:"16"}),l.t("nylasListConfigurations.previewButtonText"));case"copy":return t("span",{style:n},t("copy-icon",{width:"16",height:"16"}),l.t("nylasListConfigurations.copyLinkButtonText"));case"delete":return t("span",{style:{...n,...a}},t("delete-icon",{width:"15",height:"17"}),l.t("nylasListConfigurations.deleteButtonText"));default:return""}}previousPageClickedHandler(){if(this.previousCursors.length===0)return;this.currentCursor=this.previousCursors.pop()||null;const e=this.previousCursors[this.previousCursors.length-1]||undefined;this.initListConfigurations.emit({host:this.host,cursor:e})}nextPageClickedHandler(){if(!this.currentCursor)return;this.previousCursors=[...this.previousCursors,this.currentCursor];this.initListConfigurations.emit({host:this.host,cursor:this.currentCursor})}render(){return t(s,null,t("nylas-notification",null),t("div",{class:"header"},t("div",{class:"description"},t("h2",null,l.t("allSchedulingPages")),t("p",null,l.t("createAndManageSchedulingPages"))),this.configurations&&this.configurations.length>0&&t("div",{class:"actions"},t("button-component",{part:"nlc__create-new-cta",clickHandler:()=>{this.createButtonClick.emit(this.host)}},l.t("createNewSchedulingPageButtonText")))),t("div",{class:"configurations"},t("div",{class:"table-container"},t("table",{class:{"no-configurations":this.state!=="loading"&&(!this.configurations||this.configurations.length===0)}},t("tr",{class:{hide:this.state==="loading"||this.configurations&&this.configurations.length===0}},t("th",null,l.t("pageTitle")),t("th",null,l.t("durationTitle")),t("th",null)),this.state==="loading"&&t("tr",{class:"no-configurations"},t("td",{colSpan:3},t("div",null,t("h3",null,l.t("loading"),"..."),t("p",null,l.t("loadingPagesDescription"))))),this.state!=="loading"&&(!this.configurations||this.configurations.length===0)&&t("tr",{class:"no-configurations"},t("td",{colSpan:3},t("div",null,t("calendar-icon",{width:"48",height:"48"}),t("h3",null,l.t("noSchedulingPages")),t("p",null,l.t("createFirstSchedulingPage")),t("button-component",{part:"nlc__create-new-cta",clickHandler:()=>{this.createButtonClick.emit(this.host)}},l.t("createNewSchedulingPageButtonText"))))),this.state!=="loading"&&this.configurations?.map(((e,n)=>{const a=(n===this.configurations.length-1||n===this.configurations.length-2)&&this.configurations.length>3;const s=e;const o=e;return t("tr",{key:e?.id},t("td",null,t("div",{class:"title"},t("div",{class:"config-event-title",title:o?.event_booking?.title},o?.event_booking?.title||s?.name),t("div",{class:"config-event-description"},o?.event_booking?.description))),t("td",null,t("div",{class:"duration"},this.getDurationString(o?.availability?.duration_minutes))),t("td",null,t("div",{class:"actions"},t("button-component",{class:"edit-button",variant:"basic",key:`edit-${n}`,disabled:this.editButtonLoadingId===`edit-${n}`,isLoading:this.editButtonLoadingId===`edit-${n}`,clickHandler:t=>{t.preventDefault();this.editButtonLoadingId=`edit-${n}`;this.editButtonClick.emit({host:this.host,configuration:e})}},this.editButtonLoadingId===`edit-${n}`?null:t("edit-icon",{width:"16",height:"16"}),l.t("editSchedulingPageButtonText")),t("select-dropdown",{class:{last:a},name:"actions",options:[{value:`preview-${n}`,label:"Preview",labelHTML:this.getActionLabelHTML("preview")},{value:`copy-${n}`,label:"Copy link",labelHTML:this.getActionLabelHTML("copy")},{value:`delete-${n}`,label:"Delete",labelHTML:this.getActionLabelHTML("delete")}],defaultSelectedOption:{value:"",label:""},dropdownButtonText:"...",withSearch:false,withChevron:false,themeConfig:this.themeConfig,exportparts:"sd_dropdown: actions__dropdown, sd_dropdown-button: actions__dropdown-button, sd_dropdown-content: actions__dropdown-content, actions-Copy, actions-Preview, actions-Delete"}))))})))),t("div",{class:"pagination"},t("button",{class:"arrow left",onClick:()=>this.previousPageClickedHandler(),disabled:this.previousCursors.length<=0},t("chevron-icon",null)),t("button",{class:"arrow right",onClick:()=>this.nextPageClickedHandler(),disabled:this.disableNextPageButton},t("chevron-icon",null)))),!!this.deleteConfigurationId&&t("div",{class:"card-wrapper"},t("div",{class:"card-modal"},t("div",{class:"close-button"},t("button-component",{tooltip:"Close",id:"close",variant:"invisible",onClick:e=>this.closeModal(e),part:"nfbf__close-button"},t("close-icon",null))),t("div",{class:"header"},t("h2",{slot:"card-title",part:"nfbf__title"},l.t("deleteSchedulingPageTitle"))),t("div",{class:"description title-desc"},t("p",null,l.t("deleteSchedulingPageDescription"))),t("div",{class:{footer:true}},t("button-component",{variant:"basic",onClick:e=>this.closeModal(e),part:"nfbf__button-outline nfbf__cancel-cta"},`${l.t("deleteSchedulingPageCancelButton")}`),t("button-component",{variant:"destructive",onClick:e=>this.handleConfirmDeleteButtonClicked(e),disabled:this.showDeleteButtonLoading,isLoading:this.showDeleteButtonLoading,part:"nfbf__button-outline nfbf__reschedule-cta"},`${l.t("deleteSchedulingPageConfirmButton")}`)))))}get host(){return o(this)}static get watchers(){return{listConfigurationsNextCursor:["listConfigurationsNextCursorChangedHandler"],selectedLanguage:["selectedLanguageChangedHandler"],themeConfig:["themeConfigChangedHandler"]}}};M([i({name:"nylas-list-configurations",stateToProps:new Map([["schedulerConfig.configurations","configurations"],["schedulerConfig.listConfigurationsNextCursor","listConfigurationsNextCursor"],["schedulerConfig.selectedLanguage","selectedLanguage"],["schedulerConfig.themeConfig","themeConfig"]]),localPropsToProp:new Map([["schedulerPreviewLink","schedulerPreviewLink"]]),eventToProps:{initListConfigurations:async(e,t)=>{const{host:n,cursor:a}=e.detail;await n.setState("loading");const[s,o]=await t.schedulerConfig.getConfigurations(a);if(!s&&o&&o.message){await n.setState("error");await n.setError({message:o.message,type:m.Error,category:g.Component,title:l.t("nylasEditorTabs.getConfigsError")});return}await n.setState("loaded")},createButtonClick:async(e,t)=>{t.schedulerConfigStore.resetSelectedConfiguration();const n=Object.entries(t.schedulerConfigStore.state.enableEventTypes||{}).filter((([e,t])=>t));if(n.length===1){t.schedulerConfigStore.state.action="create";t.schedulerConfigStore.state.selectedEventType=y[n[0][0]]}else{t.schedulerConfigStore.state.action="create-select"}},deleteButtonClick:async(e,t)=>{const{host:n,configuration:a}=e.detail;const[s,o]=await t.schedulerConfig.deleteConfiguration(a.id);if(!s&&o&&o.message){await n.setState("error");await n.setError({message:o.message,type:m.Error,category:g.Component,title:l.t("nylasEditorTabs.deleteConfigError")})}await n.hideDeleteConfirmation()},editButtonClick:async(e,t)=>{const{host:n,configuration:a}=e.detail;const[s,o]=await t.schedulerConfig.getConfigurationById(a.id,true);if(!s&&o?.message){await n.setError({message:o.message,type:m.Error,category:g.Component,title:l.t("nylasEditorTabs.getConfigsError")});n.hideEditButtonLoading();return}const i=s||a;if(i.type==="group"){const{startTime:e,endTime:a}=u((new Date).toISOString(),"week");t.schedulerConfigStore.state.calendarViewDateRange={start_time:e.toString(),end_time:a.toString()};const[s,o]=await t.schedulerConfig.getGroupEvents(i.id,i);if(!s&&o&&o.message){await n.setError({message:o.message,type:m.Error,category:g.Component,title:l.t("nylasEditorTabsGroup.getGroupEventsError")});n.hideEditButtonLoading();return}}t.schedulerConfigStore.state.action="edit";t.schedulerConfigStore.state.selectedConfiguration=i;n.hideEditButtonLoading()}},fireRegisterEvent:true}),U("design:type",Function),U("design:paramtypes",[]),U("design:returntype",void 0)],A.prototype,"render",null);A.style=J;const D=':host{display:block;--nylas-primary:#2563eb;--nylas-error:#cc4841;--nylas-error-50:#ffeae8;--nylas-error-100:#ffc5bf;--nylas-error-200:#fecaca;--nylas-error-pressed:#992222;--nylas-wraning:#f06c00;--nylas-success:#16a392;--nylas-info:#2b8fc2;--nylas-base-0:#ffffff;--nylas-base-25:#fcfcfd;--nylas-base-50:#f8f9fc;--nylas-base-100:#eaecf5;--nylas-base-200:#d5d9eb;--nylas-base-300:#b3b8d8;--nylas-base-400:#717bbc;--nylas-base-500:#4e5ba6;--nylas-base-600:#3e4784;--nylas-base-700:#263f72;--nylas-base-800:#293056;--nylas-base-900:#101323;--nylas-base-950:#0e101b;--nylas-color-blue-100:#e0e6f9;--nylas-border-radius:0.25rem;--nylas-border-radius-2x:0.5rem;--nylas-border-radius-3x:0.75rem;--nylas-font-family:"Inter", sans-serif;--nylas-color-black:#000000;--nylas-color-grey-900:#2c2c2c;--nylas-color-grey-800:#4b4b4b;--nylas-color-grey-700:#6e6e6e;--nylas-color-grey-600:#8e8e8e;--nylas-color-grey-500:#b3b3b3;--nylas-color-grey-400:#cacaca;--nylas-color-grey-300:#e1e1e1;--nylas-color-grey-200:#eaeaea;--nylas-color-grey-100:#f5f5f5;--nylas-color-grey-50:#fbfcfe;--nylas-color-white:#ffffff;--nylas-color-red-900:#992222;--nylas-color-red-700:#cc4841;--nylas-color-red-500:#ff786a;--nylas-color-red-300:#ffa79e;--nylas-color-red-100:#ffc5bf;--nylas-color-red-50:#ffeae8;--nylas-color-blue-900:#213571;--nylas-color-blue-700:#314fa9;--nylas-color-blue-500:#4169e1;--nylas-color-blue-300:#bdccf9;--nylas-color-blue-100:#e0e6f9;--nylas-color-blue-50:#f6f8fd;--nylas-color-yellow-900:#7c6506;--nylas-color-yellow-700:#c29f09;--nylas-color-yellow-500:#f7c90b;--nylas-color-yellow-300:#f9de70;--nylas-color-yellow-100:#fceba9;--nylas-color-yellow-50:#fdf4ce;--nylas-color-green-900:#0e6b60;--nylas-color-green-700:#16a392;--nylas-color-green-500:#17c3b2;--nylas-color-green-300:#74dbd1;--nylas-color-green-100:#a2e7e0;--nylas-color-green-50:#d1f3f0;--nylas-color-purple-900:#643554;--nylas-color-purple-700:#954f7d;--nylas-color-purple-500:#c769a7;--nylas-color-purple-300:#dda5ca;--nylas-color-purple-100:#e0bdd6;--nylas-color-purple-50:#e9dde5;--nylas-color-sky-900:#20698f;--nylas-color-sky-700:#2b8fc2;--nylas-color-sky-500:#6dceff;--nylas-color-sky-300:#8fdaff;--nylas-color-sky-100:#b8e7ff;--nylas-color-sky-50:#d9f2ff;width:inherit}.nylas-select-event-type{height:inherit;overflow-y:auto}.nylas-select-event-type div.header{display:flex;justify-content:space-between;align-items:center;border-bottom:1px solid var(--nylas-base-200)}.nylas-select-event-type div.header h2{font-size:18px;padding:0 24px;line-height:24px;margin:0;font-weight:600;color:var(--nylas-base-800)}.nylas-select-event-type div.header button-component button{background:transparent;border:none;cursor:pointer}.nylas-select-event-type div.header button-component button:hover,.nylas-select-event-type div.header button-component button:active{color:var(--nylas-primary);background-color:transparent}.nylas-select-event-type div.header button-component button:disabled{cursor:not-allowed}.nylas-select-event-type div.content{padding:40px}.nylas-select-event-type div.content h3{margin:0 0 32px 0;font-size:18px;line-height:24px;font-weight:600}.nylas-select-event-type div.content div.event-type{display:flex;flex-direction:column;gap:8px}.nylas-select-event-type div.content div.event-type div.event-type-option{padding:16px;border:1px solid var(--nylas-base-200);border-radius:var(--nylas-border-radius-3x);width:inherit;cursor:pointer;display:flex;flex-direction:column;gap:8px}.nylas-select-event-type div.content div.event-type div.event-type-option h4{margin:0;font-size:16px;line-height:24px;font-weight:600;color:var(--nylas-base-900)}.nylas-select-event-type div.content div.event-type div.event-type-option p{margin:0;font-size:14px;line-height:21px;font-weight:400;color:var(--nylas-base-800)}';var V=undefined&&undefined.__decorate||function(e,t,n,a){var s=arguments.length,o=s<3?t:a===null?a=Object.getOwnPropertyDescriptor(t,n):a,i;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")o=Reflect.decorate(e,t,n,a);else for(var r=e.length-1;r>=0;r--)if(i=e[r])o=(s<3?i(o):s>3?i(t,n,o):i(t,n))||o;return s>3&&o&&Object.defineProperty(t,n,o),o};var q=undefined&&undefined.__metadata||function(e,t){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(e,t)};const W=class{constructor(t){e(this,t);this.returnToAllSchedulingPagesEvent=a(this,"returnToAllSchedulingPagesEvent",7);this.createEventTypeSelected=a(this,"createEventTypeSelected",7);this.name="select-event-type";this.enableEventTypes={one_on_one:true,collective:true,max_fairness:true,max_availability:true,group:true}}connectedCallback(){r("nylas-select-event-type","connectedCallback");queueMicrotask((()=>{if(this.themeConfig){this.applyThemeConfig(this.themeConfig);this.host.setAttribute("data-themed","")}}))}disconnectedCallback(){r("nylas-select-event-type","disconnectedCallback")}componentWillLoad(){r("nylas-select-event-type","componentWillLoad");this.host.setAttribute("name",this.name)}componentDidLoad(){r("nylas-select-event-type","componentDidLoad")}elementNameChangedHandler(e){r("nylas-select-event-type","elementNameChangedHandler",e);this.host.setAttribute("name",e)}selectedLanguageChangedHandler(e,t){if(e===t)return;l.changeLanguage(e)}themeConfigChangedHandler(e,t){if(e===t)return;this.applyThemeConfig(e)}applyThemeConfig(e){if(e){for(const[t,n]of Object.entries(e)){this.host.style.setProperty(`${t}`,n)}}}render(){const e={"one-on-one":"one_on_one",collective:"collective","max-fairness":"max_fairness","max-availability":"max_availability",group:"group"};const n=[{label:l.t("nylasSelectEventType.eventTypeOptions.oneOnOne.label"),value:y.one_on_one,description:l.t("nylasSelectEventType.eventTypeOptions.oneOnOne.desc")},{label:l.t("nylasSelectEventType.eventTypeOptions.collective.label"),value:y.collective,description:l.t("nylasSelectEventType.eventTypeOptions.collective.desc")},{label:l.t("nylasSelectEventType.eventTypeOptions.maxFairness.label"),value:y.max_fairness,description:l.t("nylasSelectEventType.eventTypeOptions.maxFairness.desc")},{label:l.t("nylasSelectEventType.eventTypeOptions.maxAvailability.label"),value:y.max_availability,description:l.t("nylasSelectEventType.eventTypeOptions.maxAvailability.desc")},{label:l.t("nylasSelectEventType.eventTypeOptions.group.label"),value:y.group,description:l.t("nylasSelectEventType.eventTypeOptions.group.desc")}];const a=[y.collective,y.max_availability,y.max_fairness];const o=this.participantOptions&&this.participantOptions?.length>0&&!!this.participantOptions[0].email&&!!this.participantOptions[0].name&&!!this.participantOptions[0].calendars&&this.participantOptions[0].calendars.length>0;const i=this.enableEventTypes?n.filter((t=>{const n=t.value;const s=e[n];r("key",n,this.enableEventTypes?this.enableEventTypes[s]:"no enableEventTypes");if(a.includes(n)&&!o){return false}return this.enableEventTypes&&this.enableEventTypes[s]})):n;return t(s,null,t("div",{class:"nylas-select-event-type",part:"nset"},t("div",{class:"header",part:"nset__header"},t("h2",null,l.t("nylasSelectEventType.createEventHeaderTitle")),t("button-component",{variant:"invisible",part:"nset__header__back-button",onClick:e=>{this.returnToAllSchedulingPagesEvent.emit()}},t("chevron-icon",{width:"16",height:"16"}),t("span",null,l.t("nylasSelectEventType.returnToAllSchedulingPages")))),t("div",{class:"content",part:"nset__content"},t("h3",null,l.t("nylasSelectEventType.eventTypeHeaderTitle")),t("div",{class:"event-type",part:"nset__content__event-type"},i.length===0&&t("p",null,l.t("nylasSelectEventType.noEventTypesEnabled")),i.map((e=>t("div",{class:"event-type-option",onClick:t=>{this.createEventTypeSelected.emit({eventType:e.value})},part:`nset__content__event-type-option-${e.value}`},t("h4",null,e.label),t("p",null,e.description))))))))}get host(){return o(this)}static get watchers(){return{name:["elementNameChangedHandler"],selectedLanguage:["selectedLanguageChangedHandler"],themeConfig:["themeConfigChangedHandler"]}}};V([i({name:"nylas-select-event-type",stateToProps:new Map([["schedulerConfig.selectedLanguage","selectedLanguage"],["schedulerConfig.additionalParticipants","participantOptions"],["schedulerConfig.enableEventTypes","enableEventTypes"],["schedulerConfig.themeConfig","themeConfig"]]),eventToProps:{returnToAllSchedulingPagesEvent:async(e,t)=>{t.schedulerConfigStore.state.action=null;t.schedulerConfigStore.set("selectedEventType",undefined)},createEventTypeSelected:async(e,t)=>{const{eventType:n}=e.detail;t.schedulerConfigStore.state.action="create";t.schedulerConfigStore.state.selectedEventType=n}},fireRegisterEvent:true}),q("design:type",Function),q("design:paramtypes",[]),q("design:returntype",void 0)],W.prototype,"render",null);W.style=D;export{T as google_logo_icon,O as microsoft_logo_icon,j as nylas_editor_tabs,$ as nylas_editor_tabs_group,A as nylas_list_configurations,W as nylas_select_event_type};
2
+ //# sourceMappingURL=p-acd75a32.entry.js.map