import{ao as t,ak as P,m as O,o as q,E as I,r as R,ch as v,W as _,p as D,L as w,c4 as $,bc as Q,az as u,aj as W,aJ as z,bK as J,h as c,aX as K,aZ as X,gb as V,bN as Z,bO as G,bP as B,fp as tt}from"./app-k0jcl5PQ.js";import{P as et,B as at}from"./CCtuxSlD.chunk.js";import{P as st,V as ot,a as it}from"./DH1mz64H.chunk.js";import{u as nt}from"./CtFw3Moj.chunk.js";import{u as rt,V as ct}from"./BUtU6IOA.chunk.js";import{u as pt}from"./DDxzgH2W.chunk.js";import{u as lt}from"./DgW9Cwsn.chunk.js";import{u as dt}from"./4IZETxJX.chunk.js";import{g as mt,C as ut}from"./CCWaW_Jq.chunk.js";import"./CPXlV0fg.chunk.js";import"./BlKMjFEf.chunk.js";import"./CofWDDSQ.chunk.js";import"./DwvfEevL.chunk.js";import"./D9SGbB34.chunk.js";import"./BwBaQklX.chunk.js";import"./ByBCp1MC.chunk.js";import"./BhYYYlpK.chunk.js";import"./FGhEvk_q.chunk.js";import"./WCBjpMHJ.chunk.js";import"./DoFMWlew.chunk.js";import"./CMnqIsoM.chunk.js";import"./eerUhItV.chunk.js";import"./Cukd0Qmt.chunk.js";import"./B31bqZwo.chunk.js";import"./uoUaCILN.chunk.js";import"./f_twTV5Z.chunk.js";import"./BDeUEvb2.chunk.js";import"./Daim1zo7.chunk.js";import"./B3XH0kWB.chunk.js";import"./BRhv_AHY.chunk.js";import"./BDviDDog.chunk.js";import"./wCY37Ze3.chunk.js";import"./CIN5bTKK.chunk.js";import"./DAIetGMf.chunk.js";import"./TReHo2Ua.chunk.js";import"./Bj7bJt_4.chunk.js";import"./CGYNvpr2.chunk.js";import"./U4M4wGTR.chunk.js";import"./Bw9otuBi.chunk.js";import"./BvnABNse.chunk.js";import"./Bh7bFXwG.chunk.js";import"./DCdUbbLx.chunk.js";import"./t24_x3Gi.chunk.js";import"./BAuuQuuB.chunk.js";import"./t2c-sXnZ.chunk.js";const ft="_partialBanner_1x013_1",gt={partialBanner:ft};function bt(){return t.jsxs("div",{className:"bg-white px-3",children:[t.jsx("div",{className:`partial-loading-background mb-2 ${gt.partialBanner} rounded`}),t.jsx("div",{className:"mb-1",children:t.jsx(et,{})}),t.jsx(st,{})]})}const F="contentUpdates.classificationUpdate",ht=w.encloseNamespace(F);function Pt(o){const{dispatch:p,alerts:l,setShowFollowSpinner:i}=o;function f(e,d,n){i(!0);const m=()=>{i(!1),q.logUserAction({id:e,name:d},{location:D.ContentUpdatesClassificationBanner,workflowPhase:_.Complete,descriptor:n?v.On:v.Off,actionType:R.Follow,entity:I.Classification}),l.success(ht(n?"followed":"unfollowed",{name:d,escapeText:!0}))},a=()=>{i(!1),l.error(w.getPhrase(F,"error"))},g=n?P.followSubjects([e],m,a):P.unfollowSubjects([e],m,a);O(p,g)}return{onFollow:f}}const wt="contentUpdates.classificationUpdate",xt=w.encloseNamespace(wt);function ue(o){var j,A,L,k,U;const{classificationId:p}=o,l=$(),i=Q(),{commonVideoProps:f}=pt({locationContext:D.VideoThumbnail}),e=u(W.currentUser()),[d,n]=z.useState(!1),{availablePresentations:m}=J(),a=mt(o.presentationSlug,m),g=Pt({dispatch:l,alerts:i,setShowFollowSpinner:n,currentUser:e==null?void 0:e.data}),x=new Date,y=c.format(c.endOf(c.subtract(x,6,"month"),"day"),"YYYY-MM-DD"),M=c.format(c.endOf(x,"day"),"YYYY-MM-DD"),{hasPermissions:C}=K(),b=C(X.FollowSubjects),s=u(V.getClassification(p)),h=u(e.data&&V.getClassificationUpdates(p,y,M)),S=u(b&&P.mySubjectPreferences()),Y=lt(),N=nt({name:(j=s.data)==null?void 0:j.name});Z(G.getDefaultMetadata({title:(A=s.data)==null?void 0:A.name,phraseContext:{phraseHandler:xt,titlePhrase:"pageTitle",descriptionPhrase:"pageDescription"},canonicalLink:B.getCanonicalLink({customAppLink:a==null?void 0:a.getClassificationUpdateAppLink(s.data)}),allowIndexing:B.allowIndexing()}));const H=rt({location:ct.VideoItem,presentationSlug:o.presentationSlug});dt(((L=h.data)==null?void 0:L.videos)??[]);const T=S.hasCompleted||!b;if(!(h.data&&s.data&&T&&e.data))return t.jsx(bt,{});const E=((k=S.data)==null?void 0:k.map(r=>r.id))??[];return t.jsx(ot.Provider,{value:H,children:t.jsxs("div",{className:"bg-white px-3",children:[t.jsx(ut,{classification:s.data,backgroundUrl:((U=s.data.banner)==null?void 0:U.url)??"",getClassificationAppLink:a.getClassificationAppLink,followed:!!E.find(r=>r.toString()===s.data.id.toString()),follow:g.onFollow,showFollowSpinner:d,canFollow:b}),t.jsx(at,{breadcrumbs:N}),t.jsx(it,{videos:h.data.videos,getVideoAppLink:a.getVideoAppLink,hasPermissions:C,presentationAudiences:Y.data,getPreviewQuestionsAppLink:r=>tt.getPreviewQuestionsAppLink(r),commonVideoProps:f})]})})}export{ue as ClassificationUpdateView};
//# sourceMappingURL=Dy6ajiy4.chunk.js.map
