local l_Parent_0 = script.Parent.Parent;
local v1 = require(l_Parent_0.flags.getEngineFeatureEngineUGCValidateTransparency);
local v2 = require(l_Parent_0.flags.getFFlagUGCValidationValidateTransparencyClient);
local v3 = require(l_Parent_0.flags.getFFlagUGCValidationValidateTransparencyServer);
local v4 = require(l_Parent_0.flags.getEngineFeatureViewportFrameSnapshotEngineFeature);
local v5 = require(l_Parent_0.flags.getFFlagUseThumbnailerUtil);
local v6 = game:DefineFastInt("UGCValidationHeadThreshold", 30);
local v7 = game:DefineFastInt("UGCValidationTorsoThresholdFront", 50);
local v8 = game:DefineFastInt("UGCValidationTorsoThresholdBack", 48);
local v9 = game:DefineFastInt("UGCValidationTorsoThresholdSide", 46);
local v10 = game:DefineFastInt("UGCValidationLeftArmThresholdFront", 35);
local v11 = game:DefineFastInt("UGCValidationLeftArmThresholdBack", 33);
local v12 = game:DefineFastInt("UGCValidationLeftArmThresholdSide", 50);
local v13 = game:DefineFastInt("UGCValidationRightArmThresholdFront", 35);
local v14 = game:DefineFastInt("UGCValidationRightArmThresholdBack", 33);
local v15 = game:DefineFastInt("UGCValidationRightArmThresholdSide", 50);
local v16 = game:DefineFastInt("UGCValidationLeftLegThresholdFront", 50);
local v17 = game:DefineFastInt("UGCValidationLeftLegThresholdBack", 50);
local v18 = game:DefineFastInt("UGCValidationLeftLegThresholdSide", 46);
local v19 = game:DefineFastInt("UGCValidationRightLegThresholdFront", 50);
local v20 = game:DefineFastInt("UGCValidationRightLegThresholdBack", 50);
local v21 = game:DefineFastInt("UGCValidationRightLegThresholdSide", 48);
local l_UGCValidationService_0 = game:GetService("UGCValidationService");
local _ = require(l_Parent_0.util.Types);
local v24 = require(l_Parent_0.util.AssetTraversalUtils);
local v25 = require(l_Parent_0.ConstantsInterface);
local v26 = require(l_Parent_0.util.Thumbnailer);
local v27 = require(l_Parent_0.util.setupTransparentPartSize);
local v28 = {
    Vector3.new(0, 0, -1),
    Vector3.new(0, 0, 1),
    (Vector3.new(1, 0, 0))
};
local v29 = Color3.fromRGB(0, 0, 0);
local v30 = Color3.fromRGB(7, 32, 91);
local v31 = {
    [Enum.AssetType.DynamicHead] = {
        [v28[1]] = v6 / 100,
        [v28[2]] = v6 / 100,
        [v28[3]] = v6 / 100
    },
    [Enum.AssetType.Torso] = {
        [v28[1]] = v7 / 100,
        [v28[2]] = v8 / 100,
        [v28[3]] = v9 / 100
    },
    [Enum.AssetType.LeftArm] = {
        [v28[1]] = v10 / 100,
        [v28[2]] = v11 / 100,
        [v28[3]] = v12 / 100
    },
    [Enum.AssetType.RightArm] = {
        [v28[1]] = v13 / 100,
        [v28[2]] = v14 / 100,
        [v28[3]] = v15 / 100
    },
    [Enum.AssetType.LeftLeg] = {
        [v28[1]] = v16 / 100,
        [v28[2]] = v17 / 100,
        [v28[3]] = v18 / 100
    },
    [Enum.AssetType.RightLeg] = {
        [v28[1]] = v19 / 100,
        [v28[2]] = v20 / 100,
        [v28[3]] = v21 / 100
    }
};
local function v35()
    local v32 = Instance.new("ScreenGui", game:GetService("CoreGui"));
    local v33 = Instance.new("ViewportFrame", v32);
    v33.BackgroundTransparency = 1;
    v33.BorderSizePixel = 0;
    v33.BackgroundColor3 = v29;
    local v34 = Instance.new("WorldModel", v33);
    v33.Size = UDim2.fromOffset(100, 100);
    return v32, v34, v33;
end;
local function v43(v36, v37)
    local v38 = nil;
    local v39 = nil;
    v38 = v36.CFrame.Position;
    v39 = v36.Size;
    if v38 then
        local v40 = Vector3.new(1, 1, 1) - Vector3.new(math.abs(v37.X), math.abs(v37.Y), (math.abs(v37.Z)));
        local l_Camera_0 = Instance.new("Camera");
        local v42 = v39 * v40;
        l_Camera_0.CFrame = CFrame.lookAt((v38 + v37 * ((math.max(v42.X, v42.Y, v42.Z) / 1.9) / 0.7002075382097097)) + (v37 * v39) / 2, v38);
        l_Camera_0.FieldOfView = 70;
        return l_Camera_0;
    else
        return nil;
    end;
end;
local function v52(v44, v45)
    local v46, _ = game:GetService("ThumbnailGenerator"):Click("Png", 100, 100, true);
    if v46 then
        local l_status_0, l_result_0 = pcall(function()
            return l_UGCValidationService_0:ValidateImageTransparencyThresholdByteString(v46, v31[v44][v45]);
        end);
        if l_status_0 then
            if l_result_0 then
                return true;
            else
                return false, {
                    (string.format("%s is too transparent. Please fill in more of the mesh.", v44.Name))
                };
            end;
        else
            local v50 = string.format("Failed to read data from snapshot of (%s)", v44.Name);
            error(v50);
            return false, {
                v50
            };
        end;
    else
        local v51 = string.format("Unable to capture snapshot of %s", v44.Name);
        error(v51);
        return false, {
            v51
        };
    end;
end;
local function v60(v53, v54, v55)
    local l_status_1, l_result_1 = pcall(function()
        task.wait(1);
        return v55:CaptureSnapshotAsync();
    end);
    if l_status_1 then
        local l_status_2, l_result_2 = pcall(function()
            return l_UGCValidationService_0:ValidateImageTransparencyThresholdTextureID(l_result_1, v31[v53][v54]);
        end);
        if l_status_2 then
            if l_result_2 then
                return true;
            else
                return false, {
                    (string.format("%s is too transparent. Please fill in more of the mesh.", v53.Name))
                };
            end;
        else
            return false, {
                (string.format("Failed to read data from snapshot of (%s)", v53.Name))
            };
        end;
    else
        return false, {
            string.format("Unable to capture snapshot of %s", v53.Name)
        };
    end;
end;
local function v95(v61, v62, v63)
    if (not v61 or not v62) or v63 == nil then
        return true;
    elseif v1() then
        if not v63 or v3() then
            if v63 or v2() and v4() then
                local v64 = v61:Clone();
                local v65 = nil;
                local v66 = nil;
                local v67 = nil;
                if not v63 then
                    local v68, v69, v70 = v35();
                    v65 = v68;
                    v66 = v69;
                    v67 = v70;
                end;
                local v71 = {};
                local l_MeshPart_0 = Instance.new("MeshPart");
                l_MeshPart_0.Parent = not not v63 and workspace or v66;
                l_MeshPart_0.CanCollide = false;
                l_MeshPart_0.Transparency = 0.5;
                l_MeshPart_0.Color = v30;
                if Enum.AssetType.DynamicHead == v62 then
                    v24.calculateBounds(v62, v64, CFrame.new(), v71);
                    v64.Parent = if not v63 then v66 else workspace;
                    l_MeshPart_0.Parent = if not v63 then v66 else workspace;
                    l_MeshPart_0.Position = v64.Position;
                    l_MeshPart_0.Size = v64.Size;
                else
                    local v73 = v24.assetHierarchy[v62];
                    v24.traverseHierarchy(nil, v64, v62, nil, CFrame.new(), v73.root, v73, v71);
                    local function v74(v75, v76, v77, v78, v79)
                        local l_v75_FirstChild_0 = v75:FindFirstChild(v78);
                        local l_v77_0 = v77;
                        if v76 then
                            local l_v75_FirstChild_1 = v75:FindFirstChild(v76);
                            local v83 = v25.getRigAttachmentToParent(v62, v78);
                            l_v77_0 = (l_v77_0 * l_v75_FirstChild_1:FindFirstChild(v83).CFrame) * l_v75_FirstChild_0:FindFirstChild(v83).CFrame:Inverse();
                        end;
                        l_v75_FirstChild_0.CFrame = l_v77_0;
                        if v79.children then
                            for v84, v85 in v79.children, nil, nil do
                                v74(v75, v78, l_v77_0, v84, v85);
                            end;
                        end;
                    end;
                    v64.Parent = if not v63 then v66 else workspace;
                    v74(v64, nil, CFrame.new(), v73.root, v73);
                    local v86 = Vector3.new();
                    local v87 = Vector3.new();
                    v86 = if not v71.maxOverall then Vector3.new() else v71.maxOverall;
                    v87 = if not v71.minOverall then Vector3.new() else v71.minOverall;
                    if not (v71.minOverall ~= nil) or v71.maxOverall == nil then
                        return false, {
                            "Errored out trying to determine size of asset"
                        };
                    else
                        l_MeshPart_0.Size = Vector3.new(v86.X - v87.X, v86.Y - v87.Y, v86.Z - v87.Z);
                        l_MeshPart_0.Position = Vector3.new(v87.X + l_MeshPart_0.Size.X / 2, v87.Y + l_MeshPart_0.Size.Y / 2, v87.Z + l_MeshPart_0.Size.Z / 2);
                    end;
                end;
                for _, v89 in v28, nil, nil do
                    local v90 = v43(l_MeshPart_0, v89);
                    if v90 then
                        if not v63 then
                            v90.Parent = v67;
                            v67.CurrentCamera = v90;
                        else
                            v90.Name = "ThumbnailCamera";
                            v90.Parent = workspace:GetChildren()[1];
                        end;
                        if not v63 then
                            local v91, v92 = v60(v62, v89, v67);
                            if not v91 then
                                v65:Destroy();
                                v64:Destroy();
                                l_MeshPart_0:Destroy();
                                return false, v92;
                            end;
                        else
                            local v93, v94 = v52(v62, v89);
                            if not v93 then
                                v64:Destroy();
                                l_MeshPart_0:Destroy();
                                return false, v94;
                            end;
                        end;
                        v90:Destroy();
                    else
                        if not v63 then
                            v65:Destroy();
                        end;
                        v64:Destroy();
                        l_MeshPart_0:Destroy();
                        return false, {
                            string.format("Unable to setup camera for Part (%s)", v62.Name)
                        };
                    end;
                end;
                if not v63 then
                    v65:Destroy();
                end;
                v64:Destroy();
                l_MeshPart_0:Destroy();
                return true;
            else
                return true;
            end;
        else
            return true;
        end;
    else
        return true;
    end;
