local l_Parent_0 = script.Parent.Parent.Parent;
local v1 = require(l_Parent_0.Packages.Framework);
local v2 = require(l_Parent_0.Packages.Roact);
local v3 = require(l_Parent_0.Packages.Rodux);
local l_ContextServices_0 = v1.ContextServices;
local v5 = require(l_Parent_0.Src.ContextItems);
local l_Http_0 = v1.Http;
local l_MockPlugin_0 = v1.TestHelpers.Instances.MockPlugin;
local v8 = require(l_Parent_0.Src.TestHelpers.MockTerrain);
local l_Localization_0 = l_ContextServices_0.Localization;
local v10 = require(l_Parent_0.Src.Reducers.MainReducer);
local v11 = require(l_Parent_0.Src.Resources.PluginTheme);
local v12 = require(l_Parent_0.Src.Resources.makeTheme);
local v13 = require(l_Parent_0.Src.Util.PluginActivationController);
local l_TerrainInterfaces_0 = l_Parent_0.Src.TerrainInterfaces;
local v15 = require(l_TerrainInterfaces_0.TerrainGenerationInstance);
local v16 = require(l_TerrainInterfaces_0.TerrainImporterInstance);
local v17 = require(l_TerrainInterfaces_0.TerrainSeaLevel);
local v18 = require(l_Parent_0.Src.Util.ShorelineController);
local v19 = require(l_Parent_0.Src.Util.SmoothVoxelsController);
local v20 = v2.PureComponent:extend(script.Name);
v20.createMocks = function()
    local v21 = l_MockPlugin_0.new();
    return {
        plugin = v21,
        mouse = v21:GetMouse(),
        store = v3.Store.new(v10),
        theme = v11.mock(),
        localization = l_Localization_0.mock(),
        terrain = v8.new(),
        networking = l_Http_0.Networking.mock()
    };
end;
v20.createMockContextItems = function(v22)
    local v23 = l_ContextServices_0.Analytics.mock();
    return {
        plugin = l_ContextServices_0.Plugin.new(v22.plugin),
        mouse = l_ContextServices_0.Mouse.new(v22.mouse),
        store = l_ContextServices_0.Store.new(v22.store),
        theme = v5.DEPRECATED_Theme.new(v22.theme),
        devFrameworkThemeItem = v12(true),
        localization = v22.localization,
        analytics = v23,
        networking = v22.networking,
        terrain = v5.Terrain.new(v22.terrain),
        pluginActivationController = v13.new(v22.plugin),
        terrainImporter = v16.new({
            terrain = v22.terrain,
            localization = v22.localization,
            analytics = v23,
            userId = 0
        }),
        terrainGeneration = v15.new({
            terrain = v22.terrain,
            localization = v22.localization,
            analytics = v23
        }),
        seaLevel = v17.new({
            terrain = v22.terrain,
            localization = v22.localization
        }),
        shorelineController = v18.new(v23, v22.plugin, v22.store, v22.terrain, true),
        smoothVoxelsController = v19.new(v23, v22.plugin, v22.store, v22.terrain, true)
    };
end;
v20.cleanupMocks = function(v24, v25)
    v25.smoothVoxelsController:destroy();
    v25.shorelineController:destroy();
    v25.seaLevel:destroy();
    v25.terrainGeneration:destroy();
    v25.terrainImporter:destroy();
    v25.pluginActivationController:destroy();
    v25.localization:destroy();
    v25.devFrameworkThemeItem:destroy();
    v25.theme:destroy();
    v24.store:destruct();
    v24.plugin:Destroy();
end;
v20.init = function(v26)
    v26.mocks = v20.createMocks();
    v26.mockItems = v20.createMockContextItems(v26.mocks);
end;
v20.willUnmount = function(v27)
    v20.cleanupMocks(v27.mocks, v27.mockItems);
    v27.mocks = {};
    v27.mockItems = {};
end;
v20.render = function(v28)
    return l_ContextServices_0.provide({
        v28.mockItems.plugin,
        v28.mockItems.mouse,
        v28.mockItems.store,
        v28.mockItems.theme,
        v28.mockItems.localization,
        v28.mockItems.analytics,
        v28.mockItems.pluginActivationController,
        v28.mockItems.terrainImporter,
        v28.mockItems.terrainGeneration,
        v28.mockItems.seaLevel,
        v28.mockItems.shorelineController,
        v28.mockItems.smoothVoxelsController
    }, {
        WrappedComponent = v2.createFragment(v28.props[v2.Children])
    });
end;
v20.createElementWithMockContext = function(v29, v30, v31)
    local v32 = true;
    if type(v29) ~= "function" then
        v32 = false;
        if type(v29) == "table" then
            v32 = type(v29.render) == "function";
        end;
    end;
    assert(v32, "MockWrapper.createElementWithMockContext passed invalid component");
    return v2.createElement(v20, {
        MyComponent = v2.createElement(v29, v30, v31)
    });
end;
return v20;


local _ = require(script.Parent.Parent.Parent.Packages.Framework).Util.Signal;
local v1 = {};
v1.__index = v1;
v1.new = function()
    return (setmetatable({}, v1));
end;
v1.IsA = function(_, v3)
    return v3 == "Terrain";
end;
v1.WriteVoxels = function(_, _, _, _, _)
end;
v1.ReadVoxels = function(_, _, _)
    return {
        size = Vector3.new(0, 0, 0)
    }, {
        size = Vector3.new(0, 0, 0)
    };
end;
v1.FillBall = function(_, _, _, _)
end;
v1.FillBlock = function(_, _, _, _)
end;
v1.FillCylinder = function(_, _, _, _, _)
end;
v1.Clear = function(_)
end;
v1.PasteRegion = function(_, _, _, _)
end;
v1.CopyRegion = function(_, _)
    return {};
end;
v1.ReplaceMaterial = function(_, _, _, _, _)
end;
v1.CanShorelinesBeUpgraded = function(_)
end;
return v1;


local v0 = require(script.Parent.Parent.Parent.Packages.Framework).ContextServices.ContextItem:extend("CalloutController");
v0.new = function(v1)
    local v2 = {
        _calloutService = v1 or game:GetService("CalloutService")
    };
    assert(v2._calloutService, "CalloutController requires a CalloutService");
    return (setmetatable(v2, v0));
end;
v0.defineCallout = function(v3, v4, v5, v6, v7)
    v3._calloutService:DefineCallout(v4, v5, v6, v7);
end;
v0.attachCallout = function(v8, v9, v10, v11)
    v8._calloutService:AttachCallout(v9, v10, v11);
end;
v0.detachCalloutsByDefinitionId = function(v12, v13)
    v12._calloutService:DetachCalloutsByDefinitionId(v13);
end;
return v0;


local l_game_FastInt_0 = game:GetFastInt("TerrainEditorScalingPrecision");
return function(v1, v2, v3)
    local v4 = {
        Vector3.new(v2.X / 2, v2.Y / 2, v2.Z / 2),
        Vector3.new(-v2.X / 2, v2.Y / 2, v2.Z / 2),
        Vector3.new(v2.X / 2, -v2.Y / 2, v2.Z / 2),
        Vector3.new(v2.X / 2, v2.Y / 2, -v2.Z / 2),
        Vector3.new(-v2.X / 2, -v2.Y / 2, v2.Z / 2),
        Vector3.new(-v2.X / 2, v2.Y / 2, -v2.Z / 2),
        Vector3.new(v2.X / 2, -v2.Y / 2, -v2.Z / 2),
        (Vector3.new(-v2.X / 2, -v2.Y / 2, -v2.Z / 2))
    };
    local v5 = Vector3.new(math.huge, math.huge, math.huge);
    local v6 = Vector3.new(-math.huge, -math.huge, -math.huge);
    for _, v8 in v4, nil, nil do
        local v9 = nil;
        v9 = if not v3 then v1 * v8 else v1.Position + v8;
        v5 = Vector3.new(math.min(v5.X, v9.X), math.min(v5.Y, v9.Y), (math.min(v5.Z, v9.Z)));
        v6 = Vector3.new(math.max(v6.X, v9.X), math.max(v6.Y, v9.Y), (math.max(v6.Z, v9.Z)));
    end;
    local l_l_game_FastInt_0_0 = l_game_FastInt_0;
    v5 = Vector3.new(math.round(v5.X * l_l_game_FastInt_0_0) / l_l_game_FastInt_0_0, math.round(v5.Y * l_l_game_FastInt_0_0) / l_l_game_FastInt_0_0, math.round(v5.Z * l_l_game_FastInt_0_0) / l_l_game_FastInt_0_0);
    v6 = Vector3.new(math.round(v6.X * l_l_game_FastInt_0_0) / l_l_game_FastInt_0_0, math.round(v6.Y * l_l_game_FastInt_0_0) / l_l_game_FastInt_0_0, math.round(v6.Z * l_l_game_FastInt_0_0) / l_l_game_FastInt_0_0);
    return (Region3int16.new(Vector3int16.new(math.floor(v5.X / 4), math.floor(v5.Y / 4), (math.floor(v5.Z / 4))), Vector3int16.new(math.ceil(v6.X / 4), math.ceil(v6.Y / 4), (math.ceil(v6.Z / 4)))));
end;


local l_Workspace_0 = game:GetService("Workspace");
local function _(v1, v2)
    v2 = v2 or false;
    return function()
        local l_TerrainToolsFlags_0 = l_Workspace_0:FindFirstChild("TerrainToolsFlags");
        if l_TerrainToolsFlags_0 and l_TerrainToolsFlags_0:FindFirstChild(v1) then
            return l_TerrainToolsFlags_0[v1].Value;
        else
            return v2;
        end;
    end;
end;
local v5 = {};
local v6 = nil or false;
local v7 = "RunningUnderCLI";
local l_v7_0 = v7 --[[ copy: 5 -> 6 ]];
local v9;
do
    local l_v6_0 = v6;
    v9 = function()
        local l_TerrainToolsFlags_1 = l_Workspace_0:FindFirstChild("TerrainToolsFlags");
        if l_TerrainToolsFlags_1 and l_TerrainToolsFlags_1:FindFirstChild(l_v7_0) then
            return l_TerrainToolsFlags_1[l_v7_0].Value;
        else
            return l_v6_0;
        end;
    end;
end;
v5.RunningUnderCLI = v9;
v6 = nil or false;
v7 = "RunTests";
local l_v7_1 = v7 --[[ copy: 5 -> 7 ]];
do
    local l_v6_1 = v6;
    v9 = function()
        local l_TerrainToolsFlags_2 = l_Workspace_0:FindFirstChild("TerrainToolsFlags");
        if l_TerrainToolsFlags_2 and l_TerrainToolsFlags_2:FindFirstChild(l_v7_1) then
            return l_TerrainToolsFlags_2[l_v7_1].Value;
        else
            return l_v6_1;
        end;
    end;
end;
v5.RunTests = v9;
v6 = nil or false;
v7 = "LogTestsQuiet";
local l_v7_2 = v7 --[[ copy: 5 -> 8 ]];
do
    local l_v6_2 = v6;
    v9 = function()
        local l_TerrainToolsFlags_3 = l_Workspace_0:FindFirstChild("TerrainToolsFlags");
        if l_TerrainToolsFlags_3 and l_TerrainToolsFlags_3:FindFirstChild(l_v7_2) then
            return l_TerrainToolsFlags_3[l_v7_2].Value;
        else
            return l_v6_2;
        end;
    end;
end;
v5.LogTestsQuiet = v9;
v6 = nil or false;
v7 = "RunDeveloperFrameworkTests";
local l_v7_3 = v7 --[[ copy: 5 -> 9 ]];
do
    local l_v6_3 = v6;
    v9 = function()
        local l_TerrainToolsFlags_4 = l_Workspace_0:FindFirstChild("TerrainToolsFlags");
        if l_TerrainToolsFlags_4 and l_TerrainToolsFlags_4:FindFirstChild(l_v7_3) then
            return l_TerrainToolsFlags_4[l_v7_3].Value;
        else
            return l_v6_3;
        end;
    end;
end;
v5.RunDeveloperFrameworkTests = v9;
v6 = nil or false;
v7 = "LogAnalytics";
local l_v7_4 = v7 --[[ copy: 5 -> 10 ]];
do
    local l_v6_4 = v6;
    v9 = function()
        local l_TerrainToolsFlags_5 = l_Workspace_0:FindFirstChild("TerrainToolsFlags");
        if l_TerrainToolsFlags_5 and l_TerrainToolsFlags_5:FindFirstChild(l_v7_4) then
            return l_TerrainToolsFlags_5[l_v7_4].Value;
        else
            return l_v6_4;
        end;
    end;
end;
v5.LogAnalytics = v9;
v6 = nil or false;
v7 = "SetCameraOnRegionImport";
do
    local l_v6_5 = v6;
    v9 = function()
        local l_TerrainToolsFlags_6 = l_Workspace_0:FindFirstChild("TerrainToolsFlags");
        if l_TerrainToolsFlags_6 and l_TerrainToolsFlags_6:FindFirstChild(v7) then
            return l_TerrainToolsFlags_6[v7].Value;
        else
            return l_v6_5;
        end;
    end;
end;
v5.SetCameraOnRegionImport = v9;
return v5;


