#include "HyperTwistTraining/HyperTwistTrainingPanelWidget.h"

#include "HyperTwistAlgorithm/HyperTwistAlgorithmKeyboard.h"
#include "HyperTwistAlgorithm/HyperTwistAlgorithmSerializer.h"
#include "HyperTwistBrowser/HyperTwistBrowserWidget.h"
#include "HyperTwistSimulation/HyperTwistClassicCubeOrbitPawn.h"
#include "HyperTwistSimulation/HyperTwistClassicCubePlayerController.h"
#include "HyperTwistSimulation/HyperTwistVirtual3333ProjectionPlayerController.h"
#include "HyperTwistTraining/HyperTwistTrainingControlSurfaceFormatting.h"
#include "HyperTwistTraining/HyperTwistTrainingImmersiveEnvironmentLibrary.h"
#include "HyperTwistTraining/HyperTwistTrainingMagic120CellLibrary.h"
#include "HyperTwistTraining/HyperTwistTrainingMagicCube5DLibrary.h"
#include "HyperTwistTraining/HyperTwistTrainingRuntimeLibrary.h"
#include "HyperTwistTraining/HyperTwistTrainingViewerLibrary.h"
#include "HyperTwistXR/HyperTwistXrRuntimeLibrary.h"
#include "Interfaces/IPluginManager.h"
#include "Misc/ConfigCacheIni.h"

namespace HyperTwistTrainingPanelWidgetInternal
{
	struct FProjectInputGroundworkFacts
	{
		bool bEnhancedInputProjectGroundworkPresent = false;
		bool bMotionControllerGroundworkPresent = false;
		bool bOpenXrProjectPluginEnabled = false;
		bool bXrVerticalAdjustmentAxisPresent = false;
		int32 MotionControllerFamilyCount = 0;
		TArray<FString> MotionControllerFamilies;
	};

	struct FSelectorRecallFacts
	{
		FHyperTwistTrainingImportedGeneratedModeLaunchRequest LaunchRequest;
		bool bReady = false;
		int32 SelectorCount = 0;
	};

	struct FXrControllerBoundaryFacts
	{
		FString DecisionId;
		bool bNativeOpenXrControllerWideningNoGo = true;
		bool bRequiresDedicatedRuntimeOwnersForReopen = true;
		bool bRequiresUserFacingSettingsRebindingForReopen = true;
		bool bRequiresWindowsPackagedControllerValidationForReopen = true;
	};

	struct FDedicatedHigherDimensionalRuntimeOwnershipFacts
	{
		FString FamilyLabel;
		FString ActivationProfileId;
		FString HostSurfaceId;
		FString ViewContextSurfaceId;
		FString SessionSurfaceId;
		FString SceneSurfaceId;
		bool bHostReady = false;
		bool bViewContextReady = false;
		bool bSessionReady = false;
		bool bSceneReady = false;

		bool IsReady() const
		{
			return bHostReady
				&& bViewContextReady
				&& bSessionReady
				&& bSceneReady;
		}
	};

	struct FViewerCameraSettingsFacts
	{
		FHyperTwistTrainingViewerEditorToolReference Tool;
		FString ExportArtifactId;
		bool bToolReady = false;
		bool bExportArtifactReady = false;
	};

	struct FImmersiveSessionRecallFacts
	{
		FHyperTwistTrainingImmersiveSessionRecallBoundary Boundary;
		bool bReady = false;
	};

	struct FXrRuntimeOwnershipFacts
	{
		FHyperTwistXrRuntimeOwnershipSurface RuntimeSurface;
		FHyperTwistXrPreferenceProfile PreferenceProfile;
		FHyperTwistXrControllerBindingProfile ControllerBindingProfile;
		FHyperTwistXrControllerSettingsOwnershipSurface ControllerSettingsSurface;
		bool bRuntimeOwnerReady = false;
		bool bPreferenceProfileReady = false;
		bool bControllerBindingProfileReady = false;
		bool bControllerSettingsOwnershipReady = false;
		bool bControllerRebindingOwnershipReady = false;
		bool bWindowsPackagedControllerProofReady = false;
		int32 PreferenceFieldCount = 0;
		int32 ControllerBindingAxisCount = 0;
		int32 SupportedControllerFamilyCount = 0;
		int32 ControllerSettingsFieldCount = 0;
		int32 ControllerRebindableInputCount = 0;
		int32 ControllerLayoutPresetCount = 0;
	};

	FString DescribeBool(const bool bValue)
	{
		return HyperTwistTrainingControlSurfaceFormatting::DescribeBool(bValue);
	}

	FString DescribeReadyState(const bool bValue)
	{
		return HyperTwistTrainingControlSurfaceFormatting::DescribeReadyState(bValue);
	}

	FString DescribeAggregateReadyState(
		const bool bPrimaryReady,
		const bool bSecondaryReady
	)
	{
		return HyperTwistTrainingControlSurfaceFormatting::DescribeAggregateReadyState(
			bPrimaryReady,
			bSecondaryReady);
	}

	FString DescribeOwnedContinuityState(
		const bool bOwnershipReady,
		const bool bContinuityReady
	)
	{
		return HyperTwistTrainingControlSurfaceFormatting::DescribeOwnedContinuityState(
			bOwnershipReady,
			bContinuityReady);
	}

	FString DescribeIdOrFallback(const FString& Value)
	{
		return HyperTwistTrainingControlSurfaceFormatting::DescribeIdOrFallback(Value);
	}

	FString DescribeIdIfReady(
		const bool bReady,
		const FString& Value
	)
	{
		return HyperTwistTrainingControlSurfaceFormatting::DescribeIdIfReady(
			bReady,
			Value
		);
	}

	int32 DescribeCountIfReady(
		const bool bReady,
		const int32 Count
	)
	{
		return HyperTwistTrainingControlSurfaceFormatting::DescribeCountIfReady(
			bReady,
			Count
		);
	}

	FString DescribeKeyForRoster(const FKey& Key)
	{
		return Key.IsValid() ? Key.GetDisplayName().ToString() : TEXT("n/a");
	}

	FString DescribeMoveForRoster(const FHyperTwistAlgorithmBlockMove& Move)
	{
		if (Move.Family.IsEmpty())
		{
			return TEXT("n/a");
		}

		FHyperTwistAlgorithmNode Node;
		Node.NodeType = EHyperTwistAlgorithmNodeType::BlockMove;
		Node.BlockMove = Move;

		FHyperTwistAlgorithmSequence Sequence;
		Sequence.Nodes.Add(Node);

		const FString CanonicalText =
			UHyperTwistAlgorithmSerializer::SerializeAlgorithm(Sequence);
		return !CanonicalText.IsEmpty() ? CanonicalText : TEXT("n/a");
	}

	FString BuildClassicKeyboardMoveRosterLine(
		const FHyperTwistAlgorithmKeyboardProfile& Profile
	)
	{
		if (Profile.Bindings.Num() <= 0)
		{
			return TEXT("Classic move roster: unavailable.");
		}

		TArray<FString> PairFragments;
		PairFragments.Reserve((Profile.Bindings.Num() + 1) / 2);

		for (int32 BindingIndex = 0; BindingIndex < Profile.Bindings.Num(); BindingIndex += 2)
		{
			const FHyperTwistAlgorithmKeyboardBinding& FirstBinding =
				Profile.Bindings[BindingIndex];
			if (BindingIndex + 1 < Profile.Bindings.Num())
			{
				const FHyperTwistAlgorithmKeyboardBinding& SecondBinding =
					Profile.Bindings[BindingIndex + 1];
				PairFragments.Add(
					FString::Printf(
						TEXT("%s/%s = %s/%s"),
						*DescribeKeyForRoster(FirstBinding.Key),
						*DescribeKeyForRoster(SecondBinding.Key),
						*DescribeMoveForRoster(FirstBinding.Move),
						*DescribeMoveForRoster(SecondBinding.Move)
					)
				);
				continue;
			}

			PairFragments.Add(
				FString::Printf(
					TEXT("%s = %s"),
					*DescribeKeyForRoster(FirstBinding.Key),
					*DescribeMoveForRoster(FirstBinding.Move)
				)
			);
		}

		return FString::Printf(
			TEXT("Classic move roster: %s."),
			*FString::Join(PairFragments, TEXT(", "))
		);
	}

	FString BuildClassicCubePointerLine(
		const AHyperTwistClassicCubePlayerController* ClassicCubeDefaults,
		const AHyperTwistClassicCubeOrbitPawn* ClassicCubeOrbitDefaults
	)
	{
		if (ClassicCubeDefaults == nullptr && ClassicCubeOrbitDefaults == nullptr)
		{
			return TEXT("Classic cube pointers: unavailable.");
		}

		const bool bMiddleMouseOrbitReady =
			ClassicCubeOrbitDefaults != nullptr
			&& ClassicCubeOrbitDefaults->bUseMiddleMouseOrbit;
		const bool bWheelZoomReady =
			ClassicCubeOrbitDefaults != nullptr
			&& ClassicCubeOrbitDefaults->ZoomStep > 0.0f;

		return FString::Printf(
			TEXT("Classic cube pointers: LMB clockwise ready | RMB counter-clockwise %s | touch clockwise %s | MMB drag orbit %s | wheel zoom %s | mouse cursor %s."),
			ClassicCubeDefaults != nullptr && ClassicCubeDefaults->bEnableCounterClockwiseRightClick ? TEXT("ready") : TEXT("disabled"),
			ClassicCubeDefaults != nullptr && ClassicCubeDefaults->bEnableTouchTurnInput ? TEXT("ready") : TEXT("disabled"),
			bMiddleMouseOrbitReady ? TEXT("ready") : TEXT("disabled"),
			bWheelZoomReady ? TEXT("ready") : TEXT("disabled"),
			ClassicCubeDefaults != nullptr && ClassicCubeDefaults->bShowMouseCursor ? TEXT("visible") : TEXT("hidden")
		);
	}

	FString BuildClassicCubeActionShortcutLine(
		const AHyperTwistClassicCubePlayerController* ClassicCubeDefaults
	)
	{
		if (ClassicCubeDefaults == nullptr)
		{
			return TEXT("Classic cube action shortcuts: unavailable.");
		}

			return FString::Printf(
				TEXT("Classic cube action shortcuts: new puzzle %s | hint %s | submit %s | guided mode %s | global coach dictation %s | optional Classic voice commands %s."),
				ClassicCubeDefaults->bBindFreshAttemptShortcut ? TEXT("ready") : TEXT("disabled"),
				ClassicCubeDefaults->bBindHintShortcut ? TEXT("ready") : TEXT("disabled"),
				ClassicCubeDefaults->bBindSubmitSolveShortcut ? TEXT("ready") : TEXT("disabled"),
				ClassicCubeDefaults->bBindModeToggleShortcut ? TEXT("ready") : TEXT("disabled"),
				ClassicCubeDefaults->GlobalDictationCapture != nullptr ? TEXT("ready") : TEXT("disabled"),
				ClassicCubeDefaults->bBindVoiceHoldShortcut ? TEXT("enabled") : TEXT("off by default")
			);
	}

	bool TryFindViewerEditorToolById(
		const FHyperTwistTrainingViewerReferenceBundle& Bundle,
		const FString& ToolId,
		FHyperTwistTrainingViewerEditorToolReference& OutTool
	)
	{
		for (const FHyperTwistTrainingViewerEditorToolReference& Tool : Bundle.EditorTools)
		{
			if (Tool.ToolId == ToolId && Tool.IsStructurallyValid())
			{
				OutTool = Tool;
				return true;
			}
		}

		OutTool = FHyperTwistTrainingViewerEditorToolReference();
		return false;
	}

	bool TryFindViewerQaArtifactById(
		const FHyperTwistTrainingViewerReferenceBundle& Bundle,
		const FString& ArtifactId,
		FHyperTwistTrainingViewerQaArtifactReference& OutArtifact
	)
	{
		for (const FHyperTwistTrainingViewerQaArtifactReference& Artifact : Bundle.QaArtifacts)
		{
			if (Artifact.ArtifactId == ArtifactId && Artifact.IsStructurallyValid())
			{
				OutArtifact = Artifact;
				return true;
			}
		}

		OutArtifact = FHyperTwistTrainingViewerQaArtifactReference();
		return false;
	}

	bool TryFindFirstViewerQaArtifactByIds(
		const FHyperTwistTrainingViewerReferenceBundle& Bundle,
		const TArray<FString>& ArtifactIds,
		FString& OutArtifactId,
		FHyperTwistTrainingViewerQaArtifactReference& OutArtifact
	)
	{
		for (const FString& ArtifactId : ArtifactIds)
		{
			if (TryFindViewerQaArtifactById(Bundle, ArtifactId, OutArtifact))
			{
				OutArtifactId = ArtifactId;
				return true;
			}
		}

		OutArtifactId.Reset();
		OutArtifact = FHyperTwistTrainingViewerQaArtifactReference();
		return false;
	}

	FViewerCameraSettingsFacts BuildViewerCameraSettingsFacts()
	{
		FViewerCameraSettingsFacts Facts;
		const FHyperTwistTrainingViewerReferenceBundle Bundle =
			UHyperTwistTrainingViewerLibrary::BuildBundledBrowserViewerReferenceBundle();
		Facts.bToolReady =
			Bundle.IsStructurallyValid()
			&& TryFindViewerEditorToolById(
				Bundle,
				TEXT("tool/camera-settings"),
				Facts.Tool
			);
		if (Facts.bToolReady)
		{
			FHyperTwistTrainingViewerQaArtifactReference ExportArtifact;
			Facts.bExportArtifactReady = TryFindFirstViewerQaArtifactByIds(
				Bundle,
				Facts.Tool.ExportArtifactIds,
				Facts.ExportArtifactId,
				ExportArtifact
			);
		}

		return Facts;
	}

	FImmersiveSessionRecallFacts BuildImmersiveSessionRecallFacts()
	{
		FImmersiveSessionRecallFacts Facts;
		Facts.bReady =
			UHyperTwistTrainingRuntimeLibrary::TryGetBundledImmersiveSessionRecallBoundary(
				TEXT("immersive-training-session-recall-boundary"),
				Facts.Boundary
			) && Facts.Boundary.IsStructurallyValid();
		return Facts;
	}

	bool AxisConfigEntriesContainToken(
		const TArray<FString>& AxisConfigEntries,
		const TCHAR* Token
	)
	{
		for (const FString& Entry : AxisConfigEntries)
		{
			if (Entry.Contains(Token))
			{
				return true;
			}
		}

		return false;
	}

	bool ReadProjectPluginEnabled(const TCHAR* PluginName)
	{
		if (const TSharedPtr<IPlugin> Plugin = IPluginManager::Get().FindPlugin(PluginName))
		{
			return Plugin->IsEnabled();
		}

		return false;
	}

	FProjectInputGroundworkFacts BuildProjectInputGroundworkFacts()
	{
		FProjectInputGroundworkFacts Facts;
		Facts.bOpenXrProjectPluginEnabled = ReadProjectPluginEnabled(TEXT("OpenXR"));

		if (GConfig == nullptr)
		{
			return Facts;
		}

		static constexpr TCHAR InputSettingsSection[] = TEXT("/Script/Engine.InputSettings");

		FString DefaultPlayerInputClass;
		FString DefaultInputComponentClass;
		GConfig->GetString(
			InputSettingsSection,
			TEXT("DefaultPlayerInputClass"),
			DefaultPlayerInputClass,
			GInputIni
		);
		GConfig->GetString(
			InputSettingsSection,
			TEXT("DefaultInputComponentClass"),
			DefaultInputComponentClass,
			GInputIni
		);

		Facts.bEnhancedInputProjectGroundworkPresent =
			DefaultPlayerInputClass == TEXT("/Script/EnhancedInput.EnhancedPlayerInput")
			&& DefaultInputComponentClass == TEXT("/Script/EnhancedInput.EnhancedInputComponent");

		GConfig->GetBool(
			InputSettingsSection,
			TEXT("bEnableMotionControls"),
			Facts.bMotionControllerGroundworkPresent,
			GInputIni
		);

		TArray<FString> AxisConfigEntries;
		GConfig->GetArray(
			InputSettingsSection,
			TEXT("AxisConfig"),
			AxisConfigEntries,
			GInputIni
		);
		TArray<FString> AxisMappingEntries;
		GConfig->GetArray(
			InputSettingsSection,
			TEXT("AxisMappings"),
			AxisMappingEntries,
			GInputIni
		);
		Facts.bXrVerticalAdjustmentAxisPresent = AxisConfigEntriesContainToken(
			AxisMappingEntries,
			TEXT("AxisName=\"HyperTwistXr_VerticalAdjust\"")
		);

		const struct
		{
			const TCHAR* Token;
			const TCHAR* Label;
		} MotionControllerFamilies[] = {
			{TEXT("Vive_"), TEXT("Vive")},
			{TEXT("MixedReality_"), TEXT("Mixed Reality")},
			{TEXT("OculusTouch_"), TEXT("Oculus Touch")},
			{TEXT("ValveIndex_"), TEXT("Valve Index")}
		};

		for (const auto& Family : MotionControllerFamilies)
		{
			if (AxisConfigEntriesContainToken(AxisConfigEntries, Family.Token))
			{
				Facts.MotionControllerFamilies.Add(Family.Label);
			}
		}

		Facts.MotionControllerFamilyCount = Facts.MotionControllerFamilies.Num();
		return Facts;
	}

	const FProjectInputGroundworkFacts& GetProjectInputGroundworkFacts()
	{
		static const FProjectInputGroundworkFacts CachedFacts =
			BuildProjectInputGroundworkFacts();
		return CachedFacts;
	}

	FSelectorRecallFacts BuildSelectorRecallFacts(
		const FHyperTwistTrainingImportedGeneratedModeLaunchRequest& ActiveDeckRequest,
		const FHyperTwistTrainingImportedGeneratedModeLaunchRequest& ImportedRequest
	)
	{
		FSelectorRecallFacts Facts;
		Facts.LaunchRequest =
			ActiveDeckRequest.IsStructurallyValid() ? ActiveDeckRequest : ImportedRequest;
		Facts.bReady =
			Facts.LaunchRequest.IsStructurallyValid()
			&& Facts.LaunchRequest.LaunchConfig.SelectorChoices.Num() > 0;
		Facts.SelectorCount =
			Facts.bReady ? Facts.LaunchRequest.LaunchConfig.SelectorChoices.Num() : 0;
		return Facts;
	}

	FString BuildSelectorRecallLine(const FSelectorRecallFacts& Facts)
	{
		if (!Facts.bReady)
		{
			return TEXT("Repository-backed selector recall: unavailable until a persisted generated-mode launch request with selector choices has been observed.");
		}

		const FString SurfaceId =
			!Facts.LaunchRequest.LaunchConfig.SurfaceId.IsEmpty()
				? Facts.LaunchRequest.LaunchConfig.SurfaceId
				: TEXT("n/a");
		const FString RequestSource =
			!Facts.LaunchRequest.RequestSource.IsEmpty()
				? Facts.LaunchRequest.RequestSource
				: TEXT("n/a");
		return FString::Printf(
			TEXT("Repository-backed selector recall: ready | surface %s | selectors %d | request source %s."),
			*SurfaceId,
			Facts.SelectorCount,
			*RequestSource
		);
	}

	FDedicatedHigherDimensionalRuntimeOwnershipFacts
	BuildDedicatedHigherDimensionalRuntimeOwnershipFacts(
		const FString& FamilyLabel,
		const FString& ActivationProfileId
	)
	{
		FDedicatedHigherDimensionalRuntimeOwnershipFacts Facts;
		Facts.FamilyLabel = FamilyLabel;
		Facts.ActivationProfileId = ActivationProfileId;

		FHyperTwistTrainingHigherDimensionalRuntimeHostSurface HostSurface;
		Facts.bHostReady =
			UHyperTwistTrainingRuntimeLibrary::TryGetBundledHigherDimensionalRuntimeHostSurfaceByActivationProfileId(
				ActivationProfileId,
				HostSurface
			) && HostSurface.IsStructurallyValid();
		if (Facts.bHostReady)
		{
			Facts.HostSurfaceId = HostSurface.HostSurfaceId;
		}

		FHyperTwistTrainingHigherDimensionalRuntimeViewContextSurface ViewContextSurface;
		Facts.bViewContextReady =
			UHyperTwistTrainingRuntimeLibrary::TryGetBundledHigherDimensionalRuntimeViewContextSurfaceByActivationProfileId(
				ActivationProfileId,
				ViewContextSurface
			) && ViewContextSurface.IsStructurallyValid();
		if (Facts.bViewContextReady)
		{
			Facts.ViewContextSurfaceId = ViewContextSurface.ViewContextSurfaceId;
		}

		FHyperTwistTrainingHigherDimensionalRuntimeSessionSurface SessionSurface;
		Facts.bSessionReady =
			UHyperTwistTrainingRuntimeLibrary::TryGetBundledHigherDimensionalRuntimeSessionSurfaceByActivationProfileId(
				ActivationProfileId,
				SessionSurface
			) && SessionSurface.IsStructurallyValid();
		if (Facts.bSessionReady)
		{
			Facts.SessionSurfaceId = SessionSurface.SessionSurfaceId;
		}

		FHyperTwistTrainingHigherDimensionalInteractiveSceneSurface SceneSurface;
		Facts.bSceneReady =
			UHyperTwistTrainingRuntimeLibrary::TryGetBundledHigherDimensionalInteractiveSceneSurfaceByActivationProfileId(
				ActivationProfileId,
				SceneSurface
			) && SceneSurface.IsStructurallyValid();
		if (Facts.bSceneReady)
		{
			Facts.SceneSurfaceId = SceneSurface.SceneSurfaceId;
		}

		return Facts;
	}

	FString BuildDedicatedHigherDimensionalRuntimeOwnershipLine(
		const FDedicatedHigherDimensionalRuntimeOwnershipFacts& Facts
	)
	{
		return FString::Printf(
			TEXT("%s %s | activation %s | host %s (%s) | view %s (%s) | session %s (%s) | scene %s (%s)"),
			*Facts.FamilyLabel,
			*DescribeReadyState(Facts.IsReady()),
			*DescribeIdOrFallback(Facts.ActivationProfileId),
			*DescribeBool(Facts.bHostReady),
			*DescribeIdOrFallback(Facts.HostSurfaceId),
			*DescribeBool(Facts.bViewContextReady),
			*DescribeIdOrFallback(Facts.ViewContextSurfaceId),
			*DescribeBool(Facts.bSessionReady),
			*DescribeIdOrFallback(Facts.SessionSurfaceId),
			*DescribeBool(Facts.bSceneReady),
			*DescribeIdOrFallback(Facts.SceneSurfaceId)
		);
	}