end;
return function(v96, v97, v98)
    if v5() then
        if v96 then
            if v1() then
                local v99 = not not v98 or false;
                if not v99 or v3() then
                    if v99 or v2() and v4() then
                        local v100 = v96:Clone();
                        local l_MeshPart_1 = Instance.new("MeshPart");
                        l_MeshPart_1.CanCollide = false;
                        l_MeshPart_1.Transparency = 0.5;
                        l_MeshPart_1.Color = v30;
                        if v27(l_MeshPart_1, v100, v97) then
                            local l_Folder_0 = Instance.new("Folder");
                            l_MeshPart_1.Parent = l_Folder_0;
                            v100.Parent = l_Folder_0;
                            local v103 = v26.new(v99, 70, Vector2.new(100, 100));
                            v103:init(l_MeshPart_1);
                            for _, v105 in v28, nil, nil do
                                local v106 = l_MeshPart_1.Size * (Vector3.new(1, 1, 1) - Vector3.new(math.abs(v105.X), math.abs(v105.Y), (math.abs(v105.Z))));
                                v103:setCamera(0.95, math.max(v106.X, v106.Y, v106.Z), v105);
                                local v107, v108 = v103:takeSnapshot();
                                if not v107 then
                                    v103:cleanup();
                                    local v109 = string.format("Unable to capture snapshot of %s", v97.Name);
                                    if not v99 then
                                        return false, {
                                            v109
                                        };
                                    else
                                        error(v109);
                                    end;
                                end;
                                local v110 = nil;
                                local v111 = nil;
                                if not v99 then
                                    local l_status_3, l_result_3 = pcall(function()
                                        return l_UGCValidationService_0:ValidateImageTransparencyThresholdTextureID(v108, v31[v97][v105]);
                                    end);
                                    v110 = l_status_3;
                                    v111 = l_result_3;
                                else
                                    local l_status_4, l_result_4 = pcall(function()
                                        return l_UGCValidationService_0:ValidateImageTransparencyThresholdByteString(v108, v31[v97][v105]);
                                    end);
                                    v110 = l_status_4;
                                    v111 = l_result_4;
                                end;
                                if not v110 then
                                    v103:cleanup();
                                    local v116 = string.format("Failed to read data from snapshot of (%s)", v97.Name);
                                    if not v99 then
                                        return false, {
                                            v116
                                        };
                                    else
                                        error(v116);
                                    end;
                                end;
                                if not v111 then
                                    v103:cleanup();
                                    return false, {
                                        string.format("%s is too transparent. Please fill in more of the mesh.", v97.Name)
                                    };
                                end;
                            end;
                            v103:cleanup();
                            return true;
                        else
                            return false, {
                                "Error getting part sizes "
                            };
                        end;
                    else
                        return true;
                    end;
                else
                    return true;
                end;
            else
                return true;
            end;
        else
            return true;
        end;
    else
        return v95(v96, v97, v98);
    end;
end;


local l_Parent_0 = script.Parent.Parent;
local v1 = require(l_Parent_0.Analytics);
local v2 = require(l_Parent_0.Constants);
local v3 = require(l_Parent_0.flags.getFFlagUseUGCValidationContext);
local function v7(v4)
    for v5, v6 in v4, nil, nil do
        if v5 ~= v2.GUIDAttributeName then
            return false;
        elseif typeof(v6) ~= "string" then
            return false;
        elseif v2.GUIDAttributeMaxLength < string.len(v6) then
            return false;
        end;
    end;
    return true;
end;
return function(v8)
    local v9 = {};
    if not v7(v8:GetAttributes()) then
        table.insert(v9, v8:GetFullName());
    end;
    for _, v11 in ipairs(v8:GetDescendants()) do
        if next(v11:GetAttributes()) ~= nil then
            table.insert(v9, v11:GetFullName());
        end;
    end;
    if #v9 > 0 then
        local v12 = {};
        if not v3() then
            table.insert(v12, "The following instances contained attributes:");
        else
            table.insert(v12, string.format("'%s' contains attributes in its properties that are not allowed. You need to remove the following attributes: ", v8.Name));
        end;
        for _, v14 in pairs(v9) do
            table.insert(v12, v14);
        end;
        v1.reportFailure(v1.ErrorType.validateAttributes);
        return false, v12;
    else
        return true;
    end;
end;


local l_Parent_0 = script.Parent.Parent;
local _ = require(l_Parent_0.util.Types);
local v2 = require(l_Parent_0.Analytics);
local v3 = require(l_Parent_0.Constants);
local v4 = require(l_Parent_0.util.FailureReasonsAccumulator);
local v5 = require(l_Parent_0.util.prettyPrintVector3);
local v6 = require(l_Parent_0.util.floatEquals);
local v7 = require(l_Parent_0.flags.getFFlagUseUGCValidationContext);
local v8 = require(l_Parent_0.flags.getFFlagCheckOrientationOnAllAttachments);
local function v18(v9, v10, v11)
    local v12 = v10.Size / 2;
    local v13 = v9.CFrame.Position / v12;
    local l_min_0 = v11.min;
    local l_max_0 = v11.max;
    for _, v17 in {
        "X",
        "Y",
        "Z"
    }, nil, nil do
        if not (v13[v17] >= l_min_0[v17]) or l_max_0[v17] < v13[v17] then
            v2.reportFailure(v2.ErrorType.validateBodyPartChildAttachmentBounds_InvalidAttachmentPosition);
            if not v7() then
                return false, {
                    string.format("Attachment (%s) in %s, is at [%s] but must be within [%s] to [%s]", v9.Name, v10.Name, v5(v9.CFrame.Position), v5(l_min_0 * v12), v5(l_max_0 * v12))
                };
            else
                return false, {
                    string.format("Attachment (%s) in %s is placed at a position [%s] that is outside the valid range of ([%s] to [%s]). You need to adjust the attachment position.", v9.Name, v10.Name, v5(v9.CFrame.Position), v5(l_min_0 * v12), v5(l_max_0 * v12))
                };
            end;
        end;
    end;
    return true;
end;
local function v27(v19, _, v21)
    local v22 = v4.new();
    local l_v19_FirstChild_0 = v19:FindFirstChild(v21.rigAttachmentToParent.name);
    assert(l_v19_FirstChild_0);
    v22:updateReasons(v18(l_v19_FirstChild_0, v19, v21.rigAttachmentToParent.bounds));
    for v24, v25 in pairs(v21.otherAttachments) do
        local l_v19_FirstChild_1 = v19:FindFirstChild(v24);
        assert(l_v19_FirstChild_1);
        v22:updateReasons(v18(l_v19_FirstChild_1, v19, v25.bounds));
    end;
    return v22:getFinalResults();