local v0 = require(script.Parent.Parent.Parent.Packages.Framework);
local l_ContextItem_0 = v0.ContextServices.ContextItem;
local l_Signal_0 = v0.Util.Signal;
local function v5(v3)
    local l_ImageLabel_0 = Instance.new("ImageLabel");
    l_ImageLabel_0.Size = UDim2.new(0, 0, 0, 0);
    l_ImageLabel_0.BackgroundTransparency = 1;
    l_ImageLabel_0.Parent = v3;
    return l_ImageLabel_0;
end;
local v6 = l_ContextItem_0:extend("ImageLoader");
v6.new = function(v7)
    local v8 = setmetatable({
        ImageLoaded = l_Signal_0.new(),
        _loadedImagesCache = {},
        _imageLabelPool = {},
        _loadingImageLabels = {},
        _loadingImageIds = {},
        _alive = true,
        _createImageLabel = not not v7 and v7.createImageLabel or v5
    }, v6);
    v8._hostGui = Instance.new("ScreenGui");
    v8._hostGui.Name = "ImageLoader";
    v8._hostGui.Enabled = true;
    v8._hostGui.Parent = game:GetService("CoreGui");
    if not (v7 and v7._dontPoll) then
        spawn(function()
            v8:_pollImageLoop();
        end);
    end;
    return v8;
end;
v6.loadImage = function(v9, v10)
    if not (v10 ~= nil) or v10 == "" then
        return false;
    elseif not v9._loadedImagesCache[v10] then
        if not v9._loadingImageIds[v10] then
            local v11 = nil;
            v11 = if #v9._imageLabelPool > 0 then table.remove(v9._imageLabelPool) else v9._createImageLabel(v9._hostGui);
            v11.Image = v10;
            v9._loadingImageIds[v10] = true;
            table.insert(v9._loadingImageLabels, v11);
            return false;
        else
            return false;
        end;
    else
        v9.ImageLoaded:Fire(v10);
        return true;
    end;
end;
v6.hasImageLoaded = function(v12, v13)
    return v12._loadedImagesCache[v13] or false;
end;
v6.destroy = function(v14)
    v14._alive = false;
    for _, v16 in ipairs(v14._imageLabelPool) do
        v16:Destroy();
    end;
    v14._imageLabelPool = nil;
    for _, v18 in ipairs(v14._loadingImageLabels) do
        v18:Destroy();
    end;
    v14._loadingImageLabels = nil;
    v14._hostGui:Destroy();
    v14._hostGui = nil;
end;
v6._pollImageLoop = function(v19)
    while v19._alive do
        v19:_checkImages();
        wait(0.1);
    end;
end;
v6._checkImages = function(v20)
    local v21 = 1;
    while v21 <= #v20._loadingImageLabels do
        local v22 = v20._loadingImageLabels[v21];
        if not v22.IsLoaded then
            v21 = v21 + 1;
        else
            local l_Image_0 = v22.Image;
            v20._loadedImagesCache[l_Image_0] = true;
            v20.ImageLoaded:Fire(l_Image_0);
            v22.Image = "";
            v20._loadingImageIds[l_Image_0] = nil;
            table.remove(v20._loadingImageLabels, v21);
            table.insert(v20._imageLabelPool, v22);
        end;
    end;
end;
return v6;


local l_Parent_0 = script.Parent.Parent.Parent;
local l_Signal_0 = require(l_Parent_0.Packages.Framework).Util.Signal;
local v2 = require(l_Parent_0.Src.Util.quickWait);
local v3 = {};
v3.__index = v3;
v3.new = function(v4)
    assert(type(v4) == "table", "LongOperation needs an options table");
    local v5 = setmetatable({
        Started = l_Signal_0.new(),
        Paused = l_Signal_0.new(),
        Resumed = l_Signal_0.new(),
        PausedChanged = l_Signal_0.new(),
        Canceled = l_Signal_0.new(),
        Finished = l_Signal_0.new(),
        RunningChanged = l_Signal_0.new(),
        ProgressChanged = l_Signal_0.new(),
        _name = v4.name or "",
        _onStartFunc = v4.onStart,
        _onStepFunc = v4.onStep,
        _onPauseFunc = v4.onPause,
        _onResumeFunc = v4.onResume,
        _onCancelFunc = v4.onCancel,
        _onFinishFunc = v4.onFinish,
        _onErrorFunc = v4.onError,
        _timeBetweenSteps = v4.timeBetweenSteps or 0,
        _timeBetweenPauseChecks = v4.timeBetweenPauseChecks or 0.1,
        _operationData = {},
        _hasStarted = false,
        _isPaused = false,
        _wasCanceled = false,
        _hasFinished = false,
        _isRunning = false,
        _operationProgress = 0,
        _errorMessage = nil,
        _startTime = 0,
        _endTime = 0,
        _yieldTime = 0
    }, v3);
    assert(v5._onStepFunc and type(v5._onStepFunc) == "function", "LongOperation.new() requires an onStep callback");
    return v5;
end;
v3.destroy = function(v6)
    if not ((not v6._hasStarted or v6._hasFinished) or v6._wasCanceled) then
        v6:cancel();
    end;
end;
v3.start = function(v7, v8)
    if not v7._hasStarted then
        if v8 then
            assert(type(v8) == "table", "LongOperation:start() initialData should be nil or table");
            v7._operationData = v8;
        end;
        v7._hasStarted = true;
        v7._isRunning = true;
        v7._startTime = tick();
        v7.Started:Fire();
        v7.RunningChanged:Fire(true);
        spawn(function()
            v7:_runOperation();
        end);
        return ;
    else
        return ;
    end;
end;
v3.pause = function(v9)
    if not ((not v9._hasStarted or v9._hasFinished) or v9._wasCanceled) and not v9._isPaused then
        v9._isPaused = true;
        v9.Paused:Fire();
        v9.PausedChanged:Fire(true);
        return ;
    else
        return ;
    end;
end;
v3.resume = function(v10)
    if not ((not v10._hasStarted or v10._hasFinished) or v10._wasCanceled) and v10._isPaused then
        v10._isPaused = false;
        v10.Resumed:Fire();
        v10.PausedChanged:Fire(false);
        return ;
    else
        return ;
    end;
end;
v3.togglePause = function(v11)
    if not (not v11._hasStarted or v11._hasFinished) and not v11._wasCanceled then
        if not v11._isPaused then
            v11:pause();
            return ;
        else
            v11:resume();
            return ;
        end;
    else
        return ;
    end;
end;
v3.cancel = function(v12)
    if not (not v12._hasStarted or v12._hasFinished) and not v12._wasCanceled then
        v12._wasCanceled = true;
        v12.Canceled:Fire();
        return ;
    else
        return ;
    end;
end;
v3.getName = function(v13)
    return v13._name;
end;
v3.getOperationData = function(v14)
    return v14._operationData;
end;
v3.hasStarted = function(v15)
    return v15._hasStarted;
end;
v3.isPaused = function(v16)
    return v16._isPaused;
end;
v3.wasCanceled = function(v17)
    return v17._wasCanceled;
end;
v3.hasFinished = function(v18)
    return v18._hasFinished;
end;
v3.isRunning = function(v19)
    return v19._isRunning;
end;
v3.didError = function(v20)
    return not not v20._errorMessage;
end;
v3.getErrorMessage = function(v21)
    return v21._errorMessage;
end;
v3.getProgress = function(v22)
    return v22._operationProgress;
end;
v3._setProgress = function(v23, v24)
    if v23._operationProgress ~= v24 then
        v23._operationProgress = v24;
        v23.ProgressChanged:Fire(v24);
    end;
end;
v3.getTimeTaken = function(v25)
    if v25._hasFinished then
        return v25._endTime - v25._startTime;
    else
        return 0;
    end;
end;
v3.getYieldTime = function(v26)
    return v26._yieldTime;
end;
v3.getWorkTime = function(v27)
    if v27._hasFinished then
        return v27:getTimeTaken() - v27:getYieldTime();
    else
        return 0;
    end;
end;
v3._yield = function(v28, ...)
    local v29 = tick();
    v2(...);
    v28._yieldTime = v28._yieldTime + (tick() - v29);
end;
v3._handleError = function(v30, v31)
    if not v30:didError() then
        v30._errorMessage = tostring(v31) or "";
        v30:_runCallback(v30._onErrorFunc);
        return ;
    else
        return ;
    end;
end;
v3._runCallback = function(v32, v33)
    if v33 then
        local v34 = nil;
        if not xpcall(function()
            v34 = {
                v33(v32._operationData, v32)
            };
        end, function(v35)
            v32:_handleError(v35);
        end) then
            return false;
        else
            return true, unpack(v34);
        end;
    else
        return false;
    end;
end;
v3._runOperation = function(v36)
    v36:_runCallback(v36._onStartFunc);
    v36:_yield(v36._timeBetweenSteps);
    local v37 = false;
    while not v36:didError() do
        if not v36._wasCanceled then
            if not v36._isPaused then
                if not (v37 and not v36:_runCallback(v36._onResumeFunc)) then
                    v37 = false;
                    local v38, v39, v40 = v36:_runCallback(v36._onStepFunc);
                    if v38 then
                        v36:_setProgress(v40);
                        if v39 then
                            v36:_yield(v36._timeBetweenSteps);
                        else
                            break;
                        end;
                    else
                        break;
                    end;
                else
                    break;
                end;
            elseif not (not v37 and not v36:_runCallback(v36._onPauseFunc)) then
                v37 = true;
                v36:_yield(v36._timeBetweenPauseChecks);
            else
                break;
            end;
        else
            v36:_runCallback(v36._onCancelFunc);
            break;
        end;
    end;
    v36._hasFinished = true;
    v36._isRunning = false;
    v36._endTime = tick();
    v36.RunningChanged:Fire(false);
    v36:_runCallback(v36._onFinishFunc);
    v36.Finished:Fire();
end;
return v3;


local l_Parent_0 = script.Parent.Parent.Parent;
local l_Signal_0 = require(l_Parent_0.Packages.Framework).Util.Signal;
local v2 = require(l_Parent_0.Src.Util.quickWait);
local v3 = {};
v3.__index = v3;
v3.new = function(v4)
    local v5 = setmetatable({
        _timeBetweenOperations = (v4 or {}).timeBetweenOperations or 0,
        _queue = {},
        _currentOperationIndex = 0,
        _currentOperation = nil,
        _currentOperationConnections = nil,
        _lastOperationData = {},
        _lastOperationErrorMessage = nil,
        _queueRunning = false,
        QueueRunningChanged = l_Signal_0.new(),
        NextOperationStarted = l_Signal_0.new(),
        _paused = false,
        PausedChanged = l_Signal_0.new(),
        _progress = 0,
        ProgressChanged = l_Signal_0.new(),
        _wasCanceled = false
    }, v3);
    v5._updateProgress = function(v6)
        v5._progress = v6;
        v5.ProgressChanged:Fire(v6);
    end;
    v5._updatePaused = function(v7)
        v5._paused = v7;
        v5.PausedChanged:Fire(v7);
    end;
    v5._updateRunning = function(v8)
        if v8 then
            v5:_setQueueRunning(true);
        end;
    end;
    v5._operationFinished = function()
        v5:_cleanupCurrentOperation();
        if not v5._wasCanceled and not v5:didError() then
            if not v5:_hasNextOperation() then
                v5:_setQueueRunning(false);
                return ;
            else
                v2(v5._timeBetweenOperations);
                v5:_moveToNextOperation();
                v5:_startCurrentOperation();
                return ;
            end;
        else
            v5:_setQueueRunning(false);
            return ;
        end;
    end;
    return v5;
end;
v3.reset = function(v9)
    v9:destroy();
    v9._queue = {};
    v9._currentOperationIndex = 0;
    v9._lastOperationData = {};
    v9._queueRunning = false;
    v9._paused = false;
    v9._progress = 0;
    v9._wasCanceled = false;
    return v9;
end;
v3.destroy = function(v10)
    if v10._currentOperation then
        v10:_cleanupCurrentOperation();
    end;
end;
v3.addToQueue = function(v11, v12)
    table.insert(v11._queue, v12);
    return v11;
end;
v3.start = function(v13, v14)
    assert(not v13._currentOperation, "LongOperationQueue is already running an operation");
    assert(v13:_hasNextOperation(), "LongOperationQueue has no operation to run");
    if v14 then
        assert(type(v14) == "table", "LongOperationQueue:start() initialData should be nil or table");
        v13._lastOperationData = v14;
    end;
    v13:_moveToNextOperation();
    v13:_startCurrentOperation();
end;
v3.pause = function(v15)
    if v15._currentOperation then
        v15._currentOperation:pause();
    end;
end;
v3.resume = function(v16)
    if v16._currentOperation then
        v16._currentOperation:resume();
    end;
end;
v3.togglePause = function(v17)
    if v17._currentOperation then
        v17._currentOperation:togglePause();
    end;
end;
v3.cancel = function(v18)
    v18._wasCanceled = true;
    if v18._currentOperation then
        v18._currentOperation:cancel();
    end;
end;
v3.isQueueRunning = function(v19)
    return v19._queueRunning;
end;
v3.getProgress = function(v20)
    return v20._progress;
end;
v3.isPaused = function(v21)
    return v21._paused;
end;
v3.didError = function(v22)
    return not not v22._lastOperationErrorMessage;
