local l_script_FirstAncestor_0 = script:FindFirstAncestor("AvatarCompatibilityPreviewer");
local v1 = require(l_script_FirstAncestor_0.Packages.AvatarToolsShared);
local v2 = require(l_script_FirstAncestor_0.Packages.Framework);
local l_LuaMeshEditingModule_0 = l_script_FirstAncestor_0.Packages.LuaMeshEditingModule;
local v4 = require(l_script_FirstAncestor_0.Packages.React);
local v5 = require(l_script_FirstAncestor_0.Packages.ViewportToolingFramework);
local v6 = require(l_script_FirstAncestor_0.Src.Components.EditingTools.CageEditingTool.LuaMeshEditingModuleWrapper);
local v7 = require(l_script_FirstAncestor_0.Src.Util.Constants);
local _ = require(l_script_FirstAncestor_0.Src.Resources.Theme);
local _ = require(l_script_FirstAncestor_0.Src.Types);
local v10 = require(l_script_FirstAncestor_0.Src.Components.EditingTools.useBindFocusOnPositions);
local v11 = require(l_script_FirstAncestor_0.Src.Hooks.useRefWithInitial);
local v12 = require(l_script_FirstAncestor_0.Src.Hooks.useToggleState);
local v13 = require(l_LuaMeshEditingModule_0.Tools.BrushTool);
local l_ContextServices_0 = v2.ContextServices;
local l_Localization_0 = l_ContextServices_0.Localization;
local l_LuaMeshEditingModuleContext_0 = v1.Contexts.LuaMeshEditingModuleContext;
local l_Stylizer_0 = l_ContextServices_0.Stylizer;
return function(v18)
    local v19 = l_Localization_0:use();
    local v20 = l_Stylizer_0:use("CageEditingTool");
    local v21 = v11(v13.new);
    local v22, v23 = v4.useState(50);
    local v24, v25 = v4.useState(0.3);
    local v26 = v12(true);
    local v27, v28 = v4.useState({});
    v10(v27);
    return l_ContextServices_0.provide({
        l_LuaMeshEditingModuleContext_0.new({
            BrushTool = v21.current
        })
    }, {
        CageEditingTool = v4.createElement(v6, {
            Mannequin = v18.mannequin,
            Falloff = ((v22 / 100) * v24) / v7.FALLOFF_CURSOR_ADJUSTMENT,
            Radius = v24,
            OnChangeSelectedPositions = v28,
            Symmetrical = v26.enabled
        }),
        [v7.EDITING_TOOLS_GUI_NAMES.CageEditingToolToolbar] = v4.createElement(v5.Toolbar, {
            HorizontalItems = {
                {
                    Type = "Button",
                    Icon = v20.SymmetryImage,
                    Tooltip = v19:getText("CageEditingTool", "Symmetry"),
                    TooltipDescription = v19:getText("CageEditingTool", "SymmetryDescription"),
                    Value = v26.enabled,
                    OnClick = v26.toggle,
                    Selected = v26.enabled
                },
                {
                    Type = "Separator"
                },
                {
                    Type = "Slider",
                    Value = v24,
                    OnChange = v25,
                    Icon = "rbxasset://studio_svg_textures/Lua/AvatarCompatibilityPreviewer/Dark/Standard/radius@2x.png",
                    Tooltip = v19:getText("CageEditingTool", "Radius"),
                    Min = 0.1,
                    Max = 0.5
                },
                {
                    Type = "Slider",
                    Value = v22,
                    OnChange = v23,
                    Icon = "rbxasset://studio_svg_textures/Lua/AvatarCompatibilityPreviewer/Dark/Standard/radius@2x.png",
                    Tooltip = v19:getText("CageEditingTool", "Falloff"),
                    Min = 0,
                    Max = 100,
                    InputPrecision = 0,
                    DisplayFormat = "%d%%"
                },
                {
                    Type = "Separator"
                },
                unpack(v18.additionalToolbarItems)
            }
        })
    });
end;


local l_UGCValidationService_0 = game:GetService("UGCValidationService");
local l_script_FirstAncestor_0 = script:FindFirstAncestor("AvatarCompatibilityPreviewer");
local v2 = require(l_script_FirstAncestor_0.Packages.React);
local v3 = require(l_script_FirstAncestor_0.Packages.ReactUtils);
local v4 = require(l_script_FirstAncestor_0.Src.Util.Constants);
local v5 = require(l_script_FirstAncestor_0.Src.Util.EquipmentStateContext);
local v6 = require(l_script_FirstAncestor_0.Src.Components.TestingInterfaceContext);
local _ = require(l_script_FirstAncestor_0.Src.Types);
local v8 = require(l_script_FirstAncestor_0.Src.Flags.getFFlagAvatarPreviewerCageEditingTools);
local v9 = require(l_script_FirstAncestor_0.Src.Flags.getFFlagAvatarPreviewerEditingTools);
local v10 = require(l_script_FirstAncestor_0.Src.Util.isAvatar);
local v11 = require(l_script_FirstAncestor_0.Src.Hooks.useAsync);
local v12 = require(l_script_FirstAncestor_0.Src.Hooks.useClothingFromInstances);
local v13 = require(l_script_FirstAncestor_0.Src.Hooks.useIncrementedState);
local v14 = require(l_script_FirstAncestor_0.Src.Hooks.useMoveAccessoriesAlongsideAttachments);
local v15 = require(l_script_FirstAncestor_0.Src.Hooks.usePreviewHumanoidDescription);
local function v17(v16)
    v12(v16.dummy);
    v14(v16.dummy);
end;
local function _(v18)
    return v18:FindFirstChildWhichIsA("WrapTarget");
end;
local function v27(v20)
    local v24 = v2.useMemo(function()
        local v21 = {};
        for _, v23 in v20:GetChildren() do
            if not (not v23:IsA("Accessory") or not v23.Archivable) then
                table.insert(v21, v23:Clone());
            end;
        end;
        return v21;
    end, {
        v20
    });
    return v2.useCallback(function()
        for _, v26 in v24, nil, nil do
            v26:Clone().Parent = v20;
        end;
    end, {
        v24
    });
end;
local function v63(v28, v29)
    local v33 = v2.useMemo(function()
        local v30 = {};
        for _, v32 in v28:GetChildren() do
            if not (not v32:IsA("BasePart") or not v32.Archivable) then
                assert(v32:IsA("BasePart"), "Luau");
                if v4.BODY_PART_TO_LIMB_NAME[v32.Name] ~= nil then
                    table.insert(v30, v32:Clone());
                end;
            end;
        end;
        return v30;
    end, {
        v28
    });
    local v38 = v3.useRefToState((v2.useMemo(function()
        local v34 = {};
        for _, v36 in v33, nil, nil do
            local v37 = v4.BODY_PART_TO_LIMB_NAME[v36.Name];
            if v37 ~= nil and v29[v37] == 0 then
                table.insert(v34, v36);
            end;
        end;
        return v34;
    end, {
        v33,
        v29
    })));
    local function v44(v39)
        local l_Humanoid_0 = v28:FindFirstChildWhichIsA("Humanoid");
        if l_Humanoid_0 == nil then
            return ;
        else
            assert(l_Humanoid_0:IsA("Humanoid"), "Luau");
            for _, v42 in v39, nil, nil do
                local v43 = v42:Clone();
                if v8() then
                    l_UGCValidationService_0:ResetCollisionFidelity(v43, Enum.CollisionFidelity.Default);
                end;
                l_Humanoid_0:ReplaceBodyPartR15(Enum.BodyPartR15[v42.Name], v43);
            end;
            return ;
        end;
    end;
    return (v2.useCallback(function()
        local v45 = {};
        for _, v47 in v33, nil, nil do
            if table.find(v38.current, v47) ~= nil then
                local l_v28_FirstChild_0 = v28:FindFirstChild(v47.Name);
                if l_v28_FirstChild_0 ~= nil then
                    local v49 = {};
                    for _, v51 in l_v28_FirstChild_0:GetChildren() do
                        if v51:IsA("Attachment") then
                            v49[v51.Name] = v51.CFrame;
                        end;
                    end;
                    local l_WrapTarget_0 = l_v28_FirstChild_0:FindFirstChildWhichIsA("WrapTarget");
                    local v53 = l_WrapTarget_0 and l_WrapTarget_0:GetVertices(Enum.CageType.Outer);
                    table.insert(v45, function()
                        local l_v28_FirstChild_1 = v28:FindFirstChild(l_v28_FirstChild_0.Name);
                        if l_v28_FirstChild_1 == nil then
                            return ;
                        else
                            assert(l_v28_FirstChild_1 ~= nil, v4.LUAU_ANALYZE_ERROR);
                            for v55, v56 in v49, nil, nil do
                                local l_l_v28_FirstChild_1_FirstChild_0 = l_v28_FirstChild_1:FindFirstChild(v55);
                                if not (not (l_l_v28_FirstChild_1_FirstChild_0 ~= nil) or not l_l_v28_FirstChild_1_FirstChild_0:IsA("Attachment")) then
                                    local v58 = false;
                                    if l_l_v28_FirstChild_1_FirstChild_0 ~= nil then
                                        v58 = l_l_v28_FirstChild_1_FirstChild_0:IsA("Attachment");
                                    end;
                                    assert(v58, v4.LUAU_ANALYZE_ERROR);
                                    l_l_v28_FirstChild_1_FirstChild_0.CFrame = v56;
                                    local l_l_l_v28_FirstChild_1_FirstChild_0_FirstChild_0 = l_l_v28_FirstChild_1_FirstChild_0:FindFirstChild(v4.ORIGINAL_POSITION_VALUE);
                                    if not (not (l_l_l_v28_FirstChild_1_FirstChild_0_FirstChild_0 ~= nil) or not l_l_l_v28_FirstChild_1_FirstChild_0_FirstChild_0:IsA("Vector3Value")) then
                                        l_l_l_v28_FirstChild_1_FirstChild_0_FirstChild_0.Value = v56.Position;
                                    end;
                                end;
                            end;
                            local l_WrapTarget_1 = l_v28_FirstChild_1:FindFirstChildWhichIsA("WrapTarget");
                            if l_WrapTarget_1 ~= nil and v53 ~= nil then
                                l_WrapTarget_1:ModifyVertices(Enum.CageType.Outer, v53);
                            end;
                            return ;
                        end;
                    end);
                end;
            end;
        end;
        v44(v33);
        for _, v62 in v45, nil, nil do
            v62();
        end;
    end, {
        v33,
        v28
    }));
end;
return function(v64)
    assert(v9(), "RepresentEditorStateOnWorldModle required FFlagAvatarPreviewerEditingTools");
    local v65 = v2.useContext(v5);
    local v66 = v2.useContext(v6.Context);
    v2.useEffect(function()
        return v65.startIgnoringChildren();
    end, {
        v65.startIgnoringChildren
    });
    local v67 = v15({
        WorldModel = v64.worldModel
    }, {}, {
        includeAccessories = v64.includeAccessories,
        resetIncludesBodyParts = false
    });
    local v68 = v27(v64.worldModel);
    local v69 = v63(v64.worldModel, v67);
    local v70 = v3.useRefToState(v68);
    local v71 = v3.useRefToState(v69);
    v2.useEffect(function()
        local l_BodyColors_0 = v64.worldModel:FindFirstChildWhichIsA("BodyColors");
        if l_BodyColors_0 ~= nil then
            l_BodyColors_0 = l_BodyColors_0:Clone();
        end;
        return function()
            if v10(v64.worldModel) then
                if v64.includeAccessories then
                    for _, v74 in v64.worldModel:GetChildren() do
                        if v74:IsA("Accessory") then
                            v74:Destroy();
                        end;
                    end;
                    v70.current();
                end;
                v71.current();
                if l_BodyColors_0 ~= nil then
                    local l_BodyColors_1 = v64.worldModel:FindFirstChildWhichIsA("BodyColors");
                    if l_BodyColors_1 ~= nil then
                        l_BodyColors_1:Destroy();
                    end;
                    l_BodyColors_0.Parent = v64.worldModel;
                end;
                if v66.onRepresentEditorStateOnWorldModelUnmounted ~= nil then
                    task.defer(function()
                        v66.onRepresentEditorStateOnWorldModelUnmounted:Fire();
                    end);
                end;
                return ;
            else
                return ;
            end;
        end;
    end, {
        v64.includeAccessories,
        v68,
        v69
    });
    local v76 = v13();
    v11(function()
        v64.worldModel.Humanoid:ApplyDescriptionReset(v67);
        if not v64.includeAccessories then
            v68();
        end;
        if v66.onRepresentEditorStateOnWorldModelDescriptionApplied ~= nil then
            task.defer(function()
                v66.onRepresentEditorStateOnWorldModelDescriptionApplied:Fire();
            end);
        end;
        v76.increment();
        return nil;
    end, {
        v67,
        v68
    });
    if v64.includeAccessories and v76.amount > 0 then
        return v2.createElement(v17, {
            key = ("GiveDummyInstancesClothing%*"):format(v76.amount),
            dummy = v64.worldModel
        });
    else
        return nil;
    end;
