local l_Parent_0 = script.Parent.Parent.Parent;
local v1 = require(l_Parent_0.Packages.Dash);
local v2 = require(l_Parent_0.Packages.Rodux);
local l_Actions_0 = l_Parent_0.Src.Actions;
local v4 = require(l_Actions_0.DoneGeneratingImages);
local v5 = require(l_Actions_0.MergeFilteredTextPrompt);
local v6 = require(l_Actions_0.SetGeneratingImages);
local v7 = require(l_Actions_0.SetGenerationError);
local v8 = require(l_Actions_0.SetIsSavingMaterial);
local v9 = require(l_Actions_0.SetTextPrompt);
local v10 = require(l_Parent_0.Src.Util.tryReplaceFirstText);
local v11 = require(l_Parent_0.Src.Enum.GenerationErrorType);
local l_join_0 = v1.join;
return (v2.createReducer({
    isGeneratingImages = false,
    generatingImages = 0,
    isSavingMaterial = false,
    textPrompt = "",
    generationError = {
        generationErrorType = v11.None,
        message = nil
    }
}, {
    [v6.name] = function(v13, v14)
        return l_join_0(v13, {
            generatingImages = v14.amount
        });
    end,
    [v4.name] = function(v15, _)
        return l_join_0(v15, {
            generatingImages = 0
        });
    end,
    [v7.name] = function(v17, v18)
        return l_join_0(v17, {
            generationError = {
                generationErrorType = v18.generationErrorType,
                message = v18.message or v1.None
            }
        });
    end,
    [v8.name] = function(v19, v20)
        return l_join_0(v19, {
            isSavingMaterial = v20.isSavingMaterial
        });
    end,
    [v9.name] = function(v21, v22)
        return l_join_0(v21, {
            textPrompt = v22.textPrompt
        });
    end,
    [v5.name] = function(v23, v24)
        if v24.original == v24.filteredText then
            return v23;
        else
            local v25 = v10(v23.textPrompt, v24.original, v24.filteredText);
            if not v25 then
                return v23;
            else
                return l_join_0(v23, {
                    textPrompt = v25
                });
            end;
        end;
    end
}));


local l_Parent_0 = script.Parent.Parent.Parent;
return (require(l_Parent_0.Packages.Rodux).combineReducers({
    AppStateReducer = require(l_Parent_0.Src.Reducers.AppStateReducer),
    MaterialsReducer = require(l_Parent_0.Src.Reducers.MaterialsReducer)
}));


local l_Parent_0 = script.Parent.Parent.Parent;
local v1 = require(l_Parent_0.Packages.Dash);
local v2 = require(l_Parent_0.Packages.Rodux);
local _ = require(l_Parent_0.Src.Types);
local l_Actions_0 = l_Parent_0.Src.Actions;
local v5 = require(l_Actions_0.AddGeneratedMaterials);
local v6 = require(l_Actions_0.ClearSelectedMaterial);
local v7 = require(l_Actions_0.MarkAsSaved);
local v8 = require(l_Actions_0.RemoveAllMaterials);
local v9 = require(l_Actions_0.DEPRECATED_RemoveMaterial);
local v10 = require(l_Actions_0.SetBaseMaterial);
local v11 = require(l_Actions_0.SetMaterialGenerationSession);
local v12 = require(l_Actions_0.SetMaterials);
local v13 = require(l_Actions_0.SetSelectedMaterial);
local v14 = require(l_Actions_0.UpdateMaterialTextures);
local v15 = require(l_Actions_0.SetInitialImageId);
local v16 = require(l_Parent_0.Src.Flags.getFFlagMaterialGeneratorNewUI);
local _ = require(l_Parent_0.Src.Util.createGeneratedMaterial);
local l_append_0 = v1.append;
local l_collectArray_0 = v1.collectArray;
local l_join_0 = v1.join;
local _ = v1.map;
return (v2.createReducer({
    materials = {},
    initialImageId = nil,
    selectedMaterial = nil,
    session = nil
}, {
    [v5.name] = function(v22, v23)
        return l_join_0(v22, {
            materials = l_append_0({}, v23.materials, v22.materials)
        });
    end,
    [v6.name] = not v16() and function(v24, _)
        return l_join_0(v24, {
            selectedMaterial = v1.None
        });
    end or nil,
    [v15.name] = function(v26, v27)
        return l_join_0(v26, {
            initialImageId = v27.initialImageId or v1.None
        });
    end,
    [v7.name] = not v16() and function(v28, v29)
        return l_join_0(v28, {
            materials = l_collectArray_0(v28.materials, function(_, v31)
                if v31.Id == v29.material.Id then
                    v31.IsTemporary = false;
                    if v31.MaterialVariant then
                        v31.MaterialVariant.Archivable = true;
                    end;
                end;
                return v31;
            end)
        });
    end or nil,
    [v8.name] = function(v32, _)
        return l_join_0(v32, {
            materials = {},
            selectedMaterial = v1.None
        });
    end,
    [v9.name] = not v16() and function(v34, v35)
        local v38 = l_collectArray_0(v34.materials, function(_, v37)
            if v37 == v35.material then
                return nil;
            else
                return v37;
            end;
        end);
        local v39 = nil;
        if v34.selectedMaterial == v35.material then
            v39 = v1.None;
        end;
        return l_join_0(v34, {
            materials = v38,
            selectedMaterial = v39
        });
    end or nil,
    [v10.name] = not v16() and function(v40, v41)
        return l_join_0(v40, {
            materials = l_collectArray_0(v40.materials, function(_, v43)
                if v43 == v40.selectedMaterial then
                    v43.BaseMaterial = v41.baseMaterial;
                    if v43.MaterialVariant then
                        v43.MaterialVariant.BaseMaterial = v41.baseMaterial;
                    end;
                end;
                return v43;
            end)
        });
    end or nil,
    [v11.name] = function(v44, v45)
        return l_join_0(v44, {
            session = v45.session
        });
    end,
    [v12.name] = if not v16() then nil else function(v46, v47)
        return l_join_0(v46, {
            materials = v47.materials
        });
    end,
    [v13.name] = function(v48, v49)
        return l_join_0(v48, {
            selectedMaterial = v49.selectedMaterial or v1.None
        });
    end,
    [v14.name] = not v16() and function(v50, v51)
        return l_join_0(v50, {
            materials = l_collectArray_0(v50.materials, function(_, v53)
                if v53 == v51.material then
                    v53.Textures = l_join_0(v53.Textures, v51.textures);
                    local l_Textures_0 = v53.Textures;
                    local l_MaterialVariant_0 = v53.MaterialVariant;
                    if l_Textures_0.ColorMap then
                        l_MaterialVariant_0.ColorMap = l_Textures_0.ColorMap;
                    end;
                    if l_Textures_0.MetalnessMap then
                        l_MaterialVariant_0.MetalnessMap = l_Textures_0.MetalnessMap;
                    end;
                    if l_Textures_0.NormalMap then
                        l_MaterialVariant_0.NormalMap = l_Textures_0.NormalMap;
                    end;
                    if l_Textures_0.RoughnessMap then
                        l_MaterialVariant_0.RoughnessMap = l_Textures_0.RoughnessMap;
                    end;
                end;
                return v53;
            end)
        });
    end or nil
}));


local v0 = require(script.Parent.Parent.Parent.Src.Util.Constants);
local l_EDITOR_WIDTH_0 = v0.EDITOR_WIDTH;
local l_EDITOR_HEIGHT_0 = v0.EDITOR_HEIGHT;
local l_PROMPT_HEIGHT_0 = v0.PROMPT_HEIGHT;
return {
    {
        value = {
            name = "Prompt, Browser, Editor (horizontal)",
            fillDirection = Enum.FillDirection.Horizontal,
            mainContentSize = UDim2.new(1, -l_EDITOR_WIDTH_0, 1, 0),
            editorSize = UDim2.new(0, l_EDITOR_WIDTH_0, 1, 0)
        }
    },
    {
        maxWidth = 576,
        value = {
            name = "Prompt, Browser, Editor (vertical)",
            fillDirection = Enum.FillDirection.Vertical,
            mainContentSize = UDim2.new(1, 0, 1, -l_EDITOR_HEIGHT_0),
            editorSize = UDim2.new(1, 0, 0, l_EDITOR_HEIGHT_0)
        }
    },
    {
        maxWidth = 576,
        maxHeight = (l_PROMPT_HEIGHT_0 + l_EDITOR_HEIGHT_0) + 50,
        value = {
            name = "Prompt, Editor (vertical)",
            fillDirection = Enum.FillDirection.Vertical,
            mainContentSize = UDim2.new(1, 0, 0, l_PROMPT_HEIGHT_0),
            editorSize = UDim2.new(1, 0, 1, -l_PROMPT_HEIGHT_0),
            browserVisible = false
        }
    },
    {
        maxWidth = 576,
        maxHeight = l_EDITOR_HEIGHT_0 + 50,
        value = {
            name = "Editor only",
            mainContentVisible = false,
            editorSize = UDim2.fromScale(1, 1)
        }
    }
};


local l_Parent_0 = script.Parent.Parent.Parent;
local v1 = require(l_Parent_0.Packages.Dash);
local v2 = require(l_Parent_0.Packages.Framework);
local v3 = require(l_Parent_0.Packages.MaterialFramework);
local l_Style_0 = v2.Style;
local l_StudioTheme_0 = l_Style_0.Themes.StudioTheme;
local l_StyleKey_0 = l_Style_0.StyleKey;
local l_getRawComponentStyle_0 = l_Style_0.getRawComponentStyle;
local l_ComponentSymbols_0 = l_Style_0.ComponentSymbols;
local l_Image_0 = v2.UI.Image;
local v10 = require(l_Parent_0.Src.Flags.getFFlagMaterialGeneratorSupportVariations2);
local v11 = require(l_Parent_0.Src.Flags.getFFlagMaterialGeneratorNewUI);
local l_StyleModifier_0 = v2.Util.StyleModifier;
local l_Theme_0 = v3.Resources.Theme;
local v14 = require(l_Parent_0.Src.Resources.Theme);
local v15 = {
    Image = "rbxasset://textures/DevConsole/Close.png",
    Color = l_StyleKey_0.ErrorText,
    Size = UDim2.fromScale(1, 1)
};
local v16 = {
    Header = {
        GenerateButtonSize = UDim2.fromOffset(80, 32),
        UploadButtonSize = UDim2.fromOffset(32, 32),
        MultiLinePrompt = true,
        Padding = 10,
        PromptHeight = not v10() and 64 or 88,
        RowHeight = 32,
        Size = UDim2.new(1, 0, 0, 102),
        VerticalSpacing = 6,
        ErrorPadding = 32,
        ErrorSpacing = 32,
        ErrorLabelSpacing = 8,
        RetryButtonSize = UDim2.new(0, 150, 0, 44),
        ErrorMessageTextColor = l_StyleKey_0.TextSecondary,
        AddImageButtonIconColor = l_StyleKey_0.MainText,
        AddImageButtonIconColorNoImage = l_StyleKey_0.MainText,
        ImagePadding = 5,
        ImageCornerRadius = UDim.new(0, 8),
        ImageBackgroundColor3 = l_StyleKey_0.InputFieldBackground,
        ImageColor3 = Color3.new(1, 1, 1),
        ImageBorderColor = l_StyleKey_0.InputFieldBorder
    },
    [l_StyleModifier_0.Selected] = {
        Header = {
            ImageColor3 = Color3.new(0.5, 0.5, 0.5),
            ImageBorderColor = l_StyleKey_0.InputFieldBorderSelected,
            AddImageButtonIconColor = Color3.new(1, 1, 1)
        }
    },
    [l_StyleModifier_0.Hover] = {
        Header = {
            ImageColor3 = Color3.new(0.5, 0.5, 0.5),
            ImageBorderColor = l_StyleKey_0.InputFieldBorderHover,
            AddImageButtonIconColor = Color3.new(1, 1, 1)
        },
        TextureItem = {
            ImageColor3 = Color3.new(0.9, 0.9, 0.9)
        }
    },
    ErrorBox = {
        Padding = 32,
        MaxWidth = 400,
        PrimaryColor = l_StyleKey_0.ErrorText,
        CornerRadius = 8,
        CloseButtonPosition = UDim2.new(1, 19, 0.5, 0),
        CloseButtonSize = UDim2.fromOffset(13, 13),
        RightPadding = 15
    },
    MainView = {
        ErrorPadding = 8,
        ErrorInnerPadding = 12,
        ErrorMaxWidth = math.huge
    },
    MaterialView = {
        LabelWidth = 100,
        Padding = 8,
        PreviewHeight = 192,
        PreviewTileSize = UDim2.new(0, 192, 0, 192),
        PrimarySettingsGroupBackgroundColor = l_StyleKey_0.ForegroundContrast,
        SaveAndApplyButtonSize = UDim2.fromOffset(220, 32),
        ApplyButtonSize = UDim2.fromOffset(120, 32),
        SettingsGroupPadding = {
            Left = 6,
            Right = 6
        },
        SettingsGroupSpacing = 10,
        SettingSpacing = 6,
        StudsPerTileSettingSize = UDim2.new(1, 0, 0, 32),
        VerticalSpacing = 6
    },
    ModalView = {
        CloseButtonSize = UDim2.fromOffset(24, 24),
        ContentSize = UDim2.new(1, -30, 1, -30),
        Transparency = 0.5
    },
    Setting = {
        HorizontalSpacing = 16,
        Size = UDim2.new(1, 0, 0, 30),
        ValueLabelWidth = 30
    },
    TextureBrowser = {
        CellPadding = UDim2.fromOffset(6, 6),
        CellSize = UDim2.fromOffset(128, 128),
        Padding = {
            Top = 4,
            Left = 10,
            Right = 10
        }
    },
    TextureItem = {
        BackgroundColor = l_StyleKey_0.ForegroundMain,
        BorderColor = l_StyleKey_0.ForegroundContrast,
        CornerRadius = UDim.new(0, 6),
        ImageColor3 = Color3.new(1, 1, 1),
        BorderThickness = 2,
        SelectedBorderColor = l_StyleKey_0.ActionSelected,
        Size = UDim2.fromOffset(128, 128)
    },
    [l_ComponentSymbols_0.Button] = v1.join(l_getRawComponentStyle_0("Button"), {
        ["&Close"] = {
            Background = l_Image_0,
            BackgroundStyle = {
                AnchorPoint = Vector2.new(0.5, 0.5),
                Image = "rbxasset://textures/ui/TopBar/close.png",
                Color = l_StyleKey_0.ButtonText,
                Position = UDim2.fromScale(0.5, 0.5),
                Size = UDim2.fromOffset(18, 18)
            },
            [l_StyleModifier_0.Hover] = {
                BackgroundStyle = {
                    AnchorPoint = Vector2.new(0.5, 0.5),
                    Image = "rbxasset://textures/ui/TopBar/close.png",
                    Color = l_StyleKey_0.BrightText,
                    Position = UDim2.fromScale(0.5, 0.5),
                    Size = UDim2.fromOffset(18, 18)
                }
            }
        },
        ["&ErrorClose"] = {
            Background = l_Image_0,
            BackgroundStyle = v15,
            [l_StyleModifier_0.Hover] = {
                BackgroundStyle = v15
            }
        }
    })
};
if not v11() then
    return function(v17)
        local _ = nil;
        return (if not v17 then l_StudioTheme_0.new() else l_StudioTheme_0.mock()):extend(v16);
    end;
