local X=require(script.Parent.Parent.Configuration)local b=require(script.Spritesheets)local d=X.Roact local p=X.RoactAnimate local o=table.create(20)o[1]="\114\098\120\097\115\115\101\116\105\100\058\047\047\049\051\051\048\053\049\052\054\053\056"o[2]="\114\098\120\097\115\115\101\116\105\100\058\047\047\049\051\051\048\053\049\053\049\052\051"o[3]="\114\098\120\097\115\115\101\116\105\100\058\047\047\049\051\051\048\053\055\051\051\050\052"o[4]="\114\098\120\097\115\115\101\116\105\100\058\047\047\049\051\051\048\053\055\051\054\048\057"o[5]="\114\098\120\097\115\115\101\116\105\100\058\047\047\049\051\051\048\053\055\051\056\056\048"o[6]="\114\098\120\097\115\115\101\116\105\100\058\047\047\049\051\051\048\053\055\052\052\053\052"o[7]="\114\098\120\097\115\115\101\116\105\100\058\047\047\049\051\051\048\053\055\053\052\057\056"o[8]="\114\098\120\097\115\115\101\116\105\100\058\047\047\049\051\051\048\053\055\053\055\054\053"o[9]="\114\098\120\097\115\115\101\116\105\100\058\047\047\049\051\051\048\053\055\053\057\051\057"o[10]="\114\098\120\097\115\115\101\116\105\100\058\047\047\049\051\051\048\053\056\050\050\049\055"o[11]="\114\098\120\097\115\115\101\116\105\100\058\047\047\049\051\051\048\053\056\050\052\049\054"o[12]="\114\098\120\097\115\115\101\116\105\100\058\047\047\049\051\051\048\053\056\050\053\057\049"o[13]="\114\098\120\097\115\115\101\116\105\100\058\047\047\049\051\051\048\053\056\050\057\054\052"o[14]="\114\098\120\097\115\115\101\116\105\100\058\047\047\049\051\051\048\053\056\051\049\048\057"o[15]="\114\098\120\097\115\115\101\116\105\100\058\047\047\049\051\051\048\053\056\056\050\051\048"o[16]="\114\098\120\097\115\115\101\116\105\100\058\047\047\049\051\051\048\053\056\056\052\057\051"o[17]="\114\098\120\097\115\115\101\116\105\100\058\047\047\049\051\051\048\053\056\056\054\055\057"o[18]="\114\098\120\097\115\115\101\116\105\100\058\047\047\049\051\051\048\053\056\056\056\050\048"o[19]="\114\098\120\097\115\115\101\116\105\100\058\047\047\049\051\051\048\053\056\056\057\051\050"o[20]="\114\098\120\097\115\115\101\116\105\100\058\047\047\049\051\051\048\053\057\050\049\050\051"local function A(X,b)local d=0 local p=nil for X in next,X do if b%X==0 or X%b==0 then return X elseif not p or math.abs(X-b)<p then d=X p=math.abs(X-b)end end return d end local function z(X)local z=X.Icon local y=b[z]local N=X.Resolution if not N then if X.Size.X.Scale~=0 or X.Size.Y.Scale~=0 then N=A(y,math.huge)else assert(X.Size.X.Offset==X.Size.Y.Offset,"\073\102 \117\115\105\110\103 \111\102\102\115\101\116 \073\099\111\110 \115\105\122\101 \109\117\115\116 \114\101\115\117\108\116 \105\110 \097 \115\113\117\097\114\101")N=A(y,X.Size.X.Offset)end end local T=y[N]return d.createElement(p.ImageLabel,{Image=o[T.Sheet];BackgroundTransparency=1;ImageRectSize=Vector2.new(T.Size,T.Size),ImageRectOffset=Vector2.new(T.X,T.Y),ImageColor3=X.IconColor3,ImageTransparency=X.IconTransparency;Size=X.Size,Position=X.Position;AnchorPoint=X.AnchorPoint})end return z
local Configuration = require(script.Parent.Parent.Configuration)
local Spritesheet = require(script.Spritesheets)

local Roact = Configuration.Roact
local RoactAnimate = Configuration.RoactAnimate

local SHEET_ASSETS = table.create(20)
SHEET_ASSETS[1] = "rbxassetid://1330514658"
SHEET_ASSETS[2] = "rbxassetid://1330515143"
SHEET_ASSETS[3] = "rbxassetid://1330573324"
SHEET_ASSETS[4] = "rbxassetid://1330573609"
SHEET_ASSETS[5] = "rbxassetid://1330573880"
SHEET_ASSETS[6] = "rbxassetid://1330574454"
SHEET_ASSETS[7] = "rbxassetid://1330575498"
SHEET_ASSETS[8] = "rbxassetid://1330575765"
SHEET_ASSETS[9] = "rbxassetid://1330575939"
SHEET_ASSETS[10] = "rbxassetid://1330582217"
SHEET_ASSETS[11] = "rbxassetid://1330582416"
SHEET_ASSETS[12] = "rbxassetid://1330582591"
SHEET_ASSETS[13] = "rbxassetid://1330582964"
SHEET_ASSETS[14] = "rbxassetid://1330583109"
SHEET_ASSETS[15] = "rbxassetid://1330588230"
SHEET_ASSETS[16] = "rbxassetid://1330588493"
SHEET_ASSETS[17] = "rbxassetid://1330588679"
SHEET_ASSETS[18] = "rbxassetid://1330588820"
SHEET_ASSETS[19] = "rbxassetid://1330588932"
SHEET_ASSETS[20] = "rbxassetid://1330592123"

local function ClosestResolution(icon, goalResolution)
	local closest = 0
	local closestDelta = nil

	for resolution in next, icon do
		if goalResolution % resolution == 0 or resolution % goalResolution == 0 then
			return resolution
		elseif not closestDelta or math.abs(resolution - goalResolution) < closestDelta then
			closest = resolution
			closestDelta = math.abs(resolution - goalResolution)
		end
	end

	return closest
end

local function Icon(props)
	local iconName = props.Icon
	local icon = Spritesheet[iconName]

	local chosenResolution = props.Resolution

	if not chosenResolution then
		if props.Size.X.Scale ~= 0 or props.Size.Y.Scale ~= 0 then
			chosenResolution = ClosestResolution(icon, math.huge)
		else
			assert(props.Size.X.Offset == props.Size.Y.Offset, "If using offset Icon size must result in a square")
			chosenResolution = ClosestResolution(icon, props.Size.X.Offset)
		end
	end

	local variant = icon[chosenResolution]

	return Roact.createElement(RoactAnimate.ImageLabel, {
		Image = SHEET_ASSETS[variant.Sheet],
		BackgroundTransparency = 1,
		ImageRectSize = Vector2.new(variant.Size, variant.Size),
		ImageRectOffset = Vector2.new(variant.X, variant.Y),
		ImageColor3 = props.IconColor3,
		ImageTransparency = props.IconTransparency,
		Size = props.Size,
		Position = props.Position,
		AnchorPoint = props.AnchorPoint,
	})
end

return Icon