"use strict";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const cloneDeep$1 = require("../../../../node_modules/lodash-es/cloneDeep.js");
function cloneDeep(data) {
  return cloneDeep$1.default(data);
}
function removeEmptyValues(data) {
  if (typeof data !== "object" || data === null) {
    return data;
  }
  if (Array.isArray(data)) {
    return data.map((item) => removeEmptyValues(item)).filter((item) => {
      return item !== null && item !== void 0 && item !== "";
    });
  }
  const result = {};
  for (const key in data) {
    if (Object.prototype.hasOwnProperty.call(data, key)) {
      const value = removeEmptyValues(data[key]);
      if (value !== null && value !== void 0 && value !== "") {
        result[key] = value;
      }
    }
  }
  return result;
}
const findPageById = (pageList, pageId) => {
  for (const item of pageList) {
    if (item.id == pageId) {
      return item;
    }
    if (item.children && item.children.length > 0) {
      const found = findPageById(item.children, pageId);
      if (found) {
        return { ...found, parentPage: item };
      }
    }
  }
  return null;
};
exports.cloneDeep = cloneDeep;
exports.findPageById = findPageById;
exports.removeEmptyValues = removeEmptyValues;