end;
v3.getErrorMessage = function(v23)
    return v23._lastOperationErrorMessage;
end;
v3._setQueueRunning = function(v24, v25)
    if v24._queueRunning ~= v25 then
        v24._queueRunning = v25;
        v24.QueueRunningChanged:Fire(v25);
    end;
end;
v3._startCurrentOperation = function(v26)
    local l__currentOperation_0 = v26._currentOperation;
    assert(l__currentOperation_0, "LongOperationQueue:_startCurrentOperation() has no operation to start)");
    v26._updateProgress(0);
    v26.NextOperationStarted:Fire(l__currentOperation_0);
    l__currentOperation_0:start(v26._lastOperationData or {});
end;
v3._hasNextOperation = function(v28)
    return v28._currentOperationIndex + 1 <= #v28._queue;
end;
v3._moveToNextOperation = function(v29)
    assert(not v29._currentOperation, "LongOperationQueue is already running an operation");
    if v29:_hasNextOperation() then
        v29._currentOperationIndex = v29._currentOperationIndex + 1;
        v29._currentOperation = v29._queue[v29._currentOperationIndex];
        v29._currentOperationConnections = {
            progressChanged = v29._currentOperation.ProgressChanged:Connect(v29._updateProgress),
            pausedChanged = v29._currentOperation.PausedChanged:Connect(v29._updatePaused),
            runningChanged = v29._currentOperation.RunningChanged:Connect(v29._updateRunning),
            finished = v29._currentOperation.Finished:Connect(v29._operationFinished)
        };
        return true;
    else
        return false;
    end;
end;
v3._cleanupCurrentOperation = function(v30)
    assert(v30._currentOperation, "LongOperationQueue has no operation to clean up");
    v30._lastOperationData = v30._currentOperation:getOperationData();
    v30._lastOperationErrorMessage = v30._currentOperation:getErrorMessage();
    for _, v32 in pairs(v30._currentOperationConnections) do
        v32:Disconnect();
    end;
    v30._currentOperationConnections = nil;
    v30._currentOperation:destroy();
    v30._currentOperation = nil;
end;
return v3;


return {
    [Enum.Material.Air] = {
        enum = Enum.Material.Air,
        image = "mtrl_air.png",
        image_2022 = "mtrl_air.png"
    },
    [Enum.Material.Grass] = {
        enum = Enum.Material.Grass,
        image = "mtrl_grass.png",
        image_2022 = "mtrl_grass_2022.png"
    },
    [Enum.Material.Sand] = {
        enum = Enum.Material.Sand,
        image = "mtrl_sand.png",
        image_2022 = "mtrl_sand_2022.png"
    },
    [Enum.Material.Rock] = {
        enum = Enum.Material.Rock,
        image = "mtrl_rock.png",
        image_2022 = "mtrl_rock_2022.png"
    },
    [Enum.Material.Water] = {
        enum = Enum.Material.Water,
        image = "mtrl_water.png",
        image_2022 = "mtrl_water_2022.png",
        forceIgnoreWater = true,
        forceIgnoreWaterTo = false
    },
    [Enum.Material.Ground] = {
        enum = Enum.Material.Ground,
        image = "mtrl_ground.png",
        image_2022 = "mtrl_ground_2022.png"
    },
    [Enum.Material.Sandstone] = {
        enum = Enum.Material.Sandstone,
        image = "mtrl_sandstone.png",
        image_2022 = "mtrl_sandstone_2022.png"
    },
    [Enum.Material.Slate] = {
        enum = Enum.Material.Slate,
        image = "mtrl_slate.png",
        image_2022 = "mtrl_slate_2022.png"
    },
    [Enum.Material.Snow] = {
        enum = Enum.Material.Snow,
        image = "mtrl_snow.png",
        image_2022 = "mtrl_snow_2022.png"
    },
    [Enum.Material.Mud] = {
        enum = Enum.Material.Mud,
        image = "mtrl_mud.png",
        image_2022 = "mtrl_mud_2022.png"
    },
    [Enum.Material.Brick] = {
        enum = Enum.Material.Brick,
        image = "mtrl_brick.png",
        image_2022 = "mtrl_brick_2022.png",
        forceSnapToGrid = true
    },
    [Enum.Material.Concrete] = {
        enum = Enum.Material.Concrete,
        image = "mtrl_concrete.png",
        image_2022 = "mtrl_concrete_2022.png"
    },
    [Enum.Material.Glacier] = {
        enum = Enum.Material.Glacier,
        image = "mtrl_glacier.png",
        image_2022 = "mtrl_glacier_2022.png"
    },
    [Enum.Material.WoodPlanks] = {
        enum = Enum.Material.WoodPlanks,
        image = "mtrl_woodplanks.png",
        image_2022 = "mtrl_woodplanks_2022.png",
        forceSnapToGrid = true
    },
    [Enum.Material.CrackedLava] = {
        enum = Enum.Material.CrackedLava,
        image = "mtrl_crackedlava.png",
        image_2022 = "mtrl_crackedlava_2022.png"
    },
    [Enum.Material.Basalt] = {
        enum = Enum.Material.Basalt,
        image = "mtrl_basalt.png",
        image_2022 = "mtrl_basalt_2022.png"
    },
    [Enum.Material.Ice] = {
        enum = Enum.Material.Ice,
        image = "mtrl_ice.png",
        image_2022 = "mtrl_ice_2022.png"
    },
    [Enum.Material.Salt] = {
        enum = Enum.Material.Salt,
        image = "mtrl_salt.png",
        image_2022 = "mtrl_salt_2022.png"
    },
    [Enum.Material.Cobblestone] = {
        enum = Enum.Material.Cobblestone,
        image = "mtrl_cobblestone.png",
        image_2022 = "mtrl_cobblestone_2022.png"
    },
    [Enum.Material.Limestone] = {
        enum = Enum.Material.Limestone,
        image = "mtrl_limestone.png",
        image_2022 = "mtrl_limestone_2022.png"
    },
    [Enum.Material.Asphalt] = {
        enum = Enum.Material.Asphalt,
        image = "mtrl_asphalt.png",
        image_2022 = "mtrl_asphalt_2022.png"
    },
    [Enum.Material.LeafyGrass] = {
        enum = Enum.Material.LeafyGrass,
        image = "mtrl_leafygrass.png",
        image_2022 = "mtrl_leafygrass_2022.png"
    },
    [Enum.Material.Pavement] = {
        enum = Enum.Material.Pavement,
        image = "mtrl_pavement.png",
        image_2022 = "mtrl_pavement_2022.png"
    }
};


return function(v0, v1)
    local v2 = v0.Rotation * v1;
    return CFrame.new(v0.Position), (Vector3.new(math.abs(v2.x), math.abs(v2.y), (math.abs(v2.z))));
end;


local l_ContextServices_0 = require(script.Parent.Parent.Parent.Packages.Framework).ContextServices;
local l_ContextItem_0 = l_ContextServices_0.ContextItem;
local l_PluginActions_0 = l_ContextServices_0.PluginActions;
local v3 = l_ContextItem_0:extend("PluginActionsController");
v3.new = function(v4, v5)
    assert(v4, "PluginActionsController.new() requires a plugin");
    return (setmetatable({
        _pluginActions = l_PluginActions_0.new(v4, v5)
    }, v3));
end;
v3.Enable = function(v6, v7)
    v6:SetEnabled(v7, true);
end;
v3.Disable = function(v8, v9)
    v8:SetEnabled(v9, false);
end;
v3.SetEnabled = function(v10, v11, v12)
    v10._pluginActions:get(v11).Enabled = v12;
end;
v3.Connect = function(v13, v14, v15)
    return v13._pluginActions:get(v14).Triggered:Connect(v15);
end;
return v3;


return function(v0, v1, v2)
    v0.Size = nil;
    for v3, v4 in v0, nil, nil do
        for v5, v6 in v4, nil, nil do
            for v7, v8 in v6, nil, nil do
                if v8 == Enum.Material.Water then
                    if v2[v3][v5][v7] < v1[v3][v5][v7] then
                        v2[v3][v5][v7] = v1[v3][v5][v7];
                    end;
                    v1[v3][v5][v7] = 0;
                    v0[v3][v5][v7] = Enum.Material.Air;
                end;
            end;
        end;
    end;
end;


local v0 = require(script.Parent.isProtectedInstance);
return {
    arrayToSet = function(v1)
        local v2 = {};
        for _, v4 in ipairs(v1) do
            v2[v4] = true;
        end;
        return v2;
    end,
    diff = function(v5, v6)
        local v7 = {};
        for v8 in pairs(v5) do
            if not v6[v8] then
                v7[v8] = true;
            end;
        end;
        return v7;
    end,
    splitArrayIntoValidSets = function(v9, v10)
        local v11 = {};
        local v12 = {};
        for _, v14 in ipairs(v9) do
            if not v10(v14) then
                v12[v14] = true;
            else
                v11[v14] = true;
            end;
        end;
        return v11, v12;
    end,
    isAnyInstanceAncestorInSet = function(v15, v16)
        if not v0(v15) then
            while true do
                if not v15 then
                    return false;
                elseif not v16[v15] then
                    v15 = v15.Parent;
                else
                    return true;
                end;
            end;
        else
            return false;
        end;
    end
};


local l_Parent_0 = script.Parent.Parent.Parent;
local v1 = require(l_Parent_0.Packages.Framework);
local l_Actions_0 = l_Parent_0.Src.Actions;
local v3 = require(l_Actions_0.SetShorelinesUpgradePercent);
local v4 = require(l_Actions_0.SetShorelinesUpgradePossible);
local v5 = require(l_Actions_0.SetShorelinesUpgradeSuggestion);
local v6 = v1.ContextServices.ContextItem:extend("ShorelineController");
v6.new = function(v7, v8, v9, v10, v11)
    local v12 = setmetatable({
        _changeHistoryService = game:GetService("ChangeHistoryService"),
        _shorelineUpgraderService = game:GetService("ShorelineUpgraderService"),
        _analytics = v7,
        _plugin = v8,
        _store = v9,
        _terrain = v10,
        _mock = v11
    }, v6);
    if not v11 then
        v12._onShorelinesUpgradedChanged = v12._terrain:get():GetPropertyChangedSignal("ShorelinesUpgraded"):Connect(function()
            v12:checkUpgradeCapability();
        end);
        v12._dontAsk = v12._plugin:GetSetting("UpgradeShorelines_DontAsk");
        v12:checkUpgradeCapability();
        return v12;
    else
        return v12;
    end;
end;
v6.destroy = function(v13)
    if not v13._mock then
        if v13._onShorelinesUpgradedChanged then
            v13._onShorelinesUpgradedChanged:Disconnect();
        end;
        return ;
    else
        return ;
    end;
end;
v6.dismiss = function(v14, v15)
    if not v14._mock then
        v14._dismiss = true;
        v14._dontAsk = v15;
        v14._plugin:SetSetting("UpgradeShorelines_DontAsk", v15);
        v14._analytics:report("upgradeShorelinesDismiss", v15);
        v14:checkUpgradeCapability();
        return ;
    else
        return ;
    end;
end;
v6.checkUpgradeCapability = function(v16)
    if not v16._mock then
        local v17 = v16._terrain:get();
        local v18 = v17 and v17:CanShorelinesBeUpgraded();
        v16._store:dispatch(v4(v18));
        v16._store:dispatch(v5(((not v16._dontAsk and not v16._dismiss) and not v16._updating) and v18));
        return ;
    else
        return ;
    end;
end;
v6.cancel = function(v19)
    if not v19._mock then
        v19._updating = false;
        local l_ShorelinesUpgradePercent_0 = v19._store:getState().Tools.ShorelinesUpgradePercent;
        if not (l_ShorelinesUpgradePercent_0 < 0) or l_ShorelinesUpgradePercent_0 < 1 then
            v19._shorelineUpgraderService:Cancel();
            v19._analytics:report("upgradeShorelinesCancel");
            v19._store:dispatch(v3(-1));
        end;
        return ;
    else
        return ;
    end;
end;
v6.start = function(v21, v22)
    if not v21._mock then
        v21._updating = true;
        v21._shorelineUpgraderService:Start();
        v21._shorelineUpgraderService.Status:Connect(function(v23)
            v21._store:dispatch(v3(v23));
            v21:checkUpgradeCapability();
        end);
        v21._analytics:report("upgradeShorelinesAction", v22);
        return ;
    else
        return ;
    end;
end;
return v6;


local l_Parent_0 = script.Parent.Parent.Parent;
local v1 = require(l_Parent_0.Packages.Framework);
local l_Actions_0 = l_Parent_0.Src.Actions;
local v3 = require(l_Actions_0.SetSmoothVoxelsUpgradePercent);
local v4 = require(l_Actions_0.SetSmoothVoxelsUpgradePossible);
local v5 = require(l_Actions_0.SetSmoothVoxelsUpgradeSuggestion);
local v6 = v1.ContextServices.ContextItem:extend("SmoothVoxelsController");
v6.new = function(v7, v8, v9, v10, v11)
    local v12 = setmetatable({
        _changeHistoryService = game:GetService("ChangeHistoryService"),
        _smoothVoxelsUpgraderService = game:GetService("SmoothVoxelsUpgraderService"),
        _analytics = v7,
        _plugin = v8,
        _store = v9,
        _terrain = v10,
        _mock = v11
    }, v6);
    if not v11 then
        local v13 = v12._terrain:get();
        v12._onSmoothVoxelsUpgradedChanged = v13:GetPropertyChangedSignal("SmoothVoxelsUpgraded"):Connect(function()
            v12:checkUpgradeCapability();
        end);
        v12._onShorelinesUpgradedChanged = v13:GetPropertyChangedSignal("ShorelinesUpgraded"):Connect(function()
            v12:checkUpgradeCapability();
        end);
        v12._dontAsk = v12._plugin:GetSetting("UpgradeSmoothVoxels_DontAsk");
        v12:checkUpgradeCapability();
        return v12;
    else
        return v12;
    end;
