bry-biometric-collector
Version:
BRy web-collector component for biometric capture.
848 lines (847 loc) • 21.1 kB
JavaScript
import { S as M, x as K, y as R, z as D, B as w, C as g, O as fe, E as C, H as E, I as b, ab as be, a$ as $, bt as j, bu as x, aB as L, D as O, G as v, bm as ee, bv as te, X as p, b9 as V, bw as _e, U as he, Y as de, ae as F, $ as ce, a1 as k, a2 as c, a3 as B, a0 as d, J as we, bp as N, a8 as Ce, T as pe, ap as ve, Q as ke, K as Be, N as T, b8 as _, bn as H, bx as me, Z as y, _ as A, a4 as S, M as I, L as ne } from "./main_8f1a8854_3.3.6.js";
function Ee(r) {
let e;
return {
c() {
e = O("div"), v(e, "class", "w-16");
},
m(n, t) {
w(n, e, t);
},
p: C,
d(n) {
n && E(e);
}
};
}
function Oe(r) {
let e, n, t, a, i, s, u, l = [
{ xmlns: "http://www.w3.org/2000/svg" },
{ width: "2em" },
{ height: "2em" },
{ viewBox: "0 0 256 256" },
/*$$props*/
r[3]
], o = {};
for (let f = 0; f < l.length; f += 1)
o = j(o, l[f]);
return {
c() {
e = O("div"), n = O("label"), t = ee("svg"), a = ee("path"), v(a, "fill", "hsl(var(--n))"), v(a, "d", "M208 56h-27.72l-13.63-20.44A8 8 0 0 0 160 32H96a8 8 0 0 0-6.65 3.56L75.71 56H48a24 24 0 0 0-24 24v112a24 24 0 0 0 24 24h160a24 24 0 0 0 24-24V80a24 24 0 0 0-24-24m-51.19 110.4A48.21 48.21 0 0 1 96 163.77V168a8 8 0 0 1-16 0v-24a8 8 0 0 1 8-8h24a8 8 0 0 1 0 16h-5.15a32.12 32.12 0 0 0 40.34 1.61a8 8 0 0 1 9.62 12.79M176 120a8 8 0 0 1-8 8h-24a8 8 0 0 1 0-16h5.15a32.12 32.12 0 0 0-40.34-1.61a8 8 0 0 1-9.62-12.79a48.21 48.21 0 0 1 60.81 2.63V96a8 8 0 0 1 16 0Z"), te(t, o), v(n, "tabindex", "0"), n.hidden = i = /*$cameraDevicesStore*/
r[1].length <= 1, v(n, "class", "ce-dui-btn ce-dui-btn-ghost w-16");
},
m(f, m) {
w(f, e, m), p(e, n), p(n, t), p(t, a), s || (u = V(
e,
"click",
/*click_handler*/
r[4]
), s = !0);
},
p(f, m) {
te(t, o = _e(l, [
{ xmlns: "http://www.w3.org/2000/svg" },
{ width: "2em" },
{ height: "2em" },
{ viewBox: "0 0 256 256" },
m & /*$$props*/
8 && /*$$props*/
f[3]
])), m & /*$cameraDevicesStore*/
2 && i !== (i = /*$cameraDevicesStore*/
f[1].length <= 1) && (n.hidden = i);
},
d(f) {
f && E(e), s = !1, u();
}
};
}
function ye(r) {
let e;
function n(i, s) {
return (
/*show*/
i[0] && /*$cameraDevicesStore*/
i[1].length > 1 ? Oe : Ee
);
}
let t = n(r), a = t(r);
return {
c() {
a.c(), e = fe(), this.c = C;
},
m(i, s) {
a.m(i, s), w(i, e, s);
},
p(i, [s]) {
t === (t = n(i)) && a ? a.p(i, s) : (a.d(1), a = t(i), a && (a.c(), a.m(e.parentNode, e)));
},
i: C,
o: C,
d(i) {
a.d(i), i && E(e);
}
};
}
function Ae(r, e, n) {
let t, a;
b(r, be, (u) => n(1, t = u)), b(r, $, (u) => n(2, a = u));
let { show: i } = e;
const s = () => {
L($, a = !a, a);
};
return r.$$set = (u) => {
n(3, e = j(j({}, e), x(u))), "show" in u && n(0, i = u.show);
}, e = x(e), [i, t, a, e, s];
}
class U extends M {
constructor(e) {
super(), K(
this,
{
target: this.shadowRoot,
props: D(this.attributes),
customElement: !0
},
Ae,
ye,
R,
{ show: 0 },
null
), e && (e.target && w(e.target, this, e.anchor), e.props && (this.$set(e.props), g()));
}
static get observedAttributes() {
return ["show"];
}
get show() {
return this.$$.ctx[0];
}
set show(e) {
this.$$set({ show: e }), g();
}
}
customElements.define("camera-btn", U);
function Se(r) {
let e, n = (
/*$_*/
r[0]("buttons.startCapture") + ""
), t, a, i;
return {
c() {
e = O("button"), t = he(n), this.c = C, v(e, "class", "bg-primary text-white font-medium h-12 px-4 rounded-3xl text-xl transition-colors duration-500 hover:bg-primary-focus");
},
m(s, u) {
w(s, e, u), p(e, t), a || (i = V(
e,
"click",
/*click_handler*/
r[2]
), a = !0);
},
p(s, [u]) {
u & /*$_*/
1 && n !== (n = /*$_*/
s[0]("buttons.startCapture") + "") && de(t, n);
},
i: C,
o: C,
d(s) {
s && E(e), a = !1, i();
}
};
}
function Te(r, e, n) {
let t, a;
b(r, F, (u) => n(3, t = u)), b(r, ce, (u) => n(0, a = u));
function i() {
L(F, t = !0, t);
}
return [a, i, () => i()];
}
class ge extends M {
constructor(e) {
super(), K(
this,
{
target: this.shadowRoot,
props: D(this.attributes),
customElement: !0
},
Te,
Se,
R,
{},
null
), e && e.target && w(e.target, this, e.anchor);
}
}
customElements.define("start-auto-capture-btn", ge);
function Le(r) {
let e, n = (
/*$_*/
r[3]("faceCollector.capture") + ""
), t, a, i;
return {
c() {
e = O("button"), t = he(n), this.c = C, e.disabled = /*disabled*/
r[1], e.hidden = /*hidden*/
r[2], v(e, "class", "bg-primary text-white font-medium h-12 px-4 rounded-3xl text-xl transition-colors duration-200 hover:bg-primary-focus disabled:bg-gray-300 disabled:hover:bg-gray-300 disabled:opacity-60");
},
m(s, u) {
w(s, e, u), p(e, t), a || (i = V(
e,
"click",
/*click_handler*/
r[4]
), a = !0);
},
p(s, [u]) {
u & /*$_*/
8 && n !== (n = /*$_*/
s[3]("faceCollector.capture") + "") && de(t, n), u & /*disabled*/
2 && (e.disabled = /*disabled*/
s[1]), u & /*hidden*/
4 && (e.hidden = /*hidden*/
s[2]);
},
i: C,
o: C,
d(s) {
s && E(e), a = !1, i();
}
};
}
function He(r, e, n) {
let t;
b(r, ce, (l) => n(3, t = l));
let { handler: a = () => {
} } = e, { disabled: i = !1 } = e, { hidden: s = !1 } = e;
const u = () => !i && a();
return r.$$set = (l) => {
"handler" in l && n(0, a = l.handler), "disabled" in l && n(1, i = l.disabled), "hidden" in l && n(2, s = l.hidden);
}, [a, i, s, t, u];
}
class Z extends M {
constructor(e) {
super(), K(
this,
{
target: this.shadowRoot,
props: D(this.attributes),
customElement: !0
},
He,
Le,
R,
{ handler: 0, disabled: 1, hidden: 2 },
null
), e && (e.target && w(e.target, this, e.anchor), e.props && (this.$set(e.props), g()));
}
static get observedAttributes() {
return ["handler", "disabled", "hidden"];
}
get handler() {
return this.$$.ctx[0];
}
set handler(e) {
this.$$set({ handler: e }), g();
}
get disabled() {
return this.$$.ctx[1];
}
set disabled(e) {
this.$$set({ disabled: e }), g();
}
get hidden() {
return this.$$.ctx[2];
}
set hidden(e) {
this.$$set({ hidden: e }), g();
}
}
customElements.define("take-picture-btn", Z);
function Ie(r) {
let e, n, t, a, i = (
/*$ready*/
r[13] && re(r)
), s = (
/*$ready*/
r[13] && ae(r)
), u = (
/*$ready*/
r[13] && ie(r)
);
return {
c() {
e = O("div"), i && i.c(), n = T(), s && s.c(), t = T(), u && u.c(), v(e, "class", "w-full flex justify-between items-center px-2"), _(e, "background-color", "rgba(" + H(
/*videoOverlay*/
r[5]
) + ", " + (1 - /*videoOverlayTransparency*/
r[6] / 100) + ")"), _(
e,
"height",
/*$captureBarHeight*/
r[11] + "px"
), _(
e,
"max-height",
/*$captureBarHeight*/
r[11] + "px"
);
},
m(l, o) {
w(l, e, o), i && i.m(e, null), p(e, n), s && s.m(e, null), p(e, t), u && u.m(e, null), a = !0;
},
p(l, o) {
/*$ready*/
l[13] ? i ? (i.p(l, o), o & /*$ready*/
8192 && d(i, 1)) : (i = re(l), i.c(), d(i, 1), i.m(e, n)) : i && (k(), c(i, 1, 1, () => {
i = null;
}), B()), /*$ready*/
l[13] ? s ? (s.p(l, o), o & /*$ready*/
8192 && d(s, 1)) : (s = ae(l), s.c(), d(s, 1), s.m(e, t)) : s && (k(), c(s, 1, 1, () => {
s = null;
}), B()), /*$ready*/
l[13] ? u ? (u.p(l, o), o & /*$ready*/
8192 && d(u, 1)) : (u = ie(l), u.c(), d(u, 1), u.m(e, null)) : u && (k(), c(u, 1, 1, () => {
u = null;
}), B()), (!a || o & /*videoOverlay, videoOverlayTransparency*/
96) && _(e, "background-color", "rgba(" + H(
/*videoOverlay*/
l[5]
) + ", " + (1 - /*videoOverlayTransparency*/
l[6] / 100) + ")"), (!a || o & /*$captureBarHeight*/
2048) && _(
e,
"height",
/*$captureBarHeight*/
l[11] + "px"
), (!a || o & /*$captureBarHeight*/
2048) && _(
e,
"max-height",
/*$captureBarHeight*/
l[11] + "px"
);
},
i(l) {
a || (d(i), d(s), d(u), a = !0);
},
o(l) {
c(i), c(s), c(u), a = !1;
},
d(l) {
l && E(e), i && i.d(), s && s.d(), u && u.d();
}
};
}
function Me(r) {
let e, n, t, a, i, s = (
/*$ready*/
r[13] && se(r)
), u = (
/*showAutoCaptureButton*/
r[1] && !/*$automaticCapture*/
r[14] && !/*showCaptureButton*/
r[2] && /*$ready*/
r[13] && le()
), l = (
/*showCaptureButton*/
r[2] && /*$ready*/
r[13] && ue(r)
), o = (
/*$ready*/
r[13] && oe(r)
);
return {
c() {
e = O("div"), s && s.c(), n = T(), u && u.c(), t = T(), l && l.c(), a = T(), o && o.c(), v(e, "class", "w-full flex justify-between items-center px-2"), _(e, "background-color", "rgba(" + H(
/*videoOverlay*/
r[5]
) + ", " + (1 - /*videoOverlayTransparency*/
r[6] / 100) + ")"), _(
e,
"height",
/*$captureBarHeight*/
r[11] + "px"
), _(
e,
"max-height",
/*$captureBarHeight*/
r[11] + "px"
);
},
m(f, m) {
w(f, e, m), s && s.m(e, null), p(e, n), u && u.m(e, null), p(e, t), l && l.m(e, null), p(e, a), o && o.m(e, null), i = !0;
},
p(f, m) {
/*$ready*/
f[13] ? s ? (s.p(f, m), m & /*$ready*/
8192 && d(s, 1)) : (s = se(f), s.c(), d(s, 1), s.m(e, n)) : s && (k(), c(s, 1, 1, () => {
s = null;
}), B()), /*showAutoCaptureButton*/
f[1] && !/*$automaticCapture*/
f[14] && !/*showCaptureButton*/
f[2] && /*$ready*/
f[13] ? u ? m & /*showAutoCaptureButton, $automaticCapture, showCaptureButton, $ready*/
24582 && d(u, 1) : (u = le(), u.c(), d(u, 1), u.m(e, t)) : u && (k(), c(u, 1, 1, () => {
u = null;
}), B()), /*showCaptureButton*/
f[2] && /*$ready*/
f[13] ? l ? (l.p(f, m), m & /*showCaptureButton, $ready*/
8196 && d(l, 1)) : (l = ue(f), l.c(), d(l, 1), l.m(e, a)) : l && (k(), c(l, 1, 1, () => {
l = null;
}), B()), /*$ready*/
f[13] ? o ? (o.p(f, m), m & /*$ready*/
8192 && d(o, 1)) : (o = oe(f), o.c(), d(o, 1), o.m(e, null)) : o && (k(), c(o, 1, 1, () => {
o = null;
}), B()), (!i || m & /*videoOverlay, videoOverlayTransparency*/
96) && _(e, "background-color", "rgba(" + H(
/*videoOverlay*/
f[5]
) + ", " + (1 - /*videoOverlayTransparency*/
f[6] / 100) + ")"), (!i || m & /*$captureBarHeight*/
2048) && _(
e,
"height",
/*$captureBarHeight*/
f[11] + "px"
), (!i || m & /*$captureBarHeight*/
2048) && _(
e,
"max-height",
/*$captureBarHeight*/
f[11] + "px"
);
},
i(f) {
i || (d(s), d(u), d(l), d(o), i = !0);
},
o(f) {
c(s), c(u), c(l), c(o), i = !1;
},
d(f) {
f && E(e), s && s.d(), u && u.d(), l && l.d(), o && o.d();
}
};
}
function re(r) {
let e, n;
return e = new me({
props: { show: (
/*showConfigButton*/
r[0]
) }
}), {
c() {
y(e.$$.fragment);
},
m(t, a) {
A(e, t, a), n = !0;
},
p(t, a) {
const i = {};
a & /*showConfigButton*/
1 && (i.show = /*showConfigButton*/
t[0]), e.$set(i);
},
i(t) {
n || (d(e.$$.fragment, t), n = !0);
},
o(t) {
c(e.$$.fragment, t), n = !1;
},
d(t) {
S(e, t);
}
};
}
function ae(r) {
let e, n;
return e = new Z({
props: {
hidden: (
/*$cameraStatusStore*/
r[16] !== I.OK
),
handler: (
/*handler*/
r[10]
)
}
}), {
c() {
y(e.$$.fragment);
},
m(t, a) {
A(e, t, a), n = !0;
},
p(t, a) {
const i = {};
a & /*$cameraStatusStore*/
65536 && (i.hidden = /*$cameraStatusStore*/
t[16] !== I.OK), a & /*handler*/
1024 && (i.handler = /*handler*/
t[10]), e.$set(i);
},
i(t) {
n || (d(e.$$.fragment, t), n = !0);
},
o(t) {
c(e.$$.fragment, t), n = !1;
},
d(t) {
S(e, t);
}
};
}
function ie(r) {
let e, n;
return e = new U({
props: { show: (
/*showCameraButton*/
r[3]
) }
}), {
c() {
y(e.$$.fragment);
},
m(t, a) {
A(e, t, a), n = !0;
},
p(t, a) {
const i = {};
a & /*showCameraButton*/
8 && (i.show = /*showCameraButton*/
t[3]), e.$set(i);
},
i(t) {
n || (d(e.$$.fragment, t), n = !0);
},
o(t) {
c(e.$$.fragment, t), n = !1;
},
d(t) {
S(e, t);
}
};
}
function se(r) {
let e, n;
return e = new me({
props: { show: (
/*showConfigButton*/
r[0]
) }
}), {
c() {
y(e.$$.fragment);
},
m(t, a) {
A(e, t, a), n = !0;
},
p(t, a) {
const i = {};
a & /*showConfigButton*/
1 && (i.show = /*showConfigButton*/
t[0]), e.$set(i);
},
i(t) {
n || (d(e.$$.fragment, t), n = !0);
},
o(t) {
c(e.$$.fragment, t), n = !1;
},
d(t) {
S(e, t);
}
};
}
function le(r) {
let e, n;
return e = new ge({}), {
c() {
y(e.$$.fragment);
},
m(t, a) {
A(e, t, a), n = !0;
},
i(t) {
n || (d(e.$$.fragment, t), n = !0);
},
o(t) {
c(e.$$.fragment, t), n = !1;
},
d(t) {
S(e, t);
}
};
}
function ue(r) {
let e, n;
return e = new Z({
props: {
disabled: !/*enableCaptureButton*/
r[4] && /*$enableFaceApi*/
r[15] || !/*$ready*/
r[13] && !/*$enableFaceApi*/
r[15],
hidden: (
/*$cameraStatusStore*/
r[16] !== I.OK || ne() && /*idrndLoading*/
(r[8] || /*idrndClosed*/
r[7] || /*waitingIdrndCaptureEvent*/
r[9])
),
handler: (
/*handler*/
r[10]
)
}
}), {
c() {
y(e.$$.fragment);
},
m(t, a) {
A(e, t, a), n = !0;
},
p(t, a) {
const i = {};
a & /*enableCaptureButton, $enableFaceApi, $ready*/
40976 && (i.disabled = !/*enableCaptureButton*/
t[4] && /*$enableFaceApi*/
t[15] || !/*$ready*/
t[13] && !/*$enableFaceApi*/
t[15]), a & /*$cameraStatusStore, idrndLoading, idrndClosed, waitingIdrndCaptureEvent*/
66432 && (i.hidden = /*$cameraStatusStore*/
t[16] !== I.OK || ne() && /*idrndLoading*/
(t[8] || /*idrndClosed*/
t[7] || /*waitingIdrndCaptureEvent*/
t[9])), a & /*handler*/
1024 && (i.handler = /*handler*/
t[10]), e.$set(i);
},
i(t) {
n || (d(e.$$.fragment, t), n = !0);
},
o(t) {
c(e.$$.fragment, t), n = !1;
},
d(t) {
S(e, t);
}
};
}
function oe(r) {
let e, n;
return e = new U({
props: { show: (
/*showCameraButton*/
r[3]
) }
}), {
c() {
y(e.$$.fragment);
},
m(t, a) {
A(e, t, a), n = !0;
},
p(t, a) {
const i = {};
a & /*showCameraButton*/
8 && (i.show = /*showCameraButton*/
t[3]), e.$set(i);
},
i(t) {
n || (d(e.$$.fragment, t), n = !0);
},
o(t) {
c(e.$$.fragment, t), n = !1;
},
d(t) {
S(e, t);
}
};
}
function Ke(r) {
let e, n, t, a;
const i = [Me, Ie], s = [];
function u(l, o) {
return (
/*$collectorSelect*/
l[12] === "FACE" || /*$collectorSelect*/
l[12] === "BOTH" ? 0 : (
/*$collectorSelect*/
l[12] === "DOCUMENT" ? 1 : -1
)
);
}
return ~(e = u(r)) && (n = s[e] = i[e](r)), {
c() {
n && n.c(), t = fe(), this.c = C;
},
m(l, o) {
~e && s[e].m(l, o), w(l, t, o), a = !0;
},
p(l, [o]) {
let f = e;
e = u(l), e === f ? ~e && s[e].p(l, o) : (n && (k(), c(s[f], 1, 1, () => {
s[f] = null;
}), B()), ~e ? (n = s[e], n ? n.p(l, o) : (n = s[e] = i[e](l), n.c()), d(n, 1), n.m(t.parentNode, t)) : n = null);
},
i(l) {
a || (d(n), a = !0);
},
o(l) {
c(n), a = !1;
},
d(l) {
~e && s[e].d(l), l && E(t);
}
};
}
function Re(r, e, n) {
let t, a, i, s, u, l, o;
b(r, we, (h) => n(17, t = h)), b(r, N, (h) => n(11, a = h)), b(r, Ce, (h) => n(12, i = h)), b(r, pe, (h) => n(13, s = h)), b(r, F, (h) => n(14, u = h)), b(r, ve, (h) => n(15, l = h)), b(r, ke, (h) => n(16, o = h));
let { showConfigButton: f = null } = e, { showAutoCaptureButton: m = null } = e, { showCaptureButton: q = null } = e, { showCameraButton: z = null } = e, { enableCaptureButton: G = null } = e, { videoOverlay: J = "" } = e, { videoOverlayTransparency: P = 100 } = e, { idrndClosed: Q = null } = e, { idrndLoading: X = null } = e, { waitingIdrndCaptureEvent: Y = null } = e, { handler: W = () => {
} } = e;
return r.$$set = (h) => {
"showConfigButton" in h && n(0, f = h.showConfigButton), "showAutoCaptureButton" in h && n(1, m = h.showAutoCaptureButton), "showCaptureButton" in h && n(2, q = h.showCaptureButton), "showCameraButton" in h && n(3, z = h.showCameraButton), "enableCaptureButton" in h && n(4, G = h.enableCaptureButton), "videoOverlay" in h && n(5, J = h.videoOverlay), "videoOverlayTransparency" in h && n(6, P = h.videoOverlayTransparency), "idrndClosed" in h && n(7, Q = h.idrndClosed), "idrndLoading" in h && n(8, X = h.idrndLoading), "waitingIdrndCaptureEvent" in h && n(9, Y = h.waitingIdrndCaptureEvent), "handler" in h && n(10, W = h.handler);
}, r.$$.update = () => {
r.$$.dirty & /*$videoStore*/
131072 && t && (Be() ? L(N, a = Math.round(t.videoHeight * 0.25), a) : L(N, a = Math.round(t.videoHeight * 0.15), a));
}, [
f,
m,
q,
z,
G,
J,
P,
Q,
X,
Y,
W,
a,
i,
s,
u,
l,
o,
t
];
}
class De extends M {
constructor(e) {
super(), K(
this,
{
target: this.shadowRoot,
props: D(this.attributes),
customElement: !0
},
Re,
Ke,
R,
{
showConfigButton: 0,
showAutoCaptureButton: 1,
showCaptureButton: 2,
showCameraButton: 3,
enableCaptureButton: 4,
videoOverlay: 5,
videoOverlayTransparency: 6,
idrndClosed: 7,
idrndLoading: 8,
waitingIdrndCaptureEvent: 9,
handler: 10
},
null
), e && (e.target && w(e.target, this, e.anchor), e.props && (this.$set(e.props), g()));
}
static get observedAttributes() {
return [
"showConfigButton",
"showAutoCaptureButton",
"showCaptureButton",
"showCameraButton",
"enableCaptureButton",
"videoOverlay",
"videoOverlayTransparency",
"idrndClosed",
"idrndLoading",
"waitingIdrndCaptureEvent",
"handler"
];
}
get showConfigButton() {
return this.$$.ctx[0];
}
set showConfigButton(e) {
this.$$set({ showConfigButton: e }), g();
}
get showAutoCaptureButton() {
return this.$$.ctx[1];
}
set showAutoCaptureButton(e) {
this.$$set({ showAutoCaptureButton: e }), g();
}
get showCaptureButton() {
return this.$$.ctx[2];
}
set showCaptureButton(e) {
this.$$set({ showCaptureButton: e }), g();
}
get showCameraButton() {
return this.$$.ctx[3];
}
set showCameraButton(e) {
this.$$set({ showCameraButton: e }), g();
}
get enableCaptureButton() {
return this.$$.ctx[4];
}
set enableCaptureButton(e) {
this.$$set({ enableCaptureButton: e }), g();
}
get videoOverlay() {
return this.$$.ctx[5];
}
set videoOverlay(e) {
this.$$set({ videoOverlay: e }), g();
}
get videoOverlayTransparency() {
return this.$$.ctx[6];
}
set videoOverlayTransparency(e) {
this.$$set({ videoOverlayTransparency: e }), g();
}
get idrndClosed() {
return this.$$.ctx[7];
}
set idrndClosed(e) {
this.$$set({ idrndClosed: e }), g();
}
get idrndLoading() {
return this.$$.ctx[8];
}
set idrndLoading(e) {
this.$$set({ idrndLoading: e }), g();
}
get waitingIdrndCaptureEvent() {
return this.$$.ctx[9];
}
set waitingIdrndCaptureEvent(e) {
this.$$set({ waitingIdrndCaptureEvent: e }), g();
}
get handler() {
return this.$$.ctx[10];
}
set handler(e) {
this.$$set({ handler: e }), g();
}
}
customElements.define("capture-bar", De);
export {
De as C
};