	FXrRuntimeOwnershipFacts BuildXrRuntimeOwnershipFacts()
	{
		FXrRuntimeOwnershipFacts Facts;
		Facts.RuntimeSurface =
			UHyperTwistXrRuntimeLibrary::BuildBundledXrRuntimeOwnershipSurface();
		Facts.PreferenceProfile =
			UHyperTwistXrRuntimeLibrary::GetDefaultXrPreferenceProfile();
		Facts.ControllerBindingProfile =
			UHyperTwistXrRuntimeLibrary::GetDefaultXrControllerBindingProfile();
		Facts.ControllerSettingsSurface =
			UHyperTwistXrRuntimeLibrary::BuildBundledXrControllerSettingsOwnershipSurface();
		Facts.bRuntimeOwnerReady = Facts.RuntimeSurface.IsStructurallyValid();
		Facts.bPreferenceProfileReady = Facts.PreferenceProfile.IsStructurallyValid();
		Facts.bControllerBindingProfileReady =
			Facts.ControllerBindingProfile.IsStructurallyValid();
		Facts.bControllerSettingsOwnershipReady =
			Facts.ControllerSettingsSurface.IsStructurallyValid()
			&& Facts.ControllerSettingsSurface.bUserFacingSettingsReady;
		Facts.bControllerRebindingOwnershipReady =
			Facts.ControllerSettingsSurface.IsStructurallyValid()
			&& Facts.ControllerSettingsSurface.bUserFacingRebindingReady;
		Facts.bWindowsPackagedControllerProofReady =
			Facts.ControllerSettingsSurface.IsStructurallyValid()
			&& Facts.ControllerSettingsSurface.bWindowsPackagedControllerProofReady;
		Facts.PreferenceFieldCount = Facts.PreferenceProfile.PreferenceFieldTags.Num();
		Facts.ControllerBindingAxisCount =
			Facts.ControllerBindingProfile.RequiredAxisNames.Num();
		Facts.SupportedControllerFamilyCount =
			Facts.RuntimeSurface.SupportedControllerFamilies.Num();
		Facts.ControllerSettingsFieldCount =
			Facts.ControllerSettingsSurface.UserVisibleSettingFieldTags.Num();
		Facts.ControllerRebindableInputCount =
			Facts.ControllerSettingsSurface.RebindableInputNames.Num();
		Facts.ControllerLayoutPresetCount =
			Facts.ControllerSettingsSurface.LayoutPresetIds.Num();
		return Facts;
	}

	FString DescribeXrDominantHand(const EHyperTwistXrDominantHand DominantHand)
	{
		return DominantHand == EHyperTwistXrDominantHand::Left
			? TEXT("left")
			: TEXT("right");
	}

	FString DescribeXrPostureMode(const EHyperTwistXrPostureMode PostureMode)
	{
		switch (PostureMode)
		{
		case EHyperTwistXrPostureMode::Seated:
			return TEXT("seated");
		case EHyperTwistXrPostureMode::Hybrid:
			return TEXT("hybrid");
		default:
			return TEXT("standing");
		}
	}

	FString BuildXrRuntimeOwnerLine(const FXrRuntimeOwnershipFacts& Facts)
	{
		return FString::Printf(
			TEXT("Bounded XR runtime owner: %s | runtime %s | preferences %s | bindings %s | motion sources %s/%s | controller families %d."),
			*DescribeReadyState(Facts.bRuntimeOwnerReady),
			*DescribeIdIfReady(Facts.bRuntimeOwnerReady, Facts.RuntimeSurface.RuntimeOwnerId),
			*DescribeIdIfReady(
				Facts.bPreferenceProfileReady,
				Facts.PreferenceProfile.ProfileId),
			*DescribeIdIfReady(
				Facts.bControllerBindingProfileReady,
				Facts.ControllerBindingProfile.ProfileId),
			*DescribeIdIfReady(Facts.bRuntimeOwnerReady, Facts.RuntimeSurface.LeftMotionSourceId),
			*DescribeIdIfReady(Facts.bRuntimeOwnerReady, Facts.RuntimeSurface.RightMotionSourceId),
			DescribeCountIfReady(
				Facts.bRuntimeOwnerReady,
				Facts.SupportedControllerFamilyCount)
		);
	}

	FString BuildXrPreferenceOwnerLine(const FXrRuntimeOwnershipFacts& Facts)
	{
		return FString::Printf(
			TEXT("XR preference ownership: %s | profile %s | posture %s | dominant hand %s | snap turn %.0f | vertical adjust %.0f | pointer %.0f | world scale %.0f | preference fields %d."),
			*DescribeReadyState(Facts.bPreferenceProfileReady),
			*DescribeIdIfReady(
				Facts.bPreferenceProfileReady,
				Facts.PreferenceProfile.ProfileId),
			*DescribeXrPostureMode(Facts.PreferenceProfile.PostureMode),
			*DescribeXrDominantHand(Facts.PreferenceProfile.DominantHand),
			Facts.PreferenceProfile.SnapTurnDegrees,
			Facts.PreferenceProfile.VerticalAdjustmentUnitsPerSecond,
			Facts.PreferenceProfile.PointerLengthUnits,
			Facts.PreferenceProfile.WorldToMetersScale,
			DescribeCountIfReady(
				Facts.bPreferenceProfileReady,
				Facts.PreferenceFieldCount)
		);
	}

	FString BuildXrControllerBindingLine(const FXrRuntimeOwnershipFacts& Facts)
	{
		return FString::Printf(
			TEXT("XR controller bindings: %s | profile %s | required axes %d | families %d."),
			*DescribeReadyState(Facts.bControllerBindingProfileReady),
			*DescribeIdIfReady(
				Facts.bControllerBindingProfileReady,
				Facts.ControllerBindingProfile.ProfileId),
			DescribeCountIfReady(
				Facts.bControllerBindingProfileReady,
				Facts.ControllerBindingAxisCount),
			DescribeCountIfReady(
				Facts.bControllerBindingProfileReady,
				Facts.SupportedControllerFamilyCount)
		);
	}

	FString BuildXrControllerSettingsOwnershipLine(
		const FXrRuntimeOwnershipFacts& Facts
	)
	{
		return FString::Printf(
			TEXT("XR controller settings: %s | rebinding %s | owner %s | surface %s | default layout %s | settings fields %d | rebindable inputs %d | layout presets %d | families %d."),
			*DescribeReadyState(Facts.bControllerSettingsOwnershipReady),
			*DescribeReadyState(Facts.bControllerRebindingOwnershipReady),
			*DescribeIdIfReady(
				Facts.bControllerSettingsOwnershipReady,
				Facts.ControllerSettingsSurface.SettingsOwnerId),
			*DescribeIdIfReady(
				Facts.bControllerRebindingOwnershipReady,
				Facts.ControllerSettingsSurface.RebindingSurfaceId),
			*DescribeIdIfReady(
				Facts.bControllerSettingsOwnershipReady,
				Facts.ControllerSettingsSurface.DefaultLayoutPresetId),
			DescribeCountIfReady(
				Facts.bControllerSettingsOwnershipReady,
				Facts.ControllerSettingsFieldCount),
			DescribeCountIfReady(
				Facts.bControllerRebindingOwnershipReady,
				Facts.ControllerRebindableInputCount),
			DescribeCountIfReady(
				Facts.bControllerSettingsOwnershipReady,
				Facts.ControllerLayoutPresetCount),
			DescribeCountIfReady(
				Facts.bControllerSettingsOwnershipReady,
				Facts.SupportedControllerFamilyCount)
		);
	}

	const FXrControllerBoundaryFacts& GetXrControllerBoundaryFacts()
	{
		static const FXrControllerBoundaryFacts CachedFacts = []()
		{
			FXrControllerBoundaryFacts Facts;
			Facts.DecisionId = TEXT("desktop-hosted-openxr-controller-widening-no-go");
			return Facts;
		}();
		return CachedFacts;
	}

	FString BuildControlInputXrBoundaryLine()
	{
		return TEXT("Current XR host/plugin decision: bounded OpenXR runtime ownership plus first-party controller settings/rebinding now exist inside the desktop simulator, but full native controller widening remains desktop-hosted No-Go until Windows packaged controller validation is complete.");
	}

	FString BuildControlSettingsXrBoundaryLine(const bool bOpenXrProjectPluginEnabled)
	{
		return FString::Printf(
			TEXT("XR/controller completion: the broader host decision remains desktop-hosted No-Go; project OpenXR plugin %s; bounded runtime owners and first-party controller settings/rebinding now exist, but packaged controller proof is not yet shipped."),
			bOpenXrProjectPluginEnabled ? TEXT("enabled") : TEXT("not enabled")
		);
	}

	FString BuildControlProfileRosterXrBoundaryLine(
		const bool bOpenXrProjectPluginEnabled
	)
	{
		return FString::Printf(
			TEXT("Controller rebinding: first-party owned; the current native roster now includes a bounded OpenXR runtime, controller binding profile, and user-facing controller settings/rebinding surface, the project OpenXR plugin is %s, and packaged controller proof is not yet shipped while the broader XR host decision remains desktop-hosted No-Go."),
			bOpenXrProjectPluginEnabled ? TEXT("enabled") : TEXT("not enabled")
		);
	}

	FString ResolveCoachHandoffStartActionSourceLabel(
		const FHyperTwistTrainingCoachPanelState& PanelState,
		const EHyperTwistTrainingCoachHandoffKind HandoffKind,
		const FString& FallbackSourceLabel
	)
	{
		if (HandoffKind == EHyperTwistTrainingCoachHandoffKind::Queue
			&& !PanelState.PreferredQueueRecoveryActionSourceLabel.IsEmpty())
		{
			return PanelState.PreferredQueueRecoveryActionSourceLabel;
		}

		if (PanelState.PreferredCoachHandoffKind == HandoffKind
			&& !PanelState.PreferredCoachHandoffSourceLabel.IsEmpty())
		{
			return PanelState.PreferredCoachHandoffSourceLabel;
		}

		if ((HandoffKind == EHyperTwistTrainingCoachHandoffKind::FollowUp
				|| HandoffKind == EHyperTwistTrainingCoachHandoffKind::Recommended)
			&& !PanelState.PreferredGuidanceSourceLabel.IsEmpty())
		{
			return PanelState.PreferredGuidanceSourceLabel;
		}

		if (!PanelState.PreferredCoachHandoffSourceLabel.IsEmpty())
		{
			return PanelState.PreferredCoachHandoffSourceLabel;
		}

		if (HandoffKind == EHyperTwistTrainingCoachHandoffKind::Queue
			&& !PanelState.NextQueueSourceLabel.IsEmpty())
		{
			return PanelState.NextQueueSourceLabel;
		}

		if (!PanelState.PreferredLaunchBudgetSourceLabel.IsEmpty())
		{
			return PanelState.PreferredLaunchBudgetSourceLabel;
		}

		return FallbackSourceLabel;
	}

	FString ResolvePrimaryCoachActionStartActionSourceLabel(
		const FHyperTwistTrainingCoachPanelState& PanelState,
		const FString& FallbackSourceLabel
	)
	{
		if (PanelState.PreferredQueueRecoveryAction != EHyperTwistTrainingQueueRecoveryAction::None)
		{
			return ResolveCoachHandoffStartActionSourceLabel(
				PanelState,
				EHyperTwistTrainingCoachHandoffKind::Queue,
				FallbackSourceLabel
			);
		}

		if (PanelState.PreferredCoachHandoffKind != EHyperTwistTrainingCoachHandoffKind::None)
		{
			return ResolveCoachHandoffStartActionSourceLabel(
				PanelState,
				PanelState.PreferredCoachHandoffKind,
				FallbackSourceLabel
			);
		}

		if (!PanelState.PreferredGuidanceSourceLabel.IsEmpty())
		{
			return PanelState.PreferredGuidanceSourceLabel;
		}

		if (!PanelState.PreferredLaunchBudgetSourceLabel.IsEmpty())
		{
			return PanelState.PreferredLaunchBudgetSourceLabel;
		}

		return FallbackSourceLabel;
	}

	FString BuildBrowserRuntimeStatusLine(
		const FHyperTwistBrowserOperatorStatusSurface& OperatorStatusSurface
	)
	{
		return FString::Printf(
			TEXT("%s | %s | %s"),
			*OperatorStatusSurface.Headline,
			*OperatorStatusSurface.SummaryLine,
			*OperatorStatusSurface.QueueStatusLine
		);
	}

	FString ResolveBrowserRuntimeFactOrPlaceholder(
		const FString& RuntimeFact,
		const TCHAR* Placeholder
	)
	{
		return RuntimeFact.IsEmpty() ? FString(Placeholder) : RuntimeFact;
	}

	FString BuildBrowserRuntimeTimelineLine(
		const FHyperTwistBrowserOperatorStatusSurface& OperatorStatusSurface
	)
	{
		const FString BootstrapStartedAtUtc = ResolveBrowserRuntimeFactOrPlaceholder(
			OperatorStatusSurface.BootstrapStartedAtUtc,
			TEXT("pending")
		);
		const FString RuntimeReadyAtUtc = ResolveBrowserRuntimeFactOrPlaceholder(
			OperatorStatusSurface.RuntimeReadyAtUtc,
			TEXT("pending")
		);
		const FString FallbackSuffix = OperatorStatusSurface.FallbackReason.IsEmpty()
			? FString()
			: FString::Printf(TEXT(" | fallback %s"), *OperatorStatusSurface.FallbackReason);

		return FString::Printf(
			TEXT("timeline boot %s | ready %s%s"),
			*BootstrapStartedAtUtc,
			*RuntimeReadyAtUtc,
			*FallbackSuffix
		);
	}

	FString BuildBrowserRuntimeReceiptLine(
		const FHyperTwistBrowserOperatorStatusSurface& OperatorStatusSurface
	)
	{
		const FString LastCommandReceivedAtUtc = ResolveBrowserRuntimeFactOrPlaceholder(
			OperatorStatusSurface.LastCommandReceivedAtUtc,
			TEXT("pending")
		);
		const FString LastShellStateReceivedAtUtc = ResolveBrowserRuntimeFactOrPlaceholder(
			OperatorStatusSurface.LastShellStateReceivedAtUtc,
			TEXT("pending")
		);

		return FString::Printf(
			TEXT("receipts cmd %s | shell %s"),
			*LastCommandReceivedAtUtc,
			*LastShellStateReceivedAtUtc
		);
	}

	FString BuildBrowserRuntimeDetailLine(
		const FHyperTwistBrowserOperatorStatusSurface& OperatorStatusSurface
	)
	{
		const FString TimelineLine = BuildBrowserRuntimeTimelineLine(OperatorStatusSurface);
		const FString ReceiptLine = BuildBrowserRuntimeReceiptLine(OperatorStatusSurface);

		return FString::Printf(
			TEXT("%s | %s | %s | %s | stage %s | ready %s | runtime-ready payload %s | runtime-status envelope %s"),
			*OperatorStatusSurface.BridgeStatusLine,
			*OperatorStatusSurface.ShellAuthorityLine,
			*TimelineLine,
			*ReceiptLine,
			*OperatorStatusSurface.RuntimeStageId,
			OperatorStatusSurface.bBrowserRuntimeReady ? TEXT("yes") : TEXT("no"),
			OperatorStatusSurface.bHasRuntimeReadyPayload ? TEXT("yes") : TEXT("no"),
			OperatorStatusSurface.bHasRuntimeStatusEnvelope ? TEXT("yes") : TEXT("no")
		);
	}
}

void UHyperTwistTrainingPanelWidget::NativeConstruct()
{
	Super::NativeConstruct();

	if (bRefreshOnConstruct)
	{
		RefreshTrainingState();
	}
}

bool UHyperTwistTrainingPanelWidget::HasActiveTrainingRun() const
{
	return UHyperTwistTrainingRuntimeLibrary::HasActiveTrainingRun(const_cast<UHyperTwistTrainingPanelWidget*>(this));
}

bool UHyperTwistTrainingPanelWidget::HasActiveMethodDrillRun() const
{
	return UHyperTwistTrainingRuntimeLibrary::HasActiveMethodDrillRun(
		const_cast<UHyperTwistTrainingPanelWidget*>(this));
}

void UHyperTwistTrainingPanelWidget::RefreshTrainingState()
{
	CachedRunState = UHyperTwistTrainingRuntimeLibrary::GetActiveTrainingRunState(this);
	CachedRunSummary = UHyperTwistTrainingRuntimeLibrary::GetActiveTrainingRunSummary(this);
	CachedRecognitionSessionState =
		UHyperTwistTrainingRuntimeLibrary::GetActiveTrainingRecognitionSessionState(this);
	UHyperTwistTrainingRuntimeLibrary::TryGetActiveImportedRuntimeSelectionState(
		this,
		CachedImportedRuntimeSelectionState
	);
	UHyperTwistTrainingRuntimeLibrary::TryGetActiveImportedGeneratedModeLaunchConfig(
		this,
		CachedImportedGeneratedModeLaunchConfig
	);
	UHyperTwistTrainingRuntimeLibrary::TryGetActiveImportedGeneratedModeLaunchRequest(
		this,
		CachedImportedGeneratedModeLaunchRequest
	);
	UHyperTwistTrainingRuntimeLibrary::TryGetLatestGeneratedModeLaunchRequestForActiveDeck(
		this,
		CachedLatestGeneratedModeLaunchRequestForActiveDeck
	);
	if (!UHyperTwistTrainingRuntimeLibrary::TryGetActiveHigherDimensionalRuntimeActivationProfile(
			this,
			CachedHigherDimensionalRuntimeActivationProfile))
	{
		CachedHigherDimensionalRuntimeActivationProfile =
			FHyperTwistTrainingHigherDimensionalRuntimeActivationProfile();
	}
	if (!UHyperTwistTrainingRuntimeLibrary::TryGetActiveHigherDimensionalRuntimeHostSurface(
			this,
			CachedHigherDimensionalRuntimeHostSurface))
	{
		CachedHigherDimensionalRuntimeHostSurface =
			FHyperTwistTrainingHigherDimensionalRuntimeHostSurface();
	}
	if (!UHyperTwistTrainingRuntimeLibrary::TryGetActiveHigherDimensionalRuntimeLaunchSurface(
			this,
			CachedHigherDimensionalRuntimeLaunchSurface))
	{
		CachedHigherDimensionalRuntimeLaunchSurface =
			FHyperTwistTrainingHigherDimensionalRuntimeLaunchSurface();
	}
	if (!UHyperTwistTrainingRuntimeLibrary::TryGetActiveHigherDimensionalRuntimeViewContextSurface(
			this,
			CachedHigherDimensionalRuntimeViewContextSurface))
	{
		CachedHigherDimensionalRuntimeViewContextSurface =
			FHyperTwistTrainingHigherDimensionalRuntimeViewContextSurface();
	}
	if (!UHyperTwistTrainingRuntimeLibrary::TryGetActiveHigherDimensionalRuntimeSessionSurface(
			this,
			CachedHigherDimensionalRuntimeSessionSurface))
	{
		CachedHigherDimensionalRuntimeSessionSurface =
			FHyperTwistTrainingHigherDimensionalRuntimeSessionSurface();
	}
	if (!UHyperTwistTrainingRuntimeLibrary::TryGetActiveHigherDimensionalInteractiveSceneSurface(
			this,
			CachedHigherDimensionalInteractiveSceneSurface))
	{
		CachedHigherDimensionalInteractiveSceneSurface =
			FHyperTwistTrainingHigherDimensionalInteractiveSceneSurface();
	}
	CachedMethodDrillRunState = UHyperTwistTrainingRuntimeLibrary::GetActiveMethodDrillRunState(this);
	CachedMethodDrillSummary = UHyperTwistTrainingRuntimeLibrary::GetActiveMethodDrillSummary(this);
	CachedMethodDrillDiagnosticPacket =
		UHyperTwistTrainingRuntimeLibrary::GetActiveTrainingMethodDrillDiagnosticPacket(this);
	CachedMethodDrillFollowUpTemplate =
		UHyperTwistTrainingRuntimeLibrary::GetActiveTrainingMethodDrillFollowUpTemplate(this);
	CachedMethodDrillFollowUpDeck =
		UHyperTwistTrainingRuntimeLibrary::BuildActiveMethodDrillFollowUpDeck(this);
	CachedActiveTrainingSessionTemplates =
		UHyperTwistTrainingRuntimeLibrary::GetActiveTrainingSessionTemplates(this);
	if (DefaultUserId.IsEmpty())
	{
		CachedDefaultUserTrainingSessionTemplates.Reset();
	}
	else
	{
		CachedDefaultUserTrainingSessionTemplates =
			UHyperTwistTrainingRuntimeLibrary::GetTrainingSessionTemplatesForUser(
				this,
				DefaultUserId,
				FString()
			);
	}
	CachedCoachSignals = UHyperTwistTrainingRuntimeLibrary::GetActiveTrainingCoachSignals(this);
	CachedCoachBrief = UHyperTwistTrainingRuntimeLibrary::GetActiveTrainingCoachBrief(this);
	CachedCoachFollowUpBrief = UHyperTwistTrainingRuntimeLibrary::GetActiveTrainingCoachFollowUpBrief(this);
	CachedCoachSessionQueueSummary =
		UHyperTwistTrainingRuntimeLibrary::GetActiveTrainingCoachSessionQueueSummary(this);
	CachedCoachSessionQueueState =
		UHyperTwistTrainingRuntimeLibrary::GetActiveTrainingCoachSessionQueueState(this);
	CachedCoachScheduleHorizonSummary =
		UHyperTwistTrainingRuntimeLibrary::GetActiveTrainingCoachScheduleHorizonSummary(this);
	CachedCoachSchedulePolicySummary =
		UHyperTwistTrainingRuntimeLibrary::GetActiveTrainingCoachSchedulePolicySummary(this);
	CachedCoachQueueExecutionSummary =
		UHyperTwistTrainingRuntimeLibrary::GetActiveTrainingCoachSessionQueueExecutionSummary(this);
	CachedCoachPanelState = UHyperTwistTrainingRuntimeLibrary::GetActiveTrainingCoachPanelState(this);
	CachedRepositoryRoundTripVerification =
		UHyperTwistTrainingRuntimeLibrary::GetActiveTrainingRepositoryRoundTripVerification(this);
}

TArray<FHyperTwistTrainingSessionTemplate> UHyperTwistTrainingPanelWidget::GetTrainingSessionTemplatesForUser(
	const FString& UserId,
	const FString& ReferenceUtc
)
{
	const TArray<FHyperTwistTrainingSessionTemplate> SessionTemplates =
		UHyperTwistTrainingRuntimeLibrary::GetTrainingSessionTemplatesForUser(
			this,
			UserId,
			ReferenceUtc
		);
	if (UserId == DefaultUserId)
	{
		CachedDefaultUserTrainingSessionTemplates = SessionTemplates;
	}

	return SessionTemplates;
}

FHyperTwistTrainingRunState UHyperTwistTrainingPanelWidget::StartSampleClassicTrainingRun()
{
	LastStepResult = FHyperTwistTrainingRunStepResult();
	CachedRunState = UHyperTwistTrainingRuntimeLibrary::StartSampleClassicTrainingRun(
		this,
		DefaultUserId,
		DefaultSessionId,
		DefaultMode
	);
	RefreshTrainingState();
	return CachedRunState;
}

FHyperTwistTrainingRunState UHyperTwistTrainingPanelWidget::StartTrainingRunFromDeck(
	const FHyperTwistTrainingDeck& Deck,
	const FString& UserId,
	const FString& SessionId,
	EHyperTwistTrainingDeliveryMode Mode
)
{
	LastStepResult = FHyperTwistTrainingRunStepResult();
	CachedRunState = UHyperTwistTrainingRuntimeLibrary::StartTrainingRunFromDeck(
		this,
		Deck,
		UserId,
		SessionId,
		Mode
	);
	RefreshTrainingState();
	return CachedRunState;
}

