UNPKG

@innovatrics/dot-face-auto-capture

Version:
1,413 lines 313 kB
var Ao = Object.defineProperty; var tr = (p) => { throw TypeError(p); }; var Do = (p, c, n) => c in p ? Ao(p, c, { enumerable: !0, configurable: !0, writable: !0, value: n }) : p[c] = n; var Ne = (p, c, n) => Do(p, typeof c != "symbol" ? c + "" : c, n), rr = (p, c, n) => c.has(p) || tr("Cannot " + n); var q = (p, c, n) => (rr(p, c, "read from private field"), n ? n.call(p) : c.get(p)), We = (p, c, n) => c.has(p) ? tr("Cannot add the same private member more than once") : c instanceof WeakSet ? c.add(p) : c.set(p, n), ze = (p, c, n, t) => (rr(p, c, "write to private field"), t ? t.call(p, n) : c.set(p, n), n); /** * @license * Copyright 2019 Google LLC * SPDX-License-Identifier: Apache-2.0 */ const Tr = Symbol("Comlink.proxy"), ko = Symbol("Comlink.endpoint"), To = Symbol("Comlink.releaseProxy"), rt = Symbol("Comlink.finalizer"), $e = Symbol("Comlink.thrown"), Er = (p) => typeof p == "object" && p !== null || typeof p == "function", Eo = { canHandle: (p) => Er(p) && p[Tr], serialize(p) { const { port1: c, port2: n } = new MessageChannel(); return gt(p, c), [n, [n]]; }, deserialize(p) { return p.start(), Ro(p); } }, Fo = { canHandle: (p) => Er(p) && $e in p, serialize({ value: p }) { let c; return p instanceof Error ? c = { isError: !0, value: { message: p.message, name: p.name, stack: p.stack } } : c = { isError: !1, value: p }, [c, []]; }, deserialize(p) { throw p.isError ? Object.assign(new Error(p.value.message), p.value) : p.value; } }, Fr = /* @__PURE__ */ new Map([ ["proxy", Eo], ["throw", Fo] ]); function _o(p, c) { for (const n of p) if (c === n || n === "*" || n instanceof RegExp && n.test(c)) return !0; return !1; } function gt(p, c = globalThis, n = ["*"]) { c.addEventListener("message", function t(e) { if (!e || !e.data) return; if (!_o(n, e.origin)) { console.warn(`Invalid origin '${e.origin}' for comlink proxy`); return; } const { id: r, type: o, path: d } = Object.assign({ path: [] }, e.data), l = (e.data.argumentList || []).map(ue); let y; try { const S = d.slice(0, -1).reduce((O, P) => O[P], p), m = d.reduce((O, P) => O[P], p); switch (o) { case "GET": y = m; break; case "SET": S[d.slice(-1)[0]] = ue(e.data.value), y = !0; break; case "APPLY": y = m.apply(S, l); break; case "CONSTRUCT": { const O = new m(...l); y = zo(O); } break; case "ENDPOINT": { const { port1: O, port2: P } = new MessageChannel(); gt(p, P), y = Wo(O, [O]); } break; case "RELEASE": y = void 0; break; default: return; } } catch (S) { y = { value: S, [$e]: 0 }; } Promise.resolve(y).catch((S) => ({ value: S, [$e]: 0 })).then((S) => { const [m, O] = Ve(S); c.postMessage(Object.assign(Object.assign({}, m), { id: r }), O), o === "RELEASE" && (c.removeEventListener("message", t), _r(c), rt in p && typeof p[rt] == "function" && p[rt]()); }).catch((S) => { const [m, O] = Ve({ value: new TypeError("Unserializable return value"), [$e]: 0 }); c.postMessage(Object.assign(Object.assign({}, m), { id: r }), O); }); }), c.start && c.start(); } function Mo(p) { return p.constructor.name === "MessagePort"; } function _r(p) { Mo(p) && p.close(); } function Ro(p, c) { const n = /* @__PURE__ */ new Map(); return p.addEventListener("message", function(e) { const { data: r } = e; if (!r || !r.id) return; const o = n.get(r.id); if (o) try { o(r); } finally { n.delete(r.id); } }), yt(p, n, [], c); } function Ue(p) { if (p) throw new Error("Proxy has been released and is not useable"); } function Mr(p) { return be(p, /* @__PURE__ */ new Map(), { type: "RELEASE" }).then(() => { _r(p); }); } const Ge = /* @__PURE__ */ new WeakMap(), Be = "FinalizationRegistry" in globalThis && new FinalizationRegistry((p) => { const c = (Ge.get(p) || 0) - 1; Ge.set(p, c), c === 0 && Mr(p); }); function Lo(p, c) { const n = (Ge.get(c) || 0) + 1; Ge.set(c, n), Be && Be.register(p, c, p); } function xo(p) { Be && Be.unregister(p); } function yt(p, c, n = [], t = function() { }) { let e = !1; const r = new Proxy(t, { get(o, d) { if (Ue(e), d === To) return () => { xo(r), Mr(p), c.clear(), e = !0; }; if (d === "then") { if (n.length === 0) return { then: () => r }; const l = be(p, c, { type: "GET", path: n.map((y) => y.toString()) }).then(ue); return l.then.bind(l); } return yt(p, c, [...n, d]); }, set(o, d, l) { Ue(e); const [y, S] = Ve(l); return be(p, c, { type: "SET", path: [...n, d].map((m) => m.toString()), value: y }, S).then(ue); }, apply(o, d, l) { Ue(e); const y = n[n.length - 1]; if (y === ko) return be(p, c, { type: "ENDPOINT" }).then(ue); if (y === "bind") return yt(p, c, n.slice(0, -1)); const [S, m] = nr(l); return be(p, c, { type: "APPLY", path: n.map((O) => O.toString()), argumentList: S }, m).then(ue); }, construct(o, d) { Ue(e); const [l, y] = nr(d); return be(p, c, { type: "CONSTRUCT", path: n.map((S) => S.toString()), argumentList: l }, y).then(ue); } }); return Lo(r, p), r; } function No(p) { return Array.prototype.concat.apply([], p); } function nr(p) { const c = p.map(Ve); return [c.map((n) => n[0]), No(c.map((n) => n[1]))]; } const Rr = /* @__PURE__ */ new WeakMap(); function Wo(p, c) { return Rr.set(p, c), p; } function zo(p) { return Object.assign(p, { [Tr]: !0 }); } function Ve(p) { for (const [c, n] of Fr) if (n.canHandle(p)) { const [t, e] = n.serialize(p); return [ { type: "HANDLER", name: c, value: t }, e ]; } return [ { type: "RAW", value: p }, Rr.get(p) || [] ]; } function ue(p) { switch (p.type) { case "HANDLER": return Fr.get(p.name).deserialize(p.value); case "RAW": return p.value; } } function be(p, c, n, t) { return new Promise((e) => { const r = Uo(); c.set(r, e), p.start && p.start(), p.postMessage(Object.assign({ id: r }, n), t); }); } function Uo() { return new Array(4).fill(0).map(() => Math.floor(Math.random() * Number.MAX_SAFE_INTEGER).toString(16)).join("-"); } const Se = 1e3, or = { simd: "sam_simd.wasm", sam: "sam.wasm" }, $o = 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 V extends Error { constructor(n, t) { super(n); Ne(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 V) 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 V(t, n); } static fromError(n) { if (this.logError(n), n instanceof V) return n; const t = "An unexpected error has occurred"; return new V(t); } } const Go = { RGBA: "RGBA" }; var ae, fe, ve; class Bo { constructor(c, n) { We(this, ae); We(this, fe); We(this, ve); ze(this, ae, c), ze(this, fe, this.allocate(n.length * n.BYTES_PER_ELEMENT)), ze(this, ve, this.allocate(n.length * n.BYTES_PER_ELEMENT)); } get rgbaImagePointer() { return q(this, fe); } get bgr0ImagePointer() { return q(this, ve); } allocate(c) { return q(this, ae)._malloc(c); } free() { q(this, ae)._free(q(this, fe)), q(this, ae)._free(q(this, ve)); } writeDataToMemory(c) { q(this, ae).HEAPU8.set(c, q(this, fe)); } } ae = new WeakMap(), fe = new WeakMap(), ve = new WeakMap(); class Vo { constructor() { Ne(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 V( `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 V( `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 V) 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 $o() ? or.simd : or.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 V("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 V("SAM WASM module is not initialized"); const n = new Bo(this.samWasmModule, c); return n.writeDataToMemory(c), n; } convertToSamColorImage(c, n) { if (!this.samWasmModule) throw new V("SAM WASM module is not initialized"); const t = this.writeImageToMemory(c); return this.samWasmModule.convertToSamColorImage( n.width, n.height, t.rgbaImagePointer, Go.RGBA, t.bgr0ImagePointer ), t; } } const Ho = (p) => Number.parseFloat(p.toFixed(3)), Yo = (p, c) => Math.min(p, c); var ge = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, ir = {}, nt = {}, ot, ar; function Jo() { if (ar) return ot; ar = 1, ot = 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(d, l) { t[e] = function(y) { if (o) if (o = !1, y) l(y); else { for (var S = new Array(arguments.length - 1), m = 0; m < S.length; ) S[m++] = arguments[m]; d.apply(null, S); } }; try { c.apply(n || null, t); } catch (y) { o && (o = !1, l(y)); } }); } return ot; } var sr = {}, lr; function Ko() { return lr || (lr = 1, function(p) { var c = p; c.length = function(o) { var d = o.length; if (!d) return 0; for (var l = 0; --d % 4 > 1 && o.charAt(d) === "="; ) ++l; return Math.ceil(o.length * 3) / 4 - l; }; 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, d, l) { for (var y = null, S = [], m = 0, O = 0, P; d < l; ) { var I = o[d++]; switch (O) { case 0: S[m++] = n[I >> 2], P = (I & 3) << 4, O = 1; break; case 1: S[m++] = n[P | I >> 4], P = (I & 15) << 2, O = 2; break; case 2: S[m++] = n[P | I >> 6], S[m++] = n[I & 63], O = 0; break; } m > 8191 && ((y || (y = [])).push(String.fromCharCode.apply(String, S)), m = 0); } return O && (S[m++] = n[P], S[m++] = 61, O === 1 && (S[m++] = 61)), y ? (m && y.push(String.fromCharCode.apply(String, S.slice(0, m))), y.join("")) : String.fromCharCode.apply(String, S.slice(0, m)); }; var r = "invalid encoding"; c.decode = function(o, d, l) { for (var y = l, S = 0, m, O = 0; O < o.length; ) { var P = o.charCodeAt(O++); if (P === 61 && S > 1) break; if ((P = t[P]) === void 0) throw Error(r); switch (S) { case 0: m = P, S = 1; break; case 1: d[l++] = m << 2 | (P & 48) >> 4, m = P, S = 2; break; case 2: d[l++] = (m & 15) << 4 | (P & 60) >> 2, m = P, S = 3; break; case 3: d[l++] = (m & 3) << 6 | P, S = 0; break; } } if (S === 1) throw Error(r); return l - y; }, c.test = function(o) { return /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(o); }; }(sr)), sr; } var it, cr; function Zo() { if (cr) return it; cr = 1, it = 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; }, it; } var at, dr; function qo() { if (dr) return at; dr = 1, at = p(p); function p(r) { return typeof Float32Array < "u" ? function() { var o = new Float32Array([-0]), d = new Uint8Array(o.buffer), l = d[3] === 128; function y(P, I, E) { o[0] = P, I[E] = d[0], I[E + 1] = d[1], I[E + 2] = d[2], I[E + 3] = d[3]; } function S(P, I, E) { o[0] = P, I[E] = d[3], I[E + 1] = d[2], I[E + 2] = d[1], I[E + 3] = d[0]; } r.writeFloatLE = l ? y : S, r.writeFloatBE = l ? S : y; function m(P, I) { return d[0] = P[I], d[1] = P[I + 1], d[2] = P[I + 2], d[3] = P[I + 3], o[0]; } function O(P, I) { return d[3] = P[I], d[2] = P[I + 1], d[1] = P[I + 2], d[0] = P[I + 3], o[0]; } r.readFloatLE = l ? m : O, r.readFloatBE = l ? O : m; }() : function() { function o(l, y, S, m) { var O = y < 0 ? 1 : 0; if (O && (y = -y), y === 0) l(1 / y > 0 ? ( /* positive */ 0 ) : ( /* negative 0 */ 2147483648 ), S, m); else if (isNaN(y)) l(2143289344, S, m); else if (y > 34028234663852886e22) l((O << 31 | 2139095040) >>> 0, S, m); else if (y < 11754943508222875e-54) l((O << 31 | Math.round(y / 1401298464324817e-60)) >>> 0, S, m); else { var P = Math.floor(Math.log(y) / Math.LN2), I = Math.round(y * Math.pow(2, -P) * 8388608) & 8388607; l((O << 31 | P + 127 << 23 | I) >>> 0, S, m); } } r.writeFloatLE = o.bind(null, c), r.writeFloatBE = o.bind(null, n); function d(l, y, S) { var m = l(y, S), O = (m >> 31) * 2 + 1, P = m >>> 23 & 255, I = m & 8388607; return P === 255 ? I ? NaN : O * (1 / 0) : P === 0 ? O * 1401298464324817e-60 * I : O * Math.pow(2, P - 150) * (I + 8388608); } r.readFloatLE = d.bind(null, t), r.readFloatBE = d.bind(null, e); }(), typeof Float64Array < "u" ? function() { var o = new Float64Array([-0]), d = new Uint8Array(o.buffer), l = d[7] === 128; function y(P, I, E) { o[0] = P, I[E] = d[0], I[E + 1] = d[1], I[E + 2] = d[2], I[E + 3] = d[3], I[E + 4] = d[4], I[E + 5] = d[5], I[E + 6] = d[6], I[E + 7] = d[7]; } function S(P, I, E) { o[0] = P, I[E] = d[7], I[E + 1] = d[6], I[E + 2] = d[5], I[E + 3] = d[4], I[E + 4] = d[3], I[E + 5] = d[2], I[E + 6] = d[1], I[E + 7] = d[0]; } r.writeDoubleLE = l ? y : S, r.writeDoubleBE = l ? S : y; function m(P, I) { return d[0] = P[I], d[1] = P[I + 1], d[2] = P[I + 2], d[3] = P[I + 3], d[4] = P[I + 4], d[5] = P[I + 5], d[6] = P[I + 6], d[7] = P[I + 7], o[0]; } function O(P, I) { return d[7] = P[I], d[6] = P[I + 1], d[5] = P[I + 2], d[4] = P[I + 3], d[3] = P[I + 4], d[2] = P[I + 5], d[1] = P[I + 6], d[0] = P[I + 7], o[0]; } r.readDoubleLE = l ? m : O, r.readDoubleBE = l ? O : m; }() : function() { function o(l, y, S, m, O, P) { var I = m < 0 ? 1 : 0; if (I && (m = -m), m === 0) l(0, O, P + y), l(1 / m > 0 ? ( /* positive */ 0 ) : ( /* negative 0 */ 2147483648 ), O, P + S); else if (isNaN(m)) l(0, O, P + y), l(2146959360, O, P + S); else if (m > 17976931348623157e292) l(0, O, P + y), l((I << 31 | 2146435072) >>> 0, O, P + S); else { var E; if (m < 22250738585072014e-324) E = m / 5e-324, l(E >>> 0, O, P + y), l((I << 31 | E / 4294967296) >>> 0, O, P + S); else { var w = Math.floor(Math.log(m) / Math.LN2); w === 1024 && (w = 1023), E = m * Math.pow(2, -w), l(E * 4503599627370496 >>> 0, O, P + y), l((I << 31 | w + 1023 << 20 | E * 1048576 & 1048575) >>> 0, O, P + S); } } } r.writeDoubleLE = o.bind(null, c, 0, 4), r.writeDoubleBE = o.bind(null, n, 4, 0); function d(l, y, S, m, O) { var P = l(m, O + y), I = l(m, O + S), E = (I >> 31) * 2 + 1, w = I >>> 20 & 2047, D = 4294967296 * (I & 1048575) + P; return w === 2047 ? D ? NaN : E * (1 / 0) : w === 0 ? E * 5e-324 * D : E * Math.pow(2, w - 1075) * (D + 4503599627370496); } r.readDoubleLE = d.bind(null, t, 0, 4), r.readDoubleBE = d.bind(null, e, 4, 0); }(), r; } function c(r, o, d) { o[d] = r & 255, o[d + 1] = r >>> 8 & 255, o[d + 2] = r >>> 16 & 255, o[d + 3] = r >>> 24; } function n(r, o, d) { o[d] = r >>> 24, o[d + 1] = r >>> 16 & 255, o[d + 2] = r >>> 8 & 255, o[d + 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 at; } function ur(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 st, fr; function Xo() { if (fr) return st; fr = 1, st = p; function p(c) { try { if (typeof ur != "function") return null; var n = ur(c); return n && (n.length || Object.keys(n).length) ? n : null; } catch { return null; } } return st; } var pr = {}, mr; function Qo() { return mr || (mr = 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, d = [], l = 0, y; t < e; ) y = n[t++], y < 128 ? d[l++] = y : y > 191 && y < 224 ? d[l++] = (y & 31) << 6 | n[t++] & 63 : y > 239 && y < 365 ? (y = ((y & 7) << 18 | (n[t++] & 63) << 12 | (n[t++] & 63) << 6 | n[t++] & 63) - 65536, d[l++] = 55296 + (y >> 10), d[l++] = 56320 + (y & 1023)) : d[l++] = (y & 15) << 12 | (n[t++] & 63) << 6 | n[t++] & 63, l > 8191 && ((o || (o = [])).push(String.fromCharCode.apply(String, d)), l = 0); return o ? (l && o.push(String.fromCharCode.apply(String, d.slice(0, l))), o.join("")) : String.fromCharCode.apply(String, d.slice(0, l)); }, c.write = function(n, t, e) { for (var r = e, o, d, l = 0; l < n.length; ++l) o = n.charCodeAt(l), o < 128 ? t[e++] = o : o < 2048 ? (t[e++] = o >> 6 | 192, t[e++] = o & 63 | 128) : (o & 64512) === 55296 && ((d = n.charCodeAt(l + 1)) & 64512) === 56320 ? (o = 65536 + ((o & 1023) << 10) + (d & 1023), ++l, 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; }; }(pr)), pr; } var lt, hr; function ei() { if (hr) return lt; hr = 1, lt = p; function p(c, n, t) { var e = t || 8192, r = e >>> 1, o = null, d = e; return function(l) { if (l < 1 || l > r) return c(l); d + l > e && (o = c(e), d = 0); var y = n.call(o, d, d += l); return d & 7 && (d = (d | 7) + 1), y; }; } return lt; } var ct, yr; function ti() { if (yr) return ct; yr = 1, ct = 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 d = r >>> 0, l = (r - d) / 4294967296 >>> 0; return o && (l = ~l >>> 0, d = ~d >>> 0, ++d > 4294967295 && (d = 0, ++l > 4294967295 && (l = 0))), new c(d, l); }, 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, d = ~this.hi >>> 0; return o || (d = d + 1 >>> 0), -(o + d * 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, d = this.hi >>> 24; return d === 0 ? o === 0 ? r < 16384 ? r < 128 ? 1 : 2 : r < 2097152 ? 3 : 4 : o < 16384 ? o < 128 ? 5 : 6 : o < 2097152 ? 7 : 8 : d < 128 ? 9 : 10; }, ct; } var gr; function pe() { return gr || (gr = 1, function(p) { var c = p; c.asPromise = Jo(), c.base64 = Ko(), c.EventEmitter = Zo(), c.float = qo(), c.inquire = Xo(), c.utf8 = Qo(), c.pool = ei(), c.LongBits = ti(), c.isNode = !!(typeof ge < "u" && ge && ge.process && ge.process.versions && ge.process.versions.node), c.global = c.isNode && ge || typeof window < "u" && window || typeof self < "u" && self || nt, 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 d = Object.keys(r), l = 0; l < d.length; ++l) (e[d[l]] === void 0 || !o) && (e[d[l]] = r[d[l]]); return e; } c.merge = n, c.lcFirst = function(e) { return e.charAt(0).toLowerCase() + e.substring(1); }; function t(e) { function r(o, d) { if (!(this instanceof r)) return new r(o, d); Object.defineProperty(this, "message", { get: function() { return o; } }), Error.captureStackTrace ? Error.captureStackTrace(this, r) : Object.defineProperty(this, "stack", { value: new Error().stack || "" }), d && n(this, d); } 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 d = Object.keys(this), l = d.length - 1; l > -1; --l) if (r[d[l]] === 1 && this[d[l]] !== void 0 && this[d[l]] !== null) return d[l]; }; }, 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); }; }; }(nt)), nt; } var dt, br; function Lr() { if (br) return dt; br = 1, dt = l; var p = pe(), c, n = p.LongBits, t = p.base64, e = p.utf8; function r(w, D, M) { this.fn = w, this.len = D, this.next = void 0, this.val = M; } function o() { } function d(w) { this.head = w.head, this.tail = w.tail, this.len = w.len, this.next = w.states; } function l() { this.len = 0, this.head = new r(o, 0, 0), this.tail = this.head, this.states = null; } var y = function() { return p.Buffer ? function() { return (l.create = function() { return new c(); })(); } : function() { return new l(); }; }; l.create = y(), l.alloc = function(w) { return new p.Array(w); }, p.Array !== Array && (l.alloc = p.pool(l.alloc, p.Array.prototype.subarray)), l.prototype._push = function(w, D, M) { return this.tail = this.tail.next = new r(w, D, M), this.len += D, this; }; function S(w, D, M) { D[M] = w & 255; } function m(w, D, M) { for (; w > 127; ) D[M++] = w & 127 | 128, w >>>= 7; D[M] = w; } function O(w, D) { this.len = w, this.next = void 0, this.val = D; } O.prototype = Object.create(r.prototype), O.prototype.fn = m, l.prototype.uint32 = function(w) { return this.len += (this.tail = this.tail.next = new O( (w = w >>> 0) < 128 ? 1 : w < 16384 ? 2 : w < 2097152 ? 3 : w < 268435456 ? 4 : 5, w )).len, this; }, l.prototype.int32 = function(w) { return w < 0 ? this._push(P, 10, n.fromNumber(w)) : this.uint32(w); }, l.prototype.sint32 = function(w) { return this.uint32((w << 1 ^ w >> 31) >>> 0); }; function P(w, D, M) { for (; w.hi; ) D[M++] = w.lo & 127 | 128, w.lo = (w.lo >>> 7 | w.hi << 25) >>> 0, w.hi >>>= 7; for (; w.lo > 127; ) D[M++] = w.lo & 127 | 128, w.lo = w.lo >>> 7; D[M++] = w.lo; } l.prototype.uint64 = function(w) { var D = n.from(w); return this._push(P, D.length(), D); }, l.prototype.int64 = l.prototype.uint64, l.prototype.sint64 = function(w) { var D = n.from(w).zzEncode(); return this._push(P, D.length(), D); }, l.prototype.bool = function(w) { return this._push(S, 1, w ? 1 : 0); }; function I(w, D, M) { D[M] = w & 255, D[M + 1] = w >>> 8 & 255, D[M + 2] = w >>> 16 & 255, D[M + 3] = w >>> 24; } l.prototype.fixed32 = function(w) { return this._push(I, 4, w >>> 0); }, l.prototype.sfixed32 = l.prototype.fixed32, l.prototype.fixed64 = function(w) { var D = n.from(w); return this._push(I, 4, D.lo)._push(I, 4, D.hi); }, l.prototype.sfixed64 = l.prototype.fixed64, l.prototype.float = function(w) { return this._push(p.float.writeFloatLE, 4, w); }, l.prototype.double = function(w) { return this._push(p.float.writeDoubleLE, 8, w); }; var E = p.Array.prototype.set ? function(w, D, M) { D.set(w, M); } : function(w, D, M) { for (var X = 0; X < w.length; ++X) D[M + X] = w[X]; }; return l.prototype.bytes = function(w) { var D = w.length >>> 0; if (!D) return this._push(S, 1, 0); if (p.isString(w)) { var M = l.alloc(D = t.length(w)); t.decode(w, M, 0), w = M; } return this.uint32(D)._push(E, D, w); }, l.prototype.string = function(w) { var D = e.length(w); return D ? this.uint32(D)._push(e.write, D, w) : this._push(S, 1, 0); }, l.prototype.fork = function() { return this.states = new d(this), this.head = this.tail = new r(o, 0, 0), this.len = 0, this; }, l.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; }, l.prototype.ldelim = function() { var w = this.head, D = this.tail, M = this.len; return this.reset().uint32(M), M && (this.tail.next = w.next, this.tail = D, this.len += M), this; }, l.prototype.finish = function() { for (var w = this.head.next, D = this.constructor.alloc(this.len), M = 0; w; ) w.fn(w.val, D, M), M += w.len, w = w.next; return D; }, l._configure = function(w) { c = w, l.create = y(), c._configure(); }, dt; } var ut, vr; function ri() { if (vr) return ut; vr = 1, ut = n; var p = Lr(); (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 d = 0; d < e.length; ) r[o++] = e[d++]; }; }, 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(), ut; } var ft, Or; function xr() { if (Or) return ft; Or = 1, ft = r; var p = pe(), c, n = p.LongBits, t = p.utf8; function e(m, O) { return RangeError("index out of range: " + m.pos + " + " + (O || 1) + " > " + m.len); } function r(m) { this.buf = m, this.pos = 0, this.len = m.length; } var o = typeof Uint8Array < "u" ? function(m) { if (m instanceof Uint8Array || Array.isArray(m)) return new r(m); throw Error("illegal buffer"); } : function(m) { if (Array.isArray(m)) return new r(m); throw Error("illegal buffer"); }, d = function() { return p.Buffer ? function(m) { return (r.create = function(O) { return p.Buffer.isBuffer(O) ? new c(O) : o(O); })(m); } : o; }; r.create = d(), r.prototype._slice = p.Array.prototype.subarray || /* istanbul ignore next */ p.Array.prototype.slice, r.prototype.uint32 = /* @__PURE__ */ function() { var m = 4294967295; return function() { if (m = (this.buf[this.pos] & 127) >>> 0, this.buf[this.pos++] < 128 || (m = (m | (this.buf[this.pos] & 127) << 7) >>> 0, this.buf[this.pos++] < 128) || (m = (m | (this.buf[this.pos] & 127) << 14) >>> 0, this.buf[this.pos++] < 128) || (m = (m | (this.buf[this.pos] & 127) << 21) >>> 0, this.buf[this.pos++] < 128) || (m = (m | (this.buf[this.pos] & 15) << 28) >>> 0, this.buf[this.pos++] < 128)) return m; if ((this.pos += 5) > this.len) throw this.pos = this.len, e(this, 10); return m; }; }(), r.prototype.int32 = function() { return this.uint32() | 0; }, r.prototype.sint32 = function() { var m = this.uint32(); return m >>> 1 ^ -(m & 1) | 0; }; function l() { var m = new n(0, 0), O = 0; if (this.len - this.pos > 4) { for (; O < 4; ++O) if (m.lo = (m.lo | (this.buf[this.pos] & 127) << O * 7) >>> 0, this.buf[this.pos++] < 128) return m; if (m.lo = (m.lo | (this.buf[this.pos] & 127) << 28) >>> 0, m.hi = (m.hi | (this.buf[this.pos] & 127) >> 4) >>> 0, this.buf[this.pos++] < 128) return m; O = 0; } else { for (; O < 3; ++O) { if (this.pos >= this.len) throw e(this); if (m.lo = (m.lo | (this.buf[this.pos] & 127) << O * 7) >>> 0, this.buf[this.pos++] < 128) return m; } return m.lo = (m.lo | (this.buf[this.pos++] & 127) << O * 7) >>> 0, m; } if (this.len - this.pos > 4) { for (; O < 5; ++O) if (m.hi = (m.hi | (this.buf[this.pos] & 127) << O * 7 + 3) >>> 0, this.buf[this.pos++] < 128) return m; } else for (; O < 5; ++O) { if (this.pos >= this.len) throw e(this); if (m.hi = (m.hi | (this.buf[this.pos] & 127) << O * 7 + 3) >>> 0, this.buf[this.pos++] < 128) return m; } throw Error("invalid varint encoding"); } r.prototype.bool = function() { return this.uint32() !== 0; }; function y(m, O) { return (m[O - 4] | m[O - 3] << 8 | m[O - 2] << 16 | m[O - 1] << 24) >>> 0; } r.prototype.fixed32 = function() { if (this.pos + 4 > this.len) throw e(this, 4); return y(this.buf, this.pos += 4); }, r.prototype.sfixed32 = function() { if (this.pos + 4 > this.len) throw e(this, 4); return y(this.buf, this.pos += 4) | 0; }; function S() { if (this.pos + 8 > this.len) throw e(this, 8); return new n(y(this.buf, this.pos += 4), y(this.buf, this.pos += 4)); } return r.prototype.float = function() { if (this.pos + 4 > this.len) throw e(this, 4); var m = p.float.readFloatLE(this.buf, this.pos); return this.pos += 4, m; }, r.prototype.double = function() { if (this.pos + 8 > this.len) throw e(this, 4); var m = p.float.readDoubleLE(this.buf, this.pos); return this.pos += 8, m; }, r.prototype.bytes = function() { var m = this.uint32(), O = this.pos, P = this.pos + m; if (P > this.len) throw e(this, m); if (this.pos += m, Array.isArray(this.buf)) return this.buf.slice(O, P); if (O === P) { var I = p.Buffer; return I ? I.alloc(0) : new this.buf.constructor(0); } return this._slice.call(this.buf, O, P); }, r.prototype.string = function() { var m = this.bytes(); return t.read(m, 0, m.length); }, r.prototype.skip = function(m) { if (typeof m == "number") { if (this.pos + m > this.len) throw e(this, m); this.pos += m; } else do if (this.pos >= this.len) throw e(this); while (this.buf[this.pos++] & 128); return this; }, r.prototype.skipType = function(m) { switch (m) { case 0: this.skip(); break; case 1: this.skip(8); break; case 2: this.skip(this.uint32()); break; case 3: for (; (m = this.uint32() & 7) !== 4; ) this.skipType(m); break; case 5: this.skip(4); break; /* istanbul ignore next */ default: throw Error("invalid wire type " + m + " at offset " + this.pos); } return this; }, r._configure = function(m) { c = m, r.create = d(), c._configure(); var O = p.Long ? "toLong" : ( /* istanbul ignore next */ "toNumber" ); p.merge(r.prototype, { int64: function() { return l.call(this)[O](!1); }, uint64: function() { return l.call(this)[O](!0); }, sint64: function() { return l.call(this).zzDecode()[O](!1); }, fixed64: function() { return S.call(this)[O](!0); }, sfixed64: function() { return S.call(this)[O](!1); } }); }, ft; } var pt, wr; function ni() { if (wr) return pt; wr = 1, pt = n; var p = xr(); (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(), pt; } var Pr = {}, mt, jr; function oi() { if (jr) return mt; jr = 1, mt = 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, d) { if (!o) throw TypeError("request must be specified"); var l = this; if (!d) return p.asPromise(n, l, t, e, r, o); if (!l.rpcImpl) { setTimeout(function() { d(Error("already ended")); }, 0); return; } try { return l.rpcImpl( t, e[l.requestDelimited ? "encodeDelimited" : "encode"](o).finish(), function(y, S) { if (y) return l.emit("error", y, t), d(y); if (S === null) { l.end( /* endedByRPC */ !0 ); return; } if (!(S instanceof r)) try { S = r[l.responseDelimited ? "decodeDelimited" : "decode"](S); } catch (m) { return l.emit("error", m, t), d(m); } return l.emit("data", S, t), d(null, S); } ); } catch (y) { l.emit("error", y, t), setTimeout(function() { d(y); }, 0); return; } }, c.prototype.end = function(n) { return this.rpcImpl && (n || this.rpcImpl(null, null, null), this.rpcImpl = null, this.emit("end").off()), this; }, mt; } var Ir; function ii() { return Ir || (Ir = 1, function(p) { var c = p; c.Service = oi(); }(Pr)), Pr; } var Sr, Cr; function ai() { return Cr || (Cr = 1, Sr = {}), Sr; } var Ar; function si() { return Ar || (Ar = 1, function(p) { var c = p; c.build = "minimal", c.Writer = Lr(), c.BufferWriter = ri(), c.Reader = xr(), c.BufferReader = ni(), c.util = pe(), c.rpc = ii(), c.roots = ai(), c.configure = n; function n() { c.util._configure(), c.Writer._configure(c.BufferWriter), c.Reader._configure(c.BufferReader); } n(); }(ir)), ir; } var Dr, kr; function li() { return kr || (kr = 1, Dr = si()), Dr; } var _ = li(); const g = _.Reader, L = _.Writer, u = _.util, i = _.roots.default || (_.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 = u.newBuffer([]), c.prototype.iv = u.newBuffer([]), c.prototype.schemaVersion = 0, c.prototype.bytes = u.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 g || (n = g.create(n)); let r = t === void 0 ? n.len : n.pos + t, o = new i.dot.Content(); for (; n.pos < r; ) { let d = n.uint32(); if (d === e) break; switch (d >>> 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(d & 7); break; } } return o; }, c.decodeDelimited = function(n) { return n instanceof g || (n = new g(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" || u.isString(n.token)) ? "token: buffer expected" : n.iv != null && n.hasOwnProperty("iv") && !(n.iv && typeof n.iv.length == "number" || u.isString(n.iv)) ? "iv: buffer expected" : n.schemaVersion != null && n.hasOwnProperty("schemaVersion") && !u.isInteger(n.schemaVersion) ? "schemaVersion: integer expected" : n.bytes != null && n.hasOwnProperty("bytes") && !(n.bytes && typeof n.bytes.length == "number" || u.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" ? u.base64.decode(n.token, t.token = u.newBuffer(u.base64.length(n.token)), 0) : n.token.length >= 0 && (t.token = n.token)), n.iv != null && (typeof n.iv == "string" ? u.base64.decode(n.iv, t.iv = u.newBuffer(u.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" ? u.base64.decode(n.bytes, t.bytes = u.newBuffer(u.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 = u.newBuffer(e.token))), t.bytes === String ? e.iv = "" : (e.iv = [], t.bytes !== Array && (e.iv = u.newBuffer(e.iv))), e.schemaVersion = 0, t.bytes === String ? e.bytes = "" : (e.bytes = [], t.bytes !== Array && (e.bytes = u.newBuffer(e.bytes)))), n.token != null && n.hasOwnProperty("token") && (e.token = t.bytes === String ? u.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 ? u.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 ? u.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, _.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 = u.emptyArray, n.prototype.video = null, n.prototype.metadata = null; let t; return Object.defineProperty(n.prototype, "_video", { get: u.oneOfGetter(t = ["video"]), set: u.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.encode