import { ref, h } from 'vue';
import { u as useAPI } from './api.820f4308.mjs';
import { e as useToast, a as useRoute, n as navigateTo, N as NuxtPage } from './server.mjs';
import { d as defineNuxtComponent } from './component.800bf414.mjs';
import { b as buildDomainEntityNav } from './enity-nav.95ef1cfa.mjs';
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 '@vue-layout/basic';
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 'vue/server-renderer';
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.d2421f17.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().identityProvider.getOne(route.params.id);
    } catch (e) {
      return navigateTo({ path: "/admin/identity-providers" });
    }
    const handleUpdated = (e) => {
      toast.success("The identity-provider 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-atom me-1" }),
        entity.value.name,
        h("span", { class: "sub-title ms-1" }, [
          "Details"
        ])
      ]),
      h("div", { class: "mb-3" }, [
        buildDomainEntityNav(
          `/admin/identity-providers/${entity.value.id}`,
          items,
          {
            prevLink: true
          }
        )
      ]),
      h("div", [
        h(NuxtPage, {
          onUpdated: handleUpdated,
          onFailed: handleFailed,
          entity: entity.value
        })
      ])
    ]);
  }
});

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