local z=(require(script.Parent.loader)).load(script)local x=game:GetService("\082\117\110\083\101\114\118\105\099\101")local S=game:GetService("\087\111\114\107\115\112\097\099\101")local g=z("\066\097\115\105\099\080\097\110\101")local J=z("\066\108\101\110\100")local D=z("\083\112\114\105\110\103\079\098\106\101\099\116")local j=z("\082\120")local C=z("\077\097\116\104")local R=setmetatable({},g)R.ClassName="\083\111\102\116\083\104\117\116\100\111\119\110\085\073"R.__index=R function R.new()local z=setmetatable(g.new(),R)z._title=Instance.new("\083\116\114\105\110\103\086\097\108\117\101")z._title.Value=""z._maid:GiveTask(z._title)z._subtitle=Instance.new("\083\116\114\105\110\103\086\097\108\117\101")z._subtitle.Value=""z._maid:GiveTask(z._subtitle)z._percentVisible=D.new(0,40)z._maid:GiveTask(z._percentVisible)z._maid:GiveTask(z.VisibleChanged:Connect(function(x,S)z._percentVisible.t=x and 1 or 0 if S then z._percentVisible.p=z._percentVisible.t z._percentVisible.v=0 end end))z._blur=Instance.new("\066\108\117\114\069\102\102\101\099\116")z._blur.Name="\083\111\102\116\083\104\117\116\100\111\119\110\066\108\117\114"z._blur.Enabled=false z._blur.Size=0 z._blur.Parent=S.CurrentCamera z._maid:GiveTask(z._blur)z._maid:GiveTask((z:_render()):Subscribe(function(x)z.Gui=x end))return z end function R.SetTitle(x,z)x._title.Value=z end function R.SetSubtitle(x,z)x._subtitle.Value=z end function R._render(z)local S=z._percentVisible:ObserveRenderStepped()local g=J.Computed(S,function(z)return 1-z end)local D=Color3.new(0,0,0)local R=Color3.new(.9,.9,.9)z._maid:GiveTask(S:Subscribe(function(x)z._blur.Size=x*30 z._blur.Enabled=x>0 end))return(J.New("\070\114\097\109\101"))({Name="\083\111\102\116\083\104\117\116\100\111\119\110\085\073",Size=UDim2.new(1,0,1,0),AnchorPoint=Vector2.new(.5,.5),Position=UDim2.fromScale(.5,.5);Active=J.Computed(S,function(z)return z>0 end),Visible=J.Computed(S,function(z)return z>0 end);BackgroundColor3=D;BackgroundTransparency=J.Computed(S,function(z)return C.map(z,0,1,1,.4)end),[J.Children]={(J.New("\085\073\080\097\100\100\105\110\103"))({PaddingLeft=UDim.new(0,20),PaddingRight=UDim.new(0,20),PaddingTop=UDim.new(0,20),PaddingBottom=UDim.new(0,20)});(J.New("\070\114\097\109\101"))({Name="\067\111\110\116\101\110\116\067\111\110\116\097\105\110\101\114";Size=UDim2.new(1,0,1,0);AnchorPoint=Vector2.new(.5,.5),Position=UDim2.fromScale(.5,.5),BackgroundTransparency=1;[J.Children]={(J.New("\085\073\083\099\097\108\101"))({Scale=J.Computed(S,function(z)return.7+.3*z end)});(J.New("\070\114\097\109\101"))({Name="\073\109\097\103\101\076\097\098\101\108\067\111\110\116\097\105\110\101\114",Size=UDim2.new(0,80,0,80);BackgroundTransparency=1;LayoutOrder=1,[J.Children]={(J.New("\073\109\097\103\101\076\097\098\101\108"))({Size=UDim2.new(1,0,1,0),ImageTransparency=g;BackgroundTransparency=1,Image="\114\098\120\097\115\115\101\116\105\100\058\047\047\054\048\051\049\051\048\050\057\049\054"})}}),(J.New("\070\114\097\109\101"))({Name="\076\097\098\101\108\067\111\110\116\097\105\110\101\114",Size=UDim2.new(1,0,0,80);Position=UDim2.new(.5,0,.5,0),AnchorPoint=Vector2.new(.5,.5);BackgroundTransparency=1,LayoutOrder=2;[J.Children]={(J.New("\084\101\120\116\076\097\098\101\108"))({Name="\084\105\116\108\101\076\097\098\101\108";BackgroundTransparency=1;Position=UDim2.fromScale(.5,0),Size=UDim2.new(1,0,.6,0),AnchorPoint=Vector2.new(.5,0),Text=z._title,Font=Enum.Font.SourceSansBold,TextTransparency=g;TextColor3=R;LayoutOrder=1;TextScaled=true}),(J.New("\084\101\120\116\076\097\098\101\108"))({Name="\083\117\098\116\105\116\108\101\076\097\098\101\108";BackgroundTransparency=1,Position=UDim2.fromScale(.5,1);Size=UDim2.new(1,0,.3,0),AnchorPoint=Vector2.new(.5,1),Text=z._subtitle;Font=Enum.Font.SourceSansLight,TextTransparency=g,TextColor3=R;LayoutOrder=2;TextScaled=true});(J.New("\085\073\065\115\112\101\099\116\082\097\116\105\111\067\111\110\115\116\114\097\105\110\116"))({AspectRatio=5})}});(J.New("\070\114\097\109\101"))({Name="\083\112\097\099\101\114",BackgroundTransparency=1;Size=UDim2.new(0,0,0,50);LayoutOrder=3}),(J.New("\070\114\097\109\101"))({Name="\076\111\097\100\105\110\103\076\097\098\101\108",Position=UDim2.fromScale(.5,.5);AnchorPoint=Vector2.new(.5,.5);LayoutOrder=4;Size=UDim2.fromScale(.25,.25);BackgroundTransparency=1,[J.Children]={(J.New("\070\114\097\109\101"))({Name="\082\111\098\108\111\120\076\111\103\111",Size=UDim2.new(1,0,1,0);BackgroundColor3=R;AnchorPoint=Vector2.new(.5,.5),Position=UDim2.fromScale(.5,.5);BackgroundTransparency=g,Rotation=(j.fromSignal(x.RenderStepped)):Pipe({j.map(function()local z=(tick()*math.pi)*1.5 local x=math.sin(z)local S=(math.sin(z-math.pi/2)+1)/2 if x>0 then return 15+S*360 else return 15 end end)});[J.Children]={(J.New("\070\114\097\109\101"))({BackgroundColor3=D,Size=UDim2.fromScale(.2,.2),AnchorPoint=Vector2.new(.5,.5),Position=UDim2.fromScale(.5,.5);BackgroundTransparency=g})}}),(J.New("\085\073\065\115\112\101\099\116\082\097\116\105\111\067\111\110\115\116\114\097\105\110\116"))({AspectRatio=1}),(J.New("\085\073\083\105\122\101\067\111\110\115\116\114\097\105\110\116"))({MaxSize=Vector2.new(math.huge,50)})}}),(J.New("\085\073\076\105\115\116\076\097\121\111\117\116"))({FillDirection=Enum.FillDirection.Vertical;SortOrder=Enum.SortOrder.LayoutOrder,HorizontalAlignment=Enum.HorizontalAlignment.Center;VerticalAlignment=Enum.VerticalAlignment.Center,Padding=UDim.new(0,10)})}})}})end return R
--[=[
	@class SoftShutdownUI
]=]

