local function W(W)return W==game.ServerStorage.Garbage or W:IsDescendantOf(game.ServerStorage.Garbage)or W:IsA("\083\116\097\114\116\101\114\067\104\097\114\097\099\116\101\114\083\099\114\105\112\116\115")end local function q(W)return W:IsA("\070\111\108\100\101\114")or W:IsA("\083\116\097\114\116\101\114\080\108\097\121\101\114\083\099\114\105\112\116\115")or W:IsA("\082\101\112\108\105\099\097\116\101\100\083\116\111\114\097\103\101")or W:IsA("\083\101\114\118\101\114\083\099\114\105\112\116\083\101\114\118\105\099\101")or W:IsA("\083\101\114\118\101\114\083\116\111\114\097\103\101")or W:IsA("\083\116\097\114\116\101\114\080\108\097\121\101\114")end local function e(W)local q=0 for W,e in ipairs(W:GetChildren())do if e:IsA("\076\117\097\083\111\117\114\099\101\067\111\110\116\097\105\110\101\114")then q+=1 end end return q end local function t(W,q)local e=q and"\105\110\105\116"or W.Name if W:IsA("\076\111\099\097\108\083\099\114\105\112\116")then return e.."\046\099\108\105\101\110\116\046\108\117\097"elseif W:IsA("\077\111\100\117\108\101\083\099\114\105\112\116")then return e.."\046\108\117\097"elseif W:IsA("\083\099\114\105\112\116")then return e.."\046\115\101\114\118\101\114\046\108\117\097"end end local function V(W)local V={children={};name="\115\114\099";type="\100\105\114\101\099\116\111\114\121"}if q(W)then V.type="\100\105\114\101\099\116\111\114\121"V.name=W.Name elseif W:IsA("\076\117\097\083\111\117\114\099\101\067\111\110\116\097\105\110\101\114")then if e(W)>0 then V.type="\100\105\114\101\099\116\111\114\121"V.name=W.name local q={children={},name="\105\110\105\116\046\108\117\097";type="\102\105\108\101"}q.name=t(W,true)table.insert(V.children,q)else V.type="\102\105\108\101"V.name=t(W)end else return end return V end local function d(q,e)local t=V(q)if t then for q,e in ipairs(q:GetChildren())do if W(e)then continue end d(e,t.children)end table.insert(e,t)end end return function()local W={url="\104\116\116\112\115\058\047\047\114\097\119\046\103\105\116\104\117\098\117\115\101\114\099\111\110\116\101\110\116\046\099\111\109\047\089\049\049\057\053\047\065\118\097\116\097\114-\069\100\105\116\111\114-\050\047\109\097\115\116\101\114\047",paths={children={};name="\115\114\099";type="\100\105\114\101\099\116\111\114\121"}}d(game.ReplicatedStorage,W.paths.children)d(game.ServerStorage,W.paths.children)d(game.ServerScriptService,W.paths.children)d(game.StarterPlayer,W.paths.children)print((game:GetService("\072\116\116\112\083\101\114\118\105\099\101")):JSONEncode(W))end
local function isBlacklist(instance)
	return (instance == game.ServerStorage.Garbage) or instance:IsDescendantOf(game.ServerStorage.Garbage) or instance:IsA("StarterCharacterScripts")
end

local function isWhitelist(instance)
	return instance:IsA("Folder") or instance:IsA("StarterPlayerScripts")
		or instance:IsA("ReplicatedStorage") or instance:IsA("ServerScriptService") or instance:IsA("ServerStorage") or instance:IsA("StarterPlayer")
end

local function countBaseScript(parent)
	local count = 0
	for i, v in ipairs(parent:GetChildren()) do
		if v:IsA("LuaSourceContainer") then
			count += 1
		end
	end
	return count
end

local function getName(baseScript, useInit)
	local name = useInit and "init" or baseScript.Name
	if baseScript:IsA("LocalScript") then
		return name .. ".client.lua"
	elseif baseScript:IsA("ModuleScript") then
		return name .. ".lua"
	elseif baseScript:IsA("Script") then
		return name .. ".server.lua"
	end
end

local function getPath(parent)
	local path = {
		children = {},
		name = "src",
		type = "directory",
	}
	
	if isWhitelist(parent) then
		path.type = "directory"
		path.name = parent.Name
	elseif parent:IsA("LuaSourceContainer") then
		if countBaseScript(parent) > 0 then
			path.type = "directory"
			path.name = parent.name
			
			local initPath = {
				children = {},
				name = "init.lua",
				type = "file",
			}
			initPath.name = getName(parent, true)
			table.insert(path.children, initPath)
			
		else
			path.type = "file"
			path.name = getName(parent)
		end
	else
		return
	end
	
	return path
end


local function getPathRecursive(parent, path)
	local a = getPath(parent)
	if a then
		for i, v in ipairs(parent:GetChildren()) do
			if isBlacklist(v) then continue end
			getPathRecursive(v, a.children)
		end
		table.insert(path, a)
	end
end


return function()
	local list = {
		url = "https://raw.githubusercontent.com/Y1195/Avatar-Editor-2/master/",
		paths = {
			children = {},
			name = "src",
			type = "directory",
		},
	}
	
	getPathRecursive(game.ReplicatedStorage, list.paths.children)
	getPathRecursive(game.ServerStorage, list.paths.children)
	getPathRecursive(game.ServerScriptService, list.paths.children)
	getPathRecursive(game.StarterPlayer, list.paths.children)
	
	print(game:GetService("HttpService"):JSONEncode(list))
end