@innovatrics/dot-document-auto-capture
Version:
Digital onboarding document capture
1,353 lines • 296 kB
JavaScript
var Bo = Object.defineProperty;
var gr = (c) => {
throw TypeError(c);
};
var Ho = (c, i, r) => i in c ? Bo(c, i, { enumerable: !0, configurable: !0, writable: !0, value: r }) : c[i] = r;
var Ze = (c, i, r) => Ho(c, typeof i != "symbol" ? i + "" : i, r), yr = (c, i, r) => i.has(c) || gr("Cannot " + r);
var Z = (c, i, r) => (yr(c, i, "read from private field"), r ? r.call(c) : i.get(c)), Ke = (c, i, r) => i.has(c) ? gr("Cannot add the same private member more than once") : i instanceof WeakSet ? i.add(c) : i.set(c, r), qe = (c, i, r, t) => (yr(c, i, "write to private field"), t ? t.call(c, r) : i.set(c, r), r);
const br = {
simd: "sam_simd.wasm",
sam: "sam.wasm"
}, Vo = 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 G extends Error {
constructor(r, t) {
super(r);
Ze(this, "cause");
this.name = "AutoCaptureError", this.cause = t;
}
// Change this to Decorator when they will be in stable release
static logError(r) {
}
static fromCameraError(r) {
if (this.logError(r), r instanceof G)
return r;
let t;
switch (r.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 G(t, r);
}
static fromError(r) {
if (this.logError(r), r instanceof G)
return r;
const t = "An unexpected error has occurred";
return new G(t);
}
}
const Jo = {
RGB: "RGB",
RGBA: "RGBA"
};
var se, ge, je;
class Yo {
constructor(i, r) {
Ke(this, se);
Ke(this, ge);
Ke(this, je);
qe(this, se, i), qe(this, ge, this.allocate(r.length * r.BYTES_PER_ELEMENT)), qe(this, je, this.allocate(r.length * r.BYTES_PER_ELEMENT));
}
get rgbaImagePointer() {
return Z(this, ge);
}
get bgr0ImagePointer() {
return Z(this, je);
}
allocate(i) {
return Z(this, se)._malloc(i);
}
free() {
Z(this, se)._free(Z(this, ge)), Z(this, se)._free(Z(this, je));
}
writeDataToMemory(i) {
Z(this, se).HEAPU8.set(i, Z(this, ge));
}
}
se = new WeakMap(), ge = new WeakMap(), je = new WeakMap();
class Zo {
constructor() {
Ze(this, "samWasmModule");
}
getOverriddenModules(i, r) {
return {
locateFile: (t) => new URL(r || t, i).href
};
}
async handleMissingOrInvalidSamModule(i, r) {
try {
const t = await fetch(i);
if (!t.ok)
throw new G(
`The path to ${r} is incorrect or the module is missing. Please check provided path to wasm files. Current path is ${i}`
);
const e = await t.arrayBuffer();
if (!WebAssembly.validate(e))
throw new G(
`The provided ${r} is not a valid WASM module. Please check provided path to wasm files. Current path is ${i}`
);
} catch (t) {
if (t instanceof G)
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 Vo() ? br.simd : br.sam;
}
async initSamModule(i, r) {
if (this.samWasmModule)
return;
const t = await this.getSamWasmFileName(), e = this.getSamWasmFilePath(r, t);
try {
this.samWasmModule = await this.fetchSamModule(this.getOverriddenModules(i, e)), this.samWasmModule.init();
} catch {
throw await this.handleMissingOrInvalidSamModule(e, t), new G("Could not init detector.");
}
}
terminateSamModule() {
var i;
(i = this.samWasmModule) == null || i.terminate();
}
async getSamVersion() {
var r;
const i = await ((r = this.samWasmModule) == null ? void 0 : r.getInfoString());
return i == null ? void 0 : i.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(i) {
if (!this.samWasmModule)
throw new G("SAM WASM module is not initialized");
const r = new Yo(this.samWasmModule, i);
return r.writeDataToMemory(i), r;
}
convertToSamColorImage(i, r) {
if (!this.samWasmModule)
throw new G("SAM WASM module is not initialized");
const t = this.writeImageToMemory(i);
return this.samWasmModule.convertToSamColorImage(
r.width,
r.height,
t.rgbaImagePointer,
Jo.RGBA,
t.bgr0ImagePointer
), t;
}
}
const Xe = (c, i) => Math.hypot(i.x - c.x, i.y - c.y), Ko = (c) => {
const { bottomLeft: i, bottomRight: r, topLeft: t, topRight: e } = c, n = Xe(t, e), o = Xe(e, r), d = Xe(i, r), f = Xe(t, i);
return Math.min(n, o, d, f);
};
var me = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, Mr = {}, vr = {}, qo = Xo;
function Xo(c, i) {
for (var r = new Array(arguments.length - 1), t = 0, e = 2, n = !0; e < arguments.length; )
r[t++] = arguments[e++];
return new Promise(function(o, d) {
r[t] = function(f) {
if (n)
if (n = !1, f)
d(f);
else {
for (var y = new Array(arguments.length - 1), O = 0; O < y.length; )
y[O++] = arguments[O];
o.apply(null, y);
}
};
try {
c.apply(i || null, r);
} catch (f) {
n && (n = !1, d(f));
}
});
}
var Rr = {};
(function(c) {
var i = c;
i.length = function(o) {
var d = o.length;
if (!d)
return 0;
for (var f = 0; --d % 4 > 1 && o.charAt(d) === "="; )
++f;
return Math.ceil(o.length * 3) / 4 - f;
};
for (var r = new Array(64), t = new Array(123), e = 0; e < 64; )
t[r[e] = e < 26 ? e + 65 : e < 52 ? e + 71 : e < 62 ? e - 4 : e - 59 | 43] = e++;
i.encode = function(o, d, f) {
for (var y = null, O = [], I = 0, C = 0, _; d < f; ) {
var X = o[d++];
switch (C) {
case 0:
O[I++] = r[X >> 2], _ = (X & 3) << 4, C = 1;
break;
case 1:
O[I++] = r[_ | X >> 4], _ = (X & 15) << 2, C = 2;
break;
case 2:
O[I++] = r[_ | X >> 6], O[I++] = r[X & 63], C = 0;
break;
}
I > 8191 && ((y || (y = [])).push(String.fromCharCode.apply(String, O)), I = 0);
}
return C && (O[I++] = r[_], O[I++] = 61, C === 1 && (O[I++] = 61)), y ? (I && y.push(String.fromCharCode.apply(String, O.slice(0, I))), y.join("")) : String.fromCharCode.apply(String, O.slice(0, I));
};
var n = "invalid encoding";
i.decode = function(o, d, f) {
for (var y = f, O = 0, I, C = 0; C < o.length; ) {
var _ = o.charCodeAt(C++);
if (_ === 61 && O > 1)
break;
if ((_ = t[_]) === void 0)
throw Error(n);
switch (O) {
case 0:
I = _, O = 1;
break;
case 1:
d[f++] = I << 2 | (_ & 48) >> 4, I = _, O = 2;
break;
case 2:
d[f++] = (I & 15) << 4 | (_ & 60) >> 2, I = _, O = 3;
break;
case 3:
d[f++] = (I & 3) << 6 | _, O = 0;
break;
}
}
if (O === 1)
throw Error(n);
return f - y;
}, i.test = function(o) {
return /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(o);
};
})(Rr);
var Qo = it;
function it() {
this._listeners = {};
}
it.prototype.on = function(c, i, r) {
return (this._listeners[c] || (this._listeners[c] = [])).push({
fn: i,
ctx: r || this
}), this;
};
it.prototype.off = function(c, i) {
if (c === void 0)
this._listeners = {};
else if (i === void 0)
this._listeners[c] = [];
else
for (var r = this._listeners[c], t = 0; t < r.length; )
r[t].fn === i ? r.splice(t, 1) : ++t;
return this;
};
it.prototype.emit = function(c) {
var i = this._listeners[c];
if (i) {
for (var r = [], t = 1; t < arguments.length; )
r.push(arguments[t++]);
for (t = 0; t < i.length; )
i[t].fn.apply(i[t++].ctx, r);
}
return this;
};
var ei = Or(Or);
function Or(c) {
return typeof Float32Array < "u" ? function() {
var i = new Float32Array([-0]), r = new Uint8Array(i.buffer), t = r[3] === 128;
function e(f, y, O) {
i[0] = f, y[O] = r[0], y[O + 1] = r[1], y[O + 2] = r[2], y[O + 3] = r[3];
}
function n(f, y, O) {
i[0] = f, y[O] = r[3], y[O + 1] = r[2], y[O + 2] = r[1], y[O + 3] = r[0];
}
c.writeFloatLE = t ? e : n, c.writeFloatBE = t ? n : e;
function o(f, y) {
return r[0] = f[y], r[1] = f[y + 1], r[2] = f[y + 2], r[3] = f[y + 3], i[0];
}
function d(f, y) {
return r[3] = f[y], r[2] = f[y + 1], r[1] = f[y + 2], r[0] = f[y + 3], i[0];
}
c.readFloatLE = t ? o : d, c.readFloatBE = t ? d : o;
}() : function() {
function i(t, e, n, o) {
var d = e < 0 ? 1 : 0;
if (d && (e = -e), e === 0)
t(1 / e > 0 ? (
/* positive */
0
) : (
/* negative 0 */
2147483648
), n, o);
else if (isNaN(e))
t(2143289344, n, o);
else if (e > 34028234663852886e22)
t((d << 31 | 2139095040) >>> 0, n, o);
else if (e < 11754943508222875e-54)
t((d << 31 | Math.round(e / 1401298464324817e-60)) >>> 0, n, o);
else {
var f = Math.floor(Math.log(e) / Math.LN2), y = Math.round(e * Math.pow(2, -f) * 8388608) & 8388607;
t((d << 31 | f + 127 << 23 | y) >>> 0, n, o);
}
}
c.writeFloatLE = i.bind(null, wr), c.writeFloatBE = i.bind(null, Pr);
function r(t, e, n) {
var o = t(e, n), d = (o >> 31) * 2 + 1, f = o >>> 23 & 255, y = o & 8388607;
return f === 255 ? y ? NaN : d * (1 / 0) : f === 0 ? d * 1401298464324817e-60 * y : d * Math.pow(2, f - 150) * (y + 8388608);
}
c.readFloatLE = r.bind(null, jr), c.readFloatBE = r.bind(null, Ir);
}(), typeof Float64Array < "u" ? function() {
var i = new Float64Array([-0]), r = new Uint8Array(i.buffer), t = r[7] === 128;
function e(f, y, O) {
i[0] = f, y[O] = r[0], y[O + 1] = r[1], y[O + 2] = r[2], y[O + 3] = r[3], y[O + 4] = r[4], y[O + 5] = r[5], y[O + 6] = r[6], y[O + 7] = r[7];
}
function n(f, y, O) {
i[0] = f, y[O] = r[7], y[O + 1] = r[6], y[O + 2] = r[5], y[O + 3] = r[4], y[O + 4] = r[3], y[O + 5] = r[2], y[O + 6] = r[1], y[O + 7] = r[0];
}
c.writeDoubleLE = t ? e : n, c.writeDoubleBE = t ? n : e;
function o(f, y) {
return r[0] = f[y], r[1] = f[y + 1], r[2] = f[y + 2], r[3] = f[y + 3], r[4] = f[y + 4], r[5] = f[y + 5], r[6] = f[y + 6], r[7] = f[y + 7], i[0];
}
function d(f, y) {
return r[7] = f[y], r[6] = f[y + 1], r[5] = f[y + 2], r[4] = f[y + 3], r[3] = f[y + 4], r[2] = f[y + 5], r[1] = f[y + 6], r[0] = f[y + 7], i[0];
}
c.readDoubleLE = t ? o : d, c.readDoubleBE = t ? d : o;
}() : function() {
function i(t, e, n, o, d, f) {
var y = o < 0 ? 1 : 0;
if (y && (o = -o), o === 0)
t(0, d, f + e), t(1 / o > 0 ? (
/* positive */
0
) : (
/* negative 0 */
2147483648
), d, f + n);
else if (isNaN(o))
t(0, d, f + e), t(2146959360, d, f + n);
else if (o > 17976931348623157e292)
t(0, d, f + e), t((y << 31 | 2146435072) >>> 0, d, f + n);
else {
var O;
if (o < 22250738585072014e-324)
O = o / 5e-324, t(O >>> 0, d, f + e), t((y << 31 | O / 4294967296) >>> 0, d, f + n);
else {
var I = Math.floor(Math.log(o) / Math.LN2);
I === 1024 && (I = 1023), O = o * Math.pow(2, -I), t(O * 4503599627370496 >>> 0, d, f + e), t((y << 31 | I + 1023 << 20 | O * 1048576 & 1048575) >>> 0, d, f + n);
}
}
}
c.writeDoubleLE = i.bind(null, wr, 0, 4), c.writeDoubleBE = i.bind(null, Pr, 4, 0);
function r(t, e, n, o, d) {
var f = t(o, d + e), y = t(o, d + n), O = (y >> 31) * 2 + 1, I = y >>> 20 & 2047, C = 4294967296 * (y & 1048575) + f;
return I === 2047 ? C ? NaN : O * (1 / 0) : I === 0 ? O * 5e-324 * C : O * Math.pow(2, I - 1075) * (C + 4503599627370496);
}
c.readDoubleLE = r.bind(null, jr, 0, 4), c.readDoubleBE = r.bind(null, Ir, 4, 0);
}(), c;
}
function wr(c, i, r) {
i[r] = c & 255, i[r + 1] = c >>> 8 & 255, i[r + 2] = c >>> 16 & 255, i[r + 3] = c >>> 24;
}
function Pr(c, i, r) {
i[r] = c >>> 24, i[r + 1] = c >>> 16 & 255, i[r + 2] = c >>> 8 & 255, i[r + 3] = c & 255;
}
function jr(c, i) {
return (c[i] | c[i + 1] << 8 | c[i + 2] << 16 | c[i + 3] << 24) >>> 0;
}
function Ir(c, i) {
return (c[i] << 24 | c[i + 1] << 16 | c[i + 2] << 8 | c[i + 3]) >>> 0;
}
function Sr(c) {
throw new Error('Could not dynamically require "' + c + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.');
}
var ti = ri;
function ri(c) {
try {
if (typeof Sr != "function")
return null;
var i = Sr(c);
return i && (i.length || Object.keys(i).length) ? i : null;
} catch {
return null;
}
}
var Lr = {};
(function(c) {
var i = c;
i.length = function(r) {
for (var t = 0, e = 0, n = 0; n < r.length; ++n)
e = r.charCodeAt(n), e < 128 ? t += 1 : e < 2048 ? t += 2 : (e & 64512) === 55296 && (r.charCodeAt(n + 1) & 64512) === 56320 ? (++n, t += 4) : t += 3;
return t;
}, i.read = function(r, t, e) {
var n = e - t;
if (n < 1)
return "";
for (var o = null, d = [], f = 0, y; t < e; )
y = r[t++], y < 128 ? d[f++] = y : y > 191 && y < 224 ? d[f++] = (y & 31) << 6 | r[t++] & 63 : y > 239 && y < 365 ? (y = ((y & 7) << 18 | (r[t++] & 63) << 12 | (r[t++] & 63) << 6 | r[t++] & 63) - 65536, d[f++] = 55296 + (y >> 10), d[f++] = 56320 + (y & 1023)) : d[f++] = (y & 15) << 12 | (r[t++] & 63) << 6 | r[t++] & 63, f > 8191 && ((o || (o = [])).push(String.fromCharCode.apply(String, d)), f = 0);
return o ? (f && o.push(String.fromCharCode.apply(String, d.slice(0, f))), o.join("")) : String.fromCharCode.apply(String, d.slice(0, f));
}, i.write = function(r, t, e) {
for (var n = e, o, d, f = 0; f < r.length; ++f)
o = r.charCodeAt(f), o < 128 ? t[e++] = o : o < 2048 ? (t[e++] = o >> 6 | 192, t[e++] = o & 63 | 128) : (o & 64512) === 55296 && ((d = r.charCodeAt(f + 1)) & 64512) === 56320 ? (o = 65536 + ((o & 1023) << 10) + (d & 1023), ++f, 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 - n;
};
})(Lr);
var ni = oi;
function oi(c, i, r) {
var t = r || 8192, e = t >>> 1, n = null, o = t;
return function(d) {
if (d < 1 || d > e)
return c(d);
o + d > t && (n = c(t), o = 0);
var f = i.call(n, o, o += d);
return o & 7 && (o = (o | 7) + 1), f;
};
}
var Ot, Cr;
function ii() {
if (Cr)
return Ot;
Cr = 1, Ot = i;
var c = be();
function i(n, o) {
this.lo = n >>> 0, this.hi = o >>> 0;
}
var r = i.zero = new i(0, 0);
r.toNumber = function() {
return 0;
}, r.zzEncode = r.zzDecode = function() {
return this;
}, r.length = function() {
return 1;
};
var t = i.zeroHash = "\0\0\0\0\0\0\0\0";
i.fromNumber = function(n) {
if (n === 0)
return r;
var o = n < 0;
o && (n = -n);
var d = n >>> 0, f = (n - d) / 4294967296 >>> 0;
return o && (f = ~f >>> 0, d = ~d >>> 0, ++d > 4294967295 && (d = 0, ++f > 4294967295 && (f = 0))), new i(d, f);
}, i.from = function(n) {
if (typeof n == "number")
return i.fromNumber(n);
if (c.isString(n))
if (c.Long)
n = c.Long.fromString(n);
else
return i.fromNumber(parseInt(n, 10));
return n.low || n.high ? new i(n.low >>> 0, n.high >>> 0) : r;
}, i.prototype.toNumber = function(n) {
if (!n && this.hi >>> 31) {
var o = ~this.lo + 1 >>> 0, d = ~this.hi >>> 0;
return o || (d = d + 1 >>> 0), -(o + d * 4294967296);
}
return this.lo + this.hi * 4294967296;
}, i.prototype.toLong = function(n) {
return c.Long ? new c.Long(this.lo | 0, this.hi | 0, !!n) : { low: this.lo | 0, high: this.hi | 0, unsigned: !!n };
};
var e = String.prototype.charCodeAt;
return i.fromHash = function(n) {
return n === t ? r : new i(
(e.call(n, 0) | e.call(n, 1) << 8 | e.call(n, 2) << 16 | e.call(n, 3) << 24) >>> 0,
(e.call(n, 4) | e.call(n, 5) << 8 | e.call(n, 6) << 16 | e.call(n, 7) << 24) >>> 0
);
}, i.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
);
}, i.prototype.zzEncode = function() {
var n = this.hi >> 31;
return this.hi = ((this.hi << 1 | this.lo >>> 31) ^ n) >>> 0, this.lo = (this.lo << 1 ^ n) >>> 0, this;
}, i.prototype.zzDecode = function() {
var n = -(this.lo & 1);
return this.lo = ((this.lo >>> 1 | this.hi << 31) ^ n) >>> 0, this.hi = (this.hi >>> 1 ^ n) >>> 0, this;
}, i.prototype.length = function() {
var n = this.lo, o = (this.lo >>> 28 | this.hi << 4) >>> 0, d = this.hi >>> 24;
return d === 0 ? o === 0 ? n < 16384 ? n < 128 ? 1 : 2 : n < 2097152 ? 3 : 4 : o < 16384 ? o < 128 ? 5 : 6 : o < 2097152 ? 7 : 8 : d < 128 ? 9 : 10;
}, Ot;
}
var Ar;
function be() {
return Ar || (Ar = 1, function(c) {
var i = c;
i.asPromise = qo, i.base64 = Rr, i.EventEmitter = Qo, i.float = ei, i.inquire = ti, i.utf8 = Lr, i.pool = ni, i.LongBits = ii(), i.isNode = !!(typeof me < "u" && me && me.process && me.process.versions && me.process.versions.node), i.global = i.isNode && me || typeof window < "u" && window || typeof self < "u" && self || me, i.emptyArray = Object.freeze ? Object.freeze([]) : (
/* istanbul ignore next */
[]
), i.emptyObject = Object.freeze ? Object.freeze({}) : (
/* istanbul ignore next */
{}
), i.isInteger = Number.isInteger || /* istanbul ignore next */
function(e) {
return typeof e == "number" && isFinite(e) && Math.floor(e) === e;
}, i.isString = function(e) {
return typeof e == "string" || e instanceof String;
}, i.isObject = function(e) {
return e && typeof e == "object";
}, i.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`
*/
i.isSet = function(e, n) {
var o = e[n];
return o != null && e.hasOwnProperty(n) ? typeof o != "object" || (Array.isArray(o) ? o.length : Object.keys(o).length) > 0 : !1;
}, i.Buffer = function() {
try {
var e = i.inquire("buffer").Buffer;
return e.prototype.utf8Write ? e : (
/* istanbul ignore next */
null
);
} catch {
return null;
}
}(), i._Buffer_from = null, i._Buffer_allocUnsafe = null, i.newBuffer = function(e) {
return typeof e == "number" ? i.Buffer ? i._Buffer_allocUnsafe(e) : new i.Array(e) : i.Buffer ? i._Buffer_from(e) : typeof Uint8Array > "u" ? e : new Uint8Array(e);
}, i.Array = typeof Uint8Array < "u" ? Uint8Array : Array, i.Long = /* istanbul ignore next */
i.global.dcodeIO && /* istanbul ignore next */
i.global.dcodeIO.Long || /* istanbul ignore next */
i.global.Long || i.inquire("long"), i.key2Re = /^true|false|0|1$/, i.key32Re = /^-?(?:0|[1-9][0-9]*)$/, i.key64Re = /^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/, i.longToHash = function(e) {
return e ? i.LongBits.from(e).toHash() : i.LongBits.zeroHash;
}, i.longFromHash = function(e, n) {
var o = i.LongBits.fromHash(e);
return i.Long ? i.Long.fromBits(o.lo, o.hi, n) : o.toNumber(!!n);
};
function r(e, n, o) {
for (var d = Object.keys(n), f = 0; f < d.length; ++f)
(e[d[f]] === void 0 || !o) && (e[d[f]] = n[d[f]]);
return e;
}
i.merge = r, i.lcFirst = function(e) {
return e.charAt(0).toLowerCase() + e.substring(1);
};
function t(e) {
function n(o, d) {
if (!(this instanceof n))
return new n(o, d);
Object.defineProperty(this, "message", { get: function() {
return o;
} }), Error.captureStackTrace ? Error.captureStackTrace(this, n) : Object.defineProperty(this, "stack", { value: new Error().stack || "" }), d && r(this, d);
}
return n.prototype = Object.create(Error.prototype, {
constructor: {
value: n,
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
}
}), n;
}
i.newError = t, i.ProtocolError = t("ProtocolError"), i.oneOfGetter = function(e) {
for (var n = {}, o = 0; o < e.length; ++o)
n[e[o]] = 1;
return function() {
for (var d = Object.keys(this), f = d.length - 1; f > -1; --f)
if (n[d[f]] === 1 && this[d[f]] !== void 0 && this[d[f]] !== null)
return d[f];
};
}, i.oneOfSetter = function(e) {
return function(n) {
for (var o = 0; o < e.length; ++o)
e[o] !== n && delete this[e[o]];
};
}, i.toJSONOptions = {
longs: String,
enums: String,
bytes: String,
json: !0
}, i._configure = function() {
var e = i.Buffer;
if (!e) {
i._Buffer_from = i._Buffer_allocUnsafe = null;
return;
}
i._Buffer_from = e.from !== Uint8Array.from && e.from || /* istanbul ignore next */
function(n, o) {
return new e(n, o);
}, i._Buffer_allocUnsafe = e.allocUnsafe || /* istanbul ignore next */
function(n) {
return new e(n);
};
};
}(vr)), vr;
}
var xr = F, B = be(), jt, at = B.LongBits, Dr = B.base64, Tr = B.utf8;
function Ee(c, i, r) {
this.fn = c, this.len = i, this.next = void 0, this.val = r;
}
function At() {
}
function ai(c) {
this.head = c.head, this.tail = c.tail, this.len = c.len, this.next = c.states;
}
function F() {
this.len = 0, this.head = new Ee(At, 0, 0), this.tail = this.head, this.states = null;
}
var Nr = function() {
return B.Buffer ? function() {
return (F.create = function() {
return new jt();
})();
} : function() {
return new F();
};
};
F.create = Nr();
F.alloc = function(c) {
return new B.Array(c);
};
B.Array !== Array && (F.alloc = B.pool(F.alloc, B.Array.prototype.subarray));
F.prototype._push = function(c, i, r) {
return this.tail = this.tail.next = new Ee(c, i, r), this.len += i, this;
};
function Dt(c, i, r) {
i[r] = c & 255;
}
function si(c, i, r) {
for (; c > 127; )
i[r++] = c & 127 | 128, c >>>= 7;
i[r] = c;
}
function Tt(c, i) {
this.len = c, this.next = void 0, this.val = i;
}
Tt.prototype = Object.create(Ee.prototype);
Tt.prototype.fn = si;
F.prototype.uint32 = function(c) {
return this.len += (this.tail = this.tail.next = new Tt(
(c = c >>> 0) < 128 ? 1 : c < 16384 ? 2 : c < 2097152 ? 3 : c < 268435456 ? 4 : 5,
c
)).len, this;
};
F.prototype.int32 = function(c) {
return c < 0 ? this._push(kt, 10, at.fromNumber(c)) : this.uint32(c);
};
F.prototype.sint32 = function(c) {
return this.uint32((c << 1 ^ c >> 31) >>> 0);
};
function kt(c, i, r) {
for (; c.hi; )
i[r++] = c.lo & 127 | 128, c.lo = (c.lo >>> 7 | c.hi << 25) >>> 0, c.hi >>>= 7;
for (; c.lo > 127; )
i[r++] = c.lo & 127 | 128, c.lo = c.lo >>> 7;
i[r++] = c.lo;
}
F.prototype.uint64 = function(c) {
var i = at.from(c);
return this._push(kt, i.length(), i);
};
F.prototype.int64 = F.prototype.uint64;
F.prototype.sint64 = function(c) {
var i = at.from(c).zzEncode();
return this._push(kt, i.length(), i);
};
F.prototype.bool = function(c) {
return this._push(Dt, 1, c ? 1 : 0);
};
function It(c, i, r) {
i[r] = c & 255, i[r + 1] = c >>> 8 & 255, i[r + 2] = c >>> 16 & 255, i[r + 3] = c >>> 24;
}
F.prototype.fixed32 = function(c) {
return this._push(It, 4, c >>> 0);
};
F.prototype.sfixed32 = F.prototype.fixed32;
F.prototype.fixed64 = function(c) {
var i = at.from(c);
return this._push(It, 4, i.lo)._push(It, 4, i.hi);
};
F.prototype.sfixed64 = F.prototype.fixed64;
F.prototype.float = function(c) {
return this._push(B.float.writeFloatLE, 4, c);
};
F.prototype.double = function(c) {
return this._push(B.float.writeDoubleLE, 8, c);
};
var li = B.Array.prototype.set ? function(c, i, r) {
i.set(c, r);
} : function(c, i, r) {
for (var t = 0; t < c.length; ++t)
i[r + t] = c[t];
};
F.prototype.bytes = function(c) {
var i = c.length >>> 0;
if (!i)
return this._push(Dt, 1, 0);
if (B.isString(c)) {
var r = F.alloc(i = Dr.length(c));
Dr.decode(c, r, 0), c = r;
}
return this.uint32(i)._push(li, i, c);
};
F.prototype.string = function(c) {
var i = Tr.length(c);
return i ? this.uint32(i)._push(Tr.write, i, c) : this._push(Dt, 1, 0);
};
F.prototype.fork = function() {
return this.states = new ai(this), this.head = this.tail = new Ee(At, 0, 0), this.len = 0, this;
};
F.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 Ee(At, 0, 0), this.len = 0), this;
};
F.prototype.ldelim = function() {
var c = this.head, i = this.tail, r = this.len;
return this.reset().uint32(r), r && (this.tail.next = c.next, this.tail = i, this.len += r), this;
};
F.prototype.finish = function() {
for (var c = this.head.next, i = this.constructor.alloc(this.len), r = 0; c; )
c.fn(c.val, i, r), r += c.len, c = c.next;
return i;
};
F._configure = function(c) {
jt = c, F.create = Nr(), jt._configure();
};
var ci = K, Wr = xr;
(K.prototype = Object.create(Wr.prototype)).constructor = K;
var le = be();
function K() {
Wr.call(this);
}
K._configure = function() {
K.alloc = le._Buffer_allocUnsafe, K.writeBytesBuffer = le.Buffer && le.Buffer.prototype instanceof Uint8Array && le.Buffer.prototype.set.name === "set" ? function(c, i, r) {
i.set(c, r);
} : function(c, i, r) {
if (c.copy)
c.copy(i, r, 0, c.length);
else
for (var t = 0; t < c.length; )
i[r++] = c[t++];
};
};
K.prototype.bytes = function(c) {
le.isString(c) && (c = le._Buffer_from(c, "base64"));
var i = c.length >>> 0;
return this.uint32(i), i && this._push(K.writeBytesBuffer, i, c), this;
};
function di(c, i, r) {
c.length < 40 ? le.utf8.write(c, i, r) : i.utf8Write ? i.utf8Write(c, r) : i.write(c, r);
}
K.prototype.string = function(c) {
var i = le.Buffer.byteLength(c);
return this.uint32(i), i && this._push(di, i, c), this;
};
K._configure();
var zr = L, q = be(), St, Ur = q.LongBits, ui = q.utf8;
function V(c, i) {
return RangeError("index out of range: " + c.pos + " + " + (i || 1) + " > " + c.len);
}
function L(c) {
this.buf = c, this.pos = 0, this.len = c.length;
}
var kr = typeof Uint8Array < "u" ? function(c) {
if (c instanceof Uint8Array || Array.isArray(c))
return new L(c);
throw Error("illegal buffer");
} : function(c) {
if (Array.isArray(c))
return new L(c);
throw Error("illegal buffer");
}, $r = function() {
return q.Buffer ? function(c) {
return (L.create = function(i) {
return q.Buffer.isBuffer(i) ? new St(i) : kr(i);
})(c);
} : kr;
};
L.create = $r();
L.prototype._slice = q.Array.prototype.subarray || /* istanbul ignore next */
q.Array.prototype.slice;
L.prototype.uint32 = /* @__PURE__ */ function() {
var c = 4294967295;
return function() {
if (c = (this.buf[this.pos] & 127) >>> 0, this.buf[this.pos++] < 128 || (c = (c | (this.buf[this.pos] & 127) << 7) >>> 0, this.buf[this.pos++] < 128) || (c = (c | (this.buf[this.pos] & 127) << 14) >>> 0, this.buf[this.pos++] < 128) || (c = (c | (this.buf[this.pos] & 127) << 21) >>> 0, this.buf[this.pos++] < 128) || (c = (c | (this.buf[this.pos] & 15) << 28) >>> 0, this.buf[this.pos++] < 128))
return c;
if ((this.pos += 5) > this.len)
throw this.pos = this.len, V(this, 10);
return c;
};
}();
L.prototype.int32 = function() {
return this.uint32() | 0;
};
L.prototype.sint32 = function() {
var c = this.uint32();
return c >>> 1 ^ -(c & 1) | 0;
};
function wt() {
var c = new Ur(0, 0), i = 0;
if (this.len - this.pos > 4) {
for (; i < 4; ++i)
if (c.lo = (c.lo | (this.buf[this.pos] & 127) << i * 7) >>> 0, this.buf[this.pos++] < 128)
return c;
if (c.lo = (c.lo | (this.buf[this.pos] & 127) << 28) >>> 0, c.hi = (c.hi | (this.buf[this.pos] & 127) >> 4) >>> 0, this.buf[this.pos++] < 128)
return c;
i = 0;
} else {
for (; i < 3; ++i) {
if (this.pos >= this.len)
throw V(this);
if (c.lo = (c.lo | (this.buf[this.pos] & 127) << i * 7) >>> 0, this.buf[this.pos++] < 128)
return c;
}
return c.lo = (c.lo | (this.buf[this.pos++] & 127) << i * 7) >>> 0, c;
}
if (this.len - this.pos > 4) {
for (; i < 5; ++i)
if (c.hi = (c.hi | (this.buf[this.pos] & 127) << i * 7 + 3) >>> 0, this.buf[this.pos++] < 128)
return c;
} else
for (; i < 5; ++i) {
if (this.pos >= this.len)
throw V(this);
if (c.hi = (c.hi | (this.buf[this.pos] & 127) << i * 7 + 3) >>> 0, this.buf[this.pos++] < 128)
return c;
}
throw Error("invalid varint encoding");
}
L.prototype.bool = function() {
return this.uint32() !== 0;
};
function tt(c, i) {
return (c[i - 4] | c[i - 3] << 8 | c[i - 2] << 16 | c[i - 1] << 24) >>> 0;
}
L.prototype.fixed32 = function() {
if (this.pos + 4 > this.len)
throw V(this, 4);
return tt(this.buf, this.pos += 4);
};
L.prototype.sfixed32 = function() {
if (this.pos + 4 > this.len)
throw V(this, 4);
return tt(this.buf, this.pos += 4) | 0;
};
function Er() {
if (this.pos + 8 > this.len)
throw V(this, 8);
return new Ur(tt(this.buf, this.pos += 4), tt(this.buf, this.pos += 4));
}
L.prototype.float = function() {
if (this.pos + 4 > this.len)
throw V(this, 4);
var c = q.float.readFloatLE(this.buf, this.pos);
return this.pos += 4, c;
};
L.prototype.double = function() {
if (this.pos + 8 > this.len)
throw V(this, 4);
var c = q.float.readDoubleLE(this.buf, this.pos);
return this.pos += 8, c;
};
L.prototype.bytes = function() {
var c = this.uint32(), i = this.pos, r = this.pos + c;
if (r > this.len)
throw V(this, c);
return this.pos += c, Array.isArray(this.buf) ? this.buf.slice(i, r) : i === r ? new this.buf.constructor(0) : this._slice.call(this.buf, i, r);
};
L.prototype.string = function() {
var c = this.bytes();
return ui.read(c, 0, c.length);
};
L.prototype.skip = function(c) {
if (typeof c == "number") {
if (this.pos + c > this.len)
throw V(this, c);
this.pos += c;
} else
do
if (this.pos >= this.len)
throw V(this);
while (this.buf[this.pos++] & 128);
return this;
};
L.prototype.skipType = function(c) {
switch (c) {
case 0:
this.skip();
break;
case 1:
this.skip(8);
break;
case 2:
this.skip(this.uint32());
break;
case 3:
for (; (c = this.uint32() & 7) !== 4; )
this.skipType(c);
break;
case 5:
this.skip(4);
break;
default:
throw Error("invalid wire type " + c + " at offset " + this.pos);
}
return this;
};
L._configure = function(c) {
St = c, L.create = $r(), St._configure();
var i = q.Long ? "toLong" : (
/* istanbul ignore next */
"toNumber"
);
q.merge(L.prototype, {
int64: function() {
return wt.call(this)[i](!1);
},
uint64: function() {
return wt.call(this)[i](!0);
},
sint64: function() {
return wt.call(this).zzDecode()[i](!1);
},
fixed64: function() {
return Er.call(this)[i](!0);
},
sfixed64: function() {
return Er.call(this)[i](!1);
}
});
};
var pi = ye, Gr = zr;
(ye.prototype = Object.create(Gr.prototype)).constructor = ye;
var Fr = be();
function ye(c) {
Gr.call(this, c);
}
ye._configure = function() {
Fr.Buffer && (ye.prototype._slice = Fr.Buffer.prototype.slice);
};
ye.prototype.string = function() {
var c = this.uint32();
return this.buf.utf8Slice ? this.buf.utf8Slice(this.pos, this.pos = Math.min(this.pos + c, this.len)) : this.buf.toString("utf-8", this.pos, this.pos = Math.min(this.pos + c, this.len));
};
ye._configure();
var Br = {}, fi = ke, Et = be();
(ke.prototype = Object.create(Et.EventEmitter.prototype)).constructor = ke;
function ke(c, i, r) {
if (typeof c != "function")
throw TypeError("rpcImpl must be a function");
Et.EventEmitter.call(this), this.rpcImpl = c, this.requestDelimited = !!i, this.responseDelimited = !!r;
}
ke.prototype.rpcCall = function c(i, r, t, e, n) {
if (!e)
throw TypeError("request must be specified");
var o = this;
if (!n)
return Et.asPromise(c, o, i, r, t, e);
if (!o.rpcImpl) {
setTimeout(function() {
n(Error("already ended"));
}, 0);
return;
}
try {
return o.rpcImpl(
i,
r[o.requestDelimited ? "encodeDelimited" : "encode"](e).finish(),
function(d, f) {
if (d)
return o.emit("error", d, i), n(d);
if (f === null) {
o.end(
/* endedByRPC */
!0
);
return;
}
if (!(f instanceof t))
try {
f = t[o.responseDelimited ? "decodeDelimited" : "decode"](f);
} catch (y) {
return o.emit("error", y, i), n(y);
}
return o.emit("data", f, i), n(null, f);
}
);
} catch (d) {
o.emit("error", d, i), setTimeout(function() {
n(d);
}, 0);
return;
}
};
ke.prototype.end = function(c) {
return this.rpcImpl && (c || this.rpcImpl(null, null, null), this.rpcImpl = null, this.emit("end").off()), this;
};
(function(c) {
var i = c;
i.Service = fi;
})(Br);
var mi = {};
(function(c) {
var i = c;
i.build = "minimal", i.Writer = xr, i.BufferWriter = ci, i.Reader = zr, i.BufferReader = pi, i.util = be(), i.rpc = Br, i.roots = mi, i.configure = r;
function r() {
i.util._configure(), i.Writer._configure(i.BufferWriter), i.Reader._configure(i.BufferReader);
}
r();
})(Mr);
var T = Mr;
const h = T.Reader, E = T.Writer, p = T.util, a = T.roots.default || (T.roots.default = {});
a.dot = (() => {
const c = {};
return c.Content = function() {
function i(r) {
if (r)
for (let t = Object.keys(r), e = 0; e < t.length; ++e)
r[t[e]] != null && (this[t[e]] = r[t[e]]);
}
return i.prototype.token = p.newBuffer([]), i.prototype.iv = p.newBuffer([]), i.prototype.schemaVersion = 0, i.prototype.bytes = p.newBuffer([]), i.create = function(r) {
return new i(r);
}, i.encode = function(r, t) {
return t || (t = E.create()), r.token != null && Object.hasOwnProperty.call(r, "token") && t.uint32(
/* id 1, wireType 2 =*/
10
).bytes(r.token), r.iv != null && Object.hasOwnProperty.call(r, "iv") && t.uint32(
/* id 2, wireType 2 =*/
18
).bytes(r.iv), r.schemaVersion != null && Object.hasOwnProperty.call(r, "schemaVersion") && t.uint32(
/* id 3, wireType 0 =*/
24
).int32(r.schemaVersion), r.bytes != null && Object.hasOwnProperty.call(r, "bytes") && t.uint32(
/* id 4, wireType 2 =*/
34
).bytes(r.bytes), t;
}, i.encodeDelimited = function(r, t) {
return this.encode(r, t).ldelim();
}, i.decode = function(r, t) {
r instanceof h || (r = h.create(r));
let e = t === void 0 ? r.len : r.pos + t, n = new a.dot.Content();
for (; r.pos < e; ) {
let o = r.uint32();
switch (o >>> 3) {
case 1: {
n.token = r.bytes();
break;
}
case 2: {
n.iv = r.bytes();
break;
}
case 3: {
n.schemaVersion = r.int32();
break;
}
case 4: {
n.bytes = r.bytes();
break;
}
default:
r.skipType(o & 7);
break;
}
}
return n;
}, i.decodeDelimited = function(r) {
return r instanceof h || (r = new h(r)), this.decode(r, r.uint32());
}, i.verify = function(r) {
return typeof r != "object" || r === null ? "object expected" : r.token != null && r.hasOwnProperty("token") && !(r.token && typeof r.token.length == "number" || p.isString(r.token)) ? "token: buffer expected" : r.iv != null && r.hasOwnProperty("iv") && !(r.iv && typeof r.iv.length == "number" || p.isString(r.iv)) ? "iv: buffer expected" : r.schemaVersion != null && r.hasOwnProperty("schemaVersion") && !p.isInteger(r.schemaVersion) ? "schemaVersion: integer expected" : r.bytes != null && r.hasOwnProperty("bytes") && !(r.bytes && typeof r.bytes.length == "number" || p.isString(r.bytes)) ? "bytes: buffer expected" : null;
}, i.fromObject = function(r) {
if (r instanceof a.dot.Content)
return r;
let t = new a.dot.Content();
return r.token != null && (typeof r.token == "string" ? p.base64.decode(r.token, t.token = p.newBuffer(p.base64.length(r.token)), 0) : r.token.length >= 0 && (t.token = r.token)), r.iv != null && (typeof r.iv == "string" ? p.base64.decode(r.iv, t.iv = p.newBuffer(p.base64.length(r.iv)), 0) : r.iv.length >= 0 && (t.iv = r.iv)), r.schemaVersion != null && (t.schemaVersion = r.schemaVersion | 0), r.bytes != null && (typeof r.bytes == "string" ? p.base64.decode(r.bytes, t.bytes = p.newBuffer(p.base64.length(r.bytes)), 0) : r.bytes.length >= 0 && (t.bytes = r.bytes)), t;
}, i.toObject = function(r, t) {
t || (t = {});
let e = {};
return t.defaults && (t.bytes === String ? e.token = "" : (e.token = [], t.bytes !== Array && (e.token = p.newBuffer(e.token))), t.bytes === String ? e.iv = "" : (e.iv = [], t.bytes !== Array && (e.iv = p.newBuffer(e.iv))), e.schemaVersion = 0, t.bytes === String ? e.bytes = "" : (e.bytes = [], t.bytes !== Array && (e.bytes = p.newBuffer(e.bytes)))), r.token != null && r.hasOwnProperty("token") && (e.token = t.bytes === String ? p.base64.encode(r.token, 0, r.token.length) : t.bytes === Array ? Array.prototype.slice.call(r.token) : r.token), r.iv != null && r.hasOwnProperty("iv") && (e.iv = t.bytes === String ? p.base64.encode(r.iv, 0, r.iv.length) : t.bytes === Array ? Array.prototype.slice.call(r.iv) : r.iv), r.schemaVersion != null && r.hasOwnProperty("schemaVersion") && (e.schemaVersion = r.schemaVersion), r.bytes != null && r.hasOwnProperty("bytes") && (e.bytes = t.bytes === String ? p.base64.encode(r.bytes, 0, r.bytes.length) : t.bytes === Array ? Array.prototype.slice.call(r.bytes) : r.bytes), e;
}, i.prototype.toJSON = function() {
return this.constructor.toObject(this, T.util.toJSONOptions);
}, i.getTypeUrl = function(r) {
return r === void 0 && (r = "type.googleapis.com"), r + "/dot.Content";
}, i;
}(), c.v4 = function() {
const i = {};
return i.MagnifEyeLivenessContent = function() {
function r(t) {
if (this.images = [], t)
for (let e = Object.keys(t), n = 0; n < e.length; ++n)
t[e[n]] != null && (this[e[n]] = t[e[n]]);
}
return r.prototype.images = p.emptyArray, r.prototype.metadata = null, r.create = function(t) {
return new r(t);
}, r.encode = function(t, e) {
if (e || (e = E.create()), t.images != null && t.images.length)
for (let n = 0; n < t.images.length; ++n)
a.dot.Image.encode(t.images[n], e.uint32(
/* id 1, wireType 2 =*/
10
).fork()).ldelim();
return t.metadata != null && Object.hasOwnProperty.call(t, "metadata") && a.dot.v4.Metadata.encode(t.metadata, e.uint32(
/* id 2, wireType 2 =*/
18
).fork()).ldelim(), e;
}, r.encodeDelimited = function(t, e) {
return this.encode(t, e).ldelim();
}, r.decode = function(t, e) {
t instanceof h || (t = h.create(t));
let n = e === void 0 ? t.len : t.pos + e, o = new a.dot.v4.MagnifEyeLivenessContent();
for (; t.pos < n; ) {
let d = t.uint32();
switch (d >>> 3) {
case 1: {
o.images && o.images.length || (o.images = []), o.images.push(a.dot.Image.decode(t, t.uint32()));
break;
}
case 2: {
o.metadata = a.dot.v4.Metadata.decode(t, t.uint32());
break;
}
default:
t.skipType(d & 7);
break;
}
}
return o;
}, r.decodeDelimited = function(t) {
return t instanceof h || (t = new h(t)), this.decode(t, t.uint32());
}, r.verify = function(t) {
if (typeof t != "object" || t === null)
return "object expected";
if (t.images != null && t.hasOwnProperty("images")) {
if (!Array.isArray(t.images))
return "images: array expected";
for (let e = 0; e < t.images.length; ++e) {
let n = a.dot.Image.verify(t.images[e]);
if (n)
return "images." + n;
}
}
if (t.metadata != null && t.hasOwnProperty("metadata")) {
let e = a.dot.v4.Metadata.verify(t.metadata);
if (e)
return "metadata." + e;
}
return null;
}, r.fromObject = function(t) {
if (t instanceof a.dot.v4.MagnifEyeLivenessContent)
return t;
let e = new a.dot.v4.MagnifEyeLivenessContent();
if (t.images) {
if (!Array.isArray(t.images))
throw TypeError(".dot.v4.MagnifEyeLivenessContent.images: array expected");
e.images = [];
for (let n = 0; n < t.images.length; ++n) {
if (typeof t.images[n] != "object")
throw TypeError(".dot.v4.MagnifEyeLivenessContent.images: object expected");
e.images[n] = a.dot.Image.fromObject(t.images[n]);
}
}
if (t.metadata != null) {
if (typeof t.metadata != "object")
throw TypeError(".dot.v4.MagnifEyeLivenessContent.metadata: object expected");
e.metadata = a.dot.v4.Metadata.fromObject(t.metadata);
}
return e;
}, r.toObject = function(t, e) {
e || (e = {});
let n = {};
if ((e.arrays || e.defaults) && (n.images = []), e.defaults && (n.metadata = null), t.images && t.images.length) {
n.images = [];
for (let o = 0; o < t.images.length; ++o)
n.images[o] = a.dot.Image.toObject(t.images[o], e);
}
return t.metadata != null && t.hasOwnProperty("metadata") && (n.metadata = a.dot.v4.Metadata.toObject(t.metadata, e)), n;
}, r.prototype.toJSON = function() {
return this.constructor.toObject(this, T.util.toJSONOptions);
}, r.getTypeUrl = function(t) {
return t === void 0 && (t = "type.googleapis.com"), t + "/dot.v4.MagnifEyeLivenessContent";
}, r;
}(), i.Metadata = function() {
function r(e) {
if (e)
for (let n = Object.keys(e), o = 0; o < n.length; ++o)
e[n[o]] != null && (this[n[o]] = e[n[o]]);
}
r.prototype.platform = 0, r.prototype.sessionToken = null, r.prototype.componentVersion = "", r.prototype.web = null, r.prototype.android = null, r.prototype.ios = null;
let t;
return Object.defineProperty(r.prototype, "_sessionToken", {
get: p.oneOfGetter(t = ["sessionToken"]),
set: p.oneOfSetter(t)
}), Object.defineProperty(r.prototype, "metadata", {
get: p.oneOfGetter(t = ["web", "android", "ios"]),
set: p.oneOfSetter(t)
}), r.create = function(e) {
return new r(e);
}, r.encode = function(e, n) {
return n || (n = E.create()), e.platform != null && Object.hasOwnProperty.call(e, "platform") && n.uint32(
/* id 1, wireType 0 =*/
8
).int32(e.platform), e.web != null && Object.hasOwnProperty.call(e, "web") && a.dot.v4.WebMetadata.encode(e.web, n.uint32(
/* id 2, wireType 2 =*/
18
).fork()).ldelim(), e.android != null && Object.hasOwnProperty.call(e, "android") && a.dot.v4.AndroidMetadata.encode(e.android, n.uint32(
/* id 3, wireType 2 =*/
26
).fork()).ldelim(), e.ios != null && Object.hasOwnProperty.call(e, "ios") && a.dot.v4.IosMetadata.encode(e.ios, n.uint32(
/* id 4, wireType 2 =*/
34
).fork()).ldelim(), e.sessionToken != null && Object.hasOwnProperty.call(e, "sessionToken") && n.uint32(
/* id 5, wireType 2 =*/
42
).string(e.sessionToken), e.componentVersion != null && Object.hasOwnProperty.call(e, "componentVersion") && n.uint32(
/* id 6, wireType 2 =*/
50
).string(e.componentVersion), n;
}, r.encodeDelimited = function(e, n) {
return this.encode(e, n).ldelim();
}, r.decode = function(e, n) {
e instanceof h || (e = h.create(e));
let o = n === void 0 ? e.len : e.pos + n, d = new a.dot.v4.Metadata();
for (; e.pos < o; ) {
let f = e.uint32();
switch (f >>> 3) {
case 1: {
d.platform = e.int32();
break;
}
case 5: {
d.sessionToken = e.string();
break;
}
case 6: {
d.componentVersion = e.string();
break;
}
case 2: {
d.web = a.dot.v4.WebMetadata.decode(e, e.uint32());
break;
}
case 3: {
d.android = a.dot.v4.AndroidMetadata.decode(e, e.uint32());
break;
}
case 4: {
d.ios = a.dot.v4.IosMetadata.decode(e, e.uint32());
break;
}
default:
e.skipType(f & 7);
break;
}
}
return d;
}, r.decodeDelimited = function(e) {
return e instanceof h || (e = new h(e)), this.decode(e, e.uint32());
}, r.verify = function(e) {
if (typeof e != "object" || e === null)
return "object expected";
let n = {};
if (e.platform != null && e.hasOwnProperty("platform"))
switch (e.platform) {
default:
return "platform: enum value expected";
case 0:
case 1:
case 2:
break;
}
if (e.sessionToken != null && e.hasOwnProperty("sessionToken") && (n._sessionToken = 1, !p.isString(e.sessionToken)))
return "sessionToken: string expected";
if (e.componentVersion != null && e.hasOwnProperty("componentVersion") && !p.isString(e.componentVersion))
return "componentVersion: string expected";
if (e.web != null && e.hasOwnProperty("web")) {
n.metadata = 1;
{
let o = a.dot.v4.WebMetadata.verify(e.web);
if (o)
return "web." + o;
}
}
if (e.android != null && e.hasOwnProperty("android")) {
if (n.metadata === 1)
return "metadata: multiple values";
n.metadata = 1;
{
let o = a.dot.v4.AndroidMetadata.verify(e.android);
if (o)
return "android." + o;
}
}
if (e.ios != null && e.hasOwnProperty("ios")) {
if (n.metadata === 1)
return "metadata: multiple values";
n.metadata = 1;
{
let o = a.dot.v4.IosMetadata.verify(e.ios);
if (o)
return "ios." + o;
}
}
return null;
}, r.fromObject = function(e) {
if (e instanceof a.dot.v4.Metadata)
return e;
let n = new a.dot.v4.Metadata();
switch (e.platform) {
default:
if (typeof e.platform == "number") {
n.platform = e.platform;
break;
}
break;
case "WEB":
case 0:
n.platform = 0;
break;
case "ANDROID":
case 1:
n.platform = 1;
break;
case "IOS":
case 2:
n.platform = 2;
break;
}
if (e.sessionToken != null && (n.sessionToken = String(e.sessionToken)), e.componentVersion != null && (n.componentVersion = String(e.componentVersion)), e.web != null) {
if (typeof e.web != "object")
throw TypeEr