local require = require(script.Parent.loader).load(script)

local RunService = game:GetService("RunService")
local Workspace = game:GetService("Workspace")

local BasicPane = require("BasicPane")
local Blend = require("Blend")
local SpringObject = require("SpringObject")
local Rx = require("Rx")
local Math = require("Math")

local SoftShutdownUI = setmetatable({}, BasicPane)
SoftShutdownUI.ClassName = "SoftShutdownUI"
SoftShutdownUI.__index = SoftShutdownUI

function SoftShutdownUI.new()
	local self = setmetatable(BasicPane.new(), SoftShutdownUI)

	self._title = Instance.new("StringValue")
	self._title.Value = ""
	self._maid:GiveTask(self._title)

	self._subtitle = Instance.new("StringValue")
	self._subtitle.Value = ""
	self._maid:GiveTask(self._subtitle)

	self._percentVisible = SpringObject.new(0, 40)
	self._maid:GiveTask(self._percentVisible)

	self._maid:GiveTask(self.VisibleChanged:Connect(function(isVisible, doNotAnimate)
		self._percentVisible.t = isVisible and 1 or 0
		if doNotAnimate then
			self._percentVisible.p = self._percentVisible.t
			self._percentVisible.v = 0
		end
	end))

	self._blur = Instance.new("BlurEffect")
	self._blur.Name = "SoftShutdownBlur"
	self._blur.Enabled = false
	self._blur.Size = 0
	self._blur.Parent = Workspace.CurrentCamera
	self._maid:GiveTask(self._blur)

	self._maid:GiveTask(self:_render():Subscribe(function(gui)
		self.Gui = gui
	end))

	return self
