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 __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
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 __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);

// src/components/pisellFloorMapLayout/utils/floorMapViewConfigDiff.ts
var floorMapViewConfigDiff_exports = {};
__export(floorMapViewConfigDiff_exports, {
  floorMapViewConfigsEqual: () => floorMapViewConfigsEqual,
  normalizeFloorMapViewConfigFromProp: () => normalizeFloorMapViewConfigFromProp
});
module.exports = __toCommonJS(floorMapViewConfigDiff_exports);
var import_cloneDeep = __toESM(require("lodash/cloneDeep"));
var import_isEqual = __toESM(require("lodash/isEqual"));
var import_types = require("../types");
function normalizeFloorMapViewConfigFromProp(floorMapConfigProp) {
  const src = floorMapConfigProp;
  const base = src.canvasUi != null ? (0, import_cloneDeep.default)(src) : (0, import_cloneDeep.default)({
    ...src,
    canvasUi: {
      canCreate: src.canCreate ?? false,
      canEdit: src.canEdit ?? false
    }
  });
  if (base.canvasUi.canCreate && (!base.elementKinds || base.elementKinds.length === 0)) {
    base.elementKindCategories = [
      { id: "furniture", label: "桌椅设施", order: 0 },
      { id: "decoration", label: "装饰与区域", order: 1 }
    ];
    base.elementKinds = [
      {
        value: "table",
        label: "方桌",
        categoryId: "furniture",
        dataBindingPolicy: "optional",
        allowedDataSourceKeys: ["sales"],
        showInPalette: true
      },
      {
        value: "marker",
        label: "标记",
        categoryId: "decoration",
        dataBindingPolicy: "none",
        showInPalette: true
      },
      {
        value: import_types.FLOOR_MAP_STAGE_ELEMENT_KIND,
        label: "舞台/区域",
        categoryId: "decoration",
        dataBindingPolicy: "none",
        showInPalette: true
      },
      {
        value: import_types.FLOOR_MAP_IMAGE_ELEMENT_KIND,
        label: "图片（底图）",
        categoryId: "decoration",
        dataBindingPolicy: "none",
        showInPalette: true
      },
      {
        value: "icon",
        label: "图标",
        categoryId: "decoration",
        dataBindingPolicy: "none",
        defaultShape: "circle",
        showInPalette: true
      }
    ];
  }
  if (!base.sceneElements) base.sceneElements = [];
  return base;
}
function sortStableForCompare(config) {
  var _a, _b, _c;
  const c = (0, import_cloneDeep.default)(config);
  c.canvases = [...c.canvases].sort(
    (a, b) => String(a.id).localeCompare(String(b.id))
  );
  c.sceneElements = [...c.sceneElements ?? []].sort(
    (a, b) => String(a.instanceId).localeCompare(String(b.instanceId))
  );
  if ((_a = c.elementKinds) == null ? void 0 : _a.length) {
    c.elementKinds = [...c.elementKinds].sort(
      (a, b) => String(a.value).localeCompare(String(b.value))
    );
  }
  if ((_b = c.elementKindCategories) == null ? void 0 : _b.length) {
    c.elementKindCategories = [...c.elementKindCategories].sort(
      (a, b) => String(a.id).localeCompare(String(b.id))
    );
  }
  if ((_c = c.edges) == null ? void 0 : _c.length) {
    c.edges = [...c.edges].sort(
      (a, b) => String(a.id).localeCompare(String(b.id))
    );
  }
  return c;
}
function floorMapViewConfigsEqual(a, b) {
  return (0, import_isEqual.default)(sortStableForCompare(a), sortStableForCompare(b));
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  floorMapViewConfigsEqual,
  normalizeFloorMapViewConfigFromProp
});
