@idscan/idvc2 3.12.0 → 3.13.0
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.
- package/README.md +15 -0
- package/dist/idvc.js +1 -1
- package/dist/idvc.js.gzip +0 -0
- package/dist/index.html +191 -22
- package/dist/networks/Face-chunk.js +1 -1
- package/dist/networks/MRZ-chunk.js +1 -1
- package/dist/types/bl.d.ts +2 -1
- package/dist/types/idvc.d.ts +9 -1
- package/dist/types/modules/Loader/Loader.d.ts +3 -4
- package/dist/types/modules/Loader/loaderStack.d.ts +35 -0
- package/dist/types/modules/ui/Loader/LoaderUI.d.ts +2 -0
- package/dist/types/modules/ui/Loader/loader-template.d.ts +3 -2
- package/dist/types/neural models/mrzModel.d.ts +2 -4
- package/package.json +18 -8
package/dist/idvc.js.gzip
CHANGED
|
Binary file
|
package/dist/index.html
CHANGED
|
@@ -1,20 +1,166 @@
|
|
|
1
|
-
<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><meta charset="utf-8"><title>Demo Pages</title><style
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><meta charset="utf-8"><title>Demo Pages</title><style>:root {
|
|
2
|
+
--demo-bg: #F4F5F8;
|
|
3
|
+
--demo-surface: #FFFFFF;
|
|
4
|
+
--demo-border: #E3E5EB;
|
|
5
|
+
--demo-text: #1C1C1C;
|
|
6
|
+
--demo-muted: #6B6E78;
|
|
7
|
+
--demo-accent: #3B6FE0;
|
|
8
|
+
--demo-accent-soft: #E9F0FD;
|
|
9
|
+
--demo-danger: #C4372B;
|
|
10
|
+
--demo-radius: 12px;
|
|
11
|
+
}
|
|
12
|
+
body {
|
|
13
|
+
margin: 0;
|
|
14
|
+
background: var(--demo-bg);
|
|
15
|
+
color: var(--demo-text);
|
|
16
|
+
font: 14px/1.4 Inter, Arial, "Helvetica Neue", Helvetica, sans-serif;
|
|
17
|
+
}
|
|
18
|
+
.container * {
|
|
19
|
+
box-sizing: border-box;
|
|
20
|
+
font-family: Inter, sans-serif;
|
|
21
|
+
}
|
|
22
|
+
.demo-header {
|
|
23
|
+
max-width: 920px;
|
|
24
|
+
margin: 0 auto;
|
|
25
|
+
padding: 20px 24px 0;
|
|
26
|
+
}
|
|
27
|
+
.demo-header h1 {
|
|
4
28
|
margin: 0;
|
|
29
|
+
font-size: 20px;
|
|
30
|
+
font-weight: 600;
|
|
31
|
+
}
|
|
32
|
+
.demo-layout {
|
|
33
|
+
display: flex;
|
|
34
|
+
flex-direction: column;
|
|
35
|
+
align-items: center;
|
|
36
|
+
gap: 20px;
|
|
37
|
+
padding: 20px 24px 40px;
|
|
38
|
+
}
|
|
39
|
+
.demo-card,
|
|
40
|
+
.demo-panel {
|
|
41
|
+
background: var(--demo-surface);
|
|
42
|
+
border: 1px solid var(--demo-border);
|
|
43
|
+
border-radius: var(--demo-radius);
|
|
44
|
+
box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
|
|
45
|
+
}
|
|
46
|
+
.demo-card {
|
|
47
|
+
width: 100%;
|
|
48
|
+
max-width: 560px;
|
|
49
|
+
overflow: hidden;
|
|
50
|
+
}
|
|
51
|
+
.demo-panel {
|
|
52
|
+
display: grid;
|
|
53
|
+
grid-template-columns: repeat(3, minmax(0, 1fr));
|
|
54
|
+
width: 100%;
|
|
55
|
+
max-width: 920px;
|
|
56
|
+
box-sizing: border-box;
|
|
57
|
+
}
|
|
58
|
+
.demo-section {
|
|
59
|
+
padding: 14px 16px;
|
|
60
|
+
}
|
|
61
|
+
.demo-section + .demo-section {
|
|
62
|
+
border-left: 1px solid var(--demo-border);
|
|
63
|
+
}
|
|
64
|
+
.demo-section_wide {
|
|
65
|
+
grid-column: 1 / -1;
|
|
66
|
+
border-top: 1px solid var(--demo-border);
|
|
67
|
+
}
|
|
68
|
+
.demo-panel .demo-section_wide {
|
|
69
|
+
border-left: 0;
|
|
70
|
+
}
|
|
71
|
+
.demo-groups {
|
|
72
|
+
display: grid;
|
|
73
|
+
grid-template-columns: minmax(0, 2fr) repeat(3, minmax(0, 1fr));
|
|
74
|
+
gap: 14px 20px;
|
|
75
|
+
}
|
|
76
|
+
.demo-section h2 {
|
|
77
|
+
margin: 0 0 10px;
|
|
78
|
+
font-size: 12px;
|
|
79
|
+
font-weight: 600;
|
|
80
|
+
letter-spacing: 0.04em;
|
|
81
|
+
text-transform: uppercase;
|
|
82
|
+
color: var(--demo-muted);
|
|
83
|
+
}
|
|
84
|
+
.demo-section h3 {
|
|
85
|
+
margin: 0 0 6px;
|
|
86
|
+
font-size: 13px;
|
|
87
|
+
font-weight: 600;
|
|
88
|
+
}
|
|
89
|
+
.demo-section h3 small {
|
|
90
|
+
margin-left: 4px;
|
|
91
|
+
font-size: 12px;
|
|
92
|
+
font-weight: 400;
|
|
93
|
+
color: var(--demo-muted);
|
|
94
|
+
}
|
|
95
|
+
.demo-buttons {
|
|
96
|
+
display: flex;
|
|
97
|
+
flex-wrap: wrap;
|
|
98
|
+
gap: 6px;
|
|
99
|
+
}
|
|
100
|
+
.demo-panel button {
|
|
101
|
+
padding: 7px 12px;
|
|
102
|
+
border: 1px solid var(--demo-border);
|
|
103
|
+
border-radius: 8px;
|
|
104
|
+
background: var(--demo-surface);
|
|
105
|
+
color: var(--demo-text);
|
|
106
|
+
font: inherit;
|
|
107
|
+
font-size: 13px;
|
|
108
|
+
cursor: pointer;
|
|
109
|
+
transition: background-color 0.15s, border-color 0.15s, color 0.15s;
|
|
5
110
|
}
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
111
|
+
.demo-panel button:hover {
|
|
112
|
+
border-color: #C9CDD6;
|
|
113
|
+
background: #F8F9FB;
|
|
114
|
+
}
|
|
115
|
+
.demo-panel button:focus-visible {
|
|
116
|
+
outline: 2px solid var(--demo-accent);
|
|
117
|
+
outline-offset: 2px;
|
|
118
|
+
}
|
|
119
|
+
.demo-panel button[aria-pressed="true"] {
|
|
120
|
+
position: relative;
|
|
121
|
+
border-color: var(--demo-accent);
|
|
122
|
+
background: var(--demo-accent-soft);
|
|
123
|
+
color: var(--demo-accent);
|
|
124
|
+
}
|
|
125
|
+
.demo-panel button.demo-danger {
|
|
126
|
+
color: var(--demo-danger);
|
|
127
|
+
}
|
|
128
|
+
.demo-panel button.demo-quiet {
|
|
129
|
+
border-style: dashed;
|
|
130
|
+
color: var(--demo-muted);
|
|
131
|
+
}
|
|
132
|
+
.demo-segmented {
|
|
133
|
+
display: inline-flex;
|
|
134
|
+
}
|
|
135
|
+
.demo-segmented button {
|
|
136
|
+
min-width: 48px;
|
|
137
|
+
}
|
|
138
|
+
.demo-segmented button:first-child {
|
|
139
|
+
border-radius: 8px 0 0 8px;
|
|
140
|
+
}
|
|
141
|
+
.demo-segmented button + button {
|
|
142
|
+
margin-left: -1px;
|
|
143
|
+
border-radius: 0 8px 8px 0;
|
|
144
|
+
}
|
|
145
|
+
@media (max-width: 720px) {
|
|
146
|
+
.demo-panel {
|
|
147
|
+
grid-template-columns: minmax(0, 1fr);
|
|
9
148
|
}
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
149
|
+
.demo-section + .demo-section {
|
|
150
|
+
border-left: 0;
|
|
151
|
+
border-top: 1px solid var(--demo-border);
|
|
13
152
|
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
153
|
+
.demo-groups {
|
|
154
|
+
grid-template-columns: minmax(0, 1fr);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
@media (max-width: 480px) {
|
|
158
|
+
.demo-header,
|
|
159
|
+
.demo-layout {
|
|
160
|
+
padding-left: 16px;
|
|
161
|
+
padding-right: 16px;
|
|
162
|
+
}
|
|
163
|
+
}</style></head><body><header class="demo-header"><h1>IDVC demo</h1></header><main class="demo-layout"><div class="demo-card"><div id="videoCapturingEl" class="container"></div></div><section class="demo-panel" aria-label="Controls"><section class="demo-section"><h2>Component</h2><div class="demo-buttons"><button id="btn-reload">Reload</button> <button id="btn-remount">Remount</button> <button id="btn-resetAllSteps">Reset all steps</button> <button id="btn-unmount" class="demo-danger">Unmount</button></div></section><section class="demo-section"><h2>Config</h2><div class="demo-buttons"><button id="btn-reconfig">GreenCard + IntId, es</button> <button id="btn-reconfig1">PassportCard</button> <button id="btn-redocs">docTypes: PassportCard</button></div></section><section class="demo-section"><h2>Language</h2><div class="demo-segmented" role="group" aria-label="Language"><button id="btn-change-en" aria-pressed="true">En</button> <button id="btn-change-es" aria-pressed="false">Es</button></div></section><section class="demo-section demo-section_wide" id="loader-scenes-container"><h2>Loader</h2><div class="demo-groups"><div><h3>prepare <small>starting</small></h3><div class="demo-buttons"><button data-scene="prepare" data-top="Neural network is warming up" data-bottom="Document capture will be ready to use shortly...">Warm-up</button> <button data-scene="prepare" data-bottom="Preparing to work">Preparing to work</button> <button data-scene="prepare" data-bottom="Loading step">Loading step</button> <button data-scene="prepare" data-bottom="Mode is changing">Mode is changing</button> <button data-scene="prepare" data-bottom="Loading document">Loading document</button> <button data-scene="prepare" data-bottom="Resetting">Resetting</button></div></div><div><h3>check <small>processing</small></h3><div class="demo-buttons"><button data-scene="check" data-top="Document has been submitted for processing" data-bottom="Please wait for the response">Submit</button> <button data-scene="check" data-top="We are pre-validating your images" data-bottom="Please wait">Consent check</button></div></div><div><h3>send <small>sending</small></h3><div class="demo-buttons"><button data-scene="send" data-bottom="Uploading">Uploading</button> <button data-scene="send" data-top="Sending form data" data-bottom="Please wait">Sending form data</button></div></div><div><h3>Other</h3><div class="demo-buttons"><button id="btn" aria-pressed="false">Spinner</button> <button id="btn-loader" aria-pressed="false">Custom texts</button> <button id="btn-loader-scene-hide" class="demo-quiet">Hide loader</button></div></div></div></section></section></main><script type="module" src="idvc.js"></script><script type="module" src="langs.js"></script><script type="module">import IDVC, { prepareRequestDataForDiveApi } from './idvc.js'
|
|
18
164
|
const keys = {
|
|
19
165
|
'10.105.74.121': 'eyJwZGY0MTdrZXkiOiJXYkZZY2RrdTJOMWdlVXJIb1hZL2RhQW1QUERKZ2NGRTRDODJqazhzYkczaWJoekM0dXV3SnJ4dWZtOE5YcFNBWDJoREhYRXQvMVl4SVhPRGNhOUVHQ0w1cUFPdllQemp2T2hhTzZzcXAvc1lHWGxBTytnZ0NVSkthRm04MTFnQThpajE0RXhrY013NzNLMEwzcEhwMTlvYjdsUUpFSE9xbG83dTNvTjRNczQ9IiwiaW1hZ2VQcm9jZXNzaW5nS2V5Ijoiam1EWWVVMkhqOFhVVWJEdFlPcHRkLzZobnFEcEFQaldhVlpWOG9qOGU3WUVoQ3Q1L3ovNlVlWnRkMDhDWjduaXhrQ1d3SlVpUUllbC9rRHI4RGFxeXpLVnRtZzNRbnROcHZBZnFjQ2ZmeGpBTk1SeVkvbjJWQjloSE02MzlWcG03dktsNWxRQWRJQlFMZFUydGdBcHhYVy9WK3JFa1pIVDVKT1FMdzA0WXBnPSIsInRyYWNrU3RyaW5nUGFyc2VyS2V5IjoiSGlBaUt4UER6amRtUjFSRUZJR0oxUEpmR0tleFl2Z2ZFS3dtVXMwcDVxdWswL1pzbGNiazRXaGt0amFxc0FiYnRyYllZeVB5b21mRm1neFVkLzdHVnJtdFJPTiszZEZZcFk5NHlNMEtSY2dpd3Nrdm5PaGlZZjJubnZ1U0REMGhUWkZKWlh1NDNJNDQxR0U5OHh0d3JJdGN2aVQ1SWJ6bXJOTS9OYlRKK2Z3PSIsImNvbW1vbkxpY2Vuc2VLZXkiOiJkaTdLYmN6T3gzUjA2MTNxNENUaUIrYS9iY2gvcEhuemlucmVUK0JtOXBrcERod1EvbXUyM0dJOFdnOWtkcHRPR3VJbDRmWHpCd214enRZN1hZclg5YVU0SWxoNHhRQUgzY0x6cHJnb0ZyY2EyZjllZ3RJb0NiYkJKcnRWZFVXdUVmZE15NkRMSVA4WG04ZHJjdDFFc29XYnE5dHB3OFh5Ukt4cEM4N1pIbGs9In0=',
|
|
20
166
|
'10.105.74.158': 'eyJwZGY0MTdrZXkiOiIxdFAxUmlYSlx1MDAyQjZxaU0yYUFMYW1CVWNQTGdGY202Y3RVXHUwMDJCeU9OeWg1RjZ4YzdhTmFoR2dUazBzQWs5RjdEZjE2ZXlreXVZcnRJM0Jxc2pnQjZuRklickZrWWl3d3dlSGg2SENObDNGWkttTC9yUmZJc0FLc0FzMUNLMHJrVk5FS1BwdEJIQTc0TmxZNVhlajl1NnpRVms5QUxHeDdxeE1adUlvUUNvVDNqYnFNPSIsImNvbW1vbkxpY2Vuc2VLZXkiOiJuelhkTnRpc0NFXHUwMDJCNTNJODR4dDh3eEZwcGV4TU5QMW54MjdqcnFxNDJvVzRqZ05jZFYwUzFscGM2OGZcdTAwMkIxdlFNVGtlTWR5SjZrNjRRbG80c0prbVpnM3VEUFx1MDAyQjFvWVZ0eVFZODNrdHlKaXZNNE5pLzkxbURBNS9sQURUMEVjY2phUnpaRXZHNGU4RGE5SU1cdTAwMkI5TktFejZlWk5KN20xd3BYaWx0Ny9CdEZzT0VoUT0iLCJpbWFnZVByb2Nlc3NpbmdLZXkiOiIyeW9JWnlpa1hRTHBjdmU2ZjN5YlF6cFo3cGJYR0FjZk9udVVvc3oxbWhUdDlmSW5RcldQaXVta0NlVTg5d2pwaUxoZDJnVWlDSHVKNng5ZnRBZzNNXHUwMDJCV09LYzVSVnhIdm56enl3WGpDb2V2cEQwS05mZ0tCRjQyalRJNXlOQmVFTkpzOVV0MVhPRzdFa1FpdUJWeGtBSEo3TVhuNU1ESmg1S0J1QkVRbWIwMD0iLCJ0cmFja1N0cmluZ1BhcnNlcktleSI6IjFQVmpjeUE3eC9Ia1V5QW55dHdHZEZjZWZNMG5XV0RaYnVSb0VlTXNhOU01L2xqeVBjdHlVNmd5c0NhV0IwWVBQSDFRbm5RQ0xiYktIRER3VGE3TGxmVHNJOUY3emJsOW5ZVGVwbzM1ZE81aWhcdTAwMkJcdTAwMkI4VUhwZWFsaDFQUGJWMzBwL1Rwd1MyQTJqZjVvWnVpS2V4U2haYlx1MDAyQlZcdTAwMkJ1MUdtTk50cTV6YzNJNnNFVWp3PSIsImlPU01SWkRldGVjdG9yS2V5IjoibHZKNkVMM0Q0ZWdNMVpLTWh5VEJhdXlBeDNkNmViL2JWYWt1L1h2a1lFdFc1b3N4MVYxWlJMZUhtcW5TV3JtUUF2Smp1N3dnTnNNN1dWNFBKNEtvT3NHeU5QbjdxdTZhWDZFemI0ejIzMGVuUVpDWFBRVjBaTEVpcEtGUkZqZEc4bS9qU1dObmlFSW1Pd2ZPbko0VXBIXHUwMDJCRzNvOTVnbHQ0MjdDT2tDRUpsTVU9IiwiaU9TUERGRGV0ZWN0b3JLZXkiOiIxQjBLLkIxUDBNNU8uRzdJNEQuRTFFNUg4T3pCZU9qTiJ9',
|
|
@@ -207,9 +353,10 @@
|
|
|
207
353
|
let videoCapturingComponent = new IDVC(config);
|
|
208
354
|
let k = false
|
|
209
355
|
let c = false
|
|
210
|
-
document.getElementById('btn').addEventListener('click', () => {
|
|
356
|
+
document.getElementById('btn').addEventListener('click', (e) => {
|
|
211
357
|
k = !k
|
|
212
358
|
videoCapturingComponent.showSpinner(k)
|
|
359
|
+
e.currentTarget.setAttribute('aria-pressed', String(k))
|
|
213
360
|
})
|
|
214
361
|
document.getElementById('btn-reconfig').addEventListener('click', () => {
|
|
215
362
|
videoCapturingComponent.reloadComponent(newConfig)
|
|
@@ -217,10 +364,31 @@
|
|
|
217
364
|
document.getElementById('btn-reconfig1').addEventListener('click', () => {
|
|
218
365
|
videoCapturingComponent.reloadComponent(newConfig1)
|
|
219
366
|
})
|
|
220
|
-
document.getElementById('btn-loader').addEventListener('click', () => {
|
|
367
|
+
document.getElementById('btn-loader').addEventListener('click', (e) => {
|
|
221
368
|
c = !c
|
|
222
|
-
videoCapturingComponent.showLoader(c, '
|
|
369
|
+
videoCapturingComponent.showLoader(c, 'The bottom text set by showLoader', 'Custom top text')
|
|
370
|
+
e.currentTarget.setAttribute('aria-pressed', String(c))
|
|
223
371
|
})
|
|
372
|
+
let isSceneLoaderShown = false
|
|
373
|
+
const sceneButtons = document.querySelectorAll('#loader-scenes-container [data-scene]')
|
|
374
|
+
const hideSceneLoader = () => {
|
|
375
|
+
if (isSceneLoaderShown) {
|
|
376
|
+
videoCapturingComponent.showLoader(false)
|
|
377
|
+
isSceneLoaderShown = false
|
|
378
|
+
}
|
|
379
|
+
sceneButtons.forEach((button) => button.setAttribute('aria-pressed', 'false'))
|
|
380
|
+
}
|
|
381
|
+
sceneButtons.forEach((button) => {
|
|
382
|
+
button.setAttribute('aria-pressed', 'false')
|
|
383
|
+
button.addEventListener('click', () => {
|
|
384
|
+
const { scene, top = '', bottom = '' } = button.dataset
|
|
385
|
+
hideSceneLoader()
|
|
386
|
+
videoCapturingComponent.showLoader(true, bottom, top, { scene })
|
|
387
|
+
isSceneLoaderShown = true
|
|
388
|
+
button.setAttribute('aria-pressed', 'true')
|
|
389
|
+
})
|
|
390
|
+
})
|
|
391
|
+
document.getElementById('btn-loader-scene-hide').addEventListener('click', hideSceneLoader)
|
|
224
392
|
document.getElementById('btn-reload').addEventListener('click', () => {
|
|
225
393
|
videoCapturingComponent.reloadComponent(config);
|
|
226
394
|
})
|
|
@@ -244,12 +412,13 @@
|
|
|
244
412
|
},
|
|
245
413
|
]);
|
|
246
414
|
})
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
415
|
+
const setLanguage = (language) => {
|
|
416
|
+
videoCapturingComponent.changeLanguage(language);
|
|
417
|
+
document.getElementById('btn-change-en').setAttribute('aria-pressed', String(language === 'en'))
|
|
418
|
+
document.getElementById('btn-change-es').setAttribute('aria-pressed', String(language === 'es'))
|
|
419
|
+
}
|
|
420
|
+
document.getElementById('btn-change-en').addEventListener('click', () => setLanguage('en'))
|
|
421
|
+
document.getElementById('btn-change-es').addEventListener('click', () => setLanguage('es'))
|
|
253
422
|
document.getElementById('btn-unmount').addEventListener('click', () => {
|
|
254
423
|
const el = document.getElementById(config.el);
|
|
255
424
|
el.remove();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(self.webpackChunk_idscan_idvc2=self.webpackChunk_idscan_idvc2||[]).push([[300],{3698(e,t,r){r.r(t),r.d(t,{default:()=>oe});var n=r(2639),i=r(5909),o=r(4955),s=r(6367),c=r(6248);function a(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function u(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function l(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}),e}var h=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),u(this,"realFace",void 0),u(this,"moveToCenter",void 0),u(this,"noFace",void 0),u(this,"perimeter",void 0),u(this,"distance",void 0),u(this,"baseSizes",void 0),u(this,"lowFacePerimeterPercent",void 0),u(this,"lowFacePerimeterPercentDefault",void 0),u(this,"correctDirection",void 0),u(this,"direction",void 0),u(this,"turnDistances",void 0),u(this,"prediction",void 0),u(this,"faceFailCount",void 0),u(this,"faceSuccessCount",void 0),u(this,"res",void 0),u(this,"geometry",void 0),this.faceFailCount=0,this.faceSuccessCount=0,this.realFace=!1,this.moveToCenter=!1,this.noFace=!1,this.perimeter=0,this.distance=0,this.baseSizes={width:320,height:320},this.res={status:!1,cancel:!1,touch:!1,image:null,type:"VolumeFace"},this.lowFacePerimeterPercent=27,this.lowFacePerimeterPercentDefault=27,this.correctDirection=!1,this.direction=null,this.turnDistances={leftRightPercents:0,isLeft:!1}}var t,r,n;return t=e,r=[{key:"init",value:function(e){this.geometry=e}},{key:"result",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=l(function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){u(e,t,r[t])})}return e}({drawPoints:this.prediction?this.prediction.keypointList:[]},this.res),{status:e,faceFailCount:this.faceFailCount,faceSuccessCount:this.faceSuccessCount,perimeter:this.perimeter,realFace:this.realFace,moveToCenter:this.moveToCenter,distance:this.distance,noFace:this.noFace,prediction:this.prediction,isCorrectDirection:this.correctDirection});return e&&(this.faceSuccessCount=0,this.faceFailCount=0,this.realFace=!1),t}},{key:"noPredictions",value:function(){return this.perimeter=0,this.distance=0,this.prediction=null,this.moveToCenter=!1,this.faceFailCount+=1,this.realFace=!1,this.faceSuccessCount=0,this.noFace=!0,this.res.status=!1,this.result(!1)}},{key:"processFace",value:function(e,t){return this.perimeter=0,this.moveToCenter=!1,this.noFace=!1,this.distance=0,this.baseSizes.width=t instanceof HTMLVideoElement?t.videoWidth:t.width,this.baseSizes.height=t instanceof HTMLVideoElement?t.videoHeight:t.height,this.prediction=e,this.processPrediction(),this.faceSuccessCount>3&&e.score>15?this.result(!0):this.result(!1)}},{key:"dropSuccess",value:function(){this.lowFacePerimeterPercent=this.lowFacePerimeterPercentDefault,this.faceSuccessCount=0,this.realFace=!1}},{key:"getDirection",value:function(){return this.direction}},{key:"isCorrectKeyPointsDistances",value:function(e){return e.eyeDistance>35&&e.earDistance>75}},{key:"setDirection",value:function(e){this.direction=e}},{key:"getMf",value:function(e){return[Math.abs((this.baseSizes.width/2-e[0])*(100/this.baseSizes.width)),Math.abs((this.baseSizes.height/2-e[1])*(100/this.baseSizes.height))]}},{key:"processBadPerimeter",value:function(e){e<=this.lowFacePerimeterPercent?this.perimeter=1:e>=100&&(this.perimeter=2)}},{key:"main",value:function(e,t,r){var n;e>this.lowFacePerimeterPercent&&e<100?t[0]<=15&&t[1]<=15&&this.isCorrectKeyPointsDistances(r)?((null===(n=o.A.currentStepObj)||void 0===n?void 0:n.shouldRecordMultiImages)&&!c.UI.mainScreen.videoWrapper.canvasWrapper.isStartedRecord&&c.UI.mainScreen.videoWrapper.canvasWrapper.toggleRecordMultiImages(o.A.currentStepObj,o.A.isStarted),this.lowFacePerimeterPercent=this.lowFacePerimeterPercentDefault-7,this.calculateDistance(),this.processDistance(),this.processRealFace()):(this.dropSuccess(),this.moveToCenter=!0):(this.dropSuccess(),this.processBadPerimeter(e))}},{key:"processRealFace",value:function(){this.realFace&&(this.distance>75?this.faceSuccessCount+=1:this.faceSuccessCount=0)}},{key:"calculateFace",value:function(){var e=this.prediction.bbox,t=e.x,r=e.y,n=e.w,i=e.h,o=[t,r],s=[t+n,r+i],c=(n+i)/(this.baseSizes.width+this.baseSizes.height)*100,a=this.geometry.rectCenter(o,s);return{perimeter:c,mf:this.getMf(a)}}},{key:"calculateKeyPointsDistances",value:function(){return{eyeDistance:~~this.geometry.distanceBetweenPointsX(this.prediction.face.leftEye,this.prediction.face.rightEye),earDistance:~~this.geometry.distanceBetweenPointsX(this.prediction.face.leftEar,this.prediction.face.rightEar)}}},{key:"processPrediction",value:function(){var e=this.calculateFace(),t=e.perimeter,r=e.mf,n=this.calculateKeyPointsDistances();this.main(t,r,n)}},{key:"processDistance",value:function(){this.correctDirection=this.direction===s.m.LEFT?this.turnDistances.isLeft:!this.turnDistances.isLeft,this.distance=this.turnDistances.leftRightPercents,this.correctDirection&&this.distance<=50&&(this.realFace=!0)}},{key:"calculateTurn",value:function(e,t){var r=Math.min(e,t),n=Math.max(e,t);return Math.trunc(r/n*100)}},{key:"calculateDistance",value:function(){var e=~~this.geometry.distanceBetweenPointsX(this.prediction.face.rightEye,this.prediction.face.nose),t=~~this.geometry.distanceBetweenPointsX(this.prediction.face.leftEye,this.prediction.face.nose),r=this.calculateTurn(e,t),n=t>=e;this.turnDistances={leftRightPercents:r,isLeft:n}}},{key:"allocate",value:function(){}}],r&&a(t.prototype,r),n&&a(t,n),e}();const f=h;var p=r(7734),y=r(2842),d=r(4703),v=r(2933),b=r(3814);function w(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function g(e,t,r,n,i,o,s){try{var c=e[o](s),a=c.value}catch(e){return void r(e)}c.done?t(a):Promise.resolve(a).then(n,i)}function m(e){return function(){var t=this,r=arguments;return new Promise(function(n,i){var o=e.apply(t,r);function s(e){g(o,n,i,s,c,"next",e)}function c(e){g(o,n,i,s,c,"throw",e)}s(void 0)})}}function P(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function k(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function x(e){return x=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},x(e)}function S(e,t){return!t||"object"!=((r=t)&&"undefined"!=typeof Symbol&&r.constructor===Symbol?"symbol":typeof r)&&"function"!=typeof t?w(e):t;var r}function L(e,t){return L=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},L(e,t)}function O(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}();return function(){var r,n=x(e);if(t){var i=x(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return S(this,r)}}function F(e,t){var r,n,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function c(o){return function(c){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,n=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,c])}}}var D=[[16,16],[8,8]],M=[2,6],C=128,E=128,j=[1,E,C,3],A="Identity:0",z="Identity_2:0",B=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&L(e,t)}(o,e);var t,r,n,i=O(o);function o(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:y.K.WASM,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,o),k(w(e=i.call(this,t,r,n)),"anchorList",new Array(896)),k(w(e),"scoreList",new Float32Array(896)),k(w(e),"regressorList",new Float32Array(14336)),k(w(e),"thresholdLogit",1.0986122886681096),k(w(e),"bBoxList",[]),k(w(e),"keyPoints",Array(6)),k(w(e),"origSize",{height:0,width:0}),e.createAnchor(),e}return t=o,(r=[{key:"createAnchor",value:function(){for(var e=0,t=0;t<D.length;t+=1)for(var r=D[t][0],n=D[t][1],i=128/r,o=128/n,s=M[t],c=0,a=0,u=0;u<n;u+=1){c=o*(u+.5);for(var l=0;l<r;l+=1){a=i*(l+.5);for(var h=0;h<s;h+=1)this.anchorList[e]=[a,c],e+=1}}}},{key:"processImage",value:function(e){var t=this;return m(function(){var r;return F(this,function(n){return t.getBoundingBoxes({scaleX:e.width/C,scaleY:e.height/E}),(r=t.nms())?(t.fillKeyPoints({bbox:r,crop:e}),[2,{bbox:r,keyPoints:t.keyPoints,face:{leftEye:t.keyPoints[0],rightEye:t.keyPoints[1],nose:t.keyPoints[2],mouth:t.keyPoints[3],leftEar:t.keyPoints[4],rightEar:t.keyPoints[5]}}]):[2,!1]})})()}},{key:"predict",value:function(e){var t=this;return m(function(){var r,n;return F(this,function(i){switch(i.label){case 0:return r=new p.qY("float32",e,j),[4,t.session.run(k({},"input:0",r))];case 1:return n=i.sent(),t.scoreList.set(n[A].data,0),t.scoreList.set(n["Identity_1:0"].data,n[A].size),t.regressorList.set(n[z].data,0),t.regressorList.set(n["Identity_3:0"].data,n[z].size),[2]}})})()}},{key:"predictFromImage",value:function(e,t){var r=this;return m(function(){var n,i,o,s,c,a;return F(this,function(u){switch(u.label){case 0:if(!r.session)throw new Error("ONNX session isn't started");return n=r.createSrc(e,"angles-input-canvas"),i=t||(0,v.Nw)("angles-canvas",{width:C,height:E}),r.origSize.width=n instanceof HTMLVideoElement?n.videoWidth:n.width,r.origSize.height=n instanceof HTMLVideoElement?n.videoHeight:n.height,o=(0,v.CA)(n,i),s=o.resized,c=o.crop,a=(0,b.Js)(s,b.Qg.HALF),[4,r.predict(a)];case 1:return u.sent(),[2,r.processImage(c)]}})})()}},{key:"getBoundingBoxes",value:function(e){var t=e.scaleX,r=e.scaleY,n=this;this.bBoxList.length=0,this.anchorList.forEach(function(e,i){if(n.scoreList[i]>n.thresholdLogit){var o=16*i,s=n.regressorList[o]+e[0],c=n.regressorList[o+1]+e[1],a=n.regressorList[o+2],u=n.regressorList[o+3],l={classId:i,label:"",score:+n.scoreList[i],x:~~((s-a/2)*t),y:~~((c-u/2)*r),w:~~(a*t),h:~~(u*r)};n.bBoxList.push(l)}})}},{key:"calculateIoU",value:function(e,t){var r=Math.max(e.x,t.x),n=Math.max(e.y,t.y),i=Math.min(e.x+e.w,t.x+t.w),o=Math.min(e.y+e.h,t.y+t.h);if(i<r||o<n)return 0;var s=(i-r)*(o-n);return s/(e.w*e.h+t.w*t.h-s)}},{key:"nms",value:function(){var e=[];this.bBoxList.sort(function(e,t){return t.score-e.score});for(var t=new Array(this.bBoxList.length).fill(!1),r=0;r<this.bBoxList.length;r+=1){var n=[];if(!t[r]){n.push(this.bBoxList[r]);for(var i=r+1;i<this.bBoxList.length;i+=1)t[i]||this.calculateIoU(this.bBoxList[r],this.bBoxList[i])>.5&&(n.push(this.bBoxList[i]),t[i]=!0);e.push(n[0])}}return e[0]}},{key:"fixInScreen",value:function(e){e.x=Math.max(0,e.x),e.y=Math.max(0,e.y),e.w=Math.min(this.origSize.width-e.x,e.w),e.h=Math.min(this.origSize.height-e.y,e.h)}},{key:"fillKeyPoints",value:function(e){var t=e.bbox,r=e.crop,n=t.classId;t.classId=0,t.label="FACE",t.x+=r.x,t.y+=r.y,this.fixInScreen(t);for(var i=16*n,o=0;o<6;o+=1){var s=this.regressorList[i+4+2*o]+this.anchorList[n][0],c=this.regressorList[i+4+2*o+1]+this.anchorList[n][1];this.keyPoints[o]=[~~(s*r.width/C+r.x),~~(c*r.height/E+r.y)]}}}])&&P(t.prototype,r),n&&P(t,n),o}(d.A);function _(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function T(e,t,r,n,i,o,s){try{var c=e[o](s),a=c.value}catch(e){return void r(e)}c.done?t(a):Promise.resolve(a).then(n,i)}function I(e){return function(){var t=this,r=arguments;return new Promise(function(n,i){var o=e.apply(t,r);function s(e){T(o,n,i,s,c,"next",e)}function c(e){T(o,n,i,s,c,"throw",e)}s(void 0)})}}function R(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function W(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function H(e){return H=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},H(e)}function K(e,t){return!t||"object"!=((r=t)&&"undefined"!=typeof Symbol&&r.constructor===Symbol?"symbol":typeof r)&&"function"!=typeof t?_(e):t;var r}function X(e,t){return X=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},X(e,t)}function N(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}();return function(){var r,n=H(e);if(t){var i=H(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return K(this,r)}}function V(e,t){var r,n,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function c(o){return function(c){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,n=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,c])}}}var U=[1,192,192,3],G=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&X(e,t)}(o,e);var t,r,n,i=N(o);function o(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:y.K.WASM,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,o),W(_(e=i.call(this,t,r,n)),"origSize",{width:0,height:0}),W(_(e),"crop",{x:0,y:0,width:0,height:0}),W(_(e),"landmarkList",new Float32Array(1404)),W(_(e),"keypointList",new Array(468)),e}return t=o,(r=[{key:"preProcess",value:function(e){var t=~~(e.x+e.w/2),r=~~(e.y+e.h/2),n=~~(1.7*Math.max(e.w,e.h));this.crop.x=~~Math.max(0,t-n/2),this.crop.y=~~Math.max(0,r-n/2),this.crop.width=~~Math.min(n,this.origSize.width-this.crop.x),this.crop.height=~~Math.min(n,this.origSize.height-this.crop.y)}},{key:"predict",value:function(e){var t=this;return I(function(){var r,n,i,o,s,c;return V(this,function(a){switch(a.label){case 0:return r=new p.qY("float32",e,U),n=W({},"input_1",r),[4,t.session.run(n)];case 1:for(i=a.sent(),t.landmarkList.set(i.conv2d_20.data,0),o=t.crop.width/192,s=t.crop.height/192,c=0;c<468;c+=1)t.keypointList[c]=[~~(t.landmarkList[3*c+0]*o+.5+t.crop.x),~~(t.landmarkList[3*c+1]*s+.5+t.crop.y)];return[2,{score:i.conv2d_30.data[0],keypointList:t.keypointList}]}})})()}},{key:"prepareMesh",value:function(e,t){var r=t.getContext("2d");return r.drawImage(e,this.crop.x,this.crop.y,this.crop.width,this.crop.height,0,0,t.width,t.height),r.getImageData(0,0,t.width,t.height)}},{key:"predictFromImage",value:function(e,t){var r=this;return I(function(){var n,i,o;return V(this,function(s){if(!r.session)throw new Error("ONNX session isn't started");return n=r.createSrc(e,"mesh-face-input-canvasWrapper"),i=t||(0,v.Nw)("mesh-face-canvasWrapper",{width:192,height:192}),r.origSize.width=n instanceof HTMLVideoElement?n.videoWidth:n.width,r.origSize.height=n instanceof HTMLVideoElement?n.videoHeight:n.height,o=(0,b.Js)(r.prepareMesh(n,i),b.Qg.HALF),[2,r.predict(o)]})})()}}])&&R(t.prototype,r),n&&R(t,n),o}(d.A),Y=r(8200);function J(e,t,r,n,i,o,s){try{var c=e[o](s),a=c.value}catch(e){return void r(e)}c.done?t(a):Promise.resolve(a).then(n,i)}function q(e){return function(){var t=this,r=arguments;return new Promise(function(n,i){var o=e.apply(t,r);function s(e){J(o,n,i,s,c,"next",e)}function c(e){J(o,n,i,s,c,"throw",e)}s(void 0)})}}function Q(e,t){var r,n,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function c(o){return function(c){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,n=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,c])}}}var Z,$=(Z=q(function(){var e;return Q(this,function(t){return e=new f,n.A.setModule("module","face",e),[2]})}),function(){return Z.apply(this,arguments)}),ee=function(){var e=q(function(){var e,t,r,s,c;return Q(this,function(a){switch(a.label){case 0:return e=Y.f.simdSupport?y.K.WASM:y.K.WEBGL,"ios"===o.A.browser.os.toLowerCase()&&(t=o.A.browser.version,r=+t.split(".").pop(),Number.isFinite(r)&&r<16&&(e=y.K.WASM)),s=new B("".concat(i.n.ey),e,o.A.networkUrl),c=new G("".concat(i.n.w0),e,o.A.networkUrl),n.A.setModule("model","blazeFace",s),n.A.setModule("model","meshFace",c),[4,$()];case 1:return a.sent(),[2,[s.initialize.bind(s),c.initialize.bind(c)]]}})});return function(){return e.apply(this,arguments)}}();const te=ee;function re(e,t,r,n,i,o,s){try{var c=e[o](s),a=c.value}catch(e){return void r(e)}c.done?t(a):Promise.resolve(a).then(n,i)}function ne(e,t){var r,n,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function c(o){return function(c){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,n=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,c])}}}var ie=function(){var e,t=(e=function(){return ne(this,function(e){switch(e.label){case 0:return[4,te()];case 1:return[2,e.sent()]}})},function(){var t=this,r=arguments;return new Promise(function(n,i){var o=e.apply(t,r);function s(e){re(o,n,i,s,c,"next",e)}function c(e){re(o,n,i,s,c,"throw",e)}s(void 0)})});return function(){return t.apply(this,arguments)}}();const oe=ie},5909(e){e.exports=JSON.parse('{"n":{"EX":"mrz03032023.onnx","w0":"faceLandmark03032023.onnx","ey":"faceDetection03032023.onnx","sh":"yoloFaceFingers.onnx"}}')}}]);
|
|
1
|
+
(self.webpackChunk_idscan_idvc2=self.webpackChunk_idscan_idvc2||[]).push([[300],{3698(e,t,r){r.r(t),r.d(t,{default:()=>oe});var n=r(2639),i=r(5909),o=r(4955),s=r(6367),c=r(7746);function a(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function u(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function l(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}),e}var h=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),u(this,"realFace",void 0),u(this,"moveToCenter",void 0),u(this,"noFace",void 0),u(this,"perimeter",void 0),u(this,"distance",void 0),u(this,"baseSizes",void 0),u(this,"lowFacePerimeterPercent",void 0),u(this,"lowFacePerimeterPercentDefault",void 0),u(this,"correctDirection",void 0),u(this,"direction",void 0),u(this,"turnDistances",void 0),u(this,"prediction",void 0),u(this,"faceFailCount",void 0),u(this,"faceSuccessCount",void 0),u(this,"res",void 0),u(this,"geometry",void 0),this.faceFailCount=0,this.faceSuccessCount=0,this.realFace=!1,this.moveToCenter=!1,this.noFace=!1,this.perimeter=0,this.distance=0,this.baseSizes={width:320,height:320},this.res={status:!1,cancel:!1,touch:!1,image:null,type:"VolumeFace"},this.lowFacePerimeterPercent=27,this.lowFacePerimeterPercentDefault=27,this.correctDirection=!1,this.direction=null,this.turnDistances={leftRightPercents:0,isLeft:!1}}var t,r,n;return t=e,r=[{key:"init",value:function(e){this.geometry=e}},{key:"result",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=l(function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){u(e,t,r[t])})}return e}({drawPoints:this.prediction?this.prediction.keypointList:[]},this.res),{status:e,faceFailCount:this.faceFailCount,faceSuccessCount:this.faceSuccessCount,perimeter:this.perimeter,realFace:this.realFace,moveToCenter:this.moveToCenter,distance:this.distance,noFace:this.noFace,prediction:this.prediction,isCorrectDirection:this.correctDirection});return e&&(this.faceSuccessCount=0,this.faceFailCount=0,this.realFace=!1),t}},{key:"noPredictions",value:function(){return this.perimeter=0,this.distance=0,this.prediction=null,this.moveToCenter=!1,this.faceFailCount+=1,this.realFace=!1,this.faceSuccessCount=0,this.noFace=!0,this.res.status=!1,this.result(!1)}},{key:"processFace",value:function(e,t){return this.perimeter=0,this.moveToCenter=!1,this.noFace=!1,this.distance=0,this.baseSizes.width=t instanceof HTMLVideoElement?t.videoWidth:t.width,this.baseSizes.height=t instanceof HTMLVideoElement?t.videoHeight:t.height,this.prediction=e,this.processPrediction(),this.faceSuccessCount>3&&e.score>15?this.result(!0):this.result(!1)}},{key:"dropSuccess",value:function(){this.lowFacePerimeterPercent=this.lowFacePerimeterPercentDefault,this.faceSuccessCount=0,this.realFace=!1}},{key:"getDirection",value:function(){return this.direction}},{key:"isCorrectKeyPointsDistances",value:function(e){return e.eyeDistance>35&&e.earDistance>75}},{key:"setDirection",value:function(e){this.direction=e}},{key:"getMf",value:function(e){return[Math.abs((this.baseSizes.width/2-e[0])*(100/this.baseSizes.width)),Math.abs((this.baseSizes.height/2-e[1])*(100/this.baseSizes.height))]}},{key:"processBadPerimeter",value:function(e){e<=this.lowFacePerimeterPercent?this.perimeter=1:e>=100&&(this.perimeter=2)}},{key:"main",value:function(e,t,r){var n;e>this.lowFacePerimeterPercent&&e<100?t[0]<=15&&t[1]<=15&&this.isCorrectKeyPointsDistances(r)?((null===(n=o.A.currentStepObj)||void 0===n?void 0:n.shouldRecordMultiImages)&&!c.UI.mainScreen.videoWrapper.canvasWrapper.isStartedRecord&&c.UI.mainScreen.videoWrapper.canvasWrapper.toggleRecordMultiImages(o.A.currentStepObj,o.A.isStarted),this.lowFacePerimeterPercent=this.lowFacePerimeterPercentDefault-7,this.calculateDistance(),this.processDistance(),this.processRealFace()):(this.dropSuccess(),this.moveToCenter=!0):(this.dropSuccess(),this.processBadPerimeter(e))}},{key:"processRealFace",value:function(){this.realFace&&(this.distance>75?this.faceSuccessCount+=1:this.faceSuccessCount=0)}},{key:"calculateFace",value:function(){var e=this.prediction.bbox,t=e.x,r=e.y,n=e.w,i=e.h,o=[t,r],s=[t+n,r+i],c=(n+i)/(this.baseSizes.width+this.baseSizes.height)*100,a=this.geometry.rectCenter(o,s);return{perimeter:c,mf:this.getMf(a)}}},{key:"calculateKeyPointsDistances",value:function(){return{eyeDistance:~~this.geometry.distanceBetweenPointsX(this.prediction.face.leftEye,this.prediction.face.rightEye),earDistance:~~this.geometry.distanceBetweenPointsX(this.prediction.face.leftEar,this.prediction.face.rightEar)}}},{key:"processPrediction",value:function(){var e=this.calculateFace(),t=e.perimeter,r=e.mf,n=this.calculateKeyPointsDistances();this.main(t,r,n)}},{key:"processDistance",value:function(){this.correctDirection=this.direction===s.m.LEFT?this.turnDistances.isLeft:!this.turnDistances.isLeft,this.distance=this.turnDistances.leftRightPercents,this.correctDirection&&this.distance<=50&&(this.realFace=!0)}},{key:"calculateTurn",value:function(e,t){var r=Math.min(e,t),n=Math.max(e,t);return Math.trunc(r/n*100)}},{key:"calculateDistance",value:function(){var e=~~this.geometry.distanceBetweenPointsX(this.prediction.face.rightEye,this.prediction.face.nose),t=~~this.geometry.distanceBetweenPointsX(this.prediction.face.leftEye,this.prediction.face.nose),r=this.calculateTurn(e,t),n=t>=e;this.turnDistances={leftRightPercents:r,isLeft:n}}},{key:"allocate",value:function(){}}],r&&a(t.prototype,r),n&&a(t,n),e}();const f=h;var p=r(7734),y=r(2842),d=r(4703),v=r(2933),b=r(3814);function w(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function g(e,t,r,n,i,o,s){try{var c=e[o](s),a=c.value}catch(e){return void r(e)}c.done?t(a):Promise.resolve(a).then(n,i)}function m(e){return function(){var t=this,r=arguments;return new Promise(function(n,i){var o=e.apply(t,r);function s(e){g(o,n,i,s,c,"next",e)}function c(e){g(o,n,i,s,c,"throw",e)}s(void 0)})}}function P(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function k(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function x(e){return x=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},x(e)}function S(e,t){return!t||"object"!=((r=t)&&"undefined"!=typeof Symbol&&r.constructor===Symbol?"symbol":typeof r)&&"function"!=typeof t?w(e):t;var r}function L(e,t){return L=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},L(e,t)}function O(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}();return function(){var r,n=x(e);if(t){var i=x(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return S(this,r)}}function F(e,t){var r,n,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function c(o){return function(c){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,n=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,c])}}}var D=[[16,16],[8,8]],M=[2,6],C=128,E=128,j=[1,E,C,3],A="Identity:0",z="Identity_2:0",B=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&L(e,t)}(o,e);var t,r,n,i=O(o);function o(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:y.K.WASM,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,o),k(w(e=i.call(this,t,r,n)),"anchorList",new Array(896)),k(w(e),"scoreList",new Float32Array(896)),k(w(e),"regressorList",new Float32Array(14336)),k(w(e),"thresholdLogit",1.0986122886681096),k(w(e),"bBoxList",[]),k(w(e),"keyPoints",Array(6)),k(w(e),"origSize",{height:0,width:0}),e.createAnchor(),e}return t=o,(r=[{key:"createAnchor",value:function(){for(var e=0,t=0;t<D.length;t+=1)for(var r=D[t][0],n=D[t][1],i=128/r,o=128/n,s=M[t],c=0,a=0,u=0;u<n;u+=1){c=o*(u+.5);for(var l=0;l<r;l+=1){a=i*(l+.5);for(var h=0;h<s;h+=1)this.anchorList[e]=[a,c],e+=1}}}},{key:"processImage",value:function(e){var t=this;return m(function(){var r;return F(this,function(n){return t.getBoundingBoxes({scaleX:e.width/C,scaleY:e.height/E}),(r=t.nms())?(t.fillKeyPoints({bbox:r,crop:e}),[2,{bbox:r,keyPoints:t.keyPoints,face:{leftEye:t.keyPoints[0],rightEye:t.keyPoints[1],nose:t.keyPoints[2],mouth:t.keyPoints[3],leftEar:t.keyPoints[4],rightEar:t.keyPoints[5]}}]):[2,!1]})})()}},{key:"predict",value:function(e){var t=this;return m(function(){var r,n;return F(this,function(i){switch(i.label){case 0:return r=new p.qY("float32",e,j),[4,t.session.run(k({},"input:0",r))];case 1:return n=i.sent(),t.scoreList.set(n[A].data,0),t.scoreList.set(n["Identity_1:0"].data,n[A].size),t.regressorList.set(n[z].data,0),t.regressorList.set(n["Identity_3:0"].data,n[z].size),[2]}})})()}},{key:"predictFromImage",value:function(e,t){var r=this;return m(function(){var n,i,o,s,c,a;return F(this,function(u){switch(u.label){case 0:if(!r.session)throw new Error("ONNX session isn't started");return n=r.createSrc(e,"angles-input-canvas"),i=t||(0,v.Nw)("angles-canvas",{width:C,height:E}),r.origSize.width=n instanceof HTMLVideoElement?n.videoWidth:n.width,r.origSize.height=n instanceof HTMLVideoElement?n.videoHeight:n.height,o=(0,v.CA)(n,i),s=o.resized,c=o.crop,a=(0,b.Js)(s,b.Qg.HALF),[4,r.predict(a)];case 1:return u.sent(),[2,r.processImage(c)]}})})()}},{key:"getBoundingBoxes",value:function(e){var t=e.scaleX,r=e.scaleY,n=this;this.bBoxList.length=0,this.anchorList.forEach(function(e,i){if(n.scoreList[i]>n.thresholdLogit){var o=16*i,s=n.regressorList[o]+e[0],c=n.regressorList[o+1]+e[1],a=n.regressorList[o+2],u=n.regressorList[o+3],l={classId:i,label:"",score:+n.scoreList[i],x:~~((s-a/2)*t),y:~~((c-u/2)*r),w:~~(a*t),h:~~(u*r)};n.bBoxList.push(l)}})}},{key:"calculateIoU",value:function(e,t){var r=Math.max(e.x,t.x),n=Math.max(e.y,t.y),i=Math.min(e.x+e.w,t.x+t.w),o=Math.min(e.y+e.h,t.y+t.h);if(i<r||o<n)return 0;var s=(i-r)*(o-n);return s/(e.w*e.h+t.w*t.h-s)}},{key:"nms",value:function(){var e=[];this.bBoxList.sort(function(e,t){return t.score-e.score});for(var t=new Array(this.bBoxList.length).fill(!1),r=0;r<this.bBoxList.length;r+=1){var n=[];if(!t[r]){n.push(this.bBoxList[r]);for(var i=r+1;i<this.bBoxList.length;i+=1)t[i]||this.calculateIoU(this.bBoxList[r],this.bBoxList[i])>.5&&(n.push(this.bBoxList[i]),t[i]=!0);e.push(n[0])}}return e[0]}},{key:"fixInScreen",value:function(e){e.x=Math.max(0,e.x),e.y=Math.max(0,e.y),e.w=Math.min(this.origSize.width-e.x,e.w),e.h=Math.min(this.origSize.height-e.y,e.h)}},{key:"fillKeyPoints",value:function(e){var t=e.bbox,r=e.crop,n=t.classId;t.classId=0,t.label="FACE",t.x+=r.x,t.y+=r.y,this.fixInScreen(t);for(var i=16*n,o=0;o<6;o+=1){var s=this.regressorList[i+4+2*o]+this.anchorList[n][0],c=this.regressorList[i+4+2*o+1]+this.anchorList[n][1];this.keyPoints[o]=[~~(s*r.width/C+r.x),~~(c*r.height/E+r.y)]}}}])&&P(t.prototype,r),n&&P(t,n),o}(d.A);function _(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function T(e,t,r,n,i,o,s){try{var c=e[o](s),a=c.value}catch(e){return void r(e)}c.done?t(a):Promise.resolve(a).then(n,i)}function I(e){return function(){var t=this,r=arguments;return new Promise(function(n,i){var o=e.apply(t,r);function s(e){T(o,n,i,s,c,"next",e)}function c(e){T(o,n,i,s,c,"throw",e)}s(void 0)})}}function R(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function W(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function H(e){return H=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},H(e)}function K(e,t){return!t||"object"!=((r=t)&&"undefined"!=typeof Symbol&&r.constructor===Symbol?"symbol":typeof r)&&"function"!=typeof t?_(e):t;var r}function X(e,t){return X=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},X(e,t)}function N(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}();return function(){var r,n=H(e);if(t){var i=H(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return K(this,r)}}function V(e,t){var r,n,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function c(o){return function(c){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,n=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,c])}}}var U=[1,192,192,3],G=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&X(e,t)}(o,e);var t,r,n,i=N(o);function o(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:y.K.WASM,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,o),W(_(e=i.call(this,t,r,n)),"origSize",{width:0,height:0}),W(_(e),"crop",{x:0,y:0,width:0,height:0}),W(_(e),"landmarkList",new Float32Array(1404)),W(_(e),"keypointList",new Array(468)),e}return t=o,(r=[{key:"preProcess",value:function(e){var t=~~(e.x+e.w/2),r=~~(e.y+e.h/2),n=~~(1.7*Math.max(e.w,e.h));this.crop.x=~~Math.max(0,t-n/2),this.crop.y=~~Math.max(0,r-n/2),this.crop.width=~~Math.min(n,this.origSize.width-this.crop.x),this.crop.height=~~Math.min(n,this.origSize.height-this.crop.y)}},{key:"predict",value:function(e){var t=this;return I(function(){var r,n,i,o,s,c;return V(this,function(a){switch(a.label){case 0:return r=new p.qY("float32",e,U),n=W({},"input_1",r),[4,t.session.run(n)];case 1:for(i=a.sent(),t.landmarkList.set(i.conv2d_20.data,0),o=t.crop.width/192,s=t.crop.height/192,c=0;c<468;c+=1)t.keypointList[c]=[~~(t.landmarkList[3*c+0]*o+.5+t.crop.x),~~(t.landmarkList[3*c+1]*s+.5+t.crop.y)];return[2,{score:i.conv2d_30.data[0],keypointList:t.keypointList}]}})})()}},{key:"prepareMesh",value:function(e,t){var r=t.getContext("2d");return r.drawImage(e,this.crop.x,this.crop.y,this.crop.width,this.crop.height,0,0,t.width,t.height),r.getImageData(0,0,t.width,t.height)}},{key:"predictFromImage",value:function(e,t){var r=this;return I(function(){var n,i,o;return V(this,function(s){if(!r.session)throw new Error("ONNX session isn't started");return n=r.createSrc(e,"mesh-face-input-canvasWrapper"),i=t||(0,v.Nw)("mesh-face-canvasWrapper",{width:192,height:192}),r.origSize.width=n instanceof HTMLVideoElement?n.videoWidth:n.width,r.origSize.height=n instanceof HTMLVideoElement?n.videoHeight:n.height,o=(0,b.Js)(r.prepareMesh(n,i),b.Qg.HALF),[2,r.predict(o)]})})()}}])&&R(t.prototype,r),n&&R(t,n),o}(d.A),Y=r(8200);function J(e,t,r,n,i,o,s){try{var c=e[o](s),a=c.value}catch(e){return void r(e)}c.done?t(a):Promise.resolve(a).then(n,i)}function q(e){return function(){var t=this,r=arguments;return new Promise(function(n,i){var o=e.apply(t,r);function s(e){J(o,n,i,s,c,"next",e)}function c(e){J(o,n,i,s,c,"throw",e)}s(void 0)})}}function Q(e,t){var r,n,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function c(o){return function(c){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,n=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,c])}}}var Z,$=(Z=q(function(){var e;return Q(this,function(t){return e=new f,n.A.setModule("module","face",e),[2]})}),function(){return Z.apply(this,arguments)}),ee=function(){var e=q(function(){var e,t,r,s,c;return Q(this,function(a){switch(a.label){case 0:return e=Y.f.simdSupport?y.K.WASM:y.K.WEBGL,"ios"===o.A.browser.os.toLowerCase()&&(t=o.A.browser.version,r=+t.split(".").pop(),Number.isFinite(r)&&r<16&&(e=y.K.WASM)),s=new B("".concat(i.n.ey),e,o.A.networkUrl),c=new G("".concat(i.n.w0),e,o.A.networkUrl),n.A.setModule("model","blazeFace",s),n.A.setModule("model","meshFace",c),[4,$()];case 1:return a.sent(),[2,[s.initialize.bind(s),c.initialize.bind(c)]]}})});return function(){return e.apply(this,arguments)}}();const te=ee;function re(e,t,r,n,i,o,s){try{var c=e[o](s),a=c.value}catch(e){return void r(e)}c.done?t(a):Promise.resolve(a).then(n,i)}function ne(e,t){var r,n,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function c(o){return function(c){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,n=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,c])}}}var ie=function(){var e,t=(e=function(){return ne(this,function(e){switch(e.label){case 0:return[4,te()];case 1:return[2,e.sent()]}})},function(){var t=this,r=arguments;return new Promise(function(n,i){var o=e.apply(t,r);function s(e){re(o,n,i,s,c,"next",e)}function c(e){re(o,n,i,s,c,"throw",e)}s(void 0)})});return function(){return t.apply(this,arguments)}}();const oe=ie},5909(e){e.exports=JSON.parse('{"n":{"EX":"mrz03032023.onnx","w0":"faceLandmark03032023.onnx","ey":"faceDetection03032023.onnx","sh":"yoloFaceFingers.onnx"}}')}}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(self.webpackChunk_idscan_idvc2=self.webpackChunk_idscan_idvc2||[]).push([[292],{7798(e,t,r){r.d(t,{x:()=>l});var n=r(3075),o=r(1509);function i(e,t,r,n,o,i,u){try{var a=e[i](u),c=a.value}catch(e){return void r(e)}a.done?t(c):Promise.resolve(c).then(n,o)}function u(e){return function(){var t=this,r=arguments;return new Promise(function(n,o){var u=e.apply(t,r);function a(e){i(u,n,o,a,c,"next",e)}function c(e){i(u,n,o,a,c,"throw",e)}a(void 0)})}}function a(e,t){var r,n,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;u;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return u.label++,{value:i[1],done:!1};case 5:u.label++,n=i[1],i=[0];continue;case 7:i=u.ops.pop(),u.trys.pop();continue;default:if(!(o=u.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){u=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){u.label=i[1];break}if(6===i[0]&&u.label<o[1]){u.label=o[1],o=i;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(i);break}o[2]&&u.ops.pop(),u.trys.pop();continue}i=t.call(e,u)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}}var c,s=(c=u(function(e){var t,r,i,u,c;return a(this,function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),r=Uint8Array.bind,[4,(0,o.ZN)(e)];case 1:return t=new(r.apply(Uint8Array,[void 0,a.sent()])),i=(0,n.Aq)(t),u=new Blob([i.buffer],{type:"application/javascript"}),[2,URL.createObjectURL(u)];case 2:throw c=a.sent(),console.error("Error loading and decompressing worker file:",c),c;case 3:return[2]}})}),function(e){return c.apply(this,arguments)}),l=function(){var e=u(function(e){var t;return a(this,function(r){switch(r.label){case 0:return[4,s(e)];case 1:return t=r.sent(),[2,new Worker(t)]}})});return function(t){return e.apply(this,arguments)}}()},290(e,t,r){r.r(t),r.d(t,{default:()=>Z});var n=r(4955),o=r(2639),i=r(7734),u=r(4703),a=r(2842),c=r(3814),s=["0","1","2","3","4","*","5","6","7","*","8","9","A","*","B","C","*","D","*","E","*","F","*","G","*","H","I","J","*","K","*","L","*","M","N","O","P","*","Q","R","*","S","T","*","U","*","V","*","W","X","Y","*","Z","<","*"];function l(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function f(e,t,r,n,o,i,u){try{var a=e[i](u),c=a.value}catch(e){return void r(e)}a.done?t(c):Promise.resolve(c).then(n,o)}function p(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function y(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function h(e){return h=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},h(e)}function b(e,t){return!t||"object"!=((r=t)&&"undefined"!=typeof Symbol&&r.constructor===Symbol?"symbol":typeof r)&&"function"!=typeof t?l(e):t;var r}function d(e,t){return d=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},d(e,t)}function v(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}();return function(){var r,n=h(e);if(t){var o=h(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return b(this,r)}}function w(e,t){var r,n,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;u;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return u.label++,{value:i[1],done:!1};case 5:u.label++,n=i[1],i=[0];continue;case 7:i=u.ops.pop(),u.trys.pop();continue;default:if(!(o=u.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){u=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){u.label=i[1];break}if(6===i[0]&&u.label<o[1]){u.label=o[1],o=i;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(i);break}o[2]&&u.ops.pop(),u.trys.pop();continue}i=t.call(e,u)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}}var m=[1,28,28,1],g=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&d(e,t)}(u,e);var t,r,n,o=v(u);function u(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:a.K.WASM,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,u),y(l(e=o.call(this,t,r,n)),"predictionList",void 0),y(l(e),"interpretedPredictionsList",void 0),e}return t=u,r=[{key:"predict",value:function(e){var t=y({},"input_1",new i.qY("float32",e,m));return this.session.run(t)}},{key:"predictFromArray",value:function(e,t){var r,n=this;return(r=function(){var r,o,i;return w(this,function(u){switch(u.label){case 0:if(n.predictionList||(n.predictionList=new Array(t).fill(0)),n.interpretedPredictionsList||(n.interpretedPredictionsList=new Array(t).fill(0)),n.loading)return[2,[]];r=(0,c.S8)(e,c.Qg.STANDART),o=0,u.label=1;case 1:return o<t?(i=n.predictionList,[4,n.predict(r.subarray(784*o,784*(o+1)))]):[3,4];case 2:i[o]=u.sent(),u.label=3;case 3:return o+=1,[3,1];case 4:return n.predictionList.forEach(function(e,t){n.interpretedPredictionsList[t]=n.interpret(e.dense.data)}),[2,n.interpretedPredictionsList]}})},function(){var e=this,t=arguments;return new Promise(function(n,o){var i=r.apply(e,t);function u(e){f(i,n,o,u,a,"next",e)}function a(e){f(i,n,o,u,a,"throw",e)}u(void 0)})})()}},{key:"interpret",value:function(e){return Array.from(e).map(function(e,t){return{value:s[t],confidence:e}}).sort(function(e,t){return e.confidence-t.confidence}).slice(-3).reverse()}},{key:"isLoading",get:function(){return this.loading}},{key:"predictFromImage",value:function(e,t){}}],r&&p(t.prototype,r),n&&p(t,n),u}(u.A),k=r(3818),O=r(5909);function P(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function x(e,t,r,n,o,i,u){try{var a=e[i](u),c=a.value}catch(e){return void r(e)}a.done?t(c):Promise.resolve(c).then(n,o)}function j(e){return function(){var t=this,r=arguments;return new Promise(function(n,o){var i=e.apply(t,r);function u(e){x(i,n,o,u,a,"next",e)}function a(e){x(i,n,o,u,a,"throw",e)}u(void 0)})}}function S(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function A(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function R(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){A(e,t,r[t])})}return e}function E(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}),e}function M(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,i=[],u=!0,a=!1;try{for(r=r.call(e);!(u=(n=r.next()).done)&&(i.push(n.value),!t||i.length!==t);u=!0);}catch(e){a=!0,o=e}finally{try{u||null==r.return||r.return()}finally{if(a)throw o}}return i}}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return P(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(r);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return P(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function L(e,t){var r,n,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;u;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return u.label++,{value:i[1],done:!1};case 5:u.label++,n=i[1],i=[0];continue;case 7:i=u.ops.pop(),u.trys.pop();continue;default:if(!(o=u.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){u=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){u.label=i[1];break}if(6===i[0]&&u.label<o[1]){u.label=o[1],o=i;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(i);break}o[2]&&u.ops.pop(),u.trys.pop();continue}i=t.call(e,u)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}}var T=function(){function e(t,r,n){var o=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),A(this,"w",0),A(this,"h",0),A(this,"successCount",0),A(this,"worker",void 0),A(this,"model",void 0),A(this,"isInitialized",!1),A(this,"isProcessing",!1),A(this,"MIN_MRZ_FRAMES",3),this.model=new g("".concat(O.n.EX),a.K.WASM,n),this.worker=t,this.worker.postMessage({fn:"init",initData:{key:r,networkUrl:n}}),this.worker.onmessage=function(e){var t=e.data,r=t.name,n=t.data;"initialization"===r&&(o.isInitialized=n)}}var t,r,n;return t=e,r=[{key:"getErrorVal",value:function(e){var t;return-3===e&&(t=0),-2===e&&(t=1),t}},{key:"licenseError",value:function(e){return{error:!0,errorType:"licenceKeyError",errorVal:this.getErrorVal(e)}}},{key:"yComparator",value:function(e,t){return e.y<t.y?[e,t]:[t,e]}},{key:"allocate",value:function(){}},{key:"prepareMRZLocation",value:function(e){var t=[e.leftTop,e.rightTop,e.rightBottom,e.leftBottom].sort(function(e,t){return e.x-t.x}),r=M(this.yComparator(t[0],t[1]),2),n=r[0],o=r[1],i=M(this.yComparator(t[2],t[3]),2),u=i[0],a=i[1],c=.03;return{leftTop:{x:n.x-c,y:n.y-c},rightTop:{x:u.x+c,y:u.y-c},rightBottom:{x:a.x+c,y:a.y+c},leftBottom:{x:o.x-c,y:o.y+c}}}},{key:"writeResults",value:function(e){var t={mrzText:""},r=e.fields.filter(function(e){return-1!==e.name.indexOf("Line")&&e.value.length>0}).map(function(e){return e.value}).join("\n");return r.length>0&&(t.mrzText=window.btoa(r)),t}},{key:"predict",value:function(e,t){var r=this;return j(function(){var n;return L(this,function(o){switch(o.label){case 0:return[4,r.model.predictFromArray(e,t)];case 1:return(n=o.sent()).filter(function(e){return"*"===M(e,1)[0].value}).length>3?[4,r.model.predictFromArray(e.reverse(),t)]:[3,3];case 2:n=o.sent(),o.label=3;case 3:return[2,n]}})})()}},{key:"scan",value:function(e){var t=this;return new Promise(function(r){t.worker.postMessage({fn:"prepare",iData:e});var n,o=t;t.worker.onmessage=(n=j(function(e){var t,n,i,u;return L(this,function(a){switch(a.label){case 0:return t=e.data,n=t.name,i=t.data,"batchArr"!==n?[3,2]:[4,o.predict(i.batchArr,i.batchSize)];case 1:return u=a.sent(),o.worker.postMessage({fn:"process",predictions:u}),[2];case 2:return"result"===n&&r(i),r(i),[2]}})}),function(e){return n.apply(this,arguments)})})}},{key:"processMRZ",value:function(e){var t=this;return j(function(){var r,n,o,i,u,a,c;return L(this,function(s){switch(s.label){case 0:return n={status:!1,cancel:!1,touch:!1,image:null,type:"mrz",isSuccessProcess:!1},t.isProcessing?[2,n]:t.isInitialized?(t.isProcessing=!0,[4,(0,k.x)("mrz_stream",function(){return t.scan(e)})]):[2,n];case 1:return(null==(o=s.sent())?void 0:o.errorId)?(t.isProcessing=!1,[2,E(R({},o),{error:t.licenseError(o.errorId)})]):(o&&0===(null==o||null===(r=o.status)||void 0===r?void 0:r.value)&&(null==o?void 0:o.count)>0?(i=t.estimateResults(o),u=i===o.count&&o.symbolsConf>.95?"green":"yellow",n.coords={locations:t.prepareMRZLocation(o.location),color:u},a=i===o.count&&o.symbolsConf>.85,c=i>=o.count-2,(a||c)&&(t.successCount+=1,n.isSuccessProcess=!0,t.successCount>=t.MIN_MRZ_FRAMES&&(n.status=!0,n.needToCut=!0,n.image=e,n.results=t.writeResults(o)))):(n.coords=null,t.successCount=0),t.isProcessing=!1,[2,n])}})})()}},{key:"estimateResults",value:function(e){return 0===e.count?0:e.fields.reduce(function(e,t){return"Valid"===t.status?e+1:e},0)}},{key:"detectMrz",value:function(e){var t=this;return j(function(){var r,n,o,i,u;return L(this,function(a){switch(a.label){case 0:return[4,(0,k.x)("mrz_upload",function(){return t.scan(e)})];case 1:return r=a.sent(),n=!0,r&&r.count>0&&r.symbolsConf>.8?(o=t.prepareMRZLocation(r.location),i=t.writeResults(r),[2,{status:!0,locations:o,results:i,isNotMRZ:n=!1}]):(r&&r.symbolsConf>.6&&(n=!1),u={status:!1,isNotMRZ:n},(null==r?void 0:r.errorId)&&(u.error=t.licenseError(r.errorId)),[2,u])}})})()}}],r&&S(t.prototype,r),n&&S(t,n),e}();const _=T;var C=r(8101),z=r(7798);function I(e,t,r,n,o,i,u){try{var a=e[i](u),c=a.value}catch(e){return void r(e)}a.done?t(c):Promise.resolve(c).then(n,o)}function D(e,t){var r,n,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;u;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return u.label++,{value:i[1],done:!1};case 5:u.label++,n=i[1],i=[0];continue;case 7:i=u.ops.pop(),u.trys.pop();continue;default:if(!(o=u.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){u=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){u.label=i[1];break}if(6===i[0]&&u.label<o[1]){u.label=o[1],o=i;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(i);break}o[2]&&u.ops.pop(),u.trys.pop();continue}i=t.call(e,u)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}}const Z=(F=function(e){var t,r,i,u;return D(this,function(a){switch(a.label){case 0:return(t=e.commonLicenseKey)?[3,1]:((0,C.A)(),[3,3]);case 1:return[4,(0,z.x)("".concat(n.A.networkUrl,"mrzWorker.js.gzip"))];case 2:i=a.sent(),u=new _(i,t,n.A.networkUrl),o.A.setModule("module","mrz",u),r=[u.model.initialize.bind(u.model)],a.label=3;case 3:return[2,r]}})},U=function(){var e=this,t=arguments;return new Promise(function(r,n){var o=F.apply(e,t);function i(e){I(o,r,n,i,u,"next",e)}function u(e){I(o,r,n,i,u,"throw",e)}i(void 0)})},function(e){return U.apply(this,arguments)});var F,U},5909(e){e.exports=JSON.parse('{"n":{"EX":"mrz03032023.onnx","w0":"faceLandmark03032023.onnx","ey":"faceDetection03032023.onnx","sh":"yoloFaceFingers.onnx"}}')}}]);
|
|
1
|
+
(self.webpackChunk_idscan_idvc2=self.webpackChunk_idscan_idvc2||[]).push([[292],{7798(e,t,r){r.d(t,{x:()=>s});var n=r(3075),o=r(1509);function i(e,t,r,n,o,i,u){try{var a=e[i](u),c=a.value}catch(e){return void r(e)}a.done?t(c):Promise.resolve(c).then(n,o)}function u(e){return function(){var t=this,r=arguments;return new Promise(function(n,o){var u=e.apply(t,r);function a(e){i(u,n,o,a,c,"next",e)}function c(e){i(u,n,o,a,c,"throw",e)}a(void 0)})}}function a(e,t){var r,n,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;u;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return u.label++,{value:i[1],done:!1};case 5:u.label++,n=i[1],i=[0];continue;case 7:i=u.ops.pop(),u.trys.pop();continue;default:if(!(o=u.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){u=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){u.label=i[1];break}if(6===i[0]&&u.label<o[1]){u.label=o[1],o=i;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(i);break}o[2]&&u.ops.pop(),u.trys.pop();continue}i=t.call(e,u)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}}var c,l=(c=u(function(e){var t,r,i,u,c;return a(this,function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),r=Uint8Array.bind,[4,(0,o.ZN)(e)];case 1:return t=new(r.apply(Uint8Array,[void 0,a.sent()])),i=(0,n.Aq)(t),u=new Blob([i.buffer],{type:"application/javascript"}),[2,URL.createObjectURL(u)];case 2:throw c=a.sent(),console.error("Error loading and decompressing worker file:",c),c;case 3:return[2]}})}),function(e){return c.apply(this,arguments)}),s=function(){var e=u(function(e){var t;return a(this,function(r){switch(r.label){case 0:return[4,l(e)];case 1:return t=r.sent(),[2,new Worker(t)]}})});return function(t){return e.apply(this,arguments)}}()},290(e,t,r){r.r(t),r.d(t,{default:()=>I});var n=r(4955),o=r(2639),i=r(7734),u=r(4703),a=r(2842),c=r(3814),l=["0","1","2","3","4","*","5","6","7","*","8","9","A","*","B","C","*","D","*","E","*","F","*","G","*","H","I","J","*","K","*","L","*","M","N","O","P","*","Q","R","*","S","T","*","U","*","V","*","W","X","Y","*","Z","<","*"];function s(e,t,r,n,o,i,u){try{var a=e[i](u),c=a.value}catch(e){return void r(e)}a.done?t(c):Promise.resolve(c).then(n,o)}function f(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function p(e){return p=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},p(e)}function y(e,t){return!t||"object"!=((r=t)&&"undefined"!=typeof Symbol&&r.constructor===Symbol?"symbol":typeof r)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t;var r}function h(e,t){return h=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},h(e,t)}function b(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}();return function(){var r,n=p(e);if(t){var o=p(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return y(this,r)}}function v(e,t){var r,n,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;u;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return u.label++,{value:i[1],done:!1};case 5:u.label++,n=i[1],i=[0];continue;case 7:i=u.ops.pop(),u.trys.pop();continue;default:if(!(o=u.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){u=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){u.label=i[1];break}if(6===i[0]&&u.label<o[1]){u.label=o[1],o=i;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(i);break}o[2]&&u.ops.pop(),u.trys.pop();continue}i=t.call(e,u)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}}var d=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&h(e,t)}(u,e);var t,r,n,o=b(u);function u(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:a.K.WASM,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,u),o.call(this,e,t,r)}return t=u,r=[{key:"predict",value:function(e){var t,r,n,o=e.length/784,u=new i.qY("float32",e,[o,28,28,1]),a=(n=u,(r="input_1")in(t={})?Object.defineProperty(t,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[r]=n,t);return this.session.run(a)}},{key:"predictFromArray",value:function(e,t){var r,n=this;return(r=function(){var r,o,i,u;return v(this,function(a){switch(a.label){case 0:return n.loading||0===t?[2,[]]:(r=(0,c.S8)(e.slice(0,784*t),c.Qg.STANDART),[4,n.predict(r)]);case 1:return o=a.sent(),i=o.dense.data,u=i.length/t,[2,Array.from({length:t},function(e,t){return n.interpret(i.subarray(u*t,u*(t+1)))})]}})},function(){var e=this,t=arguments;return new Promise(function(n,o){var i=r.apply(e,t);function u(e){s(i,n,o,u,a,"next",e)}function a(e){s(i,n,o,u,a,"throw",e)}u(void 0)})})()}},{key:"interpret",value:function(e){return Array.from(e).map(function(e,t){return{value:l[t],confidence:e}}).sort(function(e,t){return e.confidence-t.confidence}).slice(-3).reverse()}},{key:"isLoading",get:function(){return this.loading}},{key:"predictFromImage",value:function(e,t){}}],r&&f(t.prototype,r),n&&f(t,n),u}(u.A),w=r(3818),m=r(5909);function g(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function k(e,t,r,n,o,i,u){try{var a=e[i](u),c=a.value}catch(e){return void r(e)}a.done?t(c):Promise.resolve(c).then(n,o)}function O(e){return function(){var t=this,r=arguments;return new Promise(function(n,o){var i=e.apply(t,r);function u(e){k(i,n,o,u,a,"next",e)}function a(e){k(i,n,o,u,a,"throw",e)}u(void 0)})}}function x(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function P(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function j(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){P(e,t,r[t])})}return e}function S(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}),e}function A(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,i=[],u=!0,a=!1;try{for(r=r.call(e);!(u=(n=r.next()).done)&&(i.push(n.value),!t||i.length!==t);u=!0);}catch(e){a=!0,o=e}finally{try{u||null==r.return||r.return()}finally{if(a)throw o}}return i}}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return g(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(r);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return g(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function R(e,t){var r,n,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;u;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return u.label++,{value:i[1],done:!1};case 5:u.label++,n=i[1],i=[0];continue;case 7:i=u.ops.pop(),u.trys.pop();continue;default:if(!(o=u.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){u=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){u.label=i[1];break}if(6===i[0]&&u.label<o[1]){u.label=o[1],o=i;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(i);break}o[2]&&u.ops.pop(),u.trys.pop();continue}i=t.call(e,u)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}}var E=function(){function e(t,r,n){var o=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),P(this,"w",0),P(this,"h",0),P(this,"successCount",0),P(this,"worker",void 0),P(this,"model",void 0),P(this,"isInitialized",!1),P(this,"isProcessing",!1),P(this,"MIN_MRZ_FRAMES",3),this.model=new d("".concat(m.n.EX),a.K.WASM,n),this.worker=t,this.worker.postMessage({fn:"init",initData:{key:r,networkUrl:n}}),this.worker.onmessage=function(e){var t=e.data,r=t.name,n=t.data;"initialization"===r&&(o.isInitialized=n)}}var t,r,n;return t=e,r=[{key:"getErrorVal",value:function(e){var t;return-3===e&&(t=0),-2===e&&(t=1),t}},{key:"licenseError",value:function(e){return{error:!0,errorType:"licenceKeyError",errorVal:this.getErrorVal(e)}}},{key:"yComparator",value:function(e,t){return e.y<t.y?[e,t]:[t,e]}},{key:"allocate",value:function(){}},{key:"prepareMRZLocation",value:function(e){var t=[e.leftTop,e.rightTop,e.rightBottom,e.leftBottom].sort(function(e,t){return e.x-t.x}),r=A(this.yComparator(t[0],t[1]),2),n=r[0],o=r[1],i=A(this.yComparator(t[2],t[3]),2),u=i[0],a=i[1],c=.03;return{leftTop:{x:n.x-c,y:n.y-c},rightTop:{x:u.x+c,y:u.y-c},rightBottom:{x:a.x+c,y:a.y+c},leftBottom:{x:o.x-c,y:o.y+c}}}},{key:"writeResults",value:function(e){var t={mrzText:""},r=e.fields.filter(function(e){return-1!==e.name.indexOf("Line")&&e.value.length>0}).map(function(e){return e.value}).join("\n");return r.length>0&&(t.mrzText=window.btoa(r)),t}},{key:"predict",value:function(e,t){var r=this;return O(function(){var n;return R(this,function(o){switch(o.label){case 0:return[4,r.model.predictFromArray(e,t)];case 1:return(n=o.sent()).filter(function(e){return"*"===A(e,1)[0].value}).length>3?[4,r.model.predictFromArray(e.reverse(),t)]:[3,3];case 2:n=o.sent(),o.label=3;case 3:return[2,n]}})})()}},{key:"scan",value:function(e){var t=this;return new Promise(function(r){t.worker.postMessage({fn:"prepare",iData:e});var n,o=t;t.worker.onmessage=(n=O(function(e){var t,n,i,u;return R(this,function(a){switch(a.label){case 0:return t=e.data,n=t.name,i=t.data,"batchArr"!==n?[3,2]:[4,o.predict(i.batchArr,i.batchSize)];case 1:return u=a.sent(),o.worker.postMessage({fn:"process",predictions:u}),[2];case 2:return"result"===n&&r(i),r(i),[2]}})}),function(e){return n.apply(this,arguments)})})}},{key:"processMRZ",value:function(e){var t=this;return O(function(){var r,n,o,i,u,a,c;return R(this,function(l){switch(l.label){case 0:return n={status:!1,cancel:!1,touch:!1,image:null,type:"mrz",isSuccessProcess:!1},t.isProcessing?[2,n]:t.isInitialized?(t.isProcessing=!0,[4,(0,w.x)("mrz_stream",function(){return t.scan(e)})]):[2,n];case 1:return(null==(o=l.sent())?void 0:o.errorId)?(t.isProcessing=!1,[2,S(j({},o),{error:t.licenseError(o.errorId)})]):(o&&0===(null==o||null===(r=o.status)||void 0===r?void 0:r.value)&&(null==o?void 0:o.count)>0?(i=t.estimateResults(o),u=i===o.count&&o.symbolsConf>.95?"green":"yellow",n.coords={locations:t.prepareMRZLocation(o.location),color:u},a=i===o.count&&o.symbolsConf>.85,c=i>=o.count-2,(a||c)&&(t.successCount+=1,n.isSuccessProcess=!0,t.successCount>=t.MIN_MRZ_FRAMES&&(n.status=!0,n.needToCut=!0,n.image=e,n.results=t.writeResults(o)))):(n.coords=null,t.successCount=0),t.isProcessing=!1,[2,n])}})})()}},{key:"estimateResults",value:function(e){return 0===e.count?0:e.fields.reduce(function(e,t){return"Valid"===t.status?e+1:e},0)}},{key:"detectMrz",value:function(e){var t=this;return O(function(){var r,n,o,i,u;return R(this,function(a){switch(a.label){case 0:return[4,(0,w.x)("mrz_upload",function(){return t.scan(e)})];case 1:return r=a.sent(),n=!0,r&&r.count>0&&r.symbolsConf>.8?(o=t.prepareMRZLocation(r.location),i=t.writeResults(r),[2,{status:!0,locations:o,results:i,isNotMRZ:n=!1}]):(r&&r.symbolsConf>.6&&(n=!1),u={status:!1,isNotMRZ:n},(null==r?void 0:r.errorId)&&(u.error=t.licenseError(r.errorId)),[2,u])}})})()}}],r&&x(t.prototype,r),n&&x(t,n),e}();const M=E;var T=r(8101),_=r(7798);function C(e,t,r,n,o,i,u){try{var a=e[i](u),c=a.value}catch(e){return void r(e)}a.done?t(c):Promise.resolve(c).then(n,o)}function z(e,t){var r,n,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;u;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return u.label++,{value:i[1],done:!1};case 5:u.label++,n=i[1],i=[0];continue;case 7:i=u.ops.pop(),u.trys.pop();continue;default:if(!(o=u.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){u=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){u.label=i[1];break}if(6===i[0]&&u.label<o[1]){u.label=o[1],o=i;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(i);break}o[2]&&u.ops.pop(),u.trys.pop();continue}i=t.call(e,u)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}}const I=(D=function(e){var t,r,i,u;return z(this,function(a){switch(a.label){case 0:return(t=e.commonLicenseKey)?[3,1]:((0,T.A)(),[3,3]);case 1:return[4,(0,_.x)("".concat(n.A.networkUrl,"mrzWorker.js.gzip"))];case 2:i=a.sent(),u=new M(i,t,n.A.networkUrl),o.A.setModule("module","mrz",u),r=[u.model.initialize.bind(u.model)],a.label=3;case 3:return[2,r]}})},L=function(){var e=this,t=arguments;return new Promise(function(r,n){var o=D.apply(e,t);function i(e){C(o,r,n,i,u,"next",e)}function u(e){C(o,r,n,i,u,"throw",e)}i(void 0)})},function(e){return L.apply(this,arguments)});var D,L},5909(e){e.exports=JSON.parse('{"n":{"EX":"mrz03032023.onnx","w0":"faceLandmark03032023.onnx","ey":"faceDetection03032023.onnx","sh":"yoloFaceFingers.onnx"}}')}}]);
|
package/dist/types/bl.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { IConfig } from './modules/Config';
|
|
2
2
|
import { IDocumentTypeConfig } from './modules/validator';
|
|
3
|
+
import type { ILoaderOptions } from './modules/Loader/loaderStack';
|
|
3
4
|
declare const bl: {
|
|
4
5
|
showSelectDocumentTypeModal(isFirstInit: boolean): void;
|
|
5
6
|
postInit(): Promise<void>;
|
|
@@ -10,6 +11,6 @@ declare const bl: {
|
|
|
10
11
|
resetSteps(): Promise<void>;
|
|
11
12
|
updateDocumentTypes(documentTypes: IDocumentTypeConfig): Promise<any>;
|
|
12
13
|
reloadComponent(config: Partial<IConfig>): Promise<void>;
|
|
13
|
-
showLoader(val: boolean, bottomText?: string, topText?: string): void;
|
|
14
|
+
showLoader(val: boolean, bottomText?: string, topText?: string, options?: ILoaderOptions): void;
|
|
14
15
|
};
|
|
15
16
|
export default bl;
|
package/dist/types/idvc.d.ts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { IConfig } from './modules/Config';
|
|
2
2
|
import type { SupportedLanguage } from './environment/langs';
|
|
3
3
|
import type { IDocumentTypeConfig } from './modules/validator';
|
|
4
|
+
import type { ILoaderOptions } from './modules/Loader/loaderStack';
|
|
4
5
|
export { prepareRequestDataForDiveApi, } from './integrations/prepareRequestDataForDiveApi';
|
|
5
6
|
export type { IPrepareRequestDataForDiveApiParams } from './integrations/prepareRequestDataForDiveApi';
|
|
6
7
|
export { splitTrackString } from './integrations/splitTrackString';
|
|
7
8
|
export type { ITrackStringParts } from './integrations/splitTrackString';
|
|
9
|
+
export type { ILoaderOptions, LoaderScene } from './modules/Loader/loaderStack';
|
|
8
10
|
export default class VideoCapturing {
|
|
9
11
|
/**
|
|
10
12
|
* Splits the captured track string (`<data>.<barcodeParams>`) into its parts.
|
|
@@ -21,8 +23,14 @@ export default class VideoCapturing {
|
|
|
21
23
|
resetAllSteps(): void;
|
|
22
24
|
reloadComponent(newConfig: Partial<IConfig>): void;
|
|
23
25
|
updateDocumentTypes(documentTypes: IDocumentTypeConfig): void;
|
|
26
|
+
/** Shows (val = true) or hides the loader without texts, with the animation of the prepare scene. */
|
|
24
27
|
showSpinner(val: any): void;
|
|
25
|
-
|
|
28
|
+
/**
|
|
29
|
+
* Shows the loader (val = true) or hides the last shown one (val = false).
|
|
30
|
+
* Shows and hides are stacked: each hide removes the state of the last show, the loader stays while any is left.
|
|
31
|
+
* options.scene picks the animation: 'check' (default) while something is checked, 'send' while data is sent.
|
|
32
|
+
*/
|
|
33
|
+
showLoader(val: boolean, bottomText?: string, topText?: string, options?: ILoaderOptions): void;
|
|
26
34
|
private prepareContext;
|
|
27
35
|
private init;
|
|
28
36
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { LoaderState } from '../ui/Loader/LoaderUI';
|
|
2
|
+
import { ILoaderOptions } from './loaderStack';
|
|
2
3
|
interface ILoader {
|
|
3
4
|
addState: () => void;
|
|
4
5
|
showLoader: () => void;
|
|
@@ -8,15 +9,13 @@ interface ILoader {
|
|
|
8
9
|
}
|
|
9
10
|
export declare class Loader implements ILoader {
|
|
10
11
|
private ui;
|
|
11
|
-
private
|
|
12
|
+
private stack;
|
|
12
13
|
constructor(mountElement: any, state: LoaderState);
|
|
13
|
-
addState(bottomText?: string, topText?: string): void;
|
|
14
|
+
addState(bottomText?: string, topText?: string, options?: ILoaderOptions): void;
|
|
14
15
|
removeState(): void;
|
|
15
16
|
clearState(): void;
|
|
16
17
|
showLoader(): void;
|
|
17
18
|
hideLoader(): void;
|
|
18
|
-
private setText;
|
|
19
|
-
private setVideoLoadingText;
|
|
20
19
|
private statsProcessing;
|
|
21
20
|
}
|
|
22
21
|
export {};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The scene of the loader:
|
|
3
|
+
* - `check` (default): a curtain of light passes over the cubes and a wave of soft hops follows it,
|
|
4
|
+
* for waiting while something is being checked or processed;
|
|
5
|
+
* - `send`: the cubes fly away by diagonals and dissolve, for waiting while data is being sent or uploaded;
|
|
6
|
+
* - `prepare`: the cubes come down by diagonals and the grid is built, for waiting while something
|
|
7
|
+
* is being started or prepared (a step, the camera, the neural network).
|
|
8
|
+
*/
|
|
9
|
+
export type LoaderScene = 'check' | 'send' | 'prepare';
|
|
10
|
+
export declare const LOADER_SCENES: readonly LoaderScene[];
|
|
11
|
+
export declare const DEFAULT_LOADER_SCENE: LoaderScene;
|
|
12
|
+
export interface ILoaderOptions {
|
|
13
|
+
/** The scene drawn above the texts, `check` by default. */
|
|
14
|
+
scene?: LoaderScene;
|
|
15
|
+
}
|
|
16
|
+
export type LoaderStat = {
|
|
17
|
+
bottomText: string;
|
|
18
|
+
topText: string;
|
|
19
|
+
scene: LoaderScene;
|
|
20
|
+
};
|
|
21
|
+
/** Returns the scene if it is known, otherwise the default one. */
|
|
22
|
+
export declare function resolveLoaderScene(scene: unknown): LoaderScene;
|
|
23
|
+
/**
|
|
24
|
+
* The states of the loader: each show pushes one, each hide pops the last one,
|
|
25
|
+
* and the loader draws the last pushed state while any is left.
|
|
26
|
+
*/
|
|
27
|
+
export declare class LoaderStack {
|
|
28
|
+
private stats;
|
|
29
|
+
push(bottomText?: string, topText?: string, options?: ILoaderOptions | null): void;
|
|
30
|
+
pop(): void;
|
|
31
|
+
clear(): void;
|
|
32
|
+
get size(): number;
|
|
33
|
+
/** The state drawn now, undefined when the loader is hidden. */
|
|
34
|
+
get current(): LoaderStat | undefined;
|
|
35
|
+
}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { ComponentLit } from '../ComponentLit';
|
|
2
|
+
import type { LoaderScene } from '../../Loader/loaderStack';
|
|
2
3
|
export type LoaderState = {
|
|
3
4
|
loading: boolean;
|
|
4
5
|
spinnerVisibility: boolean;
|
|
5
6
|
bottomText?: string;
|
|
6
7
|
topText?: string;
|
|
8
|
+
scene?: LoaderScene;
|
|
7
9
|
};
|
|
8
10
|
export declare class LoaderUI extends ComponentLit<LoaderState> {
|
|
9
11
|
constructor(mountElement: HTMLElement | string, state: LoaderState, events?: any);
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
import { TemplateResult } from 'lit-html';
|
|
2
|
-
|
|
1
|
+
import { type TemplateResult } from 'lit-html';
|
|
2
|
+
import type { LoaderState } from './LoaderUI';
|
|
3
|
+
export declare const LoaderTemplate: (state: LoaderState) => TemplateResult;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="onnxruntime-web" />
|
|
2
2
|
import NeuralModel from './neuralModel';
|
|
3
3
|
import { Provider } from './Provider';
|
|
4
4
|
import { RGBColor32 } from '../helpers/image';
|
|
@@ -8,10 +8,8 @@ interface Prediction {
|
|
|
8
8
|
}
|
|
9
9
|
export type PredictionList = Prediction[];
|
|
10
10
|
export default class MrzModel extends NeuralModel {
|
|
11
|
-
predictionList: InferenceSession.OnnxValueMapType[];
|
|
12
|
-
interpretedPredictionsList: PredictionList[];
|
|
13
11
|
constructor(url?: string, provider?: Provider, wasmPaths?: string);
|
|
14
|
-
predict(rgb: RGBColor32): Promise<InferenceSession.OnnxValueMapType>;
|
|
12
|
+
predict(rgb: RGBColor32): Promise<import("onnxruntime-web").InferenceSession.OnnxValueMapType>;
|
|
15
13
|
predictFromArray(input: Float32Array, batchSize: number): Promise<PredictionList[]>;
|
|
16
14
|
interpret(data: Float32Array): PredictionList;
|
|
17
15
|
get isLoading(): boolean;
|