local l_StudioFixPluginWidgetLocalizedIds_0 = game:GetFastFlag("StudioFixPluginWidgetLocalizedIds");
local l_Parent_0 = script.Parent.Parent;
local v2 = require(l_Parent_0.Packages.React);
local v3 = require(l_Parent_0.Packages.ReactRoblox);
local v4 = require(l_Parent_0.Packages.Framework);
local v5 = if not v4.SharedFlags.getFFlagDevFrameworkBetterInit() then v4.StudioUI.DockWidget else v4.UI.DockWidget;
local l_ContextServices_0 = v4.ContextServices;
local l_Plugin_0 = l_ContextServices_0.Plugin;
local l_Mouse_0 = l_ContextServices_0.Mouse;
local v9 = require(l_Parent_0.Src.Resources.MakeTheme);
local l_SourceStrings_0 = l_Parent_0.Src.Resources.Localization.SourceStrings;
local l_LocalizedStrings_0 = l_Parent_0.Src.Resources.Localization.LocalizedStrings;
local v12 = require(l_Parent_0.Src.Components.CollaboratorList);
local v13 = require(l_Parent_0.Src.ContextServices.CollaboratorsServiceContext);
local v14 = require(l_Parent_0.Src.Util.AnalyticsHandlers);
local l_RunService_0 = game:GetService("RunService");
local v16 = v2.PureComponent:extend("MainPlugin");
v16.init = function(v17, v18)
    v17:setState({
        enabled = false
    });
    v17.toggleEnabled = function()
        v17.analytics:report("panelToggled", not v17.state.enabled);
        v17:setState(function(v19)
            return {
                enabled = not v19.enabled
            };
        end);
    end;
    v17.onClose = function()
        v17.analytics:report("panelToggled", false);
        v17:setState({
            enabled = false
        });
    end;
    v17.onRestore = function(v20)
        v17:setState({
            enabled = v20
        });
    end;
    v17.onWidgetEnabledChanged = function(v21)
        v17:setState({
            enabled = v21.Enabled
        });
    end;
    v17.localization = l_ContextServices_0.Localization.new({
        stringResourceTable = l_SourceStrings_0,
        translationResourceTable = l_LocalizedStrings_0,
        pluginName = "SocialPresence"
    });
    v17.analytics = l_ContextServices_0.Analytics.new(v14);
    v18.EnableSignal.Event:Connect(v17.toggleEnabled);
end;
v16.render = function(v22)
    local l_CollaboratorsService_0 = game:GetService("CollaboratorsService");
    local l_props_0 = v22.props;
    local l_state_0 = v22.state;
    local l_Plugin_1 = l_props_0.Plugin;
    return l_ContextServices_0.provide({
        l_Plugin_0.new(l_Plugin_1),
        l_Mouse_0.new(l_Plugin_1:getMouse()),
        v9(),
        v22.localization,
        v22.analytics,
        v13.new(l_CollaboratorsService_0)
    }, {
        MainWidget = v2.createElement(v5, {
            Id = if not l_StudioFixPluginWidgetLocalizedIds_0 then nil else "SocialPresence",
            Enabled = l_state_0.enabled and l_RunService_0:IsEdit(),
            Title = v22.localization:getText("Plugin", "Name"),
            ZIndexBehavior = Enum.ZIndexBehavior.Sibling,
            InitialDockState = Enum.InitialDockState.Right,
            Size = Vector2.new(640, 480),
            MinSize = Vector2.new(250, 200),
            OnClose = v22.onClose,
            ShouldRestore = true,
            OnWidgetRestored = v22.onRestore,
            [v3.Change.Enabled] = v22.onWidgetEnabledChanged
        }, {
            CollaboratorList = v2.createElement(v12)
        })
    });
end;
return v16;


local l_Style_0 = require(script.Parent.Parent.Parent.Packages.Framework).Style;
local l_StudioTheme_0 = l_Style_0.Themes.StudioTheme;
local l_StyleKey_0 = l_Style_0.StyleKey;
local v3 = {
    [l_StyleKey_0.ActivityRing] = "rbxasset://studio_svg_textures/Lua/SocialPresence/Light/Large/ActivityRing.png",
    [l_StyleKey_0.AddCollaboratorIcon] = "rbxasset://studio_svg_textures/Shared/WidgetIcons/Light/Standard/AddCollaborator.png",
    [l_StyleKey_0.CheckboxOnIcon] = "rbxasset://studio_svg_textures/Shared/Utility/Light/Standard/CheckboxOn.png",
    [l_StyleKey_0.CheckboxOffIcon] = "rbxasset://studio_svg_textures/Shared/Utility/Light/Standard/CheckboxOff.png",
    [l_StyleKey_0.MoreIcon] = "rbxasset://studio_svg_textures/Shared/Navigation/Light/Standard/More.png",
    [l_StyleKey_0.RibbonBarHover] = Color3.fromRGB(228, 238, 254)
};
local v4 = {
    [l_StyleKey_0.ActivityRing] = "rbxasset://studio_svg_textures/Lua/SocialPresence/Dark/Large/ActivityRing.png",
    [l_StyleKey_0.AddCollaboratorIcon] = "rbxasset://studio_svg_textures/Shared/WidgetIcons/Dark/Standard/AddCollaborator.png",
    [l_StyleKey_0.CheckboxOnIcon] = "rbxasset://studio_svg_textures/Shared/Utility/Dark/Standard/CheckboxOn.png",
    [l_StyleKey_0.CheckboxOffIcon] = "rbxasset://studio_svg_textures/Shared/Utility/Dark/Standard/CheckboxOff.png",
    [l_StyleKey_0.MoreIcon] = "rbxasset://studio_svg_textures/Shared/Navigation/Dark/Standard/More.png",
    [l_StyleKey_0.RibbonBarHover] = Color3.fromRGB(37, 37, 37)
};
local v5 = {
    activityRing = l_StyleKey_0.ActivityRing,
    ribbonItem = {
        size = UDim2.new(0, 24, 1, 0),
        background = l_StyleKey_0.Tab,
        overflowBackground = l_StyleKey_0.ImageButtonBackground,
        addIcon = l_StyleKey_0.AddCollaboratorIcon,
        buttonHover = l_StyleKey_0.RibbonBarHover
    },
    footer = {
        height = 24,
        borderColor = l_StyleKey_0.Border,
        iconColor = l_StyleKey_0.ButtonText,
        moreIcon = l_StyleKey_0.MoreIcon,
        uncheckedIcon = l_StyleKey_0.CheckboxOffIcon,
        checkedIcon = l_StyleKey_0.CheckboxOnIcon,
        disableTeamCreateColor = Color3.fromRGB(244, 100, 93)
    },
    highlightToggle = {
        height = 28,
        background = l_StyleKey_0.SubBackground,
        border = l_StyleKey_0.Border
    },
    collaboratorItem = {
        size = UDim2.new(1, 0, 0, 58),
        expandedSize = UDim2.new(1, 0, 0, 96),
        thumbnailSize = UDim2.fromOffset(42, 42),
        hoveredBackground = l_StyleKey_0.SubBackground,
        usernamePosition = UDim2.fromOffset(48, 4),
        subtitlePosition = UDim2.fromOffset(48, 24)
    },
    jumpButton = {
        background = l_StyleKey_0.ImageButtonBackground,
        hoveredBackground = l_StyleKey_0.ButtonHover,
        pressedBackground = l_StyleKey_0.ButtonPressed,
        textColor = l_StyleKey_0.TextPrimary,
        baseStyle = {
            BackgroundImage = "rbxasset://textures/StudioToolbox/RoundedBackground.png",
            SliceCenter = Rect.new(3, 3, 13, 13),
            BorderSize = 0
        }
    },
    userThumbnail = {
        avatarBackground = l_StyleKey_0.SecondaryContrast,
        avatarIdleBackground = l_StyleKey_0.ForegroundContrast,
        avatarSizeRatio = 0.75,
        idleTint = Color3.fromRGB(140, 140, 140),
        loadingImage = "rbxasset://textures/StudioSharedUI/default_user.png",
        loadFailureImage = "rbxasset://textures/GameSettings/ModeratedAsset.jpg"
    }
};
return function(v6)
    local _ = nil;
    return (if not v6 then l_StudioTheme_0.new(v4, v3) else l_StudioTheme_0.mock(v4, v3)):extend(v5);
end;


local v0 = require(script:FindFirstAncestor("SocialPresence").Packages.Framework);
local l_createStyleRule_0 = v0.Styling.createStyleRule;
return v0.Styling.createStyleSheet("SocialPresence", {
    l_createStyleRule_0(".RibbonElement", {
        Size = UDim2.new(0, 24, 0, 24),
        BackgroundTransparency = 1
    }, {
        l_createStyleRule_0("::UICorner", {
            CornerRadius = UDim.new(0.5, 0)
        })
    }),
    l_createStyleRule_0(".Button", {
        AutoButtonColor = false,
        BackgroundTransparency = 1,
        BorderSizePixel = 0
    }, {
        l_createStyleRule_0(":hover", {
            BackgroundColor3 = "$BackgroundPaper",
            BackgroundTransparency = 0
        }),
        l_createStyleRule_0(":pressed", {
            BackgroundColor3 = "$ActionActivated",
            BackgroundTransparency = 0
        })
    })
}, {});


return require(script:FindFirstAncestor("SocialPresence").Packages.Framework).Styling.createStyleSheet("SocialPresenceDarkTheme", {}, {
    ActivityRingImage = "rbxasset://studio_svg_textures/Lua/SocialPresence/Dark/Large/ActivityRing.png",
    AddCollaboratorIcon = "rbxasset://studio_svg_textures/Shared/WidgetIcons/Dark/Standard/AddCollaborator.png"
});


return require(script:FindFirstAncestor("SocialPresence").Packages.Framework).Styling.createStyleSheet("SocialPresenceLightTheme", {}, {
    ActivityRingImage = "rbxasset://studio_svg_textures/Lua/SocialPresence/Light/Large/ActivityRing.png",
    AddCollaboratorIcon = "rbxasset://studio_svg_textures/Shared/WidgetIcons/Light/Standard/AddCollaborator.png"
});


local l_COLLAB6395SocialPresenceStylesheets_0 = game:GetFastFlag("COLLAB6395SocialPresenceStylesheets");
local l_Parent_0 = script.Parent.Parent;
local v2 = require(l_Parent_0.Packages.React);
local v3 = require(l_Parent_0.Packages.Framework);
local l_ContextServices_0 = v3.ContextServices;
local l_Plugin_0 = l_ContextServices_0.Plugin;
local l_Mouse_0 = l_ContextServices_0.Mouse;
local l_StudioTheme_0 = v3.Style.Themes.StudioTheme;
local l_registerPluginStyles_0 = v3.Styling.registerPluginStyles;
local v9 = require(l_Parent_0.Src.Resources.MakeTheme);
local l_SourceStrings_0 = l_Parent_0.Src.Resources.Localization.SourceStrings;
local l_LocalizedStrings_0 = l_Parent_0.Src.Resources.Localization.LocalizedStrings;
local l_Components_0 = l_Parent_0.Src.Components;
local v13 = not not l_COLLAB6395SocialPresenceStylesheets_0 and require(l_Components_0.CollaboratorRibbon) or require(l_Components_0.DEPRECATED_CollaboratorRibbon);
local v14 = require(l_Parent_0.Src.ContextServices.CollaboratorsServiceContext);
local v15 = require(l_Parent_0.Src.Util.AnalyticsHandlers);
local v16 = v2.PureComponent:extend("RibbonPlugin");
v16.init = function(v17, v18)
    v17.localization = l_ContextServices_0.Localization.new({
        stringResourceTable = l_SourceStrings_0,
        translationResourceTable = l_LocalizedStrings_0,
        pluginName = "SocialPresence"
    });
    v17.analytics = l_ContextServices_0.Analytics.new(v15);
    if l_COLLAB6395SocialPresenceStylesheets_0 then
        v17.design = l_registerPluginStyles_0(v18.Plugin);
    end;
