import{A as b,J as g,o as S,S as C,ai as h,R as y,e as R,bo as _,f as j,aS as H,g as k}from"./app-BgLa5dit.js";import{P as B}from"./CY0zrGLk.chunk.js";const L=s=>`assembly_line_presentation_id_${s}`;function F(s={},A,u,n,d){var p;let{presentationId:r}=s;(p=b[d])!=null&&p.presentationId&&(r=b[d].presentationId);const f=g.get(L(n)),a=S(C.presentations(h.Subject)),t=S(B.streamablePresentation());y.useEffect(()=>{if(s.presentationId||!a.hasCompleted||!t.hasCompleted)return;if(f){o(f);return}if(n==="streamable"){o(t.data.id);return}if(R.canViewAllPresentations(u))return;const e=a.data.find(l=>l.status===_.Published);o(e.id)},[a.hasCompleted,t.hasCompleted]);function o(e){var P;g.set(L(n),e);const l=j.getCurrentRoute().appLink;let c=l.params;((P=c.presentationId)==null?void 0:P.toString())!==(e==null?void 0:e.toString())&&(A!=="video"&&(c=H.omit(c,["cursor"])),k.trigger({...l,params:{...c,presentationId:e}},{replace:!0}))}const i=n==="streamable"?[t.data].filter(Boolean):[...a.data||[],u!=="topic_seo"?t.data:null].filter(Boolean),m=t.data&&a.data;return{selectedPresentation:m&&(i==null?void 0:i.find(e=>e.id.toString()===(r==null?void 0:r.toString()))),setPresentation:o,isLoading:!m,presentations:i}}export{L as g,F as u};
//# sourceMappingURL=Brw8lpR5.chunk.js.map