end

function SoftShutdownUI:SetTitle(text)
	self._title.Value = text
end

function SoftShutdownUI:SetSubtitle(text)
	self._subtitle.Value = text
end

function SoftShutdownUI:_render()
	local percentVisible = self._percentVisible:ObserveRenderStepped()
	local transparency = Blend.Computed(percentVisible, function(value)
		return 1 - value
	end)
	local backgroundColor = Color3.new(0, 0, 0)
	local foregroundColor = Color3.new(0.9, 0.9, 0.9)

	self._maid:GiveTask(percentVisible:Subscribe(function(percent)
		self._blur.Size = percent * 30
		self._blur.Enabled = percent > 0
	end))

	return Blend.New("Frame")({
		Name = "SoftShutdownUI",
		Size = UDim2.new(1, 0, 1, 0),
		AnchorPoint = Vector2.new(0.5, 0.5),
		Position = UDim2.fromScale(0.5, 0.5),
		Active = Blend.Computed(percentVisible, function(visible)
			return visible > 0
		end),
		Visible = Blend.Computed(percentVisible, function(visible)
			return visible > 0
		end),
		BackgroundColor3 = backgroundColor,
		BackgroundTransparency = Blend.Computed(percentVisible, function(visible)
			return Math.map(visible, 0, 1, 1, 0.4)
		end),

		[Blend.Children] = {
			Blend.New("UIPadding")({
				PaddingLeft = UDim.new(0, 20),
				PaddingRight = UDim.new(0, 20),
				PaddingTop = UDim.new(0, 20),
				PaddingBottom = UDim.new(0, 20),
			}),

			Blend.New("Frame")({
				Name = "ContentContainer",
				Size = UDim2.new(1, 0, 1, 0),
				AnchorPoint = Vector2.new(0.5, 0.5),
				Position = UDim2.fromScale(0.5, 0.5),
				BackgroundTransparency = 1,

				[Blend.Children] = {
					Blend.New("UIScale")({
						Scale = Blend.Computed(percentVisible, function(visible)
							return 0.7 + 0.3 * visible
						end),
					}),

					Blend.New("Frame")({
						Name = "ImageLabelContainer",
						Size = UDim2.new(0, 80, 0, 80),
						BackgroundTransparency = 1,
						LayoutOrder = 1,

						[Blend.Children] = {
							Blend.New("ImageLabel")({
								Size = UDim2.new(1, 0, 1, 0),
								ImageTransparency = transparency,
								BackgroundTransparency = 1,
								Image = "rbxassetid://6031302916",
							}),
						},
					}),

					Blend.New("Frame")({
						Name = "LabelContainer",
						Size = UDim2.new(1, 0, 0, 80),
						Position = UDim2.new(0.5, 0, 0.5, 0),
						AnchorPoint = Vector2.new(0.5, 0.5),
						BackgroundTransparency = 1,
						LayoutOrder = 2,

						[Blend.Children] = {
							Blend.New("TextLabel")({
								Name = "TitleLabel",
								BackgroundTransparency = 1,
								Position = UDim2.fromScale(0.5, 0),
								Size = UDim2.new(1, 0, 0.6, 0),
								AnchorPoint = Vector2.new(0.5, 0),
								Text = self._title,
								Font = Enum.Font.SourceSansBold,
								TextTransparency = transparency,
								TextColor3 = foregroundColor,
								LayoutOrder = 1,
								TextScaled = true,
							}),

							Blend.New("TextLabel")({
								Name = "SubtitleLabel",
								BackgroundTransparency = 1,
								Position = UDim2.fromScale(0.5, 1),
								Size = UDim2.new(1, 0, 0.3, 0),
								AnchorPoint = Vector2.new(0.5, 1),
								Text = self._subtitle,
								Font = Enum.Font.SourceSansLight,
								TextTransparency = transparency,
								TextColor3 = foregroundColor,
								LayoutOrder = 2,
								TextScaled = true,
							}),

							Blend.New("UIAspectRatioConstraint")({
								AspectRatio = 5,
							}),
						},
					}),

					Blend.New("Frame")({
						Name = "Spacer",
						BackgroundTransparency = 1,
						Size = UDim2.new(0, 0, 0, 50),
						LayoutOrder = 3,
					}),

					Blend.New("Frame")({
						Name = "LoadingLabel",
						Position = UDim2.fromScale(0.5, 0.5),
						AnchorPoint = Vector2.new(0.5, 0.5),
						LayoutOrder = 4,
						Size = UDim2.fromScale(0.25, 0.25),
						BackgroundTransparency = 1,

						[Blend.Children] = {
							Blend.New("Frame")({
								Name = "RobloxLogo",
								Size = UDim2.new(1, 0, 1, 0),
								BackgroundColor3 = foregroundColor,
								AnchorPoint = Vector2.new(0.5, 0.5),
								Position = UDim2.fromScale(0.5, 0.5),

								BackgroundTransparency = transparency,
								Rotation = Rx.fromSignal(RunService.RenderStepped):Pipe({
									Rx.map(function()
										-- tick persists between sessions
										local t = tick() * math.pi * 1.5
										local smallerWave = math.sin(t)
										local percent = (math.sin(t - math.pi / 2) + 1) / 2

										if smallerWave > 0 then
											return 15 + percent * 360
										else
											return 15
										end
									end),
								}),

								[Blend.Children] = {
									Blend.New("Frame")({
										BackgroundColor3 = backgroundColor,
										Size = UDim2.fromScale(1 / 5, 1 / 5),
										AnchorPoint = Vector2.new(0.5, 0.5),
										Position = UDim2.fromScale(0.5, 0.5),
										BackgroundTransparency = transparency,
									}),
								},
							}),

							Blend.New("UIAspectRatioConstraint")({
								AspectRatio = 1,
							}),

							Blend.New("UISizeConstraint")({
								MaxSize = Vector2.new(math.huge, 50),
							}),
						},
					}),

					Blend.New("UIListLayout")({
						FillDirection = Enum.FillDirection.Vertical,
						SortOrder = Enum.SortOrder.LayoutOrder,
						HorizontalAlignment = Enum.HorizontalAlignment.Center,
						VerticalAlignment = Enum.VerticalAlignment.Center,
						Padding = UDim.new(0, 10),
					}),
				},
			}),
		},
	})
end

return SoftShutdownUI
