(function(c,s,d,n,b,i,C,p,h,S){"use strict";function w(t,l){if(!(t instanceof l))throw new TypeError("Cannot call a class as a function")}function y(t,l){for(var e=0;e0:t||t===0||t===!1}function B(t){return JSON.parse(JSON.stringify(t,function(l,e){if(e===t)return e;if(!(typeof l=="string"&&l.startsWith("_")))switch(typeof e){case"object":{if(Array.isArray(e)&&e.length===0)return;const a=Object.entries(e).filter(function(M){return v(M[1])});return a.length>0?Object.fromEntries(a):void 0}default:return v(e)?e:void 0}}))}var f;(function(t){t[t.PLAYING=0]="PLAYING",t[t.STREAMING=1]="STREAMING",t[t.LISTENING=2]="LISTENING",t[t.WATCHING=3]="WATCHING",t[t.COMPETING=5]="COMPETING"})(f||(f={}));const _=d.findByProps("getAssetIds"),T=Date.now(),u=s.plugin.storage;typeof u.selected?.length!="number"&&Object.assign(u,{selected:"default",selections:{default:G()}});function G(){return{name:"Discord",application_id:"1054951789318909972",flags:0,type:f.PLAYING,timestamps:{_enabled:!1,start:T},assets:{},buttons:[{},{}]}}async function I(t){if(typeof t!="object")throw new Error("Invalid activity");if(t){const l=t?.timestamps?._enabled;if(t=B(t),l?t.timestamps.start||=T:delete t.timestamps,t.assets){const e=[t.application_id,[t.assets.large_image,t.assets.small_image]];let a=_.getAssetIds(...e);a.length||(a=await _.fetchAssetIds(...e)),t.assets.large_image=a[0],t.assets.small_image=a[1]}t.buttons?.length?(t.buttons=t.buttons.filter(function(e){return e.label&&e.url}),t.buttons.length?Object.assign(t,{metadata:{button_urls:t.buttons.map(function(e){return e.url})},buttons:t.buttons.map(function(e){return e.label})}):delete t.buttons):delete t.buttons}return n.FluxDispatcher.dispatch({type:"LOCAL_ACTIVITY_UPDATE",activity:t,pid:1608,socketId:"RichPresence@Vendetta"}),t}var m=new(function(){function t(){w(this,t),P(this,"settings",D)}return L(t,[{key:"onLoad",value:function(){s.logger.log("Sending RPC request");const l=u.selections[u.selected];if(!l)throw new Error("Selected activity does not exist");I(l).then(function(e){s.logger.log("RPC request sent"),s.logger.log(e)}).catch(function(e){s.logger.error("An error occured while sending RPC request :("),s.logger.error(e?.stack??e)})}},{key:"onUnload",value:function(){s.logger.log("Stopping RPC request"),I(null)}}]),t}());return c.default=m,Object.defineProperty(c,"__esModule",{value:!0}),c})({},vendetta,vendetta.metro,vendetta.metro.common,vendetta.plugin,vendetta.ui.components,vendetta.storage,vendetta.ui,vendetta.metro.common.ReactNative,window.React);