(function(I,A,a,g,h,ee,T,k){"use strict";consts={DEFAULT_APP_NAME:"Music",DEFAULT_TIME_INTERVAL:5,APPLICATION_ID:"1054951789318909972",MIN_UPDATE_INTERVAL:3,MAX_RETRY_ATTEMPTS:3,RETRY_DELAY:5e3,LFM_API_BASE_URL:"http://ws.audioscrobbler.com/2.0",LFM_DEFAULT_COVER_HASHES:["2a96cbd8b46e442fc41c2b86b821562f","c6f59c1e5e7240a4c0d427abd71f3dbb"],DEFAULT_SETTINGS:{username:"",apiKey:"",appName:"Music",timeInterval:5,showTimestamp:!0,listeningTo:!0,ignoreSpotify:!0,verboseLogging:!1},GITHUB_URL:"https://github.com/kmmiio99o/letup",GITHUB_COMMITS_URL:"https://github.com/kmmiio99o/letup/commits/main/"};functionP(t,e){if(!(tinstanceofe))thrownewTypeError("Cannot call a class as a function")}functionU(t,e){for(varn=0;n<e.length;n++){varr=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"inr&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}functionD(t,e,n){returne&&U(t.prototype,e),n&&U(t,n),t}T.findByProps("SET_ACTIVITY");constO=T.findByProps("getAssetIds"),x=T.findByStoreName("SelfPresenceStore"),C=T.findByStoreName("UserStore");functionL(){returnM(null)}functionM(t){c.pluginStopped&&(V(),t=null),c.lastActivity=t,a.FluxDispatcher.dispatch({type:"LOCAL_ACTIVITY_UPDATE",activity:t,pid:2312,socketId:"Last.fm@Vendetta"})}asyncfunctionY(t,e=s.APPLICATION_ID){if(!t?.length)return[];try{returnawaitO.fetchAssetIds(e,t)}catch(n){returnconsole.error("[Last.fm] Failed to fetch assets:",n),[]}}constb={};b.componentMountErrors=[],b.componentMountCount=0,b.settingsLoadAttempts=0;functionm(t,e){b[t]=e}constF=function(){functiont(){P(this,t)}returnD(t,[{key:"validateSettings",value:function(){if(!o.username)thrownewError("Last.fm username is not set");if(!o.apiKey)thrownewError("Last.fm API key is not set")}},{key:"handleError",value:asyncfunction(e){this.lastError=e.error;constn={2:"Invalid API key",6:"User not found",11:"Service temporarily unavailable",16:"Service temporarily unavailable",29:"Rate limit exceeded"}[e.error]||e.message||"Unknown error";throwh.showToast(`Last.fm Error: ${n}`,g.getAssetIDByName("Small")),newError(`Last.fm API Error ${e.error}: ${n}`)}},{key:"makeRequest",value:asyncfunction(e){constn=newURLSearchParams({...e,api_key:o.apiKey,format:"json"}).toString(),r=awaitfetch(`${s.LFM_API_BASE_URL}?${n}`),p=awaitr.json();return(!r.ok||p.error)&&awaitthis.handleError(p),p}},{key:"fetchLatestScrobble",value:asyncfunction(){try{this.validateSettings();conste=(awaitthis.makeRequest({method:"user.getrecenttracks",user:o.username,limit:"1",extended:"1"}))?.recenttracks?.track?.[0];if(m("lastAPIResponse",e),!e)thrownewError("No tracks found");this.retryCount=0;constn=!!e["@attr"]?.nowplaying,r=n?Math.floor(Date.now()/1e3):parseInt(e?.date?.uts);letp=null;try{consty=awaitthis.makeRequest({method:"track.getInfo",track:e.name,artist:e.artist.name,username:o.username}),i=parseInt(y?.track?.duration);i>0&&(p=r+Math.floor(i/1e3))}catch(y){console.warn("Failed to fetch track duration",y)}return{name:e.name,artist:e.artist.name,album:e.album["#text"],albumArt:awaitthis.handleAlbumCover(e.image?.find(function(y){returny.size==="large"})?.["#text"]),url:e.url,date:e.date?.["#text"]??"now",nowPlaying:n,loved:e.loved==="1",from:r,to:p}}catch(e){if(this.retryCount++,this.retryCount>s.MAX_RETRY_ATTEMPTS)throwthis.retryCount=0,e;returnawaitnewPromise(function(n){returnsetTimeout(n,s.RETRY_DELAY)}),this.fetchLatestScrobble()}}},{key:"handleAlbumCover",value:asyncfunction(e){return!e||s.LFM_DEFAULT_COVER_HASHES.some(function(n){returne.includes(n)})?null:e}},{key:"getLastError",value:function(){returnthis.lastError}},{key:"resetRetryCount",value:function(){this.retryCount=0}}],[{key:"getInstance",value:function(){returnt.instance||(t.instance=newt),t.instance}}]),t}().getInstance();functionK(t){conste=Math.floor(t/60),n=Math.floor(t%60);return`${e}:${n.toString().padStart(2,"0")}`}varH=function(t){returnt[t.PLAYING=0]="PLAYING",t[t.STREAMING=1]="STREAMING",t[t.LISTENING=2]="LISTENING",t[t.COMPETING=5]="COMPETING",t}(H||{});constl=function(...t){returno.verboseLogging&&co