import{dm as U,dl as s,a8 as l,a7 as g,d as y,dn as L,j as n,ar as N,Y as w,cD as I,dp as d,e7 as h}from"./app-BgLa5dit.js";import{F as A}from"./B5-QmNlz.chunk.js";import{E as H}from"./CPYC3VpT.chunk.js";import{M as D}from"./CJkmdwb7.chunk.js";function F(e,a){let i="";switch(a){case s.Videos:i=`/videos/${e.id}/${l.slugify(e.name)}`;break;case s.Playlists:i=`/playlists/${e.id}/${l.slugify(e.name)}`;break;case s.Series:i=`/series/${e.id}/${l.slugify(e.name)}`;break;case s.Clips:i=`/clips/${e.id}/${l.slugify(e.name)}`;break;case s.Interactives:i=`/interactive/${e.id}/${l.slugify(e.name)}`;break}return g.safeUrlConcat(ClickView.Config.Urls.LiteUrl,i)}function B(e){var a;return(a=e.series)!=null&&a.id?g.safeUrlConcat(ClickView.Config.Urls.LiteUrl,`/series/${e.series.id}/${l.slugify(e.series.name)}`):""}function P(e){return(e==null?void 0:e.replace(/[,#]/g,""))??""}const q={exportMembers(e,a,i){const c=U.singularizeMemberType(a),o=[`${c} id`,`${c} name`,`${c} link`];a===s.Videos&&o.push("Series link");const u=[o];e.forEach(r=>{const t=[];t.push(r.id),t.push(P(r.name)),t.push(F(r,a)),a===s.Videos&&t.push(B(r)),u.push(t)}),A.downloadCsvArray(u,`${i}_${a}.csv`)}};function R(e){if(e===s.Videos)return d.ClassificationVideos;if(e===s.Series)return d.ClassificationSeries;if(e===s.Playlists)return d.ClassificationPlaylists;if(e===s.Clips)return d.ClassificationClips;if(e===s.Interactives)return d.ClassificationInteractives}function G(e){return e===s.Videos?[h.Video,h.Series]:[]}function J(e){const{classificationId:a,memberType:i,presentation:c,classification:o,audiences:u,visibleVideos:r,items:t,isFetching:k,hasMore:M,nextCursor:$,fetchNext:v,columnActions:S,appLinks:m,getTabs:b,onExport:C,bulkRemoveAppLink:p}=e,f=y(t||[]),V=L.getColumnSet(R(i)),j={actions:S,appLinks:m,extraData:{allAudiences:u,visibleVideos:r,pinnedVideoId:o==null?void 0:o.pinnedVideoMasterId,checkboxManager:f}},E=i===s.Videos?!!t&&!!r:!!t,x=!!p&&f.hasSomeSelections();return n.jsxs(n.Fragment,{children:[n.jsx(H,{memberType:i,presentation:c,classificationId:a,getTabs:b}),E?n.jsx(D,{members:t,columns:V,columnData:j,columnGroups:G(i),emptyStateText:`No ${i} in this topic.`,isFetching:k,fetchNext:v,nextCursor:$,hasMoreMembers:M,children:n.jsxs("div",{className:"ms-auto",children:[p&&n.jsx(w,{className:`btn btn-outline-danger me-3 ${x?"":"disabled"}`,appLink:p(a,i,f.getSelected()),disabled:!x,children:"Bulk remove videos"}),C&&n.jsx(I,{variant:"outline-dark",onClick:()=>C(t),children:"Export table"})]})}):n.jsx("div",{className:"text-center p-5",children:n.jsx(N,{as:"div",animation:"border",role:"status"})})]})}export{q as C,J as E};
//# sourceMappingURL=7ILDX1zd.chunk.js.map
