"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
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 __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var MatterModel_exports = {};
__export(MatterModel_exports, {
  MatterModel: () => MatterModel
});
module.exports = __toCommonJS(MatterModel_exports);
var import_elements = require("../elements/index.js");
var import_ModelTraversal = require("../logic/ModelTraversal.js");
var import_AttributeModel = require("./AttributeModel.js");
var import_ClusterModel = require("./ClusterModel.js");
var import_DeviceTypeModel = require("./DeviceTypeModel.js");
var import_FabricModel = require("./FabricModel.js");
var import_FieldModel = require("./FieldModel.js");
var import_Globals = require("./Globals.js");
var import_Model = require("./Model.js");
var import_ScopeModel = require("./ScopeModel.js");
var import_SemanticNamespaceModel = require("./SemanticNamespaceModel.js");
/**
 * @license
 * Copyright 2022-2025 Matter.js Authors
 * SPDX-License-Identifier: Apache-2.0
 */
class MatterModel extends import_ScopeModel.ScopeModel {
  tag = import_elements.MatterElement.Tag;
  get children() {
    return super.children;
  }
  set children(children) {
    super.children = children;
  }
  /**
   * The default instance of the canonical MatterModel (also exported directly simply as "Matter").
   */
  static standard = new MatterModel({
    name: "Matter",
    children: Object.values(import_Globals.Globals)
  });
  /**
   * Clusters.
   */
  get clusters() {
    return this.all(import_ClusterModel.ClusterModel);
  }
  /**
   * Device types.
   */
  get deviceTypes() {
    return this.all(import_DeviceTypeModel.DeviceTypeModel);
  }
  /**
   * Semantic tag namespaces.
   */
  get semanticNamespaces() {
    return this.all(import_SemanticNamespaceModel.SemanticNamespaceModel);
  }
  /**
   * Global datatypes.
   */
  get datatypes() {
    return this.all(import_FieldModel.FieldModel);
  }
  /**
   * Global attributes.
   */
  get attributes() {
    return this.all(import_AttributeModel.AttributeModel);
  }
  /**
   * Fabrics.
   */
  get fabrics() {
    return this.all(import_FabricModel.FabricModel);
  }
  /**
   * Create a new MatterModel.
   *
   * @param definition the MatterElement that defines the model
   */
  constructor(definition, ...children) {
    const name = definition.name ?? "Matter";
    const definitionChildren = [...definition.children || []];
    super({ ...definition, name, children: definitionChildren }, ...children);
  }
  /**
   * All sub-cluster global elements from this model.
   *
   * This is the set of utility datatypes required by cluster definitions.
   *
   * The returned elements are clones as we use this to initialize empty models for testing or diagnostic purposes.
   */
  get seedGlobals() {
    return this.children.filter((child) => child.isSeed).map((child) => child.clone());
  }
  static {
    import_Model.Model.types[import_elements.MatterElement.Tag] = this;
  }
}
import_ModelTraversal.ModelTraversal.fallbackScope = MatterModel.standard;
//# sourceMappingURL=MatterModel.js.map
