{"version":3,"file":"GetClientClusters.cjs","sources":["../../../../src/methods/ESPRMMatterNode/GetClientClusters.ts"],"sourcesContent":["/*\n * SPDX-FileCopyrightText: 2026 Espressif Systems (Shanghai) CO LTD\n *\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { ESPRMMatterNode } from \"../../ESPRMMatterNode\";\n\n/**\n * Augments the ESPRMMatterNode class with the `getClientClusters` method.\n */\ndeclare module \"../../ESPRMMatterNode\" {\n  interface ESPRMMatterNode {\n    /**\n     * Gets client cluster IDs exposed by this node.\n     *\n     * When `endpointId` is omitted, returns a sorted, de-duplicated list of all\n     * client cluster IDs across every endpoint. When `endpointId` is provided, returns\n     * only the client clusters on that endpoint (empty array if the endpoint is unknown).\n     *\n     * @param endpointId - Optional endpoint ID (`0` is root, `1+` are application endpoints).\n     * @returns Sorted array of client cluster IDs.\n     *\n     * @example\n     * ```typescript\n     * const node = ESPRMMatterNode.fromMatterMetaData(nodeDetails);\n     *\n     * // All client clusters across endpoints\n     * const allClientClusters = await node.getClientClusters();\n     *\n     * // Client clusters bound to endpoint 0 (root)\n     * const rootClientClusters = await node.getClientClusters(0);\n     * ```\n     */\n    getClientClusters(endpointId?: number): Promise<number[]>;\n  }\n}\n\nESPRMMatterNode.prototype.getClientClusters = async function (\n  endpointId?: number\n): Promise<number[]> {\n  if (endpointId !== undefined) {\n    const endpoint = this.endpoints.find((ep) => ep.endpointId === endpointId);\n    return endpoint?.clientClusters ?? [];\n  }\n\n  const clusterIds = new Set<number>();\n  for (const endpoint of this.endpoints) {\n    for (const clusterId of endpoint.clientClusters) {\n      clusterIds.add(clusterId);\n    }\n  }\n\n  return [...clusterIds].sort((left, right) => left - right);\n};\n"],"names":["ESPRMMatterNode"],"mappings":";;;;AAAA;;;;AAIG;AAkCHA,+BAAe,CAAC,SAAS,CAAC,iBAAiB,GAAG,gBAC5C,UAAmB,EAAA;AAEnB,IAAA,IAAI,UAAU,KAAK,SAAS,EAAE;AAC5B,QAAA,MAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,UAAU,KAAK,UAAU,CAAC;AAC1E,QAAA,OAAO,QAAQ,EAAE,cAAc,IAAI,EAAE;IACvC;AAEA,IAAA,MAAM,UAAU,GAAG,IAAI,GAAG,EAAU;AACpC,IAAA,KAAK,MAAM,QAAQ,IAAI,IAAI,CAAC,SAAS,EAAE;AACrC,QAAA,KAAK,MAAM,SAAS,IAAI,QAAQ,CAAC,cAAc,EAAE;AAC/C,YAAA,UAAU,CAAC,GAAG,CAAC,SAAS,CAAC;QAC3B;IACF;AAEA,IAAA,OAAO,CAAC,GAAG,UAAU,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,KAAK,KAAK,IAAI,GAAG,KAAK,CAAC;AAC5D,CAAC;;"}