"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ExtensibilityPlatformFunctions = void 0;
const EndpointFetchHttpClient_js_1 = require("../net/EndpointFetchHttpClient.js");
const StripeEventEmitter_js_1 = require("../StripeEventEmitter.js");
const PlatformFunctions_js_1 = require("./PlatformFunctions.js");
const unsupportedRuntimeError = (method, alternative) => new Error(`Stripe: \`${method}()\` is not available in the extensibility runtime.` +
    (alternative ? ` ${alternative}` : ''));
/**
 * Platform functions for extensibility scripts.
 */
class ExtensibilityPlatformFunctions extends PlatformFunctions_js_1.PlatformFunctions {
    /** @override */
    emitWarning(_warning) {
        // Extensibility runtime has no user-visible warning target.
    }
    /** @override */
    getEnv() {
        return null;
    }
    /** @override */
    getRuntimeVersion() {
        return null;
    }
    /** @override */
    getDefaultMaxNetworkRetries() {
        return 0;
    }
    /** @override */
    createDefaultAuthenticator() {
        // Authentication is injected automatically.
        return () => Promise.resolve();
    }
    /** @override */
    createEmitter() {
        return new StripeEventEmitter_js_1.StripeEventEmitter();
    }
    /** @override */
    tryBufferData(data) {
        return Promise.resolve(data);
    }
    /** @override */
    createDefaultHttpClient() {
        return new EndpointFetchHttpClient_js_1.EndpointFetchHttpClient();
    }
    /** @override */
    createFetchHttpClient() {
        throw unsupportedRuntimeError('createFetchHttpClient', 'Use the default `endpointFetch` HTTP client instead.');
    }
    /** @override */
    createNodeHttpClient() {
        throw unsupportedRuntimeError('createNodeHttpClient', 'Use the default `endpointFetch` HTTP client instead.');
    }
    /** @override */
    createNodeCryptoProvider() {
        throw unsupportedRuntimeError('createNodeCryptoProvider');
    }
    /** @override */
    createDefaultCryptoProvider() {
        throw unsupportedRuntimeError('createDefaultCryptoProvider', 'Pass an explicit `CryptoProvider` for crypto-dependent helpers.');
    }
}
exports.ExtensibilityPlatformFunctions = ExtensibilityPlatformFunctions;
//# sourceMappingURL=ExtensibilityPlatformFunctions.js.map