(function(E,S,a,x,g,A,v,N){"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/vd-plugins",GITHUB_COMMITS_URL:"https://github.com/kmmiio99o/vd-plugins/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++){vari=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"ini&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}functionC(t,e,n){returne&&U(t.prototype,e),n&&U(t,n),t}const{SET_ACTIVITY:te}=g.findByProps("SET_ACTIVITY"),B=g.findByProps("getAssetIds"),Y=g.findByStoreName("SelfPresenceStore"),D=g.findByStoreName("UserStore");function_(){returnF(null)}functionF(t){c.pluginStopped&&(G(),t=null),c.lastActivity=t,a.FluxDispatcher.dispatch({type:"LOCAL_ACTIVITY_UPDATE",activity:t,pid:2312,socketId:"Last.fm@Vendetta"})}asyncfunctionK(t,e=s.APPLICATION_ID){if(!t?.length)return[];try{returnawaitB.fetchAssetIds(e,t)}catch(n){returnconsole.error("[Last.fm] Failed to fetch assets:",n),[]}}constL={};L.componentMountErrors=[],L.componentMountCount=0,L.settingsLoadAttempts=0;functionh(t,e){L[t]=e}constM=(function(){functiont(){P(this,t)}returnC(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",11:"Service temporarily unavailable",16:"Service temporarily unavailable",29:"Rate limit exceeded"}[e.error]||e.message||"Unknown error";throwconsole.log(`[Last.fm] API Error ${e.error}: ${n}`),newError(`Last.fm API Error ${e.error}: ${n}`)}},{key:"makeRequest",value:asyncfunction(e){constn=newURLSearchParams({...e,api_key:o.apiKey,format:"json"}).toString(),i=awaitfetch(`${s.LFM_API_BASE_URL}?${n}`),f=awaiti.json();return(!i.ok||f.error)&&awaitthis.handleError(f),f}},{key:"fetchLatestScrobble",value:asyncfunction(){try{this.validateSettings();conste=(awaitthis.makeRequest({method:"user.getrecenttracks",user:o.username,limit:"1",extended:"1"}))?.recenttracks?.track?.[0];if(h("lastAPIResponse",e),!e)throwconsole.log("[Last.fm] No tracks found for user"),newError("No tracks found");this.retryCount=0;constn=!!e["@attr"]?.nowplaying,i=n?Math.floor(Date.now()/1e3):parseInt(e?.date?.uts);letf=null;try{constm=awaitthis.makeRequest({method:"track.getInfo",track:e.name,artist:e.artist.name,username:o.username}),r=parseInt(m?.track?.duration);r>0&&(f=i+Math.floor(r/1e3))}catch(m){console.warn("[Last.fm] Failed to fetch track duration",m)}return{name:e.name,artist:e.artist.name,album:e.album["#text"],albumArt:awaitthis.handleAlbumCover(e.image?.find(function(m){returnm.size==="large"})?.["#text"]),url:e.url,date:e.date?.["#text"]??"now",nowPlaying:n,loved:e.loved==="1",from:i,to:f}}catch(e){if(this.retryCount++,this.retryCount>s.MAX_RETRY_ATTEMPTS)throwthis.retryCount=0,console.error("[Last.fm] Max retry attempts reached"),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();functionH(t){conste=Math.floor(t/60),n=Math.floor(t%60);return`${e}:${n.toString().padStart(2,"0")}`}varj=(function(t){returnt[t.PLAYING=0]="PLAYING",t[t.STREAMING=1]="STREAMING",t[t.L