@innovatrics/dot-document-auto-capture
Version:
Digital onboarding document capture
1,309 lines (1,308 loc) • 343 kB
JavaScript
var Mo = Object.defineProperty;
var nr = (p) => {
throw TypeError(p);
};
var Ro = (p, c, n) => c in p ? Mo(p, c, { enumerable: !0, configurable: !0, writable: !0, value: n }) : p[c] = n;
var ze = (p, c, n) => Ro(p, typeof c != "symbol" ? c + "" : c, n), or = (p, c, n) => c.has(p) || nr("Cannot " + n);
var ee = (p, c, n) => (or(p, c, "read from private field"), n ? n.call(p) : c.get(p)), Ve = (p, c, n) => c.has(p) ? nr("Cannot add the same private member more than once") : c instanceof WeakSet ? c.add(p) : c.set(p, n), Ue = (p, c, n, t) => (or(p, c, "write to private field"), t ? t.call(p, n) : c.set(p, n), n);
const ir = {
simd: "sam_simd.wasm",
sam: "sam.wasm"
}, xo = async () => WebAssembly.validate(new Uint8Array([0, 97, 115, 109, 1, 0, 0, 0, 1, 5, 1, 96, 0, 1, 123, 3, 2, 1, 0, 10, 10, 1, 8, 0, 65, 0, 253, 15, 253, 98, 11]));
class $ extends Error {
constructor(n, t) {
super(n);
ze(this, "cause");
this.name = "AutoCaptureError", this.cause = t;
}
// Change this to Decorator when they will be in stable release
static logError(n) {
}
static fromCameraError(n) {
if (this.logError(n), n instanceof $)
return n;
let t;
switch (n.name) {
case "OverconstrainedError":
t = "Minimum quality requirements are not met by your camera";
break;
case "NotReadableError":
case "AbortError":
t = "The webcam is already in use by another application";
break;
case "NotAllowedError":
t = "To use your camera, you must allow permissions";
break;
case "NotFoundError":
t = "There is no camera available to you";
break;
default:
t = "An unknown camera error has occurred";
break;
}
return new $(t, n);
}
static fromError(n) {
if (this.logError(n), n instanceof $)
return n;
const t = "An unexpected error has occurred";
return new $(t);
}
}
const No = {
RGBA: "RGBA"
};
var le, fe, Oe;
class Wo {
constructor(c, n) {
Ve(this, le);
Ve(this, fe);
Ve(this, Oe);
Ue(this, le, c), Ue(this, fe, this.allocate(n.length * n.BYTES_PER_ELEMENT)), Ue(this, Oe, this.allocate(n.length * n.BYTES_PER_ELEMENT));
}
get rgbaImagePointer() {
return ee(this, fe);
}
get bgr0ImagePointer() {
return ee(this, Oe);
}
allocate(c) {
return ee(this, le)._malloc(c);
}
free() {
ee(this, le)._free(ee(this, fe)), ee(this, le)._free(ee(this, Oe));
}
writeDataToMemory(c) {
ee(this, le).HEAPU8.set(c, ee(this, fe));
}
}
le = new WeakMap(), fe = new WeakMap(), Oe = new WeakMap();
class zo {
constructor() {
ze(this, "samWasmModule");
}
getOverriddenModules(c, n) {
return {
locateFile: (t) => new URL(n || t, c).href
};
}
async handleMissingOrInvalidSamModule(c, n) {
try {
const t = await fetch(c);
if (!t.ok)
throw new $(
`The path to ${n} is incorrect or the module is missing. Please check provided path to wasm files. Current path is ${c}`
);
const e = await t.arrayBuffer();
if (!WebAssembly.validate(e))
throw new $(
`The provided ${n} is not a valid WASM module. Please check provided path to wasm files. Current path is ${c}`
);
} catch (t) {
if (t instanceof $)
throw console.error(
"You can find more information about how to host wasm files here: https://developers.innovatrics.com/digital-onboarding/technical/remote/dot-web-document/latest/documentation/#_hosting_sam_wasm"
), t;
}
}
async getSamWasmFileName() {
return await xo() ? ir.simd : ir.sam;
}
async initSamModule(c, n) {
if (this.samWasmModule)
return;
const t = await this.getSamWasmFileName(), e = this.getSamWasmFilePath(n, t);
try {
this.samWasmModule = await this.fetchSamModule(this.getOverriddenModules(c, e)), this.samWasmModule.init();
} catch {
throw await this.handleMissingOrInvalidSamModule(e, t), new $("Could not init detector.");
}
}
terminateSamModule() {
var c;
(c = this.samWasmModule) == null || c.terminate();
}
async getSamVersion() {
var n;
const c = await ((n = this.samWasmModule) == null ? void 0 : n.getInfoString());
return c == null ? void 0 : c.trim();
}
/*
* In TS 5.2.0 was added special keyword "using" which could be perfect for this case.
* Unfortunately, vite preact plugin does not support this version of TS yet.
* Check possibility of using "using" keyword when vite preact plugin updates
*/
writeImageToMemory(c) {
if (!this.samWasmModule)
throw new $("SAM WASM module is not initialized");
const n = new Wo(this.samWasmModule, c);
return n.writeDataToMemory(c), n;
}
convertToSamColorImage(c, n) {
if (!this.samWasmModule)
throw new $("SAM WASM module is not initialized");
const t = this.writeImageToMemory(c);
return this.samWasmModule.convertToSamColorImage(
n.width,
n.height,
t.rgbaImagePointer,
No.RGBA,
t.bgr0ImagePointer
), t;
}
async getOptimalRegionForCompressionDetection(c, n) {
if (!this.samWasmModule)
throw new $("SAM WASM module is not initialized");
const t = this.convertToSamColorImage(c, n), { height: e, width: r, x: o, y: u } = await this.samWasmModule.selectOptimalRegionForCompressionDetection(
n.width,
n.height,
t.bgr0ImagePointer
);
return t.free(), {
height: e,
width: r,
shiftX: o,
shiftY: u
};
}
}
const Ge = (p, c) => Math.hypot(c.x - p.x, c.y - p.y), Vo = (p) => {
const { bottomLeft: c, bottomRight: n, topLeft: t, topRight: e } = p, r = Ge(t, e), o = Ge(e, n), u = Ge(c, n), s = Ge(t, c);
return Math.min(r, o, u, s);
};
var be = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, ar = {}, st = {}, lt, sr;
function Uo() {
if (sr) return lt;
sr = 1, lt = p;
function p(c, n) {
for (var t = new Array(arguments.length - 1), e = 0, r = 2, o = !0; r < arguments.length; )
t[e++] = arguments[r++];
return new Promise(function(u, s) {
t[e] = function(g) {
if (o)
if (o = !1, g)
s(g);
else {
for (var S = new Array(arguments.length - 1), h = 0; h < S.length; )
S[h++] = arguments[h];
u.apply(null, S);
}
};
try {
c.apply(n || null, t);
} catch (g) {
o && (o = !1, s(g));
}
});
}
return lt;
}
var lr = {}, cr;
function Go() {
return cr || (cr = 1, function(p) {
var c = p;
c.length = function(o) {
var u = o.length;
if (!u)
return 0;
for (var s = 0; --u % 4 > 1 && o.charAt(u) === "="; )
++s;
return Math.ceil(o.length * 3) / 4 - s;
};
for (var n = new Array(64), t = new Array(123), e = 0; e < 64; )
t[n[e] = e < 26 ? e + 65 : e < 52 ? e + 71 : e < 62 ? e - 4 : e - 59 | 43] = e++;
c.encode = function(o, u, s) {
for (var g = null, S = [], h = 0, O = 0, I; u < s; ) {
var j = o[u++];
switch (O) {
case 0:
S[h++] = n[j >> 2], I = (j & 3) << 4, O = 1;
break;
case 1:
S[h++] = n[I | j >> 4], I = (j & 15) << 2, O = 2;
break;
case 2:
S[h++] = n[I | j >> 6], S[h++] = n[j & 63], O = 0;
break;
}
h > 8191 && ((g || (g = [])).push(String.fromCharCode.apply(String, S)), h = 0);
}
return O && (S[h++] = n[I], S[h++] = 61, O === 1 && (S[h++] = 61)), g ? (h && g.push(String.fromCharCode.apply(String, S.slice(0, h))), g.join("")) : String.fromCharCode.apply(String, S.slice(0, h));
};
var r = "invalid encoding";
c.decode = function(o, u, s) {
for (var g = s, S = 0, h, O = 0; O < o.length; ) {
var I = o.charCodeAt(O++);
if (I === 61 && S > 1)
break;
if ((I = t[I]) === void 0)
throw Error(r);
switch (S) {
case 0:
h = I, S = 1;
break;
case 1:
u[s++] = h << 2 | (I & 48) >> 4, h = I, S = 2;
break;
case 2:
u[s++] = (h & 15) << 4 | (I & 60) >> 2, h = I, S = 3;
break;
case 3:
u[s++] = (h & 3) << 6 | I, S = 0;
break;
}
}
if (S === 1)
throw Error(r);
return s - g;
}, c.test = function(o) {
return /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(o);
};
}(lr)), lr;
}
var ct, ur;
function $o() {
if (ur) return ct;
ur = 1, ct = p;
function p() {
this._listeners = {};
}
return p.prototype.on = function(c, n, t) {
return (this._listeners[c] || (this._listeners[c] = [])).push({
fn: n,
ctx: t || this
}), this;
}, p.prototype.off = function(c, n) {
if (c === void 0)
this._listeners = {};
else if (n === void 0)
this._listeners[c] = [];
else
for (var t = this._listeners[c], e = 0; e < t.length; )
t[e].fn === n ? t.splice(e, 1) : ++e;
return this;
}, p.prototype.emit = function(c) {
var n = this._listeners[c];
if (n) {
for (var t = [], e = 1; e < arguments.length; )
t.push(arguments[e++]);
for (e = 0; e < n.length; )
n[e].fn.apply(n[e++].ctx, t);
}
return this;
}, ct;
}
var ut, dr;
function Bo() {
if (dr) return ut;
dr = 1, ut = p(p);
function p(r) {
return typeof Float32Array < "u" ? function() {
var o = new Float32Array([-0]), u = new Uint8Array(o.buffer), s = u[3] === 128;
function g(I, j, F) {
o[0] = I, j[F] = u[0], j[F + 1] = u[1], j[F + 2] = u[2], j[F + 3] = u[3];
}
function S(I, j, F) {
o[0] = I, j[F] = u[3], j[F + 1] = u[2], j[F + 2] = u[1], j[F + 3] = u[0];
}
r.writeFloatLE = s ? g : S, r.writeFloatBE = s ? S : g;
function h(I, j) {
return u[0] = I[j], u[1] = I[j + 1], u[2] = I[j + 2], u[3] = I[j + 3], o[0];
}
function O(I, j) {
return u[3] = I[j], u[2] = I[j + 1], u[1] = I[j + 2], u[0] = I[j + 3], o[0];
}
r.readFloatLE = s ? h : O, r.readFloatBE = s ? O : h;
}() : function() {
function o(s, g, S, h) {
var O = g < 0 ? 1 : 0;
if (O && (g = -g), g === 0)
s(1 / g > 0 ? (
/* positive */
0
) : (
/* negative 0 */
2147483648
), S, h);
else if (isNaN(g))
s(2143289344, S, h);
else if (g > 34028234663852886e22)
s((O << 31 | 2139095040) >>> 0, S, h);
else if (g < 11754943508222875e-54)
s((O << 31 | Math.round(g / 1401298464324817e-60)) >>> 0, S, h);
else {
var I = Math.floor(Math.log(g) / Math.LN2), j = Math.round(g * Math.pow(2, -I) * 8388608) & 8388607;
s((O << 31 | I + 127 << 23 | j) >>> 0, S, h);
}
}
r.writeFloatLE = o.bind(null, c), r.writeFloatBE = o.bind(null, n);
function u(s, g, S) {
var h = s(g, S), O = (h >> 31) * 2 + 1, I = h >>> 23 & 255, j = h & 8388607;
return I === 255 ? j ? NaN : O * (1 / 0) : I === 0 ? O * 1401298464324817e-60 * j : O * Math.pow(2, I - 150) * (j + 8388608);
}
r.readFloatLE = u.bind(null, t), r.readFloatBE = u.bind(null, e);
}(), typeof Float64Array < "u" ? function() {
var o = new Float64Array([-0]), u = new Uint8Array(o.buffer), s = u[7] === 128;
function g(I, j, F) {
o[0] = I, j[F] = u[0], j[F + 1] = u[1], j[F + 2] = u[2], j[F + 3] = u[3], j[F + 4] = u[4], j[F + 5] = u[5], j[F + 6] = u[6], j[F + 7] = u[7];
}
function S(I, j, F) {
o[0] = I, j[F] = u[7], j[F + 1] = u[6], j[F + 2] = u[5], j[F + 3] = u[4], j[F + 4] = u[3], j[F + 5] = u[2], j[F + 6] = u[1], j[F + 7] = u[0];
}
r.writeDoubleLE = s ? g : S, r.writeDoubleBE = s ? S : g;
function h(I, j) {
return u[0] = I[j], u[1] = I[j + 1], u[2] = I[j + 2], u[3] = I[j + 3], u[4] = I[j + 4], u[5] = I[j + 5], u[6] = I[j + 6], u[7] = I[j + 7], o[0];
}
function O(I, j) {
return u[7] = I[j], u[6] = I[j + 1], u[5] = I[j + 2], u[4] = I[j + 3], u[3] = I[j + 4], u[2] = I[j + 5], u[1] = I[j + 6], u[0] = I[j + 7], o[0];
}
r.readDoubleLE = s ? h : O, r.readDoubleBE = s ? O : h;
}() : function() {
function o(s, g, S, h, O, I) {
var j = h < 0 ? 1 : 0;
if (j && (h = -h), h === 0)
s(0, O, I + g), s(1 / h > 0 ? (
/* positive */
0
) : (
/* negative 0 */
2147483648
), O, I + S);
else if (isNaN(h))
s(0, O, I + g), s(2146959360, O, I + S);
else if (h > 17976931348623157e292)
s(0, O, I + g), s((j << 31 | 2146435072) >>> 0, O, I + S);
else {
var F;
if (h < 22250738585072014e-324)
F = h / 5e-324, s(F >>> 0, O, I + g), s((j << 31 | F / 4294967296) >>> 0, O, I + S);
else {
var P = Math.floor(Math.log(h) / Math.LN2);
P === 1024 && (P = 1023), F = h * Math.pow(2, -P), s(F * 4503599627370496 >>> 0, O, I + g), s((j << 31 | P + 1023 << 20 | F * 1048576 & 1048575) >>> 0, O, I + S);
}
}
}
r.writeDoubleLE = o.bind(null, c, 0, 4), r.writeDoubleBE = o.bind(null, n, 4, 0);
function u(s, g, S, h, O) {
var I = s(h, O + g), j = s(h, O + S), F = (j >> 31) * 2 + 1, P = j >>> 20 & 2047, D = 4294967296 * (j & 1048575) + I;
return P === 2047 ? D ? NaN : F * (1 / 0) : P === 0 ? F * 5e-324 * D : F * Math.pow(2, P - 1075) * (D + 4503599627370496);
}
r.readDoubleLE = u.bind(null, t, 0, 4), r.readDoubleBE = u.bind(null, e, 4, 0);
}(), r;
}
function c(r, o, u) {
o[u] = r & 255, o[u + 1] = r >>> 8 & 255, o[u + 2] = r >>> 16 & 255, o[u + 3] = r >>> 24;
}
function n(r, o, u) {
o[u] = r >>> 24, o[u + 1] = r >>> 16 & 255, o[u + 2] = r >>> 8 & 255, o[u + 3] = r & 255;
}
function t(r, o) {
return (r[o] | r[o + 1] << 8 | r[o + 2] << 16 | r[o + 3] << 24) >>> 0;
}
function e(r, o) {
return (r[o] << 24 | r[o + 1] << 16 | r[o + 2] << 8 | r[o + 3]) >>> 0;
}
return ut;
}
function fr(p) {
throw new Error('Could not dynamically require "' + p + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.');
}
var dt, pr;
function Ho() {
if (pr) return dt;
pr = 1, dt = p;
function p(c) {
try {
if (typeof fr != "function")
return null;
var n = fr(c);
return n && (n.length || Object.keys(n).length) ? n : null;
} catch {
return null;
}
}
return dt;
}
var mr = {}, yr;
function Yo() {
return yr || (yr = 1, function(p) {
var c = p;
c.length = function(n) {
for (var t = 0, e = 0, r = 0; r < n.length; ++r)
e = n.charCodeAt(r), e < 128 ? t += 1 : e < 2048 ? t += 2 : (e & 64512) === 55296 && (n.charCodeAt(r + 1) & 64512) === 56320 ? (++r, t += 4) : t += 3;
return t;
}, c.read = function(n, t, e) {
var r = e - t;
if (r < 1)
return "";
for (var o = null, u = [], s = 0, g; t < e; )
g = n[t++], g < 128 ? u[s++] = g : g > 191 && g < 224 ? u[s++] = (g & 31) << 6 | n[t++] & 63 : g > 239 && g < 365 ? (g = ((g & 7) << 18 | (n[t++] & 63) << 12 | (n[t++] & 63) << 6 | n[t++] & 63) - 65536, u[s++] = 55296 + (g >> 10), u[s++] = 56320 + (g & 1023)) : u[s++] = (g & 15) << 12 | (n[t++] & 63) << 6 | n[t++] & 63, s > 8191 && ((o || (o = [])).push(String.fromCharCode.apply(String, u)), s = 0);
return o ? (s && o.push(String.fromCharCode.apply(String, u.slice(0, s))), o.join("")) : String.fromCharCode.apply(String, u.slice(0, s));
}, c.write = function(n, t, e) {
for (var r = e, o, u, s = 0; s < n.length; ++s)
o = n.charCodeAt(s), o < 128 ? t[e++] = o : o < 2048 ? (t[e++] = o >> 6 | 192, t[e++] = o & 63 | 128) : (o & 64512) === 55296 && ((u = n.charCodeAt(s + 1)) & 64512) === 56320 ? (o = 65536 + ((o & 1023) << 10) + (u & 1023), ++s, t[e++] = o >> 18 | 240, t[e++] = o >> 12 & 63 | 128, t[e++] = o >> 6 & 63 | 128, t[e++] = o & 63 | 128) : (t[e++] = o >> 12 | 224, t[e++] = o >> 6 & 63 | 128, t[e++] = o & 63 | 128);
return e - r;
};
}(mr)), mr;
}
var ft, hr;
function Jo() {
if (hr) return ft;
hr = 1, ft = p;
function p(c, n, t) {
var e = t || 8192, r = e >>> 1, o = null, u = e;
return function(s) {
if (s < 1 || s > r)
return c(s);
u + s > e && (o = c(e), u = 0);
var g = n.call(o, u, u += s);
return u & 7 && (u = (u | 7) + 1), g;
};
}
return ft;
}
var pt, gr;
function Zo() {
if (gr) return pt;
gr = 1, pt = c;
var p = pe();
function c(r, o) {
this.lo = r >>> 0, this.hi = o >>> 0;
}
var n = c.zero = new c(0, 0);
n.toNumber = function() {
return 0;
}, n.zzEncode = n.zzDecode = function() {
return this;
}, n.length = function() {
return 1;
};
var t = c.zeroHash = "\0\0\0\0\0\0\0\0";
c.fromNumber = function(r) {
if (r === 0)
return n;
var o = r < 0;
o && (r = -r);
var u = r >>> 0, s = (r - u) / 4294967296 >>> 0;
return o && (s = ~s >>> 0, u = ~u >>> 0, ++u > 4294967295 && (u = 0, ++s > 4294967295 && (s = 0))), new c(u, s);
}, c.from = function(r) {
if (typeof r == "number")
return c.fromNumber(r);
if (p.isString(r))
if (p.Long)
r = p.Long.fromString(r);
else
return c.fromNumber(parseInt(r, 10));
return r.low || r.high ? new c(r.low >>> 0, r.high >>> 0) : n;
}, c.prototype.toNumber = function(r) {
if (!r && this.hi >>> 31) {
var o = ~this.lo + 1 >>> 0, u = ~this.hi >>> 0;
return o || (u = u + 1 >>> 0), -(o + u * 4294967296);
}
return this.lo + this.hi * 4294967296;
}, c.prototype.toLong = function(r) {
return p.Long ? new p.Long(this.lo | 0, this.hi | 0, !!r) : { low: this.lo | 0, high: this.hi | 0, unsigned: !!r };
};
var e = String.prototype.charCodeAt;
return c.fromHash = function(r) {
return r === t ? n : new c(
(e.call(r, 0) | e.call(r, 1) << 8 | e.call(r, 2) << 16 | e.call(r, 3) << 24) >>> 0,
(e.call(r, 4) | e.call(r, 5) << 8 | e.call(r, 6) << 16 | e.call(r, 7) << 24) >>> 0
);
}, c.prototype.toHash = function() {
return String.fromCharCode(
this.lo & 255,
this.lo >>> 8 & 255,
this.lo >>> 16 & 255,
this.lo >>> 24,
this.hi & 255,
this.hi >>> 8 & 255,
this.hi >>> 16 & 255,
this.hi >>> 24
);
}, c.prototype.zzEncode = function() {
var r = this.hi >> 31;
return this.hi = ((this.hi << 1 | this.lo >>> 31) ^ r) >>> 0, this.lo = (this.lo << 1 ^ r) >>> 0, this;
}, c.prototype.zzDecode = function() {
var r = -(this.lo & 1);
return this.lo = ((this.lo >>> 1 | this.hi << 31) ^ r) >>> 0, this.hi = (this.hi >>> 1 ^ r) >>> 0, this;
}, c.prototype.length = function() {
var r = this.lo, o = (this.lo >>> 28 | this.hi << 4) >>> 0, u = this.hi >>> 24;
return u === 0 ? o === 0 ? r < 16384 ? r < 128 ? 1 : 2 : r < 2097152 ? 3 : 4 : o < 16384 ? o < 128 ? 5 : 6 : o < 2097152 ? 7 : 8 : u < 128 ? 9 : 10;
}, pt;
}
var br;
function pe() {
return br || (br = 1, function(p) {
var c = p;
c.asPromise = Uo(), c.base64 = Go(), c.EventEmitter = $o(), c.float = Bo(), c.inquire = Ho(), c.utf8 = Yo(), c.pool = Jo(), c.LongBits = Zo(), c.isNode = !!(typeof be < "u" && be && be.process && be.process.versions && be.process.versions.node), c.global = c.isNode && be || typeof window < "u" && window || typeof self < "u" && self || st, c.emptyArray = Object.freeze ? Object.freeze([]) : (
/* istanbul ignore next */
[]
), c.emptyObject = Object.freeze ? Object.freeze({}) : (
/* istanbul ignore next */
{}
), c.isInteger = Number.isInteger || /* istanbul ignore next */
function(e) {
return typeof e == "number" && isFinite(e) && Math.floor(e) === e;
}, c.isString = function(e) {
return typeof e == "string" || e instanceof String;
}, c.isObject = function(e) {
return e && typeof e == "object";
}, c.isset = /**
* Checks if a property on a message is considered to be present.
* @param {Object} obj Plain object or message instance
* @param {string} prop Property name
* @returns {boolean} `true` if considered to be present, otherwise `false`
*/
c.isSet = function(e, r) {
var o = e[r];
return o != null && e.hasOwnProperty(r) ? typeof o != "object" || (Array.isArray(o) ? o.length : Object.keys(o).length) > 0 : !1;
}, c.Buffer = function() {
try {
var e = c.inquire("buffer").Buffer;
return e.prototype.utf8Write ? e : (
/* istanbul ignore next */
null
);
} catch {
return null;
}
}(), c._Buffer_from = null, c._Buffer_allocUnsafe = null, c.newBuffer = function(e) {
return typeof e == "number" ? c.Buffer ? c._Buffer_allocUnsafe(e) : new c.Array(e) : c.Buffer ? c._Buffer_from(e) : typeof Uint8Array > "u" ? e : new Uint8Array(e);
}, c.Array = typeof Uint8Array < "u" ? Uint8Array : Array, c.Long = /* istanbul ignore next */
c.global.dcodeIO && /* istanbul ignore next */
c.global.dcodeIO.Long || /* istanbul ignore next */
c.global.Long || c.inquire("long"), c.key2Re = /^true|false|0|1$/, c.key32Re = /^-?(?:0|[1-9][0-9]*)$/, c.key64Re = /^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/, c.longToHash = function(e) {
return e ? c.LongBits.from(e).toHash() : c.LongBits.zeroHash;
}, c.longFromHash = function(e, r) {
var o = c.LongBits.fromHash(e);
return c.Long ? c.Long.fromBits(o.lo, o.hi, r) : o.toNumber(!!r);
};
function n(e, r, o) {
for (var u = Object.keys(r), s = 0; s < u.length; ++s)
(e[u[s]] === void 0 || !o) && (e[u[s]] = r[u[s]]);
return e;
}
c.merge = n, c.lcFirst = function(e) {
return e.charAt(0).toLowerCase() + e.substring(1);
};
function t(e) {
function r(o, u) {
if (!(this instanceof r))
return new r(o, u);
Object.defineProperty(this, "message", { get: function() {
return o;
} }), Error.captureStackTrace ? Error.captureStackTrace(this, r) : Object.defineProperty(this, "stack", { value: new Error().stack || "" }), u && n(this, u);
}
return r.prototype = Object.create(Error.prototype, {
constructor: {
value: r,
writable: !0,
enumerable: !1,
configurable: !0
},
name: {
get: function() {
return e;
},
set: void 0,
enumerable: !1,
// configurable: false would accurately preserve the behavior of
// the original, but I'm guessing that was not intentional.
// For an actual error subclass, this property would
// be configurable.
configurable: !0
},
toString: {
value: function() {
return this.name + ": " + this.message;
},
writable: !0,
enumerable: !1,
configurable: !0
}
}), r;
}
c.newError = t, c.ProtocolError = t("ProtocolError"), c.oneOfGetter = function(e) {
for (var r = {}, o = 0; o < e.length; ++o)
r[e[o]] = 1;
return function() {
for (var u = Object.keys(this), s = u.length - 1; s > -1; --s)
if (r[u[s]] === 1 && this[u[s]] !== void 0 && this[u[s]] !== null)
return u[s];
};
}, c.oneOfSetter = function(e) {
return function(r) {
for (var o = 0; o < e.length; ++o)
e[o] !== r && delete this[e[o]];
};
}, c.toJSONOptions = {
longs: String,
enums: String,
bytes: String,
json: !0
}, c._configure = function() {
var e = c.Buffer;
if (!e) {
c._Buffer_from = c._Buffer_allocUnsafe = null;
return;
}
c._Buffer_from = e.from !== Uint8Array.from && e.from || /* istanbul ignore next */
function(r, o) {
return new e(r, o);
}, c._Buffer_allocUnsafe = e.allocUnsafe || /* istanbul ignore next */
function(r) {
return new e(r);
};
};
}(st)), st;
}
var mt, vr;
function Fr() {
if (vr) return mt;
vr = 1, mt = s;
var p = pe(), c, n = p.LongBits, t = p.base64, e = p.utf8;
function r(P, D, R) {
this.fn = P, this.len = D, this.next = void 0, this.val = R;
}
function o() {
}
function u(P) {
this.head = P.head, this.tail = P.tail, this.len = P.len, this.next = P.states;
}
function s() {
this.len = 0, this.head = new r(o, 0, 0), this.tail = this.head, this.states = null;
}
var g = function() {
return p.Buffer ? function() {
return (s.create = function() {
return new c();
})();
} : function() {
return new s();
};
};
s.create = g(), s.alloc = function(P) {
return new p.Array(P);
}, p.Array !== Array && (s.alloc = p.pool(s.alloc, p.Array.prototype.subarray)), s.prototype._push = function(P, D, R) {
return this.tail = this.tail.next = new r(P, D, R), this.len += D, this;
};
function S(P, D, R) {
D[R] = P & 255;
}
function h(P, D, R) {
for (; P > 127; )
D[R++] = P & 127 | 128, P >>>= 7;
D[R] = P;
}
function O(P, D) {
this.len = P, this.next = void 0, this.val = D;
}
O.prototype = Object.create(r.prototype), O.prototype.fn = h, s.prototype.uint32 = function(P) {
return this.len += (this.tail = this.tail.next = new O(
(P = P >>> 0) < 128 ? 1 : P < 16384 ? 2 : P < 2097152 ? 3 : P < 268435456 ? 4 : 5,
P
)).len, this;
}, s.prototype.int32 = function(P) {
return P < 0 ? this._push(I, 10, n.fromNumber(P)) : this.uint32(P);
}, s.prototype.sint32 = function(P) {
return this.uint32((P << 1 ^ P >> 31) >>> 0);
};
function I(P, D, R) {
for (; P.hi; )
D[R++] = P.lo & 127 | 128, P.lo = (P.lo >>> 7 | P.hi << 25) >>> 0, P.hi >>>= 7;
for (; P.lo > 127; )
D[R++] = P.lo & 127 | 128, P.lo = P.lo >>> 7;
D[R++] = P.lo;
}
s.prototype.uint64 = function(P) {
var D = n.from(P);
return this._push(I, D.length(), D);
}, s.prototype.int64 = s.prototype.uint64, s.prototype.sint64 = function(P) {
var D = n.from(P).zzEncode();
return this._push(I, D.length(), D);
}, s.prototype.bool = function(P) {
return this._push(S, 1, P ? 1 : 0);
};
function j(P, D, R) {
D[R] = P & 255, D[R + 1] = P >>> 8 & 255, D[R + 2] = P >>> 16 & 255, D[R + 3] = P >>> 24;
}
s.prototype.fixed32 = function(P) {
return this._push(j, 4, P >>> 0);
}, s.prototype.sfixed32 = s.prototype.fixed32, s.prototype.fixed64 = function(P) {
var D = n.from(P);
return this._push(j, 4, D.lo)._push(j, 4, D.hi);
}, s.prototype.sfixed64 = s.prototype.fixed64, s.prototype.float = function(P) {
return this._push(p.float.writeFloatLE, 4, P);
}, s.prototype.double = function(P) {
return this._push(p.float.writeDoubleLE, 8, P);
};
var F = p.Array.prototype.set ? function(P, D, R) {
D.set(P, R);
} : function(P, D, R) {
for (var B = 0; B < P.length; ++B)
D[R + B] = P[B];
};
return s.prototype.bytes = function(P) {
var D = P.length >>> 0;
if (!D)
return this._push(S, 1, 0);
if (p.isString(P)) {
var R = s.alloc(D = t.length(P));
t.decode(P, R, 0), P = R;
}
return this.uint32(D)._push(F, D, P);
}, s.prototype.string = function(P) {
var D = e.length(P);
return D ? this.uint32(D)._push(e.write, D, P) : this._push(S, 1, 0);
}, s.prototype.fork = function() {
return this.states = new u(this), this.head = this.tail = new r(o, 0, 0), this.len = 0, this;
}, s.prototype.reset = function() {
return this.states ? (this.head = this.states.head, this.tail = this.states.tail, this.len = this.states.len, this.states = this.states.next) : (this.head = this.tail = new r(o, 0, 0), this.len = 0), this;
}, s.prototype.ldelim = function() {
var P = this.head, D = this.tail, R = this.len;
return this.reset().uint32(R), R && (this.tail.next = P.next, this.tail = D, this.len += R), this;
}, s.prototype.finish = function() {
for (var P = this.head.next, D = this.constructor.alloc(this.len), R = 0; P; )
P.fn(P.val, D, R), R += P.len, P = P.next;
return D;
}, s._configure = function(P) {
c = P, s.create = g(), c._configure();
}, mt;
}
var yt, Or;
function Ko() {
if (Or) return yt;
Or = 1, yt = n;
var p = Fr();
(n.prototype = Object.create(p.prototype)).constructor = n;
var c = pe();
function n() {
p.call(this);
}
n._configure = function() {
n.alloc = c._Buffer_allocUnsafe, n.writeBytesBuffer = c.Buffer && c.Buffer.prototype instanceof Uint8Array && c.Buffer.prototype.set.name === "set" ? function(e, r, o) {
r.set(e, o);
} : function(e, r, o) {
if (e.copy)
e.copy(r, o, 0, e.length);
else for (var u = 0; u < e.length; )
r[o++] = e[u++];
};
}, n.prototype.bytes = function(e) {
c.isString(e) && (e = c._Buffer_from(e, "base64"));
var r = e.length >>> 0;
return this.uint32(r), r && this._push(n.writeBytesBuffer, r, e), this;
};
function t(e, r, o) {
e.length < 40 ? c.utf8.write(e, r, o) : r.utf8Write ? r.utf8Write(e, o) : r.write(e, o);
}
return n.prototype.string = function(e) {
var r = c.Buffer.byteLength(e);
return this.uint32(r), r && this._push(t, r, e), this;
}, n._configure(), yt;
}
var ht, wr;
function _r() {
if (wr) return ht;
wr = 1, ht = r;
var p = pe(), c, n = p.LongBits, t = p.utf8;
function e(h, O) {
return RangeError("index out of range: " + h.pos + " + " + (O || 1) + " > " + h.len);
}
function r(h) {
this.buf = h, this.pos = 0, this.len = h.length;
}
var o = typeof Uint8Array < "u" ? function(h) {
if (h instanceof Uint8Array || Array.isArray(h))
return new r(h);
throw Error("illegal buffer");
} : function(h) {
if (Array.isArray(h))
return new r(h);
throw Error("illegal buffer");
}, u = function() {
return p.Buffer ? function(h) {
return (r.create = function(O) {
return p.Buffer.isBuffer(O) ? new c(O) : o(O);
})(h);
} : o;
};
r.create = u(), r.prototype._slice = p.Array.prototype.subarray || /* istanbul ignore next */
p.Array.prototype.slice, r.prototype.uint32 = /* @__PURE__ */ function() {
var h = 4294967295;
return function() {
if (h = (this.buf[this.pos] & 127) >>> 0, this.buf[this.pos++] < 128 || (h = (h | (this.buf[this.pos] & 127) << 7) >>> 0, this.buf[this.pos++] < 128) || (h = (h | (this.buf[this.pos] & 127) << 14) >>> 0, this.buf[this.pos++] < 128) || (h = (h | (this.buf[this.pos] & 127) << 21) >>> 0, this.buf[this.pos++] < 128) || (h = (h | (this.buf[this.pos] & 15) << 28) >>> 0, this.buf[this.pos++] < 128)) return h;
if ((this.pos += 5) > this.len)
throw this.pos = this.len, e(this, 10);
return h;
};
}(), r.prototype.int32 = function() {
return this.uint32() | 0;
}, r.prototype.sint32 = function() {
var h = this.uint32();
return h >>> 1 ^ -(h & 1) | 0;
};
function s() {
var h = new n(0, 0), O = 0;
if (this.len - this.pos > 4) {
for (; O < 4; ++O)
if (h.lo = (h.lo | (this.buf[this.pos] & 127) << O * 7) >>> 0, this.buf[this.pos++] < 128)
return h;
if (h.lo = (h.lo | (this.buf[this.pos] & 127) << 28) >>> 0, h.hi = (h.hi | (this.buf[this.pos] & 127) >> 4) >>> 0, this.buf[this.pos++] < 128)
return h;
O = 0;
} else {
for (; O < 3; ++O) {
if (this.pos >= this.len)
throw e(this);
if (h.lo = (h.lo | (this.buf[this.pos] & 127) << O * 7) >>> 0, this.buf[this.pos++] < 128)
return h;
}
return h.lo = (h.lo | (this.buf[this.pos++] & 127) << O * 7) >>> 0, h;
}
if (this.len - this.pos > 4) {
for (; O < 5; ++O)
if (h.hi = (h.hi | (this.buf[this.pos] & 127) << O * 7 + 3) >>> 0, this.buf[this.pos++] < 128)
return h;
} else
for (; O < 5; ++O) {
if (this.pos >= this.len)
throw e(this);
if (h.hi = (h.hi | (this.buf[this.pos] & 127) << O * 7 + 3) >>> 0, this.buf[this.pos++] < 128)
return h;
}
throw Error("invalid varint encoding");
}
r.prototype.bool = function() {
return this.uint32() !== 0;
};
function g(h, O) {
return (h[O - 4] | h[O - 3] << 8 | h[O - 2] << 16 | h[O - 1] << 24) >>> 0;
}
r.prototype.fixed32 = function() {
if (this.pos + 4 > this.len)
throw e(this, 4);
return g(this.buf, this.pos += 4);
}, r.prototype.sfixed32 = function() {
if (this.pos + 4 > this.len)
throw e(this, 4);
return g(this.buf, this.pos += 4) | 0;
};
function S() {
if (this.pos + 8 > this.len)
throw e(this, 8);
return new n(g(this.buf, this.pos += 4), g(this.buf, this.pos += 4));
}
return r.prototype.float = function() {
if (this.pos + 4 > this.len)
throw e(this, 4);
var h = p.float.readFloatLE(this.buf, this.pos);
return this.pos += 4, h;
}, r.prototype.double = function() {
if (this.pos + 8 > this.len)
throw e(this, 4);
var h = p.float.readDoubleLE(this.buf, this.pos);
return this.pos += 8, h;
}, r.prototype.bytes = function() {
var h = this.uint32(), O = this.pos, I = this.pos + h;
if (I > this.len)
throw e(this, h);
if (this.pos += h, Array.isArray(this.buf))
return this.buf.slice(O, I);
if (O === I) {
var j = p.Buffer;
return j ? j.alloc(0) : new this.buf.constructor(0);
}
return this._slice.call(this.buf, O, I);
}, r.prototype.string = function() {
var h = this.bytes();
return t.read(h, 0, h.length);
}, r.prototype.skip = function(h) {
if (typeof h == "number") {
if (this.pos + h > this.len)
throw e(this, h);
this.pos += h;
} else
do
if (this.pos >= this.len)
throw e(this);
while (this.buf[this.pos++] & 128);
return this;
}, r.prototype.skipType = function(h) {
switch (h) {
case 0:
this.skip();
break;
case 1:
this.skip(8);
break;
case 2:
this.skip(this.uint32());
break;
case 3:
for (; (h = this.uint32() & 7) !== 4; )
this.skipType(h);
break;
case 5:
this.skip(4);
break;
/* istanbul ignore next */
default:
throw Error("invalid wire type " + h + " at offset " + this.pos);
}
return this;
}, r._configure = function(h) {
c = h, r.create = u(), c._configure();
var O = p.Long ? "toLong" : (
/* istanbul ignore next */
"toNumber"
);
p.merge(r.prototype, {
int64: function() {
return s.call(this)[O](!1);
},
uint64: function() {
return s.call(this)[O](!0);
},
sint64: function() {
return s.call(this).zzDecode()[O](!1);
},
fixed64: function() {
return S.call(this)[O](!0);
},
sfixed64: function() {
return S.call(this)[O](!1);
}
});
}, ht;
}
var gt, Pr;
function qo() {
if (Pr) return gt;
Pr = 1, gt = n;
var p = _r();
(n.prototype = Object.create(p.prototype)).constructor = n;
var c = pe();
function n(t) {
p.call(this, t);
}
return n._configure = function() {
c.Buffer && (n.prototype._slice = c.Buffer.prototype.slice);
}, n.prototype.string = function() {
var t = this.uint32();
return this.buf.utf8Slice ? this.buf.utf8Slice(this.pos, this.pos = Math.min(this.pos + t, this.len)) : this.buf.toString("utf-8", this.pos, this.pos = Math.min(this.pos + t, this.len));
}, n._configure(), gt;
}
var Ir = {}, bt, jr;
function Xo() {
if (jr) return bt;
jr = 1, bt = c;
var p = pe();
(c.prototype = Object.create(p.EventEmitter.prototype)).constructor = c;
function c(n, t, e) {
if (typeof n != "function")
throw TypeError("rpcImpl must be a function");
p.EventEmitter.call(this), this.rpcImpl = n, this.requestDelimited = !!t, this.responseDelimited = !!e;
}
return c.prototype.rpcCall = function n(t, e, r, o, u) {
if (!o)
throw TypeError("request must be specified");
var s = this;
if (!u)
return p.asPromise(n, s, t, e, r, o);
if (!s.rpcImpl) {
setTimeout(function() {
u(Error("already ended"));
}, 0);
return;
}
try {
return s.rpcImpl(
t,
e[s.requestDelimited ? "encodeDelimited" : "encode"](o).finish(),
function(g, S) {
if (g)
return s.emit("error", g, t), u(g);
if (S === null) {
s.end(
/* endedByRPC */
!0
);
return;
}
if (!(S instanceof r))
try {
S = r[s.responseDelimited ? "decodeDelimited" : "decode"](S);
} catch (h) {
return s.emit("error", h, t), u(h);
}
return s.emit("data", S, t), u(null, S);
}
);
} catch (g) {
s.emit("error", g, t), setTimeout(function() {
u(g);
}, 0);
return;
}
}, c.prototype.end = function(n) {
return this.rpcImpl && (n || this.rpcImpl(null, null, null), this.rpcImpl = null, this.emit("end").off()), this;
}, bt;
}
var Cr;
function Qo() {
return Cr || (Cr = 1, function(p) {
var c = p;
c.Service = Xo();
}(Ir)), Ir;
}
var Sr, Ar;
function ei() {
return Ar || (Ar = 1, Sr = {}), Sr;
}
var Dr;
function ti() {
return Dr || (Dr = 1, function(p) {
var c = p;
c.build = "minimal", c.Writer = Fr(), c.BufferWriter = Ko(), c.Reader = _r(), c.BufferReader = qo(), c.util = pe(), c.rpc = Qo(), c.roots = ei(), c.configure = n;
function n() {
c.util._configure(), c.Writer._configure(c.BufferWriter), c.Reader._configure(c.BufferReader);
}
n();
}(ar)), ar;
}
var kr, Tr;
function ri() {
return Tr || (Tr = 1, kr = ti()), kr;
}
var E = ri();
const y = E.Reader, L = E.Writer, d = E.util, i = E.roots.default || (E.roots.default = {});
i.dot = (() => {
const p = {};
return p.Content = function() {
function c(n) {
if (n)
for (let t = Object.keys(n), e = 0; e < t.length; ++e)
n[t[e]] != null && (this[t[e]] = n[t[e]]);
}
return c.prototype.token = d.newBuffer([]), c.prototype.iv = d.newBuffer([]), c.prototype.schemaVersion = 0, c.prototype.bytes = d.newBuffer([]), c.create = function(n) {
return new c(n);
}, c.encode = function(n, t) {
return t || (t = L.create()), n.token != null && Object.hasOwnProperty.call(n, "token") && t.uint32(
/* id 1, wireType 2 =*/
10
).bytes(n.token), n.iv != null && Object.hasOwnProperty.call(n, "iv") && t.uint32(
/* id 2, wireType 2 =*/
18
).bytes(n.iv), n.schemaVersion != null && Object.hasOwnProperty.call(n, "schemaVersion") && t.uint32(
/* id 3, wireType 0 =*/
24
).int32(n.schemaVersion), n.bytes != null && Object.hasOwnProperty.call(n, "bytes") && t.uint32(
/* id 4, wireType 2 =*/
34
).bytes(n.bytes), t;
}, c.encodeDelimited = function(n, t) {
return this.encode(n, t).ldelim();
}, c.decode = function(n, t, e) {
n instanceof y || (n = y.create(n));
let r = t === void 0 ? n.len : n.pos + t, o = new i.dot.Content();
for (; n.pos < r; ) {
let u = n.uint32();
if (u === e)
break;
switch (u >>> 3) {
case 1: {
o.token = n.bytes();
break;
}
case 2: {
o.iv = n.bytes();
break;
}
case 3: {
o.schemaVersion = n.int32();
break;
}
case 4: {
o.bytes = n.bytes();
break;
}
default:
n.skipType(u & 7);
break;
}
}
return o;
}, c.decodeDelimited = function(n) {
return n instanceof y || (n = new y(n)), this.decode(n, n.uint32());
}, c.verify = function(n) {
return typeof n != "object" || n === null ? "object expected" : n.token != null && n.hasOwnProperty("token") && !(n.token && typeof n.token.length == "number" || d.isString(n.token)) ? "token: buffer expected" : n.iv != null && n.hasOwnProperty("iv") && !(n.iv && typeof n.iv.length == "number" || d.isString(n.iv)) ? "iv: buffer expected" : n.schemaVersion != null && n.hasOwnProperty("schemaVersion") && !d.isInteger(n.schemaVersion) ? "schemaVersion: integer expected" : n.bytes != null && n.hasOwnProperty("bytes") && !(n.bytes && typeof n.bytes.length == "number" || d.isString(n.bytes)) ? "bytes: buffer expected" : null;
}, c.fromObject = function(n) {
if (n instanceof i.dot.Content)
return n;
let t = new i.dot.Content();
return n.token != null && (typeof n.token == "string" ? d.base64.decode(n.token, t.token = d.newBuffer(d.base64.length(n.token)), 0) : n.token.length >= 0 && (t.token = n.token)), n.iv != null && (typeof n.iv == "string" ? d.base64.decode(n.iv, t.iv = d.newBuffer(d.base64.length(n.iv)), 0) : n.iv.length >= 0 && (t.iv = n.iv)), n.schemaVersion != null && (t.schemaVersion = n.schemaVersion | 0), n.bytes != null && (typeof n.bytes == "string" ? d.base64.decode(n.bytes, t.bytes = d.newBuffer(d.base64.length(n.bytes)), 0) : n.bytes.length >= 0 && (t.bytes = n.bytes)), t;
}, c.toObject = function(n, t) {
t || (t = {});
let e = {};
return t.defaults && (t.bytes === String ? e.token = "" : (e.token = [], t.bytes !== Array && (e.token = d.newBuffer(e.token))), t.bytes === String ? e.iv = "" : (e.iv = [], t.bytes !== Array && (e.iv = d.newBuffer(e.iv))), e.schemaVersion = 0, t.bytes === String ? e.bytes = "" : (e.bytes = [], t.bytes !== Array && (e.bytes = d.newBuffer(e.bytes)))), n.token != null && n.hasOwnProperty("token") && (e.token = t.bytes === String ? d.base64.encode(n.token, 0, n.token.length) : t.bytes === Array ? Array.prototype.slice.call(n.token) : n.token), n.iv != null && n.hasOwnProperty("iv") && (e.iv = t.bytes === String ? d.base64.encode(n.iv, 0, n.iv.length) : t.bytes === Array ? Array.prototype.slice.call(n.iv) : n.iv), n.schemaVersion != null && n.hasOwnProperty("schemaVersion") && (e.schemaVersion = n.schemaVersion), n.bytes != null && n.hasOwnProperty("bytes") && (e.bytes = t.bytes === String ? d.base64.encode(n.bytes, 0, n.bytes.length) : t.bytes === Array ? Array.prototype.slice.call(n.bytes) : n.bytes), e;
}, c.prototype.toJSON = function() {
return this.constructor.toObject(this, E.util.toJSONOptions);
}, c.getTypeUrl = function(n) {
return n === void 0 && (n = "type.googleapis.com"), n + "/dot.Content";
}, c;
}(), p.v4 = function() {
const c = {};
return c.MagnifEyeLivenessContent = function() {
function n(e) {
if (this.images = [], e)
for (let r = Object.keys(e), o = 0; o < r.length; ++o)
e[r[o]] != null && (this[r[o]] = e[r[o]]);
}
n.prototype.images = d.emptyArray, n.prototype.video = null, n.prototype.metadata = null;
let t;
return Object.defineProperty(n.prototype, "_video", {
get: d.oneOfGetter(t = ["video"]),
set: d.oneOfSetter(t)
}), n.create = function(e) {
return new n(e);
}, n.encode = function(e, r) {
if (r || (r = L.create()), e.images != null && e.images.length)
for (let o = 0; o < e.images.length; ++o)
i.dot.Image.encode(e.images[o], r.uint32(
/* id 1, wireType 2 =*/
10
).fork()).ldelim();
return e.metadata != null && Object.hasOwnProperty.call(e, "metadata") && i.dot.v4.Metadata.encode(e.metadata, r.uint32(
/* id 2, wireType 2 =*/
18
).fork()).ldelim(), e.video != null && Object.hasOwnProperty.call(e, "video") && i.dot.Video.encode(e.video, r.uint32(
/* id 3, wireType 2 =*/
26
).fork()).ldelim(), r;
}, n.encodeDelimited = function(e, r) {
return this.encode(e, r).ldelim();
}, n.decode = function(e, r, o) {
e instanceof y || (e = y.create(e));
let u = r === void 0 ? e.len : e.pos + r, s = new i.dot.v4.MagnifEyeLivenessContent();
for (; e.pos < u; ) {
let g = e.uint32();
if (g === o)
break;
switch (g >>> 3) {
case 1: {
s.images && s.images.length || (s.images = []), s.images.push(i.dot.Image.decode(e, e.uint32()));
break;
}
case 3: {
s.video = i.dot.Video.decode(e, e.uint32());
break;
}
case 2: {
s.metadata = i.dot.v4.Metadata.decode(e, e.uint32());
break;
}
default:
e.skipType(g & 7);
break;
}
}
return s;
}, n.decodeDelimited = function(e) {
return e instanceof y || (e = new y(e)), this.decode(e, e.uint32());
}, n.verify = function(e) {
if (typeof e != "object" || e === null)
return "object expected";
if (e.images != null && e.hasOwnProperty("images")) {
if (!Array.isArray(e.images))
return "images: array expected";
for (let r = 0; r < e.images.length; ++r) {
let o = i.dot.Image.verify(e.images[r]);
if (o)
return "images." + o;
}
}
if (e.video != null && e.hasOwnProperty("video")) {
let r = i.dot.Video.verify(e.video);
if (r)
return "video." + r;
}
if (e.metadata != null && e.hasOwnProperty("metadata")) {
let r = i.dot.v4.Metadata.verify(e.metadata);
if (r)
return "metadata." + r;
}
return null;
}, n.fromObject = function(e) {
if (e instanceof i.dot.v4.MagnifEyeLivenessContent)
return e;
let r = new i.dot.v4.MagnifEyeLivenessContent();
if (e.images) {
if (!Array.isArray(e.images))
throw TypeError(".dot.v4.MagnifEyeLivenessContent.images: array expected");
r.images = [];
for (let o = 0; o < e.images.length; ++o) {
if (typeof e.images[o] != "object")
throw TypeError(".dot.v4.MagnifEyeLivenessContent.images: object expected");
r.images[o] = i.dot.Image.fromObject(e.images[o]);
}
}
if (e.video != null) {
if (typeof e.video != "object")
throw TypeError(".dot.v4.MagnifEyeLivenessContent.video: object expected");
r.video = i.dot.Video.fromObject(e.video);
}
if (e.metadata != null) {
if (typeof e.metadata != "object")
throw TypeError(".dot.v4.MagnifEyeLivenessContent.metadata: object expected");
r.metadata = i.dot.v4.Metadata.fromObject(e.metadata);
}
return r;
}, n.toObject = function(e, r) {
r || (r = {});
let o = {};
if ((r.arrays || r.defaults) && (o.images = []), r.defaults && (o.metadata = null), e.images && e.images.length) {
o.images = [];
for (let u = 0; u < e.images.length; ++u)
o.images[u] = i.dot.Image.toObject(e.images[u], r);
}
return e.metadata != null && e.hasOwnProperty("metadata") && (o.metadata = i.dot.v4.Metadata.toObject(e.metadata, r)), e.video != null && e.hasOwnProperty("video") && (o.video = i.dot.Video.toObject(e.video, r), r.oneofs && (o._video = "video")), o;
}, n.prototype.toJSON = function() {
return this.constructor.toObject(this, E.util.toJSONOptions);
}, n.getTypeUrl = function(e) {
return e === void 0 && (e = "type.googleapis.com"), e + "/dot.v4.MagnifEyeLivenessContent";
}, n;
}(), c.Metadata = function() {
function n(e) {
if (e)
for (let r = Object.keys(e), o = 0; o < r.length; ++o)
e[r[o]] != null && (this[r[o]] = e[r[o]]);
}
n.prototype.platform = 0, n.prototype.sessionToken = null, n.prototype.componentVersion = "", n.prototype.web = null, n.prototype.android = null, n.prototype.ios = null;
let t;
return Object.defineProperty(n.prototype, "_sessionToken", {
get: d.oneOfGetter(t = ["sessionToken"]),
set: d.oneOfSetter(t)
}), Object.defineProperty(n.prototype, "metadata", {
get: d.oneOfGetter(t = ["web", "android", "ios"]),
set: d.oneOfSetter(t)
}), n.create = function(e) {
return new n(e);
}, n.encode = function(e, r) {
return r || (r = L.create()), e.platform != null && Object.hasOwnProperty.call(e, "platform") && r.uint32(
/* id 1, wireType 0 =*/
8
).int32(e.platform), e.web != null && Object.hasOwnProperty.call(e, "web") && i.dot.v4.WebMetadata.encode(e.web, r.uint32(
/* id 2, wireType 2 =*/
18
).fork()).ldelim(), e.android != null && Object.hasOwnProperty.call(e, "android") && i.dot.v4.AndroidMetadata.encode(e.android, r.uint32(
/* id 3, wireType 2 =*/
26
).fork()).ldelim(), e.ios != null && Object.hasOwnProperty.call(e, "ios") && i.dot.v4.IosMetadata.encode(e.ios, r.uint32(
/* id 4, wireType 2 =*/
34
).fork()).ldelim(), e.sessionToken != null && Object.hasOwnProperty.call(e, "sessionToken") && r.uint32(
/* id 5, wireType 2 =*/
42
).string(e.sessionToken), e.componentVersion != null && Object.hasOwnProperty.call(e, "componentVersion") && r.uint32(