import { ref, h } from 'vue';
import { u as useAPI } from './sidebar.74ee9bac.mjs';
import { b as useToast, a as useRoute, n as navigateTo, N as NuxtPage } from './server.mjs';
import { d as defineNuxtComponent } from './component.ed786e27.mjs';
import { b as buildDomainEntityNav } from './enity-nav.3b505301.mjs';
import 'vue/server-renderer';
import '@vue-layout/basic';
import 'ofetch';
import 'hookable';
import 'unctx';
import 'destr';
import 'ufo';
import 'h3';
import '@unhead/vue';
import '@unhead/dom';
import 'vue-router';
import '@ebec/http';
import 'hapic';
import 'rapiq';
import 'change-case';
import '@ucast/mongo2js';
import '@hapic/oauth2';
import '@vuelidate/validators';
import 'ilingo';
import 'nanoid';
import '@vue-layout/hyperscript';
import 'smob';
import 'browser-storage-adapter';
import 'cookie-es';
import 'ohash';
import 'defu';
import './node-server.mjs';
import 'node-fetch-native/polyfill';
import 'http';
import 'https';
import 'unenv/runtime/fetch/index';
import 'scule';
import 'unstorage';
import 'radix3';
import 'node:fs';
import 'node:url';
import 'pathe';
import './composables.c25fc8b8.mjs';

const _id_ = defineNuxtComponent({
  async setup() {
    const items = [
      {
        name: "General",
        icon: "fas fa-bars",
        urlSuffix: ""
      }
    ];
    const toast = useToast();
    const route = useRoute();
    const entity = ref(null);
    try {
      entity.value = await useAPI().realm.getOne(route.params.id);
    } catch (e) {
      return navigateTo({ path: "/admin/realms" });
    }
    const handleUpdated = (e) => {
      toast.success("The realm was successfully updated.");
      const keys = Object.keys(e);
      for (let i = 0; i < keys.length; i++) {
        entity.value[keys[i]] = e[keys[i]];
      }
    };
    const handleFailed = (e) => {
      toast.warning(e.message);
    };
    return () => h("div", [
      h("h1", { class: "title no-border mb-3" }, [
        h("i", { class: "fa fa-robot me-1" }),
        entity.value.id,
        h("span", { class: "sub-title ms-1" }, [
          "Details"
        ])
      ]),
      h("div", { class: "mb-2" }, [
        buildDomainEntityNav(`/admin/realms/${entity.value.id}`, items, { prevLink: true })
      ]),
      h("div", [
        h(NuxtPage, {
          onUpdated: handleUpdated,
          onFailed: handleFailed,
          entity: entity.value
        })
      ])
    ]);
  }
});

export { _id_ as default };
//# sourceMappingURL=_id_.85447c0a.mjs.map
