local s=import("\046\047\066\097\115\101\073\110\115\116\097\110\099\101")local n=import("\046\046\047\116\121\112\101\115\047\067\111\108\111\114\051")local v=import("\046\046\047\073\110\115\116\097\110\099\101\080\114\111\112\101\114\116\121")local M=import("\046\046\047\083\105\103\110\097\108")local C=import("\046\046\047\069\110\117\109\047\083\105\122\101\067\111\110\115\116\114\097\105\110\116")local D=import("\046\046\047\116\121\112\101\115\047\085\068\105\109\050")local P=import("\046\046\047\116\121\112\101\115\047\086\101\099\116\111\114\050")local W=s:extend("\071\117\105\079\098\106\101\099\116")W.properties.AbsolutePosition=v.readOnly({get=function(s)if s:FindFirstAncestorOfClass("\083\099\114\101\101\110\071\117\105")==nil then return P.new()end local n=s.Parent.AbsolutePosition local v=s.Parent.AbsoluteSize local M=s.Position return P.new((n.X+M.X.Scale*v.X)+M.X.Offset,(n.Y+M.Y.Scale*v.Y)+M.Y.Offset)end})W.properties.AbsoluteSize=v.readOnly({get=function(s)if s:FindFirstAncestorOfClass("\083\099\114\101\101\110\071\117\105")==nil then return P.new()end local n=s.Size local v,M=0,0 if s.Parent~=nil and(s.Parent:IsA("\071\117\105\079\098\106\101\099\116")or s.Parent:IsA("\083\099\114\101\101\110\071\117\105"))then local n=s.Parent.AbsoluteSize v=n.X M=n.Y end return P.new(v*n.X.Scale+n.X.Offset,M*n.Y.Scale+n.Y.Offset)end})W.properties.Active=v.typed("\098\111\111\108\101\097\110",{getDefault=function()return true end})W.properties.AnchorPoint=v.typed("\086\101\099\116\111\114\050",{getDefault=function()return P.new()end})W.properties.BackgroundColor3=v.typed("\067\111\108\111\114\051",{getDefault=function()return n.new()end})W.properties.BackgroundTransparency=v.typed("\110\117\109\098\101\114",{getDefault=function()return 0 end})W.properties.BorderSizePixel=v.typed("\110\117\109\098\101\114",{getDefault=function()return 0 end})W.properties.BorderColor3=v.typed("\067\111\108\111\114\051",{getDefault=function()return n.fromRGB(27,42,53)end})W.properties.ClipsDescendants=v.typed("\098\111\111\108\101\097\110",{getDefault=function()return false end})W.properties.InputBegan=v.readOnly({getDefault=function()return M.new()end})W.properties.InputEnded=v.readOnly({getDefault=function()return M.new()end})W.properties.LayoutOrder=v.typed("\110\117\109\098\101\114",{getDefault=function()return 0 end})W.properties.MouseEnter=v.readOnly({getDefault=function()return M.new()end})W.properties.MouseLeave=v.readOnly({getDefault=function()return M.new()end})W.properties.Position=v.typed("\085\068\105\109\050",{getDefault=function()return D.new()end})W.properties.Selectable=v.typed("\098\111\111\108\101\097\110",{getDefault=function()return true end})W.properties.Size=v.typed("\085\068\105\109\050",{getDefault=function()return D.new()end})W.properties.SizeConstraint=v.enum(C,{getDefault=function()return C.RelativeXY end})W.properties.Visible=v.typed("\098\111\111\108\101\097\110",{getDefault=function()return true end})W.properties.ZIndex=v.typed("\110\117\109\098\101\114",{getDefault=function()return 1 end})return W
local BaseInstance = import("./BaseInstance")
local Color3 = import("../types/Color3")
local InstanceProperty = import("../InstanceProperty")
local Signal = import("../Signal")
local SizeConstraint = import("../Enum/SizeConstraint")
local UDim2 = import("../types/UDim2")
local Vector2 = import("../types/Vector2")