end;


local v0 = require(script:FindFirstAncestor("AvatarCompatibilityPreviewer").Src.Util.exhaustiveMatch);
local function v8(v1, v2, v3)
    local v4 = 1;
    local l_v1_0 = v1;
    while true do
        local v6 = (v4 + l_v1_0) // 2;
        local v7 = v2((v3(v6)));
        if v7 == "equal" then
            return v6;
        else
            assert(v7 ~= "equal", "Luau");
            if v4 == l_v1_0 then
                return nil;
            elseif v7 == "smaller" then
                v4 = v6 + 1;
            elseif v7 == "bigger" then
                l_v1_0 = v6 - 1;
            else
                v0(v7);
            end;
        end;
    end;
end;
return function(v9, v10, v11)
    local v12 = v8(v9, v10, v11);
    if v12 == nil then
        return {};
    else
        assert(v12 ~= nil, "Luau");
        local v13 = {
            v12
        };
        for v14 = v12 - 1, 1, -1 do
            if v10(v11(v14)) == "equal" then
                table.insert(v13, v14);
            else
                break;
            end;
        end;
        for v15 = v12 + 1, v9 do
            if v10(v11(v15)) == "equal" then
                table.insert(v13, v15);
            else
                break;
            end;
        end;
        return v13;
    end;
end;


local l_script_FirstAncestor_0 = script:FindFirstAncestor("AvatarCompatibilityPreviewer");
local v1 = require(l_script_FirstAncestor_0.Packages.Dash);
local _ = require(l_script_FirstAncestor_0.Packages.LuaMeshEditingModule.Types);
local _ = require(l_script_FirstAncestor_0.Src.Types);
local v4 = require(script.binarySearchRange);
local function _(v5, v6)
    if math.abs(v5.X - v6.X) <= 1.0E-5 then
        return v5.Y < v6.Y;
    else
        return v5.X < v6.X;
    end;
