import{R as p,o as b,aU as u,k as g,l as y,j as e,E as j,a9 as n,ag as i,aJ as P}from"./app-BgLa5dit.js";function w(t){switch(t){case i.Interactive:return"interactive";case i.Clip:return"clip";case i.Video:return"video"}}function m(t){var o;const[l,r]=p.useState(!1),s=b(u.getObject(t.id)),a=w((o=s.data)==null?void 0:o.typeId),h=g(),c=y();function d(){r(!0),h(u.updateStatus(t.id,P.Published)).then(()=>{c.success(`Successfully published <strong>${s.data.name}</strong>.`),t.closePopup()}).catch(()=>{c.error(`Something went wrong while trying to publish <strong>${s.data.name}</strong>. Please try again.`),r(!1)})}return e.jsx(j,{title:`Publish ${a}`,closePopup:t.closePopup,showLoadingSpinner:!s.data,children:!!s.data&&e.jsxs(e.Fragment,{children:[e.jsxs("p",{children:["Are you sure you want to re-publish ",e.jsx("strong",{children:s.data.name}),"?"]}),e.jsxs("p",{children:["This ",a," was archived by another curator previously. Please ensure you have considered why this was archived before re-publishing it."]}),e.jsxs(n,{children:[e.jsx(n.Cancel,{onClick:t.closePopup}),e.jsx(n.Submit,{variant:"dark",type:"button",text:`Publish ${a}`,onClick:d,showSpinner:l})]})]})})}export{m as PublishObjectView};
//# sourceMappingURL=BvoBi35Z.chunk.js.map
