UNPKG

bry-biometric-collector

Version:

BRy web-collector component for biometric capture.

1,566 lines 65.5 kB
import { S as Ut, q as Vt, r as jt, t as Ht, w as L, x as q, y as C, z as ge, B as x, C as m, D as be, E as J, G as Z, H as S, I as ve, J as I, K as Ne, L as Me, M as _e, N as h, O as H, P as j, Q as U, R as fa, T as _, U as lt, V as rt, W as Lt, X as Qe, Y, Z as Ge, _ as da, a0 as Ye, a1 as he, a2 as ha, a3 as Se, a4 as fi, a5 as Dt, a6 as di, a7 as ma, a8 as _a, a9 as Pe, aa as we, ab as ga, ac as Ft, ad as Nt, ae as me, af as ee, $ as ba, ag as Ce, ah as hi, ai as Ze, aj as St, ak as va, al as xe, am as mi, an as _i, ao as pa, ap as wa, aq as Ca, ar as Ea, as as ya, at as Ta, au as Oa, av as Pt, aw as K, j as nt, ax as Bt, ay as Ra, az as $e, aA as et, aB as ka, aC as gi, aD as bi, aE as tt, A as Wt, aF as Ee, aG as it, aH as Aa, aI as vi, d as Re, aJ as Mt, aK as at, aL as Ia, aM as La, aN as Da, aO as Fa, aP as Na, aQ as Sa, aR as Pa, aS as Be, aT as Ba, aU as Wa, aV as st, aW as oe, aX as ft, aY as ct, aZ as Fi, a_ as M, a$ as V, b0 as pi, b1 as Ma, b2 as Ua, b3 as Va, b4 as ot, b5 as We, b6 as ja, b7 as Ha, b8 as wi, b9 as Ka, ba as ut, bb as qa } from "./main_379f7152_3.0.0.js"; import { W as za, C as Ja, V as Xa, a as Qa } from "./ValidationAlert_f97e5664_3.0.0.js"; import { detectSingleFace as Ga, matchDimensions as Ya, resizeResults as Za, Box as xa } from "./face_api_0e3ce8c8_3.0.0.js"; function $a(i) { let e, t, s, o; return t = new za({}), { c() { e = C("div"), ge(t.$$.fragment), this.c = x, m(e, "id", "face-oval"), m(e, "class", s = "loader " + /*loading*/ (i[0] ? "loading" : "") + " z-10"), m( e, "style", /*styleVars*/ i[1] ); }, m(n, l) { L(n, e, l), be(t, e, null), o = !0; }, p(n, [l]) { (!o || l & /*loading*/ 1 && s !== (s = "loader " + /*loading*/ (n[0] ? "loading" : "") + " z-10")) && m(e, "class", s), (!o || l & /*styleVars*/ 2) && m( e, "style", /*styleVars*/ n[1] ); }, i(n) { o || (J(t.$$.fragment, n), o = !0); }, o(n) { Z(t.$$.fragment, n), o = !1; }, d(n) { n && S(e), ve(t); } }; } const es = "hsl(var(--p))", ts = "hsl(var(--su))"; function is(i, e, t) { let s, o, n; I(i, Ne, (b) => t(7, o = b)), I(i, Me, (b) => t(8, n = b)); let { loading: l } = e, r, c, u = 0.8, f = 8, v = 0.15; return _e() && (u = 0.65, f = 10, v = 0.25), i.$$set = (b) => { "loading" in b && t(0, l = b.loading); }, i.$$.update = () => { if (i.$$.dirty & /*$videoStore, percentage, ovalHeight, ovalWidth, $ovalDimensions, captureBarPercentage*/ 476 && n) { t(3, c = n.videoHeight * u), t(2, r = c / 1.45), h(Ne, o.width = r, o), h(Ne, o.height = c, o), h(Ne, o.x = (n.videoWidth - o.width) / 2, o); let b = n.videoHeight - n.videoHeight * v; h(Ne, o.y = b - o.height, o); } i.$$.dirty & /*ovalWidth, ovalHeight, borderWidth*/ 44 && t(1, s = ` --oval-width: ${r}px; --oval-height: ${c}px; --border-color: ${es}; --border-color-animation: ${ts}; --oval-border: ${f}px; `); }, [ l, s, r, c, u, f, v, o, n ]; } class Ni extends Ut { constructor(e) { super(), Vt( this, { target: this.shadowRoot, props: Ht(this.attributes), customElement: !0 }, is, $a, jt, { loading: 0 }, null ), e && (e.target && L(e.target, this, e.anchor), e.props && (this.$set(e.props), q())); } static get observedAttributes() { return ["loading"]; } get loading() { return this.$$.ctx[0]; } set loading(e) { this.$$set({ loading: e }), q(); } } customElements.define("face-oval", Ni); function as(i) { let e; return { c() { e = C("div"), this.c = x, m(e, "class", "video-overlay z-0"), m( e, "style", /*styleVars*/ i[0] ); }, m(t, s) { L(t, e, s); }, p(t, [s]) { s & /*styleVars*/ 1 && m( e, "style", /*styleVars*/ t[0] ); }, i: x, o: x, d(t) { t && S(e); } }; } function ss(i, e, t) { let s, o; I(i, Me, (f) => t(6, o = f)); let n, l, r = 0.8, { overlayColor: c } = e, { overlayTransparency: u } = e; return _e() && (r = 0.65), i.$$set = (f) => { "overlayColor" in f && t(1, c = f.overlayColor), "overlayTransparency" in f && t(2, u = f.overlayTransparency); }, i.$$.update = () => { i.$$.dirty & /*$videoStore, percentage, ovalHeight*/ 112 && o && (t(4, l = o.videoHeight * r), t(3, n = l / 1.45)), i.$$.dirty & /*ovalWidth, ovalHeight, overlayColor, overlayTransparency*/ 30 && t(0, s = ` --oval-width: ${n}px; --oval-height: ${l}px; --overlay-color: ${c}; --overlay-transparency: ${u}; `); }, [ s, c, u, n, l, r, o ]; } class Si extends Ut { constructor(e) { super(), Vt( this, { target: this.shadowRoot, props: Ht(this.attributes), customElement: !0 }, ss, as, jt, { overlayColor: 1, overlayTransparency: 2 }, null ), e && (e.target && L(e.target, this, e.anchor), e.props && (this.$set(e.props), q())); } static get observedAttributes() { return ["overlayColor", "overlayTransparency"]; } get overlayColor() { return this.$$.ctx[1]; } set overlayColor(e) { this.$$set({ overlayColor: e }), q(); } get overlayTransparency() { return this.$$.ctx[2]; } set overlayTransparency(e) { this.$$set({ overlayTransparency: e }), q(); } } customElements.define("overlay-oval", Si); function Ci(i, e, t) { const s = i.slice(); return s[118] = e[t], s; } function Ei(i) { let e, t, s = H(), o, n, l, r, c, u, f, v, b, d, E, g, p, k, T, F, A, B = s && os(i), W = ( /*$ready*/ i[21] && yi(i) ); return d = new Wa({}), g = new Ja({ props: { showConfigButton: ( /*showConfigButton*/ i[4] ), showAutoCaptureButton: ( /*showAutoCaptureButton*/ i[5] ), showCaptureButton: ( /*showCaptureButton*/ i[0] ), showCameraButton: ( /*showCameraButton*/ i[6] ), enableCaptureButton: ( /*enableCaptureButton*/ i[15] ), videoOverlay: ( /*videoOverlay*/ i[8] ), videoOverlayTransparency: ( /*videoOverlayTransparency*/ i[9] ), idrndClosed: ( /*idrndClosed*/ i[17] ), idrndLoading: ( /*idrndLoading*/ i[16] ), waitingIdrndCaptureEvent: ( /*waitingIdrndCaptureEvent*/ i[18] ), handler: ( /*capture*/ i[37] ) } }), { c() { e = C("div"), t = C("div"), B && B.c(), o = U(), n = C("video"), r = U(), c = C("canvas"), u = U(), f = C("div"), v = C("div"), W && W.c(), b = U(), ge(d.$$.fragment), E = U(), ge(g.$$.fragment), m(n, "id", "bry-cc-camera-video-tag"), m(n, "class", l = /*$ready*/ i[21] ? _e() ? "absolute inset-0 -scale-x-100" : "w-full h-full object-cover -scale-x-100" : "w-0 h-0"), n.playsInline = !0, n.muted = !0, n.autoplay = !0, m(c, "id", "bry-ce-detectionsCanvas"), m(c, "class", "absolute top-0 left-0 max-w-full -scale-x-100"), m(t, "class", "overflow-hidden"), st( t, "width", /*$videoStore*/ i[31].videoWidth + "px" ), st( t, "height", /*$videoStore*/ i[31].videoHeight + "px" ), m(v, "class", "flex flex-grow w-full items-center justify-center relative"), m(f, "class", "absolute inset-0 flex flex-col items-center justify-between w-full h-full"), m(e, "class", p = /*$ready*/ i[21] ? "relative" : "relative w-0 h-0"), e.hidden = k = /*$cameraStatusStore*/ i[20] !== j.OK || H() && /*idrndLoading*/ (i[16] || /*idrndClosed*/ i[17] || /*waitingIdrndCaptureEvent*/ i[18]); }, m(R, y) { L(R, e, y), _(e, t), B && B.m(t, null), _(t, o), _(t, n), i[47](n), _(t, r), _(t, c), i[49](c), _(e, u), _(e, f), _(f, v), W && W.m(v, null), _(f, b), be(d, f, null), _(f, E), be(g, f, null), T = !0, F || (A = [ oe( n, "canplay", /*canplay_handler*/ i[48] ), oe( n, "play", /*play*/ i[10], { once: !0 } ) ], F = !0); }, p(R, y) { s && B.p(R, y), (!T || y[0] & /*$ready*/ 2097152 && l !== (l = /*$ready*/ R[21] ? _e() ? "absolute inset-0 -scale-x-100" : "w-full h-full object-cover -scale-x-100" : "w-0 h-0")) && m(n, "class", l), (!T || y[1] & /*$videoStore*/ 1) && st( t, "width", /*$videoStore*/ R[31].videoWidth + "px" ), (!T || y[1] & /*$videoStore*/ 1) && st( t, "height", /*$videoStore*/ R[31].videoHeight + "px" ), /*$ready*/ R[21] ? W ? (W.p(R, y), y[0] & /*$ready*/ 2097152 && J(W, 1)) : (W = yi(R), W.c(), J(W, 1), W.m(v, null)) : W && (lt(), Z(W, 1, 1, () => { W = null; }), rt()); const X = {}; y[0] & /*showConfigButton*/ 16 && (X.showConfigButton = /*showConfigButton*/ R[4]), y[0] & /*showAutoCaptureButton*/ 32 && (X.showAutoCaptureButton = /*showAutoCaptureButton*/ R[5]), y[0] & /*showCaptureButton*/ 1 && (X.showCaptureButton = /*showCaptureButton*/ R[0]), y[0] & /*showCameraButton*/ 64 && (X.showCameraButton = /*showCameraButton*/ R[6]), y[0] & /*enableCaptureButton*/ 32768 && (X.enableCaptureButton = /*enableCaptureButton*/ R[15]), y[0] & /*videoOverlay*/ 256 && (X.videoOverlay = /*videoOverlay*/ R[8]), y[0] & /*videoOverlayTransparency*/ 512 && (X.videoOverlayTransparency = /*videoOverlayTransparency*/ R[9]), y[0] & /*idrndClosed*/ 131072 && (X.idrndClosed = /*idrndClosed*/ R[17]), y[0] & /*idrndLoading*/ 65536 && (X.idrndLoading = /*idrndLoading*/ R[16]), y[0] & /*waitingIdrndCaptureEvent*/ 262144 && (X.waitingIdrndCaptureEvent = /*waitingIdrndCaptureEvent*/ R[18]), g.$set(X), (!T || y[0] & /*$ready*/ 2097152 && p !== (p = /*$ready*/ R[21] ? "relative" : "relative w-0 h-0")) && m(e, "class", p), (!T || y[0] & /*$cameraStatusStore, idrndLoading, idrndClosed, waitingIdrndCaptureEvent*/ 1507328 && k !== (k = /*$cameraStatusStore*/ R[20] !== j.OK || H() && /*idrndLoading*/ (R[16] || /*idrndClosed*/ R[17] || /*waitingIdrndCaptureEvent*/ R[18]))) && (e.hidden = k); }, i(R) { T || (J(W), J(d.$$.fragment, R), J(g.$$.fragment, R), T = !0); }, o(R) { Z(W), Z(d.$$.fragment, R), Z(g.$$.fragment, R), T = !1; }, d(R) { R && S(e), B && B.d(), i[47](null), i[49](null), W && W.d(), ve(d), ve(g), F = !1, ft(A); } }; } function os(i) { let e; return { c() { e = C("idlive-face-capture"), e.hidden = !0, We(e, "mask_hidden", ""), We(e, "auto_capture_disabled", ""), We(e, "auto_close_disabled", ""), We( e, "device_id", /*$selectedVideoDeviceId*/ i[22] ); }, m(t, s) { L(t, e, s), i[46](e); }, p(t, s) { s[0] & /*$selectedVideoDeviceId*/ 4194304 && We( e, "device_id", /*$selectedVideoDeviceId*/ t[22] ); }, d(t) { t && S(e), i[46](null); } }; } function yi(i) { let e, t, s, o, n, l; return e = new Xa({ props: { isCountingDown: ( /*isCountingDown*/ i[14] ) } }), s = new Ni({ props: { loading: ( /*isCountingDown*/ i[14] ) } }), n = new Si({ props: { overlayColor: ( /*videoOverlay*/ i[8] ), overlayTransparency: ( /*videoOverlayTransparency*/ i[9] ) } }), { c() { ge(e.$$.fragment), t = U(), ge(s.$$.fragment), o = U(), ge(n.$$.fragment); }, m(r, c) { be(e, r, c), L(r, t, c), be(s, r, c), L(r, o, c), be(n, r, c), l = !0; }, p(r, c) { const u = {}; c[0] & /*isCountingDown*/ 16384 && (u.isCountingDown = /*isCountingDown*/ r[14]), e.$set(u); const f = {}; c[0] & /*isCountingDown*/ 16384 && (f.loading = /*isCountingDown*/ r[14]), s.$set(f); const v = {}; c[0] & /*videoOverlay*/ 256 && (v.overlayColor = /*videoOverlay*/ r[8]), c[0] & /*videoOverlayTransparency*/ 512 && (v.overlayTransparency = /*videoOverlayTransparency*/ r[9]), n.$set(v); }, i(r) { l || (J(e.$$.fragment, r), J(s.$$.fragment, r), J(n.$$.fragment, r), l = !0); }, o(r) { Z(e.$$.fragment, r), Z(s.$$.fragment, r), Z(n.$$.fragment, r), l = !1; }, d(r) { ve(e, r), r && S(t), ve(s, r), r && S(o), ve(n, r); } }; } function Ti(i) { let e, t, s, o, n; function l(u, f) { return ( /*$isLoading*/ u[32] ? ls : ns ); } let r = l(i), c = r(i); return { c() { e = C("slot"), t = C("div"), s = C("img"), n = U(), c.c(), ct(s.src, o = Fi) || m(s, "src", o), m(s, "alt", "loading gif"), m(s, "class", "m-auto h-[10em] lg:h-[12em]"), m(t, "class", "translate-y-1/3 md:translate-y-1/4 xl:translate-y-1/2"), m(e, "name", "obtaining-photo-gif"), m(e, "class", "block h-[17em] lg:h-[21.6em] xl:h-[30em]"); }, m(u, f) { L(u, e, f), _(e, t), _(t, s), _(t, n), c.m(t, null); }, p(u, f) { r === (r = l(u)) && c ? c.p(u, f) : (c.d(1), c = r(u), c && (c.c(), c.m(t, null))); }, d(u) { u && S(e), c.d(); } }; } function ns(i) { let e, t = ( /*$_*/ i[28]("faceCollector.obtainingPicture") + "" ), s; return { c() { e = C("span"), s = M(t), m(e, "class", "2xl:text-2xl lg:text-2xl text-md block p-2 m-auto text-center"); }, m(o, n) { L(o, e, n), _(e, s); }, p(o, n) { n[0] & /*$_*/ 268435456 && t !== (t = /*$_*/ o[28]("faceCollector.obtainingPicture") + "") && V(s, t); }, d(o) { o && S(e); } }; } function ls(i) { let e; return { c() { e = C("span"), e.textContent = "Obtaining photo...", m(e, "class", "2xl:text-2xl lg:text-2xl text-md block p-2 m-auto text-center"); }, m(t, s) { L(t, e, s); }, p: x, d(t) { t && S(e); } }; } function Oi(i) { let e, t, s, o, n; function l(u, f) { return ( /*$isLoading*/ u[32] ? cs : rs ); } let r = l(i), c = r(i); return { c() { e = C("slot"), t = C("div"), s = C("img"), n = U(), c.c(), ct(s.src, o = Fi) || m(s, "src", o), m(s, "alt", "loading gif"), m(s, "class", "m-auto h-[10em] lg:h-[12em]"), m(t, "class", "translate-y-1/3 md:translate-y-1/4 xl:translate-y-1/2"), m(e, "name", "loading-camera-gif"), m(e, "class", "block h-[17em] lg:h-[21.6em] xl:h-[30em]"); }, m(u, f) { L(u, e, f), _(e, t), _(t, s), _(t, n), c.m(t, null); }, p(u, f) { r === (r = l(u)) && c ? c.p(u, f) : (c.d(1), c = r(u), c && (c.c(), c.m(t, null))); }, d(u) { u && S(e), c.d(); } }; } function rs(i) { let e, t = ( /*$_*/ i[28]("faceCollector.initiatingCamera") + "" ), s; return { c() { e = C("span"), s = M(t), m(e, "class", "2xl:text-2xl lg:text-2xl text-md block p-2 m-auto text-center"); }, m(o, n) { L(o, e, n), _(e, s); }, p(o, n) { n[0] & /*$_*/ 268435456 && t !== (t = /*$_*/ o[28]("faceCollector.initiatingCamera") + "") && V(s, t); }, d(o) { o && S(e); } }; } function cs(i) { let e; return { c() { e = C("span"), e.textContent = "Loading camera...", m(e, "class", "2xl:text-2xl lg:text-2xl text-md block p-2 m-auto text-center"); }, m(t, s) { L(t, e, s); }, p: x, d(t) { t && S(e); } }; } function Ri(i) { let e, t, s = ( /*$_*/ i[28]("faceCollector.finish") + "" ), o, n, l, r, c = ( /*$_*/ i[28]("faceCollector.retakePhoto") + "" ), u, f, v; return { c() { e = C("div"), t = C("button"), o = M(s), l = U(), r = C("button"), u = M(c), t.disabled = n = /*$justification*/ i[25].length === 0, m(t, "class", "ce-dui-btn ce-dui-btn-primary ce-dui-btn-block flex-shrink"), m(r, "id", "bry-cc-retake-button"), m(r, "class", "ce-dui-btn ce-dui-btn-block ce-dui-btn-outline flex-shrink"), m(e, "class", "ce-dui-btn-group flex"); }, m(b, d) { L(b, e, d), _(e, t), _(t, o), _(e, l), _(e, r), _(r, u), f || (v = [ oe( t, "click", /*click_handler*/ i[50] ), oe( r, "click", /*click_handler_1*/ i[51] ) ], f = !0); }, p(b, d) { d[0] & /*$_*/ 268435456 && s !== (s = /*$_*/ b[28]("faceCollector.finish") + "") && V(o, s), d[0] & /*$justification*/ 33554432 && n !== (n = /*$justification*/ b[25].length === 0) && (t.disabled = n), d[0] & /*$_*/ 268435456 && c !== (c = /*$_*/ b[28]("faceCollector.retakePhoto") + "") && V(u, c); }, d(b) { b && S(e), f = !1, ft(v); } }; } function us(i) { let e, t; return e = new Qa({ props: { handler: ( /*func*/ i[60] ) } }), { c() { ge(e.$$.fragment); }, m(s, o) { be(e, s, o), t = !0; }, p: x, i(s) { t || (J(e.$$.fragment, s), t = !0); }, o(s) { Z(e.$$.fragment, s), t = !1; }, d(s) { ve(e, s); } }; } function fs(i) { let e, t, s, o, n, l, r, c, u; const f = [ gs, _s, ms, hs, ds ], v = []; function b(d, E) { return ( /*$captured*/ d[23] ? ( /*$unconformitiesStore*/ d[29].isLoading ? 1 : ( /*$requestResult*/ d[27] !== K.OK ? 2 : ( /*$saved*/ d[24] ? 4 : 3 ) ) ) : 0 ); } return l = b(i), r = v[l] = f[l](i), { c() { e = C("div"), t = C("img"), n = U(), r.c(), m(t, "class", "m-auto col-start-1 col-end-1 max-h-[23.2em]"), ct(t.src, s = /*$dataTypePrefix*/ i[30] + "," + /*$image*/ i[26]) || m(t, "src", s), t.hidden = o = !/*$captured*/ i[23] || !/*$showFaceWhileValidating*/ i[33] && /*$unconformitiesStore*/ i[29].isLoading, m(t, "alt", ""), m(e, "class", c = "grid-cols-1 grid-rows-2 sm:grid-cols-2 sm:grid-rows-1 gap-[.5em] " + (!/*$showFaceWhileValidating*/ i[33] && /*$unconformitiesStore*/ i[29].isLoading ? "absolute -translate-y-1/2 -translate-x-1/2 top-1/2 left-1/2 overflow-visible" : "grid overflow-hidden")); }, m(d, E) { L(d, e, E), _(e, t), _(e, n), v[l].m(e, null), u = !0; }, p(d, E) { (!u || E[0] & /*$dataTypePrefix, $image*/ 1140850688 && !ct(t.src, s = /*$dataTypePrefix*/ d[30] + "," + /*$image*/ d[26])) && m(t, "src", s), (!u || E[0] & /*$captured, $unconformitiesStore*/ 545259520 | E[1] & /*$showFaceWhileValidating*/ 4 && o !== (o = !/*$captured*/ d[23] || !/*$showFaceWhileValidating*/ d[33] && /*$unconformitiesStore*/ d[29].isLoading)) && (t.hidden = o); let g = l; l = b(d), l === g ? v[l].p(d, E) : (lt(), Z(v[g], 1, 1, () => { v[g] = null; }), rt(), r = v[l], r ? r.p(d, E) : (r = v[l] = f[l](d), r.c()), J(r, 1), r.m(e, null)), (!u || E[0] & /*$unconformitiesStore*/ 536870912 | E[1] & /*$showFaceWhileValidating*/ 4 && c !== (c = "grid-cols-1 grid-rows-2 sm:grid-cols-2 sm:grid-rows-1 gap-[.5em] " + (!/*$showFaceWhileValidating*/ d[33] && /*$unconformitiesStore*/ d[29].isLoading ? "absolute -translate-y-1/2 -translate-x-1/2 top-1/2 left-1/2 overflow-visible" : "grid overflow-hidden"))) && m(e, "class", c); }, i(d) { u || (J(r), u = !0); }, o(d) { Z(r), u = !1; }, d(d) { d && S(e), v[l].d(); } }; } function ds(i) { let e, t, s = ( /*$_*/ i[28]("faceCollector.captured") + "" ), o, n, l, r, c, u = ( /*$_*/ i[28]("faceCollector.retakePhoto") + "" ), f, v, b = nt(ja).faceStrategy !== Ha.DISABLED, d, E, g, p = ( /*$unconformitiesStore*/ i[29].unconformities.length !== 0 && ki(i) ), k = b && bs(); return { c() { e = C("div"), t = C("h1"), o = M(s), n = U(), p && p.c(), l = U(), r = C("div"), c = C("button"), f = M(u), v = U(), k && k.c(), m(t, "class", "text-3xl font-bold pb-[1em] transition-opacity"), m(c, "id", "bry-cc-retake-button"), m(c, "class", "ce-dui-btn ce-dui-btn-block flex-shrink text-base"), m(r, "class", "flex flex-row"), wi(r, "ce-dui-btn-group", !/*$exportButtonDisabled*/ i[34]); }, m(T, F) { L(T, e, F), _(e, t), _(t, o), _(e, n), p && p.m(e, null), _(e, l), _(e, r), _(r, c), _(c, f), _(r, v), k && k.m(r, null), d = !0, E || (g = oe( c, "click", /*click_handler_6*/ i[59] ), E = !0); }, p(T, F) { (!d || F[0] & /*$_*/ 268435456) && s !== (s = /*$_*/ T[28]("faceCollector.captured") + "") && V(o, s), /*$unconformitiesStore*/ T[29].unconformities.length !== 0 ? p ? p.p(T, F) : (p = ki(T), p.c(), p.m(e, l)) : p && (p.d(1), p = null), (!d || F[0] & /*$_*/ 268435456) && u !== (u = /*$_*/ T[28]("faceCollector.retakePhoto") + "") && V(f, u), (!d || F[1] & /*$exportButtonDisabled*/ 8) && wi(r, "ce-dui-btn-group", !/*$exportButtonDisabled*/ T[34]); }, i(T) { d || (J(k), d = !0); }, o(T) { Z(k), d = !1; }, d(T) { T && S(e), p && p.d(), k && k.d(), E = !1, g(); } }; } function hs(i) { let e, t, s = ( /*evaluatePhoto*/ (i[2] ? ( /*$unconformitiesStore*/ i[29].unconformities.length === 0 ? ( /*$_*/ i[28]("faceCollector.everythingOk") ) : ( /*$_*/ i[28]("faceCollector.unconformities") ) ) : ( /*$_*/ i[28]("faceCollector.previewCapture") )) + "" ), o, n, l, r, c, u, f = ( /*$unconformitiesStore*/ i[29].unconformities ), v = []; for (let g = 0; g < f.length; g += 1) v[g] = Ai(Ci(i, f, g)); let b = ( /*evaluatePhoto*/ i[2] && /*$unconformitiesStore*/ i[29].unconformities.length == 0 && Ii(i) ), d = ( /*showJustificationField*/ i[7] && /*$unconformitiesStore*/ i[29].unconformities.length > 0 && Li(i) ), E = ( /*$captured*/ i[23] && Di(i) ); return { c() { e = C("div"), t = C("h1"), o = M(s), n = U(), l = C("div"); for (let g = 0; g < v.length; g += 1) v[g].c(); r = U(), b && b.c(), c = U(), d && d.c(), u = U(), E && E.c(), m(t, "class", "text-3xl font-bold transition-opacity"), m(l, "class", "flex flex-wrap"), m(e, "class", "flex flex-col justify-between"); }, m(g, p) { L(g, e, p), _(e, t), _(t, o), _(e, n), _(e, l); for (let k = 0; k < v.length; k += 1) v[k] && v[k].m(l, null); _(l, r), b && b.m(l, null), _(e, c), d && d.m(e, null), _(e, u), E && E.m(e, null); }, p(g, p) { if (p[0] & /*evaluatePhoto, $unconformitiesStore, $_*/ 805306372 && s !== (s = /*evaluatePhoto*/ (g[2] ? ( /*$unconformitiesStore*/ g[29].unconformities.length === 0 ? ( /*$_*/ g[28]("faceCollector.everythingOk") ) : ( /*$_*/ g[28]("faceCollector.unconformities") ) ) : ( /*$_*/ g[28]("faceCollector.previewCapture") )) + "") && V(o, s), p[0] & /*$unconformitiesStore*/ 536870912) { f = /*$unconformitiesStore*/ g[29].unconformities; let k; for (k = 0; k < f.length; k += 1) { const T = Ci(g, f, k); v[k] ? v[k].p(T, p) : (v[k] = Ai(T), v[k].c(), v[k].m(l, r)); } for (; k < v.length; k += 1) v[k].d(1); v.length = f.length; } /*evaluatePhoto*/ g[2] && /*$unconformitiesStore*/ g[29].unconformities.length == 0 ? b ? b.p(g, p) : (b = Ii(g), b.c(), b.m(l, null)) : b && (b.d(1), b = null), /*showJustificationField*/ g[7] && /*$unconformitiesStore*/ g[29].unconformities.length > 0 ? d ? d.p(g, p) : (d = Li(g), d.c(), d.m(e, u)) : d && (d.d(1), d = null), /*$captured*/ g[23] ? E ? E.p(g, p) : (E = Di(g), E.c(), E.m(e, null)) : E && (E.d(1), E = null); }, i: x, o: x, d(g) { g && S(e), Ka(v, g), b && b.d(), d && d.d(), E && E.d(); } }; } function ms(i) { let e, t, s, o, n = ( /*$_*/ i[28]("faceCollector.finish") + "" ), l, r, c, u = ( /*$_*/ i[28]("faceCollector.retakePhoto") + "" ), f, v, b; function d(p, k) { return ( /*$requestResult*/ p[27] === K.LIVENESS_DETECTION_FAILURE || /*$requestResult*/ p[27] === K.UNKNOWN_LIVENESS_ERROR ? ys : ( /*$requestResult*/ p[27] === K.LOW_LIVENESS_SCORE ? Es : ( /*$requestResult*/ p[27] === K.TEMPLATE_EXTRACTION_ERROR || /*$requestResult*/ p[27] === K.UNKNOWN_TEMPLATE_EXTRACTION_ERROR ? Cs : ( /*$requestResult*/ p[27] === K.UNABLE_TO_COMMUNICATE_WITH_TEMPLATE_EXTRACTION_SERVICE ? ws : ( /*$requestResult*/ p[27] === K.LIVENESS_EVALUATION_ERROR ? ps : vs ) ) ) ) ); } let E = d(i), g = E(i); return { c() { e = C("div"), g.c(), t = U(), s = C("div"), o = C("button"), l = M(n), r = U(), c = C("button"), f = M(u), o.disabled = !0, m(o, "class", "ce-dui-btn ce-dui-btn-primary ce-dui-btn-block flex-shrink"), m(c, "id", "bry-cc-retake-button"), m(c, "class", "ce-dui-btn ce-dui-btn-block ce-dui-btn-outline flex-shrink"), m(s, "class", "ce-dui-btn-group flex"), m(e, "class", "flex flex-col justify-between"); }, m(p, k) { L(p, e, k), g.m(e, null), _(e, t), _(e, s), _(s, o), _(o, l), _(s, r), _(s, c), _(c, f), v || (b = [ oe( o, "click", /*click_handler_2*/ i[53] ), oe( c, "click", /*click_handler_3*/ i[54] ) ], v = !0); }, p(p, k) { E === (E = d(p)) && g ? g.p(p, k) : (g.d(1), g = E(p), g && (g.c(), g.m(e, t))), k[0] & /*$_*/ 268435456 && n !== (n = /*$_*/ p[28]("faceCollector.finish") + "") && V(l, n), k[0] & /*$_*/ 268435456 && u !== (u = /*$_*/ p[28]("faceCollector.retakePhoto") + "") && V(f, u); }, i: x, o: x, d(p) { p && S(e), g.d(), v = !1, ft(b); } }; } function _s(i) { let e, t, s = ( /*$_*/ i[28]("faceCollector.validating") + "" ), o, n, l; return { c() { e = C("div"), t = C("h1"), o = M(s), n = U(), l = C("div"), m(t, "class", "inline-block text-3xl font-bold pb-[1em] transition-opacity"), m(l, "class", "ml-6 inline-block dot-typing"), m(e, "class", "min-w-[200px]"); }, m(r, c) { L(r, e, c), _(e, t), _(t, o), _(e, n), _(e, l); }, p(r, c) { c[0] & /*$_*/ 268435456 && s !== (s = /*$_*/ r[28]("faceCollector.validating") + "") && V(o, s); }, i: x, o: x, d(r) { r && S(e); } }; } function gs(i) { let e; return { c() { e = C("div"), m(e, "class", ""); }, m(t, s) { L(t, e, s); }, p: x, i: x, o: x, d(t) { t && S(e); } }; } function ki(i) { let e, t, s = ( /*$_*/ i[28]("faceCollector.justification") + "" ), o, n, l, r, c; return { c() { e = C("label"), t = C("span"), o = M(s), n = U(), l = C("textarea"), m(t, "class", "ce-dui-label-text text-base"), m(e, "class", "ce-dui-label"), m(e, "for", "justification"), m(l, "contenteditable", ""), m(l, "id", "justification"), m(l, "class", "ce-dui-textarea ce-dui-textarea-bordered textarea-ghost h-[6em] w-full text-base"); }, m(u, f) { L(u, e, f), _(e, t), _(t, o), L(u, n, f), L(u, l, f), ut( l, /*$justification*/ i[25] ), r || (c = oe( l, "input", /*textarea_input_handler_1*/ i[58] ), r = !0); }, p(u, f) { f[0] & /*$_*/ 268435456 && s !== (s = /*$_*/ u[28]("faceCollector.justification") + "") && V(o, s), f[0] & /*$justification*/ 33554432 && ut( l, /*$justification*/ u[25] ); }, d(u) { u && S(e), u && S(n), u && S(l), r = !1, c(); } }; } function bs(i) { let e, t; return e = new qa({ props: { cssClass: "ce-dui-btn-block flex-shrink" } }), { c() { ge(e.$$.fragment); }, m(s, o) { be(e, s, o), t = !0; }, i(s) { t || (J(e.$$.fragment, s), t = !0); }, o(s) { Z(e.$$.fragment, s), t = !1; }, d(s) { ve(e, s); } }; } function Ai(i) { let e, t = ( /*unconformity*/ i[118] + "" ), s; return { c() { e = C("div"), s = M(t), m(e, "class", "ce-dui-badge ce-dui-badge-lg h-[2em] ce-dui-badge-error text-xl pb-[.25em] m-[.5em]"); }, m(o, n) { L(o, e, n), _(e, s); }, p(o, n) { n[0] & /*$unconformitiesStore*/ 536870912 && t !== (t = /*unconformity*/ o[118] + "") && V(s, t); }, d(o) { o && S(e); } }; } function Ii(i) { let e, t = ( /*$_*/ i[28]("faceCollector.noNonconformity") + "" ), s; return { c() { e = C("div"), s = M(t), m(e, "class", "ce-dui-badge ce-dui-badge-lg h-[2em] ce-dui-badge-info text-xl pb-[.25em] m-[.5em]"); }, m(o, n) { L(o, e, n), _(e, s); }, p(o, n) { n[0] & /*$_*/ 268435456 && t !== (t = /*$_*/ o[28]("faceCollector.noNonconformity") + "") && V(s, t); }, d(o) { o && S(e); } }; } function Li(i) { let e, t, s, o = ( /*$_*/ i[28]("faceCollector.provideAReasonForTheLowQualityCapture") + "" ), n, l, r, c, u, f, v, b, d = ( /*$_*/ i[28]("faceCollector.thisInformationIsRequired") + "" ), E, g, p, k; return { c() { e = C("div"), t = C("label"), s = C("span"), n = M(o), l = U(), r = C("textarea"), u = U(), f = C("label"), v = C("span"), b = M("("), E = M(d), g = M(")"), m(s, "class", "ce-dui-label-text text-base"), m(t, "class", "ce-dui-label"), m(t, "for", "justification"), m(r, "contenteditable", ""), m(r, "id", "justification"), m(r, "class", "ce-dui-textarea ce-dui-textarea-bordered h-[6em] text-base"), m(r, "placeholder", c = /*$_*/ i[28]("faceCollector.yourJustification")), m(v, "class", "ce-dui-label-text-alt text-base"), m(f, "class", "ce-dui-label"), m(f, "for", "justification"), m(e, "class", "ce-dui-form-control"); }, m(T, F) { L(T, e, F), _(e, t), _(t, s), _(s, n), _(e, l), _(e, r), ut( r, /*$justification*/ i[25] ), _(e, u), _(e, f), _(f, v), _(v, b), _(v, E), _(v, g), p || (k = oe( r, "input", /*textarea_input_handler*/ i[55] ), p = !0); }, p(T, F) { F[0] & /*$_*/ 268435456 && o !== (o = /*$_*/ T[28]("faceCollector.provideAReasonForTheLowQualityCapture") + "") && V(n, o), F[0] & /*$_*/ 268435456 && c !== (c = /*$_*/ T[28]("faceCollector.yourJustification")) && m(r, "placeholder", c), F[0] & /*$justification*/ 33554432 && ut( r, /*$justification*/ T[25] ), F[0] & /*$_*/ 268435456 && d !== (d = /*$_*/ T[28]("faceCollector.thisInformationIsRequired") + "") && V(E, d); }, d(T) { T && S(e), p = !1, k(); } }; } function Di(i) { let e, t, s = ( /*$_*/ i[28]("faceCollector.finish") + "" ), o, n, l, r, c = ( /*$_*/ i[28]("faceCollector.retakePhoto") + "" ), u, f, v; return { c() { e = C("div"), t = C("button"), o = M(s), l = U(), r = C("button"), u = M(c), t.disabled = n = /*evaluatePhoto*/ i[2] && /*showJustificationField*/ i[7] && /*$justification*/ i[25].length === 0 && /*$unconformitiesStore*/ i[29].unconformities.length !== 0, m(t, "class", "ce-dui-btn ce-dui-btn-primary ce-dui-btn-block flex-shrink text-base"), m(r, "id", "bry-cc-retake-button"), m(r, "class", "ce-dui-btn ce-dui-btn-block ce-dui-btn-outline flex-shrink text-base"), m(e, "class", "ce-dui-btn-group flex"); }, m(b, d) { L(b, e, d), _(e, t), _(t, o), _(e, l), _(e, r), _(r, u), f || (v = [ oe( t, "click", /*click_handler_4*/ i[56] ), oe( r, "click", /*click_handler_5*/ i[57] ) ], f = !0); }, p(b, d) { d[0] & /*$_*/ 268435456 && s !== (s = /*$_*/ b[28]("faceCollector.finish") + "") && V(o, s), d[0] & /*evaluatePhoto, showJustificationField, $justification, $unconformitiesStore*/ 570425476 && n !== (n = /*evaluatePhoto*/ b[2] && /*showJustificationField*/ b[7] && /*$justification*/ b[25].length === 0 && /*$unconformitiesStore*/ b[29].unconformities.length !== 0) && (t.disabled = n), d[0] & /*$_*/ 268435456 && c !== (c = /*$_*/ b[28]("faceCollector.retakePhoto") + "") && V(u, c); }, d(b) { b && S(e), f = !1, ft(v); } }; } function vs(i) { let e, t = ( /*$_*/ i[28]("faceCollector.everythingOk") + "" ), s; return { c() { e = C("h1"), s = M(t), m(e, "class", "text-3xl font-bold pb-[1em] transition-opacity"); }, m(o, n) { L(o, e, n), _(e, s); }, p(o, n) { n[0] & /*$_*/ 268435456 && t !== (t = /*$_*/ o[28]("faceCollector.everythingOk") + "") && V(s, t); }, d(o) { o && S(e); } }; } function ps(i) { let e, t = ( /*$_*/ i[28]("liveness.error.evaluationError") + "" ), s; return { c() { e = C("h1"), s = M(t), m(e, "class", "text-3xl font-bold pb-[1em] transition-opacity text-error"); }, m(o, n) { L(o, e, n), _(e, s); }, p(o, n) { n[0] & /*$_*/ 268435456 && t !== (t = /*$_*/ o[28]("liveness.error.evaluationError") + "") && V(s, t); }, d(o) { o && S(e); } }; } function ws(i) { let e, t = ( /*$_*/ i[28]("faceCollector.unableToCompleteRequest") + "" ), s; return { c() { e = C("h1"), s = M(t), m(e, "class", "text-3xl font-bold pb-[1em] transition-opacity text-error"); }, m(o, n) { L(o, e, n), _(e, s); }, p(o, n) { n[0] & /*$_*/ 268435456 && t !== (t = /*$_*/ o[28]("faceCollector.unableToCompleteRequest") + "") && V(s, t); }, d(o) { o && S(e); } }; } function Cs(i) { let e, t = ( /*$_*/ i[28]("faceCollector.lowQualityCapture") + "" ), s; return { c() { e = C("h1"), s = M(t), m(e, "class", "text-3xl font-bold pb-[1em] transition-opacity text-error"); }, m(o, n) { L(o, e, n), _(e, s); }, p(o, n) { n[0] & /*$_*/ 268435456 && t !== (t = /*$_*/ o[28]("faceCollector.lowQualityCapture") + "") && V(s, t); }, d(o) { o && S(e); } }; } function Es(i) { let e, t = ( /*$_*/ i[28]("liveness.error.error") + "" ), s, o, n = ( /*$_*/ i[28]("faceCollector.unaliveCapture") + "" ), l; return { c() { e = C("h1"), s = M(t), o = M(": "), l = M(n), m(e, "class", "text-3xl font-bold pb-[1em] transition-opacity text-error"); }, m(r, c) { L(r, e, c), _(e, s), _(e, o), _(e, l); }, p(r, c) { c[0] & /*$_*/ 268435456 && t !== (t = /*$_*/ r[28]("liveness.error.error") + "") && V(s, t), c[0] & /*$_*/ 268435456 && n !== (n = /*$_*/ r[28]("faceCollector.unaliveCapture") + "") && V(l, n); }, d(r) { r && S(e); } }; } function ys(i) { let e, t = ( /*$_*/ i[28]("liveness.error.error") + "" ), s, o, n = ( /*$_*/ i[28]( /*livenessError*/ i[19] ) + "" ), l, r; return { c() { e = C("h1"), s = M(t), o = M(": "), l = M(n), r = M("."), m(e, "class", "text-3xl font-bold pb-[1em] transition-opacity text-error"); }, m(c, u) { L(c, e, u), _(e, s), _(e, o), _(e, l), _(e, r); }, p(c, u) { u[0] & /*$_*/ 268435456 && t !== (t = /*$_*/ c[28]("liveness.error.error") + "") && V(s, t), u[0] & /*$_, livenessError*/ 268959744 && n !== (n = /*$_*/ c[28]( /*livenessError*/ c[19] ) + "") && V(l, n); }, d(c) { c && S(e); } }; } function Ts(i) { let e, t, s, o = H() && /*waitingIdrndCaptureEvent*/ i[18], n, l = (H() && /*idrndLoading*/ (i[16] || !/*$ready*/ i[21]) || !H() && !/*$ready*/ i[21]) && /*$cameraStatusStore*/ i[20] === j.OK, r, c, u, f, v, b, d = ( /*$videoStore*/ i[31] && Ei(i) ), E = o && Ti(i), g = l && Oi(i), p = ( /*$captured*/ i[23] && Ri(i) ); const k = [fs, us], T = []; function F(A, B) { return (!/*idrndClosed*/ A[17] || /*$captured*/ A[23]) && /*showUnconformities*/ A[3] ? 0 : ( /*$cameraStatusStore*/ A[20] !== j.OK ? 1 : -1 ); } return ~(u = F(i)) && (f = T[u] = k[u](i)), { c() { e = C("div"), t = C("div"), d && d.c(), s = U(), E && E.c(), n = U(), g && g.c(), r = U(), p && p.c(), c = U(), f && f.c(), v = fa(), this.c = x, m(t, "class", "relative mx-auto"), m(e, "class", "flex flex-col justify-between"); }, m(A, B) { L(A, e, B), _(e, t), d && d.m(t, null), _(t, s), E && E.m(t, null), _(t, n), g && g.m(t, null), _(t, r), p && p.m(t, null), i[52](e), L(A, c, B), ~u && T[u].m(A, B), L(A, v, B), b = !0; }, p(A, B) { /*$videoStore*/ A[31] ? d ? (d.p(A, B), B[1] & /*$videoStore*/ 1 && J(d, 1)) : (d = Ei(A), d.c(), J(d, 1), d.m(t, s)) : d && (lt(), Z(d, 1, 1, () => { d = null; }), rt()), B[0] & /*waitingIdrndCaptureEvent*/ 262144 && (o = H() && /*waitingIdrndCaptureEvent*/ A[18]), o ? E ? E.p(A, B) : (E = Ti(A), E.c(), E.m(t, n)) : E && (E.d(1), E = null), B[0] & /*idrndLoading, $ready, $cameraStatusStore*/ 3211264 && (l = (H() && /*idrndLoading*/ (A[16] || !/*$ready*/ A[21]) || !H() && !/*$ready*/ A[21]) && /*$cameraStatusStore*/ A[20] === j.OK), l ? g ? g.p(A, B) : (g = Oi(A), g.c(), g.m(t, r)) : g && (g.d(1), g = null), /*$captured*/ A[23] ? p ? p.p(A, B) : (p = Ri(A), p.c(), p.m(t, null)) : p && (p.d(1), p = null); let W = u; u = F(A), u === W ? ~u && T[u].p(A, B) : (f && (lt(), Z(T[W], 1, 1, () => { T[W] = null; }), rt()), ~u ? (f = T[u], f ? f.p(A, B) : (f = T[u] = k[u](A), f.c()), J(f, 1), f.m(v.parentNode, v)) : f = null); }, i(A) { b || (J(d), J(f), b = !0); }, o(A) { Z(d), Z(f), b = !1; }, d(A) { A && S(e), d && d.d(), E && E.d(), g && g.d(), p && p.d(), i[52](null), A && S(c), ~u && T[u].d(A), A && S(v); } }; } let Os = 0, Rs = 3e3; function ks() { ({}).VITE_USE_DEV === "true" ? import("./index-no-detector_281a271b_3.0.0.js") : import("./index-no-detector_56051121_3.0.0.js"); } function As(i, e, t) { const s = e.videoWidth / e.videoHeight, o = t.width / t.height; let n = 0, l = 0, r = e.videoWidth, c = e.videoHeight; s > o ? (r = e.videoHeight * o, n = (e.videoWidth - r) / 2) : s < o && (c = e.videoWidth / o, l = (e.videoHeight - c) / 2), i.drawImage(e, n, l, r, c, 0, 0, t.width, t.height); } function Is(i, e, t) { let s, o, n, l, r, c, u, f, v, b, d, E, g, p, k, T, F, A, B, W, R, y, X, $, ce, le, ke, dt, ae, Kt, ht, mt, _t, qt, zt, Jt; I(i, Lt, (a) => t(73, s = a)), I(i, Qe, (a) => t(75, n = a)), I(i, Y, (a) => t(20, l = a)), I(i, Ge, (a) => t(21, r = a)), I(i, da, (a) => t(76, c = a)), I(i, Ye, (a) => t(77, u = a)), I(i, he, (a) => t(22, f = a)), I(i, ha, (a) => t(78, v = a)), I(i, Se, (a) => t(23, b = a)), I(i, fi, (a) => t(79, d = a)), I(i, Dt, (a) => t(80, E = a)), I(i, di, (a) => t(81, g = a)), I(i, ma, (a) => t(82, p = a)), I(i, _a, (a) => t(83, k = a)), I(i, Pe, (a) => t(84, T = a)), I(i, we, (a) => t(85, F = a)), I(i, ga, (a) => t(86, A = a)), I(i, Ft, (a) => t(24, B = a)), I(i, Nt, (a) => t(25, W = a)), I(i, me, (a) => t(26, R = a)), I(i, ee, (a) => t(27, y = a)), I(i, ba, (a) => t(28, X = a)), I(i, Ce, (a) => t(29, $ = a)), I(i, hi, (a) => t(87, le = a)), I(i, Ze, (a) => t(88, ke = a)), I(i, St, (a) => t(89, dt = a)), I(i, Me, (a) => t(31, ae = a)), I(i, va, (a) => t(90, Kt = a)), I(i, xe, (a) => t(91, ht = a)), I(i, mi, (a) => t(92, mt = a)), I(i, _i, (a) => t(93, _t = a)), I(i, pa, (a) => t(32, qt = a)), I(i, wa, (a) => t(33, zt = a)), I(i, Ca, (a) => t(34, Jt = a)); let D, te, ue, Xt, Qt = !1, Ae = !1, gt = !1, bt = !1, vt = (/* @__PURE__ */ new Date()).getTime(), pt = { width: 1280, height: 720 }, { enableMinutiae: wt } = e, { videoDimensions: Ct } = e, { noTabs: Et } = e, { weightsPath: yt } = e, { evaluatePhoto: fe } = e, { showCaptureButton: Tt } = e, { showUnconformities: Gt } = e, { showConfigButton: Yt } = e, { showAutoCaptureButton: Ot } = e, { showCameraButton: Zt } = e, { showJustificationField: xt } = e, { minEyeToEyeDist: Ie } = e, { videoOverlay: $t } = e, { videoOverlayTransparency: ei } = e; const Ue = pi(!1); I(i, Ue, (a) => t(74, o = a)); const Le = pi("data:image/png;base64"); I(i, Le, (a) => t(30, ce = a)); let { widgetInstance: Q } = e, De = !1, Rt = !1, Ve = !0, ne = !0, ye = !1, ti = 0, ie = "", kt = 0, je = !0, ii = 0; const He = Ea.mixin({ toast: !0, position: "bottom-left", timer: 13e3, timerProgressBar: !0 }); ya(async () => { if (h(Ze, ke = !0, ke), h(Ge, r = !1, r), si(), le) try { await Ta(yt), Qt = !0, Xt = await Oa(); } catch { h(hi, le = !1, le), t(0, Tt = !0); } H() ? (ks(), Pi()) : await pe(), _e() || Wi(); }); async function ai() { const [a, w] = (Ct ?? "")?.replaceAll(" ", "")?.split("x")?.map((O) => O ? parseInt(O) : void 0); !a || !w || (_e() ? (await Ma(), h( Me, ae = { videoWidth: window.innerWidth, videoHeight: window.innerHeight }, ae )) : h(Me, ae = { videoWidth: a, videoHeight: w }, ae)); } function si() { h(Qe, n = !1, n), h(Se, b = !1, b), h(Ye, u = Pt.FRONT_CAMERA, u), Ot && h(di, g = !1, g), h(Ft, B = !1, B), h(ee, y = K.OK, y), h(Pe, T = "", T), h(Ce, $.unconformities = [], $); const a = nt(Bt); a.closedMouth = !1, a.isPersonCloseEnough = !1, a.isPersonTooclose = !0, a.isPersonInFrame = !1, Bt.set(a), h(we, F = "", F); } function Pi() { Q.addEventListener("open", (a) => { const w = a.detail[0].video; h( _i, _t = { width: w.videoWidth, height: w.videoHeight }, _t ), t(11, D.srcObject = w.srcObject, D), t(16, Ve = !1), Ra(Q); function O() { ne || Be(D, O, !0); } O(); }), Q.addEventListener("error", (a) => { console.error(a), a.detail[0].message === "Device in use" ? h(Y, l = j.CAMERA_IN_USE_ERROR, l) : a.detail[0].message === "Permission denied" || a.detail[0].message === "Permission dismissed" ? h(Y, l = j.CAMERA_DENIED_ERROR, l) : a.detail[0].message === "Requested device not found" && h(Y, l = j.DEVICE_NOT_FOUND_ERROR, l), t(16, Ve = !1); }), Q.addEventListener("faceDetection", (a) => { }), Q.addEventListener("close", async (a) => { b || (De = !1), t(17, ne = !0), t(18, ye = !1), l === j.OK && h(Y, l = j.CAMERA_CLOSED_ERROR, l); }), Q.addEventListener("initialize", async (a) => { Rt = !0, h(mi, mt = !0, mt), dt === $e.Face && !De && !b && Rt && await At(); }), Q.addEventListener("capture", async (a) => { t(19, ie = ""); const { encryptedFile: w, photo: O } = a.detail[0]; h(xe, ht = w, ht); const P = (await et(O)).split(","); if (le) try { let z = await ka(O); if (!await gi(z)) { console.warn("Liveness capture - face not detected! Resetting capture."); return; } } catch (z) { console.warn(z); } finally { t(18, ye = !1); } if (t(18, ye = !1), h(ee, y = K.OK, y), h(Ce, $.isLoading = !0, $), h(Se, b = !0, b), De = !1, h(Le, ce = P[0], ce), h(me, R = P[1], R), h(Pe, T = P[1], T), !Kt) { let z, re, It, Je; try { if (!bi(Ie)) throw new Error("FACE_TOO_SMALL"); ({ bodyParts: z, icaoWarnings: re } = await tt(T, fe, (await et(w)).split(",")[1])), window.dispatchEvent(new CustomEvent( "face-unconformities-validated", { detail: { bodyParts: z, icaoWarnings: re, status: y } } )); } catch (se) { console.error(se); let Oe = Ee.UNKNOWN, Xe = [], ui = []; se instanceof Wt && se.response?.status === 400 ? se.response.data && Array.isArray(se.response.data.bodyParts) ? (Xe = se.response.data.bodyParts, ui = se.response.data.icaoWarnings, It = se.response.data.invalidLivenessCounter, Je = se.response.data.invalidLivenessLimit, Oe = Xe.find((ua) => ua.livenessResult.error)?.livenessResult.error_code, h(ee, y = K.LIVENESS_DETECTION_FAILURE, y), t(19, ie = Ee[Oe]), console.error("Liveness error:", Oe)) : h(ee, y = K.TEMPLATE_EXTRACTION_ERROR, y) : se instanceof Error && ["FACE_NOT_FOUND", "FACE_TOO_SMALL"].includes(se.message) ? (h(ee, y = K.LIVENESS_DETECTION_FAILURE, y), Oe = se.message, t(19, ie = Ee[Oe]), Xe = ri()) : fe && He.fire({ icon: "error", title: "Falha ao comunicar com serviço de Liveness" }), h(Ce, $.isLoading = !1, $), window.dispatchEvent(new CustomEvent( "face-unconformities-validated", { detail: { bodyParts: Xe, errorCode: Oe, translatedError: X(ie), status: y, icaoWarnings: ui, invalidLivenessCounter: It, invalidLivenessLimit: Je } } )); return; } if (y !== K.OK) { h(Ce, $.isLoading = !1, $); return; } z[0].livenessResult && ni(z[0].livenessResult), z.length !== 0 && z[0].data && h(me, R = z[0].data, R), it(re); return; } let N, G; try { G = await Aa(w), ni(G.data); } catch (z) { h(ee, y = K.UNKNOWN_LIVENESS_ERROR, y), console.error(z), z instanceof Wt && z.response?.status === 400 ? (N = z.response.data.error_code, t(19, ie = Ee[N]), console.error("Liveness error:", N), h(ee, y = K.LIVENESS_DETECTION_FAILURE, y)) : He.fire({ icon: "error", title: "Falha ao comunicar com serviço de Liveness" }); } if (y !== K.OK) { h(Ce, $.isLoading = !1, $), window.dispatchEvent(new CustomEvent( "face-unconformities-validated", { detail: { bodyParts: [ { bodyPart: "FACE", data: T, livenessBlob: (await et(w)).split(",")[1], ...G && { livenessResult: G } } ], ...N && { errorCode: N }, ...ie && { translatedError: X(ie) }, status: y } } )); return; } let { bodyParts: de, icaoWarnings: Fe } = await tt(T, fe); window.dispatchEvent(new CustomEvent( "face-unconformities-validated", { detail: { bodyParts: de, icaoWarnings: Fe, status: y, errorCode: N, ...ie && { translatedError: X(ie) } } } )), de[0].data && h(me, R = de[0].data, R), it(Fe); }); } async function pe(a) { if (!je) { h(Y, l = j.CAMERA_ORIENTATION_PORTRAIT, l); return; } await ai(), H() ? At() : await Bi(ae.videoWidth, ae.videoHeight, a); } async function At() { if (H()) { if (await ai(), !v[0]?.deviceId) { try { await vi(640, 480); } catch (a) { const w = a, O = Re(a) && a.constraint ? a.constraint : ""; console.error(w.message, O), Re(w) && "message" in w && w.message.includes("Requested device not found") && h(Y, l = j.DEVICE_NOT_FOUND_ERROR, l); } await Mt(), h(he, f = v[0].deviceId, f); } h(Y, l = j.OK, l), Q && "openCamera" in Q && Q.openCamera(), De = !0, t(17, ne = !1), t(16, Ve = !0); } } async function Ke() { if (le && !Qt) return Be(D, Ke); if (D) { if (dt !== $e.Face && !Et) return Be(D, Ke); h(Ge, r = !0, r), h(Ze, ke = !1, ke), le && (o || h(Ue, o = !0, o)), Be(D, Ke); } } async function oi() { if (h(ee, y = K.OK, y), H()) { t(18, ye = !0), Q.takePhoto(); return; } let a = null; if (le && (a = await Mi(), !await gi(a))) { console.warn("Face capture - face not detected! Resetting capture."); return; } h(Se, b = !0, b); try { if (le && a) { const w = a.toDataURL("image/jpeg").split(","); h(Le, ce = w[0], ce), h(me, R = w[1], R), h(Pe, T = w[1], T); let O, P; if (!bi(Ie)) throw new Error("FACE_TOO_SMALL"); ({ bodyParts: O, icaoWarnings: P } = await tt(R, fe)), window.dispatchEvent(new CustomEvent( "face-unconformities-validated", { detail: { bodyParts: O, icaoWarnings: P, status: y } } )), O.length !== 0 && O[0].data && h(me, R = O[0].data, R), it(P); } else { const w = document.createElement("canvas"), O = w.getContext("2d"); w.width