FHyperTwistTrainingRunState UHyperTwistTrainingPanelWidget::StartTrainingRunFromTemplate(
	const FString& TemplateId,
	const FString& UserId,
	const FString& SessionId
)
{
	LastStepResult = FHyperTwistTrainingRunStepResult();
	CachedRunState = UHyperTwistTrainingRuntimeLibrary::StartTrainingRunFromTemplate(
		this,
		TemplateId,
		UserId,
		SessionId
	);
	RefreshTrainingState();
	return CachedRunState;
}

FHyperTwistTrainingRunStepResult UHyperTwistTrainingPanelWidget::SubmitTrainingAttempt(
	const FHyperTwistTrainingAttempt& Attempt,
	int32 TimeMs
)
{
	LastStepResult = UHyperTwistTrainingRuntimeLibrary::SubmitTrainingAttempt(this, Attempt, TimeMs);
	RefreshTrainingState();
	return LastStepResult;
}

FHyperTwistTrainingSession UHyperTwistTrainingPanelWidget::CompleteActiveTrainingRun(bool bAbortSession)
{
	const FHyperTwistTrainingSession CompletedSession = UHyperTwistTrainingRuntimeLibrary::CompleteActiveTrainingRun(
		this,
		bAbortSession
	);
	RefreshTrainingState();
	return CompletedSession;
}

void UHyperTwistTrainingPanelWidget::ClearActiveTrainingRun()
{
	UHyperTwistTrainingRuntimeLibrary::ClearActiveTrainingRun(this);
	LastStepResult = FHyperTwistTrainingRunStepResult();
	LastGeneratedModeExecutionBlockedReason.Reset();
	RefreshTrainingState();
}

bool UHyperTwistTrainingPanelWidget::OpenActiveRecognitionSession(FString& OutError)
{
	const bool bOpened = UHyperTwistTrainingRuntimeLibrary::OpenActiveRecognitionSession(this, OutError);
	RefreshTrainingState();
	return bOpened;
}

FHyperTwistVisionPreviewResult UHyperTwistTrainingPanelWidget::SubmitActiveRecognitionFrame(
	const FHyperTwistVisionFrameEnvelope& Frame
)
{
	const FHyperTwistVisionPreviewResult Result =
		UHyperTwistTrainingRuntimeLibrary::SubmitActiveRecognitionFrame(this, Frame);
	RefreshTrainingState();
	return Result;
}

FHyperTwistVisionCommitResult UHyperTwistTrainingPanelWidget::CommitActiveRecognitionObservation(
	const FHyperTwistVisionCommitRequest& Request
)
{
	const FHyperTwistVisionCommitResult Result =
		UHyperTwistTrainingRuntimeLibrary::CommitActiveRecognitionObservation(this, Request);
	RefreshTrainingState();
	return Result;
}

FHyperTwistVisionFinalizeResult UHyperTwistTrainingPanelWidget::FinalizeActiveRecognitionSession()
{
	const FHyperTwistVisionFinalizeResult Result =
		UHyperTwistTrainingRuntimeLibrary::FinalizeActiveRecognitionSession(this);
	RefreshTrainingState();
	return Result;
}

bool UHyperTwistTrainingPanelWidget::CloseActiveRecognitionSession(FString& OutError)
{
	const bool bClosed = UHyperTwistTrainingRuntimeLibrary::CloseActiveRecognitionSession(this, OutError);
	RefreshTrainingState();
	return bClosed;
}

FHyperTwistTrainingRunState UHyperTwistTrainingPanelWidget::ApplyActiveImportedRuntimeSelectorOption(
	const FString& SelectorId,
	const FString& OptionId
)
{
	LastGeneratedModeExecutionBlockedReason.Reset();
	CachedRunState = UHyperTwistTrainingRuntimeLibrary::ApplyActiveImportedRuntimeSelectorOption(
		this,
		SelectorId,
		OptionId
	);
	RefreshTrainingState();
	return CachedRunState;
}

FHyperTwistTrainingRunState UHyperTwistTrainingPanelWidget::ApplyActiveImportedGeneratedModeSelectorChoice(
	const FString& SelectorId,
	const FString& SelectedValue,
	const FString& DisplayValue
)
{
	LastGeneratedModeExecutionBlockedReason.Reset();
	CachedRunState = UHyperTwistTrainingRuntimeLibrary::ApplyActiveImportedGeneratedModeSelectorChoice(
		this,
		SelectorId,
		SelectedValue,
		DisplayValue
	);
	RefreshTrainingState();
	return CachedRunState;
}

FHyperTwistTrainingImportedGeneratedModeLaunchRequest
UHyperTwistTrainingPanelWidget::CreateActiveImportedGeneratedModeLaunchRequest(
	const FString& RequestSource
)
{
	LastGeneratedModeExecutionBlockedReason.Reset();
	CachedImportedGeneratedModeLaunchRequest =
		UHyperTwistTrainingRuntimeLibrary::CreateActiveImportedGeneratedModeLaunchRequest(
			this,
			RequestSource
		);
	RefreshTrainingState();
	return CachedImportedGeneratedModeLaunchRequest;
}

bool UHyperTwistTrainingPanelWidget::TryExecuteActiveImportedGeneratedModeLaunchRequest(
	FHyperTwistTrainingRunState& OutRunState,
	FString& OutBlockedReason
)
{
	const bool bSucceeded = UHyperTwistTrainingRuntimeLibrary::TryExecuteActiveImportedGeneratedModeLaunchRequest(
		this,
		OutRunState,
		OutBlockedReason
	);
	CachedRunState = OutRunState;
	LastGeneratedModeExecutionBlockedReason = OutBlockedReason;
	RefreshTrainingState();
	return bSucceeded;
}

FHyperTwistTrainingImportedRuntimeSelectionState
UHyperTwistTrainingPanelWidget::GetDisplayedImportedRuntimeSelectionState() const
{
	return CachedImportedRuntimeSelectionState;
}

FHyperTwistTrainingImportedGeneratedModeLaunchConfig
UHyperTwistTrainingPanelWidget::GetDisplayedImportedGeneratedModeLaunchConfig() const
{
	return CachedImportedGeneratedModeLaunchConfig;
}

FHyperTwistTrainingImportedGeneratedModeLaunchRequest
UHyperTwistTrainingPanelWidget::GetDisplayedImportedGeneratedModeLaunchRequest() const
{
	return CachedImportedGeneratedModeLaunchRequest;
}

FHyperTwistTrainingImportedGeneratedModeLaunchRequest
UHyperTwistTrainingPanelWidget::GetDisplayedLatestGeneratedModeLaunchRequestForActiveDeck() const
{
	return CachedLatestGeneratedModeLaunchRequestForActiveDeck;
}

FString UHyperTwistTrainingPanelWidget::GetDisplayedGeneratedModeExecutionBlockedReason() const
{
	return LastGeneratedModeExecutionBlockedReason;
}

bool UHyperTwistTrainingPanelWidget::HasDisplayedHigherDimensionalRuntimeActivationProfile() const
{
	return CachedHigherDimensionalRuntimeActivationProfile.IsStructurallyValid();
}

FHyperTwistTrainingHigherDimensionalRuntimeActivationProfile
UHyperTwistTrainingPanelWidget::GetDisplayedHigherDimensionalRuntimeActivationProfile() const
{
	return CachedHigherDimensionalRuntimeActivationProfile;
}

bool UHyperTwistTrainingPanelWidget::HasDisplayedHigherDimensionalRuntimeHostSurface() const
{
	return CachedHigherDimensionalRuntimeHostSurface.IsStructurallyValid();
}

FHyperTwistTrainingHigherDimensionalRuntimeHostSurface
UHyperTwistTrainingPanelWidget::GetDisplayedHigherDimensionalRuntimeHostSurface() const
{
	return CachedHigherDimensionalRuntimeHostSurface;
}

bool UHyperTwistTrainingPanelWidget::HasDisplayedHigherDimensionalRuntimeLaunchSurface() const
{
	return CachedHigherDimensionalRuntimeLaunchSurface.IsStructurallyValid();
}

FHyperTwistTrainingHigherDimensionalRuntimeLaunchSurface
UHyperTwistTrainingPanelWidget::GetDisplayedHigherDimensionalRuntimeLaunchSurface() const
{
	return CachedHigherDimensionalRuntimeLaunchSurface;
}

bool UHyperTwistTrainingPanelWidget::HasDisplayedHigherDimensionalRuntimeViewContextSurface() const
{
	return CachedHigherDimensionalRuntimeViewContextSurface.IsStructurallyValid();
}

FHyperTwistTrainingHigherDimensionalRuntimeViewContextSurface
UHyperTwistTrainingPanelWidget::GetDisplayedHigherDimensionalRuntimeViewContextSurface() const
{
	return CachedHigherDimensionalRuntimeViewContextSurface;
}

bool UHyperTwistTrainingPanelWidget::HasDisplayedHigherDimensionalRuntimeSessionSurface() const
{
	return CachedHigherDimensionalRuntimeSessionSurface.IsStructurallyValid();
}

FHyperTwistTrainingHigherDimensionalRuntimeSessionSurface
UHyperTwistTrainingPanelWidget::GetDisplayedHigherDimensionalRuntimeSessionSurface() const
{
	return CachedHigherDimensionalRuntimeSessionSurface;
}

bool UHyperTwistTrainingPanelWidget::HasDisplayedHigherDimensionalInteractiveSceneSurface() const
{
	return CachedHigherDimensionalInteractiveSceneSurface.IsStructurallyValid();
}

FHyperTwistTrainingHigherDimensionalInteractiveSceneSurface
UHyperTwistTrainingPanelWidget::GetDisplayedHigherDimensionalInteractiveSceneSurface() const
{
	return CachedHigherDimensionalInteractiveSceneSurface;
}

void UHyperTwistTrainingPanelWidget::SetObservedBrowserWidget(
	UHyperTwistBrowserWidget* InBrowserWidget
)
{
	ObservedBrowserWidget = InBrowserWidget;
}

void UHyperTwistTrainingPanelWidget::ClearObservedBrowserWidget()
{
	ObservedBrowserWidget.Reset();
}

bool UHyperTwistTrainingPanelWidget::HasObservedBrowserWidget() const
{
	return ObservedBrowserWidget.IsValid();
}

FHyperTwistTrainingBrowserRuntimeInspectSurface
UHyperTwistTrainingPanelWidget::GetDisplayedBrowserRuntimeInspectSurface() const
{
	FHyperTwistTrainingBrowserRuntimeInspectSurface Surface;

	UHyperTwistBrowserWidget* BrowserWidget = ObservedBrowserWidget.Get();
	if (BrowserWidget == nullptr)
	{
		Surface.Headline = TEXT("Browser runtime unavailable");
		Surface.SummaryLine = TEXT("no observed browser widget is attached");
		Surface.RuntimeStageId = TEXT("unobserved");
		Surface.RuntimeMode = TEXT("unobserved");
		Surface.StatusLine =
			TEXT("Browser runtime: no observed browser widget is attached to this training/operator surface.");
		Surface.DetailLine =
			TEXT("Attach the embedded UHyperTwistBrowserWidget through SetObservedBrowserWidget before expecting waiting, ready, or live runtime diagnostics here.");
		return Surface;
	}

	const FHyperTwistBrowserOperatorStatusSurface OperatorStatusSurface =
		BrowserWidget->GetBrowserOperatorStatusSurface();
	Surface.Headline = OperatorStatusSurface.Headline;
	Surface.SummaryLine = OperatorStatusSurface.SummaryLine;
	Surface.StatusLine =
		HyperTwistTrainingPanelWidgetInternal::BuildBrowserRuntimeStatusLine(OperatorStatusSurface);
	Surface.DetailLine =
		HyperTwistTrainingPanelWidgetInternal::BuildBrowserRuntimeDetailLine(OperatorStatusSurface);
	Surface.QueueStatusLine = OperatorStatusSurface.QueueStatusLine;
	Surface.BridgeStatusLine = OperatorStatusSurface.BridgeStatusLine;
	Surface.ShellAuthorityLine = OperatorStatusSurface.ShellAuthorityLine;
	Surface.RuntimeStageId = OperatorStatusSurface.RuntimeStageId;
	Surface.RuntimeMode = OperatorStatusSurface.RuntimeMode;
	Surface.BridgeTrafficStatus = OperatorStatusSurface.BridgeTrafficStatus;
	Surface.BootstrapStartedAtUtc = OperatorStatusSurface.BootstrapStartedAtUtc;
	Surface.RuntimeReadyAtUtc = OperatorStatusSurface.RuntimeReadyAtUtc;
	Surface.LastCommandReceivedAtUtc = OperatorStatusSurface.LastCommandReceivedAtUtc;
	Surface.LastShellStateReceivedAtUtc = OperatorStatusSurface.LastShellStateReceivedAtUtc;
	Surface.FallbackReason = OperatorStatusSurface.FallbackReason;
	Surface.AdapterCount = OperatorStatusSurface.AdapterCount;
	Surface.PendingCommandCount = OperatorStatusSurface.PendingCommandCount;
	Surface.PendingShellStateCount = OperatorStatusSurface.PendingShellStateCount;
	Surface.bHasObservedBrowserWidget = true;
	Surface.bBrowserRuntimeReady = OperatorStatusSurface.bBrowserRuntimeReady;
	Surface.bHasRuntimeReadyPayload = OperatorStatusSurface.bHasRuntimeReadyPayload;
	Surface.bHasRuntimeStatusEnvelope = OperatorStatusSurface.bHasRuntimeStatusEnvelope;
	return Surface;
}

FHyperTwistTrainingControlInputReadinessInspectSurface
UHyperTwistTrainingPanelWidget::GetDisplayedControlInputReadinessInspectSurface() const
{
	FHyperTwistTrainingControlInputReadinessInspectSurface Surface;
	Surface.Headline = TEXT("Control and input readiness");
	Surface.KeyboardProfileName =
		UHyperTwistAlgorithmKeyboardLibrary::GetDefaultKeyboardProfileName();
	Surface.bClassicKeyboardProfileReady = !Surface.KeyboardProfileName.IsEmpty();

	const AHyperTwistClassicCubePlayerController* ClassicCubeDefaults =
		GetDefault<AHyperTwistClassicCubePlayerController>();
	const AHyperTwistClassicCubeOrbitPawn* ClassicCubeOrbitDefaults =
		GetDefault<AHyperTwistClassicCubeOrbitPawn>();
	Surface.bClassicCubeMouseInputReady = ClassicCubeDefaults != nullptr
		&& ClassicCubeDefaults->bShowMouseCursor;
	Surface.bClassicCubeTouchInputReady =
		ClassicCubeDefaults != nullptr && ClassicCubeDefaults->bEnableTouchTurnInput;
		Surface.bClassicCubeShortcutReady = ClassicCubeDefaults != nullptr
			&& ClassicCubeDefaults->bBindFreshAttemptShortcut
			&& ClassicCubeDefaults->bBindHintShortcut
			&& ClassicCubeDefaults->bBindSubmitSolveShortcut
			&& ClassicCubeDefaults->bBindModeToggleShortcut
			&& ClassicCubeDefaults->GlobalDictationCapture != nullptr;

	const AHyperTwistVirtual3333ProjectionPlayerController* HigherDimensionalDefaults =
		GetDefault<AHyperTwistVirtual3333ProjectionPlayerController>();
	Surface.bHigherDimensionalKeyboardInputReady =
		HigherDimensionalDefaults != nullptr && HigherDimensionalDefaults->bUseGameAndUiInputMode;

	const HyperTwistTrainingPanelWidgetInternal::FDedicatedHigherDimensionalRuntimeOwnershipFacts
		Magic120CellRuntimeOwnershipFacts =
			HyperTwistTrainingPanelWidgetInternal::
				BuildDedicatedHigherDimensionalRuntimeOwnershipFacts(
					TEXT("Magic120Cell"),
					TEXT("magic120cell-cleanroom-runtime-activation")
				);
	const HyperTwistTrainingPanelWidgetInternal::FDedicatedHigherDimensionalRuntimeOwnershipFacts
		MagicCube5DRuntimeOwnershipFacts =
			HyperTwistTrainingPanelWidgetInternal::
				BuildDedicatedHigherDimensionalRuntimeOwnershipFacts(
					TEXT("MagicCube5D"),
					TEXT("magiccube5d-cleanroom-runtime-activation")
				);
	Surface.bHigherDimensionalDedicatedFamilyReady =
		Magic120CellRuntimeOwnershipFacts.IsReady()
		&& MagicCube5DRuntimeOwnershipFacts.IsReady();

	const HyperTwistTrainingPanelWidgetInternal::FProjectInputGroundworkFacts& InputGroundworkFacts =
		HyperTwistTrainingPanelWidgetInternal::GetProjectInputGroundworkFacts();
	Surface.bEnhancedInputProjectGroundworkPresent =
		InputGroundworkFacts.bEnhancedInputProjectGroundworkPresent;
	Surface.bMotionControllerGroundworkPresent =
		InputGroundworkFacts.bMotionControllerGroundworkPresent
		&& InputGroundworkFacts.MotionControllerFamilyCount > 0;
	Surface.MotionControllerFamilyCount = InputGroundworkFacts.MotionControllerFamilyCount;
	Surface.bOpenXrProjectPluginEnabled =
		InputGroundworkFacts.bOpenXrProjectPluginEnabled;
	Surface.bXrVerticalAdjustmentAxisPresent =
		InputGroundworkFacts.bXrVerticalAdjustmentAxisPresent;

	FHyperTwistTrainingImmersivePresenceControlContract PresenceControlContract;
	Surface.bImmersivePresenceContractReady =
		UHyperTwistTrainingRuntimeLibrary::TryGetBundledImmersivePresenceControlContract(
			TEXT("immersive-training-presence-control-contract"),
			PresenceControlContract
		);
	const HyperTwistTrainingPanelWidgetInternal::FViewerCameraSettingsFacts
		CameraSettingsFacts =
			HyperTwistTrainingPanelWidgetInternal::BuildViewerCameraSettingsFacts();
	const bool bCameraSettingsContinuityReady =
		CameraSettingsFacts.bExportArtifactReady;
	const FString CameraExportArtifactId = CameraSettingsFacts.ExportArtifactId;
	const HyperTwistTrainingPanelWidgetInternal::FImmersiveSessionRecallFacts
		ImmersiveSessionRecallFacts =
			HyperTwistTrainingPanelWidgetInternal::BuildImmersiveSessionRecallFacts();
	const bool bImmersiveSessionRecallReady =
		ImmersiveSessionRecallFacts.bReady;
	const HyperTwistTrainingPanelWidgetInternal::FXrRuntimeOwnershipFacts
		XrRuntimeOwnershipFacts =
			HyperTwistTrainingPanelWidgetInternal::BuildXrRuntimeOwnershipFacts();
	Surface.XrRuntimeOwnerId = XrRuntimeOwnershipFacts.RuntimeSurface.RuntimeOwnerId;
	Surface.XrPreferenceProfileId = XrRuntimeOwnershipFacts.PreferenceProfile.ProfileId;
	Surface.XrControllerBindingProfileId =
		XrRuntimeOwnershipFacts.ControllerBindingProfile.ProfileId;
	Surface.XrControllerSettingsOwnerId =
		XrRuntimeOwnershipFacts.ControllerSettingsSurface.SettingsOwnerId;
	Surface.XrControllerRebindingSurfaceId =
		XrRuntimeOwnershipFacts.ControllerSettingsSurface.RebindingSurfaceId;
	Surface.XrDefaultControllerLayoutPresetId =
		XrRuntimeOwnershipFacts.ControllerSettingsSurface.DefaultLayoutPresetId;
	Surface.XrPreferenceFieldCount = XrRuntimeOwnershipFacts.PreferenceFieldCount;
	Surface.XrControllerBindingAxisCount =
		XrRuntimeOwnershipFacts.ControllerBindingAxisCount;
	Surface.XrSupportedControllerFamilyCount =
		XrRuntimeOwnershipFacts.SupportedControllerFamilyCount;
	Surface.XrControllerSettingsFieldCount =
		XrRuntimeOwnershipFacts.ControllerSettingsFieldCount;
	Surface.XrControllerRebindableInputCount =
		XrRuntimeOwnershipFacts.ControllerRebindableInputCount;
	Surface.XrControllerLayoutPresetCount =
		XrRuntimeOwnershipFacts.ControllerLayoutPresetCount;
	Surface.bBoundedXrRuntimeOwnerReady =
		XrRuntimeOwnershipFacts.bRuntimeOwnerReady;
	Surface.bXrPreferenceProfileReady =
		XrRuntimeOwnershipFacts.bPreferenceProfileReady;
	Surface.bXrControllerBindingProfileReady =
		XrRuntimeOwnershipFacts.bControllerBindingProfileReady;
	Surface.bXrControllerSettingsOwnershipReady =
		XrRuntimeOwnershipFacts.bControllerSettingsOwnershipReady;
	Surface.bXrControllerRebindingOwnershipReady =
		XrRuntimeOwnershipFacts.bControllerRebindingOwnershipReady;
	Surface.bWindowsPackagedControllerProofReady =
		XrRuntimeOwnershipFacts.bWindowsPackagedControllerProofReady;

	Surface.bFinishedXrRuntimeReady = false;
	Surface.bFinishedPreferencesReady = false;
	const HyperTwistTrainingPanelWidgetInternal::FXrControllerBoundaryFacts& XrBoundaryFacts =
		HyperTwistTrainingPanelWidgetInternal::GetXrControllerBoundaryFacts();
	Surface.XrHostDecisionId = XrBoundaryFacts.DecisionId;
	Surface.bNativeOpenXrControllerWideningNoGo =
		XrBoundaryFacts.bNativeOpenXrControllerWideningNoGo;
	Surface.bRequiresDedicatedRuntimeOwnersForReopen =
		XrBoundaryFacts.bRequiresDedicatedRuntimeOwnersForReopen;
	Surface.bRequiresUserFacingSettingsRebindingForReopen =
		XrBoundaryFacts.bRequiresUserFacingSettingsRebindingForReopen;
	Surface.bRequiresWindowsPackagedControllerValidationForReopen =
		XrBoundaryFacts.bRequiresWindowsPackagedControllerValidationForReopen;

	Surface.SummaryLine = FString::Printf(
		TEXT("Keyboard and mouse lanes are ready today; bounded OpenXR runtime ownership, controller bindings, preference profiles, and first-party controller settings/rebinding now exist, the project OpenXR plugin is %s, and finished packaged XR proof remains intentionally unshipped."),
		Surface.bOpenXrProjectPluginEnabled ? TEXT("enabled") : TEXT("not enabled")
	);
	Surface.ClassicCubeStatusLine = FString::Printf(
		TEXT("Classic cube: mouse %s | touch %s | shortcuts %s."),
		*HyperTwistTrainingPanelWidgetInternal::DescribeBool(
			Surface.bClassicCubeMouseInputReady),
		*HyperTwistTrainingPanelWidgetInternal::DescribeBool(
			Surface.bClassicCubeTouchInputReady),
		*HyperTwistTrainingPanelWidgetInternal::DescribeBool(
			Surface.bClassicCubeShortcutReady)
	);
	Surface.ClassicCubePointerLine =
		HyperTwistTrainingPanelWidgetInternal::BuildClassicCubePointerLine(
			ClassicCubeDefaults,
			ClassicCubeOrbitDefaults
		);
	Surface.ClassicCubeActionShortcutLine =
		HyperTwistTrainingPanelWidgetInternal::BuildClassicCubeActionShortcutLine(
			ClassicCubeDefaults
		);
	Surface.KeyboardProfileLine = FString::Printf(
		TEXT("Keyboard profile: %s is the shipped classic mapping."),
		*Surface.KeyboardProfileName
	);
	Surface.HigherDimensionalStatusLine = FString::Printf(
		TEXT("Higher-dimensional: keyboard-driven slice/layer control %s | %s | %s."),
		*HyperTwistTrainingPanelWidgetInternal::DescribeBool(
			Surface.bHigherDimensionalKeyboardInputReady),
		*HyperTwistTrainingPanelWidgetInternal::
			BuildDedicatedHigherDimensionalRuntimeOwnershipLine(
				Magic120CellRuntimeOwnershipFacts),
		*HyperTwistTrainingPanelWidgetInternal::
			BuildDedicatedHigherDimensionalRuntimeOwnershipLine(
				MagicCube5DRuntimeOwnershipFacts)
	);
	const FString MotionControllerFamilyLabels =
		InputGroundworkFacts.MotionControllerFamilies.Num() > 0
			? FString::Join(InputGroundworkFacts.MotionControllerFamilies, TEXT(", "))
			: FString(TEXT("none"));
	Surface.XrStatusLine = FString::Printf(
		TEXT("XR groundwork: EnhancedInput config %s | motion controls %s | controller families %d (%s) | OpenXR project plugin %s | vertical adjust axis %s | immersive presence contract %s | bounded runtime owner %s (%s) | controller binding %s (%s) | controller settings %s (%s) | packaged controller proof %s."),
		*HyperTwistTrainingPanelWidgetInternal::DescribeBool(
			Surface.bEnhancedInputProjectGroundworkPresent),
		*HyperTwistTrainingPanelWidgetInternal::DescribeBool(
			Surface.bMotionControllerGroundworkPresent),
		Surface.MotionControllerFamilyCount,
		*MotionControllerFamilyLabels,
		*HyperTwistTrainingPanelWidgetInternal::DescribeBool(
			Surface.bOpenXrProjectPluginEnabled),
		*HyperTwistTrainingPanelWidgetInternal::DescribeBool(
			Surface.bXrVerticalAdjustmentAxisPresent),
		*HyperTwistTrainingPanelWidgetInternal::DescribeBool(
			Surface.bImmersivePresenceContractReady),
		*HyperTwistTrainingPanelWidgetInternal::DescribeBool(
			Surface.bBoundedXrRuntimeOwnerReady),
		*HyperTwistTrainingPanelWidgetInternal::DescribeIdOrFallback(
			Surface.XrRuntimeOwnerId),
		*HyperTwistTrainingPanelWidgetInternal::DescribeBool(
			Surface.bXrControllerBindingProfileReady),
		*HyperTwistTrainingPanelWidgetInternal::DescribeIdOrFallback(
			Surface.XrControllerBindingProfileId),
		*HyperTwistTrainingPanelWidgetInternal::DescribeBool(
			Surface.bXrControllerSettingsOwnershipReady
				&& Surface.bXrControllerRebindingOwnershipReady),
		*HyperTwistTrainingPanelWidgetInternal::DescribeIdOrFallback(
			Surface.XrControllerSettingsOwnerId),
		Surface.bWindowsPackagedControllerProofReady
			? TEXT("ready")
			: TEXT("not yet shipped")
	);
	Surface.PreferencesStatusLine =
		HyperTwistTrainingControlSurfaceFormatting::BuildControlInputPreferencesStatusLine(
			bCameraSettingsContinuityReady,
			CameraExportArtifactId,
			bImmersiveSessionRecallReady,
			ImmersiveSessionRecallFacts.Boundary.BoundaryId,
			ImmersiveSessionRecallFacts.Boundary.RecallScopeIds.Num(),
			ImmersiveSessionRecallFacts.Boundary.PreferenceFieldTags.Num()
		);
	Surface.XrRuntimeOwnerLine =
		HyperTwistTrainingPanelWidgetInternal::BuildXrRuntimeOwnerLine(
			XrRuntimeOwnershipFacts
		);
	Surface.XrPreferenceOwnerLine =
		HyperTwistTrainingPanelWidgetInternal::BuildXrPreferenceOwnerLine(
			XrRuntimeOwnershipFacts
		);
	Surface.XrControllerBindingLine =
		HyperTwistTrainingPanelWidgetInternal::BuildXrControllerBindingLine(
			XrRuntimeOwnershipFacts
		);
	Surface.XrControllerSettingsLine =
		HyperTwistTrainingPanelWidgetInternal::BuildXrControllerSettingsOwnershipLine(
			XrRuntimeOwnershipFacts
		);
	Surface.NextPacketLine =
		HyperTwistTrainingPanelWidgetInternal::BuildControlInputXrBoundaryLine();
	Surface.StatusLine = FString::Printf(
		TEXT("classic cube %s | higher-dimensional %s | XR groundwork %s | controller settings/rebinding %s | packaged XR proof %s"),
		Surface.bClassicCubeMouseInputReady
			&& Surface.bClassicCubeTouchInputReady
			&& Surface.bClassicCubeShortcutReady
			? TEXT("ready")
			: TEXT("partial"),
		Surface.bHigherDimensionalKeyboardInputReady
			&& Surface.bHigherDimensionalDedicatedFamilyReady
			? TEXT("ready")
			: TEXT("partial"),
		Surface.bEnhancedInputProjectGroundworkPresent
			&& Surface.bMotionControllerGroundworkPresent
			&& Surface.bImmersivePresenceContractReady
			? TEXT("present")
			: TEXT("limited"),
		Surface.bXrControllerSettingsOwnershipReady
			&& Surface.bXrControllerRebindingOwnershipReady
			? TEXT("owned")
			: TEXT("missing"),
		Surface.bWindowsPackagedControllerProofReady ? TEXT("ready") : TEXT("not yet shipped")
	);
	Surface.DetailLine = FString::Printf(
		TEXT("%s | %s | %s | %s | %s | %s | %s | %s | %s | %s | %s | %s"),
		*Surface.ClassicCubeStatusLine,
		*Surface.ClassicCubePointerLine,
		*Surface.ClassicCubeActionShortcutLine,
		*Surface.KeyboardProfileLine,
		*Surface.HigherDimensionalStatusLine,
		*Surface.XrStatusLine,
		*Surface.PreferencesStatusLine,
		*Surface.XrRuntimeOwnerLine,
		*Surface.XrPreferenceOwnerLine,
		*Surface.XrControllerBindingLine,
		*Surface.XrControllerSettingsLine,
		*Surface.NextPacketLine
	);
	return Surface;
}