end;
v16.render = function(v19)
    local l_CollaboratorsService_0 = game:GetService("CollaboratorsService");
    local l_props_0 = v19.props;
    local l_Plugin_1 = l_props_0.Plugin;
    return l_ContextServices_0.provide({
        l_Plugin_0.new(l_Plugin_1),
        l_Mouse_0.new(l_Plugin_1:getMouse()),
        not not l_COLLAB6395SocialPresenceStylesheets_0 and l_StudioTheme_0.new() or v9(),
        v19.localization,
        v19.analytics,
        v14.new(l_CollaboratorsService_0)
    }, {
        RibbonComponent = v2.createElement(v13, {
            Widget = l_props_0.Widget,
            OnClick = l_props_0.OnClick
        }),
        StyleLink = not not l_COLLAB6395SocialPresenceStylesheets_0 and v2.createElement("StyleLink", {
            StyleSheet = v19.design
        }) or nil
    });
end;
return v16;


local v0 = require(script.Parent.Parent.Parent.Packages.Cryo);
local l_StudioService_0 = game:GetService("StudioService");
return function(v2)
    local function v4(v3)
        if game:GetFastFlag("COLLAB5863Telemetry") then
            v2:SendEventDeferred("studio", "SocialPresence", "StudioSocialPresenceAction", (v0.Dictionary.join({
                studioSid = v2:GetSessionId(),
                clientId = v2:GetClientId(),
                placeId = game.PlaceId,
                userId = l_StudioService_0:GetUserId()
            }, v3 or {})));
        end;
    end;
    return {
        panelToggled = function(_, v6)
            v4({
                actionName = not v6 and "panelDisabled" or "panelEnabled"
            });
        end,
        highlightsToggled = function(_, v8)
            v4({
                actionName = not v8 and "highlightsDisabled" or "highlightsEnabled"
            });
        end,
        jumpToCollaboratorPressed = function(v9)
            v4({
                actionName = v9
            });
        end,
        manageCollaboratorsPressed = function(v10)
            v4({
                actionName = v10
            });
        end
    };
end;


local l_Parent_0 = script.Parent.Parent.Parent;
local v1 = require(l_Parent_0.Packages.Framework);
local l_TestHelpers_0 = v1.TestHelpers;
local l_ContextServices_0 = v1.ContextServices;
local v4 = {
    l_ContextServices_0.Analytics.mock(),
    l_ContextServices_0.Localization.mock(),
    require(l_Parent_0.Src.Resources.MakeTheme)(true),
    require(l_Parent_0.Src.ContextServices.CollaboratorsServiceContext).new()
};
return function(v5)
    assert(type(v5) == "table", "Expected story to be a table");
    return l_TestHelpers_0.provideMockContext(v4, v5);
end;


if plugin then
    local l_script_FirstAncestor_0 = script:FindFirstAncestor("StreamingServiceDispatcherRegistry");
    local v1 = require(l_script_FirstAncestor_0.Src.Utils.CliAdapter);
    local v2 = pcall(function()
        game:GetService("StreamingService");
    end);
    local v3 = require(l_script_FirstAncestor_0.Packages.TestLoader);
    if not require(l_script_FirstAncestor_0.Src.Flags.getFFlagFixAssistantLuaTests)() then
        if not v2 then
            if not v1.RunningEval then
                v3.launch("StreamingServiceDispatcherRegistry", l_script_FirstAncestor_0.Src.Mocks);
                return ;
            end;
        else
            v3.launch("StreamingServiceDispatcherRegistry", l_script_FirstAncestor_0.Src);
        end;
    elseif not v1.RunningEval then
        v3.launch("StreamingServiceDispatcherRegistry", l_script_FirstAncestor_0.Src);
    end;
    if not v3.isCli() or v1.RunningEval then
        if require(l_script_FirstAncestor_0.Src.Flags.getFFlagAICOChatBot)() then
            local v4 = require(l_script_FirstAncestor_0.Src.MainPlugin);
            local v5 = nil;
            local function _()
                plugin.Name = l_script_FirstAncestor_0.Name;
                v5 = v4.new();
                v5:init();
            end;
            plugin.Unloading:Connect(function()
                if v5 then
                    v5:destroy();
                end;
            end);
            plugin.Name = l_script_FirstAncestor_0.Name;
            v5 = v4.new();
            v5:init();
            return ;
        else
            return ;
        end;
    else
        return ;
    end;
else
    return ;
end;


local v0 = {};
local v1 = {};
local v2 = {};
local v3 = {};
local v4 = "";
v0.newRequest = function(v5)
    v1[v5] = {};
    v2[v5] = {};
end;
v0.activeStreamId = function()
    return v4;
end;
v0.setActiveStreamId = function(v6)
    v4 = v6;
end;
v0.requestStreamSubscription = function(v7, v8, v9, v10, v11, v12)
    v1[v7][v8] = {};
    v3[v8] = {
        handlePacket = v10,
        startActiveStream = v11,
        streamEnded = v12
    };
    if v9 then
        table.insert(v2[v7], v8);
        if v4 == "" then
            v4 = v8;
            v11(v7);
        end;
    end;
end;
v0.storeStreamPacket = function(v13, v14, v15)
    table.insert(v1[v13][v14], v15);
end;
v0.activeStreamEnded = function(v16, v17)
    if v3[v17].streamEnded then
        v3[v17].streamEnded();
    end;
    v4 = "";
    v1[v16][v17] = nil;
    v3[v17] = nil;
    table.remove(v2[v16], 1);
    local v18 = v2[v16][1];
    if v18 then
        v4 = v18;
        v3[v18].startActiveStream(v16);
    end;
    return v2[v16][1];
end;
v0.packetExists = function(v19, v20)
    if v1[v19][v20] and #v1[v19][v20] > 0 then
        return true;
    else
        return false;
    end;
end;
v0.handleEarliestPacketForStream = function(v21, v22)
    local v23 = table.remove(v1[v21][v22], 1);
    if v3[v22].handlePacket then
        v3[v22].handlePacket(v23);
    end;
    return v23;
end;
v0.requestEnded = function(v24)
    v1[v24] = nil;
    v2[v24] = nil;
    v4 = "";
end;
v0.clear = function()
    v1 = {};
    v2 = {};
    v3 = {};
    v4 = "";
end;
v0.getStreamCache = function()
    return v1;
end;
return v0;


local l_script_FirstAncestor_0 = script:FindFirstAncestor("StreamingServiceDispatcherRegistry");
local v1 = require(l_script_FirstAncestor_0.Src.Utils.CliAdapter);
local v2 = v1.GetService("ChangeHistoryService");
local v3 = v1.GetService("StreamingService");
local v4 = v1.GetService("ConversationalAIAcceptanceService");
local v5 = require(l_script_FirstAncestor_0.Src.Flags.getFFlagConvAIMenu_Attrib);
local v6 = require(l_script_FirstAncestor_0.Src.Flags.getFFlagConvAICodeRunnerTelemetry);
local v7 = require(l_script_FirstAncestor_0.Src.Flags.getFFlagCAPInstanceTrackerForUndoTelemetry);
local v8 = {
    assetCacheMap = {},
    g2g = {},
    guid2instance = {},
    guidToInfo = {},
    chatBulletMap = {},
    altDataMap = {},
    requestRegionAdornments = {},
    requestMetadata = {},
    activeDraftGuids = nil,
    draftModeModels = {}
};
if v5() then
    v8.cachedAssetAttributionInfo = {};
end;
if v7() then
    v8.recordingActionNumber = 1;
    v8.requestToRecordName = {};
end;
local v9 = {};
local v10 = {};
v8.get = function(v11, v12)
    if not v11 or #v11 == 0 then
        return ;
    else
        local v13 = nil;
        if v12 then
            v13 = v3:GetInstance(v12, v11);
        end;
        return v13 or v9[v11];
    end;
end;
v8.set = function(v14, v15)
    v9[v14] = v15;
end;
local v16 = nil;
local v17 = nil;
v8.StartRecordingActions = function(v18, v19)
    if not v17 then
        local v20 = nil;
        if not v7() then
            v20 = not v6() and "Assistant Actions" or (v19 or "Assistant Actions");
        else
            v20 = v19 or v8.requestToRecordName[v18];
            if not v20 then
                v20 = ("%* %*"):format("Assistant Actions", v8.recordingActionNumber);
                local l_v8_0 = v8;
                l_v8_0.recordingActionNumber = l_v8_0.recordingActionNumber + 1;
                v8.requestToRecordName[v18] = v20;
            end;
        end;
        local v22 = v2:TryBeginRecording(v20);
        if v22 then
            v17 = v22;
            return true, v22;
        else
            warn("StartRecordingActions failed: TryBeginRecording returned nil");
            return false;
        end;
    else
        if not v2:IsRecordingInProgress(v17) then
            warn("StartRecordingActions failed: currentRecording is set but not running");
        end;
        return false;
    end;
end;
v8.EndRecordingActions = function(v23, v24)
    if v17 then
        assert(v17, "Luau");
        local _, v26 = v2:GetCanUndo();
        local l_Append_0 = Enum.FinishRecordingOperation.Append;
        local v28 = nil;
        if not v7() then
            v28 = not v6() and "Assistant Actions" or (v24 or "Assistant Actions");
        else
            v28 = v24 or v8.requestToRecordName[v23];
            if not v28 then
                return false;
            end;
        end;
        if not (v16 == v23) or v26 ~= v28 then
            l_Append_0 = Enum.FinishRecordingOperation.Commit;
        end;
        v2:FinishRecording(v17, l_Append_0);
        if not (not v7() or v24) then
            v4:RecordingActionEnded(v23, v28);
        end;
        v16 = v23;
        v17 = nil;
        return true;
    else
        return false;
    end;
end;
local function _(v29)
    local v30 = v8.requestMetadata[v29];
    if not v30 then
        v30 = {
            RequestId = v29,
            Time_Start = os.clock()
        };
        v8.requestMetadata[v29] = v30;
        return v30;
    else
        return v30;
    end;
end;
v8.GetRequestFolder = function(v32)
    if v32 then
        local v33 = v10[v32];
        if not v33 then
            v33 = Instance.new("Folder");
            v33.Parent = workspace;
            v10[v32] = v33;
            local function _(v34, v35)
                if typeof(v35) == "Instance" then
                    return ;
                else
                    v33:SetAttribute(v34, v35);
                    if v34 == "Query" then
                        v33.Name = "PROMPT: " .. v35:gsub("^(" .. ("."):rep(30) .. ".-)( .*)$", "%1...");
                    end;
                    return ;
                end;
            end;
            local v37 = v8.requestMetadata[v32];
            local v38;
            if not v37 then
                v37 = {
                    RequestId = v32,
                    Time_Start = os.clock()
                };
                v8.requestMetadata[v32] = v37;
                v38 = v37;
            else
                v38 = v37;
            end;
            for v39, v40 in v38, nil, nil do
                if not (typeof(v40) == "Instance") then
                    v33:SetAttribute(v39, v40);
                    if v39 == "Query" then
                        v33.Name = "PROMPT: " .. v40:gsub("^(" .. ("."):rep(30) .. ".-)( .*)$", "%1...");
                    end;
                end;
            end;
            setmetatable(v38, {
                __newindex = function(_, v42, v43)
                    if typeof(v43) == "Instance" then
                        return ;
                    else
                        v33:SetAttribute(v42, v43);
                        if v42 == "Query" then
                            v33.Name = "PROMPT: " .. v43:gsub("^(" .. ("."):rep(30) .. ".-)( .*)$", "%1...");
                        end;
                        return ;
                    end;
                end
            });
        end;
        return v33;
    else
        return ;
    end;
