import{R as o,l as h,o as s,r as f,p as y,g as v,h as n,i as C,j as e,ar as b,aJ as d,aR as g}from"./app-BgLa5dit.js";import{P as j,M as x}from"./CanLAf7a.chunk.js";import{C as A}from"./CULwvqVp.chunk.js";import{O as w}from"./B-fq6xxv.chunk.js";import{E}from"./kJGoOu-N.chunk.js";import{C as R}from"./BHQAWhAu.chunk.js";import{A as l}from"./DFA8aJel.chunk.js";import"./B0KtsevF.chunk.js";import"./IEOSPmnY.chunk.js";import"./C8_78Eqq.chunk.js";import"./Bkj-W53y.chunk.js";import"./KIVqng-q.chunk.js";import"./DIopWku2.chunk.js";import"./VIUZq4Vp.chunk.js";import"./B3xA170I.chunk.js";import"./t8cVFCZO.chunk.js";import"./Cu2-dDll.chunk.js";import"./kOrk-qeI.chunk.js";import"./BfMtaC_g.chunk.js";function J(a){const[c,p]=o.useState(!1),m=h(),r=s(g.currentUser()),t=s(f.clip(a.id)),u=s(y.getAssemblyLineVideo(a.id)),i=s(t.data&&j.createViewKey(t.data.id,x.MasterObject));return o.useEffect(()=>{i.hasError&&(m.error("You cannot preview this clip as it has been created on a video from a different region. You have been redirected to the edit details page."),v.trigger({application:C.CLIPS,action:n.Clips.EDIT_CLIP_DETAILS,args:[a.id]},{replace:!0}))},[i.hasError]),!t.data||!r.data||!i.hasCompleted?e.jsx("div",{className:"text-center py-5",children:e.jsx(b,{as:"div",animation:"border"})}):i.hasError?e.jsx(e.Fragment,{}):e.jsxs("div",{children:[!!r.data&&e.jsx(E,{clipId:a.id,activeAction:n.Clips.PREVIEW_CLIP,currentUser:r.data}),t.data.status===d.Published&&e.jsxs(l,{variant:"info",className:"mt-3 mb-1",children:["This clip is ",e.jsx("strong",{children:"published"})," and cannot be edited or deleted. You may archive it if you believe it should no longer be in use."]}),t.data.status===d.Archived&&e.jsxs(l,{variant:"info",className:"mt-3 mb-1",children:["This clip is ",e.jsx("strong",{children:"archived"}),". You may publish it again from the options menu."]}),e.jsxs("div",{className:`${c?"":"d-none"}`,children:[e.jsx(w,{object:{name:t.data.name,status:t.data.status},actions:R.getClipActions(t.data,u.data),actionsDropdownClassName:"btn btn-outline-dark",showStatus:!0}),e.jsx(A,{viewKey:i.data.viewKey,playerApi:new URL(ClickView.Config.Urls.PlayerApi),hotkeyElQuerySelector:"body",onReady:()=>p(!0),eventLogging:!1})]})]})}export{J as PreviewClipView};
//# sourceMappingURL=DAm0-8Nw.chunk.js.map
