import{aT as o,o as s,aU as w,aV as k,k as b,l as S,j as E,aO as d,aW as y,aX as A,ag as P,aY as p,aZ as R,aJ as O,g as U,h as B,i as F,aR as x}from"./app-BgLa5dit.js";import{C as V}from"./B6YXg1_D.chunk.js";import{I as j}from"./DTRakM4e.chunk.js";function N(t){const[u,n]=o.useState(!1),[a,l]=o.useState(null),i=s(x.currentUser()),e=s(w.getObject(t.parentId)),r=s(k.curationTags()),c=b(),m=S();async function g(){n(!0);try{const I=r.data.find(v=>v.name===y.CLICKVIEW_CURATED),f={name:e.data.name,duration:A.isType(e.data,P.Clip)?(e.data.endTime-e.data.startTime)*1e3:e.data.duration,immediateFeedback:(a==null?void 0:a.id)==="feedback",preventScrubbing:!1},T=await c(p.createInteractive(t.parentId,f)),h=await c(p.createInteractiveMetadata(t.parentId,{name:e.data.name,interactiveId:T.id,owner:{id:i.data.id},originType:j.Original,status:O.Draft,permissions:R.getProtectedReadPermission(),tags:[{id:I.id}]}));U.trigger({application:F.INTERACTIVES,action:B.Interactives.EDIT_INTERACTIVE,args:[h.id]}),t.closePopup()}catch{n(!1),m.error("Something went wrong")}}const C=[{id:"feedback",title:"Instant feedback",description:"Students instantly see the correct answer and the teacher's suggested responses.",imageUrl:d.Interactives.FeedbackOptions.FEEDBACK},{id:"no-feedback",title:"Classic quiz",description:"Students will not see the correct answer. Staff may review and provide feedback after completion.",imageUrl:d.Interactives.FeedbackOptions.NO_FEEDBACK}];return E.jsx(V,{title:"Create interactive video",closePopup:t.closePopup,options:C,selectOption:l,selection:a,showLoadingSpinner:!e.data||!i.data||!r.data,cancelButtonProps:{onClick:t.closePopup},submitButtonProps:{onClick:g,text:"Continue",variant:"dark",showSpinner:u,disabled:!a}})}export{N as NewInteractiveView};
//# sourceMappingURL=BaWAON7l.chunk.js.map
