{"version":3,"file":"GetValue.cjs","sources":["../../../../src/methods/ESPRMMatterDeviceParam/GetValue.ts"],"sourcesContent":["/*\n * SPDX-FileCopyrightText: 2026 Espressif Systems (Shanghai) CO LTD\n *\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { ESPRMMatterDeviceParam } from \"../../ESPRMMatterDeviceParam\";\nimport { ESPRMMatterNode } from \"../../ESPRMMatterNode\";\nimport { executeMatterControl } from \"../../services/ESPMatterTransport\";\nimport { readXyColorParam } from \"../../services/ESPRMMatterHelpers/XyColorControl\";\nimport { MatterControlOperations } from \"../../utils/constants\";\n\ndeclare module \"../../ESPRMMatterDeviceParam\" {\n  interface ESPRMMatterDeviceParam {\n    /**\n     * Reads the current cluster value via the Matter transport delegate.\n     */\n    getValue(): Promise<ESPRMMatterDeviceParam>;\n  }\n}\n\nESPRMMatterDeviceParam.prototype.getValue = async function (): Promise<\n  ESPRMMatterDeviceParam\n> {\n  const node = this.nodeRef.deref() as ESPRMMatterNode;\n  const matterNodeId = node.matterNodeId!;\n\n  // XY-backed color param: the value derives from the CurrentX/CurrentY pair;\n  // the pair read updates this param and its sibling component together.\n  if (this.xyColorComponent !== undefined) {\n    await readXyColorParam(this, node);\n    return this;\n  }\n\n  const result = await executeMatterControl(node, {\n    operation: MatterControlOperations.READ,\n    matterNodeId,\n    endpointId: this.endpointId!,\n    clusterId: this.clusterId!,\n    attributeId: this.matterAttributeId ?? 0,\n  });\n\n  const readResult = result as { value?: unknown } | null;\n\n  this.value = this.resolver\n    ? this.resolver.decodeValue(readResult?.value, this.rawModes)\n    : readResult?.value;\n\n  return this;\n};\n"],"names":["ESPRMMatterDeviceParam","readXyColorParam","executeMatterControl","MatterControlOperations"],"mappings":";;;;;;;;;AAAA;;;;AAIG;AAiBHA,6CAAsB,CAAC,SAAS,CAAC,QAAQ,GAAG,kBAAK;IAG/C,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,KAAK,EAAqB;AACpD,IAAA,MAAM,YAAY,GAAG,IAAI,CAAC,YAAa;;;AAIvC,IAAA,IAAI,IAAI,CAAC,gBAAgB,KAAK,SAAS,EAAE;AACvC,QAAA,MAAMC,+BAAgB,CAAC,IAAI,EAAE,IAAI,CAAC;AAClC,QAAA,OAAO,IAAI;IACb;AAEA,IAAA,MAAM,MAAM,GAAG,MAAMC,yCAAoB,CAAC,IAAI,EAAE;QAC9C,SAAS,EAAEC,iCAAuB,CAAC,IAAI;QACvC,YAAY;QACZ,UAAU,EAAE,IAAI,CAAC,UAAW;QAC5B,SAAS,EAAE,IAAI,CAAC,SAAU;AAC1B,QAAA,WAAW,EAAE,IAAI,CAAC,iBAAiB,IAAI,CAAC;AACzC,KAAA,CAAC;IAEF,MAAM,UAAU,GAAG,MAAoC;AAEvD,IAAA,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;AAChB,UAAE,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,UAAU,EAAE,KAAK,EAAE,IAAI,CAAC,QAAQ;AAC5D,UAAE,UAAU,EAAE,KAAK;AAErB,IAAA,OAAO,IAAI;AACb,CAAC;;"}