else
    return function(v19)
        local _ = nil;
        return (if not v19 then l_Theme_0.new() else l_Theme_0.mock()):extend(v14);
    end;
end;


local l_Parent_0 = script.Parent.Parent.Parent;
local v1 = require(l_Parent_0.Packages.Dash);
local v2 = require(l_Parent_0.Packages.Framework);
local l_Style_0 = v2.Style;
local l_Colors_0 = l_Style_0.Colors;
local l_StyleKey_0 = l_Style_0.StyleKey;
local l_StyleModifier_0 = v2.Util.StyleModifier;
local l_ComponentSymbols_0 = l_Style_0.ComponentSymbols;
local l_Image_0 = v2.UI.Image;
local l_UIData_0 = v2.UIData;
local v10 = require(l_UIData_0.Alert.style);
local v11 = require(l_UIData_0.Button.style);
local v12 = require(l_Parent_0.Src.Util.Constants);
local l_PROMPT_HEIGHT_0 = v12.PROMPT_HEIGHT;
local l_TOOLBAR_HEIGHT_0 = v12.TOOLBAR_HEIGHT;
local v15 = {};
l_ComponentSymbols_0:add("LoadingButton");
v15[l_ComponentSymbols_0.LoadingButton] = {
    LoadingIndicatorSize = UDim2.fromOffset(24, 16)
};
l_ComponentSymbols_0:add("App");
v15[l_ComponentSymbols_0.App] = {
    BrowserSize = UDim2.new(1, 0, 1, -l_PROMPT_HEIGHT_0),
    PromptSize = UDim2.new(1, 0, 0, l_PROMPT_HEIGHT_0)
};
l_ComponentSymbols_0:add("Prompt");
v15[l_ComponentSymbols_0.Prompt] = {
    BackgroundColor = l_StyleKey_0.Titlebar,
    MultiLine = true,
    Padding = 8,
    PromptToolbarSize = UDim2.new(1, 0, 0, l_TOOLBAR_HEIGHT_0)
};
l_ComponentSymbols_0:add("PromptToolbar");
v15[l_ComponentSymbols_0.PromptToolbar] = {
    GenerateButtonSize = UDim2.fromOffset(80, 32)
};
l_ComponentSymbols_0:add("Browser");
v15[l_ComponentSymbols_0.Browser] = {
    CellGroupHeader = {
        AfterContent = true,
        Collapsible = false,
        Size = UDim2.new(1, 0, 0, l_TOOLBAR_HEIGHT_0)
    },
    Padding = 4,
    StatusIconImageColor = l_Colors_0.Gray_Light,
    StatusIconPosition = UDim2.fromOffset(6, 6),
    StatusIconSize = UDim2.fromOffset(16, 16)
};
l_ComponentSymbols_0:add("PromptGroupFooter");
v15[l_ComponentSymbols_0.PromptGroupFooter] = {
    BackgroundColor = l_StyleKey_0.ForegroundContrast,
    ButtonColor = l_StyleKey_0.TextSecondary,
    ButtonImageSize = UDim2.fromOffset(16, 16),
    ButtonSize = UDim2.fromOffset(24, 24),
    ButtonSpacing = 4,
    CopyPromptButtonImage = "rbxasset://textures/MaterialGenerator/Copy_16x16.png",
    CornerRadius = UDim.new(0, 4),
    Padding = {
        Left = 6,
        Right = 4
    },
    Style = "RoundBox",
    TextColor = l_StyleKey_0.TextSecondary
};
l_ComponentSymbols_0:add("Editor");
v15[l_ComponentSymbols_0.Editor] = {
    ApplyButtonBackgroundColor = l_StyleKey_0.Button,
    ApplyButtonIcon = "rbxasset://textures/MaterialManager/Apply_to_Selection.png",
    ApplyButtonSize = UDim2.fromOffset(0, 32),
    CloseButtonSize = UDim2.fromOffset(24, 24),
    LabelWidth = 100,
    Padding = 8,
    PreviewBackgroundColor = l_StyleKey_0.ScrollBarBackground,
    PreviewHeight = 300,
    PreviewTileSize = UDim2.fromOffset(192, 192),
    SettingsPadding = {
        Left = 10,
        Right = 10,
        Top = 10,
        Bottom = 30
    },
    SettingSpacing = 8,
    StudsPerTileSettingSize = UDim2.new(1, 0, 0, 30),
    UploadAndApplyButtonIcon = "rbxasset://textures/MaterialGenerator/Submit_16x16.png",
    UploadAndApplyButtonSize = UDim2.fromOffset(180, 32)
};
l_ComponentSymbols_0:add("Setting");
v15[l_ComponentSymbols_0.Setting] = {
    HorizontalSpacing = 16,
    Size = UDim2.new(1, 0, 0, 30),
    ValueLabelWidth = 30
};
v15[l_ComponentSymbols_0.Alert] = v1.join(v10, {
    ["&AppError"] = v1.join(v10["&Error"], {
        HorizontalPadding = UDim.new(0, 16),
        MaxWidth = math.huge
    })
});
local v16 = {
    Color = l_StyleKey_0.ErrorText,
    Image = "rbxasset://textures/DevConsole/Close.png",
    Size = UDim2.fromScale(1, 1)
};
v15[l_ComponentSymbols_0.Button] = v1.join(v11, {
    ["&Close"] = {
        Background = l_Image_0,
        BackgroundStyle = {
            AnchorPoint = Vector2.new(0.5, 0.5),
            Image = "rbxasset://textures/ui/TopBar/close.png",
            Color = l_StyleKey_0.ButtonText,
            Position = UDim2.fromScale(0.5, 0.5),
            Size = UDim2.fromOffset(18, 18)
        },
        [l_StyleModifier_0.Hover] = {
            BackgroundStyle = {
                AnchorPoint = Vector2.new(0.5, 0.5),
                Image = "rbxasset://textures/ui/TopBar/close.png",
                Color = l_StyleKey_0.BrightText,
                Position = UDim2.fromScale(0.5, 0.5),
                Size = UDim2.fromOffset(18, 18)
            }
        }
    },
    ["&ErrorClose"] = {
        Background = l_Image_0,
        BackgroundStyle = v16,
        [l_StyleModifier_0.Hover] = {
            BackgroundStyle = v16
        }
    }
});
return v15;


local l_HttpService_0 = game:GetService("HttpService");
local l_Parent_0 = script.Parent.Parent.Parent;
local v2 = require(l_Parent_0.Src.Util.DebugFlags);
local l_MaterialGeneratorErrorAnalytics_0 = game:GetFastFlag("MaterialGeneratorErrorAnalytics");
local v4 = require(l_Parent_0.Src.Enum.GenerationErrorType);
local _ = require(l_Parent_0.Src.Types);
local l_join_0 = require(l_Parent_0.Packages.Dash).join;
return function(v7)
    local function v11(v8, v9)
        local v10 = l_join_0({
            studioSid = v7:GetSessionId(),
            clientId = v7:GetClientId(),
            placeId = game.PlaceId
        }, v9 or {});
        if v2.LogAnalytics() then
            print(("%s SendEvent eventName=%s args=%s"):format("MaterialGenerator", v8, l_HttpService_0:JSONEncode(v10)));
        end;
        v7:SendEventDeferred("studio", "MaterialGenerator", v8, v10);
    end;
    return {
        generateButtonClicked = function(_, v13, v14, v15, v16)
            v11("GenerateButtonClicked", {
                generationId = v13,
                samples = v14,
                textPrompt = v15,
                filteredTextPrompt = v16
            });
        end,
        generateMaterials = function(_, v18, v19, v20, v21, v22)
            if l_MaterialGeneratorErrorAnalytics_0 then
                v11("GenerateMaterials", {
                    generationId = v18,
                    inputType = v19,
                    samples = v20,
                    promptText = v21,
                    filteredPromptText = v22
                });
                return ;
            else
                return ;
            end;
        end,
        generateMaterialsError = function(_, v24, v25, v26, v27)
            if l_MaterialGeneratorErrorAnalytics_0 then
                assert(v4.isEnumValue(v26), "Expected errorType to be a GenerationErrorType");
                local _ = nil;
                v11("GenerateMaterialsError", {
                    promptText = v24,
                    initialImageId = v25,
                    errorMessage = if not not v27 and v27 ~= "" then ("%*: '%*'"):format(v26, v27) else tostring(v26)
                });
                return ;
            else
                return ;
            end;
        end,
        saveButtonClicked = function(_, v30, v31)
            local v32 = nil;
            if v30.BaseMaterial then
                v32 = v30.BaseMaterial.Name;
            end;
            local v33 = nil;
            if v30.MaterialPattern then
                v33 = v30.MaterialPattern.Name;
            end;
            v11(not l_MaterialGeneratorErrorAnalytics_0 and "SaveButtonClicked" or "SaveGeneratedMaterial", {
                colorMap = v30.ColorMap,
                metalnessMap = v30.MetalnessMap,
                normalMap = v30.NormalMap,
                roughnessMap = v30.RoughnessMap,
                name = v30.Name,
                baseMaterial = v32,
                materialPattern = v33,
                studsPerTile = v30.StudsPerTile,
                generationId = v31
            });
        end
    };
end;


