"use strict";(globalThis["webpackChunksynclounge"]=globalThis["webpackChunksynclounge"]||[]).push([[8817],{8817:(e,t,n)=>{n.r(t),n.d(t,{default:()=>A});var d=n(7179),r=n(4437),s=n(5057),l=n(5294),c=n(2680),i=function(){var e=this,t=e._self._c;return e.recentlyAdded.length?t("div",[e._t("preHeader"),t(l.Z,{attrs:{"no-gutters":""}},[t(r.Z,[t(c.Z,[e._v(" Recently Added ")])],1),t(r.Z,{staticClass:"ml-auto",attrs:{cols:"auto"}},[t(d.Z,{style:e.recentlyAddedDownStyle,attrs:{icon:""},on:{click:e.recentlyAddedDown}},[t(s.Z,[e._v("navigate_before")])],1),t(d.Z,{style:e.recentlyAddedUpStyle,attrs:{icon:""},on:{click:e.recentlyAddedUp}},[t(s.Z,[e._v("navigate_next")])],1)],1)],1),t(l.Z,e._l(e.subsetRecentlyAdded,(function(e){return t(r.Z,{key:e.key,attrs:{cols:"4",sm:"3",md:"2",xl:"1"}},[t("PlexThumbnail",{attrs:{content:e,"full-title":"",type:"thumb",cols:"4",sm:"3",md:"2",xl:"1"}})],1)})),1)],2):e._e()},a=[],o=n(629);const h={name:"PlexOnDeck",components:{PlexThumbnail:()=>Promise.all([n.e(8735),n.e(6790)]).then(n.bind(n,8735))},props:{machineIdentifier:{type:String,required:!0}},data:()=>({recentlyAdded:[],recentlyAddedOffset:0,abortController:null}),computed:{recentItemsPer(){switch(this.$vuetify.breakpoint.name){case"xs":return 3;case"sm":return 4;case"md":case"lg":return 6;default:return 12}},recentlyAddedDownStyle(){return 0===this.recentlyAddedOffset?{opacity:.5}:{}},recentlyAddedUpStyle(){return this.recentlyAddedOffset+this.recentItemsPer>=this.recentlyAdded.length?{opacity:.5}:{}},subsetRecentlyAdded(){return this.recentlyAdded.slice(this.recentlyAddedOffset,this.recentlyAddedOffset+this.recentItemsPer)}},watch:{machineIdentifier:{handler(){return this.recentlyAdded=[],this.recentlyAddedOffset=0,this.fetchRecentlyAdded()},immediate:!0}},beforeDestroy(){this.abortRequests()},methods:{...(0,o.nv)("plexservers",["FETCH_RECENTLY_ADDED_MEDIA"]),abortRequests(){this.abortController&&(this.abortController.abort(),this.abortController=null)},recentlyAddedUp(){this.recentlyAddedOffset+this.recentItemsPer>=this.recentlyAdded.length||(this.recentlyAddedOffset+=this.recentItemsPer)},recentlyAddedDown(){this.recentlyAddedOffset-this.recentItemsPer<0?this.recentlyAddedOffset=0:this.recentlyAddedOffset-=this.recentItemsPer},async fetchRecentlyAddedCriticalSection(e){this.recentlyAdded=await this.FETCH_RECENTLY_ADDED_MEDIA({machineIdentifier:this.machineIdentifier,signal:e})},async fetchRecentlyAdded(){this.abortRequests();const e=new AbortController;this.abortController=e;try{await this.fetchRecentlyAddedCriticalSection(e.signal)}catch(t){if(!e.signal.aborted)throw t}}}},y=h;var f=n(1001),u=(0,f.Z)(y,i,a,!1,null,null,null);const A=u.exports}}]);
//# sourceMappingURL=8817.4d36d710.js.map