"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 Gzip_exports = {};
__export(Gzip_exports, {
  Gzip: () => Gzip
});
module.exports = __toCommonJS(Gzip_exports);
var import_MatterError = require("#MatterError.js");
var import_Streams = require("./Streams.js");
/**
 * @license
 * Copyright 2022-2026 Matter.js Authors
 * SPDX-License-Identifier: Apache-2.0
 */
var Gzip;
((Gzip2) => {
  Gzip2.isAvailable = typeof CompressionStream !== "undefined" && typeof DecompressionStream !== "undefined";
  function compress(source) {
    if (!Gzip2.isAvailable) {
      throw new import_MatterError.ImplementationError("Gzip compression is not supported in this runtime");
    }
    const compressed = import_Streams.Stream.from(source).pipeThrough(
      new CompressionStream("gzip")
    );
    return import_Streams.Stream.iterable(compressed);
  }
  Gzip2.compress = compress;
  function decompress(source) {
    if (!Gzip2.isAvailable) {
      throw new import_MatterError.ImplementationError("Gzip decompression is not supported in this runtime");
    }
    const decompressed = import_Streams.Stream.from(source).pipeThrough(
      new DecompressionStream("gzip")
    );
    return import_Streams.Stream.iterable(decompressed);
  }
  Gzip2.decompress = decompress;
})(Gzip || (Gzip = {}));
//# sourceMappingURL=Gzip.js.map