end;
v6.destroy = function(v14)
    if not v14._mock then
        if v14._onSmoothVoxelsUpgradedChanged then
            v14._onSmoothVoxelsUpgradedChanged:Disconnect();
        end;
        if v14._onShorelinesUpgradedChanged then
            v14._onShorelinesUpgradedChanged:Disconnect();
        end;
        return ;
    else
        return ;
    end;
end;
v6.dismiss = function(v15, v16)
    if not v15._mock then
        v15._dismiss = true;
        v15._dontAsk = v16;
        v15._plugin:SetSetting("UpgradeSmoothVoxels_DontAsk", v16);
        v15._analytics:report("upgradeSmoothVoxelsDismiss", v16);
        v15:checkUpgradeCapability();
        return ;
    else
        return ;
    end;
end;
v6.checkUpgradeCapability = function(v17)
    if not v17._mock then
        local v18 = v17._terrain:get();
        local v19 = v18 and v18:CanSmoothVoxelsBeUpgraded();
        v17._store:dispatch(v4(v19));
        v17._store:dispatch(v5(((not v17._dontAsk and not v17._dismiss) and not v17._updating) and v19));
        return ;
    else
        return ;
    end;
end;
v6.cancel = function(v20)
    if not v20._mock then
        v20._updating = false;
        local l_SmoothVoxelsUpgradePercent_0 = v20._store:getState().Tools.SmoothVoxelsUpgradePercent;
        if not (l_SmoothVoxelsUpgradePercent_0 < 0) or l_SmoothVoxelsUpgradePercent_0 < 1 then
            v20._smoothVoxelsUpgraderService:Cancel();
            v20._analytics:report("upgradeSmoothVoxelsCancel");
            v20._store:dispatch(v3(-1));
        end;
        return ;
    else
        return ;
    end;
end;
v6.start = function(v22, v23)
    if not v22._mock then
        v22._updating = true;
        v22._smoothVoxelsUpgraderService:Start();
        v22._smoothVoxelsUpgraderService.Status:Connect(function(v24)
            v22._store:dispatch(v3(v24));
            v22:checkUpgradeCapability();
        end);
        v22._analytics:report("upgradeSmoothVoxelsAction", v23);
        return ;
    else
        return ;
    end;
end;
return v6;


return {
    ToolId = {
        Generate = "Generate",
        Import = "Import",
        ImportLocal = "ImportLocal",
        SeaLevel = "SeaLevel",
        Replace = "Replace",
        Clear = "Clear",
        Select = "Select",
        Transform = "Transform",
        Move = "Move",
        Resize = "Resize",
        Rotate = "Rotate",
        Copy = "Copy",
        Paste = "Paste",
        Delete = "Delete",
        Fill = "Fill",
        Material = "Material",
        Add = "Add",
        Subtract = "Subtract",
        Grow = "Grow",
        Erode = "Erode",
        Smooth = "Smooth",
        Flatten = "Flatten",
        Draw = "Draw",
        Sculpt = "Sculpt",
        Paint = "Paint",
        None = "None"
    },
    TabId = {
        Create = "Create",
        Build = "Build",
        Region = "Region",
        Sculpt = "Sculpt",
        Paint = "Paint",
        Edit = "Edit"
    },
    PivotType = {
        Top = "Top",
        Center = "Cen",
        Bottom = "Bot"
    },
    PlaneLockType = {
        Off = "Off",
        Auto = "Auto",
        Manual = "Manual"
    },
    FlattenMode = {
        Erode = "Erode",
        Both = "Both",
        Grow = "Grow"
    },
    BrushShape = {
        Sphere = "Sphere",
        Cube = "Cube",
        Cylinder = "Cylinder"
    },
    Biome = {
        Water = "Water",
        Plains = "Plains",
        Dunes = "Dunes",
        Mountains = "Mountains",
        Arctic = "Arctic",
        Marsh = "Marsh",
        Hills = "Hills",
        Canyons = "Canyons",
        Lavascape = "Lavascape"
    },
    Shape = {
        Block = "Block",
        Cylinder = "Cylinder",
        CylinderRotate = "CylinderRotate",
        Ball = "Ball",
        Wedge = "Wedge"
    },
    ReplaceMode = {
        Box = "Box",
        Brush = "Brush"
    },
    TransformMode = {
        Duplicate = "Duplicate",
        Move = "Move",
        Paste = "Paste"
    },
    ImportMaterialMode = {
        DefaultMaterial = "DefaultMaterial",
        Colormap = "Colormap"
    },
    BrushMode = {
        Add = "Add",
        Subtract = "Subtract"
    }
};


local l_PivotType_0 = require(script.Parent.TerrainEnums).PivotType;
return function(v1, v2, v3)
    local v4 = v3 / 2;
    if v1 == l_PivotType_0.Top then
        return (Vector3.new(v2.x, v2.y - v4, v2.z));
    elseif v1 == l_PivotType_0.Center then
        return v2;
    elseif v1 == l_PivotType_0.Bottom then
        return (Vector3.new(v2.x, v2.y + v4, v2.z));
    else
        return v2;
    end;
end;


local v0 = require(script.Parent.Parent.Parent.Src.Util.ConvertTransformToRegion);
return function(v1, v2, v3, v4, v5)
    if not v5 then
        v2:ApplyTransform(v3.Rotation, v4);
    end;
    v1:PasteRegion(v2, v0(v3, v4).Min, false);
end;


local l_Parent_0 = script.Parent.Parent.Parent;
local v1 = require(l_Parent_0.Packages.Cryo);
local v2 = require(l_Parent_0.Src.Util.DebugFlags);
local l_HttpService_0 = game:GetService("HttpService");
local l_StudioService_0 = game:GetService("StudioService");
return function(v5)
    local function v9(v6, v7)
        local v8 = v1.Dictionary.join({
            studioSid = v5:GetSessionId(),
            clientId = v5:GetClientId(),
            placeId = game.PlaceId,
            userId = l_StudioService_0:GetUserId()
        }, v7 or {});
        if v2.LogAnalytics() then
            print(("Terrain SendEvent eventName=%s args=%s"):format(tostring(v6), l_HttpService_0:JSONEncode(v8)));
        end;
        v5:SendEventDeferred("studio", "Terrain", v6, v8);
    end;
    local function _(v10, v11)
        v11 = v11 or 1;
        if v2.LogAnalytics() then
            print(("Terrain ReportCounter counterName=%s count=%s"):format(tostring(v10), (tostring(v11))));
        end;
        v5:ReportCounter(v10, v11);
    end;
    return {
        changeTool = function(_, v14)
            v9("ToolSelected", {
                name = v14
            });
        end,
        changeTab = function(_, v16)
            v9("TabSelected", {
                name = v16
            });
        end,
        toggleWidget = function()
            local v17 = nil or 1;
            if v2.LogAnalytics() then
                print(("Terrain ReportCounter counterName=%s count=%s"):format(tostring("TerrainToolsToggleButton"), (tostring(v17))));
            end;
            v5:ReportCounter("TerrainToolsToggleButton", v17);
            v9("ToggleWidget");
        end,
        openWidget = function()
            local v18 = nil or 1;
            if v2.LogAnalytics() then
                print(("Terrain ReportCounter counterName=%s count=%s"):format(tostring("TerrainToolsOpenWidget"), (tostring(v18))));
            end;
            v5:ReportCounter("TerrainToolsOpenWidget", v18);
            v9("OpenWidget");
        end,
        closeWidget = function()
            local v19 = nil or 1;
            if v2.LogAnalytics() then
                print(("Terrain ReportCounter counterName=%s count=%s"):format(tostring("TerrainToolsCloseWidget"), (tostring(v19))));
            end;
            v5:ReportCounter("TerrainToolsCloseWidget", v19);
            v9("CloseWidget");
        end,
        generateTerrain = function(_, v21, v22, v23)
            v9("GenerateTerrain", {
                numVoxels = v21,
                biomesize = v22,
                seed = v23
            });
        end,
        useBrushTool = function(_, v25)
            v9("UseTerrainTool", {
                toolName = v25
            });
        end,
        useBrushToolExtended = function(_, v27)
            v9("UseTerrainTool", {
                toolName = v27.currentTool,
                brushShape = v27.brushShape,
                cursorSize = v27.cursorSize,
                cursorHeight = v27.cursorHeight,
                strength = v27.strength,
                material = v27.material,
                autoMaterial = v27.autoMaterial,
                flattenMode = v27.flattenMode,
                pivot = v27.pivot,
                ignoreWater = v27.ignoreWater,
                ignoreParts = v27.ignoreParts,
                planeLock = v27.planeLock,
                fixedPlane = v27.fixedPlane,
                snapToVoxel = v27.snapToVoxel,
                planePositionY = v27.planePositionY,
                source = v27.source,
                target = v27.target
            });
        end,
        importTerrain = function(_, v29, v30, v31)
            v9("ImportTerrain", {
                regionDims = ("%d,%d,%d)"):format(v29.Size.x, v29.Size.y, v29.Size.z),
                heightMapUrl = v30,
                colorMapUrl = v31
            });
        end,
        importTerrainLocal = function(_, v33, v34, v35, v36, v37)
            local v38 = {
                regionDims = ("%d,%d,%d)"):format(v33.Size.x, v33.Size.y, v33.Size.z),
                heightMapImgDims = ("%d, %d"):format(v35.width, v35.height),
                heightMapChannels = v35.channels,
                material = v34,
                guid = v37
            };
            if next(v36) then
                v38.colorMapImgDims = ("%d, %d"):format(v36.width, v36.height);
                v38.colorMapChannels = v36.channels;
            end;
            v9("ImportTerrainLocal", v38);
        end,
        importTerrainLocalHeightMap = function(_, v40, v41)
            v9("ImportTerrainHeightmapMapping", {
                assetId = v40,
                guid = v41
            });
        end,
        importTerrainLocalColorMap = function(_, v43, v44)
            v9("ImportTerrainColormapMapping", {
                assetId = v43,
                guid = v44
            });
        end,
        upgradeShorelinesAction = function(_, v46)
            v9("UpgradeShorelinesAction", {
                source = v46
            });
        end,
        upgradeShorelinesCancel = function(_)
            v9("UpgradeShorelinesCancel", {});
        end,
        upgradeShorelinesDismiss = function(_, v49)
            v9("UpgradeShorelinesDismiss", {
                dontAsk = v49
            });
        end,
        upgradeSmoothVoxelsAction = function(_, v51)
            v9("UpgradeSmoothVoxelsAction", {
                source = v51
            });
        end,
        upgradeSmoothVoxelsCancel = function(_)
            v9("UpgradeSmoothVoxelsCancel", {});
        end,
        upgradeSmoothVoxelsDismiss = function(_, v54)
            v9("UpgradeSmoothVoxelsDismiss", {
                dontAsk = v54
            });
        end,
        regionAction = function(_, v56)
            local v57 = "TerrainToolsRegion" .. v56;
            local v58 = nil or 1;
            if v2.LogAnalytics() then
                print(("Terrain ReportCounter counterName=%s count=%s"):format(tostring(v57), (tostring(v58))));
            end;
            v5:ReportCounter(v57, v58);
        end,
        regionMode = function(_, v60)
            local v61 = "TerrainToolsRegionMode" .. v60;
            local v62 = nil or 1;
            if v2.LogAnalytics() then
                print(("Terrain ReportCounter counterName=%s count=%s"):format(tostring(v61), (tostring(v62))));
            end;
            v5:ReportCounter(v61, v62);
        end
    };
end;


local v0 = require(script.Parent.Parent.Parent.Src.Util.TerrainEnums);
local l_ToolId_0 = v0.ToolId;
local l_BrushShape_0 = v0.BrushShape;
return function(v3)
    local v4 = {};
    for v5, v6 in pairs(v3) do
        v4[v5] = v6;
    end;
    if v4.currentTool == l_ToolId_0.Flatten then
        v4.planeLock = nil;
        if not v4.fixedPlane then
            v4.planePositionY = nil;
        end;
    else
        v4.flattenMode = nil;
        v4.fixedPlane = nil;
        v4.planePositionY = nil;
    end;
    if (v4.currentTool ~= l_ToolId_0.Add and v4.currentTool ~= l_ToolId_0.Grow) and v4.currentTool ~= l_ToolId_0.Paint then
        v4.material = nil;
        v4.autoMaterial = nil;
    else
        v4.material = v4.material.Name;
        if v4.currentTool == l_ToolId_0.Paint then
            v4.autoMaterial = nil;
        end;
    end;
    if v4.currentTool ~= l_ToolId_0.Replace then
        v4.source = nil;
        v4.target = nil;
    else
        v4.source = v4.source.Name;
        v4.target = v4.target.Name;
    end;
    if v3.brushShape == l_BrushShape_0.Sphere then
        v4.cursorHeight = nil;
    end;
    return v4;