local GuiObject = BaseInstance:extend("GuiObject")

GuiObject.properties.AbsolutePosition = InstanceProperty.readOnly({
	get = function(self)
		if self:FindFirstAncestorOfClass("ScreenGui") == nil then
			return Vector2.new()
		end

		local parentAbsolutePosition = self.Parent.AbsolutePosition
		local parentAbsoluteSize = self.Parent.AbsoluteSize
		local position = self.Position

		return Vector2.new(
			parentAbsolutePosition.X + position.X.Scale * parentAbsoluteSize.X + position.X.Offset,
			parentAbsolutePosition.Y + position.Y.Scale * parentAbsoluteSize.Y + position.Y.Offset
		)
	end,
})

GuiObject.properties.AbsoluteSize = InstanceProperty.readOnly({
	get = function(self)
		if self:FindFirstAncestorOfClass("ScreenGui") == nil then
			return Vector2.new()
		end

		local size = self.Size
		local scaleX, scaleY = 0, 0

		if self.Parent ~= nil and (self.Parent:IsA("GuiObject") or self.Parent:IsA("ScreenGui")) then
			local parentSize = self.Parent.AbsoluteSize
			scaleX = parentSize.X
			scaleY = parentSize.Y
		end

		return Vector2.new(
			scaleX * size.X.Scale + size.X.Offset,
			scaleY * size.Y.Scale + size.Y.Offset
		)
	end,
})

GuiObject.properties.Active = InstanceProperty.typed("boolean", {
	getDefault = function()
		return true
	end,
})

GuiObject.properties.AnchorPoint = InstanceProperty.typed("Vector2", {
	getDefault = function()
		return Vector2.new()
	end,
})

GuiObject.properties.BackgroundColor3 = InstanceProperty.typed("Color3", {
	getDefault = function()
		return Color3.new()
	end,
})

GuiObject.properties.BackgroundTransparency = InstanceProperty.typed("number", {
	getDefault = function()
		return 0
	end,
})

GuiObject.properties.BorderSizePixel = InstanceProperty.typed("number", {
	getDefault = function()
		return 0
	end,
})

GuiObject.properties.BorderColor3 = InstanceProperty.typed("Color3", {
	getDefault = function()
		return Color3.fromRGB(27, 42, 53)
	end,
})

GuiObject.properties.ClipsDescendants = InstanceProperty.typed("boolean", {
	getDefault = function()
		return false
	end,
})

GuiObject.properties.InputBegan = InstanceProperty.readOnly({
	getDefault = function()
		return Signal.new()
	end,
})

GuiObject.properties.InputEnded = InstanceProperty.readOnly({
	getDefault = function()
		return Signal.new()
	end,
})

GuiObject.properties.LayoutOrder = InstanceProperty.typed("number", {
	getDefault = function()
		return 0
	end,
})

GuiObject.properties.MouseEnter = InstanceProperty.readOnly({
	getDefault = function()
		return Signal.new()
	end,
})

GuiObject.properties.MouseLeave = InstanceProperty.readOnly({
	getDefault = function()
		return Signal.new()
	end,
})

GuiObject.properties.Position = InstanceProperty.typed("UDim2", {
	getDefault = function()
		return UDim2.new()
	end,
})

GuiObject.properties.Selectable = InstanceProperty.typed("boolean", {
	getDefault = function()
		return true
	end,
})

GuiObject.properties.Size = InstanceProperty.typed("UDim2", {
	getDefault = function()
		return UDim2.new()
	end,
})

GuiObject.properties.SizeConstraint = InstanceProperty.enum(SizeConstraint, {
	getDefault = function()
		return SizeConstraint.RelativeXY
	end,
})

GuiObject.properties.Visible = InstanceProperty.typed("boolean", {
	getDefault = function()
		return true
	end,
})

GuiObject.properties.ZIndex = InstanceProperty.typed("number", {
	getDefault = function()
		return 1
	end,
})

return GuiObject