import{dk as x,R as I,o as a,S as o,ai as T,j as n,h,dl as O,aR as U}from"./app-BgLa5dit.js";import{O as k}from"./B-fq6xxv.chunk.js";import{A as c}from"./BGBqNFqg.chunk.js";import{E as L}from"./DAIT4p5u.chunk.js";import{E as q}from"./KB6Isaz1.chunk.js";import"./BfMtaC_g.chunk.js";import"./AvyxFUsd.chunk.js";function w(i){var m,A;const u=x(),[e,v]=I.useState(),b=a(U.currentUser()),f=a(c.backboneAudience(i.interactiveId)),p=a(c.audiences(i.interactiveId)),r=a(o.member(i.interactiveId)),d=a(o.presentations(T.Subject)),E=a(c.backboneAudiences()),l=a((e==null?void 0:e.id)&&o.presentationAudiences(e.id));I.useEffect(()=>{var s,t;!e&&((t=(s=d.data)==null?void 0:s[0])!=null&&t.id)&&v(d.data[0])},[(A=(m=d.data)==null?void 0:m[0])==null?void 0:A.id]);function R(s,t){u(c.updateObjectAudiences(i.interactiveId,e.id,s,t,t))}function S(s,t,j){u(c.updateObjectLevels(i.interactiveId,s,t,j,j))}return n.jsxs(n.Fragment,{children:[!!(b.data&&r.data)&&n.jsx(L,{interactive:r.data,activeAction:h.Interactives.EDIT_INTERACTIVE_AUDIENCES,currentUser:b.data}),n.jsx(k,{object:r.data}),n.jsx(q,{objectLevels:f.data,objectAudiences:p.data,presentations:d.data,currentPresentation:e,setCurrentPresentation:v,levels:E.data,presentationAudiences:l.data,memberType:O.Interactives,saveAudiences:R,saveLevels:S})]})}export{w as EditInteractiveAudiencesView};
//# sourceMappingURL=Drg-gBhs.chunk.js.map