end;
return function(v8, v9)
    local v10 = require(l_script_FirstAncestor_0.Src.Components.EditingTools.CageEditingTool.SymmetricalUVs);
    assert(buffer.len(v10) / 32 == buffer.len(v10) // 32, "SymmetricalUVs buffer is not divisible by cursor offset");
    local v12 = v1.filter(v8:GetDescendants(), function(v11)
        return v11:IsA("WrapTarget");
    end);
    if v9 == nil then
        v9 = warn;
    end;
    assert(v9 ~= nil, "Luau");
    local v13 = {};
    local v14 = {};
    local function v19(v15, v16, v17, v18)
        if v13[v15] == nil then
            v13[v15] = {};
        end;
        if v13[v15][v16] == nil then
            v13[v15][v16] = {};
        end;
        table.insert(v13[v15][v16], {
            targetName = v17,
            vertex = v18
        });
    end;
    local function v30(v20)
        local v25 = v4(buffer.len(v10) // 32, function(v21)
            local v22 = buffer.readf64(v10, v21);
            local v23 = buffer.readf64(v10, v21 + 8);
            if not Vector3.new(v22, v23):FuzzyEq(v20, 1.0E-7) then
                if math.abs(v22 - v20.X) > 1.0E-7 then
                    if v20.X < v22 then
                        return "bigger";
                    else
                        return "smaller";
                    end;
                elseif v20.Y < v23 then
                    return "bigger";
                else
                    return "smaller";
                end;
            else
                return "equal";
            end;
        end, function(v24)
            return (v24 - 1) * 32;
        end);
        local v26 = {};
        for _, v28 in v25, nil, nil do
            local v29 = (v28 - 1) * 32;
            table.insert(v26, (Vector3.new(buffer.readf64(v10, v29 + 16), (buffer.readf64(v10, v29 + 24)))));
        end;
        return v26;
    end;
    local function v41(v31)
        local v32 = {};
        for _, v34 in v31, nil, nil do
            for _, v40 in (v4(#v14, function(v35)
                if not v35.uv:FuzzyEq(v34) then
                    local l_uv_0 = v35.uv;
                    local l_v34_0 = v34;
                    if not if math.abs(l_uv_0.X - l_v34_0.X) <= 1.0E-5 then l_uv_0.Y < l_v34_0.Y else l_uv_0.X < l_v34_0.X then
                        return "bigger";
                    else
                        return "smaller";
                    end;
                else
                    return "equal";
                end;
            end, function(v38)
                return v14[v38];
            end)), nil, nil do
                table.insert(v32, v14[v40]);
            end;
        end;
        return v32;
    end;
    debug.profilebegin("Collect points and UVs");
    for _, v43 in v12, nil, nil do
        for v44, v45 in v43:GetUVs(Enum.CageType.Outer) do
            table.insert(v14, {
                targetName = v43.Name,
                vertex = v44,
                uv = Vector3.new(v45.X, v45.Y)
            });
        end;
    end;
    debug.profileend();
    debug.profilebegin("Sort points and UVs");
    table.sort(v14, function(v46, v47)
        local l_uv_1 = v46.uv;
        local l_uv_2 = v47.uv;
        if math.abs(l_uv_1.X - l_uv_2.X) <= 1.0E-5 then
            return l_uv_1.Y < l_uv_2.Y;
        else
            return l_uv_1.X < l_uv_2.X;
        end;
    end);
    debug.profileend();
    debug.profilebegin("Create symmetry map");
    for _, v51 in v14, nil, nil do
        debug.profilebegin("Find what UVs are symmetrical");
        local v52 = v30(v51.uv);
        debug.profileend();
        if #v52 == 0 then
            local v53 = nil;
            for v54 = 0, buffer.len(v10) - 32, 32 do
                if Vector3.new(buffer.readf64(v10, v54), (buffer.readf64(v10, v54 + 8))):FuzzyEq(v51.uv, 1.0E-7) then
                    v53 = 1 + v54 // 32;
                    break;
                end;
            end;
            v9((("Couldn't find symmetrical UVs for %*:%* (at %*), was supposed to find it at index %*"):format(v51.targetName, v51.vertex, v51.uv, v53)));
        else
            debug.profilebegin("Find points with UV");
            for _, v56 in v41(v52) do
                v19(v51.targetName, v51.vertex, v56.targetName, v56.vertex);
                v19(v56.targetName, v56.vertex, v51.targetName, v51.vertex);
            end;
            debug.profileend();
        end;
    end;
    debug.profileend();
    return v13;
end;


local l_script_FirstAncestor_0 = script:FindFirstAncestor("AvatarCompatibilityPreviewer");
local v1 = require(l_script_FirstAncestor_0.Src.Resources.BuiltinItems);
local v2 = require(l_script_FirstAncestor_0.Src.Resources.CatalogItems);
return function(v3)
    local v4 = {};
    for _, v6 in v1.allItems, nil, nil do
        if v6.attachment == v3 then
            table.insert(v4, v6.id);
        end;
    end;
    if #v4 == 0 then
        return nil;
    else
        for _, v8 in v2, nil, nil do
            for _, v10 in v8, nil, nil do
                for _, v12 in v10.Items, nil, nil do
                    if typeof(v12) == "number" and table.find(v4, v12) ~= nil then
                        return v10.Key;
                    end;
                end;
            end;
        end;
        return nil;
    end;
end;


local l_script_FirstAncestor_0 = script:FindFirstAncestor("AvatarCompatibilityPreviewer");
local v1 = require(l_script_FirstAncestor_0.Packages.Framework);
local v2 = require(l_script_FirstAncestor_0.Packages.React);
local v3 = require(l_script_FirstAncestor_0.Packages.ViewportToolingFramework);
local v4 = require(l_script_FirstAncestor_0.Src.Util.Constants);
local _ = require(l_script_FirstAncestor_0.Src.Types);
local v6 = require(l_script_FirstAncestor_0.Src.Util.exhaustiveMatch);
local v7 = require(l_script_FirstAncestor_0.Src.Hooks.useKeyedState);
local v8 = require(script.AttachmentTool);
local v9 = require(script.CageEditingTool);
local v10 = require(script.RepresentEditorStateOnWorldModel);
local v11 = require(script.useBindFocusOnPVInstance);
local v12 = require(l_script_FirstAncestor_0.Src.Flags.getFFlagAvatarPreviewerEditingTools);
local v13 = require(l_script_FirstAncestor_0.Src.Flags.getFFlagAvatarPreviewerCageEditingTools);
local l_Localization_0 = v1.ContextServices.Localization;
local l_Plugin_0 = v1.ContextServices.Plugin;
local function v18(v16)
    local v17 = true;
    if v16 ~= "attachments" then
        v17 = v16 == "none";
    end;
    return v17;
end;
local function v20(v19)
    v11(v19.dummy);
end;
return function(v21)
    assert(v12(), "AvatarPreviewerEditingTools_Dev is not enabled");
    local v22 = l_Localization_0:use();
    local v23, v24 = v2.useState("none");
    local v25 = l_Plugin_0:use():get();
    v2.useEffect(function()
        v25:Activate(true);
        return function()
            v25:Deactivate();
        end;
    end, {});
    local v26, v27 = v7(v18, v23);
    local v29 = {
        {
            Type = "Button",
            Tooltip = v22:getText("EditingTools", "ShowAccessories"),
            Icon = v2.createElement("Frame", {
                BackgroundColor3 = Color3.new(1, 0, 1),
                BackgroundTransparency = 0,
                Size = UDim2.fromScale(1, 1)
            }),
            Selected = v26,
            OnClick = function()
                v27(function(v28)
                    return not v28;
                end);
            end
        }
    };
    local function v34(v30, v31, v32)
        return {
            Type = "Button",
            Tooltip = v32,
            Icon = ("%*/%*.png"):format("rbxasset://studio_svg_textures/Lua/AvatarCompatibilityPreviewer/Dark/Large", v31),
            Selected = v23 == v30,
            OnClick = function()
                v24(function(v33)
                    if v33 == v30 then
                        return "none";
                    else
                        return v30;
                    end;
                end);
            end,
            Enabled = nil,
            TooltipDescription = nil
        };
    end;
    local l_createElement_0 = v2.createElement;
    local l_Fragment_0 = v2.Fragment;
    local v37 = {};
    local v38 = {
        [v4.EDITING_TOOLS_GUI_NAMES.EditingToolbar] = v2.createElement(v3.Toolbar, {
            InitialPosition = "Top",
            VerticalItems = {
                v34("attachments", "attachments_tool", v22:getText("EditingTools", "AttachmentsTool")),
                (v34("cage", "cage_tool", v22:getText("EditingTools", "CageTool")))
            }
        })
    };
    local v39 = false;
    if v23 ~= "none" then
        v39 = if v23 == "attachments" then v2.createElement(v8, {
            worldModel = v21.worldModel,
            additionalToolbarItems = v29
        }) else if v13() and v23 == "cage" then v2.createElement(v9, {
            mannequin = v21.worldModel,
            additionalToolbarItems = v29
        }) else v6(v23);
    end;
    v38.Tool = v39;
    v39 = false;
    if v23 ~= "none" then
        v39 = v2.createElement(v10, {
            worldModel = v21.worldModel,
            includeAccessories = v26
        });
    end;
    v38.RepresentEditorStateOnWorldModel = v39;
    v39 = false;
    if v23 ~= "none" then
        v39 = v2.createElement(v20, {
            dummy = v21.worldModel
        });
    end;
    v38.BindFocusOnPVInstance = v39;
    return l_createElement_0(l_Fragment_0, v37, v38);
end;


local l_Selection_0 = game:GetService("Selection");
local l_script_FirstAncestor_0 = script:FindFirstAncestor("AvatarCompatibilityPreviewer");
local l_DraggerFramework_0 = l_script_FirstAncestor_0.Packages.DraggerFramework;
local v3 = require(l_script_FirstAncestor_0.Packages.React);
local v4 = require(l_DraggerFramework_0.Utility.BoundingBox);
local v5 = require(l_script_FirstAncestor_0.Src.Util.Constants);
return function(v6)
    v3.useEffect(function()
        local v9 = l_Selection_0:AddFocusCallback(v5.FOCUS_CALLBACK_PRIORITIES.Dummy, function()
            local v7, v8 = v4.fromObjects({
                v6
            });
            return v7 - v8 * 0.5, v7 + v8 * 0.5;
        end);
        return function()
            v9:Disconnect();
        end;
    end, {
        v6
    });
end;


local l_Selection_0 = game:GetService("Selection");
local l_script_FirstAncestor_0 = script:FindFirstAncestor("AvatarCompatibilityPreviewer");
local v2 = require(l_script_FirstAncestor_0.Packages.React);
local v3 = require(l_script_FirstAncestor_0.Src.Util.Constants);
return function(v4)
    local v5 = v2.useRef(v4);
    v5.current = v4;
    assert(v5.current ~= nil, v3.LUAU_ANALYZE_ERROR);
    v2.useEffect(function()
        if #v4 == 0 then
            return nil;
        else
            local v11 = l_Selection_0:AddFocusCallback(v3.FOCUS_CALLBACK_PRIORITIES.Positions, function()
                local l_current_0 = v5.current;
                if #l_current_0 == 0 then
                    return Vector3.zero, Vector3.zero;
                else
                    local v7 = l_current_0[1];
                    local v8 = l_current_0[1];
                    for v9 = 2, #l_current_0 do
                        local v10 = l_current_0[v9];
                        v7 = v7:Min(v10);
                        v8 = v8:Max(v10);
                    end;
                    return v7, v8;
                end;
            end);
            return function()
                v11:Disconnect();
            end;
        end;
    end, {
        #v4 == 0
    });
end;


local l_Parent_0 = script.Parent.Parent.Parent;
local v1 = require(l_Parent_0.Packages.React);
local v2 = require(l_Parent_0.Src.Util.EquipmentStateContext);
local v3 = require(l_Parent_0.Src.Util.Serializers);
local _ = require(l_Parent_0.Src.Types);
local v5 = require(l_Parent_0.Src.Hooks.useAvatarAssets);
local v6 = require(l_Parent_0.Src.Hooks.useAddEquippedItem);
local v7 = require(l_Parent_0.Src.Hooks.useRemoveEquippedItem);
local v8 = require(l_Parent_0.Src.Hooks.useSerializedState);
local v9 = require(l_Parent_0.Src.Hooks.useSetEquippedItemIsHidden);
local v10 = require(l_Parent_0.Src.Hooks.useIncrementedState);
local v11 = require(l_Parent_0.Src.Hooks.useUserCatalogFolder);
local v12 = require(l_Parent_0.Src.Flags.getFFlagAvatarPreviewerEquippedHoverMenu)();
local v13 = require(l_Parent_0.Src.Flags.getFFlagAvatarPreviewerReplicateEditorStateOnWorldModel);
return function(v14)
    local v15 = v11();
    local v16, v17 = v8(v14.root, "equippedItems", {}, (v1.useMemo(function()
        return v3.createEquippedItemsSerializer(v15);
    end, {
        v15
    })));
    local v18 = if not v12 then nil else v9(v17, false);
    local v19 = if not v12 then nil else v9(v17, true);
    local v27 = if not v12 then nil else v1.useCallback(function(v20, v21)
        v17(function(v22)
            local v23 = table.clone(v22);
            for v24, v25 in v23, nil, nil do
                if not (v21 ~= nil) or table.find(v21, v25) == nil then
                    local v26 = table.clone(v25);
                    v26.isHidden = v20;
                    v23[v24] = v26;
                end;
            end;
            return v23;
        end);
    end, {
        v16
    });
    local v28 = v6(v17);
    local v29 = v7(v17);
    local v30 = v1.useCallback(function()
        v17({});
    end, {});
    local v36 = v1.useCallback(function(v31, v32)
        v17(function(v33)
            local v34 = false;
            if v31 > 0 then
                v34 = v31 <= #v33;
            end;
            assert(v34, "Starting index out of range");
            v34 = false;
            if v32 > 0 then
                v34 = v32 <= #v33;
            end;
            assert(v34, "New index out of range");
            v33 = table.clone(v33);
            local v35 = table.remove(v33, v31);
            assert(v35 ~= nil, "Removed item is invalid even though we checked bounds");
            table.insert(v33, v32, v35);
            return v33;
        end);
    end, {});
    local v37 = v5(v16);
    local v38 = v10();
    return v1.createElement(v2.Provider, {
        value = {
            equippedItems = v16,
            addEquippedItem = v28,
            removeEquippedItem = v29,
            removeAllEquippedItems = v30,
            moveEquippedItemsToIndex = v36,
            hideEquippedItem = v19,
            showEquippedItem = v18,
            setHideAllEquippedItems = v27,
            avatarAssets = v37,
            startIgnoringChildren = if not v13() then nil else v1.useCallback(function()
                v38.increment();
                return function()
                    v38.decrement();
                end;
            end, {}),
            isIgnoringChildren = v38.amount > 0
        }
    }, v14.children);
end;


local l_script_FirstAncestor_0 = script:FindFirstAncestor("AvatarCompatibilityPreviewer");
local v1 = require(l_script_FirstAncestor_0.Packages.Framework);
local v2 = require(l_script_FirstAncestor_0.Packages.React);
local v3 = require(l_script_FirstAncestor_0.Src.Components.EquippedItemsSidebar.EquippedItemSideMenu);
local v4 = require(l_script_FirstAncestor_0.Src.Components.ItemDataPreview);
local v5 = require(l_script_FirstAncestor_0.Src.Util.DEPRECATED_AvatarScreenContext);
local v6 = require(l_script_FirstAncestor_0.Src.Components.AvatarScreenContext);
local v7 = require(l_script_FirstAncestor_0.Src.Util.EquipmentStateContext);
local _ = require(l_script_FirstAncestor_0.Src.Resources.Theme);
local _ = require(l_script_FirstAncestor_0.Src.Types);
local v10 = require(l_script_FirstAncestor_0.Src.Flags.getFFlagAvatarPreviewerEquippedHoverMenu);
local v11 = require(l_script_FirstAncestor_0.Src.Flags.getFFlagAvatarPreviewerSkinToneAlphaDetection);
local l_UI_0 = v1.UI;
local l_showContextMenu_0 = l_UI_0.showContextMenu;
local l_Pane_0 = l_UI_0.Pane;
local l_Localization_0 = v1.ContextServices.Localization;
local l_Stylizer_0 = v1.ContextServices.Stylizer;
local l_StyleModifier_0 = v1.Util.StyleModifier;
return function(v18)
    local v19 = l_Localization_0:use();
    local v20 = l_Stylizer_0:use("EquippedItemPreview");
    local v21 = v2.useContext(if not v11() then v5 else v6.Context);
    local v22 = v2.useContext(v7);
    local v23, v24 = v2.useState(false);
    local v25 = v2.useCallback(function()
        v21.openPalette(v18.ItemData.palette.Key);
    end, {
        v18.ItemData,
        v21.openPalette
    });
    local v26 = v2.useCallback(function()
        v22.removeEquippedItem(v18.ItemData);
    end, {
        v18.ItemData,
        v22.removeEquippedItem
    });
    v2.useEffect(function()
        if v23 then
            v21.incrementDummyPreviewLock();
            return function()
                v21.decrementDummyPreviewLock();
            end;
        else
            return nil;
        end;
    end, {
        v23
    });
    local v27, v28 = v2.useState(Vector2.new());
    return v2.createElement(l_Pane_0, {
        Style = "EquippedItemPreview",
        StyleModifier = if not v23 then if v10() and v18.ItemData.isHidden then l_StyleModifier_0.Disabled else nil else l_StyleModifier_0.Hover,
        LayoutOrder = v18.LayoutOrder,
        Position = v18.Position,
        Size = v18.Size,
        [v2.Event.InputBegan] = v2.useCallback(function(_, v30)
            if v30.UserInputType == Enum.UserInputType.MouseButton1 then
                v28(Vector2.new(v30.Position.X, v30.Position.Y));
                return ;
            elseif v30.UserInputType == Enum.UserInputType.MouseButton2 then
                l_showContextMenu_0(l_script_FirstAncestor_0.Parent, {
                    {
                        Text = v19:getText("EquippedItemContextMenu", "OpenPalette", {
                            palette = v19:getText("AssetPalettes", v18.ItemData.palette.Key)
                        }),
                        OnItemClicked = v25
                    },
                    {
                        ShowSeparator = true
                    },
                    {
                        Text = v19:getText("EquippedItemContextMenu", "UnequipItem"),
                        OnItemClicked = v26
                    },
                    {
                        Text = v19:getText("EquippedItemContextMenu", "UnequipAllItems"),
                        OnItemClicked = v22.removeAllEquippedItems
                    }
                });
                return ;
            else
                if v30.UserInputType == Enum.UserInputType.MouseMovement then
                    v24(true);
                end;
                return ;
            end;
        end, {
            v18.ItemData,
            v25,
            v26
        }),
        [v2.Event.InputEnded] = v2.useCallback(function(_, v32)
            if v32.UserInputType == Enum.UserInputType.MouseMovement then
                v24(false);
                return ;
            else
                if v32.UserInputType == Enum.UserInputType.MouseButton1 and (Vector2.new(v32.Position.X, v32.Position.Y) - v27).Magnitude < 4 then
                    v25();
                end;
                return ;
            end;
        end, {
            v27
        }),
        [v2.Tag] = "data-testid=EquippedItemPreview"
    }, {
        Inner = v2.createElement(l_Pane_0, {
            Style = "EquippedItemPreviewInner",
            AnchorPoint = Vector2.new(0.5, 0.5),
            Position = UDim2.fromScale(0.5, 0.5),
            Size = UDim2.new(1, -v20.StrokeThickness, 1, -v20.StrokeThickness)
        }, {
            UIStroke = v2.createElement("UIStroke", {
                Color = v20.StrokeColor,
                Thickness = v20.StrokeThickness
            }),
            HoverX = if not v23 or v18.IsDragging then nil else v2.createElement(l_Pane_0, {
                AnchorPoint = v20.HoverX.AnchorPoint,
                Position = v20.HoverX.Position,
                Size = v20.HoverX.Size,
                OnClick = v26
            }, {
                HoverX = v2.createElement(l_UI_0.Image, {
                    Image = v20.HoverX.Image,
                    Size = UDim2.fromScale(1, 1)
                })
            }),
            Preview = v2.createElement(v4, {
                ItemData = v18.ItemData,
                Selected = false,
                Transparency = if not v10() then nil else if v18.ItemData.isHidden then v20.ItemHiddenTransparency else v20.ItemWornTransparency
            })
        }),
        Outer = if not v10() then nil else v2.createElement(v3, {
            ItemData = v18.ItemData,
            tileHovered = v23
        })
    });
end;


local l_script_FirstAncestor_0 = script:FindFirstAncestor("AvatarCompatibilityPreviewer");
local v1 = require(l_script_FirstAncestor_0.Packages.Framework);
local v2 = require(l_script_FirstAncestor_0.Packages.React);
local v3 = require(l_script_FirstAncestor_0.Src.Hooks.useAggressiveHoverEndState);
local v4 = require(l_script_FirstAncestor_0.Src.Hooks.useToggleState);
local v5 = require(l_script_FirstAncestor_0.Src.Util.DEPRECATED_AvatarScreenContext);
local v6 = require(l_script_FirstAncestor_0.Src.Components.AvatarScreenContext);
local v7 = require(l_script_FirstAncestor_0.Src.Util.EquipmentStateContext);
local _ = require(l_script_FirstAncestor_0.Src.Resources.Theme);
local _ = require(l_script_FirstAncestor_0.Src.Types);
local v10 = require(l_script_FirstAncestor_0.Src.Flags.getFFlagAvatarPreviewerSkinToneAlphaDetection);
local l_UI_0 = v1.UI;
local l_Image_0 = l_UI_0.Image;
local l_Pane_0 = l_UI_0.Pane;
local l_showContextMenu_0 = l_UI_0.showContextMenu;
local l_Localization_0 = v1.ContextServices.Localization;
local l_Stylizer_0 = v1.ContextServices.Stylizer;
return function(v17)
    local v18 = l_Localization_0:use();
    local v19 = l_Stylizer_0:use("EquippedItemSideMenu");
    local v20 = v2.useContext(if not v10() then v5 else v6.Context);
    local v21 = v2.useContext(v7);
    local v22, v23 = v2.useState(false);
    local v24 = v4(false);
    local v25 = v4(false);
    local v26 = v2.useRef(nil);
    local v27 = v3(v26);
    local v28 = v2.useCallback(function()
        v20.openPalette(v17.ItemData.palette.Key);
    end, {
        v17.ItemData,
        v20.openPalette
    });
    local v29 = v2.useCallback(function()
        v21.hideEquippedItem(v17.ItemData);
    end, {
        v17.ItemData,
        v21.hideEquippedItem
    });
    local v30 = v2.useCallback(function()
        v21.showEquippedItem(v17.ItemData);
    end, {
        v17.ItemData,
        v21.showEquippedItem
    });
    local v32 = v2.useCallback(function(v31)
        return v21.setHideAllEquippedItems(true, {
            v31
        });
    end, {
        v21.setHideAllEquippedItems
    });
    local v34 = v2.useCallback(function(v33)
        return v21.setHideAllEquippedItems(false, {
            v33
        });
    end, {
        v21.setHideAllEquippedItems
    });
    local v39 = v2.useCallback(function(v35, v36)
        for _, v38 in v21.equippedItems, nil, nil do
            if v38 ~= v36 and v35 ~= (v38.isHidden or false) then
                return false;
            end;
        end;
        return true;
    end, {
        v21.equippedItems
    });
    local v40 = v2.useCallback(function()
        v21.removeEquippedItem(v17.ItemData);
    end, {
        v17.ItemData,
        v21.removeEquippedItem
    });
    local v43 = v2.useCallback(function(_, v42)
        if v42.UserInputType == Enum.UserInputType.MouseButton1 then
            if not v42:IsModifierKeyDown(Enum.ModifierKey.Shift) then
                if not v42:IsModifierKeyDown(Enum.ModifierKey.Alt) then
                    if not v17.ItemData.isHidden then
                        v29();
                        return ;
                    else
                        v30();
                        return ;
                    end;
                elseif not v17.ItemData.isHidden then
                    if not v39(true, v17.ItemData) then
                        v32(v17.ItemData);
                        return ;
                    else
                        v34();
                        return ;
                    end;
                elseif not v39(false, v17.ItemData) then
                    v34(v17.ItemData);
                    return ;
                else
                    v32();
                    return ;
                end;
            elseif not v17.ItemData.isHidden then
                if not v39(false) then
                    v34();
                    return ;
                else
                    v32();
                    return ;
                end;
            elseif not v39(true) then
                v32();
                return ;
            else
                v34();
                return ;
            end;
        else
            if v42.UserInputType == Enum.UserInputType.MouseMovement then
                v23(true);
            end;
            return ;
        end;
    end, {
        v17.ItemData.isHidden,
        v30,
        v29,
        v34,
        v32
    });
    local v46 = v2.useCallback(function(_, v45)
        if v45.UserInputType == Enum.UserInputType.MouseMovement then
            v23(false);
        end;
    end, {});
    local function v47()
        v25.enable();
        l_showContextMenu_0(l_script_FirstAncestor_0.Parent, {
            {
                Text = v18:getText("EquippedItemContextMenu", "OpenPalette", {
                    palette = v18:getText("AssetPalettes", v17.ItemData.palette.Key)
                }),
                OnItemClicked = v28
            },
            {
                ShowSeparator = true
            },
            {
                Text = if not v17.ItemData.isHidden then v18:getText("EquippedItemContextMenu", "HideItem") else v18:getText("EquippedItemContextMenu", "ShowItem"),
                OnItemClicked = if not v17.ItemData.isHidden then v29 else v30
            },
            {
                Text = v18:getText("EquippedItemContextMenu", "HideAllItems"),
                OnItemClicked = v32
            },
            {
                Text = v18:getText("EquippedItemContextMenu", "ShowAllItems"),
                OnItemClicked = v34
            },
            {
                ShowSeparator = true
            },
            {
                Text = v18:getText("EquippedItemContextMenu", "UnequipItem"),
                OnItemClicked = v40
            },
            {
                Text = v18:getText("EquippedItemContextMenu", "UnequipAllItems"),
                OnItemClicked = v21.removeAllEquippedItems
            }
        });
        v25.disable();
    end;
    v2.useEffect(function()
        if v27.isHovered then
            v20.incrementDummyPreviewLock();
            return function()
                v20.decrementDummyPreviewLock();
            end;
        else
            return nil;
        end;
    end, {
        v27.isHovered
    });
    if not (v17.tileHovered or v27.isHovered) and not v25.enabled then
        if not v17.ItemData.isHidden then
            return nil;
        else
            return (v2.createElement(l_UI_0.Image, {
                Style = "EquippedItemDisabledBackground",
                AnchorPoint = Vector2.new(-0.5, 0),
                Position = UDim2.new(-0.5, 0, 0, v19.Margin),
                Size = UDim2.fromScale(0.5, 0.5)
            }, {
                HideShowPane = v2.createElement(l_Pane_0, {
                    AnchorPoint = Vector2.new(0, 0),
                    Position = UDim2.fromScale(0, 0),
                    Layout = Enum.FillDirection.Vertical,
                    [v2.Event.MouseEnter] = v27.hover
                }, {
                    HideShowIcon = v2.createElement(l_UI_0.Image, {
                        Style = "EquippedItemUnhideIcon",
                        Size = UDim2.fromOffset(v19.IconSize, v19.IconSize)
                    })
                })
            }));
        end;
    else
        return (v2.createElement(l_Image_0, {
            Style = "EquippedItemHoverMenuBackground",
            AnchorPoint = Vector2.new(-0.5, 0),
            Position = UDim2.new(-0.5, 0, 0, v19.Margin),
            Size = UDim2.new(0.5, 0, 1, -v19.Margin)
        }, {
            Container = v2.createElement(l_Pane_0, {
                Layout = Enum.FillDirection.Vertical,
                Spacing = 8,
                ref = v26,
                [v2.Event.MouseEnter] = v27.hover
            }, {
                HideShowPane = v2.createElement(l_Pane_0, {
                    AnchorPoint = Vector2.new(0, 0),
                    Position = UDim2.fromScale(0, 0),
                    AutomaticSize = Enum.AutomaticSize.XY,
                    [v2.Event.InputBegan] = v43,
                    [v2.Event.InputEnded] = v46
                }, {
                    HideShowIcon = v2.createElement(l_Image_0, {
                        Style = if not v17.ItemData.isHidden then v22 and "EquippedItemHideHoverIcon" or "EquippedItemHideIcon" else v22 and "EquippedItemUnhideHoverIcon" or "EquippedItemUnhideIcon",
                        Size = UDim2.fromOffset(v19.IconSize, v19.IconSize)
                    })
                }),
                DotsPane = v2.createElement(l_Pane_0, {
                    OnClick = v47,
                    AutomaticSize = Enum.AutomaticSize.XY,
                    [v2.Event.MouseEnter] = v24.enable,
                    [v2.Event.MouseLeave] = v24.disable
                }, {
                    DotsIcon = v2.createElement(l_Image_0, {
                        Style = "EquippedItemDotsIcon",
                        ImageColor3 = if not v24.enabled then v19.DotsBackground else v19.DotsBackgroundHover,
                        Size = UDim2.fromOffset(v19.IconSize, v19.IconSize)
                    })
                })
            })
        }));
    end;
end;


local l_script_FirstAncestor_0 = script:FindFirstAncestor("AvatarCompatibilityPreviewer");
local v1 = require(l_script_FirstAncestor_0.Packages.Framework);
local v2 = require(l_script_FirstAncestor_0.Packages.React);
local v3 = require(script.EquippedItemPreview);
local v4 = require(script.Parent.ResetCameraButton);
local v5 = require(l_script_FirstAncestor_0.Src.Components.DraggableTileList);
local v6 = require(l_script_FirstAncestor_0.Src.Util.EquipmentStateContext);
local v7 = require(l_script_FirstAncestor_0.Src.Util.getItemAccessoryType);
local v8 = require(l_script_FirstAncestor_0.Src.Util.DEPRECATED_isLayeredClothing);
local _ = require(l_script_FirstAncestor_0.Src.Resources.Theme);
local _ = require(l_script_FirstAncestor_0.Src.Types);
local v11 = require(l_script_FirstAncestor_0.Src.Flags.getFFlagAvatarPreviewerEquippedHoverMenu);
local v12 = require(l_script_FirstAncestor_0.Src.Flags.getFFlagAvatarPreviewerClothingTypeIcons);
local l_UI_0 = v1.UI;
local l_Pane_0 = l_UI_0.Pane;
local l_ScrollingFrame_0 = l_UI_0.ScrollingFrame;
local l_LayoutOrderIterator_0 = v1.Util.LayoutOrderIterator;
local l_Analytics_0 = v1.ContextServices.Analytics;
local l_Stylizer_0 = v1.ContextServices.Stylizer;
return function(v19)
    local v20 = l_Analytics_0:use();
    local v21 = l_Stylizer_0:use("EquippedItemsSidebar");
    local v22 = v2.useContext(v6);
    local v23 = {};
    local v24 = {};
    local v25 = l_LayoutOrderIterator_0.new();
    for _, v27 in v22.equippedItems, nil, nil do
        if not if not v12() then v8(v27) else v7(v27) == "layered" then
            table.insert(v24, v2.createElement(v3, {
                ItemData = v27,
                LayoutOrder = v25:getNextOrder(),
                Size = v21.CellSize
            }));
        else
            table.insert(v23, 1, v27);
        end;
    end;
    local _ = UDim2.fromOffset(v21.CellSize.X.Offset, v21.CellSize.Y.Offset * #v23);
    local v29, v30 = v2.useState(Vector2.new());
    return v2.createElement(l_Pane_0, {
        AnchorPoint = Vector2.new(1, 1),
        Position = UDim2.fromScale(1, 1) - v21.PositionOffset,
        Size = v21.Size,
        Layout = Enum.FillDirection.Vertical,
        Spacing = v21.SidebarSpacing
    }, {
        Contents = v2.createElement(l_Pane_0, {
            AutomaticSize = Enum.AutomaticSize.Y,
            HorizontalAlignment = Enum.HorizontalAlignment.Right,
            Layout = Enum.FillDirection.Vertical,
            Spacing = v21.SidebarSpacing,
            [v2.Change.AbsoluteSize] = function(v31)
                v30(v31.AbsoluteSize);
            end
        }, {
            ResetCameraButton = v2.createElement(v4, {
                LayoutOrder = v25:getNextOrder()
            }),
            LayeredClothingEquipment = v2.createElement(v5, {
                cellSize = v21.CellSize,
                layoutOrder = v25:getNextOrder(),
                tiles = v23,
                render = function(v32, v33)
                    local v34 = v2.createElement(v3, {
                        ItemData = v32,
                        Size = UDim2.fromScale(1, 1),
                        IsDragging = v33
                    });
                    if not v11() then
                        return v34, (tostring(v32));
                    else
                        return v34, tostring(v32.palette) .. "/" .. tostring(v32.item);
                    end;
                end,
                move = v2.useCallback(function(v35, v36)
                    v20:report("changedLayers");
                    v19.OnClothingLayerOrderChanged((#v23 - v35) + 1, (#v23 - v36) + 1);
                end, {
                    v19.OnClothingLayerOrderChanged,
                    #v23
                })
            })
        }),
        OtherEquipment = v2.createElement(l_ScrollingFrame_0, {
            AutomaticSize = Enum.AutomaticSize.X,
            AutoSizeCanvas = false,
            AutomaticCanvasSize = Enum.AutomaticSize.Y,
            HorizontalAlignment = if not v11() then nil else Enum.HorizontalAlignment.Right,
            LayoutOrder = v25:getNextOrder(),
            Layout = Enum.FillDirection.Vertical,
            Spacing = v21.ItemSpacing,
            Size = if not v11() then UDim2.new(0, v21.CellSize.X.Offset, 1, -v29.Y) else UDim2.new(0, v21.CellSize.X.Offset + v21.FrameSizeOffset, 1, -v29.Y),
            ScrollingFrameSize = if not v11() then nil else UDim2.new(0, v21.ScrollingFrameSizeOffset, 1, 0)
        }, v24)
    });
end;


local v0 = require(script.Parent.Parent.Parent.Packages.React);
return function(v1)
    local v2, v3 = v0.useState(false);
    v0.useEffect(function()
        v3(true);
    end, v1.dependencies);
    v0.useEffect(function()
        if v2 then
            v3(false);
            return ;
        else
            return ;
        end;
    end, {
        v2
    });
    if not v2 then
        return v0.createElement(v1.component, v1.innerProps);
    else
        return nil;
    end;
end;


local l_script_FirstAncestor_0 = script:FindFirstAncestor("AvatarCompatibilityPreviewer");
local v1 = require(l_script_FirstAncestor_0.Src.Flags.getFFlagAvatarPreviewerEquippedHoverMenu);
local v2 = require(l_script_FirstAncestor_0.Packages.Framework);
local v3 = require(l_script_FirstAncestor_0.Packages.React);
local _ = require(l_script_FirstAncestor_0.Src.Resources.Theme);
local l_AssetRenderModel_0 = v2.UI.AssetRenderModel;
local l_Stylizer_0 = v2.ContextServices.Stylizer;
local function v10(v7)
    if not v7:IsA("Model") then
        if not v7:IsA("Accessory") then
            if not v7:IsA("BasePart") then
                if v7:IsA("Folder") then
                    local l_Handle_0 = v7:FindFirstChildWhichIsA("Accessory"):FindFirstChild("Handle");
                    if l_Handle_0:IsA("BasePart") then
                        return l_Handle_0;
                    end;
                end;
            else
                return v7;
            end;
        else
            local l_Handle_1 = v7:FindFirstChild("Handle");
            if l_Handle_1:IsA("BasePart") then
                return l_Handle_1;
            end;
        end;
        return nil;
    else
        return v7.PrimaryPart;
    end;
end;
return function(v11)
    local v12 = l_Stylizer_0:use("ItemDataPreviewModel");
    local v16 = v3.useMemo(function()
        local v13 = v11.Instance:Clone();
        local v14 = v10(v13);
        local l_Model_0 = Instance.new("Model");
        v13.Parent = l_Model_0;
        assert(v14:IsDescendantOf(l_Model_0), "The primary part we're about to use should have been moved");
        l_Model_0.PrimaryPart = v14;
        return l_Model_0;
    end, {
        v11.Instance
    });
    return v3.createElement(l_AssetRenderModel_0, {
        FocusDirection = v16.PrimaryPart and v16.PrimaryPart.CFrame.LookVector,
        Model = v16,
        Static = true,
        Ambient = v12.InstanceAmbient,
        LightColor = Color3.new(1, 1, 1),
        LightDirection = v16.PrimaryPart and -v16.PrimaryPart.CFrame.LookVector,
        ImageTransparency = if not v1() then nil else v11.Transparency
    });
end;


local l_script_FirstAncestor_0 = script:FindFirstAncestor("AvatarCompatibilityPreviewer");
local v1 = require(l_script_FirstAncestor_0.Src.Flags.getFFlagAvatarPreviewerEquippedHoverMenu);
local v2 = require(l_script_FirstAncestor_0.Src.Util.Constants);
local v3 = require(l_script_FirstAncestor_0.Packages.React);
local v4 = require(script.ItemDataPreviewModel);
local _ = require(l_script_FirstAncestor_0.Src.Types);
return function(v6)
    if v6.ItemData.item.source == v2.SOURCE_BUILTIN then
        return v3.createElement(v6.ItemData.palette.PreviewComponent, {
            Item = v6.ItemData.item.builtinItem,
            Selected = v6.Selected,
            Transparency = if not v1() then nil else v6.Transparency
        });
    elseif v6.ItemData.item.source == v2.SOURCE_INSTANCE then
        return v3.createElement(v4, {
            Instance = v6.ItemData.item.instance,
            Transparency = if not v1() then nil else v6.Transparency
        });
    else
        error((("Unknown item source: %*"):format(v6.ItemData.item.source)));
        return ;
    end;
end;


local l_script_FirstAncestor_0 = script:FindFirstAncestor("AvatarCompatibilityPreviewer");
local v1 = require(l_script_FirstAncestor_0.Packages.Framework);
local v2 = require(l_script_FirstAncestor_0.Packages.React);
local v3 = require(l_script_FirstAncestor_0.Src.Util.addPlatform);
local _ = require(l_script_FirstAncestor_0.Src.Components.Screens.AvatarScreen.Stages.StageType);
local v5 = require(l_script_FirstAncestor_0.Src.Flags.getFFlagAvatarPreviewerAutoSetup);
local v6 = require(l_script_FirstAncestor_0.Src.Flags.getFFlagAvatarPreviewerSetUpResetCameraButton);
local v7 = require(l_script_FirstAncestor_0.Src.Flags.getFFlagAvatarPreviewerSkinToneAlphaDetection);
local l_UI_0 = v1.UI;
local l_SharedFlags_0 = v1.SharedFlags;
local v10 = if not l_SharedFlags_0.getFFlagDevFrameworkBetterInit() then v1.StudioUI.AssetRenderModel else l_UI_0.AssetRenderModel;
local v11 = l_SharedFlags_0.getFFlagDevFrameworkAssetRenderModelEnableSky();
local l_Stylizer_0 = v1.ContextServices.Stylizer;
local v13 = require(l_script_FirstAncestor_0.Src.Util.Constants);
local _ = require(l_script_FirstAncestor_0.Src.Resources.Theme);
local _ = require(l_script_FirstAncestor_0.Src.Types);
return (v2.memo(function(v16)
    assert(v5() or v7(), "ModelPreview requires FFlagAvatarPreviewerSkinToneAlphaDetection");
    assert(v16.Model.PrimaryPart ~= nil, "PrimaryPart is not set");
    local v17 = l_Stylizer_0:use("ModelPreview");
    local v18, v19 = v2.useState(nil);
    v2.useEffect(function()
        if v18 ~= nil then
            v18:Destroy();
            v19(nil);
        end;
        if v16.Model == nil then
            return ;
        else
            assert(v16.Model ~= nil, v13.LUAU_ANALYZE_ERROR);
            local l_WorldModel_0 = Instance.new("WorldModel");
            v16.Model.Name = "Dummy";
            v16.Model.Parent = l_WorldModel_0;
            l_WorldModel_0.PrimaryPart = v16.Model.PrimaryPart;
            l_WorldModel_0:PivotTo(CFrame.new());
            v19(l_WorldModel_0);
            return v3(l_WorldModel_0, v16.Model, v17.PlatformHeight, v17.PlatformSize);
        end;
    end, {
        v16.Model
    });
    local v21 = v2.useState(Instance.new("Camera"));
    local v22 = v2.useRef({
        cframe = CFrame.new(),
        focus = CFrame.new(),
        model = nil
    });
    assert(v22.current ~= nil, v13.LUAU_ANALYZE_ERROR);
    local v25 = v2.useCallback(function()
        local l_current_0 = v22.current;
        assert(l_current_0.model ~= nil, "Model hasn't been set before resetCamera");
        local v24 = v16.GetCameraModifications(l_current_0.model.Dummy);
        v21.CFrame = v24.cframe or l_current_0.cframe;
        v21.Focus = v24.focus or l_current_0.focus;
        v21.FieldOfView = v24.fov;
    end, {
        v16.GetCameraModifications
    });
    v2.useEffect(function()
        if v22.current.model == nil then
            return ;
        else
            v25();
            return ;
        end;
    end, {
        v16.GetCameraModifications
    });
    local v28 = v2.useCallback(function(v26)
        local v27 = nil;
        task.defer(function()
            if v26:IsDescendantOf(game) then
                assert(v26:FindFirstChild("Dummy"), "View model does not have a dummy");
                v22.current = {
                    cframe = v13.DEFAULT_CAMERA_ANGLE,
                    focus = v21.Focus,
                    model = v26
                };
                v25();
                if v16.InitialCameraPosition == nil then
                    return ;
                else
                    assert(v16.InitialCameraPosition ~= nil, v13.LUAU_ANALYZE_ERROR);
                    assert(v16.SetInitialCameraPosition ~= nil, "InitialCameraPosition should always some with a SetInitialCameraPosition");
                    v21.CFrame = v16.InitialCameraPosition;
                    v27 = v21:GetPropertyChangedSignal("CFrame"):Connect(function()
                        v16.SetInitialCameraPosition(v21.CFrame);
                    end);
                    return ;
                end;
            else
                return ;
            end;
        end);
        return function()
            if v27 ~= nil then
                v27:Disconnect();
            end;
        end;
    end, {
        v16.InitialCameraPosition
    });
    v2.useEffect(function()
        if v16.ResetCameraSignal == nil then
            return ;
        else
            assert(v16.ResetCameraSignal ~= nil, v13.LUAU_ANALYZE_ERROR);
            local v29 = v16.ResetCameraSignal:Connect(v25);
            return function()
                v29:Disconnect();
            end;
        end;
    end, {
        v25,
        v16.ResetCameraSignal
    });
    v2.useEffect(function()
        local function v32()
            if v18 ~= nil then
                for _, v31 in v18:GetDescendants() do
                    if v31:IsA("WrapLayer") then
                        v31.Order = v31.Order + 1;
                        v31.Order = v31.Order - 1;
                    end;
                end;
            end;
        end;
        task.defer(v32);
        task.delay(0.05, v32);
    end, {
        v18
    });
    if not v18 then
        return nil;
    else
        return (v2.createElement(v10, {
            Camera = v21,
            Model = v18,
            FocusPosition = v16.Model.PrimaryPart.CFrame.Position,
            FocusDirection = v16.Model.PrimaryPart.CFrame.LookVector,
            Size = UDim2.fromScale(1, 1),
            Ambient = v17.Ambient,
            EnableSky = if not v11 then nil else v17.EnableSky,
            LightColor = v17.LightColor,
            LightDirection = v17.LightDirection,
            PanSpeedMultiplier = v17.PanSpeedMultiplier,
            ShouldClone = false,
            RecenterModelOnUpdate = true,
            RecenterCameraOnUpdate = true,
            Static = v16.Static,
            ResetCameraPosition = v13.DEFAULT_CAMERA_ANGLE,
            OnViewModelLoaded = v28,
            ShowResetCamera = if not v6() then nil else v16.ShowResetCameraButton
        }));
    end;
end));


local l_script_FirstAncestor_0 = script:FindFirstAncestor("AvatarCompatibilityPreviewer");
local v1 = require(l_script_FirstAncestor_0.Packages.Framework);
local v2 = require(l_script_FirstAncestor_0.Packages.React);
local _ = require(l_script_FirstAncestor_0.Src.Resources.Theme);
local l_UI_0 = v1.UI;
local l_TextLabel_0 = l_UI_0.TextLabel;
local l_Pane_0 = l_UI_0.Pane;
local l_Stylizer_0 = v1.ContextServices.Stylizer;
return function(v8)
    local v9 = l_Stylizer_0:use("Notice");
    return v2.createElement(l_Pane_0, {
        AnchorPoint = Vector2.new(0.5, 0.5),
        Position = UDim2.fromScale(0.5, 0.5),
        AutomaticSize = Enum.AutomaticSize.XY,
        BackgroundColor = v9.BackgroundColor,
        Padding = v9.Padding
    }, {
        UICorner = v2.createElement("UICorner", {
            CornerRadius = v9.CornerRadius
        }),
        NoticeText = v2.createElement(l_TextLabel_0, {
            AutomaticSize = Enum.AutomaticSize.XY,
            Text = v8.Text,
            TextColor = v9.TextColor,
            TextSize = v9.TextSize,
            TextWrapped = true
        })
    });
end;


local l_script_FirstAncestor_0 = script:FindFirstAncestor("AvatarCompatibilityPreviewer");
local v1 = require(l_script_FirstAncestor_0.Packages.React);
local v2 = require(l_script_FirstAncestor_0.Src.Util.OriginalLimbContext);
return function(v3)
    local v4 = v1.useRef({});
    assert(v4.current ~= nil, "Luau");
    v1.useEffect(function()
        return function()
            for _, v6 in v4.current, nil, nil do
                v6:Disconnect();
            end;
            table.clear(v4.current);
        end;
    end, {});
    return v1.createElement(v2.Provider, {
        value = v1.useMemo(function()
            return {
                isLimbOriginal = function(v7)
                    return v4.current[v7] ~= nil;
                end,
                markLimbAsOriginal = function(v8)
                    v4.current[v8] = v8.Destroying:Connect(function()
                        v4.current[v8]:Disconnect();
                        v4.current[v8] = nil;
                    end);
                end
            };
        end, {})
    }, v3.children);
end;


local l_script_FirstAncestor_0 = script:FindFirstAncestor("AvatarCompatibilityPreviewer");
local v1 = require(l_script_FirstAncestor_0.Packages.Framework);
local v2 = require(l_script_FirstAncestor_0.Packages.React);
local v3 = require(l_script_FirstAncestor_0.Src.Hooks.useToggleState);
local _ = require(l_script_FirstAncestor_0.Src.Resources.Theme);
local l_UI_0 = v1.UI;
local l_Image_0 = l_UI_0.Image;
local l_Pane_0 = l_UI_0.Pane;
local l_showContextMenu_0 = l_UI_0.showContextMenu;
local l_Plugin_0 = v1.ContextServices.Plugin;
local l_Stylizer_0 = v1.ContextServices.Stylizer;
return function(v11)
    local v12 = l_Plugin_0:use():get();
    local v13 = l_Stylizer_0:use("PickTabMenu");
    local v14 = v3(false);
    return v2.createElement(l_Pane_0, {
        Position = v13.Position,
        Size = v13.Size,
        BackgroundColor3 = v11.BackgroundColor,
        Padding = v13.Padding
    }, {
        Button = v2.createElement(l_Pane_0, {
            OnClick = function()
                l_showContextMenu_0(v12, v11.MenuTabs);
            end,
            BackgroundColor3 = if not v14.enabled then v11.BackgroundColor else v11.BackgroundColorHover,
            [v2.Event.MouseEnter] = v14.enable,
            [v2.Event.MouseLeave] = v14.disable
        }, {
            UICorner = v2.createElement("UICorner", {
                CornerRadius = v13.CornerRadius
            }),
            DotsIcon = v2.createElement(l_Image_0, {
                Style = "PickTabMenu",
                ImageColor3 = v13.ImageColor
            })
        })
    });
end;


local v0 = require(script:FindFirstAncestor("AvatarCompatibilityPreviewer").Packages.React);
local l_status_0, l_result_0 = pcall(function()
    return game:GetService("PlacesService");
end);
return (v0.createContext({
    startPlaySolo = function()
        if not l_status_0 then
            error("Calling startPlaySolo on unmocked PlacesService");
            return ;
        else
            l_result_0:StartPlaySolo();
            return ;
        end;
    end,
    stopPlaySolo = function()
        if not l_status_0 then
            error("Calling stopPlaySolo on unmocked PlacesService");
            return ;
        else
            l_result_0:StopPlaySolo();
            return ;
        end;
    end
}));


local l_script_FirstAncestor_0 = script:FindFirstAncestor("AvatarCompatibilityPreviewer");
local v1 = require(l_script_FirstAncestor_0.Packages.Framework);
local v2 = require(l_script_FirstAncestor_0.Packages.React);
local v3 = require(l_script_FirstAncestor_0.Packages.ReactRoblox);
local v4 = require(l_script_FirstAncestor_0.Src.Components.AvatarScreenContext);
local v5 = require(l_script_FirstAncestor_0.Src.Util.DEPRECATED_AvatarScreenContext);
local v6 = require(l_script_FirstAncestor_0.Src.Components.Background);
local v7 = require(l_script_FirstAncestor_0.Src.Components.DummyPreview_DEPRECATED);
local v8 = require(l_script_FirstAncestor_0.Src.Components.ModelPreview);
local v9 = require(l_script_FirstAncestor_0.Src.Hooks.useSerializedState);
local l_UI_0 = v1.UI;
local l_LoadingIndicator_0 = l_UI_0.LoadingIndicator;
local l_Pane_0 = l_UI_0.Pane;
local v13 = require(l_script_FirstAncestor_0.Src.Util.Constants);
local _ = require(l_script_FirstAncestor_0.Src.Resources.Theme);
local _ = require(l_script_FirstAncestor_0.Src.Types);
local v16 = require(l_script_FirstAncestor_0.Src.Flags.getFFlagAvatarPreviewerAutoSetup);
local v17 = v16();
local v18 = require(l_script_FirstAncestor_0.Src.Flags.getFFlagAvatarPreviewerSkinToneAlphaDetection);
local l_Stylizer_0 = v1.ContextServices.Stylizer;
return function(v20)
    local v21 = if not v18() then if v17 then v2.useContext(v5) else nil else v2.useContext(v4.Context);
    local v22 = if not v17 then l_Stylizer_0:use("PrimaryDummyPreview") else nil;
    local v27 = v2.useCallback(function(_, v24)
        if v24.UserInputType ~= Enum.UserInputType.MouseButton2 then
            return ;
        else
            local l_Position_0 = v24.Position;
            local v26 = nil;
            v26 = v24:GetPropertyChangedSignal("Position"):Connect(function()
                if (v24.Position - l_Position_0).Magnitude >= 4 then
                    v26:Disconnect();
                end;
            end);
            return ;
        end;
    end, {
        v20.Dummy,
        v20.RevertToDefault
    });
    local v28, v29 = v9(v20.Avatar.WorldModel, "CameraPosition", v13.DEFAULT_CAMERA_ANGLE);
    if not v16() and not v18() then
        return v2.createElement("ImageLabel", {
            BackgroundTransparency = 1,
            Image = v22.BackgroundImage,
            Size = UDim2.fromScale(1, 1),
            ZIndex = -1,
            [v3.Event.InputBegan] = v27
        }, {
            DummyPreview = if not v20.Dummy then v2.createElement(l_LoadingIndicator_0, {
                AnchorPoint = Vector2.new(0.5, 0.5),
                Position = UDim2.fromScale(0.5, 0.5),
                Size = UDim2.fromScale(0.5, 0.5)
            }) else v2.createElement(v7, {
                Dummy = v20.Dummy,
                ResetCameraSignal = v20.ResetCameraSignal
            })
        });
    else
        return v2.createElement(l_Pane_0, {
            ZIndex = -1,
            [v3.Event.InputBegan] = v27
        }, {
            Background = v2.createElement(v6),
            DummyPreview = if not v20.Dummy then v2.createElement(l_LoadingIndicator_0, {
                AnchorPoint = Vector2.new(0.5, 0.5),
                Position = UDim2.fromScale(0.5, 0.5),
                Size = UDim2.fromScale(0.5, 0.5)
            }) else v2.createElement(v8, {
                Model = v20.Dummy,
                ResetCameraSignal = v20.ResetCameraSignal,
                InitialCameraPosition = v28,
                SetInitialCameraPosition = v29,
                GetCameraModifications = v21.stage.getPreviewCameraModifications,
                Static = v21.dummyPreviewLocked
            })
        });
    end;
end;


local l_script_FirstAncestor_0 = script:FindFirstAncestor("AvatarCompatibilityPreviewer");
local v1 = require(l_script_FirstAncestor_0.Packages.Framework);
local v2 = require(l_script_FirstAncestor_0.Packages.React);
local v3 = require(l_script_FirstAncestor_0.Src.Components.AvatarScreenContext);
local v4 = require(l_script_FirstAncestor_0.Src.Util.DEPRECATED_AvatarScreenContext);
local v5 = require(l_script_FirstAncestor_0.Src.Flags.getFFlagAvatarPreviewerSkinToneAlphaDetection);
local l_UI_0 = v1.UI;
local l_Button_0 = l_UI_0.Button;
local l_Image_0 = l_UI_0.Image;
local l_Tooltip_0 = l_UI_0.Tooltip;
local l_Stylizer_0 = v1.ContextServices.Stylizer;
local _ = require(l_script_FirstAncestor_0.Src.Resources.Theme);
return function(v12)
    local v13 = l_Stylizer_0:use("ResetCameraButton");
    local v14 = v2.useContext(if not v5() then v4 else v3.Context);
    local v15 = UDim.new(0, v13.Spacing);
    return v2.createElement(l_Button_0, {
        AnchorPoint = Vector2.new(1, 0),
        LayoutOrder = v12.LayoutOrder,
        OnClick = v14.resetCamera,
        Style = "Round",
        Size = v13.Size + UDim2.fromOffset(v13.Spacing, v13.Spacing),
        ZIndex = 2
    }, {
        Spacing = v2.createElement("UIPadding", {
            PaddingLeft = v15,
            PaddingRight = v15,
            PaddingTop = v15,
            PaddingBottom = v15
        }),
        Icon = v2.createElement(l_Image_0, {
            Image = v13.Image
        }),
        Tooltip = v2.createElement(l_Tooltip_0, {
            Text = "Reset Camera"
        })
    });
end;


local l_RunService_0 = game:GetService("RunService");
return (require(script:FindFirstAncestor("AvatarCompatibilityPreviewer").Packages.React).createContext({
    isRunning = function()
        return l_RunService_0:IsRunning();
    end
}));


local l_script_FirstAncestor_0 = script:FindFirstAncestor("AvatarCompatibilityPreviewer");
local v1 = require(l_script_FirstAncestor_0.Packages.Framework);
local v2 = require(l_script_FirstAncestor_0.Packages.React);
local v3 = require(l_script_FirstAncestor_0.Src.Components.Background);
local v4 = require(l_script_FirstAncestor_0.Src.Components.ModelPreview);
local v5 = require(l_script_FirstAncestor_0.Src.Util.Constants);
local _ = require(l_script_FirstAncestor_0.Src.Resources.Theme);
local _ = require(l_script_FirstAncestor_0.Src.Types);
local v8 = require(l_script_FirstAncestor_0.Src.Util.exhaustiveMatch);
local v9 = require(l_script_FirstAncestor_0.Src.Util.filterDescendants);
local v10 = require(l_script_FirstAncestor_0.Src.Hooks.useToggleState);
local l_UI_0 = v1.UI;
local l_Alert_0 = l_UI_0.Alert;
local l_IconButton_0 = l_UI_0.IconButton;
local l_Pane_0 = l_UI_0.Pane;
local l_StyledDialog_0 = l_UI_0.StyledDialog;
local l_TextLabel_0 = l_UI_0.TextLabel;
local l_LayoutOrderIterator_0 = v1.Util.LayoutOrderIterator;
local l_Localization_0 = v1.ContextServices.Localization;
local l_Stylizer_0 = v1.ContextServices.Stylizer;
local v20 = require(l_script_FirstAncestor_0.Src.Flags.getFFlagAvatarPreviewerAutoSetupDisablePublish);
local v21 = game:DefineFastFlag("AvatarPreviewerAutoSetupBetterPivot", false);
local v22 = require(l_script_FirstAncestor_0.Src.Flags.getFFlagAvatarPreviewerSetUpResetCameraButton);
local function v23()
    return {
        fov = 70
    };
end;
local function _(v24)
    if v24 == "ErrorMultipleBodies" then
        return false;
    elseif v24 == "ErrorSourceFail" then
        return true;
    else
        return v8(v24);
    end;
end;
return function(v26)
    local v27 = l_Localization_0:use();
    local v28 = l_Stylizer_0:use("AutoSetupScreen");
    assert(v26.autoSetupState.type ~= "none", v5.LUAU_ANALYZE_ERROR);
    local v30 = v2.useMemo(function()
        local l_target_0 = v26.autoSetupState.target;
        assert(#l_target_0.bodies > 0, "Received empty bodies list from auto setup state");
        return l_target_0.bodies[1];
    end, {
        v26.autoSetupState.target
    });
    local v33 = v2.useMemo(function()
        local l_Model_0 = Instance.new("Model");
        local v32 = v30:Clone();
        if v21 then
            v32.PivotOffset = CFrame.new();
        end;
        v32.Parent = l_Model_0;
        l_Model_0.PrimaryPart = v32;
        v9(v32);
        return l_Model_0;
    end, {
        v30
    });
    local v34 = v10(false);
    v2.useEffect(function()
        if v26.autoSetupState.type == "error" then
            v34.enable();
        end;
    end, {
        v26.autoSetupState
    });
    v2.useEffect(function()
        if v26.autoSetupState.type ~= "inAutoSetup" then
            v33.PrimaryPart.CFrame = CFrame.new(v33.PrimaryPart.Position) * v30.CFrame.Rotation;
            return ;
        else
            local v35 = task.spawn(function()
                while true do
                    v33.PrimaryPart.CFrame = v33.PrimaryPart.CFrame * CFrame.Angles(0, ((task.wait() * v28.SpinRate) * 2) * 3.141592653589793, 0);
                end;
            end);
            return function()
                task.cancel(v35);
            end;
        end;
    end, {
        v26.autoSetupState,
        v33
    });
    local v36 = v10(false);
    local v37 = l_LayoutOrderIterator_0.new();
    local l_createElement_0 = v2.createElement;
    local l_l_Pane_0_0 = l_Pane_0;
    local v40 = {};
    local v42 = {
        Background = v2.createElement(v3),
        ModelPreview = v2.createElement(l_Pane_0, {
            ZIndex = v37:getNextOrder()
        }, v2.createElement(v4, {
            Model = v33,
            GetCameraModifications = v23,
            ShowResetCameraButton = not not v22() or nil
        })),
        CancelDialog = v2.createElement(l_StyledDialog_0, {
            Style = "AcceptCancel",
            Enabled = v36.enabled,
            Modal = true,
            Resizable = false,
            Title = v27:getText("AvatarScreen", "CancelPromptTitle"),
            MinContentSize = Vector2.new(300, 50),
            Buttons = {
                {
                    Key = "yes",
                    Text = v27:getText("AvatarScreen", "CancelPromptYes")
                },
                {
                    Key = "no",
                    Text = v27:getText("AvatarScreen", "CancelPromptNo")
                }
            },
            OnButtonPressed = function(v41)
                if v41 == "yes" then
                    v26.cancelAutoSetup();
                end;
                v36.disable();
            end,
            OnClose = v36.disable
        }, {
            Text = v2.createElement(l_TextLabel_0, {
                Text = v27:getText("AvatarScreen", "CancelPromptConfirmText"),
                TextWrapped = true
            })
        })
    };
    local l_createElement_1 = v2.createElement;
    local l_l_Pane_0_1 = l_Pane_0;
    local v45 = {
        AutomaticSize = Enum.AutomaticSize.Y,
        Size = UDim2.fromScale(1, 0),
        ZIndex = v37:getNextOrder()
    };
    local v46 = {
        Padding = v2.createElement("UIPadding", {
            PaddingLeft = v28.AlertPaddingHorizontal,
            PaddingRight = v28.AlertPaddingHorizontal,
            PaddingTop = v28.AlertPaddingVertical
        })
    };
    local v47;
    if not (v26.autoSetupState.type == "error") or not v34.enabled then
        if v20() and v26.autoSetupState.type == "hasSelection" then
            v47 = v2.createElement(l_Alert_0, {
                Title = v27:getText("AvatarScreen", "AutoSetupStartTitle"),
                Description = v27:getText("AvatarScreen", "AutoSetupStartDescription"),
                Style = "Warning",
                OnClose = v34.disable
            });
        else
            v47 = false;
            if v26.autoSetupState.type == "inAutoSetup" then
                v47 = v2.createElement(l_Alert_0, {
                    Title = v27:getText("AvatarScreen", "AutoSetupInProgressTitle"),
                    Description = v27:getText("AvatarScreen", "AutoSetupInProgressDescription") .. (v26.autoSetupState.eta == nil and "" or "\n" .. v27:getText("AvatarScreen", "AutoSetupETA", {
                        eta = math.ceil(v26.autoSetupState.eta)
                    })),
                    PrimaryAction = {
                        Text = v27:getText("AvatarScreen", "AutoSetupInProgressActionText"),
                        OnClick = v36.enable
                    }
                });
            end;
        end;
    else
        v47 = v2.createElement(l_Alert_0, {
            Title = v27:getText("AvatarScreen", "AutoSetupErrorTitle"),
            Description = v27:getText("AvatarScreen", v26.autoSetupState.error),
            Style = "Error",
            OnClose = v34.disable
        });
    end;
    v46.Alert = v47;
    v42.ErrorAlert = l_createElement_1(l_l_Pane_0_1, v45, v46);
    if v26.autoSetupState.type ~= "hasSelection" then
        l_createElement_1 = false;
        if v26.autoSetupState.type == "error" then
            l_l_Pane_0_1 = v26.autoSetupState.error;
            l_createElement_1 = l_l_Pane_0_1 ~= "ErrorMultipleBodies" and (l_l_Pane_0_1 == "ErrorSourceFail" and true or v8(l_l_Pane_0_1));
            if not l_createElement_1 then
                goto label0;
            end;
        else
            goto label0;
        end;
    end;
    l_createElement_1 = v2.createElement(l_Pane_0, {
        AnchorPoint = Vector2.new(1, 1),
        AutomaticSize = Enum.AutomaticSize.XY,
        Position = v28.ControlsPosition,
        ZIndex = v37:getNextOrder()
    }, {
        Start = v2.createElement(l_IconButton_0, {
            AutomaticSize = Enum.AutomaticSize.XY,
            OnClick = v26.startAutoSetup,
            Style = "PrimaryBrand",
            Text = v27:getText("AvatarScreen", "StartAutoSetup"),
            ZIndex = 2
        })
    });
    ::label0::;
    v42.Controls = l_createElement_1;
    return l_createElement_0(l_l_Pane_0_0, v40, v42);
end;


local l_script_FirstAncestor_0 = script:FindFirstAncestor("AvatarCompatibilityPreviewer");
local v1 = require(l_script_FirstAncestor_0.Packages.Framework);
local v2 = require(l_script_FirstAncestor_0.Packages.React);
local _ = require(l_script_FirstAncestor_0.Src.Types);
local v4 = require(l_script_FirstAncestor_0.Src.Components.SurveyDialog);
local _ = require(l_script_FirstAncestor_0.Src.Resources.Theme);
local v6 = require(l_script_FirstAncestor_0.Src.Hooks.useCreatedByAutoSetup);
local v7 = require(l_script_FirstAncestor_0.Src.Hooks.useCreatedByAutoSetup_DEPRECATED);
local v8 = require(l_script_FirstAncestor_0.Src.Hooks.useSerializedState);
local v9 = require(l_script_FirstAncestor_0.Src.Hooks.useToggleState);
local v10 = require(l_script_FirstAncestor_0.Src.Util.Constants);
local v11 = require(l_script_FirstAncestor_0.Src.Util.findUnderlyingMeshAssetIds);
local v12 = require(l_script_FirstAncestor_0.Src.Flags.getFFlagAvatarPreviewerAutoSetupTelemetry);
local v13 = require(l_script_FirstAncestor_0.Src.Flags.getFFlagAvatarPreviewerAutoSetupDisablePublish);
local v14 = require(l_script_FirstAncestor_0.Src.Flags.getFFlagAvatarPreviewerAutoSetupTelemetryV2);
local l_Analytics_0 = v1.ContextServices.Analytics;
local l_Stylizer_0 = v1.ContextServices.Stylizer;
return function(v17)
    local v18 = l_Analytics_0:use();
    local v19 = l_Stylizer_0:use("ContextualSurveyDialogButton");
    local v20 = if v13() or v14() then v6(v17.Avatar.WorldModel) else v7(v17.Avatar);
    local v21, v22 = v8(v17.Avatar.WorldModel, "completedAutoSetupSurvey", false);
    local v23 = if not v14() then nil else v8(v17.Avatar.WorldModel, v10.ATTRIBUTE_AUTO_SETUP_INPUT_ASSET, nil);
    local v24 = v9(false);
    local v26 = v2.useCallback(function(v25)
        if not v14() then
            if not v12() then
                v18:report("sendAutoSetupSurvey", v25);
            else
                v18:report("sendAutoSetupSurvey", v25, v11(v17.Avatar.WorldModel));
            end;
        else
            v18:report("sendAutoSetupSurvey", v25, v11(v17.Avatar.WorldModel), v23);
        end;
        v22(true);
    end, {});
    if v20 then
        return v2.createElement(v2.Fragment, {}, {
            SurveyDialog = v24.enabled and v2.createElement(v4, {
                close = v24.disable,
                submitResults = v26
            }),
            ContextualSurveyDialogButton = not v21 and v2.createElement("ImageButton", {
                AnchorPoint = Vector2.new(0, 1),
                BackgroundTransparency = 1,
                Image = v19.Image,
                Position = v19.Position,
                Size = v19.Size,
                [v2.Event.Activated] = v24.enable
            })
        });
    else
        return nil;
    end;
end;


local l_script_FirstAncestor_0 = script:FindFirstAncestor("AvatarCompatibilityPreviewer");
local _ = require(l_script_FirstAncestor_0.Packages.Cryo);
local _ = require(l_script_FirstAncestor_0.Packages.Dash);
local v3 = require(l_script_FirstAncestor_0.Packages.React);
local v4 = require(l_script_FirstAncestor_0.Src.Components.AnimationController);
local v5 = require(l_script_FirstAncestor_0.Src.Components.EquippedItemsSidebar);
local _ = require(script.Parent.StageType);
local v7 = require(l_script_FirstAncestor_0.Src.Util.Constants);
local v8 = require(l_script_FirstAncestor_0.Src.Util.EquipmentStateContext);
local _ = require(l_script_FirstAncestor_0.Src.Types);
local v10 = require(l_script_FirstAncestor_0.Src.Hooks.useOnClothingLayerOrderChanged);
return {
    tabs = {
        "animations",
        "clothing",
        "accessories",
        "body"
    },
    render = function(v11)
        local l_avatarAssets_0 = v3.useContext(v8).avatarAssets;
        local v13 = v10();
        if v11.Dummy == nil then
            return nil;
        else
            assert(v11.Dummy, v7.LUAU_ANALYZE_ERROR);
            return v3.createElement(v3.Fragment, {}, {
                EquippedItemsSidebar = v3.createElement(v5, {
                    OnClothingLayerOrderChanged = v13
                }),
                AnimationController = l_avatarAssets_0.animation and v3.createElement(v4, {
                    Dummy = v11.Dummy,
                    AnimationId = l_avatarAssets_0.animation
                })
            });
        end;
    end,
    getPreviewCameraModifications = function()
        return {
            fov = 50
        };
    end
};


local l_script_FirstAncestor_0 = script:FindFirstAncestor("AvatarCompatibilityPreviewer");
local v1 = require(l_script_FirstAncestor_0.Packages.Framework);
local v2 = require(l_script_FirstAncestor_0.Packages.React);
local v3 = require(l_script_FirstAncestor_0.Src.Components.AnimationController);
local v4 = require(l_script_FirstAncestor_0.Src.Components.EquippedItemsSidebar);
local v5 = require(l_script_FirstAncestor_0.Src.Components.Notice);
local v6 = require(l_script_FirstAncestor_0.Src.Flags.getFFlagAvatarPreviewerReorganizeCheckFace);
local v7 = v6();
local v8 = require(l_script_FirstAncestor_0.Src.Hooks.useOnClothingLayerOrderChanged);
local _ = require(l_script_FirstAncestor_0.Src.Types);
local v10 = require(l_script_FirstAncestor_0.Src.Util.Constants);
local v11 = require(l_script_FirstAncestor_0.Src.Util.EquipmentStateContext);
local _ = require(script.Parent.StageType);
local l_Localization_0 = v1.ContextServices.Localization;
return {
    tabs = if not v6() then {
        "face"
    } else {
        "animations_face",
        "accessories_face"
    },
    render = function(v14)
        local v15 = l_Localization_0:use();
        local v16 = v2.useContext(v11);
        local v17 = nil;
        if v7 then
            v17 = v8();
        end;
        if v14.Dummy == nil then
            return nil;
        else
            assert(v14.Dummy ~= nil, v10.LUAU_ANALYZE_ERROR);
            local v18 = if v14.Dummy.Head:FindFirstChildWhichIsA("FaceControls") == nil and (not v6() or v14.SelectedTab == "animations_face") then v2.createElement(v5, {
                key = "Notice",
                Text = v15:getText("CheckFace", "DynamicHeadNotice")
            }) else if v16.avatarAssets.emotion ~= nil then v2.createElement(v3, {
                key = "AnimationController",
                Dummy = v14.Dummy,
                AnimationId = v16.avatarAssets.emotion
            }) else nil;
            if not v6() then
                return v18;
            else
                return v2.createElement(v2.Fragment, {}, {
                    EquippedItemsSidebar = v2.createElement(v4, {
                        OnClothingLayerOrderChanged = v17
                    });
                    v18
                });
            end;
        end;
    end,
    getPreviewCameraModifications = function(v19)
        local l_Head_0 = v19.Head;
        return {
            focus = CFrame.new(l_Head_0.Position),
            cframe = if not v6() then CFrame.lookAt(l_Head_0.Position + (l_Head_0.Size.Magnitude * l_Head_0.CFrame.LookVector) * 1.5, l_Head_0.Position) else CFrame.lookAt((l_Head_0.Position + (l_Head_0.Size.Magnitude * l_Head_0.CFrame.LookVector) * 2) - (l_Head_0.Size.Magnitude * l_Head_0.CFrame.RightVector) * 1, l_Head_0.Position),
            fov = 35
        };
    end
};


local l_script_FirstAncestor_0 = script:FindFirstAncestor("AvatarCompatibilityPreviewer");
local _ = require(l_script_FirstAncestor_0.Packages.React);
local _ = require(l_script_FirstAncestor_0.Src.Types);
return {};


local _ = require(script.StageType);
return {
    CheckBody = require(script.CheckBody),
    CheckFace = require(script.CheckFace)
};


local l_script_FirstAncestor_0 = script:FindFirstAncestor("AvatarCompatibilityPreviewer");
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.React);
local l_Pane_0 = v2.UI.Pane;
local l_LayoutOrderIterator_0 = v2.Util.LayoutOrderIterator;
local l_Signal_0 = v2.Util.Signal;
local l_Stylizer_0 = v2.ContextServices.Stylizer;
local _ = require(l_script_FirstAncestor_0.Src.Types);
local v9 = require(l_script_FirstAncestor_0.Src.Components.AvatarScreenContext);
local v10 = require(l_script_FirstAncestor_0.Src.Components.AssetPalettes);
local v11 = require(l_script_FirstAncestor_0.Src.Components.Catalog);
local v12 = require(l_script_FirstAncestor_0.Src.Components.ContextStack);
local v13 = require(l_script_FirstAncestor_0.Src.Components.ContextStack_DEPRECATED);
local v14 = require(l_script_FirstAncestor_0.Src.Components.DisambiguationMenuContext);
local v15 = require(l_script_FirstAncestor_0.Src.Components.EditingTools);
local v16 = require(l_script_FirstAncestor_0.Src.Components.PrimaryDummyPreview);
local v17 = require(l_script_FirstAncestor_0.Src.Components.StageSelector);
local v18 = require(l_script_FirstAncestor_0.Src.Components.TabBar);
local v19 = require(l_script_FirstAncestor_0.Src.Components.UGCValidationNotice);
local v20 = require(l_script_FirstAncestor_0.Src.Resources.CatalogItems);
local _ = require(l_script_FirstAncestor_0.Src.Resources.Theme);
local v22 = require(script.ContextualSurveyDialogButton);
local v23 = require(script.Stages);
local v24 = require(l_script_FirstAncestor_0.Src.Hooks.useAccessoryWelding);
local v25 = require(l_script_FirstAncestor_0.Src.Hooks.useBodyPartsFromBase);
local v26 = require(l_script_FirstAncestor_0.Src.Hooks.useClothingFromInstances);
local v27 = require(l_script_FirstAncestor_0.Src.Hooks.useCopyPropertyChanges);
local v28 = require(l_script_FirstAncestor_0.Src.Hooks.useDummyFromHumanoidDescription);
local v29 = require(l_script_FirstAncestor_0.Src.Hooks.useMoveAccessoriesAlongsideAttachments);
local v30 = require(l_script_FirstAncestor_0.Src.Hooks.useIncrementedState);
local v31 = require(l_script_FirstAncestor_0.Src.Hooks.useInitialImportController);
local v32 = require(l_script_FirstAncestor_0.Src.Hooks.usePreviewHumanoidDescription);
local v33 = require(l_script_FirstAncestor_0.Src.Hooks.useTrackNewChildrenController);
local v34 = require(l_script_FirstAncestor_0.Src.Hooks.useUntexturedController);
local v35 = require(l_script_FirstAncestor_0.Src.Util.DEPRECATED_AvatarScreenContext);
local v36 = require(l_script_FirstAncestor_0.Src.Util.Constants);
local v37 = require(l_script_FirstAncestor_0.Src.Util.EquipmentStateContext);
local v38 = require(l_script_FirstAncestor_0.Src.Util.SimpleSerializedStateContext);
local v39 = require(l_script_FirstAncestor_0.Src.Util.getPaletteFromKey);
local v40 = require(l_script_FirstAncestor_0.Src.Flags.getFFlagAvatarPreviewerAutoSetup);
local v41 = require(l_script_FirstAncestor_0.Src.Flags.getFFlagAvatarPreviewerEditingTools);
local v42 = v41();
local v43 = require(l_script_FirstAncestor_0.Src.Flags.getFFlagAvatarPreviewerPickTabsMenu);
local v44 = require(l_script_FirstAncestor_0.Src.Flags.getFFlagAvatarPreviewerReorganizeCheckFace);
local v45 = require(l_script_FirstAncestor_0.Src.Flags.getFFlagAvatarPreviewerTestWithAssets);
local v46 = require(l_script_FirstAncestor_0.Src.Flags.getFFlagAvatarPreviewerSkinToneAlphaDetection);
local function _(v47)
    return v20[v47][1].Key;
end;
local function v50(v49)
    v31(v49.WorldModel);
    v33(v49.WorldModel);
    if v42 then
        v27(v49.WorldModel, v49.Dummy, v49.UpdateHumanoidDescription);
    end;
end;
return function(v51)
    local v52 = l_Stylizer_0:use("AvatarScreen");
    local v53 = l_Stylizer_0:use("StageSelector");
    local v54 = v3.useContext(v37);
    local v55 = v3.useContext(v38);
    local v56 = v23[v55.stage];
    local l_WorldModel_0 = v51.Avatar.WorldModel;
    local v58, v59 = v3.useState(v56.tabs[1]);
    assert(v58 ~= nil, "Current stage didn't have a tab");
    local v60, v61 = v3.useState(v20[v58][1].Key);
    local v63 = v1.find(v20[v58], function(v62)
        return v62.Key == v60;
    end);
    v3.useEffect(function()
        if v44() and table.find(v56.tabs, v58) ~= nil then
            return ;
        else
            local v64 = v56.tabs[1];
            v59(v64);
            v61(v20[v64][1].Key);
            return ;
        end;
    end, {
        v56
    });
    local v70 = v3.useCallback(function(v65)
        local _, v67 = v39(v65);
        assert(v67 ~= nil, "Selecting palette that doesn't exist");
        v61(v65);
        v59(v67);
        for v68, v69 in v23, nil, nil do
            if table.find(v69.tabs, v67) ~= nil then
                v55.setStage(v68);
                return ;
            end;
        end;
        error((("Invalid stage for %* (in %*)"):format(v65, v67)));
    end, {
        v55.setStage
    });
    local v71, v72 = v3.useState({});
    local v73, v74 = v3.useState(0);
    local v75 = v28(l_WorldModel_0, (v32(v51.Avatar, {
        v73
    })));
    v25(v75, l_WorldModel_0);
    v26(v75);
    v34(v75, v55.isTextured);
    v24(v75);
    if v42 then
        v29(v75);
    end;
    local v76 = v3.useRef(l_Signal_0.new());
    assert(v76.current ~= nil, v36.LUAU_ANALYZE_ERROR);
    local v77 = v3.useCallback(function()
        v76.current:Fire();
    end, {});
    local v78 = v30();
    local v79 = l_LayoutOrderIterator_0.new();
    local v82 = {
        AvatarScreen = v3.createElement(l_Pane_0, {}, {
            StageSelect = v3.createElement(v17, {
                SelectedStage = v55.stage,
                SetStage = v55.setStage,
                Avatar = v51.Avatar,
                PreviewDummy = if not v45() then nil else v75
            }),
            Contents = v3.createElement(l_Pane_0, {
                Position = UDim2.fromOffset(v53.Width, 0),
                Size = UDim2.new(1, -v53.Width, 1, 0)
            }, {
                Tabs = v3.createElement(l_Pane_0, {
                    Position = UDim2.fromOffset(0, v52.Tabs.VerticalOffset),
                    Size = UDim2.new(1, 0, 0, v52.Tabs.Height),
                    Layout = Enum.FillDirection.Vertical
                }, {
                    TabBar = v3.createElement(v18, {
                        LayoutOrder = v79:getNextOrder(),
                        Tabs = v56.tabs,
                        SelectedTab = v58,
                        SetSelectedTab = function(v80)
                            v59(v80);
                            v61(v20[v80][1].Key);
                        end
                    }),
                    AssetPalettes = v3.createElement(v10, {
                        LayoutOrder = if not v43() then nil else v79:getNextOrder(),
                        SelectedTab = v58,
                        SelectedPalette = v60,
                        SetSelectedPalette = v61,
                        ScrollingFrameProps = if not v43() then {
                            LayoutOrder = v79:getNextOrder()
                        } else nil
                    })
                }),
                Contents = v3.createElement(l_Pane_0, {
                    AnchorPoint = Vector2.new(0, 1),
                    Position = UDim2.fromScale(0, 1),
                    Size = UDim2.new(1, 0, 1, -v52.Tabs.Height)
                }, {
                    CatalogContainer = v63 and v3.createElement(l_Pane_0, {
                        AutomaticSize = Enum.AutomaticSize.Y,
                        BackgroundColor3 = v52.AssetPalettes.BackgroundColor,
                        Size = UDim2.new(0, v52.AssetPalettes.Width, 1, 0)
                    }, {
                        CatalogContainer = v3.createElement(l_Pane_0, {
                            Size = UDim2.new(1, -v52.AssetPalettes.SeparatorWidth, 1, 0)
                        }, {
                            Catalog = v3.createElement(v11, {
                                Palette = v63
                            })
                        }),
                        Separator = v3.createElement(l_Pane_0, {
                            AnchorPoint = Vector2.new(1, 0),
                            BackgroundColor3 = v52.AssetPalettes.SeparatorColor,
                            Position = UDim2.fromScale(1, 0),
                            Size = UDim2.new(0, v52.AssetPalettes.SeparatorWidth, 1, 0)
                        })
                    }),
                    Preview = v3.createElement(l_Pane_0, {
                        AnchorPoint = Vector2.new(1, 0),
                        Position = UDim2.fromScale(1, 0),
                        Size = UDim2.new(1, not v63 and 0 or -v52.AssetPalettes.Width, 1, 0)
                    }, {
                        DummyPreview = v3.createElement(v16, {
                            Dummy = v75,
                            Avatar = v51.Avatar,
                            RevertToDefault = function()
                                if l_WorldModel_0 == nil then
                                    return ;
                                else
                                    v54.removeAllEquippedItems();
                                    return ;
                                end;
                            end,
                            ResetCameraSignal = v76.current
                        }),
                        UGCValidationNotice = v3.createElement(v19, {
                            Avatar = l_WorldModel_0
                        }),
                        if v55.stage == "CheckBody" then v3.createElement(v23.CheckBody.render, {
                            Avatar = v51.Avatar,
                            Dummy = v75,
                            SelectedTab = v58
                        }) else if v55.stage == "CheckFace" then v3.createElement(v23.CheckFace.render, {
                            Avatar = v51.Avatar,
                            Dummy = v75,
                            SelectedTab = v58
                        }) else error((("Unknown stage %*"):format(v55.stage))),
                        ContextualSurveyDialogButton = v40() and v3.createElement(v22, {
                            Avatar = v51.Avatar
                        })
                    })
                })
            })
        }),
        InitialImport = v3.createElement(v50, {
            WorldModel = l_WorldModel_0,
            Dummy = v75,
            UpdateHumanoidDescription = function()
                v74(function(v81)
                    return v81 + 1;
                end);
            end
        }),
        [v36.EDITING_TOOLS_GUI_NAMES.EditingToolbar] = v41() and v3.createElement(v15, {
            worldModel = l_WorldModel_0
        })
    };
    if not v46() then
        if not v40() then
            return v3.createElement(v13, {
                providers = {
                    {
                        provider = v35.Provider,
                        value = {
                            openPalette = v70,
                            resetCamera = v77,
                            stage = v56,
                            dummyPreviewLocked = v78.amount > 0,
                            incrementDummyPreviewLock = v78.increment,
                            decrementDummyPreviewLock = v78.decrement
                        }
                    },
                    {
                        provider = v14.Provider
                    }
                }
            }, v82);
        else
            return v3.createElement(v12, {
                providers = {
                    v3.createElement(v35.Provider, {
                        openPalette = 3,
                        value = {
                            openPalette = v70,
                            focusedAttachments = if not v42 then nil else v71,
                            setFocusedAttachments = if not v42 then nil else v72,
                            dummyPreviewLocked = v78.amount > 0,
                            incrementDummyPreviewLock = v78.increment,
                            decrementDummyPreviewLock = v78.decrement,
                            resetCamera = v77,
                            stage = v56
                        }
                    }),
                    v3.createElement(v14.Provider)
                }
            }, v82);
        end;
    else
        return v3.createElement(v12, {
            providers = {
                v3.createElement(v9.Provider, {
                    openPalette = v70,
                    resetCamera = v77,
                    stage = v56,
                    selectedAvatar = l_WorldModel_0
                }),
                v3.createElement(v14.Provider)
            }
        }, v82);
    end;
end;


local l_script_FirstAncestor_0 = script:FindFirstAncestor("AvatarCompatibilityPreviewer");
local v1 = require(l_script_FirstAncestor_0.Packages.Framework);
local v2 = require(l_script_FirstAncestor_0.Packages.React);
local v3 = require(l_script_FirstAncestor_0.Src.Util.SelectionWrapper);
local _ = require(l_script_FirstAncestor_0.Src.Resources.Theme);
local l_UI_0 = v1.UI;
local l_AssetRenderModel_0 = l_UI_0.AssetRenderModel;
local l_Button_0 = l_UI_0.Button;
local l_Pane_0 = l_UI_0.Pane;
local l_TextLabel_0 = l_UI_0.TextLabel;
local l_Stylizer_0 = v1.ContextServices.Stylizer;
local l_LayoutOrderIterator_0 = v1.Util.LayoutOrderIterator;
return function(v12)
    local v13 = v3:use():get();
    local l_Avatar_0 = l_Stylizer_0:use("ImportPage").Avatar;
    local v15 = l_LayoutOrderIterator_0.new();
    local v19 = v2.useMemo(function()
        local v16 = v12.Cell.Avatar:Clone();
        for _, v18 in v16:GetDescendants() do
            if not (not v18:IsA("LuaSourceContainer") and not v18:IsA("Sound")) then
                v18:Destroy();
            end;
        end;
        return v16;
    end, {
        v12.Cell.Avatar
    });
    return v2.createElement(l_Button_0, {
        AutomaticSize = Enum.AutomaticSize.XY,
        Position = v12.Position,
        OnClick = function()
            v13:Set({
                v12.Cell.Avatar
            });
        end,
        Size = v12.Size
    }, {
        v2.createElement(l_Pane_0, {
            Layout = Enum.FillDirection.Vertical,
            Padding = l_Avatar_0.InnerPadding,
            Spacing = l_Avatar_0.Padding
        }, {
            Preview = v2.createElement(l_AssetRenderModel_0, {
                FocusDirection = v19.PrimaryPart.CFrame.LookVector,
                Model = v19,
                Static = true,
                Ambient = l_Avatar_0.PreviewAmbient,
                LayoutOrder = v15:getNextOrder(),
                LightColor = Color3.new(1, 1, 1),
                LightDirection = -v19.PrimaryPart.CFrame.LookVector,
                Size = UDim2.fromOffset(l_Avatar_0.IconSize, l_Avatar_0.IconSize)
            }),
            Name = v2.createElement(l_TextLabel_0, {
                LayoutOrder = v15:getNextOrder(),
                Size = UDim2.new(1, 0, 0, l_Avatar_0.NameFontSize * l_Avatar_0.NameLines),
                Text = v12.Cell.Avatar.Name,
                TextColor = l_Avatar_0.TitleColor,
                TextSize = l_Avatar_0.NameFontSize,
                TextTruncate = Enum.TextTruncate.AtEnd,
                TextXAlignment = Enum.TextXAlignment.Left,
                TextYAlignment = Enum.TextYAlignment.Top,
                TextWrapped = true
            })
        })
    });
end;