end;
v8.GetRequestMetadata = function(v44, v45)
    local v46 = v8.requestMetadata[v44];
    local v47;
    if not v46 then
        v46 = {
            RequestId = v44,
            Time_Start = os.clock()
        };
        v8.requestMetadata[v44] = v46;
        v47 = v46;
    else
        v47 = v46;
    end;
    return v47[v45];
end;
v8.SetRequestMetadata = function(v48, v49, v50)
    local v51 = v8.requestMetadata[v48];
    local v52;
    if not v51 then
        v51 = {
            RequestId = v48,
            Time_Start = os.clock()
        };
        v8.requestMetadata[v48] = v51;
        v52 = v51;
    else
        v52 = v51;
    end;
    v52[v49] = v50;
end;
v8.destroy = function()
end;
return v8;


local l_script_FirstAncestor_0 = script:FindFirstAncestor("StreamingServiceDispatcherRegistry");
local v1 = require(l_script_FirstAncestor_0.Src.Utils.CliAdapter).GetService("StreamingService");
local v2 = require(l_script_FirstAncestor_0.Src.Utils.Utils);
local _ = require(l_script_FirstAncestor_0.Src.Types);
local v4 = require(l_script_FirstAncestor_0.Src.Commands.BuilderCommands.BuilderNameMap);
return function(v5)
    local l_requestId_0 = v5.requestId;
    local l_arguments_0 = v5.arguments;
    local l_direct_instance_0 = l_arguments_0.direct_instance;
    local v9 = l_direct_instance_0 or v4.get(l_arguments_0.sourceInstanceId, l_requestId_0);
    if v9 then
        assert(v9, "Luau");
        if not l_direct_instance_0 then
            v4.StartRecordingActions(l_requestId_0);
        end;
        local v10 = v9:Clone();
        if v10 then
            if l_arguments_0.newInstanceId then
                v4.set(l_arguments_0.newInstanceId, v10);
            end;
            l_arguments_0.direct_instance = v10;
            v1:ExecuteCommandAsync(l_requestId_0, "SetProperty", v5);
            v10.Parent = v2.getRequestParent(v10, l_requestId_0);
            if not l_direct_instance_0 then
                v4.EndRecordingActions(l_requestId_0);
            end;
            v2.modifyChatWithInstanceLink(l_requestId_0, v10, "copied", l_arguments_0.chatGroup or l_arguments_0.newInstanceId);
            return ;
        else
            if not l_direct_instance_0 then
                v4.EndRecordingActions(l_requestId_0);
            end;
            return ;
        end;
    else
        return ;
    end;
end;


local l_script_FirstAncestor_0 = script:FindFirstAncestor("StreamingServiceDispatcherRegistry");
local v1 = require(l_script_FirstAncestor_0.Src.Utils.CliAdapter);
local v2 = v1.GetService("MaterialGenerationService");
local v3 = v1.GetService("MaterialService");
local v4 = v1.GetService("ChatbotUIService");
local v5 = require(l_script_FirstAncestor_0.Packages.Promise);
local v6 = require(l_script_FirstAncestor_0.Packages.Dash);
local v7 = require(l_script_FirstAncestor_0.Src.Utils.Utils);
local _ = require(l_script_FirstAncestor_0.Src.Types);
local v9 = require(l_script_FirstAncestor_0.Src.Localization.Localization);
local v10 = require(l_script_FirstAncestor_0.Src.Commands.BuilderCommands.BuilderNameMap);
local v11 = require(l_script_FirstAncestor_0.Src.Flags.getFFlagMaterialGenErrorTextFiltered);
local v12 = require(l_script_FirstAncestor_0.Src.Flags.getFFlagMaterialGeneratorNewServiceAsyncApi);
local function v18(v13)
    local v16 = v6.collectSet(v3:GetDescendants(), function(_, v15)
        if not v15:IsA("MaterialVariant") then
            return nil;
        else
            return v15.Name;
        end;
    end);
    if v16[v13] then
        local v17 = 1;
        while v16[v13 .. v17] do
            v17 = v17 + 1;
        end;
        return v13 .. v17;
    else
        return v13;
    end;
end;
local function _(v19, v20)
    assert(type(v19) == "string", "Bad materialDescription");
    assert(type(v20) == "number", "Bad amount");
    return v5.try(function()
        if not v12() then
            return v2:DEPRECATED_GenerateMaterialVariantsAync(v19, v20);
        else
            return v2:GenerateMaterialVariantsAsync(v19, v20);
        end;
    end);
end;
local function _(v22)
    assert(type(v22) == "table", "Bad materials");
    return v5.try(function()
        return v2:UploadMaterialVariantsAsync(v22);
    end);
end;
local function _(v24, v25)
    local l_v24_FirstChild_0 = v24:FindFirstChild(v25);
    if not l_v24_FirstChild_0 then
        local l_Folder_0 = Instance.new("Folder");
        l_Folder_0.Name = v25;
        l_Folder_0.Parent = v24;
        return l_Folder_0;
    else
        return l_v24_FirstChild_0;
    end;
end;
local function _(v29)
    return string.format("studio://apply_material_variant/%s", v29);
end;
local function _(v31)
    return string.format("//instance/%s) %s", v31.ClassName, v31.Name);
end;
local function v51(v33, v34, v35, v36, v37)
    v7.streamText(v33.requestId, string.format("\n%s\n", (v9:getText("CreateMaterial", "Description", {
        baseMaterial = tostring(v35),
        description = tostring(v34),
        materialPattern = tostring(v37)
    }))));
    assert(type(v34) == "string", "Bad materialDescription");
    assert(true, "Bad amount");
    local l_try_0 = v5.try;
    local v39 = 4;
    return l_try_0(function()
        if not v12() then
            return v2:DEPRECATED_GenerateMaterialVariantsAync(v34, v39);
        else
            return v2:GenerateMaterialVariantsAsync(v34, v39);
        end;
    end):andThen(function(v40)
        assert(type(v40) == "table", "Bad materials");
        return v5.try(function()
            return v2:UploadMaterialVariantsAsync(v40);
        end):andThen(function()
            local l_v3_0 = v3;
            local l_AssistantMaterials_0 = l_v3_0:FindFirstChild("AssistantMaterials");
            local v43;
            if not l_AssistantMaterials_0 then
                local l_Folder_1 = Instance.new("Folder");
                l_Folder_1.Name = "AssistantMaterials";
                l_Folder_1.Parent = l_v3_0;
                v43 = l_Folder_1;
            else
                v43 = l_AssistantMaterials_0;
            end;
            l_AssistantMaterials_0 = string.format("Material: %s", v34);
            local l_v43_FirstChild_0 = v43:FindFirstChild(l_AssistantMaterials_0);
            if not l_v43_FirstChild_0 then
                local l_Folder_2 = Instance.new("Folder");
                l_Folder_2.Name = l_AssistantMaterials_0;
                l_Folder_2.Parent = v43;
                l_v3_0 = l_Folder_2;
            else
                l_v3_0 = l_v43_FirstChild_0;
            end;
            l_AssistantMaterials_0 = {};
            l_v43_FirstChild_0 = 0;
            local v47 = false;
            for _, v49 in v40, nil, nil do
                local l_v49_DebugId_0 = v49:GetDebugId(10);
                v49.Name = v18(v36);
                v49.BaseMaterial = v35;
                v49.MaterialPattern = v37;
                v49.Parent = l_v3_0;
                v10.guidToInfo[l_v49_DebugId_0] = {
                    instance = v49
                };
                l_v43_FirstChild_0 = v49.StudsPerTile;
                v47 = v49.MaterialPattern == Enum.MaterialPattern.Organic;
                table.insert(l_AssistantMaterials_0, {
                    guid = l_v49_DebugId_0,
                    url = v49.ColorMap,
                    action = string.format("studio://apply_material_variant/%s", l_v49_DebugId_0),
                    tooltip = v49.Name
                });
            end;
            v4:DisplayContent("Materials", {
                requestId = v33.requestId or "",
                instanceData = l_AssistantMaterials_0,
                studsPerTile = l_v43_FirstChild_0,
                isOrganic = v47
            });
            return v40[1];
        end);
    end);
end;
local function _(v52, v53, v54, v55, v56)
    return v51(v52, v53, v54, v55, v56);
end;
return function(v58)
    local l_arguments_0 = v58.arguments;
    assert(type(l_arguments_0.materialDescription) == "string", "Bad request.materialDescription");
    local v60 = l_arguments_0.materialId or l_arguments_0.instanceId;
    assert(v60, "Bad request.materialId");
    l_arguments_0.materialId = v60;
    v10.StartRecordingActions(v58.requestId);
    local v61, v62 = v51(v58, l_arguments_0.materialDescription, l_arguments_0.baseMaterial, l_arguments_0.materialId, l_arguments_0.materialPattern):await();
    if v61 then
        if l_arguments_0.materialId then
            v10.set(l_arguments_0.materialId, v62);
        end;
        v10.EndRecordingActions(v58.requestId);
        return ;
    else
        local v63 = v9:getText("CreateMaterial", "FailedToCreateMaterialImprovedError", {});
        if not (not v11() or not string.find(tostring(v62), "text is fully filtered")) then
            v63 = v9:getText("CreateMaterial", "FailedToCreateMaterialTextFilteredError", {});
        end;
        v7.streamText(v58.requestId, string.format("\n%s\n", v63));
        v10.EndRecordingActions(v58.requestId);
        return ;
    end;
end;


local l_script_FirstAncestor_0 = script:FindFirstAncestor("StreamingServiceDispatcherRegistry");
local v1 = require(l_script_FirstAncestor_0.Src.Utils.CliAdapter);
local v2 = v1.GetService("StudioAssetService");
local v3 = v1.GetService("StudioService");
local v4 = v1.GetService("RunService");
local v5 = v1.GetService("Selection");
local _ = require(l_script_FirstAncestor_0.Src.Types);
local v7 = require(l_script_FirstAncestor_0.Src.Flags.getFFlagCLI88299);
local v8 = require(l_script_FirstAncestor_0.Src.Flags.getFFlagRunCommandsInCodeAssist);
return function(_)
    if v4:IsStudio() then
        if not v7() then
            local l_status_0, l_result_0 = pcall(function()
                return v3:HasInternalPermission();
            end);
            if not (l_status_0 and l_result_0) then
                return ;
            end;
        end;
        if v8() then
            for _, v13 in v5:Get() do
                local l_status_1, l_result_1 = pcall(function()
                    v2:PublishPackage(v13, {
                        Name = v13.Name,
                        AssetType = Enum.AssetType.Model.Name,
                        Description = "",
                        IsPackage = false,
                        PublishToMarketplace = false,
                        AllowComments = false
                    });
                end);
                if not l_status_1 then
                    warn(l_result_1);
                end;
            end;
            return ;
        else
            return ;
        end;
    else
        return ;
    end;
end;


local _ = require(script:FindFirstAncestor("StreamingServiceDispatcherRegistry").Src.Types);
return function(v1)
    if v1 then
        local l_arguments_0 = v1.arguments;
        if (not v1 or not l_arguments_0) or not l_arguments_0.time then
            task.wait(1);
            return ;
        else
            task.wait(l_arguments_0.time);
            return ;
        end;
    else
        task.wait(1);
        return ;
    end;
end;


local l_script_FirstAncestor_0 = script:FindFirstAncestor("StreamingServiceDispatcherRegistry");
local v1 = require(l_script_FirstAncestor_0.Src.Utils.Utils);
local _ = require(l_script_FirstAncestor_0.Src.Types);
local v3 = require(l_script_FirstAncestor_0.Src.Commands.BuilderCommands.BuilderNameMap);
return function(v4)
    local l_requestId_0 = v4.requestId;
    local v6 = v1.getRequestCFrame(l_requestId_0);
    local v7 = v3.GetRequestMetadata(l_requestId_0, "PlacementSize");
    v1.addConstraintVisualization(l_requestId_0, v6, Vector3.new(v7.X, 0, v7.Z), true);
    v1.startConstraintVisualization(l_requestId_0, true);
