import { print as origPrint } from "graphql";
import { __DEV__ } from "@apollo/client/utilities/environment";
import { registerGlobalCache } from "@apollo/client/utilities/internal";
import { AutoCleanedWeakCache, cacheSizes, } from "../caching/index.js";
let printCache;
export const print = Object.assign((ast) => {
    let result = printCache.get(ast);
    if (!result) {
        result = origPrint(ast);
        printCache.set(ast, result);
    }
    return result;
}, {
    reset() {
        printCache = new AutoCleanedWeakCache(cacheSizes.print || 2000 /* defaultCacheSizes.print */);
    },
});
print.reset();
if (__DEV__) {
    registerGlobalCache("print", () => (printCache ? printCache.size : 0));
}
//# sourceMappingURL=print.js.map
