local O=(require(script.Parent.loader)).load(script)local m=O("\083\116\111\114\121\066\097\114\085\116\105\108\115")local N={}function N.makeVisibleSwitch(O,N,P)local g=m.createSwitch(O,P or"\086\105\115\105\098\108\101",true)local A=O._maid A:GiveTask((g:Observe()):Subscribe(function(O)N:SetVisible(O)end))A:GiveTask(N.VisibleChanged:Connect(function(O)g:SetValue(O)end))A:GiveTask(N)return g end return N
--[=[
	@class StoryBarPaneUtils
	@client

	Utils for glueing story bar elements to Nevermore BasicPanes. State is observed, allowing elements to control and respond.

	![Switch Controlling Basic Pane Visibility Gif](/evenmore/storybar/basicpaneswitch.gif)
]=]

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

local StoryBarUtils = require("StoryBarUtils")

local StoryBarPaneUtils = {}

--[=[
	Creates a [SwitchBarElement] underneath a [StoryBar], bound to the visibility of a GUI class inherting [BasicPane].

	```lua
		-- Create UI.
		local exampleBasicPane = ClassThatInheritsBasicPane.new()
		maid:GiveTask(exampleBasicPane)
		-- Bind UI visiblity to switch.
		local bar = StoryBarUtils.createStoryBar(maid, target)
		StoryBarPaneUtils.makeVisibleSwitch(bar, exampleBasicPane)
	```

	@param storyBar StoryBar
	@param basicPane BasicPane
	@param name string?
	@return SwitchBarElement
]=]
function StoryBarPaneUtils.makeVisibleSwitch(storyBar, basicPane, name)
	local switch = StoryBarUtils.createSwitch(storyBar, name or "Visible", true)
	local maid = storyBar._maid
	maid:GiveTask(switch:Observe():Subscribe(function(switchState)
		basicPane:SetVisible(switchState)
	end))
	maid:GiveTask(basicPane.VisibleChanged:Connect(function(visible)
		switch:SetValue(visible)
	end))
	maid:GiveTask(basicPane)
	return switch
end

return StoryBarPaneUtils