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,OAAO,WAAW,KAAK,WAAW,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC;AAE3E,cAAc;AACd,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,CAAC,WAAW,EAAE,EAAE;IACvC,IAAI,iBAAiB,IAAI,CAAC,OAAO,EAAE;QAC/B,MAAM,OAAO,GAAG,IAAI,WAAW,EAAE,CAAC;QAClC,OAAO,CAAC,KAAc,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;KACpD;IACD,OAAO,CAAC,KAAK,GAAG,EAAE,EAAE,EAAE,CAAC,YAAY,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC;AACrE,CAAC,CAAC,CAAC,OAAO,WAAW,KAAK,WAAW,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC","file":"utf8.js","sourcesContent":["// Licensed to the Apache Software Foundation (ASF) under one\n// or more contributor license agreements. See the NOTICE file\n// distributed with this work for additional information\n// regarding copyright ownership. The ASF licenses this file\n// to you under the Apache License, Version 2.0 (the\n// \"License\"); you may not use this file except in compliance\n// with the License. You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing,\n// software distributed under the License is distributed on an\n// \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n// KIND, either express or implied. See the License for the\n// specific language governing permissions and limitations\n// under the License.\n\nimport { toUint8Array } from './buffer';\nimport {\n TextDecoder as TextDecoderPolyfill,\n TextEncoder as TextEncoderPolyfill,\n} from 'text-encoding-utf-8';\n\n/** @ignore @suppress {missingRequire} */\nconst _Buffer = typeof Buffer === 'function' ? Buffer : null;\n/** @ignore */\nconst useNativeEncoders = typeof TextDecoder === 'function' && typeof TextEncoder === 'function';\n\n/** @ignore */\nexport const decodeUtf8 = ((TextDecoder) => {\n if (useNativeEncoders || !_Buffer) {\n const decoder = new TextDecoder('utf-8');\n return (buffer?: ArrayBuffer | ArrayBufferView) => decoder.decode(buffer);\n }\n return (input: ArrayBufferLike | ArrayBufferView) => {\n const { buffer, byteOffset, length } = toUint8Array(input);\n return _Buffer.from(buffer, byteOffset, length).toString();\n };\n})(typeof TextDecoder !== 'undefined' ? TextDecoder : TextDecoderPolyfill);\n\n/** @ignore */\nexport const encodeUtf8 = ((TextEncoder) => {\n if (useNativeEncoders || !_Buffer) {\n const encoder = new TextEncoder();\n return (value?: string) => encoder.encode(value);\n }\n return (input = '') => toUint8Array(_Buffer.from(input, 'utf8'));\n})(typeof TextEncoder !== 'undefined' ? TextEncoder : TextEncoderPolyfill);\n"]}