var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
  // If the importer is in node compatibility mode or this is not an ESM
  // file that has been converted to a CommonJS file using a Babel-
  // compatible transform (i.e. "__esModule" has not been set), then set
  // "default" to the CommonJS "module.exports" for node compatibility.
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
  mod
));
var import_node_test = __toESM(require("node:test"));
var import_strict = __toESM(require("node:assert/strict"));
var import_mesher = require("../src/voxels/mesher.js");
const makeMesh = () => (0, import_mesher.buildVoxelMesh)({
  voxels: [1, 2],
  dimensions: [2, 1, 1],
  size: [2, 1, 1]
});
(0, import_node_test.default)("buildVoxelMesh assigns material groups without mixing palette indices", () => {
  const result = makeMesh();
  import_strict.default.ok(result.groups.length > 1, "expected multiple material groups");
  import_strict.default.equal(new Set(result.groups.map((group) => group.material)).size, 2, "should contain both palette indices");
  let covered = 0;
  result.groups.forEach((group) => {
    import_strict.default.equal(group.start % 6, 0, "group should align with triangle pairs");
    import_strict.default.equal(group.count % 6, 0, "group count should be a multiple of a quad");
    covered += group.count;
  });
  import_strict.default.equal(covered, result.indices.length, "groups should cover entire index buffer");
});
