/*! For license information please see Main.js.LICENSE.txt */
import * as __WEBPACK_EXTERNAL_MODULE__minecraft_server_editor_81aed4a5__ from "@minecraft/server-editor";

import * as __WEBPACK_EXTERNAL_MODULE__minecraft_server_fb7572af__ from "@minecraft/server";

import * as __WEBPACK_EXTERNAL_MODULE__minecraft_server_editor_bindings_e2bf1028__ from "@minecraft/server-editor-bindings";

var __webpack_modules__ = {
    869: (__unused_webpack_module, exports) => {
        Object.defineProperty(exports, "__esModule", {
            value: true
        });
        exports.clampNumber = void 0;
        function clampNumber(val, min, max) {
            return Math.min(Math.max(val, min), max);
        }
        exports.clampNumber = clampNumber;
    },
    605: function(__unused_webpack_module, exports, __webpack_require__) {
        var __createBinding = this && this.__createBinding || (Object.create ? function(o, m, k, k2) {
            if (k2 === undefined) k2 = k;
            var desc = Object.getOwnPropertyDescriptor(m, k);
            if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
                desc = {
                    enumerable: true,
                    get: function() {
                        return m[k];
                    }
                };
            }
            Object.defineProperty(o, k2, desc);
        } : function(o, m, k, k2) {
            if (k2 === undefined) k2 = k;
            o[k2] = m[k];
        });
        var __exportStar = this && this.__exportStar || function(m, exports) {
            for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
        };
        Object.defineProperty(exports, "__esModule", {
            value: true
        });
        __exportStar(__webpack_require__(869), exports);
    },
    79: function(__unused_webpack_module, exports, __webpack_require__) {
        var __createBinding = this && this.__createBinding || (Object.create ? function(o, m, k, k2) {
            if (k2 === undefined) k2 = k;
            var desc = Object.getOwnPropertyDescriptor(m, k);
            if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
                desc = {
                    enumerable: true,
                    get: function() {
                        return m[k];
                    }
                };
            }
            Object.defineProperty(o, k2, desc);
        } : function(o, m, k, k2) {
            if (k2 === undefined) k2 = k;
            o[k2] = m[k];
        });
        var __exportStar = this && this.__exportStar || function(m, exports) {
            for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
        };
        Object.defineProperty(exports, "__esModule", {
            value: true
        });
        __exportStar(__webpack_require__(200), exports);
        __exportStar(__webpack_require__(605), exports);
    },
    604: (__unused_webpack_module, exports, __webpack_require__) => {
        Object.defineProperty(exports, "__esModule", {
            value: true
        });
        exports.VECTOR3_SOUTH = exports.VECTOR3_NORTH = exports.VECTOR3_EAST = exports.VECTOR3_WEST = exports.VECTOR3_ZERO = exports.VECTOR3_ONE = exports.VECTOR3_BACK = exports.VECTOR3_FORWARD = exports.VECTOR3_RIGHT = exports.VECTOR3_LEFT = exports.VECTOR3_DOWN = exports.VECTOR3_UP = exports.Vector2Utils = exports.Vector3Utils = void 0;
        const clamp_1 = __webpack_require__(869);
        class Vector3Utils {
            static equals(v1, v2) {
                return v1.x === v2.x && v1.y === v2.y && v1.z === v2.z;
            }
            static add(v1, v2) {
                return {
                    x: v1.x + v2.x,
                    y: v1.y + v2.y,
                    z: v1.z + v2.z
                };
            }
            static subtract(v1, v2) {
                return {
                    x: v1.x - v2.x,
                    y: v1.y - v2.y,
                    z: v1.z - v2.z
                };
            }
            static scale(v1, scale) {
                return {
                    x: v1.x * scale,
                    y: v1.y * scale,
                    z: v1.z * scale
                };
            }
            static dot(a, b) {
                return a.x * b.x + a.y * b.y + a.z * b.z;
            }
            static cross(a, b) {
                return {
                    x: a.y * b.z - a.z * b.y,
                    y: a.z * b.x - a.x * b.z,
                    z: a.x * b.y - a.y * b.x
                };
            }
            static magnitude(v) {
                return Math.sqrt(v.x ** 2 + v.y ** 2 + v.z ** 2);
            }
            static normalize(v) {
                const mag = Vector3Utils.magnitude(v);
                return {
                    x: v.x / mag,
                    y: v.y / mag,
                    z: v.z / mag
                };
            }
            static floor(v) {
                return {
                    x: Math.floor(v.x),
                    y: Math.floor(v.y),
                    z: Math.floor(v.z)
                };
            }
            static toString(v, options) {
                const decimals = options?.decimals ?? 2;
                const str = [ v.x.toFixed(decimals), v.y.toFixed(decimals), v.z.toFixed(decimals) ];
                return str.join(options?.delimiter ?? ", ");
            }
            static clamp(v, limits) {
                return {
                    x: (0, clamp_1.clampNumber)(v.x, limits?.min?.x ?? Number.MIN_SAFE_INTEGER, limits?.max?.x ?? Number.MAX_SAFE_INTEGER),
                    y: (0, clamp_1.clampNumber)(v.y, limits?.min?.y ?? Number.MIN_SAFE_INTEGER, limits?.max?.y ?? Number.MAX_SAFE_INTEGER),
                    z: (0, clamp_1.clampNumber)(v.z, limits?.min?.z ?? Number.MIN_SAFE_INTEGER, limits?.max?.z ?? Number.MAX_SAFE_INTEGER)
                };
            }
        }
        exports.Vector3Utils = Vector3Utils;
        class Vector2Utils {
            static toString(v, options) {
                const decimals = options?.decimals ?? 2;
                const str = [ v.x.toFixed(decimals), v.y.toFixed(decimals) ];
                return str.join(options?.delimiter ?? ", ");
            }
        }
        exports.Vector2Utils = Vector2Utils;
        exports.VECTOR3_UP = {
            x: 0,
            y: 1,
            z: 0
        };
        exports.VECTOR3_DOWN = {
            x: 0,
            y: -1,
            z: 0
        };
        exports.VECTOR3_LEFT = {
            x: -1,
            y: 0,
            z: 0
        };
        exports.VECTOR3_RIGHT = {
            x: 1,
            y: 0,
            z: 0
        };
        exports.VECTOR3_FORWARD = {
            x: 0,
            y: 0,
            z: 1
        };
        exports.VECTOR3_BACK = {
            x: 0,
            y: 0,
            z: -1
        };
        exports.VECTOR3_ONE = {
            x: 1,
            y: 1,
            z: 1
        };
        exports.VECTOR3_ZERO = {
            x: 0,
            y: 0,
            z: 0
        };
        exports.VECTOR3_WEST = {
            x: -1,
            y: 0,
            z: 0
        };
        exports.VECTOR3_EAST = {
            x: 1,
            y: 0,
            z: 0
        };
        exports.VECTOR3_NORTH = {
            x: 0,
            y: 0,
            z: 1
        };
        exports.VECTOR3_SOUTH = {
            x: 0,
            y: 0,
            z: -1
        };
    },
    200: function(__unused_webpack_module, exports, __webpack_require__) {
        var __createBinding = this && this.__createBinding || (Object.create ? function(o, m, k, k2) {
            if (k2 === undefined) k2 = k;
            var desc = Object.getOwnPropertyDescriptor(m, k);
            if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
                desc = {
                    enumerable: true,
                    get: function() {
                        return m[k];
                    }
                };
            }
            Object.defineProperty(o, k2, desc);
        } : function(o, m, k, k2) {
            if (k2 === undefined) k2 = k;
            o[k2] = m[k];
        });
        var __exportStar = this && this.__exportStar || function(m, exports) {
            for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
        };
        Object.defineProperty(exports, "__esModule", {
            value: true
        });
        __exportStar(__webpack_require__(604), exports);
        __exportStar(__webpack_require__(963), exports);
    },
    963: (__unused_webpack_module, exports, __webpack_require__) => {
        Object.defineProperty(exports, "__esModule", {
            value: true
        });
        exports.Vector2Builder = exports.Vector3Builder = void 0;
        const coreHelpers_1 = __webpack_require__(604);
        class Vector3Builder {
            constructor(first, y, z) {
                if (typeof first === "object") {
                    this.x = first.x;
                    this.y = first.y;
                    this.z = first.z;
                } else {
                    this.x = first;
                    this.y = y ?? 0;
                    this.z = z ?? 0;
                }
            }
            assign(vec) {
                this.x = vec.x;
                this.y = vec.y;
                this.z = vec.z;
                return this;
            }
            equals(v) {
                return coreHelpers_1.Vector3Utils.equals(this, v);
            }
            add(v) {
                return this.assign(coreHelpers_1.Vector3Utils.add(this, v));
            }
            subtract(v) {
                return this.assign(coreHelpers_1.Vector3Utils.subtract(this, v));
            }
            scale(val) {
                return this.assign(coreHelpers_1.Vector3Utils.scale(this, val));
            }
            dot(vec) {
                return coreHelpers_1.Vector3Utils.dot(this, vec);
            }
            cross(vec) {
                return this.assign(coreHelpers_1.Vector3Utils.cross(this, vec));
            }
            magnitude() {
                return coreHelpers_1.Vector3Utils.magnitude(this);
            }
            normalize() {
                return this.assign(coreHelpers_1.Vector3Utils.normalize(this));
            }
            floor() {
                return this.assign(coreHelpers_1.Vector3Utils.floor(this));
            }
            toString(options) {
                return coreHelpers_1.Vector3Utils.toString(this, options);
            }
            clamp(limits) {
                return this.assign(coreHelpers_1.Vector3Utils.clamp(this, limits));
            }
        }
        exports.Vector3Builder = Vector3Builder;
        class Vector2Builder {
            constructor(first, y) {
                if (typeof first === "object") {
                    this.x = first.x;
                    this.y = first.y;
                } else {
                    this.x = first;
                    this.y = y ?? 0;
                }
            }
            toString(options) {
                return coreHelpers_1.Vector2Utils.toString(this, options);
            }
        }
        exports.Vector2Builder = Vector2Builder;
    },
    766: (__unused_webpack_module, exports) => {
        exports.byteLength = byteLength;
        exports.toByteArray = toByteArray;
        exports.fromByteArray = fromByteArray;
        var lookup = [];
        var revLookup = [];
        var Arr = typeof Uint8Array !== "undefined" ? Uint8Array : Array;
        var code = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
        for (var i = 0, len = code.length; i < len; ++i) {
            lookup[i] = code[i];
            revLookup[code.charCodeAt(i)] = i;
        }
        revLookup["-".charCodeAt(0)] = 62;
        revLookup["_".charCodeAt(0)] = 63;
        function getLens(b64) {
            var len = b64.length;
            if (len % 4 > 0) {
                throw new Error("Invalid string. Length must be a multiple of 4");
            }
            var validLen = b64.indexOf("=");
            if (validLen === -1) validLen = len;
            var placeHoldersLen = validLen === len ? 0 : 4 - validLen % 4;
            return [ validLen, placeHoldersLen ];
        }
        function byteLength(b64) {
            var lens = getLens(b64);
            var validLen = lens[0];
            var placeHoldersLen = lens[1];
            return (validLen + placeHoldersLen) * 3 / 4 - placeHoldersLen;
        }
        function _byteLength(b64, validLen, placeHoldersLen) {
            return (validLen + placeHoldersLen) * 3 / 4 - placeHoldersLen;
        }
        function toByteArray(b64) {
            var tmp;
            var lens = getLens(b64);
            var validLen = lens[0];
            var placeHoldersLen = lens[1];
            var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen));
            var curByte = 0;
            var len = placeHoldersLen > 0 ? validLen - 4 : validLen;
            var i;
            for (i = 0; i < len; i += 4) {
                tmp = revLookup[b64.charCodeAt(i)] << 18 | revLookup[b64.charCodeAt(i + 1)] << 12 | revLookup[b64.charCodeAt(i + 2)] << 6 | revLookup[b64.charCodeAt(i + 3)];
                arr[curByte++] = tmp >> 16 & 255;
                arr[curByte++] = tmp >> 8 & 255;
                arr[curByte++] = tmp & 255;
            }
            if (placeHoldersLen === 2) {
                tmp = revLookup[b64.charCodeAt(i)] << 2 | revLookup[b64.charCodeAt(i + 1)] >> 4;
                arr[curByte++] = tmp & 255;
            }
            if (placeHoldersLen === 1) {
                tmp = revLookup[b64.charCodeAt(i)] << 10 | revLookup[b64.charCodeAt(i + 1)] << 4 | revLookup[b64.charCodeAt(i + 2)] >> 2;
                arr[curByte++] = tmp >> 8 & 255;
                arr[curByte++] = tmp & 255;
            }
            return arr;
        }
        function tripletToBase64(num) {
            return lookup[num >> 18 & 63] + lookup[num >> 12 & 63] + lookup[num >> 6 & 63] + lookup[num & 63];
        }
        function encodeChunk(uint8, start, end) {
            var tmp;
            var output = [];
            for (var i = start; i < end; i += 3) {
                tmp = (uint8[i] << 16 & 16711680) + (uint8[i + 1] << 8 & 65280) + (uint8[i + 2] & 255);
                output.push(tripletToBase64(tmp));
            }
            return output.join("");
        }
        function fromByteArray(uint8) {
            var tmp;
            var len = uint8.length;
            var extraBytes = len % 3;
            var parts = [];
            var maxChunkLength = 16383;
            for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
                parts.push(encodeChunk(uint8, i, i + maxChunkLength > len2 ? len2 : i + maxChunkLength));
            }
            if (extraBytes === 1) {
                tmp = uint8[len - 1];
                parts.push(lookup[tmp >> 2] + lookup[tmp << 4 & 63] + "==");
            } else if (extraBytes === 2) {
                tmp = (uint8[len - 2] << 8) + uint8[len - 1];
                parts.push(lookup[tmp >> 10] + lookup[tmp >> 4 & 63] + lookup[tmp << 2 & 63] + "=");
            }
            return parts.join("");
        }
    },
    834: (__unused_webpack_module, exports, __webpack_require__) => {
        var __webpack_unused_export__;
        var base64 = __webpack_require__(766);
        var ieee754 = __webpack_require__(333);
        var customInspectSymbol = typeof Symbol === "function" && typeof Symbol["for"] === "function" ? Symbol["for"]("nodejs.util.inspect.custom") : null;
        exports.lW = Buffer;
        __webpack_unused_export__ = SlowBuffer;
        exports.h2 = 50;
        var K_MAX_LENGTH = 2147483647;
        __webpack_unused_export__ = K_MAX_LENGTH;
        Buffer.TYPED_ARRAY_SUPPORT = typedArraySupport();
        if (!Buffer.TYPED_ARRAY_SUPPORT && typeof console !== "undefined" && typeof console.error === "function") {
            console.error("This browser lacks typed array (Uint8Array) support which is required by " + "`buffer` v5.x. Use `buffer` v4.x if you require old browser support.");
        }
        function typedArraySupport() {
            try {
                var arr = new Uint8Array(1);
                var proto = {
                    foo: function() {
                        return 42;
                    }
                };
                Object.setPrototypeOf(proto, Uint8Array.prototype);
                Object.setPrototypeOf(arr, proto);
                return arr.foo() === 42;
            } catch (e) {
                return false;
            }
        }
        Object.defineProperty(Buffer.prototype, "parent", {
            enumerable: true,
            get: function() {
                if (!Buffer.isBuffer(this)) return undefined;
                return this.buffer;
            }
        });
        Object.defineProperty(Buffer.prototype, "offset", {
            enumerable: true,
            get: function() {
                if (!Buffer.isBuffer(this)) return undefined;
                return this.byteOffset;
            }
        });
        function createBuffer(length) {
            if (length > K_MAX_LENGTH) {
                throw new RangeError('The value "' + length + '" is invalid for option "size"');
            }
            var buf = new Uint8Array(length);
            Object.setPrototypeOf(buf, Buffer.prototype);
            return buf;
        }
        function Buffer(arg, encodingOrOffset, length) {
            if (typeof arg === "number") {
                if (typeof encodingOrOffset === "string") {
                    throw new TypeError('The "string" argument must be of type string. Received type number');
                }
                return allocUnsafe(arg);
            }
            return from(arg, encodingOrOffset, length);
        }
        Buffer.poolSize = 8192;
        function from(value, encodingOrOffset, length) {
            if (typeof value === "string") {
                return fromString(value, encodingOrOffset);
            }
            if (ArrayBuffer.isView(value)) {
                return fromArrayView(value);
            }
            if (value == null) {
                throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, " + "or Array-like Object. Received type " + typeof value);
            }
            if (isInstance(value, ArrayBuffer) || value && isInstance(value.buffer, ArrayBuffer)) {
                return fromArrayBuffer(value, encodingOrOffset, length);
            }
            if (typeof SharedArrayBuffer !== "undefined" && (isInstance(value, SharedArrayBuffer) || value && isInstance(value.buffer, SharedArrayBuffer))) {
                return fromArrayBuffer(value, encodingOrOffset, length);
            }
            if (typeof value === "number") {
                throw new TypeError('The "value" argument must not be of type number. Received type number');
            }
            var valueOf = value.valueOf && value.valueOf();
            if (valueOf != null && valueOf !== value) {
                return Buffer.from(valueOf, encodingOrOffset, length);
            }
            var b = fromObject(value);
            if (b) return b;
            if (typeof Symbol !== "undefined" && Symbol.toPrimitive != null && typeof value[Symbol.toPrimitive] === "function") {
                return Buffer.from(value[Symbol.toPrimitive]("string"), encodingOrOffset, length);
            }
            throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, " + "or Array-like Object. Received type " + typeof value);
        }
        Buffer.from = function(value, encodingOrOffset, length) {
            return from(value, encodingOrOffset, length);
        };
        Object.setPrototypeOf(Buffer.prototype, Uint8Array.prototype);
        Object.setPrototypeOf(Buffer, Uint8Array);
        function assertSize(size) {
            if (typeof size !== "number") {
                throw new TypeError('"size" argument must be of type number');
            } else if (size < 0) {
                throw new RangeError('The value "' + size + '" is invalid for option "size"');
            }
        }
        function alloc(size, fill, encoding) {
            assertSize(size);
            if (size <= 0) {
                return createBuffer(size);
            }
            if (fill !== undefined) {
                return typeof encoding === "string" ? createBuffer(size).fill(fill, encoding) : createBuffer(size).fill(fill);
            }
            return createBuffer(size);
        }
        Buffer.alloc = function(size, fill, encoding) {
            return alloc(size, fill, encoding);
        };
        function allocUnsafe(size) {
            assertSize(size);
            return createBuffer(size < 0 ? 0 : checked(size) | 0);
        }
        Buffer.allocUnsafe = function(size) {
            return allocUnsafe(size);
        };
        Buffer.allocUnsafeSlow = function(size) {
            return allocUnsafe(size);
        };
        function fromString(string, encoding) {
            if (typeof encoding !== "string" || encoding === "") {
                encoding = "utf8";
            }
            if (!Buffer.isEncoding(encoding)) {
                throw new TypeError("Unknown encoding: " + encoding);
            }
            var length = byteLength(string, encoding) | 0;
            var buf = createBuffer(length);
            var actual = buf.write(string, encoding);
            if (actual !== length) {
                buf = buf.slice(0, actual);
            }
            return buf;
        }
        function fromArrayLike(array) {
            var length = array.length < 0 ? 0 : checked(array.length) | 0;
            var buf = createBuffer(length);
            for (var i = 0; i < length; i += 1) {
                buf[i] = array[i] & 255;
            }
            return buf;
        }
        function fromArrayView(arrayView) {
            if (isInstance(arrayView, Uint8Array)) {
                var copy = new Uint8Array(arrayView);
                return fromArrayBuffer(copy.buffer, copy.byteOffset, copy.byteLength);
            }
            return fromArrayLike(arrayView);
        }
        function fromArrayBuffer(array, byteOffset, length) {
            if (byteOffset < 0 || array.byteLength < byteOffset) {
                throw new RangeError('"offset" is outside of buffer bounds');
            }
            if (array.byteLength < byteOffset + (length || 0)) {
                throw new RangeError('"length" is outside of buffer bounds');
            }
            var buf;
            if (byteOffset === undefined && length === undefined) {
                buf = new Uint8Array(array);
            } else if (length === undefined) {
                buf = new Uint8Array(array, byteOffset);
            } else {
                buf = new Uint8Array(array, byteOffset, length);
            }
            Object.setPrototypeOf(buf, Buffer.prototype);
            return buf;
        }
        function fromObject(obj) {
            if (Buffer.isBuffer(obj)) {
                var len = checked(obj.length) | 0;
                var buf = createBuffer(len);
                if (buf.length === 0) {
                    return buf;
                }
                obj.copy(buf, 0, 0, len);
                return buf;
            }
            if (obj.length !== undefined) {
                if (typeof obj.length !== "number" || numberIsNaN(obj.length)) {
                    return createBuffer(0);
                }
                return fromArrayLike(obj);
            }
            if (obj.type === "Buffer" && Array.isArray(obj.data)) {
                return fromArrayLike(obj.data);
            }
        }
        function checked(length) {
            if (length >= K_MAX_LENGTH) {
                throw new RangeError("Attempt to allocate Buffer larger than maximum " + "size: 0x" + K_MAX_LENGTH.toString(16) + " bytes");
            }
            return length | 0;
        }
        function SlowBuffer(length) {
            if (+length != length) {
                length = 0;
            }
            return Buffer.alloc(+length);
        }
        Buffer.isBuffer = function isBuffer(b) {
            return b != null && b._isBuffer === true && b !== Buffer.prototype;
        };
        Buffer.compare = function compare(a, b) {
            if (isInstance(a, Uint8Array)) a = Buffer.from(a, a.offset, a.byteLength);
            if (isInstance(b, Uint8Array)) b = Buffer.from(b, b.offset, b.byteLength);
            if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {
                throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');
            }
            if (a === b) return 0;
            var x = a.length;
            var y = b.length;
            for (var i = 0, len = Math.min(x, y); i < len; ++i) {
                if (a[i] !== b[i]) {
                    x = a[i];
                    y = b[i];
                    break;
                }
            }
            if (x < y) return -1;
            if (y < x) return 1;
            return 0;
        };
        Buffer.isEncoding = function isEncoding(encoding) {
            switch (String(encoding).toLowerCase()) {
              case "hex":
              case "utf8":
              case "utf-8":
              case "ascii":
              case "latin1":
              case "binary":
              case "base64":
              case "ucs2":
              case "ucs-2":
              case "utf16le":
              case "utf-16le":
                return true;

              default:
                return false;
            }
        };
        Buffer.concat = function concat(list, length) {
            if (!Array.isArray(list)) {
                throw new TypeError('"list" argument must be an Array of Buffers');
            }
            if (list.length === 0) {
                return Buffer.alloc(0);
            }
            var i;
            if (length === undefined) {
                length = 0;
                for (i = 0; i < list.length; ++i) {
                    length += list[i].length;
                }
            }
            var buffer = Buffer.allocUnsafe(length);
            var pos = 0;
            for (i = 0; i < list.length; ++i) {
                var buf = list[i];
                if (isInstance(buf, Uint8Array)) {
                    if (pos + buf.length > buffer.length) {
                        Buffer.from(buf).copy(buffer, pos);
                    } else {
                        Uint8Array.prototype.set.call(buffer, buf, pos);
                    }
                } else if (!Buffer.isBuffer(buf)) {
                    throw new TypeError('"list" argument must be an Array of Buffers');
                } else {
                    buf.copy(buffer, pos);
                }
                pos += buf.length;
            }
            return buffer;
        };
        function byteLength(string, encoding) {
            if (Buffer.isBuffer(string)) {
                return string.length;
            }
            if (ArrayBuffer.isView(string) || isInstance(string, ArrayBuffer)) {
                return string.byteLength;
            }
            if (typeof string !== "string") {
                throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. ' + "Received type " + typeof string);
            }
            var len = string.length;
            var mustMatch = arguments.length > 2 && arguments[2] === true;
            if (!mustMatch && len === 0) return 0;
            var loweredCase = false;
            for (;;) {
                switch (encoding) {
                  case "ascii":
                  case "latin1":
                  case "binary":
                    return len;

                  case "utf8":
                  case "utf-8":
                    return utf8ToBytes(string).length;

                  case "ucs2":
                  case "ucs-2":
                  case "utf16le":
                  case "utf-16le":
                    return len * 2;

                  case "hex":
                    return len >>> 1;

                  case "base64":
                    return base64ToBytes(string).length;

                  default:
                    if (loweredCase) {
                        return mustMatch ? -1 : utf8ToBytes(string).length;
                    }
                    encoding = ("" + encoding).toLowerCase();
                    loweredCase = true;
                }
            }
        }
        Buffer.byteLength = byteLength;
        function slowToString(encoding, start, end) {
            var loweredCase = false;
            if (start === undefined || start < 0) {
                start = 0;
            }
            if (start > this.length) {
                return "";
            }
            if (end === undefined || end > this.length) {
                end = this.length;
            }
            if (end <= 0) {
                return "";
            }
            end >>>= 0;
            start >>>= 0;
            if (end <= start) {
                return "";
            }
            if (!encoding) encoding = "utf8";
            while (true) {
                switch (encoding) {
                  case "hex":
                    return hexSlice(this, start, end);

                  case "utf8":
                  case "utf-8":
                    return utf8Slice(this, start, end);

                  case "ascii":
                    return asciiSlice(this, start, end);

                  case "latin1":
                  case "binary":
                    return latin1Slice(this, start, end);

                  case "base64":
                    return base64Slice(this, start, end);

                  case "ucs2":
                  case "ucs-2":
                  case "utf16le":
                  case "utf-16le":
                    return utf16leSlice(this, start, end);

                  default:
                    if (loweredCase) throw new TypeError("Unknown encoding: " + encoding);
                    encoding = (encoding + "").toLowerCase();
                    loweredCase = true;
                }
            }
        }
        Buffer.prototype._isBuffer = true;
        function swap(b, n, m) {
            var i = b[n];
            b[n] = b[m];
            b[m] = i;
        }
        Buffer.prototype.swap16 = function swap16() {
            var len = this.length;
            if (len % 2 !== 0) {
                throw new RangeError("Buffer size must be a multiple of 16-bits");
            }
            for (var i = 0; i < len; i += 2) {
                swap(this, i, i + 1);
            }
            return this;
        };
        Buffer.prototype.swap32 = function swap32() {
            var len = this.length;
            if (len % 4 !== 0) {
                throw new RangeError("Buffer size must be a multiple of 32-bits");
            }
            for (var i = 0; i < len; i += 4) {
                swap(this, i, i + 3);
                swap(this, i + 1, i + 2);
            }
            return this;
        };
        Buffer.prototype.swap64 = function swap64() {
            var len = this.length;
            if (len % 8 !== 0) {
                throw new RangeError("Buffer size must be a multiple of 64-bits");
            }
            for (var i = 0; i < len; i += 8) {
                swap(this, i, i + 7);
                swap(this, i + 1, i + 6);
                swap(this, i + 2, i + 5);
                swap(this, i + 3, i + 4);
            }
            return this;
        };
        Buffer.prototype.toString = function toString() {
            var length = this.length;
            if (length === 0) return "";
            if (arguments.length === 0) return utf8Slice(this, 0, length);
            return slowToString.apply(this, arguments);
        };
        Buffer.prototype.toLocaleString = Buffer.prototype.toString;
        Buffer.prototype.equals = function equals(b) {
            if (!Buffer.isBuffer(b)) throw new TypeError("Argument must be a Buffer");
            if (this === b) return true;
            return Buffer.compare(this, b) === 0;
        };
        Buffer.prototype.inspect = function inspect() {
            var str = "";
            var max = exports.h2;
            str = this.toString("hex", 0, max).replace(/(.{2})/g, "$1 ").trim();
            if (this.length > max) str += " ... ";
            return "<Buffer " + str + ">";
        };
        if (customInspectSymbol) {
            Buffer.prototype[customInspectSymbol] = Buffer.prototype.inspect;
        }
        Buffer.prototype.compare = function compare(target, start, end, thisStart, thisEnd) {
            if (isInstance(target, Uint8Array)) {
                target = Buffer.from(target, target.offset, target.byteLength);
            }
            if (!Buffer.isBuffer(target)) {
                throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. ' + "Received type " + typeof target);
            }
            if (start === undefined) {
                start = 0;
            }
            if (end === undefined) {
                end = target ? target.length : 0;
            }
            if (thisStart === undefined) {
                thisStart = 0;
            }
            if (thisEnd === undefined) {
                thisEnd = this.length;
            }
            if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {
                throw new RangeError("out of range index");
            }
            if (thisStart >= thisEnd && start >= end) {
                return 0;
            }
            if (thisStart >= thisEnd) {
                return -1;
            }
            if (start >= end) {
                return 1;
            }
            start >>>= 0;
            end >>>= 0;
            thisStart >>>= 0;
            thisEnd >>>= 0;
            if (this === target) return 0;
            var x = thisEnd - thisStart;
            var y = end - start;
            var len = Math.min(x, y);
            var thisCopy = this.slice(thisStart, thisEnd);
            var targetCopy = target.slice(start, end);
            for (var i = 0; i < len; ++i) {
                if (thisCopy[i] !== targetCopy[i]) {
                    x = thisCopy[i];
                    y = targetCopy[i];
                    break;
                }
            }
            if (x < y) return -1;
            if (y < x) return 1;
            return 0;
        };
        function bidirectionalIndexOf(buffer, val, byteOffset, encoding, dir) {
            if (buffer.length === 0) return -1;
            if (typeof byteOffset === "string") {
                encoding = byteOffset;
                byteOffset = 0;
            } else if (byteOffset > 2147483647) {
                byteOffset = 2147483647;
            } else if (byteOffset < -2147483648) {
                byteOffset = -2147483648;
            }
            byteOffset = +byteOffset;
            if (numberIsNaN(byteOffset)) {
                byteOffset = dir ? 0 : buffer.length - 1;
            }
            if (byteOffset < 0) byteOffset = buffer.length + byteOffset;
            if (byteOffset >= buffer.length) {
                if (dir) return -1; else byteOffset = buffer.length - 1;
            } else if (byteOffset < 0) {
                if (dir) byteOffset = 0; else return -1;
            }
            if (typeof val === "string") {
                val = Buffer.from(val, encoding);
            }
            if (Buffer.isBuffer(val)) {
                if (val.length === 0) {
                    return -1;
                }
                return arrayIndexOf(buffer, val, byteOffset, encoding, dir);
            } else if (typeof val === "number") {
                val = val & 255;
                if (typeof Uint8Array.prototype.indexOf === "function") {
                    if (dir) {
                        return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset);
                    } else {
                        return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset);
                    }
                }
                return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir);
            }
            throw new TypeError("val must be string, number or Buffer");
        }
        function arrayIndexOf(arr, val, byteOffset, encoding, dir) {
            var indexSize = 1;
            var arrLength = arr.length;
            var valLength = val.length;
            if (encoding !== undefined) {
                encoding = String(encoding).toLowerCase();
                if (encoding === "ucs2" || encoding === "ucs-2" || encoding === "utf16le" || encoding === "utf-16le") {
                    if (arr.length < 2 || val.length < 2) {
                        return -1;
                    }
                    indexSize = 2;
                    arrLength /= 2;
                    valLength /= 2;
                    byteOffset /= 2;
                }
            }
            function read(buf, i) {
                if (indexSize === 1) {
                    return buf[i];
                } else {
                    return buf.readUInt16BE(i * indexSize);
                }
            }
            var i;
            if (dir) {
                var foundIndex = -1;
                for (i = byteOffset; i < arrLength; i++) {
                    if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
                        if (foundIndex === -1) foundIndex = i;
                        if (i - foundIndex + 1 === valLength) return foundIndex * indexSize;
                    } else {
                        if (foundIndex !== -1) i -= i - foundIndex;
                        foundIndex = -1;
                    }
                }
            } else {
                if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength;
                for (i = byteOffset; i >= 0; i--) {
                    var found = true;
                    for (var j = 0; j < valLength; j++) {
                        if (read(arr, i + j) !== read(val, j)) {
                            found = false;
                            break;
                        }
                    }
                    if (found) return i;
                }
            }
            return -1;
        }
        Buffer.prototype.includes = function includes(val, byteOffset, encoding) {
            return this.indexOf(val, byteOffset, encoding) !== -1;
        };
        Buffer.prototype.indexOf = function indexOf(val, byteOffset, encoding) {
            return bidirectionalIndexOf(this, val, byteOffset, encoding, true);
        };
        Buffer.prototype.lastIndexOf = function lastIndexOf(val, byteOffset, encoding) {
            return bidirectionalIndexOf(this, val, byteOffset, encoding, false);
        };
        function hexWrite(buf, string, offset, length) {
            offset = Number(offset) || 0;
            var remaining = buf.length - offset;
            if (!length) {
                length = remaining;
            } else {
                length = Number(length);
                if (length > remaining) {
                    length = remaining;
                }
            }
            var strLen = string.length;
            if (length > strLen / 2) {
                length = strLen / 2;
            }
            for (var i = 0; i < length; ++i) {
                var parsed = parseInt(string.substr(i * 2, 2), 16);
                if (numberIsNaN(parsed)) return i;
                buf[offset + i] = parsed;
            }
            return i;
        }
        function utf8Write(buf, string, offset, length) {
            return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length);
        }
        function asciiWrite(buf, string, offset, length) {
            return blitBuffer(asciiToBytes(string), buf, offset, length);
        }
        function base64Write(buf, string, offset, length) {
            return blitBuffer(base64ToBytes(string), buf, offset, length);
        }
        function ucs2Write(buf, string, offset, length) {
            return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length);
        }
        Buffer.prototype.write = function write(string, offset, length, encoding) {
            if (offset === undefined) {
                encoding = "utf8";
                length = this.length;
                offset = 0;
            } else if (length === undefined && typeof offset === "string") {
                encoding = offset;
                length = this.length;
                offset = 0;
            } else if (isFinite(offset)) {
                offset = offset >>> 0;
                if (isFinite(length)) {
                    length = length >>> 0;
                    if (encoding === undefined) encoding = "utf8";
                } else {
                    encoding = length;
                    length = undefined;
                }
            } else {
                throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");
            }
            var remaining = this.length - offset;
            if (length === undefined || length > remaining) length = remaining;
            if (string.length > 0 && (length < 0 || offset < 0) || offset > this.length) {
                throw new RangeError("Attempt to write outside buffer bounds");
            }
            if (!encoding) encoding = "utf8";
            var loweredCase = false;
            for (;;) {
                switch (encoding) {
                  case "hex":
                    return hexWrite(this, string, offset, length);

                  case "utf8":
                  case "utf-8":
                    return utf8Write(this, string, offset, length);

                  case "ascii":
                  case "latin1":
                  case "binary":
                    return asciiWrite(this, string, offset, length);

                  case "base64":
                    return base64Write(this, string, offset, length);

                  case "ucs2":
                  case "ucs-2":
                  case "utf16le":
                  case "utf-16le":
                    return ucs2Write(this, string, offset, length);

                  default:
                    if (loweredCase) throw new TypeError("Unknown encoding: " + encoding);
                    encoding = ("" + encoding).toLowerCase();
                    loweredCase = true;
                }
            }
        };
        Buffer.prototype.toJSON = function toJSON() {
            return {
                type: "Buffer",
                data: Array.prototype.slice.call(this._arr || this, 0)
            };
        };
        function base64Slice(buf, start, end) {
            if (start === 0 && end === buf.length) {
                return base64.fromByteArray(buf);
            } else {
                return base64.fromByteArray(buf.slice(start, end));
            }
        }
        function utf8Slice(buf, start, end) {
            end = Math.min(buf.length, end);
            var res = [];
            var i = start;
            while (i < end) {
                var firstByte = buf[i];
                var codePoint = null;
                var bytesPerSequence = firstByte > 239 ? 4 : firstByte > 223 ? 3 : firstByte > 191 ? 2 : 1;
                if (i + bytesPerSequence <= end) {
                    var secondByte, thirdByte, fourthByte, tempCodePoint;
                    switch (bytesPerSequence) {
                      case 1:
                        if (firstByte < 128) {
                            codePoint = firstByte;
                        }
                        break;

                      case 2:
                        secondByte = buf[i + 1];
                        if ((secondByte & 192) === 128) {
                            tempCodePoint = (firstByte & 31) << 6 | secondByte & 63;
                            if (tempCodePoint > 127) {
                                codePoint = tempCodePoint;
                            }
                        }
                        break;

                      case 3:
                        secondByte = buf[i + 1];
                        thirdByte = buf[i + 2];
                        if ((secondByte & 192) === 128 && (thirdByte & 192) === 128) {
                            tempCodePoint = (firstByte & 15) << 12 | (secondByte & 63) << 6 | thirdByte & 63;
                            if (tempCodePoint > 2047 && (tempCodePoint < 55296 || tempCodePoint > 57343)) {
                                codePoint = tempCodePoint;
                            }
                        }
                        break;

                      case 4:
                        secondByte = buf[i + 1];
                        thirdByte = buf[i + 2];
                        fourthByte = buf[i + 3];
                        if ((secondByte & 192) === 128 && (thirdByte & 192) === 128 && (fourthByte & 192) === 128) {
                            tempCodePoint = (firstByte & 15) << 18 | (secondByte & 63) << 12 | (thirdByte & 63) << 6 | fourthByte & 63;
                            if (tempCodePoint > 65535 && tempCodePoint < 1114112) {
                                codePoint = tempCodePoint;
                            }
                        }
                    }
                }
                if (codePoint === null) {
                    codePoint = 65533;
                    bytesPerSequence = 1;
                } else if (codePoint > 65535) {
                    codePoint -= 65536;
                    res.push(codePoint >>> 10 & 1023 | 55296);
                    codePoint = 56320 | codePoint & 1023;
                }
                res.push(codePoint);
                i += bytesPerSequence;
            }
            return decodeCodePointsArray(res);
        }
        var MAX_ARGUMENTS_LENGTH = 4096;
        function decodeCodePointsArray(codePoints) {
            var len = codePoints.length;
            if (len <= MAX_ARGUMENTS_LENGTH) {
                return String.fromCharCode.apply(String, codePoints);
            }
            var res = "";
            var i = 0;
            while (i < len) {
                res += String.fromCharCode.apply(String, codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH));
            }
            return res;
        }
        function asciiSlice(buf, start, end) {
            var ret = "";
            end = Math.min(buf.length, end);
            for (var i = start; i < end; ++i) {
                ret += String.fromCharCode(buf[i] & 127);
            }
            return ret;
        }
        function latin1Slice(buf, start, end) {
            var ret = "";
            end = Math.min(buf.length, end);
            for (var i = start; i < end; ++i) {
                ret += String.fromCharCode(buf[i]);
            }
            return ret;
        }
        function hexSlice(buf, start, end) {
            var len = buf.length;
            if (!start || start < 0) start = 0;
            if (!end || end < 0 || end > len) end = len;
            var out = "";
            for (var i = start; i < end; ++i) {
                out += hexSliceLookupTable[buf[i]];
            }
            return out;
        }
        function utf16leSlice(buf, start, end) {
            var bytes = buf.slice(start, end);
            var res = "";
            for (var i = 0; i < bytes.length - 1; i += 2) {
                res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256);
            }
            return res;
        }
        Buffer.prototype.slice = function slice(start, end) {
            var len = this.length;
            start = ~~start;
            end = end === undefined ? len : ~~end;
            if (start < 0) {
                start += len;
                if (start < 0) start = 0;
            } else if (start > len) {
                start = len;
            }
            if (end < 0) {
                end += len;
                if (end < 0) end = 0;
            } else if (end > len) {
                end = len;
            }
            if (end < start) end = start;
            var newBuf = this.subarray(start, end);
            Object.setPrototypeOf(newBuf, Buffer.prototype);
            return newBuf;
        };
        function checkOffset(offset, ext, length) {
            if (offset % 1 !== 0 || offset < 0) throw new RangeError("offset is not uint");
            if (offset + ext > length) throw new RangeError("Trying to access beyond buffer length");
        }
        Buffer.prototype.readUintLE = Buffer.prototype.readUIntLE = function readUIntLE(offset, byteLength, noAssert) {
            offset = offset >>> 0;
            byteLength = byteLength >>> 0;
            if (!noAssert) checkOffset(offset, byteLength, this.length);
            var val = this[offset];
            var mul = 1;
            var i = 0;
            while (++i < byteLength && (mul *= 256)) {
                val += this[offset + i] * mul;
            }
            return val;
        };
        Buffer.prototype.readUintBE = Buffer.prototype.readUIntBE = function readUIntBE(offset, byteLength, noAssert) {
            offset = offset >>> 0;
            byteLength = byteLength >>> 0;
            if (!noAssert) {
                checkOffset(offset, byteLength, this.length);
            }
            var val = this[offset + --byteLength];
            var mul = 1;
            while (byteLength > 0 && (mul *= 256)) {
                val += this[offset + --byteLength] * mul;
            }
            return val;
        };
        Buffer.prototype.readUint8 = Buffer.prototype.readUInt8 = function readUInt8(offset, noAssert) {
            offset = offset >>> 0;
            if (!noAssert) checkOffset(offset, 1, this.length);
            return this[offset];
        };
        Buffer.prototype.readUint16LE = Buffer.prototype.readUInt16LE = function readUInt16LE(offset, noAssert) {
            offset = offset >>> 0;
            if (!noAssert) checkOffset(offset, 2, this.length);
            return this[offset] | this[offset + 1] << 8;
        };
        Buffer.prototype.readUint16BE = Buffer.prototype.readUInt16BE = function readUInt16BE(offset, noAssert) {
            offset = offset >>> 0;
            if (!noAssert) checkOffset(offset, 2, this.length);
            return this[offset] << 8 | this[offset + 1];
        };
        Buffer.prototype.readUint32LE = Buffer.prototype.readUInt32LE = function readUInt32LE(offset, noAssert) {
            offset = offset >>> 0;
            if (!noAssert) checkOffset(offset, 4, this.length);
            return (this[offset] | this[offset + 1] << 8 | this[offset + 2] << 16) + this[offset + 3] * 16777216;
        };
        Buffer.prototype.readUint32BE = Buffer.prototype.readUInt32BE = function readUInt32BE(offset, noAssert) {
            offset = offset >>> 0;
            if (!noAssert) checkOffset(offset, 4, this.length);
            return this[offset] * 16777216 + (this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3]);
        };
        Buffer.prototype.readIntLE = function readIntLE(offset, byteLength, noAssert) {
            offset = offset >>> 0;
            byteLength = byteLength >>> 0;
            if (!noAssert) checkOffset(offset, byteLength, this.length);
            var val = this[offset];
            var mul = 1;
            var i = 0;
            while (++i < byteLength && (mul *= 256)) {
                val += this[offset + i] * mul;
            }
            mul *= 128;
            if (val >= mul) val -= Math.pow(2, 8 * byteLength);
            return val;
        };
        Buffer.prototype.readIntBE = function readIntBE(offset, byteLength, noAssert) {
            offset = offset >>> 0;
            byteLength = byteLength >>> 0;
            if (!noAssert) checkOffset(offset, byteLength, this.length);
            var i = byteLength;
            var mul = 1;
            var val = this[offset + --i];
            while (i > 0 && (mul *= 256)) {
                val += this[offset + --i] * mul;
            }
            mul *= 128;
            if (val >= mul) val -= Math.pow(2, 8 * byteLength);
            return val;
        };
        Buffer.prototype.readInt8 = function readInt8(offset, noAssert) {
            offset = offset >>> 0;
            if (!noAssert) checkOffset(offset, 1, this.length);
            if (!(this[offset] & 128)) return this[offset];
            return (255 - this[offset] + 1) * -1;
        };
        Buffer.prototype.readInt16LE = function readInt16LE(offset, noAssert) {
            offset = offset >>> 0;
            if (!noAssert) checkOffset(offset, 2, this.length);
            var val = this[offset] | this[offset + 1] << 8;
            return val & 32768 ? val | 4294901760 : val;
        };
        Buffer.prototype.readInt16BE = function readInt16BE(offset, noAssert) {
            offset = offset >>> 0;
            if (!noAssert) checkOffset(offset, 2, this.length);
            var val = this[offset + 1] | this[offset] << 8;
            return val & 32768 ? val | 4294901760 : val;
        };
        Buffer.prototype.readInt32LE = function readInt32LE(offset, noAssert) {
            offset = offset >>> 0;
            if (!noAssert) checkOffset(offset, 4, this.length);
            return this[offset] | this[offset + 1] << 8 | this[offset + 2] << 16 | this[offset + 3] << 24;
        };
        Buffer.prototype.readInt32BE = function readInt32BE(offset, noAssert) {
            offset = offset >>> 0;
            if (!noAssert) checkOffset(offset, 4, this.length);
            return this[offset] << 24 | this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3];
        };
        Buffer.prototype.readFloatLE = function readFloatLE(offset, noAssert) {
            offset = offset >>> 0;
            if (!noAssert) checkOffset(offset, 4, this.length);
            return ieee754.read(this, offset, true, 23, 4);
        };
        Buffer.prototype.readFloatBE = function readFloatBE(offset, noAssert) {
            offset = offset >>> 0;
            if (!noAssert) checkOffset(offset, 4, this.length);
            return ieee754.read(this, offset, false, 23, 4);
        };
        Buffer.prototype.readDoubleLE = function readDoubleLE(offset, noAssert) {
            offset = offset >>> 0;
            if (!noAssert) checkOffset(offset, 8, this.length);
            return ieee754.read(this, offset, true, 52, 8);
        };
        Buffer.prototype.readDoubleBE = function readDoubleBE(offset, noAssert) {
            offset = offset >>> 0;
            if (!noAssert) checkOffset(offset, 8, this.length);
            return ieee754.read(this, offset, false, 52, 8);
        };
        function checkInt(buf, value, offset, ext, max, min) {
            if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance');
            if (value > max || value < min) throw new RangeError('"value" argument is out of bounds');
            if (offset + ext > buf.length) throw new RangeError("Index out of range");
        }
        Buffer.prototype.writeUintLE = Buffer.prototype.writeUIntLE = function writeUIntLE(value, offset, byteLength, noAssert) {
            value = +value;
            offset = offset >>> 0;
            byteLength = byteLength >>> 0;
            if (!noAssert) {
                var maxBytes = Math.pow(2, 8 * byteLength) - 1;
                checkInt(this, value, offset, byteLength, maxBytes, 0);
            }
            var mul = 1;
            var i = 0;
            this[offset] = value & 255;
            while (++i < byteLength && (mul *= 256)) {
                this[offset + i] = value / mul & 255;
            }
            return offset + byteLength;
        };
        Buffer.prototype.writeUintBE = Buffer.prototype.writeUIntBE = function writeUIntBE(value, offset, byteLength, noAssert) {
            value = +value;
            offset = offset >>> 0;
            byteLength = byteLength >>> 0;
            if (!noAssert) {
                var maxBytes = Math.pow(2, 8 * byteLength) - 1;
                checkInt(this, value, offset, byteLength, maxBytes, 0);
            }
            var i = byteLength - 1;
            var mul = 1;
            this[offset + i] = value & 255;
            while (--i >= 0 && (mul *= 256)) {
                this[offset + i] = value / mul & 255;
            }
            return offset + byteLength;
        };
        Buffer.prototype.writeUint8 = Buffer.prototype.writeUInt8 = function writeUInt8(value, offset, noAssert) {
            value = +value;
            offset = offset >>> 0;
            if (!noAssert) checkInt(this, value, offset, 1, 255, 0);
            this[offset] = value & 255;
            return offset + 1;
        };
        Buffer.prototype.writeUint16LE = Buffer.prototype.writeUInt16LE = function writeUInt16LE(value, offset, noAssert) {
            value = +value;
            offset = offset >>> 0;
            if (!noAssert) checkInt(this, value, offset, 2, 65535, 0);
            this[offset] = value & 255;
            this[offset + 1] = value >>> 8;
            return offset + 2;
        };
        Buffer.prototype.writeUint16BE = Buffer.prototype.writeUInt16BE = function writeUInt16BE(value, offset, noAssert) {
            value = +value;
            offset = offset >>> 0;
            if (!noAssert) checkInt(this, value, offset, 2, 65535, 0);
            this[offset] = value >>> 8;
            this[offset + 1] = value & 255;
            return offset + 2;
        };
        Buffer.prototype.writeUint32LE = Buffer.prototype.writeUInt32LE = function writeUInt32LE(value, offset, noAssert) {
            value = +value;
            offset = offset >>> 0;
            if (!noAssert) checkInt(this, value, offset, 4, 4294967295, 0);
            this[offset + 3] = value >>> 24;
            this[offset + 2] = value >>> 16;
            this[offset + 1] = value >>> 8;
            this[offset] = value & 255;
            return offset + 4;
        };
        Buffer.prototype.writeUint32BE = Buffer.prototype.writeUInt32BE = function writeUInt32BE(value, offset, noAssert) {
            value = +value;
            offset = offset >>> 0;
            if (!noAssert) checkInt(this, value, offset, 4, 4294967295, 0);
            this[offset] = value >>> 24;
            this[offset + 1] = value >>> 16;
            this[offset + 2] = value >>> 8;
            this[offset + 3] = value & 255;
            return offset + 4;
        };
        Buffer.prototype.writeIntLE = function writeIntLE(value, offset, byteLength, noAssert) {
            value = +value;
            offset = offset >>> 0;
            if (!noAssert) {
                var limit = Math.pow(2, 8 * byteLength - 1);
                checkInt(this, value, offset, byteLength, limit - 1, -limit);
            }
            var i = 0;
            var mul = 1;
            var sub = 0;
            this[offset] = value & 255;
            while (++i < byteLength && (mul *= 256)) {
                if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {
                    sub = 1;
                }
                this[offset + i] = (value / mul >> 0) - sub & 255;
            }
            return offset + byteLength;
        };
        Buffer.prototype.writeIntBE = function writeIntBE(value, offset, byteLength, noAssert) {
            value = +value;
            offset = offset >>> 0;
            if (!noAssert) {
                var limit = Math.pow(2, 8 * byteLength - 1);
                checkInt(this, value, offset, byteLength, limit - 1, -limit);
            }
            var i = byteLength - 1;
            var mul = 1;
            var sub = 0;
            this[offset + i] = value & 255;
            while (--i >= 0 && (mul *= 256)) {
                if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {
                    sub = 1;
                }
                this[offset + i] = (value / mul >> 0) - sub & 255;
            }
            return offset + byteLength;
        };
        Buffer.prototype.writeInt8 = function writeInt8(value, offset, noAssert) {
            value = +value;
            offset = offset >>> 0;
            if (!noAssert) checkInt(this, value, offset, 1, 127, -128);
            if (value < 0) value = 255 + value + 1;
            this[offset] = value & 255;
            return offset + 1;
        };
        Buffer.prototype.writeInt16LE = function writeInt16LE(value, offset, noAssert) {
            value = +value;
            offset = offset >>> 0;
            if (!noAssert) checkInt(this, value, offset, 2, 32767, -32768);
            this[offset] = value & 255;
            this[offset + 1] = value >>> 8;
            return offset + 2;
        };
        Buffer.prototype.writeInt16BE = function writeInt16BE(value, offset, noAssert) {
            value = +value;
            offset = offset >>> 0;
            if (!noAssert) checkInt(this, value, offset, 2, 32767, -32768);
            this[offset] = value >>> 8;
            this[offset + 1] = value & 255;
            return offset + 2;
        };
        Buffer.prototype.writeInt32LE = function writeInt32LE(value, offset, noAssert) {
            value = +value;
            offset = offset >>> 0;
            if (!noAssert) checkInt(this, value, offset, 4, 2147483647, -2147483648);
            this[offset] = value & 255;
            this[offset + 1] = value >>> 8;
            this[offset + 2] = value >>> 16;
            this[offset + 3] = value >>> 24;
            return offset + 4;
        };
        Buffer.prototype.writeInt32BE = function writeInt32BE(value, offset, noAssert) {
            value = +value;
            offset = offset >>> 0;
            if (!noAssert) checkInt(this, value, offset, 4, 2147483647, -2147483648);
            if (value < 0) value = 4294967295 + value + 1;
            this[offset] = value >>> 24;
            this[offset + 1] = value >>> 16;
            this[offset + 2] = value >>> 8;
            this[offset + 3] = value & 255;
            return offset + 4;
        };
        function checkIEEE754(buf, value, offset, ext, max, min) {
            if (offset + ext > buf.length) throw new RangeError("Index out of range");
            if (offset < 0) throw new RangeError("Index out of range");
        }
        function writeFloat(buf, value, offset, littleEndian, noAssert) {
            value = +value;
            offset = offset >>> 0;
            if (!noAssert) {
                checkIEEE754(buf, value, offset, 4, 34028234663852886e22, -34028234663852886e22);
            }
            ieee754.write(buf, value, offset, littleEndian, 23, 4);
            return offset + 4;
        }
        Buffer.prototype.writeFloatLE = function writeFloatLE(value, offset, noAssert) {
            return writeFloat(this, value, offset, true, noAssert);
        };
        Buffer.prototype.writeFloatBE = function writeFloatBE(value, offset, noAssert) {
            return writeFloat(this, value, offset, false, noAssert);
        };
        function writeDouble(buf, value, offset, littleEndian, noAssert) {
            value = +value;
            offset = offset >>> 0;
            if (!noAssert) {
                checkIEEE754(buf, value, offset, 8, 17976931348623157e292, -17976931348623157e292);
            }
            ieee754.write(buf, value, offset, littleEndian, 52, 8);
            return offset + 8;
        }
        Buffer.prototype.writeDoubleLE = function writeDoubleLE(value, offset, noAssert) {
            return writeDouble(this, value, offset, true, noAssert);
        };
        Buffer.prototype.writeDoubleBE = function writeDoubleBE(value, offset, noAssert) {
            return writeDouble(this, value, offset, false, noAssert);
        };
        Buffer.prototype.copy = function copy(target, targetStart, start, end) {
            if (!Buffer.isBuffer(target)) throw new TypeError("argument should be a Buffer");
            if (!start) start = 0;
            if (!end && end !== 0) end = this.length;
            if (targetStart >= target.length) targetStart = target.length;
            if (!targetStart) targetStart = 0;
            if (end > 0 && end < start) end = start;
            if (end === start) return 0;
            if (target.length === 0 || this.length === 0) return 0;
            if (targetStart < 0) {
                throw new RangeError("targetStart out of bounds");
            }
            if (start < 0 || start >= this.length) throw new RangeError("Index out of range");
            if (end < 0) throw new RangeError("sourceEnd out of bounds");
            if (end > this.length) end = this.length;
            if (target.length - targetStart < end - start) {
                end = target.length - targetStart + start;
            }
            var len = end - start;
            if (this === target && typeof Uint8Array.prototype.copyWithin === "function") {
                this.copyWithin(targetStart, start, end);
            } else {
                Uint8Array.prototype.set.call(target, this.subarray(start, end), targetStart);
            }
            return len;
        };
        Buffer.prototype.fill = function fill(val, start, end, encoding) {
            if (typeof val === "string") {
                if (typeof start === "string") {
                    encoding = start;
                    start = 0;
                    end = this.length;
                } else if (typeof end === "string") {
                    encoding = end;
                    end = this.length;
                }
                if (encoding !== undefined && typeof encoding !== "string") {
                    throw new TypeError("encoding must be a string");
                }
                if (typeof encoding === "string" && !Buffer.isEncoding(encoding)) {
                    throw new TypeError("Unknown encoding: " + encoding);
                }
                if (val.length === 1) {
                    var code = val.charCodeAt(0);
                    if (encoding === "utf8" && code < 128 || encoding === "latin1") {
                        val = code;
                    }
                }
            } else if (typeof val === "number") {
                val = val & 255;
            } else if (typeof val === "boolean") {
                val = Number(val);
            }
            if (start < 0 || this.length < start || this.length < end) {
                throw new RangeError("Out of range index");
            }
            if (end <= start) {
                return this;
            }
            start = start >>> 0;
            end = end === undefined ? this.length : end >>> 0;
            if (!val) val = 0;
            var i;
            if (typeof val === "number") {
                for (i = start; i < end; ++i) {
                    this[i] = val;
                }
            } else {
                var bytes = Buffer.isBuffer(val) ? val : Buffer.from(val, encoding);
                var len = bytes.length;
                if (len === 0) {
                    throw new TypeError('The value "' + val + '" is invalid for argument "value"');
                }
                for (i = 0; i < end - start; ++i) {
                    this[i + start] = bytes[i % len];
                }
            }
            return this;
        };
        var INVALID_BASE64_RE = /[^+/0-9A-Za-z-_]/g;
        function base64clean(str) {
            str = str.split("=")[0];
            str = str.trim().replace(INVALID_BASE64_RE, "");
            if (str.length < 2) return "";
            while (str.length % 4 !== 0) {
                str = str + "=";
            }
            return str;
        }
        function utf8ToBytes(string, units) {
            units = units || Infinity;
            var codePoint;
            var length = string.length;
            var leadSurrogate = null;
            var bytes = [];
            for (var i = 0; i < length; ++i) {
                codePoint = string.charCodeAt(i);
                if (codePoint > 55295 && codePoint < 57344) {
                    if (!leadSurrogate) {
                        if (codePoint > 56319) {
                            if ((units -= 3) > -1) bytes.push(239, 191, 189);
                            continue;
                        } else if (i + 1 === length) {
                            if ((units -= 3) > -1) bytes.push(239, 191, 189);
                            continue;
                        }
                        leadSurrogate = codePoint;
                        continue;
                    }
                    if (codePoint < 56320) {
                        if ((units -= 3) > -1) bytes.push(239, 191, 189);
                        leadSurrogate = codePoint;
                        continue;
                    }
                    codePoint = (leadSurrogate - 55296 << 10 | codePoint - 56320) + 65536;
                } else if (leadSurrogate) {
                    if ((units -= 3) > -1) bytes.push(239, 191, 189);
                }
                leadSurrogate = null;
                if (codePoint < 128) {
                    if ((units -= 1) < 0) break;
                    bytes.push(codePoint);
                } else if (codePoint < 2048) {
                    if ((units -= 2) < 0) break;
                    bytes.push(codePoint >> 6 | 192, codePoint & 63 | 128);
                } else if (codePoint < 65536) {
                    if ((units -= 3) < 0) break;
                    bytes.push(codePoint >> 12 | 224, codePoint >> 6 & 63 | 128, codePoint & 63 | 128);
                } else if (codePoint < 1114112) {
                    if ((units -= 4) < 0) break;
                    bytes.push(codePoint >> 18 | 240, codePoint >> 12 & 63 | 128, codePoint >> 6 & 63 | 128, codePoint & 63 | 128);
                } else {
                    throw new Error("Invalid code point");
                }
            }
            return bytes;
        }
        function asciiToBytes(str) {
            var byteArray = [];
            for (var i = 0; i < str.length; ++i) {
                byteArray.push(str.charCodeAt(i) & 255);
            }
            return byteArray;
        }
        function utf16leToBytes(str, units) {
            var c, hi, lo;
            var byteArray = [];
            for (var i = 0; i < str.length; ++i) {
                if ((units -= 2) < 0) break;
                c = str.charCodeAt(i);
                hi = c >> 8;
                lo = c % 256;
                byteArray.push(lo);
                byteArray.push(hi);
            }
            return byteArray;
        }
        function base64ToBytes(str) {
            return base64.toByteArray(base64clean(str));
        }
        function blitBuffer(src, dst, offset, length) {
            for (var i = 0; i < length; ++i) {
                if (i + offset >= dst.length || i >= src.length) break;
                dst[i + offset] = src[i];
            }
            return i;
        }
        function isInstance(obj, type) {
            return obj instanceof type || obj != null && obj.constructor != null && obj.constructor.name != null && obj.constructor.name === type.name;
        }
        function numberIsNaN(obj) {
            return obj !== obj;
        }
        var hexSliceLookupTable = function() {
            var alphabet = "0123456789abcdef";
            var table = new Array(256);
            for (var i = 0; i < 16; ++i) {
                var i16 = i * 16;
                for (var j = 0; j < 16; ++j) {
                    table[i16 + j] = alphabet[i] + alphabet[j];
                }
            }
            return table;
        }();
    },
    333: (__unused_webpack_module, exports) => {
        exports.read = function(buffer, offset, isLE, mLen, nBytes) {
            var e, m;
            var eLen = nBytes * 8 - mLen - 1;
            var eMax = (1 << eLen) - 1;
            var eBias = eMax >> 1;
            var nBits = -7;
            var i = isLE ? nBytes - 1 : 0;
            var d = isLE ? -1 : 1;
            var s = buffer[offset + i];
            i += d;
            e = s & (1 << -nBits) - 1;
            s >>= -nBits;
            nBits += eLen;
            for (;nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8) {}
            m = e & (1 << -nBits) - 1;
            e >>= -nBits;
            nBits += mLen;
            for (;nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8) {}
            if (e === 0) {
                e = 1 - eBias;
            } else if (e === eMax) {
                return m ? NaN : (s ? -1 : 1) * Infinity;
            } else {
                m = m + Math.pow(2, mLen);
                e = e - eBias;
            }
            return (s ? -1 : 1) * m * Math.pow(2, e - mLen);
        };
        exports.write = function(buffer, value, offset, isLE, mLen, nBytes) {
            var e, m, c;
            var eLen = nBytes * 8 - mLen - 1;
            var eMax = (1 << eLen) - 1;
            var eBias = eMax >> 1;
            var rt = mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0;
            var i = isLE ? 0 : nBytes - 1;
            var d = isLE ? 1 : -1;
            var s = value < 0 || value === 0 && 1 / value < 0 ? 1 : 0;
            value = Math.abs(value);
            if (isNaN(value) || value === Infinity) {
                m = isNaN(value) ? 1 : 0;
                e = eMax;
            } else {
                e = Math.floor(Math.log(value) / Math.LN2);
                if (value * (c = Math.pow(2, -e)) < 1) {
                    e--;
                    c *= 2;
                }
                if (e + eBias >= 1) {
                    value += rt / c;
                } else {
                    value += rt * Math.pow(2, 1 - eBias);
                }
                if (value * c >= 2) {
                    e++;
                    c /= 2;
                }
                if (e + eBias >= eMax) {
                    m = 0;
                    e = eMax;
                } else if (e + eBias >= 1) {
                    m = (value * c - 1) * Math.pow(2, mLen);
                    e = e + eBias;
                } else {
                    m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen);
                    e = 0;
                }
            }
            for (;mLen >= 8; buffer[offset + i] = m & 255, i += d, m /= 256, mLen -= 8) {}
            e = e << mLen | m;
            eLen += mLen;
            for (;eLen > 0; buffer[offset + i] = e & 255, i += d, e /= 256, eLen -= 8) {}
            buffer[offset + i - d] |= s * 128;
        };
    }
};

var __webpack_module_cache__ = {};

function __webpack_require__(moduleId) {
    var cachedModule = __webpack_module_cache__[moduleId];
    if (cachedModule !== undefined) {
        return cachedModule.exports;
    }
    var module = __webpack_module_cache__[moduleId] = {
        exports: {}
    };
    __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
    return module.exports;
}

(() => {
    __webpack_require__.d = (exports, definition) => {
        for (var key in definition) {
            if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
                Object.defineProperty(exports, key, {
                    enumerable: true,
                    get: definition[key]
                });
            }
        }
    };
})();

(() => {
    __webpack_require__.o = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop);
})();

var __webpack_exports__ = {};

(() => {
    var x = y => {
        var x = {};
        __webpack_require__.d(x, y);
        return x;
    };
    var y = x => () => x;
    const server_editor_namespaceObject = x({
        ["ActionTypes"]: () => __WEBPACK_EXTERNAL_MODULE__minecraft_server_editor_81aed4a5__.ActionTypes,
        ["BlockMaskListType"]: () => __WEBPACK_EXTERNAL_MODULE__minecraft_server_editor_81aed4a5__.BlockMaskListType,
        ["BoolPropertyItemVariant"]: () => __WEBPACK_EXTERNAL_MODULE__minecraft_server_editor_81aed4a5__.BoolPropertyItemVariant,
        ["ColorPickerPropertyItemVariant"]: () => __WEBPACK_EXTERNAL_MODULE__minecraft_server_editor_81aed4a5__.ColorPickerPropertyItemVariant,
        ["ComboBoxPropertyItemDataType"]: () => __WEBPACK_EXTERNAL_MODULE__minecraft_server_editor_81aed4a5__.ComboBoxPropertyItemDataType,
        ["CoreActionBarItemType"]: () => __WEBPACK_EXTERNAL_MODULE__minecraft_server_editor_81aed4a5__.CoreActionBarItemType,
        ["CoreMenuType"]: () => __WEBPACK_EXTERNAL_MODULE__minecraft_server_editor_81aed4a5__.CoreMenuType,
        ["CursorControlMode"]: () => __WEBPACK_EXTERNAL_MODULE__minecraft_server_editor_81aed4a5__.CursorControlMode,
        ["CursorTargetMode"]: () => __WEBPACK_EXTERNAL_MODULE__minecraft_server_editor_81aed4a5__.CursorTargetMode,
        ["DaylightCycle"]: () => __WEBPACK_EXTERNAL_MODULE__minecraft_server_editor_81aed4a5__.DaylightCycle,
        ["EditorInputContext"]: () => __WEBPACK_EXTERNAL_MODULE__minecraft_server_editor_81aed4a5__.EditorInputContext,
        ["EditorMode"]: () => __WEBPACK_EXTERNAL_MODULE__minecraft_server_editor_81aed4a5__.EditorMode,
        ["EntityOperationType"]: () => __WEBPACK_EXTERNAL_MODULE__minecraft_server_editor_81aed4a5__.EntityOperationType,
        ["ExportResult"]: () => __WEBPACK_EXTERNAL_MODULE__minecraft_server_editor_81aed4a5__.ExportResult,
        ["GamePublishSetting"]: () => __WEBPACK_EXTERNAL_MODULE__minecraft_server_editor_81aed4a5__.GamePublishSetting,
        ["GraphicsSettingsProperty"]: () => __WEBPACK_EXTERNAL_MODULE__minecraft_server_editor_81aed4a5__.GraphicsSettingsProperty,
        ["ImageResourceType"]: () => __WEBPACK_EXTERNAL_MODULE__minecraft_server_editor_81aed4a5__.ImageResourceType,
        ["InputModifier"]: () => __WEBPACK_EXTERNAL_MODULE__minecraft_server_editor_81aed4a5__.InputModifier,
        ["KeyboardKey"]: () => __WEBPACK_EXTERNAL_MODULE__minecraft_server_editor_81aed4a5__.KeyboardKey,
        ["LayoutAlignment"]: () => __WEBPACK_EXTERNAL_MODULE__minecraft_server_editor_81aed4a5__.LayoutAlignment,
        ["MouseActionType"]: () => __WEBPACK_EXTERNAL_MODULE__minecraft_server_editor_81aed4a5__.MouseActionType,
        ["MouseInputType"]: () => __WEBPACK_EXTERNAL_MODULE__minecraft_server_editor_81aed4a5__.MouseInputType,
        ["NumberPropertyItemVariant"]: () => __WEBPACK_EXTERNAL_MODULE__minecraft_server_editor_81aed4a5__.NumberPropertyItemVariant,
        ["PaintMode"]: () => __WEBPACK_EXTERNAL_MODULE__minecraft_server_editor_81aed4a5__.PaintMode,
        ["PlayerPermissionLevel"]: () => __WEBPACK_EXTERNAL_MODULE__minecraft_server_editor_81aed4a5__.PlayerPermissionLevel,
        ["PlaytestSessionResult"]: () => __WEBPACK_EXTERNAL_MODULE__minecraft_server_editor_81aed4a5__.PlaytestSessionResult,
        ["SettingsUIElement"]: () => __WEBPACK_EXTERNAL_MODULE__minecraft_server_editor_81aed4a5__.SettingsUIElement,
        ["SimpleToolWrapper"]: () => __WEBPACK_EXTERNAL_MODULE__minecraft_server_editor_81aed4a5__.SimpleToolWrapper,
        ["SpeedSettingsProperty"]: () => __WEBPACK_EXTERNAL_MODULE__minecraft_server_editor_81aed4a5__.SpeedSettingsProperty,
        ["SplineType"]: () => __WEBPACK_EXTERNAL_MODULE__minecraft_server_editor_81aed4a5__.SplineType,
        ["StatusBarAlignment"]: () => __WEBPACK_EXTERNAL_MODULE__minecraft_server_editor_81aed4a5__.StatusBarAlignment,
        ["WidgetComponentRenderPrimitiveTypeBox"]: () => __WEBPACK_EXTERNAL_MODULE__minecraft_server_editor_81aed4a5__.WidgetComponentRenderPrimitiveTypeBox,
        ["WidgetComponentRenderPrimitiveTypeDisc"]: () => __WEBPACK_EXTERNAL_MODULE__minecraft_server_editor_81aed4a5__.WidgetComponentRenderPrimitiveTypeDisc,
        ["WidgetGroupSelectionMode"]: () => __WEBPACK_EXTERNAL_MODULE__minecraft_server_editor_81aed4a5__.WidgetGroupSelectionMode,
        ["WidgetMouseButtonActionType"]: () => __WEBPACK_EXTERNAL_MODULE__minecraft_server_editor_81aed4a5__.WidgetMouseButtonActionType,
        ["bindDataSource"]: () => __WEBPACK_EXTERNAL_MODULE__minecraft_server_editor_81aed4a5__.bindDataSource,
        ["editor"]: () => __WEBPACK_EXTERNAL_MODULE__minecraft_server_editor_81aed4a5__.editor,
        ["executeLargeOperation"]: () => __WEBPACK_EXTERNAL_MODULE__minecraft_server_editor_81aed4a5__.executeLargeOperation,
        ["executeLargeOperationFromIterator"]: () => __WEBPACK_EXTERNAL_MODULE__minecraft_server_editor_81aed4a5__.executeLargeOperationFromIterator,
        ["makeObservable"]: () => __WEBPACK_EXTERNAL_MODULE__minecraft_server_editor_81aed4a5__.makeObservable,
        ["registerEditorExtension"]: () => __WEBPACK_EXTERNAL_MODULE__minecraft_server_editor_81aed4a5__.registerEditorExtension,
        ["registerUserDefinedTransactionHandler"]: () => __WEBPACK_EXTERNAL_MODULE__minecraft_server_editor_81aed4a5__.registerUserDefinedTransactionHandler,
        ["stringFromException"]: () => __WEBPACK_EXTERNAL_MODULE__minecraft_server_editor_81aed4a5__.stringFromException
    });
    var server_x = y => {
        var x = {};
        __webpack_require__.d(x, y);
        return x;
    };
    var server_y = x => () => x;
    const server_namespaceObject = server_x({
        ["BiomeTypes"]: () => __WEBPACK_EXTERNAL_MODULE__minecraft_server_fb7572af__.BiomeTypes,
        ["BlockTypes"]: () => __WEBPACK_EXTERNAL_MODULE__minecraft_server_fb7572af__.BlockTypes,
        ["BlockVolume"]: () => __WEBPACK_EXTERNAL_MODULE__minecraft_server_fb7572af__.BlockVolume,
        ["BoundingBoxUtils"]: () => __WEBPACK_EXTERNAL_MODULE__minecraft_server_fb7572af__.BoundingBoxUtils,
        ["CompoundBlockVolume"]: () => __WEBPACK_EXTERNAL_MODULE__minecraft_server_fb7572af__.CompoundBlockVolume,
        ["CompoundBlockVolumeAction"]: () => __WEBPACK_EXTERNAL_MODULE__minecraft_server_fb7572af__.CompoundBlockVolumeAction,
        ["CompoundBlockVolumePositionRelativity"]: () => __WEBPACK_EXTERNAL_MODULE__minecraft_server_fb7572af__.CompoundBlockVolumePositionRelativity,
        ["Difficulty"]: () => __WEBPACK_EXTERNAL_MODULE__minecraft_server_fb7572af__.Difficulty,
        ["Direction"]: () => __WEBPACK_EXTERNAL_MODULE__minecraft_server_fb7572af__.Direction,
        ["EasingType"]: () => __WEBPACK_EXTERNAL_MODULE__minecraft_server_fb7572af__.EasingType,
        ["GameMode"]: () => __WEBPACK_EXTERNAL_MODULE__minecraft_server_fb7572af__.GameMode,
        ["StructureMirrorAxis"]: () => __WEBPACK_EXTERNAL_MODULE__minecraft_server_fb7572af__.StructureMirrorAxis,
        ["StructureRotation"]: () => __WEBPACK_EXTERNAL_MODULE__minecraft_server_fb7572af__.StructureRotation,
        ["TicksPerSecond"]: () => __WEBPACK_EXTERNAL_MODULE__minecraft_server_fb7572af__.TicksPerSecond,
        ["TimeOfDay"]: () => __WEBPACK_EXTERNAL_MODULE__minecraft_server_fb7572af__.TimeOfDay,
        ["WeatherType"]: () => __WEBPACK_EXTERNAL_MODULE__minecraft_server_fb7572af__.WeatherType,
        ["system"]: () => __WEBPACK_EXTERNAL_MODULE__minecraft_server_fb7572af__.system,
        ["world"]: () => __WEBPACK_EXTERNAL_MODULE__minecraft_server_fb7572af__.world
    });
    var MinecraftBiomeTypes = (MinecraftBiomeTypes2 => {
        MinecraftBiomeTypes2["BambooJungle"] = "minecraft:bamboo_jungle";
        MinecraftBiomeTypes2["BambooJungleHills"] = "minecraft:bamboo_jungle_hills";
        MinecraftBiomeTypes2["BasaltDeltas"] = "minecraft:basalt_deltas";
        MinecraftBiomeTypes2["Beach"] = "minecraft:beach";
        MinecraftBiomeTypes2["BirchForest"] = "minecraft:birch_forest";
        MinecraftBiomeTypes2["BirchForestHills"] = "minecraft:birch_forest_hills";
        MinecraftBiomeTypes2["BirchForestHillsMutated"] = "minecraft:birch_forest_hills_mutated";
        MinecraftBiomeTypes2["BirchForestMutated"] = "minecraft:birch_forest_mutated";
        MinecraftBiomeTypes2["CherryGrove"] = "minecraft:cherry_grove";
        MinecraftBiomeTypes2["ColdBeach"] = "minecraft:cold_beach";
        MinecraftBiomeTypes2["ColdOcean"] = "minecraft:cold_ocean";
        MinecraftBiomeTypes2["ColdTaiga"] = "minecraft:cold_taiga";
        MinecraftBiomeTypes2["ColdTaigaHills"] = "minecraft:cold_taiga_hills";
        MinecraftBiomeTypes2["ColdTaigaMutated"] = "minecraft:cold_taiga_mutated";
        MinecraftBiomeTypes2["CrimsonForest"] = "minecraft:crimson_forest";
        MinecraftBiomeTypes2["DeepColdOcean"] = "minecraft:deep_cold_ocean";
        MinecraftBiomeTypes2["DeepDark"] = "minecraft:deep_dark";
        MinecraftBiomeTypes2["DeepFrozenOcean"] = "minecraft:deep_frozen_ocean";
        MinecraftBiomeTypes2["DeepLukewarmOcean"] = "minecraft:deep_lukewarm_ocean";
        MinecraftBiomeTypes2["DeepOcean"] = "minecraft:deep_ocean";
        MinecraftBiomeTypes2["DeepWarmOcean"] = "minecraft:deep_warm_ocean";
        MinecraftBiomeTypes2["Desert"] = "minecraft:desert";
        MinecraftBiomeTypes2["DesertHills"] = "minecraft:desert_hills";
        MinecraftBiomeTypes2["DesertMutated"] = "minecraft:desert_mutated";
        MinecraftBiomeTypes2["DripstoneCaves"] = "minecraft:dripstone_caves";
        MinecraftBiomeTypes2["ExtremeHills"] = "minecraft:extreme_hills";
        MinecraftBiomeTypes2["ExtremeHillsEdge"] = "minecraft:extreme_hills_edge";
        MinecraftBiomeTypes2["ExtremeHillsMutated"] = "minecraft:extreme_hills_mutated";
        MinecraftBiomeTypes2["ExtremeHillsPlusTrees"] = "minecraft:extreme_hills_plus_trees";
        MinecraftBiomeTypes2["ExtremeHillsPlusTreesMutated"] = "minecraft:extreme_hills_plus_trees_mutated";
        MinecraftBiomeTypes2["FlowerForest"] = "minecraft:flower_forest";
        MinecraftBiomeTypes2["Forest"] = "minecraft:forest";
        MinecraftBiomeTypes2["ForestHills"] = "minecraft:forest_hills";
        MinecraftBiomeTypes2["FrozenOcean"] = "minecraft:frozen_ocean";
        MinecraftBiomeTypes2["FrozenPeaks"] = "minecraft:frozen_peaks";
        MinecraftBiomeTypes2["FrozenRiver"] = "minecraft:frozen_river";
        MinecraftBiomeTypes2["Grove"] = "minecraft:grove";
        MinecraftBiomeTypes2["Hell"] = "minecraft:hell";
        MinecraftBiomeTypes2["IceMountains"] = "minecraft:ice_mountains";
        MinecraftBiomeTypes2["IcePlains"] = "minecraft:ice_plains";
        MinecraftBiomeTypes2["IcePlainsSpikes"] = "minecraft:ice_plains_spikes";
        MinecraftBiomeTypes2["JaggedPeaks"] = "minecraft:jagged_peaks";
        MinecraftBiomeTypes2["Jungle"] = "minecraft:jungle";
        MinecraftBiomeTypes2["JungleEdge"] = "minecraft:jungle_edge";
        MinecraftBiomeTypes2["JungleEdgeMutated"] = "minecraft:jungle_edge_mutated";
        MinecraftBiomeTypes2["JungleHills"] = "minecraft:jungle_hills";
        MinecraftBiomeTypes2["JungleMutated"] = "minecraft:jungle_mutated";
        MinecraftBiomeTypes2["LegacyFrozenOcean"] = "minecraft:legacy_frozen_ocean";
        MinecraftBiomeTypes2["LukewarmOcean"] = "minecraft:lukewarm_ocean";
        MinecraftBiomeTypes2["LushCaves"] = "minecraft:lush_caves";
        MinecraftBiomeTypes2["MangroveSwamp"] = "minecraft:mangrove_swamp";
        MinecraftBiomeTypes2["Meadow"] = "minecraft:meadow";
        MinecraftBiomeTypes2["MegaTaiga"] = "minecraft:mega_taiga";
        MinecraftBiomeTypes2["MegaTaigaHills"] = "minecraft:mega_taiga_hills";
        MinecraftBiomeTypes2["Mesa"] = "minecraft:mesa";
        MinecraftBiomeTypes2["MesaBryce"] = "minecraft:mesa_bryce";
        MinecraftBiomeTypes2["MesaPlateau"] = "minecraft:mesa_plateau";
        MinecraftBiomeTypes2["MesaPlateauMutated"] = "minecraft:mesa_plateau_mutated";
        MinecraftBiomeTypes2["MesaPlateauStone"] = "minecraft:mesa_plateau_stone";
        MinecraftBiomeTypes2["MesaPlateauStoneMutated"] = "minecraft:mesa_plateau_stone_mutated";
        MinecraftBiomeTypes2["MushroomIsland"] = "minecraft:mushroom_island";
        MinecraftBiomeTypes2["MushroomIslandShore"] = "minecraft:mushroom_island_shore";
        MinecraftBiomeTypes2["Ocean"] = "minecraft:ocean";
        MinecraftBiomeTypes2["PaleGarden"] = "minecraft:pale_garden";
        MinecraftBiomeTypes2["Plains"] = "minecraft:plains";
        MinecraftBiomeTypes2["RedwoodTaigaHillsMutated"] = "minecraft:redwood_taiga_hills_mutated";
        MinecraftBiomeTypes2["RedwoodTaigaMutated"] = "minecraft:redwood_taiga_mutated";
        MinecraftBiomeTypes2["River"] = "minecraft:river";
        MinecraftBiomeTypes2["RoofedForest"] = "minecraft:roofed_forest";
        MinecraftBiomeTypes2["RoofedForestMutated"] = "minecraft:roofed_forest_mutated";
        MinecraftBiomeTypes2["Savanna"] = "minecraft:savanna";
        MinecraftBiomeTypes2["SavannaMutated"] = "minecraft:savanna_mutated";
        MinecraftBiomeTypes2["SavannaPlateau"] = "minecraft:savanna_plateau";
        MinecraftBiomeTypes2["SavannaPlateauMutated"] = "minecraft:savanna_plateau_mutated";
        MinecraftBiomeTypes2["SnowySlopes"] = "minecraft:snowy_slopes";
        MinecraftBiomeTypes2["SoulsandValley"] = "minecraft:soulsand_valley";
        MinecraftBiomeTypes2["StoneBeach"] = "minecraft:stone_beach";
        MinecraftBiomeTypes2["StonyPeaks"] = "minecraft:stony_peaks";
        MinecraftBiomeTypes2["SunflowerPlains"] = "minecraft:sunflower_plains";
        MinecraftBiomeTypes2["Swampland"] = "minecraft:swampland";
        MinecraftBiomeTypes2["SwamplandMutated"] = "minecraft:swampland_mutated";
        MinecraftBiomeTypes2["Taiga"] = "minecraft:taiga";
        MinecraftBiomeTypes2["TaigaHills"] = "minecraft:taiga_hills";
        MinecraftBiomeTypes2["TaigaMutated"] = "minecraft:taiga_mutated";
        MinecraftBiomeTypes2["TheEnd"] = "minecraft:the_end";
        MinecraftBiomeTypes2["WarmOcean"] = "minecraft:warm_ocean";
        MinecraftBiomeTypes2["WarpedForest"] = "minecraft:warped_forest";
        return MinecraftBiomeTypes2;
    })(MinecraftBiomeTypes || {});
    var MinecraftBlockTypes = (MinecraftBlockTypes2 => {
        MinecraftBlockTypes2["AcaciaButton"] = "minecraft:acacia_button";
        MinecraftBlockTypes2["AcaciaDoor"] = "minecraft:acacia_door";
        MinecraftBlockTypes2["AcaciaDoubleSlab"] = "minecraft:acacia_double_slab";
        MinecraftBlockTypes2["AcaciaFence"] = "minecraft:acacia_fence";
        MinecraftBlockTypes2["AcaciaFenceGate"] = "minecraft:acacia_fence_gate";
        MinecraftBlockTypes2["AcaciaHangingSign"] = "minecraft:acacia_hanging_sign";
        MinecraftBlockTypes2["AcaciaLeaves"] = "minecraft:acacia_leaves";
        MinecraftBlockTypes2["AcaciaLog"] = "minecraft:acacia_log";
        MinecraftBlockTypes2["AcaciaPlanks"] = "minecraft:acacia_planks";
        MinecraftBlockTypes2["AcaciaPressurePlate"] = "minecraft:acacia_pressure_plate";
        MinecraftBlockTypes2["AcaciaSapling"] = "minecraft:acacia_sapling";
        MinecraftBlockTypes2["AcaciaSlab"] = "minecraft:acacia_slab";
        MinecraftBlockTypes2["AcaciaStairs"] = "minecraft:acacia_stairs";
        MinecraftBlockTypes2["AcaciaStandingSign"] = "minecraft:acacia_standing_sign";
        MinecraftBlockTypes2["AcaciaTrapdoor"] = "minecraft:acacia_trapdoor";
        MinecraftBlockTypes2["AcaciaWallSign"] = "minecraft:acacia_wall_sign";
        MinecraftBlockTypes2["AcaciaWood"] = "minecraft:acacia_wood";
        MinecraftBlockTypes2["ActivatorRail"] = "minecraft:activator_rail";
        MinecraftBlockTypes2["Air"] = "minecraft:air";
        MinecraftBlockTypes2["Allium"] = "minecraft:allium";
        MinecraftBlockTypes2["Allow"] = "minecraft:allow";
        MinecraftBlockTypes2["AmethystBlock"] = "minecraft:amethyst_block";
        MinecraftBlockTypes2["AmethystCluster"] = "minecraft:amethyst_cluster";
        MinecraftBlockTypes2["AncientDebris"] = "minecraft:ancient_debris";
        MinecraftBlockTypes2["Andesite"] = "minecraft:andesite";
        MinecraftBlockTypes2["AndesiteDoubleSlab"] = "minecraft:andesite_double_slab";
        MinecraftBlockTypes2["AndesiteSlab"] = "minecraft:andesite_slab";
        MinecraftBlockTypes2["AndesiteStairs"] = "minecraft:andesite_stairs";
        MinecraftBlockTypes2["AndesiteWall"] = "minecraft:andesite_wall";
        MinecraftBlockTypes2["Anvil"] = "minecraft:anvil";
        MinecraftBlockTypes2["Azalea"] = "minecraft:azalea";
        MinecraftBlockTypes2["AzaleaLeaves"] = "minecraft:azalea_leaves";
        MinecraftBlockTypes2["AzaleaLeavesFlowered"] = "minecraft:azalea_leaves_flowered";
        MinecraftBlockTypes2["AzureBluet"] = "minecraft:azure_bluet";
        MinecraftBlockTypes2["Bamboo"] = "minecraft:bamboo";
        MinecraftBlockTypes2["BambooBlock"] = "minecraft:bamboo_block";
        MinecraftBlockTypes2["BambooButton"] = "minecraft:bamboo_button";
        MinecraftBlockTypes2["BambooDoor"] = "minecraft:bamboo_door";
        MinecraftBlockTypes2["BambooDoubleSlab"] = "minecraft:bamboo_double_slab";
        MinecraftBlockTypes2["BambooFence"] = "minecraft:bamboo_fence";
        MinecraftBlockTypes2["BambooFenceGate"] = "minecraft:bamboo_fence_gate";
        MinecraftBlockTypes2["BambooHangingSign"] = "minecraft:bamboo_hanging_sign";
        MinecraftBlockTypes2["BambooMosaic"] = "minecraft:bamboo_mosaic";
        MinecraftBlockTypes2["BambooMosaicDoubleSlab"] = "minecraft:bamboo_mosaic_double_slab";
        MinecraftBlockTypes2["BambooMosaicSlab"] = "minecraft:bamboo_mosaic_slab";
        MinecraftBlockTypes2["BambooMosaicStairs"] = "minecraft:bamboo_mosaic_stairs";
        MinecraftBlockTypes2["BambooPlanks"] = "minecraft:bamboo_planks";
        MinecraftBlockTypes2["BambooPressurePlate"] = "minecraft:bamboo_pressure_plate";
        MinecraftBlockTypes2["BambooSapling"] = "minecraft:bamboo_sapling";
        MinecraftBlockTypes2["BambooSlab"] = "minecraft:bamboo_slab";
        MinecraftBlockTypes2["BambooStairs"] = "minecraft:bamboo_stairs";
        MinecraftBlockTypes2["BambooStandingSign"] = "minecraft:bamboo_standing_sign";
        MinecraftBlockTypes2["BambooTrapdoor"] = "minecraft:bamboo_trapdoor";
        MinecraftBlockTypes2["BambooWallSign"] = "minecraft:bamboo_wall_sign";
        MinecraftBlockTypes2["Barrel"] = "minecraft:barrel";
        MinecraftBlockTypes2["Barrier"] = "minecraft:barrier";
        MinecraftBlockTypes2["Basalt"] = "minecraft:basalt";
        MinecraftBlockTypes2["Beacon"] = "minecraft:beacon";
        MinecraftBlockTypes2["Bed"] = "minecraft:bed";
        MinecraftBlockTypes2["Bedrock"] = "minecraft:bedrock";
        MinecraftBlockTypes2["BeeNest"] = "minecraft:bee_nest";
        MinecraftBlockTypes2["Beehive"] = "minecraft:beehive";
        MinecraftBlockTypes2["Beetroot"] = "minecraft:beetroot";
        MinecraftBlockTypes2["Bell"] = "minecraft:bell";
        MinecraftBlockTypes2["BigDripleaf"] = "minecraft:big_dripleaf";
        MinecraftBlockTypes2["BirchButton"] = "minecraft:birch_button";
        MinecraftBlockTypes2["BirchDoor"] = "minecraft:birch_door";
        MinecraftBlockTypes2["BirchDoubleSlab"] = "minecraft:birch_double_slab";
        MinecraftBlockTypes2["BirchFence"] = "minecraft:birch_fence";
        MinecraftBlockTypes2["BirchFenceGate"] = "minecraft:birch_fence_gate";
        MinecraftBlockTypes2["BirchHangingSign"] = "minecraft:birch_hanging_sign";
        MinecraftBlockTypes2["BirchLeaves"] = "minecraft:birch_leaves";
        MinecraftBlockTypes2["BirchLog"] = "minecraft:birch_log";
        MinecraftBlockTypes2["BirchPlanks"] = "minecraft:birch_planks";
        MinecraftBlockTypes2["BirchPressurePlate"] = "minecraft:birch_pressure_plate";
        MinecraftBlockTypes2["BirchSapling"] = "minecraft:birch_sapling";
        MinecraftBlockTypes2["BirchSlab"] = "minecraft:birch_slab";
        MinecraftBlockTypes2["BirchStairs"] = "minecraft:birch_stairs";
        MinecraftBlockTypes2["BirchStandingSign"] = "minecraft:birch_standing_sign";
        MinecraftBlockTypes2["BirchTrapdoor"] = "minecraft:birch_trapdoor";
        MinecraftBlockTypes2["BirchWallSign"] = "minecraft:birch_wall_sign";
        MinecraftBlockTypes2["BirchWood"] = "minecraft:birch_wood";
        MinecraftBlockTypes2["BlackCandle"] = "minecraft:black_candle";
        MinecraftBlockTypes2["BlackCandleCake"] = "minecraft:black_candle_cake";
        MinecraftBlockTypes2["BlackCarpet"] = "minecraft:black_carpet";
        MinecraftBlockTypes2["BlackConcrete"] = "minecraft:black_concrete";
        MinecraftBlockTypes2["BlackConcretePowder"] = "minecraft:black_concrete_powder";
        MinecraftBlockTypes2["BlackGlazedTerracotta"] = "minecraft:black_glazed_terracotta";
        MinecraftBlockTypes2["BlackShulkerBox"] = "minecraft:black_shulker_box";
        MinecraftBlockTypes2["BlackStainedGlass"] = "minecraft:black_stained_glass";
        MinecraftBlockTypes2["BlackStainedGlassPane"] = "minecraft:black_stained_glass_pane";
        MinecraftBlockTypes2["BlackTerracotta"] = "minecraft:black_terracotta";
        MinecraftBlockTypes2["BlackWool"] = "minecraft:black_wool";
        MinecraftBlockTypes2["Blackstone"] = "minecraft:blackstone";
        MinecraftBlockTypes2["BlackstoneDoubleSlab"] = "minecraft:blackstone_double_slab";
        MinecraftBlockTypes2["BlackstoneSlab"] = "minecraft:blackstone_slab";
        MinecraftBlockTypes2["BlackstoneStairs"] = "minecraft:blackstone_stairs";
        MinecraftBlockTypes2["BlackstoneWall"] = "minecraft:blackstone_wall";
        MinecraftBlockTypes2["BlastFurnace"] = "minecraft:blast_furnace";
        MinecraftBlockTypes2["BlueCandle"] = "minecraft:blue_candle";
        MinecraftBlockTypes2["BlueCandleCake"] = "minecraft:blue_candle_cake";
        MinecraftBlockTypes2["BlueCarpet"] = "minecraft:blue_carpet";
        MinecraftBlockTypes2["BlueConcrete"] = "minecraft:blue_concrete";
        MinecraftBlockTypes2["BlueConcretePowder"] = "minecraft:blue_concrete_powder";
        MinecraftBlockTypes2["BlueGlazedTerracotta"] = "minecraft:blue_glazed_terracotta";
        MinecraftBlockTypes2["BlueIce"] = "minecraft:blue_ice";
        MinecraftBlockTypes2["BlueOrchid"] = "minecraft:blue_orchid";
        MinecraftBlockTypes2["BlueShulkerBox"] = "minecraft:blue_shulker_box";
        MinecraftBlockTypes2["BlueStainedGlass"] = "minecraft:blue_stained_glass";
        MinecraftBlockTypes2["BlueStainedGlassPane"] = "minecraft:blue_stained_glass_pane";
        MinecraftBlockTypes2["BlueTerracotta"] = "minecraft:blue_terracotta";
        MinecraftBlockTypes2["BlueWool"] = "minecraft:blue_wool";
        MinecraftBlockTypes2["BoneBlock"] = "minecraft:bone_block";
        MinecraftBlockTypes2["Bookshelf"] = "minecraft:bookshelf";
        MinecraftBlockTypes2["BorderBlock"] = "minecraft:border_block";
        MinecraftBlockTypes2["BrainCoral"] = "minecraft:brain_coral";
        MinecraftBlockTypes2["BrainCoralBlock"] = "minecraft:brain_coral_block";
        MinecraftBlockTypes2["BrainCoralFan"] = "minecraft:brain_coral_fan";
        MinecraftBlockTypes2["BrainCoralWallFan"] = "minecraft:brain_coral_wall_fan";
        MinecraftBlockTypes2["BrewingStand"] = "minecraft:brewing_stand";
        MinecraftBlockTypes2["BrickBlock"] = "minecraft:brick_block";
        MinecraftBlockTypes2["BrickDoubleSlab"] = "minecraft:brick_double_slab";
        MinecraftBlockTypes2["BrickSlab"] = "minecraft:brick_slab";
        MinecraftBlockTypes2["BrickStairs"] = "minecraft:brick_stairs";
        MinecraftBlockTypes2["BrickWall"] = "minecraft:brick_wall";
        MinecraftBlockTypes2["BrownCandle"] = "minecraft:brown_candle";
        MinecraftBlockTypes2["BrownCandleCake"] = "minecraft:brown_candle_cake";
        MinecraftBlockTypes2["BrownCarpet"] = "minecraft:brown_carpet";
        MinecraftBlockTypes2["BrownConcrete"] = "minecraft:brown_concrete";
        MinecraftBlockTypes2["BrownConcretePowder"] = "minecraft:brown_concrete_powder";
        MinecraftBlockTypes2["BrownGlazedTerracotta"] = "minecraft:brown_glazed_terracotta";
        MinecraftBlockTypes2["BrownMushroom"] = "minecraft:brown_mushroom";
        MinecraftBlockTypes2["BrownMushroomBlock"] = "minecraft:brown_mushroom_block";
        MinecraftBlockTypes2["BrownShulkerBox"] = "minecraft:brown_shulker_box";
        MinecraftBlockTypes2["BrownStainedGlass"] = "minecraft:brown_stained_glass";
        MinecraftBlockTypes2["BrownStainedGlassPane"] = "minecraft:brown_stained_glass_pane";
        MinecraftBlockTypes2["BrownTerracotta"] = "minecraft:brown_terracotta";
        MinecraftBlockTypes2["BrownWool"] = "minecraft:brown_wool";
        MinecraftBlockTypes2["BubbleColumn"] = "minecraft:bubble_column";
        MinecraftBlockTypes2["BubbleCoral"] = "minecraft:bubble_coral";
        MinecraftBlockTypes2["BubbleCoralBlock"] = "minecraft:bubble_coral_block";
        MinecraftBlockTypes2["BubbleCoralFan"] = "minecraft:bubble_coral_fan";
        MinecraftBlockTypes2["BubbleCoralWallFan"] = "minecraft:bubble_coral_wall_fan";
        MinecraftBlockTypes2["BuddingAmethyst"] = "minecraft:budding_amethyst";
        MinecraftBlockTypes2["Cactus"] = "minecraft:cactus";
        MinecraftBlockTypes2["Cake"] = "minecraft:cake";
        MinecraftBlockTypes2["Calcite"] = "minecraft:calcite";
        MinecraftBlockTypes2["CalibratedSculkSensor"] = "minecraft:calibrated_sculk_sensor";
        MinecraftBlockTypes2["Camera"] = "minecraft:camera";
        MinecraftBlockTypes2["Campfire"] = "minecraft:campfire";
        MinecraftBlockTypes2["Candle"] = "minecraft:candle";
        MinecraftBlockTypes2["CandleCake"] = "minecraft:candle_cake";
        MinecraftBlockTypes2["Carrots"] = "minecraft:carrots";
        MinecraftBlockTypes2["CartographyTable"] = "minecraft:cartography_table";
        MinecraftBlockTypes2["CarvedPumpkin"] = "minecraft:carved_pumpkin";
        MinecraftBlockTypes2["Cauldron"] = "minecraft:cauldron";
        MinecraftBlockTypes2["CaveVines"] = "minecraft:cave_vines";
        MinecraftBlockTypes2["CaveVinesBodyWithBerries"] = "minecraft:cave_vines_body_with_berries";
        MinecraftBlockTypes2["CaveVinesHeadWithBerries"] = "minecraft:cave_vines_head_with_berries";
        MinecraftBlockTypes2["Chain"] = "minecraft:chain";
        MinecraftBlockTypes2["ChainCommandBlock"] = "minecraft:chain_command_block";
        MinecraftBlockTypes2["ChemicalHeat"] = "minecraft:chemical_heat";
        MinecraftBlockTypes2["CherryButton"] = "minecraft:cherry_button";
        MinecraftBlockTypes2["CherryDoor"] = "minecraft:cherry_door";
        MinecraftBlockTypes2["CherryDoubleSlab"] = "minecraft:cherry_double_slab";
        MinecraftBlockTypes2["CherryFence"] = "minecraft:cherry_fence";
        MinecraftBlockTypes2["CherryFenceGate"] = "minecraft:cherry_fence_gate";
        MinecraftBlockTypes2["CherryHangingSign"] = "minecraft:cherry_hanging_sign";
        MinecraftBlockTypes2["CherryLeaves"] = "minecraft:cherry_leaves";
        MinecraftBlockTypes2["CherryLog"] = "minecraft:cherry_log";
        MinecraftBlockTypes2["CherryPlanks"] = "minecraft:cherry_planks";
        MinecraftBlockTypes2["CherryPressurePlate"] = "minecraft:cherry_pressure_plate";
        MinecraftBlockTypes2["CherrySapling"] = "minecraft:cherry_sapling";
        MinecraftBlockTypes2["CherrySlab"] = "minecraft:cherry_slab";
        MinecraftBlockTypes2["CherryStairs"] = "minecraft:cherry_stairs";
        MinecraftBlockTypes2["CherryStandingSign"] = "minecraft:cherry_standing_sign";
        MinecraftBlockTypes2["CherryTrapdoor"] = "minecraft:cherry_trapdoor";
        MinecraftBlockTypes2["CherryWallSign"] = "minecraft:cherry_wall_sign";
        MinecraftBlockTypes2["CherryWood"] = "minecraft:cherry_wood";
        MinecraftBlockTypes2["Chest"] = "minecraft:chest";
        MinecraftBlockTypes2["ChippedAnvil"] = "minecraft:chipped_anvil";
        MinecraftBlockTypes2["ChiseledBookshelf"] = "minecraft:chiseled_bookshelf";
        MinecraftBlockTypes2["ChiseledCopper"] = "minecraft:chiseled_copper";
        MinecraftBlockTypes2["ChiseledDeepslate"] = "minecraft:chiseled_deepslate";
        MinecraftBlockTypes2["ChiseledNetherBricks"] = "minecraft:chiseled_nether_bricks";
        MinecraftBlockTypes2["ChiseledPolishedBlackstone"] = "minecraft:chiseled_polished_blackstone";
        MinecraftBlockTypes2["ChiseledQuartzBlock"] = "minecraft:chiseled_quartz_block";
        MinecraftBlockTypes2["ChiseledRedSandstone"] = "minecraft:chiseled_red_sandstone";
        MinecraftBlockTypes2["ChiseledResinBricks"] = "minecraft:chiseled_resin_bricks";
        MinecraftBlockTypes2["ChiseledSandstone"] = "minecraft:chiseled_sandstone";
        MinecraftBlockTypes2["ChiseledStoneBricks"] = "minecraft:chiseled_stone_bricks";
        MinecraftBlockTypes2["ChiseledTuff"] = "minecraft:chiseled_tuff";
        MinecraftBlockTypes2["ChiseledTuffBricks"] = "minecraft:chiseled_tuff_bricks";
        MinecraftBlockTypes2["ChorusFlower"] = "minecraft:chorus_flower";
        MinecraftBlockTypes2["ChorusPlant"] = "minecraft:chorus_plant";
        MinecraftBlockTypes2["Clay"] = "minecraft:clay";
        MinecraftBlockTypes2["ClosedEyeblossom"] = "minecraft:closed_eyeblossom";
        MinecraftBlockTypes2["CoalBlock"] = "minecraft:coal_block";
        MinecraftBlockTypes2["CoalOre"] = "minecraft:coal_ore";
        MinecraftBlockTypes2["CoarseDirt"] = "minecraft:coarse_dirt";
        MinecraftBlockTypes2["CobbledDeepslate"] = "minecraft:cobbled_deepslate";
        MinecraftBlockTypes2["CobbledDeepslateDoubleSlab"] = "minecraft:cobbled_deepslate_double_slab";
        MinecraftBlockTypes2["CobbledDeepslateSlab"] = "minecraft:cobbled_deepslate_slab";
        MinecraftBlockTypes2["CobbledDeepslateStairs"] = "minecraft:cobbled_deepslate_stairs";
        MinecraftBlockTypes2["CobbledDeepslateWall"] = "minecraft:cobbled_deepslate_wall";
        MinecraftBlockTypes2["Cobblestone"] = "minecraft:cobblestone";
        MinecraftBlockTypes2["CobblestoneDoubleSlab"] = "minecraft:cobblestone_double_slab";
        MinecraftBlockTypes2["CobblestoneSlab"] = "minecraft:cobblestone_slab";
        MinecraftBlockTypes2["CobblestoneWall"] = "minecraft:cobblestone_wall";
        MinecraftBlockTypes2["Cocoa"] = "minecraft:cocoa";
        MinecraftBlockTypes2["ColoredTorchBlue"] = "minecraft:colored_torch_blue";
        MinecraftBlockTypes2["ColoredTorchGreen"] = "minecraft:colored_torch_green";
        MinecraftBlockTypes2["ColoredTorchPurple"] = "minecraft:colored_torch_purple";
        MinecraftBlockTypes2["ColoredTorchRed"] = "minecraft:colored_torch_red";
        MinecraftBlockTypes2["CommandBlock"] = "minecraft:command_block";
        MinecraftBlockTypes2["Composter"] = "minecraft:composter";
        MinecraftBlockTypes2["CompoundCreator"] = "minecraft:compound_creator";
        MinecraftBlockTypes2["Conduit"] = "minecraft:conduit";
        MinecraftBlockTypes2["CopperBlock"] = "minecraft:copper_block";
        MinecraftBlockTypes2["CopperBulb"] = "minecraft:copper_bulb";
        MinecraftBlockTypes2["CopperDoor"] = "minecraft:copper_door";
        MinecraftBlockTypes2["CopperGrate"] = "minecraft:copper_grate";
        MinecraftBlockTypes2["CopperOre"] = "minecraft:copper_ore";
        MinecraftBlockTypes2["CopperTrapdoor"] = "minecraft:copper_trapdoor";
        MinecraftBlockTypes2["Cornflower"] = "minecraft:cornflower";
        MinecraftBlockTypes2["CrackedDeepslateBricks"] = "minecraft:cracked_deepslate_bricks";
        MinecraftBlockTypes2["CrackedDeepslateTiles"] = "minecraft:cracked_deepslate_tiles";
        MinecraftBlockTypes2["CrackedNetherBricks"] = "minecraft:cracked_nether_bricks";
        MinecraftBlockTypes2["CrackedPolishedBlackstoneBricks"] = "minecraft:cracked_polished_blackstone_bricks";
        MinecraftBlockTypes2["CrackedStoneBricks"] = "minecraft:cracked_stone_bricks";
        MinecraftBlockTypes2["Crafter"] = "minecraft:crafter";
        MinecraftBlockTypes2["CraftingTable"] = "minecraft:crafting_table";
        MinecraftBlockTypes2["CreakingHeart"] = "minecraft:creaking_heart";
        MinecraftBlockTypes2["CreeperHead"] = "minecraft:creeper_head";
        MinecraftBlockTypes2["CrimsonButton"] = "minecraft:crimson_button";
        MinecraftBlockTypes2["CrimsonDoor"] = "minecraft:crimson_door";
        MinecraftBlockTypes2["CrimsonDoubleSlab"] = "minecraft:crimson_double_slab";
        MinecraftBlockTypes2["CrimsonFence"] = "minecraft:crimson_fence";
        MinecraftBlockTypes2["CrimsonFenceGate"] = "minecraft:crimson_fence_gate";
        MinecraftBlockTypes2["CrimsonFungus"] = "minecraft:crimson_fungus";
        MinecraftBlockTypes2["CrimsonHangingSign"] = "minecraft:crimson_hanging_sign";
        MinecraftBlockTypes2["CrimsonHyphae"] = "minecraft:crimson_hyphae";
        MinecraftBlockTypes2["CrimsonNylium"] = "minecraft:crimson_nylium";
        MinecraftBlockTypes2["CrimsonPlanks"] = "minecraft:crimson_planks";
        MinecraftBlockTypes2["CrimsonPressurePlate"] = "minecraft:crimson_pressure_plate";
        MinecraftBlockTypes2["CrimsonRoots"] = "minecraft:crimson_roots";
        MinecraftBlockTypes2["CrimsonSlab"] = "minecraft:crimson_slab";
        MinecraftBlockTypes2["CrimsonStairs"] = "minecraft:crimson_stairs";
        MinecraftBlockTypes2["CrimsonStandingSign"] = "minecraft:crimson_standing_sign";
        MinecraftBlockTypes2["CrimsonStem"] = "minecraft:crimson_stem";
        MinecraftBlockTypes2["CrimsonTrapdoor"] = "minecraft:crimson_trapdoor";
        MinecraftBlockTypes2["CrimsonWallSign"] = "minecraft:crimson_wall_sign";
        MinecraftBlockTypes2["CryingObsidian"] = "minecraft:crying_obsidian";
        MinecraftBlockTypes2["CutCopper"] = "minecraft:cut_copper";
        MinecraftBlockTypes2["CutCopperSlab"] = "minecraft:cut_copper_slab";
        MinecraftBlockTypes2["CutCopperStairs"] = "minecraft:cut_copper_stairs";
        MinecraftBlockTypes2["CutRedSandstone"] = "minecraft:cut_red_sandstone";
        MinecraftBlockTypes2["CutRedSandstoneDoubleSlab"] = "minecraft:cut_red_sandstone_double_slab";
        MinecraftBlockTypes2["CutRedSandstoneSlab"] = "minecraft:cut_red_sandstone_slab";
        MinecraftBlockTypes2["CutSandstone"] = "minecraft:cut_sandstone";
        MinecraftBlockTypes2["CutSandstoneDoubleSlab"] = "minecraft:cut_sandstone_double_slab";
        MinecraftBlockTypes2["CutSandstoneSlab"] = "minecraft:cut_sandstone_slab";
        MinecraftBlockTypes2["CyanCandle"] = "minecraft:cyan_candle";
        MinecraftBlockTypes2["CyanCandleCake"] = "minecraft:cyan_candle_cake";
        MinecraftBlockTypes2["CyanCarpet"] = "minecraft:cyan_carpet";
        MinecraftBlockTypes2["CyanConcrete"] = "minecraft:cyan_concrete";
        MinecraftBlockTypes2["CyanConcretePowder"] = "minecraft:cyan_concrete_powder";
        MinecraftBlockTypes2["CyanGlazedTerracotta"] = "minecraft:cyan_glazed_terracotta";
        MinecraftBlockTypes2["CyanShulkerBox"] = "minecraft:cyan_shulker_box";
        MinecraftBlockTypes2["CyanStainedGlass"] = "minecraft:cyan_stained_glass";
        MinecraftBlockTypes2["CyanStainedGlassPane"] = "minecraft:cyan_stained_glass_pane";
        MinecraftBlockTypes2["CyanTerracotta"] = "minecraft:cyan_terracotta";
        MinecraftBlockTypes2["CyanWool"] = "minecraft:cyan_wool";
        MinecraftBlockTypes2["DamagedAnvil"] = "minecraft:damaged_anvil";
        MinecraftBlockTypes2["Dandelion"] = "minecraft:dandelion";
        MinecraftBlockTypes2["DarkOakButton"] = "minecraft:dark_oak_button";
        MinecraftBlockTypes2["DarkOakDoor"] = "minecraft:dark_oak_door";
        MinecraftBlockTypes2["DarkOakDoubleSlab"] = "minecraft:dark_oak_double_slab";
        MinecraftBlockTypes2["DarkOakFence"] = "minecraft:dark_oak_fence";
        MinecraftBlockTypes2["DarkOakFenceGate"] = "minecraft:dark_oak_fence_gate";
        MinecraftBlockTypes2["DarkOakHangingSign"] = "minecraft:dark_oak_hanging_sign";
        MinecraftBlockTypes2["DarkOakLeaves"] = "minecraft:dark_oak_leaves";
        MinecraftBlockTypes2["DarkOakLog"] = "minecraft:dark_oak_log";
        MinecraftBlockTypes2["DarkOakPlanks"] = "minecraft:dark_oak_planks";
        MinecraftBlockTypes2["DarkOakPressurePlate"] = "minecraft:dark_oak_pressure_plate";
        MinecraftBlockTypes2["DarkOakSapling"] = "minecraft:dark_oak_sapling";
        MinecraftBlockTypes2["DarkOakSlab"] = "minecraft:dark_oak_slab";
        MinecraftBlockTypes2["DarkOakStairs"] = "minecraft:dark_oak_stairs";
        MinecraftBlockTypes2["DarkOakTrapdoor"] = "minecraft:dark_oak_trapdoor";
        MinecraftBlockTypes2["DarkOakWood"] = "minecraft:dark_oak_wood";
        MinecraftBlockTypes2["DarkPrismarine"] = "minecraft:dark_prismarine";
        MinecraftBlockTypes2["DarkPrismarineDoubleSlab"] = "minecraft:dark_prismarine_double_slab";
        MinecraftBlockTypes2["DarkPrismarineSlab"] = "minecraft:dark_prismarine_slab";
        MinecraftBlockTypes2["DarkPrismarineStairs"] = "minecraft:dark_prismarine_stairs";
        MinecraftBlockTypes2["DarkoakStandingSign"] = "minecraft:darkoak_standing_sign";
        MinecraftBlockTypes2["DarkoakWallSign"] = "minecraft:darkoak_wall_sign";
        MinecraftBlockTypes2["DaylightDetector"] = "minecraft:daylight_detector";
        MinecraftBlockTypes2["DaylightDetectorInverted"] = "minecraft:daylight_detector_inverted";
        MinecraftBlockTypes2["DeadBrainCoral"] = "minecraft:dead_brain_coral";
        MinecraftBlockTypes2["DeadBrainCoralBlock"] = "minecraft:dead_brain_coral_block";
        MinecraftBlockTypes2["DeadBrainCoralFan"] = "minecraft:dead_brain_coral_fan";
        MinecraftBlockTypes2["DeadBrainCoralWallFan"] = "minecraft:dead_brain_coral_wall_fan";
        MinecraftBlockTypes2["DeadBubbleCoral"] = "minecraft:dead_bubble_coral";
        MinecraftBlockTypes2["DeadBubbleCoralBlock"] = "minecraft:dead_bubble_coral_block";
        MinecraftBlockTypes2["DeadBubbleCoralFan"] = "minecraft:dead_bubble_coral_fan";
        MinecraftBlockTypes2["DeadBubbleCoralWallFan"] = "minecraft:dead_bubble_coral_wall_fan";
        MinecraftBlockTypes2["DeadFireCoral"] = "minecraft:dead_fire_coral";
        MinecraftBlockTypes2["DeadFireCoralBlock"] = "minecraft:dead_fire_coral_block";
        MinecraftBlockTypes2["DeadFireCoralFan"] = "minecraft:dead_fire_coral_fan";
        MinecraftBlockTypes2["DeadFireCoralWallFan"] = "minecraft:dead_fire_coral_wall_fan";
        MinecraftBlockTypes2["DeadHornCoral"] = "minecraft:dead_horn_coral";
        MinecraftBlockTypes2["DeadHornCoralBlock"] = "minecraft:dead_horn_coral_block";
        MinecraftBlockTypes2["DeadHornCoralFan"] = "minecraft:dead_horn_coral_fan";
        MinecraftBlockTypes2["DeadHornCoralWallFan"] = "minecraft:dead_horn_coral_wall_fan";
        MinecraftBlockTypes2["DeadTubeCoral"] = "minecraft:dead_tube_coral";
        MinecraftBlockTypes2["DeadTubeCoralBlock"] = "minecraft:dead_tube_coral_block";
        MinecraftBlockTypes2["DeadTubeCoralFan"] = "minecraft:dead_tube_coral_fan";
        MinecraftBlockTypes2["DeadTubeCoralWallFan"] = "minecraft:dead_tube_coral_wall_fan";
        MinecraftBlockTypes2["Deadbush"] = "minecraft:deadbush";
        MinecraftBlockTypes2["DecoratedPot"] = "minecraft:decorated_pot";
        MinecraftBlockTypes2["Deepslate"] = "minecraft:deepslate";
        MinecraftBlockTypes2["DeepslateBrickDoubleSlab"] = "minecraft:deepslate_brick_double_slab";
        MinecraftBlockTypes2["DeepslateBrickSlab"] = "minecraft:deepslate_brick_slab";
        MinecraftBlockTypes2["DeepslateBrickStairs"] = "minecraft:deepslate_brick_stairs";
        MinecraftBlockTypes2["DeepslateBrickWall"] = "minecraft:deepslate_brick_wall";
        MinecraftBlockTypes2["DeepslateBricks"] = "minecraft:deepslate_bricks";
        MinecraftBlockTypes2["DeepslateCoalOre"] = "minecraft:deepslate_coal_ore";
        MinecraftBlockTypes2["DeepslateCopperOre"] = "minecraft:deepslate_copper_ore";
        MinecraftBlockTypes2["DeepslateDiamondOre"] = "minecraft:deepslate_diamond_ore";
        MinecraftBlockTypes2["DeepslateEmeraldOre"] = "minecraft:deepslate_emerald_ore";
        MinecraftBlockTypes2["DeepslateGoldOre"] = "minecraft:deepslate_gold_ore";
        MinecraftBlockTypes2["DeepslateIronOre"] = "minecraft:deepslate_iron_ore";
        MinecraftBlockTypes2["DeepslateLapisOre"] = "minecraft:deepslate_lapis_ore";
        MinecraftBlockTypes2["DeepslateRedstoneOre"] = "minecraft:deepslate_redstone_ore";
        MinecraftBlockTypes2["DeepslateTileDoubleSlab"] = "minecraft:deepslate_tile_double_slab";
        MinecraftBlockTypes2["DeepslateTileSlab"] = "minecraft:deepslate_tile_slab";
        MinecraftBlockTypes2["DeepslateTileStairs"] = "minecraft:deepslate_tile_stairs";
        MinecraftBlockTypes2["DeepslateTileWall"] = "minecraft:deepslate_tile_wall";
        MinecraftBlockTypes2["DeepslateTiles"] = "minecraft:deepslate_tiles";
        MinecraftBlockTypes2["Deny"] = "minecraft:deny";
        MinecraftBlockTypes2["DetectorRail"] = "minecraft:detector_rail";
        MinecraftBlockTypes2["DiamondBlock"] = "minecraft:diamond_block";
        MinecraftBlockTypes2["DiamondOre"] = "minecraft:diamond_ore";
        MinecraftBlockTypes2["Diorite"] = "minecraft:diorite";
        MinecraftBlockTypes2["DioriteDoubleSlab"] = "minecraft:diorite_double_slab";
        MinecraftBlockTypes2["DioriteSlab"] = "minecraft:diorite_slab";
        MinecraftBlockTypes2["DioriteStairs"] = "minecraft:diorite_stairs";
        MinecraftBlockTypes2["DioriteWall"] = "minecraft:diorite_wall";
        MinecraftBlockTypes2["Dirt"] = "minecraft:dirt";
        MinecraftBlockTypes2["DirtWithRoots"] = "minecraft:dirt_with_roots";
        MinecraftBlockTypes2["Dispenser"] = "minecraft:dispenser";
        MinecraftBlockTypes2["DoubleCutCopperSlab"] = "minecraft:double_cut_copper_slab";
        MinecraftBlockTypes2["DragonEgg"] = "minecraft:dragon_egg";
        MinecraftBlockTypes2["DragonHead"] = "minecraft:dragon_head";
        MinecraftBlockTypes2["DriedKelpBlock"] = "minecraft:dried_kelp_block";
        MinecraftBlockTypes2["DripstoneBlock"] = "minecraft:dripstone_block";
        MinecraftBlockTypes2["Dropper"] = "minecraft:dropper";
        MinecraftBlockTypes2["Element0"] = "minecraft:element_0";
        MinecraftBlockTypes2["Element1"] = "minecraft:element_1";
        MinecraftBlockTypes2["Element10"] = "minecraft:element_10";
        MinecraftBlockTypes2["Element100"] = "minecraft:element_100";
        MinecraftBlockTypes2["Element101"] = "minecraft:element_101";
        MinecraftBlockTypes2["Element102"] = "minecraft:element_102";
        MinecraftBlockTypes2["Element103"] = "minecraft:element_103";
        MinecraftBlockTypes2["Element104"] = "minecraft:element_104";
        MinecraftBlockTypes2["Element105"] = "minecraft:element_105";
        MinecraftBlockTypes2["Element106"] = "minecraft:element_106";
        MinecraftBlockTypes2["Element107"] = "minecraft:element_107";
        MinecraftBlockTypes2["Element108"] = "minecraft:element_108";
        MinecraftBlockTypes2["Element109"] = "minecraft:element_109";
        MinecraftBlockTypes2["Element11"] = "minecraft:element_11";
        MinecraftBlockTypes2["Element110"] = "minecraft:element_110";
        MinecraftBlockTypes2["Element111"] = "minecraft:element_111";
        MinecraftBlockTypes2["Element112"] = "minecraft:element_112";
        MinecraftBlockTypes2["Element113"] = "minecraft:element_113";
        MinecraftBlockTypes2["Element114"] = "minecraft:element_114";
        MinecraftBlockTypes2["Element115"] = "minecraft:element_115";
        MinecraftBlockTypes2["Element116"] = "minecraft:element_116";
        MinecraftBlockTypes2["Element117"] = "minecraft:element_117";
        MinecraftBlockTypes2["Element118"] = "minecraft:element_118";
        MinecraftBlockTypes2["Element12"] = "minecraft:element_12";
        MinecraftBlockTypes2["Element13"] = "minecraft:element_13";
        MinecraftBlockTypes2["Element14"] = "minecraft:element_14";
        MinecraftBlockTypes2["Element15"] = "minecraft:element_15";
        MinecraftBlockTypes2["Element16"] = "minecraft:element_16";
        MinecraftBlockTypes2["Element17"] = "minecraft:element_17";
        MinecraftBlockTypes2["Element18"] = "minecraft:element_18";
        MinecraftBlockTypes2["Element19"] = "minecraft:element_19";
        MinecraftBlockTypes2["Element2"] = "minecraft:element_2";
        MinecraftBlockTypes2["Element20"] = "minecraft:element_20";
        MinecraftBlockTypes2["Element21"] = "minecraft:element_21";
        MinecraftBlockTypes2["Element22"] = "minecraft:element_22";
        MinecraftBlockTypes2["Element23"] = "minecraft:element_23";
        MinecraftBlockTypes2["Element24"] = "minecraft:element_24";
        MinecraftBlockTypes2["Element25"] = "minecraft:element_25";
        MinecraftBlockTypes2["Element26"] = "minecraft:element_26";
        MinecraftBlockTypes2["Element27"] = "minecraft:element_27";
        MinecraftBlockTypes2["Element28"] = "minecraft:element_28";
        MinecraftBlockTypes2["Element29"] = "minecraft:element_29";
        MinecraftBlockTypes2["Element3"] = "minecraft:element_3";
        MinecraftBlockTypes2["Element30"] = "minecraft:element_30";
        MinecraftBlockTypes2["Element31"] = "minecraft:element_31";
        MinecraftBlockTypes2["Element32"] = "minecraft:element_32";
        MinecraftBlockTypes2["Element33"] = "minecraft:element_33";
        MinecraftBlockTypes2["Element34"] = "minecraft:element_34";
        MinecraftBlockTypes2["Element35"] = "minecraft:element_35";
        MinecraftBlockTypes2["Element36"] = "minecraft:element_36";
        MinecraftBlockTypes2["Element37"] = "minecraft:element_37";
        MinecraftBlockTypes2["Element38"] = "minecraft:element_38";
        MinecraftBlockTypes2["Element39"] = "minecraft:element_39";
        MinecraftBlockTypes2["Element4"] = "minecraft:element_4";
        MinecraftBlockTypes2["Element40"] = "minecraft:element_40";
        MinecraftBlockTypes2["Element41"] = "minecraft:element_41";
        MinecraftBlockTypes2["Element42"] = "minecraft:element_42";
        MinecraftBlockTypes2["Element43"] = "minecraft:element_43";
        MinecraftBlockTypes2["Element44"] = "minecraft:element_44";
        MinecraftBlockTypes2["Element45"] = "minecraft:element_45";
        MinecraftBlockTypes2["Element46"] = "minecraft:element_46";
        MinecraftBlockTypes2["Element47"] = "minecraft:element_47";
        MinecraftBlockTypes2["Element48"] = "minecraft:element_48";
        MinecraftBlockTypes2["Element49"] = "minecraft:element_49";
        MinecraftBlockTypes2["Element5"] = "minecraft:element_5";
        MinecraftBlockTypes2["Element50"] = "minecraft:element_50";
        MinecraftBlockTypes2["Element51"] = "minecraft:element_51";
        MinecraftBlockTypes2["Element52"] = "minecraft:element_52";
        MinecraftBlockTypes2["Element53"] = "minecraft:element_53";
        MinecraftBlockTypes2["Element54"] = "minecraft:element_54";
        MinecraftBlockTypes2["Element55"] = "minecraft:element_55";
        MinecraftBlockTypes2["Element56"] = "minecraft:element_56";
        MinecraftBlockTypes2["Element57"] = "minecraft:element_57";
        MinecraftBlockTypes2["Element58"] = "minecraft:element_58";
        MinecraftBlockTypes2["Element59"] = "minecraft:element_59";
        MinecraftBlockTypes2["Element6"] = "minecraft:element_6";
        MinecraftBlockTypes2["Element60"] = "minecraft:element_60";
        MinecraftBlockTypes2["Element61"] = "minecraft:element_61";
        MinecraftBlockTypes2["Element62"] = "minecraft:element_62";
        MinecraftBlockTypes2["Element63"] = "minecraft:element_63";
        MinecraftBlockTypes2["Element64"] = "minecraft:element_64";
        MinecraftBlockTypes2["Element65"] = "minecraft:element_65";
        MinecraftBlockTypes2["Element66"] = "minecraft:element_66";
        MinecraftBlockTypes2["Element67"] = "minecraft:element_67";
        MinecraftBlockTypes2["Element68"] = "minecraft:element_68";
        MinecraftBlockTypes2["Element69"] = "minecraft:element_69";
        MinecraftBlockTypes2["Element7"] = "minecraft:element_7";
        MinecraftBlockTypes2["Element70"] = "minecraft:element_70";
        MinecraftBlockTypes2["Element71"] = "minecraft:element_71";
        MinecraftBlockTypes2["Element72"] = "minecraft:element_72";
        MinecraftBlockTypes2["Element73"] = "minecraft:element_73";
        MinecraftBlockTypes2["Element74"] = "minecraft:element_74";
        MinecraftBlockTypes2["Element75"] = "minecraft:element_75";
        MinecraftBlockTypes2["Element76"] = "minecraft:element_76";
        MinecraftBlockTypes2["Element77"] = "minecraft:element_77";
        MinecraftBlockTypes2["Element78"] = "minecraft:element_78";
        MinecraftBlockTypes2["Element79"] = "minecraft:element_79";
        MinecraftBlockTypes2["Element8"] = "minecraft:element_8";
        MinecraftBlockTypes2["Element80"] = "minecraft:element_80";
        MinecraftBlockTypes2["Element81"] = "minecraft:element_81";
        MinecraftBlockTypes2["Element82"] = "minecraft:element_82";
        MinecraftBlockTypes2["Element83"] = "minecraft:element_83";
        MinecraftBlockTypes2["Element84"] = "minecraft:element_84";
        MinecraftBlockTypes2["Element85"] = "minecraft:element_85";
        MinecraftBlockTypes2["Element86"] = "minecraft:element_86";
        MinecraftBlockTypes2["Element87"] = "minecraft:element_87";
        MinecraftBlockTypes2["Element88"] = "minecraft:element_88";
        MinecraftBlockTypes2["Element89"] = "minecraft:element_89";
        MinecraftBlockTypes2["Element9"] = "minecraft:element_9";
        MinecraftBlockTypes2["Element90"] = "minecraft:element_90";
        MinecraftBlockTypes2["Element91"] = "minecraft:element_91";
        MinecraftBlockTypes2["Element92"] = "minecraft:element_92";
        MinecraftBlockTypes2["Element93"] = "minecraft:element_93";
        MinecraftBlockTypes2["Element94"] = "minecraft:element_94";
        MinecraftBlockTypes2["Element95"] = "minecraft:element_95";
        MinecraftBlockTypes2["Element96"] = "minecraft:element_96";
        MinecraftBlockTypes2["Element97"] = "minecraft:element_97";
        MinecraftBlockTypes2["Element98"] = "minecraft:element_98";
        MinecraftBlockTypes2["Element99"] = "minecraft:element_99";
        MinecraftBlockTypes2["ElementConstructor"] = "minecraft:element_constructor";
        MinecraftBlockTypes2["EmeraldBlock"] = "minecraft:emerald_block";
        MinecraftBlockTypes2["EmeraldOre"] = "minecraft:emerald_ore";
        MinecraftBlockTypes2["EnchantingTable"] = "minecraft:enchanting_table";
        MinecraftBlockTypes2["EndBrickStairs"] = "minecraft:end_brick_stairs";
        MinecraftBlockTypes2["EndBricks"] = "minecraft:end_bricks";
        MinecraftBlockTypes2["EndPortal"] = "minecraft:end_portal";
        MinecraftBlockTypes2["EndPortalFrame"] = "minecraft:end_portal_frame";
        MinecraftBlockTypes2["EndRod"] = "minecraft:end_rod";
        MinecraftBlockTypes2["EndStone"] = "minecraft:end_stone";
        MinecraftBlockTypes2["EndStoneBrickDoubleSlab"] = "minecraft:end_stone_brick_double_slab";
        MinecraftBlockTypes2["EndStoneBrickSlab"] = "minecraft:end_stone_brick_slab";
        MinecraftBlockTypes2["EndStoneBrickWall"] = "minecraft:end_stone_brick_wall";
        MinecraftBlockTypes2["EnderChest"] = "minecraft:ender_chest";
        MinecraftBlockTypes2["ExposedChiseledCopper"] = "minecraft:exposed_chiseled_copper";
        MinecraftBlockTypes2["ExposedCopper"] = "minecraft:exposed_copper";
        MinecraftBlockTypes2["ExposedCopperBulb"] = "minecraft:exposed_copper_bulb";
        MinecraftBlockTypes2["ExposedCopperDoor"] = "minecraft:exposed_copper_door";
        MinecraftBlockTypes2["ExposedCopperGrate"] = "minecraft:exposed_copper_grate";
        MinecraftBlockTypes2["ExposedCopperTrapdoor"] = "minecraft:exposed_copper_trapdoor";
        MinecraftBlockTypes2["ExposedCutCopper"] = "minecraft:exposed_cut_copper";
        MinecraftBlockTypes2["ExposedCutCopperSlab"] = "minecraft:exposed_cut_copper_slab";
        MinecraftBlockTypes2["ExposedCutCopperStairs"] = "minecraft:exposed_cut_copper_stairs";
        MinecraftBlockTypes2["ExposedDoubleCutCopperSlab"] = "minecraft:exposed_double_cut_copper_slab";
        MinecraftBlockTypes2["Farmland"] = "minecraft:farmland";
        MinecraftBlockTypes2["FenceGate"] = "minecraft:fence_gate";
        MinecraftBlockTypes2["Fern"] = "minecraft:fern";
        MinecraftBlockTypes2["Fire"] = "minecraft:fire";
        MinecraftBlockTypes2["FireCoral"] = "minecraft:fire_coral";
        MinecraftBlockTypes2["FireCoralBlock"] = "minecraft:fire_coral_block";
        MinecraftBlockTypes2["FireCoralFan"] = "minecraft:fire_coral_fan";
        MinecraftBlockTypes2["FireCoralWallFan"] = "minecraft:fire_coral_wall_fan";
        MinecraftBlockTypes2["FletchingTable"] = "minecraft:fletching_table";
        MinecraftBlockTypes2["FlowerPot"] = "minecraft:flower_pot";
        MinecraftBlockTypes2["FloweringAzalea"] = "minecraft:flowering_azalea";
        MinecraftBlockTypes2["FlowingLava"] = "minecraft:flowing_lava";
        MinecraftBlockTypes2["FlowingWater"] = "minecraft:flowing_water";
        MinecraftBlockTypes2["Frame"] = "minecraft:frame";
        MinecraftBlockTypes2["FrogSpawn"] = "minecraft:frog_spawn";
        MinecraftBlockTypes2["FrostedIce"] = "minecraft:frosted_ice";
        MinecraftBlockTypes2["Furnace"] = "minecraft:furnace";
        MinecraftBlockTypes2["GildedBlackstone"] = "minecraft:gilded_blackstone";
        MinecraftBlockTypes2["Glass"] = "minecraft:glass";
        MinecraftBlockTypes2["GlassPane"] = "minecraft:glass_pane";
        MinecraftBlockTypes2["GlowFrame"] = "minecraft:glow_frame";
        MinecraftBlockTypes2["GlowLichen"] = "minecraft:glow_lichen";
        MinecraftBlockTypes2["Glowstone"] = "minecraft:glowstone";
        MinecraftBlockTypes2["GoldBlock"] = "minecraft:gold_block";
        MinecraftBlockTypes2["GoldOre"] = "minecraft:gold_ore";
        MinecraftBlockTypes2["GoldenRail"] = "minecraft:golden_rail";
        MinecraftBlockTypes2["Granite"] = "minecraft:granite";
        MinecraftBlockTypes2["GraniteDoubleSlab"] = "minecraft:granite_double_slab";
        MinecraftBlockTypes2["GraniteSlab"] = "minecraft:granite_slab";
        MinecraftBlockTypes2["GraniteStairs"] = "minecraft:granite_stairs";
        MinecraftBlockTypes2["GraniteWall"] = "minecraft:granite_wall";
        MinecraftBlockTypes2["GrassBlock"] = "minecraft:grass_block";
        MinecraftBlockTypes2["GrassPath"] = "minecraft:grass_path";
        MinecraftBlockTypes2["Gravel"] = "minecraft:gravel";
        MinecraftBlockTypes2["GrayCandle"] = "minecraft:gray_candle";
        MinecraftBlockTypes2["GrayCandleCake"] = "minecraft:gray_candle_cake";
        MinecraftBlockTypes2["GrayCarpet"] = "minecraft:gray_carpet";
        MinecraftBlockTypes2["GrayConcrete"] = "minecraft:gray_concrete";
        MinecraftBlockTypes2["GrayConcretePowder"] = "minecraft:gray_concrete_powder";
        MinecraftBlockTypes2["GrayGlazedTerracotta"] = "minecraft:gray_glazed_terracotta";
        MinecraftBlockTypes2["GrayShulkerBox"] = "minecraft:gray_shulker_box";
        MinecraftBlockTypes2["GrayStainedGlass"] = "minecraft:gray_stained_glass";
        MinecraftBlockTypes2["GrayStainedGlassPane"] = "minecraft:gray_stained_glass_pane";
        MinecraftBlockTypes2["GrayTerracotta"] = "minecraft:gray_terracotta";
        MinecraftBlockTypes2["GrayWool"] = "minecraft:gray_wool";
        MinecraftBlockTypes2["GreenCandle"] = "minecraft:green_candle";
        MinecraftBlockTypes2["GreenCandleCake"] = "minecraft:green_candle_cake";
        MinecraftBlockTypes2["GreenCarpet"] = "minecraft:green_carpet";
        MinecraftBlockTypes2["GreenConcrete"] = "minecraft:green_concrete";
        MinecraftBlockTypes2["GreenConcretePowder"] = "minecraft:green_concrete_powder";
        MinecraftBlockTypes2["GreenGlazedTerracotta"] = "minecraft:green_glazed_terracotta";
        MinecraftBlockTypes2["GreenShulkerBox"] = "minecraft:green_shulker_box";
        MinecraftBlockTypes2["GreenStainedGlass"] = "minecraft:green_stained_glass";
        MinecraftBlockTypes2["GreenStainedGlassPane"] = "minecraft:green_stained_glass_pane";
        MinecraftBlockTypes2["GreenTerracotta"] = "minecraft:green_terracotta";
        MinecraftBlockTypes2["GreenWool"] = "minecraft:green_wool";
        MinecraftBlockTypes2["Grindstone"] = "minecraft:grindstone";
        MinecraftBlockTypes2["HangingRoots"] = "minecraft:hanging_roots";
        MinecraftBlockTypes2["HardBlackStainedGlass"] = "minecraft:hard_black_stained_glass";
        MinecraftBlockTypes2["HardBlackStainedGlassPane"] = "minecraft:hard_black_stained_glass_pane";
        MinecraftBlockTypes2["HardBlueStainedGlass"] = "minecraft:hard_blue_stained_glass";
        MinecraftBlockTypes2["HardBlueStainedGlassPane"] = "minecraft:hard_blue_stained_glass_pane";
        MinecraftBlockTypes2["HardBrownStainedGlass"] = "minecraft:hard_brown_stained_glass";
        MinecraftBlockTypes2["HardBrownStainedGlassPane"] = "minecraft:hard_brown_stained_glass_pane";
        MinecraftBlockTypes2["HardCyanStainedGlass"] = "minecraft:hard_cyan_stained_glass";
        MinecraftBlockTypes2["HardCyanStainedGlassPane"] = "minecraft:hard_cyan_stained_glass_pane";
        MinecraftBlockTypes2["HardGlass"] = "minecraft:hard_glass";
        MinecraftBlockTypes2["HardGlassPane"] = "minecraft:hard_glass_pane";
        MinecraftBlockTypes2["HardGrayStainedGlass"] = "minecraft:hard_gray_stained_glass";
        MinecraftBlockTypes2["HardGrayStainedGlassPane"] = "minecraft:hard_gray_stained_glass_pane";
        MinecraftBlockTypes2["HardGreenStainedGlass"] = "minecraft:hard_green_stained_glass";
        MinecraftBlockTypes2["HardGreenStainedGlassPane"] = "minecraft:hard_green_stained_glass_pane";
        MinecraftBlockTypes2["HardLightBlueStainedGlass"] = "minecraft:hard_light_blue_stained_glass";
        MinecraftBlockTypes2["HardLightBlueStainedGlassPane"] = "minecraft:hard_light_blue_stained_glass_pane";
        MinecraftBlockTypes2["HardLightGrayStainedGlass"] = "minecraft:hard_light_gray_stained_glass";
        MinecraftBlockTypes2["HardLightGrayStainedGlassPane"] = "minecraft:hard_light_gray_stained_glass_pane";
        MinecraftBlockTypes2["HardLimeStainedGlass"] = "minecraft:hard_lime_stained_glass";
        MinecraftBlockTypes2["HardLimeStainedGlassPane"] = "minecraft:hard_lime_stained_glass_pane";
        MinecraftBlockTypes2["HardMagentaStainedGlass"] = "minecraft:hard_magenta_stained_glass";
        MinecraftBlockTypes2["HardMagentaStainedGlassPane"] = "minecraft:hard_magenta_stained_glass_pane";
        MinecraftBlockTypes2["HardOrangeStainedGlass"] = "minecraft:hard_orange_stained_glass";
        MinecraftBlockTypes2["HardOrangeStainedGlassPane"] = "minecraft:hard_orange_stained_glass_pane";
        MinecraftBlockTypes2["HardPinkStainedGlass"] = "minecraft:hard_pink_stained_glass";
        MinecraftBlockTypes2["HardPinkStainedGlassPane"] = "minecraft:hard_pink_stained_glass_pane";
        MinecraftBlockTypes2["HardPurpleStainedGlass"] = "minecraft:hard_purple_stained_glass";
        MinecraftBlockTypes2["HardPurpleStainedGlassPane"] = "minecraft:hard_purple_stained_glass_pane";
        MinecraftBlockTypes2["HardRedStainedGlass"] = "minecraft:hard_red_stained_glass";
        MinecraftBlockTypes2["HardRedStainedGlassPane"] = "minecraft:hard_red_stained_glass_pane";
        MinecraftBlockTypes2["HardWhiteStainedGlass"] = "minecraft:hard_white_stained_glass";
        MinecraftBlockTypes2["HardWhiteStainedGlassPane"] = "minecraft:hard_white_stained_glass_pane";
        MinecraftBlockTypes2["HardYellowStainedGlass"] = "minecraft:hard_yellow_stained_glass";
        MinecraftBlockTypes2["HardYellowStainedGlassPane"] = "minecraft:hard_yellow_stained_glass_pane";
        MinecraftBlockTypes2["HardenedClay"] = "minecraft:hardened_clay";
        MinecraftBlockTypes2["HayBlock"] = "minecraft:hay_block";
        MinecraftBlockTypes2["HeavyCore"] = "minecraft:heavy_core";
        MinecraftBlockTypes2["HeavyWeightedPressurePlate"] = "minecraft:heavy_weighted_pressure_plate";
        MinecraftBlockTypes2["HoneyBlock"] = "minecraft:honey_block";
        MinecraftBlockTypes2["HoneycombBlock"] = "minecraft:honeycomb_block";
        MinecraftBlockTypes2["Hopper"] = "minecraft:hopper";
        MinecraftBlockTypes2["HornCoral"] = "minecraft:horn_coral";
        MinecraftBlockTypes2["HornCoralBlock"] = "minecraft:horn_coral_block";
        MinecraftBlockTypes2["HornCoralFan"] = "minecraft:horn_coral_fan";
        MinecraftBlockTypes2["HornCoralWallFan"] = "minecraft:horn_coral_wall_fan";
        MinecraftBlockTypes2["Ice"] = "minecraft:ice";
        MinecraftBlockTypes2["InfestedChiseledStoneBricks"] = "minecraft:infested_chiseled_stone_bricks";
        MinecraftBlockTypes2["InfestedCobblestone"] = "minecraft:infested_cobblestone";
        MinecraftBlockTypes2["InfestedCrackedStoneBricks"] = "minecraft:infested_cracked_stone_bricks";
        MinecraftBlockTypes2["InfestedDeepslate"] = "minecraft:infested_deepslate";
        MinecraftBlockTypes2["InfestedMossyStoneBricks"] = "minecraft:infested_mossy_stone_bricks";
        MinecraftBlockTypes2["InfestedStone"] = "minecraft:infested_stone";
        MinecraftBlockTypes2["InfestedStoneBricks"] = "minecraft:infested_stone_bricks";
        MinecraftBlockTypes2["IronBars"] = "minecraft:iron_bars";
        MinecraftBlockTypes2["IronBlock"] = "minecraft:iron_block";
        MinecraftBlockTypes2["IronDoor"] = "minecraft:iron_door";
        MinecraftBlockTypes2["IronOre"] = "minecraft:iron_ore";
        MinecraftBlockTypes2["IronTrapdoor"] = "minecraft:iron_trapdoor";
        MinecraftBlockTypes2["Jigsaw"] = "minecraft:jigsaw";
        MinecraftBlockTypes2["Jukebox"] = "minecraft:jukebox";
        MinecraftBlockTypes2["JungleButton"] = "minecraft:jungle_button";
        MinecraftBlockTypes2["JungleDoor"] = "minecraft:jungle_door";
        MinecraftBlockTypes2["JungleDoubleSlab"] = "minecraft:jungle_double_slab";
        MinecraftBlockTypes2["JungleFence"] = "minecraft:jungle_fence";
        MinecraftBlockTypes2["JungleFenceGate"] = "minecraft:jungle_fence_gate";
        MinecraftBlockTypes2["JungleHangingSign"] = "minecraft:jungle_hanging_sign";
        MinecraftBlockTypes2["JungleLeaves"] = "minecraft:jungle_leaves";
        MinecraftBlockTypes2["JungleLog"] = "minecraft:jungle_log";
        MinecraftBlockTypes2["JunglePlanks"] = "minecraft:jungle_planks";
        MinecraftBlockTypes2["JunglePressurePlate"] = "minecraft:jungle_pressure_plate";
        MinecraftBlockTypes2["JungleSapling"] = "minecraft:jungle_sapling";
        MinecraftBlockTypes2["JungleSlab"] = "minecraft:jungle_slab";
        MinecraftBlockTypes2["JungleStairs"] = "minecraft:jungle_stairs";
        MinecraftBlockTypes2["JungleStandingSign"] = "minecraft:jungle_standing_sign";
        MinecraftBlockTypes2["JungleTrapdoor"] = "minecraft:jungle_trapdoor";
        MinecraftBlockTypes2["JungleWallSign"] = "minecraft:jungle_wall_sign";
        MinecraftBlockTypes2["JungleWood"] = "minecraft:jungle_wood";
        MinecraftBlockTypes2["Kelp"] = "minecraft:kelp";
        MinecraftBlockTypes2["LabTable"] = "minecraft:lab_table";
        MinecraftBlockTypes2["Ladder"] = "minecraft:ladder";
        MinecraftBlockTypes2["Lantern"] = "minecraft:lantern";
        MinecraftBlockTypes2["LapisBlock"] = "minecraft:lapis_block";
        MinecraftBlockTypes2["LapisOre"] = "minecraft:lapis_ore";
        MinecraftBlockTypes2["LargeAmethystBud"] = "minecraft:large_amethyst_bud";
        MinecraftBlockTypes2["LargeFern"] = "minecraft:large_fern";
        MinecraftBlockTypes2["Lava"] = "minecraft:lava";
        MinecraftBlockTypes2["Lectern"] = "minecraft:lectern";
        MinecraftBlockTypes2["Lever"] = "minecraft:lever";
        MinecraftBlockTypes2["LightBlock0"] = "minecraft:light_block_0";
        MinecraftBlockTypes2["LightBlock1"] = "minecraft:light_block_1";
        MinecraftBlockTypes2["LightBlock10"] = "minecraft:light_block_10";
        MinecraftBlockTypes2["LightBlock11"] = "minecraft:light_block_11";
        MinecraftBlockTypes2["LightBlock12"] = "minecraft:light_block_12";
        MinecraftBlockTypes2["LightBlock13"] = "minecraft:light_block_13";
        MinecraftBlockTypes2["LightBlock14"] = "minecraft:light_block_14";
        MinecraftBlockTypes2["LightBlock15"] = "minecraft:light_block_15";
        MinecraftBlockTypes2["LightBlock2"] = "minecraft:light_block_2";
        MinecraftBlockTypes2["LightBlock3"] = "minecraft:light_block_3";
        MinecraftBlockTypes2["LightBlock4"] = "minecraft:light_block_4";
        MinecraftBlockTypes2["LightBlock5"] = "minecraft:light_block_5";
        MinecraftBlockTypes2["LightBlock6"] = "minecraft:light_block_6";
        MinecraftBlockTypes2["LightBlock7"] = "minecraft:light_block_7";
        MinecraftBlockTypes2["LightBlock8"] = "minecraft:light_block_8";
        MinecraftBlockTypes2["LightBlock9"] = "minecraft:light_block_9";
        MinecraftBlockTypes2["LightBlueCandle"] = "minecraft:light_blue_candle";
        MinecraftBlockTypes2["LightBlueCandleCake"] = "minecraft:light_blue_candle_cake";
        MinecraftBlockTypes2["LightBlueCarpet"] = "minecraft:light_blue_carpet";
        MinecraftBlockTypes2["LightBlueConcrete"] = "minecraft:light_blue_concrete";
        MinecraftBlockTypes2["LightBlueConcretePowder"] = "minecraft:light_blue_concrete_powder";
        MinecraftBlockTypes2["LightBlueGlazedTerracotta"] = "minecraft:light_blue_glazed_terracotta";
        MinecraftBlockTypes2["LightBlueShulkerBox"] = "minecraft:light_blue_shulker_box";
        MinecraftBlockTypes2["LightBlueStainedGlass"] = "minecraft:light_blue_stained_glass";
        MinecraftBlockTypes2["LightBlueStainedGlassPane"] = "minecraft:light_blue_stained_glass_pane";
        MinecraftBlockTypes2["LightBlueTerracotta"] = "minecraft:light_blue_terracotta";
        MinecraftBlockTypes2["LightBlueWool"] = "minecraft:light_blue_wool";
        MinecraftBlockTypes2["LightGrayCandle"] = "minecraft:light_gray_candle";
        MinecraftBlockTypes2["LightGrayCandleCake"] = "minecraft:light_gray_candle_cake";
        MinecraftBlockTypes2["LightGrayCarpet"] = "minecraft:light_gray_carpet";
        MinecraftBlockTypes2["LightGrayConcrete"] = "minecraft:light_gray_concrete";
        MinecraftBlockTypes2["LightGrayConcretePowder"] = "minecraft:light_gray_concrete_powder";
        MinecraftBlockTypes2["LightGrayShulkerBox"] = "minecraft:light_gray_shulker_box";
        MinecraftBlockTypes2["LightGrayStainedGlass"] = "minecraft:light_gray_stained_glass";
        MinecraftBlockTypes2["LightGrayStainedGlassPane"] = "minecraft:light_gray_stained_glass_pane";
        MinecraftBlockTypes2["LightGrayTerracotta"] = "minecraft:light_gray_terracotta";
        MinecraftBlockTypes2["LightGrayWool"] = "minecraft:light_gray_wool";
        MinecraftBlockTypes2["LightWeightedPressurePlate"] = "minecraft:light_weighted_pressure_plate";
        MinecraftBlockTypes2["LightningRod"] = "minecraft:lightning_rod";
        MinecraftBlockTypes2["Lilac"] = "minecraft:lilac";
        MinecraftBlockTypes2["LilyOfTheValley"] = "minecraft:lily_of_the_valley";
        MinecraftBlockTypes2["LimeCandle"] = "minecraft:lime_candle";
        MinecraftBlockTypes2["LimeCandleCake"] = "minecraft:lime_candle_cake";
        MinecraftBlockTypes2["LimeCarpet"] = "minecraft:lime_carpet";
        MinecraftBlockTypes2["LimeConcrete"] = "minecraft:lime_concrete";
        MinecraftBlockTypes2["LimeConcretePowder"] = "minecraft:lime_concrete_powder";
        MinecraftBlockTypes2["LimeGlazedTerracotta"] = "minecraft:lime_glazed_terracotta";
        MinecraftBlockTypes2["LimeShulkerBox"] = "minecraft:lime_shulker_box";
        MinecraftBlockTypes2["LimeStainedGlass"] = "minecraft:lime_stained_glass";
        MinecraftBlockTypes2["LimeStainedGlassPane"] = "minecraft:lime_stained_glass_pane";
        MinecraftBlockTypes2["LimeTerracotta"] = "minecraft:lime_terracotta";
        MinecraftBlockTypes2["LimeWool"] = "minecraft:lime_wool";
        MinecraftBlockTypes2["LitBlastFurnace"] = "minecraft:lit_blast_furnace";
        MinecraftBlockTypes2["LitDeepslateRedstoneOre"] = "minecraft:lit_deepslate_redstone_ore";
        MinecraftBlockTypes2["LitFurnace"] = "minecraft:lit_furnace";
        MinecraftBlockTypes2["LitPumpkin"] = "minecraft:lit_pumpkin";
        MinecraftBlockTypes2["LitRedstoneLamp"] = "minecraft:lit_redstone_lamp";
        MinecraftBlockTypes2["LitRedstoneOre"] = "minecraft:lit_redstone_ore";
        MinecraftBlockTypes2["LitSmoker"] = "minecraft:lit_smoker";
        MinecraftBlockTypes2["Lodestone"] = "minecraft:lodestone";
        MinecraftBlockTypes2["Loom"] = "minecraft:loom";
        MinecraftBlockTypes2["MagentaCandle"] = "minecraft:magenta_candle";
        MinecraftBlockTypes2["MagentaCandleCake"] = "minecraft:magenta_candle_cake";
        MinecraftBlockTypes2["MagentaCarpet"] = "minecraft:magenta_carpet";
        MinecraftBlockTypes2["MagentaConcrete"] = "minecraft:magenta_concrete";
        MinecraftBlockTypes2["MagentaConcretePowder"] = "minecraft:magenta_concrete_powder";
        MinecraftBlockTypes2["MagentaGlazedTerracotta"] = "minecraft:magenta_glazed_terracotta";
        MinecraftBlockTypes2["MagentaShulkerBox"] = "minecraft:magenta_shulker_box";
        MinecraftBlockTypes2["MagentaStainedGlass"] = "minecraft:magenta_stained_glass";
        MinecraftBlockTypes2["MagentaStainedGlassPane"] = "minecraft:magenta_stained_glass_pane";
        MinecraftBlockTypes2["MagentaTerracotta"] = "minecraft:magenta_terracotta";
        MinecraftBlockTypes2["MagentaWool"] = "minecraft:magenta_wool";
        MinecraftBlockTypes2["Magma"] = "minecraft:magma";
        MinecraftBlockTypes2["MangroveButton"] = "minecraft:mangrove_button";
        MinecraftBlockTypes2["MangroveDoor"] = "minecraft:mangrove_door";
        MinecraftBlockTypes2["MangroveDoubleSlab"] = "minecraft:mangrove_double_slab";
        MinecraftBlockTypes2["MangroveFence"] = "minecraft:mangrove_fence";
        MinecraftBlockTypes2["MangroveFenceGate"] = "minecraft:mangrove_fence_gate";
        MinecraftBlockTypes2["MangroveHangingSign"] = "minecraft:mangrove_hanging_sign";
        MinecraftBlockTypes2["MangroveLeaves"] = "minecraft:mangrove_leaves";
        MinecraftBlockTypes2["MangroveLog"] = "minecraft:mangrove_log";
        MinecraftBlockTypes2["MangrovePlanks"] = "minecraft:mangrove_planks";
        MinecraftBlockTypes2["MangrovePressurePlate"] = "minecraft:mangrove_pressure_plate";
        MinecraftBlockTypes2["MangrovePropagule"] = "minecraft:mangrove_propagule";
        MinecraftBlockTypes2["MangroveRoots"] = "minecraft:mangrove_roots";
        MinecraftBlockTypes2["MangroveSlab"] = "minecraft:mangrove_slab";
        MinecraftBlockTypes2["MangroveStairs"] = "minecraft:mangrove_stairs";
        MinecraftBlockTypes2["MangroveStandingSign"] = "minecraft:mangrove_standing_sign";
        MinecraftBlockTypes2["MangroveTrapdoor"] = "minecraft:mangrove_trapdoor";
        MinecraftBlockTypes2["MangroveWallSign"] = "minecraft:mangrove_wall_sign";
        MinecraftBlockTypes2["MangroveWood"] = "minecraft:mangrove_wood";
        MinecraftBlockTypes2["MaterialReducer"] = "minecraft:material_reducer";
        MinecraftBlockTypes2["MediumAmethystBud"] = "minecraft:medium_amethyst_bud";
        MinecraftBlockTypes2["MelonBlock"] = "minecraft:melon_block";
        MinecraftBlockTypes2["MelonStem"] = "minecraft:melon_stem";
        MinecraftBlockTypes2["MobSpawner"] = "minecraft:mob_spawner";
        MinecraftBlockTypes2["MossBlock"] = "minecraft:moss_block";
        MinecraftBlockTypes2["MossCarpet"] = "minecraft:moss_carpet";
        MinecraftBlockTypes2["MossyCobblestone"] = "minecraft:mossy_cobblestone";
        MinecraftBlockTypes2["MossyCobblestoneDoubleSlab"] = "minecraft:mossy_cobblestone_double_slab";
        MinecraftBlockTypes2["MossyCobblestoneSlab"] = "minecraft:mossy_cobblestone_slab";
        MinecraftBlockTypes2["MossyCobblestoneStairs"] = "minecraft:mossy_cobblestone_stairs";
        MinecraftBlockTypes2["MossyCobblestoneWall"] = "minecraft:mossy_cobblestone_wall";
        MinecraftBlockTypes2["MossyStoneBrickDoubleSlab"] = "minecraft:mossy_stone_brick_double_slab";
        MinecraftBlockTypes2["MossyStoneBrickSlab"] = "minecraft:mossy_stone_brick_slab";
        MinecraftBlockTypes2["MossyStoneBrickStairs"] = "minecraft:mossy_stone_brick_stairs";
        MinecraftBlockTypes2["MossyStoneBrickWall"] = "minecraft:mossy_stone_brick_wall";
        MinecraftBlockTypes2["MossyStoneBricks"] = "minecraft:mossy_stone_bricks";
        MinecraftBlockTypes2["Mud"] = "minecraft:mud";
        MinecraftBlockTypes2["MudBrickDoubleSlab"] = "minecraft:mud_brick_double_slab";
        MinecraftBlockTypes2["MudBrickSlab"] = "minecraft:mud_brick_slab";
        MinecraftBlockTypes2["MudBrickStairs"] = "minecraft:mud_brick_stairs";
        MinecraftBlockTypes2["MudBrickWall"] = "minecraft:mud_brick_wall";
        MinecraftBlockTypes2["MudBricks"] = "minecraft:mud_bricks";
        MinecraftBlockTypes2["MuddyMangroveRoots"] = "minecraft:muddy_mangrove_roots";
        MinecraftBlockTypes2["MushroomStem"] = "minecraft:mushroom_stem";
        MinecraftBlockTypes2["Mycelium"] = "minecraft:mycelium";
        MinecraftBlockTypes2["NetherBrick"] = "minecraft:nether_brick";
        MinecraftBlockTypes2["NetherBrickDoubleSlab"] = "minecraft:nether_brick_double_slab";
        MinecraftBlockTypes2["NetherBrickFence"] = "minecraft:nether_brick_fence";
        MinecraftBlockTypes2["NetherBrickSlab"] = "minecraft:nether_brick_slab";
        MinecraftBlockTypes2["NetherBrickStairs"] = "minecraft:nether_brick_stairs";
        MinecraftBlockTypes2["NetherBrickWall"] = "minecraft:nether_brick_wall";
        MinecraftBlockTypes2["NetherGoldOre"] = "minecraft:nether_gold_ore";
        MinecraftBlockTypes2["NetherSprouts"] = "minecraft:nether_sprouts";
        MinecraftBlockTypes2["NetherWart"] = "minecraft:nether_wart";
        MinecraftBlockTypes2["NetherWartBlock"] = "minecraft:nether_wart_block";
        MinecraftBlockTypes2["NetheriteBlock"] = "minecraft:netherite_block";
        MinecraftBlockTypes2["Netherrack"] = "minecraft:netherrack";
        MinecraftBlockTypes2["NormalStoneDoubleSlab"] = "minecraft:normal_stone_double_slab";
        MinecraftBlockTypes2["NormalStoneSlab"] = "minecraft:normal_stone_slab";
        MinecraftBlockTypes2["NormalStoneStairs"] = "minecraft:normal_stone_stairs";
        MinecraftBlockTypes2["Noteblock"] = "minecraft:noteblock";
        MinecraftBlockTypes2["OakDoubleSlab"] = "minecraft:oak_double_slab";
        MinecraftBlockTypes2["OakFence"] = "minecraft:oak_fence";
        MinecraftBlockTypes2["OakHangingSign"] = "minecraft:oak_hanging_sign";
        MinecraftBlockTypes2["OakLeaves"] = "minecraft:oak_leaves";
        MinecraftBlockTypes2["OakLog"] = "minecraft:oak_log";
        MinecraftBlockTypes2["OakPlanks"] = "minecraft:oak_planks";
        MinecraftBlockTypes2["OakSapling"] = "minecraft:oak_sapling";
        MinecraftBlockTypes2["OakSlab"] = "minecraft:oak_slab";
        MinecraftBlockTypes2["OakStairs"] = "minecraft:oak_stairs";
        MinecraftBlockTypes2["OakWood"] = "minecraft:oak_wood";
        MinecraftBlockTypes2["Observer"] = "minecraft:observer";
        MinecraftBlockTypes2["Obsidian"] = "minecraft:obsidian";
        MinecraftBlockTypes2["OchreFroglight"] = "minecraft:ochre_froglight";
        MinecraftBlockTypes2["OpenEyeblossom"] = "minecraft:open_eyeblossom";
        MinecraftBlockTypes2["OrangeCandle"] = "minecraft:orange_candle";
        MinecraftBlockTypes2["OrangeCandleCake"] = "minecraft:orange_candle_cake";
        MinecraftBlockTypes2["OrangeCarpet"] = "minecraft:orange_carpet";
        MinecraftBlockTypes2["OrangeConcrete"] = "minecraft:orange_concrete";
        MinecraftBlockTypes2["OrangeConcretePowder"] = "minecraft:orange_concrete_powder";
        MinecraftBlockTypes2["OrangeGlazedTerracotta"] = "minecraft:orange_glazed_terracotta";
        MinecraftBlockTypes2["OrangeShulkerBox"] = "minecraft:orange_shulker_box";
        MinecraftBlockTypes2["OrangeStainedGlass"] = "minecraft:orange_stained_glass";
        MinecraftBlockTypes2["OrangeStainedGlassPane"] = "minecraft:orange_stained_glass_pane";
        MinecraftBlockTypes2["OrangeTerracotta"] = "minecraft:orange_terracotta";
        MinecraftBlockTypes2["OrangeTulip"] = "minecraft:orange_tulip";
        MinecraftBlockTypes2["OrangeWool"] = "minecraft:orange_wool";
        MinecraftBlockTypes2["OxeyeDaisy"] = "minecraft:oxeye_daisy";
        MinecraftBlockTypes2["OxidizedChiseledCopper"] = "minecraft:oxidized_chiseled_copper";
        MinecraftBlockTypes2["OxidizedCopper"] = "minecraft:oxidized_copper";
        MinecraftBlockTypes2["OxidizedCopperBulb"] = "minecraft:oxidized_copper_bulb";
        MinecraftBlockTypes2["OxidizedCopperDoor"] = "minecraft:oxidized_copper_door";
        MinecraftBlockTypes2["OxidizedCopperGrate"] = "minecraft:oxidized_copper_grate";
        MinecraftBlockTypes2["OxidizedCopperTrapdoor"] = "minecraft:oxidized_copper_trapdoor";
        MinecraftBlockTypes2["OxidizedCutCopper"] = "minecraft:oxidized_cut_copper";
        MinecraftBlockTypes2["OxidizedCutCopperSlab"] = "minecraft:oxidized_cut_copper_slab";
        MinecraftBlockTypes2["OxidizedCutCopperStairs"] = "minecraft:oxidized_cut_copper_stairs";
        MinecraftBlockTypes2["OxidizedDoubleCutCopperSlab"] = "minecraft:oxidized_double_cut_copper_slab";
        MinecraftBlockTypes2["PackedIce"] = "minecraft:packed_ice";
        MinecraftBlockTypes2["PackedMud"] = "minecraft:packed_mud";
        MinecraftBlockTypes2["PaleHangingMoss"] = "minecraft:pale_hanging_moss";
        MinecraftBlockTypes2["PaleMossBlock"] = "minecraft:pale_moss_block";
        MinecraftBlockTypes2["PaleMossCarpet"] = "minecraft:pale_moss_carpet";
        MinecraftBlockTypes2["PaleOakButton"] = "minecraft:pale_oak_button";
        MinecraftBlockTypes2["PaleOakDoor"] = "minecraft:pale_oak_door";
        MinecraftBlockTypes2["PaleOakDoubleSlab"] = "minecraft:pale_oak_double_slab";
        MinecraftBlockTypes2["PaleOakFence"] = "minecraft:pale_oak_fence";
        MinecraftBlockTypes2["PaleOakFenceGate"] = "minecraft:pale_oak_fence_gate";
        MinecraftBlockTypes2["PaleOakHangingSign"] = "minecraft:pale_oak_hanging_sign";
        MinecraftBlockTypes2["PaleOakLeaves"] = "minecraft:pale_oak_leaves";
        MinecraftBlockTypes2["PaleOakLog"] = "minecraft:pale_oak_log";
        MinecraftBlockTypes2["PaleOakPlanks"] = "minecraft:pale_oak_planks";
        MinecraftBlockTypes2["PaleOakPressurePlate"] = "minecraft:pale_oak_pressure_plate";
        MinecraftBlockTypes2["PaleOakSapling"] = "minecraft:pale_oak_sapling";
        MinecraftBlockTypes2["PaleOakSlab"] = "minecraft:pale_oak_slab";
        MinecraftBlockTypes2["PaleOakStairs"] = "minecraft:pale_oak_stairs";
        MinecraftBlockTypes2["PaleOakStandingSign"] = "minecraft:pale_oak_standing_sign";
        MinecraftBlockTypes2["PaleOakTrapdoor"] = "minecraft:pale_oak_trapdoor";
        MinecraftBlockTypes2["PaleOakWallSign"] = "minecraft:pale_oak_wall_sign";
        MinecraftBlockTypes2["PaleOakWood"] = "minecraft:pale_oak_wood";
        MinecraftBlockTypes2["PearlescentFroglight"] = "minecraft:pearlescent_froglight";
        MinecraftBlockTypes2["Peony"] = "minecraft:peony";
        MinecraftBlockTypes2["PetrifiedOakDoubleSlab"] = "minecraft:petrified_oak_double_slab";
        MinecraftBlockTypes2["PetrifiedOakSlab"] = "minecraft:petrified_oak_slab";
        MinecraftBlockTypes2["PiglinHead"] = "minecraft:piglin_head";
        MinecraftBlockTypes2["PinkCandle"] = "minecraft:pink_candle";
        MinecraftBlockTypes2["PinkCandleCake"] = "minecraft:pink_candle_cake";
        MinecraftBlockTypes2["PinkCarpet"] = "minecraft:pink_carpet";
        MinecraftBlockTypes2["PinkConcrete"] = "minecraft:pink_concrete";
        MinecraftBlockTypes2["PinkConcretePowder"] = "minecraft:pink_concrete_powder";
        MinecraftBlockTypes2["PinkGlazedTerracotta"] = "minecraft:pink_glazed_terracotta";
        MinecraftBlockTypes2["PinkPetals"] = "minecraft:pink_petals";
        MinecraftBlockTypes2["PinkShulkerBox"] = "minecraft:pink_shulker_box";
        MinecraftBlockTypes2["PinkStainedGlass"] = "minecraft:pink_stained_glass";
        MinecraftBlockTypes2["PinkStainedGlassPane"] = "minecraft:pink_stained_glass_pane";
        MinecraftBlockTypes2["PinkTerracotta"] = "minecraft:pink_terracotta";
        MinecraftBlockTypes2["PinkTulip"] = "minecraft:pink_tulip";
        MinecraftBlockTypes2["PinkWool"] = "minecraft:pink_wool";
        MinecraftBlockTypes2["Piston"] = "minecraft:piston";
        MinecraftBlockTypes2["PistonArmCollision"] = "minecraft:piston_arm_collision";
        MinecraftBlockTypes2["PitcherCrop"] = "minecraft:pitcher_crop";
        MinecraftBlockTypes2["PitcherPlant"] = "minecraft:pitcher_plant";
        MinecraftBlockTypes2["PlayerHead"] = "minecraft:player_head";
        MinecraftBlockTypes2["Podzol"] = "minecraft:podzol";
        MinecraftBlockTypes2["PointedDripstone"] = "minecraft:pointed_dripstone";
        MinecraftBlockTypes2["PolishedAndesite"] = "minecraft:polished_andesite";
        MinecraftBlockTypes2["PolishedAndesiteDoubleSlab"] = "minecraft:polished_andesite_double_slab";
        MinecraftBlockTypes2["PolishedAndesiteSlab"] = "minecraft:polished_andesite_slab";
        MinecraftBlockTypes2["PolishedAndesiteStairs"] = "minecraft:polished_andesite_stairs";
        MinecraftBlockTypes2["PolishedBasalt"] = "minecraft:polished_basalt";
        MinecraftBlockTypes2["PolishedBlackstone"] = "minecraft:polished_blackstone";
        MinecraftBlockTypes2["PolishedBlackstoneBrickDoubleSlab"] = "minecraft:polished_blackstone_brick_double_slab";
        MinecraftBlockTypes2["PolishedBlackstoneBrickSlab"] = "minecraft:polished_blackstone_brick_slab";
        MinecraftBlockTypes2["PolishedBlackstoneBrickStairs"] = "minecraft:polished_blackstone_brick_stairs";
        MinecraftBlockTypes2["PolishedBlackstoneBrickWall"] = "minecraft:polished_blackstone_brick_wall";
        MinecraftBlockTypes2["PolishedBlackstoneBricks"] = "minecraft:polished_blackstone_bricks";
        MinecraftBlockTypes2["PolishedBlackstoneButton"] = "minecraft:polished_blackstone_button";
        MinecraftBlockTypes2["PolishedBlackstoneDoubleSlab"] = "minecraft:polished_blackstone_double_slab";
        MinecraftBlockTypes2["PolishedBlackstonePressurePlate"] = "minecraft:polished_blackstone_pressure_plate";
        MinecraftBlockTypes2["PolishedBlackstoneSlab"] = "minecraft:polished_blackstone_slab";
        MinecraftBlockTypes2["PolishedBlackstoneStairs"] = "minecraft:polished_blackstone_stairs";
        MinecraftBlockTypes2["PolishedBlackstoneWall"] = "minecraft:polished_blackstone_wall";
        MinecraftBlockTypes2["PolishedDeepslate"] = "minecraft:polished_deepslate";
        MinecraftBlockTypes2["PolishedDeepslateDoubleSlab"] = "minecraft:polished_deepslate_double_slab";
        MinecraftBlockTypes2["PolishedDeepslateSlab"] = "minecraft:polished_deepslate_slab";
        MinecraftBlockTypes2["PolishedDeepslateStairs"] = "minecraft:polished_deepslate_stairs";
        MinecraftBlockTypes2["PolishedDeepslateWall"] = "minecraft:polished_deepslate_wall";
        MinecraftBlockTypes2["PolishedDiorite"] = "minecraft:polished_diorite";
        MinecraftBlockTypes2["PolishedDioriteDoubleSlab"] = "minecraft:polished_diorite_double_slab";
        MinecraftBlockTypes2["PolishedDioriteSlab"] = "minecraft:polished_diorite_slab";
        MinecraftBlockTypes2["PolishedDioriteStairs"] = "minecraft:polished_diorite_stairs";
        MinecraftBlockTypes2["PolishedGranite"] = "minecraft:polished_granite";
        MinecraftBlockTypes2["PolishedGraniteDoubleSlab"] = "minecraft:polished_granite_double_slab";
        MinecraftBlockTypes2["PolishedGraniteSlab"] = "minecraft:polished_granite_slab";
        MinecraftBlockTypes2["PolishedGraniteStairs"] = "minecraft:polished_granite_stairs";
        MinecraftBlockTypes2["PolishedTuff"] = "minecraft:polished_tuff";
        MinecraftBlockTypes2["PolishedTuffDoubleSlab"] = "minecraft:polished_tuff_double_slab";
        MinecraftBlockTypes2["PolishedTuffSlab"] = "minecraft:polished_tuff_slab";
        MinecraftBlockTypes2["PolishedTuffStairs"] = "minecraft:polished_tuff_stairs";
        MinecraftBlockTypes2["PolishedTuffWall"] = "minecraft:polished_tuff_wall";
        MinecraftBlockTypes2["Poppy"] = "minecraft:poppy";
        MinecraftBlockTypes2["Portal"] = "minecraft:portal";
        MinecraftBlockTypes2["Potatoes"] = "minecraft:potatoes";
        MinecraftBlockTypes2["PowderSnow"] = "minecraft:powder_snow";
        MinecraftBlockTypes2["PoweredComparator"] = "minecraft:powered_comparator";
        MinecraftBlockTypes2["PoweredRepeater"] = "minecraft:powered_repeater";
        MinecraftBlockTypes2["Prismarine"] = "minecraft:prismarine";
        MinecraftBlockTypes2["PrismarineBrickDoubleSlab"] = "minecraft:prismarine_brick_double_slab";
        MinecraftBlockTypes2["PrismarineBrickSlab"] = "minecraft:prismarine_brick_slab";
        MinecraftBlockTypes2["PrismarineBricks"] = "minecraft:prismarine_bricks";
        MinecraftBlockTypes2["PrismarineBricksStairs"] = "minecraft:prismarine_bricks_stairs";
        MinecraftBlockTypes2["PrismarineDoubleSlab"] = "minecraft:prismarine_double_slab";
        MinecraftBlockTypes2["PrismarineSlab"] = "minecraft:prismarine_slab";
        MinecraftBlockTypes2["PrismarineStairs"] = "minecraft:prismarine_stairs";
        MinecraftBlockTypes2["PrismarineWall"] = "minecraft:prismarine_wall";
        MinecraftBlockTypes2["Pumpkin"] = "minecraft:pumpkin";
        MinecraftBlockTypes2["PumpkinStem"] = "minecraft:pumpkin_stem";
        MinecraftBlockTypes2["PurpleCandle"] = "minecraft:purple_candle";
        MinecraftBlockTypes2["PurpleCandleCake"] = "minecraft:purple_candle_cake";
        MinecraftBlockTypes2["PurpleCarpet"] = "minecraft:purple_carpet";
        MinecraftBlockTypes2["PurpleConcrete"] = "minecraft:purple_concrete";
        MinecraftBlockTypes2["PurpleConcretePowder"] = "minecraft:purple_concrete_powder";
        MinecraftBlockTypes2["PurpleGlazedTerracotta"] = "minecraft:purple_glazed_terracotta";
        MinecraftBlockTypes2["PurpleShulkerBox"] = "minecraft:purple_shulker_box";
        MinecraftBlockTypes2["PurpleStainedGlass"] = "minecraft:purple_stained_glass";
        MinecraftBlockTypes2["PurpleStainedGlassPane"] = "minecraft:purple_stained_glass_pane";
        MinecraftBlockTypes2["PurpleTerracotta"] = "minecraft:purple_terracotta";
        MinecraftBlockTypes2["PurpleWool"] = "minecraft:purple_wool";
        MinecraftBlockTypes2["PurpurBlock"] = "minecraft:purpur_block";
        MinecraftBlockTypes2["PurpurDoubleSlab"] = "minecraft:purpur_double_slab";
        MinecraftBlockTypes2["PurpurPillar"] = "minecraft:purpur_pillar";
        MinecraftBlockTypes2["PurpurSlab"] = "minecraft:purpur_slab";
        MinecraftBlockTypes2["PurpurStairs"] = "minecraft:purpur_stairs";
        MinecraftBlockTypes2["QuartzBlock"] = "minecraft:quartz_block";
        MinecraftBlockTypes2["QuartzBricks"] = "minecraft:quartz_bricks";
        MinecraftBlockTypes2["QuartzDoubleSlab"] = "minecraft:quartz_double_slab";
        MinecraftBlockTypes2["QuartzOre"] = "minecraft:quartz_ore";
        MinecraftBlockTypes2["QuartzPillar"] = "minecraft:quartz_pillar";
        MinecraftBlockTypes2["QuartzSlab"] = "minecraft:quartz_slab";
        MinecraftBlockTypes2["QuartzStairs"] = "minecraft:quartz_stairs";
        MinecraftBlockTypes2["Rail"] = "minecraft:rail";
        MinecraftBlockTypes2["RawCopperBlock"] = "minecraft:raw_copper_block";
        MinecraftBlockTypes2["RawGoldBlock"] = "minecraft:raw_gold_block";
        MinecraftBlockTypes2["RawIronBlock"] = "minecraft:raw_iron_block";
        MinecraftBlockTypes2["RedCandle"] = "minecraft:red_candle";
        MinecraftBlockTypes2["RedCandleCake"] = "minecraft:red_candle_cake";
        MinecraftBlockTypes2["RedCarpet"] = "minecraft:red_carpet";
        MinecraftBlockTypes2["RedConcrete"] = "minecraft:red_concrete";
        MinecraftBlockTypes2["RedConcretePowder"] = "minecraft:red_concrete_powder";
        MinecraftBlockTypes2["RedGlazedTerracotta"] = "minecraft:red_glazed_terracotta";
        MinecraftBlockTypes2["RedMushroom"] = "minecraft:red_mushroom";
        MinecraftBlockTypes2["RedMushroomBlock"] = "minecraft:red_mushroom_block";
        MinecraftBlockTypes2["RedNetherBrick"] = "minecraft:red_nether_brick";
        MinecraftBlockTypes2["RedNetherBrickDoubleSlab"] = "minecraft:red_nether_brick_double_slab";
        MinecraftBlockTypes2["RedNetherBrickSlab"] = "minecraft:red_nether_brick_slab";
        MinecraftBlockTypes2["RedNetherBrickStairs"] = "minecraft:red_nether_brick_stairs";
        MinecraftBlockTypes2["RedNetherBrickWall"] = "minecraft:red_nether_brick_wall";
        MinecraftBlockTypes2["RedSand"] = "minecraft:red_sand";
        MinecraftBlockTypes2["RedSandstone"] = "minecraft:red_sandstone";
        MinecraftBlockTypes2["RedSandstoneDoubleSlab"] = "minecraft:red_sandstone_double_slab";
        MinecraftBlockTypes2["RedSandstoneSlab"] = "minecraft:red_sandstone_slab";
        MinecraftBlockTypes2["RedSandstoneStairs"] = "minecraft:red_sandstone_stairs";
        MinecraftBlockTypes2["RedSandstoneWall"] = "minecraft:red_sandstone_wall";
        MinecraftBlockTypes2["RedShulkerBox"] = "minecraft:red_shulker_box";
        MinecraftBlockTypes2["RedStainedGlass"] = "minecraft:red_stained_glass";
        MinecraftBlockTypes2["RedStainedGlassPane"] = "minecraft:red_stained_glass_pane";
        MinecraftBlockTypes2["RedTerracotta"] = "minecraft:red_terracotta";
        MinecraftBlockTypes2["RedTulip"] = "minecraft:red_tulip";
        MinecraftBlockTypes2["RedWool"] = "minecraft:red_wool";
        MinecraftBlockTypes2["RedstoneBlock"] = "minecraft:redstone_block";
        MinecraftBlockTypes2["RedstoneLamp"] = "minecraft:redstone_lamp";
        MinecraftBlockTypes2["RedstoneOre"] = "minecraft:redstone_ore";
        MinecraftBlockTypes2["RedstoneTorch"] = "minecraft:redstone_torch";
        MinecraftBlockTypes2["RedstoneWire"] = "minecraft:redstone_wire";
        MinecraftBlockTypes2["Reeds"] = "minecraft:reeds";
        MinecraftBlockTypes2["ReinforcedDeepslate"] = "minecraft:reinforced_deepslate";
        MinecraftBlockTypes2["RepeatingCommandBlock"] = "minecraft:repeating_command_block";
        MinecraftBlockTypes2["ResinBlock"] = "minecraft:resin_block";
        MinecraftBlockTypes2["ResinBrickDoubleSlab"] = "minecraft:resin_brick_double_slab";
        MinecraftBlockTypes2["ResinBrickSlab"] = "minecraft:resin_brick_slab";
        MinecraftBlockTypes2["ResinBrickStairs"] = "minecraft:resin_brick_stairs";
        MinecraftBlockTypes2["ResinBrickWall"] = "minecraft:resin_brick_wall";
        MinecraftBlockTypes2["ResinBricks"] = "minecraft:resin_bricks";
        MinecraftBlockTypes2["ResinClump"] = "minecraft:resin_clump";
        MinecraftBlockTypes2["RespawnAnchor"] = "minecraft:respawn_anchor";
        MinecraftBlockTypes2["RoseBush"] = "minecraft:rose_bush";
        MinecraftBlockTypes2["Sand"] = "minecraft:sand";
        MinecraftBlockTypes2["Sandstone"] = "minecraft:sandstone";
        MinecraftBlockTypes2["SandstoneDoubleSlab"] = "minecraft:sandstone_double_slab";
        MinecraftBlockTypes2["SandstoneSlab"] = "minecraft:sandstone_slab";
        MinecraftBlockTypes2["SandstoneStairs"] = "minecraft:sandstone_stairs";
        MinecraftBlockTypes2["SandstoneWall"] = "minecraft:sandstone_wall";
        MinecraftBlockTypes2["Scaffolding"] = "minecraft:scaffolding";
        MinecraftBlockTypes2["Sculk"] = "minecraft:sculk";
        MinecraftBlockTypes2["SculkCatalyst"] = "minecraft:sculk_catalyst";
        MinecraftBlockTypes2["SculkSensor"] = "minecraft:sculk_sensor";
        MinecraftBlockTypes2["SculkShrieker"] = "minecraft:sculk_shrieker";
        MinecraftBlockTypes2["SculkVein"] = "minecraft:sculk_vein";
        MinecraftBlockTypes2["SeaLantern"] = "minecraft:sea_lantern";
        MinecraftBlockTypes2["SeaPickle"] = "minecraft:sea_pickle";
        MinecraftBlockTypes2["Seagrass"] = "minecraft:seagrass";
        MinecraftBlockTypes2["ShortGrass"] = "minecraft:short_grass";
        MinecraftBlockTypes2["Shroomlight"] = "minecraft:shroomlight";
        MinecraftBlockTypes2["SilverGlazedTerracotta"] = "minecraft:silver_glazed_terracotta";
        MinecraftBlockTypes2["SkeletonSkull"] = "minecraft:skeleton_skull";
        MinecraftBlockTypes2["Slime"] = "minecraft:slime";
        MinecraftBlockTypes2["SmallAmethystBud"] = "minecraft:small_amethyst_bud";
        MinecraftBlockTypes2["SmallDripleafBlock"] = "minecraft:small_dripleaf_block";
        MinecraftBlockTypes2["SmithingTable"] = "minecraft:smithing_table";
        MinecraftBlockTypes2["Smoker"] = "minecraft:smoker";
        MinecraftBlockTypes2["SmoothBasalt"] = "minecraft:smooth_basalt";
        MinecraftBlockTypes2["SmoothQuartz"] = "minecraft:smooth_quartz";
        MinecraftBlockTypes2["SmoothQuartzDoubleSlab"] = "minecraft:smooth_quartz_double_slab";
        MinecraftBlockTypes2["SmoothQuartzSlab"] = "minecraft:smooth_quartz_slab";
        MinecraftBlockTypes2["SmoothQuartzStairs"] = "minecraft:smooth_quartz_stairs";
        MinecraftBlockTypes2["SmoothRedSandstone"] = "minecraft:smooth_red_sandstone";
        MinecraftBlockTypes2["SmoothRedSandstoneDoubleSlab"] = "minecraft:smooth_red_sandstone_double_slab";
        MinecraftBlockTypes2["SmoothRedSandstoneSlab"] = "minecraft:smooth_red_sandstone_slab";
        MinecraftBlockTypes2["SmoothRedSandstoneStairs"] = "minecraft:smooth_red_sandstone_stairs";
        MinecraftBlockTypes2["SmoothSandstone"] = "minecraft:smooth_sandstone";
        MinecraftBlockTypes2["SmoothSandstoneDoubleSlab"] = "minecraft:smooth_sandstone_double_slab";
        MinecraftBlockTypes2["SmoothSandstoneSlab"] = "minecraft:smooth_sandstone_slab";
        MinecraftBlockTypes2["SmoothSandstoneStairs"] = "minecraft:smooth_sandstone_stairs";
        MinecraftBlockTypes2["SmoothStone"] = "minecraft:smooth_stone";
        MinecraftBlockTypes2["SmoothStoneDoubleSlab"] = "minecraft:smooth_stone_double_slab";
        MinecraftBlockTypes2["SmoothStoneSlab"] = "minecraft:smooth_stone_slab";
        MinecraftBlockTypes2["SnifferEgg"] = "minecraft:sniffer_egg";
        MinecraftBlockTypes2["Snow"] = "minecraft:snow";
        MinecraftBlockTypes2["SnowLayer"] = "minecraft:snow_layer";
        MinecraftBlockTypes2["SoulCampfire"] = "minecraft:soul_campfire";
        MinecraftBlockTypes2["SoulFire"] = "minecraft:soul_fire";
        MinecraftBlockTypes2["SoulLantern"] = "minecraft:soul_lantern";
        MinecraftBlockTypes2["SoulSand"] = "minecraft:soul_sand";
        MinecraftBlockTypes2["SoulSoil"] = "minecraft:soul_soil";
        MinecraftBlockTypes2["SoulTorch"] = "minecraft:soul_torch";
        MinecraftBlockTypes2["Sponge"] = "minecraft:sponge";
        MinecraftBlockTypes2["SporeBlossom"] = "minecraft:spore_blossom";
        MinecraftBlockTypes2["SpruceButton"] = "minecraft:spruce_button";
        MinecraftBlockTypes2["SpruceDoor"] = "minecraft:spruce_door";
        MinecraftBlockTypes2["SpruceDoubleSlab"] = "minecraft:spruce_double_slab";
        MinecraftBlockTypes2["SpruceFence"] = "minecraft:spruce_fence";
        MinecraftBlockTypes2["SpruceFenceGate"] = "minecraft:spruce_fence_gate";
        MinecraftBlockTypes2["SpruceHangingSign"] = "minecraft:spruce_hanging_sign";
        MinecraftBlockTypes2["SpruceLeaves"] = "minecraft:spruce_leaves";
        MinecraftBlockTypes2["SpruceLog"] = "minecraft:spruce_log";
        MinecraftBlockTypes2["SprucePlanks"] = "minecraft:spruce_planks";
        MinecraftBlockTypes2["SprucePressurePlate"] = "minecraft:spruce_pressure_plate";
        MinecraftBlockTypes2["SpruceSapling"] = "minecraft:spruce_sapling";
        MinecraftBlockTypes2["SpruceSlab"] = "minecraft:spruce_slab";
        MinecraftBlockTypes2["SpruceStairs"] = "minecraft:spruce_stairs";
        MinecraftBlockTypes2["SpruceStandingSign"] = "minecraft:spruce_standing_sign";
        MinecraftBlockTypes2["SpruceTrapdoor"] = "minecraft:spruce_trapdoor";
        MinecraftBlockTypes2["SpruceWallSign"] = "minecraft:spruce_wall_sign";
        MinecraftBlockTypes2["SpruceWood"] = "minecraft:spruce_wood";
        MinecraftBlockTypes2["StandingBanner"] = "minecraft:standing_banner";
        MinecraftBlockTypes2["StandingSign"] = "minecraft:standing_sign";
        MinecraftBlockTypes2["StickyPiston"] = "minecraft:sticky_piston";
        MinecraftBlockTypes2["StickyPistonArmCollision"] = "minecraft:sticky_piston_arm_collision";
        MinecraftBlockTypes2["Stone"] = "minecraft:stone";
        MinecraftBlockTypes2["StoneBrickDoubleSlab"] = "minecraft:stone_brick_double_slab";
        MinecraftBlockTypes2["StoneBrickSlab"] = "minecraft:stone_brick_slab";
        MinecraftBlockTypes2["StoneBrickStairs"] = "minecraft:stone_brick_stairs";
        MinecraftBlockTypes2["StoneBrickWall"] = "minecraft:stone_brick_wall";
        MinecraftBlockTypes2["StoneBricks"] = "minecraft:stone_bricks";
        MinecraftBlockTypes2["StoneButton"] = "minecraft:stone_button";
        MinecraftBlockTypes2["StonePressurePlate"] = "minecraft:stone_pressure_plate";
        MinecraftBlockTypes2["StoneStairs"] = "minecraft:stone_stairs";
        MinecraftBlockTypes2["StonecutterBlock"] = "minecraft:stonecutter_block";
        MinecraftBlockTypes2["StrippedAcaciaLog"] = "minecraft:stripped_acacia_log";
        MinecraftBlockTypes2["StrippedAcaciaWood"] = "minecraft:stripped_acacia_wood";
        MinecraftBlockTypes2["StrippedBambooBlock"] = "minecraft:stripped_bamboo_block";
        MinecraftBlockTypes2["StrippedBirchLog"] = "minecraft:stripped_birch_log";
        MinecraftBlockTypes2["StrippedBirchWood"] = "minecraft:stripped_birch_wood";
        MinecraftBlockTypes2["StrippedCherryLog"] = "minecraft:stripped_cherry_log";
        MinecraftBlockTypes2["StrippedCherryWood"] = "minecraft:stripped_cherry_wood";
        MinecraftBlockTypes2["StrippedCrimsonHyphae"] = "minecraft:stripped_crimson_hyphae";
        MinecraftBlockTypes2["StrippedCrimsonStem"] = "minecraft:stripped_crimson_stem";
        MinecraftBlockTypes2["StrippedDarkOakLog"] = "minecraft:stripped_dark_oak_log";
        MinecraftBlockTypes2["StrippedDarkOakWood"] = "minecraft:stripped_dark_oak_wood";
        MinecraftBlockTypes2["StrippedJungleLog"] = "minecraft:stripped_jungle_log";
        MinecraftBlockTypes2["StrippedJungleWood"] = "minecraft:stripped_jungle_wood";
        MinecraftBlockTypes2["StrippedMangroveLog"] = "minecraft:stripped_mangrove_log";
        MinecraftBlockTypes2["StrippedMangroveWood"] = "minecraft:stripped_mangrove_wood";
        MinecraftBlockTypes2["StrippedOakLog"] = "minecraft:stripped_oak_log";
        MinecraftBlockTypes2["StrippedOakWood"] = "minecraft:stripped_oak_wood";
        MinecraftBlockTypes2["StrippedPaleOakLog"] = "minecraft:stripped_pale_oak_log";
        MinecraftBlockTypes2["StrippedPaleOakWood"] = "minecraft:stripped_pale_oak_wood";
        MinecraftBlockTypes2["StrippedSpruceLog"] = "minecraft:stripped_spruce_log";
        MinecraftBlockTypes2["StrippedSpruceWood"] = "minecraft:stripped_spruce_wood";
        MinecraftBlockTypes2["StrippedWarpedHyphae"] = "minecraft:stripped_warped_hyphae";
        MinecraftBlockTypes2["StrippedWarpedStem"] = "minecraft:stripped_warped_stem";
        MinecraftBlockTypes2["StructureBlock"] = "minecraft:structure_block";
        MinecraftBlockTypes2["StructureVoid"] = "minecraft:structure_void";
        MinecraftBlockTypes2["Sunflower"] = "minecraft:sunflower";
        MinecraftBlockTypes2["SuspiciousGravel"] = "minecraft:suspicious_gravel";
        MinecraftBlockTypes2["SuspiciousSand"] = "minecraft:suspicious_sand";
        MinecraftBlockTypes2["SweetBerryBush"] = "minecraft:sweet_berry_bush";
        MinecraftBlockTypes2["TallGrass"] = "minecraft:tall_grass";
        MinecraftBlockTypes2["Target"] = "minecraft:target";
        MinecraftBlockTypes2["TintedGlass"] = "minecraft:tinted_glass";
        MinecraftBlockTypes2["Tnt"] = "minecraft:tnt";
        MinecraftBlockTypes2["Torch"] = "minecraft:torch";
        MinecraftBlockTypes2["Torchflower"] = "minecraft:torchflower";
        MinecraftBlockTypes2["TorchflowerCrop"] = "minecraft:torchflower_crop";
        MinecraftBlockTypes2["Trapdoor"] = "minecraft:trapdoor";
        MinecraftBlockTypes2["TrappedChest"] = "minecraft:trapped_chest";
        MinecraftBlockTypes2["TrialSpawner"] = "minecraft:trial_spawner";
        MinecraftBlockTypes2["TripWire"] = "minecraft:trip_wire";
        MinecraftBlockTypes2["TripwireHook"] = "minecraft:tripwire_hook";
        MinecraftBlockTypes2["TubeCoral"] = "minecraft:tube_coral";
        MinecraftBlockTypes2["TubeCoralBlock"] = "minecraft:tube_coral_block";
        MinecraftBlockTypes2["TubeCoralFan"] = "minecraft:tube_coral_fan";
        MinecraftBlockTypes2["TubeCoralWallFan"] = "minecraft:tube_coral_wall_fan";
        MinecraftBlockTypes2["Tuff"] = "minecraft:tuff";
        MinecraftBlockTypes2["TuffBrickDoubleSlab"] = "minecraft:tuff_brick_double_slab";
        MinecraftBlockTypes2["TuffBrickSlab"] = "minecraft:tuff_brick_slab";
        MinecraftBlockTypes2["TuffBrickStairs"] = "minecraft:tuff_brick_stairs";
        MinecraftBlockTypes2["TuffBrickWall"] = "minecraft:tuff_brick_wall";
        MinecraftBlockTypes2["TuffBricks"] = "minecraft:tuff_bricks";
        MinecraftBlockTypes2["TuffDoubleSlab"] = "minecraft:tuff_double_slab";
        MinecraftBlockTypes2["TuffSlab"] = "minecraft:tuff_slab";
        MinecraftBlockTypes2["TuffStairs"] = "minecraft:tuff_stairs";
        MinecraftBlockTypes2["TuffWall"] = "minecraft:tuff_wall";
        MinecraftBlockTypes2["TurtleEgg"] = "minecraft:turtle_egg";
        MinecraftBlockTypes2["TwistingVines"] = "minecraft:twisting_vines";
        MinecraftBlockTypes2["UnderwaterTnt"] = "minecraft:underwater_tnt";
        MinecraftBlockTypes2["UnderwaterTorch"] = "minecraft:underwater_torch";
        MinecraftBlockTypes2["UndyedShulkerBox"] = "minecraft:undyed_shulker_box";
        MinecraftBlockTypes2["Unknown"] = "minecraft:unknown";
        MinecraftBlockTypes2["UnlitRedstoneTorch"] = "minecraft:unlit_redstone_torch";
        MinecraftBlockTypes2["UnpoweredComparator"] = "minecraft:unpowered_comparator";
        MinecraftBlockTypes2["UnpoweredRepeater"] = "minecraft:unpowered_repeater";
        MinecraftBlockTypes2["Vault"] = "minecraft:vault";
        MinecraftBlockTypes2["VerdantFroglight"] = "minecraft:verdant_froglight";
        MinecraftBlockTypes2["Vine"] = "minecraft:vine";
        MinecraftBlockTypes2["WallBanner"] = "minecraft:wall_banner";
        MinecraftBlockTypes2["WallSign"] = "minecraft:wall_sign";
        MinecraftBlockTypes2["WarpedButton"] = "minecraft:warped_button";
        MinecraftBlockTypes2["WarpedDoor"] = "minecraft:warped_door";
        MinecraftBlockTypes2["WarpedDoubleSlab"] = "minecraft:warped_double_slab";
        MinecraftBlockTypes2["WarpedFence"] = "minecraft:warped_fence";
        MinecraftBlockTypes2["WarpedFenceGate"] = "minecraft:warped_fence_gate";
        MinecraftBlockTypes2["WarpedFungus"] = "minecraft:warped_fungus";
        MinecraftBlockTypes2["WarpedHangingSign"] = "minecraft:warped_hanging_sign";
        MinecraftBlockTypes2["WarpedHyphae"] = "minecraft:warped_hyphae";
        MinecraftBlockTypes2["WarpedNylium"] = "minecraft:warped_nylium";
        MinecraftBlockTypes2["WarpedPlanks"] = "minecraft:warped_planks";
        MinecraftBlockTypes2["WarpedPressurePlate"] = "minecraft:warped_pressure_plate";
        MinecraftBlockTypes2["WarpedRoots"] = "minecraft:warped_roots";
        MinecraftBlockTypes2["WarpedSlab"] = "minecraft:warped_slab";
        MinecraftBlockTypes2["WarpedStairs"] = "minecraft:warped_stairs";
        MinecraftBlockTypes2["WarpedStandingSign"] = "minecraft:warped_standing_sign";
        MinecraftBlockTypes2["WarpedStem"] = "minecraft:warped_stem";
        MinecraftBlockTypes2["WarpedTrapdoor"] = "minecraft:warped_trapdoor";
        MinecraftBlockTypes2["WarpedWallSign"] = "minecraft:warped_wall_sign";
        MinecraftBlockTypes2["WarpedWartBlock"] = "minecraft:warped_wart_block";
        MinecraftBlockTypes2["Water"] = "minecraft:water";
        MinecraftBlockTypes2["Waterlily"] = "minecraft:waterlily";
        MinecraftBlockTypes2["WaxedChiseledCopper"] = "minecraft:waxed_chiseled_copper";
        MinecraftBlockTypes2["WaxedCopper"] = "minecraft:waxed_copper";
        MinecraftBlockTypes2["WaxedCopperBulb"] = "minecraft:waxed_copper_bulb";
        MinecraftBlockTypes2["WaxedCopperDoor"] = "minecraft:waxed_copper_door";
        MinecraftBlockTypes2["WaxedCopperGrate"] = "minecraft:waxed_copper_grate";
        MinecraftBlockTypes2["WaxedCopperTrapdoor"] = "minecraft:waxed_copper_trapdoor";
        MinecraftBlockTypes2["WaxedCutCopper"] = "minecraft:waxed_cut_copper";
        MinecraftBlockTypes2["WaxedCutCopperSlab"] = "minecraft:waxed_cut_copper_slab";
        MinecraftBlockTypes2["WaxedCutCopperStairs"] = "minecraft:waxed_cut_copper_stairs";
        MinecraftBlockTypes2["WaxedDoubleCutCopperSlab"] = "minecraft:waxed_double_cut_copper_slab";
        MinecraftBlockTypes2["WaxedExposedChiseledCopper"] = "minecraft:waxed_exposed_chiseled_copper";
        MinecraftBlockTypes2["WaxedExposedCopper"] = "minecraft:waxed_exposed_copper";
        MinecraftBlockTypes2["WaxedExposedCopperBulb"] = "minecraft:waxed_exposed_copper_bulb";
        MinecraftBlockTypes2["WaxedExposedCopperDoor"] = "minecraft:waxed_exposed_copper_door";
        MinecraftBlockTypes2["WaxedExposedCopperGrate"] = "minecraft:waxed_exposed_copper_grate";
        MinecraftBlockTypes2["WaxedExposedCopperTrapdoor"] = "minecraft:waxed_exposed_copper_trapdoor";
        MinecraftBlockTypes2["WaxedExposedCutCopper"] = "minecraft:waxed_exposed_cut_copper";
        MinecraftBlockTypes2["WaxedExposedCutCopperSlab"] = "minecraft:waxed_exposed_cut_copper_slab";
        MinecraftBlockTypes2["WaxedExposedCutCopperStairs"] = "minecraft:waxed_exposed_cut_copper_stairs";
        MinecraftBlockTypes2["WaxedExposedDoubleCutCopperSlab"] = "minecraft:waxed_exposed_double_cut_copper_slab";
        MinecraftBlockTypes2["WaxedOxidizedChiseledCopper"] = "minecraft:waxed_oxidized_chiseled_copper";
        MinecraftBlockTypes2["WaxedOxidizedCopper"] = "minecraft:waxed_oxidized_copper";
        MinecraftBlockTypes2["WaxedOxidizedCopperBulb"] = "minecraft:waxed_oxidized_copper_bulb";
        MinecraftBlockTypes2["WaxedOxidizedCopperDoor"] = "minecraft:waxed_oxidized_copper_door";
        MinecraftBlockTypes2["WaxedOxidizedCopperGrate"] = "minecraft:waxed_oxidized_copper_grate";
        MinecraftBlockTypes2["WaxedOxidizedCopperTrapdoor"] = "minecraft:waxed_oxidized_copper_trapdoor";
        MinecraftBlockTypes2["WaxedOxidizedCutCopper"] = "minecraft:waxed_oxidized_cut_copper";
        MinecraftBlockTypes2["WaxedOxidizedCutCopperSlab"] = "minecraft:waxed_oxidized_cut_copper_slab";
        MinecraftBlockTypes2["WaxedOxidizedCutCopperStairs"] = "minecraft:waxed_oxidized_cut_copper_stairs";
        MinecraftBlockTypes2["WaxedOxidizedDoubleCutCopperSlab"] = "minecraft:waxed_oxidized_double_cut_copper_slab";
        MinecraftBlockTypes2["WaxedWeatheredChiseledCopper"] = "minecraft:waxed_weathered_chiseled_copper";
        MinecraftBlockTypes2["WaxedWeatheredCopper"] = "minecraft:waxed_weathered_copper";
        MinecraftBlockTypes2["WaxedWeatheredCopperBulb"] = "minecraft:waxed_weathered_copper_bulb";
        MinecraftBlockTypes2["WaxedWeatheredCopperDoor"] = "minecraft:waxed_weathered_copper_door";
        MinecraftBlockTypes2["WaxedWeatheredCopperGrate"] = "minecraft:waxed_weathered_copper_grate";
        MinecraftBlockTypes2["WaxedWeatheredCopperTrapdoor"] = "minecraft:waxed_weathered_copper_trapdoor";
        MinecraftBlockTypes2["WaxedWeatheredCutCopper"] = "minecraft:waxed_weathered_cut_copper";
        MinecraftBlockTypes2["WaxedWeatheredCutCopperSlab"] = "minecraft:waxed_weathered_cut_copper_slab";
        MinecraftBlockTypes2["WaxedWeatheredCutCopperStairs"] = "minecraft:waxed_weathered_cut_copper_stairs";
        MinecraftBlockTypes2["WaxedWeatheredDoubleCutCopperSlab"] = "minecraft:waxed_weathered_double_cut_copper_slab";
        MinecraftBlockTypes2["WeatheredChiseledCopper"] = "minecraft:weathered_chiseled_copper";
        MinecraftBlockTypes2["WeatheredCopper"] = "minecraft:weathered_copper";
        MinecraftBlockTypes2["WeatheredCopperBulb"] = "minecraft:weathered_copper_bulb";
        MinecraftBlockTypes2["WeatheredCopperDoor"] = "minecraft:weathered_copper_door";
        MinecraftBlockTypes2["WeatheredCopperGrate"] = "minecraft:weathered_copper_grate";
        MinecraftBlockTypes2["WeatheredCopperTrapdoor"] = "minecraft:weathered_copper_trapdoor";
        MinecraftBlockTypes2["WeatheredCutCopper"] = "minecraft:weathered_cut_copper";
        MinecraftBlockTypes2["WeatheredCutCopperSlab"] = "minecraft:weathered_cut_copper_slab";
        MinecraftBlockTypes2["WeatheredCutCopperStairs"] = "minecraft:weathered_cut_copper_stairs";
        MinecraftBlockTypes2["WeatheredDoubleCutCopperSlab"] = "minecraft:weathered_double_cut_copper_slab";
        MinecraftBlockTypes2["Web"] = "minecraft:web";
        MinecraftBlockTypes2["WeepingVines"] = "minecraft:weeping_vines";
        MinecraftBlockTypes2["WetSponge"] = "minecraft:wet_sponge";
        MinecraftBlockTypes2["Wheat"] = "minecraft:wheat";
        MinecraftBlockTypes2["WhiteCandle"] = "minecraft:white_candle";
        MinecraftBlockTypes2["WhiteCandleCake"] = "minecraft:white_candle_cake";
        MinecraftBlockTypes2["WhiteCarpet"] = "minecraft:white_carpet";
        MinecraftBlockTypes2["WhiteConcrete"] = "minecraft:white_concrete";
        MinecraftBlockTypes2["WhiteConcretePowder"] = "minecraft:white_concrete_powder";
        MinecraftBlockTypes2["WhiteGlazedTerracotta"] = "minecraft:white_glazed_terracotta";
        MinecraftBlockTypes2["WhiteShulkerBox"] = "minecraft:white_shulker_box";
        MinecraftBlockTypes2["WhiteStainedGlass"] = "minecraft:white_stained_glass";
        MinecraftBlockTypes2["WhiteStainedGlassPane"] = "minecraft:white_stained_glass_pane";
        MinecraftBlockTypes2["WhiteTerracotta"] = "minecraft:white_terracotta";
        MinecraftBlockTypes2["WhiteTulip"] = "minecraft:white_tulip";
        MinecraftBlockTypes2["WhiteWool"] = "minecraft:white_wool";
        MinecraftBlockTypes2["WitherRose"] = "minecraft:wither_rose";
        MinecraftBlockTypes2["WitherSkeletonSkull"] = "minecraft:wither_skeleton_skull";
        MinecraftBlockTypes2["WoodenButton"] = "minecraft:wooden_button";
        MinecraftBlockTypes2["WoodenDoor"] = "minecraft:wooden_door";
        MinecraftBlockTypes2["WoodenPressurePlate"] = "minecraft:wooden_pressure_plate";
        MinecraftBlockTypes2["YellowCandle"] = "minecraft:yellow_candle";
        MinecraftBlockTypes2["YellowCandleCake"] = "minecraft:yellow_candle_cake";
        MinecraftBlockTypes2["YellowCarpet"] = "minecraft:yellow_carpet";
        MinecraftBlockTypes2["YellowConcrete"] = "minecraft:yellow_concrete";
        MinecraftBlockTypes2["YellowConcretePowder"] = "minecraft:yellow_concrete_powder";
        MinecraftBlockTypes2["YellowGlazedTerracotta"] = "minecraft:yellow_glazed_terracotta";
        MinecraftBlockTypes2["YellowShulkerBox"] = "minecraft:yellow_shulker_box";
        MinecraftBlockTypes2["YellowStainedGlass"] = "minecraft:yellow_stained_glass";
        MinecraftBlockTypes2["YellowStainedGlassPane"] = "minecraft:yellow_stained_glass_pane";
        MinecraftBlockTypes2["YellowTerracotta"] = "minecraft:yellow_terracotta";
        MinecraftBlockTypes2["YellowWool"] = "minecraft:yellow_wool";
        MinecraftBlockTypes2["ZombieHead"] = "minecraft:zombie_head";
        return MinecraftBlockTypes2;
    })(MinecraftBlockTypes || {});
    var MinecraftCameraPresetsTypes = (MinecraftCameraPresetsTypes2 => {
        MinecraftCameraPresetsTypes2["FirstPerson"] = "minecraft:first_person";
        MinecraftCameraPresetsTypes2["FixedBoom"] = "minecraft:fixed_boom";
        MinecraftCameraPresetsTypes2["FollowOrbit"] = "minecraft:follow_orbit";
        MinecraftCameraPresetsTypes2["Free"] = "minecraft:free";
        MinecraftCameraPresetsTypes2["ThirdPerson"] = "minecraft:third_person";
        MinecraftCameraPresetsTypes2["ThirdPersonFront"] = "minecraft:third_person_front";
        return MinecraftCameraPresetsTypes2;
    })(MinecraftCameraPresetsTypes || {});
    var MinecraftCooldownCategoryTypes = (MinecraftCooldownCategoryTypes2 => {
        MinecraftCooldownCategoryTypes2["Chorusfruit"] = "minecraft:chorusfruit";
        MinecraftCooldownCategoryTypes2["EnderPearl"] = "minecraft:ender_pearl";
        MinecraftCooldownCategoryTypes2["GoatHorn"] = "minecraft:goat_horn";
        MinecraftCooldownCategoryTypes2["Shield"] = "minecraft:shield";
        MinecraftCooldownCategoryTypes2["WindCharge"] = "minecraft:wind_charge";
        return MinecraftCooldownCategoryTypes2;
    })(MinecraftCooldownCategoryTypes || {});
    var MinecraftDimensionTypes = (MinecraftDimensionTypes2 => {
        MinecraftDimensionTypes2["Nether"] = "minecraft:nether";
        MinecraftDimensionTypes2["Overworld"] = "minecraft:overworld";
        MinecraftDimensionTypes2["TheEnd"] = "minecraft:the_end";
        return MinecraftDimensionTypes2;
    })(MinecraftDimensionTypes || {});
    var MinecraftEffectTypes = (MinecraftEffectTypes2 => {
        MinecraftEffectTypes2["Absorption"] = "minecraft:absorption";
        MinecraftEffectTypes2["BadOmen"] = "minecraft:bad_omen";
        MinecraftEffectTypes2["Blindness"] = "minecraft:blindness";
        MinecraftEffectTypes2["ConduitPower"] = "minecraft:conduit_power";
        MinecraftEffectTypes2["Darkness"] = "minecraft:darkness";
        MinecraftEffectTypes2["FatalPoison"] = "minecraft:fatal_poison";
        MinecraftEffectTypes2["FireResistance"] = "minecraft:fire_resistance";
        MinecraftEffectTypes2["Haste"] = "minecraft:haste";
        MinecraftEffectTypes2["HealthBoost"] = "minecraft:health_boost";
        MinecraftEffectTypes2["Hunger"] = "minecraft:hunger";
        MinecraftEffectTypes2["Infested"] = "minecraft:infested";
        MinecraftEffectTypes2["InstantDamage"] = "minecraft:instant_damage";
        MinecraftEffectTypes2["InstantHealth"] = "minecraft:instant_health";
        MinecraftEffectTypes2["Invisibility"] = "minecraft:invisibility";
        MinecraftEffectTypes2["JumpBoost"] = "minecraft:jump_boost";
        MinecraftEffectTypes2["Levitation"] = "minecraft:levitation";
        MinecraftEffectTypes2["MiningFatigue"] = "minecraft:mining_fatigue";
        MinecraftEffectTypes2["Nausea"] = "minecraft:nausea";
        MinecraftEffectTypes2["NightVision"] = "minecraft:night_vision";
        MinecraftEffectTypes2["Oozing"] = "minecraft:oozing";
        MinecraftEffectTypes2["Poison"] = "minecraft:poison";
        MinecraftEffectTypes2["RaidOmen"] = "minecraft:raid_omen";
        MinecraftEffectTypes2["Regeneration"] = "minecraft:regeneration";
        MinecraftEffectTypes2["Resistance"] = "minecraft:resistance";
        MinecraftEffectTypes2["Saturation"] = "minecraft:saturation";
        MinecraftEffectTypes2["SlowFalling"] = "minecraft:slow_falling";
        MinecraftEffectTypes2["Slowness"] = "minecraft:slowness";
        MinecraftEffectTypes2["Speed"] = "minecraft:speed";
        MinecraftEffectTypes2["Strength"] = "minecraft:strength";
        MinecraftEffectTypes2["TrialOmen"] = "minecraft:trial_omen";
        MinecraftEffectTypes2["VillageHero"] = "minecraft:village_hero";
        MinecraftEffectTypes2["WaterBreathing"] = "minecraft:water_breathing";
        MinecraftEffectTypes2["Weakness"] = "minecraft:weakness";
        MinecraftEffectTypes2["Weaving"] = "minecraft:weaving";
        MinecraftEffectTypes2["WindCharged"] = "minecraft:wind_charged";
        MinecraftEffectTypes2["Wither"] = "minecraft:wither";
        return MinecraftEffectTypes2;
    })(MinecraftEffectTypes || {});
    var MinecraftEnchantmentTypes = (MinecraftEnchantmentTypes2 => {
        MinecraftEnchantmentTypes2["AquaAffinity"] = "minecraft:aqua_affinity";
        MinecraftEnchantmentTypes2["BaneOfArthropods"] = "minecraft:bane_of_arthropods";
        MinecraftEnchantmentTypes2["Binding"] = "minecraft:binding";
        MinecraftEnchantmentTypes2["BlastProtection"] = "minecraft:blast_protection";
        MinecraftEnchantmentTypes2["BowInfinity"] = "minecraft:infinity";
        MinecraftEnchantmentTypes2["Breach"] = "minecraft:breach";
        MinecraftEnchantmentTypes2["Channeling"] = "minecraft:channeling";
        MinecraftEnchantmentTypes2["Density"] = "minecraft:density";
        MinecraftEnchantmentTypes2["DepthStrider"] = "minecraft:depth_strider";
        MinecraftEnchantmentTypes2["Efficiency"] = "minecraft:efficiency";
        MinecraftEnchantmentTypes2["FeatherFalling"] = "minecraft:feather_falling";
        MinecraftEnchantmentTypes2["FireAspect"] = "minecraft:fire_aspect";
        MinecraftEnchantmentTypes2["FireProtection"] = "minecraft:fire_protection";
        MinecraftEnchantmentTypes2["Flame"] = "minecraft:flame";
        MinecraftEnchantmentTypes2["Fortune"] = "minecraft:fortune";
        MinecraftEnchantmentTypes2["FrostWalker"] = "minecraft:frost_walker";
        MinecraftEnchantmentTypes2["Impaling"] = "minecraft:impaling";
        MinecraftEnchantmentTypes2["Knockback"] = "minecraft:knockback";
        MinecraftEnchantmentTypes2["Looting"] = "minecraft:looting";
        MinecraftEnchantmentTypes2["Loyalty"] = "minecraft:loyalty";
        MinecraftEnchantmentTypes2["LuckOfTheSea"] = "minecraft:luck_of_the_sea";
        MinecraftEnchantmentTypes2["Lure"] = "minecraft:lure";
        MinecraftEnchantmentTypes2["Mending"] = "minecraft:mending";
        MinecraftEnchantmentTypes2["Multishot"] = "minecraft:multishot";
        MinecraftEnchantmentTypes2["Piercing"] = "minecraft:piercing";
        MinecraftEnchantmentTypes2["Power"] = "minecraft:power";
        MinecraftEnchantmentTypes2["ProjectileProtection"] = "minecraft:projectile_protection";
        MinecraftEnchantmentTypes2["Protection"] = "minecraft:protection";
        MinecraftEnchantmentTypes2["Punch"] = "minecraft:punch";
        MinecraftEnchantmentTypes2["QuickCharge"] = "minecraft:quick_charge";
        MinecraftEnchantmentTypes2["Respiration"] = "minecraft:respiration";
        MinecraftEnchantmentTypes2["Riptide"] = "minecraft:riptide";
        MinecraftEnchantmentTypes2["Sharpness"] = "minecraft:sharpness";
        MinecraftEnchantmentTypes2["SilkTouch"] = "minecraft:silk_touch";
        MinecraftEnchantmentTypes2["Smite"] = "minecraft:smite";
        MinecraftEnchantmentTypes2["SoulSpeed"] = "minecraft:soul_speed";
        MinecraftEnchantmentTypes2["SwiftSneak"] = "minecraft:swift_sneak";
        MinecraftEnchantmentTypes2["Thorns"] = "minecraft:thorns";
        MinecraftEnchantmentTypes2["Unbreaking"] = "minecraft:unbreaking";
        MinecraftEnchantmentTypes2["Vanishing"] = "minecraft:vanishing";
        MinecraftEnchantmentTypes2["WindBurst"] = "minecraft:wind_burst";
        return MinecraftEnchantmentTypes2;
    })(MinecraftEnchantmentTypes || {});
    var MinecraftEntityTypes = (MinecraftEntityTypes2 => {
        MinecraftEntityTypes2["Agent"] = "minecraft:agent";
        MinecraftEntityTypes2["Allay"] = "minecraft:allay";
        MinecraftEntityTypes2["AreaEffectCloud"] = "minecraft:area_effect_cloud";
        MinecraftEntityTypes2["Armadillo"] = "minecraft:armadillo";
        MinecraftEntityTypes2["ArmorStand"] = "minecraft:armor_stand";
        MinecraftEntityTypes2["Arrow"] = "minecraft:arrow";
        MinecraftEntityTypes2["Axolotl"] = "minecraft:axolotl";
        MinecraftEntityTypes2["Bat"] = "minecraft:bat";
        MinecraftEntityTypes2["Bee"] = "minecraft:bee";
        MinecraftEntityTypes2["Blaze"] = "minecraft:blaze";
        MinecraftEntityTypes2["Boat"] = "minecraft:boat";
        MinecraftEntityTypes2["Bogged"] = "minecraft:bogged";
        MinecraftEntityTypes2["Breeze"] = "minecraft:breeze";
        MinecraftEntityTypes2["BreezeWindChargeProjectile"] = "minecraft:breeze_wind_charge_projectile";
        MinecraftEntityTypes2["Camel"] = "minecraft:camel";
        MinecraftEntityTypes2["Cat"] = "minecraft:cat";
        MinecraftEntityTypes2["CaveSpider"] = "minecraft:cave_spider";
        MinecraftEntityTypes2["ChestBoat"] = "minecraft:chest_boat";
        MinecraftEntityTypes2["ChestMinecart"] = "minecraft:chest_minecart";
        MinecraftEntityTypes2["Chicken"] = "minecraft:chicken";
        MinecraftEntityTypes2["Cod"] = "minecraft:cod";
        MinecraftEntityTypes2["CommandBlockMinecart"] = "minecraft:command_block_minecart";
        MinecraftEntityTypes2["Cow"] = "minecraft:cow";
        MinecraftEntityTypes2["Creaking"] = "minecraft:creaking";
        MinecraftEntityTypes2["Creeper"] = "minecraft:creeper";
        MinecraftEntityTypes2["Dolphin"] = "minecraft:dolphin";
        MinecraftEntityTypes2["Donkey"] = "minecraft:donkey";
        MinecraftEntityTypes2["DragonFireball"] = "minecraft:dragon_fireball";
        MinecraftEntityTypes2["Drowned"] = "minecraft:drowned";
        MinecraftEntityTypes2["Egg"] = "minecraft:egg";
        MinecraftEntityTypes2["ElderGuardian"] = "minecraft:elder_guardian";
        MinecraftEntityTypes2["EnderCrystal"] = "minecraft:ender_crystal";
        MinecraftEntityTypes2["EnderDragon"] = "minecraft:ender_dragon";
        MinecraftEntityTypes2["EnderPearl"] = "minecraft:ender_pearl";
        MinecraftEntityTypes2["Enderman"] = "minecraft:enderman";
        MinecraftEntityTypes2["Endermite"] = "minecraft:endermite";
        MinecraftEntityTypes2["EvocationIllager"] = "minecraft:evocation_illager";
        MinecraftEntityTypes2["EyeOfEnderSignal"] = "minecraft:eye_of_ender_signal";
        MinecraftEntityTypes2["Fireball"] = "minecraft:fireball";
        MinecraftEntityTypes2["FireworksRocket"] = "minecraft:fireworks_rocket";
        MinecraftEntityTypes2["FishingHook"] = "minecraft:fishing_hook";
        MinecraftEntityTypes2["Fox"] = "minecraft:fox";
        MinecraftEntityTypes2["Frog"] = "minecraft:frog";
        MinecraftEntityTypes2["Ghast"] = "minecraft:ghast";
        MinecraftEntityTypes2["GlowSquid"] = "minecraft:glow_squid";
        MinecraftEntityTypes2["Goat"] = "minecraft:goat";
        MinecraftEntityTypes2["Guardian"] = "minecraft:guardian";
        MinecraftEntityTypes2["Hoglin"] = "minecraft:hoglin";
        MinecraftEntityTypes2["HopperMinecart"] = "minecraft:hopper_minecart";
        MinecraftEntityTypes2["Horse"] = "minecraft:horse";
        MinecraftEntityTypes2["Husk"] = "minecraft:husk";
        MinecraftEntityTypes2["IronGolem"] = "minecraft:iron_golem";
        MinecraftEntityTypes2["LightningBolt"] = "minecraft:lightning_bolt";
        MinecraftEntityTypes2["LingeringPotion"] = "minecraft:lingering_potion";
        MinecraftEntityTypes2["Llama"] = "minecraft:llama";
        MinecraftEntityTypes2["LlamaSpit"] = "minecraft:llama_spit";
        MinecraftEntityTypes2["MagmaCube"] = "minecraft:magma_cube";
        MinecraftEntityTypes2["Minecart"] = "minecraft:minecart";
        MinecraftEntityTypes2["Mooshroom"] = "minecraft:mooshroom";
        MinecraftEntityTypes2["Mule"] = "minecraft:mule";
        MinecraftEntityTypes2["Npc"] = "minecraft:npc";
        MinecraftEntityTypes2["Ocelot"] = "minecraft:ocelot";
        MinecraftEntityTypes2["OminousItemSpawner"] = "minecraft:ominous_item_spawner";
        MinecraftEntityTypes2["Panda"] = "minecraft:panda";
        MinecraftEntityTypes2["Parrot"] = "minecraft:parrot";
        MinecraftEntityTypes2["Phantom"] = "minecraft:phantom";
        MinecraftEntityTypes2["Pig"] = "minecraft:pig";
        MinecraftEntityTypes2["Piglin"] = "minecraft:piglin";
        MinecraftEntityTypes2["PiglinBrute"] = "minecraft:piglin_brute";
        MinecraftEntityTypes2["Pillager"] = "minecraft:pillager";
        MinecraftEntityTypes2["Player"] = "minecraft:player";
        MinecraftEntityTypes2["PolarBear"] = "minecraft:polar_bear";
        MinecraftEntityTypes2["Pufferfish"] = "minecraft:pufferfish";
        MinecraftEntityTypes2["Rabbit"] = "minecraft:rabbit";
        MinecraftEntityTypes2["Ravager"] = "minecraft:ravager";
        MinecraftEntityTypes2["Salmon"] = "minecraft:salmon";
        MinecraftEntityTypes2["Sheep"] = "minecraft:sheep";
        MinecraftEntityTypes2["Shulker"] = "minecraft:shulker";
        MinecraftEntityTypes2["ShulkerBullet"] = "minecraft:shulker_bullet";
        MinecraftEntityTypes2["Silverfish"] = "minecraft:silverfish";
        MinecraftEntityTypes2["Skeleton"] = "minecraft:skeleton";
        MinecraftEntityTypes2["SkeletonHorse"] = "minecraft:skeleton_horse";
        MinecraftEntityTypes2["Slime"] = "minecraft:slime";
        MinecraftEntityTypes2["SmallFireball"] = "minecraft:small_fireball";
        MinecraftEntityTypes2["Sniffer"] = "minecraft:sniffer";
        MinecraftEntityTypes2["SnowGolem"] = "minecraft:snow_golem";
        MinecraftEntityTypes2["Snowball"] = "minecraft:snowball";
        MinecraftEntityTypes2["Spider"] = "minecraft:spider";
        MinecraftEntityTypes2["SplashPotion"] = "minecraft:splash_potion";
        MinecraftEntityTypes2["Squid"] = "minecraft:squid";
        MinecraftEntityTypes2["Stray"] = "minecraft:stray";
        MinecraftEntityTypes2["Strider"] = "minecraft:strider";
        MinecraftEntityTypes2["Tadpole"] = "minecraft:tadpole";
        MinecraftEntityTypes2["ThrownTrident"] = "minecraft:thrown_trident";
        MinecraftEntityTypes2["Tnt"] = "minecraft:tnt";
        MinecraftEntityTypes2["TntMinecart"] = "minecraft:tnt_minecart";
        MinecraftEntityTypes2["TraderLlama"] = "minecraft:trader_llama";
        MinecraftEntityTypes2["TripodCamera"] = "minecraft:tripod_camera";
        MinecraftEntityTypes2["Tropicalfish"] = "minecraft:tropicalfish";
        MinecraftEntityTypes2["Turtle"] = "minecraft:turtle";
        MinecraftEntityTypes2["Vex"] = "minecraft:vex";
        MinecraftEntityTypes2["Villager"] = "minecraft:villager";
        MinecraftEntityTypes2["VillagerV2"] = "minecraft:villager_v2";
        MinecraftEntityTypes2["Vindicator"] = "minecraft:vindicator";
        MinecraftEntityTypes2["WanderingTrader"] = "minecraft:wandering_trader";
        MinecraftEntityTypes2["Warden"] = "minecraft:warden";
        MinecraftEntityTypes2["WindChargeProjectile"] = "minecraft:wind_charge_projectile";
        MinecraftEntityTypes2["Witch"] = "minecraft:witch";
        MinecraftEntityTypes2["Wither"] = "minecraft:wither";
        MinecraftEntityTypes2["WitherSkeleton"] = "minecraft:wither_skeleton";
        MinecraftEntityTypes2["WitherSkull"] = "minecraft:wither_skull";
        MinecraftEntityTypes2["WitherSkullDangerous"] = "minecraft:wither_skull_dangerous";
        MinecraftEntityTypes2["Wolf"] = "minecraft:wolf";
        MinecraftEntityTypes2["XpBottle"] = "minecraft:xp_bottle";
        MinecraftEntityTypes2["XpOrb"] = "minecraft:xp_orb";
        MinecraftEntityTypes2["Zoglin"] = "minecraft:zoglin";
        MinecraftEntityTypes2["Zombie"] = "minecraft:zombie";
        MinecraftEntityTypes2["ZombieHorse"] = "minecraft:zombie_horse";
        MinecraftEntityTypes2["ZombiePigman"] = "minecraft:zombie_pigman";
        MinecraftEntityTypes2["ZombieVillager"] = "minecraft:zombie_villager";
        MinecraftEntityTypes2["ZombieVillagerV2"] = "minecraft:zombie_villager_v2";
        return MinecraftEntityTypes2;
    })(MinecraftEntityTypes || {});
    var MinecraftFeatureTypes = (MinecraftFeatureTypes2 => {
        MinecraftFeatureTypes2["AncientCity"] = "minecraft:ancient_city";
        MinecraftFeatureTypes2["BastionRemnant"] = "minecraft:bastion_remnant";
        MinecraftFeatureTypes2["BuriedTreasure"] = "minecraft:buried_treasure";
        MinecraftFeatureTypes2["EndCity"] = "minecraft:end_city";
        MinecraftFeatureTypes2["Fortress"] = "minecraft:fortress";
        MinecraftFeatureTypes2["Mansion"] = "minecraft:mansion";
        MinecraftFeatureTypes2["Mineshaft"] = "minecraft:mineshaft";
        MinecraftFeatureTypes2["Monument"] = "minecraft:monument";
        MinecraftFeatureTypes2["PillagerOutpost"] = "minecraft:pillager_outpost";
        MinecraftFeatureTypes2["RuinedPortal"] = "minecraft:ruined_portal";
        MinecraftFeatureTypes2["Ruins"] = "minecraft:ruins";
        MinecraftFeatureTypes2["Shipwreck"] = "minecraft:shipwreck";
        MinecraftFeatureTypes2["Stronghold"] = "minecraft:stronghold";
        MinecraftFeatureTypes2["Temple"] = "minecraft:temple";
        MinecraftFeatureTypes2["TrailRuins"] = "minecraft:trail_ruins";
        MinecraftFeatureTypes2["TrialChambers"] = "minecraft:trial_chambers";
        MinecraftFeatureTypes2["Village"] = "minecraft:village";
        return MinecraftFeatureTypes2;
    })(MinecraftFeatureTypes || {});
    var MinecraftItemTypes = (MinecraftItemTypes2 => {
        MinecraftItemTypes2["AcaciaBoat"] = "minecraft:acacia_boat";
        MinecraftItemTypes2["AcaciaButton"] = "minecraft:acacia_button";
        MinecraftItemTypes2["AcaciaChestBoat"] = "minecraft:acacia_chest_boat";
        MinecraftItemTypes2["AcaciaDoor"] = "minecraft:acacia_door";
        MinecraftItemTypes2["AcaciaFence"] = "minecraft:acacia_fence";
        MinecraftItemTypes2["AcaciaFenceGate"] = "minecraft:acacia_fence_gate";
        MinecraftItemTypes2["AcaciaHangingSign"] = "minecraft:acacia_hanging_sign";
        MinecraftItemTypes2["AcaciaLeaves"] = "minecraft:acacia_leaves";
        MinecraftItemTypes2["AcaciaLog"] = "minecraft:acacia_log";
        MinecraftItemTypes2["AcaciaPlanks"] = "minecraft:acacia_planks";
        MinecraftItemTypes2["AcaciaPressurePlate"] = "minecraft:acacia_pressure_plate";
        MinecraftItemTypes2["AcaciaSapling"] = "minecraft:acacia_sapling";
        MinecraftItemTypes2["AcaciaSign"] = "minecraft:acacia_sign";
        MinecraftItemTypes2["AcaciaSlab"] = "minecraft:acacia_slab";
        MinecraftItemTypes2["AcaciaStairs"] = "minecraft:acacia_stairs";
        MinecraftItemTypes2["AcaciaTrapdoor"] = "minecraft:acacia_trapdoor";
        MinecraftItemTypes2["AcaciaWood"] = "minecraft:acacia_wood";
        MinecraftItemTypes2["ActivatorRail"] = "minecraft:activator_rail";
        MinecraftItemTypes2["Air"] = "minecraft:air";
        MinecraftItemTypes2["AllaySpawnEgg"] = "minecraft:allay_spawn_egg";
        MinecraftItemTypes2["Allium"] = "minecraft:allium";
        MinecraftItemTypes2["Allow"] = "minecraft:allow";
        MinecraftItemTypes2["AmethystBlock"] = "minecraft:amethyst_block";
        MinecraftItemTypes2["AmethystCluster"] = "minecraft:amethyst_cluster";
        MinecraftItemTypes2["AmethystShard"] = "minecraft:amethyst_shard";
        MinecraftItemTypes2["AncientDebris"] = "minecraft:ancient_debris";
        MinecraftItemTypes2["Andesite"] = "minecraft:andesite";
        MinecraftItemTypes2["AndesiteSlab"] = "minecraft:andesite_slab";
        MinecraftItemTypes2["AndesiteStairs"] = "minecraft:andesite_stairs";
        MinecraftItemTypes2["AndesiteWall"] = "minecraft:andesite_wall";
        MinecraftItemTypes2["AnglerPotterySherd"] = "minecraft:angler_pottery_sherd";
        MinecraftItemTypes2["Anvil"] = "minecraft:anvil";
        MinecraftItemTypes2["Apple"] = "minecraft:apple";
        MinecraftItemTypes2["ArcherPotterySherd"] = "minecraft:archer_pottery_sherd";
        MinecraftItemTypes2["ArmadilloScute"] = "minecraft:armadillo_scute";
        MinecraftItemTypes2["ArmadilloSpawnEgg"] = "minecraft:armadillo_spawn_egg";
        MinecraftItemTypes2["ArmorStand"] = "minecraft:armor_stand";
        MinecraftItemTypes2["ArmsUpPotterySherd"] = "minecraft:arms_up_pottery_sherd";
        MinecraftItemTypes2["Arrow"] = "minecraft:arrow";
        MinecraftItemTypes2["AxolotlBucket"] = "minecraft:axolotl_bucket";
        MinecraftItemTypes2["AxolotlSpawnEgg"] = "minecraft:axolotl_spawn_egg";
        MinecraftItemTypes2["Azalea"] = "minecraft:azalea";
        MinecraftItemTypes2["AzaleaLeaves"] = "minecraft:azalea_leaves";
        MinecraftItemTypes2["AzaleaLeavesFlowered"] = "minecraft:azalea_leaves_flowered";
        MinecraftItemTypes2["AzureBluet"] = "minecraft:azure_bluet";
        MinecraftItemTypes2["BakedPotato"] = "minecraft:baked_potato";
        MinecraftItemTypes2["Bamboo"] = "minecraft:bamboo";
        MinecraftItemTypes2["BambooBlock"] = "minecraft:bamboo_block";
        MinecraftItemTypes2["BambooButton"] = "minecraft:bamboo_button";
        MinecraftItemTypes2["BambooChestRaft"] = "minecraft:bamboo_chest_raft";
        MinecraftItemTypes2["BambooDoor"] = "minecraft:bamboo_door";
        MinecraftItemTypes2["BambooFence"] = "minecraft:bamboo_fence";
        MinecraftItemTypes2["BambooFenceGate"] = "minecraft:bamboo_fence_gate";
        MinecraftItemTypes2["BambooHangingSign"] = "minecraft:bamboo_hanging_sign";
        MinecraftItemTypes2["BambooMosaic"] = "minecraft:bamboo_mosaic";
        MinecraftItemTypes2["BambooMosaicSlab"] = "minecraft:bamboo_mosaic_slab";
        MinecraftItemTypes2["BambooMosaicStairs"] = "minecraft:bamboo_mosaic_stairs";
        MinecraftItemTypes2["BambooPlanks"] = "minecraft:bamboo_planks";
        MinecraftItemTypes2["BambooPressurePlate"] = "minecraft:bamboo_pressure_plate";
        MinecraftItemTypes2["BambooRaft"] = "minecraft:bamboo_raft";
        MinecraftItemTypes2["BambooSign"] = "minecraft:bamboo_sign";
        MinecraftItemTypes2["BambooSlab"] = "minecraft:bamboo_slab";
        MinecraftItemTypes2["BambooStairs"] = "minecraft:bamboo_stairs";
        MinecraftItemTypes2["BambooTrapdoor"] = "minecraft:bamboo_trapdoor";
        MinecraftItemTypes2["Banner"] = "minecraft:banner";
        MinecraftItemTypes2["Barrel"] = "minecraft:barrel";
        MinecraftItemTypes2["Barrier"] = "minecraft:barrier";
        MinecraftItemTypes2["Basalt"] = "minecraft:basalt";
        MinecraftItemTypes2["BatSpawnEgg"] = "minecraft:bat_spawn_egg";
        MinecraftItemTypes2["Beacon"] = "minecraft:beacon";
        MinecraftItemTypes2["Bed"] = "minecraft:bed";
        MinecraftItemTypes2["Bedrock"] = "minecraft:bedrock";
        MinecraftItemTypes2["BeeNest"] = "minecraft:bee_nest";
        MinecraftItemTypes2["BeeSpawnEgg"] = "minecraft:bee_spawn_egg";
        MinecraftItemTypes2["Beef"] = "minecraft:beef";
        MinecraftItemTypes2["Beehive"] = "minecraft:beehive";
        MinecraftItemTypes2["Beetroot"] = "minecraft:beetroot";
        MinecraftItemTypes2["BeetrootSeeds"] = "minecraft:beetroot_seeds";
        MinecraftItemTypes2["BeetrootSoup"] = "minecraft:beetroot_soup";
        MinecraftItemTypes2["Bell"] = "minecraft:bell";
        MinecraftItemTypes2["BigDripleaf"] = "minecraft:big_dripleaf";
        MinecraftItemTypes2["BirchBoat"] = "minecraft:birch_boat";
        MinecraftItemTypes2["BirchButton"] = "minecraft:birch_button";
        MinecraftItemTypes2["BirchChestBoat"] = "minecraft:birch_chest_boat";
        MinecraftItemTypes2["BirchDoor"] = "minecraft:birch_door";
        MinecraftItemTypes2["BirchFence"] = "minecraft:birch_fence";
        MinecraftItemTypes2["BirchFenceGate"] = "minecraft:birch_fence_gate";
        MinecraftItemTypes2["BirchHangingSign"] = "minecraft:birch_hanging_sign";
        MinecraftItemTypes2["BirchLeaves"] = "minecraft:birch_leaves";
        MinecraftItemTypes2["BirchLog"] = "minecraft:birch_log";
        MinecraftItemTypes2["BirchPlanks"] = "minecraft:birch_planks";
        MinecraftItemTypes2["BirchPressurePlate"] = "minecraft:birch_pressure_plate";
        MinecraftItemTypes2["BirchSapling"] = "minecraft:birch_sapling";
        MinecraftItemTypes2["BirchSign"] = "minecraft:birch_sign";
        MinecraftItemTypes2["BirchSlab"] = "minecraft:birch_slab";
        MinecraftItemTypes2["BirchStairs"] = "minecraft:birch_stairs";
        MinecraftItemTypes2["BirchTrapdoor"] = "minecraft:birch_trapdoor";
        MinecraftItemTypes2["BirchWood"] = "minecraft:birch_wood";
        MinecraftItemTypes2["BlackBundle"] = "minecraft:black_bundle";
        MinecraftItemTypes2["BlackCandle"] = "minecraft:black_candle";
        MinecraftItemTypes2["BlackCarpet"] = "minecraft:black_carpet";
        MinecraftItemTypes2["BlackConcrete"] = "minecraft:black_concrete";
        MinecraftItemTypes2["BlackConcretePowder"] = "minecraft:black_concrete_powder";
        MinecraftItemTypes2["BlackDye"] = "minecraft:black_dye";
        MinecraftItemTypes2["BlackGlazedTerracotta"] = "minecraft:black_glazed_terracotta";
        MinecraftItemTypes2["BlackShulkerBox"] = "minecraft:black_shulker_box";
        MinecraftItemTypes2["BlackStainedGlass"] = "minecraft:black_stained_glass";
        MinecraftItemTypes2["BlackStainedGlassPane"] = "minecraft:black_stained_glass_pane";
        MinecraftItemTypes2["BlackTerracotta"] = "minecraft:black_terracotta";
        MinecraftItemTypes2["BlackWool"] = "minecraft:black_wool";
        MinecraftItemTypes2["Blackstone"] = "minecraft:blackstone";
        MinecraftItemTypes2["BlackstoneSlab"] = "minecraft:blackstone_slab";
        MinecraftItemTypes2["BlackstoneStairs"] = "minecraft:blackstone_stairs";
        MinecraftItemTypes2["BlackstoneWall"] = "minecraft:blackstone_wall";
        MinecraftItemTypes2["BladePotterySherd"] = "minecraft:blade_pottery_sherd";
        MinecraftItemTypes2["BlastFurnace"] = "minecraft:blast_furnace";
        MinecraftItemTypes2["BlazePowder"] = "minecraft:blaze_powder";
        MinecraftItemTypes2["BlazeRod"] = "minecraft:blaze_rod";
        MinecraftItemTypes2["BlazeSpawnEgg"] = "minecraft:blaze_spawn_egg";
        MinecraftItemTypes2["BlueBundle"] = "minecraft:blue_bundle";
        MinecraftItemTypes2["BlueCandle"] = "minecraft:blue_candle";
        MinecraftItemTypes2["BlueCarpet"] = "minecraft:blue_carpet";
        MinecraftItemTypes2["BlueConcrete"] = "minecraft:blue_concrete";
        MinecraftItemTypes2["BlueConcretePowder"] = "minecraft:blue_concrete_powder";
        MinecraftItemTypes2["BlueDye"] = "minecraft:blue_dye";
        MinecraftItemTypes2["BlueGlazedTerracotta"] = "minecraft:blue_glazed_terracotta";
        MinecraftItemTypes2["BlueIce"] = "minecraft:blue_ice";
        MinecraftItemTypes2["BlueOrchid"] = "minecraft:blue_orchid";
        MinecraftItemTypes2["BlueShulkerBox"] = "minecraft:blue_shulker_box";
        MinecraftItemTypes2["BlueStainedGlass"] = "minecraft:blue_stained_glass";
        MinecraftItemTypes2["BlueStainedGlassPane"] = "minecraft:blue_stained_glass_pane";
        MinecraftItemTypes2["BlueTerracotta"] = "minecraft:blue_terracotta";
        MinecraftItemTypes2["BlueWool"] = "minecraft:blue_wool";
        MinecraftItemTypes2["BoggedSpawnEgg"] = "minecraft:bogged_spawn_egg";
        MinecraftItemTypes2["BoltArmorTrimSmithingTemplate"] = "minecraft:bolt_armor_trim_smithing_template";
        MinecraftItemTypes2["Bone"] = "minecraft:bone";
        MinecraftItemTypes2["BoneBlock"] = "minecraft:bone_block";
        MinecraftItemTypes2["BoneMeal"] = "minecraft:bone_meal";
        MinecraftItemTypes2["Book"] = "minecraft:book";
        MinecraftItemTypes2["Bookshelf"] = "minecraft:bookshelf";
        MinecraftItemTypes2["BorderBlock"] = "minecraft:border_block";
        MinecraftItemTypes2["BordureIndentedBannerPattern"] = "minecraft:bordure_indented_banner_pattern";
        MinecraftItemTypes2["Bow"] = "minecraft:bow";
        MinecraftItemTypes2["Bowl"] = "minecraft:bowl";
        MinecraftItemTypes2["BrainCoral"] = "minecraft:brain_coral";
        MinecraftItemTypes2["BrainCoralBlock"] = "minecraft:brain_coral_block";
        MinecraftItemTypes2["BrainCoralFan"] = "minecraft:brain_coral_fan";
        MinecraftItemTypes2["Bread"] = "minecraft:bread";
        MinecraftItemTypes2["BreezeRod"] = "minecraft:breeze_rod";
        MinecraftItemTypes2["BreezeSpawnEgg"] = "minecraft:breeze_spawn_egg";
        MinecraftItemTypes2["BrewerPotterySherd"] = "minecraft:brewer_pottery_sherd";
        MinecraftItemTypes2["BrewingStand"] = "minecraft:brewing_stand";
        MinecraftItemTypes2["Brick"] = "minecraft:brick";
        MinecraftItemTypes2["BrickBlock"] = "minecraft:brick_block";
        MinecraftItemTypes2["BrickSlab"] = "minecraft:brick_slab";
        MinecraftItemTypes2["BrickStairs"] = "minecraft:brick_stairs";
        MinecraftItemTypes2["BrickWall"] = "minecraft:brick_wall";
        MinecraftItemTypes2["BrownBundle"] = "minecraft:brown_bundle";
        MinecraftItemTypes2["BrownCandle"] = "minecraft:brown_candle";
        MinecraftItemTypes2["BrownCarpet"] = "minecraft:brown_carpet";
        MinecraftItemTypes2["BrownConcrete"] = "minecraft:brown_concrete";
        MinecraftItemTypes2["BrownConcretePowder"] = "minecraft:brown_concrete_powder";
        MinecraftItemTypes2["BrownDye"] = "minecraft:brown_dye";
        MinecraftItemTypes2["BrownGlazedTerracotta"] = "minecraft:brown_glazed_terracotta";
        MinecraftItemTypes2["BrownMushroom"] = "minecraft:brown_mushroom";
        MinecraftItemTypes2["BrownMushroomBlock"] = "minecraft:brown_mushroom_block";
        MinecraftItemTypes2["BrownShulkerBox"] = "minecraft:brown_shulker_box";
        MinecraftItemTypes2["BrownStainedGlass"] = "minecraft:brown_stained_glass";
        MinecraftItemTypes2["BrownStainedGlassPane"] = "minecraft:brown_stained_glass_pane";
        MinecraftItemTypes2["BrownTerracotta"] = "minecraft:brown_terracotta";
        MinecraftItemTypes2["BrownWool"] = "minecraft:brown_wool";
        MinecraftItemTypes2["Brush"] = "minecraft:brush";
        MinecraftItemTypes2["BubbleCoral"] = "minecraft:bubble_coral";
        MinecraftItemTypes2["BubbleCoralBlock"] = "minecraft:bubble_coral_block";
        MinecraftItemTypes2["BubbleCoralFan"] = "minecraft:bubble_coral_fan";
        MinecraftItemTypes2["Bucket"] = "minecraft:bucket";
        MinecraftItemTypes2["BuddingAmethyst"] = "minecraft:budding_amethyst";
        MinecraftItemTypes2["Bundle"] = "minecraft:bundle";
        MinecraftItemTypes2["BurnPotterySherd"] = "minecraft:burn_pottery_sherd";
        MinecraftItemTypes2["Cactus"] = "minecraft:cactus";
        MinecraftItemTypes2["Cake"] = "minecraft:cake";
        MinecraftItemTypes2["Calcite"] = "minecraft:calcite";
        MinecraftItemTypes2["CalibratedSculkSensor"] = "minecraft:calibrated_sculk_sensor";
        MinecraftItemTypes2["CamelSpawnEgg"] = "minecraft:camel_spawn_egg";
        MinecraftItemTypes2["Campfire"] = "minecraft:campfire";
        MinecraftItemTypes2["Candle"] = "minecraft:candle";
        MinecraftItemTypes2["Carrot"] = "minecraft:carrot";
        MinecraftItemTypes2["CarrotOnAStick"] = "minecraft:carrot_on_a_stick";
        MinecraftItemTypes2["CartographyTable"] = "minecraft:cartography_table";
        MinecraftItemTypes2["CarvedPumpkin"] = "minecraft:carved_pumpkin";
        MinecraftItemTypes2["CatSpawnEgg"] = "minecraft:cat_spawn_egg";
        MinecraftItemTypes2["Cauldron"] = "minecraft:cauldron";
        MinecraftItemTypes2["CaveSpiderSpawnEgg"] = "minecraft:cave_spider_spawn_egg";
        MinecraftItemTypes2["Chain"] = "minecraft:chain";
        MinecraftItemTypes2["ChainCommandBlock"] = "minecraft:chain_command_block";
        MinecraftItemTypes2["ChainmailBoots"] = "minecraft:chainmail_boots";
        MinecraftItemTypes2["ChainmailChestplate"] = "minecraft:chainmail_chestplate";
        MinecraftItemTypes2["ChainmailHelmet"] = "minecraft:chainmail_helmet";
        MinecraftItemTypes2["ChainmailLeggings"] = "minecraft:chainmail_leggings";
        MinecraftItemTypes2["Charcoal"] = "minecraft:charcoal";
        MinecraftItemTypes2["CherryBoat"] = "minecraft:cherry_boat";
        MinecraftItemTypes2["CherryButton"] = "minecraft:cherry_button";
        MinecraftItemTypes2["CherryChestBoat"] = "minecraft:cherry_chest_boat";
        MinecraftItemTypes2["CherryDoor"] = "minecraft:cherry_door";
        MinecraftItemTypes2["CherryFence"] = "minecraft:cherry_fence";
        MinecraftItemTypes2["CherryFenceGate"] = "minecraft:cherry_fence_gate";
        MinecraftItemTypes2["CherryHangingSign"] = "minecraft:cherry_hanging_sign";
        MinecraftItemTypes2["CherryLeaves"] = "minecraft:cherry_leaves";
        MinecraftItemTypes2["CherryLog"] = "minecraft:cherry_log";
        MinecraftItemTypes2["CherryPlanks"] = "minecraft:cherry_planks";
        MinecraftItemTypes2["CherryPressurePlate"] = "minecraft:cherry_pressure_plate";
        MinecraftItemTypes2["CherrySapling"] = "minecraft:cherry_sapling";
        MinecraftItemTypes2["CherrySign"] = "minecraft:cherry_sign";
        MinecraftItemTypes2["CherrySlab"] = "minecraft:cherry_slab";
        MinecraftItemTypes2["CherryStairs"] = "minecraft:cherry_stairs";
        MinecraftItemTypes2["CherryTrapdoor"] = "minecraft:cherry_trapdoor";
        MinecraftItemTypes2["CherryWood"] = "minecraft:cherry_wood";
        MinecraftItemTypes2["Chest"] = "minecraft:chest";
        MinecraftItemTypes2["ChestMinecart"] = "minecraft:chest_minecart";
        MinecraftItemTypes2["Chicken"] = "minecraft:chicken";
        MinecraftItemTypes2["ChickenSpawnEgg"] = "minecraft:chicken_spawn_egg";
        MinecraftItemTypes2["ChippedAnvil"] = "minecraft:chipped_anvil";
        MinecraftItemTypes2["ChiseledBookshelf"] = "minecraft:chiseled_bookshelf";
        MinecraftItemTypes2["ChiseledCopper"] = "minecraft:chiseled_copper";
        MinecraftItemTypes2["ChiseledDeepslate"] = "minecraft:chiseled_deepslate";
        MinecraftItemTypes2["ChiseledNetherBricks"] = "minecraft:chiseled_nether_bricks";
        MinecraftItemTypes2["ChiseledPolishedBlackstone"] = "minecraft:chiseled_polished_blackstone";
        MinecraftItemTypes2["ChiseledQuartzBlock"] = "minecraft:chiseled_quartz_block";
        MinecraftItemTypes2["ChiseledRedSandstone"] = "minecraft:chiseled_red_sandstone";
        MinecraftItemTypes2["ChiseledResinBricks"] = "minecraft:chiseled_resin_bricks";
        MinecraftItemTypes2["ChiseledSandstone"] = "minecraft:chiseled_sandstone";
        MinecraftItemTypes2["ChiseledStoneBricks"] = "minecraft:chiseled_stone_bricks";
        MinecraftItemTypes2["ChiseledTuff"] = "minecraft:chiseled_tuff";
        MinecraftItemTypes2["ChiseledTuffBricks"] = "minecraft:chiseled_tuff_bricks";
        MinecraftItemTypes2["ChorusFlower"] = "minecraft:chorus_flower";
        MinecraftItemTypes2["ChorusFruit"] = "minecraft:chorus_fruit";
        MinecraftItemTypes2["ChorusPlant"] = "minecraft:chorus_plant";
        MinecraftItemTypes2["Clay"] = "minecraft:clay";
        MinecraftItemTypes2["ClayBall"] = "minecraft:clay_ball";
        MinecraftItemTypes2["Clock"] = "minecraft:clock";
        MinecraftItemTypes2["ClosedEyeblossom"] = "minecraft:closed_eyeblossom";
        MinecraftItemTypes2["Coal"] = "minecraft:coal";
        MinecraftItemTypes2["CoalBlock"] = "minecraft:coal_block";
        MinecraftItemTypes2["CoalOre"] = "minecraft:coal_ore";
        MinecraftItemTypes2["CoarseDirt"] = "minecraft:coarse_dirt";
        MinecraftItemTypes2["CoastArmorTrimSmithingTemplate"] = "minecraft:coast_armor_trim_smithing_template";
        MinecraftItemTypes2["CobbledDeepslate"] = "minecraft:cobbled_deepslate";
        MinecraftItemTypes2["CobbledDeepslateSlab"] = "minecraft:cobbled_deepslate_slab";
        MinecraftItemTypes2["CobbledDeepslateStairs"] = "minecraft:cobbled_deepslate_stairs";
        MinecraftItemTypes2["CobbledDeepslateWall"] = "minecraft:cobbled_deepslate_wall";
        MinecraftItemTypes2["Cobblestone"] = "minecraft:cobblestone";
        MinecraftItemTypes2["CobblestoneSlab"] = "minecraft:cobblestone_slab";
        MinecraftItemTypes2["CobblestoneWall"] = "minecraft:cobblestone_wall";
        MinecraftItemTypes2["CocoaBeans"] = "minecraft:cocoa_beans";
        MinecraftItemTypes2["Cod"] = "minecraft:cod";
        MinecraftItemTypes2["CodBucket"] = "minecraft:cod_bucket";
        MinecraftItemTypes2["CodSpawnEgg"] = "minecraft:cod_spawn_egg";
        MinecraftItemTypes2["CommandBlock"] = "minecraft:command_block";
        MinecraftItemTypes2["CommandBlockMinecart"] = "minecraft:command_block_minecart";
        MinecraftItemTypes2["Comparator"] = "minecraft:comparator";
        MinecraftItemTypes2["Compass"] = "minecraft:compass";
        MinecraftItemTypes2["Composter"] = "minecraft:composter";
        MinecraftItemTypes2["Conduit"] = "minecraft:conduit";
        MinecraftItemTypes2["CookedBeef"] = "minecraft:cooked_beef";
        MinecraftItemTypes2["CookedChicken"] = "minecraft:cooked_chicken";
        MinecraftItemTypes2["CookedCod"] = "minecraft:cooked_cod";
        MinecraftItemTypes2["CookedMutton"] = "minecraft:cooked_mutton";
        MinecraftItemTypes2["CookedPorkchop"] = "minecraft:cooked_porkchop";
        MinecraftItemTypes2["CookedRabbit"] = "minecraft:cooked_rabbit";
        MinecraftItemTypes2["CookedSalmon"] = "minecraft:cooked_salmon";
        MinecraftItemTypes2["Cookie"] = "minecraft:cookie";
        MinecraftItemTypes2["CopperBlock"] = "minecraft:copper_block";
        MinecraftItemTypes2["CopperBulb"] = "minecraft:copper_bulb";
        MinecraftItemTypes2["CopperDoor"] = "minecraft:copper_door";
        MinecraftItemTypes2["CopperGrate"] = "minecraft:copper_grate";
        MinecraftItemTypes2["CopperIngot"] = "minecraft:copper_ingot";
        MinecraftItemTypes2["CopperOre"] = "minecraft:copper_ore";
        MinecraftItemTypes2["CopperTrapdoor"] = "minecraft:copper_trapdoor";
        MinecraftItemTypes2["Cornflower"] = "minecraft:cornflower";
        MinecraftItemTypes2["CowSpawnEgg"] = "minecraft:cow_spawn_egg";
        MinecraftItemTypes2["CrackedDeepslateBricks"] = "minecraft:cracked_deepslate_bricks";
        MinecraftItemTypes2["CrackedDeepslateTiles"] = "minecraft:cracked_deepslate_tiles";
        MinecraftItemTypes2["CrackedNetherBricks"] = "minecraft:cracked_nether_bricks";
        MinecraftItemTypes2["CrackedPolishedBlackstoneBricks"] = "minecraft:cracked_polished_blackstone_bricks";
        MinecraftItemTypes2["CrackedStoneBricks"] = "minecraft:cracked_stone_bricks";
        MinecraftItemTypes2["Crafter"] = "minecraft:crafter";
        MinecraftItemTypes2["CraftingTable"] = "minecraft:crafting_table";
        MinecraftItemTypes2["CreakingHeart"] = "minecraft:creaking_heart";
        MinecraftItemTypes2["CreakingSpawnEgg"] = "minecraft:creaking_spawn_egg";
        MinecraftItemTypes2["CreeperBannerPattern"] = "minecraft:creeper_banner_pattern";
        MinecraftItemTypes2["CreeperHead"] = "minecraft:creeper_head";
        MinecraftItemTypes2["CreeperSpawnEgg"] = "minecraft:creeper_spawn_egg";
        MinecraftItemTypes2["CrimsonButton"] = "minecraft:crimson_button";
        MinecraftItemTypes2["CrimsonDoor"] = "minecraft:crimson_door";
        MinecraftItemTypes2["CrimsonFence"] = "minecraft:crimson_fence";
        MinecraftItemTypes2["CrimsonFenceGate"] = "minecraft:crimson_fence_gate";
        MinecraftItemTypes2["CrimsonFungus"] = "minecraft:crimson_fungus";
        MinecraftItemTypes2["CrimsonHangingSign"] = "minecraft:crimson_hanging_sign";
        MinecraftItemTypes2["CrimsonHyphae"] = "minecraft:crimson_hyphae";
        MinecraftItemTypes2["CrimsonNylium"] = "minecraft:crimson_nylium";
        MinecraftItemTypes2["CrimsonPlanks"] = "minecraft:crimson_planks";
        MinecraftItemTypes2["CrimsonPressurePlate"] = "minecraft:crimson_pressure_plate";
        MinecraftItemTypes2["CrimsonRoots"] = "minecraft:crimson_roots";
        MinecraftItemTypes2["CrimsonSign"] = "minecraft:crimson_sign";
        MinecraftItemTypes2["CrimsonSlab"] = "minecraft:crimson_slab";
        MinecraftItemTypes2["CrimsonStairs"] = "minecraft:crimson_stairs";
        MinecraftItemTypes2["CrimsonStem"] = "minecraft:crimson_stem";
        MinecraftItemTypes2["CrimsonTrapdoor"] = "minecraft:crimson_trapdoor";
        MinecraftItemTypes2["Crossbow"] = "minecraft:crossbow";
        MinecraftItemTypes2["CryingObsidian"] = "minecraft:crying_obsidian";
        MinecraftItemTypes2["CutCopper"] = "minecraft:cut_copper";
        MinecraftItemTypes2["CutCopperSlab"] = "minecraft:cut_copper_slab";
        MinecraftItemTypes2["CutCopperStairs"] = "minecraft:cut_copper_stairs";
        MinecraftItemTypes2["CutRedSandstone"] = "minecraft:cut_red_sandstone";
        MinecraftItemTypes2["CutRedSandstoneSlab"] = "minecraft:cut_red_sandstone_slab";
        MinecraftItemTypes2["CutSandstone"] = "minecraft:cut_sandstone";
        MinecraftItemTypes2["CutSandstoneSlab"] = "minecraft:cut_sandstone_slab";
        MinecraftItemTypes2["CyanBundle"] = "minecraft:cyan_bundle";
        MinecraftItemTypes2["CyanCandle"] = "minecraft:cyan_candle";
        MinecraftItemTypes2["CyanCarpet"] = "minecraft:cyan_carpet";
        MinecraftItemTypes2["CyanConcrete"] = "minecraft:cyan_concrete";
        MinecraftItemTypes2["CyanConcretePowder"] = "minecraft:cyan_concrete_powder";
        MinecraftItemTypes2["CyanDye"] = "minecraft:cyan_dye";
        MinecraftItemTypes2["CyanGlazedTerracotta"] = "minecraft:cyan_glazed_terracotta";
        MinecraftItemTypes2["CyanShulkerBox"] = "minecraft:cyan_shulker_box";
        MinecraftItemTypes2["CyanStainedGlass"] = "minecraft:cyan_stained_glass";
        MinecraftItemTypes2["CyanStainedGlassPane"] = "minecraft:cyan_stained_glass_pane";
        MinecraftItemTypes2["CyanTerracotta"] = "minecraft:cyan_terracotta";
        MinecraftItemTypes2["CyanWool"] = "minecraft:cyan_wool";
        MinecraftItemTypes2["DamagedAnvil"] = "minecraft:damaged_anvil";
        MinecraftItemTypes2["Dandelion"] = "minecraft:dandelion";
        MinecraftItemTypes2["DangerPotterySherd"] = "minecraft:danger_pottery_sherd";
        MinecraftItemTypes2["DarkOakBoat"] = "minecraft:dark_oak_boat";
        MinecraftItemTypes2["DarkOakButton"] = "minecraft:dark_oak_button";
        MinecraftItemTypes2["DarkOakChestBoat"] = "minecraft:dark_oak_chest_boat";
        MinecraftItemTypes2["DarkOakDoor"] = "minecraft:dark_oak_door";
        MinecraftItemTypes2["DarkOakFence"] = "minecraft:dark_oak_fence";
        MinecraftItemTypes2["DarkOakFenceGate"] = "minecraft:dark_oak_fence_gate";
        MinecraftItemTypes2["DarkOakHangingSign"] = "minecraft:dark_oak_hanging_sign";
        MinecraftItemTypes2["DarkOakLeaves"] = "minecraft:dark_oak_leaves";
        MinecraftItemTypes2["DarkOakLog"] = "minecraft:dark_oak_log";
        MinecraftItemTypes2["DarkOakPlanks"] = "minecraft:dark_oak_planks";
        MinecraftItemTypes2["DarkOakPressurePlate"] = "minecraft:dark_oak_pressure_plate";
        MinecraftItemTypes2["DarkOakSapling"] = "minecraft:dark_oak_sapling";
        MinecraftItemTypes2["DarkOakSign"] = "minecraft:dark_oak_sign";
        MinecraftItemTypes2["DarkOakSlab"] = "minecraft:dark_oak_slab";
        MinecraftItemTypes2["DarkOakStairs"] = "minecraft:dark_oak_stairs";
        MinecraftItemTypes2["DarkOakTrapdoor"] = "minecraft:dark_oak_trapdoor";
        MinecraftItemTypes2["DarkOakWood"] = "minecraft:dark_oak_wood";
        MinecraftItemTypes2["DarkPrismarine"] = "minecraft:dark_prismarine";
        MinecraftItemTypes2["DarkPrismarineSlab"] = "minecraft:dark_prismarine_slab";
        MinecraftItemTypes2["DarkPrismarineStairs"] = "minecraft:dark_prismarine_stairs";
        MinecraftItemTypes2["DaylightDetector"] = "minecraft:daylight_detector";
        MinecraftItemTypes2["DeadBrainCoral"] = "minecraft:dead_brain_coral";
        MinecraftItemTypes2["DeadBrainCoralBlock"] = "minecraft:dead_brain_coral_block";
        MinecraftItemTypes2["DeadBrainCoralFan"] = "minecraft:dead_brain_coral_fan";
        MinecraftItemTypes2["DeadBubbleCoral"] = "minecraft:dead_bubble_coral";
        MinecraftItemTypes2["DeadBubbleCoralBlock"] = "minecraft:dead_bubble_coral_block";
        MinecraftItemTypes2["DeadBubbleCoralFan"] = "minecraft:dead_bubble_coral_fan";
        MinecraftItemTypes2["DeadFireCoral"] = "minecraft:dead_fire_coral";
        MinecraftItemTypes2["DeadFireCoralBlock"] = "minecraft:dead_fire_coral_block";
        MinecraftItemTypes2["DeadFireCoralFan"] = "minecraft:dead_fire_coral_fan";
        MinecraftItemTypes2["DeadHornCoral"] = "minecraft:dead_horn_coral";
        MinecraftItemTypes2["DeadHornCoralBlock"] = "minecraft:dead_horn_coral_block";
        MinecraftItemTypes2["DeadHornCoralFan"] = "minecraft:dead_horn_coral_fan";
        MinecraftItemTypes2["DeadTubeCoral"] = "minecraft:dead_tube_coral";
        MinecraftItemTypes2["DeadTubeCoralBlock"] = "minecraft:dead_tube_coral_block";
        MinecraftItemTypes2["DeadTubeCoralFan"] = "minecraft:dead_tube_coral_fan";
        MinecraftItemTypes2["Deadbush"] = "minecraft:deadbush";
        MinecraftItemTypes2["DebugStick"] = "minecraft:debug_stick";
        MinecraftItemTypes2["DecoratedPot"] = "minecraft:decorated_pot";
        MinecraftItemTypes2["Deepslate"] = "minecraft:deepslate";
        MinecraftItemTypes2["DeepslateBrickSlab"] = "minecraft:deepslate_brick_slab";
        MinecraftItemTypes2["DeepslateBrickStairs"] = "minecraft:deepslate_brick_stairs";
        MinecraftItemTypes2["DeepslateBrickWall"] = "minecraft:deepslate_brick_wall";
        MinecraftItemTypes2["DeepslateBricks"] = "minecraft:deepslate_bricks";
        MinecraftItemTypes2["DeepslateCoalOre"] = "minecraft:deepslate_coal_ore";
        MinecraftItemTypes2["DeepslateCopperOre"] = "minecraft:deepslate_copper_ore";
        MinecraftItemTypes2["DeepslateDiamondOre"] = "minecraft:deepslate_diamond_ore";
        MinecraftItemTypes2["DeepslateEmeraldOre"] = "minecraft:deepslate_emerald_ore";
        MinecraftItemTypes2["DeepslateGoldOre"] = "minecraft:deepslate_gold_ore";
        MinecraftItemTypes2["DeepslateIronOre"] = "minecraft:deepslate_iron_ore";
        MinecraftItemTypes2["DeepslateLapisOre"] = "minecraft:deepslate_lapis_ore";
        MinecraftItemTypes2["DeepslateRedstoneOre"] = "minecraft:deepslate_redstone_ore";
        MinecraftItemTypes2["DeepslateTileSlab"] = "minecraft:deepslate_tile_slab";
        MinecraftItemTypes2["DeepslateTileStairs"] = "minecraft:deepslate_tile_stairs";
        MinecraftItemTypes2["DeepslateTileWall"] = "minecraft:deepslate_tile_wall";
        MinecraftItemTypes2["DeepslateTiles"] = "minecraft:deepslate_tiles";
        MinecraftItemTypes2["Deny"] = "minecraft:deny";
        MinecraftItemTypes2["DetectorRail"] = "minecraft:detector_rail";
        MinecraftItemTypes2["Diamond"] = "minecraft:diamond";
        MinecraftItemTypes2["DiamondAxe"] = "minecraft:diamond_axe";
        MinecraftItemTypes2["DiamondBlock"] = "minecraft:diamond_block";
        MinecraftItemTypes2["DiamondBoots"] = "minecraft:diamond_boots";
        MinecraftItemTypes2["DiamondChestplate"] = "minecraft:diamond_chestplate";
        MinecraftItemTypes2["DiamondHelmet"] = "minecraft:diamond_helmet";
        MinecraftItemTypes2["DiamondHoe"] = "minecraft:diamond_hoe";
        MinecraftItemTypes2["DiamondHorseArmor"] = "minecraft:diamond_horse_armor";
        MinecraftItemTypes2["DiamondLeggings"] = "minecraft:diamond_leggings";
        MinecraftItemTypes2["DiamondOre"] = "minecraft:diamond_ore";
        MinecraftItemTypes2["DiamondPickaxe"] = "minecraft:diamond_pickaxe";
        MinecraftItemTypes2["DiamondShovel"] = "minecraft:diamond_shovel";
        MinecraftItemTypes2["DiamondSword"] = "minecraft:diamond_sword";
        MinecraftItemTypes2["Diorite"] = "minecraft:diorite";
        MinecraftItemTypes2["DioriteSlab"] = "minecraft:diorite_slab";
        MinecraftItemTypes2["DioriteStairs"] = "minecraft:diorite_stairs";
        MinecraftItemTypes2["DioriteWall"] = "minecraft:diorite_wall";
        MinecraftItemTypes2["Dirt"] = "minecraft:dirt";
        MinecraftItemTypes2["DirtWithRoots"] = "minecraft:dirt_with_roots";
        MinecraftItemTypes2["DiscFragment5"] = "minecraft:disc_fragment_5";
        MinecraftItemTypes2["Dispenser"] = "minecraft:dispenser";
        MinecraftItemTypes2["DolphinSpawnEgg"] = "minecraft:dolphin_spawn_egg";
        MinecraftItemTypes2["DonkeySpawnEgg"] = "minecraft:donkey_spawn_egg";
        MinecraftItemTypes2["DragonBreath"] = "minecraft:dragon_breath";
        MinecraftItemTypes2["DragonEgg"] = "minecraft:dragon_egg";
        MinecraftItemTypes2["DragonHead"] = "minecraft:dragon_head";
        MinecraftItemTypes2["DriedKelp"] = "minecraft:dried_kelp";
        MinecraftItemTypes2["DriedKelpBlock"] = "minecraft:dried_kelp_block";
        MinecraftItemTypes2["DripstoneBlock"] = "minecraft:dripstone_block";
        MinecraftItemTypes2["Dropper"] = "minecraft:dropper";
        MinecraftItemTypes2["DrownedSpawnEgg"] = "minecraft:drowned_spawn_egg";
        MinecraftItemTypes2["DuneArmorTrimSmithingTemplate"] = "minecraft:dune_armor_trim_smithing_template";
        MinecraftItemTypes2["EchoShard"] = "minecraft:echo_shard";
        MinecraftItemTypes2["Egg"] = "minecraft:egg";
        MinecraftItemTypes2["ElderGuardianSpawnEgg"] = "minecraft:elder_guardian_spawn_egg";
        MinecraftItemTypes2["Elytra"] = "minecraft:elytra";
        MinecraftItemTypes2["Emerald"] = "minecraft:emerald";
        MinecraftItemTypes2["EmeraldBlock"] = "minecraft:emerald_block";
        MinecraftItemTypes2["EmeraldOre"] = "minecraft:emerald_ore";
        MinecraftItemTypes2["EmptyMap"] = "minecraft:empty_map";
        MinecraftItemTypes2["EnchantedBook"] = "minecraft:enchanted_book";
        MinecraftItemTypes2["EnchantedGoldenApple"] = "minecraft:enchanted_golden_apple";
        MinecraftItemTypes2["EnchantingTable"] = "minecraft:enchanting_table";
        MinecraftItemTypes2["EndBrickStairs"] = "minecraft:end_brick_stairs";
        MinecraftItemTypes2["EndBricks"] = "minecraft:end_bricks";
        MinecraftItemTypes2["EndCrystal"] = "minecraft:end_crystal";
        MinecraftItemTypes2["EndPortalFrame"] = "minecraft:end_portal_frame";
        MinecraftItemTypes2["EndRod"] = "minecraft:end_rod";
        MinecraftItemTypes2["EndStone"] = "minecraft:end_stone";
        MinecraftItemTypes2["EndStoneBrickSlab"] = "minecraft:end_stone_brick_slab";
        MinecraftItemTypes2["EndStoneBrickWall"] = "minecraft:end_stone_brick_wall";
        MinecraftItemTypes2["EnderChest"] = "minecraft:ender_chest";
        MinecraftItemTypes2["EnderDragonSpawnEgg"] = "minecraft:ender_dragon_spawn_egg";
        MinecraftItemTypes2["EnderEye"] = "minecraft:ender_eye";
        MinecraftItemTypes2["EnderPearl"] = "minecraft:ender_pearl";
        MinecraftItemTypes2["EndermanSpawnEgg"] = "minecraft:enderman_spawn_egg";
        MinecraftItemTypes2["EndermiteSpawnEgg"] = "minecraft:endermite_spawn_egg";
        MinecraftItemTypes2["EvokerSpawnEgg"] = "minecraft:evoker_spawn_egg";
        MinecraftItemTypes2["ExperienceBottle"] = "minecraft:experience_bottle";
        MinecraftItemTypes2["ExplorerPotterySherd"] = "minecraft:explorer_pottery_sherd";
        MinecraftItemTypes2["ExposedChiseledCopper"] = "minecraft:exposed_chiseled_copper";
        MinecraftItemTypes2["ExposedCopper"] = "minecraft:exposed_copper";
        MinecraftItemTypes2["ExposedCopperBulb"] = "minecraft:exposed_copper_bulb";
        MinecraftItemTypes2["ExposedCopperDoor"] = "minecraft:exposed_copper_door";
        MinecraftItemTypes2["ExposedCopperGrate"] = "minecraft:exposed_copper_grate";
        MinecraftItemTypes2["ExposedCopperTrapdoor"] = "minecraft:exposed_copper_trapdoor";
        MinecraftItemTypes2["ExposedCutCopper"] = "minecraft:exposed_cut_copper";
        MinecraftItemTypes2["ExposedCutCopperSlab"] = "minecraft:exposed_cut_copper_slab";
        MinecraftItemTypes2["ExposedCutCopperStairs"] = "minecraft:exposed_cut_copper_stairs";
        MinecraftItemTypes2["EyeArmorTrimSmithingTemplate"] = "minecraft:eye_armor_trim_smithing_template";
        MinecraftItemTypes2["Farmland"] = "minecraft:farmland";
        MinecraftItemTypes2["Feather"] = "minecraft:feather";
        MinecraftItemTypes2["FenceGate"] = "minecraft:fence_gate";
        MinecraftItemTypes2["FermentedSpiderEye"] = "minecraft:fermented_spider_eye";
        MinecraftItemTypes2["Fern"] = "minecraft:fern";
        MinecraftItemTypes2["FieldMasonedBannerPattern"] = "minecraft:field_masoned_banner_pattern";
        MinecraftItemTypes2["FilledMap"] = "minecraft:filled_map";
        MinecraftItemTypes2["FireCharge"] = "minecraft:fire_charge";
        MinecraftItemTypes2["FireCoral"] = "minecraft:fire_coral";
        MinecraftItemTypes2["FireCoralBlock"] = "minecraft:fire_coral_block";
        MinecraftItemTypes2["FireCoralFan"] = "minecraft:fire_coral_fan";
        MinecraftItemTypes2["FireworkRocket"] = "minecraft:firework_rocket";
        MinecraftItemTypes2["FireworkStar"] = "minecraft:firework_star";
        MinecraftItemTypes2["FishingRod"] = "minecraft:fishing_rod";
        MinecraftItemTypes2["FletchingTable"] = "minecraft:fletching_table";
        MinecraftItemTypes2["Flint"] = "minecraft:flint";
        MinecraftItemTypes2["FlintAndSteel"] = "minecraft:flint_and_steel";
        MinecraftItemTypes2["FlowArmorTrimSmithingTemplate"] = "minecraft:flow_armor_trim_smithing_template";
        MinecraftItemTypes2["FlowBannerPattern"] = "minecraft:flow_banner_pattern";
        MinecraftItemTypes2["FlowPotterySherd"] = "minecraft:flow_pottery_sherd";
        MinecraftItemTypes2["FlowerBannerPattern"] = "minecraft:flower_banner_pattern";
        MinecraftItemTypes2["FlowerPot"] = "minecraft:flower_pot";
        MinecraftItemTypes2["FloweringAzalea"] = "minecraft:flowering_azalea";
        MinecraftItemTypes2["FoxSpawnEgg"] = "minecraft:fox_spawn_egg";
        MinecraftItemTypes2["Frame"] = "minecraft:frame";
        MinecraftItemTypes2["FriendPotterySherd"] = "minecraft:friend_pottery_sherd";
        MinecraftItemTypes2["FrogSpawn"] = "minecraft:frog_spawn";
        MinecraftItemTypes2["FrogSpawnEgg"] = "minecraft:frog_spawn_egg";
        MinecraftItemTypes2["FrostedIce"] = "minecraft:frosted_ice";
        MinecraftItemTypes2["Furnace"] = "minecraft:furnace";
        MinecraftItemTypes2["GhastSpawnEgg"] = "minecraft:ghast_spawn_egg";
        MinecraftItemTypes2["GhastTear"] = "minecraft:ghast_tear";
        MinecraftItemTypes2["GildedBlackstone"] = "minecraft:gilded_blackstone";
        MinecraftItemTypes2["Glass"] = "minecraft:glass";
        MinecraftItemTypes2["GlassBottle"] = "minecraft:glass_bottle";
        MinecraftItemTypes2["GlassPane"] = "minecraft:glass_pane";
        MinecraftItemTypes2["GlisteringMelonSlice"] = "minecraft:glistering_melon_slice";
        MinecraftItemTypes2["GlobeBannerPattern"] = "minecraft:globe_banner_pattern";
        MinecraftItemTypes2["GlowBerries"] = "minecraft:glow_berries";
        MinecraftItemTypes2["GlowFrame"] = "minecraft:glow_frame";
        MinecraftItemTypes2["GlowInkSac"] = "minecraft:glow_ink_sac";
        MinecraftItemTypes2["GlowLichen"] = "minecraft:glow_lichen";
        MinecraftItemTypes2["GlowSquidSpawnEgg"] = "minecraft:glow_squid_spawn_egg";
        MinecraftItemTypes2["Glowstone"] = "minecraft:glowstone";
        MinecraftItemTypes2["GlowstoneDust"] = "minecraft:glowstone_dust";
        MinecraftItemTypes2["GoatHorn"] = "minecraft:goat_horn";
        MinecraftItemTypes2["GoatSpawnEgg"] = "minecraft:goat_spawn_egg";
        MinecraftItemTypes2["GoldBlock"] = "minecraft:gold_block";
        MinecraftItemTypes2["GoldIngot"] = "minecraft:gold_ingot";
        MinecraftItemTypes2["GoldNugget"] = "minecraft:gold_nugget";
        MinecraftItemTypes2["GoldOre"] = "minecraft:gold_ore";
        MinecraftItemTypes2["GoldenApple"] = "minecraft:golden_apple";
        MinecraftItemTypes2["GoldenAxe"] = "minecraft:golden_axe";
        MinecraftItemTypes2["GoldenBoots"] = "minecraft:golden_boots";
        MinecraftItemTypes2["GoldenCarrot"] = "minecraft:golden_carrot";
        MinecraftItemTypes2["GoldenChestplate"] = "minecraft:golden_chestplate";
        MinecraftItemTypes2["GoldenHelmet"] = "minecraft:golden_helmet";
        MinecraftItemTypes2["GoldenHoe"] = "minecraft:golden_hoe";
        MinecraftItemTypes2["GoldenHorseArmor"] = "minecraft:golden_horse_armor";
        MinecraftItemTypes2["GoldenLeggings"] = "minecraft:golden_leggings";
        MinecraftItemTypes2["GoldenPickaxe"] = "minecraft:golden_pickaxe";
        MinecraftItemTypes2["GoldenRail"] = "minecraft:golden_rail";
        MinecraftItemTypes2["GoldenShovel"] = "minecraft:golden_shovel";
        MinecraftItemTypes2["GoldenSword"] = "minecraft:golden_sword";
        MinecraftItemTypes2["Granite"] = "minecraft:granite";
        MinecraftItemTypes2["GraniteSlab"] = "minecraft:granite_slab";
        MinecraftItemTypes2["GraniteStairs"] = "minecraft:granite_stairs";
        MinecraftItemTypes2["GraniteWall"] = "minecraft:granite_wall";
        MinecraftItemTypes2["GrassBlock"] = "minecraft:grass_block";
        MinecraftItemTypes2["GrassPath"] = "minecraft:grass_path";
        MinecraftItemTypes2["Gravel"] = "minecraft:gravel";
        MinecraftItemTypes2["GrayBundle"] = "minecraft:gray_bundle";
        MinecraftItemTypes2["GrayCandle"] = "minecraft:gray_candle";
        MinecraftItemTypes2["GrayCarpet"] = "minecraft:gray_carpet";
        MinecraftItemTypes2["GrayConcrete"] = "minecraft:gray_concrete";
        MinecraftItemTypes2["GrayConcretePowder"] = "minecraft:gray_concrete_powder";
        MinecraftItemTypes2["GrayDye"] = "minecraft:gray_dye";
        MinecraftItemTypes2["GrayGlazedTerracotta"] = "minecraft:gray_glazed_terracotta";
        MinecraftItemTypes2["GrayShulkerBox"] = "minecraft:gray_shulker_box";
        MinecraftItemTypes2["GrayStainedGlass"] = "minecraft:gray_stained_glass";
        MinecraftItemTypes2["GrayStainedGlassPane"] = "minecraft:gray_stained_glass_pane";
        MinecraftItemTypes2["GrayTerracotta"] = "minecraft:gray_terracotta";
        MinecraftItemTypes2["GrayWool"] = "minecraft:gray_wool";
        MinecraftItemTypes2["GreenBundle"] = "minecraft:green_bundle";
        MinecraftItemTypes2["GreenCandle"] = "minecraft:green_candle";
        MinecraftItemTypes2["GreenCarpet"] = "minecraft:green_carpet";
        MinecraftItemTypes2["GreenConcrete"] = "minecraft:green_concrete";
        MinecraftItemTypes2["GreenConcretePowder"] = "minecraft:green_concrete_powder";
        MinecraftItemTypes2["GreenDye"] = "minecraft:green_dye";
        MinecraftItemTypes2["GreenGlazedTerracotta"] = "minecraft:green_glazed_terracotta";
        MinecraftItemTypes2["GreenShulkerBox"] = "minecraft:green_shulker_box";
        MinecraftItemTypes2["GreenStainedGlass"] = "minecraft:green_stained_glass";
        MinecraftItemTypes2["GreenStainedGlassPane"] = "minecraft:green_stained_glass_pane";
        MinecraftItemTypes2["GreenTerracotta"] = "minecraft:green_terracotta";
        MinecraftItemTypes2["GreenWool"] = "minecraft:green_wool";
        MinecraftItemTypes2["Grindstone"] = "minecraft:grindstone";
        MinecraftItemTypes2["GuardianSpawnEgg"] = "minecraft:guardian_spawn_egg";
        MinecraftItemTypes2["Gunpowder"] = "minecraft:gunpowder";
        MinecraftItemTypes2["GusterBannerPattern"] = "minecraft:guster_banner_pattern";
        MinecraftItemTypes2["GusterPotterySherd"] = "minecraft:guster_pottery_sherd";
        MinecraftItemTypes2["HangingRoots"] = "minecraft:hanging_roots";
        MinecraftItemTypes2["HardenedClay"] = "minecraft:hardened_clay";
        MinecraftItemTypes2["HayBlock"] = "minecraft:hay_block";
        MinecraftItemTypes2["HeartOfTheSea"] = "minecraft:heart_of_the_sea";
        MinecraftItemTypes2["HeartPotterySherd"] = "minecraft:heart_pottery_sherd";
        MinecraftItemTypes2["HeartbreakPotterySherd"] = "minecraft:heartbreak_pottery_sherd";
        MinecraftItemTypes2["HeavyCore"] = "minecraft:heavy_core";
        MinecraftItemTypes2["HeavyWeightedPressurePlate"] = "minecraft:heavy_weighted_pressure_plate";
        MinecraftItemTypes2["HoglinSpawnEgg"] = "minecraft:hoglin_spawn_egg";
        MinecraftItemTypes2["HoneyBlock"] = "minecraft:honey_block";
        MinecraftItemTypes2["HoneyBottle"] = "minecraft:honey_bottle";
        MinecraftItemTypes2["Honeycomb"] = "minecraft:honeycomb";
        MinecraftItemTypes2["HoneycombBlock"] = "minecraft:honeycomb_block";
        MinecraftItemTypes2["Hopper"] = "minecraft:hopper";
        MinecraftItemTypes2["HopperMinecart"] = "minecraft:hopper_minecart";
        MinecraftItemTypes2["HornCoral"] = "minecraft:horn_coral";
        MinecraftItemTypes2["HornCoralBlock"] = "minecraft:horn_coral_block";
        MinecraftItemTypes2["HornCoralFan"] = "minecraft:horn_coral_fan";
        MinecraftItemTypes2["HorseSpawnEgg"] = "minecraft:horse_spawn_egg";
        MinecraftItemTypes2["HostArmorTrimSmithingTemplate"] = "minecraft:host_armor_trim_smithing_template";
        MinecraftItemTypes2["HowlPotterySherd"] = "minecraft:howl_pottery_sherd";
        MinecraftItemTypes2["HuskSpawnEgg"] = "minecraft:husk_spawn_egg";
        MinecraftItemTypes2["Ice"] = "minecraft:ice";
        MinecraftItemTypes2["InfestedChiseledStoneBricks"] = "minecraft:infested_chiseled_stone_bricks";
        MinecraftItemTypes2["InfestedCobblestone"] = "minecraft:infested_cobblestone";
        MinecraftItemTypes2["InfestedCrackedStoneBricks"] = "minecraft:infested_cracked_stone_bricks";
        MinecraftItemTypes2["InfestedDeepslate"] = "minecraft:infested_deepslate";
        MinecraftItemTypes2["InfestedMossyStoneBricks"] = "minecraft:infested_mossy_stone_bricks";
        MinecraftItemTypes2["InfestedStone"] = "minecraft:infested_stone";
        MinecraftItemTypes2["InfestedStoneBricks"] = "minecraft:infested_stone_bricks";
        MinecraftItemTypes2["InkSac"] = "minecraft:ink_sac";
        MinecraftItemTypes2["IronAxe"] = "minecraft:iron_axe";
        MinecraftItemTypes2["IronBars"] = "minecraft:iron_bars";
        MinecraftItemTypes2["IronBlock"] = "minecraft:iron_block";
        MinecraftItemTypes2["IronBoots"] = "minecraft:iron_boots";
        MinecraftItemTypes2["IronChestplate"] = "minecraft:iron_chestplate";
        MinecraftItemTypes2["IronDoor"] = "minecraft:iron_door";
        MinecraftItemTypes2["IronGolemSpawnEgg"] = "minecraft:iron_golem_spawn_egg";
        MinecraftItemTypes2["IronHelmet"] = "minecraft:iron_helmet";
        MinecraftItemTypes2["IronHoe"] = "minecraft:iron_hoe";
        MinecraftItemTypes2["IronHorseArmor"] = "minecraft:iron_horse_armor";
        MinecraftItemTypes2["IronIngot"] = "minecraft:iron_ingot";
        MinecraftItemTypes2["IronLeggings"] = "minecraft:iron_leggings";
        MinecraftItemTypes2["IronNugget"] = "minecraft:iron_nugget";
        MinecraftItemTypes2["IronOre"] = "minecraft:iron_ore";
        MinecraftItemTypes2["IronPickaxe"] = "minecraft:iron_pickaxe";
        MinecraftItemTypes2["IronShovel"] = "minecraft:iron_shovel";
        MinecraftItemTypes2["IronSword"] = "minecraft:iron_sword";
        MinecraftItemTypes2["IronTrapdoor"] = "minecraft:iron_trapdoor";
        MinecraftItemTypes2["Jigsaw"] = "minecraft:jigsaw";
        MinecraftItemTypes2["Jukebox"] = "minecraft:jukebox";
        MinecraftItemTypes2["JungleBoat"] = "minecraft:jungle_boat";
        MinecraftItemTypes2["JungleButton"] = "minecraft:jungle_button";
        MinecraftItemTypes2["JungleChestBoat"] = "minecraft:jungle_chest_boat";
        MinecraftItemTypes2["JungleDoor"] = "minecraft:jungle_door";
        MinecraftItemTypes2["JungleFence"] = "minecraft:jungle_fence";
        MinecraftItemTypes2["JungleFenceGate"] = "minecraft:jungle_fence_gate";
        MinecraftItemTypes2["JungleHangingSign"] = "minecraft:jungle_hanging_sign";
        MinecraftItemTypes2["JungleLeaves"] = "minecraft:jungle_leaves";
        MinecraftItemTypes2["JungleLog"] = "minecraft:jungle_log";
        MinecraftItemTypes2["JunglePlanks"] = "minecraft:jungle_planks";
        MinecraftItemTypes2["JunglePressurePlate"] = "minecraft:jungle_pressure_plate";
        MinecraftItemTypes2["JungleSapling"] = "minecraft:jungle_sapling";
        MinecraftItemTypes2["JungleSign"] = "minecraft:jungle_sign";
        MinecraftItemTypes2["JungleSlab"] = "minecraft:jungle_slab";
        MinecraftItemTypes2["JungleStairs"] = "minecraft:jungle_stairs";
        MinecraftItemTypes2["JungleTrapdoor"] = "minecraft:jungle_trapdoor";
        MinecraftItemTypes2["JungleWood"] = "minecraft:jungle_wood";
        MinecraftItemTypes2["Kelp"] = "minecraft:kelp";
        MinecraftItemTypes2["Ladder"] = "minecraft:ladder";
        MinecraftItemTypes2["Lantern"] = "minecraft:lantern";
        MinecraftItemTypes2["LapisBlock"] = "minecraft:lapis_block";
        MinecraftItemTypes2["LapisLazuli"] = "minecraft:lapis_lazuli";
        MinecraftItemTypes2["LapisOre"] = "minecraft:lapis_ore";
        MinecraftItemTypes2["LargeAmethystBud"] = "minecraft:large_amethyst_bud";
        MinecraftItemTypes2["LargeFern"] = "minecraft:large_fern";
        MinecraftItemTypes2["LavaBucket"] = "minecraft:lava_bucket";
        MinecraftItemTypes2["Lead"] = "minecraft:lead";
        MinecraftItemTypes2["Leather"] = "minecraft:leather";
        MinecraftItemTypes2["LeatherBoots"] = "minecraft:leather_boots";
        MinecraftItemTypes2["LeatherChestplate"] = "minecraft:leather_chestplate";
        MinecraftItemTypes2["LeatherHelmet"] = "minecraft:leather_helmet";
        MinecraftItemTypes2["LeatherHorseArmor"] = "minecraft:leather_horse_armor";
        MinecraftItemTypes2["LeatherLeggings"] = "minecraft:leather_leggings";
        MinecraftItemTypes2["Lectern"] = "minecraft:lectern";
        MinecraftItemTypes2["Lever"] = "minecraft:lever";
        MinecraftItemTypes2["LightBlock0"] = "minecraft:light_block_0";
        MinecraftItemTypes2["LightBlock1"] = "minecraft:light_block_1";
        MinecraftItemTypes2["LightBlock10"] = "minecraft:light_block_10";
        MinecraftItemTypes2["LightBlock11"] = "minecraft:light_block_11";
        MinecraftItemTypes2["LightBlock12"] = "minecraft:light_block_12";
        MinecraftItemTypes2["LightBlock13"] = "minecraft:light_block_13";
        MinecraftItemTypes2["LightBlock14"] = "minecraft:light_block_14";
        MinecraftItemTypes2["LightBlock15"] = "minecraft:light_block_15";
        MinecraftItemTypes2["LightBlock2"] = "minecraft:light_block_2";
        MinecraftItemTypes2["LightBlock3"] = "minecraft:light_block_3";
        MinecraftItemTypes2["LightBlock4"] = "minecraft:light_block_4";
        MinecraftItemTypes2["LightBlock5"] = "minecraft:light_block_5";
        MinecraftItemTypes2["LightBlock6"] = "minecraft:light_block_6";
        MinecraftItemTypes2["LightBlock7"] = "minecraft:light_block_7";
        MinecraftItemTypes2["LightBlock8"] = "minecraft:light_block_8";
        MinecraftItemTypes2["LightBlock9"] = "minecraft:light_block_9";
        MinecraftItemTypes2["LightBlueBundle"] = "minecraft:light_blue_bundle";
        MinecraftItemTypes2["LightBlueCandle"] = "minecraft:light_blue_candle";
        MinecraftItemTypes2["LightBlueCarpet"] = "minecraft:light_blue_carpet";
        MinecraftItemTypes2["LightBlueConcrete"] = "minecraft:light_blue_concrete";
        MinecraftItemTypes2["LightBlueConcretePowder"] = "minecraft:light_blue_concrete_powder";
        MinecraftItemTypes2["LightBlueDye"] = "minecraft:light_blue_dye";
        MinecraftItemTypes2["LightBlueGlazedTerracotta"] = "minecraft:light_blue_glazed_terracotta";
        MinecraftItemTypes2["LightBlueShulkerBox"] = "minecraft:light_blue_shulker_box";
        MinecraftItemTypes2["LightBlueStainedGlass"] = "minecraft:light_blue_stained_glass";
        MinecraftItemTypes2["LightBlueStainedGlassPane"] = "minecraft:light_blue_stained_glass_pane";
        MinecraftItemTypes2["LightBlueTerracotta"] = "minecraft:light_blue_terracotta";
        MinecraftItemTypes2["LightBlueWool"] = "minecraft:light_blue_wool";
        MinecraftItemTypes2["LightGrayBundle"] = "minecraft:light_gray_bundle";
        MinecraftItemTypes2["LightGrayCandle"] = "minecraft:light_gray_candle";
        MinecraftItemTypes2["LightGrayCarpet"] = "minecraft:light_gray_carpet";
        MinecraftItemTypes2["LightGrayConcrete"] = "minecraft:light_gray_concrete";
        MinecraftItemTypes2["LightGrayConcretePowder"] = "minecraft:light_gray_concrete_powder";
        MinecraftItemTypes2["LightGrayDye"] = "minecraft:light_gray_dye";
        MinecraftItemTypes2["LightGrayShulkerBox"] = "minecraft:light_gray_shulker_box";
        MinecraftItemTypes2["LightGrayStainedGlass"] = "minecraft:light_gray_stained_glass";
        MinecraftItemTypes2["LightGrayStainedGlassPane"] = "minecraft:light_gray_stained_glass_pane";
        MinecraftItemTypes2["LightGrayTerracotta"] = "minecraft:light_gray_terracotta";
        MinecraftItemTypes2["LightGrayWool"] = "minecraft:light_gray_wool";
        MinecraftItemTypes2["LightWeightedPressurePlate"] = "minecraft:light_weighted_pressure_plate";
        MinecraftItemTypes2["LightningRod"] = "minecraft:lightning_rod";
        MinecraftItemTypes2["Lilac"] = "minecraft:lilac";
        MinecraftItemTypes2["LilyOfTheValley"] = "minecraft:lily_of_the_valley";
        MinecraftItemTypes2["LimeBundle"] = "minecraft:lime_bundle";
        MinecraftItemTypes2["LimeCandle"] = "minecraft:lime_candle";
        MinecraftItemTypes2["LimeCarpet"] = "minecraft:lime_carpet";
        MinecraftItemTypes2["LimeConcrete"] = "minecraft:lime_concrete";
        MinecraftItemTypes2["LimeConcretePowder"] = "minecraft:lime_concrete_powder";
        MinecraftItemTypes2["LimeDye"] = "minecraft:lime_dye";
        MinecraftItemTypes2["LimeGlazedTerracotta"] = "minecraft:lime_glazed_terracotta";
        MinecraftItemTypes2["LimeShulkerBox"] = "minecraft:lime_shulker_box";
        MinecraftItemTypes2["LimeStainedGlass"] = "minecraft:lime_stained_glass";
        MinecraftItemTypes2["LimeStainedGlassPane"] = "minecraft:lime_stained_glass_pane";
        MinecraftItemTypes2["LimeTerracotta"] = "minecraft:lime_terracotta";
        MinecraftItemTypes2["LimeWool"] = "minecraft:lime_wool";
        MinecraftItemTypes2["LingeringPotion"] = "minecraft:lingering_potion";
        MinecraftItemTypes2["LitPumpkin"] = "minecraft:lit_pumpkin";
        MinecraftItemTypes2["LlamaSpawnEgg"] = "minecraft:llama_spawn_egg";
        MinecraftItemTypes2["Lodestone"] = "minecraft:lodestone";
        MinecraftItemTypes2["LodestoneCompass"] = "minecraft:lodestone_compass";
        MinecraftItemTypes2["Loom"] = "minecraft:loom";
        MinecraftItemTypes2["Mace"] = "minecraft:mace";
        MinecraftItemTypes2["MagentaBundle"] = "minecraft:magenta_bundle";
        MinecraftItemTypes2["MagentaCandle"] = "minecraft:magenta_candle";
        MinecraftItemTypes2["MagentaCarpet"] = "minecraft:magenta_carpet";
        MinecraftItemTypes2["MagentaConcrete"] = "minecraft:magenta_concrete";
        MinecraftItemTypes2["MagentaConcretePowder"] = "minecraft:magenta_concrete_powder";
        MinecraftItemTypes2["MagentaDye"] = "minecraft:magenta_dye";
        MinecraftItemTypes2["MagentaGlazedTerracotta"] = "minecraft:magenta_glazed_terracotta";
        MinecraftItemTypes2["MagentaShulkerBox"] = "minecraft:magenta_shulker_box";
        MinecraftItemTypes2["MagentaStainedGlass"] = "minecraft:magenta_stained_glass";
        MinecraftItemTypes2["MagentaStainedGlassPane"] = "minecraft:magenta_stained_glass_pane";
        MinecraftItemTypes2["MagentaTerracotta"] = "minecraft:magenta_terracotta";
        MinecraftItemTypes2["MagentaWool"] = "minecraft:magenta_wool";
        MinecraftItemTypes2["Magma"] = "minecraft:magma";
        MinecraftItemTypes2["MagmaCream"] = "minecraft:magma_cream";
        MinecraftItemTypes2["MagmaCubeSpawnEgg"] = "minecraft:magma_cube_spawn_egg";
        MinecraftItemTypes2["MangroveBoat"] = "minecraft:mangrove_boat";
        MinecraftItemTypes2["MangroveButton"] = "minecraft:mangrove_button";
        MinecraftItemTypes2["MangroveChestBoat"] = "minecraft:mangrove_chest_boat";
        MinecraftItemTypes2["MangroveDoor"] = "minecraft:mangrove_door";
        MinecraftItemTypes2["MangroveFence"] = "minecraft:mangrove_fence";
        MinecraftItemTypes2["MangroveFenceGate"] = "minecraft:mangrove_fence_gate";
        MinecraftItemTypes2["MangroveHangingSign"] = "minecraft:mangrove_hanging_sign";
        MinecraftItemTypes2["MangroveLeaves"] = "minecraft:mangrove_leaves";
        MinecraftItemTypes2["MangroveLog"] = "minecraft:mangrove_log";
        MinecraftItemTypes2["MangrovePlanks"] = "minecraft:mangrove_planks";
        MinecraftItemTypes2["MangrovePressurePlate"] = "minecraft:mangrove_pressure_plate";
        MinecraftItemTypes2["MangrovePropagule"] = "minecraft:mangrove_propagule";
        MinecraftItemTypes2["MangroveRoots"] = "minecraft:mangrove_roots";
        MinecraftItemTypes2["MangroveSign"] = "minecraft:mangrove_sign";
        MinecraftItemTypes2["MangroveSlab"] = "minecraft:mangrove_slab";
        MinecraftItemTypes2["MangroveStairs"] = "minecraft:mangrove_stairs";
        MinecraftItemTypes2["MangroveTrapdoor"] = "minecraft:mangrove_trapdoor";
        MinecraftItemTypes2["MangroveWood"] = "minecraft:mangrove_wood";
        MinecraftItemTypes2["MediumAmethystBud"] = "minecraft:medium_amethyst_bud";
        MinecraftItemTypes2["MelonBlock"] = "minecraft:melon_block";
        MinecraftItemTypes2["MelonSeeds"] = "minecraft:melon_seeds";
        MinecraftItemTypes2["MelonSlice"] = "minecraft:melon_slice";
        MinecraftItemTypes2["MilkBucket"] = "minecraft:milk_bucket";
        MinecraftItemTypes2["Minecart"] = "minecraft:minecart";
        MinecraftItemTypes2["MinerPotterySherd"] = "minecraft:miner_pottery_sherd";
        MinecraftItemTypes2["MobSpawner"] = "minecraft:mob_spawner";
        MinecraftItemTypes2["MojangBannerPattern"] = "minecraft:mojang_banner_pattern";
        MinecraftItemTypes2["MooshroomSpawnEgg"] = "minecraft:mooshroom_spawn_egg";
        MinecraftItemTypes2["MossBlock"] = "minecraft:moss_block";
        MinecraftItemTypes2["MossCarpet"] = "minecraft:moss_carpet";
        MinecraftItemTypes2["MossyCobblestone"] = "minecraft:mossy_cobblestone";
        MinecraftItemTypes2["MossyCobblestoneSlab"] = "minecraft:mossy_cobblestone_slab";
        MinecraftItemTypes2["MossyCobblestoneStairs"] = "minecraft:mossy_cobblestone_stairs";
        MinecraftItemTypes2["MossyCobblestoneWall"] = "minecraft:mossy_cobblestone_wall";
        MinecraftItemTypes2["MossyStoneBrickSlab"] = "minecraft:mossy_stone_brick_slab";
        MinecraftItemTypes2["MossyStoneBrickStairs"] = "minecraft:mossy_stone_brick_stairs";
        MinecraftItemTypes2["MossyStoneBrickWall"] = "minecraft:mossy_stone_brick_wall";
        MinecraftItemTypes2["MossyStoneBricks"] = "minecraft:mossy_stone_bricks";
        MinecraftItemTypes2["MournerPotterySherd"] = "minecraft:mourner_pottery_sherd";
        MinecraftItemTypes2["Mud"] = "minecraft:mud";
        MinecraftItemTypes2["MudBrickSlab"] = "minecraft:mud_brick_slab";
        MinecraftItemTypes2["MudBrickStairs"] = "minecraft:mud_brick_stairs";
        MinecraftItemTypes2["MudBrickWall"] = "minecraft:mud_brick_wall";
        MinecraftItemTypes2["MudBricks"] = "minecraft:mud_bricks";
        MinecraftItemTypes2["MuddyMangroveRoots"] = "minecraft:muddy_mangrove_roots";
        MinecraftItemTypes2["MuleSpawnEgg"] = "minecraft:mule_spawn_egg";
        MinecraftItemTypes2["MushroomStem"] = "minecraft:mushroom_stem";
        MinecraftItemTypes2["MushroomStew"] = "minecraft:mushroom_stew";
        MinecraftItemTypes2["MusicDisc11"] = "minecraft:music_disc_11";
        MinecraftItemTypes2["MusicDisc13"] = "minecraft:music_disc_13";
        MinecraftItemTypes2["MusicDisc5"] = "minecraft:music_disc_5";
        MinecraftItemTypes2["MusicDiscBlocks"] = "minecraft:music_disc_blocks";
        MinecraftItemTypes2["MusicDiscCat"] = "minecraft:music_disc_cat";
        MinecraftItemTypes2["MusicDiscChirp"] = "minecraft:music_disc_chirp";
        MinecraftItemTypes2["MusicDiscCreator"] = "minecraft:music_disc_creator";
        MinecraftItemTypes2["MusicDiscCreatorMusicBox"] = "minecraft:music_disc_creator_music_box";
        MinecraftItemTypes2["MusicDiscFar"] = "minecraft:music_disc_far";
        MinecraftItemTypes2["MusicDiscMall"] = "minecraft:music_disc_mall";
        MinecraftItemTypes2["MusicDiscMellohi"] = "minecraft:music_disc_mellohi";
        MinecraftItemTypes2["MusicDiscOtherside"] = "minecraft:music_disc_otherside";
        MinecraftItemTypes2["MusicDiscPigstep"] = "minecraft:music_disc_pigstep";
        MinecraftItemTypes2["MusicDiscPrecipice"] = "minecraft:music_disc_precipice";
        MinecraftItemTypes2["MusicDiscRelic"] = "minecraft:music_disc_relic";
        MinecraftItemTypes2["MusicDiscStal"] = "minecraft:music_disc_stal";
        MinecraftItemTypes2["MusicDiscStrad"] = "minecraft:music_disc_strad";
        MinecraftItemTypes2["MusicDiscWait"] = "minecraft:music_disc_wait";
        MinecraftItemTypes2["MusicDiscWard"] = "minecraft:music_disc_ward";
        MinecraftItemTypes2["Mutton"] = "minecraft:mutton";
        MinecraftItemTypes2["Mycelium"] = "minecraft:mycelium";
        MinecraftItemTypes2["NameTag"] = "minecraft:name_tag";
        MinecraftItemTypes2["NautilusShell"] = "minecraft:nautilus_shell";
        MinecraftItemTypes2["NetherBrick"] = "minecraft:nether_brick";
        MinecraftItemTypes2["NetherBrickFence"] = "minecraft:nether_brick_fence";
        MinecraftItemTypes2["NetherBrickSlab"] = "minecraft:nether_brick_slab";
        MinecraftItemTypes2["NetherBrickStairs"] = "minecraft:nether_brick_stairs";
        MinecraftItemTypes2["NetherBrickWall"] = "minecraft:nether_brick_wall";
        MinecraftItemTypes2["NetherGoldOre"] = "minecraft:nether_gold_ore";
        MinecraftItemTypes2["NetherSprouts"] = "minecraft:nether_sprouts";
        MinecraftItemTypes2["NetherStar"] = "minecraft:nether_star";
        MinecraftItemTypes2["NetherWart"] = "minecraft:nether_wart";
        MinecraftItemTypes2["NetherWartBlock"] = "minecraft:nether_wart_block";
        MinecraftItemTypes2["Netherbrick"] = "minecraft:netherbrick";
        MinecraftItemTypes2["NetheriteAxe"] = "minecraft:netherite_axe";
        MinecraftItemTypes2["NetheriteBlock"] = "minecraft:netherite_block";
        MinecraftItemTypes2["NetheriteBoots"] = "minecraft:netherite_boots";
        MinecraftItemTypes2["NetheriteChestplate"] = "minecraft:netherite_chestplate";
        MinecraftItemTypes2["NetheriteHelmet"] = "minecraft:netherite_helmet";
        MinecraftItemTypes2["NetheriteHoe"] = "minecraft:netherite_hoe";
        MinecraftItemTypes2["NetheriteIngot"] = "minecraft:netherite_ingot";
        MinecraftItemTypes2["NetheriteLeggings"] = "minecraft:netherite_leggings";
        MinecraftItemTypes2["NetheritePickaxe"] = "minecraft:netherite_pickaxe";
        MinecraftItemTypes2["NetheriteScrap"] = "minecraft:netherite_scrap";
        MinecraftItemTypes2["NetheriteShovel"] = "minecraft:netherite_shovel";
        MinecraftItemTypes2["NetheriteSword"] = "minecraft:netherite_sword";
        MinecraftItemTypes2["NetheriteUpgradeSmithingTemplate"] = "minecraft:netherite_upgrade_smithing_template";
        MinecraftItemTypes2["Netherrack"] = "minecraft:netherrack";
        MinecraftItemTypes2["NormalStoneSlab"] = "minecraft:normal_stone_slab";
        MinecraftItemTypes2["NormalStoneStairs"] = "minecraft:normal_stone_stairs";
        MinecraftItemTypes2["Noteblock"] = "minecraft:noteblock";
        MinecraftItemTypes2["OakBoat"] = "minecraft:oak_boat";
        MinecraftItemTypes2["OakChestBoat"] = "minecraft:oak_chest_boat";
        MinecraftItemTypes2["OakFence"] = "minecraft:oak_fence";
        MinecraftItemTypes2["OakHangingSign"] = "minecraft:oak_hanging_sign";
        MinecraftItemTypes2["OakLeaves"] = "minecraft:oak_leaves";
        MinecraftItemTypes2["OakLog"] = "minecraft:oak_log";
        MinecraftItemTypes2["OakPlanks"] = "minecraft:oak_planks";
        MinecraftItemTypes2["OakSapling"] = "minecraft:oak_sapling";
        MinecraftItemTypes2["OakSign"] = "minecraft:oak_sign";
        MinecraftItemTypes2["OakSlab"] = "minecraft:oak_slab";
        MinecraftItemTypes2["OakStairs"] = "minecraft:oak_stairs";
        MinecraftItemTypes2["OakWood"] = "minecraft:oak_wood";
        MinecraftItemTypes2["Observer"] = "minecraft:observer";
        MinecraftItemTypes2["Obsidian"] = "minecraft:obsidian";
        MinecraftItemTypes2["OcelotSpawnEgg"] = "minecraft:ocelot_spawn_egg";
        MinecraftItemTypes2["OchreFroglight"] = "minecraft:ochre_froglight";
        MinecraftItemTypes2["OminousBottle"] = "minecraft:ominous_bottle";
        MinecraftItemTypes2["OminousTrialKey"] = "minecraft:ominous_trial_key";
        MinecraftItemTypes2["OpenEyeblossom"] = "minecraft:open_eyeblossom";
        MinecraftItemTypes2["OrangeBundle"] = "minecraft:orange_bundle";
        MinecraftItemTypes2["OrangeCandle"] = "minecraft:orange_candle";
        MinecraftItemTypes2["OrangeCarpet"] = "minecraft:orange_carpet";
        MinecraftItemTypes2["OrangeConcrete"] = "minecraft:orange_concrete";
        MinecraftItemTypes2["OrangeConcretePowder"] = "minecraft:orange_concrete_powder";
        MinecraftItemTypes2["OrangeDye"] = "minecraft:orange_dye";
        MinecraftItemTypes2["OrangeGlazedTerracotta"] = "minecraft:orange_glazed_terracotta";
        MinecraftItemTypes2["OrangeShulkerBox"] = "minecraft:orange_shulker_box";
        MinecraftItemTypes2["OrangeStainedGlass"] = "minecraft:orange_stained_glass";
        MinecraftItemTypes2["OrangeStainedGlassPane"] = "minecraft:orange_stained_glass_pane";
        MinecraftItemTypes2["OrangeTerracotta"] = "minecraft:orange_terracotta";
        MinecraftItemTypes2["OrangeTulip"] = "minecraft:orange_tulip";
        MinecraftItemTypes2["OrangeWool"] = "minecraft:orange_wool";
        MinecraftItemTypes2["OxeyeDaisy"] = "minecraft:oxeye_daisy";
        MinecraftItemTypes2["OxidizedChiseledCopper"] = "minecraft:oxidized_chiseled_copper";
        MinecraftItemTypes2["OxidizedCopper"] = "minecraft:oxidized_copper";
        MinecraftItemTypes2["OxidizedCopperBulb"] = "minecraft:oxidized_copper_bulb";
        MinecraftItemTypes2["OxidizedCopperDoor"] = "minecraft:oxidized_copper_door";
        MinecraftItemTypes2["OxidizedCopperGrate"] = "minecraft:oxidized_copper_grate";
        MinecraftItemTypes2["OxidizedCopperTrapdoor"] = "minecraft:oxidized_copper_trapdoor";
        MinecraftItemTypes2["OxidizedCutCopper"] = "minecraft:oxidized_cut_copper";
        MinecraftItemTypes2["OxidizedCutCopperSlab"] = "minecraft:oxidized_cut_copper_slab";
        MinecraftItemTypes2["OxidizedCutCopperStairs"] = "minecraft:oxidized_cut_copper_stairs";
        MinecraftItemTypes2["PackedIce"] = "minecraft:packed_ice";
        MinecraftItemTypes2["PackedMud"] = "minecraft:packed_mud";
        MinecraftItemTypes2["Painting"] = "minecraft:painting";
        MinecraftItemTypes2["PaleHangingMoss"] = "minecraft:pale_hanging_moss";
        MinecraftItemTypes2["PaleMossBlock"] = "minecraft:pale_moss_block";
        MinecraftItemTypes2["PaleMossCarpet"] = "minecraft:pale_moss_carpet";
        MinecraftItemTypes2["PaleOakBoat"] = "minecraft:pale_oak_boat";
        MinecraftItemTypes2["PaleOakButton"] = "minecraft:pale_oak_button";
        MinecraftItemTypes2["PaleOakChestBoat"] = "minecraft:pale_oak_chest_boat";
        MinecraftItemTypes2["PaleOakDoor"] = "minecraft:pale_oak_door";
        MinecraftItemTypes2["PaleOakFence"] = "minecraft:pale_oak_fence";
        MinecraftItemTypes2["PaleOakFenceGate"] = "minecraft:pale_oak_fence_gate";
        MinecraftItemTypes2["PaleOakHangingSign"] = "minecraft:pale_oak_hanging_sign";
        MinecraftItemTypes2["PaleOakLeaves"] = "minecraft:pale_oak_leaves";
        MinecraftItemTypes2["PaleOakLog"] = "minecraft:pale_oak_log";
        MinecraftItemTypes2["PaleOakPlanks"] = "minecraft:pale_oak_planks";
        MinecraftItemTypes2["PaleOakPressurePlate"] = "minecraft:pale_oak_pressure_plate";
        MinecraftItemTypes2["PaleOakSapling"] = "minecraft:pale_oak_sapling";
        MinecraftItemTypes2["PaleOakSign"] = "minecraft:pale_oak_sign";
        MinecraftItemTypes2["PaleOakSlab"] = "minecraft:pale_oak_slab";
        MinecraftItemTypes2["PaleOakStairs"] = "minecraft:pale_oak_stairs";
        MinecraftItemTypes2["PaleOakTrapdoor"] = "minecraft:pale_oak_trapdoor";
        MinecraftItemTypes2["PaleOakWood"] = "minecraft:pale_oak_wood";
        MinecraftItemTypes2["PandaSpawnEgg"] = "minecraft:panda_spawn_egg";
        MinecraftItemTypes2["Paper"] = "minecraft:paper";
        MinecraftItemTypes2["ParrotSpawnEgg"] = "minecraft:parrot_spawn_egg";
        MinecraftItemTypes2["PearlescentFroglight"] = "minecraft:pearlescent_froglight";
        MinecraftItemTypes2["Peony"] = "minecraft:peony";
        MinecraftItemTypes2["PetrifiedOakSlab"] = "minecraft:petrified_oak_slab";
        MinecraftItemTypes2["PhantomMembrane"] = "minecraft:phantom_membrane";
        MinecraftItemTypes2["PhantomSpawnEgg"] = "minecraft:phantom_spawn_egg";
        MinecraftItemTypes2["PigSpawnEgg"] = "minecraft:pig_spawn_egg";
        MinecraftItemTypes2["PiglinBannerPattern"] = "minecraft:piglin_banner_pattern";
        MinecraftItemTypes2["PiglinBruteSpawnEgg"] = "minecraft:piglin_brute_spawn_egg";
        MinecraftItemTypes2["PiglinHead"] = "minecraft:piglin_head";
        MinecraftItemTypes2["PiglinSpawnEgg"] = "minecraft:piglin_spawn_egg";
        MinecraftItemTypes2["PillagerSpawnEgg"] = "minecraft:pillager_spawn_egg";
        MinecraftItemTypes2["PinkBundle"] = "minecraft:pink_bundle";
        MinecraftItemTypes2["PinkCandle"] = "minecraft:pink_candle";
        MinecraftItemTypes2["PinkCarpet"] = "minecraft:pink_carpet";
        MinecraftItemTypes2["PinkConcrete"] = "minecraft:pink_concrete";
        MinecraftItemTypes2["PinkConcretePowder"] = "minecraft:pink_concrete_powder";
        MinecraftItemTypes2["PinkDye"] = "minecraft:pink_dye";
        MinecraftItemTypes2["PinkGlazedTerracotta"] = "minecraft:pink_glazed_terracotta";
        MinecraftItemTypes2["PinkPetals"] = "minecraft:pink_petals";
        MinecraftItemTypes2["PinkShulkerBox"] = "minecraft:pink_shulker_box";
        MinecraftItemTypes2["PinkStainedGlass"] = "minecraft:pink_stained_glass";
        MinecraftItemTypes2["PinkStainedGlassPane"] = "minecraft:pink_stained_glass_pane";
        MinecraftItemTypes2["PinkTerracotta"] = "minecraft:pink_terracotta";
        MinecraftItemTypes2["PinkTulip"] = "minecraft:pink_tulip";
        MinecraftItemTypes2["PinkWool"] = "minecraft:pink_wool";
        MinecraftItemTypes2["Piston"] = "minecraft:piston";
        MinecraftItemTypes2["PitcherPlant"] = "minecraft:pitcher_plant";
        MinecraftItemTypes2["PitcherPod"] = "minecraft:pitcher_pod";
        MinecraftItemTypes2["PlayerHead"] = "minecraft:player_head";
        MinecraftItemTypes2["PlentyPotterySherd"] = "minecraft:plenty_pottery_sherd";
        MinecraftItemTypes2["Podzol"] = "minecraft:podzol";
        MinecraftItemTypes2["PointedDripstone"] = "minecraft:pointed_dripstone";
        MinecraftItemTypes2["PoisonousPotato"] = "minecraft:poisonous_potato";
        MinecraftItemTypes2["PolarBearSpawnEgg"] = "minecraft:polar_bear_spawn_egg";
        MinecraftItemTypes2["PolishedAndesite"] = "minecraft:polished_andesite";
        MinecraftItemTypes2["PolishedAndesiteSlab"] = "minecraft:polished_andesite_slab";
        MinecraftItemTypes2["PolishedAndesiteStairs"] = "minecraft:polished_andesite_stairs";
        MinecraftItemTypes2["PolishedBasalt"] = "minecraft:polished_basalt";
        MinecraftItemTypes2["PolishedBlackstone"] = "minecraft:polished_blackstone";
        MinecraftItemTypes2["PolishedBlackstoneBrickSlab"] = "minecraft:polished_blackstone_brick_slab";
        MinecraftItemTypes2["PolishedBlackstoneBrickStairs"] = "minecraft:polished_blackstone_brick_stairs";
        MinecraftItemTypes2["PolishedBlackstoneBrickWall"] = "minecraft:polished_blackstone_brick_wall";
        MinecraftItemTypes2["PolishedBlackstoneBricks"] = "minecraft:polished_blackstone_bricks";
        MinecraftItemTypes2["PolishedBlackstoneButton"] = "minecraft:polished_blackstone_button";
        MinecraftItemTypes2["PolishedBlackstonePressurePlate"] = "minecraft:polished_blackstone_pressure_plate";
        MinecraftItemTypes2["PolishedBlackstoneSlab"] = "minecraft:polished_blackstone_slab";
        MinecraftItemTypes2["PolishedBlackstoneStairs"] = "minecraft:polished_blackstone_stairs";
        MinecraftItemTypes2["PolishedBlackstoneWall"] = "minecraft:polished_blackstone_wall";
        MinecraftItemTypes2["PolishedDeepslate"] = "minecraft:polished_deepslate";
        MinecraftItemTypes2["PolishedDeepslateSlab"] = "minecraft:polished_deepslate_slab";
        MinecraftItemTypes2["PolishedDeepslateStairs"] = "minecraft:polished_deepslate_stairs";
        MinecraftItemTypes2["PolishedDeepslateWall"] = "minecraft:polished_deepslate_wall";
        MinecraftItemTypes2["PolishedDiorite"] = "minecraft:polished_diorite";
        MinecraftItemTypes2["PolishedDioriteSlab"] = "minecraft:polished_diorite_slab";
        MinecraftItemTypes2["PolishedDioriteStairs"] = "minecraft:polished_diorite_stairs";
        MinecraftItemTypes2["PolishedGranite"] = "minecraft:polished_granite";
        MinecraftItemTypes2["PolishedGraniteSlab"] = "minecraft:polished_granite_slab";
        MinecraftItemTypes2["PolishedGraniteStairs"] = "minecraft:polished_granite_stairs";
        MinecraftItemTypes2["PolishedTuff"] = "minecraft:polished_tuff";
        MinecraftItemTypes2["PolishedTuffSlab"] = "minecraft:polished_tuff_slab";
        MinecraftItemTypes2["PolishedTuffStairs"] = "minecraft:polished_tuff_stairs";
        MinecraftItemTypes2["PolishedTuffWall"] = "minecraft:polished_tuff_wall";
        MinecraftItemTypes2["PoppedChorusFruit"] = "minecraft:popped_chorus_fruit";
        MinecraftItemTypes2["Poppy"] = "minecraft:poppy";
        MinecraftItemTypes2["Porkchop"] = "minecraft:porkchop";
        MinecraftItemTypes2["Potato"] = "minecraft:potato";
        MinecraftItemTypes2["Potion"] = "minecraft:potion";
        MinecraftItemTypes2["PowderSnowBucket"] = "minecraft:powder_snow_bucket";
        MinecraftItemTypes2["Prismarine"] = "minecraft:prismarine";
        MinecraftItemTypes2["PrismarineBrickSlab"] = "minecraft:prismarine_brick_slab";
        MinecraftItemTypes2["PrismarineBricks"] = "minecraft:prismarine_bricks";
        MinecraftItemTypes2["PrismarineBricksStairs"] = "minecraft:prismarine_bricks_stairs";
        MinecraftItemTypes2["PrismarineCrystals"] = "minecraft:prismarine_crystals";
        MinecraftItemTypes2["PrismarineShard"] = "minecraft:prismarine_shard";
        MinecraftItemTypes2["PrismarineSlab"] = "minecraft:prismarine_slab";
        MinecraftItemTypes2["PrismarineStairs"] = "minecraft:prismarine_stairs";
        MinecraftItemTypes2["PrismarineWall"] = "minecraft:prismarine_wall";
        MinecraftItemTypes2["PrizePotterySherd"] = "minecraft:prize_pottery_sherd";
        MinecraftItemTypes2["Pufferfish"] = "minecraft:pufferfish";
        MinecraftItemTypes2["PufferfishBucket"] = "minecraft:pufferfish_bucket";
        MinecraftItemTypes2["PufferfishSpawnEgg"] = "minecraft:pufferfish_spawn_egg";
        MinecraftItemTypes2["Pumpkin"] = "minecraft:pumpkin";
        MinecraftItemTypes2["PumpkinPie"] = "minecraft:pumpkin_pie";
        MinecraftItemTypes2["PumpkinSeeds"] = "minecraft:pumpkin_seeds";
        MinecraftItemTypes2["PurpleBundle"] = "minecraft:purple_bundle";
        MinecraftItemTypes2["PurpleCandle"] = "minecraft:purple_candle";
        MinecraftItemTypes2["PurpleCarpet"] = "minecraft:purple_carpet";
        MinecraftItemTypes2["PurpleConcrete"] = "minecraft:purple_concrete";
        MinecraftItemTypes2["PurpleConcretePowder"] = "minecraft:purple_concrete_powder";
        MinecraftItemTypes2["PurpleDye"] = "minecraft:purple_dye";
        MinecraftItemTypes2["PurpleGlazedTerracotta"] = "minecraft:purple_glazed_terracotta";
        MinecraftItemTypes2["PurpleShulkerBox"] = "minecraft:purple_shulker_box";
        MinecraftItemTypes2["PurpleStainedGlass"] = "minecraft:purple_stained_glass";
        MinecraftItemTypes2["PurpleStainedGlassPane"] = "minecraft:purple_stained_glass_pane";
        MinecraftItemTypes2["PurpleTerracotta"] = "minecraft:purple_terracotta";
        MinecraftItemTypes2["PurpleWool"] = "minecraft:purple_wool";
        MinecraftItemTypes2["PurpurBlock"] = "minecraft:purpur_block";
        MinecraftItemTypes2["PurpurPillar"] = "minecraft:purpur_pillar";
        MinecraftItemTypes2["PurpurSlab"] = "minecraft:purpur_slab";
        MinecraftItemTypes2["PurpurStairs"] = "minecraft:purpur_stairs";
        MinecraftItemTypes2["Quartz"] = "minecraft:quartz";
        MinecraftItemTypes2["QuartzBlock"] = "minecraft:quartz_block";
        MinecraftItemTypes2["QuartzBricks"] = "minecraft:quartz_bricks";
        MinecraftItemTypes2["QuartzOre"] = "minecraft:quartz_ore";
        MinecraftItemTypes2["QuartzPillar"] = "minecraft:quartz_pillar";
        MinecraftItemTypes2["QuartzSlab"] = "minecraft:quartz_slab";
        MinecraftItemTypes2["QuartzStairs"] = "minecraft:quartz_stairs";
        MinecraftItemTypes2["Rabbit"] = "minecraft:rabbit";
        MinecraftItemTypes2["RabbitFoot"] = "minecraft:rabbit_foot";
        MinecraftItemTypes2["RabbitHide"] = "minecraft:rabbit_hide";
        MinecraftItemTypes2["RabbitSpawnEgg"] = "minecraft:rabbit_spawn_egg";
        MinecraftItemTypes2["RabbitStew"] = "minecraft:rabbit_stew";
        MinecraftItemTypes2["Rail"] = "minecraft:rail";
        MinecraftItemTypes2["RaiserArmorTrimSmithingTemplate"] = "minecraft:raiser_armor_trim_smithing_template";
        MinecraftItemTypes2["RavagerSpawnEgg"] = "minecraft:ravager_spawn_egg";
        MinecraftItemTypes2["RawCopper"] = "minecraft:raw_copper";
        MinecraftItemTypes2["RawCopperBlock"] = "minecraft:raw_copper_block";
        MinecraftItemTypes2["RawGold"] = "minecraft:raw_gold";
        MinecraftItemTypes2["RawGoldBlock"] = "minecraft:raw_gold_block";
        MinecraftItemTypes2["RawIron"] = "minecraft:raw_iron";
        MinecraftItemTypes2["RawIronBlock"] = "minecraft:raw_iron_block";
        MinecraftItemTypes2["RecoveryCompass"] = "minecraft:recovery_compass";
        MinecraftItemTypes2["RedBundle"] = "minecraft:red_bundle";
        MinecraftItemTypes2["RedCandle"] = "minecraft:red_candle";
        MinecraftItemTypes2["RedCarpet"] = "minecraft:red_carpet";
        MinecraftItemTypes2["RedConcrete"] = "minecraft:red_concrete";
        MinecraftItemTypes2["RedConcretePowder"] = "minecraft:red_concrete_powder";
        MinecraftItemTypes2["RedDye"] = "minecraft:red_dye";
        MinecraftItemTypes2["RedGlazedTerracotta"] = "minecraft:red_glazed_terracotta";
        MinecraftItemTypes2["RedMushroom"] = "minecraft:red_mushroom";
        MinecraftItemTypes2["RedMushroomBlock"] = "minecraft:red_mushroom_block";
        MinecraftItemTypes2["RedNetherBrick"] = "minecraft:red_nether_brick";
        MinecraftItemTypes2["RedNetherBrickSlab"] = "minecraft:red_nether_brick_slab";
        MinecraftItemTypes2["RedNetherBrickStairs"] = "minecraft:red_nether_brick_stairs";
        MinecraftItemTypes2["RedNetherBrickWall"] = "minecraft:red_nether_brick_wall";
        MinecraftItemTypes2["RedSand"] = "minecraft:red_sand";
        MinecraftItemTypes2["RedSandstone"] = "minecraft:red_sandstone";
        MinecraftItemTypes2["RedSandstoneSlab"] = "minecraft:red_sandstone_slab";
        MinecraftItemTypes2["RedSandstoneStairs"] = "minecraft:red_sandstone_stairs";
        MinecraftItemTypes2["RedSandstoneWall"] = "minecraft:red_sandstone_wall";
        MinecraftItemTypes2["RedShulkerBox"] = "minecraft:red_shulker_box";
        MinecraftItemTypes2["RedStainedGlass"] = "minecraft:red_stained_glass";
        MinecraftItemTypes2["RedStainedGlassPane"] = "minecraft:red_stained_glass_pane";
        MinecraftItemTypes2["RedTerracotta"] = "minecraft:red_terracotta";
        MinecraftItemTypes2["RedTulip"] = "minecraft:red_tulip";
        MinecraftItemTypes2["RedWool"] = "minecraft:red_wool";
        MinecraftItemTypes2["Redstone"] = "minecraft:redstone";
        MinecraftItemTypes2["RedstoneBlock"] = "minecraft:redstone_block";
        MinecraftItemTypes2["RedstoneLamp"] = "minecraft:redstone_lamp";
        MinecraftItemTypes2["RedstoneOre"] = "minecraft:redstone_ore";
        MinecraftItemTypes2["RedstoneTorch"] = "minecraft:redstone_torch";
        MinecraftItemTypes2["ReinforcedDeepslate"] = "minecraft:reinforced_deepslate";
        MinecraftItemTypes2["Repeater"] = "minecraft:repeater";
        MinecraftItemTypes2["RepeatingCommandBlock"] = "minecraft:repeating_command_block";
        MinecraftItemTypes2["ResinBlock"] = "minecraft:resin_block";
        MinecraftItemTypes2["ResinBrick"] = "minecraft:resin_brick";
        MinecraftItemTypes2["ResinBrickSlab"] = "minecraft:resin_brick_slab";
        MinecraftItemTypes2["ResinBrickStairs"] = "minecraft:resin_brick_stairs";
        MinecraftItemTypes2["ResinBrickWall"] = "minecraft:resin_brick_wall";
        MinecraftItemTypes2["ResinBricks"] = "minecraft:resin_bricks";
        MinecraftItemTypes2["ResinClump"] = "minecraft:resin_clump";
        MinecraftItemTypes2["RespawnAnchor"] = "minecraft:respawn_anchor";
        MinecraftItemTypes2["RibArmorTrimSmithingTemplate"] = "minecraft:rib_armor_trim_smithing_template";
        MinecraftItemTypes2["RoseBush"] = "minecraft:rose_bush";
        MinecraftItemTypes2["RottenFlesh"] = "minecraft:rotten_flesh";
        MinecraftItemTypes2["Saddle"] = "minecraft:saddle";
        MinecraftItemTypes2["Salmon"] = "minecraft:salmon";
        MinecraftItemTypes2["SalmonBucket"] = "minecraft:salmon_bucket";
        MinecraftItemTypes2["SalmonSpawnEgg"] = "minecraft:salmon_spawn_egg";
        MinecraftItemTypes2["Sand"] = "minecraft:sand";
        MinecraftItemTypes2["Sandstone"] = "minecraft:sandstone";
        MinecraftItemTypes2["SandstoneSlab"] = "minecraft:sandstone_slab";
        MinecraftItemTypes2["SandstoneStairs"] = "minecraft:sandstone_stairs";
        MinecraftItemTypes2["SandstoneWall"] = "minecraft:sandstone_wall";
        MinecraftItemTypes2["Scaffolding"] = "minecraft:scaffolding";
        MinecraftItemTypes2["ScrapePotterySherd"] = "minecraft:scrape_pottery_sherd";
        MinecraftItemTypes2["Sculk"] = "minecraft:sculk";
        MinecraftItemTypes2["SculkCatalyst"] = "minecraft:sculk_catalyst";
        MinecraftItemTypes2["SculkSensor"] = "minecraft:sculk_sensor";
        MinecraftItemTypes2["SculkShrieker"] = "minecraft:sculk_shrieker";
        MinecraftItemTypes2["SculkVein"] = "minecraft:sculk_vein";
        MinecraftItemTypes2["SeaLantern"] = "minecraft:sea_lantern";
        MinecraftItemTypes2["SeaPickle"] = "minecraft:sea_pickle";
        MinecraftItemTypes2["Seagrass"] = "minecraft:seagrass";
        MinecraftItemTypes2["SentryArmorTrimSmithingTemplate"] = "minecraft:sentry_armor_trim_smithing_template";
        MinecraftItemTypes2["ShaperArmorTrimSmithingTemplate"] = "minecraft:shaper_armor_trim_smithing_template";
        MinecraftItemTypes2["SheafPotterySherd"] = "minecraft:sheaf_pottery_sherd";
        MinecraftItemTypes2["Shears"] = "minecraft:shears";
        MinecraftItemTypes2["SheepSpawnEgg"] = "minecraft:sheep_spawn_egg";
        MinecraftItemTypes2["ShelterPotterySherd"] = "minecraft:shelter_pottery_sherd";
        MinecraftItemTypes2["Shield"] = "minecraft:shield";
        MinecraftItemTypes2["ShortGrass"] = "minecraft:short_grass";
        MinecraftItemTypes2["Shroomlight"] = "minecraft:shroomlight";
        MinecraftItemTypes2["ShulkerShell"] = "minecraft:shulker_shell";
        MinecraftItemTypes2["ShulkerSpawnEgg"] = "minecraft:shulker_spawn_egg";
        MinecraftItemTypes2["SilenceArmorTrimSmithingTemplate"] = "minecraft:silence_armor_trim_smithing_template";
        MinecraftItemTypes2["SilverGlazedTerracotta"] = "minecraft:silver_glazed_terracotta";
        MinecraftItemTypes2["SilverfishSpawnEgg"] = "minecraft:silverfish_spawn_egg";
        MinecraftItemTypes2["SkeletonHorseSpawnEgg"] = "minecraft:skeleton_horse_spawn_egg";
        MinecraftItemTypes2["SkeletonSkull"] = "minecraft:skeleton_skull";
        MinecraftItemTypes2["SkeletonSpawnEgg"] = "minecraft:skeleton_spawn_egg";
        MinecraftItemTypes2["SkullBannerPattern"] = "minecraft:skull_banner_pattern";
        MinecraftItemTypes2["SkullPotterySherd"] = "minecraft:skull_pottery_sherd";
        MinecraftItemTypes2["Slime"] = "minecraft:slime";
        MinecraftItemTypes2["SlimeBall"] = "minecraft:slime_ball";
        MinecraftItemTypes2["SlimeSpawnEgg"] = "minecraft:slime_spawn_egg";
        MinecraftItemTypes2["SmallAmethystBud"] = "minecraft:small_amethyst_bud";
        MinecraftItemTypes2["SmallDripleafBlock"] = "minecraft:small_dripleaf_block";
        MinecraftItemTypes2["SmithingTable"] = "minecraft:smithing_table";
        MinecraftItemTypes2["Smoker"] = "minecraft:smoker";
        MinecraftItemTypes2["SmoothBasalt"] = "minecraft:smooth_basalt";
        MinecraftItemTypes2["SmoothQuartz"] = "minecraft:smooth_quartz";
        MinecraftItemTypes2["SmoothQuartzSlab"] = "minecraft:smooth_quartz_slab";
        MinecraftItemTypes2["SmoothQuartzStairs"] = "minecraft:smooth_quartz_stairs";
        MinecraftItemTypes2["SmoothRedSandstone"] = "minecraft:smooth_red_sandstone";
        MinecraftItemTypes2["SmoothRedSandstoneSlab"] = "minecraft:smooth_red_sandstone_slab";
        MinecraftItemTypes2["SmoothRedSandstoneStairs"] = "minecraft:smooth_red_sandstone_stairs";
        MinecraftItemTypes2["SmoothSandstone"] = "minecraft:smooth_sandstone";
        MinecraftItemTypes2["SmoothSandstoneSlab"] = "minecraft:smooth_sandstone_slab";
        MinecraftItemTypes2["SmoothSandstoneStairs"] = "minecraft:smooth_sandstone_stairs";
        MinecraftItemTypes2["SmoothStone"] = "minecraft:smooth_stone";
        MinecraftItemTypes2["SmoothStoneSlab"] = "minecraft:smooth_stone_slab";
        MinecraftItemTypes2["SnifferEgg"] = "minecraft:sniffer_egg";
        MinecraftItemTypes2["SnifferSpawnEgg"] = "minecraft:sniffer_spawn_egg";
        MinecraftItemTypes2["SnortPotterySherd"] = "minecraft:snort_pottery_sherd";
        MinecraftItemTypes2["SnoutArmorTrimSmithingTemplate"] = "minecraft:snout_armor_trim_smithing_template";
        MinecraftItemTypes2["Snow"] = "minecraft:snow";
        MinecraftItemTypes2["SnowGolemSpawnEgg"] = "minecraft:snow_golem_spawn_egg";
        MinecraftItemTypes2["SnowLayer"] = "minecraft:snow_layer";
        MinecraftItemTypes2["Snowball"] = "minecraft:snowball";
        MinecraftItemTypes2["SoulCampfire"] = "minecraft:soul_campfire";
        MinecraftItemTypes2["SoulLantern"] = "minecraft:soul_lantern";
        MinecraftItemTypes2["SoulSand"] = "minecraft:soul_sand";
        MinecraftItemTypes2["SoulSoil"] = "minecraft:soul_soil";
        MinecraftItemTypes2["SoulTorch"] = "minecraft:soul_torch";
        MinecraftItemTypes2["SpiderEye"] = "minecraft:spider_eye";
        MinecraftItemTypes2["SpiderSpawnEgg"] = "minecraft:spider_spawn_egg";
        MinecraftItemTypes2["SpireArmorTrimSmithingTemplate"] = "minecraft:spire_armor_trim_smithing_template";
        MinecraftItemTypes2["SplashPotion"] = "minecraft:splash_potion";
        MinecraftItemTypes2["Sponge"] = "minecraft:sponge";
        MinecraftItemTypes2["SporeBlossom"] = "minecraft:spore_blossom";
        MinecraftItemTypes2["SpruceBoat"] = "minecraft:spruce_boat";
        MinecraftItemTypes2["SpruceButton"] = "minecraft:spruce_button";
        MinecraftItemTypes2["SpruceChestBoat"] = "minecraft:spruce_chest_boat";
        MinecraftItemTypes2["SpruceDoor"] = "minecraft:spruce_door";
        MinecraftItemTypes2["SpruceFence"] = "minecraft:spruce_fence";
        MinecraftItemTypes2["SpruceFenceGate"] = "minecraft:spruce_fence_gate";
        MinecraftItemTypes2["SpruceHangingSign"] = "minecraft:spruce_hanging_sign";
        MinecraftItemTypes2["SpruceLeaves"] = "minecraft:spruce_leaves";
        MinecraftItemTypes2["SpruceLog"] = "minecraft:spruce_log";
        MinecraftItemTypes2["SprucePlanks"] = "minecraft:spruce_planks";
        MinecraftItemTypes2["SprucePressurePlate"] = "minecraft:spruce_pressure_plate";
        MinecraftItemTypes2["SpruceSapling"] = "minecraft:spruce_sapling";
        MinecraftItemTypes2["SpruceSign"] = "minecraft:spruce_sign";
        MinecraftItemTypes2["SpruceSlab"] = "minecraft:spruce_slab";
        MinecraftItemTypes2["SpruceStairs"] = "minecraft:spruce_stairs";
        MinecraftItemTypes2["SpruceTrapdoor"] = "minecraft:spruce_trapdoor";
        MinecraftItemTypes2["SpruceWood"] = "minecraft:spruce_wood";
        MinecraftItemTypes2["Spyglass"] = "minecraft:spyglass";
        MinecraftItemTypes2["SquidSpawnEgg"] = "minecraft:squid_spawn_egg";
        MinecraftItemTypes2["Stick"] = "minecraft:stick";
        MinecraftItemTypes2["StickyPiston"] = "minecraft:sticky_piston";
        MinecraftItemTypes2["Stone"] = "minecraft:stone";
        MinecraftItemTypes2["StoneAxe"] = "minecraft:stone_axe";
        MinecraftItemTypes2["StoneBrickSlab"] = "minecraft:stone_brick_slab";
        MinecraftItemTypes2["StoneBrickStairs"] = "minecraft:stone_brick_stairs";
        MinecraftItemTypes2["StoneBrickWall"] = "minecraft:stone_brick_wall";
        MinecraftItemTypes2["StoneBricks"] = "minecraft:stone_bricks";
        MinecraftItemTypes2["StoneButton"] = "minecraft:stone_button";
        MinecraftItemTypes2["StoneHoe"] = "minecraft:stone_hoe";
        MinecraftItemTypes2["StonePickaxe"] = "minecraft:stone_pickaxe";
        MinecraftItemTypes2["StonePressurePlate"] = "minecraft:stone_pressure_plate";
        MinecraftItemTypes2["StoneShovel"] = "minecraft:stone_shovel";
        MinecraftItemTypes2["StoneStairs"] = "minecraft:stone_stairs";
        MinecraftItemTypes2["StoneSword"] = "minecraft:stone_sword";
        MinecraftItemTypes2["StonecutterBlock"] = "minecraft:stonecutter_block";
        MinecraftItemTypes2["StraySpawnEgg"] = "minecraft:stray_spawn_egg";
        MinecraftItemTypes2["StriderSpawnEgg"] = "minecraft:strider_spawn_egg";
        MinecraftItemTypes2["String"] = "minecraft:string";
        MinecraftItemTypes2["StrippedAcaciaLog"] = "minecraft:stripped_acacia_log";
        MinecraftItemTypes2["StrippedAcaciaWood"] = "minecraft:stripped_acacia_wood";
        MinecraftItemTypes2["StrippedBambooBlock"] = "minecraft:stripped_bamboo_block";
        MinecraftItemTypes2["StrippedBirchLog"] = "minecraft:stripped_birch_log";
        MinecraftItemTypes2["StrippedBirchWood"] = "minecraft:stripped_birch_wood";
        MinecraftItemTypes2["StrippedCherryLog"] = "minecraft:stripped_cherry_log";
        MinecraftItemTypes2["StrippedCherryWood"] = "minecraft:stripped_cherry_wood";
        MinecraftItemTypes2["StrippedCrimsonHyphae"] = "minecraft:stripped_crimson_hyphae";
        MinecraftItemTypes2["StrippedCrimsonStem"] = "minecraft:stripped_crimson_stem";
        MinecraftItemTypes2["StrippedDarkOakLog"] = "minecraft:stripped_dark_oak_log";
        MinecraftItemTypes2["StrippedDarkOakWood"] = "minecraft:stripped_dark_oak_wood";
        MinecraftItemTypes2["StrippedJungleLog"] = "minecraft:stripped_jungle_log";
        MinecraftItemTypes2["StrippedJungleWood"] = "minecraft:stripped_jungle_wood";
        MinecraftItemTypes2["StrippedMangroveLog"] = "minecraft:stripped_mangrove_log";
        MinecraftItemTypes2["StrippedMangroveWood"] = "minecraft:stripped_mangrove_wood";
        MinecraftItemTypes2["StrippedOakLog"] = "minecraft:stripped_oak_log";
        MinecraftItemTypes2["StrippedOakWood"] = "minecraft:stripped_oak_wood";
        MinecraftItemTypes2["StrippedPaleOakLog"] = "minecraft:stripped_pale_oak_log";
        MinecraftItemTypes2["StrippedPaleOakWood"] = "minecraft:stripped_pale_oak_wood";
        MinecraftItemTypes2["StrippedSpruceLog"] = "minecraft:stripped_spruce_log";
        MinecraftItemTypes2["StrippedSpruceWood"] = "minecraft:stripped_spruce_wood";
        MinecraftItemTypes2["StrippedWarpedHyphae"] = "minecraft:stripped_warped_hyphae";
        MinecraftItemTypes2["StrippedWarpedStem"] = "minecraft:stripped_warped_stem";
        MinecraftItemTypes2["StructureBlock"] = "minecraft:structure_block";
        MinecraftItemTypes2["StructureVoid"] = "minecraft:structure_void";
        MinecraftItemTypes2["Sugar"] = "minecraft:sugar";
        MinecraftItemTypes2["SugarCane"] = "minecraft:sugar_cane";
        MinecraftItemTypes2["Sunflower"] = "minecraft:sunflower";
        MinecraftItemTypes2["SuspiciousGravel"] = "minecraft:suspicious_gravel";
        MinecraftItemTypes2["SuspiciousSand"] = "minecraft:suspicious_sand";
        MinecraftItemTypes2["SuspiciousStew"] = "minecraft:suspicious_stew";
        MinecraftItemTypes2["SweetBerries"] = "minecraft:sweet_berries";
        MinecraftItemTypes2["TadpoleBucket"] = "minecraft:tadpole_bucket";
        MinecraftItemTypes2["TadpoleSpawnEgg"] = "minecraft:tadpole_spawn_egg";
        MinecraftItemTypes2["TallGrass"] = "minecraft:tall_grass";
        MinecraftItemTypes2["Target"] = "minecraft:target";
        MinecraftItemTypes2["TideArmorTrimSmithingTemplate"] = "minecraft:tide_armor_trim_smithing_template";
        MinecraftItemTypes2["TintedGlass"] = "minecraft:tinted_glass";
        MinecraftItemTypes2["Tnt"] = "minecraft:tnt";
        MinecraftItemTypes2["TntMinecart"] = "minecraft:tnt_minecart";
        MinecraftItemTypes2["Torch"] = "minecraft:torch";
        MinecraftItemTypes2["Torchflower"] = "minecraft:torchflower";
        MinecraftItemTypes2["TorchflowerSeeds"] = "minecraft:torchflower_seeds";
        MinecraftItemTypes2["TotemOfUndying"] = "minecraft:totem_of_undying";
        MinecraftItemTypes2["TraderLlamaSpawnEgg"] = "minecraft:trader_llama_spawn_egg";
        MinecraftItemTypes2["Trapdoor"] = "minecraft:trapdoor";
        MinecraftItemTypes2["TrappedChest"] = "minecraft:trapped_chest";
        MinecraftItemTypes2["TrialKey"] = "minecraft:trial_key";
        MinecraftItemTypes2["TrialSpawner"] = "minecraft:trial_spawner";
        MinecraftItemTypes2["Trident"] = "minecraft:trident";
        MinecraftItemTypes2["TripwireHook"] = "minecraft:tripwire_hook";
        MinecraftItemTypes2["TropicalFish"] = "minecraft:tropical_fish";
        MinecraftItemTypes2["TropicalFishBucket"] = "minecraft:tropical_fish_bucket";
        MinecraftItemTypes2["TropicalFishSpawnEgg"] = "minecraft:tropical_fish_spawn_egg";
        MinecraftItemTypes2["TubeCoral"] = "minecraft:tube_coral";
        MinecraftItemTypes2["TubeCoralBlock"] = "minecraft:tube_coral_block";
        MinecraftItemTypes2["TubeCoralFan"] = "minecraft:tube_coral_fan";
        MinecraftItemTypes2["Tuff"] = "minecraft:tuff";
        MinecraftItemTypes2["TuffBrickSlab"] = "minecraft:tuff_brick_slab";
        MinecraftItemTypes2["TuffBrickStairs"] = "minecraft:tuff_brick_stairs";
        MinecraftItemTypes2["TuffBrickWall"] = "minecraft:tuff_brick_wall";
        MinecraftItemTypes2["TuffBricks"] = "minecraft:tuff_bricks";
        MinecraftItemTypes2["TuffSlab"] = "minecraft:tuff_slab";
        MinecraftItemTypes2["TuffStairs"] = "minecraft:tuff_stairs";
        MinecraftItemTypes2["TuffWall"] = "minecraft:tuff_wall";
        MinecraftItemTypes2["TurtleEgg"] = "minecraft:turtle_egg";
        MinecraftItemTypes2["TurtleHelmet"] = "minecraft:turtle_helmet";
        MinecraftItemTypes2["TurtleScute"] = "minecraft:turtle_scute";
        MinecraftItemTypes2["TurtleSpawnEgg"] = "minecraft:turtle_spawn_egg";
        MinecraftItemTypes2["TwistingVines"] = "minecraft:twisting_vines";
        MinecraftItemTypes2["UndyedShulkerBox"] = "minecraft:undyed_shulker_box";
        MinecraftItemTypes2["Vault"] = "minecraft:vault";
        MinecraftItemTypes2["VerdantFroglight"] = "minecraft:verdant_froglight";
        MinecraftItemTypes2["VexArmorTrimSmithingTemplate"] = "minecraft:vex_armor_trim_smithing_template";
        MinecraftItemTypes2["VexSpawnEgg"] = "minecraft:vex_spawn_egg";
        MinecraftItemTypes2["VillagerSpawnEgg"] = "minecraft:villager_spawn_egg";
        MinecraftItemTypes2["VindicatorSpawnEgg"] = "minecraft:vindicator_spawn_egg";
        MinecraftItemTypes2["Vine"] = "minecraft:vine";
        MinecraftItemTypes2["WanderingTraderSpawnEgg"] = "minecraft:wandering_trader_spawn_egg";
        MinecraftItemTypes2["WardArmorTrimSmithingTemplate"] = "minecraft:ward_armor_trim_smithing_template";
        MinecraftItemTypes2["WardenSpawnEgg"] = "minecraft:warden_spawn_egg";
        MinecraftItemTypes2["WarpedButton"] = "minecraft:warped_button";
        MinecraftItemTypes2["WarpedDoor"] = "minecraft:warped_door";
        MinecraftItemTypes2["WarpedFence"] = "minecraft:warped_fence";
        MinecraftItemTypes2["WarpedFenceGate"] = "minecraft:warped_fence_gate";
        MinecraftItemTypes2["WarpedFungus"] = "minecraft:warped_fungus";
        MinecraftItemTypes2["WarpedFungusOnAStick"] = "minecraft:warped_fungus_on_a_stick";
        MinecraftItemTypes2["WarpedHangingSign"] = "minecraft:warped_hanging_sign";
        MinecraftItemTypes2["WarpedHyphae"] = "minecraft:warped_hyphae";
        MinecraftItemTypes2["WarpedNylium"] = "minecraft:warped_nylium";
        MinecraftItemTypes2["WarpedPlanks"] = "minecraft:warped_planks";
        MinecraftItemTypes2["WarpedPressurePlate"] = "minecraft:warped_pressure_plate";
        MinecraftItemTypes2["WarpedRoots"] = "minecraft:warped_roots";
        MinecraftItemTypes2["WarpedSign"] = "minecraft:warped_sign";
        MinecraftItemTypes2["WarpedSlab"] = "minecraft:warped_slab";
        MinecraftItemTypes2["WarpedStairs"] = "minecraft:warped_stairs";
        MinecraftItemTypes2["WarpedStem"] = "minecraft:warped_stem";
        MinecraftItemTypes2["WarpedTrapdoor"] = "minecraft:warped_trapdoor";
        MinecraftItemTypes2["WarpedWartBlock"] = "minecraft:warped_wart_block";
        MinecraftItemTypes2["WaterBucket"] = "minecraft:water_bucket";
        MinecraftItemTypes2["Waterlily"] = "minecraft:waterlily";
        MinecraftItemTypes2["WaxedChiseledCopper"] = "minecraft:waxed_chiseled_copper";
        MinecraftItemTypes2["WaxedCopper"] = "minecraft:waxed_copper";
        MinecraftItemTypes2["WaxedCopperBulb"] = "minecraft:waxed_copper_bulb";
        MinecraftItemTypes2["WaxedCopperDoor"] = "minecraft:waxed_copper_door";
        MinecraftItemTypes2["WaxedCopperGrate"] = "minecraft:waxed_copper_grate";
        MinecraftItemTypes2["WaxedCopperTrapdoor"] = "minecraft:waxed_copper_trapdoor";
        MinecraftItemTypes2["WaxedCutCopper"] = "minecraft:waxed_cut_copper";
        MinecraftItemTypes2["WaxedCutCopperSlab"] = "minecraft:waxed_cut_copper_slab";
        MinecraftItemTypes2["WaxedCutCopperStairs"] = "minecraft:waxed_cut_copper_stairs";
        MinecraftItemTypes2["WaxedExposedChiseledCopper"] = "minecraft:waxed_exposed_chiseled_copper";
        MinecraftItemTypes2["WaxedExposedCopper"] = "minecraft:waxed_exposed_copper";
        MinecraftItemTypes2["WaxedExposedCopperBulb"] = "minecraft:waxed_exposed_copper_bulb";
        MinecraftItemTypes2["WaxedExposedCopperDoor"] = "minecraft:waxed_exposed_copper_door";
        MinecraftItemTypes2["WaxedExposedCopperGrate"] = "minecraft:waxed_exposed_copper_grate";
        MinecraftItemTypes2["WaxedExposedCopperTrapdoor"] = "minecraft:waxed_exposed_copper_trapdoor";
        MinecraftItemTypes2["WaxedExposedCutCopper"] = "minecraft:waxed_exposed_cut_copper";
        MinecraftItemTypes2["WaxedExposedCutCopperSlab"] = "minecraft:waxed_exposed_cut_copper_slab";
        MinecraftItemTypes2["WaxedExposedCutCopperStairs"] = "minecraft:waxed_exposed_cut_copper_stairs";
        MinecraftItemTypes2["WaxedOxidizedChiseledCopper"] = "minecraft:waxed_oxidized_chiseled_copper";
        MinecraftItemTypes2["WaxedOxidizedCopper"] = "minecraft:waxed_oxidized_copper";
        MinecraftItemTypes2["WaxedOxidizedCopperBulb"] = "minecraft:waxed_oxidized_copper_bulb";
        MinecraftItemTypes2["WaxedOxidizedCopperDoor"] = "minecraft:waxed_oxidized_copper_door";
        MinecraftItemTypes2["WaxedOxidizedCopperGrate"] = "minecraft:waxed_oxidized_copper_grate";
        MinecraftItemTypes2["WaxedOxidizedCopperTrapdoor"] = "minecraft:waxed_oxidized_copper_trapdoor";
        MinecraftItemTypes2["WaxedOxidizedCutCopper"] = "minecraft:waxed_oxidized_cut_copper";
        MinecraftItemTypes2["WaxedOxidizedCutCopperSlab"] = "minecraft:waxed_oxidized_cut_copper_slab";
        MinecraftItemTypes2["WaxedOxidizedCutCopperStairs"] = "minecraft:waxed_oxidized_cut_copper_stairs";
        MinecraftItemTypes2["WaxedWeatheredChiseledCopper"] = "minecraft:waxed_weathered_chiseled_copper";
        MinecraftItemTypes2["WaxedWeatheredCopper"] = "minecraft:waxed_weathered_copper";
        MinecraftItemTypes2["WaxedWeatheredCopperBulb"] = "minecraft:waxed_weathered_copper_bulb";
        MinecraftItemTypes2["WaxedWeatheredCopperDoor"] = "minecraft:waxed_weathered_copper_door";
        MinecraftItemTypes2["WaxedWeatheredCopperGrate"] = "minecraft:waxed_weathered_copper_grate";
        MinecraftItemTypes2["WaxedWeatheredCopperTrapdoor"] = "minecraft:waxed_weathered_copper_trapdoor";
        MinecraftItemTypes2["WaxedWeatheredCutCopper"] = "minecraft:waxed_weathered_cut_copper";
        MinecraftItemTypes2["WaxedWeatheredCutCopperSlab"] = "minecraft:waxed_weathered_cut_copper_slab";
        MinecraftItemTypes2["WaxedWeatheredCutCopperStairs"] = "minecraft:waxed_weathered_cut_copper_stairs";
        MinecraftItemTypes2["WayfinderArmorTrimSmithingTemplate"] = "minecraft:wayfinder_armor_trim_smithing_template";
        MinecraftItemTypes2["WeatheredChiseledCopper"] = "minecraft:weathered_chiseled_copper";
        MinecraftItemTypes2["WeatheredCopper"] = "minecraft:weathered_copper";
        MinecraftItemTypes2["WeatheredCopperBulb"] = "minecraft:weathered_copper_bulb";
        MinecraftItemTypes2["WeatheredCopperDoor"] = "minecraft:weathered_copper_door";
        MinecraftItemTypes2["WeatheredCopperGrate"] = "minecraft:weathered_copper_grate";
        MinecraftItemTypes2["WeatheredCopperTrapdoor"] = "minecraft:weathered_copper_trapdoor";
        MinecraftItemTypes2["WeatheredCutCopper"] = "minecraft:weathered_cut_copper";
        MinecraftItemTypes2["WeatheredCutCopperSlab"] = "minecraft:weathered_cut_copper_slab";
        MinecraftItemTypes2["WeatheredCutCopperStairs"] = "minecraft:weathered_cut_copper_stairs";
        MinecraftItemTypes2["Web"] = "minecraft:web";
        MinecraftItemTypes2["WeepingVines"] = "minecraft:weeping_vines";
        MinecraftItemTypes2["WetSponge"] = "minecraft:wet_sponge";
        MinecraftItemTypes2["Wheat"] = "minecraft:wheat";
        MinecraftItemTypes2["WheatSeeds"] = "minecraft:wheat_seeds";
        MinecraftItemTypes2["WhiteBundle"] = "minecraft:white_bundle";
        MinecraftItemTypes2["WhiteCandle"] = "minecraft:white_candle";
        MinecraftItemTypes2["WhiteCarpet"] = "minecraft:white_carpet";
        MinecraftItemTypes2["WhiteConcrete"] = "minecraft:white_concrete";
        MinecraftItemTypes2["WhiteConcretePowder"] = "minecraft:white_concrete_powder";
        MinecraftItemTypes2["WhiteDye"] = "minecraft:white_dye";
        MinecraftItemTypes2["WhiteGlazedTerracotta"] = "minecraft:white_glazed_terracotta";
        MinecraftItemTypes2["WhiteShulkerBox"] = "minecraft:white_shulker_box";
        MinecraftItemTypes2["WhiteStainedGlass"] = "minecraft:white_stained_glass";
        MinecraftItemTypes2["WhiteStainedGlassPane"] = "minecraft:white_stained_glass_pane";
        MinecraftItemTypes2["WhiteTerracotta"] = "minecraft:white_terracotta";
        MinecraftItemTypes2["WhiteTulip"] = "minecraft:white_tulip";
        MinecraftItemTypes2["WhiteWool"] = "minecraft:white_wool";
        MinecraftItemTypes2["WildArmorTrimSmithingTemplate"] = "minecraft:wild_armor_trim_smithing_template";
        MinecraftItemTypes2["WindCharge"] = "minecraft:wind_charge";
        MinecraftItemTypes2["WitchSpawnEgg"] = "minecraft:witch_spawn_egg";
        MinecraftItemTypes2["WitherRose"] = "minecraft:wither_rose";
        MinecraftItemTypes2["WitherSkeletonSkull"] = "minecraft:wither_skeleton_skull";
        MinecraftItemTypes2["WitherSkeletonSpawnEgg"] = "minecraft:wither_skeleton_spawn_egg";
        MinecraftItemTypes2["WitherSpawnEgg"] = "minecraft:wither_spawn_egg";
        MinecraftItemTypes2["WolfArmor"] = "minecraft:wolf_armor";
        MinecraftItemTypes2["WolfSpawnEgg"] = "minecraft:wolf_spawn_egg";
        MinecraftItemTypes2["WoodenAxe"] = "minecraft:wooden_axe";
        MinecraftItemTypes2["WoodenButton"] = "minecraft:wooden_button";
        MinecraftItemTypes2["WoodenDoor"] = "minecraft:wooden_door";
        MinecraftItemTypes2["WoodenHoe"] = "minecraft:wooden_hoe";
        MinecraftItemTypes2["WoodenPickaxe"] = "minecraft:wooden_pickaxe";
        MinecraftItemTypes2["WoodenPressurePlate"] = "minecraft:wooden_pressure_plate";
        MinecraftItemTypes2["WoodenShovel"] = "minecraft:wooden_shovel";
        MinecraftItemTypes2["WoodenSword"] = "minecraft:wooden_sword";
        MinecraftItemTypes2["WritableBook"] = "minecraft:writable_book";
        MinecraftItemTypes2["YellowBundle"] = "minecraft:yellow_bundle";
        MinecraftItemTypes2["YellowCandle"] = "minecraft:yellow_candle";
        MinecraftItemTypes2["YellowCarpet"] = "minecraft:yellow_carpet";
        MinecraftItemTypes2["YellowConcrete"] = "minecraft:yellow_concrete";
        MinecraftItemTypes2["YellowConcretePowder"] = "minecraft:yellow_concrete_powder";
        MinecraftItemTypes2["YellowDye"] = "minecraft:yellow_dye";
        MinecraftItemTypes2["YellowGlazedTerracotta"] = "minecraft:yellow_glazed_terracotta";
        MinecraftItemTypes2["YellowShulkerBox"] = "minecraft:yellow_shulker_box";
        MinecraftItemTypes2["YellowStainedGlass"] = "minecraft:yellow_stained_glass";
        MinecraftItemTypes2["YellowStainedGlassPane"] = "minecraft:yellow_stained_glass_pane";
        MinecraftItemTypes2["YellowTerracotta"] = "minecraft:yellow_terracotta";
        MinecraftItemTypes2["YellowWool"] = "minecraft:yellow_wool";
        MinecraftItemTypes2["ZoglinSpawnEgg"] = "minecraft:zoglin_spawn_egg";
        MinecraftItemTypes2["ZombieHead"] = "minecraft:zombie_head";
        MinecraftItemTypes2["ZombieHorseSpawnEgg"] = "minecraft:zombie_horse_spawn_egg";
        MinecraftItemTypes2["ZombiePigmanSpawnEgg"] = "minecraft:zombie_pigman_spawn_egg";
        MinecraftItemTypes2["ZombieSpawnEgg"] = "minecraft:zombie_spawn_egg";
        MinecraftItemTypes2["ZombieVillagerSpawnEgg"] = "minecraft:zombie_villager_spawn_egg";
        return MinecraftItemTypes2;
    })(MinecraftItemTypes || {});
    var MinecraftPotionEffectTypes = (MinecraftPotionEffectTypes2 => {
        MinecraftPotionEffectTypes2["FireResistance"] = "FireResistance";
        MinecraftPotionEffectTypes2["Harming"] = "Harming";
        MinecraftPotionEffectTypes2["Healing"] = "Healing";
        MinecraftPotionEffectTypes2["Infested"] = "Infested";
        MinecraftPotionEffectTypes2["Invisibility"] = "Invisibility";
        MinecraftPotionEffectTypes2["Leaping"] = "Leaping";
        MinecraftPotionEffectTypes2["NightVision"] = "NightVision";
        MinecraftPotionEffectTypes2["None"] = "None";
        MinecraftPotionEffectTypes2["Oozing"] = "Oozing";
        MinecraftPotionEffectTypes2["Poison"] = "Poison";
        MinecraftPotionEffectTypes2["SlowFalling"] = "SlowFalling";
        MinecraftPotionEffectTypes2["Slowing"] = "Slowing";
        MinecraftPotionEffectTypes2["Strength"] = "Strength";
        MinecraftPotionEffectTypes2["Swiftness"] = "Swiftness";
        MinecraftPotionEffectTypes2["TurtleMaster"] = "TurtleMaster";
        MinecraftPotionEffectTypes2["WaterBreath"] = "WaterBreath";
        MinecraftPotionEffectTypes2["Weakness"] = "Weakness";
        MinecraftPotionEffectTypes2["Weaving"] = "Weaving";
        MinecraftPotionEffectTypes2["WindCharged"] = "WindCharged";
        MinecraftPotionEffectTypes2["Wither"] = "Wither";
        return MinecraftPotionEffectTypes2;
    })(MinecraftPotionEffectTypes || {});
    var MinecraftPotionLiquidTypes = (MinecraftPotionLiquidTypes2 => {
        MinecraftPotionLiquidTypes2["Lingering"] = "Lingering";
        MinecraftPotionLiquidTypes2["Regular"] = "Regular";
        MinecraftPotionLiquidTypes2["Splash"] = "Splash";
        return MinecraftPotionLiquidTypes2;
    })(MinecraftPotionLiquidTypes || {});
    var MinecraftPotionModifierTypes = (MinecraftPotionModifierTypes2 => {
        MinecraftPotionModifierTypes2["Long"] = "Long";
        MinecraftPotionModifierTypes2["Normal"] = "Normal";
        MinecraftPotionModifierTypes2["Strong"] = "Strong";
        return MinecraftPotionModifierTypes2;
    })(MinecraftPotionModifierTypes || {});
    var lib = __webpack_require__(79);
    var Direction;
    (function(Direction) {
        Direction[Direction["Forward"] = 0] = "Forward";
        Direction[Direction["Right"] = 1] = "Right";
        Direction[Direction["Back"] = 2] = "Back";
        Direction[Direction["Left"] = 3] = "Left";
        Direction[Direction["Up"] = 4] = "Up";
        Direction[Direction["Down"] = 5] = "Down";
    })(Direction || (Direction = {}));
    const directionLookup = {
        [Direction.Forward]: lib.VECTOR3_FORWARD,
        [Direction.Right]: lib.VECTOR3_LEFT,
        [Direction.Back]: lib.VECTOR3_BACK,
        [Direction.Left]: lib.VECTOR3_RIGHT,
        [Direction.Up]: lib.VECTOR3_UP,
        [Direction.Down]: lib.VECTOR3_DOWN
    };
    function getRotationCorrectedDirection(rotationY, realDirection) {
        if (realDirection === Direction.Up || realDirection === Direction.Down) {
            return realDirection;
        }
        const directionQuadrant = Math.floor((rotationY + 405 + realDirection * 90) % 360 / 90);
        return directionQuadrant;
    }
    function getRotationCorrectedDirectionVector(rotationY, realDirection) {
        const relativeDirection = getRotationCorrectedDirection(rotationY, realDirection);
        return directionLookup[relativeDirection];
    }
    function getDirectionVector(direction) {
        return directionLookup[direction];
    }
    function getScaledDirectionVector(direction, scaleValue) {
        const vec = Vector3Utils.scale(getDirectionVector(direction), scaleValue);
        return vec;
    }
    function shrinkVolumeAlongAbsoluteAxis(volume, direction, amount) {
        const bounds = volume.getBoundingBox();
        const boundSize = server_namespaceObject.BoundingBoxUtils.getSpan(bounds);
        const min = bounds.min;
        const max = bounds.max;
        const spanX = boundSize.x;
        const spanY = boundSize.y;
        const spanZ = boundSize.z;
        switch (direction) {
          case Direction.Up:
            if (spanY > amount) {
                max.y -= amount;
            }
            break;

          case Direction.Down:
            if (spanY > amount) {
                min.y += amount;
            }
            break;

          case Direction.Forward:
            if (spanZ > amount) {
                max.z -= amount;
            }
            break;

          case Direction.Back:
            if (spanZ > amount) {
                min.z += amount;
            }
            break;

          case Direction.Left:
            if (spanX > amount) {
                max.x -= amount;
            }
            break;

          case Direction.Right:
            if (spanX > amount) {
                min.x += amount;
            }
            break;
        }
        return new server_namespaceObject.BlockVolume(min, max);
    }
    function shrinkVolumeAlongViewAxis(volume, rotationY, direction, amount) {
        const relativeDirection = getRotationCorrectedDirection(rotationY, direction);
        return shrinkVolumeAlongAbsoluteAxis(volume, relativeDirection, amount);
    }
    function growVolumeAlongAbsoluteAxis(volume, direction, amount) {
        const maxAxialLength = 100;
        if (amount > maxAxialLength) {
            amount = maxAxialLength;
        }
        const bounds = volume.getBoundingBox();
        const boundSize = server_namespaceObject.BoundingBoxUtils.getSpan(bounds);
        const min = bounds.min;
        const max = bounds.max;
        const spanX = boundSize.x;
        const spanY = boundSize.y;
        const spanZ = boundSize.z;
        switch (direction) {
          case Direction.Up:
            if (spanY + amount > maxAxialLength) {
                amount = maxAxialLength - spanY;
            }
            max.y += amount;
            break;

          case Direction.Down:
            if (spanY + amount > maxAxialLength) {
                amount = maxAxialLength - spanY;
            }
            min.y -= amount;
            break;

          case Direction.Forward:
            if (spanZ + amount > maxAxialLength) {
                amount = maxAxialLength - spanZ;
            }
            max.z += amount;
            break;

          case Direction.Back:
            if (spanZ + amount > maxAxialLength) {
                amount = maxAxialLength - spanZ;
            }
            min.z -= amount;
            break;

          case Direction.Left:
            if (spanX + amount > maxAxialLength) {
                amount = maxAxialLength - spanX;
            }
            max.x += amount;
            break;

          case Direction.Right:
            if (spanX + amount > maxAxialLength) {
                amount = maxAxialLength - spanX;
            }
            min.x -= amount;
            break;
        }
        return new server_namespaceObject.BlockVolume(min, max);
    }
    function growVolumeAlongViewAxis(volume, rotationY, direction, amount) {
        const relativeDirection = getRotationCorrectedDirection(rotationY, direction);
        return growVolumeAlongAbsoluteAxis(volume, relativeDirection, amount);
    }
    var AxisPlanes;
    (function(AxisPlanes) {
        AxisPlanes[AxisPlanes["XZ"] = 0] = "XZ";
        AxisPlanes[AxisPlanes["XY"] = 1] = "XY";
        AxisPlanes[AxisPlanes["YZ"] = 2] = "YZ";
    })(AxisPlanes || (AxisPlanes = {}));
    const axisNormalLookup = {
        [AxisPlanes.XZ]: lib.VECTOR3_UP,
        [AxisPlanes.XY]: lib.VECTOR3_FORWARD,
        [AxisPlanes.YZ]: lib.VECTOR3_LEFT
    };
    function getAxisNormal(axis) {
        return axisNormalLookup[axis];
    }
    function getRelativeXYAxisAsNormal(rotation) {
        const direction = getRotationCorrectedDirection(rotation, Direction.Forward);
        switch (direction) {
          case Direction.Forward:
          case Direction.Back:
            return axisNormalLookup[AxisPlanes.XY];

          case Direction.Right:
          case Direction.Left:
            return axisNormalLookup[AxisPlanes.YZ];

          default:
            throw "Invalid quadrant";
        }
    }
    function intersectRayPlane(rayLocation, rayDirection, planeNormal, planeDistance) {
        const denominator = lib.Vector3Utils.dot(rayDirection, planeNormal);
        if (denominator !== 0) {
            const t = -(lib.Vector3Utils.dot(rayLocation, planeNormal) + planeDistance) / denominator;
            if (t < 0) {
                return undefined;
            }
            const scaledDirection = lib.Vector3Utils.scale(rayDirection, t);
            const result = lib.Vector3Utils.add(rayLocation, scaledDirection);
            return result;
        } else if (lib.Vector3Utils.dot(planeNormal, rayLocation) + planeDistance === 0) {
            return rayLocation;
        }
        return undefined;
    }
    var BlockLineType;
    (function(BlockLineType) {
        BlockLineType[BlockLineType["Direct"] = 0] = "Direct";
        BlockLineType[BlockLineType["Staggered"] = 1] = "Staggered";
        BlockLineType[BlockLineType["Contour"] = 2] = "Contour";
    })(BlockLineType || (BlockLineType = {}));
    class BlockLineLocationIterator {
        constructor(data) {
            this.data = data;
            this.index = 0;
        }
        [Symbol.iterator]() {
            return {
                next: () => this.next()
            };
        }
        next() {
            if (this.index < this.data.length) {
                return {
                    value: this.data[this.index++],
                    done: false
                };
            } else {
                return {
                    value: undefined,
                    done: true
                };
            }
        }
    }
    class BlockLine {
        constructor(start, end, options) {
            this.data = [];
            this.start = start;
            this.end = end;
            if (options) {
                this.options = options;
            } else {
                this.options = {
                    width: 1,
                    height: 1,
                    mode: BlockLineType.Direct
                };
            }
            this.generateLine();
        }
        plotBresenhamLine3D(start, end) {
            const line = [];
            line.push({
                x: start.x,
                y: start.y,
                z: start.z
            });
            const dx = Math.abs(end.x - start.x);
            const dy = Math.abs(end.y - start.y);
            const dz = Math.abs(end.z - start.z);
            const xs = end.x > start.x ? 1 : -1;
            const ys = end.y > start.y ? 1 : -1;
            const zs = end.z > start.z ? 1 : -1;
            if (dx >= dy && dx >= dz) {
                let p0 = 2 * dy - dx;
                let p1 = 2 * dz - dx;
                let x0 = start.x;
                let y0 = start.y;
                let z0 = start.z;
                while (x0 !== end.x) {
                    x0 += xs;
                    if (p0 >= 0) {
                        y0 += ys;
                        p0 -= 2 * dx;
                    }
                    if (p1 >= 0) {
                        z0 += zs;
                        p1 -= 2 * dx;
                    }
                    p0 += 2 * dy;
                    p1 += 2 * dz;
                    line.push({
                        x: x0,
                        y: y0,
                        z: z0
                    });
                }
            } else if (dy >= dx && dy >= dz) {
                let p0 = 2 * dx - dy;
                let p1 = 2 * dz - dy;
                let y0 = start.y;
                let x0 = start.x;
                let z0 = start.z;
                while (y0 !== end.y) {
                    y0 += ys;
                    if (p0 >= 0) {
                        x0 += xs;
                        p0 -= 2 * dy;
                    }
                    if (p1 >= 0) {
                        z0 += zs;
                        p1 -= 2 * dy;
                    }
                    p0 += 2 * dx;
                    p1 += 2 * dz;
                    line.push({
                        x: x0,
                        y: y0,
                        z: z0
                    });
                }
            } else {
                let p0 = 2 * dy - dz;
                let p1 = 2 * dx - dz;
                let z0 = start.z;
                let x0 = start.x;
                let y0 = start.y;
                while (z0 !== end.z) {
                    z0 += zs;
                    if (p0 >= 0) {
                        y0 += ys;
                        p0 -= 2 * dz;
                    }
                    if (p1 >= 0) {
                        x0 += xs;
                        p1 -= 2 * dz;
                    }
                    p0 += 2 * dy;
                    p1 += 2 * dx;
                    line.push({
                        x: x0,
                        y: y0,
                        z: z0
                    });
                }
            }
            return line;
        }
        plotManhattanLine3D(start, end) {
            const line = [];
            let x = start.x;
            let y = start.y;
            let z = start.z;
            line.push({
                x,
                y,
                z
            });
            while (x !== end.x || y !== end.y || z !== end.z) {
                if (x < end.x) {
                    x++;
                    line.push({
                        x,
                        y,
                        z
                    });
                } else if (x > end.x) {
                    x--;
                    line.push({
                        x,
                        y,
                        z
                    });
                }
                if (y < end.y) {
                    y++;
                    line.push({
                        x,
                        y,
                        z
                    });
                } else if (y > end.y) {
                    y--;
                    line.push({
                        x,
                        y,
                        z
                    });
                }
                if (z < end.z) {
                    z++;
                    line.push({
                        x,
                        y,
                        z
                    });
                } else if (z > end.z) {
                    z--;
                    line.push({
                        x,
                        y,
                        z
                    });
                }
            }
            return line;
        }
        generateLine() {
            switch (this.options.mode) {
              case BlockLineType.Direct:
                this.data = this.plotBresenhamLine3D(this.start, this.end);
                break;

              case BlockLineType.Staggered:
                this.data = this.plotManhattanLine3D(this.start, this.end);
                break;

              default:
                this.data = [];
                break;
            }
        }
        setStart(start) {
            this.start = start;
            this.generateLine();
        }
        setEnd(end) {
            this.end = end;
            this.generateLine();
        }
        moveLine(vec) {
            this.start = {
                x: this.start.x + vec.x,
                y: this.start.y + vec.y,
                z: this.start.z + vec.z
            };
            this.end = {
                x: this.end.x,
                y: this.end.y + vec.y,
                z: this.end.z + vec.z
            };
            this.generateLine();
        }
        getBlockLineLocationIterator() {
            return new BlockLineLocationIterator(this.data);
        }
    }
    class SimpleStateSelector {
        constructor(initialState) {
            this.state = initialState;
        }
        changeState(next, action, state, predicate) {
            if (state === undefined) {
                this.state = next;
                action();
                return true;
            }
            if (predicate === undefined) {
                throw Error("All optional arguments must be provided");
            }
            if (predicate && this.state === state) {
                action();
                this.state = next;
                return true;
            }
            return false;
        }
        getState() {
            return this.state;
        }
        resetState(initialState) {
            this.state = initialState;
        }
    }
    function calculateClipboardNormalizedAnchorValue(item, absolute) {
        const itemSize = item.getSize();
        if (itemSize.x < 1 || itemSize.y < 1 || itemSize.z < 1) {
            return lib.VECTOR3_ZERO;
        }
        const clamped = lib.Vector3Utils.clamp(absolute, {
            min: lib.VECTOR3_ZERO,
            max: lib.Vector3Utils.subtract(itemSize, lib.VECTOR3_ONE)
        });
        const x = itemSize.x <= 1 ? 0 : clamped.x * 2 / (itemSize.x - 1) - 1;
        const y = itemSize.y <= 1 ? 0 : clamped.y * 2 / (itemSize.y - 1) - 1;
        const z = itemSize.z <= 1 ? 0 : clamped.z * 2 / (itemSize.z - 1) - 1;
        return new lib.Vector3Builder(x, y, z);
    }
    function calculateClipboardAbsoluteAnchorValue(item, normalized) {
        const itemSize = item.getSize();
        const x = (normalized.x + 1) * ((itemSize.x - 1) / 2);
        const y = (normalized.y + 1) * ((itemSize.y - 1) / 2);
        const z = (normalized.z + 1) * ((itemSize.z - 1) / 2);
        return new lib.Vector3Builder(x, y, z);
    }
    var server_editor_bindings_x = y => {
        var x = {};
        __webpack_require__.d(x, y);
        return x;
    };
    var server_editor_bindings_y = x => () => x;
    const server_editor_bindings_namespaceObject = server_editor_bindings_x({
        ["BrushShapeType"]: () => __WEBPACK_EXTERNAL_MODULE__minecraft_server_editor_bindings_e2bf1028__.BrushShapeType,
        ["PaintCompletionState"]: () => __WEBPACK_EXTERNAL_MODULE__minecraft_server_editor_bindings_e2bf1028__.PaintCompletionState,
        ["editorInternal"]: () => __WEBPACK_EXTERNAL_MODULE__minecraft_server_editor_bindings_e2bf1028__.editorInternal
    });
    const TESTFORBLOCKS_RETRY_COUNT = 5;
    const TESTFORBLOCKS_WAIT_TICKS_COUNT = 2;
    async function executeTickSafeOperation(context, logger, bounds, tickingHandle, operation) {
        tickingHandle = createUniqueEditorString(tickingHandle);
        const tickingAreaService = server_editor_bindings_namespaceObject.editorInternal.getPlayerServices(context.player).tickingArea;
        try {
            tickingAreaService.requestTickingArea(tickingHandle, bounds.min, bounds.max);
        } catch (e) {
            logger.error(`Failed to set ticking area: ${(0, server_editor_namespaceObject.stringFromException)(e)}`);
            return;
        }
        try {
            let retryCount = TESTFORBLOCKS_RETRY_COUNT;
            let success = false;
            while (retryCount > 0) {
                if (tickingAreaService.isTickingAreaActive(tickingHandle)) {
                    success = true;
                    break;
                }
                await server_namespaceObject.system.waitTicks(TESTFORBLOCKS_WAIT_TICKS_COUNT);
                retryCount--;
            }
            if (!success) {
                logger.error(`Ticking area was not moved to active after ${TESTFORBLOCKS_RETRY_COUNT} attempts`);
                throw new Error(`Ticking area was not moved to active after ${TESTFORBLOCKS_RETRY_COUNT} attempts`);
            }
            operation();
        } catch (e) {
            logger.error(`Failed to execute operation: ${(0, server_editor_namespaceObject.stringFromException)(e)}`);
        } finally {
            if (!tickingAreaService.releaseTickingArea(tickingHandle)) {
                logger.error(`Failed to release ticking area ${tickingHandle}`);
            }
        }
    }
    async function executeTickSafeAsyncOperation(context, logger, bounds, tickingHandle, operation) {
        tickingHandle = createUniqueEditorString(tickingHandle);
        const tickingAreaService = server_editor_bindings_namespaceObject.editorInternal.getPlayerServices(context.player).tickingArea;
        try {
            tickingAreaService.requestTickingArea(tickingHandle, bounds.min, bounds.max);
        } catch (e) {
            logger.error(`Failed to set ticking area: ${(0, server_editor_namespaceObject.stringFromException)(e)}`);
            return;
        }
        try {
            let retryCount = TESTFORBLOCKS_RETRY_COUNT;
            let success = false;
            while (retryCount > 0) {
                if (tickingAreaService.isTickingAreaActive(tickingHandle)) {
                    success = true;
                    break;
                }
                await server_namespaceObject.system.waitTicks(TESTFORBLOCKS_WAIT_TICKS_COUNT);
                retryCount--;
            }
            if (!success) {
                logger.error(`Ticking area was not moved to active after ${TESTFORBLOCKS_RETRY_COUNT} attempts`);
                throw new Error(`Ticking area was not moved to active after ${TESTFORBLOCKS_RETRY_COUNT} attempts`);
            }
            await operation();
        } catch (e) {
            logger.error(`Failed to execute operation: ${(0, server_editor_namespaceObject.stringFromException)(e)}`);
        } finally {
            if (!tickingAreaService.releaseTickingArea(tickingHandle)) {
                logger.error(`Failed to release ticking area ${tickingHandle}`);
            }
        }
    }
    function guid() {
        const s4 = () => Math.floor((1 + Math.random()) * 65536).toString(16).substring(1);
        return s4() + s4() + "-" + s4() + "-" + s4() + "-" + s4() + "-" + s4() + s4() + s4();
    }
    const EDITOR_PREFIX = "editor::";
    function createUniqueEditorString(name) {
        if (name.startsWith(EDITOR_PREFIX)) {
            return name;
        }
        return EDITOR_PREFIX + name + "::" + guid();
    }
    async function executeLargeOperationWithTransactionAndTicking(context, logger, originalSelection, transactionString, operation) {
        transactionString = createUniqueEditorString(transactionString);
        const selection = context.selectionManager.create();
        selection.set(originalSelection);
        const bounds = selection.getBoundingBox();
        if (!context.transactionManager.openTransaction(transactionString)) {
            throw Error("Failed to open transaction");
        }
        try {
            context.transactionManager.trackBlockChangeArea(bounds.min, bounds.max);
        } catch (e) {
            context.transactionManager.discardOpenTransaction();
            throw e;
        }
        await executeTickSafeAsyncOperation(context, logger, bounds, transactionString, (async () => {
            await (0, server_editor_namespaceObject.executeLargeOperation)(selection, operation);
        })).catch((e => {
            context.transactionManager.discardOpenTransaction();
            throw e;
        })).then((() => {
            if (!context.transactionManager.commitOpenTransaction()) {
                throw Error("Failed to commit transaction");
            }
        }));
    }
    async function executeLargeOperationFromIteratorWithTransactionAndTicking(context, logger, bounds, blockLocationIterator, transactionString, operation) {
        transactionString = createUniqueEditorString(transactionString);
        if (!context.transactionManager.openTransaction(transactionString)) {
            throw Error("Failed to open transaction");
        }
        try {
            context.transactionManager.trackBlockChangeArea(bounds.min, bounds.max);
        } catch (e) {
            context.transactionManager.discardOpenTransaction();
            throw Error((0, server_editor_namespaceObject.stringFromException)(e));
        }
        await executeTickSafeAsyncOperation(context, logger, bounds, transactionString, (async () => {
            await (0, server_editor_namespaceObject.executeLargeOperationFromIterator)(blockLocationIterator, operation).catch((e => {
                context.transactionManager.discardOpenTransaction();
                throw e;
            })).then((() => {
                if (!context.transactionManager.commitOpenTransaction()) {
                    throw Error("Failed to commit transaction");
                }
            }));
        }));
    }
    async function executeFunctionWithTransactionAndTicking(context, logger, originalSelection, transactionString, operation) {
        transactionString = createUniqueEditorString(transactionString);
        const selection = context.selectionManager.create();
        selection.set(originalSelection);
        const bounds = selection.getBoundingBox();
        if (!context.transactionManager.openTransaction(transactionString)) {
            throw Error("Failed to open transaction");
        }
        try {
            context.transactionManager.trackBlockChangeArea(bounds.min, bounds.max);
        } catch (e) {
            context.transactionManager.discardOpenTransaction();
            throw e;
        }
        await executeTickSafeOperation(context, logger, bounds, transactionString, operation).catch((e => {
            context.transactionManager.discardOpenTransaction();
            throw e;
        })).then((() => {
            if (!context.transactionManager.commitOpenTransaction()) {
                throw Error("Failed to commit transaction");
            }
        }));
    }
    var node_modules_buffer = __webpack_require__(834);
    function CreateBase64ImageFromRGB(rgbValues, width, height) {
        const HEADER_SIZE = 54;
        const DIB_HEADER_SIZE = 40;
        const PIXELS_PER_METER = 2835;
        const fileSize = HEADER_SIZE + 3 * width * height;
        const buffer = node_modules_buffer.lW.alloc(fileSize);
        buffer.write("BM");
        buffer.writeUInt32LE(fileSize, 2);
        buffer.writeUInt32LE(HEADER_SIZE, 10);
        buffer.writeUInt32LE(DIB_HEADER_SIZE, 14);
        buffer.writeInt32LE(width, 18);
        buffer.writeInt32LE(height, 22);
        buffer.writeUInt16LE(1, 26);
        buffer.writeUInt16LE(24, 28);
        buffer.writeUInt32LE(0, 30);
        buffer.writeUInt32LE(3 * width * height, 34);
        buffer.writeInt32LE(PIXELS_PER_METER, 38);
        buffer.writeInt32LE(PIXELS_PER_METER, 42);
        let offset = HEADER_SIZE;
        for (let y = height - 1; y >= 0; y--) {
            for (let x = 0; x < width; x++) {
                const idx = y * width + x;
                if (idx < rgbValues.length) {
                    const {r, g, b} = rgbValues[idx];
                    buffer.writeUInt8(b, offset);
                    buffer.writeUInt8(g, offset + 1);
                    buffer.writeUInt8(r, offset + 2);
                }
                offset += 3;
            }
        }
        return `data:image/bmp;base64,${buffer.toString("base64")}`;
    }
    function backupColors(extensionContext) {
        const cursorProperties = extensionContext.cursor.getProperties();
        const colorBackup = {};
        if (cursorProperties.fillColor) {
            colorBackup.cursorFillColor = cursorProperties.fillColor;
        }
        if (cursorProperties.outlineColor) {
            colorBackup.cursorOutlineColor = cursorProperties.outlineColor;
        }
        colorBackup.selectionFillColor = extensionContext.selectionManager.selection.getFillColor();
        colorBackup.selectionOutlineColor = extensionContext.selectionManager.selection.getOutlineColor();
        return colorBackup;
    }
    function restoreBackedUpColors(extensionContext, backedUpColors) {
        const cursorProperties = extensionContext.cursor.getProperties();
        if (!backedUpColors.cursorFillColor) {
            delete cursorProperties.fillColor;
        } else {
            cursorProperties.fillColor = backedUpColors.cursorFillColor;
        }
        if (!backedUpColors.cursorOutlineColor) {
            delete cursorProperties.outlineColor;
        } else {
            cursorProperties.outlineColor = backedUpColors.cursorOutlineColor;
        }
        extensionContext.cursor.setProperties(cursorProperties);
        if (backedUpColors.selectionFillColor) {
            extensionContext.selectionManager.selection.setFillColor(backedUpColors.selectionFillColor);
        }
        if (backedUpColors.selectionOutlineColor) {
            extensionContext.selectionManager.selection.setOutlineColor(backedUpColors.selectionOutlineColor);
        }
    }
    function getMapValueFromKey(map, key) {
        const value = map.get(key);
        if (value === undefined) {
            throw new Error(`Key ${String(key)} not found in map`);
        }
        return value;
    }
    function getMapKeyFromValue(map, value) {
        for (const [key, val] of map.entries()) {
            if (val === value) {
                return key;
            }
        }
        throw new Error(`Value ${String(value)} not found in map`);
    }
    function getEnumKeyByEnumValue(myEnum, enumValue) {
        const keys = Object.keys(myEnum);
        for (const key of keys) {
            if (myEnum[key] === enumValue) {
                return key;
            }
        }
        return "";
    }
    var ExtrudeAxis;
    (function(ExtrudeAxis) {
        ExtrudeAxis["XAxis"] = "resourcePack.editor.brushShape.common.settings.xAxis";
        ExtrudeAxis["YAxis"] = "resourcePack.editor.brushShape.common.settings.yAxis";
        ExtrudeAxis["ZAxis"] = "resourcePack.editor.brushShape.common.settings.zAxis";
        ExtrudeAxis["XAxisNeg"] = "resourcePack.editor.brushShape.common.settings.xAxisNeg";
        ExtrudeAxis["YAxisNeg"] = "resourcePack.editor.brushShape.common.settings.yAxisNeg";
        ExtrudeAxis["ZAxisNeg"] = "resourcePack.editor.brushShape.common.settings.zAxisNeg";
    })(ExtrudeAxis || (ExtrudeAxis = {}));
    function flipToAxis(point, axis) {
        switch (axis) {
          case ExtrudeAxis.XAxis:
            {
                return {
                    x: point.y,
                    y: point.z,
                    z: point.x
                };
            }

          case ExtrudeAxis.YAxis:
            {
                break;
            }

          case ExtrudeAxis.ZAxis:
            {
                return {
                    x: point.x,
                    y: point.z,
                    z: point.y
                };
            }

          case ExtrudeAxis.XAxisNeg:
            {
                return {
                    x: -point.y,
                    y: point.z,
                    z: point.x
                };
            }

          case ExtrudeAxis.YAxisNeg:
            {
                return {
                    x: point.x,
                    y: -point.y,
                    z: point.z
                };
            }

          case ExtrudeAxis.ZAxisNeg:
            {
                return {
                    x: point.x,
                    y: point.z,
                    z: -point.y
                };
            }
        }
        return point;
    }
    function midpointLine(width, height) {
        let x0 = 0;
        let y0 = 0;
        const x1 = width - 1;
        const y1 = height - 1;
        const dx = x1 - x0;
        const dy = y0 - y1;
        let e1 = dx + dy;
        let e2 = 0;
        const heights = new Array(width);
        do {
            heights[x0] = y0;
            e2 = 2 * e1;
            if (e2 >= dy) {
                e1 += dy;
                x0 += 1;
            }
            if (e2 <= dx) {
                e1 += dx;
                y0 += 1;
            }
        } while (x0 <= x1 && y0 <= y1);
        return heights;
    }
    function midpointEllipse(width, height) {
        let x0 = 0;
        let y0 = 0;
        const x1 = width * 2;
        const y1 = height * 2;
        let a = x1 - x0;
        const b = y1 - y0;
        let b1 = b & 1;
        let dx = 4 * (1 - a) * b * b;
        let dy = 4 * (b1 + 1) * a * a;
        let e1 = dx + dy + b1 * a * a;
        let e2 = 0;
        y0 += Math.floor((b + 1) / 2);
        a *= 8 * a;
        b1 = 8 * b * b;
        const heights = new Array(width);
        do {
            heights[x0] = y0 - height;
            e2 = 2 * e1;
            if (e2 <= dy) {
                y0++;
                e1 += dy += a;
            }
            if (e2 >= dx || 2 * e1 > dy) {
                x0++;
                e1 += dx += b1;
            }
        } while (x0 < width);
        return heights;
    }
    function calculateCylinderCompoundBlockVolume(width, depth, length, axis) {
        const zs_of_x = midpointEllipse(width, depth);
        const corners = [];
        if (width > 1) {
            for (let x = 0; x < zs_of_x.length; x++) {
                const x1 = x - width;
                const x2 = x + 1;
                const z1 = zs_of_x[x];
                const z2 = zs_of_x[zs_of_x.length - (x + 1)];
                corners.push({
                    x: x1,
                    y: 0,
                    z: z1
                });
                corners.push({
                    x: x1,
                    y: length - 1,
                    z: -z1
                });
                corners.push({
                    x: x2,
                    y: 0,
                    z: z2
                });
                corners.push({
                    x: x2,
                    y: length - 1,
                    z: -z2
                });
            }
        }
        corners.push({
            x: 0,
            y: 0,
            z: zs_of_x[zs_of_x.length - 1]
        });
        corners.push({
            x: 0,
            y: length - 1,
            z: -zs_of_x[zs_of_x.length - 1]
        });
        const compoundBlockVolume = new server_namespaceObject.CompoundBlockVolume;
        for (let i = 0; i < corners.length; i += 2) {
            const start = flipToAxis(corners[i], axis);
            const end = flipToAxis(corners[i + 1], axis);
            compoundBlockVolume.pushVolume({
                action: server_namespaceObject.CompoundBlockVolumeAction.Add,
                locationRelativity: server_namespaceObject.CompoundBlockVolumePositionRelativity.Relative,
                volume: new server_namespaceObject.BlockVolume(start, end)
            });
        }
        return compoundBlockVolume;
    }
    class SharedControlImpl {
        constructor(session, parentTool, parentPropertyPane, controlName, localizationPrefix) {
            this._session = session;
            this._parentTool = parentTool;
            this._parentPropertyPane = parentPropertyPane;
            this._controlName = controlName;
            this._isActive = false;
            this._isInitialized = false;
            this._localizationPrefix = localizationPrefix;
        }
        initialize() {
            this._isInitialized = true;
        }
        shutdown() {
            this._isInitialized = false;
        }
        activateControl() {
            if (!this._isInitialized) {
                throw new Error("Control must be initialized before it can be activated");
            }
            if (this._isActive) {
                throw new Error("Control is already active");
            }
            this._isActive = true;
        }
        deactivateControl() {
            if (!this._isActive) {
                throw new Error("Control is not active");
            }
            this._isActive = false;
        }
        registerToolKeyBinding(action, binding, tag) {
            this._parentTool.registerKeyBinding(action, binding, {
                uniqueId: `editor:${this._controlName}:${tag}`,
                label: `${this._localizationPrefix}.keybinding.${tag}`
            });
        }
        localize(key) {
            return `${this.localizationPrefix}.${key}`;
        }
        get session() {
            return this._session;
        }
        get propertyPane() {
            return this._parentPropertyPane;
        }
        get controlName() {
            return this._controlName;
        }
        get tool() {
            return this._parentTool;
        }
        get isActive() {
            return this._isActive;
        }
        get isInitialized() {
            return this._isInitialized;
        }
        get localizationPrefix() {
            return this._localizationPrefix;
        }
    }
    function arraysAreEqual(a, b) {
        if (a === undefined || b === undefined) {
            return a === b;
        }
        return a.length === b.length && a.every(((value, index) => value === b[index]));
    }
    function convertBlockStringsToBlockType(blockString) {
        const blockTypes = [];
        for (let blockStringElement of blockString) {
            if (!blockStringElement.includes(":")) {
                blockStringElement = "minecraft:" + blockStringElement;
            }
            const blockType = server_namespaceObject.BlockTypes.get(blockStringElement);
            if (blockType) {
                blockTypes.push(blockType);
            }
        }
        return blockTypes;
    }
    function convertBlockTypesToBlockStrings(blockTypes) {
        const blockStrings = [];
        for (const blockType of blockTypes) {
            let blockName = blockType.id;
            if (blockName.startsWith("minecraft:")) {
                blockName = blockName.substring(10);
            }
            blockStrings.push(blockName);
        }
        return blockStrings;
    }
    function isBlockNotAir(block) {
        return block.typeId !== MinecraftBlockTypes.Air;
    }
    function isBlockSolid(block) {
        return block.isSolid;
    }
    function isSameBlockAndProperties(BlockA, BlockB) {
        if (!isSameBlockType(BlockA, BlockB)) {
            return false;
        }
        const BlockAPermutationProperties = BlockA.permutation.getAllStates();
        const BlockBPermutationProperties = BlockB.permutation.getAllStates();
        return JSON.stringify(BlockAPermutationProperties) === JSON.stringify(BlockBPermutationProperties);
    }
    function isSameBlockType(BlockA, BlockB) {
        return BlockA.typeId === BlockB.typeId;
    }
    const PROPERTY_BRUSHPAINTCONTROL_NAME = "BrushPaintControl";
    const PROPERTY_BRUSHPAINTCONTROL_BLOCKMASK_SETTINGS_MASK = `${PROPERTY_BRUSHPAINTCONTROL_NAME}:BlockMask:Mask`;
    const PROPERTY_BRUSHPAINTCONTROL_BLOCKMASK_SETTINGS_REPLACE = `${PROPERTY_BRUSHPAINTCONTROL_NAME}:BlockMask:Replace`;
    const PROPERTY_BRUSHPAINTCONTROL_LOCALIZATION_PREFIX = `resourcePack.editor.${PROPERTY_BRUSHPAINTCONTROL_NAME}`;
    var InternalMaskType;
    (function(InternalMaskType) {
        InternalMaskType[InternalMaskType["Disabled"] = 0] = "Disabled";
        InternalMaskType[InternalMaskType["Mask"] = 1] = "Mask";
        InternalMaskType[InternalMaskType["Replace"] = 2] = "Replace";
    })(InternalMaskType || (InternalMaskType = {}));
    class BrushPaintSharedControl extends SharedControlImpl {
        get isUIConstructed() {
            return this._brushSettingsSubPane !== undefined;
        }
        constructor(session, parentTool, parentPropertyPane, _brushSettings, _options) {
            super(session, parentTool, parentPropertyPane, PROPERTY_BRUSHPAINTCONTROL_NAME, PROPERTY_BRUSHPAINTCONTROL_LOCALIZATION_PREFIX);
            this._options = _options;
            this._selectedBrushIndex = (0, server_editor_namespaceObject.makeObservable)(0);
            this._internalMaskType = (0, server_editor_namespaceObject.makeObservable)(InternalMaskType.Disabled);
            this._brushSettingsCollection = [];
            this._brushShapeOffset = (0, server_editor_namespaceObject.makeObservable)({
                x: 0,
                y: 0,
                z: 0
            });
            this._brushControlRootPane = undefined;
            this._brushSettingsSubPane = undefined;
            this._customSettingsSubPane = undefined;
            this._fillConstraintsSubPane = undefined;
            this._fillReplaceSubPane = undefined;
            this._fillMaskSubPane = undefined;
            this._blockListReplaceTable = undefined;
            this._blockListReplace = [];
            this._blockListMaskTable = undefined;
            this._blockListMask = [];
            this._updateSettingsOperations = [];
            this._updateSettingsOperationTickHandle = undefined;
            this._editorMode = server_editor_namespaceObject.EditorMode.Tool;
            this._brushSettings = _brushSettings;
        }
        initialize() {
            super.initialize();
            this._blockListMask = this._loadBlockMask(PROPERTY_BRUSHPAINTCONTROL_BLOCKMASK_SETTINGS_MASK, convertBlockStringsToBlockType([ "air" ]));
            this._blockListReplace = this._loadBlockMask(PROPERTY_BRUSHPAINTCONTROL_BLOCKMASK_SETTINGS_REPLACE, convertBlockStringsToBlockType([ "air" ]));
            if (!this.tool) {
                throw new Error("SharedControl tool is not set");
            }
            const offsetNudgeUpAction = this.session.actionManager.createAction({
                actionType: server_editor_namespaceObject.ActionTypes.NoArgsAction,
                onExecute: () => {
                    this._nudgeOffset(lib.VECTOR3_UP);
                }
            });
            const offsetNudgeDownAction = this.session.actionManager.createAction({
                actionType: server_editor_namespaceObject.ActionTypes.NoArgsAction,
                onExecute: () => {
                    this._nudgeOffset(lib.VECTOR3_DOWN);
                }
            });
            const offsetNudgeForwardAction = this.session.actionManager.createAction({
                actionType: server_editor_namespaceObject.ActionTypes.NoArgsAction,
                onExecute: () => {
                    const nudgeVector = this._getRelativeNudgeDirection(Direction.Forward);
                    this._nudgeOffset(nudgeVector);
                }
            });
            const offsetNudgeBackAction = this.session.actionManager.createAction({
                actionType: server_editor_namespaceObject.ActionTypes.NoArgsAction,
                onExecute: () => {
                    const nudgeVector = this._getRelativeNudgeDirection(Direction.Back);
                    this._nudgeOffset(nudgeVector);
                }
            });
            const offsetNudgeLeftAction = this.session.actionManager.createAction({
                actionType: server_editor_namespaceObject.ActionTypes.NoArgsAction,
                onExecute: () => {
                    const nudgeVector = this._getRelativeNudgeDirection(Direction.Left);
                    this._nudgeOffset(nudgeVector);
                }
            });
            const offsetNudgeRightAction = this.session.actionManager.createAction({
                actionType: server_editor_namespaceObject.ActionTypes.NoArgsAction,
                onExecute: () => {
                    const nudgeVector = this._getRelativeNudgeDirection(Direction.Right);
                    this._nudgeOffset(nudgeVector);
                }
            });
            this.registerToolKeyBinding(offsetNudgeUpAction, {
                key: server_editor_namespaceObject.KeyboardKey.PAGE_UP,
                modifier: server_editor_namespaceObject.InputModifier.Control | server_editor_namespaceObject.InputModifier.Shift
            }, "nudgeOffsetUp");
            this.registerToolKeyBinding(offsetNudgeDownAction, {
                key: server_editor_namespaceObject.KeyboardKey.PAGE_DOWN,
                modifier: server_editor_namespaceObject.InputModifier.Control | server_editor_namespaceObject.InputModifier.Shift
            }, "nudgeOffsetDown");
            this.registerToolKeyBinding(offsetNudgeForwardAction, {
                key: server_editor_namespaceObject.KeyboardKey.UP,
                modifier: server_editor_namespaceObject.InputModifier.Control | server_editor_namespaceObject.InputModifier.Shift
            }, "nudgeOffsetForward");
            this.registerToolKeyBinding(offsetNudgeBackAction, {
                key: server_editor_namespaceObject.KeyboardKey.DOWN,
                modifier: server_editor_namespaceObject.InputModifier.Control | server_editor_namespaceObject.InputModifier.Shift
            }, "nudgeOffsetBack");
            this.registerToolKeyBinding(offsetNudgeLeftAction, {
                key: server_editor_namespaceObject.KeyboardKey.LEFT,
                modifier: server_editor_namespaceObject.InputModifier.Control | server_editor_namespaceObject.InputModifier.Shift
            }, "nudgeOffsetLeft");
            this.registerToolKeyBinding(offsetNudgeRightAction, {
                key: server_editor_namespaceObject.KeyboardKey.RIGHT,
                modifier: server_editor_namespaceObject.InputModifier.Control | server_editor_namespaceObject.InputModifier.Shift
            }, "nudgeOffsetRight");
            const maskingModeReplaceAction = this.session.actionManager.createAction({
                actionType: server_editor_namespaceObject.ActionTypes.NoArgsAction,
                onExecute: () => {
                    if (this._internalMaskType.value === InternalMaskType.Replace) {
                        this._internalMaskType.set(InternalMaskType.Disabled);
                    } else {
                        this._internalMaskType.set(InternalMaskType.Replace);
                    }
                    this._switchBrushMaskPanes();
                    this._setBrushMask();
                }
            });
            this.registerToolKeyBinding(maskingModeReplaceAction, {
                key: server_editor_namespaceObject.KeyboardKey.KEY_R
            }, "replaceMask");
            const maskingModeMaskAction = this.session.actionManager.createAction({
                actionType: server_editor_namespaceObject.ActionTypes.NoArgsAction,
                onExecute: () => {
                    if (this._internalMaskType.value === InternalMaskType.Mask) {
                        this._internalMaskType.set(InternalMaskType.Disabled);
                    } else {
                        this._internalMaskType.set(InternalMaskType.Mask);
                    }
                    this._switchBrushMaskPanes();
                    this._setBrushMask();
                }
            });
            this.registerToolKeyBinding(maskingModeMaskAction, {
                key: server_editor_namespaceObject.KeyboardKey.KEY_M
            }, "maskMask");
        }
        shutdown() {
            super.shutdown();
            this._brushControlRootPane = undefined;
            this._brushSettingsSubPane = undefined;
            this._customSettingsSubPane = undefined;
            this._fillConstraintsSubPane = undefined;
            this._fillReplaceSubPane = undefined;
            this._fillMaskSubPane = undefined;
            this._blockListReplaceTable = undefined;
            this._blockListMaskTable = undefined;
        }
        activateControl() {
            super.activateControl();
            this._modeChangeEventSubscriptionHandle = this.session.extensionContext.afterEvents.modeChange.subscribe((event => {
                this._editorMode = event.mode;
                if (this._editorMode === server_editor_namespaceObject.EditorMode.Tool) {
                    if (this.isActive) {
                        this.activateVisualization();
                    } else {
                        this.deactivateVisualization();
                    }
                } else {
                    this.deactivateVisualization();
                }
            }));
            this._brushShapeOffset.set(this.session.extensionContext.brushShapeManager.getBrushShapeOffset());
            this._constructControlUI();
            this._setupBrushModeAndType();
            this._updateSettingsOperationTickHandle = server_namespaceObject.system.runInterval((() => {
                this._runUpdateOperation();
            }), 20);
            this._brushControlRootPane?.show();
            this.propertyPane.show();
            this._activateBrush();
            this.activateVisualization();
        }
        deactivateControl() {
            super.deactivateControl();
            if (this._modeChangeEventSubscriptionHandle) {
                this.session.extensionContext.afterEvents.modeChange.unsubscribe(this._modeChangeEventSubscriptionHandle);
                this._modeChangeEventSubscriptionHandle = undefined;
            }
            this.deactivateVisualization();
            this._destroyControlUI();
            if (this._updateSettingsOperationTickHandle !== undefined) {
                server_namespaceObject.system.clearRun(this._updateSettingsOperationTickHandle);
            }
            this._brushControlRootPane?.hide();
        }
        activateVisualization() {
            this.session.extensionContext.brushShapeManager.activateBrushTool();
            this._setBrushVolume();
            this._setBrushMask();
            this._switchBrushMaskPanes();
        }
        showVisualization() {
            this.session.extensionContext.brushShapeManager.setBrushShapeVisible(true);
        }
        deactivateVisualization() {
            this.session.extensionContext.brushShapeManager.deactivateBrushTool();
        }
        hideVisualization() {
            this.session.extensionContext.brushShapeManager.setBrushShapeVisible(false);
        }
        _setupBrushModeAndType() {
            const paintMode = this._brushSettings.paintMode;
            this.session.extensionContext.brushShapeManager.switchBrushPaintMode(paintMode);
        }
        _destroyControlUI() {
            if (this._brushControlRootPane) {
                this.propertyPane.removeSubPane(this._brushControlRootPane);
                this._brushControlRootPane = undefined;
            }
        }
        _constructControlUI() {
            const brushShapeInfo = this.session.extensionContext.brushShapeManager.brushShapeList;
            if (brushShapeInfo === undefined || brushShapeInfo.length === 0) {
                throw new Error(`${this.controlName} - No brush shapes found (not even system level ones)`);
            }
            if (this._brushControlRootPane) {
                this._destroyControlUI();
            }
            this._brushControlRootPane = this.propertyPane.createSubPane({
                title: this.localize("rootPane.title"),
                hasMargins: this._options?.hasPaneMargins
            });
            const dropdownItems = brushShapeInfo.map(((key, index) => {
                const item = {
                    label: key.name,
                    value: index,
                    imageData: {
                        path: key.icon,
                        type: server_editor_namespaceObject.ImageResourceType.Icon
                    }
                };
                return item;
            }));
            {
                this._brushControlRootPane.addDropdown(this._selectedBrushIndex, {
                    title: this.localize("brush.title"),
                    entries: dropdownItems,
                    onChange: (newValue, oldValue) => {
                        if (oldValue !== newValue && typeof newValue === "number") {
                            this._activateBrush(brushShapeInfo[newValue].name);
                        }
                    }
                });
                this._brushShapeOffset.set(this.session.extensionContext.brushShapeManager.getBrushShapeOffset());
                this._brushControlRootPane.addVector3(this._brushShapeOffset, {
                    title: this.localize("offset.title"),
                    tooltip: this.localize("offset.tooltip"),
                    isInteger: true,
                    min: BrushPaintSharedControl.MIN_OFFSET,
                    max: BrushPaintSharedControl.MAX_OFFSET,
                    onChange: (newValue, oldValue) => {
                        if (oldValue !== newValue) {
                            this.session.extensionContext.brushShapeManager.setBrushShapeOffset(newValue);
                        }
                    }
                });
            }
            this._brushSettingsSubPane = this._brushControlRootPane.createSubPane({
                title: this.localize("brushSettings.title")
            });
            this._fillConstraintsSubPane = this._brushControlRootPane.createSubPane({
                title: this.localize("fillConstraints.title")
            });
            this._fillConstraintsSubPane.addToggleGroup(this._internalMaskType, {
                title: this.localize("fillConstraints.maskMode.title"),
                entries: [ {
                    label: this.localize("fillConstraints.maskMode.disabled"),
                    value: InternalMaskType.Disabled,
                    icon: "squareIcon",
                    tooltip: this.localize("fillConstraints.maskMode.disabled.tooltip")
                }, {
                    label: this.localize("fillConstraints.maskMode.mask"),
                    value: InternalMaskType.Mask,
                    icon: "pack://textures/editor/mask.png",
                    tooltip: this.localize("fillConstraints.maskMode.mask.tooltip")
                }, {
                    label: this.localize("fillConstraints.maskMode.replace"),
                    value: InternalMaskType.Replace,
                    icon: "pack://textures/editor/replace.png",
                    tooltip: this.localize("fillConstraints.replace.tooltip")
                } ],
                onChange: () => {
                    this._switchBrushMaskPanes();
                    this._setBrushMask();
                }
            });
            {
                this._fillReplaceSubPane = this._fillConstraintsSubPane.createSubPane({
                    title: this.localize("fillConstraints.replace.title")
                });
                this._blockListReplaceTable = this._fillReplaceSubPane?.addBlockList({
                    blockList: convertBlockTypesToBlockStrings(this._blockListReplace),
                    onChange: (obj, property, oldValue, newValue) => {
                        const oldVal = oldValue;
                        const newVal = newValue;
                        if (!arraysAreEqual(oldVal, newVal) && this._blockListReplace !== undefined) {
                            this._blockListReplace = convertBlockStringsToBlockType(newVal);
                            this._blockListReplaceTable?.updateBlockList(newVal);
                            this._setBrushMask();
                            this._saveBlockMasks();
                        }
                    }
                });
                this._fillReplaceSubPane.hide();
            }
            {
                this._fillMaskSubPane = this._fillConstraintsSubPane.createSubPane({
                    title: this.localize("fillConstraints.mask.title")
                });
                this._blockListMaskTable = this._fillMaskSubPane?.addBlockList({
                    blockList: convertBlockTypesToBlockStrings(this._blockListMask),
                    onChange: (obj, property, oldValue, newValue) => {
                        const oldVal = oldValue;
                        const newVal = newValue;
                        if (!arraysAreEqual(oldVal, newVal) && this._blockListMask !== undefined) {
                            this._blockListMask = convertBlockStringsToBlockType(newVal);
                            this._blockListMaskTable?.updateBlockList(newVal);
                            this._setBrushMask();
                            this._saveBlockMasks();
                        }
                    }
                });
                this._fillMaskSubPane.hide();
            }
        }
        _setBrushVolume(volume) {
            if (volume === undefined) {
                volume = this.session.extensionContext.brushShapeManager.activeBrushVolume;
                if (volume === undefined) {
                    throw new Error("No active brush volume");
                }
            }
            this.session.extensionContext.brushShapeManager.setBrushShape(volume);
        }
        _getBlockMaskListTypeFromInternalMaskType(internalMaskType) {
            switch (internalMaskType) {
              case InternalMaskType.Mask:
                return server_editor_namespaceObject.BlockMaskListType.Mask;

              case InternalMaskType.Replace:
                return server_editor_namespaceObject.BlockMaskListType.Replace;

              case InternalMaskType.Disabled:
                return server_editor_namespaceObject.BlockMaskListType.Disabled;

              default:
                throw new Error("Invalid internal mask type");
            }
        }
        _getInternalMaskTypeFromBlockMaskListType(blockMaskListType) {
            switch (blockMaskListType) {
              case server_editor_namespaceObject.BlockMaskListType.Mask:
                return InternalMaskType.Mask;

              case server_editor_namespaceObject.BlockMaskListType.Replace:
                return InternalMaskType.Replace;

              case server_editor_namespaceObject.BlockMaskListType.Disabled:
                return InternalMaskType.Disabled;

              default:
                throw new Error("Invalid block mask list type");
            }
        }
        _setBrushMask(mask) {
            if (mask === undefined) {
                mask = {
                    maskType: this._getBlockMaskListTypeFromInternalMaskType(this._internalMaskType.value),
                    blockList: this._internalMaskType.value === InternalMaskType.Mask ? this._blockListMask : this._blockListReplace
                };
            }
            this.session.extensionContext.brushShapeManager.setBrushMask(mask);
        }
        _switchBrushMaskPanes() {
            switch (this._internalMaskType.value) {
              case InternalMaskType.Replace:
                {
                    this._fillMaskSubPane?.hide();
                    this._fillReplaceSubPane?.show();
                    break;
                }

              case InternalMaskType.Mask:
                {
                    this._fillMaskSubPane?.show();
                    this._fillReplaceSubPane?.hide();
                    break;
                }

              case InternalMaskType.Disabled:
                {
                    this._fillMaskSubPane?.hide();
                    this._fillReplaceSubPane?.hide();
                    break;
                }
            }
            this._fillConstraintsSubPane?.show();
        }
        _activateBrush(brushShapeName) {
            if (brushShapeName === undefined) {
                const currentBrushIndex = this._selectedBrushIndex.value;
                const brushShapeList = this.session.extensionContext.brushShapeManager.brushShapeList;
                if (currentBrushIndex < 0 || currentBrushIndex >= brushShapeList.length) {
                    throw new Error("Invalid brush index");
                }
                brushShapeName = brushShapeList[currentBrushIndex].name;
            }
            const volume = this.session.extensionContext.brushShapeManager.switchBrushShape(brushShapeName);
            this.session.extensionContext.brushShapeManager.setBrushShape(volume);
            this._refreshSettings();
            return brushShapeName;
        }
        _refreshSettings() {
            let brushShapeName = this.session.extensionContext.brushShapeManager.activeBrushShape?.name;
            if (brushShapeName === undefined) {
                this.session.log.debug(`No active brush shape - attempting to activate using the current brush index`);
                try {
                    brushShapeName = this._activateBrush();
                } catch (e) {
                    this.session.log.error(`Error activating brush: ${(0, server_editor_namespaceObject.stringFromException)(e)}`);
                    return;
                }
            }
            const brushUISettings = this.session.extensionContext.brushShapeManager.getSettingsUIElements(brushShapeName);
            this._updateSettingsSubPane(brushShapeName, brushUISettings);
        }
        _updateSettingsSubPane(brushShapeName, uiElements) {
            if (!this._brushControlRootPane) {
                this.session.log.debug(`No settings pane`);
                return;
            }
            if (!this._brushSettingsSubPane) {
                this.session.log.debug(`No custom settings pane`);
                return;
            }
            this._brushControlRootPane.hide();
            if (this._customSettingsSubPane) {
                this._brushSettingsSubPane.removeSubPane(this._customSettingsSubPane);
            }
            this._customSettingsSubPane = this._brushSettingsSubPane.createSubPane({
                title: brushShapeName
            });
            this._brushSettingsCollection = [];
            const brushShapeManager = this.session.extensionContext.brushShapeManager;
            for (let i = 0; i < uiElements.length; i++) {
                const element = uiElements[i];
                if (element === undefined) {
                    continue;
                }
                const elementName = element.name;
                if (elementName.length === 0) {
                    continue;
                }
                if (typeof element.initialValue === "number") {
                    const elementIndex = this._brushSettingsCollection.push((0, server_editor_namespaceObject.makeObservable)(element.initialValue)) - 1;
                    const item = this._customSettingsSubPane.addNumber(this._brushSettingsCollection[elementIndex], {
                        title: elementName,
                        min: Number(element.options.min ?? BrushPaintSharedControl.DEFAULT_NUMBER_MIN),
                        max: Number(element.options.max ?? BrushPaintSharedControl.DEFAULT_NUMBER_MAX),
                        variant: server_editor_namespaceObject.NumberPropertyItemVariant.InputFieldAndSlider,
                        enable: true,
                        visible: true,
                        isInteger: true,
                        onChange: (newValue, _) => {
                            if (element.options.refreshOnChange === true) {
                                if (item !== undefined) {
                                    item.visible = false;
                                }
                                if (this._customSettingsSubPane !== undefined) {
                                    this._customSettingsSubPane.hide();
                                }
                            }
                            this._enqueueUpdateOperation((() => brushShapeManager.uiSettingValueChanged(elementName, newValue)));
                        }
                    });
                } else if (typeof element.initialValue === "boolean") {
                    const elementIndex = this._brushSettingsCollection.push((0, server_editor_namespaceObject.makeObservable)(element.initialValue)) - 1;
                    const item = this._customSettingsSubPane.addBool(this._brushSettingsCollection[elementIndex], {
                        title: elementName,
                        enable: true,
                        visible: true,
                        onChange: (newValue, _) => {
                            if (element.options.refreshOnChange === true) {
                                if (item !== undefined) {
                                    item.visible = false;
                                }
                                if (this._customSettingsSubPane !== undefined) {
                                    this._customSettingsSubPane.hide();
                                }
                            }
                            this._enqueueUpdateOperation((() => brushShapeManager.uiSettingValueChanged(elementName, newValue)));
                        }
                    });
                } else if (typeof element.initialValue === "string") {
                    if (element.options.dropdownItems) {
                        const dropdownOptions = element.options.dropdownItems;
                        let initialIndex = dropdownOptions.indexOf(element.initialValue);
                        if (initialIndex === -1) {
                            initialIndex = 0;
                        }
                        const elementIndex = this._brushSettingsCollection.push((0, server_editor_namespaceObject.makeObservable)(initialIndex)) - 1;
                        const dropdownItems = dropdownOptions.map(((key, index) => {
                            const item = {
                                label: key,
                                value: index
                            };
                            return item;
                        }));
                        const item = this._customSettingsSubPane.addDropdown(this._brushSettingsCollection[elementIndex], {
                            title: elementName,
                            entries: dropdownItems,
                            onChange: newValue => {
                                if (element.options.refreshOnChange === true) {
                                    if (item !== undefined) {
                                        item.visible = false;
                                    }
                                    if (this._customSettingsSubPane !== undefined) {
                                        this._customSettingsSubPane.hide();
                                    }
                                }
                                this._enqueueUpdateOperation((() => brushShapeManager.uiSettingValueChanged(elementName, dropdownOptions[newValue])));
                            }
                        });
                    } else {
                        const elementIndex = this._brushSettingsCollection.push((0, server_editor_namespaceObject.makeObservable)(element.initialValue)) - 1;
                        const item = this._customSettingsSubPane.addString(this._brushSettingsCollection[elementIndex], {
                            title: elementName,
                            enable: true,
                            visible: true,
                            onChange: newValue => {
                                if (element.options.refreshOnChange === true) {
                                    if (item !== undefined) {
                                        item.visible = false;
                                    }
                                    if (this._customSettingsSubPane !== undefined) {
                                        this._customSettingsSubPane.hide();
                                    }
                                }
                                this._enqueueUpdateOperation((() => brushShapeManager.uiSettingValueChanged(elementName, newValue)));
                            }
                        });
                    }
                } else {
                    const elementIndex = this._brushSettingsCollection.push((0, server_editor_namespaceObject.makeObservable)(element.initialValue)) - 1;
                    const item = this._customSettingsSubPane.addVector3(this._brushSettingsCollection[elementIndex], {
                        title: elementName,
                        enable: true,
                        visible: true,
                        onChange: (newValue, oldValue) => {
                            const ov = oldValue;
                            const nvv = newValue;
                            if (ov.x !== undefined && nvv.x !== undefined && !lib.Vector3Utils.equals(ov, nvv)) {
                                if (element.options.refreshOnChange === true) {
                                    if (item !== undefined) {
                                        item.visible = false;
                                    }
                                    if (this._customSettingsSubPane !== undefined) {
                                        this._customSettingsSubPane.hide();
                                    }
                                }
                                this._enqueueUpdateOperation((() => brushShapeManager.uiSettingValueChanged(elementName, nvv)));
                            }
                        }
                    });
                }
            }
            this._customSettingsSubPane.show();
            this._brushSettingsSubPane.show();
            this._brushControlRootPane.show();
        }
        _enqueueUpdateOperation(f) {
            this._updateSettingsOperations.push(f);
        }
        _runUpdateOperation() {
            let needsRefresh = false;
            if (this._updateSettingsOperations.length > 0) {
                for (;;) {
                    const f = this._updateSettingsOperations.shift();
                    if (f === undefined) {
                        break;
                    }
                    needsRefresh || (needsRefresh = f());
                }
                if (needsRefresh) {
                    this._refreshSettings();
                }
                this._setBrushVolume();
            }
        }
        _saveBlockMasks() {
            const maskList = convertBlockTypesToBlockStrings(this._blockListMask);
            this.session.extensionContext.player.setDynamicProperty(PROPERTY_BRUSHPAINTCONTROL_BLOCKMASK_SETTINGS_MASK, JSON.stringify(maskList));
            const replaceList = convertBlockTypesToBlockStrings(this._blockListReplace);
            this.session.extensionContext.player.setDynamicProperty(PROPERTY_BRUSHPAINTCONTROL_BLOCKMASK_SETTINGS_REPLACE, JSON.stringify(replaceList));
        }
        _loadBlockMask(key, defaultList) {
            const data = this.session.extensionContext.player.getDynamicProperty(key);
            if (data) {
                try {
                    const blockStringList = JSON.parse(data);
                    if (blockStringList !== undefined && blockStringList.length > 0) {
                        const blockList = convertBlockStringsToBlockType(blockStringList);
                        if (blockList.length > 0) {
                            return blockList;
                        }
                    }
                    return defaultList;
                } catch (error) {
                    return defaultList;
                }
            }
            return defaultList;
        }
        _getRelativeNudgeDirection(direction) {
            const rotationY = this.session.extensionContext.player.getRotation().y;
            const rotationCorrectedVector = getRotationCorrectedDirectionVector(rotationY, direction);
            return rotationCorrectedVector;
        }
        _nudgeOffset(nudgeVector) {
            let update = lib.Vector3Utils.add(this._brushShapeOffset.value, nudgeVector);
            update = lib.Vector3Utils.clamp(update, {
                min: BrushPaintSharedControl.MIN_OFFSET,
                max: BrushPaintSharedControl.MAX_OFFSET
            });
            this._brushShapeOffset.set(update);
            this.session.extensionContext.brushShapeManager.setBrushShapeOffset(update);
        }
    }
    BrushPaintSharedControl.DEFAULT_NUMBER_MIN = 1;
    BrushPaintSharedControl.DEFAULT_NUMBER_MAX = 6;
    BrushPaintSharedControl.MIN_OFFSET = {
        x: -20,
        y: -20,
        z: -20
    };
    BrushPaintSharedControl.MAX_OFFSET = {
        x: 20,
        y: 20,
        z: 20
    };
    const PROPERTY_CURSORMODECONTROL_NAME = "CursorModeControl";
    const PROPERTY_CURSORMODECONTROL_LOCALIZATION_PREFIX = `resourcePack.editor.${PROPERTY_CURSORMODECONTROL_NAME}`;
    class CursorModeControl extends SharedControlImpl {
        get cursorProperties() {
            const props = {
                ...this._overrideCursorProperties,
                controlMode: this._mouseControlMode.value,
                targetMode: this._cursorTargetMode.value,
                fixedModeDistance: this._fixedDistanceCursor.value
            };
            return props;
        }
        constructor(_session, _parentTool, _parentPropertyPane, _bindManualInput, _overrideCursorProperties, _options) {
            super(_session, _parentTool, _parentPropertyPane, PROPERTY_CURSORMODECONTROL_NAME, PROPERTY_CURSORMODECONTROL_LOCALIZATION_PREFIX);
            this._options = _options;
            this._controlRootPane = undefined;
            this._mouseControlMode = (0, server_editor_namespaceObject.makeObservable)(server_editor_namespaceObject.CursorControlMode.KeyboardAndMouse);
            this._cursorTargetMode = (0, server_editor_namespaceObject.makeObservable)(server_editor_namespaceObject.CursorTargetMode.Block);
            this._projectThroughWater = (0, server_editor_namespaceObject.makeObservable)(true);
            this._fixedDistanceCursor = (0, server_editor_namespaceObject.makeObservable)(5);
            this._canMoveManually = () => true;
            this._updateCursorProperties = (_session, _cursorControlMode, _cursorTargetMode, _fixedDistanceValue, _fixedDistanceSliderControl) => {
                const cursorProperties = {
                    ...this._overrideCursorProperties,
                    controlMode: _cursorControlMode,
                    targetMode: _cursorTargetMode,
                    fixedModeDistance: _fixedDistanceValue
                };
                if (_fixedDistanceSliderControl) {
                    _fixedDistanceSliderControl.visible = _cursorControlMode === server_editor_namespaceObject.CursorControlMode.Fixed;
                }
                if (_cursorControlMode === server_editor_namespaceObject.CursorControlMode.Keyboard) {
                    this.session.toolRail.focusToolInputContext();
                }
                _session.extensionContext.cursor.setProperties(cursorProperties);
            };
            this._storedCursorProperties = this.session.extensionContext.cursor.getProperties();
            this._overrideCursorProperties = {
                ..._overrideCursorProperties
            };
            this._bindManualInput = _bindManualInput ?? true;
            const currentCursorProperties = _overrideCursorProperties ?? this._storedCursorProperties;
            this._mouseControlMode.set(currentCursorProperties.controlMode ?? server_editor_namespaceObject.CursorControlMode.KeyboardAndMouse);
            this._cursorTargetMode.set(currentCursorProperties.targetMode ?? server_editor_namespaceObject.CursorTargetMode.Block);
            this._projectThroughWater.set(currentCursorProperties.projectThroughLiquid ?? true);
            this._fixedDistanceCursor.set(currentCursorProperties.fixedModeDistance ?? 5);
        }
        bindMovementFunctions(canMove, moveForward, moveBack, moveLeft, moveRight, moveUp, moveDown) {
            this._canMoveManually = canMove ?? this._canMoveManually;
            this._moveForward = moveForward;
            this._moveBack = moveBack;
            this._moveLeft = moveLeft;
            this._moveRight = moveRight;
            this._moveUp = moveUp;
            this._moveDown = moveDown;
        }
        initialize() {
            super.initialize();
            this.tool.onModalToolActivation.subscribe((eventData => {
                if (eventData.isActiveTool) {
                    this._updateCursorProperties(this.session, this._mouseControlMode.value, this._cursorTargetMode.value, this._fixedDistanceCursor.value, this._fixedDistanceSliderControl);
                } else {
                    this.session.extensionContext.cursor.setProperties(this._storedCursorProperties);
                }
            }));
            if (this._bindManualInput) {
                const _moveBlockCursorManually = (_session, _direction) => {
                    const rotationY = _session.extensionContext.player.getRotation().y;
                    const rotationCorrectedVector = getRotationCorrectedDirectionVector(rotationY, _direction);
                    _session.extensionContext.cursor.moveBy(rotationCorrectedVector);
                };
                const keyUpAction = this.session.actionManager.createAction({
                    actionType: server_editor_namespaceObject.ActionTypes.NoArgsAction,
                    onExecute: () => {
                        if (this._canMoveManually()) {
                            this.session.extensionContext.cursor.moveBy(lib.VECTOR3_UP);
                            if (this._moveUp) {
                                this._moveUp();
                            }
                        }
                    }
                });
                const keyDownAction = this.session.actionManager.createAction({
                    actionType: server_editor_namespaceObject.ActionTypes.NoArgsAction,
                    onExecute: () => {
                        if (this._canMoveManually()) {
                            this.session.extensionContext.cursor.moveBy(lib.VECTOR3_DOWN);
                            if (this._moveDown) {
                                this._moveDown();
                            }
                        }
                    }
                });
                const keyLeftAction = this.session.actionManager.createAction({
                    actionType: server_editor_namespaceObject.ActionTypes.NoArgsAction,
                    onExecute: () => {
                        if (this._canMoveManually()) {
                            _moveBlockCursorManually(this.session, Direction.Left);
                            if (this._moveLeft) {
                                this._moveLeft();
                            }
                        }
                    }
                });
                const keyRightAction = this.session.actionManager.createAction({
                    actionType: server_editor_namespaceObject.ActionTypes.NoArgsAction,
                    onExecute: () => {
                        if (this._canMoveManually()) {
                            _moveBlockCursorManually(this.session, Direction.Right);
                            if (this._moveRight) {
                                this._moveRight();
                            }
                        }
                    }
                });
                const keyForwardAction = this.session.actionManager.createAction({
                    actionType: server_editor_namespaceObject.ActionTypes.NoArgsAction,
                    onExecute: () => {
                        if (this._canMoveManually()) {
                            _moveBlockCursorManually(this.session, Direction.Forward);
                            if (this._moveForward) {
                                this._moveForward();
                            }
                        }
                    }
                });
                const keyBackAction = this.session.actionManager.createAction({
                    actionType: server_editor_namespaceObject.ActionTypes.NoArgsAction,
                    onExecute: () => {
                        if (this._canMoveManually()) {
                            _moveBlockCursorManually(this.session, Direction.Back);
                            if (this._moveBack) {
                                this._moveBack();
                            }
                        }
                    }
                });
                this.registerToolKeyBinding(keyForwardAction, {
                    key: server_editor_namespaceObject.KeyboardKey.UP
                }, "moveCursorForward");
                this.registerToolKeyBinding(keyBackAction, {
                    key: server_editor_namespaceObject.KeyboardKey.DOWN
                }, "moveCursorBack");
                this.registerToolKeyBinding(keyLeftAction, {
                    key: server_editor_namespaceObject.KeyboardKey.LEFT
                }, "moveCursorLeft");
                this.registerToolKeyBinding(keyRightAction, {
                    key: server_editor_namespaceObject.KeyboardKey.RIGHT
                }, "moveCursorRight");
                this.registerToolKeyBinding(keyUpAction, {
                    key: server_editor_namespaceObject.KeyboardKey.PAGE_UP
                }, "moveCursorUp");
                this.registerToolKeyBinding(keyDownAction, {
                    key: server_editor_namespaceObject.KeyboardKey.PAGE_DOWN
                }, "moveCursorDown");
                {
                    const keyToggleMouseControlModeAction = this.session.actionManager.createAction({
                        actionType: server_editor_namespaceObject.ActionTypes.NoArgsAction,
                        onExecute: () => {
                            const currentMode = this._mouseControlMode.value;
                            if (currentMode === server_editor_namespaceObject.CursorControlMode.Fixed) {
                                return;
                            }
                            const newMode = currentMode === server_editor_namespaceObject.CursorControlMode.Keyboard ? server_editor_namespaceObject.CursorControlMode.KeyboardAndMouse : server_editor_namespaceObject.CursorControlMode.Keyboard;
                            this._mouseControlMode.set(newMode);
                            this._updateCursorProperties(this.session, this._mouseControlMode.value, this._cursorTargetMode.value, this._fixedDistanceCursor.value, this._fixedDistanceSliderControl);
                        }
                    });
                    this.registerToolKeyBinding(keyToggleMouseControlModeAction, {
                        key: server_editor_namespaceObject.KeyboardKey.KEY_C
                    }, "toggleMouseTracking");
                }
                {
                    const keyToggleFixedControlModeAction = this.session.actionManager.createAction({
                        actionType: server_editor_namespaceObject.ActionTypes.NoArgsAction,
                        onExecute: () => {
                            const currentMode = this._mouseControlMode.value;
                            const newMode = currentMode === server_editor_namespaceObject.CursorControlMode.Fixed ? server_editor_namespaceObject.CursorControlMode.KeyboardAndMouse : server_editor_namespaceObject.CursorControlMode.Fixed;
                            this._mouseControlMode.set(newMode);
                            this._updateCursorProperties(this.session, this._mouseControlMode.value, this._cursorTargetMode.value, this._fixedDistanceCursor.value, this._fixedDistanceSliderControl);
                        }
                    });
                    this.registerToolKeyBinding(keyToggleFixedControlModeAction, {
                        key: server_editor_namespaceObject.KeyboardKey.KEY_F
                    }, "toggleFixedDistance");
                    const mouseWheelAction = this.session.actionManager.createAction({
                        actionType: server_editor_namespaceObject.ActionTypes.MouseRayCastAction,
                        onExecute: (mouseRay, mouseProps) => {
                            if (mouseProps.inputType === server_editor_namespaceObject.MouseInputType.WheelOut) {
                                if (this._mouseControlMode.value === server_editor_namespaceObject.CursorControlMode.Fixed) {
                                    let currentDistance = this._fixedDistanceCursor.value;
                                    if (mouseProps.modifiers.shift) {
                                        currentDistance += 5;
                                    } else {
                                        currentDistance += 1;
                                    }
                                    if (currentDistance > CursorModeControl.MAX_FIXED_DISTANCE) {
                                        currentDistance = CursorModeControl.MAX_FIXED_DISTANCE;
                                    }
                                    this._fixedDistanceCursor.set(currentDistance);
                                    this._updateCursorProperties(this.session, this._mouseControlMode.value, this._cursorTargetMode.value, this._fixedDistanceCursor.value, this._fixedDistanceSliderControl);
                                }
                            } else if (mouseProps.inputType === server_editor_namespaceObject.MouseInputType.WheelIn) {
                                if (this._mouseControlMode.value === server_editor_namespaceObject.CursorControlMode.Fixed) {
                                    let currentDistance = this._fixedDistanceCursor.value;
                                    if (mouseProps.modifiers.shift) {
                                        currentDistance -= 5;
                                    } else {
                                        currentDistance -= 1;
                                    }
                                    if (currentDistance < CursorModeControl.MIN_FIXED_DISTANCE) {
                                        currentDistance = CursorModeControl.MIN_FIXED_DISTANCE;
                                    }
                                    this._fixedDistanceCursor.set(currentDistance);
                                    this._updateCursorProperties(this.session, this._mouseControlMode.value, this._cursorTargetMode.value, this._fixedDistanceCursor.value, this._fixedDistanceSliderControl);
                                }
                            }
                        }
                    });
                    this.tool.registerMouseWheelBinding(mouseWheelAction);
                }
                {
                    const keyToggleTargetModeAction = this.session.actionManager.createAction({
                        actionType: server_editor_namespaceObject.ActionTypes.NoArgsAction,
                        onExecute: () => {
                            const currentMode = this._cursorTargetMode.value;
                            const newMode = currentMode === server_editor_namespaceObject.CursorTargetMode.Block ? server_editor_namespaceObject.CursorTargetMode.Face : server_editor_namespaceObject.CursorTargetMode.Block;
                            this._cursorTargetMode.set(newMode);
                            this._updateCursorProperties(this.session, this._mouseControlMode.value, this._cursorTargetMode.value, this._fixedDistanceCursor.value, this._fixedDistanceSliderControl);
                        }
                    });
                    this.registerToolKeyBinding(keyToggleTargetModeAction, {
                        key: server_editor_namespaceObject.KeyboardKey.KEY_B
                    }, "toggleBlockTargetMode");
                }
                this._updateCursorProperties(this.session, this._mouseControlMode.value, this._cursorTargetMode.value, this._fixedDistanceCursor.value, this._fixedDistanceSliderControl);
            }
        }
        shutdown() {
            super.shutdown();
            if (this._cursorPropertyEventSub) {
                this.session.extensionContext.afterEvents.cursorPropertyChange.unsubscribe(this._cursorPropertyEventSub);
            }
            this.session.extensionContext.cursor.setProperties(this._storedCursorProperties);
        }
        activateControl() {
            super.activateControl();
            this._constructControlUI();
            this.propertyPane.show();
        }
        deactivateControl() {
            super.deactivateControl();
            this._destroyControlUI();
        }
        _destroyControlUI() {
            if (this._controlRootPane) {
                this._controlRootPane.hide();
                this.propertyPane.removeSubPane(this._controlRootPane);
                this._controlRootPane = undefined;
            }
        }
        _constructControlUI() {
            if (this._controlRootPane) {
                this._destroyControlUI();
            }
            this._controlRootPane = this.propertyPane.createSubPane({
                title: this.localize("rootPane.title"),
                hasMargins: this._options?.hasPaneMargins
            });
            {
                this._controlRootPane.addDropdown(this._mouseControlMode, {
                    title: this.localize("mouseControlMode.title"),
                    tooltip: this.localize("mouseControlMode.tooltip"),
                    entries: [ {
                        label: this.localize("mouseControlMode.keyboard"),
                        value: server_editor_namespaceObject.CursorControlMode.Keyboard
                    }, {
                        label: this.localize("mouseControlMode.keyboardAndMouse"),
                        value: server_editor_namespaceObject.CursorControlMode.KeyboardAndMouse
                    }, {
                        label: this.localize("mouseControlMode.fixed"),
                        value: server_editor_namespaceObject.CursorControlMode.Fixed
                    } ],
                    onChange: () => {
                        this._updateCursorProperties(this.session, this._mouseControlMode.value, this._cursorTargetMode.value, this._fixedDistanceCursor.value, this._fixedDistanceSliderControl);
                    }
                });
                const cursorProperties = this.session.extensionContext.cursor.getProperties();
                this._fixedDistanceCursor.set(cursorProperties.fixedModeDistance ?? 5);
                const fixedDistanceSliderVisible = cursorProperties.controlMode === server_editor_namespaceObject.CursorControlMode.Fixed;
                this._fixedDistanceSliderControl = this._controlRootPane.addNumber(this._fixedDistanceCursor, {
                    visible: fixedDistanceSliderVisible,
                    isInteger: true,
                    min: CursorModeControl.MIN_FIXED_DISTANCE,
                    max: CursorModeControl.MAX_FIXED_DISTANCE,
                    title: this.localize("fixedDistance.slider.title"),
                    tooltip: this.localize("fixedDistance.slider.tooltip"),
                    variant: server_editor_namespaceObject.NumberPropertyItemVariant.InputFieldAndSlider,
                    onChange: () => {
                        this._updateCursorProperties(this.session, this._mouseControlMode.value, this._cursorTargetMode.value, this._fixedDistanceCursor.value, this._fixedDistanceSliderControl);
                    }
                });
                this.session.extensionContext.afterEvents.cursorPropertyChange.subscribe((_event => {
                    if (_event.properties.fixedModeDistance !== undefined && _event.properties.fixedModeDistance !== this._fixedDistanceCursor.value) {
                        this._fixedDistanceCursor.set(_event.properties.fixedModeDistance);
                    }
                }));
            }
            {
                this._controlRootPane.addToggleGroup(this._cursorTargetMode, {
                    title: this.localize("cursorTargetMode.title"),
                    tooltip: this.localize("cursorTargetMode.tooltip"),
                    entries: [ {
                        label: this.localize("cursorTargetMode.block"),
                        tooltip: this.localize("cursorTargetMode.block.tooltip"),
                        value: server_editor_namespaceObject.CursorTargetMode.Block,
                        icon: "pack://textures/editor/block-mode.png"
                    }, {
                        label: this.localize("cursorTargetMode.face"),
                        tooltip: this.localize("cursorTargetMode.face.tooltip"),
                        value: server_editor_namespaceObject.CursorTargetMode.Face,
                        icon: "pack://textures/editor/face-mode.png"
                    } ],
                    onChange: () => {
                        this._updateCursorProperties(this.session, this._mouseControlMode.value, this._cursorTargetMode.value, this._fixedDistanceCursor.value, this._fixedDistanceSliderControl);
                    }
                });
            }
            {
                this._controlRootPane.addBool(this._projectThroughWater, {
                    title: this.localize("projectThroughWater.title"),
                    tooltip: this.localize("projectThroughWater.tooltip"),
                    onChange: () => {
                        const cursorProperties = {
                            projectThroughLiquid: this._projectThroughWater.value
                        };
                        this.session.extensionContext.cursor.setProperties(cursorProperties);
                    }
                });
                this._cursorPropertyEventSub = this.session.extensionContext.afterEvents.cursorPropertyChange.subscribe((event => {
                    if (event.properties.projectThroughLiquid !== undefined) {
                        this._projectThroughWater.set(event.properties.projectThroughLiquid);
                    }
                }));
            }
            this._controlRootPane?.show();
        }
    }
    CursorModeControl.MAX_FIXED_DISTANCE = 40;
    CursorModeControl.MIN_FIXED_DISTANCE = 1;
    const SHOULD_LOG_TELEMETRY = false;
    var TelemetrySource;
    (function(TelemetrySource) {
        TelemetrySource["Selection"] = "SELECTION";
        TelemetrySource["PastePreview"] = "PASTE_PREVIEW";
        TelemetrySource["Line"] = "LINE";
        TelemetrySource["Summon"] = "SUMMON";
        TelemetrySource["Ruler"] = "RULER";
        TelemetrySource["Brush"] = "BRUSH";
        TelemetrySource["Flatten"] = "FLATTEN";
        TelemetrySource["SmartFill"] = "SMART_FILL";
        TelemetrySource["Terrain"] = "TERRAIN";
        TelemetrySource["Extrude"] = "EXTRUDE";
        TelemetrySource["Repeater"] = "REPEATER";
        TelemetrySource["Farm"] = "FARM";
        TelemetrySource["Grapple"] = "GRAPPLE";
        TelemetrySource["DeferredLighting"] = "DEFERRED_LIGHTING";
        TelemetrySource["TimeOfDay"] = "TIME_OF_DAY";
        TelemetrySource["Export"] = "EXPORT";
        TelemetrySource["TestWorld"] = "TEST_WORLD";
        TelemetrySource["ViewSettings"] = "VIEW_SETTINGS";
        TelemetrySource["Locate"] = "LOCATE";
        TelemetrySource["Navigation"] = "NAVIGATION";
    })(TelemetrySource || (TelemetrySource = {}));
    function fireTelemetryEvent(player, source, eventName, properties = {}) {
        if (SHOULD_LOG_TELEMETRY) {
            server_editor_namespaceObject.editor.log.debug(`${source}::${eventName}::${JSON.stringify(properties)}`, {
                player,
                tags: [ "Telemetry" ]
            });
        }
        server_editor_bindings_namespaceObject.editorInternal.fireTelemetryEvent(player, source, eventName, JSON.stringify(properties));
    }
    class TelemetryManager {
        constructor(player, telemetrySource) {
            this._player = player;
            this._source = telemetrySource;
        }
        fireTelemetryEvent(eventName, properties = {}, shouldFire = true) {
            if (!shouldFire) {
                return;
            }
            fireTelemetryEvent(this._player, this._source, eventName, properties);
        }
    }
    class logInterface {
        debug(_m) {
            if (this._debug) this._debug(_m);
        }
        error(_m) {
            if (this._error) this._error(_m);
        }
        onStep(_path, _key, _type, _data, _properties) {
            if (this._onStep) {
                this._onStep(_path, _key, _type, _data, _properties);
            }
        }
    }
    var OpNodeSourceType;
    (function(OpNodeSourceType) {
        OpNodeSourceType["NULL"] = "null";
        OpNodeSourceType["BOOLEAN"] = "boolean";
        OpNodeSourceType["OBJECT"] = "object";
        OpNodeSourceType["ARRAY"] = "array";
        OpNodeSourceType["NUMBER"] = "number";
        OpNodeSourceType["INTEGER"] = "integer";
        OpNodeSourceType["STRING"] = "string";
        OpNodeSourceType["MAP"] = "map";
        OpNodeSourceType["ENUM"] = "enum";
    })(OpNodeSourceType || (OpNodeSourceType = {}));
    function _isDataOfType(data, type) {
        switch (type) {
          case OpNodeSourceType.NULL:
            return data === undefined;

          case OpNodeSourceType.BOOLEAN:
            return typeof data === "boolean";

          case OpNodeSourceType.ARRAY:
            return Array.isArray(data);

          case OpNodeSourceType.NUMBER:
            return typeof data === "number";

          case OpNodeSourceType.INTEGER:
            return Number.isInteger(data);

          case OpNodeSourceType.STRING:
            return typeof data === "string";

          case OpNodeSourceType.MAP:
          case OpNodeSourceType.OBJECT:
            return typeof data === "object";

          case OpNodeSourceType.ENUM:
            return typeof data === "string";

          default:
            return false;
        }
    }
    var OpNodeEditorUIControlType;
    (function(OpNodeEditorUIControlType) {
        OpNodeEditorUIControlType["FLOAT"] = "float";
        OpNodeEditorUIControlType["TEXT"] = "text";
        OpNodeEditorUIControlType["SLIDER"] = "slider";
        OpNodeEditorUIControlType["CHECKBOX"] = "checkbox";
        OpNodeEditorUIControlType["COLOR"] = "color";
        OpNodeEditorUIControlType["VECTOR3"] = "vector3";
        OpNodeEditorUIControlType["DROPDOWN"] = "dropdown";
        OpNodeEditorUIControlType["UNKNOWN"] = "unknown";
    })(OpNodeEditorUIControlType || (OpNodeEditorUIControlType = {}));
    class OpPropertyPattern {
        constructor(pattern) {
            this._pattern = pattern;
        }
        get pattern() {
            return this._pattern;
        }
        clone() {
            return new OpPropertyPattern(this._pattern);
        }
        toString() {
            return `Pattern(${this._pattern})`;
        }
        validate(_key, _data, _log) {
            if (typeof _data !== "string") {
                _log?.error(`Key(${_key}): Data(${JSON.stringify(_data)}) is not a string`);
                return false;
            }
            const regex = new RegExp(this._pattern);
            const isMatch = regex.test(_data);
            if (!isMatch) {
                _log?.error(`Key(${_key}): Data(${String(_data)}) does not match pattern(${this._pattern})`);
            }
            return isMatch;
        }
    }
    class OpPropertyEditorTag {
        constructor(editorTag) {
            this._editorTag = editorTag;
        }
        get editorTag() {
            return this._editorTag;
        }
        clone() {
            return new OpPropertyEditorTag(this._editorTag);
        }
        toString() {
            return `Editor tag (${this._editorTag})`;
        }
        validate(_key, _data, _log) {
            const editorRegex = /\[editor\([^)]+\)\]/;
            const isMatch = editorRegex.test(this.editorTag);
            if (!isMatch) {
                _log?.error(`Data(${this._editorTag}) does not match Pattern of CEREAL_EDITOR_SCHEMA_TAG`);
                return false;
            }
            return true;
        }
    }
    class OpPropertyValueRange {
        constructor(minimum, maximum) {
            this._minimum = minimum;
            this._maximum = maximum;
        }
        get min() {
            return this._minimum;
        }
        get max() {
            return this._maximum;
        }
        clone() {
            return new OpPropertyValueRange(this._minimum, this._maximum);
        }
        toString() {
            return `ValueRange(${this._minimum}, ${this._maximum})`;
        }
        validate(_key, data, _log) {
            if (typeof data !== "number") {
                _log?.error(`Key(${_key}): Data(${JSON.stringify(data)}) is not a number`);
                return false;
            }
            const isInRange = data >= this._minimum && data <= this._maximum;
            if (!isInRange) {
                _log?.error(`Key(${_key}): Data(${Number(data)}) is not in range(${this._minimum}, ${this._maximum})`);
            }
            return isInRange;
        }
    }
    class OpPropertyArrayBounds {
        constructor(minItems, maxItems) {
            this._minItems = minItems;
            this._maxItems = maxItems;
        }
        get minItems() {
            return this._minItems;
        }
        get maxItems() {
            return this._maxItems;
        }
        clone() {
            return new OpPropertyArrayBounds(this._minItems, this._maxItems);
        }
        toString() {
            return `ArrayBounds(${String(this._minItems)}, ${String(this._maxItems)})`;
        }
        validate(_key, _data, _log) {
            if (!Array.isArray(_data)) {
                return false;
            }
            if (this._minItems !== undefined && _data.length < this._minItems) {
                _log?.error(`Key(${_key}): Data(${JSON.stringify(_data)}) has less than min items(${this._minItems})`);
                return false;
            }
            if (this._maxItems !== undefined && _data.length > this._maxItems) {
                _log?.error(`Key(${_key}): Data(${JSON.stringify(_data)}) has more than max items(${this._maxItems})`);
                return false;
            }
            return true;
        }
    }
    class OpPropertyMapBounds {
        constructor(minProperties, maxProperties) {
            this._minProperties = minProperties;
            this._maxProperties = maxProperties;
        }
        get minProperties() {
            return this._minProperties;
        }
        get maxProperties() {
            return this._maxProperties;
        }
        clone() {
            return new OpPropertyMapBounds(this._minProperties, this._maxProperties);
        }
        toString() {
            return `MapBounds(${String(this._minProperties)}, ${String(this._maxProperties)})`;
        }
        validate(_key, _data, _log) {
            if (typeof _data !== "object") {
                return false;
            }
            const keys = Object.keys(_data);
            if (this._minProperties !== undefined && keys.length < this._minProperties) {
                _log?.error(`Key(${_key}): Data(${JSON.stringify(_data)}) has less than min properties(${this._minProperties})`);
                return false;
            }
            if (this._maxProperties !== undefined && keys.length > this._maxProperties) {
                _log?.error(`Key(${_key}): Data(${JSON.stringify(_data)}) has more than max properties(${this._maxProperties})`);
                return false;
            }
            return true;
        }
    }
    class OpPropertyStringLiteral {
        constructor(literal) {
            this._literal = literal;
        }
        get literal() {
            return this._literal;
        }
        clone() {
            return new OpPropertyStringLiteral(this._literal);
        }
        toString() {
            return `Literal(${this._literal})`;
        }
        validate(_key, _data, _log) {
            const isMatch = _key.localeCompare(this._literal) === 0;
            return isMatch;
        }
    }
    class OpPropertyEnum {
        constructor(enums) {
            this._enums = [];
            this._prettyEnums = [];
            this._enums = enums;
            this._prettyEnums = enums.map((e => e));
        }
        get enums() {
            return this._enums;
        }
        get prettyEnums() {
            return this._prettyEnums;
        }
        prettifyEnums(prettyFunction) {
            this._prettyEnums = this._enums.map((e => prettyFunction(e)));
        }
        getIndexOf(data) {
            let index = this._enums.indexOf(data);
            if (index < 0) {
                index = this._prettyEnums.indexOf(data);
            }
            return index;
        }
        clone() {
            return new OpPropertyEnum(this._enums);
        }
        toString() {
            return `Enum(${this._prettyEnums.join(", ")})`;
        }
        validate(_key, _data, _log) {
            if (typeof _data !== "string") {
                return false;
            }
            const isMatch = this._enums.includes(_data) || this._prettyEnums.includes(_data);
            if (!isMatch) {
                _log?.error(`Key(${_key}): Data(${_data}) is not in enum[${this._enums.join(", ")}]`);
            }
            return isMatch;
        }
    }
    class OpPropertyReadOnly {
        clone() {
            return new OpPropertyReadOnly;
        }
        toString() {
            return `ReadOnly(true)`;
        }
        validate(_key, _data, _log) {
            return true;
        }
    }
    class OpPropertyPrettifier {
        clone() {
            return new OpPropertyPrettifier;
        }
        toString() {
            return `Prettify(true)`;
        }
        validate(_key, _data, _log) {
            return true;
        }
        prettify(_input) {
            if (_input.startsWith("minecraft:")) {
                _input = _input.substring(10);
            }
            _input = _input.replace(/_/g, " ");
            _input = _input.replace(/([a-z])([A-Z])/g, "$1 $2");
            _input = _input.split(" ").map((word => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase())).join(" ");
            return _input;
        }
    }
    class OpPropertyLabelAliases {
        constructor(labelRemaps) {
            this._labelRemaps = labelRemaps;
        }
        get aliases() {
            return this._labelRemaps;
        }
        addAlias(_original, _new) {
            this._labelRemaps[_original] = _new;
        }
        clone() {
            return new OpPropertyLabelAliases(this._labelRemaps);
        }
        toString() {
            return `Labels(${Object.entries(this._labelRemaps).map((([key, value]) => `${key}:${value}`)).join(", ")})`;
        }
        validate(_key, _data, _log) {
            if (typeof this._labelRemaps !== "object" && !Array.isArray(this._labelRemaps)) {
                _log?.error(`format for alias ${JSON.stringify(this._labelRemaps)} is invalid`);
                return false;
            }
            const isMatch = Object.keys(this._labelRemaps).every((key => typeof key === "string" && typeof this._labelRemaps[key] === "string"));
            return isMatch;
        }
        getLabelAlias(_label) {
            return this._labelRemaps[_label] ?? _label;
        }
    }
    class OpPropertyType {
        constructor(type) {
            this._type = OpNodeSourceType.NULL;
            this._type = type;
        }
        get type() {
            return this._type;
        }
        clone() {
            return new OpPropertyType(this._type);
        }
        toString() {
            return `Type(${this._type})`;
        }
        validate(_key, _data, _log) {
            return _isDataOfType(_data, this._type);
        }
    }
    class OpPropertyEditorUIControl {
        constructor(controlType) {
            this._controlType = OpNodeEditorUIControlType.UNKNOWN;
            this._controlType = controlType;
        }
        get controlType() {
            return this._controlType;
        }
        clone() {
            return new OpPropertyEditorUIControl(this._controlType);
        }
        toString() {
            return `EditorControl(${this._controlType})`;
        }
        validate(_key, _data, _log) {
            return true;
        }
    }
    class OpPropertyStack {
        constructor() {
            this._properties = [];
        }
        addOrReplaceProperty(property) {
            for (let i = 0; i < this._properties.length; i++) {
                if (this._properties[i].constructor.name === property.constructor.name) {
                    this._properties[i] = property;
                    return;
                }
            }
            this._properties.push(property);
        }
        removeProperty(propType) {
            for (let i = 0; i < this._properties.length; i++) {
                if (this._properties[i].constructor.name === propType) {
                    this._properties.splice(i, 1);
                    return;
                }
            }
        }
        hasProperty(propType) {
            for (let i = 0; i < this._properties.length; i++) {
                if (this._properties[i].constructor.name === propType) {
                    return true;
                }
            }
            return false;
        }
        getProperty(propType) {
            for (let i = 0; i < this._properties.length; i++) {
                if (this._properties[i].constructor.name === propType) {
                    return this._properties[i];
                }
            }
            return undefined;
        }
        _extractEditorProperties(_node, _description) {
            const editorRegex = /editor\(([^)]+)\)/;
            const match = _description.match(editorRegex);
            if (!match) {
                return;
            }
            const editorString = match[1];
            const splitKeyValuePairs = data => {
                const pairs = {};
                let inBraces = false;
                let key = "";
                let value = "";
                let current = "";
                let expectValue = false;
                for (const char of data) {
                    if (char === "{") {
                        inBraces = true;
                        current += char;
                    } else if (char === "}") {
                        inBraces = false;
                        current += char;
                    } else if (char === ":" && !inBraces) {
                        key = current.trim();
                        current = "";
                        expectValue = true;
                    } else if (char === "," && !inBraces) {
                        value = current.trim();
                        pairs[key] = value;
                        current = "";
                        expectValue = false;
                    } else {
                        current += char;
                    }
                }
                if (expectValue) {
                    value = current.trim();
                    pairs[key] = value;
                }
                return pairs;
            };
            const keyValuePairs = splitKeyValuePairs(editorString);
            const aliasRemaps = new OpPropertyLabelAliases({});
            for (const key in keyValuePairs) {
                if (key === "alias" && keyValuePairs[key].startsWith("{") && keyValuePairs[key].endsWith("}")) {
                    const aliasKeyValue = keyValuePairs[key].slice(1, -1);
                    const aliasKeyValuePairs = splitKeyValuePairs(aliasKeyValue);
                    Object.entries(aliasKeyValuePairs).forEach((([aliasKey, aliasValue]) => {
                        aliasRemaps.addAlias(aliasKey, aliasValue);
                    }));
                } else {
                    const value = keyValuePairs[key];
                    if (!(key && value)) {
                        throw new Error(`Invalid [editor(key:value,...) key-value pair: ${JSON.stringify(keyValuePairs)}`);
                    }
                    const prettifyOrReadonlyModifier = value === "true" || value === "1" || value === "yes" || value === "on";
                    if (key === "prettify") {
                        if (prettifyOrReadonlyModifier) {
                            this.addOrReplaceProperty(new OpPropertyPrettifier);
                        }
                    } else if (key === "readonly") {
                        if (prettifyOrReadonlyModifier) {
                            this.addOrReplaceProperty(new OpPropertyReadOnly);
                        }
                    } else if (key === "type") {
                        let controlType = OpNodeEditorUIControlType.FLOAT;
                        switch (value) {
                          case "float":
                          case "number":
                            controlType = OpNodeEditorUIControlType.FLOAT;
                            break;

                          case "text":
                          case "string":
                            controlType = _node.enum !== undefined ? OpNodeEditorUIControlType.DROPDOWN : OpNodeEditorUIControlType.TEXT;
                            break;

                          case "enum":
                          case "dropdown":
                            controlType = OpNodeEditorUIControlType.DROPDOWN;
                            break;

                          case "slider":
                            controlType = OpNodeEditorUIControlType.SLIDER;
                            break;

                          case "checkbox":
                          case "boolean":
                          case "bool":
                            controlType = OpNodeEditorUIControlType.CHECKBOX;
                            break;

                          case "color":
                            controlType = OpNodeEditorUIControlType.COLOR;
                            break;

                          case "vector3":
                          case "vec3":
                            controlType = OpNodeEditorUIControlType.VECTOR3;
                            break;

                          default:
                            controlType = OpNodeEditorUIControlType.UNKNOWN;
                            throw new Error(`Unknown editor control type: ${value}`);
                        }
                        this.addOrReplaceProperty(new OpPropertyEditorUIControl(controlType));
                    }
                }
            }
            if (Object.keys(aliasRemaps.aliases).length > 0) {
                this.addOrReplaceProperty(aliasRemaps);
            }
        }
        extractProperties(node) {
            if (node === undefined) {
                return;
            }
            if (node.type !== undefined) {
                let nodeType = OpNodeSourceType.NULL;
                switch (node.type) {
                  case "null":
                    nodeType = OpNodeSourceType.NULL;
                    break;

                  case "boolean":
                    nodeType = OpNodeSourceType.BOOLEAN;
                    break;

                  case "object":
                    nodeType = node.additionalProperties !== undefined ? OpNodeSourceType.MAP : OpNodeSourceType.OBJECT;
                    break;

                  case "array":
                    nodeType = OpNodeSourceType.ARRAY;
                    break;

                  case "number":
                    nodeType = OpNodeSourceType.NUMBER;
                    break;

                  case "integer":
                    nodeType = OpNodeSourceType.INTEGER;
                    break;

                  case "string":
                    nodeType = node.enum !== undefined ? OpNodeSourceType.ENUM : OpNodeSourceType.STRING;
                    break;

                  default:
                    throw new Error(`Unknown type: ${JSON.stringify(node.type)}`);
                }
                this.addOrReplaceProperty(new OpPropertyType(nodeType));
            }
            if (node.enum !== undefined) {
                const enumArray = [ ...node.enum ];
                this.addOrReplaceProperty(new OpPropertyEnum(enumArray));
            }
            if (node.$metaProperties !== undefined && node.$metaProperties.CEREAL_EDITOR_SCHEMA_TAG !== undefined) {
                this.addOrReplaceProperty(new OpPropertyEditorTag(node.$metaProperties.CEREAL_EDITOR_SCHEMA_TAG));
                const description = String(node.$metaProperties.CEREAL_EDITOR_SCHEMA_TAG).trim();
                this._extractEditorProperties(node, description);
            }
            if (node.minimum !== undefined && node.maximum !== undefined) {
                this.addOrReplaceProperty(new OpPropertyValueRange(node.minimum, node.maximum));
            }
            if (node.pattern !== undefined) {
                this.addOrReplaceProperty(new OpPropertyPattern(node.pattern));
            }
            if (node.minProperties !== undefined || node.maxProperties !== undefined || node.additionalProperties !== undefined) {
                this.addOrReplaceProperty(new OpPropertyMapBounds(node.minProperties, node.maxProperties));
            } else if (node.minItems !== undefined || node.maxItems !== undefined || node.items !== undefined) {
                this.addOrReplaceProperty(new OpPropertyArrayBounds(node.minItems, node.maxItems));
            }
        }
        clone() {
            const stack = new OpPropertyStack;
            for (const property of this._properties) {
                stack.addOrReplaceProperty(property.clone());
            }
            return stack;
        }
        toString() {
            let str = "";
            for (let i = this._properties.length - 1; i >= 0; i--) {
                str += this._properties[i].toString() + " ";
            }
            return str;
        }
        validateAll(_key, _data, _log) {
            for (let i = this._properties.length - 1; i >= 0; i--) {
                if (!this._properties[i].validate(_key, _data, _log)) {
                    return false;
                }
            }
            return true;
        }
        validate(_type, _key, data, _log) {
            const property = this.getProperty(_type);
            if (property === undefined) {
                return true;
            }
            return property.validate(_key, data, _log);
        }
    }
    class OpBaseNode {
        constructor(_tabDepth, _schemaObject, _refMap, _propertyStack, _logger) {
            this._type = OpNodeSourceType.NULL;
            this._children = [];
            this._propertyStack = new OpPropertyStack;
            this._logger = _logger;
            _tabDepth = _tabDepth + "    ";
            if (_schemaObject === undefined) {
                throw new Error("SchemaObject is undefined");
            }
            _propertyStack.extractProperties(_schemaObject);
            _schemaObject = _refMap.resolve(_schemaObject);
            _propertyStack.extractProperties(_schemaObject);
            this._propertyStack = _propertyStack.clone();
            this._title = _schemaObject?.title ?? "";
            this._editorMetaProperties = _schemaObject?.$metaProperties?.CEREAL_EDITOR_SCHEMA_TAG ?? "";
            this._type = _schemaObject?.type ?? OpNodeSourceType.OBJECT;
            this._isArray = _schemaObject?.items !== undefined || this._title === "sequence container";
            this._isMap = _schemaObject?.additionalProperties !== undefined || this._title === "associative container";
            this._id = _schemaObject?.$id ?? "no-id";
            this._oneOf = _schemaObject?.oneOf !== undefined;
            if (this._editorMetaProperties.localeCompare("") !== 0) {
                const editorRegex = /\[editor\([^)]+\)\]/;
                const isMatch = editorRegex.test(this._editorMetaProperties);
                if (!isMatch) {
                    throw new Error(`meta properties of SchemaObject are invalid. CEREAL_EDITOR_SCHEMA_TAG = ${this._editorMetaProperties}`);
                }
            }
            if (this._type === "object" && this._isMap) {
                this._type = OpNodeSourceType.MAP;
            } else if (this._type === "object" && this._isArray) {
                this._type = OpNodeSourceType.ARRAY;
            }
            this._logger?.debug(`${_tabDepth}Title: ${this._title}, Id: ${this._id}, Type: ${this._type}, OneOf: ${this._oneOf}, Array: ${this._isArray}, Map: ${this._isMap}`);
            this._logger?.debug(`  ${_tabDepth}props[ ${this._propertyStack.toString()} ]`);
            if (typeof _schemaObject === "object") {
                if (_schemaObject.oneOf !== undefined) {
                    for (const oneOfObject of _schemaObject.oneOf) {
                        const oneOfPropertyStack = _propertyStack.clone();
                        oneOfPropertyStack.extractProperties(oneOfObject);
                        oneOfPropertyStack.removeProperty("OpPropertyStringLiteral");
                        const node = new OpBaseNode(_tabDepth, oneOfObject, _refMap, oneOfPropertyStack, this._logger);
                        this._children.push(node);
                    }
                } else if (_schemaObject.properties !== undefined) {
                    for (const key in _schemaObject.properties) {
                        const propertyPropertyStack = _propertyStack.clone();
                        let property = _schemaObject.properties[key];
                        propertyPropertyStack.extractProperties(property);
                        property = _refMap.resolve(property);
                        propertyPropertyStack.extractProperties(property);
                        propertyPropertyStack.addOrReplaceProperty(new OpPropertyStringLiteral(key));
                        const node = new OpBaseNode(_tabDepth, property, _refMap, propertyPropertyStack, this._logger);
                        this._children.push(node);
                    }
                } else {
                    if (this._type === OpNodeSourceType.ARRAY) {
                        if (_schemaObject.items !== undefined) {
                            const itemPropertyStack = _propertyStack.clone();
                            itemPropertyStack.extractProperties(_schemaObject.items);
                            itemPropertyStack.removeProperty("OpPropertyArrayBounds");
                            itemPropertyStack.removeProperty("OpPropertyStringLiteral");
                            const node = new OpBaseNode(_tabDepth, _schemaObject.items, _refMap, itemPropertyStack, this._logger);
                            this._children.push(node);
                        }
                    } else if (this._type === OpNodeSourceType.MAP) {
                        const additionalPropertyStack = _propertyStack.clone();
                        additionalPropertyStack.extractProperties(_schemaObject.additionalProperties);
                        additionalPropertyStack.removeProperty("OpPropertyMapBounds");
                        additionalPropertyStack.removeProperty("OpPropertyStringLiteral");
                        const node = new OpBaseNode(_tabDepth, _schemaObject.additionalProperties, _refMap, additionalPropertyStack, this._logger);
                        this._children.push(node);
                    } else {
                        this._logger?.debug(`  ${_tabDepth}No properties or oneOf`);
                    }
                }
            } else {
                this._logger?.debug(`  ${_tabDepth} current schema object is ${typeof _schemaObject} should be type object`);
            }
        }
        validate(_key, _data, _tabDepth, _path) {
            _tabDepth = _tabDepth + "    ";
            if (!this._oneOf && _key !== "") {
                _path += "/" + _key;
            }
            this._logger?.debug(`${_tabDepth}Node: ${this._title}, Type: ${this._type}, Id: ${this._id}, OneOf: ${this._oneOf}, Props: ${this._propertyStack.toString()}, Children: ${this._children.length}`);
            this._logger?.debug(`${_tabDepth}incoming Key: ${_key}, Type: ${typeof _data}, Data: ${JSON.stringify(_data)}, `);
            const isArray = Array.isArray(_data);
            if (!this._oneOf) {
                if (!_isDataOfType(_data, this._type)) {
                    this._logger?.debug(`${_tabDepth}  Type mismatch: ${typeof _data} != ${this._type} (Array: ${isArray})`);
                    return false;
                }
                if (!this._propertyStack.validate("OpPropertyType", _key, _data, this._logger)) {
                    this._logger?.debug(`${_tabDepth}  Type mismatch: ${typeof _data} != ${this._type} (Array: ${isArray})`);
                    return false;
                }
                if (this._type === OpNodeSourceType.ARRAY) {
                    if (!this._propertyStack.validate("OpPropertyArrayBounds", _key, _data, this._logger)) {
                        return false;
                    }
                }
                if (this._type === OpNodeSourceType.MAP) {
                    if (!this._propertyStack.validate("OpPropertyMapBounds", _key, _data, this._logger)) {
                        return false;
                    }
                }
                if (this.type === OpNodeSourceType.STRING) {
                    if (!this._propertyStack.validate("OpPropertyPattern", _key, _data, this._logger)) {
                        return false;
                    }
                }
                if (this.type === OpNodeSourceType.NUMBER || this.type === OpNodeSourceType.INTEGER) {
                    if (!this._propertyStack.validate("OpPropertyValueRange", _key, _data, this._logger)) {
                        return false;
                    }
                }
            }
            if (!this._propertyStack.validate("OpPropertyStringLiteral", _key, _data, this._logger)) {
                return false;
            }
            if (!this._propertyStack.validate("OpPropertyEditorTag", _key, _data, this._logger)) {
                return false;
            }
            if (!this._propertyStack.validate("OpPropertyLabelAliases", _key, _data, this._logger)) {
                return false;
            }
            if (!this._oneOf) {
                if (_path !== "" && _key !== "") {
                    this._logger?.onStep(_path, _key, this._type, _data, this._propertyStack);
                }
            }
            if (this._type === OpNodeSourceType.OBJECT || this._type === OpNodeSourceType.MAP || this._oneOf) {
                if (this._oneOf) {
                    for (const child of this._children) {
                        if (child.validate(_key, _data, _tabDepth, _path)) {
                            return true;
                        }
                    }
                    this._logger?.debug(`${_tabDepth}  Object bounds validation failed (Key: ${_key}, Data: ${JSON.stringify(_data)})`);
                    return false;
                }
                for (const objectKey in _data) {
                    let found = false;
                    for (const child of this._children) {
                        if (child.validate(objectKey, _data[objectKey], _tabDepth, _path)) {
                            found = true;
                            break;
                        }
                    }
                    if (!found) {
                        return false;
                    }
                }
                this._logger?.debug(`${_tabDepth}  All object properties validated successfully`);
                return true;
            } else if (isArray) {
                for (let index = 0; index < _data.length; index++) {
                    const element = _data[index];
                    for (const child of this._children) {
                        if (!child.validate(String(index), element, _tabDepth, _path)) {
                            this._logger?.debug(`${_tabDepth}  Array validation failed`);
                            return false;
                        }
                    }
                }
                this._logger?.debug(`${_tabDepth}  Array validation PASSED`);
                return true;
            } else if (this._type === OpNodeSourceType.STRING) {
                const propertyType = this._propertyStack.getProperty("OpPropertyType");
                if (propertyType !== undefined) {
                    if (propertyType.type === OpNodeSourceType.ENUM) {
                        const enumProperty = this._propertyStack.getProperty("OpPropertyEnum");
                        if (enumProperty !== undefined) {
                            if (!enumProperty.validate(_key, _data, this._logger)) {
                                return false;
                            }
                            this._logger?.debug(`${_tabDepth}  Enum validation PASSED`);
                            return true;
                        } else {
                            this._logger?.debug(`${_tabDepth}  Enum property not found`);
                            return false;
                        }
                    }
                }
            }
            this._logger?.debug(`${_tabDepth}  Data: "${_key} : ${JSON.stringify(_data)}" - appears valid`);
            return true;
        }
        get title() {
            return this._title;
        }
        get editorProperties() {
            return this._editorMetaProperties;
        }
        get type() {
            return this._type;
        }
        get id() {
            return this._id;
        }
    }
    class SchemaRefMap {
        constructor(_definitions) {
            this._map = new Map;
            if (_definitions !== undefined) {
                for (const key in _definitions) {
                    this._map.set(key, _definitions[key]);
                }
            }
        }
        resolve(_schema) {
            if (_schema === undefined) {
                throw new Error("Schema is undefined");
            }
            const refPrologue = "#/definitions/";
            if (_schema.$ref === undefined) {
                return _schema;
            }
            let ref = _schema.$ref;
            if (ref.startsWith(refPrologue)) {
                ref = ref.substring(refPrologue.length);
            } else {
                throw new Error(`Failed to resolve ref: ${String(_schema.$ref)}`);
            }
            const result = this._map.get(ref);
            if (result === undefined) {
                throw new Error(`Failed to resolve ref: ${String(_schema.$ref)}`);
            }
            return this.resolve(result);
        }
    }
    class SchemaValidatorBuilder {
        constructor(_logger) {
            this._schemaObject = {};
            this._root = undefined;
            this._refMap = new SchemaRefMap(undefined);
            this._logger = _logger;
        }
        build(_schemaObject) {
            this._schemaObject = _schemaObject;
            if (_schemaObject.definitions !== undefined) {
                this._refMap = new SchemaRefMap(_schemaObject.definitions);
            }
            try {
                const root = new OpBaseNode("", _schemaObject, this._refMap, new OpPropertyStack, this._logger);
                this._root = root;
            } catch {
                this._logger?.error(`Failed to build schema`);
                return false;
            }
            return true;
        }
        validate(_data) {
            if (_data === undefined) {
                throw new Error("Data is undefined");
            }
            if (this._root === undefined) {
                throw new Error("No Schema Map built yet");
            }
            return this._root.validate("", _data, "", "");
        }
    }
    async function deleteOperation(uiSession) {
        if (uiSession.extensionContext.selectionManager.selection.isEmpty) {
            uiSession.log.warning("Selection volume is empty - nothing to clear");
            return;
        }
        const onError = e => {
            uiSession.log.error(e.message);
        };
        await executeFunctionWithTransactionAndTicking(uiSession.extensionContext, uiSession.log, uiSession.extensionContext.selectionManager.selection, "Delete", (() => {
            uiSession.extensionContext.blockUtilities.fillVolume(uiSession.extensionContext.selectionManager.selection, MinecraftBlockTypes.Air);
        })).catch(onError);
    }
    class DeleteBehavior {
        constructor(uiSession, coreMenuItems) {
            const deleteAction = uiSession.actionManager.createAction({
                actionType: server_editor_namespaceObject.ActionTypes.NoArgsAction,
                onExecute: () => {
                    deleteOperation(uiSession).catch((e => uiSession.log.error(e.message)));
                }
            });
            coreMenuItems.edit.addItem({
                label: "resourcePack.editor.menuBar.edit.delete"
            }, deleteAction);
            uiSession.inputManager.registerKeyBinding(server_editor_namespaceObject.EditorInputContext.GlobalEditor, deleteAction, {
                key: server_editor_namespaceObject.KeyboardKey.DELETE
            }, {
                uniqueId: "editor:toolModeKeyBinding:delete",
                label: "resourcePack.editor.delete.keyBinding"
            });
        }
        teardown() {}
    }
    const mapMarkerEntityName = "editor:map_marker";
    class LineSegment {
        constructor(point, surfaceContour, targetMode, terminator, widgetGroup, changedEvent) {
            this._location = point;
            this._surfaceContour = surfaceContour;
            this._terminator = terminator;
            this._targetMode = targetMode;
            this._widget = widgetGroup.createWidget(point, {
                selectable: true,
                snapToBlockLocation: true,
                visible: true,
                collisionOffset: {
                    x: .5,
                    y: .5,
                    z: .5
                },
                collisionRadius: .5,
                stateChangeEvent: data => {
                    if (data.location !== undefined) {
                        this._location = data.location;
                        const textComponent = data.widget.getComponent("position_text");
                        if (textComponent) {
                            textComponent.label = lib.Vector3Utils.toString(data.location, {
                                decimals: 1
                            });
                        }
                        changedEvent();
                    }
                }
            });
            this._widget.addEntityComponent("marker", mapMarkerEntityName, {
                isClickable: true,
                visible: true,
                offset: {
                    x: .5,
                    y: 0,
                    z: .5
                }
            });
            this._widget.addTextComponent("position_text", lib.Vector3Utils.toString(point, {
                decimals: 1
            }), {
                offset: {
                    x: 0,
                    y: 1,
                    z: 0
                },
                visible: true
            });
            this._widget.addGizmoComponent("position_gizmo", {
                offset: {
                    x: .5,
                    y: 0,
                    z: .5
                },
                visible: true
            });
            this._widget.addGuideComponent("position_guide");
        }
        clear() {
            this._widget?.delete();
        }
        get point() {
            return this._location;
        }
        get surfaceContour() {
            return this._surfaceContour;
        }
        get targetMode() {
            return this._targetMode;
        }
        get terminator() {
            return this._terminator;
        }
        set terminator(value) {
            this._terminator = value;
        }
        get isSelected() {
            const isSelected = this._widget.selected;
            return isSelected;
        }
        set isSelected(value) {
            this._widget.selected = value;
        }
    }
    class LineSegmentList {
        constructor(widgetGroup, preview, dimension) {
            this._segments = [];
            this.pointChangedEventHandler = () => {
                this.rebuildPreview(this._lastLineType);
            };
            this._widgetGroup = widgetGroup;
            this._preview = preview;
            this._lastLineType = BlockLineType.Direct;
            this._dimension = dimension;
        }
        addNextPoint(point, surfaceContour, targetMode) {
            if (this._segments.length > 0) {
                this._segments[this._segments.length - 1].terminator = false;
                this._segments[this._segments.length - 1].isSelected = false;
            }
            const segment = new LineSegment(point, surfaceContour, targetMode, true, this._widgetGroup, this.pointChangedEventHandler);
            segment.isSelected = true;
            this._segments.push(segment);
        }
        addNewPoint(point, surfaceContour, targetMode) {
            if (this._segments.length > 0) {
                this._segments[this._segments.length - 1].isSelected = false;
            }
            const segment = new LineSegment(point, surfaceContour, targetMode, true, this._widgetGroup, this.pointChangedEventHandler);
            segment.isSelected = true;
            this._segments.push(segment);
        }
        clear() {
            for (const segment of this._segments) {
                segment.clear();
            }
            this._segments = [];
            this._preview.visible = false;
            this._preview.clear();
        }
        get length() {
            return this._segments.length;
        }
        getSurfaceSolidBlockPos(xz, yStart, yMin, dimension, cursorTargetMode) {
            const offset = cursorTargetMode === server_editor_namespaceObject.CursorTargetMode.Block ? 0 : 1;
            for (let i = yStart; i > yMin; i--) {
                const block = dimension?.getBlock({
                    x: xz.x,
                    y: i,
                    z: xz.z
                });
                if (block) {
                    if (block.isSolid && !block.typeId.includes("leaves")) {
                        return {
                            x: xz.x,
                            y: i + offset,
                            z: xz.z
                        };
                    }
                }
            }
            return xz;
        }
        buildLinearBlockPositionArray(mode) {
            const positions = [];
            if (this.length === 0) {
                return positions;
            } else if (this.length === 1) {
                positions.push(this._segments[0].point);
                return positions;
            }
            for (let i = 0; i < this.length - 1; i++) {
                const start = this._segments[i].point;
                const end = this._segments[i + 1].point;
                const line = new BlockLine(start, end, {
                    mode
                });
                const surfaceContour = this._segments[i].surfaceContour;
                const targetMode = this._segments[i].targetMode;
                for (const point of line.getBlockLineLocationIterator()) {
                    if (surfaceContour) {
                        const projPoint = this.getSurfaceSolidBlockPos(point, start.y, 0, this._dimension, targetMode);
                        positions.push(projPoint);
                    } else {
                        positions.push(point);
                    }
                }
                if (this._segments[i + 1].terminator) {
                    ++i;
                }
            }
            const oddLength = this.length % 2 !== 0;
            if (oddLength) {
                positions.push(this._segments[this.length - 1].point);
            }
            return positions;
        }
        rebuildPreview(lineMode) {
            this._preview.visible = false;
            this._preview.clear();
            if (lineMode) {
                this._lastLineType = lineMode;
            }
            if (this.length === 0) {
                return;
            }
            const positions = this.buildLinearBlockPositionArray(lineMode ?? this._lastLineType);
            for (const point of positions) {
                this._preview.pushVolume({
                    action: server_namespaceObject.CompoundBlockVolumeAction.Add,
                    volume: new server_namespaceObject.BlockVolume(point, point)
                });
            }
            this._preview.visible = true;
        }
        get preview() {
            return this._preview;
        }
        get areAnySelected() {
            const anySelected = this._segments.some((segment => segment.isSelected));
            return anySelected;
        }
        selectAll() {
            this._widgetGroup.selectAllWidgets();
        }
        deselectAll() {
            this._widgetGroup.deselectAllWidgets();
        }
        removeLastSegment() {
            if (this._segments.length > 0) {
                this._segments[this._segments.length - 1].clear();
                this._segments.pop();
                this.rebuildPreview(this._lastLineType);
            }
        }
        nudgeSelected(_nudgeVector) {}
    }
    var SelectionCursorMode;
    (function(SelectionCursorMode) {
        SelectionCursorMode[SelectionCursorMode["Freeform"] = 0] = "Freeform";
        SelectionCursorMode[SelectionCursorMode["FixedDistance"] = 1] = "FixedDistance";
        SelectionCursorMode[SelectionCursorMode["AdjacentFace"] = 2] = "AdjacentFace";
    })(SelectionCursorMode || (SelectionCursorMode = {}));
    var LineTelemetry;
    (function(LineTelemetry) {
        LineTelemetry["AddNewPoint"] = "AddNewPoint";
        LineTelemetry["Deselect"] = "Deselect";
        LineTelemetry["DeselectAll"] = "DeselectAll";
        LineTelemetry["SelectAll"] = "SelectAll";
        LineTelemetry["FillAndClear"] = "FillAndClear";
        LineTelemetry["Fill"] = "Fill";
        LineTelemetry["DeleteAndClear"] = "DeleteAndClear";
        LineTelemetry["Delete"] = "Delete";
        LineTelemetry["Nudge"] = "Nudge";
        LineTelemetry["Move"] = "Move";
        LineTelemetry["SelectionModeChange"] = "SelectionModeChange";
        LineTelemetry["AlgorithmChanged"] = "AlgorithmChanged";
    })(LineTelemetry || (LineTelemetry = {}));
    class LineBehavior {
        constructor(uiSession) {
            this.uiSession = uiSession;
            this.SELECTION_COLOR = {
                red: 0,
                green: .85,
                blue: .95,
                alpha: 1
            };
            this.SELECTION_OUTLINE_COLOR = {
                red: 0,
                green: 0,
                blue: 1,
                alpha: .5
            };
            this.fillSelection = async (uiSession, fillBlockType) => {
                const player = uiSession.extensionContext.player;
                const dimension = player.dimension;
                const operation = blockLocation => {
                    const block = dimension.getBlock(blockLocation);
                    if (block) {
                        block.setType(fillBlockType);
                    }
                };
                const onError = e => {
                    this.uiSession.log.error(`Fill operation failed with error: ${e.message}`);
                };
                await executeLargeOperationWithTransactionAndTicking(uiSession.extensionContext, uiSession.log, this.lineSegments.preview, "Line-tool", operation).catch(onError);
            };
            const previewSelection = uiSession.extensionContext.selectionManager.create();
            previewSelection.setOutlineColor(this.SELECTION_COLOR);
            previewSelection.setFillColor(this.SELECTION_OUTLINE_COLOR);
            this.telemetryManager = new TelemetryManager(uiSession.extensionContext.player, TelemetrySource.Line);
            const groupOptions = {
                groupSelectionMode: server_editor_namespaceObject.WidgetGroupSelectionMode.Multiple
            };
            const widgetGroup = uiSession.extensionContext.widgetManager.createGroup(groupOptions);
            this.lineSegments = new LineSegmentList(widgetGroup, previewSelection, uiSession.extensionContext.player.dimension);
            this.props = {
                selectionMode: SelectionCursorMode.Freeform,
                width: 1,
                height: 1,
                lineMode: BlockLineType.Direct,
                surfaceContour: false,
                prevSurfaceContour: false
            };
            this.cursorProperties = uiSession.extensionContext.cursor.getProperties();
            if (this.cursorProperties.fillColor) {
                delete this.cursorProperties.fillColor;
            }
            this.cursorProperties.outlineColor = this.SELECTION_COLOR;
            this.cursorProperties.controlMode = server_editor_namespaceObject.CursorControlMode.KeyboardAndMouse;
            this.cursorProperties.targetMode = server_editor_namespaceObject.CursorTargetMode.Block;
            this.cursorProperties.visible = true;
            this.tool = this.addTool(uiSession);
            this.pane = this.addLineToolPane(uiSession, this.tool);
            this.pane.hide();
            this.tool.bindPropertyPane(this.pane);
            this.registerMouseAction(uiSession);
            this.registerMouseWheelAction(uiSession);
            this._registerToolKeyBinding(uiSession.actionManager.createAction({
                actionType: server_editor_namespaceObject.ActionTypes.NoArgsAction,
                onExecute: () => {
                    if (this.lineSegments.areAnySelected) {
                        this.telemetryManager.fireTelemetryEvent(LineTelemetry.Deselect, {
                            mode: "all"
                        });
                        this.lineSegments.deselectAll();
                    } else {
                        this.telemetryManager.fireTelemetryEvent(LineTelemetry.Deselect, {
                            mode: "last"
                        });
                        this.lineSegments.removeLastSegment();
                    }
                }
            }), {
                key: server_editor_namespaceObject.KeyboardKey.KEY_D,
                modifier: server_editor_namespaceObject.InputModifier.Control
            }, "deselect");
            this._registerToolKeyBinding(uiSession.actionManager.createAction({
                actionType: server_editor_namespaceObject.ActionTypes.NoArgsAction,
                onExecute: () => {
                    this.telemetryManager.fireTelemetryEvent(LineTelemetry.DeselectAll);
                    this.clearState();
                }
            }), {
                key: server_editor_namespaceObject.KeyboardKey.KEY_D,
                modifier: server_editor_namespaceObject.InputModifier.Control | server_editor_namespaceObject.InputModifier.Shift
            }, "deselectAll");
            this._registerToolKeyBinding(uiSession.actionManager.createAction({
                actionType: server_editor_namespaceObject.ActionTypes.NoArgsAction,
                onExecute: () => {
                    this.telemetryManager.fireTelemetryEvent(LineTelemetry.SelectAll);
                    this.lineSegments.selectAll();
                }
            }), {
                key: server_editor_namespaceObject.KeyboardKey.KEY_A,
                modifier: server_editor_namespaceObject.InputModifier.Control
            }, "selectAll");
            this._registerToolKeyBinding(uiSession.actionManager.createAction({
                actionType: server_editor_namespaceObject.ActionTypes.NoArgsAction,
                onExecute: () => {
                    this.telemetryManager.fireTelemetryEvent(LineTelemetry.FillAndClear);
                    const fillBlockType = uiSession.extensionContext.blockPalette.getSelectedBlockType();
                    this.finalizeFillSelection(uiSession, fillBlockType);
                }
            }), {
                key: server_editor_namespaceObject.KeyboardKey.KEY_F,
                modifier: server_editor_namespaceObject.InputModifier.Control
            }, "fillAndClear");
            this._registerToolKeyBinding(uiSession.actionManager.createAction({
                actionType: server_editor_namespaceObject.ActionTypes.NoArgsAction,
                onExecute: () => {
                    this.telemetryManager.fireTelemetryEvent(LineTelemetry.Fill);
                    const fillBlockType = uiSession.extensionContext.blockPalette.getSelectedBlockType();
                    this.finalizeFillSelection(uiSession, fillBlockType, false);
                }
            }), {
                key: server_editor_namespaceObject.KeyboardKey.KEY_F,
                modifier: server_editor_namespaceObject.InputModifier.Control | server_editor_namespaceObject.InputModifier.Shift
            }, "fill");
            this._registerToolKeyBinding(uiSession.actionManager.createAction({
                actionType: server_editor_namespaceObject.ActionTypes.NoArgsAction,
                onExecute: () => {
                    this.telemetryManager.fireTelemetryEvent(LineTelemetry.DeleteAndClear);
                    const fillBlockType = server_namespaceObject.BlockTypes.get(MinecraftBlockTypes.Air);
                    this.finalizeFillSelection(uiSession, fillBlockType);
                }
            }), {
                key: server_editor_namespaceObject.KeyboardKey.DELETE
            }, "deleteAndClear");
            this._registerToolKeyBinding(uiSession.actionManager.createAction({
                actionType: server_editor_namespaceObject.ActionTypes.NoArgsAction,
                onExecute: () => {
                    this.telemetryManager.fireTelemetryEvent(LineTelemetry.Delete);
                    const fillBlockType = server_namespaceObject.BlockTypes.get(MinecraftBlockTypes.Air);
                    this.finalizeFillSelection(uiSession, fillBlockType, false);
                }
            }), {
                key: server_editor_namespaceObject.KeyboardKey.DELETE,
                modifier: server_editor_namespaceObject.InputModifier.Shift
            }, "delete");
            const keyUpAction = uiSession.actionManager.createAction({
                actionType: server_editor_namespaceObject.ActionTypes.NoArgsAction,
                onExecute: () => {
                    this.telemetryManager.fireTelemetryEvent(LineTelemetry.Nudge, {
                        direction: "up"
                    });
                    this.lineSegments.nudgeSelected(lib.VECTOR3_UP);
                }
            });
            const keyDownAction = uiSession.actionManager.createAction({
                actionType: server_editor_namespaceObject.ActionTypes.NoArgsAction,
                onExecute: () => {
                    this.telemetryManager.fireTelemetryEvent(LineTelemetry.Nudge, {
                        direction: "down"
                    });
                    this.lineSegments.nudgeSelected(lib.VECTOR3_DOWN);
                }
            });
            const keyLeftAction = uiSession.actionManager.createAction({
                actionType: server_editor_namespaceObject.ActionTypes.NoArgsAction,
                onExecute: () => {
                    this.telemetryManager.fireTelemetryEvent(LineTelemetry.Nudge, {
                        direction: "left"
                    });
                    const nudgeVector = this.getRelativeNudgeDirection(uiSession, Direction.Left);
                    this.lineSegments.nudgeSelected(nudgeVector);
                }
            });
            const keyRightAction = uiSession.actionManager.createAction({
                actionType: server_editor_namespaceObject.ActionTypes.NoArgsAction,
                onExecute: () => {
                    this.telemetryManager.fireTelemetryEvent(LineTelemetry.Nudge, {
                        direction: "right"
                    });
                    const nudgeVector = this.getRelativeNudgeDirection(uiSession, Direction.Right);
                    this.lineSegments.nudgeSelected(nudgeVector);
                }
            });
            const keyForwardAction = uiSession.actionManager.createAction({
                actionType: server_editor_namespaceObject.ActionTypes.NoArgsAction,
                onExecute: () => {
                    this.telemetryManager.fireTelemetryEvent(LineTelemetry.Nudge, {
                        direction: "forward"
                    });
                    const nudgeVector = this.getRelativeNudgeDirection(uiSession, Direction.Forward);
                    this.lineSegments.nudgeSelected(nudgeVector);
                }
            });
            const keyBackAction = uiSession.actionManager.createAction({
                actionType: server_editor_namespaceObject.ActionTypes.NoArgsAction,
                onExecute: () => {
                    this.telemetryManager.fireTelemetryEvent(LineTelemetry.Nudge, {
                        direction: "back"
                    });
                    const nudgeVector = this.getRelativeNudgeDirection(uiSession, Direction.Back);
                    this.lineSegments.nudgeSelected(nudgeVector);
                }
            });
            this._registerToolKeyBinding(keyForwardAction, {
                key: server_editor_namespaceObject.KeyboardKey.UP
            }, "moveForward");
            this._registerToolKeyBinding(keyBackAction, {
                key: server_editor_namespaceObject.KeyboardKey.DOWN
            }, "moveBack");
            this._registerToolKeyBinding(keyLeftAction, {
                key: server_editor_namespaceObject.KeyboardKey.LEFT
            }, "moveLeft");
            this._registerToolKeyBinding(keyRightAction, {
                key: server_editor_namespaceObject.KeyboardKey.RIGHT
            }, "moveRight");
            this._registerToolKeyBinding(keyUpAction, {
                key: server_editor_namespaceObject.KeyboardKey.PAGE_UP
            }, "moveUp");
            this._registerToolKeyBinding(keyDownAction, {
                key: server_editor_namespaceObject.KeyboardKey.PAGE_DOWN
            }, "moveDown");
            uiSession.extensionContext.afterEvents.modeChange.subscribe((event => {
                if (event.mode === server_editor_namespaceObject.EditorMode.Crosshair) {
                    this.clearState();
                }
            }));
        }
        teardown() {}
        getRelativeNudgeDirection(uiSession, direction) {
            const rotationY = uiSession.extensionContext.player.getRotation().y;
            const rotationCorrectedVector = getRotationCorrectedDirectionVector(rotationY, direction);
            return rotationCorrectedVector;
        }
        finalizeFillSelection(uiSession, fillBlockType, clear = true) {
            this.fillSelection(uiSession, fillBlockType).catch((e => uiSession.log.error(e.message))).finally((() => {
                if (clear) {
                    this.clearState();
                }
            }));
        }
        addTool(uiSession) {
            const tool = uiSession.toolRail.addTool("editor:modalTool:line", {
                title: "resourcePack.editor.toolRail.line.title",
                icon: "pack://textures/editor/Line.png?filtering=point",
                tooltip: "resourcePack.editor.toolRail.line.tooltip"
            });
            tool.onModalToolActivation.subscribe((eventData => {
                if (eventData.isActiveTool) {
                    this.backedUpColors = backupColors(uiSession.extensionContext);
                    uiSession.extensionContext.cursor.setProperties(this.cursorProperties);
                } else {
                    this.clearState();
                    if (this.backedUpColors) {
                        restoreBackedUpColors(uiSession.extensionContext, this.backedUpColors);
                        this.backedUpColors = undefined;
                    }
                }
            }));
            return tool;
        }
        addLineToolPane(uiSession, tool) {
            const pane = uiSession.createPropertyPane({
                title: "resourcePack.editor.toolRail.line.title",
                infoTooltip: {
                    description: [ "resourcePack.editor.toolRail.line.tooltip", {
                        link: "https://aka.ms/BedrockEditorLineTool",
                        text: "resourcePack.editor.help.learnMore"
                    } ]
                }
            });
            this.props = (0, server_editor_namespaceObject.bindDataSource)(pane, this.props);
            pane.addNumber_deprecated(this.props, "width", {
                title: "resourcePack.editor.toolRail.line.pane.width.title",
                min: 1,
                max: 1,
                enable: false
            });
            pane.addNumber_deprecated(this.props, "height", {
                title: "resourcePack.editor.toolRail.line.pane.height.title",
                min: 1,
                max: 1,
                enable: false
            });
            pane.addDropdown_deprecated(this.props, "selectionMode", {
                title: "resourcePack.editor.toolRail.line.pane.selectionMode",
                dropdownItems: [ {
                    label: "resourcePack.editor.toolRail.line.pane.selectionMode.freeForm",
                    value: SelectionCursorMode.Freeform
                }, {
                    label: "resourcePack.editor.toolRail.line.pane.selectionMode.fixedDistance",
                    value: SelectionCursorMode.FixedDistance
                }, {
                    label: "resourcePack.editor.toolRail.line.pane.selectionMode.adjacent",
                    value: SelectionCursorMode.AdjacentFace
                } ],
                onChange: (_obj, _property, oldValue, newValue) => {
                    const oldVal = oldValue;
                    const newVal = newValue;
                    let cursorControlMode = server_editor_namespaceObject.CursorControlMode.KeyboardAndMouse;
                    let cursorTargetMode = server_editor_namespaceObject.CursorTargetMode.Block;
                    if (oldVal !== newVal) {
                        this.telemetryManager.fireTelemetryEvent(LineTelemetry.SelectionModeChange, {
                            mode: newVal
                        });
                        switch (newVal) {
                          case SelectionCursorMode.Freeform:
                            cursorControlMode = server_editor_namespaceObject.CursorControlMode.KeyboardAndMouse;
                            cursorTargetMode = server_editor_namespaceObject.CursorTargetMode.Block;
                            break;

                          case SelectionCursorMode.FixedDistance:
                            cursorControlMode = server_editor_namespaceObject.CursorControlMode.Fixed;
                            cursorTargetMode = server_editor_namespaceObject.CursorTargetMode.Block;
                            break;

                          case SelectionCursorMode.AdjacentFace:
                            cursorControlMode = server_editor_namespaceObject.CursorControlMode.KeyboardAndMouse;
                            cursorTargetMode = server_editor_namespaceObject.CursorTargetMode.Face;
                            break;

                          default:
                            uiSession.log.error(`Unknown value from selection mode drop-down`);
                            return;
                        }
                        this.cursorProperties = uiSession.extensionContext.cursor.getProperties();
                        this.cursorProperties.controlMode = cursorControlMode;
                        this.cursorProperties.targetMode = cursorTargetMode;
                        uiSession.extensionContext.cursor.setProperties(this.cursorProperties);
                        if (newVal === SelectionCursorMode.FixedDistance) {
                            this.props.prevSurfaceContour = this.props.surfaceContour;
                            this.props.surfaceContour = false;
                            this.surfaceContourBoolItem.enable = false;
                        } else {
                            this.props.surfaceContour = this.props.prevSurfaceContour;
                            this.surfaceContourBoolItem.enable = true;
                        }
                    }
                }
            });
            pane.addDropdown_deprecated(this.props, "lineMode", {
                title: "resourcePack.editor.toolRail.line.pane.algorithm.title",
                dropdownItems: [ {
                    label: "resourcePack.editor.toolRail.line.pane.algorithm.Direct",
                    value: BlockLineType.Direct
                }, {
                    label: "resourcePack.editor.toolRail.line.pane.algorithm.Staggered",
                    value: BlockLineType.Staggered
                } ],
                onChange: (_obj, _property, _oldValue, _newValue) => {
                    const oldVal = _oldValue;
                    const newVal = _newValue;
                    if (oldVal !== newVal) {
                        this.telemetryManager.fireTelemetryEvent(LineTelemetry.AlgorithmChanged, {
                            mode: newVal
                        });
                    }
                }
            });
            this.surfaceContourBoolItem = pane.addBool_deprecated(this.props, "surfaceContour", {
                title: "resourcePack.editor.toolRail.line.pane.surfaceContour",
                onChange: (_obj, _property, _oldValue, _newValue) => {}
            });
            pane.addButton((() => {
                this.telemetryManager.fireTelemetryEvent(LineTelemetry.FillAndClear);
                const fillBlockType = uiSession.extensionContext.blockPalette.getSelectedBlockType();
                this.finalizeFillSelection(uiSession, fillBlockType);
            }), {
                title: "resourcePack.editor.toolRail.line.pane.fillAction"
            });
            tool.bindPropertyPane(pane);
            return pane;
        }
        registerMouseAction(uiSession) {
            const executeAction = uiSession.actionManager.createAction({
                actionType: server_editor_namespaceObject.ActionTypes.MouseRayCastAction,
                onExecute: (mouseRay, mouseProps) => {
                    if (mouseProps.mouseAction === server_editor_namespaceObject.MouseActionType.LeftButton && mouseProps.inputType === server_editor_namespaceObject.MouseInputType.ButtonUp && uiSession.toolRail.getSelectedToolId() === this.tool.id && mouseRay?.cursorBlockLocation) {
                        const targetLocation = mouseRay.cursorBlockLocation;
                        const noModifiers = !mouseProps.modifiers.alt && !mouseProps.modifiers.ctrl && !mouseProps.modifiers.shift;
                        const targetMode = this.cursorProperties.targetMode ?? server_editor_namespaceObject.CursorTargetMode.Block;
                        let rebuildPreview = false;
                        if (noModifiers) {
                            if (this.lineSegments.length >= 2) {
                                this.lineSegments.clear();
                            }
                            this.telemetryManager.fireTelemetryEvent(LineTelemetry.AddNewPoint, {
                                mode: "noModifiers"
                            });
                            this.lineSegments.addNextPoint(targetLocation, this.props.surfaceContour, targetMode);
                            rebuildPreview = true;
                        } else if (mouseProps.modifiers.shift) {
                            this.telemetryManager.fireTelemetryEvent(LineTelemetry.AddNewPoint, {
                                mode: "shift"
                            });
                            this.lineSegments.addNextPoint(targetLocation, this.props.surfaceContour, targetMode);
                            rebuildPreview = true;
                        } else if (mouseProps.modifiers.ctrl) {
                            this.telemetryManager.fireTelemetryEvent(LineTelemetry.AddNewPoint, {
                                mode: "ctrl"
                            });
                            this.lineSegments.addNewPoint(targetLocation, this.props.surfaceContour, targetMode);
                            rebuildPreview = true;
                        }
                        if (rebuildPreview) {
                            this.lineSegments.rebuildPreview(this.props.lineMode);
                        }
                    }
                }
            });
            this.tool.registerMouseButtonBinding(executeAction);
        }
        registerMouseWheelAction(uiSession) {
            const mouseWheelAction = uiSession.actionManager.createAction({
                actionType: server_editor_namespaceObject.ActionTypes.MouseRayCastAction,
                onExecute: (_, mouseProps) => {
                    if (this.cursorProperties.controlMode !== server_editor_namespaceObject.CursorControlMode.Fixed) {
                        return;
                    }
                    this.telemetryManager.fireTelemetryEvent(LineTelemetry.Move);
                    if (mouseProps.inputType === server_editor_namespaceObject.MouseInputType.WheelOut) {
                        uiSession.extensionContext.cursor.moveBy(lib.VECTOR3_FORWARD);
                    } else if (mouseProps.inputType === server_editor_namespaceObject.MouseInputType.WheelIn) {
                        uiSession.extensionContext.cursor.moveBy(lib.VECTOR3_BACK);
                    }
                }
            });
            this.tool.registerMouseWheelBinding(mouseWheelAction);
        }
        clearState() {
            this.lineSegments.clear();
        }
        _registerToolKeyBinding(action, binding, tag) {
            this.tool.registerKeyBinding(action, binding, {
                uniqueId: `editor:lineToolKeyBinding:${tag}`,
                label: `resourcePack.editor.toolRail.line.keyBinding.${tag}`
            });
        }
    }
    LineBehavior.BEHAVIOR_NAME = "Line";
    class Stack {
        constructor(maxStackSize) {
            this.maxStackSize = maxStackSize;
            this.internalStack = [];
            this.stackHead = -1;
        }
        isEmpty() {
            return this.internalStack.length === 0;
        }
        push(element) {
            if (this.stackHead < this.internalStack.length - 1) {
                this.internalStack.length = this.stackHead + 1;
            }
            const elementsToTrim = this.maxStackSize && this.internalStack.length >= this.maxStackSize ? this.maxStackSize - this.internalStack.length + 1 : 0;
            this.internalStack = [ ...this.internalStack.slice(elementsToTrim), element ];
            this.stackHead = this.internalStack.length - 1;
        }
        moveHeadDown() {
            if (this.isEmpty()) {
                return;
            }
            this.stackHead = (0, lib.clampNumber)(--this.stackHead, 0, this.internalStack.length - 1);
        }
        moveHeadUp() {
            if (this.isEmpty()) {
                return;
            }
            this.stackHead = (0, lib.clampNumber)(++this.stackHead, 0, this.internalStack.length - 1);
        }
        head() {
            if (this.isEmpty()) {
                return undefined;
            }
            return this.internalStack[this.stackHead];
        }
        length() {
            return this.internalStack.length;
        }
        clear() {
            this.internalStack = [];
            this.stackHead = -1;
        }
        forEach(callbackfn) {
            this.internalStack.forEach(callbackfn);
        }
    }
    const logNavigationInfoDynamicPropertyName = "navigationstack:lognavigationinfo";
    class NavigationStackBehavior {
        constructor(uiSession) {
            this.uiSession = uiSession;
            this.stack = new Stack(NavigationStackBehavior.MAX_STACK_SIZE);
            this.logNavigationInfo = false;
            this.navigationLoggingMenuItem = undefined;
            this.updateInternalHandle = undefined;
            uiSession.log.debug(`Initializing ${NavigationStackBehavior.BEHAVIOR_NAME}`);
            this.loadDynamicProperties(uiSession);
            const baseMenu = uiSession.scratchStorage?.coreMenuItems?.view;
            if (baseMenu) {
                this.createMenuItemWithAction(uiSession, baseMenu);
            }
            this.bindShortcuts(uiSession);
            if (this.shouldAddAutomatedRecord(uiSession.extensionContext.player)) {
                this.addRecordToStack(uiSession);
            }
            if (!this.updateInternalHandle) {
                this.queueInitialDelayAddRecordCheck(uiSession);
            }
        }
        teardown() {
            this.uiSession.log.debug(`Shutting down ${NavigationStackBehavior.BEHAVIOR_NAME}`);
            if (this.updateInternalHandle) {
                server_namespaceObject.system.clearRun(this.updateInternalHandle);
            }
        }
        createMenuItemWithAction(uiSession, menu) {
            const toggleNavigationLoggingAction = uiSession.actionManager.createAction({
                actionType: server_editor_namespaceObject.ActionTypes.NoArgsAction,
                onExecute: () => {
                    if (this.navigationLoggingMenuItem) {
                        this.logNavigationInfo = !this.logNavigationInfo;
                        this.navigationLoggingMenuItem.checked = this.logNavigationInfo;
                        uiSession.extensionContext.player.setDynamicProperty(logNavigationInfoDynamicPropertyName, this.logNavigationInfo);
                        if (this.logNavigationInfo) {
                            this.logStack();
                        }
                    }
                }
            });
            this.navigationLoggingMenuItem = menu.addItem({
                label: "resourcePack.editor.menuBar.view.navigationLogging",
                checked: this.logNavigationInfo
            }, toggleNavigationLoggingAction);
        }
        bindShortcuts(uiSession) {
            const moveHeadUpAndMovePlayerToLocation = uiSession.actionManager.createAction({
                actionType: server_editor_namespaceObject.ActionTypes.NoArgsAction,
                onExecute: () => {
                    if (this.stack.isEmpty()) {
                        this.logStack();
                        return;
                    }
                    this.stack.moveHeadUp();
                    const player = uiSession.extensionContext.player;
                    const entry = this.stack.head();
                    if (entry) {
                        player.teleport(entry.pos, {
                            rotation: entry.rot,
                            dimension: entry.dimension
                        });
                    }
                    this.logStack();
                }
            });
            uiSession.inputManager.registerKeyBinding(server_editor_namespaceObject.EditorInputContext.GlobalToolMode, moveHeadUpAndMovePlayerToLocation, {
                key: server_editor_namespaceObject.KeyboardKey.BRACKET_CLOSE,
                modifier: server_editor_namespaceObject.InputModifier.Control
            }, {
                uniqueId: "editor:toolModeKeyBinding:navigationNext",
                label: "resourcePack.editor.navigation.keyBinding.next"
            });
            const moveHeadDownAndMovePlayerToLocation = uiSession.actionManager.createAction({
                actionType: server_editor_namespaceObject.ActionTypes.NoArgsAction,
                onExecute: () => {
                    if (this.stack.isEmpty()) {
                        this.logStack();
                        return;
                    }
                    this.stack.moveHeadDown();
                    const player = uiSession.extensionContext.player;
                    const entry = this.stack.head();
                    if (entry) {
                        player.teleport(entry.pos, {
                            rotation: entry.rot,
                            dimension: entry.dimension
                        });
                    }
                    this.logStack();
                }
            });
            uiSession.inputManager.registerKeyBinding(server_editor_namespaceObject.EditorInputContext.GlobalToolMode, moveHeadDownAndMovePlayerToLocation, {
                key: server_editor_namespaceObject.KeyboardKey.BRACKET_OPEN,
                modifier: server_editor_namespaceObject.InputModifier.Control
            }, {
                uniqueId: "editor:toolModeKeyBinding:navigationPrev",
                label: "resourcePack.editor.navigation.keyBinding.previous"
            });
            const addRecordToStackAction = uiSession.actionManager.createAction({
                actionType: server_editor_namespaceObject.ActionTypes.NoArgsAction,
                onExecute: () => {
                    this.addRecordToStack(uiSession);
                }
            });
            uiSession.inputManager.registerKeyBinding(server_editor_namespaceObject.EditorInputContext.GlobalToolMode, addRecordToStackAction, {
                key: server_editor_namespaceObject.KeyboardKey.KEY_K,
                modifier: server_editor_namespaceObject.InputModifier.Control
            }, {
                uniqueId: "editor:toolModeKeyBinding:navigationAdd",
                label: "resourcePack.editor.navigation.keyBinding.add"
            });
        }
        shouldAddAutomatedRecord(player) {
            const headRecord = this.stack.head();
            if (headRecord) {
                if (player.dimension !== headRecord.dimension) {
                    return true;
                }
                const playerVelocity = player.getVelocity();
                const playerLocation = player.location;
                const headRecordLocation = headRecord.pos;
                const distanceFromHeadRecord = lib.Vector3Utils.magnitude(lib.Vector3Utils.subtract(headRecordLocation, playerLocation));
                const shouldAddAutomatedRecord = Math.abs(playerVelocity.x) === 0 && Math.abs(playerVelocity.y) === 0 && Math.abs(playerVelocity.z) === 0 && distanceFromHeadRecord >= NavigationStackBehavior.AUTO_ADD_MIN_DISTANCE_IN_BLOCKS;
                return shouldAddAutomatedRecord;
            } else {
                return true;
            }
        }
        addRecordToStack(uiSession) {
            const player = uiSession.extensionContext.player;
            this.stack.push({
                pos: player.location,
                rot: player.getRotation(),
                dimension: player.dimension
            });
            this.logStack();
        }
        queueInitialDelayAddRecordCheck(uiSession) {
            this.updateInternalHandle = server_namespaceObject.system.runTimeout((() => {
                if (this.shouldAddAutomatedRecord(uiSession.extensionContext.player)) {
                    this.addRecordToStack(uiSession);
                    this.queueInitialDelayAddRecordCheck(uiSession);
                } else {
                    this.doRepeatedAutomatedRecordCheck(uiSession);
                }
            }), NavigationStackBehavior.AUTO_ADD_INTERVAL_IN_SECONDS * server_namespaceObject.TicksPerSecond);
        }
        doRepeatedAutomatedRecordCheck(uiSession) {
            this.updateInternalHandle = server_namespaceObject.system.runInterval((() => {
                if (this.shouldAddAutomatedRecord(uiSession.extensionContext.player)) {
                    if (this.updateInternalHandle) {
                        server_namespaceObject.system.clearRun(this.updateInternalHandle);
                        this.updateInternalHandle = undefined;
                    }
                    this.addRecordToStack(uiSession);
                    this.queueInitialDelayAddRecordCheck(uiSession);
                }
            }), NavigationStackBehavior.POLL_INTERVAL_IN_SECONDS * server_namespaceObject.TicksPerSecond);
        }
        loadDynamicProperties(uiSession) {
            const player = uiSession.extensionContext.player;
            const logNavigationInfo = player.getDynamicProperty(logNavigationInfoDynamicPropertyName);
            if (logNavigationInfo) {
                if (typeof logNavigationInfo === "boolean") {
                    this.logNavigationInfo = logNavigationInfo;
                } else {
                    server_editor_namespaceObject.editor.log.warning(`LogNavigationInfo dynamic property type expected to be 'boolean' for NavigationStack extension, instead found '${typeof logNavigationInfo}'`);
                }
            }
        }
        logStack() {
            if (!this.logNavigationInfo) {
                return;
            }
            const logProperties = {
                tags: [ "Editor", "Navigation" ]
            };
            const headRecord = this.stack.head();
            if (headRecord) {
                this.stack.forEach(((record, index) => {
                    const pos = record.pos;
                    const rot = record.rot;
                    const dimensionID = record.dimension.id;
                    const headIndicator = record === headRecord ? "*" : "";
                    server_editor_namespaceObject.editor.log.info(`${index}: pos [${lib.Vector3Utils.toString(pos)}], rot [${lib.Vector2Utils.toString(rot)}], dim [${dimensionID}] ${headIndicator}`, logProperties);
                }));
            } else {
                server_editor_namespaceObject.editor.log.info("Navigation: stack is empty", logProperties);
            }
        }
    }
    NavigationStackBehavior.BEHAVIOR_NAME = "Navigation Stack";
    NavigationStackBehavior.MAX_STACK_SIZE = 50;
    NavigationStackBehavior.POLL_INTERVAL_IN_SECONDS = .5;
    NavigationStackBehavior.AUTO_ADD_INTERVAL_IN_SECONDS = 5;
    NavigationStackBehavior.AUTO_ADD_MIN_DISTANCE_IN_BLOCKS = 5;
    class PauseBehavior {
        constructor(uiSession) {
            this.uiSession = uiSession;
            this.pauseMenu = undefined;
            this.pauseMobsMenuItem = undefined;
            this.pauseCheckIntervalSeconds = 1;
            this.periodicPauseCheckHandle = server_namespaceObject.system.runInterval((() => {
                if (this.pauseMobsMenuItem) {
                    if (server_editor_namespaceObject.editor.simulation.isPaused()) {
                        if (this.pauseMobsMenuItem.checked === false) {
                            this.pauseMobsMenuItem.checked = true;
                        }
                    } else {
                        if (this.pauseMobsMenuItem.checked) {
                            this.pauseMobsMenuItem.checked = false;
                        }
                    }
                }
            }), this.pauseCheckIntervalSeconds * server_namespaceObject.TicksPerSecond);
        }
        createPauseMenu(worldOptions) {
            const alternatePauseMobsAction = this.uiSession.actionManager.createAction({
                actionType: server_editor_namespaceObject.ActionTypes.NoArgsAction,
                onExecute: () => {
                    if (this.pauseMobsMenuItem) {
                        if (server_editor_namespaceObject.editor.simulation.isPaused()) {
                            this.pauseMobsMenuItem.checked = false;
                            server_editor_namespaceObject.editor.simulation.setPaused(false);
                        } else {
                            this.pauseMobsMenuItem.checked = true;
                            server_editor_namespaceObject.editor.simulation.setPaused(true);
                        }
                    }
                }
            });
            this.pauseMenu = worldOptions.addItem({
                label: "resourcePack.editor.menuBar.worldOptions.pause"
            });
            this.pauseMobsMenuItem = this.pauseMenu.addItem({
                label: "resourcePack.editor.menuBar.worldOptions.pause.entities",
                checked: server_editor_namespaceObject.editor.simulation.isPaused()
            }, alternatePauseMobsAction);
        }
        teardown() {
            server_namespaceObject.system.clearRun(this.periodicPauseCheckHandle);
        }
    }
    class PlayerCountBehavior {
        constructor(uiSession) {
            const statusBarItem = uiSession.statusBar.createItem({
                alignment: server_editor_namespaceObject.StatusBarAlignment.Right,
                icon: "playersIcon"
            });
            uiSession.eventSubscriptionCache.subscribeToBedrockEvent("playerJoin", (() => this.updateStatusBarText(statusBarItem, server_namespaceObject.world.getAllPlayers().length + 1)));
            uiSession.eventSubscriptionCache.subscribeToBedrockEvent("playerLeave", (() => this.updateStatusBarText(statusBarItem, server_namespaceObject.world.getAllPlayers().length)));
            this.updateStatusBarText(statusBarItem, server_namespaceObject.world.getAllPlayers().length);
        }
        updateStatusBarText(statusBarItem, playerCount) {
            statusBarItem.setText({
                id: "resourcePack.editor.statusBar.connectedPlayers",
                props: [ `${playerCount}` ]
            });
        }
        teardown() {}
    }
    function formatAsTimeString(hours, minutes) {
        return hours.toString().padStart(2, "0") + ":" + minutes.toString().padStart(2, "0");
    }
    const capitalizeWord = s => {
        if (s.length === 0) return s;
        return s.charAt(0).toUpperCase() + s.slice(1);
    };
    const mcHoursPerTick = 1e3;
    const mcMinsPerTick = 16.6667;
    const Custom = -2;
    const validGameModes = [ server_namespaceObject.GameMode.survival, server_namespaceObject.GameMode.creative, server_namespaceObject.GameMode.adventure ];
    const validDifficulties = [ server_namespaceObject.Difficulty.Peaceful, server_namespaceObject.Difficulty.Easy, server_namespaceObject.Difficulty.Normal, server_namespaceObject.Difficulty.Hard ];
    const validWeather = [ server_namespaceObject.WeatherType.Clear, server_namespaceObject.WeatherType.Rain, server_namespaceObject.WeatherType.Thunder ];
    const validDaylightCycle = [ server_editor_namespaceObject.DaylightCycle.Normal, server_editor_namespaceObject.DaylightCycle.AlwaysDay, server_editor_namespaceObject.DaylightCycle.LockTime ];
    const validTimes = [ {
        name: "Default",
        time: -1
    }, {
        name: "Day",
        time: server_namespaceObject.TimeOfDay.Day
    }, {
        name: "Noon",
        time: server_namespaceObject.TimeOfDay.Noon
    }, {
        name: "Sunset",
        time: server_namespaceObject.TimeOfDay.Sunset
    }, {
        name: "Night",
        time: server_namespaceObject.TimeOfDay.Night
    }, {
        name: "Midnight",
        time: server_namespaceObject.TimeOfDay.Midnight
    }, {
        name: "Sunrise",
        time: server_namespaceObject.TimeOfDay.Sunrise
    }, {
        name: "Custom",
        time: Custom
    } ];
    const paneDataDynamicPropertyName = "playtest:paneData";
    class PlaytestBehavior {
        constructor(uiSession) {
            this._lastPlayTestAvailability = false;
            this.initialize(uiSession);
        }
        addMenuItem(uiSession) {
            const coreMenuItems = uiSession.scratchStorage?.coreMenuItems;
            const playtestMenuItem = coreMenuItems?.worldOptions.addItem({
                label: "resourcePack.editor.playtest.Menu.Title"
            }, uiSession.actionManager.createAction({
                actionType: server_editor_namespaceObject.ActionTypes.NoArgsAction,
                onExecute: () => {
                    this._propertyPane?.show();
                }
            }));
            return playtestMenuItem;
        }
        buildPropertyPane(uiSession) {
            const propertyPane = uiSession.createPropertyPane({
                title: "resourcePack.editor.playtest.Dialog.Title",
                infoTooltip: {
                    description: [ {
                        link: "https://aka.ms/BedrockEditorTestSettings",
                        text: "resourcePack.editor.help.learnMore"
                    } ]
                }
            });
            const player = uiSession.extensionContext.player;
            const paneData = this.loadPlayTestDynamicProperties(uiSession);
            this._paneDataSource = (0, server_editor_namespaceObject.bindDataSource)(propertyPane, paneData);
            const gameTypeItems = validGameModes.map(((v, i) => {
                const item = {
                    label: capitalizeWord(v),
                    value: i
                };
                return item;
            }));
            propertyPane.addDropdown_deprecated(this._paneDataSource, "gameMode", {
                title: "resourcePack.editor.playtest.Dialog.GameMode",
                dropdownItems: gameTypeItems,
                onChange: () => {
                    this.savePlayTestDynamicProperties(player);
                }
            });
            const difficultyItems = validDifficulties.map(((v, i) => {
                const item = {
                    label: getEnumKeyByEnumValue(server_namespaceObject.Difficulty, v),
                    value: i
                };
                return item;
            }));
            propertyPane.addDropdown_deprecated(this._paneDataSource, "difficulty", {
                title: "resourcePack.editor.playtest.Dialog.Difficulty",
                dropdownItems: difficultyItems,
                onChange: () => {
                    this.savePlayTestDynamicProperties(player);
                }
            });
            propertyPane.addBool_deprecated(this._paneDataSource, "overrideSpawn", {
                title: "resourcePack.editor.playtest.Dialog.OverrideSpawn",
                onChange: () => {
                    this.savePlayTestDynamicProperties(player);
                }
            });
            const advancedPane = propertyPane.createSubPane({
                title: "resourcePack.editor.playtest.AdvancedSettings.title"
            });
            advancedPane.collapse();
            const daylightCycleItems = validDaylightCycle.map(((v, i) => {
                const item = {
                    label: getEnumKeyByEnumValue(server_editor_namespaceObject.DaylightCycle, v),
                    value: i
                };
                return item;
            }));
            advancedPane.addDropdown_deprecated(this._paneDataSource, "daylightCycle", {
                title: "resourcePack.editor.playtest.Dialog.DaylightCycle",
                dropdownItems: daylightCycleItems,
                onChange: () => {
                    this.savePlayTestDynamicProperties(player);
                }
            });
            const customTime = advancedPane.addString_deprecated(this._paneDataSource, "time", {
                title: "resourcePack.editor.timeOfDay.customTime",
                enable: this._paneDataSource.timeOfDay === 7,
                onChange: (_obj, _property, _oldValue, newValue) => {
                    this.savePlayTestDynamicProperties(player);
                    if (!this._paneDataSource) {
                        return;
                    }
                    if (_oldValue.toString() === newValue.toString()) {
                        return;
                    }
                    this._paneDataSource.time = this.parseTimeValue(newValue.toString());
                }
            });
            const timeItems = validTimes.map(((v, i) => {
                const item = {
                    label: v.name,
                    value: i
                };
                return item;
            }));
            advancedPane.addDropdown_deprecated(this._paneDataSource, "timeOfDay", {
                title: "resourcePack.editor.playtest.Dialog.TimeOfDay",
                dropdownItems: timeItems,
                onChange: (_obj, _property, _oldValue, newValue) => {
                    if (Number.isSafeInteger(newValue)) {
                        const num = Number(validTimes[Number(newValue)].time);
                        if (num === Custom) {
                            customTime.enable = true;
                        } else if (num >= 0) {
                            if (this._paneDataSource) {
                                this._paneDataSource.time = this.getTimeStringFromTime(num);
                            }
                            customTime.enable = false;
                        }
                    }
                    this.savePlayTestDynamicProperties(player);
                }
            });
            advancedPane.addBool_deprecated(this._paneDataSource, "weatherCycle", {
                title: "resourcePack.editor.playtest.Dialog.WeatherCycle",
                onChange: () => {
                    this.savePlayTestDynamicProperties(player);
                }
            });
            const weatherItems = validWeather.map(((v, i) => {
                const item = {
                    label: getEnumKeyByEnumValue(server_namespaceObject.WeatherType, v),
                    value: i
                };
                return item;
            }));
            advancedPane.addDropdown_deprecated(this._paneDataSource, "weather", {
                title: "resourcePack.editor.playtest.Dialog.weather",
                dropdownItems: weatherItems,
                onChange: (_obj, _property, _oldValue, _newValue) => {
                    if (this._paneDataSource) {
                        this._paneDataSource.weather = Number(_newValue);
                    }
                    this.savePlayTestDynamicProperties(player);
                }
            });
            advancedPane.addBool_deprecated(this._paneDataSource, "showCoordinates", {
                title: "resourcePack.editor.playtest.Dialog.ShowCoordinates",
                onChange: () => {
                    this.savePlayTestDynamicProperties(player);
                }
            });
            const informationSubPane = propertyPane.createSubPane({
                title: "Information"
            });
            informationSubPane.addText("resourcePack.editor.playtest.Title.Tooltip");
            this._lastPlayTestAvailability = uiSession.extensionContext.playtest.getPlaytestSessionAvailability() === server_editor_namespaceObject.PlaytestSessionResult.OK;
            this._testButton = propertyPane.addButton(uiSession.actionManager.createAction({
                actionType: server_editor_namespaceObject.ActionTypes.NoArgsAction,
                onExecute: async () => {
                    if (!this._paneDataSource) {
                        return;
                    }
                    const options = this.getGameOptionsFromPaneSourceData(this._paneDataSource, uiSession);
                    const readyCondition = uiSession.extensionContext.playtest.getPlaytestSessionAvailability();
                    const isReady = readyCondition === server_editor_namespaceObject.PlaytestSessionResult.OK;
                    uiSession.log.debug(`Session status result: ${getEnumKeyByEnumValue(server_editor_namespaceObject.PlaytestSessionResult, readyCondition)}`);
                    if (!isReady) {
                        if (this._testButton) {
                            this._testButton.enable = false;
                        }
                        return;
                    }
                    fireTelemetryEvent(player, TelemetrySource.TestWorld, "TestWorldButton", {
                        settings: options
                    });
                    const result = await uiSession.extensionContext.playtest.beginPlaytest(options);
                    uiSession.log.debug(`Ending Playtest Session with result: ${getEnumKeyByEnumValue(server_editor_namespaceObject.PlaytestSessionResult, result)}`);
                }
            }), {
                title: "resourcePack.editor.playtest.Dialog.TestButton",
                visible: true,
                enable: this._lastPlayTestAvailability
            });
            return propertyPane;
        }
        loadPlayTestDynamicProperties(uiSession) {
            const dynamicPaneData = uiSession.extensionContext.player.getDynamicProperty(paneDataDynamicPropertyName);
            if (dynamicPaneData) {
                try {
                    const paneData = JSON.parse(dynamicPaneData);
                    return paneData;
                } catch (error) {
                    uiSession.log.warning(`'${dynamicPaneData}' could not be parsed`);
                }
            }
            const defaultPaneData = {
                gameMode: 0,
                difficulty: 2,
                daylightCycle: server_editor_namespaceObject.DaylightCycle.Normal,
                respawnRadius: 10,
                weatherCycle: true,
                weather: 0,
                showCoordinates: true,
                timeOfDay: 0,
                time: "",
                overrideSpawn: true
            };
            return defaultPaneData;
        }
        savePlayTestDynamicProperties(player) {
            if (player) {
                player.setDynamicProperty(paneDataDynamicPropertyName, JSON.stringify(this._paneDataSource));
            }
        }
        parseTimeValue(timeString) {
            let returnStr = "";
            let time = Number(timeString);
            if (isNaN(time)) {
                if (timeString.indexOf(":") >= 0) {
                    const timeArray = timeString.split(":");
                    if (timeArray.length === 2) {
                        let hours = Number(timeArray[0]);
                        let minutes = Number(timeArray[1]);
                        if (!isNaN(hours) && !isNaN(minutes)) {
                            if (minutes > 59) {
                                minutes = 0;
                                hours += 1;
                            } else {
                                minutes = (0, lib.clampNumber)(minutes, 0, 59);
                            }
                            if (hours > 23) {
                                hours = 23;
                                minutes = 59;
                            } else {
                                hours = (0, lib.clampNumber)(hours, 0, 23);
                            }
                            returnStr = formatAsTimeString(hours.toString(), minutes.toString());
                        }
                    }
                }
            } else {
                time = (0, lib.clampNumber)(time, 0, 23999);
                returnStr = this.getTimeStringFromTime(time);
            }
            return returnStr;
        }
        getTimeFromTimeString(timeOfDay) {
            if (Number.isSafeInteger(timeOfDay)) {
                return Number(timeOfDay);
            } else {
                if (timeOfDay.indexOf(":")) {
                    const timeArray = timeOfDay.split(":");
                    if (timeArray.length === 2) {
                        let hours = Number(timeArray[0]) - 6;
                        if (hours < 0) {
                            hours = 24 - (6 + hours);
                        }
                        let minutes = Number(timeArray[1]);
                        hours = (0, lib.clampNumber)(hours, 0, 23);
                        minutes = (0, lib.clampNumber)(minutes, 0, 59);
                        return hours * mcHoursPerTick + minutes * mcMinsPerTick;
                    }
                }
            }
            return 0;
        }
        getTimeStringFromTime(timeOfDay) {
            const mcHours = Math.trunc(timeOfDay / mcHoursPerTick);
            const mcMinutes = timeOfDay % mcHoursPerTick;
            const hours = (mcHours + 6) % 24;
            let minutes = Math.round(mcMinutes / mcMinsPerTick);
            minutes = (0, lib.clampNumber)(minutes, 0, 59);
            return formatAsTimeString(hours.toString(), minutes.toString());
        }
        getGameOptionsFromPaneSourceData(data, uiSession) {
            const gameMode = validGameModes[data.gameMode];
            const difficulty = validDifficulties[data.difficulty];
            const timeOfDay = validTimes[data.timeOfDay].time;
            const daylightCycle = validDaylightCycle[data.daylightCycle];
            const options = {
                daylightCycle,
                difficulty,
                respawnRadius: data.respawnRadius,
                gameMode,
                disableWeather: !data.weatherCycle,
                weather: data.weather,
                showCoordinates: data.showCoordinates
            };
            if (timeOfDay === Custom) {
                options.timeOfDay = this.getTimeFromTimeString(data.time);
            } else if (timeOfDay >= 0) {
                options.timeOfDay = timeOfDay;
            } else {
                options.timeOfDay = 0;
            }
            if (data.overrideSpawn) {
                options.spawnPosition = uiSession.extensionContext.player.location;
                options.dimensionId = uiSession.extensionContext.player.dimension.id.replace("minecraft:", "").replace("_", " ");
            }
            return options;
        }
        initialize(uiSession) {
            this._extensionMenuItem = this.addMenuItem(uiSession);
            this._propertyPane = this.buildPropertyPane(uiSession);
            this._tickRunId = server_namespaceObject.system.runInterval((() => {
                const readyCondition = uiSession.extensionContext.playtest.getPlaytestSessionAvailability();
                const isReady = readyCondition === server_editor_namespaceObject.PlaytestSessionResult.OK;
                if (this._lastPlayTestAvailability !== isReady) {
                    if (this._testButton) {
                        this._testButton.enable = isReady;
                    }
                    this._lastPlayTestAvailability = isReady;
                }
            }), server_namespaceObject.TicksPerSecond / 4);
        }
        teardown() {
            if (this._tickRunId) {
                server_namespaceObject.system.clearRun(this._tickRunId);
            }
        }
    }
    const Controls = {
        Up: server_editor_namespaceObject.KeyboardKey.PAGE_UP,
        Down: server_editor_namespaceObject.KeyboardKey.PAGE_DOWN,
        Forward: server_editor_namespaceObject.KeyboardKey.UP,
        Back: server_editor_namespaceObject.KeyboardKey.DOWN,
        Left: server_editor_namespaceObject.KeyboardKey.LEFT,
        Right: server_editor_namespaceObject.KeyboardKey.RIGHT,
        Select: server_editor_namespaceObject.KeyboardKey.ENTER,
        Clear: server_editor_namespaceObject.KeyboardKey.KEY_D
    };
    var SelectionMode;
    (function(SelectionMode) {
        SelectionMode[SelectionMode["Marquee"] = 1] = "Marquee";
        SelectionMode[SelectionMode["Paint"] = 2] = "Paint";
    })(SelectionMode || (SelectionMode = {}));
    var QuickActionMode;
    (function(QuickActionMode) {
        QuickActionMode[QuickActionMode["Invalid"] = -1] = "Invalid";
        QuickActionMode[QuickActionMode["DeselectSelection"] = 1] = "DeselectSelection";
        QuickActionMode[QuickActionMode["FillSelection"] = 2] = "FillSelection";
        QuickActionMode[QuickActionMode["DeleteSelection"] = 3] = "DeleteSelection";
    })(QuickActionMode || (QuickActionMode = {}));
    var SelectionTelemetry;
    (function(SelectionTelemetry) {
        SelectionTelemetry["QuickAction"] = "QuickAction";
        SelectionTelemetry["FillSelection"] = "FillSelection";
        SelectionTelemetry["DeleteSelection"] = "DeleteSelection";
        SelectionTelemetry["FreehandSelectionBegin"] = "FreehandSelectionBegin";
        SelectionTelemetry["FreehandSelectionComplete"] = "FreehandSelectionComplete";
        SelectionTelemetry["SelectionCreated"] = "SelectionCreated";
        SelectionTelemetry["SelectionExpanded"] = "SelectionExpanded";
        SelectionTelemetry["SelectionMoveTop"] = "SelectionMoveTop";
        SelectionTelemetry["SelectionMoveAll"] = "SelectionMoveAll";
        SelectionTelemetry["SelectionShrink"] = "SelectionShrink";
        SelectionTelemetry["SelectionGrow"] = "SelectionGrow";
        SelectionTelemetry["ModeChanged"] = "ModeChanged";
        SelectionTelemetry["Deselect"] = "Deselect";
    })(SelectionTelemetry || (SelectionTelemetry = {}));
    class SelectionBehavior {
        get toolId() {
            return this.tool.id;
        }
        constructor(uiSession) {
            this.uiSession = uiSession;
            this._quickActionMode = (0, server_editor_namespaceObject.makeObservable)(QuickActionMode.Invalid);
            this.moveTopSelection = (uiSession, lastAnchor, direction) => {
                const lastVolumeItem = uiSession.extensionContext.selectionManager.selection.peekLastVolume();
                if (!lastVolumeItem) {
                    return undefined;
                }
                this.telemetryManager.fireTelemetryEvent(SelectionTelemetry.SelectionMoveTop, {
                    direction
                });
                const lastVolume = lastVolumeItem.volume;
                uiSession.extensionContext.selectionManager.selection.popVolume();
                const rotationY = uiSession.extensionContext.player.getRotation().y;
                const correctedVector = getRotationCorrectedDirectionVector(rotationY, direction);
                const newVolume = lastVolume;
                newVolume.translate({
                    x: correctedVector.x,
                    y: correctedVector.y,
                    z: correctedVector.z
                });
                uiSession.extensionContext.selectionManager.selection.pushVolume({
                    action: lastVolumeItem.action,
                    volume: newVolume
                });
                const updatedClick = {
                    x: lastAnchor.x + correctedVector.x,
                    y: lastAnchor.y + correctedVector.y,
                    z: lastAnchor.z + correctedVector.z
                };
                return updatedClick;
            };
            this.moveAllSelections = (uiSession, anchorPosition, direction) => {
                if (uiSession.extensionContext.selectionManager.selection.isEmpty) {
                    return undefined;
                }
                this.telemetryManager.fireTelemetryEvent(SelectionTelemetry.SelectionMoveAll, {
                    direction
                });
                const rotationY = uiSession.extensionContext.player.getRotation().y;
                const correctedVector = getRotationCorrectedDirectionVector(rotationY, direction);
                uiSession.extensionContext.selectionManager.selection.moveBy({
                    x: correctedVector.x,
                    y: correctedVector.y,
                    z: correctedVector.z
                });
                const updatedClick = {
                    x: anchorPosition.x + correctedVector.x,
                    y: anchorPosition.y + correctedVector.y,
                    z: anchorPosition.z + correctedVector.z
                };
                return updatedClick;
            };
            this.shrinkVolume = (uiSession, direction) => {
                const lastVolumeItem = uiSession.extensionContext.selectionManager.selection.peekLastVolume();
                if (!lastVolumeItem) {
                    return;
                }
                this.telemetryManager.fireTelemetryEvent(SelectionTelemetry.SelectionShrink, {
                    direction
                });
                const lastVolume = lastVolumeItem.volume;
                uiSession.extensionContext.selectionManager.selection.popVolume();
                const rotationY = uiSession.extensionContext.player.getRotation().y;
                const newVolume = shrinkVolumeAlongViewAxis(lastVolume, rotationY, direction, 1);
                uiSession.extensionContext.selectionManager.selection.pushVolume({
                    action: lastVolumeItem.action,
                    volume: newVolume
                });
            };
            this.growVolume = (uiSession, direction) => {
                const lastVolumeItem = uiSession.extensionContext.selectionManager.selection.peekLastVolume();
                if (!lastVolumeItem) {
                    return;
                }
                this.telemetryManager.fireTelemetryEvent(SelectionTelemetry.SelectionGrow, {
                    direction
                });
                const lastVolume = lastVolumeItem.volume;
                uiSession.extensionContext.selectionManager.selection.popVolume();
                const rotationY = uiSession.extensionContext.player.getRotation().y;
                const newVolume = growVolumeAlongViewAxis(lastVolume, rotationY, direction, 1);
                uiSession.extensionContext.selectionManager.selection.pushVolume({
                    action: lastVolumeItem.action,
                    volume: newVolume
                });
            };
            this.bindToolInput = uiSession => {
                const singleClickAction = uiSession.actionManager.createAction({
                    actionType: server_editor_namespaceObject.ActionTypes.MouseRayCastAction,
                    onExecute: (mouseRay, mouseProps) => {
                        if (this._selectionMode.value === SelectionMode.Marquee) {
                            if (mouseProps.mouseAction === server_editor_namespaceObject.MouseActionType.LeftButton) {
                                if (mouseProps.inputType === server_editor_namespaceObject.MouseInputType.ButtonDown) {
                                    if (mouseRay.rayHit || this._cursorModeControl.cursorProperties.controlMode === server_editor_namespaceObject.CursorControlMode.Fixed) {
                                        this.singleClick(uiSession, mouseRay, mouseProps.modifiers.shift, mouseProps.modifiers.ctrl, mouseProps.modifiers.alt);
                                    } else {
                                        uiSession.extensionContext.selectionManager.selection.clear();
                                    }
                                } else if (mouseProps.inputType === server_editor_namespaceObject.MouseInputType.ButtonUp) {}
                            }
                        } else if (this._selectionMode.value === SelectionMode.Paint) {
                            if (mouseProps.mouseAction === server_editor_namespaceObject.MouseActionType.LeftButton) {
                                if (mouseProps.inputType === server_editor_namespaceObject.MouseInputType.ButtonDown) {
                                    if (!mouseProps.modifiers.shift) {
                                        this.uiSession.extensionContext.selectionManager.selection.clear();
                                    }
                                    this._beginFreehandSelection();
                                } else if (mouseProps.inputType === server_editor_namespaceObject.MouseInputType.ButtonUp && this._freehandSelectionActive) {
                                    this._endFreehandSelection();
                                }
                            }
                        }
                    }
                });
                this.tool.registerMouseButtonBinding(singleClickAction);
                const moveSelectionUpAction = uiSession.actionManager.createAction({
                    actionType: server_editor_namespaceObject.ActionTypes.NoArgsAction,
                    onExecute: () => {
                        const updatedAnchor = this.moveTopSelection(uiSession, this.lastAnchorPosition, Direction.Up);
                        if (updatedAnchor) {
                            this.lastAnchorPosition = updatedAnchor;
                        }
                    }
                });
                const moveSelectionDownAction = uiSession.actionManager.createAction({
                    actionType: server_editor_namespaceObject.ActionTypes.NoArgsAction,
                    onExecute: () => {
                        const updatedAnchor = this.moveTopSelection(uiSession, this.lastAnchorPosition, Direction.Down);
                        if (updatedAnchor) {
                            this.lastAnchorPosition = updatedAnchor;
                        }
                    }
                });
                const moveSelectionLeftAction = uiSession.actionManager.createAction({
                    actionType: server_editor_namespaceObject.ActionTypes.NoArgsAction,
                    onExecute: () => {
                        const updatedAnchor = this.moveTopSelection(uiSession, this.lastAnchorPosition, Direction.Left);
                        if (updatedAnchor) {
                            this.lastAnchorPosition = updatedAnchor;
                        }
                    }
                });
                const moveSelectionRightAction = uiSession.actionManager.createAction({
                    actionType: server_editor_namespaceObject.ActionTypes.NoArgsAction,
                    onExecute: () => {
                        const updatedAnchor = this.moveTopSelection(uiSession, this.lastAnchorPosition, Direction.Right);
                        if (updatedAnchor) {
                            this.lastAnchorPosition = updatedAnchor;
                        }
                    }
                });
                const moveSelectionForwardAction = uiSession.actionManager.createAction({
                    actionType: server_editor_namespaceObject.ActionTypes.NoArgsAction,
                    onExecute: () => {
                        const updatedAnchor = this.moveTopSelection(uiSession, this.lastAnchorPosition, Direction.Forward);
                        if (updatedAnchor) {
                            this.lastAnchorPosition = updatedAnchor;
                        }
                    }
                });
                const moveSelectionBackAction = uiSession.actionManager.createAction({
                    actionType: server_editor_namespaceObject.ActionTypes.NoArgsAction,
                    onExecute: () => {
                        const updatedAnchor = this.moveTopSelection(uiSession, this.lastAnchorPosition, Direction.Back);
                        if (updatedAnchor) {
                            this.lastAnchorPosition = updatedAnchor;
                        }
                    }
                });
                this._registerToolKeyBinding(moveSelectionForwardAction, {
                    key: Controls.Forward,
                    modifier: server_editor_namespaceObject.InputModifier.Alt
                }, "moveSelectionForward");
                this._registerToolKeyBinding(moveSelectionBackAction, {
                    key: Controls.Back,
                    modifier: server_editor_namespaceObject.InputModifier.Alt
                }, "moveSelectionBack");
                this._registerToolKeyBinding(moveSelectionLeftAction, {
                    key: Controls.Left,
                    modifier: server_editor_namespaceObject.InputModifier.Alt
                }, "moveSelectionLeft");
                this._registerToolKeyBinding(moveSelectionRightAction, {
                    key: Controls.Right,
                    modifier: server_editor_namespaceObject.InputModifier.Alt
                }, "moveSelectionRight");
                this._registerToolKeyBinding(moveSelectionUpAction, {
                    key: Controls.Up,
                    modifier: server_editor_namespaceObject.InputModifier.Alt
                }, "moveSelectionUp");
                this._registerToolKeyBinding(moveSelectionDownAction, {
                    key: Controls.Down,
                    modifier: server_editor_namespaceObject.InputModifier.Alt
                }, "moveSelectionDown");
                const moveAllSelectionUpAction = uiSession.actionManager.createAction({
                    actionType: server_editor_namespaceObject.ActionTypes.NoArgsAction,
                    onExecute: () => {
                        const updatedAnchor = this.moveAllSelections(uiSession, this.lastAnchorPosition, Direction.Up);
                        if (updatedAnchor) {
                            this.lastAnchorPosition = updatedAnchor;
                        }
                    }
                });
                const moveAllSelectionDownAction = uiSession.actionManager.createAction({
                    actionType: server_editor_namespaceObject.ActionTypes.NoArgsAction,
                    onExecute: () => {
                        const updatedAnchor = this.moveAllSelections(uiSession, this.lastAnchorPosition, Direction.Down);
                        if (updatedAnchor) {
                            this.lastAnchorPosition = updatedAnchor;
                        }
                    }
                });
                const moveAllSelectionLeftAction = uiSession.actionManager.createAction({
                    actionType: server_editor_namespaceObject.ActionTypes.NoArgsAction,
                    onExecute: () => {
                        const updatedAnchor = this.moveAllSelections(uiSession, this.lastAnchorPosition, Direction.Left);
                        if (updatedAnchor) {
                            this.lastAnchorPosition = updatedAnchor;
                        }
                    }
                });
                const moveAllSelectionRightAction = uiSession.actionManager.createAction({
                    actionType: server_editor_namespaceObject.ActionTypes.NoArgsAction,
                    onExecute: () => {
                        const updatedAnchor = this.moveAllSelections(uiSession, this.lastAnchorPosition, Direction.Right);
                        if (updatedAnchor) {
                            this.lastAnchorPosition = updatedAnchor;
                        }
                    }
                });
                const moveAllSelectionForwardAction = uiSession.actionManager.createAction({
                    actionType: server_editor_namespaceObject.ActionTypes.NoArgsAction,
                    onExecute: () => {
                        const updatedAnchor = this.moveAllSelections(uiSession, this.lastAnchorPosition, Direction.Forward);
                        if (updatedAnchor) {
                            this.lastAnchorPosition = updatedAnchor;
                        }
                    }
                });
                const moveAllSelectionBackAction = uiSession.actionManager.createAction({
                    actionType: server_editor_namespaceObject.ActionTypes.NoArgsAction,
                    onExecute: () => {
                        const updatedAnchor = this.moveAllSelections(uiSession, this.lastAnchorPosition, Direction.Back);
                        if (updatedAnchor) {
                            this.lastAnchorPosition = updatedAnchor;
                        }
                    }
                });
                this._registerToolKeyBinding(moveAllSelectionForwardAction, {
                    key: Controls.Forward,
                    modifier: server_editor_namespaceObject.InputModifier.Alt | server_editor_namespaceObject.InputModifier.Control
                }, "moveAllSelectionForward");
                this._registerToolKeyBinding(moveAllSelectionBackAction, {
                    key: Controls.Back,
                    modifier: server_editor_namespaceObject.InputModifier.Alt | server_editor_namespaceObject.InputModifier.Control
                }, "moveAllSelectionBack");
                this._registerToolKeyBinding(moveAllSelectionLeftAction, {
                    key: Controls.Left,
                    modifier: server_editor_namespaceObject.InputModifier.Alt | server_editor_namespaceObject.InputModifier.Control
                }, "moveAllSelectionLeft");
                this._registerToolKeyBinding(moveAllSelectionRightAction, {
                    key: Controls.Right,
                    modifier: server_editor_namespaceObject.InputModifier.Alt | server_editor_namespaceObject.InputModifier.Control
                }, "moveAllSelectionRight");
                this._registerToolKeyBinding(moveAllSelectionUpAction, {
                    key: Controls.Up,
                    modifier: server_editor_namespaceObject.InputModifier.Alt | server_editor_namespaceObject.InputModifier.Control
                }, "moveAllSelectionUp");
                this._registerToolKeyBinding(moveAllSelectionDownAction, {
                    key: Controls.Down,
                    modifier: server_editor_namespaceObject.InputModifier.Alt | server_editor_namespaceObject.InputModifier.Control
                }, "moveAllSelectionDown");
                const keySelectAction = uiSession.actionManager.createAction({
                    actionType: server_editor_namespaceObject.ActionTypes.NoArgsAction,
                    onExecute: () => {
                        const blockLocation = uiSession.extensionContext.cursor.getPosition();
                        const ray = {
                            location: lib.VECTOR3_ZERO,
                            direction: lib.VECTOR3_ZERO,
                            cursorBlockLocation: blockLocation,
                            rayHit: false
                        };
                        if (this._selectionMode.value === SelectionMode.Marquee) {
                            this.singleClick(uiSession, ray, false, false, false);
                        } else {
                            this._beginFreehandSelection(true);
                        }
                    }
                });
                this.tool.registerKeyBinding(keySelectAction, {
                    key: Controls.Select
                });
                const keySelectMultipleAction = uiSession.actionManager.createAction({
                    actionType: server_editor_namespaceObject.ActionTypes.NoArgsAction,
                    onExecute: () => {
                        const blockLocation = uiSession.extensionContext.cursor.getPosition();
                        const ray = {
                            location: lib.VECTOR3_ZERO,
                            direction: lib.VECTOR3_ZERO,
                            cursorBlockLocation: blockLocation,
                            rayHit: false
                        };
                        if (this._selectionMode.value === SelectionMode.Marquee) {
                            this.singleClick(uiSession, ray, false, true, false);
                        } else {
                            this._beginFreehandSelection(true);
                        }
                    }
                });
                this.tool.registerKeyBinding(keySelectMultipleAction, {
                    key: Controls.Select,
                    modifier: server_editor_namespaceObject.InputModifier.Control
                });
                const keySelectAndExtendAction = uiSession.actionManager.createAction({
                    actionType: server_editor_namespaceObject.ActionTypes.NoArgsAction,
                    onExecute: () => {
                        const blockLocation = uiSession.extensionContext.cursor.getPosition();
                        const ray = {
                            location: lib.VECTOR3_ZERO,
                            direction: lib.VECTOR3_ZERO,
                            cursorBlockLocation: blockLocation,
                            rayHit: false
                        };
                        if (this._selectionMode.value === SelectionMode.Marquee) {
                            this.singleClick(uiSession, ray, true, false, false);
                        } else {
                            this._beginFreehandSelection(true);
                        }
                    }
                });
                this.tool.registerKeyBinding(keySelectAndExtendAction, {
                    key: Controls.Select,
                    modifier: server_editor_namespaceObject.InputModifier.Shift
                });
                const keyGrowUpAction = uiSession.actionManager.createAction({
                    actionType: server_editor_namespaceObject.ActionTypes.NoArgsAction,
                    onExecute: () => {
                        this.growVolume(uiSession, Direction.Up);
                    }
                });
                this._registerToolKeyBinding(keyGrowUpAction, {
                    key: Controls.Up,
                    modifier: server_editor_namespaceObject.InputModifier.Shift
                }, "growUp");
                const keyGrowDownAction = uiSession.actionManager.createAction({
                    actionType: server_editor_namespaceObject.ActionTypes.NoArgsAction,
                    onExecute: () => {
                        this.growVolume(uiSession, Direction.Down);
                    }
                });
                this._registerToolKeyBinding(keyGrowDownAction, {
                    key: Controls.Down,
                    modifier: server_editor_namespaceObject.InputModifier.Shift
                }, "growDown");
                const keyGrowForwardAction = uiSession.actionManager.createAction({
                    actionType: server_editor_namespaceObject.ActionTypes.NoArgsAction,
                    onExecute: () => {
                        this.growVolume(uiSession, Direction.Forward);
                    }
                });
                this._registerToolKeyBinding(keyGrowForwardAction, {
                    key: Controls.Forward,
                    modifier: server_editor_namespaceObject.InputModifier.Shift
                }, "growForward");
                const keyGrowBackAction = uiSession.actionManager.createAction({
                    actionType: server_editor_namespaceObject.ActionTypes.NoArgsAction,
                    onExecute: () => {
                        this.growVolume(uiSession, Direction.Back);
                    }
                });
                this._registerToolKeyBinding(keyGrowBackAction, {
                    key: Controls.Back,
                    modifier: server_editor_namespaceObject.InputModifier.Shift
                }, "growBack");
                const keyGrowLeftAction = uiSession.actionManager.createAction({
                    actionType: server_editor_namespaceObject.ActionTypes.NoArgsAction,
                    onExecute: () => {
                        this.growVolume(uiSession, Direction.Left);
                    }
                });
                this._registerToolKeyBinding(keyGrowLeftAction, {
                    key: Controls.Left,
                    modifier: server_editor_namespaceObject.InputModifier.Shift
                }, "growLeft");
                const keyGrowRightAction = uiSession.actionManager.createAction({
                    actionType: server_editor_namespaceObject.ActionTypes.NoArgsAction,
                    onExecute: () => {
                        this.growVolume(uiSession, Direction.Right);
                    }
                });
                this._registerToolKeyBinding(keyGrowRightAction, {
                    key: Controls.Right,
                    modifier: server_editor_namespaceObject.InputModifier.Shift
                }, "growRight");
                const keyShrinkUpAction = uiSession.actionManager.createAction({
                    actionType: server_editor_namespaceObject.ActionTypes.NoArgsAction,
                    onExecute: () => {
                        this.shrinkVolume(uiSession, Direction.Up);
                    }
                });
                this._registerToolKeyBinding(keyShrinkUpAction, {
                    key: Controls.Up,
                    modifier: server_editor_namespaceObject.InputModifier.Control
                }, "shrinkUp");
                const keyShrinkDownAction = uiSession.actionManager.createAction({
                    actionType: server_editor_namespaceObject.ActionTypes.NoArgsAction,
                    onExecute: () => {
                        this.shrinkVolume(uiSession, Direction.Down);
                    }
                });
                this._registerToolKeyBinding(keyShrinkDownAction, {
                    key: Controls.Down,
                    modifier: server_editor_namespaceObject.InputModifier.Control
                }, "shrinkDown");
                const keyShrinkForwardAction = uiSession.actionManager.createAction({
                    actionType: server_editor_namespaceObject.ActionTypes.NoArgsAction,
                    onExecute: () => {
                        this.shrinkVolume(uiSession, Direction.Forward);
                    }
                });
                this._registerToolKeyBinding(keyShrinkForwardAction, {
                    key: Controls.Forward,
                    modifier: server_editor_namespaceObject.InputModifier.Control
                }, "shrinkForward");
                const keyShrinkBackAction = uiSession.actionManager.createAction({
                    actionType: server_editor_namespaceObject.ActionTypes.NoArgsAction,
                    onExecute: () => {
                        this.shrinkVolume(uiSession, Direction.Back);
                    }
                });
                this._registerToolKeyBinding(keyShrinkBackAction, {
                    key: Controls.Back,
                    modifier: server_editor_namespaceObject.InputModifier.Control
                }, "shrinkBack");
                const keyShrinkLeftAction = uiSession.actionManager.createAction({
                    actionType: server_editor_namespaceObject.ActionTypes.NoArgsAction,
                    onExecute: () => {
                        this.shrinkVolume(uiSession, Direction.Left);
                    }
                });
                this._registerToolKeyBinding(keyShrinkLeftAction, {
                    key: Controls.Left,
                    modifier: server_editor_namespaceObject.InputModifier.Control
                }, "shrinkLeft");
                const keyShrinkRightAction = uiSession.actionManager.createAction({
                    actionType: server_editor_namespaceObject.ActionTypes.NoArgsAction,
                    onExecute: () => {
                        this.shrinkVolume(uiSession, Direction.Right);
                    }
                });
                this._registerToolKeyBinding(keyShrinkRightAction, {
                    key: Controls.Right,
                    modifier: server_editor_namespaceObject.InputModifier.Control
                }, "shrinkRight");
            };
            this.updateSelectionInfo = uiSession => {
                if (!uiSession.extensionContext.selectionManager) {
                    return;
                }
                const selection = uiSession.extensionContext.selectionManager.selection;
                const lastVolumeItem = selection.peekLastVolume(server_namespaceObject.CompoundBlockVolumePositionRelativity.Absolute);
                if (!lastVolumeItem) {
                    if (this.originPropertyItem) {
                        this.originPropertyItem.enable = false;
                    }
                    if (this.sizePropertyItem) {
                        this.sizePropertyItem.enable = false;
                    }
                    return;
                }
                if (this.originPropertyItem) {
                    this.originPropertyItem.enable = true;
                }
                if (this.sizePropertyItem) {
                    this.sizePropertyItem.enable = true;
                }
                const lastVolume = lastVolumeItem.volume;
                const bounds = lastVolume.getBoundingBox();
                const boundsSize = server_namespaceObject.BoundingBoxUtils.getSpan(bounds);
                const x = Math.trunc(bounds.min.x);
                const y = Math.trunc(bounds.min.y);
                const z = Math.trunc(bounds.min.z);
                const origin = this.origin.value;
                if (origin.x !== x || origin.y !== y || origin.z !== z) {
                    this.origin.set({
                        x,
                        y,
                        z
                    });
                }
                const sx = Math.trunc(boundsSize.x);
                const sy = Math.trunc(boundsSize.y);
                const sz = Math.trunc(boundsSize.z);
                const size = this.size.value;
                if (size.x !== sx || size.y !== sy || size.z !== sz) {
                    this.size.set({
                        x: sx,
                        y: sy,
                        z: sz
                    });
                }
            };
            this.addModeSelectionControls = (_uiSession, _parentPane) => {
                _parentPane.addToggleGroup(this._selectionMode, {
                    title: "resourcePack.editor.selectionTool.modeSelection.title",
                    hiddenLabel: false,
                    entries: [ {
                        value: SelectionMode.Marquee,
                        label: "resourcePack.editor.selectionTool.modeSelection.marquee.title",
                        icon: "marqueeIcon",
                        tooltip: "resourcePack.editor.selectionTool.modeSelection.marquee.tooltip"
                    }, {
                        value: SelectionMode.Paint,
                        label: "resourcePack.editor.selectionTool.modeSelection.freehand.title",
                        icon: "brushIcon",
                        tooltip: "resourcePack.editor.selectionTool.modeSelection.freehand.tooltip"
                    } ],
                    onChange: (_newValue, _oldValue) => {
                        this.switchSelectionMode(_newValue, _oldValue, true);
                    }
                });
                _parentPane.addDivider();
                _parentPane.addToggleGroup(this._quickActionMode, {
                    title: "resourcePack.editor.selectionTool.quickAction.title",
                    hiddenLabel: false,
                    entries: [ {
                        value: QuickActionMode.DeselectSelection,
                        label: "resourcePack.editor.selectionTool.quickAction.clearSelection",
                        icon: "marqueeRemoveIcon",
                        tooltip: "resourcePack.editor.selectionTool.quickAction.clearSelection.tooltip"
                    }, {
                        value: QuickActionMode.FillSelection,
                        label: "resourcePack.editor.selectionTool.quickAction.fillSelection",
                        icon: "fillIcon",
                        tooltip: "resourcePack.editor.selectionTool.quickAction.fillSelection.tooltip"
                    }, {
                        value: QuickActionMode.DeleteSelection,
                        label: "resourcePack.editor.selectionTool.quickAction.deleteSelection",
                        icon: "clearIcon",
                        tooltip: "resourcePack.editor.selectionTool.quickAction.deleteSelection.tooltip"
                    } ],
                    onChange: _newValue => {
                        this._quickActionMode.set(QuickActionMode.Invalid);
                        switch (_newValue) {
                          case QuickActionMode.DeselectSelection:
                            this.telemetryManager.fireTelemetryEvent(SelectionTelemetry.QuickAction, {
                                action: SelectionTelemetry.Deselect
                            });
                            this.uiSession.extensionContext.selectionManager.selection.clear();
                            break;

                          case QuickActionMode.FillSelection:
                            {
                                this.telemetryManager.fireTelemetryEvent(SelectionTelemetry.QuickAction, {
                                    action: SelectionTelemetry.FillSelection
                                });
                                this.performFillOperation(this.uiSession, this.uiSession.extensionContext).catch((e => this.uiSession.log.error(e.message)));
                            }
                            break;

                          case QuickActionMode.DeleteSelection:
                            {
                                const blockType = server_namespaceObject.BlockTypes.get(MinecraftBlockTypes.Air);
                                if (!blockType) {
                                    return;
                                }
                                this.telemetryManager.fireTelemetryEvent(SelectionTelemetry.QuickAction, {
                                    action: SelectionTelemetry.DeleteSelection
                                });
                                this.performDeleteOperation(this.uiSession).catch((e => this.uiSession.log.error(e.message)));
                            }
                        }
                    }
                });
                _parentPane.addDivider();
            };
            this.addTool = (uiSession, action) => {
                const tool = uiSession.toolRail.addTool("editor:modalTool:selection", {
                    title: "resourcePack.editor.selectionTool.toolRail.title",
                    icon: "pack://textures/editor/marquee.png?filtering=point",
                    tooltip: "resourcePack.editor.selectionTool.toolRail.description",
                    action
                });
                tool.onModalToolActivation.subscribe((eventData => {
                    if (eventData.isActiveTool) {
                        this.backedUpColors = backupColors(uiSession.extensionContext);
                        uiSession.extensionContext.cursor.setProperties(this.toolCursorProperties);
                        this.updateSelectionInfo(uiSession);
                        uiSession.extensionContext.afterEvents.primarySelectionChange.subscribe(this.onSelectionChange);
                    } else {
                        if (this.backedUpColors) {
                            restoreBackedUpColors(uiSession.extensionContext, this.backedUpColors);
                            this.backedUpColors = undefined;
                        }
                    }
                }));
                return tool;
            };
            this.onSelectionChange = () => {
                this.updateSelectionInfo(this.uiSession);
            };
            this.bindGlobalActivationShortcut = (uiSession, storage) => {
                const deselectAction = uiSession.actionManager.createAction({
                    actionType: server_editor_namespaceObject.ActionTypes.NoArgsAction,
                    onExecute: () => {
                        this.telemetryManager.fireTelemetryEvent(SelectionTelemetry.Deselect);
                        uiSession.extensionContext.selectionManager.selection.clear();
                    }
                });
                uiSession.inputManager.registerKeyBinding(server_editor_namespaceObject.EditorInputContext.GlobalToolMode, this.toggleAction, {
                    key: server_editor_namespaceObject.KeyboardKey.KEY_S,
                    modifier: server_editor_namespaceObject.InputModifier.Control
                }, {
                    uniqueId: "editor:toolModeKeyBinding:toggleSelection",
                    label: "resourcePack.editor.selectionTool.keyBinding.toggleTool"
                });
                uiSession.inputManager.registerKeyBinding(server_editor_namespaceObject.EditorInputContext.GlobalToolMode, this.executeFillAction, {
                    key: server_editor_namespaceObject.KeyboardKey.KEY_F,
                    modifier: server_editor_namespaceObject.InputModifier.Control
                }, {
                    uniqueId: "editor:toolModeKeyBinding:fillSelection",
                    label: "resourcePack.editor.selectionTool.keyBinding.fill"
                });
                uiSession.inputManager.registerKeyBinding(server_editor_namespaceObject.EditorInputContext.GlobalToolMode, deselectAction, {
                    key: server_editor_namespaceObject.KeyboardKey.KEY_D,
                    modifier: server_editor_namespaceObject.InputModifier.Control
                }, {
                    uniqueId: "editor:toolModeKeyBinding:deselectSelection",
                    label: "resourcePack.editor.selectionTool.keyBinding.deselect"
                });
                storage.coreMenuItems?.edit.addItem({
                    label: "resourcePack.editor.menuBar.edit.quickFill"
                }, this.executeFillAction);
                storage.coreMenuItems?.edit.addItem({
                    label: "resourcePack.editor.menuBar.edit.deselect"
                }, deselectAction);
            };
            this.performFillOperation = async (session, context) => {
                if (context.selectionManager.selection.isEmpty) {
                    session.log.warning("No selection available to fill");
                    return;
                }
                const onError = e => {
                    session.log.error(`Fill operation failed with error: ${e.message}`);
                };
                await executeFunctionWithTransactionAndTicking(session.extensionContext, session.log, context.selectionManager.selection, "Select-Fill", (() => {
                    session.extensionContext.blockUtilities.fillVolume(context.selectionManager.selection);
                })).catch(onError);
            };
            this.performDeleteOperation = async session => {
                await deleteOperation(session);
            };
            const storage = uiSession.scratchStorage;
            if (!storage) {
                throw new Error("Can not instantiate Selection functionality without valid CoreEditor storage.");
            }
            this.telemetryManager = new TelemetryManager(uiSession.extensionContext.player, TelemetrySource.Selection);
            this._freehandSelectionActive = false;
            this._selectionMode = (0, server_editor_namespaceObject.makeObservable)(SelectionMode.Marquee);
            this.origin = (0, server_editor_namespaceObject.makeObservable)({
                x: 0,
                y: 0,
                z: 0
            });
            this.size = (0, server_editor_namespaceObject.makeObservable)({
                x: 1,
                y: 1,
                z: 1
            });
            this.toolCursorProperties = {
                outlineColor: {
                    red: 1,
                    green: 1,
                    blue: 0,
                    alpha: 1
                },
                controlMode: server_editor_namespaceObject.CursorControlMode.KeyboardAndMouse,
                targetMode: server_editor_namespaceObject.CursorTargetMode.Block,
                visible: true
            };
            this.toggleAction = uiSession.actionManager.createAction({
                actionType: server_editor_namespaceObject.ActionTypes.NoArgsAction,
                onExecute: () => {
                    uiSession.toolRail.setSelectedToolId(this.tool.id);
                }
            });
            this.executeFillAction = uiSession.actionManager.createAction({
                actionType: server_editor_namespaceObject.ActionTypes.NoArgsAction,
                onExecute: () => {
                    this.telemetryManager.fireTelemetryEvent(SelectionTelemetry.FillSelection);
                    this.performFillOperation(uiSession, uiSession.extensionContext).catch((e => uiSession.log.error(e.message)));
                }
            });
            this.tool = this.addTool(uiSession, this.toggleAction);
            this.rootPane = uiSession.createPropertyPane({
                title: "resourcePack.editor.selectionTool.settingsPane.title",
                infoTooltip: {
                    description: [ "resourcePack.editor.selectionTool.toolRail.description", {
                        link: "https://aka.ms/BedrockEditorSelection",
                        text: "resourcePack.editor.help.learnMore"
                    } ]
                }
            });
            this.tool.bindPropertyPane(this.rootPane);
            this.addModeSelectionControls(uiSession, this.rootPane);
            {
                this._cursorControlHolderPane = this.rootPane.createSubPane({
                    title: "Hidden Cursor Control Holder Pane",
                    hasExpander: false
                });
                const bindManualControls = true;
                this._cursorModeControl = new CursorModeControl(this.uiSession, this.tool, this._cursorControlHolderPane, bindManualControls, this.toolCursorProperties, {
                    hasPaneMargins: false
                });
                this._cursorModeControl.initialize();
                this.rootPane.addDivider();
            }
            this._modeHolderPane = this.rootPane.createSubPane({
                title: "Hidden Mode Holder Pane",
                hasExpander: false
            });
            this.constructMarqueeUIControls(uiSession, this._modeHolderPane);
            {
                this._brushControl = new BrushPaintSharedControl(uiSession, this.tool, this._modeHolderPane, {
                    paintMode: server_editor_namespaceObject.PaintMode.FreehandSelect,
                    brushShapeType: server_editor_bindings_namespaceObject.BrushShapeType.OffsetList
                }, {
                    hasPaneMargins: false
                });
                this._brushControl.initialize();
            }
            this.tool.onModalToolActivation.subscribe((eventData => {
                if (eventData.isActiveTool) {
                    this.switchSelectionMode(this._selectionMode.value);
                    this._cursorModeControl.activateControl();
                    this.updateSelectionInfo(uiSession);
                    uiSession.extensionContext.afterEvents.primarySelectionChange.subscribe(this.onSelectionChange);
                } else {
                    this.switchSelectionMode(undefined, this._selectionMode.value);
                    this._cursorModeControl.deactivateControl();
                    uiSession.extensionContext.afterEvents.primarySelectionChange.unsubscribe(this.onSelectionChange);
                }
            }));
            this.lastAnchorPosition = {
                x: 0,
                y: 0,
                z: 0
            };
            this.bindToolInput(uiSession);
            this.bindGlobalActivationShortcut(uiSession, storage);
            server_namespaceObject.system.runTimeout((() => uiSession.toolRail.setSelectedToolId(this.tool.id)));
            uiSession.extensionContext.afterEvents.primarySelectionChange.subscribe(this.onSelectionChange);
        }
        teardown() {
            this._cursorModeControl.shutdown();
            this._brushControl.shutdown();
            this.uiSession.extensionContext.afterEvents.primarySelectionChange.unsubscribe(this.onSelectionChange);
            this.uiSession.extensionContext.selectionManager.selection.clear();
        }
        _beginFreehandSelection(_oneShot = false) {
            if (this._freehandSelectionActive) {
                throw new Error("Freehand selection already active");
            }
            if (this._selectionMode.value !== SelectionMode.Paint) {
                throw new Error("Freehand selection can only be activated in Freehand Paint mode");
            }
            this.telemetryManager.fireTelemetryEvent(SelectionTelemetry.FreehandSelectionBegin, {
                oneShot: _oneShot
            });
            this._freehandSelectionActive = true;
            if (_oneShot) {
                this.uiSession.extensionContext.brushShapeManager.singlePaint((_state => {
                    this._freehandSelectionActive = false;
                }));
            } else {
                this.uiSession.extensionContext.brushShapeManager.beginPainting((_state => {
                    this._freehandSelectionActive = false;
                }));
            }
        }
        _endFreehandSelection() {
            if (!this._freehandSelectionActive) {
                throw new Error("Freehand selection not active");
            }
            this.telemetryManager.fireTelemetryEvent(SelectionTelemetry.FreehandSelectionComplete);
            this.uiSession.extensionContext.brushShapeManager.endPainting(false);
            this._freehandSelectionActive = false;
        }
        singleClick(uiSession, mouseRay, shiftPressed, ctrlPressed, altPressed) {
            const clickLoc = mouseRay.cursorBlockLocation;
            if (!shiftPressed && !ctrlPressed && !altPressed) {
                this.telemetryManager.fireTelemetryEvent(SelectionTelemetry.SelectionCreated);
                uiSession.extensionContext.selectionManager.selection.clear();
                uiSession.extensionContext.selectionManager.selection.pushVolume({
                    action: server_namespaceObject.CompoundBlockVolumeAction.Add,
                    volume: new server_namespaceObject.BlockVolume(clickLoc, clickLoc)
                });
                this.lastAnchorPosition = clickLoc;
            } else if (shiftPressed && !ctrlPressed && !altPressed) {
                if (uiSession.extensionContext.selectionManager.selection.isEmpty) {
                    this.telemetryManager.fireTelemetryEvent(SelectionTelemetry.SelectionCreated);
                    uiSession.extensionContext.selectionManager.selection.pushVolume({
                        action: server_namespaceObject.CompoundBlockVolumeAction.Add,
                        volume: new server_namespaceObject.BlockVolume(clickLoc, clickLoc)
                    });
                    this.lastAnchorPosition = clickLoc;
                } else {
                    const lastAnchorPosition = this.lastAnchorPosition;
                    this.telemetryManager.fireTelemetryEvent(SelectionTelemetry.SelectionExpanded, {
                        mode: "Shift"
                    });
                    const lastVolume = uiSession.extensionContext.selectionManager.selection.peekLastVolume();
                    uiSession.extensionContext.selectionManager.selection.popVolume();
                    try {
                        uiSession.extensionContext.selectionManager.selection.pushVolume({
                            action: server_namespaceObject.CompoundBlockVolumeAction.Add,
                            volume: new server_namespaceObject.BlockVolume(lastAnchorPosition, clickLoc)
                        });
                    } catch {
                        if (lastVolume) {
                            uiSession.extensionContext.selectionManager.selection.pushVolume(lastVolume);
                        }
                    }
                }
            } else if (ctrlPressed && !shiftPressed && !altPressed) {
                let success = true;
                try {
                    this.telemetryManager.fireTelemetryEvent(SelectionTelemetry.SelectionCreated);
                    uiSession.extensionContext.selectionManager.selection.pushVolume({
                        action: server_namespaceObject.CompoundBlockVolumeAction.Add,
                        volume: new server_namespaceObject.BlockVolume(clickLoc, clickLoc)
                    });
                } catch {
                    success = false;
                }
                if (success) {
                    this.lastAnchorPosition = clickLoc;
                }
            } else if (altPressed && !shiftPressed && !ctrlPressed) {
                const currentItem = uiSession.extensionContext.selectionManager.selection.peekLastVolume();
                if (!currentItem) {
                    this.telemetryManager.fireTelemetryEvent(SelectionTelemetry.SelectionCreated);
                    uiSession.extensionContext.selectionManager.selection.pushVolume({
                        action: server_namespaceObject.CompoundBlockVolumeAction.Add,
                        volume: new server_namespaceObject.BlockVolume(clickLoc, clickLoc)
                    });
                    this.lastAnchorPosition = clickLoc;
                } else {
                    const currentVolume = currentItem.volume;
                    const currentBounds = currentVolume.getBoundingBox();
                    const translatedRayLocation = lib.Vector3Utils.subtract(mouseRay.location, currentBounds.min);
                    const XYPlaneNormal = getRelativeXYAxisAsNormal(uiSession.extensionContext.player.getRotation().y);
                    const intersection = intersectRayPlane(translatedRayLocation, mouseRay.direction, XYPlaneNormal, 0);
                    if (intersection) {
                        this.telemetryManager.fireTelemetryEvent(SelectionTelemetry.SelectionExpanded, {
                            mode: "Alt"
                        });
                        const translatedIntersection = lib.Vector3Utils.add(intersection, currentBounds.min);
                        const newY = Math.ceil(translatedIntersection.y) - 1;
                        uiSession.extensionContext.selectionManager.selection.popVolume();
                        uiSession.extensionContext.selectionManager.selection.pushVolume({
                            action: currentItem.action,
                            volume: new server_namespaceObject.BlockVolume({
                                x: currentBounds.min.x,
                                y: currentBounds.min.y,
                                z: currentBounds.min.z
                            }, {
                                x: currentBounds.max.x,
                                y: newY,
                                z: currentBounds.max.z
                            })
                        });
                    }
                }
            }
        }
        switchSelectionMode(newMode, oldMode, userInitiated = false) {
            if (oldMode) {
                switch (oldMode) {
                  case SelectionMode.Marquee:
                    this.destroyMarqueeUIControls(this._modeHolderPane);
                    break;

                  case SelectionMode.Paint:
                    this._brushControl.deactivateControl();
                    this._brushControl.deactivateVisualization();
                    break;
                }
            }
            if (newMode) {
                switch (newMode) {
                  case SelectionMode.Marquee:
                    this.telemetryManager.fireTelemetryEvent(SelectionTelemetry.ModeChanged, {
                        mode: "Marquee"
                    }, userInitiated);
                    this.constructMarqueeUIControls(this.uiSession, this._modeHolderPane);
                    break;

                  case SelectionMode.Paint:
                    this.telemetryManager.fireTelemetryEvent(SelectionTelemetry.ModeChanged, {
                        mode: "Paint"
                    }, userInitiated);
                    this._brushControl.activateControl();
                    this._brushControl.activateVisualization();
                    break;
                }
            }
        }
        destroyMarqueeUIControls(parentPane) {
            if (this._marqueeModePane) {
                this._marqueeModePane.hide();
                parentPane.removeSubPane(this._marqueeModePane);
                this._marqueeModePane = undefined;
            }
        }
        constructMarqueeUIControls(uiSession, parentPane) {
            this.destroyMarqueeUIControls(parentPane);
            this._marqueeModePane = parentPane.createSubPane({
                title: "resourcePack.editor.selectionTool.marquee.title",
                hasMargins: false
            });
            this._marqueeModePane.hide();
            const updateSelection = (origin, size) => {
                const selection = uiSession.extensionContext.selectionManager.selection;
                const lastVolume = selection.peekLastVolume(server_namespaceObject.CompoundBlockVolumePositionRelativity.Absolute);
                if (lastVolume) {
                    const volumeOrigin = selection.getVolumeOrigin();
                    const min = {
                        x: origin.x - volumeOrigin.x,
                        y: origin.y - volumeOrigin.y,
                        z: origin.z - volumeOrigin.z
                    };
                    const max = {
                        x: min.x + size.x - 1,
                        y: min.y + size.y - 1,
                        z: min.z + size.z - 1
                    };
                    selection.popVolume();
                    try {
                        selection.pushVolume({
                            action: server_namespaceObject.CompoundBlockVolumeAction.Add,
                            volume: new server_namespaceObject.BlockVolume(min, max)
                        });
                    } catch {
                        selection.pushVolume(lastVolume);
                    }
                }
            };
            const onOriginChange = newValue => {
                updateSelection(newValue, this.size.value);
            };
            const onSizeChange = newValue => {
                updateSelection(this.origin.value, newValue);
            };
            const subPaneTransform = this._marqueeModePane.createSubPane({
                title: "resourcePack.editor.selectionTool.transformPane.title"
            });
            this.originPropertyItem = subPaneTransform.addVector3(this.origin, {
                title: "resourcePack.editor.selectionTool.transformPane.origin",
                tooltip: "resourcePack.editor.selectionTool.transformPane.origin.tooltip",
                min: {
                    y: uiSession.extensionContext.player.dimension.heightRange.min
                },
                max: {
                    y: uiSession.extensionContext.player.dimension.heightRange.max
                },
                onChange: onOriginChange
            });
            this.sizePropertyItem = subPaneTransform.addVector3(this.size, {
                title: "resourcePack.editor.selectionTool.transformPane.size",
                min: {
                    x: 1,
                    y: 1,
                    z: 1
                },
                max: {
                    x: 100,
                    y: 100,
                    z: 100
                },
                onChange: onSizeChange
            });
            this.uiSession.eventSubscriptionCache.subscribeToBedrockEvent("playerDimensionChange", (event => {
                if (event.player.id === uiSession.extensionContext.player.id) {
                    uiSession.extensionContext.selectionManager.selection.clear();
                    const heightRange = event.toDimension.heightRange;
                    this.originPropertyItem?.updateAxisLimits({
                        min: {
                            y: heightRange.min
                        },
                        max: {
                            y: heightRange.max
                        }
                    });
                }
            }));
            this._marqueeModePane.show();
            parentPane.show();
        }
        _registerToolKeyBinding(action, binding, tag) {
            this.tool.registerKeyBinding(action, binding, {
                uniqueId: `editor:selectionToolKeyBinding:${tag}`,
                label: `resourcePack.editor.selectionTool.keyBinding.${tag}`
            });
        }
    }
    class UndoRedoBehavior {
        constructor(uiSession, coreMenuItems) {
            this._canUndo = false;
            this._canRedo = false;
            this._transactionManager = uiSession.extensionContext.transactionManager;
            this._canUndo = this._transactionManager.undoSize() > 0;
            this._canRedo = this._transactionManager.redoSize() > 0;
            const undoAction = uiSession.actionManager.createAction({
                actionType: server_editor_namespaceObject.ActionTypes.NoArgsAction,
                onExecute: () => {
                    this._transactionManager.undo();
                }
            });
            const redoAction = uiSession.actionManager.createAction({
                actionType: server_editor_namespaceObject.ActionTypes.NoArgsAction,
                onExecute: () => {
                    this._transactionManager.redo();
                }
            });
            this._undoMenuItem = coreMenuItems.edit.addItem({
                label: "resourcePack.editor.menuBar.edit.undo",
                enabled: this._canUndo
            }, undoAction);
            this._redoMenuItem = coreMenuItems.edit.addItem({
                label: "resourcePack.editor.menuBar.edit.redo",
                enabled: this._canRedo
            }, redoAction);
            this._undoActionBarItem = uiSession.actionBar.registerItem(server_editor_namespaceObject.CoreActionBarItemType.Undo, undoAction, {
                label: "resourcePack.editor.actionBar.undo",
                icon: "undoIcon",
                tooltipTitle: "resourcePack.editor.actionBar.undo.tooltipTitle",
                tooltipDescription: "resourcePack.editor.actionBar.undo.tooltipDescription",
                enabled: this._canUndo
            });
            this._redoActionBarItem = uiSession.actionBar.registerItem(server_editor_namespaceObject.CoreActionBarItemType.Redo, redoAction, {
                label: "resourcePack.editor.actionBar.redo",
                icon: "redoIcon",
                tooltipTitle: "resourcePack.editor.actionBar.redo.tooltipTitle",
                tooltipDescription: "resourcePack.editor.actionBar.redo.tooltipDescription",
                enabled: this._canRedo
            });
            uiSession.inputManager.registerKeyBinding(server_editor_namespaceObject.EditorInputContext.GlobalEditor, undoAction, {
                key: server_editor_namespaceObject.KeyboardKey.KEY_Z,
                modifier: server_editor_namespaceObject.InputModifier.Control
            }, {
                uniqueId: "editor:globalKeyBinding:undo",
                label: "resourcePack.editor.transaction.keyBinding.undo"
            });
            uiSession.inputManager.registerKeyBinding(server_editor_namespaceObject.EditorInputContext.GlobalEditor, redoAction, {
                key: server_editor_namespaceObject.KeyboardKey.KEY_Y,
                modifier: server_editor_namespaceObject.InputModifier.Control
            }, {
                uniqueId: "editor:globalKeyBinding:redo",
                label: "resourcePack.editor.transaction.keyBinding.redo"
            });
            this.updateHandle = server_namespaceObject.system.runInterval((() => {
                this._checkUndoRedoState();
            }), server_namespaceObject.TicksPerSecond / 2);
        }
        _checkUndoRedoState() {
            const canUndo = this._transactionManager.undoSize() > 0;
            const canRedo = this._transactionManager.redoSize() > 0;
            if (canUndo !== this._canUndo) {
                if (this._undoActionBarItem) {
                    this._undoActionBarItem.setEnabled(canUndo);
                }
                if (this._undoMenuItem) {
                    this._undoMenuItem.enabled = canUndo;
                }
                this._canUndo = canUndo;
            }
            if (canRedo !== this._canRedo) {
                if (this._redoActionBarItem) {
                    this._redoActionBarItem.setEnabled(canRedo);
                }
                if (this._redoMenuItem) {
                    this._redoMenuItem.enabled = canRedo;
                }
                this._canRedo = canRedo;
            }
        }
        teardown() {
            if (this.updateHandle) {
                server_namespaceObject.system.clearRun(this.updateHandle);
            }
        }
    }
    function stringFromException(e) {
        if (typeof e === "string") {
            return e;
        } else if (typeof e === "object" && e !== null && "message" in e) {
            return e.message;
        }
        return "Unknown exception";
    }
    const PreviewColor = {
        red: 0,
        green: .5,
        blue: .5,
        alpha: .2
    };
    const HighlightColor = {
        red: .5,
        green: 1,
        blue: .5,
        alpha: 1
    };
    const FillColor = {
        red: 0,
        green: 0,
        blue: .5,
        alpha: .1
    };
    var SummonTelemetry;
    (function(SummonTelemetry) {
        SummonTelemetry["Create"] = "Create";
        SummonTelemetry["Delete"] = "Delete";
        SummonTelemetry["Clear"] = "Clear";
        SummonTelemetry["Nudge"] = "Nudge";
        SummonTelemetry["Undo"] = "Undo";
        SummonTelemetry["Redo"] = "Redo";
        SummonTelemetry["PickerUpdated"] = "PickerUpdated";
        SummonTelemetry["Select"] = "Select";
        SummonTelemetry["SelectMove"] = "SelectMove";
    })(SummonTelemetry || (SummonTelemetry = {}));
    class SummonTool {
        constructor(session) {
            this._session = session;
            this._cursorProperties = {
                outlineColor: {
                    red: 1,
                    green: 1,
                    blue: 0,
                    alpha: 1
                },
                controlMode: server_editor_namespaceObject.CursorControlMode.KeyboardAndMouse,
                targetMode: server_editor_namespaceObject.CursorTargetMode.Face,
                visible: true,
                fixedModeDistance: 5
            };
            this.telemetryManager = new TelemetryManager(session.extensionContext.player, TelemetrySource.Summon);
            this._previewSelection = this._session.extensionContext.selectionManager.create();
            this._previewSelection.visible = false;
            this._previewSelection.setOutlineColor(PreviewColor);
            this._previewSelection.setFillColor(FillColor);
            this._previewSelection.pushVolume({
                action: server_namespaceObject.CompoundBlockVolumeAction.Add,
                volume: new server_namespaceObject.BlockVolume(lib.VECTOR3_ZERO, lib.VECTOR3_ZERO)
            });
            const activationAction = this._session.actionManager.createAction({
                actionType: server_editor_namespaceObject.ActionTypes.NoArgsAction,
                onExecute: () => {
                    this._session.toolRail.setSelectedToolId(this._tool.id);
                }
            });
            this._tool = this._session.toolRail.addTool("editor:modalTool:summon", {
                title: "resourcePack.editor.toolRail.summonTool.tool.title",
                icon: "pack://textures/editor/Entity.png?filtering=point",
                tooltip: "resourcePack.editor.toolRail.summonTool.tool.tip",
                action: activationAction
            });
            this._tool.onModalToolActivation.subscribe((eventData => {
                if (eventData.isActiveTool) {
                    this._backedUpColors = backupColors(session.extensionContext);
                    this._session.extensionContext.cursor.setProperties(this._cursorProperties);
                } else {
                    this.shutdownMouseWatcher();
                    this.clearSelection();
                    if (this._backedUpColors) {
                        restoreBackedUpColors(session.extensionContext, this._backedUpColors);
                        this._backedUpColors = undefined;
                    }
                }
            }));
            this._createTransactionHandler = (0, server_editor_namespaceObject.registerUserDefinedTransactionHandler)(this._session.extensionContext.transactionManager, (() => {
                this.telemetryManager.fireTelemetryEvent(SummonTelemetry.Undo, {
                    mode: "Clear"
                });
                this.clearSelection();
            }), (payload => {
                this.telemetryManager.fireTelemetryEvent(SummonTelemetry.Redo, {
                    mode: "Create"
                });
                const entity = server_namespaceObject.world.getEntity(payload.entityID);
                if (entity) {
                    this.selectEntity(entity);
                }
            }));
            this._deleteTransactionHandler = (0, server_editor_namespaceObject.registerUserDefinedTransactionHandler)(this._session.extensionContext.transactionManager, (payload => {
                this.telemetryManager.fireTelemetryEvent(SummonTelemetry.Undo, {
                    mode: "Create"
                });
                const entity = server_namespaceObject.world.getEntity(payload.entityID);
                if (entity) {
                    this.selectEntity(entity);
                }
            }), (() => {
                this.telemetryManager.fireTelemetryEvent(SummonTelemetry.Redo, {
                    mode: "Clear"
                });
                this.clearSelection();
            }));
            this._session.inputManager.registerKeyBinding(server_editor_namespaceObject.EditorInputContext.GlobalToolMode, activationAction, {
                key: server_editor_namespaceObject.KeyboardKey.KEY_S,
                modifier: server_editor_namespaceObject.InputModifier.Control | server_editor_namespaceObject.InputModifier.Shift
            }, {
                uniqueId: "editor:toolModeKeyBinding:toggleSummonTool",
                label: "resourcePack.editor.toolRail.summonTool.keyBinding.toggle"
            });
            this._registerToolKeyBinding(this._session.actionManager.createAction({
                actionType: server_editor_namespaceObject.ActionTypes.NoArgsAction,
                onExecute: () => {
                    if (this._selectedEntity) {
                        this.telemetryManager.fireTelemetryEvent(SummonTelemetry.Delete);
                        const manager = this._session.extensionContext.transactionManager;
                        manager.openTransaction("Summon Tool - Delete Entity");
                        try {
                            if (this._selectedEntity) {
                                const transactionPayload = {
                                    entityID: this._selectedEntity.id
                                };
                                this._deleteTransactionHandler.addUserDefinedOperation(transactionPayload, "Entity Delete");
                                manager.addEntityOperation(this._selectedEntity, server_editor_namespaceObject.EntityOperationType.Delete);
                            }
                        } catch (e) {
                            this._session.log.warning(`Unable to commit delete entity transaction. ${stringFromException(e)}`);
                            manager.discardOpenTransaction();
                            return;
                        }
                        manager.commitOpenTransaction();
                        try {
                            this._selectedEntity.remove();
                        } catch (e) {
                            this._session.log.error(`${stringFromException(e)}`);
                        } finally {
                            this.clearSelection();
                        }
                    }
                }
            }), {
                key: server_editor_namespaceObject.KeyboardKey.DELETE
            }, "delete");
            this._registerToolKeyBinding(this._session.actionManager.createAction({
                actionType: server_editor_namespaceObject.ActionTypes.NoArgsAction,
                onExecute: () => {
                    this.telemetryManager.fireTelemetryEvent(SummonTelemetry.Clear);
                    this.clearSelection();
                }
            }), {
                key: server_editor_namespaceObject.KeyboardKey.KEY_D,
                modifier: server_editor_namespaceObject.InputModifier.Control
            }, "clear");
            const keyUpAction = this._session.actionManager.createAction({
                actionType: server_editor_namespaceObject.ActionTypes.NoArgsAction,
                onExecute: () => {
                    this.telemetryManager.fireTelemetryEvent(SummonTelemetry.Nudge, {
                        direction: "up"
                    });
                    this.nudgeSelected(lib.VECTOR3_UP);
                }
            });
            const keyDownAction = this._session.actionManager.createAction({
                actionType: server_editor_namespaceObject.ActionTypes.NoArgsAction,
                onExecute: () => {
                    this.telemetryManager.fireTelemetryEvent(SummonTelemetry.Nudge, {
                        direction: "down"
                    });
                    this.nudgeSelected(lib.VECTOR3_DOWN);
                }
            });
            const keyLeftAction = this._session.actionManager.createAction({
                actionType: server_editor_namespaceObject.ActionTypes.NoArgsAction,
                onExecute: () => {
                    this.telemetryManager.fireTelemetryEvent(SummonTelemetry.Nudge, {
                        direction: "left"
                    });
                    const nudgeVector = this.getRelativeNudgeDirection(Direction.Left);
                    this.nudgeSelected(nudgeVector);
                }
            });
            const keyRightAction = this._session.actionManager.createAction({
                actionType: server_editor_namespaceObject.ActionTypes.NoArgsAction,
                onExecute: () => {
                    this.telemetryManager.fireTelemetryEvent(SummonTelemetry.Nudge, {
                        direction: "right"
                    });
                    const nudgeVector = this.getRelativeNudgeDirection(Direction.Right);
                    this.nudgeSelected(nudgeVector);
                }
            });
            const keyForwardAction = this._session.actionManager.createAction({
                actionType: server_editor_namespaceObject.ActionTypes.NoArgsAction,
                onExecute: () => {
                    this.telemetryManager.fireTelemetryEvent(SummonTelemetry.Nudge, {
                        direction: "forward"
                    });
                    const nudgeVector = this.getRelativeNudgeDirection(Direction.Forward);
                    this.nudgeSelected(nudgeVector);
                }
            });
            const keyBackAction = this._session.actionManager.createAction({
                actionType: server_editor_namespaceObject.ActionTypes.NoArgsAction,
                onExecute: () => {
                    this.telemetryManager.fireTelemetryEvent(SummonTelemetry.Nudge, {
                        direction: "back"
                    });
                    const nudgeVector = this.getRelativeNudgeDirection(Direction.Back);
                    this.nudgeSelected(nudgeVector);
                }
            });
            this._registerToolKeyBinding(keyForwardAction, {
                key: server_editor_namespaceObject.KeyboardKey.UP
            }, "moveForward");
            this._registerToolKeyBinding(keyBackAction, {
                key: server_editor_namespaceObject.KeyboardKey.DOWN
            }, "moveBack");
            this._registerToolKeyBinding(keyLeftAction, {
                key: server_editor_namespaceObject.KeyboardKey.LEFT
            }, "moveLeft");
            this._registerToolKeyBinding(keyRightAction, {
                key: server_editor_namespaceObject.KeyboardKey.RIGHT
            }, "moveRight");
            this._registerToolKeyBinding(keyUpAction, {
                key: server_editor_namespaceObject.KeyboardKey.PAGE_UP
            }, "moveUp");
            this._registerToolKeyBinding(keyDownAction, {
                key: server_editor_namespaceObject.KeyboardKey.PAGE_DOWN
            }, "moveDown");
            this._rotation = 0;
            this._mouseMoveWatcherId = -1;
            {
                this._pane = this._session.createPropertyPane({
                    title: "resourcePack.editor.toolRail.summonTool.pane.title",
                    infoTooltip: {
                        description: [ "resourcePack.editor.toolRail.summonTool.tool.tip", {
                            link: "https://aka.ms/BedrockEditorSummonTool",
                            text: "resourcePack.editor.help.learnMore"
                        } ]
                    }
                });
                this._paneBindingData = (0, server_editor_namespaceObject.bindDataSource)(this._pane, {
                    rotation: 0
                });
                this._entityType = (0, server_editor_namespaceObject.makeObservable)(MinecraftEntityTypes.Pig);
                this._pane.addNumber_deprecated(this._paneBindingData, "rotation", {
                    title: "resourcePack.editor.toolRail.summonTool.tool.selectSubPane.rotation",
                    min: -180,
                    max: 180,
                    showSlider: true,
                    onChange: (_obj, _property, _oldValue, _newValue) => {
                        const rotation = _newValue;
                        this._rotation = rotation;
                        this.updateRotation();
                    }
                });
                this._pane.addText("resourcePack.editor.toolRail.summonTool.tool.infoText");
                this._pane.addComboBox(this._entityType, {
                    title: "resourcePack.editor.summonTool.summonSubPane.EntityPickerTitle",
                    dataType: server_editor_namespaceObject.ComboBoxPropertyItemDataType.Entity,
                    onChange: newValue => {
                        this.telemetryManager.fireTelemetryEvent(SummonTelemetry.PickerUpdated, {
                            entity: newValue
                        });
                    }
                });
                this._tool.bindPropertyPane(this._pane);
            }
            const executeMouseButtonAction = this._session.actionManager.createAction({
                actionType: server_editor_namespaceObject.ActionTypes.MouseRayCastAction,
                onExecute: (mouseRay, mouseProps) => {
                    if (mouseProps.mouseAction !== server_editor_namespaceObject.MouseActionType.LeftButton) {
                        return;
                    }
                    const buttonDown = mouseProps.inputType === server_editor_namespaceObject.MouseInputType.ButtonDown;
                    if (buttonDown) {
                        const player = this._session.extensionContext.player;
                        const dimension = player.dimension;
                        const entityHitList = dimension.getEntitiesFromRay(mouseRay.location, mouseRay.direction);
                        let hitEntity = undefined;
                        if (entityHitList.length > 1) {
                            hitEntity = entityHitList[1];
                            if (hitEntity.entity === this._selectedEntity) {
                                this.telemetryManager.fireTelemetryEvent(SummonTelemetry.SelectMove, {
                                    state: "Begin"
                                });
                                this.handleBeginSelectMove(mouseRay);
                            } else if (hitEntity.entity !== this._selectedEntity) {
                                this.telemetryManager.fireTelemetryEvent(SummonTelemetry.Select);
                                this.selectEntity(hitEntity.entity);
                            }
                        } else {
                            this.telemetryManager.fireTelemetryEvent(SummonTelemetry.Create);
                            this.handleBeginSummonMode(mouseRay);
                        }
                    } else {
                        if (this._mouseMoveWatcherId >= 0) {
                            this.telemetryManager.fireTelemetryEvent(SummonTelemetry.SelectMove, {
                                state: "End"
                            });
                            this.handleEndSelectMove(mouseRay);
                        }
                    }
                }
            });
            this._tool.registerMouseButtonBinding(executeMouseButtonAction);
            const rotateEntityAction = this._session.actionManager.createAction({
                actionType: server_editor_namespaceObject.ActionTypes.MouseRayCastAction,
                onExecute: (mouseRay, mouseProps) => {
                    if (!this._selectedEntity) {
                        return;
                    }
                    if (mouseProps.mouseAction === server_editor_namespaceObject.MouseActionType.Wheel) {
                        if (mouseProps.inputType === server_editor_namespaceObject.MouseInputType.WheelOut) {
                            this._rotation += 10;
                            this.updateRotation();
                        } else if (mouseProps.inputType === server_editor_namespaceObject.MouseInputType.WheelIn) {
                            this._rotation -= 10;
                            this.updateRotation();
                        }
                    }
                }
            });
            this._tool.registerMouseWheelBinding(rotateEntityAction);
        }
        nudgeSelected(nudgeVector) {
            if (this._selectedEntity && this._mouseMoveWatcherId < 0) {
                const currentLocation = this._selectedEntity.location;
                const newLocation = lib.Vector3Utils.add(currentLocation, nudgeVector);
                this._selectedEntity.teleport(newLocation);
                this.updateSelectionPreview();
            }
        }
        selectEntity(entity) {
            this._selectedEntity = entity;
            this._rotation = entity.getRotation().y;
            this.updateSelectionPreview();
        }
        getRelativeNudgeDirection(direction) {
            const rotationY = this._session.extensionContext.player.getRotation().y;
            const rotationCorrectedVector = getRotationCorrectedDirectionVector(rotationY, direction);
            return rotationCorrectedVector;
        }
        updateRotation() {
            if (!this._selectedEntity) {
                return;
            }
            let rotation = this._rotation;
            if (rotation < -180) {
                rotation += 360;
            } else if (rotation > 180) {
                rotation -= 360;
            }
            const location = this._selectedEntity.location;
            this._selectedEntity.setRotation({
                x: 0,
                y: rotation
            });
            this._selectedEntity.teleport(location);
            this._paneBindingData.rotation = rotation;
            this._rotation = rotation;
        }
        shutdownMouseWatcher() {
            if (this._mouseMoveWatcherId >= 0) {
                server_namespaceObject.system.clearRun(this._mouseMoveWatcherId);
                this._mouseMoveWatcherId = -1;
            }
        }
        handleEndSelectMove(mouseRay) {
            this.shutdownMouseWatcher();
            if (this._selectedEntity) {
                const targetLoc = {
                    x: mouseRay.cursorBlockLocation.x + .5,
                    y: mouseRay.cursorBlockLocation.y,
                    z: mouseRay.cursorBlockLocation.z + .5
                };
                this._selectedEntity.teleport(targetLoc);
            }
            this.updateSelectionPreview();
        }
        handleBeginSelectMove(_) {
            if (!this._selectedEntity) {
                return;
            }
            let currentCursorLocation = this._session.extensionContext.cursor.getPosition();
            const mouseWatcherTick = () => {
                if (this._mouseMoveWatcherId >= 0 && this._selectedEntity) {
                    const cursorLoc = lib.Vector3Utils.floor(this._session.extensionContext.cursor.getPosition());
                    if (!lib.Vector3Utils.equals(cursorLoc, currentCursorLocation)) {
                        currentCursorLocation = cursorLoc;
                        const entityNewPos = lib.Vector3Utils.add(currentCursorLocation, {
                            x: .5,
                            y: 0,
                            z: .5
                        });
                        this._selectedEntity.teleport(entityNewPos);
                        this.updateSelectionPreview(true);
                    }
                    this._mouseMoveWatcherId = server_namespaceObject.system.run(mouseWatcherTick);
                }
            };
            this._mouseMoveWatcherId = server_namespaceObject.system.run(mouseWatcherTick);
            this.updateSelectionPreview(true);
        }
        handleBeginSummonMode(mouseRay) {
            const spawnLoc = {
                x: mouseRay.cursorBlockLocation.x + .5,
                y: mouseRay.cursorBlockLocation.y,
                z: mouseRay.cursorBlockLocation.z + .5
            };
            const player = this._session.extensionContext.player;
            const dimension = player.dimension;
            try {
                this._selectedEntity = dimension.spawnEntity(this._entityType.value, spawnLoc, {
                    initialPersistence: true
                });
            } catch (e) {
                this._session.log.error(`${stringFromException(e)}`);
                this.clearSelection();
            }
            this.updateSelectionPreview();
            this.updateRotation();
            const manager = this._session.extensionContext.transactionManager;
            manager.openTransaction("Summon Tool - Create Entity");
            try {
                if (this._selectedEntity) {
                    manager.addEntityOperation(this._selectedEntity, server_editor_namespaceObject.EntityOperationType.Create);
                    const transactionPayload = {
                        entityID: this._selectedEntity.id
                    };
                    this._createTransactionHandler.addUserDefinedOperation(transactionPayload, "Entity Create");
                }
            } catch (e) {
                this._session.log.warning(`Unable to commit create entity transaction. ${stringFromException(e)}`);
                manager.discardOpenTransaction();
                return;
            }
            manager.commitOpenTransaction();
        }
        teardown() {
            this.shutdownMouseWatcher();
        }
        clearSelection() {
            this._previewSelection.visible = false;
            this._selectedEntity = undefined;
        }
        updateSelectionPreview(highlight = false) {
            if (this._selectedEntity) {
                this._previewSelection.visible = true;
                this._previewSelection.moveTo(this._selectedEntity.location);
                if (highlight) {
                    this._previewSelection.setOutlineColor(HighlightColor);
                } else {
                    this._previewSelection.setOutlineColor(PreviewColor);
                }
            } else {
                this._previewSelection.visible = false;
            }
        }
        _registerToolKeyBinding(action, binding, tag) {
            this._tool.registerKeyBinding(action, binding, {
                uniqueId: `editor:summonToolKeyBinding:${tag}`,
                label: `resourcePack.editor.toolRail.summonTool.keyBinding.${tag}`
            });
        }
    }
    const TimeOfDay_mcHoursPerTick = 1e3;
    const TimeOfDay_mcMinsPerTick = 16.6667;
    var ClockType;
    (function(ClockType) {
        ClockType[ClockType["CLOCK_24HR"] = 0] = "CLOCK_24HR";
        ClockType[ClockType["CLOCK_12HR"] = 1] = "CLOCK_12HR";
        ClockType[ClockType["MINECRAFT_CLOCK"] = 2] = "MINECRAFT_CLOCK";
    })(ClockType || (ClockType = {}));
    const clockValues = [ {
        stringId: "resourcePack.editor.timeOfDay.24hrClock",
        index: ClockType.CLOCK_24HR
    }, {
        stringId: "resourcePack.editor.timeOfDay.12hrClock",
        index: ClockType.CLOCK_12HR
    }, {
        stringId: "resourcePack.editor.timeOfDay.minecraftClock",
        index: ClockType.MINECRAFT_CLOCK
    } ];
    var TODDropDown;
    (function(TODDropDown) {
        TODDropDown[TODDropDown["Day"] = 1e3] = "Day";
        TODDropDown[TODDropDown["Noon"] = 6e3] = "Noon";
        TODDropDown[TODDropDown["Sunset"] = 12e3] = "Sunset";
        TODDropDown[TODDropDown["Night"] = 13e3] = "Night";
        TODDropDown[TODDropDown["Midnight"] = 18e3] = "Midnight";
        TODDropDown[TODDropDown["Sunrise"] = 23e3] = "Sunrise";
        TODDropDown[TODDropDown["None"] = 100001] = "None";
    })(TODDropDown || (TODDropDown = {}));
    const validPresets = [ {
        stringId: "resourcePack.editor.timeOfDay.dropDown.none",
        time: TODDropDown.None
    }, {
        stringId: "resourcePack.editor.timeOfDay.dropDown.day",
        time: TODDropDown.Day
    }, {
        stringId: "resourcePack.editor.timeOfDay.dropDown.noon",
        time: TODDropDown.Noon
    }, {
        stringId: "resourcePack.editor.timeOfDay.dropDown.sunset",
        time: TODDropDown.Sunset
    }, {
        stringId: "resourcePack.editor.timeOfDay.dropDown.night",
        time: TODDropDown.Night
    }, {
        stringId: "resourcePack.editor.timeOfDay.dropDown.midnight",
        time: TODDropDown.Midnight
    }, {
        stringId: "resourcePack.editor.timeOfDay.dropDown.sunrise",
        time: TODDropDown.Sunrise
    } ];
    const TimeOfDay_validDaylightCycle = [ server_editor_namespaceObject.DaylightCycle.Normal, server_editor_namespaceObject.DaylightCycle.AlwaysDay, server_editor_namespaceObject.DaylightCycle.LockTime ];
    var TimeOfDayTelemetry;
    (function(TimeOfDayTelemetry) {
        TimeOfDayTelemetry["SettingsChanged"] = "SettingsChanged";
    })(TimeOfDayTelemetry || (TimeOfDayTelemetry = {}));
    class TimeOfDayBehavior {
        constructor(_uiSession, _parentMenu) {
            this._uiSession = _uiSession;
            this._timeOfDayValue = (0, server_editor_namespaceObject.makeObservable)(server_namespaceObject.world.getTimeOfDay());
            this._timeOfDayTimeString = (0, server_editor_namespaceObject.makeObservable)(this.convertTODToTime(server_namespaceObject.world.getTimeOfDay(), false));
            this._clockType = (0, server_editor_namespaceObject.makeObservable)(ClockType.CLOCK_24HR);
            this._customTime = (0, server_editor_namespaceObject.makeObservable)(-1);
            this._daylightCycle = (0, server_editor_namespaceObject.makeObservable)(server_editor_namespaceObject.DaylightCycle.LockTime);
            this._currentPreset = (0, server_editor_namespaceObject.makeObservable)(TODDropDown.None);
            this.openMenuAction = this._uiSession.actionManager.createAction({
                actionType: server_editor_namespaceObject.ActionTypes.NoArgsAction,
                onExecute: () => {
                    this._timeOfDayValue.set(server_namespaceObject.world.getTimeOfDay());
                    this._Pane?.show();
                }
            });
            this.createMenuItem(_parentMenu);
            this.telemetryManager = new TelemetryManager(_uiSession.extensionContext.player, TelemetrySource.TimeOfDay);
            this._Pane = _uiSession.createPropertyPane({
                title: "resourcePack.editor.timeOfDay.title",
                infoTooltip: {
                    description: [ {
                        link: "https://aka.ms/BedrockEditorTimeOfDaySettings",
                        text: "resourcePack.editor.help.learnMore"
                    } ]
                }
            });
            const clockItems = clockValues.map((v => {
                const item = {
                    label: v.stringId,
                    value: v.index
                };
                return item;
            }));
            this._Pane.addDropdown(this._clockType, {
                title: "resourcePack.editor.timeOfDay.clockType",
                enable: true,
                entries: clockItems,
                onChange: (_newValue, _oldValue, _items) => {
                    this.telemetryManager.fireTelemetryEvent(TimeOfDayTelemetry.SettingsChanged, {
                        settingName: "clockType",
                        newSetting: _newValue
                    });
                }
            });
            this._Pane.addString(this._timeOfDayTimeString, {
                title: "resourcePack.editor.timeOfDay.currentTime",
                enable: false
            });
            const daylightCycleItems = TimeOfDay_validDaylightCycle.map(((v, i) => {
                const item = {
                    label: getEnumKeyByEnumValue(server_editor_namespaceObject.DaylightCycle, v),
                    value: i
                };
                return item;
            }));
            this._Pane.addDropdown(this._daylightCycle, {
                title: "resourcePack.editor.timeOfDay.daylightCycle",
                enable: true,
                entries: daylightCycleItems,
                visible: true,
                onChange: (_newValue, _oldValue, _items) => {
                    const currentTime = server_namespaceObject.world.getTimeOfDay();
                    this.setDaylightCycle(Number(_newValue), currentTime, _uiSession);
                    this._currentPreset.set(TODDropDown.None);
                    this.telemetryManager.fireTelemetryEvent(TimeOfDayTelemetry.SettingsChanged, {
                        settingName: "daylightCycle",
                        newSetting: _newValue
                    });
                }
            });
            this._Pane.addDivider();
            const timeItems = validPresets.map((v => {
                const item = {
                    label: v.stringId,
                    value: v.time
                };
                return item;
            }));
            this._Pane.addDropdown(this._currentPreset, {
                title: "resourcePack.editor.timeOfDay.dropDown.title",
                entries: timeItems,
                onChange: (_newValue, _oldValue, _items) => {
                    if (Number.isSafeInteger(_newValue)) {
                        const num = Number(_newValue);
                        if (num === TODDropDown.None) {
                            customTime.enable = true;
                            customTime.visible = true;
                        } else {
                            this.setDaylightCycle(server_editor_namespaceObject.DaylightCycle.LockTime, num, _uiSession);
                            this._timeOfDayValue.set(num);
                        }
                        server_namespaceObject.world.setTimeOfDay(num);
                        customTime.enable = false;
                        customTime.visible = false;
                        this.telemetryManager.fireTelemetryEvent(TimeOfDayTelemetry.SettingsChanged, {
                            settingName: "currentPreset",
                            newSetting: _newValue
                        });
                    }
                }
            });
            const customTime = this._Pane.addNumber(this._customTime, {
                title: "resourcePack.editor.timeOfDay.customTime",
                min: 0,
                max: 24 * TimeOfDay_mcHoursPerTick - 1,
                variant: server_editor_namespaceObject.NumberPropertyItemVariant.InputFieldAndSlider,
                enable: this._daylightCycle.value === server_editor_namespaceObject.DaylightCycle.Normal,
                visible: true,
                onChange: newValue => {
                    this._timeOfDayValue.set(Number(newValue));
                    const newTime = Number(newValue);
                    this.setDaylightCycle(server_editor_namespaceObject.DaylightCycle.LockTime, newTime, _uiSession);
                    this._daylightCycle.set(server_editor_namespaceObject.DaylightCycle.LockTime);
                    if (this._currentPreset.value === TODDropDown.None) {
                        this._customTime.set(newTime);
                    }
                }
            });
            this._updateHandle = server_namespaceObject.system.runInterval((() => {
                const currentTime = server_namespaceObject.world.getTimeOfDay();
                if (this._Pane.visible) {
                    if (this._clockType.value !== ClockType.MINECRAFT_CLOCK) {
                        const is24HrClock = this._clockType.value === ClockType.CLOCK_24HR ? true : false;
                        this._timeOfDayTimeString.set(this.convertTODToTime(server_namespaceObject.world.getTimeOfDay(), is24HrClock));
                    } else {
                        this._timeOfDayTimeString.set(currentTime.toString());
                    }
                }
            }), 3);
        }
        createMenuItem(menu) {
            menu.addItem({
                label: "resourcePack.editor.timeOfDay.menu.title"
            }, this.openMenuAction);
        }
        convertTODToTime(timeOfDay, use24HrClock) {
            let ampm = "";
            const isPM = timeOfDay >= server_namespaceObject.TimeOfDay.Noon && timeOfDay < server_namespaceObject.TimeOfDay.Midnight;
            if (!use24HrClock) {
                if (isPM) {
                    ampm = " " + TimeOfDayBehavior._pmStr;
                } else {
                    ampm = " " + TimeOfDayBehavior._amStr;
                }
            }
            let hours = (6 + Math.floor(timeOfDay / TimeOfDay_mcHoursPerTick)) % 24;
            let numZeroes = 2;
            if (!use24HrClock) {
                hours = hours % 12;
                hours = hours === 0 ? 12 : hours;
                numZeroes = 1;
            }
            const hourStr = hours.toString().padStart(numZeroes, "0");
            timeOfDay %= TimeOfDay_mcHoursPerTick;
            const minutes = Math.floor(timeOfDay / TimeOfDay_mcMinsPerTick);
            const minuteStr = minutes.toString().padStart(2, "0");
            return `${hourStr}:${minuteStr}${ampm}`;
        }
        convertToTOD(hours, minutes) {
            hours -= 6;
            if (hours < 0) {
                hours = 24 - (6 + hours);
            }
            return hours * TimeOfDay_mcHoursPerTick + minutes * TimeOfDay_mcMinsPerTick;
        }
        setDaylightCycle(daylightCycle, currentTime, uiSession) {
            this._daylightCycle.set(daylightCycle);
            server_namespaceObject.world.getDimension("overworld").runCommandAsync(`alwaysday ${(daylightCycle === server_editor_namespaceObject.DaylightCycle.AlwaysDay || daylightCycle === server_editor_namespaceObject.DaylightCycle.LockTime).toString()}`).then((() => {
                const timeStr = daylightCycle === server_editor_namespaceObject.DaylightCycle.Normal ? "started" : "stopped";
                uiSession.log.info(`Time ${timeStr}`);
                if (daylightCycle === server_editor_namespaceObject.DaylightCycle.AlwaysDay) {
                    server_namespaceObject.world.setTimeOfDay(TODDropDown.Noon);
                } else {
                    server_namespaceObject.world.setTimeOfDay(currentTime);
                }
            })).catch((_ => uiSession.log.error("Unable to adjust daylight cycle due to unknown error.")));
        }
        teardown() {
            if (this._updateHandle) {
                server_namespaceObject.system.clearRun(this._updateHandle);
            }
        }
    }
    TimeOfDayBehavior.BEHAVIOR_NAME = "Time of Day";
    TimeOfDayBehavior._amStr = "A.M.";
    TimeOfDayBehavior._pmStr = "P.M.";
    const STORED_LOCATION_DYNAMIC_PROPERTY_NAME = "goto-mark:storedLocations";
    const STORED_LOCATION_NAME_MAX_LENGTH = 16;
    const STORED_LOCATIONS_MAX = 9;
    const WHITE_RGBA = {
        red: 1,
        green: 1,
        blue: 1,
        alpha: 1
    };
    const BLACK_RGBA = {
        red: 0,
        green: 0,
        blue: 0,
        alpha: 1
    };
    const MAX_LOADED_CHUNK_SIZE = 78;
    const CACHE_LENGTH = 4 * MAX_LOADED_CHUNK_SIZE;
    const CACHE_UPDATE_DISTANCE = 64;
    const CACHE_MAX_SIZE = (CACHE_LENGTH + 1) * (CACHE_LENGTH + 1);
    const MAP_IMAGE_SIZE = 35;
    const MAP_REFRESH_SIZE = 128;
    var MapSize;
    (function(MapSize) {
        MapSize[MapSize["Small"] = 0] = "Small";
        MapSize[MapSize["Middle"] = 1] = "Middle";
        MapSize[MapSize["Large"] = 2] = "Large";
    })(MapSize || (MapSize = {}));
    var GotoMark_Direction;
    (function(Direction) {
        Direction[Direction["North"] = 0] = "North";
        Direction[Direction["East"] = 1] = "East";
        Direction[Direction["South"] = 2] = "South";
        Direction[Direction["West"] = 3] = "West";
        Direction[Direction["Northeast"] = 4] = "Northeast";
        Direction[Direction["Southwest"] = 5] = "Southwest";
        Direction[Direction["Southeast"] = 6] = "Southeast";
        Direction[Direction["Northwest"] = 7] = "Northwest";
    })(GotoMark_Direction || (GotoMark_Direction = {}));
    const mapSizeInPixels = {
        [MapSize.Small]: 64,
        [MapSize.Middle]: 128,
        [MapSize.Large]: 256
    };
    const pixelFactors = {
        [MapSize.Small]: 4,
        [MapSize.Middle]: 2,
        [MapSize.Large]: 1
    };
    const DimensionIds = {
        "minecraft:overworld": 0,
        "minecraft:nether": 1,
        "minecraft:the_end": 2
    };
    var NavigationTelemetry;
    (function(NavigationTelemetry) {
        NavigationTelemetry["ShowMapToggle"] = "ShowMapToggle";
        NavigationTelemetry["TeleportToLocation"] = "TeleportToLocation";
        NavigationTelemetry["StoredLocationsChanged"] = "StoredLocationsChanged";
        NavigationTelemetry["TeleportToStoredLocation"] = "TeleportToStoredLocation";
        NavigationTelemetry["DeleteStoredLocation"] = "DeleteStoredLocation";
        NavigationTelemetry["SaveLocation"] = "SaveLocation";
        NavigationTelemetry["TeleportViaMap"] = "TeleportViaMap";
    })(NavigationTelemetry || (NavigationTelemetry = {}));
    class GotoMarkBehavior {
        constructor(uiSession, parentMenu) {
            this.uiSession = uiSession;
            this.mapPayload = (0, server_editor_namespaceObject.makeObservable)("");
            this.previousDirectionPlayerIsFacing = GotoMark_Direction.North;
            this.ifShowMap = (0, server_editor_namespaceObject.makeObservable)(false);
            this.openMenuAction = this.uiSession.actionManager.createAction({
                actionType: server_editor_namespaceObject.ActionTypes.NoArgsAction,
                onExecute: () => {
                    this.parentPane?.show();
                }
            });
            this.isWithinPlayerIconArea = (x, z) => z >= -15 && z <= 12 && x >= -9 && x <= 10 && !((x >= -9 && x <= -6 || x >= 7 && x <= 10) && (z >= -15 && z <= -8 || z >= 9 && z <= 12) || (x >= -5 && x <= -2 || x >= 3 && x <= 6) && z >= -15 && z <= -12);
            this.isWhiteBlockInPlayerIcon = (x, z) => x >= -1 && x <= 2 && z >= -11 && z <= 8 || (x >= -5 && x <= -2 || x >= 3 && x <= 6) && z >= -7 && z <= 8;
            this.playerIconMap = new Map([ [ GotoMark_Direction.North, [ (z, x) => this.isWithinPlayerIconArea(x, z), (z, x) => this.isWhiteBlockInPlayerIcon(x, z) ] ], [ GotoMark_Direction.East, [ (z, x) => this.isWithinPlayerIconArea(z, -x), (z, x) => this.isWhiteBlockInPlayerIcon(z, -x) ] ], [ GotoMark_Direction.South, [ (z, x) => this.isWithinPlayerIconArea(x, -z), (z, x) => this.isWhiteBlockInPlayerIcon(x, -z) ] ], [ GotoMark_Direction.West, [ (z, x) => this.isWithinPlayerIconArea(z, x), (z, x) => this.isWhiteBlockInPlayerIcon(z, x) ] ], [ GotoMark_Direction.Northwest, [ (z, x) => z >= -12 && z <= 12 && x >= -12 && x <= 12 && !(this.playerIconAreaIndexArrays[x + 12].includes(z) || this.playerIconAreaIndexArrays[z + 12].includes(x)), (z, x) => this.playerIconWhiteBlockIndexArrays[x + 12].includes(z) || this.playerIconWhiteBlockIndexArrays[z + 12].includes(x) ] ], [ GotoMark_Direction.Northeast, [ (z, x) => z >= -12 && z <= 12 && x >= -12 && x <= 12 && !(this.playerIconAreaIndexArrays[-x + 12].includes(z) || this.playerIconAreaIndexArrays[z + 12].includes(-x)), (z, x) => this.playerIconWhiteBlockIndexArrays[-x + 12].includes(z) || this.playerIconWhiteBlockIndexArrays[z + 12].includes(-x) ] ], [ GotoMark_Direction.Southeast, [ (z, x) => z >= -12 && z <= 12 && x >= -12 && x <= 12 && !(this.playerIconAreaIndexArrays[-x + 12].includes(-z) || this.playerIconAreaIndexArrays[-z + 12].includes(-x)), (z, x) => this.playerIconWhiteBlockIndexArrays[-x + 12].includes(-z) || this.playerIconWhiteBlockIndexArrays[-z + 12].includes(-x) ] ], [ GotoMark_Direction.Southwest, [ (z, x) => z >= -12 && z <= 12 && x >= -12 && x <= 12 && !(this.playerIconAreaIndexArrays[x + 12].includes(-z) || this.playerIconAreaIndexArrays[-z + 12].includes(x)), (z, x) => this.playerIconWhiteBlockIndexArrays[x + 12].includes(-z) || this.playerIconWhiteBlockIndexArrays[-z + 12].includes(x) ] ] ]);
            this.playerIconAreaIndexArrays = [ [ -12, -11, -8, -7, -6, -5, -2, -1, 0, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 ], [ -7, -6, -1, 4, 5, 6, 7, 8, 9, 10, 11, 12 ], [ 5, 6, 7, 8, 9, 10, 11, 12 ], [ 6, 7, 8, 9, 10, 11, 12 ], [ 7, 8, 9, 10, 11, 12 ], [ 8, 9, 10, 11, 12 ], [ 9, 10, 11, 12 ], [ 10, 11, 12 ], [ 11, 12 ], [ 12 ], [], [], [ 12 ], [ 12 ], [ 11, 12 ], [ 12 ], [], [], [ 12 ], [ 11, 12 ], [ 10, 11, 12 ], [ 9, 10, 11, 12 ], [ 10, 11, 12 ], [ 11, 12 ], [ 12 ] ];
            this.playerIconWhiteBlockIndexArrays = [ [], [], [], [], [ -7, -6, -1, 0 ], [ -7, -6, -5 - 2, -1, 0, 1 ], [ -6, -5, -4, -3, -2, -1, 0, 1, 2 ], [ -5, -4, -3, -2, -1, 0, 1, 2, 3 ], [ -4, -3, -2, -1, 0, 1, 2, 3, 4 ], [ -3, -2, -1, 0, 1, 2, 3, 4, 5 ], [ -2, -1, 0, 1, 2, 3, 4, 5, 6 ], [ -1, 0, 1, 2, 3, 4, 5, 6, 7 ], [ 0, 1, 2, 3, 4, 5, 6, 7, 8 ], [ 1, 2, 3, 4, 5, 6, 7, 8 ], [ 2, 3, 4, 5, 6, 7, 8, 9 ], [ 3, 4, 5, 6, 7, 8 ], [ 4, 5, 6, 7 ], [ 5, 6 ], [], [], [], [], [], [], [] ];
            uiSession.log.debug(`Initializing extension [${uiSession.extensionContext.extensionInfo.name}] for player [${uiSession.extensionContext.player.name}]`);
            this.createMenuItem(parentMenu);
            this.telemetryManager = new TelemetryManager(uiSession.extensionContext.player, TelemetrySource.Navigation);
            this.previousLocation = uiSession.extensionContext.player.location;
            this.storedLocations = [];
            this.transactionHandler = (0, server_editor_namespaceObject.registerUserDefinedTransactionHandler)(uiSession.extensionContext.transactionManager, (payload => {
                uiSession.log.info(`Teleporting to location ${lib.Vector3Utils.toString(payload.current)}`);
                try {
                    uiSession.extensionContext.player.teleport(payload.current);
                } catch (e) {
                    uiSession.log.error(`Teleport failed: ${(0, server_editor_namespaceObject.stringFromException)(e)}`);
                }
            }), (payload => {
                uiSession.log.info(`Teleporting to location ${lib.Vector3Utils.toString(payload.destination)}`);
                try {
                    uiSession.extensionContext.player.teleport(payload.destination);
                } catch (e) {
                    uiSession.log.error(`Teleport failed: ${(0, server_editor_namespaceObject.stringFromException)(e)}`);
                }
            }));
            this.surfaceBlockColorCache = {
                center: uiSession.extensionContext.player.location,
                blocks: {},
                isUpdating: false
            };
            this.locationMarkRenderingStorage = {};
            const me = uiSession.extensionContext.player;
            try {
                const fetchedLocationsString = me.getDynamicProperty(STORED_LOCATION_DYNAMIC_PROPERTY_NAME);
                if (!fetchedLocationsString) {
                    uiSession.log.info("No stored locations found during initialization");
                } else {
                    const fetchedLocationsArray = JSON.parse(fetchedLocationsString);
                    if (fetchedLocationsArray) {
                        this.storedLocations = fetchedLocationsArray;
                    }
                    uiSession.log.info(`Found ${this.storedLocations.length} stored locations during initialization`);
                }
            } catch (e) {
                uiSession.log.info(`Exception ${(0, server_editor_namespaceObject.stringFromException)(e)} occurred during initialization`);
            }
            this.buildParentPane();
            uiSession.actionBar.registerItem("editor:actionBarItem:goToMark", this.openMenuAction, {
                label: "resourcePack.editor.goToMark.title",
                icon: "pack://textures/goto-mark.png",
                tooltipTitle: "resourcePack.editor.goToMark.actionBar.tooltip.title",
                tooltipDescription: "resourcePack.editor.goToMark.actionBar.tooltip.description"
            });
        }
        createMenuItem(menu) {
            menu.addItem({
                label: "resourcePack.editor.goToMark.title"
            }, this.openMenuAction);
        }
        buildParentPane() {
            const parentPane = this.uiSession.createPropertyPane({
                title: "resourcePack.editor.goToMark.title",
                infoTooltip: {
                    description: [ {
                        link: "https://aka.ms/BedrockEditorNavigationPanel",
                        text: "resourcePack.editor.help.learnMore"
                    } ]
                }
            });
            const currentLocation = lib.Vector3Utils.floor(this.uiSession.extensionContext.player.location);
            const mapSizeSelection = (0, server_editor_namespaceObject.makeObservable)(MapSize.Small);
            const playerLocation = (0, server_editor_namespaceObject.makeObservable)(currentLocation);
            this.previousLocation = {
                ...currentLocation
            };
            parentPane.addBool(this.ifShowMap, {
                title: "resourcePack.editor.goToMark.pane.showMap",
                onChange: current => {
                    if (current) {
                        this.updateLocationMarkRenderingStorage();
                        this.updateSurfaceBlockColorCache(false).catch((e => {
                            this.uiSession.log.error(`${e.message}`);
                            this.surfaceBlockColorCache.isUpdating = false;
                        }));
                        this.mapPayload.set(this.createMiniMap(mapSizeSelection));
                    }
                    if (this.mapSizeDropDown) {
                        this.mapSizeDropDown.enable = current;
                        this.mapSizeDropDown.visible = current;
                    }
                    if (this.mapImage) {
                        this.mapImage.visible = current;
                    }
                    if (this.refreshMapButton) {
                        this.refreshMapButton.enable = current;
                        this.refreshMapButton.visible = current;
                    }
                    if (this.locationMarkColorPicker) {
                        this.locationMarkColorPicker.visible = current;
                        this.locationMarkColorPicker.enable = current;
                    }
                    this.telemetryManager.fireTelemetryEvent(NavigationTelemetry.ShowMapToggle, {
                        showMap: current
                    });
                },
                variant: server_editor_namespaceObject.BoolPropertyItemVariant.ToggleSwitch
            });
            this.mapSizeDropDown = parentPane.addDropdown(mapSizeSelection, {
                visible: this.ifShowMap.value,
                enable: this.ifShowMap.value,
                title: "resourcePack.editor.goToMark.pane.mapSize",
                entries: [ {
                    label: "64 x 64 blocks",
                    value: MapSize.Small
                }, {
                    label: "128 x 128 blocks",
                    value: MapSize.Middle
                }, {
                    label: "256 x 256 blocks",
                    value: MapSize.Large
                } ],
                onChange: () => {
                    this.mapPayload.set(this.createMiniMap(mapSizeSelection));
                }
            });
            this.mapImage = parentPane.addImage(this.mapPayload, {
                visible: this.ifShowMap.value,
                imageSize: MAP_IMAGE_SIZE,
                alignment: server_editor_namespaceObject.LayoutAlignment.Center,
                onClick: (x, y) => {
                    const mapSize = mapSizeInPixels[mapSizeSelection.value];
                    const me = this.uiSession.extensionContext.player;
                    const currentLocation = lib.Vector3Utils.floor(me.location);
                    const clickedXZLocation = {
                        x: currentLocation.x + Math.floor(x * mapSize) - mapSize / 2,
                        y: 0,
                        z: currentLocation.z + Math.floor(y * mapSize) - mapSize / 2
                    };
                    const cacheKey = this.createCacheKey(clickedXZLocation.x, clickedXZLocation.z, DimensionIds[me.dimension.id]);
                    const blockBelowPlayerCacheKey = this.createCacheKey(currentLocation.x, currentLocation.z, DimensionIds[me.dimension.id]);
                    const cache = this.surfaceBlockColorCache;
                    if (cache.blocks[cacheKey] && cache.blocks[blockBelowPlayerCacheKey]) {
                        const blockBelowPlayerLocation = cache.blocks[blockBelowPlayerCacheKey].location;
                        const blockLocation = cache.blocks[cacheKey].location;
                        const teleportLocation = {
                            x: blockLocation.x,
                            y: blockLocation.y + currentLocation.y - blockBelowPlayerLocation.y,
                            z: blockLocation.z
                        };
                        this.teleportTo(teleportLocation);
                        this.telemetryManager.fireTelemetryEvent(NavigationTelemetry.TeleportViaMap);
                    } else {
                        this.uiSession.log.error(`Please wait for the blocks to be loaded`);
                    }
                }
            });
            this.refreshMapButton = parentPane.addButton(this.uiSession.actionManager.createAction({
                actionType: server_editor_namespaceObject.ActionTypes.NoArgsAction,
                onExecute: () => {
                    this.updateSurfaceBlockColorCache(true).then((() => {
                        this.mapPayload.set(this.createMiniMap(mapSizeSelection));
                    })).catch((e => {
                        this.uiSession.log.error(e.message);
                        this.surfaceBlockColorCache.isUpdating = false;
                    }));
                }
            }), {
                title: "resourcePack.editor.goToMark.pane.refreshMap",
                visible: this.ifShowMap.value,
                enable: this.ifShowMap.value
            });
            parentPane.addVector3(playerLocation, {
                title: "resourcePack.editor.goToMark.pane.location"
            });
            this.updateHandle = server_namespaceObject.system.runInterval((() => {
                if (!parentPane.visible) {
                    return;
                }
                const player = this.uiSession.extensionContext.player;
                const currentLocation = lib.Vector3Utils.floor(player.location);
                const previousLocation = lib.Vector3Utils.floor(this.previousLocation);
                const directionPlayerIsFacing = this.getCurrentDirectionPlayerIsFacing();
                if (lib.Vector3Utils.equals(currentLocation, previousLocation) && directionPlayerIsFacing === this.previousDirectionPlayerIsFacing) {
                    return;
                }
                this.previousLocation = currentLocation;
                playerLocation.set({
                    ...currentLocation
                });
                this.previousDirectionPlayerIsFacing = directionPlayerIsFacing;
                if (this.ifShowMap.value) {
                    this.mapPayload.set(this.createMiniMap(mapSizeSelection));
                }
            }), 1);
            this.cacheUpdateHandle = server_namespaceObject.system.runInterval((() => {
                if (!this.ifShowMap.value || !parentPane.visible) {
                    return;
                }
                const cache = this.surfaceBlockColorCache;
                const playerLocation = lib.Vector3Utils.floor(this.uiSession.extensionContext.player.location);
                if (!this.isPlayerFarFromCenter(cache.center, playerLocation) || cache.isUpdating) {
                    return;
                }
                this.updateSurfaceBlockColorCache(false).then((() => {
                    this.mapPayload.set(this.createMiniMap(mapSizeSelection));
                })).catch((e => {
                    this.uiSession.log.error(e.message);
                    cache.isUpdating = false;
                }));
            }), 20);
            this.cacheClearHandle = server_namespaceObject.system.runInterval((() => {
                if (!this.ifShowMap.value || !parentPane.visible) {
                    return;
                }
                const cache = this.surfaceBlockColorCache;
                if (Object.keys(cache.blocks).length > CACHE_MAX_SIZE) {
                    this.uiSession.log.debug(`Cache Clean starts: cache size ${Object.keys(cache.blocks).length} at ${Date.now().toString()}`);
                    const latestPlayerLocation = lib.Vector3Utils.floor(this.uiSession.extensionContext.player.location);
                    for (const key in cache.blocks) {
                        if (Object.prototype.hasOwnProperty.call(cache.blocks, key)) {
                            if (this.shouldDeleteItemFromCache(latestPlayerLocation, cache.blocks[key].location)) {
                                delete cache.blocks[key];
                            }
                        }
                    }
                    this.uiSession.log.debug(`Cache Clean finished!: cache size ${Object.keys(cache.blocks).length} at ${Date.now().toString()}`);
                }
            }), 20);
            parentPane.addButton(this.uiSession.actionManager.createAction({
                actionType: server_editor_namespaceObject.ActionTypes.NoArgsAction,
                onExecute: () => {
                    const panelLocation = playerLocation.value;
                    this.teleportTo(panelLocation);
                    this.telemetryManager.fireTelemetryEvent(NavigationTelemetry.TeleportToLocation);
                }
            }), {
                title: "resourcePack.editor.goToMark.pane.teleport",
                visible: true
            });
            parentPane.addDivider();
            this.parentPane = parentPane;
            this.buildLocationPane(0, mapSizeSelection);
            return parentPane;
        }
        mapDropdownItems() {
            return this.storedLocations.map(((v, index) => {
                const item = {
                    label: `${index + 1}: ${v.name} (${lib.Vector3Utils.toString(v.location)})`,
                    value: index
                };
                return item;
            }));
        }
        createTransaction(current, destination) {
            const transactionPayload = {
                current,
                destination
            };
            if (!this.uiSession.scratchStorage) {
                return;
            }
            this.uiSession.extensionContext.transactionManager.openTransaction("goto position");
            this.transactionHandler.addUserDefinedOperation(transactionPayload, "Goto(Teleport)");
            this.uiSession.extensionContext.transactionManager.commitOpenTransaction();
        }
        teleportTo(destination) {
            this.createTransaction(this.uiSession.extensionContext.player.location, destination);
            this.uiSession.log.info(`Teleporting to location ${lib.Vector3Utils.toString(destination)}`);
            try {
                this.uiSession.extensionContext.player.teleport(destination);
            } catch (e) {
                this.uiSession.log.error(`Teleport failed: ${(0, server_editor_namespaceObject.stringFromException)(e)}`);
            }
        }
        buildLocationPane(initialSelection, mapSizeSelection) {
            if (!this.parentPane) {
                this.uiSession.log.error("An error occurred: No UI pane could be found");
                return;
            }
            const locationPane = this.parentPane.createSubPane({
                title: "resourcePack.editor.goToMark.pane.locationPane.title"
            });
            const currentColor = (0, server_editor_namespaceObject.makeObservable)(this.storedLocations[initialSelection]?.color ?? WHITE_RGBA);
            const currentSelection = (0, server_editor_namespaceObject.makeObservable)(initialSelection);
            const newName = (0, server_editor_namespaceObject.makeObservable)("");
            const dropdownItems = this.mapDropdownItems();
            this.dropdownMenu = locationPane.addDropdown(currentSelection, {
                title: "resourcePack.editor.goToMark.pane.locationPane.dropdownLabel",
                entries: dropdownItems,
                onChange: newValue => {
                    if (this.teleportButton) {
                        this.teleportButton.setTitle({
                            id: "resourcePack.editor.goToMark.pane.locationPane.teleport",
                            props: [ `${newValue + 1}` ]
                        });
                    }
                    if (this.storedLocations[newValue] === undefined) {
                        currentColor.set({
                            ...WHITE_RGBA
                        });
                        return;
                    }
                    currentColor.set({
                        ...this.storedLocations[newValue].color
                    });
                    this.telemetryManager.fireTelemetryEvent(NavigationTelemetry.StoredLocationsChanged);
                }
            });
            this.locationMarkColorPicker = locationPane.addColorPicker(currentColor, {
                visible: this.ifShowMap.value,
                enable: this.ifShowMap.value,
                variant: server_editor_namespaceObject.ColorPickerPropertyItemVariant.Inline,
                title: "resourcePack.editor.goToMark.pane.locationPane.markColor",
                hiddenAlpha: true,
                onChange: color => {
                    if (this.storedLocations[currentSelection.value] === undefined) {
                        return;
                    }
                    this.storedLocations[currentSelection.value].color = {
                        ...color
                    };
                    this.storeLocationsToPlayer();
                    if (this.ifShowMap.value) {
                        this.updateLocationMarkRenderingStorage();
                        this.mapPayload?.set(this.createMiniMap(mapSizeSelection));
                    }
                }
            });
            locationPane.addDivider();
            this.teleportButton = locationPane.addButton(this.uiSession.actionManager.createAction({
                actionType: server_editor_namespaceObject.ActionTypes.NoArgsAction,
                onExecute: () => {
                    if (currentSelection.value < 0 || currentSelection.value >= this.storedLocations.length) {
                        this.uiSession.log.error("No stored locations to delete");
                        return;
                    }
                    const destination = this.storedLocations[currentSelection.value].location;
                    this.teleportTo(destination);
                    this.telemetryManager.fireTelemetryEvent(NavigationTelemetry.TeleportToStoredLocation);
                }
            }), {
                title: {
                    id: "resourcePack.editor.goToMark.pane.locationPane.teleport",
                    props: [ dropdownItems.length > 0 ? `${currentSelection.value + 1}` : "" ]
                },
                visible: true
            });
            locationPane.addButton(this.uiSession.actionManager.createAction({
                actionType: server_editor_namespaceObject.ActionTypes.NoArgsAction,
                onExecute: () => {
                    const selectionValue = currentSelection.value;
                    if (selectionValue < 0 || selectionValue >= this.storedLocations.length) {
                        this.uiSession.log.error("No stored locations to delete");
                        return;
                    }
                    const locationData = this.storedLocations[selectionValue];
                    const locationName = locationData.name;
                    this.uiSession.log.info(`Deleting stored location name "${locationName}"`);
                    this.storedLocations.splice(selectionValue, 1);
                    this.storeLocationsToPlayer();
                    const dropdownItems = this.mapDropdownItems();
                    const newValue = selectionValue >= dropdownItems.length && selectionValue > 0 ? selectionValue - 1 : selectionValue;
                    this.dropdownMenu?.updateEntries(dropdownItems, newValue);
                    if (this.storedLocations[newValue] === undefined) {
                        currentColor.set({
                            ...WHITE_RGBA
                        });
                    } else {
                        currentColor.set({
                            ...this.storedLocations[newValue].color
                        });
                    }
                    this.updateLocationMarkRenderingStorage(locationData);
                    if (this.ifShowMap.value) {
                        this.mapPayload?.set(this.createMiniMap(mapSizeSelection));
                    }
                    this.teleportButton?.setTitle({
                        id: "resourcePack.editor.goToMark.pane.locationPane.teleport",
                        props: [ dropdownItems.length > 0 ? `${newValue + 1}` : "" ]
                    });
                    this.telemetryManager.fireTelemetryEvent(NavigationTelemetry.DeleteStoredLocation);
                }
            }), {
                title: "resourcePack.editor.goToMark.pane.locationPane.delete",
                visible: true
            });
            locationPane.addString(newName, {
                title: "resourcePack.editor.goToMark.pane.locationPane.inputName"
            });
            locationPane.addButton(this.uiSession.actionManager.createAction({
                actionType: server_editor_namespaceObject.ActionTypes.NoArgsAction,
                onExecute: () => {
                    if (this.storedLocations.length >= STORED_LOCATIONS_MAX) {
                        this.uiSession.log.error(`Cannot store more than ${STORED_LOCATIONS_MAX} locations`);
                        return;
                    }
                    const currentLocation = lib.Vector3Utils.floor(this.uiSession.extensionContext.player.location);
                    if (!newName.value || newName.value === "") {
                        newName.set(`Location ${this.storedLocations.length + 1}`);
                    } else {
                        const trimmedName = newName.value.trim();
                        if (trimmedName.length > STORED_LOCATION_NAME_MAX_LENGTH) {
                            newName.set(trimmedName.substring(0, STORED_LOCATION_NAME_MAX_LENGTH));
                        }
                    }
                    this.uiSession.log.info(`Adding Location ${lib.Vector3Utils.toString(currentLocation)} as "${newName.value}"`);
                    this.storedLocations.push({
                        name: newName.value,
                        location: currentLocation,
                        color: {
                            ...WHITE_RGBA
                        }
                    });
                    this.storeLocationsToPlayer();
                    const newSelectionIndex = this.storedLocations.length - 1;
                    const dropdownItems = this.mapDropdownItems();
                    this.dropdownMenu?.updateEntries(dropdownItems, newSelectionIndex);
                    currentColor.set({
                        ...WHITE_RGBA
                    });
                    if (this.ifShowMap.value) {
                        this.updateLocationMarkRenderingStorage();
                        this.mapPayload?.set(this.createMiniMap(mapSizeSelection));
                    }
                    this.teleportButton?.setTitle({
                        id: "resourcePack.editor.goToMark.pane.locationPane.teleport",
                        props: [ `${newSelectionIndex + 1}` ]
                    });
                    newName.set("");
                    this.telemetryManager.fireTelemetryEvent(NavigationTelemetry.SaveLocation);
                }
            }), {
                title: "resourcePack.editor.goToMark.pane.locationPane.store"
            });
        }
        storeLocationsToPlayer() {
            const me = this.uiSession.extensionContext.player;
            me.setDynamicProperty(STORED_LOCATION_DYNAMIC_PROPERTY_NAME, JSON.stringify(this.storedLocations));
        }
        createMiniMap(mapSizeSelection) {
            const mapSize = mapSizeInPixels[mapSizeSelection.value];
            const pixelFactor = pixelFactors[mapSizeSelection.value];
            const me = this.uiSession.extensionContext.player;
            const currentPlayerLocation = lib.Vector3Utils.floor(me.location);
            const currentDirectionPlayerIsFacing = this.getCurrentDirectionPlayerIsFacing();
            const maxHeight = me.dimension.heightRange.max;
            const dimensionID = DimensionIds[me.dimension.id];
            const rgbValues = [];
            const cache = this.surfaceBlockColorCache;
            for (let zOffset = -mapSize / 2 * pixelFactor; zOffset < mapSize / 2 * pixelFactor; zOffset++) {
                for (let xOffset = -mapSize / 2 * pixelFactor; xOffset < mapSize / 2 * pixelFactor; xOffset++) {
                    let color;
                    const blockXOffset = Math.floor(xOffset / pixelFactor);
                    const blockZOffset = Math.floor(zOffset / pixelFactor);
                    const isWithinPlayerArea = this.playerIconMap.get(currentDirectionPlayerIsFacing)?.[0];
                    const isWhiteBlock = this.playerIconMap.get(currentDirectionPlayerIsFacing)?.[1];
                    const highestLocation = {
                        x: currentPlayerLocation.x + blockXOffset,
                        y: maxHeight,
                        z: currentPlayerLocation.z + blockZOffset
                    };
                    const currentXZString = this.createCacheKey(highestLocation.x, highestLocation.z, mapSizeSelection.value);
                    const cacheKey = this.createCacheKey(highestLocation.x, highestLocation.z, dimensionID);
                    if (cache.blocks[cacheKey]) {
                        color = cache.blocks[cacheKey].color;
                    } else {
                        try {
                            const block = me.dimension.getBlockBelow(highestLocation, {
                                includeLiquidBlocks: true
                            });
                            if (block !== undefined) {
                                color = server_editor_bindings_namespaceObject.editorInternal.getMapColorUnsafe(me, block.location);
                                cache.blocks[cacheKey] = {
                                    color: {
                                        ...color
                                    },
                                    location: lib.Vector3Utils.floor(block.location)
                                };
                            } else {
                                color = {
                                    ...WHITE_RGBA
                                };
                            }
                        } catch {
                            color = {
                                ...WHITE_RGBA
                            };
                        }
                    }
                    if (isWithinPlayerArea?.(zOffset, xOffset)) {
                        color = isWhiteBlock?.(zOffset, xOffset) ? {
                            ...WHITE_RGBA
                        } : {
                            ...BLACK_RGBA
                        };
                    } else if (currentXZString in this.locationMarkRenderingStorage) {
                        color = this.locationMarkRenderingStorage[currentXZString].color;
                    }
                    const rgbObject = {
                        r: Math.round(color.red * 255),
                        g: Math.round(color.green * 255),
                        b: Math.round(color.blue * 255)
                    };
                    rgbValues.push(rgbObject);
                }
            }
            const base64Payload = CreateBase64ImageFromRGB(rgbValues, mapSize * pixelFactor, mapSize * pixelFactor);
            return base64Payload;
        }
        async updateSurfaceBlockColorCache(ifReloadBlockData) {
            const me = this.uiSession.extensionContext.player;
            const currentPlayerLocation = lib.Vector3Utils.floor(me.location);
            const maxHeight = me.dimension.heightRange.max;
            const dimensionID = DimensionIds[me.dimension.id];
            const cache = this.surfaceBlockColorCache;
            cache.center = currentPlayerLocation;
            cache.isUpdating = true;
            this.uiSession.log.debug(`Cache Update starts with cache size ${Object.keys(cache.blocks).length} at ${Date.now()}. Please wait for a while...`);
            if (!ifReloadBlockData) {
                const numChunksPerRow = CACHE_LENGTH / MAX_LOADED_CHUNK_SIZE;
                const centerChunkIndex = numChunksPerRow / 2 - 1;
                const processChunk = async (i, j) => {
                    const centerLocation = {
                        x: currentPlayerLocation.x + MAX_LOADED_CHUNK_SIZE * i - (CACHE_LENGTH / 2 - MAX_LOADED_CHUNK_SIZE / 2),
                        y: 0,
                        z: currentPlayerLocation.z + MAX_LOADED_CHUNK_SIZE * j - (CACHE_LENGTH / 2 - MAX_LOADED_CHUNK_SIZE / 2)
                    };
                    const operation = () => {
                        for (let zOffset = -MAX_LOADED_CHUNK_SIZE / 2; zOffset < MAX_LOADED_CHUNK_SIZE / 2; zOffset++) {
                            for (let xOffset = -MAX_LOADED_CHUNK_SIZE / 2; xOffset < MAX_LOADED_CHUNK_SIZE / 2; xOffset++) {
                                const highestLocation = {
                                    x: centerLocation.x + xOffset,
                                    y: maxHeight,
                                    z: centerLocation.z + zOffset
                                };
                                const cacheKey = this.createCacheKey(highestLocation.x, highestLocation.z, dimensionID);
                                if (!cache.blocks[cacheKey]) {
                                    const block = me.dimension.getBlockBelow(highestLocation, {
                                        includeLiquidBlocks: true
                                    });
                                    if (block !== undefined) {
                                        const color = server_editor_bindings_namespaceObject.editorInternal.getMapColorUnsafe(me, block.location);
                                        cache.blocks[cacheKey] = {
                                            color: {
                                                ...color
                                            },
                                            location: lib.Vector3Utils.floor(block.location)
                                        };
                                    }
                                }
                            }
                        }
                    };
                    const volume = new server_namespaceObject.BlockVolume({
                        x: centerLocation.x - MAX_LOADED_CHUNK_SIZE / 2,
                        y: maxHeight - 1,
                        z: centerLocation.z - MAX_LOADED_CHUNK_SIZE / 2
                    }, {
                        x: centerLocation.x + MAX_LOADED_CHUNK_SIZE / 2,
                        y: maxHeight - 1,
                        z: centerLocation.z + MAX_LOADED_CHUNK_SIZE / 2
                    });
                    await executeTickSafeOperation(this.uiSession.extensionContext, this.uiSession.log, volume.getBoundingBox(), EDITOR_PREFIX + `createminimap${i}${j}`, operation);
                };
                for (let i = centerChunkIndex; i <= centerChunkIndex + 1; i++) {
                    for (let j = centerChunkIndex; j <= centerChunkIndex + 1; j++) {
                        await processChunk(i, j);
                    }
                }
                for (let i = 0; i < numChunksPerRow; i++) {
                    for (let j = 0; j < numChunksPerRow; j++) {
                        if (i >= centerChunkIndex && i <= centerChunkIndex + 1 && j >= centerChunkIndex && j <= centerChunkIndex + 1) {
                            continue;
                        }
                        await processChunk(i, j);
                    }
                }
            } else {
                const operation = () => {
                    for (let zOffset = -MAP_REFRESH_SIZE / 2; zOffset < MAP_REFRESH_SIZE / 2; zOffset++) {
                        for (let xOffset = -MAP_REFRESH_SIZE / 2; xOffset < MAP_REFRESH_SIZE / 2; xOffset++) {
                            const highestLocation = {
                                x: currentPlayerLocation.x + xOffset,
                                y: maxHeight,
                                z: currentPlayerLocation.z + zOffset
                            };
                            const cacheKey = this.createCacheKey(highestLocation.x, highestLocation.z, dimensionID);
                            const block = me.dimension.getBlockBelow(highestLocation, {
                                includeLiquidBlocks: true
                            });
                            if (block !== undefined) {
                                const color = server_editor_bindings_namespaceObject.editorInternal.getMapColorUnsafe(me, block.location);
                                cache.blocks[cacheKey] = {
                                    color: {
                                        ...color
                                    },
                                    location: lib.Vector3Utils.floor(block.location)
                                };
                            }
                        }
                    }
                };
                const volume = new server_namespaceObject.BlockVolume({
                    x: currentPlayerLocation.x - MAP_REFRESH_SIZE / 2,
                    y: maxHeight - 1,
                    z: currentPlayerLocation.z - MAP_REFRESH_SIZE / 2
                }, {
                    x: currentPlayerLocation.x + MAP_REFRESH_SIZE / 2,
                    y: maxHeight - 1,
                    z: currentPlayerLocation.z + MAP_REFRESH_SIZE / 2
                });
                await executeTickSafeOperation(this.uiSession.extensionContext, this.uiSession.log, volume.getBoundingBox(), EDITOR_PREFIX + `createminimap`, operation);
            }
            cache.isUpdating = false;
            this.uiSession.log.debug(`Cache Update finished with cache size ${Object.keys(cache.blocks).length} at ${Date.now().toString()}`);
        }
        createCacheKey(x, z, extraItem) {
            return `${x},${z},${extraItem}`;
        }
        updateLocationMarkRenderingStorage(deletedLocation) {
            if (deletedLocation) {
                for (const locationString in this.locationMarkRenderingStorage) {
                    if (Object.prototype.hasOwnProperty.call(this.locationMarkRenderingStorage, locationString)) {
                        if (this.locationMarkRenderingStorage[locationString].relatedStoredLocation === deletedLocation) {
                            delete this.locationMarkRenderingStorage[locationString];
                        }
                    }
                }
            }
            this.processLocationMarkOnDifferentMapSize(-8, 0, -3, 3, ((z, x) => z === 0 && x === 0 || z === -1 && x >= -1 && x <= 1 || z === -2 && x >= -1 && x <= 1 || z === -3 && x >= -2 && x <= 2 || z >= -6 && z <= -4 && x >= -3 && x <= 3 || z === -7 && x >= -2 && x <= 2 || z === -8 && x >= -1 && x <= 1), ((z, x) => z === 0 && x === 0 || z === -1 && (x === -1 || x === 1) || z === -2 && (x === -1 || x === 1) || z === -3 && (x === -2 || x === 2) || z >= -6 && z <= -4 && (x === -3 || x === 3) || z === -7 && (x === -2 || x === 2) || z === -8 && x >= -1 && x <= 1), ((z, x) => z === -4 && x === 0 || z === -5 && x >= -1 && x <= 1 || z === -6 && x === 0), MapSize.Small);
            this.processLocationMarkOnDifferentMapSize(-8, 0, -3, 3, ((z, x) => z === 0 && x === 0 || z === -1 && x >= -1 && x <= 1 || z === -2 && x >= -1 && x <= 1 || z === -3 && x >= -2 && x <= 2 || z >= -6 && z <= -4 && x >= -3 && x <= 3 || z === -7 && x >= -2 && x <= 2 || z === -8 && x >= -1 && x <= 1), ((z, x) => z === 0 && x === 0 || z === -1 && (x === -1 || x === 1) || z === -2 && (x === -1 || x === 1) || z === -3 && (x === -2 || x === 2) || z >= -6 && z <= -4 && (x === -3 || x === 3) || z === -7 && (x === -2 || x === 2) || z === -8 && x >= -1 && x <= 1), ((z, x) => z === -4 && x === 0 || z === -5 && x >= -1 && x <= 1 || z === -6 && x === 0), MapSize.Middle);
            this.processLocationMarkOnDifferentMapSize(-18, 0, -7, 7, ((z, x) => z >= -2 && z <= 0 && x >= -1 && x <= 1 || z >= -6 && z <= -3 && x >= -3 && x <= 3 || z >= -8 && z <= -7 && x >= -5 && x <= 5 || z >= -14 && z <= -9 && x >= -7 && x <= 7 || z >= -16 && z <= -15 && x >= -5 && x <= 5 || z >= -18 && z <= -17 && x >= -3 && x <= 3), ((z, x) => z >= -2 && z <= 0 && (x === -1 || x === 0 || x === 1) || z >= -6 && z <= -3 && (x === -3 || x === -2 || x === 2 || x === 3) || z >= -8 && z <= -7 && (x === -4 || x === -5 || x === 4 || x === 5) || z >= -14 && z <= -9 && (x === -7 || x === -6 || x === 6 || x === 7) || z >= -16 && z <= -15 && (x === -4 || x === -5 || x === 4 || x === 5) || z >= -18 && z <= -17 && x >= -3 && x <= 3), ((z, x) => z === -7 && x === 0 || z === -8 && x === 0 || z === -9 && x >= 0 && x <= 1 || z === -10 && x >= -1 && x <= 1 || z === -11 && x >= -4 && x <= 2 || z === -12 && x >= -2 && x <= 2 || z === -13 && x >= 0 && x <= 3 || z === -14 && x === 3), MapSize.Large);
        }
        processLocationMarkOnDifferentMapSize(zLowerBound, zUpperBound, xLowerBound, xUpperBound, isWithinRange, isWithinOuterBorderRange, isWithinInnerBorderRange, mapSize) {
            for (const locationData of this.storedLocations) {
                for (let zOffset = zUpperBound; zOffset >= zLowerBound; zOffset--) {
                    for (let xOffset = xLowerBound; xOffset <= xUpperBound; xOffset++) {
                        const currentLocation = {
                            x: locationData.location.x + xOffset,
                            y: locationData.location.y,
                            z: locationData.location.z + zOffset
                        };
                        if (isWithinRange(zOffset, xOffset)) {
                            const locationString = this.createCacheKey(currentLocation.x, currentLocation.z, mapSize);
                            let color;
                            if (isWithinOuterBorderRange(zOffset, xOffset)) {
                                color = {
                                    ...BLACK_RGBA
                                };
                            } else if (isWithinInnerBorderRange(zOffset, xOffset)) {
                                color = this.isLocationMarkNearWhite(locationData.color) ? {
                                    ...BLACK_RGBA
                                } : {
                                    ...WHITE_RGBA
                                };
                            } else {
                                color = {
                                    ...locationData.color
                                };
                            }
                            if (!(locationString in this.locationMarkRenderingStorage)) {
                                this.locationMarkRenderingStorage[locationString] = {
                                    color,
                                    relatedStoredLocation: locationData
                                };
                            } else if (locationData.location.z >= this.locationMarkRenderingStorage[locationString].relatedStoredLocation.location.z) {
                                this.locationMarkRenderingStorage[locationString].relatedStoredLocation = locationData;
                                this.locationMarkRenderingStorage[locationString].color = color;
                            }
                        }
                    }
                }
            }
        }
        getCurrentDirectionPlayerIsFacing() {
            const player = this.uiSession.extensionContext.player;
            let directionPlayerIsFacing;
            const viewDirection = player.getViewDirection();
            let angle = Math.atan2(viewDirection.z, viewDirection.x);
            if (angle < 0) {
                angle += 2 * Math.PI;
            }
            if (angle >= 15 * Math.PI / 8 || angle < Math.PI / 8) {
                directionPlayerIsFacing = GotoMark_Direction.East;
            } else if (angle >= Math.PI / 8 && angle < 3 * Math.PI / 8) {
                directionPlayerIsFacing = GotoMark_Direction.Southeast;
            } else if (angle >= 3 * Math.PI / 8 && angle < 5 * Math.PI / 8) {
                directionPlayerIsFacing = GotoMark_Direction.South;
            } else if (angle >= 5 * Math.PI / 8 && angle < 7 * Math.PI / 8) {
                directionPlayerIsFacing = GotoMark_Direction.Southwest;
            } else if (angle >= 7 * Math.PI / 8 && angle < 9 * Math.PI / 8) {
                directionPlayerIsFacing = GotoMark_Direction.West;
            } else if (angle >= 9 * Math.PI / 8 && angle < 11 * Math.PI / 8) {
                directionPlayerIsFacing = GotoMark_Direction.Northwest;
            } else if (angle >= 11 * Math.PI / 8 && angle < 13 * Math.PI / 8) {
                directionPlayerIsFacing = GotoMark_Direction.North;
            } else {
                directionPlayerIsFacing = GotoMark_Direction.Northeast;
            }
            return directionPlayerIsFacing;
        }
        isPlayerFarFromCenter(center, currentLocation) {
            return Math.abs(center.x - currentLocation.x) > CACHE_UPDATE_DISTANCE || Math.abs(center.z - currentLocation.z) > CACHE_UPDATE_DISTANCE;
        }
        shouldDeleteItemFromCache(latestPlayerLocation, itemLocation) {
            return Math.abs(latestPlayerLocation.x - itemLocation.x) > CACHE_LENGTH / 2 || Math.abs(latestPlayerLocation.z - itemLocation.z) > CACHE_LENGTH / 2;
        }
        isLocationMarkNearWhite(color) {
            return color.red >= .9 && color.blue >= .9 && color.green >= .9;
        }
        teardown() {
            this.uiSession.log.debug(`Shutting down extension [${this.uiSession.extensionContext.extensionInfo.name}] for player [${this.uiSession.extensionContext.player.name}]`);
            if (this.updateHandle) {
                server_namespaceObject.system.clearRun(this.updateHandle);
            }
            if (this.cacheClearHandle) {
                server_namespaceObject.system.clearRun(this.cacheClearHandle);
            }
            if (this.cacheUpdateHandle) {
                server_namespaceObject.system.clearRun(this.cacheUpdateHandle);
            }
        }
    }
    class WeatherBehavior {
        auxLog(logString, currentPlayer) {
            const currentTags = [ "Editor", "Weather" ];
            const currentLogProperties = {
                player: currentPlayer,
                tags: currentTags
            };
            server_editor_namespaceObject.editor.log.info(logString, currentLogProperties);
        }
        setWeatherAndLog(newWeatherType) {
            const dimension = server_namespaceObject.world.getDimension("overworld");
            dimension.setWeather(newWeatherType, this.weatherDuration);
            this.auxLog(`Setting weather to ${newWeatherType} in the Overworld dimension`);
        }
        getWeather() {
            const dimension = server_namespaceObject.world.getDimension("overworld");
            return dimension.getWeather();
        }
        resetMenuStates() {
            if (this.clearWeatherMenuItem) {
                this.clearWeatherMenuItem.checked = false;
            }
            if (this.rainWeatherMenuItem) {
                this.rainWeatherMenuItem.checked = false;
            }
            if (this.thunderWeatherMenuItem) {
                this.thunderWeatherMenuItem.checked = false;
            }
        }
        updateMenuStates(newWeatherType) {
            this.resetMenuStates();
            switch (newWeatherType) {
              case server_namespaceObject.WeatherType.Clear:
                if (this.clearWeatherMenuItem) {
                    this.clearWeatherMenuItem.checked = true;
                }
                break;

              case server_namespaceObject.WeatherType.Rain:
                if (this.rainWeatherMenuItem) {
                    this.rainWeatherMenuItem.checked = true;
                }
                break;

              case server_namespaceObject.WeatherType.Thunder:
                if (this.thunderWeatherMenuItem) {
                    this.thunderWeatherMenuItem.checked = true;
                }
                break;
            }
        }
        setSubscriptionToWeatherChangeEvent(uiSession) {
            uiSession.eventSubscriptionCache.subscribeToBedrockEvent("weatherChange", (evt => {
                this.auxLog(`Weather is now ${evt.newWeather} in the Overworld dimension`, uiSession.extensionContext.player);
                this.updateMenuStates(evt.newWeather);
            }));
        }
        constructor(uiSession, parentMenu) {
            this.uiSession = uiSession;
            this.weatherMenu = undefined;
            this.clearWeatherMenuItem = undefined;
            this.rainWeatherMenuItem = undefined;
            this.thunderWeatherMenuItem = undefined;
            this.weatherDuration = 1e6;
            this.createWeatherMenu(parentMenu);
            this.setSubscriptionToWeatherChangeEvent(this.uiSession);
            this.updateMenuStates(this.getWeather());
        }
        createWeatherMenu(parentMenu) {
            const weatherClearAction = this.uiSession.actionManager.createAction({
                actionType: server_editor_namespaceObject.ActionTypes.NoArgsAction,
                onExecute: () => {
                    this.setWeatherAndLog(server_namespaceObject.WeatherType.Clear);
                }
            });
            const weatherRainAction = this.uiSession.actionManager.createAction({
                actionType: server_editor_namespaceObject.ActionTypes.NoArgsAction,
                onExecute: () => {
                    this.setWeatherAndLog(server_namespaceObject.WeatherType.Rain);
                }
            });
            const weatherThunderAction = this.uiSession.actionManager.createAction({
                actionType: server_editor_namespaceObject.ActionTypes.NoArgsAction,
                onExecute: () => {
                    this.setWeatherAndLog(server_namespaceObject.WeatherType.Thunder);
                }
            });
            if (this.uiSession.scratchStorage) {
                this.weatherMenu = parentMenu.addItem({
                    label: "resourcePack.editor.menuBar.parentMenu.weather"
                });
                this.clearWeatherMenuItem = this.weatherMenu.addItem({
                    label: "resourcePack.editor.menuBar.parentMenu.weather.clear"
                }, weatherClearAction);
                this.rainWeatherMenuItem = this.weatherMenu.addItem({
                    label: "resourcePack.editor.menuBar.parentMenu.weather.rain"
                }, weatherRainAction);
                this.thunderWeatherMenuItem = this.weatherMenu.addItem({
                    label: "resourcePack.editor.menuBar.parentMenu.weather.thunder"
                }, weatherThunderAction);
            }
        }
        teardown() {
            this.resetMenuStates();
        }
    }
    function JSONPropertyPane_stringFromException(e) {
        if (typeof e === "string") {
            return e;
        } else if (typeof e === "object" && e !== null && "message" in e) {
            return e.message;
        }
        return "Unknown exception";
    }
    var PropertyBagItemType;
    (function(PropertyBagItemType) {
        PropertyBagItemType[PropertyBagItemType["Number"] = 0] = "Number";
        PropertyBagItemType[PropertyBagItemType["String"] = 1] = "String";
        PropertyBagItemType[PropertyBagItemType["Slider"] = 2] = "Slider";
        PropertyBagItemType[PropertyBagItemType["ColorRGB"] = 3] = "ColorRGB";
        PropertyBagItemType[PropertyBagItemType["ColorRGBA"] = 4] = "ColorRGBA";
        PropertyBagItemType[PropertyBagItemType["Vector3"] = 5] = "Vector3";
        PropertyBagItemType[PropertyBagItemType["Dropdown"] = 6] = "Dropdown";
        PropertyBagItemType[PropertyBagItemType["Checkbox"] = 7] = "Checkbox";
    })(PropertyBagItemType || (PropertyBagItemType = {}));
    class DataItemGroup {
        constructor(_displayName, _path, _parentGroup, _type) {
            this._displayName = _displayName;
            this._path = _path;
            this._dataItems = [];
            this._parentGroup = _parentGroup;
            this._logicalGroupOnly = false;
            this._type = _type;
        }
        get displayName() {
            return this._displayName;
        }
        get path() {
            return this._path;
        }
        get containerBounds() {
            return this._containerBounds;
        }
        set containerBounds(value) {
            this._containerBounds = value;
        }
        get propertyPane() {
            return this._uiPropertyPane;
        }
        get logicalGroupOnly() {
            return this._logicalGroupOnly;
        }
        set logicalGroupOnly(value) {
            this._logicalGroupOnly = value;
        }
        get type() {
            return this._type;
        }
        createPropertyPane(_rootPane, _propertyBag, _actualData, _schemaInterface, _dataItemChangedCallback) {
            if (this._parentGroup) {
                if (this._parentGroup.propertyPane) {
                    _rootPane = this._parentGroup.propertyPane;
                }
            }
            if (!_rootPane) {
                throw new Error(`Missing parent property pane`);
            }
            const displayName = this._displayName;
            const displayExpander = this._displayName.length > 0;
            if (this._logicalGroupOnly) {
                this._uiPropertyPane = _rootPane;
            } else {
                this._uiPropertyPane = _rootPane.createSubPane({
                    title: displayName,
                    hasExpander: displayExpander
                });
            }
            if (!this._uiPropertyPane) {
                throw new Error("Failed to create property pane");
            }
            this._dataItems.sort(((a, b) => a._displayName.localeCompare(b._displayName)));
            for (const item of this._dataItems) {
                if (item._propertyBagType === PropertyBagItemType.Number || item._propertyBagType === PropertyBagItemType.Slider) {
                    const showSlider = item._propertyBagType === PropertyBagItemType.Slider;
                    _schemaInterface.debug(`Adding number property: ${item._propertyBagName} as ${showSlider ? "slider" : "number"}`);
                    const controlProps = {};
                    if (item._min !== undefined && item._max !== undefined) {
                        controlProps.min = item._min;
                        controlProps.max = item._max;
                        controlProps.showSlider = showSlider;
                        controlProps.isFloat = true;
                    }
                    if (item._readonly) {
                        controlProps.enable = false;
                    }
                    item._insertDataIntoOriginalObject = (_obj, _property, _oldValue, _newValue) => {
                        const propertyBagType = item._propertyBagType;
                        const originalType = item._originalType;
                        const ok = this._insertDataIntoOriginalObject(_property, _newValue, _actualData, propertyBagType, originalType);
                        if (ok && _dataItemChangedCallback) {
                            _dataItemChangedCallback();
                        }
                    };
                    controlProps.title = item._displayName;
                    controlProps.onChange = item._insertDataIntoOriginalObject;
                    this._uiPropertyPane.addNumber_deprecated(_propertyBag, item._propertyBagName, controlProps);
                } else if (item._propertyBagType === PropertyBagItemType.String) {
                    _schemaInterface.debug(`Adding string property: ${item._propertyBagName}`);
                    item._insertDataIntoOriginalObject = (_obj, _property, _oldValue, _newValue) => {
                        const propertyBagType = item._propertyBagType;
                        const originalType = item._originalType;
                        const ok = this._insertDataIntoOriginalObject(_property, _newValue, _actualData, propertyBagType, originalType);
                        if (ok && _dataItemChangedCallback) {
                            _dataItemChangedCallback();
                        }
                    };
                    const stringProps = {
                        title: item._displayName,
                        onChange: item._insertDataIntoOriginalObject
                    };
                    if (item._readonly) {
                        stringProps.enable = false;
                    }
                    this._uiPropertyPane.addString_deprecated(_propertyBag, item._propertyBagName, stringProps);
                } else if (item._propertyBagType === PropertyBagItemType.ColorRGB || item._propertyBagType === PropertyBagItemType.ColorRGBA) {
                    _schemaInterface.debug(`Adding color property: ${item._propertyBagName}`);
                    item._insertDataIntoOriginalObject = (_obj, _property, _oldValue, _newValue) => {
                        const propertyBagType = item._propertyBagType;
                        const originalType = item._originalType;
                        const ok = this._insertDataIntoOriginalObject(_property, _newValue, _actualData, propertyBagType, originalType);
                        if (ok && _dataItemChangedCallback) {
                            _dataItemChangedCallback();
                        }
                    };
                    const colorProps = {
                        title: item._displayName,
                        showAlpha: item._propertyBagType === PropertyBagItemType.ColorRGBA,
                        variant: server_editor_namespaceObject.ColorPickerPropertyItemVariant.Inline,
                        onChange: item._insertDataIntoOriginalObject
                    };
                    if (item._readonly) {
                        colorProps.enable = false;
                    }
                    this._uiPropertyPane.addColorPicker_deprecated(_propertyBag, item._propertyBagName, colorProps);
                } else if (item._propertyBagType === PropertyBagItemType.Vector3) {
                    _schemaInterface.debug(`Adding vector property: ${item._propertyBagName}`);
                    item._insertDataIntoOriginalObject = (_obj, _property, _oldValue, _newValue) => {
                        const propertyBagType = item._propertyBagType;
                        const originalType = item._originalType;
                        const ok = this._insertDataIntoOriginalObject(_property, _newValue, _actualData, propertyBagType, originalType);
                        if (ok && _dataItemChangedCallback) {
                            _dataItemChangedCallback();
                        }
                    };
                    const vectorProps = {
                        title: item._displayName,
                        onChange: item._insertDataIntoOriginalObject
                    };
                    if (item._min !== undefined) {
                        vectorProps.minX = item._min;
                        vectorProps.minY = item._min;
                        vectorProps.minZ = item._min;
                    }
                    if (item._max !== undefined) {
                        vectorProps.maxX = item._max;
                        vectorProps.maxY = item._max;
                        vectorProps.maxZ = item._max;
                    }
                    if (item._readonly) {
                        vectorProps.enable = false;
                    }
                    this._uiPropertyPane.addVector3_deprecated(_propertyBag, item._propertyBagName, vectorProps);
                } else if (item._propertyBagType === PropertyBagItemType.Dropdown) {
                    _schemaInterface.debug(`Adding dropdown property: ${item._propertyBagName}`);
                    if (item._enums === undefined || item._prettyEnums === undefined) {
                        throw new Error("Dropdown property must have enums defined");
                    }
                    const comboDropdownItems = item._prettyEnums?.map(((v, i) => {
                        const dropItem = {
                            label: v,
                            value: i
                        };
                        return dropItem;
                    }));
                    item._insertDataIntoOriginalObject = (_obj, _property, _oldValue, _newValue) => {
                        const propertyBagType = item._propertyBagType;
                        const originalType = item._originalType;
                        const stringValue = item._enums !== undefined ? item._enums[Number(_newValue)] : "";
                        const ok = this._insertDataIntoOriginalObject(_property, stringValue, _actualData, propertyBagType, originalType);
                        if (ok && _dataItemChangedCallback) {
                            _dataItemChangedCallback();
                        }
                    };
                    const comboProps = {
                        title: item._displayName,
                        dropdownItems: comboDropdownItems,
                        onChange: item._insertDataIntoOriginalObject
                    };
                    if (item._readonly) {
                        comboProps.enable = false;
                    }
                    comboProps.dropdownItems = comboDropdownItems;
                    this._uiPropertyPane.addDropdown_deprecated(_propertyBag, item._propertyBagName, comboProps);
                } else if (item._propertyBagType === PropertyBagItemType.Checkbox) {
                    _schemaInterface.debug(`Adding checkbox property: ${item._propertyBagName}`);
                    const controlProps = {
                        displayAsToggleSwitch: true
                    };
                    if (item._readonly) {
                        controlProps.enable = false;
                    }
                    item._insertDataIntoOriginalObject = (_obj, _property, _oldValue, _newValue) => {
                        const propertyBagType = item._propertyBagType;
                        const originalType = item._originalType;
                        const ok = this._insertDataIntoOriginalObject(_property, _newValue, _actualData, propertyBagType, originalType);
                        if (ok && _dataItemChangedCallback) {
                            _dataItemChangedCallback();
                        }
                    };
                    controlProps.title = item._displayName;
                    controlProps.onChange = item._insertDataIntoOriginalObject;
                    this._uiPropertyPane.addBool_deprecated(_propertyBag, item._propertyBagName, controlProps);
                }
            }
        }
        _insertDataIntoOriginalObject(_property, _newValue, _actualData, _propertyBagType, _originalType) {
            const fnInsertDataIntoObjectByPath = (_path, _value) => {
                const pathParts = _path.split("/").filter(Boolean);
                let data = _actualData;
                for (let i = 0; i < pathParts.length; i++) {
                    const part = pathParts[i];
                    if (data[part] === undefined) {
                        throw new Error(`Failed to find path element ${part}`);
                    }
                    if (i === pathParts.length - 1) {
                        data[part] = _value;
                        return true;
                    }
                    data = data[part];
                }
                throw new Error(`Failed to find path element ${_path}`);
            };
            switch (_propertyBagType) {
              case PropertyBagItemType.Number:
              case PropertyBagItemType.Slider:
                {
                    if (typeof _newValue !== "number") {
                        throw new Error(`Invalid number value for property ${_property}`);
                    }
                    switch (_originalType) {
                      case OpNodeSourceType.INTEGER:
                        fnInsertDataIntoObjectByPath(_property, Math.round(_newValue));
                        break;

                      case OpNodeSourceType.NUMBER:
                        fnInsertDataIntoObjectByPath(_property, _newValue);
                        break;

                      default:
                        throw new Error(`Invalid original type for property ${_property}`);
                    }
                }
                break;

              case PropertyBagItemType.Checkbox:
                {
                    if (typeof _newValue !== "boolean") {
                        throw new Error(`Invalid number value for property ${_property}`);
                    }
                    fnInsertDataIntoObjectByPath(_property, _newValue);
                }
                break;

              case PropertyBagItemType.String:
                {
                    if (typeof _newValue !== "string") {
                        throw new Error(`Invalid string value for property ${_property}`);
                    }
                    if (_originalType !== OpNodeSourceType.STRING) {
                        throw new Error(`Invalid original type for property ${_property}`);
                    }
                    fnInsertDataIntoObjectByPath(_property, _newValue);
                }
                break;

              case PropertyBagItemType.ColorRGB:
              case PropertyBagItemType.ColorRGBA:
                {
                    if (typeof _newValue !== "object") {
                        throw new Error(`Invalid color value for property ${_property}`);
                    }
                    if (_originalType === OpNodeSourceType.ARRAY || _originalType === OpNodeSourceType.MAP) {
                        if ("red" in _newValue && "green" in _newValue && "blue" in _newValue) {
                            if (_originalType === OpNodeSourceType.ARRAY) {
                                const colorComponents = [];
                                colorComponents.push(Number(_newValue.red));
                                colorComponents.push(Number(_newValue.green));
                                colorComponents.push(Number(_newValue.blue));
                                if (_propertyBagType === PropertyBagItemType.ColorRGBA && "alpha" in _newValue) {
                                    colorComponents.push(Number(_newValue.alpha));
                                }
                                for (let i = 0; i < colorComponents.length; i++) {
                                    const keyName = `${_property}/${i}`;
                                    fnInsertDataIntoObjectByPath(keyName, colorComponents[i] * 255);
                                }
                            } else if (_originalType === OpNodeSourceType.MAP) {
                                throw new Error(`Associative container of named RGB values not yet implemented`);
                            }
                        } else {
                            throw new Error(`Invalid color value for property ${_property}`);
                        }
                    } else if (_originalType === OpNodeSourceType.STRING) {
                        if ("red" in _newValue && "green" in _newValue && "blue" in _newValue) {
                            const toHex = n => {
                                const hex = Math.max(0, Math.min(255, Math.round(n * 255))).toString(16);
                                return hex.length === 1 ? "0" + hex : hex;
                            };
                            const hexString = `#${toHex(Number(_newValue.red))}${toHex(Number(_newValue.green))}${toHex(Number(_newValue.blue))}`;
                            fnInsertDataIntoObjectByPath(_property, hexString);
                        } else {
                            throw new Error(`Invalid color value for property ${_property}`);
                        }
                    } else {
                        throw new Error(`Invalid original type for property ${_property}`);
                    }
                }
                break;

              case PropertyBagItemType.Vector3:
                {
                    if (typeof _newValue !== "object" && !Array.isArray(_newValue)) {
                        throw new Error(`Invalid color value for property ${_property}`);
                    }
                    if (_originalType !== OpNodeSourceType.ARRAY && _originalType !== OpNodeSourceType.MAP) {
                        throw new Error(`Invalid original type for property ${_property}`);
                    }
                    if ("x" in _newValue && "y" in _newValue && "z" in _newValue) {
                        if (_originalType === OpNodeSourceType.ARRAY) {
                            const vectorComponents = [];
                            vectorComponents.push(Number(_newValue.x));
                            vectorComponents.push(Number(_newValue.y));
                            vectorComponents.push(Number(_newValue.z));
                            for (let i = 0; i < vectorComponents.length; i++) {
                                const keyName = `${_property}/${i}`;
                                fnInsertDataIntoObjectByPath(keyName, vectorComponents[i]);
                            }
                        } else if (_originalType === OpNodeSourceType.MAP) {
                            throw new Error(`Associative container of named XYZ values not yet implemented`);
                        }
                    } else {
                        throw new Error(`Invalid color value for property ${_property}`);
                    }
                }
                break;

              case PropertyBagItemType.Dropdown:
                {
                    if (typeof _newValue !== "string") {
                        throw new Error(`Invalid dropdown value for property ${_property}`);
                    }
                    if (_originalType !== OpNodeSourceType.STRING) {
                        throw new Error(`Invalid original type for property ${_property}`);
                    }
                    fnInsertDataIntoObjectByPath(_property, _newValue);
                }
                break;

              default:
                throw new Error(`Invalid property bag type for property ${_property}`);
            }
            return true;
        }
        addNumber_deprecated(_displayName, _propertyBagName, _originalType, _min, _max, _readonly) {
            this._dataItems.push({
                _displayName,
                _propertyBagName,
                _propertyBagType: PropertyBagItemType.Number,
                _min,
                _max,
                _originalType,
                _uiCollectionComponent: false,
                _readonly: _readonly ?? false
            });
        }
        addString_deprecated(_displayName, _propertyBagName, _validationRegex, _readonly) {
            this._dataItems.push({
                _displayName,
                _propertyBagName,
                _propertyBagType: PropertyBagItemType.String,
                _validationRegex,
                _originalType: OpNodeSourceType.STRING,
                _uiCollectionComponent: false,
                _readonly: _readonly ?? false
            });
        }
        addSlider(_displayName, _propertyBagName, _originalType, _min, _max) {
            this._dataItems.push({
                _displayName,
                _propertyBagName,
                _propertyBagType: PropertyBagItemType.Slider,
                _min,
                _max,
                _originalType,
                _uiCollectionComponent: false,
                _readonly: false
            });
        }
        addColor(_displayName, _propertyBagName, size, _originalType, _uiCollectionComponent) {
            this._dataItems.push({
                _displayName,
                _propertyBagName,
                _propertyBagType: size === 4 ? PropertyBagItemType.ColorRGBA : PropertyBagItemType.ColorRGB,
                _originalType,
                _uiCollectionComponent,
                _readonly: false
            });
        }
        addVector3(_displayName, _propertyBagName, _originalType, _min, _max, _readonly) {
            this._dataItems.push({
                _displayName,
                _propertyBagName,
                _propertyBagType: PropertyBagItemType.Vector3,
                _originalType,
                _min,
                _max,
                _uiCollectionComponent: true,
                _readonly: _readonly ?? false
            });
        }
        addDropdown(_displayName, _propertyBagName, _originalType, _enums, _prettyEnums, _readonly) {
            this._dataItems.push({
                _displayName,
                _propertyBagName,
                _propertyBagType: PropertyBagItemType.Dropdown,
                _originalType,
                _uiCollectionComponent: false,
                _readonly: _readonly ?? false,
                _enums,
                _prettyEnums
            });
        }
        addCheckbox(_displayName, _propertyBagName, _originalType, _readonly) {
            this._dataItems.push({
                _displayName,
                _propertyBagName,
                _propertyBagType: PropertyBagItemType.Checkbox,
                _originalType,
                _uiCollectionComponent: false,
                _readonly: _readonly ?? false
            });
        }
        restoreData(_propertyBag) {
            for (const item of this._dataItems) {
                const path = item._propertyBagName;
                const oldValue = _propertyBag[path];
                const newValue = _propertyBag[path];
                if (item._insertDataIntoOriginalObject) {
                    item._insertDataIntoOriginalObject(_propertyBag, path, oldValue, newValue);
                }
            }
        }
    }
    class UIComponentMap {
        constructor(session, data) {
            this._editableProperties = {};
            this._backupProperties = {};
            this._groups = [];
            this._session = session;
            this._dirty = false;
            this._currentData = JSON.parse(JSON.stringify(data));
        }
        get dirty() {
            return this._dirty;
        }
        set dirty(value) {
            this._dirty = value;
        }
        get currentData() {
            return this._currentData;
        }
        _findGroupFromPath(path) {
            const lastSlash = path.lastIndexOf("/");
            if (lastSlash <= 0) {
                return undefined;
            }
            const parentPath = path.slice(0, lastSlash);
            for (const group of this._groups) {
                if (group.path === parentPath) {
                    return group;
                }
            }
            throw new Error(`Failed to find a parent group for a non-root data item (${path})`);
            return undefined;
        }
        addDataItem(_path, _key, _type, _data, _properties) {
            let parentGroup = this._findGroupFromPath(_path);
            const fnConvertNodeTypeToDefaultEditor = _type => {
                switch (_type) {
                  case OpNodeSourceType.STRING:
                    return OpNodeEditorUIControlType.TEXT;

                  case OpNodeSourceType.NUMBER:
                  case OpNodeSourceType.INTEGER:
                    return OpNodeEditorUIControlType.FLOAT;

                  case OpNodeSourceType.BOOLEAN:
                    return OpNodeEditorUIControlType.CHECKBOX;

                  default:
                    return OpNodeEditorUIControlType.UNKNOWN;
                }
            };
            let editorControl = fnConvertNodeTypeToDefaultEditor(_type);
            const editorProperty = _properties.getProperty("OpPropertyEditorUIControl");
            if (editorProperty) {
                editorControl = editorProperty.controlType;
            }
            const labelAliases = _properties.getProperty("OpPropertyLabelAliases");
            const prettify = _properties.getProperty("OpPropertyPrettifier");
            const aliasAndPrettify = _key => {
                const alias = labelAliases?.getLabelAlias(_key) ?? _key;
                const displayName = prettify?.prettify(alias) ?? alias;
                return displayName;
            };
            const displayName = aliasAndPrettify(_key);
            if (_type === OpNodeSourceType.NULL) {
                throw new Error("I don't know what to do with nulls");
            } else if (_type === OpNodeSourceType.OBJECT || _type === OpNodeSourceType.ARRAY || _type === OpNodeSourceType.MAP) {
                this._groups.push(new DataItemGroup(displayName, _path, parentGroup, _type));
                const containerBounds = {
                    min: 0,
                    max: 0
                };
                const arrayBoundsProperty = _properties.getProperty("OpPropertyArrayBounds");
                if (arrayBoundsProperty) {
                    if (arrayBoundsProperty.minItems !== undefined) {
                        containerBounds.min = arrayBoundsProperty.minItems;
                    }
                    if (arrayBoundsProperty.maxItems !== undefined) {
                        containerBounds.max = arrayBoundsProperty.maxItems;
                    }
                } else {
                    const mapBoundsProperty = _properties.getProperty("OpPropertyMapBounds");
                    if (mapBoundsProperty) {
                        if (mapBoundsProperty.minProperties !== undefined) {
                            containerBounds.min = mapBoundsProperty.minProperties;
                        }
                        if (mapBoundsProperty.maxProperties !== undefined) {
                            containerBounds.max = mapBoundsProperty.maxProperties;
                        }
                    }
                }
                if (editorControl === OpNodeEditorUIControlType.COLOR || editorControl === OpNodeEditorUIControlType.VECTOR3) {
                    if (containerBounds.min !== containerBounds.max || containerBounds.min !== 3 && containerBounds.min !== 4) {
                        throw new Error(`Container bounds not specified - Path(${_path}), Key(${_key}) -- minItems and maxItems MUST be specified in the schema`);
                    }
                }
                if (editorControl === OpNodeEditorUIControlType.COLOR) {
                    this._groups[this._groups.length - 1].containerBounds = containerBounds;
                    this._groups[this._groups.length - 1].logicalGroupOnly = true;
                    const color = {
                        Red: 0,
                        Green: 0,
                        Blue: 0,
                        Alpha: 0
                    };
                    this._editableProperties[_path] = color;
                } else if (editorControl === OpNodeEditorUIControlType.VECTOR3) {
                    this._groups[this._groups.length - 1].containerBounds = containerBounds;
                    this._groups[this._groups.length - 1].logicalGroupOnly = true;
                    const vec3 = {
                        x: 0,
                        y: 0,
                        z: 0
                    };
                    this._editableProperties[_path] = vec3;
                }
            } else {
                if (!parentGroup) {
                    const groupIndex = this._groups.push(new DataItemGroup("", _path, undefined, OpNodeSourceType.NULL));
                    parentGroup = this._groups[groupIndex - 1];
                }
                if (_type !== OpNodeSourceType.STRING && _type !== OpNodeSourceType.NUMBER && _type !== OpNodeSourceType.INTEGER && _type !== OpNodeSourceType.BOOLEAN) {
                    return;
                }
                this._editableProperties[_path] = _data;
                const regexValidator = _properties.getProperty("OpPropertyPattern")?.pattern;
                const valueMin = _properties.getProperty("OpPropertyValueRange")?.min;
                const valueMax = _properties.getProperty("OpPropertyValueRange")?.max;
                const readonly = _properties.hasProperty("OpPropertyReadOnly");
                switch (editorControl) {
                  case OpNodeEditorUIControlType.FLOAT:
                    parentGroup.addNumber_deprecated(displayName, _path, _type, valueMin, valueMax, readonly);
                    break;

                  case OpNodeEditorUIControlType.SLIDER:
                    parentGroup.addSlider(displayName, _path, _type, valueMin, valueMax);
                    break;

                  case OpNodeEditorUIControlType.TEXT:
                    parentGroup.addString_deprecated(displayName, _path, regexValidator, readonly);
                    break;

                  case OpNodeEditorUIControlType.CHECKBOX:
                    parentGroup.addCheckbox(displayName, _path, _type, readonly);
                    break;

                  case OpNodeEditorUIControlType.COLOR:
                    {
                        const parentPath = parentGroup.path;
                        if (_type === OpNodeSourceType.NUMBER || _type === OpNodeSourceType.INTEGER) {
                            if (parentGroup.type !== OpNodeSourceType.ARRAY) {
                                throw new Error(`Associative container of named RGB values not yet implemented`);
                            }
                            const colorSize = parentGroup.containerBounds?.max;
                            if (!colorSize) {
                                throw new Error(`Array bounds not specified - Path(${_path}), Key(${_key})`);
                            }
                            const index = Number(_key);
                            if (index >= colorSize || index < 0) {
                                throw new Error(`Array bounds exceeded - Path(${_path}), Key(${_key})`);
                            } else if (index === colorSize - 1) {
                                const componentData = [];
                                for (let i = 0; i < colorSize; i++) {
                                    const colorComponentPath = `${parentPath}/${i}`;
                                    const colorComponent = this._editableProperties[colorComponentPath];
                                    if (typeof colorComponent !== "number") {
                                        throw new Error(`Invalid color component value at path ${colorComponentPath}`);
                                    }
                                    componentData.push(colorComponent / 255);
                                }
                                if (colorSize === 3) {
                                    componentData.push(1);
                                }
                                const color = {
                                    red: componentData[0],
                                    green: componentData[1],
                                    blue: componentData[2],
                                    alpha: componentData[3]
                                };
                                this._editableProperties[parentPath] = color;
                                const groupDisplayName = aliasAndPrettify(parentGroup.displayName);
                                const _grandparentGroup = this._findGroupFromPath(parentPath) ?? parentGroup;
                                _grandparentGroup.addColor(groupDisplayName, parentPath, colorSize, parentGroup.type, true);
                            }
                        } else if (_type === OpNodeSourceType.STRING) {
                            const colorString = String(_data);
                            if (!/^#([0-9A-Fa-f]{6}|[0-9A-Fa-f]{8})$/.test(colorString)) {
                                throw new Error("Invalid color string format");
                            }
                            const componentData = [];
                            let colorSize = 0;
                            for (let i = 1; i < colorString.length; i += 2) {
                                const component = parseInt(colorString.substring(i, i + 2), 16);
                                componentData.push(component / 255);
                                ++colorSize;
                            }
                            if (colorSize === 3) {
                                componentData.push(1);
                            }
                            const color = {
                                red: componentData[0],
                                green: componentData[1],
                                blue: componentData[2],
                                alpha: componentData[3]
                            };
                            this._editableProperties[parentPath] = color;
                            const groupDisplayName = aliasAndPrettify(parentGroup.displayName);
                            const grandparentGroup = this._findGroupFromPath(parentPath) ?? parentGroup;
                            grandparentGroup.addColor(groupDisplayName, parentPath, colorSize, parentGroup.type, true);
                        }
                    }
                    break;

                  case OpNodeEditorUIControlType.VECTOR3:
                    {
                        const parentPath = parentGroup.path;
                        if (_type === OpNodeSourceType.NUMBER || _type === OpNodeSourceType.INTEGER) {
                            if (parentGroup.type !== OpNodeSourceType.ARRAY) {
                                throw new Error(`Associative container of named XYZ values not yet implemented`);
                            }
                            const index = Number(_key);
                            if (index >= 3 || index < 0) {
                                throw new Error(`Array bounds exceeded - Path(${_path}), Key(${_key})`);
                            } else if (index === 2) {
                                const componentData = [];
                                for (let i = 0; i < 3; i++) {
                                    const componentPath = `${parentPath}/${i}`;
                                    const componentValue = this._editableProperties[componentPath];
                                    if (typeof componentValue !== "number") {
                                        throw new Error(`Invalid vector3 component value at path ${componentPath}`);
                                    }
                                    componentData.push(componentValue);
                                }
                                const vec3 = {
                                    x: componentData[0],
                                    y: componentData[1],
                                    z: componentData[2]
                                };
                                this._editableProperties[parentPath] = vec3;
                                const groupDisplayName = aliasAndPrettify(parentGroup.displayName);
                                const _grandparentGroup = this._findGroupFromPath(parentPath) ?? parentGroup;
                                _grandparentGroup.addVector3(groupDisplayName, parentPath, parentGroup.type, valueMin, valueMax, readonly);
                            }
                        }
                    }
                    break;

                  case OpNodeEditorUIControlType.DROPDOWN:
                    {
                        const enumProperty = _properties.getProperty("OpPropertyEnum");
                        if (enumProperty === undefined) {
                            throw new Error("Control type is dropdown, but no enum values specified in schema");
                        }
                        enumProperty.prettifyEnums(aliasAndPrettify);
                        const comboItems = enumProperty.enums ?? [];
                        const prettyComboItems = enumProperty.prettyEnums ?? [];
                        const index = enumProperty.getIndexOf(String(_data));
                        if (index === -1) {
                            throw new Error("Invalid enum value in data");
                        }
                        this._editableProperties[_path] = index;
                        parentGroup.addDropdown(displayName, _path, _type, comboItems, prettyComboItems, readonly);
                    }
                    break;

                  default:
                    throw new Error(`Unknown control type encountered - ${JSON.stringify(editorControl)}`);
                }
            }
        }
        constructUIComponents(_rootPane, _schemaInterface) {
            if (this._currentData === undefined) {
                throw new Error("No data object to build UI components from");
            }
            if (_rootPane === undefined) {
                throw new Error("No root pane to build UI components in");
            }
            this._editableProperties = (0, server_editor_namespaceObject.bindDataSource)(_rootPane, this._editableProperties);
            for (const group of this._groups) {
                group.createPropertyPane(_rootPane, this._editableProperties, this._currentData, _schemaInterface, (() => {
                    this._dirty = true;
                }));
            }
        }
        backupProperties() {
            this._backupProperties = JSON.parse(JSON.stringify(this._editableProperties));
        }
        restoreProperties() {
            for (const key in this._backupProperties) {
                const value = this._backupProperties[key];
                this._editableProperties[key] = value;
            }
            for (const group of this._groups) {
                group.restoreData(this._editableProperties);
            }
        }
    }
    var DeferredLightingTelemetry;
    (function(DeferredLightingTelemetry) {
        DeferredLightingTelemetry["ModeChanged"] = "ModeChanged";
        DeferredLightingTelemetry["ResetSettings"] = "ResetSettings";
        DeferredLightingTelemetry["ExportSettings"] = "ExportSettings";
    })(DeferredLightingTelemetry || (DeferredLightingTelemetry = {}));
    class JSONPropertyPane {
        _logInfo(message) {
            this._session.log.info(message);
        }
        _logError(message) {
            this._session.log.error(message);
        }
        _logDebug(message) {
            this._session.log.debug(message);
        }
        constructor(session) {
            this._errorCollection = [];
            this._session = session;
            this._tickHandle = -1;
            this._asyncOperationWorking = false;
            this.telemetryManager = new TelemetryManager(session.extensionContext.player, TelemetrySource.DeferredLighting);
            this._schemaInterface = new logInterface;
            this._schemaInterface._debug = _msg => {};
            this._schemaInterface._error = _msg => {
                this._logError(_msg);
                this._errorCollection.push(_msg);
            };
            this._schemaInterface._onStep = (_path, _key, _type, _data, _properties) => {
                this._schemaInterface.debug(`Step: Path(${_path}) - Key(${_key}) - Type(${_type}) - Data(${JSON.stringify(_data)}), Properties(${_properties.toString()})`);
                this._uiComponentMap?.addDataItem(_path, _key, _type, _data, _properties);
            };
            const transferManager = server_editor_bindings_namespaceObject.editorInternal.getPlayerServices(this._session.extensionContext.player).dataTransfer;
            const accessorList = transferManager.getRegisteredAccessors();
            this._rootPane = this._session.createPropertyPane({
                title: "resourcePack.editor.agfx.pane.title",
                infoTooltip: {
                    description: [ {
                        link: "https://aka.ms/BedrockEditorDeferredLighting",
                        text: "resourcePack.editor.help.learnMore"
                    } ]
                }
            });
            this._rootPropertyBag = (0, server_editor_namespaceObject.bindDataSource)(this._rootPane, {
                _selectedAccessorIndex: -1
            });
            this._rootPane.onPropertyPaneVisibilityUpdated.subscribe((eventData => {
                if (eventData.isVisible && this._currentAccessor !== undefined) {
                    const accessorName = this._currentAccessor;
                    this._startDirtyWatcher(transferManager, accessorName);
                } else {
                    this._stopDirtyWatcher();
                }
            }));
            const accessorDropdownItems = accessorList.map(((v, i) => {
                const item = {
                    label: v.nameStringId,
                    value: i
                };
                return item;
            }));
            this._rootPane.addDropdown_deprecated(this._rootPropertyBag, "_selectedAccessorIndex", {
                title: "resourcePack.editor.agfx.pane.settings_selector",
                dropdownItems: accessorDropdownItems,
                onChange: (_obj, _property, _oldValue, _newValue) => {
                    const oldIndex = Number(_oldValue);
                    const newIndex = Number(_newValue);
                    if (oldIndex === newIndex) {
                        return;
                    }
                    if (this._asyncOperationWorking) {
                        this._logInfo("Async operation already in progress - ignoring request for now");
                        this._rootPropertyBag._selectedAccessorIndex = oldIndex;
                        return;
                    }
                    if (this._rootPropertyBag._selectedAccessorIndex < 0 || this._rootPropertyBag._selectedAccessorIndex >= accessorList.length) {
                        this._logError("Invalid accessor index selected - this shouldn't be possible");
                        return;
                    }
                    const accessor = accessorList[this._rootPropertyBag._selectedAccessorIndex];
                    this._currentAccessor = accessor.uniqueId;
                    this._changeSettingPage(transferManager, accessor.uniqueId);
                    this.telemetryManager.fireTelemetryEvent(DeferredLightingTelemetry.ModeChanged, {
                        mode: accessor.uniqueId
                    });
                }
            });
            this._session.menuBar.getMenu(server_editor_namespaceObject.CoreMenuType.View).then((menu => {
                this._menu = menu.addItem({
                    label: "resourcePack.editor.deferredLightingSettings.menu.title",
                    uniqueId: "DeferredLightingSettingsMenuItem"
                }, this._session.actionManager.createAction({
                    actionType: server_editor_namespaceObject.ActionTypes.NoArgsAction,
                    onExecute: () => {
                        this._rootPane.show();
                    }
                }));
            })).catch((() => {
                this._logError("Failed to add root menu item for this tool");
            }));
        }
        _buildErrorUI(msg) {
            if (this._settingsPane) {
                this._settingsPane.hide();
                this._rootPane.removeSubPane(this._settingsPane);
                this._settingsPane = undefined;
            }
            this._settingsPane = this._rootPane.createSubPane({
                title: "resourcePack.editor.agfx.settings.error.title"
            });
            const errorMessages = msg.split("\n");
            for (const msg of errorMessages) {
                this._settingsPane.addText(msg, {
                    border: false
                });
            }
            this._asyncOperationWorking = false;
            this._settingsPane?.show();
            this._rootPane?.show();
        }
        _changeSettingPage(_transferManager, _accessorName) {
            if (this._asyncOperationWorking) {
                this._logError("Async operation already in progress - ignoring request");
                return;
            }
            this._errorCollection = [];
            if (this._settingsPane) {
                this._settingsPane.hide();
                this._rootPane.removeSubPane(this._settingsPane);
                this._settingsPane = undefined;
            }
            this._asyncOperationWorking = true;
            _transferManager.requestData(_accessorName).then((data => {
                this._schemaInterface.debug("Received data from transfer manager");
                this._asyncOperationWorking = false;
                let dataObject;
                let schemaObject;
                this._errorCollection = [];
                this._uiComponentMap = undefined;
                try {
                    dataObject = JSON.parse(data.data);
                    this._schemaInterface.debug("Parsed incoming JSON object - OK");
                    schemaObject = JSON.parse(data.schema);
                    this._schemaInterface.debug("Parsed incoming JSON schema - OK");
                } catch (e) {
                    this._schemaInterface.error(`Failed to parse incoming JSON object - ${JSONPropertyPane_stringFromException(e)}`);
                    this._buildErrorUI(this._errorCollection.join("\n"));
                    return;
                }
                this._uiComponentMap = new UIComponentMap(this._session, dataObject);
                try {
                    const schemaBuilder = new SchemaValidatorBuilder(this._schemaInterface);
                    const builtSchema = schemaBuilder.build(schemaObject);
                    const validatedFlag = schemaBuilder.validate(dataObject);
                    if (!validatedFlag) {
                        throw new Error("Failed to validate incoming JSON object");
                    }
                    this._uiComponentMap.backupProperties();
                } catch (e) {
                    this._schemaInterface.error(`Failed to validate schema - ${JSONPropertyPane_stringFromException(e)}`);
                    this._buildErrorUI(this._errorCollection.join("\n"));
                    this._uiComponentMap = undefined;
                    return;
                }
                try {
                    this._settingsPane = this._rootPane.createSubPane({
                        title: "resourcePack.editor.agfx.pane.settings.title"
                    });
                    this._settingsPane.addButton((() => {
                        if (this._uiComponentMap !== undefined) {
                            this._schemaInterface.debug("Resetting to defaults");
                            this._uiComponentMap.restoreProperties();
                            this._uiComponentMap.dirty = true;
                            this.telemetryManager.fireTelemetryEvent(DeferredLightingTelemetry.ResetSettings);
                        }
                    }), {
                        title: "resourcePack.editor.agfx.pane.settings.revert_changes"
                    });
                    this._settingsPane.addDivider();
                    this._uiComponentMap?.constructUIComponents(this._settingsPane, this._schemaInterface);
                    this._settingsPane.addDivider();
                    this._settingsPane.addButton((() => {
                        if (this._uiComponentMap !== undefined) {
                            this._logInfo("Exporting current settings to clipboard");
                            const data = JSON.stringify(this._uiComponentMap.currentData);
                            _transferManager.sendDataToClipboard(data);
                            this.telemetryManager.fireTelemetryEvent(DeferredLightingTelemetry.ExportSettings);
                        }
                    }), {
                        title: "resourcePack.editor.agfx.pane.settings.export_to_clipboard"
                    });
                    this._settingsPane.addDivider();
                    server_namespaceObject.system.runTimeout((() => {
                        this._logInfo("Showing settings pane");
                        this._settingsPane?.show();
                        this._rootPane?.show();
                    }), 1);
                } catch (e) {
                    this._schemaInterface.error(`Failed to build UI components - ${JSONPropertyPane_stringFromException(e)}`);
                    this._buildErrorUI(this._errorCollection.join("\n"));
                    return;
                }
                this._startDirtyWatcher(_transferManager, _accessorName);
            })).catch((e => {
                this._schemaInterface.error(`Failed to transfer data from client - ${JSONPropertyPane_stringFromException(e)}`);
                this._buildErrorUI(this._errorCollection.join("\n"));
            }));
        }
        _stopDirtyWatcher() {
            if (this._tickHandle !== -1) {
                server_namespaceObject.system.clearRun(this._tickHandle);
                this._tickHandle = -1;
            }
        }
        _startDirtyWatcher(_transferManager, _accessorName) {
            if (this._tickHandle !== -1) {
                this._stopDirtyWatcher();
            }
            if (this._tickHandle === -1) {
                this._tickHandle = server_namespaceObject.system.runInterval((() => {
                    if (this._uiComponentMap?.dirty) {
                        this._uiComponentMap.dirty = false;
                        this._schemaInterface.debug("Data is dirty - pushing to client");
                        const data = JSON.stringify(this._uiComponentMap.currentData);
                        _transferManager.sendData(_accessorName, data);
                    }
                }), 1);
            }
        }
        teardown() {
            this._stopDirtyWatcher();
        }
    }
    const MAX_RADIUS = 20;
    const MAX_LENGTH = 40;
    function registerConeBrushShape(uiSession) {
        const settings = {
            uniform: true,
            radius: 4,
            width: 4,
            depth: 4,
            height: 8,
            axis: ExtrudeAxis.YAxis
        };
        uiSession.extensionContext.brushShapeManager.registerBrushShape("resourcePack.editor.brushShape.cone.name", "pack://textures/editor/brushes/cone.png", (() => {
            const xSide = settings.uniform ? settings.radius : settings.width;
            const zSide = settings.uniform ? settings.radius : settings.depth;
            const xs_of_y = midpointLine(settings.height, xSide);
            const zs_of_y = midpointLine(settings.height, zSide);
            const heights = new Array(xSide * 2 + 1);
            for (let i = 0; i < heights.length; i++) {
                heights[i] = new Array(zSide * 2 + 1);
            }
            function setBuf(x, z, y) {
                for (let i = -z; i <= z; i++) {
                    heights[x + xSide][i + zSide] = y;
                    heights[-x + xSide][i + zSide] = y;
                }
            }
            for (let y = 0; y < xs_of_y.length; y++) {
                const corner_x = xs_of_y[xs_of_y.length - (y + 1)];
                const corner_z = zs_of_y[xs_of_y.length - (y + 1)];
                const zs_of_x = midpointEllipse(corner_x, corner_z);
                for (let x = 0; x < zs_of_x.length; x++) {
                    const z = zs_of_x[x];
                    setBuf(x - corner_x, z + 1, y);
                }
            }
            for (let z = 0; z < heights[0].length; z++) {
                heights[xSide][z] = heights[xSide - 1][z];
            }
            heights[xSide][zSide] = settings.height - 1;
            const points = [];
            for (let i = 0; i < heights.length; i++) {
                const col = heights[i];
                const x = i - xSide;
                for (let j = 0; j < col.length; j++) {
                    const z = j - zSide;
                    const y = col[j];
                    if (y > 0) {
                        points.push({
                            x,
                            y: 0,
                            z
                        });
                        points.push({
                            x,
                            y,
                            z
                        });
                    }
                }
            }
            const compoundBlockVolume = new server_namespaceObject.CompoundBlockVolume;
            for (let i = 0; i < points.length; i += 2) {
                const start = flipToAxis(points[i], settings.axis);
                const end = flipToAxis(points[i + 1], settings.axis);
                compoundBlockVolume.pushVolume({
                    action: server_namespaceObject.CompoundBlockVolumeAction.Add,
                    locationRelativity: server_namespaceObject.CompoundBlockVolumePositionRelativity.Relative,
                    volume: new server_namespaceObject.BlockVolume(start, end)
                });
            }
            return compoundBlockVolume;
        }), (() => {
            const uiElements = [ new server_editor_namespaceObject.SettingsUIElement("resourcePack.editor.brushShape.common.settings.uniform", settings.uniform, (arg => {
                if (arg !== undefined && typeof arg === "boolean") {
                    settings.uniform = arg;
                }
            }), {
                refreshOnChange: true
            }) ];
            if (settings.uniform) {
                uiElements.push(new server_editor_namespaceObject.SettingsUIElement("resourcePack.editor.brushShape.common.settings.radius", settings.radius, (arg => {
                    if (arg !== undefined && typeof arg === "number") {
                        settings.radius = arg;
                    }
                }), {
                    min: 1,
                    max: MAX_RADIUS
                }));
            } else {
                uiElements.push(new server_editor_namespaceObject.SettingsUIElement("resourcePack.editor.brushShape.cone.settings.width", settings.width, (arg => {
                    if (arg !== undefined && typeof arg === "number") {
                        settings.width = arg;
                    }
                }), {
                    min: 1,
                    max: MAX_RADIUS
                }), new server_editor_namespaceObject.SettingsUIElement("resourcePack.editor.brushShape.cone.settings.depth", settings.depth, (arg => {
                    if (arg !== undefined && typeof arg === "number") {
                        settings.depth = arg;
                    }
                }), {
                    min: 1,
                    max: MAX_RADIUS
                }));
            }
            uiElements.push(new server_editor_namespaceObject.SettingsUIElement("resourcePack.editor.brushShape.common.settings.height", settings.height, (arg => {
                if (arg !== undefined && typeof arg === "number") {
                    settings.height = arg;
                }
            }), {
                min: 1,
                max: MAX_LENGTH
            }), new server_editor_namespaceObject.SettingsUIElement("resourcePack.editor.brushShape.common.settings.axis", settings.axis, (arg => {
                if (arg !== undefined && typeof arg === "string") {
                    settings.axis = arg;
                }
            }), {
                dropdownItems: [ ExtrudeAxis.XAxis, ExtrudeAxis.YAxis, ExtrudeAxis.ZAxis ]
            }));
            return uiElements;
        }));
    }
    const cuboidBrushShape_MAX_LENGTH = 20;
    function registerCuboidBrushShape(uiSession) {
        const settings = {
            uniform: true,
            length: 4,
            width: 4,
            height: 4,
            depth: 4
        };
        uiSession.extensionContext.brushShapeManager.registerBrushShape("resourcePack.editor.brushShape.cuboid.name", "pack://textures/editor/brushes/cuboid.png", (() => {
            const compoundBlockVolume = new server_namespaceObject.CompoundBlockVolume;
            if (settings.uniform) {
                const side = Math.floor(settings.length / 2);
                compoundBlockVolume.pushVolume({
                    action: server_namespaceObject.CompoundBlockVolumeAction.Add,
                    locationRelativity: server_namespaceObject.CompoundBlockVolumePositionRelativity.Relative,
                    volume: new server_namespaceObject.BlockVolume({
                        x: -side,
                        y: 0,
                        z: -side
                    }, {
                        x: side,
                        y: side * 2,
                        z: side
                    })
                });
            } else {
                const xSide = Math.floor(settings.width / 2);
                const zSide = Math.floor(settings.depth / 2);
                compoundBlockVolume.pushVolume({
                    action: server_namespaceObject.CompoundBlockVolumeAction.Add,
                    locationRelativity: server_namespaceObject.CompoundBlockVolumePositionRelativity.Relative,
                    volume: new server_namespaceObject.BlockVolume({
                        x: -xSide,
                        y: 0,
                        z: -zSide
                    }, {
                        x: -xSide + settings.width - 1,
                        y: settings.height - 1,
                        z: -zSide + settings.depth - 1
                    })
                });
            }
            return compoundBlockVolume;
        }), (() => {
            const uiElements = [ new server_editor_namespaceObject.SettingsUIElement("resourcePack.editor.brushShape.common.settings.uniform", settings.uniform, (arg => {
                if (arg !== undefined && typeof arg === "boolean") {
                    settings.uniform = arg;
                }
            }), {
                refreshOnChange: true
            }) ];
            if (settings.uniform) {
                uiElements.push(new server_editor_namespaceObject.SettingsUIElement("resourcePack.editor.brushShape.common.settings.length", settings.length, (arg => {
                    if (arg !== undefined && typeof arg === "number") {
                        settings.length = arg;
                    }
                }), {
                    min: 1,
                    max: cuboidBrushShape_MAX_LENGTH
                }));
            } else {
                uiElements.push(new server_editor_namespaceObject.SettingsUIElement("resourcePack.editor.brushShape.cuboid.settings.width", settings.width, (arg => {
                    if (arg !== undefined && typeof arg === "number") {
                        settings.width = arg;
                    }
                }), {
                    min: 1,
                    max: cuboidBrushShape_MAX_LENGTH
                }), new server_editor_namespaceObject.SettingsUIElement("resourcePack.editor.brushShape.cuboid.settings.height", settings.height, (arg => {
                    if (arg !== undefined && typeof arg === "number") {
                        settings.height = arg;
                    }
                }), {
                    min: 1,
                    max: cuboidBrushShape_MAX_LENGTH
                }), new server_editor_namespaceObject.SettingsUIElement("resourcePack.editor.brushShape.cuboid.settings.depth", settings.depth, (arg => {
                    if (arg !== undefined && typeof arg === "number") {
                        settings.depth = arg;
                    }
                }), {
                    min: 1,
                    max: cuboidBrushShape_MAX_LENGTH
                }));
            }
            return uiElements;
        }));
    }
    const cylinderBrushShape_MAX_RADIUS = 20;
    const cylinderBrushShape_MAX_LENGTH = 40;
    function registerCylinderBrushShape(uiSession) {
        const settings = {
            uniform: true,
            radius: 4,
            width_radius: 4,
            depth_radius: 4,
            height: 8,
            axis: ExtrudeAxis.YAxis
        };
        uiSession.extensionContext.brushShapeManager.registerBrushShape("resourcePack.editor.brushShape.cylinder.name", "pack://textures/editor/brushes/cylinder.png", (() => {
            const width = settings.uniform ? settings.radius : settings.width_radius;
            const depth = settings.uniform ? settings.radius : settings.depth_radius;
            return calculateCylinderCompoundBlockVolume(width, depth, settings.height, settings.axis);
        }), (() => {
            const uiElements = [ new server_editor_namespaceObject.SettingsUIElement("resourcePack.editor.brushShape.common.settings.uniform", settings.uniform, (arg => {
                if (arg !== undefined && typeof arg === "boolean") {
                    settings.uniform = arg;
                }
            }), {
                refreshOnChange: true
            }) ];
            if (settings.uniform) {
                uiElements.push(new server_editor_namespaceObject.SettingsUIElement("resourcePack.editor.brushShape.common.settings.radius", settings.radius, (arg => {
                    if (arg !== undefined && typeof arg === "number") {
                        settings.radius = arg;
                    }
                }), {
                    min: 1,
                    max: cylinderBrushShape_MAX_RADIUS
                }));
            } else {
                uiElements.push(new server_editor_namespaceObject.SettingsUIElement("resourcePack.editor.brushShape.cylinder.settings.width_radius", settings.width_radius, (arg => {
                    if (arg !== undefined && typeof arg === "number") {
                        settings.width_radius = arg;
                    }
                }), {
                    min: 1,
                    max: cylinderBrushShape_MAX_RADIUS
                }), new server_editor_namespaceObject.SettingsUIElement("resourcePack.editor.brushShape.cylinder.settings.depth_radius", settings.depth_radius, (arg => {
                    if (arg !== undefined && typeof arg === "number") {
                        settings.depth_radius = arg;
                    }
                }), {
                    min: 1,
                    max: cylinderBrushShape_MAX_RADIUS
                }));
            }
            uiElements.push(new server_editor_namespaceObject.SettingsUIElement("resourcePack.editor.brushShape.common.settings.height", settings.height, (arg => {
                if (arg !== undefined && typeof arg === "number") {
                    settings.height = arg;
                }
            }), {
                min: 1,
                max: cylinderBrushShape_MAX_LENGTH
            }), new server_editor_namespaceObject.SettingsUIElement("resourcePack.editor.brushShape.common.settings.axis", settings.axis, (arg => {
                if (arg !== undefined && typeof arg === "string") {
                    settings.axis = arg;
                }
            }), {
                dropdownItems: [ ExtrudeAxis.XAxis, ExtrudeAxis.YAxis, ExtrudeAxis.ZAxis ]
            }));
            return uiElements;
        }));
    }
    const ellipsoidBrushShape_MAX_RADIUS = 20;
    function registerEllipsoidBrushShape(uiSession) {
        const settings = {
            uniform: true,
            radius: 4,
            width_radius: 4,
            height_radius: 4,
            depth_radius: 4
        };
        uiSession.extensionContext.brushShapeManager.registerBrushShape("resourcePack.editor.brushShape.ellipsoid.name", "pack://textures/editor/brushes/ellipsoid.png", (() => {
            const compoundBlockVolume = new server_namespaceObject.CompoundBlockVolume;
            let points = [];
            if (settings.uniform && settings.radius === 1 || !settings.uniform && settings.width_radius === 1 && settings.height_radius === 1 && settings.depth_radius === 1) {
                points.push({
                    x: 0,
                    y: 0,
                    z: 0
                }, {
                    x: 0,
                    y: 0,
                    z: 0
                });
            } else if (settings.uniform && settings.radius === 2 || !settings.uniform && settings.width_radius === 2 && settings.height_radius === 2 && settings.depth_radius === 2) {
                points = [ {
                    x: -1,
                    y: 0,
                    z: 0
                }, {
                    x: -1,
                    y: 0,
                    z: 0
                }, {
                    x: 0,
                    y: 0,
                    z: -1
                }, {
                    x: 0,
                    y: 0,
                    z: 1
                }, {
                    x: 1,
                    y: 0,
                    z: 0
                }, {
                    x: 1,
                    y: 0,
                    z: 0
                }, {
                    x: 0,
                    y: -1,
                    z: 0
                }, {
                    x: 0,
                    y: -1,
                    z: 0
                }, {
                    x: 0,
                    y: 1,
                    z: 0
                }, {
                    x: 0,
                    y: 1,
                    z: 0
                } ];
            } else {
                try {
                    const xSide = settings.uniform ? settings.radius : settings.width_radius;
                    const ySide = settings.uniform ? settings.radius : settings.height_radius;
                    const zSide = settings.uniform ? settings.radius : settings.depth_radius;
                    const xs_of_y = midpointEllipse(ySide, xSide);
                    const zs_of_y = midpointEllipse(ySide, zSide);
                    const heights = new Array(xSide * 2 + 1);
                    for (let i = 0; i < heights.length; i++) {
                        heights[i] = new Array(zSide * 2 + 1);
                    }
                    const setBuf = (x, z, y) => {
                        for (let i = zSide - z; i <= zSide + z; i++) {
                            heights[x][i] = y;
                            heights[2 * xSide - x][i] = y;
                        }
                    };
                    for (let y = 0; y < xs_of_y.length; y++) {
                        const y2 = xs_of_y.length - (y + 1);
                        const corner_x = xs_of_y[y2];
                        const corner_z = zs_of_y[y2];
                        const zs_of_x = midpointEllipse(corner_x, corner_z);
                        for (let x = 0; x < zs_of_x.length; x++) {
                            const z = zs_of_x[x];
                            setBuf(x + (xSide - corner_x), z, y);
                        }
                    }
                    for (let z = 0; z < heights[0].length; z++) {
                        heights[xSide][z] = heights[xSide - 1][z];
                    }
                    for (let i = 0; i < heights.length; i++) {
                        const col = heights[i];
                        const x = i - xSide;
                        for (let j = 0; j < col.length; j++) {
                            const z = j - zSide;
                            const y = col[j];
                            if (y > 0) {
                                points.push({
                                    x,
                                    y: -y,
                                    z
                                });
                                points.push({
                                    x,
                                    y: +y,
                                    z
                                });
                            }
                        }
                    }
                } catch (reason) {
                    uiSession.log.error(`Error computing ellipsoid: ${stringFromException(reason)}`);
                    points = [ {
                        x: 0,
                        y: 0,
                        z: 0
                    }, {
                        x: 0,
                        y: 0,
                        z: 0
                    } ];
                }
            }
            for (let i = 0; i < points.length; i += 2) {
                const start = points[i];
                const end = points[i + 1];
                compoundBlockVolume.pushVolume({
                    action: server_namespaceObject.CompoundBlockVolumeAction.Add,
                    locationRelativity: server_namespaceObject.CompoundBlockVolumePositionRelativity.Relative,
                    volume: new server_namespaceObject.BlockVolume(start, end)
                });
            }
            return compoundBlockVolume;
        }), (() => {
            const uiElements = [ new server_editor_namespaceObject.SettingsUIElement("resourcePack.editor.brushShape.common.settings.uniform", settings.uniform, (arg => {
                if (arg !== undefined && typeof arg === "boolean") {
                    settings.uniform = arg;
                }
            }), {
                refreshOnChange: true
            }) ];
            if (settings.uniform) {
                uiElements.push(new server_editor_namespaceObject.SettingsUIElement("resourcePack.editor.brushShape.common.settings.radius", settings.radius, (arg => {
                    if (arg !== undefined && typeof arg === "number") {
                        settings.radius = arg;
                    }
                }), {
                    min: 1,
                    max: ellipsoidBrushShape_MAX_RADIUS
                }));
            } else {
                uiElements.push(new server_editor_namespaceObject.SettingsUIElement("resourcePack.editor.brushShape.ellipsoid.settings.width_radius", settings.width_radius, (arg => {
                    if (arg !== undefined && typeof arg === "number") {
                        settings.width_radius = arg;
                    }
                }), {
                    min: 1,
                    max: ellipsoidBrushShape_MAX_RADIUS
                }), new server_editor_namespaceObject.SettingsUIElement("resourcePack.editor.brushShape.ellipsoid.settings.height_radius", settings.height_radius, (arg => {
                    if (arg !== undefined && typeof arg === "number") {
                        settings.height_radius = arg;
                    }
                }), {
                    min: 1,
                    max: ellipsoidBrushShape_MAX_RADIUS
                }), new server_editor_namespaceObject.SettingsUIElement("resourcePack.editor.brushShape.ellipsoid.settings.depth_radius", settings.depth_radius, (arg => {
                    if (arg !== undefined && typeof arg === "number") {
                        settings.depth_radius = arg;
                    }
                }), {
                    min: 1,
                    max: ellipsoidBrushShape_MAX_RADIUS
                }));
            }
            return uiElements;
        }));
    }
    const MAX_SIDE = 20;
    function registerPyramidBrushShape(uiSession) {
        const settings = {
            uniform: true,
            width: 8,
            height: 8,
            depth: 8,
            axis: ExtrudeAxis.YAxis
        };
        uiSession.extensionContext.brushShapeManager.registerBrushShape("resourcePack.editor.brushShape.pyramid.name", "pack://textures/editor/brushes/pyramid.png", (() => {
            const xSide = Math.ceil(settings.width / 2);
            const zSide = Math.ceil(settings.uniform ? settings.width / 2 : settings.depth / 2);
            const xs_of_y = midpointLine(settings.height, xSide);
            const zs_of_y = midpointLine(settings.height, zSide);
            const compoundBlockVolume = new server_namespaceObject.CompoundBlockVolume;
            for (let i = 0; i < xs_of_y.length; i++) {
                const y = xs_of_y.length - (i + 1);
                const x = xs_of_y[i];
                const z = zs_of_y[i];
                const start = flipToAxis({
                    x: -x,
                    y,
                    z: -z
                }, settings.axis);
                const end = flipToAxis({
                    x,
                    y,
                    z
                }, settings.axis);
                compoundBlockVolume.pushVolume({
                    action: server_namespaceObject.CompoundBlockVolumeAction.Add,
                    locationRelativity: server_namespaceObject.CompoundBlockVolumePositionRelativity.Relative,
                    volume: new server_namespaceObject.BlockVolume(start, end)
                });
            }
            return compoundBlockVolume;
        }), (() => {
            const uiElements = [ new server_editor_namespaceObject.SettingsUIElement("resourcePack.editor.brushShape.common.settings.uniform", settings.uniform, (arg => {
                if (arg !== undefined && typeof arg === "boolean") {
                    settings.uniform = arg;
                }
            }), {
                refreshOnChange: true
            }), new server_editor_namespaceObject.SettingsUIElement(settings.uniform ? "resourcePack.editor.brushShape.common.settings.length" : "resourcePack.editor.brushShape.pyramid.settings.width", settings.width, (arg => {
                if (arg !== undefined && typeof arg === "number") {
                    settings.width = arg;
                }
            }), {
                min: 1,
                max: MAX_SIDE
            }) ];
            if (!settings.uniform) {
                uiElements.push(new server_editor_namespaceObject.SettingsUIElement("resourcePack.editor.brushShape.pyramid.settings.depth", settings.depth, (arg => {
                    if (arg !== undefined && typeof arg === "number") {
                        settings.depth = arg;
                    }
                }), {
                    min: 1,
                    max: MAX_SIDE
                }));
            }
            uiElements.push(new server_editor_namespaceObject.SettingsUIElement("resourcePack.editor.brushShape.pyramid.settings.height", settings.height, (arg => {
                if (arg !== undefined && typeof arg === "number") {
                    settings.height = arg;
                }
            }), {
                min: 1,
                max: MAX_SIDE
            }), new server_editor_namespaceObject.SettingsUIElement("resourcePack.editor.brushShape.common.settings.axis", settings.axis, (arg => {
                if (arg !== undefined && typeof arg === "string") {
                    settings.axis = arg;
                }
            }), {
                dropdownItems: [ ExtrudeAxis.XAxis, ExtrudeAxis.XAxisNeg, ExtrudeAxis.YAxis, ExtrudeAxis.YAxisNeg, ExtrudeAxis.ZAxis, ExtrudeAxis.ZAxisNeg ]
            }));
            return uiElements;
        }));
    }
    function registerSinglePointBrushShape(uiSession) {
        uiSession.extensionContext.brushShapeManager.registerBrushShape("resourcePack.editor.brushShape.singleBlock.name", "pack://textures/editor/brushes/block.png", (() => {
            const compoundBlockVolume = new server_namespaceObject.CompoundBlockVolume;
            compoundBlockVolume.pushVolume({
                action: server_namespaceObject.CompoundBlockVolumeAction.Add,
                locationRelativity: server_namespaceObject.CompoundBlockVolumePositionRelativity.Relative,
                volume: new server_namespaceObject.BlockVolume({
                    x: 0,
                    y: 0,
                    z: 0
                }, {
                    x: 0,
                    y: 0,
                    z: 0
                })
            });
            return compoundBlockVolume;
        }), (() => []));
    }
    function registerCoreBrushShapes(session) {
        registerSinglePointBrushShape(session);
        registerConeBrushShape(session);
        registerCuboidBrushShape(session);
        registerCylinderBrushShape(session);
        registerEllipsoidBrushShape(session);
        registerPyramidBrushShape(session);
    }
    const RulerTool_mapMarkerEntityName = "editor:ruler_idle";
    const EMPTY_INFO = "---";
    var MeasuringMarkSelectionState;
    (function(MeasuringMarkSelectionState) {
        MeasuringMarkSelectionState[MeasuringMarkSelectionState["NotSelected"] = 0] = "NotSelected";
        MeasuringMarkSelectionState[MeasuringMarkSelectionState["StartPositionSelected"] = 1] = "StartPositionSelected";
        MeasuringMarkSelectionState[MeasuringMarkSelectionState["EndPositionSelected"] = 2] = "EndPositionSelected";
    })(MeasuringMarkSelectionState || (MeasuringMarkSelectionState = {}));
    var RulerTelemetry;
    (function(RulerTelemetry) {
        RulerTelemetry["StartPointSelected"] = "StartPointSelected";
        RulerTelemetry["EndPointSelected"] = "EndPointSelected";
        RulerTelemetry["Reset"] = "Reset";
    })(RulerTelemetry || (RulerTelemetry = {}));
    class Midpoint {
        constructor(start, end, group) {
            this._start = start;
            this._end = end;
            this._delta = lib.Vector3Utils.subtract(this._end.location, this._start.location);
            this._length = lib.Vector3Utils.magnitude(this._delta);
            this._location = lib.Vector3Utils.add(lib.Vector3Utils.scale(this._delta, .5), this._start.location);
            this._widget = group.createWidget(this._location, {
                selectable: true,
                snapToBlockLocation: false,
                visible: true,
                collisionRadius: 0
            });
            this._textComponent = this._widget.addTextComponent("length_text", `${this._length.toFixed(1)}`, {});
        }
        update() {
            this._delta = lib.Vector3Utils.subtract(this._end.location, this._start.location);
            this._length = lib.Vector3Utils.magnitude(this._delta);
            this._location = lib.Vector3Utils.add(lib.Vector3Utils.scale(this._delta, .5), this._start.location);
            this._textComponent.label = this._length.toFixed(1);
            this._widget.location = this._location;
        }
        destroy() {
            this._widget.delete();
        }
    }
    class MeasuringMark {
        constructor(other, position, widgetGroup, updater) {
            this._location = position;
            this._other = other;
            this._widget = widgetGroup.createWidget(position, {
                selectable: true,
                snapToBlockLocation: true,
                visible: true,
                collisionOffset: {
                    x: .5,
                    y: .5,
                    z: .5
                },
                collisionRadius: .5,
                stateChangeEvent: data => {
                    if (data.location !== undefined) {
                        this._location = data.location;
                        const textComponent = data.widget.getComponent("position_text");
                        if (textComponent) {
                            textComponent.label = lib.Vector3Utils.toString(data.location, {
                                decimals: 1
                            });
                        }
                        updater();
                    }
                }
            });
            this._widget.addEntityComponent("marker", RulerTool_mapMarkerEntityName, {
                isClickable: true,
                visible: true,
                offset: {
                    x: .5,
                    y: 0,
                    z: .5
                }
            });
            this._widget.addTextComponent("position_text", lib.Vector3Utils.toString(position, {
                decimals: 1
            }), {
                offset: {
                    x: 0,
                    y: 1,
                    z: 0
                },
                visible: true
            });
            this._widget.addGizmoComponent("position_gizmo", {
                offset: {
                    x: .5,
                    y: 0,
                    z: .5
                },
                visible: true
            });
            this._widget.addGuideComponent("position_guide");
            if (this._other) {
                const spline = this._widget.addSplineComponent("spline", {
                    splineType: server_editor_namespaceObject.SplineType.Line,
                    controlPoints: [],
                    offset: {
                        x: .5,
                        y: 0,
                        z: .5
                    }
                });
                const widgetList = [ this._other.widget ];
                spline.setControlPoints(widgetList);
            }
        }
        destroy() {
            this._widget.delete();
        }
        isLocation(location) {
            return lib.Vector3Utils.equals(this._location, location);
        }
        get widget() {
            return this._widget;
        }
        get location() {
            return this._location;
        }
    }
    class RulerToolBehavior {
        constructor(uiSession) {
            this.uiSession = uiSession;
            this._endPointSelectionState = MeasuringMarkSelectionState.NotSelected;
            this._selectionState = new SimpleStateSelector(MeasuringMarkSelectionState.NotSelected);
            this._infoText = (0, server_editor_namespaceObject.makeObservable)(EMPTY_INFO);
            uiSession.log.debug(`Initializing ${RulerToolBehavior.BEHAVIOR_NAME}`);
            this.telemetryManager = new TelemetryManager(uiSession.extensionContext.player, TelemetrySource.Ruler);
            this._widgetGroup = uiSession.extensionContext.widgetManager.createGroup({
                groupSelectionMode: server_editor_namespaceObject.WidgetGroupSelectionMode.Multiple,
                visible: true
            });
            this._cursorProperties = uiSession.extensionContext.cursor.getProperties();
            if (this._cursorProperties.fillColor) {
                delete this._cursorProperties.fillColor;
            }
            this._cursorProperties.outlineColor = {
                red: 0,
                green: 1,
                blue: 0,
                alpha: 1
            };
            this._cursorProperties.controlMode = server_editor_namespaceObject.CursorControlMode.KeyboardAndMouse;
            this._cursorProperties.targetMode = server_editor_namespaceObject.CursorTargetMode.Face;
            this._cursorProperties.visible = true;
            this._statusBarItem = uiSession.statusBar.createItem({
                alignment: server_editor_namespaceObject.StatusBarAlignment.Left,
                size: 80
            });
            this._tool = this.addTool(uiSession);
            this._tool.onModalToolActivation.subscribe((eventData => {
                if (eventData.isActiveTool) {
                    this._backedUpColors = backupColors(uiSession.extensionContext);
                    uiSession.extensionContext.cursor.setProperties(this._cursorProperties);
                } else {
                    this._startPoint?.destroy();
                    this._endPoint?.destroy();
                    this._midPoint?.destroy();
                    this._statusBarItem.setText("");
                    this._startPoint = undefined;
                    this._endPoint = undefined;
                    this._midPoint = undefined;
                    this._endPointSelectionState = MeasuringMarkSelectionState.NotSelected;
                    this._selectionState.resetState(this._endPointSelectionState);
                    if (this._backedUpColors) {
                        restoreBackedUpColors(uiSession.extensionContext, this._backedUpColors);
                        this._backedUpColors = undefined;
                    }
                }
            }));
            const pane = this.uiSession.createPropertyPane({
                title: "resourcePack.editor.toolRail.rulerTool.title",
                infoTooltip: {
                    description: [ "resourcePack.editor.toolRail.rulerTool.tooltip", {
                        link: "https://aka.ms/BedrockEditorRulerTool",
                        text: "resourcePack.editor.help.learnMore"
                    } ]
                }
            });
            pane.addText(this._infoText, {
                title: "resourcePack.editor.toolRail.rulerTool.info.title"
            });
            this._tool.bindPropertyPane(pane);
        }
        teardown() {
            this.uiSession.log.debug(`Shutting down ${RulerToolBehavior.BEHAVIOR_NAME}`);
            this._startPoint?.destroy();
            this._endPoint?.destroy();
            this._midPoint?.destroy();
            this.uiSession.extensionContext.widgetManager.deleteGroup(this._widgetGroup);
            this._statusBarItem.setText("");
        }
        addTool(uiSession) {
            const tool = uiSession.toolRail.addTool("editor:modalTool:ruler", {
                title: "resourcePack.editor.toolRail.rulerTool.title",
                icon: "pack://textures/editor/ruler-tool.png?filtering=point",
                tooltip: "resourcePack.editor.toolRail.rulerTool.tooltip"
            });
            const executeAction = uiSession.actionManager.createAction({
                actionType: server_editor_namespaceObject.ActionTypes.MouseRayCastAction,
                onExecute: (mouseRay, mouseProps) => {
                    if (mouseProps.mouseAction === server_editor_namespaceObject.MouseActionType.LeftButton && mouseProps.inputType === server_editor_namespaceObject.MouseInputType.ButtonUp && uiSession.toolRail.getSelectedToolId() === this._tool.id && mouseRay?.cursorBlockLocation) {
                        const targetLocation = mouseRay.cursorBlockLocation;
                        if (this._startPoint?.isLocation(targetLocation) || this._endPoint?.isLocation(targetLocation)) {
                            return;
                        }
                        this.selectNextState(uiSession, targetLocation, mouseProps.modifiers);
                    }
                }
            });
            tool.registerMouseButtonBinding(executeAction);
            return tool;
        }
        updateInfoText() {
            let text = "";
            if (this._startPoint) {
                text += `S(${lib.Vector3Utils.toString(this._startPoint.location, {
                    decimals: 1
                })})`;
                if (this._endPoint) {
                    text += ` -> E(${lib.Vector3Utils.toString(this._endPoint.location, {
                        decimals: 1
                    })})`;
                    const delta = lib.Vector3Utils.subtract(this._endPoint.location, this._startPoint.location);
                    text += ` D(${lib.Vector3Utils.toString(delta, {
                        decimals: 1
                    })})`;
                    const length = lib.Vector3Utils.magnitude(delta);
                    text += ` L:${length.toFixed(1)}`;
                }
            }
            this._statusBarItem.setText(text);
            this._infoText.set(text ? text : EMPTY_INFO);
        }
        selectNextState(uiSession, targetLocation, mouseModifiers) {
            const noModifiers = !mouseModifiers.alt && !mouseModifiers.ctrl && !mouseModifiers.shift;
            if (this._selectionState.changeState(MeasuringMarkSelectionState.StartPositionSelected, (() => {
                this.telemetryManager.fireTelemetryEvent(RulerTelemetry.StartPointSelected);
                this._startPoint = new MeasuringMark(undefined, targetLocation, this._widgetGroup, (() => {
                    this.updateInfoText();
                    this._midPoint?.update();
                }));
                this.updateInfoText();
            }), MeasuringMarkSelectionState.NotSelected, noModifiers)) {
                return;
            }
            if (this._selectionState.changeState(MeasuringMarkSelectionState.EndPositionSelected, (() => {
                if (!this._startPoint) {
                    return;
                }
                this.telemetryManager.fireTelemetryEvent(RulerTelemetry.EndPointSelected);
                this._endPoint = new MeasuringMark(this._startPoint, targetLocation, this._widgetGroup, (() => {
                    this.updateInfoText();
                    this._midPoint?.update();
                }));
                this.updateInfoText();
                this._midPoint = new Midpoint(this._startPoint, this._endPoint, this._widgetGroup);
            }), MeasuringMarkSelectionState.StartPositionSelected, noModifiers)) {
                return;
            }
            if (this._selectionState.changeState(MeasuringMarkSelectionState.NotSelected, (() => {
                this.telemetryManager.fireTelemetryEvent(RulerTelemetry.Reset);
                this._startPoint?.destroy();
                this._endPoint?.destroy();
                this._midPoint?.destroy();
                this._startPoint = undefined;
                this._endPoint = undefined;
                this._midPoint = undefined;
                this.updateInfoText();
            }), MeasuringMarkSelectionState.EndPositionSelected, noModifiers)) {
                return;
            }
        }
    }
    RulerToolBehavior.BEHAVIOR_NAME = "Ruler Tool";
    const gameModeLookUpIndex = {
        survival: 0,
        creative: 1,
        adventure: 2,
        spectator: 6
    };
    const ExportProject_validGameModes = [ server_namespaceObject.GameMode.survival, server_namespaceObject.GameMode.creative, server_namespaceObject.GameMode.adventure ];
    const validPlayerAccess = [ server_editor_namespaceObject.GamePublishSetting.InviteOnly, server_editor_namespaceObject.GamePublishSetting.FriendsOnly, server_editor_namespaceObject.GamePublishSetting.FriendsOfFriends ];
    const validPlayerPermissionLevels = [ server_editor_namespaceObject.PlayerPermissionLevel.Visitor, server_editor_namespaceObject.PlayerPermissionLevel.Member, server_editor_namespaceObject.PlayerPermissionLevel.Operator, server_editor_namespaceObject.PlayerPermissionLevel.Custom ];
    const ExportProject_validDaylightCycle = [ server_editor_namespaceObject.DaylightCycle.Normal, server_editor_namespaceObject.DaylightCycle.AlwaysDay, server_editor_namespaceObject.DaylightCycle.LockTime ];
    class ExportBehavior {
        constructor(uiSession, parentMenu) {
            this._uiSession = uiSession;
            this._cheatOptionsList = [];
            this._multiplayerOptionsList = [];
            this._paneDataOptionsList = [];
            this._gameOptions = this._uiSession.extensionContext.exportManager.getGameOptions();
            this._defaultGameOptions = this._uiSession.extensionContext.exportManager.getGameOptions(true);
            const hardcore = this._gameOptions.hardcore;
            this._currentGameModeDropdownItems = this.getGameModeDropdownItems(hardcore);
            this._currentDifficultyDropDownItems = this.getDifficultyDropdownItems(hardcore);
            this._lastDifficulty = this._currentDifficultyDropDownItems[!hardcore ? this._gameOptions.difficulty : 0].value;
            this._lastGameModeIndex = gameModeLookUpIndex[this._gameOptions.gameMode];
            this._lastStartingMap = this._gameOptions.startingMap;
            this._lastBonusChest = this._gameOptions.bonusChest;
            this._lastCheatsEnabled = this._gameOptions.cheats;
            this._exportPane = this.buildPropertyPane(uiSession);
            this.createMenuItem(parentMenu);
        }
        createMenuItem(menu) {
            menu.addItem({
                label: "resourcePack.editor.menuBar.file.export"
            }, this._uiSession?.actionManager.createAction({
                actionType: server_editor_namespaceObject.ActionTypes.NoArgsAction,
                onExecute: () => {
                    if (this._exportPane) {
                        this._exportPane?.show();
                    }
                }
            }));
        }
        buildPropertyPane(uiSession) {
            const exportPane = uiSession.createPropertyPane({
                title: `resourcePack.editor.menuBar.file.export`
            });
            const paneData = (0, server_editor_namespaceObject.bindDataSource)(exportPane, Object.assign({}, this._gameOptions, {
                gameModeIndex: gameModeLookUpIndex[this._gameOptions.gameMode]
            }));
            const exportTypePropItem = exportPane.addDropdown_deprecated(paneData, `exportType`, {
                title: `resourcePack.editor.exportProject.exportType`,
                dropdownItems: [ {
                    label: "resourcePack.editor.exportProject.exportType.playableWorld",
                    value: 0
                } ],
                onChange: (_obj, _property, _oldValue, newValue) => {
                    this.setOption(this._gameOptions, "exportType", newValue);
                }
            });
            this._paneDataOptionsList?.push(exportTypePropItem);
            const versionNumber = this._uiSession?.extensionContext.exportManager.getGameVersion();
            if (versionNumber) {
                const warningPane = exportPane.createSubPane({
                    title: `resourcePack.editor.exportProject.exportNotes`
                });
                warningPane.addText({
                    id: "resourcePack.editor.exportProject.exportNotes.warning",
                    props: [ `${versionNumber}` ]
                });
            }
            exportPane.addDivider();
            const generalSettingsPane = exportPane.createSubPane({
                title: `resourcePack.editor.exportProject.generalSettings`
            });
            generalSettingsPane.collapse();
            const worldNamePropItem = generalSettingsPane.addString_deprecated(paneData, "worldName", {
                title: `resourcePack.editor.exportProject.generalSettings.worldName`,
                onChange: (_obj, _property, _oldValue, newValue) => {
                    this.setOption(this._gameOptions, "worldName", newValue);
                }
            });
            this._paneDataOptionsList?.push(worldNamePropItem);
            const gameModePropItem = generalSettingsPane.addDropdown_deprecated(paneData, `gameModeIndex`, {
                title: "resourcePack.editor.exportProject.generalSettings.gameMode",
                dropdownItems: this._currentGameModeDropdownItems,
                onChange: (_obj, _property, _oldValue, newValue) => {
                    const newValueIndex = newValue;
                    paneData.gameMode = ExportProject_validGameModes[newValueIndex];
                    this.setOption(this._gameOptions, "gameMode", paneData.gameMode);
                }
            });
            this._paneDataOptionsList?.push(gameModePropItem);
            const difficultyPropItem = generalSettingsPane.addDropdown_deprecated(paneData, "difficulty", {
                title: "resourcePack.editor.exportProject.generalSettings.difficulty",
                dropdownItems: this._currentDifficultyDropDownItems,
                onChange: (_obj, _property, _oldValue, newValue) => {
                    this.setOption(this._gameOptions, "difficulty", newValue);
                }
            });
            this._paneDataOptionsList?.push(difficultyPropItem);
            const hardcorePropItem = generalSettingsPane.addBool_deprecated(paneData, `hardcore`, {
                title: "resourcePack.editor.exportProject.generalSettings.hardcore",
                onChange: (_obj, _property, _oldValue, newValue) => {
                    const hardcoreProp = newValue;
                    this.setOption(this._gameOptions, "hardcore", hardcoreProp);
                    this._currentGameModeDropdownItems = this.getGameModeDropdownItems(hardcoreProp);
                    this._currentDifficultyDropDownItems = this.getDifficultyDropdownItems(hardcoreProp);
                    if (hardcoreProp) {
                        this._lastDifficulty = paneData.difficulty;
                        this._lastGameModeIndex = paneData.gameModeIndex;
                        this._lastBonusChest = paneData.bonusChest;
                        this._lastStartingMap = paneData.startingMap;
                        this._lastCheatsEnabled = paneData.cheats;
                        this.setOption(paneData, `startingMap`, this._defaultGameOptions.startingMap);
                        this.setOption(paneData, `bonusChest`, this._defaultGameOptions.bonusChest);
                        this.setOption(paneData, `cheats`, this._defaultGameOptions.cheats);
                        this.setLastCheatValues();
                        this.setToDefaultCheatOptions(paneData.cheats, paneData);
                    } else {
                        this.setOption(paneData, `startingMap`, this._lastStartingMap);
                        this.setOption(paneData, `bonusChest`, this._lastBonusChest);
                        this.setOption(paneData, `cheats`, this._lastCheatsEnabled);
                        this.setCheatsToLastValues(paneData, paneData.cheats);
                    }
                    gameModePropItem.updateDropdownItems(this._currentGameModeDropdownItems, this._currentGameModeDropdownItems[hardcoreProp ? 0 : this._lastGameModeIndex].value);
                    difficultyPropItem.updateDropdownItems(this._currentDifficultyDropDownItems, this._currentDifficultyDropDownItems[hardcoreProp ? 0 : this._lastDifficulty].value);
                    this.setOption(paneData, `difficulty`, this._currentDifficultyDropDownItems[hardcoreProp ? 0 : this._lastDifficulty].value);
                    this.setOption(this._gameOptions, `difficulty`, paneData.difficulty);
                    this.setOption(this._gameOptions, `startingMap`, paneData.startingMap);
                    this.setOption(this._gameOptions, `bonusChest`, paneData.bonusChest);
                    this.setOption(this._gameOptions, `cheats`, paneData.cheats);
                    startingMapPropItem.enable = !hardcoreProp;
                    bonusChestPropItem.enable = !hardcoreProp;
                    cheatsPropItem.enable = !hardcoreProp;
                }
            });
            this._paneDataOptionsList?.push(hardcorePropItem);
            const advancedSettingsPane = exportPane.createSubPane({
                title: `resourcePack.editor.exportProject.advancedSettings`
            });
            advancedSettingsPane.collapse();
            const startingMapPropItem = advancedSettingsPane.addBool_deprecated(paneData, `startingMap`, {
                title: "resourcePack.editor.exportProject.advancedSettings.startingMap",
                onChange: (_obj, _property, _oldValue, newValue) => {
                    this.setOption(this._gameOptions, "startingMap", newValue);
                }
            });
            this._paneDataOptionsList?.push(startingMapPropItem);
            const bonusChestPropItem = advancedSettingsPane.addBool_deprecated(paneData, `bonusChest`, {
                title: "resourcePack.editor.exportProject.advancedSettings.bonusChest",
                onChange: (_obj, _property, _oldValue, newValue) => {
                    this.setOption(this._gameOptions, "bonusChest", newValue);
                }
            });
            this._paneDataOptionsList?.push(bonusChestPropItem);
            const showCoordinatesPropItem = advancedSettingsPane.addBool_deprecated(paneData, `showCoordinates`, {
                title: "resourcePack.editor.exportProject.advancedSettings.showCoordinates",
                onChange: (_obj, _property, _oldValue, newValue) => {
                    this.setOption(this._gameOptions, "showCoordinates", newValue);
                }
            });
            this._paneDataOptionsList?.push(showCoordinatesPropItem);
            const showDaysPlayedPropItem = advancedSettingsPane.addBool_deprecated(paneData, `showDaysPlayed`, {
                title: "resourcePack.editor.exportProject.advancedSettings.showDaysPlayed",
                onChange: (_obj, _property, _oldValue, newValue) => {
                    this.setOption(this._gameOptions, "showDaysPlayed", newValue);
                }
            });
            this._paneDataOptionsList?.push(showDaysPlayedPropItem);
            const recipeUnlocking = advancedSettingsPane.addBool_deprecated(paneData, `recipeUnlocking`, {
                title: "resourcePack.editor.exportProject.advancedSettings.recipeUnlocking",
                onChange: (_obj, _property, _oldValue, newValue) => {
                    this.setOption(this._gameOptions, "recipeUnlocking", newValue);
                }
            });
            this._paneDataOptionsList?.push(recipeUnlocking);
            const fireSpreads = advancedSettingsPane.addBool_deprecated(paneData, `fireSpreads`, {
                title: "resourcePack.editor.exportProject.advancedSettings.fireSpreads",
                onChange: (_obj, _property, _oldValue, newValue) => {
                    this.setOption(this._gameOptions, "fireSpreads", newValue);
                }
            });
            this._paneDataOptionsList?.push(fireSpreads);
            const tntExplodesPropItem = advancedSettingsPane.addBool_deprecated(paneData, `tntExplodes`, {
                title: "resourcePack.editor.exportProject.advancedSettings.tntExplodes",
                onChange: (_obj, _property, _oldValue, newValue) => {
                    this.setOption(this._gameOptions, "tntExplodes", newValue);
                }
            });
            this._paneDataOptionsList?.push(tntExplodesPropItem);
            const respawnBlocksExplodePropItem = advancedSettingsPane.addBool_deprecated(paneData, `respawnBlocksExplode`, {
                title: "resourcePack.editor.exportProject.advancedSettings.resawnBlocksExplode",
                onChange: (_obj, _property, _oldValue, newValue) => {
                    this.setOption(this._gameOptions, "respawnBlocksExplode", newValue);
                }
            });
            this._paneDataOptionsList?.push(respawnBlocksExplodePropItem);
            const mobLootPropItem = advancedSettingsPane.addBool_deprecated(paneData, `mobLoot`, {
                title: "resourcePack.editor.exportProject.advancedSettings.mobLoot",
                onChange: (_obj, _property, _oldValue, newValue) => {
                    this.setOption(this._gameOptions, "mobLoot", newValue);
                }
            });
            this._paneDataOptionsList?.push(mobLootPropItem);
            const naturalRegenerationPropItem = advancedSettingsPane.addBool_deprecated(paneData, `naturalRegeneration`, {
                title: "resourcePack.editor.exportProject.advancedSettings.naturalRegeneration",
                onChange: (_obj, _property, _oldValue, newValue) => {
                    this.setOption(this._gameOptions, "naturalRegeneration", newValue);
                }
            });
            this._paneDataOptionsList?.push(naturalRegenerationPropItem);
            const tileDropsPropItem = advancedSettingsPane.addBool_deprecated(paneData, `tileDrops`, {
                title: "resourcePack.editor.exportProject.advancedSettings.tileDrops",
                onChange: (_obj, _property, _oldValue, newValue) => {
                    this.setOption(this._gameOptions, "tileDrops", newValue);
                }
            });
            this._paneDataOptionsList?.push(tileDropsPropItem);
            const immediateRespawnPropItem = advancedSettingsPane.addBool_deprecated(paneData, `immediateRespawn`, {
                title: "resourcePack.editor.exportProject.advancedSettings.immediateRespawn",
                onChange: (_obj, _property, _oldValue, newValue) => {
                    this.setOption(this._gameOptions, "immediateRespawn", newValue);
                }
            });
            this._paneDataOptionsList?.push(immediateRespawnPropItem);
            const respawnRadiusPropItem = advancedSettingsPane.addNumber_deprecated(paneData, `respawnRadius`, {
                title: `resourcePack.editor.exportProject.advancedSettings.respawnRadius`,
                min: 0,
                max: 128,
                onChange: (_obj, _property, _oldValue, newValue) => {
                    this.setOption(this._gameOptions, `respawnRadius`, newValue);
                }
            });
            this._paneDataOptionsList?.push(respawnRadiusPropItem);
            const simulationDistancePropItem = advancedSettingsPane.addNumber_deprecated(paneData, `simulationDistance`, {
                title: `resourcePack.editor.exportProject.advancedSettings.simulationDistance`,
                min: 4,
                max: 12,
                onChange: (_obj, _property, _oldValue, newValue) => {
                    this.setOption(this._gameOptions, `simulationDistance`, newValue);
                }
            });
            this._paneDataOptionsList?.push(simulationDistancePropItem);
            const multiplayerSettingsPane = exportPane.createSubPane({
                title: `resourcePack.editor.exportProject.multiplayerSettings`
            });
            multiplayerSettingsPane.collapse();
            const multiplayerGamePropItem = multiplayerSettingsPane.addBool_deprecated(paneData, `multiplayerGame`, {
                title: "resourcePack.editor.exportProject.multiplayerSettings.multiplayerGame",
                onChange: (_obj, _property, _oldValue, newValue) => {
                    this.setOption(this._gameOptions, "multiplayerGame", newValue);
                    this.setMultiplayerOptionsEnableState(newValue);
                }
            });
            this._paneDataOptionsList?.push(multiplayerGamePropItem);
            const playerAccessItems = validPlayerAccess.map(((v, i) => {
                const enumKey = getEnumKeyByEnumValue(server_editor_namespaceObject.GamePublishSetting, v);
                const enumName = this.capitalizeAndSpaceEnumName(enumKey);
                const item = {
                    label: enumName,
                    value: i
                };
                return item;
            }));
            const playerAccessPropItem = multiplayerSettingsPane.addDropdown_deprecated(paneData, `playerAccess`, {
                title: "resourcePack.editor.exportProject.multiplayerSettings.playerAccess",
                dropdownItems: playerAccessItems,
                onChange: (_obj, _property, _oldValue, newValue) => {
                    this.setOption(this._gameOptions, "playerAccess", newValue);
                }
            });
            this._paneDataOptionsList?.push(playerAccessPropItem);
            this._multiplayerOptionsList?.push(playerAccessPropItem);
            const playerPermissionLevelItems = validPlayerPermissionLevels.map(((v, i) => {
                const item = {
                    label: getEnumKeyByEnumValue(server_editor_namespaceObject.PlayerPermissionLevel, v),
                    value: i
                };
                return item;
            }));
            const playerPermissionsPropItem = multiplayerSettingsPane.addDropdown_deprecated(paneData, `playerPermissions`, {
                title: "resourcePack.editor.exportProject.multiplayerSettings.playerPermissions",
                dropdownItems: playerPermissionLevelItems,
                onChange: (_obj, _property, _oldValue, newValue) => {
                    this.setOption(this._gameOptions, "playerAccess", newValue);
                }
            });
            this._paneDataOptionsList?.push(playerPermissionsPropItem);
            this._multiplayerOptionsList?.push(playerPermissionsPropItem);
            const lanVisibilityPropItem = multiplayerSettingsPane.addBool_deprecated(paneData, `lanVisibility`, {
                title: "resourcePack.editor.exportProject.multiplayerSettings.visibleToLAN",
                onChange: (_obj, _property, _oldValue, newValue) => {
                    this.setOption(this._gameOptions, "lanVisibility", newValue);
                }
            });
            this._paneDataOptionsList?.push(lanVisibilityPropItem);
            this._multiplayerOptionsList?.push(lanVisibilityPropItem);
            const friendlyFirePropItem = multiplayerSettingsPane.addBool_deprecated(paneData, `friendlyFire`, {
                title: "resourcePack.editor.exportProject.multiplayerSettings.friendlyFire",
                onChange: (_obj, _property, _oldValue, newValue) => {
                    this.setOption(this._gameOptions, "friendlyFire", newValue);
                }
            });
            this._paneDataOptionsList?.push(friendlyFirePropItem);
            this._multiplayerOptionsList?.push(friendlyFirePropItem);
            this.setMultiplayerOptionsEnableState(paneData.multiplayerGame);
            const cheatsSettingsPane = exportPane.createSubPane({
                title: `resourcePack.editor.exportProject.cheatsSettings`
            });
            cheatsSettingsPane.collapse();
            const cheatsPropItem = cheatsSettingsPane.addBool_deprecated(paneData, `cheats`, {
                title: `resourcePack.editor.exportProject.cheatsSettings.cheats`,
                onChange: (_obj, _property, _oldValue, newValue) => {
                    this.setOption(this._gameOptions, `cheats`, newValue);
                    if (this._gameOptions.cheats !== undefined) {
                        this.setToDefaultCheatOptions(this._gameOptions.cheats, paneData);
                    }
                }
            });
            this._paneDataOptionsList?.push(cheatsPropItem);
            const daylightCycleItems = ExportProject_validDaylightCycle.map(((v, i) => {
                const enumKey = getEnumKeyByEnumValue(server_editor_namespaceObject.DaylightCycle, v);
                const enumName = this.capitalizeAndSpaceEnumName(enumKey);
                const item = {
                    label: enumName,
                    value: i
                };
                return item;
            }));
            const daylightCyclePropItem = cheatsSettingsPane.addDropdown_deprecated(paneData, "daylightCycle", {
                title: `resourcePack.editor.exportProject.cheatsSettings.daylightCycle`,
                enable: cheatsPropItem.value,
                dropdownItems: daylightCycleItems,
                onChange: (_obj, _property, _oldValue, newValue) => {
                    this.setOption(this._gameOptions, `daylightCycle`, newValue);
                }
            });
            this._cheatOptionsList?.push(daylightCyclePropItem);
            const keepInventoryPropItem = cheatsSettingsPane.addBool_deprecated(paneData, `keepInventory`, {
                title: `resourcePack.editor.exportProject.cheatsSettings.keepInventory`,
                enable: cheatsPropItem.value,
                onChange: (_obj, _property, _oldValue, newValue) => {
                    this.setOption(this._gameOptions, `keepInventory`, newValue);
                }
            });
            this._cheatOptionsList?.push(keepInventoryPropItem);
            const mobSpawningPropItem = cheatsSettingsPane.addBool_deprecated(paneData, `mobSpawning`, {
                title: `resourcePack.editor.exportProject.cheatsSettings.mobSpawning`,
                enable: cheatsPropItem.value,
                onChange: (_obj, _property, _oldValue, newValue) => {
                    this.setOption(this._gameOptions, `mobSpawning`, newValue);
                }
            });
            this._cheatOptionsList?.push(mobSpawningPropItem);
            const mobGriefingPropItem = cheatsSettingsPane.addBool_deprecated(paneData, `mobGriefing`, {
                title: `resourcePack.editor.exportProject.cheatsSettings.mobGriefing`,
                enable: cheatsPropItem.value,
                onChange: (_obj, _property, _oldValue, newValue) => {
                    this.setOption(this._gameOptions, `mobGriefing`, newValue);
                }
            });
            this._cheatOptionsList?.push(mobGriefingPropItem);
            const entitiesDropLootPropItem = cheatsSettingsPane.addBool_deprecated(paneData, `entitiesDropLoot`, {
                title: `resourcePack.editor.exportProject.cheatsSettings.entitiesDropLoot`,
                enable: cheatsPropItem.value,
                onChange: (_obj, _property, _oldValue, newValue) => {
                    this.setOption(this._gameOptions, `entitiesDropLoot`, newValue);
                }
            });
            this._cheatOptionsList?.push(entitiesDropLootPropItem);
            const disableWeatherPropItem = cheatsSettingsPane.addBool_deprecated(paneData, `disableWeather`, {
                title: `resourcePack.editor.exportProject.cheatsSettings.weatherCycle`,
                enable: cheatsPropItem.value,
                onChange: (_obj, _property, _oldValue, newValue) => {
                    this.setOption(this._gameOptions, `disableWeather`, newValue);
                }
            });
            this._cheatOptionsList?.push(disableWeatherPropItem);
            const commandBlockEnabledPropItem = cheatsSettingsPane.addBool_deprecated(paneData, `commandBlockEnabled`, {
                title: `resourcePack.editor.exportProject.cheatsSettings.commandBlocks`,
                enable: cheatsPropItem.value,
                onChange: (_obj, _property, _oldValue, newValue) => {
                    this.setOption(this._gameOptions, `commandBlockEnabled`, newValue);
                }
            });
            this._cheatOptionsList?.push(commandBlockEnabledPropItem);
            cheatsSettingsPane.addBool_deprecated(paneData, `educationEdition`, {
                title: "resourcePack.editor.exportProject.cheatsSettings.educationFeatures",
                enable: false
            });
            const randomTickSpeedPropItem = cheatsSettingsPane.addNumber_deprecated(paneData, `randomTickSpeed`, {
                title: `resourcePack.editor.exportProject.cheatsSettings.randomTickSpeed`,
                enable: cheatsPropItem.value,
                min: 0,
                max: 4096,
                onChange: (_obj, _property, _oldValue, newValue) => {
                    this.setOption(this._gameOptions, `randomTickSpeed`, newValue);
                }
            });
            this._cheatOptionsList?.push(randomTickSpeedPropItem);
            exportPane.addDivider();
            exportPane.addButton(uiSession?.actionManager.createAction({
                actionType: server_editor_namespaceObject.ActionTypes.NoArgsAction,
                onExecute: async () => {
                    await this.tryExport();
                    fireTelemetryEvent(uiSession.extensionContext.player, TelemetrySource.Export, "ExportButton", {
                        settings: this._gameOptions
                    });
                }
            }), {
                title: `resourcePack.editor.exportProject.export`
            });
            exportPane.addButton(uiSession?.actionManager.createAction({
                actionType: server_editor_namespaceObject.ActionTypes.NoArgsAction,
                onExecute: () => {
                    this.setToDefaultGameOptions(paneData);
                    fireTelemetryEvent(uiSession.extensionContext.player, TelemetrySource.Export, "ResetButton");
                }
            }), {
                title: `resourcePack.editor.exportProject.resetToDefault`
            });
            exportPane.hide();
            return exportPane;
        }
        async tryExport() {
            if (!this._uiSession?.extensionContext.exportManager.canExportProject()) {
                return;
            }
            try {
                const exportResult = await this._uiSession.extensionContext.exportManager.beginExportProject(this._gameOptions);
                this._uiSession?.log.info(`Project Export ending with result: ${this.capitalizeAndSpaceEnumName(getEnumKeyByEnumValue(server_editor_namespaceObject.ExportResult, exportResult))}`);
            } catch (error) {
                this._uiSession.log.error(`Export error : ${error}`);
            }
        }
        setOption(_object, propName, newValue) {
            _object[propName] = newValue;
        }
        setMultiplayerOptionsEnableState(isMultiplayerOptionEnabled) {
            this._multiplayerOptionsList?.forEach((propItem => {
                propItem.enable = isMultiplayerOptionEnabled;
            }));
        }
        setToDefaultCheatOptions(isCheatsOptionEnabled, paneData) {
            if (isCheatsOptionEnabled) {
                this._cheatOptionsList?.forEach((propItem => {
                    propItem.enable = true;
                }));
            } else {
                const defaultGameOptions = this._defaultGameOptions;
                this._cheatOptionsList?.forEach((propItem => {
                    if (defaultGameOptions !== undefined) {
                        this.setOption(paneData, propItem.property, defaultGameOptions[propItem.property]);
                        this.setOption(this._gameOptions, propItem.property, defaultGameOptions[propItem.property]);
                    }
                    propItem.enable = false;
                }));
            }
        }
        setToDefaultGameOptions(paneData) {
            const defaultGameOptions = Object.assign({}, this._defaultGameOptions, {
                gameModeIndex: gameModeLookUpIndex[this._defaultGameOptions.gameMode]
            });
            this._paneDataOptionsList?.forEach((propItem => {
                if (defaultGameOptions !== undefined) {
                    this.setOption(paneData, propItem.property, defaultGameOptions[propItem.property]);
                    this.setOption(this._gameOptions, propItem.property, defaultGameOptions[propItem.property]);
                }
            }));
            this.setToDefaultCheatOptions(paneData.cheats, paneData);
        }
        capitalizeAndSpaceEnumName(currentString) {
            if (!currentString) {
                return "";
            }
            const isUpperCase = char => char === char.toUpperCase() && char !== char.toLowerCase();
            let result = currentString.charAt(0).toUpperCase();
            for (let i = 1; i < currentString.length; i++) {
                if (isUpperCase(currentString.charAt(i))) {
                    result = result + " ";
                }
                result += currentString.charAt(i).toLowerCase();
            }
            return result;
        }
        getGameModeDropdownItems(hardcore) {
            const gameModeDropDownItems = [ {
                label: "resourcePack.editor.exportProject.gameMode.survival",
                value: gameModeLookUpIndex[server_namespaceObject.GameMode.survival]
            }, {
                label: "resourcePack.editor.exportProject.gameMode.creative",
                value: gameModeLookUpIndex[server_namespaceObject.GameMode.creative]
            }, {
                label: "resourcePack.editor.exportProject.gameMode.adventure",
                value: gameModeLookUpIndex[server_namespaceObject.GameMode.adventure]
            } ];
            const hardCoreGameModeItems = gameModeDropDownItems.filter((dropDownItem => dropDownItem.label !== "resourcePack.editor.exportProject.gameMode.creative"));
            return !hardcore ? gameModeDropDownItems : hardCoreGameModeItems;
        }
        getDifficultyDropdownItems(hardcore) {
            const validDifficulties = [ server_namespaceObject.Difficulty.Peaceful, server_namespaceObject.Difficulty.Easy, server_namespaceObject.Difficulty.Normal, server_namespaceObject.Difficulty.Hard ];
            const localizationDictionary = {
                [server_namespaceObject.Difficulty.Peaceful]: "resourcePack.editor.exportProject.difficulty.peaceful",
                [server_namespaceObject.Difficulty.Easy]: "resourcePack.editor.exportProject.difficulty.easy",
                [server_namespaceObject.Difficulty.Normal]: "resourcePack.editor.exportProject.difficulty.normal",
                [server_namespaceObject.Difficulty.Hard]: "resourcePack.editor.exportProject.difficulty.hard"
            };
            const difficultyItems = validDifficulties.map(((v, i) => {
                const item = {
                    label: localizationDictionary[v],
                    value: i
                };
                return item;
            }));
            const hardcoreDifficultyItem = {
                label: localizationDictionary[server_namespaceObject.Difficulty.Hard],
                value: server_namespaceObject.Difficulty.Hard
            };
            return hardcore ? [ hardcoreDifficultyItem ] : difficultyItems;
        }
        setLastCheatValues() {
            if (!this._lastCheatsValues) {
                this._lastCheatsValues = {};
            }
            this._cheatOptionsList?.forEach((propItem => {
                if (this._lastCheatsValues) {
                    this._lastCheatsValues[propItem.property] = propItem.value;
                }
            }));
        }
        setCheatsToLastValues(paneData, cheatsEnabled) {
            if (this._lastCheatsValues) {
                this._cheatOptionsList?.forEach((propItem => {
                    if (this._lastCheatsValues) {
                        this.setOption(paneData, propItem.property, this._lastCheatsValues[propItem.property]);
                        propItem.enable = cheatsEnabled;
                    }
                }));
            }
        }
        teardown() {}
    }
    var BrushTelemetry;
    (function(BrushTelemetry) {
        BrushTelemetry["StartPaining"] = "StartPaining";
        BrushTelemetry["EndPainting"] = "EndPainting";
    })(BrushTelemetry || (BrushTelemetry = {}));
    class BrushPainterBehavior {
        get session() {
            return this._session;
        }
        get tool() {
            return this._tool;
        }
        get rootPane() {
            return this._rootPane;
        }
        constructor(_session) {
            this._session = _session;
            this.telemetryManager = new TelemetryManager(_session.extensionContext.player, TelemetrySource.Brush);
            this._cursorProperties = {
                outlineColor: {
                    red: 0,
                    green: .5,
                    blue: .5,
                    alpha: .2
                },
                controlMode: server_editor_namespaceObject.CursorControlMode.KeyboardAndMouse,
                targetMode: server_editor_namespaceObject.CursorTargetMode.Block,
                visible: true
            };
            const activationAction = this.session.actionManager.createAction({
                actionType: server_editor_namespaceObject.ActionTypes.NoArgsAction,
                onExecute: () => {
                    this.session.toolRail.setSelectedToolId(this.tool.id);
                }
            });
            this._tool = this.session.toolRail.addTool("editor:modalTool:brushPainter", {
                title: "resourcePack.editor.brushPaint.title",
                icon: "pack://textures/editor/Brush.png?filtering=point",
                tooltip: "resourcePack.editor.brushPaint.tooltip",
                action: activationAction
            });
            this.session.inputManager.registerKeyBinding(server_editor_namespaceObject.EditorInputContext.GlobalToolMode, activationAction, {
                key: server_editor_namespaceObject.KeyboardKey.KEY_B,
                modifier: server_editor_namespaceObject.InputModifier.Control
            }, {
                uniqueId: "editor:toolModeKeyBinding:toggleBrushMode",
                label: "resourcePack.editor.brushPaint.inputContext.activateBrushPaint"
            });
            this._rootPane = this.session.createPropertyPane({
                title: "resourcePack.editor.brushPaint.title",
                infoTooltip: {
                    description: [ "resourcePack.editor.brushPaint.tooltip", {
                        link: "https://aka.ms/BedrockEditorBrush",
                        text: "resourcePack.editor.help.learnMore"
                    } ]
                }
            });
            this.tool.bindPropertyPane(this.rootPane);
            const bindManualControls = true;
            this._cursorModeControl = new CursorModeControl(this.session, this.tool, this.rootPane, bindManualControls, this._cursorProperties);
            this._cursorModeControl.initialize();
            this._brushControl = new BrushPaintSharedControl(this.session, this.tool, this.rootPane, {
                paintMode: server_editor_namespaceObject.PaintMode.BlockPaint,
                brushShapeType: server_editor_bindings_namespaceObject.BrushShapeType.OffsetList
            });
            this._brushControl.initialize();
            this.tool.onModalToolActivation.subscribe((data => {
                if (data.isActiveTool) {
                    this._cursorModeControl.activateControl();
                    this._brushControl.activateControl();
                    this._brushControl.activateVisualization();
                } else {
                    if (this._paintingActive) {
                        this._endPainting();
                    }
                    this._cursorModeControl.deactivateControl();
                    this._brushControl.deactivateControl();
                    this._brushControl.deactivateVisualization();
                }
            }));
            this.session.extensionContext.afterEvents.modeChange.subscribe((_event => {
                if (this._brushControl.isActive && this._paintingActive) {
                    this._endPainting();
                }
            }));
            this._paintingActive = false;
            this._registerMouseUpDownAction();
            this._registerKeyboardInputActions();
        }
        _registerMouseUpDownAction() {
            const action = this.session.actionManager.createAction({
                actionType: server_editor_namespaceObject.ActionTypes.MouseRayCastAction,
                onExecute: (_mouseRay, mouseProps) => {
                    if (mouseProps.mouseAction === server_editor_namespaceObject.MouseActionType.LeftButton) {
                        if (mouseProps.inputType === server_editor_namespaceObject.MouseInputType.ButtonDown) {
                            this.telemetryManager.fireTelemetryEvent(BrushTelemetry.StartPaining);
                            this._beginPainting();
                        } else if (mouseProps.inputType === server_editor_namespaceObject.MouseInputType.ButtonUp && this._paintingActive) {
                            this.telemetryManager.fireTelemetryEvent(BrushTelemetry.EndPainting, {
                                offset: this._session.extensionContext.brushShapeManager.getBrushShapeOffset()
                            });
                            this._endPainting();
                        }
                    }
                }
            });
            this._tool.registerMouseButtonBinding(action);
        }
        _registerKeyboardInputActions() {
            const singlePressPaintAction = this.session.actionManager.createAction({
                actionType: server_editor_namespaceObject.ActionTypes.NoArgsAction,
                onExecute: () => {
                    if (this._paintingActive) {
                        return;
                    }
                    this.session.extensionContext.transactionManager.openTransaction("Brush Paint");
                    this.session.extensionContext.brushShapeManager.singlePaint((state => {
                        if (state === server_editor_bindings_namespaceObject.PaintCompletionState.Success) {
                            this.session.extensionContext.transactionManager.commitOpenTransaction();
                        } else {
                            this.session.extensionContext.transactionManager.discardOpenTransaction();
                            this.session.log.error(`Error during painting`);
                        }
                        this._paintingActive = false;
                    }));
                }
            });
            this.tool.registerKeyBinding(singlePressPaintAction, {
                key: server_editor_namespaceObject.KeyboardKey.ENTER
            }, {
                uniqueId: "editor:brushPainter:paintAtCursor",
                label: "resourcePack.editor.brushPaint.inputContext.oneshot"
            });
        }
        _beginPainting() {
            this._paintingActive = true;
            this.session.extensionContext.transactionManager.openTransaction("Brush Paint");
            this.session.extensionContext.brushShapeManager.beginPainting((state => {
                if (state === server_editor_bindings_namespaceObject.PaintCompletionState.Success) {
                    this.session.extensionContext.transactionManager.commitOpenTransaction();
                } else {
                    this.session.extensionContext.transactionManager.discardOpenTransaction();
                    this.session.log.error(`Error during painting`);
                }
                this._paintingActive = false;
            }));
        }
        _endPainting() {
            this._paintingActive = false;
            this.session.extensionContext.brushShapeManager.endPainting(false);
        }
        teardown() {
            this._cursorModeControl.shutdown();
            this._brushControl.shutdown();
        }
    }
    BrushPainterBehavior.BEHAVIOR_NAME = "Brush Paint";
    var LocateMode;
    (function(LocateMode) {
        LocateMode[LocateMode["Biome"] = 0] = "Biome";
    })(LocateMode || (LocateMode = {}));
    var LocateTelemetry;
    (function(LocateTelemetry) {
        LocateTelemetry["SelectionBiome"] = "SelectionBiome";
        LocateTelemetry["FindBiome"] = "FindBiome";
        LocateTelemetry["GoToResults"] = "GoToResults";
    })(LocateTelemetry || (LocateTelemetry = {}));
    class LocateTool extends server_editor_namespaceObject.SimpleToolWrapper {
        activateResultsPane(biome, pos) {
            this.simpleTool.logInfo(`Found ${biome} at ${lib.Vector3Utils.toString(pos)}`);
            this._results.foundType = biome;
            this._results.foundPos.set(pos);
            const foundPane = this.simpleTool.pane.findPane("results-found");
            foundPane?.reconstructPane();
            this.simpleTool.showPane("results-found");
        }
        activateNoResultsPane() {
            this.simpleTool.showPane("results-notfound");
        }
        hideResultsPane() {
            this.simpleTool.hidePane("results");
        }
        buildTypeSelectionPane(component) {
            const actualPane = component.pane;
            const locatorType = {
                locateMode: (0, server_editor_namespaceObject.makeObservable)(LocateMode.Biome)
            };
            actualPane.addDropdown(locatorType.locateMode, {
                title: "resourcePack.editor.locate.locatetype.title",
                entries: [ {
                    label: "resourcePack.editor.locate.locatetype.biome",
                    value: LocateMode.Biome
                } ],
                onChange: newValue => {
                    const mode = newValue;
                    if (mode === LocateMode.Biome) {
                        component.simpleTool.showPane("type-biome");
                    } else {
                        component.simpleTool.showPane("type-structure");
                    }
                    component.simpleTool.hidePane("results");
                }
            });
        }
        buildBiomeSearchPane(component) {
            const actualPane = component.pane;
            const biomeType = {
                biomeId: (0, server_editor_namespaceObject.makeObservable)(0),
                biomePos: (0, server_editor_namespaceObject.makeObservable)(lib.VECTOR3_ZERO)
            };
            const listOfBiomes = server_namespaceObject.BiomeTypes.getAll().map(((v, i) => {
                const names = v.id;
                const item = {
                    label: names.replace("minecraft:", "").replace("_", " "),
                    value: i
                };
                return item;
            })).filter((item => !this.blockedBiomes.has(item.label))).sort(((a, b) => a.label.localeCompare(b.label)));
            actualPane.addDropdown(biomeType.biomeId, {
                title: "resourcePack.editor.locate.biome.title",
                entries: listOfBiomes,
                onChange: () => {
                    component.simpleTool.hidePane("results");
                    this.telemetryManager.fireTelemetryEvent(LocateTelemetry.FindBiome, {
                        biomeId: biomeType.biomeId.value
                    });
                }
            });
            const locateBiomeAction = component.session.actionManager.createAction({
                actionType: server_editor_namespaceObject.ActionTypes.NoArgsAction,
                onExecute: () => {
                    const biome = server_namespaceObject.BiomeTypes.getAll()[biomeType.biomeId.value].id;
                    const player = component.session.extensionContext.player;
                    const biomePos = player.dimension.findClosestBiome(player.location, biome);
                    if (biomePos) {
                        this.activateResultsPane(biome, biomePos);
                    } else {
                        this.activateNoResultsPane();
                    }
                    this.telemetryManager.fireTelemetryEvent(LocateTelemetry.FindBiome, {
                        biomeId: biomeType.biomeId.value
                    });
                }
            });
            actualPane.addButton(locateBiomeAction, {
                title: "resourcePack.editor.locate.biome.find",
                visible: true,
                icon: "pinIcon"
            });
        }
        buildStructurePane(component) {
            const actualPane = component.pane;
            actualPane.addText("resourcePack.editor.locate.structure.message", {
                border: true
            });
        }
        buildResultsPane(component) {
            const actualPane = component.pane;
            actualPane.addText(`Found ${this._results.foundType}`);
            actualPane.addVector3(this._results.foundPos, {
                title: "resourcePack.editor.locate.results.foundat",
                enable: false,
                visible: true
            });
            actualPane.addButton(component.session.actionManager.createAction({
                actionType: server_editor_namespaceObject.ActionTypes.NoArgsAction,
                onExecute: () => {
                    const pos = this._results.foundPos;
                    component.session.extensionContext.player.teleport(pos.value);
                    this.telemetryManager.fireTelemetryEvent(LocateTelemetry.GoToResults);
                }
            }), {
                title: "resourcePack.editor.locate.results.goto"
            });
        }
        buildNoResultsPane(component) {
            const actualPane = component.pane;
            actualPane.addText("resourcePack.editor.locate.results.notfound", {
                border: true
            });
        }
        constructor(session) {
            super();
            this._results = {
                foundType: "",
                foundPos: (0, server_editor_namespaceObject.makeObservable)(lib.VECTOR3_ZERO)
            };
            this.blockedBiomes = new Set("hell");
            this.telemetryManager = new TelemetryManager(session.extensionContext.player, TelemetrySource.Locate);
            const toolOptions = {
                id: "editor:locateTool",
                name: "Locate",
                activationKeyBinding: {
                    binding: {
                        key: server_editor_namespaceObject.KeyboardKey.KEY_L,
                        modifier: server_editor_namespaceObject.InputModifier.Control
                    },
                    info: {
                        uniqueId: "editor:toolModeKeyBinding:toggleLocateTool",
                        label: "resourcePack.editor.locate.keyBinding.toggleTool"
                    }
                },
                propertyPaneOptions: {
                    id: "pane",
                    title: "resourcePack.editor.locate.title",
                    infoTooltip: {
                        description: [ {
                            link: "https://aka.ms/BedrockEditorLocate",
                            text: "resourcePack.editor.help.learnMore"
                        } ]
                    },
                    childPaneInitiallyVisible: "typeSelector",
                    childPanes: [ {
                        id: "typeSelector",
                        title: "resourcePack.editor.locate.locatetype.title",
                        onBeginFinalize: component => this.buildTypeSelectionPane(component),
                        childPaneInitiallyVisible: "type-biome",
                        childPanesMutuallyExclusive: true,
                        childPanes: [ {
                            id: "type-biome",
                            title: "resourcePack.editor.locate.biome.title",
                            onBeginFinalize: component => this.buildBiomeSearchPane(component)
                        }, {
                            id: "type-structure",
                            title: "resourcePack.editor.locate.structure.title",
                            onBeginFinalize: component => this.buildStructurePane(component)
                        } ]
                    }, {
                        id: "results",
                        title: "resourcePack.editor.locate.results.title",
                        childPanesMutuallyExclusive: true,
                        childPanes: [ {
                            id: "results-found",
                            title: "resourcePack.editor.locate.results.foundat.title",
                            onBeginFinalize: component => this.buildResultsPane(component)
                        }, {
                            id: "results-notfound",
                            title: "resourcePack.editor.locate.results.notfound.title",
                            onBeginFinalize: component => this.buildNoResultsPane(component)
                        } ]
                    } ]
                }
            };
            this.setupSimpleTool(session, toolOptions);
        }
    }
    const PROPERTY_CLIPBOARDPREVIEWCONTROL_NAME = "ClipboardPreviewControl";
    const PROPERTY_CLIPBOARDPREVIEWCONTROL_LOCALIZATION_PREFIX = `resourcePack.editor.${PROPERTY_CLIPBOARDPREVIEWCONTROL_NAME}`;
    class ClipboardPreviewControl extends SharedControlImpl {
        constructor(session, parentTool, parentPropertyPane, clipboardItem, options) {
            super(session, parentTool, parentPropertyPane, PROPERTY_CLIPBOARDPREVIEWCONTROL_NAME, PROPERTY_CLIPBOARDPREVIEWCONTROL_LOCALIZATION_PREFIX);
            this._structureSize = (0, server_editor_namespaceObject.makeObservable)(new lib.Vector3Builder(0, 0, 0));
            this._structureHumanReadableOrigin = (0, server_editor_namespaceObject.makeObservable)(new lib.Vector3Builder(0, 0, 0));
            this._structureOffset = (0, server_editor_namespaceObject.makeObservable)(new lib.Vector3Builder(0, 0, 0));
            this._structureRotationIndex = (0, server_editor_namespaceObject.makeObservable)(0);
            this._structureMirrorX = (0, server_editor_namespaceObject.makeObservable)(false);
            this._structureMirrorZ = (0, server_editor_namespaceObject.makeObservable)(false);
            this._editorMode = server_editor_namespaceObject.EditorMode.Tool;
            this._fillVolume = async (dimension, volume, fillBlockType) => {
                const operation = blockLocation => {
                    const block = dimension.getBlock(blockLocation);
                    if (block) {
                        block.setType(fillBlockType);
                    }
                };
                await executeLargeOperationFromIteratorWithTransactionAndTicking(this.session.extensionContext, this.session.log, volume.getBoundingBox(), volume.getBlockLocationIterator(), "Inverse Paste", operation);
            };
            this._clipboardItem = clipboardItem;
            this._setupParametersFromClipboardItem();
            this._structureRotationIndex.set(this._getRotationOrderIndex(options?.rotation ?? server_namespaceObject.StructureRotation.None));
            const {mirrorX, mirrorZ} = this._getBooleansFromMirrorAxis(options?.mirrorAxis ?? server_namespaceObject.StructureMirrorAxis.None);
            this._structureMirrorX.set(mirrorX);
            this._structureMirrorZ.set(mirrorZ);
            this._structureOffset.set(lib.VECTOR3_ZERO);
            const defaultOrigin = calculateClipboardAbsoluteAnchorValue(this._clipboardItem, ClipboardPreviewControl.DEFAULT_ORIGIN);
            this._structureHumanReadableOrigin.set(defaultOrigin);
            this._bindToCursor = options?.bindToCursor ?? true;
            this._widgetGroup = this._createWidgetGroup();
            this._transferParametersToClipboardComponent();
            this.session.extensionContext.afterEvents.clipboardChange.subscribe((_event => {
                if (_event.itemId === this._clipboardItem.id) {
                    this._setupParametersFromClipboardItem();
                    this._transferParametersToClipboardComponent();
                }
            }));
        }
        initialize() {
            this.session.log.info("ClipboardPreviewControl::initialize");
            super.initialize();
            if (!this.tool) {
                throw new Error("Tool is not initialized");
            }
            const offsetNudgeUpAction = this.session.actionManager.createAction({
                actionType: server_editor_namespaceObject.ActionTypes.NoArgsAction,
                onExecute: () => {
                    this._nudgeOffset(lib.VECTOR3_UP);
                }
            });
            const offsetNudgeDownAction = this.session.actionManager.createAction({
                actionType: server_editor_namespaceObject.ActionTypes.NoArgsAction,
                onExecute: () => {
                    this._nudgeOffset(lib.VECTOR3_DOWN);
                }
            });
            const offsetNudgeForwardAction = this.session.actionManager.createAction({
                actionType: server_editor_namespaceObject.ActionTypes.NoArgsAction,
                onExecute: () => {
                    const nudgeVector = this._getRelativeNudgeDirection(Direction.Forward);
                    this._nudgeOffset(nudgeVector);
                }
            });
            const offsetNudgeBackAction = this.session.actionManager.createAction({
                actionType: server_editor_namespaceObject.ActionTypes.NoArgsAction,
                onExecute: () => {
                    const nudgeVector = this._getRelativeNudgeDirection(Direction.Back);
                    this._nudgeOffset(nudgeVector);
                }
            });
            const offsetNudgeLeftAction = this.session.actionManager.createAction({
                actionType: server_editor_namespaceObject.ActionTypes.NoArgsAction,
                onExecute: () => {
                    const nudgeVector = this._getRelativeNudgeDirection(Direction.Left);
                    this._nudgeOffset(nudgeVector);
                }
            });
            const offsetNudgeRightAction = this.session.actionManager.createAction({
                actionType: server_editor_namespaceObject.ActionTypes.NoArgsAction,
                onExecute: () => {
                    const nudgeVector = this._getRelativeNudgeDirection(Direction.Right);
                    this._nudgeOffset(nudgeVector);
                }
            });
            this.registerToolKeyBinding(offsetNudgeUpAction, {
                key: server_editor_namespaceObject.KeyboardKey.PAGE_UP,
                modifier: server_editor_namespaceObject.InputModifier.Control | server_editor_namespaceObject.InputModifier.Shift
            }, "nudgeOffsetUp");
            this.registerToolKeyBinding(offsetNudgeDownAction, {
                key: server_editor_namespaceObject.KeyboardKey.PAGE_DOWN,
                modifier: server_editor_namespaceObject.InputModifier.Control | server_editor_namespaceObject.InputModifier.Shift
            }, "nudgeOffsetDown");
            this.registerToolKeyBinding(offsetNudgeForwardAction, {
                key: server_editor_namespaceObject.KeyboardKey.UP,
                modifier: server_editor_namespaceObject.InputModifier.Control | server_editor_namespaceObject.InputModifier.Shift
            }, "nudgeOffsetForward");
            this.registerToolKeyBinding(offsetNudgeBackAction, {
                key: server_editor_namespaceObject.KeyboardKey.DOWN,
                modifier: server_editor_namespaceObject.InputModifier.Control | server_editor_namespaceObject.InputModifier.Shift
            }, "nudgeOffsetBack");
            this.registerToolKeyBinding(offsetNudgeLeftAction, {
                key: server_editor_namespaceObject.KeyboardKey.LEFT,
                modifier: server_editor_namespaceObject.InputModifier.Control | server_editor_namespaceObject.InputModifier.Shift
            }, "nudgeOffsetLeft");
            this.registerToolKeyBinding(offsetNudgeRightAction, {
                key: server_editor_namespaceObject.KeyboardKey.RIGHT,
                modifier: server_editor_namespaceObject.InputModifier.Control | server_editor_namespaceObject.InputModifier.Shift
            }, "nudgeOffsetRight");
            const keyOriginUpAction = this.session.actionManager.createAction({
                actionType: server_editor_namespaceObject.ActionTypes.NoArgsAction,
                onExecute: () => {
                    this._nudgeOrigin(lib.VECTOR3_UP);
                }
            });
            const keyOriginDownAction = this.session.actionManager.createAction({
                actionType: server_editor_namespaceObject.ActionTypes.NoArgsAction,
                onExecute: () => {
                    this._nudgeOrigin(lib.VECTOR3_DOWN);
                }
            });
            const keyOriginLeftAction = this.session.actionManager.createAction({
                actionType: server_editor_namespaceObject.ActionTypes.NoArgsAction,
                onExecute: () => {
                    const nudgeVector = this._getRelativeNudgeDirection(Direction.Left);
                    this._nudgeOrigin(nudgeVector);
                }
            });
            const keyOriginRightAction = this.session.actionManager.createAction({
                actionType: server_editor_namespaceObject.ActionTypes.NoArgsAction,
                onExecute: () => {
                    const nudgeVector = this._getRelativeNudgeDirection(Direction.Right);
                    this._nudgeOrigin(nudgeVector);
                }
            });
            const keyOriginForwardAction = this.session.actionManager.createAction({
                actionType: server_editor_namespaceObject.ActionTypes.NoArgsAction,
                onExecute: () => {
                    const nudgeVector = this._getRelativeNudgeDirection(Direction.Forward);
                    this._nudgeOrigin(nudgeVector);
                }
            });
            const keyOriginBackAction = this.session.actionManager.createAction({
                actionType: server_editor_namespaceObject.ActionTypes.NoArgsAction,
                onExecute: () => {
                    const nudgeVector = this._getRelativeNudgeDirection(Direction.Back);
                    this._nudgeOrigin(nudgeVector);
                }
            });
            this.registerToolKeyBinding(keyOriginForwardAction, {
                key: server_editor_namespaceObject.KeyboardKey.UP,
                modifier: server_editor_namespaceObject.InputModifier.Control
            }, "moveOriginForward");
            this.registerToolKeyBinding(keyOriginBackAction, {
                key: server_editor_namespaceObject.KeyboardKey.DOWN,
                modifier: server_editor_namespaceObject.InputModifier.Control
            }, "moveOriginBack");
            this.registerToolKeyBinding(keyOriginLeftAction, {
                key: server_editor_namespaceObject.KeyboardKey.LEFT,
                modifier: server_editor_namespaceObject.InputModifier.Control
            }, "moveOriginLeft");
            this.registerToolKeyBinding(keyOriginRightAction, {
                key: server_editor_namespaceObject.KeyboardKey.RIGHT,
                modifier: server_editor_namespaceObject.InputModifier.Control
            }, "moveOriginRight");
            this.registerToolKeyBinding(keyOriginUpAction, {
                key: server_editor_namespaceObject.KeyboardKey.PAGE_UP,
                modifier: server_editor_namespaceObject.InputModifier.Control
            }, "moveOriginUp");
            this.registerToolKeyBinding(keyOriginDownAction, {
                key: server_editor_namespaceObject.KeyboardKey.PAGE_DOWN,
                modifier: server_editor_namespaceObject.InputModifier.Control
            }, "moveOriginDown");
            const rotateClockwiseAction = this.session.actionManager.createAction({
                actionType: server_editor_namespaceObject.ActionTypes.NoArgsAction,
                onExecute: () => {
                    const index = (this._structureRotationIndex.value + 1) % ClipboardPreviewControl._rotationOrder.length;
                    this._structureRotationIndex.set(index);
                    this._widgetComponent.clipboardRotation = this._getRotationFromOrderedIndex(index);
                }
            });
            this.registerToolKeyBinding(rotateClockwiseAction, {
                key: server_editor_namespaceObject.KeyboardKey.KEY_R
            }, "rotateClockWise");
            const rotateAntiClockwiseAction = this.session.actionManager.createAction({
                actionType: server_editor_namespaceObject.ActionTypes.NoArgsAction,
                onExecute: () => {
                    const index = ((this._structureRotationIndex.value - 1) % ClipboardPreviewControl._rotationOrder.length + ClipboardPreviewControl._rotationOrder.length) % ClipboardPreviewControl._rotationOrder.length;
                    this._structureRotationIndex.set(index);
                    this._widgetComponent.clipboardRotation = this._getRotationFromOrderedIndex(index);
                }
            });
            this.registerToolKeyBinding(rotateAntiClockwiseAction, {
                key: server_editor_namespaceObject.KeyboardKey.KEY_R,
                modifier: server_editor_namespaceObject.InputModifier.Shift
            }, "rotateCounterClockWise");
            const mirrorXAction = this.session.actionManager.createAction({
                actionType: server_editor_namespaceObject.ActionTypes.NoArgsAction,
                onExecute: () => {
                    this._structureMirrorX.set(!this._structureMirrorX.value);
                    const mirrorAxis = this._getMirrorAxisFromBooleans(this._structureMirrorX.value, this._structureMirrorZ.value);
                    this._widgetComponent.clipboardMirror = mirrorAxis;
                }
            });
            this.registerToolKeyBinding(mirrorXAction, {
                key: server_editor_namespaceObject.KeyboardKey.KEY_X
            }, "toggleMirrorX");
            const mirrorZAction = this.session.actionManager.createAction({
                actionType: server_editor_namespaceObject.ActionTypes.NoArgsAction,
                onExecute: () => {
                    this._structureMirrorZ.set(!this._structureMirrorZ.value);
                    const mirrorAxis = this._getMirrorAxisFromBooleans(this._structureMirrorX.value, this._structureMirrorZ.value);
                    this._widgetComponent.clipboardMirror = mirrorAxis;
                }
            });
            this.registerToolKeyBinding(mirrorZAction, {
                key: server_editor_namespaceObject.KeyboardKey.KEY_Z
            }, "toggleMirrorZ");
        }
        shutdown() {
            this.session.log.info("ClipboardPreviewControl::shutdown");
            super.shutdown();
        }
        activateControl() {
            this.session.log.info("ClipboardPreviewControl::activateControl");
            if (this.isActive) {
                this.session.log.info("ClipboardPreviewControl::activateControl - exiting early - already active");
                return;
            }
            super.activateControl();
            this._modeChangeEventSubscriptionHandle = this.session.extensionContext.afterEvents.modeChange.subscribe((event => {
                this._editorMode = event.mode;
                if (this._editorMode === server_editor_namespaceObject.EditorMode.Tool) {
                    if (this.isActive) {
                        this.session.log.info("ClipboardPreviewControl::modeChangeEvent::Tool (isActive)");
                        this.activateVisualization();
                    } else {
                        this.session.log.info("ClipboardPreviewControl::modeChangeEvent::Tool");
                        this.deactivateVisualization();
                    }
                } else {
                    this.session.log.info("ClipboardPreviewControl::modeChangeEvent::Crosshair");
                    this.deactivateVisualization();
                }
            }));
            this._setupParametersFromClipboardItem();
            this._transferParametersToClipboardComponent();
            this._constructControlUI();
            this._controlPane?.show();
            this.propertyPane.show();
        }
        deactivateControl() {
            this.session.log.info("ClipboardPreviewControl::deactivateControl");
            if (!this.isActive) {
                this.session.log.info("ClipboardPreviewControl::deactivateControl - exiting early - already deactivated");
                return;
            }
            super.deactivateControl();
            if (this._modeChangeEventSubscriptionHandle) {
                this.session.extensionContext.afterEvents.modeChange.unsubscribe(this._modeChangeEventSubscriptionHandle);
                this._modeChangeEventSubscriptionHandle = undefined;
            }
            this._destroyControlUI();
            this._controlPane?.hide();
            this.propertyPane.show();
        }
        activateVisualization() {
            this.session.log.info("ClipboardPreviewControl::activateVisualization");
            this._widgetGroup.visible = true;
        }
        deactivateVisualization() {
            this.session.log.info("ClipboardPreviewControl::deactivateVisualization");
            this._widgetGroup.visible = false;
        }
        _constructControlUI() {
            this.session.log.info("ClipboardPreviewControl::constructControlUI");
            if (this._controlPane) {
                this._structureOriginUIComponent = undefined;
                this._controlPane.hide();
                this.propertyPane.removeSubPane(this._controlPane);
                this._controlPane = undefined;
            }
            this._controlPane = this.propertyPane.createSubPane({
                title: this.localize("rootPane.title"),
                hasExpander: true
            });
            this._controlPane.addVector3(this._structureSize, {
                title: this.localize("structureSize.title"),
                enable: false,
                isInteger: true
            });
            const placementPane = this._controlPane.createSubPane({
                title: this.localize("placement.title"),
                hasExpander: true,
                hasMargins: false
            });
            this._structureOriginUIComponent = placementPane.addVector3(this._structureHumanReadableOrigin, {
                title: this.localize("origin.title"),
                tooltip: this.localize("origin.tooltip"),
                enable: true,
                isInteger: false,
                min: ClipboardPreviewControl.MIN_ORIGIN,
                max: this._calculateStructureOriginMax(this._structureSize.value),
                onChange: _newValue => {
                    this._widgetComponent.clipboardNormalizedOrigin = calculateClipboardNormalizedAnchorValue(this._clipboardItem, _newValue);
                }
            });
            placementPane.addVector3(this._structureOffset, {
                title: this.localize("offset.title"),
                tooltip: this.localize("offset.tooltip"),
                enable: true,
                isInteger: true,
                min: ClipboardPreviewControl.MIN_OFFSET,
                max: ClipboardPreviewControl.MAX_OFFSET,
                onChange: _newValue => {
                    this._widgetComponent.clipboardOffset = _newValue;
                }
            });
            placementPane.addDropdown(this._structureRotationIndex, {
                title: this.localize("rotation.title"),
                tooltip: this.localize("rotation.tooltip"),
                entries: [ {
                    value: 0,
                    label: this.localize("rotation.none")
                }, {
                    value: 1,
                    label: this.localize("rotation.90")
                }, {
                    value: 2,
                    label: this.localize("rotation.180")
                }, {
                    value: 3,
                    label: this.localize("rotation.270")
                } ],
                onChange: _newValue => {
                    this._widgetComponent.clipboardRotation = this._getRotationFromOrderedIndex(_newValue);
                }
            });
            placementPane.addBool(this._structureMirrorX, {
                enable: true,
                title: this.localize("mirror.axis.x"),
                tooltip: this.localize("mirror.axis.x.tooltip"),
                onChange: _newValue => {
                    const mirrorAxis = this._getMirrorAxisFromBooleans(_newValue, this._structureMirrorZ.value);
                    this._widgetComponent.clipboardMirror = mirrorAxis;
                }
            });
            placementPane.addBool(this._structureMirrorZ, {
                enable: true,
                title: this.localize("mirror.axis.z"),
                tooltip: this.localize("mirror.axis.z.tooltip"),
                onChange: _newValue => {
                    const mirrorAxis = this._getMirrorAxisFromBooleans(this._structureMirrorX.value, _newValue);
                    this._widgetComponent.clipboardMirror = mirrorAxis;
                }
            });
        }
        _destroyControlUI() {
            this.session.log.info("ClipboardPreviewControl::destroyControlUI");
            this._structureOriginUIComponent = undefined;
            if (this._controlPane) {
                this._controlPane.hide();
                this.propertyPane.removeSubPane(this._controlPane);
                this._controlPane = undefined;
            }
        }
        _setupParametersFromClipboardItem() {
            const clipboardSize = this._clipboardItem.getSize();
            this._structureSize.set(clipboardSize);
            const humanReadableOrigin = calculateClipboardAbsoluteAnchorValue(this._clipboardItem, ClipboardPreviewControl.DEFAULT_ORIGIN);
            this._structureHumanReadableOrigin.set(humanReadableOrigin);
            if (this._structureOriginUIComponent) {
                const maxHumanReadableOrigin = this._calculateStructureOriginMax(clipboardSize);
                this._structureOriginUIComponent.updateAxisLimits({
                    max: maxHumanReadableOrigin
                });
            }
        }
        _calculateStructureOriginMax(itemSize) {
            const result = lib.Vector3Utils.clamp(lib.Vector3Utils.subtract(itemSize, lib.VECTOR3_ONE), {
                min: lib.VECTOR3_ZERO,
                max: itemSize
            });
            return result;
        }
        _transferParametersToClipboardComponent() {
            this._widgetComponent.clipboardOffset = this._structureOffset.value;
            this._widgetComponent.clipboardRotation = this._getRotationFromOrderedIndex(this._structureRotationIndex.value);
            this._widgetComponent.clipboardMirror = this._getMirrorAxisFromBooleans(this._structureMirrorX.value, this._structureMirrorZ.value);
            this._widgetComponent.clipboardOffset = this._structureOffset.value;
            this._widgetComponent.clipboardNormalizedOrigin = calculateClipboardNormalizedAnchorValue(this._clipboardItem, this._structureHumanReadableOrigin.value);
        }
        _getRotationOrderIndex(rotation) {
            const index = ClipboardPreviewControl._rotationOrder.indexOf(rotation);
            return index;
        }
        _getRotationFromOrderedIndex(index) {
            return ClipboardPreviewControl._rotationOrder[index];
        }
        _getMirrorAxisFromBooleans(mirrorX, mirrorZ) {
            if (mirrorX && mirrorZ) {
                return server_namespaceObject.StructureMirrorAxis.XZ;
            } else if (mirrorX) {
                return server_namespaceObject.StructureMirrorAxis.X;
            } else if (mirrorZ) {
                return server_namespaceObject.StructureMirrorAxis.Z;
            }
            return server_namespaceObject.StructureMirrorAxis.None;
        }
        _getBooleansFromMirrorAxis(mirrorAxis) {
            switch (mirrorAxis) {
              case server_namespaceObject.StructureMirrorAxis.XZ:
                return {
                    mirrorX: true,
                    mirrorZ: true
                };

              case server_namespaceObject.StructureMirrorAxis.X:
                return {
                    mirrorX: true,
                    mirrorZ: false
                };

              case server_namespaceObject.StructureMirrorAxis.Z:
                return {
                    mirrorX: false,
                    mirrorZ: true
                };

              default:
                return {
                    mirrorX: false,
                    mirrorZ: false
                };
            }
        }
        _getRelativeNudgeDirection(direction) {
            const rotationY = this.session.extensionContext.player.getRotation().y;
            const rotationCorrectedVector = getRotationCorrectedDirectionVector(rotationY, direction);
            return rotationCorrectedVector;
        }
        _nudgeOffset(nudgeVector) {
            let update = lib.Vector3Utils.add(this._structureOffset.value, nudgeVector);
            update = lib.Vector3Utils.clamp(update, {
                min: ClipboardPreviewControl.MIN_OFFSET,
                max: ClipboardPreviewControl.MAX_OFFSET
            });
            this._structureOffset.set(update);
            this._widgetComponent.clipboardOffset = update;
        }
        _nudgeOrigin(nudgeVector) {
            const clipboardRotation = this._widgetComponent.clipboardRotation;
            let rotatedVector = nudgeVector;
            switch (clipboardRotation) {
              case server_namespaceObject.StructureRotation.Rotate90:
                rotatedVector = {
                    x: nudgeVector.z,
                    y: nudgeVector.y,
                    z: -nudgeVector.x
                };
                break;

              case server_namespaceObject.StructureRotation.Rotate180:
                rotatedVector = {
                    x: -nudgeVector.x,
                    y: nudgeVector.y,
                    z: -nudgeVector.z
                };
                break;

              case server_namespaceObject.StructureRotation.Rotate270:
                rotatedVector = {
                    x: -nudgeVector.z,
                    y: nudgeVector.y,
                    z: nudgeVector.x
                };
            }
            let update = lib.Vector3Utils.add(this._structureHumanReadableOrigin.value, rotatedVector);
            const maxSize = this._calculateStructureOriginMax(this._structureSize.value);
            update = lib.Vector3Utils.clamp(update, {
                min: lib.VECTOR3_ZERO,
                max: maxSize
            });
            this._structureHumanReadableOrigin.set(update);
            this._widgetComponent.clipboardNormalizedOrigin = calculateClipboardNormalizedAnchorValue(this._clipboardItem, update);
        }
        pastePreviewIntoWorld(location) {
            if (!this.isActive) {
                throw new Error("Control must be active");
            }
            if (this._clipboardItem.isEmpty) {
                this.session.log.info("Clipboard is empty");
                return;
            }
            const vector3_half = new lib.Vector3Builder(0, 0, 0);
            const clipboardTarget = lib.Vector3Utils.add(location ?? this.session.extensionContext.cursor.getPosition(), vector3_half);
            const transactionManager = this.session.extensionContext.transactionManager;
            transactionManager.openTransaction("Paste Preview");
            const writeOptions = {
                normalizedOrigin: calculateClipboardNormalizedAnchorValue(this._clipboardItem, this._structureHumanReadableOrigin.value),
                offset: this._structureOffset.value,
                mirror: this._getMirrorAxisFromBooleans(this._structureMirrorX.value, this._structureMirrorZ.value),
                rotation: this._getRotationFromOrderedIndex(this._structureRotationIndex.value)
            };
            try {
                const wroteOK = this._clipboardItem.writeToWorld(clipboardTarget, writeOptions);
                if (!wroteOK) {
                    throw new Error("unknown error");
                }
                transactionManager.commitOpenTransaction();
            } catch (e) {
                transactionManager.discardOpenTransaction();
                this.session.log.error(`Failed to write clipboard to world (${(0, server_editor_namespaceObject.stringFromException)(e)})`);
            }
        }
        pasteClipboardSilhouette(location) {
            if (!this.isActive) {
                throw new Error("Control must be active");
            }
            if (this._clipboardItem.isEmpty) {
                this.session.log.info("Clipboard is empty");
                return;
            }
            const vector3_half = new lib.Vector3Builder(.5, .5, .5);
            const cursorTarget = lib.Vector3Utils.add(location ?? this.session.extensionContext.cursor.getPosition(), vector3_half);
            const writeOptions = {
                normalizedOrigin: calculateClipboardNormalizedAnchorValue(this._clipboardItem, this._structureHumanReadableOrigin.value),
                offset: this._structureOffset.value,
                mirror: this._getMirrorAxisFromBooleans(this._structureMirrorX.value, this._structureMirrorZ.value),
                rotation: this._getRotationFromOrderedIndex(this._structureRotationIndex.value)
            };
            const writeVolume = this._clipboardItem.getPredictedWriteAsCompoundBlockVolume(cursorTarget, writeOptions);
            const fillBlockType = server_namespaceObject.BlockTypes.get(MinecraftBlockTypes.Air);
            this._fillVolume(this.session.extensionContext.player.dimension, writeVolume, fillBlockType).catch((e => this.session.log.error(e.message)));
        }
        _createWidgetGroup() {
            const widgetGroup = this.session.extensionContext.widgetManager.createGroup({
                groupSelectionMode: server_editor_namespaceObject.WidgetGroupSelectionMode.None,
                visible: false
            });
            const options = {
                bindPositionToBlockCursor: this._bindToCursor,
                collisionOffset: new lib.Vector3Builder(0, 0, 0),
                collisionRadius: 0,
                selectable: false,
                visible: true
            };
            this._widget = widgetGroup.createWidget(new lib.Vector3Builder(0, 0, 0), options);
            const clipboardOptions = {
                clipboardMirror: this._getMirrorAxisFromBooleans(this._structureMirrorX.value, this._structureMirrorZ.value),
                clipboardRotation: this._getRotationFromOrderedIndex(this._structureRotationIndex.value),
                offset: this._structureOffset.value,
                clipboardNormalizedOrigin: calculateClipboardNormalizedAnchorValue(this._clipboardItem, this._structureHumanReadableOrigin.value),
                showBounds: true,
                visible: true
            };
            const clipboardItem = this.session.extensionContext.clipboardManager.clipboard;
            this._widgetComponent = this._widget.addClipboardComponent("clipboard-preview-shared-control", clipboardItem, clipboardOptions);
            return widgetGroup;
        }
    }
    ClipboardPreviewControl._rotationOrder = [ server_namespaceObject.StructureRotation.None, server_namespaceObject.StructureRotation.Rotate90, server_namespaceObject.StructureRotation.Rotate180, server_namespaceObject.StructureRotation.Rotate270 ];
    ClipboardPreviewControl.MIN_ORIGIN = {
        x: 0,
        y: 0,
        z: 0
    };
    ClipboardPreviewControl.MIN_OFFSET = {
        x: -100,
        y: -100,
        z: -100
    };
    ClipboardPreviewControl.MAX_OFFSET = {
        x: 100,
        y: 100,
        z: 100
    };
    ClipboardPreviewControl.DEFAULT_ORIGIN = {
        x: 0,
        y: -1,
        z: 0
    };
    var PastePreviewTelemetry;
    (function(PastePreviewTelemetry) {
        PastePreviewTelemetry["PastePreviewActivated"] = "PastePreviewActivated";
        PastePreviewTelemetry["PastePreviewIntoWorld"] = "PastePreviewIntoWorld";
        PastePreviewTelemetry["ClearPastePreview"] = "ClearPastePreview";
    })(PastePreviewTelemetry || (PastePreviewTelemetry = {}));
    class PastePreviewBehavior {
        get session() {
            return this._session;
        }
        get tool() {
            return this._tool;
        }
        get rootPane() {
            return this._rootPane;
        }
        constructor(_session, _fallbackToolId) {
            this._session = _session;
            this._fallbackToolId = _fallbackToolId;
            this._isActive = false;
            this.telemetryManager = new TelemetryManager(this._session.extensionContext.player, TelemetrySource.PastePreview);
            this._cursorProperties = {
                outlineColor: {
                    red: 0,
                    green: .5,
                    blue: .5,
                    alpha: .2
                },
                controlMode: server_editor_namespaceObject.CursorControlMode.KeyboardAndMouse,
                targetMode: server_editor_namespaceObject.CursorTargetMode.Block,
                visible: true
            };
            const activationAction = this.session.actionManager.createAction({
                actionType: server_editor_namespaceObject.ActionTypes.NoArgsAction,
                onExecute: () => {
                    this.session.toolRail.setSelectedToolId(this.tool.id);
                }
            });
            this._tool = this._session.toolRail.addTool("editor:modalTool:pastePreview", {
                title: "resourcePack.editor.pastepreview.tool.title",
                icon: "pack://textures/editor/Paste.png?filtering=point",
                tooltip: "resourcePack.editor.pastepreview.tool.tip",
                action: activationAction
            });
            this._rootPane = this.session.createPropertyPane({
                title: "resourcePack.editor.pastePreview.tool.title",
                infoTooltip: {
                    description: [ "resourcePack.editor.pastepreview.tool.tip", {
                        link: "https://aka.ms/BedrockEditorPastePreview",
                        text: "resourcePack.editor.help.learnMore"
                    } ]
                }
            });
            this.tool.bindPropertyPane(this.rootPane);
            const bindManualControls = true;
            this._cursorModeControl = new CursorModeControl(this.session, this.tool, this.rootPane, bindManualControls, this._cursorProperties);
            this._cursorModeControl.initialize();
            this._clipboardPreviewControl = new ClipboardPreviewControl(this.session, this.tool, this.rootPane, this.session.extensionContext.clipboardManager.clipboard);
            this._clipboardPreviewControl.initialize();
            this.tool.onModalToolActivation.subscribe((data => {
                this._isActive = data.isActiveTool;
                if (data.isActiveTool) {
                    this.session.log.info("NewPastePreview::onModalToolActivation");
                    this._cursorModeControl.activateControl();
                    this._clipboardPreviewControl.activateControl();
                    this._clipboardPreviewControl.activateVisualization();
                } else {
                    this.session.log.info("NewPastePreview::onModalToolDeactivation");
                    this._cursorModeControl.deactivateControl();
                    this._clipboardPreviewControl.deactivateVisualization();
                    this._clipboardPreviewControl.deactivateControl();
                }
            }));
            this._modeChangeEventSubscriptionHandle = this.session.extensionContext.afterEvents.modeChange.subscribe((_event => {
                if (_event.mode === server_editor_namespaceObject.EditorMode.Crosshair) {
                    if (this._isActive) {
                        this.session.log.info("NewPastePreview::afterEvent::modeChange::Crosshair");
                        this._cursorModeControl.deactivateControl();
                        this._clipboardPreviewControl.deactivateVisualization();
                        this._clipboardPreviewControl.deactivateControl();
                    }
                } else if (_event.mode === server_editor_namespaceObject.EditorMode.Tool) {
                    if (this._isActive) {
                        this.session.log.info("NewPastePreview::afterEvent::modeChange::Tool");
                        this._cursorModeControl.activateControl();
                        this._clipboardPreviewControl.activateControl();
                        this._clipboardPreviewControl.activateVisualization();
                    }
                }
            }));
            this._registerMouseUpDownAction();
            this._registerKeyboardInputActions();
        }
        _registerKeyboardInputActions() {
            const pasteClipboardIntoWorldAction = this._session.actionManager.createAction({
                actionType: server_editor_namespaceObject.ActionTypes.NoArgsAction,
                onExecute: () => {
                    if (this._clipboardPreviewControl.isActive) {
                        this._clipboardPreviewControl.pastePreviewIntoWorld();
                    }
                }
            });
            this._tool.registerKeyBinding(pasteClipboardIntoWorldAction, {
                key: server_editor_namespaceObject.KeyboardKey.KEY_F,
                modifier: server_editor_namespaceObject.InputModifier.Control
            }, {
                uniqueId: `editor:pastePreviewToolKeyBinding:pasteAtCursor.F`,
                label: `resourcePack.editor.pastepreview.keyBinding.pasteAtCursor`
            });
            this._tool.registerKeyBinding(pasteClipboardIntoWorldAction, {
                key: server_editor_namespaceObject.KeyboardKey.ENTER
            }, {
                uniqueId: `editor:pastePreviewToolKeyBinding:pasteAtCursor.Enter`,
                label: `resourcePack.editor.pastepreview.keyBinding.pasteAtCursor`
            });
            const activatePastePreviewAction = this._session.actionManager.createAction({
                actionType: server_editor_namespaceObject.ActionTypes.NoArgsAction,
                onExecute: () => {
                    if (!this._clipboardPreviewControl.isActive) {
                        this.telemetryManager.fireTelemetryEvent(PastePreviewTelemetry.PastePreviewActivated);
                        this._session.toolRail.setSelectedToolId(this._tool.id);
                        this._clipboardPreviewControl.activateControl();
                        this._clipboardPreviewControl.activateVisualization();
                    }
                }
            });
            this._session.inputManager.registerKeyBinding(server_editor_namespaceObject.EditorInputContext.GlobalToolMode, activatePastePreviewAction, {
                key: server_editor_namespaceObject.KeyboardKey.KEY_V,
                modifier: server_editor_namespaceObject.InputModifier.Control | server_editor_namespaceObject.InputModifier.Shift
            }, {
                uniqueId: "editor:toolModeKeyBinding:pastepreview",
                label: "resourcePack.editor.pastepreview.keyBinding.pastepreview"
            });
            const deactivatePreviewAndFallbackAction = this._session.actionManager.createAction({
                actionType: server_editor_namespaceObject.ActionTypes.NoArgsAction,
                onExecute: () => {
                    this.telemetryManager.fireTelemetryEvent(PastePreviewTelemetry.ClearPastePreview);
                    this._clipboardPreviewControl.deactivateVisualization();
                    this._clipboardPreviewControl.deactivateControl();
                    this._activateFallbackTool();
                }
            });
            this._tool.registerKeyBinding(deactivatePreviewAndFallbackAction, {
                key: server_editor_namespaceObject.KeyboardKey.KEY_D,
                modifier: server_editor_namespaceObject.InputModifier.Control
            }, {
                uniqueId: `editor:pastePreviewToolKeyBinding:clearPreview`,
                label: `resourcePack.editor.pastepreview.keyBinding.clearPreview`
            });
            this._tool.registerKeyBinding(deactivatePreviewAndFallbackAction, {
                key: server_editor_namespaceObject.KeyboardKey.ESCAPE
            }, {
                uniqueId: `editor:pastePreviewToolKeyBinding:clearPreviewEsc`,
                label: `resourcePack.editor.pastepreview.keyBinding.clearPreview`
            });
        }
        _registerMouseUpDownAction() {
            const mouseClickAction = this._session.actionManager.createAction({
                actionType: server_editor_namespaceObject.ActionTypes.MouseRayCastAction,
                onExecute: (_, mouseProps) => {
                    if (mouseProps.mouseAction === server_editor_namespaceObject.MouseActionType.LeftButton) {
                        if (mouseProps.inputType === server_editor_namespaceObject.MouseInputType.ButtonDown) {
                            if (this._clipboardPreviewControl.isActive) {
                                if (mouseProps.modifiers.ctrl) {
                                    this.telemetryManager.fireTelemetryEvent(PastePreviewTelemetry.PastePreviewIntoWorld, {
                                        mode: "silhouette"
                                    });
                                    this._clipboardPreviewControl.pasteClipboardSilhouette();
                                } else {
                                    this.telemetryManager.fireTelemetryEvent(PastePreviewTelemetry.PastePreviewIntoWorld, {
                                        mode: "quick"
                                    });
                                    this._clipboardPreviewControl.pastePreviewIntoWorld();
                                }
                            }
                        }
                    }
                }
            });
            this._tool.registerMouseButtonBinding(mouseClickAction);
        }
        _activateFallbackTool() {
            this._session.toolRail.setSelectedToolId(this._fallbackToolId);
        }
        teardown() {
            if (this._modeChangeEventSubscriptionHandle) {
                this.session.extensionContext.afterEvents.modeChange.unsubscribe(this._modeChangeEventSubscriptionHandle);
                this._modeChangeEventSubscriptionHandle = undefined;
            }
            this._cursorModeControl.shutdown();
            this._clipboardPreviewControl.shutdown();
        }
    }
    PastePreviewBehavior.BEHAVIOR_NAME = "New Paste Preview";
    class CopyPasteBehavior {
        constructor(uiSession) {
            this._session = uiSession;
            const simpleCopyAction = this.session.actionManager.createAction({
                actionType: server_editor_namespaceObject.ActionTypes.NoArgsAction,
                onExecute: async () => {
                    await this._copySelectionToClipboard();
                }
            });
            const simpleCutAction = this.session.actionManager.createAction({
                actionType: server_editor_namespaceObject.ActionTypes.NoArgsAction,
                onExecute: async () => {
                    await this._copySelectionToClipboard();
                    await deleteOperation(this._session);
                }
            });
            const simplePasteAction = this._session.actionManager.createAction({
                actionType: server_editor_namespaceObject.ActionTypes.NoArgsAction,
                onExecute: () => {
                    this._pasteFromClipboard();
                }
            });
            this._session.inputManager.registerKeyBinding(server_editor_namespaceObject.EditorInputContext.GlobalToolMode, simpleCopyAction, {
                key: server_editor_namespaceObject.KeyboardKey.KEY_C,
                modifier: server_editor_namespaceObject.InputModifier.Control
            }, {
                uniqueId: "editor:toolModeKeyBinding:copySelection",
                label: "resourcePack.editor.copypaste.keyBinding.copy"
            });
            this._session.inputManager.registerKeyBinding(server_editor_namespaceObject.EditorInputContext.GlobalToolMode, simpleCutAction, {
                key: server_editor_namespaceObject.KeyboardKey.KEY_X,
                modifier: server_editor_namespaceObject.InputModifier.Control
            }, {
                uniqueId: "editor:toolModeKeyBinding:cutSelection",
                label: "resourcePack.editor.copypaste.keyBinding.cut"
            });
            this._session.inputManager.registerKeyBinding(server_editor_namespaceObject.EditorInputContext.GlobalToolMode, simplePasteAction, {
                key: server_editor_namespaceObject.KeyboardKey.KEY_V,
                modifier: server_editor_namespaceObject.InputModifier.Control
            }, {
                uniqueId: "editor:toolModeKeyBinding:paste",
                label: "resourcePack.editor.copypaste.keyBinding.paste"
            });
            this._copyActionBar = uiSession.actionBar.registerItem("editor:copypaste:copy", simpleCopyAction, {
                label: "resourcePack.editor.copypaste.actionbar.copy.title",
                icon: "copyIcon",
                tooltipTitle: "resourcePack.editor.copypaste.actionbar.copy.tooltip",
                tooltipDescription: "resourcePack.editor.copypaste.actionbar.copy.tooltipDescription",
                enabled: true
            });
            this._cutActionBar = uiSession.actionBar.registerItem("editor:copypaste:cut", simpleCutAction, {
                label: "resourcePack.editor.copypaste.actionbar.cut.title",
                icon: "cutIcon",
                tooltipTitle: "resourcePack.editor.copypaste.actionbar.cut.tooltip",
                tooltipDescription: "resourcePack.editor.copypaste.actionbar.cut.tooltipDescription",
                enabled: true
            });
            this.session.menuBar.getMenu(server_editor_namespaceObject.CoreMenuType.Edit).then((menu => {
                menu.addItem({
                    label: "resourcePack.editor.copypaste.menu.copy.title",
                    uniqueId: "editor:copypaste:menu:copy"
                }, simpleCopyAction);
                menu.addItem({
                    label: "resourcePack.editor.copypaste.menu.cut.title",
                    uniqueId: "editor:copypaste:menu:cut"
                }, simpleCutAction);
            })).catch((() => {
                this.session.log.error('Failed to add root menu item "copy/paste"');
            }));
        }
        get session() {
            return this._session;
        }
        async _copySelectionToClipboard() {
            const selection = this.session.extensionContext.selectionManager.selection;
            if (!selection.isEmpty) {
                this.session.extensionContext.clipboardManager.clipboard.clear();
                await executeTickSafeOperation(this._session.extensionContext, this._session.log, selection.getBoundingBox(), "copy-paste-copy-operation", (() => {
                    this.session.extensionContext.clipboardManager.clipboard.readFromSelection(selection);
                }));
            } else {
                this.session.log.info("Unable to copy to clipboard: selection is empty");
            }
        }
        _pasteFromClipboard() {
            const clipboardItem = this._session.extensionContext.clipboardManager.clipboard;
            if (clipboardItem.isEmpty) {
                this.session.log.info("Unable to paste to world: clipboard is empty");
                return;
            }
            const vector3_half = new lib.Vector3Builder(.5, .5, .5);
            const clipboardTarget = lib.Vector3Utils.add(this._session.extensionContext.cursor.getPosition(), vector3_half);
            const transactionManager = this._session.extensionContext.transactionManager;
            transactionManager.openTransaction("Simple Paste");
            const writeOptions = {
                normalizedOrigin: new lib.Vector3Builder(0, 0, 0),
                offset: new lib.Vector3Builder(0, 0, 0),
                mirror: server_namespaceObject.StructureMirrorAxis.None,
                rotation: server_namespaceObject.StructureRotation.None
            };
            try {
                const wroteOK = clipboardItem.writeToWorld(clipboardTarget, writeOptions);
                if (!wroteOK) {
                    throw new Error("unknown error");
                }
                transactionManager.commitOpenTransaction();
            } catch (e) {
                transactionManager.discardOpenTransaction();
                this.session.log.error(`Failed to write clipboard to world (${(0, server_editor_namespaceObject.stringFromException)(e)})`);
            }
        }
        teardown() {}
    }
    var FlattenTelemetry;
    (function(FlattenTelemetry) {
        FlattenTelemetry["StartFlatten"] = "StartFlatten";
        FlattenTelemetry["EndFlatten"] = "EndFlatten";
    })(FlattenTelemetry || (FlattenTelemetry = {}));
    class FlattenBrushBehavior {
        constructor(uiSession) {
            this.uiSession = uiSession;
            this.currentlySelectedHeight = 0;
            this.alreadyCulledRootBlocks = new Set;
            this.visualizerInstances = [];
            uiSession.log.debug(`Initializing ${FlattenBrushBehavior.BEHAVIOR_NAME}`);
            this.flattenThreshold = (0, server_editor_namespaceObject.makeObservable)(FlattenBrushBehavior.DEFAULT_FLATTEN_THRESHOLD);
            this.radius = (0, server_editor_namespaceObject.makeObservable)(FlattenBrushBehavior.DEFAULT_RADIUS);
            this.tool = this.createTool(uiSession);
            this.pane = this.createToolPane(uiSession);
            this.telemetryManager = new TelemetryManager(uiSession.extensionContext.player, TelemetrySource.Flatten);
            this.tool.bindPropertyPane(this.pane);
            this.widgetGroup = this.createVisualizer();
        }
        createTool(uiSession) {
            const toolToggleAction = uiSession.actionManager.createAction({
                actionType: server_editor_namespaceObject.ActionTypes.NoArgsAction,
                onExecute: () => {
                    uiSession.toolRail.setSelectedToolId(tool.id);
                }
            });
            const tool = uiSession.toolRail.addTool("editor:modalTool:flatten", {
                title: "resourcePack.editor.toolRail.flattenBrush.title",
                icon: "pack://textures/editor/Flatten.png?filtering=point",
                tooltip: "resourcePack.editor.toolRail.flattenBrush.tooltip",
                action: toolToggleAction
            });
            tool.onModalToolActivation.subscribe((eventData => {
                if (eventData.isActiveTool) {
                    const cursorProperties = uiSession.extensionContext.cursor.getProperties();
                    cursorProperties.controlMode = server_editor_namespaceObject.CursorControlMode.KeyboardAndMouse;
                    cursorProperties.targetMode = server_editor_namespaceObject.CursorTargetMode.Block;
                    cursorProperties.visible = true;
                    uiSession.extensionContext.cursor.setProperties(cursorProperties);
                    this.widgetGroup.visible = true;
                } else {
                    this.widgetGroup.visible = false;
                }
            }));
            uiSession.inputManager.registerKeyBinding(server_editor_namespaceObject.EditorInputContext.GlobalToolMode, toolToggleAction, {
                key: server_editor_namespaceObject.KeyboardKey.KEY_H,
                modifier: server_editor_namespaceObject.InputModifier.Control | server_editor_namespaceObject.InputModifier.Shift
            });
            const startExecuteAction = uiSession.actionManager.createAction({
                actionType: server_editor_namespaceObject.ActionTypes.MouseRayCastAction,
                onExecute: (mouseRay, mouseProps) => {
                    if (mouseProps.inputType === server_editor_namespaceObject.MouseInputType.DragStart && uiSession.toolRail.getSelectedToolId() === this.tool.id && mouseRay?.cursorBlockLocation) {
                        this.telemetryManager.fireTelemetryEvent(FlattenTelemetry.StartFlatten);
                        const targetLocation = mouseRay.cursorBlockLocation;
                        this.currentlySelectedHeight = targetLocation.y;
                        uiSession.extensionContext.transactionManager.openTransaction("Flatten Brush Action");
                        this.alreadyCulledRootBlocks.clear();
                        this.removeBlocksAbove(uiSession, targetLocation);
                    }
                }
            });
            const dragExecuteAction = uiSession.actionManager.createAction({
                actionType: server_editor_namespaceObject.ActionTypes.MouseRayCastAction,
                onExecute: (mouseRay, mouseProps) => {
                    if (mouseProps.inputType === server_editor_namespaceObject.MouseInputType.Drag && uiSession.toolRail.getSelectedToolId() === this.tool.id && mouseRay?.cursorBlockLocation) {
                        const targetLocation = mouseRay.cursorBlockLocation;
                        if (targetLocation.y < uiSession.extensionContext.player.dimension.heightRange.max) {
                            this.removeBlocksAbove(uiSession, targetLocation);
                        }
                    }
                }
            });
            const endExecuteAction = uiSession.actionManager.createAction({
                actionType: server_editor_namespaceObject.ActionTypes.MouseRayCastAction,
                onExecute: (_, mouseProps) => {
                    if (mouseProps.inputType === server_editor_namespaceObject.MouseInputType.DragEnd && uiSession.toolRail.getSelectedToolId() === this.tool.id) {
                        this.telemetryManager.fireTelemetryEvent(FlattenTelemetry.EndFlatten, {
                            settings: {
                                radius: this.radius.value,
                                heightThreshold: this.flattenThreshold.value
                            }
                        });
                        uiSession.extensionContext.transactionManager.commitOpenTransaction();
                    }
                }
            });
            tool.registerMouseDragBinding(startExecuteAction);
            tool.registerMouseDragBinding(dragExecuteAction);
            tool.registerMouseDragBinding(endExecuteAction);
            return tool;
        }
        createToolPane(uiSession) {
            const pane = uiSession.createPropertyPane({
                title: "resourcePack.editor.toolRail.flattenBrush.title",
                infoTooltip: {
                    description: [ "resourcePack.editor.toolRail.flattenBrush.tooltip", {
                        link: "https://aka.ms/BedrockEditorFlattenTool",
                        text: "resourcePack.editor.help.learnMore"
                    } ]
                }
            });
            pane.addNumber(this.flattenThreshold, {
                title: "resourcePack.editor.toolRail.flattenBrush.settings.heightThreshold",
                min: FlattenBrushBehavior.MIN_HEIGHT,
                max: FlattenBrushBehavior.MAX_HEIGHT,
                isInteger: true,
                variant: server_editor_namespaceObject.NumberPropertyItemVariant.InputFieldAndSlider
            });
            pane.addNumber(this.radius, {
                title: "resourcePack.editor.toolRail.flattenBrush.settings.radius",
                min: FlattenBrushBehavior.MIN_RADIUS,
                max: FlattenBrushBehavior.MAX_RADIUS,
                isInteger: true,
                onChange: newValue => {
                    this.relativeBlockPosToFlatten = generateFloorBlockOffsetListFromRadiusAndCenter(newValue);
                    this.visualizerInstances.forEach((instance => {
                        instance.disc.radius = newValue + FlattenBrushBehavior.BASE_RADIUS_ADJUSTMENT + instance.radiusAdjustment;
                        instance.renderComp.setPrimitive(instance.disc);
                    }));
                },
                variant: server_editor_namespaceObject.NumberPropertyItemVariant.InputFieldAndSlider
            });
            pane.hide();
            return pane;
        }
        removeBlocksAbove(uiSession, targetLocation) {
            const toTrack = [];
            const start = this.currentlySelectedHeight + 1;
            if (!this.relativeBlockPosToFlatten) {
                this.relativeBlockPosToFlatten = generateFloorBlockOffsetListFromRadiusAndCenter(this.radius.value);
            }
            for (const blockPosOffset of this.relativeBlockPosToFlatten.getBlockLocationIterator()) {
                const absoluteBlockPos = {
                    x: targetLocation.x + blockPosOffset.x,
                    y: start,
                    z: targetLocation.z + blockPosOffset.z
                };
                if (!this.alreadyCulledRootBlocks.has(absoluteBlockPos)) {
                    this.alreadyCulledRootBlocks.add(absoluteBlockPos);
                    for (let i = start; i < uiSession.extensionContext.player.dimension.heightRange.max && i < this.flattenThreshold.value + start; i++) {
                        const block = uiSession.extensionContext.player.dimension.getBlock({
                            x: absoluteBlockPos.x,
                            y: i,
                            z: absoluteBlockPos.z
                        });
                        if (block && block.isSolid === true) {
                            toTrack.push(block.location);
                        }
                    }
                }
            }
            if (toTrack.length > 0) {
                uiSession.extensionContext.transactionManager.trackBlockChangeList(toTrack);
            }
            toTrack.forEach((location => {
                const block = uiSession.extensionContext.player.dimension.getBlock(location);
                if (block) {
                    block.setWaterlogged(false);
                    block.setType(MinecraftBlockTypes.Air);
                }
            }));
            return;
        }
        createVisualizer() {
            const widgetGroup = this.uiSession.extensionContext.widgetManager.createGroup({
                groupSelectionMode: server_editor_namespaceObject.WidgetGroupSelectionMode.None,
                visible: false
            });
            const options = {
                bindPositionToBlockCursor: true,
                collisionOffset: new lib.Vector3Builder(0, 0, 0),
                collisionRadius: 0,
                selectable: false,
                visible: true
            };
            this.widget = widgetGroup.createWidget(new lib.Vector3Builder(0, 0, 0), options);
            const renderOptions = {
                offset: new lib.Vector3Builder(.5, 1.1, .5),
                visible: true
            };
            for (let i = 0; i < FlattenBrushBehavior.NUM_VISUALIZER_INSTANCES; i++) {
                const radAdjustment = FlattenBrushBehavior.VISUALIZER_INSTANCE_RADIUS_INCREMENT * i;
                const disc = new server_editor_namespaceObject.WidgetComponentRenderPrimitiveTypeDisc(new lib.Vector3Builder(0, 0, 0), FlattenBrushBehavior.DEFAULT_RADIUS + FlattenBrushBehavior.BASE_RADIUS_ADJUSTMENT + radAdjustment, FlattenBrushBehavior.DISC_COLOR);
                this.visualizerInstances[i] = {
                    radiusAdjustment: radAdjustment,
                    disc,
                    renderComp: this.widget.addRenderPrimitiveComponent(FlattenBrushBehavior.VISUALIZER_INSTANCE_BASE_NAME + i.toString(), disc, renderOptions)
                };
            }
            return widgetGroup;
        }
        teardown() {
            this.uiSession.log.debug(`Shutting down ${FlattenBrushBehavior.BEHAVIOR_NAME}`);
        }
    }
    FlattenBrushBehavior.BEHAVIOR_NAME = "Flatten Brush";
    FlattenBrushBehavior.DEFAULT_FLATTEN_THRESHOLD = 16;
    FlattenBrushBehavior.DEFAULT_RADIUS = 3;
    FlattenBrushBehavior.MIN_HEIGHT = 1;
    FlattenBrushBehavior.MAX_HEIGHT = 32;
    FlattenBrushBehavior.MIN_RADIUS = 1;
    FlattenBrushBehavior.MAX_RADIUS = 5;
    FlattenBrushBehavior.VISUALIZER_INSTANCE_RADIUS_INCREMENT = .001;
    FlattenBrushBehavior.BASE_RADIUS_ADJUSTMENT = .5;
    FlattenBrushBehavior.NUM_VISUALIZER_INSTANCES = 20;
    FlattenBrushBehavior.DISC_COLOR = {
        red: 1,
        green: 0,
        blue: 0,
        alpha: .3
    };
    function generateFloorBlockOffsetListFromRadiusAndCenter(radius) {
        return calculateCylinderCompoundBlockVolume(radius, radius, 1, ExtrudeAxis.YAxis);
    }
    const ALL_DIRECTIONS = [ Direction.Up, Direction.Down, Direction.Left, Direction.Right, Direction.Forward, Direction.Back ];
    var SmartFillTelemetry;
    (function(SmartFillTelemetry) {
        SmartFillTelemetry["Fill"] = "Fill";
    })(SmartFillTelemetry || (SmartFillTelemetry = {}));
    class SmartFillToolBehavior {
        constructor(uiSession) {
            this.uiSession = uiSession;
            this.SELECTION_COLOR = {
                red: 0,
                green: .85,
                blue: .95,
                alpha: 1
            };
            uiSession.log.debug(`Initializing ${SmartFillToolBehavior.BEHAVIOR_NAME}`);
            this.telemetryManager = new TelemetryManager(uiSession.extensionContext.player, TelemetrySource.SmartFill);
            this.cursorProperties = uiSession.extensionContext.cursor.getProperties();
            if (this.cursorProperties.fillColor) {
                delete this.cursorProperties.fillColor;
            }
            this.cursorProperties.outlineColor = this.SELECTION_COLOR;
            this.cursorProperties.controlMode = server_editor_namespaceObject.CursorControlMode.KeyboardAndMouse;
            this.cursorProperties.targetMode = server_editor_namespaceObject.CursorTargetMode.Block;
            this.cursorProperties.visible = true;
            this.currentAreaLimit = (0, server_editor_namespaceObject.makeObservable)(SmartFillToolBehavior.AREA_LIMIT);
            this.tool = this.addTool(uiSession);
            this.pane = this.buildPane(uiSession, this.tool);
            this.pane.hide();
            this.tool.bindPropertyPane(this.pane);
        }
        teardown() {
            this.uiSession.log.debug(`Shutting down ${SmartFillToolBehavior.BEHAVIOR_NAME}`);
        }
        addTool(uiSession) {
            const tool = uiSession.toolRail.addTool("editor:modalTool:smartFill", {
                title: "resourcePack.editor.toolRail.smartFillTool.title",
                icon: "pack://textures/editor/Fill.png?filtering=point",
                tooltip: "resourcePack.editor.toolRail.smartFillTool.tooltip"
            });
            tool.onModalToolActivation.subscribe((eventData => {
                if (eventData.isActiveTool) {
                    this.backedUpColors = backupColors(uiSession.extensionContext);
                    uiSession.extensionContext.cursor.setProperties(this.cursorProperties);
                } else {
                    if (this.backedUpColors) {
                        restoreBackedUpColors(uiSession.extensionContext, this.backedUpColors);
                        this.backedUpColors = undefined;
                    }
                }
            }));
            const executeAction = uiSession.actionManager.createAction({
                actionType: server_editor_namespaceObject.ActionTypes.MouseRayCastAction,
                onExecute: async (mouseRay, mouseProps) => {
                    if (mouseProps.mouseAction === server_editor_namespaceObject.MouseActionType.LeftButton && mouseProps.inputType === server_editor_namespaceObject.MouseInputType.ButtonUp && uiSession.toolRail.getSelectedToolId() === this.tool.id && mouseRay?.cursorBlockLocation) {
                        const targetLocation = mouseRay.cursorBlockLocation;
                        const selection = await this.generateFillVolumeSelection(uiSession, targetLocation);
                        if (selection === undefined || selection.isEmpty) {
                            uiSession.log.error("Failed to generate selection");
                            return;
                        }
                        await this.applyFillToSelection(uiSession, selection, SmartFillToolBehavior.WRITE_OPERATION_NAME, SmartFillToolBehavior.BEHAVIOR_NAME);
                    }
                }
            });
            tool.registerMouseButtonBinding(executeAction);
            return tool;
        }
        async generateFillVolumeSelection(uiSession, targetLocation) {
            const selection = await this.buildFloodSelectionFromLocation(uiSession, targetLocation, ALL_DIRECTIONS, this.currentAreaLimit.value, SmartFillToolBehavior.READ_OPERATION_NAME);
            return selection;
        }
        async buildFloodSelectionFromLocation(uiSession, targetLocation, allowedDirections, areaLimit, operationName) {
            const player = uiSession.extensionContext.player;
            const dimension = player.dimension;
            const consideredLocations = new Set([ lib.Vector3Utils.toString(targetLocation) ]);
            const addedLocations = new Set;
            const stack = [ targetLocation ];
            const globalSelection = uiSession.extensionContext.selectionManager.selection;
            const globalSelectionSet = new Set;
            if (!globalSelection.isEmpty) {
                const iterator = globalSelection.getBlockLocationIterator();
                for (const position of iterator) {
                    globalSelectionSet.add(lib.Vector3Utils.toString(position));
                }
            }
            const selection = uiSession.extensionContext.selectionManager.create();
            const BOX_SIZE = areaLimit;
            const min = lib.Vector3Utils.subtract(targetLocation, {
                x: BOX_SIZE,
                y: BOX_SIZE,
                z: BOX_SIZE
            });
            const max = lib.Vector3Utils.add(targetLocation, {
                x: BOX_SIZE,
                y: BOX_SIZE,
                z: BOX_SIZE
            });
            const bounds = server_namespaceObject.BoundingBoxUtils.createValid(min, max);
            const targetBlock = dimension.getBlock(targetLocation)?.typeId;
            if (targetBlock === undefined) {
                uiSession.log.error("Starting block was undefined, this likely means the block was too far away");
                return selection;
            }
            const operation = () => {
                while (stack.length > 0) {
                    const currentLocation = stack.pop();
                    if (currentLocation === undefined || !server_namespaceObject.BoundingBoxUtils.isInside(bounds, currentLocation) || dimension.getBlock(currentLocation)?.typeId !== targetBlock || globalSelectionSet.size > 0 && !globalSelectionSet.has(lib.Vector3Utils.toString(currentLocation))) {
                        continue;
                    }
                    selection.pushVolume({
                        action: server_namespaceObject.CompoundBlockVolumeAction.Add,
                        volume: new server_namespaceObject.BlockVolume(currentLocation, currentLocation)
                    });
                    addedLocations.add(lib.Vector3Utils.toString(currentLocation));
                    for (const direction of ALL_DIRECTIONS) {
                        if (allowedDirections.length > 0 && !allowedDirections.includes(direction)) {
                            continue;
                        }
                        const directionVector = getDirectionVector(direction);
                        const newLocation = lib.Vector3Utils.add(currentLocation, directionVector);
                        const newLocationString = lib.Vector3Utils.toString(newLocation);
                        if (!consideredLocations.has(newLocationString)) {
                            stack.push(newLocation);
                            consideredLocations.add(newLocationString);
                        }
                    }
                }
            };
            const onError = e => {
                uiSession.log.error(`${operationName} operation failed with error: ${e.message}`);
            };
            await executeTickSafeOperation(uiSession.extensionContext, uiSession.log, bounds, `${operationName}`, operation).catch(onError);
            return selection;
        }
        async applyFillToSelection(uiSession, selection, operationName, toolName) {
            const onError = e => {
                uiSession.log.error(`${toolName} operation failed with error: ${e.message}`);
            };
            this.telemetryManager.fireTelemetryEvent(SmartFillTelemetry.Fill, {
                selectionSize: lib.Vector3Utils.subtract(selection.getBoundingBox().max, selection.getBoundingBox().min)
            });
            await executeFunctionWithTransactionAndTicking(uiSession.extensionContext, uiSession.log, selection, operationName, (() => {
                uiSession.extensionContext.blockUtilities.fillVolume(selection);
            })).catch(onError);
        }
        buildPane(uiSession, tool) {
            const pane = uiSession.createPropertyPane({
                title: "resourcePack.editor.toolRail.smartFillTool.title",
                infoTooltip: {
                    description: [ "resourcePack.editor.toolRail.smartFillTool.tooltip", {
                        link: "https://aka.ms/BedrockEditorSmartFill",
                        text: "resourcePack.editor.help.learnMore"
                    } ]
                }
            });
            pane.addNumber(this.currentAreaLimit, {
                isInteger: true,
                max: SmartFillToolBehavior.AREA_LIMIT,
                min: 1,
                title: "resourcePack.editor.toolRail.smartFillTool.areaLimit.title",
                tooltip: "resourcePack.editor.toolRail.smartFillTool.areaLimit.tooltip",
                variant: server_editor_namespaceObject.NumberPropertyItemVariant.InputFieldAndSlider
            });
            tool.bindPropertyPane(pane);
            return pane;
        }
    }
    SmartFillToolBehavior.BEHAVIOR_NAME = "Smart Fill Tool";
    SmartFillToolBehavior.READ_OPERATION_NAME = "Smart-Fill-Read";
    SmartFillToolBehavior.WRITE_OPERATION_NAME = "Smart-Fill-Write";
    SmartFillToolBehavior.AREA_LIMIT = 16;
    SmartFillToolBehavior.DEFAULT_FILL_PERCENTAGE = 100;
    var TerrainMode;
    (function(TerrainMode) {
        TerrainMode[TerrainMode["SmoothMode"] = 1] = "SmoothMode";
    })(TerrainMode || (TerrainMode = {}));
    var TerrainTelemetry;
    (function(TerrainTelemetry) {
        TerrainTelemetry["StartPaining"] = "StartPaining";
        TerrainTelemetry["EndPainting"] = "EndPainting";
    })(TerrainTelemetry || (TerrainTelemetry = {}));
    class SmoothRoughenBehavior {
        constructor(_session) {
            this._session = _session;
            this._paintingActive = false;
            this._terrainMode = (0, server_editor_namespaceObject.makeObservable)(TerrainMode.SmoothMode);
            this._smoothStrength = (0, server_editor_namespaceObject.makeObservable)(9);
            this._cursorProperties = {
                outlineColor: {
                    red: 0,
                    green: .5,
                    blue: .5,
                    alpha: .2
                },
                controlMode: server_editor_namespaceObject.CursorControlMode.KeyboardAndMouse,
                targetMode: server_editor_namespaceObject.CursorTargetMode.Block,
                visible: true
            };
            this.telemetryManager = new TelemetryManager(_session.extensionContext.player, TelemetrySource.Terrain);
            const activationAction = this._session.actionManager.createAction({
                actionType: server_editor_namespaceObject.ActionTypes.NoArgsAction,
                onExecute: () => {
                    this._session.toolRail.setSelectedToolId(this._tool.id);
                }
            });
            this._tool = this._session.toolRail.addTool("editor:Smooth", {
                title: "resourcePack.editor.toolRail.Terrain.title",
                icon: "pack://textures/editor/Terrain.png?filtering=point",
                tooltip: "resourcePack.editor.toolRail.Terrain.description",
                action: activationAction
            });
            this._rootPane = this._session.createPropertyPane({
                title: "resourcePack.editor.toolRail.Terrain.title",
                infoTooltip: {
                    description: [ "resourcePack.editor.toolRail.Terrain.description", {
                        link: "https://aka.ms/BedrockEditorSmoothRoughen",
                        text: "resourcePack.editor.help.learnMore"
                    } ]
                }
            });
            this._tool.bindPropertyPane(this._rootPane);
            const bindManualControls = true;
            this._cursorModeControl = new CursorModeControl(this._session, this._tool, this._rootPane, bindManualControls, this._cursorProperties);
            this._cursorModeControl.initialize();
            this._brushControl = new BrushPaintSharedControl(this._session, this._tool, this._rootPane, {
                paintMode: server_editor_namespaceObject.PaintMode.Smooth,
                brushShapeType: server_editor_bindings_namespaceObject.BrushShapeType.OffsetList
            });
            this._brushControl.initialize();
            this._rootPane.addToggleGroup(this._terrainMode, {
                title: "resourcePack.editor.toolRail.Terrain.Mode.title",
                hiddenLabel: false,
                entries: [ {
                    value: TerrainMode.SmoothMode,
                    label: "resourcePack.editor.toolRail.Terrain.Smooth.mode.title",
                    icon: "pack://textures/editor/Terrain-Smooth.png?filtering=point",
                    tooltip: "resourcePack.editor.toolRail.Terrain.Smooth.tooltip"
                } ]
            });
            this._rootPane.addNumber(this._smoothStrength, {
                isInteger: true,
                max: 9,
                min: 0,
                onChange: newValue => {
                    this._session.extensionContext.brushShapeManager.setSmoothStrength(newValue);
                },
                title: "resourcePack.editor.toolRail.Terrain.SmoothStrength",
                variant: server_editor_namespaceObject.NumberPropertyItemVariant.InputFieldAndSlider
            });
            this._tool.onModalToolActivation.subscribe((data => {
                if (data.isActiveTool) {
                    this._cursorModeControl.activateControl();
                    this._brushControl.activateControl();
                    this._brushControl.activateVisualization();
                } else {
                    if (this._paintingActive) {
                        this._endPainting();
                    }
                    this._cursorModeControl.deactivateControl();
                    this._brushControl.deactivateControl();
                    this._brushControl.deactivateVisualization();
                }
            }));
            this._registerMouseUpDownAction();
        }
        _registerMouseUpDownAction() {
            const action = this._session.actionManager.createAction({
                actionType: server_editor_namespaceObject.ActionTypes.MouseRayCastAction,
                onExecute: (_mouseRay, mouseProps) => {
                    if (mouseProps.mouseAction === server_editor_namespaceObject.MouseActionType.LeftButton) {
                        if (mouseProps.inputType === server_editor_namespaceObject.MouseInputType.ButtonDown) {
                            this.telemetryManager.fireTelemetryEvent(TerrainTelemetry.StartPaining);
                            this._beginPainting();
                        } else if (mouseProps.inputType === server_editor_namespaceObject.MouseInputType.ButtonUp && this._paintingActive) {
                            this.telemetryManager.fireTelemetryEvent(TerrainTelemetry.EndPainting, {
                                smoothingStrength: this._smoothStrength.value,
                                offset: this._session.extensionContext.brushShapeManager.getBrushShapeOffset()
                            });
                            this._endPainting();
                        }
                    }
                }
            });
            this._tool.registerMouseButtonBinding(action);
        }
        _beginPainting() {
            this._paintingActive = true;
            this._brushControl.hideVisualization();
            this._session.extensionContext.transactionManager.openTransaction("Smooth");
            this._session.extensionContext.brushShapeManager.beginPainting((state => {
                if (state === server_editor_bindings_namespaceObject.PaintCompletionState.Success) {
                    this._session.extensionContext.transactionManager.commitOpenTransaction();
                } else {
                    this._session.extensionContext.transactionManager.discardOpenTransaction();
                    this._session.log.error(`Error during smoothing`);
                }
                this._paintingActive = false;
            }));
        }
        _endPainting() {
            this._paintingActive = false;
            this._brushControl.showVisualization();
            this._session.extensionContext.brushShapeManager.endPainting(false);
        }
        teardown() {
            this._cursorModeControl.shutdown();
            this._brushControl.shutdown();
        }
    }
    SmoothRoughenBehavior.BEHAVIOR_NAME = "Terrain";
    const ExtrudeTool_mapMarkerEntityName = "editor:map_marker";
    var ContiguousSelectionType;
    (function(ContiguousSelectionType) {
        ContiguousSelectionType[ContiguousSelectionType["SameBlock"] = 0] = "SameBlock";
        ContiguousSelectionType[ContiguousSelectionType["BlockStates"] = 1] = "BlockStates";
        ContiguousSelectionType[ContiguousSelectionType["SolidBlock"] = 2] = "SolidBlock";
        ContiguousSelectionType[ContiguousSelectionType["AllBlocks"] = 3] = "AllBlocks";
        ContiguousSelectionType[ContiguousSelectionType["Custom"] = 4] = "Custom";
    })(ContiguousSelectionType || (ContiguousSelectionType = {}));
    var ExtrusionType;
    (function(ExtrusionType) {
        ExtrusionType[ExtrusionType["Extrude"] = 0] = "Extrude";
        ExtrusionType[ExtrusionType["QuickExtrude"] = 1] = "QuickExtrude";
    })(ExtrusionType || (ExtrusionType = {}));
    var QuickExtrudeMode;
    (function(QuickExtrudeMode) {
        QuickExtrudeMode[QuickExtrudeMode["Shrink"] = 0] = "Shrink";
        QuickExtrudeMode[QuickExtrudeMode["Grow"] = 1] = "Grow";
    })(QuickExtrudeMode || (QuickExtrudeMode = {}));
    var ExtrudeTool_SelectionMode;
    (function(SelectionMode) {
        SelectionMode[SelectionMode["Contiguous"] = 0] = "Contiguous";
        SelectionMode[SelectionMode["Marquee"] = 1] = "Marquee";
    })(ExtrudeTool_SelectionMode || (ExtrudeTool_SelectionMode = {}));
    var ExtrudeTelemetry;
    (function(ExtrudeTelemetry) {
        ExtrudeTelemetry["QuickExtrude"] = "QuickExtrude";
    })(ExtrudeTelemetry || (ExtrudeTelemetry = {}));
    class ExtrudeTool {
        constructor(uiSession) {
            this.uiSession = uiSession;
            this.SELECTION_COLOR = {
                red: 1,
                green: 1,
                blue: 1,
                alpha: 0
            };
            this.SELECTION_OUTLINE_COLOR = {
                red: 1,
                green: 1,
                blue: 1,
                alpha: .1
            };
            this.SHRINK_SELECTION_COLOR = {
                red: 1,
                green: 0,
                blue: 0,
                alpha: 1
            };
            this.GROW_SELECTION_COLOR = {
                red: 0,
                green: 0,
                blue: 1,
                alpha: 1
            };
            this.extruderSettingsSubPane = undefined;
            this.quickExtrudeSettingsSubPane = undefined;
            this.contiguousSelectionBlockList = [];
            this.previousSelection = new Map;
            this.searchOffsets = [];
            this.selectStack = new Map;
            this.quickExtrudeFaceSelection = new Map;
            this.trackList = new Map;
            this.UseMarqueeSelection = (mouseRay, shiftPressed, ctrlPressed, altPressed) => {
                const clickLoc = mouseRay.cursorBlockLocation;
                const dimension = this.uiSession.extensionContext.player.dimension;
                const raycastFace = dimension.getBlockFromRay(mouseRay.location, mouseRay.direction)?.face;
                if (raycastFace === undefined) {
                    return undefined;
                }
                if (!shiftPressed && !ctrlPressed && !altPressed) {
                    this.widget?.delete();
                    this.widget = undefined;
                    this.preview.clear();
                    this.preview.pushVolume({
                        action: server_namespaceObject.CompoundBlockVolumeAction.Add,
                        volume: new server_namespaceObject.BlockVolume(clickLoc, clickLoc)
                    });
                    this.selectStack.clear();
                    this.selectStack.set(lib.Vector3Utils.toString(clickLoc), clickLoc);
                    this.anchorPreviewLocation = clickLoc;
                    this.currentPreviewLocation = clickLoc;
                    this._addWidget(clickLoc, raycastFace);
                } else if (shiftPressed && !ctrlPressed && !altPressed) {
                    if (this.preview.isEmpty) {
                        this.preview.pushVolume({
                            action: server_namespaceObject.CompoundBlockVolumeAction.Add,
                            volume: new server_namespaceObject.BlockVolume(clickLoc, clickLoc)
                        });
                        this.widget?.delete();
                        this.widget = undefined;
                        this.selectStack.clear();
                        this.selectStack.set(lib.Vector3Utils.toString(clickLoc), clickLoc);
                        this.anchorPreviewLocation = clickLoc;
                        this.currentPreviewLocation = clickLoc;
                        this._addWidget(clickLoc, raycastFace);
                    } else {
                        const lastAnchorPosition = this.anchorPreviewLocation;
                        const lastVolume = this.preview.peekLastVolume();
                        this.preview.popVolume();
                        try {
                            this.preview.pushVolume({
                                action: server_namespaceObject.CompoundBlockVolumeAction.Add,
                                volume: new server_namespaceObject.BlockVolume(lastAnchorPosition, clickLoc)
                            });
                            this._addVolumeToSelectStack(lastAnchorPosition, clickLoc);
                        } catch {
                            if (lastVolume) {
                                this.preview.pushVolume(lastVolume);
                            }
                        }
                    }
                } else if (ctrlPressed && !shiftPressed && !altPressed) {
                    let success = true;
                    try {
                        this.preview.pushVolume({
                            action: server_namespaceObject.CompoundBlockVolumeAction.Add,
                            volume: new server_namespaceObject.BlockVolume(clickLoc, clickLoc)
                        });
                    } catch {
                        success = false;
                    }
                    if (success) {
                        this.widget?.delete();
                        this.widget = undefined;
                        this.anchorPreviewLocation = clickLoc;
                        this.currentPreviewLocation = clickLoc;
                        this._addWidget(clickLoc, raycastFace);
                        this.selectStack.set(lib.Vector3Utils.toString(clickLoc), clickLoc);
                    }
                } else if (altPressed && !shiftPressed && !ctrlPressed) {
                    const currentItem = this.preview.peekLastVolume();
                    if (!currentItem) {
                        this.preview.pushVolume({
                            action: server_namespaceObject.CompoundBlockVolumeAction.Add,
                            volume: new server_namespaceObject.BlockVolume(clickLoc, clickLoc)
                        });
                        this.widget?.delete();
                        this.widget = undefined;
                        this.selectStack.clear();
                        this.selectStack.set(lib.Vector3Utils.toString(clickLoc), clickLoc);
                        this.anchorPreviewLocation = clickLoc;
                        this.currentPreviewLocation = clickLoc;
                        this._addWidget(clickLoc, raycastFace);
                    } else {
                        const currentVolume = currentItem.volume;
                        const currentBounds = currentVolume.getBoundingBox();
                        const translatedRayLocation = lib.Vector3Utils.subtract(mouseRay.location, currentBounds.min);
                        const XYPlaneNormal = getRelativeXYAxisAsNormal(this.uiSession.extensionContext.player.getRotation().y);
                        const intersection = intersectRayPlane(translatedRayLocation, mouseRay.direction, XYPlaneNormal, 0);
                        if (intersection) {
                            const translatedIntersection = lib.Vector3Utils.add(intersection, currentBounds.min);
                            const newY = Math.ceil(translatedIntersection.y) - 1;
                            const VolumeStart = {
                                x: currentBounds.min.x,
                                y: currentBounds.min.y,
                                z: currentBounds.min.z
                            };
                            const VolumeEnd = {
                                x: currentBounds.max.x,
                                y: newY,
                                z: currentBounds.max.z
                            };
                            this.preview.popVolume();
                            this.preview.pushVolume({
                                action: currentItem.action,
                                volume: new server_namespaceObject.BlockVolume(VolumeStart, VolumeEnd)
                            });
                            this._addVolumeToSelectStack(VolumeStart, VolumeEnd);
                        }
                    }
                }
            };
            this.faceSize = (0, server_editor_namespaceObject.makeObservable)(ExtrudeTool.MAX_FACE_SIZE);
            this.contiguousSelectionType = (0, server_editor_namespaceObject.makeObservable)(ContiguousSelectionType.SameBlock);
            this.extrusionType = (0, server_editor_namespaceObject.makeObservable)(ExtrusionType.QuickExtrude);
            this.layerCount = (0, server_editor_namespaceObject.makeObservable)(ExtrudeTool.MIN_LAYERS);
            this.hasAdjacentBlocks = (0, server_editor_namespaceObject.makeObservable)(false);
            this.hasOpenedTransaction = false;
            this.hasPendingWidgetTransaction = false;
            this.hasTrailingBlocks = (0, server_editor_namespaceObject.makeObservable)(true);
            this.quickExtrudeFaceDirection = 0;
            this.quickExtrudePreviewActive = false;
            this.quickExtrudeMode = (0, server_editor_namespaceObject.makeObservable)(QuickExtrudeMode.Grow);
            this.sampleCount = (0, server_editor_namespaceObject.makeObservable)(ExtrudeTool.MIN_SAMPLES);
            this.searchRadius = (0, server_editor_namespaceObject.makeObservable)(ExtrudeTool.MIN_RADIUS);
            this.selectionMode = (0, server_editor_namespaceObject.makeObservable)(ExtrudeTool_SelectionMode.Marquee);
            this.toleranceLevel = (0, server_editor_namespaceObject.makeObservable)(ExtrudeTool.MIN_TOLERANCE);
            this.telemetryManager = new TelemetryManager(uiSession.extensionContext.player, TelemetrySource.Extrude);
            this.quickExtrudeSelectionWidgetGroup = this.uiSession.extensionContext.widgetManager.createGroup({
                groupSelectionMode: server_editor_namespaceObject.WidgetGroupSelectionMode.Multiple,
                visible: true
            });
            this.quickExtrudeSelectionWidget = this.quickExtrudeSelectionWidgetGroup.createWidget({
                x: 0,
                y: 0,
                z: 0
            }, {
                selectable: false,
                snapToBlockLocation: true,
                visible: true
            });
            this.tool = this._createTool(uiSession);
            this.pane = this._createToolPane(uiSession);
            this.cursorProperties = uiSession.extensionContext.cursor.getProperties();
            this.cursorProperties.outlineColor = {
                red: 2,
                green: 1,
                blue: 2,
                alpha: 1
            };
            this.cursorProperties.controlMode = server_editor_namespaceObject.CursorControlMode.KeyboardAndMouse;
            this.cursorProperties.targetMode = server_editor_namespaceObject.CursorTargetMode.Block;
            this.cursorProperties.visible = true;
            this.searchOffsets.push({
                x: 0,
                y: 0,
                z: 0
            });
            for (let x = -1; x <= 1; x += 2) {
                this.searchOffsets.push({
                    x,
                    y: 0,
                    z: 0
                });
            }
            for (let y = -1; y <= 1; y += 2) {
                this.searchOffsets.push({
                    x: 0,
                    y,
                    z: 0
                });
            }
            for (let z = -1; z <= 1; z += 2) {
                this.searchOffsets.push({
                    x: 0,
                    y: 0,
                    z
                });
            }
            this.preview = uiSession.extensionContext.selectionManager.create();
            this.preview.setOutlineColor(this.SELECTION_OUTLINE_COLOR);
            this.preview.setFillColor(this.SELECTION_COLOR);
            this.previousAnchorPosition = {
                x: 0,
                y: 0,
                z: 0
            };
            this.previousWidgetPosition = {
                x: 0,
                y: 0,
                z: 0
            };
            this.currentPreviewLocation = {
                x: 0,
                y: 0,
                z: 0
            };
            this.anchorPreviewLocation = {
                x: 0,
                y: 0,
                z: 0
            };
            this.quickExtrudePreviewPosition = {
                x: 0,
                y: 0,
                z: 0
            };
            const groupOptions = {
                groupSelectionMode: server_editor_namespaceObject.WidgetGroupSelectionMode.Multiple
            };
            this.widgetGroup = uiSession.extensionContext.widgetManager.createGroup(groupOptions);
            this._registerMouseAction(uiSession);
            this.tool.bindPropertyPane(this.pane);
            this._registerToolKeyBinding(uiSession.actionManager.createAction({
                actionType: server_editor_namespaceObject.ActionTypes.NoArgsAction,
                onExecute: () => {
                    this._clearState();
                }
            }), {
                key: server_editor_namespaceObject.KeyboardKey.KEY_D,
                modifier: server_editor_namespaceObject.InputModifier.Control
            }, "deselect");
            this.completedSelectionTransactionHandler = (0, server_editor_namespaceObject.registerUserDefinedTransactionHandler)(this.uiSession.extensionContext.transactionManager, (() => {
                this._drawPreviewFromSelectStack();
            }), (() => {
                this._drawPreviewFromSelectStack();
            }));
            this.newSelectionTransactionHandler = (0, server_editor_namespaceObject.registerUserDefinedTransactionHandler)(this.uiSession.extensionContext.transactionManager, (payload => {
                const newSelectionArray = payload.differenceInNewSelection;
                if (newSelectionArray !== undefined) {
                    for (const selection of newSelectionArray) {
                        const selectionKey = lib.Vector3Utils.toString(selection);
                        this.selectStack.delete(selectionKey);
                    }
                }
            }), (payload => {
                const anchor = payload.newAnchorPosition;
                const newSelectionArray = payload.differenceInNewSelection;
                const position = payload.newWidgetPosition;
                if (this.widget !== undefined && anchor !== undefined && newSelectionArray !== undefined && position !== undefined) {
                    this.anchorPreviewLocation = anchor;
                    this.currentPreviewLocation = position;
                    this.widget.location = position;
                    for (const selection of newSelectionArray) {
                        const selectionKey = lib.Vector3Utils.toString(selection);
                        this.selectStack.set(selectionKey, selection);
                    }
                    this.previousAnchorPosition = anchor;
                    this.previousWidgetPosition = position;
                    this._copySelectionMap(this.previousSelection, this.selectStack);
                }
            }));
            this.oldSelectionTransactionHandler = (0, server_editor_namespaceObject.registerUserDefinedTransactionHandler)(this.uiSession.extensionContext.transactionManager, (payload => {
                const anchor = payload.oldAnchorPosition;
                const oldSelectionArray = payload.differenceInOldSelection;
                const position = payload.oldWidgetPosition;
                if (this.widget !== undefined && anchor !== undefined && oldSelectionArray !== undefined && position !== undefined) {
                    this.anchorPreviewLocation = anchor;
                    this.currentPreviewLocation = position;
                    this.widget.location = position;
                    for (const selection of oldSelectionArray) {
                        const selectionKey = lib.Vector3Utils.toString(selection);
                        this.selectStack.set(selectionKey, selection);
                    }
                    this.previousAnchorPosition = anchor;
                    this.previousWidgetPosition = position;
                    this._copySelectionMap(this.previousSelection, this.selectStack);
                    this._drawPreviewFromSelectStack();
                }
            }), (payload => {
                const oldSelectionArray = payload.differenceInOldSelection;
                if (oldSelectionArray !== undefined) {
                    for (const selection of oldSelectionArray) {
                        const selectionKey = lib.Vector3Utils.toString(selection);
                        this.selectStack.delete(selectionKey);
                    }
                    this._drawPreviewFromSelectStack();
                }
            }));
            this.quickExtrudePreviewActive = false;
            if (ExtrudeTool.ENABLE_VISUALIZATION) {
                const onTick = () => {
                    const cursor = this.uiSession.extensionContext.cursor;
                    const position = cursor.getPosition();
                    const direction = cursor.faceDirection;
                    if (this.quickExtrudePreviewActive && (!lib.Vector3Utils.equals(position, this.quickExtrudePreviewPosition) || direction !== this.quickExtrudeFaceDirection)) {
                        this.quickExtrudePreviewPosition = position;
                        this.quickExtrudeFaceDirection = direction;
                        this._createFacePreview();
                    }
                };
                this.tickHandle = server_namespaceObject.system.runInterval(onTick, ExtrudeTool.TICK_REFRESH_RATE);
            }
        }
        _createTool(uiSession) {
            const toolToggleAction = uiSession.actionManager.createAction({
                actionType: server_editor_namespaceObject.ActionTypes.NoArgsAction,
                onExecute: () => {
                    uiSession.toolRail.setSelectedToolId(tool.id);
                }
            });
            const tool = uiSession.toolRail.addTool("editor:modalTool:extrude", {
                title: "resourcePack.editor.toolRail.ExtrudeTool.title",
                icon: "pack://textures/editor/Lift.png?filtering=point",
                tooltip: "resourcePack.editor.toolRail.ExtrudeTool.tooltip",
                action: toolToggleAction
            });
            tool.onModalToolActivation.subscribe((eventData => {
                if (eventData.isActiveTool) {
                    uiSession.extensionContext.cursor.setProperties(this.cursorProperties);
                    if (this.extrusionType.value === ExtrusionType.QuickExtrude) {
                        this.quickExtrudePreviewActive = true;
                    } else {
                        this.quickExtrudePreviewActive = false;
                        this._destroyFacePreview();
                    }
                } else {
                    this.quickExtrudePreviewActive = false;
                    this._destroyFacePreview();
                    this._clearState();
                }
            }));
            uiSession.inputManager.registerKeyBinding(server_editor_namespaceObject.EditorInputContext.GlobalToolMode, toolToggleAction, {
                key: server_editor_namespaceObject.KeyboardKey.KEY_E,
                modifier: server_editor_namespaceObject.InputModifier.Control | server_editor_namespaceObject.InputModifier.Shift
            }, {
                uniqueId: "editorCore:ExtrudeTool:toggleTool",
                label: "resourcePack.editor.toolRail.ExtrudeTool.keyBinding.toggleTool"
            });
            return tool;
        }
        _createFacePreview() {
            if (!ExtrudeTool.ENABLE_VISUALIZATION) {
                return;
            }
            const cursor = this.uiSession.extensionContext.cursor;
            const cursorPosition = cursor.getPosition();
            const cursorDirection = cursor.faceDirection;
            let direction = server_namespaceObject.Direction.Down;
            const scale = {
                x: 1,
                y: 1,
                z: 1
            };
            const growthOffset = {
                x: 0,
                y: 0,
                z: 0
            };
            const shrinkDirection = {
                x: 0,
                y: 0,
                z: 0
            };
            switch (cursorDirection) {
              case 0:
                direction = server_namespaceObject.Direction.Down;
                if (this.quickExtrudeMode.value === QuickExtrudeMode.Grow) {
                    scale.y = 1 * this.layerCount.value;
                }
                growthOffset.y = -.5 * this.layerCount.value;
                shrinkDirection.y = 1;
                break;

              case 1:
                direction = server_namespaceObject.Direction.Up;
                if (this.quickExtrudeMode.value === QuickExtrudeMode.Grow) {
                    scale.y = 1 * this.layerCount.value;
                }
                growthOffset.y = .5;
                shrinkDirection.y = -1;
                break;

              case 2:
                direction = server_namespaceObject.Direction.North;
                if (this.quickExtrudeMode.value === QuickExtrudeMode.Grow) {
                    scale.z = 1 * this.layerCount.value;
                }
                growthOffset.z = -.5 * this.layerCount.value;
                shrinkDirection.z = 1;
                break;

              case 3:
                direction = server_namespaceObject.Direction.South;
                if (this.quickExtrudeMode.value === QuickExtrudeMode.Grow) {
                    scale.z = 1 * this.layerCount.value;
                }
                growthOffset.z = .5;
                shrinkDirection.z = -1;
                break;

              case 4:
                direction = server_namespaceObject.Direction.West;
                if (this.quickExtrudeMode.value === QuickExtrudeMode.Grow) {
                    scale.x = 1 * this.layerCount.value;
                }
                growthOffset.x = -.5 * this.layerCount.value;
                shrinkDirection.x = 1;
                break;

              case 5:
                direction = server_namespaceObject.Direction.East;
                if (this.quickExtrudeMode.value === QuickExtrudeMode.Grow) {
                    scale.x = 1 * this.layerCount.value;
                }
                growthOffset.x = .5;
                shrinkDirection.x = -1;
                break;
            }
            const dimension = this.uiSession.extensionContext.player.dimension;
            const centerBlock = dimension.getBlock(cursorPosition);
            if (centerBlock === undefined) {
                return;
            }
            const selectionStack = this._selectContiguousFaceForQuickExtrude(this.uiSession, direction, centerBlock, true);
            if (selectionStack.size > 0) {
                this._destroyFacePreview();
                this.quickExtrudeSelectionWidget.location = cursorPosition;
                this._copySelectionMap(this.quickExtrudeFaceSelection, selectionStack);
                const color = this.quickExtrudeMode.value === QuickExtrudeMode.Shrink ? this.SHRINK_SELECTION_COLOR : this.GROW_SELECTION_COLOR;
                if (this.quickExtrudeMode.value === QuickExtrudeMode.Shrink) {
                    let currentLayer = new Map;
                    this._copySelectionMap(currentLayer, selectionStack);
                    for (let i = 2; i <= this.layerCount.value; i++) {
                        const layer = this._quickExtrudeGetSelectionAfterShrink(currentLayer, shrinkDirection);
                        currentLayer.clear();
                        currentLayer = layer;
                        this._appendSelectionMap(selectionStack, currentLayer);
                    }
                }
                let iter = 0;
                const componentCount = this.quickExtrudeSelectionWidget.getComponents().length;
                for (const selection of selectionStack) {
                    let offset = lib.Vector3Utils.subtract(selection[1], cursorPosition);
                    offset = lib.Vector3Utils.scale(offset, .5);
                    if (this.quickExtrudeMode.value === QuickExtrudeMode.Grow) {
                        offset = lib.Vector3Utils.add(offset, growthOffset);
                    }
                    const newPrim = new server_editor_namespaceObject.WidgetComponentRenderPrimitiveTypeBox(cursorPosition, color, scale);
                    const componentName = `primitive-${componentCount + iter}`;
                    this.quickExtrudeSelectionWidget.addRenderPrimitiveComponent(componentName, newPrim, {
                        offset
                    });
                    iter++;
                }
            }
        }
        _destroyFacePreview() {
            const components = this.quickExtrudeSelectionWidget.getComponents();
            if (components.length > 0) {
                for (const component of components) {
                    this.quickExtrudeSelectionWidget.deleteComponent(component);
                }
            }
        }
        _createThisContiguousSelectionBlockList(parentPane) {
            parentPane.hide();
            this.contiguousSelectionBlockListTable = parentPane.addBlockList({
                blockList: convertBlockTypesToBlockStrings(this.contiguousSelectionBlockList),
                onChange: (object, property, oldValue, newValue) => {
                    const oldVal = oldValue;
                    const newVal = newValue;
                    if (!arraysAreEqual(oldVal, newVal) && this.contiguousSelectionBlockList !== undefined && this.contiguousSelectionBlockListTable !== undefined) {
                        this.contiguousSelectionBlockList = convertBlockStringsToBlockType(newVal);
                        this.contiguousSelectionBlockListTable.updateBlockList(newVal);
                    }
                }
            });
            parentPane.show();
        }
        _createTrailingBlocksProperty(parentPane) {
            const trailingBlocksValue = parentPane.addNumber(this.sampleCount, {
                title: "resourcePack.editor.toolRail.ExtrudeTool.pane.SampleLayerCount.title",
                min: ExtrudeTool.MIN_SAMPLES,
                max: ExtrudeTool.MAX_SAMPLES,
                variant: server_editor_namespaceObject.NumberPropertyItemVariant.InputFieldAndSlider,
                isInteger: true
            });
            parentPane.show();
            return trailingBlocksValue;
        }
        _createContiguousSelectionPane(parentPane) {
            const contiguousSelectionSettingsSubPane = parentPane.createSubPane({
                title: "resourcePack.editor.toolRail.ExtrudeTool.pane.ContiguousSelectionSettings.title"
            });
            contiguousSelectionSettingsSubPane.hide();
            contiguousSelectionSettingsSubPane.addDropdown(this.contiguousSelectionType, {
                title: "resourcePack.editor.toolRail.ExtrudeTool.pane.ContiguousSelectionType.title",
                entries: [ {
                    label: "resourcePack.editor.toolRail.ExtrudeTool.pane.ContiguousSelectionType.SameBlocks",
                    value: 0
                }, {
                    label: "resourcePack.editor.toolRail.ExtrudeTool.pane.ContiguousSelectionType.SameBlocksAndStates",
                    value: 1
                }, {
                    label: "resourcePack.editor.toolRail.ExtrudeTool.pane.ContiguousSelectionType.SolidBlocks",
                    value: 2
                }, {
                    label: "resourcePack.editor.toolRail.ExtrudeTool.pane.ContiguousSelectionType.AllBlocks",
                    value: 3
                }, {
                    label: "resourcePack.editor.toolRail.ExtrudeTool.pane.ContiguousSelectionType.CustomBlockList",
                    value: 4
                } ],
                onChange: () => {
                    if (this.contiguousSelectionBlockListTable) {
                        if (this.contiguousSelectionType.value === ContiguousSelectionType.Custom) {
                            contiguousSelectionSettingsSubPane.hide();
                            this.contiguousSelectionBlockListTable.visible = true;
                            contiguousSelectionSettingsSubPane.show();
                        } else {
                            contiguousSelectionSettingsSubPane.hide();
                            this.contiguousSelectionBlockListTable.visible = false;
                            contiguousSelectionSettingsSubPane.show();
                        }
                    }
                }
            });
            this._createThisContiguousSelectionBlockList(contiguousSelectionSettingsSubPane);
            if (this.contiguousSelectionBlockListTable) {
                if (this.contiguousSelectionType.value === ContiguousSelectionType.Custom) {
                    contiguousSelectionSettingsSubPane.hide();
                    this.contiguousSelectionBlockListTable.visible = true;
                    contiguousSelectionSettingsSubPane.show();
                } else {
                    contiguousSelectionSettingsSubPane.hide();
                    this.contiguousSelectionBlockListTable.visible = false;
                    contiguousSelectionSettingsSubPane.show();
                }
            }
            const toleranceItem = contiguousSelectionSettingsSubPane.addNumber(this.toleranceLevel, {
                title: "resourcePack.editor.toolRail.ExtrudeTool.pane.ToleranceLevel.title",
                min: ExtrudeTool.MIN_TOLERANCE,
                max: ExtrudeTool.MAX_TOLERANCE,
                variant: server_editor_namespaceObject.NumberPropertyItemVariant.InputFieldAndSlider,
                isInteger: true
            });
            const hasAdjacentBlocksItem = contiguousSelectionSettingsSubPane.addBool(this.hasAdjacentBlocks, {
                title: "resourcePack.editor.toolRail.ExtrudeTool.pane.HasAdjacentBlocks.title"
            });
            switch (this.extrusionType.value) {
              case ExtrusionType.Extrude:
                contiguousSelectionSettingsSubPane.hide();
                toleranceItem.visible = true;
                hasAdjacentBlocksItem.visible = false;
                this.quickExtrudePreviewActive = false;
                contiguousSelectionSettingsSubPane.show();
                this._destroyFacePreview();
                break;

              case ExtrusionType.QuickExtrude:
                contiguousSelectionSettingsSubPane.hide();
                toleranceItem.visible = false;
                hasAdjacentBlocksItem.visible = true;
                this.quickExtrudePreviewActive = true;
                contiguousSelectionSettingsSubPane.show();
                break;
            }
            contiguousSelectionSettingsSubPane.show();
            parentPane.show();
            return contiguousSelectionSettingsSubPane;
        }
        _destroyExtrusionPane(parentPane) {
            if (this.extruderSettingsSubPane) {
                this.extruderSettingsSubPane.hide();
                parentPane.removeSubPane(this.extruderSettingsSubPane);
                this.extruderSettingsSubPane = undefined;
            }
        }
        _createExtrusionPane(parentPane) {
            this._destroyExtrusionPane(parentPane);
            this.extruderSettingsSubPane = parentPane.createSubPane({
                title: "resourcePack.editor.toolRail.ExtrudeTool.pane.ExtruderSettings.title"
            });
            this.extruderSettingsSubPane.hide();
            this.extruderSettingsSubPane.addDropdown(this.selectionMode, {
                title: "resourcePack.editor.toolRail.ExtrudeTool.pane.SelectionMode.title",
                entries: [ {
                    label: "resourcePack.editor.toolRail.ExtrudeTool.pane.SelectionMode.MarqueeSelection",
                    value: 1
                }, {
                    label: "resourcePack.editor.toolRail.ExtrudeTool.pane.SelectionMode.ContiguousSelection",
                    value: 0
                } ],
                onChange: () => {
                    if (this.selectionMode.value === ExtrudeTool_SelectionMode.Contiguous) {
                        this.extruderSettingsSubPane?.hide();
                        contiguousPane.show();
                        this.extruderSettingsSubPane?.show();
                    } else {
                        this.extruderSettingsSubPane?.hide();
                        contiguousPane.hide();
                        this.extruderSettingsSubPane?.show();
                    }
                }
            });
            const contiguousPane = this._createContiguousSelectionPane(this.extruderSettingsSubPane);
            contiguousPane.addNumber(this.searchRadius, {
                title: "resourcePack.editor.toolRail.ExtrudeTool.pane.Radius.title",
                min: ExtrudeTool.MIN_RADIUS,
                max: ExtrudeTool.MAX_RADIUS,
                variant: server_editor_namespaceObject.NumberPropertyItemVariant.InputFieldAndSlider,
                isInteger: true
            });
            if (this.selectionMode.value === ExtrudeTool_SelectionMode.Contiguous) {
                this.extruderSettingsSubPane.hide();
                contiguousPane.show();
                this.extruderSettingsSubPane.show();
            } else {
                this.extruderSettingsSubPane.hide();
                contiguousPane.hide();
                this.extruderSettingsSubPane.show();
            }
            const trailingBlocksSettingsSubPane = this.extruderSettingsSubPane.createSubPane({
                title: "resourcePack.editor.toolRail.ExtrudeTool.pane.SelectionMode.TrailingBlocks.title"
            });
            trailingBlocksSettingsSubPane.addBool(this.hasTrailingBlocks, {
                title: "resourcePack.editor.toolRail.ExtrudeTool.pane.SelectionMode.TrailingBlocks.title",
                onChange: () => {
                    if (this.hasTrailingBlocks.value) {
                        this.extruderSettingsSubPane?.hide();
                        TrailingBlocksProperties.visible = true;
                        this.extruderSettingsSubPane?.show();
                    } else {
                        this.extruderSettingsSubPane?.hide();
                        TrailingBlocksProperties.visible = false;
                        this.extruderSettingsSubPane?.show();
                    }
                }
            });
            const TrailingBlocksProperties = this._createTrailingBlocksProperty(trailingBlocksSettingsSubPane);
            if (this.hasTrailingBlocks.value) {
                this.extruderSettingsSubPane.hide();
                TrailingBlocksProperties.visible = true;
                this.extruderSettingsSubPane.show();
            } else {
                this.extruderSettingsSubPane.hide();
                TrailingBlocksProperties.visible = false;
                this.extruderSettingsSubPane.show();
            }
            this.extruderSettingsSubPane.show();
            parentPane.show();
        }
        _destroyQuickExtrudePane(parentPane) {
            if (this.quickExtrudeSettingsSubPane) {
                this.quickExtrudeSettingsSubPane.hide();
                parentPane.removeSubPane(this.quickExtrudeSettingsSubPane);
                this.quickExtrudeSettingsSubPane = undefined;
            }
        }
        _createQuickExtrudePane(parentPane) {
            this._destroyQuickExtrudePane(parentPane);
            this.quickExtrudeSettingsSubPane = parentPane.createSubPane({
                title: "resourcePack.editor.toolRail.ExtrudeTool.pane.SelectionMode.QuickExtrudeSettings.title"
            });
            this.quickExtrudeSettingsSubPane.hide();
            this.quickExtrudeSettingsSubPane.addToggleGroup(this.quickExtrudeMode, {
                title: "resourcePack.editor.toolRail.ExtrudeTool.pane.SelectionMode.QuickExtrudeMode.title",
                hiddenLabel: true,
                entries: [ {
                    label: "resourcePack.editor.toolRail.ExtrudeTool.pane.SelectionMode.QuickExtrudeMode.expand.title",
                    value: QuickExtrudeMode.Grow,
                    icon: "pack://textures/editor/Marquee-Add.png?filtering=point",
                    tooltip: "resourcePack.editor.toolRail.ExtrudeTool.pane.SelectionMode.QuickExtrudeMode.expand.tooltip"
                }, {
                    label: "resourcePack.editor.toolRail.ExtrudeTool.pane.SelectionMode.QuickExtrudeMode.decrease.title",
                    value: QuickExtrudeMode.Shrink,
                    icon: "pack://textures/editor/Marquee-Subtract.png?filtering=point",
                    tooltip: "resourcePack.editor.toolRail.ExtrudeTool.pane.SelectionMode.QuickExtrudeMode.decrease.tooltip"
                } ],
                onChange: () => {
                    this._createFacePreview();
                }
            });
            this.quickExtrudeSettingsSubPane.addNumber(this.faceSize, {
                title: "Face Size",
                min: ExtrudeTool.MIN_FACE_SIZE,
                max: ExtrudeTool.MAX_FACE_SIZE,
                variant: server_editor_namespaceObject.NumberPropertyItemVariant.InputFieldAndSlider,
                isInteger: true
            });
            this.quickExtrudeSettingsSubPane.addNumber(this.layerCount, {
                title: "resourcePack.editor.toolRail.ExtrudeTool.pane.SelectionMode.LayerCount.title",
                min: ExtrudeTool.MIN_LAYERS,
                max: ExtrudeTool.MAX_LAYERS,
                variant: server_editor_namespaceObject.NumberPropertyItemVariant.InputFieldAndSlider,
                isInteger: true
            });
            this._createContiguousSelectionPane(this.quickExtrudeSettingsSubPane);
            this.quickExtrudeSettingsSubPane.show();
            parentPane.show();
        }
        _createToolPane(uiSession) {
            const pane = uiSession.createPropertyPane({
                title: "resourcePack.editor.toolRail.ExtrudeTool.title",
                infoTooltip: {
                    description: [ "resourcePack.editor.toolRail.ExtrudeTool.tooltip", {
                        link: "https://aka.ms/BedrockEditorExtrude",
                        text: "resourcePack.editor.help.learnMore"
                    } ]
                }
            });
            if (this.extrusionType.value === ExtrusionType.Extrude) {
                this._destroyQuickExtrudePane(pane);
                this._createExtrusionPane(pane);
                this.quickExtrudePreviewActive = false;
                this._destroyFacePreview();
            } else if (this.extrusionType.value === ExtrusionType.QuickExtrude) {
                this._destroyExtrusionPane(pane);
                this._createQuickExtrudePane(pane);
                this.quickExtrudePreviewActive = true;
            }
            pane.hide();
            return pane;
        }
        teardown() {
            this._clearState();
            if (this.tickHandle !== undefined) {
                server_namespaceObject.system.clearRun(this.tickHandle);
            }
        }
        _getQuickExtrudeVectorFromDirection(direction) {
            const quickExtrudeDirection = {
                x: 0,
                y: 0,
                z: 0
            };
            switch (direction) {
              case server_namespaceObject.Direction.Up:
                quickExtrudeDirection.y = 1;
                break;

              case server_namespaceObject.Direction.Down:
                quickExtrudeDirection.y = -1;
                break;

              case server_namespaceObject.Direction.North:
                quickExtrudeDirection.z = -1;
                break;

              case server_namespaceObject.Direction.South:
                quickExtrudeDirection.z = 1;
                break;

              case server_namespaceObject.Direction.East:
                quickExtrudeDirection.x = 1;
                break;

              case server_namespaceObject.Direction.West:
                quickExtrudeDirection.x = -1;
                break;
            }
            return quickExtrudeDirection;
        }
        _registerMouseAction(uiSession) {
            const executeAction = uiSession.actionManager.createAction({
                actionType: server_editor_namespaceObject.ActionTypes.MouseRayCastAction,
                onExecute: (mouseRay, mouseProps) => {
                    if (mouseProps.mouseAction === server_editor_namespaceObject.MouseActionType.LeftButton && mouseProps.inputType === server_editor_namespaceObject.MouseInputType.ButtonDown && uiSession.toolRail.getSelectedToolId() === this.tool.id && mouseRay?.cursorBlockLocation) {
                        const noModifiers = !mouseProps.modifiers.alt && !mouseProps.modifiers.ctrl && !mouseProps.modifiers.shift;
                        const dimension = uiSession.extensionContext.player.dimension;
                        const rayDirection = mouseRay.direction;
                        const startLocation = mouseRay.location;
                        const raycastFace = dimension.getBlockFromRay(startLocation, rayDirection)?.face;
                        if (raycastFace === undefined) {
                            return undefined;
                        }
                        const quickExtrudeDirection = this._getQuickExtrudeVectorFromDirection(raycastFace);
                        let quickExtrudeShrinkSelection = new Map;
                        const targetBlock = dimension.getBlock(mouseRay.cursorBlockLocation);
                        if (targetBlock) {
                            this.preview.visible = true;
                            switch (this.extrusionType.value) {
                              case ExtrusionType.Extrude:
                                switch (this.selectionMode.value) {
                                  case ExtrudeTool_SelectionMode.Contiguous:
                                    this.widget?.delete();
                                    this.widget = undefined;
                                    this.preview.clear();
                                    if (noModifiers) {
                                        this.selectStack = new Map;
                                    }
                                    this._selectContiguousExtrusionForExtruder(uiSession, raycastFace, targetBlock);
                                    if (this.selectStack.size > 0) {
                                        this._addWidget(targetBlock.location, raycastFace);
                                        this.anchorPreviewLocation = mouseRay.cursorBlockLocation;
                                        this.currentPreviewLocation = this.anchorPreviewLocation;
                                    }
                                    break;

                                  case ExtrudeTool_SelectionMode.Marquee:
                                    this.UseMarqueeSelection(mouseRay, mouseProps.modifiers.shift, mouseProps.modifiers.ctrl, mouseProps.modifiers.alt);
                                    break;
                                }
                                break;

                              case ExtrusionType.QuickExtrude:
                                this.trackList.clear();
                                this.uiSession.extensionContext.transactionManager.openTransaction("resourcePack.editor.toolRail.ExtrudeTool.title");
                                this.hasOpenedTransaction = true;
                                this.selectStack = this._selectContiguousFaceForQuickExtrude(this.uiSession, raycastFace, targetBlock, true);
                                this.anchorPreviewLocation = mouseRay.cursorBlockLocation;
                                this.currentPreviewLocation = mouseRay.cursorBlockLocation;
                                switch (this.quickExtrudeMode.value) {
                                  case QuickExtrudeMode.Grow:
                                    this.telemetryManager.fireTelemetryEvent(ExtrudeTelemetry.QuickExtrude, {
                                        mode: "grow",
                                        faceSize: this.faceSize.value,
                                        layerCount: this.layerCount.value,
                                        contiguousSelection: this.contiguousSelectionType.value,
                                        hasAdjacentBlocks: this.hasAdjacentBlocks.value
                                    });
                                    for (let i = 0; i < this.layerCount.value; i++) {
                                        this._growSelection(lib.Vector3Utils.add(this.currentPreviewLocation, quickExtrudeDirection));
                                        this.currentPreviewLocation = lib.Vector3Utils.add(this.currentPreviewLocation, quickExtrudeDirection);
                                    }
                                    break;

                                  case QuickExtrudeMode.Shrink:
                                    this.telemetryManager.fireTelemetryEvent(ExtrudeTelemetry.QuickExtrude, {
                                        mode: "shrink",
                                        faceSize: this.faceSize.value,
                                        layerCount: this.layerCount.value,
                                        contiguousSelection: this.contiguousSelectionType.value,
                                        hasAdjacentBlocks: this.hasAdjacentBlocks.value
                                    });
                                    for (let i = 0; i < this.layerCount.value; i++) {
                                        quickExtrudeShrinkSelection.clear();
                                        quickExtrudeShrinkSelection = this._quickExtrudeGetSelectionAfterShrink(this.selectStack, lib.Vector3Utils.scale(quickExtrudeDirection, -1));
                                        this._shrinkSelection(lib.Vector3Utils.subtract(this.currentPreviewLocation, quickExtrudeDirection));
                                        this.currentPreviewLocation = lib.Vector3Utils.subtract(this.currentPreviewLocation, quickExtrudeDirection);
                                        this._copySelectionMap(this.selectStack, quickExtrudeShrinkSelection);
                                        if (this.selectStack.size <= 0) {
                                            break;
                                        }
                                    }
                                }
                                this._clearState();
                                if (this.hasOpenedTransaction) {
                                    this.hasOpenedTransaction = false;
                                    try {
                                        this.uiSession.extensionContext.transactionManager.commitOpenTransaction();
                                    } catch (e) {
                                        this.uiSession.extensionContext.transactionManager.discardOpenTransaction();
                                        this.uiSession.log.error(`Error committing transaction: ${e.message}`);
                                    }
                                }
                                break;
                            }
                        }
                    }
                }
            });
            this.tool.registerMouseButtonBinding(executeAction);
        }
        _getPositionKey(loc) {
            return [ loc.x, loc.y, loc.z ].join(",");
        }
        _addWidget(location, direction) {
            this.widget = this.widgetGroup.createWidget(location, {
                selectable: true,
                snapToBlockLocation: true,
                visible: true,
                collisionOffset: {
                    x: .5,
                    y: .5,
                    z: .5
                },
                collisionRadius: .5,
                stateChangeEvent: data => {
                    if (data.mouseEvent !== undefined) {
                        if (!this.hasOpenedTransaction && data.mouseEvent.action === server_editor_namespaceObject.WidgetMouseButtonActionType.Pressed) {
                            this.hasOpenedTransaction = true;
                            this.hasPendingWidgetTransaction = false;
                            this.trackList.clear();
                            this.uiSession.extensionContext.transactionManager.openTransaction("resourcePack.editor.toolRail.ExtrudeTool.title");
                        } else if (this.hasOpenedTransaction && data.mouseEvent.action === server_editor_namespaceObject.WidgetMouseButtonActionType.Released) {
                            this.hasOpenedTransaction = false;
                            this.completedSelectionTransactionHandler.addUserDefinedOperation({}, "Extruder Completed Selection Data");
                            if (this.hasPendingWidgetTransaction === false) {
                                this.uiSession.extensionContext.transactionManager.discardOpenTransaction();
                            } else {
                                try {
                                    this.uiSession.extensionContext.transactionManager.commitOpenTransaction();
                                } catch (e) {
                                    this.uiSession.extensionContext.transactionManager.discardOpenTransaction();
                                    this.uiSession.log.error(`Error committing transaction: ${e.message}`);
                                }
                            }
                            this.hasPendingWidgetTransaction = false;
                        }
                    }
                    if (this.hasOpenedTransaction && data.location !== undefined && this.currentPreviewLocation !== data.location) {
                        const offset = lib.Vector3Utils.subtract(data.location, this.currentPreviewLocation);
                        const xIncrement = {
                            x: Math.sign(offset.x),
                            y: 0,
                            z: 0
                        };
                        const yIncrement = {
                            x: 0,
                            y: Math.sign(offset.y),
                            z: 0
                        };
                        const zIncrement = {
                            x: 0,
                            y: 0,
                            z: Math.sign(offset.z)
                        };
                        for (let y = 0; y < Math.abs(offset.y); y++) {
                            const incrementalLocation = lib.Vector3Utils.add(this.currentPreviewLocation, yIncrement);
                            this._incrementWidgetExtrusion(incrementalLocation, direction);
                        }
                        for (let x = 0; x < Math.abs(offset.x); x++) {
                            const incrementalLocation = lib.Vector3Utils.add(this.currentPreviewLocation, xIncrement);
                            this._incrementWidgetExtrusion(incrementalLocation, direction);
                        }
                        for (let z = 0; z < Math.abs(offset.z); z++) {
                            const incrementalLocation = lib.Vector3Utils.add(this.currentPreviewLocation, zIncrement);
                            this._incrementWidgetExtrusion(incrementalLocation, direction);
                        }
                        this._drawPreviewFromSelectStack();
                    }
                }
            });
            this.widget.addEntityComponent("marker", ExtrudeTool_mapMarkerEntityName, {
                isClickable: false,
                visible: true,
                offset: {
                    x: .5,
                    y: 0,
                    z: .5
                }
            });
            this.widget.addGizmoComponent("position_gizmo", {
                offset: {
                    x: .5,
                    y: 0,
                    z: .5
                },
                visible: true
            });
            if (this.widget !== undefined) {
                this.previousAnchorPosition = this.anchorPreviewLocation;
                this._copySelectionMap(this.previousSelection, this.selectStack);
                this.previousWidgetPosition = this.widget.location;
            }
        }
        _drawPreviewFromSelectStack() {
            this.preview.clear();
            for (const selection of this.selectStack) {
                const value = selection[1];
                let isEdge = false;
                for (let x = -1; x <= 1 && !isEdge; x += 2) {
                    const position = {
                        x: value.x + x,
                        y: value.y,
                        z: value.z
                    };
                    if (!this.selectStack.has(lib.Vector3Utils.toString(position))) {
                        isEdge = true;
                    }
                }
                for (let y = -1; y <= 1 && !isEdge; y += 2) {
                    const position = {
                        x: value.x,
                        y: value.y + y,
                        z: value.z
                    };
                    if (!this.selectStack.has(lib.Vector3Utils.toString(position))) {
                        isEdge = true;
                    }
                }
                for (let z = -1; z <= 1 && !isEdge; z += 2) {
                    const position = {
                        x: value.x,
                        y: value.y,
                        z: value.z + z
                    };
                    if (!this.selectStack.has(lib.Vector3Utils.toString(position))) {
                        isEdge = true;
                    }
                }
                if (isEdge) {
                    this.preview.pushVolume({
                        action: server_namespaceObject.CompoundBlockVolumeAction.Add,
                        volume: new server_namespaceObject.BlockVolume(value, value)
                    });
                }
            }
        }
        _incrementWidgetExtrusion(newLocation, direction) {
            if (newLocation !== undefined && this.currentPreviewLocation !== newLocation) {
                const offset = lib.Vector3Utils.subtract(newLocation, this.currentPreviewLocation);
                const isMovingUp = offset.y > 0;
                const isMovingDown = offset.y < 0;
                const isMovingNorth = offset.z < 0;
                const isMovingSouth = offset.z > 0;
                const isMovingWest = offset.x < 0;
                const isMovingEast = offset.x > 0;
                const isAboveStart = this.currentPreviewLocation.y > this.anchorPreviewLocation.y;
                const isBelowStart = this.currentPreviewLocation.y < this.anchorPreviewLocation.y;
                const isNorthOfStart = this.currentPreviewLocation.z < this.anchorPreviewLocation.z;
                const isSouthOfStart = this.currentPreviewLocation.z > this.anchorPreviewLocation.z;
                const isEastOfStart = this.currentPreviewLocation.x > this.anchorPreviewLocation.x;
                const isWestOfStart = this.currentPreviewLocation.x < this.anchorPreviewLocation.x;
                if (this._isDraggingSelection(direction, isMovingUp, isMovingDown, isMovingNorth, isMovingSouth, isMovingWest, isMovingEast)) {
                    this._dragSelection(newLocation);
                } else if (isAboveStart && isMovingDown || isBelowStart && isMovingUp || isNorthOfStart && isMovingSouth || isSouthOfStart && isMovingNorth || isEastOfStart && isMovingWest || isWestOfStart && isMovingEast) {
                    this._shrinkSelection(newLocation);
                } else {
                    this._growSelection(newLocation);
                }
                this.currentPreviewLocation = newLocation;
                this._addSelectionChangesToTransaction();
            }
        }
        _growSelection(moveLocation) {
            const offset = lib.Vector3Utils.subtract(moveLocation, this.currentPreviewLocation);
            const newSelection = new Map;
            const newBlockType = new Map;
            const player = this.uiSession.extensionContext.player;
            const dimension = player.dimension;
            for (const selection of this.selectStack) {
                const value = selection[1];
                const blockType = dimension.getBlock(value)?.typeId;
                if (blockType === undefined) {
                    continue;
                }
                const newLocation = lib.Vector3Utils.add(value, offset);
                const newLocationKey = lib.Vector3Utils.toString(newLocation);
                if (!newSelection.has(newLocationKey)) {
                    newSelection.set(newLocationKey, newLocation);
                    newBlockType.set(newLocationKey, blockType);
                }
            }
            for (const [key, selectLoc] of newSelection) {
                this.selectStack.set(key, selectLoc);
                const block = dimension.getBlock(selectLoc);
                if (block === undefined) {
                    continue;
                }
                const blockType = newBlockType.get(key);
                if (blockType === undefined) {
                    continue;
                }
                this.hasPendingWidgetTransaction = true;
                this._addBlockLocationToTransaction(selectLoc);
                block.setType(blockType);
            }
        }
        _shrinkSelection(moveLocation) {
            const offset = lib.Vector3Utils.subtract(moveLocation, this.currentPreviewLocation);
            const newSelection = new Map;
            const newBlockType = new Map;
            const player = this.uiSession.extensionContext.player;
            const dimension = player.dimension;
            for (const selection of this.selectStack) {
                const value = selection[1];
                const block = dimension.getBlock(value);
                if (block === undefined) {
                    continue;
                }
                const newLocation = lib.Vector3Utils.add(value, offset);
                const newLocationKey = lib.Vector3Utils.toString(newLocation);
                if (this.selectStack.has(newLocationKey)) {
                    newSelection.set(newLocationKey, newLocation);
                    newBlockType.set(newLocationKey, block.typeId);
                }
            }
            for (const [key, value] of this.selectStack) {
                const block = dimension.getBlock(value);
                if (block === undefined) {
                    continue;
                }
                this.hasPendingWidgetTransaction = true;
                this._addBlockLocationToTransaction(value);
                if (!newSelection.has(key)) {
                    this.selectStack.delete(key);
                    if (this.hasTrailingBlocks.value && this.extrusionType.value === ExtrusionType.Extrude) {
                        this._addTrailingBlock(block, offset);
                    } else {
                        block.setType(MinecraftBlockTypes.Air);
                    }
                } else {
                    const blockType = newBlockType.get(key);
                    if (blockType !== undefined) {
                        block.setType(blockType);
                    }
                }
            }
        }
        _quickExtrudeGetSelectionAfterShrink(originalSelection, offset) {
            const newSelection = new Map;
            const player = this.uiSession.extensionContext.player;
            const dimension = player.dimension;
            for (const selection of originalSelection) {
                const value = selection[1];
                const sampleBlock = dimension.getBlock(value);
                if (sampleBlock === undefined) {
                    continue;
                }
                const testPosition = lib.Vector3Utils.add(value, offset);
                const testBlock = dimension.getBlock(testPosition);
                if (testBlock === undefined) {
                    continue;
                }
                if (this._areBlocksContiguous(sampleBlock, testBlock) === true) {
                    newSelection.set(lib.Vector3Utils.toString(testPosition), testPosition);
                }
            }
            return newSelection;
        }
        _isDraggingSelection(direction, isMovingUp, isMovingDown, isMovingNorth, isMovingSouth, isMovingWest, isMovingEast) {
            const size = lib.Vector3Utils.subtract(this.currentPreviewLocation, this.anchorPreviewLocation);
            switch (direction) {
              case server_namespaceObject.Direction.Up:
                if (size.y === 0 && isMovingDown) {
                    return true;
                }
                break;

              case server_namespaceObject.Direction.Down:
                if (size.y === 0 && isMovingUp) {
                    return true;
                }
                break;

              case server_namespaceObject.Direction.North:
                if (size.z === 0 && isMovingSouth) {
                    return true;
                }
                break;

              case server_namespaceObject.Direction.South:
                if (size.z === 0 && isMovingNorth) {
                    return true;
                }
                break;

              case server_namespaceObject.Direction.East:
                if (size.x === 0 && isMovingWest) {
                    return true;
                }
                break;

              case server_namespaceObject.Direction.West:
                if (size.x === 0 && isMovingEast) {
                    return true;
                }
                break;
            }
            return false;
        }
        _dragSelection(moveLocation) {
            const offset = lib.Vector3Utils.subtract(moveLocation, this.currentPreviewLocation);
            const newSelection = new Map;
            const newBlockType = new Map;
            const player = this.uiSession.extensionContext.player;
            const dimension = player.dimension;
            for (const selection of this.selectStack) {
                const value = selection[1];
                const blockType = dimension.getBlock(value)?.typeId;
                if (blockType === undefined) {
                    continue;
                }
                const newLocation = lib.Vector3Utils.add(value, offset);
                const newLocationKey = lib.Vector3Utils.toString(newLocation);
                if (!newSelection.has(newLocationKey)) {
                    newSelection.set(newLocationKey, newLocation);
                    newBlockType.set(newLocationKey, blockType);
                }
            }
            for (const [key, value] of newSelection) {
                const prevBlockLocation = lib.Vector3Utils.subtract(value, offset);
                const prevBlock = dimension.getBlock(prevBlockLocation);
                if (prevBlock !== undefined && !newSelection.has(lib.Vector3Utils.toString(prevBlockLocation))) {
                    this.hasPendingWidgetTransaction = true;
                    this._addBlockLocationToTransaction(prevBlockLocation);
                    if (this.hasTrailingBlocks.value && this.extrusionType.value === ExtrusionType.Extrude) {
                        this._addTrailingBlock(prevBlock, offset);
                    } else {
                        prevBlock.setType(MinecraftBlockTypes.Air);
                    }
                }
                const block = dimension.getBlock(value);
                if (block === undefined) {
                    continue;
                }
                this._addBlockLocationToTransaction(value);
                const blockType = newBlockType.get(key);
                if (blockType === undefined) {
                    continue;
                }
                block.setType(blockType);
            }
            this.selectStack = newSelection;
            this.anchorPreviewLocation = lib.Vector3Utils.add(this.anchorPreviewLocation, offset);
        }
        _isBlockTypeInSelectionList(block) {
            if (this.contiguousSelectionBlockList === undefined || this.contiguousSelectionBlockList.length === 0) {
                return false;
            }
            const blockType = block.type;
            if (blockType === undefined) {
                return false;
            }
            for (let i = 0; i < this.contiguousSelectionBlockList.length; i++) {
                if (this.contiguousSelectionBlockList[i] === blockType) {
                    return true;
                }
            }
            return false;
        }
        _addVolumeToSelectStack(volumeStart, volumeEnd) {
            const minX = Math.min(volumeStart.x, volumeEnd.x);
            const minY = Math.min(volumeStart.y, volumeEnd.y);
            const minZ = Math.min(volumeStart.z, volumeEnd.z);
            const maxX = Math.max(volumeStart.x, volumeEnd.x);
            const maxY = Math.max(volumeStart.y, volumeEnd.y);
            const maxZ = Math.max(volumeStart.z, volumeEnd.z);
            for (let x = minX; x <= maxX; ++x) {
                for (let y = minY; y <= maxY; ++y) {
                    for (let z = minZ; z <= maxZ; ++z) {
                        const position = {
                            x,
                            y,
                            z
                        };
                        this.selectStack.set(lib.Vector3Utils.toString(position), position);
                    }
                }
            }
        }
        _addTrailingBlock(currentBlock, MoveDirection) {
            const player = this.uiSession.extensionContext.player;
            const dimension = player.dimension;
            const sampleBlocks = [];
            try {
                let prevBlockLocation = lib.Vector3Utils.subtract(currentBlock.location, MoveDirection);
                for (let i = 0; i < this.sampleCount.value; i++) {
                    const prevBlock = dimension.getBlock(prevBlockLocation);
                    if (prevBlock !== undefined) {
                        sampleBlocks.push(prevBlock.typeId);
                    }
                    prevBlockLocation = lib.Vector3Utils.subtract(prevBlockLocation, MoveDirection);
                }
            } catch {
                if (sampleBlocks.length > 0) {
                    const BlockTypeIndex = Math.floor(Math.random() * sampleBlocks.length);
                    currentBlock.setType(sampleBlocks[BlockTypeIndex]);
                } else {
                    currentBlock.setType(MinecraftBlockTypes.Air);
                }
            }
            if (sampleBlocks.length > 0) {
                const BlockTypeIndex = Math.floor(Math.random() * sampleBlocks.length);
                currentBlock.setType(sampleBlocks[BlockTypeIndex]);
            } else {
                currentBlock.setType(MinecraftBlockTypes.Air);
            }
        }
        _areBlocksContiguous(blockToFollow, blockToTest) {
            switch (this.contiguousSelectionType.value) {
              case ContiguousSelectionType.SameBlock:
                return isSameBlockType(blockToFollow, blockToTest);

              case ContiguousSelectionType.BlockStates:
                return isSameBlockAndProperties(blockToFollow, blockToTest);

              case ContiguousSelectionType.SolidBlock:
                return isBlockSolid(blockToTest);

              case ContiguousSelectionType.AllBlocks:
                return isBlockNotAir(blockToTest);

              case ContiguousSelectionType.Custom:
                return this._isBlockTypeInSelectionList(blockToTest);
            }
            return false;
        }
        _isBlockExposedInDirection(targetLocation, direction) {
            const ExtrusionDirection = {
                x: 0,
                y: 0,
                z: 0
            };
            switch (direction) {
              case server_namespaceObject.Direction.Up:
                ExtrusionDirection.y = 1;
                break;

              case server_namespaceObject.Direction.Down:
                ExtrusionDirection.y = -1;
                break;

              case server_namespaceObject.Direction.North:
                ExtrusionDirection.z = -1;
                break;

              case server_namespaceObject.Direction.South:
                ExtrusionDirection.z = 1;
                break;

              case server_namespaceObject.Direction.East:
                ExtrusionDirection.x = 1;
                break;

              case server_namespaceObject.Direction.West:
                ExtrusionDirection.x = -1;
                break;
            }
            const dimension = this.uiSession.extensionContext.player.dimension;
            const blockToCheck = dimension.getBlock(lib.Vector3Utils.add(targetLocation, ExtrusionDirection));
            if (blockToCheck === undefined || blockToCheck.typeId !== MinecraftBlockTypes.Air) {
                return false;
            }
            return true;
        }
        _selectContiguousFaceForQuickExtrude(uiSession, selectionDirection, block, checkTolerance) {
            uiSession.extensionContext.selectionManager.selection.clear();
            const FaceSelection = new Map;
            if (block) {
                const faceSize = (this.faceSize.value - 1) / 2;
                const from = {
                    x: block.location.x - faceSize,
                    y: block.location.y - faceSize,
                    z: block.location.z - faceSize
                };
                const to = {
                    x: block.location.x + faceSize,
                    y: block.location.y + faceSize,
                    z: block.location.z + faceSize
                };
                switch (selectionDirection) {
                  case server_namespaceObject.Direction.Up:
                    from.y = block.location.y;
                    to.y = block.location.y;
                    break;

                  case server_namespaceObject.Direction.Down:
                    from.y = block.location.y;
                    to.y = block.location.y;
                    break;

                  case server_namespaceObject.Direction.North:
                    from.z = block.location.z;
                    to.z = block.location.z;
                    break;

                  case server_namespaceObject.Direction.South:
                    from.z = block.location.z;
                    to.z = block.location.z;
                    break;

                  case server_namespaceObject.Direction.East:
                    from.x = block.location.x;
                    to.x = block.location.x;
                    break;

                  case server_namespaceObject.Direction.West:
                    from.x = block.location.x;
                    to.x = block.location.x;
                    break;
                }
                let bounds = new server_namespaceObject.BlockVolume(from, to);
                const dimension = block.dimension;
                let furthestUp = block.location.y;
                let furthestDown = block.location.y;
                let furthestWest = block.location.x;
                let furthestEast = block.location.x;
                let furthestNorth = block.location.z;
                let furthestSouth = block.location.z;
                let fillStack = [];
                let hasAdjustedBounds = false;
                const outOfBoundsBlocks = [];
                const visitedBlocks = new Map;
                const initialTolerance = checkTolerance && this.hasAdjacentBlocks.value ? 1 : 0;
                fillStack.push({
                    Position: block.location,
                    Tolerance: initialTolerance
                });
                visitedBlocks.set(this._getPositionKey(block.location), {
                    Checked: true,
                    Tolerance: initialTolerance
                });
                while (fillStack.length > 0 || !hasAdjustedBounds) {
                    if (fillStack.length <= 0) {
                        if (furthestUp < Math.floor(to.y) && furthestDown === Math.floor(from.y)) {
                            from.y = furthestUp - (to.y - from.y);
                        } else if (furthestUp === Math.floor(to.y) && furthestDown > Math.floor(from.y)) {
                            to.y = furthestDown + (to.y - from.y);
                        }
                        if (furthestEast < Math.floor(to.x) && furthestWest === Math.floor(from.x)) {
                            from.x = furthestEast - (to.x - from.x);
                        } else if (furthestEast === Math.floor(to.x) && furthestWest > Math.floor(from.x)) {
                            to.x = furthestWest + (to.x - from.x);
                        }
                        if (furthestSouth === Math.floor(to.z) && furthestNorth > Math.floor(from.z)) {
                            to.z = furthestNorth + (to.z - from.z);
                        } else if (furthestSouth < Math.floor(to.z) && furthestNorth === Math.floor(from.z)) {
                            from.z = furthestSouth - (to.z - from.z);
                        }
                        fillStack = outOfBoundsBlocks;
                        bounds = new server_namespaceObject.BlockVolume(from, to);
                        hasAdjustedBounds = true;
                    }
                    const checkBlock = fillStack.pop();
                    if (checkBlock !== undefined) {
                        const loc = checkBlock.Position;
                        visitedBlocks.set(this._getPositionKey(loc), {
                            Checked: true,
                            Tolerance: checkBlock.Tolerance
                        });
                        if (loc === undefined || !bounds.isInside(loc)) continue;
                        let isContiguous = true;
                        try {
                            const blockAtLoc = dimension.getBlock(loc);
                            if (blockAtLoc !== undefined) {
                                switch (this.contiguousSelectionType.value) {
                                  case ContiguousSelectionType.SameBlock:
                                    if (!isSameBlockType(block, blockAtLoc)) {
                                        isContiguous = false;
                                        if (checkBlock.Tolerance <= 0) {
                                            continue;
                                        }
                                    }
                                    break;

                                  case ContiguousSelectionType.BlockStates:
                                    if (!isSameBlockAndProperties(block, blockAtLoc)) {
                                        isContiguous = false;
                                        if (checkBlock.Tolerance <= 0) {
                                            continue;
                                        }
                                    }
                                    break;

                                  case ContiguousSelectionType.SolidBlock:
                                    if (!isBlockSolid(blockAtLoc)) {
                                        isContiguous = false;
                                        if (checkBlock.Tolerance <= 0) {
                                            continue;
                                        }
                                    }
                                    break;

                                  case ContiguousSelectionType.AllBlocks:
                                    if (!isBlockNotAir(blockAtLoc)) {
                                        isContiguous = false;
                                        if (checkBlock.Tolerance <= 0) {
                                            continue;
                                        }
                                    }
                                    break;

                                  case ContiguousSelectionType.Custom:
                                    if (!this._isBlockTypeInSelectionList(blockAtLoc)) {
                                        isContiguous = false;
                                        if (checkBlock.Tolerance <= 0) {
                                            continue;
                                        }
                                    }
                                    break;
                                }
                                if (!this._isBlockExposedInDirection(loc, selectionDirection)) {
                                    isContiguous = false;
                                    if (checkBlock.Tolerance <= 0) {
                                        continue;
                                    }
                                }
                            } else {
                                continue;
                            }
                        } catch {
                            continue;
                        }
                        let remainingTolerance = checkBlock.Tolerance - 1;
                        if (isContiguous) {
                            if (loc.x < furthestWest) {
                                furthestWest = loc.x;
                            }
                            if (loc.x > furthestEast) {
                                furthestEast = loc.x;
                            }
                            if (loc.z < furthestNorth) {
                                furthestNorth = loc.z;
                            }
                            if (loc.z > furthestSouth) {
                                furthestSouth = loc.z;
                            }
                            if (loc.y < furthestDown) {
                                furthestDown = loc.y;
                            }
                            if (loc.y > furthestUp) {
                                furthestUp = loc.y;
                            }
                            FaceSelection.set(lib.Vector3Utils.toString(loc), loc);
                            remainingTolerance = initialTolerance;
                        }
                        for (const offset of this.searchOffsets) {
                            const offsetLoc = {
                                x: loc.x + offset.x,
                                y: loc.y + offset.y,
                                z: loc.z + offset.z
                            };
                            if (!bounds.isInside(offsetLoc)) {
                                outOfBoundsBlocks.push({
                                    Position: offsetLoc,
                                    Tolerance: remainingTolerance
                                });
                                continue;
                            }
                            const visitedBlock = visitedBlocks.get(this._getPositionKey(offsetLoc));
                            if (visitedBlock !== undefined) {
                                if (visitedBlock.Tolerance >= remainingTolerance && visitedBlock.Checked) {
                                    continue;
                                }
                            }
                            fillStack.push({
                                Position: offsetLoc,
                                Tolerance: remainingTolerance
                            });
                            visitedBlocks.set(this._getPositionKey(offsetLoc), {
                                Checked: false,
                                Tolerance: remainingTolerance
                            });
                        }
                    }
                }
            }
            return FaceSelection;
        }
        _selectContiguousExtrusionForExtruder(uiSession, selectionDirection, block) {
            uiSession.extensionContext.selectionManager.selection.clear();
            if (block) {
                const radius = (this.searchRadius.value - 1) / 2;
                const from = {
                    x: block.location.x - radius,
                    y: block.location.y - radius,
                    z: block.location.z - radius
                };
                const to = {
                    x: block.location.x + radius,
                    y: block.location.y + radius,
                    z: block.location.z + radius
                };
                switch (selectionDirection) {
                  case server_namespaceObject.Direction.Up:
                    from.y = block.location.y;
                    to.y = block.location.y - (this.searchRadius.value - 1);
                    break;

                  case server_namespaceObject.Direction.Down:
                    from.y = block.location.y;
                    to.y = block.location.y + (this.searchRadius.value - 1);
                    break;

                  case server_namespaceObject.Direction.North:
                    from.z = block.location.z;
                    to.z = block.location.z + (this.searchRadius.value - 1);
                    break;

                  case server_namespaceObject.Direction.South:
                    from.z = block.location.z;
                    to.z = block.location.z - (this.searchRadius.value - 1);
                    break;

                  case server_namespaceObject.Direction.East:
                    from.x = block.location.x;
                    to.x = block.location.x - (this.searchRadius.value - 1);
                    break;

                  case server_namespaceObject.Direction.West:
                    from.x = block.location.x;
                    to.x = block.location.x + (this.searchRadius.value - 1);
                    break;
                }
                const bounds = new server_namespaceObject.BlockVolume(from, to);
                const dimension = block.dimension;
                const fillStack = [];
                const visitedBlocks = new Map;
                fillStack.push({
                    Position: block.location,
                    Tolerance: this.toleranceLevel.value - 1
                });
                visitedBlocks.set(this._getPositionKey(block.location), {
                    Checked: true,
                    Tolerance: this.toleranceLevel.value
                });
                while (fillStack.length > 0) {
                    const checkBlock = fillStack.pop();
                    if (checkBlock !== undefined) {
                        const loc = checkBlock.Position;
                        visitedBlocks.set(this._getPositionKey(loc), {
                            Checked: true,
                            Tolerance: checkBlock.Tolerance
                        });
                        if (loc === undefined || !bounds.isInside(loc)) continue;
                        let isContiguous = true;
                        try {
                            const blockAtLoc = dimension.getBlock(loc);
                            if (blockAtLoc !== undefined) {
                                switch (this.contiguousSelectionType.value) {
                                  case ContiguousSelectionType.SameBlock:
                                    if (!isSameBlockType(block, blockAtLoc)) {
                                        isContiguous = false;
                                        if (checkBlock.Tolerance <= 0) {
                                            continue;
                                        }
                                    }
                                    break;

                                  case ContiguousSelectionType.BlockStates:
                                    if (!isSameBlockAndProperties(block, blockAtLoc)) {
                                        isContiguous = false;
                                        if (checkBlock.Tolerance <= 0) {
                                            continue;
                                        }
                                    }
                                    break;

                                  case ContiguousSelectionType.SolidBlock:
                                    if (!isBlockSolid(blockAtLoc)) {
                                        isContiguous = false;
                                        if (checkBlock.Tolerance <= 0) {
                                            continue;
                                        }
                                    }
                                    break;

                                  case ContiguousSelectionType.AllBlocks:
                                    if (!isBlockNotAir(blockAtLoc)) {
                                        isContiguous = false;
                                        if (checkBlock.Tolerance <= 0) {
                                            continue;
                                        }
                                    }
                                    break;

                                  case ContiguousSelectionType.Custom:
                                    if (!this._isBlockTypeInSelectionList(blockAtLoc)) {
                                        isContiguous = false;
                                        if (checkBlock.Tolerance <= 0) {
                                            continue;
                                        }
                                    }
                                    break;
                                }
                            } else {
                                continue;
                            }
                        } catch (e) {
                            this.uiSession.log.error(`Error making selection: ${e.message}`);
                            continue;
                        }
                        let remainingTolerance = checkBlock.Tolerance - 1;
                        if (isContiguous) {
                            this.selectStack.set(lib.Vector3Utils.toString(loc), loc);
                            remainingTolerance = this.toleranceLevel.value - 1;
                        }
                        for (const offset of this.searchOffsets) {
                            const offsetLoc = {
                                x: loc.x + offset.x,
                                y: loc.y + offset.y,
                                z: loc.z + offset.z
                            };
                            if (!bounds.isInside(offsetLoc)) continue;
                            const visitedBlock = visitedBlocks.get(this._getPositionKey(offsetLoc));
                            if (visitedBlock !== undefined) {
                                if (visitedBlock.Tolerance >= remainingTolerance && visitedBlock.Checked) {
                                    continue;
                                }
                            }
                            fillStack.push({
                                Position: offsetLoc,
                                Tolerance: remainingTolerance
                            });
                            visitedBlocks.set(this._getPositionKey(offsetLoc), {
                                Checked: false,
                                Tolerance: remainingTolerance
                            });
                        }
                    }
                }
                this._drawPreviewFromSelectStack();
            }
        }
        _registerToolKeyBinding(action, binding, tag) {
            this.tool.registerKeyBinding(action, binding, {
                uniqueId: `editor:ExtrudeToolKeyBinding:${tag}`,
                label: `resourcePack.editor.toolRail.ExtrudeTool.keyBinding.${tag}`
            });
        }
        _clearState() {
            this.widget?.delete();
            this.widget = undefined;
            this.preview.clear();
            this.selectStack.clear();
        }
        _addBlockLocationToTransaction(blockLocation) {
            if (this.hasOpenedTransaction && !this.trackList.has(lib.Vector3Utils.toString(blockLocation))) {
                this.trackList.set(lib.Vector3Utils.toString(blockLocation), blockLocation);
                this.uiSession.extensionContext.transactionManager.trackBlockChangeList([ blockLocation ]);
            }
        }
        _getNewSelectionChanges(previousSelection, newSelection) {
            const selectionArray = [];
            for (const selection of newSelection) {
                if (!previousSelection.has(selection[0])) {
                    selectionArray.push(selection[1]);
                }
            }
            return selectionArray;
        }
        _getOldSelectionChanges(previousSelection, newSelection) {
            const selectionArray = [];
            for (const selection of previousSelection) {
                if (!newSelection.has(selection[0])) {
                    selectionArray.push(selection[1]);
                }
            }
            return selectionArray;
        }
        _copySelectionMap(destinationMap, sourceMap) {
            destinationMap.clear();
            for (const selection of sourceMap) {
                destinationMap.set(selection[0], selection[1]);
            }
        }
        _appendSelectionMap(destinationMap, sourceMap) {
            for (const selection of sourceMap) {
                destinationMap.set(selection[0], selection[1]);
            }
        }
        _addSelectionChangesToTransaction() {
            if (this.widget !== undefined) {
                const differenceInNewSelection = this._getNewSelectionChanges(this.previousSelection, this.selectStack);
                const differenceInOldSelection = this._getOldSelectionChanges(this.previousSelection, this.selectStack);
                let selectionTransactionSuccessful = true;
                try {
                    const transactionPayload = {
                        differenceInOldSelection,
                        oldAnchorPosition: this.previousAnchorPosition,
                        oldWidgetPosition: this.previousWidgetPosition
                    };
                    this.oldSelectionTransactionHandler.addUserDefinedOperation(transactionPayload, "Extruder Previous Selection Data");
                } catch (e) {
                    selectionTransactionSuccessful = false;
                    this.uiSession.log.error(`Error adding selection to transaction: ${e.message}`);
                }
                try {
                    const transactionPayload = {
                        differenceInNewSelection,
                        newAnchorPosition: this.anchorPreviewLocation,
                        newWidgetPosition: this.widget.location
                    };
                    this.newSelectionTransactionHandler.addUserDefinedOperation(transactionPayload, "Extruder Current Selection Data");
                } catch (e) {
                    selectionTransactionSuccessful = false;
                    this.uiSession.log.error(`Error adding selection to transaction: ${e.message}`);
                }
                if (selectionTransactionSuccessful && this.widget !== undefined) {
                    this.previousAnchorPosition = this.anchorPreviewLocation;
                    this._copySelectionMap(this.previousSelection, this.selectStack);
                    this.previousWidgetPosition = this.widget.location;
                }
            }
        }
    }
    ExtrudeTool.BEHAVIOR_NAME = "Extrude Tool";
    ExtrudeTool.ENABLE_VISUALIZATION = false;
    ExtrudeTool.MIN_FACE_SIZE = 1;
    ExtrudeTool.MAX_FACE_SIZE = 32;
    ExtrudeTool.MIN_LAYERS = 1;
    ExtrudeTool.MAX_LAYERS = 16;
    ExtrudeTool.MIN_RADIUS = 1;
    ExtrudeTool.MAX_RADIUS = 100;
    ExtrudeTool.MIN_SAMPLES = 1;
    ExtrudeTool.MAX_SAMPLES = 16;
    ExtrudeTool.MIN_TOLERANCE = 1;
    ExtrudeTool.MAX_TOLERANCE = 16;
    ExtrudeTool.TICK_REFRESH_RATE = 5;
    var RepeaterTelemetry;
    (function(RepeaterTelemetry) {
        RepeaterTelemetry["Repeat"] = "Repeat";
    })(RepeaterTelemetry || (RepeaterTelemetry = {}));
    class RepeaterTool {
        constructor(uiSession) {
            this.uiSession = uiSession;
            this.isActiveTool = false;
            this.widgets = new Array;
            this.session = uiSession;
            uiSession.log.debug(`Initializing ${RepeaterTool.BEHAVIOR_NAME}`);
            this.telemetryManager = new TelemetryManager(uiSession.extensionContext.player, TelemetrySource.Repeater);
            this.spacing = (0, server_editor_namespaceObject.makeObservable)({
                x: 1,
                y: 0,
                z: 0
            });
            this.repetitions = (0, server_editor_namespaceObject.makeObservable)(1);
            this.statusMessage = (0, server_editor_namespaceObject.makeObservable)("");
            this.visualizationWidgets = uiSession.extensionContext.widgetManager.createGroup({
                groupSelectionMode: server_editor_namespaceObject.WidgetGroupSelectionMode.Multiple,
                visible: true
            });
            this.tool = this.createTool(uiSession);
            this.pane = this._createToolPane(uiSession);
            this.tool.bindPropertyPane(this.pane);
        }
        createTool(uiSession) {
            const toolToggleAction = uiSession.actionManager.createAction({
                actionType: server_editor_namespaceObject.ActionTypes.NoArgsAction,
                onExecute: () => {
                    uiSession.toolRail.setSelectedToolId(tool.id);
                }
            });
            const tool = uiSession.toolRail.addTool("editor:modalTool:repeater", {
                title: "resourcePack.editor.toolRail.RepeaterTool.title",
                icon: "pack://textures/editor/Repeater.png?filtering=point",
                tooltip: "resourcePack.editor.toolRail.RepeaterTool.tooltip",
                action: toolToggleAction
            });
            tool.onModalToolActivation.subscribe((data => {
                this.isActiveTool = data.isActiveTool;
                if (data.isActiveTool) {
                    this._redrawVisualization(uiSession);
                } else {
                    this._clearVisualization();
                }
            }));
            this.selectionChangeEventSubscriptionHandle = uiSession.extensionContext.afterEvents.primarySelectionChange.subscribe((() => this._redrawVisualization(this.session)));
            this.modeChangeEventSubscriptionHandle = this.session.extensionContext.afterEvents.modeChange.subscribe((event => {
                if (event.mode === server_editor_namespaceObject.EditorMode.Crosshair) {
                    this._clearVisualization();
                } else if (event.mode === server_editor_namespaceObject.EditorMode.Tool) {
                    this._redrawVisualization(this.session);
                }
            }));
            return tool;
        }
        _clearVisualization() {
            for (const widget of this.widgets) {
                this.visualizationWidgets.deleteWidget(widget);
            }
            this.widgets = [];
        }
        _redrawVisualization(uiSession) {
            const selection = uiSession.extensionContext.selectionManager.selection;
            if (selection.isEmpty) {
                this._clearVisualization();
                if (this.statusMessagePane) {
                    this.statusMessage.set({
                        id: "resourcePack.editor.toolRail.RepeaterTool.statusMessage.noSelection"
                    });
                    this.statusMessagePane.visible = true;
                }
                return;
            }
            if (!this.isActiveTool) {
                return;
            }
            if (this.statusMessagePane) {
                this.statusMessagePane.visible = false;
            }
            this._clearVisualization();
            if (this.spacing.value.x === 0 && this.spacing.value.y === 0 && this.spacing.value.z === 0) {
                return;
            }
            const startCoordinate = selection.getBoundingBox().min;
            const shapeOffset = this._getSelectionOffset(uiSession);
            const clipboardItem = this._getClipboardItemFromSelection(uiSession);
            for (let i = 0; i < this.repetitions.value; i++) {
                const offset = {
                    x: this.spacing.value.x * (i + 1),
                    y: this.spacing.value.y * (i + 1),
                    z: this.spacing.value.z * (i + 1)
                };
                const newStart = lib.Vector3Utils.add(startCoordinate, offset);
                const visualizationStart = lib.Vector3Utils.add(newStart, shapeOffset);
                const widget = this.visualizationWidgets.createWidget(visualizationStart, {});
                widget.addClipboardComponent(`Visualization-${i}`, clipboardItem, {
                    showBounds: true
                });
                this.widgets.push(widget);
            }
        }
        _getClipboardItemFromSelection(uiSession) {
            const selection = uiSession.extensionContext.selectionManager.selection;
            const clipboardItem = uiSession.extensionContext.clipboardManager.create();
            clipboardItem.readFromSelection(selection);
            return clipboardItem;
        }
        _applyRepetition(uiSession) {
            this.telemetryManager.fireTelemetryEvent(RepeaterTelemetry.Repeat, {
                repetitions: this.repetitions.value,
                spacing: this.spacing.value
            });
            uiSession.extensionContext.transactionManager.openTransaction("Repeater Tool");
            const shapeOffset = this._getSelectionOffset(uiSession);
            const clipboardItem = this._getClipboardItemFromSelection(uiSession);
            for (const widget of this.widgets) {
                const widgetLocation = lib.Vector3Utils.subtract(widget.location, shapeOffset);
                clipboardItem.writeToWorld(widgetLocation);
            }
            uiSession.extensionContext.transactionManager.commitOpenTransaction();
            this._clearVisualization();
        }
        _getSelectionOffset(uiSession) {
            const selection = uiSession.extensionContext.selectionManager.selection;
            if (selection.isEmpty) {
                return {
                    x: 0,
                    y: 0,
                    z: 0
                };
            }
            const startCoordinate = selection.getBoundingBox().min;
            const endCoordinate = selection.getBoundingBox().max;
            let shapeOffset = lib.Vector3Utils.subtract(endCoordinate, startCoordinate);
            shapeOffset = lib.Vector3Utils.scale(shapeOffset, .5);
            return shapeOffset;
        }
        _createToolPane(uiSession) {
            const pane = uiSession.createPropertyPane({
                title: "resourcePack.editor.toolRail.RepeaterTool.title",
                infoTooltip: {
                    description: [ "resourcePack.editor.toolRail.repeaterTool.tooltip", {
                        link: "https://aka.ms/BedrockEditorRepeaterTool",
                        text: "resourcePack.editor.help.learnMore"
                    } ]
                }
            });
            this.statusMessagePane = pane.addText(this.statusMessage);
            pane.addVector3(this.spacing, {
                title: "resourcePack.editor.toolRail.RepeaterTool.pane.Spacing",
                isInteger: true,
                onChange: newValue => {
                    this.spacing.set(newValue);
                    this._redrawVisualization(uiSession);
                }
            });
            pane.addNumber(this.repetitions, {
                title: "resourcePack.editor.toolRail.RepeaterTool.pane.Repetitions",
                min: 1,
                max: 100,
                isInteger: true,
                onChange: (newValue, _) => {
                    this.repetitions.set(newValue);
                    this._redrawVisualization(uiSession);
                }
            });
            const applyAction = uiSession.actionManager.createAction({
                actionType: server_editor_namespaceObject.ActionTypes.NoArgsAction,
                onExecute: () => this._applyRepetition(uiSession)
            });
            pane.addButton(applyAction, {
                title: "resourcePack.editor.toolRail.RepeaterTool.pane.Apply",
                visible: true
            });
            pane.hide();
            return pane;
        }
        teardown() {
            if (this.modeChangeEventSubscriptionHandle) {
                this.session.extensionContext.afterEvents.modeChange.unsubscribe(this.modeChangeEventSubscriptionHandle);
                this.modeChangeEventSubscriptionHandle = undefined;
            }
            if (this.selectionChangeEventSubscriptionHandle) {
                this.session.extensionContext.afterEvents.primarySelectionChange.unsubscribe(this.selectionChangeEventSubscriptionHandle);
                this.selectionChangeEventSubscriptionHandle = undefined;
            }
            this._clearVisualization();
            this.uiSession.log.debug(`Shutting down ${RepeaterTool.BEHAVIOR_NAME}`);
        }
    }
    RepeaterTool.BEHAVIOR_NAME = "Repeat Tool";
    function getRandomInt(upper) {
        return Math.floor(Math.random() * (upper + 1));
    }
    function fenceTypeToBlockType(fenceType) {
        switch (fenceType) {
          case 0:
            return MinecraftBlockTypes.OakFence;

          case 1:
            return MinecraftBlockTypes.BirchFence;

          case 2:
            return MinecraftBlockTypes.AcaciaFence;

          case 3:
            return MinecraftBlockTypes.BambooFence;

          case 4:
            return MinecraftBlockTypes.CherryFence;

          case 5:
            return MinecraftBlockTypes.JungleFence;

          case 6:
            return MinecraftBlockTypes.SpruceFence;

          case 7:
            return MinecraftBlockTypes.WarpedFence;

          case 8:
            return MinecraftBlockTypes.CrimsonFence;

          default:
            return MinecraftBlockTypes.OakFence;
        }
    }
    var FarmTelemetry;
    (function(FarmTelemetry) {
        FarmTelemetry["Place"] = "Place";
    })(FarmTelemetry || (FarmTelemetry = {}));
    class FarmGeneratorTool {
        constructor(uiSession) {
            this.buildFarm = (targetCorner, x, z, length, width, possibleAnimals, possibleCrops, player, commonSettings) => {
                let didPlaceAnimal = false;
                for (let i = 0; i < width; i++) {
                    for (let j = length - 1; j > -1; j--) {
                        const xOffset = i * x;
                        const zOffset = z * j;
                        const location = {
                            x: targetCorner.x + xOffset,
                            y: targetCorner.y,
                            z: targetCorner.z + zOffset
                        };
                        const locationAbove = {
                            x: targetCorner.x + xOffset,
                            y: targetCorner.y + 1,
                            z: targetCorner.z + zOffset
                        };
                        const block = player.dimension.getBlock(location);
                        const blockAbove = player.dimension.getBlock(locationAbove);
                        const isBorder = i === 0 || i === width - 1 || j === 0 || j === length - 1;
                        if (xOffset % 3 === 0 && !isBorder && commonSettings.irrigation.value) {
                            block?.setType(MinecraftBlockTypes.Water);
                        } else {
                            block?.setType(MinecraftBlockTypes.Farmland);
                        }
                        if (isBorder) {
                            blockAbove?.setType(fenceTypeToBlockType(commonSettings.fenceType.value));
                        } else if (possibleAnimals.length > 0 && getRandomInt(5) === 5) {
                            const animal = getRandomInt(possibleAnimals.length - 1);
                            const entityType = possibleAnimals[animal];
                            player.dimension.spawnEntity(entityType, blockAbove?.location ?? lib.VECTOR3_ZERO, {
                                initialPersistence: true
                            });
                            didPlaceAnimal = true;
                        } else if (!block?.isLiquid && possibleCrops.length > 0) {
                            const crop = getRandomInt(possibleCrops.length - 1);
                            const blockType = possibleCrops[crop];
                            blockAbove?.setType(blockType);
                        }
                    }
                }
                if (!didPlaceAnimal && possibleAnimals.length > 0 && width > 2 && length > 2) {
                    const locationAbove = {
                        x: targetCorner.x + x,
                        y: targetCorner.y + 1,
                        z: targetCorner.z + z
                    };
                    const blockAbove = player.dimension.getBlock(locationAbove);
                    const animal = getRandomInt(possibleAnimals.length - 1);
                    const entityType = possibleAnimals[animal];
                    player.dimension.spawnEntity(entityType, blockAbove?.location ?? lib.VECTOR3_ZERO, {
                        initialPersistence: true
                    });
                }
            };
            this._tool = this.addFarmGeneratorTool(uiSession);
            this.telemetryManager = new TelemetryManager(uiSession.extensionContext.player, TelemetrySource.Farm);
            this.addFarmGeneratorSettingsPane(uiSession, this._tool);
        }
        teardown() {}
        addFarmGeneratorSettingsPane(uiSession, tool) {
            const windowPane = uiSession.createPropertyPane({
                title: "resourcePack.editor.toolRail.FarmGenerator.pane.title",
                infoTooltip: {
                    description: [ "resourcePack.editor.toolRail.FarmGenerator.tool.tooltip", {
                        link: "https://aka.ms/BedrockEditorFarmGenerator",
                        text: "resourcePack.editor.help.learnMore"
                    } ]
                }
            });
            const cropPane = windowPane.createSubPane({
                title: "resourcePack.editor.toolRail.FarmGenerator.pane.crops.title"
            });
            const animalPane = windowPane.createSubPane({
                title: "resourcePack.editor.toolRail.FarmGenerator.pane.animals.title"
            });
            const commonSettings = {
                farmWidth: (0, server_editor_namespaceObject.makeObservable)(10),
                farmLength: (0, server_editor_namespaceObject.makeObservable)(10),
                irrigation: (0, server_editor_namespaceObject.makeObservable)(false),
                fenceType: (0, server_editor_namespaceObject.makeObservable)(0)
            };
            const cropSettings = {
                wheat: (0, server_editor_namespaceObject.makeObservable)(false),
                pumpkin: (0, server_editor_namespaceObject.makeObservable)(false),
                potato: (0, server_editor_namespaceObject.makeObservable)(false),
                carrot: (0, server_editor_namespaceObject.makeObservable)(false),
                beetroot: (0, server_editor_namespaceObject.makeObservable)(false)
            };
            const animalSettings = {
                pig: (0, server_editor_namespaceObject.makeObservable)(false),
                sheep: (0, server_editor_namespaceObject.makeObservable)(false),
                cow: (0, server_editor_namespaceObject.makeObservable)(false)
            };
            const onExecuteGenerator = ray => {
                const player = uiSession.extensionContext.player;
                const raycastResult = ray !== undefined ? player.dimension.getBlockFromRay(ray.location, ray.direction) : player.getBlockFromViewDirection();
                if (!raycastResult) {
                    uiSession.log.error("No block from view vector");
                    return;
                }
                const targetBlock = raycastResult.block;
                let targetCorner = {
                    x: targetBlock.location.x,
                    y: targetBlock.location.y,
                    z: targetBlock.location.z
                };
                const possibleCrops = [];
                if (cropSettings.beetroot.value) {
                    possibleCrops.push(MinecraftBlockTypes.Beetroot);
                }
                if (cropSettings.carrot.value) {
                    possibleCrops.push(MinecraftBlockTypes.Carrots);
                }
                if (cropSettings.pumpkin.value) {
                    possibleCrops.push(MinecraftBlockTypes.Pumpkin);
                }
                if (cropSettings.wheat.value) {
                    possibleCrops.push(MinecraftBlockTypes.Wheat);
                }
                if (cropSettings.potato.value) {
                    possibleCrops.push(MinecraftBlockTypes.Potatoes);
                }
                const possibleAnimals = [];
                if (animalSettings.sheep.value) {
                    possibleAnimals.push(MinecraftEntityTypes.Sheep);
                }
                if (animalSettings.cow.value) {
                    possibleAnimals.push(MinecraftEntityTypes.Cow);
                }
                if (animalSettings.pig.value) {
                    possibleAnimals.push(MinecraftEntityTypes.Pig);
                }
                let x = 1;
                let z = 1;
                let length = commonSettings.farmLength.value;
                let width = commonSettings.farmWidth.value;
                if (Math.round(player.getViewDirection().z) === -1) {
                    targetCorner = {
                        x: targetCorner.x + (commonSettings.farmWidth.value / 2 - 1),
                        y: targetCorner.y,
                        z: targetCorner.z - (commonSettings.farmLength.value / 2 - 1)
                    };
                    uiSession.log.info("Facing north");
                    x = -1;
                } else if (Math.round(player.getViewDirection().x) === 1) {
                    targetCorner = {
                        x: targetCorner.x + (commonSettings.farmWidth.value / 2 - 1),
                        y: targetCorner.y,
                        z: targetCorner.z + (commonSettings.farmLength.value / 2 - 1)
                    };
                    uiSession.log.info("Facing east");
                    length = commonSettings.farmWidth.value;
                    width = commonSettings.farmLength.value;
                    x = -1;
                    z = -1;
                }
                if (Math.round(player.getViewDirection().z) === 1) {
                    targetCorner = {
                        x: targetCorner.x - (commonSettings.farmWidth.value / 2 - 1),
                        y: targetCorner.y,
                        z: targetCorner.z + (commonSettings.farmLength.value / 2 - 1)
                    };
                    uiSession.log.info("Facing south");
                    z = -1;
                } else if (Math.round(player.getViewDirection().x) === -1) {
                    targetCorner = {
                        x: targetCorner.x - (commonSettings.farmWidth.value / 2 - 1),
                        y: targetCorner.y,
                        z: targetCorner.z - (commonSettings.farmLength.value / 2 - 1)
                    };
                    uiSession.log.info("Facing west");
                    length = commonSettings.farmWidth.value;
                    width = commonSettings.farmLength.value;
                }
                this.telemetryManager.fireTelemetryEvent(FarmTelemetry.Place, {
                    farmWidth: commonSettings.farmWidth.value,
                    farmLength: commonSettings.farmLength.value,
                    irrigation: commonSettings.irrigation.value,
                    fenceType: commonSettings.fenceType.value,
                    crops: possibleCrops,
                    animals: possibleAnimals
                });
                this.buildFarm(targetCorner, x, z, length, width, possibleAnimals, possibleCrops, player, commonSettings);
            };
            const executeMouseAction = uiSession.actionManager.createAction({
                actionType: server_editor_namespaceObject.ActionTypes.MouseRayCastAction,
                onExecute: (mouseRay, mouseProps) => {
                    if (mouseProps.mouseAction === server_editor_namespaceObject.MouseActionType.LeftButton && mouseProps.inputType === server_editor_namespaceObject.MouseInputType.ButtonDown) {
                        onExecuteGenerator(mouseRay);
                    }
                }
            });
            const executeKeyAction = uiSession.actionManager.createAction({
                actionType: server_editor_namespaceObject.ActionTypes.NoArgsAction,
                onExecute: () => {
                    onExecuteGenerator();
                }
            });
            tool.registerKeyBinding(executeKeyAction, {
                key: server_editor_namespaceObject.KeyboardKey.KEY_P,
                modifier: server_editor_namespaceObject.InputModifier.Control
            }, {
                uniqueId: "editorSamples:farmGenerator:place",
                label: "resourcePack.editor.toolRail.FarmGenerator.keyBinding.place"
            });
            tool.registerMouseButtonBinding(executeMouseAction);
            windowPane.addNumber(commonSettings.farmLength, {
                title: "resourcePack.editor.toolRail.FarmGenerator.pane.length",
                min: 2,
                max: 20,
                isInteger: true
            });
            windowPane.addNumber(commonSettings.farmWidth, {
                title: "resourcePack.editor.toolRail.FarmGenerator.pane.width",
                min: 2,
                max: 20,
                isInteger: true
            });
            windowPane.addDropdown(commonSettings.fenceType, {
                title: "resourcePack.editor.toolRail.FarmGenerator.pane.fence",
                enable: true,
                entries: [ {
                    label: "Oak",
                    value: 0
                }, {
                    label: "Birch",
                    value: 1
                }, {
                    label: "Acacia",
                    value: 2
                }, {
                    label: "Bamboo",
                    value: 3
                }, {
                    label: "Cherry",
                    value: 4
                }, {
                    label: "Jungle",
                    value: 5
                }, {
                    label: "Spruce",
                    value: 6
                }, {
                    label: "Warped",
                    value: 7
                }, {
                    label: "Crimson",
                    value: 8
                } ]
            });
            windowPane.addBool(commonSettings.irrigation, {
                title: "resourcePack.editor.toolRail.FarmGenerator.pane.irrigation",
                tooltip: "resourcePack.editor.toolRail.FarmGenerator.pane.irrigation.tooltip"
            });
            cropPane.addBool(cropSettings.wheat, {
                title: "resourcePack.editor.toolRail.FarmGenerator.pane.crops.wheat"
            });
            cropPane.addBool(cropSettings.potato, {
                title: "resourcePack.editor.toolRail.FarmGenerator.pane.crops.potato"
            });
            cropPane.addBool(cropSettings.beetroot, {
                title: "resourcePack.editor.toolRail.FarmGenerator.pane.crops.beets"
            });
            cropPane.addBool(cropSettings.pumpkin, {
                title: "resourcePack.editor.toolRail.FarmGenerator.pane.crops.pumpkin"
            });
            cropPane.addBool(cropSettings.carrot, {
                title: "resourcePack.editor.toolRail.FarmGenerator.pane.crops.carrot"
            });
            animalPane.addBool(animalSettings.cow, {
                title: "resourcePack.editor.toolRail.FarmGenerator.pane.animals.cow"
            });
            animalPane.addBool(animalSettings.sheep, {
                title: "resourcePack.editor.toolRail.FarmGenerator.pane.animals.sheep"
            });
            animalPane.addBool(animalSettings.pig, {
                title: "resourcePack.editor.toolRail.FarmGenerator.pane.animals.pig"
            });
            tool.bindPropertyPane(windowPane);
        }
        addFarmGeneratorTool(uiSession) {
            const toolToggleAction = uiSession.actionManager.createAction({
                actionType: server_editor_namespaceObject.ActionTypes.NoArgsAction,
                onExecute: () => {
                    uiSession.toolRail.setSelectedToolId(tool.id);
                }
            });
            const tool = uiSession.toolRail.addTool("editorCore:farmTool", {
                title: "resourcePack.editor.toolRail.FarmGenerator.tool.title",
                icon: "pack://textures/editor/farm-generator.png?filtering=point",
                tooltip: "resourcePack.editor.toolRail.FarmGenerator.tool.tooltip",
                action: toolToggleAction
            });
            return tool;
        }
    }
    function createCoreUI(uiSession) {
        if (!uiSession.scratchStorage) {
            throw new Error("Core UI initialization order incorrect");
        }
        const player = uiSession.extensionContext.player;
        const internalServices = server_editor_bindings_namespaceObject.editorInternal.getPlayerServices(player);
        try {
            internalServices.tickingArea.purgeTickingAreas(EDITOR_PREFIX);
        } catch (e) {
            uiSession.log.error(`Failed to purge ticking areas:${(0, server_editor_namespaceObject.stringFromException)(e)}`);
        }
        const showUISettingsAction = uiSession.actionManager.createAction({
            actionType: server_editor_namespaceObject.ActionTypes.NoArgsAction,
            onExecute: () => {
                uiSession.builtInUIManager.updateUISettingsPanelVisibility(true);
            }
        });
        const pauseScreenAction = uiSession.actionManager.createAction({
            actionType: server_editor_namespaceObject.ActionTypes.NoArgsAction,
            onExecute: () => {
                uiSession.builtInUIManager.navigateToPauseScreen();
            }
        });
        const showLoggingPaneAction = uiSession.actionManager.createAction({
            actionType: server_editor_namespaceObject.ActionTypes.NoArgsAction,
            onExecute: () => {
                uiSession.builtInUIManager.updateLogPanelVisibility(true);
            }
        });
        const overworldAction = uiSession.actionManager.createAction({
            actionType: server_editor_namespaceObject.ActionTypes.NoArgsAction,
            onExecute: () => {
                const rotation = player.getRotation();
                player.teleport(player.location, {
                    dimension: server_namespaceObject.world.getDimension("overworld"),
                    rotation,
                    keepVelocity: false
                });
            }
        });
        const netherAction = uiSession.actionManager.createAction({
            actionType: server_editor_namespaceObject.ActionTypes.NoArgsAction,
            onExecute: () => {
                const rotation = player.getRotation();
                player.teleport(player.location, {
                    dimension: server_namespaceObject.world.getDimension("nether"),
                    rotation,
                    keepVelocity: false
                });
            }
        });
        const endAction = uiSession.actionManager.createAction({
            actionType: server_editor_namespaceObject.ActionTypes.NoArgsAction,
            onExecute: () => {
                uiSession.extensionContext.transactionManager.openTransaction("Transaction dimension change");
                const rotation = player.getRotation();
                player.teleport(player.location, {
                    dimension: server_namespaceObject.world.getDimension("the_end"),
                    rotation,
                    keepVelocity: false
                });
                uiSession.extensionContext.transactionManager.commitOpenTransaction();
            }
        });
        const quickStartAction = uiSession.actionManager.createAction({
            actionType: server_editor_namespaceObject.ActionTypes.NoArgsAction,
            onExecute: () => {
                uiSession.builtInUIManager.updateWelcomePanelVisibility(true);
            }
        });
        const documentationAction = uiSession.actionManager.createAction({
            actionType: server_editor_namespaceObject.ActionTypes.NoArgsAction,
            onExecute: () => {
                uiSession.builtInUIManager.navigateToDocumentation();
            }
        });
        const feedbackAction = uiSession.actionManager.createAction({
            actionType: server_editor_namespaceObject.ActionTypes.NoArgsAction,
            onExecute: () => {
                uiSession.builtInUIManager.navigateToFeedback();
            }
        });
        let cursorProjectMenuItem = undefined;
        const cursorProjectAction = uiSession.actionManager.createAction({
            actionType: server_editor_namespaceObject.ActionTypes.NoArgsAction,
            onExecute: () => {
                if (cursorProjectMenuItem) {
                    const props = uiSession.extensionContext.cursor.getProperties();
                    props.projectThroughLiquid = !props.projectThroughLiquid;
                    cursorProjectMenuItem.checked = props.projectThroughLiquid;
                    uiSession.extensionContext.cursor.setProperties(props);
                }
            }
        });
        const initialCursorProjection = uiSession.extensionContext.cursor.getProperties().projectThroughLiquid;
        const cursorChangeHandle = uiSession.extensionContext.afterEvents.cursorPropertyChange.subscribe((event => {
            if (event.properties.projectThroughLiquid !== undefined && cursorProjectMenuItem) {
                cursorProjectMenuItem.checked = event.properties.projectThroughLiquid;
            }
        }));
        uiSession.scratchStorage.cleanupHandles.push((() => uiSession.extensionContext.afterEvents.cursorPropertyChange.unsubscribe(cursorChangeHandle)));
        uiSession.inputManager.registerKeyBinding(server_editor_namespaceObject.EditorInputContext.GlobalToolMode, pauseScreenAction, {
            key: server_editor_namespaceObject.KeyboardKey.KEY_Q,
            modifier: server_editor_namespaceObject.InputModifier.Control
        }, {
            uniqueId: "editor:toolModeKeyBinding:showGameMenu",
            label: "resourcePack.editor.core.keyBinding.showGameMenu"
        });
        uiSession.inputManager.registerKeyBinding(server_editor_namespaceObject.EditorInputContext.GlobalToolMode, showLoggingPaneAction, {
            key: server_editor_namespaceObject.KeyboardKey.KEY_H,
            modifier: server_editor_namespaceObject.InputModifier.Control
        }, {
            uniqueId: "editor:toolModeKeyBinding:showLogPanel",
            label: "resourcePack.editor.core.keyBinding.showLogPanel"
        });
        const file = uiSession.menuBar.createMenu({
            label: "resourcePack.editor.menuBar.file",
            uniqueId: server_editor_namespaceObject.CoreMenuType.File
        });
        const edit = uiSession.menuBar.createMenu({
            label: "resourcePack.editor.menuBar.edit",
            uniqueId: server_editor_namespaceObject.CoreMenuType.Edit
        });
        const extensions = uiSession.menuBar.createMenu({
            label: "resourcePack.editor.menuBar.extensions",
            uniqueId: server_editor_namespaceObject.CoreMenuType.Extensions
        });
        const view = uiSession.menuBar.createMenu({
            label: "resourcePack.editor.menuBar.view",
            uniqueId: server_editor_namespaceObject.CoreMenuType.View
        });
        const worldOptions = uiSession.menuBar.createMenu({
            label: "resourcePack.editor.menuBar.worldOptions",
            uniqueId: server_editor_namespaceObject.CoreMenuType.WorldOptions
        });
        const experimental = uiSession.menuBar.createMenu({
            label: "resourcePack.editor.menuBar.experimental",
            uniqueId: server_editor_namespaceObject.CoreMenuType.Experimental
        });
        const help = uiSession.menuBar.createMenu({
            label: "resourcePack.editor.menuBar.help",
            uniqueId: server_editor_namespaceObject.CoreMenuType.Help
        });
        file.addItem({
            label: "resourcePack.editor.menuBar.file.settings"
        }, showUISettingsAction);
        const cursorMenu = file.addItem({
            label: "resourcePack.editor.menuBar.file.cursor"
        });
        cursorProjectMenuItem = cursorMenu.addItem({
            label: "resourcePack.editor.menuBar.file.cursor.projectThroughLiquid",
            checked: initialCursorProjection
        }, cursorProjectAction);
        file.addItem({
            label: "resourcePack.editor.menuBar.file.pauseScreen"
        }, pauseScreenAction);
        view.addItem({
            label: "resourcePack.editor.menuBar.view.logging"
        }, showLoggingPaneAction);
        if (!uiSession.scratchStorage.pauseBehavior) {
            throw new Error("pauseBehavior undefined - Core UI initialization order incorrect");
        }
        uiSession.scratchStorage.pauseBehavior.createPauseMenu(worldOptions);
        const changeDimension = worldOptions.addItem({
            label: "resourcePack.editor.menuBar.worldOptions.changeDimension"
        });
        changeDimension.addItem({
            label: "resourcePack.editor.menuBar.worldOptions.changeDimension.overworld"
        }, overworldAction);
        changeDimension.addItem({
            label: "resourcePack.editor.menuBar.worldOptions.changeDimension.nether"
        }, netherAction);
        changeDimension.addItem({
            label: "resourcePack.editor.menuBar.worldOptions.changeDimension.end"
        }, endAction);
        help.addItem({
            label: "resourcePack.editor.menuBar.help.quickStart"
        }, quickStartAction);
        help.addItem({
            label: "resourcePack.editor.menuBar.help.documentation"
        }, documentationAction);
        help.addItem({
            label: "resourcePack.editor.menuBar.help.feedback"
        }, feedbackAction);
        file.show();
        edit.show();
        worldOptions.show();
        help.show();
        return {
            file,
            edit,
            extensions,
            view,
            worldOptions,
            experimental,
            help
        };
    }
    function registerCoreEditorExtension() {
        (0, server_editor_namespaceObject.registerEditorExtension)("CoreEditor", (uiSession => {
            uiSession.log.debug(`Initializing ${uiSession.extensionContext.extensionInfo.name} extension`);
            uiSession.scratchStorage = {
                cleanupHandles: []
            };
            registerCoreBrushShapes(uiSession);
            uiSession.scratchStorage.pauseBehavior = new PauseBehavior(uiSession);
            uiSession.scratchStorage.coreMenuItems = createCoreUI(uiSession);
            const transactions = new UndoRedoBehavior(uiSession, uiSession.scratchStorage.coreMenuItems);
            const selectBehavior = new SelectionBehavior(uiSession);
            uiSession.scratchStorage.copyPasteBehavior = new CopyPasteBehavior(uiSession);
            uiSession.scratchStorage.newPastePreview = new PastePreviewBehavior(uiSession, selectBehavior.toolId);
            uiSession.scratchStorage.deleteBehavior = new DeleteBehavior(uiSession, uiSession.scratchStorage.coreMenuItems);
            uiSession.scratchStorage.playerCountBehavior = new PlayerCountBehavior(uiSession);
            const playtest = new PlaytestBehavior(uiSession);
            const navigationStack = new NavigationStackBehavior(uiSession);
            const line = new LineBehavior(uiSession);
            const summonTool = new SummonTool(uiSession);
            const timeOfDay = new TimeOfDayBehavior(uiSession, uiSession.scratchStorage.coreMenuItems.worldOptions);
            const gotoMark = new GotoMarkBehavior(uiSession, uiSession.scratchStorage.coreMenuItems.worldOptions);
            const jsonPropertyPane = new JSONPropertyPane(uiSession);
            const weather = new WeatherBehavior(uiSession, uiSession.scratchStorage.coreMenuItems.worldOptions);
            const rulerTool = new RulerToolBehavior(uiSession);
            const exportBehavior = new ExportBehavior(uiSession, uiSession.scratchStorage.coreMenuItems.file);
            const brushPainter = new BrushPainterBehavior(uiSession);
            const locateTool = new LocateTool(uiSession);
            const flattenBrush = new FlattenBrushBehavior(uiSession);
            const smartFill = new SmartFillToolBehavior(uiSession);
            const smoothRoughen = new SmoothRoughenBehavior(uiSession);
            const extrudeTool = new ExtrudeTool(uiSession);
            const repeaterTool = new RepeaterTool(uiSession);
            const farmGeneratorTool = new FarmGeneratorTool(uiSession);
            uiSession.log.debug("CoreEditor Extension Initialized\n");
            return [ selectBehavior, uiSession.scratchStorage.deleteBehavior, uiSession.scratchStorage.playerCountBehavior, uiSession.scratchStorage.pauseBehavior, uiSession.scratchStorage.newPastePreview, uiSession.scratchStorage.copyPasteBehavior, transactions, playtest, navigationStack, line, summonTool, timeOfDay, gotoMark, weather, jsonPropertyPane, rulerTool, exportBehavior, brushPainter, locateTool, flattenBrush, smartFill, smoothRoughen, extrudeTool, repeaterTool, farmGeneratorTool ];
        }), (uiSession => {
            uiSession.log.debug(`Shutting down ${uiSession.extensionContext.extensionInfo.name} Extension\n`);
            if (uiSession.scratchStorage) {
                uiSession.scratchStorage.cleanupHandles.forEach((handle => handle()));
            }
        }), {
            description: "Minecraft Core Editor Built-in Extensions",
            notes: "https://github.com/Mojang/minecraft-editor"
        });
    }
    function flyCameraToTarget(uiSession, target, viewTarget) {
        if (uiSession.scratchStorage) {
            const easeTimeInSeconds = uiSession.scratchStorage.easeTimeInSeconds;
            const player = uiSession.extensionContext.player;
            const playerPosition = player.location;
            const playerHeadPosition = player.getHeadLocation();
            const playerCameraPosition = lib.Vector3Utils.add(playerHeadPosition, uiSession.scratchStorage.cameraHeadOffset);
            const playerCameraDelta = lib.Vector3Utils.subtract(playerCameraPosition, playerPosition);
            const effectOptions = {
                showParticles: false
            };
            player.addEffect("minecraft:invisibility", (easeTimeInSeconds + .25) * server_namespaceObject.TicksPerSecond, effectOptions);
            const desiredDistance = 0;
            const direction = lib.Vector3Utils.subtract(target, playerCameraPosition);
            const normalizedDirection = lib.Vector3Utils.normalize(direction);
            const offset = lib.Vector3Utils.scale(normalizedDirection, desiredDistance);
            uiSession.scratchStorage.latestRunId = server_namespaceObject.system.runTimeout((() => {
                const cameraPositionOptions = {
                    easeOptions: {
                        easeTime: easeTimeInSeconds,
                        easeType: server_namespaceObject.EasingType.InOutQuad
                    },
                    facingLocation: viewTarget,
                    location: lib.Vector3Utils.add(target, offset)
                };
                player.camera.setCamera("minecraft:free", cameraPositionOptions);
            }), .1 * server_namespaceObject.TicksPerSecond);
            const newPlayerRotationTarget = lib.Vector3Utils.subtract(viewTarget, playerCameraDelta);
            const newPlayerPositionTarget = lib.Vector3Utils.subtract(target, playerCameraDelta);
            uiSession.scratchStorage.latestRunId = server_namespaceObject.system.runTimeout((() => {
                player.camera.setCamera("minecraft:first_person");
                player.teleport(newPlayerPositionTarget, {
                    facingLocation: newPlayerRotationTarget
                });
                if (uiSession.scratchStorage) {
                    uiSession.scratchStorage.latestRunId = undefined;
                }
            }), easeTimeInSeconds * server_namespaceObject.TicksPerSecond);
        }
    }
    function registerGrappleExtension() {
        (0, server_editor_namespaceObject.registerEditorExtension)("Grapple", (uiSession => {
            uiSession.log.debug(`Initializing ${uiSession.extensionContext.extensionInfo.name} extension`);
            uiSession.scratchStorage = {
                latestRunId: undefined,
                easeTimeInSeconds: .75,
                playerFOV: 66,
                grappleDistance: 100,
                cameraHeadOffset: {
                    x: 0,
                    y: .1,
                    z: 0
                }
            };
            const grappleAction = uiSession.actionManager.createAction({
                actionType: server_editor_namespaceObject.ActionTypes.NoArgsAction,
                onExecute: () => {
                    if (uiSession.scratchStorage?.latestRunId || !uiSession.scratchStorage?.grappleDistance) {
                        return;
                    }
                    const playerCameraPosition = lib.Vector3Utils.add(uiSession.extensionContext.player.getHeadLocation(), uiSession.scratchStorage.cameraHeadOffset);
                    const cursorRay = uiSession.extensionContext.cursor.getRay();
                    const rayDirection = lib.Vector3Utils.subtract(cursorRay.end, cursorRay.start);
                    const normalizedDirection = lib.Vector3Utils.normalize(rayDirection);
                    let cameraTarget = uiSession.extensionContext.player.location;
                    let positionTarget = uiSession.extensionContext.player.location;
                    if (cursorRay.hit === true) {
                        const blockHit = uiSession.extensionContext.player.dimension.getBlockFromRay(cursorRay.start, normalizedDirection, {
                            includePassableBlocks: true
                        });
                        if (blockHit?.block) {
                            cameraTarget = blockHit.block.center();
                            positionTarget = lib.Vector3Utils.subtract(cameraTarget, lib.Vector3Utils.scale(lib.Vector3Utils.normalize(lib.Vector3Utils.subtract(cameraTarget, playerCameraPosition)), 3));
                            fireTelemetryEvent(uiSession.extensionContext.player, TelemetrySource.Grapple, "GrappleToBlock");
                        }
                    } else {
                        const length = lib.Vector3Utils.magnitude(rayDirection);
                        if (length < uiSession.scratchStorage.grappleDistance) {
                            cameraTarget = cursorRay.end;
                            positionTarget = cameraTarget;
                        } else {
                            cameraTarget = lib.Vector3Utils.add(cursorRay.start, lib.Vector3Utils.scale(normalizedDirection, uiSession.scratchStorage.grappleDistance + 2));
                            positionTarget = lib.Vector3Utils.add(cursorRay.start, lib.Vector3Utils.scale(normalizedDirection, uiSession.scratchStorage.grappleDistance));
                        }
                        fireTelemetryEvent(uiSession.extensionContext.player, TelemetrySource.Grapple, "GrappleDistance");
                    }
                    flyCameraToTarget(uiSession, positionTarget, cameraTarget);
                }
            });
            const frameAction = uiSession.actionManager.createAction({
                actionType: server_editor_namespaceObject.ActionTypes.NoArgsAction,
                onExecute: () => {
                    if (uiSession.scratchStorage?.latestRunId || !uiSession.scratchStorage) {
                        return;
                    }
                    const selection = uiSession.extensionContext.selectionManager.selection;
                    if (!selection || selection.isEmpty) {
                        return;
                    }
                    const bounds = selection.getBoundingBox();
                    if (!bounds) {
                        return;
                    }
                    bounds.max = lib.Vector3Utils.add(bounds.max, {
                        x: 1,
                        y: 1,
                        z: 1
                    });
                    const cameraTarget = lib.Vector3Utils.scale(lib.Vector3Utils.add(bounds.min, bounds.max), .5);
                    const xEdge = (bounds.max.x - bounds.min.x) / 2;
                    const yEdge = (bounds.max.y - bounds.min.y) / 2;
                    const zEdge = (bounds.max.z - bounds.min.z) / 2;
                    const radiusToUse = (xEdge + yEdge + zEdge) / 3;
                    const halfFOV = uiSession.scratchStorage.playerFOV / 2;
                    const thetaInRadians = halfFOV / 2 * Math.PI / 180;
                    const targetDistanceDelta = radiusToUse / Math.tan(thetaInRadians);
                    const playerCameraPosition = lib.Vector3Utils.add(uiSession.extensionContext.player.getHeadLocation(), uiSession.scratchStorage.cameraHeadOffset);
                    const cameraDirection = lib.Vector3Utils.subtract(cameraTarget, playerCameraPosition);
                    const normalizedDirection = lib.Vector3Utils.normalize(cameraDirection);
                    const fullDistance = lib.Vector3Utils.magnitude(cameraDirection);
                    const desiredDistance = fullDistance - targetDistanceDelta;
                    const offset = lib.Vector3Utils.scale(normalizedDirection, desiredDistance);
                    const positionTarget = lib.Vector3Utils.add(playerCameraPosition, offset);
                    fireTelemetryEvent(uiSession.extensionContext.player, TelemetrySource.Grapple, "GrappleToSelection");
                    flyCameraToTarget(uiSession, positionTarget, cameraTarget);
                }
            });
            uiSession.inputManager.registerKeyBinding(server_editor_namespaceObject.EditorInputContext.Viewport, grappleAction, {
                key: server_editor_namespaceObject.KeyboardKey.KEY_G
            }, {
                uniqueId: "editor:viewportKeyBinding:flyToCursor",
                label: "resourcePack.editor.grapple.keyBinding.flyToCursor"
            });
            uiSession.inputManager.registerKeyBinding(server_editor_namespaceObject.EditorInputContext.Viewport, frameAction, {
                key: server_editor_namespaceObject.KeyboardKey.KEY_F,
                modifier: server_editor_namespaceObject.InputModifier.Control | server_editor_namespaceObject.InputModifier.Shift
            }, {
                uniqueId: "editor:viewportKeyBinding:flyToSelection",
                label: "resourcePack.editor.grapple.keyBinding.flyToSelection"
            });
            return [];
        }), (uiSession => {
            uiSession.log.debug(`Shutting down ${uiSession.extensionContext.extensionInfo.name} extension`);
            if (uiSession.scratchStorage?.latestRunId) {
                server_namespaceObject.system.clearRun(uiSession.scratchStorage.latestRunId);
                uiSession.scratchStorage.latestRunId = undefined;
            }
        }));
    }
    const PlayerPosition_DimensionIds = {
        "minecraft:overworld": 0,
        "minecraft:nether": -1,
        "minecraft:the_end": 1
    };
    const TicksRefreshRate = 5;
    const UnknownBlockType = `--`;
    function getDimensionName(dimensionId) {
        for (const key in PlayerPosition_DimensionIds) {
            const value = PlayerPosition_DimensionIds[key];
            if (value === dimensionId) {
                return key;
            }
        }
        return "minecraft:overworld";
    }
    function movePlayer(location, extensionContext, dimensionId = Number.MIN_SAFE_INTEGER) {
        const player = extensionContext.player;
        const targetDimension = dimensionId !== Number.MIN_SAFE_INTEGER ? server_namespaceObject.world.getDimension(getDimensionName(dimensionId)) : player.dimension;
        const rotation = player.getRotation();
        player.teleport(location, {
            dimension: targetDimension,
            rotation,
            keepVelocity: false
        });
    }
    function getDeltaPosFormat(_delta) {
        return `Δ (${_delta?.x ?? UnknownBlockType},${_delta?.y ?? UnknownBlockType},${_delta?.z ?? UnknownBlockType})`;
    }
    const updateStatusBarText = (statusBarItem, playerLocation, extensionContext) => {
        let cursorDeltaFromPlayerText = "";
        let blockTypeText = UnknownBlockType;
        const cursorLocation = extensionContext.cursor.getPosition();
        if (extensionContext.cursor.isVisible) {
            const dimension = extensionContext.player.dimension;
            cursorDeltaFromPlayerText = getDeltaPosFormat(lib.Vector3Utils.subtract(cursorLocation, playerLocation));
            try {
                blockTypeText = dimension.getBlock(cursorLocation)?.typeId ?? UnknownBlockType;
            } catch (error) {
                server_editor_namespaceObject.editor.log.error(stringFromException(error), {
                    player: extensionContext.player
                });
            }
        } else {
            cursorDeltaFromPlayerText = getDeltaPosFormat();
        }
        statusBarItem.setText(`P (${Math.floor(playerLocation.x)},${Math.floor(playerLocation.y)},${Math.floor(playerLocation.z)}) | ${cursorDeltaFromPlayerText} | C (${Math.floor(cursorLocation.x)},${Math.floor(cursorLocation.y)},${Math.floor(cursorLocation.z)}) | ${blockTypeText}`);
    };
    function registerPlayerPositionExtension() {
        (0, server_editor_namespaceObject.registerEditorExtension)("PlayerPosition", (uiSession => {
            uiSession.log.debug(`Initializing ${uiSession.extensionContext.extensionInfo.name} extension`);
            uiSession.scratchStorage = {
                isDisposed: false,
                latestRunId: -1
            };
            const player = uiSession.extensionContext.player;
            let currentPlayerLocation = player.location;
            let currentCursorLocation = uiSession.extensionContext.cursor.getPosition();
            const pane = uiSession.createPropertyPane({
                title: "resourcePack.editor.playerPositionExtension.pane"
            });
            const playerPosition = (0, server_editor_namespaceObject.bindDataSource)(pane, {
                position: {
                    x: 0,
                    y: 0,
                    z: 0
                },
                dimensionId: PlayerPosition_DimensionIds[player.dimension.id]
            });
            const subPaneDimension = pane.createSubPane({
                title: "resourcePack.editor.playerPositionExtension.worldSettings"
            });
            subPaneDimension.addDropdown_deprecated(playerPosition, "dimensionId", {
                title: "resourcePack.editor.playerPositionExtension.dimension",
                dropdownItems: [ {
                    label: "resourcePack.editor.playerPositionExtension.overworld",
                    value: PlayerPosition_DimensionIds["minecraft:overworld"]
                }, {
                    label: "resourcePack.editor.playerPositionExtension.nether",
                    value: PlayerPosition_DimensionIds["minecraft:nether"]
                }, {
                    label: "resourcePack.editor.playerPositionExtension.theEnd",
                    value: PlayerPosition_DimensionIds["minecraft:the_end"]
                } ],
                onChange: (_obj, _property, _oldValue, _newValue) => {
                    movePlayer(player.location, uiSession.extensionContext, playerPosition.dimensionId);
                }
            });
            const positionStatusItem = uiSession.statusBar.createItem({
                alignment: server_editor_namespaceObject.StatusBarAlignment.Left,
                icon: "informationIcon",
                size: 70
            });
            updateStatusBarText(positionStatusItem, currentPlayerLocation, uiSession.extensionContext);
            let ticks = 0;
            const onTick = () => {
                if (ticks++ % TicksRefreshRate === 0) {
                    ticks = 0;
                    const playerLoc = lib.Vector3Utils.floor(player.location);
                    const cursorLoc = lib.Vector3Utils.floor(uiSession.extensionContext.cursor.getPosition());
                    if (!lib.Vector3Utils.equals(playerLoc, currentPlayerLocation) || !lib.Vector3Utils.equals(cursorLoc, currentCursorLocation)) {
                        currentPlayerLocation = playerLoc;
                        currentCursorLocation = cursorLoc;
                        updateStatusBarText(positionStatusItem, currentPlayerLocation, uiSession.extensionContext);
                    }
                }
                if (uiSession.scratchStorage && !uiSession.scratchStorage.isDisposed) {
                    uiSession.scratchStorage.latestRunId = server_namespaceObject.system.run(onTick);
                }
            };
            uiSession.scratchStorage.latestRunId = server_namespaceObject.system.run(onTick);
            return [];
        }), (uiSession => {
            if (uiSession.scratchStorage && uiSession.scratchStorage.latestRunId !== -1) {
                uiSession.scratchStorage.isDisposed = true;
                server_namespaceObject.system.clearRun(uiSession.scratchStorage.latestRunId);
            }
            uiSession.log.debug(`Shutting down ${uiSession.extensionContext.extensionInfo.name} extension`);
        }), {
            description: "Keeps track of player position and allow to modify it into the pane."
        });
    }
    const PERSISTENCE_KEY = "editor:view-settings";
    var ViewSettingsTelemetry;
    (function(ViewSettingsTelemetry) {
        ViewSettingsTelemetry["ShowInvisibleBlocks"] = "ShowInvisibleBlocks";
        ViewSettingsTelemetry["ShowChunkBoundaries"] = "ShowChunkBoundaries";
        ViewSettingsTelemetry["FlySpeedMultiplier"] = "FlySpeedMultiplier";
        ViewSettingsTelemetry["ShowCompass"] = "ShowCompass";
    })(ViewSettingsTelemetry || (ViewSettingsTelemetry = {}));
    class GraphicsSettingsTool extends server_editor_namespaceObject.SimpleToolWrapper {
        persistSettings() {
            const persistentData = {
                showInvisibleBlocks: this.mShowInvisibleBlocks.value,
                showChunkBoundaries: this.mShowChunkBoundaries.value,
                flySpeedMultiplier: this.mFlySpeedMultiplier.value,
                showCompass: this.mShowCompass.value
            };
            try {
                this.session.extensionContext.player.setDynamicProperty(PERSISTENCE_KEY, JSON.stringify(persistentData));
            } catch (err) {
                this.session.log.error(`Failed to persist settings: ${(0, server_editor_namespaceObject.stringFromException)(err)}`);
            }
        }
        loadSettingsFromStorage() {
            try {
                const persistentData = this.session.extensionContext.player.getDynamicProperty(PERSISTENCE_KEY);
                if (persistentData) {
                    const data = JSON.parse(persistentData);
                    this.mShowInvisibleBlocks.set(data.showInvisibleBlocks);
                    this.mShowChunkBoundaries.set(data.showChunkBoundaries);
                    this.mFlySpeedMultiplier.set(data.flySpeedMultiplier);
                    this.mShowCompass.set(data.showCompass);
                    this.session.extensionContext.settings.graphics.set(server_editor_namespaceObject.GraphicsSettingsProperty.ShowInvisibleBlocks, this.mShowInvisibleBlocks.value);
                    this.session.extensionContext.settings.graphics.set(server_editor_namespaceObject.GraphicsSettingsProperty.ShowChunkBoundaries, this.mShowChunkBoundaries.value);
                    this.session.extensionContext.settings.speed.set(server_editor_namespaceObject.SpeedSettingsProperty.FlySpeedMultiplier, this.mFlySpeedMultiplier.value);
                    this.session.extensionContext.settings.graphics.set(server_editor_namespaceObject.GraphicsSettingsProperty.ShowCompass, this.mShowCompass.value);
                }
            } catch (err) {
                this.session.log.error(`Failed to load settings: ${(0, server_editor_namespaceObject.stringFromException)(err)}`);
            }
        }
        constructor(session) {
            super();
            this.mShowInvisibleBlocks = (0, server_editor_namespaceObject.makeObservable)(true);
            this.mShowChunkBoundaries = (0, server_editor_namespaceObject.makeObservable)(false);
            this.mFlySpeedMultiplier = (0, server_editor_namespaceObject.makeObservable)(1);
            this.mShowCompass = (0, server_editor_namespaceObject.makeObservable)(true);
            this.telemetryManaager = new TelemetryManager(session.extensionContext.player, TelemetrySource.ViewSettings);
            const paneOptions = {
                id: "main",
                title: "resourcePack.editor.viewSettings.title",
                onEndFinalize: component => {
                    this.loadSettingsFromStorage();
                    component.pane.addBool(this.mShowInvisibleBlocks, {
                        title: "resourcePack.editor.viewSettings.invisible.title",
                        tooltip: "resourcePack.editor.viewSettings.invisible.tip",
                        variant: server_editor_namespaceObject.BoolPropertyItemVariant.ToggleSwitch,
                        onChange: (_newValue, _oldValue) => {
                            component.session.extensionContext.settings.graphics.set(server_editor_namespaceObject.GraphicsSettingsProperty.ShowInvisibleBlocks, _newValue);
                            this.telemetryManaager.fireTelemetryEvent(ViewSettingsTelemetry.ShowInvisibleBlocks, {
                                value: _newValue
                            });
                            this.persistSettings();
                        }
                    });
                    component.pane.addBool(this.mShowChunkBoundaries, {
                        title: "resourcePack.editor.viewSettings.chunk.title",
                        tooltip: "resourcePack.editor.viewSettings.chunk.tip",
                        variant: server_editor_namespaceObject.BoolPropertyItemVariant.ToggleSwitch,
                        onChange: (_newValue, _oldValue) => {
                            component.session.extensionContext.settings.graphics.set(server_editor_namespaceObject.GraphicsSettingsProperty.ShowChunkBoundaries, _newValue);
                            this.telemetryManaager.fireTelemetryEvent(ViewSettingsTelemetry.ShowChunkBoundaries, {
                                value: _newValue
                            });
                            this.persistSettings();
                        }
                    });
                    component.pane.addBool(this.mShowCompass, {
                        title: "resourcePack.editor.viewSettings.compass.title",
                        tooltip: "resourcePack.editor.viewSettings.compass.tip",
                        variant: server_editor_namespaceObject.BoolPropertyItemVariant.ToggleSwitch,
                        onChange: (_newValue, _oldValue) => {
                            component.session.extensionContext.settings.graphics.set(server_editor_namespaceObject.GraphicsSettingsProperty.ShowCompass, _newValue);
                            this.telemetryManaager.fireTelemetryEvent(ViewSettingsTelemetry.ShowCompass, {
                                value: _newValue
                            });
                            this.persistSettings();
                        }
                    });
                    component.pane.addDivider();
                    component.pane.addNumber(this.mFlySpeedMultiplier, {
                        title: "resourcePack.editor.viewSettings.flySpeed.title",
                        tooltip: "resourcePack.editor.viewSettings.flySpeed.tip",
                        isInteger: true,
                        min: 1,
                        max: 10,
                        variant: server_editor_namespaceObject.NumberPropertyItemVariant.InputFieldAndSlider,
                        onChange: (_newValue, _oldValue) => {
                            component.session.extensionContext.settings.speed.set(server_editor_namespaceObject.SpeedSettingsProperty.FlySpeedMultiplier, _newValue);
                            this.telemetryManaager.fireTelemetryEvent(ViewSettingsTelemetry.FlySpeedMultiplier, {
                                value: _newValue
                            });
                            this.persistSettings();
                        }
                    });
                }
            };
            const options = {
                id: "editor:viewSettings",
                name: "resourcePack.editor.viewSettings.menu",
                propertyPaneOptions: paneOptions
            };
            this.setupSimpleTool(session, options);
        }
    }
    function registerViewSettingsExtension() {
        (0, server_editor_namespaceObject.registerEditorExtension)("view-settings", (uiSession => {
            uiSession.log.debug(`Initializing extension [${uiSession.extensionContext.extensionInfo.name}]`);
            const graphicsSettingsTool = new GraphicsSettingsTool(uiSession);
            return [ graphicsSettingsTool ];
        }), (uiSession => {
            uiSession.log.debug(`Shutting down extension [${uiSession.extensionContext.extensionInfo.name}] for player [${uiSession.extensionContext.player.name}]`);
        }), {
            description: "View Settings",
            notes: "by Dave (https://youtu.be/KyElxl_j4Wc?si=Mem99VTjqAE_UE2T)"
        });
    }
    function _setupTimeOfDay() {
        server_namespaceObject.world.getDimension("overworld").runCommandAsync("alwaysday true").then((() => {
            server_namespaceObject.world.setTimeOfDay(server_namespaceObject.TimeOfDay.Noon);
        })).catch((_ => console.log("Editor::GlobalInitialize - Unable to adjust daylight cycle due to unknown error.")));
    }
    function _setupDefaultWeatherCycle() {
        const errorString = "Editor::GlobalInitialize - Unable to adjust weather cycle due to unknown error.";
        const dimension = server_namespaceObject.world.getDimension("overworld");
        dimension.runCommandAsync("/gamerule doweathercycle false").then((() => {
            try {
                dimension.setWeather(server_namespaceObject.WeatherType.Clear, 1e6);
            } catch (_err) {
                console.log(errorString);
            }
        })).catch((_ => console.log(errorString)));
    }
    function runOnceEditorInitialization() {
        _setupTimeOfDay();
        _setupDefaultWeatherCycle();
    }
    runOnceEditorInitialization();
    registerCoreEditorExtension();
    registerPlayerPositionExtension();
    registerGrappleExtension();
    registerViewSettingsExtension();
})();