local l_Parent_0 = script.Parent.Parent.Parent;
local l_Packages_0 = l_Parent_0.Packages;
local v2 = require(l_Packages_0.MaterialFramework);
local v3 = require(l_Packages_0.Framework);
local v4 = require(l_Packages_0.React);
local v5 = require(l_Packages_0.Dev.RoactCompat);
local l_Resources_0 = l_Parent_0.Src.Resources;
local v7 = require(l_Resources_0.MakeTheme);
local l_ContextServices_0 = v3.ContextServices;
local l_DocParser_0 = v3.Util.Typecheck.DocParser;
local l_Focus_0 = l_ContextServices_0.Focus;
local l_Localization_0 = l_ContextServices_0.Localization;
local l_Mouse_0 = l_ContextServices_0.Mouse;
local l_Plugin_0 = l_ContextServices_0.Plugin;
local l_StudioServices_0 = v2.Context.StudioServices;
return {
    name = "Material Generator",
    exclude = {
        "_Index"
    },
    storyRoots = {
        l_Parent_0.Src
    },
    roact = v5,
    mapStory = function(v15)
        local v16 = l_Localization_0.new({
            stringResourceTable = l_Resources_0.Localization.SourceStrings,
            translationResourceTable = l_Resources_0.Localization.LocalizedStrings,
            pluginName = "MaterialGenerator",
            libraries = {
                [v2.Resources.LOCALIZATION_PROJECT_NAME] = {
                    stringResourceTable = v2.Resources.SourceStrings,
                    translationResourceTable = v2.Resources.LocalizedStrings
                }
            }
        });
        return function(v17)
            return l_ContextServices_0.provide({
                v16,
                l_Focus_0.new(v17.focus),
                l_Mouse_0.new(v17.plugin:GetMouse()),
                l_Plugin_0.new(v17.plugin),
                l_StudioServices_0.new(),
                v7()
            }, {
                Child = v4.createElement(v15, v17)
            });
        end;
    end,
    mapDefinition = function(v18)
        local l_FirstChild_0 = v18.source.Parent:FindFirstChild(v18.name);
        if l_FirstChild_0 then
            local v20 = l_DocParser_0.new(v18.name, l_FirstChild_0);
            local l_status_0, l_result_0 = pcall(function()
                return v20:parse();
            end);
            if l_status_0 then
                v18.docs = l_result_0;
                v18.summary = l_result_0.Summary;
            end;
        end;
        return v18;
    end
};


local l_Parent_0 = script.Parent.Parent.Parent;
local v1 = require(l_Parent_0.Packages.Rodux);
local v2 = require(l_Parent_0.Src.Reducers.MainReducer);
return function()
    return v1.Store.new(v2, nil, {
        v1.thunkMiddleware
    });
end;


local l_ServiceWrapper_0 = require(script.Parent.Parent.Parent.Packages.Framework).TestHelpers.ServiceWrapper;
return function()
    return l_ServiceWrapper_0.new("MaterialGenerationService", true):asService();
end;


local l_Parent_0 = script.Parent.Parent.Parent;
local _ = require(l_Parent_0.Src.Types);
local v2 = require(l_Parent_0.Src.TestHelpers.createMockSessionData);
local v3 = require(l_Parent_0.Src.Util.generatedMaterialFromColorMap);
return function()
    local v4, v5, v6 = v2();
    local v7 = {};
    for _, v9 in v5, nil, nil do
        table.insert(v7, (v3(v6, v9, v9, v4)));
    end;
    return v7;
end;


local v0 = require(script.Parent.Parent.Parent.Src.TestHelpers.createMockMaterialGenerationService);
return function()
    local v1 = v0():StartSession();
    local v2, v3 = v1:GenerateImagesAsync("test", {});
    return v1, v2, v3;
end;


local l_Parent_0 = script.Parent.Parent.Parent;
local v1 = require(l_Parent_0.Packages.MaterialFramework);
local v2 = require(l_Parent_0.Packages.Rodux);
local l_StudioServices_0 = v1.Context.StudioServices;
local l_Actions_0 = l_Parent_0.Src.Actions;
local v5 = require(l_Actions_0.SetSelectedMaterial);
local v6 = require(l_Actions_0.SetTextPrompt);
local v7 = require(l_Parent_0.Src.Reducers.MainReducer);
local v8 = require(l_Parent_0.Src.Thunks.GenerateImages);
return function()
    local v9 = v2.Store.new(v7, nil, {
        v2.thunkMiddleware
    });
    v9:dispatch(v6("ancient stone wall"));
    v9:dispatch(v8((l_StudioServices_0.new(true))));
    v9:dispatch(v5(v9:getState().MaterialsReducer.materials[1]));
    return v9;
end;


local _ = require(script.Parent.Parent.Parent.Src.Types);
return function(v1, v2)
    return function(_)
        local l_MaterialVariant_0 = v1.MaterialVariant;
        local v5 = false;
        for _, v7 in v2:getService("Selection"):Get() do
            if v7:IsA("BasePart") then
                v7.Material = l_MaterialVariant_0.BaseMaterial;
                v7.MaterialVariant = l_MaterialVariant_0.Name;
                v5 = true;
            end;
        end;
        if v5 then
            v2:getService("ChangeHistoryService"):SetWaypoint("MaterialGenerator apply material");
        end;
    end;
end;


local l_Parent_0 = script.Parent.Parent.Parent;
local _ = require(l_Parent_0.Src.Types);
local v2 = require(l_Parent_0.Packages.Dash);
local _ = require(l_Parent_0.Packages.Promise);
local l_Actions_0 = l_Parent_0.Src.Actions;
local v5 = require(l_Actions_0.AddGeneratedMaterials);
local v6 = require(l_Actions_0.SetGenerationError);
local v7 = require(l_Actions_0.UpdateMaterialTextures);
local v8 = require(l_Parent_0.Src.Flags.getFFlagMaterialGeneratorNewUI);
local v9 = require(l_Parent_0.Src.Thunks.UpdateMaterial);
local l_Util_0 = l_Parent_0.Src.Util;
local v11 = require(l_Util_0.createGeneratedMaterial);
local v12 = require(l_Util_0.generateMaterialMaps);
local l_collectArray_0 = v2.collectArray;
local l_joinDeep_0 = v2.joinDeep;
local l_map_0 = v2.map;
return function(v16, v17, v18, v19)
    return function(v20)
        local v23 = l_collectArray_0(v19:getServiceInstance("MaterialService"):GetDescendants(), function(_, v22)
            if not v22:IsA("MaterialVariant") then
                return nil;
            else
                return v22.Name;
            end;
        end);
        local v26 = l_map_0(v17, function(v24)
            local v25 = v11(v16, v24, v23);
            v25.GenerationId = v18;
            table.insert(v23, v25.Name);
            return v25;
        end);
        v20:dispatch(v5(v26));
        local l_session_0 = v20:getState().MaterialsReducer.session;
        for _, v29 in v26, nil, nil do
            v12(l_session_0, v29):andThen(function(v30)
                if not v8() then
                    v20:dispatch(v7(v29, v30));
                    return ;
                else
                    v20:dispatch(v9((l_joinDeep_0(v29, {
                        Textures = v30
                    }))));
                    return ;
                end;
            end, function(v31)
                v20:dispatch(v6(v31.ErrorType, v31.ErrorMessage));
            end);
        end;
    end;
end;


