"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.textEncodingPolyfill = textEncodingPolyfill;
if (typeof TextDecoder !== 'function' ||
    typeof TextEncoder !== 'function') {
    const global = (typeof globalThis === 'object' &&
        globalThis?.Object === Object &&
        globalThis) ||
        Function('return this')();
    Object.assign(global, textEncodingPolyfill());
}
function textEncodingPolyfill() {
    class TextEncoder {
        encode(string) {
            return Buffer.from(string, 'utf8');
        }
    }
    class TextDecoder {
        decode(bytes) {
            const str = Buffer.from(bytes).toString('utf8');
            return str.slice(+str.startsWith('\ufeff'));
        }
    }
    return { TextDecoder, TextEncoder };
}
//# sourceMappingURL=textencoder-polyfill.js.map