local h=game:GetService("\080\108\097\121\101\114\115")local C=game:GetService("\082\101\112\108\105\099\097\116\101\100\083\116\111\114\097\103\101")local A=h.LocalPlayer local t=A.PlayerGui local B=C.Packages local E=require(B.Koute)local n=require(B.Fusion)local c=n.Children local i=n.New local p=n.Value local U=E.Router local g=E.Route local k=E.Canvas local function T(h)return(i("\070\114\097\109\101"))({Size=UDim2.fromScale(1,1);[c]={(i("\084\101\120\116\076\097\098\101\108"))({Size=UDim2.fromScale(1,1),Text=h.PageName})}})end local m=p("\078\111\110\101")local P=U({routes={(g("\047"))({view=function(h,C)return T({PageName=C.path:get()})end});(g("\047\097\098\099"))({view=function(h,C)return T({PageName=C.path:get()})end,[c]={(g("\047\100\101\102"))({view=function(h,C)return T({PageName=C.path:get()})end}),(g("\047\104\105\106"))({view=function(h,C)return T({PageName=C.path:get()})end})}})}});(i("\083\099\114\101\101\110\071\117\105"))({Parent=t,ZIndexBehavior=Enum.ZIndexBehavior.Sibling;[c]={(i("\084\101\120\116\076\097\098\101\108"))({AnchorPoint=Vector2.new(.5,0);Position=UDim2.new(.5,0,0,12);Size=UDim2.fromOffset(0,14),Text=m;ZIndex=2});k({source=P})}})print(P.routes)m:set("\071\111\116\111 \047\097\098\099\047")P:go("\047\097\098\099")task.wait(1)m:set("\071\111\116\111 \047\097\098\099\047\104\105\106")P:go("\047\097\098\099\047\104\105\106")task.wait(1)P:go("\047\097\098\099\047\104\105\106")m:set("\071\111\116\111 \047\097\098\099\047\100\101\102\047")P:go("\047\097\098\099\047\100\101\102")task.wait(1)m:set("\071\111 \098\097\099\107 \098\121 \050")P:back(2)task.wait(1)m:set("\071\111\116\111 \047\097\098\099\047\100\101\102\047")P:go("\047\097\098\099\047\100\101\102")task.wait(1)print(P.history)P:go("\047")m:set("\079\075\033")
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")

local Player = Players.LocalPlayer
local PlayerGui = Player.PlayerGui
local Packages = ReplicatedStorage.Packages
local Koute = require(Packages.Koute)
local Fusion = require(Packages.Fusion)

local Children = Fusion.Children
local New = Fusion.New
local Value = Fusion.Value
local Router = Koute.Router
local Route = Koute.Route
local Canvas = Koute.Canvas

local function createDemoFrame(props)
    return New "Frame" {
        Size = UDim2.fromScale(1, 1),
        [Children] = {
            New "TextLabel" {
                Size = UDim2.fromScale(1, 1),
                Text = props.PageName,
            }
        }
    }
end

local actionState = Value("None")
local router = Router {
    routes = {
        Route "/" {
            view = function(_, context)
                return createDemoFrame({ PageName = context.path:get()})
            end,
        },

        Route "/abc" {
            view = function(_, context)
                return createDemoFrame({ PageName = context.path:get()})
            end,
            [Children] = {
                Route "/def" {
                    view = function(_, context)
                        return createDemoFrame({ PageName = context.path:get()})
                    end,
                },

                Route "/hij" {
                    view = function(_, context)
                        return createDemoFrame({ PageName = context.path:get()})
                    end,
                },
            },
        },
    },
}

New "ScreenGui" {
    Parent = PlayerGui,
    ZIndexBehavior = Enum.ZIndexBehavior.Sibling,

    [Children] = {
        New "TextLabel" {
            AnchorPoint = Vector2.new(0.5, 0),
            Position = UDim2.new(0.5, 0, 0, 12),
            Size = UDim2.fromOffset(0, 14),
            Text = actionState,
            ZIndex = 2,
        },

        Canvas {
            source = router,
        }
    }
}

print(router.routes)
actionState:set("Goto /abc/")
router:go("/abc")
task.wait(1)
actionState:set("Goto /abc/hij")
router:go("/abc/hij")
task.wait(1)
router:go("/abc/hij")
actionState:set("Goto /abc/def/")
router:go("/abc/def")
task.wait(1)
actionState:set("Go back by 2")
router:back(2)
task.wait(1)
actionState:set("Goto /abc/def/")
router:go("/abc/def")
task.wait(1)
print(router.history)
router:go("/")
actionState:set("OK!")