import{k as y,l as E,o as p,S,j as s,E as h,G as I}from"./app-BgLa5dit.js";import{b as P,a as D}from"./3qXJd5bi.chunk.js";import{C as u}from"./CdBbWXza.chunk.js";import"./4qGb1BIY.chunk.js";function C(a){var o,l,r;const m=y(),c=E(),i=p(u.getSpecialEvent(a.specialEventId)),e=(l=(o=i.data)==null?void 0:o.policies)==null?void 0:l.find(t=>t.id.toString()===a.specialEventPolicyId.toString()),n=p(!!e&&S.getClassificationTree(e.presentationId));async function f(t,v){try{const d={...e,metadata:{objectType:"Topic",objectId:t.classificationId},presentationId:t.presentationId,startDate:t.startDate,endDate:t.endDate,frequency:t.frequency,interval:t.interval};t.startDate===t.endDate&&delete d.endDate,await m(u.editSpecialEventPolicy(a.specialEventPolicyId,a.specialEventId,d)),c.success(`Successfully updated calendar event for <strong>${i.data.name}</strong>`),a.closePopup()}catch{c.error("Failed to update calendar event"),v()}}return s.jsx(h,{title:`Edit calendar event ${(r=i.data)==null?void 0:r.name}`,closePopup:a.closePopup,backdrop:"static",showLoadingSpinner:!i.hasCompleted||!n.hasCompleted,children:i.hasCompleted&&n.hasCompleted&&s.jsx(I,{initialValues:{startDate:e.startDate,endDate:e.endDate||e.startDate,frequency:e.frequency,interval:e.interval,presentationId:e.presentationId,classificationId:e.metadata.objectId},onSubmit:f,validationSchema:P,children:s.jsx(D,{classificationTree:n.data,isNew:!1,closePopup:a.closePopup})})})}export{C as EditSpecialEventPolicyView};
//# sourceMappingURL=DuDL9t-c.chunk.js.map
