Decompiled source of R Fiddler v2.0.1

plugins/R-Fiddler/R-Fiddler.dll

Decompiled 3 months ago
using System;
using System.Collections;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.Linq;
using System.Net.Http;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.NET.Common;
using BepInExResoniteShim;
using Elements.Assets;
using Elements.Core;
using FrooxEngine;
using HarmonyLib;
using SkyFrost.Base;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(/*Could not decode attribute arguments.*/)]
[assembly: TargetFramework(".NETCoreApp,Version=v9.0", FrameworkDisplayName = ".NET 9.0")]
[assembly: AssemblyCompany("Knackrack615, NepuShiro, LeCloutPanda")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("2.0.0.0")]
[assembly: AssemblyInformationalVersion("2.0.0+8d8d5ead5fad803ca4240638f26f548dae7adc58")]
[assembly: AssemblyProduct("R-Fiddler")]
[assembly: AssemblyTitle("R-Fiddler")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/HGCommunity/R-Fiddler")]
[assembly: AssemblyVersion("2.0.0.0")]
[module: RefSafetyRules(11)]
namespace R_Fiddler;

public class Helpers
{
	[StructLayout(3)]
	[CompilerGenerated]
	private struct <GetFaviconUrlAsync>d__0 : IAsyncStateMachine
	{
		public int <>1__state;

		public AsyncTaskMethodBuilder<string> <>t__builder;

		public Uri uri;

		private string <subdomain>5__2;

		private string <mainDomain>5__3;

		private TaskAwaiter<string> <>u__1;

		private void MoveNext()
		{
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			int num = <>1__state;
			string result2;
			try
			{
				TaskAwaiter<string> awaiter;
				if (num != 0)
				{
					if (num == 1)
					{
						awaiter = <>u__1;
						<>u__1 = default(TaskAwaiter<string>);
						num = (<>1__state = -1);
						goto IL_011c;
					}
					<subdomain>5__2 = uri.Scheme + "://" + uri.Host;
					<mainDomain>5__3 = GetMainDomain(uri);
					awaiter = TryGetFaviconUrl(<subdomain>5__2).GetAwaiter();
					if (!awaiter.IsCompleted)
					{
						num = (<>1__state = 0);
						<>u__1 = awaiter;
						<>t__builder.AwaitUnsafeOnCompleted<TaskAwaiter<string>, <GetFaviconUrlAsync>d__0>(ref awaiter, ref this);
						return;
					}
				}
				else
				{
					awaiter = <>u__1;
					<>u__1 = default(TaskAwaiter<string>);
					num = (<>1__state = -1);
				}
				string result = awaiter.GetResult();
				if (result == null)
				{
					if (<subdomain>5__2 != <mainDomain>5__3)
					{
						awaiter = TryGetFaviconUrl(<mainDomain>5__3).GetAwaiter();
						if (!awaiter.IsCompleted)
						{
							num = (<>1__state = 1);
							<>u__1 = awaiter;
							<>t__builder.AwaitUnsafeOnCompleted<TaskAwaiter<string>, <GetFaviconUrlAsync>d__0>(ref awaiter, ref this);
							return;
						}
						goto IL_011c;
					}
					goto IL_012b;
				}
				result2 = result;
				goto end_IL_0007;
				IL_011c:
				result = awaiter.GetResult();
				if (result == null)
				{
					goto IL_012b;
				}
				result2 = result;
				goto end_IL_0007;
				IL_012b:
				result2 = null;
				end_IL_0007:;
			}
			catch (global::System.Exception exception)
			{
				<>1__state = -2;
				<subdomain>5__2 = null;
				<mainDomain>5__3 = null;
				<>t__builder.SetException(exception);
				return;
			}
			<>1__state = -2;
			<subdomain>5__2 = null;
			<mainDomain>5__3 = null;
			<>t__builder.SetResult(result2);
		}

		[DebuggerHidden]
		private void SetStateMachine(IAsyncStateMachine stateMachine)
		{
			<>t__builder.SetStateMachine(stateMachine);
		}
	}

	[StructLayout(3)]
	[CompilerGenerated]
	private struct <IsValidImageUrl>d__5 : IAsyncStateMachine
	{
		public int <>1__state;

		public AsyncTaskMethodBuilder<bool> <>t__builder;

		public Uri url;

		private HttpClient <httpClient>5__2;

		private TaskAwaiter<HttpResponseMessage> <>u__1;

		private void MoveNext()
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Expected O, but got Unknown
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Expected O, but got Unknown
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			int num = <>1__state;
			bool result2;
			try
			{
				try
				{
					if (num != 0)
					{
						<httpClient>5__2 = new HttpClient();
					}
					try
					{
						TaskAwaiter<HttpResponseMessage> awaiter;
						if (num != 0)
						{
							<httpClient>5__2.Timeout = TimeSpan.FromSeconds(10L);
							awaiter = <httpClient>5__2.SendAsync(new HttpRequestMessage(HttpMethod.Head, url)).GetAwaiter();
							if (!awaiter.IsCompleted)
							{
								num = (<>1__state = 0);
								<>u__1 = awaiter;
								<>t__builder.AwaitUnsafeOnCompleted<TaskAwaiter<HttpResponseMessage>, <IsValidImageUrl>d__5>(ref awaiter, ref this);
								return;
							}
						}
						else
						{
							awaiter = <>u__1;
							<>u__1 = default(TaskAwaiter<HttpResponseMessage>);
							num = (<>1__state = -1);
						}
						HttpResponseMessage result = awaiter.GetResult();
						try
						{
							result2 = result.IsSuccessStatusCode && result.Content.Headers.ContentType != null && result.Content.Headers.ContentType.MediaType.ToLower().StartsWith("image/");
						}
						finally
						{
							if (num < 0)
							{
								((global::System.IDisposable)result)?.Dispose();
							}
						}
					}
					finally
					{
						if (num < 0 && <httpClient>5__2 != null)
						{
							((global::System.IDisposable)<httpClient>5__2).Dispose();
						}
					}
				}
				catch
				{
					result2 = false;
				}
			}
			catch (global::System.Exception exception)
			{
				<>1__state = -2;
				<>t__builder.SetException(exception);
				return;
			}
			<>1__state = -2;
			<>t__builder.SetResult(result2);
		}

		[DebuggerHidden]
		private void SetStateMachine(IAsyncStateMachine stateMachine)
		{
			<>t__builder.SetStateMachine(stateMachine);
		}
	}

	[StructLayout(3)]
	[CompilerGenerated]
	private struct <TryGetFaviconUrl>d__2 : IAsyncStateMachine
	{
		public int <>1__state;

		public AsyncTaskMethodBuilder<string> <>t__builder;

		public string domain;

		private HttpClient <httpClient>5__2;

		private string <faviconUrl>5__3;

		private TaskAwaiter<HttpResponseMessage> <>u__1;

		private TaskAwaiter<string> <>u__2;

		private void MoveNext()
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Expected O, but got Unknown
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Expected O, but got Unknown
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			int num = <>1__state;
			string result;
			try
			{
				if ((uint)num > 1u)
				{
					<httpClient>5__2 = new HttpClient();
				}
				try
				{
					_ = 1;
					try
					{
						TaskAwaiter<string> awaiter;
						TaskAwaiter<HttpResponseMessage> awaiter2;
						if (num != 0)
						{
							if (num == 1)
							{
								awaiter = <>u__2;
								<>u__2 = default(TaskAwaiter<string>);
								num = (<>1__state = -1);
								goto IL_011e;
							}
							<faviconUrl>5__3 = domain + "/favicon.ico";
							awaiter2 = <httpClient>5__2.SendAsync(new HttpRequestMessage(HttpMethod.Head, <faviconUrl>5__3)).GetAwaiter();
							if (!awaiter2.IsCompleted)
							{
								num = (<>1__state = 0);
								<>u__1 = awaiter2;
								<>t__builder.AwaitUnsafeOnCompleted<TaskAwaiter<HttpResponseMessage>, <TryGetFaviconUrl>d__2>(ref awaiter2, ref this);
								return;
							}
						}
						else
						{
							awaiter2 = <>u__1;
							<>u__1 = default(TaskAwaiter<HttpResponseMessage>);
							num = (<>1__state = -1);
						}
						if (!awaiter2.GetResult().IsSuccessStatusCode)
						{
							awaiter = <httpClient>5__2.GetStringAsync(domain).GetAwaiter();
							if (!awaiter.IsCompleted)
							{
								num = (<>1__state = 1);
								<>u__2 = awaiter;
								<>t__builder.AwaitUnsafeOnCompleted<TaskAwaiter<string>, <TryGetFaviconUrl>d__2>(ref awaiter, ref this);
								return;
							}
							goto IL_011e;
						}
						result = <faviconUrl>5__3;
						goto end_IL_001c;
						IL_011e:
						result = ExtractFaviconUrlFromHtml(awaiter.GetResult(), domain);
						end_IL_001c:;
					}
					catch
					{
						result = null;
					}
				}
				finally
				{
					if (num < 0 && <httpClient>5__2 != null)
					{
						((global::System.IDisposable)<httpClient>5__2).Dispose();
					}
				}
			}
			catch (global::System.Exception exception)
			{
				<>1__state = -2;
				<httpClient>5__2 = null;
				<>t__builder.SetException(exception);
				return;
			}
			<>1__state = -2;
			<httpClient>5__2 = null;
			<>t__builder.SetResult(result);
		}

		[DebuggerHidden]
		private void SetStateMachine(IAsyncStateMachine stateMachine)
		{
			<>t__builder.SetStateMachine(stateMachine);
		}
	}

	[AsyncStateMachine(typeof(<GetFaviconUrlAsync>d__0))]
	public static async global::System.Threading.Tasks.Task<string> GetFaviconUrlAsync(Uri uri)
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		string subdomain = uri.Scheme + "://" + uri.Host;
		string mainDomain = GetMainDomain(uri);
		string text = await TryGetFaviconUrl(subdomain);
		if (text != null)
		{
			return text;
		}
		if (subdomain != mainDomain)
		{
			text = await TryGetFaviconUrl(mainDomain);
			if (text != null)
			{
				return text;
			}
		}
		return null;
	}

	public static string GetMainDomain(Uri uri)
	{
		string[] array = uri.Host.Split('.', (StringSplitOptions)0);
		string text = uri.Host;
		if (array.Length > 2)
		{
			text = string.Join(".", Enumerable.Skip<string>((global::System.Collections.Generic.IEnumerable<string>)array, array.Length - 2));
		}
		return uri.Scheme + "://" + text;
	}

	[AsyncStateMachine(typeof(<TryGetFaviconUrl>d__2))]
	private static async global::System.Threading.Tasks.Task<string> TryGetFaviconUrl(string domain)
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		HttpClient httpClient = new HttpClient();
		try
		{
			_ = 1;
			try
			{
				string faviconUrl = domain + "/favicon.ico";
				if ((await httpClient.SendAsync(new HttpRequestMessage(HttpMethod.Head, faviconUrl))).IsSuccessStatusCode)
				{
					return faviconUrl;
				}
				return ExtractFaviconUrlFromHtml(await httpClient.GetStringAsync(domain), domain);
			}
			catch
			{
				return null;
			}
		}
		finally
		{
			((global::System.IDisposable)httpClient)?.Dispose();
		}
	}

	private static string ExtractFaviconUrlFromHtml(string html, string domain)
	{
		string[] array = new string[2] { "<link[^>]*rel=[\"'](?:shortcut )?icon[\"'][^>]*href=[\"']([^\"']+)", "<link[^>]*href=[\"']([^\"']+)[^>]*rel=[\"'](?:shortcut )?icon[\"']" };
		foreach (string text in array)
		{
			Match val = Regex.Match(html, text, (RegexOptions)1);
			if (((Group)val).Success)
			{
				return NormalizeUrl(((Capture)val.Groups[1]).Value, domain);
			}
		}
		return null;
	}

	private static string NormalizeUrl(string url, string domain)
	{
		if (url.StartsWith("//"))
		{
			return "https:" + url;
		}
		if (url.StartsWith("/"))
		{
			return domain + url;
		}
		if (!url.StartsWith("http"))
		{
			return domain + "/" + url;
		}
		return url;
	}

	[AsyncStateMachine(typeof(<IsValidImageUrl>d__5))]
	public static async global::System.Threading.Tasks.Task<bool> IsValidImageUrl(Uri url)
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		try
		{
			HttpClient httpClient = new HttpClient();
			try
			{
				httpClient.Timeout = TimeSpan.FromSeconds(10L);
				HttpResponseMessage val = await httpClient.SendAsync(new HttpRequestMessage(HttpMethod.Head, url));
				try
				{
					if (!val.IsSuccessStatusCode)
					{
						return false;
					}
					if (val.Content.Headers.ContentType == null)
					{
						return false;
					}
					return val.Content.Headers.ContentType.MediaType.ToLower().StartsWith("image/");
				}
				finally
				{
					((global::System.IDisposable)val)?.Dispose();
				}
			}
			finally
			{
				((global::System.IDisposable)httpClient)?.Dispose();
			}
		}
		catch
		{
			return false;
		}
	}
}
[ResonitePlugin("HGCommunity.R-Fiddler", "R-Fiddler", "2.0.0", "Knackrack615, NepuShiro, LeCloutPanda", "https://github.com/HGCommunity/R-Fiddler")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class Plugin : BasePlugin
{
	[HarmonyPatch(typeof(AssetManager))]
	private static class AssetManagerPatch
	{
		[HarmonyPrefix]
		[HarmonyPatch("GatherAsset")]
		private static bool GatherAssetPrefix(AssetManager __instance, EngineAssetGatherer ___assetGatherer, ref global::System.Threading.Tasks.ValueTask<GatherResult> __result, Uri __0, float __1, DB_Endpoint? __2)
		{
			if (!configEnabled.Value)
			{
				return true;
			}
			__result = HandleRequest<GatherResult>(__instance, ___assetGatherer, __0, __1, __2);
			return false;
		}

		[HarmonyPrefix]
		[HarmonyPatch("GatherAssetFile")]
		private static bool GatherAssetFilePrefix(AssetManager __instance, EngineAssetGatherer ___assetGatherer, ref global::System.Threading.Tasks.ValueTask<string> __result, Uri __0, float __1, DB_Endpoint? __2)
		{
			if (!configEnabled.Value)
			{
				return true;
			}
			__result = HandleRequest<string>(__instance, ___assetGatherer, __0, __1, __2);
			return false;
		}
	}

	[HarmonyPatch(typeof(NotificationPanel))]
	private static class NotificationPanelPatches
	{
		[HarmonyPostfix]
		[HarmonyPatch("OnAttach")]
		private static void OnAttachPostfix(NotificationPanel __instance)
		{
			if (addNotificationMethod != (MethodInfo)null && NotificationPanel.Current != null)
			{
				addNotification = (Action<string, string, Uri, colorX, NotificationType, string, Uri, IAssetProvider<AudioClip>>)(object)global::System.Delegate.CreateDelegate(typeof(Action<string, string, Uri, colorX, NotificationType, string, Uri, IAssetProvider<AudioClip>>), (object)NotificationPanel.Current, addNotificationMethod);
			}
		}
	}

	[Serializable]
	[CompilerGenerated]
	private sealed class <>c
	{
		[StructLayout(3)]
		private struct <<GetFaviconAsync>b__39_0>d : IAsyncStateMachine
		{
			public int <>1__state;

			public AsyncTaskMethodBuilder<string> <>t__builder;

			public Uri uri;

			private ConfiguredTaskAwaiter<string> <>u__1;

			private void MoveNext()
			{
				//IL_004e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0053: Unknown result type (might be due to invalid IL or missing references)
				//IL_005a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0016: Unknown result type (might be due to invalid IL or missing references)
				//IL_001b: Unknown result type (might be due to invalid IL or missing references)
				//IL_001e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0023: Unknown result type (might be due to invalid IL or missing references)
				//IL_0037: Unknown result type (might be due to invalid IL or missing references)
				//IL_0038: Unknown result type (might be due to invalid IL or missing references)
				int num = <>1__state;
				string result;
				try
				{
					ConfiguredTaskAwaiter<string> awaiter;
					if (num != 0)
					{
						awaiter = Helpers.GetFaviconUrlAsync(uri).ConfigureAwait(false).GetAwaiter();
						if (!awaiter.IsCompleted)
						{
							num = (<>1__state = 0);
							<>u__1 = awaiter;
							<>t__builder.AwaitUnsafeOnCompleted<ConfiguredTaskAwaiter<string>, <<GetFaviconAsync>b__39_0>d>(ref awaiter, ref this);
							return;
						}
					}
					else
					{
						awaiter = <>u__1;
						<>u__1 = default(ConfiguredTaskAwaiter<string>);
						num = (<>1__state = -1);
					}
					result = awaiter.GetResult() ?? configPlaceholderUri.Value;
				}
				catch (global::System.Exception exception)
				{
					<>1__state = -2;
					<>t__builder.SetException(exception);
					return;
				}
				<>1__state = -2;
				<>t__builder.SetResult(result);
			}

			[DebuggerHidden]
			private void SetStateMachine(IAsyncStateMachine stateMachine)
			{
				<>t__builder.SetStateMachine(stateMachine);
			}
		}

		public static readonly <>c <>9 = new <>c();

		public static EventHandler <>9__25_0;

		public static TimerCallback <>9__26_0;

		public static Func<string, string> <>9__28_0;

		public static Func<string, bool> <>9__28_1;

		public static Func<string, string> <>9__28_2;

		public static Func<string, string> <>9__29_0;

		public static Func<KeyValuePair<string, global::System.DateTime>, string> <>9__32_1;

		public static Action <>9__36_0;

		public static Func<Uri, global::System.Threading.Tasks.Task<string>> <>9__39_0;

		internal void <InitializeConfig>b__25_0(object? _, EventArgs _)
		{
			RebuildTrustedSet();
		}

		internal void <InitializeCleanupTimer>b__26_0(object? _)
		{
			CleanupCaches();
		}

		internal string <ParseTrustedDomains>b__28_0(string s)
		{
			return s.Trim();
		}

		internal bool <ParseTrustedDomains>b__28_1(string s)
		{
			return !string.IsNullOrWhiteSpace(s);
		}

		internal string <ParseTrustedDomains>b__28_2(string s)
		{
			return NormalizeHost(s);
		}

		internal string <NormalizeHost>b__29_0(string h)
		{
			try
			{
				return idnMapping.Value.GetAscii(h).ToLowerInvariant();
			}
			catch
			{
				return h.ToLowerInvariant();
			}
		}

		internal string <CleanupCaches>b__32_1(KeyValuePair<string, global::System.DateTime> kvp)
		{
			return kvp.Key;
		}

		internal void <PlayNotificationSound>b__36_0()
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Expected O, but got Unknown
			<>c__DisplayClass36_0 CS$<>8__locals0 = new <>c__DisplayClass36_0
			{
				clip = null,
				soundUri = new Uri(configNotifSoundUri.Value)
			};
			((ContainerWorker<Component>)(object)((Component)NotificationPanel.Current).Slot).ForeachComponent<StaticAudioClip>((Func<StaticAudioClip, bool>)delegate(StaticAudioClip a)
			{
				if (Sync<Uri>.op_Implicit(((StaticAssetProvider<AudioClip, DummyMetadata, AudioClipVariantDescriptor>)(object)a).URL) == CS$<>8__locals0.soundUri)
				{
					CS$<>8__locals0.clip = a;
					return false;
				}
				return true;
			}, false, false);
			if (CS$<>8__locals0.clip == null)
			{
				CS$<>8__locals0.clip = SlotAssets.AttachAudioClip(((Component)NotificationPanel.Current).Slot, CS$<>8__locals0.soundUri, true);
			}
			SlotAssets.PlayOneShot(((Component)NotificationPanel.Current).Slot, (IAssetProvider<AudioClip>)(object)CS$<>8__locals0.clip, 1f, false, (bool?)true, 1f, true, (AudioDistanceSpace)1, false);
		}

		[AsyncStateMachine(typeof(<<GetFaviconAsync>b__39_0>d))]
		internal async global::System.Threading.Tasks.Task<string> <GetFaviconAsync>b__39_0(Uri uri)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			return (await Helpers.GetFaviconUrlAsync(uri).ConfigureAwait(false)) ?? configPlaceholderUri.Value;
		}

		internal IdnMapping <.cctor>b__47_0()
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Expected O, but got Unknown
			return new IdnMapping();
		}
	}

	[CompilerGenerated]
	private sealed class <>c__DisplayClass35_0
	{
		public colorX backgroundColor;

		public string notificationText;

		public Uri target;

		public string uriDisplay;

		public Uri worldThumbnail;

		public Uri favicon;

		internal void <AddNotification>b__0()
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			if (addNotification != null)
			{
				addNotification.Invoke((string)null, uriDisplay, worldThumbnail, backgroundColor, GetNotificationType(), notificationText, favicon, (IAssetProvider<AudioClip>)null);
				AddHyperLink(NotificationPanel.Current, target);
			}
			else
			{
				PluginLog.LogError((object)"addNotification delegate is null - NotificationPanel may not be properly initialized");
			}
		}
	}

	[CompilerGenerated]
	private sealed class <>c__DisplayClass36_0
	{
		public Uri soundUri;

		public StaticAudioClip clip;

		internal bool <PlayNotificationSound>b__1(StaticAudioClip a)
		{
			if (Sync<Uri>.op_Implicit(((StaticAssetProvider<AudioClip, DummyMetadata, AudioClipVariantDescriptor>)(object)a).URL) == soundUri)
			{
				clip = a;
				return false;
			}
			return true;
		}
	}

	[StructLayout(3)]
	[CompilerGenerated]
	private struct <AddNotification>d__35 : IAsyncStateMachine
	{
		public int <>1__state;

		public AsyncTaskMethodBuilder<bool> <>t__builder;

		public colorX backgroundColor;

		public string notificationText;

		public Uri target;

		private <>c__DisplayClass35_0 <>8__1;

		private ConfiguredTaskAwaiter <>u__1;

		private ConfiguredTaskAwaiter<Uri> <>u__2;

		private void MoveNext()
		{
			//IL_027b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0282: Expected O, but got Unknown
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0167: Unknown result type (might be due to invalid IL or missing references)
			//IL_016c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0174: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: Unknown result type (might be due to invalid IL or missing references)
			//IL_012e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0132: Unknown result type (might be due to invalid IL or missing references)
			//IL_0137: Unknown result type (might be due to invalid IL or missing references)
			//IL_01aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_01af: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_014c: Unknown result type (might be due to invalid IL or missing references)
			//IL_014e: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_0260: Unknown result type (might be due to invalid IL or missing references)
			//IL_026b: Expected O, but got Unknown
			int num = <>1__state;
			bool result;
			try
			{
				if ((uint)num <= 2u)
				{
					goto IL_0078;
				}
				<>8__1 = new <>c__DisplayClass35_0();
				<>8__1.backgroundColor = backgroundColor;
				<>8__1.notificationText = notificationText;
				<>8__1.target = target;
				if (!configEnabled.Value)
				{
					result = true;
				}
				else
				{
					if (!ShouldSkipNotification(<>8__1.target, out string _))
					{
						goto IL_0078;
					}
					result = true;
				}
				goto end_IL_0007;
				IL_0078:
				bool flag = default(bool);
				try
				{
					ConfiguredTaskAwaiter awaiter2;
					ConfiguredTaskAwaiter<Uri> awaiter;
					World focusedWorld;
					Uri result2;
					switch (num)
					{
					default:
					{
						ConfiguredTaskAwaitable val = PlayNotificationSound().ConfigureAwait(false);
						awaiter2 = ((ConfiguredTaskAwaitable)(ref val)).GetAwaiter();
						if (!((ConfiguredTaskAwaiter)(ref awaiter2)).IsCompleted)
						{
							num = (<>1__state = 0);
							<>u__1 = awaiter2;
							<>t__builder.AwaitUnsafeOnCompleted<ConfiguredTaskAwaiter, <AddNotification>d__35>(ref awaiter2, ref this);
							return;
						}
						goto IL_00e7;
					}
					case 0:
						awaiter2 = <>u__1;
						<>u__1 = default(ConfiguredTaskAwaiter);
						num = (<>1__state = -1);
						goto IL_00e7;
					case 1:
						awaiter = <>u__2;
						<>u__2 = default(ConfiguredTaskAwaiter<Uri>);
						num = (<>1__state = -1);
						goto IL_0183;
					case 2:
						{
							awaiter = <>u__2;
							<>u__2 = default(ConfiguredTaskAwaiter<Uri>);
							num = (<>1__state = -1);
							break;
						}
						IL_0183:
						result2 = awaiter.GetResult();
						<>8__1.worldThumbnail = result2;
						awaiter = GetFaviconAsync(<>8__1.target).ConfigureAwait(false).GetAwaiter();
						if (!awaiter.IsCompleted)
						{
							num = (<>1__state = 2);
							<>u__2 = awaiter;
							<>t__builder.AwaitUnsafeOnCompleted<ConfiguredTaskAwaiter<Uri>, <AddNotification>d__35>(ref awaiter, ref this);
							return;
						}
						break;
						IL_00e7:
						((ConfiguredTaskAwaiter)(ref awaiter2)).GetResult();
						focusedWorld = Engine.Current.WorldManager.FocusedWorld;
						<>8__1.uriDisplay = FormatUriDisplay(<>8__1.target);
						awaiter = GetWorldThumbnail(focusedWorld, <>8__1.target).ConfigureAwait(false).GetAwaiter();
						if (!awaiter.IsCompleted)
						{
							num = (<>1__state = 1);
							<>u__2 = awaiter;
							<>t__builder.AwaitUnsafeOnCompleted<ConfiguredTaskAwaiter<Uri>, <AddNotification>d__35>(ref awaiter, ref this);
							return;
						}
						goto IL_0183;
					}
					result2 = awaiter.GetResult();
					<>8__1.favicon = result2;
					object previousFaviconLock = Plugin.previousFaviconLock;
					flag = false;
					try
					{
						Monitor.Enter(previousFaviconLock, ref flag);
						previousFavicon = <>8__1.favicon;
					}
					finally
					{
						if (num < 0 && flag)
						{
							Monitor.Exit(previousFaviconLock);
						}
					}
					((ComponentBase<Component>)(object)NotificationPanel.Current).RunSynchronously((Action)delegate
					{
						//IL_001a: Unknown result type (might be due to invalid IL or missing references)
						//IL_001f: Unknown result type (might be due to invalid IL or missing references)
						if (addNotification != null)
						{
							addNotification.Invoke((string)null, <>8__1.uriDisplay, <>8__1.worldThumbnail, <>8__1.backgroundColor, GetNotificationType(), <>8__1.notificationText, <>8__1.favicon, (IAssetProvider<AudioClip>)null);
							AddHyperLink(NotificationPanel.Current, <>8__1.target);
						}
						else
						{
							PluginLog.LogError((object)"addNotification delegate is null - NotificationPanel may not be properly initialized");
						}
					}, false);
					result = true;
				}
				catch (global::System.Exception ex)
				{
					ManualLogSource pluginLog = PluginLog;
					BepInExErrorLogInterpolatedStringHandler val2 = new BepInExErrorLogInterpolatedStringHandler(27, 1, ref flag);
					if (flag)
					{
						((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("Error adding notification: ");
						((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<global::System.Exception>(ex);
					}
					pluginLog.LogError(val2);
					result = true;
				}
				end_IL_0007:;
			}
			catch (global::System.Exception exception)
			{
				<>1__state = -2;
				<>8__1 = null;
				<>t__builder.SetException(exception);
				return;
			}
			<>1__state = -2;
			<>8__1 = null;
			<>t__builder.SetResult(result);
		}

		[DebuggerHidden]
		private void SetStateMachine(IAsyncStateMachine stateMachine)
		{
			<>t__builder.SetStateMachine(stateMachine);
		}
	}

	[StructLayout(3)]
	[CompilerGenerated]
	private struct <AskForPermission>d__43 : IAsyncStateMachine
	{
		public int <>1__state;

		public AsyncTaskMethodBuilder<bool> <>t__builder;

		public Uri target;

		private ConfiguredTaskAwaiter<bool> <>u__1;

		private void MoveNext()
		{
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Expected O, but got Unknown
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			int num = <>1__state;
			bool result;
			try
			{
				ConfiguredTaskAwaiter<bool> awaiter;
				if (num != 0)
				{
					ManualLogSource pluginLog = PluginLog;
					bool flag = default(bool);
					BepInExDebugLogInterpolatedStringHandler val = new BepInExDebugLogInterpolatedStringHandler(16, 1, ref flag);
					if (flag)
					{
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Got Request for ");
						((BepInExLogInterpolatedStringHandler)val).AppendFormatted<Uri>(target);
					}
					pluginLog.LogDebug(val);
					ValueTuple<string, colorX> notificationDetails = GetNotificationDetails(target.Scheme);
					awaiter = AddNotification(notificationText: notificationDetails.Item1, backgroundColor: notificationDetails.Item2, target: target).ConfigureAwait(false).GetAwaiter();
					if (!awaiter.IsCompleted)
					{
						num = (<>1__state = 0);
						<>u__1 = awaiter;
						<>t__builder.AwaitUnsafeOnCompleted<ConfiguredTaskAwaiter<bool>, <AskForPermission>d__43>(ref awaiter, ref this);
						return;
					}
				}
				else
				{
					awaiter = <>u__1;
					<>u__1 = default(ConfiguredTaskAwaiter<bool>);
					num = (<>1__state = -1);
				}
				result = awaiter.GetResult();
			}
			catch (global::System.Exception exception)
			{
				<>1__state = -2;
				<>t__builder.SetException(exception);
				return;
			}
			<>1__state = -2;
			<>t__builder.SetResult(result);
		}

		[DebuggerHidden]
		private void SetStateMachine(IAsyncStateMachine stateMachine)
		{
			<>t__builder.SetStateMachine(stateMachine);
		}
	}

	[StructLayout(3)]
	[CompilerGenerated]
	private struct <GetFaviconAsync>d__39 : IAsyncStateMachine
	{
		public int <>1__state;

		public AsyncTaskMethodBuilder<Uri> <>t__builder;

		public Uri target;

		private ConfiguredTaskAwaiter<string> <>u__1;

		private void MoveNext()
		{
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Expected O, but got Unknown
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Expected O, but got Unknown
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			int num = <>1__state;
			Uri result;
			try
			{
				try
				{
					ConfiguredTaskAwaiter<string> awaiter;
					if (num != 0)
					{
						awaiter = faviconCache.GetOrAdd(target, (Func<Uri, global::System.Threading.Tasks.Task<string>>)([AsyncStateMachine(typeof(<>c.<<GetFaviconAsync>b__39_0>d))] async (Uri uri) => (await Helpers.GetFaviconUrlAsync(uri).ConfigureAwait(false)) ?? configPlaceholderUri.Value)).ConfigureAwait(false).GetAwaiter();
						if (!awaiter.IsCompleted)
						{
							num = (<>1__state = 0);
							<>u__1 = awaiter;
							<>t__builder.AwaitUnsafeOnCompleted<ConfiguredTaskAwaiter<string>, <GetFaviconAsync>d__39>(ref awaiter, ref this);
							return;
						}
					}
					else
					{
						awaiter = <>u__1;
						<>u__1 = default(ConfiguredTaskAwaiter<string>);
						num = (<>1__state = -1);
					}
					result = new Uri(awaiter.GetResult());
				}
				catch
				{
					result = new Uri(configPlaceholderUri.Value);
				}
			}
			catch (global::System.Exception exception)
			{
				<>1__state = -2;
				<>t__builder.SetException(exception);
				return;
			}
			<>1__state = -2;
			<>t__builder.SetResult(result);
		}

		[DebuggerHidden]
		private void SetStateMachine(IAsyncStateMachine stateMachine)
		{
			<>t__builder.SetStateMachine(stateMachine);
		}
	}

	[StructLayout(3)]
	[CompilerGenerated]
	private struct <GetWorldThumbnail>d__38 : IAsyncStateMachine
	{
		public int <>1__state;

		public AsyncTaskMethodBuilder<Uri> <>t__builder;

		public Uri target;

		public World world;

		private Uri <placeholder>5__2;

		private ConfiguredTaskAwaiter<bool> <>u__1;

		private void MoveNext()
		{
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Expected O, but got Unknown
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Expected O, but got Unknown
			int num = <>1__state;
			Uri result;
			try
			{
				ConfiguredTaskAwaiter<bool> awaiter;
				if (num != 0)
				{
					<placeholder>5__2 = new Uri(configPlaceholderUri.Value);
					awaiter = Helpers.IsValidImageUrl(target).ConfigureAwait(false).GetAwaiter();
					if (!awaiter.IsCompleted)
					{
						num = (<>1__state = 0);
						<>u__1 = awaiter;
						<>t__builder.AwaitUnsafeOnCompleted<ConfiguredTaskAwaiter<bool>, <GetWorldThumbnail>d__38>(ref awaiter, ref this);
						return;
					}
				}
				else
				{
					awaiter = <>u__1;
					<>u__1 = default(ConfiguredTaskAwaiter<bool>);
					num = (<>1__state = -1);
				}
				if (awaiter.GetResult())
				{
					result = target;
				}
				else
				{
					if (world == null || WorldExtensions.IsUserspace(world) || string.Equals(world.Name, "local", (StringComparison)5))
					{
						goto IL_00ef;
					}
					SessionInfo obj = world.GenerateSessionInfo();
					string text = ((obj != null) ? obj.ThumbnailUrl : null);
					if (string.IsNullOrEmpty(text))
					{
						goto IL_00ef;
					}
					result = new Uri(text);
				}
				goto end_IL_0007;
				IL_00ef:
				result = <placeholder>5__2;
				end_IL_0007:;
			}
			catch (global::System.Exception exception)
			{
				<>1__state = -2;
				<placeholder>5__2 = null;
				<>t__builder.SetException(exception);
				return;
			}
			<>1__state = -2;
			<placeholder>5__2 = null;
			<>t__builder.SetResult(result);
		}

		[DebuggerHidden]
		private void SetStateMachine(IAsyncStateMachine stateMachine)
		{
			<>t__builder.SetStateMachine(stateMachine);
		}
	}

	[StructLayout(3)]
	[CompilerGenerated]
	private struct <HandleRequest>d__41<T> : IAsyncStateMachine where T : notnull
	{
		public int <>1__state;

		public AsyncValueTaskMethodBuilder<T> <>t__builder;

		public Uri uri;

		public EngineAssetGatherer assetGatherer;

		public float priority;

		public DB_Endpoint? endpointOverwrite;

		private ConfiguredTaskAwaiter<bool> <>u__1;

		private ConfiguredValueTaskAwaiter<GatherResult> <>u__2;

		private ConfiguredValueTaskAwaiter<string> <>u__3;

		private void MoveNext()
		{
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_011b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0120: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: Unknown result type (might be due to invalid IL or missing references)
			//IL_018a: Unknown result type (might be due to invalid IL or missing references)
			//IL_018f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0197: Unknown result type (might be due to invalid IL or missing references)
			//IL_0236: Unknown result type (might be due to invalid IL or missing references)
			//IL_023b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0243: Unknown result type (might be due to invalid IL or missing references)
			//IL_0139: Unknown result type (might be due to invalid IL or missing references)
			//IL_013e: Unknown result type (might be due to invalid IL or missing references)
			//IL_014c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0151: Unknown result type (might be due to invalid IL or missing references)
			//IL_0155: Unknown result type (might be due to invalid IL or missing references)
			//IL_015a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0254: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_016f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0171: Unknown result type (might be due to invalid IL or missing references)
			//IL_0270: Unknown result type (might be due to invalid IL or missing references)
			//IL_0277: Expected O, but got Unknown
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0201: Unknown result type (might be due to invalid IL or missing references)
			//IL_0206: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Unknown result type (might be due to invalid IL or missing references)
			//IL_021b: Unknown result type (might be due to invalid IL or missing references)
			//IL_021d: Unknown result type (might be due to invalid IL or missing references)
			int num = <>1__state;
			T result;
			try
			{
				bool flag;
				ConfiguredTaskAwaiter<bool> awaiter3;
				ConfiguredValueTaskAwaiter<string> awaiter2;
				ConfiguredValueTaskAwaiter<GatherResult> awaiter;
				ManualLogSource pluginLog;
				BepInExDebugLogInterpolatedStringHandler val;
				GatherResult result2;
				switch (num)
				{
				default:
					flag = IsAllowedUri(uri);
					if (!flag)
					{
						awaiter3 = AskForPermission(uri).ConfigureAwait(false).GetAwaiter();
						if (!awaiter3.IsCompleted)
						{
							num = (<>1__state = 0);
							<>u__1 = awaiter3;
							<>t__builder.AwaitUnsafeOnCompleted<ConfiguredTaskAwaiter<bool>, <HandleRequest>d__41<T>>(ref awaiter3, ref this);
							return;
						}
						goto IL_008f;
					}
					goto IL_0097;
				case 0:
					awaiter3 = <>u__1;
					<>u__1 = default(ConfiguredTaskAwaiter<bool>);
					num = (<>1__state = -1);
					goto IL_008f;
				case 1:
					awaiter = <>u__2;
					<>u__2 = default(ConfiguredValueTaskAwaiter<GatherResult>);
					num = (<>1__state = -1);
					goto IL_0137;
				case 2:
					awaiter2 = <>u__3;
					<>u__3 = default(ConfiguredValueTaskAwaiter<string>);
					num = (<>1__state = -1);
					goto IL_01a6;
				case 3:
					{
						awaiter = <>u__2;
						<>u__2 = default(ConfiguredValueTaskAwaiter<GatherResult>);
						num = (<>1__state = -1);
						goto IL_0252;
					}
					IL_01a6:
					result = (T)(object)awaiter2.GetResult();
					goto end_IL_0007;
					IL_0252:
					result = (T)(object)awaiter.GetResult();
					goto end_IL_0007;
					IL_008f:
					flag = awaiter3.GetResult();
					goto IL_0097;
					IL_0097:
					if (flag)
					{
						if (typeof(T) == typeof(string))
						{
							awaiter = assetGatherer.Gather(uri, priority, endpointOverwrite).ConfigureAwait(false).GetAwaiter();
							if (!awaiter.IsCompleted)
							{
								num = (<>1__state = 1);
								<>u__2 = awaiter;
								<>t__builder.AwaitUnsafeOnCompleted<ConfiguredValueTaskAwaiter<GatherResult>, <HandleRequest>d__41<T>>(ref awaiter, ref this);
								return;
							}
							goto IL_0137;
						}
						if (!(typeof(T) == typeof(GatherResult)))
						{
							break;
						}
						awaiter = assetGatherer.Gather(uri, priority, endpointOverwrite).ConfigureAwait(false).GetAwaiter();
						if (!awaiter.IsCompleted)
						{
							num = (<>1__state = 3);
							<>u__2 = awaiter;
							<>t__builder.AwaitUnsafeOnCompleted<ConfiguredValueTaskAwaiter<GatherResult>, <HandleRequest>d__41<T>>(ref awaiter, ref this);
							return;
						}
						goto IL_0252;
					}
					pluginLog = PluginLog;
					val = new BepInExDebugLogInterpolatedStringHandler(32, 1, ref flag);
					if (flag)
					{
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral("No permissions to load asset at ");
						((BepInExLogInterpolatedStringHandler)val).AppendFormatted<Uri>(uri);
					}
					pluginLog.LogDebug(val);
					break;
					IL_0137:
					result2 = awaiter.GetResult();
					awaiter2 = ((GatherResult)(ref result2)).GetFile().ConfigureAwait(false).GetAwaiter();
					if (!awaiter2.IsCompleted)
					{
						num = (<>1__state = 2);
						<>u__3 = awaiter2;
						<>t__builder.AwaitUnsafeOnCompleted<ConfiguredValueTaskAwaiter<string>, <HandleRequest>d__41<T>>(ref awaiter2, ref this);
						return;
					}
					goto IL_01a6;
				}
				result = default(T);
				end_IL_0007:;
			}
			catch (global::System.Exception exception)
			{
				<>1__state = -2;
				<>t__builder.SetException(exception);
				return;
			}
			<>1__state = -2;
			<>t__builder.SetResult(result);
		}

		[DebuggerHidden]
		private void SetStateMachine(IAsyncStateMachine stateMachine)
		{
			<>t__builder.SetStateMachine(stateMachine);
		}
	}

	[StructLayout(3)]
	[CompilerGenerated]
	private struct <PlayNotificationSound>d__36 : IAsyncStateMachine
	{
		public int <>1__state;

		public AsyncTaskMethodBuilder <>t__builder;

		private ConfiguredTaskAwaiter <>u__1;

		private void MoveNext()
		{
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Expected O, but got Unknown
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			int num = <>1__state;
			try
			{
				ConfiguredTaskAwaiter awaiter;
				if (num == 0)
				{
					awaiter = <>u__1;
					<>u__1 = default(ConfiguredTaskAwaiter);
					num = (<>1__state = -1);
					goto IL_0093;
				}
				if (configNotifSound.Value)
				{
					object obj = <>c.<>9__36_0;
					if (obj == null)
					{
						Action val = delegate
						{
							//IL_0018: Unknown result type (might be due to invalid IL or missing references)
							//IL_0022: Expected O, but got Unknown
							<>c__DisplayClass36_0 CS$<>8__locals0 = new <>c__DisplayClass36_0
							{
								clip = null,
								soundUri = new Uri(configNotifSoundUri.Value)
							};
							((ContainerWorker<Component>)(object)((Component)NotificationPanel.Current).Slot).ForeachComponent<StaticAudioClip>((Func<StaticAudioClip, bool>)delegate(StaticAudioClip a)
							{
								if (Sync<Uri>.op_Implicit(((StaticAssetProvider<AudioClip, DummyMetadata, AudioClipVariantDescriptor>)(object)a).URL) == CS$<>8__locals0.soundUri)
								{
									CS$<>8__locals0.clip = a;
									return false;
								}
								return true;
							}, false, false);
							if (CS$<>8__locals0.clip == null)
							{
								CS$<>8__locals0.clip = SlotAssets.AttachAudioClip(((Component)NotificationPanel.Current).Slot, CS$<>8__locals0.soundUri, true);
							}
							SlotAssets.PlayOneShot(((Component)NotificationPanel.Current).Slot, (IAssetProvider<AudioClip>)(object)CS$<>8__locals0.clip, 1f, false, (bool?)true, 1f, true, (AudioDistanceSpace)1, false);
						};
						<>c.<>9__36_0 = val;
						obj = (object)val;
					}
					ConfiguredTaskAwaitable val2 = global::System.Threading.Tasks.Task.Run((Action)obj).ConfigureAwait(false);
					awaiter = ((ConfiguredTaskAwaitable)(ref val2)).GetAwaiter();
					if (!((ConfiguredTaskAwaiter)(ref awaiter)).IsCompleted)
					{
						num = (<>1__state = 0);
						<>u__1 = awaiter;
						((AsyncTaskMethodBuilder)(ref <>t__builder)).AwaitUnsafeOnCompleted<ConfiguredTaskAwaiter, <PlayNotificationSound>d__36>(ref awaiter, ref this);
						return;
					}
					goto IL_0093;
				}
				goto end_IL_0007;
				IL_0093:
				((ConfiguredTaskAwaiter)(ref awaiter)).GetResult();
				end_IL_0007:;
			}
			catch (global::System.Exception exception)
			{
				<>1__state = -2;
				((AsyncTaskMethodBuilder)(ref <>t__builder)).SetException(exception);
				return;
			}
			<>1__state = -2;
			((AsyncTaskMethodBuilder)(ref <>t__builder)).SetResult();
		}

		[DebuggerHidden]
		private void SetStateMachine(IAsyncStateMachine stateMachine)
		{
			((AsyncTaskMethodBuilder)(ref <>t__builder)).SetStateMachine(stateMachine);
		}
	}

	private static ManualLogSource PluginLog = null;

	private const int CLEANUP_INTERVAL_MINUTES = 1;

	private const int COOLDOWN_MULTIPLIER = 2;

	private const char DOMAIN_SEPARATOR = '.';

	private const char PATH_SEPARATOR = '/';

	private const char QUERY_SEPARATOR = '?';

	private static readonly MethodInfo addNotificationMethod = AccessTools.Method(typeof(NotificationPanel), "AddNotification", new global::System.Type[8]
	{
		typeof(string),
		typeof(string),
		typeof(Uri),
		typeof(colorX),
		typeof(NotificationType),
		typeof(string),
		typeof(Uri),
		typeof(IAssetProvider<AudioClip>)
	}, (global::System.Type[])null);

	private static readonly ConcurrentDictionary<string, global::System.DateTime> domainCooldowns = new ConcurrentDictionary<string, global::System.DateTime>();

	private static readonly ConcurrentDictionary<Uri, global::System.Threading.Tasks.Task<string>> faviconCache = new ConcurrentDictionary<Uri, global::System.Threading.Tasks.Task<string>>();

	private static readonly ReaderWriterLockSlim trustedLock = new ReaderWriterLockSlim();

	private static HashSet<string> trustedDomains = new HashSet<string>((IEqualityComparer<string>)(object)StringComparer.OrdinalIgnoreCase);

	private static readonly ConcurrentDictionary<string, string> idnCache = new ConcurrentDictionary<string, string>((IEqualityComparer<string>)(object)StringComparer.OrdinalIgnoreCase);

	private static readonly object previousFaviconLock = new object();

	private static Uri? previousFavicon;

	private static readonly Lazy<IdnMapping> idnMapping = new Lazy<IdnMapping>((Func<IdnMapping>)(() => new IdnMapping()));

	private static Timer? cleanupTimer;

	private static global::System.DateTime lastCleanup = global::System.DateTime.MinValue;

	private static ConfigEntry<bool> configEnabled = null;

	private static ConfigEntry<string> configTrustedUri = null;

	private static ConfigEntry<int> configCooldown = null;

	private static ConfigEntry<string> configPlaceholderUri = null;

	private static ConfigEntry<bool> configNotifSound = null;

	private static ConfigEntry<string> configNotifSoundUri = null;

	private static Action<string, string, Uri, colorX, NotificationType, string, Uri, IAssetProvider<AudioClip>>? addNotification;

	public override void Load()
	{
		PluginLog = ((BasePlugin)this).Log;
		InitializeConfig();
		((BasePlugin)this).HarmonyInstance.PatchAll();
		RebuildTrustedSet();
		InitializeCleanupTimer();
	}

	private void InitializeConfig()
	{
		//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f0: Expected O, but got Unknown
		configEnabled = ((BasePlugin)this).Config.Bind<bool>("General", "Enabled", true, "Toggle notifications for external asset loading.");
		configTrustedUri = ((BasePlugin)this).Config.Bind<string>("General", "TrustedURI", "google.com, imgur.com, reddit.com, youtube.com, facebook.com, twitter.com, wikipedia.org, wikimedia.org, discordapp.net, discordapp.com, resonite.com", "List of trusted domains that won't trigger notifications.");
		configCooldown = ((BasePlugin)this).Config.Bind<int>("General", "Cooldown", 5, "Set a cooldown period (in seconds) between notifications for the same domain. 0 to disable");
		configPlaceholderUri = ((BasePlugin)this).Config.Bind<string>("General", "PlaceholderURI", "resdb:///264a3cdc5c149326aefd44d40b23a068032c716d3966ca5dc883775eb236ac10.webp", "Specify an image to use when no image is available.");
		configNotifSound = ((BasePlugin)this).Config.Bind<bool>("General", "NotifSound", false, "Enable sound for notifications.");
		configNotifSoundUri = ((BasePlugin)this).Config.Bind<string>("General", "NotifURI", "resdb:///aba6554bd032a406c11b3b0bdb4e1214d2b12808891993e4fb498449f94e37a7.wav", "Set the sound file for notifications.");
		ConfigEntry<string> obj = configTrustedUri;
		object obj2 = <>c.<>9__25_0;
		if (obj2 == null)
		{
			EventHandler val = delegate
			{
				RebuildTrustedSet();
			};
			<>c.<>9__25_0 = val;
			obj2 = (object)val;
		}
		obj.SettingChanged += (EventHandler)obj2;
	}

	private static void InitializeCleanupTimer()
	{
		//IL_0032: Unknown result type (might be due to invalid IL or missing references)
		//IL_0039: Unknown result type (might be due to invalid IL or missing references)
		//IL_003e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0048: Expected O, but got Unknown
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_0029: Unknown result type (might be due to invalid IL or missing references)
		//IL_002f: Expected O, but got Unknown
		Timer? obj = cleanupTimer;
		if (obj != null)
		{
			obj.Dispose();
		}
		object obj2 = <>c.<>9__26_0;
		if (obj2 == null)
		{
			TimerCallback val = delegate
			{
				CleanupCaches();
			};
			<>c.<>9__26_0 = val;
			obj2 = (object)val;
		}
		cleanupTimer = new Timer((TimerCallback)obj2, (object)null, TimeSpan.FromMinutes(1L), TimeSpan.FromMinutes(1L));
	}

	private static void RebuildTrustedSet()
	{
		HashSet<string> val = ParseTrustedDomains(configTrustedUri.Value);
		trustedLock.EnterWriteLock();
		try
		{
			trustedDomains = val;
		}
		finally
		{
			trustedLock.ExitWriteLock();
		}
	}

	private static HashSet<string> ParseTrustedDomains(string trustedUriString)
	{
		return new HashSet<string>(Enumerable.Select<string, string>(Enumerable.Where<string>(Enumerable.Select<string, string>((global::System.Collections.Generic.IEnumerable<string>)trustedUriString.Split(',', (StringSplitOptions)0), (Func<string, string>)((string s) => s.Trim())), (Func<string, bool>)((string s) => !string.IsNullOrWhiteSpace(s))), (Func<string, string>)((string s) => NormalizeHost(s))), (IEqualityComparer<string>)(object)StringComparer.OrdinalIgnoreCase);
	}

	private static string NormalizeHost(string host)
	{
		if (string.IsNullOrWhiteSpace(host))
		{
			return string.Empty;
		}
		host = host.Trim().Trim('.');
		return idnCache.GetOrAdd(host, (Func<string, string>)delegate(string h)
		{
			try
			{
				return idnMapping.Value.GetAscii(h).ToLowerInvariant();
			}
			catch
			{
				return h.ToLowerInvariant();
			}
		});
	}

	private static bool IsTrustedHost(string host)
	{
		if (string.IsNullOrWhiteSpace(host))
		{
			return false;
		}
		string normalizedHost = NormalizeHost(host);
		trustedLock.EnterReadLock();
		try
		{
			return Enumerable.Any<string>((global::System.Collections.Generic.IEnumerable<string>)trustedDomains, (Func<string, bool>)((string trusted) => normalizedHost == trusted || normalizedHost.EndsWith($"{46}{trusted}", (StringComparison)4)));
		}
		finally
		{
			trustedLock.ExitReadLock();
		}
	}

	private static bool ShouldSkipNotification(Uri target, out string domain)
	{
		//IL_0066: Unknown result type (might be due to invalid IL or missing references)
		//IL_006d: Unknown result type (might be due to invalid IL or missing references)
		domain = target.Host.ToLowerInvariant();
		lock (previousFaviconLock)
		{
			if (target == previousFavicon)
			{
				return true;
			}
		}
		int value = configCooldown.Value;
		if (value <= 0)
		{
			return false;
		}
		global::System.DateTime utcNow = global::System.DateTime.UtcNow;
		global::System.DateTime dateTime = default(global::System.DateTime);
		if (domainCooldowns.TryGetValue(domain, ref dateTime) && utcNow - dateTime < TimeSpan.FromSeconds((long)value))
		{
			return true;
		}
		domainCooldowns[domain] = utcNow;
		return false;
	}

	private static void CleanupCaches()
	{
		//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f3: Expected O, but got Unknown
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_0072: Unknown result type (might be due to invalid IL or missing references)
		//IL_0077: Unknown result type (might be due to invalid IL or missing references)
		try
		{
			global::System.DateTime utcNow = global::System.DateTime.UtcNow;
			int value = configCooldown.Value;
			if (value > 0)
			{
				global::System.DateTime cutoff = utcNow - TimeSpan.FromSeconds((long)(value * 2));
				Enumerator<string> enumerator = Enumerable.ToList<string>(Enumerable.Select<KeyValuePair<string, global::System.DateTime>, string>(Enumerable.Where<KeyValuePair<string, global::System.DateTime>>((global::System.Collections.Generic.IEnumerable<KeyValuePair<string, global::System.DateTime>>)domainCooldowns, (Func<KeyValuePair<string, global::System.DateTime>, bool>)((KeyValuePair<string, global::System.DateTime> kvp) => kvp.Value < cutoff)), (Func<KeyValuePair<string, global::System.DateTime>, string>)((KeyValuePair<string, global::System.DateTime> kvp) => kvp.Key))).GetEnumerator();
				try
				{
					global::System.DateTime dateTime = default(global::System.DateTime);
					while (enumerator.MoveNext())
					{
						string current = enumerator.Current;
						domainCooldowns.TryRemove(current, ref dateTime);
					}
				}
				finally
				{
					((global::System.IDisposable)enumerator).Dispose();
				}
			}
			if (faviconCache.Count > 100)
			{
				faviconCache.Clear();
			}
			if (idnCache.Count > 500)
			{
				idnCache.Clear();
			}
		}
		catch (global::System.Exception ex)
		{
			ManualLogSource pluginLog = PluginLog;
			bool flag = default(bool);
			BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(22, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Error during cleanup: ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<global::System.Exception>(ex);
			}
			pluginLog.LogError(val);
		}
	}

	[AsyncStateMachine(typeof(<AddNotification>d__35))]
	private static async global::System.Threading.Tasks.Task<bool> AddNotification(colorX backgroundColor, Uri target, string notificationText = "N/A")
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_000e: Unknown result type (might be due to invalid IL or missing references)
		//IL_000f: Unknown result type (might be due to invalid IL or missing references)
		string notificationText2 = notificationText;
		Uri target2 = target;
		if (!configEnabled.Value)
		{
			return true;
		}
		if (ShouldSkipNotification(target2, out string _))
		{
			return true;
		}
		try
		{
			await PlayNotificationSound().ConfigureAwait(false);
			World focusedWorld = Engine.Current.WorldManager.FocusedWorld;
			string uriDisplay = FormatUriDisplay(target2);
			Uri worldThumbnail = await GetWorldThumbnail(focusedWorld, target2).ConfigureAwait(false);
			Uri favicon = await GetFaviconAsync(target2).ConfigureAwait(false);
			lock (previousFaviconLock)
			{
				previousFavicon = favicon;
			}
			((ComponentBase<Component>)(object)NotificationPanel.Current).RunSynchronously((Action)delegate
			{
				//IL_001a: Unknown result type (might be due to invalid IL or missing references)
				//IL_001f: Unknown result type (might be due to invalid IL or missing references)
				if (addNotification != null)
				{
					addNotification.Invoke((string)null, uriDisplay, worldThumbnail, backgroundColor, GetNotificationType(), notificationText2, favicon, (IAssetProvider<AudioClip>)null);
					AddHyperLink(NotificationPanel.Current, target2);
				}
				else
				{
					PluginLog.LogError((object)"addNotification delegate is null - NotificationPanel may not be properly initialized");
				}
			}, false);
			return true;
		}
		catch (global::System.Exception ex)
		{
			ManualLogSource pluginLog = PluginLog;
			bool flag = default(bool);
			BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(27, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Error adding notification: ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<global::System.Exception>(ex);
			}
			pluginLog.LogError(val);
			return true;
		}
	}

	[AsyncStateMachine(typeof(<PlayNotificationSound>d__36))]
	private static global::System.Threading.Tasks.Task PlayNotificationSound()
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		<PlayNotificationSound>d__36 <PlayNotificationSound>d__ = default(<PlayNotificationSound>d__36);
		<PlayNotificationSound>d__.<>t__builder = AsyncTaskMethodBuilder.Create();
		<PlayNotificationSound>d__.<>1__state = -1;
		((AsyncTaskMethodBuilder)(ref <PlayNotificationSound>d__.<>t__builder)).Start<<PlayNotificationSound>d__36>(ref <PlayNotificationSound>d__);
		return ((AsyncTaskMethodBuilder)(ref <PlayNotificationSound>d__.<>t__builder)).Task;
	}

	private static string FormatUriDisplay(Uri target)
	{
		string text = Enumerable.LastOrDefault<string>((global::System.Collections.Generic.IEnumerable<string>)target.AbsolutePath.Split('?', (StringSplitOptions)0)[0].Split('/', (StringSplitOptions)0)) ?? string.Empty;
		return "<nobr>" + target.Host + "..." + text;
	}

	[AsyncStateMachine(typeof(<GetWorldThumbnail>d__38))]
	private static async global::System.Threading.Tasks.Task<Uri> GetWorldThumbnail(World world, Uri target)
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		Uri placeholder = new Uri(configPlaceholderUri.Value);
		if (await Helpers.IsValidImageUrl(target).ConfigureAwait(false))
		{
			return target;
		}
		if (world != null && !WorldExtensions.IsUserspace(world) && !string.Equals(world.Name, "local", (StringComparison)5))
		{
			SessionInfo obj = world.GenerateSessionInfo();
			string text = ((obj != null) ? obj.ThumbnailUrl : null);
			if (!string.IsNullOrEmpty(text))
			{
				return new Uri(text);
			}
		}
		return placeholder;
	}

	[AsyncStateMachine(typeof(<GetFaviconAsync>d__39))]
	private static async global::System.Threading.Tasks.Task<Uri> GetFaviconAsync(Uri target)
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		try
		{
			return new Uri(await faviconCache.GetOrAdd(target, (Func<Uri, global::System.Threading.Tasks.Task<string>>)([AsyncStateMachine(typeof(<>c.<<GetFaviconAsync>b__39_0>d))] async (Uri uri) => (await Helpers.GetFaviconUrlAsync(uri).ConfigureAwait(false)) ?? configPlaceholderUri.Value)).ConfigureAwait(false));
		}
		catch
		{
			return new Uri(configPlaceholderUri.Value);
		}
	}

	private static void AddHyperLink(NotificationPanel notificationPanel, Uri uri)
	{
		//IL_0078: Unknown result type (might be due to invalid IL or missing references)
		//IL_007e: Expected O, but got Unknown
		try
		{
			global::System.Collections.IList value = Traverse.Create((object)notificationPanel).Field("_items").GetValue<global::System.Collections.IList>();
			if (value != null && ((global::System.Collections.ICollection)value).Count > 0)
			{
				Slot value2 = Traverse.Create(value[((global::System.Collections.ICollection)value).Count - 1]).Field("root").GetValue<Slot>();
				if (value2 != null)
				{
					Hyperlink obj = ((ContainerWorker<Component>)(object)value2).AttachComponent<Hyperlink>(true, (Action<Hyperlink>)null);
					((SyncField<Uri>)(object)obj.URL).Value = uri;
					((SyncField<string>)(object)obj.Reason).Value = "Open Asset in Browser";
				}
			}
		}
		catch (global::System.Exception ex)
		{
			ManualLogSource pluginLog = PluginLog;
			bool flag = default(bool);
			BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(24, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Error adding hyperlink: ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<global::System.Exception>(ex);
			}
			pluginLog.LogError(val);
		}
	}

	[AsyncStateMachine(typeof(<HandleRequest>d__41<>))]
	private unsafe static global::System.Threading.Tasks.ValueTask<T> HandleRequest<T>(AssetManager assetManager, EngineAssetGatherer assetGatherer, Uri uri, float priority, DB_Endpoint? endpointOverwrite)
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		<HandleRequest>d__41<T> <HandleRequest>d__ = default(<HandleRequest>d__41<T>);
		<HandleRequest>d__.<>t__builder = AsyncValueTaskMethodBuilder<T>.Create();
		<HandleRequest>d__.assetGatherer = assetGatherer;
		<HandleRequest>d__.uri = uri;
		<HandleRequest>d__.priority = priority;
		<HandleRequest>d__.endpointOverwrite = endpointOverwrite;
		<HandleRequest>d__.<>1__state = -1;
		((AsyncValueTaskMethodBuilder<<HandleRequest>d__41<T>>*)(&<HandleRequest>d__.<>t__builder))->Start<<HandleRequest>d__41<T>>(ref <HandleRequest>d__);
		return <HandleRequest>d__.<>t__builder.Task;
	}

	private static bool IsAllowedUri(Uri uri)
	{
		if (!(uri.Scheme == "resdb") && !(uri.Scheme == "local"))
		{
			return IsTrustedHost(uri.Host);
		}
		return true;
	}

	[AsyncStateMachine(typeof(<AskForPermission>d__43))]
	private static async global::System.Threading.Tasks.Task<bool> AskForPermission(Uri target)
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		ManualLogSource pluginLog = PluginLog;
		bool flag = default(bool);
		BepInExDebugLogInterpolatedStringHandler val = new BepInExDebugLogInterpolatedStringHandler(16, 1, ref flag);
		if (flag)
		{
			((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Got Request for ");
			((BepInExLogInterpolatedStringHandler)val).AppendFormatted<Uri>(target);
		}
		pluginLog.LogDebug(val);
		ValueTuple<string, colorX> notificationDetails = GetNotificationDetails(target.Scheme);
		return await AddNotification(notificationText: notificationDetails.Item1, backgroundColor: notificationDetails.Item2, target: target).ConfigureAwait(false);
	}

	private static ValueTuple<string, colorX> GetNotificationDetails(string scheme)
	{
		//IL_0047: Unknown result type (might be due to invalid IL or missing references)
		//IL_004c: Unknown result type (might be due to invalid IL or missing references)
		//IL_006d: Unknown result type (might be due to invalid IL or missing references)
		//IL_006e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0070: Unknown result type (might be due to invalid IL or missing references)
		//IL_0071: Unknown result type (might be due to invalid IL or missing references)
		//IL_004f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0054: Unknown result type (might be due to invalid IL or missing references)
		//IL_0057: Unknown result type (might be due to invalid IL or missing references)
		//IL_005c: Unknown result type (might be due to invalid IL or missing references)
		//IL_005f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0064: Unknown result type (might be due to invalid IL or missing references)
		//IL_0067: Unknown result type (might be due to invalid IL or missing references)
		//IL_006c: Unknown result type (might be due to invalid IL or missing references)
		string text = scheme.ToUpperInvariant() + " URI Requested";
		colorX val = ((scheme == "http") ? Dark.RED : ((scheme == "https") ? Dark.GREEN : ((scheme == "ws") ? Dark.RED : ((!(scheme == "wss")) ? Dark.PURPLE : Dark.GREEN))));
		colorX val2 = val;
		return new ValueTuple<string, colorX>(text, val2);
	}

	private static NotificationType GetNotificationType()
	{
		if (configNotifSound.Value)
		{
			return (NotificationType)3;
		}
		return (NotificationType)1;
	}
}
public static class PluginMetadata
{
	public const string GUID = "HGCommunity.R-Fiddler";

	public const string NAME = "R-Fiddler";

	public const string VERSION = "2.0.0";

	public const string AUTHORS = "Knackrack615, NepuShiro, LeCloutPanda";

	public const string REPOSITORY_URL = "https://github.com/HGCommunity/R-Fiddler";
}