@idscan/onboarding 2.1.28 → 2.2.5
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/.npmignore +20 -0
- package/dist/css/onboarding.css +1 -1
- package/dist/js/wrapper.js +1 -1
- package/dist/networks/156-9239-chunk.js +1 -0
- package/dist/networks/190-77ed-chunk.js +1 -0
- package/dist/networks/77-9e2f-chunk.js +1 -0
- package/dist/networks/Face-e375-chunk.js +1 -0
- package/dist/networks/MRZ-d498-chunk.js +1 -0
- package/dist/networks/PDF-78d2-chunk.js +1 -0
- package/dist/networks/ZXing-5410-chunk.js +1 -0
- package/dist/networks/angle03032023.onnx +0 -0
- package/dist/networks/classLocal03032023.onnx +0 -0
- package/dist/networks/faceDetection03032023.onnx +0 -0
- package/dist/networks/faceLandmark03032023.onnx +0 -0
- package/dist/networks/mrz03032023.onnx +0 -0
- package/dist/networks/ort-wasm-simd-threaded.wasm +0 -0
- package/dist/networks/ort-wasm-simd.wasm +0 -0
- package/dist/networks/ort-wasm-threaded.wasm +0 -0
- package/dist/networks/ort-wasm.wasm +0 -0
- package/package.json +8 -4
- package/readme.md +383 -0
- package/dist/networks/130-3968-chunk.js +0 -1
- package/dist/networks/215-cb9e-chunk.js +0 -1
- package/dist/networks/400-3816-chunk.js +0 -1
- package/dist/networks/716-d3a2-chunk.js +0 -1
- package/dist/networks/Face-4ffb-chunk.js +0 -1
- package/dist/networks/MRZ-d77b-chunk.js +0 -1
- package/dist/networks/PDF-89f3-chunk.js +0 -1
- package/dist/networks/ZXing-e76f-chunk.js +0 -1
- package/dist/networks/angles20210831.bin +0 -0
- package/dist/networks/angles20210831.json +0 -1
- package/dist/networks/asyncLoader-4593-chunk.js +0 -1
- package/dist/networks/cdnLoader-bdbc-chunk.js +0 -1
- package/dist/networks/classLocal20220112.bin +0 -0
- package/dist/networks/classLocal20220112.json +0 -1
- package/dist/networks/detectormodel20220817.bin +0 -0
- package/dist/networks/detectormodel20220817.json +0 -1
- package/dist/networks/facemesh20210831.bin +0 -0
- package/dist/networks/facemesh20210831.json +0 -1
- package/dist/networks/landmarkmodel20220817.bin +0 -0
- package/dist/networks/landmarkmodel20220817.json +0 -1
- package/dist/networks/mrz20220531.bin +0 -0
- package/dist/networks/mrz20220531.json +0 -1953
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@idscan/onboarding",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.2.5",
|
|
4
4
|
"description": "Wrapper of the IDVC library for DVS Online.",
|
|
5
5
|
"main": "dist/js/wrapper.js",
|
|
6
6
|
"files": [
|
|
7
|
-
"dist"
|
|
7
|
+
"dist/**",
|
|
8
|
+
".npmignore",
|
|
9
|
+
"notes.txt",
|
|
10
|
+
"LICENSE.txt",
|
|
11
|
+
"README.md"
|
|
8
12
|
],
|
|
9
13
|
"scripts": {
|
|
10
14
|
"start": "webpack serve --mode development",
|
|
@@ -15,7 +19,7 @@
|
|
|
15
19
|
"minor": "npm version minor"
|
|
16
20
|
},
|
|
17
21
|
"dependencies": {
|
|
18
|
-
"@idscan/idvc2": "^2.
|
|
22
|
+
"@idscan/idvc2": "^2.5.1",
|
|
19
23
|
"core-js": "^3.30.0",
|
|
20
24
|
"qrcode": "^1.5.1",
|
|
21
25
|
"regenerator-runtime": "^0.13.11"
|
|
@@ -53,7 +57,7 @@
|
|
|
53
57
|
"style-loader": "^3.3.1",
|
|
54
58
|
"ts-loader": "^9.4.2",
|
|
55
59
|
"typescript": "^4.9.5",
|
|
56
|
-
"webpack": "^5.
|
|
60
|
+
"webpack": "^5.81.0",
|
|
57
61
|
"webpack-cli": "^5.0.1",
|
|
58
62
|
"webpack-dev-server": "^4.11.1"
|
|
59
63
|
},
|
package/readme.md
ADDED
|
@@ -0,0 +1,383 @@
|
|
|
1
|
+
## Overview
|
|
2
|
+
|
|
3
|
+
Wrapper of the IDVC library for DVS Online.
|
|
4
|
+
|
|
5
|
+
## Use cases
|
|
6
|
+
|
|
7
|
+
- Capture and determination of the document type
|
|
8
|
+
- Capture of pdf417
|
|
9
|
+
- Capture of MRZ
|
|
10
|
+
- Capture of faces
|
|
11
|
+
|
|
12
|
+
## Recommendations
|
|
13
|
+
|
|
14
|
+
Use a modern phone with a good camera having the definition of not less than 8 megapixels.
|
|
15
|
+
The capture must be made in a well-lighted room. A document must be located at the uniform background.
|
|
16
|
+
|
|
17
|
+
## Limitations
|
|
18
|
+
|
|
19
|
+
This component works in phones with the operating system Android in the browser Chrome (minimum version 52) and in phones with the operating system iOS (minimum version 11) in the browser Safari
|
|
20
|
+
|
|
21
|
+
## Installation
|
|
22
|
+
|
|
23
|
+
```
|
|
24
|
+
$ npm install @idscan/onboarding
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
This component contains JS, CSS files which require the mandatory import into your project.
|
|
28
|
+
|
|
29
|
+
1. Before importing it is necessary to set the webpack-configuration.
|
|
30
|
+
|
|
31
|
+
*Note: The project must use the webpack 4 and later versions.*
|
|
32
|
+
|
|
33
|
+
1.1. Add the following rules of loading to the field rules
|
|
34
|
+
```javascript
|
|
35
|
+
{
|
|
36
|
+
test: /\.css$/,
|
|
37
|
+
use: ["style-loader", "css-loader"]
|
|
38
|
+
}
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
1.2. If you prefer to use neural networks from your domain, you should add the 'CopyWebpackPlugin' into the section 'plugins' which will copy the files, which are necessary for the work of the neural network, from the folder to another folder that should be selected by you.
|
|
42
|
+
|
|
43
|
+
*Note: The structure inside the folder of the component 'networks' must be saved on the server with due regard to the nesting.
|
|
44
|
+
There are binary files in the folder which do not have the extension. These files must be provided by the server with the header `Content-Type: application/octet-stream`.*
|
|
45
|
+
```javascript
|
|
46
|
+
new CopyWebpackPlugin ([
|
|
47
|
+
{
|
|
48
|
+
from: 'node_modules/@idscan/onboarding/dist/networks/**/*',
|
|
49
|
+
to: 'networks/[folder]/[name].[ext]',
|
|
50
|
+
toType: 'template'
|
|
51
|
+
}
|
|
52
|
+
])
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
1.3. Import the library and css to your project.
|
|
56
|
+
|
|
57
|
+
```javascript
|
|
58
|
+
import DVSOIDVC from '@idscan/onboarding';
|
|
59
|
+
import '@idscan/onboarding/dist/css/onboarding.css';
|
|
60
|
+
```
|
|
61
|
+
## Initialization
|
|
62
|
+
|
|
63
|
+
Create an instance of the object 'DVS Online IDVC library wrapper'. The object takes one object of the component configuration as a parameter.
|
|
64
|
+
|
|
65
|
+
All configurations of @idscan/IDVC will be fetched from DVS Online by domainId.
|
|
66
|
+
|
|
67
|
+
Available fields:
|
|
68
|
+
|
|
69
|
+
**el** (string) - id of an element on the page where the component will be integrated. Required.
|
|
70
|
+
|
|
71
|
+
**applicantId** (string) - id of applicant. Required
|
|
72
|
+
|
|
73
|
+
**domainId** (string) - domain id where from will get configs and styles. Required
|
|
74
|
+
|
|
75
|
+
**domainApi** (string) - URL address of onboarding API
|
|
76
|
+
|
|
77
|
+
**publicKey** (string) - DVS Web API Public Key. Required
|
|
78
|
+
|
|
79
|
+
**isAuth** (boolean) - Flag indicating that only face authentication is required
|
|
80
|
+
|
|
81
|
+
**chunkPublicPath** (string) - Path to the folder with chunks. Specify the path on the server if you need to remove the folder to another location. The default path is \'networks\'.
|
|
82
|
+
|
|
83
|
+
**callbacks** (object) - object with callback hooks. Available next hooks:
|
|
84
|
+
|
|
85
|
+
- **onChange** - callback-function which will be called after change one step. The returnable value is the object with the type and the image
|
|
86
|
+
|
|
87
|
+
- **onCameraError** - The function that is invoked in case if the camera is not available. The response value is the object with the error code and the message
|
|
88
|
+
|
|
89
|
+
- **onReset** - callback-function which will be called after reset all the steps. The returnable value is the object with the steps
|
|
90
|
+
|
|
91
|
+
- **onRetakeHook** - the function that will be called before reset the current step. The returnable value is the object with the current step
|
|
92
|
+
|
|
93
|
+
- **onValidate** - the function that will be called after validation response received. The returnable value is the object with validation information
|
|
94
|
+
|
|
95
|
+
- **onError** - the function that will be called on error. The response value is the object with the error code and the message
|
|
96
|
+
|
|
97
|
+
- **onReloaded** - the function that will be called after the component finishes reloading. This function doesn't return a value.
|
|
98
|
+
|
|
99
|
+
- **onMounted** - the function that will be called on the component mounted. This function doesn't return a value.
|
|
100
|
+
|
|
101
|
+
- **submit** - callback-function which will be called after completing all the steps. The returnable value is the object with the following content:
|
|
102
|
+
```javascript
|
|
103
|
+
documentTypes: [
|
|
104
|
+
{
|
|
105
|
+
type: "ID",
|
|
106
|
+
steps:[
|
|
107
|
+
{ type: 'front', name: 'Document Front', mode: { uploader: true, video: true } },
|
|
108
|
+
{ type: 'pdf', name: 'Document PDF417 Barcode' , mode: { uploader: true, video: true } },
|
|
109
|
+
{ type: 'face', name: 'Face', mode: { uploader: false, video: true } }
|
|
110
|
+
]},
|
|
111
|
+
{
|
|
112
|
+
type: "Passport",
|
|
113
|
+
steps:[
|
|
114
|
+
{ type: 'mrz', name: 'Passport Front' , mode: { uploader: true, video: true } },
|
|
115
|
+
{ type: 'face', name: 'Face', mode: { uploader: false, video: true } }
|
|
116
|
+
]},
|
|
117
|
+
]
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
steps – steps with the type and the image in the format 'base64'.
|
|
121
|
+
|
|
122
|
+
Also, if you use automatic capture, in the "back" step **trackstring** will be returned (raw PDF417 data from Barcode encoded in base64)
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
*Note: Request an license key for the library by emailing
|
|
126
|
+
[sales@idscan.net](mailto:sales@idscan.net) or [support@idscan.net](mailto:support@idscan.net)*
|
|
127
|
+
|
|
128
|
+
## Methods
|
|
129
|
+
|
|
130
|
+
**setApplicant** (string) - the method that reinitialize wrapper for new applicant. Parameter is an applicant id of string type.
|
|
131
|
+
```javascript
|
|
132
|
+
import DVSOIDVC from './Wrapper';
|
|
133
|
+
|
|
134
|
+
const lib = new DVSOIDVC({
|
|
135
|
+
applicantId: '...',
|
|
136
|
+
domainId: '...',
|
|
137
|
+
publicKey: '...',
|
|
138
|
+
chunkPublicPath: '/customPath/',
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
const btn = document.getElementById('btn');
|
|
142
|
+
btn.addEventListener('click', () => {
|
|
143
|
+
const applicantId = 'new applicant id';
|
|
144
|
+
lib.setApplicant(applicantId);
|
|
145
|
+
});
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
**updateConfig** (string) - the method that reinitialize wrapper with new config. Parameter is an JSON encoded IDVC config. Works only in demo mode.
|
|
149
|
+
|
|
150
|
+
## Version history
|
|
151
|
+
- **2.2.5**
|
|
152
|
+
- Fixed build issue
|
|
153
|
+
|
|
154
|
+
- **2.2.4**
|
|
155
|
+
- Updated IDVC component
|
|
156
|
+
|
|
157
|
+
- **2.2.3**
|
|
158
|
+
- Added: face auth success modal
|
|
159
|
+
|
|
160
|
+
- **2.2.2**
|
|
161
|
+
- Added: config change
|
|
162
|
+
- Changed API calls
|
|
163
|
+
|
|
164
|
+
- **2.2.1**
|
|
165
|
+
- Fix: face validation
|
|
166
|
+
|
|
167
|
+
- **2.2.0**
|
|
168
|
+
- Feat: add flag indicating that only face authentication is required
|
|
169
|
+
- Feat: some minor fixes
|
|
170
|
+
|
|
171
|
+
- **2.1.29**
|
|
172
|
+
- Feat: some minor fixes
|
|
173
|
+
|
|
174
|
+
- **2.1.28**
|
|
175
|
+
- Updated IDVC component
|
|
176
|
+
|
|
177
|
+
- **2.1.27**
|
|
178
|
+
- Updated IDVC component
|
|
179
|
+
|
|
180
|
+
- **2.1.26**
|
|
181
|
+
- Fix: Consent Form styles
|
|
182
|
+
|
|
183
|
+
- **2.1.25**
|
|
184
|
+
- Feat: Add attempt left status text
|
|
185
|
+
- Fix: Validation Modal
|
|
186
|
+
|
|
187
|
+
- **2.1.24**
|
|
188
|
+
- Fix: Consent Form styles
|
|
189
|
+
|
|
190
|
+
- **2.1.23**
|
|
191
|
+
- Feat: rework Consent Form
|
|
192
|
+
- Feat: change Domains Api to Integrations Api
|
|
193
|
+
|
|
194
|
+
- **2.1.22**
|
|
195
|
+
- Fix: embedded app status from api
|
|
196
|
+
- Feat: update IDVC callbacks readme
|
|
197
|
+
|
|
198
|
+
- **2.1.21**
|
|
199
|
+
- Feat: change domain to domainApi
|
|
200
|
+
- Feat: domainApi is required now
|
|
201
|
+
|
|
202
|
+
- **2.1.20**
|
|
203
|
+
- Fix: change showQRCode flag name to showQrCode
|
|
204
|
+
|
|
205
|
+
- **2.1.19**
|
|
206
|
+
- Fix: return old check validation endpoint
|
|
207
|
+
- Feat: add check for showQRCode flag from backend
|
|
208
|
+
|
|
209
|
+
- **2.1.18**
|
|
210
|
+
- Add the possibility of continuing the documents' check on a mobile device
|
|
211
|
+
|
|
212
|
+
- **2.1.17**
|
|
213
|
+
- Change verifyFace option behavior
|
|
214
|
+
|
|
215
|
+
- **2.1.16**
|
|
216
|
+
- Updated IDVC component
|
|
217
|
+
|
|
218
|
+
- **2.1.15**
|
|
219
|
+
- Updated IDVC component
|
|
220
|
+
|
|
221
|
+
- **2.1.14**
|
|
222
|
+
- Updated IDVC component
|
|
223
|
+
|
|
224
|
+
- **2.1.13**
|
|
225
|
+
- Updated IDVC component
|
|
226
|
+
|
|
227
|
+
- **2.1.12**
|
|
228
|
+
- Fix: validation model
|
|
229
|
+
|
|
230
|
+
- **2.1.11**
|
|
231
|
+
- Updated IDVC component
|
|
232
|
+
|
|
233
|
+
- **2.1.10**
|
|
234
|
+
- Updated IDVC component
|
|
235
|
+
|
|
236
|
+
- **2.1.9**
|
|
237
|
+
- Fixed API path
|
|
238
|
+
|
|
239
|
+
- **2.1.8**
|
|
240
|
+
- Updated IDVC component
|
|
241
|
+
|
|
242
|
+
- **2.1.7**
|
|
243
|
+
- Added support for Proxy based frameworks
|
|
244
|
+
|
|
245
|
+
- **2.1.6**
|
|
246
|
+
- Added support for ios < 15
|
|
247
|
+
|
|
248
|
+
- **2.1.5**
|
|
249
|
+
- Updated IDVC component
|
|
250
|
+
|
|
251
|
+
- **2.1.4**
|
|
252
|
+
- Improved document types validation
|
|
253
|
+
|
|
254
|
+
- **2.1.3**
|
|
255
|
+
- Updated IDVC component
|
|
256
|
+
|
|
257
|
+
- **2.1.2**
|
|
258
|
+
- Updated IDVC component
|
|
259
|
+
- Changed: modal message behaviour
|
|
260
|
+
|
|
261
|
+
- **2.1.1**
|
|
262
|
+
- Fixed: submit mrz
|
|
263
|
+
|
|
264
|
+
- **2.1.0**
|
|
265
|
+
- Added: new option in config "chunkPublicPath"
|
|
266
|
+
|
|
267
|
+
- **2.0.19**
|
|
268
|
+
- Updated IDVC component
|
|
269
|
+
|
|
270
|
+
- **2.0.18**
|
|
271
|
+
- Updated IDVC component
|
|
272
|
+
|
|
273
|
+
- **2.0.17**
|
|
274
|
+
- Some improvements
|
|
275
|
+
|
|
276
|
+
- **2.0.16**
|
|
277
|
+
- Some improvements
|
|
278
|
+
|
|
279
|
+
- **2.0.15**
|
|
280
|
+
- Some improvements
|
|
281
|
+
|
|
282
|
+
- **2.0.14**
|
|
283
|
+
- Some improvements
|
|
284
|
+
|
|
285
|
+
- **2.0.13**
|
|
286
|
+
- Updated IDVC component
|
|
287
|
+
|
|
288
|
+
- **2.0.12**
|
|
289
|
+
- Updated IDVC component
|
|
290
|
+
|
|
291
|
+
- **2.0.11**
|
|
292
|
+
- Updated IDVC component
|
|
293
|
+
|
|
294
|
+
- **2.0.10**
|
|
295
|
+
- Updated IDVC component
|
|
296
|
+
|
|
297
|
+
- **2.0.9**
|
|
298
|
+
- Updated IDVC component
|
|
299
|
+
|
|
300
|
+
- **2.0.8**
|
|
301
|
+
- Some improvements
|
|
302
|
+
|
|
303
|
+
- **2.0.7**
|
|
304
|
+
- Fixed background
|
|
305
|
+
|
|
306
|
+
- **2.0.6**
|
|
307
|
+
- Added version 1 config support
|
|
308
|
+
|
|
309
|
+
- **2.0.5**
|
|
310
|
+
- Updated IDVC component
|
|
311
|
+
- Fixed submit method
|
|
312
|
+
|
|
313
|
+
- **2.0.4**
|
|
314
|
+
- Updated IDVC component
|
|
315
|
+
|
|
316
|
+
- **2.0.3**
|
|
317
|
+
- Some improvements
|
|
318
|
+
|
|
319
|
+
- **2.0.2**
|
|
320
|
+
- Updated IDVC component
|
|
321
|
+
|
|
322
|
+
- **2.0.1**
|
|
323
|
+
- Added consent form
|
|
324
|
+
|
|
325
|
+
- **2.0.0**
|
|
326
|
+
- Migrate to the IDVC version 2
|
|
327
|
+
|
|
328
|
+
- **1.0.18**
|
|
329
|
+
- Fixed spinner
|
|
330
|
+
|
|
331
|
+
- **1.0.17**
|
|
332
|
+
- Fixed license key
|
|
333
|
+
|
|
334
|
+
- **1.0.16**
|
|
335
|
+
- Added sign for forced closing of the request
|
|
336
|
+
|
|
337
|
+
- **1.0.15**
|
|
338
|
+
- updated IDVC component
|
|
339
|
+
|
|
340
|
+
- **1.0.14**
|
|
341
|
+
- updated IDVC component
|
|
342
|
+
|
|
343
|
+
- **1.0.13**
|
|
344
|
+
- added ids for style tags
|
|
345
|
+
|
|
346
|
+
- **1.0.12**
|
|
347
|
+
- updated IDVC component
|
|
348
|
+
|
|
349
|
+
- **1.0.11**
|
|
350
|
+
- updated using DVS Online API
|
|
351
|
+
|
|
352
|
+
- **1.0.10**
|
|
353
|
+
- added: onMounted callback
|
|
354
|
+
|
|
355
|
+
- **1.0.9**
|
|
356
|
+
- @idscan/idvc dependency updated
|
|
357
|
+
|
|
358
|
+
- **1.0.8**
|
|
359
|
+
- added: reload component with new configs in demo mode
|
|
360
|
+
|
|
361
|
+
- **1.0.7**
|
|
362
|
+
- updated using DVS Online API
|
|
363
|
+
|
|
364
|
+
- **1.0.6**
|
|
365
|
+
- updated using DVS Online API
|
|
366
|
+
|
|
367
|
+
- **1.0.5**
|
|
368
|
+
- updated IDVC component
|
|
369
|
+
- updated using DVS Online API
|
|
370
|
+
|
|
371
|
+
- **1.0.4**
|
|
372
|
+
- use CDN
|
|
373
|
+
|
|
374
|
+
- **1.0.3**
|
|
375
|
+
- Changed readme
|
|
376
|
+
|
|
377
|
+
- **1.0.2**
|
|
378
|
+
- Some improvements
|
|
379
|
+
|
|
380
|
+
- **1.0.1**
|
|
381
|
+
- Changed readme
|
|
382
|
+
|
|
383
|
+
- **1.0.0**
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
onmessage=({data:e})=>{Object.keys(e).forEach(((t,n)=>{fetch(e[t]).then((e=>e.body)).then((e=>{const t=e.getReader();return new ReadableStream({start(e){!function n(){t.read().then((({done:t,value:s})=>{t?e.close():(e.enqueue(s),n())}))}()}})})).then((e=>new Response(e,{headers:{"Content-Type":"text/javascript"}}).text())).then((t=>{const s=`executedScript${n}`,a="scriptExecuted";let c=t;c+=`\n const event = new Event('${a}');\n document.getElementById('${s}').dispatchEvent(event);\n `,Object.keys(e).length,postMessage({value:c,id:s,event:a})}))}))};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const t=(t,e)=>t-e,e=(t,e)=>t+e,r=(t,e)=>t%e>1?t-1:-1,n=(t,e)=>(t+1)%e>=0?t+1:-1,a=(e,n)=>r(t(e,n),n),s=(e,r)=>n(t(e,r),r),o=(t,n)=>r(e(t,n),n),c=(t,r)=>n(e(t,r),r),h=(h,i)=>[a,t,s,n,c,e,o,r].map((t=>t(h,i))),d=(t,e)=>{const r=[],n=[],a=t.length;let s,o=0;const c=()=>{const s=e=>e>0&&0!==t[e]&&e<a;for(;r.length;){const a=r.pop();if(!a)break;t[a]=0,n[o].add(a),h(a,e).forEach((t=>{s(t)&&r.push(t)}))}};for(s=0;s<a;s+=1)0!==t[s]&&(n[o]=new Set,r.push(s),c(),o+=1);return n},i=.3,l=(t,e)=>Math.floor(t/e),u=(t,e)=>{return[(r=t,n=e,r%n),l(t,e)];var r,n},m=t=>null!=t,g=(t,e,r)=>{const n=((t,e=120)=>{const r=t.width*t.height,n=new Uint8ClampedArray(r);let a,s=0,o=0,c=0,h=0;for(a=0;a<r;a+=1){const r=a<<2;s=t.data[r+0],o=t.data[r+1],c=t.data[r+2],h=77*s+151*o+28*c>>8,h<e&&(n[a]=1)}return n})(t);return(({segments:t,width:e,scaleWidth:r,scaleHeight:n})=>t.map((t=>{let a=Number.MAX_VALUE,s=Number.MAX_VALUE,o=Number.MIN_VALUE,c=Number.MIN_VALUE;for(const r of t){const t=u(r,e);t[0]<a&&(a=t[0]),t[1]<s&&(s=t[1]),t[0]>o&&(o=t[0]),t[1]>c&&(c=t[1])}const h=(o-a)*(c-s);return h>5&&h<500?{perimeter:h,x1:Math.trunc(a/i/r),y1:Math.trunc(s/i/n),x2:Math.trunc(o/i/r),y2:Math.trunc(c/i/n)}:null})).filter(m))({segments:d(n,t.width),width:t.width,scaleWidth:e,scaleHeight:r})};onmessage=({data:t})=>{const e=g(t.iData,t.resizedToBorderScaleWidth,t.resizedToBorderScaleHeight);postMessage({segments:e})};
|