// Force strict mode and setup for ESM
"use strict";
const __papertOriginalEmitWarning = process.emitWarning.bind(process);
process.emitWarning = function patchedEmitWarning(warning, ...args) {
  if (!process.env.PAPERT_SHOW_NODE_DEPRECATIONS) {
    const warningCode =
      (warning && typeof warning === 'object' && 'code' in warning && warning.code) ||
      (args.length > 1 && typeof args[1] === 'string' && args[1]) ||
      (args.length > 0 &&
        args[0] &&
        typeof args[0] === 'object' &&
        'code' in args[0] &&
        args[0].code);
    if (warningCode === 'DEP0040' || warningCode === 'DEP0169') {
      return;
    }
  }
  return __papertOriginalEmitWarning(warning, ...args);
};
import {
  __name,
  init_esbuild_shims
} from "./chunk-NCFEMX7E.js";

// packages/core/dist/src/mcp/token-storage/base-token-storage.js
init_esbuild_shims();
var BaseTokenStorage = class {
  static {
    __name(this, "BaseTokenStorage");
  }
  serviceName;
  constructor(serviceName) {
    this.serviceName = serviceName;
  }
  validateCredentials(credentials) {
    if (!credentials.serverName) {
      throw new Error("Server name is required");
    }
    if (!credentials.token) {
      throw new Error("Token is required");
    }
    if (!credentials.token.accessToken) {
      throw new Error("Access token is required");
    }
    if (!credentials.token.tokenType) {
      throw new Error("Token type is required");
    }
  }
  isTokenExpired(credentials) {
    if (!credentials.token.expiresAt) {
      return false;
    }
    const bufferMs = 5 * 60 * 1e3;
    return Date.now() > credentials.token.expiresAt - bufferMs;
  }
  sanitizeServerName(serverName) {
    return serverName.replace(/[^a-zA-Z0-9-_.]/g, "_");
  }
};

export {
  BaseTokenStorage
};
/**
 * @license
 * * Copyright 2026 Papert-code
 * SPDX-License-Identifier: Apache-2.0
 */
