@innovatrics/dot-face-auto-capture
Version:
Digital onboarding selfie capture
1,433 lines • 295 kB
JavaScript
var Wo = Object.defineProperty;
var mr = (c) => {
throw TypeError(c);
};
var zo = (c, i, r) => i in c ? Wo(c, i, { enumerable: !0, configurable: !0, writable: !0, value: r }) : c[i] = r;
var Ke = (c, i, r) => zo(c, typeof i != "symbol" ? i + "" : i, r), hr = (c, i, r) => i.has(c) || mr("Cannot " + r);
var Z = (c, i, r) => (hr(c, i, "read from private field"), r ? r.call(c) : i.get(c)), Ze = (c, i, r) => i.has(c) ? mr("Cannot add the same private member more than once") : i instanceof WeakSet ? i.add(c) : i.set(c, r), qe = (c, i, r, t) => (hr(c, i, "write to private field"), t ? t.call(c, r) : i.set(c, r), r);
/**
* @license
* Copyright 2019 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
const Fr = Symbol("Comlink.proxy"), Uo = Symbol("Comlink.endpoint"), $o = Symbol("Comlink.releaseProxy"), gt = Symbol("Comlink.finalizer"), Qe = Symbol("Comlink.thrown"), _r = (c) => typeof c == "object" && c !== null || typeof c == "function", Go = {
canHandle: (c) => _r(c) && c[Fr],
serialize(c) {
const { port1: i, port2: r } = new MessageChannel();
return St(c, i), [r, [r]];
},
deserialize(c) {
return c.start(), Jo(c);
}
}, Bo = {
canHandle: (c) => _r(c) && Qe in c,
serialize({ value: c }) {
let i;
return c instanceof Error ? i = {
isError: !0,
value: {
message: c.message,
name: c.name,
stack: c.stack
}
} : i = { isError: !1, value: c }, [i, []];
},
deserialize(c) {
throw c.isError ? Object.assign(new Error(c.value.message), c.value) : c.value;
}
}, Mr = /* @__PURE__ */ new Map([
["proxy", Go],
["throw", Bo]
]);
function Ho(c, i) {
for (const r of c)
if (i === r || r === "*" || r instanceof RegExp && r.test(i))
return !0;
return !1;
}
function St(c, i = globalThis, r = ["*"]) {
i.addEventListener("message", function t(e) {
if (!e || !e.data)
return;
if (!Ho(r, e.origin)) {
console.warn(`Invalid origin '${e.origin}' for comlink proxy`);
return;
}
const { id: n, type: o, path: d } = Object.assign({ path: [] }, e.data), f = (e.data.argumentList || []).map(he);
let y;
try {
const O = d.slice(0, -1).reduce((T, _) => T[_], c), j = d.reduce((T, _) => T[_], c);
switch (o) {
case "GET":
y = j;
break;
case "SET":
O[d.slice(-1)[0]] = he(e.data.value), y = !0;
break;
case "APPLY":
y = j.apply(O, f);
break;
case "CONSTRUCT":
{
const T = new j(...f);
y = Xo(T);
}
break;
case "ENDPOINT":
{
const { port1: T, port2: _ } = new MessageChannel();
St(c, _), y = qo(T, [T]);
}
break;
case "RELEASE":
y = void 0;
break;
default:
return;
}
} catch (O) {
y = { value: O, [Qe]: 0 };
}
Promise.resolve(y).catch((O) => ({ value: O, [Qe]: 0 })).then((O) => {
const [j, T] = rt(O);
i.postMessage(Object.assign(Object.assign({}, j), { id: n }), T), o === "RELEASE" && (i.removeEventListener("message", t), Rr(i), gt in c && typeof c[gt] == "function" && c[gt]());
}).catch((O) => {
const [j, T] = rt({
value: new TypeError("Unserializable return value"),
[Qe]: 0
});
i.postMessage(Object.assign(Object.assign({}, j), { id: n }), T);
});
}), i.start && i.start();
}
function Vo(c) {
return c.constructor.name === "MessagePort";
}
function Rr(c) {
Vo(c) && c.close();
}
function Jo(c, i) {
return wt(c, [], i);
}
function Xe(c) {
if (c)
throw new Error("Proxy has been released and is not useable");
}
function Lr(c) {
return Pe(c, {
type: "RELEASE"
}).then(() => {
Rr(c);
});
}
const et = /* @__PURE__ */ new WeakMap(), tt = "FinalizationRegistry" in globalThis && new FinalizationRegistry((c) => {
const i = (et.get(c) || 0) - 1;
et.set(c, i), i === 0 && Lr(c);
});
function Yo(c, i) {
const r = (et.get(i) || 0) + 1;
et.set(i, r), tt && tt.register(c, i, c);
}
function Ko(c) {
tt && tt.unregister(c);
}
function wt(c, i = [], r = function() {
}) {
let t = !1;
const e = new Proxy(r, {
get(n, o) {
if (Xe(t), o === $o)
return () => {
Ko(e), Lr(c), t = !0;
};
if (o === "then") {
if (i.length === 0)
return { then: () => e };
const d = Pe(c, {
type: "GET",
path: i.map((f) => f.toString())
}).then(he);
return d.then.bind(d);
}
return wt(c, [...i, o]);
},
set(n, o, d) {
Xe(t);
const [f, y] = rt(d);
return Pe(c, {
type: "SET",
path: [...i, o].map((O) => O.toString()),
value: f
}, y).then(he);
},
apply(n, o, d) {
Xe(t);
const f = i[i.length - 1];
if (f === Uo)
return Pe(c, {
type: "ENDPOINT"
}).then(he);
if (f === "bind")
return wt(c, i.slice(0, -1));
const [y, O] = yr(d);
return Pe(c, {
type: "APPLY",
path: i.map((j) => j.toString()),
argumentList: y
}, O).then(he);
},
construct(n, o) {
Xe(t);
const [d, f] = yr(o);
return Pe(c, {
type: "CONSTRUCT",
path: i.map((y) => y.toString()),
argumentList: d
}, f).then(he);
}
});
return Yo(e, c), e;
}
function Zo(c) {
return Array.prototype.concat.apply([], c);
}
function yr(c) {
const i = c.map(rt);
return [i.map((r) => r[0]), Zo(i.map((r) => r[1]))];
}
const xr = /* @__PURE__ */ new WeakMap();
function qo(c, i) {
return xr.set(c, i), c;
}
function Xo(c) {
return Object.assign(c, { [Fr]: !0 });
}
function rt(c) {
for (const [i, r] of Mr)
if (r.canHandle(c)) {
const [t, e] = r.serialize(c);
return [
{
type: "HANDLER",
name: i,
value: t
},
e
];
}
return [
{
type: "RAW",
value: c
},
xr.get(c) || []
];
}
function he(c) {
switch (c.type) {
case "HANDLER":
return Mr.get(c.name).deserialize(c.value);
case "RAW":
return c.value;
}
}
function Pe(c, i, r) {
return new Promise((t) => {
const e = Qo();
c.addEventListener("message", function n(o) {
!o.data || !o.data.id || o.data.id !== e || (c.removeEventListener("message", n), t(o.data));
}), c.start && c.start(), c.postMessage(Object.assign({ id: e }, i), r);
});
}
function Qo() {
return new Array(4).fill(0).map(() => Math.floor(Math.random() * Number.MAX_SAFE_INTEGER).toString(16)).join("-");
}
const Te = 1e3, gr = {
simd: "sam_simd.wasm",
sam: "sam.wasm"
}, ei = 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 B extends Error {
constructor(r, t) {
super(r);
Ke(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 B)
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 B(t, r);
}
static fromError(r) {
if (this.logError(r), r instanceof B)
return r;
const t = "An unexpected error has occurred";
return new B(t);
}
}
const ti = {
RGB: "RGB",
RGBA: "RGBA"
};
var ae, ye, je;
class ri {
constructor(i, r) {
Ze(this, ae);
Ze(this, ye);
Ze(this, je);
qe(this, ae, i), qe(this, ye, this.allocate(r.length * r.BYTES_PER_ELEMENT)), qe(this, je, this.allocate(r.length * r.BYTES_PER_ELEMENT));
}
get rgbaImagePointer() {
return Z(this, ye);
}
get bgr0ImagePointer() {
return Z(this, je);
}
allocate(i) {
return Z(this, ae)._malloc(i);
}
free() {
Z(this, ae)._free(Z(this, ye)), Z(this, ae)._free(Z(this, je));
}
writeDataToMemory(i) {
Z(this, ae).HEAPU8.set(i, Z(this, ye));
}
}
ae = new WeakMap(), ye = new WeakMap(), je = new WeakMap();
class ni {
constructor() {
Ke(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 B(
`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 B(
`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 B)
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 ei() ? gr.simd : gr.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 B("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 B("SAM WASM module is not initialized");
const r = new ri(this.samWasmModule, i);
return r.writeDataToMemory(i), r;
}
convertToSamColorImage(i, r) {
if (!this.samWasmModule)
throw new B("SAM WASM module is not initialized");
const t = this.writeImageToMemory(i);
return this.samWasmModule.convertToSamColorImage(
r.width,
r.height,
t.rgbaImagePointer,
ti.RGBA,
t.bgr0ImagePointer
), t;
}
}
const oi = (c) => Number.parseFloat(c.toFixed(3)), ii = (c, i) => Math.min(c, i);
var me = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, Nr = {}, br = {}, ai = si;
function si(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 Wr = {};
(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 = [], j = 0, T = 0, _; d < f; ) {
var $ = o[d++];
switch (T) {
case 0:
O[j++] = r[$ >> 2], _ = ($ & 3) << 4, T = 1;
break;
case 1:
O[j++] = r[_ | $ >> 4], _ = ($ & 15) << 2, T = 2;
break;
case 2:
O[j++] = r[_ | $ >> 6], O[j++] = r[$ & 63], T = 0;
break;
}
j > 8191 && ((y || (y = [])).push(String.fromCharCode.apply(String, O)), j = 0);
}
return T && (O[j++] = r[_], O[j++] = 61, T === 1 && (O[j++] = 61)), y ? (j && y.push(String.fromCharCode.apply(String, O.slice(0, j))), y.join("")) : String.fromCharCode.apply(String, O.slice(0, j));
};
var n = "invalid encoding";
i.decode = function(o, d, f) {
for (var y = f, O = 0, j, T = 0; T < o.length; ) {
var _ = o.charCodeAt(T++);
if (_ === 61 && O > 1)
break;
if ((_ = t[_]) === void 0)
throw Error(n);
switch (O) {
case 0:
j = _, O = 1;
break;
case 1:
d[f++] = j << 2 | (_ & 48) >> 4, j = _, O = 2;
break;
case 2:
d[f++] = (j & 15) << 4 | (_ & 60) >> 2, j = _, O = 3;
break;
case 3:
d[f++] = (j & 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);
};
})(Wr);
var li = ot;
function ot() {
this._listeners = {};
}
ot.prototype.on = function(c, i, r) {
return (this._listeners[c] || (this._listeners[c] = [])).push({
fn: i,
ctx: r || this
}), this;
};
ot.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;
};
ot.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 ci = vr(vr);
function vr(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, Or), c.writeFloatBE = i.bind(null, wr);
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, Pr), c.readFloatBE = r.bind(null, jr);
}(), 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 j = Math.floor(Math.log(o) / Math.LN2);
j === 1024 && (j = 1023), O = o * Math.pow(2, -j), t(O * 4503599627370496 >>> 0, d, f + e), t((y << 31 | j + 1023 << 20 | O * 1048576 & 1048575) >>> 0, d, f + n);
}
}
}
c.writeDoubleLE = i.bind(null, Or, 0, 4), c.writeDoubleBE = i.bind(null, wr, 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, j = y >>> 20 & 2047, T = 4294967296 * (y & 1048575) + f;
return j === 2047 ? T ? NaN : O * (1 / 0) : j === 0 ? O * 5e-324 * T : O * Math.pow(2, j - 1075) * (T + 4503599627370496);
}
c.readDoubleLE = r.bind(null, Pr, 0, 4), c.readDoubleBE = r.bind(null, jr, 4, 0);
}(), c;
}
function Or(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 wr(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 Pr(c, i) {
return (c[i] | c[i + 1] << 8 | c[i + 2] << 16 | c[i + 3] << 24) >>> 0;
}
function jr(c, i) {
return (c[i] << 24 | c[i + 1] << 16 | c[i + 2] << 8 | c[i + 3]) >>> 0;
}
function Ir(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 di = ui;
function ui(c) {
try {
if (typeof Ir != "function")
return null;
var i = Ir(c);
return i && (i.length || Object.keys(i).length) ? i : null;
} catch {
return null;
}
}
var zr = {};
(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;
};
})(zr);
var pi = fi;
function fi(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 bt, Sr;
function mi() {
if (Sr)
return bt;
Sr = 1, bt = 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;
}, bt;
}
var Cr;
function be() {
return Cr || (Cr = 1, function(c) {
var i = c;
i.asPromise = ai, i.base64 = Wr, i.EventEmitter = li, i.float = ci, i.inquire = di, i.utf8 = zr, i.pool = pi, i.LongBits = mi(), 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);
};
};
}(br)), br;
}
var Ur = F, H = be(), Pt, it = H.LongBits, Ar = H.base64, Dr = H.utf8;
function Ee(c, i, r) {
this.fn = c, this.len = i, this.next = void 0, this.val = r;
}
function Ct() {
}
function hi(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(Ct, 0, 0), this.tail = this.head, this.states = null;
}
var $r = function() {
return H.Buffer ? function() {
return (F.create = function() {
return new Pt();
})();
} : function() {
return new F();
};
};
F.create = $r();
F.alloc = function(c) {
return new H.Array(c);
};
H.Array !== Array && (F.alloc = H.pool(F.alloc, H.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 At(c, i, r) {
i[r] = c & 255;
}
function yi(c, i, r) {
for (; c > 127; )
i[r++] = c & 127 | 128, c >>>= 7;
i[r] = c;
}
function Dt(c, i) {
this.len = c, this.next = void 0, this.val = i;
}
Dt.prototype = Object.create(Ee.prototype);
Dt.prototype.fn = yi;
F.prototype.uint32 = function(c) {
return this.len += (this.tail = this.tail.next = new Dt(
(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(Tt, 10, it.fromNumber(c)) : this.uint32(c);
};
F.prototype.sint32 = function(c) {
return this.uint32((c << 1 ^ c >> 31) >>> 0);
};
function Tt(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 = it.from(c);
return this._push(Tt, i.length(), i);
};
F.prototype.int64 = F.prototype.uint64;
F.prototype.sint64 = function(c) {
var i = it.from(c).zzEncode();
return this._push(Tt, i.length(), i);
};
F.prototype.bool = function(c) {
return this._push(At, 1, c ? 1 : 0);
};
function jt(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(jt, 4, c >>> 0);
};
F.prototype.sfixed32 = F.prototype.fixed32;
F.prototype.fixed64 = function(c) {
var i = it.from(c);
return this._push(jt, 4, i.lo)._push(jt, 4, i.hi);
};
F.prototype.sfixed64 = F.prototype.fixed64;
F.prototype.float = function(c) {
return this._push(H.float.writeFloatLE, 4, c);
};
F.prototype.double = function(c) {
return this._push(H.float.writeDoubleLE, 8, c);
};
var gi = H.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(At, 1, 0);
if (H.isString(c)) {
var r = F.alloc(i = Ar.length(c));
Ar.decode(c, r, 0), c = r;
}
return this.uint32(i)._push(gi, i, c);
};
F.prototype.string = function(c) {
var i = Dr.length(c);
return i ? this.uint32(i)._push(Dr.write, i, c) : this._push(At, 1, 0);
};
F.prototype.fork = function() {
return this.states = new hi(this), this.head = this.tail = new Ee(Ct, 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(Ct, 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) {
Pt = c, F.create = $r(), Pt._configure();
};
var bi = q, Gr = Ur;
(q.prototype = Object.create(Gr.prototype)).constructor = q;
var se = be();
function q() {
Gr.call(this);
}
q._configure = function() {
q.alloc = se._Buffer_allocUnsafe, q.writeBytesBuffer = se.Buffer && se.Buffer.prototype instanceof Uint8Array && se.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++];
};
};
q.prototype.bytes = function(c) {
se.isString(c) && (c = se._Buffer_from(c, "base64"));
var i = c.length >>> 0;
return this.uint32(i), i && this._push(q.writeBytesBuffer, i, c), this;
};
function vi(c, i, r) {
c.length < 40 ? se.utf8.write(c, i, r) : i.utf8Write ? i.utf8Write(c, r) : i.write(c, r);
}
q.prototype.string = function(c) {
var i = se.Buffer.byteLength(c);
return this.uint32(i), i && this._push(vi, i, c), this;
};
q._configure();
var Br = R, X = be(), It, Hr = X.LongBits, Oi = X.utf8;
function J(c, i) {
return RangeError("index out of range: " + c.pos + " + " + (i || 1) + " > " + c.len);
}
function R(c) {
this.buf = c, this.pos = 0, this.len = c.length;
}
var Tr = typeof Uint8Array < "u" ? function(c) {
if (c instanceof Uint8Array || Array.isArray(c))
return new R(c);
throw Error("illegal buffer");
} : function(c) {
if (Array.isArray(c))
return new R(c);
throw Error("illegal buffer");
}, Vr = function() {
return X.Buffer ? function(c) {
return (R.create = function(i) {
return X.Buffer.isBuffer(i) ? new It(i) : Tr(i);
})(c);
} : Tr;
};
R.create = Vr();
R.prototype._slice = X.Array.prototype.subarray || /* istanbul ignore next */
X.Array.prototype.slice;
R.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, J(this, 10);
return c;
};
}();
R.prototype.int32 = function() {
return this.uint32() | 0;
};
R.prototype.sint32 = function() {
var c = this.uint32();
return c >>> 1 ^ -(c & 1) | 0;
};
function vt() {
var c = new Hr(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 J(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 J(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");
}
R.prototype.bool = function() {
return this.uint32() !== 0;
};
function nt(c, i) {
return (c[i - 4] | c[i - 3] << 8 | c[i - 2] << 16 | c[i - 1] << 24) >>> 0;
}
R.prototype.fixed32 = function() {
if (this.pos + 4 > this.len)
throw J(this, 4);
return nt(this.buf, this.pos += 4);
};
R.prototype.sfixed32 = function() {
if (this.pos + 4 > this.len)
throw J(this, 4);
return nt(this.buf, this.pos += 4) | 0;
};
function kr() {
if (this.pos + 8 > this.len)
throw J(this, 8);
return new Hr(nt(this.buf, this.pos += 4), nt(this.buf, this.pos += 4));
}
R.prototype.float = function() {
if (this.pos + 4 > this.len)
throw J(this, 4);
var c = X.float.readFloatLE(this.buf, this.pos);
return this.pos += 4, c;
};
R.prototype.double = function() {
if (this.pos + 8 > this.len)
throw J(this, 4);
var c = X.float.readDoubleLE(this.buf, this.pos);
return this.pos += 8, c;
};
R.prototype.bytes = function() {
var c = this.uint32(), i = this.pos, r = this.pos + c;
if (r > this.len)
throw J(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);
};
R.prototype.string = function() {
var c = this.bytes();
return Oi.read(c, 0, c.length);
};
R.prototype.skip = function(c) {
if (typeof c == "number") {
if (this.pos + c > this.len)
throw J(this, c);
this.pos += c;
} else
do
if (this.pos >= this.len)
throw J(this);
while (this.buf[this.pos++] & 128);
return this;
};
R.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;
};
R._configure = function(c) {
It = c, R.create = Vr(), It._configure();
var i = X.Long ? "toLong" : (
/* istanbul ignore next */
"toNumber"
);
X.merge(R.prototype, {
int64: function() {
return vt.call(this)[i](!1);
},
uint64: function() {
return vt.call(this)[i](!0);
},
sint64: function() {
return vt.call(this).zzDecode()[i](!1);
},
fixed64: function() {
return kr.call(this)[i](!0);
},
sfixed64: function() {
return kr.call(this)[i](!1);
}
});
};
var wi = ge, Jr = Br;
(ge.prototype = Object.create(Jr.prototype)).constructor = ge;
var Er = be();
function ge(c) {
Jr.call(this, c);
}
ge._configure = function() {
Er.Buffer && (ge.prototype._slice = Er.Buffer.prototype.slice);
};
ge.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));
};
ge._configure();
var Yr = {}, Pi = ke, kt = be();
(ke.prototype = Object.create(kt.EventEmitter.prototype)).constructor = ke;
function ke(c, i, r) {
if (typeof c != "function")
throw TypeError("rpcImpl must be a function");
kt.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 kt.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 = Pi;
})(Yr);
var ji = {};
(function(c) {
var i = c;
i.build = "minimal", i.Writer = Ur, i.BufferWriter = bi, i.Reader = Br, i.BufferReader = wi, i.util = be(), i.rpc = Yr, i.roots = ji, i.configure = r;
function r() {
i.util._configure(), i.Writer._configure(i.BufferWriter), i.Reader._configure(i.BufferReader);
}
r();
})(Nr);
var D = Nr;
const h = D.Reader, E = D.Writer, p = D.util, a = D.roots.default || (D.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, D.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.m