<commit_before>package flixel.system.debug;

#if !FLX_NO_DEBUG
import flash.display.DisplayObject;
import flash.geom.Matrix;
import flash.geom.Point;
import flash.geom.Rectangle;
import flixel.FlxBasic;
import flixel.FlxCamera;
import flixel.FlxG;
import flixel.FlxObject;
import flixel.FlxSprite;
import flixel.FlxState;
import flixel.FlxSubState;
import flixel.group.FlxSpriteGroup;
import flixel.group.FlxTypedGroup.FlxTypedGroup;
import flixel.input.gamepad.FlxGamepad;
import flixel.input.mouse.FlxMouse;
import flixel.input.touch.FlxTouch;
import flixel.input.FlxSwipe;
import flixel.system.debug.ConsoleUtil.PathToVariable;
import flixel.system.debug.Tracker.TrackerProfile;
import flixel.system.debug.Watch;
import flixel.text.FlxText;
import flixel.tile.FlxTilemap;
import flixel.tweens.FlxTween;
import flixel.tweens.misc.MultiVarTween;
#if !bitfive
import flixel.ui.FlxBar;
#end
import flixel.ui.FlxTypedButton.FlxTypedButton;
import flixel.util.FlxPath;
import flixel.util.FlxPoint;
import flixel.util.FlxRect;
#end

import flixel.util.FlxStringUtil;

class Tracker extends Watch
{
	#if !FLX_NO_DEBUG
	/**
	 * Order matters here, as the last profile is the most releveant - i.e., if the 
	 * FlxSprite profile were added before the one for FlxObject, it would never be selected.
	 */
	public static var profiles:Array<TrackerProfile>;
	
	/**
	 * Stores a reference to all objects for a which a tracker window exists
	 * to prevent the creation of two windows for the same object.
	 */ 
	public static var objectsBeingTracked:Array<Dynamic> = [];
	
	public static inline function addProfile(Profile:TrackerProfile):Void
	{
		if (Profile != null)
		{
			profiles.push(Profile);
		}
	}
	
	public static function findProfile(Object:Dynamic):TrackerProfile
	{
		initProfiles();
		
		var lastMatchingProfile:TrackerProfile = null;
		for (profile in profiles)
		{
			if ((profile != null) && Std.is(Object, profile.objectClass))
			{
				lastMatchingProfile = profile;
			}
		}
		return lastMatchingProfile;
	}
	
	public static function onStateSwitch():Void
	{
		_numTrackerWindows = 0;
	}
	