FHyperTwistTrainingControlSettingsOwnershipInspectSurface
UHyperTwistTrainingPanelWidget::GetDisplayedControlSettingsOwnershipInspectSurface() const
{
	FHyperTwistTrainingControlSettingsOwnershipInspectSurface Surface;
	Surface.Headline = TEXT("Control settings ownership");

	const HyperTwistTrainingPanelWidgetInternal::FViewerCameraSettingsFacts
		CameraSettingsFacts =
			HyperTwistTrainingPanelWidgetInternal::BuildViewerCameraSettingsFacts();
	Surface.bCameraSettingsReady = CameraSettingsFacts.bToolReady;
	if (Surface.bCameraSettingsReady)
	{
		Surface.CameraSettingsToolId = CameraSettingsFacts.Tool.ToolId;
		Surface.CameraSettingsWorkflowTagCount =
			CameraSettingsFacts.Tool.WorkflowTags.Num();
		Surface.CameraSettingsPreviewStateTagCount =
			CameraSettingsFacts.Tool.PreviewStateTags.Num();
		Surface.CameraSettingsExportArtifactCount =
			CameraSettingsFacts.Tool.ExportArtifactIds.Num();
	}
	Surface.bCameraSettingsContinuityReady =
		CameraSettingsFacts.bExportArtifactReady;
	Surface.CameraSettingsExportArtifactId = CameraSettingsFacts.ExportArtifactId;

	FHyperTwistTrainingImmersivePresenceControlContract ImmersivePresenceContract;
	Surface.bImmersivePresenceSettingsReady =
		UHyperTwistTrainingRuntimeLibrary::TryGetBundledImmersivePresenceControlContract(
			TEXT("immersive-training-presence-control-contract"),
			ImmersivePresenceContract
		) && ImmersivePresenceContract.IsStructurallyValid();
	if (Surface.bImmersivePresenceSettingsReady)
	{
		Surface.ImmersivePresenceContractId = ImmersivePresenceContract.ContractId;
		Surface.ImmersivePresenceSurfaceTagCount =
			ImmersivePresenceContract.PresenceSurfaceTags.Num();
	}
	const HyperTwistTrainingPanelWidgetInternal::FImmersiveSessionRecallFacts
		ImmersiveSessionRecallFacts =
			HyperTwistTrainingPanelWidgetInternal::BuildImmersiveSessionRecallFacts();
	Surface.bImmersiveSessionRecallReady = ImmersiveSessionRecallFacts.bReady;
	if (Surface.bImmersiveSessionRecallReady)
	{
		Surface.ImmersiveSessionRecallBoundaryId =
			ImmersiveSessionRecallFacts.Boundary.BoundaryId;
		Surface.ImmersiveSessionRecallScopeCount =
			ImmersiveSessionRecallFacts.Boundary.RecallScopeIds.Num();
		Surface.ImmersiveSessionRecallPreferenceFieldTagCount =
			ImmersiveSessionRecallFacts.Boundary.PreferenceFieldTags.Num();
		Surface.ImmersiveSessionRecallResetSurfaceTagCount =
			ImmersiveSessionRecallFacts.Boundary.ResetSurfaceTags.Num();
	}

	FHyperTwistTrainingHigherDimensionalRuntimeViewContextSurface Magic120CellViewContextSurface;
	const bool bMagic120CellViewContextReady =
		UHyperTwistTrainingRuntimeLibrary::TryGetBundledHigherDimensionalRuntimeViewContextSurfaceByActivationProfileId(
			TEXT("magic120cell-cleanroom-runtime-activation"),
			Magic120CellViewContextSurface
		) && Magic120CellViewContextSurface.IsStructurallyValid();
	Surface.Magic120CellSelectorCount = Magic120CellViewContextSurface.Selectors.Num();
	Surface.Magic120CellViewProfileContractId =
		Magic120CellViewContextSurface.PrimaryViewProfileContractId;
	FHyperTwistTrainingMagic120CellViewProfileContract Magic120CellViewProfileContract;
	Surface.bMagic120CellViewSettingsReady =
		bMagic120CellViewContextReady
		&& UHyperTwistTrainingRuntimeLibrary::TryGetBundledMagic120CellViewProfileContract(
			Magic120CellViewContextSurface.PrimaryViewProfileContractId,
			Magic120CellViewProfileContract
		) && Magic120CellViewProfileContract.IsStructurallyValid();
	Surface.Magic120CellProjectionSurfaceTagCount =
		Magic120CellViewProfileContract.ProjectionSurfaceTags.Num();
	Surface.Magic120CellSymmetryPresetTagCount =
		Magic120CellViewProfileContract.SymmetryPresetTags.Num();
	Surface.Magic120CellVisibilityPresetTagCount =
		Magic120CellViewProfileContract.VisibilityPresetTags.Num();
	Surface.Magic120CellFocusSurfaceTagCount =
		Magic120CellViewProfileContract.FocusSurfaceTags.Num();
	FHyperTwistTrainingHigherDimensionalRuntimeSessionSurface Magic120CellSessionSurface;
	Surface.bMagic120CellPersistenceSettingsReady =
		UHyperTwistTrainingRuntimeLibrary::TryGetBundledHigherDimensionalRuntimeSessionSurfaceByActivationProfileId(
			TEXT("magic120cell-cleanroom-runtime-activation"),
			Magic120CellSessionSurface
		) && Magic120CellSessionSurface.IsStructurallyValid();
	if (Surface.bMagic120CellPersistenceSettingsReady)
	{
		Surface.Magic120CellSessionSurfaceId = Magic120CellSessionSurface.SessionSurfaceId;
		Surface.Magic120CellPersistenceBoundaryId =
			Magic120CellSessionSurface.PrimaryPersistenceBoundaryId;
	}
	FHyperTwistTrainingHigherDimensionalInteractiveSceneSurface Magic120CellSceneSurface;
	Surface.bMagic120CellPersistenceSettingsReady =
		Surface.bMagic120CellPersistenceSettingsReady
		&& UHyperTwistTrainingRuntimeLibrary::TryGetBundledHigherDimensionalInteractiveSceneSurfaceByActivationProfileId(
			TEXT("magic120cell-cleanroom-runtime-activation"),
			Magic120CellSceneSurface
		) && Magic120CellSceneSurface.IsStructurallyValid();
	if (Surface.bMagic120CellPersistenceSettingsReady)
	{
		Surface.Magic120CellSceneSurfaceId = Magic120CellSceneSurface.SceneSurfaceId;
		Surface.Magic120CellStateSemanticsId = Magic120CellSceneSurface.StateSemanticsId;
	}

	FHyperTwistTrainingHigherDimensionalRuntimeViewContextSurface MagicCube5DViewContextSurface;
	const bool bMagicCube5DViewContextReady =
		UHyperTwistTrainingRuntimeLibrary::TryGetBundledHigherDimensionalRuntimeViewContextSurfaceByActivationProfileId(
			TEXT("magiccube5d-cleanroom-runtime-activation"),
			MagicCube5DViewContextSurface
		) && MagicCube5DViewContextSurface.IsStructurallyValid();
	Surface.MagicCube5DSelectorCount = MagicCube5DViewContextSurface.Selectors.Num();
	Surface.MagicCube5DViewProfileContractId =
		MagicCube5DViewContextSurface.PrimaryViewProfileContractId;
	FHyperTwistTrainingMagicCube5DViewProfileContract MagicCube5DViewProfileContract;
	Surface.bMagicCube5DViewSettingsReady =
		bMagicCube5DViewContextReady
		&& UHyperTwistTrainingRuntimeLibrary::TryGetBundledMagicCube5DViewProfileContract(
			MagicCube5DViewContextSurface.PrimaryViewProfileContractId,
			MagicCube5DViewProfileContract
		) && MagicCube5DViewProfileContract.IsStructurallyValid();
	Surface.MagicCube5DProjectionSurfaceTagCount =
		MagicCube5DViewProfileContract.ProjectionSurfaceTags.Num();
	Surface.MagicCube5DStereoSurfaceTagCount =
		MagicCube5DViewProfileContract.StereoSurfaceTags.Num();
	Surface.MagicCube5DVisibilitySurfaceTagCount =
		MagicCube5DViewProfileContract.VisibilitySurfaceTags.Num();
	Surface.MagicCube5DFocusSurfaceTagCount =
		MagicCube5DViewProfileContract.FocusSurfaceTags.Num();
	FHyperTwistTrainingHigherDimensionalRuntimeSessionSurface MagicCube5DSessionSurface;
	Surface.bMagicCube5DPersistenceSettingsReady =
		UHyperTwistTrainingRuntimeLibrary::TryGetBundledHigherDimensionalRuntimeSessionSurfaceByActivationProfileId(
			TEXT("magiccube5d-cleanroom-runtime-activation"),
			MagicCube5DSessionSurface
		) && MagicCube5DSessionSurface.IsStructurallyValid();
	if (Surface.bMagicCube5DPersistenceSettingsReady)
	{
		Surface.MagicCube5DSessionSurfaceId = MagicCube5DSessionSurface.SessionSurfaceId;
		Surface.MagicCube5DPersistenceBoundaryId =
			MagicCube5DSessionSurface.PrimaryPersistenceBoundaryId;
	}
	FHyperTwistTrainingHigherDimensionalInteractiveSceneSurface MagicCube5DSceneSurface;
	Surface.bMagicCube5DPersistenceSettingsReady =
		Surface.bMagicCube5DPersistenceSettingsReady
		&& UHyperTwistTrainingRuntimeLibrary::TryGetBundledHigherDimensionalInteractiveSceneSurfaceByActivationProfileId(
			TEXT("magiccube5d-cleanroom-runtime-activation"),
			MagicCube5DSceneSurface
		) && MagicCube5DSceneSurface.IsStructurallyValid();
	if (Surface.bMagicCube5DPersistenceSettingsReady)
	{
		Surface.MagicCube5DSceneSurfaceId = MagicCube5DSceneSurface.SceneSurfaceId;
		Surface.MagicCube5DStateSemanticsId = MagicCube5DSceneSurface.StateSemanticsId;
	}

	const FHyperTwistTrainingHigherDimensionalRuntimeViewContextSurface ActiveViewContextSurface =
		HasDisplayedHigherDimensionalRuntimeViewContextSurface()
			? GetDisplayedHigherDimensionalRuntimeViewContextSurface()
			: FHyperTwistTrainingHigherDimensionalRuntimeViewContextSurface();
	const FHyperTwistTrainingHigherDimensionalRuntimeSessionSurface ActiveSessionSurface =
		HasDisplayedHigherDimensionalRuntimeSessionSurface()
			? GetDisplayedHigherDimensionalRuntimeSessionSurface()
			: FHyperTwistTrainingHigherDimensionalRuntimeSessionSurface();
	const FHyperTwistTrainingHigherDimensionalInteractiveSceneSurface ActiveSceneSurface =
		HasDisplayedHigherDimensionalInteractiveSceneSurface()
			? GetDisplayedHigherDimensionalInteractiveSceneSurface()
			: FHyperTwistTrainingHigherDimensionalInteractiveSceneSurface();
	Surface.bActiveHigherDimensionalSettingsVisible = ActiveViewContextSurface.IsStructurallyValid();
	Surface.ActiveHigherDimensionalViewContextId =
		Surface.bActiveHigherDimensionalSettingsVisible
			? ActiveViewContextSurface.ViewContextSurfaceId
			: TEXT("none");
	Surface.ActiveHigherDimensionalSessionSurfaceId =
		ActiveSessionSurface.IsStructurallyValid()
			? ActiveSessionSurface.SessionSurfaceId
			: TEXT("none");
	Surface.ActiveHigherDimensionalInteractiveSceneSurfaceId =
		ActiveSceneSurface.IsStructurallyValid()
			? ActiveSceneSurface.SceneSurfaceId
			: TEXT("none");
	Surface.ActiveHigherDimensionalSelectorCount =
		Surface.bActiveHigherDimensionalSettingsVisible
			? ActiveViewContextSurface.Selectors.Num()
			: 0;

	const HyperTwistTrainingPanelWidgetInternal::FSelectorRecallFacts SelectorRecallFacts =
		HyperTwistTrainingPanelWidgetInternal::BuildSelectorRecallFacts(
			CachedLatestGeneratedModeLaunchRequestForActiveDeck,
			CachedImportedGeneratedModeLaunchRequest
		);
	Surface.bRepositoryBackedSelectorRecallReady = SelectorRecallFacts.bReady;
	Surface.RecalledHigherDimensionalSelectorCount = SelectorRecallFacts.SelectorCount;
	const HyperTwistTrainingPanelWidgetInternal::FXrRuntimeOwnershipFacts
		XrRuntimeOwnershipFacts =
			HyperTwistTrainingPanelWidgetInternal::BuildXrRuntimeOwnershipFacts();
	Surface.XrRuntimeOwnerId = XrRuntimeOwnershipFacts.RuntimeSurface.RuntimeOwnerId;
	Surface.XrPreferenceProfileId = XrRuntimeOwnershipFacts.PreferenceProfile.ProfileId;
	Surface.XrControllerBindingProfileId =
		XrRuntimeOwnershipFacts.ControllerBindingProfile.ProfileId;
	Surface.XrControllerSettingsOwnerId =
		XrRuntimeOwnershipFacts.ControllerSettingsSurface.SettingsOwnerId;
	Surface.XrControllerRebindingSurfaceId =
		XrRuntimeOwnershipFacts.ControllerSettingsSurface.RebindingSurfaceId;
	Surface.XrDefaultControllerLayoutPresetId =
		XrRuntimeOwnershipFacts.ControllerSettingsSurface.DefaultLayoutPresetId;
	Surface.XrPreferenceFieldCount = XrRuntimeOwnershipFacts.PreferenceFieldCount;
	Surface.XrControllerBindingAxisCount =
		XrRuntimeOwnershipFacts.ControllerBindingAxisCount;
	Surface.XrSupportedControllerFamilyCount =
		XrRuntimeOwnershipFacts.SupportedControllerFamilyCount;
	Surface.XrControllerSettingsFieldCount =
		XrRuntimeOwnershipFacts.ControllerSettingsFieldCount;
	Surface.XrControllerRebindableInputCount =
		XrRuntimeOwnershipFacts.ControllerRebindableInputCount;
	Surface.XrControllerLayoutPresetCount =
		XrRuntimeOwnershipFacts.ControllerLayoutPresetCount;
	Surface.bXrPreferenceProfileReady =
		XrRuntimeOwnershipFacts.bPreferenceProfileReady;
	Surface.bXrControllerBindingProfileReady =
		XrRuntimeOwnershipFacts.bControllerBindingProfileReady;
	Surface.bXrControllerSettingsOwnershipReady =
		XrRuntimeOwnershipFacts.bControllerSettingsOwnershipReady;
	Surface.bXrControllerRebindingOwnershipReady =
		XrRuntimeOwnershipFacts.bControllerRebindingOwnershipReady;
	Surface.bWindowsPackagedControllerProofReady =
		XrRuntimeOwnershipFacts.bWindowsPackagedControllerProofReady;

	Surface.bHigherDimensionalSelectorSettingsReady =
		Surface.bMagic120CellViewSettingsReady
		&& Surface.bMagicCube5DViewSettingsReady
		&& Surface.Magic120CellSelectorCount > 0
		&& Surface.MagicCube5DSelectorCount > 0;
	Surface.bFinishedControllerRebindingReady = false;
	Surface.bOpenXrProjectPluginEnabled =
		HyperTwistTrainingPanelWidgetInternal::GetProjectInputGroundworkFacts()
			.bOpenXrProjectPluginEnabled;
	const HyperTwistTrainingPanelWidgetInternal::FXrControllerBoundaryFacts& XrBoundaryFacts =
		HyperTwistTrainingPanelWidgetInternal::GetXrControllerBoundaryFacts();
	Surface.XrHostDecisionId = XrBoundaryFacts.DecisionId;
	Surface.bNativeOpenXrControllerWideningNoGo =
		XrBoundaryFacts.bNativeOpenXrControllerWideningNoGo;
	Surface.bRequiresDedicatedRuntimeOwnersForReopen =
		XrBoundaryFacts.bRequiresDedicatedRuntimeOwnersForReopen;
	Surface.bRequiresUserFacingSettingsRebindingForReopen =
		XrBoundaryFacts.bRequiresUserFacingSettingsRebindingForReopen;
	Surface.bRequiresWindowsPackagedControllerValidationForReopen =
		XrBoundaryFacts.bRequiresWindowsPackagedControllerValidationForReopen;

	const bool bMagic120CellSelectorSettingsReady =
		Surface.bMagic120CellViewSettingsReady
		&& Surface.Magic120CellSelectorCount > 0;
	const bool bMagicCube5DSelectorSettingsReady =
		Surface.bMagicCube5DViewSettingsReady
		&& Surface.MagicCube5DSelectorCount > 0;

	Surface.SummaryLine =
		TEXT("Camera, immersive, dedicated-family, bounded XR preference settings, and first-party controller settings/rebinding are already owned, while packaged controller proof still remains unfinished.");
	Surface.CameraSettingsLine =
		HyperTwistTrainingControlSurfaceFormatting::BuildControlSettingsCameraSettingsLine(
			Surface.bCameraSettingsReady,
			Surface.bCameraSettingsContinuityReady,
			Surface.CameraSettingsToolId,
			Surface.CameraSettingsExportArtifactId,
			Surface.CameraSettingsWorkflowTagCount,
			Surface.CameraSettingsPreviewStateTagCount,
			Surface.CameraSettingsExportArtifactCount
		);
	Surface.ImmersiveSettingsLine =
		HyperTwistTrainingControlSurfaceFormatting::BuildControlSettingsImmersiveSettingsLine(
			Surface.bImmersivePresenceSettingsReady,
			Surface.bImmersiveSessionRecallReady,
			Surface.ImmersivePresenceContractId,
			Surface.ImmersiveSessionRecallBoundaryId,
			ImmersivePresenceContract.ImmersionIntensityIds.Num(),
			ImmersivePresenceContract.ReducedDistractionPresetIds.Num(),
			Surface.ImmersivePresenceSurfaceTagCount,
			Surface.ImmersiveSessionRecallScopeCount,
			Surface.ImmersiveSessionRecallPreferenceFieldTagCount,
			Surface.ImmersiveSessionRecallResetSurfaceTagCount
		);
	Surface.Magic120CellSettingsLine =
		HyperTwistTrainingControlSurfaceFormatting::BuildControlSettingsFamilyOwnedLine(
			TEXT("Magic120Cell"),
			Surface.bMagic120CellViewSettingsReady,
			Surface.bMagic120CellPersistenceSettingsReady,
			Surface.Magic120CellViewProfileContractId,
			Surface.Magic120CellSessionSurfaceId,
			Surface.Magic120CellSceneSurfaceId,
			Surface.Magic120CellPersistenceBoundaryId,
			Surface.Magic120CellStateSemanticsId,
			Surface.Magic120CellSelectorCount,
			TEXT("symmetry presets"),
			Surface.Magic120CellProjectionSurfaceTagCount,
			Surface.Magic120CellSymmetryPresetTagCount,
			TEXT("visibility presets"),
			Surface.Magic120CellVisibilityPresetTagCount,
			TEXT("focus surfaces"),
			Surface.Magic120CellFocusSurfaceTagCount
		);
	Surface.MagicCube5DSettingsLine =
		HyperTwistTrainingControlSurfaceFormatting::BuildControlSettingsFamilyOwnedLine(
			TEXT("MagicCube5D"),
			Surface.bMagicCube5DViewSettingsReady,
			Surface.bMagicCube5DPersistenceSettingsReady,
			Surface.MagicCube5DViewProfileContractId,
			Surface.MagicCube5DSessionSurfaceId,
			Surface.MagicCube5DSceneSurfaceId,
			Surface.MagicCube5DPersistenceBoundaryId,
			Surface.MagicCube5DStateSemanticsId,
			Surface.MagicCube5DSelectorCount,
			TEXT("stereo tags"),
			Surface.MagicCube5DProjectionSurfaceTagCount,
			Surface.MagicCube5DStereoSurfaceTagCount,
			TEXT("visibility tags"),
			Surface.MagicCube5DVisibilitySurfaceTagCount,
			TEXT("focus surfaces"),
			Surface.MagicCube5DFocusSurfaceTagCount
		);
	Surface.SelectorSettingsLine =
		HyperTwistTrainingControlSurfaceFormatting::BuildControlSettingsSelectorOwnershipLine(
			bMagic120CellSelectorSettingsReady,
			bMagicCube5DSelectorSettingsReady,
			Surface.bActiveHigherDimensionalSettingsVisible,
			Surface.ActiveHigherDimensionalViewContextId,
			Surface.ActiveHigherDimensionalSessionSurfaceId,
			Surface.ActiveHigherDimensionalInteractiveSceneSurfaceId,
			Surface.ActiveHigherDimensionalSelectorCount
		);
	Surface.SelectorRecallLine =
		HyperTwistTrainingPanelWidgetInternal::BuildSelectorRecallLine(
			SelectorRecallFacts
		);
	Surface.XrSettingsOwnershipLine = FString::Printf(
		TEXT("%s | %s"),
		*HyperTwistTrainingPanelWidgetInternal::BuildXrPreferenceOwnerLine(
			XrRuntimeOwnershipFacts),
		*HyperTwistTrainingPanelWidgetInternal::BuildXrControllerSettingsOwnershipLine(
			XrRuntimeOwnershipFacts)
	);
	Surface.XrGapLine =
		HyperTwistTrainingPanelWidgetInternal::BuildControlSettingsXrBoundaryLine(
			Surface.bOpenXrProjectPluginEnabled
		);
	Surface.StatusLine =
		HyperTwistTrainingControlSurfaceFormatting::BuildControlSettingsStatusLine(
			Surface.bCameraSettingsReady,
			Surface.bCameraSettingsContinuityReady,
			Surface.bImmersivePresenceSettingsReady,
			Surface.bImmersiveSessionRecallReady,
			Surface.bMagic120CellViewSettingsReady,
			Surface.bMagic120CellPersistenceSettingsReady,
			Surface.bMagicCube5DViewSettingsReady,
			Surface.bMagicCube5DPersistenceSettingsReady,
			bMagic120CellSelectorSettingsReady,
			bMagicCube5DSelectorSettingsReady,
			Surface.bRepositoryBackedSelectorRecallReady,
			Surface.bXrControllerSettingsOwnershipReady
				&& Surface.bXrControllerRebindingOwnershipReady,
			Surface.bWindowsPackagedControllerProofReady
		);
	Surface.DetailLine = FString::Printf(
		TEXT("%s | %s | %s | %s | %s | %s | %s | %s"),
		*Surface.CameraSettingsLine,
		*Surface.ImmersiveSettingsLine,
		*Surface.Magic120CellSettingsLine,
		*Surface.MagicCube5DSettingsLine,
		*Surface.SelectorSettingsLine,
		*Surface.SelectorRecallLine,
		*Surface.XrSettingsOwnershipLine,
		*Surface.XrGapLine
	);

	return Surface;
}