end;


local v0 = require(script.Parent.Constants);
return function(v1, v2)
    local v3 = v1:Inverse();
    local v4 = v2 * v3.RightVector;
    local v5 = v2 * v3.UpVector;
    local v6 = v2 * v3.LookVector;
    local v7 = (math.abs(v4.x) + math.abs(v4.y)) + math.abs(v4.z);
    local v8 = (math.abs(v5.x) + math.abs(v5.y)) + math.abs(v5.z);
    local v9 = (math.abs(v6.x) + math.abs(v6.y)) + math.abs(v6.z);
    local l_Position_0 = v1.Position;
    local v11 = Vector3.new(v7, v8, v9) / 2;
    return Region3.new(l_Position_0 - v11, l_Position_0 + v11):ExpandToGrid(v0.VOXEL_RESOLUTION);
end;


return function(v0, v1, v2)
    return {
        TopFront = {
            CFrame = v0 * CFrame.new(0, v1.Y / 2, v1.Z / 2),
            Size = Vector3.new(v1.X + v2, v2, v2)
        },
        BottomFront = {
            CFrame = v0 * CFrame.new(0, -v1.Y / 2, v1.Z / 2),
            Size = Vector3.new(v1.X + v2, v2, v2)
        },
        LeftFront = {
            CFrame = v0 * CFrame.new(-v1.X / 2, 0, v1.Z / 2),
            Size = Vector3.new(v2, v1.Y + v2, v2)
        },
        RightFront = {
            CFrame = v0 * CFrame.new(v1.X / 2, 0, v1.Z / 2),
            Size = Vector3.new(v2, v1.Y + v2, v2)
        },
        TopBack = {
            CFrame = v0 * CFrame.new(0, v1.Y / 2, -v1.Z / 2),
            Size = Vector3.new(v1.X + v2, v2, v2)
        },
        BottomBack = {
            CFrame = v0 * CFrame.new(0, -v1.Y / 2, -v1.Z / 2),
            Size = Vector3.new(v1.X + v2, v2, v2)
        },
        LeftBack = {
            CFrame = v0 * CFrame.new(-v1.X / 2, 0, -v1.Z / 2),
            Size = Vector3.new(v2, v1.Y + v2, v2)
        },
        RightBack = {
            CFrame = v0 * CFrame.new(v1.X / 2, 0, -v1.Z / 2),
            Size = Vector3.new(v2, v1.Y + v2, v2)
        },
        TopLeft = {
            CFrame = v0 * CFrame.new(-v1.X / 2, v1.Y / 2, 0),
            Size = Vector3.new(v2, v2, v1.Z + v2)
        },
        BottomLeft = {
            CFrame = v0 * CFrame.new(-v1.X / 2, -v1.Y / 2, 0),
            Size = Vector3.new(v2, v2, v1.Z + v2)
        },
        TopRight = {
            CFrame = v0 * CFrame.new(v1.X / 2, v1.Y / 2, 0),
            Size = Vector3.new(v2, v2, v1.Z + v2)
        },
        BottomRight = {
            CFrame = v0 * CFrame.new(v1.X / 2, -v1.Y / 2, 0),
            Size = Vector3.new(v2, v2, v1.Z + v2)
        }
    };
end;


local v0 = require(script.Parent.Parent.Parent.Src.Util.Constants);
return function(v1, v2)
    local v3 = v1.Position / v0.GRID_SIZE;
    local v4 = Vector3.new(math.floor(v3.x) * v0.GRID_SIZE, math.floor(v3.y) * v0.GRID_SIZE, math.floor(v3.z) * v0.GRID_SIZE);
    local v5 = v2.Position / v0.GRID_SIZE;
    local v6 = Vector3.new(math.floor(v5.x) * v0.GRID_SIZE, math.floor(v5.y) * v0.GRID_SIZE, math.floor(v5.z) * v0.GRID_SIZE);
    local v7 = v4:Min(v6);
    local v8 = v6:Max(v4);
    return {
        size = (v8 - v7):Max((Vector3.new(v0.GRID_SIZE, v0.GRID_SIZE, v0.GRID_SIZE))),
        transform = CFrame.new((v8 + v7) / 2)
    };
end;


local l_Shape_0 = require(script.Parent.TerrainEnums).Shape;
local v21 = {
    [l_Shape_0.Block] = function(v1, v2, v3)
        local v4 = v2:VectorToObjectSpace(v1);
        return (math.min(v3.x - math.abs(v4.x), v3.y - math.abs(v4.y), v3.z - math.abs(v4.z), 1));
    end,
    [l_Shape_0.Ball] = function(v5, v6, v7)
        local v8 = v6:VectorToObjectSpace(v5);
        return (math.min(v7.x - math.abs(v8.x), math.min(v7.x, v7.y, v7.z) - v8.Magnitude, 1));
    end,
    [l_Shape_0.CylinderRotate] = function(v9, v10, v11)
        local v12 = v10:VectorToObjectSpace(v9);
        return (math.min(v11.x - math.abs(v12.x), math.min(v11.y, v11.z) - math.sqrt(v12.y * v12.y + v12.z * v12.z), 1));
    end,
    [l_Shape_0.Cylinder] = function(v13, v14, v15)
        local v16 = v14:VectorToObjectSpace(v13);
        return (math.min(v15.y - math.abs(v16.y), math.min(v15.x, v15.z) - math.sqrt(v16.x * v16.x + v16.z * v16.z), 1));
    end,
    [l_Shape_0.Wedge] = function(v17, v18, v19)
        local v20 = v18:VectorToObjectSpace(v17);
        return v20.z * (v19.y / v19.z) - v20.y > 1 and math.min(v19.x - math.abs(v20.x), v19.y - math.abs(v20.y), v19.z - math.abs(v20.z), 1) or 0;
    end
};
return function(v22)
    assert(v21[v22], ("getShapeFunction() got invalid shape \"%s\""):format((tostring(v22))));
    return v21[v22];
end;


local v0 = require(script.Parent.Parent.Parent.Src.Util.DebugFlags);
local l_Workspace_0 = game:GetService("Workspace");
local v2 = nil;
local function _()
    v2 = nil;
    local l_Terrain_0 = l_Workspace_0.Terrain;
    if not (l_Terrain_0 and l_Terrain_0:IsA("Terrain")) then
        l_Workspace_0:GetPropertyChangedSignal("Terrain"):Wait();
        l_Terrain_0 = l_Workspace_0.Terrain;
    end;
    v2 = l_Terrain_0;
end;
return function()
    assert(not v0.RunningUnderCLI(), "getTerrain() is disabled under CLI where Workspace.Terrain does not exist");
    if not v2 then
        v2 = nil;
        local l_Terrain_1 = l_Workspace_0.Terrain;
        if not (l_Terrain_1 and l_Terrain_1:IsA("Terrain")) then
            l_Workspace_0:GetPropertyChangedSignal("Terrain"):Wait();
            l_Terrain_1 = l_Workspace_0.Terrain;
        end;
        v2 = l_Terrain_1;
    end;
    return v2;
end;


local function v0()
end;
return function(v1)
    if xpcall(function()
        local _ = v1.Name;
    end, v0) then
        return false;
    else
        return true;
    end;
end;


local l_RenderStepped_0 = game:GetService("RunService").RenderStepped;
local l_Heartbeat_0 = game:GetService("RunService").Heartbeat;
local l_TerrainEditorFixQuickWait_0 = game:GetFastFlag("TerrainEditorFixQuickWait");
local function v3(v4)
    if not v4 or v4 == 0 then
        if not l_TerrainEditorFixQuickWait_0 then
            l_RenderStepped_0:wait();
            return ;
        else
            l_Heartbeat_0:wait();
            return ;
        end;
    else
        if v4 < 0.033333 then
            local v5 = tick();
            if not l_TerrainEditorFixQuickWait_0 then
                l_RenderStepped_0:wait();
            else
                l_Heartbeat_0:wait();
            end;
            local v6 = tick() - v5;
            if v6 <= v4 * 0.5 then
                v3(v4 - v6);
                return ;
            end;
        else
            wait(v4);
        end;
        return ;
    end;
end;
return v3;


require(script.Parent.defineLuaFlags);
if plugin then
    local l_Parent_0 = script.Parent.Parent;
    if game:GetFastFlag("EnableTextureGenerator2") then
        local v1 = require(l_Parent_0.Packages.React);
        local v2 = require(l_Parent_0.Packages.ReactRoblox);
        local v3 = require(l_Parent_0.Src.MainPlugin);
        local v4 = nil;
        local function v6()
            plugin.Name = l_Parent_0.Name;
            local v5 = v1.createElement(v3, {
                Plugin = plugin
            });
            v4 = v2.createRoot(Instance.new("Frame"));
            v4:render(v5);
        end;
        plugin.Unloading:Connect(function()
            if v4 then
                v4:render(nil);
                v4 = nil;
            end;
        end);
        v6();
        return ;
    else
        return ;
    end;
else
    return ;
end;


local l_script_FirstAncestor_0 = script:FindFirstAncestor("TextureGenerator");
local v1 = require(l_script_FirstAncestor_0.Packages.React);
local v2 = require(l_script_FirstAncestor_0.Packages.ReactUtils);
local l_ContextStack_0 = v2.ContextStack;
local l_useToggleState_0 = v2.useToggleState;
local v5 = require(l_script_FirstAncestor_0.Src.Components.GenerationsProvider);
local v6 = require(l_script_FirstAncestor_0.Src.Components.OptionsProvider);
local v7 = require(l_script_FirstAncestor_0.Src.Components.PreviewProvider);
local v8 = require(l_script_FirstAncestor_0.Src.Components.Screens.GenerationScreen);
local v9 = require(l_script_FirstAncestor_0.Src.Components.Screens.TermsOfServiceScreen);
local v10 = require(l_script_FirstAncestor_0.Src.Util.Constants);
local v11 = game:DefineFastFlag("TextureGeneratorAddTermsOfServicePage", false);
return function(v12)
    if not v11 then
        return v1.createElement(l_ContextStack_0, {
            providers = {
                v1.createElement(v5),
                v1.createElement(v6),
                v1.createElement(v7)
            }
        }, v1.createElement(v8));
    else
        local v13 = l_useToggleState_0(v12.Plugin:GetSetting(v10.TEXTURE_GENERATOR_LEGAL_ACCEPT));
        if v13.enabled then
            return v1.createElement(l_ContextStack_0, {
                providers = {
                    v1.createElement(v5),
                    v1.createElement(v6),
                    v1.createElement(v7)
                }
            }, v1.createElement(v8));
        else
            return v1.createElement(v9, {
                Plugin = v12.Plugin,
                AcceptedButtonEnable = v13.enable
            });
        end;
    end;
end;


local l_script_FirstAncestor_0 = script:FindFirstAncestor("TextureGenerator");
local v1 = require(l_script_FirstAncestor_0.Packages.React);
local v2 = require(l_script_FirstAncestor_0.Packages.Framework);
local _ = require(l_script_FirstAncestor_0.Src.Types);
local l_Localization_0 = v2.ContextServices.Localization;
local l_Components_0 = l_script_FirstAncestor_0.Src.Components;
local v6 = require(l_Components_0.Options);
local v7 = require(l_Components_0.PreviewArea);
local v8 = require(l_Components_0.PromptEntry);
local v9 = require(l_Components_0.ViewSelector);
local v10 = require(l_script_FirstAncestor_0.Src.Hooks.useSelectedMeshParts);
local l_UI_0 = v2.UI;
local l_Alert_0 = l_UI_0.Alert;
local l_Pane_0 = l_UI_0.Pane;
local l_TextLabel_0 = l_UI_0.TextLabel;
local l_Stylizer_0 = v2.Style.Stylizer;
local _ = v2.Util.StyleModifier;
local l_LayoutOrderIterator_0 = v2.Util.LayoutOrderIterator;
local v18 = require(l_script_FirstAncestor_0.Src.Util.Constants);
local v19 = require(l_script_FirstAncestor_0.Src.Util.createHashFromMeshParts);
local v20 = require(l_script_FirstAncestor_0.Src.Util.PreviewsContext);
local function v26(v21, v22)
    for v23, v24 in v21.previews, nil, nil do
        if v21.modelToPreview[v22] == v23 then
            local v25 = table.clone(v24);
            v25.uuid = v23;
            if v24.status == v18.STATUS.FAILED then
                return nil;
            else
                return v25;
            end;
        end;
    end;
    return nil;
