import { aa as y } from "../index-DSGwv2Yx.js";
import "../random_width-B_fVXhGx.js";
import "../zeros_like-rOHr54NY.js";
import "../Generator.js";
import "../index-Cp39cXWe.js";
import "../dataset-DlqAN81i.js";
import "../ops/cpu/attentionMask.js";
import "../ops/webgl/attentionMask.js";
import "../ops/grads/attentionMask.js";
import "../ops/cpu/rope.js";
import "../ops/webgl/rope.js";
import "../rope-CC5RjmKU.js";
import "../ops/cpu/appendCache.js";
import "../ops/webgl/appendCache.js";
import "../ops/grads/softmax16.js";
import "../matMul16-BIT70Vya.js";
import "../ops/webgl/matMul16.js";
import "../ops/cpu/matMul16.js";
import "../pack16-WlOSOuZA.js";
import "../ops/transpose16.js";
import "../ops/reshape16.js";
import "../ops/cpu/qkv.js";
import "../ops/webgl/qkv.js";
import "../ops/grads/qkv.js";
import "../ops/cpu/normRMS.js";
import "../ops/webgl/normRMS.js";
import "../ops/grads/normRMS.js";
import "../ops/dropout16.js";
import "../ops/webgl/dropout16.js";
import "../ops/grads/add16.js";
import "../jszip.min-BZhlzntC.js";
import g from "../tokeniser/CharTokeniser.js";
import k from "../tokeniser/bpe.js";
import { dummyPassAsync as u } from "../utilities/dummy.js";
import b from "../models/factory.js";
import "../ops/cpu/adamAdjust.js";
import "../ops/webgl/adamAdjust.js";
import "../ops/cpu/adamMoments.js";
import "../ops/webgl/adamMoments.js";
import "../index-DvYrXKkX.js";
import "../ops/cpu/gatherSub.js";
import "../ops/webgl/gatherSub.js";
import "../ops/cpu/scatterSub.js";
import "../ops/webgl/scatterSub.js";
import "../papaparse.min-C0cScC2i.js";
import "../ops/cpu/matMulGelu.js";
import "../matMulGelu-CsZnh18H.js";
import "../ops/grads/matMulGelu.js";
import "../ops/cpu/gelu.js";
import "../ops/webgl/gelu.js";
import "../gelu-DpTCC3eB.js";
import "../ops/webgl/log.js";
import "../checks/normRMS.js";
import "../checks/normRMSGrad.js";
import { importWeights as M } from "../utilities/weights.js";
async function jt(r, m) {
  const p = /* @__PURE__ */ new Map(), s = await r.file("manifest.json")?.async("string");
  if (!s)
    throw new Error("Manifest file not found in the zip archive");
  const a = JSON.parse(s);
  for (const [t, o] of Object.entries(a.weightSpec))
    p.set(t, { spec: o, data: new Float32Array() });
  const c = await r.file("tokeniser.json")?.async("string");
  if (!c)
    throw new Error("Tokeniser file not found in the zip archive");
  const i = JSON.parse(c), l = (i.type ?? "char") === "char" ? new g(i.vocab) : new k(i.vocab, i.merges), f = /* @__PURE__ */ new Map();
  for (const t of Object.keys(r.files))
    if (t.endsWith(".bin")) {
      const o = t.replace(".bin", ""), w = await r.file(t).async("arraybuffer"), d = new Float32Array(w), n = p.get(o) || { spec: [], data: new Float32Array() };
      n.data = d, p.set(o, n);
      const h = await M(n);
      f.set(o, h);
    }
  y();
  const e = b(a.config);
  return e.metaData = m, await u(e), e.weightStore.loadWeights(f, !!m.url), { model: e, tokeniser: l, metaData: m };
}
export {
  jt as default
};
