first commit
This commit is contained in:
21
app_vue/node_modules/@webassemblyjs/utf8/LICENSE
generated
vendored
Normal file
21
app_vue/node_modules/@webassemblyjs/utf8/LICENSE
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2018 Sven Sauleau <sven@sauleau.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
67
app_vue/node_modules/@webassemblyjs/utf8/esm/decoder.js
generated
vendored
Normal file
67
app_vue/node_modules/@webassemblyjs/utf8/esm/decoder.js
generated
vendored
Normal file
@ -0,0 +1,67 @@
|
||||
function con(b) {
|
||||
if ((b & 0xc0) === 0x80) {
|
||||
return b & 0x3f;
|
||||
} else {
|
||||
throw new Error("invalid UTF-8 encoding");
|
||||
}
|
||||
}
|
||||
|
||||
function code(min, n) {
|
||||
if (n < min || 0xd800 <= n && n < 0xe000 || n >= 0x10000) {
|
||||
throw new Error("invalid UTF-8 encoding");
|
||||
} else {
|
||||
return n;
|
||||
}
|
||||
}
|
||||
|
||||
export function decode(bytes) {
|
||||
return _decode(bytes).map(function (x) {
|
||||
return String.fromCharCode(x);
|
||||
}).join("");
|
||||
}
|
||||
|
||||
function _decode(bytes) {
|
||||
var result = [];
|
||||
|
||||
while (bytes.length > 0) {
|
||||
var b1 = bytes[0];
|
||||
|
||||
if (b1 < 0x80) {
|
||||
result.push(code(0x0, b1));
|
||||
bytes = bytes.slice(1);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (b1 < 0xc0) {
|
||||
throw new Error("invalid UTF-8 encoding");
|
||||
}
|
||||
|
||||
var b2 = bytes[1];
|
||||
|
||||
if (b1 < 0xe0) {
|
||||
result.push(code(0x80, ((b1 & 0x1f) << 6) + con(b2)));
|
||||
bytes = bytes.slice(2);
|
||||
continue;
|
||||
}
|
||||
|
||||
var b3 = bytes[2];
|
||||
|
||||
if (b1 < 0xf0) {
|
||||
result.push(code(0x800, ((b1 & 0x0f) << 12) + (con(b2) << 6) + con(b3)));
|
||||
bytes = bytes.slice(3);
|
||||
continue;
|
||||
}
|
||||
|
||||
var b4 = bytes[3];
|
||||
|
||||
if (b1 < 0xf8) {
|
||||
result.push(code(0x10000, (((b1 & 0x07) << 18) + con(b2) << 12) + (con(b3) << 6) + con(b4)));
|
||||
bytes = bytes.slice(4);
|
||||
continue;
|
||||
}
|
||||
|
||||
throw new Error("invalid UTF-8 encoding");
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
60
app_vue/node_modules/@webassemblyjs/utf8/esm/encoder.js
generated
vendored
Normal file
60
app_vue/node_modules/@webassemblyjs/utf8/esm/encoder.js
generated
vendored
Normal file
@ -0,0 +1,60 @@
|
||||
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
||||
|
||||
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
||||
|
||||
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
||||
|
||||
function _toArray(arr) { return _arrayWithHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableRest(); }
|
||||
|
||||
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
||||
|
||||
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
||||
|
||||
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
||||
|
||||
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
||||
|
||||
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
||||
|
||||
function con(n) {
|
||||
return 0x80 | n & 0x3f;
|
||||
}
|
||||
|
||||
export function encode(str) {
|
||||
var arr = str.split("").map(function (x) {
|
||||
return x.charCodeAt(0);
|
||||
});
|
||||
return _encode(arr);
|
||||
}
|
||||
|
||||
function _encode(arr) {
|
||||
if (arr.length === 0) {
|
||||
return [];
|
||||
}
|
||||
|
||||
var _arr = _toArray(arr),
|
||||
n = _arr[0],
|
||||
ns = _arr.slice(1);
|
||||
|
||||
if (n < 0) {
|
||||
throw new Error("utf8");
|
||||
}
|
||||
|
||||
if (n < 0x80) {
|
||||
return [n].concat(_toConsumableArray(_encode(ns)));
|
||||
}
|
||||
|
||||
if (n < 0x800) {
|
||||
return [0xc0 | n >>> 6, con(n)].concat(_toConsumableArray(_encode(ns)));
|
||||
}
|
||||
|
||||
if (n < 0x10000) {
|
||||
return [0xe0 | n >>> 12, con(n >>> 6), con(n)].concat(_toConsumableArray(_encode(ns)));
|
||||
}
|
||||
|
||||
if (n < 0x110000) {
|
||||
return [0xf0 | n >>> 18, con(n >>> 12), con(n >>> 6), con(n)].concat(_toConsumableArray(_encode(ns)));
|
||||
}
|
||||
|
||||
throw new Error("utf8");
|
||||
}
|
||||
2
app_vue/node_modules/@webassemblyjs/utf8/esm/index.js
generated
vendored
Normal file
2
app_vue/node_modules/@webassemblyjs/utf8/esm/index.js
generated
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
export { decode } from "./decoder";
|
||||
export { encode } from "./encoder";
|
||||
74
app_vue/node_modules/@webassemblyjs/utf8/lib/decoder.js
generated
vendored
Normal file
74
app_vue/node_modules/@webassemblyjs/utf8/lib/decoder.js
generated
vendored
Normal file
@ -0,0 +1,74 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.decode = decode;
|
||||
|
||||
function con(b) {
|
||||
if ((b & 0xc0) === 0x80) {
|
||||
return b & 0x3f;
|
||||
} else {
|
||||
throw new Error("invalid UTF-8 encoding");
|
||||
}
|
||||
}
|
||||
|
||||
function code(min, n) {
|
||||
if (n < min || 0xd800 <= n && n < 0xe000 || n >= 0x10000) {
|
||||
throw new Error("invalid UTF-8 encoding");
|
||||
} else {
|
||||
return n;
|
||||
}
|
||||
}
|
||||
|
||||
function decode(bytes) {
|
||||
return _decode(bytes).map(function (x) {
|
||||
return String.fromCharCode(x);
|
||||
}).join("");
|
||||
}
|
||||
|
||||
function _decode(bytes) {
|
||||
var result = [];
|
||||
|
||||
while (bytes.length > 0) {
|
||||
var b1 = bytes[0];
|
||||
|
||||
if (b1 < 0x80) {
|
||||
result.push(code(0x0, b1));
|
||||
bytes = bytes.slice(1);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (b1 < 0xc0) {
|
||||
throw new Error("invalid UTF-8 encoding");
|
||||
}
|
||||
|
||||
var b2 = bytes[1];
|
||||
|
||||
if (b1 < 0xe0) {
|
||||
result.push(code(0x80, ((b1 & 0x1f) << 6) + con(b2)));
|
||||
bytes = bytes.slice(2);
|
||||
continue;
|
||||
}
|
||||
|
||||
var b3 = bytes[2];
|
||||
|
||||
if (b1 < 0xf0) {
|
||||
result.push(code(0x800, ((b1 & 0x0f) << 12) + (con(b2) << 6) + con(b3)));
|
||||
bytes = bytes.slice(3);
|
||||
continue;
|
||||
}
|
||||
|
||||
var b4 = bytes[3];
|
||||
|
||||
if (b1 < 0xf8) {
|
||||
result.push(code(0x10000, (((b1 & 0x07) << 18) + con(b2) << 12) + (con(b3) << 6) + con(b4)));
|
||||
bytes = bytes.slice(4);
|
||||
continue;
|
||||
}
|
||||
|
||||
throw new Error("invalid UTF-8 encoding");
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
67
app_vue/node_modules/@webassemblyjs/utf8/lib/encoder.js
generated
vendored
Normal file
67
app_vue/node_modules/@webassemblyjs/utf8/lib/encoder.js
generated
vendored
Normal file
@ -0,0 +1,67 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.encode = encode;
|
||||
|
||||
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
||||
|
||||
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
||||
|
||||
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
||||
|
||||
function _toArray(arr) { return _arrayWithHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableRest(); }
|
||||
|
||||
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
||||
|
||||
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
||||
|
||||
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
||||
|
||||
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
||||
|
||||
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
||||
|
||||
function con(n) {
|
||||
return 0x80 | n & 0x3f;
|
||||
}
|
||||
|
||||
function encode(str) {
|
||||
var arr = str.split("").map(function (x) {
|
||||
return x.charCodeAt(0);
|
||||
});
|
||||
return _encode(arr);
|
||||
}
|
||||
|
||||
function _encode(arr) {
|
||||
if (arr.length === 0) {
|
||||
return [];
|
||||
}
|
||||
|
||||
var _arr = _toArray(arr),
|
||||
n = _arr[0],
|
||||
ns = _arr.slice(1);
|
||||
|
||||
if (n < 0) {
|
||||
throw new Error("utf8");
|
||||
}
|
||||
|
||||
if (n < 0x80) {
|
||||
return [n].concat(_toConsumableArray(_encode(ns)));
|
||||
}
|
||||
|
||||
if (n < 0x800) {
|
||||
return [0xc0 | n >>> 6, con(n)].concat(_toConsumableArray(_encode(ns)));
|
||||
}
|
||||
|
||||
if (n < 0x10000) {
|
||||
return [0xe0 | n >>> 12, con(n >>> 6), con(n)].concat(_toConsumableArray(_encode(ns)));
|
||||
}
|
||||
|
||||
if (n < 0x110000) {
|
||||
return [0xf0 | n >>> 18, con(n >>> 12), con(n >>> 6), con(n)].concat(_toConsumableArray(_encode(ns)));
|
||||
}
|
||||
|
||||
throw new Error("utf8");
|
||||
}
|
||||
21
app_vue/node_modules/@webassemblyjs/utf8/lib/index.js
generated
vendored
Normal file
21
app_vue/node_modules/@webassemblyjs/utf8/lib/index.js
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "decode", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _decoder.decode;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "encode", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _encoder.encode;
|
||||
}
|
||||
});
|
||||
|
||||
var _decoder = require("./decoder");
|
||||
|
||||
var _encoder = require("./encoder");
|
||||
20
app_vue/node_modules/@webassemblyjs/utf8/package.json
generated
vendored
Normal file
20
app_vue/node_modules/@webassemblyjs/utf8/package.json
generated
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
{
|
||||
"name": "@webassemblyjs/utf8",
|
||||
"version": "1.13.2",
|
||||
"description": "UTF8 encoder/decoder for WASM",
|
||||
"main": "lib/index.js",
|
||||
"module": "esm/index.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/xtuc/webassemblyjs.git"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"author": "Sven Sauleau",
|
||||
"license": "MIT",
|
||||
"gitHead": "897aeb784f042a46a00626f1d1cca96159aa5db3"
|
||||
}
|
||||
67
app_vue/node_modules/@webassemblyjs/utf8/src/decoder.js
generated
vendored
Normal file
67
app_vue/node_modules/@webassemblyjs/utf8/src/decoder.js
generated
vendored
Normal file
@ -0,0 +1,67 @@
|
||||
function con(b) {
|
||||
if ((b & 0xc0) === 0x80) {
|
||||
return b & 0x3f;
|
||||
} else {
|
||||
throw new Error("invalid UTF-8 encoding");
|
||||
}
|
||||
}
|
||||
|
||||
function code(min, n) {
|
||||
if (n < min || (0xd800 <= n && n < 0xe000) || n >= 0x10000) {
|
||||
throw new Error("invalid UTF-8 encoding");
|
||||
} else {
|
||||
return n;
|
||||
}
|
||||
}
|
||||
|
||||
export function decode(bytes) {
|
||||
return _decode(bytes)
|
||||
.map((x) => String.fromCharCode(x))
|
||||
.join("");
|
||||
}
|
||||
|
||||
function _decode(bytes) {
|
||||
const result = [];
|
||||
while (bytes.length > 0) {
|
||||
const b1 = bytes[0];
|
||||
if (b1 < 0x80) {
|
||||
result.push(code(0x0, b1));
|
||||
bytes = bytes.slice(1);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (b1 < 0xc0) {
|
||||
throw new Error("invalid UTF-8 encoding");
|
||||
}
|
||||
|
||||
const b2 = bytes[1];
|
||||
if (b1 < 0xe0) {
|
||||
result.push(code(0x80, ((b1 & 0x1f) << 6) + con(b2)));
|
||||
bytes = bytes.slice(2);
|
||||
continue;
|
||||
}
|
||||
|
||||
const b3 = bytes[2];
|
||||
if (b1 < 0xf0) {
|
||||
result.push(code(0x800, ((b1 & 0x0f) << 12) + (con(b2) << 6) + con(b3)));
|
||||
bytes = bytes.slice(3);
|
||||
continue;
|
||||
}
|
||||
|
||||
const b4 = bytes[3];
|
||||
if (b1 < 0xf8) {
|
||||
result.push(
|
||||
code(
|
||||
0x10000,
|
||||
((((b1 & 0x07) << 18) + con(b2)) << 12) + (con(b3) << 6) + con(b4)
|
||||
)
|
||||
);
|
||||
bytes = bytes.slice(4);
|
||||
continue;
|
||||
}
|
||||
|
||||
throw new Error("invalid UTF-8 encoding");
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
44
app_vue/node_modules/@webassemblyjs/utf8/src/encoder.js
generated
vendored
Normal file
44
app_vue/node_modules/@webassemblyjs/utf8/src/encoder.js
generated
vendored
Normal file
@ -0,0 +1,44 @@
|
||||
function con(n) {
|
||||
return 0x80 | (n & 0x3f);
|
||||
}
|
||||
|
||||
export function encode(str) {
|
||||
const arr = str.split("").map((x) => x.charCodeAt(0));
|
||||
return _encode(arr);
|
||||
}
|
||||
|
||||
function _encode(arr) {
|
||||
if (arr.length === 0) {
|
||||
return [];
|
||||
}
|
||||
|
||||
const [n, ...ns] = arr;
|
||||
|
||||
if (n < 0) {
|
||||
throw new Error("utf8");
|
||||
}
|
||||
|
||||
if (n < 0x80) {
|
||||
return [n, ..._encode(ns)];
|
||||
}
|
||||
|
||||
if (n < 0x800) {
|
||||
return [0xc0 | (n >>> 6), con(n), ..._encode(ns)];
|
||||
}
|
||||
|
||||
if (n < 0x10000) {
|
||||
return [0xe0 | (n >>> 12), con(n >>> 6), con(n), ..._encode(ns)];
|
||||
}
|
||||
|
||||
if (n < 0x110000) {
|
||||
return [
|
||||
0xf0 | (n >>> 18),
|
||||
con(n >>> 12),
|
||||
con(n >>> 6),
|
||||
con(n),
|
||||
..._encode(ns),
|
||||
];
|
||||
}
|
||||
|
||||
throw new Error("utf8");
|
||||
}
|
||||
4
app_vue/node_modules/@webassemblyjs/utf8/src/index.js
generated
vendored
Normal file
4
app_vue/node_modules/@webassemblyjs/utf8/src/index.js
generated
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
// @flow
|
||||
|
||||
export { decode } from "./decoder";
|
||||
export { encode } from "./encoder";
|
||||
13
app_vue/node_modules/@webassemblyjs/utf8/test/index.js
generated
vendored
Normal file
13
app_vue/node_modules/@webassemblyjs/utf8/test/index.js
generated
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
const { assert } = require("chai");
|
||||
|
||||
const { decode, encode } = require("../lib");
|
||||
|
||||
describe("UTF8", () => {
|
||||
it("should f-1(f(x)) = x", () => {
|
||||
assert.equal(decode(encode("foo")), "foo");
|
||||
assert.equal(decode(encode("éé")), "éé");
|
||||
|
||||
// TODO(sven): utf8 encoder fails here
|
||||
// assert.equal(decode(encode("🤣见見")), "🤣见見");
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user