end;


local l_script_FirstAncestor_0 = script:FindFirstAncestor("StreamingServiceDispatcherRegistry");
local v1 = require(l_script_FirstAncestor_0.Src.Utils.CliAdapter);
local v2 = v1.GetService("StreamingService");
local v3 = v1.GetService("ConversationalAIAcceptanceService");
local v4 = require(l_script_FirstAncestor_0.Src.Utils.Utils);
local _ = require(l_script_FirstAncestor_0.Src.Types);
local v6 = require(l_script_FirstAncestor_0.Src.Commands.BuilderCommands.BuilderNameMap);
return function(v7)
    local l_arguments_0 = v7.arguments;
    local l_altDataId_0 = l_arguments_0.altDataId;
    local v10 = not not l_altDataId_0 and v6.altDataMap[l_altDataId_0] or nil;
    if not v10 then
        v6.StartRecordingActions(v7.requestId);
    end;
    v10 = v10 or {
        request = v7,
        assetId = l_arguments_0.assetId,
        altAssets = l_arguments_0.altAssets
    };
    assert(v10, "Failed to set default altData in insertAsset");
    local l_assetId_0 = v10.assetId;
    local v12 = v4.loadAssetAsync(l_assetId_0);
    if v12 then
        assert(v12, "Luau");
        if l_arguments_0.newInstanceId then
            v6.set(l_arguments_0.newInstanceId, v12);
        end;
        l_arguments_0.direct_instance = v12;
        v2:ExecuteCommandAsync(v7.requestId, "SetProperty", v7);
        v12.Parent = v4.getRequestParent(v12, v7.requestId);
        v6.EndRecordingActions(v7.requestId);
        v3:AssetInserted(v7.requestId, l_assetId_0);
        v4.modifyChatWithInstanceLink(v7.requestId, v12, "added", l_arguments_0.chatGroup or l_arguments_0.newInstanceId, v10);
        return ;
    else
        return ;
    end;
end;


local l_script_FirstAncestor_0 = script:FindFirstAncestor("StreamingServiceDispatcherRegistry");
local v1 = require(l_script_FirstAncestor_0.Src.Utils.CliAdapter);
local v2 = v1.GetService("StreamingService");
local v3 = v1.GetService("ConversationalAIAcceptanceService");
local v4 = require(l_script_FirstAncestor_0.Src.Utils.Utils);
local _ = require(l_script_FirstAncestor_0.Src.Types);
local v6 = require(l_script_FirstAncestor_0.Src.Commands.BuilderCommands.BuilderNameMap);
return function(v7)
    local l_arguments_0 = v7.arguments;
    v6.StartRecordingActions(v7.requestId);
    local v9 = Instance.new(l_arguments_0.className);
    if l_arguments_0.newInstanceId then
        v6.set(l_arguments_0.newInstanceId, v9);
    end;
    l_arguments_0.direct_instance = v9;
    v2:ExecuteCommandAsync(v7.requestId, "SetProperty", v7);
    v9.Parent = v4.getRequestParent(v9, v7.requestId);
    v6.EndRecordingActions(v7.requestId);
    v3:InstanceInserted(v7.requestId);
    v4.modifyChatWithInstanceLink(v7.requestId, v9, "created", l_arguments_0.chatGroup or l_arguments_0.newInstanceId);
end;


local l_script_FirstAncestor_0 = script:FindFirstAncestor("StreamingServiceDispatcherRegistry");
local _ = require(l_script_FirstAncestor_0.Src.Types);
local v2 = require(l_script_FirstAncestor_0.Src.Commands.BuilderCommands.BuilderNameMap);
return function(v3)
    local l_requestId_0 = v3.requestId;
    local l_arguments_0 = v3.arguments;
    local l_direct_instance_0 = l_arguments_0.direct_instance;
    local v7 = l_direct_instance_0 or v2.get(l_arguments_0.instanceId, l_requestId_0);
    if v7 then
        assert(v7, "Luau");
        if v7.Parent then
            if not l_direct_instance_0 then
                v2.StartRecordingActions(l_requestId_0);
            end;
            v7.Parent = nil;
            if not l_direct_instance_0 then
                v2.EndRecordingActions(l_requestId_0);
            end;
        end;
        return ;
    else
        return ;
    end;
end;


local l_script_FirstAncestor_0 = script:FindFirstAncestor("StreamingServiceDispatcherRegistry");
local v1 = require(l_script_FirstAncestor_0.Src.Utils.CliAdapter);
local v2 = v1.GetService("StreamingService");
local v3 = v1.GetService("ChatbotUIService");
local v4 = v1.GetService("ConversationalAIAcceptanceService");
local v5 = v1.GetService("ChangeHistoryService");
local _ = require(l_script_FirstAncestor_0.Src.Types);
local v7 = require(l_script_FirstAncestor_0.Src.Localization.Localization);
local v8 = require(l_script_FirstAncestor_0.Src.Commands.BuilderCommands.BuilderNameMap);
local v9 = require(l_script_FirstAncestor_0.Src.Flags.getFFlagConvAICodeRunner);
local v10 = require(l_script_FirstAncestor_0.Src.Flags.getFFlagConvAICodeRunnerTelemetry);
local v11 = require(l_script_FirstAncestor_0.Src.Flags.getFFlagConvAICodeRunnerUndoTelemetry);
local v12 = require(l_script_FirstAncestor_0.Src.Flags.getFFlagConvAICodeRunnerUX);
local v13 = require(l_script_FirstAncestor_0.Src.Flags.getFFlagConvAISettingAutoRunCode);
local v14 = require(l_script_FirstAncestor_0.Src.Flags.getFFlagConvAICodeRunnerUseThemeColors);
local v15 = require(l_script_FirstAncestor_0.Src.Flags.getFFlagConvAICodeRunnerBetterResultMessages);
local v16 = require(l_script_FirstAncestor_0.Src.Flags.getFFlagConvAICodeRunnerUniqueRecordings);
local v17 = require(l_script_FirstAncestor_0.Src.Flags.getFFlagConvAICodeRunnerLocalAutorunWarning);
local v18 = require(l_script_FirstAncestor_0.Src.Flags.getFStringConvAICodeRunnerAutorunDisabledWarning);
local v19 = require(l_script_FirstAncestor_0.Src.Flags.getFFlagConvAIStreamableCommands);
local v20 = {};
local v21 = 1;
local v22 = {};
local function _(v23)
    assert(v16(), "Local recordings are not available - CodeRunner Unique Recordings");
    return {
        requestId = v23,
        hasBeenUndone = false,
        hasBeenRedone = false
    };
end;
local function v25(v26, v27, v28, v29)
    assert(v15(), "Feature is not turned on - RunCode Better Result Messages");
    v3:DisplayContent("TransformContent", {
        requestId = v26,
        transformFunction = function(v30)
            for v31, v32 in v30, nil, nil do
                if string.find(v32, v27) then
                    v30[v31] = v28;
                end;
            end;
            return v30;
        end,
        completeCallback = function(v33)
            if not v33 then
                task.defer(function()
                    local v34 = (v29 or 0) + 1;
                    if v34 > 10 then
                        warn("[RunCode] updateResultMessage: Exceeded maximum depth");
                        return ;
                    else
                        v25(v26, v27, v28, v34);
                        return ;
                    end;
                end);
                return ;
            else
                return ;
            end;
        end
    });