end;
return function(v27)
    local v28 = v1.useContext(v20);
    local v29 = l_Localization_0:use();
    local v30 = l_Stylizer_0:use("EntryArea");
    local v31 = l_LayoutOrderIterator_0.new();
    local v32 = v10();
    local v33 = v19(v32);
    local v34 = v26(v28, v33);
    local v35 = v28.getTopError(v33);
    local v36 = next(v32) ~= nil;
    local v37 = v34 ~= nil;
    local v38 = {};
    if v36 or v37 then
        if not v36 or v37 then
            if not (not v36 or not v37) then
                v38.PreviewArea = v1.createElement(v7, {
                    LayoutOrder = v31:getNextOrder(),
                    PreviewData = v34
                });
            end;
        else
            v38.ViewSelector = v1.createElement(v9, {
                LayoutOrder = v31:getNextOrder(),
                MeshParts = v32
            });
            v38.PromptEntry = v1.createElement(v8, {
                LayoutOrder = v31:getNextOrder()
            });
            v38.Options = v1.createElement(v6, {
                LayoutOrder = v31:getNextOrder()
            });
        end;
    else
        v38.SelectText = v1.createElement(l_TextLabel_0, {
            AutomaticSize = Enum.AutomaticSize.XY,
            AnchorPoint = Vector2.new(0.5, 0.5),
            Size = UDim2.fromOffset(150, 100),
            Position = UDim2.fromScale(0.5, 0.5),
            RichText = true,
            Text = v29:getText("EntryArea", "NoSelectionMessage"),
            TextWrapped = true,
            TextXAlignment = Enum.TextXAlignment.Center,
            TextYAlignment = Enum.TextYAlignment.Center
        });
    end;
    v1.useMemo(function()
        if not v33 or #v33 <= 0 then
            return ;
        elseif v28.total > 0 and v28.quota <= 0 then
            v28.addError(v33, "PreviewUsageAlert", v29:getText("PreviewUsageAlert", "Title"), v29:getText("PreviewUsageAlert", "Description", {
                total = v28.total
            }), "warning");
            return ;
        else
            v28.removeErrorById(v33, "PreviewUsageAlert");
            return ;
        end;
    end, {
        v33,
        v28.quota,
        v28.total
    });
    local function _(v39)
        if v39 == "warning" then
            return "Warning";
        elseif v39 == "error" then
            return "Error";
        elseif v39 == "info" then
            return "Info";
        elseif v39 == "success" then
            return "Success";
        else
            return "Error";
        end;
    end;
    local l_createElement_0 = v1.createElement;
    local l_l_Pane_0_0 = l_Pane_0;
    local v43 = {
        AutomaticSize = Enum.AutomaticSize.Y,
        BackgroundColor = v30.BackgroundColor,
        LayoutOrder = v27.LayoutOrder,
        Size = UDim2.new(1, 0, 0, 200),
        Style = "Box"
    };
    local v44 = {};
    local v45 = false;
    if v35 ~= nil then
        v45 = v1.createElement;
        local l_l_Alert_0_0 = l_Alert_0;
        local v47 = {
            Title = v35.title,
            Description = v35.message
        };
        local l_errorType_0 = v35.errorType;
        v47.Style = l_errorType_0 == "warning" and "Warning" or (l_errorType_0 == "error" and "Error" or (l_errorType_0 == "info" and "Info" or (l_errorType_0 == "success" and "Success" or "Error")));
        v47.ZIndex = 2;
        v47.OnClose = function()
            v28.popError(v33);
        end;
        v45 = v45(l_l_Alert_0_0, v47);
    end;
    v44.Alert = v45;
    v44.List = v1.createElement(l_Pane_0, {
        HorizontalAlignment = Enum.HorizontalAlignment.Center,
        Layout = Enum.FillDirection.Vertical,
        VerticalAlignment = Enum.VerticalAlignment.Center
    }, v38);
    return l_createElement_0(l_l_Pane_0_0, v43, v44);
end;


local l_script_FirstAncestor_0 = script:FindFirstAncestor("TextureGenerator");
local v1 = require(l_script_FirstAncestor_0.Packages.Framework);
local v2 = require(l_script_FirstAncestor_0.Packages.React);
local l_ContextServices_0 = v1.ContextServices;
local l_Localization_0 = l_ContextServices_0.Localization;
local l_Stylizer_0 = l_ContextServices_0.Stylizer;
local l_UI_0 = v1.UI;
local l_Image_0 = l_UI_0.Image;
local l_Pane_0 = l_UI_0.Pane;
local l_TextLabel_0 = l_UI_0.TextLabel;
local l_Tooltip_0 = l_UI_0.Tooltip;
local l_LayoutOrderIterator_0 = v1.Util.LayoutOrderIterator;
local _ = require(l_script_FirstAncestor_0.Src.Resources.Theme);
return function(v13)
    local v14 = l_Stylizer_0:use("GenerationAngleHelp");
    local v15 = l_Localization_0:use();
    local v16 = l_LayoutOrderIterator_0.new();
    return v2.createElement(l_Tooltip_0, {
        AnchorPoint = v14.AnchorPoint,
        LayoutOrder = v13.LayoutOrder,
        Position = v14.Position,
        Text = v15:getText("GenerationAngleHelp", "Tooltip"),
        TextXAlignment = Enum.TextXAlignment.Left,
        Child = v2.createElement(l_Pane_0, {
            AutomaticSize = Enum.AutomaticSize.X,
            HorizontalAlignment = Enum.HorizontalAlignment.Left,
            Layout = Enum.FillDirection.Horizontal,
            Padding = v14.Padding,
            Spacing = v14.Spacing,
            VerticalAlignment = Enum.VerticalAlignment.Center,
            ZIndex = v14.ZIndex
        }, {
            TextLabel = v2.createElement(l_TextLabel_0, {
                AutomaticSize = Enum.AutomaticSize.X,
                LayoutOrder = v16:getNextOrder(),
                Style = v14.TextStyle,
                Text = v15:getText("GenerationAngleHelp", "Text")
            }),
            Image = v2.createElement(l_Image_0, {
                LayoutOrder = v16:getNextOrder(),
                Style = v14.HelpImage
            })
        })
    });
end;


local l_script_FirstAncestor_0 = script:FindFirstAncestor("TextureGenerator");
local l_TextureGenerationService_0 = game:GetService("TextureGenerationService");
local v2 = require(l_script_FirstAncestor_0.Packages.Framework);
local v3 = require(l_script_FirstAncestor_0.Packages.React);
local l_ContextServices_0 = v2.ContextServices;
local l_Analytics_0 = l_ContextServices_0.Analytics;
local l_Localization_0 = l_ContextServices_0.Localization;
local l_UI_0 = v2.UI;
local l_AssetRenderModel_0 = l_UI_0.AssetRenderModel;
local l_Button_0 = l_UI_0.Button;
local l_Checkbox_0 = l_UI_0.Checkbox;
local l_Dialog_0 = l_UI_0.Dialog;
local l_ExpandablePane_0 = l_UI_0.ExpandablePane;
local l_Image_0 = l_UI_0.Image;
local l_Pane_0 = l_UI_0.Pane;
local l_Separator_0 = l_UI_0.Separator;
local l_showContextMenu_0 = l_UI_0.showContextMenu;
local l_TextInput_0 = l_UI_0.TextInput;
local l_TextLabel_0 = l_UI_0.TextLabel;
local l_TimeProgressBar_0 = l_UI_0.TimeProgressBar;
local l_TitledFrame_0 = l_UI_0.TitledFrame;
local _ = v2.Util.StyleModifier;
local l_LayoutOrderIterator_0 = v2.Util.LayoutOrderIterator;
local l_Stylizer_0 = v2.ContextServices.Stylizer;
local v24 = require(l_script_FirstAncestor_0.Src.Hooks.useSelectedMeshParts);
local v25 = require(l_script_FirstAncestor_0.Src.Util.Constants);
local v26 = require(l_script_FirstAncestor_0.Src.Util.GenerationsContext);
local v27 = require(l_script_FirstAncestor_0.Src.Util.SelectionWrapper);
local v28 = require(l_script_FirstAncestor_0.Src.Util.setTexture);
local _ = require(l_script_FirstAncestor_0.Src.Resources.Theme);
local _ = require(l_script_FirstAncestor_0.Src.Types);
local l_GuiService_0 = game:GetService("GuiService");
local l_Workspace_0 = game:GetService("Workspace");
local v33 = require(l_script_FirstAncestor_0.Src.Flags.getFFlagTextureGeneratorTelemetry);
local v34 = require(l_script_FirstAncestor_0.Src.Flags.getFFlagTextureGeneratorTelemetryIncludeLocalId);
local v35 = require(l_script_FirstAncestor_0.Src.Flags.getFFlagTextureGeneratorAddFeedback);
local function v38(v36, v37)
    return {
        {
            Id = v25.DROPDOWN_ACTIONS.INSERT,
            Text = v36:getText("DropdownOptions", "Insert"),
            OnItemClicked = v37
        },
        {
            Id = v25.DROPDOWN_ACTIONS.INVENTORY,
            Text = v36:getText("DropdownOptions", "Inventory"),
            OnItemClicked = v37
        },
        {
            Id = v25.DROPDOWN_ACTIONS.EXPORT,
            Text = v36:getText("DropdownOptions", "Export"),
            OnItemClicked = v37
        },
        {
            Id = v25.DROPDOWN_ACTIONS.REMOVE,
            Text = v36:getText("DropdownOptions", "Remove"),
            OnItemClicked = v37
        }
    };
end;
local _ = function(v39, v40)
    return v3.useMemo(function()
        if not v39 then
            return nil;
        else
            local l_Model_0 = Instance.new("Model");
            for _, v43 in v39, nil, nil do
                local v44 = v43:Clone();
                if v40 then
                    v28(v44, v40);
                end;
                v44.Parent = l_Model_0;
            end;
            return l_Model_0;
        end;
    end, {
        v39,
        v40
    });
end;
local function _(v46, v47)
    local l_ViewportSize_0 = v47.ViewportSize;
    return (v46.Magnitude / 2) / math.sin((math.atan(math.tan((math.rad(v47.FieldOfView / 2))) * math.min(1, l_ViewportSize_0.X / l_ViewportSize_0.Y))));
end;
local function v57(v50)
    local v51 = l_Localization_0:use();
    local v52 = l_LayoutOrderIterator_0.new();
    local l_startTime_0 = v50.Generation.startTime;
    local v54 = tonumber(v50.Generation.estimatedWaitDurationSeconds);
    local l_previewImage_0 = v50.Generation.previewImage;
    local v56 = l_Stylizer_0:use("GenerationCard");
    return v3.createElement(l_Pane_0, {
        AutomaticSize = Enum.AutomaticSize.Y,
        HorizontalAlignment = Enum.HorizontalAlignment.Left,
        Layout = Enum.FillDirection.Horizontal,
        Padding = v56.Padding,
        VerticalAlignment = Enum.VerticalAlignment.Center,
        Size = UDim2.fromScale(1, 0)
    }, {
        PreviewImage = if not l_previewImage_0 then nil else v3.createElement(l_Image_0, {
            AnchorPoint = Vector2.new(0.5, 0.5),
            LayoutOrder = v52:getNextOrder(),
            Size = v56.PreviewImageSize,
            Image = l_previewImage_0.previewId,
            Position = UDim2.fromScale(0.5, 0.5)
        }),
        Content = if not v54 then v3.createElement(l_TextLabel_0, {
            LayoutOrder = v52:getNextOrder(),
            Size = v56.PromptLabelProgressSize,
            Text = v50.Generation.prompt,
            TextTruncate = Enum.TextTruncate.AtEnd,
            TextXAlignment = Enum.TextXAlignment.Left,
            TextYAlignment = Enum.TextYAlignment.Center,
            TextWrapped = true
        }) else v3.createElement(l_TimeProgressBar_0, {
            LayoutOrder = v52:getNextOrder(),
            StartTime = l_startTime_0,
            TotalTime = v54,
            Width = v56.ProgressBarWidth
        }),
        CancelButton = v3.createElement(l_Button_0, {
            LayoutOrder = v52:getNextOrder(),
            Size = v56.CancelButtonSize,
            OnClick = v50.OnCancel,
            Style = v56.CancelButtonStyle,
            Text = v51:getText("GenerationCard", "Cancel")
        })
    });