FHyperTwistTrainingControlProfileRosterInspectSurface
UHyperTwistTrainingPanelWidget::GetDisplayedControlProfileRosterInspectSurface() const
{
	FHyperTwistTrainingControlProfileRosterInspectSurface Surface;
	Surface.Headline = TEXT("Selectable control and profile roster");

	const FHyperTwistAlgorithmKeyboardProfile ClassicKeyboardProfile =
		UHyperTwistAlgorithmKeyboardLibrary::GetClassicWcaKeyboardProfile();
	Surface.ClassicKeyboardProfileName = ClassicKeyboardProfile.ProfileName;
	Surface.ClassicKeyboardBindingCount = ClassicKeyboardProfile.Bindings.Num();
	Surface.bClassicKeyboardProfileReady =
		!Surface.ClassicKeyboardProfileName.IsEmpty() && Surface.ClassicKeyboardBindingCount > 0;

	FHyperTwistTrainingImmersivePresenceControlContract PresenceContract;
	Surface.bImmersivePresenceProfileReady =
		UHyperTwistTrainingRuntimeLibrary::TryGetBundledImmersivePresenceControlContract(
			TEXT("immersive-training-presence-control-contract"),
			PresenceContract
		) && PresenceContract.IsStructurallyValid();
	if (Surface.bImmersivePresenceProfileReady)
	{
		Surface.ImmersivePresenceContractId = PresenceContract.ContractId;
		Surface.ImmersionIntensityPresetCount = PresenceContract.ImmersionIntensityIds.Num();
		Surface.ReducedDistractionPresetCount =
			PresenceContract.ReducedDistractionPresetIds.Num();
	}
	const HyperTwistTrainingPanelWidgetInternal::FViewerCameraSettingsFacts
		CameraSettingsFacts =
			HyperTwistTrainingPanelWidgetInternal::BuildViewerCameraSettingsFacts();
	Surface.bCameraSettingsContinuityReady =
		CameraSettingsFacts.bExportArtifactReady;
	Surface.CameraSettingsExportArtifactId = CameraSettingsFacts.ExportArtifactId;
	const HyperTwistTrainingPanelWidgetInternal::FImmersiveSessionRecallFacts
		ImmersiveSessionRecallFacts =
			HyperTwistTrainingPanelWidgetInternal::BuildImmersiveSessionRecallFacts();
	Surface.bImmersiveSessionRecallReady = ImmersiveSessionRecallFacts.bReady;
	if (Surface.bImmersiveSessionRecallReady)
	{
		Surface.ImmersiveSessionRecallBoundaryId =
			ImmersiveSessionRecallFacts.Boundary.BoundaryId;
		Surface.ImmersiveSessionRecallScopeCount =
			ImmersiveSessionRecallFacts.Boundary.RecallScopeIds.Num();
		Surface.ImmersiveSessionRecallPreferenceFieldTagCount =
			ImmersiveSessionRecallFacts.Boundary.PreferenceFieldTags.Num();
	}

	const FHyperTwistTrainingMagic120CellReferenceBundle Magic120CellBundle =
		UHyperTwistTrainingRuntimeLibrary::GetBundledMagic120CellReferenceBundle();
	Surface.Magic120CellRuntimeProfileContractId =
		Magic120CellBundle.PrimaryRuntimeProfileContractId;
	Surface.Magic120CellViewProfileContractId = Magic120CellBundle.PrimaryViewProfileContractId;
	FHyperTwistTrainingMagic120CellRuntimeProfileContract Magic120CellRuntimeProfile;
	const bool bMagic120CellRuntimeProfileReady =
		UHyperTwistTrainingRuntimeLibrary::TryGetBundledMagic120CellRuntimeProfileContract(
			Surface.Magic120CellRuntimeProfileContractId,
			Magic120CellRuntimeProfile
		) && Magic120CellRuntimeProfile.IsStructurallyValid();
	FHyperTwistTrainingMagic120CellViewProfileContract Magic120CellViewProfile;
	const bool bMagic120CellViewProfileReady =
		UHyperTwistTrainingRuntimeLibrary::TryGetBundledMagic120CellViewProfileContract(
			Surface.Magic120CellViewProfileContractId,
			Magic120CellViewProfile
		) && Magic120CellViewProfile.IsStructurallyValid();
	FHyperTwistTrainingHigherDimensionalRuntimeViewContextSurface Magic120CellViewContextSurface;
	const bool bMagic120CellViewContextReady =
		UHyperTwistTrainingRuntimeLibrary::TryGetBundledHigherDimensionalRuntimeViewContextSurfaceByActivationProfileId(
			TEXT("magic120cell-cleanroom-runtime-activation"),
			Magic120CellViewContextSurface
		) && Magic120CellViewContextSurface.IsStructurallyValid();
	Surface.Magic120CellSelectorCount = Magic120CellViewContextSurface.Selectors.Num();
	Surface.bMagic120CellProfileReady =
		bMagic120CellRuntimeProfileReady
		&& bMagic120CellViewProfileReady
		&& bMagic120CellViewContextReady
		&& Surface.Magic120CellSelectorCount > 0;

	const FHyperTwistTrainingMagicCube5DReferenceBundle MagicCube5DBundle =
		UHyperTwistTrainingRuntimeLibrary::GetBundledMagicCube5DReferenceBundle();
	Surface.MagicCube5DRuntimeProfileContractId =
		MagicCube5DBundle.PrimaryRuntimeProfileContractId;
	Surface.MagicCube5DViewProfileContractId = MagicCube5DBundle.PrimaryViewProfileContractId;
	FHyperTwistTrainingMagicCube5DRuntimeProfileContract MagicCube5DRuntimeProfile;
	const bool bMagicCube5DRuntimeProfileReady =
		UHyperTwistTrainingRuntimeLibrary::TryGetBundledMagicCube5DRuntimeProfileContract(
			Surface.MagicCube5DRuntimeProfileContractId,
			MagicCube5DRuntimeProfile
		) && MagicCube5DRuntimeProfile.IsStructurallyValid();
	FHyperTwistTrainingMagicCube5DViewProfileContract MagicCube5DViewProfile;
	const bool bMagicCube5DViewProfileReady =
		UHyperTwistTrainingRuntimeLibrary::TryGetBundledMagicCube5DViewProfileContract(
			Surface.MagicCube5DViewProfileContractId,
			MagicCube5DViewProfile
		) && MagicCube5DViewProfile.IsStructurallyValid();
	FHyperTwistTrainingHigherDimensionalRuntimeViewContextSurface MagicCube5DViewContextSurface;
	const bool bMagicCube5DViewContextReady =
		UHyperTwistTrainingRuntimeLibrary::TryGetBundledHigherDimensionalRuntimeViewContextSurfaceByActivationProfileId(
			TEXT("magiccube5d-cleanroom-runtime-activation"),
			MagicCube5DViewContextSurface
		) && MagicCube5DViewContextSurface.IsStructurallyValid();
	Surface.MagicCube5DSelectorCount = MagicCube5DViewContextSurface.Selectors.Num();
	Surface.bMagicCube5DProfileReady =
		bMagicCube5DRuntimeProfileReady
		&& bMagicCube5DViewProfileReady
		&& bMagicCube5DViewContextReady
		&& Surface.MagicCube5DSelectorCount > 0;

	const FHyperTwistTrainingHigherDimensionalRuntimeActivationProfile ActiveActivationProfile =
		HasDisplayedHigherDimensionalRuntimeActivationProfile()
			? GetDisplayedHigherDimensionalRuntimeActivationProfile()
			: FHyperTwistTrainingHigherDimensionalRuntimeActivationProfile();
	const FHyperTwistTrainingHigherDimensionalRuntimeViewContextSurface ActiveViewContextSurface =
		HasDisplayedHigherDimensionalRuntimeViewContextSurface()
			? GetDisplayedHigherDimensionalRuntimeViewContextSurface()
			: FHyperTwistTrainingHigherDimensionalRuntimeViewContextSurface();
	const FHyperTwistTrainingHigherDimensionalRuntimeSessionSurface ActiveSessionSurface =
		HasDisplayedHigherDimensionalRuntimeSessionSurface()
			? GetDisplayedHigherDimensionalRuntimeSessionSurface()
			: FHyperTwistTrainingHigherDimensionalRuntimeSessionSurface();
	const FHyperTwistTrainingHigherDimensionalInteractiveSceneSurface ActiveSceneSurface =
		HasDisplayedHigherDimensionalInteractiveSceneSurface()
			? GetDisplayedHigherDimensionalInteractiveSceneSurface()
			: FHyperTwistTrainingHigherDimensionalInteractiveSceneSurface();
	Surface.bActiveHigherDimensionalProfileVisible = ActiveActivationProfile.IsStructurallyValid();
	Surface.ActiveHigherDimensionalActivationProfileId =
		Surface.bActiveHigherDimensionalProfileVisible
			? ActiveActivationProfile.ActivationProfileId
			: TEXT("none");
	Surface.ActiveHigherDimensionalViewContextId = ActiveViewContextSurface.IsStructurallyValid()
		? ActiveViewContextSurface.ViewContextSurfaceId
		: TEXT("none");
	Surface.ActiveHigherDimensionalSessionSurfaceId = ActiveSessionSurface.IsStructurallyValid()
		? ActiveSessionSurface.SessionSurfaceId
		: TEXT("none");
	Surface.ActiveHigherDimensionalInteractiveSceneSurfaceId =
		ActiveSceneSurface.IsStructurallyValid()
			? ActiveSceneSurface.SceneSurfaceId
			: TEXT("none");
	Surface.ActiveHigherDimensionalSelectorCount = ActiveViewContextSurface.IsStructurallyValid()
		? ActiveViewContextSurface.Selectors.Num()
		: 0;

	const HyperTwistTrainingPanelWidgetInternal::FSelectorRecallFacts SelectorRecallFacts =
		HyperTwistTrainingPanelWidgetInternal::BuildSelectorRecallFacts(
			CachedLatestGeneratedModeLaunchRequestForActiveDeck,
			CachedImportedGeneratedModeLaunchRequest
		);
	Surface.bRepositoryBackedSelectorRecallReady = SelectorRecallFacts.bReady;
	Surface.RecalledHigherDimensionalSelectorCount = SelectorRecallFacts.SelectorCount;
	const HyperTwistTrainingPanelWidgetInternal::FXrRuntimeOwnershipFacts
		XrRuntimeOwnershipFacts =
			HyperTwistTrainingPanelWidgetInternal::BuildXrRuntimeOwnershipFacts();
	Surface.XrRuntimeOwnerId = XrRuntimeOwnershipFacts.RuntimeSurface.RuntimeOwnerId;
	Surface.XrPreferenceProfileId = XrRuntimeOwnershipFacts.PreferenceProfile.ProfileId;
	Surface.XrControllerBindingProfileId =
		XrRuntimeOwnershipFacts.ControllerBindingProfile.ProfileId;
	Surface.XrControllerSettingsOwnerId =
		XrRuntimeOwnershipFacts.ControllerSettingsSurface.SettingsOwnerId;
	Surface.XrControllerRebindingSurfaceId =
		XrRuntimeOwnershipFacts.ControllerSettingsSurface.RebindingSurfaceId;
	Surface.XrDefaultControllerLayoutPresetId =
		XrRuntimeOwnershipFacts.ControllerSettingsSurface.DefaultLayoutPresetId;
	Surface.XrPreferenceFieldCount = XrRuntimeOwnershipFacts.PreferenceFieldCount;
	Surface.XrControllerBindingAxisCount =
		XrRuntimeOwnershipFacts.ControllerBindingAxisCount;
	Surface.XrSupportedControllerFamilyCount =
		XrRuntimeOwnershipFacts.SupportedControllerFamilyCount;
	Surface.XrControllerSettingsFieldCount =
		XrRuntimeOwnershipFacts.ControllerSettingsFieldCount;
	Surface.XrControllerRebindableInputCount =
		XrRuntimeOwnershipFacts.ControllerRebindableInputCount;
	Surface.XrControllerLayoutPresetCount =
		XrRuntimeOwnershipFacts.ControllerLayoutPresetCount;
	Surface.bXrPreferenceProfileReady =
		XrRuntimeOwnershipFacts.bPreferenceProfileReady;
	Surface.bXrControllerBindingProfileReady =
		XrRuntimeOwnershipFacts.bControllerBindingProfileReady;
	Surface.bXrControllerSettingsOwnershipReady =
		XrRuntimeOwnershipFacts.bControllerSettingsOwnershipReady;
	Surface.bXrControllerRebindingOwnershipReady =
		XrRuntimeOwnershipFacts.bControllerRebindingOwnershipReady;
	Surface.bWindowsPackagedControllerProofReady =
		XrRuntimeOwnershipFacts.bWindowsPackagedControllerProofReady;

	Surface.bFinishedControllerRebindingReady = false;
	Surface.bOpenXrProjectPluginEnabled =
		HyperTwistTrainingPanelWidgetInternal::GetProjectInputGroundworkFacts()
			.bOpenXrProjectPluginEnabled;
	const HyperTwistTrainingPanelWidgetInternal::FXrControllerBoundaryFacts& XrBoundaryFacts =
		HyperTwistTrainingPanelWidgetInternal::GetXrControllerBoundaryFacts();
	Surface.XrHostDecisionId = XrBoundaryFacts.DecisionId;
	Surface.bNativeOpenXrControllerWideningNoGo =
		XrBoundaryFacts.bNativeOpenXrControllerWideningNoGo;
	Surface.bRequiresDedicatedRuntimeOwnersForReopen =
		XrBoundaryFacts.bRequiresDedicatedRuntimeOwnersForReopen;
	Surface.bRequiresUserFacingSettingsRebindingForReopen =
		XrBoundaryFacts.bRequiresUserFacingSettingsRebindingForReopen;
	Surface.bRequiresWindowsPackagedControllerValidationForReopen =
		XrBoundaryFacts.bRequiresWindowsPackagedControllerValidationForReopen;

	const FString ClassicKeyboardProfileName =
		!Surface.ClassicKeyboardProfileName.IsEmpty()
			? Surface.ClassicKeyboardProfileName
			: TEXT("n/a");
	const FString PresenceContractId =
		!Surface.ImmersivePresenceContractId.IsEmpty()
			? Surface.ImmersivePresenceContractId
			: TEXT("n/a");
	const FString Magic120CellRuntimeProfileId =
		!Surface.Magic120CellRuntimeProfileContractId.IsEmpty()
			? Surface.Magic120CellRuntimeProfileContractId
			: TEXT("n/a");
	const FString Magic120CellViewProfileId =
		!Surface.Magic120CellViewProfileContractId.IsEmpty()
			? Surface.Magic120CellViewProfileContractId
			: TEXT("n/a");
	const FString MagicCube5DRuntimeProfileId =
		!Surface.MagicCube5DRuntimeProfileContractId.IsEmpty()
			? Surface.MagicCube5DRuntimeProfileContractId
			: TEXT("n/a");
	const FString MagicCube5DViewProfileId =
		!Surface.MagicCube5DViewProfileContractId.IsEmpty()
			? Surface.MagicCube5DViewProfileContractId
			: TEXT("n/a");
	const FString ActiveActivationProfileId =
		!Surface.ActiveHigherDimensionalActivationProfileId.IsEmpty()
			? Surface.ActiveHigherDimensionalActivationProfileId
			: TEXT("none");
	const FString ActiveViewContextId =
		!Surface.ActiveHigherDimensionalViewContextId.IsEmpty()
			? Surface.ActiveHigherDimensionalViewContextId
			: TEXT("none");
	const FString ActiveSessionSurfaceId =
		!Surface.ActiveHigherDimensionalSessionSurfaceId.IsEmpty()
			? Surface.ActiveHigherDimensionalSessionSurfaceId
			: TEXT("none");
	const FString ActiveSceneSurfaceId =
		!Surface.ActiveHigherDimensionalInteractiveSceneSurfaceId.IsEmpty()
			? Surface.ActiveHigherDimensionalInteractiveSceneSurfaceId
			: TEXT("none");
	Surface.SummaryLine =
		TEXT("The shipped selectable roster currently covers the classic keyboard mapping, scenic immersive presets, bounded XR controller profiles, first-party controller settings/rebinding ownership, bounded camera or immersive continuity, and dedicated 120-cell/5D view-selector families, while packaged controller proof still remains unfinished.");
	Surface.ClassicKeyboardProfileLine = FString::Printf(
		TEXT("Classic keyboard profile: %s | bindings %d | ctrl suppressed %s | alt suppressed %s | meta suppressed %s | repeat suppressed %s."),
		*ClassicKeyboardProfileName,
		Surface.ClassicKeyboardBindingCount,
		*HyperTwistTrainingPanelWidgetInternal::DescribeBool(
			ClassicKeyboardProfile.Policy.bSuppressCtrl),
		*HyperTwistTrainingPanelWidgetInternal::DescribeBool(
			ClassicKeyboardProfile.Policy.bSuppressAlt),
		*HyperTwistTrainingPanelWidgetInternal::DescribeBool(
			ClassicKeyboardProfile.Policy.bSuppressMeta),
		*HyperTwistTrainingPanelWidgetInternal::DescribeBool(
			ClassicKeyboardProfile.Policy.bSuppressRepeat)
	);
	Surface.ClassicKeyboardMoveRosterLine =
		HyperTwistTrainingPanelWidgetInternal::BuildClassicKeyboardMoveRosterLine(
			ClassicKeyboardProfile
		);
	Surface.ImmersivePresenceProfileLine = FString::Printf(
		TEXT("Immersive presence presets: %s | contract %s | intensity presets %d | reduced-distraction presets %d."),
		*HyperTwistTrainingPanelWidgetInternal::DescribeReadyState(
			Surface.bImmersivePresenceProfileReady),
		*PresenceContractId,
		Surface.ImmersionIntensityPresetCount,
		Surface.ReducedDistractionPresetCount
	);
	Surface.Magic120CellProfileLine = FString::Printf(
		TEXT("Magic120Cell selectable family: %s | runtime %s | view %s | selectors %d."),
		*HyperTwistTrainingPanelWidgetInternal::DescribeReadyState(
			Surface.bMagic120CellProfileReady),
		*Magic120CellRuntimeProfileId,
		*Magic120CellViewProfileId,
		Surface.Magic120CellSelectorCount
	);
	Surface.MagicCube5DProfileLine = FString::Printf(
		TEXT("MagicCube5D selectable family: %s | runtime %s | view %s | selectors %d."),
		*HyperTwistTrainingPanelWidgetInternal::DescribeReadyState(
			Surface.bMagicCube5DProfileReady),
		*MagicCube5DRuntimeProfileId,
		*MagicCube5DViewProfileId,
		Surface.MagicCube5DSelectorCount
	);
	Surface.ActiveHigherDimensionalProfileLine =
		Surface.bActiveHigherDimensionalProfileVisible
			? FString::Printf(
				TEXT("Active higher-dimensional selection: activation %s | view context %s | session %s | scene %s | visible selectors %d."),
				*ActiveActivationProfileId,
				*ActiveViewContextId,
				*ActiveSessionSurfaceId,
				*ActiveSceneSurfaceId,
				Surface.ActiveHigherDimensionalSelectorCount
			)
			: TEXT("Active higher-dimensional selection: none currently displayed in this widget.");
	Surface.SelectorRecallLine =
		HyperTwistTrainingPanelWidgetInternal::BuildSelectorRecallLine(
			SelectorRecallFacts
		);
	Surface.PreferencesContinuityLine =
		HyperTwistTrainingControlSurfaceFormatting::BuildControlProfilePreferencesContinuityLine(
			Surface.bCameraSettingsContinuityReady,
			Surface.CameraSettingsExportArtifactId,
			Surface.bImmersiveSessionRecallReady,
			Surface.ImmersiveSessionRecallBoundaryId,
			Surface.ImmersiveSessionRecallScopeCount,
			Surface.ImmersiveSessionRecallPreferenceFieldTagCount
		);
	Surface.XrControllerProfileLine = FString::Printf(
		TEXT("%s | %s"),
		*HyperTwistTrainingPanelWidgetInternal::BuildXrControllerBindingLine(
			XrRuntimeOwnershipFacts),
		*HyperTwistTrainingPanelWidgetInternal::BuildXrControllerSettingsOwnershipLine(
			XrRuntimeOwnershipFacts)
	);
	Surface.PreferencesGapLine =
		HyperTwistTrainingPanelWidgetInternal::BuildControlProfileRosterXrBoundaryLine(
			Surface.bOpenXrProjectPluginEnabled
		);
	Surface.StatusLine =
		HyperTwistTrainingControlSurfaceFormatting::BuildControlProfileStatusLine(
			Surface.bClassicKeyboardProfileReady,
			Surface.bImmersivePresenceProfileReady,
			Surface.bMagic120CellProfileReady,
			Surface.bMagicCube5DProfileReady,
			Surface.bActiveHigherDimensionalProfileVisible,
			Surface.bRepositoryBackedSelectorRecallReady,
			Surface.bCameraSettingsContinuityReady,
			Surface.bImmersiveSessionRecallReady,
			Surface.bXrControllerSettingsOwnershipReady
				&& Surface.bXrControllerRebindingOwnershipReady,
			Surface.bWindowsPackagedControllerProofReady
		);
	Surface.DetailLine = FString::Printf(
		TEXT("%s | %s | %s | %s | %s | %s | %s | %s | %s | %s"),
		*Surface.ClassicKeyboardProfileLine,
		*Surface.ClassicKeyboardMoveRosterLine,
		*Surface.ImmersivePresenceProfileLine,
		*Surface.Magic120CellProfileLine,
		*Surface.MagicCube5DProfileLine,
		*Surface.ActiveHigherDimensionalProfileLine,
		*Surface.SelectorRecallLine,
		*Surface.PreferencesContinuityLine,
		*Surface.XrControllerProfileLine,
		*Surface.PreferencesGapLine
	);

	return Surface;
}

