"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[4656],{84656:function(e,t,a){a.r(t),a(63238),a(55849),a(32081);var i,n=a(53218),r=a(92642),s=a(47005),o=a(53913),u=a(29856);function m(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(t.type=t.type||"Primary","Episode"!==e.Type)return null;if("Primary"===t.type&&e.SeriesPrimaryImageTag)return t.tag=e.SeriesPrimaryImageTag,o.Z.getApiClient(e.ServerId).getScaledImageUrl(e.SeriesId,t);if("Thumb"===t.type){if(e.SeriesThumbImageTag)return t.tag=e.SeriesThumbImageTag,o.Z.getApiClient(e.ServerId).getScaledImageUrl(e.SeriesId,t);if(e.ParentThumbImageTag)return t.tag=e.ParentThumbImageTag,o.Z.getApiClient(e.ServerId).getScaledImageUrl(e.ParentThumbItemId,t)}return null}function l(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return t.type=t.type||"Primary",e.ImageTags&&e.ImageTags[t.type]?(t.tag=e.ImageTags[t.type],o.Z.getApiClient(e.ServerId).getScaledImageUrl(e.Id,t)):e.AlbumId&&e.AlbumPrimaryImageTag?(t.tag=e.AlbumPrimaryImageTag,o.Z.getApiClient(e.ServerId).getScaledImageUrl(e.AlbumId,t)):null}function d(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=m(e,t)||l(e,t);if(a){var i=t.height||t.maxHeight;return{src:a,sizes:i+"x"+i}}return null}function g(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[96,128,192,256,384,512],a=[];return t.forEach((function(t){var i=d(e,{height:t});null!==i&&a.push(i)})),a}function c(e,t,a){if("timeupdate"!==a){var i=t.NowPlayingItem;if(i){"init"===a&&(a="timeupdate");var n="Video"===i.MediaType,s=e.isLocalPlayer||!1;if(!s||!n){var o=t.PlayState||{},d=r.Z.getNowPlayingNames(i),c=d[d.length-1].text,p=1===d.length?"":d[0].text,I=i.Album||"",f=i.Id,v=parseInt(i.RunTimeTicks?i.RunTimeTicks/1e4:0),S=parseInt(o.PositionTicks?o.PositionTicks/1e4:0),h=o.IsPaused||!1,T=o.CanSeek||!1;if("mediaSession"in navigator)navigator.mediaSession.metadata=new MediaMetadata({title:p,artist:c,album:I,artwork:g(i)});else{var A=m(i,{maxHeight:3e3})||l(i,{maxHeight:3e3});u.Z.updateMediaSession({action:a,isLocalPlayer:s,itemId:f,title:p,artist:c,album:I,duration:v,position:S,imageUrl:A,canSeek:T,isPaused:h})}}}else y()}}function p(e){c(this,n.O.getPlayerState(this),e.type)}function I(e,t){c(this,t,"statechange")}function f(e,t){c(this,t,e.type)}function v(){y()}function y(){"mediaSession"in navigator?navigator.mediaSession.metadata=null:u.Z.hideMediaSession()}function S(e){i&&(s.Events.off(i,"playbackstart",f),s.Events.off(i,"playbackstop",v),s.Events.off(i,"unpause",p),s.Events.off(i,"pause",p),s.Events.off(i,"statechange",I),s.Events.off(i,"timeupdate",p),i=null,y()),e&&(i=e,c(e,n.O.getPlayerState(e),"init"),s.Events.on(i,"playbackstart",f),s.Events.on(i,"playbackstop",v),s.Events.on(i,"unpause",p),s.Events.on(i,"pause",p),s.Events.on(i,"statechange",I),s.Events.on(i,"timeupdate",p))}function h(e){n.O[e](i)}"mediaSession"in navigator&&(navigator.mediaSession.setActionHandler("previoustrack",(function(){h("previousTrack")})),navigator.mediaSession.setActionHandler("nexttrack",(function(){h("nextTrack")})),navigator.mediaSession.setActionHandler("play",(function(){h("unpause")})),navigator.mediaSession.setActionHandler("pause",(function(){h("pause")})),navigator.mediaSession.setActionHandler("seekbackward",(function(){h("rewind")})),navigator.mediaSession.setActionHandler("seekforward",(function(){h("fastForward")})),navigator.mediaSession.setActionHandler("seekto",(function(e){var t=n.O.getPlayerState(i).NowPlayingItem,a=parseInt(t.RunTimeTicks?t.RunTimeTicks/1e4:0),r=1e3*e.seekTime;n.O.seekPercent(r/a*100,i)}))),s.Events.on(n.O,"playerchange",(function(){S(n.O.getCurrentPlayer())})),S(n.O.getCurrentPlayer())},92642:function(e,t,a){a(61013),t.Z={getNowPlayingNames:function(e,t){var a=e,i=null,n=e.Name;e.AlbumId&&"Audio"===e.MediaType&&(a={Id:e.AlbumId,Name:e.Album,Type:"MusicAlbum",IsFolder:!0}),"Video"===e.MediaType&&(null!=e.IndexNumber&&(n=e.IndexNumber+" - "+n),null!=e.ParentIndexNumber&&(n=e.ParentIndexNumber+"."+n));var r="";e.ArtistItems&&e.ArtistItems.length?(i={Id:e.ArtistItems[0].Id,Name:e.ArtistItems[0].Name,Type:"MusicArtist",IsFolder:!0},r=e.ArtistItems.map((function(e){return e.Name})).join(", ")):e.Artists&&e.Artists.length?r=e.Artists.join(", "):e.SeriesName||e.Album?(r=n,n=e.SeriesName||e.Album,i=a,a=e.SeriesId?{Id:e.SeriesId,Name:e.SeriesName,Type:"Series",IsFolder:!0}:null):e.ProductionYear&&!1!==t&&(r=e.ProductionYear);var s=[];return s.push({text:n,item:a}),r&&s.push({text:r,item:i}),s}}}}]);