import { getCurrentInstance as s, provide as m, defineComponent as p, openBlock as c, createBlock as l, unref as i } from "vue";
import { RouterView as d } from "vue-router";
const n = /* @__PURE__ */ new WeakMap(), u = (e, t) => {
  var r;
  const a = (r = s()) == null ? void 0 : r.proxy;
  if (a == null)
    throw new Error("provideLocal must be called in setup");
  n.has(a) || n.set(a, /* @__PURE__ */ Object.create(null));
  const o = n.get(a);
  o[e] = t, m(e, t);
};
typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
const h = Symbol("RESOURCE_CONTEXT"), w = (e) => u(h, e), R = /* @__PURE__ */ p({
  name: "FsResource",
  __name: "Resource",
  props: {
    name: {}
  },
  setup(e) {
    return w({ name: e.name }), (r, a) => (c(), l(i(d)));
  }
}), $ = (e) => {
  const t = [];
  return e.listView && t.push({
    path: "",
    name: `${e.name}-list`,
    component: e.listView
  }), e.editView && t.push({
    path: "edit/:id",
    name: `${e.name}-edit`,
    component: e.editView
  }), e.createView && t.push({
    path: "create",
    name: `${e.name}-create`,
    component: e.createView
  }), e.detailView && t.push({
    path: "detail/:id",
    name: `${e.name}-detail`,
    component: e.detailView
  }), [
    {
      path: `/${e.name}`,
      name: e.name,
      component: R,
      props: {
        name: e.name
      },
      children: [...t, ...e.otherViews || []]
    }
  ];
}, b = (e) => {
  const t = $(e), r = {
    list: `/${e.name}`,
    edit: (a) => `/${e.name}/edit/${a}`,
    create: `/${e.name}/create`,
    detail: (a) => `/${e.name}/detail/${a}`,
    basePath: `/${e.name}`
  };
  return {
    name: e.name,
    routes: t,
    routePath: r
  };
};
export {
  R as FsResource,
  b as createResourceFactory
};
//# sourceMappingURL=index.mjs.map
