import { getCurrentInstance as n, provide as i, inject as c } from "vue";
const d = {
  create: () => Promise.resolve({ data: null }),
  // avoids adding a context in tests
  deleteOne: () => Promise.resolve({ data: null }),
  // avoids adding a context in tests
  getList: () => Promise.resolve({
    data: Array.from({ length: 30 }).map((t, o) => ({
      name: o,
      id: o
    })),
    total: 20
  }),
  // avoids adding a context in tests
  getMany: () => Promise.resolve({ data: [] }),
  // avoids adding a context in tests
  getManyReference: () => Promise.resolve({ data: [], total: 0 }),
  // avoids adding a context in tests
  getOne: () => Promise.resolve({ data: null }),
  // avoids adding a context in tests
  update: () => Promise.resolve({ data: null })
  // avoids adding a context in tests
}, r = /* @__PURE__ */ new WeakMap(), u = (t, o) => {
  var a;
  const e = (a = n()) == null ? void 0 : a.proxy;
  if (e == null)
    throw new Error("provideLocal must be called in setup");
  r.has(e) || r.set(e, /* @__PURE__ */ Object.create(null));
  const s = r.get(e);
  s[t] = o, i(t, o);
}, v = (...t) => {
  var o;
  const a = t[0], e = (o = n()) == null ? void 0 : o.proxy;
  if (e == null)
    throw new Error("injectLocal must be called in setup");
  return r.has(e) && a in r.get(e) ? r.get(e)[a] : c(...t);
};
typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
const l = Symbol("DATA_PROVIDER_CONTEXT"), m = (t) => u(l, t), P = () => v(l, d);
export {
  l as DATA_PROVIDER_CONTEXT,
  m as createDataProviderProvider,
  P as useDataProviderContext
};
//# sourceMappingURL=data-provider.mjs.map