FHyperTwistTrainingDeck UHyperTwistTrainingPanelWidget::BuildActiveCoachRecommendedDeck(const int32 MaxCases)
{
	CachedCoachRecommendedDeck = UHyperTwistTrainingRuntimeLibrary::BuildActiveCoachRecommendedDeck(
		this,
		MaxCases > 0 ? MaxCases : DefaultCoachMaxCases
	);
	RefreshTrainingState();
	return CachedCoachRecommendedDeck;
}

FHyperTwistTrainingDeck UHyperTwistTrainingPanelWidget::BuildActiveCoachFollowUpDeck(const int32 MaxCases)
{
	CachedCoachFollowUpDeck = UHyperTwistTrainingRuntimeLibrary::BuildActiveCoachFollowUpDeck(
		this,
		MaxCases > 0 ? MaxCases : DefaultCoachMaxCases
	);
	RefreshTrainingState();
	return CachedCoachFollowUpDeck;
}

FHyperTwistTrainingDeck UHyperTwistTrainingPanelWidget::BuildActiveMethodDrillFollowUpDeck()
{
	CachedMethodDrillFollowUpDeck =
		UHyperTwistTrainingRuntimeLibrary::BuildActiveMethodDrillFollowUpDeck(this);
	RefreshTrainingState();
	return CachedMethodDrillFollowUpDeck;
}

FString UHyperTwistTrainingPanelWidget::ResolveCoachHandoffStartActionSourceLabel(
	const EHyperTwistTrainingCoachHandoffKind HandoffKind
) const
{
	return HyperTwistTrainingPanelWidgetInternal::ResolveCoachHandoffStartActionSourceLabel(
		CachedCoachPanelState,
		HandoffKind,
		FString::Printf(
			TEXT("coach-panel-%s"),
			HandoffKind == EHyperTwistTrainingCoachHandoffKind::Queue
				? TEXT("queue")
				: (HandoffKind == EHyperTwistTrainingCoachHandoffKind::FollowUp
					? TEXT("follow-up")
					: (HandoffKind == EHyperTwistTrainingCoachHandoffKind::Recommended
						? TEXT("recommended")
						: TEXT("handoff")))
		)
	);
}

FString UHyperTwistTrainingPanelWidget::ResolvePrimaryCoachActionStartActionSourceLabel() const
{
	return HyperTwistTrainingPanelWidgetInternal::ResolvePrimaryCoachActionStartActionSourceLabel(
		CachedCoachPanelState,
		TEXT("coach-panel-primary-action")
	);
}

TArray<FHyperTwistCoachSignal> UHyperTwistTrainingPanelWidget::GetDisplayedCoachSignals() const
{
	return CachedCoachSignals;
}

FHyperTwistCoachBrief UHyperTwistTrainingPanelWidget::GetDisplayedCoachBrief() const
{
	return CachedCoachBrief;
}

FHyperTwistCoachBrief UHyperTwistTrainingPanelWidget::GetDisplayedCoachFollowUpBrief() const
{
	return CachedCoachFollowUpBrief;
}

FHyperTwistCoachSessionQueueSummary
UHyperTwistTrainingPanelWidget::GetDisplayedCoachSessionQueueSummary() const
{
	return CachedCoachSessionQueueSummary;
}

FHyperTwistCoachScheduleHorizonSummary
UHyperTwistTrainingPanelWidget::GetDisplayedCoachScheduleHorizonSummary() const
{
	return CachedCoachScheduleHorizonSummary;
}

FHyperTwistCoachSchedulePolicySummary
UHyperTwistTrainingPanelWidget::GetDisplayedCoachSchedulePolicySummary() const
{
	return CachedCoachSchedulePolicySummary;
}

FHyperTwistTrainingCoachPrimaryActionSurface
UHyperTwistTrainingPanelWidget::GetDisplayedPrimaryCoachActionSurface() const
{
	FHyperTwistTrainingCoachPrimaryActionSurface Surface =
		UHyperTwistTrainingCoachLibrary::DerivePrimaryCoachActionSurface(CachedCoachPanelState);
	Surface.ActionSourceLabel = Surface.bCanExecute
		? ResolvePrimaryCoachActionStartActionSourceLabel()
		: FString();
	return Surface;
}

FHyperTwistTrainingCoachQueueControlSurface
UHyperTwistTrainingPanelWidget::GetDisplayedCoachQueueControlSurface() const
{
	FHyperTwistTrainingCoachQueueControlSurface Surface =
		UHyperTwistTrainingCoachLibrary::DeriveCoachQueueControlSurface(
			CachedCoachSessionQueueState,
			CachedCoachPanelState
		);
	Surface.PromoteActionSourceLabel = Surface.bCanPromote
		? ResolveCoachHandoffStartActionSourceLabel(EHyperTwistTrainingCoachHandoffKind::Queue)
		: FString();
	return Surface;
}

FHyperTwistTrainingCoachQueueRecoveryPostureSurface
UHyperTwistTrainingPanelWidget::GetDisplayedCoachQueueRecoveryPostureSurface() const
{
	const FHyperTwistTrainingCoachPrimaryActionSurface PrimaryActionSurface =
		GetDisplayedPrimaryCoachActionSurface();
	const FHyperTwistTrainingCoachQueueControlSurface QueueControlSurface =
		GetDisplayedCoachQueueControlSurface();
	return UHyperTwistTrainingCoachLibrary::DeriveCoachQueueRecoveryPostureSurface(
		CachedCoachSchedulePolicySummary,
		CachedCoachQueueExecutionSummary,
		CachedCoachPanelState,
		PrimaryActionSurface,
		QueueControlSurface
	);
}

FHyperTwistTrainingCoachHandoffContinuationSurface
UHyperTwistTrainingPanelWidget::GetDisplayedCoachHandoffContinuationSurface() const
{
	const FHyperTwistTrainingCoachPrimaryActionSurface PrimaryActionSurface =
		GetDisplayedPrimaryCoachActionSurface();
	const FHyperTwistTrainingCoachQueueControlSurface QueueControlSurface =
		GetDisplayedCoachQueueControlSurface();
	const FHyperTwistTrainingCoachQueueRecoveryPostureSurface QueueRecoveryPostureSurface =
		UHyperTwistTrainingCoachLibrary::DeriveCoachQueueRecoveryPostureSurface(
			CachedCoachSchedulePolicySummary,
			CachedCoachQueueExecutionSummary,
			CachedCoachPanelState,
			PrimaryActionSurface,
			QueueControlSurface
		);
	return UHyperTwistTrainingCoachLibrary::DeriveCoachHandoffContinuationSurface(
		CachedCoachPanelState,
		PrimaryActionSurface,
		QueueControlSurface,
		QueueRecoveryPostureSurface
	);
}

FHyperTwistTrainingCoachFocusProvenanceSurface
UHyperTwistTrainingPanelWidget::GetDisplayedCoachFocusProvenanceSurface() const
{
	const FHyperTwistTrainingCoachPrimaryActionSurface PrimaryActionSurface =
		GetDisplayedPrimaryCoachActionSurface();
	const FHyperTwistTrainingCoachQueueControlSurface QueueControlSurface =
		GetDisplayedCoachQueueControlSurface();
	const FHyperTwistTrainingCoachQueueRecoveryPostureSurface QueueRecoveryPostureSurface =
		UHyperTwistTrainingCoachLibrary::DeriveCoachQueueRecoveryPostureSurface(
			CachedCoachSchedulePolicySummary,
			CachedCoachQueueExecutionSummary,
			CachedCoachPanelState,
			PrimaryActionSurface,
			QueueControlSurface
		);
	const FHyperTwistTrainingCoachHandoffContinuationSurface HandoffContinuationSurface =
		UHyperTwistTrainingCoachLibrary::DeriveCoachHandoffContinuationSurface(
			CachedCoachPanelState,
			PrimaryActionSurface,
			QueueControlSurface,
			QueueRecoveryPostureSurface
		);
	return UHyperTwistTrainingCoachLibrary::DeriveCoachFocusProvenanceSurface(
		CachedCoachPanelState,
		PrimaryActionSurface,
		QueueControlSurface,
		QueueRecoveryPostureSurface,
		HandoffContinuationSurface
	);
}

FHyperTwistTrainingCoachWorkloadBudgetSurface
UHyperTwistTrainingPanelWidget::GetDisplayedCoachWorkloadBudgetSurface() const
{
	const FHyperTwistTrainingCoachPrimaryActionSurface PrimaryActionSurface =
		GetDisplayedPrimaryCoachActionSurface();
	const FHyperTwistTrainingCoachQueueControlSurface QueueControlSurface =
		GetDisplayedCoachQueueControlSurface();
	const FHyperTwistTrainingCoachQueueRecoveryPostureSurface QueueRecoveryPostureSurface =
		UHyperTwistTrainingCoachLibrary::DeriveCoachQueueRecoveryPostureSurface(
			CachedCoachSchedulePolicySummary,
			CachedCoachQueueExecutionSummary,
			CachedCoachPanelState,
			PrimaryActionSurface,
			QueueControlSurface
		);
	const FHyperTwistTrainingCoachHandoffContinuationSurface HandoffContinuationSurface =
		UHyperTwistTrainingCoachLibrary::DeriveCoachHandoffContinuationSurface(
			CachedCoachPanelState,
			PrimaryActionSurface,
			QueueControlSurface,
			QueueRecoveryPostureSurface
		);
	const FHyperTwistTrainingCoachFocusProvenanceSurface FocusProvenanceSurface =
		UHyperTwistTrainingCoachLibrary::DeriveCoachFocusProvenanceSurface(
			CachedCoachPanelState,
			PrimaryActionSurface,
			QueueControlSurface,
			QueueRecoveryPostureSurface,
			HandoffContinuationSurface
		);
	return UHyperTwistTrainingCoachLibrary::DeriveCoachWorkloadBudgetSurface(
		CachedCoachPanelState,
		QueueRecoveryPostureSurface,
		HandoffContinuationSurface,
		FocusProvenanceSurface
	);
}

FHyperTwistTrainingCoachReadinessEligibilitySurface
UHyperTwistTrainingPanelWidget::GetDisplayedCoachReadinessEligibilitySurface() const
{
	const FHyperTwistTrainingCoachPrimaryActionSurface PrimaryActionSurface =
		GetDisplayedPrimaryCoachActionSurface();
	const FHyperTwistTrainingCoachQueueControlSurface QueueControlSurface =
		GetDisplayedCoachQueueControlSurface();
	const FHyperTwistTrainingCoachQueueRecoveryPostureSurface QueueRecoveryPostureSurface =
		UHyperTwistTrainingCoachLibrary::DeriveCoachQueueRecoveryPostureSurface(
			CachedCoachSchedulePolicySummary,
			CachedCoachQueueExecutionSummary,
			CachedCoachPanelState,
			PrimaryActionSurface,
			QueueControlSurface
		);
	const FHyperTwistTrainingCoachHandoffContinuationSurface HandoffContinuationSurface =
		UHyperTwistTrainingCoachLibrary::DeriveCoachHandoffContinuationSurface(
			CachedCoachPanelState,
			PrimaryActionSurface,
			QueueControlSurface,
			QueueRecoveryPostureSurface
		);
	const FHyperTwistTrainingCoachFocusProvenanceSurface FocusProvenanceSurface =
		UHyperTwistTrainingCoachLibrary::DeriveCoachFocusProvenanceSurface(
			CachedCoachPanelState,
			PrimaryActionSurface,
			QueueControlSurface,
			QueueRecoveryPostureSurface,
			HandoffContinuationSurface
		);
	const FHyperTwistTrainingCoachWorkloadBudgetSurface WorkloadBudgetSurface =
		UHyperTwistTrainingCoachLibrary::DeriveCoachWorkloadBudgetSurface(
			CachedCoachPanelState,
			QueueRecoveryPostureSurface,
			HandoffContinuationSurface,
			FocusProvenanceSurface
		);
	return UHyperTwistTrainingCoachLibrary::DeriveCoachReadinessEligibilitySurface(
		CachedCoachPanelState,
		PrimaryActionSurface,
		QueueControlSurface,
		QueueRecoveryPostureSurface,
		HandoffContinuationSurface,
		FocusProvenanceSurface,
		WorkloadBudgetSurface
	);
}

FHyperTwistTrainingCoachVerificationRecognitionReviewContextSurface
UHyperTwistTrainingPanelWidget::GetDisplayedCoachVerificationRecognitionReviewContextSurface() const
{
	const FHyperTwistTrainingCoachPrimaryActionSurface PrimaryActionSurface =
		GetDisplayedPrimaryCoachActionSurface();
	const FHyperTwistTrainingCoachQueueControlSurface QueueControlSurface =
		GetDisplayedCoachQueueControlSurface();
	const FHyperTwistTrainingCoachQueueRecoveryPostureSurface QueueRecoveryPostureSurface =
		UHyperTwistTrainingCoachLibrary::DeriveCoachQueueRecoveryPostureSurface(
			CachedCoachSchedulePolicySummary,
			CachedCoachQueueExecutionSummary,
			CachedCoachPanelState,
			PrimaryActionSurface,
			QueueControlSurface
		);
	const FHyperTwistTrainingCoachHandoffContinuationSurface HandoffContinuationSurface =
		UHyperTwistTrainingCoachLibrary::DeriveCoachHandoffContinuationSurface(
			CachedCoachPanelState,
			PrimaryActionSurface,
			QueueControlSurface,
			QueueRecoveryPostureSurface
		);
	const FHyperTwistTrainingCoachFocusProvenanceSurface FocusProvenanceSurface =
		UHyperTwistTrainingCoachLibrary::DeriveCoachFocusProvenanceSurface(
			CachedCoachPanelState,
			PrimaryActionSurface,
			QueueControlSurface,
			QueueRecoveryPostureSurface,
			HandoffContinuationSurface
		);
	const FHyperTwistTrainingCoachWorkloadBudgetSurface WorkloadBudgetSurface =
		UHyperTwistTrainingCoachLibrary::DeriveCoachWorkloadBudgetSurface(
			CachedCoachPanelState,
			QueueRecoveryPostureSurface,
			HandoffContinuationSurface,
			FocusProvenanceSurface
		);
	const FHyperTwistTrainingCoachReadinessEligibilitySurface ReadinessEligibilitySurface =
		UHyperTwistTrainingCoachLibrary::DeriveCoachReadinessEligibilitySurface(
			CachedCoachPanelState,
			PrimaryActionSurface,
			QueueControlSurface,
			QueueRecoveryPostureSurface,
			HandoffContinuationSurface,
			FocusProvenanceSurface,
			WorkloadBudgetSurface
		);
	return UHyperTwistTrainingCoachLibrary::DeriveCoachVerificationRecognitionReviewContextSurface(
		CachedCoachPanelState,
		FocusProvenanceSurface,
		WorkloadBudgetSurface,
		ReadinessEligibilitySurface
	);
}

FHyperTwistTrainingCoachGeneratedModeLaunchExecutionContextSurface
UHyperTwistTrainingPanelWidget::GetDisplayedCoachGeneratedModeLaunchExecutionContextSurface() const
{
	const FHyperTwistTrainingCoachReadinessEligibilitySurface ReadinessEligibilitySurface =
		GetDisplayedCoachReadinessEligibilitySurface();
	const FHyperTwistTrainingCoachVerificationRecognitionReviewContextSurface
		VerificationRecognitionReviewContextSurface =
			GetDisplayedCoachVerificationRecognitionReviewContextSurface();
	return UHyperTwistTrainingCoachLibrary::DeriveCoachGeneratedModeLaunchExecutionContextSurface(
		CachedCoachPanelState,
		ReadinessEligibilitySurface,
		VerificationRecognitionReviewContextSurface
	);
}

FHyperTwistTrainingCoachGeneratedModeSelectorApplicationContextSurface
UHyperTwistTrainingPanelWidget::GetDisplayedCoachGeneratedModeSelectorApplicationContextSurface() const
{
	const FHyperTwistTrainingCoachGeneratedModeLaunchExecutionContextSurface
		LaunchExecutionContextSurface =
			GetDisplayedCoachGeneratedModeLaunchExecutionContextSurface();
	return UHyperTwistTrainingCoachLibrary::DeriveCoachGeneratedModeSelectorApplicationContextSurface(
		CachedRunState.ActiveDeck,
		CachedImportedRuntimeSelectionState,
		CachedImportedGeneratedModeLaunchConfig,
		LaunchExecutionContextSurface
	);
}

FHyperTwistTrainingCoachGeneratedModeSelectorRosterSurface
UHyperTwistTrainingPanelWidget::GetDisplayedCoachGeneratedModeSelectorRosterSurface() const
{
	const FHyperTwistTrainingCoachGeneratedModeSelectorApplicationContextSurface
		SelectorApplicationContextSurface =
			GetDisplayedCoachGeneratedModeSelectorApplicationContextSurface();
	return UHyperTwistTrainingCoachLibrary::DeriveCoachGeneratedModeSelectorRosterSurface(
		CachedRunState.ActiveDeck,
		CachedImportedRuntimeSelectionState,
		SelectorApplicationContextSurface
	);
}

FHyperTwistTrainingCoachGeneratedModeSelectorOptionMenuSurface
UHyperTwistTrainingPanelWidget::GetDisplayedCoachGeneratedModeSelectorOptionMenuSurface(
	const FString& SelectorId
) const
{
	const FHyperTwistTrainingCoachGeneratedModeSelectorRosterSurface SelectorRosterSurface =
		GetDisplayedCoachGeneratedModeSelectorRosterSurface();
	return UHyperTwistTrainingCoachLibrary::DeriveCoachGeneratedModeSelectorOptionMenuSurface(
		CachedRunState.ActiveDeck,
		CachedImportedRuntimeSelectionState,
		SelectorId,
		SelectorRosterSurface
	);
}

FHyperTwistTrainingCoachGeneratedModeSelectorOptionActionabilitySurface
UHyperTwistTrainingPanelWidget::GetDisplayedCoachGeneratedModeSelectorOptionActionabilitySurface(
	const FString& SelectorId
) const
{
	const FHyperTwistTrainingCoachGeneratedModeSelectorOptionMenuSurface OptionMenuSurface =
		GetDisplayedCoachGeneratedModeSelectorOptionMenuSurface(SelectorId);
	return UHyperTwistTrainingCoachLibrary::DeriveCoachGeneratedModeSelectorOptionActionabilitySurface(
		CachedRunState.ActiveDeck,
		SelectorId,
		OptionMenuSurface
	);
}

FHyperTwistTrainingCoachGeneratedModeSelectorOptionDispatchSurface
UHyperTwistTrainingPanelWidget::GetDisplayedCoachGeneratedModeSelectorOptionDispatchSurface(
	const FString& SelectorId
) const
{
	const FHyperTwistTrainingCoachGeneratedModeSelectorOptionMenuSurface OptionMenuSurface =
		GetDisplayedCoachGeneratedModeSelectorOptionMenuSurface(SelectorId);
	const FHyperTwistTrainingCoachGeneratedModeSelectorOptionActionabilitySurface
		OptionActionabilitySurface =
			GetDisplayedCoachGeneratedModeSelectorOptionActionabilitySurface(SelectorId);
	return UHyperTwistTrainingCoachLibrary::DeriveCoachGeneratedModeSelectorOptionDispatchSurface(
		SelectorId,
		OptionMenuSurface,
		OptionActionabilitySurface
	);
}

