import{o,aY as d,l as I,k as m,j as t,E as v,a9 as s,gd as h,aZ as w,aJ as C,g as x,h as P,i as f,aR as j}from"./app-BgLa5dit.js";import{I as A}from"./DTRakM4e.chunk.js";function T(a){const p=o(j.currentUser()),e=o(d.interactiveMetadata(a.interactiveId)),n=I(),i=m();async function u(){var r,c;try{const l=await i(h.copyInteractive(e.data.interactiveId)),g=await i(d.createInteractiveMetadata(e.data._parentVideo.id,{name:e.data.name,interactiveId:l.id,owner:{id:p.data.id},originType:A.Original,status:C.Draft,permissions:w.getProtectedReadPermission(),tags:(c=(r=e.data.tags)==null?void 0:r.data)==null?void 0:c.map(y=>({id:y.id}))}));n.success(`Successfully created a copy of <strong>${e.data.name}</strong>.`),a.closePopup(),x.trigger({application:f.INTERACTIVES,action:P.Interactives.EDIT_INTERACTIVE,args:[g.id]})}catch{n.error(`Something went wrong while we were trying to copy <strong>${e.data.name}</strong>. Please try again.`),a.closePopup()}}return t.jsx(v,{title:"Copy interactive",showLoadingSpinner:!e.data,closePopup:a.closePopup,children:!!e.data&&t.jsxs(t.Fragment,{children:[t.jsxs("p",{children:["Are you sure you want to create a copy of ",t.jsx("strong",{children:e.data.name}),"?"]}),t.jsxs(s,{children:[t.jsx(s.Cancel,{onClick:a.closePopup}),t.jsx(s.Submit,{text:"Copy interactive",variant:"dark",onClick:u})]})]})})}export{T as CopyInteractiveView};
//# sourceMappingURL=B73vS6ft.chunk.js.map
