local j=script.Parent local E=j.Parent local e=require(E.t)local Y=e.tuple(e.table,e.optional(e.intersection(e.integer,e.numberMin(0))))local function F(j,E)assert(Y(j,E))local e={}for j,Y in pairs(j)do if type(Y)=="\116\097\098\108\101"and(not E or E>0)then local j=F(Y,E and E-1)for E,e in pairs(e)do j[E]=e end e=j else e[j]=Y end end return e end return F
local Dictionary = script.Parent

local Llama = Dictionary.Parent
local t = require(Llama.t)

local validate = t.tuple(t.table, t.optional(t.intersection(t.integer, t.numberMin(0))))

local function flatten(dictionary, depth)
	assert(validate(dictionary, depth))
	
	local new = {}

	for key, value in pairs(dictionary) do
		if type(value) == "table" and (not depth or depth > 0) then
			local subDictionary = flatten(value, depth and depth - 1)

			for newKey, newValue in pairs(new) do
				subDictionary[newKey] = newValue
			end

			new = subDictionary
		else
			new[key] = value
		end
	end

	return new
end

return flatten