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