{"version":3,"sources":["../../../lib/utils/browser-buffer-encode.js"],"names":["textEncoder","TextEncoder","require","Buffer","stringToBuffer","str","from","encode","buffer","exports"],"mappings":";;AAAA;AACA,IAAMA,WAAW,GAAG,OAAOC,WAAP,KAAuB,WAAvB,GAAqC,IAArC,GAA4C,IAAIA,WAAJ,CAAgB,OAAhB,CAAhE;;eACiBC,OAAO,CAAC,QAAD,C;IAAjBC,M,YAAAA,M;;AAEP,SAASC,cAAT,CAAwBC,GAAxB,EAA6B;AAC3B,MAAI,OAAOA,GAAP,KAAe,QAAnB,EAA6B;AAC3B,WAAOA,GAAP;AACD;;AACD,MAAIL,WAAJ,EAAiB;AACf,WAAOG,MAAM,CAACG,IAAP,CAAYN,WAAW,CAACO,MAAZ,CAAmBF,GAAnB,EAAwBG,MAApC,CAAP;AACD;;AACD,SAAOL,MAAM,CAACG,IAAP,CAAYD,GAAZ,CAAP;AACD;;AAEDI,OAAO,CAACL,cAAR,GAAyBA,cAAzB","sourcesContent":["// eslint-disable-next-line node/no-unsupported-features/node-builtins\r\nconst textEncoder = typeof TextEncoder === 'undefined' ? null : new TextEncoder('utf-8');\r\nconst {Buffer} = require('buffer');\r\n\r\nfunction stringToBuffer(str) {\r\n if (typeof str !== 'string') {\r\n return str;\r\n }\r\n if (textEncoder) {\r\n return Buffer.from(textEncoder.encode(str).buffer);\r\n }\r\n return Buffer.from(str);\r\n}\r\n\r\nexports.stringToBuffer = stringToBuffer;\r\n"],"file":"browser-buffer-encode.js"}