import { routes, saveActiveWorkspace } from "../../routes.js";
import { createApiClient } from "../../libs/create-client.js";
import ApiClientApp_default from "./ApiClientApp.vue.js";
import { createRouter, createWebHistory } from "vue-router";
//#region src/layouts/App/create-api-client-app.ts
/**
* Mount the full-blown API Client modal to a given element.
*/
var createApiClientApp = async (el, configuration = {}, mountOnInitialize = true) => {
	const router = createRouter({
		history: createWebHistory(),
		routes
	});
	const client = createApiClient({
		el,
		appComponent: ApiClientApp_default,
		configuration,
		mountOnInitialize,
		router,
		layout: "desktop"
	});
	const { importSpecFile, importSpecFromUrl } = client.store;
	router.afterEach((to) => {
		saveActiveWorkspace(to);
	});
	if (configuration.url) await importSpecFromUrl(configuration.url, "default", { proxyUrl: configuration.proxyUrl });
	else if (configuration.content) await importSpecFile(configuration.content, "default");
	return {
		client,
		router
	};
};
//#endregion
export { createApiClientApp };

//# sourceMappingURL=create-api-client-app.js.map