import {
  getCommonConfig,
  getRuntimeInstanceTelemetryInfo,
  telemetry_client_default
} from "./chunk-V4DHVC7M.mjs";
import {
  __name
} from "./chunk-FHD4JECV.mjs";

// src/lib/integrations/nextjs/app-router.ts
import { createCopilotEndpoint } from "@copilotkitnext/runtime";
function copilotRuntimeNextJSAppRouterEndpoint(options) {
  var _a;
  const commonConfig = getCommonConfig(options);
  telemetry_client_default.setGlobalProperties({
    runtime: {
      framework: "nextjs-app-router"
    }
  });
  if ((_a = options.properties) == null ? void 0 : _a._copilotkit) {
    telemetry_client_default.setGlobalProperties({
      _copilotkit: options.properties._copilotkit
    });
  }
  telemetry_client_default.capture("oss.runtime.instance_created", getRuntimeInstanceTelemetryInfo(options));
  const logger = commonConfig.logging;
  logger.debug("Creating NextJS App Router endpoint");
  const serviceAdapter = options.serviceAdapter;
  options.runtime.handleServiceAdapter(serviceAdapter);
  return createCopilotEndpoint({
    runtime: options.runtime.instance,
    basePath: options.endpoint
  });
}
__name(copilotRuntimeNextJSAppRouterEndpoint, "copilotRuntimeNextJSAppRouterEndpoint");

// src/lib/integrations/nextjs/pages-router.ts
import { createCopilotEndpoint as createCopilotEndpoint2 } from "@copilotkitnext/runtime";
var config = {
  api: {
    bodyParser: false
  }
};
function copilotRuntimeNextJSPagesRouterEndpoint(options) {
  var _a;
  const commonConfig = getCommonConfig(options);
  telemetry_client_default.setGlobalProperties({
    runtime: {
      framework: "nextjs-pages-router"
    }
  });
  if ((_a = options.properties) == null ? void 0 : _a._copilotkit) {
    telemetry_client_default.setGlobalProperties({
      _copilotkit: options.properties._copilotkit
    });
  }
  telemetry_client_default.capture("oss.runtime.instance_created", getRuntimeInstanceTelemetryInfo(options));
  const logger = commonConfig.logging;
  logger.debug("Creating NextJS Pages Router endpoint");
  const serviceAdapter = options.serviceAdapter;
  options.runtime.handleServiceAdapter(serviceAdapter);
  return createCopilotEndpoint2({
    runtime: options.runtime.instance,
    basePath: options.baseUrl
  });
}
__name(copilotRuntimeNextJSPagesRouterEndpoint, "copilotRuntimeNextJSPagesRouterEndpoint");

export {
  copilotRuntimeNextJSAppRouterEndpoint,
  config,
  copilotRuntimeNextJSPagesRouterEndpoint
};
//# sourceMappingURL=chunk-BJZHMXND.mjs.map