|
function Te(r, t = Zr.current) {
t != Zr.current && (Cs.checkNormalize(), r = r.normalize(t));
let e = [];
for (let i = 0; i < r.length; i++) {
const n = r.charCodeAt(i);
if (n < 128) e.push(n);
else if (n < 2048) e.push(n >> 6 | 192), e.push(n & 63 | 128);
else if ((n & 64512) == 55296) {
i++;
const s = r.charCodeAt(i);
if (i >= r.length || (s & 64512) !== 56320) throw new Error("invalid utf-8 string");
const a = 65536 + ((n & 1023) << 10) + (s & 1023);
e.push(a >> 18 | 240), e.push(a >> 12 & 63 | 128), e.push(a >> 6 & 63 | 128), e.push(a & 63 | 128)
} else e.push(n >> 12 | 224), e.push(n >> 6 & 63 | 128), e.push(n & 63 | 128)
}
return $(e)
}
|
|