import { defineComponent, resolveComponent, h } from 'vue';
import { i as isRealmResourceWritable } from './utils-e4eb8c9d.mjs';
import { u as useAuthStore, b as storeToRefs } from './auth-2d06b6ac.mjs';
import { b as navigateTo } from './nuxt-link-5ac46069.mjs';
import './server.mjs';
import 'ofetch';
import 'destr';
import '@unhead/vue';
import '@unhead/dom';
import '@unhead/ssr';
import './page-011b4897.mjs';
import 'vue-router';
import 'defu';
import 'unctx';
import 'h3';
import 'ufo';
import 'hapic';
import 'rapiq';
import '@vue-layout/basic';
import '@vuelidate/validators';
import 'ilingo';
import 'nanoid';
import '@vue-layout/hyperscript';
import 'smob';
import 'browser-storage-adapter';
import 'cookie-es';
import 'ohash';
import 'vue/server-renderer';
import './composables-31566dd1.mjs';
import './_plugin-vue_export-helper-cc2b3d55.mjs';
import './config.mjs';
import 'scule';
import '@ucast/mongo2js';
import 'change-case';
import '@ebec/http';
import '@hapic/oauth2';
import 'hookable';

const add = defineComponent({
  emits: ["failed", "created"],
  setup(props, { emit }) {
    const handleCreated = (e) => {
      navigateTo({ path: `/admin/roles/${e.id}` });
    };
    const handleFailed = (e) => {
      emit("failed", e);
    };
    const form = resolveComponent("RoleForm");
    const store = useAuthStore();
    const { realmManagement, realmManagementId } = storeToRefs(store);
    return () => {
      let realmId;
      if (!isRealmResourceWritable(realmManagement.value)) {
        realmId = realmManagementId.value;
      }
      return h(form, {
        onCreated: handleCreated,
        onFailed: handleFailed,
        realmId
      });
    };
  }
});

export { add as default };
//# sourceMappingURL=add-dc121c68.mjs.map