end;
local function v57(v35)
    assert(v9(), "Feature is not turned on - RunCode command");
    local l_arguments_0 = v35.arguments;
    local l_code_0 = l_arguments_0.code;
    if not (not if not v19() then l_arguments_0.localStreamId else l_arguments_0.isLocalCommand or not l_code_0) then
        local v38 = if not v19() then l_arguments_0.localStreamId else l_arguments_0.syncStreamId;
        assert(v38, "Local command must have a streamId");
        local v39 = (v22[v38] or 0) + 1;
        v22[v38] = v39;
        l_arguments_0.runCodeGuid = v38 .. "_" .. v39;
        v3:DisplayContent("AddTextDropdown", {
            requestId = v35.requestId,
            streamId = v38,
            content = ("```lua\n%s\n```"):format(l_code_0),
            closedTitle = v7:getText("RunCode", "CodeDropdownClosedTitle"),
            openedTitle = v7:getText("RunCode", "CodeDropdownOpenedTitle")
        });
    end;
    local l_v3_Settings_0 = v3:GetSettings();
    if not l_arguments_0.isManualRun then
        local l_status_0, l_result_0 = pcall(function()
            return v2:BindCodeToGuid(l_arguments_0.runCodeGuid, l_code_0);
        end);
        if not l_status_0 then
            warn(l_result_0);
        elseif v10() then
            v4:CodeRunnerActivated(v35.requestId, l_code_0, not l_arguments_0.noAutorun, l_v3_Settings_0.AutoRunCode, l_v3_Settings_0.AutoExpandDropdowns);
        end;
    end;
    local v43 = l_arguments_0.noAutorun or v13() and not l_v3_Settings_0.AutoRunCode;
    if l_arguments_0.isManualRun or not v43 then
        local v44 = nil;
        local v45 = nil;
        local v46 = nil;
        if not v16() then
            v8.StartRecordingActions(v35.requestId);
        else
            if l_arguments_0.isManualRun then
                v44 = ("%* %*"):format("Assistant Code Runner", v21);
            end;
            v21 = v21 + 1;
            local l_requestId_0 = v35.requestId;
            assert(v16(), "Local recordings are not available - CodeRunner Unique Recordings");
            v45 = {
                requestId = l_requestId_0,
                hasBeenUndone = false,
                hasBeenRedone = false
            };
            v46 = v8.StartRecordingActions(v35.requestId, v44);
        end;
        local l_status_1, l_result_1 = pcall(function()
            return v2:RunSandboxedCode(l_arguments_0.runCodeGuid, v35.requestId);
        end);
        if v16() then
            local v50 = v8.EndRecordingActions(v35.requestId, v44);
            if not ((not v46 or not v50) or not v44) then
                v20[v44] = v45;
            end;
        end;
        local v51 = not v12() and "StreamText" or "StreamTextInNewMessage";
        local v52 = not v12() and "p" or "span";
        if not l_status_1 then
            local v53 = not v14() and "style = \"color:#ff3838\"" or "class=\"errorText\"";
            if not v15() then
                v3:DisplayContent(v51, {
                    requestId = v35.requestId,
                    content = ("\n<%* %*>%*</%*>\n"):format(v52, v53, l_result_1, v52)
                });
            else
                l_result_1 = string.gsub(l_result_1, "([<>&])", "\\%1");
                local v54 = ("id='runCodeResult_%*'"):format(l_arguments_0.runCodeGuid);
                v25(v35.requestId, v54, (("\n<%* %* %*>%*</%*>\n"):format(v52, v53, v54, l_result_1, v52)));
            end;
        else
            local v55 = not v14() and "style = \"color:#73ff57\"" or "class=\"successText\"";
            if not v15() then
                v3:DisplayContent(v51, {
                    requestId = v35.requestId,
                    content = ("\n<%* %*>Code executed successfullyformat(v52, v55, v52)
                });
            else
                local v56 = ("id='runCodeResult_%*'"):format(l_arguments_0.runCodeGuid);
                v25(v35.requestId, v56, (("\n<%* %* %*>Code executed successfullyformat(v52, v55, v56, v52)));
            end;
        end;
        if v10() then
            v4:CodeRunnerCompleted(v35.requestId, l_status_1, l_result_1 or "");
        end;
        if not v16() then
            v8.EndRecordingActions(v35.requestId);
        end;
        return ;
    else
        if not (((not v17() or l_arguments_0.noAutorun) or not v13()) or v3:GetSettings().AutoRunCode) then
            v3:DisplayContent("StreamText", {
                requestId = v35.requestId,
                content = ("%*"):format((v18()))
            });
        end;
        return ;
    end;
end;
if not (not v11() or not v16()) then
    v5.OnUndo:Connect(function(v58)
        local v59 = v20[v58];
        if not (not v59 or v59.hasBeenUndone) then
            v59.hasBeenUndone = true;
            task.delay(5, function()
                if not v59.hasBeenRedone then
                    v4:CodeRunnerUndone(v59.requestId);
                    return ;
                else
                    return ;
                end;
            end);
        end;
    end);
    v5.OnRedo:Connect(function(v60)
        local v61 = v20[v60];
        if not (not v61 or v61.hasBeenRedone) then
            v61.hasBeenRedone = true;
        end;
    end);
end;
return v57;


local l_script_FirstAncestor_0 = script:FindFirstAncestor("StreamingServiceDispatcherRegistry");
local v1 = require(l_script_FirstAncestor_0.Src.Utils.CliAdapter).GetService("StreamingService");
local v2 = require(l_script_FirstAncestor_0.Src.Utils.Utils);
local _ = require(l_script_FirstAncestor_0.Src.Types);
local v4 = require(l_script_FirstAncestor_0.Src.Commands.BuilderCommands.BuilderNameMap);
return function(v5)
    if not v2.isDraftModeEnabled(v5.requestId) then
        v4.activeDraftGuids = {};
        v2.enableDraftMode(v5.requestId);
    end;
    v1:ExecuteCommandAsync(v5.requestId, v5.arguments.command, {
        requestId = v5.requestId,
        arguments = v5.arguments.arguments
    });
end;


local l_script_FirstAncestor_0 = script:FindFirstAncestor("StreamingServiceDispatcherRegistry");
local v1 = require(l_script_FirstAncestor_0.Src.Utils.Utils);
local _ = require(l_script_FirstAncestor_0.Src.Types);
local v3 = require(l_script_FirstAncestor_0.Src.Commands.BuilderCommands.BuilderNameMap);
return function(v4)
    local l_arguments_0 = v4.arguments;
    local v6 = true;
    if l_arguments_0.enabled ~= 1 then
        v6 = l_arguments_0.enabled == true;
    end;
    if not v6 then
        v3.activeDraftGuids = nil;
        v1.disableDraftMode(v4.requestId);
        return ;
    else
        v3.activeDraftGuids = {};
        v1.enableDraftMode(v4.requestId);
        return ;
    end;
end;


local l_script_FirstAncestor_0 = script:FindFirstAncestor("StreamingServiceDispatcherRegistry");
local v1 = require(l_script_FirstAncestor_0.Src.Utils.Utils);
local _ = require(l_script_FirstAncestor_0.Src.Types);
local v3 = require(l_script_FirstAncestor_0.Src.Commands.BuilderCommands.BuilderNameMap);
local function _(v4, v5)
    if v4:IsA("BasePart") then
        v4.Material = v5.BaseMaterial;
        v4.MaterialVariant = v5.Name;
    end;
end;
local function v13(v7, v8)
    local v9 = v3.get(v8.applicationTargetInstanceId, v7.requestId);
    if v9 then
        assert(v9, "Luau");
        local v10 = v3.get(v8.materialId, v7.requestId);
        if v10 then
            assert(v10, "Luau");
            if v10:IsA("MaterialVariant") then
                assert(v10:IsA("MaterialVariant"), "Luau");
                if v9:IsA("BasePart") then
                    v9.Material = v10.BaseMaterial;
                    v9.MaterialVariant = v10.Name;
                end;
                for _, v12 in v9:GetDescendants() do
                    if v12:IsA("BasePart") then
                        v12.Material = v10.BaseMaterial;
                        v12.MaterialVariant = v10.Name;
                    end;
                end;
                v1.modifyChatWithInstanceLink(v7.requestId, v9, ("Applied %* to"):format(v10.Name), "set_material_" .. v7.requestId);
                return ;
            else
                warn((("Bad materialVariant instance from id %*, expected class of MaterialVariant, got %*"):format(v8.materialId, v10.ClassName)));
                return ;
            end;
        else
            warn((("Failed to find material for id %*"):format(v8.materialId)));
            return ;
        end;
    else
        warn((("Failed to find target for id %*"):format(v8.applicationTargetInstanceId)));
        return ;
    end;
end;
return function(v14)
    local l_arguments_0 = v14.arguments;
    assert(type(l_arguments_0.applicationTargetInstanceId) == "string", "Bad request.applicationTargetInstanceId");
    assert(type(l_arguments_0.materialId) == "string", "Bad request.materialId");
    v3.StartRecordingActions(v14.requestId);
    v13(v14, l_arguments_0);
    v3.EndRecordingActions(v14.requestId);
end;


local l_script_FirstAncestor_0 = script:FindFirstAncestor("StreamingServiceDispatcherRegistry");
local v1 = require(l_script_FirstAncestor_0.Src.Utils.CliAdapter).GetService("ScriptEditorService");
local v2 = require(l_script_FirstAncestor_0.Src.Utils.Utils);
local _ = require(l_script_FirstAncestor_0.Src.Types);
local v4 = require(l_script_FirstAncestor_0.Src.Commands.BuilderCommands.BuilderNameMap);
local v5 = require(l_script_FirstAncestor_0.Src.ContextCollectors.RecentInstancesContext);
local v6 = require(l_script_FirstAncestor_0.Src.Flags.getFFlagCAPRecentInstancesContextV2);
local function _(v7, v8)
    if v7:IsA("BasePart") then
        if typeof(v8) == "string" then
            v7.Color = Color3.fromHex(v8);
            return ;
        else
            v7.Color = Color3.fromRGB(v8.r, v8.g, v8.b);
        end;
    end;
end;
local function v15(v10, v11)
    if v10 then
        local v12 = v4.get(v10, v11);
        if not v12 then
            local l_status_0, l_result_0 = pcall(game.GetService, game, v10);
            if not l_status_0 or not l_result_0 then
                if v10 == "workspace" then
                    return workspace;
                elseif v10 == "StarterPlayerScripts" then
                    return game:GetService("StarterPlayer"):FindFirstChildWhichIsA("StarterPlayerScripts");
                elseif v10 == "StarterCharacterScripts" then
                    return game:GetService("StarterPlayer"):FindFirstChildWhichIsA("StarterCharacterScripts");
                end;
            else
                return l_result_0;
            end;
        else
            return v12;
        end;
    end;
end;
return function(v16)
    local l_requestId_0 = v16.requestId;
    local l_arguments_0 = v16.arguments;
    local l_direct_instance_0 = l_arguments_0.direct_instance;
    local v20 = l_direct_instance_0 or v4.get(l_arguments_0.newInstanceId or l_arguments_0.instanceId, l_requestId_0);
    if v20 then
        assert(v20, "Luau");
        if not l_direct_instance_0 then
            v4.StartRecordingActions(l_requestId_0);
        end;
        local v21 = l_arguments_0.properties or {};
        if v21.instanceName then
            v20.Name = v21.instanceName;
        end;
        local v22 = v15(v21.parentInstanceId, l_requestId_0);
        if v22 then
            v20.Parent = v22;
        end;
        if not (not v21.size or not v20:IsA("BasePart")) then
            v20.Size = Vector3.new(v21.size.x, v21.size.y, v21.size.z);
        end;
        if v20:IsA("Model") then
            if v21.scale and v21.scale > 0 then
                v20:ScaleTo(v20:GetScale() * v21.scale);
            elseif v21.height and v21.height > 0.1 then
                local _, v24 = v2.getWorldBoundingBox(v20);
                if v24.Y > 0.1 then
                    v20:ScaleTo(v21.height / v24.Y);
                end;
            elseif v21.size and v21.size.y > 0.1 then
                local _, v26 = v2.getWorldBoundingBox(v20);
                if v26.Y > 0.1 and v21.size.y > 0.1 then
                    v20:ScaleTo(v21.size.y / v26.Y);
                end;
            end;
        end;
        if not (not v21.source or not v20:IsA("Script") and not v20:IsA("ModuleScript")) then
            v1:UpdateSourceAsync(v20, function(_)
                return v21.source;
            end);
        end;
        if v21.color then
            local l_color_0 = v21.color;
            if v20:IsA("BasePart") then
                if typeof(l_color_0) == "string" then
                    v20.Color = Color3.fromHex(l_color_0);
                else
                    v20.Color = Color3.fromRGB(l_color_0.r, l_color_0.g, l_color_0.b);
                end;
            end;
            for _, v30 in v20:GetDescendants() do
                local l_color_1 = v21.color;
                if v30:IsA("BasePart") then
                    if typeof(l_color_1) == "string" then
                        v30.Color = Color3.fromHex(l_color_1);
                    else
                        v30.Color = Color3.fromRGB(l_color_1.r, l_color_1.g, l_color_1.b);
                    end;
                end;
            end;
        end;
        if not (not v21.material or not v20:IsA("BasePart")) then
            v20.Material = Enum.Material[v21.material];
        end;
        if (((l_direct_instance_0 or v21.position) or v21.elevation) or v21.rotation) or v21.referenceInstance then
            v2.getWorldBoundingBox(v20, function(v32)
                local v33 = nil;
                v33 = if not v21.position then CFrame.new(0, 0, 0) else CFrame.new(v21.position.x or 0, 0, v21.position.z or 0);
                local l_positionOrigin_0 = v21.positionOrigin;
                local v35 = v4.get(v21.referenceInstance, l_requestId_0);
                local v36, v37 = v2.getWorldBoundingBox(v35);
                local v38 = CFrame.new();
                local v39 = nil;
                local v40 = nil;
                if l_positionOrigin_0 == "absolute" then
                    v38 = CFrame.new();
                elseif not (l_positionOrigin_0 == "relative") or not v35 then
                    if not (l_positionOrigin_0 == "onTop") or not v35 then
                        local v41, v42 = v2.getRequestCFrame(l_requestId_0);
                        v38 = v41;
                        v40 = v42;
                    else
                        v38 = CFrame.new(v36.Position);
                        v39 = v35;
                    end;
                else
                    v38 = CFrame.new(v36.Position);
                end;
                local v43 = v38:ToWorldSpace(v33);
                local v44 = (-v43.Position.Y + v2.getGroundLevelAt(v43.Position, v39, v37, v40)) + v32:GetExtentsSize().Y / 2;
                if v21.elevation then
                    v44 = v44 + v21.elevation;
                end;
                v43 = v43 + Vector3.new(0, v44, 0);
                if v21.rotation then
                    v43 = CFrame.fromEulerAngles(0, math.rad(v21.rotation), 0) * v43.Rotation + v43.Position;
                end;
                v32:PivotTo(v43);
            end);
        end;
        if not l_direct_instance_0 then
            v4.EndRecordingActions(l_requestId_0);
        end;
        if not v6() then
            v5.registerInstance(v20);
            return ;
        else
            v5.registerInstanceV2(v20, l_requestId_0, v5.getInstanceTypes().Created);
            return ;
        end;
    else
        return ;
    end;
end;


local l_script_FirstAncestor_0 = script:FindFirstAncestor("StreamingServiceDispatcherRegistry");
local _ = require(l_script_FirstAncestor_0.Src.Types);
local l_Commands_0 = l_script_FirstAncestor_0.Src.Commands;
local l_DisplayRichText_0 = l_Commands_0.DisplayRichText;
local l_DisplaySuggestions_0 = l_Commands_0.DisplaySuggestions;
local l_DisplayError_0 = l_Commands_0.DisplayError;
local l_QueueRichText_0 = l_Commands_0.QueueRichText;
local l_BuilderCommands_0 = l_Commands_0.BuilderCommands;
local l_Instantiate_0 = l_BuilderCommands_0.Instantiate;
local l_InsertAsset_0 = l_BuilderCommands_0.InsertAsset;
local l_SetProperty_0 = l_BuilderCommands_0.SetProperty;
local l_CreateMaterial_0 = l_BuilderCommands_0.CreateMaterial;
local l_SetMaterial_0 = l_BuilderCommands_0.SetMaterial;
local l_RemoveInstance_0 = l_BuilderCommands_0.RemoveInstance;
local l_CloneInstance_0 = l_BuilderCommands_0.CloneInstance;
local l_DisplayRegionAdornments_0 = l_BuilderCommands_0.DisplayRegionAdornments;
local l_DebugBulkPublishToInventory_0 = l_BuilderCommands_0.DebugBulkPublishToInventory;
local l_SetDraftMode_0 = l_BuilderCommands_0.SetDraftMode;
local l_RunDraftCommand_0 = l_BuilderCommands_0.RunDraftCommand;
local l_DebugSleep_0 = l_BuilderCommands_0.DebugSleep;
local l_RunCode_0 = l_BuilderCommands_0.RunCode;
local v21 = require(l_script_FirstAncestor_0.Src.Flags.getFFlagConvAICodeRunner);
local v22 = {
    parallel = {
        [l_DisplayRichText_0.Name] = require(l_DisplayRichText_0),
        [l_DisplayError_0.Name] = require(l_DisplayError_0),
        [l_DisplayRegionAdornments_0.Name] = require(l_DisplayRegionAdornments_0),
        InsertAssetInstant = require(l_InsertAsset_0),
        SetPropertyInstant = require(l_SetProperty_0),
        InstantiateInstant = require(l_Instantiate_0)
    },
    sequential = {
        [l_Instantiate_0.Name] = require(l_Instantiate_0),
        [l_InsertAsset_0.Name] = require(l_InsertAsset_0),
        [l_SetProperty_0.Name] = require(l_SetProperty_0),
        [l_QueueRichText_0.Name] = require(l_QueueRichText_0),
        [l_CreateMaterial_0.Name] = require(l_CreateMaterial_0),
        [l_SetMaterial_0.Name] = require(l_SetMaterial_0),
        [l_DebugBulkPublishToInventory_0.Name] = require(l_DebugBulkPublishToInventory_0),
        [l_DisplaySuggestions_0.Name] = require(l_DisplaySuggestions_0),
        [l_RemoveInstance_0.Name] = require(l_RemoveInstance_0),
        [l_CloneInstance_0.Name] = require(l_CloneInstance_0),
        [l_SetDraftMode_0.Name] = require(l_SetDraftMode_0),
        [l_RunDraftCommand_0.Name] = require(l_RunDraftCommand_0),
        [l_DebugSleep_0.Name] = require(l_DebugSleep_0)
    }
};
if v21() then
    v22.sequential[l_RunCode_0.Name] = require(l_RunCode_0);
end;
return v22;


local l_script_FirstAncestor_0 = script:FindFirstAncestor("StreamingServiceDispatcherRegistry");
local v1 = require(l_script_FirstAncestor_0.Src.Utils.CliAdapter);
local v2 = v1.GetService("ChatbotUIService");
local v3 = v1.GetService("ConversationalAIAcceptanceService");
local _ = require(l_script_FirstAncestor_0.Src.Types);
local v5 = require(l_script_FirstAncestor_0.Src.Localization.Localization);
local v6 = require(l_script_FirstAncestor_0.Src.Flags.getFFlagEndRequestWhenDisplayErrorMessage);
local v7 = require(l_script_FirstAncestor_0.Src.Flags.getFIntConvAIMaxQuotaTimeout);
local v8 = require(l_script_FirstAncestor_0.Src.Flags.getFIntConvAIServersAtMaxCapacityTimeout);
local function _(v9, v10)
    return v5:getText("ErrorMessage", v9[math.random(1, #v9)], v10);
end;
local function _(v12, v13)
    v2:DisplayContent("StreamText", {
        requestId = v12,
        content = v13
    });
end;
local function _(v15, v16, v17)
    v2:DisplayContent("SetErrorMessage", {
        message = v15,
        disableInput = v16,
        timeout = v17
    });
end;
local v42 = {
    function(v19, v20)
        if v20.errorId == "RawErrorMessage" then
            v2:DisplayContent("StreamText", {
                requestId = v19,
                content = v20.content
            });
            return true;
        else
            return false;
        end;
    end,
    function(_, v22)
        if v22.errorId == "RawErrorStatusBar" then
            v2:DisplayContent("SetStatusBarMessage", {
                message = v22.content or "",
                disableInput = v22.disableInput or false,
                timeout = v22.timeout or 0
            });
            return true;
        else
            return false;
        end;
    end,
    function(v23, v24)
        if v24.errorId == "InappropriateRequest" then
            local v25 = string.format("
%s", "https://en.help.roblox.com/hc/en-us/articles/203313410-Roblox-Community-Standards", "https://en.help.roblox.com/hc/en-us/articles/203313410-Roblox-Community-Standards");
            local v26 = {
                "InappropriateRequestOne1",
                "InappropriateRequestTwo1"
            };
            v2:DisplayContent("StreamText", {
                requestId = v23,
                content = v5:getText("ErrorMessage", v26[math.random(1, #v26)], {
                    url = v25
                })
            });
            return true;
        else
            return false;
        end;
    end,
    function(_, v28)
        if v28.errorId == "QuotaError" then
            local v29 = {
                "QuotaErrorOne",
                "QuotaErrorTwo",
                "QuotaErrorThree"
            };
            v2:DisplayContent("SetErrorMessage", {
                message = v5:getText("ErrorMessage", v29[math.random(1, #v29)], nil),
                disableInput = true,
                timeout = v7()
            });
            return true;
        else
            return false;
        end;
    end,
    function(v30, v31)
        if v31.errorId == "ConnectionLost" then
            local v32 = {
                "ConnectionLostOne",
                "ConnectionLostTwo"
            };
            v2:DisplayContent("StreamText", {
                requestId = v30,
                content = v5:getText("ErrorMessage", v32[math.random(1, #v32)], nil)
            });
            return true;
        else
            return false;
        end;
    end,
    function(_, v34)
        if v34.errorId == "ServersAtMaxCapacity" then
            local v35 = {
                "ServersAtMaxCapacity"
            };
            v2:DisplayContent("SetErrorMessage", {
                message = v5:getText("ErrorMessage", v35[math.random(1, #v35)], nil),
                disableInput = true,
                timeout = v8()
            });
            return true;
        else
            return false;
        end;
    end,
    function(v36, v37)
        if v37.errorId == "GeneralError" then
            local v38 = {
                "GeneralError"
            };
            v2:DisplayContent("StreamText", {
                requestId = v36,
                content = v5:getText("ErrorMessage", v38[math.random(1, #v38)], nil)
            });
            return true;
        else
            return false;
        end;
    end,
    function(v39, v40)
        if v40.errorId == "StreamingServiceError" then
            if v40.errorType == "HttpFailed" and tonumber(v40.errorMessage) ~= 200 then
                local v41 = {
                    "ConnectionLostOne",
                    "ConnectionLostTwo"
                };
                v2:DisplayContent("StreamText", {
                    requestId = v39,
                    content = v5:getText("ErrorMessage", v41[math.random(1, #v41)], nil)
                });
            end;
            return true;
        else
            return false;
        end;
    end
};
return function(v43)
    local l_arguments_0 = v43.arguments;
    for _, v46 in ipairs(v42) do
        if v46(v43.requestId or "", l_arguments_0) then
            v3:ErrorTelemetry(v43.requestId or "", l_arguments_0.errorId or "UnknownError");
            break;
        end;
    end;
    if v6() then
        v2:DisplayContent("EndRequest", {
            requestId = v43.requestId
        });
    end;
end;


local l_script_FirstAncestor_0 = script:FindFirstAncestor("StreamingServiceDispatcherRegistry");
local v1 = require(l_script_FirstAncestor_0.Src.Utils.CliAdapter);
local v2 = v1.GetService("ChatbotUIService");
local v3 = v1.GetService("StreamingService");
local v4 = require(l_script_FirstAncestor_0.Packages.Cryo);
local _ = require(l_script_FirstAncestor_0.Src.Types);
local v6 = require(l_script_FirstAncestor_0.Src.Cache.StreamCache);
local v7 = require(l_script_FirstAncestor_0.Src.Flags.getFFlagConvAIDropdownGenerationIndicator);
local v8 = require(l_script_FirstAncestor_0.Src.Flags.getFFlagConvAIStreamableCommands);
return function(v9)
    local l_requestId_0 = v9.requestId;
    local l_arguments_0 = v9.arguments;
    local l_streamId_0 = l_arguments_0.text.streamId;
    if not (not v1.RunningEval or l_streamId_0) and type(l_arguments_0.text) == "string" then
        print((("<< DisplayText got collapsed stream >> \n%*\n<< /DisplayText >>"):format(l_arguments_0.text)));
        return ;
    else
        v6.requestStreamSubscription(l_requestId_0, l_streamId_0, true, function(v13)
            if not v13.isFinal then
                local _ = nil;
                v3:InvokeCommand(l_requestId_0, "QueueRichText", if not v8() then {
                    requestId = l_requestId_0,
                    arguments = {
                        "StreamText",
                        v4.Dictionary.join({
                            requestId = l_requestId_0,
                            streamId = l_streamId_0
                        }, v13)
                    }
                } else {
                    requestId = l_requestId_0,
                    arguments = {
                        v13.command,
                        v13.command == "DisplayContent" and "StreamText" or nil,
                        v4.Dictionary.join({
                            requestId = l_requestId_0,
                            streamId = l_streamId_0
                        }, v13)
                    }
                });
                return ;
            else
                return ;
            end;
        end, function(v15)
            v2:DisplayContent("MessageBubble", {
                requestId = v15,
                streamId = l_streamId_0
            });
        end, function()
            if v7() then
                local _ = nil;
                v3:InvokeCommand(l_requestId_0, "QueueRichText", if not v8() then {
                    requestId = l_requestId_0,
                    arguments = {
                        "StreamEnded",
                        {
                            requestId = l_requestId_0,
                            streamId = l_streamId_0
                        }
                    }
                } else {
                    requestId = l_requestId_0,
                    arguments = {
                        "DisplayContent",
                        "StreamEnded",
                        {
                            requestId = l_requestId_0,
                            streamId = l_streamId_0
                        }
                    }
                });
            end;
        end);
        return ;
    end;
end;


local l_script_FirstAncestor_0 = script:FindFirstAncestor("StreamingServiceDispatcherRegistry");
local v1 = require(l_script_FirstAncestor_0.Src.Utils.CliAdapter).GetService("ChatbotUIService");
local _ = require(l_script_FirstAncestor_0.Src.Types);
return function(v3)
    v1:DisplayContent("DisplaySuggestions", v3.arguments);
end;


local l_script_FirstAncestor_0 = script:FindFirstAncestor("StreamingServiceDispatcherRegistry");
local v1 = require(l_script_FirstAncestor_0.Src.Utils.CliAdapter);
local v2 = v1.GetService("ChatbotUIService");
local v3 = v1.GetService("StreamingService");
local _ = require(l_script_FirstAncestor_0.Src.Types);
local v5 = require(l_script_FirstAncestor_0.Src.Flags.getFFlagConvAIStreamableCommands);
return function(v6)
    if not v5() then
        v2:DisplayContent(unpack(v6.arguments));
        return ;
    else
        local v7, v8, v9 = unpack(v6.arguments);
        if v7 == "DisplayContent" then
            v2:DisplayContent(v8, v9);
            return ;
        else
            v3:ExecuteCommandAsync(v6.requestId, v7, v9);
            return ;
        end;
    end;
end;


local l_script_FirstAncestor_0 = script:FindFirstAncestor("StreamingServiceDispatcherRegistry");
local v1 = require(l_script_FirstAncestor_0.Src.Utils.CliAdapter);
local v2 = v1.GetService("StreamingService");
local v3 = v1.GetService("ChatbotUIService");
local v4 = v1.GetService("ConversationalAIAcceptanceService");
local v5 = v1.GetService("Selection");
local v6 = v1.GetService("HttpService");
local v7 = require(l_script_FirstAncestor_0.Src.Utils.Utils);
local v8 = require(l_script_FirstAncestor_0.Src.Commands.BuilderCommands.BuilderNameMap);
local v9 = require(script.Parent.RecentInstancesContext);
local v10 = {};
local v11 = require(l_script_FirstAncestor_0.Src.Flags.getFFlagShowViewportContextVisualization);
local v12 = require(l_script_FirstAncestor_0.Src.Flags.getFFlagDebugConvAIEnableAudioCapabilities);
local v13 = require(l_script_FirstAncestor_0.Src.Flags.getFFlagCAPRecentInstancesContextV2);
local v14 = require(l_script_FirstAncestor_0.Src.Flags.getFIntCAPRecentSelectedInstanceCount);
local v15 = require(l_script_FirstAncestor_0.Src.Flags.getFFlagCAPDMHierarchyIncludePosition);
local v16 = require(l_script_FirstAncestor_0.Src.Flags.getFIntViewportContextCollectionHeight);
local v17 = require(l_script_FirstAncestor_0.Src.Flags.getFIntMaxContextAllowedFromSelection);
local v18 = require(l_script_FirstAncestor_0.Src.Flags.getFIntMaxContextAllowedFromViewport);
local v19 = require(l_script_FirstAncestor_0.Src.Flags.getFIntViewportRootMaxAreaFactor);
local v20 = require(l_script_FirstAncestor_0.Src.Flags.getFIntCAPDMHierarchySelectedMaxDepth);
local v21 = require(l_script_FirstAncestor_0.Src.Flags.getFIntCAPDMHierarchyDefaultDepth);
local v22 = require(l_script_FirstAncestor_0.Src.Flags.getFIntCAPDMHierarchyGlobalContainerDepth);
local v23 = require(l_script_FirstAncestor_0.Src.Flags.getFIntCAPDMHierarchyMaxBytes);
local v24 = OverlapParams.new();
v24.BruteForceAllSlow = true;
local v25 = {
    ServerScriptService = true,
    ReplicatedStorage = true,
    ReplicatedFirst = true,
    Workspace = true,
    StarterGui = true,
    StarterPlayer = true
};
local function v30(v26, v27)
    local v28, v29 = v7.getPositionAndSize(v26, v27);
    if v28 and v29 then
        return {
            x = math.ceil(v28.X * 100) / 100,
            y = math.ceil(v28.Y * 100) / 100,
            z = math.ceil(v28.Z * 100) / 100
        }, {
            x = math.ceil(v29.X * 100) / 100,
            y = math.ceil(v29.Y * 100) / 100,
            z = math.ceil(v29.Z * 100) / 100
        };
    else
        return ;
    end;
end;
local function v36(v31, v32, v33)
    if v11() then
        local v34, v35 = v7.getPositionAndSize(v32, v33);
        if not (not v34 or not v35) then
            v7.addConstraintVisualization(v31, v33:ToWorldSpace(CFrame.new(v34)), v35, true, Color3.fromRGB(0, 170, 255));
        end;
    end;
end;
local function _(v37, v38)
    return (v37:IsA("Script") or v37:IsA("ModuleScript")) and (v38.isSelected or v38.isRecent);
end;
local function v53(v40, v41, v42)
    local v43 = v18();
    local v44 = v19() / 100;
    local v45 = {};
    local v46 = 0;
    for _, v48 in v40, nil, nil do
        if v43 > v46 then
            local l_v48_0 = v48;
            if (l_v48_0.Size.X * l_v48_0.Size.Z) / v41 <= 1 then
                while true do
                    local l_Parent_0 = l_v48_0.Parent;
                    if l_Parent_0 and l_Parent_0 ~= workspace then
                        local _, v52 = v30(l_Parent_0, v42);
                        if v44 >= (v52.x * v52.z) / v41 then
                            l_v48_0 = l_Parent_0;
                        else
                            break;
                        end;
                    else
                        break;
                    end;
                end;
                if not v45[l_v48_0] then
                    v45[l_v48_0] = l_v48_0;
                    v46 = v46 + 1;
                end;
            end;
        else
            break;
        end;
    end;
    return v45;
end;
local function v62(v54, v55, v56)
    local v57 = {};
    for _, v59 in (v53(workspace:GetPartBoundsInBox(v55, v56, v24), v56.X * v56.Z, v55)), nil, nil do
        v36(v54, v59, v55);
        local v60, v61 = v30(v59, v55);
        table.insert(v57, {
            instanceId = v59,
            assetId = if v59.SourceAssetId > 0 then v59.SourceAssetId else nil,
            size = {
                x = v61.x,
                z = v61.z
            },
            pos = {
                x = v60.x,
                z = v60.z
            }
        });
        v8.guid2instance[v59:GetDebugId()] = v59;
    end;
    return v57;
end;
local v63 = 0;
generateHierarchy = function(v64, v65, v66, v67)
    local v68 = {
        instanceId = v64,
        instanceName = v64.Name,
        className = v64.ClassName,
        assetId = if v64.SourceAssetId > 0 then v64.SourceAssetId else nil,
        attributes = v7.getInstanceAttributes(v64)
    };
    if v15() then
        local v69, v70 = v30(v64, v66);
        v68.pos = v69;
        v68.size = v70;
    end;
    if v65[v64] then
        v68.isSelected = true;
    end;
    if not v13() then
        if not (not v67 or not v67[v64]) then
            v68.isRecent = true;
        end;
    elseif not ((not v67 or not v67[v64]) or v68.isSelected) then
        v68.isRecent = true;
    end;
    if not v13() then
        if v64:IsA("Script") then
            v68.scriptSource = v64.Source;
        end;
    elseif (v64:IsA("Script") or v64:IsA("ModuleScript")) and (v68.isSelected or v68.isRecent) then
        v68.scriptSource = v64.Source;
    end;
    v68.children = {};
    local v71 = false;
    for _, v73 in ipairs(v64:GetChildren()) do
        local v74 = generateHierarchy(v73, v65, v66, v67);
        if v74 then
            table.insert(v68.children, v74);
            if not v13() then
                if not (not v74.isSelected and not v74.isRecent) then
                    v71 = true;
                end;
            else
                v71 = true;
            end;
        end;
    end;
    if not v13() then
        if ((v68.isSelected or v68.isRecent) or v71) or next(v68.children) ~= nil then
            return v68;
        else
            return nil;
        end;
    elseif not (v68.isSelected or v68.isRecent) and not v71 then
        return nil;
    else
        return v68;
    end;
end;
populateChildren = function(v75, v76, v77, v78)
    if v75 then
        if not v75.isSelected and not v75.isRecent then
            for _, v80 in ipairs(v75.children) do
                populateChildren(v80, v80.instanceId, v77, v78);
            end;
            return ;
        else
            local v81 = {};
            for _, v83 in ipairs(v75.children) do
                table.insert(v81, v83);
            end;
            populateChildrenRecursive(v75, v76, v77, v78);
            for _, v85 in ipairs(v81) do
                populateChildren(v85, v85.instanceId, v77, v78);
            end;
            return ;
        end;
    else
        return ;
    end;
end;
populateChildrenRecursive = function(v86, v87, v88, v89)
    if v89 <= 0 then
        return ;
    else
        local v90 = {};
        for _, v92 in ipairs(v86.children) do
            v90[v92.instanceId] = v92;
        end;
        for _, v94 in ipairs(v87:GetChildren()) do
            local v95 = {
                instanceId = v94,
                instanceName = v94.Name,
                className = v94.ClassName,
                assetId = v94.SourceAssetId > 0 and v94.SourceAssetId or nil,
                attributes = v7.getInstanceAttributes(v94)
            };
            if v15() then
                local v96, v97 = v30(v94, v88);
                v95.pos = v96;
                v95.size = v97;
            end;
            if not v13() then
                if v94:IsA("Script") then
                    v95.scriptSource = v94.Source;
                end;
            elseif (v94:IsA("Script") or v94:IsA("ModuleScript")) and (v95.isSelected or v95.isRecent) then
                v95.scriptSource = v94.Source;
            end;
            v95.children = {};
            local v98 = string.len((v6:JSONEncode(v95)));
            if v90[v94] then
                populateChildrenRecursive(v90[v94], v94, v88, v89 - 1);
            elseif v23() < v63 + v98 then
                return ;
            else
                table.insert(v86.children, v95);
                v63 = v63 + v98;
                populateChildrenRecursive(v95, v94, v88, v89 - 1);
            end;
        end;
        return ;
    end;
end;
populateMissingGlobalContainers = function(v99, v100, v101, v102)
    local v103 = {};
    for _, v105 in ipairs(v99.children) do
        v103[v105.instanceName] = v105;
    end;
    for v106, _ in pairs(v25) do
        local l_v100_FirstChild_0 = v100:FindFirstChild(v106);
        if v103[v106] or not l_v100_FirstChild_0 then
            if l_v100_FirstChild_0 then
                populateChildrenRecursive(v103[v106], l_v100_FirstChild_0, v101, v102);
            end;
        else
            local v109 = {
                instanceId = l_v100_FirstChild_0,
                instanceName = v106,
                className = l_v100_FirstChild_0.ClassName,
                children = {}
            };
            populateChildrenRecursive(v109, l_v100_FirstChild_0, v101, v102);
            table.insert(v99.children, v109);
        end;
    end;
end;
v10.register = function()
    v2:RegisterContextCollector("DefaultContextCollector", function(v110)
        v63 = 0;
        local v111 = {};
        local v112 = v5:Get();
        local v113 = v7.getRequestCFrame(v110);
        local v114 = {};
        if #v112 > 0 then
            local v115 = v17();
            v111.Selected = {};
            for v116, v117 in v112, nil, nil do
                if v115 >= v116 then
                    v114[v117] = true;
                    local v118, v119 = v30(v117, v113);
                    v8.guid2instance[v117:GetDebugId()] = v117;
                    table.insert(v111.Selected, {
                        instanceId = v117,
                        className = v117.ClassName,
                        instanceName = v117.Name,
                        assetId = if v117.SourceAssetId > 0 then v117.SourceAssetId else nil,
                        attributes = v7.getInstanceAttributes(v117),
                        size = v119,
                        pos = v118
                    });
                else
                    break;
                end;
            end;
        end;
        local v120 = {};
        if not v13() then
            v120 = v9.fetchContext();
            if #v120 > 0 then
                v111.Recent = v120;
            end;
        else
            v9.syncContext();
            v120 = v9.fetchContextV2();
        end;
        local v121 = nil;
        local _ = nil;
        v121 = tick();
        local v123 = {};
        for _, v125 in ipairs(v120) do
            v123[v125.instanceId] = true;
        end;
        if not (next(v114) == nil) or next(v123) ~= nil then
            v111.Hierarchy = generateHierarchy(game, v114, v113, v123);
            v63 = string.len((v6:JSONEncode(v111.Hierarchy)));
            populateChildren(v111.Hierarchy, game, v113, v20());
            if not v111.Hierarchy then
                v111.Hierarchy = {
                    instanceId = game,
                    instanceName = game.Name,
                    className = game.ClassName,
                    children = {}
                };
            end;
            populateMissingGlobalContainers(v111.Hierarchy, game, v113, v22());
        else
            local v126 = {
                instanceId = game,
                instanceName = game.Name,
                className = game.ClassName,
                children = {}
            };
            populateMissingGlobalContainers(v126, game, v113, v21());
            v111.Hierarchy = v126;
        end;
        if v13() then
            local v127 = v9.getInstanceTypes();
            local v128 = 0;
            for v129, _ in pairs(v114) do
                if v14() > v128 then
                    v9.registerInstanceV2(v129, v110, v127.Selected);
                    v128 = v128 + 1;
                else
                    break;
                end;
            end;
        end;
        v4:DataModelHierarchyLatency(v110, tick() - v121);
        v111.use_inventory_assets = v3:GetSettings().UseInventoryAssets;
        v111.enable_audio_capabilities = not not v12() or nil;
        return v111;
    end);
    v2:RegisterContextCollector("ViewportContextCollector", function(v131)
        v7.getRequestCFrame(v131);
        local v132 = v8.GetRequestMetadata(v131, "RequestCFrame");
        local v133 = v8.GetRequestMetadata(v131, "PlacementSize");
        return {
            placement_area = {
                x = v133.X,
                z = v133.Z
            },
            viewport_instances = v62(v131, v132, (Vector3.new(v133.X, v16(), v133.Z)))
        };
    end);
end;
v10.unregister = function()
    v2:UnregisterContextCollector("DefaultContextCollector");
    v2:UnregisterContextCollector("ViewportContextCollector");
end;
return v10;


local l_script_FirstAncestor_0 = script:FindFirstAncestor("StreamingServiceDispatcherRegistry");
local v1 = require(l_script_FirstAncestor_0.Src.Flags.getFFlagCAPRecentInstancesContextV2);
local v2 = require(l_script_FirstAncestor_0.Src.Utils.Utils);
local v3 = {};
local v4 = {};
local v5 = {
    Workspace = true,
    ReplicatedStorage = true,
    ReplicatedFirst = true,
    ServerScriptService = true,
    ServerStorage = true,
    StarterGui = true,
    StarterPack = true,
    StarterPlayer = true,
    StarterPlayerScripts = true,
    StarterCharacterScripts = true
};
local v6 = {
    Created = "Created",
    Selected = "Selected",
    ScriptAttached = "ScriptAttached"
};
v3.getInstanceTypes = function()
    return v6;
end;
v3.registerInstance = function(v7)
    table.insert(v4, 1, {
        instanceId = v7,
        className = v7.ClassName,
        instanceName = v7.Name,
        assetId = if v7.SourceAssetId > 0 then v7.SourceAssetId else nil,
        attributes = v2.getInstanceAttributes(v7)
    });
end;
v3.registerInstanceV2 = function(v8, v9, v10)
    if not v5[v8.ClassName] then
        if v8:IsA("Script") and v10 == v6.Created then
            v3.registerInstanceV2(v8.Parent, v9, v6.ScriptAttached);
        end;
        v4[v8] = {
            instanceId = v8,
            className = v8.ClassName,
            instanceName = v8.Name,
            assetId = if v8.SourceAssetId > 0 then v8.SourceAssetId else nil,
            attributes = v2.getInstanceAttributes(v8),
            instanceType = v10,
            requestId = v9
        };
        return ;
    else
        return ;
    end;
end;
v3.fetchContext = function()
    return v4;
end;
v3.fetchContextV2 = function()
    assert(v1(), "RecentInstancesContextV2 is not enabled");
    local v11 = {};
    for _, v13 in pairs(v4) do
        table.insert(v11, v13);
    end;
    return v11;
end;
v3.syncContext = function()
    for v14, _ in pairs(v4) do
        if v14.Parent == nil then
            v4[v14] = nil;
        end;
    end;
end;
v3.clear = function()
    v4 = {};
end;
return v3;


game:DefineFastFlag("AICOChatBot", false);
return function()
    return game:GetFastFlag("AICOChatBot");
end;


game:DefineFastFlag("AutoNormalizeBoundingBoxesForInsertedAssets", false);
return function()
    return game:GetFastFlag("AutoNormalizeBoundingBoxesForInsertedAssets");
end;


game:DefineFastFlag("AutoUnlockInsertedAssets", false);
return function()
    return game:GetFastFlag("AutoUnlockInsertedAssets");
end;


game:DefineFastFlag("CAPDMHierarchyIncludeAttributes", false);
return function()
    return game:GetFastFlag("CAPDMHierarchyIncludeAttributes");
end;


game:DefineFastFlag("CAPDMHierarchyIncludePosition", false);
return function()
    return game:GetFastFlag("CAPDMHierarchyIncludePosition");
end;


game:DefineFastFlag("CAPInstanceTrackerForUndoTelemetry2", false);
return function()
    return game:GetFastFlag("CAPInstanceTrackerForUndoTelemetry2");
end;


game:DefineFastFlag("CAPRecentInstancesContextV2", false);
return function()
    return game:GetFastFlag("CAPRecentInstancesContextV2");
end;


game:DefineFastFlag("CLI88299", false);
return function()
    return game:GetFastFlag("CLI88299");
end;


game:DefineFastFlag("ConvAIAssetCreditAttributes", false);
return function()
    return game:GetFastFlag("ConvAIAssetCreditAttributes");
end;


game:DefineFastFlag("ConvAICodeRunner5", false);
return function()
    return game:GetFastFlag("ConvAICodeRunner5");
end;


game:DefineFastFlag("ConvAICodeRunnerBetterResultMessages", false);
return function()
    return game:GetFastFlag("ConvAICodeRunnerBetterResultMessages");
end;


game:DefineFastFlag("ConvAICodeRunnerLocalAutorunWarning", false);
return function()
    return game:GetFastFlag("ConvAICodeRunnerLocalAutorunWarning");
end;


game:DefineFastFlag("ConvAICodeRunnerTelemetry2", false);
return function()
    return game:GetFastFlag("ConvAICodeRunnerTelemetry2");
end;


game:DefineFastFlag("ConvAICodeRunnerUX4", false);
return function()
    return game:GetFastFlag("ConvAICodeRunnerUX4");
end;


game:DefineFastFlag("ConvAICodeRunnerUndoTelemetry2", false);
return function()
    return game:GetFastFlag("ConvAICodeRunnerUndoTelemetry2");
end;


game:DefineFastFlag("ConvAICodeRunnerUniqueRecordings", false);
return function()
    return game:GetFastFlag("ConvAICodeRunnerUniqueRecordings");
end;


game:DefineFastFlag("ConvAICodeRunnerUseThemeColors", false);
return function()
    return game:GetFastFlag("ConvAICodeRunnerUseThemeColors");
end;


game:DefineFastFlag("ConvAIDropdownGenerationIndicator4", false);
return function()
    return game:GetFastFlag("ConvAIDropdownGenerationIndicator4");
end;


game:DefineFastFlag("ConvAIFirstVariationFix", false);
return function()
    return game:GetFastFlag("ConvAIFirstVariationFix");
end;


game:DefineFastFlag("ConvAIMenu_Attrib2", false);
return function()
    return game:GetFastFlag("ConvAIMenu_Attrib2");
end;


game:DefineFastFlag("ConvAISettingAutoRunCode2", false);
return function()
    return game:GetFastFlag("ConvAISettingAutoRunCode2");
end;


game:DefineFastFlag("ConvAIStreamableCommands", false);
return function()
    return game:GetFastFlag("ConvAIStreamableCommands");
end;


game:DefineFastFlag("ConvAI_ConditionalDropdown", false);
return function()
    return game:GetFastFlag("ConvAI_ConditionalDropdown");
end;


game:DefineFastFlag("ConvoAIDisableAssetScripts", false);
return function()
    return game:GetFastFlag("ConvoAIDisableAssetScripts");
end;


game:DefineFastFlag("DebugConvAIEnableAudioCapabilities", false);
return function()
    return game:GetFastFlag("DebugConvAIEnableAudioCapabilities");
end;


game:DefineFastFlag("EndRequestWhenDisplayErrorMessage", false);
return function()
    return game:GetFastFlag("EndRequestWhenDisplayErrorMessage");
end;


game:DefineFastFlag("FixAssistantEvalLocalization", false);
return function()
    return game:GetFastFlag("FixAssistantEvalLocalization");
end;


game:DefineFastFlag("FixAssistantLuaTests", false);
return function()
    return game:GetFastFlag("FixAssistantLuaTests");
end;


game:DefineFastFlag("MaterialGenErrorTextFiltered", false);
return function()
    return game:GetFastFlag("MaterialGenErrorTextFiltered");
end;


return function()
    return game:GetFastFlag("MaterialGeneratorNewServiceAsyncApi");
end;


game:DefineFastFlag("RemoveHintsAndMessagesFromInsertion", false);
return function()
    return game:GetFastFlag("RemoveHintsAndMessagesFromInsertion");
end;


game:DefineFastFlag("RunCommandsInCodeAssist", false);
return function()
    return game:GetFastFlag("RunCommandsInCodeAssist");
end;


game:DefineFastFlag("ShowViewportContextVisualization", false);
return function()
    return game:GetFastFlag("ShowViewportContextVisualization");
end;


game:DefineFastInt("CAPDMHierarchyDefaultDepth", 2);
return function()
    return game:GetFastInt("CAPDMHierarchyDefaultDepth");
end;


game:DefineFastInt("CAPDMHierarchyGlobalContainerDepth", 2);
return function()
    return game:GetFastInt("CAPDMHierarchyGlobalContainerDepth");
end;


game:DefineFastInt("CAPDMHierarchyMaxAttributesSize", 32);
return function()
    return game:GetFastInt("CAPDMHierarchyMaxAttributesSize");
end;


game:DefineFastInt("CAPDMHierarchyMaxBytes", 100000);
return function()
    return game:GetFastInt("CAPDMHierarchyMaxBytes");
end;


game:DefineFastInt("CAPDMHierarchySelectedMaxDepth", 10);
return function()
    return game:GetFastInt("CAPDMHierarchySelectedMaxDepth");
end;


game:DefineFastInt("CAPRecentSelectedInstanceCount", 3);
return function()
    return game:GetFastInt("CAPRecentSelectedInstanceCount");
end;


game:DefineFastInt("ConvAIMaxQuotaTimeout", 900000);
return function()
    return game:GetFastInt("ConvAIMaxQuotaTimeout");
end;


game:DefineFastInt("ConvAIServersAtMaxCapacityTimeout", 900000);
return function()
    return game:GetFastInt("ConvAIServersAtMaxCapacityTimeout");
end;


game:DefineFastInt("MaxContextAllowedFromSelection", 50);
return function()
    return game:GetFastInt("MaxContextAllowedFromSelection");
end;


game:DefineFastInt("MaxContextAllowedFromViewport", 50);
return function()
    return game:GetFastInt("MaxContextAllowedFromViewport");
end;


game:DefineFastInt("MaxRegionFenceHeight", 500);
return function()
    return game:GetFastInt("MaxRegionFenceHeight");
end;


game:DefineFastInt("MaxRequestAreaSizeRatio", 200);
return function()
    return game:GetFastInt("MaxRequestAreaSizeRatio");
end;


game:DefineFastInt("ViewportContextCollectionHeight", 100);
return function()
    return game:GetFastInt("ViewportContextCollectionHeight");
end;


game:DefineFastInt("ViewportRootMaxAreaFactor", 30);
return function()
    return game:GetFastInt("ViewportRootMaxAreaFactor");
end;


game:DefineFastString("ConvAICodeRunnerAutorunDisabledWarning", "Warning: the action was not executed: auto-run was disabled by user.\nPlease review the code and press the Play button to run it.");
return function()
    return game:GetFastString("ConvAICodeRunnerAutorunDisabledWarning");
end;