end;
local function v105(v58)
    local v59 = v3.useContext(v26);
    local v60 = l_Localization_0:use();
    local v61 = l_ContextServices_0.Plugin:use():get();
    local v62 = l_LayoutOrderIterator_0.new();
    local v63 = l_LayoutOrderIterator_0.new();
    local v64 = l_Analytics_0:use();
    local v65 = l_Stylizer_0:use("GenerationCard");
    local l_Generation_0 = v58.Generation;
    local l_status_0 = l_Generation_0.status;
    local v68 = nil;
    if l_status_0 == v25.STATUS.COMPLETED then
        v68 = l_Generation_0.prompt or "";
    elseif not l_Generation_0.message then
        if l_Generation_0.errors then
            v68 = l_Generation_0.errors[1];
        end;
    else
        v68 = l_Generation_0.message;
    end;
    local l_textureIds_0 = l_Generation_0.textureIds;
    local l_meshParts_0 = l_Generation_0.meshParts;
    local v75 = v3.useMemo(function()
        if not l_meshParts_0 then
            return nil;
        else
            local l_Model_1 = Instance.new("Model");
            for _, v73 in l_meshParts_0, nil, nil do
                local v74 = v73:Clone();
                if l_textureIds_0 then
                    v28(v74, l_textureIds_0);
                end;
                v74.Parent = l_Model_1;
            end;
            return l_Model_1;
        end;
    end, {
        l_meshParts_0,
        l_textureIds_0
    });
    local v76 = if not not v35() and l_status_0 == v25.STATUS.COMPLETED then v65.PromptLabelCompletedSize else v65.PromptLabelSize;
    local v90 = v38(v60, function(v77)
        if v77.Id == v25.DROPDOWN_ACTIONS.INSERT then
            local l_Model_2 = Instance.new("Model");
            local v79 = CFrame.new();
            local v80 = Vector3.new();
            for _, v82 in l_meshParts_0, nil, nil do
                local v83 = v82:Clone();
                v83.Parent = l_Model_2;
                if l_Generation_0.textureIds then
                    v28(v83, l_Generation_0.textureIds);
                end;
                if v80.Magnitude < v82.Size.Magnitude then
                    v80 = v82.Size;
                    v79 = v82.CFrame;
                end;
            end;
            l_Model_2.Parent = l_Workspace_0;
            local l_CurrentCamera_0 = l_Workspace_0.CurrentCamera;
            l_CurrentCamera_0.CameraType = Enum.CameraType.Fixed;
            local l_v80_0 = v80;
            local l_ViewportSize_1 = l_CurrentCamera_0.ViewportSize;
            local v87 = (l_v80_0.Magnitude / 2) / math.sin((math.atan(math.tan((math.rad(l_CurrentCamera_0.FieldOfView / 2))) * math.min(1, l_ViewportSize_1.X / l_ViewportSize_1.Y))));
            l_v80_0 = l_CurrentCamera_0.CFrame;
            l_CurrentCamera_0.CFrame = ((l_v80_0 - l_v80_0.Position) + v79.Position) - l_v80_0.LookVector * v87;
            l_CurrentCamera_0.Focus = v79;
            return ;
        elseif v77.Id == v25.DROPDOWN_ACTIONS.INVENTORY then
            l_GuiService_0:OpenBrowserWindow(v25.INVENTORY_URL);
            return ;
        else
            if v77.Id == v25.DROPDOWN_ACTIONS.EXPORT then
                PluginManager():ExportSelection();
                if v33() then
                    local v88 = nil;
                    if v34() then
                        v88 = l_Generation_0.uuid;
                    end;
                    v64:report("ExportGeneratedTexture", l_Generation_0.serverId, l_Generation_0.meshParts, l_Generation_0.prompt, l_Generation_0.seed, l_Generation_0.rotation, l_Generation_0.smartUVUnwrap, l_Generation_0.promptMasking, l_Generation_0.textureIds, v88);
                    return ;
                end;
            elseif v77.Id == v25.DROPDOWN_ACTIONS.REMOVE then
                v59.updateGeneration({
                    action = v25.GENERATION_ACTIONS.REMOVE,
                    uuid = v58.Generation.uuid
                });
                if v33() then
                    local v89 = nil;
                    if v34() then
                        v89 = l_Generation_0.uuid;
                    end;
                    v64:report("RemoveGeneratedTexture", l_Generation_0.serverId, l_Generation_0.meshParts, l_Generation_0.prompt, l_Generation_0.seed, l_Generation_0.rotation, l_Generation_0.smartUVUnwrap, l_Generation_0.promptMasking, l_Generation_0.textureIds, v89);
                end;
            end;
            return ;
        end;
    end);
    local l_rotation_0 = l_Generation_0.rotation;
    return v3.createElement(l_Pane_0, {
        AutomaticSize = Enum.AutomaticSize.Y,
        HorizontalAlignment = Enum.HorizontalAlignment.Left,
        Layout = Enum.FillDirection.Horizontal,
        Padding = v65.Padding,
        VerticalAlignment = Enum.VerticalAlignment.Center
    }, {
        InstanceView = if not v75 then nil else v3.createElement(l_AssetRenderModel_0, {
            LayoutOrder = v62:getNextOrder(),
            Model = v75,
            Size = v65.InstanceViewSize,
            Static = true,
            BackgroundColor3 = v65.BackgroundColor,
            FocusDirection = v3.useMemo(function()
                if not l_rotation_0 then
                    return v25.INITIAL_FOCUS_DIRECTION;
                else
                    return CFrame.fromEulerAnglesYXZ(-math.rad(l_rotation_0.X), -math.rad(l_rotation_0.Y), -math.rad(l_rotation_0.Z)) * v25.INITIAL_FOCUS_DIRECTION;
                end;
            end, {
                l_rotation_0
            }),
            LightColor = Color3.new(1, 1, 1),
            LightDirection = -Vector3.new(1, 1, 1)
        }),
        PromptLabel = v3.createElement(l_TextLabel_0, {
            LayoutOrder = v62:getNextOrder(),
            Size = v76,
            Style = l_status_0 == v25.STATUS.FAILED and "Warning" or nil,
            Text = v68,
            TextTruncate = Enum.TextTruncate.AtEnd,
            TextXAlignment = Enum.TextXAlignment.Left,
            TextYAlignment = Enum.TextYAlignment.Center,
            TextWrapped = true
        }),
        ThumbsUpButton = if not not v35() and l_status_0 == v25.STATUS.COMPLETED then v3.createElement(l_Button_0, {
            DisableHover = l_Generation_0.accepted ~= nil,
            LayoutOrder = v62:getNextOrder(),
            Size = v65.MenuButtonSize,
            Style = "RoundSubtle",
            OnClick = function()
                if l_Generation_0.accepted ~= nil then
                    return ;
                else
                    local v92 = table.clone(l_Generation_0);
                    v92.accepted = true;
                    v59.updateGeneration({
                        action = v25.GENERATION_ACTIONS.UPDATE,
                        uuid = v58.Generation.uuid,
                        data = v92
                    });
                    if v33() then
                        local v93 = nil;
                        if v34() then
                            v93 = l_Generation_0.uuid;
                        end;
                        v64:report("SendFeedback", l_Generation_0.serverId, l_Generation_0.meshParts, l_Generation_0.prompt, l_Generation_0.seed, l_Generation_0.rotation, l_Generation_0.smartUVUnwrap, l_Generation_0.promptMasking, l_Generation_0.textureIds, v93, true);
                    end;
                    return ;
                end;
            end
        }, {
            Icon = v3.createElement(l_Image_0, {
                AnchorPoint = Vector2.new(0.5, 0.5),
                Image = if not l_Generation_0.accepted then v65.ThumbsUpOutlineIcon else v65.ThumbsUpIcon,
                Position = UDim2.fromScale(0.5, 0.5),
                Size = UDim2.fromOffset(16, 16)
            })
        }) else nil,
        ThumbsDownButton = if not not v35() and l_status_0 == v25.STATUS.COMPLETED then v3.createElement(l_Button_0, {
            DisableHover = l_Generation_0.accepted ~= nil,
            LayoutOrder = v62:getNextOrder(),
            Size = v65.MenuButtonSize,
            Style = "RoundSubtle",
            OnClick = function()
                if l_Generation_0.accepted ~= nil then
                    return ;
                else
                    local v94 = table.clone(l_Generation_0);
                    v94.showFeedbackDialog = true;
                    v94.feedbackTable = {
                        promptCheckbox = false,
                        qualityCheckbox = false,
                        resolutionCheckbox = false,
                        looksCheckbox = false,
                        otherNotes = ""
                    };
                    v59.updateGeneration({
                        action = v25.GENERATION_ACTIONS.UPDATE,
                        uuid = v58.Generation.uuid,
                        data = v94
                    });
                    return ;
                end;
            end
        }, {
            Icon = v3.createElement(l_Image_0, {
                AnchorPoint = Vector2.new(0.5, 0.5),
                Image = if not (l_Generation_0.accepted ~= nil) or l_Generation_0.accepted then v65.ThumbsDownOutlineIcon else v65.ThumbsDownIcon,
                Position = UDim2.fromScale(0.5, 0.5),
                Size = UDim2.fromOffset(16, 16)
            })
        }) else nil,
        Button = v3.createElement(l_Button_0, {
            LayoutOrder = v62:getNextOrder(),
            Size = v65.MenuButtonSize,
            Style = "RoundSubtle",
            OnClick = function()
                if l_status_0 == v25.STATUS.FAILED then
                    v59.updateGeneration({
                        action = v25.GENERATION_ACTIONS.REMOVE,
                        uuid = v58.Generation.uuid
                    });
                    return ;
                else
                    l_showContextMenu_0(v61, v90);
                    return ;
                end;
            end
        }, {
            Icon = if l_status_0 == v25.STATUS.FAILED then v3.createElement(l_Image_0, {
                AnchorPoint = Vector2.new(0.5, 0.5),
                Image = "rbxasset://textures/DeveloperFramework/close.png",
                Position = UDim2.fromScale(0.5, 0.5),
                Size = UDim2.fromOffset(16, 16),
                Style = "ColoredWarning"
            }) else v3.createElement(l_Image_0, {
                AnchorPoint = Vector2.new(0.5, 0.5),
                Image = "rbxasset://textures/StudioSharedUI/MeatballMenu.png",
                Position = UDim2.fromScale(0.5, 0.5),
                Size = UDim2.fromOffset(24, 24)
            })
        }),
        FeedbackFrom = if not not v35() and l_Generation_0.showFeedbackDialog then v3.createElement(l_Dialog_0, {
            Enabled = l_Generation_0.showFeedbackDialog,
            Size = Vector2.new(600, 400),
            Title = v60:getText("FeedbackDialog", "Title"),
            OnClose = function()
                local v95 = table.clone(l_Generation_0);
                v95.showFeedbackDialog = false;
                v59.updateGeneration({
                    action = v25.GENERATION_ACTIONS.UPDATE,
                    uuid = v58.Generation.uuid,
                    data = v95
                });
            end
        }, {
            Frame = v3.createElement(l_Pane_0, {
                AutomaticSize = Enum.AutomaticSize.Y,
                Layout = Enum.FillDirection.Vertical,
                Padding = 16
            }, {
                Title = v3.createElement(l_ExpandablePane_0, {
                    AlwaysExpanded = true,
                    ContentPadding = 10,
                    ContentSpacing = 15,
                    Style = "Title",
                    Text = v60:getText("FeedbackDialog", "Title"),
                    VerticalAlignment = Enum.VerticalAlignment.Top
                }, {
                    Checkboxes = v3.createElement(l_TitledFrame_0, {
                        Title = v60:getText("FeedbackDialog", "CheckboxTitle"),
                        LayoutOrder = v63:getNextOrder()
                    }, {
                        PromptCheckbox = v3.createElement(l_Checkbox_0, {
                            Checked = l_Generation_0.feedbackTable.promptCheckbox,
                            LayoutOrder = v63:getNextOrder(),
                            Text = v60:getText("FeedbackDialog", "PromptCheckbox"),
                            OnClick = function()
                                local v96 = table.clone(l_Generation_0);
                                l_Generation_0.feedbackTable.promptCheckbox = not l_Generation_0.feedbackTable.promptCheckbox;
                                v59.updateGeneration({
                                    action = v25.GENERATION_ACTIONS.UPDATE,
                                    uuid = v58.Generation.uuid,
                                    data = v96
                                });
                            end
                        }),
                        QualityCheckbox = v3.createElement(l_Checkbox_0, {
                            Checked = l_Generation_0.feedbackTable.qualityCheckbox,
                            LayoutOrder = v63:getNextOrder(),
                            Text = v60:getText("FeedbackDialog", "QualityCheckbox"),
                            OnClick = function()
                                local v97 = table.clone(l_Generation_0);
                                l_Generation_0.feedbackTable.qualityCheckbox = not l_Generation_0.feedbackTable.qualityCheckbox;
                                v59.updateGeneration({
                                    action = v25.GENERATION_ACTIONS.UPDATE,
                                    uuid = v58.Generation.uuid,
                                    data = v97
                                });
                            end
                        }),
                        ResolutionCheckbox = v3.createElement(l_Checkbox_0, {
                            Checked = l_Generation_0.feedbackTable.resolutionCheckbox,
                            LayoutOrder = v63:getNextOrder(),
                            Text = v60:getText("FeedbackDialog", "ResolutionCheckbox"),
                            OnClick = function()
                                local v98 = table.clone(l_Generation_0);
                                l_Generation_0.feedbackTable.resolutionCheckbox = not l_Generation_0.feedbackTable.resolutionCheckbox;
                                v59.updateGeneration({
                                    action = v25.GENERATION_ACTIONS.UPDATE,
                                    uuid = v58.Generation.uuid,
                                    data = v98
                                });
                            end
                        }),
                        LooksCheckbox = v3.createElement(l_Checkbox_0, {
                            Checked = l_Generation_0.feedbackTable.looksCheckbox,
                            LayoutOrder = v63:getNextOrder(),
                            Text = v60:getText("FeedbackDialog", "LooksCheckbox"),
                            OnClick = function()
                                local v99 = table.clone(l_Generation_0);
                                l_Generation_0.feedbackTable.looksCheckbox = not l_Generation_0.feedbackTable.looksCheckbox;
                                v59.updateGeneration({
                                    action = v25.GENERATION_ACTIONS.UPDATE,
                                    uuid = v58.Generation.uuid,
                                    data = v99
                                });
                            end
                        })
                    }),
                    FreeformText = v3.createElement(l_TitledFrame_0, {
                        Title = v60:getText("FeedbackDialog", "OtherNotesTitle"),
                        LayoutOrder = v63:getNextOrder()
                    }, {
                        TextInput = v3.createElement(l_TextInput_0, {
                            Size = UDim2.new(1, 0, 0, 120),
                            MultiLine = true,
                            MaxLength = 1000,
                            Text = l_Generation_0.feedbackTable.otherNotes,
                            OnTextChanged = function(v100)
                                local v101 = table.clone(l_Generation_0);
                                v101.feedbackTable.otherNotes = v100;
                                v59.updateGeneration({
                                    action = v25.GENERATION_ACTIONS.UPDATE,
                                    uuid = v58.Generation.uuid,
                                    data = v101
                                });
                            end
                        })
                    })
                }),
                Separator = v3.createElement(l_Separator_0, {
                    LayoutOrder = 2,
                    Weight = 5
                }),
                ButtonPane = v3.createElement(l_Pane_0, {
                    Size = UDim2.new(1, 0, 0, 70),
                    HorizontalAlignment = Enum.HorizontalAlignment.Right,
                    Layout = Enum.FillDirection.Horizontal,
                    Spacing = 10,
                    LayoutOrder = 3
                }, {
                    CancelButton = v3.createElement(l_Button_0, {
                        LayoutOrder = 1,
                        Size = UDim2.fromOffset(70, 40),
                        Style = "Round",
                        Text = v60:getText("GenerationCard", "Cancel"),
                        OnClick = function()
                            local v102 = table.clone(l_Generation_0);
                            v102.showFeedbackDialog = false;
                            v59.updateGeneration({
                                action = v25.GENERATION_ACTIONS.UPDATE,
                                uuid = v58.Generation.uuid,
                                data = v102
                            });
                        end
                    }),
                    SubmitButton = v3.createElement(l_Button_0, {
                        LayoutOrder = 2,
                        Size = UDim2.fromOffset(150, 40),
                        Style = "RoundPrimary",
                        Text = v60:getText("FeedbackDialog", "SubmitButton"),
                        OnClick = function()
                            local v103 = table.clone(l_Generation_0);
                            v103.accepted = false;
                            v103.showFeedbackDialog = false;
                            v59.updateGeneration({
                                action = v25.GENERATION_ACTIONS.UPDATE,
                                uuid = v58.Generation.uuid,
                                data = v103
                            });
                            if v33() then
                                local v104 = nil;
                                if v34() then
                                    v104 = l_Generation_0.uuid;
                                end;
                                v64:report("SendFeedback", l_Generation_0.serverId, l_Generation_0.meshParts, l_Generation_0.prompt, l_Generation_0.seed, l_Generation_0.rotation, l_Generation_0.smartUVUnwrap, l_Generation_0.promptMasking, l_Generation_0.textureIds, v104, false, l_Generation_0.feedbackTable);
                            end;
                        end
                    })
                })
            })
        }) else nil
    });