local l_Parent_0 = script.Parent.Parent.Parent;
local l_Actions_0 = l_Parent_0.Src.Actions;
local v2 = require(l_Actions_0.ClearSelectedMaterial);
local v3 = require(l_Actions_0.DoneGeneratingImages);
local v4 = require(l_Actions_0.MergeFilteredTextPrompt);
local v5 = require(l_Actions_0.SetGeneratingImages);
local v6 = require(l_Actions_0.SetGenerationError);
local v7 = require(l_Actions_0.SetMaterialGenerationSession);
local _ = require(l_Actions_0.SetSelectedMaterial);
local v9 = require(l_Parent_0.Src.Thunks.CreateGeneratedMaterials);
local v10 = require(l_Parent_0.Src.Enum.GenerationErrorType);
local v11 = require(l_Parent_0.Src.Util.DebugFlags);
local v12 = require(l_Parent_0.Src.Util.parseGenerationError);
local v13 = require(l_Parent_0.Src.Flags.getFFlagMaterialGeneratorNewUI);
local v14 = require(l_Parent_0.Src.Flags.getFFlagMaterialGeneratorSupportVariations2);
local l_MaterialGeneratorErrorAnalytics_0 = game:GetFastFlag("MaterialGeneratorErrorAnalytics");
local _ = require(l_Parent_0.Src.Types);
return function(v17, v18, v19)
    return function(v20)
        local v21 = v20:getState();
        local v22 = v17:getService("MaterialGenerationService");
        local l_session_0 = v21.MaterialsReducer.session;
        if not l_session_0 then
            l_session_0 = v22:StartSession();
            if not l_session_0 then
                v20:dispatch(v6(v10.NoSession));
                return ;
            else
                v20:dispatch(v7(l_session_0));
            end;
        end;
        local l_textPrompt_0 = v21.AppStateReducer.textPrompt;
        if not l_textPrompt_0 or l_textPrompt_0 == "" then
            return ;
        else
            local v25 = nil;
            if v14() then
                v25 = v21.MaterialsReducer.initialImageId;
            end;
            local v26 = {
                InitialImage = v25,
                Samples = 4
            };
            if not v13() then
                v20:dispatch(v2());
            end;
            v20:dispatch(v5(v26.Samples));
            v20:dispatch(v6(v10.None, nil));
            task.spawn(function()
                local v27 = nil;
                local v28 = nil;
                local v29 = nil;
                if not l_MaterialGeneratorErrorAnalytics_0 then
                    local l_status_0, l_result_0 = pcall(function()
                        local v30, v31, v32 = l_session_0:GenerateImagesAsync(l_textPrompt_0, v26);
                        v27 = v30;
                        v28 = v31;
                        v29 = v32;
                    end);
                    v20:dispatch(v3());
                    if not l_status_0 then
                        if type(l_result_0) == "string" then
                            if not string.find(l_result_0, "got network error status: 429") then
                                if not string.find(l_result_0, "got network error status: 500") then
                                    if not string.find(l_result_0, "got network error status: 504") then
                                        if not string.find(l_result_0, "TextFullyFiltered") then
                                            if not string.find(l_result_0, "AccountingFailed") or not string.find(l_result_0, "Decrementing account failed") then
                                                v20:dispatch(v6(v10.CustomMessage, l_result_0));
                                            else
                                                v20:dispatch(v6(v10.AccountingFailedDecrement, nil));
                                            end;
                                        else
                                            v20:dispatch(v4(l_textPrompt_0, string.gsub(l_textPrompt_0, "[^ \n]", "#")));
                                            v20:dispatch(v6(v10.TextFullyFiltered, nil));
                                        end;
                                    else
                                        v20:dispatch(v6(v10.ServerError504, nil));
                                    end;
                                else
                                    v20:dispatch(v6(v10.ServerError500, nil));
                                end;
                            else
                                v20:dispatch(v6(v10.TooManyRequests, nil));
                            end;
                        else
                            v20:dispatch(v6(v10.Unknown, nil));
                        end;
                        return ;
                    end;
                else
                    local v35 = nil;
                    local v36 = nil;
                    if not v11.ForceGenerationError() then
                        local l_status_1, l_result_1 = pcall(function()
                            local v37, v38, v39 = l_session_0:GenerateImagesAsync(l_textPrompt_0, v26);
                            v27 = v37;
                            v28 = v38;
                            v29 = v39;
                        end);
                        v35 = l_status_1;
                        v36 = l_result_1;
                    else
                        v35 = false;
                        v36 = nil;
                    end;
                    v20:dispatch(v3());
                    if not v35 then
                        local v42, v43 = v12(v36);
                        if v42 == v10.TextFullyFiltered then
                            v20:dispatch(v4(l_textPrompt_0, string.gsub(l_textPrompt_0, "[^ \n]", "#")));
                        end;
                        v20:dispatch(v6(v42, v43));
                        if v18 then
                            v18:report("generateMaterialsError", l_textPrompt_0, v25, v42, v43);
                        end;
                        return ;
                    end;
                end;
                local l_l_textPrompt_0_0 = l_textPrompt_0;
                if type(v28) == "string" and #v28 > 0 then
                    l_l_textPrompt_0_0 = v28;
                    v20:dispatch(v4(l_textPrompt_0, v28));
                end;
                local v45 = v17:getService("HttpService"):GenerateGUID(false);
                v20:dispatch(v9(l_l_textPrompt_0_0, v27, v45, v17));
                if v18 then
                    if not l_MaterialGeneratorErrorAnalytics_0 then
                        v18:report("generateButtonClicked", v45, #v27, l_textPrompt_0, v28);
                    else
                        v18:report("generateMaterials", v45, v19, #v27, l_textPrompt_0, v28);
                    end;
                end;
            end);
            return ;
        end;
    end;
end;


local l_Parent_0 = script.Parent.Parent.Parent;
local v1 = require(l_Parent_0.Packages.Dash);
local _ = require(l_Parent_0.Src.Types);
local l_Actions_0 = l_Parent_0.Src.Actions;
local v4 = require(l_Actions_0.SetGenerationError);
local v5 = require(l_Actions_0.UpdateMaterialTextures);
local v6 = require(l_Parent_0.Src.Enum.GenerationErrorType);
local v7 = require(l_Parent_0.Src.Flags.getFFlagMaterialGeneratorNewUI);
local v8 = require(l_Parent_0.Src.Thunks.UpdateMaterial);
local l_joinDeep_0 = v1.joinDeep;
local function _(v10)
    local l_Textures_0 = v10.Textures;
    local v12 = false;
    if l_Textures_0.MetalnessMap ~= nil then
        v12 = false;
        if l_Textures_0.NormalMap ~= nil then
            v12 = l_Textures_0.RoughnessMap ~= nil;
        end;
    end;
    return v12;
end;
return function()
    return function(v14)
        local v15 = v14:getState();
        local l_selectedMaterial_0 = v15.MaterialsReducer.selectedMaterial;
        if l_selectedMaterial_0 then
            if v7() then
                local l_Textures_1 = l_selectedMaterial_0.Textures;
                local v18 = false;
                if l_Textures_1.MetalnessMap ~= nil then
                    v18 = false;
                    if l_Textures_1.NormalMap ~= nil then
                        v18 = l_Textures_1.RoughnessMap ~= nil;
                    end;
                end;
                if v18 then
                    return ;
                end;
            end;
            local l_session_0 = v15.MaterialsReducer.session;
            if l_session_0 then
                task.spawn(function()
                    local v20 = nil;
                    local l_status_0, l_result_0 = pcall(function()
                        v20 = l_session_0:GenerateMaterialMapsAsync(l_selectedMaterial_0.Id);
                    end);
                    if v14:getState().MaterialsReducer.selectedMaterial ~= l_selectedMaterial_0 then
                        return ;
                    elseif l_status_0 then
                        if v20 then
                            local v23 = {
                                ColorMap = v20.ColorMap,
                                MetalnessMap = v20.MetalnessMap,
                                NormalMap = v20.NormalMap,
                                RoughnessMap = v20.RoughnessMap
                            };
                            if not v7() then
                                v14:dispatch(v5(l_selectedMaterial_0, v23));
                            else
                                v14:dispatch(v8((l_joinDeep_0(l_selectedMaterial_0, {
                                    Textures = v23
                                }))));
                            end;
                            return ;
                        else
                            v14:dispatch(v4(v6.FailedToGenerate, nil));
                            return ;
                        end;
                    else
                        if not l_result_0 then
                            v14:dispatch(v4(v6.Unknown, nil));
                        else
                            v14:dispatch(v4(v6.CustomMessage, l_result_0));
                        end;
                        return ;
                    end;
                end);
                return ;
            else
                v14:dispatch(v4(v6.NoSession, nil));
                return ;
            end;
        else
            v14:dispatch(v4(v6.NoSelectedMaterial, nil));
            return ;
        end;
    end;
end;


local l_Parent_0 = script.Parent.Parent.Parent;
local v1 = require(l_Parent_0.Packages.Dash);
local _ = require(l_Parent_0.Src.Types);
local l_Actions_0 = l_Parent_0.Src.Actions;
local v4 = require(l_Actions_0.SetMaterials);
local v5 = require(l_Actions_0.SetSelectedMaterial);
local l_filter_0 = v1.filter;
return function(v7)
    return function(v8)
        local l_MaterialsReducer_0 = v8:getState().MaterialsReducer;
        if l_MaterialsReducer_0.selectedMaterial == v7 then
            v8:dispatch(v5(nil));
        end;
        v8:dispatch(v4((l_filter_0(l_MaterialsReducer_0.materials, function(v10)
            return v10 ~= v7;
        end))));
    end;
end;


local l_Parent_0 = script.Parent.Parent.Parent;
local v1 = require(l_Parent_0.Packages.Dash);
local _ = require(l_Parent_0.Src.Types);
local l_Actions_0 = l_Parent_0.Src.Actions;
local v4 = require(l_Actions_0.SetMaterials);
local v5 = require(l_Actions_0.SetSelectedMaterial);
local l_collectArray_0 = v1.collectArray;
return function(v7)
    return function(v8)
        local l_MaterialsReducer_0 = v8:getState().MaterialsReducer;
        if l_MaterialsReducer_0.selectedMaterial and l_MaterialsReducer_0.selectedMaterial.Id == v7.Id then
            v8:dispatch(v5(nil));
            shouldReselectMaterial = true;
        end;
        v8:dispatch(v4((l_collectArray_0(l_MaterialsReducer_0.materials, function(_, v11)
            if v11.Id == v7.Id then
                return v7;
            else
                return v11;
            end;
        end))));
        if shouldReselectMaterial then
            v8:dispatch(v5(v7));
        end;
    end;
end;


local l_Parent_0 = script.Parent.Parent.Parent;
local v1 = require(l_Parent_0.Packages.Dash);
local _ = require(l_Parent_0.Src.Types);
local l_Actions_0 = l_Parent_0.Src.Actions;
local v4 = require(l_Actions_0.MarkAsSaved);
local v5 = require(l_Actions_0.SetIsSavingMaterial);
local v6 = require(l_Parent_0.Src.Flags.getFFlagMaterialGeneratorNewUI);
local v7 = require(l_Parent_0.Src.Thunks.UpdateMaterial);
local v8 = require(l_Parent_0.Src.Util.createMaterialVariant);
local l_join_0 = v1.join;
return function(v10, v11)
    return function(v12)
        if v10.IsTemporary then
            local l_session_0 = v12:getState().MaterialsReducer.session;
            local l_Id_0 = v10.Id;
            v12:dispatch(v5(true));
            task.spawn(function()
                local v15 = l_session_0:UploadMaterialAsync(l_Id_0);
                local l_MaterialVariant_0 = v10.MaterialVariant;
                if not l_MaterialVariant_0 then
                    v10.MaterialVariant = v8(v10);
                else
                    l_MaterialVariant_0.ColorMap = v15.ColorMap;
                    if v15.NormalMap then
                        l_MaterialVariant_0.NormalMap = v15.NormalMap;
                    end;
                    if v15.MetalnessMap then
                        l_MaterialVariant_0.MetalnessMap = v15.MetalnessMap;
                    end;
                    if v15.RoughnessMap then
                        l_MaterialVariant_0.RoughnessMap = v15.RoughnessMap;
                    end;
                end;
                if not v6() then
                    v12:dispatch(v4(v10));
                else
                    v12:dispatch(v7(l_join_0(v10, {
                        IsTemporary = false
                    })));
                end;
                v12:dispatch(v5(false));
                v11:report("saveButtonClicked", v10.MaterialVariant, v10.GenerationId);
            end);
            return ;
        else
            return ;
        end;
    end;
end;


return {
    TOOLBAR_HEIGHT = 32,
    PROMPT_HEIGHT = 102,
    SETTING_GEOMETRY_TYPE = "MaterialGenerator_GeometryType",
    SETTING_GEOMETRY_TYPE_DEFAULT = require(script:FindFirstAncestor("MaterialGenerator").Packages.MaterialFramework).Enums.MaterialPreviewGeometryType.Plane.rawValue(),
    EDITOR_WIDTH = 300,
    EDITOR_HEIGHT = 540,
    PLUGIN_SIZE = Vector2.new(600, 540),
    PLUGIN_MIN_SIZE = Vector2.new(300, 300),
    MATERIALS_FOLDER_NAME = "Material Generator",
    GENERATION_SAMPLES = 4,
    INSTANCE_NAME_MAX_LENGTH = 100,
    STUDS_PER_TILE_MAX = 20,
    STUDS_PER_TILE_MIN = 0.1,
    STUDS_PER_TILE_SNAP_INCREMENT = 0.1,
    SUPPORTED_MATERIALS = {
        Enum.Material.Asphalt,
        Enum.Material.Basalt,
        Enum.Material.Brick,
        Enum.Material.Cobblestone,
        Enum.Material.Concrete,
        Enum.Material.CorrodedMetal,
        Enum.Material.CrackedLava,
        Enum.Material.DiamondPlate,
        Enum.Material.Fabric,
        Enum.Material.Foil,
        Enum.Material.Glacier,
        Enum.Material.Granite,
        Enum.Material.Grass,
        Enum.Material.Ground,
        Enum.Material.Ice,
        Enum.Material.LeafyGrass,
        Enum.Material.Limestone,
        Enum.Material.Marble,
        Enum.Material.Metal,
        Enum.Material.Mud,
        Enum.Material.Pavement,
        Enum.Material.Pebble,
        Enum.Material.Plastic,
        Enum.Material.Rock,
        Enum.Material.Salt,
        Enum.Material.Sand,
        Enum.Material.Sandstone,
        Enum.Material.Slate,
        Enum.Material.SmoothPlastic,
        Enum.Material.Snow,
        Enum.Material.Wood,
        Enum.Material.WoodPlanks
    }
};


local _ = script.Parent.Parent.Parent;
local function _(v1)
    return (v1:lower():gsub("[ _](%a)", string.upper):gsub("^%a", string.upper):gsub("%p", ""));
end;
local function v10(v3, v4)
    local v5 = {};
    if v4 then
        for _, v7 in pairs(v4:GetDescendants()) do
            if v7:IsA("MaterialVariant") then
                v5[string.lower(v7.Name)] = v7.Name;
            end;
        end;
    end;
    local v8 = string.lower(v3);
    if v5[v8] then
        local v9 = 0;
        while true do
            v9 = v9 + 1;
            if not v5[string.format("%s %0d", v8, v9)] then
                break;
            end;
        end;
        return string.format("%s %0d", v3, v9);
    else
        return v3;
    end;
end;
return function(v11, v12)
    return v10((v11 .. " Material"):lower():gsub("[ _](%a)", string.upper):gsub("^%a", string.upper):gsub("%p", ""), v12);
end;


local l_Workspace_0 = game:GetService("Workspace");
local v1 = require(script.Parent.Parent.Parent.Packages.TestLoader);
local v2 = v1.hasInternalPermission();
local v3 = v1.isCli();
local function _(v4, v5)
    local v6 = v5 or false;
    return function()
        local l_MaterialGeneratorFlags_0 = l_Workspace_0:FindFirstChild("MaterialGeneratorFlags");
        if l_MaterialGeneratorFlags_0 and l_MaterialGeneratorFlags_0:FindFirstChild(v4) then
            return l_MaterialGeneratorFlags_0[v4].Value;
        else
            return v6;
        end;
    end;
end;
local v9 = {};
local v10 = v3 or false;
local v11 = "RunningUnderCLI";
local l_v11_0 = v11 --[[ copy: 9 -> 11 ]];
local l_v10_0 = v10 --[[ copy: 8 -> 12 ]];
v9.RunningUnderCLI = function()
    local l_MaterialGeneratorFlags_1 = l_Workspace_0:FindFirstChild("MaterialGeneratorFlags");
    if l_MaterialGeneratorFlags_1 and l_MaterialGeneratorFlags_1:FindFirstChild(l_v11_0) then
        return l_MaterialGeneratorFlags_1[l_v11_0].Value;
    else
        return l_v10_0;
    end;
end;
v10 = "RunTests";
v11 = false;
local l_v10_1 = v10 --[[ copy: 8 -> 13 ]];
local l_v11_1 = v11 --[[ copy: 9 -> 14 ]];
v9.RunTests = function()
    local l_MaterialGeneratorFlags_2 = l_Workspace_0:FindFirstChild("MaterialGeneratorFlags");
    if l_MaterialGeneratorFlags_2 and l_MaterialGeneratorFlags_2:FindFirstChild(l_v10_1) then
        return l_MaterialGeneratorFlags_2[l_v10_1].Value;
    else
        return l_v11_1;
    end;
end;
v10 = "LogTestsQuiet";
v11 = false;
local l_v10_2 = v10 --[[ copy: 8 -> 15 ]];
local l_v11_2 = v11 --[[ copy: 9 -> 16 ]];
v9.LogTestsQuiet = function()
    local l_MaterialGeneratorFlags_3 = l_Workspace_0:FindFirstChild("MaterialGeneratorFlags");
    if l_MaterialGeneratorFlags_3 and l_MaterialGeneratorFlags_3:FindFirstChild(l_v10_2) then
        return l_MaterialGeneratorFlags_3[l_v10_2].Value;
    else
        return l_v11_2;
    end;
end;
v10 = "LogAnalytics";
v11 = false;
local l_v10_3 = v10 --[[ copy: 8 -> 17 ]];
local l_v11_3 = v11 --[[ copy: 9 -> 18 ]];
v9.LogAnalytics = function()
    local l_MaterialGeneratorFlags_4 = l_Workspace_0:FindFirstChild("MaterialGeneratorFlags");
    if l_MaterialGeneratorFlags_4 and l_MaterialGeneratorFlags_4:FindFirstChild(l_v10_3) then
        return l_MaterialGeneratorFlags_4[l_v10_3].Value;
    else
        return l_v11_3;
    end;
end;
v10 = "RunDeveloperFrameworkTests";
v11 = false;
local l_v10_4 = v10 --[[ copy: 8 -> 19 ]];
local l_v11_4 = v11 --[[ copy: 9 -> 20 ]];
v9.RunDeveloperFrameworkTests = function()
    local l_MaterialGeneratorFlags_5 = l_Workspace_0:FindFirstChild("MaterialGeneratorFlags");
    if l_MaterialGeneratorFlags_5 and l_MaterialGeneratorFlags_5:FindFirstChild(l_v10_4) then
        return l_MaterialGeneratorFlags_5[l_v10_4].Value;
    else
        return l_v11_4;
    end;
end;
v11 = (v3 or v2) or false;
local v27 = "EnableRoactConfigs";
local l_v11_5 = v11 --[[ copy: 9 -> 21 ]];
v9.EnableRoactConfigs = function()
    local l_MaterialGeneratorFlags_6 = l_Workspace_0:FindFirstChild("MaterialGeneratorFlags");
    if l_MaterialGeneratorFlags_6 and l_MaterialGeneratorFlags_6:FindFirstChild(v27) then
        return l_MaterialGeneratorFlags_6[v27].Value;
    else
        return l_v11_5;
    end;
end;
v10 = "ForceGenerationError";
v11 = false;
v9.ForceGenerationError = function()
    local l_MaterialGeneratorFlags_7 = l_Workspace_0:FindFirstChild("MaterialGeneratorFlags");
    if l_MaterialGeneratorFlags_7 and l_MaterialGeneratorFlags_7:FindFirstChild(v10) then
        return l_MaterialGeneratorFlags_7[v10].Value;
    else
        return v11;
    end;
end;
return v9;


local l_script_FirstAncestor_0 = script:FindFirstAncestor("MaterialGenerator");
local v1 = require(l_script_FirstAncestor_0.Packages.React);
local l_createUnimplemented_0 = require(l_script_FirstAncestor_0.Packages.ReactUtils).createUnimplemented;
local _ = require(l_script_FirstAncestor_0.Src.Types);
return (v1.createContext({
    promptGroups = {},
    materialStates = {},
    addMaterials = l_createUnimplemented_0("addMaterials"),
    removeMaterial = l_createUnimplemented_0("removeMaterial"),
    removeAllMaterials = l_createUnimplemented_0("removeAllMaterials"),
    hasBaseMaterial = l_createUnimplemented_0("hasBaseMaterial"),
    markHasBaseMaterial = l_createUnimplemented_0("markHasBaseMaterial"),
    getMaterialStatus = l_createUnimplemented_0("getMaterialStatus"),
    setMaterialStatus = l_createUnimplemented_0("setMaterialStatus")
}));


local l_script_FirstAncestor_0 = script:FindFirstAncestor("MaterialGenerator");
local v1 = require(l_script_FirstAncestor_0.Packages.Dash);
local v2 = require(l_script_FirstAncestor_0.Packages.React);
local v3 = require(l_script_FirstAncestor_0.Src.Util.GeneratedMaterialsContext);
local _ = require(l_script_FirstAncestor_0.Src.Types);
local v5 = {};
local function v18(v6)
    local v7, _ = v2.useState(v6.promptGroups);
    local v9, _ = v2.useState(v6.materialStates);
    local v11, v12 = v2.useState(nil);
    return v2.createElement(v3.Provider, {
        value = {
            promptGroups = v7,
            materialStates = v9,
            addMaterials = function()
            end,
            removeMaterial = function()
            end,
            removeAllMaterials = function()
            end,
            hasBaseMaterial = function(_)
                return false;
            end,
            markHasBaseMaterial = function(_)
            end,
            getMaterialStatus = function(_)
                return "None";
            end,
            setMaterialStatus = function(_, _)
            end,
            previewMaterial = v11,
            setPreviewMaterial = v12
        }
    }, v6.children);
end;
v5.BasicProvider = function(v19)
    return v2.createElement(v18, {
        promptGroups = v2.useMemo(function()
            return {
                {
                    materialVariants = v19.instances,
                    promptText = "test prompt",
                    filteredPromptText = "test prompt"
                }
            };
        end, {
            v19.instances
        }),
        materialStates = v2.useMemo(function()
            return v1.collect(v19.instances, function(_, v21)
                return v21, {
                    generationId = "1",
                    hasBaseMaterial = false;
                    "None"
                };
            end);
        end, {
            v19.instances
        })
    }, v19.children);
end;
return v5;


local l_script_FirstAncestor_0 = script:FindFirstAncestor("MaterialGenerator");
local v1 = require(l_script_FirstAncestor_0.Packages.React);
local l_createUnimplemented_0 = require(l_script_FirstAncestor_0.Packages.ReactUtils).createUnimplemented;
local _ = require(l_script_FirstAncestor_0.Src.Types);
return (v1.createContext({
    session = nil,
    isGenerating = false,
    lastGeneratedPromptText = "",
    promptText = "",
    setPromptText = l_createUnimplemented_0("setPromptText"),
    errorMessage = nil,
    popError = l_createUnimplemented_0("popError"),
    generateMaterialVariants = l_createUnimplemented_0("generateMaterialVariants"),
    uploadMaterialVariant = l_createUnimplemented_0("uploadMaterialVariant")
}));


local l_script_FirstAncestor_0 = script:FindFirstAncestor("MaterialGenerator");
local v1 = require(l_script_FirstAncestor_0.Packages.React);
local l_createUnimplemented_0 = require(l_script_FirstAncestor_0.Packages.ReactUtils).createUnimplemented;
local _ = require(l_script_FirstAncestor_0.Src.Types);
return v1.createContext({
    getSetting = l_createUnimplemented_0("getSetting"),
    setSetting = l_createUnimplemented_0("setSetting"),
    pluginSettings = {}
});


local l_script_FirstAncestor_0 = script:FindFirstAncestor("MaterialGenerator");
local v1 = require(l_script_FirstAncestor_0.Packages.React);
local l_createUnimplemented_0 = require(l_script_FirstAncestor_0.Packages.ReactUtils).createUnimplemented;
local _ = require(l_script_FirstAncestor_0.Src.Types);
return (v1.createContext({
    selectedMaterial = nil,
    setSelectedMaterial = l_createUnimplemented_0("setSelectedMaterial"),
    applySelectedMaterial = l_createUnimplemented_0("applySelectedMaterial")
}));


local l_script_FirstAncestor_0 = script:FindFirstAncestor("MaterialGenerator");
local v1 = require(l_script_FirstAncestor_0.Packages.React);
local _ = require(l_script_FirstAncestor_0.Packages.ReactUtils).useToggleState;
local v3 = require(l_script_FirstAncestor_0.Src.Util.PreviewContext);
local v4 = {};
local function v8(v5)
    local v6, v7 = v1.useState(v5.selectedMaterial);
    return v1.createElement(v3.Provider, {
        value = {
            selectedMaterial = v6,
            setSelectedMaterial = v7,
            applySelectedMaterial = function()
            end
        }
    }, v5.children);
end;
v4.BasicProvider = function(v9)
    return v1.createElement(v8, {
        selectedMaterial = v9.selectedMaterial
    }, v9.children);
end;
return v4;


local l_map_0 = require(script.Parent.Parent.Parent.Packages.Dash).map;
local v1 = {
    Enum.Material.Asphalt,
    Enum.Material.Basalt,
    Enum.Material.Brick,
    Enum.Material.Cobblestone,
    Enum.Material.Concrete,
    Enum.Material.CorrodedMetal,
    Enum.Material.CrackedLava,
    Enum.Material.DiamondPlate,
    Enum.Material.Fabric,
    Enum.Material.Foil,
    Enum.Material.Glacier,
    Enum.Material.Granite,
    Enum.Material.Grass,
    Enum.Material.Ground,
    Enum.Material.Ice,
    Enum.Material.LeafyGrass,
    Enum.Material.Limestone,
    Enum.Material.Marble,
    Enum.Material.Metal,
    Enum.Material.Mud,
    Enum.Material.Pavement,
    Enum.Material.Pebble,
    Enum.Material.Plastic,
    Enum.Material.Rock,
    Enum.Material.Salt,
    Enum.Material.Sand,
    Enum.Material.Sandstone,
    Enum.Material.Slate,
    Enum.Material.SmoothPlastic,
    Enum.Material.Snow,
    Enum.Material.Wood,
    Enum.Material.WoodPlanks
};
return {
    getIcons = function()
        return l_map_0(v1, function(v2)
            return (("rbxasset://textures/MaterialGenerator/Materials/%*.png"):format(v2.Name));
        end);
    end,
    getNames = function()
        return l_map_0(v1, function(v3)
            return v3.Name;
        end);
    end
};


local l_script_FirstAncestor_0 = script:FindFirstAncestor("MaterialGenerator");
local v1 = require(l_script_FirstAncestor_0.Packages.Dash);
local _ = require(l_script_FirstAncestor_0.Src.Types);
return function(v3, v4, v5, v6)
    local v7 = v6[1];
    local v8 = {
        materialVariants = v3,
        promptText = v4,
        filteredPromptText = v5
    };
    if v7 and v7.promptText == v4 then
        v1.append(v8.materialVariants, v7.materialVariants);
        return v1.append({
            v8
        }, v1.slice(v6, 2));
    else
        return v1.append({
            v8
        }, v6);
    end;
end;


local l_Parent_0 = script.Parent.Parent.Parent;
local _ = require(l_Parent_0.Src.Types);
local l_Util_0 = l_Parent_0.Src.Util;
local v3 = require(l_Util_0.createMaterialVariant);
local v4 = require(l_Util_0.getNewMaterialName);
return function(v5, v6, v7)
    local v8 = {
        Name = v4(v5, v7),
        Id = v6,
        Textures = {
            ColorMap = v6
        },
        BaseMaterial = nil,
        IsGenerating = false,
        IsTemporary = true
    };
    v8.MaterialVariant = v3(v8);
    return v8;
end;


local _ = require(script.Parent.Parent.Parent.Src.Types);
return function(v1)
    local l_MaterialVariant_0 = Instance.new("MaterialVariant");
    l_MaterialVariant_0.Name = v1.Name;
    l_MaterialVariant_0.Archivable = false;
    local l_Textures_0 = v1.Textures;
    l_MaterialVariant_0.ColorMap = l_Textures_0.ColorMap;
    if l_Textures_0.NormalMap then
        l_MaterialVariant_0.NormalMap = l_Textures_0.NormalMap;
    end;
    if l_Textures_0.MetalnessMap then
        l_MaterialVariant_0.MetalnessMap = l_Textures_0.MetalnessMap;
    end;
    if l_Textures_0.RoughnessMap then
        l_MaterialVariant_0.RoughnessMap = l_Textures_0.RoughnessMap;
    end;
    return l_MaterialVariant_0;
end;


local l_Parent_0 = script.Parent.Parent.Parent;
local _ = require(l_Parent_0.Src.Types);
local v2 = require(l_Parent_0.Packages.Promise);
local v3 = require(l_Parent_0.Src.Enum.GenerationErrorType);
local function _(v4)
    local l_Textures_0 = v4.Textures;
    local v6 = false;
    if l_Textures_0.MetalnessMap ~= nil then
        v6 = false;
        if l_Textures_0.NormalMap ~= nil then
            v6 = l_Textures_0.RoughnessMap ~= nil;
        end;
    end;
    return v6;
end;
return function(v8, v9)
    local l_Textures_1 = v9.Textures;
    local v11 = false;
    if l_Textures_1.MetalnessMap ~= nil then
        v11 = false;
        if l_Textures_1.NormalMap ~= nil then
            v11 = l_Textures_1.RoughnessMap ~= nil;
        end;
    end;
    if not v11 then
        return v2.new(function(v12, v13)
            task.spawn(function()
                local v14 = nil;
                local l_status_0, l_result_0 = pcall(function()
                    v14 = v8:GenerateMaterialMapsAsync(v9.Id);
                end);
                if l_status_0 then
                    if v14 then
                        v12({
                            ColorMap = v14.ColorMap,
                            MetalnessMap = v14.MetalnessMap,
                            NormalMap = v14.NormalMap,
                            RoughnessMap = v14.RoughnessMap
                        });
                        return ;
                    else
                        v13({
                            ErrorType = v3.FailedToGenerate
                        });
                        return ;
                    end;
                else
                    if not l_result_0 then
                        v13({
                            ErrorType = v3.Unknown
                        });
                    else
                        v13({
                            ErrorType = v3.CustomMessage,
                            ErrorMessage = l_result_0
                        });
                    end;
                    return ;
                end;
            end);
        end);
    else
        return v2.resolve(v9.Textures);
    end;
end;


local l_script_FirstAncestor_0 = script:FindFirstAncestor("MaterialGenerator");
local v1 = require(l_script_FirstAncestor_0.Packages.Dash);
local v2 = require(l_script_FirstAncestor_0.Packages.Promise);
local l_Util_0 = l_script_FirstAncestor_0.Src.Util;
local v4 = require(l_Util_0.Constants);
local v5 = require(l_Util_0.parseGenerationError);
local _ = require(l_script_FirstAncestor_0.Src.Types);
local function _(v7, v8)
    return v2.new(function(v9, v10)
        local v11 = nil;
        local v12 = nil;
        local l_status_0, l_result_0 = pcall(function()
            local v13, v14 = v8:GenerateImagesAsync(v7, {
                Samples = v4.GENERATION_SAMPLES
            });
            v11 = v13;
            v12 = v14;
        end);
        if not l_status_0 then
            local v17, v18 = v5(l_result_0);
            v10({
                errorType = v17,
                message = v18
            });
        else
            v9({
                imageIds = v11,
                filteredPromptText = v12
            });
        end;
    end);
end;
local function v29(v20, v21)
    return v2.new(function(v22, v23)
        task.spawn(function()
            local v24 = nil;
            local l_status_1, l_result_1 = pcall(function()
                v24 = v21:GenerateMaterialMapsAsync(v20);
            end);
            if not l_status_1 or not v24 then
                local v27, v28 = v5(l_result_1);
                v23({
                    errorType = v27,
                    message = v28
                });
            else
                v22({
                    colorMap = v20,
                    metalnessMap = v24.MetalnessMap,
                    normalMap = v24.NormalMap,
                    roughnessMap = v24.RoughnessMap
                });
            end;
        end);
    end);
end;
return function(v30, v31)
    local v32 = nil;
    return v2.new(function(v33, v34)
        local v35 = nil;
        local v36 = nil;
        local l_status_2, l_result_2 = pcall(function()
            local v37, v38 = v31:GenerateImagesAsync(v30, {
                Samples = v4.GENERATION_SAMPLES
            });
            v35 = v37;
            v36 = v38;
        end);
        if not l_status_2 then
            local v41, v42 = v5(l_result_2);
            v34({
                errorType = v41,
                message = v42
            });
        else
            v33({
                imageIds = v35,
                filteredPromptText = v36
            });
        end;
    end):andThen(function(v43)
        v32 = v43.filteredPromptText;
        return v2.all(v1.map(v43.imageIds, function(v44)
            return v29(v44, v31);
        end));
    end):andThen(function(v45)
        return v2.resolve({
            materialVariants = v1.map(v45, function(v46)
                local l_MaterialVariant_0 = Instance.new("MaterialVariant");
                l_MaterialVariant_0.Archivable = false;
                l_MaterialVariant_0.ColorMap = v46.colorMap;
                l_MaterialVariant_0.MetalnessMap = v46.metalnessMap;
                l_MaterialVariant_0.NormalMap = v46.normalMap;
                l_MaterialVariant_0.RoughnessMap = v46.roughnessMap;
                return l_MaterialVariant_0;
            end),
            filteredPromptText = v32
        });
    end);
end;


local l_Parent_0 = script.Parent.Parent.Parent;
local _ = require(l_Parent_0.Src.Types);
local l_Util_0 = l_Parent_0.Src.Util;
local v3 = require(l_Util_0.createMaterialVariant);
local v4 = require(l_Util_0.DEPRECATED_getNewMaterialName);
return function(v5, v6, v7, _)
    local v9 = {
        Name = v4(v5, game:GetService("MaterialService")),
        Id = v6,
        Textures = {
            ColorMap = v7
        },
        BaseMaterial = nil,
        IsGenerating = false,
        IsTemporary = true
    };
    v9.MaterialVariant = v3(v9);
    return v9;
end;


local l_script_FirstAncestor_0 = script:FindFirstAncestor("MaterialGenerator");
local v1 = require(l_script_FirstAncestor_0.Packages.Dash);
local _ = require(l_script_FirstAncestor_0.Src.Types);
return function(v3)
    return v1.flat(v1.map(v3, function(v4)
        return v4.materialVariants;
    end));
end;


local _ = script:FindFirstAncestor("MaterialGenerator");
local function _(v1)
    return (v1:lower():gsub("[ _](%a)", string.upper):gsub("^%a", string.upper):gsub("%p", ""));
end;
local function v10(v3, v4)
    local v5 = {};
    for _, v7 in v4, nil, nil do
        v5[string.lower(v7)] = true;
    end;
    local v8 = string.lower(v3);
    if v5[v8] then
        local v9 = 0;
        while true do
            v9 = v9 + 1;
            if not v5[string.format("%s %0d", v8, v9)] then
                break;
            end;
        end;
        return string.format("%s %0d", v3, v9);
    else
        return v3;
    end;
end;
return function(v11, v12)
    return v10(v11:lower():gsub("[ _](%a)", string.upper):gsub("^%a", string.upper):gsub("%p", ""), v12 or {});
end;


local l_script_FirstAncestor_0 = script:FindFirstAncestor("MaterialGenerator");
local v1 = require(l_script_FirstAncestor_0.Src.Util.Constants);
local v2 = require(l_script_FirstAncestor_0.Src.Flags.getFIntMaterialGeneratorSampleCount);
return function()
    local v3 = v2();
    if v3 > 0 then
        return v3;
    else
        return v1.GENERATION_SAMPLES;
    end;
end;


local l_script_FirstAncestor_0 = script:FindFirstAncestor("MaterialGenerator");
local v1 = require(l_script_FirstAncestor_0.Packages.Dash);
local v2 = require(l_script_FirstAncestor_0.Packages.Framework);
local v3 = require(l_script_FirstAncestor_0.Packages.MaterialFramework);
local v4 = require(l_script_FirstAncestor_0.Packages.React);
local v5 = require(l_script_FirstAncestor_0.Packages.ReactUtils);
local v6 = require(l_script_FirstAncestor_0.Packages.Rodux);
local l_ContextStack_0 = v5.ContextStack;
local l_ContextServices_0 = v2.ContextServices;
local l_TestHelpers_0 = v2.TestHelpers;
local l_StudioServices_0 = v3.Context.StudioServices;
local l_Components_0 = l_script_FirstAncestor_0.Src.Components;
local v12 = require(l_Components_0.GenerationProvider);
local v13 = require(l_Components_0.GeneratedMaterialsProvider);
local v14 = require(l_Components_0.PluginSettingsProvider);
local v15 = require(l_Components_0.PreviewProvider);
local v16 = require(l_script_FirstAncestor_0.Src.Controllers.MaterialPreviewController);
local v17 = require(l_script_FirstAncestor_0.Src.Flags.getFFlagMaterialGeneratorNewUI);
local v18 = require(l_script_FirstAncestor_0.Src.Reducers.MainReducer);
local v19 = {
    l_ContextServices_0.Analytics.mock(),
    l_ContextServices_0.Localization.mock(),
    require(l_script_FirstAncestor_0.Src.Resources.MakeTheme)(true),
    l_StudioServices_0.mock()
};
if not v17() then
    local v20 = l_ContextServices_0.Store.new(v6.Store.new(v18, nil, {
        v6.thunkMiddleware
    }, nil));
    table.insert(v19, v20);
    table.insert(v19, v16.new(v20, true));
end;
return function(v21, v22)
    assert(type(v21) == "table", "Expected story to be a table");
    if not v17() then
        return l_TestHelpers_0.provideMockContext(v19, v21);
    else
        return l_TestHelpers_0.provideMockContext(v19, {
            ContextStack = v4.createElement(l_ContextStack_0, {
                providers = v1.append({
                    v4.createElement(v12),
                    v4.createElement(v13),
                    v4.createElement(v14),
                    v4.createElement(v15, {
                        enabled = true
                    })
                }, v22 or {})
            }, v21)
        });
    end;
end;


local v0 = require(script:FindFirstAncestor("MaterialGenerator").Src.Enum.GenerationErrorType);
return function(v1)
    if type(v1) == "string" then
        if not string.find(v1, "got network error status: 429") then
            if not string.find(v1, "got network error status: 500") then
                if not string.find(v1, "got network error status: 504") then
                    if not string.find(v1, "TextFullyFiltered") then
                        if not string.find(v1, "AccountingFailed") or not string.find(v1, "Decrementing account failed") then
                            return v0.CustomMessage, v1;
                        else
                            return v0.AccountingFailedDecrement;
                        end;
                    else
                        return v0.TextFullyFiltered;
                    end;
                else
                    return v0.ServerError504;
                end;
            else
                return v0.ServerError500;
            end;
        else
            return v0.TooManyRequests;
        end;
    else
        return v0.Unknown, nil;
    end;
end;


local l_script_FirstAncestor_0 = script:FindFirstAncestor("MaterialGenerator");
local v1 = require(l_script_FirstAncestor_0.Packages.Dash);
local l_LUAU_ANALYZE_ERROR_0 = require(l_script_FirstAncestor_0.Packages.ReactUtils).LUAU_ANALYZE_ERROR;
local _ = require(l_script_FirstAncestor_0.Src.Types);
local function _(v4, v5)
    return v1.find(v5, function(v6)
        return table.find(v6.materialVariants, v4) ~= nil;
    end);
end;
return function(v8, v9)
    local v11 = v1.find(v9, function(v10)
        return table.find(v10.materialVariants, v8) ~= nil;
    end);
    if v11 then
        assert(v11 ~= nil, l_LUAU_ANALYZE_ERROR_0);
        local v13 = v1.join(v11, {
            materialVariants = v1.filter(v11.materialVariants, function(v12)
                return v12 ~= v8;
            end)
        });
        if #v13.materialVariants == 0 then
            local v14 = table.find(v9, v11);
            assert(v14 ~= nil, "Expected promptGroups to contain found group");
            local v15 = v9[v14 - 1];
            local v16 = v9[v14 + 1];
            if not (not v15 or not v16) and v15.promptText == v16.promptText then
                return v1.append(v1.slice(v9, nil, v14 - 2), {
                    (v1.join(v15, {
                        materialVariants = v1.append({}, v15.materialVariants, v16.materialVariants)
                    }))
                }, (v1.slice(v9, v14 + 2, nil)));
            else
                return v1.filter(v9, function(v17)
                    return v17 ~= v11;
                end);
            end;
        else
            return v1.map(v9, function(v18)
                if v18 == v11 then
                    return v13;
                else
                    return v18;
                end;
            end);
        end;
    else
        warn("MaterialVariant doesn't belong to a group");
        return v9;
    end;
end;


local function _(v0)
    assert(type(v0) == "string", "Bad str");
    return string.gsub(v0, "[%(%)%.%%%+%-%*%?%[%]%^%$]", function(v1)
        return "%" .. v1;
    end);
end;
return function(v3, v4, v5)
    if v3 == v4 then
        return v5;
    elseif v3 ~= nil then
        local l_gsub_0 = string.gsub;
        local l_v3_0 = v3;
        assert(type(v4) == "string", "Bad str");
        l_gsub_0, l_v3_0 = l_gsub_0(l_v3_0, string.gsub(v4, "[%(%)%.%%%+%-%*%?%[%]%^%$]", function(v8)
            return "%" .. v8;
        end), v5, 1);
        if l_v3_0 > 0 then
            return l_gsub_0;
        else
            return nil;
        end;
    else
        return nil;
    end;
end;


local l_script_FirstAncestor_0 = script:FindFirstAncestor("MaterialGenerator");
local v1 = require(l_script_FirstAncestor_0.Packages.Promise);
local v2 = require(l_script_FirstAncestor_0.Src.Enum.GenerationErrorType);
local _ = require(l_script_FirstAncestor_0.Src.Types);
return function(v4, v5)
    return v1.new(function(v6, v7)
        local v8 = nil;
        local l_status_0, l_result_0 = pcall(function()
            v8 = v5:UploadMaterialAsync(v4.ColorMap);
        end);
        if not l_status_0 or not v8 then
            v7({
                errorType = if not l_result_0 then v2.Unknown else v2.CustomMessage,
                message = l_result_0
            });
            return ;
        else
            v6({
                colorMap = v8.ColorMap,
                metalnessMap = v8.MetalnessMap,
                normalMap = v8.NormalMap,
                roughnessMap = v8.RoughnessMap
            });
            return ;
        end;
    end);
end;


game:DefineFastInt("InfluxReportMaterialManagerHundrethPercent2", 0);
game:DefineFastFlag("ShowMaterialManagerFromElsewhere", false);
return nil;


if plugin then
    local l_Parent_0 = script.Parent.Parent;
    require(script.Parent.defineLuaFlags);
    local l_status_0, l_result_0 = pcall(function()
        return game:GetService("StudioService"):HasInternalPermission();
    end);
    require(script.Parent.commonInit)();
    local v3 = require(l_Parent_0.Packages.TestLoader);
    v3.launch(l_Parent_0.Name, l_Parent_0.Src);
    if not v3.isCli() then
        local v4 = require(l_Parent_0.Packages.Roact);
        local v5 = require(l_Parent_0.Packages.Framework);
        local v6 = require(l_Parent_0.Src.MainPlugin);
        local v7 = nil;
        local v8 = nil;
        if not (not l_status_0 or not l_result_0) then
            v8 = v5.DeveloperTools.forPlugin(l_Parent_0.Name, plugin);
        end;
        local function v9()
            plugin.Name = l_Parent_0.Name;
            v7 = v4.mount((v4.createElement(v6, {
                Plugin = plugin
            })));
            if v8 then
                v8:addRoactTree("Roact tree", v7);
            end;
        end;
        plugin.Unloading:Connect(function()
            if v8 then
                v8:destroy();
            end;
            if v7 then
                v4.unmount(v7);
                v7 = nil;
            end;
        end);
        v9();
        return ;
    else
        return ;
    end;
else
    return ;
end;


local l_Parent_0 = script.Parent.Parent;
require(script.Parent.commonInit)();
local v1 = require(l_Parent_0.Src.Util.DebugFlags);
if not (not v1.RunningUnderCLI() and not v1.RunTests()) then
    _G.__DEV__ = true;
    _G.__ROACT_17_MOCK_SCHEDULER__ = true;
    _G.__ROACT_17_INLINE_ACT__ = true;
    local v2 = require(l_Parent_0.Packages.Dev.TestEZ);
    local l_TestBootstrap_0 = v2.TestBootstrap;
    local l_TeamCityReporter_0 = v2.Reporters.TeamCityReporter;
    local l_TextReporter_0 = v2.Reporters.TextReporter;
    if v1.LogTestsQuiet() then
        l_TextReporter_0 = v2.Reporters.TextReporterQuiet;
    end;
    l_TextReporter_0 = not not _G.TEAMCITY and l_TeamCityReporter_0 or l_TextReporter_0;
    print("----- All " .. script.Parent.Parent.Name .. " Tests ------");
    require(script.Parent.defineLuaFlags);
    l_TestBootstrap_0:run({
        l_Parent_0.Src
    }, l_TextReporter_0);
    print("----------------------------------");
end;
if v1.RunningUnderCLI() then
    pcall(function()
        game:GetService("ProcessService"):ExitAsync(0);
    end);
end;


local l_Parent_0 = script.Parent.Parent.Parent;
local _ = require(l_Parent_0.Src.Types);
return require(l_Parent_0.Packages.Framework).Util.Action(script.Name, function(v2)
    assert(type(v2) == "table", ("Expected materialWrapper to be a table, received %s"):format((type(v2))));
    return {
        MaterialWrapper = v2
    };
end);


return require(script.Parent.Parent.Parent.Packages.Framework).Util.Action(script.Name, function(v0)
    assert(type(v0) == "boolean", ("Expected active to be boolean, received %s"):format((type(v0))));
    return {
        DEPRECATED_ActiveAsTool = v0
    };
end);


local l_Parent_0 = script.Parent.Parent.Parent;
local _ = require(l_Parent_0.Src.Types);
return require(l_Parent_0.Packages.Framework).Util.Action(script.Name, function(v2, v3)
    assert(type(v2) == "string", ("Expected paneName to be a string, received %s"):format((type(v2))));
    assert(type(v3) == "boolean", ("Expected expandedPaneState to be a boolean, received %s"):format((type(v3))));
    return {
        PaneName = v2,
        ExpandedPaneState = v3
    };
end);


local l_Parent_0 = script.Parent.Parent.Parent;
local _ = require(l_Parent_0.Src.Types);
return require(l_Parent_0.Packages.Framework).Util.Action(script.Name, function(v2)
    assert(type(v2) == "table", ("Expected material to be a table, received %s"):format((type(v2))));
    return {
        Material = v2
    };
end);


local l_Parent_0 = script.Parent.Parent.Parent;
local _ = require(l_Parent_0.Src.Types);
return require(l_Parent_0.Packages.Framework).Util.Action(script.Name, function(v2)
    assert(type(v2) == "table", ("Expected materialBrowserLayout to be a table, received %s"):format((type(v2))));
    return {
        MaterialBrowserLayout = v2
    };
end);


local l_Parent_0 = script.Parent.Parent.Parent;
local _ = require(l_Parent_0.Src.Types);
return require(l_Parent_0.Packages.Framework).Util.Action(script.Name, function(v2)
    assert(type(v2) == "table", ("Expected materialList to be a table, received %s"):format((type(v2))));
    return {
        MaterialList = v2
    };
end);


local l_Parent_0 = script.Parent.Parent.Parent;
local _ = require(l_Parent_0.Src.Types);
return require(l_Parent_0.Packages.Framework).Util.Action(script.Name, function(v2, v3)
    assert(type(v3) == "number", ("Expected index to be a number, received %s"):format((type(v3))));
    return {
        Index = v3,
        Material = v2
    };
end);


local l_Parent_0 = script.Parent.Parent.Parent;
local _ = require(l_Parent_0.Src.Types);
return require(l_Parent_0.Packages.Framework).Util.Action(script.Name, function(v2, v3)
    assert(type(v3) == "table", ("Expected overrides to be a table, received %s"):format((type(v3))));
    return {
        Material = v2,
        Overrides = v3
    };
end);


local l_Parent_0 = script.Parent.Parent.Parent;
local _ = require(l_Parent_0.Src.Types);
return require(l_Parent_0.Packages.Framework).Util.Action(script.Name, function(v2, v3)
    return {
        Material = v2,
        MaterialStatus = v3
    };
end);


local l_Parent_0 = script.Parent.Parent.Parent;
local _ = require(l_Parent_0.Src.Types);
return require(l_Parent_0.Packages.Framework).Util.Action(script.Name, function(v2)
    assert(type(v2) == "number", ("Expected material to be a number, received %s"):format((type(v2))));
    return {
        MaterialTileSize = v2
    };
end);


local l_Parent_0 = script.Parent.Parent.Parent;
local _ = require(l_Parent_0.Src.Types);
return require(l_Parent_0.Packages.Framework).Util.Action(script.Name, function(v2)
    return {
        MaterialVariant = v2
    };
end);


return require(script.Parent.Parent.Parent.Packages.Framework).Util.Action(script.Name, function(v0)
    assert(type(v0) == "boolean", ("Expected menuHover to be a boolean, received %s"):format((type(v0))));
    return {
        MenuHover = v0
    };
end);


local l_Parent_0 = script.Parent.Parent.Parent;
local _ = require(l_Parent_0.Src.Types);
return require(l_Parent_0.Packages.Framework).Util.Action(script.Name, function(v2)
    assert(type(v2) == "table", ("Expected oath to be a table, received %s"):format((type(v2))));
    return {
        Path = v2
    };
end);


return require(script.Parent.Parent.Parent.Packages.Framework).Util.Action(script.Name, function(v0)
    assert(type(v0) == "string", ("Expected search to be a string, received %s"):format((type(v0))));
    return {
        Search = v0
    };
end);


local l_Parent_0 = script.Parent.Parent.Parent;
local _ = require(l_Parent_0.Src.Types);
return require(l_Parent_0.Packages.Framework).Util.Action(script.Name, function(v2)
    assert(type(v2) == "boolean", ("Expected material to be a boolean, received %s"):format((type(v2))));
    return {
        Use2022Materials = v2
    };
end);


return require(script.Parent.Parent.Parent.Packages.Framework).Util.Action(script.Name, function(v0)
    assert(type(v0) == "string", ("Expected viewType to be a string, received %s"):format((type(v0))));
    return {
        ViewType = v0
    };
end);


local l_Parent_0 = script.Parent.Parent.Parent;
local v1 = require(l_Parent_0.Packages.Framework);
local v2 = require(l_Parent_0.Packages.Roact);
local l_Dash_0 = v1.Dash;
local l_withContext_0 = v1.ContextServices.withContext;
local l_LoadingIndicator_0 = v1.UI.LoadingIndicator;
local v6 = require(l_Parent_0.Src.Controllers.ImageLoader);
local v7 = v2.PureComponent:extend("LoadingImage");
v7.init = function(v8)
    local l_props_0 = v8.props;
    v8.state = {
        currentImageLoaded = false
    };
    v8.mostRecentRequestedImage = nil;
    v8.requestLoadImage = function(v10)
        if v10 == v8.mostRecentRequestedImage then
            return ;
        else
            v8:setState({
                currentImageLoaded = false
            });
            v8.mostRecentRequestedImage = v10;
            if v10 ~= nil and v10 ~= "" then
                l_props_0.ImageLoader:loadImage(v10);
            end;
            return ;
        end;
    end;
    v8.onImageLoaded = function(v11)
        if v8.isMounted then
            if v11 == v8.mostRecentRequestedImage then
                v8:setState({
                    currentImageLoaded = true
                });
            end;
            return ;
        else
            return ;
        end;
    end;
end;
v7.didMount = function(v12)
    local l_props_1 = v12.props;
    v12.isMounted = true;
    v12.onImageLoaderConnection = l_props_1.ImageLoader.ImageLoaded:Connect(v12.onImageLoaded);
    v12.requestLoadImage(l_props_1.Image);
end;
v7.willUnmount = function(v14)
    if v14.onImageLoaderConnection then
        v14.onImageLoaderConnection:Disconnect();
        v14.onImageLoaderConnection = nil;
    end;
    v14.isMounted = false;
end;
v7.didUpdate = function(v15, v16, _)
    local l_props_2 = v15.props;
    if v16.Image ~= l_props_2.Image then
        v15.requestLoadImage(l_props_2.Image);
    end;
end;
v7.render = function(v19)
    local l_props_3 = v19.props;
    local l_currentImageLoaded_0 = v19.state.currentImageLoaded;
    return v2.createElement("Frame", {
        LayoutOrder = l_props_3.LayoutOrder,
        AnchorPoint = l_props_3.AnchorPoint,
        Position = l_props_3.Position,
        Size = l_props_3.Size,
        ZIndex = l_props_3.ZIndex,
        BackgroundTransparency = 1
    }, {
        Image = l_currentImageLoaded_0 and v2.createElement("ImageLabel", not not l_currentImageLoaded_0 and l_Dash_0.join(l_props_3, {
            Size = UDim2.new(1, 0, 1, 0),
            LayoutOrder = 2,
            AnchorPoint = l_Dash_0.None,
            Position = l_Dash_0.None,
            ZIndex = l_Dash_0.None,
            ImageTransparency = 0.5,
            ImageLoader = l_Dash_0.None
        }) or {}),
        LoadingSpinner = if l_currentImageLoaded_0 then nil else v2.createElement(l_LoadingIndicator_0, {
            LayoutOrder = 1,
            AnchorPoint = Vector2.new(0.5, 0.5),
            Position = UDim2.new(0.5, 0, 0.5, 0),
            Size = UDim2.fromScale(0.5, 0.5)
        })
    });
end;
return (l_withContext_0({
    ImageLoader = v6
})(v7));


local l_Parent_0 = script.Parent.Parent.Parent.Parent.Parent;
local _ = require(l_Parent_0.Src.Types);
local v2 = require(l_Parent_0.Packages.Roact);
local v3 = require(l_Parent_0.Packages.RoactRodux);
local v4 = require(l_Parent_0.Packages.Framework);
local l_ContextServices_0 = v4.ContextServices;
local l_withContext_0 = l_ContextServices_0.withContext;
local l_Analytics_0 = l_ContextServices_0.Analytics;
local l_Localization_0 = l_ContextServices_0.Localization;
local l_Stylizer_0 = v4.Style.Stylizer;
local l_UI_0 = v4.UI;
local l_DEPRECATED_TextInput_0 = l_UI_0.DEPRECATED_TextInput;
local l_SelectInput_0 = l_UI_0.SelectInput;
local l_ExpandablePane_0 = l_UI_0.ExpandablePane;
local v14 = require(l_Parent_0.Src.Actions.SetExpandedPane);
local _ = require(l_Parent_0.Src.Reducers.MainReducer);
local l_Controllers_0 = l_Parent_0.Src.Controllers;
local v17 = require(l_Controllers_0.MaterialServiceController);
local v18 = require(l_Controllers_0.GeneralServiceController);
local v19 = require(l_Parent_0.Src.Components.MaterialBrowser.MaterialEditor.LabeledElement);
local l_Constants_0 = l_Parent_0.Src.Resources.Constants;
local v21 = require(l_Constants_0.getMaterialPath);
local v22 = require(l_Constants_0.getSupportedMaterials);
local v23 = require(l_Constants_0.getMaterialName);
local v24 = require(l_Constants_0.getSettingsNames)();
local v25 = v22(true);
local v26 = v2.PureComponent:extend("GeneralSettings");
v26.init = function(v27)
    v27.state = {
        name = v27.props.MaterialVariant.Name
    };
    v27.baseMaterials = {};
    v27.setNameStatus = function(v28, v29)
        v27:setState({
            nameMessage = v28 or v2.None,
            status = v29 or Enum.PropertyStatus.Ok
        });
    end;
    v27.onNameChanged = function(v30)
        v27:setState({
            name = v30
        });
    end;
    v27.onFocusLost = function()
        local l_props_0 = v27.props;
        local l_Localization_1 = l_props_0.Localization;
        if v27.state.name and v27.state.name ~= "" then
            l_props_0.GeneralServiceController:setName(l_props_0.MaterialVariant, v27.state.name);
            if not l_props_0.MaterialServiceController:checkMaterialName(v27.state.name, l_props_0.MaterialVariant.BaseMaterial) then
                v27.setNameStatus(nil);
                return ;
            else
                v27.setNameStatus(l_Localization_1:getText("CreateDialog", "ErrorNameExists"), Enum.PropertyStatus.Warning);
                return ;
            end;
        else
            v27:setState({
                name = l_props_0.MaterialVariant.Name
            });
            return ;
        end;
    end;
    v27.onBaseMaterialSelected = function(_, v34)
        local l_props_1 = v27.props;
        local l_Localization_2 = l_props_1.Localization;
        l_props_1.GeneralServiceController:setBaseMaterial(l_props_1.MaterialVariant, v25[v34]);
        l_props_1.MaterialServiceController:setPath(v21(l_props_1.MaterialVariant.BaseMaterial));
        if not l_props_1.MaterialServiceController:checkMaterialName(l_props_1.MaterialVariant.Name, l_props_1.MaterialVariant.BaseMaterial) then
            v27.setNameStatus(nil);
            return ;
        else
            v27.setNameStatus(l_Localization_2:getText("CreateDialog", "ErrorNameExists"), Enum.PropertyStatus.Warning);
            return ;
        end;
    end;
    v27.onExpandedChanged = function()
        local l_props_2 = v27.props;
        l_props_2.dispatchSetExpandedPane(v24.GeneralSettings, not l_props_2.ExpandedPane);
    end;
end;
v26.didMount = function(v38)
    local l_Localization_3 = v38.props.Localization;
    for _, v41 in ipairs(v25) do
        table.insert(v38.baseMaterials, l_Localization_3:getText("Materials", v23(v41)));
    end;
    v38:setState({});
end;
v26.didUpdate = function(v42, _, v44)
    if v42.state.name ~= v42.props.MaterialVariant.Name and v44.name == v42.state.name then
        v42:setState({
            name = v42.props.MaterialVariant.Name
        });
    end;
end;
v26.render = function(v45)
    local l_props_3 = v45.props;
    local l_GeneralSettings_0 = l_props_3.Stylizer.GeneralSettings;
    local l_Localization_4 = l_props_3.Localization;
    local v49 = -1;
    for v50, v51 in ipairs(v25) do
        if v51 == l_props_3.MaterialVariant.BaseMaterial then
            v49 = v50;
        end;
        if v51 == Enum.Material.Plastic and v49 == -1 then
            v49 = v50;
        end;
    end;
    if v49 == -1 then
        v49 = 1;
    end;
    return v2.createElement(l_ExpandablePane_0, {
        LayoutOrder = l_props_3.LayoutOrder,
        ContentPadding = l_GeneralSettings_0.ContentPadding,
        ContentSpacing = l_GeneralSettings_0.ItemSpacing,
        Text = l_Localization_4:getText("MaterialGeneral", "General"),
        Style = l_GeneralSettings_0.CustomExpandablePane,
        Expanded = l_props_3.ExpandedPane,
        OnExpandedChanged = v45.onExpandedChanged
    }, {
        Name = v2.createElement(v19, {
            LabelColumnWidth = l_GeneralSettings_0.LabelColumnWidth,
            LayoutOrder = 1,
            Text = l_Localization_4:getText("CreateDialog", "NameVariant"),
            StatusText = v45.state.nameMessage,
            Status = v45.state.status
        }, {
            v2.createElement(l_DEPRECATED_TextInput_0, {
                Style = "FilledRoundedBorder",
                Size = l_GeneralSettings_0.DialogColumnSize,
                Text = v45.state.name,
                OnTextChanged = v45.onNameChanged,
                OnFocusLost = v45.onFocusLost
            })
        }),
        BaseMaterial = v2.createElement(v19, {
            LabelColumnWidth = l_GeneralSettings_0.LabelColumnWidth,
            LayoutOrder = 2,
            Text = l_Localization_4:getText("CreateDialog", "BaseMaterialVariant")
        }, {
            v2.createElement(l_SelectInput_0, {
                Style = l_GeneralSettings_0.CustomSelectInput,
                Items = v45.baseMaterials,
                Size = l_GeneralSettings_0.DialogColumnSize,
                OnItemActivated = v45.onBaseMaterialSelected,
                PlaceholderText = l_Localization_4:getText("CreateDialog", "PlaceholderBaseMaterial"),
                SelectedIndex = v49
            })
        })
    });
end;
return v3.connect(function(v52)
    return {
        ExpandedPane = v52.MaterialBrowserReducer.ExpandedPane[v24.GeneralSettings],
        Material = v52.MaterialBrowserReducer.Material
    };
end, function(v53)
    return {
        dispatchSetExpandedPane = function(v54, v55)
            v53(v14(v54, v55));
        end
    };
end)((l_withContext_0({
    Analytics = l_Analytics_0,
    Localization = l_Localization_0,
    Stylizer = l_Stylizer_0,
    MaterialServiceController = v17,
    GeneralServiceController = v18
})(v26)));


local l_Parent_0 = script.Parent.Parent.Parent.Parent.Parent;
local v1 = require(l_Parent_0.Packages.Roact);
local v2 = require(l_Parent_0.Packages.Framework);
local l_join_0 = v2.Dash.join;
local l_UI_0 = v2.UI;
local l_TextLabel_0 = l_UI_0.TextLabel;
local l_Pane_0 = l_UI_0.Pane;
local l_LayoutOrderIterator_0 = v2.Util.LayoutOrderIterator;
local l_ContextServices_0 = v2.ContextServices;
local l_withContext_0 = l_ContextServices_0.withContext;
local l_Analytics_0 = l_ContextServices_0.Analytics;
local l_Localization_0 = l_ContextServices_0.Localization;
local l_Stylizer_0 = v2.Style.Stylizer;
local v13 = require(l_Parent_0.Src.Components.StatusIcon);
local v14 = v1.PureComponent:extend("LabeledElement");
v14.render = function(v15)
    local l_props_0 = v15.props;
    local l_LabeledElement_0 = l_props_0.Stylizer.LabeledElement;
    local v18 = l_LayoutOrderIterator_0.new();
    local v19 = l_props_0.FillDirection or l_LabeledElement_0.FillDirection;
    local v20 = UDim2.new(l_props_0.LabelColumnWidth, l_LabeledElement_0.LabelYSize);
    local l_ImageSize_0 = l_LabeledElement_0.ImageSize;
    local l_Status_0 = l_props_0.Status;
    local l_StatusText_0 = l_props_0.StatusText;
    local l_VerticalAlignment_0 = l_props_0.VerticalAlignment;
    return v1.createElement(l_Pane_0, {
        AutomaticSize = Enum.AutomaticSize.Y,
        HorizontalAlignment = Enum.HorizontalAlignment.Left,
        VerticalAlignment = l_VerticalAlignment_0 or Enum.VerticalAlignment.Top,
        Layout = Enum.FillDirection.Horizontal,
        LayoutOrder = l_props_0.LayoutOrder,
        Padding = l_props_0.Padding or if not l_Status_0 or l_Status_0 and l_Status_0 == Enum.PropertyStatus.Ok then {
            Left = l_ImageSize_0.Width.Offset
        } else nil
    }, {
        StatusIcon = if not not l_Status_0 and l_Status_0 ~= Enum.PropertyStatus.Ok then v1.createElement(v13, {
            LayoutOrder = v18:getNextOrder(),
            Size = l_ImageSize_0,
            StatusText = l_StatusText_0,
            Status = l_Status_0
        }) else nil,
        LabeledElement = v1.createElement(l_Pane_0, {
            HorizontalAlignment = Enum.HorizontalAlignment.Left,
            Layout = v19,
            LayoutOrder = v18:getNextOrder(),
            Spacing = 2,
            VerticalAlignment = l_VerticalAlignment_0 or Enum.VerticalAlignment.Top
        }, {
            Label = v1.createElement(l_TextLabel_0, {
                AutomaticSize = Enum.AutomaticSize.Y,
                Font = l_props_0.Font,
                LayoutOrder = 1,
                Size = v20,
                Text = l_props_0.Text,
                TextXAlignment = l_props_0.TextXAlignment or l_LabeledElement_0.TextXAlignment,
                TextWrapped = true
            }),
            ElementListItem = v1.createElement(l_Pane_0, l_join_0({
                LayoutOrder = 2,
                AutomaticSize = Enum.AutomaticSize.XY,
                VerticalAlignment = l_VerticalAlignment_0
            }, l_props_0.WrapperProps), l_props_0[v1.Children])
        })
    });
end;
return (l_withContext_0({
    Analytics = l_Analytics_0,
    Localization = l_Localization_0,
    Stylizer = l_Stylizer_0
})(v14));


local l_Parent_0 = script.Parent.Parent.Parent.Parent.Parent;
local _ = require(l_Parent_0.Src.Types);
local v2 = require(l_Parent_0.Packages.Roact);
local v3 = require(l_Parent_0.Packages.RoactRodux);
local v4 = require(l_Parent_0.Packages.Framework);
local l_Stylizer_0 = v4.Style.Stylizer;
local l_ContextServices_0 = v4.ContextServices;
local l_withContext_0 = l_ContextServices_0.withContext;
local l_Analytics_0 = l_ContextServices_0.Analytics;
local l_Localization_0 = l_ContextServices_0.Localization;
local l_UI_0 = v4.UI;
local l_Button_0 = l_UI_0.Button;
local l_Image_0 = l_UI_0.Image;
local l_Pane_0 = l_UI_0.Pane;
local v14 = require(l_Parent_0.Src.Actions.ClearMaterial);
local _ = require(l_Parent_0.Src.Reducers.MainReducer);
local v16 = require(l_Parent_0.Src.Components.MaterialPreview);
local v17 = v2.PureComponent:extend("MaterialHeader");
v17.init = function(v18)
    v18.onClose = function()
        v18.props.dispatchClearMaterial();
    end;
end;
v17.render = function(v19)
    local l_props_0 = v19.props;
    local l_MaterialHeader_0 = l_props_0.Stylizer.MaterialHeader;
    local l_Material_0 = l_props_0.Material;
    if l_Material_0 then
        return v2.createElement(l_Pane_0, {
            LayoutOrder = l_props_0.LayoutOrder,
            Size = l_MaterialHeader_0.HeaderSize
        }, {
            Preview = v2.createElement(v16, {
                BackgroundColor = l_MaterialHeader_0.HeaderBackground,
                DisableZoom = true,
                LayoutOrder = 1,
                Material = l_Material_0.Material,
                MaterialVariant = l_Material_0.MaterialVariant,
                Position = UDim2.fromOffset(0, 0)
            }),
            Close = v2.createElement(l_Button_0, {
                OnClick = v19.onClose,
                Position = l_MaterialHeader_0.ButtonPosition,
                Size = l_MaterialHeader_0.ButtonSize,
                Style = l_MaterialHeader_0.ButtonStyle,
                ZIndex = 2
            }, {
                Image = v2.createElement(l_Image_0, {
                    Style = l_MaterialHeader_0.Close,
                    Size = l_MaterialHeader_0.ImageSize,
                    Position = l_MaterialHeader_0.ImagePosition
                })
            })
        });
    else
        return v2.createElement(l_Pane_0);
    end;
end;
return v3.connect(function(v23, v24)
    return {
        Material = v24.MockMaterial or v23.MaterialBrowserReducer.Material
    };
end, function(v25)
    return {
        dispatchClearMaterial = function()
            v25(v14());
        end
    };
end)((l_withContext_0({
    Analytics = l_Analytics_0,
    Localization = l_Localization_0,
    Stylizer = l_Stylizer_0
})(v17)));