FHyperTwistTrainingCoachGeneratedModeSelectorOptionExecutionImpactSurface
UHyperTwistTrainingPanelWidget::GetDisplayedCoachGeneratedModeSelectorOptionExecutionImpactSurface(
	const FString& SelectorId
) const
{
	const FHyperTwistTrainingCoachGeneratedModeLaunchExecutionContextSurface
		LaunchExecutionContextSurface =
			GetDisplayedCoachGeneratedModeLaunchExecutionContextSurface();
	const FHyperTwistTrainingCoachGeneratedModeSelectorOptionMenuSurface OptionMenuSurface =
		GetDisplayedCoachGeneratedModeSelectorOptionMenuSurface(SelectorId);
	const FHyperTwistTrainingCoachGeneratedModeSelectorOptionDispatchSurface OptionDispatchSurface =
		GetDisplayedCoachGeneratedModeSelectorOptionDispatchSurface(SelectorId);
	return UHyperTwistTrainingCoachLibrary::DeriveCoachGeneratedModeSelectorOptionExecutionImpactSurface(
		CachedRunState,
		SelectorId,
		LaunchExecutionContextSurface,
		OptionMenuSurface,
		OptionDispatchSurface
	);
}

FHyperTwistTrainingCoachGeneratedModeSelectorOptionRequestAlignmentSurface
UHyperTwistTrainingPanelWidget::GetDisplayedCoachGeneratedModeSelectorOptionRequestAlignmentSurface(
	const FString& SelectorId
) const
{
	const FHyperTwistTrainingCoachGeneratedModeSelectorOptionMenuSurface OptionMenuSurface =
		GetDisplayedCoachGeneratedModeSelectorOptionMenuSurface(SelectorId);
	const FHyperTwistTrainingCoachGeneratedModeSelectorOptionDispatchSurface OptionDispatchSurface =
		GetDisplayedCoachGeneratedModeSelectorOptionDispatchSurface(SelectorId);
	const FHyperTwistTrainingCoachGeneratedModeSelectorOptionExecutionImpactSurface
		OptionExecutionImpactSurface =
			GetDisplayedCoachGeneratedModeSelectorOptionExecutionImpactSurface(SelectorId);
	return UHyperTwistTrainingCoachLibrary::DeriveCoachGeneratedModeSelectorOptionRequestAlignmentSurface(
		CachedRunState,
		SelectorId,
		OptionMenuSurface,
		OptionDispatchSurface,
		OptionExecutionImpactSurface
	);
}

FHyperTwistTrainingCoachGeneratedModeSelectorOptionStoredRequestDeltaSurface
UHyperTwistTrainingPanelWidget::GetDisplayedCoachGeneratedModeSelectorOptionStoredRequestDeltaSurface(
	const FString& SelectorId
) const
{
	const FHyperTwistTrainingCoachGeneratedModeSelectorOptionMenuSurface OptionMenuSurface =
		GetDisplayedCoachGeneratedModeSelectorOptionMenuSurface(SelectorId);
	const FHyperTwistTrainingCoachGeneratedModeSelectorOptionDispatchSurface OptionDispatchSurface =
		GetDisplayedCoachGeneratedModeSelectorOptionDispatchSurface(SelectorId);
	const FHyperTwistTrainingCoachGeneratedModeSelectorOptionRequestAlignmentSurface
		OptionRequestAlignmentSurface =
			GetDisplayedCoachGeneratedModeSelectorOptionRequestAlignmentSurface(SelectorId);
	return UHyperTwistTrainingCoachLibrary::DeriveCoachGeneratedModeSelectorOptionStoredRequestDeltaSurface(
		CachedRunState,
		SelectorId,
		OptionMenuSurface,
		OptionDispatchSurface,
		OptionRequestAlignmentSurface
	);
}

FHyperTwistTrainingCoachGeneratedModeSelectorOptionLaunchRequestPreviewSurface
UHyperTwistTrainingPanelWidget::GetDisplayedCoachGeneratedModeSelectorOptionLaunchRequestPreviewSurface(
	const FString& SelectorId
) const
{
	const FHyperTwistTrainingCoachGeneratedModeSelectorOptionMenuSurface OptionMenuSurface =
		GetDisplayedCoachGeneratedModeSelectorOptionMenuSurface(SelectorId);
	const FHyperTwistTrainingCoachGeneratedModeSelectorOptionDispatchSurface OptionDispatchSurface =
		GetDisplayedCoachGeneratedModeSelectorOptionDispatchSurface(SelectorId);
	const FHyperTwistTrainingCoachGeneratedModeSelectorOptionRequestAlignmentSurface
		OptionRequestAlignmentSurface =
			GetDisplayedCoachGeneratedModeSelectorOptionRequestAlignmentSurface(SelectorId);
	return UHyperTwistTrainingCoachLibrary::DeriveCoachGeneratedModeSelectorOptionLaunchRequestPreviewSurface(
		CachedRunState,
		SelectorId,
		OptionMenuSurface,
		OptionDispatchSurface,
		OptionRequestAlignmentSurface
	);
}

FHyperTwistTrainingCoachGeneratedModeSelectorOptionLaunchRequestMetadataPreviewSurface
UHyperTwistTrainingPanelWidget::GetDisplayedCoachGeneratedModeSelectorOptionLaunchRequestMetadataPreviewSurface(
	const FString& SelectorId
) const
{
	const FHyperTwistTrainingCoachGeneratedModeSelectorOptionMenuSurface OptionMenuSurface =
		GetDisplayedCoachGeneratedModeSelectorOptionMenuSurface(SelectorId);
	const FHyperTwistTrainingCoachGeneratedModeSelectorOptionLaunchRequestPreviewSurface
		OptionLaunchRequestPreviewSurface =
			GetDisplayedCoachGeneratedModeSelectorOptionLaunchRequestPreviewSurface(SelectorId);
	return UHyperTwistTrainingCoachLibrary::
		DeriveCoachGeneratedModeSelectorOptionLaunchRequestMetadataPreviewSurface(
			CachedRunState,
			SelectorId,
			OptionMenuSurface,
			OptionLaunchRequestPreviewSurface
		);
}

FHyperTwistTrainingCoachGeneratedModeSelectorOptionLaunchRequestEnvelopePreviewSurface
UHyperTwistTrainingPanelWidget::GetDisplayedCoachGeneratedModeSelectorOptionLaunchRequestEnvelopePreviewSurface(
	const FString& SelectorId
) const
{
	const FHyperTwistTrainingCoachGeneratedModeSelectorOptionMenuSurface OptionMenuSurface =
		GetDisplayedCoachGeneratedModeSelectorOptionMenuSurface(SelectorId);
	const FHyperTwistTrainingCoachGeneratedModeSelectorOptionLaunchRequestPreviewSurface
		OptionLaunchRequestPreviewSurface =
			GetDisplayedCoachGeneratedModeSelectorOptionLaunchRequestPreviewSurface(SelectorId);
	return UHyperTwistTrainingCoachLibrary::
		DeriveCoachGeneratedModeSelectorOptionLaunchRequestEnvelopePreviewSurface(
			CachedRunState,
			SelectorId,
			OptionMenuSurface,
			OptionLaunchRequestPreviewSurface
		);
}

FHyperTwistTrainingCoachGeneratedModeSelectorOptionOwnedExecutionCasePreviewSurface
UHyperTwistTrainingPanelWidget::GetDisplayedCoachGeneratedModeSelectorOptionOwnedExecutionCasePreviewSurface(
	const FString& SelectorId
) const
{
	const FHyperTwistTrainingCoachGeneratedModeSelectorOptionMenuSurface OptionMenuSurface =
		GetDisplayedCoachGeneratedModeSelectorOptionMenuSurface(SelectorId);
	const FHyperTwistTrainingCoachGeneratedModeSelectorOptionLaunchRequestEnvelopePreviewSurface
		OptionLaunchRequestEnvelopePreviewSurface =
			GetDisplayedCoachGeneratedModeSelectorOptionLaunchRequestEnvelopePreviewSurface(SelectorId);
	return UHyperTwistTrainingCoachLibrary::
		DeriveCoachGeneratedModeSelectorOptionOwnedExecutionCasePreviewSurface(
			CachedRunState,
			SelectorId,
			OptionMenuSurface,
			OptionLaunchRequestEnvelopePreviewSurface
		);
}

FHyperTwistTrainingCoachGeneratedModeSelectorOptionOwnedExecutionPromptPreviewSurface
UHyperTwistTrainingPanelWidget::GetDisplayedCoachGeneratedModeSelectorOptionOwnedExecutionPromptPreviewSurface(
	const FString& SelectorId
) const
{
	const FHyperTwistTrainingCoachGeneratedModeSelectorOptionMenuSurface OptionMenuSurface =
		GetDisplayedCoachGeneratedModeSelectorOptionMenuSurface(SelectorId);
	const FHyperTwistTrainingCoachGeneratedModeSelectorOptionLaunchRequestPreviewSurface
		OptionLaunchRequestPreviewSurface =
			GetDisplayedCoachGeneratedModeSelectorOptionLaunchRequestPreviewSurface(SelectorId);
	return UHyperTwistTrainingCoachLibrary::
		DeriveCoachGeneratedModeSelectorOptionOwnedExecutionPromptPreviewSurface(
			CachedRunState,
			SelectorId,
			OptionMenuSurface,
			OptionLaunchRequestPreviewSurface
		);
}

FHyperTwistTrainingCoachGeneratedModeSelectorOptionOwnedExecutionDeliveryPreviewSurface
UHyperTwistTrainingPanelWidget::GetDisplayedCoachGeneratedModeSelectorOptionOwnedExecutionDeliveryPreviewSurface(
	const FString& SelectorId
) const
{
	const FHyperTwistTrainingCoachGeneratedModeSelectorOptionMenuSurface OptionMenuSurface =
		GetDisplayedCoachGeneratedModeSelectorOptionMenuSurface(SelectorId);
	const FHyperTwistTrainingCoachGeneratedModeSelectorOptionLaunchRequestPreviewSurface
		OptionLaunchRequestPreviewSurface =
			GetDisplayedCoachGeneratedModeSelectorOptionLaunchRequestPreviewSurface(SelectorId);
	return UHyperTwistTrainingCoachLibrary::
		DeriveCoachGeneratedModeSelectorOptionOwnedExecutionDeliveryPreviewSurface(
			CachedRunState,
			SelectorId,
			OptionMenuSurface,
			OptionLaunchRequestPreviewSurface
		);
}

FHyperTwistTrainingCoachGeneratedModeSelectorOptionOwnedExecutionPuzzleSubsetDifficultyPreviewSurface
UHyperTwistTrainingPanelWidget::GetDisplayedCoachGeneratedModeSelectorOptionOwnedExecutionPuzzleSubsetDifficultyPreviewSurface(
	const FString& SelectorId
) const
{
	const FHyperTwistTrainingCoachGeneratedModeSelectorOptionMenuSurface OptionMenuSurface =
		GetDisplayedCoachGeneratedModeSelectorOptionMenuSurface(SelectorId);
	const FHyperTwistTrainingCoachGeneratedModeSelectorOptionLaunchRequestPreviewSurface
		OptionLaunchRequestPreviewSurface =
			GetDisplayedCoachGeneratedModeSelectorOptionLaunchRequestPreviewSurface(SelectorId);
	return UHyperTwistTrainingCoachLibrary::
		DeriveCoachGeneratedModeSelectorOptionOwnedExecutionPuzzleSubsetDifficultyPreviewSurface(
			CachedRunState,
			SelectorId,
			OptionMenuSurface,
			OptionLaunchRequestPreviewSurface
		);
}

FHyperTwistTrainingCoachGeneratedModeSelectorOptionOwnedExecutionProvenancePreviewSurface
UHyperTwistTrainingPanelWidget::GetDisplayedCoachGeneratedModeSelectorOptionOwnedExecutionProvenancePreviewSurface(
	const FString& SelectorId
) const
{
	const FHyperTwistTrainingCoachGeneratedModeSelectorOptionMenuSurface OptionMenuSurface =
		GetDisplayedCoachGeneratedModeSelectorOptionMenuSurface(SelectorId);
	const FHyperTwistTrainingCoachGeneratedModeSelectorOptionLaunchRequestPreviewSurface
		OptionLaunchRequestPreviewSurface =
			GetDisplayedCoachGeneratedModeSelectorOptionLaunchRequestPreviewSurface(SelectorId);
	return UHyperTwistTrainingCoachLibrary::
		DeriveCoachGeneratedModeSelectorOptionOwnedExecutionProvenancePreviewSurface(
			CachedRunState,
			SelectorId,
			OptionMenuSurface,
			OptionLaunchRequestPreviewSurface
		);
}

FHyperTwistTrainingCoachGeneratedModeSelectorOptionOwnedExecutionDeckTitleSelectionPolicyPreviewSurface
UHyperTwistTrainingPanelWidget::GetDisplayedCoachGeneratedModeSelectorOptionOwnedExecutionDeckTitleSelectionPolicyPreviewSurface(
	const FString& SelectorId
) const
{
	const FHyperTwistTrainingCoachGeneratedModeSelectorOptionMenuSurface OptionMenuSurface =
		GetDisplayedCoachGeneratedModeSelectorOptionMenuSurface(SelectorId);
	const FHyperTwistTrainingCoachGeneratedModeSelectorOptionLaunchRequestPreviewSurface
		OptionLaunchRequestPreviewSurface =
			GetDisplayedCoachGeneratedModeSelectorOptionLaunchRequestPreviewSurface(SelectorId);
	return UHyperTwistTrainingCoachLibrary::
		DeriveCoachGeneratedModeSelectorOptionOwnedExecutionDeckTitleSelectionPolicyPreviewSurface(
			CachedRunState,
			SelectorId,
			OptionMenuSurface,
			OptionLaunchRequestPreviewSurface
		);
}

FHyperTwistTrainingCoachGeneratedModeSelectorOptionOwnedExecutionDeckIdRuntimeSurfaceRetentionPreviewSurface
UHyperTwistTrainingPanelWidget::GetDisplayedCoachGeneratedModeSelectorOptionOwnedExecutionDeckIdRuntimeSurfaceRetentionPreviewSurface(
	const FString& SelectorId
) const
{
	const FHyperTwistTrainingCoachGeneratedModeSelectorOptionMenuSurface OptionMenuSurface =
		GetDisplayedCoachGeneratedModeSelectorOptionMenuSurface(SelectorId);
	const FHyperTwistTrainingCoachGeneratedModeSelectorOptionLaunchRequestPreviewSurface
		OptionLaunchRequestPreviewSurface =
			GetDisplayedCoachGeneratedModeSelectorOptionLaunchRequestPreviewSurface(SelectorId);
	return UHyperTwistTrainingCoachLibrary::
		DeriveCoachGeneratedModeSelectorOptionOwnedExecutionDeckIdRuntimeSurfaceRetentionPreviewSurface(
			CachedRunState,
			SelectorId,
			OptionMenuSurface,
			OptionLaunchRequestPreviewSurface
		);
}

FHyperTwistTrainingCoachGeneratedModeSelectorOptionOwnedExecutionDeliveryModeRosterAllowedModeRetentionPreviewSurface
UHyperTwistTrainingPanelWidget::GetDisplayedCoachGeneratedModeSelectorOptionOwnedExecutionDeliveryModeRosterAllowedModeRetentionPreviewSurface(
	const FString& SelectorId
) const
{
	const FHyperTwistTrainingCoachGeneratedModeSelectorOptionMenuSurface OptionMenuSurface =
		GetDisplayedCoachGeneratedModeSelectorOptionMenuSurface(SelectorId);
	const FHyperTwistTrainingCoachGeneratedModeSelectorOptionLaunchRequestPreviewSurface
		OptionLaunchRequestPreviewSurface =
			GetDisplayedCoachGeneratedModeSelectorOptionLaunchRequestPreviewSurface(SelectorId);
	return UHyperTwistTrainingCoachLibrary::
		DeriveCoachGeneratedModeSelectorOptionOwnedExecutionDeliveryModeRosterAllowedModeRetentionPreviewSurface(
			CachedRunState,
			SelectorId,
			OptionMenuSurface,
			OptionLaunchRequestPreviewSurface
		);
}

FHyperTwistTrainingCoachGeneratedModeSelectorOptionOwnedExecutionRealScrambleVirtualCubeSmartCubeCapabilityRetentionPreviewSurface
UHyperTwistTrainingPanelWidget::GetDisplayedCoachGeneratedModeSelectorOptionOwnedExecutionRealScrambleVirtualCubeSmartCubeCapabilityRetentionPreviewSurface(
	const FString& SelectorId
) const
{
	const FHyperTwistTrainingCoachGeneratedModeSelectorOptionMenuSurface OptionMenuSurface =
		GetDisplayedCoachGeneratedModeSelectorOptionMenuSurface(SelectorId);
	const FHyperTwistTrainingCoachGeneratedModeSelectorOptionLaunchRequestPreviewSurface
		OptionLaunchRequestPreviewSurface =
			GetDisplayedCoachGeneratedModeSelectorOptionLaunchRequestPreviewSurface(SelectorId);
	return UHyperTwistTrainingCoachLibrary::
		DeriveCoachGeneratedModeSelectorOptionOwnedExecutionRealScrambleVirtualCubeSmartCubeCapabilityRetentionPreviewSurface(
			CachedRunState,
			SelectorId,
			OptionMenuSurface,
			OptionLaunchRequestPreviewSurface
		);
}

FHyperTwistTrainingCoachGeneratedModeSelectorOptionOwnedExecutionTimingPolicyRetentionPreviewSurface
UHyperTwistTrainingPanelWidget::GetDisplayedCoachGeneratedModeSelectorOptionOwnedExecutionTimingPolicyRetentionPreviewSurface(
	const FString& SelectorId
) const
{
	const FHyperTwistTrainingCoachGeneratedModeSelectorOptionMenuSurface OptionMenuSurface =
		GetDisplayedCoachGeneratedModeSelectorOptionMenuSurface(SelectorId);
	const FHyperTwistTrainingCoachGeneratedModeSelectorOptionLaunchRequestPreviewSurface
		OptionLaunchRequestPreviewSurface =
			GetDisplayedCoachGeneratedModeSelectorOptionLaunchRequestPreviewSurface(SelectorId);
	return UHyperTwistTrainingCoachLibrary::
		DeriveCoachGeneratedModeSelectorOptionOwnedExecutionTimingPolicyRetentionPreviewSurface(
			CachedRunState,
			SelectorId,
			OptionMenuSurface,
			OptionLaunchRequestPreviewSurface
		);
}

FHyperTwistTrainingCoachGeneratedModeSelectorOptionOwnedExecutionSplitPhaseDetailRetentionPreviewSurface
UHyperTwistTrainingPanelWidget::GetDisplayedCoachGeneratedModeSelectorOptionOwnedExecutionSplitPhaseDetailRetentionPreviewSurface(
	const FString& SelectorId
) const
{
	const FHyperTwistTrainingCoachGeneratedModeSelectorOptionMenuSurface OptionMenuSurface =
		GetDisplayedCoachGeneratedModeSelectorOptionMenuSurface(SelectorId);
	const FHyperTwistTrainingCoachGeneratedModeSelectorOptionLaunchRequestPreviewSurface
		OptionLaunchRequestPreviewSurface =
			GetDisplayedCoachGeneratedModeSelectorOptionLaunchRequestPreviewSurface(SelectorId);
	return UHyperTwistTrainingCoachLibrary::
		DeriveCoachGeneratedModeSelectorOptionOwnedExecutionSplitPhaseDetailRetentionPreviewSurface(
			CachedRunState,
			SelectorId,
			OptionMenuSurface,
			OptionLaunchRequestPreviewSurface
		);
}

FHyperTwistTrainingCoachGeneratedModeSelectorOptionOwnedExecutionSplitPhasePhaseIdLabelFallbackProvenancePreviewSurface
UHyperTwistTrainingPanelWidget::GetDisplayedCoachGeneratedModeSelectorOptionOwnedExecutionSplitPhasePhaseIdLabelFallbackProvenancePreviewSurface(
	const FString& SelectorId
) const
{
	const FHyperTwistTrainingCoachGeneratedModeSelectorOptionMenuSurface OptionMenuSurface =
		GetDisplayedCoachGeneratedModeSelectorOptionMenuSurface(SelectorId);
	const FHyperTwistTrainingCoachGeneratedModeSelectorOptionLaunchRequestPreviewSurface
		OptionLaunchRequestPreviewSurface =
			GetDisplayedCoachGeneratedModeSelectorOptionLaunchRequestPreviewSurface(SelectorId);
	return UHyperTwistTrainingCoachLibrary::
		DeriveCoachGeneratedModeSelectorOptionOwnedExecutionSplitPhasePhaseIdLabelFallbackProvenancePreviewSurface(
			CachedRunState,
			SelectorId,
			OptionMenuSurface,
			OptionLaunchRequestPreviewSurface
		);
}

FHyperTwistTrainingCoachGeneratedModeSelectorOptionOwnedExecutionSplitPhaseDuplicatePruningSurvivorProvenancePreviewSurface
UHyperTwistTrainingPanelWidget::GetDisplayedCoachGeneratedModeSelectorOptionOwnedExecutionSplitPhaseDuplicatePruningSurvivorProvenancePreviewSurface(
	const FString& SelectorId
) const
{
	const FHyperTwistTrainingCoachGeneratedModeSelectorOptionMenuSurface OptionMenuSurface =
		GetDisplayedCoachGeneratedModeSelectorOptionMenuSurface(SelectorId);
	const FHyperTwistTrainingCoachGeneratedModeSelectorOptionLaunchRequestPreviewSurface
		OptionLaunchRequestPreviewSurface =
			GetDisplayedCoachGeneratedModeSelectorOptionLaunchRequestPreviewSurface(SelectorId);
	return UHyperTwistTrainingCoachLibrary::
		DeriveCoachGeneratedModeSelectorOptionOwnedExecutionSplitPhaseDuplicatePruningSurvivorProvenancePreviewSurface(
			CachedRunState,
			SelectorId,
			OptionMenuSurface,
			OptionLaunchRequestPreviewSurface
		);
}

FHyperTwistTrainingCoachGeneratedModeSelectorOptionOwnedExecutionSplitPhaseNormalizationSummaryPreviewSurface
UHyperTwistTrainingPanelWidget::GetDisplayedCoachGeneratedModeSelectorOptionOwnedExecutionSplitPhaseNormalizationSummaryPreviewSurface(
	const FString& SelectorId
) const
{
	const FHyperTwistTrainingCoachGeneratedModeSelectorOptionMenuSurface OptionMenuSurface =
		GetDisplayedCoachGeneratedModeSelectorOptionMenuSurface(SelectorId);
	const FHyperTwistTrainingCoachGeneratedModeSelectorOptionLaunchRequestPreviewSurface
		OptionLaunchRequestPreviewSurface =
			GetDisplayedCoachGeneratedModeSelectorOptionLaunchRequestPreviewSurface(SelectorId);
	return UHyperTwistTrainingCoachLibrary::
		DeriveCoachGeneratedModeSelectorOptionOwnedExecutionSplitPhaseNormalizationSummaryPreviewSurface(
			CachedRunState,
			SelectorId,
			OptionMenuSurface,
			OptionLaunchRequestPreviewSurface
		);
}

