Spaces:
Running
Running
Perceptual Model added
Browse files- docs/dist/index.cjs +1423 -0
- docs/dist/index.js +1382 -0
- docs/docs/.nojekyll +1 -0
- docs/docs/assets/favicon.svg +36 -0
- docs/docs/assets/hierarchy.js +1 -0
- docs/docs/assets/highlight.css +120 -0
- docs/docs/assets/icons.js +18 -0
- docs/docs/assets/icons.svg +1 -0
- docs/docs/assets/main.js +60 -0
- docs/docs/assets/navigation.js +1 -0
- docs/docs/assets/search.js +1 -0
- docs/docs/assets/style.css +1611 -0
- docs/docs/classes/bchecc.BCH.html +137 -0
- docs/docs/classes/datalayer.DataLayer.html +41 -0
- docs/docs/classes/trustmark.TrustMark.html +48 -0
- docs/docs/functions/datalayer.getSchemaCapacity.html +6 -0
- docs/docs/functions/datalayer.getSchemaVersion.html +6 -0
- docs/docs/index.html +37 -0
- docs/docs/modules.html +1 -0
- docs/docs/modules/bchecc.html +1 -0
- docs/docs/modules/datalayer.html +1 -0
- docs/docs/modules/trustmark.html +1 -0
- docs/index.html +187 -35
- docs/index.js +277 -0
- docs/style.css +360 -0
docs/dist/index.cjs
ADDED
@@ -0,0 +1,1423 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
"use strict";
|
2 |
+
var __create = Object.create;
|
3 |
+
var __defProp = Object.defineProperty;
|
4 |
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
5 |
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
6 |
+
var __getProtoOf = Object.getPrototypeOf;
|
7 |
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
8 |
+
var __export = (target, all) => {
|
9 |
+
for (var name in all)
|
10 |
+
__defProp(target, name, { get: all[name], enumerable: true });
|
11 |
+
};
|
12 |
+
var __copyProps = (to, from, except, desc) => {
|
13 |
+
if (from && typeof from === "object" || typeof from === "function") {
|
14 |
+
for (let key of __getOwnPropNames(from))
|
15 |
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
16 |
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
17 |
+
}
|
18 |
+
return to;
|
19 |
+
};
|
20 |
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
21 |
+
// If the importer is in node compatibility mode or this is not an ESM
|
22 |
+
// file that has been converted to a CommonJS file using a Babel-
|
23 |
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
24 |
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
25 |
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
26 |
+
mod
|
27 |
+
));
|
28 |
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
29 |
+
|
30 |
+
// src/index.ts
|
31 |
+
var src_exports = {};
|
32 |
+
__export(src_exports, {
|
33 |
+
TrustMark: () => TrustMark
|
34 |
+
});
|
35 |
+
module.exports = __toCommonJS(src_exports);
|
36 |
+
|
37 |
+
// src/trustmark.ts
|
38 |
+
var import_node_fs = require("fs");
|
39 |
+
var import_node_crypto = require("crypto");
|
40 |
+
var ort = __toESM(require("onnxruntime-node"), 1);
|
41 |
+
var tf = __toESM(require("@tensorflow/tfjs-node"), 1);
|
42 |
+
|
43 |
+
// src/bchecc.ts
|
44 |
+
var BCH = class {
|
45 |
+
ECCstate;
|
46 |
+
/**
|
47 |
+
* Initializes the ECC state with given parameters.
|
48 |
+
* @param {number} t - Number of error correctable bits, max number of bit flips we can account for, increasing this increase the ecc length
|
49 |
+
* @param {number} poly - The polynomial used for ECC.
|
50 |
+
*/
|
51 |
+
constructor(t, poly) {
|
52 |
+
let tmp = poly;
|
53 |
+
let m = 0;
|
54 |
+
while (tmp >> 1) {
|
55 |
+
tmp = tmp >> 1;
|
56 |
+
m += 1;
|
57 |
+
}
|
58 |
+
this.ECCstate = {
|
59 |
+
m,
|
60 |
+
t,
|
61 |
+
poly
|
62 |
+
};
|
63 |
+
this.ECCstate.n = Math.pow(2, m) - 1;
|
64 |
+
const words = Math.ceil(m * t / 32);
|
65 |
+
this.ECCstate.ecc_bytes = Math.ceil(m * t / 8);
|
66 |
+
this.ECCstate.cyclic_tab = new Array(words * 1024).fill(BigInt(0));
|
67 |
+
this.ECCstate.syn = new Array(2 * t).fill(0);
|
68 |
+
this.ECCstate.elp = new Array(t + 1).fill(0);
|
69 |
+
this.ECCstate.errloc = new Array(t).fill(0);
|
70 |
+
let x = 1;
|
71 |
+
const k = Math.pow(2, this.deg(poly));
|
72 |
+
if (k !== Math.pow(2, this.ECCstate.m)) {
|
73 |
+
return;
|
74 |
+
}
|
75 |
+
this.ECCstate.exponents = new Array(1 + this.ECCstate.n).fill(0);
|
76 |
+
this.ECCstate.logarithms = new Array(1 + this.ECCstate.n).fill(0);
|
77 |
+
this.ECCstate.elp_pre = new Array(1 + this.ECCstate.m).fill(0);
|
78 |
+
for (let i2 = 0; i2 < this.ECCstate.n; i2++) {
|
79 |
+
this.ECCstate.exponents[i2] = x;
|
80 |
+
this.ECCstate.logarithms[x] = i2;
|
81 |
+
if (i2 && x === 1) {
|
82 |
+
return;
|
83 |
+
}
|
84 |
+
x *= 2;
|
85 |
+
if (x & k) {
|
86 |
+
x ^= poly;
|
87 |
+
}
|
88 |
+
}
|
89 |
+
this.ECCstate.logarithms[0] = 0;
|
90 |
+
this.ECCstate.exponents[this.ECCstate.n] = 1;
|
91 |
+
let n = 0;
|
92 |
+
const g = { deg: 0, c: new Array(m * t + 1).fill(BigInt(0)) };
|
93 |
+
const roots = new Array(this.ECCstate.n + 1).fill(0);
|
94 |
+
const genpoly = new Array(Math.ceil(m * t + 1 / 32)).fill(BigInt(0));
|
95 |
+
for (let i2 = 0; i2 < t; i2++) {
|
96 |
+
let r = 2 * i2 + 1;
|
97 |
+
for (let j = 0; j < m; j++) {
|
98 |
+
roots[r] = 1;
|
99 |
+
r = this.mod(this, 2 * r);
|
100 |
+
}
|
101 |
+
}
|
102 |
+
g.deg = 0;
|
103 |
+
g.c[0] = BigInt(1);
|
104 |
+
for (let i2 = 0; i2 < this.ECCstate.n; i2++) {
|
105 |
+
if (roots[i2]) {
|
106 |
+
const r = this.ECCstate.exponents[i2];
|
107 |
+
g.c[g.deg + 1] = BigInt(1);
|
108 |
+
for (let j = g.deg; j > 0; j--) {
|
109 |
+
g.c[j] = this.g_mul(this, g.c[j], r) ^ g.c[j - 1];
|
110 |
+
}
|
111 |
+
g.c[0] = this.g_mul(this, g.c[0], r);
|
112 |
+
g.deg += 1;
|
113 |
+
}
|
114 |
+
}
|
115 |
+
n = g.deg + 1;
|
116 |
+
let i = 0;
|
117 |
+
while (n > 0) {
|
118 |
+
const nbits = n > 32 ? 32 : n;
|
119 |
+
let word = BigInt(0);
|
120 |
+
for (let j = 0; j < nbits; j++) {
|
121 |
+
if (g.c[n - 1 - j]) {
|
122 |
+
word |= BigInt(Math.pow(2, 31 - j));
|
123 |
+
}
|
124 |
+
}
|
125 |
+
genpoly[i] = word;
|
126 |
+
i += 1;
|
127 |
+
n -= nbits;
|
128 |
+
}
|
129 |
+
this.ECCstate.ecc_bits = g.deg;
|
130 |
+
this.buildCyclic(genpoly);
|
131 |
+
let sum = 0;
|
132 |
+
let aexp = 0;
|
133 |
+
for (let i2 = 0; i2 < m; i2++) {
|
134 |
+
for (let j = 0; j < m; j++) {
|
135 |
+
sum ^= this.g_pow(this, i2 * Math.pow(2, j));
|
136 |
+
}
|
137 |
+
if (sum) {
|
138 |
+
aexp = this.ECCstate.exponents[i2];
|
139 |
+
break;
|
140 |
+
}
|
141 |
+
}
|
142 |
+
x = 0;
|
143 |
+
const precomp = new Array(31).fill(0);
|
144 |
+
let remaining = m;
|
145 |
+
while (x <= this.ECCstate.n && remaining) {
|
146 |
+
let y = this.g_sqrt(this, x) ^ x;
|
147 |
+
for (let i2 = 0; i2 < 2; i2++) {
|
148 |
+
const r = this.g_log(this, y);
|
149 |
+
if (y && r < m && !precomp[r]) {
|
150 |
+
this.ECCstate.elp_pre[r] = x;
|
151 |
+
precomp[r] = 1;
|
152 |
+
remaining -= 1;
|
153 |
+
break;
|
154 |
+
}
|
155 |
+
y ^= aexp;
|
156 |
+
}
|
157 |
+
x += 1;
|
158 |
+
}
|
159 |
+
}
|
160 |
+
/**
|
161 |
+
* Encodes the data and generates ECC bytes.
|
162 |
+
* @param {number[]} data - The input data array.
|
163 |
+
* @returns {Uint8Array} - The generated ECC bytes.
|
164 |
+
*/
|
165 |
+
encode(data) {
|
166 |
+
let bigIntData = this.convertAllBitsToBigInts(data, 8);
|
167 |
+
const datalen = bigIntData.length;
|
168 |
+
const l = this.ceilop(this.ECCstate.m * this.ECCstate.t, 32) - 1;
|
169 |
+
let ecc = new Array(this.getEccBytes()).fill(0);
|
170 |
+
const ecc_max_words = this.ceilop(31 * 64, 32);
|
171 |
+
const r = new Array(ecc_max_words).fill(BigInt(0));
|
172 |
+
const tab0idx = 0;
|
173 |
+
const tab1idx = tab0idx + 256 * (l + 1);
|
174 |
+
const tab2idx = tab1idx + 256 * (l + 1);
|
175 |
+
const tab3idx = tab2idx + 256 * (l + 1);
|
176 |
+
let mlen = Math.floor(datalen / 4);
|
177 |
+
let offset = 0;
|
178 |
+
while (mlen > 0) {
|
179 |
+
let w = this.convertBytesToBigInt(bigIntData.slice(offset, offset + 4));
|
180 |
+
w ^= r[0];
|
181 |
+
const p0 = tab0idx + (l + 1) * Number(w >> BigInt(0) & BigInt(255));
|
182 |
+
const p1 = tab1idx + (l + 1) * Number(w >> BigInt(8) & BigInt(255));
|
183 |
+
const p2 = tab2idx + (l + 1) * Number(w >> BigInt(16) & BigInt(255));
|
184 |
+
const p3 = tab3idx + (l + 1) * Number(w >> BigInt(24) & BigInt(255));
|
185 |
+
for (let i = 0; i < l; i++) {
|
186 |
+
r[i] = r[i + 1] ^ this.ECCstate.cyclic_tab[Number(p0) + i] ^ this.ECCstate.cyclic_tab[Number(p1) + i] ^ this.ECCstate.cyclic_tab[Number(p2) + i] ^ this.ECCstate.cyclic_tab[Number(p3) + i];
|
187 |
+
}
|
188 |
+
r[l] = this.ECCstate.cyclic_tab[Number(p0) + l] ^ this.ECCstate.cyclic_tab[Number(p1) + l] ^ this.ECCstate.cyclic_tab[Number(p2) + l] ^ this.ECCstate.cyclic_tab[Number(p3) + l];
|
189 |
+
mlen--;
|
190 |
+
offset += 4;
|
191 |
+
}
|
192 |
+
bigIntData = bigIntData.slice(offset);
|
193 |
+
let leftdata = bigIntData.length;
|
194 |
+
ecc = r;
|
195 |
+
let posn = 0;
|
196 |
+
while (leftdata) {
|
197 |
+
const tmp = bigIntData[posn];
|
198 |
+
posn++;
|
199 |
+
let pidx = (l + 1) * Number(ecc[0] >> BigInt(24) ^ tmp & BigInt(255));
|
200 |
+
for (let i = 0; i < l; i++) {
|
201 |
+
ecc[i] = (ecc[i] << BigInt(8) & BigInt(4294967295) | ecc[i + 1] >> BigInt(24)) ^ this.ECCstate.cyclic_tab[Number(pidx)];
|
202 |
+
pidx++;
|
203 |
+
}
|
204 |
+
ecc[l] = ecc[l] << BigInt(8) & BigInt(4294967295) ^ this.ECCstate.cyclic_tab[Number(pidx)];
|
205 |
+
leftdata--;
|
206 |
+
}
|
207 |
+
this.ECCstate.ecc_buf = ecc;
|
208 |
+
let eccout = [];
|
209 |
+
for (const e of r) {
|
210 |
+
eccout.push(Number(e >> BigInt(24)) & 255);
|
211 |
+
eccout.push(Number(e >> BigInt(16)) & 255);
|
212 |
+
eccout.push(Number(e >> BigInt(8)) & 255);
|
213 |
+
eccout.push(Number(e >> BigInt(0)) & 255);
|
214 |
+
}
|
215 |
+
eccout = eccout.slice(0, this.getEccBytes());
|
216 |
+
const eccbytes = new Uint8Array(eccout);
|
217 |
+
return eccbytes;
|
218 |
+
}
|
219 |
+
/**
|
220 |
+
* Decodes the data and corrects errors using ECC.
|
221 |
+
* @param {number[]} data - The input data array.
|
222 |
+
* @param {Uint8Array} recvecc - The received ECC data.
|
223 |
+
* @returns {any} - The corrected data and status.
|
224 |
+
*/
|
225 |
+
decode(data, recvecc) {
|
226 |
+
this.encode(data);
|
227 |
+
const eccbuf = this.convertAllBitsToBigInts(Array.from(recvecc), 32);
|
228 |
+
const eccwords = this.ceilop(this.ECCstate.m * this.ECCstate.t, 32);
|
229 |
+
let sum = BigInt(0);
|
230 |
+
for (let i = 0; i < eccwords; i++) {
|
231 |
+
this.ECCstate.ecc_buf[i] = this.ECCstate.ecc_buf[i] ^ eccbuf[i];
|
232 |
+
sum = sum | this.ECCstate.ecc_buf[i];
|
233 |
+
}
|
234 |
+
const dataout = this.convertAllBitsToBigInts(data, 8);
|
235 |
+
if (sum === BigInt(0)) {
|
236 |
+
return {
|
237 |
+
bitflips: 0,
|
238 |
+
valid: true,
|
239 |
+
binary: this.toBinString(dataout, data.length),
|
240 |
+
hex: this.toHexString(dataout, data.length),
|
241 |
+
ascii: this.toAsciiString(dataout)
|
242 |
+
};
|
243 |
+
}
|
244 |
+
let s = this.ECCstate.ecc_bits;
|
245 |
+
let t = this.ECCstate.t;
|
246 |
+
const syn = new Array(2 * t).fill(0);
|
247 |
+
const m = s & 31;
|
248 |
+
const synbuf = this.ECCstate.ecc_buf;
|
249 |
+
if (m) {
|
250 |
+
synbuf[Math.floor(s / 32)] = synbuf[Math.floor(s / 32)] & ~BigInt(Math.pow(2, Number(32 - m)) - 1);
|
251 |
+
}
|
252 |
+
let synptr = 0;
|
253 |
+
while (s > 0 || synptr === 0) {
|
254 |
+
let poly = synbuf[synptr];
|
255 |
+
synptr += 1;
|
256 |
+
s -= 32;
|
257 |
+
while (poly) {
|
258 |
+
const i = this.degBigInt(poly);
|
259 |
+
for (let j = 0; j < 2 * t; j += 2) {
|
260 |
+
syn[j] = syn[j] ^ this.g_pow(this, (j + 1) * (i + s));
|
261 |
+
}
|
262 |
+
poly = poly ^ BigInt(Math.pow(2, i));
|
263 |
+
}
|
264 |
+
}
|
265 |
+
for (let i = 0; i < t; i++) {
|
266 |
+
syn[2 * i + 1] = this.g_sqrt(this, syn[i]);
|
267 |
+
}
|
268 |
+
const n = this.ECCstate.n;
|
269 |
+
t = this.ECCstate.t;
|
270 |
+
let pp = -1;
|
271 |
+
let pd = 1;
|
272 |
+
let pelp = { deg: 0, c: new Array(2 * t).fill(0) };
|
273 |
+
pelp.c[0] = 1;
|
274 |
+
const elp = { deg: 0, c: new Array(2 * t).fill(0) };
|
275 |
+
elp.c[0] = 1;
|
276 |
+
let d = syn[0];
|
277 |
+
let elp_copy;
|
278 |
+
for (let i = 0; i < t; i++) {
|
279 |
+
if (elp.deg > t) {
|
280 |
+
break;
|
281 |
+
}
|
282 |
+
if (d) {
|
283 |
+
const k = 2 * i - pp;
|
284 |
+
elp_copy = JSON.parse(JSON.stringify(elp));
|
285 |
+
let tmp = this.g_log(this, d) + n - this.g_log(this, pd);
|
286 |
+
for (let j = 0; j <= pelp.deg; j++) {
|
287 |
+
if (pelp.c[j] !== BigInt(0)) {
|
288 |
+
const l = this.g_log(this, pelp.c[j]);
|
289 |
+
elp.c[j + k] = elp.c[j + k] ^ this.g_pow(this, tmp + l);
|
290 |
+
}
|
291 |
+
}
|
292 |
+
tmp = pelp.deg + k;
|
293 |
+
if (tmp > elp.deg) {
|
294 |
+
elp.deg = tmp;
|
295 |
+
pelp = JSON.parse(JSON.stringify(elp_copy));
|
296 |
+
pd = d;
|
297 |
+
pp = 2 * i;
|
298 |
+
}
|
299 |
+
}
|
300 |
+
if (i < t - 1) {
|
301 |
+
d = syn[2 * i + 2];
|
302 |
+
for (let j = 1; j <= elp.deg; j++) {
|
303 |
+
d = d ^ this.g_mul(this, elp.c[j], syn[2 * i + 2 - j]);
|
304 |
+
}
|
305 |
+
}
|
306 |
+
}
|
307 |
+
this.ECCstate.elp = elp;
|
308 |
+
const nroots = this.getRoots(this, dataout.length, this.ECCstate.elp);
|
309 |
+
const datalen = dataout.length;
|
310 |
+
const nbits = datalen * 8 + this.ECCstate.ecc_bits;
|
311 |
+
if (nroots === -1) {
|
312 |
+
return { valid: false };
|
313 |
+
}
|
314 |
+
for (let i = 0; i < nroots; i++) {
|
315 |
+
if (this.ECCstate.errloc[i] >= nbits) {
|
316 |
+
return -1;
|
317 |
+
}
|
318 |
+
this.ECCstate.errloc[i] = nbits - 1 - this.ECCstate.errloc[i];
|
319 |
+
this.ECCstate.errloc[i] = this.ECCstate.errloc[i] & ~7 | 7 - (this.ECCstate.errloc[i] & 7);
|
320 |
+
}
|
321 |
+
for (const bitflip of this.ECCstate.errloc) {
|
322 |
+
const byte = Math.floor(bitflip / 8);
|
323 |
+
const bit = Math.pow(2, bitflip & 7);
|
324 |
+
if (bitflip < (dataout.length + recvecc.length) * 8) {
|
325 |
+
if (byte < dataout.length) {
|
326 |
+
dataout[byte] = dataout[byte] ^ BigInt(bit);
|
327 |
+
} else {
|
328 |
+
recvecc[byte - dataout.length] = recvecc[byte - dataout.length] ^ bit;
|
329 |
+
}
|
330 |
+
}
|
331 |
+
}
|
332 |
+
return {
|
333 |
+
bitflips: nroots,
|
334 |
+
valid: true,
|
335 |
+
binary: this.toBinString(dataout, data.length),
|
336 |
+
hex: this.toHexString(dataout, data.length),
|
337 |
+
ascii: this.toAsciiString(dataout)
|
338 |
+
};
|
339 |
+
}
|
340 |
+
/**
|
341 |
+
* Finds the roots of a polynomial.
|
342 |
+
* @param {any} instance - The instance of the ECC state.
|
343 |
+
* @param {number} k - The degree of the polynomial.
|
344 |
+
* @param {any} poly - The polynomial.
|
345 |
+
* @returns {number} - The number of roots found.
|
346 |
+
*/
|
347 |
+
getRoots(instance, k, poly) {
|
348 |
+
const roots = [];
|
349 |
+
if (poly.deg > 2) {
|
350 |
+
k = k * 8 + instance.ECCstate.ecc_bits;
|
351 |
+
const rep = new Array(instance.ECCstate.t * 2).fill(0);
|
352 |
+
const d = poly.deg;
|
353 |
+
const l = instance.ECCstate.n - this.g_log(instance, poly.c[poly.deg]);
|
354 |
+
for (let i = 0; i < d; i++) {
|
355 |
+
if (poly.c[i]) {
|
356 |
+
rep[i] = this.mod(instance, this.g_log(instance, poly.c[i]) + l);
|
357 |
+
} else {
|
358 |
+
rep[i] = -1;
|
359 |
+
}
|
360 |
+
}
|
361 |
+
rep[poly.deg] = 0;
|
362 |
+
const syn0 = this.g_div(instance, poly.c[0], poly.c[poly.deg]);
|
363 |
+
for (let i = instance.ECCstate.n - k + 1; i < instance.ECCstate.n + 1; i++) {
|
364 |
+
let syn = syn0;
|
365 |
+
for (let j = 1; j < poly.deg + 1; j++) {
|
366 |
+
const m = rep[j];
|
367 |
+
if (m >= 0) {
|
368 |
+
syn = syn ^ this.g_pow(instance, m + j * i);
|
369 |
+
}
|
370 |
+
}
|
371 |
+
if (syn === 0) {
|
372 |
+
roots.push(instance.ECCstate.n - i);
|
373 |
+
if (roots.length === poly.deg) {
|
374 |
+
break;
|
375 |
+
}
|
376 |
+
}
|
377 |
+
}
|
378 |
+
if (roots.length < poly.deg) {
|
379 |
+
instance.ECCstate.errloc = [];
|
380 |
+
return -1;
|
381 |
+
}
|
382 |
+
}
|
383 |
+
if (poly.deg === 1) {
|
384 |
+
if (poly.c[0]) {
|
385 |
+
roots.push(
|
386 |
+
this.mod(
|
387 |
+
instance,
|
388 |
+
instance.ECCstate.n - instance.ECCstate.logarithms[poly.c[0]] + instance.ECCstate.logarithms[poly.c[1]]
|
389 |
+
)
|
390 |
+
);
|
391 |
+
}
|
392 |
+
}
|
393 |
+
if (poly.deg === 2) {
|
394 |
+
if (poly.c[0] && poly.c[1]) {
|
395 |
+
const l0 = instance.ECCstate.logarithms[poly.c[0]];
|
396 |
+
const l1 = instance.ECCstate.logarithms[poly.c[1]];
|
397 |
+
const l2 = instance.ECCstate.logarithms[poly.c[2]];
|
398 |
+
const u = this.g_pow(instance, l0 + l2 + 2 * (instance.ECCstate.n - l1));
|
399 |
+
let r = 0;
|
400 |
+
let v = u;
|
401 |
+
while (v) {
|
402 |
+
const i = this.deg(v);
|
403 |
+
r = r ^ instance.ECCstate.elp_pre[i];
|
404 |
+
v = v ^ Math.pow(2, i);
|
405 |
+
}
|
406 |
+
if (this.g_sqrt(instance, r) ^ Number(r === u)) {
|
407 |
+
roots.push(this.modn(instance, 2 * instance.ECCstate.n - l1 - instance.ECCstate.logarithms[r] + l2));
|
408 |
+
roots.push(this.modn(instance, 2 * instance.ECCstate.n - l1 - instance.ECCstate.logarithms[r ^ 1] + l2));
|
409 |
+
}
|
410 |
+
}
|
411 |
+
}
|
412 |
+
instance.ECCstate.errloc = roots;
|
413 |
+
return roots.length;
|
414 |
+
}
|
415 |
+
/**
|
416 |
+
* Gets the number of ECC bits.
|
417 |
+
* @returns {number} - The number of ECC bits.
|
418 |
+
*/
|
419 |
+
getEccBits() {
|
420 |
+
return this.ECCstate.ecc_bits;
|
421 |
+
}
|
422 |
+
/**
|
423 |
+
* Gets the number of ECC bytes.
|
424 |
+
* @returns {number} - The number of ECC bytes.
|
425 |
+
*/
|
426 |
+
getEccBytes() {
|
427 |
+
return Math.ceil(this.ECCstate.m * this.ECCstate.t / 8);
|
428 |
+
}
|
429 |
+
/**
|
430 |
+
* Builds a cyclic table for error correction.
|
431 |
+
* @param {bigint[]} g - The generator polynomial.
|
432 |
+
*/
|
433 |
+
buildCyclic(g) {
|
434 |
+
const l = Math.ceil(this.ECCstate.m * this.ECCstate.t / 32);
|
435 |
+
const plen = Math.ceil((this.ECCstate.ecc_bits + 1) / 32);
|
436 |
+
const ecclen = Math.ceil(this.ECCstate.ecc_bits / 32);
|
437 |
+
this.ECCstate.cyclic_tab = new Array(4 * 256 * l).fill(BigInt(0));
|
438 |
+
for (let i = 0; i < 256; i++) {
|
439 |
+
for (let b = 0; b < 4; b++) {
|
440 |
+
const offset = (b * 256 + i) * l;
|
441 |
+
let data = BigInt(i) << BigInt(8 * b);
|
442 |
+
while (data) {
|
443 |
+
const d = this.degBigInt(data);
|
444 |
+
data ^= g[0] >> BigInt(31 - d);
|
445 |
+
for (let j = 0; j < ecclen; j++) {
|
446 |
+
let hi, lo;
|
447 |
+
if (d < 31) {
|
448 |
+
hi = BigInt(g[j] << BigInt(d + 1)) & BigInt(4294967295);
|
449 |
+
} else {
|
450 |
+
hi = BigInt(0);
|
451 |
+
}
|
452 |
+
if (j + 1 < plen) {
|
453 |
+
lo = g[j + 1] >> BigInt(31 - d);
|
454 |
+
} else {
|
455 |
+
lo = BigInt(0);
|
456 |
+
}
|
457 |
+
if (this.ECCstate.cyclic_tab[j + offset] === BigInt(0)) {
|
458 |
+
this.ECCstate.cyclic_tab[j + offset] = BigInt(0);
|
459 |
+
}
|
460 |
+
this.ECCstate.cyclic_tab[j + offset] ^= hi | lo;
|
461 |
+
}
|
462 |
+
}
|
463 |
+
}
|
464 |
+
}
|
465 |
+
}
|
466 |
+
/** GALOIS OPERATIONS */
|
467 |
+
/**
|
468 |
+
* Computes the power of a value in a Galois field.
|
469 |
+
* @param instance - The current context containing Galois field parameters.
|
470 |
+
* @param i - The exponent value.
|
471 |
+
* @returns The result of raising a value to the power i in the Galois field.
|
472 |
+
*/
|
473 |
+
g_pow(instance, i) {
|
474 |
+
return instance.ECCstate.exponents[this.modn(instance, i)];
|
475 |
+
}
|
476 |
+
/**
|
477 |
+
* Computes the square root of a value in a Galois field.
|
478 |
+
* @param instance - The current context containing Galois field parameters.
|
479 |
+
* @param a - The value whose square root is to be computed.
|
480 |
+
* @returns The square root of the value in the Galois field.
|
481 |
+
*/
|
482 |
+
g_sqrt(instance, a) {
|
483 |
+
if (a) {
|
484 |
+
return instance.ECCstate.exponents[this.mod(instance, 2 * instance.ECCstate.logarithms[a])];
|
485 |
+
} else {
|
486 |
+
return 0;
|
487 |
+
}
|
488 |
+
}
|
489 |
+
/**
|
490 |
+
* Computes the logarithm of a value in a Galois field.
|
491 |
+
* @param instance - The current context containing Galois field parameters.
|
492 |
+
* @param x - The value whose logarithm is to be computed.
|
493 |
+
* @returns The logarithm of the value in the Galois field.
|
494 |
+
*/
|
495 |
+
g_log(instance, x) {
|
496 |
+
return instance.ECCstate.logarithms[x];
|
497 |
+
}
|
498 |
+
/**
|
499 |
+
* Multiplies two values in a Galois field.
|
500 |
+
* @param instance - The current context containing Galois field parameters.
|
501 |
+
* @param a - The first value to be multiplied.
|
502 |
+
* @param b - The second value to be multiplied.
|
503 |
+
* @returns The product of the two values in the Galois field.
|
504 |
+
*/
|
505 |
+
g_mul(instance, a, b) {
|
506 |
+
if (a > 0 && b > 0) {
|
507 |
+
const res = this.mod(instance, instance.ECCstate.logarithms[a] + instance.ECCstate.logarithms[b]);
|
508 |
+
return instance.ECCstate.exponents[res];
|
509 |
+
} else {
|
510 |
+
return 0;
|
511 |
+
}
|
512 |
+
}
|
513 |
+
/**
|
514 |
+
* Divides two values in a Galois field.
|
515 |
+
* @param instance - The current context containing Galois field parameters.
|
516 |
+
* @param a - The dividend.
|
517 |
+
* @param b - The divisor.
|
518 |
+
* @returns The quotient of the division in the Galois field.
|
519 |
+
*/
|
520 |
+
g_div(instance, a, b) {
|
521 |
+
if (a) {
|
522 |
+
return instance.ECCstate.exponents[this.mod(instance, instance.ECCstate.logarithms[a] + instance.ECCstate.n - instance.ECCstate.logarithms[b])];
|
523 |
+
} else {
|
524 |
+
return 0;
|
525 |
+
}
|
526 |
+
}
|
527 |
+
/**
|
528 |
+
* Reduces a value modulo the Galois field size.
|
529 |
+
* @param instance - The current context containing Galois field parameters.
|
530 |
+
* @param v - The value to be reduced.
|
531 |
+
* @returns The value reduced modulo the Galois field size.
|
532 |
+
*/
|
533 |
+
mod(instance, v) {
|
534 |
+
if (v < instance.ECCstate.n) {
|
535 |
+
return v;
|
536 |
+
} else {
|
537 |
+
return v - instance.ECCstate.n;
|
538 |
+
}
|
539 |
+
}
|
540 |
+
/**
|
541 |
+
* Reduces a value modulo the Galois field size.
|
542 |
+
* @param instance - The current context containing Galois field parameters.
|
543 |
+
* @param v - The value to be reduced.
|
544 |
+
* @returns The value reduced modulo the Galois field size.
|
545 |
+
*/
|
546 |
+
modn(instance, v) {
|
547 |
+
const n = instance.ECCstate.n;
|
548 |
+
while (v >= n) {
|
549 |
+
v -= n;
|
550 |
+
v = (v & n) + (v >> instance.ECCstate.m);
|
551 |
+
}
|
552 |
+
return v;
|
553 |
+
}
|
554 |
+
/**
|
555 |
+
* Computes the degree of a polynomial represented as an integer.
|
556 |
+
* @param x - The polynomial represented as an integer.
|
557 |
+
* @returns The degree of the polynomial.
|
558 |
+
*/
|
559 |
+
deg(x) {
|
560 |
+
let count = 0;
|
561 |
+
while (x >> 1) {
|
562 |
+
x = x >> 1;
|
563 |
+
count += 1;
|
564 |
+
}
|
565 |
+
return count;
|
566 |
+
}
|
567 |
+
/**
|
568 |
+
* Computes the ceiling of the division of two integers.
|
569 |
+
* @param a - The dividend.
|
570 |
+
* @param b - The divisor.
|
571 |
+
* @returns The ceiling of the division of a by b.
|
572 |
+
*/
|
573 |
+
ceilop(a, b) {
|
574 |
+
return Math.floor((a + b - 1) / b);
|
575 |
+
}
|
576 |
+
/**
|
577 |
+
* Computes the degree of a polynomial represented as a BigInt.
|
578 |
+
* @param x - The polynomial represented as a BigInt.
|
579 |
+
* @returns The degree of the polynomial.
|
580 |
+
*/
|
581 |
+
degBigInt(x) {
|
582 |
+
let count = 0;
|
583 |
+
while (x >> BigInt(1)) {
|
584 |
+
x = x >> BigInt(1);
|
585 |
+
count += 1;
|
586 |
+
}
|
587 |
+
return count;
|
588 |
+
}
|
589 |
+
/**
|
590 |
+
* Converts an array of bits into a single BigInt value.
|
591 |
+
* @param {number[]} bitArray - The array of bits to convert.
|
592 |
+
* @param {number} bitLimit - The maximum number of bits to process.
|
593 |
+
* @returns {BigInt} - The combined value of all bits in the array.
|
594 |
+
*/
|
595 |
+
convertBitsToBigInt(bitArray, bitLimit) {
|
596 |
+
let result = BigInt(0);
|
597 |
+
if (bitLimit < bitArray.length) {
|
598 |
+
bitLimit = bitArray.length;
|
599 |
+
}
|
600 |
+
let pos = bitLimit - 1;
|
601 |
+
for (let b = 0; b < bitLimit; b++) {
|
602 |
+
if (bitArray[b]) {
|
603 |
+
result += BigInt(1) << BigInt(pos);
|
604 |
+
}
|
605 |
+
pos--;
|
606 |
+
}
|
607 |
+
return result;
|
608 |
+
}
|
609 |
+
/**
|
610 |
+
* Processes an array of bits in chunks, converting each chunk into a BigInt.
|
611 |
+
* @param {number[]} bitArray - The array of bits to process.
|
612 |
+
* @param {number} chunkSize - The size of each chunk of bits to process.
|
613 |
+
* @returns {BigInt[]} - An array of BigInt values representing chunks of the original bit array.
|
614 |
+
*/
|
615 |
+
convertAllBitsToBigInts(bitArray, chunkSize) {
|
616 |
+
const dataLength = bitArray.length;
|
617 |
+
let numChunks = Math.floor(dataLength / chunkSize);
|
618 |
+
const resultArray = [];
|
619 |
+
let offset = 0;
|
620 |
+
while (numChunks > 0) {
|
621 |
+
const chunk = bitArray.slice(offset, offset + chunkSize);
|
622 |
+
const bigInt = this.convertBitsToBigInt(chunk, chunkSize);
|
623 |
+
resultArray.push(bigInt);
|
624 |
+
offset += chunkSize;
|
625 |
+
numChunks--;
|
626 |
+
}
|
627 |
+
const remainingBitsArray = bitArray.slice(offset);
|
628 |
+
if (remainingBitsArray.length > 0) {
|
629 |
+
const bigInt = this.convertBitsToBigInt(remainingBitsArray, chunkSize);
|
630 |
+
resultArray.push(bigInt);
|
631 |
+
}
|
632 |
+
return resultArray;
|
633 |
+
}
|
634 |
+
/**
|
635 |
+
* Converts an array of up to 4 bytes into a single BigInt value.
|
636 |
+
* @param {bigint[]} byteArray - The array of bytes to convert.
|
637 |
+
* @returns {BigInt} - The combined value of the bytes as a BigInt.
|
638 |
+
*/
|
639 |
+
convertBytesToBigInt(byteArray) {
|
640 |
+
let result = BigInt(0);
|
641 |
+
if (byteArray.length > 0) result += byteArray[0] << BigInt(24);
|
642 |
+
if (byteArray.length > 1) result += byteArray[1] << BigInt(16);
|
643 |
+
if (byteArray.length > 2) result += byteArray[2] << BigInt(8);
|
644 |
+
if (byteArray.length > 3) result += byteArray[3];
|
645 |
+
return result;
|
646 |
+
}
|
647 |
+
/**
|
648 |
+
* Generates a binary string from data.
|
649 |
+
* @param {any[]} dataout - The data output array.
|
650 |
+
* @param {number} datalen - The desired length of the binary string.
|
651 |
+
* @returns {string} - The binary string representation of the data.
|
652 |
+
*/
|
653 |
+
toBinString(dataout, datalen) {
|
654 |
+
let out = "";
|
655 |
+
for (const byte of dataout) {
|
656 |
+
out += this.numberToBinaryString(byte, 8);
|
657 |
+
}
|
658 |
+
out = out.slice(0, datalen);
|
659 |
+
return out;
|
660 |
+
}
|
661 |
+
/**
|
662 |
+
* Converts a number to a binary string of a given length.
|
663 |
+
* @param {number} num - The number to convert.
|
664 |
+
* @param {number} length - The desired length of the binary string.
|
665 |
+
* @returns {string} - The binary string representation of the number.
|
666 |
+
*/
|
667 |
+
numberToBinaryString(num, length) {
|
668 |
+
let binaryString = num.toString(2);
|
669 |
+
while (binaryString.length < length) {
|
670 |
+
binaryString = "0" + binaryString;
|
671 |
+
}
|
672 |
+
return binaryString;
|
673 |
+
}
|
674 |
+
/**
|
675 |
+
* Decodes a Uint8Array to a string using 7-bit ASCII encoding.
|
676 |
+
* @param {Uint8Array} data - The input byte array.
|
677 |
+
* @returns {string} - The decoded string.
|
678 |
+
*/
|
679 |
+
toAsciiString(data) {
|
680 |
+
const textBitStr = data.map((byte) => byte.toString(2).padStart(8, "0")).join("");
|
681 |
+
const textInt7 = [];
|
682 |
+
for (let i = 0; i < textBitStr.length; i += 7) {
|
683 |
+
const bitSegment = textBitStr.slice(i, i + 7);
|
684 |
+
textInt7.push(parseInt(bitSegment, 2));
|
685 |
+
}
|
686 |
+
const textBytes = new Uint8Array(textInt7);
|
687 |
+
const decodedText = new TextDecoder("utf-8").decode(textBytes).replace(/\0/g, "");
|
688 |
+
return decodedText;
|
689 |
+
}
|
690 |
+
/**
|
691 |
+
* Converts an array of numbers to a hexadecimal string.
|
692 |
+
* @param {any[]} data - The array of numbers to convert.
|
693 |
+
* @returns {string} - The hexadecimal string representation of the numbers.
|
694 |
+
*/
|
695 |
+
toHexString(data, datalen) {
|
696 |
+
if (data.length > datalen / 8) {
|
697 |
+
data.pop();
|
698 |
+
}
|
699 |
+
return data.map(function(byte) {
|
700 |
+
byte = Number(byte);
|
701 |
+
if (byte > 15) return (byte & 255).toString(16);
|
702 |
+
else return "0" + (byte & 255).toString(16);
|
703 |
+
}).join("");
|
704 |
+
}
|
705 |
+
};
|
706 |
+
|
707 |
+
// src/datalayer.ts
|
708 |
+
var BCH_POLYNOMIAL = 137;
|
709 |
+
var DataLayer = class {
|
710 |
+
payload_len;
|
711 |
+
// Length of the payload in bits
|
712 |
+
encoding_mode;
|
713 |
+
// Encoding mode to be used
|
714 |
+
versionbits;
|
715 |
+
// Number of bits for the schema version
|
716 |
+
bch_encoder;
|
717 |
+
// BCH encoder instance
|
718 |
+
bch_decoders;
|
719 |
+
// Dictionary of BCH decoders for different schemas
|
720 |
+
/**
|
721 |
+
* Initializes the DataLayer with specified parameters.
|
722 |
+
* @param {number} payload_len - The length of the payload in bits.
|
723 |
+
* @param {boolean} verbose - Flag to indicate if messages should be logged.
|
724 |
+
* @param {number} encoding_mode - The encoding mode to be used (default is 0).
|
725 |
+
*/
|
726 |
+
constructor(payload_len, verbose, encoding_mode) {
|
727 |
+
this.bch_encoder = this.buildBCH(encoding_mode);
|
728 |
+
this.encoding_mode = encoding_mode;
|
729 |
+
this.versionbits = 4;
|
730 |
+
this.bch_decoders = {};
|
731 |
+
for (let i = 0; i < 4; i++) {
|
732 |
+
this.bch_decoders[i] = this.buildBCH(i);
|
733 |
+
}
|
734 |
+
this.payload_len = payload_len;
|
735 |
+
}
|
736 |
+
/**
|
737 |
+
* Builds and returns a BCH instance based on the given encoding mode.
|
738 |
+
*
|
739 |
+
* @param encoding_mode The encoding mode.
|
740 |
+
* @returns A BCH instance configured for the specified encoding mode.
|
741 |
+
*/
|
742 |
+
buildBCH(encoding_mode) {
|
743 |
+
switch (encoding_mode) {
|
744 |
+
case 1:
|
745 |
+
return new BCH(5, BCH_POLYNOMIAL);
|
746 |
+
case 2:
|
747 |
+
return new BCH(4, BCH_POLYNOMIAL);
|
748 |
+
case 3:
|
749 |
+
return new BCH(3, BCH_POLYNOMIAL);
|
750 |
+
default:
|
751 |
+
return new BCH(8, BCH_POLYNOMIAL);
|
752 |
+
}
|
753 |
+
}
|
754 |
+
/**
|
755 |
+
* Encodes a text string into a Float32Array with the ECC encoding.
|
756 |
+
* @param {string} text - The input text string.
|
757 |
+
* @returns {Float32Array} - The encoded Float32Array.
|
758 |
+
*/
|
759 |
+
encodeText(text) {
|
760 |
+
const data = this.encodeAscii(text);
|
761 |
+
const packet_d = Array.from(data).map((x) => x.toString(2).padStart(8, "0")).join("");
|
762 |
+
return this.encodePacket(packet_d);
|
763 |
+
}
|
764 |
+
/**
|
765 |
+
* Encodes a binary string into a Float32Array with the ECC encoding.
|
766 |
+
* @param {string} strbin - The input binary string.
|
767 |
+
* @returns {Float32Array} - The encoded Float32Array with the ECC encoding.
|
768 |
+
*/
|
769 |
+
encodeBinary(strbin) {
|
770 |
+
return this.encodePacket(String(strbin));
|
771 |
+
}
|
772 |
+
/**
|
773 |
+
* Processes and encodes the packet data.
|
774 |
+
* @param {string} packet_d - The binary string representation of the packet data.
|
775 |
+
* @returns {Float32Array} - The encoded Float32Array.
|
776 |
+
*/
|
777 |
+
encodePacket(packet_d) {
|
778 |
+
const data_bitcount = this.payload_len - this.bch_encoder.getEccBits() - this.versionbits;
|
779 |
+
const ecc_bitcount = this.bch_encoder.getEccBits();
|
780 |
+
packet_d = packet_d.substring(0, data_bitcount);
|
781 |
+
packet_d = packet_d.padEnd(data_bitcount, "0");
|
782 |
+
const pad_d = packet_d.length % 8 === 0 ? 0 : 8 - packet_d.length % 8;
|
783 |
+
const paddedpacket_d = packet_d + "0".repeat(pad_d);
|
784 |
+
const padded_data = Array.from(paddedpacket_d.split("").map(Number));
|
785 |
+
const ecc = this.bch_encoder.encode(padded_data);
|
786 |
+
let packet_e = Array.from(ecc).map((x) => x.toString(2).padStart(8, "0")).join("");
|
787 |
+
packet_e = packet_e.substring(0, ecc_bitcount);
|
788 |
+
const pad_e = packet_e.length % 8 === 0 || this.encoding_mode !== 0 ? 0 : 8 - packet_e.length % 8;
|
789 |
+
packet_e = packet_e.padEnd(packet_e.length + pad_e, "0");
|
790 |
+
const version = this.encoding_mode;
|
791 |
+
const packet_v = version.toString(2).padStart(4, "0");
|
792 |
+
let packet = packet_d + packet_e + packet_v;
|
793 |
+
packet = packet.split("").map((x) => parseInt(x, 10)).join("");
|
794 |
+
if (this.payload_len !== packet.length) {
|
795 |
+
throw new Error("Error! Could not form complete packet");
|
796 |
+
}
|
797 |
+
return new Float32Array(packet.split("").map(Number));
|
798 |
+
}
|
799 |
+
/**
|
800 |
+
* Encodes a string to a Float32Array using 7-bit ASCII encoding.
|
801 |
+
* @param {string} text - The input text string.
|
802 |
+
* @returns {Float32Array} - The encoded Float32Array.
|
803 |
+
*/
|
804 |
+
encodeAscii(text) {
|
805 |
+
const textInt7 = Array.from(text).map((t) => t.charCodeAt(0) & 127);
|
806 |
+
let textBitStr = textInt7.map((t) => t.toString(2).padStart(7, "0")).join("");
|
807 |
+
if (textBitStr.length % 8 !== 0) {
|
808 |
+
textBitStr = textBitStr.padEnd(textBitStr.length + (8 - textBitStr.length % 8), "0");
|
809 |
+
}
|
810 |
+
const byteArray = [];
|
811 |
+
for (let i = 0; i < textBitStr.length; i += 8) {
|
812 |
+
byteArray.push(parseInt(textBitStr.slice(i, i + 8), 2));
|
813 |
+
}
|
814 |
+
return new Float32Array(byteArray);
|
815 |
+
}
|
816 |
+
};
|
817 |
+
function getSchemaCapacity(schema_version) {
|
818 |
+
switch (schema_version) {
|
819 |
+
case 0:
|
820 |
+
return 40;
|
821 |
+
case 1:
|
822 |
+
return 61;
|
823 |
+
case 2:
|
824 |
+
return 68;
|
825 |
+
case 3:
|
826 |
+
return 75;
|
827 |
+
default:
|
828 |
+
throw new Error("Invalid schema version");
|
829 |
+
}
|
830 |
+
}
|
831 |
+
function getSchemaVersion(binary_array) {
|
832 |
+
const last_two_bits = binary_array.slice(-2);
|
833 |
+
const version = last_two_bits[0] * 2 + last_two_bits[1];
|
834 |
+
return version;
|
835 |
+
}
|
836 |
+
|
837 |
+
// src/ONNX_HUB_MANIFEST.json
|
838 |
+
var ONNX_HUB_MANIFEST_default = [
|
839 |
+
{
|
840 |
+
model: "Trustmark variant Q encoder",
|
841 |
+
model_name: "encoder_Q.onnx",
|
842 |
+
model_remote_host: "https://cc-assets.netlify.app",
|
843 |
+
model_path: "/watermarking/trustmark-models/encoder_Q.onnx",
|
844 |
+
onnx_version: "1.9.0",
|
845 |
+
opset_version: 17,
|
846 |
+
metadata: {
|
847 |
+
model_sha: "19b3d1b25836130ffd78775a8f61539f993375d1823ef0e59ba5b8dffb4f892d",
|
848 |
+
model_bytes: 17312208,
|
849 |
+
tags: ["watermarking"],
|
850 |
+
io_ports: {
|
851 |
+
inputs: [
|
852 |
+
{
|
853 |
+
name: " onnx::Concat_0",
|
854 |
+
shape: [1, 3, 256, 256],
|
855 |
+
type: "tensor(float)"
|
856 |
+
},
|
857 |
+
{
|
858 |
+
name: "onnx::Gemm_1",
|
859 |
+
shape: [1, 100],
|
860 |
+
type: "tensor(float)"
|
861 |
+
}
|
862 |
+
],
|
863 |
+
outputs: [
|
864 |
+
{
|
865 |
+
name: "image",
|
866 |
+
shape: [1, 3, 256, 256],
|
867 |
+
type: "tensor(float)"
|
868 |
+
}
|
869 |
+
]
|
870 |
+
}
|
871 |
+
}
|
872 |
+
},
|
873 |
+
{
|
874 |
+
model: "Trustmark variant P encoder",
|
875 |
+
model_name: "encoder_P.onnx",
|
876 |
+
model_remote_host: "https://cc-assets.netlify.app",
|
877 |
+
model_path: "/watermarking/trustmark-models/encoder_P.onnx",
|
878 |
+
onnx_version: "1.9.0",
|
879 |
+
opset_version: 17,
|
880 |
+
metadata: {
|
881 |
+
model_sha: "053441c9c9f05fc158ccba71c610d9d58fcd2c82d1912bf0ffcee988cf2f74c8",
|
882 |
+
model_bytes: 17312208,
|
883 |
+
tags: ["watermarking"],
|
884 |
+
io_ports: {
|
885 |
+
inputs: [
|
886 |
+
{
|
887 |
+
name: " onnx::Concat_0",
|
888 |
+
shape: [1, 3, 256, 256],
|
889 |
+
type: "tensor(float)"
|
890 |
+
},
|
891 |
+
{
|
892 |
+
name: "onnx::Gemm_1",
|
893 |
+
shape: [1, 100],
|
894 |
+
type: "tensor(float)"
|
895 |
+
}
|
896 |
+
],
|
897 |
+
outputs: [
|
898 |
+
{
|
899 |
+
name: "image",
|
900 |
+
shape: [1, 3, 256, 256],
|
901 |
+
type: "tensor(float)"
|
902 |
+
}
|
903 |
+
]
|
904 |
+
}
|
905 |
+
}
|
906 |
+
},
|
907 |
+
{
|
908 |
+
model: "Trustmark variant Q decoder",
|
909 |
+
model_name: "decoder_Q.onnx",
|
910 |
+
model_remote_host: "https://cc-assets.netlify.app",
|
911 |
+
model_path: "/watermarking/trustmark-models/decoder_Q.onnx",
|
912 |
+
onnx_version: "1.9.0",
|
913 |
+
opset_version: 17,
|
914 |
+
metadata: {
|
915 |
+
model_sha: "ee3268f057c9dabef680e169302f5973d0589feea86189ed229a896cc3aa88df",
|
916 |
+
model_bytes: 47401222,
|
917 |
+
tags: ["watermarking"],
|
918 |
+
io_ports: {
|
919 |
+
inputs: [
|
920 |
+
{
|
921 |
+
name: "image",
|
922 |
+
shape: [1, 3, 256, 256],
|
923 |
+
type: "tensor(float)"
|
924 |
+
}
|
925 |
+
],
|
926 |
+
outputs: [
|
927 |
+
{
|
928 |
+
name: "output",
|
929 |
+
shape: [1, 100],
|
930 |
+
type: "tensor(float)"
|
931 |
+
}
|
932 |
+
]
|
933 |
+
}
|
934 |
+
}
|
935 |
+
},
|
936 |
+
{
|
937 |
+
model: "Trustmark variant P decoder",
|
938 |
+
model_name: "decoder_P.onnx",
|
939 |
+
model_remote_host: "https://cc-assets.netlify.app",
|
940 |
+
model_path: "/watermarking/trustmark-models/decoder_P.onnx",
|
941 |
+
onnx_version: "1.9.0",
|
942 |
+
opset_version: 17,
|
943 |
+
metadata: {
|
944 |
+
model_sha: "be6d7c33f8a7b376f179e75f3f7c58ff816a9ac7bb6d37fd0a729a635f624c35",
|
945 |
+
model_bytes: 47400467,
|
946 |
+
tags: ["watermarking"],
|
947 |
+
io_ports: {
|
948 |
+
inputs: [
|
949 |
+
{
|
950 |
+
name: "image",
|
951 |
+
shape: [1, 3, 224, 224],
|
952 |
+
type: "tensor(float)"
|
953 |
+
}
|
954 |
+
],
|
955 |
+
outputs: [
|
956 |
+
{
|
957 |
+
name: "output",
|
958 |
+
shape: [1, 100],
|
959 |
+
type: "tensor(float)"
|
960 |
+
}
|
961 |
+
]
|
962 |
+
}
|
963 |
+
}
|
964 |
+
}
|
965 |
+
];
|
966 |
+
|
967 |
+
// src/trustmark.ts
|
968 |
+
var MODELS_PATH = "models/";
|
969 |
+
var ASPECT_RATIO_LIM = 2;
|
970 |
+
var IS_BROWSER = false;
|
971 |
+
var IS_NODE = false;
|
972 |
+
if (typeof window === "undefined") {
|
973 |
+
IS_NODE = true;
|
974 |
+
} else {
|
975 |
+
IS_BROWSER = true;
|
976 |
+
}
|
977 |
+
var VERBOSE = true;
|
978 |
+
var TrustMark = class _TrustMark {
|
979 |
+
/** * Static encoding mapping for different BCH modes. */
|
980 |
+
static encoding = {
|
981 |
+
undefined: -1,
|
982 |
+
BCH_SUPER: 0,
|
983 |
+
BCH_3: 3,
|
984 |
+
BCH_4: 2,
|
985 |
+
BCH_5: 1
|
986 |
+
};
|
987 |
+
use_ecc;
|
988 |
+
secret_len;
|
989 |
+
ecc;
|
990 |
+
decoder_session;
|
991 |
+
encoder_session;
|
992 |
+
preprocess_224_session;
|
993 |
+
preprocess_256_session;
|
994 |
+
model_type;
|
995 |
+
/**
|
996 |
+
* Constructs a new TrustMark instance.
|
997 |
+
* @param {boolean} [use_ecc=true] - use BCH error correction on the payload, reducing payload size (default)
|
998 |
+
* @param {number} [secret_len=100] - The length of the secret.
|
999 |
+
* @param {number} [encoding_mode=TrustMark.encoding.BCH_4] - The data schema encoding mode to use.
|
1000 |
+
*/
|
1001 |
+
constructor(use_ecc = true, secret_len = 100, encoding_mode = _TrustMark.encoding.BCH_4) {
|
1002 |
+
this.use_ecc = use_ecc;
|
1003 |
+
this.secret_len = secret_len;
|
1004 |
+
this.ecc = new DataLayer(secret_len, VERBOSE, encoding_mode);
|
1005 |
+
}
|
1006 |
+
/**
|
1007 |
+
* Decodes the watermark of an image from a given URL.
|
1008 |
+
*
|
1009 |
+
* @param image_url The URL of the image to decode.
|
1010 |
+
* @returns A promise that resolves to the decoded watermnark data.
|
1011 |
+
*/
|
1012 |
+
async decode(image_url) {
|
1013 |
+
tf.engine().startScope();
|
1014 |
+
const stego_image = await this.loadImage(image_url, "decode");
|
1015 |
+
await sleep(0);
|
1016 |
+
tf.engine().endScope();
|
1017 |
+
const input_feeds = { image: stego_image.onnx };
|
1018 |
+
const start_time = /* @__PURE__ */ new Date();
|
1019 |
+
const model_output = await this.decoder_session.run(input_feeds);
|
1020 |
+
const time_elapsed = (/* @__PURE__ */ new Date()).getTime() - start_time.getTime();
|
1021 |
+
tsLog(`Prediction: ${time_elapsed}ms`);
|
1022 |
+
await sleep(0);
|
1023 |
+
const output_data = model_output.output.cpuData;
|
1024 |
+
const binary_array = output_data.map((value) => value >= 0 ? 1 : 0);
|
1025 |
+
const schema = getSchemaVersion(binary_array);
|
1026 |
+
let data_bits = getSchemaCapacity(schema);
|
1027 |
+
let data = binary_array.slice(0, data_bits);
|
1028 |
+
let ecc = binary_array.slice(data_bits, 96);
|
1029 |
+
let decoded_data = this.ecc.bch_decoders[schema].decode(data, ecc);
|
1030 |
+
decoded_data.schema = schema;
|
1031 |
+
if (!decoded_data.valid) {
|
1032 |
+
for (let alt_schema = 0; alt_schema < 3; alt_schema++) {
|
1033 |
+
if (alt_schema === schema) continue;
|
1034 |
+
data_bits = getSchemaCapacity(alt_schema);
|
1035 |
+
data = binary_array.slice(0, data_bits);
|
1036 |
+
ecc = binary_array.slice(data_bits, 96);
|
1037 |
+
decoded_data = this.ecc.bch_decoders[alt_schema].decode(data, ecc);
|
1038 |
+
decoded_data.schema = alt_schema;
|
1039 |
+
if (decoded_data.valid) {
|
1040 |
+
break;
|
1041 |
+
}
|
1042 |
+
}
|
1043 |
+
}
|
1044 |
+
decoded_data.raw = binary_array;
|
1045 |
+
return decoded_data;
|
1046 |
+
}
|
1047 |
+
/**
|
1048 |
+
* Encodes a secret into an image and returns the stego image and the residual image.
|
1049 |
+
*
|
1050 |
+
* @param {string} image_url The cover image data.
|
1051 |
+
* @param {string} string_secret The secret string to encode.
|
1052 |
+
* @param {number} wm_strength The watermark strength. Default is 0.4.
|
1053 |
+
* @param {boolean} maculate Whether to overwrite an existing watermark with random values. Default is false.
|
1054 |
+
* @param {string} output The output format. Default is 'bytes'.
|
1055 |
+
* @returns A promise that resolves with the encoded data or rejects with an error.
|
1056 |
+
*/
|
1057 |
+
async encode(image_url, string_secret, wm_strength = 0.4, maculate = false, output = "bytes") {
|
1058 |
+
tf.engine().startScope();
|
1059 |
+
const cover_image = await this.loadImage(image_url, "encode");
|
1060 |
+
let mode;
|
1061 |
+
let secret = new Float32Array(100);
|
1062 |
+
if (maculate === true) {
|
1063 |
+
mode = "binary";
|
1064 |
+
secret.set(
|
1065 |
+
Float32Array.from({ length: 96 }, () => Math.round(Math.random())),
|
1066 |
+
0
|
1067 |
+
);
|
1068 |
+
secret.set([0, 0, 0, 0], 96);
|
1069 |
+
} else {
|
1070 |
+
const binary_count = string_secret.match(/[01]/g);
|
1071 |
+
if (binary_count && binary_count.length == string_secret.length) {
|
1072 |
+
mode = "binary";
|
1073 |
+
} else {
|
1074 |
+
mode = "text";
|
1075 |
+
}
|
1076 |
+
if (!this.use_ecc) {
|
1077 |
+
if (mode === "binary") {
|
1078 |
+
secret = new Float32Array(Array.from(string_secret).map(Number));
|
1079 |
+
} else {
|
1080 |
+
secret = this.ecc.encodeAscii(string_secret);
|
1081 |
+
secret = new Float32Array(Array.from(secret).map(Number));
|
1082 |
+
}
|
1083 |
+
} else {
|
1084 |
+
if (mode === "binary") {
|
1085 |
+
secret = this.ecc.encodeBinary(string_secret);
|
1086 |
+
} else {
|
1087 |
+
secret = this.ecc.encodeText(string_secret);
|
1088 |
+
}
|
1089 |
+
}
|
1090 |
+
}
|
1091 |
+
cover_image.onnx_secret = new ort.Tensor("float32", secret, [1, 100]);
|
1092 |
+
const input_feeds = { "onnx::Concat_0": cover_image.onnx, "onnx::Gemm_1": cover_image.onnx_secret };
|
1093 |
+
let start_time = /* @__PURE__ */ new Date();
|
1094 |
+
const model_output = await this.encoder_session.run(input_feeds);
|
1095 |
+
let time_elapsed = (/* @__PURE__ */ new Date()).getTime() - start_time.getTime();
|
1096 |
+
tsLog(`Inference: ${time_elapsed}ms`);
|
1097 |
+
await sleep(0);
|
1098 |
+
start_time = /* @__PURE__ */ new Date();
|
1099 |
+
const tf_cover = tf.tensor(cover_image.onnx.cpuData, [1, 3, 256, 256]);
|
1100 |
+
const tf_stego = tf.tensor(model_output.image.cpuData, [1, 3, 256, 256]);
|
1101 |
+
let tf_residual = tf.clipByValue(tf_stego, -1, 1).sub(tf_cover).squeeze().transpose([1, 2, 0]);
|
1102 |
+
tf_cover.dispose();
|
1103 |
+
tf_stego.dispose();
|
1104 |
+
if (IS_NODE && VERBOSE || IS_BROWSER) {
|
1105 |
+
const residual_display = tf_residual.mul(10).clipByValue(0, 1);
|
1106 |
+
if (IS_NODE) {
|
1107 |
+
if (output == "png") {
|
1108 |
+
cover_image.residual = await tf.node.encodePng(residual_display.mul(255));
|
1109 |
+
} else {
|
1110 |
+
cover_image.residual = await tf.browser.toPixels(residual_display);
|
1111 |
+
}
|
1112 |
+
} else {
|
1113 |
+
cover_image.residual = await tf.browser.toPixels(residual_display);
|
1114 |
+
}
|
1115 |
+
residual_display.dispose();
|
1116 |
+
}
|
1117 |
+
tf_residual = tf.image.resizeBilinear(tf_residual, [cover_image.crop_height, cover_image.crop_width]);
|
1118 |
+
time_elapsed = (/* @__PURE__ */ new Date()).getTime() - start_time.getTime();
|
1119 |
+
tsLog(`Residual Interpolation: ${time_elapsed}ms`);
|
1120 |
+
await sleep(0);
|
1121 |
+
start_time = /* @__PURE__ */ new Date();
|
1122 |
+
let tf_merge = tf.clipByValue(tf.add(tf_residual.mul(wm_strength), cover_image.tf_crop), 0, 1);
|
1123 |
+
if (cover_image.aspect_ratio > 2) {
|
1124 |
+
if (cover_image.orientation == "landscape") {
|
1125 |
+
const axe_length = Math.floor((cover_image.width - cover_image.crop_axe) / 2);
|
1126 |
+
const part_a = cover_image.tf_source.slice([0, 0, 0], [cover_image.crop_axe, axe_length, 3]);
|
1127 |
+
const part_b = cover_image.tf_source.slice(
|
1128 |
+
[0, axe_length + cover_image.crop_axe, 0],
|
1129 |
+
[cover_image.crop_axe, cover_image.width - axe_length - cover_image.crop_axe, 3]
|
1130 |
+
);
|
1131 |
+
tf_merge = tf.concat([part_a, tf_merge, part_b], 1);
|
1132 |
+
}
|
1133 |
+
if (cover_image.orientation == "portrait") {
|
1134 |
+
const axe_length = Math.floor((cover_image.height - cover_image.crop_axe) / 2);
|
1135 |
+
const part_a = cover_image.tf_source.slice([0, 0, 0], [axe_length, cover_image.crop_axe, 3]);
|
1136 |
+
const part_b = cover_image.tf_source.slice(
|
1137 |
+
[axe_length + cover_image.crop_axe, 0, 0],
|
1138 |
+
[cover_image.height - axe_length - cover_image.crop_axe, cover_image.crop_axe, 3]
|
1139 |
+
);
|
1140 |
+
tf_merge = tf.concat([part_a, tf_merge, part_b], 0);
|
1141 |
+
}
|
1142 |
+
}
|
1143 |
+
cover_image.tf_crop.dispose();
|
1144 |
+
tf_residual.dispose();
|
1145 |
+
time_elapsed = (/* @__PURE__ */ new Date()).getTime() - start_time.getTime();
|
1146 |
+
tsLog(`Compositing: ${time_elapsed}ms`);
|
1147 |
+
await sleep(0);
|
1148 |
+
start_time = /* @__PURE__ */ new Date();
|
1149 |
+
if (IS_NODE) {
|
1150 |
+
if (output == "png") {
|
1151 |
+
cover_image.stego = await tf.node.encodePng(tf_merge.mul(255));
|
1152 |
+
} else {
|
1153 |
+
cover_image.stego = await tf.browser.toPixels(tf_merge);
|
1154 |
+
}
|
1155 |
+
} else {
|
1156 |
+
cover_image.stego = await tf.browser.toPixels(tf_merge);
|
1157 |
+
}
|
1158 |
+
time_elapsed = (/* @__PURE__ */ new Date()).getTime() - start_time.getTime();
|
1159 |
+
tsLog(`Encoding: ${time_elapsed}ms`);
|
1160 |
+
await sleep(0);
|
1161 |
+
tf.engine().endScope();
|
1162 |
+
return {
|
1163 |
+
stego: cover_image.stego,
|
1164 |
+
residual: cover_image.residual ? cover_image.residual : new Uint8Array(),
|
1165 |
+
height: cover_image.height,
|
1166 |
+
width: cover_image.width
|
1167 |
+
};
|
1168 |
+
}
|
1169 |
+
/**
|
1170 |
+
* Processes an image and returns the processed data.
|
1171 |
+
*
|
1172 |
+
* @param image The input image data.
|
1173 |
+
* @returns A promise that resolves with the processed image data or rejects with an error.
|
1174 |
+
*/
|
1175 |
+
async processImage(image2, process_type) {
|
1176 |
+
const start_time = /* @__PURE__ */ new Date();
|
1177 |
+
image2.width = image2.tf_source.shape[2];
|
1178 |
+
image2.height = image2.tf_source.shape[1];
|
1179 |
+
if (image2.width > image2.height) {
|
1180 |
+
image2.orientation = "landscape";
|
1181 |
+
image2.aspect_ratio = image2.width / image2.height;
|
1182 |
+
} else {
|
1183 |
+
image2.orientation = "portrait";
|
1184 |
+
image2.aspect_ratio = image2.height / image2.width;
|
1185 |
+
}
|
1186 |
+
if (image2.aspect_ratio > ASPECT_RATIO_LIM) {
|
1187 |
+
const size = Math.min(image2.width, image2.height);
|
1188 |
+
const left = (image2.width - size) / 2;
|
1189 |
+
const top = (image2.height - size) / 2;
|
1190 |
+
image2.tf_crop = tf.image.cropAndResize(
|
1191 |
+
image2.tf_source,
|
1192 |
+
[[top / image2.height, left / image2.width, (top + size) / image2.height, (left + size) / image2.width]],
|
1193 |
+
[0],
|
1194 |
+
[size, size],
|
1195 |
+
"nearest"
|
1196 |
+
);
|
1197 |
+
image2.crop_axe = image2.crop_width = image2.crop_height = size;
|
1198 |
+
} else {
|
1199 |
+
image2.tf_crop = image2.tf_source;
|
1200 |
+
image2.crop_width = image2.width;
|
1201 |
+
image2.crop_height = image2.height;
|
1202 |
+
}
|
1203 |
+
image2.tf_source = image2.tf_source.squeeze();
|
1204 |
+
image2.tf_crop = image2.tf_crop.transpose([0, 3, 1, 2]);
|
1205 |
+
const data = image2.tf_crop.dataSync();
|
1206 |
+
const onnxTensor = new ort.Tensor("float32", data, image2.tf_crop.shape);
|
1207 |
+
image2.tf_crop = image2.tf_crop.transpose([0, 2, 3, 1]);
|
1208 |
+
image2.tf_crop = image2.tf_crop.squeeze();
|
1209 |
+
if (this.model_type == "P" && process_type == "decode") {
|
1210 |
+
image2.onnx = (await this.preprocess_224_session.run({ input: onnxTensor })).output;
|
1211 |
+
} else {
|
1212 |
+
image2.onnx = (await this.preprocess_256_session.run({ input: onnxTensor })).output;
|
1213 |
+
}
|
1214 |
+
await sleep(0);
|
1215 |
+
const time_elapsed = (/* @__PURE__ */ new Date()).getTime() - start_time.getTime();
|
1216 |
+
tsLog(`Processing: ${image2.width}x${image2.height}: ${time_elapsed}ms`);
|
1217 |
+
return image2;
|
1218 |
+
}
|
1219 |
+
/**
|
1220 |
+
* Loads an image from a given URL and processes it.
|
1221 |
+
*
|
1222 |
+
* @param image_url The URL of the image to load.
|
1223 |
+
* @returns A promise that resolves with the processed image data or rejects with an error.
|
1224 |
+
*/
|
1225 |
+
async loadImage(image_url, process_type) {
|
1226 |
+
return new Promise(async (resolve) => {
|
1227 |
+
const start_time = /* @__PURE__ */ new Date();
|
1228 |
+
const image2 = { url: image_url };
|
1229 |
+
if (IS_NODE) {
|
1230 |
+
const image_buffer = (0, import_node_fs.readFileSync)(image2.url);
|
1231 |
+
image2.tf_source = tf.node.decodeImage(image_buffer).expandDims(0).div(255);
|
1232 |
+
} else {
|
1233 |
+
const img = new Image();
|
1234 |
+
img.onload = async () => {
|
1235 |
+
image2.tf_source = tf.browser.fromPixels(img).expandDims(0).div(255);
|
1236 |
+
const time_elapsed = (/* @__PURE__ */ new Date()).getTime() - start_time.getTime();
|
1237 |
+
tsLog(`Loading: ${time_elapsed}ms`);
|
1238 |
+
resolve(await this.processImage(image2, process_type));
|
1239 |
+
};
|
1240 |
+
img.src = image2.url;
|
1241 |
+
}
|
1242 |
+
if (IS_NODE) {
|
1243 |
+
const time_elapsed = (/* @__PURE__ */ new Date()).getTime() - start_time.getTime();
|
1244 |
+
tsLog(`Loading: ${time_elapsed}ms`);
|
1245 |
+
resolve(await this.processImage(image2, process_type));
|
1246 |
+
}
|
1247 |
+
});
|
1248 |
+
}
|
1249 |
+
/**
|
1250 |
+
* Loads the ONNX models for preprocessing, encoding, and decoding.
|
1251 |
+
*/
|
1252 |
+
async loadModels(type = "Q") {
|
1253 |
+
const models = await getModels();
|
1254 |
+
let decoder_model_url;
|
1255 |
+
let encoder_model_url;
|
1256 |
+
this.model_type = type;
|
1257 |
+
if (type == "Q") {
|
1258 |
+
decoder_model_url = models["decoder_Q.onnx"];
|
1259 |
+
encoder_model_url = models["encoder_Q.onnx"];
|
1260 |
+
}
|
1261 |
+
if (type == "P") {
|
1262 |
+
decoder_model_url = models["decoder_P.onnx"];
|
1263 |
+
encoder_model_url = models["encoder_P.onnx"];
|
1264 |
+
this.preprocess_224_session = await ort.InferenceSession.create("models/preprocess_224.onnx").catch((error) => {
|
1265 |
+
throw new Error(`Error loading preprocessing ONNX model: ${error}`);
|
1266 |
+
});
|
1267 |
+
}
|
1268 |
+
const session_option = { executionProviders: ["cpu"] };
|
1269 |
+
this.preprocess_256_session = await ort.InferenceSession.create("models/preprocess_256.onnx").catch((error) => {
|
1270 |
+
throw new Error(`Error loading preprocessing ONNX model: ${error}`);
|
1271 |
+
});
|
1272 |
+
this.decoder_session = await ort.InferenceSession.create(decoder_model_url, session_option).catch((error) => {
|
1273 |
+
throw new Error(`Error loading decoder ONNX model: ${error}`);
|
1274 |
+
});
|
1275 |
+
this.encoder_session = await ort.InferenceSession.create(encoder_model_url, session_option).catch((error) => {
|
1276 |
+
throw new Error(`Error loading encoder ONNX model: ${error}`);
|
1277 |
+
});
|
1278 |
+
}
|
1279 |
+
};
|
1280 |
+
async function getModels() {
|
1281 |
+
return new Promise(async (resolve, reject) => {
|
1282 |
+
const fetchs = [];
|
1283 |
+
const models = {};
|
1284 |
+
for (const model of ONNX_HUB_MANIFEST_default) {
|
1285 |
+
const model_url = model.model_remote_host + model.model_path;
|
1286 |
+
const model_path = MODELS_PATH + model.model_name;
|
1287 |
+
const model_bytes = model.metadata.model_bytes;
|
1288 |
+
if (IS_NODE) {
|
1289 |
+
if ((0, import_node_fs.existsSync)(model_path)) {
|
1290 |
+
models[model.model_name] = model_path;
|
1291 |
+
} else {
|
1292 |
+
tsLog(`'${model_path}' needs to be fetched and cached from remote repository.`);
|
1293 |
+
fetchs.push(fetchModel(model_url, model_path, model.model_name, model.metadata.model_sha, model_bytes));
|
1294 |
+
}
|
1295 |
+
} else {
|
1296 |
+
await restoreFileFromCache(model.model_name).then((file) => {
|
1297 |
+
models[model.model_name] = file;
|
1298 |
+
}).catch((e) => {
|
1299 |
+
tsLog(model.model_name + " needs to be fetched and cached from remote repository.");
|
1300 |
+
fetchs.push(fetchModel(model_url, model_path, model.model_name, model.metadata.model_sha, model_bytes));
|
1301 |
+
});
|
1302 |
+
}
|
1303 |
+
}
|
1304 |
+
await Promise.all(fetchs).then((fmodels) => {
|
1305 |
+
fmodels.forEach(function(fmodel) {
|
1306 |
+
models[fmodel.model_name] = fmodel.path;
|
1307 |
+
});
|
1308 |
+
}).catch((err) => reject(err));
|
1309 |
+
resolve(models);
|
1310 |
+
});
|
1311 |
+
}
|
1312 |
+
async function fetchModel(url, file_path, model_name, checksum, model_bytes) {
|
1313 |
+
return new Promise(async (resolve, reject) => {
|
1314 |
+
fetch(url).then((response) => {
|
1315 |
+
return response.body;
|
1316 |
+
}).then((body) => {
|
1317 |
+
const reader = body.getReader();
|
1318 |
+
let charsReceived = 0;
|
1319 |
+
return new ReadableStream({
|
1320 |
+
async start(controller) {
|
1321 |
+
return pump();
|
1322 |
+
function pump() {
|
1323 |
+
return reader.read().then(({ done, value }) => {
|
1324 |
+
if (done) {
|
1325 |
+
controller.close();
|
1326 |
+
return;
|
1327 |
+
}
|
1328 |
+
charsReceived += value.length;
|
1329 |
+
const progress_percentage = Math.floor(charsReceived / model_bytes * 100);
|
1330 |
+
if (IS_NODE) {
|
1331 |
+
process.stdout.clearLine(0);
|
1332 |
+
process.stdout.cursorTo(0);
|
1333 |
+
process.stdout.write(`Progress: ${drawProgressBar(progress_percentage)} of ${model_name}`);
|
1334 |
+
} else {
|
1335 |
+
tsLog(`Loading model: ${progress_percentage}% of ${file_path}`, true);
|
1336 |
+
}
|
1337 |
+
controller.enqueue(value);
|
1338 |
+
return pump();
|
1339 |
+
});
|
1340 |
+
}
|
1341 |
+
}
|
1342 |
+
});
|
1343 |
+
}).then((stream) => new Response(stream)).then((response) => response.arrayBuffer()).then(async (a_buffer) => {
|
1344 |
+
const file_chacksum = await sha(new Uint8Array(a_buffer));
|
1345 |
+
if (file_chacksum == checksum) {
|
1346 |
+
const model = {
|
1347 |
+
model_name,
|
1348 |
+
path: a_buffer
|
1349 |
+
};
|
1350 |
+
if (IS_NODE) {
|
1351 |
+
(0, import_node_fs.writeFile)(file_path, new Uint8Array(a_buffer), (err) => {
|
1352 |
+
if (err) {
|
1353 |
+
reject(err);
|
1354 |
+
} else {
|
1355 |
+
resolve(model);
|
1356 |
+
}
|
1357 |
+
});
|
1358 |
+
} else {
|
1359 |
+
await storeFileInCache(model_name, new Blob([a_buffer], { type: "application/octet-stream" }));
|
1360 |
+
resolve(model);
|
1361 |
+
}
|
1362 |
+
}
|
1363 |
+
}).catch((err) => reject(err));
|
1364 |
+
});
|
1365 |
+
}
|
1366 |
+
async function restoreFileFromCache(model_name) {
|
1367 |
+
const modelCache = await caches.open("models");
|
1368 |
+
const response = await modelCache.match(model_name);
|
1369 |
+
if (!response) {
|
1370 |
+
throw new Error(`${model_name} not found in cache.`);
|
1371 |
+
}
|
1372 |
+
const file = await response.arrayBuffer();
|
1373 |
+
tsLog(`${model_name} found in cache.`);
|
1374 |
+
return file;
|
1375 |
+
}
|
1376 |
+
async function storeFileInCache(model_name, blob) {
|
1377 |
+
try {
|
1378 |
+
const modelCache = await caches.open("models");
|
1379 |
+
await modelCache.put(model_name, new Response(blob));
|
1380 |
+
tsLog(`${model_name} cached`);
|
1381 |
+
} catch (err) {
|
1382 |
+
throw new Error(err);
|
1383 |
+
}
|
1384 |
+
}
|
1385 |
+
function drawProgressBar(progress) {
|
1386 |
+
const barWidth = 30;
|
1387 |
+
const filledWidth = Math.floor(progress / 100 * barWidth);
|
1388 |
+
const emptyWidth = barWidth - filledWidth;
|
1389 |
+
const progressBar = "\u2588".repeat(filledWidth) + "\u2592".repeat(emptyWidth);
|
1390 |
+
return `[${progressBar}] ${progress}%`;
|
1391 |
+
}
|
1392 |
+
function sha(content) {
|
1393 |
+
if (IS_NODE) {
|
1394 |
+
return (0, import_node_crypto.createHash)("sha256").update(content).digest("hex");
|
1395 |
+
} else {
|
1396 |
+
return hash(content);
|
1397 |
+
}
|
1398 |
+
}
|
1399 |
+
function sleep(m) {
|
1400 |
+
if (IS_BROWSER) {
|
1401 |
+
return new Promise((resolve) => setTimeout(resolve, m));
|
1402 |
+
}
|
1403 |
+
}
|
1404 |
+
function tsLog(str, browser_only = false) {
|
1405 |
+
if (IS_BROWSER) {
|
1406 |
+
const payloadevt = new CustomEvent("status", { detail: str });
|
1407 |
+
window.dispatchEvent(payloadevt);
|
1408 |
+
}
|
1409 |
+
if (IS_NODE && browser_only === false && VERBOSE) {
|
1410 |
+
console.log(str);
|
1411 |
+
}
|
1412 |
+
}
|
1413 |
+
async function hash(content) {
|
1414 |
+
const hashBuffer = await crypto.subtle.digest("SHA-256", content);
|
1415 |
+
const hashArray = Array.from(new Uint8Array(hashBuffer));
|
1416 |
+
const hashHex = hashArray.map((bytes) => bytes.toString(16).padStart(2, "0")).join("");
|
1417 |
+
console.log(hashHex);
|
1418 |
+
return hashHex;
|
1419 |
+
}
|
1420 |
+
// Annotate the CommonJS export names for ESM import in node:
|
1421 |
+
0 && (module.exports = {
|
1422 |
+
TrustMark
|
1423 |
+
});
|
docs/dist/index.js
ADDED
@@ -0,0 +1,1382 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
// src/trustmark.ts
|
2 |
+
|
3 |
+
// src/bchecc.ts
|
4 |
+
var BCH = class {
|
5 |
+
ECCstate;
|
6 |
+
/**
|
7 |
+
* Initializes the ECC state with given parameters.
|
8 |
+
* @param {number} t - Number of error correctable bits, max number of bit flips we can account for, increasing this increase the ecc length
|
9 |
+
* @param {number} poly - The polynomial used for ECC.
|
10 |
+
*/
|
11 |
+
constructor(t, poly) {
|
12 |
+
let tmp = poly;
|
13 |
+
let m = 0;
|
14 |
+
while (tmp >> 1) {
|
15 |
+
tmp = tmp >> 1;
|
16 |
+
m += 1;
|
17 |
+
}
|
18 |
+
this.ECCstate = {
|
19 |
+
m,
|
20 |
+
t,
|
21 |
+
poly
|
22 |
+
};
|
23 |
+
this.ECCstate.n = Math.pow(2, m) - 1;
|
24 |
+
const words = Math.ceil(m * t / 32);
|
25 |
+
this.ECCstate.ecc_bytes = Math.ceil(m * t / 8);
|
26 |
+
this.ECCstate.cyclic_tab = new Array(words * 1024).fill(BigInt(0));
|
27 |
+
this.ECCstate.syn = new Array(2 * t).fill(0);
|
28 |
+
this.ECCstate.elp = new Array(t + 1).fill(0);
|
29 |
+
this.ECCstate.errloc = new Array(t).fill(0);
|
30 |
+
let x = 1;
|
31 |
+
const k = Math.pow(2, this.deg(poly));
|
32 |
+
if (k !== Math.pow(2, this.ECCstate.m)) {
|
33 |
+
return;
|
34 |
+
}
|
35 |
+
this.ECCstate.exponents = new Array(1 + this.ECCstate.n).fill(0);
|
36 |
+
this.ECCstate.logarithms = new Array(1 + this.ECCstate.n).fill(0);
|
37 |
+
this.ECCstate.elp_pre = new Array(1 + this.ECCstate.m).fill(0);
|
38 |
+
for (let i2 = 0; i2 < this.ECCstate.n; i2++) {
|
39 |
+
this.ECCstate.exponents[i2] = x;
|
40 |
+
this.ECCstate.logarithms[x] = i2;
|
41 |
+
if (i2 && x === 1) {
|
42 |
+
return;
|
43 |
+
}
|
44 |
+
x *= 2;
|
45 |
+
if (x & k) {
|
46 |
+
x ^= poly;
|
47 |
+
}
|
48 |
+
}
|
49 |
+
this.ECCstate.logarithms[0] = 0;
|
50 |
+
this.ECCstate.exponents[this.ECCstate.n] = 1;
|
51 |
+
let n = 0;
|
52 |
+
const g = { deg: 0, c: new Array(m * t + 1).fill(BigInt(0)) };
|
53 |
+
const roots = new Array(this.ECCstate.n + 1).fill(0);
|
54 |
+
const genpoly = new Array(Math.ceil(m * t + 1 / 32)).fill(BigInt(0));
|
55 |
+
for (let i2 = 0; i2 < t; i2++) {
|
56 |
+
let r = 2 * i2 + 1;
|
57 |
+
for (let j = 0; j < m; j++) {
|
58 |
+
roots[r] = 1;
|
59 |
+
r = this.mod(this, 2 * r);
|
60 |
+
}
|
61 |
+
}
|
62 |
+
g.deg = 0;
|
63 |
+
g.c[0] = BigInt(1);
|
64 |
+
for (let i2 = 0; i2 < this.ECCstate.n; i2++) {
|
65 |
+
if (roots[i2]) {
|
66 |
+
const r = this.ECCstate.exponents[i2];
|
67 |
+
g.c[g.deg + 1] = BigInt(1);
|
68 |
+
for (let j = g.deg; j > 0; j--) {
|
69 |
+
g.c[j] = this.g_mul(this, g.c[j], r) ^ g.c[j - 1];
|
70 |
+
}
|
71 |
+
g.c[0] = this.g_mul(this, g.c[0], r);
|
72 |
+
g.deg += 1;
|
73 |
+
}
|
74 |
+
}
|
75 |
+
n = g.deg + 1;
|
76 |
+
let i = 0;
|
77 |
+
while (n > 0) {
|
78 |
+
const nbits = n > 32 ? 32 : n;
|
79 |
+
let word = BigInt(0);
|
80 |
+
for (let j = 0; j < nbits; j++) {
|
81 |
+
if (g.c[n - 1 - j]) {
|
82 |
+
word |= BigInt(Math.pow(2, 31 - j));
|
83 |
+
}
|
84 |
+
}
|
85 |
+
genpoly[i] = word;
|
86 |
+
i += 1;
|
87 |
+
n -= nbits;
|
88 |
+
}
|
89 |
+
this.ECCstate.ecc_bits = g.deg;
|
90 |
+
this.buildCyclic(genpoly);
|
91 |
+
let sum = 0;
|
92 |
+
let aexp = 0;
|
93 |
+
for (let i2 = 0; i2 < m; i2++) {
|
94 |
+
for (let j = 0; j < m; j++) {
|
95 |
+
sum ^= this.g_pow(this, i2 * Math.pow(2, j));
|
96 |
+
}
|
97 |
+
if (sum) {
|
98 |
+
aexp = this.ECCstate.exponents[i2];
|
99 |
+
break;
|
100 |
+
}
|
101 |
+
}
|
102 |
+
x = 0;
|
103 |
+
const precomp = new Array(31).fill(0);
|
104 |
+
let remaining = m;
|
105 |
+
while (x <= this.ECCstate.n && remaining) {
|
106 |
+
let y = this.g_sqrt(this, x) ^ x;
|
107 |
+
for (let i2 = 0; i2 < 2; i2++) {
|
108 |
+
const r = this.g_log(this, y);
|
109 |
+
if (y && r < m && !precomp[r]) {
|
110 |
+
this.ECCstate.elp_pre[r] = x;
|
111 |
+
precomp[r] = 1;
|
112 |
+
remaining -= 1;
|
113 |
+
break;
|
114 |
+
}
|
115 |
+
y ^= aexp;
|
116 |
+
}
|
117 |
+
x += 1;
|
118 |
+
}
|
119 |
+
}
|
120 |
+
/**
|
121 |
+
* Encodes the data and generates ECC bytes.
|
122 |
+
* @param {number[]} data - The input data array.
|
123 |
+
* @returns {Uint8Array} - The generated ECC bytes.
|
124 |
+
*/
|
125 |
+
encode(data) {
|
126 |
+
let bigIntData = this.convertAllBitsToBigInts(data, 8);
|
127 |
+
const datalen = bigIntData.length;
|
128 |
+
const l = this.ceilop(this.ECCstate.m * this.ECCstate.t, 32) - 1;
|
129 |
+
let ecc = new Array(this.getEccBytes()).fill(0);
|
130 |
+
const ecc_max_words = this.ceilop(31 * 64, 32);
|
131 |
+
const r = new Array(ecc_max_words).fill(BigInt(0));
|
132 |
+
const tab0idx = 0;
|
133 |
+
const tab1idx = tab0idx + 256 * (l + 1);
|
134 |
+
const tab2idx = tab1idx + 256 * (l + 1);
|
135 |
+
const tab3idx = tab2idx + 256 * (l + 1);
|
136 |
+
let mlen = Math.floor(datalen / 4);
|
137 |
+
let offset = 0;
|
138 |
+
while (mlen > 0) {
|
139 |
+
let w = this.convertBytesToBigInt(bigIntData.slice(offset, offset + 4));
|
140 |
+
w ^= r[0];
|
141 |
+
const p0 = tab0idx + (l + 1) * Number(w >> BigInt(0) & BigInt(255));
|
142 |
+
const p1 = tab1idx + (l + 1) * Number(w >> BigInt(8) & BigInt(255));
|
143 |
+
const p2 = tab2idx + (l + 1) * Number(w >> BigInt(16) & BigInt(255));
|
144 |
+
const p3 = tab3idx + (l + 1) * Number(w >> BigInt(24) & BigInt(255));
|
145 |
+
for (let i = 0; i < l; i++) {
|
146 |
+
r[i] = r[i + 1] ^ this.ECCstate.cyclic_tab[Number(p0) + i] ^ this.ECCstate.cyclic_tab[Number(p1) + i] ^ this.ECCstate.cyclic_tab[Number(p2) + i] ^ this.ECCstate.cyclic_tab[Number(p3) + i];
|
147 |
+
}
|
148 |
+
r[l] = this.ECCstate.cyclic_tab[Number(p0) + l] ^ this.ECCstate.cyclic_tab[Number(p1) + l] ^ this.ECCstate.cyclic_tab[Number(p2) + l] ^ this.ECCstate.cyclic_tab[Number(p3) + l];
|
149 |
+
mlen--;
|
150 |
+
offset += 4;
|
151 |
+
}
|
152 |
+
bigIntData = bigIntData.slice(offset);
|
153 |
+
let leftdata = bigIntData.length;
|
154 |
+
ecc = r;
|
155 |
+
let posn = 0;
|
156 |
+
while (leftdata) {
|
157 |
+
const tmp = bigIntData[posn];
|
158 |
+
posn++;
|
159 |
+
let pidx = (l + 1) * Number(ecc[0] >> BigInt(24) ^ tmp & BigInt(255));
|
160 |
+
for (let i = 0; i < l; i++) {
|
161 |
+
ecc[i] = (ecc[i] << BigInt(8) & BigInt(4294967295) | ecc[i + 1] >> BigInt(24)) ^ this.ECCstate.cyclic_tab[Number(pidx)];
|
162 |
+
pidx++;
|
163 |
+
}
|
164 |
+
ecc[l] = ecc[l] << BigInt(8) & BigInt(4294967295) ^ this.ECCstate.cyclic_tab[Number(pidx)];
|
165 |
+
leftdata--;
|
166 |
+
}
|
167 |
+
this.ECCstate.ecc_buf = ecc;
|
168 |
+
let eccout = [];
|
169 |
+
for (const e of r) {
|
170 |
+
eccout.push(Number(e >> BigInt(24)) & 255);
|
171 |
+
eccout.push(Number(e >> BigInt(16)) & 255);
|
172 |
+
eccout.push(Number(e >> BigInt(8)) & 255);
|
173 |
+
eccout.push(Number(e >> BigInt(0)) & 255);
|
174 |
+
}
|
175 |
+
eccout = eccout.slice(0, this.getEccBytes());
|
176 |
+
const eccbytes = new Uint8Array(eccout);
|
177 |
+
return eccbytes;
|
178 |
+
}
|
179 |
+
/**
|
180 |
+
* Decodes the data and corrects errors using ECC.
|
181 |
+
* @param {number[]} data - The input data array.
|
182 |
+
* @param {Uint8Array} recvecc - The received ECC data.
|
183 |
+
* @returns {any} - The corrected data and status.
|
184 |
+
*/
|
185 |
+
decode(data, recvecc) {
|
186 |
+
this.encode(data);
|
187 |
+
const eccbuf = this.convertAllBitsToBigInts(Array.from(recvecc), 32);
|
188 |
+
const eccwords = this.ceilop(this.ECCstate.m * this.ECCstate.t, 32);
|
189 |
+
let sum = BigInt(0);
|
190 |
+
for (let i = 0; i < eccwords; i++) {
|
191 |
+
this.ECCstate.ecc_buf[i] = this.ECCstate.ecc_buf[i] ^ eccbuf[i];
|
192 |
+
sum = sum | this.ECCstate.ecc_buf[i];
|
193 |
+
}
|
194 |
+
const dataout = this.convertAllBitsToBigInts(data, 8);
|
195 |
+
if (sum === BigInt(0)) {
|
196 |
+
return {
|
197 |
+
bitflips: 0,
|
198 |
+
valid: true,
|
199 |
+
binary: this.toBinString(dataout, data.length),
|
200 |
+
hex: this.toHexString(dataout, data.length),
|
201 |
+
ascii: this.toAsciiString(dataout)
|
202 |
+
};
|
203 |
+
}
|
204 |
+
let s = this.ECCstate.ecc_bits;
|
205 |
+
let t = this.ECCstate.t;
|
206 |
+
const syn = new Array(2 * t).fill(0);
|
207 |
+
const m = s & 31;
|
208 |
+
const synbuf = this.ECCstate.ecc_buf;
|
209 |
+
if (m) {
|
210 |
+
synbuf[Math.floor(s / 32)] = synbuf[Math.floor(s / 32)] & ~BigInt(Math.pow(2, Number(32 - m)) - 1);
|
211 |
+
}
|
212 |
+
let synptr = 0;
|
213 |
+
while (s > 0 || synptr === 0) {
|
214 |
+
let poly = synbuf[synptr];
|
215 |
+
synptr += 1;
|
216 |
+
s -= 32;
|
217 |
+
while (poly) {
|
218 |
+
const i = this.degBigInt(poly);
|
219 |
+
for (let j = 0; j < 2 * t; j += 2) {
|
220 |
+
syn[j] = syn[j] ^ this.g_pow(this, (j + 1) * (i + s));
|
221 |
+
}
|
222 |
+
poly = poly ^ BigInt(Math.pow(2, i));
|
223 |
+
}
|
224 |
+
}
|
225 |
+
for (let i = 0; i < t; i++) {
|
226 |
+
syn[2 * i + 1] = this.g_sqrt(this, syn[i]);
|
227 |
+
}
|
228 |
+
const n = this.ECCstate.n;
|
229 |
+
t = this.ECCstate.t;
|
230 |
+
let pp = -1;
|
231 |
+
let pd = 1;
|
232 |
+
let pelp = { deg: 0, c: new Array(2 * t).fill(0) };
|
233 |
+
pelp.c[0] = 1;
|
234 |
+
const elp = { deg: 0, c: new Array(2 * t).fill(0) };
|
235 |
+
elp.c[0] = 1;
|
236 |
+
let d = syn[0];
|
237 |
+
let elp_copy;
|
238 |
+
for (let i = 0; i < t; i++) {
|
239 |
+
if (elp.deg > t) {
|
240 |
+
break;
|
241 |
+
}
|
242 |
+
if (d) {
|
243 |
+
const k = 2 * i - pp;
|
244 |
+
elp_copy = JSON.parse(JSON.stringify(elp));
|
245 |
+
let tmp = this.g_log(this, d) + n - this.g_log(this, pd);
|
246 |
+
for (let j = 0; j <= pelp.deg; j++) {
|
247 |
+
if (pelp.c[j] !== BigInt(0)) {
|
248 |
+
const l = this.g_log(this, pelp.c[j]);
|
249 |
+
elp.c[j + k] = elp.c[j + k] ^ this.g_pow(this, tmp + l);
|
250 |
+
}
|
251 |
+
}
|
252 |
+
tmp = pelp.deg + k;
|
253 |
+
if (tmp > elp.deg) {
|
254 |
+
elp.deg = tmp;
|
255 |
+
pelp = JSON.parse(JSON.stringify(elp_copy));
|
256 |
+
pd = d;
|
257 |
+
pp = 2 * i;
|
258 |
+
}
|
259 |
+
}
|
260 |
+
if (i < t - 1) {
|
261 |
+
d = syn[2 * i + 2];
|
262 |
+
for (let j = 1; j <= elp.deg; j++) {
|
263 |
+
d = d ^ this.g_mul(this, elp.c[j], syn[2 * i + 2 - j]);
|
264 |
+
}
|
265 |
+
}
|
266 |
+
}
|
267 |
+
this.ECCstate.elp = elp;
|
268 |
+
const nroots = this.getRoots(this, dataout.length, this.ECCstate.elp);
|
269 |
+
const datalen = dataout.length;
|
270 |
+
const nbits = datalen * 8 + this.ECCstate.ecc_bits;
|
271 |
+
if (nroots === -1) {
|
272 |
+
return { valid: false };
|
273 |
+
}
|
274 |
+
for (let i = 0; i < nroots; i++) {
|
275 |
+
if (this.ECCstate.errloc[i] >= nbits) {
|
276 |
+
return -1;
|
277 |
+
}
|
278 |
+
this.ECCstate.errloc[i] = nbits - 1 - this.ECCstate.errloc[i];
|
279 |
+
this.ECCstate.errloc[i] = this.ECCstate.errloc[i] & ~7 | 7 - (this.ECCstate.errloc[i] & 7);
|
280 |
+
}
|
281 |
+
for (const bitflip of this.ECCstate.errloc) {
|
282 |
+
const byte = Math.floor(bitflip / 8);
|
283 |
+
const bit = Math.pow(2, bitflip & 7);
|
284 |
+
if (bitflip < (dataout.length + recvecc.length) * 8) {
|
285 |
+
if (byte < dataout.length) {
|
286 |
+
dataout[byte] = dataout[byte] ^ BigInt(bit);
|
287 |
+
} else {
|
288 |
+
recvecc[byte - dataout.length] = recvecc[byte - dataout.length] ^ bit;
|
289 |
+
}
|
290 |
+
}
|
291 |
+
}
|
292 |
+
return {
|
293 |
+
bitflips: nroots,
|
294 |
+
valid: true,
|
295 |
+
binary: this.toBinString(dataout, data.length),
|
296 |
+
hex: this.toHexString(dataout, data.length),
|
297 |
+
ascii: this.toAsciiString(dataout)
|
298 |
+
};
|
299 |
+
}
|
300 |
+
/**
|
301 |
+
* Finds the roots of a polynomial.
|
302 |
+
* @param {any} instance - The instance of the ECC state.
|
303 |
+
* @param {number} k - The degree of the polynomial.
|
304 |
+
* @param {any} poly - The polynomial.
|
305 |
+
* @returns {number} - The number of roots found.
|
306 |
+
*/
|
307 |
+
getRoots(instance, k, poly) {
|
308 |
+
const roots = [];
|
309 |
+
if (poly.deg > 2) {
|
310 |
+
k = k * 8 + instance.ECCstate.ecc_bits;
|
311 |
+
const rep = new Array(instance.ECCstate.t * 2).fill(0);
|
312 |
+
const d = poly.deg;
|
313 |
+
const l = instance.ECCstate.n - this.g_log(instance, poly.c[poly.deg]);
|
314 |
+
for (let i = 0; i < d; i++) {
|
315 |
+
if (poly.c[i]) {
|
316 |
+
rep[i] = this.mod(instance, this.g_log(instance, poly.c[i]) + l);
|
317 |
+
} else {
|
318 |
+
rep[i] = -1;
|
319 |
+
}
|
320 |
+
}
|
321 |
+
rep[poly.deg] = 0;
|
322 |
+
const syn0 = this.g_div(instance, poly.c[0], poly.c[poly.deg]);
|
323 |
+
for (let i = instance.ECCstate.n - k + 1; i < instance.ECCstate.n + 1; i++) {
|
324 |
+
let syn = syn0;
|
325 |
+
for (let j = 1; j < poly.deg + 1; j++) {
|
326 |
+
const m = rep[j];
|
327 |
+
if (m >= 0) {
|
328 |
+
syn = syn ^ this.g_pow(instance, m + j * i);
|
329 |
+
}
|
330 |
+
}
|
331 |
+
if (syn === 0) {
|
332 |
+
roots.push(instance.ECCstate.n - i);
|
333 |
+
if (roots.length === poly.deg) {
|
334 |
+
break;
|
335 |
+
}
|
336 |
+
}
|
337 |
+
}
|
338 |
+
if (roots.length < poly.deg) {
|
339 |
+
instance.ECCstate.errloc = [];
|
340 |
+
return -1;
|
341 |
+
}
|
342 |
+
}
|
343 |
+
if (poly.deg === 1) {
|
344 |
+
if (poly.c[0]) {
|
345 |
+
roots.push(
|
346 |
+
this.mod(
|
347 |
+
instance,
|
348 |
+
instance.ECCstate.n - instance.ECCstate.logarithms[poly.c[0]] + instance.ECCstate.logarithms[poly.c[1]]
|
349 |
+
)
|
350 |
+
);
|
351 |
+
}
|
352 |
+
}
|
353 |
+
if (poly.deg === 2) {
|
354 |
+
if (poly.c[0] && poly.c[1]) {
|
355 |
+
const l0 = instance.ECCstate.logarithms[poly.c[0]];
|
356 |
+
const l1 = instance.ECCstate.logarithms[poly.c[1]];
|
357 |
+
const l2 = instance.ECCstate.logarithms[poly.c[2]];
|
358 |
+
const u = this.g_pow(instance, l0 + l2 + 2 * (instance.ECCstate.n - l1));
|
359 |
+
let r = 0;
|
360 |
+
let v = u;
|
361 |
+
while (v) {
|
362 |
+
const i = this.deg(v);
|
363 |
+
r = r ^ instance.ECCstate.elp_pre[i];
|
364 |
+
v = v ^ Math.pow(2, i);
|
365 |
+
}
|
366 |
+
if (this.g_sqrt(instance, r) ^ Number(r === u)) {
|
367 |
+
roots.push(this.modn(instance, 2 * instance.ECCstate.n - l1 - instance.ECCstate.logarithms[r] + l2));
|
368 |
+
roots.push(this.modn(instance, 2 * instance.ECCstate.n - l1 - instance.ECCstate.logarithms[r ^ 1] + l2));
|
369 |
+
}
|
370 |
+
}
|
371 |
+
}
|
372 |
+
instance.ECCstate.errloc = roots;
|
373 |
+
return roots.length;
|
374 |
+
}
|
375 |
+
/**
|
376 |
+
* Gets the number of ECC bits.
|
377 |
+
* @returns {number} - The number of ECC bits.
|
378 |
+
*/
|
379 |
+
getEccBits() {
|
380 |
+
return this.ECCstate.ecc_bits;
|
381 |
+
}
|
382 |
+
/**
|
383 |
+
* Gets the number of ECC bytes.
|
384 |
+
* @returns {number} - The number of ECC bytes.
|
385 |
+
*/
|
386 |
+
getEccBytes() {
|
387 |
+
return Math.ceil(this.ECCstate.m * this.ECCstate.t / 8);
|
388 |
+
}
|
389 |
+
/**
|
390 |
+
* Builds a cyclic table for error correction.
|
391 |
+
* @param {bigint[]} g - The generator polynomial.
|
392 |
+
*/
|
393 |
+
buildCyclic(g) {
|
394 |
+
const l = Math.ceil(this.ECCstate.m * this.ECCstate.t / 32);
|
395 |
+
const plen = Math.ceil((this.ECCstate.ecc_bits + 1) / 32);
|
396 |
+
const ecclen = Math.ceil(this.ECCstate.ecc_bits / 32);
|
397 |
+
this.ECCstate.cyclic_tab = new Array(4 * 256 * l).fill(BigInt(0));
|
398 |
+
for (let i = 0; i < 256; i++) {
|
399 |
+
for (let b = 0; b < 4; b++) {
|
400 |
+
const offset = (b * 256 + i) * l;
|
401 |
+
let data = BigInt(i) << BigInt(8 * b);
|
402 |
+
while (data) {
|
403 |
+
const d = this.degBigInt(data);
|
404 |
+
data ^= g[0] >> BigInt(31 - d);
|
405 |
+
for (let j = 0; j < ecclen; j++) {
|
406 |
+
let hi, lo;
|
407 |
+
if (d < 31) {
|
408 |
+
hi = BigInt(g[j] << BigInt(d + 1)) & BigInt(4294967295);
|
409 |
+
} else {
|
410 |
+
hi = BigInt(0);
|
411 |
+
}
|
412 |
+
if (j + 1 < plen) {
|
413 |
+
lo = g[j + 1] >> BigInt(31 - d);
|
414 |
+
} else {
|
415 |
+
lo = BigInt(0);
|
416 |
+
}
|
417 |
+
if (this.ECCstate.cyclic_tab[j + offset] === BigInt(0)) {
|
418 |
+
this.ECCstate.cyclic_tab[j + offset] = BigInt(0);
|
419 |
+
}
|
420 |
+
this.ECCstate.cyclic_tab[j + offset] ^= hi | lo;
|
421 |
+
}
|
422 |
+
}
|
423 |
+
}
|
424 |
+
}
|
425 |
+
}
|
426 |
+
/** GALOIS OPERATIONS */
|
427 |
+
/**
|
428 |
+
* Computes the power of a value in a Galois field.
|
429 |
+
* @param instance - The current context containing Galois field parameters.
|
430 |
+
* @param i - The exponent value.
|
431 |
+
* @returns The result of raising a value to the power i in the Galois field.
|
432 |
+
*/
|
433 |
+
g_pow(instance, i) {
|
434 |
+
return instance.ECCstate.exponents[this.modn(instance, i)];
|
435 |
+
}
|
436 |
+
/**
|
437 |
+
* Computes the square root of a value in a Galois field.
|
438 |
+
* @param instance - The current context containing Galois field parameters.
|
439 |
+
* @param a - The value whose square root is to be computed.
|
440 |
+
* @returns The square root of the value in the Galois field.
|
441 |
+
*/
|
442 |
+
g_sqrt(instance, a) {
|
443 |
+
if (a) {
|
444 |
+
return instance.ECCstate.exponents[this.mod(instance, 2 * instance.ECCstate.logarithms[a])];
|
445 |
+
} else {
|
446 |
+
return 0;
|
447 |
+
}
|
448 |
+
}
|
449 |
+
/**
|
450 |
+
* Computes the logarithm of a value in a Galois field.
|
451 |
+
* @param instance - The current context containing Galois field parameters.
|
452 |
+
* @param x - The value whose logarithm is to be computed.
|
453 |
+
* @returns The logarithm of the value in the Galois field.
|
454 |
+
*/
|
455 |
+
g_log(instance, x) {
|
456 |
+
return instance.ECCstate.logarithms[x];
|
457 |
+
}
|
458 |
+
/**
|
459 |
+
* Multiplies two values in a Galois field.
|
460 |
+
* @param instance - The current context containing Galois field parameters.
|
461 |
+
* @param a - The first value to be multiplied.
|
462 |
+
* @param b - The second value to be multiplied.
|
463 |
+
* @returns The product of the two values in the Galois field.
|
464 |
+
*/
|
465 |
+
g_mul(instance, a, b) {
|
466 |
+
if (a > 0 && b > 0) {
|
467 |
+
const res = this.mod(instance, instance.ECCstate.logarithms[a] + instance.ECCstate.logarithms[b]);
|
468 |
+
return instance.ECCstate.exponents[res];
|
469 |
+
} else {
|
470 |
+
return 0;
|
471 |
+
}
|
472 |
+
}
|
473 |
+
/**
|
474 |
+
* Divides two values in a Galois field.
|
475 |
+
* @param instance - The current context containing Galois field parameters.
|
476 |
+
* @param a - The dividend.
|
477 |
+
* @param b - The divisor.
|
478 |
+
* @returns The quotient of the division in the Galois field.
|
479 |
+
*/
|
480 |
+
g_div(instance, a, b) {
|
481 |
+
if (a) {
|
482 |
+
return instance.ECCstate.exponents[this.mod(instance, instance.ECCstate.logarithms[a] + instance.ECCstate.n - instance.ECCstate.logarithms[b])];
|
483 |
+
} else {
|
484 |
+
return 0;
|
485 |
+
}
|
486 |
+
}
|
487 |
+
/**
|
488 |
+
* Reduces a value modulo the Galois field size.
|
489 |
+
* @param instance - The current context containing Galois field parameters.
|
490 |
+
* @param v - The value to be reduced.
|
491 |
+
* @returns The value reduced modulo the Galois field size.
|
492 |
+
*/
|
493 |
+
mod(instance, v) {
|
494 |
+
if (v < instance.ECCstate.n) {
|
495 |
+
return v;
|
496 |
+
} else {
|
497 |
+
return v - instance.ECCstate.n;
|
498 |
+
}
|
499 |
+
}
|
500 |
+
/**
|
501 |
+
* Reduces a value modulo the Galois field size.
|
502 |
+
* @param instance - The current context containing Galois field parameters.
|
503 |
+
* @param v - The value to be reduced.
|
504 |
+
* @returns The value reduced modulo the Galois field size.
|
505 |
+
*/
|
506 |
+
modn(instance, v) {
|
507 |
+
const n = instance.ECCstate.n;
|
508 |
+
while (v >= n) {
|
509 |
+
v -= n;
|
510 |
+
v = (v & n) + (v >> instance.ECCstate.m);
|
511 |
+
}
|
512 |
+
return v;
|
513 |
+
}
|
514 |
+
/**
|
515 |
+
* Computes the degree of a polynomial represented as an integer.
|
516 |
+
* @param x - The polynomial represented as an integer.
|
517 |
+
* @returns The degree of the polynomial.
|
518 |
+
*/
|
519 |
+
deg(x) {
|
520 |
+
let count = 0;
|
521 |
+
while (x >> 1) {
|
522 |
+
x = x >> 1;
|
523 |
+
count += 1;
|
524 |
+
}
|
525 |
+
return count;
|
526 |
+
}
|
527 |
+
/**
|
528 |
+
* Computes the ceiling of the division of two integers.
|
529 |
+
* @param a - The dividend.
|
530 |
+
* @param b - The divisor.
|
531 |
+
* @returns The ceiling of the division of a by b.
|
532 |
+
*/
|
533 |
+
ceilop(a, b) {
|
534 |
+
return Math.floor((a + b - 1) / b);
|
535 |
+
}
|
536 |
+
/**
|
537 |
+
* Computes the degree of a polynomial represented as a BigInt.
|
538 |
+
* @param x - The polynomial represented as a BigInt.
|
539 |
+
* @returns The degree of the polynomial.
|
540 |
+
*/
|
541 |
+
degBigInt(x) {
|
542 |
+
let count = 0;
|
543 |
+
while (x >> BigInt(1)) {
|
544 |
+
x = x >> BigInt(1);
|
545 |
+
count += 1;
|
546 |
+
}
|
547 |
+
return count;
|
548 |
+
}
|
549 |
+
/**
|
550 |
+
* Converts an array of bits into a single BigInt value.
|
551 |
+
* @param {number[]} bitArray - The array of bits to convert.
|
552 |
+
* @param {number} bitLimit - The maximum number of bits to process.
|
553 |
+
* @returns {BigInt} - The combined value of all bits in the array.
|
554 |
+
*/
|
555 |
+
convertBitsToBigInt(bitArray, bitLimit) {
|
556 |
+
let result = BigInt(0);
|
557 |
+
if (bitLimit < bitArray.length) {
|
558 |
+
bitLimit = bitArray.length;
|
559 |
+
}
|
560 |
+
let pos = bitLimit - 1;
|
561 |
+
for (let b = 0; b < bitLimit; b++) {
|
562 |
+
if (bitArray[b]) {
|
563 |
+
result += BigInt(1) << BigInt(pos);
|
564 |
+
}
|
565 |
+
pos--;
|
566 |
+
}
|
567 |
+
return result;
|
568 |
+
}
|
569 |
+
/**
|
570 |
+
* Processes an array of bits in chunks, converting each chunk into a BigInt.
|
571 |
+
* @param {number[]} bitArray - The array of bits to process.
|
572 |
+
* @param {number} chunkSize - The size of each chunk of bits to process.
|
573 |
+
* @returns {BigInt[]} - An array of BigInt values representing chunks of the original bit array.
|
574 |
+
*/
|
575 |
+
convertAllBitsToBigInts(bitArray, chunkSize) {
|
576 |
+
const dataLength = bitArray.length;
|
577 |
+
let numChunks = Math.floor(dataLength / chunkSize);
|
578 |
+
const resultArray = [];
|
579 |
+
let offset = 0;
|
580 |
+
while (numChunks > 0) {
|
581 |
+
const chunk = bitArray.slice(offset, offset + chunkSize);
|
582 |
+
const bigInt = this.convertBitsToBigInt(chunk, chunkSize);
|
583 |
+
resultArray.push(bigInt);
|
584 |
+
offset += chunkSize;
|
585 |
+
numChunks--;
|
586 |
+
}
|
587 |
+
const remainingBitsArray = bitArray.slice(offset);
|
588 |
+
if (remainingBitsArray.length > 0) {
|
589 |
+
const bigInt = this.convertBitsToBigInt(remainingBitsArray, chunkSize);
|
590 |
+
resultArray.push(bigInt);
|
591 |
+
}
|
592 |
+
return resultArray;
|
593 |
+
}
|
594 |
+
/**
|
595 |
+
* Converts an array of up to 4 bytes into a single BigInt value.
|
596 |
+
* @param {bigint[]} byteArray - The array of bytes to convert.
|
597 |
+
* @returns {BigInt} - The combined value of the bytes as a BigInt.
|
598 |
+
*/
|
599 |
+
convertBytesToBigInt(byteArray) {
|
600 |
+
let result = BigInt(0);
|
601 |
+
if (byteArray.length > 0) result += byteArray[0] << BigInt(24);
|
602 |
+
if (byteArray.length > 1) result += byteArray[1] << BigInt(16);
|
603 |
+
if (byteArray.length > 2) result += byteArray[2] << BigInt(8);
|
604 |
+
if (byteArray.length > 3) result += byteArray[3];
|
605 |
+
return result;
|
606 |
+
}
|
607 |
+
/**
|
608 |
+
* Generates a binary string from data.
|
609 |
+
* @param {any[]} dataout - The data output array.
|
610 |
+
* @param {number} datalen - The desired length of the binary string.
|
611 |
+
* @returns {string} - The binary string representation of the data.
|
612 |
+
*/
|
613 |
+
toBinString(dataout, datalen) {
|
614 |
+
let out = "";
|
615 |
+
for (const byte of dataout) {
|
616 |
+
out += this.numberToBinaryString(byte, 8);
|
617 |
+
}
|
618 |
+
out = out.slice(0, datalen);
|
619 |
+
return out;
|
620 |
+
}
|
621 |
+
/**
|
622 |
+
* Converts a number to a binary string of a given length.
|
623 |
+
* @param {number} num - The number to convert.
|
624 |
+
* @param {number} length - The desired length of the binary string.
|
625 |
+
* @returns {string} - The binary string representation of the number.
|
626 |
+
*/
|
627 |
+
numberToBinaryString(num, length) {
|
628 |
+
let binaryString = num.toString(2);
|
629 |
+
while (binaryString.length < length) {
|
630 |
+
binaryString = "0" + binaryString;
|
631 |
+
}
|
632 |
+
return binaryString;
|
633 |
+
}
|
634 |
+
/**
|
635 |
+
* Decodes a Uint8Array to a string using 7-bit ASCII encoding.
|
636 |
+
* @param {Uint8Array} data - The input byte array.
|
637 |
+
* @returns {string} - The decoded string.
|
638 |
+
*/
|
639 |
+
toAsciiString(data) {
|
640 |
+
const textBitStr = data.map((byte) => byte.toString(2).padStart(8, "0")).join("");
|
641 |
+
const textInt7 = [];
|
642 |
+
for (let i = 0; i < textBitStr.length; i += 7) {
|
643 |
+
const bitSegment = textBitStr.slice(i, i + 7);
|
644 |
+
textInt7.push(parseInt(bitSegment, 2));
|
645 |
+
}
|
646 |
+
const textBytes = new Uint8Array(textInt7);
|
647 |
+
const decodedText = new TextDecoder("utf-8").decode(textBytes).replace(/\0/g, "");
|
648 |
+
return decodedText;
|
649 |
+
}
|
650 |
+
/**
|
651 |
+
* Converts an array of numbers to a hexadecimal string.
|
652 |
+
* @param {any[]} data - The array of numbers to convert.
|
653 |
+
* @returns {string} - The hexadecimal string representation of the numbers.
|
654 |
+
*/
|
655 |
+
toHexString(data, datalen) {
|
656 |
+
if (data.length > datalen / 8) {
|
657 |
+
data.pop();
|
658 |
+
}
|
659 |
+
return data.map(function(byte) {
|
660 |
+
byte = Number(byte);
|
661 |
+
if (byte > 15) return (byte & 255).toString(16);
|
662 |
+
else return "0" + (byte & 255).toString(16);
|
663 |
+
}).join("");
|
664 |
+
}
|
665 |
+
};
|
666 |
+
|
667 |
+
// src/datalayer.ts
|
668 |
+
var BCH_POLYNOMIAL = 137;
|
669 |
+
var DataLayer = class {
|
670 |
+
payload_len;
|
671 |
+
// Length of the payload in bits
|
672 |
+
encoding_mode;
|
673 |
+
// Encoding mode to be used
|
674 |
+
versionbits;
|
675 |
+
// Number of bits for the schema version
|
676 |
+
bch_encoder;
|
677 |
+
// BCH encoder instance
|
678 |
+
bch_decoders;
|
679 |
+
// Dictionary of BCH decoders for different schemas
|
680 |
+
/**
|
681 |
+
* Initializes the DataLayer with specified parameters.
|
682 |
+
* @param {number} payload_len - The length of the payload in bits.
|
683 |
+
* @param {boolean} verbose - Flag to indicate if messages should be logged.
|
684 |
+
* @param {number} encoding_mode - The encoding mode to be used (default is 0).
|
685 |
+
*/
|
686 |
+
constructor(payload_len, verbose, encoding_mode) {
|
687 |
+
this.bch_encoder = this.buildBCH(encoding_mode);
|
688 |
+
this.encoding_mode = encoding_mode;
|
689 |
+
this.versionbits = 4;
|
690 |
+
this.bch_decoders = {};
|
691 |
+
for (let i = 0; i < 4; i++) {
|
692 |
+
this.bch_decoders[i] = this.buildBCH(i);
|
693 |
+
}
|
694 |
+
this.payload_len = payload_len;
|
695 |
+
}
|
696 |
+
/**
|
697 |
+
* Builds and returns a BCH instance based on the given encoding mode.
|
698 |
+
*
|
699 |
+
* @param encoding_mode The encoding mode.
|
700 |
+
* @returns A BCH instance configured for the specified encoding mode.
|
701 |
+
*/
|
702 |
+
buildBCH(encoding_mode) {
|
703 |
+
switch (encoding_mode) {
|
704 |
+
case 1:
|
705 |
+
return new BCH(5, BCH_POLYNOMIAL);
|
706 |
+
case 2:
|
707 |
+
return new BCH(4, BCH_POLYNOMIAL);
|
708 |
+
case 3:
|
709 |
+
return new BCH(3, BCH_POLYNOMIAL);
|
710 |
+
default:
|
711 |
+
return new BCH(8, BCH_POLYNOMIAL);
|
712 |
+
}
|
713 |
+
}
|
714 |
+
/**
|
715 |
+
* Encodes a text string into a Float32Array with the ECC encoding.
|
716 |
+
* @param {string} text - The input text string.
|
717 |
+
* @returns {Float32Array} - The encoded Float32Array.
|
718 |
+
*/
|
719 |
+
encodeText(text) {
|
720 |
+
const data = this.encodeAscii(text);
|
721 |
+
const packet_d = Array.from(data).map((x) => x.toString(2).padStart(8, "0")).join("");
|
722 |
+
return this.encodePacket(packet_d);
|
723 |
+
}
|
724 |
+
/**
|
725 |
+
* Encodes a binary string into a Float32Array with the ECC encoding.
|
726 |
+
* @param {string} strbin - The input binary string.
|
727 |
+
* @returns {Float32Array} - The encoded Float32Array with the ECC encoding.
|
728 |
+
*/
|
729 |
+
encodeBinary(strbin) {
|
730 |
+
return this.encodePacket(String(strbin));
|
731 |
+
}
|
732 |
+
/**
|
733 |
+
* Processes and encodes the packet data.
|
734 |
+
* @param {string} packet_d - The binary string representation of the packet data.
|
735 |
+
* @returns {Float32Array} - The encoded Float32Array.
|
736 |
+
*/
|
737 |
+
encodePacket(packet_d) {
|
738 |
+
const data_bitcount = this.payload_len - this.bch_encoder.getEccBits() - this.versionbits;
|
739 |
+
const ecc_bitcount = this.bch_encoder.getEccBits();
|
740 |
+
packet_d = packet_d.substring(0, data_bitcount);
|
741 |
+
packet_d = packet_d.padEnd(data_bitcount, "0");
|
742 |
+
const pad_d = packet_d.length % 8 === 0 ? 0 : 8 - packet_d.length % 8;
|
743 |
+
const paddedpacket_d = packet_d + "0".repeat(pad_d);
|
744 |
+
const padded_data = Array.from(paddedpacket_d.split("").map(Number));
|
745 |
+
const ecc = this.bch_encoder.encode(padded_data);
|
746 |
+
let packet_e = Array.from(ecc).map((x) => x.toString(2).padStart(8, "0")).join("");
|
747 |
+
packet_e = packet_e.substring(0, ecc_bitcount);
|
748 |
+
const pad_e = packet_e.length % 8 === 0 || this.encoding_mode !== 0 ? 0 : 8 - packet_e.length % 8;
|
749 |
+
packet_e = packet_e.padEnd(packet_e.length + pad_e, "0");
|
750 |
+
const version = this.encoding_mode;
|
751 |
+
const packet_v = version.toString(2).padStart(4, "0");
|
752 |
+
let packet = packet_d + packet_e + packet_v;
|
753 |
+
packet = packet.split("").map((x) => parseInt(x, 10)).join("");
|
754 |
+
if (this.payload_len !== packet.length) {
|
755 |
+
throw new Error("Error! Could not form complete packet");
|
756 |
+
}
|
757 |
+
return new Float32Array(packet.split("").map(Number));
|
758 |
+
}
|
759 |
+
/**
|
760 |
+
* Encodes a string to a Float32Array using 7-bit ASCII encoding.
|
761 |
+
* @param {string} text - The input text string.
|
762 |
+
* @returns {Float32Array} - The encoded Float32Array.
|
763 |
+
*/
|
764 |
+
encodeAscii(text) {
|
765 |
+
const textInt7 = Array.from(text).map((t) => t.charCodeAt(0) & 127);
|
766 |
+
let textBitStr = textInt7.map((t) => t.toString(2).padStart(7, "0")).join("");
|
767 |
+
if (textBitStr.length % 8 !== 0) {
|
768 |
+
textBitStr = textBitStr.padEnd(textBitStr.length + (8 - textBitStr.length % 8), "0");
|
769 |
+
}
|
770 |
+
const byteArray = [];
|
771 |
+
for (let i = 0; i < textBitStr.length; i += 8) {
|
772 |
+
byteArray.push(parseInt(textBitStr.slice(i, i + 8), 2));
|
773 |
+
}
|
774 |
+
return new Float32Array(byteArray);
|
775 |
+
}
|
776 |
+
};
|
777 |
+
function getSchemaCapacity(schema_version) {
|
778 |
+
switch (schema_version) {
|
779 |
+
case 0:
|
780 |
+
return 40;
|
781 |
+
case 1:
|
782 |
+
return 61;
|
783 |
+
case 2:
|
784 |
+
return 68;
|
785 |
+
case 3:
|
786 |
+
return 75;
|
787 |
+
default:
|
788 |
+
throw new Error("Invalid schema version");
|
789 |
+
}
|
790 |
+
}
|
791 |
+
function getSchemaVersion(binary_array) {
|
792 |
+
const last_two_bits = binary_array.slice(-2);
|
793 |
+
const version = last_two_bits[0] * 2 + last_two_bits[1];
|
794 |
+
return version;
|
795 |
+
}
|
796 |
+
|
797 |
+
// src/ONNX_HUB_MANIFEST.json
|
798 |
+
var ONNX_HUB_MANIFEST_default = [
|
799 |
+
{
|
800 |
+
model: "Trustmark variant Q encoder",
|
801 |
+
model_name: "encoder_Q.onnx",
|
802 |
+
model_remote_host: "https://cc-assets.netlify.app",
|
803 |
+
model_path: "/watermarking/trustmark-models/encoder_Q.onnx",
|
804 |
+
onnx_version: "1.9.0",
|
805 |
+
opset_version: 17,
|
806 |
+
metadata: {
|
807 |
+
model_sha: "19b3d1b25836130ffd78775a8f61539f993375d1823ef0e59ba5b8dffb4f892d",
|
808 |
+
model_bytes: 17312208,
|
809 |
+
tags: ["watermarking"],
|
810 |
+
io_ports: {
|
811 |
+
inputs: [
|
812 |
+
{
|
813 |
+
name: " onnx::Concat_0",
|
814 |
+
shape: [1, 3, 256, 256],
|
815 |
+
type: "tensor(float)"
|
816 |
+
},
|
817 |
+
{
|
818 |
+
name: "onnx::Gemm_1",
|
819 |
+
shape: [1, 100],
|
820 |
+
type: "tensor(float)"
|
821 |
+
}
|
822 |
+
],
|
823 |
+
outputs: [
|
824 |
+
{
|
825 |
+
name: "image",
|
826 |
+
shape: [1, 3, 256, 256],
|
827 |
+
type: "tensor(float)"
|
828 |
+
}
|
829 |
+
]
|
830 |
+
}
|
831 |
+
}
|
832 |
+
},
|
833 |
+
{
|
834 |
+
model: "Trustmark variant P encoder",
|
835 |
+
model_name: "encoder_P.onnx",
|
836 |
+
model_remote_host: "https://cc-assets.netlify.app",
|
837 |
+
model_path: "/watermarking/trustmark-models/encoder_P.onnx",
|
838 |
+
onnx_version: "1.9.0",
|
839 |
+
opset_version: 17,
|
840 |
+
metadata: {
|
841 |
+
model_sha: "053441c9c9f05fc158ccba71c610d9d58fcd2c82d1912bf0ffcee988cf2f74c8",
|
842 |
+
model_bytes: 17312208,
|
843 |
+
tags: ["watermarking"],
|
844 |
+
io_ports: {
|
845 |
+
inputs: [
|
846 |
+
{
|
847 |
+
name: " onnx::Concat_0",
|
848 |
+
shape: [1, 3, 256, 256],
|
849 |
+
type: "tensor(float)"
|
850 |
+
},
|
851 |
+
{
|
852 |
+
name: "onnx::Gemm_1",
|
853 |
+
shape: [1, 100],
|
854 |
+
type: "tensor(float)"
|
855 |
+
}
|
856 |
+
],
|
857 |
+
outputs: [
|
858 |
+
{
|
859 |
+
name: "image",
|
860 |
+
shape: [1, 3, 256, 256],
|
861 |
+
type: "tensor(float)"
|
862 |
+
}
|
863 |
+
]
|
864 |
+
}
|
865 |
+
}
|
866 |
+
},
|
867 |
+
{
|
868 |
+
model: "Trustmark variant Q decoder",
|
869 |
+
model_name: "decoder_Q.onnx",
|
870 |
+
model_remote_host: "https://cc-assets.netlify.app",
|
871 |
+
model_path: "/watermarking/trustmark-models/decoder_Q.onnx",
|
872 |
+
onnx_version: "1.9.0",
|
873 |
+
opset_version: 17,
|
874 |
+
metadata: {
|
875 |
+
model_sha: "ee3268f057c9dabef680e169302f5973d0589feea86189ed229a896cc3aa88df",
|
876 |
+
model_bytes: 47401222,
|
877 |
+
tags: ["watermarking"],
|
878 |
+
io_ports: {
|
879 |
+
inputs: [
|
880 |
+
{
|
881 |
+
name: "image",
|
882 |
+
shape: [1, 3, 256, 256],
|
883 |
+
type: "tensor(float)"
|
884 |
+
}
|
885 |
+
],
|
886 |
+
outputs: [
|
887 |
+
{
|
888 |
+
name: "output",
|
889 |
+
shape: [1, 100],
|
890 |
+
type: "tensor(float)"
|
891 |
+
}
|
892 |
+
]
|
893 |
+
}
|
894 |
+
}
|
895 |
+
},
|
896 |
+
{
|
897 |
+
model: "Trustmark variant P decoder",
|
898 |
+
model_name: "decoder_P.onnx",
|
899 |
+
model_remote_host: "https://cc-assets.netlify.app",
|
900 |
+
model_path: "/watermarking/trustmark-models/decoder_P.onnx",
|
901 |
+
onnx_version: "1.9.0",
|
902 |
+
opset_version: 17,
|
903 |
+
metadata: {
|
904 |
+
model_sha: "be6d7c33f8a7b376f179e75f3f7c58ff816a9ac7bb6d37fd0a729a635f624c35",
|
905 |
+
model_bytes: 47400467,
|
906 |
+
tags: ["watermarking"],
|
907 |
+
io_ports: {
|
908 |
+
inputs: [
|
909 |
+
{
|
910 |
+
name: "image",
|
911 |
+
shape: [1, 3, 224, 224],
|
912 |
+
type: "tensor(float)"
|
913 |
+
}
|
914 |
+
],
|
915 |
+
outputs: [
|
916 |
+
{
|
917 |
+
name: "output",
|
918 |
+
shape: [1, 100],
|
919 |
+
type: "tensor(float)"
|
920 |
+
}
|
921 |
+
]
|
922 |
+
}
|
923 |
+
}
|
924 |
+
}
|
925 |
+
];
|
926 |
+
|
927 |
+
// src/trustmark.ts
|
928 |
+
var MODELS_PATH = "models/";
|
929 |
+
var ASPECT_RATIO_LIM = 2;
|
930 |
+
var IS_BROWSER = false;
|
931 |
+
var IS_NODE = false;
|
932 |
+
if (typeof window === "undefined") {
|
933 |
+
IS_NODE = true;
|
934 |
+
} else {
|
935 |
+
IS_BROWSER = true;
|
936 |
+
}
|
937 |
+
var VERBOSE = true;
|
938 |
+
var TrustMark = class _TrustMark {
|
939 |
+
/** * Static encoding mapping for different BCH modes. */
|
940 |
+
static encoding = {
|
941 |
+
undefined: -1,
|
942 |
+
BCH_SUPER: 0,
|
943 |
+
BCH_3: 3,
|
944 |
+
BCH_4: 2,
|
945 |
+
BCH_5: 1
|
946 |
+
};
|
947 |
+
use_ecc;
|
948 |
+
secret_len;
|
949 |
+
ecc;
|
950 |
+
decoder_session;
|
951 |
+
encoder_session;
|
952 |
+
preprocess_224_session;
|
953 |
+
preprocess_256_session;
|
954 |
+
model_type;
|
955 |
+
/**
|
956 |
+
* Constructs a new TrustMark instance.
|
957 |
+
* @param {boolean} [use_ecc=true] - use BCH error correction on the payload, reducing payload size (default)
|
958 |
+
* @param {number} [secret_len=100] - The length of the secret.
|
959 |
+
* @param {number} [encoding_mode=TrustMark.encoding.BCH_4] - The data schema encoding mode to use.
|
960 |
+
*/
|
961 |
+
constructor(use_ecc = true, secret_len = 100, encoding_mode = _TrustMark.encoding.BCH_4) {
|
962 |
+
this.use_ecc = use_ecc;
|
963 |
+
this.secret_len = secret_len;
|
964 |
+
this.ecc = new DataLayer(secret_len, VERBOSE, encoding_mode);
|
965 |
+
}
|
966 |
+
/**
|
967 |
+
* Decodes the watermark of an image from a given URL.
|
968 |
+
*
|
969 |
+
* @param image_url The URL of the image to decode.
|
970 |
+
* @returns A promise that resolves to the decoded watermnark data.
|
971 |
+
*/
|
972 |
+
async decode(image_url) {
|
973 |
+
tf.engine().startScope();
|
974 |
+
const stego_image = await this.loadImage(image_url, "decode");
|
975 |
+
await sleep(0);
|
976 |
+
tf.engine().endScope();
|
977 |
+
const input_feeds = { image: stego_image.onnx };
|
978 |
+
const start_time = /* @__PURE__ */ new Date();
|
979 |
+
const model_output = await this.decoder_session.run(input_feeds);
|
980 |
+
const time_elapsed = (/* @__PURE__ */ new Date()).getTime() - start_time.getTime();
|
981 |
+
tsLog(`Prediction: ${time_elapsed}ms`);
|
982 |
+
await sleep(0);
|
983 |
+
const output_data = model_output.output.cpuData;
|
984 |
+
const binary_array = output_data.map((value) => value >= 0 ? 1 : 0);
|
985 |
+
const schema = getSchemaVersion(binary_array);
|
986 |
+
let data_bits = getSchemaCapacity(schema);
|
987 |
+
let data = binary_array.slice(0, data_bits);
|
988 |
+
let ecc = binary_array.slice(data_bits, 96);
|
989 |
+
let decoded_data = this.ecc.bch_decoders[schema].decode(data, ecc);
|
990 |
+
decoded_data.schema = schema;
|
991 |
+
if (!decoded_data.valid) {
|
992 |
+
for (let alt_schema = 0; alt_schema < 3; alt_schema++) {
|
993 |
+
if (alt_schema === schema) continue;
|
994 |
+
data_bits = getSchemaCapacity(alt_schema);
|
995 |
+
data = binary_array.slice(0, data_bits);
|
996 |
+
ecc = binary_array.slice(data_bits, 96);
|
997 |
+
decoded_data = this.ecc.bch_decoders[alt_schema].decode(data, ecc);
|
998 |
+
decoded_data.schema = alt_schema;
|
999 |
+
if (decoded_data.valid) {
|
1000 |
+
break;
|
1001 |
+
}
|
1002 |
+
}
|
1003 |
+
}
|
1004 |
+
decoded_data.raw = binary_array;
|
1005 |
+
return decoded_data;
|
1006 |
+
}
|
1007 |
+
/**
|
1008 |
+
* Encodes a secret into an image and returns the stego image and the residual image.
|
1009 |
+
*
|
1010 |
+
* @param {string} image_url The cover image data.
|
1011 |
+
* @param {string} string_secret The secret string to encode.
|
1012 |
+
* @param {number} wm_strength The watermark strength. Default is 0.4.
|
1013 |
+
* @param {boolean} maculate Whether to overwrite an existing watermark with random values. Default is false.
|
1014 |
+
* @param {string} output The output format. Default is 'bytes'.
|
1015 |
+
* @returns A promise that resolves with the encoded data or rejects with an error.
|
1016 |
+
*/
|
1017 |
+
async encode(image_url, string_secret, wm_strength = 0.4, maculate = false, output = "bytes") {
|
1018 |
+
tf.engine().startScope();
|
1019 |
+
const cover_image = await this.loadImage(image_url, "encode");
|
1020 |
+
let mode;
|
1021 |
+
let secret = new Float32Array(100);
|
1022 |
+
if (maculate === true) {
|
1023 |
+
mode = "binary";
|
1024 |
+
secret.set(
|
1025 |
+
Float32Array.from({ length: 96 }, () => Math.round(Math.random())),
|
1026 |
+
0
|
1027 |
+
);
|
1028 |
+
secret.set([0, 0, 0, 0], 96);
|
1029 |
+
} else {
|
1030 |
+
const binary_count = string_secret.match(/[01]/g);
|
1031 |
+
if (binary_count && binary_count.length == string_secret.length) {
|
1032 |
+
mode = "binary";
|
1033 |
+
} else {
|
1034 |
+
mode = "text";
|
1035 |
+
}
|
1036 |
+
if (!this.use_ecc) {
|
1037 |
+
if (mode === "binary") {
|
1038 |
+
secret = new Float32Array(Array.from(string_secret).map(Number));
|
1039 |
+
} else {
|
1040 |
+
secret = this.ecc.encodeAscii(string_secret);
|
1041 |
+
secret = new Float32Array(Array.from(secret).map(Number));
|
1042 |
+
}
|
1043 |
+
} else {
|
1044 |
+
if (mode === "binary") {
|
1045 |
+
secret = this.ecc.encodeBinary(string_secret);
|
1046 |
+
} else {
|
1047 |
+
secret = this.ecc.encodeText(string_secret);
|
1048 |
+
}
|
1049 |
+
}
|
1050 |
+
}
|
1051 |
+
cover_image.onnx_secret = new ort.Tensor("float32", secret, [1, 100]);
|
1052 |
+
const input_feeds = { "onnx::Concat_0": cover_image.onnx, "onnx::Gemm_1": cover_image.onnx_secret };
|
1053 |
+
let start_time = /* @__PURE__ */ new Date();
|
1054 |
+
const model_output = await this.encoder_session.run(input_feeds);
|
1055 |
+
let time_elapsed = (/* @__PURE__ */ new Date()).getTime() - start_time.getTime();
|
1056 |
+
tsLog(`Inference: ${time_elapsed}ms`);
|
1057 |
+
await sleep(0);
|
1058 |
+
start_time = /* @__PURE__ */ new Date();
|
1059 |
+
const tf_cover = tf.tensor(cover_image.onnx.cpuData, [1, 3, 256, 256]);
|
1060 |
+
const tf_stego = tf.tensor(model_output.image.cpuData, [1, 3, 256, 256]);
|
1061 |
+
let tf_residual = tf.clipByValue(tf_stego, -1, 1).sub(tf_cover).squeeze().transpose([1, 2, 0]);
|
1062 |
+
tf_cover.dispose();
|
1063 |
+
tf_stego.dispose();
|
1064 |
+
if (IS_NODE && VERBOSE || IS_BROWSER) {
|
1065 |
+
const residual_display = tf_residual.mul(10).clipByValue(0, 1);
|
1066 |
+
if (IS_NODE) {
|
1067 |
+
if (output == "png") {
|
1068 |
+
cover_image.residual = await tf.node.encodePng(residual_display.mul(255));
|
1069 |
+
} else {
|
1070 |
+
cover_image.residual = await tf.browser.toPixels(residual_display);
|
1071 |
+
}
|
1072 |
+
} else {
|
1073 |
+
cover_image.residual = await tf.browser.toPixels(residual_display);
|
1074 |
+
}
|
1075 |
+
residual_display.dispose();
|
1076 |
+
}
|
1077 |
+
tf_residual = tf.image.resizeBilinear(tf_residual, [cover_image.crop_height, cover_image.crop_width]);
|
1078 |
+
time_elapsed = (/* @__PURE__ */ new Date()).getTime() - start_time.getTime();
|
1079 |
+
tsLog(`Residual Interpolation: ${time_elapsed}ms`);
|
1080 |
+
await sleep(0);
|
1081 |
+
start_time = /* @__PURE__ */ new Date();
|
1082 |
+
let tf_merge = tf.clipByValue(tf.add(tf_residual.mul(wm_strength), cover_image.tf_crop), 0, 1);
|
1083 |
+
if (cover_image.aspect_ratio > 2) {
|
1084 |
+
if (cover_image.orientation == "landscape") {
|
1085 |
+
const axe_length = Math.floor((cover_image.width - cover_image.crop_axe) / 2);
|
1086 |
+
const part_a = cover_image.tf_source.slice([0, 0, 0], [cover_image.crop_axe, axe_length, 3]);
|
1087 |
+
const part_b = cover_image.tf_source.slice(
|
1088 |
+
[0, axe_length + cover_image.crop_axe, 0],
|
1089 |
+
[cover_image.crop_axe, cover_image.width - axe_length - cover_image.crop_axe, 3]
|
1090 |
+
);
|
1091 |
+
tf_merge = tf.concat([part_a, tf_merge, part_b], 1);
|
1092 |
+
}
|
1093 |
+
if (cover_image.orientation == "portrait") {
|
1094 |
+
const axe_length = Math.floor((cover_image.height - cover_image.crop_axe) / 2);
|
1095 |
+
const part_a = cover_image.tf_source.slice([0, 0, 0], [axe_length, cover_image.crop_axe, 3]);
|
1096 |
+
const part_b = cover_image.tf_source.slice(
|
1097 |
+
[axe_length + cover_image.crop_axe, 0, 0],
|
1098 |
+
[cover_image.height - axe_length - cover_image.crop_axe, cover_image.crop_axe, 3]
|
1099 |
+
);
|
1100 |
+
tf_merge = tf.concat([part_a, tf_merge, part_b], 0);
|
1101 |
+
}
|
1102 |
+
}
|
1103 |
+
cover_image.tf_crop.dispose();
|
1104 |
+
tf_residual.dispose();
|
1105 |
+
time_elapsed = (/* @__PURE__ */ new Date()).getTime() - start_time.getTime();
|
1106 |
+
tsLog(`Compositing: ${time_elapsed}ms`);
|
1107 |
+
await sleep(0);
|
1108 |
+
start_time = /* @__PURE__ */ new Date();
|
1109 |
+
if (IS_NODE) {
|
1110 |
+
if (output == "png") {
|
1111 |
+
cover_image.stego = await tf.node.encodePng(tf_merge.mul(255));
|
1112 |
+
} else {
|
1113 |
+
cover_image.stego = await tf.browser.toPixels(tf_merge);
|
1114 |
+
}
|
1115 |
+
} else {
|
1116 |
+
cover_image.stego = await tf.browser.toPixels(tf_merge);
|
1117 |
+
}
|
1118 |
+
time_elapsed = (/* @__PURE__ */ new Date()).getTime() - start_time.getTime();
|
1119 |
+
tsLog(`Encoding: ${time_elapsed}ms`);
|
1120 |
+
await sleep(0);
|
1121 |
+
tf.engine().endScope();
|
1122 |
+
return {
|
1123 |
+
stego: cover_image.stego,
|
1124 |
+
residual: cover_image.residual ? cover_image.residual : new Uint8Array(),
|
1125 |
+
height: cover_image.height,
|
1126 |
+
width: cover_image.width
|
1127 |
+
};
|
1128 |
+
}
|
1129 |
+
/**
|
1130 |
+
* Processes an image and returns the processed data.
|
1131 |
+
*
|
1132 |
+
* @param image The input image data.
|
1133 |
+
* @returns A promise that resolves with the processed image data or rejects with an error.
|
1134 |
+
*/
|
1135 |
+
async processImage(image2, process_type) {
|
1136 |
+
const start_time = /* @__PURE__ */ new Date();
|
1137 |
+
image2.width = image2.tf_source.shape[2];
|
1138 |
+
image2.height = image2.tf_source.shape[1];
|
1139 |
+
if (image2.width > image2.height) {
|
1140 |
+
image2.orientation = "landscape";
|
1141 |
+
image2.aspect_ratio = image2.width / image2.height;
|
1142 |
+
} else {
|
1143 |
+
image2.orientation = "portrait";
|
1144 |
+
image2.aspect_ratio = image2.height / image2.width;
|
1145 |
+
}
|
1146 |
+
if (image2.aspect_ratio > ASPECT_RATIO_LIM) {
|
1147 |
+
const size = Math.min(image2.width, image2.height);
|
1148 |
+
const left = (image2.width - size) / 2;
|
1149 |
+
const top = (image2.height - size) / 2;
|
1150 |
+
image2.tf_crop = tf.image.cropAndResize(
|
1151 |
+
image2.tf_source,
|
1152 |
+
[[top / image2.height, left / image2.width, (top + size) / image2.height, (left + size) / image2.width]],
|
1153 |
+
[0],
|
1154 |
+
[size, size],
|
1155 |
+
"nearest"
|
1156 |
+
);
|
1157 |
+
image2.crop_axe = image2.crop_width = image2.crop_height = size;
|
1158 |
+
} else {
|
1159 |
+
image2.tf_crop = image2.tf_source;
|
1160 |
+
image2.crop_width = image2.width;
|
1161 |
+
image2.crop_height = image2.height;
|
1162 |
+
}
|
1163 |
+
image2.tf_source = image2.tf_source.squeeze();
|
1164 |
+
image2.tf_crop = image2.tf_crop.transpose([0, 3, 1, 2]);
|
1165 |
+
const data = image2.tf_crop.dataSync();
|
1166 |
+
const onnxTensor = new ort.Tensor("float32", data, image2.tf_crop.shape);
|
1167 |
+
image2.tf_crop = image2.tf_crop.transpose([0, 2, 3, 1]);
|
1168 |
+
image2.tf_crop = image2.tf_crop.squeeze();
|
1169 |
+
if (this.model_type == "P" && process_type == "decode") {
|
1170 |
+
image2.onnx = (await this.preprocess_224_session.run({ input: onnxTensor })).output;
|
1171 |
+
} else {
|
1172 |
+
image2.onnx = (await this.preprocess_256_session.run({ input: onnxTensor })).output;
|
1173 |
+
}
|
1174 |
+
await sleep(0);
|
1175 |
+
const time_elapsed = (/* @__PURE__ */ new Date()).getTime() - start_time.getTime();
|
1176 |
+
tsLog(`Processing: ${image2.width}x${image2.height}: ${time_elapsed}ms`);
|
1177 |
+
return image2;
|
1178 |
+
}
|
1179 |
+
/**
|
1180 |
+
* Loads an image from a given URL and processes it.
|
1181 |
+
*
|
1182 |
+
* @param image_url The URL of the image to load.
|
1183 |
+
* @returns A promise that resolves with the processed image data or rejects with an error.
|
1184 |
+
*/
|
1185 |
+
async loadImage(image_url, process_type) {
|
1186 |
+
return new Promise(async (resolve) => {
|
1187 |
+
const start_time = /* @__PURE__ */ new Date();
|
1188 |
+
const image2 = { url: image_url };
|
1189 |
+
if (IS_NODE) {
|
1190 |
+
const image_buffer = readFileSync(image2.url);
|
1191 |
+
image2.tf_source = tf.node.decodeImage(image_buffer).expandDims(0).div(255);
|
1192 |
+
} else {
|
1193 |
+
const img = new Image();
|
1194 |
+
img.onload = async () => {
|
1195 |
+
image2.tf_source = tf.browser.fromPixels(img).expandDims(0).div(255);
|
1196 |
+
const time_elapsed = (/* @__PURE__ */ new Date()).getTime() - start_time.getTime();
|
1197 |
+
tsLog(`Loading: ${time_elapsed}ms`);
|
1198 |
+
resolve(await this.processImage(image2, process_type));
|
1199 |
+
};
|
1200 |
+
img.src = image2.url;
|
1201 |
+
}
|
1202 |
+
if (IS_NODE) {
|
1203 |
+
const time_elapsed = (/* @__PURE__ */ new Date()).getTime() - start_time.getTime();
|
1204 |
+
tsLog(`Loading: ${time_elapsed}ms`);
|
1205 |
+
resolve(await this.processImage(image2, process_type));
|
1206 |
+
}
|
1207 |
+
});
|
1208 |
+
}
|
1209 |
+
/**
|
1210 |
+
* Loads the ONNX models for preprocessing, encoding, and decoding.
|
1211 |
+
*/
|
1212 |
+
async loadModels(type = "Q") {
|
1213 |
+
const models = await getModels();
|
1214 |
+
let decoder_model_url;
|
1215 |
+
let encoder_model_url;
|
1216 |
+
this.model_type = type;
|
1217 |
+
if (type == "Q") {
|
1218 |
+
decoder_model_url = models["decoder_Q.onnx"];
|
1219 |
+
encoder_model_url = models["encoder_Q.onnx"];
|
1220 |
+
}
|
1221 |
+
if (type == "P") {
|
1222 |
+
decoder_model_url = models["decoder_P.onnx"];
|
1223 |
+
encoder_model_url = models["encoder_P.onnx"];
|
1224 |
+
this.preprocess_224_session = await ort.InferenceSession.create("models/preprocess_224.onnx").catch((error) => {
|
1225 |
+
throw new Error(`Error loading preprocessing ONNX model: ${error}`);
|
1226 |
+
});
|
1227 |
+
}
|
1228 |
+
const session_option = { executionProviders: ["cpu"] };
|
1229 |
+
this.preprocess_256_session = await ort.InferenceSession.create("models/preprocess_256.onnx").catch((error) => {
|
1230 |
+
throw new Error(`Error loading preprocessing ONNX model: ${error}`);
|
1231 |
+
});
|
1232 |
+
this.decoder_session = await ort.InferenceSession.create(decoder_model_url, session_option).catch((error) => {
|
1233 |
+
throw new Error(`Error loading decoder ONNX model: ${error}`);
|
1234 |
+
});
|
1235 |
+
this.encoder_session = await ort.InferenceSession.create(encoder_model_url, session_option).catch((error) => {
|
1236 |
+
throw new Error(`Error loading encoder ONNX model: ${error}`);
|
1237 |
+
});
|
1238 |
+
}
|
1239 |
+
};
|
1240 |
+
async function getModels() {
|
1241 |
+
return new Promise(async (resolve, reject) => {
|
1242 |
+
const fetchs = [];
|
1243 |
+
const models = {};
|
1244 |
+
for (const model of ONNX_HUB_MANIFEST_default) {
|
1245 |
+
const model_url = model.model_remote_host + model.model_path;
|
1246 |
+
const model_path = MODELS_PATH + model.model_name;
|
1247 |
+
const model_bytes = model.metadata.model_bytes;
|
1248 |
+
if (IS_NODE) {
|
1249 |
+
if (existsSync(model_path)) {
|
1250 |
+
models[model.model_name] = model_path;
|
1251 |
+
} else {
|
1252 |
+
tsLog(`'${model_path}' needs to be fetched and cached from remote repository.`);
|
1253 |
+
fetchs.push(fetchModel(model_url, model_path, model.model_name, model.metadata.model_sha, model_bytes));
|
1254 |
+
}
|
1255 |
+
} else {
|
1256 |
+
await restoreFileFromCache(model.model_name).then((file) => {
|
1257 |
+
models[model.model_name] = file;
|
1258 |
+
}).catch((e) => {
|
1259 |
+
tsLog(model.model_name + " needs to be fetched and cached from remote repository.");
|
1260 |
+
fetchs.push(fetchModel(model_url, model_path, model.model_name, model.metadata.model_sha, model_bytes));
|
1261 |
+
});
|
1262 |
+
}
|
1263 |
+
}
|
1264 |
+
await Promise.all(fetchs).then((fmodels) => {
|
1265 |
+
fmodels.forEach(function(fmodel) {
|
1266 |
+
models[fmodel.model_name] = fmodel.path;
|
1267 |
+
});
|
1268 |
+
}).catch((err) => reject(err));
|
1269 |
+
resolve(models);
|
1270 |
+
});
|
1271 |
+
}
|
1272 |
+
async function fetchModel(url, file_path, model_name, checksum, model_bytes) {
|
1273 |
+
return new Promise(async (resolve, reject) => {
|
1274 |
+
fetch(url).then((response) => {
|
1275 |
+
return response.body;
|
1276 |
+
}).then((body) => {
|
1277 |
+
const reader = body.getReader();
|
1278 |
+
let charsReceived = 0;
|
1279 |
+
return new ReadableStream({
|
1280 |
+
async start(controller) {
|
1281 |
+
return pump();
|
1282 |
+
function pump() {
|
1283 |
+
return reader.read().then(({ done, value }) => {
|
1284 |
+
if (done) {
|
1285 |
+
controller.close();
|
1286 |
+
return;
|
1287 |
+
}
|
1288 |
+
charsReceived += value.length;
|
1289 |
+
const progress_percentage = Math.floor(charsReceived / model_bytes * 100);
|
1290 |
+
if (IS_NODE) {
|
1291 |
+
process.stdout.clearLine(0);
|
1292 |
+
process.stdout.cursorTo(0);
|
1293 |
+
process.stdout.write(`Progress: ${drawProgressBar(progress_percentage)} of ${model_name}`);
|
1294 |
+
} else {
|
1295 |
+
tsLog(`Loading model: ${progress_percentage}% of ${file_path}`, true);
|
1296 |
+
}
|
1297 |
+
controller.enqueue(value);
|
1298 |
+
return pump();
|
1299 |
+
});
|
1300 |
+
}
|
1301 |
+
}
|
1302 |
+
});
|
1303 |
+
}).then((stream) => new Response(stream)).then((response) => response.arrayBuffer()).then(async (a_buffer) => {
|
1304 |
+
const file_chacksum = await sha(new Uint8Array(a_buffer));
|
1305 |
+
if (file_chacksum == checksum) {
|
1306 |
+
const model = {
|
1307 |
+
model_name,
|
1308 |
+
path: a_buffer
|
1309 |
+
};
|
1310 |
+
if (IS_NODE) {
|
1311 |
+
writeFile(file_path, new Uint8Array(a_buffer), (err) => {
|
1312 |
+
if (err) {
|
1313 |
+
reject(err);
|
1314 |
+
} else {
|
1315 |
+
resolve(model);
|
1316 |
+
}
|
1317 |
+
});
|
1318 |
+
} else {
|
1319 |
+
await storeFileInCache(model_name, new Blob([a_buffer], { type: "application/octet-stream" }));
|
1320 |
+
resolve(model);
|
1321 |
+
}
|
1322 |
+
}
|
1323 |
+
}).catch((err) => reject(err));
|
1324 |
+
});
|
1325 |
+
}
|
1326 |
+
async function restoreFileFromCache(model_name) {
|
1327 |
+
const modelCache = await caches.open("models");
|
1328 |
+
const response = await modelCache.match(model_name);
|
1329 |
+
if (!response) {
|
1330 |
+
throw new Error(`${model_name} not found in cache.`);
|
1331 |
+
}
|
1332 |
+
const file = await response.arrayBuffer();
|
1333 |
+
tsLog(`${model_name} found in cache.`);
|
1334 |
+
return file;
|
1335 |
+
}
|
1336 |
+
async function storeFileInCache(model_name, blob) {
|
1337 |
+
try {
|
1338 |
+
const modelCache = await caches.open("models");
|
1339 |
+
await modelCache.put(model_name, new Response(blob));
|
1340 |
+
tsLog(`${model_name} cached`);
|
1341 |
+
} catch (err) {
|
1342 |
+
throw new Error(err);
|
1343 |
+
}
|
1344 |
+
}
|
1345 |
+
function drawProgressBar(progress) {
|
1346 |
+
const barWidth = 30;
|
1347 |
+
const filledWidth = Math.floor(progress / 100 * barWidth);
|
1348 |
+
const emptyWidth = barWidth - filledWidth;
|
1349 |
+
const progressBar = "\u2588".repeat(filledWidth) + "\u2592".repeat(emptyWidth);
|
1350 |
+
return `[${progressBar}] ${progress}%`;
|
1351 |
+
}
|
1352 |
+
function sha(content) {
|
1353 |
+
if (IS_NODE) {
|
1354 |
+
return createHash("sha256").update(content).digest("hex");
|
1355 |
+
} else {
|
1356 |
+
return hash(content);
|
1357 |
+
}
|
1358 |
+
}
|
1359 |
+
function sleep(m) {
|
1360 |
+
if (IS_BROWSER) {
|
1361 |
+
return new Promise((resolve) => setTimeout(resolve, m));
|
1362 |
+
}
|
1363 |
+
}
|
1364 |
+
function tsLog(str, browser_only = false) {
|
1365 |
+
if (IS_BROWSER) {
|
1366 |
+
const payloadevt = new CustomEvent("status", { detail: str });
|
1367 |
+
window.dispatchEvent(payloadevt);
|
1368 |
+
}
|
1369 |
+
if (IS_NODE && browser_only === false && VERBOSE) {
|
1370 |
+
console.log(str);
|
1371 |
+
}
|
1372 |
+
}
|
1373 |
+
async function hash(content) {
|
1374 |
+
const hashBuffer = await crypto.subtle.digest("SHA-256", content);
|
1375 |
+
const hashArray = Array.from(new Uint8Array(hashBuffer));
|
1376 |
+
const hashHex = hashArray.map((bytes) => bytes.toString(16).padStart(2, "0")).join("");
|
1377 |
+
console.log(hashHex);
|
1378 |
+
return hashHex;
|
1379 |
+
}
|
1380 |
+
export {
|
1381 |
+
TrustMark
|
1382 |
+
};
|
docs/docs/.nojekyll
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
TypeDoc added this file to prevent GitHub Pages from using Jekyll. You can turn off this behavior by setting the `githubPages` option to false.
|
docs/docs/assets/favicon.svg
ADDED
|
docs/docs/assets/hierarchy.js
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
window.hierarchyData = "eJyrVirKzy8pVrKKjtVRKkpNy0lNLsnMzwMKVNfWAgCbHgqm"
|
docs/docs/assets/highlight.css
ADDED
@@ -0,0 +1,120 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
:root {
|
2 |
+
--light-hl-0: #800000;
|
3 |
+
--dark-hl-0: #808080;
|
4 |
+
--light-hl-1: #800000;
|
5 |
+
--dark-hl-1: #569CD6;
|
6 |
+
--light-hl-2: #000000FF;
|
7 |
+
--dark-hl-2: #D4D4D4;
|
8 |
+
--light-hl-3: #E50000;
|
9 |
+
--dark-hl-3: #9CDCFE;
|
10 |
+
--light-hl-4: #0000FF;
|
11 |
+
--dark-hl-4: #CE9178;
|
12 |
+
--light-hl-5: #AF00DB;
|
13 |
+
--dark-hl-5: #C586C0;
|
14 |
+
--light-hl-6: #000000;
|
15 |
+
--dark-hl-6: #D4D4D4;
|
16 |
+
--light-hl-7: #001080;
|
17 |
+
--dark-hl-7: #9CDCFE;
|
18 |
+
--light-hl-8: #A31515;
|
19 |
+
--dark-hl-8: #CE9178;
|
20 |
+
--light-hl-9: #008000;
|
21 |
+
--dark-hl-9: #6A9955;
|
22 |
+
--light-hl-10: #0000FF;
|
23 |
+
--dark-hl-10: #569CD6;
|
24 |
+
--light-hl-11: #0070C1;
|
25 |
+
--dark-hl-11: #4FC1FF;
|
26 |
+
--light-hl-12: #795E26;
|
27 |
+
--dark-hl-12: #DCDCAA;
|
28 |
+
--light-hl-13: #098658;
|
29 |
+
--dark-hl-13: #B5CEA8;
|
30 |
+
--light-code-background: #FFFFFF;
|
31 |
+
--dark-code-background: #1E1E1E;
|
32 |
+
}
|
33 |
+
|
34 |
+
@media (prefers-color-scheme: light) { :root {
|
35 |
+
--hl-0: var(--light-hl-0);
|
36 |
+
--hl-1: var(--light-hl-1);
|
37 |
+
--hl-2: var(--light-hl-2);
|
38 |
+
--hl-3: var(--light-hl-3);
|
39 |
+
--hl-4: var(--light-hl-4);
|
40 |
+
--hl-5: var(--light-hl-5);
|
41 |
+
--hl-6: var(--light-hl-6);
|
42 |
+
--hl-7: var(--light-hl-7);
|
43 |
+
--hl-8: var(--light-hl-8);
|
44 |
+
--hl-9: var(--light-hl-9);
|
45 |
+
--hl-10: var(--light-hl-10);
|
46 |
+
--hl-11: var(--light-hl-11);
|
47 |
+
--hl-12: var(--light-hl-12);
|
48 |
+
--hl-13: var(--light-hl-13);
|
49 |
+
--code-background: var(--light-code-background);
|
50 |
+
} }
|
51 |
+
|
52 |
+
@media (prefers-color-scheme: dark) { :root {
|
53 |
+
--hl-0: var(--dark-hl-0);
|
54 |
+
--hl-1: var(--dark-hl-1);
|
55 |
+
--hl-2: var(--dark-hl-2);
|
56 |
+
--hl-3: var(--dark-hl-3);
|
57 |
+
--hl-4: var(--dark-hl-4);
|
58 |
+
--hl-5: var(--dark-hl-5);
|
59 |
+
--hl-6: var(--dark-hl-6);
|
60 |
+
--hl-7: var(--dark-hl-7);
|
61 |
+
--hl-8: var(--dark-hl-8);
|
62 |
+
--hl-9: var(--dark-hl-9);
|
63 |
+
--hl-10: var(--dark-hl-10);
|
64 |
+
--hl-11: var(--dark-hl-11);
|
65 |
+
--hl-12: var(--dark-hl-12);
|
66 |
+
--hl-13: var(--dark-hl-13);
|
67 |
+
--code-background: var(--dark-code-background);
|
68 |
+
} }
|
69 |
+
|
70 |
+
:root[data-theme='light'] {
|
71 |
+
--hl-0: var(--light-hl-0);
|
72 |
+
--hl-1: var(--light-hl-1);
|
73 |
+
--hl-2: var(--light-hl-2);
|
74 |
+
--hl-3: var(--light-hl-3);
|
75 |
+
--hl-4: var(--light-hl-4);
|
76 |
+
--hl-5: var(--light-hl-5);
|
77 |
+
--hl-6: var(--light-hl-6);
|
78 |
+
--hl-7: var(--light-hl-7);
|
79 |
+
--hl-8: var(--light-hl-8);
|
80 |
+
--hl-9: var(--light-hl-9);
|
81 |
+
--hl-10: var(--light-hl-10);
|
82 |
+
--hl-11: var(--light-hl-11);
|
83 |
+
--hl-12: var(--light-hl-12);
|
84 |
+
--hl-13: var(--light-hl-13);
|
85 |
+
--code-background: var(--light-code-background);
|
86 |
+
}
|
87 |
+
|
88 |
+
:root[data-theme='dark'] {
|
89 |
+
--hl-0: var(--dark-hl-0);
|
90 |
+
--hl-1: var(--dark-hl-1);
|
91 |
+
--hl-2: var(--dark-hl-2);
|
92 |
+
--hl-3: var(--dark-hl-3);
|
93 |
+
--hl-4: var(--dark-hl-4);
|
94 |
+
--hl-5: var(--dark-hl-5);
|
95 |
+
--hl-6: var(--dark-hl-6);
|
96 |
+
--hl-7: var(--dark-hl-7);
|
97 |
+
--hl-8: var(--dark-hl-8);
|
98 |
+
--hl-9: var(--dark-hl-9);
|
99 |
+
--hl-10: var(--dark-hl-10);
|
100 |
+
--hl-11: var(--dark-hl-11);
|
101 |
+
--hl-12: var(--dark-hl-12);
|
102 |
+
--hl-13: var(--dark-hl-13);
|
103 |
+
--code-background: var(--dark-code-background);
|
104 |
+
}
|
105 |
+
|
106 |
+
.hl-0 { color: var(--hl-0); }
|
107 |
+
.hl-1 { color: var(--hl-1); }
|
108 |
+
.hl-2 { color: var(--hl-2); }
|
109 |
+
.hl-3 { color: var(--hl-3); }
|
110 |
+
.hl-4 { color: var(--hl-4); }
|
111 |
+
.hl-5 { color: var(--hl-5); }
|
112 |
+
.hl-6 { color: var(--hl-6); }
|
113 |
+
.hl-7 { color: var(--hl-7); }
|
114 |
+
.hl-8 { color: var(--hl-8); }
|
115 |
+
.hl-9 { color: var(--hl-9); }
|
116 |
+
.hl-10 { color: var(--hl-10); }
|
117 |
+
.hl-11 { color: var(--hl-11); }
|
118 |
+
.hl-12 { color: var(--hl-12); }
|
119 |
+
.hl-13 { color: var(--hl-13); }
|
120 |
+
pre, code { background: var(--code-background); }
|
docs/docs/assets/icons.js
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
(function() {
|
2 |
+
addIcons();
|
3 |
+
function addIcons() {
|
4 |
+
if (document.readyState === "loading") return document.addEventListener("DOMContentLoaded", addIcons);
|
5 |
+
const svg = document.body.appendChild(document.createElementNS("http://www.w3.org/2000/svg", "svg"));
|
6 |
+
svg.innerHTML = `<g id="icon-1" class="tsd-no-select"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-module)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6"></rect><text fill="var(--color-icon-text)" x="50%" y="50%" dominant-baseline="central" text-anchor="middle">M</text></g><g id="icon-2" class="tsd-no-select"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-module)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6"></rect><text fill="var(--color-icon-text)" x="50%" y="50%" dominant-baseline="central" text-anchor="middle">M</text></g><g id="icon-4" class="tsd-no-select"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-namespace)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6"></rect><text fill="var(--color-icon-text)" x="50%" y="50%" dominant-baseline="central" text-anchor="middle">N</text></g><g id="icon-8" class="tsd-no-select"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-enum)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6"></rect><text fill="var(--color-icon-text)" x="50%" y="50%" dominant-baseline="central" text-anchor="middle">E</text></g><g id="icon-16" class="tsd-no-select"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-property)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="12"></rect><text fill="var(--color-icon-text)" x="50%" y="50%" dominant-baseline="central" text-anchor="middle">P</text></g><g id="icon-32" class="tsd-no-select"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-variable)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6"></rect><text fill="var(--color-icon-text)" x="50%" y="50%" dominant-baseline="central" text-anchor="middle">V</text></g><g id="icon-64" class="tsd-no-select"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-function)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6"></rect><text fill="var(--color-icon-text)" x="50%" y="50%" dominant-baseline="central" text-anchor="middle">F</text></g><g id="icon-128" class="tsd-no-select"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-class)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6"></rect><text fill="var(--color-icon-text)" x="50%" y="50%" dominant-baseline="central" text-anchor="middle">C</text></g><g id="icon-256" class="tsd-no-select"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-interface)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6"></rect><text fill="var(--color-icon-text)" x="50%" y="50%" dominant-baseline="central" text-anchor="middle">I</text></g><g id="icon-512" class="tsd-no-select"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-constructor)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="12"></rect><text fill="var(--color-icon-text)" x="50%" y="50%" dominant-baseline="central" text-anchor="middle">C</text></g><g id="icon-1024" class="tsd-no-select"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-property)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="12"></rect><text fill="var(--color-icon-text)" x="50%" y="50%" dominant-baseline="central" text-anchor="middle">P</text></g><g id="icon-2048" class="tsd-no-select"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-method)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="12"></rect><text fill="var(--color-icon-text)" x="50%" y="50%" dominant-baseline="central" text-anchor="middle">M</text></g><g id="icon-4096" class="tsd-no-select"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-function)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6"></rect><text fill="var(--color-icon-text)" x="50%" y="50%" dominant-baseline="central" text-anchor="middle">F</text></g><g id="icon-8192" class="tsd-no-select"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-property)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="12"></rect><text fill="var(--color-icon-text)" x="50%" y="50%" dominant-baseline="central" text-anchor="middle">P</text></g><g id="icon-16384" class="tsd-no-select"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-constructor)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="12"></rect><text fill="var(--color-icon-text)" x="50%" y="50%" dominant-baseline="central" text-anchor="middle">C</text></g><g id="icon-32768" class="tsd-no-select"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-property)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="12"></rect><text fill="var(--color-icon-text)" x="50%" y="50%" dominant-baseline="central" text-anchor="middle">P</text></g><g id="icon-65536" class="tsd-no-select"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-type-alias)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6"></rect><text fill="var(--color-icon-text)" x="50%" y="50%" dominant-baseline="central" text-anchor="middle">T</text></g><g id="icon-131072" class="tsd-no-select"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-type-alias)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6"></rect><text fill="var(--color-icon-text)" x="50%" y="50%" dominant-baseline="central" text-anchor="middle">T</text></g><g id="icon-262144" class="tsd-no-select"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-accessor)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="12"></rect><text fill="var(--color-icon-text)" x="50%" y="50%" dominant-baseline="central" text-anchor="middle">A</text></g><g id="icon-524288" class="tsd-no-select"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-accessor)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="12"></rect><text fill="var(--color-icon-text)" x="50%" y="50%" dominant-baseline="central" text-anchor="middle">A</text></g><g id="icon-1048576" class="tsd-no-select"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-accessor)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="12"></rect><text fill="var(--color-icon-text)" x="50%" y="50%" dominant-baseline="central" text-anchor="middle">A</text></g><g id="icon-2097152" class="tsd-no-select"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-type-alias)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6"></rect><text fill="var(--color-icon-text)" x="50%" y="50%" dominant-baseline="central" text-anchor="middle">T</text></g><g id="icon-4194304" class="tsd-no-select"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-reference)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="12"></rect><text fill="var(--color-icon-text)" x="50%" y="50%" dominant-baseline="central" text-anchor="middle">R</text></g><g id="icon-8388608" class="tsd-no-select"><rect fill="var(--color-icon-background)" stroke="var(--color-document)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6"></rect><g stroke="var(--color-icon-text)" fill="none" stroke-width="1.5"><polygon points="6,5 6,19 18,19, 18,10 13,5"></polygon><line x1="9" y1="9" x2="13" y2="9"></line><line x1="9" y1="12" x2="15" y2="12"></line><line x1="9" y1="15" x2="15" y2="15"></line></g></g><g id="icon-folder" class="tsd-no-select"><rect fill="var(--color-icon-background)" stroke="var(--color-document)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6"></rect><g stroke="var(--color-icon-text)" fill="none" stroke-width="1.5"><polygon points="5,5 10,5 12,8 19,8 19,18 5,18"></polygon></g></g><g id="icon-chevronDown" class="tsd-no-select"><path d="M4.93896 8.531L12 15.591L19.061 8.531L16.939 6.409L12 11.349L7.06098 6.409L4.93896 8.531Z" fill="var(--color-icon-text)"></path></g><g id="icon-chevronSmall" class="tsd-no-select"><path d="M1.5 5.50969L8 11.6609L14.5 5.50969L12.5466 3.66086L8 7.96494L3.45341 3.66086L1.5 5.50969Z" fill="var(--color-icon-text)"></path></g><g id="icon-checkbox" class="tsd-no-select"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></g><g id="icon-menu" class="tsd-no-select"><rect x="1" y="3" width="14" height="2" fill="var(--color-icon-text)"></rect><rect x="1" y="7" width="14" height="2" fill="var(--color-icon-text)"></rect><rect x="1" y="11" width="14" height="2" fill="var(--color-icon-text)"></rect></g><g id="icon-search" class="tsd-no-select"><path d="M15.7824 13.833L12.6666 10.7177C12.5259 10.5771 12.3353 10.499 12.1353 10.499H11.6259C12.4884 9.39596 13.001 8.00859 13.001 6.49937C13.001 2.90909 10.0914 0 6.50048 0C2.90959 0 0 2.90909 0 6.49937C0 10.0896 2.90959 12.9987 6.50048 12.9987C8.00996 12.9987 9.39756 12.4863 10.5008 11.6239V12.1332C10.5008 12.3332 10.5789 12.5238 10.7195 12.6644L13.8354 15.7797C14.1292 16.0734 14.6042 16.0734 14.8948 15.7797L15.7793 14.8954C16.0731 14.6017 16.0731 14.1267 15.7824 13.833ZM6.50048 10.499C4.29094 10.499 2.50018 8.71165 2.50018 6.49937C2.50018 4.29021 4.28781 2.49976 6.50048 2.49976C8.71001 2.49976 10.5008 4.28708 10.5008 6.49937C10.5008 8.70852 8.71314 10.499 6.50048 10.499Z" fill="var(--color-icon-text)"></path></g><g id="icon-anchor" class="tsd-no-select"><g stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path><path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></g></g><g id="icon-alertNote" class="tsd-no-select"><path fill="var(--color-alert-note)" d="M0 8a8 8 0 1 1 16 0A8 8 0 0 1 0 8Zm8-6.5a6.5 6.5 0 1 0 0 13 6.5 6.5 0 0 0 0-13ZM6.5 7.75A.75.75 0 0 1 7.25 7h1a.75.75 0 0 1 .75.75v2.75h.25a.75.75 0 0 1 0 1.5h-2a.75.75 0 0 1 0-1.5h.25v-2h-.25a.75.75 0 0 1-.75-.75ZM8 6a1 1 0 1 1 0-2 1 1 0 0 1 0 2Z"></path></g><g id="icon-alertTip" class="tsd-no-select"><path fill="var(--color-alert-tip)" d="M8 1.5c-2.363 0-4 1.69-4 3.75 0 .984.424 1.625.984 2.304l.214.253c.223.264.47.556.673.848.284.411.537.896.621 1.49a.75.75 0 0 1-1.484.211c-.04-.282-.163-.547-.37-.847a8.456 8.456 0 0 0-.542-.68c-.084-.1-.173-.205-.268-.32C3.201 7.75 2.5 6.766 2.5 5.25 2.5 2.31 4.863 0 8 0s5.5 2.31 5.5 5.25c0 1.516-.701 2.5-1.328 3.259-.095.115-.184.22-.268.319-.207.245-.383.453-.541.681-.208.3-.33.565-.37.847a.751.751 0 0 1-1.485-.212c.084-.593.337-1.078.621-1.489.203-.292.45-.584.673-.848.075-.088.147-.173.213-.253.561-.679.985-1.32.985-2.304 0-2.06-1.637-3.75-4-3.75ZM5.75 12h4.5a.75.75 0 0 1 0 1.5h-4.5a.75.75 0 0 1 0-1.5ZM6 15.25a.75.75 0 0 1 .75-.75h2.5a.75.75 0 0 1 0 1.5h-2.5a.75.75 0 0 1-.75-.75Z"></path></g><g id="icon-alertImportant" class="tsd-no-select"><path fill="var(--color-alert-important)" d="M0 1.75C0 .784.784 0 1.75 0h12.5C15.216 0 16 .784 16 1.75v9.5A1.75 1.75 0 0 1 14.25 13H8.06l-2.573 2.573A1.458 1.458 0 0 1 3 14.543V13H1.75A1.75 1.75 0 0 1 0 11.25Zm1.75-.25a.25.25 0 0 0-.25.25v9.5c0 .138.112.25.25.25h2a.75.75 0 0 1 .75.75v2.19l2.72-2.72a.749.749 0 0 1 .53-.22h6.5a.25.25 0 0 0 .25-.25v-9.5a.25.25 0 0 0-.25-.25Zm7 2.25v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 9a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z"></path></g><g id="icon-alertWarning" class="tsd-no-select"><path fill="var(--color-alert-warning)" d="M6.457 1.047c.659-1.234 2.427-1.234 3.086 0l6.082 11.378A1.75 1.75 0 0 1 14.082 15H1.918a1.75 1.75 0 0 1-1.543-2.575Zm1.763.707a.25.25 0 0 0-.44 0L1.698 13.132a.25.25 0 0 0 .22.368h12.164a.25.25 0 0 0 .22-.368Zm.53 3.996v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 11a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z"></path></g><g id="icon-alertCaution" class="tsd-no-select"><path fill="var(--color-alert-caution)" d="M4.47.22A.749.749 0 0 1 5 0h6c.199 0 .389.079.53.22l4.25 4.25c.141.14.22.331.22.53v6a.749.749 0 0 1-.22.53l-4.25 4.25A.749.749 0 0 1 11 16H5a.749.749 0 0 1-.53-.22L.22 11.53A.749.749 0 0 1 0 11V5c0-.199.079-.389.22-.53Zm.84 1.28L1.5 5.31v5.38l3.81 3.81h5.38l3.81-3.81V5.31L10.69 1.5ZM8 4a.75.75 0 0 1 .75.75v3.5a.75.75 0 0 1-1.5 0v-3.5A.75.75 0 0 1 8 4Zm0 8a1 1 0 1 1 0-2 1 1 0 0 1 0 2Z"></path></g>`;
|
7 |
+
svg.style.display = "none";
|
8 |
+
if (location.protocol === "file:") updateUseElements();
|
9 |
+
}
|
10 |
+
|
11 |
+
function updateUseElements() {
|
12 |
+
document.querySelectorAll("use").forEach(el => {
|
13 |
+
if (el.getAttribute("href").includes("#icon-")) {
|
14 |
+
el.setAttribute("href", el.getAttribute("href").replace(/.*#/, "#"));
|
15 |
+
}
|
16 |
+
});
|
17 |
+
}
|
18 |
+
})()
|
docs/docs/assets/icons.svg
ADDED
|
docs/docs/assets/main.js
ADDED
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
"use strict";
|
2 |
+
window.translations={"copy":"Copy","copied":"Copied!","normally_hidden":"This member is normally hidden due to your filter settings.","hierarchy_expand":"Expand","hierarchy_collapse":"Collapse","folder":"Folder","kind_1":"Project","kind_2":"Module","kind_4":"Namespace","kind_8":"Enumeration","kind_16":"Enumeration Member","kind_32":"Variable","kind_64":"Function","kind_128":"Class","kind_256":"Interface","kind_512":"Constructor","kind_1024":"Property","kind_2048":"Method","kind_4096":"Call Signature","kind_8192":"Index Signature","kind_16384":"Constructor Signature","kind_32768":"Parameter","kind_65536":"Type Literal","kind_131072":"Type Parameter","kind_262144":"Accessor","kind_524288":"Get Signature","kind_1048576":"Set Signature","kind_2097152":"Type Alias","kind_4194304":"Reference","kind_8388608":"Document"};
|
3 |
+
"use strict";(()=>{var De=Object.create;var le=Object.defineProperty;var Fe=Object.getOwnPropertyDescriptor;var Ne=Object.getOwnPropertyNames;var Ve=Object.getPrototypeOf,Be=Object.prototype.hasOwnProperty;var qe=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var je=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Ne(e))!Be.call(t,i)&&i!==n&&le(t,i,{get:()=>e[i],enumerable:!(r=Fe(e,i))||r.enumerable});return t};var $e=(t,e,n)=>(n=t!=null?De(Ve(t)):{},je(e||!t||!t.__esModule?le(n,"default",{value:t,enumerable:!0}):n,t));var pe=qe((de,he)=>{(function(){var t=function(e){var n=new t.Builder;return n.pipeline.add(t.trimmer,t.stopWordFilter,t.stemmer),n.searchPipeline.add(t.stemmer),e.call(n,n),n.build()};t.version="2.3.9";t.utils={},t.utils.warn=function(e){return function(n){e.console&&console.warn&&console.warn(n)}}(this),t.utils.asString=function(e){return e==null?"":e.toString()},t.utils.clone=function(e){if(e==null)return e;for(var n=Object.create(null),r=Object.keys(e),i=0;i<r.length;i++){var s=r[i],o=e[s];if(Array.isArray(o)){n[s]=o.slice();continue}if(typeof o=="string"||typeof o=="number"||typeof o=="boolean"){n[s]=o;continue}throw new TypeError("clone is not deep and does not support nested objects")}return n},t.FieldRef=function(e,n,r){this.docRef=e,this.fieldName=n,this._stringValue=r},t.FieldRef.joiner="/",t.FieldRef.fromString=function(e){var n=e.indexOf(t.FieldRef.joiner);if(n===-1)throw"malformed field ref string";var r=e.slice(0,n),i=e.slice(n+1);return new t.FieldRef(i,r,e)},t.FieldRef.prototype.toString=function(){return this._stringValue==null&&(this._stringValue=this.fieldName+t.FieldRef.joiner+this.docRef),this._stringValue};t.Set=function(e){if(this.elements=Object.create(null),e){this.length=e.length;for(var n=0;n<this.length;n++)this.elements[e[n]]=!0}else this.length=0},t.Set.complete={intersect:function(e){return e},union:function(){return this},contains:function(){return!0}},t.Set.empty={intersect:function(){return this},union:function(e){return e},contains:function(){return!1}},t.Set.prototype.contains=function(e){return!!this.elements[e]},t.Set.prototype.intersect=function(e){var n,r,i,s=[];if(e===t.Set.complete)return this;if(e===t.Set.empty)return e;this.length<e.length?(n=this,r=e):(n=e,r=this),i=Object.keys(n.elements);for(var o=0;o<i.length;o++){var a=i[o];a in r.elements&&s.push(a)}return new t.Set(s)},t.Set.prototype.union=function(e){return e===t.Set.complete?t.Set.complete:e===t.Set.empty?this:new t.Set(Object.keys(this.elements).concat(Object.keys(e.elements)))},t.idf=function(e,n){var r=0;for(var i in e)i!="_index"&&(r+=Object.keys(e[i]).length);var s=(n-r+.5)/(r+.5);return Math.log(1+Math.abs(s))},t.Token=function(e,n){this.str=e||"",this.metadata=n||{}},t.Token.prototype.toString=function(){return this.str},t.Token.prototype.update=function(e){return this.str=e(this.str,this.metadata),this},t.Token.prototype.clone=function(e){return e=e||function(n){return n},new t.Token(e(this.str,this.metadata),this.metadata)};t.tokenizer=function(e,n){if(e==null||e==null)return[];if(Array.isArray(e))return e.map(function(m){return new t.Token(t.utils.asString(m).toLowerCase(),t.utils.clone(n))});for(var r=e.toString().toLowerCase(),i=r.length,s=[],o=0,a=0;o<=i;o++){var l=r.charAt(o),c=o-a;if(l.match(t.tokenizer.separator)||o==i){if(c>0){var d=t.utils.clone(n)||{};d.position=[a,c],d.index=s.length,s.push(new t.Token(r.slice(a,o),d))}a=o+1}}return s},t.tokenizer.separator=/[\s\-]+/;t.Pipeline=function(){this._stack=[]},t.Pipeline.registeredFunctions=Object.create(null),t.Pipeline.registerFunction=function(e,n){n in this.registeredFunctions&&t.utils.warn("Overwriting existing registered function: "+n),e.label=n,t.Pipeline.registeredFunctions[e.label]=e},t.Pipeline.warnIfFunctionNotRegistered=function(e){var n=e.label&&e.label in this.registeredFunctions;n||t.utils.warn(`Function is not registered with pipeline. This may cause problems when serialising the index.
|
4 |
+
`,e)},t.Pipeline.load=function(e){var n=new t.Pipeline;return e.forEach(function(r){var i=t.Pipeline.registeredFunctions[r];if(i)n.add(i);else throw new Error("Cannot load unregistered function: "+r)}),n},t.Pipeline.prototype.add=function(){var e=Array.prototype.slice.call(arguments);e.forEach(function(n){t.Pipeline.warnIfFunctionNotRegistered(n),this._stack.push(n)},this)},t.Pipeline.prototype.after=function(e,n){t.Pipeline.warnIfFunctionNotRegistered(n);var r=this._stack.indexOf(e);if(r==-1)throw new Error("Cannot find existingFn");r=r+1,this._stack.splice(r,0,n)},t.Pipeline.prototype.before=function(e,n){t.Pipeline.warnIfFunctionNotRegistered(n);var r=this._stack.indexOf(e);if(r==-1)throw new Error("Cannot find existingFn");this._stack.splice(r,0,n)},t.Pipeline.prototype.remove=function(e){var n=this._stack.indexOf(e);n!=-1&&this._stack.splice(n,1)},t.Pipeline.prototype.run=function(e){for(var n=this._stack.length,r=0;r<n;r++){for(var i=this._stack[r],s=[],o=0;o<e.length;o++){var a=i(e[o],o,e);if(!(a==null||a===""))if(Array.isArray(a))for(var l=0;l<a.length;l++)s.push(a[l]);else s.push(a)}e=s}return e},t.Pipeline.prototype.runString=function(e,n){var r=new t.Token(e,n);return this.run([r]).map(function(i){return i.toString()})},t.Pipeline.prototype.reset=function(){this._stack=[]},t.Pipeline.prototype.toJSON=function(){return this._stack.map(function(e){return t.Pipeline.warnIfFunctionNotRegistered(e),e.label})};t.Vector=function(e){this._magnitude=0,this.elements=e||[]},t.Vector.prototype.positionForIndex=function(e){if(this.elements.length==0)return 0;for(var n=0,r=this.elements.length/2,i=r-n,s=Math.floor(i/2),o=this.elements[s*2];i>1&&(o<e&&(n=s),o>e&&(r=s),o!=e);)i=r-n,s=n+Math.floor(i/2),o=this.elements[s*2];if(o==e||o>e)return s*2;if(o<e)return(s+1)*2},t.Vector.prototype.insert=function(e,n){this.upsert(e,n,function(){throw"duplicate index"})},t.Vector.prototype.upsert=function(e,n,r){this._magnitude=0;var i=this.positionForIndex(e);this.elements[i]==e?this.elements[i+1]=r(this.elements[i+1],n):this.elements.splice(i,0,e,n)},t.Vector.prototype.magnitude=function(){if(this._magnitude)return this._magnitude;for(var e=0,n=this.elements.length,r=1;r<n;r+=2){var i=this.elements[r];e+=i*i}return this._magnitude=Math.sqrt(e)},t.Vector.prototype.dot=function(e){for(var n=0,r=this.elements,i=e.elements,s=r.length,o=i.length,a=0,l=0,c=0,d=0;c<s&&d<o;)a=r[c],l=i[d],a<l?c+=2:a>l?d+=2:a==l&&(n+=r[c+1]*i[d+1],c+=2,d+=2);return n},t.Vector.prototype.similarity=function(e){return this.dot(e)/this.magnitude()||0},t.Vector.prototype.toArray=function(){for(var e=new Array(this.elements.length/2),n=1,r=0;n<this.elements.length;n+=2,r++)e[r]=this.elements[n];return e},t.Vector.prototype.toJSON=function(){return this.elements};t.stemmer=function(){var e={ational:"ate",tional:"tion",enci:"ence",anci:"ance",izer:"ize",bli:"ble",alli:"al",entli:"ent",eli:"e",ousli:"ous",ization:"ize",ation:"ate",ator:"ate",alism:"al",iveness:"ive",fulness:"ful",ousness:"ous",aliti:"al",iviti:"ive",biliti:"ble",logi:"log"},n={icate:"ic",ative:"",alize:"al",iciti:"ic",ical:"ic",ful:"",ness:""},r="[^aeiou]",i="[aeiouy]",s=r+"[^aeiouy]*",o=i+"[aeiou]*",a="^("+s+")?"+o+s,l="^("+s+")?"+o+s+"("+o+")?$",c="^("+s+")?"+o+s+o+s,d="^("+s+")?"+i,m=new RegExp(a),p=new RegExp(c),L=new RegExp(l),v=new RegExp(d),b=/^(.+?)(ss|i)es$/,f=/^(.+?)([^s])s$/,y=/^(.+?)eed$/,S=/^(.+?)(ed|ing)$/,w=/.$/,k=/(at|bl|iz)$/,O=new RegExp("([^aeiouylsz])\\1$"),q=new RegExp("^"+s+i+"[^aeiouwxy]$"),F=/^(.+?[^aeiou])y$/,j=/^(.+?)(ational|tional|enci|anci|izer|bli|alli|entli|eli|ousli|ization|ation|ator|alism|iveness|fulness|ousness|aliti|iviti|biliti|logi)$/,$=/^(.+?)(icate|ative|alize|iciti|ical|ful|ness)$/,N=/^(.+?)(al|ance|ence|er|ic|able|ible|ant|ement|ment|ent|ou|ism|ate|iti|ous|ive|ize)$/,z=/^(.+?)(s|t)(ion)$/,Q=/^(.+?)e$/,W=/ll$/,U=new RegExp("^"+s+i+"[^aeiouwxy]$"),V=function(u){var g,P,T,h,x,_,R;if(u.length<3)return u;if(T=u.substr(0,1),T=="y"&&(u=T.toUpperCase()+u.substr(1)),h=b,x=f,h.test(u)?u=u.replace(h,"$1$2"):x.test(u)&&(u=u.replace(x,"$1$2")),h=y,x=S,h.test(u)){var E=h.exec(u);h=m,h.test(E[1])&&(h=w,u=u.replace(h,""))}else if(x.test(u)){var E=x.exec(u);g=E[1],x=v,x.test(g)&&(u=g,x=k,_=O,R=q,x.test(u)?u=u+"e":_.test(u)?(h=w,u=u.replace(h,"")):R.test(u)&&(u=u+"e"))}if(h=F,h.test(u)){var E=h.exec(u);g=E[1],u=g+"i"}if(h=j,h.test(u)){var E=h.exec(u);g=E[1],P=E[2],h=m,h.test(g)&&(u=g+e[P])}if(h=$,h.test(u)){var E=h.exec(u);g=E[1],P=E[2],h=m,h.test(g)&&(u=g+n[P])}if(h=N,x=z,h.test(u)){var E=h.exec(u);g=E[1],h=p,h.test(g)&&(u=g)}else if(x.test(u)){var E=x.exec(u);g=E[1]+E[2],x=p,x.test(g)&&(u=g)}if(h=Q,h.test(u)){var E=h.exec(u);g=E[1],h=p,x=L,_=U,(h.test(g)||x.test(g)&&!_.test(g))&&(u=g)}return h=W,x=p,h.test(u)&&x.test(u)&&(h=w,u=u.replace(h,"")),T=="y"&&(u=T.toLowerCase()+u.substr(1)),u};return function(M){return M.update(V)}}(),t.Pipeline.registerFunction(t.stemmer,"stemmer");t.generateStopWordFilter=function(e){var n=e.reduce(function(r,i){return r[i]=i,r},{});return function(r){if(r&&n[r.toString()]!==r.toString())return r}},t.stopWordFilter=t.generateStopWordFilter(["a","able","about","across","after","all","almost","also","am","among","an","and","any","are","as","at","be","because","been","but","by","can","cannot","could","dear","did","do","does","either","else","ever","every","for","from","get","got","had","has","have","he","her","hers","him","his","how","however","i","if","in","into","is","it","its","just","least","let","like","likely","may","me","might","most","must","my","neither","no","nor","not","of","off","often","on","only","or","other","our","own","rather","said","say","says","she","should","since","so","some","than","that","the","their","them","then","there","these","they","this","tis","to","too","twas","us","wants","was","we","were","what","when","where","which","while","who","whom","why","will","with","would","yet","you","your"]),t.Pipeline.registerFunction(t.stopWordFilter,"stopWordFilter");t.trimmer=function(e){return e.update(function(n){return n.replace(/^\W+/,"").replace(/\W+$/,"")})},t.Pipeline.registerFunction(t.trimmer,"trimmer");t.TokenSet=function(){this.final=!1,this.edges={},this.id=t.TokenSet._nextId,t.TokenSet._nextId+=1},t.TokenSet._nextId=1,t.TokenSet.fromArray=function(e){for(var n=new t.TokenSet.Builder,r=0,i=e.length;r<i;r++)n.insert(e[r]);return n.finish(),n.root},t.TokenSet.fromClause=function(e){return"editDistance"in e?t.TokenSet.fromFuzzyString(e.term,e.editDistance):t.TokenSet.fromString(e.term)},t.TokenSet.fromFuzzyString=function(e,n){for(var r=new t.TokenSet,i=[{node:r,editsRemaining:n,str:e}];i.length;){var s=i.pop();if(s.str.length>0){var o=s.str.charAt(0),a;o in s.node.edges?a=s.node.edges[o]:(a=new t.TokenSet,s.node.edges[o]=a),s.str.length==1&&(a.final=!0),i.push({node:a,editsRemaining:s.editsRemaining,str:s.str.slice(1)})}if(s.editsRemaining!=0){if("*"in s.node.edges)var l=s.node.edges["*"];else{var l=new t.TokenSet;s.node.edges["*"]=l}if(s.str.length==0&&(l.final=!0),i.push({node:l,editsRemaining:s.editsRemaining-1,str:s.str}),s.str.length>1&&i.push({node:s.node,editsRemaining:s.editsRemaining-1,str:s.str.slice(1)}),s.str.length==1&&(s.node.final=!0),s.str.length>=1){if("*"in s.node.edges)var c=s.node.edges["*"];else{var c=new t.TokenSet;s.node.edges["*"]=c}s.str.length==1&&(c.final=!0),i.push({node:c,editsRemaining:s.editsRemaining-1,str:s.str.slice(1)})}if(s.str.length>1){var d=s.str.charAt(0),m=s.str.charAt(1),p;m in s.node.edges?p=s.node.edges[m]:(p=new t.TokenSet,s.node.edges[m]=p),s.str.length==1&&(p.final=!0),i.push({node:p,editsRemaining:s.editsRemaining-1,str:d+s.str.slice(2)})}}}return r},t.TokenSet.fromString=function(e){for(var n=new t.TokenSet,r=n,i=0,s=e.length;i<s;i++){var o=e[i],a=i==s-1;if(o=="*")n.edges[o]=n,n.final=a;else{var l=new t.TokenSet;l.final=a,n.edges[o]=l,n=l}}return r},t.TokenSet.prototype.toArray=function(){for(var e=[],n=[{prefix:"",node:this}];n.length;){var r=n.pop(),i=Object.keys(r.node.edges),s=i.length;r.node.final&&(r.prefix.charAt(0),e.push(r.prefix));for(var o=0;o<s;o++){var a=i[o];n.push({prefix:r.prefix.concat(a),node:r.node.edges[a]})}}return e},t.TokenSet.prototype.toString=function(){if(this._str)return this._str;for(var e=this.final?"1":"0",n=Object.keys(this.edges).sort(),r=n.length,i=0;i<r;i++){var s=n[i],o=this.edges[s];e=e+s+o.id}return e},t.TokenSet.prototype.intersect=function(e){for(var n=new t.TokenSet,r=void 0,i=[{qNode:e,output:n,node:this}];i.length;){r=i.pop();for(var s=Object.keys(r.qNode.edges),o=s.length,a=Object.keys(r.node.edges),l=a.length,c=0;c<o;c++)for(var d=s[c],m=0;m<l;m++){var p=a[m];if(p==d||d=="*"){var L=r.node.edges[p],v=r.qNode.edges[d],b=L.final&&v.final,f=void 0;p in r.output.edges?(f=r.output.edges[p],f.final=f.final||b):(f=new t.TokenSet,f.final=b,r.output.edges[p]=f),i.push({qNode:v,output:f,node:L})}}}return n},t.TokenSet.Builder=function(){this.previousWord="",this.root=new t.TokenSet,this.uncheckedNodes=[],this.minimizedNodes={}},t.TokenSet.Builder.prototype.insert=function(e){var n,r=0;if(e<this.previousWord)throw new Error("Out of order word insertion");for(var i=0;i<e.length&&i<this.previousWord.length&&e[i]==this.previousWord[i];i++)r++;this.minimize(r),this.uncheckedNodes.length==0?n=this.root:n=this.uncheckedNodes[this.uncheckedNodes.length-1].child;for(var i=r;i<e.length;i++){var s=new t.TokenSet,o=e[i];n.edges[o]=s,this.uncheckedNodes.push({parent:n,char:o,child:s}),n=s}n.final=!0,this.previousWord=e},t.TokenSet.Builder.prototype.finish=function(){this.minimize(0)},t.TokenSet.Builder.prototype.minimize=function(e){for(var n=this.uncheckedNodes.length-1;n>=e;n--){var r=this.uncheckedNodes[n],i=r.child.toString();i in this.minimizedNodes?r.parent.edges[r.char]=this.minimizedNodes[i]:(r.child._str=i,this.minimizedNodes[i]=r.child),this.uncheckedNodes.pop()}};t.Index=function(e){this.invertedIndex=e.invertedIndex,this.fieldVectors=e.fieldVectors,this.tokenSet=e.tokenSet,this.fields=e.fields,this.pipeline=e.pipeline},t.Index.prototype.search=function(e){return this.query(function(n){var r=new t.QueryParser(e,n);r.parse()})},t.Index.prototype.query=function(e){for(var n=new t.Query(this.fields),r=Object.create(null),i=Object.create(null),s=Object.create(null),o=Object.create(null),a=Object.create(null),l=0;l<this.fields.length;l++)i[this.fields[l]]=new t.Vector;e.call(n,n);for(var l=0;l<n.clauses.length;l++){var c=n.clauses[l],d=null,m=t.Set.empty;c.usePipeline?d=this.pipeline.runString(c.term,{fields:c.fields}):d=[c.term];for(var p=0;p<d.length;p++){var L=d[p];c.term=L;var v=t.TokenSet.fromClause(c),b=this.tokenSet.intersect(v).toArray();if(b.length===0&&c.presence===t.Query.presence.REQUIRED){for(var f=0;f<c.fields.length;f++){var y=c.fields[f];o[y]=t.Set.empty}break}for(var S=0;S<b.length;S++)for(var w=b[S],k=this.invertedIndex[w],O=k._index,f=0;f<c.fields.length;f++){var y=c.fields[f],q=k[y],F=Object.keys(q),j=w+"/"+y,$=new t.Set(F);if(c.presence==t.Query.presence.REQUIRED&&(m=m.union($),o[y]===void 0&&(o[y]=t.Set.complete)),c.presence==t.Query.presence.PROHIBITED){a[y]===void 0&&(a[y]=t.Set.empty),a[y]=a[y].union($);continue}if(i[y].upsert(O,c.boost,function(Ae,He){return Ae+He}),!s[j]){for(var N=0;N<F.length;N++){var z=F[N],Q=new t.FieldRef(z,y),W=q[z],U;(U=r[Q])===void 0?r[Q]=new t.MatchData(w,y,W):U.add(w,y,W)}s[j]=!0}}}if(c.presence===t.Query.presence.REQUIRED)for(var f=0;f<c.fields.length;f++){var y=c.fields[f];o[y]=o[y].intersect(m)}}for(var V=t.Set.complete,M=t.Set.empty,l=0;l<this.fields.length;l++){var y=this.fields[l];o[y]&&(V=V.intersect(o[y])),a[y]&&(M=M.union(a[y]))}var u=Object.keys(r),g=[],P=Object.create(null);if(n.isNegated()){u=Object.keys(this.fieldVectors);for(var l=0;l<u.length;l++){var Q=u[l],T=t.FieldRef.fromString(Q);r[Q]=new t.MatchData}}for(var l=0;l<u.length;l++){var T=t.FieldRef.fromString(u[l]),h=T.docRef;if(V.contains(h)&&!M.contains(h)){var x=this.fieldVectors[T],_=i[T.fieldName].similarity(x),R;if((R=P[h])!==void 0)R.score+=_,R.matchData.combine(r[T]);else{var E={ref:h,score:_,matchData:r[T]};P[h]=E,g.push(E)}}}return g.sort(function(Me,Re){return Re.score-Me.score})},t.Index.prototype.toJSON=function(){var e=Object.keys(this.invertedIndex).sort().map(function(r){return[r,this.invertedIndex[r]]},this),n=Object.keys(this.fieldVectors).map(function(r){return[r,this.fieldVectors[r].toJSON()]},this);return{version:t.version,fields:this.fields,fieldVectors:n,invertedIndex:e,pipeline:this.pipeline.toJSON()}},t.Index.load=function(e){var n={},r={},i=e.fieldVectors,s=Object.create(null),o=e.invertedIndex,a=new t.TokenSet.Builder,l=t.Pipeline.load(e.pipeline);e.version!=t.version&&t.utils.warn("Version mismatch when loading serialised index. Current version of lunr '"+t.version+"' does not match serialized index '"+e.version+"'");for(var c=0;c<i.length;c++){var d=i[c],m=d[0],p=d[1];r[m]=new t.Vector(p)}for(var c=0;c<o.length;c++){var d=o[c],L=d[0],v=d[1];a.insert(L),s[L]=v}return a.finish(),n.fields=e.fields,n.fieldVectors=r,n.invertedIndex=s,n.tokenSet=a.root,n.pipeline=l,new t.Index(n)};t.Builder=function(){this._ref="id",this._fields=Object.create(null),this._documents=Object.create(null),this.invertedIndex=Object.create(null),this.fieldTermFrequencies={},this.fieldLengths={},this.tokenizer=t.tokenizer,this.pipeline=new t.Pipeline,this.searchPipeline=new t.Pipeline,this.documentCount=0,this._b=.75,this._k1=1.2,this.termIndex=0,this.metadataWhitelist=[]},t.Builder.prototype.ref=function(e){this._ref=e},t.Builder.prototype.field=function(e,n){if(/\//.test(e))throw new RangeError("Field '"+e+"' contains illegal character '/'");this._fields[e]=n||{}},t.Builder.prototype.b=function(e){e<0?this._b=0:e>1?this._b=1:this._b=e},t.Builder.prototype.k1=function(e){this._k1=e},t.Builder.prototype.add=function(e,n){var r=e[this._ref],i=Object.keys(this._fields);this._documents[r]=n||{},this.documentCount+=1;for(var s=0;s<i.length;s++){var o=i[s],a=this._fields[o].extractor,l=a?a(e):e[o],c=this.tokenizer(l,{fields:[o]}),d=this.pipeline.run(c),m=new t.FieldRef(r,o),p=Object.create(null);this.fieldTermFrequencies[m]=p,this.fieldLengths[m]=0,this.fieldLengths[m]+=d.length;for(var L=0;L<d.length;L++){var v=d[L];if(p[v]==null&&(p[v]=0),p[v]+=1,this.invertedIndex[v]==null){var b=Object.create(null);b._index=this.termIndex,this.termIndex+=1;for(var f=0;f<i.length;f++)b[i[f]]=Object.create(null);this.invertedIndex[v]=b}this.invertedIndex[v][o][r]==null&&(this.invertedIndex[v][o][r]=Object.create(null));for(var y=0;y<this.metadataWhitelist.length;y++){var S=this.metadataWhitelist[y],w=v.metadata[S];this.invertedIndex[v][o][r][S]==null&&(this.invertedIndex[v][o][r][S]=[]),this.invertedIndex[v][o][r][S].push(w)}}}},t.Builder.prototype.calculateAverageFieldLengths=function(){for(var e=Object.keys(this.fieldLengths),n=e.length,r={},i={},s=0;s<n;s++){var o=t.FieldRef.fromString(e[s]),a=o.fieldName;i[a]||(i[a]=0),i[a]+=1,r[a]||(r[a]=0),r[a]+=this.fieldLengths[o]}for(var l=Object.keys(this._fields),s=0;s<l.length;s++){var c=l[s];r[c]=r[c]/i[c]}this.averageFieldLength=r},t.Builder.prototype.createFieldVectors=function(){for(var e={},n=Object.keys(this.fieldTermFrequencies),r=n.length,i=Object.create(null),s=0;s<r;s++){for(var o=t.FieldRef.fromString(n[s]),a=o.fieldName,l=this.fieldLengths[o],c=new t.Vector,d=this.fieldTermFrequencies[o],m=Object.keys(d),p=m.length,L=this._fields[a].boost||1,v=this._documents[o.docRef].boost||1,b=0;b<p;b++){var f=m[b],y=d[f],S=this.invertedIndex[f]._index,w,k,O;i[f]===void 0?(w=t.idf(this.invertedIndex[f],this.documentCount),i[f]=w):w=i[f],k=w*((this._k1+1)*y)/(this._k1*(1-this._b+this._b*(l/this.averageFieldLength[a]))+y),k*=L,k*=v,O=Math.round(k*1e3)/1e3,c.insert(S,O)}e[o]=c}this.fieldVectors=e},t.Builder.prototype.createTokenSet=function(){this.tokenSet=t.TokenSet.fromArray(Object.keys(this.invertedIndex).sort())},t.Builder.prototype.build=function(){return this.calculateAverageFieldLengths(),this.createFieldVectors(),this.createTokenSet(),new t.Index({invertedIndex:this.invertedIndex,fieldVectors:this.fieldVectors,tokenSet:this.tokenSet,fields:Object.keys(this._fields),pipeline:this.searchPipeline})},t.Builder.prototype.use=function(e){var n=Array.prototype.slice.call(arguments,1);n.unshift(this),e.apply(this,n)},t.MatchData=function(e,n,r){for(var i=Object.create(null),s=Object.keys(r||{}),o=0;o<s.length;o++){var a=s[o];i[a]=r[a].slice()}this.metadata=Object.create(null),e!==void 0&&(this.metadata[e]=Object.create(null),this.metadata[e][n]=i)},t.MatchData.prototype.combine=function(e){for(var n=Object.keys(e.metadata),r=0;r<n.length;r++){var i=n[r],s=Object.keys(e.metadata[i]);this.metadata[i]==null&&(this.metadata[i]=Object.create(null));for(var o=0;o<s.length;o++){var a=s[o],l=Object.keys(e.metadata[i][a]);this.metadata[i][a]==null&&(this.metadata[i][a]=Object.create(null));for(var c=0;c<l.length;c++){var d=l[c];this.metadata[i][a][d]==null?this.metadata[i][a][d]=e.metadata[i][a][d]:this.metadata[i][a][d]=this.metadata[i][a][d].concat(e.metadata[i][a][d])}}}},t.MatchData.prototype.add=function(e,n,r){if(!(e in this.metadata)){this.metadata[e]=Object.create(null),this.metadata[e][n]=r;return}if(!(n in this.metadata[e])){this.metadata[e][n]=r;return}for(var i=Object.keys(r),s=0;s<i.length;s++){var o=i[s];o in this.metadata[e][n]?this.metadata[e][n][o]=this.metadata[e][n][o].concat(r[o]):this.metadata[e][n][o]=r[o]}},t.Query=function(e){this.clauses=[],this.allFields=e},t.Query.wildcard=new String("*"),t.Query.wildcard.NONE=0,t.Query.wildcard.LEADING=1,t.Query.wildcard.TRAILING=2,t.Query.presence={OPTIONAL:1,REQUIRED:2,PROHIBITED:3},t.Query.prototype.clause=function(e){return"fields"in e||(e.fields=this.allFields),"boost"in e||(e.boost=1),"usePipeline"in e||(e.usePipeline=!0),"wildcard"in e||(e.wildcard=t.Query.wildcard.NONE),e.wildcard&t.Query.wildcard.LEADING&&e.term.charAt(0)!=t.Query.wildcard&&(e.term="*"+e.term),e.wildcard&t.Query.wildcard.TRAILING&&e.term.slice(-1)!=t.Query.wildcard&&(e.term=""+e.term+"*"),"presence"in e||(e.presence=t.Query.presence.OPTIONAL),this.clauses.push(e),this},t.Query.prototype.isNegated=function(){for(var e=0;e<this.clauses.length;e++)if(this.clauses[e].presence!=t.Query.presence.PROHIBITED)return!1;return!0},t.Query.prototype.term=function(e,n){if(Array.isArray(e))return e.forEach(function(i){this.term(i,t.utils.clone(n))},this),this;var r=n||{};return r.term=e.toString(),this.clause(r),this},t.QueryParseError=function(e,n,r){this.name="QueryParseError",this.message=e,this.start=n,this.end=r},t.QueryParseError.prototype=new Error,t.QueryLexer=function(e){this.lexemes=[],this.str=e,this.length=e.length,this.pos=0,this.start=0,this.escapeCharPositions=[]},t.QueryLexer.prototype.run=function(){for(var e=t.QueryLexer.lexText;e;)e=e(this)},t.QueryLexer.prototype.sliceString=function(){for(var e=[],n=this.start,r=this.pos,i=0;i<this.escapeCharPositions.length;i++)r=this.escapeCharPositions[i],e.push(this.str.slice(n,r)),n=r+1;return e.push(this.str.slice(n,this.pos)),this.escapeCharPositions.length=0,e.join("")},t.QueryLexer.prototype.emit=function(e){this.lexemes.push({type:e,str:this.sliceString(),start:this.start,end:this.pos}),this.start=this.pos},t.QueryLexer.prototype.escapeCharacter=function(){this.escapeCharPositions.push(this.pos-1),this.pos+=1},t.QueryLexer.prototype.next=function(){if(this.pos>=this.length)return t.QueryLexer.EOS;var e=this.str.charAt(this.pos);return this.pos+=1,e},t.QueryLexer.prototype.width=function(){return this.pos-this.start},t.QueryLexer.prototype.ignore=function(){this.start==this.pos&&(this.pos+=1),this.start=this.pos},t.QueryLexer.prototype.backup=function(){this.pos-=1},t.QueryLexer.prototype.acceptDigitRun=function(){var e,n;do e=this.next(),n=e.charCodeAt(0);while(n>47&&n<58);e!=t.QueryLexer.EOS&&this.backup()},t.QueryLexer.prototype.more=function(){return this.pos<this.length},t.QueryLexer.EOS="EOS",t.QueryLexer.FIELD="FIELD",t.QueryLexer.TERM="TERM",t.QueryLexer.EDIT_DISTANCE="EDIT_DISTANCE",t.QueryLexer.BOOST="BOOST",t.QueryLexer.PRESENCE="PRESENCE",t.QueryLexer.lexField=function(e){return e.backup(),e.emit(t.QueryLexer.FIELD),e.ignore(),t.QueryLexer.lexText},t.QueryLexer.lexTerm=function(e){if(e.width()>1&&(e.backup(),e.emit(t.QueryLexer.TERM)),e.ignore(),e.more())return t.QueryLexer.lexText},t.QueryLexer.lexEditDistance=function(e){return e.ignore(),e.acceptDigitRun(),e.emit(t.QueryLexer.EDIT_DISTANCE),t.QueryLexer.lexText},t.QueryLexer.lexBoost=function(e){return e.ignore(),e.acceptDigitRun(),e.emit(t.QueryLexer.BOOST),t.QueryLexer.lexText},t.QueryLexer.lexEOS=function(e){e.width()>0&&e.emit(t.QueryLexer.TERM)},t.QueryLexer.termSeparator=t.tokenizer.separator,t.QueryLexer.lexText=function(e){for(;;){var n=e.next();if(n==t.QueryLexer.EOS)return t.QueryLexer.lexEOS;if(n.charCodeAt(0)==92){e.escapeCharacter();continue}if(n==":")return t.QueryLexer.lexField;if(n=="~")return e.backup(),e.width()>0&&e.emit(t.QueryLexer.TERM),t.QueryLexer.lexEditDistance;if(n=="^")return e.backup(),e.width()>0&&e.emit(t.QueryLexer.TERM),t.QueryLexer.lexBoost;if(n=="+"&&e.width()===1||n=="-"&&e.width()===1)return e.emit(t.QueryLexer.PRESENCE),t.QueryLexer.lexText;if(n.match(t.QueryLexer.termSeparator))return t.QueryLexer.lexTerm}},t.QueryParser=function(e,n){this.lexer=new t.QueryLexer(e),this.query=n,this.currentClause={},this.lexemeIdx=0},t.QueryParser.prototype.parse=function(){this.lexer.run(),this.lexemes=this.lexer.lexemes;for(var e=t.QueryParser.parseClause;e;)e=e(this);return this.query},t.QueryParser.prototype.peekLexeme=function(){return this.lexemes[this.lexemeIdx]},t.QueryParser.prototype.consumeLexeme=function(){var e=this.peekLexeme();return this.lexemeIdx+=1,e},t.QueryParser.prototype.nextClause=function(){var e=this.currentClause;this.query.clause(e),this.currentClause={}},t.QueryParser.parseClause=function(e){var n=e.peekLexeme();if(n!=null)switch(n.type){case t.QueryLexer.PRESENCE:return t.QueryParser.parsePresence;case t.QueryLexer.FIELD:return t.QueryParser.parseField;case t.QueryLexer.TERM:return t.QueryParser.parseTerm;default:var r="expected either a field or a term, found "+n.type;throw n.str.length>=1&&(r+=" with value '"+n.str+"'"),new t.QueryParseError(r,n.start,n.end)}},t.QueryParser.parsePresence=function(e){var n=e.consumeLexeme();if(n!=null){switch(n.str){case"-":e.currentClause.presence=t.Query.presence.PROHIBITED;break;case"+":e.currentClause.presence=t.Query.presence.REQUIRED;break;default:var r="unrecognised presence operator'"+n.str+"'";throw new t.QueryParseError(r,n.start,n.end)}var i=e.peekLexeme();if(i==null){var r="expecting term or field, found nothing";throw new t.QueryParseError(r,n.start,n.end)}switch(i.type){case t.QueryLexer.FIELD:return t.QueryParser.parseField;case t.QueryLexer.TERM:return t.QueryParser.parseTerm;default:var r="expecting term or field, found '"+i.type+"'";throw new t.QueryParseError(r,i.start,i.end)}}},t.QueryParser.parseField=function(e){var n=e.consumeLexeme();if(n!=null){if(e.query.allFields.indexOf(n.str)==-1){var r=e.query.allFields.map(function(o){return"'"+o+"'"}).join(", "),i="unrecognised field '"+n.str+"', possible fields: "+r;throw new t.QueryParseError(i,n.start,n.end)}e.currentClause.fields=[n.str];var s=e.peekLexeme();if(s==null){var i="expecting term, found nothing";throw new t.QueryParseError(i,n.start,n.end)}switch(s.type){case t.QueryLexer.TERM:return t.QueryParser.parseTerm;default:var i="expecting term, found '"+s.type+"'";throw new t.QueryParseError(i,s.start,s.end)}}},t.QueryParser.parseTerm=function(e){var n=e.consumeLexeme();if(n!=null){e.currentClause.term=n.str.toLowerCase(),n.str.indexOf("*")!=-1&&(e.currentClause.usePipeline=!1);var r=e.peekLexeme();if(r==null){e.nextClause();return}switch(r.type){case t.QueryLexer.TERM:return e.nextClause(),t.QueryParser.parseTerm;case t.QueryLexer.FIELD:return e.nextClause(),t.QueryParser.parseField;case t.QueryLexer.EDIT_DISTANCE:return t.QueryParser.parseEditDistance;case t.QueryLexer.BOOST:return t.QueryParser.parseBoost;case t.QueryLexer.PRESENCE:return e.nextClause(),t.QueryParser.parsePresence;default:var i="Unexpected lexeme type '"+r.type+"'";throw new t.QueryParseError(i,r.start,r.end)}}},t.QueryParser.parseEditDistance=function(e){var n=e.consumeLexeme();if(n!=null){var r=parseInt(n.str,10);if(isNaN(r)){var i="edit distance must be numeric";throw new t.QueryParseError(i,n.start,n.end)}e.currentClause.editDistance=r;var s=e.peekLexeme();if(s==null){e.nextClause();return}switch(s.type){case t.QueryLexer.TERM:return e.nextClause(),t.QueryParser.parseTerm;case t.QueryLexer.FIELD:return e.nextClause(),t.QueryParser.parseField;case t.QueryLexer.EDIT_DISTANCE:return t.QueryParser.parseEditDistance;case t.QueryLexer.BOOST:return t.QueryParser.parseBoost;case t.QueryLexer.PRESENCE:return e.nextClause(),t.QueryParser.parsePresence;default:var i="Unexpected lexeme type '"+s.type+"'";throw new t.QueryParseError(i,s.start,s.end)}}},t.QueryParser.parseBoost=function(e){var n=e.consumeLexeme();if(n!=null){var r=parseInt(n.str,10);if(isNaN(r)){var i="boost must be numeric";throw new t.QueryParseError(i,n.start,n.end)}e.currentClause.boost=r;var s=e.peekLexeme();if(s==null){e.nextClause();return}switch(s.type){case t.QueryLexer.TERM:return e.nextClause(),t.QueryParser.parseTerm;case t.QueryLexer.FIELD:return e.nextClause(),t.QueryParser.parseField;case t.QueryLexer.EDIT_DISTANCE:return t.QueryParser.parseEditDistance;case t.QueryLexer.BOOST:return t.QueryParser.parseBoost;case t.QueryLexer.PRESENCE:return e.nextClause(),t.QueryParser.parsePresence;default:var i="Unexpected lexeme type '"+s.type+"'";throw new t.QueryParseError(i,s.start,s.end)}}},function(e,n){typeof define=="function"&&define.amd?define(n):typeof de=="object"?he.exports=n():e.lunr=n()}(this,function(){return t})})()});window.translations||={copy:"Copy",copied:"Copied!",normally_hidden:"This member is normally hidden due to your filter settings.",hierarchy_expand:"Expand",hierarchy_collapse:"Collapse",folder:"Folder",kind_1:"Project",kind_2:"Module",kind_4:"Namespace",kind_8:"Enumeration",kind_16:"Enumeration Member",kind_32:"Variable",kind_64:"Function",kind_128:"Class",kind_256:"Interface",kind_512:"Constructor",kind_1024:"Property",kind_2048:"Method",kind_4096:"Call Signature",kind_8192:"Index Signature",kind_16384:"Constructor Signature",kind_32768:"Parameter",kind_65536:"Type Literal",kind_131072:"Type Parameter",kind_262144:"Accessor",kind_524288:"Get Signature",kind_1048576:"Set Signature",kind_2097152:"Type Alias",kind_4194304:"Reference",kind_8388608:"Document"};var ce=[];function G(t,e){ce.push({selector:e,constructor:t})}var J=class{alwaysVisibleMember=null;constructor(){this.createComponents(document.body),this.ensureFocusedElementVisible(),this.listenForCodeCopies(),window.addEventListener("hashchange",()=>this.ensureFocusedElementVisible()),document.body.style.display||(this.ensureFocusedElementVisible(),this.updateIndexVisibility(),this.scrollToHash())}createComponents(e){ce.forEach(n=>{e.querySelectorAll(n.selector).forEach(r=>{r.dataset.hasInstance||(new n.constructor({el:r,app:this}),r.dataset.hasInstance=String(!0))})})}filterChanged(){this.ensureFocusedElementVisible()}showPage(){document.body.style.display&&(document.body.style.removeProperty("display"),this.ensureFocusedElementVisible(),this.updateIndexVisibility(),this.scrollToHash())}scrollToHash(){if(location.hash){let e=document.getElementById(location.hash.substring(1));if(!e)return;e.scrollIntoView({behavior:"instant",block:"start"})}}ensureActivePageVisible(){let e=document.querySelector(".tsd-navigation .current"),n=e?.parentElement;for(;n&&!n.classList.contains(".tsd-navigation");)n instanceof HTMLDetailsElement&&(n.open=!0),n=n.parentElement;if(e&&!ze(e)){let r=e.getBoundingClientRect().top-document.documentElement.clientHeight/4;document.querySelector(".site-menu").scrollTop=r,document.querySelector(".col-sidebar").scrollTop=r}}updateIndexVisibility(){let e=document.querySelector(".tsd-index-content"),n=e?.open;e&&(e.open=!0),document.querySelectorAll(".tsd-index-section").forEach(r=>{r.style.display="block";let i=Array.from(r.querySelectorAll(".tsd-index-link")).every(s=>s.offsetParent==null);r.style.display=i?"none":"block"}),e&&(e.open=n)}ensureFocusedElementVisible(){if(this.alwaysVisibleMember&&(this.alwaysVisibleMember.classList.remove("always-visible"),this.alwaysVisibleMember.firstElementChild.remove(),this.alwaysVisibleMember=null),!location.hash)return;let e=document.getElementById(location.hash.substring(1));if(!e)return;let n=e.parentElement;for(;n&&n.tagName!=="SECTION";)n=n.parentElement;if(!n)return;let r=n.offsetParent==null,i=n;for(;i!==document.body;)i instanceof HTMLDetailsElement&&(i.open=!0),i=i.parentElement;if(n.offsetParent==null){this.alwaysVisibleMember=n,n.classList.add("always-visible");let s=document.createElement("p");s.classList.add("warning"),s.textContent=window.translations.normally_hidden,n.prepend(s)}r&&e.scrollIntoView()}listenForCodeCopies(){document.querySelectorAll("pre > button").forEach(e=>{let n;e.addEventListener("click",()=>{e.previousElementSibling instanceof HTMLElement&&navigator.clipboard.writeText(e.previousElementSibling.innerText.trim()),e.textContent=window.translations.copied,e.classList.add("visible"),clearTimeout(n),n=setTimeout(()=>{e.classList.remove("visible"),n=setTimeout(()=>{e.textContent=window.translations.copy},100)},1e3)})})}};function ze(t){let e=t.getBoundingClientRect(),n=Math.max(document.documentElement.clientHeight,window.innerHeight);return!(e.bottom<0||e.top-n>=0)}var ue=(t,e=100)=>{let n;return()=>{clearTimeout(n),n=setTimeout(()=>t(),e)}};var ge=$e(pe(),1);async function A(t){let e=Uint8Array.from(atob(t),s=>s.charCodeAt(0)),r=new Blob([e]).stream().pipeThrough(new DecompressionStream("deflate")),i=await new Response(r).text();return JSON.parse(i)}async function fe(t,e){if(!window.searchData)return;let n=await A(window.searchData);t.data=n,t.index=ge.Index.load(n.index),e.classList.remove("loading"),e.classList.add("ready")}function ve(){let t=document.getElementById("tsd-search");if(!t)return;let e={base:document.documentElement.dataset.base+"/"},n=document.getElementById("tsd-search-script");t.classList.add("loading"),n&&(n.addEventListener("error",()=>{t.classList.remove("loading"),t.classList.add("failure")}),n.addEventListener("load",()=>{fe(e,t)}),fe(e,t));let r=document.querySelector("#tsd-search input"),i=document.querySelector("#tsd-search .results");if(!r||!i)throw new Error("The input field or the result list wrapper was not found");i.addEventListener("mouseup",()=>{re(t)}),r.addEventListener("focus",()=>t.classList.add("has-focus")),We(t,i,r,e)}function We(t,e,n,r){n.addEventListener("input",ue(()=>{Ue(t,e,n,r)},200)),n.addEventListener("keydown",i=>{i.key=="Enter"?Je(e,t):i.key=="ArrowUp"?(me(e,n,-1),i.preventDefault()):i.key==="ArrowDown"&&(me(e,n,1),i.preventDefault())}),document.body.addEventListener("keypress",i=>{i.altKey||i.ctrlKey||i.metaKey||!n.matches(":focus")&&i.key==="/"&&(i.preventDefault(),n.focus())}),document.body.addEventListener("keyup",i=>{t.classList.contains("has-focus")&&(i.key==="Escape"||!e.matches(":focus-within")&&!n.matches(":focus"))&&(n.blur(),re(t))})}function re(t){t.classList.remove("has-focus")}function Ue(t,e,n,r){if(!r.index||!r.data)return;e.textContent="";let i=n.value.trim(),s;if(i){let o=i.split(" ").map(a=>a.length?`*${a}*`:"").join(" ");s=r.index.search(o)}else s=[];for(let o=0;o<s.length;o++){let a=s[o],l=r.data.rows[Number(a.ref)],c=1;l.name.toLowerCase().startsWith(i.toLowerCase())&&(c*=1+1/(1+Math.abs(l.name.length-i.length))),a.score*=c}if(s.length===0){let o=document.createElement("li");o.classList.add("no-results");let a=document.createElement("span");a.textContent="No results found",o.appendChild(a),e.appendChild(o)}s.sort((o,a)=>a.score-o.score);for(let o=0,a=Math.min(10,s.length);o<a;o++){let l=r.data.rows[Number(s[o].ref)],c=`<svg width="20" height="20" viewBox="0 0 24 24" fill="none" class="tsd-kind-icon"><use href="#icon-${l.kind}"></use></svg>`,d=ye(l.name,i);globalThis.DEBUG_SEARCH_WEIGHTS&&(d+=` (score: ${s[o].score.toFixed(2)})`),l.parent&&(d=`<span class="parent">
|
5 |
+
${ye(l.parent,i)}.</span>${d}`);let m=document.createElement("li");m.classList.value=l.classes??"";let p=document.createElement("a");p.href=r.base+l.url,p.innerHTML=c+d,m.append(p),p.addEventListener("focus",()=>{e.querySelector(".current")?.classList.remove("current"),m.classList.add("current")}),e.appendChild(m)}}function me(t,e,n){let r=t.querySelector(".current");if(!r)r=t.querySelector(n==1?"li:first-child":"li:last-child"),r&&r.classList.add("current");else{let i=r;if(n===1)do i=i.nextElementSibling??void 0;while(i instanceof HTMLElement&&i.offsetParent==null);else do i=i.previousElementSibling??void 0;while(i instanceof HTMLElement&&i.offsetParent==null);i?(r.classList.remove("current"),i.classList.add("current")):n===-1&&(r.classList.remove("current"),e.focus())}}function Je(t,e){let n=t.querySelector(".current");if(n||(n=t.querySelector("li:first-child")),n){let r=n.querySelector("a");r&&(window.location.href=r.href),re(e)}}function ye(t,e){if(e==="")return t;let n=t.toLocaleLowerCase(),r=e.toLocaleLowerCase(),i=[],s=0,o=n.indexOf(r);for(;o!=-1;)i.push(ne(t.substring(s,o)),`<b>${ne(t.substring(o,o+r.length))}</b>`),s=o+r.length,o=n.indexOf(r,s);return i.push(ne(t.substring(s))),i.join("")}var Ge={"&":"&","<":"<",">":">","'":"'",'"':"""};function ne(t){return t.replace(/[&<>"'"]/g,e=>Ge[e])}var I=class{el;app;constructor(e){this.el=e.el,this.app=e.app}};var H="mousedown",Ee="mousemove",B="mouseup",X={x:0,y:0},xe=!1,ie=!1,Xe=!1,D=!1,be=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);document.documentElement.classList.add(be?"is-mobile":"not-mobile");be&&"ontouchstart"in document.documentElement&&(Xe=!0,H="touchstart",Ee="touchmove",B="touchend");document.addEventListener(H,t=>{ie=!0,D=!1;let e=H=="touchstart"?t.targetTouches[0]:t;X.y=e.pageY||0,X.x=e.pageX||0});document.addEventListener(Ee,t=>{if(ie&&!D){let e=H=="touchstart"?t.targetTouches[0]:t,n=X.x-(e.pageX||0),r=X.y-(e.pageY||0);D=Math.sqrt(n*n+r*r)>10}});document.addEventListener(B,()=>{ie=!1});document.addEventListener("click",t=>{xe&&(t.preventDefault(),t.stopImmediatePropagation(),xe=!1)});var Y=class extends I{active;className;constructor(e){super(e),this.className=this.el.dataset.toggle||"",this.el.addEventListener(B,n=>this.onPointerUp(n)),this.el.addEventListener("click",n=>n.preventDefault()),document.addEventListener(H,n=>this.onDocumentPointerDown(n)),document.addEventListener(B,n=>this.onDocumentPointerUp(n))}setActive(e){if(this.active==e)return;this.active=e,document.documentElement.classList.toggle("has-"+this.className,e),this.el.classList.toggle("active",e);let n=(this.active?"to-has-":"from-has-")+this.className;document.documentElement.classList.add(n),setTimeout(()=>document.documentElement.classList.remove(n),500)}onPointerUp(e){D||(this.setActive(!0),e.preventDefault())}onDocumentPointerDown(e){if(this.active){if(e.target.closest(".col-sidebar, .tsd-filter-group"))return;this.setActive(!1)}}onDocumentPointerUp(e){if(!D&&this.active&&e.target.closest(".col-sidebar")){let n=e.target.closest("a");if(n){let r=window.location.href;r.indexOf("#")!=-1&&(r=r.substring(0,r.indexOf("#"))),n.href.substring(0,r.length)==r&&setTimeout(()=>this.setActive(!1),250)}}}};var se;try{se=localStorage}catch{se={getItem(){return null},setItem(){}}}var C=se;var Le=document.head.appendChild(document.createElement("style"));Le.dataset.for="filters";var Z=class extends I{key;value;constructor(e){super(e),this.key=`filter-${this.el.name}`,this.value=this.el.checked,this.el.addEventListener("change",()=>{this.setLocalStorage(this.el.checked)}),this.setLocalStorage(this.fromLocalStorage()),Le.innerHTML+=`html:not(.${this.key}) .tsd-is-${this.el.name} { display: none; }
|
6 |
+
`,this.app.updateIndexVisibility()}fromLocalStorage(){let e=C.getItem(this.key);return e?e==="true":this.el.checked}setLocalStorage(e){C.setItem(this.key,e.toString()),this.value=e,this.handleValueChange()}handleValueChange(){this.el.checked=this.value,document.documentElement.classList.toggle(this.key,this.value),this.app.filterChanged(),this.app.updateIndexVisibility()}};var oe=new Map,ae=class{open;accordions=[];key;constructor(e,n){this.key=e,this.open=n}add(e){this.accordions.push(e),e.open=this.open,e.addEventListener("toggle",()=>{this.toggle(e.open)})}toggle(e){for(let n of this.accordions)n.open=e;C.setItem(this.key,e.toString())}},K=class extends I{constructor(e){super(e);let n=this.el.querySelector("summary"),r=n.querySelector("a");r&&r.addEventListener("click",()=>{location.assign(r.href)});let i=`tsd-accordion-${n.dataset.key??n.textContent.trim().replace(/\s+/g,"-").toLowerCase()}`,s;if(oe.has(i))s=oe.get(i);else{let o=C.getItem(i),a=o?o==="true":this.el.open;s=new ae(i,a),oe.set(i,s)}s.add(this.el)}};function Se(t){let e=C.getItem("tsd-theme")||"os";t.value=e,we(e),t.addEventListener("change",()=>{C.setItem("tsd-theme",t.value),we(t.value)})}function we(t){document.documentElement.dataset.theme=t}var ee;function Ce(){let t=document.getElementById("tsd-nav-script");t&&(t.addEventListener("load",Te),Te())}async function Te(){let t=document.getElementById("tsd-nav-container");if(!t||!window.navigationData)return;let e=await A(window.navigationData);ee=document.documentElement.dataset.base,ee.endsWith("/")||(ee+="/"),t.innerHTML="";for(let n of e)Ie(n,t,[]);window.app.createComponents(t),window.app.showPage(),window.app.ensureActivePageVisible()}function Ie(t,e,n){let r=e.appendChild(document.createElement("li"));if(t.children){let i=[...n,t.text],s=r.appendChild(document.createElement("details"));s.className=t.class?`${t.class} tsd-accordion`:"tsd-accordion";let o=s.appendChild(document.createElement("summary"));o.className="tsd-accordion-summary",o.dataset.key=i.join("$"),o.innerHTML='<svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="#icon-chevronDown"></use></svg>',ke(t,o);let a=s.appendChild(document.createElement("div"));a.className="tsd-accordion-details";let l=a.appendChild(document.createElement("ul"));l.className="tsd-nested-navigation";for(let c of t.children)Ie(c,l,i)}else ke(t,r,t.class)}function ke(t,e,n){if(t.path){let r=e.appendChild(document.createElement("a"));if(r.href=ee+t.path,n&&(r.className=n),location.pathname===r.pathname&&!r.href.includes("#")&&r.classList.add("current"),t.kind){let i=window.translations[`kind_${t.kind}`].replaceAll('"',""");r.innerHTML=`<svg width="20" height="20" viewBox="0 0 24 24" fill="none" class="tsd-kind-icon" aria-label="${i}"><use href="#icon-${t.kind}"></use></svg>`}r.appendChild(document.createElement("span")).textContent=t.text}else{let r=e.appendChild(document.createElement("span")),i=window.translations.folder.replaceAll('"',""");r.innerHTML=`<svg width="20" height="20" viewBox="0 0 24 24" fill="none" class="tsd-kind-icon" aria-label="${i}"><use href="#icon-folder"></use></svg>`,r.appendChild(document.createElement("span")).textContent=t.text}}var te=document.documentElement.dataset.base;te.endsWith("/")||(te+="/");function Pe(){document.querySelector(".tsd-full-hierarchy")?Ye():document.querySelector(".tsd-hierarchy")&&Ze()}function Ye(){document.addEventListener("click",r=>{let i=r.target;for(;i.parentElement&&i.parentElement.tagName!="LI";)i=i.parentElement;i.dataset.dropdown&&(i.dataset.dropdown=String(i.dataset.dropdown!=="true"))});let t=new Map,e=new Set;for(let r of document.querySelectorAll(".tsd-full-hierarchy [data-refl]")){let i=r.querySelector("ul");t.has(r.dataset.refl)?e.add(r.dataset.refl):i&&t.set(r.dataset.refl,i)}for(let r of e)n(r);function n(r){let i=t.get(r).cloneNode(!0);i.querySelectorAll("[id]").forEach(s=>{s.removeAttribute("id")}),i.querySelectorAll("[data-dropdown]").forEach(s=>{s.dataset.dropdown="false"});for(let s of document.querySelectorAll(`[data-refl="${r}"]`)){let o=tt(),a=s.querySelector("ul");s.insertBefore(o,a),o.dataset.dropdown=String(!!a),a||s.appendChild(i.cloneNode(!0))}}}function Ze(){let t=document.getElementById("tsd-hierarchy-script");t&&(t.addEventListener("load",Qe),Qe())}async function Qe(){let t=document.querySelector(".tsd-panel.tsd-hierarchy:has(h4 a)");if(!t||!window.hierarchyData)return;let e=+t.dataset.refl,n=await A(window.hierarchyData),r=t.querySelector("ul"),i=document.createElement("ul");if(i.classList.add("tsd-hierarchy"),Ke(i,n,e),r.querySelectorAll("li").length==i.querySelectorAll("li").length)return;let s=document.createElement("span");s.classList.add("tsd-hierarchy-toggle"),s.textContent=window.translations.hierarchy_expand,t.querySelector("h4 a")?.insertAdjacentElement("afterend",s),s.insertAdjacentText("beforebegin",", "),s.addEventListener("click",()=>{s.textContent===window.translations.hierarchy_expand?(r.insertAdjacentElement("afterend",i),r.remove(),s.textContent=window.translations.hierarchy_collapse):(i.insertAdjacentElement("afterend",r),i.remove(),s.textContent=window.translations.hierarchy_expand)})}function Ke(t,e,n){let r=e.roots.filter(i=>et(e,i,n));for(let i of r)t.appendChild(_e(e,i,n))}function _e(t,e,n,r=new Set){if(r.has(e))return;r.add(e);let i=t.reflections[e],s=document.createElement("li");if(s.classList.add("tsd-hierarchy-item"),e===n){let o=s.appendChild(document.createElement("span"));o.textContent=i.name,o.classList.add("tsd-hierarchy-target")}else{for(let a of i.uniqueNameParents||[]){let l=t.reflections[a],c=s.appendChild(document.createElement("a"));c.textContent=l.name,c.href=te+l.url,c.className=l.class+" tsd-signature-type",s.append(document.createTextNode("."))}let o=s.appendChild(document.createElement("a"));o.textContent=t.reflections[e].name,o.href=te+i.url,o.className=i.class+" tsd-signature-type"}if(i.children){let o=s.appendChild(document.createElement("ul"));o.classList.add("tsd-hierarchy");for(let a of i.children){let l=_e(t,a,n,r);l&&o.appendChild(l)}}return r.delete(e),s}function et(t,e,n){if(e===n)return!0;let r=new Set,i=[t.reflections[e]];for(;i.length;){let s=i.pop();if(!r.has(s)){r.add(s);for(let o of s.children||[]){if(o===n)return!0;i.push(t.reflections[o])}}}return!1}function tt(){let t=document.createElementNS("http://www.w3.org/2000/svg","svg");return t.setAttribute("width","20"),t.setAttribute("height","20"),t.setAttribute("viewBox","0 0 24 24"),t.setAttribute("fill","none"),t.innerHTML='<use href="#icon-chevronDown"></use>',t}G(Y,"a[data-toggle]");G(K,".tsd-accordion");G(Z,".tsd-filter-item input[type=checkbox]");var Oe=document.getElementById("tsd-theme");Oe&&Se(Oe);var nt=new J;Object.defineProperty(window,"app",{value:nt});ve();Ce();Pe();})();
|
7 |
+
/*! Bundled license information:
|
8 |
+
|
9 |
+
lunr/lunr.js:
|
10 |
+
(**
|
11 |
+
* lunr - http://lunrjs.com - A bit like Solr, but much smaller and not as bright - 2.3.9
|
12 |
+
* Copyright (C) 2020 Oliver Nightingale
|
13 |
+
* @license MIT
|
14 |
+
*)
|
15 |
+
(*!
|
16 |
+
* lunr.utils
|
17 |
+
* Copyright (C) 2020 Oliver Nightingale
|
18 |
+
*)
|
19 |
+
(*!
|
20 |
+
* lunr.Set
|
21 |
+
* Copyright (C) 2020 Oliver Nightingale
|
22 |
+
*)
|
23 |
+
(*!
|
24 |
+
* lunr.tokenizer
|
25 |
+
* Copyright (C) 2020 Oliver Nightingale
|
26 |
+
*)
|
27 |
+
(*!
|
28 |
+
* lunr.Pipeline
|
29 |
+
* Copyright (C) 2020 Oliver Nightingale
|
30 |
+
*)
|
31 |
+
(*!
|
32 |
+
* lunr.Vector
|
33 |
+
* Copyright (C) 2020 Oliver Nightingale
|
34 |
+
*)
|
35 |
+
(*!
|
36 |
+
* lunr.stemmer
|
37 |
+
* Copyright (C) 2020 Oliver Nightingale
|
38 |
+
* Includes code from - http://tartarus.org/~martin/PorterStemmer/js.txt
|
39 |
+
*)
|
40 |
+
(*!
|
41 |
+
* lunr.stopWordFilter
|
42 |
+
* Copyright (C) 2020 Oliver Nightingale
|
43 |
+
*)
|
44 |
+
(*!
|
45 |
+
* lunr.trimmer
|
46 |
+
* Copyright (C) 2020 Oliver Nightingale
|
47 |
+
*)
|
48 |
+
(*!
|
49 |
+
* lunr.TokenSet
|
50 |
+
* Copyright (C) 2020 Oliver Nightingale
|
51 |
+
*)
|
52 |
+
(*!
|
53 |
+
* lunr.Index
|
54 |
+
* Copyright (C) 2020 Oliver Nightingale
|
55 |
+
*)
|
56 |
+
(*!
|
57 |
+
* lunr.Builder
|
58 |
+
* Copyright (C) 2020 Oliver Nightingale
|
59 |
+
*)
|
60 |
+
*/
|
docs/docs/assets/navigation.js
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
window.navigationData = "eJyNkTELwjAUhP9L5qJYRKSjdXDQSXEpHZ5pNMWkLckrWKT/3Yg2aUiHjsndfRz3sjdB9kKSkBvljFISkQaQm7esi1Ywvfz9LzhKYcRnWRUkiSNCeSkKxSqSZBaxSw8uTwVo7fJG8xmreNvnfWTDBSAI6JgKK1hpVou9cR990NDFgawpLOUqPRieTXsJKTRAS+wc8d5WFMu6GjMDu8/erKfQV6a04cwk/90BeDwkqlajBPUMh7TSrCEvX/fJAw1DOpA1TV03/wATHdCC"
|
docs/docs/assets/search.js
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
window.searchData = "eJytm11v48YOhv+LemukmS/byV03LdAFToGDdtGbIDAUeZoVVrZcW243CPLfO6MPizSpmLJ9lciel6RGDzmURn5LtuW/u+T+8S35lq+Xyb2eJOt05ZP7pNrud9Uq3X5LJsl+W4RPVuVyX/jdj4dvbr5WqyJ8nRXpbueDmSR5n3SWlJ4fbH2Jit+grVYCbB3GMFYnySbd+nWFwgKubrU9+PLrrFzm6xexqx+A4oTPXgm8O9VPWlaud2F0VpVbuX8sOicENAH7nV/4LJP77wUX+975bOurReHXcvdIc3EEo878Sme99AEgv10EI7u8HHHqVHj5+a/PjIUKL45ls/WbbZkFgwut7fiQBvVXjcxNL4sM6S+OLBRZXyyq142XR4M050Sgb+38iOaxEF/Dc4PgWGSv4bm9mJ9X6csI/60qb1UXR1GU6XJkCFFyVf+/RZZ24wJYdZqzIujBS6u0SF99v3R2Hcfhmw87jmmfRS+++iP76lfpQ7pJs7x6PZj8a7/OqpCr0CgZ/XEL0sf5se8//RZVlQ9dt4PHe4Z91s/h+/+hGeyuX+/xMGa8K2mnM+RM1Okw4sEqnr5G/Nh2YzAGLLo4hq55XKy40jUYxbHs4jj+afh5ziuavINRYNHFMTxnXxdtGyGPAYuuEkPbVo2YiCPVOVGgSvq8z4vlp4dfR0QQFSGMa3hvpvOL/16NBNJXjeZKEXzK1+n2dWwMz53qSlH8P82++dEzselUV4rip12W52ODSFvRWTHAlIB3Rd2i2nwsvofnaG5NhK8+XkzaCMavJEcORAtIrxmqEb88POyqtKLl+thdOOgGjvAl6WmJp49b2dN+Brr2Yz8nmvXTfkLD8ntZMovMsacwcNsOvMDXL1n2iVvSGG/h+MOFTOzvtfJih+3Ycz3WVf/hNSty+tTi2GM9NuvGnn2Oi0357+mza0ed72X395bWXOqmHXa+n6KkT/qom2bU+V5W+0LgpRl1vpdl/o/ASzPqXC+h+p/00Yy5wANtxxkXw+23pNqdvurNmHM9ZD4vys3pBakbdsGZfMpfPq9PJ0sY+Zy/5OtL8iWsn6Hnr2JJ/VIK/baaWFur8loR/FQUMIjT9bbVpUUBA7mk9nZzEUv46MmIoivMRhX8rv+ottx+xbHr6C52Px/tVJz2uN6vnv02nm/ssoWuG1EdQBBdHENV1t2w+LzrNvgKXn/138U+v/rvIzw+TZLg0H9P7t+6O/EwQt+Ym7sg+Sv3xTLusjWhBIPlauVrcJZltq//fWqH/eljcxsHN6N/vE0mj7cTo25mc/X0NHnsxPUX9Qedjf6TWqiGhIoIFRLqcKQmZnozn98hoSZCjYQmHOmJnt9YNUVCQ4QGCW04MpxHS4QWCV04spzQEaFDwmk4cpxwSoRTJJyFoyknnBHhDAnn4WjGCedEOEfCQNDjnBPeEeEdBiDycMcpFWVHHcETkVC3rJjhBwOkaoIUyx5lSGGIVEQj3B5yYsqRwiCpiIdiUVKUJYVhUhERxeKkKE8KA6UiJopFSlGmFIZKRVTUlD1nypXCYKmIi2LRUpQtheFSERnF4qUoXwoDpm8Hw9aUMI0J02qoWmgKmD6qUDVgLNqaKVIYMF2XKRZtTQHTGDAdkdF8daSAaQyYjshozYopYBoDpiMymkVbU8A0BkxHZDSLtqaAaQyYjshoFm1NAdMYMB2R0WzF1BQwjQEzERnNom0oYAYDZmrAWLQNJcxgwkxkRrOEGUqYOVoHIzOGJcwwSyEmzNjBVZQCZjBgJiJjWDoNBcxgwMx0sPAaCpjBgJnZYMk3FDCDATMRGcPmhaGAGQyYicgYNi8MBcxgwGxExrB5YSlgFgNmIzKGzQtLAbMYMBuRMWxeWAqYxYDZGjA2LywFzB41W3W3xeaFZfotTJitCWPzwlLCLCbMRmYsmxeWEmYxYTYyY1m2LSXMYsJsZMayhFlKmMWE2ciM5ftTSpjFhLnIjOV7VEqYw4S5yIxlCXOUMIcJc5EZyxLmKGEOE+YiM5YlzFHCHCbMRWYsS5ijhLmjlr7u6VnCHNPVY8Jc3dezhDlKmMOEuciMYwlzlDCHCXORGccS5ihh7Uf1bWN8nuCXn5vbx3DXV28CviWL9oYyrCPtHexbEpaK+7f39/4GMhyBe8j4XXSDdzN7U6F7OJgKDYLU1GF3FljSwJKTWqp3oYCRO3BmWmbksEsKzFgQy0xupnuUDqba9ZZCuZZY6p7/9UYsCCeks8gI3NUCJwamp1Fq1fwNy77QLv/MDEQ7A9HK6GKfBwKLU2BRdlX5h2rA5ByYlJ06eJeot6NAaGrWTqnsEnX7ZsCYAsZ0e11k+JHXPnurIEKprRc0VSDFw0oktMBMOUgFJ0uFo+wGBmSlpt9sBRkJJtnI6ky3kwquFEgk1WaSEcYEt+FBZgIgjXB20LsNwBS44lp2wfALCsAUyGUjw5q89NtbA8bmI2w1b5CAoAAHeoSh+skruIbAyigj7QtWICCwnmpZxWv33EB2ABtWRlK7BwnQBgxZWVFrdxiBDbCCWll6tDu7wAYA0Mrmttu2BUYALVY4qWDHHhgC9cvI0gHtxANLYB22smzoX1kAZuAqLOM3mNnV73Rmh5dPAchgptRIe93OAjQHKFKy+QKvDAM7YLaUjCT45i8wBPJdyVKj3m4GyQVy3coWQfgCPAgFZKmSVelmWxrEAq6+lV0tfq8MrIsgKiebIPTKKjg/kP1alrlDv6jojQKeZDgN/RSiNwnCVLJExC/WgzMG1UHJaib8dRG4ruAaiMwcbUKCywlodTJa0UYuiAnMk5NGBbYpQUyAWiejFvzar7cDSL1tdLIsOvygDJRRkEciG+jVZLB6w0ZAYCncYW/yjS/ydZA8Pr2//weQ4nw4";
|
docs/docs/assets/style.css
ADDED
@@ -0,0 +1,1611 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
@layer typedoc {
|
2 |
+
:root {
|
3 |
+
/* Light */
|
4 |
+
--light-color-background: #f2f4f8;
|
5 |
+
--light-color-background-secondary: #eff0f1;
|
6 |
+
--light-color-warning-text: #222;
|
7 |
+
--light-color-background-warning: #e6e600;
|
8 |
+
--light-color-accent: #c5c7c9;
|
9 |
+
--light-color-active-menu-item: var(--light-color-accent);
|
10 |
+
--light-color-text: #222;
|
11 |
+
--light-color-text-aside: #6e6e6e;
|
12 |
+
|
13 |
+
--light-color-icon-background: var(--light-color-background);
|
14 |
+
--light-color-icon-text: var(--light-color-text);
|
15 |
+
|
16 |
+
--light-color-comment-tag-text: var(--light-color-text);
|
17 |
+
--light-color-comment-tag: var(--light-color-background);
|
18 |
+
|
19 |
+
--light-color-link: #1f70c2;
|
20 |
+
--light-color-focus-outline: #3584e4;
|
21 |
+
|
22 |
+
--light-color-ts-keyword: #056bd6;
|
23 |
+
--light-color-ts-project: #b111c9;
|
24 |
+
--light-color-ts-module: var(--light-color-ts-project);
|
25 |
+
--light-color-ts-namespace: var(--light-color-ts-project);
|
26 |
+
--light-color-ts-enum: #7e6f15;
|
27 |
+
--light-color-ts-enum-member: var(--light-color-ts-enum);
|
28 |
+
--light-color-ts-variable: #4760ec;
|
29 |
+
--light-color-ts-function: #572be7;
|
30 |
+
--light-color-ts-class: #1f70c2;
|
31 |
+
--light-color-ts-interface: #108024;
|
32 |
+
--light-color-ts-constructor: var(--light-color-ts-class);
|
33 |
+
--light-color-ts-property: #9f5f30;
|
34 |
+
--light-color-ts-method: #be3989;
|
35 |
+
--light-color-ts-reference: #ff4d82;
|
36 |
+
--light-color-ts-call-signature: var(--light-color-ts-method);
|
37 |
+
--light-color-ts-index-signature: var(--light-color-ts-property);
|
38 |
+
--light-color-ts-constructor-signature: var(
|
39 |
+
--light-color-ts-constructor
|
40 |
+
);
|
41 |
+
--light-color-ts-parameter: var(--light-color-ts-variable);
|
42 |
+
/* type literal not included as links will never be generated to it */
|
43 |
+
--light-color-ts-type-parameter: #a55c0e;
|
44 |
+
--light-color-ts-accessor: #c73c3c;
|
45 |
+
--light-color-ts-get-signature: var(--light-color-ts-accessor);
|
46 |
+
--light-color-ts-set-signature: var(--light-color-ts-accessor);
|
47 |
+
--light-color-ts-type-alias: #d51270;
|
48 |
+
/* reference not included as links will be colored with the kind that it points to */
|
49 |
+
--light-color-document: #000000;
|
50 |
+
|
51 |
+
--light-color-alert-note: #0969d9;
|
52 |
+
--light-color-alert-tip: #1a7f37;
|
53 |
+
--light-color-alert-important: #8250df;
|
54 |
+
--light-color-alert-warning: #9a6700;
|
55 |
+
--light-color-alert-caution: #cf222e;
|
56 |
+
|
57 |
+
--light-external-icon: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' width='10' height='10'><path fill-opacity='0' stroke='%23000' stroke-width='10' d='m43,35H5v60h60V57M45,5v10l10,10-30,30 20,20 30-30 10,10h10V5z'/></svg>");
|
58 |
+
--light-color-scheme: light;
|
59 |
+
|
60 |
+
/* Dark */
|
61 |
+
--dark-color-background: #2b2e33;
|
62 |
+
--dark-color-background-secondary: #1e2024;
|
63 |
+
--dark-color-background-warning: #bebe00;
|
64 |
+
--dark-color-warning-text: #222;
|
65 |
+
--dark-color-accent: #9096a2;
|
66 |
+
--dark-color-active-menu-item: #5d5d6a;
|
67 |
+
--dark-color-text: #f5f5f5;
|
68 |
+
--dark-color-text-aside: #dddddd;
|
69 |
+
|
70 |
+
--dark-color-icon-background: var(--dark-color-background-secondary);
|
71 |
+
--dark-color-icon-text: var(--dark-color-text);
|
72 |
+
|
73 |
+
--dark-color-comment-tag-text: var(--dark-color-text);
|
74 |
+
--dark-color-comment-tag: var(--dark-color-background);
|
75 |
+
|
76 |
+
--dark-color-link: #00aff4;
|
77 |
+
--dark-color-focus-outline: #4c97f2;
|
78 |
+
|
79 |
+
--dark-color-ts-keyword: #3399ff;
|
80 |
+
--dark-color-ts-project: #e358ff;
|
81 |
+
--dark-color-ts-module: var(--dark-color-ts-project);
|
82 |
+
--dark-color-ts-namespace: var(--dark-color-ts-project);
|
83 |
+
--dark-color-ts-enum: #f4d93e;
|
84 |
+
--dark-color-ts-enum-member: var(--dark-color-ts-enum);
|
85 |
+
--dark-color-ts-variable: #798dff;
|
86 |
+
--dark-color-ts-function: #a280ff;
|
87 |
+
--dark-color-ts-class: #8ac4ff;
|
88 |
+
--dark-color-ts-interface: #6cff87;
|
89 |
+
--dark-color-ts-constructor: var(--dark-color-ts-class);
|
90 |
+
--dark-color-ts-property: #ff984d;
|
91 |
+
--dark-color-ts-method: #ff4db8;
|
92 |
+
--dark-color-ts-reference: #ff4d82;
|
93 |
+
--dark-color-ts-call-signature: var(--dark-color-ts-method);
|
94 |
+
--dark-color-ts-index-signature: var(--dark-color-ts-property);
|
95 |
+
--dark-color-ts-constructor-signature: var(--dark-color-ts-constructor);
|
96 |
+
--dark-color-ts-parameter: var(--dark-color-ts-variable);
|
97 |
+
/* type literal not included as links will never be generated to it */
|
98 |
+
--dark-color-ts-type-parameter: #e07d13;
|
99 |
+
--dark-color-ts-accessor: #ff6060;
|
100 |
+
--dark-color-ts-get-signature: var(--dark-color-ts-accessor);
|
101 |
+
--dark-color-ts-set-signature: var(--dark-color-ts-accessor);
|
102 |
+
--dark-color-ts-type-alias: #ff6492;
|
103 |
+
/* reference not included as links will be colored with the kind that it points to */
|
104 |
+
--dark-color-document: #ffffff;
|
105 |
+
|
106 |
+
--dark-color-alert-note: #0969d9;
|
107 |
+
--dark-color-alert-tip: #1a7f37;
|
108 |
+
--dark-color-alert-important: #8250df;
|
109 |
+
--dark-color-alert-warning: #9a6700;
|
110 |
+
--dark-color-alert-caution: #cf222e;
|
111 |
+
|
112 |
+
--dark-external-icon: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' width='10' height='10'><path fill-opacity='0' stroke='%23fff' stroke-width='10' d='m43,35H5v60h60V57M45,5v10l10,10-30,30 20,20 30-30 10,10h10V5z'/></svg>");
|
113 |
+
--dark-color-scheme: dark;
|
114 |
+
}
|
115 |
+
|
116 |
+
@media (prefers-color-scheme: light) {
|
117 |
+
:root {
|
118 |
+
--color-background: var(--light-color-background);
|
119 |
+
--color-background-secondary: var(
|
120 |
+
--light-color-background-secondary
|
121 |
+
);
|
122 |
+
--color-background-warning: var(--light-color-background-warning);
|
123 |
+
--color-warning-text: var(--light-color-warning-text);
|
124 |
+
--color-accent: var(--light-color-accent);
|
125 |
+
--color-active-menu-item: var(--light-color-active-menu-item);
|
126 |
+
--color-text: var(--light-color-text);
|
127 |
+
--color-text-aside: var(--light-color-text-aside);
|
128 |
+
|
129 |
+
--color-icon-background: var(--light-color-icon-background);
|
130 |
+
--color-icon-text: var(--light-color-icon-text);
|
131 |
+
|
132 |
+
--color-comment-tag-text: var(--light-color-text);
|
133 |
+
--color-comment-tag: var(--light-color-background);
|
134 |
+
|
135 |
+
--color-link: var(--light-color-link);
|
136 |
+
--color-focus-outline: var(--light-color-focus-outline);
|
137 |
+
|
138 |
+
--color-ts-keyword: var(--light-color-ts-keyword);
|
139 |
+
--color-ts-project: var(--light-color-ts-project);
|
140 |
+
--color-ts-module: var(--light-color-ts-module);
|
141 |
+
--color-ts-namespace: var(--light-color-ts-namespace);
|
142 |
+
--color-ts-enum: var(--light-color-ts-enum);
|
143 |
+
--color-ts-enum-member: var(--light-color-ts-enum-member);
|
144 |
+
--color-ts-variable: var(--light-color-ts-variable);
|
145 |
+
--color-ts-function: var(--light-color-ts-function);
|
146 |
+
--color-ts-class: var(--light-color-ts-class);
|
147 |
+
--color-ts-interface: var(--light-color-ts-interface);
|
148 |
+
--color-ts-constructor: var(--light-color-ts-constructor);
|
149 |
+
--color-ts-property: var(--light-color-ts-property);
|
150 |
+
--color-ts-method: var(--light-color-ts-method);
|
151 |
+
--color-ts-reference: var(--light-color-ts-reference);
|
152 |
+
--color-ts-call-signature: var(--light-color-ts-call-signature);
|
153 |
+
--color-ts-index-signature: var(--light-color-ts-index-signature);
|
154 |
+
--color-ts-constructor-signature: var(
|
155 |
+
--light-color-ts-constructor-signature
|
156 |
+
);
|
157 |
+
--color-ts-parameter: var(--light-color-ts-parameter);
|
158 |
+
--color-ts-type-parameter: var(--light-color-ts-type-parameter);
|
159 |
+
--color-ts-accessor: var(--light-color-ts-accessor);
|
160 |
+
--color-ts-get-signature: var(--light-color-ts-get-signature);
|
161 |
+
--color-ts-set-signature: var(--light-color-ts-set-signature);
|
162 |
+
--color-ts-type-alias: var(--light-color-ts-type-alias);
|
163 |
+
--color-document: var(--light-color-document);
|
164 |
+
|
165 |
+
--color-alert-note: var(--light-color-alert-note);
|
166 |
+
--color-alert-tip: var(--light-color-alert-tip);
|
167 |
+
--color-alert-important: var(--light-color-alert-important);
|
168 |
+
--color-alert-warning: var(--light-color-alert-warning);
|
169 |
+
--color-alert-caution: var(--light-color-alert-caution);
|
170 |
+
|
171 |
+
--external-icon: var(--light-external-icon);
|
172 |
+
--color-scheme: var(--light-color-scheme);
|
173 |
+
}
|
174 |
+
}
|
175 |
+
|
176 |
+
@media (prefers-color-scheme: dark) {
|
177 |
+
:root {
|
178 |
+
--color-background: var(--dark-color-background);
|
179 |
+
--color-background-secondary: var(
|
180 |
+
--dark-color-background-secondary
|
181 |
+
);
|
182 |
+
--color-background-warning: var(--dark-color-background-warning);
|
183 |
+
--color-warning-text: var(--dark-color-warning-text);
|
184 |
+
--color-accent: var(--dark-color-accent);
|
185 |
+
--color-active-menu-item: var(--dark-color-active-menu-item);
|
186 |
+
--color-text: var(--dark-color-text);
|
187 |
+
--color-text-aside: var(--dark-color-text-aside);
|
188 |
+
|
189 |
+
--color-icon-background: var(--dark-color-icon-background);
|
190 |
+
--color-icon-text: var(--dark-color-icon-text);
|
191 |
+
|
192 |
+
--color-comment-tag-text: var(--dark-color-text);
|
193 |
+
--color-comment-tag: var(--dark-color-background);
|
194 |
+
|
195 |
+
--color-link: var(--dark-color-link);
|
196 |
+
--color-focus-outline: var(--dark-color-focus-outline);
|
197 |
+
|
198 |
+
--color-ts-keyword: var(--dark-color-ts-keyword);
|
199 |
+
--color-ts-project: var(--dark-color-ts-project);
|
200 |
+
--color-ts-module: var(--dark-color-ts-module);
|
201 |
+
--color-ts-namespace: var(--dark-color-ts-namespace);
|
202 |
+
--color-ts-enum: var(--dark-color-ts-enum);
|
203 |
+
--color-ts-enum-member: var(--dark-color-ts-enum-member);
|
204 |
+
--color-ts-variable: var(--dark-color-ts-variable);
|
205 |
+
--color-ts-function: var(--dark-color-ts-function);
|
206 |
+
--color-ts-class: var(--dark-color-ts-class);
|
207 |
+
--color-ts-interface: var(--dark-color-ts-interface);
|
208 |
+
--color-ts-constructor: var(--dark-color-ts-constructor);
|
209 |
+
--color-ts-property: var(--dark-color-ts-property);
|
210 |
+
--color-ts-method: var(--dark-color-ts-method);
|
211 |
+
--color-ts-reference: var(--dark-color-ts-reference);
|
212 |
+
--color-ts-call-signature: var(--dark-color-ts-call-signature);
|
213 |
+
--color-ts-index-signature: var(--dark-color-ts-index-signature);
|
214 |
+
--color-ts-constructor-signature: var(
|
215 |
+
--dark-color-ts-constructor-signature
|
216 |
+
);
|
217 |
+
--color-ts-parameter: var(--dark-color-ts-parameter);
|
218 |
+
--color-ts-type-parameter: var(--dark-color-ts-type-parameter);
|
219 |
+
--color-ts-accessor: var(--dark-color-ts-accessor);
|
220 |
+
--color-ts-get-signature: var(--dark-color-ts-get-signature);
|
221 |
+
--color-ts-set-signature: var(--dark-color-ts-set-signature);
|
222 |
+
--color-ts-type-alias: var(--dark-color-ts-type-alias);
|
223 |
+
--color-document: var(--dark-color-document);
|
224 |
+
|
225 |
+
--color-alert-note: var(--dark-color-alert-note);
|
226 |
+
--color-alert-tip: var(--dark-color-alert-tip);
|
227 |
+
--color-alert-important: var(--dark-color-alert-important);
|
228 |
+
--color-alert-warning: var(--dark-color-alert-warning);
|
229 |
+
--color-alert-caution: var(--dark-color-alert-caution);
|
230 |
+
|
231 |
+
--external-icon: var(--dark-external-icon);
|
232 |
+
--color-scheme: var(--dark-color-scheme);
|
233 |
+
}
|
234 |
+
}
|
235 |
+
|
236 |
+
html {
|
237 |
+
color-scheme: var(--color-scheme);
|
238 |
+
}
|
239 |
+
|
240 |
+
body {
|
241 |
+
margin: 0;
|
242 |
+
}
|
243 |
+
|
244 |
+
:root[data-theme="light"] {
|
245 |
+
--color-background: var(--light-color-background);
|
246 |
+
--color-background-secondary: var(--light-color-background-secondary);
|
247 |
+
--color-background-warning: var(--light-color-background-warning);
|
248 |
+
--color-warning-text: var(--light-color-warning-text);
|
249 |
+
--color-icon-background: var(--light-color-icon-background);
|
250 |
+
--color-accent: var(--light-color-accent);
|
251 |
+
--color-active-menu-item: var(--light-color-active-menu-item);
|
252 |
+
--color-text: var(--light-color-text);
|
253 |
+
--color-text-aside: var(--light-color-text-aside);
|
254 |
+
--color-icon-text: var(--light-color-icon-text);
|
255 |
+
|
256 |
+
--color-comment-tag-text: var(--light-color-text);
|
257 |
+
--color-comment-tag: var(--light-color-background);
|
258 |
+
|
259 |
+
--color-link: var(--light-color-link);
|
260 |
+
--color-focus-outline: var(--light-color-focus-outline);
|
261 |
+
|
262 |
+
--color-ts-keyword: var(--light-color-ts-keyword);
|
263 |
+
--color-ts-project: var(--light-color-ts-project);
|
264 |
+
--color-ts-module: var(--light-color-ts-module);
|
265 |
+
--color-ts-namespace: var(--light-color-ts-namespace);
|
266 |
+
--color-ts-enum: var(--light-color-ts-enum);
|
267 |
+
--color-ts-enum-member: var(--light-color-ts-enum-member);
|
268 |
+
--color-ts-variable: var(--light-color-ts-variable);
|
269 |
+
--color-ts-function: var(--light-color-ts-function);
|
270 |
+
--color-ts-class: var(--light-color-ts-class);
|
271 |
+
--color-ts-interface: var(--light-color-ts-interface);
|
272 |
+
--color-ts-constructor: var(--light-color-ts-constructor);
|
273 |
+
--color-ts-property: var(--light-color-ts-property);
|
274 |
+
--color-ts-method: var(--light-color-ts-method);
|
275 |
+
--color-ts-reference: var(--light-color-ts-reference);
|
276 |
+
--color-ts-call-signature: var(--light-color-ts-call-signature);
|
277 |
+
--color-ts-index-signature: var(--light-color-ts-index-signature);
|
278 |
+
--color-ts-constructor-signature: var(
|
279 |
+
--light-color-ts-constructor-signature
|
280 |
+
);
|
281 |
+
--color-ts-parameter: var(--light-color-ts-parameter);
|
282 |
+
--color-ts-type-parameter: var(--light-color-ts-type-parameter);
|
283 |
+
--color-ts-accessor: var(--light-color-ts-accessor);
|
284 |
+
--color-ts-get-signature: var(--light-color-ts-get-signature);
|
285 |
+
--color-ts-set-signature: var(--light-color-ts-set-signature);
|
286 |
+
--color-ts-type-alias: var(--light-color-ts-type-alias);
|
287 |
+
--color-document: var(--light-color-document);
|
288 |
+
|
289 |
+
--color-note: var(--light-color-note);
|
290 |
+
--color-tip: var(--light-color-tip);
|
291 |
+
--color-important: var(--light-color-important);
|
292 |
+
--color-warning: var(--light-color-warning);
|
293 |
+
--color-caution: var(--light-color-caution);
|
294 |
+
|
295 |
+
--external-icon: var(--light-external-icon);
|
296 |
+
--color-scheme: var(--light-color-scheme);
|
297 |
+
}
|
298 |
+
|
299 |
+
:root[data-theme="dark"] {
|
300 |
+
--color-background: var(--dark-color-background);
|
301 |
+
--color-background-secondary: var(--dark-color-background-secondary);
|
302 |
+
--color-background-warning: var(--dark-color-background-warning);
|
303 |
+
--color-warning-text: var(--dark-color-warning-text);
|
304 |
+
--color-icon-background: var(--dark-color-icon-background);
|
305 |
+
--color-accent: var(--dark-color-accent);
|
306 |
+
--color-active-menu-item: var(--dark-color-active-menu-item);
|
307 |
+
--color-text: var(--dark-color-text);
|
308 |
+
--color-text-aside: var(--dark-color-text-aside);
|
309 |
+
--color-icon-text: var(--dark-color-icon-text);
|
310 |
+
|
311 |
+
--color-comment-tag-text: var(--dark-color-text);
|
312 |
+
--color-comment-tag: var(--dark-color-background);
|
313 |
+
|
314 |
+
--color-link: var(--dark-color-link);
|
315 |
+
--color-focus-outline: var(--dark-color-focus-outline);
|
316 |
+
|
317 |
+
--color-ts-keyword: var(--dark-color-ts-keyword);
|
318 |
+
--color-ts-project: var(--dark-color-ts-project);
|
319 |
+
--color-ts-module: var(--dark-color-ts-module);
|
320 |
+
--color-ts-namespace: var(--dark-color-ts-namespace);
|
321 |
+
--color-ts-enum: var(--dark-color-ts-enum);
|
322 |
+
--color-ts-enum-member: var(--dark-color-ts-enum-member);
|
323 |
+
--color-ts-variable: var(--dark-color-ts-variable);
|
324 |
+
--color-ts-function: var(--dark-color-ts-function);
|
325 |
+
--color-ts-class: var(--dark-color-ts-class);
|
326 |
+
--color-ts-interface: var(--dark-color-ts-interface);
|
327 |
+
--color-ts-constructor: var(--dark-color-ts-constructor);
|
328 |
+
--color-ts-property: var(--dark-color-ts-property);
|
329 |
+
--color-ts-method: var(--dark-color-ts-method);
|
330 |
+
--color-ts-reference: var(--dark-color-ts-reference);
|
331 |
+
--color-ts-call-signature: var(--dark-color-ts-call-signature);
|
332 |
+
--color-ts-index-signature: var(--dark-color-ts-index-signature);
|
333 |
+
--color-ts-constructor-signature: var(
|
334 |
+
--dark-color-ts-constructor-signature
|
335 |
+
);
|
336 |
+
--color-ts-parameter: var(--dark-color-ts-parameter);
|
337 |
+
--color-ts-type-parameter: var(--dark-color-ts-type-parameter);
|
338 |
+
--color-ts-accessor: var(--dark-color-ts-accessor);
|
339 |
+
--color-ts-get-signature: var(--dark-color-ts-get-signature);
|
340 |
+
--color-ts-set-signature: var(--dark-color-ts-set-signature);
|
341 |
+
--color-ts-type-alias: var(--dark-color-ts-type-alias);
|
342 |
+
--color-document: var(--dark-color-document);
|
343 |
+
|
344 |
+
--color-note: var(--dark-color-note);
|
345 |
+
--color-tip: var(--dark-color-tip);
|
346 |
+
--color-important: var(--dark-color-important);
|
347 |
+
--color-warning: var(--dark-color-warning);
|
348 |
+
--color-caution: var(--dark-color-caution);
|
349 |
+
|
350 |
+
--external-icon: var(--dark-external-icon);
|
351 |
+
--color-scheme: var(--dark-color-scheme);
|
352 |
+
}
|
353 |
+
|
354 |
+
*:focus-visible,
|
355 |
+
.tsd-accordion-summary:focus-visible svg {
|
356 |
+
outline: 2px solid var(--color-focus-outline);
|
357 |
+
}
|
358 |
+
|
359 |
+
.always-visible,
|
360 |
+
.always-visible .tsd-signatures {
|
361 |
+
display: inherit !important;
|
362 |
+
}
|
363 |
+
|
364 |
+
h1,
|
365 |
+
h2,
|
366 |
+
h3,
|
367 |
+
h4,
|
368 |
+
h5,
|
369 |
+
h6 {
|
370 |
+
line-height: 1.2;
|
371 |
+
}
|
372 |
+
|
373 |
+
h1 {
|
374 |
+
font-size: 1.875rem;
|
375 |
+
margin: 0.67rem 0;
|
376 |
+
}
|
377 |
+
|
378 |
+
h2 {
|
379 |
+
font-size: 1.5rem;
|
380 |
+
margin: 0.83rem 0;
|
381 |
+
}
|
382 |
+
|
383 |
+
h3 {
|
384 |
+
font-size: 1.25rem;
|
385 |
+
margin: 1rem 0;
|
386 |
+
}
|
387 |
+
|
388 |
+
h4 {
|
389 |
+
font-size: 1.05rem;
|
390 |
+
margin: 1.33rem 0;
|
391 |
+
}
|
392 |
+
|
393 |
+
h5 {
|
394 |
+
font-size: 1rem;
|
395 |
+
margin: 1.5rem 0;
|
396 |
+
}
|
397 |
+
|
398 |
+
h6 {
|
399 |
+
font-size: 0.875rem;
|
400 |
+
margin: 2.33rem 0;
|
401 |
+
}
|
402 |
+
|
403 |
+
dl,
|
404 |
+
menu,
|
405 |
+
ol,
|
406 |
+
ul {
|
407 |
+
margin: 1em 0;
|
408 |
+
}
|
409 |
+
|
410 |
+
dd {
|
411 |
+
margin: 0 0 0 34px;
|
412 |
+
}
|
413 |
+
|
414 |
+
.container {
|
415 |
+
max-width: 1700px;
|
416 |
+
padding: 0 2rem;
|
417 |
+
}
|
418 |
+
|
419 |
+
/* Footer */
|
420 |
+
footer {
|
421 |
+
border-top: 1px solid var(--color-accent);
|
422 |
+
padding-top: 1rem;
|
423 |
+
padding-bottom: 1rem;
|
424 |
+
max-height: 3.5rem;
|
425 |
+
}
|
426 |
+
footer > p {
|
427 |
+
margin: 0 1em;
|
428 |
+
}
|
429 |
+
|
430 |
+
.container-main {
|
431 |
+
margin: 0 auto;
|
432 |
+
/* toolbar, footer, margin */
|
433 |
+
min-height: calc(100vh - 41px - 56px - 4rem);
|
434 |
+
}
|
435 |
+
|
436 |
+
@keyframes fade-in {
|
437 |
+
from {
|
438 |
+
opacity: 0;
|
439 |
+
}
|
440 |
+
to {
|
441 |
+
opacity: 1;
|
442 |
+
}
|
443 |
+
}
|
444 |
+
@keyframes fade-out {
|
445 |
+
from {
|
446 |
+
opacity: 1;
|
447 |
+
visibility: visible;
|
448 |
+
}
|
449 |
+
to {
|
450 |
+
opacity: 0;
|
451 |
+
}
|
452 |
+
}
|
453 |
+
@keyframes fade-in-delayed {
|
454 |
+
0% {
|
455 |
+
opacity: 0;
|
456 |
+
}
|
457 |
+
33% {
|
458 |
+
opacity: 0;
|
459 |
+
}
|
460 |
+
100% {
|
461 |
+
opacity: 1;
|
462 |
+
}
|
463 |
+
}
|
464 |
+
@keyframes fade-out-delayed {
|
465 |
+
0% {
|
466 |
+
opacity: 1;
|
467 |
+
visibility: visible;
|
468 |
+
}
|
469 |
+
66% {
|
470 |
+
opacity: 0;
|
471 |
+
}
|
472 |
+
100% {
|
473 |
+
opacity: 0;
|
474 |
+
}
|
475 |
+
}
|
476 |
+
@keyframes pop-in-from-right {
|
477 |
+
from {
|
478 |
+
transform: translate(100%, 0);
|
479 |
+
}
|
480 |
+
to {
|
481 |
+
transform: translate(0, 0);
|
482 |
+
}
|
483 |
+
}
|
484 |
+
@keyframes pop-out-to-right {
|
485 |
+
from {
|
486 |
+
transform: translate(0, 0);
|
487 |
+
visibility: visible;
|
488 |
+
}
|
489 |
+
to {
|
490 |
+
transform: translate(100%, 0);
|
491 |
+
}
|
492 |
+
}
|
493 |
+
body {
|
494 |
+
background: var(--color-background);
|
495 |
+
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans",
|
496 |
+
Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
|
497 |
+
font-size: 16px;
|
498 |
+
color: var(--color-text);
|
499 |
+
}
|
500 |
+
|
501 |
+
a {
|
502 |
+
color: var(--color-link);
|
503 |
+
text-decoration: none;
|
504 |
+
}
|
505 |
+
a:hover {
|
506 |
+
text-decoration: underline;
|
507 |
+
}
|
508 |
+
a.external[target="_blank"] {
|
509 |
+
background-image: var(--external-icon);
|
510 |
+
background-position: top 3px right;
|
511 |
+
background-repeat: no-repeat;
|
512 |
+
padding-right: 13px;
|
513 |
+
}
|
514 |
+
a.tsd-anchor-link {
|
515 |
+
color: var(--color-text);
|
516 |
+
}
|
517 |
+
|
518 |
+
code,
|
519 |
+
pre {
|
520 |
+
font-family: Menlo, Monaco, Consolas, "Courier New", monospace;
|
521 |
+
padding: 0.2em;
|
522 |
+
margin: 0;
|
523 |
+
font-size: 0.875rem;
|
524 |
+
border-radius: 0.8em;
|
525 |
+
}
|
526 |
+
|
527 |
+
pre {
|
528 |
+
position: relative;
|
529 |
+
white-space: pre-wrap;
|
530 |
+
word-wrap: break-word;
|
531 |
+
padding: 10px;
|
532 |
+
border: 1px solid var(--color-accent);
|
533 |
+
margin-bottom: 8px;
|
534 |
+
}
|
535 |
+
pre code {
|
536 |
+
padding: 0;
|
537 |
+
font-size: 100%;
|
538 |
+
}
|
539 |
+
pre > button {
|
540 |
+
position: absolute;
|
541 |
+
top: 10px;
|
542 |
+
right: 10px;
|
543 |
+
opacity: 0;
|
544 |
+
transition: opacity 0.1s;
|
545 |
+
box-sizing: border-box;
|
546 |
+
}
|
547 |
+
pre:hover > button,
|
548 |
+
pre > button.visible {
|
549 |
+
opacity: 1;
|
550 |
+
}
|
551 |
+
|
552 |
+
blockquote {
|
553 |
+
margin: 1em 0;
|
554 |
+
padding-left: 1em;
|
555 |
+
border-left: 4px solid gray;
|
556 |
+
}
|
557 |
+
|
558 |
+
.tsd-typography {
|
559 |
+
line-height: 1.333em;
|
560 |
+
}
|
561 |
+
.tsd-typography ul {
|
562 |
+
list-style: square;
|
563 |
+
padding: 0 0 0 20px;
|
564 |
+
margin: 0;
|
565 |
+
}
|
566 |
+
.tsd-typography .tsd-index-panel h3,
|
567 |
+
.tsd-index-panel .tsd-typography h3,
|
568 |
+
.tsd-typography h4,
|
569 |
+
.tsd-typography h5,
|
570 |
+
.tsd-typography h6 {
|
571 |
+
font-size: 1em;
|
572 |
+
}
|
573 |
+
.tsd-typography h5,
|
574 |
+
.tsd-typography h6 {
|
575 |
+
font-weight: normal;
|
576 |
+
}
|
577 |
+
.tsd-typography p,
|
578 |
+
.tsd-typography ul,
|
579 |
+
.tsd-typography ol {
|
580 |
+
margin: 1em 0;
|
581 |
+
}
|
582 |
+
.tsd-typography table {
|
583 |
+
border-collapse: collapse;
|
584 |
+
border: none;
|
585 |
+
}
|
586 |
+
.tsd-typography td,
|
587 |
+
.tsd-typography th {
|
588 |
+
padding: 6px 13px;
|
589 |
+
border: 1px solid var(--color-accent);
|
590 |
+
}
|
591 |
+
.tsd-typography thead,
|
592 |
+
.tsd-typography tr:nth-child(even) {
|
593 |
+
background-color: var(--color-background-secondary);
|
594 |
+
}
|
595 |
+
|
596 |
+
.tsd-alert {
|
597 |
+
padding: 8px 16px;
|
598 |
+
margin-bottom: 16px;
|
599 |
+
border-left: 0.25em solid var(--alert-color);
|
600 |
+
}
|
601 |
+
.tsd-alert blockquote > :last-child,
|
602 |
+
.tsd-alert > :last-child {
|
603 |
+
margin-bottom: 0;
|
604 |
+
}
|
605 |
+
.tsd-alert-title {
|
606 |
+
color: var(--alert-color);
|
607 |
+
display: inline-flex;
|
608 |
+
align-items: center;
|
609 |
+
}
|
610 |
+
.tsd-alert-title span {
|
611 |
+
margin-left: 4px;
|
612 |
+
}
|
613 |
+
|
614 |
+
.tsd-alert-note {
|
615 |
+
--alert-color: var(--color-alert-note);
|
616 |
+
}
|
617 |
+
.tsd-alert-tip {
|
618 |
+
--alert-color: var(--color-alert-tip);
|
619 |
+
}
|
620 |
+
.tsd-alert-important {
|
621 |
+
--alert-color: var(--color-alert-important);
|
622 |
+
}
|
623 |
+
.tsd-alert-warning {
|
624 |
+
--alert-color: var(--color-alert-warning);
|
625 |
+
}
|
626 |
+
.tsd-alert-caution {
|
627 |
+
--alert-color: var(--color-alert-caution);
|
628 |
+
}
|
629 |
+
|
630 |
+
.tsd-breadcrumb {
|
631 |
+
margin: 0;
|
632 |
+
padding: 0;
|
633 |
+
color: var(--color-text-aside);
|
634 |
+
}
|
635 |
+
.tsd-breadcrumb a {
|
636 |
+
color: var(--color-text-aside);
|
637 |
+
text-decoration: none;
|
638 |
+
}
|
639 |
+
.tsd-breadcrumb a:hover {
|
640 |
+
text-decoration: underline;
|
641 |
+
}
|
642 |
+
.tsd-breadcrumb li {
|
643 |
+
display: inline;
|
644 |
+
}
|
645 |
+
.tsd-breadcrumb li:after {
|
646 |
+
content: " / ";
|
647 |
+
}
|
648 |
+
|
649 |
+
.tsd-comment-tags {
|
650 |
+
display: flex;
|
651 |
+
flex-direction: column;
|
652 |
+
}
|
653 |
+
dl.tsd-comment-tag-group {
|
654 |
+
display: flex;
|
655 |
+
align-items: center;
|
656 |
+
overflow: hidden;
|
657 |
+
margin: 0.5em 0;
|
658 |
+
}
|
659 |
+
dl.tsd-comment-tag-group dt {
|
660 |
+
display: flex;
|
661 |
+
margin-right: 0.5em;
|
662 |
+
font-size: 0.875em;
|
663 |
+
font-weight: normal;
|
664 |
+
}
|
665 |
+
dl.tsd-comment-tag-group dd {
|
666 |
+
margin: 0;
|
667 |
+
}
|
668 |
+
code.tsd-tag {
|
669 |
+
padding: 0.25em 0.4em;
|
670 |
+
border: 0.1em solid var(--color-accent);
|
671 |
+
margin-right: 0.25em;
|
672 |
+
font-size: 70%;
|
673 |
+
}
|
674 |
+
h1 code.tsd-tag:first-of-type {
|
675 |
+
margin-left: 0.25em;
|
676 |
+
}
|
677 |
+
|
678 |
+
dl.tsd-comment-tag-group dd:before,
|
679 |
+
dl.tsd-comment-tag-group dd:after {
|
680 |
+
content: " ";
|
681 |
+
}
|
682 |
+
dl.tsd-comment-tag-group dd pre,
|
683 |
+
dl.tsd-comment-tag-group dd:after {
|
684 |
+
clear: both;
|
685 |
+
}
|
686 |
+
dl.tsd-comment-tag-group p {
|
687 |
+
margin: 0;
|
688 |
+
}
|
689 |
+
|
690 |
+
.tsd-panel.tsd-comment .lead {
|
691 |
+
font-size: 1.1em;
|
692 |
+
line-height: 1.333em;
|
693 |
+
margin-bottom: 2em;
|
694 |
+
}
|
695 |
+
.tsd-panel.tsd-comment .lead:last-child {
|
696 |
+
margin-bottom: 0;
|
697 |
+
}
|
698 |
+
|
699 |
+
.tsd-filter-visibility h4 {
|
700 |
+
font-size: 1rem;
|
701 |
+
padding-top: 0.75rem;
|
702 |
+
padding-bottom: 0.5rem;
|
703 |
+
margin: 0;
|
704 |
+
}
|
705 |
+
.tsd-filter-item:not(:last-child) {
|
706 |
+
margin-bottom: 0.5rem;
|
707 |
+
}
|
708 |
+
.tsd-filter-input {
|
709 |
+
display: flex;
|
710 |
+
width: -moz-fit-content;
|
711 |
+
width: fit-content;
|
712 |
+
align-items: center;
|
713 |
+
-webkit-user-select: none;
|
714 |
+
-moz-user-select: none;
|
715 |
+
-ms-user-select: none;
|
716 |
+
user-select: none;
|
717 |
+
cursor: pointer;
|
718 |
+
}
|
719 |
+
.tsd-filter-input input[type="checkbox"] {
|
720 |
+
cursor: pointer;
|
721 |
+
position: absolute;
|
722 |
+
width: 1.5em;
|
723 |
+
height: 1.5em;
|
724 |
+
opacity: 0;
|
725 |
+
}
|
726 |
+
.tsd-filter-input input[type="checkbox"]:disabled {
|
727 |
+
pointer-events: none;
|
728 |
+
}
|
729 |
+
.tsd-filter-input svg {
|
730 |
+
cursor: pointer;
|
731 |
+
width: 1.5em;
|
732 |
+
height: 1.5em;
|
733 |
+
margin-right: 0.5em;
|
734 |
+
border-radius: 0.33em;
|
735 |
+
/* Leaving this at full opacity breaks event listeners on Firefox.
|
736 |
+
Don't remove unless you know what you're doing. */
|
737 |
+
opacity: 0.99;
|
738 |
+
}
|
739 |
+
.tsd-filter-input input[type="checkbox"]:focus-visible + svg {
|
740 |
+
outline: 2px solid var(--color-focus-outline);
|
741 |
+
}
|
742 |
+
.tsd-checkbox-background {
|
743 |
+
fill: var(--color-accent);
|
744 |
+
}
|
745 |
+
input[type="checkbox"]:checked ~ svg .tsd-checkbox-checkmark {
|
746 |
+
stroke: var(--color-text);
|
747 |
+
}
|
748 |
+
.tsd-filter-input input:disabled ~ svg > .tsd-checkbox-background {
|
749 |
+
fill: var(--color-background);
|
750 |
+
stroke: var(--color-accent);
|
751 |
+
stroke-width: 0.25rem;
|
752 |
+
}
|
753 |
+
.tsd-filter-input input:disabled ~ svg > .tsd-checkbox-checkmark {
|
754 |
+
stroke: var(--color-accent);
|
755 |
+
}
|
756 |
+
|
757 |
+
.settings-label {
|
758 |
+
font-weight: bold;
|
759 |
+
text-transform: uppercase;
|
760 |
+
display: inline-block;
|
761 |
+
}
|
762 |
+
|
763 |
+
.tsd-filter-visibility .settings-label {
|
764 |
+
margin: 0.75rem 0 0.5rem 0;
|
765 |
+
}
|
766 |
+
|
767 |
+
.tsd-theme-toggle .settings-label {
|
768 |
+
margin: 0.75rem 0.75rem 0 0;
|
769 |
+
}
|
770 |
+
|
771 |
+
.tsd-hierarchy h4 label:hover span {
|
772 |
+
text-decoration: underline;
|
773 |
+
}
|
774 |
+
|
775 |
+
.tsd-hierarchy {
|
776 |
+
list-style: square;
|
777 |
+
margin: 0;
|
778 |
+
}
|
779 |
+
.tsd-hierarchy-target {
|
780 |
+
font-weight: bold;
|
781 |
+
}
|
782 |
+
.tsd-hierarchy-toggle {
|
783 |
+
color: var(--color-link);
|
784 |
+
cursor: pointer;
|
785 |
+
}
|
786 |
+
|
787 |
+
.tsd-full-hierarchy:not(:last-child) {
|
788 |
+
margin-bottom: 1em;
|
789 |
+
padding-bottom: 1em;
|
790 |
+
border-bottom: 1px solid var(--color-accent);
|
791 |
+
}
|
792 |
+
.tsd-full-hierarchy,
|
793 |
+
.tsd-full-hierarchy ul {
|
794 |
+
list-style: none;
|
795 |
+
margin: 0;
|
796 |
+
padding: 0;
|
797 |
+
}
|
798 |
+
.tsd-full-hierarchy ul {
|
799 |
+
padding-left: 1.5rem;
|
800 |
+
}
|
801 |
+
.tsd-full-hierarchy a {
|
802 |
+
padding: 0.25rem 0 !important;
|
803 |
+
font-size: 1rem;
|
804 |
+
display: inline-flex;
|
805 |
+
align-items: center;
|
806 |
+
color: var(--color-text);
|
807 |
+
}
|
808 |
+
.tsd-full-hierarchy svg[data-dropdown] {
|
809 |
+
cursor: pointer;
|
810 |
+
}
|
811 |
+
.tsd-full-hierarchy svg[data-dropdown="false"] {
|
812 |
+
transform: rotate(-90deg);
|
813 |
+
}
|
814 |
+
.tsd-full-hierarchy svg[data-dropdown="false"] ~ ul {
|
815 |
+
display: none;
|
816 |
+
}
|
817 |
+
|
818 |
+
.tsd-panel-group.tsd-index-group {
|
819 |
+
margin-bottom: 0;
|
820 |
+
}
|
821 |
+
.tsd-index-panel .tsd-index-list {
|
822 |
+
list-style: none;
|
823 |
+
line-height: 1.333em;
|
824 |
+
margin: 0;
|
825 |
+
padding: 0.25rem 0 0 0;
|
826 |
+
overflow: hidden;
|
827 |
+
display: grid;
|
828 |
+
grid-template-columns: repeat(3, 1fr);
|
829 |
+
column-gap: 1rem;
|
830 |
+
grid-template-rows: auto;
|
831 |
+
}
|
832 |
+
@media (max-width: 1024px) {
|
833 |
+
.tsd-index-panel .tsd-index-list {
|
834 |
+
grid-template-columns: repeat(2, 1fr);
|
835 |
+
}
|
836 |
+
}
|
837 |
+
@media (max-width: 768px) {
|
838 |
+
.tsd-index-panel .tsd-index-list {
|
839 |
+
grid-template-columns: repeat(1, 1fr);
|
840 |
+
}
|
841 |
+
}
|
842 |
+
.tsd-index-panel .tsd-index-list li {
|
843 |
+
-webkit-page-break-inside: avoid;
|
844 |
+
-moz-page-break-inside: avoid;
|
845 |
+
-ms-page-break-inside: avoid;
|
846 |
+
-o-page-break-inside: avoid;
|
847 |
+
page-break-inside: avoid;
|
848 |
+
}
|
849 |
+
|
850 |
+
.tsd-flag {
|
851 |
+
display: inline-block;
|
852 |
+
padding: 0.25em 0.4em;
|
853 |
+
border-radius: 4px;
|
854 |
+
color: var(--color-comment-tag-text);
|
855 |
+
background-color: var(--color-comment-tag);
|
856 |
+
text-indent: 0;
|
857 |
+
font-size: 75%;
|
858 |
+
line-height: 1;
|
859 |
+
font-weight: normal;
|
860 |
+
}
|
861 |
+
|
862 |
+
.tsd-anchor {
|
863 |
+
position: relative;
|
864 |
+
top: -100px;
|
865 |
+
}
|
866 |
+
|
867 |
+
.tsd-member {
|
868 |
+
position: relative;
|
869 |
+
}
|
870 |
+
.tsd-member .tsd-anchor + h3 {
|
871 |
+
display: flex;
|
872 |
+
align-items: center;
|
873 |
+
margin-top: 0;
|
874 |
+
margin-bottom: 0;
|
875 |
+
border-bottom: none;
|
876 |
+
}
|
877 |
+
|
878 |
+
.tsd-navigation.settings {
|
879 |
+
margin: 1rem 0;
|
880 |
+
}
|
881 |
+
.tsd-navigation > a,
|
882 |
+
.tsd-navigation .tsd-accordion-summary {
|
883 |
+
width: calc(100% - 0.25rem);
|
884 |
+
display: flex;
|
885 |
+
align-items: center;
|
886 |
+
}
|
887 |
+
.tsd-navigation a,
|
888 |
+
.tsd-navigation summary > span,
|
889 |
+
.tsd-page-navigation a {
|
890 |
+
display: flex;
|
891 |
+
width: calc(100% - 0.25rem);
|
892 |
+
align-items: center;
|
893 |
+
padding: 0.25rem;
|
894 |
+
color: var(--color-text);
|
895 |
+
text-decoration: none;
|
896 |
+
box-sizing: border-box;
|
897 |
+
}
|
898 |
+
.tsd-navigation a.current,
|
899 |
+
.tsd-page-navigation a.current {
|
900 |
+
background: var(--color-active-menu-item);
|
901 |
+
}
|
902 |
+
.tsd-navigation a:hover,
|
903 |
+
.tsd-page-navigation a:hover {
|
904 |
+
text-decoration: underline;
|
905 |
+
}
|
906 |
+
.tsd-navigation ul,
|
907 |
+
.tsd-page-navigation ul {
|
908 |
+
margin-top: 0;
|
909 |
+
margin-bottom: 0;
|
910 |
+
padding: 0;
|
911 |
+
list-style: none;
|
912 |
+
}
|
913 |
+
.tsd-navigation li,
|
914 |
+
.tsd-page-navigation li {
|
915 |
+
padding: 0;
|
916 |
+
max-width: 100%;
|
917 |
+
}
|
918 |
+
.tsd-navigation .tsd-nav-link {
|
919 |
+
display: none;
|
920 |
+
}
|
921 |
+
.tsd-nested-navigation {
|
922 |
+
margin-left: 3rem;
|
923 |
+
}
|
924 |
+
.tsd-nested-navigation > li > details {
|
925 |
+
margin-left: -1.5rem;
|
926 |
+
}
|
927 |
+
.tsd-small-nested-navigation {
|
928 |
+
margin-left: 1.5rem;
|
929 |
+
}
|
930 |
+
.tsd-small-nested-navigation > li > details {
|
931 |
+
margin-left: -1.5rem;
|
932 |
+
}
|
933 |
+
|
934 |
+
.tsd-page-navigation-section {
|
935 |
+
margin-left: 10px;
|
936 |
+
}
|
937 |
+
.tsd-page-navigation-section > summary {
|
938 |
+
padding: 0.25rem;
|
939 |
+
}
|
940 |
+
.tsd-page-navigation-section > div {
|
941 |
+
margin-left: 20px;
|
942 |
+
}
|
943 |
+
.tsd-page-navigation ul {
|
944 |
+
padding-left: 1.75rem;
|
945 |
+
}
|
946 |
+
|
947 |
+
#tsd-sidebar-links a {
|
948 |
+
margin-top: 0;
|
949 |
+
margin-bottom: 0.5rem;
|
950 |
+
line-height: 1.25rem;
|
951 |
+
}
|
952 |
+
#tsd-sidebar-links a:last-of-type {
|
953 |
+
margin-bottom: 0;
|
954 |
+
}
|
955 |
+
|
956 |
+
a.tsd-index-link {
|
957 |
+
padding: 0.25rem 0 !important;
|
958 |
+
font-size: 1rem;
|
959 |
+
line-height: 1.25rem;
|
960 |
+
display: inline-flex;
|
961 |
+
align-items: center;
|
962 |
+
color: var(--color-text);
|
963 |
+
}
|
964 |
+
.tsd-accordion-summary {
|
965 |
+
list-style-type: none; /* hide marker on non-safari */
|
966 |
+
outline: none; /* broken on safari, so just hide it */
|
967 |
+
}
|
968 |
+
.tsd-accordion-summary::-webkit-details-marker {
|
969 |
+
display: none; /* hide marker on safari */
|
970 |
+
}
|
971 |
+
.tsd-accordion-summary,
|
972 |
+
.tsd-accordion-summary a {
|
973 |
+
-moz-user-select: none;
|
974 |
+
-webkit-user-select: none;
|
975 |
+
-ms-user-select: none;
|
976 |
+
user-select: none;
|
977 |
+
|
978 |
+
cursor: pointer;
|
979 |
+
}
|
980 |
+
.tsd-accordion-summary a {
|
981 |
+
width: calc(100% - 1.5rem);
|
982 |
+
}
|
983 |
+
.tsd-accordion-summary > * {
|
984 |
+
margin-top: 0;
|
985 |
+
margin-bottom: 0;
|
986 |
+
padding-top: 0;
|
987 |
+
padding-bottom: 0;
|
988 |
+
}
|
989 |
+
.tsd-accordion .tsd-accordion-summary > svg {
|
990 |
+
margin-left: 0.25rem;
|
991 |
+
vertical-align: text-top;
|
992 |
+
}
|
993 |
+
/*
|
994 |
+
* We need to be careful to target the arrow indicating whether the accordion
|
995 |
+
* is open, but not any other SVGs included in the details element.
|
996 |
+
*/
|
997 |
+
.tsd-accordion:not([open]) > .tsd-accordion-summary > svg:first-child,
|
998 |
+
.tsd-accordion:not([open]) > .tsd-accordion-summary > h1 > svg:first-child,
|
999 |
+
.tsd-accordion:not([open]) > .tsd-accordion-summary > h2 > svg:first-child,
|
1000 |
+
.tsd-accordion:not([open]) > .tsd-accordion-summary > h3 > svg:first-child,
|
1001 |
+
.tsd-accordion:not([open]) > .tsd-accordion-summary > h4 > svg:first-child,
|
1002 |
+
.tsd-accordion:not([open]) > .tsd-accordion-summary > h5 > svg:first-child {
|
1003 |
+
transform: rotate(-90deg);
|
1004 |
+
}
|
1005 |
+
.tsd-index-content > :not(:first-child) {
|
1006 |
+
margin-top: 0.75rem;
|
1007 |
+
}
|
1008 |
+
.tsd-index-heading {
|
1009 |
+
margin-top: 1.5rem;
|
1010 |
+
margin-bottom: 0.75rem;
|
1011 |
+
}
|
1012 |
+
|
1013 |
+
.tsd-no-select {
|
1014 |
+
-webkit-user-select: none;
|
1015 |
+
-moz-user-select: none;
|
1016 |
+
-ms-user-select: none;
|
1017 |
+
user-select: none;
|
1018 |
+
}
|
1019 |
+
.tsd-kind-icon {
|
1020 |
+
margin-right: 0.5rem;
|
1021 |
+
width: 1.25rem;
|
1022 |
+
height: 1.25rem;
|
1023 |
+
min-width: 1.25rem;
|
1024 |
+
min-height: 1.25rem;
|
1025 |
+
}
|
1026 |
+
.tsd-signature > .tsd-kind-icon {
|
1027 |
+
margin-right: 0.8rem;
|
1028 |
+
}
|
1029 |
+
|
1030 |
+
.tsd-panel {
|
1031 |
+
margin-bottom: 2.5rem;
|
1032 |
+
}
|
1033 |
+
.tsd-panel.tsd-member {
|
1034 |
+
margin-bottom: 4rem;
|
1035 |
+
}
|
1036 |
+
.tsd-panel:empty {
|
1037 |
+
display: none;
|
1038 |
+
}
|
1039 |
+
.tsd-panel > h1,
|
1040 |
+
.tsd-panel > h2,
|
1041 |
+
.tsd-panel > h3 {
|
1042 |
+
margin: 1.5rem -1.5rem 0.75rem -1.5rem;
|
1043 |
+
padding: 0 1.5rem 0.75rem 1.5rem;
|
1044 |
+
}
|
1045 |
+
.tsd-panel > h1.tsd-before-signature,
|
1046 |
+
.tsd-panel > h2.tsd-before-signature,
|
1047 |
+
.tsd-panel > h3.tsd-before-signature {
|
1048 |
+
margin-bottom: 0;
|
1049 |
+
border-bottom: none;
|
1050 |
+
}
|
1051 |
+
|
1052 |
+
.tsd-panel-group {
|
1053 |
+
margin: 2rem 0;
|
1054 |
+
}
|
1055 |
+
.tsd-panel-group.tsd-index-group {
|
1056 |
+
margin: 2rem 0;
|
1057 |
+
}
|
1058 |
+
.tsd-panel-group.tsd-index-group details {
|
1059 |
+
margin: 2rem 0;
|
1060 |
+
}
|
1061 |
+
.tsd-panel-group > .tsd-accordion-summary {
|
1062 |
+
margin-bottom: 1rem;
|
1063 |
+
}
|
1064 |
+
|
1065 |
+
#tsd-search {
|
1066 |
+
transition: background-color 0.2s;
|
1067 |
+
}
|
1068 |
+
#tsd-search .title {
|
1069 |
+
position: relative;
|
1070 |
+
z-index: 2;
|
1071 |
+
}
|
1072 |
+
#tsd-search .field {
|
1073 |
+
position: absolute;
|
1074 |
+
left: 0;
|
1075 |
+
top: 0;
|
1076 |
+
right: 2.5rem;
|
1077 |
+
height: 100%;
|
1078 |
+
}
|
1079 |
+
#tsd-search .field input {
|
1080 |
+
box-sizing: border-box;
|
1081 |
+
position: relative;
|
1082 |
+
top: -50px;
|
1083 |
+
z-index: 1;
|
1084 |
+
width: 100%;
|
1085 |
+
padding: 0 10px;
|
1086 |
+
opacity: 0;
|
1087 |
+
outline: 0;
|
1088 |
+
border: 0;
|
1089 |
+
background: transparent;
|
1090 |
+
color: var(--color-text);
|
1091 |
+
}
|
1092 |
+
#tsd-search .field label {
|
1093 |
+
position: absolute;
|
1094 |
+
overflow: hidden;
|
1095 |
+
right: -40px;
|
1096 |
+
}
|
1097 |
+
#tsd-search .field input,
|
1098 |
+
#tsd-search .title,
|
1099 |
+
#tsd-toolbar-links a {
|
1100 |
+
transition: opacity 0.2s;
|
1101 |
+
}
|
1102 |
+
#tsd-search .results {
|
1103 |
+
position: absolute;
|
1104 |
+
visibility: hidden;
|
1105 |
+
top: 40px;
|
1106 |
+
width: 100%;
|
1107 |
+
margin: 0;
|
1108 |
+
padding: 0;
|
1109 |
+
list-style: none;
|
1110 |
+
box-shadow: 0 0 4px rgba(0, 0, 0, 0.25);
|
1111 |
+
}
|
1112 |
+
#tsd-search .results li {
|
1113 |
+
background-color: var(--color-background);
|
1114 |
+
line-height: initial;
|
1115 |
+
padding: 4px;
|
1116 |
+
}
|
1117 |
+
#tsd-search .results li:nth-child(even) {
|
1118 |
+
background-color: var(--color-background-secondary);
|
1119 |
+
}
|
1120 |
+
#tsd-search .results li.state {
|
1121 |
+
display: none;
|
1122 |
+
}
|
1123 |
+
#tsd-search .results li.current:not(.no-results),
|
1124 |
+
#tsd-search .results li:hover:not(.no-results) {
|
1125 |
+
background-color: var(--color-accent);
|
1126 |
+
}
|
1127 |
+
#tsd-search .results a {
|
1128 |
+
display: flex;
|
1129 |
+
align-items: center;
|
1130 |
+
padding: 0.25rem;
|
1131 |
+
box-sizing: border-box;
|
1132 |
+
}
|
1133 |
+
#tsd-search .results a:before {
|
1134 |
+
top: 10px;
|
1135 |
+
}
|
1136 |
+
#tsd-search .results span.parent {
|
1137 |
+
color: var(--color-text-aside);
|
1138 |
+
font-weight: normal;
|
1139 |
+
}
|
1140 |
+
#tsd-search.has-focus {
|
1141 |
+
background-color: var(--color-accent);
|
1142 |
+
}
|
1143 |
+
#tsd-search.has-focus .field input {
|
1144 |
+
top: 0;
|
1145 |
+
opacity: 1;
|
1146 |
+
}
|
1147 |
+
#tsd-search.has-focus .title,
|
1148 |
+
#tsd-search.has-focus #tsd-toolbar-links a {
|
1149 |
+
z-index: 0;
|
1150 |
+
opacity: 0;
|
1151 |
+
}
|
1152 |
+
#tsd-search.has-focus .results {
|
1153 |
+
visibility: visible;
|
1154 |
+
}
|
1155 |
+
#tsd-search.loading .results li.state.loading {
|
1156 |
+
display: block;
|
1157 |
+
}
|
1158 |
+
#tsd-search.failure .results li.state.failure {
|
1159 |
+
display: block;
|
1160 |
+
}
|
1161 |
+
|
1162 |
+
#tsd-toolbar-links {
|
1163 |
+
position: absolute;
|
1164 |
+
top: 0;
|
1165 |
+
right: 2rem;
|
1166 |
+
height: 100%;
|
1167 |
+
display: flex;
|
1168 |
+
align-items: center;
|
1169 |
+
justify-content: flex-end;
|
1170 |
+
}
|
1171 |
+
#tsd-toolbar-links a {
|
1172 |
+
margin-left: 1.5rem;
|
1173 |
+
}
|
1174 |
+
#tsd-toolbar-links a:hover {
|
1175 |
+
text-decoration: underline;
|
1176 |
+
}
|
1177 |
+
|
1178 |
+
.tsd-signature {
|
1179 |
+
margin: 0 0 1rem 0;
|
1180 |
+
padding: 1rem 0.5rem;
|
1181 |
+
border: 1px solid var(--color-accent);
|
1182 |
+
font-family: Menlo, Monaco, Consolas, "Courier New", monospace;
|
1183 |
+
font-size: 14px;
|
1184 |
+
overflow-x: auto;
|
1185 |
+
}
|
1186 |
+
|
1187 |
+
.tsd-signature-keyword {
|
1188 |
+
color: var(--color-ts-keyword);
|
1189 |
+
font-weight: normal;
|
1190 |
+
}
|
1191 |
+
|
1192 |
+
.tsd-signature-symbol {
|
1193 |
+
color: var(--color-text-aside);
|
1194 |
+
font-weight: normal;
|
1195 |
+
}
|
1196 |
+
|
1197 |
+
.tsd-signature-type {
|
1198 |
+
font-style: italic;
|
1199 |
+
font-weight: normal;
|
1200 |
+
}
|
1201 |
+
|
1202 |
+
.tsd-signatures {
|
1203 |
+
padding: 0;
|
1204 |
+
margin: 0 0 1em 0;
|
1205 |
+
list-style-type: none;
|
1206 |
+
}
|
1207 |
+
.tsd-signatures .tsd-signature {
|
1208 |
+
margin: 0;
|
1209 |
+
border-color: var(--color-accent);
|
1210 |
+
border-width: 1px 0;
|
1211 |
+
transition: background-color 0.1s;
|
1212 |
+
}
|
1213 |
+
.tsd-signatures .tsd-index-signature:not(:last-child) {
|
1214 |
+
margin-bottom: 1em;
|
1215 |
+
}
|
1216 |
+
.tsd-signatures .tsd-index-signature .tsd-signature {
|
1217 |
+
border-width: 1px;
|
1218 |
+
}
|
1219 |
+
.tsd-description .tsd-signatures .tsd-signature {
|
1220 |
+
border-width: 1px;
|
1221 |
+
}
|
1222 |
+
|
1223 |
+
ul.tsd-parameter-list,
|
1224 |
+
ul.tsd-type-parameter-list {
|
1225 |
+
list-style: square;
|
1226 |
+
margin: 0;
|
1227 |
+
padding-left: 20px;
|
1228 |
+
}
|
1229 |
+
ul.tsd-parameter-list > li.tsd-parameter-signature,
|
1230 |
+
ul.tsd-type-parameter-list > li.tsd-parameter-signature {
|
1231 |
+
list-style: none;
|
1232 |
+
margin-left: -20px;
|
1233 |
+
}
|
1234 |
+
ul.tsd-parameter-list h5,
|
1235 |
+
ul.tsd-type-parameter-list h5 {
|
1236 |
+
font-size: 16px;
|
1237 |
+
margin: 1em 0 0.5em 0;
|
1238 |
+
}
|
1239 |
+
.tsd-sources {
|
1240 |
+
margin-top: 1rem;
|
1241 |
+
font-size: 0.875em;
|
1242 |
+
}
|
1243 |
+
.tsd-sources a {
|
1244 |
+
color: var(--color-text-aside);
|
1245 |
+
text-decoration: underline;
|
1246 |
+
}
|
1247 |
+
.tsd-sources ul {
|
1248 |
+
list-style: none;
|
1249 |
+
padding: 0;
|
1250 |
+
}
|
1251 |
+
|
1252 |
+
.tsd-page-toolbar {
|
1253 |
+
position: sticky;
|
1254 |
+
z-index: 1;
|
1255 |
+
top: 0;
|
1256 |
+
left: 0;
|
1257 |
+
width: 100%;
|
1258 |
+
color: var(--color-text);
|
1259 |
+
background: var(--color-background-secondary);
|
1260 |
+
border-bottom: 1px var(--color-accent) solid;
|
1261 |
+
transition: transform 0.3s ease-in-out;
|
1262 |
+
}
|
1263 |
+
.tsd-page-toolbar a {
|
1264 |
+
color: var(--color-text);
|
1265 |
+
text-decoration: none;
|
1266 |
+
}
|
1267 |
+
.tsd-page-toolbar a.title {
|
1268 |
+
font-weight: bold;
|
1269 |
+
}
|
1270 |
+
.tsd-page-toolbar a.title:hover {
|
1271 |
+
text-decoration: underline;
|
1272 |
+
}
|
1273 |
+
.tsd-page-toolbar .tsd-toolbar-contents {
|
1274 |
+
display: flex;
|
1275 |
+
justify-content: space-between;
|
1276 |
+
height: 2.5rem;
|
1277 |
+
margin: 0 auto;
|
1278 |
+
}
|
1279 |
+
.tsd-page-toolbar .table-cell {
|
1280 |
+
position: relative;
|
1281 |
+
white-space: nowrap;
|
1282 |
+
line-height: 40px;
|
1283 |
+
}
|
1284 |
+
.tsd-page-toolbar .table-cell:first-child {
|
1285 |
+
width: 100%;
|
1286 |
+
}
|
1287 |
+
.tsd-page-toolbar .tsd-toolbar-icon {
|
1288 |
+
box-sizing: border-box;
|
1289 |
+
line-height: 0;
|
1290 |
+
padding: 12px 0;
|
1291 |
+
}
|
1292 |
+
|
1293 |
+
.tsd-widget {
|
1294 |
+
display: inline-block;
|
1295 |
+
overflow: hidden;
|
1296 |
+
opacity: 0.8;
|
1297 |
+
height: 40px;
|
1298 |
+
transition:
|
1299 |
+
opacity 0.1s,
|
1300 |
+
background-color 0.2s;
|
1301 |
+
vertical-align: bottom;
|
1302 |
+
cursor: pointer;
|
1303 |
+
}
|
1304 |
+
.tsd-widget:hover {
|
1305 |
+
opacity: 0.9;
|
1306 |
+
}
|
1307 |
+
.tsd-widget.active {
|
1308 |
+
opacity: 1;
|
1309 |
+
background-color: var(--color-accent);
|
1310 |
+
}
|
1311 |
+
.tsd-widget.no-caption {
|
1312 |
+
width: 40px;
|
1313 |
+
}
|
1314 |
+
.tsd-widget.no-caption:before {
|
1315 |
+
margin: 0;
|
1316 |
+
}
|
1317 |
+
|
1318 |
+
.tsd-widget.options,
|
1319 |
+
.tsd-widget.menu {
|
1320 |
+
display: none;
|
1321 |
+
}
|
1322 |
+
input[type="checkbox"] + .tsd-widget:before {
|
1323 |
+
background-position: -120px 0;
|
1324 |
+
}
|
1325 |
+
input[type="checkbox"]:checked + .tsd-widget:before {
|
1326 |
+
background-position: -160px 0;
|
1327 |
+
}
|
1328 |
+
|
1329 |
+
img {
|
1330 |
+
max-width: 100%;
|
1331 |
+
}
|
1332 |
+
|
1333 |
+
.tsd-member-summary-name {
|
1334 |
+
display: inline-flex;
|
1335 |
+
align-items: center;
|
1336 |
+
padding: 0.25rem;
|
1337 |
+
text-decoration: none;
|
1338 |
+
}
|
1339 |
+
|
1340 |
+
.tsd-anchor-icon {
|
1341 |
+
display: inline-flex;
|
1342 |
+
align-items: center;
|
1343 |
+
margin-left: 0.5rem;
|
1344 |
+
color: var(--color-text);
|
1345 |
+
}
|
1346 |
+
|
1347 |
+
.tsd-anchor-icon svg {
|
1348 |
+
width: 1em;
|
1349 |
+
height: 1em;
|
1350 |
+
visibility: hidden;
|
1351 |
+
}
|
1352 |
+
|
1353 |
+
.tsd-member-summary-name:hover > .tsd-anchor-icon svg,
|
1354 |
+
.tsd-anchor-link:hover > .tsd-anchor-icon svg {
|
1355 |
+
visibility: visible;
|
1356 |
+
}
|
1357 |
+
|
1358 |
+
.deprecated {
|
1359 |
+
text-decoration: line-through !important;
|
1360 |
+
}
|
1361 |
+
|
1362 |
+
.warning {
|
1363 |
+
padding: 1rem;
|
1364 |
+
color: var(--color-warning-text);
|
1365 |
+
background: var(--color-background-warning);
|
1366 |
+
}
|
1367 |
+
|
1368 |
+
.tsd-kind-project {
|
1369 |
+
color: var(--color-ts-project);
|
1370 |
+
}
|
1371 |
+
.tsd-kind-module {
|
1372 |
+
color: var(--color-ts-module);
|
1373 |
+
}
|
1374 |
+
.tsd-kind-namespace {
|
1375 |
+
color: var(--color-ts-namespace);
|
1376 |
+
}
|
1377 |
+
.tsd-kind-enum {
|
1378 |
+
color: var(--color-ts-enum);
|
1379 |
+
}
|
1380 |
+
.tsd-kind-enum-member {
|
1381 |
+
color: var(--color-ts-enum-member);
|
1382 |
+
}
|
1383 |
+
.tsd-kind-variable {
|
1384 |
+
color: var(--color-ts-variable);
|
1385 |
+
}
|
1386 |
+
.tsd-kind-function {
|
1387 |
+
color: var(--color-ts-function);
|
1388 |
+
}
|
1389 |
+
.tsd-kind-class {
|
1390 |
+
color: var(--color-ts-class);
|
1391 |
+
}
|
1392 |
+
.tsd-kind-interface {
|
1393 |
+
color: var(--color-ts-interface);
|
1394 |
+
}
|
1395 |
+
.tsd-kind-constructor {
|
1396 |
+
color: var(--color-ts-constructor);
|
1397 |
+
}
|
1398 |
+
.tsd-kind-property {
|
1399 |
+
color: var(--color-ts-property);
|
1400 |
+
}
|
1401 |
+
.tsd-kind-method {
|
1402 |
+
color: var(--color-ts-method);
|
1403 |
+
}
|
1404 |
+
.tsd-kind-reference {
|
1405 |
+
color: var(--color-ts-reference);
|
1406 |
+
}
|
1407 |
+
.tsd-kind-call-signature {
|
1408 |
+
color: var(--color-ts-call-signature);
|
1409 |
+
}
|
1410 |
+
.tsd-kind-index-signature {
|
1411 |
+
color: var(--color-ts-index-signature);
|
1412 |
+
}
|
1413 |
+
.tsd-kind-constructor-signature {
|
1414 |
+
color: var(--color-ts-constructor-signature);
|
1415 |
+
}
|
1416 |
+
.tsd-kind-parameter {
|
1417 |
+
color: var(--color-ts-parameter);
|
1418 |
+
}
|
1419 |
+
.tsd-kind-type-parameter {
|
1420 |
+
color: var(--color-ts-type-parameter);
|
1421 |
+
}
|
1422 |
+
.tsd-kind-accessor {
|
1423 |
+
color: var(--color-ts-accessor);
|
1424 |
+
}
|
1425 |
+
.tsd-kind-get-signature {
|
1426 |
+
color: var(--color-ts-get-signature);
|
1427 |
+
}
|
1428 |
+
.tsd-kind-set-signature {
|
1429 |
+
color: var(--color-ts-set-signature);
|
1430 |
+
}
|
1431 |
+
.tsd-kind-type-alias {
|
1432 |
+
color: var(--color-ts-type-alias);
|
1433 |
+
}
|
1434 |
+
|
1435 |
+
/* if we have a kind icon, don't color the text by kind */
|
1436 |
+
.tsd-kind-icon ~ span {
|
1437 |
+
color: var(--color-text);
|
1438 |
+
}
|
1439 |
+
|
1440 |
+
* {
|
1441 |
+
scrollbar-width: thin;
|
1442 |
+
scrollbar-color: var(--color-accent) var(--color-icon-background);
|
1443 |
+
}
|
1444 |
+
|
1445 |
+
*::-webkit-scrollbar {
|
1446 |
+
width: 0.75rem;
|
1447 |
+
}
|
1448 |
+
|
1449 |
+
*::-webkit-scrollbar-track {
|
1450 |
+
background: var(--color-icon-background);
|
1451 |
+
}
|
1452 |
+
|
1453 |
+
*::-webkit-scrollbar-thumb {
|
1454 |
+
background-color: var(--color-accent);
|
1455 |
+
border-radius: 999rem;
|
1456 |
+
border: 0.25rem solid var(--color-icon-background);
|
1457 |
+
}
|
1458 |
+
|
1459 |
+
/* mobile */
|
1460 |
+
@media (max-width: 769px) {
|
1461 |
+
.tsd-widget.options,
|
1462 |
+
.tsd-widget.menu {
|
1463 |
+
display: inline-block;
|
1464 |
+
}
|
1465 |
+
|
1466 |
+
.container-main {
|
1467 |
+
display: flex;
|
1468 |
+
}
|
1469 |
+
html .col-content {
|
1470 |
+
float: none;
|
1471 |
+
max-width: 100%;
|
1472 |
+
width: 100%;
|
1473 |
+
}
|
1474 |
+
html .col-sidebar {
|
1475 |
+
position: fixed !important;
|
1476 |
+
overflow-y: auto;
|
1477 |
+
-webkit-overflow-scrolling: touch;
|
1478 |
+
z-index: 1024;
|
1479 |
+
top: 0 !important;
|
1480 |
+
bottom: 0 !important;
|
1481 |
+
left: auto !important;
|
1482 |
+
right: 0 !important;
|
1483 |
+
padding: 1.5rem 1.5rem 0 0;
|
1484 |
+
width: 75vw;
|
1485 |
+
visibility: hidden;
|
1486 |
+
background-color: var(--color-background);
|
1487 |
+
transform: translate(100%, 0);
|
1488 |
+
}
|
1489 |
+
html .col-sidebar > *:last-child {
|
1490 |
+
padding-bottom: 20px;
|
1491 |
+
}
|
1492 |
+
html .overlay {
|
1493 |
+
content: "";
|
1494 |
+
display: block;
|
1495 |
+
position: fixed;
|
1496 |
+
z-index: 1023;
|
1497 |
+
top: 0;
|
1498 |
+
left: 0;
|
1499 |
+
right: 0;
|
1500 |
+
bottom: 0;
|
1501 |
+
background-color: rgba(0, 0, 0, 0.75);
|
1502 |
+
visibility: hidden;
|
1503 |
+
}
|
1504 |
+
|
1505 |
+
.to-has-menu .overlay {
|
1506 |
+
animation: fade-in 0.4s;
|
1507 |
+
}
|
1508 |
+
|
1509 |
+
.to-has-menu .col-sidebar {
|
1510 |
+
animation: pop-in-from-right 0.4s;
|
1511 |
+
}
|
1512 |
+
|
1513 |
+
.from-has-menu .overlay {
|
1514 |
+
animation: fade-out 0.4s;
|
1515 |
+
}
|
1516 |
+
|
1517 |
+
.from-has-menu .col-sidebar {
|
1518 |
+
animation: pop-out-to-right 0.4s;
|
1519 |
+
}
|
1520 |
+
|
1521 |
+
.has-menu body {
|
1522 |
+
overflow: hidden;
|
1523 |
+
}
|
1524 |
+
.has-menu .overlay {
|
1525 |
+
visibility: visible;
|
1526 |
+
}
|
1527 |
+
.has-menu .col-sidebar {
|
1528 |
+
visibility: visible;
|
1529 |
+
transform: translate(0, 0);
|
1530 |
+
display: flex;
|
1531 |
+
flex-direction: column;
|
1532 |
+
gap: 1.5rem;
|
1533 |
+
max-height: 100vh;
|
1534 |
+
padding: 1rem 2rem;
|
1535 |
+
}
|
1536 |
+
.has-menu .tsd-navigation {
|
1537 |
+
max-height: 100%;
|
1538 |
+
}
|
1539 |
+
#tsd-toolbar-links {
|
1540 |
+
display: none;
|
1541 |
+
}
|
1542 |
+
.tsd-navigation .tsd-nav-link {
|
1543 |
+
display: flex;
|
1544 |
+
}
|
1545 |
+
}
|
1546 |
+
|
1547 |
+
/* one sidebar */
|
1548 |
+
@media (min-width: 770px) {
|
1549 |
+
.container-main {
|
1550 |
+
display: grid;
|
1551 |
+
grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
|
1552 |
+
grid-template-areas: "sidebar content";
|
1553 |
+
margin: 2rem auto;
|
1554 |
+
}
|
1555 |
+
|
1556 |
+
.col-sidebar {
|
1557 |
+
grid-area: sidebar;
|
1558 |
+
}
|
1559 |
+
.col-content {
|
1560 |
+
grid-area: content;
|
1561 |
+
padding: 0 1rem;
|
1562 |
+
}
|
1563 |
+
}
|
1564 |
+
@media (min-width: 770px) and (max-width: 1399px) {
|
1565 |
+
.col-sidebar {
|
1566 |
+
max-height: calc(100vh - 2rem - 42px);
|
1567 |
+
overflow: auto;
|
1568 |
+
position: sticky;
|
1569 |
+
top: 42px;
|
1570 |
+
padding-top: 1rem;
|
1571 |
+
}
|
1572 |
+
.site-menu {
|
1573 |
+
margin-top: 1rem;
|
1574 |
+
}
|
1575 |
+
}
|
1576 |
+
|
1577 |
+
/* two sidebars */
|
1578 |
+
@media (min-width: 1200px) {
|
1579 |
+
.container-main {
|
1580 |
+
grid-template-columns: minmax(0, 1fr) minmax(0, 2.5fr) minmax(
|
1581 |
+
0,
|
1582 |
+
20rem
|
1583 |
+
);
|
1584 |
+
grid-template-areas: "sidebar content toc";
|
1585 |
+
}
|
1586 |
+
|
1587 |
+
.col-sidebar {
|
1588 |
+
display: contents;
|
1589 |
+
}
|
1590 |
+
|
1591 |
+
.page-menu {
|
1592 |
+
grid-area: toc;
|
1593 |
+
padding-left: 1rem;
|
1594 |
+
}
|
1595 |
+
.site-menu {
|
1596 |
+
grid-area: sidebar;
|
1597 |
+
}
|
1598 |
+
|
1599 |
+
.site-menu {
|
1600 |
+
margin-top: 1rem;
|
1601 |
+
}
|
1602 |
+
|
1603 |
+
.page-menu,
|
1604 |
+
.site-menu {
|
1605 |
+
max-height: calc(100vh - 2rem - 42px);
|
1606 |
+
overflow: auto;
|
1607 |
+
position: sticky;
|
1608 |
+
top: 42px;
|
1609 |
+
}
|
1610 |
+
}
|
1611 |
+
}
|
docs/docs/classes/bchecc.BCH.html
ADDED
@@ -0,0 +1,137 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!DOCTYPE html><html class="default" lang="en" data-base=".."><head><meta charset="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>BCH | TrustMark.js</title><link rel="icon" href="../assets/favicon.svg" type="image/svg+xml"/><meta name="description" content="Documentation for TrustMark.js"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script defer src="../assets/main.js"></script><script async src="../assets/icons.js" id="tsd-icons-script"></script><script async src="../assets/search.js" id="tsd-search-script"></script><script async src="../assets/navigation.js" id="tsd-nav-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><div class="table-cell" id="tsd-search"><div class="field"><label for="tsd-search-field" class="tsd-widget tsd-toolbar-icon search no-caption"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-search"></use></svg></label><input type="text" id="tsd-search-field" aria-label="Search"/></div><div class="field"><div id="tsd-toolbar-links"></div></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">TrustMark.js</a></div><div class="table-cell" id="tsd-widgets"><a href="#" class="tsd-widget tsd-toolbar-icon menu no-caption" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-menu"></use></svg></a></div></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb"><li><a href="../modules.html">TrustMark.js</a></li><li><a href="../modules/bchecc.html">bchecc</a></li><li><a href="bchecc.BCH.html">BCH</a></li></ul><h1>Class BCH</h1></div><section class="tsd-panel tsd-comment"><div class="tsd-comment tsd-typography"><p>BCH (Bose-Chaudhuri-Hocquenghem) Error Correction Code class.</p>
|
2 |
+
</div><div class="tsd-comment tsd-typography"></div></section><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/bgon/trustmark.js/blob/af9ff3e40e7e332b93baad3473cd6f5664988512/src/bchecc.ts#L15">bchecc.ts:15</a></li></ul></aside><section class="tsd-panel-group tsd-index-group"><section class="tsd-panel tsd-index-panel"><details class="tsd-index-content tsd-accordion" open><summary class="tsd-accordion-summary tsd-index-summary"><h5 class="tsd-index-heading uppercase" role="button" aria-expanded="false" tabIndex="0"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronSmall"></use></svg> Index</h5></summary><div class="tsd-accordion-details"><section class="tsd-index-section"><h3 class="tsd-index-heading">Constructors</h3><div class="tsd-index-list"><a href="bchecc.BCH.html#constructor" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Constructor"><use href="../assets/icons.svg#icon-512"></use></svg><span>constructor</span></a>
|
3 |
+
</div></section><section class="tsd-index-section"><h3 class="tsd-index-heading">Properties</h3><div class="tsd-index-list"><a href="bchecc.BCH.html#eccstate" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>ECCstate</span></a>
|
4 |
+
</div></section><section class="tsd-index-section"><h3 class="tsd-index-heading">Methods</h3><div class="tsd-index-list"><a href="bchecc.BCH.html#buildcyclic" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>build<wbr/>Cyclic</span></a>
|
5 |
+
<a href="bchecc.BCH.html#ceilop" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>ceilop</span></a>
|
6 |
+
<a href="bchecc.BCH.html#convertallbitstobigints" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>convert<wbr/>All<wbr/>Bits<wbr/>To<wbr/>Big<wbr/>Ints</span></a>
|
7 |
+
<a href="bchecc.BCH.html#convertbitstobigint" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>convert<wbr/>Bits<wbr/>To<wbr/>Big<wbr/>Int</span></a>
|
8 |
+
<a href="bchecc.BCH.html#convertbytestobigint" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>convert<wbr/>Bytes<wbr/>To<wbr/>Big<wbr/>Int</span></a>
|
9 |
+
<a href="bchecc.BCH.html#decode" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>decode</span></a>
|
10 |
+
<a href="bchecc.BCH.html#deg" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>deg</span></a>
|
11 |
+
<a href="bchecc.BCH.html#degbigint" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>deg<wbr/>Big<wbr/>Int</span></a>
|
12 |
+
<a href="bchecc.BCH.html#encode" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>encode</span></a>
|
13 |
+
<a href="bchecc.BCH.html#g_div" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>g_<wbr/>div</span></a>
|
14 |
+
<a href="bchecc.BCH.html#g_log" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>g_<wbr/>log</span></a>
|
15 |
+
<a href="bchecc.BCH.html#g_mul" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>g_<wbr/>mul</span></a>
|
16 |
+
<a href="bchecc.BCH.html#g_pow" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>g_<wbr/>pow</span></a>
|
17 |
+
<a href="bchecc.BCH.html#g_sqrt" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>g_<wbr/>sqrt</span></a>
|
18 |
+
<a href="bchecc.BCH.html#geteccbits" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>get<wbr/>Ecc<wbr/>Bits</span></a>
|
19 |
+
<a href="bchecc.BCH.html#geteccbytes" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>get<wbr/>Ecc<wbr/>Bytes</span></a>
|
20 |
+
<a href="bchecc.BCH.html#getroots" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>get<wbr/>Roots</span></a>
|
21 |
+
<a href="bchecc.BCH.html#mod" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>mod</span></a>
|
22 |
+
<a href="bchecc.BCH.html#modn" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>modn</span></a>
|
23 |
+
<a href="bchecc.BCH.html#numbertobinarystring" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>number<wbr/>To<wbr/>Binary<wbr/>String</span></a>
|
24 |
+
<a href="bchecc.BCH.html#toasciistring" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>to<wbr/>Ascii<wbr/>String</span></a>
|
25 |
+
<a href="bchecc.BCH.html#tobinstring" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>to<wbr/>Bin<wbr/>String</span></a>
|
26 |
+
<a href="bchecc.BCH.html#tohexstring" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>to<wbr/>Hex<wbr/>String</span></a>
|
27 |
+
</div></section></div></details></section></section><details class="tsd-panel-group tsd-member-group tsd-accordion" open><summary class="tsd-accordion-summary" data-key="section-Constructors"><h2><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg> Constructors</h2></summary><section><section class="tsd-panel tsd-member"><a id="constructor" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>constructor</span><a href="#constructor" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="constructorbch" class="tsd-anchor"></a><span class="tsd-signature-keyword">new</span> <span class="tsd-kind-constructor-signature">BCH</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">t</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">,</span> <span class="tsd-kind-parameter">poly</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <a href="bchecc.BCH.html" class="tsd-signature-type tsd-kind-class">BCH</a><a href="#constructorbch" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Initializes the ECC state with given parameters.</p>
|
28 |
+
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">t</span>: <span class="tsd-signature-type">number</span></span><div class="tsd-comment tsd-typography"><p>Number of error correctable bits, max number of bit flips we can account for, increasing this increase the ecc length</p>
|
29 |
+
</div><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">poly</span>: <span class="tsd-signature-type">number</span></span><div class="tsd-comment tsd-typography"><p>The polynomial used for ECC.</p>
|
30 |
+
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <a href="bchecc.BCH.html" class="tsd-signature-type tsd-kind-class">BCH</a></h4><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/bgon/trustmark.js/blob/af9ff3e40e7e332b93baad3473cd6f5664988512/src/bchecc.ts#L23">bchecc.ts:23</a></li></ul></aside></div></li></ul></section></section></details><details class="tsd-panel-group tsd-member-group tsd-accordion" open><summary class="tsd-accordion-summary" data-key="section-Properties"><h2><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg> Properties</h2></summary><section><section class="tsd-panel tsd-member"><a id="eccstate" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>ECCstate</span><a href="#eccstate" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">ECCstate</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">any</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/bgon/trustmark.js/blob/af9ff3e40e7e332b93baad3473cd6f5664988512/src/bchecc.ts#L16">bchecc.ts:16</a></li></ul></aside></section></section></details><details class="tsd-panel-group tsd-member-group tsd-accordion" open><summary class="tsd-accordion-summary" data-key="section-Methods"><h2><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg> Methods</h2></summary><section><section class="tsd-panel tsd-member"><a id="buildcyclic" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>build<wbr/>Cyclic</span><a href="#buildcyclic" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="buildcyclic-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">buildCyclic</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">g</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">bigint</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">void</span><a href="#buildcyclic-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Builds a cyclic table for error correction.</p>
|
31 |
+
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">g</span>: <span class="tsd-signature-type">bigint</span><span class="tsd-signature-symbol">[]</span></span><div class="tsd-comment tsd-typography"><p>The generator polynomial.</p>
|
32 |
+
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/bgon/trustmark.js/blob/af9ff3e40e7e332b93baad3473cd6f5664988512/src/bchecc.ts#L532">bchecc.ts:532</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><a id="ceilop" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>ceilop</span><a href="#ceilop" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="ceilop-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">ceilop</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">a</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">,</span> <span class="tsd-kind-parameter">b</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span><a href="#ceilop-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Computes the ceiling of the division of two integers.</p>
|
33 |
+
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">a</span>: <span class="tsd-signature-type">number</span></span><div class="tsd-comment tsd-typography"><p>The dividend.</p>
|
34 |
+
</div><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">b</span>: <span class="tsd-signature-type">number</span></span><div class="tsd-comment tsd-typography"><p>The divisor.</p>
|
35 |
+
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">number</span></h4><p>The ceiling of the division of a by b.</p>
|
36 |
+
<div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/bgon/trustmark.js/blob/af9ff3e40e7e332b93baad3473cd6f5664988512/src/bchecc.ts#L699">bchecc.ts:699</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><a id="convertallbitstobigints" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>convert<wbr/>All<wbr/>Bits<wbr/>To<wbr/>Big<wbr/>Ints</span><a href="#convertallbitstobigints" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="convertallbitstobigints-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">convertAllBitsToBigInts</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">bitArray</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">,</span> <span class="tsd-kind-parameter">chunkSize</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">bigint</span><span class="tsd-signature-symbol">[]</span><a href="#convertallbitstobigints-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Processes an array of bits in chunks, converting each chunk into a BigInt.</p>
|
37 |
+
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">bitArray</span>: <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">[]</span></span><div class="tsd-comment tsd-typography"><p>The array of bits to process.</p>
|
38 |
+
</div><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">chunkSize</span>: <span class="tsd-signature-type">number</span></span><div class="tsd-comment tsd-typography"><p>The size of each chunk of bits to process.</p>
|
39 |
+
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">bigint</span><span class="tsd-signature-symbol">[]</span></h4><ul>
|
40 |
+
<li>An array of BigInt values representing chunks of the original bit array.</li>
|
41 |
+
</ul>
|
42 |
+
<div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/bgon/trustmark.js/blob/af9ff3e40e7e332b93baad3473cd6f5664988512/src/bchecc.ts#L744">bchecc.ts:744</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><a id="convertbitstobigint" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>convert<wbr/>Bits<wbr/>To<wbr/>Big<wbr/>Int</span><a href="#convertbitstobigint" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="convertbitstobigint-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">convertBitsToBigInt</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">bitArray</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">,</span> <span class="tsd-kind-parameter">bitLimit</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">bigint</span><a href="#convertbitstobigint-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Converts an array of bits into a single BigInt value.</p>
|
43 |
+
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">bitArray</span>: <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">[]</span></span><div class="tsd-comment tsd-typography"><p>The array of bits to convert.</p>
|
44 |
+
</div><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">bitLimit</span>: <span class="tsd-signature-type">number</span></span><div class="tsd-comment tsd-typography"><p>The maximum number of bits to process.</p>
|
45 |
+
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">bigint</span></h4><ul>
|
46 |
+
<li>The combined value of all bits in the array.</li>
|
47 |
+
</ul>
|
48 |
+
<div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/bgon/trustmark.js/blob/af9ff3e40e7e332b93baad3473cd6f5664988512/src/bchecc.ts#L723">bchecc.ts:723</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><a id="convertbytestobigint" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>convert<wbr/>Bytes<wbr/>To<wbr/>Big<wbr/>Int</span><a href="#convertbytestobigint" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="convertbytestobigint-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">convertBytesToBigInt</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">byteArray</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">bigint</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">bigint</span><a href="#convertbytestobigint-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Converts an array of up to 4 bytes into a single BigInt value.</p>
|
49 |
+
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">byteArray</span>: <span class="tsd-signature-type">bigint</span><span class="tsd-signature-symbol">[]</span></span><div class="tsd-comment tsd-typography"><p>The array of bytes to convert.</p>
|
50 |
+
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">bigint</span></h4><ul>
|
51 |
+
<li>The combined value of the bytes as a BigInt.</li>
|
52 |
+
</ul>
|
53 |
+
<div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/bgon/trustmark.js/blob/af9ff3e40e7e332b93baad3473cd6f5664988512/src/bchecc.ts#L772">bchecc.ts:772</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><a id="decode" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>decode</span><a href="#decode" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="decode-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">decode</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">data</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">,</span> <span class="tsd-kind-parameter">recvecc</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">any</span><a href="#decode-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Decodes the data and corrects errors using ECC.</p>
|
54 |
+
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">data</span>: <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">[]</span></span><div class="tsd-comment tsd-typography"><p>The input data array.</p>
|
55 |
+
</div><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">recvecc</span>: <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">[]</span></span><div class="tsd-comment tsd-typography"><p>The received ECC data.</p>
|
56 |
+
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">any</span></h4><ul>
|
57 |
+
<li>The corrected data and status.</li>
|
58 |
+
</ul>
|
59 |
+
<div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/bgon/trustmark.js/blob/af9ff3e40e7e332b93baad3473cd6f5664988512/src/bchecc.ts#L256">bchecc.ts:256</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><a id="deg" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>deg</span><a href="#deg" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="deg-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">deg</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">x</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span><a href="#deg-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Computes the degree of a polynomial represented as an integer.</p>
|
60 |
+
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">x</span>: <span class="tsd-signature-type">number</span></span><div class="tsd-comment tsd-typography"><p>The polynomial represented as an integer.</p>
|
61 |
+
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">number</span></h4><p>The degree of the polynomial.</p>
|
62 |
+
<div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/bgon/trustmark.js/blob/af9ff3e40e7e332b93baad3473cd6f5664988512/src/bchecc.ts#L684">bchecc.ts:684</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><a id="degbigint" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>deg<wbr/>Big<wbr/>Int</span><a href="#degbigint" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="degbigint-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">degBigInt</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">x</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">bigint</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span><a href="#degbigint-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Computes the degree of a polynomial represented as a BigInt.</p>
|
63 |
+
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">x</span>: <span class="tsd-signature-type">bigint</span></span><div class="tsd-comment tsd-typography"><p>The polynomial represented as a BigInt.</p>
|
64 |
+
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">number</span></h4><p>The degree of the polynomial.</p>
|
65 |
+
<div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/bgon/trustmark.js/blob/af9ff3e40e7e332b93baad3473cd6f5664988512/src/bchecc.ts#L708">bchecc.ts:708</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><a id="encode" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>encode</span><a href="#encode" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="encode-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">encode</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">data</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Uint8Array</span><a href="#encode-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Encodes the data and generates ECC bytes.</p>
|
66 |
+
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">data</span>: <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">[]</span></span><div class="tsd-comment tsd-typography"><p>The input data array.</p>
|
67 |
+
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Uint8Array</span></h4><ul>
|
68 |
+
<li>The generated ECC bytes.</li>
|
69 |
+
</ul>
|
70 |
+
<div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/bgon/trustmark.js/blob/af9ff3e40e7e332b93baad3473cd6f5664988512/src/bchecc.ts#L164">bchecc.ts:164</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><a id="g_div" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>g_<wbr/>div</span><a href="#g_div" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="g_div-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">g_div</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">instance</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">,</span> <span class="tsd-kind-parameter">a</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">,</span> <span class="tsd-kind-parameter">b</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span><a href="#g_div-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Divides two values in a Galois field.</p>
|
71 |
+
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">instance</span>: <span class="tsd-signature-type">any</span></span><div class="tsd-comment tsd-typography"><p>The current context containing Galois field parameters.</p>
|
72 |
+
</div><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">a</span>: <span class="tsd-signature-type">number</span></span><div class="tsd-comment tsd-typography"><p>The dividend.</p>
|
73 |
+
</div><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">b</span>: <span class="tsd-signature-type">number</span></span><div class="tsd-comment tsd-typography"><p>The divisor.</p>
|
74 |
+
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">number</span></h4><p>The quotient of the division in the Galois field.</p>
|
75 |
+
<div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/bgon/trustmark.js/blob/af9ff3e40e7e332b93baad3473cd6f5664988512/src/bchecc.ts#L640">bchecc.ts:640</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><a id="g_log" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>g_<wbr/>log</span><a href="#g_log" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="g_log-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">g_log</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">instance</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">,</span> <span class="tsd-kind-parameter">x</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span><a href="#g_log-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Computes the logarithm of a value in a Galois field.</p>
|
76 |
+
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">instance</span>: <span class="tsd-signature-type">any</span></span><div class="tsd-comment tsd-typography"><p>The current context containing Galois field parameters.</p>
|
77 |
+
</div><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">x</span>: <span class="tsd-signature-type">number</span></span><div class="tsd-comment tsd-typography"><p>The value whose logarithm is to be computed.</p>
|
78 |
+
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">number</span></h4><p>The logarithm of the value in the Galois field.</p>
|
79 |
+
<div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/bgon/trustmark.js/blob/af9ff3e40e7e332b93baad3473cd6f5664988512/src/bchecc.ts#L613">bchecc.ts:613</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><a id="g_mul" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>g_<wbr/>mul</span><a href="#g_mul" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="g_mul-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">g_mul</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">instance</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">,</span> <span class="tsd-kind-parameter">a</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">,</span> <span class="tsd-kind-parameter">b</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span><a href="#g_mul-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Multiplies two values in a Galois field.</p>
|
80 |
+
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">instance</span>: <span class="tsd-signature-type">any</span></span><div class="tsd-comment tsd-typography"><p>The current context containing Galois field parameters.</p>
|
81 |
+
</div><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">a</span>: <span class="tsd-signature-type">number</span></span><div class="tsd-comment tsd-typography"><p>The first value to be multiplied.</p>
|
82 |
+
</div><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">b</span>: <span class="tsd-signature-type">number</span></span><div class="tsd-comment tsd-typography"><p>The second value to be multiplied.</p>
|
83 |
+
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">number</span></h4><p>The product of the two values in the Galois field.</p>
|
84 |
+
<div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/bgon/trustmark.js/blob/af9ff3e40e7e332b93baad3473cd6f5664988512/src/bchecc.ts#L624">bchecc.ts:624</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><a id="g_pow" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>g_<wbr/>pow</span><a href="#g_pow" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="g_pow-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">g_pow</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">instance</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">,</span> <span class="tsd-kind-parameter">i</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span><a href="#g_pow-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Computes the power of a value in a Galois field.</p>
|
85 |
+
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">instance</span>: <span class="tsd-signature-type">any</span></span><div class="tsd-comment tsd-typography"><p>The current context containing Galois field parameters.</p>
|
86 |
+
</div><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">i</span>: <span class="tsd-signature-type">number</span></span><div class="tsd-comment tsd-typography"><p>The exponent value.</p>
|
87 |
+
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">number</span></h4><p>The result of raising a value to the power i in the Galois field.</p>
|
88 |
+
<div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/bgon/trustmark.js/blob/af9ff3e40e7e332b93baad3473cd6f5664988512/src/bchecc.ts#L589">bchecc.ts:589</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><a id="g_sqrt" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>g_<wbr/>sqrt</span><a href="#g_sqrt" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="g_sqrt-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">g_sqrt</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">instance</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">,</span> <span class="tsd-kind-parameter">a</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span><a href="#g_sqrt-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Computes the square root of a value in a Galois field.</p>
|
89 |
+
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">instance</span>: <span class="tsd-signature-type">any</span></span><div class="tsd-comment tsd-typography"><p>The current context containing Galois field parameters.</p>
|
90 |
+
</div><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">a</span>: <span class="tsd-signature-type">number</span></span><div class="tsd-comment tsd-typography"><p>The value whose square root is to be computed.</p>
|
91 |
+
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">number</span></h4><p>The square root of the value in the Galois field.</p>
|
92 |
+
<div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/bgon/trustmark.js/blob/af9ff3e40e7e332b93baad3473cd6f5664988512/src/bchecc.ts#L599">bchecc.ts:599</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><a id="geteccbits" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>get<wbr/>Ecc<wbr/>Bits</span><a href="#geteccbits" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="geteccbits-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">getEccBits</span><span class="tsd-signature-symbol">()</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span><a href="#geteccbits-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Gets the number of ECC bits.</p>
|
93 |
+
</div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">number</span></h4><ul>
|
94 |
+
<li>The number of ECC bits.</li>
|
95 |
+
</ul>
|
96 |
+
<div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/bgon/trustmark.js/blob/af9ff3e40e7e332b93baad3473cd6f5664988512/src/bchecc.ts#L516">bchecc.ts:516</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><a id="geteccbytes" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>get<wbr/>Ecc<wbr/>Bytes</span><a href="#geteccbytes" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="geteccbytes-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">getEccBytes</span><span class="tsd-signature-symbol">()</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span><a href="#geteccbytes-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Gets the number of ECC bytes.</p>
|
97 |
+
</div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">number</span></h4><ul>
|
98 |
+
<li>The number of ECC bytes.</li>
|
99 |
+
</ul>
|
100 |
+
<div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/bgon/trustmark.js/blob/af9ff3e40e7e332b93baad3473cd6f5664988512/src/bchecc.ts#L524">bchecc.ts:524</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><a id="getroots" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>get<wbr/>Roots</span><a href="#getroots" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="getroots-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">getRoots</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">instance</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">,</span> <span class="tsd-kind-parameter">k</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">,</span> <span class="tsd-kind-parameter">poly</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span><a href="#getroots-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Finds the roots of a polynomial.</p>
|
101 |
+
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">instance</span>: <span class="tsd-signature-type">any</span></span><div class="tsd-comment tsd-typography"><p>The instance of the ECC state.</p>
|
102 |
+
</div><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">k</span>: <span class="tsd-signature-type">number</span></span><div class="tsd-comment tsd-typography"><p>The degree of the polynomial.</p>
|
103 |
+
</div><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">poly</span>: <span class="tsd-signature-type">any</span></span><div class="tsd-comment tsd-typography"><p>The polynomial.</p>
|
104 |
+
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">number</span></h4><ul>
|
105 |
+
<li>The number of roots found.</li>
|
106 |
+
</ul>
|
107 |
+
<div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/bgon/trustmark.js/blob/af9ff3e40e7e332b93baad3473cd6f5664988512/src/bchecc.ts#L428">bchecc.ts:428</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><a id="mod" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>mod</span><a href="#mod" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="mod-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">mod</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">instance</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">,</span> <span class="tsd-kind-parameter">v</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span><a href="#mod-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Reduces a value modulo the Galois field size.</p>
|
108 |
+
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">instance</span>: <span class="tsd-signature-type">any</span></span><div class="tsd-comment tsd-typography"><p>The current context containing Galois field parameters.</p>
|
109 |
+
</div><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">v</span>: <span class="tsd-signature-type">number</span></span><div class="tsd-comment tsd-typography"><p>The value to be reduced.</p>
|
110 |
+
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">number</span></h4><p>The value reduced modulo the Galois field size.</p>
|
111 |
+
<div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/bgon/trustmark.js/blob/af9ff3e40e7e332b93baad3473cd6f5664988512/src/bchecc.ts#L656">bchecc.ts:656</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><a id="modn" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>modn</span><a href="#modn" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="modn-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">modn</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">instance</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">,</span> <span class="tsd-kind-parameter">v</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span><a href="#modn-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Reduces a value modulo the Galois field size.</p>
|
112 |
+
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">instance</span>: <span class="tsd-signature-type">any</span></span><div class="tsd-comment tsd-typography"><p>The current context containing Galois field parameters.</p>
|
113 |
+
</div><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">v</span>: <span class="tsd-signature-type">number</span></span><div class="tsd-comment tsd-typography"><p>The value to be reduced.</p>
|
114 |
+
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">number</span></h4><p>The value reduced modulo the Galois field size.</p>
|
115 |
+
<div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/bgon/trustmark.js/blob/af9ff3e40e7e332b93baad3473cd6f5664988512/src/bchecc.ts#L670">bchecc.ts:670</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><a id="numbertobinarystring" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>number<wbr/>To<wbr/>Binary<wbr/>String</span><a href="#numbertobinarystring" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="numbertobinarystring-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">numberToBinaryString</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">num</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">,</span> <span class="tsd-kind-parameter">length</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><a href="#numbertobinarystring-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Converts a number to a binary string of a given length.</p>
|
116 |
+
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">num</span>: <span class="tsd-signature-type">number</span></span><div class="tsd-comment tsd-typography"><p>The number to convert.</p>
|
117 |
+
</div><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">length</span>: <span class="tsd-signature-type">number</span></span><div class="tsd-comment tsd-typography"><p>The desired length of the binary string.</p>
|
118 |
+
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">string</span></h4><ul>
|
119 |
+
<li>The binary string representation of the number.</li>
|
120 |
+
</ul>
|
121 |
+
<div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/bgon/trustmark.js/blob/af9ff3e40e7e332b93baad3473cd6f5664988512/src/bchecc.ts#L805">bchecc.ts:805</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><a id="toasciistring" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>to<wbr/>Ascii<wbr/>String</span><a href="#toasciistring" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="toasciistring-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">toAsciiString</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">data</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><a href="#toasciistring-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Decodes a Uint8Array to a string using 7-bit ASCII encoding.</p>
|
122 |
+
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">data</span>: <span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">[]</span></span><div class="tsd-comment tsd-typography"><p>The input byte array.</p>
|
123 |
+
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">string</span></h4><ul>
|
124 |
+
<li>The decoded string.</li>
|
125 |
+
</ul>
|
126 |
+
<div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/bgon/trustmark.js/blob/af9ff3e40e7e332b93baad3473cd6f5664988512/src/bchecc.ts#L818">bchecc.ts:818</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><a id="tobinstring" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>to<wbr/>Bin<wbr/>String</span><a href="#tobinstring" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="tobinstring-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">toBinString</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">dataout</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">,</span> <span class="tsd-kind-parameter">datalen</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><a href="#tobinstring-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Generates a binary string from data.</p>
|
127 |
+
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">dataout</span>: <span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">[]</span></span><div class="tsd-comment tsd-typography"><p>The data output array.</p>
|
128 |
+
</div><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">datalen</span>: <span class="tsd-signature-type">number</span></span><div class="tsd-comment tsd-typography"><p>The desired length of the binary string.</p>
|
129 |
+
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">string</span></h4><ul>
|
130 |
+
<li>The binary string representation of the data.</li>
|
131 |
+
</ul>
|
132 |
+
<div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/bgon/trustmark.js/blob/af9ff3e40e7e332b93baad3473cd6f5664988512/src/bchecc.ts#L790">bchecc.ts:790</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><a id="tohexstring" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>to<wbr/>Hex<wbr/>String</span><a href="#tohexstring" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="tohexstring-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">toHexString</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">data</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">,</span> <span class="tsd-kind-parameter">datalen</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><a href="#tohexstring-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Converts an array of numbers to a hexadecimal string.</p>
|
133 |
+
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">data</span>: <span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">[]</span></span><div class="tsd-comment tsd-typography"><p>The array of numbers to convert.</p>
|
134 |
+
</div><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">datalen</span>: <span class="tsd-signature-type">number</span></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">string</span></h4><ul>
|
135 |
+
<li>The hexadecimal string representation of the numbers.</li>
|
136 |
+
</ul>
|
137 |
+
<div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/bgon/trustmark.js/blob/af9ff3e40e7e332b93baad3473cd6f5664988512/src/bchecc.ts#L841">bchecc.ts:841</a></li></ul></aside></div></li></ul></section></section></details></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-accordion"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div><details open class="tsd-accordion tsd-page-navigation"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>On This Page</h3></summary><div class="tsd-accordion-details"><details open class="tsd-accordion tsd-page-navigation-section"><summary class="tsd-accordion-summary" data-key="section-Constructors"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Constructors</summary><div><a href="#constructor" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Constructor"><use href="../assets/icons.svg#icon-512"></use></svg><span>constructor</span></a></div></details><details open class="tsd-accordion tsd-page-navigation-section"><summary class="tsd-accordion-summary" data-key="section-Properties"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Properties</summary><div><a href="#eccstate" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>ECCstate</span></a></div></details><details open class="tsd-accordion tsd-page-navigation-section"><summary class="tsd-accordion-summary" data-key="section-Methods"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Methods</summary><div><a href="#buildcyclic" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>build<wbr/>Cyclic</span></a><a href="#ceilop" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>ceilop</span></a><a href="#convertallbitstobigints" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>convert<wbr/>All<wbr/>Bits<wbr/>To<wbr/>Big<wbr/>Ints</span></a><a href="#convertbitstobigint" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>convert<wbr/>Bits<wbr/>To<wbr/>Big<wbr/>Int</span></a><a href="#convertbytestobigint" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>convert<wbr/>Bytes<wbr/>To<wbr/>Big<wbr/>Int</span></a><a href="#decode" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>decode</span></a><a href="#deg" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>deg</span></a><a href="#degbigint" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>deg<wbr/>Big<wbr/>Int</span></a><a href="#encode" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>encode</span></a><a href="#g_div" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>g_<wbr/>div</span></a><a href="#g_log" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>g_<wbr/>log</span></a><a href="#g_mul" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>g_<wbr/>mul</span></a><a href="#g_pow" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>g_<wbr/>pow</span></a><a href="#g_sqrt" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>g_<wbr/>sqrt</span></a><a href="#geteccbits" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>get<wbr/>Ecc<wbr/>Bits</span></a><a href="#geteccbytes" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>get<wbr/>Ecc<wbr/>Bytes</span></a><a href="#getroots" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>get<wbr/>Roots</span></a><a href="#mod" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>mod</span></a><a href="#modn" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>modn</span></a><a href="#numbertobinarystring" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>number<wbr/>To<wbr/>Binary<wbr/>String</span></a><a href="#toasciistring" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>to<wbr/>Ascii<wbr/>String</span></a><a href="#tobinstring" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>to<wbr/>Bin<wbr/>String</span></a><a href="#tohexstring" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>to<wbr/>Hex<wbr/>String</span></a></div></details></div></details></div><div class="site-menu"><nav class="tsd-navigation"><a href="../modules.html">TrustMark.js</a><ul class="tsd-small-nested-navigation" id="tsd-nav-container"><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>
|
docs/docs/classes/datalayer.DataLayer.html
ADDED
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!DOCTYPE html><html class="default" lang="en" data-base=".."><head><meta charset="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>DataLayer | TrustMark.js</title><link rel="icon" href="../assets/favicon.svg" type="image/svg+xml"/><meta name="description" content="Documentation for TrustMark.js"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script defer src="../assets/main.js"></script><script async src="../assets/icons.js" id="tsd-icons-script"></script><script async src="../assets/search.js" id="tsd-search-script"></script><script async src="../assets/navigation.js" id="tsd-nav-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><div class="table-cell" id="tsd-search"><div class="field"><label for="tsd-search-field" class="tsd-widget tsd-toolbar-icon search no-caption"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-search"></use></svg></label><input type="text" id="tsd-search-field" aria-label="Search"/></div><div class="field"><div id="tsd-toolbar-links"></div></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">TrustMark.js</a></div><div class="table-cell" id="tsd-widgets"><a href="#" class="tsd-widget tsd-toolbar-icon menu no-caption" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-menu"></use></svg></a></div></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb"><li><a href="../modules.html">TrustMark.js</a></li><li><a href="../modules/datalayer.html">datalayer</a></li><li><a href="datalayer.DataLayer.html">DataLayer</a></li></ul><h1>Class DataLayer</h1></div><section class="tsd-panel tsd-comment"><div class="tsd-comment tsd-typography"><p>Data layer for encoding and decoding payloads class.
|
2 |
+
This class utilizes BCH codes for error correction.</p>
|
3 |
+
</div><div class="tsd-comment tsd-typography"></div></section><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/bgon/trustmark.js/blob/af9ff3e40e7e332b93baad3473cd6f5664988512/src/datalayer.ts#L20">datalayer.ts:20</a></li></ul></aside><section class="tsd-panel-group tsd-index-group"><section class="tsd-panel tsd-index-panel"><details class="tsd-index-content tsd-accordion" open><summary class="tsd-accordion-summary tsd-index-summary"><h5 class="tsd-index-heading uppercase" role="button" aria-expanded="false" tabIndex="0"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronSmall"></use></svg> Index</h5></summary><div class="tsd-accordion-details"><section class="tsd-index-section"><h3 class="tsd-index-heading">Constructors</h3><div class="tsd-index-list"><a href="datalayer.DataLayer.html#constructor" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Constructor"><use href="../assets/icons.svg#icon-512"></use></svg><span>constructor</span></a>
|
4 |
+
</div></section><section class="tsd-index-section"><h3 class="tsd-index-heading">Properties</h3><div class="tsd-index-list"><a href="datalayer.DataLayer.html#bch_decoders" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>bch_<wbr/>decoders</span></a>
|
5 |
+
<a href="datalayer.DataLayer.html#bch_encoder" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>bch_<wbr/>encoder</span></a>
|
6 |
+
<a href="datalayer.DataLayer.html#encoding_mode" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>encoding_<wbr/>mode</span></a>
|
7 |
+
<a href="datalayer.DataLayer.html#payload_len" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>payload_<wbr/>len</span></a>
|
8 |
+
<a href="datalayer.DataLayer.html#versionbits" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>versionbits</span></a>
|
9 |
+
</div></section><section class="tsd-index-section"><h3 class="tsd-index-heading">Methods</h3><div class="tsd-index-list"><a href="datalayer.DataLayer.html#buildbch" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>buildBCH</span></a>
|
10 |
+
<a href="datalayer.DataLayer.html#encodeascii" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>encode<wbr/>Ascii</span></a>
|
11 |
+
<a href="datalayer.DataLayer.html#encodebinary" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>encode<wbr/>Binary</span></a>
|
12 |
+
<a href="datalayer.DataLayer.html#encodepacket" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>encode<wbr/>Packet</span></a>
|
13 |
+
<a href="datalayer.DataLayer.html#encodetext" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>encode<wbr/>Text</span></a>
|
14 |
+
</div></section></div></details></section></section><details class="tsd-panel-group tsd-member-group tsd-accordion" open><summary class="tsd-accordion-summary" data-key="section-Constructors"><h2><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg> Constructors</h2></summary><section><section class="tsd-panel tsd-member"><a id="constructor" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>constructor</span><a href="#constructor" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="constructordatalayer" class="tsd-anchor"></a><span class="tsd-signature-keyword">new</span> <span class="tsd-kind-constructor-signature">DataLayer</span><span class="tsd-signature-symbol">(</span><br/> <span class="tsd-kind-parameter">payload_len</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">,</span><br/> <span class="tsd-kind-parameter">verbose</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">,</span><br/> <span class="tsd-kind-parameter">encoding_mode</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">,</span><br/><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <a href="datalayer.DataLayer.html" class="tsd-signature-type tsd-kind-class">DataLayer</a><a href="#constructordatalayer" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Initializes the DataLayer with specified parameters.</p>
|
15 |
+
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">payload_len</span>: <span class="tsd-signature-type">number</span></span><div class="tsd-comment tsd-typography"><p>The length of the payload in bits.</p>
|
16 |
+
</div><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">verbose</span>: <span class="tsd-signature-type">boolean</span></span><div class="tsd-comment tsd-typography"><p>Flag to indicate if messages should be logged.</p>
|
17 |
+
</div><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">encoding_mode</span>: <span class="tsd-signature-type">number</span></span><div class="tsd-comment tsd-typography"><p>The encoding mode to be used (default is 0).</p>
|
18 |
+
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <a href="datalayer.DataLayer.html" class="tsd-signature-type tsd-kind-class">DataLayer</a></h4><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/bgon/trustmark.js/blob/af9ff3e40e7e332b93baad3473cd6f5664988512/src/datalayer.ts#L33">datalayer.ts:33</a></li></ul></aside></div></li></ul></section></section></details><details class="tsd-panel-group tsd-member-group tsd-accordion" open><summary class="tsd-accordion-summary" data-key="section-Properties"><h2><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg> Properties</h2></summary><section><section class="tsd-panel tsd-member"><a id="bch_decoders" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>bch_<wbr/>decoders</span><a href="#bch_decoders" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">bch_decoders</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Record</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">,</span> <a href="bchecc.BCH.html" class="tsd-signature-type tsd-kind-class">BCH</a><span class="tsd-signature-symbol">></span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/bgon/trustmark.js/blob/af9ff3e40e7e332b93baad3473cd6f5664988512/src/datalayer.ts#L25">datalayer.ts:25</a></li></ul></aside></section><section class="tsd-panel tsd-member"><a id="bch_encoder" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>bch_<wbr/>encoder</span><a href="#bch_encoder" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">bch_encoder</span><span class="tsd-signature-symbol">:</span> <a href="bchecc.BCH.html" class="tsd-signature-type tsd-kind-class">BCH</a></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/bgon/trustmark.js/blob/af9ff3e40e7e332b93baad3473cd6f5664988512/src/datalayer.ts#L24">datalayer.ts:24</a></li></ul></aside></section><section class="tsd-panel tsd-member"><a id="encoding_mode" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>encoding_<wbr/>mode</span><a href="#encoding_mode" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">encoding_mode</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/bgon/trustmark.js/blob/af9ff3e40e7e332b93baad3473cd6f5664988512/src/datalayer.ts#L22">datalayer.ts:22</a></li></ul></aside></section><section class="tsd-panel tsd-member"><a id="payload_len" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>payload_<wbr/>len</span><a href="#payload_len" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">payload_len</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/bgon/trustmark.js/blob/af9ff3e40e7e332b93baad3473cd6f5664988512/src/datalayer.ts#L21">datalayer.ts:21</a></li></ul></aside></section><section class="tsd-panel tsd-member"><a id="versionbits" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>versionbits</span><a href="#versionbits" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">versionbits</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/bgon/trustmark.js/blob/af9ff3e40e7e332b93baad3473cd6f5664988512/src/datalayer.ts#L23">datalayer.ts:23</a></li></ul></aside></section></section></details><details class="tsd-panel-group tsd-member-group tsd-accordion" open><summary class="tsd-accordion-summary" data-key="section-Methods"><h2><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg> Methods</h2></summary><section><section class="tsd-panel tsd-member"><a id="buildbch" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>buildBCH</span><a href="#buildbch" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="buildbch-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">buildBCH</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">encoding_mode</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <a href="bchecc.BCH.html" class="tsd-signature-type tsd-kind-class">BCH</a><a href="#buildbch-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Builds and returns a BCH instance based on the given encoding mode.</p>
|
19 |
+
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">encoding_mode</span>: <span class="tsd-signature-type">number</span></span><div class="tsd-comment tsd-typography"><p>The encoding mode.</p>
|
20 |
+
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <a href="bchecc.BCH.html" class="tsd-signature-type tsd-kind-class">BCH</a></h4><p>A BCH instance configured for the specified encoding mode.</p>
|
21 |
+
<div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/bgon/trustmark.js/blob/af9ff3e40e7e332b93baad3473cd6f5664988512/src/datalayer.ts#L54">datalayer.ts:54</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><a id="encodeascii" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>encode<wbr/>Ascii</span><a href="#encodeascii" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="encodeascii-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">encodeAscii</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">text</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Float32Array</span><a href="#encodeascii-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Encodes a string to a Float32Array using 7-bit ASCII encoding.</p>
|
22 |
+
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">text</span>: <span class="tsd-signature-type">string</span></span><div class="tsd-comment tsd-typography"><p>The input text string.</p>
|
23 |
+
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Float32Array</span></h4><ul>
|
24 |
+
<li>The encoded Float32Array.</li>
|
25 |
+
</ul>
|
26 |
+
<div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/bgon/trustmark.js/blob/af9ff3e40e7e332b93baad3473cd6f5664988512/src/datalayer.ts#L148">datalayer.ts:148</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><a id="encodebinary" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>encode<wbr/>Binary</span><a href="#encodebinary" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="encodebinary-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">encodeBinary</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">strbin</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Float32Array</span><a href="#encodebinary-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Encodes a binary string into a Float32Array with the ECC encoding.</p>
|
27 |
+
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">strbin</span>: <span class="tsd-signature-type">string</span></span><div class="tsd-comment tsd-typography"><p>The input binary string.</p>
|
28 |
+
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Float32Array</span></h4><ul>
|
29 |
+
<li>The encoded Float32Array with the ECC encoding.</li>
|
30 |
+
</ul>
|
31 |
+
<div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/bgon/trustmark.js/blob/af9ff3e40e7e332b93baad3473cd6f5664988512/src/datalayer.ts#L89">datalayer.ts:89</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><a id="encodepacket" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>encode<wbr/>Packet</span><a href="#encodepacket" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="encodepacket-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">encodePacket</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">packet_d</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Float32Array</span><a href="#encodepacket-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Processes and encodes the packet data.</p>
|
32 |
+
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">packet_d</span>: <span class="tsd-signature-type">string</span></span><div class="tsd-comment tsd-typography"><p>The binary string representation of the packet data.</p>
|
33 |
+
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Float32Array</span></h4><ul>
|
34 |
+
<li>The encoded Float32Array.</li>
|
35 |
+
</ul>
|
36 |
+
<div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/bgon/trustmark.js/blob/af9ff3e40e7e332b93baad3473cd6f5664988512/src/datalayer.ts#L99">datalayer.ts:99</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><a id="encodetext" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>encode<wbr/>Text</span><a href="#encodetext" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="encodetext-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">encodeText</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">text</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Float32Array</span><a href="#encodetext-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Encodes a text string into a Float32Array with the ECC encoding.</p>
|
37 |
+
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">text</span>: <span class="tsd-signature-type">string</span></span><div class="tsd-comment tsd-typography"><p>The input text string.</p>
|
38 |
+
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Float32Array</span></h4><ul>
|
39 |
+
<li>The encoded Float32Array.</li>
|
40 |
+
</ul>
|
41 |
+
<div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/bgon/trustmark.js/blob/af9ff3e40e7e332b93baad3473cd6f5664988512/src/datalayer.ts#L72">datalayer.ts:72</a></li></ul></aside></div></li></ul></section></section></details></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-accordion"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div><details open class="tsd-accordion tsd-page-navigation"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>On This Page</h3></summary><div class="tsd-accordion-details"><details open class="tsd-accordion tsd-page-navigation-section"><summary class="tsd-accordion-summary" data-key="section-Constructors"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Constructors</summary><div><a href="#constructor" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Constructor"><use href="../assets/icons.svg#icon-512"></use></svg><span>constructor</span></a></div></details><details open class="tsd-accordion tsd-page-navigation-section"><summary class="tsd-accordion-summary" data-key="section-Properties"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Properties</summary><div><a href="#bch_decoders" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>bch_<wbr/>decoders</span></a><a href="#bch_encoder" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>bch_<wbr/>encoder</span></a><a href="#encoding_mode" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>encoding_<wbr/>mode</span></a><a href="#payload_len" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>payload_<wbr/>len</span></a><a href="#versionbits" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>versionbits</span></a></div></details><details open class="tsd-accordion tsd-page-navigation-section"><summary class="tsd-accordion-summary" data-key="section-Methods"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Methods</summary><div><a href="#buildbch" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>buildBCH</span></a><a href="#encodeascii" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>encode<wbr/>Ascii</span></a><a href="#encodebinary" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>encode<wbr/>Binary</span></a><a href="#encodepacket" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>encode<wbr/>Packet</span></a><a href="#encodetext" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>encode<wbr/>Text</span></a></div></details></div></details></div><div class="site-menu"><nav class="tsd-navigation"><a href="../modules.html">TrustMark.js</a><ul class="tsd-small-nested-navigation" id="tsd-nav-container"><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>
|
docs/docs/classes/trustmark.TrustMark.html
ADDED
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!DOCTYPE html><html class="default" lang="en" data-base=".."><head><meta charset="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>TrustMark | TrustMark.js</title><link rel="icon" href="../assets/favicon.svg" type="image/svg+xml"/><meta name="description" content="Documentation for TrustMark.js"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script defer src="../assets/main.js"></script><script async src="../assets/icons.js" id="tsd-icons-script"></script><script async src="../assets/search.js" id="tsd-search-script"></script><script async src="../assets/navigation.js" id="tsd-nav-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><div class="table-cell" id="tsd-search"><div class="field"><label for="tsd-search-field" class="tsd-widget tsd-toolbar-icon search no-caption"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-search"></use></svg></label><input type="text" id="tsd-search-field" aria-label="Search"/></div><div class="field"><div id="tsd-toolbar-links"></div></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">TrustMark.js</a></div><div class="table-cell" id="tsd-widgets"><a href="#" class="tsd-widget tsd-toolbar-icon menu no-caption" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-menu"></use></svg></a></div></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb"><li><a href="../modules.html">TrustMark.js</a></li><li><a href="../modules/trustmark.html">trustmark</a></li><li><a href="trustmark.TrustMark.html">TrustMark</a></li></ul><h1>Class TrustMark</h1></div><section class="tsd-panel tsd-comment"><div class="tsd-comment tsd-typography"><p>Class representing the TrustMark watermark.
|
2 |
+
This class utilizes ECC (Error Correction Codes) and ONNX models for encoding and decoding.</p>
|
3 |
+
</div><div class="tsd-comment tsd-typography"></div></section><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/bgon/trustmark.js/blob/af9ff3e40e7e332b93baad3473cd6f5664988512/src/trustmark.ts#L42">trustmark.ts:42</a></li></ul></aside><section class="tsd-panel-group tsd-index-group"><section class="tsd-panel tsd-index-panel"><details class="tsd-index-content tsd-accordion" open><summary class="tsd-accordion-summary tsd-index-summary"><h5 class="tsd-index-heading uppercase" role="button" aria-expanded="false" tabIndex="0"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronSmall"></use></svg> Index</h5></summary><div class="tsd-accordion-details"><section class="tsd-index-section"><h3 class="tsd-index-heading">Constructors</h3><div class="tsd-index-list"><a href="trustmark.TrustMark.html#constructor" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Constructor"><use href="../assets/icons.svg#icon-512"></use></svg><span>constructor</span></a>
|
4 |
+
</div></section><section class="tsd-index-section"><h3 class="tsd-index-heading">Properties</h3><div class="tsd-index-list"><a href="trustmark.TrustMark.html#decoder_session" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>decoder_<wbr/>session</span></a>
|
5 |
+
<a href="trustmark.TrustMark.html#ecc" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>ecc</span></a>
|
6 |
+
<a href="trustmark.TrustMark.html#encoder_session" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>encoder_<wbr/>session</span></a>
|
7 |
+
<a href="trustmark.TrustMark.html#model_type" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>model_<wbr/>type</span></a>
|
8 |
+
<a href="trustmark.TrustMark.html#preprocess_224_session" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>preprocess_<wbr/>224_<wbr/>session</span></a>
|
9 |
+
<a href="trustmark.TrustMark.html#preprocess_256_session" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>preprocess_<wbr/>256_<wbr/>session</span></a>
|
10 |
+
<a href="trustmark.TrustMark.html#secret_len" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>secret_<wbr/>len</span></a>
|
11 |
+
<a href="trustmark.TrustMark.html#use_ecc" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>use_<wbr/>ecc</span></a>
|
12 |
+
<a href="trustmark.TrustMark.html#encoding" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>encoding</span></a>
|
13 |
+
</div></section><section class="tsd-index-section"><h3 class="tsd-index-heading">Methods</h3><div class="tsd-index-list"><a href="trustmark.TrustMark.html#decode" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>decode</span></a>
|
14 |
+
<a href="trustmark.TrustMark.html#encode" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>encode</span></a>
|
15 |
+
<a href="trustmark.TrustMark.html#loadimage" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>load<wbr/>Image</span></a>
|
16 |
+
<a href="trustmark.TrustMark.html#loadmodels" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>load<wbr/>Models</span></a>
|
17 |
+
<a href="trustmark.TrustMark.html#processimage" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>process<wbr/>Image</span></a>
|
18 |
+
</div></section></div></details></section></section><details class="tsd-panel-group tsd-member-group tsd-accordion" open><summary class="tsd-accordion-summary" data-key="section-Constructors"><h2><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg> Constructors</h2></summary><section><section class="tsd-panel tsd-member"><a id="constructor" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>constructor</span><a href="#constructor" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="constructortrustmark" class="tsd-anchor"></a><span class="tsd-signature-keyword">new</span> <span class="tsd-kind-constructor-signature">TrustMark</span><span class="tsd-signature-symbol">(</span><br/> <span class="tsd-kind-parameter">use_ecc</span><span class="tsd-signature-symbol">?:</span> <span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">,</span><br/> <span class="tsd-kind-parameter">secret_len</span><span class="tsd-signature-symbol">?:</span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">,</span><br/> <span class="tsd-kind-parameter">encoding_mode</span><span class="tsd-signature-symbol">?:</span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">,</span><br/><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <a href="trustmark.TrustMark.html" class="tsd-signature-type tsd-kind-class">TrustMark</a><a href="#constructortrustmark" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Constructs a new TrustMark instance.</p>
|
19 |
+
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><code class="tsd-tag">Optional</code><span class="tsd-kind-parameter">use_ecc</span>: <span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol"> = true</span></span><div class="tsd-comment tsd-typography"><p>use BCH error correction on the payload, reducing payload size (default)</p>
|
20 |
+
</div><div class="tsd-comment tsd-typography"></div></li><li><span><code class="tsd-tag">Optional</code><span class="tsd-kind-parameter">secret_len</span>: <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol"> = 100</span></span><div class="tsd-comment tsd-typography"><p>The length of the secret.</p>
|
21 |
+
</div><div class="tsd-comment tsd-typography"></div></li><li><span><code class="tsd-tag">Optional</code><span class="tsd-kind-parameter">encoding_mode</span>: <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol"> = TrustMark.encoding.BCH_4</span></span><div class="tsd-comment tsd-typography"><p>The data schema encoding mode to use.</p>
|
22 |
+
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <a href="trustmark.TrustMark.html" class="tsd-signature-type tsd-kind-class">TrustMark</a></h4><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/bgon/trustmark.js/blob/af9ff3e40e7e332b93baad3473cd6f5664988512/src/trustmark.ts#L67">trustmark.ts:67</a></li></ul></aside></div></li></ul></section></section></details><details class="tsd-panel-group tsd-member-group tsd-accordion" open><summary class="tsd-accordion-summary" data-key="section-Properties"><h2><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg> Properties</h2></summary><section><section class="tsd-panel tsd-member"><a id="decoder_session" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>decoder_<wbr/>session</span><a href="#decoder_session" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">decoder_session</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">any</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/bgon/trustmark.js/blob/af9ff3e40e7e332b93baad3473cd6f5664988512/src/trustmark.ts#L55">trustmark.ts:55</a></li></ul></aside></section><section class="tsd-panel tsd-member"><a id="ecc" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>ecc</span><a href="#ecc" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">ecc</span><span class="tsd-signature-symbol">:</span> <a href="datalayer.DataLayer.html" class="tsd-signature-type tsd-kind-class">DataLayer</a></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/bgon/trustmark.js/blob/af9ff3e40e7e332b93baad3473cd6f5664988512/src/trustmark.ts#L54">trustmark.ts:54</a></li></ul></aside></section><section class="tsd-panel tsd-member"><a id="encoder_session" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>encoder_<wbr/>session</span><a href="#encoder_session" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">encoder_session</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">any</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/bgon/trustmark.js/blob/af9ff3e40e7e332b93baad3473cd6f5664988512/src/trustmark.ts#L56">trustmark.ts:56</a></li></ul></aside></section><section class="tsd-panel tsd-member"><a id="model_type" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>model_<wbr/>type</span><a href="#model_type" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">model_type</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">undefined</span> <span class="tsd-signature-symbol">|</span> <span class="tsd-signature-type">string</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/bgon/trustmark.js/blob/af9ff3e40e7e332b93baad3473cd6f5664988512/src/trustmark.ts#L59">trustmark.ts:59</a></li></ul></aside></section><section class="tsd-panel tsd-member"><a id="preprocess_224_session" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>preprocess_<wbr/>224_<wbr/>session</span><a href="#preprocess_224_session" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">preprocess_224_session</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">any</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/bgon/trustmark.js/blob/af9ff3e40e7e332b93baad3473cd6f5664988512/src/trustmark.ts#L57">trustmark.ts:57</a></li></ul></aside></section><section class="tsd-panel tsd-member"><a id="preprocess_256_session" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>preprocess_<wbr/>256_<wbr/>session</span><a href="#preprocess_256_session" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">preprocess_256_session</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">any</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/bgon/trustmark.js/blob/af9ff3e40e7e332b93baad3473cd6f5664988512/src/trustmark.ts#L58">trustmark.ts:58</a></li></ul></aside></section><section class="tsd-panel tsd-member"><a id="secret_len" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>secret_<wbr/>len</span><a href="#secret_len" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">secret_len</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/bgon/trustmark.js/blob/af9ff3e40e7e332b93baad3473cd6f5664988512/src/trustmark.ts#L53">trustmark.ts:53</a></li></ul></aside></section><section class="tsd-panel tsd-member"><a id="use_ecc" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>use_<wbr/>ecc</span><a href="#use_ecc" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">use_ecc</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/bgon/trustmark.js/blob/af9ff3e40e7e332b93baad3473cd6f5664988512/src/trustmark.ts#L52">trustmark.ts:52</a></li></ul></aside></section><section class="tsd-panel tsd-member"><a id="encoding" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><code class="tsd-tag">Static</code><span>encoding</span><a href="#encoding" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">encoding</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">{</span><br/> <span class="tsd-kind-property">BCH_3</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-kind-property">BCH_4</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-kind-property">BCH_5</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-kind-property">BCH_SUPER</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-kind-property">undefined</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">;</span><br/><span class="tsd-signature-symbol">}</span><span class="tsd-signature-symbol"> = ...</span></div><div class="tsd-comment tsd-typography"><ul>
|
23 |
+
<li>Static encoding mapping for different BCH modes.</li>
|
24 |
+
</ul>
|
25 |
+
</div><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/bgon/trustmark.js/blob/af9ff3e40e7e332b93baad3473cd6f5664988512/src/trustmark.ts#L44">trustmark.ts:44</a></li></ul></aside></section></section></details><details class="tsd-panel-group tsd-member-group tsd-accordion" open><summary class="tsd-accordion-summary" data-key="section-Methods"><h2><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg> Methods</h2></summary><section><section class="tsd-panel tsd-member"><a id="decode" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>decode</span><a href="#decode" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="decode-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">decode</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">image_url</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">></span><a href="#decode-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Decodes the watermark of an image from a given URL.</p>
|
26 |
+
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">image_url</span>: <span class="tsd-signature-type">string</span></span><div class="tsd-comment tsd-typography"><p>The URL of the image to decode.</p>
|
27 |
+
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">></span></h4><p>A promise that resolves to the decoded watermnark data.</p>
|
28 |
+
<div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/bgon/trustmark.js/blob/af9ff3e40e7e332b93baad3473cd6f5664988512/src/trustmark.ts#L79">trustmark.ts:79</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><a id="encode" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>encode</span><a href="#encode" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="encode-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">encode</span><span class="tsd-signature-symbol">(</span><br/> <span class="tsd-kind-parameter">image_url</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">,</span><br/> <span class="tsd-kind-parameter">string_secret</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">,</span><br/> <span class="tsd-kind-parameter">wm_strength</span><span class="tsd-signature-symbol">?:</span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">,</span><br/> <span class="tsd-kind-parameter">maculate</span><span class="tsd-signature-symbol">?:</span> <span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">,</span><br/> <span class="tsd-kind-parameter">output</span><span class="tsd-signature-symbol">?:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">,</span><br/><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">></span><a href="#encode-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Encodes a secret into an image and returns the stego image and the residual image.</p>
|
29 |
+
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">image_url</span>: <span class="tsd-signature-type">string</span></span><div class="tsd-comment tsd-typography"><p>The cover image data.</p>
|
30 |
+
</div><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">string_secret</span>: <span class="tsd-signature-type">string</span></span><div class="tsd-comment tsd-typography"><p>The secret string to encode.</p>
|
31 |
+
</div><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">wm_strength</span>: <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol"> = 0.4</span></span><div class="tsd-comment tsd-typography"><p>The watermark strength. Default is 0.4.</p>
|
32 |
+
</div><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">maculate</span>: <span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol"> = false</span></span><div class="tsd-comment tsd-typography"><p>Whether to overwrite an existing watermark with random values. Default is false.</p>
|
33 |
+
</div><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">output</span>: <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> = 'bytes'</span></span><div class="tsd-comment tsd-typography"><p>The output format. Default is 'bytes'.</p>
|
34 |
+
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">></span></h4><p>A promise that resolves with the encoded data or rejects with an error.</p>
|
35 |
+
<div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/bgon/trustmark.js/blob/af9ff3e40e7e332b93baad3473cd6f5664988512/src/trustmark.ts#L141">trustmark.ts:141</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><a id="loadimage" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>load<wbr/>Image</span><a href="#loadimage" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="loadimage-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">loadImage</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">image_url</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">,</span> <span class="tsd-kind-parameter">process_type</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">></span><a href="#loadimage-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Loads an image from a URL or filesystem and processes it based on the specified type.</p>
|
36 |
+
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">image_url</span>: <span class="tsd-signature-type">string</span></span><div class="tsd-comment tsd-typography"><p>The URL or filesystem path of the image to be loaded.</p>
|
37 |
+
</div><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">process_type</span>: <span class="tsd-signature-type">string</span></span><div class="tsd-comment tsd-typography"><p>The type of processing to be applied to the image.</p>
|
38 |
+
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">></span></h4><p>A promise that resolves with the processed image.</p>
|
39 |
+
<div class="tsd-comment tsd-typography"><div class="tsd-tag-throws"><h4 class="tsd-anchor-link"><a id="throws" class="tsd-anchor"></a>Throws<a href="#throws" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><p>Throws an error if there is an issue loading or processing the image.</p>
|
40 |
+
</div></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/bgon/trustmark.js/blob/af9ff3e40e7e332b93baad3473cd6f5664988512/src/trustmark.ts#L365">trustmark.ts:365</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><a id="loadmodels" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>load<wbr/>Models</span><a href="#loadmodels" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="loadmodels-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">loadModels</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">type</span><span class="tsd-signature-symbol">?:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span><a href="#loadmodels-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Loads the necessary models based on the specified type.</p>
|
41 |
+
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><code class="tsd-tag">Optional</code><span class="tsd-kind-parameter">type</span>: <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> = 'Q'</span></span><div class="tsd-comment tsd-typography"><p>The type of models to load ('Q' or 'P').</p>
|
42 |
+
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></h4><div class="tsd-comment tsd-typography"><div class="tsd-tag-throws"><h4 class="tsd-anchor-link"><a id="throws-1" class="tsd-anchor"></a>Throws<a href="#throws-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><p>Throws an error if there is an issue loading any of the models.</p>
|
43 |
+
</div></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/bgon/trustmark.js/blob/af9ff3e40e7e332b93baad3473cd6f5664988512/src/trustmark.ts#L400">trustmark.ts:400</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><a id="processimage" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>process<wbr/>Image</span><a href="#processimage" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="processimage-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">processImage</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">image</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">,</span> <span class="tsd-kind-parameter">process_type</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">></span><a href="#processimage-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Processes the input image based on the specified processing type.</p>
|
44 |
+
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">image</span>: <span class="tsd-signature-type">any</span></span><div class="tsd-comment tsd-typography"><p>The image object containing the tensor source and other properties.</p>
|
45 |
+
</div><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">process_type</span>: <span class="tsd-signature-type">string</span></span><div class="tsd-comment tsd-typography"><p>The type of processing to be applied to the image ('decode' or other types).</p>
|
46 |
+
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">></span></h4><p>A promise that resolves with the processed image.</p>
|
47 |
+
<div class="tsd-comment tsd-typography"><div class="tsd-tag-throws"><h4 class="tsd-anchor-link"><a id="throws-2" class="tsd-anchor"></a>Throws<a href="#throws-2" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><p>Throws an error if there is an issue processing the image.</p>
|
48 |
+
</div></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/bgon/trustmark.js/blob/af9ff3e40e7e332b93baad3473cd6f5664988512/src/trustmark.ts#L300">trustmark.ts:300</a></li></ul></aside></div></li></ul></section></section></details></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-accordion"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div><details open class="tsd-accordion tsd-page-navigation"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>On This Page</h3></summary><div class="tsd-accordion-details"><details open class="tsd-accordion tsd-page-navigation-section"><summary class="tsd-accordion-summary" data-key="section-Constructors"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Constructors</summary><div><a href="#constructor" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Constructor"><use href="../assets/icons.svg#icon-512"></use></svg><span>constructor</span></a></div></details><details open class="tsd-accordion tsd-page-navigation-section"><summary class="tsd-accordion-summary" data-key="section-Properties"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Properties</summary><div><a href="#decoder_session" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>decoder_<wbr/>session</span></a><a href="#ecc" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>ecc</span></a><a href="#encoder_session" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>encoder_<wbr/>session</span></a><a href="#model_type" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>model_<wbr/>type</span></a><a href="#preprocess_224_session" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>preprocess_<wbr/>224_<wbr/>session</span></a><a href="#preprocess_256_session" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>preprocess_<wbr/>256_<wbr/>session</span></a><a href="#secret_len" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>secret_<wbr/>len</span></a><a href="#use_ecc" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>use_<wbr/>ecc</span></a><a href="#encoding" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>encoding</span></a></div></details><details open class="tsd-accordion tsd-page-navigation-section"><summary class="tsd-accordion-summary" data-key="section-Methods"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Methods</summary><div><a href="#decode" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>decode</span></a><a href="#encode" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>encode</span></a><a href="#loadimage" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>load<wbr/>Image</span></a><a href="#loadmodels" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>load<wbr/>Models</span></a><a href="#processimage" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>process<wbr/>Image</span></a></div></details></div></details></div><div class="site-menu"><nav class="tsd-navigation"><a href="../modules.html">TrustMark.js</a><ul class="tsd-small-nested-navigation" id="tsd-nav-container"><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>
|
docs/docs/functions/datalayer.getSchemaCapacity.html
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!DOCTYPE html><html class="default" lang="en" data-base=".."><head><meta charset="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>getSchemaCapacity | TrustMark.js</title><link rel="icon" href="../assets/favicon.svg" type="image/svg+xml"/><meta name="description" content="Documentation for TrustMark.js"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script defer src="../assets/main.js"></script><script async src="../assets/icons.js" id="tsd-icons-script"></script><script async src="../assets/search.js" id="tsd-search-script"></script><script async src="../assets/navigation.js" id="tsd-nav-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><div class="table-cell" id="tsd-search"><div class="field"><label for="tsd-search-field" class="tsd-widget tsd-toolbar-icon search no-caption"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-search"></use></svg></label><input type="text" id="tsd-search-field" aria-label="Search"/></div><div class="field"><div id="tsd-toolbar-links"></div></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">TrustMark.js</a></div><div class="table-cell" id="tsd-widgets"><a href="#" class="tsd-widget tsd-toolbar-icon menu no-caption" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-menu"></use></svg></a></div></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb"><li><a href="../modules.html">TrustMark.js</a></li><li><a href="../modules/datalayer.html">datalayer</a></li><li><a href="datalayer.getSchemaCapacity.html">getSchemaCapacity</a></li></ul><h1>Function getSchemaCapacity</h1></div><section class="tsd-panel"><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="getschemacapacity" class="tsd-anchor"></a><span class="tsd-kind-call-signature">getSchemaCapacity</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">schema_version</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span><a href="#getschemacapacity" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Returns the schema payload capacity based on the given version.</p>
|
2 |
+
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">schema_version</span>: <span class="tsd-signature-type">number</span></span><div class="tsd-comment tsd-typography"><p>The version of the schema.</p>
|
3 |
+
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">number</span></h4><ul>
|
4 |
+
<li>The payload capacity of the schema or 0 if the version is invalid.</li>
|
5 |
+
</ul>
|
6 |
+
<div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/bgon/trustmark.js/blob/af9ff3e40e7e332b93baad3473cd6f5664988512/src/datalayer.ts#L177">datalayer.ts:177</a></li></ul></aside></div></li></ul></section></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-accordion"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div></div><div class="site-menu"><nav class="tsd-navigation"><a href="../modules.html">TrustMark.js</a><ul class="tsd-small-nested-navigation" id="tsd-nav-container"><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>
|
docs/docs/functions/datalayer.getSchemaVersion.html
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!DOCTYPE html><html class="default" lang="en" data-base=".."><head><meta charset="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>getSchemaVersion | TrustMark.js</title><link rel="icon" href="../assets/favicon.svg" type="image/svg+xml"/><meta name="description" content="Documentation for TrustMark.js"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script defer src="../assets/main.js"></script><script async src="../assets/icons.js" id="tsd-icons-script"></script><script async src="../assets/search.js" id="tsd-search-script"></script><script async src="../assets/navigation.js" id="tsd-nav-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><div class="table-cell" id="tsd-search"><div class="field"><label for="tsd-search-field" class="tsd-widget tsd-toolbar-icon search no-caption"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-search"></use></svg></label><input type="text" id="tsd-search-field" aria-label="Search"/></div><div class="field"><div id="tsd-toolbar-links"></div></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">TrustMark.js</a></div><div class="table-cell" id="tsd-widgets"><a href="#" class="tsd-widget tsd-toolbar-icon menu no-caption" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-menu"></use></svg></a></div></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb"><li><a href="../modules.html">TrustMark.js</a></li><li><a href="../modules/datalayer.html">datalayer</a></li><li><a href="datalayer.getSchemaVersion.html">getSchemaVersion</a></li></ul><h1>Function getSchemaVersion</h1></div><section class="tsd-panel"><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="getschemaversion" class="tsd-anchor"></a><span class="tsd-kind-call-signature">getSchemaVersion</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">binary_array</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span><a href="#getschemaversion" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Returns the schema version based on the given binary array.</p>
|
2 |
+
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">binary_array</span>: <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">[]</span></span><div class="tsd-comment tsd-typography"><p>The input binary array.</p>
|
3 |
+
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">number</span></h4><ul>
|
4 |
+
<li>The schema version.</li>
|
5 |
+
</ul>
|
6 |
+
<div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/bgon/trustmark.js/blob/af9ff3e40e7e332b93baad3473cd6f5664988512/src/datalayer.ts#L198">datalayer.ts:198</a></li></ul></aside></div></li></ul></section></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-accordion"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div></div><div class="site-menu"><nav class="tsd-navigation"><a href="../modules.html">TrustMark.js</a><ul class="tsd-small-nested-navigation" id="tsd-nav-container"><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>
|
docs/docs/index.html
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!DOCTYPE html><html class="default" lang="en" data-base="."><head><meta charset="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>TrustMark.js</title><link rel="icon" href="assets/favicon.svg" type="image/svg+xml"/><meta name="description" content="Documentation for TrustMark.js"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="assets/style.css"/><link rel="stylesheet" href="assets/highlight.css"/><script defer src="assets/main.js"></script><script async src="assets/icons.js" id="tsd-icons-script"></script><script async src="assets/search.js" id="tsd-search-script"></script><script async src="assets/navigation.js" id="tsd-nav-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><div class="table-cell" id="tsd-search"><div class="field"><label for="tsd-search-field" class="tsd-widget tsd-toolbar-icon search no-caption"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="assets/icons.svg#icon-search"></use></svg></label><input type="text" id="tsd-search-field" aria-label="Search"/></div><div class="field"><div id="tsd-toolbar-links"></div></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="index.html" class="title">TrustMark.js</a></div><div class="table-cell" id="tsd-widgets"><a href="#" class="tsd-widget tsd-toolbar-icon menu no-caption" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="assets/icons.svg#icon-menu"></use></svg></a></div></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><h1>TrustMark.js</h1></div><div class="tsd-panel tsd-typography"><a id="trustmarkjs" class="tsd-anchor"></a><h1 class="tsd-anchor-link">TrustMark.js<a href="#trustmarkjs" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="assets/icons.svg#icon-anchor"></use></svg></a></h1><p>Javascript implementation of TrustMark watermarking as described in <a href="https://arxiv.org/abs/2311.18297">TrustMark - Universal Watermarking for Arbitrary Resolution Images</a> for encoding & decoding TrustMark watermarks in modern browsers as well as Node.js.</p>
|
2 |
+
<a id="important" class="tsd-anchor"></a><h1 class="tsd-anchor-link">Important!<a href="#important" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="assets/icons.svg#icon-anchor"></use></svg></a></h1><p>TrustMark.js <strong>is not suitable</strong> for production environments. Handling large image files significantly increases memory allocation, which can cause browser tab crashes or memory errors in a Node.js environment.</p>
|
3 |
+
<a id="usage-browser" class="tsd-anchor"></a><h1 class="tsd-anchor-link">Usage Browser<a href="#usage-browser" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="assets/icons.svg#icon-anchor"></use></svg></a></h1><p>Add the <code>onnxruntime-web</code> and <code>@tensorflow/tfjs</code> dependencies to your main HTML file:</p>
|
4 |
+
<pre><code class="html"><span class="hl-0"><</span><span class="hl-1">script</span><span class="hl-2"> </span><span class="hl-3">src</span><span class="hl-2">=</span><span class="hl-4">"https://cdn.jsdelivr.net/npm/onnxruntime-web@latest/dist/ort.min.js"</span><span class="hl-0">></</span><span class="hl-1">script</span><span class="hl-0">></span><br/><span class="hl-0"><</span><span class="hl-1">script</span><span class="hl-2"> </span><span class="hl-3">src</span><span class="hl-2">=</span><span class="hl-4">"https://cdn.jsdelivr.net/npm/@tensorflow/tfjs@latest/dist/tf.min.js"</span><span class="hl-0">></</span><span class="hl-1">script</span><span class="hl-0">></span>
|
5 |
+
</code><button type="button">Copy</button></pre>
|
6 |
+
|
7 |
+
<pre><code class="javascript"><span class="hl-5">import</span><span class="hl-6"> { </span><span class="hl-7">TrustMark</span><span class="hl-6"> } </span><span class="hl-5">from</span><span class="hl-6"> </span><span class="hl-8">'./dist/index.js'</span><span class="hl-6">;</span><br/><span class="hl-9">//Instanciate Trustmark</span><br/><span class="hl-10">const</span><span class="hl-6"> </span><span class="hl-11">tm</span><span class="hl-6"> = </span><span class="hl-10">new</span><span class="hl-6"> </span><span class="hl-12">TrustMark</span><span class="hl-6">()</span><br/><br/><span class="hl-9">// Load the models</span><br/><span class="hl-5">await</span><span class="hl-6"> </span><span class="hl-7">tm</span><span class="hl-6">.</span><span class="hl-12">load_models</span><span class="hl-6">()</span><br/><span class="hl-9">// Decode an Image</span><br/><span class="hl-10">let</span><span class="hl-6"> </span><span class="hl-7">decoded</span><span class="hl-6"> = </span><span class="hl-5">await</span><span class="hl-6"> </span><span class="hl-7">tm</span><span class="hl-6">.</span><span class="hl-12">decode</span><span class="hl-6">(</span><span class="hl-8">"tests/fixtures/Django_Reinhardt_(Gottlieb_07301)_watermarked.jpeg"</span><span class="hl-6">);</span>
|
8 |
+
</code><button type="button">Copy</button></pre>
|
9 |
+
|
10 |
+
<p>Note: CPU and WebGL backends are included by default in <code>@tensorflow/tfjs</code>.</p>
|
11 |
+
<a id="usage-nodejs" class="tsd-anchor"></a><h1 class="tsd-anchor-link">Usage Node.js<a href="#usage-nodejs" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="assets/icons.svg#icon-anchor"></use></svg></a></h1><pre><code class="javascript"><span class="hl-5">import</span><span class="hl-6"> { </span><span class="hl-7">TrustMark</span><span class="hl-6"> } </span><span class="hl-5">from</span><span class="hl-6"> </span><span class="hl-8">'./dist/index.cjs'</span><span class="hl-6">;</span><br/><span class="hl-9">//Instanciate Trustmark</span><br/><span class="hl-10">const</span><span class="hl-6"> </span><span class="hl-11">tm</span><span class="hl-6"> = </span><span class="hl-10">new</span><span class="hl-6"> </span><span class="hl-12">TrustMark</span><span class="hl-6">()</span><br/><br/><span class="hl-9">// Load the models</span><br/><span class="hl-5">await</span><span class="hl-6"> </span><span class="hl-7">tm</span><span class="hl-6">.</span><span class="hl-12">load_models</span><span class="hl-6">()</span><br/><span class="hl-9">// Decode an Image</span><br/><span class="hl-10">let</span><span class="hl-6"> </span><span class="hl-7">decoded</span><span class="hl-6"> = </span><span class="hl-5">await</span><span class="hl-6"> </span><span class="hl-7">tm</span><span class="hl-6">.</span><span class="hl-12">decode</span><span class="hl-6">(</span><span class="hl-8">"tests/fixtures/CLIC_watermarked.jpeg"</span><span class="hl-6">);</span>
|
12 |
+
</code><button type="button">Copy</button></pre>
|
13 |
+
|
14 |
+
<p><a href="https://github.com/tensorflow/tfjs/blob/master/tfjs-node/README.md">tfjs-node-gpu</a> is recommended for Node.js if you need to watermark large image files.</p>
|
15 |
+
<a id="models" class="tsd-anchor"></a><h1 class="tsd-anchor-link">Models<a href="#models" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="assets/icons.svg#icon-anchor"></use></svg></a></h1><p>TrustMark.js is using the Q (quality) and P (perceptual) model variants, trained to encode a payload of 100 bits. Models are fetched and cached on first use into <code>models</code> directory on Node.js, and into the <a href="https://developer.mozilla.org/en-US/docs/Web/API/CacheStorage">CacheStorage</a> in a browser environment.</p>
|
16 |
+
<a id="trustmark-q-quality-default" class="tsd-anchor"></a><h2 class="tsd-anchor-link">TrustMark-Q (Quality) (default)<a href="#trustmark-q-quality-default" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="assets/icons.svg#icon-anchor"></use></svg></a></h2><p>Offers a good balance between robustness and quality</p>
|
17 |
+
<a id="trustmark-p-perceptual" class="tsd-anchor"></a><h2 class="tsd-anchor-link">TrustMark-P (Perceptual)<a href="#trustmark-p-perceptual" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="assets/icons.svg#icon-anchor"></use></svg></a></h2><p>Gives high visual quality with PSNR exceeding 50db but less robustness to more severe noise degradations, yet it will survive most content distribution platforms.</p>
|
18 |
+
<a id="supported-data-schema-modes" class="tsd-anchor"></a><h2 class="tsd-anchor-link">Supported data schema modes<a href="#supported-data-schema-modes" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="assets/icons.svg#icon-anchor"></use></svg></a></h2><ul>
|
19 |
+
<li><code>Encoding.BCH_5</code> - Protected payload of 61 bits (+ 35 ECC bits) - allows for 5 bit flips.</li>
|
20 |
+
<li><code>Encoding.BCH_4</code> - Protected payload of 68 bits (+ 28 ECC bits) - allows for 4 bit flips. (default)</li>
|
21 |
+
<li><code>Encoding.BCH_3</code> - Protected payload of 75 bits (+ 21 ECC bits) - allows for 3 bit flips.</li>
|
22 |
+
<li><code>Encoding.BCH_SUPER</code> - Protected payload of 40 bits (+ 56 ECC bits) - allows for 8 bit flips.</li>
|
23 |
+
</ul>
|
24 |
+
<a id="preprocessing-model" class="tsd-anchor"></a><h2 class="tsd-anchor-link">Preprocessing model<a href="#preprocessing-model" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="assets/icons.svg#icon-anchor"></use></svg></a></h2><p>The models <code>models/preprocess_224.onnx</code> and <code>models/preprocess_256.onnx</code> are used to resize images to the format expected as input for the Trustmark models. It is mandatory to get the same inference results as the original Python implementation.</p>
|
25 |
+
<a id="decode" class="tsd-anchor"></a><h1 class="tsd-anchor-link">Decode<a href="#decode" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="assets/icons.svg#icon-anchor"></use></svg></a></h1><pre><code class="javascript"><span class="hl-9">// Decode the watermark of an image</span><br/><span class="hl-10">let</span><span class="hl-6"> </span><span class="hl-7">decoded</span><span class="hl-6"> = </span><span class="hl-5">await</span><span class="hl-6"> </span><span class="hl-7">tm</span><span class="hl-6">.</span><span class="hl-12">decode</span><span class="hl-6">(</span><span class="hl-8">"tests/fixtures/Django_Reinhardt_(Gottlieb_07301)_watermarked.jpeg"</span><span class="hl-6">);</span><br/><span class="hl-9">/*</span><br/><span class="hl-9">return:</span><br/><span class="hl-9">{</span><br/><span class="hl-9">bitflips, (number) - corrected bits</span><br/><span class="hl-9">valid, (boolean) - validity of the decoded watermark</span><br/><span class="hl-9">binary, (string) - string representation of decoded bits</span><br/><span class="hl-9">hex,(string) - string representation of decoded bits as hexadecimal</span><br/><span class="hl-9">ascii (string) - string representation of decoded bits as 7-bit ASCII</span><br/><span class="hl-9">}</span><br/><span class="hl-9">*/</span>
|
26 |
+
</code><button type="button">Copy</button></pre>
|
27 |
+
|
28 |
+
<a id="encode" class="tsd-anchor"></a><h1 class="tsd-anchor-link">Encode<a href="#encode" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="assets/icons.svg#icon-anchor"></use></svg></a></h1><a id="text-mode" class="tsd-anchor"></a><h2 class="tsd-anchor-link">Text mode<a href="#text-mode" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="assets/icons.svg#icon-anchor"></use></svg></a></h2><p>The payload is encoded as ASCII 7 bits. The 68 bits give you 9 characters.</p>
|
29 |
+
<a id="binary-mode" class="tsd-anchor"></a><h2 class="tsd-anchor-link">Binary mode<a href="#binary-mode" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="assets/icons.svg#icon-anchor"></use></svg></a></h2><p>The 68 bits give you 8 bytes.</p>
|
30 |
+
<pre><code class="javascript"><span class="hl-9">// text mode, 0.4 strenght, no erase</span><br/><span class="hl-5">await</span><span class="hl-6"> </span><span class="hl-7">tm</span><span class="hl-6">.</span><span class="hl-12">encode</span><span class="hl-6">(</span><span class="hl-8">"tests/fixtures/Django_Reinhardt_(Gottlieb_07301).jpeg"</span><span class="hl-6">, </span><span class="hl-8">'Marzipan'</span><span class="hl-6">, </span><span class="hl-13">0.4</span><span class="hl-6">, </span><span class="hl-10">false</span><span class="hl-6">);</span><br/><br/><span class="hl-9">// binary mode 0.4 strenght, no erase</span><br/><span class="hl-5">await</span><span class="hl-6"> </span><span class="hl-7">tm</span><span class="hl-6">.</span><span class="hl-12">encode</span><span class="hl-6">(</span><span class="hl-8">"tests/fixtures/Django_Reinhardt_(Gottlieb_07301).jpeg"</span><span class="hl-6">, </span><span class="hl-8">'11011011110100011110010101000111000100110101010010101110101011011011'</span><span class="hl-6">, </span><span class="hl-13">0.4</span><span class="hl-6">, </span><span class="hl-10">false</span><span class="hl-6">);</span><br/><br/><span class="hl-9">// text mode, 0.4 strenght, no erase as a png encoded file</span><br/><span class="hl-10">let</span><span class="hl-6"> </span><span class="hl-7">encoded</span><span class="hl-6"> = </span><span class="hl-5">await</span><span class="hl-6"> </span><span class="hl-7">tm</span><span class="hl-6">.</span><span class="hl-12">encode</span><span class="hl-6">(</span><span class="hl-8">"tests/fixtures/Django_Reinhardt_(Gottlieb_07301).jpeg"</span><span class="hl-6">, </span><span class="hl-8">'Marzipan'</span><span class="hl-6">, </span><span class="hl-13">0.4</span><span class="hl-6">, </span><span class="hl-10">false</span><span class="hl-6">, </span><span class="hl-8">'png'</span><span class="hl-6">)</span><br/><br/><br/><span class="hl-9">/*</span><br/><span class="hl-9">return:</span><br/><span class="hl-9">{</span><br/><span class="hl-9">stego, (Uint8ClampedArray | PNG data) - the watermaked image data</span><br/><span class="hl-9">residual, (Uint8ClampedArray | PNG data) - the residual image data</span><br/><span class="hl-9">width, (number) - width of the watermaked image</span><br/><span class="hl-9">height,(number) - height of the watermaked image</span><br/><span class="hl-9">}</span><br/><span class="hl-9">*/</span>
|
31 |
+
</code><button type="button">Copy</button></pre>
|
32 |
+
|
33 |
+
<a id="erase" class="tsd-anchor"></a><h1 class="tsd-anchor-link">Erase<a href="#erase" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="assets/icons.svg#icon-anchor"></use></svg></a></h1><p>Overwrite an existing watermark with random values.</p>
|
34 |
+
<pre><code class="javascript"><span class="hl-9">// erase, 0.4 strenght</span><br/><span class="hl-5">await</span><span class="hl-6"> </span><span class="hl-7">tm</span><span class="hl-6">.</span><span class="hl-12">encode</span><span class="hl-6">(</span><span class="hl-8">"tests/fixtures/Django_Reinhardt_(Gottlieb_07301)_watermarked.jpeg"</span><span class="hl-6">, </span><span class="hl-8">''</span><span class="hl-6">, </span><span class="hl-13">0.4</span><span class="hl-6">, </span><span class="hl-10">true</span><span class="hl-6">);</span><br/><br/><span class="hl-9">/*</span><br/><span class="hl-9">return:</span><br/><span class="hl-9">{</span><br/><span class="hl-9">stego, (Uint8ClampedArray | PNG data) - the image data with the watermark erased.</span><br/><span class="hl-9">residual, (Uint8ClampedArray | PNG data) - the residual image data</span><br/><span class="hl-9">width, (number) - width of the image</span><br/><span class="hl-9">height,(number) - height of the image</span><br/><span class="hl-9">}</span><br/><span class="hl-9">*/</span>
|
35 |
+
</code><button type="button">Copy</button></pre>
|
36 |
+
|
37 |
+
</div></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-accordion"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="assets/icons.svg#icon-chevronDown"></use></svg>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div><details open class="tsd-accordion tsd-page-navigation"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="assets/icons.svg#icon-chevronDown"></use></svg>On This Page</h3></summary><div class="tsd-accordion-details"><a href="#trustmarkjs"><span>Trust<wbr/>Mark.js</span></a><a href="#important"><span>Important!</span></a><a href="#usage-browser"><span>Usage <wbr/>Browser</span></a><a href="#usage-nodejs"><span>Usage <wbr/>Node.js</span></a><a href="#models"><span>Models</span></a><ul><li><a href="#trustmark-q-quality-default"><span>Trust<wbr/>Mark-<wbr/>Q (<wbr/>Quality) (default)</span></a></li><li><a href="#trustmark-p-perceptual"><span>Trust<wbr/>Mark-<wbr/>P (<wbr/>Perceptual)</span></a></li><li><a href="#supported-data-schema-modes"><span>Supported data schema modes</span></a></li><li><a href="#preprocessing-model"><span>Preprocessing model</span></a></li></ul><a href="#decode"><span>Decode</span></a><a href="#encode"><span>Encode</span></a><ul><li><a href="#text-mode"><span>Text mode</span></a></li><li><a href="#binary-mode"><span>Binary mode</span></a></li></ul><a href="#erase"><span>Erase</span></a></div></details></div><div class="site-menu"><nav class="tsd-navigation"><a href="modules.html">TrustMark.js</a><ul class="tsd-small-nested-navigation" id="tsd-nav-container"><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>
|
docs/docs/modules.html
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
<!DOCTYPE html><html class="default" lang="en" data-base="."><head><meta charset="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>TrustMark.js</title><link rel="icon" href="assets/favicon.svg" type="image/svg+xml"/><meta name="description" content="Documentation for TrustMark.js"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="assets/style.css"/><link rel="stylesheet" href="assets/highlight.css"/><script defer src="assets/main.js"></script><script async src="assets/icons.js" id="tsd-icons-script"></script><script async src="assets/search.js" id="tsd-search-script"></script><script async src="assets/navigation.js" id="tsd-nav-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><div class="table-cell" id="tsd-search"><div class="field"><label for="tsd-search-field" class="tsd-widget tsd-toolbar-icon search no-caption"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="assets/icons.svg#icon-search"></use></svg></label><input type="text" id="tsd-search-field" aria-label="Search"/></div><div class="field"><div id="tsd-toolbar-links"></div></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="index.html" class="title">TrustMark.js</a></div><div class="table-cell" id="tsd-widgets"><a href="#" class="tsd-widget tsd-toolbar-icon menu no-caption" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="assets/icons.svg#icon-menu"></use></svg></a></div></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb"><li><a href="modules.html">TrustMark.js</a></li></ul><h1>TrustMark.js</h1></div><details class="tsd-panel-group tsd-member-group tsd-accordion" open><summary class="tsd-accordion-summary" data-key="section-Modules"><h2><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="assets/icons.svg#icon-chevronDown"></use></svg> Modules</h2></summary><dl class="tsd-member-summaries"><dt class="tsd-member-summary"><a id="bchecc" class="tsd-anchor"></a><span class="tsd-member-summary-name"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Module"><use href="assets/icons.svg#icon-2"></use></svg><a href="modules/bchecc.html">bchecc</a><a href="#bchecc" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="assets/icons.svg#icon-anchor"></use></svg></a></span></dt><dd class="tsd-member-summary"></dd><dt class="tsd-member-summary"><a id="datalayer" class="tsd-anchor"></a><span class="tsd-member-summary-name"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Module"><use href="assets/icons.svg#icon-2"></use></svg><a href="modules/datalayer.html">datalayer</a><a href="#datalayer" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="assets/icons.svg#icon-anchor"></use></svg></a></span></dt><dd class="tsd-member-summary"></dd><dt class="tsd-member-summary"><a id="trustmark" class="tsd-anchor"></a><span class="tsd-member-summary-name"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Module"><use href="assets/icons.svg#icon-2"></use></svg><a href="modules/trustmark.html">trustmark</a><a href="#trustmark" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="assets/icons.svg#icon-anchor"></use></svg></a></span></dt><dd class="tsd-member-summary"></dd></dl></details></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-accordion"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="assets/icons.svg#icon-chevronDown"></use></svg>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div><details open class="tsd-accordion tsd-page-navigation"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="assets/icons.svg#icon-chevronDown"></use></svg>On This Page</h3></summary><div class="tsd-accordion-details"><details open class="tsd-accordion tsd-page-navigation-section"><summary class="tsd-accordion-summary" data-key="section-Modules"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="assets/icons.svg#icon-chevronDown"></use></svg>Modules</summary><div><a href="#bchecc" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Module"><use href="assets/icons.svg#icon-2"></use></svg><span>bchecc</span></a><a href="#datalayer" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Module"><use href="assets/icons.svg#icon-2"></use></svg><span>datalayer</span></a><a href="#trustmark" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Module"><use href="assets/icons.svg#icon-2"></use></svg><span>trustmark</span></a></div></details></div></details></div><div class="site-menu"><nav class="tsd-navigation"><a href="modules.html" class="current">TrustMark.js</a><ul class="tsd-small-nested-navigation" id="tsd-nav-container"><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>
|
docs/docs/modules/bchecc.html
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
<!DOCTYPE html><html class="default" lang="en" data-base=".."><head><meta charset="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>bchecc | TrustMark.js</title><link rel="icon" href="../assets/favicon.svg" type="image/svg+xml"/><meta name="description" content="Documentation for TrustMark.js"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script defer src="../assets/main.js"></script><script async src="../assets/icons.js" id="tsd-icons-script"></script><script async src="../assets/search.js" id="tsd-search-script"></script><script async src="../assets/navigation.js" id="tsd-nav-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><div class="table-cell" id="tsd-search"><div class="field"><label for="tsd-search-field" class="tsd-widget tsd-toolbar-icon search no-caption"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-search"></use></svg></label><input type="text" id="tsd-search-field" aria-label="Search"/></div><div class="field"><div id="tsd-toolbar-links"></div></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">TrustMark.js</a></div><div class="table-cell" id="tsd-widgets"><a href="#" class="tsd-widget tsd-toolbar-icon menu no-caption" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-menu"></use></svg></a></div></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb"><li><a href="../modules.html">TrustMark.js</a></li><li><a href="bchecc.html">bchecc</a></li></ul><h1>Module bchecc</h1></div><details class="tsd-panel-group tsd-member-group tsd-accordion" open><summary class="tsd-accordion-summary" data-key="section-Classes"><h2><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg> Classes</h2></summary><dl class="tsd-member-summaries"><dt class="tsd-member-summary"><a id="bch" class="tsd-anchor"></a><span class="tsd-member-summary-name"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Class"><use href="../assets/icons.svg#icon-128"></use></svg><a href="../classes/bchecc.BCH.html">BCH</a><a href="#bch" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></span></dt><dd class="tsd-member-summary"></dd></dl></details></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-accordion"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div><details open class="tsd-accordion tsd-page-navigation"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>On This Page</h3></summary><div class="tsd-accordion-details"><details open class="tsd-accordion tsd-page-navigation-section"><summary class="tsd-accordion-summary" data-key="section-Classes"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Classes</summary><div><a href="#bch" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Class"><use href="../assets/icons.svg#icon-128"></use></svg><span>BCH</span></a></div></details></div></details></div><div class="site-menu"><nav class="tsd-navigation"><a href="../modules.html">TrustMark.js</a><ul class="tsd-small-nested-navigation" id="tsd-nav-container"><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>
|
docs/docs/modules/datalayer.html
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
<!DOCTYPE html><html class="default" lang="en" data-base=".."><head><meta charset="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>datalayer | TrustMark.js</title><link rel="icon" href="../assets/favicon.svg" type="image/svg+xml"/><meta name="description" content="Documentation for TrustMark.js"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script defer src="../assets/main.js"></script><script async src="../assets/icons.js" id="tsd-icons-script"></script><script async src="../assets/search.js" id="tsd-search-script"></script><script async src="../assets/navigation.js" id="tsd-nav-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><div class="table-cell" id="tsd-search"><div class="field"><label for="tsd-search-field" class="tsd-widget tsd-toolbar-icon search no-caption"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-search"></use></svg></label><input type="text" id="tsd-search-field" aria-label="Search"/></div><div class="field"><div id="tsd-toolbar-links"></div></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">TrustMark.js</a></div><div class="table-cell" id="tsd-widgets"><a href="#" class="tsd-widget tsd-toolbar-icon menu no-caption" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-menu"></use></svg></a></div></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb"><li><a href="../modules.html">TrustMark.js</a></li><li><a href="datalayer.html">datalayer</a></li></ul><h1>Module datalayer</h1></div><details class="tsd-panel-group tsd-member-group tsd-accordion" open><summary class="tsd-accordion-summary" data-key="section-Classes"><h2><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg> Classes</h2></summary><dl class="tsd-member-summaries"><dt class="tsd-member-summary"><a id="datalayer" class="tsd-anchor"></a><span class="tsd-member-summary-name"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Class"><use href="../assets/icons.svg#icon-128"></use></svg><a href="../classes/datalayer.DataLayer.html">DataLayer</a><a href="#datalayer" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></span></dt><dd class="tsd-member-summary"></dd></dl></details><details class="tsd-panel-group tsd-member-group tsd-accordion" open><summary class="tsd-accordion-summary" data-key="section-Functions"><h2><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg> Functions</h2></summary><dl class="tsd-member-summaries"><dt class="tsd-member-summary"><a id="getschemacapacity" class="tsd-anchor"></a><span class="tsd-member-summary-name"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Function"><use href="../assets/icons.svg#icon-64"></use></svg><a href="../functions/datalayer.getSchemaCapacity.html">getSchemaCapacity</a><a href="#getschemacapacity" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></span></dt><dd class="tsd-member-summary"></dd><dt class="tsd-member-summary"><a id="getschemaversion" class="tsd-anchor"></a><span class="tsd-member-summary-name"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Function"><use href="../assets/icons.svg#icon-64"></use></svg><a href="../functions/datalayer.getSchemaVersion.html">getSchemaVersion</a><a href="#getschemaversion" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></span></dt><dd class="tsd-member-summary"></dd></dl></details></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-accordion"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div><details open class="tsd-accordion tsd-page-navigation"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>On This Page</h3></summary><div class="tsd-accordion-details"><details open class="tsd-accordion tsd-page-navigation-section"><summary class="tsd-accordion-summary" data-key="section-Classes"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Classes</summary><div><a href="#datalayer" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Class"><use href="../assets/icons.svg#icon-128"></use></svg><span>Data<wbr/>Layer</span></a></div></details><details open class="tsd-accordion tsd-page-navigation-section"><summary class="tsd-accordion-summary" data-key="section-Functions"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Functions</summary><div><a href="#getschemacapacity" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Function"><use href="../assets/icons.svg#icon-64"></use></svg><span>get<wbr/>Schema<wbr/>Capacity</span></a><a href="#getschemaversion" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Function"><use href="../assets/icons.svg#icon-64"></use></svg><span>get<wbr/>Schema<wbr/>Version</span></a></div></details></div></details></div><div class="site-menu"><nav class="tsd-navigation"><a href="../modules.html">TrustMark.js</a><ul class="tsd-small-nested-navigation" id="tsd-nav-container"><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>
|
docs/docs/modules/trustmark.html
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
<!DOCTYPE html><html class="default" lang="en" data-base=".."><head><meta charset="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>trustmark | TrustMark.js</title><link rel="icon" href="../assets/favicon.svg" type="image/svg+xml"/><meta name="description" content="Documentation for TrustMark.js"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script defer src="../assets/main.js"></script><script async src="../assets/icons.js" id="tsd-icons-script"></script><script async src="../assets/search.js" id="tsd-search-script"></script><script async src="../assets/navigation.js" id="tsd-nav-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><div class="table-cell" id="tsd-search"><div class="field"><label for="tsd-search-field" class="tsd-widget tsd-toolbar-icon search no-caption"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-search"></use></svg></label><input type="text" id="tsd-search-field" aria-label="Search"/></div><div class="field"><div id="tsd-toolbar-links"></div></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">TrustMark.js</a></div><div class="table-cell" id="tsd-widgets"><a href="#" class="tsd-widget tsd-toolbar-icon menu no-caption" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-menu"></use></svg></a></div></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb"><li><a href="../modules.html">TrustMark.js</a></li><li><a href="trustmark.html">trustmark</a></li></ul><h1>Module trustmark</h1></div><details class="tsd-panel-group tsd-member-group tsd-accordion" open><summary class="tsd-accordion-summary" data-key="section-Classes"><h2><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg> Classes</h2></summary><dl class="tsd-member-summaries"><dt class="tsd-member-summary"><a id="trustmark" class="tsd-anchor"></a><span class="tsd-member-summary-name"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Class"><use href="../assets/icons.svg#icon-128"></use></svg><a href="../classes/trustmark.TrustMark.html">TrustMark</a><a href="#trustmark" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></span></dt><dd class="tsd-member-summary"></dd></dl></details></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-accordion"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div><details open class="tsd-accordion tsd-page-navigation"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>On This Page</h3></summary><div class="tsd-accordion-details"><details open class="tsd-accordion tsd-page-navigation-section"><summary class="tsd-accordion-summary" data-key="section-Classes"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Classes</summary><div><a href="#trustmark" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Class"><use href="../assets/icons.svg#icon-128"></use></svg><span>Trust<wbr/>Mark</span></a></div></details></div></details></div><div class="site-menu"><nav class="tsd-navigation"><a href="../modules.html">TrustMark.js</a><ul class="tsd-small-nested-navigation" id="tsd-nav-container"><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>
|
docs/index.html
CHANGED
@@ -1,35 +1,187 @@
|
|
1 |
-
<!DOCTYPE html
|
2 |
-
<
|
3 |
-
|
4 |
-
<
|
5 |
-
|
6 |
-
|
7 |
-
<
|
8 |
-
|
9 |
-
|
10 |
-
<
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
<
|
16 |
-
<
|
17 |
-
|
18 |
-
<
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
</
|
25 |
-
|
26 |
-
<
|
27 |
-
<
|
28 |
-
<
|
29 |
-
|
30 |
-
|
31 |
-
<
|
32 |
-
<
|
33 |
-
|
34 |
-
|
35 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!DOCTYPE html>
|
2 |
+
<html>
|
3 |
+
|
4 |
+
<head>
|
5 |
+
<title>TrustMark.js encoding & decoding watermarks</title>
|
6 |
+
<link rel="stylesheet" href="style.css">
|
7 |
+
<link rel="icon" href="favicon.svg">
|
8 |
+
<script src="https://cdn.jsdelivr.net/npm/onnxruntime-web@latest/dist/ort.min.js"></script>
|
9 |
+
<script src="https://cdn.jsdelivr.net/npm/@tensorflow/tfjs@latest/dist/tf.min.js"></script>
|
10 |
+
<script type="module" src="./index.js"></script>
|
11 |
+
</head>
|
12 |
+
|
13 |
+
<body>
|
14 |
+
|
15 |
+
<h1>TrustMark images watermarking with TrustMark.js</h1>
|
16 |
+
<div class="container">
|
17 |
+
|
18 |
+
<p>Javascript implementation of TrustMark watermarking, as described in <a href="https://arxiv.org/abs/2311.18297"
|
19 |
+
target="_blank" rel="noopener noreferrer">TrustMark - Universal
|
20 |
+
Watermarking for Arbitrary Resolution Images</a>, for
|
21 |
+
encoding & decoding TrustMark watermarks locally in modern browsers as well as Node.js.</p>
|
22 |
+
|
23 |
+
|
24 |
+
</div>
|
25 |
+
|
26 |
+
<div class="container">
|
27 |
+
<div class="row">
|
28 |
+
<div id="image_container" class="display">
|
29 |
+
<div class="loader" id="processing"></div>
|
30 |
+
<div id="processing"></div>
|
31 |
+
<label for="upload" class="display_label" id="result">🖼️ Input Image</label>
|
32 |
+
<label for="upload" id="tooltip">
|
33 |
+
<svg width="25" height="25" viewBox="0 0 25 25" fill="none" xmlns="http://www.w3.org/2000/svg">
|
34 |
+
<path fill="#000"
|
35 |
+
d="M3.5 24.3a3 3 0 0 1-1.9-.8c-.5-.5-.8-1.2-.8-1.9V2.9c0-.7.3-1.3.8-1.9.6-.5 1.2-.7 2-.7h18.6c.7 0 1.3.2 1.9.7.5.6.7 1.2.7 2v18.6c0 .7-.2 1.4-.7 1.9a3 3 0 0 1-2 .8H3.6Zm0-2.7h18.7V2.9H3.5v18.7Zm2.7-2.7h13.3c.3 0 .5 0 .6-.3v-.7l-3.7-5a.6.6 0 0 0-.6-.2c-.2 0-.4 0-.5.3l-3.5 4.6-2.4-3.3a.6.6 0 0 0-.6-.3c-.2 0-.4.1-.5.3l-2.7 3.6c-.1.2-.2.4 0 .7.1.2.3.3.6.3Z">
|
36 |
+
</path>
|
37 |
+
</svg>
|
38 |
+
Click to upload image
|
39 |
+
<label for="upload">(or try examples below)</label>
|
40 |
+
</label>
|
41 |
+
<div class="download-buttons" id="download">
|
42 |
+
|
43 |
+
<button id="download-jpeg" class="download-button" onclick="download('jpeg');">
|
44 |
+
|
45 |
+
<svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" viewBox="0 0 32 32">
|
46 |
+
<path fill="currentColor"
|
47 |
+
d="M26 24v4H6v-4H4v4a2 2 0 0 0 2 2h20a2 2 0 0 0 2-2v-4zm0-10l-1.41-1.41L17 20.17V2h-2v18.17l-7.59-7.58L6 14l10 10l10-10z">
|
48 |
+
</path>
|
49 |
+
</svg>
|
50 |
+
jpeg
|
51 |
+
</button>
|
52 |
+
|
53 |
+
<button id="download-png" class="download-button" onclick="download('png');">
|
54 |
+
<svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" viewBox="0 0 32 32">
|
55 |
+
<path fill="currentColor"
|
56 |
+
d="M26 24v4H6v-4H4v4a2 2 0 0 0 2 2h20a2 2 0 0 0 2-2v-4zm0-10l-1.41-1.41L17 20.17V2h-2v18.17l-7.59-7.58L6 14l10 10l10-10z">
|
57 |
+
</path>
|
58 |
+
</svg>
|
59 |
+
png
|
60 |
+
</button>
|
61 |
+
|
62 |
+
</div>
|
63 |
+
<img id="display_img"></img>
|
64 |
+
</div>
|
65 |
+
<div class="display">
|
66 |
+
<div>
|
67 |
+
<label class="display_label">✨ Residual (x10)</label>
|
68 |
+
<canvas id="residual_img" width="256" height="256"></canvas>
|
69 |
+
</div>
|
70 |
+
|
71 |
+
</div>
|
72 |
+
</div>
|
73 |
+
|
74 |
+
|
75 |
+
|
76 |
+
</div>
|
77 |
+
|
78 |
+
<div class="container">
|
79 |
+
|
80 |
+
<div class="ux">
|
81 |
+
<pre id="status"></pre>
|
82 |
+
<input id="secret" type="text" class="form-control"
|
83 |
+
placeholder="Watermark content: 9 ASCII characters, or 68 bits binary string (maximum length)"
|
84 |
+
aria-label="Watermark payload">
|
85 |
+
<label for="secret"></label>
|
86 |
+
<div class="settings">
|
87 |
+
<div class="model">
|
88 |
+
<input type="checkbox" id="toggle" class="toggleModel" value="P" />
|
89 |
+
<label for="toggle" class="toggleContainer">
|
90 |
+
<div>Quality model</div>
|
91 |
+
<div>Perceptual model</div>
|
92 |
+
</label>
|
93 |
+
</div>
|
94 |
+
<div class="strength">
|
95 |
+
<label for="set_wm_strength">Strength: <span id="wm_strength"><span></span></label>
|
96 |
+
|
97 |
+
<input type="range" id="set_wm_strength" name="set_wm_strength" value=3 min="0" max="30" step="1">
|
98 |
+
</div>
|
99 |
+
|
100 |
+
|
101 |
+
<button class="btn btn-secondary" type="button" id="encode_button">Inject Watermark</button>
|
102 |
+
<button class="btn btn-secondary" type="button" id="erase_button">Erase Watermark</button>
|
103 |
+
<input id="upload" type="file" accept="image/*" />
|
104 |
+
</div>
|
105 |
+
</div>
|
106 |
+
|
107 |
+
<div class="examples">
|
108 |
+
<div>
|
109 |
+
<h4>
|
110 |
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true"
|
111 |
+
role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32">
|
112 |
+
<path fill="currentColor" d="M10 6h18v2H10zm0 18h18v2H10zm0-9h18v2H10zm-6 0h2v2H4zm0-9h2v2H4zm0 18h2v2H4z">
|
113 |
+
</path>
|
114 |
+
</svg> <a href="/docs/"> Documentation </a>
|
115 |
+
</h4>
|
116 |
+
<h4>
|
117 |
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true"
|
118 |
+
role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32">
|
119 |
+
<path fill="currentColor" d="M10 6h18v2H10zm0 18h18v2H10zm0-9h18v2H10zm-6 0h2v2H4zm0-9h2v2H4zm0 18h2v2H4z">
|
120 |
+
</path>
|
121 |
+
</svg> Examples, without watermark
|
122 |
+
</h4>
|
123 |
+
<div class="gallery">
|
124 |
+
<div class="gallery-item" id="ex1">
|
125 |
+
<img src="tests/fixtures/Django_Reinhardt_(Gottlieb_07301).jpeg"
|
126 |
+
alt="Django Reinhardt at the Aquarium jazz club in New York, NY by William P. Gottlieb (Gottlieb_07301), CC0 Public Domain Dedication"
|
127 |
+
name="Django_Reinhardt_(Gottlieb_07301)" class="img-thumbnail" onclick="decode_ex(this);">
|
128 |
+
</div>
|
129 |
+
<div class="gallery-item" id="ex2">
|
130 |
+
<img src="tests/fixtures/Schongau,_Photon-Stromtankstelle_im_Bahnhof,_1.jpeg"
|
131 |
+
name="Schongau,_Photon-Stromtankstelle_im_Bahnhof,_1"
|
132 |
+
alt="Schongau, eine Photon-Stromtankstelle für Züge am Bahnhof. By Renardo la vulpo, CC0 Public Domain Dedication"
|
133 |
+
class="img-thumbnail" onclick="decode_ex(this);">
|
134 |
+
</div>
|
135 |
+
<div class="gallery-item" id="ex3">
|
136 |
+
<img src="tests/fixtures/Grand_Canyon_South_Rim_at_Sunset.jpeg"
|
137 |
+
alt="Grand Canyon South Rim at Sunset, by Mgimelfarb, CC0 Public Domain Dedication"
|
138 |
+
name="Grand_Canyon_South_Rim_at_Sunset" class="img-thumbnail" onclick="decode_ex(this);">
|
139 |
+
</div>
|
140 |
+
<div class="gallery-item" id="ex3">
|
141 |
+
<img src="tests/fixtures/Quarry_Bay_apartments_(Unsplash).jpeg"
|
142 |
+
alt="Quarry Bay apartments, by Brian Sugden, CC0 Public Domain Dedication"
|
143 |
+
name="Quarry_Bay_apartments_(Unsplash)" class="img-thumbnail" onclick="decode_ex(this);">
|
144 |
+
</div>
|
145 |
+
|
146 |
+
</div>
|
147 |
+
</div>
|
148 |
+
</div>
|
149 |
+
<div class="examples">
|
150 |
+
<div>
|
151 |
+
<h4>
|
152 |
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true"
|
153 |
+
role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32">
|
154 |
+
<path fill="currentColor" d="M10 6h18v2H10zm0 18h18v2H10zm0-9h18v2H10zm-6 0h2v2H4zm0-9h2v2H4zm0 18h2v2H4z">
|
155 |
+
</path>
|
156 |
+
</svg> Examples, with watermark
|
157 |
+
</h4>
|
158 |
+
<div class="gallery">
|
159 |
+
<div class="gallery-item" id="ex1">
|
160 |
+
<img src="tests/fixtures/Django_Reinhardt_(Gottlieb_07301)_watermarked.jpeg"
|
161 |
+
alt="Django Reinhardt at the Aquarium jazz club in New York, NY by William P. Gottlieb (Gottlieb_07301), CC0 Public Domain Dedication"
|
162 |
+
name="Django_Reinhardt_(Gottlieb_07301)" class="img-thumbnail" onclick="decode_ex(this);">
|
163 |
+
</div>
|
164 |
+
<div class="gallery-item" id="ex2">
|
165 |
+
<img src="tests/fixtures/Schongau,_Photon-Stromtankstelle_im_Bahnhof,_1_watermarked.jpeg"
|
166 |
+
name="Schongau,_Photon-Stromtankstelle_im_Bahnhof,_1"
|
167 |
+
alt="Schongau, eine Photon-Stromtankstelle für Züge am Bahnhof. By Renardo la vulpo, CC0 Public Domain Dedication"
|
168 |
+
class="img-thumbnail" onclick="decode_ex(this);">
|
169 |
+
</div>
|
170 |
+
<div class="gallery-item" id="ex3">
|
171 |
+
<img src="tests/fixtures/Grand_Canyon_South_Rim_at_Sunset_watermarked.jpeg"
|
172 |
+
alt="Grand Canyon South Rim at Sunset, by Mgimelfarb, CC0 Public Domain Dedication"
|
173 |
+
name="Grand_Canyon_South_Rim_at_Sunset" class="img-thumbnail" onclick="decode_ex(this);">
|
174 |
+
</div>
|
175 |
+
<div class="gallery-item" id="ex3">
|
176 |
+
<img src="tests/fixtures/Quarry_Bay_apartments_(Unsplash)_watermarked.jpeg"
|
177 |
+
alt="Quarry Bay apartments, by Brian Sugden, CC0 Public Domain Dedication"
|
178 |
+
name="Quarry_Bay_apartments_(Unsplash)" class="img-thumbnail" onclick="decode_ex(this);">
|
179 |
+
</div>
|
180 |
+
|
181 |
+
</div>
|
182 |
+
</div>
|
183 |
+
</div>
|
184 |
+
</div>
|
185 |
+
</body>
|
186 |
+
|
187 |
+
</html>
|
docs/index.js
ADDED
@@ -0,0 +1,277 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import { TrustMark } from './dist/index.js'
|
2 |
+
|
3 |
+
// ======================================================================
|
4 |
+
// Global variables
|
5 |
+
// ======================================================================
|
6 |
+
|
7 |
+
|
8 |
+
let MODE = 'Q' // TrustMark Available modes: C=compact, Q=quality, B=base
|
9 |
+
let ENCODING_TYPE = TrustMark.encoding.BCH_4
|
10 |
+
let WM_STRENGTH = 0.4;
|
11 |
+
let JPEG_QUALITY = 0.9;
|
12 |
+
|
13 |
+
// ======================================================================
|
14 |
+
// DOM Elements
|
15 |
+
// ======================================================================
|
16 |
+
let status_element = document.getElementById("status");
|
17 |
+
let result_element = document.getElementById("result");
|
18 |
+
let secret_element = document.getElementById('secret');
|
19 |
+
let image_container = document.getElementById("image_container");
|
20 |
+
let display_img = document.getElementById("display_img");
|
21 |
+
let residual_img = document.getElementById("residual_img");
|
22 |
+
let set_wm_strength_slider = document.getElementById("set_wm_strength");
|
23 |
+
let wm_strength = document.getElementById('wm_strength')
|
24 |
+
let encode_button = document.getElementById("encode_button");
|
25 |
+
let erase_button = document.getElementById("erase_button");
|
26 |
+
let model_type_toggle = document.getElementById("toggle");
|
27 |
+
let fileUpload = document.getElementById("upload");
|
28 |
+
let fileDownload = document.getElementById("download");
|
29 |
+
let tooltip = document.getElementById("tooltip");
|
30 |
+
let processing_element = document.getElementById('processing');
|
31 |
+
|
32 |
+
window.addEventListener('status', (event) => {
|
33 |
+
console.log(event.detail);
|
34 |
+
status_element.textContent = event.detail
|
35 |
+
});
|
36 |
+
|
37 |
+
wm_strength.textContent = WM_STRENGTH
|
38 |
+
|
39 |
+
|
40 |
+
let current_image;
|
41 |
+
let tm = new TrustMark({ verbose: false, model_type: MODE, encoding_type: ENCODING_TYPE })
|
42 |
+
showSpinner()
|
43 |
+
status_element.textContent = 'Loading models...'
|
44 |
+
await tm.loadModels()
|
45 |
+
status_element.textContent = 'Trustmark initialized.'
|
46 |
+
hideSpinner()
|
47 |
+
|
48 |
+
// ======================================================================
|
49 |
+
// UI functions
|
50 |
+
// ======================================================================
|
51 |
+
|
52 |
+
model_type_toggle.addEventListener("click", async b => {
|
53 |
+
if(model_type_toggle.checked===true){await tm.loadModels('P')};
|
54 |
+
if(model_type_toggle.checked===false){await tm.loadModels('Q')};
|
55 |
+
});
|
56 |
+
encode_button.addEventListener("click", async b => {
|
57 |
+
encode().catch(e => { console.error(e) });
|
58 |
+
});
|
59 |
+
|
60 |
+
erase_button.addEventListener("click", async b => {
|
61 |
+
erase().catch(e => { console.error(e) });
|
62 |
+
});
|
63 |
+
|
64 |
+
set_wm_strength_slider.addEventListener("input", b => {
|
65 |
+
WM_STRENGTH = parseInt(set_wm_strength_slider.value) / 10;
|
66 |
+
wm_strength.textContent = WM_STRENGTH
|
67 |
+
});
|
68 |
+
|
69 |
+
image_container.addEventListener("dragover", (event) => {
|
70 |
+
event.preventDefault();
|
71 |
+
image_container.style.backgroundColor = "#e5e7eb";
|
72 |
+
});
|
73 |
+
|
74 |
+
image_container.addEventListener("drop", async (event) => {
|
75 |
+
event.preventDefault()
|
76 |
+
image_container.style.backgroundColor = "unset";
|
77 |
+
tooltip.style.display = "none";
|
78 |
+
if (event.dataTransfer.files.length) {
|
79 |
+
let file = event.dataTransfer.files[0];
|
80 |
+
if (!file) return;
|
81 |
+
display_img.src = URL.createObjectURL(file);
|
82 |
+
current_image = {
|
83 |
+
url: display_img.src,
|
84 |
+
name: parseFilename(file.name).name,
|
85 |
+
extension: parseFilename(file.name).ext,
|
86 |
+
}
|
87 |
+
decode()
|
88 |
+
}
|
89 |
+
})
|
90 |
+
|
91 |
+
fileUpload.addEventListener("change", function (b) {
|
92 |
+
image_container.style.backgroundColor = "unset";
|
93 |
+
fileDownload.style.display = 'none';
|
94 |
+
tooltip.style.display = "none";
|
95 |
+
let file = b.target.files[0];
|
96 |
+
if (!file) return;
|
97 |
+
|
98 |
+
display_img.src = URL.createObjectURL(file);
|
99 |
+
current_image = {
|
100 |
+
url: display_img.src,
|
101 |
+
name: parseFilename(file.name).name,
|
102 |
+
extension: parseFilename(file.name).ext,
|
103 |
+
}
|
104 |
+
decode().catch(e => { console.error(e) });
|
105 |
+
});
|
106 |
+
|
107 |
+
window.decode_ex = (image) => {
|
108 |
+
display_img.src = image.src
|
109 |
+
current_image = {
|
110 |
+
url: image.src,
|
111 |
+
name: image.name,
|
112 |
+
extension: parseFilename(image.src).ext,
|
113 |
+
}
|
114 |
+
decode()
|
115 |
+
}
|
116 |
+
|
117 |
+
window.download = async (format) => {
|
118 |
+
let options;
|
119 |
+
if (format == "png") { options = { type: "image/png" } }
|
120 |
+
if (format == "jpeg") { options = { type: "image/jpeg", quality: JPEG_QUALITY } }
|
121 |
+
|
122 |
+
let download_link = document.createElement("a");
|
123 |
+
download_link.style.display = "none";
|
124 |
+
download_link.href = URL.createObjectURL(await current_image.canvas.convertToBlob(options))
|
125 |
+
download_link.download = current_image.name + current_image.filename_append + '.' + format;
|
126 |
+
status_element.appendChild(download_link);
|
127 |
+
download_link.click()
|
128 |
+
}
|
129 |
+
|
130 |
+
|
131 |
+
async function decode() {
|
132 |
+
|
133 |
+
// Clear UI
|
134 |
+
let ctx = residual_img.getContext("2d");
|
135 |
+
ctx.clearRect(0, 0, residual_img.width, residual_img.height);
|
136 |
+
fileDownload.style.display = 'none';
|
137 |
+
tooltip.style.display = "none";
|
138 |
+
|
139 |
+
status_element.textContent = 'Analysing for watermark...';
|
140 |
+
showSpinner()
|
141 |
+
let result = await tm.decode(current_image.url);
|
142 |
+
hideSpinner()
|
143 |
+
if (result.valid) {
|
144 |
+
result_element.textContent = '💦 Watermarked Image';
|
145 |
+
status_element.textContent = result.binary + '\nSCHEMA:' + result.schema
|
146 |
+
+ ' BITFLIPS:' + result.bitflips + ' HEX: ' + result.hex + ' ASCII: ' + result.ascii;
|
147 |
+
} else {
|
148 |
+
|
149 |
+
result_element.textContent = '🖼️ Input Image'
|
150 |
+
status_element.textContent = "No Watermark found"
|
151 |
+
}
|
152 |
+
}
|
153 |
+
|
154 |
+
async function encode() {
|
155 |
+
|
156 |
+
// Clear Residual
|
157 |
+
let ctx = residual_img.getContext("2d");
|
158 |
+
ctx.clearRect(0, 0, residual_img.width, residual_img.height);
|
159 |
+
|
160 |
+
let string_secret = secret_element.value;
|
161 |
+
if (!current_image) {
|
162 |
+
return;
|
163 |
+
}
|
164 |
+
current_image.url_backup = display_img.src;
|
165 |
+
|
166 |
+
// Random secret if empty
|
167 |
+
if (!string_secret) {
|
168 |
+
string_secret = toBinString(Array.from({ length: 68 }, () => Math.round(Math.random())));
|
169 |
+
secret_element.value = string_secret;
|
170 |
+
}
|
171 |
+
|
172 |
+
status_element.textContent = 'Injecting the watermark...';
|
173 |
+
showSpinner();
|
174 |
+
let result = await tm.encode(current_image.url, string_secret, WM_STRENGTH);
|
175 |
+
hideSpinner();
|
176 |
+
|
177 |
+
// Display Residual
|
178 |
+
let residual_data = new ImageData(result.residual, 256, 256);
|
179 |
+
ctx.putImageData(residual_data, 0, 0);
|
180 |
+
|
181 |
+
|
182 |
+
current_image.canvas = new OffscreenCanvas(result.width, result.height);
|
183 |
+
current_image.canvas_ctx = current_image.canvas.getContext("2d");
|
184 |
+
let display_data = new ImageData(result.stego, result.width, result.height);
|
185 |
+
current_image.canvas_ctx.putImageData(display_data, 0, 0);
|
186 |
+
display_img.src = current_image.url = URL.createObjectURL(await current_image.canvas.convertToBlob());
|
187 |
+
status_element.textContent = 'Verifying the watermark...';
|
188 |
+
|
189 |
+
showSpinner()
|
190 |
+
result = await tm.decode(current_image.url);
|
191 |
+
hideSpinner();
|
192 |
+
|
193 |
+
|
194 |
+
if (result.valid) {
|
195 |
+
if (string_secret == result.ascii || string_secret == result.binary) {
|
196 |
+
result_element.textContent = '💦 Watermarked Image';
|
197 |
+
status_element.textContent = result.binary + '\nSCHEMA:' + result.schema
|
198 |
+
+ ' BITFLIPS:' + result.bitflips + ' HEX: ' + result.hex + ' ASCII: ' + result.ascii;
|
199 |
+
current_image.filename_append = "_watermarked";
|
200 |
+
fileDownload.style.display = 'flex';
|
201 |
+
} else {
|
202 |
+
display_img.src = current_image.url = current_image.url_backup;
|
203 |
+
result_element.textContent = '🖼️ Input Image';
|
204 |
+
status_element.textContent = "Watermark secret mismatch, try to change the strength level";
|
205 |
+
}
|
206 |
+
} else {
|
207 |
+
display_img.src = current_image.url = current_image.url_backup;
|
208 |
+
result_element.textContent = '🖼️ Input Image';
|
209 |
+
status_element.textContent = "No Watermark found, try to change the strength level";
|
210 |
+
}
|
211 |
+
}
|
212 |
+
|
213 |
+
async function erase() {
|
214 |
+
let ctx = residual_img.getContext("2d");
|
215 |
+
ctx.clearRect(0, 0, residual_img.width, residual_img.height);
|
216 |
+
|
217 |
+
current_image.url_backup = display_img.src;
|
218 |
+
|
219 |
+
status_element.textContent = 'Erasing the watermark...'
|
220 |
+
showSpinner()
|
221 |
+
let result = await tm.encode(current_image.url, '', WM_STRENGTH, true);
|
222 |
+
hideSpinner()
|
223 |
+
|
224 |
+
// Display the residual
|
225 |
+
let residual_data = new ImageData(result.residual, 256, 256)
|
226 |
+
ctx.putImageData(residual_data, 0, 0);
|
227 |
+
|
228 |
+
// Display erased watermark image
|
229 |
+
current_image.canvas = new OffscreenCanvas(result.width, result.height)
|
230 |
+
current_image.canvas_ctx = current_image.canvas.getContext("2d");
|
231 |
+
let display_data = new ImageData(result.stego, result.width, result.height)
|
232 |
+
current_image.canvas_ctx.putImageData(display_data, 0, 0);
|
233 |
+
display_img.src = current_image.url = URL.createObjectURL(await current_image.canvas.convertToBlob())
|
234 |
+
|
235 |
+
status_element.textContent = 'Verifying...'
|
236 |
+
showSpinner()
|
237 |
+
result = await tm.decode(current_image.url)
|
238 |
+
hideSpinner()
|
239 |
+
if (result.valid) {
|
240 |
+
display_img.src = current_image.url = current_image.url_backup;
|
241 |
+
result_element.textContent = '💦 Watermarked Image';
|
242 |
+
status_element.textContent = "Watermark not erased, try to change the strength level";
|
243 |
+
} else {
|
244 |
+
result_element.textContent = '🖼️ Input Image';
|
245 |
+
status_element.textContent = "Watermark erased.";
|
246 |
+
current_image.filename_append = "_watermark_erased";
|
247 |
+
fileDownload.style.display = 'flex';
|
248 |
+
}
|
249 |
+
|
250 |
+
}
|
251 |
+
|
252 |
+
// ======================================================================
|
253 |
+
// Utils
|
254 |
+
// ======================================================================
|
255 |
+
|
256 |
+
function showSpinner() {
|
257 |
+
processing_element.style.display = 'block';
|
258 |
+
}
|
259 |
+
|
260 |
+
function hideSpinner() {
|
261 |
+
processing_element.style.display = 'none';
|
262 |
+
}
|
263 |
+
|
264 |
+
function parseFilename(filename) {
|
265 |
+
let ext = filename.split('.').pop();
|
266 |
+
return ({ name: filename.replace("." + ext, ''), ext: ext })
|
267 |
+
}
|
268 |
+
|
269 |
+
|
270 |
+
function toBinString(bin_array) {
|
271 |
+
|
272 |
+
let out = ""
|
273 |
+
for (let i = 0; i < bin_array.length; i++) {
|
274 |
+
out += bin_array[i];
|
275 |
+
}
|
276 |
+
return out;
|
277 |
+
}
|
docs/style.css
ADDED
@@ -0,0 +1,360 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
* {
|
2 |
+
box-sizing: border-box;
|
3 |
+
padding: 0;
|
4 |
+
margin: 0;
|
5 |
+
font-family: sans-serif;
|
6 |
+
}
|
7 |
+
|
8 |
+
html,
|
9 |
+
body {
|
10 |
+
height: 100%;
|
11 |
+
}
|
12 |
+
|
13 |
+
body {
|
14 |
+
padding: 32px;
|
15 |
+
|
16 |
+
}
|
17 |
+
|
18 |
+
h1 {
|
19 |
+
text-align: center;
|
20 |
+
}
|
21 |
+
|
22 |
+
h4 {
|
23 |
+
text-align: left;
|
24 |
+
margin-top: .5rem
|
25 |
+
}
|
26 |
+
|
27 |
+
pre {
|
28 |
+
font-family: monospace;
|
29 |
+
}
|
30 |
+
|
31 |
+
.container {
|
32 |
+
|
33 |
+
width: 720px;
|
34 |
+
max-width: 100%;
|
35 |
+
margin: 0 auto;
|
36 |
+
}
|
37 |
+
|
38 |
+
.container p {
|
39 |
+
|
40 |
+
text-align: center;
|
41 |
+
}
|
42 |
+
|
43 |
+
#image_container {
|
44 |
+
border: 2px dashed #D1D5DB;
|
45 |
+
}
|
46 |
+
|
47 |
+
.row {
|
48 |
+
width: 720px;
|
49 |
+
max-width: 100%;
|
50 |
+
margin-top: 1.0rem;
|
51 |
+
min-height: 360px;
|
52 |
+
display: flex;
|
53 |
+
flex-direction: row;
|
54 |
+
flex-wrap: wrap;
|
55 |
+
|
56 |
+
}
|
57 |
+
|
58 |
+
|
59 |
+
.display {
|
60 |
+
position: relative;
|
61 |
+
width: 360px;
|
62 |
+
height: 360px;
|
63 |
+
max-width: 100%;
|
64 |
+
max-height: 100%;
|
65 |
+
border: 1px solid #D1D5DB;
|
66 |
+
border-radius: .75rem;
|
67 |
+
overflow: hidden;
|
68 |
+
margin: 0 auto;
|
69 |
+
object-fit: cover;
|
70 |
+
float: left;
|
71 |
+
display: flex;
|
72 |
+
flex-direction: column;
|
73 |
+
justify-content: center;
|
74 |
+
align-items: center;
|
75 |
+
}
|
76 |
+
|
77 |
+
.display_label {
|
78 |
+
border: 1px solid #D1D5DB;
|
79 |
+
background-color: rgb(255, 255, 255);
|
80 |
+
color: rgb(55, 65, 81);
|
81 |
+
padding: 4px;
|
82 |
+
line-height: 16px;
|
83 |
+
position: absolute;
|
84 |
+
top: 0;
|
85 |
+
left: 0;
|
86 |
+
}
|
87 |
+
|
88 |
+
|
89 |
+
.download-buttons {
|
90 |
+
display: none;
|
91 |
+
position: absolute;
|
92 |
+
bottom: 0;
|
93 |
+
height: 32px;
|
94 |
+
transition: display 20s;
|
95 |
+
}
|
96 |
+
|
97 |
+
.download-button {
|
98 |
+
background-image: linear-gradient(to right bottom, rgb(243, 244, 246), rgb(229, 231, 235));
|
99 |
+
border-radius: 8px;
|
100 |
+
border: 1px solid #D1D5DB;
|
101 |
+
color: rgb(55, 65, 81);
|
102 |
+
display: inline-flex;
|
103 |
+
line-height: 32px;
|
104 |
+
margin: 2px;
|
105 |
+
padding: 2px;
|
106 |
+
align-items: center;
|
107 |
+
}
|
108 |
+
|
109 |
+
.download-buttons label:hover {
|
110 |
+
background-image: linear-gradient(to right bottom, rgb(229, 231, 235), rgb(243, 244, 246));
|
111 |
+
color: black;
|
112 |
+
}
|
113 |
+
|
114 |
+
|
115 |
+
#display_img {
|
116 |
+
max-width: 100%;
|
117 |
+
max-height: 100%;
|
118 |
+
object-fit: cover;
|
119 |
+
overflow: hidden;
|
120 |
+
}
|
121 |
+
|
122 |
+
#residual_img {
|
123 |
+
width: 360px;
|
124 |
+
max-height: 100%;
|
125 |
+
}
|
126 |
+
|
127 |
+
|
128 |
+
input {
|
129 |
+
font-size: 16px;
|
130 |
+
border-radius: 8px;
|
131 |
+
border-color: #D1D5DB;
|
132 |
+
color: rgb(55, 65, 81);
|
133 |
+
line-height: 24px;
|
134 |
+
border: 1px solid #D1D5DB;
|
135 |
+
box-shadow: rgba(0, 0, 0, 0) 0px 0px 0px 3px, rgba(0, 0, 0, 0.05) 0px 2px 4px 0px inset;
|
136 |
+
margin: 0px;
|
137 |
+
}
|
138 |
+
|
139 |
+
input[type="text"] {
|
140 |
+
width: 100%;
|
141 |
+
margin-bottom: 4px;
|
142 |
+
padding: 4px;
|
143 |
+
font-size: 16px;
|
144 |
+
border-radius: 8px;
|
145 |
+
color: rgb(55, 65, 81);
|
146 |
+
line-height: 24px;
|
147 |
+
}
|
148 |
+
|
149 |
+
input[type="range"] {
|
150 |
+
appearance: none;
|
151 |
+
width: 70%;
|
152 |
+
height: 10px;
|
153 |
+
accent-color: rgb(55, 65, 81);
|
154 |
+
background: #D1D5DB;
|
155 |
+
border-radius: 5px;
|
156 |
+
background-image: linear-gradient(to right bottom, rgb(243, 244, 246), rgb(229, 231, 235))
|
157 |
+
}
|
158 |
+
|
159 |
+
input[type="range"]:hover {
|
160 |
+
accent-color: black;
|
161 |
+
background-image: linear-gradient(to right bottom, rgb(229, 231, 235), rgb(243, 244, 246))
|
162 |
+
}
|
163 |
+
|
164 |
+
input[type="number"] {
|
165 |
+
border: 0px;
|
166 |
+
margin-left: 4px;
|
167 |
+
width: 20%;
|
168 |
+
}
|
169 |
+
|
170 |
+
.strength {
|
171 |
+
display: flex;
|
172 |
+
align-items: center;
|
173 |
+
width: 50%;
|
174 |
+
}
|
175 |
+
|
176 |
+
.strength label {
|
177 |
+
width: 30%;
|
178 |
+
font-weight: bold;
|
179 |
+
text-align: center;
|
180 |
+
}
|
181 |
+
|
182 |
+
.settings {
|
183 |
+
border: 1px solid #D1D5DB;
|
184 |
+
padding: 4px;
|
185 |
+
border-radius: 8px;
|
186 |
+
max-width: 100%;
|
187 |
+
display: flex;
|
188 |
+
justify-content: flex-start;
|
189 |
+
align-items: center;
|
190 |
+
flex-direction: row;
|
191 |
+
flex-wrap: nowrap;
|
192 |
+
}
|
193 |
+
|
194 |
+
.settings button {
|
195 |
+
width: 25%;
|
196 |
+
max-width: 100%;
|
197 |
+
border-radius: 8px;
|
198 |
+
border: 1px solid #D1D5DB;
|
199 |
+
font-size: 16px;
|
200 |
+
font-weight: 600;
|
201 |
+
color: rgb(55, 65, 81);
|
202 |
+
display: inline-block;
|
203 |
+
text-align: center;
|
204 |
+
text-decoration: none;
|
205 |
+
vertical-align: middle;
|
206 |
+
line-height: 24px;
|
207 |
+
padding: 6px;
|
208 |
+
margin: 0px 0px 0px 5px;
|
209 |
+
background-image: linear-gradient(to right bottom, rgb(243, 244, 246), rgb(229, 231, 235))
|
210 |
+
}
|
211 |
+
|
212 |
+
button:hover {
|
213 |
+
color: black;
|
214 |
+
background-image: linear-gradient(to right bottom, rgb(229, 231, 235), rgb(243, 244, 246))
|
215 |
+
}
|
216 |
+
|
217 |
+
|
218 |
+
#tooltip {
|
219 |
+
display: flex;
|
220 |
+
flex-direction: column;
|
221 |
+
justify-content: center;
|
222 |
+
align-items: center;
|
223 |
+
}
|
224 |
+
|
225 |
+
|
226 |
+
.gallery-item {
|
227 |
+
width: 33%;
|
228 |
+
padding: 2px;
|
229 |
+
border: 1px solid #D1D5DB;
|
230 |
+
text-align: center;
|
231 |
+
}
|
232 |
+
|
233 |
+
.img-thumbnail {
|
234 |
+
max-width: 100%;
|
235 |
+
max-height: 180px;
|
236 |
+
object-fit: cover;
|
237 |
+
overflow: hidden;
|
238 |
+
}
|
239 |
+
|
240 |
+
|
241 |
+
.gallery {
|
242 |
+
display: flex;
|
243 |
+
flex-direction: row;
|
244 |
+
align-items: center;
|
245 |
+
}
|
246 |
+
|
247 |
+
|
248 |
+
#dragover {
|
249 |
+
border: 2px solid #D1D5DB;
|
250 |
+
}
|
251 |
+
|
252 |
+
#upload-button {
|
253 |
+
gap: .4rem;
|
254 |
+
font-size: 18px;
|
255 |
+
cursor: pointer
|
256 |
+
}
|
257 |
+
|
258 |
+
#upload {
|
259 |
+
display: none
|
260 |
+
}
|
261 |
+
|
262 |
+
svg {
|
263 |
+
pointer-events: none
|
264 |
+
}
|
265 |
+
|
266 |
+
#status {
|
267 |
+
font-size: 16px;
|
268 |
+
text-align: center;
|
269 |
+
min-height: 16px;
|
270 |
+
margin: 8px 0;
|
271 |
+
height: 32px;
|
272 |
+
}
|
273 |
+
|
274 |
+
.loader {
|
275 |
+
border: 8px solid #D1D5DB;
|
276 |
+
border-top: 8px solid transparent;
|
277 |
+
border-radius: 50%;
|
278 |
+
width: 4em;
|
279 |
+
height: 4em;
|
280 |
+
animation: spin 2s linear infinite;
|
281 |
+
position: absolute;
|
282 |
+
z-index: 999;
|
283 |
+
overflow: show;
|
284 |
+
margin: auto;
|
285 |
+
display: none;
|
286 |
+
}
|
287 |
+
|
288 |
+
@keyframes spin {
|
289 |
+
0% {
|
290 |
+
transform: rotate(0deg);
|
291 |
+
}
|
292 |
+
|
293 |
+
100% {
|
294 |
+
transform: rotate(360deg);
|
295 |
+
}
|
296 |
+
}
|
297 |
+
|
298 |
+
.toggleContainer {
|
299 |
+
position: relative;
|
300 |
+
display: grid;
|
301 |
+
grid-template-columns: repeat(2, 1fr);
|
302 |
+
width: fit-content;
|
303 |
+
border: 1px solid #D1D5DB;
|
304 |
+
border-radius: 16px;
|
305 |
+
background: rgb(55, 65, 81);
|
306 |
+
font-weight: bold;
|
307 |
+
color: rgb(55, 65, 81);
|
308 |
+
cursor: pointer;
|
309 |
+
margin-right: 10px;
|
310 |
+
}
|
311 |
+
|
312 |
+
.toggleContainer::before {
|
313 |
+
content: '';
|
314 |
+
position: absolute;
|
315 |
+
width: 50%;
|
316 |
+
height: 100%;
|
317 |
+
left: 0%;
|
318 |
+
border-radius: 16px;
|
319 |
+
background: rgb(55, 65, 81);
|
320 |
+
background-image: linear-gradient(to right bottom, rgb(243, 244, 246), rgb(229, 231, 235));
|
321 |
+
transition: all 0.3s;
|
322 |
+
}
|
323 |
+
|
324 |
+
.toggleModel:checked+.toggleContainer::before {
|
325 |
+
left: 50%;
|
326 |
+
}
|
327 |
+
|
328 |
+
.toggleContainer div {
|
329 |
+
padding: 4px;
|
330 |
+
text-align: center;
|
331 |
+
z-index: 1;
|
332 |
+
}
|
333 |
+
|
334 |
+
.toggleModel {
|
335 |
+
display: none;
|
336 |
+
}
|
337 |
+
|
338 |
+
.toggleModel:checked+.toggleContainer div:first-child {
|
339 |
+
|
340 |
+
color: #D1D5DB;
|
341 |
+
transition: color 0.3s;
|
342 |
+
}
|
343 |
+
|
344 |
+
.toggleModel:checked+.toggleContainer div:last-child {
|
345 |
+
|
346 |
+
color: #343434;
|
347 |
+
transition: color 0.3s;
|
348 |
+
}
|
349 |
+
|
350 |
+
.toggleModel+.toggleContainer div:first-child {
|
351 |
+
|
352 |
+
color: #343434;
|
353 |
+
transition: color 0.3s;
|
354 |
+
|
355 |
+
}
|
356 |
+
|
357 |
+
.toggleModel+.toggleContainer div:last-child {
|
358 |
+
color: #D1D5DB;
|
359 |
+
transition: color 0.3s;
|
360 |
+
}
|