(function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode(".activity[data-v-7e59872d]{display:flex;flex-direction:column;overflow:hidden;height:100%}.activity__actions[data-v-7e59872d]{display:flex;flex-direction:column;width:100%}.activity__list[data-v-7e59872d]{flex-grow:1;overflow:scroll}.activity__empty-content[data-v-7e59872d]{height:100%}[data-v-7e59872d] .empty-content__icon span{background-size:64px;width:64px;height:64px}")),document.head.appendChild(e)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}})();
import{c as r,a as c,f as l,g as u,v}from"./NcCheckboxRadioSwitch-VeztTzpz-Czz9vtPv.chunk.mjs";import{d as f,r as p,o as d,g as y,f as g,t as n}from"./translation-CD_FiYBO-Dm5ZmTPn.chunk.mjs";import{a as m,N as h,b as _}from"./Activity-BFfMM_ab.chunk.mjs";import{g as o,a as b,b as I}from"./api-kHrAWUTr.chunk.mjs";import{l as A}from"./logger-CawX0p3n.chunk.mjs";import{l as S}from"./activity-sidebar.mjs";import"./_commonjsHelpers-D9DevfhH.chunk.mjs";import"./preload-helper-DPcAka6r.chunk.mjs";const P=f({__name:"ActivitySidebarPlugin",props:{plugin:null,fileInfo:null},emits:["reload-activities"],setup(t,{emit:i}){const s=t,a=p();return d(()=>s.plugin.mount(a.value,{context:y()?.proxy,fileInfo:s.fileInfo,reload:()=>i("reload-activities")})),g(()=>s.plugin.unmount()),{__sfc:!0,props:s,emit:i,attachTarget:a}}});var x=function(){var t=this,i=t._self._c;return t._self._setupProxy,i("div",{ref:"attachTarget"})},C=[],N=r(P,x,C,!1,null,null);const w=N.exports,k={name:"ActivityTab",components:{Activity:m,NcEmptyContent:h,NcIconSvgWrapper:c,NcLoadingIcon:l,ActivitySidebarPlugin:w},data(){return{error:"",loading:!0,fileInfo:null,activities:[],lightningBoltSVG:S,sidebarPlugins:[]}},mounted(){this.sidebarPlugins=o()},methods:{async update(t){this.sidebarPlugins=[];let i=o();i.length>0&&this.$nextTick(()=>{this.sidebarPlugins=i}),this.fileInfo=t,this.resetState(),await this.getActivities()},async getActivities(){try{this.loading=!0;const t=await this.processActivities(await this.loadRealActivities()),i=await b({fileInfo:this.fileInfo});this.activities=[...t,...i].sort((s,a)=>a.timestamp-s.timestamp)}catch(t){this.error=n("activity","Unable to load the activity list"),console.error("Error loading the activity list",t)}finally{this.loading=!1}},resetState(){this.loading=!0,this.error="",this.activities=[]},async loadRealActivities(){try{const{data:t}=await u.get(v("apps/activity/api/v2/activity/filter"),{params:{format:"json",object_type:"files",object_id:this.fileInfo.id}});return t.ocs.data}catch(t){if(t.response!==void 0&&t.response.status===304)return[];throw e}},processActivities(t){t=t.map(s=>new _(s)),A.debug(`Processed ${t.length} activity(ies)`,{activities:t,fileInfo:this.fileInfo});const i=I();return t.filter(s=>!i||i.every(a=>a(s)))},t:n}};var E=function(){var t=this,i=t._self._c;return i("div",{staticClass:"activity",class:{"icon-loading":t.loading}},[t.error?i("NcEmptyContent",{attrs:{name:t.error},scopedSlots:t._u([{key:"icon",fn:function(){return[i("NcIconSvgWrapper",{attrs:{svg:t.lightningBoltSVG}})]},proxy:!0}],null,!1,63559581)}):[t.sidebarPlugins.length>0?i("div",{staticClass:"activity__actions"},t._l(t.sidebarPlugins,function(s,a){return i("ActivitySidebarPlugin",{key:a,attrs:{plugin:s,"file-info":t.fileInfo},on:{"reload-activities":function(L){return t.getActivities()}}})}),1):t._e(),t.loading?i("NcEmptyContent",{staticClass:"activity__empty-content",attrs:{name:t.t("activity","Loading activities")},scopedSlots:t._u([{key:"icon",fn:function(){return[i("NcLoadingIcon")]},proxy:!0}],null,!1,3085876643)}):t.activities.length===0?i("NcEmptyContent",{staticClass:"activity__empty-content",attrs:{name:t.t("activity","No activity yet")},scopedSlots:t._u([{key:"icon",fn:function(){return[i("span",{staticClass:"icon-activity"})]},proxy:!0}])}):i("ul",{staticClass:"activity__list"},t._l(t.activities,function(s){return i("Activity",{key:s.id,attrs:{activity:s,"show-previews":!1},on:{reload:function(a){return t.getActivities()}}})}),1)]],2)},T=[],j=r(k,E,T,!1,null,"7e59872d");const q=j.exports;export{q as default};
//# sourceMappingURL=ActivityTab-BCjAneVi.chunk.mjs.map
