import { e as a } from "../index-DSGwv2Yx.js";
import "./cpu/appendCache.js";
import "./webgl/appendCache.js";
import { isPackedTensor as c } from "../utilities/packed.js";
import { c as t } from "../concat-Dqk7Xk7h.js";
import { z as f } from "../zeros-Bw0puq_w.js";
function C(r, o, n, p) {
  if (!p) {
    const e = r.shape[2], s = c(r);
    return t(
      [
        r,
        f([r.shape[0], r.shape[1], o - e, r.shape[3]], s ? "int32" : r.dtype)
      ],
      2
    );
  }
  return a().runKernel("AppendCache", { cache: p, item: r }, { maxSize: o, pastLen: n });
}
export {
  C as appendCache
};
