import{l as w,aD as B,d_ as G,R as A,d$ as C,dl as o,w as U,dk as v,j as q,fd as z,h as m,i as u,e7 as r,ai as J,fb as X,dm as p,S as f,e0 as M}from"./app-BgLa5dit.js";import{u as K}from"./ekVIVtrT.chunk.js";import{u as Q}from"./8Im-OACs.chunk.js";import{E as W,C as Y}from"./7ILDX1zd.chunk.js";import{g as Z}from"./DPqnN5u1.chunk.js";import"./g56uS58q.chunk.js";import"./B5-QmNlz.chunk.js";import"./CPYC3VpT.chunk.js";import"./CJkmdwb7.chunk.js";import"./CTg_3F42.chunk.js";const j=Z(J.StreamableLearning),ee={[r.Video]:s=>j.video(s.id),[r.Series]:s=>({application:u.SERIES,action:m.Series.EDIT_SERIES,args:[s.id]}),[`${r.Video}:${r.Audience}`]:s=>j.videoAudiences(s.id),[`${r.Series}:${r.Audience}`]:s=>({application:u.SERIES,action:m.Series.EDIT_SERIES_AUDIENCES,args:[s==null?void 0:s.id]}),library:(s,n)=>({application:u.STREAMABLE_LEARNING,action:n==="exchange"?m.Libraries.EXCHANGE:m.Libraries.HOSTED_LIBRARIES,args:[s]})};function ie(s,n,t){const l=v();function b(d){return f.classificationMembers(s,n,t,d)}function S(d){l(b(d))}return K(b,S).items}function ue(s){const{presentationId:n,classificationId:t}=s,l=w(),b=B(G.SUBJECT),[S,d]=A.useState(),[c,y]=A.useState(),[L,N]=A.useState();C(M.getPresentationFetchOptions(n,d),[]),C(M.getClassificationFetchOptions(t,y),[t]),C(M.getAudiencesFetchOptions(n,N),[t]);const g=ie(t,o.PinnedVideos,n),T=g?U.toObject(g,"id"):{};function V(e){return f.classificationMembers(t,o.Videos,n,e)}const E=v();function I(e){E(V(e))}const{items:x,isFetching:F,hasMore:O,nextCursor:$}=Q(V,I);function D(e){const i={...c,pinnedVideoMasterId:e};b.updateClassification(t,i)}function h(e){const i=p.singularizeMemberType(o.Videos),a=e==="add"?`Successfully added ${i} to topic`:`Successfully removed ${i} from topic`;l.success(a)}function R(e){const i=p.singularizeMemberType(o.Videos),a=e==="add"?`Failed to add ${i} to topic`:`Failed to remove ${i} from topic`;l.error(a)}function P(e,i){E(f.addObjectsToClassification(c.id,[e],i,()=>h("add"),()=>R("add")))}function _(e,i){E(f.removeObjectsFromClassification(c.id,[e],i,()=>h("remove"),()=>R("remove")))}function k(e){const i={application:u.STREAMABLE_LEARNING,action:m.StreamableLearning,subjectId:t,ownerType:X.Classification,memberType:o.Videos,memberId:e.id},a=T[e.id];return[p.buildMemberAction({actionName:"pinVideo",callback:()=>D(e.id),...i}),p.buildMemberAction({actionName:a?"hideInClassification":"showInClassification",callback:()=>a?_(e.id,o.PinnedVideos):P(e.id,o.PinnedVideos),...i}),p.buildMemberAction({actionName:"remove",...i})]}function H(e){Y.exportMembers(e,o.Videos,c==null?void 0:c.name)}return q.jsx(W,{classificationId:t,memberType:o.Videos,presentation:S,classification:c,audiences:L,visibleVideos:T,items:x,isFetching:F,hasMore:O,nextCursor:$,fetchNext:I,columnActions:k,appLinks:ee,getTabs:(e,i,a)=>z.getEditClassificationTabs(u.STREAMABLE_LEARNING,e,i,a),onExport:H})}export{ue as EditSLClassificationVideosView};
//# sourceMappingURL=BVQOXjID.chunk.js.map