FHyperTwistTrainingCoachGeneratedModeSelectorOptionOwnedExecutionSplitPhaseRawRowNormalizedPhaseFusionPreviewSurface
UHyperTwistTrainingPanelWidget::GetDisplayedCoachGeneratedModeSelectorOptionOwnedExecutionSplitPhaseRawRowNormalizedPhaseFusionPreviewSurface(
	const FString& SelectorId
) const
{
	const FHyperTwistTrainingCoachGeneratedModeSelectorOptionMenuSurface OptionMenuSurface =
		GetDisplayedCoachGeneratedModeSelectorOptionMenuSurface(SelectorId);
	const FHyperTwistTrainingCoachGeneratedModeSelectorOptionLaunchRequestPreviewSurface
		OptionLaunchRequestPreviewSurface =
			GetDisplayedCoachGeneratedModeSelectorOptionLaunchRequestPreviewSurface(SelectorId);
	return UHyperTwistTrainingCoachLibrary::
		DeriveCoachGeneratedModeSelectorOptionOwnedExecutionSplitPhaseRawRowNormalizedPhaseFusionPreviewSurface(
			CachedRunState,
			SelectorId,
			OptionMenuSurface,
			OptionLaunchRequestPreviewSurface
		);
}

FHyperTwistTrainingCoachGeneratedModeSelectorOptionOwnedExecutionSplitPhaseCurrentSelectionCanonicalInspectSurface
UHyperTwistTrainingPanelWidget::GetDisplayedCoachGeneratedModeSelectorOptionOwnedExecutionSplitPhaseCurrentSelectionCanonicalInspectSurface(
	const FString& SelectorId
) const
{
	const FHyperTwistTrainingCoachGeneratedModeSelectorOptionMenuSurface OptionMenuSurface =
		GetDisplayedCoachGeneratedModeSelectorOptionMenuSurface(SelectorId);
	const FHyperTwistTrainingCoachGeneratedModeSelectorOptionLaunchRequestPreviewSurface
		OptionLaunchRequestPreviewSurface =
			GetDisplayedCoachGeneratedModeSelectorOptionLaunchRequestPreviewSurface(SelectorId);
	return UHyperTwistTrainingCoachLibrary::
		DeriveCoachGeneratedModeSelectorOptionOwnedExecutionSplitPhaseCurrentSelectionCanonicalInspectSurface(
			CachedRunState,
			SelectorId,
			OptionMenuSurface,
			OptionLaunchRequestPreviewSurface
		);
}

FHyperTwistTrainingCoachGeneratedModeSelectorOptionOwnedExecutionSplitPhaseCurrentSelectionSurvivorPhaseRosterInspectSurface
UHyperTwistTrainingPanelWidget::GetDisplayedCoachGeneratedModeSelectorOptionOwnedExecutionSplitPhaseCurrentSelectionSurvivorPhaseRosterInspectSurface(
	const FString& SelectorId
) const
{
	const FHyperTwistTrainingCoachGeneratedModeSelectorOptionMenuSurface OptionMenuSurface =
		GetDisplayedCoachGeneratedModeSelectorOptionMenuSurface(SelectorId);
	const FHyperTwistTrainingCoachGeneratedModeSelectorOptionLaunchRequestPreviewSurface
		OptionLaunchRequestPreviewSurface =
			GetDisplayedCoachGeneratedModeSelectorOptionLaunchRequestPreviewSurface(SelectorId);
	return UHyperTwistTrainingCoachLibrary::
		DeriveCoachGeneratedModeSelectorOptionOwnedExecutionSplitPhaseCurrentSelectionSurvivorPhaseRosterInspectSurface(
			CachedRunState,
			SelectorId,
			OptionMenuSurface,
			OptionLaunchRequestPreviewSurface
		);
}

FHyperTwistTrainingCoachGeneratedModeSelectorOptionOwnedExecutionSplitPhaseCurrentSelectionDroppedRowAuditInspectSurface
UHyperTwistTrainingPanelWidget::GetDisplayedCoachGeneratedModeSelectorOptionOwnedExecutionSplitPhaseCurrentSelectionDroppedRowAuditInspectSurface(
	const FString& SelectorId
) const
{
	const FHyperTwistTrainingCoachGeneratedModeSelectorOptionMenuSurface OptionMenuSurface =
		GetDisplayedCoachGeneratedModeSelectorOptionMenuSurface(SelectorId);
	const FHyperTwistTrainingCoachGeneratedModeSelectorOptionLaunchRequestPreviewSurface
		OptionLaunchRequestPreviewSurface =
			GetDisplayedCoachGeneratedModeSelectorOptionLaunchRequestPreviewSurface(SelectorId);
	return UHyperTwistTrainingCoachLibrary::
		DeriveCoachGeneratedModeSelectorOptionOwnedExecutionSplitPhaseCurrentSelectionDroppedRowAuditInspectSurface(
			CachedRunState,
			SelectorId,
			OptionMenuSurface,
			OptionLaunchRequestPreviewSurface
		);
}

FHyperTwistTrainingCoachGeneratedModeSelectorOptionOwnedExecutionSplitPhaseCurrentSelectionPhaseIdFallbackRosterInspectSurface
UHyperTwistTrainingPanelWidget::GetDisplayedCoachGeneratedModeSelectorOptionOwnedExecutionSplitPhaseCurrentSelectionPhaseIdFallbackRosterInspectSurface(
	const FString& SelectorId
) const
{
	const FHyperTwistTrainingCoachGeneratedModeSelectorOptionMenuSurface OptionMenuSurface =
		GetDisplayedCoachGeneratedModeSelectorOptionMenuSurface(SelectorId);
	const FHyperTwistTrainingCoachGeneratedModeSelectorOptionLaunchRequestPreviewSurface
		OptionLaunchRequestPreviewSurface =
			GetDisplayedCoachGeneratedModeSelectorOptionLaunchRequestPreviewSurface(SelectorId);
	return UHyperTwistTrainingCoachLibrary::
		DeriveCoachGeneratedModeSelectorOptionOwnedExecutionSplitPhaseCurrentSelectionPhaseIdFallbackRosterInspectSurface(
			CachedRunState,
			SelectorId,
			OptionMenuSurface,
			OptionLaunchRequestPreviewSurface
		);
}

FHyperTwistTrainingCoachGeneratedModeSelectorOptionOwnedExecutionSplitPhaseCurrentSelectionExplicitLabelRosterInspectSurface
UHyperTwistTrainingPanelWidget::GetDisplayedCoachGeneratedModeSelectorOptionOwnedExecutionSplitPhaseCurrentSelectionExplicitLabelRosterInspectSurface(
	const FString& SelectorId
) const
{
	const FHyperTwistTrainingCoachGeneratedModeSelectorOptionMenuSurface OptionMenuSurface =
		GetDisplayedCoachGeneratedModeSelectorOptionMenuSurface(SelectorId);
	const FHyperTwistTrainingCoachGeneratedModeSelectorOptionLaunchRequestPreviewSurface
		OptionLaunchRequestPreviewSurface =
			GetDisplayedCoachGeneratedModeSelectorOptionLaunchRequestPreviewSurface(SelectorId);
	return UHyperTwistTrainingCoachLibrary::
		DeriveCoachGeneratedModeSelectorOptionOwnedExecutionSplitPhaseCurrentSelectionExplicitLabelRosterInspectSurface(
			CachedRunState,
			SelectorId,
			OptionMenuSurface,
			OptionLaunchRequestPreviewSurface
		);
}

FHyperTwistTrainingCoachGeneratedModeSelectorOptionOwnedExecutionSplitPhaseCurrentSelectionLabelProvenancePartitionSummaryInspectSurface
UHyperTwistTrainingPanelWidget::GetDisplayedCoachGeneratedModeSelectorOptionOwnedExecutionSplitPhaseCurrentSelectionLabelProvenancePartitionSummaryInspectSurface(
	const FString& SelectorId
) const
{
	const FHyperTwistTrainingCoachGeneratedModeSelectorOptionMenuSurface OptionMenuSurface =
		GetDisplayedCoachGeneratedModeSelectorOptionMenuSurface(SelectorId);
	const FHyperTwistTrainingCoachGeneratedModeSelectorOptionLaunchRequestPreviewSurface
		OptionLaunchRequestPreviewSurface =
			GetDisplayedCoachGeneratedModeSelectorOptionLaunchRequestPreviewSurface(SelectorId);
	return UHyperTwistTrainingCoachLibrary::
		DeriveCoachGeneratedModeSelectorOptionOwnedExecutionSplitPhaseCurrentSelectionLabelProvenancePartitionSummaryInspectSurface(
			CachedRunState,
			SelectorId,
			OptionMenuSurface,
			OptionLaunchRequestPreviewSurface
		);
}

FHyperTwistTrainingCoachGeneratedModeSelectorOptionOwnedExecutionSplitPhaseCurrentSelectionLabelProvenancePartitionRosterPairInspectSurface
UHyperTwistTrainingPanelWidget::GetDisplayedCoachGeneratedModeSelectorOptionOwnedExecutionSplitPhaseCurrentSelectionLabelProvenancePartitionRosterPairInspectSurface(
	const FString& SelectorId
) const
{
	const FHyperTwistTrainingCoachGeneratedModeSelectorOptionMenuSurface OptionMenuSurface =
		GetDisplayedCoachGeneratedModeSelectorOptionMenuSurface(SelectorId);
	const FHyperTwistTrainingCoachGeneratedModeSelectorOptionLaunchRequestPreviewSurface
		OptionLaunchRequestPreviewSurface =
			GetDisplayedCoachGeneratedModeSelectorOptionLaunchRequestPreviewSurface(SelectorId);
	return UHyperTwistTrainingCoachLibrary::
		DeriveCoachGeneratedModeSelectorOptionOwnedExecutionSplitPhaseCurrentSelectionLabelProvenancePartitionRosterPairInspectSurface(
			CachedRunState,
			SelectorId,
			OptionMenuSurface,
			OptionLaunchRequestPreviewSurface
		);
}

FHyperTwistTrainingCoachGeneratedModeSelectorOptionOwnedExecutionSplitPhaseCurrentSelectionLabelProvenancePartitionMergedOrderedRosterInspectSurface
UHyperTwistTrainingPanelWidget::GetDisplayedCoachGeneratedModeSelectorOptionOwnedExecutionSplitPhaseCurrentSelectionLabelProvenancePartitionMergedOrderedRosterInspectSurface(
	const FString& SelectorId
) const
{
	const FHyperTwistTrainingCoachGeneratedModeSelectorOptionMenuSurface OptionMenuSurface =
		GetDisplayedCoachGeneratedModeSelectorOptionMenuSurface(SelectorId);
	const FHyperTwistTrainingCoachGeneratedModeSelectorOptionLaunchRequestPreviewSurface
		OptionLaunchRequestPreviewSurface =
			GetDisplayedCoachGeneratedModeSelectorOptionLaunchRequestPreviewSurface(SelectorId);
	return UHyperTwistTrainingCoachLibrary::
		DeriveCoachGeneratedModeSelectorOptionOwnedExecutionSplitPhaseCurrentSelectionLabelProvenancePartitionMergedOrderedRosterInspectSurface(
			CachedRunState,
			SelectorId,
			OptionMenuSurface,
			OptionLaunchRequestPreviewSurface
		);
}

FHyperTwistTrainingCoachGeneratedModeSelectorOptionOwnedExecutionSplitPhaseCurrentSelectionLabelProvenancePartitionMergedOrderedRosterPhaseIdLookupInspectSurface
UHyperTwistTrainingPanelWidget::GetDisplayedCoachGeneratedModeSelectorOptionOwnedExecutionSplitPhaseCurrentSelectionLabelProvenancePartitionMergedOrderedRosterPhaseIdLookupInspectSurface(
	const FString& SelectorId,
	const FString& PhaseId
) const
{
	const FHyperTwistTrainingCoachGeneratedModeSelectorOptionMenuSurface OptionMenuSurface =
		GetDisplayedCoachGeneratedModeSelectorOptionMenuSurface(SelectorId);
	const FHyperTwistTrainingCoachGeneratedModeSelectorOptionLaunchRequestPreviewSurface
		OptionLaunchRequestPreviewSurface =
			GetDisplayedCoachGeneratedModeSelectorOptionLaunchRequestPreviewSurface(SelectorId);
	return UHyperTwistTrainingCoachLibrary::
		DeriveCoachGeneratedModeSelectorOptionOwnedExecutionSplitPhaseCurrentSelectionLabelProvenancePartitionMergedOrderedRosterPhaseIdLookupInspectSurface(
			CachedRunState,
			SelectorId,
			PhaseId,
			OptionMenuSurface,
			OptionLaunchRequestPreviewSurface
		);
}

FHyperTwistTrainingCoachGeneratedModeSelectorOptionOwnedExecutionSplitPhaseCurrentSelectionLabelProvenancePartitionMergedOrderedRosterNormalizedOrderLookupInspectSurface
UHyperTwistTrainingPanelWidget::GetDisplayedCoachGeneratedModeSelectorOptionOwnedExecutionSplitPhaseCurrentSelectionLabelProvenancePartitionMergedOrderedRosterNormalizedOrderLookupInspectSurface(
	const FString& SelectorId,
	const int32 NormalizedOrder
) const
{
	const FHyperTwistTrainingCoachGeneratedModeSelectorOptionMenuSurface OptionMenuSurface =
		GetDisplayedCoachGeneratedModeSelectorOptionMenuSurface(SelectorId);
	const FHyperTwistTrainingCoachGeneratedModeSelectorOptionLaunchRequestPreviewSurface
		OptionLaunchRequestPreviewSurface =
			GetDisplayedCoachGeneratedModeSelectorOptionLaunchRequestPreviewSurface(SelectorId);
	return UHyperTwistTrainingCoachLibrary::
		DeriveCoachGeneratedModeSelectorOptionOwnedExecutionSplitPhaseCurrentSelectionLabelProvenancePartitionMergedOrderedRosterNormalizedOrderLookupInspectSurface(
			CachedRunState,
			SelectorId,
			NormalizedOrder,
			OptionMenuSurface,
			OptionLaunchRequestPreviewSurface
		);
}

FHyperTwistTrainingCoachGeneratedModeSelectorOptionOwnedExecutionSplitPhaseCurrentSelectionLabelProvenancePartitionMergedOrderedRosterEvaluationOrderLookupInspectSurface
UHyperTwistTrainingPanelWidget::GetDisplayedCoachGeneratedModeSelectorOptionOwnedExecutionSplitPhaseCurrentSelectionLabelProvenancePartitionMergedOrderedRosterEvaluationOrderLookupInspectSurface(
	const FString& SelectorId,
	const int32 EvaluationOrder
) const
{
	const FHyperTwistTrainingCoachGeneratedModeSelectorOptionMenuSurface OptionMenuSurface =
		GetDisplayedCoachGeneratedModeSelectorOptionMenuSurface(SelectorId);
	const FHyperTwistTrainingCoachGeneratedModeSelectorOptionLaunchRequestPreviewSurface
		OptionLaunchRequestPreviewSurface =
			GetDisplayedCoachGeneratedModeSelectorOptionLaunchRequestPreviewSurface(SelectorId);
	return UHyperTwistTrainingCoachLibrary::
		DeriveCoachGeneratedModeSelectorOptionOwnedExecutionSplitPhaseCurrentSelectionLabelProvenancePartitionMergedOrderedRosterEvaluationOrderLookupInspectSurface(
			CachedRunState,
			SelectorId,
			EvaluationOrder,
			OptionMenuSurface,
			OptionLaunchRequestPreviewSurface
		);
}

FHyperTwistTrainingRunState UHyperTwistTrainingPanelWidget::StartCoachRecommendedRun(
	const int32 MaxCases,
	const FString& StartActionSourceLabel
)
{
	LastStepResult = FHyperTwistTrainingRunStepResult();
	CachedRunState = UHyperTwistTrainingRuntimeLibrary::StartCoachRecommendedRun(
		this,
		DefaultSessionId + TEXT("_coach"),
		MaxCases > 0 ? MaxCases : DefaultCoachMaxCases,
		StartActionSourceLabel
	);
	RefreshTrainingState();
	return CachedRunState;
}

FHyperTwistTrainingRunState UHyperTwistTrainingPanelWidget::StartCoachFollowUpRun(
	const int32 MaxCases,
	const FString& StartActionSourceLabel
)
{
	LastStepResult = FHyperTwistTrainingRunStepResult();
	CachedRunState = UHyperTwistTrainingRuntimeLibrary::StartCoachFollowUpRun(
		this,
		DefaultSessionId + TEXT("_follow_up"),
		MaxCases > 0 ? MaxCases : DefaultCoachMaxCases,
		StartActionSourceLabel
	);
	RefreshTrainingState();
	return CachedRunState;
}

FHyperTwistTrainingRunState UHyperTwistTrainingPanelWidget::StartPrimaryCoachAction(
	const int32 MaxCases,
	const FString& StartActionSourceLabel
)
{
	LastStepResult = FHyperTwistTrainingRunStepResult();
	CachedRunState = UHyperTwistTrainingRuntimeLibrary::StartPrimaryCoachAction(
		this,
		DefaultSessionId + TEXT("_primary"),
		MaxCases > 0 ? MaxCases : DefaultCoachMaxCases,
		StartActionSourceLabel
	);
	RefreshTrainingState();
	return CachedRunState;
}

FHyperTwistTrainingRunState UHyperTwistTrainingPanelWidget::StartNextQueuedCoachRun(
	const int32 MaxCases,
	const FString& StartActionSourceLabel
)
{
	LastStepResult = FHyperTwistTrainingRunStepResult();
	CachedRunState = UHyperTwistTrainingRuntimeLibrary::StartNextQueuedCoachRun(
		this,
		DefaultSessionId + TEXT("_queue"),
		MaxCases > 0 ? MaxCases : DefaultCoachMaxCases,
		StartActionSourceLabel
	);
	RefreshTrainingState();
	return CachedRunState;
}

FHyperTwistTrainingRunState UHyperTwistTrainingPanelWidget::StartCoachQueueEntry(
	const FString& EntryId,
	const int32 MaxCases
)
{
	LastStepResult = FHyperTwistTrainingRunStepResult();
	CachedRunState = UHyperTwistTrainingRuntimeLibrary::StartCoachQueueEntry(
		this,
		EntryId,
		DefaultSessionId + TEXT("_queue_") + EntryId,
		MaxCases > 0 ? MaxCases : DefaultCoachMaxCases
	);
	RefreshTrainingState();
	return CachedRunState;
}

FHyperTwistTrainingRunState UHyperTwistTrainingPanelWidget::StartDisplayedCoachRecommendedRun(
	const int32 MaxCases
)
{
	return StartCoachRecommendedRun(
		MaxCases,
		ResolveCoachHandoffStartActionSourceLabel(EHyperTwistTrainingCoachHandoffKind::Recommended)
	);
}

FHyperTwistTrainingRunState UHyperTwistTrainingPanelWidget::StartDisplayedCoachFollowUpRun(
	const int32 MaxCases
)
{
	return StartCoachFollowUpRun(
		MaxCases,
		ResolveCoachHandoffStartActionSourceLabel(EHyperTwistTrainingCoachHandoffKind::FollowUp)
	);
}

FHyperTwistTrainingRunState UHyperTwistTrainingPanelWidget::StartDisplayedPrimaryCoachAction(
	const int32 MaxCases
)
{
	return StartPrimaryCoachAction(MaxCases, ResolvePrimaryCoachActionStartActionSourceLabel());
}

FHyperTwistTrainingRunState UHyperTwistTrainingPanelWidget::StartDisplayedNextQueuedCoachRun(
	const int32 MaxCases
)
{
	return StartNextQueuedCoachRun(
		MaxCases,
		ResolveCoachHandoffStartActionSourceLabel(EHyperTwistTrainingCoachHandoffKind::Queue)
	);
}

FHyperTwistTrainingRunState UHyperTwistTrainingPanelWidget::StartDisplayedCoachQueueEntry(
	const int32 MaxCases
)
{
	if (CachedCoachPanelState.ActiveQueueEntryId.IsEmpty())
	{
		return FHyperTwistTrainingRunState();
	}

	return StartCoachQueueEntry(CachedCoachPanelState.ActiveQueueEntryId, MaxCases);
}

bool UHyperTwistTrainingPanelWidget::DeferCoachQueueEntry(
	const FString& EntryId,
	const FString& DeferredUntilUtc,
	const FString& DeferralReasonLabel,
	const bool bManualReschedule
)
{
	const bool bSucceeded = UHyperTwistTrainingRuntimeLibrary::DeferCoachSessionQueueEntry(
		this,
		EntryId,
		DeferredUntilUtc,
		DeferralReasonLabel,
		bManualReschedule
	);
	RefreshTrainingState();
	return bSucceeded;
}

bool UHyperTwistTrainingPanelWidget::DeferDisplayedCoachQueueEntry(
	const FString& DeferredUntilUtc,
	const FString& DeferralReasonLabel,
	const bool bManualReschedule
)
{
	const FHyperTwistTrainingCoachQueueControlSurface Surface = GetDisplayedCoachQueueControlSurface();
	if (!Surface.bCanDefer || Surface.DeferTargetEntryId.IsEmpty())
	{
		return false;
	}

	return DeferCoachQueueEntry(
		Surface.DeferTargetEntryId,
		DeferredUntilUtc,
		DeferralReasonLabel,
		bManualReschedule
	);
}

bool UHyperTwistTrainingPanelWidget::PromoteCoachQueueEntry(
	const FString& EntryId,
	const FString& StartActionSourceLabel
)
{
	const bool bSucceeded = UHyperTwistTrainingRuntimeLibrary::PromoteCoachSessionQueueEntry(
		this,
		EntryId,
		StartActionSourceLabel
	);
	RefreshTrainingState();
	return bSucceeded;
}

bool UHyperTwistTrainingPanelWidget::PromoteDisplayedCoachQueueEntry()
{
	const FHyperTwistTrainingCoachQueueControlSurface Surface = GetDisplayedCoachQueueControlSurface();
	if (!Surface.bCanPromote || Surface.PromoteTargetEntryId.IsEmpty())
	{
		return false;
	}

	return PromoteCoachQueueEntry(
		Surface.PromoteTargetEntryId,
		Surface.PromoteActionSourceLabel
	);
}

FHyperTwistTrainingRunState UHyperTwistTrainingPanelWidget::StartActiveMethodDrillFollowUpRun(
	const FString& SessionId
)
{
	LastStepResult = FHyperTwistTrainingRunStepResult();
	CachedRunState =
		UHyperTwistTrainingRuntimeLibrary::StartActiveMethodDrillFollowUpRun(this, SessionId);
	RefreshTrainingState();
	return CachedRunState;
}

FHyperTwistTrainingRepositoryRoundTripVerification
UHyperTwistTrainingPanelWidget::VerifyTrainingRepositoryRoundTrip()
{
	CachedRepositoryRoundTripVerification =
		UHyperTwistTrainingRuntimeLibrary::VerifyTrainingRepositoryRoundTripAtDefaultPath(this);
	RefreshTrainingState();
	return CachedRepositoryRoundTripVerification;
}
