using System;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Text.Json;
using Microsoft.CodeAnalysis;
using SmartFormat.Core.Extensions;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("SmartFormat")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyCopyright("Copyright 2011-2024 SmartFormat Project")]
[assembly: AssemblyDescription("This package is a SmartFormat extension for formatting System.Text.Json types.\r\n\r\nSmartFormat is a lightweight text templating library written in C#.\r\nIt can format various data sources into a string with a minimal, intuitive syntax similar to string.Format.\r\nIt uses extensions to provide named placeholders, localization, pluralization, gender conjugation, and list and time formatting.\r\n ")]
[assembly: AssemblyFileVersion("3.5.0.886")]
[assembly: AssemblyInformationalVersion("3.5.0+c097ea6fc668033580909317ed90679dacbb0e8a")]
[assembly: AssemblyProduct("SmartFormat")]
[assembly: AssemblyTitle("SmartFormat.Extensions.System.Text.Json")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/axuno/SmartFormat.git")]
[assembly: AssemblyVersion("3.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
internal sealed class NullableAttribute : Attribute
{
public readonly byte[] NullableFlags;
public NullableAttribute(byte P_0)
{
NullableFlags = new byte[1] { P_0 };
}
public NullableAttribute(byte[] P_0)
{
NullableFlags = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
internal sealed class NullableContextAttribute : Attribute
{
public readonly byte Flag;
public NullableContextAttribute(byte P_0)
{
Flag = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace SmartFormat.Extensions
{
public class SystemTextJsonSource : Source
{
public override bool TryEvaluateSelector(ISelectorInfo selectorInfo)
{
//IL_008f: Unknown result type (might be due to invalid IL or missing references)
//IL_0095: Invalid comparison between Unknown and I4
ISelectorInfo selectorInfo2 = selectorInfo;
object obj = ((!(selectorInfo2.CurrentValue is JsonElement jsonElement)) ? selectorInfo2.CurrentValue : ((jsonElement.ValueKind == JsonValueKind.Null) ? null : ((object)jsonElement)));
object obj2 = obj;
if (((Source)this).TrySetResultForNullableOperator(selectorInfo2))
{
return true;
}
if (!(obj2 is JsonElement jsonElement2))
{
return false;
}
JsonElement jsonElement3 = jsonElement2.Clone();
JsonElement jsonElement4 = (((int)selectorInfo2.FormatDetails.Settings.CaseSensitivity != 1) ? jsonElement3.GetProperty(selectorInfo2.SelectorText) : jsonElement3.EnumerateObject().FirstOrDefault((JsonProperty jp) => jp.Name.Equals(selectorInfo2.SelectorText, selectorInfo2.FormatDetails.Settings.GetCaseSensitivityComparison())).Value);
ISelectorInfo val = selectorInfo2;
val.Result = jsonElement4.ValueKind switch
{
JsonValueKind.Undefined => throw new FormatException("'" + selectorInfo2.SelectorText + "'"),
JsonValueKind.Null => null,
JsonValueKind.Number => jsonElement4.GetDouble(),
JsonValueKind.False => false,
JsonValueKind.True => true,
JsonValueKind.String => jsonElement4.GetString(),
JsonValueKind.Object => jsonElement4,
JsonValueKind.Array => jsonElement4.EnumerateArray().ToArray(),
_ => throw new ArgumentOutOfRangeException("selectorInfo", "Unexpected kind of 'JsonValueKind'"),
};
return true;
}
}
}