(function(m,A,g,p,n,I,d,x,O){"use strict";consti={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:"https://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")}functionk(t,e){for(vara=0;a<e.length;a++){vars=e[a];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"ins&&(s.writable=!0),Object.defineProperty(t,s.key,s)}}functionU(t,e,a){returne&&k(t.prototype,e),a&&k(t,a),t}d.findByProps("SET_ACTIVITY");constY=d.findByProps("getAssetIds"),K=d.findByStoreName("SelfPresenceStore"),C=d.findByStoreName("UserStore");functionw(){returnD(null)}functionD(t){l.pluginStopped&&(V(),t=null),l.lastActivity=t,n.FluxDispatcher.dispatch({type:"LOCAL_ACTIVITY_UPDATE",activity:t,pid:2312,socketId:"Last.fm@Vendetta"})}asyncfunctionj(t,e=i.APPLICATION_ID){if(!t?.length)return[];try{returnawaitY.fetchAssetIds(e,t)}catch(a){returnconsole.error("[Last.fm] Failed to fetch assets:",a),[]}}constv={};v.componentMountErrors=[],v.componentMountCount=0,v.settingsLoadAttempts=0;functionh(t,e){v[t]=e}constF=function(){functiont(){P(this,t)}returnU(t,[{key:"validateSettings",value:function(){if(!c.username)thrownewError("Last.fm username is not set");if(!c.apiKey)thrownewError("Last.fm API key is not set")}},{key:"handleError",value:asyncfunction(e){this.lastError=e.error;consta={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";throwp.showToast(`Last.fm Error: ${a}`,g.getAssetIDByName("Small")),newError(`Last.fm API Error ${e.error}: ${a}`)}},{key:"makeRequest",value:asyncfunction(e){consta=newURLSearchParams({...e,api_key:c.apiKey,format:"json"}).toString(),s=awaitfetch(`${i.LFM_API_BASE_URL}?${a}`),E=awaits.json();return(!s.ok||E.error)&&awaitthis.handleError(E),E}},{key:"fetchLatestScrobble",value:asyncfunction(){try{this.validateSettings();conste=(awaitthis.makeRequest({method:"user.getrecenttracks",user:c.username,limit:"1",extended:"1"}))?.recenttracks?.track?.[0];if(h("lastAPIResponse",e),!e)thrownewError("No tracks found");returnthis.retryCount=0,{name:e.name,artist:e.artist.name,album:e.album["#text"],albumArt:awaitthis.handleAlbumCover(e.image?.find(function(a){returna.size==="large"})?.["#text"]),url:e.url,date:e.date?.["#text"]??"now",nowPlaying:!!e["@attr"]?.nowplaying,loved:e.loved==="1"}}catch(e){if(this.retryCount++,this.retryCount>i.MAX_RETRY_ATTEMPTS)throwthis.retryCount=0,e;returnawaitnewPromise(function(a){returnsetTimeout(a,i.RETRY_DELAY)}),this.fetchLatestScrobble()}}},{key:"handleAlbumCover",value:asyncfunction(e){return!e||i.LFM_DEFAULT_COVER_HASHES.some(function(a){returne.includes(a)})?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();varz=function(t){returnt[t.PLAYING=0]="PLAYING",t[t.STREAMING=1]="STREAMING",t[t.LISTENING=2]="LISTENING",t[t.COMPETING=5]="COMPETING",t}(z||{});consto=function(...t){returnc.verboseLogging&&console.log("[Last.fm]",...t)},M=function(){functiont(){P(this,t)}returnU(t,[{key:"updateActivity",value:asyncfunction(){if(l.pluginStopped){o("Plugin is stopped, skipping update"),this.stopUpdates();return}o("Fetching last track...");try{if(!c.username||!c.apiKey)thrownewError("Username or API key not set");if(c.ignoreSpotify){if(K.findActivity(function(s){returns.sync_id})){o("Spotifyiscurrentlyplaying,clea