text: !function(){function t(t){return function(t){if(Array.isArray(t))return i(t)}(t)||function(t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)}(t)||n(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function e(t,e){var i;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(i=n(t))||e&&t&&"number"==typeof t.length){i&&(t=i);var r=0,a=function(){};return{s:a,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,o=!0,c=!1;return{s:function(){i=t[Symbol.iterator]()},n:function(){var t=i.next();return o=t.done,t},e:function(t){c=!0,s=t},f:function(){try{o||null==i.return||i.return()}finally{if(c)throw s}}}}function n(t,e){if(t){if("string"==typeof t)return i(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?i(t,e):void 0}}function i(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=new Array(e);n<e;n++)i[n]=t[n];return i}function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}function s(t,e,n){return e&&a(t.prototype,e),n&&a(t,n),t}(window.webpackJsonp=window.webpackJsonp||[]).push([[10],{"+ooL":function(t,e,n){"use strict";n.d(e,"a",(function(){return o}));var i=n("XNiG"),a=n("fXoL"),o=function(){var t=function(){function t(){r(this,t),this.colorSource=new i.a,this.blobSource=new i.a,this.color$=this.colorSource.asObservable(),this.blob$=this.blobSource.asObservable()}return s(t,[{key:"setColor",value:function(t){this.colorSource.next(t)}},{key:"setBlob",value:function(){this.blobSource.next(!0)}}]),t}();return t.\u0275fac=function(e){return new(e||t)},t.\u0275prov=a.Eb({token:t,factory:t.\u0275fac}),t}()},"/1T7":function(t,e,n){"use strict";n.d(e,"a",(function(){return i}));var i=function(){function t(e){r(this,t),this.tracks=[],this.discs=[],this.sortedDiscs=[],this.modified=0,this.isContinues=!0,e.album&&e.title&&(this.name=e.album,this.sortName=this.name.toUpperCase(),this.year=e.year,this.modified=e.modified,this.year&&-1!==this.year.indexOf("-")&&(this.year=this.year.split("-")[0]))}return s(t,[{key:"url",value:function(){return"/letter/".concat(this.artist.letter.escapedLetter,"/artist/").concat(encodeURIComponent(this.artist.name),"/album/").concat(encodeURIComponent(this.name))}}]),t}()},0:function(t,e,n){t.exports=n("zUnb")},"1gFc":function(t,e,n){"use strict";n.d(e,"a",(function(){return a}));var i=n("fXoL"),a=function(){var t=function(){function t(){r(this,t)}return s(t,[{key:"requestAnimation",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"enter",e=arguments.length>1?arguments[1]:void 0,n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];e&&(e.classList.contains(t)&&e.classList.remove(t),setTimeout((function(){e.classList.add(t)}),10),n&&setTimeout((function(){e.classList.remove(t)}),150))}}]),t}();return t.\u0275fac=function(e){return new(e||t)},t.\u0275prov=i.Eb({token:t,factory:t.\u0275fac}),t}()},Gcu2:function(t,e,n){"use strict";n.d(e,"a",(function(){return h}));var i=n("XNiG"),a=n("LNEh"),o=n("ktVm"),c=n("t083"),l=n("KI15"),u=n("fXoL"),h=function(){var t=function(){function t(e,n){r(this,t),this.coreService=e,this.lastfmservice=n,this.playlistSubject=new i.a,this.playlistAnnounced$=this.playlistSubject.asObservable(),this.numberOfTracksInAPlaylist=100,this.username=localStorage.getItem("lastfm-username"),this.core=this.coreService.getCore()}return s(t,[{key:"generateRandom",value:function(){var t=this,e=Object.keys(this.core.tracks),n=this.shuffle(e).splice(0,this.numberOfTracksInAPlaylist),i=new l.a;return i.name=this.numberOfTracksInAPlaylist+" random tracks",n.map((function(e){i.tracks.push(t.core.tracks[e])})),i}},{key:"generateRadio",value:function(){var t=this;this.lastfmservice.getTopArtists(this.username).subscribe((function(e){t.playlistSubject.next(t.extractArtists(e))}))}},{key:"extractTracks",value:function(t){var e=this,n=new l.a;return n.name="Loved tracks on Last.FM",t.map((function(t){var i=e.core.getTrackByArtistAndName(t.artist.name,t.name);i&&n.tracks.push(i)})),n}},{key:"extractArtists",value:function(t){var e=this,n=[],i=[];return t.forEach((function(t,r){t.dummy=!0;var s=new a.a(t),o=e.core.artists[s.sortName];o&&r<10?n.push(o):i.push(o)})),this.generateRadioList(n,i)}},{key:"generateRadioList",value:function(t,e){var n=new l.a;n.name=this.numberOfTracksInAPlaylist+" random tracks based on your recently listened tracks";for(var i=0;i<this.numberOfTracksInAPlaylist;i++)n.tracks.push(this.getRandomTrackFromList(i%3==0||i%5==0?t:i%4==0||i%7==0?e:this.core.artistsList()));return n}},{key:"getRandomTrackFromList",value:function(t){var e=this.shuffle(t)[0];if(e){var n=this.shuffle(e.albums)[0],i=this.shuffle(n.tracks)[0];return i.duration<=6e5?i:this.getRandomTrackFromList(t)}return this.getRandomTrackFromList(t)}},{key:"shuffle",value:function(t){for(var e=t.length-1;e>0;e--){var n=Math.floor(Math.random()*(e+1)),i=t[e];t[e]=t[n],t[n]=i}return t}},{key:"getNextTrackForPlaylist",value:function(t,e){var n=this.getRandomTrackFromList(t);if(n){var i=n.artist;return e.tracks.length>1&&e.tracks[e.tracks.length-1].artist===i&&t.length>1?this.getNextTrackForPlaylist(t,e):n}return null}}]),t}();return t.\u0275fac=function(e){return new(e||t)(u.Pb(o.a),u.Pb(c.a))},t.\u0275prov=u.Eb({token:t,factory:t.\u0275fac}),t}()},KI15:function(t,e,n){"use strict";n.d(e,"a",(function(){return i}));var i=function t(){r(this,t),this.tracks=[],this.isOwn=!1,this.isContinues=!1}},LNEh:function(t,e,n){"use strict";n.d(e,"a",(function(){return i}));var i=function(){function t(e){r(this,t),this.albums=[],(e.album&&e.title||e.dummy)&&(this.name=e.name||e.artist||"",this.albumArtist=e.albumartist||e.albumArtist||"",this.sortName=this.stripFromName(this.albumArtist?this.albumArtist.toUpperCase():e.sortName?e.sortName.toUpperCase():this.name.toUpperCase(),["the ",'"',"a "]),this.bio=e.bio,this.isCollection=!!this.albumArtist&&this.name!==this.albumArtist)}return s(t,[{key:"url",value:function(){return"/letter/".concat(this.letter.escapedLetter,"/artist/").concat(encodeURIComponent(this.albumArtist||this.name),"/")}},{key:"sortAlbumsBy",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"name",e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"asc",n=new Intl.Collator("en");this.albums.sort((function(i,r){var a,s;if(-1!==t.indexOf(".")){var o=t.split(".");a=i[o[0]][o[1]],s=r[o[0]][o[1]]}else a="year"!==t?i[t].toUpperCase():i[t],s="year"!==t?r[t].toUpperCase():r[t];var c=n.compare(a,s);return"asc"===e?c:-1*c}))}},{key:"sortAndReturnAlbumsBy",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"name",e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"asc";return this.sortAlbumsBy(t,e),this.albums}},{key:"stripFromName",value:function(t,e){var n=t?t.toUpperCase():"";return n=n.trim(),e.forEach((function(t){var e=t.toUpperCase();0===n.indexOf(e)&&(n=n.substring(e.length))})),n}}]),t}()},MDLy:function(t,e,n){"use strict";n.d(e,"a",(function(){return u}));var i=n("z6cu"),a=n("JIr8"),o=n("Kj3r"),c=n("fXoL"),l=n("tk/3"),u=function(){var t=function(){function t(e){r(this,t),this.http=e,this.collectionUrl="/data/node-music.json",this.reloadUrl="/rescan",this.pollUrl="/progress",this.dsm=localStorage.getItem("dsm")}return s(t,[{key:"getCollection",value:function(){return this.dsm=localStorage.getItem("dsm"),this.http.get(this.dsm+this.collectionUrl).pipe(Object(a.a)(this.handleError))}},{key:"reload",value:function(){var t=this.dsm+this.reloadUrl,e=localStorage.getItem("jwt");return this.http.get("".concat(t,"?_ts=").concat((new Date).getTime(),"&jwt=").concat(e)).pipe(Object(a.a)(this.handleError))}},{key:"poll",value:function(){var t=this.dsm+this.pollUrl,e=localStorage.getItem("jwt");return this.http.get("".concat(t,"?_ts=").concat((new Date).getTime(),"&jwt=").concat(e)).pipe(Object(o.a)(300),Object(a.a)(this.handleError))}},{key:"handleError",value:function(t){var e=t.message?t.message:t.status?"".concat(t.status," - ").concat(t.statusText):"Server error";return Object(i.a)(e)}}]),t}();return t.\u0275fac=function(e){return new(e||t)(c.Pb(l.a))},t.\u0275prov=c.Eb({token:t,factory:t.\u0275fac}),t}()},OgP6:function(t,e,n){"use strict";n.d(e,"a",(function(){return u}));var i=n("XNiG"),a=n("z6cu"),o=n("JIr8"),c=n("fXoL"),l=n("tk/3"),u=function(){var t=function(){function t(e){r(this,t),this.http=e,this.geoSource=new i.a,this.themeSource=new i.a,this.modeSource=new i.a,this.theme$=this.themeSource.asObservable(),this.mode$=this.modeSource.asObservable(),this.geo$=this.geoSource.asObservable(),this._theme=localStorage.getItem("theme")||"light",this._mode="light",this.counter=0,this.COUNTERTIMER=6e4}return s(t,[{key:"getSunriseInfo",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:51,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:5;return this.http.get("https://api.sunrise-sunset.org/json?lat=".concat(t,"&lng=").concat(e,"&formatted=0")).pipe(Object(o.a)(this.handleError))}},{key:"applyTheme",value:function(){var t=this;"auto"===this._theme?(this.counter||(this.counter=setInterval((function(){t.checkTheme()}),this.COUNTERTIMER)),this.checkTheme(!0)):this.setStyleSheet(this._theme)}},{key:"checkTheme",value:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],e=new Date;e<this.stopDate&&e>this.startDate&&"dark"!==this._mode?(this._mode="dark",this.setStyleSheet(this._mode)):(e>this.stopDate||e<this.startDate)&&"light"!==this._mode&&(this._mode="light",this.setStyleSheet(this._mode)),t&&this.setStyleSheet(this._mode)}},{key:"handleError",value:function(t){return Object(a.a)(null)}},{key:"setStyleSheet",value:function(t){var e=document.createElement("link");e.setAttribute("rel","stylesheet"),e.setAttribute("type","text/css"),e.setAttribute("href","prod"!==window.ENV&&window.ENV?"/dist/sass/".concat(t,".css"):"global/css/".concat(t,".css")),e.setAttribute("id","customStylesheet");var n=document.getElementById("customStylesheet");n&&document.getElementsByTagName("head")[0].removeChild(n),document.getElementsByTagName("head")[0].appendChild(e),localStorage.setItem("theme",this._theme),localStorage.setItem("style",t),this.themeSource.next(this._theme),this.modeSource.next(t)}},{key:"theme",get:function(){return this._theme},set:function(t){var e=this;this._theme!==t&&(this._theme=t),"auto"!==this._theme||this.counter?"auto"===this._theme||(this.setStyleSheet(this._theme),clearInterval(this.counter),this.counter=0,this._mode=this._theme):(this.counter=setInterval((function(){e.checkTheme()}),this.COUNTERTIMER),this.checkTheme())}},{key:"mode",get:function(){return this._mode}}]),t}();return t.\u0275fac=function(e){return new(e||t)(c.Pb(l.a))},t.\u0275prov=c.Eb({token:t,factory:t.\u0275fac}),t}()},XNvx:function(t,e,n){"use strict";n.d(e,"a",(function(){return l}));var i=n("z6cu"),a=n("tk/3"),o=n("JIr8"),c=n("fXoL"),l=function(){var t=function(){function t(e){r(this,t),this.http=e,this.hasToken=!1,localStorage.getItem("jwt")&&(this.hasToken=!0)}return s(t,[{key:"doLogin",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=t;if(!e)throw new Error("You should log in via the webcrypto flow; contact me");var i={headers:new a.c({"X-Cred":n})};return this.http.post(localStorage.getItem("dsm")+"/login",null,i).pipe(Object(o.a)(this.handleError))}},{key:"autoLogin",value:function(){var t=localStorage.getItem("jwt");return t?this.doLogin(t,!0):(localStorage.removeItem("jwt"),Object(i.a)(null))}},{key:"versionCheck",value:function(t){return this.http.get(t+"/version")}},{key:"getPublicKey",value:function(t){return this.http.get(t+"/public-key")}},{key:"authenticate",value:function(t,e){return this.http.post(t+"/authenticate",{encryptedPayload:this.arrayBufferToBase64(e)})}},{key:"handleError",value:function(t){return Object(i.a)(null)}},{key:"arrayBufferToBase64",value:function(t){return btoa(new Uint8Array(t).reduce((function(t,e){return t+String.fromCharCode(e)}),""))}}]),t}();return t.\u0275fac=function(e){return new(e||t)(c.Pb(a.a))},t.\u0275prov=c.Eb({token:t,factory:t.\u0275fac}),t}()},XtVx:function(t,e,n){"use strict";n.d(e,"a",(function(){return o}));var i=n("XNiG"),a=n("fXoL"),o=function(){var t=function(){function t(){r(this,t),this.pathAnnouncementSource=new i.a,this.pageAnnouncementSource=new i.a,this.pathAnnounced$=this.pathAnnouncementSource.asObservable(),this.pageAnnounced$=this.pageAnnouncementSource.asObservable()}return s(t,[{key:"announcePath",value:function(t){this.pathAnnouncementSource.next(t)}},{key:"announcePage",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;this.pageAnnouncementSource.next({page:t,letter:e})}}]),t}();return t.\u0275fac=function(e){return new(e||t)},t.\u0275prov=a.Eb({token:t,factory:t.\u0275fac}),t}()},crnd:function(t,e){function n(t){return Promise.resolve().then((function(){var e=new Error("Cannot find module '"+t+"'");throw e.code="MODULE_NOT_FOUND",e}))}n.keys=function(){return[]},n.resolve=n,t.exports=n,n.id="crnd"},hDf6:function(t,e,n){"use strict";n.d(e,"a",(function(){return s}));var i=n("ofXK"),a=n("fXoL"),s=function(){var t=function t(){r(this,t)};return t.\u0275mod=a.Gb({type:t}),t.\u0275inj=a.Fb({factory:function(e){return new(e||t)},imports:[[i.b]]}),t}()},ktVm:function(t,n,i){"use strict";i.d(n,"a",(function(){return v}));var a,o=i("XNiG"),c=i("/1T7"),l=i("LNEh"),u=i("o8Y7"),h=function(){function t(e){r(this,t),this.artists=[],this.active=!1,e.album&&e.title&&(this.letter=e.letter||this.getFirstLetterOf(e.albumArtist||e.albumartist||e.artist),"1"===this.letter&&(this.letter="#"),this.escapedLetter=encodeURIComponent(this.letter))}return s(t,[{key:"url",value:function(){return"/letter/".concat(this.escapedLetter,"/")}},{key:"sortArtistsBy",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"sortName",e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"asc";if("albums"===t)this.artists.sort((function(t,n){return t.albums.length>n.albums.length?"asc"===e?-1:1:t.albums.length<n.albums.length?"asc"===e?1:-1:0}));else{var n=new Intl.Collator("en");this.artists.sort((function(i,r){var a,s;if(-1!==t.indexOf(".")){var o=t.split(".");a=i[o[0]][o[1]],s=r[o[0]][o[1]]}else a=i[t].toUpperCase(),s=r[t].toUpperCase();var c=n.compare(a,s);return"asc"===e?c:-1*c}))}}},{key:"sortAndReturnArtistsBy",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"name",e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"asc";return this.sortArtistsBy(t,e),this.artists}},{key:"getFirstLetterOf",value:function(t){var e="";return e=this.stripFromName(t,["the ",'"',"a "]),this.groupIfSpecialChar(e.substr(0,1))}},{key:"stripFromName",value:function(t,e){var n=t?t.toUpperCase():"";return n=n.trim(),e.forEach((function(t){var e=t.toUpperCase();0===n.indexOf(e)&&(n=n.substring(e.length))})),Object(u.a)(n)}},{key:"groupIfSpecialChar",value:function(t){return-1!==["1","2","3","4","5","6","7","8","9","0","(",")","[","]","{","}","_","-","."].indexOf(t)?"#":t}}]),t}(),d=i("YGJC"),b=function t(){var e=this;r(this,t),this.doSearch=function(t){var n=t.query,i=t.keys,r=void 0===i?["name"]:i,a=t.list;return new d.a(a,e.options(r)).search(n).map((function(t){return t.item}))},this.options=function(t){return{keys:t,threshold:.25,shouldSort:!0}}},f=i("uwnU"),m=function t(e){r(this,t),this.albums=[],this.sanitize=function(t){var e=parseInt(t,10);return isNaN(e)&&(e=0),e},e.year&&(this.year=this.sanitize(e.year))},p=function(){function t(){r(this,t),this.artists={},this.albums={},this.tracks={},this.letters={},this.years={},this.sortedLetters=[],this.sortedAlbums=[],this.isCoreParsed=!1,this.coreParsedSource=new o.a,this.coreParsed$=this.coreParsedSource.asObservable(),this.totals={artists:0,albums:0,tracks:0,playingTime:0,parsingTime:0},this.latestAdditions=[],this.search=new b,console.info("Core init 1.6.1")}return s(t,[{key:"resetCollection",value:function(){this.artists={},this.albums={},this.tracks={},this.letters={},this.years={},this.sortedLetters=[],this.sortedAlbums=[],this.totals={artists:0,albums:0,tracks:0,playingTime:0,parsingTime:0},this.latestAdditions=[]}},{key:"parseSourceJson",value:function(t){var n=this,i=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=(new Date).getTime();if(t.length){var a,s=e(t);try{for(s.s();!(a=s.n()).done;){var o=a.value;this.parseLine(o,i)}}catch(u){s.e(u)}finally{s.f()}}else t.tree&&this.parseTree(t.tree);var c=Object.keys(this.letters).sort((function(t,e){return t<e?-1:1})),l=[];c.forEach((function(t,e){l.push(n.letters[t]),n.letters[t].sortAndReturnArtistsBy("name","asc")})),this.sortedLetters=l,this.totals.parsingTime+=(new Date).getTime()-r,this.coreParsedSource.next(!0),this.isCoreParsed=!0}},{key:"getTrackByArtistAndName",value:function(t,e){var n=new l.a({name:t,dummy:!0}),i=this.artists[n.sortName],r=null;return i&&i.albums.some((function(t){t.tracks.some((function(t){if(t.title&&t.title.toLowerCase()===e.toLowerCase())return r||(r=t),!0}))})),r}},{key:"getTrackById",value:function(t){var e=new f.a({});return this.tracks.forEach((function(n){n.id===t&&(e=n)})),e}},{key:"getArtistByName",value:function(t){var e=new l.a({name:t,dummy:!0});return this.artists[e.sortName]}},{key:"getAlbumByArtistAndName",value:function(t,e){var n=null;return t.albums.forEach((function(t){t.name.toLowerCase()===e.toLowerCase()&&(n=t)})),n}},{key:"getTrackByAlbumAndName",value:function(t,e){var n=null;return t.tracks.forEach((function(t){t.title.toLowerCase()===e.toLowerCase()&&(n=t)})),n}},{key:"artistsList",value:function(){var t=this,e=[];return Object.keys(this.artists).sort((function(t,e){return t<e?-1:1})).forEach((function(n,i){e.push(t.artists[n])})),e}},{key:"trackList",value:function(){var t=this,e=[];return Object.keys(this.tracks).sort((function(t,e){return t<e?-1:1})).forEach((function(n,i){e.push(t.tracks[n])})),e}},{key:"searchArtist",value:function(t){return this.search.doSearch({query:t,list:this.artistsList()})}},{key:"searchAlbum",value:function(t){return this.search.doSearch({query:t,list:this.sortedAlbums})}},{key:"searchTrack",value:function(t){return this.search.doSearch({query:t,keys:["title"],list:this.trackList()})}},{key:"getLatestAdditions",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:14;return 0!==this.latestAdditions.length||(this.sortedAlbums.sort((function(t,e){return t.modified>e.modified?-1:t.modified<e.modified?1:0})),this.latestAdditions=this.sortedAlbums.splice(0,t)),this.latestAdditions}},{key:"getNextAlbum",value:function(t){var e=t.artist,n=e.albums.indexOf(t),i=e.albums[n+1];return i||(i=this.getNextArtist(e).albums[0]),i}},{key:"getNextArtist",value:function(t){var e=t.letter,n=e.artists.indexOf(t),i=e.artists[n+1];return i||(i=this.getNextLetter(e).artists[0]),i}},{key:"getNextLetter",value:function(t){var e=this.sortedLetters.indexOf(t),n=this.sortedLetters[e+1];return n||(n=this.sortedLetters[0]),n}},{key:"instanceIfPresent",value:function(t,e,n,i,r){var a=null;return n[e]?a=n[e]:(n[e]=i,a=i,r(t)),a}},{key:"handleLetter",value:function(t){return this.instanceIfPresent(this,t.letter,this.letters,t,(function(t){}))}},{key:"handleArtist",value:function(t,e){return this.instanceIfPresent(this,e.sortName,this.artists,e,(function(n){t.artists.push(e),e.letter=t,n.totals.artists++}))}},{key:"handleAlbum",value:function(t,e){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return this.instanceIfPresent(this,t.sortName+"|"+e.sortName,this.albums,e,(function(i){if("flac"===e.type&&n||"flac"!==e.type)if(e.artist=t,t.albums.push(e),t.sortAndReturnAlbumsBy("year","asc"),i.sortedAlbums.push(e),i.totals.albums++,i.years[e.year])i.years[e.year].albums.push(e);else{var r=new m(e);r.albums.push(e),i.years[r.year]=r}}))}},{key:"handleTrack",value:function(t,e,n){var i=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];return this.instanceIfPresent(this,n.id,this.tracks,n,(function(r){if(e.type=e.type&&e.type!==n.type?"mixed":n.type,"flac"===n.type&&i||"flac"!==n.type){r.totals.tracks++,r.totals.playingTime+=n.duration,n.artist=t,n.album=e,e.tracks.push(n);var a=n.disc;e.discs["disc-"+a]||(e.discs["disc-"+a]=[]),e.discs["disc-"+a].push(n),e.discs["disc-"+a].sort((function(t,e){return t.number<e.number?-1:1})),e.tracks.sort((function(t,e){return t.disc<e.disc||t.disc===e.disc&&t.number<e.number?-1:1}))}else console.warn("skipping flac track, flac is not supported")}))}},{key:"parseLine",value:function(t){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=new h(t);n.letter&&(n=this.handleLetter(n));var i=new l.a(t);i.name&&(i=this.handleArtist(n,i));var r=new c.a(t);r.name&&(r=this.handleAlbum(i,r,e));var a=new f.a(t);a.title&&(a=this.handleTrack(i,r,a,e))}},{key:"parseTree",value:function(t){for(var e in t){var n=new h(t[e]);for(var i in n=this.handleLetter(n),t[e].artists){var r=new l.a(t[e].artists[i]);for(var a in r=this.handleArtist(n,r),t[e].artists[i].albums){var s=new c.a(t[e].artists[i].albums[a]);for(var o in s=this.handleAlbum(r,s),t[e].artists[i].albums[a].tracks){var u=new f.a(t[e].artists[i].albums[a].tracks[o]);u=this.handleTrack(r,s,u)}}}}}}]),t}(),g=i("fXoL"),v=((a=function(){function t(){r(this,t),this.core=new p}return s(t,[{key:"getCore",value:function(){return this.core}}]),t}()).\u0275fac=function(t){return new(t||a)},a.\u0275prov=g.Eb({token:a,factory:a.\u0275fac}),a)},t083:function(t,e,n){"use strict";n.d(e,"a",(function(){return m}));var i,a=n("XNiG"),o=n("z6cu"),c=n("JIr8"),l=n("tk/3"),u=n("ztCj"),h=function(){function t(){r(this,t)}return s(t,[{key:"encodeKey",value:function(t){return encodeURIComponent(t)}},{key:"encodeValue",value:function(t){return encodeURIComponent(t)}},{key:"decodeKey",value:function(t){return decodeURIComponent(t)}},{key:"decodeValue",value:function(t){return decodeURIComponent(t)}}]),t}(),d=n("fXoL"),b="956c1818ded606576d6941de5ff793a5",f="4d183e73f7578dee78557665e9be3acc",m=((i=function(){function t(e){r(this,t),this.http=e,this.manualScrobbleListSource=new a.a,this.manualScrobbleList$=this.manualScrobbleListSource.asObservable(),this.hexcase=0,this.b64pad=""}return s(t,[{key:"getLovedTracks",value:function(t){return this.http.get("https://ws.audioscrobbler.com/2.0/",{params:{api_key:b,format:"json",limit:"1000",method:"user.getlovedtracks",user:t}}).pipe(Object(c.a)(this.handleError))}},{key:"toggleLoved",value:function(t){var e=localStorage.getItem("lastfm-token"),n=(new URLSearchParams,t.isLoved?"track.love":"track.unlove"),i=new l.d({encoder:new h}).set("method",n).set("api_key",b).set("api_sig",this.signTrack(t.trackArtist,t.album.name,t.title,null,e,n)).set("artist",t.trackArtist).set("album",t.album.name).set("track",t.title).set("sk",e),r=new l.c({"Content-Type":"application/x-www-form-urlencoded"});return this.http.post("https://ws.audioscrobbler.com/2.0/",null,{params:i,headers:r}).pipe(Object(c.a)(this.handleError))}},{key:"getTrackInfo",value:function(t,e){if(t){var n=new l.d({encoder:new h}).set("method","track.getInfo").set("artist",t.trackArtist).set("album",t.album.name).set("track",t.title).set("api_key",b).set("format","json").set("user",e);return this.http.get("https://ws.audioscrobbler.com/2.0/",{params:n}).pipe(Object(c.a)(this.handleError))}return Object(o.a)(null)}},{key:"getTopArtists",value:function(t){var e=new l.d({encoder:new h}).set("api_key",b).set("format","json").set("limit","50").set("method","user.gettopartists").set("period","1month").set("user",t);return this.http.get("https://ws.audioscrobbler.com/2.0/",{params:e}).pipe(Object(c.a)(this.handleError))}},{key:"getSimilairArtists",value:function(t){var e=new l.d({encoder:new h}).set("api_key",b).set("format","json").set("limit","20").set("autocorrect","1").set("method","artist.getSimilar").set("artist",t.name);return this.http.get("https://ws.audioscrobbler.com/2.0/",{params:e}).pipe(Object(c.a)(this.handleError))}},{key:"authenticate",value:function(t){var e=new l.d({encoder:new h}).set("api_key",b).set("api_sig",this.signAuthentication(t.user,t.password)).set("format","json").set("username",t.user).set("password",t.password),n=new l.c({"Content-Type":"application/x-www-form-urlencoded"});return this.http.post("https://ws.audioscrobbler.com/2.0/?method=auth.getMobileSession",null,{params:e,headers:n}).pipe(Object(c.a)(this.handleError))}},{key:"announceNowPlaying",value:function(t){if("mdb-skipped"!==localStorage.getItem("lastfm-username")){var e=new Date,n=Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes()+e.getTimezoneOffset(),e.getSeconds())/1e3,i=localStorage.getItem("lastfm-token"),r=new l.c({"Content-Type":"application/x-www-form-urlencoded"}),a=new l.d({encoder:new h}).set("method","track.updateNowPlaying").set("api_key",b).set("api_sig",this.signTrack(t.trackArtist,t.album.name,t.title,n,i,"track.updateNowPlaying")).set("artist",t.trackArtist).set("album",t.album.name).set("track",t.title).set("timestamp",n.toString()).set("sk",i);return this.http.post("https://ws.audioscrobbler.com/2.0/",null,{params:a,headers:r}).pipe(Object(c.a)(this.handleError))}}},{key:"scrobbleTrack",value:function(t){var e=this,n=localStorage.getItem("lastfm-username"),i=new Date,r=Date.UTC(i.getFullYear(),i.getMonth(),i.getDate(),i.getHours(),i.getMinutes()+i.getTimezoneOffset(),i.getSeconds())/1e3;if("mdb-skipped"!==n){var a=localStorage.getItem("lastfm-token");if(!this.booleanState("manual-scrobble-state")){var s=new l.c({"Content-Type":"application/x-www-form-urlencoded"}),o=new l.d({encoder:new h}).set("method","track.scrobble").set("api_key",b).set("api_sig",this.signTrack(t.trackArtist,t.album.name,t.title,r,a,"track.scrobble")).set("artist",t.trackArtist).set("album",t.album.name).set("track",t.title).set("timestamp",r.toString()).set("sk",a);return this.http.post("https://ws.audioscrobbler.com/2.0/",null,{params:o,headers:s}).pipe(Object(c.a)(this.handleError))}Object(u.c)("manual-scrobble-list").then((function(n){var i=n||[],a={artist:t.trackArtist,album:t.album.name,track:t.title,timestamp:r.toString()};i.unshift(a),Object(u.d)("manual-scrobble-list",i),e.manualScrobbleListSource.next(i)}))}else{var d="art-".concat(t.trackArtist,"-").concat(t.album.name);Object(u.c)(d).then((function(n){e.saveInLocal(t,r,n||"global/images/no-cover.png")}))}}},{key:"updateManualScrobbleList",value:function(){var t=this;Object(u.c)("manual-scrobble-list").then((function(e){t.manualScrobbleListSource.next(e||[])}))}},{key:"saveInLocal",value:function(t,e,n){var i={artist:{"#text":t.trackArtist},album:{"#text":t.album.name},image:[{"#text":n}],name:t.title,date:{uts:e}},r=[];Object(u.c)("recentlyListened").then((function(t){t&&((r=t.tracks).length>10&&(r=r.splice(0,10)),t._rev),r.unshift(i);var e={_id:"recentlyListened",tracks:r};Object(u.d)(e._id,e.tracks)}))}},{key:"scrobbleCachedTrack",value:function(t){var e=localStorage.getItem("lastfm-token"),n=new l.c({"Content-Type":"application/x-www-form-urlencoded"}),i=new l.d({encoder:new h}).set("method","track.scrobble").set("api_key",b).set("api_sig",this.signTrack(t.artist,t.album,t.track,t.timestamp,e,"track.scrobble")).set("artist",t.artist).set("album",t.album).set("track",t.track).set("timestamp",t.timestamp.toString()).set("sk",e);return this.http.post("https://ws.audioscrobbler.com/2.0/",null,{params:i,headers:n,responseType:"text"}).pipe(Object(c.a)(this.handleError))}},{key:"booleanState",value:function(t){var e=localStorage.getItem(t);return!(!e||"true"!==e)}},{key:"signAuthentication",value:function(t,e){return this.hex_md5("api_key".concat(b,"methodauth.getMobileSessionpassword").concat(e,"username").concat(t).concat(f))}},{key:"signTrack",value:function(t,e,n,i,r,a){return this.hex_md5(i?"album".concat(e,"api_key").concat(b,"artist").concat(t,"method").concat(a,"sk").concat(r,"timestamp").concat(i,"track").concat(n).concat(f):"album".concat(e,"api_key").concat(b,"artist").concat(t,"method").concat(a,"sk").concat(r,"track").concat(n).concat(f))}},{key:"handleError",value:function(t){return Object(o.a)(null)}},{key:"hex_md5",value:function(t){return this.rstr2hex(this.rstr_md5(this.str2rstr_utf8(t)))}},{key:"rstr2hex",value:function(t){try{this.hexcase=this.hexcase}catch(a){this.hexcase=0}for(var e,n=this.hexcase?"0123456789ABCDEF":"0123456789abcdef",i="",r=0;r<t.length;r++)e=t.charCodeAt(r),i+=n.charAt(e>>>4&15)+n.charAt(15&e);return i}},{key:"rstr_md5",value:function(t){return this.binl2rstr(this.binl_md5(this.rstr2binl(t),8*t.length))}},{key:"str2rstr_utf8",value:function(t){for(var e,n,i="",r=-1;++r<t.length;)e=t.charCodeAt(r),n=r+1<t.length?t.charCodeAt(r+1):0,55296<=e&&e<=56319&&56320<=n&&n<=57343&&(e=65536+((1023&e)<<10)+(1023&n),r++),e<=127?i+=String.fromCharCode(e):e<=2047?i+=String.fromCharCode(192|e>>>6&31,128|63&e):e<=65535?i+=String.fromCharCode(224|e>>>12&15,128|e>>>6&63,128|63&e):e<=2097151&&(i+=String.fromCharCode(240|e>>>18&7,128|e>>>12&63,128|e>>>6&63,128|63&e));return i}},{key:"binl2rstr",value:function(t){for(var e="",n=0;n<32*t.length;n+=8)e+=String.fromCharCode(t[n>>5]>>>n%32&255);return e}},{key:"binl_md5",value:function(t,e){t[e>>5]|=128<<e%32,t[14+(e+64>>>9<<4)]=e;for(var n=1732584193,i=-271733879,r=-1732584194,a=271733878,s=0;s<t.length;s+=16){var o=n,c=i,l=r,u=a;n=this.md5_ff(n,i,r,a,t[s+0],7,-680876936),a=this.md5_ff(a,n,i,r,t[s+1],12,-389564586),r=this.md5_ff(r,a,n,i,t[s+2],17,606105819),i=this.md5_ff(i,r,a,n,t[s+3],22,-1044525330),n=this.md5_ff(n,i,r,a,t[s+4],7,-176418897),a=this.md5_ff(a,n,i,r,t[s+5],12,1200080426),r=this.md5_ff(r,a,n,i,t[s+6],17,-1473231341),i=this.md5_ff(i,r,a,n,t[s+7],22,-45705983),n=this.md5_ff(n,i,r,a,t[s+8],7,1770035416),a=this.md5_ff(a,n,i,r,t[s+9],12,-1958414417),r=this.md5_ff(r,a,n,i,t[s+10],17,-42063),i=this.md5_ff(i,r,a,n,t[s+11],22,-1990404162),n=this.md5_ff(n,i,r,a,t[s+12],7,1804603682),a=this.md5_ff(a,n,i,r,t[s+13],12,-40341101),r=this.md5_ff(r,a,n,i,t[s+14],17,-1502002290),i=this.md5_ff(i,r,a,n,t[s+15],22,1236535329),n=this.md5_gg(n,i,r,a,t[s+1],5,-165796510),a=this.md5_gg(a,n,i,r,t[s+6],9,-1069501632),r=this.md5_gg(r,a,n,i,t[s+11],14,643717713),i=this.md5_gg(i,r,a,n,t[s+0],20,-373897302),n=this.md5_gg(n,i,r,a,t[s+5],5,-701558691),a=this.md5_gg(a,n,i,r,t[s+10],9,38016083),r=this.md5_gg(r,a,n,i,t[s+15],14,-660478335),i=this.md5_gg(i,r,a,n,t[s+4],20,-405537848),n=this.md5_gg(n,i,r,a,t[s+9],5,568446438),a=this.md5_gg(a,n,i,r,t[s+14],9,-1019803690),r=this.md5_gg(r,a,n,i,t[s+3],14,-187363961),i=this.md5_gg(i,r,a,n,t[s+8],20,1163531501),n=this.md5_gg(n,i,r,a,t[s+13],5,-1444681467),a=this.md5_gg(a,n,i,r,t[s+2],9,-51403784),r=this.md5_gg(r,a,n,i,t[s+7],14,1735328473),i=this.md5_gg(i,r,a,n,t[s+12],20,-1926607734),n=this.md5_hh(n,i,r,a,t[s+5],4,-378558),a=this.md5_hh(a,n,i,r,t[s+8],11,-2022574463),r=this.md5_hh(r,a,n,i,t[s+11],16,1839030562),i=this.md5_hh(i,r,a,n,t[s+14],23,-35309556),n=this.md5_hh(n,i,r,a,t[s+1],4,-1530992060),a=this.md5_hh(a,n,i,r,t[s+4],11,1272893353),r=this.md5_hh(r,a,n,i,t[s+7],16,-155497632),i=this.md5_hh(i,r,a,n,t[s+10],23,-1094730640),n=this.md5_hh(n,i,r,a,t[s+13],4,681279174),a=this.md5_hh(a,n,i,r,t[s+0],11,-358537222),r=this.md5_hh(r,a,n,i,t[s+3],16,-722521979),i=this.md5_hh(i,r,a,n,t[s+6],23,76029189),n=this.md5_hh(n,i,r,a,t[s+9],4,-640364487),a=this.md5_hh(a,n,i,r,t[s+12],11,-421815835),r=this.md5_hh(r,a,n,i,t[s+15],16,530742520),i=this.md5_hh(i,r,a,n,t[s+2],23,-995338651),n=this.md5_ii(n,i,r,a,t[s+0],6,-198630844),a=this.md5_ii(a,n,i,r,t[s+7],10,1126891415),r=this.md5_ii(r,a,n,i,t[s+14],15,-1416354905),i=this.md5_ii(i,r,a,n,t[s+5],21,-57434055),n=this.md5_ii(n,i,r,a,t[s+12],6,1700485571),a=this.md5_ii(a,n,i,r,t[s+3],10,-1894986606),r=this.md5_ii(r,a,n,i,t[s+10],15,-1051523),i=this.md5_ii(i,r,a,n,t[s+1],21,-2054922799),n=this.md5_ii(n,i,r,a,t[s+8],6,1873313359),a=this.md5_ii(a,n,i,r,t[s+15],10,-30611744),r=this.md5_ii(r,a,n,i,t[s+6],15,-1560198380),i=this.md5_ii(i,r,a,n,t[s+13],21,1309151649),n=this.md5_ii(n,i,r,a,t[s+4],6,-145523070),a=this.md5_ii(a,n,i,r,t[s+11],10,-1120210379),r=this.md5_ii(r,a,n,i,t[s+2],15,718787259),i=this.md5_ii(i,r,a,n,t[s+9],21,-343485551),n=this.safe_add(n,o),i=this.safe_add(i,c),r=this.safe_add(r,l),a=this.safe_add(a,u)}return Array(n,i,r,a)}},{key:"rstr2binl",value:function(t){for(var e=Array(t.length>>2),n=0;n<e.length;n++)e[n]=0;for(var i=0;i<8*t.length;i+=8)e[i>>5]|=(255&t.charCodeAt(i/8))<<i%32;return e}},{key:"md5_cmn",value:function(t,e,n,i,r,a){return this.safe_add(this.bit_rol(this.safe_add(this.safe_add(e,t),this.safe_add(i,a)),r),n)}},{key:"md5_ff",value:function(t,e,n,i,r,a,s){return this.md5_cmn(e&n|~e&i,t,e,r,a,s)}},{key:"md5_gg",value:function(t,e,n,i,r,a,s){return this.md5_cmn(e&i|n&~i,t,e,r,a,s)}},{key:"md5_hh",value:function(t,e,n,i,r,a,s){return this.md5_cmn(e^n^i,t,e,r,a,s)}},{key:"md5_ii",value:function(t,e,n,i,r,a,s){return this.md5_cmn(n^(e|~i),t,e,r,a,s)}},{key:"safe_add",value:function(t,e){var n=(65535&t)+(65535&e);return(t>>16)+(e>>16)+(n>>16)<<16|65535&n}},{key:"bit_rol",value:function(t,e){return t<<e|t>>>32-e}}]),t}()).\u0275fac=function(t){return new(t||i)(d.Pb(l.a))},i.\u0275prov=d.Eb({token:i,factory:i.\u0275fac}),i)},ufXC:function(e,n,i){"use strict";i.d(n,"a",(function(){return b}));var a=i("ztCj"),o=i("XNiG"),c=i("KI15"),l=i("Gcu2"),u=i("ktVm"),h=i("t083"),d=i("fXoL"),b=function(){var e=function(){function e(t,n,i){var a=this;r(this,e),this.lastFMService=t,this.coreService=n,this.playlistService=i,this.playlistSource=new o.a,this.volumeSource=new o.a,this.hideVolumeWindowAsSource=new o.a,this.playlistAnnounced$=this.playlistSource.asObservable(),this.volumeAnnounced=this.volumeSource.asObservable(),this.hideVolumeWindowAnnounced$=this.hideVolumeWindowAsSource.asObservable(),this.isPlaying=!1,this.isPaused=!1,this.isShuffled=!1,this.forceRestart=!1,this.volume=100,this.lastfmUserName=localStorage.getItem("lastfm-username"),this.subscription=this.playlistService.playlistAnnounced$.subscribe((function(t){a.doPlayPlaylist(t,0,!0,a.isShuffled)}))}return s(e,[{key:"setPosition",value:function(t){this.position=t,this.announce(),this.position=null}},{key:"doPlayAlbum",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];this.currentTrack&&(this.currentTrack.isPaused=!1,this.currentTrack.isPlaying=!1),this.setPlaylist(t,e,n,i,"album"),this.announce()}},{key:"doQueueAlbum",value:function(e){var n=this.currentPlaylist,i=n.playlist,r=n.startIndex,a=new c.a;a.name="queued playlist",a.type="queue",a.tracks=[].concat(t(i.tracks),t(e.tracks)),this.setPlaylist(a,r,!1,!1,"playlist")}},{key:"doPlayPlaylist",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];this.currentTrack&&(this.currentTrack.isPaused=!1,this.currentTrack.isPlaying=!1),this.setPlaylist(t,e,n,i,"playlist"),this.announce()}},{key:"doPlayTrack",value:function(t){this.currentTrack&&(this.currentTrack.isPaused=!1,this.currentTrack.isPlaying=!1);var e=new c.a;e.isOwn=!0,e.name=t.title,e.tracks.push(t),this.currentPlaylist={playlist:e,startIndex:0,isPlaying:this.isPlaying=!0,isPaused:this.isPaused=!1,isShuffled:!1,forceRestart:this.forceRestart=!0,isContinues:!1},this.announce()}},{key:"nextPlaylist",value:function(t){if(this.booleanState("continues-play"))if("random"===t){var e=this.playlistService.generateRandom();this.doPlayPlaylist(e,0,!0,this.isShuffled)}else this.playlistService.generateRadio();else this.stop()}},{key:"nextAlbum",value:function(t){if(this.booleanState("continues-play")){var e=this.coreService.getCore().getNextAlbum(t);e?this.doPlayAlbum(e,0,!0,this.isShuffled):(console.warn("no new album found, stopping playback"),this.stop())}else this.stop()}},{key:"playlistToString",value:function(){var t=[];return this.currentPlaylist.playlist.tracks.forEach((function(e){e&&t.push(e.id)})),JSON.stringify({ids:t,isShuffled:this.isShuffled,isContinues:this.currentPlaylist.isContinues,current:this.currentPlaylist.startIndex,type:this.currentPlaylist.type})}},{key:"playlistSync",value:function(){var t=[];return this.currentPlaylist.playlist.tracks.forEach((function(e){e&&t.push(e.id)})),{ids:t,isShuffled:this.isShuffled,isContinues:this.currentPlaylist.isContinues,current:this.currentPlaylist.startIndex,type:this.currentPlaylist.type}}},{key:"getCurrentPlaylist",value:function(){return this.currentPlaylist}},{key:"shufflePlaylist",value:function(t){this.isShuffled=t,this.currentPlaylist.playlist.tracks.sort(this.sortPlaylist),t&&(this.currentPlaylist.playlist.tracks=this.shuffle(this.currentPlaylist.playlist.tracks)),this.currentPlaylist.startIndex=this.currentPlaylist.playlist.tracks.indexOf(this.currentTrack),this.currentPlaylist.forceRestart=!1,this.announce()}},{key:"sortPlaylist",value:function(t,e){return t.disc<e.disc?-1:t.disc>e.disc?1:t.number<e.number?-1:t.number>e.number?1:0}},{key:"shuffle",value:function(t){for(var e=t.length-1;e>0;e--){var n=Math.floor(Math.random()*(e+1)),i=t[e];t[e]=t[n],t[n]=i}return t}},{key:"next",value:function(){this.currentTrack&&(this.currentTrack.isPaused=!1,this.currentTrack.isPlaying=!1),this.currentPlaylist&&(this.currentPlaylist.startIndex++,this.currentPlaylist.forceRestart=!1,this.announce())}},{key:"prev",value:function(){this.currentTrack&&(this.currentTrack.isPaused=!1,this.currentTrack.isPlaying=!1),this.currentPlaylist&&(this.currentPlaylist.startIndex--,this.currentPlaylist.startIndex<=0&&(this.currentPlaylist.startIndex=0),this.currentPlaylist.forceRestart=!1,this.announce())}},{key:"pause",value:function(){this.currentPlaylist&&(this.isPlaying=!1,this.isPaused=!0,this.currentPlaylist.forceRestart=!1,this.announce())}},{key:"resume",value:function(){this.currentPlaylist&&(this.isPlaying=!0,this.isPaused=!1,this.currentPlaylist.forceRestart=!1,this.announce())}},{key:"stop",value:function(){this.isPlaying=!1,this.isPaused=!1,this.currentPlaylist=null,Object(a.b)("current-playlist"),localStorage.removeItem("current-time"),this.playlistSource.next(this.currentPlaylist)}},{key:"togglePlayPause",value:function(){this.isPlaying?this.pause():this.resume()}},{key:"announce",value:function(){var t=this;this.currentPlaylist&&(this.currentTrack=this.currentPlaylist.playlist.tracks[this.currentPlaylist.startIndex],this.lastfmUserName&&this.lastFMService.getTrackInfo(this.currentTrack,this.lastfmUserName).subscribe((function(e){t.currentTrack&&e.track&&(t.currentTrack.isLoved="1"===e.track.userloved)})),this.currentTrack&&(this.currentTrack.isPaused=this.isPaused,this.currentTrack.isPlaying=this.isPlaying,this.currentPlaylist.isPlaying=this.isPlaying,this.currentPlaylist.isPaused=this.isPaused,this.currentPlaylist.isShuffled=this.isShuffled,this.currentPlaylist.position=this.position,Object(a.d)("current-playlist",this.playlistSync()),this.playlistSource.next(this.currentPlaylist)))}},{key:"getVolume",value:function(){return this.volume}},{key:"setVolume",value:function(t){this.volume=t,this.volumeSource.next(this.volume)}},{key:"hideVolumeControl",value:function(){this.hideVolumeWindowAsSource.next(!0)}},{key:"booleanState",value:function(t){var e=localStorage.getItem(t);return!(!e||"true"!==e)}},{key:"setPlaylist",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],i=arguments.length>3&&void 0!==arguments[3]&&arguments[3],r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"album";this.currentPlaylist={playlist:t,startIndex:e,isPlaying:this.isPlaying=!0,isPaused:this.isPaused=!1,isShuffled:this.isShuffled=i,forceRestart:this.forceRestart=n,isContinues:t.isContinues||"album"===r,type:t.type}}}]),e}();return e.\u0275fac=function(t){return new(t||e)(d.Pb(h.a),d.Pb(u.a),d.Pb(l.a))},e.\u0275prov=d.Eb({token:e,factory:e.\u0275fac}),e}()},uwnU:function(t,e,n){"use strict";n.d(e,"a",(function(){return a}));var i=function t(e){r(this,t),this.url=e.file||e.url||e.path||e.id},a=function(){function t(e){r(this,t),this.isPlaying=!1,this.isPaused=!1,this.isLoved=!1,this.position=0,this.buffered={start:0,end:0},this.showActions=!1,this.image="",e.album&&e.title&&(this.id=e.id,this.duration=e.seconds?1e3*e.seconds:e.duration&&!isNaN(e.duration)?e.duration:0,this.title=e.title,this.source=new i(e),this.disc=e.disc||this.guessBySource(e),this.number=e.number,this.trackArtist=e.artist,this.type=e.type||"mp3")}return s(t,[{key:"url",value:function(){return"/letter/".concat(this.artist.letter.escapedLetter,"/artist/").concat(encodeURIComponent(this.artist.name),"/album/").concat(encodeURIComponent(this.album.name),"/track/").concat(encodeURIComponent(this.title))}},{key:"toJSON",value:function(){return this.id}},{key:"guessBySource",value:function(t){for(var e=this.source.url,n=0,i=[1,2,3,4,5,6,7,8,9,10];n<i.length;n++){var r=i[n];if(-1!==e.indexOf(" - ".concat(r,"."))||-1!==e.indexOf("(".concat(r,") - "))||-1!==e.indexOf("CD"+r)||-1!==e.indexOf("\\".concat(r,"-")))return r}return 1}}]),t}()},zUnb:function(t,e,n){"use strict";n.r(e);var i=n("fXoL"),a=n("tk/3"),o=n("3Pt+"),c=n("jhN1"),l=n("Mfq2"),u=n("XNvx"),h=n("ufXC"),d=n("Gcu2"),b=n("1gFc"),f=n("MDLy"),m=n("+ooL"),p=n("OgP6"),g=n("ktVm"),v=n("t083"),y=n("XtVx"),k=n("ofXK"),S=n("ztCj"),w=function t(){r(this,t)},L=n("tyNb");function C(t,e){if(1&t){var n=i.Mb();i.Lb(0,"span"),i.Lb(1,"span",57),i.Sb("click",(function(){i.lc(n);var t=i.Wb();return t.selectArtist(t.path)})),i.pc(2),i.Kb(),i.Lb(3,"span",58),i.pc(4," \u2022 "),i.Kb(),i.Lb(5,"span"),i.pc(6),i.Kb(),i.Kb()}if(2&t){var r=i.Wb();i.xb(2),i.qc(r.path.artist.albumArtist||r.path.artist.name),i.xb(4),i.qc(r.path.album.name)}}function x(t,e){if(1&t&&(i.Lb(0,"span"),i.pc(1),i.Kb()),2&t){var n=i.Wb();i.xb(1),i.qc(n.path.artist.albumArtist||n.path.artist.name)}}function P(t,e){1&t&&(i.Lb(0,"span"),i.pc(1,"JSMusicDB Next"),i.Kb())}function A(t,e){if(1&t&&(i.Lb(0,"span"),i.pc(1),i.Kb()),2&t){var n=i.Wb();i.xb(1),i.qc(n.page)}}function T(t,e){1&t&&(i.Lb(0,"span"),i.pc(1,"JSMusicDB Next"),i.Kb())}function I(t,e){1&t&&i.Jb(0,"i",25)}function O(t,e){1&t&&i.Jb(0,"i",59)}var _=function(t){return{active:t}};function E(t,e){if(1&t&&(i.Lb(0,"li",26),i.Lb(1,"a",60),i.Jb(2,"span",61),i.pc(3),i.Kb(),i.Kb()),2&t){var n=i.Wb();i.cc("ngClass",i.fc(2,_,"Scrobble cache"===n.page)),i.xb(3),i.rc(" Scrobble cache (",n.manualScrobblingList.length,")")}}function M(t,e){if(1&t&&(i.Lb(0,"li",46),i.Lb(1,"a",62),i.Jb(2,"span",61),i.Kb(),i.Kb()),2&t){var n=i.Wb();i.cc("ngClass",i.fc(2,_,"Scrobble cache"===n.page)),i.xb(1),i.ec("tooltip","Scrobble cache (",n.manualScrobblingList.length,")")}}var j=function(t){return{visible:t}},K=function(t){return{"side-nav--visible":t}};function N(){return Object.assign(new l.a,{placement:"right",delay:250})}var D,R=((D=function(){function t(e,n,i,a){var s=this;r(this,t),this.pathService=e,this.router=n,this.lastFMService=i,this.coreService=a,this.menuVisible=!1,this.topSearchVisible=!1,this.manualScrobblingList=[],this.onDocumentClick=function(t){t.target.classList.contains("side-nav--visible")&&s.toggleMenu()},this.core=this.coreService.getCore(),this.subscription=e.pathAnnounced$.subscribe((function(t){s.path=t,s.page=null,s.menuVisible=!1,s.disableActiveLetter(),s.activateLetter(t.letter)})),this.subscription2=e.pageAnnounced$.subscribe((function(t){s.page=t.page,s.path=null,s.menuVisible=!1,s.disableActiveLetter(),s.activateLetter(t.letter)})),this.subscription3=this.lastFMService.manualScrobbleList$.subscribe((function(t){s.manualScrobblingList=t})),this.subscription4=this.core.coreParsed$.subscribe((function(t){s.ngOnInit()})),this.search=new w,Object(S.c)("manual-scrobble-list").then((function(t){s.manualScrobblingList=t||[]}))}return s(t,[{key:"ngOnInit",value:function(){this.letters=this.core.sortedLetters}},{key:"disableActiveLetter",value:function(){this.letters.forEach((function(t){t.active&&(t.active=!1)}))}},{key:"activateLetter",value:function(t){t&&(t.active=!0)}},{key:"ngOnDestroy",value:function(){this.subscription.unsubscribe(),this.subscription2.unsubscribe()}},{key:"toggleMenu",value:function(){this.menuVisible=!this.menuVisible,this.menuVisible?this.slideOut():this.slideIn()}},{key:"slideOut",value:function(){var t=document.querySelector(".js-side-nav");t.classList.add("side-nav--animatable"),t.classList.add("side-nav--visible"),document.addEventListener("click",this.onDocumentClick),t.addEventListener("transitionend",this.onTransitionEnd)}},{key:"slideIn",value:function(){var t=document.querySelector(".js-side-nav");t.classList.add("side-nav--animatable"),t.classList.remove("side-nav--visible"),document.removeEventListener("click",this.onDocumentClick),t.addEventListener("transitionend",this.onTransitionEnd)}},{key:"onTransitionEnd",value:function(t){var e=document.querySelector(".js-side-nav");e.classList.remove("side-nav--animatable"),e.removeEventListener("transitionend",this.onTransitionEnd)}},{key:"onSubmit",value:function(){this.topSearchVisible=!1,this.menuVisible&&this.toggleMenu(),this.router.navigate(["/search",this.search.query])}},{key:"toggleSearch",value:function(){this.topSearchVisible=!this.topSearchVisible,!0===this.topSearchVisible&&setTimeout((function(){document.getElementById("mobileSearch").focus()}),100)}},{key:"selectArtist",value:function(t){this.router.navigate(["letter",t.artist.letter.escapedLetter,"artist",t.artist.sortName])}},{key:"selectAlbum",value:function(t){this.router.navigate(["letter",t.album.artist.letter.escapedLetter,"artist",t.album.artist.sortName,"album",t.album.sortName])}}]),t}()).\u0275fac=function(t){return new(t||D)(i.Ib(y.a),i.Ib(L.c),i.Ib(v.a),i.Ib(g.a))},D.\u0275cmp=i.Cb({type:D,selectors:[["mdb-topmenu"]],features:[i.wb([{provide:l.a,useFactory:N}])],decls:94,vars:65,consts:[[1,"menu-top","fixed-top"],[1,"menu-toggle",3,"click"],["aria-label","menu button",1,"btn","btn-menu","d-md-none"],["aria-hidden","true",1,"glyph","glyph-hamburger"],[1,"d-none","d-md-inline-block"],["version","1.1","xmlns","http://www.w3.org/2000/svg",0,"xmlns","xlink","http://www.w3.org/1999/xlink","x","0px","y","0px","width","276.164px","height","276.164px","viewBox","0 0 276.164 276.164",0,"xml","space","preserve",1,"logo"],["d","M156.716,61.478c-4.111,6.276-8.881,11.511-14.212,15.609l-8.728,6.962c-13.339,11.855-22.937,21.433-28.542,28.464\n                  c-10.209,12.788-15.806,25.779-16.65,38.611c-0.942,14.473,3.187,28.21,12.275,40.84c9.636,13.458,21.8,20.754,36.164,21.69\n                  c3.291,0.218,6.897,0.182,9.896-0.015l-1.121-10.104c-2.09,0.192-4.306,0.223-6.628,0.068c-9.437-0.617-17.864-4.511-25.064-11.573\n                  c-7.524-7.333-10.895-15.415-10.287-24.7c1.149-17.59,12.562-35.004,33.925-51.792l9.543-7.599\n                  c8.394-7.174,15.192-16.191,20.216-26.825c4.971-10.556,7.886-21.983,8.673-33.96c0.466-7.037-0.513-15.775-2.874-25.965\n                  c-3.241-13.839-7.854-20.765-14.136-21.179c-2.232-0.138-4.676,0.986-7.658,3.617c-7.252,6.548-12.523,14.481-15.683,23.542\n                  c-2.438,6.926-4.057,16.189-4.805,27.529c-0.313,4.72,0.313,13.438,1.805,23.962l8.844-8.192c-0.028-1.183,0.005-2.413,0.096-3.703\n                  c0.466-7.221,2.289-15.062,5.394-23.293c3.956-10.296,7.689-13.409,10.133-14.204c0.668-0.218,1.32-0.298,2.015-0.254\n                  c3.185,0.212,6.358,1.559,5.815,9.979C164.664,46.132,161.831,53.693,156.716,61.478z"],["d","M164.55,209.161c5.728-2.568,10.621-6.478,14.576-11.651c5.055-6.561,7.897-14.316,8.467-23.047\n                  c0.72-10.719-1.854-20.438-7.617-28.895c-6.322-9.264-14.98-14.317-25.745-15.026c-1.232-0.081-2.543-0.075-3.895,0.025\n                  l-2.304-17.191l-9.668,7.112l1.483,12.194c-5.789,2.393-10.827,6.17-15.017,11.255c-4.823,5.924-7.508,12.443-7.964,19.382\n                  c-0.466,7.208,1.142,13.81,4.782,19.583c1.895,3.081,4.507,5.82,7.498,8.058c4.906,3.65,10.563,3.376,11.459,1.393\n                  c0.906-1.983-2.455-5.095-5.09-9.248c-1.502-2.351-2.242-5.173-2.242-8.497c0-7.053,4.256-13.116,10.317-15.799l5.673,44.211\n                  l1.325,10.258c0.864,4.873,1.719,9.725,2.537,14.52c1,6.488,1.352,12.112,1.041,16.715c-0.419,6.375-2.408,11.584-5.919,15.493\n                  c-2.234,2.485-4.844,4.055-7.795,4.925c3.961-3.962,6.414-9.43,6.414-15.478c0-12.075-9.792-21.872-21.87-21.872\n                  c-3.353,0-6.491,0.812-9.329,2.159c-0.36,0.155-0.699,0.388-1.054,0.574c-0.779,0.425-1.559,0.85-2.286,1.362\n                  c-0.249,0.187-0.487,0.403-0.732,0.605c-4.888,3.816-8.091,9.616-8.375,16.229c0,0.01-0.011,0.021-0.011,0.031\n                  c0,0.005,0,0.01,0,0.016c-0.013,0.311-0.09,0.59-0.09,0.896c0,0.259,0.067,0.492,0.078,0.74\n                  c-0.011,7.084,2.933,13.179,8.839,18.118c5.584,4.666,12.277,7.28,19.892,7.777c4.327,0.28,8.505-0.217,12.407-1.485\n                  c3.189-1.041,6.275-2.62,9.149-4.687c6.96-5.022,10.75-11.584,11.272-19.532c0.399-6.063,0.094-13.235-0.937-21.411l-2.838-18.429\n                  l-7.156-52.899c7.984,1.532,14.027,8.543,14.027,16.968c0,5.986-1.937,15.431-5.551,20.376L164.55,209.161z"],[4,"ngIf"],["aria-label","search button",1,"btn","btn-menu","btn-search","d-md-none",3,"click"],["class","glyph glyph-magnifier",4,"ngIf"],["class","glyph glyph-clear",4,"ngIf"],["role","form",3,"ngClass","ngSubmit"],["searchForm","ngForm"],["type","text","id","mobileSearch","placeholder","Search for","name","search",1,"form-control",3,"ngModel","ngModelChange"],["name","ngModel"],[1,"js-side-nav","side-nav",3,"ngClass"],[1,"js-side-nav-container","side-nav__container"],[1,"side-nav__content","nav","flex-column"],[1,"d-none","d-md-block","search-bar"],[1,"form-group"],[1,"input-group"],["role","form",3,"ngSubmit"],["type","text","id","search","placeholder","Search for","name","search",1,"form-control",3,"ngModel","ngModelChange"],[1,"input-group-addon"],[1,"glyph","glyph-magnifier"],[3,"ngClass"],["routerLink","/home"],[1,"glyph","glyph-home"],[1,"d-sm-none",3,"ngClass"],["routerLink","/letters"],[1,"glyph","glyph-characters"],["routerLink","/artists"],[1,"glyph","glyph-people"],["routerLink","/albums"],[1,"glyph","glyph-music-album"],["routerLink","/years"],[1,"glyph","glyph-calendar"],["routerLink","/playlists"],[1,"glyph","glyph-music-info"],["routerLink","/now-playing"],[1,"glyph","glyph-audio"],[3,"ngClass",4,"ngIf"],["routerLink","/settings"],[1,"glyph","glyph-settings"],[1,"d-none","d-lg-block","side-nav-xl"],[1,"nav-item",3,"ngClass"],["routerLink","/home","tooltip","Home","triggers","hover","placement","left","container","body"],[1,"d-md-none","nav-item",3,"ngClass"],["routerLink","/letters","tooltip","Letters","triggers","hover","placement","left","container","body"],["routerLink","/artists","tooltip","Artists","triggers","hover","placement","left","container","body"],["routerLink","/albums","tooltip","Albums","triggers","hover","placement","left","container","body"],["routerLink","/years","tooltip","Years","triggers","hover","placement","left","container","body"],["routerLink","/playlists","tooltip","Playlists","triggers","hover","placement","left","container","body"],["routerLink","/now-playing","tooltip","Now Playing","triggers","hover","placement","left","container","body"],["class","nav-item",3,"ngClass",4,"ngIf"],["routerLink","/settings","tooltip","Settings","triggers","hover","placement","left","container","body"],[1,"clickable","d-none","d-sm-inline",3,"click"],[1,"d-none","d-sm-inline"],[1,"glyph","glyph-clear"],["routerLink","/scrobble-cache"],[1,"glyph","glyph-upload"],["routerLink","/scrobble-cache","triggers","hover","placement","left","container","body",3,"tooltip"]],template:function(t,e){1&t&&(i.Lb(0,"div",0),i.Lb(1,"span",1),i.Sb("click",(function(){return e.toggleMenu()})),i.Lb(2,"button",2),i.Jb(3,"span",3),i.Kb(),i.Lb(4,"a",4),i.Vb(),i.Lb(5,"svg",5),i.Lb(6,"g"),i.Jb(7,"path",6),i.Jb(8,"path",7),i.Kb(),i.Kb(),i.Kb(),i.Kb(),i.Ub(),i.Lb(9,"h1"),i.oc(10,C,7,2,"span",8),i.oc(11,x,2,1,"span",8),i.oc(12,P,2,0,"span",8),i.oc(13,A,2,1,"span",8),i.oc(14,T,2,0,"span",8),i.Kb(),i.Lb(15,"button",9),i.Sb("click",(function(){return e.toggleSearch()})),i.oc(16,I,1,0,"i",10),i.oc(17,O,1,0,"i",11),i.Kb(),i.Lb(18,"form",12,13),i.Sb("ngSubmit",(function(){return e.onSubmit()})),i.Lb(20,"input",14,15),i.Sb("ngModelChange",(function(t){return e.search.query=t})),i.Kb(),i.Kb(),i.Kb(),i.Lb(22,"aside",16),i.Lb(23,"nav",17),i.Lb(24,"ul",18),i.Lb(25,"li",19),i.Lb(26,"div",20),i.Lb(27,"div",21),i.Lb(28,"form",22,13),i.Sb("ngSubmit",(function(){return e.onSubmit()})),i.Lb(30,"input",23,15),i.Sb("ngModelChange",(function(t){return e.search.query=t})),i.Kb(),i.Lb(32,"button",24),i.Jb(33,"i",25),i.Kb(),i.Kb(),i.Kb(),i.Kb(),i.Kb(),i.Lb(34,"li",26),i.Lb(35,"a",27),i.Jb(36,"span",28),i.pc(37," Home"),i.Kb(),i.Kb(),i.Lb(38,"li",29),i.Lb(39,"a",30),i.Jb(40,"span",31),i.pc(41," Letters"),i.Kb(),i.Kb(),i.Lb(42,"li",26),i.Lb(43,"a",32),i.Jb(44,"span",33),i.pc(45," Artists"),i.Kb(),i.Kb(),i.Lb(46,"li",26),i.Lb(47,"a",34),i.Jb(48,"span",35),i.pc(49," Albums"),i.Kb(),i.Kb(),i.Lb(50,"li",26),i.Lb(51,"a",36),i.Jb(52,"span",37),i.pc(53," Years"),i.Kb(),i.Kb(),i.Lb(54,"li",26),i.Lb(55,"a",38),i.Jb(56,"span",39),i.pc(57," Playlists"),i.Kb(),i.Kb(),i.Lb(58,"li",26),i.Lb(59,"a",40),i.Jb(60,"span",41),i.pc(61," Now playing"),i.Kb(),i.Kb(),i.oc(62,E,4,4,"li",42),i.Lb(63,"li",26),i.Lb(64,"a",43),i.Jb(65,"span",44),i.pc(66," Settings"),i.Kb(),i.Kb(),i.Kb(),i.Kb(),i.Kb(),i.Lb(67,"aside",45),i.Lb(68,"ul",18),i.Lb(69,"li",46),i.Lb(70,"a",47),i.Jb(71,"span",28),i.Kb(),i.Kb(),i.Lb(72,"li",48),i.Lb(73,"a",49),i.Jb(74,"span",31),i.Kb(),i.Kb(),i.Lb(75,"li",46),i.Lb(76,"a",50),i.Jb(77,"span",33),i.Kb(),i.Kb(),i.Lb(78,"li",46),i.Lb(79,"a",51),i.Jb(80,"span",35),i.Kb(),i.Kb(),i.Lb(81,"li",46),i.Lb(82,"a",52),i.Jb(83,"span",37),i.Kb(),i.Kb(),i.Lb(84,"li",46),i.Lb(85,"a",53),i.Jb(86,"span",39),i.Kb(),i.Kb(),i.Lb(87,"li",46),i.Lb(88,"a",54),i.Jb(89,"span",41),i.Kb(),i.Kb(),i.oc(90,M,3,4,"li",55),i.Lb(91,"li",46),i.Lb(92,"a",56),i.Jb(93,"span",44),i.Kb(),i.Kb(),i.Kb(),i.Kb()),2&t&&(i.xb(10),i.cc("ngIf",e.path&&e.path.album),i.xb(1),i.cc("ngIf",e.path&&e.path.artist&&!e.path.album),i.xb(1),i.cc("ngIf",e.path&&!e.path.artist),i.xb(1),i.cc("ngIf",!e.path&&e.page),i.xb(1),i.cc("ngIf",!e.path&&!e.page),i.xb(2),i.cc("ngIf",!e.topSearchVisible),i.xb(1),i.cc("ngIf",e.topSearchVisible),i.xb(1),i.cc("ngClass",i.fc(29,j,e.topSearchVisible)),i.xb(2),i.cc("ngModel",e.search.query),i.xb(2),i.cc("ngClass",i.fc(31,K,e.menuVisible)),i.xb(8),i.cc("ngModel",e.search.query),i.xb(4),i.cc("ngClass",i.fc(33,_,"Home"===e.page)),i.xb(4),i.cc("ngClass",i.fc(35,_,"Letters"===e.page)),i.xb(4),i.cc("ngClass",i.fc(37,_,"Artists"===e.page)),i.xb(4),i.cc("ngClass",i.fc(39,_,"Albums"===e.page)),i.xb(4),i.cc("ngClass",i.fc(41,_,"Years"===e.page)),i.xb(4),i.cc("ngClass",i.fc(43,_,"Playlists"===e.page)),i.xb(4),i.cc("ngClass",i.fc(45,_,"Now playing"===e.page)),i.xb(4),i.cc("ngIf",e.manualScrobblingList.length>0),i.xb(1),i.cc("ngClass",i.fc(47,_,"Settings"===e.page)),i.xb(6),i.cc("ngClass",i.fc(49,_,"Home"===e.page)),i.xb(3),i.cc("ngClass",i.fc(51,_,"Letters"===e.page)),i.xb(3),i.cc("ngClass",i.fc(53,_,"Artists"===e.page)),i.xb(3),i.cc("ngClass",i.fc(55,_,"Albums"===e.page)),i.xb(3),i.cc("ngClass",i.fc(57,_,"Years"===e.page)),i.xb(3),i.cc("ngClass",i.fc(59,_,"Playlists"===e.page)),i.xb(3),i.cc("ngClass",i.fc(61,_,"Now playing"===e.page)),i.xb(3),i.cc("ngIf",e.manualScrobblingList.length>0),i.xb(1),i.cc("ngClass",i.fc(63,_,"Settings"===e.page)))},directives:[k.k,o.m,o.d,o.e,k.i,o.a,o.c,o.f,L.d,l.b],encapsulation:2}),D),U=function(t){return{active:t}};function B(t,e){if(1&t){var n=i.Mb();i.Lb(0,"li",2),i.Lb(1,"a",3),i.Sb("click",(function(){i.lc(n);var t=e.$implicit;return i.Wb().onSelect(t)})),i.pc(2),i.Kb(),i.Kb()}if(2&t){var r=e.$implicit;i.xb(1),i.cc("ngClass",i.fc(2,U,r.active)),i.xb(1),i.qc(r.letter)}}var W,J=((W=function(){function t(e,n){var i=this;r(this,t),this.coreService=e,this.router=n,this.activeLetter=null,this.core=this.coreService.getCore(),this.subscription=this.core.coreParsed$.subscribe((function(t){i.ngOnInit()}))}return s(t,[{key:"ngOnInit",value:function(){this.letters=this.core.sortedLetters}},{key:"onSelect",value:function(t){this.activeLetter&&(this.activeLetter.active=!1),this.activeLetter=t,this.router.navigate(["/letter",t.escapedLetter])}},{key:"ngOnDestroy",value:function(){this.subscription.unsubscribe()}}]),t}()).\u0275fac=function(t){return new(t||W)(i.Ib(g.a),i.Ib(L.c))},W.\u0275cmp=i.Cb({type:W,selectors:[["mdb-letters"]],decls:2,vars:1,consts:[[1,"nav","d-none","d-md-flex","nav-letters"],["class","nav-item align-self-stretch flex-grow-1 text-center",4,"ngFor","ngForOf"],[1,"nav-item","align-self-stretch","flex-grow-1","text-center"],[3,"ngClass","click"]],template:function(t,e){1&t&&(i.Lb(0,"ul",0),i.oc(1,B,3,4,"li",1),i.Kb()),2&t&&(i.xb(1),i.cc("ngForOf",e.letters))},directives:[k.j,k.i],encapsulation:2}),W);n("hR/0");var V=n("KI15"),F=n("meIv"),q=n("Pbcf"),X=function(t){return t.r=Math.floor(t.r),t.g=Math.floor(t.g),t.b=Math.floor(t.b),t.a=1,t},$=function t(e,n){return F.a.isReadable(e,n)?X(new F.a(e).toRgb()):t("#000"===n?new F.a(e).lighten(3):new F.a(e).darken(3),n)};function H(t,e,n){if(window.runningInElectron&&!n)document.querySelector("mdb-player").dispatchEvent(new CustomEvent("external.mdbuntaint",{detail:{url:t}}));else{var i=new Image;i.crossOrigin="Anonymous",i.addEventListener("load",(function(t){var n=document.createElement("canvas"),r=n.getContext("2d");n.width=i.width,n.height=i.height,r.drawImage(i,0,0);var a=(new q.a).getColor(n).value;e(X({r:a[0],g:a[1],b:a[2]}))}),!1),i.src=t}}function z(t,e){var n,i=$(t,e),r=$(t,e);return{rgba:t,textLight:i,textDark:r,lighten:X(new F.a(i).lighten().toRgb()),darken:X(new F.a(r).darken().toRgb()),lighten30:X(new F.a(i).lighten(30).toRgb()),darken30:X(new F.a(r).darken(30).toRgb()),letterColor:(n=new F.a(i),F.a.readability("#000",n)>F.a.readability("#fff",n)?"#000":"#fff")}}function G(t){var e=document.createElement("style"),n=t.rgba,i=t.darken,r=t.lighten,a=t.textLight,s=t.textDark,o=t.letterColor,c=t.darken30,l=t.lighten30;e.setAttribute("type","text/css"),e.id="custom-css-node",e.textContent='\n      @charset "UTF-8";\n      :root {\n        --primary: rgba('.concat(n.r,", ").concat(n.g,", ").concat(n.b,", 1);\n        --darken: rgba(").concat(i.r,", ").concat(i.g,", ").concat(i.b,", 1);\n        --lighten: rgba(").concat(r.r,", ").concat(r.g,", ").concat(r.b,", 1);\n        --darken30: rgba(").concat(c.r,", ").concat(c.g,", ").concat(c.b,", 1);\n        --lighten30: rgba(").concat(l.r,", ").concat(l.g,", ").concat(l.b,", 1);\n        --text-light: rgba(").concat(a.r,", ").concat(a.g,", ").concat(a.b,", 1);\n        --text-dark: rgba(").concat(s.r,", ").concat(s.g,", ").concat(s.b,", 1);\n        --letter-color: ").concat(o,";\n      }"),Y(),document.querySelector("body").appendChild(e)}function Y(){document.querySelector("#custom-css-node")&&document.querySelector("#custom-css-node").remove()}function Z(t,e){1&t&&i.Jb(0,"i",26)}function Q(t,e){1&t&&i.Jb(0,"i",27)}var tt=function(t){return{width:t}},et=function(t,e){return{"glyph-volume":t,"glyph-mute":e}},nt=function(t){return{active:t}};function it(t,e){if(1&t){var n=i.Mb();i.Lb(0,"div",1),i.Lb(1,"div",2),i.Lb(2,"div",3),i.Sb("click",(function(t){return i.lc(n),i.Wb().jump(t)})),i.Jb(3,"div",4),i.Kb(),i.Kb(),i.Lb(4,"div",5),i.Lb(5,"div",6),i.Lb(6,"div",7),i.Sb("click",(function(){return i.lc(n),i.Wb().navigateToNowPlaying()})),i.Lb(7,"album-art",8),i.Sb("art",(function(t){return i.lc(n),i.Wb().onChangeArt(t)})),i.Kb(),i.Kb(),i.Lb(8,"div",9),i.Lb(9,"h4"),i.pc(10),i.Kb(),i.Lb(11,"h5"),i.Lb(12,"a",10),i.Sb("click",(function(){return i.lc(n),i.Wb().navigateToArtist()})),i.pc(13),i.Kb(),i.Lb(14,"span",11),i.pc(15," \u2022 "),i.Lb(16,"a",10),i.Sb("click",(function(){return i.lc(n),i.Wb().navigateToAlbum()})),i.pc(17),i.Kb(),i.Kb(),i.Kb(),i.Kb(),i.Lb(18,"div",12),i.Lb(19,"a",13),i.Sb("click",(function(){return i.lc(n),i.Wb().prev()})),i.Jb(20,"span",14),i.Kb(),i.Lb(21,"a",13),i.Sb("click",(function(){return i.lc(n),i.Wb().togglePlayPause()})),i.oc(22,Z,1,0,"i",15),i.oc(23,Q,1,0,"i",16),i.Kb(),i.Lb(24,"a",13),i.Sb("click",(function(){return i.lc(n),i.Wb().next()})),i.Jb(25,"span",17),i.Kb(),i.Lb(26,"a",18),i.Sb("click",(function(t){return i.lc(n),i.Wb().toggleVolumeWindow(t)})),i.Jb(27,"span",19),i.Kb(),i.Lb(28,"a",20),i.Sb("click",(function(){return i.lc(n),i.Wb().toggleLoved()})),i.Jb(29,"i",21),i.Kb(),i.Lb(30,"a",22),i.Sb("click",(function(){return i.lc(n),i.Wb().toggleShuffle()})),i.Jb(31,"i",23),i.Kb(),i.Kb(),i.Kb(),i.Kb(),i.Lb(32,"div",24),i.Lb(33,"input",25),i.Sb("ngModelChange",(function(t){return i.lc(n),i.Wb().volume=t}))("input",(function(){return i.lc(n),i.Wb().setVolume()}))("change",(function(){return i.lc(n),i.Wb().setVolume()})),i.Kb(),i.Kb(),i.Kb()}if(2&t){var r=i.Wb();i.xb(3),i.cc("ngStyle",i.fc(13,tt,r.track.position/r.track.duration*100+"%")),i.xb(4),i.cc("artist",r.track.trackArtist)("album",r.track.album.name),i.xb(3),i.qc(r.track.title),i.xb(3),i.qc(r.track.trackArtist),i.xb(4),i.qc(r.track.album.name),i.xb(5),i.cc("ngIf",r.isPlaying),i.xb(1),i.cc("ngIf",r.isPaused),i.xb(4),i.cc("ngClass",i.gc(15,et,r.volume>0,0==r.volume)),i.xb(1),i.cc("ngClass",i.fc(18,nt,r.track.isLoved)),i.xb(2),i.cc("ngClass",i.fc(20,nt,r.isShuffled)),i.xb(2),i.cc("hidden",!r.showVolumeWindow),i.xb(1),i.cc("ngModel",r.volume)}}var rt,at=((rt=function(){function t(e,n,i,a,s,o,c,l){var u=this;r(this,t),this.pathService=e,this.playerService=n,this.router=i,this.lastFMService=a,this.coreService=s,this.animationService=o,this.colorService=c,this.configService=l,this.showPlayer=!1,this.usesDynamicAccentColor=this.booleanState("dynamic-accent-color"),this.isPlaying=!1,this.isPaused=!1,this.hasScrobbledCurrentTrack=!1,this.isCurrentPlaylistLoaded=!1,this.isShuffled=!1,this.forceRestart=!1,this.showVolumeWindow=!1,this.volume=100,this.isHostedApp="undefined"!=typeof Windows,this.analyserID=-1,this.canShowAnimation=!1,this.bgColor="#fff",this.subscription=this.playerService.playlistAnnounced$.subscribe((function(t){t?(u.playlist=t.playlist,u.trackIndex=t.startIndex,u.isPaused=t.isPaused,u.isPlaying=t.isPlaying,u.isShuffled=t.isShuffled,u.forceRestart=t.forceRestart,u.showPlayer=u.isPaused||u.isPlaying,u.setTrack(t.position)):(u.isPlaying=!1,u.showPlayer=!1,u.mediaObject.pause())})),this.subscription5=this.playerService.hideVolumeWindowAnnounced$.subscribe((function(){u.showVolumeWindow=!1})),this.mediaObject=document.querySelector("audio"),this.mediaObject.crossOrigin="anonymous",this.mediaObject.canPlayType("audio/flac"),this.mediaObject.addEventListener("ended",(function(){u.next()})),this.mediaObject.addEventListener("timeupdate",(function(){u.updateTime()})),this.mediaObject.addEventListener("play",(function(){u.onplay()})),this.mediaObject.addEventListener("progress",(function(){u.onprogress()})),this.mediaObject.addEventListener("pause",(function(){u.onpause()})),this.mediaObject.addEventListener("ended",(function(){u.onstop()}));var h=localStorage.getItem("dsm");if(h&&(this.url=h),this.core=this.coreService.getCore(),this.subscription2=this.core.coreParsed$.subscribe((function(t){var e=localStorage.getItem("save-playlist-state");e&&"true"===e&&u.readCurrentPlaylist()})),this.subscription3=this.playerService.volumeAnnounced.subscribe((function(t){u.volume=t,u.mediaObject.volume=u.volume/100})),this.subscription4=e.pageAnnounced$.subscribe((function(t){"Now playing"===t.page?(u.showVolumeWindow=!1,u.canShowAnimation=u.booleanState("visualisation-state"),u.canShowAnimation&&(u.analyserID=window.requestAnimationFrame(u.draw.bind(u)))):u.canShowAnimation=!1})),this.isHostedApp&&(this.systemMediaControls=Windows.Media.SystemMediaTransportControls.getForCurrentView(),this.displayUpdater=this.systemMediaControls.displayUpdater,this.systemMediaControls.isEnabled=!0,this.systemMediaControls.isPlayEnabled=!0,this.systemMediaControls.isPauseEnabled=!0,this.systemMediaControls.isStopEnabled=!0,this.systemMediaControls.isNextEnabled=!0,this.systemMediaControls.isPreviousEnabled=!0,this.systemMediaControls.addEventListener("buttonpressed",(function(t){var e=Windows.Media.SystemMediaTransportControlsButton;switch(t.button){case e.play:u.mediaObject.play();break;case e.pause:u.mediaObject.pause();break;case e.stop:u.playerService.stop();break;case e.next:u.next();break;case e.previous:u.prev();break;default:console.warn("key not mapped in application",t.button)}}),!1),this.systemMediaControls.playbackStatus=Windows.Media.MediaPlaybackStatus.closed),-1===navigator.userAgent.indexOf("Mobi")){this.audioCtx=new(window.AudioContext||window.webkitAudioContext),this.analyser=this.audioCtx.createAnalyser();var d=this.audioCtx.createMediaElementSource(this.mediaObject),b=this.audioCtx.sampleRate;this.analyser.fftSize=this.calculateFft(b),this.hearableBars=this.getHearableBars(b,this.analyser.fftSize),d.connect(this.analyser),d.connect(this.audioCtx.destination),this.dataArray=new Uint8Array(this.hearableBars),this.analyser.getByteFrequencyData(this.dataArray)}this.subscription6=this.colorService.color$.subscribe((function(t){u.rgba=t})),this.subscription7=this.colorService.blob$.subscribe((function(){var t=new Blob([window.externalBlob],{type:"image/png"}),e=URL.createObjectURL(t),n=new Image;n.src=e,H(n.src,(function(t){var e=z(t,u.bgColor);u.colorService.setColor(e.rgba),e.rgba=e.textLight,G(e)}),!0)})),this.subscription8=this.configService.mode$.subscribe((function(t){if(u.bgColor="light"===t?"#fff":"#000",u.usesDynamicAccentColor&&u.rgba){var e=z(u.rgba,u.bgColor);e.rgba=e.textLight,G(e)}}))}return s(t,[{key:"draw",value:function(){var t=this;setTimeout((function(){t.analyserID=window.requestAnimationFrame(t.draw.bind(t)),t.canShowAnimation||window.cancelAnimationFrame(t.analyserID)}),1e3/30);var e=document.querySelector("canvas"),n=e.offsetWidth,i=e.offsetHeight;if(n&&i){var r=e.getContext("2d");this.analyser.getByteFrequencyData(this.dataArray),e.width=n,e.height=i,r.clearRect(0,0,n,i);for(var a,s=this.rgba||{r:0,g:110,b:205,a:1},o=Math.floor(n/this.hearableBars*1.1),c=0,l=i/150*1.17,u=0;u<this.hearableBars;u++)a=this.dataArray[u]*l,r.fillStyle="rgba(".concat(s.r,",").concat(s.g,",").concat(s.b,",").concat(this.dataArray[u]/255,")"),r.fillRect(c,i-a/2,o,a/2),c+=o+1}}},{key:"calculateFft",value:function(t){return 128*Math.floor(t/44100)}},{key:"getHearableBars",value:function(t,e){var n=e/2;switch(t){case 48e3:return n-1;case 88200:return n/2;case 96e3:return n/2-2;case 176400:return n/4;case 192e3:return n/4-4;case 352800:return n/8;case 384e3:return n/8-8;case 705600:return n/16;case 768e3:return n/16-16;default:return n}}},{key:"setTrack",value:function(t){if(this.track=this.playlist.tracks[this.trackIndex],!this.currentTrack||this.track&&this.currentTrack.id!==this.track.id||this.forceRestart){var e=localStorage.getItem("dsm");e&&(this.url=e);var n=localStorage.getItem("jwt");this.mediaObject.src="".concat(this.url,"/listen?path=").concat(encodeURIComponent(this.track.source.url),"&jwt=").concat(n),this.currentTrack=this.track,this.hasScrobbledCurrentTrack=!1,this.animationService.requestAnimation("enter",document.querySelector(".player h4")),this.animationService.requestAnimation("enter",document.querySelector(".player h5"))}this.isPlaying?this.mediaObject.play():this.mediaObject.pause(),this.isCurrentPlaylistLoaded&&(this.mediaObject.currentTime=localStorage.getItem("current-time")||0,this.isCurrentPlaylistLoaded=!1),t&&(this.mediaObject.currentTime=t)}},{key:"readCurrentPlaylist",value:function(){var t=this;Object(S.c)("current-playlist").then((function(e){var n=e;if(n){var i=t.coreService.getCore(),r=[];n.ids.forEach((function(t){r.push(i.tracks[t])}));var a=new V.a;a.tracks=r,a.name="Current Playlist",a.isContinues=n.isContinues||!1,a.type=n.type,t.isShuffled=n.isShuffled,t.isCurrentPlaylistLoaded=!0,t.playerService.doPlayPlaylist(a,n.current,!1,n.isShuffled)}}))}},{key:"ngOnDestroy",value:function(){this.subscription.unsubscribe(),this.subscription2.unsubscribe(),this.subscription3.unsubscribe(),this.subscription4.unsubscribe(),this.subscription5.unsubscribe(),this.subscription6.unsubscribe(),this.subscription7.unsubscribe(),this.subscription8.unsubscribe(),this.mediaObject.removeEventListener("ended"),this.mediaObject.removeEventListener("timeupdate"),this.mediaObject.removeEventListener("play"),this.showVolumeWindow=!1}},{key:"navigateToArtist",value:function(){this.router.navigate(["/letter",this.track.album.artist.letter.escapedLetter,"artist",this.track.album.artist.sortName])}},{key:"navigateToAlbum",value:function(){this.router.navigate(["/letter",this.track.album.artist.letter.escapedLetter,"artist",this.track.album.artist.sortName,"album",this.track.album.sortName])}},{key:"navigateToNowPlaying",value:function(){this.router.navigate(["/now-playing"])}},{key:"next",value:function(){this.trackIndex<this.playlist.tracks.length-1?(this.trackIndex++,this.playerService.next()):this.playlist.isContinues?(this.trackIndex=0,"random"===this.playlist.type||"radio"===this.playlist.type?this.playerService.nextPlaylist(this.playlist.type):this.playerService.nextAlbum(this.track.album)):this.playerService.stop()}},{key:"prev",value:function(){this.trackIndex>0&&(this.trackIndex--,this.playerService.prev())}},{key:"togglePlayPause",value:function(){this.playerService.togglePlayPause()}},{key:"updateTime",value:function(){if(this.track.position=1e3*this.mediaObject.currentTime,!this.hasScrobbledCurrentTrack&&(this.track.position>=t.SCROBBLETIME||this.track.position/this.track.duration>=.5&&performance.now()>t.SCROBBLETIME)){this.hasScrobbledCurrentTrack=!0;try{this.lastFMService.scrobbleTrack(this.track).subscribe((function(){}))}catch(e){console.error(e)}}localStorage.setItem("current-time",this.mediaObject.currentTime.toString())}},{key:"onplay",value:function(){var t=this;try{this.lastFMService.announceNowPlaying(this.track).subscribe()}catch(n){}if(document.title="".concat(this.track.title," \u2022 ").concat(this.track.trackArtist),"mediaSession"in navigator&&Object(S.c)("art-".concat(this.track.trackArtist,"-").concat(this.track.album.name)).then((function(e){e&&(navigator.mediaSession.metadata=new MediaMetadata({title:t.track.title,artist:t.track.trackArtist,album:t.track.album.name,artwork:[{src:e,sizes:"500x500",type:"image/png"}]})),navigator.mediaSession.setActionHandler("play",(function(){t.togglePlayPause()})),navigator.mediaSession.setActionHandler("pause",(function(){t.togglePlayPause()})),navigator.mediaSession.setActionHandler("previoustrack",(function(){t.prev()})),navigator.mediaSession.setActionHandler("nexttrack",(function(){t.next()}))})),this.isHostedApp&&(this.systemMediaControls.playbackStatus=Windows.Media.MediaPlaybackStatus.playing,this.displayUpdater.type=Windows.Media.MediaPlaybackType.music,Object(S.c)("art-".concat(this.track.trackArtist,"-").concat(this.track.album.name)).then((function(e){try{void 0!==t.displayUpdater&&(t.displayUpdater.musicProperties.albumArtist=t.track.trackArtist,t.displayUpdater.musicProperties.artist=t.track.trackArtist,t.displayUpdater.musicProperties.albumTitle=t.track.album.name,t.displayUpdater.musicProperties.title=t.track.title,e&&(t.displayUpdater.thumbnail=Windows.Storage.Streams.RandomAccessStreamReference.createFromUri(new Windows.Foundation.Uri(e))),t.displayUpdater.update())}catch(n){console.error("error occurred",n)}t.updateWinTile(e)}))),document.querySelector("mdb-player").dispatchEvent(new CustomEvent("external.mdbplaying",{detail:this.track})),this.audioCtx&&this.audioCtx.resume(),this.usesDynamicAccentColor=this.booleanState("dynamic-accent-color"),this.usesDynamicAccentColor&&this.rgba){var e=z(this.rgba,this.bgColor);e.rgba=e.textLight,G(e)}}},{key:"onstop",value:function(){document.querySelector("mdb-player").dispatchEvent(new Event("external.mdbstopped")),document.title="JSMusicDB Next",this.isHostedApp&&(this.systemMediaControls.playbackStatus=Windows.Media.MediaPlaybackStatus.stopped),this.audioCtx&&this.audioCtx.suspend(),Y()}},{key:"onpause",value:function(){document.querySelector("mdb-player").dispatchEvent(new CustomEvent("external.mdbpaused",{detail:this.track})),document.title="JSMusicDB Next",this.isHostedApp&&(this.systemMediaControls.playbackStatus=Windows.Media.MediaPlaybackStatus.paused),this.audioCtx&&this.audioCtx.suspend(),Y()}},{key:"onChangeArt",value:function(t){var e=this;this.usesDynamicAccentColor?H(t.detail.art,(function(t){var n=z(t,e.bgColor);e.colorService.setColor(n.rgba),n.rgba=n.textLight,G(n)}),!1):(this.colorService.setColor({r:0,g:110,b:205,a:1}),Y())}},{key:"toggleShuffle",value:function(){this.isShuffled=!this.isShuffled,this.playerService.shufflePlaylist(this.isShuffled)}},{key:"toggleLoved",value:function(){this.track.isLoved=!this.track.isLoved,this.lastFMService.toggleLoved(this.track).subscribe()}},{key:"toggleVolumeWindow",value:function(t){t.stopPropagation(),t.stopImmediatePropagation(),t.preventDefault(),this.showVolumeWindow=!this.showVolumeWindow}},{key:"onprogress",value:function(){var t=this.mediaObject.buffered;0!==t.length&&(this.track.buffered.start=1e3*t.start(0!==t.length?t.length-1:0),this.track.buffered.end=1e3*t.end(0!==t.length?t.length-1:0))}},{key:"setVolume",value:function(){this.mediaObject.volume=this.volume/100,this.playerService.setVolume(this.volume)}},{key:"jump",value:function(t){var e=(t.clientX||t.changedTouches[0].clientX)/document.querySelector(".player").clientWidth;this.playerService.setPosition(this.track.duration/1e3*e)}},{key:"booleanState",value:function(t){var e=localStorage.getItem(t);return!(!e||"true"!==e)}},{key:"updateWinTile",value:function(t){var e=Windows.UI.Notifications;e.TileUpdateManager.createTileUpdaterForApplication("App").clear();var n=e.TileUpdateManager.getTemplateContent(e.TileTemplateType.tileSquare150x150PeekImageAndText02),i=n.getElementsByTagName("text")[0];i.innerText=this.track.title,(i=n.getElementsByTagName("text")[1]).innerText=this.track.trackArtist,t&&(n.getElementsByTagName("image")[0].attributes[1].value=t);var r=new Date,a=new Date(r.getTime()+Number(this.track.duration)),s=n.importNode(this.getTileContent(t,"tileSquare310x310ImageAndText02").getElementsByTagName("binding").item(0),!0);n.getElementsByTagName("visual").item(0).appendChild(s),s=n.importNode(this.getTileContent(t,"tileWide310x150PeekImage02").getElementsByTagName("binding").item(0),!0),n.getElementsByTagName("visual").item(0).appendChild(s),s=n.importNode(this.getTileContent(t,"tileSquare71x71Image").getElementsByTagName("binding").item(0),!0),n.getElementsByTagName("visual").item(0).appendChild(s);var o=new e.TileNotification(n);o.expirationTime=a,e.TileUpdateManager.createTileUpdaterForApplication("App").update(o)}},{key:"getTileContent",value:function(t,e){var n=Windows.UI.Notifications,i=n.TileUpdateManager.getTemplateContent(n.TileTemplateType[e]);try{i.getElementsByTagName("text")[0].innerText=this.track.title}catch(r){console.error(r)}try{i.getElementsByTagName("text")[1].innerText=this.track.trackArtist}catch(r){console.error(r)}return t&&(i.getElementsByTagName("image")[0].attributes[1].value=t),i}}]),t}()).SCROBBLETIME=24e4,rt.\u0275fac=function(t){return new(t||rt)(i.Ib(y.a),i.Ib(h.a),i.Ib(L.c),i.Ib(v.a),i.Ib(g.a),i.Ib(b.a),i.Ib(m.a),i.Ib(p.a))},rt.\u0275cmp=i.Cb({type:rt,selectors:[["mdb-player"]],decls:1,vars:1,consts:[["class","player",4,"ngIf"],[1,"player"],[1,"row"],[1,"progress",3,"click"],["role","progressbar",1,"progress-bar",3,"ngStyle"],[1,"container-fluid"],[1,"row","row-sm"],[1,"col-xs-4","col-player-art",3,"click"],[3,"artist","album","art"],[1,"col-xs-11","col-player-special"],[3,"click"],[1,"hidden-xs","color-type-secondary"],[1,"col-xs-9","text-right","col-player-controls"],[1,"btn","btn-link",3,"click"],[1,"glyph","glyph-previous"],["class","glyph glyph-pause",4,"ngIf"],["class","glyph glyph-play",4,"ngIf"],[1,"glyph","glyph-next"],[1,"btn","btn-link","d-none","d-md-inline-block",3,"click"],[1,"glyph",3,"ngClass"],[1,"btn","btn-link","d-none","d-md-inline-block","btn-love",3,"ngClass","click"],[1,"glyph","glyph-star-outline"],[1,"btn","btn-link","d-none","d-md-inline-block","btn-shuffle",3,"ngClass","click"],[1,"glyph","glyph-shuffle"],[1,"volume-control",3,"hidden"],["type","range","min","0","max","100",3,"ngModel","ngModelChange","input","change"],[1,"glyph","glyph-pause"],[1,"glyph","glyph-play"]],template:function(t,e){1&t&&i.oc(0,it,34,22,"div",0),2&t&&i.cc("ngIf",e.showPlayer)},directives:[k.k,k.l,k.i,o.i,o.a,o.c,o.f],encapsulation:2}),rt);function st(t,e){if(1&t&&(i.Lb(0,"div"),i.pc(1),i.Kb()),2&t){var n=i.Wb(2);i.xb(1),i.rc(" progress: ",n.scanperc,"% ")}}function ot(t,e){if(1&t&&(i.Lb(0,"div",6),i.Lb(1,"div",7),i.Lb(2,"div",8),i.Lb(3,"div",9),i.pc(4," Collection is being reloaded, please wait. "),i.oc(5,st,2,1,"div",10),i.Lb(6,"div",11),i.Jb(7,"div",12),i.Jb(8,"div",12),i.Jb(9,"div",12),i.Jb(10,"div",12),i.Jb(11,"div",12),i.Kb(),i.Kb(),i.Kb(),i.Kb(),i.Kb()),2&t){var n=i.Wb();i.xb(5),i.cc("ngIf",n.scanperc)}}var ct,lt,ut,ht,dt=function(t){return{isPlaying:t}},bt=((lt=function(){function t(e,n,i,a,s,o,c){var l=this;r(this,t),this.collectionService=e,this.coreService=n,this.loginService=i,this.configService=a,this.playerService=s,this.colorService=o,this.isPlaying=!1,this.scanperc=0,this.isReloading=!1,this.letter="N",this.path="JSMusicDB Next",this.isLoading=!1,this.hasBeenReloading=!1,this.isHostedApp="undefined"!=typeof Windows,this.loginService.hasToken&&(this.isLoading=!0,this.poll()),this.viewContainerRef=c,this.subscription=this.playerService.playlistAnnounced$.subscribe((function(t){l.isPlaying=!!t})),this.booleanState("tracking-state")?navigator.geolocation.getCurrentPosition((function(t){l.configService.getSunriseInfo(t.coords.latitude,t.coords.longitude).subscribe((function(t){l.configService.startDate=new Date(t.results.sunset),l.configService.stopDate=new Date(t.results.sunrise),l.configService.stopDate.setDate(l.configService.stopDate.getDate()+1),l.configService.geoSource.next(),l.configService.applyTheme()}))}),(function(t){l.configService.startDate=new Date,l.configService.startDate.setHours(21,0,0),l.configService.stopDate=new Date,l.configService.stopDate.setDate(l.configService.stopDate.getDate()+1),l.configService.stopDate.setHours(7,0,0),l.configService.geoSource.next(),l.configService.applyTheme()})):(this.configService.startDate=new Date,this.configService.startDate.setHours(21,0,0),this.configService.stopDate=new Date,this.configService.stopDate.setDate(this.configService.stopDate.getDate()+1),this.configService.stopDate.setHours(7,0,0),this.configService.geoSource.next(),this.configService.applyTheme())}return s(t,[{key:"ngOnDestroy",value:function(){this.subscription.unsubscribe()}},{key:"ngOnInit",value:function(){this.mediaObject=document.querySelector("audio");var t=this.mediaObject.canPlayType("audio/flac");this.isFlacSupported="probably"===t||"maybe"===t}},{key:"getCollection",value:function(){var t=this;this.collectionService.getCollection().subscribe((function(e){return t.fillCollection(e)}),(function(t){return console.error(t)}))}},{key:"fillCollection",value:function(t){localStorage.setItem("lastParsed",(new Date).getTime().toString()),this.coreService.getCore().parseSourceJson(t,this.isFlacSupported),this.isLoading=!1}},{key:"hideVolumeWindow",value:function(){this.playerService.hideVolumeControl()}},{key:"poll",value:function(){var t=this;this.collectionService.poll().subscribe((function(e){t.scanperc=e.progress,"ready"!==e.status?(t.isReloading=!0,document.querySelector("mdb-player").dispatchEvent(new CustomEvent("external.mdbscanning",{detail:{percentage:t.scanperc}})),setTimeout((function(e){t.poll()}),5e3),t.hasBeenReloading=!0):(t.isReloading=!1,t.hasBeenReloading&&document.querySelector("mdb-player").dispatchEvent(new CustomEvent("external.mdbscanstop")),t.getCollection())}))}},{key:"onExternalPrev",value:function(t){this.playerService.prev()}},{key:"onExternalNext",value:function(t){this.playerService.next()}},{key:"onExternalToggle",value:function(t){this.playerService.togglePlayPause()}},{key:"onExternalStop",value:function(t){this.playerService.stop()}},{key:"onExternalBlob",value:function(){this.colorService.setBlob()}},{key:"booleanState",value:function(t){var e=localStorage.getItem(t);return!(!e||"true"!==e)}}]),t}()).\u0275fac=function(t){return new(t||lt)(i.Ib(f.a),i.Ib(g.a),i.Ib(u.a),i.Ib(p.a),i.Ib(h.a),i.Ib(m.a),i.Ib(i.O))},lt.\u0275cmp=i.Cb({type:lt,selectors:[["mdb-root"]],features:[i.wb([f.a,g.a,y.a,h.a,v.a,b.a,p.a,d.a,m.a])],decls:10,vars:7,consts:[["id","reloading",4,"ngIf"],[3,"ngClass","click"],[1,"fixed-top",2,"z-index","1029",3,"click"],[1,"main-content",3,"ngClass","click"],[2,"display","none"],[3,"mdbprev","mdbnext","mdbtoggle","mdbstop","click","mdbblob"],["id","reloading"],[1,"container"],[1,"row"],[1,"col"],[4,"ngIf"],[1,"progress-bar"],[1,"progress-circle"]],template:function(t,e){1&t&&(i.oc(0,ot,12,1,"div",0),i.Lb(1,"div",1),i.Sb("click",(function(){return e.hideVolumeWindow})),i.Jb(2,"mdb-topmenu"),i.Kb(),i.Lb(3,"div",2),i.Sb("click",(function(){return e.hideVolumeWindow})),i.Jb(4,"mdb-letters"),i.Kb(),i.Lb(5,"div",3),i.Sb("click",(function(){return e.hideVolumeWindow})),i.Jb(6,"router-outlet"),i.Kb(),i.Jb(7,"audio",4),i.Jb(8,"canvas"),i.Lb(9,"mdb-player",5),i.Sb("mdbprev",(function(t){return e.onExternalPrev(t)}))("mdbnext",(function(t){return e.onExternalNext(t)}))("mdbtoggle",(function(t){return e.onExternalToggle(t)}))("mdbstop",(function(t){return e.onExternalStop(t)}))("click",(function(){return e.hideVolumeWindow()}))("mdbblob",(function(){return e.onExternalBlob()})),i.Kb()),2&t&&(i.cc("ngIf",e.isReloading),i.xb(1),i.cc("ngClass",i.fc(3,dt,e.isPlaying)),i.xb(4),i.cc("ngClass",i.fc(5,dt,e.isPlaying)))},directives:[k.k,k.i,R,J,L.f,at],encapsulation:2}),lt),ft=((ct=function(){function t(e,n){r(this,t),this.loginService=e,this.router=n}return s(t,[{key:"canActivate",value:function(t,e){var n=this;return new Promise((function(t){var i=e.url;window.scrollTo(0,0),t(n.checkLogin(i))}))}},{key:"checkLogin",value:function(t){return!!localStorage.getItem("jwt")||(this.router.navigate(["/login"]),!1)}}]),t}()).\u0275fac=function(t){return new(t||ct)(i.Pb(u.a),i.Pb(L.c))},ct.\u0275prov=i.Eb({token:ct,factory:ct.\u0275fac}),ct),mt=[ft,u.a],pt=L.e.forRoot([{path:"login",loadChildren:function(){return n.e(9).then(n.bind(null,"X3zk")).then((function(t){return t.LoginModule}))}},{path:"home",loadChildren:function(){return Promise.all([n.e(0),n.e(6)]).then(n.bind(null,"ct+p")).then((function(t){return t.HomeModule}))},canActivate:[ft]},{path:"letters",loadChildren:function(){return n.e(8).then(n.bind(null,"mCIM")).then((function(t){return t.LettersModule}))},canActivate:[ft]},{path:"artists",loadChildren:function(){return Promise.all([n.e(0),n.e(5)]).then(n.bind(null,"3r4j")).then((function(t){return t.ArtistsModule}))},canActivate:[ft]},{path:"albums",loadChildren:function(){return Promise.all([n.e(0),n.e(3)]).then(n.bind(null,"fX0g")).then((function(t){return t.AlbumsModule}))},canActivate:[ft]},{path:"years",loadChildren:function(){return Promise.all([n.e(0),n.e(20)]).then(n.bind(null,"ZutQ")).then((function(t){return t.YearsModule}))},canActivate:[ft]},{path:"playlists",loadChildren:function(){return Promise.all([n.e(0),n.e(12)]).then(n.bind(null,"kez3")).then((function(t){return t.PlaylistsModule}))},canActivate:[ft]},{path:"now-playing",loadChildren:function(){return Promise.all([n.e(0),n.e(11)]).then(n.bind(null,"YxDV")).then((function(t){return t.NowPlayingModule}))},canActivate:[ft]},{path:"settings",loadChildren:function(){return Promise.all([n.e(0),n.e(17)]).then(n.bind(null,"7wo0")).then((function(t){return t.SettingsModule}))},canActivate:[ft]},{path:"scrobble-cache",loadChildren:function(){return n.e(15).then(n.bind(null,"BSpc")).then((function(t){return t.ScrobbleCacheModule}))},canActivate:[ft]},{path:"search/:query",loadChildren:function(){return Promise.all([n.e(0),n.e(16)]).then(n.bind(null,"RmqX")).then((function(t){return t.SearchModule}))},canActivate:[ft]},{path:"letter/:letter",loadChildren:function(){return Promise.all([n.e(0),n.e(7)]).then(n.bind(null,"pJo8")).then((function(t){return t.LetterDetailModule}))},canActivate:[ft]},{path:"letter/:letter/artist/:artist",loadChildren:function(){return Promise.all([n.e(0),n.e(4)]).then(n.bind(null,"2+yB")).then((function(t){return t.ArtistDetailModule}))},canActivate:[ft]},{path:"letter/:letter/artist/:artist/album/:album",loadChildren:function(){return Promise.all([n.e(0),n.e(2)]).then(n.bind(null,"jJnS")).then((function(t){return t.AlbumDetailModule}))},canActivate:[ft]},{path:"",loadChildren:function(){return Promise.all([n.e(0),n.e(6)]).then(n.bind(null,"ct+p")).then((function(t){return t.HomeModule}))},canActivate:[ft]}],{preloadingStrategy:L.b}),gt=((ut=function(){function t(){r(this,t)}return s(t,[{key:"supports",value:function(t){var e=!1;return 0===t.indexOf("mdb")&&(e=!0),e}},{key:"addEventListener",value:function(t,e,n){var i=this,r=this.manager.getZone(),a=function(t){r.run((function(){return n(t)}))};return this.manager.getZone().runOutsideAngular((function(){i.manager.addEventListener(t,"external."+e,a)}))}},{key:"addGlobalEventListener",value:function(t,e,n){var i=this,r=this.manager.getZone(),a=function(t){return r.run((function(){return n(t)}))};return this.manager.getZone().runOutsideAngular((function(){i.manager.addGlobalEventListener(t,e,a)}))}}]),t}()).\u0275fac=function(t){return new(t||ut)},ut.\u0275prov=i.Eb({token:ut,factory:ut.\u0275fac}),ut),vt=n("hDf6"),yt=n("R1ws"),kt=((ht=function t(){r(this,t),"serviceWorker"in navigator&&navigator.serviceWorker.register("sw.js").then((function(t){})).catch((function(t){console.error("Registration failed with "+t)}))}).\u0275mod=i.Gb({type:ht,bootstrap:[bt]}),ht.\u0275inj=i.Fb({factory:function(t){return new(t||ht)},providers:[mt,{provide:c.b,useClass:gt,multi:!0},{provide:i.u,useValue:"en-GB"}],imports:[[c.a,a.b,o.b,pt,l.c.forRoot(),vt.a,yt.a]]}),ht);Object(i.R)(),window.addEventListener("beforeinstallprompt",(function(t){t.preventDefault(),window.deferredPrompt=t})),c.c().bootstrapModule(kt).catch((function(t){return console.error(t)}))}},[[0,1,19]]])}();