import{o as s,s as h,k as x,S as d,j as e,h as p,ar as O,w as u}from"./app-BgLa5dit.js";import{O as k}from"./B-fq6xxv.chunk.js";import{S as V}from"./CJf3ETiT.chunk.js";import{P as E}from"./CY0zrGLk.chunk.js";import{S as g}from"./AvyxFUsd.chunk.js";function R(t){const m=s(h.video(t.videoId)),o=x(),r=s(d.getObjectAudiences(t.videoId)),b=s(d.getObjectBackboneAudiences(t.videoId)),n=s(E.streamablePresentation()),c=s(n.data&&d.presentationAudiences(n.data.id));async function l(i,v){const j=i.reduce((a,f)=>({...a,[f]:!0}),{}),I=c.data.filter(a=>j[a.masterId]),S=u.uniq(u.flatten(I.map(a=>a.backboneAudienceIds)));await o(d.updateObjectBackboneAudiences(t.videoId,S)),await o(d.updateObjectAudience(t.videoId,i,n.data.id)),v()}const A=r.hasCompleted&&b.hasCompleted&&c.hasCompleted;return e.jsxs(e.Fragment,{children:[e.jsx(V,{videoId:t.videoId,activeAction:p.StreamableLearning.EDIT_VIDEO_AUDIENCES}),e.jsx(k,{object:m.data}),A?e.jsx(g,{initialValues:{audienceIds:r.data.map(i=>i.masterId)},saveAudiences:l,audiences:c.data}):e.jsx("div",{className:"text-center p-5",children:e.jsx(O,{as:"div",animation:"border",role:"status"})})]})}export{R as StreamableVideoAudiencesView};
//# sourceMappingURL=BlbPAMnM.chunk.js.map
