import { useState as i, useMemo as a, useCallback as w, useEffect as h } from "react";
import r from "./index.es39.js";
import "./index.es40.js";
import "./index.es41.js";
import "./index.es42.js";
import "./index.es43.js";
import "./index.es44.js";
import "./index.es45.js";
import "./index.es46.js";
import "./index.es47.js";
import "./index.es48.js";
import "./index.es49.js";
import "./index.es50.js";
import "./index.es51.js";
import "./index.es52.js";
import "./index.es53.js";
import "./index.es54.js";
import "./index.es55.js";
import "./index.es56.js";
import "./index.es57.js";
import "./index.es58.js";
import "./index.es59.js";
import "./index.es60.js";
import "./index.es61.js";
import "./index.es62.js";
import "./index.es63.js";
import "./index.es64.js";
import "./index.es65.js";
import "./index.es66.js";
import x from "./index.es75.js";
const Y = (m) => {
  const [e, y] = i(), [s, C] = i({}), [n, S] = i(), [l, c] = i(), o = a(() => x.coreCitationStyles, []), f = w((t) => {
    const p = r.findWhere(o, { name: t });
    y(t), S(p?.title);
  }, [o]), u = a(() => ({ name: e, title: n, xml: l }), [e, n, l]);
  return h(() => {
    if (!e) {
      let t;
      m ? t = r.findWhere(o, { name: m }) : t = r.findWhere(o, { isDefault: !0 }), f(t?.name);
    }
  }, [o, m]), h(() => {
    e && (r.has(s, e) ? c(s[e]) : fetch(`https://www.zotero.org/styles/${e}`).then((t) => t.text()).then((t) => {
      c(t), C((p) => ({
        ...p,
        [e]: t
      }));
    }));
  }, [e, s]), {
    onStyleChange: f,
    style: u,
    styles: o
  };
};
export {
  Y as default
};
//# sourceMappingURL=index.es11.js.map
