@idscan/idvc2 2.5.3 → 2.5.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@idscan/idvc2",
3
- "version": "2.5.3",
3
+ "version": "2.5.4",
4
4
  "description": "component for the capturing documents",
5
5
  "main": "dist/idvc.js",
6
6
  "types": "dist/types/idvc.d.ts",
@@ -24,14 +24,14 @@
24
24
  "lint": "eslint ./src"
25
25
  },
26
26
  "devDependencies": {
27
- "@swc/core": "^1.3.56",
28
- "@typescript-eslint/eslint-plugin": "^5.59.2",
29
- "@typescript-eslint/parser": "^5.59.2",
27
+ "@swc/core": "^1.3.59",
28
+ "@typescript-eslint/eslint-plugin": "^5.59.6",
29
+ "@typescript-eslint/parser": "^5.59.6",
30
30
  "acorn": "^8.8.2",
31
31
  "args-parser": "^1.3.0",
32
32
  "copy-webpack-plugin": "^11.0.0",
33
- "css-loader": "^6.7.1",
34
- "eslint": "8.39.0",
33
+ "css-loader": "^6.7.4",
34
+ "eslint": "^8.41.0",
35
35
  "eslint-config-airbnb-base": "^15.0.0",
36
36
  "eslint-config-airbnb-typescript": "^17.0.0",
37
37
  "eslint-plugin-import": "^2.27.5",
@@ -42,24 +42,24 @@
42
42
  "html-loader": "^4.1.0",
43
43
  "html-webpack-plugin": "^5.5.1",
44
44
  "jest": "^29.5.0",
45
- "jsdom": "^21.1.1",
46
- "mini-css-extract-plugin": "^2.7.5",
45
+ "jsdom": "^22.0.0",
46
+ "mini-css-extract-plugin": "^2.7.6",
47
47
  "sass": "^1.62.0",
48
48
  "sass-loader": "^13.2.1",
49
49
  "string-replace-loader": "^3.1.0",
50
50
  "swc-loader": "^0.2.3",
51
51
  "swc-minify-webpack-plugin": "^2.0.0",
52
52
  "typescript": "^5.0.4",
53
- "webpack": "^5.82.0",
53
+ "webpack": "^5.83.1",
54
54
  "webpack-bundle-analyzer": "^4.8.0",
55
- "webpack-cli": "^5.0.2",
56
- "webpack-dev-server": "^4.13.3",
55
+ "webpack-cli": "^5.1.1",
56
+ "webpack-dev-server": "^4.15.0",
57
57
  "webpack-merge": "^5.8.0"
58
58
  },
