{"version":3,"file":"encoding-react-native.mjs","sourceRoot":"","sources":["../../src/encoding-react-native.mts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAUlC;;;;GAIG;AACH,MAAM,UAAU,UAAU,CAAC,KAAiB;IAC1C,IAAI,OAAO,WAAW,KAAK,WAAW,EAAE,CAAC;QACvC,MAAM,IAAI,KAAK,CAAC,8EAA8E,CAAC,CAAC;IAClG,CAAC;IACD,OAAO,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AACzC,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,UAAU,CAAC,KAAa;IACtC,IAAI,OAAO,WAAW,KAAK,WAAW,EAAE,CAAC;QACvC,MAAM,IAAI,KAAK,CAAC,8EAA8E,CAAC,CAAC;IAClG,CAAC;IACD,OAAO,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AACzC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n// React Native's type definitions do not include TextDecoder/TextEncoder,\n// but they are available at runtime in the Hermes engine.\n// See https://github.com/facebook/react-native/issues/56325\ndeclare global {\n  var TextDecoder: (new () => { decode(input: Uint8Array): string }) | undefined;\n  var TextEncoder: (new () => { encode(input: string): Uint8Array<ArrayBuffer> }) | undefined;\n}\n\n/**\n * Decodes a Uint8Array to a UTF-8 string.\n *\n * @internal\n */\nexport function decodeUtf8(bytes: Uint8Array): string {\n  if (typeof TextDecoder === \"undefined\") {\n    throw new Error(\"TextDecoder is not available in this environment. Please provide a polyfill.\");\n  }\n  return new TextDecoder().decode(bytes);\n}\n\n/**\n * Encodes a string to a UTF-8 Uint8Array.\n *\n * @internal\n */\nexport function encodeUtf8(value: string): Uint8Array<ArrayBuffer> {\n  if (typeof TextEncoder === \"undefined\") {\n    throw new Error(\"TextEncoder is not available in this environment. Please provide a polyfill.\");\n  }\n  return new TextEncoder().encode(value);\n}\n"]}