end;
return function(v106)
    local v107 = l_Stylizer_0:use("GenerationCard");
    local v108 = v3.useContext(v26);
    local v109 = v27:use():get();
    local v110 = l_Analytics_0:use();
    local l_status_1 = v106.Generation.status;
    local v113 = v3.useCallback(function()
        l_TextureGenerationService_0:CancelGenerationRequest(v106.Generation.uuid);
        v108.updateGeneration({
            action = v25.GENERATION_ACTIONS.REMOVE,
            uuid = v106.Generation.uuid
        });
        if v33() then
            local v112 = nil;
            if v34() then
                v112 = v106.Generation.uuid;
            end;
            v110:report("CancelTextureGeneration", v106.Generation.serverId or "", v106.Generation.meshParts, v106.Generation.prompt, v106.Generation.seed, v106.Generation.rotation, v106.Generation.smartUVUnwrap, v106.Generation.promptMasking, v112);
        end;
    end, {
        v106.Generation,
        v108.updateGeneration
    });
    local v114 = v24();
    local v130 = v3.useCallback(function()
        if l_status_1 ~= v25.STATUS.COMPLETED then
            return ;
        elseif next(v114) ~= nil and v108.selected ~= v106.Generation.uuid then
            v108.setSelected(v106.Generation.uuid);
            for _, v116 in v114, nil, nil do
                v28(v116, v106.Generation.textureIds);
            end;
            return ;
        elseif next(v114) ~= nil and v108.selected == v106.Generation.uuid then
            v108.setSelected(nil);
            for _, v118 in v114, nil, nil do
                v28(v118, "");
            end;
            return ;
        else
            if next(v114) == nil and v108.selected ~= v106.Generation.uuid then
                local v119 = nil;
                local v120 = CFrame.new();
                local v121 = Vector3.new();
                local v122 = false;
                for _, v124 in v106.Generation.meshParts, nil, nil do
                    local l_SurfaceAppearance_0 = v124:FindFirstChildOfClass("SurfaceAppearance");
                    if l_SurfaceAppearance_0 then
                        v119 = l_SurfaceAppearance_0.ColorMap;
                    end;
                    if v121.Magnitude < v124.Size.Magnitude then
                        v121 = v124.Size;
                        v120 = v124.CFrame;
                    end;
                    if v124:IsDescendantOf(l_Workspace_0) then
                        v122 = true;
                    end;
                end;
                if v122 and v119 == v106.Generation.textureIds then
                    assert(v119, "No texture ID found");
                    v108.setSelected(v106.Generation.uuid);
                    v109:Set(v106.Generation.meshParts);
                    local l_CurrentCamera_1 = l_Workspace_0.CurrentCamera;
                    l_CurrentCamera_1.CameraType = Enum.CameraType.Fixed;
                    local l_v121_0 = v121;
                    local l_ViewportSize_2 = l_CurrentCamera_1.ViewportSize;
                    local v129 = (l_v121_0.Magnitude / 2) / math.sin((math.atan(math.tan((math.rad(l_CurrentCamera_1.FieldOfView / 2))) * math.min(1, l_ViewportSize_2.X / l_ViewportSize_2.Y))));
                    l_v121_0 = l_CurrentCamera_1.CFrame;
                    l_CurrentCamera_1.CFrame = ((l_v121_0 - l_v121_0.Position) + v120.Position) - l_v121_0.LookVector * v129;
                    l_CurrentCamera_1.Focus = v120;
                end;
            end;
            return ;
        end;
    end, {
        l_status_1,
        v114,
        v108.selected,
        v108.setSelected
    });
    local v131, v132 = v3.useState(0);
    return v3.createElement(l_Pane_0, {
        AutomaticSize = Enum.AutomaticSize.Y,
        LayoutOrder = v106.LayoutOrder,
        Size = UDim2.new(1, 0, 0, (math.max(v131, 46))),
        Style = "CornerBox",
        OnClick = v130
    }, {
        UIPadding = v3.createElement("UIPadding", {
            PaddingTop = UDim.new(0, 3)
        }),
        Contents = v3.createElement(l_Pane_0, {
            AnchorPoint = Vector2.new(0.5, 0.5),
            AutomaticSize = Enum.AutomaticSize.Y,
            Position = UDim2.fromScale(0.5, 0.5),
            Style = "CornerBox",
            Size = UDim2.new(1, -2, 0, 0)
        }, {
            UIStroke = v3.createElement("UIStroke", {
                Thickness = 1,
                ApplyStrokeMode = Enum.ApplyStrokeMode.Border,
                Color = if l_status_1 == v25.STATUS.FAILED then v107.ErrorStrokeColor else if v108.selected == v106.Generation.uuid then v107.SelectedStrokeColor else v107.StrokeColor
            }, {
                Corner = v3.createElement("UICorner")
            }),
            Generation = if l_status_1 == v25.STATUS.PENDING then v3.createElement(v57, {
                Generation = v106.Generation,
                OnCancel = v113,
                SetHeight = v132
            }) else v3.createElement(v105, {
                Generation = v106.Generation,
                SetHeight = v132
            })
        })
    });
end;


local l_script_FirstAncestor_0 = script:FindFirstAncestor("TextureGenerator");
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_Localization_0 = v2.ContextServices.Localization;
local v5 = require(l_script_FirstAncestor_0.Src.Components.GenerationCard);
local v6 = require(l_script_FirstAncestor_0.Src.Hooks.useSelectedMeshParts);
local l_UI_0 = v2.UI;
local l_ExpandablePane_0 = l_UI_0.ExpandablePane;
local l_Pane_0 = l_UI_0.Pane;
local v10 = require(l_script_FirstAncestor_0.Src.Util.Constants);
local v11 = require(l_script_FirstAncestor_0.Src.Util.createHashFromMeshParts);
local v12 = require(l_script_FirstAncestor_0.Src.Util.GenerationsContext);
local v13 = require(l_script_FirstAncestor_0.Src.Util.sort);
local function v26(v14, v15, v16)
    local l_generations_0 = v14.generations;
    local v18 = {};
    local v22 = v13(v1.keys(l_generations_0), function(v19)
        local v20 = l_generations_0[v19];
        local l_layoutOrder_0 = l_generations_0[v19].layoutOrder;
        if v20.status == v10.STATUS.PENDING then
            return 1;
        elseif v20.status == v10.STATUS.FAILED then
            return 2;
        else
            return l_layoutOrder_0;
        end;
    end);
    for v23, v24 in l_generations_0, nil, nil do
        if not (not (not (v24.status == v10.STATUS.COMPLETED) or not v15) and (not (not v14.modelToGenerations[v15] or table.find(v14.modelToGenerations[v15], v23)) or next(v16) ~= nil and not v14.modelToGenerations[v15])) then
            local v25 = table.find(v22, v23);
            assert(v25 ~= nil, "Can't find generation id in sorted list");
            v18[v23] = v3.createElement(v5, {
                Generation = v24,
                LayoutOrder = v25
            });
        end;
    end;
    return v18;
end;
return function(v27)
    local v28 = l_Localization_0:use();
    local v29 = v6();
    local v30 = v11(v29);
    local v31 = v3.useContext(v12);
    local v32 = v26(v31, v30, v29);
    local v33 = if next(v29) == nil then v28:getText("Generations", "TitleAll") else v28:getText("Generations", "TitleSelected");
    v3.useEffect(function()
        if next(v29) == nil then
            v31.setSelected(nil);
        end;
    end, {
        v29,
        v31.setSelected
    });
    return v3.createElement(l_ExpandablePane_0, {
        AlwaysExpanded = true,
        HorizontalAlignment = Enum.HorizontalAlignment.Center,
        Layout = Enum.FillDirection.Horizontal,
        LayoutOrder = v27.LayoutOrder,
        Style = "Section",
        Text = v33,
        VerticalAlignment = Enum.VerticalAlignment.Top
    }, {
        GenerationsPane = v3.createElement(l_Pane_0, {
            AutomaticSize = Enum.AutomaticSize.Y,
            HorizontalAlignment = Enum.HorizontalAlignment.Center,
            Layout = Enum.FillDirection.Vertical,
            Spacing = UDim.new(0, 4),
            VerticalAlignment = Enum.VerticalAlignment.Top
        }, v32)
    });
end;


local l_script_FirstAncestor_0 = script:FindFirstAncestor("TextureGenerator");
local v1 = require(l_script_FirstAncestor_0.Packages.React);
local v2 = require(l_script_FirstAncestor_0.Src.Util.Constants);
local v3 = require(l_script_FirstAncestor_0.Src.Util.GenerationsContext);
local v4 = require(l_script_FirstAncestor_0.Src.Hooks.jobTableReducer);
local v5 = require(l_script_FirstAncestor_0.Src.Flags.getFFlagDebugTextureGeneratorLogging);
local function v9(v6, v7)
    assert((v7.action and v7.uuid) and v7.hash, "Action must have action, uuid, and hash fields");
    v6 = table.clone(v6);
    if v7.action == v2.GENERATION_ACTIONS.ADD then
        if v6[v7.hash] then
            v6[v7.hash] = table.clone(v6[v7.hash]);
        else
            v6[v7.hash] = {};
        end;
        table.insert(v6[v7.hash], v7.uuid);
        return v6;
    else
        if v7.action == v2.GENERATION_ACTIONS.REMOVE then
            if v6[v7.hash] then
                local v8 = table.find(v6[v7.hash], v7.uuid);
                if v8 then
                    v6[v7.hash] = table.clone(v6[v7.hash]);
                    table.remove(v6[v7.hash], v8);
                    return v6;
                end;
            end;
        else
            error((("Invalid action: %*"):format(v7.action)));
        end;
        return v6;
    end;
end;
return function(v10)
    local v11, v12 = v1.useReducer(v4, {});
    local v13, v14 = v1.useReducer(v9, {});
    local v15, v16 = v1.useState(nil);
    local v17, v18 = v1.useState(0);
    local v19, v20 = v1.useState(0);
    if v5() then
        v1.useEffect(function()
            print("Generations table: ", v11);
        end, {
            v11
        });
        v1.useEffect(function()
            print("ModelToGenerations table: ", v13);
        end, {
            v13
        });
    end;
    return v1.createElement(v3.Provider, {
        value = {
            generations = v11,
            updateGeneration = v12,
            modelToGenerations = v13,
            updateModelToGenerations = v14,
            selected = v15,
            setSelected = v16,
            quota = v17,
            setQuota = v18,
            total = v19,
            setTotal = v20
        }
    }, v10.children);
end;