59
59
  "dependencies": {
60
60
  "assert": "^2.0.0",
61
61
  "buffer": "^6.0.3",
62
- "core-js": "^3.30.1",
62
+ "core-js": "^3.30.2",
63
63
  "crypto-browserify": "^3.12.0",
64
64
  "detect-browser": "^5.3.0",
65
65
  "mobile-detect": "^1.4.5",
@@ -1,216 +0,0 @@
1
- var __webpack_exports__ = {};
2
-
3
- ;// CONCATENATED MODULE: ./src/helpers/image.ts
4
- var generateFaceColorFromAngle = function(angle) {
5
- var color = Math.abs(Math.trunc(255 - angle));
6
- if (color > 200) color = 200;
7
- if (color < 50) color = 50;
8
- return "rgba(255,215,".concat(color.toString(), ",0.3)");
9
- };
10
- /**
11
- *
12
- * @param {ImageData} iData
13
- * @param {number} threshold
14
- * @return number[] - black and whited array;
15
- */ var binarize = function(iData) {
16
- var threshold = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 120;
17
- var setColor = 1;
18
- var len = iData.width * iData.height;
19
- var result = new Uint8ClampedArray(len);
20
- var i;
21
- var red = 0;
22
- var green = 0;
23
- var blue = 0;
24
- var gray = 0;
25
- for(i = 0; i < len; i += 1){
26
- // eslint-disable-next-line no-bitwise
27
- var n = i << 2; // fast version of i * 4
28
- red = iData.data[n + 0];
29
- green = iData.data[n + 1];
30
- blue = iData.data[n + 2];
31
- // eslint-disable-next-line no-bitwise
32
- gray = 77 * red + 151 * green + 28 * blue >> 8;
33
- if (gray < threshold) {
34
- result[i] = setColor;
35
- }
36
- }
37
- return result;
38
- };
39
- var topPoint = function(position, width) {
40
- return position - width;
41
- };
42
- var bottomPoint = function(position, width) {
43
- return position + width;
44
- };
45
- var leftPoint = function(position, width) {
46
- return position % width > 1 ? position - 1 : -1;
47
- };
48
- var rightPoint = function(position, width) {
49
- return (position + 1) % width >= 0 ? position + 1 : -1;
50
- };
51
- var topLeftPoint = function(position, width) {
52
- return leftPoint(topPoint(position, width), width);
53
- };
54
- var topRightPoint = function(position, width) {
55
- return rightPoint(topPoint(position, width), width);
56
- };
57
- var bottomLeftPoint = function(position, width) {
58
- return leftPoint(bottomPoint(position, width), width);
59
- };
60
- var bottomRightPoint = function(position, width) {
61
- return rightPoint(bottomPoint(position, width), width);
62
- };
63
- var getNeigbors = function(position, width) {
64
- return [
65
- topLeftPoint,
66
- topPoint,
67
- topRightPoint,
68
- rightPoint,
69
- bottomRightPoint,
70
- bottomPoint,
71
- bottomLeftPoint,
72
- leftPoint
73
- ].map(function(fn) {
74
- return fn(position, width);
75
- });
76
- };
77
- var segmentize2 = function(binarizedImg, width) {
78
- var queue = [];
79
- var segments = [];
80
- var imgLen = binarizedImg.length;
81
- var segmentIdx = 0;
82
- var pixelIdx;
83
- var search = function() {
84
- var isValidPixel = function(el) {
85
- return el > 0 && binarizedImg[el] !== 0 && el < imgLen;
86
- };
87
- while(queue.length){
88
- var centerPixelIdx = queue.pop();
89
- if (!centerPixelIdx) break;
90
- // eslint-disable-next-line no-param-reassign
91
- binarizedImg[centerPixelIdx] = 0;
92
- segments[segmentIdx].add(centerPixelIdx);
93
- getNeigbors(centerPixelIdx, width).forEach(function(el) {
94
- if (isValidPixel(el)) {
95
- queue.push(el);
96
- }
97
- });
98
- }
99
- };
100
- for(pixelIdx = 0; pixelIdx < imgLen; pixelIdx += 1){
101
- // eslint-disable-next-line no-continue
102
- if (binarizedImg[pixelIdx] === 0) continue;
103
- segments[segmentIdx] = new Set();
104
- queue.push(pixelIdx);
105
- search();
106
- segmentIdx += 1;
107
- }
108
- return segments;
109
- };
110
- var getResizedSizes = function(size, param) {
111
- var baseWidth = param.baseWidth, baseHeight = param.baseHeight;
112
- var width = size;
113
- var height = size;
114
- if (baseWidth > baseHeight) {
115
- width = size;
116
- height = width * baseHeight / baseWidth;
117
- }
118
- if (baseHeight > baseWidth) {
119
- height = size;
120
- width = height * baseWidth / baseHeight;
121
- }
122
- return {
123
- width: Math.trunc(width),
124
- height: Math.trunc(height)
125
- };
126
- };
127
- var getCrop = function(src, dst) {
128
- var srcWidth = src.width;
129
- var srcHeight = src.height;
130
- var aspectRatioSrc = srcWidth / srcHeight; // float
131
- var aspectRatioDst = dst.width / dst.height; // float
132
- var targetCrop = {
133
- x: 0,
134
- y: 0,
135
- width: dst.width,
136
- height: dst.height
137
- };
138
- if (aspectRatioSrc > aspectRatioDst) {
139
- targetCrop.height = ~~(dst.width / aspectRatioSrc);
140
- targetCrop.y = (dst.height - targetCrop.height) / 2;
141
- } else {
142
- targetCrop.width = ~~(targetCrop.height * aspectRatioSrc);
143
- targetCrop.x = (dst.width - targetCrop.width) / 2;
144
- }
145
- return targetCrop;
146
- };
147
-
148
- ;// CONCATENATED MODULE: ./src/constatnts/imageProcessing.ts
149
- var POINT_FILL_STYLE = 'rgba(255, 255, 255, 0.5)';
150
- var POINT_STROKE_STYLE = 'rgba(255, 255, 255, 0)';
151
- var SCALE_FACTOR = 0.3;
152
-
153
- ;// CONCATENATED MODULE: ./src/workers/bubbleWorker.ts
154
-
155
-
156
- var getColumn = function(d, w) {
157
- return d % w;
158
- };
159
- var getRow = function(d, w) {
160
- return Math.floor(d / w);
161
- };
162
- var createCoordFromPointIdx = function(pixelPosition, width) {
163
- return [
164
- getColumn(pixelPosition, width),
165
- getRow(pixelPosition, width)
166
- ];
167
- };
168
- var notNull = function(value) {
169
- return value !== null && value !== undefined;
170
- };
171
- var coordinateSegment = function(param) {
172
- var segments = param.segments, width = param.width, scaleWidth = param.scaleWidth, scaleHeight = param.scaleHeight;
173
- var MIN_PERIMETER = 5;
174
- var MAX_PERIMETER = 500;
175
- return segments.map(function(segment) {
176
- var minX = Number.MAX_VALUE; // ignoring case of empty list for conciseness
177
- var minY = Number.MAX_VALUE;
178
- var maxX = Number.MIN_VALUE;
179
- var maxY = Number.MIN_VALUE;
180
- segment.forEach(function(position) {
181
- var coord = createCoordFromPointIdx(position, width);
182
- if (coord[0] < minX) minX = coord[0];
183
- if (coord[1] < minY) minY = coord[1];
184
- if (coord[0] > maxX) maxX = coord[0];
185
- if (coord[1] > maxY) maxY = coord[1];
186
- });
187
- var per = (maxX - minX) * (maxY - minY);
188
- if (per > MIN_PERIMETER && per < MAX_PERIMETER) {
189
- return {
190
- perimeter: per,
191
- x1: Math.trunc(minX / SCALE_FACTOR / scaleWidth),
192
- y1: Math.trunc(minY / SCALE_FACTOR / scaleHeight),
193
- x2: Math.trunc(maxX / SCALE_FACTOR / scaleWidth),
194
- y2: Math.trunc(maxY / SCALE_FACTOR / scaleHeight)
195
- };
196
- }
197
- return null;
198
- }).filter(notNull);
199
- };
200
- var pointsProcess = function(iData, scaleWidth, scaleHeight) {
201
- var bin = binarize(iData);
202
- return coordinateSegment({
203
- segments: segmentize2(bin, iData.width),
204
- width: iData.width,
205
- scaleWidth: scaleWidth,
206
- scaleHeight: scaleHeight
207
- });
208
- };
209
- onmessage = function(param) {
210
- var data = param.data;
211
- var segments = pointsProcess(data.iData, data.resizedToBorderScaleWidth, data.resizedToBorderScaleHeight);
212
- postMessage({
213
- segments: segments
214
- });
215
- };
216
-