()=>!0})],c.prototype,"updateFunction",2),u([h({default:()=>Me})],c.prototype,"getGridGap",2),u([h({default:()=>Pe})],c.prototype,"getColumnCount",2),u([h({default:()=>We})],c.prototype,"getWindowMargin",2),u([h({default:()=>Te})],c.prototype,"getItemRatioHeight",2),u([h({default:null})],c.prototype,"scrollElement",2),u([h({default:500})],c.prototype,"updateTriggerMargin",2),u([h({default:null})],c.prototype,"loader",2),u([h({default:!1})],c.prototype,"debug",2),u([b()],c.prototype,"updateLock",2),u([b()],c.prototype,"bottomReached",2),u([b()],c.prototype,"ref",2),u([b()],c.prototype,"containerData",2),u([ze("scrollElement")],c.prototype,"onScrollElementChanged",1),c=u([Y({name:"VirtualGrid"})],c);var Ie=function(){var e=this,t=e.$createElement,r=e._self._c||t;return r("div",{ref:"virtualGrid",style:{boxSizing:"border-box",height:e.layoutData.totalHeight+"px",paddingTop:e.renderData!==null&&e.renderData.firstRenderedRowOffset!==null?e.renderData.firstRenderedRowOffset+"px":"0px"}},[r("div",{staticClass:"grid",style:{display:"-ms-grid",display:"grid","align-items":"center","grid-template-columns":"repeat("+e.configData.columnCount+", 1fr)",gap:e.configData.gridGap+"px"}},e._l(e.renderData.cellsToRender,function(i){return r("div",{key:i.id,staticClass:"grid-item-wrapper",style:{height:i.height+"px","grid-column-start":i.columnNumber,"grid-column-end":i.columnNumber+i.columnSpan,"grid-row-start":e.getGridRowStart(i,e.renderData)}},[r(i.renderComponent,e._g({tag:"component",attrs:{item:i}},e.$listeners))],1)}),0),r(e.loadingBatch&&e.loader,{tag:"component"})],1)},Ae=[];function Ge(e,t,r,i,o,s,l,n){var a=typeof e=="function"?e.options:e;t&&(a.render=t,a.staticRenderFns=r,a._compiled=!0);var d;if(o&&(d=o),d)if(a.functional){a._injectStyles=d;var g=a.render;a.render=function(p,m){return d.call(m),g(p,m)}}else{var f=a.beforeCreate;a.beforeCreate=f?[].concat(f,d):[d]}return{exports:e,options:a}}const U={};var Ue=Ge(c,Ie,Ae,!1,He);function He(e){for(let t in U)this[t]=U[t]}var Ve=function(){return Ue.exports}();const qe={name:"FileLegacy",inheritAttrs:!1,props:{item:{type:Object,required:!0}},data(){return{loaded:!1,error:!1}},computed:{ariaUuid(){return`image-${this.item.injected.fileid}`},ariaLabel(){return v("photos",'Open the full size "{name}" image',{name:this.item.injected.basename})},isImage(){return this.item.injected.mime.startsWith("image")},decodedEtag(){return this.item.injected.etag.replace(""","").replace(""","")},src(){return x(`/core/preview?fileId=${this.item.injected.fileid}&c=${this.decodedEtag}&x=250&y=250&forceIcon=0&a=${this.croppedLayout?"0":"1"}`)},croppedLayout(){return this.$store.state.userConfig.croppedLayout}},beforeDestroy(){this.$refs.src=""},methods:{openViewer(){window.OCA.Viewer.open({fileInfo:W(this.item.injected),list:this.item.injected.list.map(e=>W(e))})},onLoad(){this.loaded=!0},onError(){this.error=!0},t:v}};var Be=function(){var e=this,t=e._self._c;return t("a",{staticClass:"file",class:{"file--cropped":e.croppedLayout},attrs:{href:e.item.injected.source,"aria-label":e.ariaLabel},on:{click:function(r){return r.preventDefault(),e.openViewer.apply(null,arguments)}}},[e.item.injected.mime.includes("video")&&e.item.injected.hasPreview?t("div",{staticClass:"icon-video-white"}):e._e(),t("transition-group",{staticClass:"transition-group",attrs:{name:"fade"}},[e.error?e._e():t("img",{key:`${e.item.injected.basename}-img`,ref:"img",attrs:{src:e.src,alt:e.item.injected.basename,"aria-describedby":e.ariaUuid},on:{load:e.onLoad,error:e.onError}}),!e.loaded||e.error?t("svg",{key:`${e.item.injected.basename}-svg`,attrs:{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",fill:"url(#placeholder__gradient)"}},[e.isImage?t("use",{attrs:{href:"#placeholder--img"}}):t("use",{attrs:{href:"#placeholder--video"}})]):e._e()]),t("p",{staticClass:"hidden-visually",attrs:{id:e.ariaUuid}},[e._v(e._s(e.item.injected.basename))]),t("div",{staticClass:"cover",attrs:{role:"none"}})],1)},Ke=[],Ye=R(qe,Be,Ke,!1,null,"6f079611");const Je=Ye.exports,Qe={name:"FolderTagPreview",components:{FolderOutline:B,RouterLink:se},props:{name:{type:String,required:!0},path:{type:String,default:""},fileList:{type:Array,default:()=>[]}},data(){return{failed:[]}},computed:{isEmpty(){return this.previewList.length===0},ariaLabel(){return v("photos",'Open the "{name}" folder',{name:this.name})},previewList(){return this.fileList.filter(e=>this.failed.indexOf(e.fileid)===-1)},previewUrl(){if(this.previewList.length===0)return null;const{fileid:e,etag:t}=this.previewList.at(-1);return x(`/core/preview?fileId=${e}&c=${t}&x=250&y=250&forceIcon=0&a=0`)},toLink(){const e=`/files/${H()?.uid}`;let t=this.path.replace(new RegExp(`^${e}`),"");return t=/^\/?(.+)/i.exec(t)[1],{...this.$route,params:{path:t.split("/")}}}},methods:{onPreviewFail({fileid:e}){this.failed.push(e)},t:v}};var Xe=function(){var e=this,t=e._self._c;return t("RouterLink",{staticClass:"folder",attrs:{to:e.toLink,"aria-label":e.ariaLabel}},[e.previewUrl?t("img",{staticClass:"folder__image",attrs:{src:e.previewUrl,alt:""},on:{error:function(r){return e.onPreviewFail(e.file)}}}):t("span",{staticClass:"folder__image folder__image--placeholder"},[t("FolderOutline",{staticClass:"folder__icon",attrs:{size:96,"fill-color":"var(--color-primary-element)"}})],1),t("span",{staticClass:"folder__details"},[t("FolderOutline"),t("span",{staticClass:"folder__title"},[e._v(e._s(e.name))])],1)])},Ze=[],et=R(Qe,Xe,Ze,!1,null,"0660a5ac");const tt=et.exports;async function J(e="/",t={}){const r=x(`/apps/photos/api/v1/${t.shared?"shared":"albums"}`),i=(await ne.get(r+e,t)).data.map(n=>({...n,filename:`${w}${n.filename}`,source:decodeURI(Z+`${w}${n.filename}`)}));let o;const s=[],l=[];for(const n of i)n.filename===`${w}${e}`?o=n:n.type!=="file"?s.push(n):q.indexOf(n.mime)>-1&&l.push(n);return{folder:o,folders:s,files:l}}const rt=V({name:"FolderComponent",components:{FolderTagPreview:tt},mixins:[K],inheritAttrs:!1,props:{item:{type:Object,required:!0}},data(){return{previewFolder:this.item.injected.fileid}},computed:{files(){return this.$store.state.folders.files},subFolders(){return this.$store.state.folders.subFolders},folders(){return this.$store.state.folders.folders},folderContent(){return this.folders[this.item.injected.fileid]},previewFiles(){const e=this.folders[this.previewFolder],t=e?e.map(r=>this.files[r]).slice(0,4):[];if(t.length===0&&this.subFolders[this.previewFolder]&&this.previewFolder===this.item.injected.fileid){const r=this.subFolders[this.previewFolder][0];this.updatePreviewFolder(r),this.folders[this.previewFolder]||this.getFolderData(this.files[this.previewFolder].filename)}return t}},async created(){this.folderContent||await this.getFolderData(this.item.injected.filename)},methods:{async getFolderData(e){try{const t=`/files/${H()?.uid}`,r=e.replace(new RegExp(`^${t}`),""),{folder:i,folders:o,files:s}=await J(r,{shared:this.item.injected.showShared,signal:this.abortController.signal});this.$store.dispatch("updateFolders",{fileid:i?.fileid,files:s,folders:o}),this.$store.dispatch("updateFoldersFiles",{folder:i,files:s,folders:o})}catch(t){j.error("Failed to get folder content",{error:t,filename:e})}},updatePreviewFolder(e){this.previewFolder=e}}});var it=function(){var e=this,t=e._self._c;return e._self._setupProxy,t("FolderTagPreview",{attrs:{id:e.item.injected.fileid,name:e.item.injected.basename.toString(),path:e.item.injected.filename,"file-list":e.previewFiles}})},ot=[],nt=R(rt,it,ot,!1,null,"d58b828a");const at=nt.exports,C={400:{marginTop:66,marginW:8,count:3,folderCount:1},700:{marginTop:66,marginW:8,count:4,folderCount:1},1024:{marginTop:66,marginW:44,count:5,folderCount:2},1280:{marginTop:66,marginW:44,count:4,folderCount:2},1440:{marginTop:88,marginW:66,count:5,folderCount:3},1600:{marginTop:88,marginW:66,count:6,folderCount:4},2048:{marginTop:88,marginW:66,count:7,folderCount:4},2560:{marginTop:88,marginW:88,count:8,folderCount:6},3440:{marginTop:88,marginW:88,count:9,folderCount:8},max:{marginTop:88,marginW:88,count:10,folderCount:10}},O=new F({data(){return{gridConfig:C.max}},watch:{gridConfig(e){this.$emit("changed",e)}},created(){window.addEventListener("resize",this.handleWindowResize),this.handleWindowResize()},beforeDestroy(){window.removeEventListener("resize",this.handleWindowResize)},methods:{handleWindowResize(){const e=Object.keys(C).map(t=>Number.parseInt(t)).find(t=>t>document.documentElement.clientWidth);this.gridConfig=C[e]||C.max}}}),st=V({data(){return{gridConfig:{}}},created(){O.$on("changed",this.handleGridConfigChange),j.debug("Grid config",{gridConfig:O.gridConfig}),this.gridConfig=O.gridConfig},beforeDestroy(){O.$off("changed",this.handleGridConfigChange)},methods:{handleGridConfigChange(e){this.gridConfig=e}}}),lt={name:"FoldersView",components:{FolderOutline:B,HeaderNavigation:le,NcEmptyContent:oe,NcLoadingIcon:ae,UploadPicker:re,VirtualGrid:Ve},mixins:[K,st],props:{rootTitle:{type:String,required:!0},path:{type:String,default:"/"},showShared:{type:Boolean,default:!1}},data(){return{error:null,allowedMimes:q,initializing:!0,loading:!1,appContent:document.getElementById("app-content-vue"),uploader:ie()}},computed:{files(){return this.$store.state.folders.files},folders(){return this.$store.state.folders.folders},folderId(){return this.$store.state.folders.paths[this.path]},folder(){return this.files[this.folderId]},folderAsFolder(){if(this.folder)return new ee({...this.folder,permissions:te(this.folder.permissions),owner:null})},folderContent(){return this.folders[this.folderId]||[]},fileList(){return this.folderContent&&this.folderContent.map(e=>this.files[e]).filter(e=>!!e)},subFolders(){return this.folderId&&this.files[this.folderId]&&this.$store.state.folders.subFolders[this.folderId]},folderList(){return this.subFolders&&this.subFolders.map(e=>this.files[e]).filter(e=>!!e)},contentList(){const e=this.folderList&&this.folderList.map(r=>({id:`folder-${r.fileid}`,injected:{...r,showShared:this.showShared},width:232,height:280,columnSpan:1,renderComponent:at})),t=this.fileList?.map(r=>({id:`file-${r.fileid}`,injected:{...r,list:this.fileList},width:256,height:256,columnSpan:1,renderComponent:Je}));return[...e||[],...t||[]]},isEmpty(){return!this.haveFiles&&!this.haveFolders},haveFiles(){return!!this.fileList&&this.fileList.length!==0},haveFolders(){return!!this.folderList&&this.folderList.length!==0}},watch:{path(){this.fetchFolderContent()},showShared(){this.fetchFolderContent()}},beforeMount(){this.fetchFolderContent()},methods:{onRefresh(){this.fetchFolderContent()},async fetchFolderContent(){this.error=null,this.loading=!0,window.OCA?.Viewer?.close?.(),window.OCA?.Files?.Sidebar?.close?.(),(!this.files[this.folderId]||!this.folders[this.folderId])&&(this.initializing=!0);try{const{folder:e,folders:t,files:r}=await J(this.path,{shared:this.showShared,signal:this.abortController.signal});this.$store.dispatch("addPath",{path:this.path,fileid:e?.fileid}),this.$store.dispatch("updateFolders",{fileid:e?.fileid,files:r,folders:t}),this.$store.dispatch("updateFoldersFiles",{folder:e,files:r,folders:t})}catch(e){e?.response&&e.response.status&&(e.response.status===404?(this.error=404,setTimeout(()=>{this.$router.push({name:this.$route.name??void 0})},3e3)):this.error=e),j.error("Error fetching album data",{error:e})}finally{this.loading=!1,this.initializing=!1}},async onUpload(e){const t=e.source.split(w).pop(),r=await de(w+t);if(r===null){j.error("Failed to fetch file",{relPath:t});return}const i={fileid:r.fileid,basename:r.basename,etag:r.attributes.etag,filename:r.root+r.path,source:r.source,lastmod:r.mtime?.getTime(),mime:r.mime,size:r.size,type:"file",permissions:"",hasPreview:r.attributes.hasPreview};this.$store.dispatch("appendFoldersFiles",[i]),this.$store.dispatch("addFilesToFolder",{fileid:this.folderId,files:[i]})},t:v}};var dt=function(){var e=this,t=e._self._c;return e.error===404?t("NcEmptyContent",{attrs:{name:e.t("photos","This folder does not exist")},scopedSlots:e._u([{key:"icon",fn:function(){return[t("FolderOutline")]},proxy:!0}],null,!1,610611029)}):e.error?t("NcEmptyContent",{attrs:{name:e.t("photos","An error occurred")}}):e.initializing?t("NcEmptyContent",{attrs:{name:e.t("photos","Loading folders …")},scopedSlots:e._u([{key:"icon",fn:function(){return[t("NcLoadingIcon")]},proxy:!0}])}):e.initializing?e._e():t("div",[t("HeaderNavigation",{key:"navigation",class:{"photos-navigation--uploading":e.uploader.queue?.length>0},attrs:{loading:e.loading,path:e.path,title:e.folder?.basename?.toString?.()||e.rootTitle,"root-title":e.rootTitle},on:{refresh:e.onRefresh}},[t("UploadPicker",{attrs:{accept:e.allowedMimes,destination:e.folderAsFolder,multiple:!0},on:{uploaded:e.onUpload}})],1),e.isEmpty?t("NcEmptyContent",{key:"emptycontent",attrs:{name:e.t("photos","No photos in here")},scopedSlots:e._u([{key:"icon",fn:function(){return[t("FolderOutline")]},proxy:!0}],null,!1,610611029)}):t("div",{staticClass:"grid-container",class:{"grid-container--folders":e.haveFolders}},[t("VirtualGrid",{ref:"virtualgrid",attrs:{items:e.contentList,"scroll-element":e.appContent,"get-column-count":()=>e.haveFolders?e.gridConfig.folderCount:e.gridConfig.count,"get-grid-gap":()=>e.haveFolders?16:8}})],1)],1)},ct=[],ut=R(lt,dt,ct,!1,null,"96fe4494");const Lt=ut.exports;export{Lt as default};
-//# sourceMappingURL=FoldersView-D1or2SXG.chunk.mjs.map
+import"./index-D5RVJiYa.chunk.mjs";import{V as F,t as v,_ as x,g as H,J as w,Q as Z,d as V,R as ee,S as te}from"./vue.runtime.esm-CUt6bkjo.chunk.mjs";import{U as re,g as ie}from"./index-DdKmqUaK-ieqacG-7.chunk.mjs";import{N as oe}from"./NcEmptyContent-Cpupu6IY.chunk.mjs";import{j as W,k as ne,h as q,l as j,f as ae}from"./index-BNsvyP4z.chunk.mjs";import{n as R,F as B}from"./icons-C7cst3Si.chunk.mjs";import{L as se}from"./video-Cscep4g4.chunk.mjs";import{A as K}from"./AbortControllerMixin-DzoAixcw.chunk.mjs";import{H as le}from"./HeaderNavigation-DRPCUjqH.chunk.mjs";import{f as de}from"./fileFetcher-y5IgObFT.chunk.mjs";import"./preload-helper-Dh9HmuEY.chunk.mjs";import"./index-D0ObSCf1.chunk.mjs";import"./useHotKey-C66SdeSu.chunk.mjs";import"./NcActionButton-CuVNJJtW-BUVPInyd.chunk.mjs";import"./NcProgressBar-DegJ2JjE-BDJnzRWz.chunk.mjs";import"./index-DeMPgnlU.chunk.mjs";import"./dialog-jEiVWX_Y.chunk.mjs";var ce=Object.defineProperty,ue=Object.defineProperties,fe=Object.getOwnPropertyDescriptors,T=Object.getOwnPropertySymbols,he=Object.prototype.hasOwnProperty,pe=Object.prototype.propertyIsEnumerable,N=(e,t,r)=>t in e?ce(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,k=(e,t)=>{for(var r in t||(t={}))he.call(t,r)&&N(e,r,t[r]);if(T)for(var r of T(t))pe.call(t,r)&&N(e,r,t[r]);return e},I=(e,t)=>ue(e,fe(t));function _(e){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?_=function(t){return typeof t}:_=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_(e)}function me(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ge(e){return we(e)||ye(e)||ve()}function we(e){if(Array.isArray(e)){for(var t=0,r=new Array(e.length);t ()=>!0})],c.prototype,"updateFunction",2),u([h({default:()=>Me})],c.prototype,"getGridGap",2),u([h({default:()=>Pe})],c.prototype,"getColumnCount",2),u([h({default:()=>We})],c.prototype,"getWindowMargin",2),u([h({default:()=>Te})],c.prototype,"getItemRatioHeight",2),u([h({default:null})],c.prototype,"scrollElement",2),u([h({default:500})],c.prototype,"updateTriggerMargin",2),u([h({default:null})],c.prototype,"loader",2),u([h({default:!1})],c.prototype,"debug",2),u([b()],c.prototype,"updateLock",2),u([b()],c.prototype,"bottomReached",2),u([b()],c.prototype,"ref",2),u([b()],c.prototype,"containerData",2),u([ze("scrollElement")],c.prototype,"onScrollElementChanged",1),c=u([Y({name:"VirtualGrid"})],c);var Ie=function(){var e=this,t=e.$createElement,r=e._self._c||t;return r("div",{ref:"virtualGrid",style:{boxSizing:"border-box",height:e.layoutData.totalHeight+"px",paddingTop:e.renderData!==null&&e.renderData.firstRenderedRowOffset!==null?e.renderData.firstRenderedRowOffset+"px":"0px"}},[r("div",{staticClass:"grid",style:{display:"-ms-grid",display:"grid","align-items":"center","grid-template-columns":"repeat("+e.configData.columnCount+", 1fr)",gap:e.configData.gridGap+"px"}},e._l(e.renderData.cellsToRender,function(i){return r("div",{key:i.id,staticClass:"grid-item-wrapper",style:{height:i.height+"px","grid-column-start":i.columnNumber,"grid-column-end":i.columnNumber+i.columnSpan,"grid-row-start":e.getGridRowStart(i,e.renderData)}},[r(i.renderComponent,e._g({tag:"component",attrs:{item:i}},e.$listeners))],1)}),0),r(e.loadingBatch&&e.loader,{tag:"component"})],1)},Ae=[];function Ge(e,t,r,i,o,s,l,n){var a=typeof e=="function"?e.options:e;t&&(a.render=t,a.staticRenderFns=r,a._compiled=!0);var d;if(o&&(d=o),d)if(a.functional){a._injectStyles=d;var g=a.render;a.render=function(p,m){return d.call(m),g(p,m)}}else{var f=a.beforeCreate;a.beforeCreate=f?[].concat(f,d):[d]}return{exports:e,options:a}}const U={};var Ue=Ge(c,Ie,Ae,!1,He);function He(e){for(let t in U)this[t]=U[t]}var Ve=function(){return Ue.exports}();const qe={name:"FileLegacy",inheritAttrs:!1,props:{item:{type:Object,required:!0}},data(){return{loaded:!1,error:!1}},computed:{ariaUuid(){return`image-${this.item.injected.fileid}`},ariaLabel(){return v("photos",'Open the full size "{name}" image',{name:this.item.injected.basename})},isImage(){return this.item.injected.mime.startsWith("image")},decodedEtag(){return this.item.injected.etag.replace(""","").replace(""","")},src(){return x(`/core/preview?fileId=${this.item.injected.fileid}&c=${this.decodedEtag}&x=250&y=250&forceIcon=0&a=${this.croppedLayout?"0":"1"}`)},croppedLayout(){return this.$store.state.userConfig.croppedLayout}},beforeDestroy(){this.$refs.src=""},methods:{openViewer(){window.OCA.Viewer.open({fileInfo:W(this.item.injected),list:this.item.injected.list.map(e=>W(e))})},onLoad(){this.loaded=!0},onError(){this.error=!0},t:v}};var Be=function(){var e=this,t=e._self._c;return t("a",{staticClass:"file",class:{"file--cropped":e.croppedLayout},attrs:{href:e.item.injected.source,"aria-label":e.ariaLabel},on:{click:function(r){return r.preventDefault(),e.openViewer.apply(null,arguments)}}},[e.item.injected.mime.includes("video")&&e.item.injected.hasPreview?t("div",{staticClass:"icon-video-white"}):e._e(),t("transition-group",{staticClass:"transition-group",attrs:{name:"fade"}},[e.error?e._e():t("img",{key:`${e.item.injected.basename}-img`,ref:"img",attrs:{src:e.src,alt:e.item.injected.basename,"aria-describedby":e.ariaUuid},on:{load:e.onLoad,error:e.onError}}),!e.loaded||e.error?t("svg",{key:`${e.item.injected.basename}-svg`,attrs:{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",fill:"url(#placeholder__gradient)"}},[e.isImage?t("use",{attrs:{href:"#placeholder--img"}}):t("use",{attrs:{href:"#placeholder--video"}})]):e._e()]),t("p",{staticClass:"hidden-visually",attrs:{id:e.ariaUuid}},[e._v(e._s(e.item.injected.basename))]),t("div",{staticClass:"cover",attrs:{role:"none"}})],1)},Ke=[],Ye=R(qe,Be,Ke,!1,null,"6f079611");const Je=Ye.exports,Qe={name:"FolderTagPreview",components:{FolderOutline:B,RouterLink:se},props:{name:{type:String,required:!0},path:{type:String,default:""},fileList:{type:Array,default:()=>[]}},data(){return{failed:[]}},computed:{isEmpty(){return this.previewList.length===0},ariaLabel(){return v("photos",'Open the "{name}" folder',{name:this.name})},previewList(){return this.fileList.filter(e=>this.failed.indexOf(e.fileid)===-1)},previewUrl(){if(this.previewList.length===0)return null;const{fileid:e,etag:t}=this.previewList.at(-1);return x(`/core/preview?fileId=${e}&c=${t}&x=250&y=250&forceIcon=0&a=0`)},toLink(){const e=`/files/${H()?.uid}`;let t=this.path.replace(new RegExp(`^${e}`),"");return t=/^\/?(.+)/i.exec(t)[1],{...this.$route,params:{path:t.split("/")}}}},methods:{onPreviewFail({fileid:e}){this.failed.push(e)},t:v}};var Xe=function(){var e=this,t=e._self._c;return t("RouterLink",{staticClass:"folder",attrs:{to:e.toLink,"aria-label":e.ariaLabel}},[e.previewUrl?t("img",{staticClass:"folder__image",attrs:{src:e.previewUrl,alt:""},on:{error:function(r){return e.onPreviewFail(e.file)}}}):t("span",{staticClass:"folder__image folder__image--placeholder"},[t("FolderOutline",{staticClass:"folder__icon",attrs:{size:96,"fill-color":"var(--color-primary-element)"}})],1),t("span",{staticClass:"folder__details"},[t("FolderOutline"),t("span",{staticClass:"folder__title"},[e._v(e._s(e.name))])],1)])},Ze=[],et=R(Qe,Xe,Ze,!1,null,"0660a5ac");const tt=et.exports;async function J(e="/",t={}){const r=x(`/apps/photos/api/v1/${t.shared?"shared":"albums"}`),i=(await ne.get(r+e,t)).data.map(n=>({...n,filename:`${w}${n.filename}`,source:decodeURI(Z+`${w}${n.filename}`)}));let o;const s=[],l=[];for(const n of i)n.filename===`${w}${e}`?o=n:n.type!=="file"?s.push(n):q.indexOf(n.mime)>-1&&l.push(n);return{folder:o,folders:s,files:l}}const rt=V({name:"FolderComponent",components:{FolderTagPreview:tt},mixins:[K],inheritAttrs:!1,props:{item:{type:Object,required:!0}},data(){return{previewFolder:this.item.injected.fileid}},computed:{files(){return this.$store.state.folders.files},subFolders(){return this.$store.state.folders.subFolders},folders(){return this.$store.state.folders.folders},folderContent(){return this.folders[this.item.injected.fileid]},previewFiles(){const e=this.folders[this.previewFolder],t=e?e.map(r=>this.files[r]).slice(0,4):[];if(t.length===0&&this.subFolders[this.previewFolder]&&this.previewFolder===this.item.injected.fileid){const r=this.subFolders[this.previewFolder][0];this.updatePreviewFolder(r),this.folders[this.previewFolder]||this.getFolderData(this.files[this.previewFolder].filename)}return t}},async created(){this.folderContent||await this.getFolderData(this.item.injected.filename)},methods:{async getFolderData(e){try{const t=`/files/${H()?.uid}`,r=e.replace(new RegExp(`^${t}`),""),{folder:i,folders:o,files:s}=await J(r,{shared:this.item.injected.showShared,signal:this.abortController.signal});this.$store.dispatch("updateFolders",{fileid:i?.fileid,files:s,folders:o}),this.$store.dispatch("updateFoldersFiles",{folder:i,files:s,folders:o})}catch(t){j.error("Failed to get folder content",{error:t,filename:e})}},updatePreviewFolder(e){this.previewFolder=e}}});var it=function(){var e=this,t=e._self._c;return e._self._setupProxy,t("FolderTagPreview",{attrs:{id:e.item.injected.fileid,name:e.item.injected.basename.toString(),path:e.item.injected.filename,"file-list":e.previewFiles}})},ot=[],nt=R(rt,it,ot,!1,null,"d58b828a");const at=nt.exports,C={400:{marginTop:66,marginW:8,count:3,folderCount:1},700:{marginTop:66,marginW:8,count:4,folderCount:1},1024:{marginTop:66,marginW:44,count:5,folderCount:2},1280:{marginTop:66,marginW:44,count:4,folderCount:2},1440:{marginTop:88,marginW:66,count:5,folderCount:3},1600:{marginTop:88,marginW:66,count:6,folderCount:4},2048:{marginTop:88,marginW:66,count:7,folderCount:4},2560:{marginTop:88,marginW:88,count:8,folderCount:6},3440:{marginTop:88,marginW:88,count:9,folderCount:8},max:{marginTop:88,marginW:88,count:10,folderCount:10}},O=new F({data(){return{gridConfig:C.max}},watch:{gridConfig(e){this.$emit("changed",e)}},created(){window.addEventListener("resize",this.handleWindowResize),this.handleWindowResize()},beforeDestroy(){window.removeEventListener("resize",this.handleWindowResize)},methods:{handleWindowResize(){const e=Object.keys(C).map(t=>Number.parseInt(t)).find(t=>t>document.documentElement.clientWidth);this.gridConfig=C[e]||C.max}}}),st=V({data(){return{gridConfig:{}}},created(){O.$on("changed",this.handleGridConfigChange),j.debug("Grid config",{gridConfig:O.gridConfig}),this.gridConfig=O.gridConfig},beforeDestroy(){O.$off("changed",this.handleGridConfigChange)},methods:{handleGridConfigChange(e){this.gridConfig=e}}}),lt={name:"FoldersView",components:{FolderOutline:B,HeaderNavigation:le,NcEmptyContent:oe,NcLoadingIcon:ae,UploadPicker:re,VirtualGrid:Ve},mixins:[K,st],props:{rootTitle:{type:String,required:!0},path:{type:String,default:"/"},showShared:{type:Boolean,default:!1}},data(){return{error:null,allowedMimes:q,initializing:!0,loading:!1,appContent:document.getElementById("app-content-vue"),uploader:ie()}},computed:{files(){return this.$store.state.folders.files},folders(){return this.$store.state.folders.folders},folderId(){return this.$store.state.folders.paths[this.path]},folder(){return this.files[this.folderId]},folderAsFolder(){if(this.folder)return new ee({...this.folder,permissions:te(this.folder.permissions),owner:null})},folderContent(){return this.folders[this.folderId]||[]},fileList(){return this.folderContent&&this.folderContent.map(e=>this.files[e]).filter(e=>!!e)},subFolders(){return this.folderId&&this.files[this.folderId]&&this.$store.state.folders.subFolders[this.folderId]},folderList(){return this.subFolders&&this.subFolders.map(e=>this.files[e]).filter(e=>!!e)},contentList(){const e=this.folderList&&this.folderList.map(r=>({id:`folder-${r.fileid}`,injected:{...r,showShared:this.showShared},width:232,height:280,columnSpan:1,renderComponent:at})),t=this.fileList?.map(r=>({id:`file-${r.fileid}`,injected:{...r,list:this.fileList},width:256,height:256,columnSpan:1,renderComponent:Je}));return[...e||[],...t||[]]},isEmpty(){return!this.haveFiles&&!this.haveFolders},haveFiles(){return!!this.fileList&&this.fileList.length!==0},haveFolders(){return!!this.folderList&&this.folderList.length!==0}},watch:{path(){this.fetchFolderContent()},showShared(){this.fetchFolderContent()}},beforeMount(){this.fetchFolderContent()},methods:{onRefresh(){this.fetchFolderContent()},async fetchFolderContent(){this.error=null,this.loading=!0,window.OCA?.Viewer?.close?.(),window.OCA?.Files?.Sidebar?.close?.(),(!this.files[this.folderId]||!this.folders[this.folderId])&&(this.initializing=!0);try{const{folder:e,folders:t,files:r}=await J(this.path,{shared:this.showShared,signal:this.abortController.signal});this.$store.dispatch("addPath",{path:this.path,fileid:e?.fileid}),this.$store.dispatch("updateFolders",{fileid:e?.fileid,files:r,folders:t}),this.$store.dispatch("updateFoldersFiles",{folder:e,files:r,folders:t})}catch(e){e?.response&&e.response.status&&(e.response.status===404?(this.error=404,setTimeout(()=>{this.$router.push({name:this.$route.name??void 0})},3e3)):this.error=e),j.error("Error fetching album data",{error:e})}finally{this.loading=!1,this.initializing=!1}},async onUpload(e){const t=e.source.split(w).pop(),r=await de(w+t);if(r===null){j.error("Failed to fetch file",{relPath:t});return}const i={fileid:r.fileid,basename:r.basename,etag:r.attributes.etag,filename:r.root+r.path,source:r.source,lastmod:r.mtime?.getTime(),mime:r.mime,size:r.size,type:"file",permissions:"",hasPreview:r.attributes.hasPreview};this.$store.dispatch("appendFoldersFiles",[i]),this.$store.dispatch("addFilesToFolder",{fileid:this.folderId,files:[i]})},t:v}};var dt=function(){var e=this,t=e._self._c;return e.error===404?t("NcEmptyContent",{attrs:{name:e.t("photos","This folder does not exist")},scopedSlots:e._u([{key:"icon",fn:function(){return[t("FolderOutline")]},proxy:!0}],null,!1,610611029)}):e.error?t("NcEmptyContent",{attrs:{name:e.t("photos","An error occurred")}}):e.initializing?t("NcEmptyContent",{attrs:{name:e.t("photos","Loading folders …")},scopedSlots:e._u([{key:"icon",fn:function(){return[t("NcLoadingIcon")]},proxy:!0}])}):e.initializing?e._e():t("div",[t("HeaderNavigation",{key:"navigation",class:{"photos-navigation--uploading":e.uploader.queue?.length>0},attrs:{loading:e.loading,path:e.path,title:e.folder?.basename?.toString?.()||e.rootTitle,"root-title":e.rootTitle},on:{refresh:e.onRefresh}},[t("UploadPicker",{attrs:{accept:e.allowedMimes,destination:e.folderAsFolder,multiple:!0},on:{uploaded:e.onUpload}})],1),e.isEmpty?t("NcEmptyContent",{key:"emptycontent",attrs:{name:e.t("photos","No photos in here")},scopedSlots:e._u([{key:"icon",fn:function(){return[t("FolderOutline")]},proxy:!0}],null,!1,610611029)}):t("div",{staticClass:"grid-container",class:{"grid-container--folders":e.haveFolders}},[t("VirtualGrid",{ref:"virtualgrid",attrs:{items:e.contentList,"scroll-element":e.appContent,"get-column-count":()=>e.haveFolders?e.gridConfig.folderCount:e.gridConfig.count,"get-grid-gap":()=>e.haveFolders?16:8}})],1)],1)},ct=[],ut=R(lt,dt,ct,!1,null,"96fe4494");const Lt=ut.exports;export{Lt as default};
+//# sourceMappingURL=FoldersView-CGJHdvQL.chunk.mjs.map
diff --git a/js/FoldersView-D1or2SXG.chunk.mjs.license b/js/FoldersView-CGJHdvQL.chunk.mjs.license
similarity index 100%
rename from js/FoldersView-D1or2SXG.chunk.mjs.license
rename to js/FoldersView-CGJHdvQL.chunk.mjs.license
diff --git a/js/FoldersView-D1or2SXG.chunk.mjs.map b/js/FoldersView-CGJHdvQL.chunk.mjs.map
similarity index 99%
rename from js/FoldersView-D1or2SXG.chunk.mjs.map
rename to js/FoldersView-CGJHdvQL.chunk.mjs.map
index 4194ff4c1..323c91fe0 100644
--- a/js/FoldersView-D1or2SXG.chunk.mjs.map
+++ b/js/FoldersView-CGJHdvQL.chunk.mjs.map
@@ -1 +1 @@
-{"version":3,"file":"FoldersView-D1or2SXG.chunk.mjs","sources":["../node_modules/vue-virtual-grid/dist/vue-virtual-grid.es.js","../src/components/FileLegacy.vue","../src/components/FolderTagPreview.vue","../src/services/FolderContent.ts","../src/components/FolderComponent.vue","../src/assets/grid-sizes.ts","../src/services/GridConfig.ts","../src/mixins/GridConfig.ts","../src/views/FoldersView.vue"],"sourcesContent":["var __defProp = Object.defineProperty;\nvar __defProps = Object.defineProperties;\nvar __getOwnPropDescs = Object.getOwnPropertyDescriptors;\nvar __getOwnPropSymbols = Object.getOwnPropertySymbols;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __propIsEnum = Object.prototype.propertyIsEnumerable;\nvar __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;\nvar __spreadValues = (a, b) => {\n for (var prop in b || (b = {}))\n if (__hasOwnProp.call(b, prop))\n __defNormalProp(a, prop, b[prop]);\n if (__getOwnPropSymbols)\n for (var prop of __getOwnPropSymbols(b)) {\n if (__propIsEnum.call(b, prop))\n __defNormalProp(a, prop, b[prop]);\n }\n return a;\n};\nvar __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));\nimport Vue from \"vue\";\n/**\n * vue-class-component v7.2.6\n * (c) 2015-present Evan You\n * @license MIT\n */\nfunction _typeof(obj) {\n if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") {\n _typeof = function(obj2) {\n return typeof obj2;\n };\n } else {\n _typeof = function(obj2) {\n return obj2 && typeof Symbol === \"function\" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? \"symbol\" : typeof obj2;\n };\n }\n return _typeof(obj);\n}\nfunction _defineProperty(obj, key, value) {\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n return obj;\n}\nfunction _toConsumableArray(arr) {\n return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread();\n}\nfunction _arrayWithoutHoles(arr) {\n if (Array.isArray(arr)) {\n for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++)\n arr2[i] = arr[i];\n return arr2;\n }\n}\nfunction _iterableToArray(iter) {\n if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === \"[object Arguments]\")\n return Array.from(iter);\n}\nfunction _nonIterableSpread() {\n throw new TypeError(\"Invalid attempt to spread non-iterable instance\");\n}\nfunction reflectionIsSupported() {\n return typeof Reflect !== \"undefined\" && Reflect.defineMetadata && Reflect.getOwnMetadataKeys;\n}\nfunction copyReflectionMetadata(to, from) {\n forwardMetadata(to, from);\n Object.getOwnPropertyNames(from.prototype).forEach(function(key) {\n forwardMetadata(to.prototype, from.prototype, key);\n });\n Object.getOwnPropertyNames(from).forEach(function(key) {\n forwardMetadata(to, from, key);\n });\n}\nfunction forwardMetadata(to, from, propertyKey) {\n var metaKeys = propertyKey ? Reflect.getOwnMetadataKeys(from, propertyKey) : Reflect.getOwnMetadataKeys(from);\n metaKeys.forEach(function(metaKey) {\n var metadata = propertyKey ? Reflect.getOwnMetadata(metaKey, from, propertyKey) : Reflect.getOwnMetadata(metaKey, from);\n if (propertyKey) {\n Reflect.defineMetadata(metaKey, metadata, to, propertyKey);\n } else {\n Reflect.defineMetadata(metaKey, metadata, to);\n }\n });\n}\nvar fakeArray = {\n __proto__: []\n};\nvar hasProto = fakeArray instanceof Array;\nfunction createDecorator(factory) {\n return function(target, key, index) {\n var Ctor = typeof target === \"function\" ? target : target.constructor;\n if (!Ctor.__decorators__) {\n Ctor.__decorators__ = [];\n }\n if (typeof index !== \"number\") {\n index = void 0;\n }\n Ctor.__decorators__.push(function(options) {\n return factory(options, key, index);\n });\n };\n}\nfunction isPrimitive(value) {\n var type = _typeof(value);\n return value == null || type !== \"object\" && type !== \"function\";\n}\nfunction collectDataFromConstructor(vm, Component2) {\n var originalInit = Component2.prototype._init;\n Component2.prototype._init = function() {\n var _this = this;\n var keys = Object.getOwnPropertyNames(vm);\n if (vm.$options.props) {\n for (var key in vm.$options.props) {\n if (!vm.hasOwnProperty(key)) {\n keys.push(key);\n }\n }\n }\n keys.forEach(function(key2) {\n Object.defineProperty(_this, key2, {\n get: function get() {\n return vm[key2];\n },\n set: function set(value) {\n vm[key2] = value;\n },\n configurable: true\n });\n });\n };\n var data = new Component2();\n Component2.prototype._init = originalInit;\n var plainData = {};\n Object.keys(data).forEach(function(key) {\n if (data[key] !== void 0) {\n plainData[key] = data[key];\n }\n });\n return plainData;\n}\nvar $internalHooks = [\n \"data\",\n \"beforeCreate\",\n \"created\",\n \"beforeMount\",\n \"mounted\",\n \"beforeDestroy\",\n \"destroyed\",\n \"beforeUpdate\",\n \"updated\",\n \"activated\",\n \"deactivated\",\n \"render\",\n \"errorCaptured\",\n \"serverPrefetch\"\n];\nfunction componentFactory(Component2) {\n var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};\n options.name = options.name || Component2._componentTag || Component2.name;\n var proto = Component2.prototype;\n Object.getOwnPropertyNames(proto).forEach(function(key) {\n if (key === \"constructor\") {\n return;\n }\n if ($internalHooks.indexOf(key) > -1) {\n options[key] = proto[key];\n return;\n }\n var descriptor = Object.getOwnPropertyDescriptor(proto, key);\n if (descriptor.value !== void 0) {\n if (typeof descriptor.value === \"function\") {\n (options.methods || (options.methods = {}))[key] = descriptor.value;\n } else {\n (options.mixins || (options.mixins = [])).push({\n data: function data() {\n return _defineProperty({}, key, descriptor.value);\n }\n });\n }\n } else if (descriptor.get || descriptor.set) {\n (options.computed || (options.computed = {}))[key] = {\n get: descriptor.get,\n set: descriptor.set\n };\n }\n });\n (options.mixins || (options.mixins = [])).push({\n data: function data() {\n return collectDataFromConstructor(this, Component2);\n }\n });\n var decorators = Component2.__decorators__;\n if (decorators) {\n decorators.forEach(function(fn) {\n return fn(options);\n });\n delete Component2.__decorators__;\n }\n var superProto = Object.getPrototypeOf(Component2.prototype);\n var Super = superProto instanceof Vue ? superProto.constructor : Vue;\n var Extended = Super.extend(options);\n forwardStaticMembers(Extended, Component2, Super);\n if (reflectionIsSupported()) {\n copyReflectionMetadata(Extended, Component2);\n }\n return Extended;\n}\nvar shouldIgnore = {\n prototype: true,\n arguments: true,\n callee: true,\n caller: true\n};\nfunction forwardStaticMembers(Extended, Original, Super) {\n Object.getOwnPropertyNames(Original).forEach(function(key) {\n if (shouldIgnore[key]) {\n return;\n }\n var extendedDescriptor = Object.getOwnPropertyDescriptor(Extended, key);\n if (extendedDescriptor && !extendedDescriptor.configurable) {\n return;\n }\n var descriptor = Object.getOwnPropertyDescriptor(Original, key);\n if (!hasProto) {\n if (key === \"cid\") {\n return;\n }\n var superDescriptor = Object.getOwnPropertyDescriptor(Super, key);\n if (!isPrimitive(descriptor.value) && superDescriptor && superDescriptor.value === descriptor.value) {\n return;\n }\n }\n Object.defineProperty(Extended, key, descriptor);\n });\n}\nfunction Component(options) {\n if (typeof options === \"function\") {\n return componentFactory(options);\n }\n return function(Component2) {\n return componentFactory(Component2, options);\n };\n}\nComponent.registerHooks = function registerHooks(keys) {\n $internalHooks.push.apply($internalHooks, _toConsumableArray(keys));\n};\nglobalThis && globalThis.__spreadArrays || function() {\n for (var s = 0, i = 0, il = arguments.length; i < il; i++)\n s += arguments[i].length;\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\n r[k] = a[j];\n return r;\n};\nfunction needToProduceProvide(original) {\n return typeof original !== \"function\" || !original.managed && !original.managedReactive;\n}\nfunction produceProvide(original) {\n var provide = function() {\n var _this = this;\n var rv = typeof original === \"function\" ? original.call(this) : original;\n rv = Object.create(rv || null);\n rv[reactiveInjectKey] = Object.create(this[reactiveInjectKey] || {});\n for (var i in provide.managed) {\n rv[provide.managed[i]] = this[i];\n }\n var _loop_1 = function(i2) {\n rv[provide.managedReactive[i2]] = this_1[i2];\n Object.defineProperty(rv[reactiveInjectKey], provide.managedReactive[i2], {\n enumerable: true,\n configurable: true,\n get: function() {\n return _this[i2];\n }\n });\n };\n var this_1 = this;\n for (var i in provide.managedReactive) {\n _loop_1(i);\n }\n return rv;\n };\n provide.managed = {};\n provide.managedReactive = {};\n return provide;\n}\nvar reactiveInjectKey = \"__reactiveInject__\";\nfunction inheritInjected(componentOptions) {\n if (!Array.isArray(componentOptions.inject)) {\n componentOptions.inject = componentOptions.inject || {};\n componentOptions.inject[reactiveInjectKey] = {\n from: reactiveInjectKey,\n default: {}\n };\n }\n}\nvar reflectMetadataIsSupported = typeof Reflect !== \"undefined\" && typeof Reflect.getMetadata !== \"undefined\";\nfunction applyMetadata(options, target, key) {\n if (reflectMetadataIsSupported) {\n if (!Array.isArray(options) && typeof options !== \"function\" && !options.hasOwnProperty(\"type\") && typeof options.type === \"undefined\") {\n var type = Reflect.getMetadata(\"design:type\", target, key);\n if (type !== Object) {\n options.type = type;\n }\n }\n }\n}\nfunction Prop(options) {\n if (options === void 0) {\n options = {};\n }\n return function(target, key) {\n applyMetadata(options, target, key);\n createDecorator(function(componentOptions, k) {\n (componentOptions.props || (componentOptions.props = {}))[k] = options;\n })(target, key);\n };\n}\nfunction ProvideReactive(key) {\n return createDecorator(function(componentOptions, k) {\n var provide = componentOptions.provide;\n inheritInjected(componentOptions);\n if (needToProduceProvide(provide)) {\n provide = componentOptions.provide = produceProvide(provide);\n }\n provide.managedReactive[k] = key || k;\n });\n}\nfunction Watch(path, options) {\n if (options === void 0) {\n options = {};\n }\n var _a = options.deep, deep = _a === void 0 ? false : _a, _b = options.immediate, immediate = _b === void 0 ? false : _b;\n return createDecorator(function(componentOptions, handler) {\n if (typeof componentOptions.watch !== \"object\") {\n componentOptions.watch = /* @__PURE__ */ Object.create(null);\n }\n var watch = componentOptions.watch;\n if (typeof watch[path] === \"object\" && !Array.isArray(watch[path])) {\n watch[path] = [watch[path]];\n } else if (typeof watch[path] === \"undefined\") {\n watch[path] = [];\n }\n watch[path].push({ handler, deep, immediate });\n });\n}\nconst getGridGapDefault = (elementWidth, windowHeight) => {\n if (elementWidth > 720 && windowHeight > 480) {\n return 10;\n } else {\n return 5;\n }\n};\nconst getColumnCountDefault = (elementWidth) => {\n return Math.floor(elementWidth / 250);\n};\nconst getWindowMarginDefault = (windowHeight) => {\n return Math.round(windowHeight * 1.5);\n};\nconst getItemRatioHeightDefault = (height, width, columnWidth) => {\n const imageRatio = height / width;\n return Math.round(columnWidth * imageRatio);\n};\nconst debugLog = (condition, ...args) => {\n if (condition) {\n console.debug(...args);\n }\n};\nvar __defProp2 = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __decorateClass = (decorators, target, key, kind) => {\n var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;\n for (var i = decorators.length - 1, decorator; i >= 0; i--)\n if (decorator = decorators[i])\n result = (kind ? decorator(target, key, result) : decorator(result)) || result;\n if (kind && result)\n __defProp2(target, key, result);\n return result;\n};\nlet VirtualGrid$1 = class extends Vue {\n constructor() {\n super(...arguments);\n this.updateLock = false;\n this.bottomReached = false;\n this.ref = null;\n this.containerData = {\n windowSize: { height: 0, width: 0 },\n windowScroll: { x: 0, y: 0 },\n elementWindowOffset: 0,\n elementSize: { height: 0, width: 0 }\n };\n }\n get loadingBatch() {\n return this.loader && this.updateLock;\n }\n get configData() {\n return this.computeConfigData(this.containerData, this.items);\n }\n get layoutData() {\n return this.computeLayoutData(this.configData);\n }\n get renderData() {\n return this.computeRenderData(this.configData, this.containerData, this.layoutData);\n }\n mounted() {\n var _a;\n this.ref = this.$refs.virtualGrid;\n this.initiliazeGrid();\n window.addEventListener(\"resize\", this.resize);\n ((_a = this.scrollElement) != null ? _a : window).addEventListener(\"scroll\", this.scroll);\n }\n beforeDestroy() {\n var _a;\n window.removeEventListener(\"resize\", this.resize);\n ((_a = this.scrollElement) != null ? _a : window).removeEventListener(\"scroll\", this.scroll);\n }\n onScrollElementChanged(scrollElement, oldScrollElement) {\n (oldScrollElement != null ? oldScrollElement : window).removeEventListener(\"scroll\", this.scroll);\n (scrollElement != null ? scrollElement : window).addEventListener(\"scroll\", this.scroll);\n }\n resize() {\n this.loadMoreData();\n }\n scroll() {\n this.loadMoreData();\n }\n initiliazeGrid() {\n this.computeContainerData();\n this.$nextTick(async () => {\n this.loadMoreData();\n });\n }\n loadMoreData() {\n this.loadMoreDataAsync().catch((error) => {\n if (error) {\n console.error(\"Fail to load next data batch\", error);\n }\n }).then();\n }\n async loadMoreDataAsync() {\n this.computeContainerData();\n const windowTop = this.containerData.windowScroll.y;\n const windowBottom = windowTop + this.containerData.windowSize.height;\n const bottomTrigger = Math.max(0, this.containerData.elementWindowOffset + this.containerData.elementSize.height - this.updateTriggerMargin);\n if (!this.bottomReached && windowBottom >= bottomTrigger && !this.updateLock) {\n this.updateLock = true;\n debugLog(this.debug, \"Loading next batch\");\n const isLastBatch = await this.updateFunction();\n if (isLastBatch) {\n debugLog(this.debug, \"Bottom reached\");\n this.bottomReached = true;\n }\n this.updateLock = false;\n await this.loadMoreDataAsync();\n }\n return;\n }\n computeContainerData() {\n if (this.ref === null) {\n return;\n }\n const windowSize = this.getWindowSize();\n const windowScroll = this.getWindowScroll();\n const elementWindowOffset = this.getElementOffset(this.ref);\n const elementSize = this.getElementSize(this.ref);\n this.containerData = { windowSize, windowScroll, elementWindowOffset, elementSize };\n }\n computeConfigData(containerData, items) {\n if (containerData === null || items === null) {\n return {\n windowMargin: 0,\n gridGap: 0,\n columnCount: 1,\n entries: []\n };\n }\n const elementWidth = containerData.elementSize ? containerData.elementSize.width : 0;\n const windowMargin = this.getWindowMargin(containerData.windowSize.height);\n const gridGap = this.getGridGap(elementWidth, containerData.windowSize.height);\n const columnCount = this.getColumnCount(elementWidth);\n const columnWidth = this.getColumnWidth(columnCount, gridGap, elementWidth);\n const entries = items.map((item) => {\n if (!item.width) {\n return item;\n }\n const imageWidth = columnWidth * item.columnSpan + gridGap * (item.columnSpan - 1);\n return __spreadProps(__spreadValues({}, item), {\n height: this.getItemRatioHeight(item.height, item.width, imageWidth),\n width: imageWidth\n });\n });\n return {\n windowMargin,\n gridGap,\n columnCount,\n entries\n };\n }\n computeLayoutData(configData) {\n if (configData === null) {\n return { cells: [], totalHeight: 0 };\n }\n let currentRowNumber = 1;\n let prevRowsTotalHeight = 0;\n let currentRowMaxHeight = 0;\n let columnShift = 0;\n const cells = configData.entries.map((entry, index) => {\n const { columnCount, gridGap } = configData;\n let columnSpanRecompute = entry.columnSpan;\n let heightRecompute = entry.height;\n if (columnSpanRecompute < 1) {\n columnSpanRecompute = columnCount;\n }\n const distanceToRowStart = (index + columnShift) % columnCount;\n if (entry.newRow && distanceToRowStart !== 0) {\n columnShift += columnCount - distanceToRowStart;\n }\n const shiftedIndex = index + columnShift;\n const columnNumber = shiftedIndex % columnCount + 1;\n const rowNumber = Math.floor(shiftedIndex / columnCount) + 1;\n if (columnNumber + columnSpanRecompute > columnCount + 1) {\n const overlapNumber = columnNumber + columnSpanRecompute - columnCount - 1;\n const overlapRatio = overlapNumber / columnSpanRecompute;\n heightRecompute = heightRecompute * (1 - overlapRatio);\n columnSpanRecompute -= overlapNumber;\n }\n if (columnSpanRecompute > 1) {\n columnShift += columnSpanRecompute - 1;\n }\n if (rowNumber !== currentRowNumber) {\n currentRowNumber = rowNumber;\n prevRowsTotalHeight += currentRowMaxHeight + gridGap;\n currentRowMaxHeight = 0;\n }\n const offset = prevRowsTotalHeight;\n const height = Math.round(heightRecompute);\n currentRowMaxHeight = Math.max(currentRowMaxHeight, height);\n return __spreadProps(__spreadValues({}, entry), { columnNumber, rowNumber, offset, height, columnSpan: columnSpanRecompute });\n });\n const totalHeight = prevRowsTotalHeight + currentRowMaxHeight;\n return { cells, totalHeight };\n }\n computeRenderData(configData, containerData, layoutData) {\n if (layoutData === null || configData === null) {\n return { cellsToRender: [], firstRenderedRowNumber: 0, firstRenderedRowOffset: 0 };\n }\n const cellsToRender = [];\n let firstRenderedRowNumber = null;\n let firstRenderedRowOffset = null;\n if (containerData.elementWindowOffset !== null) {\n const elementWindowOffset = containerData.elementWindowOffset;\n for (const cell of layoutData.cells) {\n const cellTop = elementWindowOffset + cell.offset;\n const cellBottom = cellTop + cell.height;\n const windowTop = containerData.windowScroll.y;\n const windowBottom = windowTop + containerData.windowSize.height;\n const renderTop = windowTop - configData.windowMargin;\n const renderBottom = windowBottom + configData.windowMargin;\n if (cellTop > renderBottom) {\n continue;\n }\n if (cellBottom < renderTop) {\n continue;\n }\n if (firstRenderedRowNumber === null) {\n firstRenderedRowNumber = cell.rowNumber;\n }\n if (cell.rowNumber === firstRenderedRowNumber) {\n firstRenderedRowOffset = firstRenderedRowOffset ? Math.min(firstRenderedRowOffset, cell.offset) : cell.offset;\n }\n cellsToRender.push(cell);\n }\n }\n return { cellsToRender, firstRenderedRowNumber, firstRenderedRowOffset };\n }\n getColumnWidth(columnCount, gridGap, elementWidth) {\n if (columnCount === null || gridGap === null || elementWidth === null) {\n return 0;\n }\n const totalGapSpace = (columnCount - 1) * gridGap;\n const columnWidth = Math.round((elementWidth - totalGapSpace) / columnCount);\n return columnWidth;\n }\n getGridRowStart(cell, renderData) {\n if (renderData === null) {\n return void 0;\n }\n const offset = renderData.firstRenderedRowNumber !== null ? renderData.firstRenderedRowNumber - 1 : 0;\n const gridRowStart = cell.rowNumber - offset;\n return `${gridRowStart}`;\n }\n resetGrid() {\n this.bottomReached = false;\n this.loadMoreData();\n }\n isSameElementSize(a, b) {\n return a.width === b.width && a.height === b.height;\n }\n getWindowSize() {\n return {\n width: window.innerWidth,\n height: window.innerHeight\n };\n }\n getElementSize(element) {\n const rect = element.getBoundingClientRect();\n return {\n width: rect.width,\n height: rect.height\n };\n }\n isSameElementScroll(a, b) {\n return a.x === b.x && a.y === b.y;\n }\n getWindowScroll() {\n return {\n x: window.scrollX,\n y: window.scrollY\n };\n }\n getElementOffset(element) {\n return window.scrollY + element.getBoundingClientRect().top;\n }\n};\n__decorateClass([\n Prop({ required: true })\n], VirtualGrid$1.prototype, \"items\", 2);\n__decorateClass([\n Prop({ default: () => () => true })\n], VirtualGrid$1.prototype, \"updateFunction\", 2);\n__decorateClass([\n Prop({ default: () => getGridGapDefault })\n], VirtualGrid$1.prototype, \"getGridGap\", 2);\n__decorateClass([\n Prop({ default: () => getColumnCountDefault })\n], VirtualGrid$1.prototype, \"getColumnCount\", 2);\n__decorateClass([\n Prop({ default: () => getWindowMarginDefault })\n], VirtualGrid$1.prototype, \"getWindowMargin\", 2);\n__decorateClass([\n Prop({ default: () => getItemRatioHeightDefault })\n], VirtualGrid$1.prototype, \"getItemRatioHeight\", 2);\n__decorateClass([\n Prop({ default: null })\n], VirtualGrid$1.prototype, \"scrollElement\", 2);\n__decorateClass([\n Prop({ default: 500 })\n], VirtualGrid$1.prototype, \"updateTriggerMargin\", 2);\n__decorateClass([\n Prop({ default: null })\n], VirtualGrid$1.prototype, \"loader\", 2);\n__decorateClass([\n Prop({ default: false })\n], VirtualGrid$1.prototype, \"debug\", 2);\n__decorateClass([\n ProvideReactive()\n], VirtualGrid$1.prototype, \"updateLock\", 2);\n__decorateClass([\n ProvideReactive()\n], VirtualGrid$1.prototype, \"bottomReached\", 2);\n__decorateClass([\n ProvideReactive()\n], VirtualGrid$1.prototype, \"ref\", 2);\n__decorateClass([\n ProvideReactive()\n], VirtualGrid$1.prototype, \"containerData\", 2);\n__decorateClass([\n Watch(\"scrollElement\")\n], VirtualGrid$1.prototype, \"onScrollElementChanged\", 1);\nVirtualGrid$1 = __decorateClass([\n Component({\n name: \"VirtualGrid\"\n })\n], VirtualGrid$1);\nvar render = function() {\n var _vm = this;\n var _h = _vm.$createElement;\n var _c = _vm._self._c || _h;\n return _c(\"div\", { ref: \"virtualGrid\", style: {\n boxSizing: \"border-box\",\n height: _vm.layoutData.totalHeight + \"px\",\n paddingTop: _vm.renderData !== null && _vm.renderData.firstRenderedRowOffset !== null ? _vm.renderData.firstRenderedRowOffset + \"px\" : \"0px\"\n } }, [_c(\"div\", { staticClass: \"grid\", style: {\n \"display\": \"-ms-grid\",\n \"display\": \"grid\",\n \"align-items\": \"center\",\n \"grid-template-columns\": \"repeat(\" + _vm.configData.columnCount + \", 1fr)\",\n \"gap\": _vm.configData.gridGap + \"px\"\n } }, _vm._l(_vm.renderData.cellsToRender, function(item) {\n return _c(\"div\", { key: item.id, staticClass: \"grid-item-wrapper\", style: {\n \"height\": item.height + \"px\",\n \"grid-column-start\": item.columnNumber,\n \"grid-column-end\": item.columnNumber + item.columnSpan,\n \"grid-row-start\": _vm.getGridRowStart(item, _vm.renderData)\n } }, [_c(item.renderComponent, _vm._g({ tag: \"component\", attrs: { \"item\": item } }, _vm.$listeners))], 1);\n }), 0), _c(_vm.loadingBatch && _vm.loader, { tag: \"component\" })], 1);\n};\nvar staticRenderFns = [];\nfunction normalizeComponent(scriptExports, render2, staticRenderFns2, functionalTemplate, injectStyles, scopeId, moduleIdentifier, shadowMode) {\n var options = typeof scriptExports === \"function\" ? scriptExports.options : scriptExports;\n if (render2) {\n options.render = render2;\n options.staticRenderFns = staticRenderFns2;\n options._compiled = true;\n }\n if (functionalTemplate) {\n options.functional = true;\n }\n if (scopeId) {\n options._scopeId = \"data-v-\" + scopeId;\n }\n var hook;\n if (moduleIdentifier) {\n hook = function(context) {\n context = context || this.$vnode && this.$vnode.ssrContext || this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext;\n if (!context && typeof __VUE_SSR_CONTEXT__ !== \"undefined\") {\n context = __VUE_SSR_CONTEXT__;\n }\n if (injectStyles) {\n injectStyles.call(this, context);\n }\n if (context && context._registeredComponents) {\n context._registeredComponents.add(moduleIdentifier);\n }\n };\n options._ssrRegister = hook;\n } else if (injectStyles) {\n hook = shadowMode ? function() {\n injectStyles.call(this, (options.functional ? this.parent : this).$root.$options.shadowRoot);\n } : injectStyles;\n }\n if (hook) {\n if (options.functional) {\n options._injectStyles = hook;\n var originalRender = options.render;\n options.render = function renderWithStyleInjection(h, context) {\n hook.call(context);\n return originalRender(h, context);\n };\n } else {\n var existing = options.beforeCreate;\n options.beforeCreate = existing ? [].concat(existing, hook) : [hook];\n }\n }\n return {\n exports: scriptExports,\n options\n };\n}\nconst __cssModules = {};\nvar __component__ = /* @__PURE__ */ normalizeComponent(VirtualGrid$1, render, staticRenderFns, false, __vue2_injectStyles, null, null, null);\nfunction __vue2_injectStyles(context) {\n for (let o in __cssModules) {\n this[o] = __cssModules[o];\n }\n}\nvar VirtualGrid = /* @__PURE__ */ function() {\n return __component__.exports;\n}();\nexport { VirtualGrid as default };\n","\n\n\n\t\n\t\t\n\t\t\n\t\t {{ item.injected.basename }} {{ item.injected.basename }}\n\n\t\t\t\n\t\t
\n\n\t\t\n\t\t\t
\n\n\t\t\t\n\t\t
\n\n\t\t\n\t\t\t
i)){if(o<0)o=i+(o+1);else if(o===0)continue;a.indexOf(o)===-1&&a.push(o)}}return a.sort(function(A,l){return A-l})}_byDayAndMonthDay(t){let r,T=this.by_data.BYDAY,i,a=0,n,s=T.length,o=0,A,l=this,D=this.last.day;function S(){for(A=E.daysInMonth(l.last.month,l.last.year),r=l.normalizeByMonthDayRules(l.last.year,l.last.month,l.by_data.BYMONTHDAY),n=r.length;r[a]<=D&&!(t&&r[a]==D)&&ar&&(this.last.day=1,this.increment_month(),this.is_day_in_byday(this.last)?(!this.has_by_data("BYSETPOS")||this.check_set_position(1))&&(t=1):t=0)}else if(this.has_by_data("BYMONTHDAY")){if(this.by_indices.BYMONTHDAY++,this.by_indices.BYMONTHDAY>=this.by_data.BYMONTHDAY.length&&(this.by_indices.BYMONTHDAY=0,this.increment_month(),this.by_indices.BYMONTHDAY>=this.by_data.BYMONTHDAY.length))return 0;let r=E.daysInMonth(this.last.month,this.last.year),T=this.by_data.BYMONTHDAY[this.by_indices.BYMONTHDAY];T<0&&(T=r+T+1),T>r?(this.last.day=1,t=this.is_day_in_byday(this.last)):this.last.day=T}else{this.increment_month();let r=E.daysInMonth(this.last.month,this.last.year);this.by_data.BYMONTHDAY[0]>r?t=0:this.last.day=this.by_data.BYMONTHDAY[0]}return t}next_weekday_by_week(){let t=0;if(this.next_hour()==0)return t;if(!this.has_by_data("BYDAY"))return 1;for(;;){let r=new E;this.by_indices.BYDAY++,this.by_indices.BYDAY==Object.keys(this.by_data.BYDAY).length&&(this.by_indices.BYDAY=0,t=1);let T=this.by_data.BYDAY[this.by_indices.BYDAY],i=this.ruleDayOfWeek(T)[1];i-=this.rule.wkst,i<0&&(i+=7),r.year=this.last.year,r.month=this.last.month,r.day=this.last.day;let a=r.startDoyWeek(this.rule.wkst);if(i+a<1&&!t)continue;let n=E.fromDayOfYear(a+i,this.last.year);return this.last.year=n.year,this.last.month=n.month,this.last.day=n.day,t}}next_year(){if(this.next_hour()==0)return 0;if(++this.days_index==this.days.length){this.days_index=0;do this.increment_year(this.rule.interval),this.has_by_data("BYMONTHDAY")&&(this.by_data.BYMONTHDAY=this.normalizeByMonthDayRules(this.last.year,this.last.month,this.rule.parts.BYMONTHDAY)),this.expand_year_days(this.last.year);while(this.days.length==0)}return this._nextByYearDay(),1}_nextByYearDay(){let t=this.days[this.days_index],r=this.last.year;t<1&&(t+=1,r+=1);let T=E.fromDayOfYear(t,r);this.last.day=T.day,this.last.month=T.month}ruleDayOfWeek(t,r){let T=t.match(/([+-]?[0-9])?(MO|TU|WE|TH|FR|SA|SU)/);if(T){let i=parseInt(T[1]||0,10);return t=I.icalDayToNumericDay(T[2],r),[i,t]}else return[0,0]}next_generic(t,r,T,i,a){let n=t in this.by_data,s=this.rule.freq==r,o=0;if(a&&this[a]()==0)return o;if(n){this.by_indices[t]++;let A=this.by_data[t];this.by_indices[t]==A.length&&(this.by_indices[t]=0,o=1),this.last[T]=A[this.by_indices[t]]}else s&&this["increment_"+T](this.rule.interval);return n&&o&&s&&this["increment_"+i](1),o}increment_monthday(t){for(let r=0;r\n\t\t\n\t\t\n\t\t\t{{ value }}\n\t\t\n\t
\n\t\t\n\t\t\n\t\t\t{{ value }}\n\t\t\n\t
\n\t\t\t\t
\n\t\t\n\n\t\t\n\t\t\n\t\t\t\n\t\t\t\t\t{{ dateMonthAndYear(file.id) }}\n\t\t\t\t
\n\n\t\t\t\t\n\t\t\t\t
\n\t\t\n\n\t\t\n\t\t\n\t\t\t\n\t\t\t\t\t{{ dateMonthAndYear(file.id) }}\n\t\t\t\t
\n\n\t\t\t\t