import {
  createWarpGrepTool as createWarpGrepTool3
} from "./chunk-JOJDIQKG.js";
import {
  createWarpGrepTool as createWarpGrepTool2
} from "./chunk-QXOX3QD5.js";
import {
  createWarpGrepTool
} from "./chunk-U2TBRQGW.js";
import {
  WarpGrepClient
} from "./chunk-ELZ7YZDN.js";
import {
  createCodebaseSearchTool as createCodebaseSearchTool3
} from "./chunk-UBX7QYBD.js";
import {
  createCodebaseSearchTool as createCodebaseSearchTool2
} from "./chunk-GJU7UOFL.js";
import {
  createCodebaseSearchTool
} from "./chunk-76DJEQEP.js";
import {
  CodebaseSearchClient
} from "./chunk-WM77HRKO.js";
import {
  createEditFileTool as createEditFileTool3
} from "./chunk-QZNGKOCZ.js";
import {
  createEditFileTool as createEditFileTool2
} from "./chunk-7UYDS6OX.js";
import {
  createEditFileTool
} from "./chunk-BKIM7SNY.js";
import {
  FastApplyClient
} from "./chunk-CKTA4AXM.js";
import {
  BrowserClient
} from "./chunk-5754T27Z.js";
import {
  MorphGit
} from "./chunk-VJU3BRET.js";
import {
  AnthropicRouter,
  GeminiRouter,
  OpenAIRouter,
  RawRouter
} from "./chunk-CP4NZGRY.js";

// factories/openai.ts
var OpenAIToolFactory = class {
  constructor(config) {
    this.config = config;
  }
  /**
   * Create an OpenAI-compatible warp grep tool
   * 
   * @param toolConfig - Tool configuration (morphApiKey inherited from MorphClient)
   * @returns OpenAI ChatCompletionTool with execute and formatResult methods
   */
  createWarpGrepTool(toolConfig) {
    return createWarpGrepTool({
      ...toolConfig,
      morphApiKey: this.config.apiKey
    });
  }
  /**
   * Create an OpenAI-compatible codebase search tool
   * 
   * @param toolConfig - Tool configuration with repoId (apiKey inherited from MorphClient)
   * @returns OpenAI ChatCompletionTool with execute and formatResult methods
   */
  createCodebaseSearchTool(toolConfig) {
    return createCodebaseSearchTool({
      ...toolConfig,
      apiKey: this.config.apiKey
    });
  }
  /**
   * Create an OpenAI-compatible edit file tool
   * 
   * @param toolConfig - Tool configuration (morphApiKey inherited from MorphClient)
   * @returns OpenAI ChatCompletionTool with execute and formatResult methods
   */
  createEditFileTool(toolConfig = {}) {
    return createEditFileTool({
      ...toolConfig,
      morphApiKey: this.config.apiKey
    });
  }
};

// factories/anthropic.ts
var AnthropicToolFactory = class {
  constructor(config) {
    this.config = config;
  }
  /**
   * Create an Anthropic-compatible warp grep tool
   * 
   * @param toolConfig - Tool configuration (morphApiKey inherited from MorphClient)
   * @returns Anthropic Tool with execute and formatResult methods
   */
  createWarpGrepTool(toolConfig) {
    return createWarpGrepTool2({
      ...toolConfig,
      morphApiKey: this.config.apiKey
    });
  }
  /**
   * Create an Anthropic-compatible codebase search tool
   * 
   * @param toolConfig - Tool configuration with repoId (apiKey inherited from MorphClient)
   * @returns Anthropic Tool with execute and formatResult methods
   */
  createCodebaseSearchTool(toolConfig) {
    return createCodebaseSearchTool2({
      ...toolConfig,
      apiKey: this.config.apiKey
    });
  }
  /**
   * Create an Anthropic-compatible edit file tool
   * 
   * @param toolConfig - Tool configuration (morphApiKey inherited from MorphClient)
   * @returns Anthropic Tool with execute and formatResult methods
   */
  createEditFileTool(toolConfig = {}) {
    return createEditFileTool2({
      ...toolConfig,
      morphApiKey: this.config.apiKey
    });
  }
};

