local function q(q)return function(w)local D=Roact.Component:extend("\067\117\115\116\111\109\071\117\105")function D.init(w)w.StarterGui=w.props.StarterGui or StarterGui local D=w.StarterGui:FindFirstChild(q,true)if not D then return end if not D:IsA("\070\114\097\109\101")then warn(string.format("\091\070\114\105\101\110\100\115\076\111\099\097\116\111\114\093 \067\117\115\116\111\109 \071\085\073 \112\114\111\118\105\100\101\100 \101\120\112\101\099\116\101\100 \116\111 \098\101 \070\114\097\109\101\044 \103\111\116 \037\115 \105\110\115\116\101\097\100",D.ClassName))return end w.instance=D:Clone()end function D.render(q)return Roact.createElement(w,Cryo.Dictionary.join(q.props,{customGui=q.instance}))end function D.willUnmount(q)if q.instance then q.instance:Destroy()q.instance=nil end end return D end end return q

local function withCustomGui(guiName)
	return function(Component)
		local CustomGui = Roact.Component:extend("CustomGui")

		function CustomGui:init()
			self.StarterGui = self.props.StarterGui or StarterGui

			-- Find the custom GUI folder and clone the instance
			local instance = self.StarterGui:FindFirstChild(guiName, true)

			-- No custom GUI defined
			if not instance then
				return
			end

			-- Invalid class of GUI defined
			if not instance:IsA("Frame") then
				warn(
					string.format(
						"[FriendsLocator] Custom GUI provided expected to be Frame, got %s instead",
						instance.ClassName
					)
				)
				return
			end

			-- Clone GUI
			self.instance = instance:Clone()
		end

		function CustomGui:render()
			return Roact.createElement(
				Component,
				Cryo.Dictionary.join(self.props, {
					customGui = self.instance,
				})
			)
		end

		function CustomGui:willUnmount()
			if self.instance then
				self.instance:Destroy()
				self.instance = nil
			end
		end

		return CustomGui
	end
end

return withCustomGui
