bry-biometric-collector 3.1.0 → 3.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,1174 +0,0 @@
1
- import { S as st, q as ot, r as nt, t as rt, x as j, y as S, z as p, bg as se, C as Q, D as g, a_ as oe, bh as Ot, U as I, I as E, K as M, bi as q, bj as hi, M as ne, R as H, B as $, b1 as _e, E as ee, G as F, H as U, J as te, N as X, O as v, Q as W, T as mi, V as it, W as at, X as Ge, Y as be, Z as G, _ as ve, a0 as bi, a1 as Ie, a3 as vi, a2 as de, a4 as we, a5 as Qe, a6 as Ye, a7 as Nt, ab as Ce, ad as Xe, ae as Ii, af as zt, ag as ye, $ as wi, aa as Ve, ai as jt, ak as xe, ap as Ci, aq as yi, as as Mi, at as pi, au as _i, aw as Je, ax as re, j as Di, ay as Ke, aN as kt, d as Me, aO as Rt, aP as qe, aQ as Ti, aC as $e, bk as Ai, aR as Oi, aS as Ni, aT as zi, av as ji, aU as ki, bl as Ri, aW as Ei, aX as pe, aY as Si, aZ as Zi, a$ as le, b0 as lt, b2 as Pi, b3 as V, b4 as x, w as Et, b5 as Wi, aF as Fi, b8 as et, bm as Hi } from "./main_297fa10f_3.1.0.js";
2
- import { W as Li, C as Ui, V as Bi, a as Gi } from "./ValidationAlert_15dcf5cc_3.1.0.js";
3
- import { matchDimensions as Qi, resizeResults as Yi } from "./face_api_0e3ce8c8_3.1.0.js";
4
- const Xi = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTIwNiIgaGVpZ2h0PSI4OTAiIHZpZXdCb3g9IjAgMCAxMjA2IDg5MCIgZmlsbD0ibm9uZSIgb3BhY2l0eT0iMC4yIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgogICAgPGcgZmlsdGVyPSJ1cmwoI2ZpbHRlcjBfZF8xOF80KSIgb3BhY2l0eT0iMCI+CiAgICA8bWFzayBpZD0icGF0aC0xLWluc2lkZS0xXzE4XzQiIGZpbGw9IndoaXRlIj4KICAgIDxyZWN0IHg9IjQiIHdpZHRoPSIxMTk4IiBoZWlnaHQ9Ijg4MiIgcng9IjYiLz4KICAgIDwvbWFzaz4KICAgIDxyZWN0IHg9IjQiIHdpZHRoPSIxMTk4IiBoZWlnaHQ9Ijg4MiIgcng9IjYiIHN0cm9rZT0id2hpdGUiIHN0cm9rZS1vcGFjaXR5PSIwLjkiIHN0cm9rZS13aWR0aD0iMTYiIHNoYXBlLXJlbmRlcmluZz0iY3Jpc3BFZGdlcyIgbWFzaz0idXJsKCNwYXRoLTEtaW5zaWRlLTFfMThfNCkiLz4KICAgIDwvZz4KICAgIDxtYXNrIGlkPSJwYXRoLTItaW5zaWRlLTJfMThfNCIgZmlsbD0id2hpdGUiPgogICAgPHJlY3QgeD0iMjE5LjI3OCIgeT0iMjk2IiB3aWR0aD0iMzM4Ljg2MyIgaGVpZ2h0PSI0NjgiIHJ4PSI3Ii8+CiAgICA8L21hc2s+CiAgICA8cmVjdCB4PSIyMTkuMjc4IiB5PSIyOTYiIHdpZHRoPSIzMzguODYzIiBoZWlnaHQ9IjQ2OCIgcng9IjciIHN0cm9rZT0id2hpdGUiIHN0cm9rZS1vcGFjaXR5PSIwLjkiIHN0cm9rZS13aWR0aD0iMTYiIG1hc2s9InVybCgjcGF0aC0yLWluc2lkZS0yXzE4XzQpIi8+CiAgICA8ZWxsaXBzZSBjeD0iMzg5LjIzOCIgY3k9IjUxMS4yMjgiIHJ4PSI4Ni4yMzc2IiByeT0iODUuMjI4NCIgZmlsbD0id2hpdGUiIGZpbGwtb3BhY2l0eT0iMC4wOCIvPgogICAgPHBhdGggZD0iTTQ3MS40NzUgNTExLjIyOEM0NzEuNDc1IDU1Ni4wNDUgNDM0LjcwMSA1OTIuNDU3IDM4OS4yMzggNTkyLjQ1N0MzNDMuNzc0IDU5Mi40NTcgMzA3IDU1Ni4wNDUgMzA3IDUxMS4yMjhDMzA3IDQ2Ni40MTEgMzQzLjc3NCA0MzAgMzg5LjIzOCA0MzBDNDM0LjcwMSA0MzAgNDcxLjQ3NSA0NjYuNDExIDQ3MS40NzUgNTExLjIyOFoiIHN0cm9rZT0id2hpdGUiIHN0cm9rZS1vcGFjaXR5PSIwLjkiIHN0cm9rZS13aWR0aD0iOCIvPgogICAgPHBhdGggZD0iTTM4Ny4zOCA2MDhDNTM1LjI2IDYwOCA1MzkuODggNzQzLjQ3MyA1MzkuODggNzQzLjQ3M0wyMzkgNzQzLjVDMjM5IDc0My41IDIzOS41IDYwOCAzODcuMzggNjA4WiIgZmlsbD0id2hpdGUiIGZpbGwtb3BhY2l0eT0iMC4wOCIvPgogICAgPHBhdGggZD0iTTM4Ny4zOCA2MTJDNDU5Ljc5NCA2MTIgNDk2LjY0OSA2NDUuMDIgNTE1LjYyNSA2NzcuNzQzQzUyNS4xOCA2OTQuMjIgNTMwLjI1NSA3MTAuNzMzIDUzMi45MzggNzIzLjE1QzUzNC4yNzggNzI5LjM1MSA1MzUuMDE2IDczNC41MDggNTM1LjQxOCA3MzguMDk4QzUzNS40NzMgNzM4LjU4NiA1MzUuNTIxIDczOS4wNDUgNTM1LjU2NCA3MzkuNDc0TDI0My4xODQgNzM5LjVDMjQzLjIxNiA3MzkuMDM3IDI0My4yNTMgNzM4LjUzOCAyNDMuMjk3IDczOC4wMDNDMjQzLjU5IDczNC40MTQgMjQ0LjE3MSA3MjkuMjU4IDI0NS4zMjIgNzIzLjA1OEMyNDcuNjI2IDcxMC42NDIgMjUyLjE5NyA2OTQuMTM4IDI2MS4yNDEgNjc3LjY3NkMyNzAuMjczIDY2MS4yMzYgMjgzLjc0OCA2NDQuODY0IDMwMy44OTEgNjMyLjU4N0MzMjQuMDI0IDYyMC4zMTYgMzUxLjA0MiA2MTIgMzg3LjM4IDYxMloiIHN0cm9rZT0id2hpdGUiIHN0cm9rZS1vcGFjaXR5PSIwLjkiIHN0cm9rZS13aWR0aD0iOCIvPgogICAgPGRlZnM+CiAgICA8ZmlsdGVyIGlkPSJmaWx0ZXIwX2RfMThfNCIgeD0iMCIgeT0iMCIgd2lkdGg9IjEyMDYiIGhlaWdodD0iODkwIiBmaWx0ZXJVbml0cz0idXNlclNwYWNlT25Vc2UiIGNvbG9yLWludGVycG9sYXRpb24tZmlsdGVycz0ic1JHQiI+CiAgICA8ZmVGbG9vZCBmbG9vZC1vcGFjaXR5PSIwIiByZXN1bHQ9IkJhY2tncm91bmRJbWFnZUZpeCIvPgogICAgPGZlQ29sb3JNYXRyaXggaW49IlNvdXJjZUFscGhhIiB0eXBlPSJtYXRyaXgiIHZhbHVlcz0iMCAwIDAgMCAwIDAgMCAwIDAgMCAwIDAgMCAwIDAgMCAwIDAgMTI3IDAiIHJlc3VsdD0iaGFyZEFscGhhIi8+CiAgICA8ZmVPZmZzZXQgZHk9IjQiLz4KICAgIDxmZUdhdXNzaWFuQmx1ciBzdGREZXZpYXRpb249IjIiLz4KICAgIDxmZUNvbXBvc2l0ZSBpbjI9ImhhcmRBbHBoYSIgb3BlcmF0b3I9Im91dCIvPgogICAgPGZlQ29sb3JNYXRyaXggdHlwZT0ibWF0cml4IiB2YWx1ZXM9IjAgMCAwIDAgMCAwIDAgMCAwIDAgMCAwIDAgMCAwIDAgMCAwIDAuMjUgMCIvPgogICAgPGZlQmxlbmQgbW9kZT0ibm9ybWFsIiBpbjI9IkJhY2tncm91bmRJbWFnZUZpeCIgcmVzdWx0PSJlZmZlY3QxX2Ryb3BTaGFkb3dfMThfNCIvPgogICAgPGZlQmxlbmQgbW9kZT0ibm9ybWFsIiBpbj0iU291cmNlR3JhcGhpYyIgaW4yPSJlZmZlY3QxX2Ryb3BTaGFkb3dfMThfNCIgcmVzdWx0PSJzaGFwZSIvPgogICAgPC9maWx0ZXI+CiAgICA8L2RlZnM+CiAgICA8L3N2Zz4KICAgIA==";
5
- function Vi(a) {
6
- let e, t, s, o, r, n, u, f, d, l, h;
7
- return {
8
- c() {
9
- e = p("div"), t = se("svg"), s = se("defs"), o = se("mask"), r = se("rect"), n = se("rect"), h = se("rect"), this.c = Q, g(r, "width", "100%"), g(r, "height", "100%"), g(r, "fill", "white"), g(n, "id", "transparent-rect"), g(n, "x", u = "calc((100% - " + /*$docDimensions*/
10
- a[2].width + "px) / 2)"), g(n, "y", f = "calc(" + /*y*/
11
- a[3] + ")"), g(n, "width", d = /*$docDimensions*/
12
- a[2].width), g(n, "height", l = /*$docDimensions*/
13
- a[2].height), g(n, "fill", "black"), g(o, "id", "transparentAreaMask"), g(h, "width", "100%"), g(h, "height", "100%"), oe(h, "fill", "rgba(" + Ot(
14
- /*videoOverlay*/
15
- a[0]
16
- ) + ", " + (1 - /*videoOverlayTransparency*/
17
- a[1] / 100) + ")"), g(h, "mask", "url(#transparentAreaMask)"), g(t, "class", "absolute w-full h-full"), g(t, "xmlns", "http://www.w3.org/2000/svg"), g(e, "id", "overlay-container"), g(e, "class", "flex items-center justify-center absolute inset-0");
18
- },
19
- m(c, m) {
20
- j(c, e, m), I(e, t), I(t, s), I(s, o), I(o, r), I(o, n), I(t, h);
21
- },
22
- p(c, [m]) {
23
- m & /*$docDimensions*/
24
- 4 && u !== (u = "calc((100% - " + /*$docDimensions*/
25
- c[2].width + "px) / 2)") && g(n, "x", u), m & /*y*/
26
- 8 && f !== (f = "calc(" + /*y*/
27
- c[3] + ")") && g(n, "y", f), m & /*$docDimensions*/
28
- 4 && d !== (d = /*$docDimensions*/
29
- c[2].width) && g(n, "width", d), m & /*$docDimensions*/
30
- 4 && l !== (l = /*$docDimensions*/
31
- c[2].height) && g(n, "height", l), m & /*videoOverlay, videoOverlayTransparency*/
32
- 3 && oe(h, "fill", "rgba(" + Ot(
33
- /*videoOverlay*/
34
- c[0]
35
- ) + ", " + (1 - /*videoOverlayTransparency*/
36
- c[1] / 100) + ")");
37
- },
38
- i: Q,
39
- o: Q,
40
- d(c) {
41
- c && E(e);
42
- }
43
- };
44
- }
45
- function xi(a, e, t) {
46
- let s, o, r;
47
- M(a, q, (l) => t(2, s = l)), M(a, hi, (l) => t(5, o = l)), M(a, ne, (l) => t(6, r = l));
48
- let { videoOverlay: n } = e, { videoOverlayTransparency: u } = e, f, d;
49
- return a.$$set = (l) => {
50
- "videoOverlay" in l && t(0, n = l.videoOverlay), "videoOverlayTransparency" in l && t(1, u = l.videoOverlayTransparency);
51
- }, a.$$.update = () => {
52
- a.$$.dirty & /*$videoStore, $docDimensions, $captureBarHeight, divHeight*/
53
- 116 && r && s && (t(4, f = r.videoHeight - o), t(3, d = (f - s.height) / 2 + "px"));
54
- }, [
55
- n,
56
- u,
57
- s,
58
- d,
59
- f,
60
- o,
61
- r
62
- ];
63
- }
64
- class Ft extends st {
65
- constructor(e) {
66
- super(), ot(
67
- this,
68
- {
69
- target: this.shadowRoot,
70
- props: rt(this.attributes),
71
- customElement: !0
72
- },
73
- xi,
74
- Vi,
75
- nt,
76
- {
77
- videoOverlay: 0,
78
- videoOverlayTransparency: 1
79
- },
80
- null
81
- ), e && (e.target && j(e.target, this, e.anchor), e.props && (this.$set(e.props), S()));
82
- }
83
- static get observedAttributes() {
84
- return ["videoOverlay", "videoOverlayTransparency"];
85
- }
86
- get videoOverlay() {
87
- return this.$$.ctx[0];
88
- }
89
- set videoOverlay(e) {
90
- this.$$set({ videoOverlay: e }), S();
91
- }
92
- get videoOverlayTransparency() {
93
- return this.$$.ctx[1];
94
- }
95
- set videoOverlayTransparency(e) {
96
- this.$$set({ videoOverlayTransparency: e }), S();
97
- }
98
- }
99
- customElements.define("document-overlay", Ft);
100
- function Ji(a) {
101
- let e, t, s, o, r, n, u, f, d, l, h;
102
- return u = new Li({}), l = new Ft({
103
- props: {
104
- videoOverlay: (
105
- /*videoOverlay*/
106
- a[1]
107
- ),
108
- videoOverlayTransparency: (
109
- /*videoOverlayTransparency*/
110
- a[2]
111
- ),
112
- borderWidth: (
113
- /*borderWidth*/
114
- a[3]
115
- )
116
- }
117
- }), {
118
- c() {
119
- e = p("div"), t = p("div"), s = p("div"), o = p("img"), n = H(), $(u.$$.fragment), d = H(), $(l.$$.fragment), this.c = Q, _e(o.src, r = Xi) || g(o, "src", r), g(o, "alt", "document"), g(s, "class", "w-full h-full relative"), g(t, "class", "absolute inset-0 flex justify-center"), g(e, "id", "doc-rectangle"), g(e, "class", f = "doc-loader " + /*loading*/
120
- (a[0] ? "doc-loading" : "") + " z-10"), g(
121
- e,
122
- "style",
123
- /*styleVars*/
124
- a[4]
125
- );
126
- },
127
- m(c, m) {
128
- j(c, e, m), I(e, t), I(t, s), I(s, o), I(e, n), ee(u, e, null), j(c, d, m), ee(l, c, m), h = !0;
129
- },
130
- p(c, [m]) {
131
- (!h || m & /*loading*/
132
- 1 && f !== (f = "doc-loader " + /*loading*/
133
- (c[0] ? "doc-loading" : "") + " z-10")) && g(e, "class", f), (!h || m & /*styleVars*/
134
- 16) && g(
135
- e,
136
- "style",
137
- /*styleVars*/
138
- c[4]
139
- );
140
- const y = {};
141
- m & /*videoOverlay*/
142
- 2 && (y.videoOverlay = /*videoOverlay*/
143
- c[1]), m & /*videoOverlayTransparency*/
144
- 4 && (y.videoOverlayTransparency = /*videoOverlayTransparency*/
145
- c[2]), m & /*borderWidth*/
146
- 8 && (y.borderWidth = /*borderWidth*/
147
- c[3]), l.$set(y);
148
- },
149
- i(c) {
150
- h || (F(u.$$.fragment, c), F(l.$$.fragment, c), h = !0);
151
- },
152
- o(c) {
153
- U(u.$$.fragment, c), U(l.$$.fragment, c), h = !1;
154
- },
155
- d(c) {
156
- c && E(e), te(u), c && E(d), te(l, c);
157
- }
158
- };
159
- }
160
- const tt = 1.36, Ki = "hsl(var(--p))", qi = "hsl(var(--su))";
161
- function $i(a, e, t) {
162
- let s, o, r;
163
- M(a, q, (m) => t(8, o = m)), M(a, ne, (m) => t(9, r = m));
164
- let { loading: n } = e, { videoOverlay: u = "" } = e, { videoOverlayTransparency: f = 100 } = e, d, l, h = 6, c = 0.7;
165
- return X() && (c = 0.85, h = 5), a.$$set = (m) => {
166
- "loading" in m && t(0, n = m.loading), "videoOverlay" in m && t(1, u = m.videoOverlay), "videoOverlayTransparency" in m && t(2, f = m.videoOverlayTransparency);
167
- }, a.$$.update = () => {
168
- a.$$.dirty & /*$videoStore, percentage, rectangleHeight, rectangleWidth, $docDimensions*/
169
- 992 && r && (r.videoWidth / r.videoHeight > tt ? (t(6, l = r.videoHeight * c), t(5, d = l * tt)) : (t(5, d = r.videoWidth * c), t(6, l = d / tt)), v(q, o.width = d, o), v(q, o.height = l, o), v(q, o.x = (r.videoWidth - o.width) / 2, o), v(q, o.y = (r.videoHeight - o.height) / 2, o)), a.$$.dirty & /*rectangleWidth, rectangleHeight, borderWidth*/
170
- 104 && t(4, s = `
171
- --rectangle-width: ${d}px;
172
- --rectangle-height: ${l}px;
173
- --border-color: ${Ki};
174
- --border-color-animation: ${qi};
175
- --rectangle-border: ${h}px;
176
- `);
177
- }, [
178
- n,
179
- u,
180
- f,
181
- h,
182
- s,
183
- d,
184
- l,
185
- c,
186
- o,
187
- r
188
- ];
189
- }
190
- class Ht extends st {
191
- constructor(e) {
192
- super(), ot(
193
- this,
194
- {
195
- target: this.shadowRoot,
196
- props: rt(this.attributes),
197
- customElement: !0
198
- },
199
- $i,
200
- Ji,
201
- nt,
202
- {
203
- loading: 0,
204
- videoOverlay: 1,
205
- videoOverlayTransparency: 2
206
- },
207
- null
208
- ), e && (e.target && j(e.target, this, e.anchor), e.props && (this.$set(e.props), S()));
209
- }
210
- static get observedAttributes() {
211
- return ["loading", "videoOverlay", "videoOverlayTransparency"];
212
- }
213
- get loading() {
214
- return this.$$.ctx[0];
215
- }
216
- set loading(e) {
217
- this.$$set({ loading: e }), S();
218
- }
219
- get videoOverlay() {
220
- return this.$$.ctx[1];
221
- }
222
- set videoOverlay(e) {
223
- this.$$set({ videoOverlay: e }), S();
224
- }
225
- get videoOverlayTransparency() {
226
- return this.$$.ctx[2];
227
- }
228
- set videoOverlayTransparency(e) {
229
- this.$$set({ videoOverlayTransparency: e }), S();
230
- }
231
- }
232
- customElements.define("doc-rectangle", Ht);
233
- function St(a) {
234
- let e, t, s, o, r, n, u, f, d, l, h, c, m, y, Z, b, C, O, A = (
235
- /*$ready*/
236
- a[11] && Zt(a)
237
- );
238
- return h = new Zi({}), m = new Ui({
239
- props: {
240
- showConfigButton: (
241
- /*showConfigButton*/
242
- a[1]
243
- ),
244
- showCameraButton: (
245
- /*showCameraButton*/
246
- a[2]
247
- ),
248
- videoOverlay: (
249
- /*videoOverlay*/
250
- a[3]
251
- ),
252
- videoOverlayTransparency: (
253
- /*videoOverlayTransparency*/
254
- a[4]
255
- ),
256
- handler: (
257
- /*capture*/
258
- a[24]
259
- )
260
- }
261
- }), {
262
- c() {
263
- e = p("div"), t = p("div"), s = p("video"), r = H(), n = p("canvas"), u = H(), f = p("div"), d = p("div"), A && A.c(), l = H(), $(h.$$.fragment), c = H(), $(m.$$.fragment), g(s, "id", "bry-cc-camera-video-tag"), g(s, "class", o = /*$ready*/
264
- a[11] ? X() ? "absolute inset-0" : "w-full h-full object-cover" : "w-0 h-0"), s.playsInline = !0, s.muted = !0, s.autoplay = !0, g(n, "id", "bry-ce-detectionsCanvas"), g(n, "class", "absolute top-0 left-0 max-w-full"), g(t, "class", "overflow-hidden"), oe(
265
- t,
266
- "width",
267
- /*$videoStore*/
268
- a[12].videoWidth + "px"
269
- ), oe(
270
- t,
271
- "height",
272
- /*$videoStore*/
273
- a[12].videoHeight + "px"
274
- ), g(d, "class", "flex flex-grow w-full items-center justify-center relative"), g(f, "class", "absolute inset-0 flex flex-col items-center justify-between w-full h-full"), g(e, "class", y = /*$ready*/
275
- a[11] ? "relative" : "relative w-0 h-0"), e.hidden = Z = /*$cameraStatusStore*/
276
- a[10] !== W.OK;
277
- },
278
- m(T, k) {
279
- j(T, e, k), I(e, t), I(t, s), a[32](s), I(t, r), I(t, n), a[34](n), I(e, u), I(e, f), I(f, d), A && A.m(d, null), I(f, l), ee(h, f, null), I(f, c), ee(m, f, null), b = !0, C || (O = [
280
- le(
281
- s,
282
- "canplay",
283
- /*canplay_handler*/
284
- a[33]
285
- ),
286
- le(
287
- s,
288
- "play",
289
- /*play*/
290
- a[5],
291
- { once: !0 }
292
- )
293
- ], C = !0);
294
- },
295
- p(T, k) {
296
- (!b || k[0] & /*$ready*/
297
- 2048 && o !== (o = /*$ready*/
298
- T[11] ? X() ? "absolute inset-0" : "w-full h-full object-cover" : "w-0 h-0")) && g(s, "class", o), (!b || k[0] & /*$videoStore*/
299
- 4096) && oe(
300
- t,
301
- "width",
302
- /*$videoStore*/
303
- T[12].videoWidth + "px"
304
- ), (!b || k[0] & /*$videoStore*/
305
- 4096) && oe(
306
- t,
307
- "height",
308
- /*$videoStore*/
309
- T[12].videoHeight + "px"
310
- ), /*$ready*/
311
- T[11] ? A ? (A.p(T, k), k[0] & /*$ready*/
312
- 2048 && F(A, 1)) : (A = Zt(T), A.c(), F(A, 1), A.m(d, null)) : A && (it(), U(A, 1, 1, () => {
313
- A = null;
314
- }), at());
315
- const P = {};
316
- k[0] & /*showConfigButton*/
317
- 2 && (P.showConfigButton = /*showConfigButton*/
318
- T[1]), k[0] & /*showCameraButton*/
319
- 4 && (P.showCameraButton = /*showCameraButton*/
320
- T[2]), k[0] & /*videoOverlay*/
321
- 8 && (P.videoOverlay = /*videoOverlay*/
322
- T[3]), k[0] & /*videoOverlayTransparency*/
323
- 16 && (P.videoOverlayTransparency = /*videoOverlayTransparency*/
324
- T[4]), m.$set(P), (!b || k[0] & /*$ready*/
325
- 2048 && y !== (y = /*$ready*/
326
- T[11] ? "relative" : "relative w-0 h-0")) && g(e, "class", y), (!b || k[0] & /*$cameraStatusStore*/
327
- 1024 && Z !== (Z = /*$cameraStatusStore*/
328
- T[10] !== W.OK)) && (e.hidden = Z);
329
- },
330
- i(T) {
331
- b || (F(A), F(h.$$.fragment, T), F(m.$$.fragment, T), b = !0);
332
- },
333
- o(T) {
334
- U(A), U(h.$$.fragment, T), U(m.$$.fragment, T), b = !1;
335
- },
336
- d(T) {
337
- T && E(e), a[32](null), a[34](null), A && A.d(), te(h), te(m), C = !1, lt(O);
338
- }
339
- };
340
- }
341
- function Zt(a) {
342
- let e, t, s, o;
343
- return e = new Bi({
344
- props: {
345
- isCountingDown: (
346
- /*isCountingDown*/
347
- a[9]
348
- )
349
- }
350
- }), s = new Ht({
351
- props: {
352
- loading: (
353
- /*isCountingDown*/
354
- a[9]
355
- ),
356
- videoOverlay: (
357
- /*videoOverlay*/
358
- a[3]
359
- ),
360
- videoOverlayTransparency: (
361
- /*videoOverlayTransparency*/
362
- a[4]
363
- )
364
- }
365
- }), {
366
- c() {
367
- $(e.$$.fragment), t = H(), $(s.$$.fragment);
368
- },
369
- m(r, n) {
370
- ee(e, r, n), j(r, t, n), ee(s, r, n), o = !0;
371
- },
372
- p(r, n) {
373
- const u = {};
374
- n[0] & /*isCountingDown*/
375
- 512 && (u.isCountingDown = /*isCountingDown*/
376
- r[9]), e.$set(u);
377
- const f = {};
378
- n[0] & /*isCountingDown*/
379
- 512 && (f.loading = /*isCountingDown*/
380
- r[9]), n[0] & /*videoOverlay*/
381
- 8 && (f.videoOverlay = /*videoOverlay*/
382
- r[3]), n[0] & /*videoOverlayTransparency*/
383
- 16 && (f.videoOverlayTransparency = /*videoOverlayTransparency*/
384
- r[4]), s.$set(f);
385
- },
386
- i(r) {
387
- o || (F(e.$$.fragment, r), F(s.$$.fragment, r), o = !0);
388
- },
389
- o(r) {
390
- U(e.$$.fragment, r), U(s.$$.fragment, r), o = !1;
391
- },
392
- d(r) {
393
- te(e, r), r && E(t), te(s, r);
394
- }
395
- };
396
- }
397
- function Pt(a) {
398
- let e, t, s, o, r;
399
- function n(d, l) {
400
- return (
401
- /*$isLoading*/
402
- d[20] ? ta : ea
403
- );
404
- }
405
- let u = n(a), f = u(a);
406
- return {
407
- c() {
408
- e = p("slot"), t = p("div"), s = p("img"), r = H(), f.c(), _e(s.src, o = Pi) || g(s, "src", o), g(s, "alt", "loading gif"), g(s, "class", "m-auto h-[10em] lg:h-[12em]"), g(t, "class", "translate-y-1/3 md:translate-y-1/4 xl:translate-y-1/2"), g(e, "name", "loading-camera-gif"), g(e, "class", "block h-[17em] lg:h-[21.6em] xl:h-[30em]");
409
- },
410
- m(d, l) {
411
- j(d, e, l), I(e, t), I(t, s), I(t, r), f.m(t, null);
412
- },
413
- p(d, l) {
414
- u === (u = n(d)) && f ? f.p(d, l) : (f.d(1), f = u(d), f && (f.c(), f.m(t, null)));
415
- },
416
- d(d) {
417
- d && E(e), f.d();
418
- }
419
- };
420
- }
421
- function ea(a) {
422
- let e, t = (
423
- /*$_*/
424
- a[18]("faceCollector.initiatingCamera") + ""
425
- ), s;
426
- return {
427
- c() {
428
- e = p("span"), s = V(t), g(e, "class", "2xl:text-2xl lg:text-2xl text-md block p-2 m-auto text-center");
429
- },
430
- m(o, r) {
431
- j(o, e, r), I(e, s);
432
- },
433
- p(o, r) {
434
- r[0] & /*$_*/
435
- 262144 && t !== (t = /*$_*/
436
- o[18]("faceCollector.initiatingCamera") + "") && x(s, t);
437
- },
438
- d(o) {
439
- o && E(e);
440
- }
441
- };
442
- }
443
- function ta(a) {
444
- let e;
445
- return {
446
- c() {
447
- e = p("span"), e.textContent = "Loading camera...", g(e, "class", "2xl:text-2xl lg:text-2xl text-md block p-2 m-auto text-center");
448
- },
449
- m(t, s) {
450
- j(t, e, s);
451
- },
452
- p: Q,
453
- d(t) {
454
- t && E(e);
455
- }
456
- };
457
- }
458
- function Wt(a) {
459
- let e, t, s = (
460
- /*$_*/
461
- a[18]("faceCollector.finish") + ""
462
- ), o, r, n, u, f = (
463
- /*$_*/
464
- a[18]("faceCollector.retakePhoto") + ""
465
- ), d, l, h;
466
- return {
467
- c() {
468
- e = p("div"), t = p("button"), o = V(s), n = H(), u = p("button"), d = V(f), t.disabled = r = /*$justification*/
469
- a[15].length === 0, g(t, "class", "ce-dui-btn ce-dui-btn-primary ce-dui-btn-block flex-shrink"), g(u, "id", "bry-cc-retake-button"), g(u, "class", "ce-dui-btn ce-dui-btn-block ce-dui-btn-outline flex-shrink"), g(e, "class", "ce-dui-btn-group flex");
470
- },
471
- m(c, m) {
472
- j(c, e, m), I(e, t), I(t, o), I(e, n), I(e, u), I(u, d), l || (h = [
473
- le(
474
- t,
475
- "click",
476
- /*click_handler*/
477
- a[35]
478
- ),
479
- le(
480
- u,
481
- "click",
482
- /*click_handler_1*/
483
- a[36]
484
- )
485
- ], l = !0);
486
- },
487
- p(c, m) {
488
- m[0] & /*$_*/
489
- 262144 && s !== (s = /*$_*/
490
- c[18]("faceCollector.finish") + "") && x(o, s), m[0] & /*$justification*/
491
- 32768 && r !== (r = /*$justification*/
492
- c[15].length === 0) && (t.disabled = r), m[0] & /*$_*/
493
- 262144 && f !== (f = /*$_*/
494
- c[18]("faceCollector.retakePhoto") + "") && x(d, f);
495
- },
496
- d(c) {
497
- c && E(e), l = !1, lt(h);
498
- }
499
- };
500
- }
501
- function ia(a) {
502
- let e, t;
503
- return e = new Gi({ props: { handler: (
504
- /*func*/
505
- a[40]
506
- ) } }), {
507
- c() {
508
- $(e.$$.fragment);
509
- },
510
- m(s, o) {
511
- ee(e, s, o), t = !0;
512
- },
513
- p: Q,
514
- i(s) {
515
- t || (F(e.$$.fragment, s), t = !0);
516
- },
517
- o(s) {
518
- U(e.$$.fragment, s), t = !1;
519
- },
520
- d(s) {
521
- te(e, s);
522
- }
523
- };
524
- }
525
- function aa(a) {
526
- let e, t, s, o, r, n;
527
- function u(l, h) {
528
- return (
529
- /*$captured*/
530
- l[13] ? sa : oa
531
- );
532
- }
533
- let f = u(a), d = f(a);
534
- return {
535
- c() {
536
- e = p("div"), t = p("img"), r = H(), d.c(), g(t, "class", "m-auto col-start-1 col-end-1 max-h-[23.2em]"), _e(t.src, s = /*$dataTypePrefix*/
537
- a[19] + "," + /*$image*/
538
- a[16]) || g(t, "src", s), t.hidden = o = !/*$captured*/
539
- a[13] || !/*$showFaceWhileValidating*/
540
- a[21], g(t, "alt", ""), g(e, "class", n = "grid-cols-1 grid-rows-2 sm:grid-cols-2 sm:grid-rows-1 gap-[.5em] " + (/*$showFaceWhileValidating*/
541
- a[21] ? "grid overflow-hidden" : "absolute -translate-y-1/2 -translate-x-1/2 top-1/2 left-1/2 overflow-visible"));
542
- },
543
- m(l, h) {
544
- j(l, e, h), I(e, t), I(e, r), d.m(e, null);
545
- },
546
- p(l, h) {
547
- h[0] & /*$dataTypePrefix, $image*/
548
- 589824 && !_e(t.src, s = /*$dataTypePrefix*/
549
- l[19] + "," + /*$image*/
550
- l[16]) && g(t, "src", s), h[0] & /*$captured, $showFaceWhileValidating*/
551
- 2105344 && o !== (o = !/*$captured*/
552
- l[13] || !/*$showFaceWhileValidating*/
553
- l[21]) && (t.hidden = o), f === (f = u(l)) && d ? d.p(l, h) : (d.d(1), d = f(l), d && (d.c(), d.m(e, null))), h[0] & /*$showFaceWhileValidating*/
554
- 2097152 && n !== (n = "grid-cols-1 grid-rows-2 sm:grid-cols-2 sm:grid-rows-1 gap-[.5em] " + (/*$showFaceWhileValidating*/
555
- l[21] ? "grid overflow-hidden" : "absolute -translate-y-1/2 -translate-x-1/2 top-1/2 left-1/2 overflow-visible")) && g(e, "class", n);
556
- },
557
- i: Q,
558
- o: Q,
559
- d(l) {
560
- l && E(e), d.d();
561
- }
562
- };
563
- }
564
- function sa(a) {
565
- let e, t, s, o, r = (
566
- /*$_*/
567
- a[18]("faceCollector.finish") + ""
568
- ), n, u, f, d, l = (
569
- /*$_*/
570
- a[18]("faceCollector.retakePhoto") + ""
571
- ), h, c, m;
572
- function y(C, O) {
573
- return (
574
- /*$requestResult*/
575
- C[17] === re.TEMPLATE_EXTRACTION_ERROR ? la : (
576
- /*$saved*/
577
- C[14] ? na : ra
578
- )
579
- );
580
- }
581
- let Z = y(a), b = Z(a);
582
- return {
583
- c() {
584
- e = p("div"), b.c(), t = H(), s = p("div"), o = p("button"), n = V(r), f = H(), d = p("button"), h = V(l), o.disabled = u = /*$saved*/
585
- a[14] || /*$requestResult*/
586
- a[17] !== re.OK, g(o, "class", "ce-dui-btn ce-dui-btn-primary ce-dui-btn-block flex-shrink"), g(d, "id", "bry-cc-retake-button"), g(d, "class", "ce-dui-btn ce-dui-btn-block ce-dui-btn-outline flex-shrink"), g(s, "class", "ce-dui-btn-group flex"), g(e, "class", "flex flex-col justify-between");
587
- },
588
- m(C, O) {
589
- j(C, e, O), b.m(e, null), I(e, t), I(e, s), I(s, o), I(o, n), I(s, f), I(s, d), I(d, h), c || (m = [
590
- le(
591
- o,
592
- "click",
593
- /*click_handler_2*/
594
- a[38]
595
- ),
596
- le(
597
- d,
598
- "click",
599
- /*click_handler_3*/
600
- a[39]
601
- )
602
- ], c = !0);
603
- },
604
- p(C, O) {
605
- Z === (Z = y(C)) && b ? b.p(C, O) : (b.d(1), b = Z(C), b && (b.c(), b.m(e, t))), O[0] & /*$_*/
606
- 262144 && r !== (r = /*$_*/
607
- C[18]("faceCollector.finish") + "") && x(n, r), O[0] & /*$saved, $requestResult*/
608
- 147456 && u !== (u = /*$saved*/
609
- C[14] || /*$requestResult*/
610
- C[17] !== re.OK) && (o.disabled = u), O[0] & /*$_*/
611
- 262144 && l !== (l = /*$_*/
612
- C[18]("faceCollector.retakePhoto") + "") && x(h, l);
613
- },
614
- d(C) {
615
- C && E(e), b.d(), c = !1, lt(m);
616
- }
617
- };
618
- }
619
- function oa(a) {
620
- let e;
621
- return {
622
- c() {
623
- e = p("div"), g(e, "class", "");
624
- },
625
- m(t, s) {
626
- j(t, e, s);
627
- },
628
- p: Q,
629
- d(t) {
630
- t && E(e);
631
- }
632
- };
633
- }
634
- function na(a) {
635
- let e, t = (
636
- /*$_*/
637
- a[18]("docCollector.captured") + ""
638
- ), s;
639
- return {
640
- c() {
641
- e = p("h1"), s = V(t), g(e, "class", "text-3xl font-bold pb-[1em] transition-opacity");
642
- },
643
- m(o, r) {
644
- j(o, e, r), I(e, s);
645
- },
646
- p(o, r) {
647
- r[0] & /*$_*/
648
- 262144 && t !== (t = /*$_*/
649
- o[18]("docCollector.captured") + "") && x(s, t);
650
- },
651
- d(o) {
652
- o && E(e);
653
- }
654
- };
655
- }
656
- function ra(a) {
657
- let e, t = (
658
- /*$_*/
659
- a[18]("faceCollector.everythingOk") + ""
660
- ), s;
661
- return {
662
- c() {
663
- e = p("h1"), s = V(t), g(e, "class", "text-3xl font-bold pb-[1em] transition-opacity");
664
- },
665
- m(o, r) {
666
- j(o, e, r), I(e, s);
667
- },
668
- p(o, r) {
669
- r[0] & /*$_*/
670
- 262144 && t !== (t = /*$_*/
671
- o[18]("faceCollector.everythingOk") + "") && x(s, t);
672
- },
673
- d(o) {
674
- o && E(e);
675
- }
676
- };
677
- }
678
- function la(a) {
679
- let e, t = (
680
- /*$_*/
681
- a[18]("docCollector.docNotFound") + ""
682
- ), s;
683
- return {
684
- c() {
685
- e = p("h1"), s = V(t), g(e, "class", "text-3xl font-bold pb-[1em] transition-opacity text-error");
686
- },
687
- m(o, r) {
688
- j(o, e, r), I(e, s);
689
- },
690
- p(o, r) {
691
- r[0] & /*$_*/
692
- 262144 && t !== (t = /*$_*/
693
- o[18]("docCollector.docNotFound") + "") && x(s, t);
694
- },
695
- d(o) {
696
- o && E(e);
697
- }
698
- };
699
- }
700
- function ca(a) {
701
- let e, t, s, o, r, n, u, f, d, l = (
702
- /*$videoStore*/
703
- a[12] && St(a)
704
- ), h = !/*$ready*/
705
- a[11] && /*$cameraStatusStore*/
706
- a[10] === W.OK && Pt(a), c = (
707
- /*$captured*/
708
- a[13] && Wt(a)
709
- );
710
- const m = [aa, ia], y = [];
711
- function Z(b, C) {
712
- return (
713
- /*showUnconformities*/
714
- b[0] && /*$captured*/
715
- b[13] ? 0 : (
716
- /*$cameraStatusStore*/
717
- b[10] !== W.OK ? 1 : -1
718
- )
719
- );
720
- }
721
- return ~(n = Z(a)) && (u = y[n] = m[n](a)), {
722
- c() {
723
- e = p("div"), t = p("div"), l && l.c(), s = H(), h && h.c(), o = H(), c && c.c(), r = H(), u && u.c(), f = mi(), this.c = Q, g(t, "class", "relative mx-auto"), g(e, "class", "flex flex-col justify-between");
724
- },
725
- m(b, C) {
726
- j(b, e, C), I(e, t), l && l.m(t, null), I(t, s), h && h.m(t, null), I(t, o), c && c.m(t, null), a[37](e), j(b, r, C), ~n && y[n].m(b, C), j(b, f, C), d = !0;
727
- },
728
- p(b, C) {
729
- /*$videoStore*/
730
- b[12] ? l ? (l.p(b, C), C[0] & /*$videoStore*/
731
- 4096 && F(l, 1)) : (l = St(b), l.c(), F(l, 1), l.m(t, s)) : l && (it(), U(l, 1, 1, () => {
732
- l = null;
733
- }), at()), !/*$ready*/
734
- b[11] && /*$cameraStatusStore*/
735
- b[10] === W.OK ? h ? h.p(b, C) : (h = Pt(b), h.c(), h.m(t, o)) : h && (h.d(1), h = null), /*$captured*/
736
- b[13] ? c ? c.p(b, C) : (c = Wt(b), c.c(), c.m(t, null)) : c && (c.d(1), c = null);
737
- let O = n;
738
- n = Z(b), n === O ? ~n && y[n].p(b, C) : (u && (it(), U(y[O], 1, 1, () => {
739
- y[O] = null;
740
- }), at()), ~n ? (u = y[n], u ? u.p(b, C) : (u = y[n] = m[n](b), u.c()), F(u, 1), u.m(f.parentNode, f)) : u = null);
741
- },
742
- i(b) {
743
- d || (F(l), F(u), d = !0);
744
- },
745
- o(b) {
746
- U(l), U(u), d = !1;
747
- },
748
- d(b) {
749
- b && E(e), l && l.d(), h && h.d(), c && c.d(), a[37](null), b && E(r), ~n && y[n].d(b), b && E(f);
750
- }
751
- };
752
- }
753
- let da = !1, ua = 0;
754
- function ga(a, e, t) {
755
- const s = e.videoWidth / e.videoHeight, o = t.width / t.height;
756
- let r = 0, n = 0, u = e.videoWidth, f = e.videoHeight;
757
- s > o ? (u = e.videoHeight * o, r = (e.videoWidth - u) / 2) : s < o && (f = e.videoWidth / o, n = (e.videoHeight - f) / 2), a.drawImage(e, r, n, u, f, 0, 0, t.width, t.height);
758
- }
759
- function fa(a, e, t) {
760
- let s, o, r, n, u, f, d, l, h, c, m, y, Z, b, C, O, A, T, k, P, De, J, ue, K, ct, dt, ut;
761
- M(a, Ge, (i) => t(54, s = i)), M(a, be, (i) => t(56, r = i)), M(a, G, (i) => t(10, n = i)), M(a, ve, (i) => t(11, u = i)), M(a, bi, (i) => t(57, f = i)), M(a, Ie, (i) => t(58, d = i)), M(a, vi, (i) => t(59, l = i)), M(a, de, (i) => t(60, h = i)), M(a, ne, (i) => t(12, c = i)), M(a, we, (i) => t(13, m = i)), M(a, Qe, (i) => t(61, y = i)), M(a, Ye, (i) => t(62, Z = i)), M(a, Nt, (i) => t(63, b = i)), M(a, q, (i) => t(64, C = i)), M(a, Ce, (i) => t(65, O = i)), M(a, Xe, (i) => t(14, A = i)), M(a, Ii, (i) => t(15, T = i)), M(a, zt, (i) => t(16, k = i)), M(a, ye, (i) => t(17, P = i)), M(a, wi, (i) => t(18, De = i)), M(a, Ve, (i) => t(66, J = i)), M(a, jt, (i) => t(67, K = i)), M(a, xe, (i) => t(68, ct = i)), M(a, Ci, (i) => t(20, dt = i)), M(a, yi, (i) => t(21, ut = i));
762
- let _, R, Y, ce = !1, gt = !1, L = {
763
- width: 2560,
764
- height: 1440,
765
- aspectRatio: -1
766
- };
767
- const Lt = { width: 2560, height: 1440 };
768
- let { enableMinutiae: Te } = e, { videoDimensions: Ae } = e, { noTabs: Oe } = e, { weightsPath: Ne } = e, { showUnconformities: ft } = e, { showConfigButton: ht } = e, { showCameraButton: mt } = e, { videoOverlay: bt } = e, { videoOverlayTransparency: vt } = e;
769
- const ge = Et(!1);
770
- M(a, ge, (i) => t(55, o = i));
771
- const ze = Et("data:image/png;base64");
772
- M(a, ze, (i) => t(19, ue = i));
773
- let It = !1, fe = !0, wt = 0, je = 0, ke = !0, Ct = 0, Re = (/* @__PURE__ */ new Date()).getTime(), Ee = !1;
774
- Mi.mixin({
775
- toast: !0,
776
- position: "bottom-left",
777
- timer: 13e3,
778
- timerProgressBar: !0
779
- }), pi(async () => {
780
- if (v(ve, u = !1, u), yt(), K)
781
- try {
782
- await _i(Ne), gt = !0;
783
- } catch {
784
- v(jt, K = !1, K);
785
- }
786
- await Ze(), Bt();
787
- });
788
- function yt() {
789
- v(we, m = !1, m), v(Nt, b = !0, b), v(Ce, O = "", O), v(Ie, d = Je.REAR_CAMERA, d), v(be, r = !1, r), v(Xe, A = !1, A), v(ye, P = re.OK, P), v(Ve, J = "", J);
790
- const i = Di(Ke);
791
- i.closedMouth = !1, i.isPersonCloseEnough = !1, i.isPersonTooclose = !0, i.isPersonInFrame = !1, Ke.set(i);
792
- }
793
- async function Ut() {
794
- const [i, D] = (Ae ?? "")?.replaceAll(" ", "")?.split("x")?.map((w) => w ? parseInt(w) : void 0);
795
- !i || !D || (X() ? (await Wi(), v(
796
- ne,
797
- c = {
798
- videoWidth: window.innerWidth,
799
- videoHeight: window.innerHeight
800
- },
801
- c
802
- )) : v(ne, c = { videoWidth: i, videoHeight: D }, c));
803
- }
804
- function Mt() {
805
- v(G, n = W.OK, n), It = !0, fe = !1;
806
- }
807
- async function he() {
808
- if (K && !gt)
809
- return pe(_, he);
810
- if (_) {
811
- if (ct !== $e.Document && !Oe)
812
- return pe(_, he);
813
- v(ve, u = !0, u), K && (o || v(ge, o = !0, o)), pe(_, he);
814
- }
815
- }
816
- async function pt() {
817
- let i = Gt();
818
- if (K && !await Fi(i)) {
819
- console.warn("Document capture - document not detected! Resetting capture.");
820
- return;
821
- }
822
- v(we, m = !0, m);
823
- let D = [];
824
- try {
825
- const w = i.toDataURL("image/jpeg").split(",");
826
- v(ze, ue = w[0], ue), v(zt, k = w[1], k), v(Ve, J = w[1], J), D = [
827
- {
828
- bodyPart: "DOCUMENT",
829
- data: J
830
- }
831
- ], v(ye, P = re.OK, P), window.dispatchEvent(new CustomEvent(
832
- "document-unconformities-validated",
833
- {
834
- detail: { bodyParts: D, status: P }
835
- }
836
- ));
837
- } catch (w) {
838
- console.error(w);
839
- let N, z = Hi.DOCUMENT_NOT_FOUND, B = [];
840
- w instanceof Error && ["DOCUMENT_NOT_FOUND"].includes(w.message) && (v(ye, P = re.TEMPLATE_EXTRACTION_ERROR, P), N = w.message, B = [
841
- {
842
- bodyPart: "DOCUMENT",
843
- data: J,
844
- format: "jpg"
845
- }
846
- ]), window.dispatchEvent(new CustomEvent(
847
- "document-unconformities-validated",
848
- {
849
- detail: {
850
- bodyParts: B,
851
- errorCode: N,
852
- translatedError: De(z),
853
- status: P
854
- }
855
- }
856
- ));
857
- }
858
- }
859
- function Se() {
860
- const i = {
861
- bodyPart: "DOCUMENT",
862
- data: k,
863
- justification: T
864
- };
865
- v(Xe, A = !0, A), window.dispatchEvent(new CustomEvent("export-document", { detail: i }));
866
- }
867
- function me() {
868
- window.dispatchEvent(new CustomEvent("document-scrapped")), yt(), fe && Mt();
869
- }
870
- async function Ze(i) {
871
- if (!ke) {
872
- v(G, n = W.CAMERA_ORIENTATION_PORTRAIT, n);
873
- return;
874
- }
875
- await Ut();
876
- try {
877
- let { stream: D, deviceId: w, width: N, height: z, aspectRatio: B } = await kt(L.width, L.height, d, i);
878
- if (v(Qe, y = D, y), L.aspectRatio = B || N / z, L.aspectRatio > 1 && N < L.width || L.aspectRatio < 1 && z < L.width) {
879
- L.width = N, L.height = N / 1.7777, y.getTracks()?.forEach((We) => We?.stop());
880
- const { stream: Pe } = await kt(L.width, L.height, d, i);
881
- v(Qe, y = Pe, y);
882
- }
883
- v(de, h = w || l[0].deviceId, h);
884
- } catch (D) {
885
- const w = D;
886
- fe = !0;
887
- const N = Me(D) && D.constraint ? D.constraint : "";
888
- console.error(w, N), Me(w) && "message" in w && w.message.includes("Permission denied") && (console.error("User didn't give permission to use camera!"), v(G, n = W.CAMERA_DENIED_ERROR, n)), Me(w) && "message" in w && w.message.includes("Requested device not found") && v(G, n = W.DEVICE_NOT_FOUND_ERROR, n), (N.includes("width") || N.includes("height")) && (console.error(`Camera does not meet the minimum supported requirements! (${N})`), v(G, n = W.CAMERA_UNSUPPORTED, n));
889
- }
890
- }
891
- async function ie() {
892
- v(de, h = "", h), await Ze();
893
- }
894
- function Bt() {
895
- navigator.mediaDevices.ondevicechange = async (i) => {
896
- await Rt(), n !== W.OK ? await ie() : y.active || (qe(), v(G, n = W.DEVICE_NOT_FOUND_ERROR, n));
897
- };
898
- }
899
- function _t() {
900
- v(be, r = !1, r);
901
- const i = (/* @__PURE__ */ new Date()).getTime();
902
- i - Re > 5e3 ? (Re = i, v(Ce, O = "docCollector.docWasNotFound", O)) : Ee || (Ee = !0, setTimeout(
903
- () => {
904
- Ee = !1, O != "docCollector.docWasNotFound" && v(Ce, O = "", O);
905
- },
906
- 1500
907
- ));
908
- }
909
- function Gt() {
910
- const i = c.videoWidth, D = c.videoHeight, w = Lt.width, N = D / i * w, z = document.createElement("canvas"), B = z.getContext("2d");
911
- z.width = w, z.height = N, B && ga(B, _, z);
912
- const Pe = z.width / c.videoWidth, We = z.height / c.videoHeight, di = X() ? 0.25 : 0.15, ui = Math.round(z.height * di), Fe = C.width * Pe, He = C.height * We, Tt = (X() ? 0.15 : 0.2) * Fe, At = 0.2 * He, gi = (z.width - Fe) / 2 - Tt / 2, fi = (z.height - ui - He) / 2 - At / 2, Le = Fe + Tt, Ue = He + At, ae = document.createElement("canvas");
913
- ae.width = Le, ae.height = Ue;
914
- const Be = ae.getContext("2d");
915
- return Be?.clearRect(0, 0, ae.width, ae.height), Be?.drawImage(z, gi, fi, Le, Ue, 0, 0, Le, Ue), Be?.save(), ae;
916
- }
917
- const Qt = ne.subscribe((i) => {
918
- _ && R && (t(6, _.width = i.videoWidth, _), t(6, _.height = i.videoHeight, _), t(7, R.width = i.videoWidth, R), t(7, R.height = i.videoHeight, R));
919
- }), Yt = Ke.subscribe((i) => {
920
- let D = "";
921
- if (i.isPersonCloseEnough ? i.isPersonTooclose ? D = "docCollector.moveAwayCamera" : i.isPersonInFrame || (D = "docCollector.stayInFrame") : D = "docCollector.comeCloserCamera", r && Ti(D), !m && b && r && !ce && i.isPersonInFrame && !(!i.isPersonCloseEnough || i.isPersonTooclose)) {
922
- t(9, ce = !0), Ct = (/* @__PURE__ */ new Date()).getTime() + 4500;
923
- const w = setInterval(
924
- async () => {
925
- if (!b || m || !i.isPersonCloseEnough || i.isPersonTooclose || !i.isPersonInFrame) {
926
- t(9, ce = !1), setTimeout(
927
- () => {
928
- },
929
- 1500
930
- ), clearInterval(w);
931
- return;
932
- }
933
- const N = (/* @__PURE__ */ new Date()).getTime();
934
- Math.floor((Ct - N) % (1e3 * 60) / 1e3) <= 0 && (clearInterval(w), t(9, ce = !1), pt());
935
- },
936
- 100
937
- );
938
- }
939
- }), Xt = we.subscribe((i) => {
940
- Y && (i ? (Y.classList.remove("flex"), Y.classList.add("hidden")) : (Y.classList.add("flex"), Y.classList.remove("hidden")));
941
- }), Vt = Ye.subscribe((i) => {
942
- _ && i && (console.log("setting null in video srcObject"), t(6, _.srcObject = null, _), t(6, _.src = "", _), v(de, h = null, h));
943
- });
944
- xe.subscribe(async (i) => {
945
- i === $e.Document && await Rt();
946
- });
947
- const xt = de.subscribe(async (i) => {
948
- if (!(!y || !i))
949
- try {
950
- const D = await Ai(L.width, L.height, i);
951
- t(6, _.srcObject = y, _), v(Ye, Z = !1, Z), y.getTracks().forEach((w) => {
952
- w.readyState === "live" && console.log(`Camera ${w.label} opened successfully!`);
953
- }), v(G, n = W.OK, n), Oi(_);
954
- } catch (D) {
955
- const w = D;
956
- fe = !0, Me(w) && "message" in w && w.message.includes("Requested device not found") && v(G, n = W.DEVICE_NOT_FOUND_ERROR, n);
957
- }
958
- }), Jt = xe.subscribe(async (i) => {
959
- i === $e.Document && !It && !m && da && await Mt();
960
- }), Kt = ge.subscribe(async (i) => {
961
- i && Dt();
962
- }), qt = ve.subscribe((i) => {
963
- i && window.dispatchEvent(new CustomEvent("brycc-camera-ready"));
964
- }), $t = Ni.subscribe(async (i) => {
965
- if (!(!c || l.length <= 1)) {
966
- if (qe(), !X()) {
967
- const w = (l.findIndex((z) => z.deviceId === h) + 1) % l.length, N = l[w].deviceId;
968
- await Ze(N);
969
- return;
970
- }
971
- i ? (v(Ie, d = Je.FRONT_CAMERA, d), await ie()) : (v(Ie, d = Je.REAR_CAMERA, d), await ie());
972
- }
973
- }), ei = zi.subscribe(async (i) => {
974
- !i.isSupported || !X() || f != "DOCUMENT" || (ke = i.orientation.includes("portrait"), ke ? _ && !u ? await ie() : v(G, n = W.OK, n) : v(G, n = W.CAMERA_ORIENTATION_PORTRAIT, n));
975
- });
976
- async function Dt() {
977
- let i;
978
- try {
979
- if (je >= ua) {
980
- je = 0;
981
- const D = await ji(), w = await import("./face_api_0e3ce8c8_3.1.0.js");
982
- let N;
983
- if (N = w.detectSingleFace(_, D), i = await N.withFaceLandmarks(), R.getContext("2d")?.clearRect(0, 0, R.width, R.height), i != null) {
984
- const z = Qi(R, _, !0);
985
- ki(R, _, z);
986
- const B = Yi(i, z);
987
- Ri(B) ? (Ei(B, R, Te, !0), v(be, r = !0, r), Re = (/* @__PURE__ */ new Date()).getTime()) : _t();
988
- } else
989
- _t();
990
- } else
991
- je++;
992
- } catch (D) {
993
- console.warn(`FaceapiLoop: ${D}`);
994
- } finally {
995
- o && pe(_, Dt);
996
- }
997
- }
998
- Ge.subscribe(async (i) => {
999
- i && (me(), v(Ge, s = !1, s));
1000
- }), Si(() => {
1001
- console.log("Destroying document collector"), qe(), Xt(), Yt(), Qt(), Vt(), xt(), Jt(), clearInterval(wt), Kt(), $t(), qt(), ei(), wt = 0;
1002
- });
1003
- function ti(i) {
1004
- et[i ? "unshift" : "push"](() => {
1005
- _ = i, t(6, _);
1006
- });
1007
- }
1008
- const ii = () => {
1009
- t(6, _.width = c.videoWidth, _), t(6, _.height = c.videoHeight, _), t(7, R.width = c.videoWidth, R), t(7, R.height = c.videoHeight, R);
1010
- };
1011
- function ai(i) {
1012
- et[i ? "unshift" : "push"](() => {
1013
- R = i, t(7, R);
1014
- });
1015
- }
1016
- const si = () => Se(), oi = () => me();
1017
- function ni(i) {
1018
- et[i ? "unshift" : "push"](() => {
1019
- Y = i, t(8, Y);
1020
- });
1021
- }
1022
- const ri = () => Se(), li = () => me(), ci = async () => {
1023
- await ie();
1024
- };
1025
- return a.$$set = (i) => {
1026
- "enableMinutiae" in i && t(28, Te = i.enableMinutiae), "videoDimensions" in i && t(29, Ae = i.videoDimensions), "noTabs" in i && t(30, Oe = i.noTabs), "weightsPath" in i && t(31, Ne = i.weightsPath), "showUnconformities" in i && t(0, ft = i.showUnconformities), "showConfigButton" in i && t(1, ht = i.showConfigButton), "showCameraButton" in i && t(2, mt = i.showCameraButton), "videoOverlay" in i && t(3, bt = i.videoOverlay), "videoOverlayTransparency" in i && t(4, vt = i.videoOverlayTransparency);
1027
- }, [
1028
- ft,
1029
- ht,
1030
- mt,
1031
- bt,
1032
- vt,
1033
- he,
1034
- _,
1035
- R,
1036
- Y,
1037
- ce,
1038
- n,
1039
- u,
1040
- c,
1041
- m,
1042
- A,
1043
- T,
1044
- k,
1045
- P,
1046
- De,
1047
- ue,
1048
- dt,
1049
- ut,
1050
- ge,
1051
- ze,
1052
- pt,
1053
- Se,
1054
- me,
1055
- ie,
1056
- Te,
1057
- Ae,
1058
- Oe,
1059
- Ne,
1060
- ti,
1061
- ii,
1062
- ai,
1063
- si,
1064
- oi,
1065
- ni,
1066
- ri,
1067
- li,
1068
- ci
1069
- ];
1070
- }
1071
- class ha extends st {
1072
- constructor(e) {
1073
- super(), ot(
1074
- this,
1075
- {
1076
- target: this.shadowRoot,
1077
- props: rt(this.attributes),
1078
- customElement: !0
1079
- },
1080
- fa,
1081
- ca,
1082
- nt,
1083
- {
1084
- enableMinutiae: 28,
1085
- videoDimensions: 29,
1086
- noTabs: 30,
1087
- weightsPath: 31,
1088
- showUnconformities: 0,
1089
- showConfigButton: 1,
1090
- showCameraButton: 2,
1091
- videoOverlay: 3,
1092
- videoOverlayTransparency: 4,
1093
- play: 5
1094
- },
1095
- null,
1096
- [-1, -1, -1]
1097
- ), e && (e.target && j(e.target, this, e.anchor), e.props && (this.$set(e.props), S()));
1098
- }
1099
- static get observedAttributes() {
1100
- return [
1101
- "enableMinutiae",
1102
- "videoDimensions",
1103
- "noTabs",
1104
- "weightsPath",
1105
- "showUnconformities",
1106
- "showConfigButton",
1107
- "showCameraButton",
1108
- "videoOverlay",
1109
- "videoOverlayTransparency",
1110
- "play"
1111
- ];
1112
- }
1113
- get enableMinutiae() {
1114
- return this.$$.ctx[28];
1115
- }
1116
- set enableMinutiae(e) {
1117
- this.$$set({ enableMinutiae: e }), S();
1118
- }
1119
- get videoDimensions() {
1120
- return this.$$.ctx[29];
1121
- }
1122
- set videoDimensions(e) {
1123
- this.$$set({ videoDimensions: e }), S();
1124
- }
1125
- get noTabs() {
1126
- return this.$$.ctx[30];
1127
- }
1128
- set noTabs(e) {
1129
- this.$$set({ noTabs: e }), S();
1130
- }
1131
- get weightsPath() {
1132
- return this.$$.ctx[31];
1133
- }
1134
- set weightsPath(e) {
1135
- this.$$set({ weightsPath: e }), S();
1136
- }
1137
- get showUnconformities() {
1138
- return this.$$.ctx[0];
1139
- }
1140
- set showUnconformities(e) {
1141
- this.$$set({ showUnconformities: e }), S();
1142
- }
1143
- get showConfigButton() {
1144
- return this.$$.ctx[1];
1145
- }
1146
- set showConfigButton(e) {
1147
- this.$$set({ showConfigButton: e }), S();
1148
- }
1149
- get showCameraButton() {
1150
- return this.$$.ctx[2];
1151
- }
1152
- set showCameraButton(e) {
1153
- this.$$set({ showCameraButton: e }), S();
1154
- }
1155
- get videoOverlay() {
1156
- return this.$$.ctx[3];
1157
- }
1158
- set videoOverlay(e) {
1159
- this.$$set({ videoOverlay: e }), S();
1160
- }
1161
- get videoOverlayTransparency() {
1162
- return this.$$.ctx[4];
1163
- }
1164
- set videoOverlayTransparency(e) {
1165
- this.$$set({ videoOverlayTransparency: e }), S();
1166
- }
1167
- get play() {
1168
- return this.$$.ctx[5];
1169
- }
1170
- }
1171
- customElements.define("document-collector", ha);
1172
- export {
1173
- ha as default
1174
- };