// factories/vercel.ts
var VercelToolFactory = class {
  constructor(config) {
    this.config = config;
  }
  /**
   * Create a Vercel AI SDK-compatible warp grep tool
   * 
   * @param toolConfig - Tool configuration (morphApiKey inherited from MorphClient)
   * @returns Vercel AI SDK tool
   */
  createWarpGrepTool(toolConfig) {
    return createWarpGrepTool3({
      ...toolConfig,
      morphApiKey: this.config.apiKey
    });
  }
  /**
   * Create a Vercel AI SDK-compatible codebase search tool
   * 
   * @param toolConfig - Tool configuration with repoId (apiKey inherited from MorphClient)
   * @returns Vercel AI SDK tool
   */
  createCodebaseSearchTool(toolConfig) {
    return createCodebaseSearchTool3({
      ...toolConfig,
      apiKey: this.config.apiKey
    });
  }
  /**
   * Create a Vercel AI SDK-compatible edit file tool
   * 
   * @param toolConfig - Tool configuration (morphApiKey inherited from MorphClient)
   * @returns Vercel AI SDK tool
   */
  createEditFileTool(toolConfig = {}) {
    return createEditFileTool3({
      ...toolConfig,
      morphApiKey: this.config.apiKey
    });
  }
};

// client.ts
var MorphClient = class {
  /** Client configuration */
  config;
  /** FastApply tool for editing files with AI-powered merge */
  fastApply;
  /** CodebaseSearch tool for semantic code search */
  codebaseSearch;
  /** WarpGrep tool for fast code search using ripgrep */
  warpGrep;
  /** Browser tool for AI-powered browser automation */
  browser;
  /** Git tool for version control operations */
  git;
  /** Model routers for intelligent model selection */
  routers;
  /** OpenAI-compatible tool factories */
  openai;
  /** Anthropic-compatible tool factories */
  anthropic;
  /** Vercel AI SDK tool factories */
  vercel;
  /**
   * Create a new Morph SDK client
   * 
   * @param config - Client configuration (apiKey, debug, timeout, retryConfig)
   * 
   * @example
   * ```typescript
   * const morph = new MorphClient({ 
   *   apiKey: process.env.MORPH_API_KEY,
   *   debug: true,
   *   timeout: 60000
   * });
   * ```
   */
  constructor(config = {}) {
    this.config = config;
    this.fastApply = new FastApplyClient({
      apiKey: config.apiKey,
      debug: config.debug,
      timeout: config.timeout,
      retryConfig: config.retryConfig
    });
    this.codebaseSearch = new CodebaseSearchClient({
      apiKey: config.apiKey,
      debug: config.debug,
      timeout: config.timeout,
      retryConfig: config.retryConfig
    });
    this.warpGrep = new WarpGrepClient({
      morphApiKey: config.apiKey,
      debug: config.debug,
      timeout: config.timeout,
      retryConfig: config.retryConfig
    });
    this.browser = new BrowserClient({
      apiKey: config.apiKey,
      debug: config.debug,
      timeout: config.timeout,
      retryConfig: config.retryConfig
    });
    this.git = new MorphGit({
      apiKey: config.apiKey,
      retryConfig: config.retryConfig
    });
    this.routers = {
      openai: new OpenAIRouter({
        apiKey: config.apiKey,
        debug: config.debug,
        timeout: config.timeout,
        retryConfig: config.retryConfig
      }),
      anthropic: new AnthropicRouter({
        apiKey: config.apiKey,
        debug: config.debug,
        timeout: config.timeout,
        retryConfig: config.retryConfig
      }),
      gemini: new GeminiRouter({
        apiKey: config.apiKey,
        debug: config.debug,
        timeout: config.timeout,
        retryConfig: config.retryConfig
      }),
      raw: new RawRouter({
        apiKey: config.apiKey,
        debug: config.debug,
        timeout: config.timeout,
        retryConfig: config.retryConfig
      })
    };
    this.openai = new OpenAIToolFactory(config);
    this.anthropic = new AnthropicToolFactory(config);
    this.vercel = new VercelToolFactory(config);
  }
};

export {
  OpenAIToolFactory,
  AnthropicToolFactory,
  VercelToolFactory,
  MorphClient
};
//# sourceMappingURL=chunk-RYNFKC4P.js.map