	private static function initProfiles():Void
	{
		if (profiles == null)
		{
			profiles = [];
			
			addProfile(new TrackerProfile(FlxPoint, ["x", "y"]));
			addProfile(new TrackerProfile(FlxRect, ["width", "height"], [FlxPoint]));
			
			addProfile(new TrackerProfile(FlxBasic, ["active", "visible", "alive", "exists"]));
			addProfile(new TrackerProfile(FlxObject, ["velocity", "acceleration", "drag", "angle"],
			                                         [FlxRect, FlxBasic]));
			addProfile(new TrackerProfile(FlxTilemap, ["auto", "widthInTiles", "heightInTiles", "totalTiles", "scaleX", "scaleY"], [FlxObject]));
			addProfile(new TrackerProfile(FlxSprite, ["frameWidth", "frameHeight", "alpha", "origin", "offset", "scale"], [FlxObject]));
			addProfile(new TrackerProfile(FlxTypedButton, ["status", "labelAlphas"], [FlxSprite]));
			#if !bitfive // FlxBar uses FlxGradient which uses missing gradient matrix
			addProfile(new TrackerProfile(FlxBar, ["min", "max", "range", "pct", "pxPerPercent", "value"], [FlxSprite]));
			#end
			addProfile(new TrackerProfile(FlxText, ["text", "size", "font", "embedded", "bold", "italic", "wordWrap", "borderSize", 
			                                        "borderStyle"], [FlxSprite]));
			
			addProfile(new TrackerProfile(FlxTypedGroup, ["length", "members.length", "maxSize"], [FlxBasic]));
			addProfile(new TrackerProfile(FlxSpriteGroup, null, [FlxSprite, FlxTypedGroup]));
			addProfile(new TrackerProfile(FlxState, ["persistentUpdate", "persistentDraw", "destroySubStates", "bgColor"], [FlxTypedGroup]));
			
			addProfile(new TrackerProfile(FlxCamera, ["style", "followLerp", "followLead", "deadzone", "bounds", "zoom", 
			                                          "alpha", "angle"], [FlxBasic, FlxRect]));
			
			addProfile(new TrackerProfile(FlxTween, ["active", "duration", "type", "percent", "finished", 
			                                         "scale", "backward", "executions", "startDelay", "loopDelay"]));
			<commit_msg>Make TrackerProfiles work with static variables, add a profile for FlxG<commit_after>package flixel.system.debug;

#if !FLX_NO_DEBUG
import flash.display.DisplayObject;
import flash.geom.Matrix;
import flash.geom.Point;
import flash.geom.Rectangle;
import flixel.FlxBasic;
import flixel.FlxCamera;
import flixel.FlxG;
import flixel.FlxObject;
import flixel.FlxSprite;
import flixel.FlxState;
import flixel.FlxSubState;
import flixel.group.FlxSpriteGroup;
import flixel.group.FlxTypedGroup.FlxTypedGroup;
import flixel.input.gamepad.FlxGamepad;
import flixel.input.mouse.FlxMouse;
import flixel.input.touch.FlxTouch;
import flixel.input.FlxSwipe;
import flixel.system.debug.ConsoleUtil.PathToVariable;
import flixel.system.debug.Tracker.TrackerProfile;
import flixel.system.debug.Watch;
import flixel.text.FlxText;
import flixel.tile.FlxTilemap;
import flixel.tweens.FlxTween;
import flixel.tweens.misc.MultiVarTween;
#if !bitfive
import flixel.ui.FlxBar;
#end
import flixel.ui.FlxTypedButton.FlxTypedButton;
import flixel.util.FlxPath;
import flixel.util.FlxPoint;
import flixel.util.FlxRect;
#end

import flixel.util.FlxStringUtil;

class Tracker extends Watch
{
	#if !FLX_NO_DEBUG
	/**
	 * Order matters here, as the last profile is the most releveant - i.e., if the 
	 * FlxSprite profile were added before the one for FlxObject, it would never be selected.
	 */
	public static var profiles:Array<TrackerProfile>;
	
	/**
	 * Stores a reference to all objects for a which a tracker window exists
	 * to prevent the creation of two windows for the same object.
	 */ 
	public static var objectsBeingTracked:Array<Dynamic> = [];
	
	public static inline function addProfile(Profile:TrackerProfile):Void
	{
		if (Profile != null)
		{
			profiles.push(Profile);
		}
	}
	
	public static function findProfile(Object:Dynamic):TrackerProfile
	{
		initProfiles();
		
		var lastMatchingProfile:TrackerProfile = null;
		for (profile in profiles)
		{
			if (Std.is(Object, profile.objectClass) || (Object == profile.objectClass))
			{
				lastMatchingProfile = profile;
			}
		}
		return lastMatchingProfile;
	}
	
	public static function onStateSwitch():Void
	{
		_numTrackerWindows = 0;
	}
	
	private static function initProfiles():Void
	{
		if (profiles == null)
		{
			profiles = [];
			
			addProfile(new TrackerProfile(FlxG, ["width", "height", "worldBounds.x", "worldBounds.y", "worldBounds.width", "worldBounds.height", 
			                                     "worldDivisions", "updateFramerate", "drawFramerate", "elapsed", "autoPause", "fixedTimestep", "timeScale"]));
			
			addProfile(new TrackerProfile(FlxPoint, ["x", "y"]));
			addProfile(new TrackerProfile(FlxRect, ["width", "height"], [FlxPoint]));
			
			addProfile(new TrackerProfile(FlxBasic, ["active", "visible", "alive", "exists"]));
			addProfile(new TrackerProfile(FlxObject, ["velocity", "acceleration", "drag", "angle"],
			                                         [FlxRect, FlxBasic]));
			addProfile(new TrackerProfile(FlxTilemap, ["auto", "widthInTiles", "heightInTiles", "totalTiles", "scaleX", "scaleY"], [FlxObject]));
			addProfile(new TrackerProfile(FlxSprite, ["frameWidth", "frameHeight", "alpha", "origin", "offset", "scale"], [FlxObject]));
			addProfile(new TrackerProfile(FlxTypedButton, ["status", "labelAlphas"], [FlxSprite]));
			#if !bitfive // FlxBar uses FlxGradient which uses missing gradient matrix
			addProfile(new TrackerProfile(FlxBar, ["min", "max", "range", "pct", "pxPerPercent", "value"], [FlxSprite]));
			#end
			addProfile(new TrackerProfile(FlxText, ["text", "size", "font", "embedded", "bold", "italic", "wordWrap", "borderSize", 
			                                        "borderStyle"], [FlxSprite]));
			
			addProfile(new TrackerProfile(FlxTypedGroup, ["length", "members.length", "maxSize"], [FlxBasic]));
			addProfile(new TrackerProfile(FlxSpriteGroup, null, [FlxSprite, FlxTypedGroup]));
			addProfile(new TrackerProfile(FlxState, ["persistentUpdate", "persistentDraw", "destroySubStates", "bgColor"], [FlxTypedGroup]));
			
			addProfile(new TrackerProfile(FlxCamera, ["style", "followLerp", "followLead", "deadzone", "bounds", "zoom", 
			                                          "alpha", "angle"], [FlxBasic, FlxRect]));
			
			addProfile(new TrackerProfile(FlxTween, ["active", "duration", "type", "percent", "finished", 
			                                         "scale", "backward", "executions", "startDelay", "loopDelay"]));
			
{'fraction_non_alphanumeric': 0.13472352389878164, 'fraction_numerical': 0.00023430178069353328, 'mean_word_length': 4.379332073093888, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 15, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '495689', 'n_tokens_mistral': 2897, 'n_tokens_neox': 2688, 'n_words': 621}