end;
local function v36(v28)
    local v29 = v4.new();
    for _, v31 in v28:GetDescendants() do
        if not v8() then
            local v32 = false;
            if v31.ClassName == "Attachment" then
                v32 = string.find(v31.Name, "RigAttachment");
            end;
            if not v32 then
                continue;
            end;
        elseif not (v31.ClassName == "Attachment") then
            continue;
        end;
        local v33, v34, v35 = v31.CFrame:ToOrientation();
        if not (not (not v6(v33, 0) or not v6(v34, 0)) and v6(v35, 0)) then
            v2.reportFailure(v2.ErrorType.validateBodyPartChildAttachmentBounds_AttachmentRotated);
            if not v7() then
                v29:updateReasons(false, {
                    (("Attachment %*.%* should not be rotatedformat(v31.Parent.Name, v31.Name))
                });
            else
                v29:updateReasons(false, {
                    string.format("Detected rotation in Attachment '%s'. You must reset all rotation values for this attachment to zero.", v31:GetFullName())
                });
            end;
        end;
    end;
    return v29:getFinalResults();
end;
local function v46(v37, v38)
    local l_assetTypeEnum_0 = v38.assetTypeEnum;
    local l_isServer_0 = v38.isServer;
    local v41 = v3.ASSET_TYPE_INFO[l_assetTypeEnum_0];
    assert(v41);
    local v42 = v4.new();
    v42:updateReasons(v36(v37));
    if Enum.AssetType.DynamicHead == l_assetTypeEnum_0 then
        v42:updateReasons(v27(v37, l_isServer_0, v41.subParts.Head));
    else
        for v43, v44 in pairs(v41.subParts) do
            local l_v37_FirstChild_0 = v37:FindFirstChild(v43);
            assert(l_v37_FirstChild_0);
            v42:updateReasons(v27(l_v37_FirstChild_0, l_isServer_0, v44));
        end;
    end;
    return v42:getFinalResults();
end;
local function v55(v47, v48, v49)
    local v50 = v3.ASSET_TYPE_INFO[v48];
    assert(v50);
    local v51 = v4.new();
    v51:updateReasons(v36(v47));
    if Enum.AssetType.DynamicHead == v48 then
        v51:updateReasons(v27(v47, v49, v50.subParts.Head));
    else
        for v52, v53 in pairs(v50.subParts) do
            local l_v47_FirstChild_0 = v47:FindFirstChild(v52);
            assert(l_v47_FirstChild_0);
            v51:updateReasons(v27(l_v47_FirstChild_0, v49, v53));
        end;
    end;
    return v51:getFinalResults();
end;
if not v7() then
    return v55;
else
    return v46;
end;


local v0 = require(script.Parent.Parent.Analytics);
local v1 = game:DefineFastString("UGCValidationBodyPartCollisionFidelity", "Default");
return function(v2)
    local l_v2_Descendants_0 = v2:GetDescendants();
    table.insert(l_v2_Descendants_0, 1, v2);
    local l_Default_0 = Enum.CollisionFidelity.Default;
    pcall(function()
        l_Default_0 = Enum.CollisionFidelity[v1];
    end);
    local v5 = {};
    for _, v7 in l_v2_Descendants_0, nil, nil do
        if v7:IsA("MeshPart") and v7.CollisionFidelity ~= l_Default_0 then
            table.insert(v5, (("Expected %*.CollisionFidelity to be %*"):format(v7:GetFullName(), l_Default_0.Name)));
        end;
    end;
    if #v5 == 0 then
        return true;
    else
        v0.reportFailure(v0.ErrorType.validateBodyPartCollisionFidelity);
        return false, v5;
    end;
end;


local l_Parent_0 = script.Parent.Parent;
local _ = require(l_Parent_0.util.Types);
local v2 = require(l_Parent_0.util.pcallDeferred);
local v3 = require(l_Parent_0.flags.getFFlagUGCValidationShouldYield);
local v4 = require(l_Parent_0.Analytics);
local v5 = require(l_Parent_0.Constants);
local v6 = require(l_Parent_0.validation.validateMeshComparison);
local v7 = require(l_Parent_0.util.getMeshSize);
local v8 = require(l_Parent_0.util.getEditableMeshFromContext);
local v9 = require(l_Parent_0.util.FailureReasonsAccumulator);
local v10 = require(l_Parent_0.flags.getFFlagUseUGCValidationContext);
local v11 = require(l_Parent_0.flags.getEngineFeatureUGCValidateEditableMeshAndImage);
local function v21(v12, v13, v14, v15, v16, v17)
    local v18 = {
        fullName = v12:GetFullName(),
        contentId = v14,
        fieldName = v13,
        context = v16,
        scale = v15
    };
    if v11() then
        local v19, v20 = v8(v12, v13, v17);
        if v19 then
            v18.editableMesh = v20;
        else
            return false, v18;
        end;
    end;
    return true, v18;
end;
local function v25(v22, v23, v24)
    if not v22:IsA("WrapTarget") then
        if not v22:IsA("MeshPart") then
            return false;
        else
            return v21(v22, "MeshId", v22.MeshId, v23, v22.Name, v24);
        end;
    else
        return v21(v22, "CageMeshId", v22.CageMeshId, v23, v22.ClassName, v24);
    end;
end;
local function _(v26)
    if not v26:IsA("WrapTarget") then
        if not v26:IsA("MeshPart") then
            return nil;
        else
            return v26.MeshId;
        end;
    else
        return v26.CageMeshId;
    end;
end;
local function v36(v28, v29, v30)
    local v31, v32 = v25(v29, v28, v30);
    if v31 then
        local l_WrapTarget_0 = v29:FindFirstChildWhichIsA("WrapTarget");
        assert(l_WrapTarget_0, "Missing WrapTarget child for " .. v29.Name);
        local v34, v35 = v25(l_WrapTarget_0, v28, v30);
        if v34 then
            return v6(v32, v35, v5.RenderVsWrapMeshMaxDiff, v30);
        else
            return false, {
                "Failed to load mesh data"
            };
        end;
    else
        return false, {
            "Failed to load mesh data"
        };
    end;
end;
local function v42(v37, v38, v39)
    local v40 = if not v38:IsA("WrapTarget") then if v38:IsA("MeshPart") then v38.MeshId else nil else v38.CageMeshId;
    assert(v40);
    local l_WrapTarget_1 = v38:FindFirstChildWhichIsA("WrapTarget");
    assert(l_WrapTarget_1, "Missing WrapTarget child for " .. v38.Name);
    return v6({
        id = v40,
        scale = v37,
        context = v38.Name
    }, {
        id = if not l_WrapTarget_1:IsA("WrapTarget") then if l_WrapTarget_1:IsA("MeshPart") then l_WrapTarget_1.MeshId else nil else l_WrapTarget_1.CageMeshId,
        scale = v37,
        context = l_WrapTarget_1.ClassName
    }, v5.RenderVsWrapMeshMaxDiff, v39);
end;
local function v54(v43, v44)
    local v45 = {
        fullName = v43:GetFullName(),
        fieldName = "MeshId",
        contentId = v43.MeshId,
        context = v43.Name
    };
    if v11() then
        local v46, v47 = v8(v43, "MeshId", v44);
        if v46 then
            v45.editableMesh = v47;
        else
            return false, {
                string.format("Mesh for '%s' failed to load. Make sure the mesh exists and try again.", v45.fullName)
            };
        end;
    end;
    local v48 = nil;
    local v49 = nil;
    if not v3() then
        local l_status_0, l_result_0 = pcall(v7, v45);
        v48 = l_status_0;
        v49 = l_result_0;
    else
        local v52, v53 = v2(function()
            return v7(v45);
        end, v44);
        v48 = v52;
        v49 = v53;
    end;
    if v48 then
        return true, nil, v49;
    else
        v4.reportFailure(v4.ErrorType.validateBodyPartMeshBounds_FailedToLoadMesh);
        if v44.isServer then
            error("Failed to read mesh");
        end;
        return false, {
            "Failed to read mesh"
        };
    end;
end;
local function v59(v55, v56)
    local l_status_1, l_result_1 = pcall(v7, v55.MeshId);
    if l_status_1 then
        return true, nil, l_result_1;
    else
        v4.reportFailure(v4.ErrorType.validateBodyPartMeshBounds_FailedToLoadMesh);
        if v56 then
            error("Failed to read mesh");
        end;
        return false, {
            "Failed to read mesh"
        };
    end;
end;
local function v67(v60, v61)
    local v62, v63, v64 = v54(v60, v61);
    if v62 and v64 then
        local v65 = v60.Size / v64;
        local v66 = v9.new();
        v66:updateReasons(v36(v65, v60, v61));
        return v66:getFinalResults();
    else
        return v62, v63;
    end;
end;
local function v76(v68, _, v70)
    local v71, v72, v73 = v59(v68, v70);
    if v71 and v73 then
        local v74 = v68.Size / v73;
        local v75 = v9.new();
        v75:updateReasons(v42(v74, v68, v70));
        return v75:getFinalResults();
    else
        return v71, v72;
    end;
end;
local function v84(v77, v78)
    local l_assetTypeEnum_0 = v78.assetTypeEnum;
    local v80 = v5.ASSET_TYPE_INFO[l_assetTypeEnum_0];
    if Enum.AssetType.DynamicHead == l_assetTypeEnum_0 then
        return v67(v77, v78);
    else
        local v81 = v9.new();
        for v82 in pairs(v80.subParts) do
            local l_v77_FirstChild_0 = v77:FindFirstChild(v82);
            assert(l_v77_FirstChild_0);
            v81:updateReasons(v67(l_v77_FirstChild_0, v78));
        end;
        return v81:getFinalResults();
    end;
end;
local function v93(v85, v86, v87)
    local v88 = v5.ASSET_TYPE_INFO[v86];
    if Enum.AssetType.DynamicHead == v86 then
        return v76(v85, v88.subParts.Head, v87);
    else
        local v89 = v9.new();
        for v90, v91 in pairs(v88.subParts) do
            local l_v85_FirstChild_0 = v85:FindFirstChild(v90);
            assert(l_v85_FirstChild_0);
            v89:updateReasons(v76(l_v85_FirstChild_0, v91, v87));
        end;
        return v89:getFinalResults();
    end;
end;
if not v10() then
    return v93;
else
    return v84;
end;


local l_Parent_0 = script.Parent.Parent;
local v1 = require(l_Parent_0.flags.getFFlagUseUGCValidationContext);
local v2 = require(l_Parent_0.flags.getFFlagUGCValidateFullBody);
local v3 = require(l_Parent_0.flags.getFFlagUGCValidateFixAccessories);
local v4 = require(l_Parent_0.flags.getFFlagUGCValidateHandleRestrictedUserIds);
local v5 = require(l_Parent_0.flags.getEngineFeatureUGCValidateEditableMeshAndImage);
local v6 = require(l_Parent_0.Parent.Promise);
local v7 = require(l_Parent_0.ConstantsInterface);
local _ = require(l_Parent_0.util.BundlesMetadata);
local _ = require(l_Parent_0.util.Types);
local v10 = require(l_Parent_0.util.getRestrictedUserTable);
local v11 = require(l_Parent_0.util.createEditableInstancesForContext);
local v12 = require(l_Parent_0.util.destroyEditableInstances);
local v13 = require(l_Parent_0.util.createUGCBodyPartFolders);
local v14 = require(l_Parent_0.util.fixUpPreValidation);
local v15 = require(l_Parent_0.validation.validateInternal);
local v16 = require(l_Parent_0.validation.validateFullBody);
local v17 = {
    Enum.AssetType.DynamicHead,
    Enum.AssetType.Torso,
    Enum.AssetType.LeftArm,
    Enum.AssetType.RightArm,
    Enum.AssetType.LeftLeg,
    Enum.AssetType.RightLeg,
    Enum.AssetType.HairAccessory,
    Enum.AssetType.EyebrowAccessory,
    Enum.AssetType.EyelashAccessory
};
local function v21(v18)
    v18 = v18:Clone();
    for _, v20 in v18:GetDescendants() do
        if not (not v20:IsA("Motor6D") and v20.Name ~= "OriginalSize") or v20.Name == "OriginalPosition" then
            v20:Destroy();
        elseif v20:IsA("Weld") and v20.Name == "AccessoryWeld" then
            v20:Destroy();
        elseif not (not (not (not v20:IsA("MeshPart") or v20.Parent:IsA("Accessory")) and v20.TextureID == "") or v20:FindFirstChildWhichIsA("SurfaceAppearance")) then
            Instance.new("SurfaceAppearance").Parent = v20;
        end;
    end;
    return v18;
end;
return function(v22, v23, v24, v25, v26, v27)
    v25 = v25 or function()
    end;
    assert(v25 ~= nil, "Luau");
    if v22:IsA("Model") then
        local v28 = v13(if not v3() then v21(v22) else v14(v22), v23, v24, false);
        local v29 = {};
        local v30 = {};
        for v31, v32 in v23[v24].allowedAssetTypeSettings, nil, nil do
            local v33 = assert(Enum.AssetType[v31], "Asset type name doesn't map to an enum item");
            if v32.isEligibleForUpload then
                local v34 = true;
                if v32.minimumQuantity ~= 0 then
                    v34 = v32.minimumQuantity == 1;
                end;
                assert(v34, "Invalid minimum quantity, createUGCBodyParts folder is a dictionary and will only ever give one.");
                v34 = true;
                if v32.maximumQuantity ~= 0 then
                    v34 = v32.maximumQuantity == 1;
                end;
                assert(v34, "Invalid maximum quantity, createUGCBodyParts folder is a dictionary and will only ever give one.");
                local v35 = v28[v33];
                v34 = v35 and v35[1];
                if not (v32.minimumQuantity == 0) or v34 ~= nil then
                    table.insert(v30, {
                        assetType = v33,
                        instance = v34,
                        settings = v32,
                        status = v34 == nil and "finished" or "pending"
                    });
                    if v34 == nil then
                        table.insert(v29, {
                            assetType = v33,
                            error = {
                                type = "notFound"
                            }
                        });
                    end;
                end;
            end;
        end;
        table.sort(v30, function(v36, v37)
            return (table.find(v17, v36.assetType) or math.huge) < (table.find(v17, v37.assetType) or math.huge);
        end);
        local v38 = {
            errors = v29,
            pieces = v30
        };
        v25(v38);
        return v6.each(v30, function(v39, v40)
            if v39.status == "finished" then
                return ;
            else
                assert(v39.instance ~= nil, "Unfinished piece doesn't have an instnace");
                local v41 = nil;
                local v42 = nil;
                if not v1() then
                    local v43, v44 = v15(false, {
                        v39.instance
                    }, v39.assetType, false, false, if not v4() then {} else v10(), nil);
                    v41 = v43;
                    v42 = v44;
                else
                    local v45 = {
                        v39.instance
                    };
                    local v46 = {
                        instances = v45,
                        assetTypeEnum = v39.assetType,
                        allowUnreviewedAssets = false,
                        restrictedUserIds = if not v4() then {} else v10(),
                        isServer = false,
                        isAsync = false,
                        allowEditableInstances = v26,
                        bypassFlags = v27
                    };
                    if not v5() then
                        local v47, v48 = v15(v46);
                        v41 = v47;
                        v42 = v48;
                    else
                        local v49, v50 = v11(v45, v26);
                        if v49 then
                            v46.editableMeshes = v50.editableMeshes;
                            v46.editableImages = v50.editableImages;
                            local v51, v52 = v15(v46);
                            v41 = v51;
                            v42 = v52;
                            v12(v46.editableMeshes, v46.editableImages);
                        else
                            v42 = v50;
                            v41 = false;
                        end;
                    end;
                end;
                v38 = table.clone(v38);
                v38.errors = table.clone(v38.errors);
                if not v41 then
                    assert(v42 ~= nil, "Failure without errors");
                    for _, v54 in v42, nil, nil do
                        table.insert(v38.errors, {
                            assetType = v39.assetType,
                            error = {
                                type = "message",
                                message = v54
                            }
                        });
                    end;
                end;
                v38.pieces = table.clone(v38.pieces);
                v38.pieces[v40].status = "finished";
                v25(v38);
                return ;
            end;
        end):andThen(function()
            if v2() and v24 == "Body" then
                local function v59(v55)
                    local v56 = {};
                    for _, v58 in v55, nil, nil do
                        if v7.isBodyPart(v58.assetType) then
                            table.insert(v56, {
                                assetTypeEnum = v58.assetType,
                                allSelectedInstances = if not v58.instance then {} else {
                                    v58.instance
                                }
                            });
                        end;
                    end;
                    return v56;
                end;
                local v60 = nil;
                local v61 = nil;
                local v62 = v59(v38.pieces);
                if not v1() then
                    local v63, v64 = v16(v62, false);
                    v60 = v63;
                    v61 = v64;
                else
                    local v65 = {
                        fullBodyData = v62,
                        isServer = false,
                        allowEditableInstances = v26,
                        bypassFlags = v27
                    };
                    if not v5() then
                        local v66, v67 = v16(v65);
                        v60 = v66;
                        v61 = v67;
                    else
                        local v68 = {};
                        for _, v70 in v62, nil, nil do
                            for _, v72 in v70.allSelectedInstances, nil, nil do
                                table.insert(v68, v72);
                            end;
                        end;
                        local v73, v74 = v11(v68, v26);
                        if v73 then
                            v65.editableMeshes = v74.editableMeshes;
                            v65.editableImages = v74.editableImages;
                            local v75, v76 = v16(v65);
                            v60 = v75;
                            v61 = v76;
                            v12(v65.editableMeshes, v65.editableImages);
                        else
                            v61 = v74;
                            v60 = false;
                        end;
                    end;
                end;
                if not v60 then
                    v38 = table.clone(v38);
                    v38.errors = table.clone(v38.errors);
                    assert(v61 and #v61 > 0, "There should always be a reason for failure");
                    for _, v78 in v61, nil, nil do
                        table.insert(v38.errors, {
                            assetType = nil,
                            error = {
                                type = "message",
                                message = v78
                            }
                        });
                    end;
                end;
                v25(v38);
            end;
        end):andThen(function()
            return v38;
        end);
    else
        return v6.resolve({
            errors = {
                {
                    assetType = nil,
                    error = {
                        type = "message",
                        message = "Invalid root instance, must be a model"
                    }
                }
            },
            pieces = {}
        });
    end;
end;


local l_UGCValidationService_0 = game:GetService("UGCValidationService");
local l_Parent_0 = script.Parent.Parent;
local _ = require(l_Parent_0.util.Types);
local v3 = require(l_Parent_0.Analytics);
local v4 = require(l_Parent_0.flags.getFFlagUseUGCValidationContext);
local v5 = require(l_Parent_0.flags.getEngineFeatureUGCValidateEditableMeshAndImage);
local function v18(v6)
    local v7 = nil;
    local v8 = nil;
    local v9 = nil;
    if not v5() then
        local v10, v11, v12 = pcall(function()
            return l_UGCValidationService_0:ValidateCageNonManifoldAndHoles(v6.contentId);
        end);
        v7 = v10;
        v8 = v11;
        v9 = v12;
    else
        local v13, v14, v15 = pcall(function()
            return l_UGCValidationService_0:ValidateEditableMeshCageNonManifoldAndHoles(v6.editableMesh);
        end);
        v7 = v13;
        v8 = v14;
        v9 = v15;
    end;
    if v7 then
        local v16 = {};
        local v17 = true;
        if not v8 then
            v17 = false;
            v3.reportFailure(v3.ErrorType.validateCageNonManifoldAndHoles_NonManifold);
            table.insert(v16, string.format("'%s' is non-manifold (i.e. there are edges with 3 or more incident faces). Some vertices are likely too close and welded together as a single vertex causing edges to collapse into a non-manifold. You need to edit the cage mesh so that vertices aren't too close together.", v6.fullName));
        end;
        if not v9 then
            v17 = false;
            v3.reportFailure(v3.ErrorType.validateCageNonManifoldAndHoles_CageHoles);
            table.insert(v16, string.format("'%s' is not watertight (i.e. detected holes in the mesh). You need to edit the mesh and close the holes (may leave eyes and mouth areas open when applicable).", v6.fullName));
        end;
        return v17, v16;
    else
        v3.reportFailure(v3.ErrorType.validateCageNonManifoldAndHoles_FailedToExecute);
        return false, {
            string.format("Failed to execute cage non-manifold check for '%s'. Make sure cage mesh exists and try again.", v6.fullName)
        };
    end;
end;
local function v26(v19, v20)
    local v21, v22, v23 = pcall(function()
        return l_UGCValidationService_0:ValidateCageNonManifoldAndHoles(v19);
    end);
    if v21 then
        local v24 = {};
        local v25 = true;
        if not v22 then
            v25 = false;
            v3.reportFailure(v3.ErrorType.validateCageNonManifoldAndHoles_NonManifold);
            table.insert(v24, string.format("%s has non-manifold geometry, which can cause deformation issues.", v20));
        end;
        if not v23 then
            v25 = false;
            v3.reportFailure(v3.ErrorType.validateCageNonManifoldAndHoles_CageHoles);
            table.insert(v24, string.format("%s is not watertight, meaning there are holes in it.", v20));
        end;
        return v25, v24;
    else
        v3.reportFailure(v3.ErrorType.validateCageNonManifoldAndHoles_FailedToExecute);
        return false, {
            "Failed to execute validateCageNonManifoldAndHoles check"
        };
    end;
end;
if not v4() then
    return v26;
else
    return v18;
end;


local l_UGCValidationService_0 = game:GetService("UGCValidationService");
local l_Parent_0 = script.Parent.Parent;
local _ = require(l_Parent_0.util.Types);
local v3 = require(l_Parent_0.util.pcallDeferred);
local v4 = require(l_Parent_0.flags.getFFlagUGCValidationShouldYield);
local v5 = require(l_Parent_0.flags.getFFlagUseUGCValidationContext);
local v6 = require(l_Parent_0.flags.getEngineFeatureEngineUGCValidateCageUVTriangleArea);
local v7 = require(l_Parent_0.flags.getEngineFeatureUGCValidateEditableMeshAndImage);
local v8 = require(l_Parent_0.Analytics);
local function v18(v9, v10)
    local l_isServer_0 = v10.isServer;
    if v6() then
        local v12 = nil;
        local v13 = nil;
        if not v7() or not v4() then
            local l_status_0, l_result_0 = pcall(function()
                return l_UGCValidationService_0:ValidateCageUVTriangleArea(v9.contentId);
            end);
            v12 = l_status_0;
            v13 = l_result_0;
        else
            local v16, v17 = v3(function()
                return l_UGCValidationService_0:ValidateEditableMeshCageUVTriangleArea(v9.editableMesh);
            end, v10);
            v12 = v16;
            v13 = v17;
        end;
        if v12 then
            if not v13 then
                v8.reportFailure(v8.ErrorType.validateCageUVTriangleArea_ZeroAreaTriangle);
                return false, {
                    string.format("Detected zero-area triangle in UV map of '%s'. You need to edit the UV map to fix this issue.", v9.fullName)
                };
            end;
        else
            if l_isServer_0 then
                error(string.format("Failed to load UVs for '%s'. Make sure the model has a valid UV map and try again.", v9.fullName));
            end;
            v8.reportFailure(v8.ErrorType.validateCageUVTriangleArea_FailedToLoadMesh);
            return false, {
                string.format("Failed to load UVs for '%s'. Make sure the model has a valid UV map and try again.", v9.fullName)
            };
        end;
    end;
    return true;
end;
local function v25(v19, v20, v21)
    local v22 = v19[v20];
    if v6() then
        local l_status_1, l_result_1 = pcall(function()
            return l_UGCValidationService_0:ValidateCageUVTriangleArea(v22);
        end);
        if l_status_1 then
            if not l_result_1 then
                v8.reportFailure(v8.ErrorType.validateCageUVTriangleArea_ZeroAreaTriangle);
                return false, {
                    string.format("%s.%s ( %s ) contained an invalid triangle which contained no area", v19:GetFullName(), v20, v22)
                };
            end;
        else
            if v21 then
                error("Failed to load mesh data");
            end;
            v8.reportFailure(v8.ErrorType.validateCageUVTriangleArea_FailedToLoadMesh);
            return false, {
                "Failed to load mesh data"
            };
        end;
    end;
    return true;
end;
if not v5() then
    return v25;
else
    return v18;
end;


local l_Parent_0 = script.Parent.Parent;
local _ = require(l_Parent_0.util.Types);
local v2 = require(l_Parent_0.util.pcallDeferred);
local v3 = require(l_Parent_0.flags.getFFlagUGCValidationShouldYield);
local v4 = require(l_Parent_0.WrapTargetCageUVReferenceValues);
local v5 = require(l_Parent_0.flags.getFFlagUseUGCValidationContext);
local v6 = require(l_Parent_0.flags.getEngineFeatureEngineUGCValidateBodyParts);
local v7 = require(l_Parent_0.flags.getEngineFeatureEngineUGCValidateUVValuesInReference);
local v8 = require(l_Parent_0.flags.getEngineFeatureUGCValidateEditableMeshAndImage);
local v9 = require(l_Parent_0.Analytics);
local l_UGCValidationService_0 = game:GetService("UGCValidationService");
local function v23(v11, v12, v13)
    local l_isServer_0 = v13.isServer;
    if v6() then
        if v7() then
            local v15 = assert(v4[v12.Parent.Name], "WrapTarget is not parented to a MeshPart");
            local v16 = nil;
            local v17 = nil;
            if not v8() or not v3() then
                local l_status_0, l_result_0 = pcall(function()
                    return l_UGCValidationService_0:ValidateUVValuesInReference(v15, v11.contentId);
                end);
                v16 = l_status_0;
                v17 = l_result_0;
            else
                local v20, v21 = v2(function()
                    return l_UGCValidationService_0:ValidateEditableMeshUVValuesInReference(v15, v11.editableMesh);
                end, v13);
                v16 = v20;
                v17 = v21;
            end;
            if v16 then
                if v17 then
                    return true;
                else
                    v9.reportFailure(v9.ErrorType.validateCageUVValues_UnexpectedUVValue);
                    return false, {
                        string.format("Found invalid UV value outside [0, 1] range for '%s'. You need to edit the UV map to fix this issue.", v12:GetFullName())
                    };
                end;
            else
                v9.reportFailure(v9.ErrorType.validateCageUVValues_FailedToLoadMesh);
                local v22 = string.format("Failed to load UVs for '%s'. Make sure the UV map exists and try again.", v12:GetFullName());
                if l_isServer_0 then
                    error(v22);
                end;
                return false, {
                    v22
                };
            end;
        else
            return true;
        end;
    else
        return true;
    end;
end;
local function v32(v24, v25, v26, v27)
    if v6() then
        if v7() then
            local v28 = assert(v4[v25.Parent.Name], "WrapTarget is not parented to a MeshPart");
            local l_status_1, l_result_1 = pcall(function()
                return l_UGCValidationService_0:ValidateUVValuesInReference(v28, v24);
            end);
            if l_status_1 then
                if l_result_1 then
                    return true;
                else
                    v9.reportFailure(v9.ErrorType.validateCageUVValues_UnexpectedUVValue);
                    return false, {
                        string.format("%s.%s ( %s ) has a UV value that is unexpected", v25:GetFullName(), v26, v24)
                    };
                end;
            else
                v9.reportFailure(v9.ErrorType.validateCageUVValues_FailedToLoadMesh);
                local v31 = string.format("Failed to read mesh %s.%s ( %s )", v25:GetFullName(), v26, v24);
                if v27 then
                    error(v31);
                end;
                return false, {
                    v31
                };
            end;
        else
            return true;
        end;
    else
        return true;
    end;
end;
if not v5() then
    return v32;
else
    return v23;
end;


local l_Parent_0 = script.Parent.Parent;
local _ = require(l_Parent_0.util.Types);
local v2 = require(l_Parent_0.util.pcallDeferred);
local v3 = require(l_Parent_0.flags.getFFlagUGCValidationShouldYield);
local v4 = require(l_Parent_0.Analytics);
local v5 = require(l_Parent_0.Constants);
local v6 = require(l_Parent_0.flags.getFFlagUseUGCValidationContext);
local v7 = require(l_Parent_0.flags.getEngineFeatureEngineUGCValidateBodyParts);
local v8 = require(l_Parent_0.flags.getEngineFeatureEngineUGCValidateCalculateUniqueUV);
local v9 = require(l_Parent_0.flags.getFIntUniqueUVTolerance);
local v10 = require(l_Parent_0.flags.getEngineFeatureUGCValidateEditableMeshAndImage);
local l_UGCValidationService_0 = game:GetService("UGCValidationService");
local function v31(v12, v13, v14)
    local l_isServer_0 = v14.isServer;
    if v7() then
        local v16 = assert(v5.WRAP_TARGET_CAGE_MESH_UV_COUNTS[v13.Parent.Name], "WrapTarget is not parented to a MeshPart");
        local v17 = nil;
        local v18 = nil;
        local v19 = nil;
        if not v8() then
            if not v10() or not v3() then
                local l_status_0, l_result_0 = pcall(function()
                    for v20 = 0, v9() do
                        if not l_UGCValidationService_0:ValidateUniqueUVCount(v12.contentId, v16 + v20) then
                            if not (not (v20 ~= 0 and v16 - v20 >= 0) or not l_UGCValidationService_0:ValidateUniqueUVCount(v12.contentId, v16 - v20)) then
                                return true;
                            end;
                        else
                            return true;
                        end;
                    end;
                    return false;
                end);
                v17 = l_status_0;
                v18 = l_result_0;
            else
                local v24, v25 = v2(function()
                    for v23 = 0, v9() do
                        if not l_UGCValidationService_0:ValidateEditableMeshUniqueUVCount(v12.editableMesh, v16 + v23) then
                            if not (not (v23 ~= 0 and v16 - v23 >= 0) or not l_UGCValidationService_0:ValidateEditableMeshUniqueUVCount(v12.editableMesh, v16 - v23)) then
                                return true;
                            end;
                        else
                            return true;
                        end;
                    end;
                    return false;
                end, v14);
                v17 = v24;
                v18 = v25;
            end;
        elseif not v10() or not v3() then
            local l_status_1, l_result_1 = pcall(function()
                v19 = l_UGCValidationService_0:CalculateUniqueUVCount(v12.contentId);
                return math.abs(v19 - v16) <= v9();
            end);
            v17 = l_status_1;
            v18 = l_result_1;
        else
            local v28, v29 = v2(function()
                v19 = l_UGCValidationService_0:CalculateEditableMeshUniqueUVCount(v12.editableMesh);
                return math.abs(v19 - v16) <= v9();
            end, v14);
            v17 = v28;
            v18 = v29;
        end;
        if v17 then
            if v18 then
                return true;
            else
                v4.reportFailure(v4.ErrorType.validateCageUVs_TestPassed);
                return false, {
                    string.format("%s.%s ( %s ) should have %d unique UVs, but has %d. Please make sure the mesh has the required number of unique UVs and try again.", v13:GetFullName(), v12.fieldName, not v12.contentId and "" or v12.contentId, v16, v19)
                };
            end;
        else
            local v30 = string.format("Failed to execute UV check for '%s'. Make sure the UV map exists and try again.", v13:GetFullName());
            if l_isServer_0 then
                error(v30);
            end;
            v4.reportFailure(v4.ErrorType.validateCageUVs_TestExecutedSuccessfully);
            return false, {
                v30
            };
        end;
    else
        return true;
    end;
end;
local function v46(v32, v33, v34, v35)
    if v7() then
        local v36 = assert(v5.WRAP_TARGET_CAGE_MESH_UV_COUNTS[v33.Parent.Name], "WrapTarget is not parented to a MeshPart");
        local v37 = nil;
        local v38 = nil;
        local v39 = nil;
        if not v8() then
            local l_status_2, l_result_2 = pcall(function()
                for v40 = 0, v9() do
                    if not l_UGCValidationService_0:ValidateUniqueUVCount(v32, v36 + v40) then
                        if not (not (v40 ~= 0 and v36 - v40 >= 0) or not l_UGCValidationService_0:ValidateUniqueUVCount(v32, v36 - v40)) then
                            return true;
                        end;
                    else
                        return true;
                    end;
                end;
                return false;
            end);
            v37 = l_status_2;
            v38 = l_result_2;
        else
            local l_status_3, l_result_3 = pcall(function()
                v39 = l_UGCValidationService_0:CalculateUniqueUVCount(v32);
                return math.abs(v39 - v36) <= v9();
            end);
            v37 = l_status_3;
            v38 = l_result_3;
        end;
        if v37 then
            if v38 then
                return true;
            else
                v4.reportFailure(v4.ErrorType.validateCageUVs_TestPassed);
                if not v8() then
                    return false, {
                        string.format("%s.%s ( %s ) should have %d unique UVs", v33:GetFullName(), v34, v32, v36)
                    };
                else
                    return false, {
                        string.format("%s.%s ( %s ) should have %d unique UVs, but has %d", v33:GetFullName(), v34, v32, v36, v39)
                    };
                end;
            end;
        else
            local v45 = string.format("Failed to read mesh %s.%s ( %s )", v33:GetFullName(), v34, v32);
            if v35 then
                error(v45);
            end;
            v4.reportFailure(v4.ErrorType.validateCageUVs_TestExecutedSuccessfully);
            return false, {
                v45
            };
        end;
    else
        return true;
    end;
end;
if not v6() then
    return v46;
else
    return v31;
end;


local l_UGCValidationService_0 = game:GetService("UGCValidationService");
local v1 = require(script.Parent.Parent.Analytics);
return function(v2)
    local l_status_0, l_result_0 = pcall(function()
        return l_UGCValidationService_0:CanLoadAsset(v2);
    end);
    if l_status_0 and l_result_0 then
        return true;
    else
        v1.reportFailure(v1.ErrorType.validateCanLoad);
        return false, {
            "Asset could not be loaded"
        };
    end;
end;


local l_Parent_0 = script.Parent.Parent;
local v1 = require(l_Parent_0.flags.getFFlagUseUGCValidationContext);
local v2 = require(l_Parent_0.flags.getFFlagDebugUGCDisableRCCOwnershipCheck);
local v3 = require(l_Parent_0.flags.getFFlagUGCValidateBodyPartsModeration);
local v4 = require(l_Parent_0.flags.getFFlagUGCValidateAssetStatusNameChange);
local v5 = require(l_Parent_0.flags.getFFlagUGCValidationAnalytics);
local v6 = game:DefineFastFlag("ValidateUserAndUniverseNoModeration", false);
local v7 = require(l_Parent_0.Analytics);
local v8 = require(l_Parent_0.Constants);
local v9 = require(l_Parent_0.util.ParseContentIds);
local v10 = require(l_Parent_0.util.FailureReasonsAccumulator);
local v11 = require(l_Parent_0.util.getAssetCreationDetailsRCC);
local _ = require(l_Parent_0.util.Types);
local v13 = require(l_Parent_0.validation.validateModeration);
local v14 = require(l_Parent_0.validation.validateCanLoad);
local v15 = require(l_Parent_0.validation.validateAssetCreator);
local function v19(v16)
    for _, v18 in pairs(v16) do
        if not v14(v18.instance[v18.fieldName]) then
            error(string.format("Failed to load children assets (Meshes, Textures, etc.) for '%s'. Make sure the assets exist and try again.", v18.instance.Name));
        end;
    end;
end;
local v20 = nil;
local v21 = nil;
if not v4() then
    v21 = {
        MODERATION_STATE_REVIEWING = "MODERATION_STATE_REVIEWING",
        MODERATION_STATE_REJECTED = "MODERATION_STATE_REJECTED",
        MODERATION_STATE_APPROVED = "MODERATION_STATE_APPROVED"
    };
else
    v20 = {
        MODERATION_STATE_REVIEWING = {
            MODERATION_STATE_REVIEWING = true,
            Reviewing = true
        },
        MODERATION_STATE_APPROVED = {
            MODERATION_STATE_APPROVED = true,
            Approved = true
        }
    };
end;
local function v27(v22, v23, v24, v25, v26)
    if v22[tonumber(v23)] then
        return true;
    else
        v7.reportFailure(v7.ErrorType.validateDependencies_IsRestrictedUserId);
        if not v1() then
            return false, {
                (("%*.%* ( %* ) is not owned by the developer"):format(v24:GetFullName(), v25, v26))
            };
        else
            return false, {
                (("%*.%* ( %* ) is not owned by the current user. You can only validate assets that you or a group you belong to owns."):format(v24:GetFullName(), v25, v26))
            };
        end;
    end;
end;
local function v32(v28, v29, v30, v31)
    if if not v4() then v21.MODERATION_STATE_REVIEWING == v28 else v20.MODERATION_STATE_REVIEWING[v28] then
        v7.reportFailure(v7.ErrorType.validateDependencies_IsReviewing);
        if not v1() then
            error("Asset is under review");
        else
            error("Failed to load asset {instance:GetFullName()}.{fieldName} ( {id} ) that is still going through the review process. Please, wait for a notification of completion from the review process and try again.");
        end;
    end;
    if if not v4() then v21.MODERATION_STATE_APPROVED == v28 else v20.MODERATION_STATE_APPROVED[v28] then
        return true;
    else
        v7.reportFailure(v7.ErrorType.validateDependencies_IsNotApproved);
        if not v1() then
            return false, {
                (("%*.%* ( %* ) is not owned by the developer"):format(v29:GetFullName(), v30, v31))
            };
        else
            return false, {
                (("%*.%* ( %* ) is not owned by the current user. You can only validate assets that you or a group you belong to owns."):format(v29:GetFullName(), v30, v31))
            };
        end;
    end;
end;
local function v46(v33, v34)
    if not v33 or #v33 == 0 then
        return true;
    else
        local v35 = {};
        for _, v37 in ipairs(v33) do
            v35[tonumber(v37.id)] = true;
        end;
        local v38 = v10.new();
        for v39, v40 in pairs(v34) do
            local v41, v42 = v11(v39);
            if not v41 then
                error("Failed to load asset");
            end;
            local l_creator_0 = v42.creationContext.creator;
            local v44 = if not l_creator_0.userId then l_creator_0.groupId else l_creator_0.userId;
            if not v5() then
                local v45 = string.format("%s.%s ( %s ) is not owned by the developer", v40.instance:GetFullName(), v40.fieldName, v39);
                v38:updateReasons(v35[tonumber(v44)], {
                    v45
                });
                if if not v4() then v21.MODERATION_STATE_REVIEWING == v42.moderationResult.moderationState else v20.MODERATION_STATE_REVIEWING[v42.moderationResult.moderationState] then
                    error("Asset is under review");
                end;
                v38:updateReasons(if not v4() then v21.MODERATION_STATE_APPROVED == v42.moderationResult.moderationState else v20.MODERATION_STATE_APPROVED[v42.moderationResult.moderationState], {
                    v45
                });
            else
                v38:updateReasons(v27(v35, v44, v40.instance, v40.fieldName, v39));
                v38:updateReasons(v32(v42.moderationResult.moderationState, v40.instance, v40.fieldName, v39));
            end;
        end;
        return v38:getFinalResults();
    end;
end;
local function v49(v47, v48)
    assert(v48.isServer, "isServer must be true for validateAssetCreatorsRCC");
    return v15(v47, v48);
end;
local function v53(v50, v51, v52)
    return v15(v51, true, v50 or {}, "", v52);
end;
return if not v1() then function(v54, v55, v56, v57, v58)
    local v59 = {};
    local v60, v61 = v9.parseWithErrorCheck({}, v59, v54, nil, v8.CONTENT_ID_REQUIRED_FIELDS);
    if v60 then
        if v55 then
            v19(v59);
        end;
        local v62 = v10.new();
        if not (v2() or not v55) then
            if not v6 or not v58 then
                v62:updateReasons(v46(v57, v59));
            else
                v62:updateReasons(v53(v57, v59, v58));
            end;
        end;
        if not v3() then
            local v63 = not v55;
            if v56 then
                v63 = false;
            end;
            if v63 then
                v62:updateReasons(v13(v54, v57));
            end;
        end;
        return v62:getFinalResults();
    else
        v7.reportFailure(v7.ErrorType.validateDependencies_ParseFailure);
        return false, v61;
    end;
end else function(v64, v65)
    local v66 = if not v65 then nil else v65.isServer;
    local v67 = if not v65 then nil else v65.allowUnreviewedAssets;
    local v68 = if not v65 then nil else v65.restrictedUserIds;
    local v69 = if not v65 then nil else v65.universeId;
    local v70 = {};
    local v71, v72 = v9.parseWithErrorCheck({}, v70, v64, nil, v8.CONTENT_ID_REQUIRED_FIELDS);
    if v71 then
        if v66 then
            v19(v70);
        end;
        local v73 = v10.new();
        if not (v2() or not v66) then
            if not v6 or not v69 then
                v73:updateReasons(v46(v68, v70));
            else
                v73:updateReasons(v49(v70, v65));
            end;
        end;
        if not v3() then
            local v74 = not v66;
            if v67 then
                v74 = false;
            end;
            if v74 then
                v73:updateReasons(v13(v64, v68));
            end;
        end;
        return v73:getFinalResults();
    else
        v7.reportFailure(v7.ErrorType.validateDependencies_ParseFailure);
        return false, v72;
    end;
end;


local l_UGCValidationService_0 = game:GetService("UGCValidationService");
local l_Parent_0 = script.Parent.Parent;
local v2 = require(l_Parent_0.Analytics);
local v3 = require(l_Parent_0.Constants);
local _ = require(l_Parent_0.util.Types);
local v5 = require(l_Parent_0.util.pcallDeferred);
local v6 = require(l_Parent_0.flags.getFFlagUGCValidationShouldYield);
local v7 = require(l_Parent_0.validation.validateOverlappingVertices);
local v8 = require(l_Parent_0.validation.validateCageUVs);
local v9 = require(l_Parent_0.validation.validateFullBodyCageDeletion);
local v10 = require(l_Parent_0.validation.validateMeshVertColors);
local v11 = require(l_Parent_0.validation.validateCageUVTriangleArea);
local v12 = require(l_Parent_0.validation.validateMeshTriangleArea);
local v13 = require(l_Parent_0.validation.validateCageUVValues);
local v14 = require(l_Parent_0.util.FailureReasonsAccumulator);
local v15 = require(l_Parent_0.util.ParseContentIds);
local v16 = require(l_Parent_0.util.getMeshMinMax);
local v17 = require(l_Parent_0.util.getEditableMeshFromContext);
local v18 = require(l_Parent_0.flags.getFFlagUseUGCValidationContext);
local v19 = require(l_Parent_0.flags.getFFlagUGCValidateBodyPartsExtendedMeshTests);
local v20 = require(l_Parent_0.flags.getEngineFeatureEngineUGCValidateBodyParts);
local v21 = require(l_Parent_0.flags.getFFlagUGCValidateCageUVTriangleArea);
local v22 = require(l_Parent_0.flags.getFFlagUGCValidateMeshTriangleAreaForCages);
local v23 = require(l_Parent_0.flags.getFFlagUGCValidateMeshTriangleAreaForMeshes);
local v24 = require(l_Parent_0.flags.getFFlagUGCValidateUVValuesInReference);
local v25 = require(l_Parent_0.flags.getEngineFeatureUGCValidateEditableMeshAndImage);
local function v31(v26, v27)
    if v26.HasSkinnedMesh then
        if v20() then
            local l_status_0, l_result_0 = pcall(function()
                return l_UGCValidationService_0:ValidateSkinnedMesh(v26.MeshId);
            end);
            if l_status_0 then
                if l_result_0 then
                    return true;
                else
                    local v30 = ("Detected mismatch between model and skinned data for %*. You need to re-skin your model to fix this issue."):format(v26.Name);
                    if v27 then
                        error(v30);
                    end;
                    v2.reportFailure(v2.ErrorType.validateDescendantMeshMetrics_HasSkinnedMeshMismatch);
                    return false, {
                        v30
                    };
                end;
            else
                if v27 then
                    error("Failed to retrieve mesh data to validate skinned mesh");
                end;
                v2.reportFailure(v2.ErrorType.validateDescendantMeshMetrics_FailedToLoadMesh);
                return false, {
                    "Failed to retrieve mesh data to validate skinned mesh"
                };
            end;
        else
            return true;
        end;
    else
        v2.reportFailure(v2.ErrorType.validateDescendantMeshMetrics_NoSkinningInfo);
        return false, {
            (("Missing skinning data for %*.MeshId. You need to skin your model."):format(v26.Name))
        };
    end;
end;
local function v51(v32, v33, v34)
    local l_isServer_0 = v34.isServer;
    local v36 = assert(v3.ASSET_RENDER_MESH_MAX_TRIANGLES[v33.Name]);
    local v48, v49, v50 = (function()
        local v37 = 0;
        for _, v39 in v32, nil, nil do
            if v39.instance.ClassName == "MeshPart" then
                assert(v39.fieldName == "MeshId");
                local v40 = nil;
                local v41 = nil;
                if not v25() or not v6() then
                    local l_status_1, l_result_1 = pcall(function()
                        return l_UGCValidationService_0:GetMeshTriCount(v39.instance[v39.fieldName]);
                    end);
                    v40 = l_status_1;
                    v41 = l_result_1;
                else
                    local v44, v45 = v17(v39.instance, v39.fieldName, v34);
                    if v44 then
                        local v46, v47 = v5(function()
                            return l_UGCValidationService_0:GetEditableMeshTriCount(v45);
                        end, v34);
                        v40 = v46;
                        v41 = v47;
                    else
                        v2.reportFailure(v2.ErrorType.validateDescendantMeshMetrics_FailedToLoadMesh);
                        return false, string.format("Failed to load mesh for '%s'. Make sure mesh exists and try again.", v39.instance.Name);
                    end;
                end;
                if v40 then
                    v37 = v37 + v41;
                else
                    return false, string.format("Failed to execute check for triangle face information for mesh '%s'. Make sure mesh exists and try again.", v39.instance.Name);
                end;
            end;
        end;
        return true, nil, v37;
    end)();
    if v48 then
        if v36 < v50 then
            v2.reportFailure(v2.ErrorType.validateDescendantMeshMetrics_TooManyTriangles);
            return false, {
                string.format("Mesh resolution of '%d' for '%s' is higher than max supported number of triangles '%d'. You need to retopologize your model to reduce the triangle count.", v50, v33.Name, v36)
            };
        else
            return true;
        end;
    else
        if l_isServer_0 then
            error(v49);
        end;
        v2.reportFailure(v2.ErrorType.validateDescendantMeshMetrics_FailedToCalculateTriangles);
        return false, {
            v49
        };
    end;
end;
local function v64(v52, v53, v54)
    local v55 = assert(v3.ASSET_RENDER_MESH_MAX_TRIANGLES[v53.Name]);
    local v61, v62, v63 = (function()
        local v56 = 0;
        for _, v58 in v52, nil, nil do
            if v58.instance.ClassName == "MeshPart" then
                assert(v58.fieldName == "MeshId");
                local l_status_2, l_result_2 = pcall(function()
                    return l_UGCValidationService_0:GetMeshTriCount(v58.instance[v58.fieldName]);
                end);
                if l_status_2 then
                    v56 = v56 + l_result_2;
                else
                    v2.reportFailure(v2.ErrorType.validateDescendantMeshMetrics_FailedToLoadMesh);
                    return false, (("Failed to load mesh data for %*.%* (%*)"):format(v58.instance.Name, v58.fieldName, v58.id));
                end;
            end;
        end;
        return true, nil, v56;
    end)();
    if v61 then
        if v55 < v63 then
            v2.reportFailure(v2.ErrorType.validateDescendantMeshMetrics_TooManyTriangles);
            return false, {
                (("%* cannot have more than %* triangles in render meshes"):format(v53.Name, v55))
            };
        else
            return true;
        end;
    else
        if v54 then
            error(v62);
        end;
        v2.reportFailure(v2.ErrorType.validateDescendantMeshMetrics_FailedToCalculateTriangles);
        return false, {
            v62
        };
    end;
end;
local function v71(v65, v66)
    local v67, v68, v69, v70 = v16(v65, v66);
    if v67 then
        if (v69 + (v70 - v69) / 2).Magnitude > 0.001 then
            v2.reportFailure(v2.ErrorType.validateDescendantMeshMetrics_TooFarFromOrigin);
            return false, {
                string.format("Bounds for the mesh '%s' are not centered at the origin. The max allowed distance is '%f'", v65.fullName, 0.001)
            };
        else
            return true;
        end;
    else
        return v67, v68;
    end;
end;
local function v78(v72, v73)
    local v74, v75, v76, v77 = v16(v72.MeshId, v73);
    if v74 then
        if (v76 + (v77 - v76) / 2).Magnitude > 0.001 then
            v2.reportFailure(v2.ErrorType.validateDescendantMeshMetrics_TooFarFromOrigin);
            return false, {
                (("Mesh for MeshPart %* has been built too far from the origin"):format(v72.Name))
            };
        else
            return true;
        end;
    else
        return v74, v75;
    end;
end;
local function v90(v79, v80)
    local l_isServer_1 = v80.isServer;
    assert(v80.assetTypeEnum ~= nil, "assetTypeEnum required in validationContext for validateDescendantMeshMetrics");
    local l_assetTypeEnum_0 = v80.assetTypeEnum;
    local v83 = v14.new();
    local v84 = v15.parse(v79, v3.MESH_CONTENT_ID_FIELDS, v80);
    v83:updateReasons(v51(v84, l_assetTypeEnum_0, v80));
    for _, v86 in v84, nil, nil do
        local v87 = {
            fullName = v86.instance:GetFullName(),
            fieldName = v86.fieldName,
            contentId = v86.instance[v86.fieldName],
            context = v86.instance.Name
        };
        if v25() then
            local v88, v89 = v17(v86.instance, v86.fieldName, v80);
            if v88 then
                v87.editableMesh = v89;
            else
                return false, {
                    string.format("Failed to load mesh for '%s'. Make sure mesh exists and try again.", v86.instance.Name)
                };
            end;
        end;
        if v86.instance.ClassName == "MeshPart" then
            assert(v86.fieldName == "MeshId");
            v83:updateReasons(v71(v87, v80));
            v83:updateReasons(v10(v87, true, v80));
            v83:updateReasons(v31(v86.instance, l_isServer_1));
            if v23() then
                v83:updateReasons(v12(v87, v80));
            end;
        elseif v86.instance.ClassName == "WrapTarget" then
            assert(v86.fieldName == "CageMeshId");
            v87.fullName = v87.fullName .. "OuterCage";
            if v19() then
                v83:updateReasons(v9(v87, v80));
            end;
            v83:updateReasons(v8(v87, v86.instance, v80));
            if v21() then
                v83:updateReasons(v11(v87, v80));
            end;
            if v24() then
                v83:updateReasons(v13(v87, v86.instance, v80));
            end;
            if v22() then
                v83:updateReasons(v12(v87, v80));
            end;
        end;
        if v19() then
            v83:updateReasons(v7(v87, v80));
        end;
    end;
    return v83:getFinalResults();
end;
local function v99(v91, v92, v93)
    local v94 = v14.new();
    local v95 = v15.parse(v91, v3.MESH_CONTENT_ID_FIELDS);
    v94:updateReasons(v64(v95, v92, v93));
    for _, v97 in v95, nil, nil do
        local v98 = string.format("%s.%s ( %s )", v97.instance:GetFullName(), v97.fieldName, v97.id);
        if v97.instance.ClassName == "MeshPart" then
            assert(v97.fieldName == "MeshId");
            v94:updateReasons(v78(v97.instance, v93));
            v94:updateReasons(v10(v97.instance[v97.fieldName], true, v93));
            v94:updateReasons(v31(v97.instance, v93));
            if v23() then
                v94:updateReasons(v12(v97.instance, v97.fieldName, v93));
            end;
        elseif v97.instance.ClassName == "WrapTarget" then
            assert(v97.fieldName == "CageMeshId");
            if v19() then
                v94:updateReasons(v9(v97.instance[v97.fieldName], v98, v93));
            end;
            v94:updateReasons(v8(v97.instance[v97.fieldName], v97.instance, v97.fieldName, v93));
            if v21() then
                v94:updateReasons(v11(v97.instance, v97.fieldName, v93));
            end;
            if v24() then
                v94:updateReasons(v13(v97.instance[v97.fieldName], v97.instance, v97.fieldName, v93));
            end;
            if v22() then
                v94:updateReasons(v12(v97.instance, v97.fieldName, v93));
            end;
        end;
        if v19() then
            v94:updateReasons(v7(v97.instance[v97.fieldName], v98, v93));
        end;
    end;
    return v94:getFinalResults();
end;
if not v18() then
    return v99;
else
    return v90;
end;


local l_Parent_0 = script.Parent.Parent;
local _ = require(l_Parent_0.util.Types);
local v2 = require(l_Parent_0.Constants);
local v3 = require(l_Parent_0.validation.validateTextureSize);
local v4 = require(l_Parent_0.util.FailureReasonsAccumulator);
local v5 = require(l_Parent_0.util.ParseContentIds);
local v6 = require(l_Parent_0.util.getEditableImageFromContext);
local v7 = require(l_Parent_0.flags.getFFlagUseUGCValidationContext);
local v8 = require(l_Parent_0.flags.getEngineFeatureUGCValidateEditableMeshAndImage);
local function v19(v9, v10)
    local v11 = v4.new();
    local v12 = v5.parse(v9, v2.TEXTURE_CONTENT_ID_FIELDS, v10);
    local v13 = {};
    for _, v15 in v12, nil, nil do
        local v16 = {
            fullName = v15.instance:GetFullName(),
            fieldName = v15.fieldName,
            contentId = v15.instance[v15.fieldName]
        };
        if v8() then
            local v17, v18 = v6(v15.instance, v15.fieldName, v10);
            if v17 then
                v16.editableImage = v18;
            else
                return false, {
                    "Failed to load texture data"
                };
            end;
        end;
        if not v13[v15.id] then
            v11:updateReasons(v3(v16, nil, v10));
            if v15.id then
                v13[v15.id] = true;
            end;
        end;
    end;
    return v11:getFinalResults();
end;
local function v27(v20, v21)
    local v22 = v4.new();
    local v23 = v5.parse(v20, v2.TEXTURE_CONTENT_ID_FIELDS);
    local v24 = {};
    for _, v26 in v23, nil, nil do
        if not v24[v26.id] then
            v22:updateReasons(v3(v26.instance[v26.fieldName], nil, v21));
            v24[v26.id] = true;
        end;
    end;
    return v22:getFinalResults();
end;
if not v7() then
    return v27;
else
    return v19;
end;


local l_UGCValidationService_0 = game:GetService("UGCValidationService");
local l_Parent_0 = script.Parent.Parent;
local v2 = require(l_Parent_0.Analytics);
local v3 = require(l_Parent_0.util.FailureReasonsAccumulator);
local v4 = require(l_Parent_0.flags.getFFlagUseUGCValidationContext);
local v5 = require(l_Parent_0.flags.getEngineFeatureEngineUGCValidateBodyParts);
local v6 = require(l_Parent_0.flags.getEngineFeatureUGCValidateGetInactiveControls);
local v7 = require(l_Parent_0.flags.getFFlagUGCValidateTestInactiveControls);
local l_game_EngineFeature_0 = game:GetEngineFeature("UGCValidateCompareTextureOverlap");
local v9 = require(l_Parent_0.flags.getEngineFeatureViewportFrameSnapshotEngineFeature);
local v10 = game:DefineFastInt("UGCValidateFacsDataOperationalThreshold", 200) * 0.001;
local v11 = require(l_Parent_0.util.setupDynamicHead);
local v12 = require(l_Parent_0.util.Thumbnailer);
local _ = require(l_Parent_0.util.Types);
local v14 = {
    "LipsTogether",
    "Pucker",
    "LeftLipStretcher",
    "RightLipStretcher",
    "LeftLipCornerPuller",
    "RightLipCornerPuller",
    "LeftUpperLipRaiser",
    "RightUpperLipRaiser",
    "LeftLowerLipDepressor",
    "RightLowerLipDepressor",
    "JawDrop",
    "LeftEyeClosed",
    "RightEyeClosed",
    "EyesLookRight",
    "EyesLookLeft",
    "EyesLookUp",
    "EyesLookDown"
};
local function v18(v15, v16)
    local v17 = nil;
    v17 = not v4() and "Failed to retrieve mesh data to validate dynamic head" or string.format("Failed to load model for dynamic head '%s'. Make sure model exists and try again.", v16);
    if v15 then
        error(v17);
    end;
    v2.reportFailure(v2.ErrorType.validateDynamicHeadMeshPartFormat_FailedToLoadMesh);
    return false, {
        v17
    };
end;
local v19 = Vector3.new(0, 0, -1);
local function v40(v20, v21)
    if v21 or v9() then
        local v22 = v20:Clone();
        if v11(v22) then
            local v23 = v12.new(v21, 1, Vector2.new(100, 100));
            v23:init(v22);
            v23:setCamera(1, math.max(v22.Size.X, v22.Size.Y), v19);
            local v24, v25 = v23:takeSnapshot();
            local l_FaceControls_0 = v22:FindFirstChild("FaceControls");
            if l_FaceControls_0 then
                for _, v28 in v14, nil, nil do
                    l_FaceControls_0[v28] = 1;
                end;
                local v29, v30 = v23:takeSnapshot();
                if v24 and v29 then
                    local v31 = nil;
                    local v32 = nil;
                    if not v21 then
                        local l_status_0, l_result_0 = pcall(function()
                            return l_UGCValidationService_0:CompareTextureOverlapTextureId(v25, v30);
                        end);
                        v31 = l_status_0;
                        v32 = l_result_0;
                    else
                        local l_status_1, l_result_1 = pcall(function()
                            return l_UGCValidationService_0:CompareTextureOverlapByteString(v25, v30);
                        end);
                        v31 = l_status_1;
                        v32 = l_result_1;
                    end;
                    v23:cleanup();
                    if not v31 or #v32 < 2 then
                        local v37 = string.format("Failed to read data from snapshot of DynamicHead (%s)", v20.MeshId);
                        if not v21 then
                            return false, {
                                v37
                            };
                        else
                            error(v37);
                        end;
                    end;
                    local v38 = v32[1] / v32[2];
                    if v38 < v10 then
                        return false, {
                            string.format("DynamicHead (%s) did not pass threshold (%f < %f) for percent change when emoting", v20.MeshId, v38, v10)
                        };
                    else
                        return true;
                    end;
                else
                    local v39 = string.format("Unable to capture snapshot of DynamicHead (%s)", v20.MeshId);
                    if v21 then
                        error(v39);
                    end;
                    return false, {
                        v39
                    };
                end;
            else
                v23:cleanup();
                return false, {
                    "No FaceControls founds"
                };
            end;
        else
            return false, {
                string.format("Unable to setup body for DynamicHead (%s)", v20.MeshId)
            };
        end;
    else
        return true;
    end;
end;
local function v52(v41, v42)
    if v5() then
        local l_isServer_0 = v42.isServer;
        local v44 = not not v42.bypassFlags and v42.bypassFlags.skipSnapshot;
        local l_status_2, l_result_2 = pcall(function()
            return l_UGCValidationService_0:ValidateDynamicHeadMesh(v41.MeshId);
        end);
        if l_status_2 then
            if l_result_2 then
                l_status_2 = v3.new();
                if not (not v6() or not v7()) then
                    local v47, v48;
                    l_result_2, v47, v48 = pcall(function()
                        return l_UGCValidationService_0:GetDynamicHeadMeshInactiveControls(v41.MeshId, v14);
                    end);
                    if not l_result_2 then
                        if string.find(v47, "Download Error") == 1 then
                            if not v4() then
                                return v18(l_isServer_0);
                            else
                                return v18(l_isServer_0, v41.Name);
                            end;
                        else
                            assert(false, v47);
                        end;
                    end;
                    local v49 = #v47 == 0;
                    local v50 = #v48 == 0;
                    if not (v49 and v50) then
                        v2.reportFailure(v2.ErrorType.validateDynamicHeadMeshPartFormat_ValidateDynamicHeadMeshControls);
                        l_status_2:updateReasons(v49, {
                            (("%*.MeshId (%*) is missing FACS controls: %*"):format(v41.Name, v41.MeshId, (table.concat(v47, ", "))))
                        });
                        l_status_2:updateReasons(v50, {
                            (("%*.MeshId (%*) has inactive FACS controls: %*"):format(v41.Name, v41.MeshId, (table.concat(v48, ", "))))
                        });
                    end;
                end;
                if not (not l_game_EngineFeature_0 or v44) then
                    local v51;
                    l_result_2, v51 = v40(v41, l_isServer_0);
                    l_status_2:updateReasons(l_result_2, v51);
                end;
                return l_status_2:getFinalResults();
            else
                v2.reportFailure(v2.ErrorType.validateDynamicHeadMeshPartFormat_ValidateDynamicHeadMesh);
                if not v4() then
                    return false, {
                        (("%*.MeshId (%*) is not correctly set-up to be a dynamic head mesh as it has no FACS information"):format(v41.Name, v41.MeshId))
                    };
                else
                    return false, {
                        string.format("Failed validation for dynamic head '%s' due to missing FACS information. You need to provide FACS controls for at least 17 poses (see documentation).", v41.Name)
                    };
                end;
            end;
        elseif not v4() then
            return v18(l_isServer_0);
        else
            return v18(l_isServer_0, v41.Name);
        end;
    else
        return true;
    end;
end;
local function v63(v53, v54, v55)
    if v5() then
        local l_status_3, l_result_3 = pcall(function()
            return l_UGCValidationService_0:ValidateDynamicHeadMesh(v53.MeshId);
        end);
        if l_status_3 then
            if l_result_3 then
                l_status_3 = v3.new();
                if not (not v6() or not v7()) then
                    local v58, v59;
                    l_result_3, v58, v59 = pcall(function()
                        return l_UGCValidationService_0:GetDynamicHeadMeshInactiveControls(v53.MeshId, v14);
                    end);
                    if not l_result_3 then
                        if string.find(v58, "Download Error") == 1 then
                            return v18(v54);
                        else
                            assert(false, v58);
                        end;
                    end;
                    local v60 = #v58 == 0;
                    local v61 = #v59 == 0;
                    if not (v60 and v61) then
                        v2.reportFailure(v2.ErrorType.validateDynamicHeadMeshPartFormat_ValidateDynamicHeadMeshControls);
                        l_status_3:updateReasons(v60, {
                            (("%*.MeshId (%*) is missing FACS controls: %*"):format(v53.Name, v53.MeshId, (table.concat(v58, ", "))))
                        });
                        l_status_3:updateReasons(v61, {
                            (("%*.MeshId (%*) has inactive FACS controls: %*"):format(v53.Name, v53.MeshId, (table.concat(v59, ", "))))
                        });
                    end;
                end;
                if not (not l_game_EngineFeature_0 or v55) then
                    local v62;
                    l_result_3, v62 = v40(v53, v54);
                    l_status_3:updateReasons(l_result_3, v62);
                end;
                return l_status_3:getFinalResults();
            else
                v2.reportFailure(v2.ErrorType.validateDynamicHeadMeshPartFormat_ValidateDynamicHeadMesh);
                return false, {
                    (("%*.MeshId (%*) is not correctly set-up to be a dynamic head mesh as it has no FACS information"):format(v53.Name, v53.MeshId))
                };
            end;
        else
            return v18(v54);
        end;
    else
        return true;
    end;
end;
if not v4() then
    return v63;
else
    return v52;
end;


local l_UGCValidationService_0 = game:GetService("UGCValidationService");
local l_Parent_0 = script.Parent.Parent;
local v2 = require(l_Parent_0.flags.getFFlagUseUGCValidationContext);
local v3 = require(l_Parent_0.flags.getEngineFeatureEngineUGCValidateBodyParts);
local v4 = require(l_Parent_0.flags.getFFlagUGCValidateMoveDynamicHeadTest);
local v5 = require(l_Parent_0.flags.getFFlagUGCValidateDynamicHeadMoodClient);
local v6 = require(l_Parent_0.flags.getFFlagUGCValidateDynamicHeadMoodRCC);
local v7 = require(l_Parent_0.Analytics);
local v8 = require(l_Parent_0.validation.validateSingleInstance);
local v9 = require(l_Parent_0.validation.validateMeshPartBodyPart);
local v10 = require(l_Parent_0.validation.validateDynamicHeadData);
local v11 = require(l_Parent_0.validation.validateDynamicHeadMood);
local _ = require(l_Parent_0.util.Types);
local v13 = require(l_Parent_0.util.createDynamicHeadMeshPartSchema);
local function v18(v14, v15)
    if v4() then
        assert(false, "Should never get here");
    end;
    if v3() then
        local l_status_0, l_result_0 = pcall(function()
            return l_UGCValidationService_0:ValidateDynamicHeadMesh(v14.MeshId);
        end);
        if l_status_0 then
            if l_result_0 then
                return true;
            else
                v7.reportFailure(v7.ErrorType.validateDynamicHeadMeshPartFormat_ValidateDynamicHeadMesh);
                return false, {
                    (("%*.MeshId (%*) is not correctly set-up to be a dynamic head mesh as it has no FACS information"):format(v14.Name, v14.MeshId))
                };
            end;
        else
            if v15 then
                error("Failed to retrieve mesh data to validate dynamic head");
            end;
            v7.reportFailure(v7.ErrorType.validateDynamicHeadMeshPartFormat_FailedToLoadMesh);
            return false, {
                "Failed to retrieve mesh data to validate dynamic head"
            };
        end;
    else
        return true;
    end;
end;
local function v28(v19)
    assert(v19.instances ~= nil, "instances required in validationContext for validateDynamicHeadMeshPartFormat");
    local l_instances_0 = v19.instances;
    local l_isServer_0 = v19.isServer;
    local v22 = not not v19.bypassFlags and v19.bypassFlags.skipSnapshot;
    local v23, v24 = v8(l_instances_0, v19);
    if v23 then
        local v25 = l_instances_0[1];
        local v26, v27 = v9(v25, v13(v19), v19);
        v23 = v26;
        v24 = v27;
        if v23 then
            if not (not (l_isServer_0 and v6()) and (l_isServer_0 or not v5()) or v22) then
                v26, v27 = v11(v25, if l_isServer_0 ~= nil then l_isServer_0 else false);
                v23 = v26;
                v24 = v27;
                if not v23 then
                    return false, v24;
                end;
            end;
            if not v4() then
                return v18(v25, l_isServer_0);
            else
                return v10(v25, v19);
            end;
        else
            return false, v24;
        end;
    else
        return v23, v24;
    end;
end;
local function v39(v29, v30, v31, v32, v33)
    local v34, v35 = v8(v29);
    if v34 then
        local v36 = v29[1];
        local v37, v38 = v9(v36, v13(), Enum.AssetType.DynamicHead, v30, v31, v32, v33);
        v34 = v37;
        v35 = v38;
        if v34 then
            if not (not (v30 and v6()) and (v30 or not v5())) then
                v37, v38 = v11(v36, if v30 ~= nil then v30 else false);
                v34 = v37;
                v35 = v38;
                if not v34 then
                    return false, v35;
                end;
            end;
            if not v4() then
                return v18(v36, v30);
            else
                return v10(v36, v30);
            end;
        else
            return false, v35;
        end;
    else
        return v34, v35;
    end;
end;
if not v2() then
    return v39;
else
    return v28;
end;