@uziee/document-scanner 1.1.7 → 1.1.8
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 +39 -6
- package/dist/index.es.js +713 -538
- package/dist/index.umd.js +11 -11
- package/dist/style.css +1 -0
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import Ye, { useRef as Q, useState as
|
|
2
|
-
var
|
|
1
|
+
import Ye, { useRef as Q, useState as te, useEffect as gt } from "react";
|
|
2
|
+
var me = { exports: {} }, Z = {};
|
|
3
3
|
/**
|
|
4
4
|
* @license React
|
|
5
5
|
* react-jsx-runtime.production.min.js
|
|
@@ -9,23 +9,23 @@ var ge = { exports: {} }, Z = {};
|
|
|
9
9
|
* This source code is licensed under the MIT license found in the
|
|
10
10
|
* LICENSE file in the root directory of this source tree.
|
|
11
11
|
*/
|
|
12
|
-
var
|
|
13
|
-
function
|
|
14
|
-
if (
|
|
12
|
+
var Ae;
|
|
13
|
+
function mt() {
|
|
14
|
+
if (Ae)
|
|
15
15
|
return Z;
|
|
16
|
-
|
|
17
|
-
var
|
|
18
|
-
function u(
|
|
19
|
-
var s,
|
|
20
|
-
b !== void 0 && (
|
|
21
|
-
for (s in
|
|
22
|
-
|
|
23
|
-
if (
|
|
24
|
-
for (s in
|
|
25
|
-
|
|
26
|
-
return { $$typeof:
|
|
16
|
+
Ae = 1;
|
|
17
|
+
var D = Ye, i = Symbol.for("react.element"), n = Symbol.for("react.fragment"), l = Object.prototype.hasOwnProperty, c = D.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, x = { key: !0, ref: !0, __self: !0, __source: !0 };
|
|
18
|
+
function u(f, a, b) {
|
|
19
|
+
var s, h = {}, p = null, g = null;
|
|
20
|
+
b !== void 0 && (p = "" + b), a.key !== void 0 && (p = "" + a.key), a.ref !== void 0 && (g = a.ref);
|
|
21
|
+
for (s in a)
|
|
22
|
+
l.call(a, s) && !x.hasOwnProperty(s) && (h[s] = a[s]);
|
|
23
|
+
if (f && f.defaultProps)
|
|
24
|
+
for (s in a = f.defaultProps, a)
|
|
25
|
+
h[s] === void 0 && (h[s] = a[s]);
|
|
26
|
+
return { $$typeof: i, type: f, key: p, ref: g, props: h, _owner: c.current };
|
|
27
27
|
}
|
|
28
|
-
return Z.Fragment =
|
|
28
|
+
return Z.Fragment = n, Z.jsx = u, Z.jsxs = u, Z;
|
|
29
29
|
}
|
|
30
30
|
var ee = {};
|
|
31
31
|
/**
|
|
@@ -37,66 +37,66 @@ var ee = {};
|
|
|
37
37
|
* This source code is licensed under the MIT license found in the
|
|
38
38
|
* LICENSE file in the root directory of this source tree.
|
|
39
39
|
*/
|
|
40
|
-
var
|
|
41
|
-
function
|
|
42
|
-
return
|
|
43
|
-
var
|
|
44
|
-
function
|
|
40
|
+
var We;
|
|
41
|
+
function xt() {
|
|
42
|
+
return We || (We = 1, {}.NODE_ENV !== "production" && function() {
|
|
43
|
+
var D = Ye, i = Symbol.for("react.element"), n = Symbol.for("react.portal"), l = Symbol.for("react.fragment"), c = Symbol.for("react.strict_mode"), x = Symbol.for("react.profiler"), u = Symbol.for("react.provider"), f = Symbol.for("react.context"), a = Symbol.for("react.forward_ref"), b = Symbol.for("react.suspense"), s = Symbol.for("react.suspense_list"), h = Symbol.for("react.memo"), p = Symbol.for("react.lazy"), g = Symbol.for("react.offscreen"), R = Symbol.iterator, O = "@@iterator";
|
|
44
|
+
function S(e) {
|
|
45
45
|
if (e === null || typeof e != "object")
|
|
46
46
|
return null;
|
|
47
|
-
var t =
|
|
47
|
+
var t = R && e[R] || e[O];
|
|
48
48
|
return typeof t == "function" ? t : null;
|
|
49
49
|
}
|
|
50
|
-
var v =
|
|
51
|
-
function
|
|
50
|
+
var v = D.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
51
|
+
function d(e) {
|
|
52
52
|
{
|
|
53
|
-
for (var t = arguments.length,
|
|
54
|
-
|
|
55
|
-
C("error", e,
|
|
53
|
+
for (var t = arguments.length, o = new Array(t > 1 ? t - 1 : 0), m = 1; m < t; m++)
|
|
54
|
+
o[m - 1] = arguments[m];
|
|
55
|
+
C("error", e, o);
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
|
-
function C(e, t,
|
|
58
|
+
function C(e, t, o) {
|
|
59
59
|
{
|
|
60
|
-
var
|
|
61
|
-
|
|
62
|
-
var
|
|
63
|
-
return String(
|
|
60
|
+
var m = v.ReactDebugCurrentFrame, w = m.getStackAddendum();
|
|
61
|
+
w !== "" && (t += "%s", o = o.concat([w]));
|
|
62
|
+
var E = o.map(function(j) {
|
|
63
|
+
return String(j);
|
|
64
64
|
});
|
|
65
|
-
|
|
65
|
+
E.unshift("Warning: " + t), Function.prototype.apply.call(console[e], console, E);
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
|
-
var
|
|
69
|
-
|
|
70
|
-
function
|
|
71
|
-
return !!(typeof e == "string" || typeof e == "function" || e ===
|
|
68
|
+
var M = !1, N = !1, L = !1, W = !1, $ = !1, z;
|
|
69
|
+
z = Symbol.for("react.module.reference");
|
|
70
|
+
function ie(e) {
|
|
71
|
+
return !!(typeof e == "string" || typeof e == "function" || e === l || e === x || $ || e === c || e === b || e === s || W || e === g || M || N || L || typeof e == "object" && e !== null && (e.$$typeof === p || e.$$typeof === h || e.$$typeof === u || e.$$typeof === f || e.$$typeof === a || // This needs to include all possible module reference object
|
|
72
72
|
// types supported by any Flight configuration anywhere since
|
|
73
73
|
// we don't know which Flight build this will end up being used
|
|
74
74
|
// with.
|
|
75
|
-
e.$$typeof ===
|
|
75
|
+
e.$$typeof === z || e.getModuleId !== void 0));
|
|
76
76
|
}
|
|
77
|
-
function
|
|
78
|
-
var
|
|
79
|
-
if (
|
|
80
|
-
return
|
|
81
|
-
var
|
|
82
|
-
return
|
|
77
|
+
function Y(e, t, o) {
|
|
78
|
+
var m = e.displayName;
|
|
79
|
+
if (m)
|
|
80
|
+
return m;
|
|
81
|
+
var w = t.displayName || t.name || "";
|
|
82
|
+
return w !== "" ? o + "(" + w + ")" : o;
|
|
83
83
|
}
|
|
84
|
-
function
|
|
84
|
+
function B(e) {
|
|
85
85
|
return e.displayName || "Context";
|
|
86
86
|
}
|
|
87
|
-
function
|
|
87
|
+
function T(e) {
|
|
88
88
|
if (e == null)
|
|
89
89
|
return null;
|
|
90
|
-
if (typeof e.tag == "number" &&
|
|
90
|
+
if (typeof e.tag == "number" && d("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof e == "function")
|
|
91
91
|
return e.displayName || e.name || null;
|
|
92
92
|
if (typeof e == "string")
|
|
93
93
|
return e;
|
|
94
94
|
switch (e) {
|
|
95
|
-
case
|
|
95
|
+
case l:
|
|
96
96
|
return "Fragment";
|
|
97
|
-
case
|
|
97
|
+
case n:
|
|
98
98
|
return "Portal";
|
|
99
|
-
case
|
|
99
|
+
case x:
|
|
100
100
|
return "Profiler";
|
|
101
101
|
case c:
|
|
102
102
|
return "StrictMode";
|
|
@@ -107,21 +107,21 @@ function pt() {
|
|
|
107
107
|
}
|
|
108
108
|
if (typeof e == "object")
|
|
109
109
|
switch (e.$$typeof) {
|
|
110
|
-
case
|
|
110
|
+
case f:
|
|
111
111
|
var t = e;
|
|
112
|
-
return
|
|
112
|
+
return B(t) + ".Consumer";
|
|
113
113
|
case u:
|
|
114
|
-
var
|
|
115
|
-
return
|
|
116
|
-
case
|
|
117
|
-
return
|
|
118
|
-
case
|
|
119
|
-
var
|
|
120
|
-
return
|
|
121
|
-
case
|
|
122
|
-
var
|
|
114
|
+
var o = e;
|
|
115
|
+
return B(o._context) + ".Provider";
|
|
116
|
+
case a:
|
|
117
|
+
return Y(e, e.render, "ForwardRef");
|
|
118
|
+
case h:
|
|
119
|
+
var m = e.displayName || null;
|
|
120
|
+
return m !== null ? m : T(e.type) || "Memo";
|
|
121
|
+
case p: {
|
|
122
|
+
var w = e, E = w._payload, j = w._init;
|
|
123
123
|
try {
|
|
124
|
-
return
|
|
124
|
+
return T(j(E));
|
|
125
125
|
} catch {
|
|
126
126
|
return null;
|
|
127
127
|
}
|
|
@@ -129,14 +129,14 @@ function pt() {
|
|
|
129
129
|
}
|
|
130
130
|
return null;
|
|
131
131
|
}
|
|
132
|
-
var
|
|
132
|
+
var P = Object.assign, V = 0, re, U, q, xe, be, ye, je;
|
|
133
133
|
function Ce() {
|
|
134
134
|
}
|
|
135
135
|
Ce.__reactDisabledLog = !0;
|
|
136
|
-
function
|
|
136
|
+
function Be() {
|
|
137
137
|
{
|
|
138
138
|
if (V === 0) {
|
|
139
|
-
|
|
139
|
+
re = console.log, U = console.info, q = console.warn, xe = console.error, be = console.group, ye = console.groupCollapsed, je = console.groupEnd;
|
|
140
140
|
var e = {
|
|
141
141
|
configurable: !0,
|
|
142
142
|
enumerable: !0,
|
|
@@ -156,7 +156,7 @@ function pt() {
|
|
|
156
156
|
V++;
|
|
157
157
|
}
|
|
158
158
|
}
|
|
159
|
-
function
|
|
159
|
+
function Ve() {
|
|
160
160
|
{
|
|
161
161
|
if (V--, V === 0) {
|
|
162
162
|
var e = {
|
|
@@ -165,324 +165,324 @@ function pt() {
|
|
|
165
165
|
writable: !0
|
|
166
166
|
};
|
|
167
167
|
Object.defineProperties(console, {
|
|
168
|
-
log:
|
|
169
|
-
value:
|
|
168
|
+
log: P({}, e, {
|
|
169
|
+
value: re
|
|
170
170
|
}),
|
|
171
|
-
info:
|
|
172
|
-
value:
|
|
171
|
+
info: P({}, e, {
|
|
172
|
+
value: U
|
|
173
173
|
}),
|
|
174
|
-
warn:
|
|
175
|
-
value:
|
|
174
|
+
warn: P({}, e, {
|
|
175
|
+
value: q
|
|
176
176
|
}),
|
|
177
|
-
error:
|
|
178
|
-
value:
|
|
177
|
+
error: P({}, e, {
|
|
178
|
+
value: xe
|
|
179
179
|
}),
|
|
180
|
-
group:
|
|
181
|
-
value:
|
|
180
|
+
group: P({}, e, {
|
|
181
|
+
value: be
|
|
182
182
|
}),
|
|
183
|
-
groupCollapsed:
|
|
184
|
-
value:
|
|
183
|
+
groupCollapsed: P({}, e, {
|
|
184
|
+
value: ye
|
|
185
185
|
}),
|
|
186
|
-
groupEnd:
|
|
187
|
-
value:
|
|
186
|
+
groupEnd: P({}, e, {
|
|
187
|
+
value: je
|
|
188
188
|
})
|
|
189
189
|
});
|
|
190
190
|
}
|
|
191
|
-
V < 0 &&
|
|
191
|
+
V < 0 && d("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
|
|
192
192
|
}
|
|
193
193
|
}
|
|
194
|
-
var
|
|
195
|
-
function
|
|
194
|
+
var le = v.ReactCurrentDispatcher, ce;
|
|
195
|
+
function ne(e, t, o) {
|
|
196
196
|
{
|
|
197
|
-
if (
|
|
197
|
+
if (ce === void 0)
|
|
198
198
|
try {
|
|
199
199
|
throw Error();
|
|
200
|
-
} catch (
|
|
201
|
-
var
|
|
202
|
-
|
|
200
|
+
} catch (w) {
|
|
201
|
+
var m = w.stack.trim().match(/\n( *(at )?)/);
|
|
202
|
+
ce = m && m[1] || "";
|
|
203
203
|
}
|
|
204
204
|
return `
|
|
205
|
-
` +
|
|
205
|
+
` + ce + e;
|
|
206
206
|
}
|
|
207
207
|
}
|
|
208
|
-
var
|
|
208
|
+
var ue = !1, oe;
|
|
209
209
|
{
|
|
210
|
-
var
|
|
211
|
-
|
|
210
|
+
var Ue = typeof WeakMap == "function" ? WeakMap : Map;
|
|
211
|
+
oe = new Ue();
|
|
212
212
|
}
|
|
213
|
-
function
|
|
214
|
-
if (!e ||
|
|
213
|
+
function we(e, t) {
|
|
214
|
+
if (!e || ue)
|
|
215
215
|
return "";
|
|
216
216
|
{
|
|
217
|
-
var
|
|
218
|
-
if (
|
|
219
|
-
return
|
|
217
|
+
var o = oe.get(e);
|
|
218
|
+
if (o !== void 0)
|
|
219
|
+
return o;
|
|
220
220
|
}
|
|
221
|
-
var
|
|
222
|
-
|
|
223
|
-
var
|
|
221
|
+
var m;
|
|
222
|
+
ue = !0;
|
|
223
|
+
var w = Error.prepareStackTrace;
|
|
224
224
|
Error.prepareStackTrace = void 0;
|
|
225
|
-
var
|
|
226
|
-
|
|
225
|
+
var E;
|
|
226
|
+
E = le.current, le.current = null, Be();
|
|
227
227
|
try {
|
|
228
228
|
if (t) {
|
|
229
|
-
var
|
|
229
|
+
var j = function() {
|
|
230
230
|
throw Error();
|
|
231
231
|
};
|
|
232
|
-
if (Object.defineProperty(
|
|
232
|
+
if (Object.defineProperty(j.prototype, "props", {
|
|
233
233
|
set: function() {
|
|
234
234
|
throw Error();
|
|
235
235
|
}
|
|
236
236
|
}), typeof Reflect == "object" && Reflect.construct) {
|
|
237
237
|
try {
|
|
238
|
-
Reflect.construct(
|
|
239
|
-
} catch (
|
|
240
|
-
|
|
238
|
+
Reflect.construct(j, []);
|
|
239
|
+
} catch (F) {
|
|
240
|
+
m = F;
|
|
241
241
|
}
|
|
242
|
-
Reflect.construct(e, [],
|
|
242
|
+
Reflect.construct(e, [], j);
|
|
243
243
|
} else {
|
|
244
244
|
try {
|
|
245
|
-
|
|
246
|
-
} catch (
|
|
247
|
-
|
|
245
|
+
j.call();
|
|
246
|
+
} catch (F) {
|
|
247
|
+
m = F;
|
|
248
248
|
}
|
|
249
|
-
e.call(
|
|
249
|
+
e.call(j.prototype);
|
|
250
250
|
}
|
|
251
251
|
} else {
|
|
252
252
|
try {
|
|
253
253
|
throw Error();
|
|
254
|
-
} catch (
|
|
255
|
-
|
|
254
|
+
} catch (F) {
|
|
255
|
+
m = F;
|
|
256
256
|
}
|
|
257
257
|
e();
|
|
258
258
|
}
|
|
259
|
-
} catch (
|
|
260
|
-
if (
|
|
261
|
-
for (var
|
|
262
|
-
`),
|
|
263
|
-
`),
|
|
264
|
-
|
|
265
|
-
for (;
|
|
266
|
-
if (
|
|
267
|
-
if (
|
|
259
|
+
} catch (F) {
|
|
260
|
+
if (F && m && typeof F.stack == "string") {
|
|
261
|
+
for (var y = F.stack.split(`
|
|
262
|
+
`), I = m.stack.split(`
|
|
263
|
+
`), _ = y.length - 1, k = I.length - 1; _ >= 1 && k >= 0 && y[_] !== I[k]; )
|
|
264
|
+
k--;
|
|
265
|
+
for (; _ >= 1 && k >= 0; _--, k--)
|
|
266
|
+
if (y[_] !== I[k]) {
|
|
267
|
+
if (_ !== 1 || k !== 1)
|
|
268
268
|
do
|
|
269
|
-
if (
|
|
270
|
-
var
|
|
271
|
-
` +
|
|
272
|
-
return e.displayName &&
|
|
269
|
+
if (_--, k--, k < 0 || y[_] !== I[k]) {
|
|
270
|
+
var A = `
|
|
271
|
+
` + y[_].replace(" at new ", " at ");
|
|
272
|
+
return e.displayName && A.includes("<anonymous>") && (A = A.replace("<anonymous>", e.displayName)), typeof e == "function" && oe.set(e, A), A;
|
|
273
273
|
}
|
|
274
|
-
while (
|
|
274
|
+
while (_ >= 1 && k >= 0);
|
|
275
275
|
break;
|
|
276
276
|
}
|
|
277
277
|
}
|
|
278
278
|
} finally {
|
|
279
|
-
|
|
279
|
+
ue = !1, le.current = E, Ve(), Error.prepareStackTrace = w;
|
|
280
280
|
}
|
|
281
|
-
var
|
|
282
|
-
return typeof e == "function" &&
|
|
281
|
+
var G = e ? e.displayName || e.name : "", H = G ? ne(G) : "";
|
|
282
|
+
return typeof e == "function" && oe.set(e, H), H;
|
|
283
283
|
}
|
|
284
|
-
function
|
|
285
|
-
return
|
|
284
|
+
function He(e, t, o) {
|
|
285
|
+
return we(e, !1);
|
|
286
286
|
}
|
|
287
|
-
function
|
|
287
|
+
function qe(e) {
|
|
288
288
|
var t = e.prototype;
|
|
289
289
|
return !!(t && t.isReactComponent);
|
|
290
290
|
}
|
|
291
|
-
function
|
|
291
|
+
function ae(e, t, o) {
|
|
292
292
|
if (e == null)
|
|
293
293
|
return "";
|
|
294
294
|
if (typeof e == "function")
|
|
295
|
-
return
|
|
295
|
+
return we(e, qe(e));
|
|
296
296
|
if (typeof e == "string")
|
|
297
|
-
return
|
|
297
|
+
return ne(e);
|
|
298
298
|
switch (e) {
|
|
299
299
|
case b:
|
|
300
|
-
return
|
|
300
|
+
return ne("Suspense");
|
|
301
301
|
case s:
|
|
302
|
-
return
|
|
302
|
+
return ne("SuspenseList");
|
|
303
303
|
}
|
|
304
304
|
if (typeof e == "object")
|
|
305
305
|
switch (e.$$typeof) {
|
|
306
|
-
case
|
|
307
|
-
return
|
|
308
|
-
case
|
|
309
|
-
return
|
|
310
|
-
case
|
|
311
|
-
var
|
|
306
|
+
case a:
|
|
307
|
+
return He(e.render);
|
|
308
|
+
case h:
|
|
309
|
+
return ae(e.type, t, o);
|
|
310
|
+
case p: {
|
|
311
|
+
var m = e, w = m._payload, E = m._init;
|
|
312
312
|
try {
|
|
313
|
-
return
|
|
313
|
+
return ae(E(w), t, o);
|
|
314
314
|
} catch {
|
|
315
315
|
}
|
|
316
316
|
}
|
|
317
317
|
}
|
|
318
318
|
return "";
|
|
319
319
|
}
|
|
320
|
-
var
|
|
321
|
-
function
|
|
320
|
+
var K = Object.prototype.hasOwnProperty, Re = {}, Ee = v.ReactDebugCurrentFrame;
|
|
321
|
+
function se(e) {
|
|
322
322
|
if (e) {
|
|
323
|
-
var t = e._owner,
|
|
324
|
-
|
|
323
|
+
var t = e._owner, o = ae(e.type, e._source, t ? t.type : null);
|
|
324
|
+
Ee.setExtraStackFrame(o);
|
|
325
325
|
} else
|
|
326
|
-
|
|
326
|
+
Ee.setExtraStackFrame(null);
|
|
327
327
|
}
|
|
328
|
-
function
|
|
328
|
+
function Je(e, t, o, m, w) {
|
|
329
329
|
{
|
|
330
|
-
var
|
|
331
|
-
for (var
|
|
332
|
-
if (
|
|
333
|
-
var
|
|
330
|
+
var E = Function.call.bind(K);
|
|
331
|
+
for (var j in e)
|
|
332
|
+
if (E(e, j)) {
|
|
333
|
+
var y = void 0;
|
|
334
334
|
try {
|
|
335
|
-
if (typeof e[
|
|
336
|
-
var
|
|
337
|
-
throw
|
|
335
|
+
if (typeof e[j] != "function") {
|
|
336
|
+
var I = Error((m || "React class") + ": " + o + " type `" + j + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof e[j] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
|
|
337
|
+
throw I.name = "Invariant Violation", I;
|
|
338
338
|
}
|
|
339
|
-
|
|
340
|
-
} catch (
|
|
341
|
-
|
|
339
|
+
y = e[j](t, j, m, o, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
|
|
340
|
+
} catch (_) {
|
|
341
|
+
y = _;
|
|
342
342
|
}
|
|
343
|
-
|
|
343
|
+
y && !(y instanceof Error) && (se(w), d("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", m || "React class", o, j, typeof y), se(null)), y instanceof Error && !(y.message in Re) && (Re[y.message] = !0, se(w), d("Failed %s type: %s", o, y.message), se(null));
|
|
344
344
|
}
|
|
345
345
|
}
|
|
346
346
|
}
|
|
347
|
-
var
|
|
348
|
-
function
|
|
349
|
-
return
|
|
347
|
+
var Ge = Array.isArray;
|
|
348
|
+
function fe(e) {
|
|
349
|
+
return Ge(e);
|
|
350
350
|
}
|
|
351
|
-
function
|
|
351
|
+
function Ke(e) {
|
|
352
352
|
{
|
|
353
|
-
var t = typeof Symbol == "function" && Symbol.toStringTag,
|
|
354
|
-
return
|
|
353
|
+
var t = typeof Symbol == "function" && Symbol.toStringTag, o = t && e[Symbol.toStringTag] || e.constructor.name || "Object";
|
|
354
|
+
return o;
|
|
355
355
|
}
|
|
356
356
|
}
|
|
357
|
-
function
|
|
357
|
+
function Xe(e) {
|
|
358
358
|
try {
|
|
359
|
-
return
|
|
359
|
+
return Se(e), !1;
|
|
360
360
|
} catch {
|
|
361
361
|
return !0;
|
|
362
362
|
}
|
|
363
363
|
}
|
|
364
|
-
function
|
|
364
|
+
function Se(e) {
|
|
365
365
|
return "" + e;
|
|
366
366
|
}
|
|
367
|
-
function
|
|
368
|
-
if (
|
|
369
|
-
return
|
|
367
|
+
function _e(e) {
|
|
368
|
+
if (Xe(e))
|
|
369
|
+
return d("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", Ke(e)), Se(e);
|
|
370
370
|
}
|
|
371
|
-
var
|
|
371
|
+
var X = v.ReactCurrentOwner, Qe = {
|
|
372
372
|
key: !0,
|
|
373
373
|
ref: !0,
|
|
374
374
|
__self: !0,
|
|
375
375
|
__source: !0
|
|
376
|
-
},
|
|
377
|
-
|
|
378
|
-
function
|
|
379
|
-
if (
|
|
376
|
+
}, ke, Te, de;
|
|
377
|
+
de = {};
|
|
378
|
+
function Ze(e) {
|
|
379
|
+
if (K.call(e, "ref")) {
|
|
380
380
|
var t = Object.getOwnPropertyDescriptor(e, "ref").get;
|
|
381
381
|
if (t && t.isReactWarning)
|
|
382
382
|
return !1;
|
|
383
383
|
}
|
|
384
384
|
return e.ref !== void 0;
|
|
385
385
|
}
|
|
386
|
-
function
|
|
387
|
-
if (
|
|
386
|
+
function et(e) {
|
|
387
|
+
if (K.call(e, "key")) {
|
|
388
388
|
var t = Object.getOwnPropertyDescriptor(e, "key").get;
|
|
389
389
|
if (t && t.isReactWarning)
|
|
390
390
|
return !1;
|
|
391
391
|
}
|
|
392
392
|
return e.key !== void 0;
|
|
393
393
|
}
|
|
394
|
-
function
|
|
395
|
-
if (typeof e.ref == "string" &&
|
|
396
|
-
var
|
|
397
|
-
|
|
394
|
+
function tt(e, t) {
|
|
395
|
+
if (typeof e.ref == "string" && X.current && t && X.current.stateNode !== t) {
|
|
396
|
+
var o = T(X.current.type);
|
|
397
|
+
de[o] || (d('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref', T(X.current.type), e.ref), de[o] = !0);
|
|
398
398
|
}
|
|
399
399
|
}
|
|
400
|
-
function
|
|
400
|
+
function rt(e, t) {
|
|
401
401
|
{
|
|
402
|
-
var
|
|
403
|
-
|
|
402
|
+
var o = function() {
|
|
403
|
+
ke || (ke = !0, d("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", t));
|
|
404
404
|
};
|
|
405
|
-
|
|
406
|
-
get:
|
|
405
|
+
o.isReactWarning = !0, Object.defineProperty(e, "key", {
|
|
406
|
+
get: o,
|
|
407
407
|
configurable: !0
|
|
408
408
|
});
|
|
409
409
|
}
|
|
410
410
|
}
|
|
411
|
-
function
|
|
411
|
+
function nt(e, t) {
|
|
412
412
|
{
|
|
413
|
-
var
|
|
414
|
-
|
|
413
|
+
var o = function() {
|
|
414
|
+
Te || (Te = !0, d("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", t));
|
|
415
415
|
};
|
|
416
|
-
|
|
417
|
-
get:
|
|
416
|
+
o.isReactWarning = !0, Object.defineProperty(e, "ref", {
|
|
417
|
+
get: o,
|
|
418
418
|
configurable: !0
|
|
419
419
|
});
|
|
420
420
|
}
|
|
421
421
|
}
|
|
422
|
-
var
|
|
423
|
-
var
|
|
422
|
+
var ot = function(e, t, o, m, w, E, j) {
|
|
423
|
+
var y = {
|
|
424
424
|
// This tag allows us to uniquely identify this as a React Element
|
|
425
|
-
$$typeof:
|
|
425
|
+
$$typeof: i,
|
|
426
426
|
// Built-in properties that belong on the element
|
|
427
427
|
type: e,
|
|
428
428
|
key: t,
|
|
429
|
-
ref:
|
|
430
|
-
props:
|
|
429
|
+
ref: o,
|
|
430
|
+
props: j,
|
|
431
431
|
// Record the component responsible for creating this element.
|
|
432
|
-
_owner:
|
|
432
|
+
_owner: E
|
|
433
433
|
};
|
|
434
|
-
return
|
|
434
|
+
return y._store = {}, Object.defineProperty(y._store, "validated", {
|
|
435
435
|
configurable: !1,
|
|
436
436
|
enumerable: !1,
|
|
437
437
|
writable: !0,
|
|
438
438
|
value: !1
|
|
439
|
-
}), Object.defineProperty(
|
|
439
|
+
}), Object.defineProperty(y, "_self", {
|
|
440
440
|
configurable: !1,
|
|
441
441
|
enumerable: !1,
|
|
442
442
|
writable: !1,
|
|
443
|
-
value:
|
|
444
|
-
}), Object.defineProperty(
|
|
443
|
+
value: m
|
|
444
|
+
}), Object.defineProperty(y, "_source", {
|
|
445
445
|
configurable: !1,
|
|
446
446
|
enumerable: !1,
|
|
447
447
|
writable: !1,
|
|
448
|
-
value:
|
|
449
|
-
}), Object.freeze && (Object.freeze(
|
|
448
|
+
value: w
|
|
449
|
+
}), Object.freeze && (Object.freeze(y.props), Object.freeze(y)), y;
|
|
450
450
|
};
|
|
451
|
-
function
|
|
451
|
+
function at(e, t, o, m, w) {
|
|
452
452
|
{
|
|
453
|
-
var
|
|
454
|
-
|
|
455
|
-
for (
|
|
456
|
-
|
|
453
|
+
var E, j = {}, y = null, I = null;
|
|
454
|
+
o !== void 0 && (_e(o), y = "" + o), et(t) && (_e(t.key), y = "" + t.key), Ze(t) && (I = t.ref, tt(t, w));
|
|
455
|
+
for (E in t)
|
|
456
|
+
K.call(t, E) && !Qe.hasOwnProperty(E) && (j[E] = t[E]);
|
|
457
457
|
if (e && e.defaultProps) {
|
|
458
|
-
var
|
|
459
|
-
for (
|
|
460
|
-
|
|
458
|
+
var _ = e.defaultProps;
|
|
459
|
+
for (E in _)
|
|
460
|
+
j[E] === void 0 && (j[E] = _[E]);
|
|
461
461
|
}
|
|
462
|
-
if (
|
|
463
|
-
var
|
|
464
|
-
|
|
462
|
+
if (y || I) {
|
|
463
|
+
var k = typeof e == "function" ? e.displayName || e.name || "Unknown" : e;
|
|
464
|
+
y && rt(j, k), I && nt(j, k);
|
|
465
465
|
}
|
|
466
|
-
return
|
|
466
|
+
return ot(e, y, I, w, m, X.current, j);
|
|
467
467
|
}
|
|
468
468
|
}
|
|
469
|
-
var
|
|
469
|
+
var he = v.ReactCurrentOwner, De = v.ReactDebugCurrentFrame;
|
|
470
470
|
function J(e) {
|
|
471
471
|
if (e) {
|
|
472
|
-
var t = e._owner,
|
|
473
|
-
|
|
472
|
+
var t = e._owner, o = ae(e.type, e._source, t ? t.type : null);
|
|
473
|
+
De.setExtraStackFrame(o);
|
|
474
474
|
} else
|
|
475
|
-
|
|
475
|
+
De.setExtraStackFrame(null);
|
|
476
476
|
}
|
|
477
|
-
var
|
|
478
|
-
|
|
477
|
+
var pe;
|
|
478
|
+
pe = !1;
|
|
479
479
|
function ve(e) {
|
|
480
|
-
return typeof e == "object" && e !== null && e.$$typeof ===
|
|
480
|
+
return typeof e == "object" && e !== null && e.$$typeof === i;
|
|
481
481
|
}
|
|
482
|
-
function
|
|
482
|
+
function Oe() {
|
|
483
483
|
{
|
|
484
|
-
if (
|
|
485
|
-
var e =
|
|
484
|
+
if (he.current) {
|
|
485
|
+
var e = T(he.current.type);
|
|
486
486
|
if (e)
|
|
487
487
|
return `
|
|
488
488
|
|
|
@@ -491,336 +491,336 @@ Check the render method of \`` + e + "`.";
|
|
|
491
491
|
return "";
|
|
492
492
|
}
|
|
493
493
|
}
|
|
494
|
-
function
|
|
494
|
+
function st(e) {
|
|
495
495
|
{
|
|
496
496
|
if (e !== void 0) {
|
|
497
|
-
var t = e.fileName.replace(/^.*[\\\/]/, ""),
|
|
497
|
+
var t = e.fileName.replace(/^.*[\\\/]/, ""), o = e.lineNumber;
|
|
498
498
|
return `
|
|
499
499
|
|
|
500
|
-
Check your code at ` + t + ":" +
|
|
500
|
+
Check your code at ` + t + ":" + o + ".";
|
|
501
501
|
}
|
|
502
502
|
return "";
|
|
503
503
|
}
|
|
504
504
|
}
|
|
505
|
-
var
|
|
506
|
-
function
|
|
505
|
+
var Me = {};
|
|
506
|
+
function it(e) {
|
|
507
507
|
{
|
|
508
|
-
var t =
|
|
508
|
+
var t = Oe();
|
|
509
509
|
if (!t) {
|
|
510
|
-
var
|
|
511
|
-
|
|
510
|
+
var o = typeof e == "string" ? e : e.displayName || e.name;
|
|
511
|
+
o && (t = `
|
|
512
512
|
|
|
513
|
-
Check the top-level render call using <` +
|
|
513
|
+
Check the top-level render call using <` + o + ">.");
|
|
514
514
|
}
|
|
515
515
|
return t;
|
|
516
516
|
}
|
|
517
517
|
}
|
|
518
|
-
function
|
|
518
|
+
function Pe(e, t) {
|
|
519
519
|
{
|
|
520
520
|
if (!e._store || e._store.validated || e.key != null)
|
|
521
521
|
return;
|
|
522
522
|
e._store.validated = !0;
|
|
523
|
-
var
|
|
524
|
-
if (
|
|
523
|
+
var o = it(t);
|
|
524
|
+
if (Me[o])
|
|
525
525
|
return;
|
|
526
|
-
|
|
527
|
-
var
|
|
528
|
-
e && e._owner && e._owner !==
|
|
526
|
+
Me[o] = !0;
|
|
527
|
+
var m = "";
|
|
528
|
+
e && e._owner && e._owner !== he.current && (m = " It was passed a child from " + T(e._owner.type) + "."), J(e), d('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', o, m), J(null);
|
|
529
529
|
}
|
|
530
530
|
}
|
|
531
531
|
function Ie(e, t) {
|
|
532
532
|
{
|
|
533
533
|
if (typeof e != "object")
|
|
534
534
|
return;
|
|
535
|
-
if (
|
|
536
|
-
for (var
|
|
537
|
-
var
|
|
538
|
-
ve(
|
|
535
|
+
if (fe(e))
|
|
536
|
+
for (var o = 0; o < e.length; o++) {
|
|
537
|
+
var m = e[o];
|
|
538
|
+
ve(m) && Pe(m, t);
|
|
539
539
|
}
|
|
540
540
|
else if (ve(e))
|
|
541
541
|
e._store && (e._store.validated = !0);
|
|
542
542
|
else if (e) {
|
|
543
|
-
var
|
|
544
|
-
if (typeof
|
|
545
|
-
for (var
|
|
546
|
-
ve(
|
|
543
|
+
var w = S(e);
|
|
544
|
+
if (typeof w == "function" && w !== e.entries)
|
|
545
|
+
for (var E = w.call(e), j; !(j = E.next()).done; )
|
|
546
|
+
ve(j.value) && Pe(j.value, t);
|
|
547
547
|
}
|
|
548
548
|
}
|
|
549
549
|
}
|
|
550
|
-
function
|
|
550
|
+
function lt(e) {
|
|
551
551
|
{
|
|
552
552
|
var t = e.type;
|
|
553
553
|
if (t == null || typeof t == "string")
|
|
554
554
|
return;
|
|
555
|
-
var
|
|
555
|
+
var o;
|
|
556
556
|
if (typeof t == "function")
|
|
557
|
-
|
|
558
|
-
else if (typeof t == "object" && (t.$$typeof ===
|
|
557
|
+
o = t.propTypes;
|
|
558
|
+
else if (typeof t == "object" && (t.$$typeof === a || // Note: Memo only checks outer props here.
|
|
559
559
|
// Inner props are checked in the reconciler.
|
|
560
|
-
t.$$typeof ===
|
|
561
|
-
|
|
560
|
+
t.$$typeof === h))
|
|
561
|
+
o = t.propTypes;
|
|
562
562
|
else
|
|
563
563
|
return;
|
|
564
|
-
if (
|
|
565
|
-
var
|
|
566
|
-
|
|
567
|
-
} else if (t.PropTypes !== void 0 && !
|
|
568
|
-
|
|
569
|
-
var
|
|
570
|
-
|
|
564
|
+
if (o) {
|
|
565
|
+
var m = T(t);
|
|
566
|
+
Je(o, e.props, "prop", m, e);
|
|
567
|
+
} else if (t.PropTypes !== void 0 && !pe) {
|
|
568
|
+
pe = !0;
|
|
569
|
+
var w = T(t);
|
|
570
|
+
d("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", w || "Unknown");
|
|
571
571
|
}
|
|
572
|
-
typeof t.getDefaultProps == "function" && !t.getDefaultProps.isReactClassApproved &&
|
|
572
|
+
typeof t.getDefaultProps == "function" && !t.getDefaultProps.isReactClassApproved && d("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
|
|
573
573
|
}
|
|
574
574
|
}
|
|
575
|
-
function
|
|
575
|
+
function ct(e) {
|
|
576
576
|
{
|
|
577
|
-
for (var t = Object.keys(e.props),
|
|
578
|
-
var
|
|
579
|
-
if (
|
|
580
|
-
J(e),
|
|
577
|
+
for (var t = Object.keys(e.props), o = 0; o < t.length; o++) {
|
|
578
|
+
var m = t[o];
|
|
579
|
+
if (m !== "children" && m !== "key") {
|
|
580
|
+
J(e), d("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", m), J(null);
|
|
581
581
|
break;
|
|
582
582
|
}
|
|
583
583
|
}
|
|
584
|
-
e.ref !== null && (J(e),
|
|
584
|
+
e.ref !== null && (J(e), d("Invalid attribute `ref` supplied to `React.Fragment`."), J(null));
|
|
585
585
|
}
|
|
586
586
|
}
|
|
587
|
-
var
|
|
588
|
-
function
|
|
587
|
+
var Fe = {};
|
|
588
|
+
function Ne(e, t, o, m, w, E) {
|
|
589
589
|
{
|
|
590
|
-
var
|
|
591
|
-
if (!
|
|
592
|
-
var
|
|
593
|
-
(e === void 0 || typeof e == "object" && e !== null && Object.keys(e).length === 0) && (
|
|
594
|
-
var
|
|
595
|
-
|
|
596
|
-
var
|
|
597
|
-
e === null ?
|
|
590
|
+
var j = ie(e);
|
|
591
|
+
if (!j) {
|
|
592
|
+
var y = "";
|
|
593
|
+
(e === void 0 || typeof e == "object" && e !== null && Object.keys(e).length === 0) && (y += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
|
|
594
|
+
var I = st(w);
|
|
595
|
+
I ? y += I : y += Oe();
|
|
596
|
+
var _;
|
|
597
|
+
e === null ? _ = "null" : fe(e) ? _ = "array" : e !== void 0 && e.$$typeof === i ? (_ = "<" + (T(e.type) || "Unknown") + " />", y = " Did you accidentally export a JSX literal instead of a component?") : _ = typeof e, d("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", _, y);
|
|
598
598
|
}
|
|
599
|
-
var
|
|
600
|
-
if (
|
|
601
|
-
return
|
|
602
|
-
if (
|
|
603
|
-
var
|
|
604
|
-
if (
|
|
605
|
-
if (
|
|
606
|
-
if (
|
|
607
|
-
for (var
|
|
608
|
-
Ie(
|
|
609
|
-
Object.freeze && Object.freeze(
|
|
599
|
+
var k = at(e, t, o, w, E);
|
|
600
|
+
if (k == null)
|
|
601
|
+
return k;
|
|
602
|
+
if (j) {
|
|
603
|
+
var A = t.children;
|
|
604
|
+
if (A !== void 0)
|
|
605
|
+
if (m)
|
|
606
|
+
if (fe(A)) {
|
|
607
|
+
for (var G = 0; G < A.length; G++)
|
|
608
|
+
Ie(A[G], e);
|
|
609
|
+
Object.freeze && Object.freeze(A);
|
|
610
610
|
} else
|
|
611
|
-
|
|
611
|
+
d("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
|
|
612
612
|
else
|
|
613
|
-
Ie(
|
|
613
|
+
Ie(A, e);
|
|
614
614
|
}
|
|
615
|
-
if (
|
|
616
|
-
var
|
|
617
|
-
return
|
|
618
|
-
}),
|
|
619
|
-
if (!
|
|
620
|
-
var
|
|
621
|
-
|
|
615
|
+
if (K.call(t, "key")) {
|
|
616
|
+
var H = T(e), F = Object.keys(t).filter(function(vt) {
|
|
617
|
+
return vt !== "key";
|
|
618
|
+
}), ge = F.length > 0 ? "{key: someKey, " + F.join(": ..., ") + ": ...}" : "{key: someKey}";
|
|
619
|
+
if (!Fe[H + ge]) {
|
|
620
|
+
var pt = F.length > 0 ? "{" + F.join(": ..., ") + ": ...}" : "{}";
|
|
621
|
+
d(`A props object containing a "key" prop is being spread into JSX:
|
|
622
622
|
let props = %s;
|
|
623
623
|
<%s {...props} />
|
|
624
624
|
React keys must be passed directly to JSX without using spread:
|
|
625
625
|
let props = %s;
|
|
626
|
-
<%s key={someKey} {...props} />`,
|
|
626
|
+
<%s key={someKey} {...props} />`, ge, H, pt, H), Fe[H + ge] = !0;
|
|
627
627
|
}
|
|
628
628
|
}
|
|
629
|
-
return e ===
|
|
629
|
+
return e === l ? ct(k) : lt(k), k;
|
|
630
630
|
}
|
|
631
631
|
}
|
|
632
|
-
function
|
|
633
|
-
return
|
|
632
|
+
function ut(e, t, o) {
|
|
633
|
+
return Ne(e, t, o, !0);
|
|
634
634
|
}
|
|
635
|
-
function
|
|
636
|
-
return
|
|
635
|
+
function ft(e, t, o) {
|
|
636
|
+
return Ne(e, t, o, !1);
|
|
637
637
|
}
|
|
638
|
-
var
|
|
639
|
-
ee.Fragment =
|
|
638
|
+
var dt = ft, ht = ut;
|
|
639
|
+
ee.Fragment = l, ee.jsx = dt, ee.jsxs = ht;
|
|
640
640
|
}()), ee;
|
|
641
641
|
}
|
|
642
|
-
({}).NODE_ENV === "production" ?
|
|
643
|
-
var
|
|
644
|
-
class
|
|
642
|
+
({}).NODE_ENV === "production" ? me.exports = mt() : me.exports = xt();
|
|
643
|
+
var r = me.exports;
|
|
644
|
+
class bt {
|
|
645
645
|
constructor() {
|
|
646
646
|
this.procCanvas = document.createElement("canvas"), this.procCtx = this.procCanvas.getContext("2d", { willReadFrequently: !0 }), this.smoothCorners = null, this.missCount = 0;
|
|
647
647
|
}
|
|
648
|
-
detect(
|
|
649
|
-
const
|
|
650
|
-
if (!
|
|
648
|
+
detect(i, n = 0.18) {
|
|
649
|
+
const l = Math.floor(i.videoWidth * n), c = Math.floor(i.videoHeight * n);
|
|
650
|
+
if (!l || !c)
|
|
651
651
|
return null;
|
|
652
|
-
this.procCanvas.width =
|
|
653
|
-
const u = this.procCtx.getImageData(0, 0,
|
|
654
|
-
this.cleanMask(
|
|
655
|
-
const
|
|
656
|
-
if (!
|
|
652
|
+
this.procCanvas.width = l, this.procCanvas.height = c, this.procCtx.drawImage(i, 0, 0, l, c);
|
|
653
|
+
const u = this.procCtx.getImageData(0, 0, l, c).data, { brightness: f, saturation: a, avgBright: b, isTexturedBackground: s } = this.analyzeImage(u, l, c), h = this.createPaperMask(u, f, a, l, c, b, s);
|
|
654
|
+
this.cleanMask(h, l, c, s);
|
|
655
|
+
const p = this.findLargestBlob(h, l, c);
|
|
656
|
+
if (!p || p.size < l * c * 0.06)
|
|
657
657
|
return this.handleMiss();
|
|
658
|
-
const
|
|
659
|
-
if (!
|
|
658
|
+
const g = this.findRegionCorners(p.pixels, l, c);
|
|
659
|
+
if (!g)
|
|
660
660
|
return this.handleMiss();
|
|
661
|
-
if (!this.validateQuad(
|
|
661
|
+
if (!this.validateQuad(g, l, c))
|
|
662
662
|
return this.handleMiss();
|
|
663
|
-
const
|
|
664
|
-
tl: [
|
|
665
|
-
tr: [
|
|
666
|
-
br: [
|
|
667
|
-
bl: [
|
|
663
|
+
const R = {
|
|
664
|
+
tl: [g.tl[0] / n, g.tl[1] / n],
|
|
665
|
+
tr: [g.tr[0] / n, g.tr[1] / n],
|
|
666
|
+
br: [g.br[0] / n, g.br[1] / n],
|
|
667
|
+
bl: [g.bl[0] / n, g.bl[1] / n]
|
|
668
668
|
};
|
|
669
|
-
return this.missCount = 0, this.smooth(
|
|
669
|
+
return this.missCount = 0, this.smooth(R);
|
|
670
670
|
}
|
|
671
|
-
analyzeImage(
|
|
672
|
-
const c = new Float32Array(
|
|
673
|
-
let u = 0,
|
|
674
|
-
for (let
|
|
675
|
-
const
|
|
676
|
-
c[
|
|
677
|
-
const v = Math.max(
|
|
678
|
-
|
|
679
|
-
}
|
|
680
|
-
const
|
|
681
|
-
return { brightness: c, saturation:
|
|
671
|
+
analyzeImage(i, n, l) {
|
|
672
|
+
const c = new Float32Array(n * l), x = new Float32Array(n * l);
|
|
673
|
+
let u = 0, f = 0;
|
|
674
|
+
for (let h = 0, p = 0; h < i.length; h += 4, p++) {
|
|
675
|
+
const g = i[h], R = i[h + 1], O = i[h + 2], S = (g + R + O) / 3;
|
|
676
|
+
c[p] = S, u += S, S > 150 && f++;
|
|
677
|
+
const v = Math.max(g, R, O), d = Math.min(g, R, O);
|
|
678
|
+
x[p] = v > 0 ? (v - d) / v : 0;
|
|
679
|
+
}
|
|
680
|
+
const a = u / (n * l), s = f / (n * l) > 0.5 || a > 160;
|
|
681
|
+
return { brightness: c, saturation: x, avgBright: a, isTexturedBackground: s };
|
|
682
682
|
}
|
|
683
|
-
createPaperMask(
|
|
684
|
-
const
|
|
683
|
+
createPaperMask(i, n, l, c, x, u, f) {
|
|
684
|
+
const a = new Uint8Array(c * x), b = f ? this.calcLocalVariance(n, c, x) : null;
|
|
685
685
|
let s;
|
|
686
|
-
|
|
687
|
-
const
|
|
688
|
-
for (let
|
|
689
|
-
const
|
|
690
|
-
if (
|
|
686
|
+
f ? s = u + 15 : s = Math.max(120, u);
|
|
687
|
+
const h = 0.3, p = f ? 400 : 9999;
|
|
688
|
+
for (let g = 0; g < c * x; g++) {
|
|
689
|
+
const R = n[g], O = l[g];
|
|
690
|
+
if (R < s || O > h)
|
|
691
691
|
continue;
|
|
692
|
-
const
|
|
693
|
-
Math.abs(v -
|
|
692
|
+
const S = g * 4, v = i[S], d = i[S + 1], C = i[S + 2];
|
|
693
|
+
Math.abs(v - d) + Math.abs(d - C) + Math.abs(v - C) > 80 || f && b && b[g] > p || (a[g] = 1);
|
|
694
694
|
}
|
|
695
|
-
return
|
|
695
|
+
return a;
|
|
696
696
|
}
|
|
697
|
-
calcLocalVariance(
|
|
698
|
-
const c = new Float32Array(
|
|
699
|
-
for (let
|
|
700
|
-
for (let
|
|
701
|
-
let b = 0, s = 0,
|
|
702
|
-
for (let
|
|
703
|
-
for (let
|
|
704
|
-
const
|
|
705
|
-
b +=
|
|
697
|
+
calcLocalVariance(i, n, l) {
|
|
698
|
+
const c = new Float32Array(n * l), u = Math.floor(3 / 2);
|
|
699
|
+
for (let f = u; f < l - u; f++)
|
|
700
|
+
for (let a = u; a < n - u; a++) {
|
|
701
|
+
let b = 0, s = 0, h = 0;
|
|
702
|
+
for (let g = -u; g <= u; g++)
|
|
703
|
+
for (let R = -u; R <= u; R++) {
|
|
704
|
+
const O = i[(f + g) * n + (a + R)];
|
|
705
|
+
b += O, s += O * O, h++;
|
|
706
706
|
}
|
|
707
|
-
const
|
|
708
|
-
c[
|
|
707
|
+
const p = b / h;
|
|
708
|
+
c[f * n + a] = s / h - p * p;
|
|
709
709
|
}
|
|
710
710
|
return c;
|
|
711
711
|
}
|
|
712
|
-
cleanMask(
|
|
713
|
-
const
|
|
714
|
-
for (let u = 0; u <
|
|
715
|
-
const
|
|
716
|
-
for (let
|
|
717
|
-
for (let b = 1; b <
|
|
718
|
-
const s =
|
|
719
|
-
|
|
712
|
+
cleanMask(i, n, l, c) {
|
|
713
|
+
const x = c ? 2 : 1;
|
|
714
|
+
for (let u = 0; u < x; u++) {
|
|
715
|
+
const f = new Uint8Array(n * l);
|
|
716
|
+
for (let a = 1; a < l - 1; a++)
|
|
717
|
+
for (let b = 1; b < n - 1; b++) {
|
|
718
|
+
const s = a * n + b;
|
|
719
|
+
i[s] && i[s - 1] && i[s + 1] && i[s - n] && i[s + n] && (f[s] = 1);
|
|
720
720
|
}
|
|
721
|
-
for (let
|
|
722
|
-
|
|
723
|
-
}
|
|
724
|
-
for (let u = 0; u <
|
|
725
|
-
const
|
|
726
|
-
for (let
|
|
727
|
-
for (let b = 1; b <
|
|
728
|
-
const s =
|
|
729
|
-
(
|
|
721
|
+
for (let a = 0; a < n * l; a++)
|
|
722
|
+
i[a] = f[a];
|
|
723
|
+
}
|
|
724
|
+
for (let u = 0; u < x; u++) {
|
|
725
|
+
const f = new Uint8Array(n * l);
|
|
726
|
+
for (let a = 1; a < l - 1; a++)
|
|
727
|
+
for (let b = 1; b < n - 1; b++) {
|
|
728
|
+
const s = a * n + b;
|
|
729
|
+
(i[s] || i[s - 1] || i[s + 1] || i[s - n] || i[s + n]) && (f[s] = 1);
|
|
730
730
|
}
|
|
731
|
-
for (let
|
|
732
|
-
|
|
731
|
+
for (let a = 0; a < n * l; a++)
|
|
732
|
+
i[a] = f[a];
|
|
733
733
|
}
|
|
734
734
|
}
|
|
735
|
-
findLargestBlob(
|
|
736
|
-
const c = new Uint8Array(
|
|
737
|
-
let
|
|
738
|
-
for (let
|
|
739
|
-
for (let
|
|
740
|
-
const b =
|
|
741
|
-
if (!
|
|
735
|
+
findLargestBlob(i, n, l) {
|
|
736
|
+
const c = new Uint8Array(n * l);
|
|
737
|
+
let x = null, u = 0;
|
|
738
|
+
for (let f = 0; f < l; f++)
|
|
739
|
+
for (let a = 0; a < n; a++) {
|
|
740
|
+
const b = f * n + a;
|
|
741
|
+
if (!i[b] || c[b])
|
|
742
742
|
continue;
|
|
743
|
-
const s = /* @__PURE__ */ new Set(),
|
|
744
|
-
for (;
|
|
745
|
-
const [
|
|
746
|
-
if (
|
|
743
|
+
const s = /* @__PURE__ */ new Set(), h = [[a, f]];
|
|
744
|
+
for (; h.length > 0; ) {
|
|
745
|
+
const [p, g] = h.pop();
|
|
746
|
+
if (p < 0 || p >= n || g < 0 || g >= l)
|
|
747
747
|
continue;
|
|
748
|
-
const
|
|
749
|
-
c[
|
|
748
|
+
const R = g * n + p;
|
|
749
|
+
c[R] || !i[R] || (c[R] = 1, s.add(R), h.push([p - 1, g], [p + 1, g], [p, g - 1], [p, g + 1]));
|
|
750
750
|
}
|
|
751
|
-
s.size > u && (u = s.size,
|
|
751
|
+
s.size > u && (u = s.size, x = { pixels: s, size: s.size });
|
|
752
752
|
}
|
|
753
|
-
return
|
|
753
|
+
return x;
|
|
754
754
|
}
|
|
755
|
-
findRegionCorners(
|
|
756
|
-
let c = 0,
|
|
757
|
-
for (const
|
|
758
|
-
const v =
|
|
759
|
-
c += v,
|
|
760
|
-
}
|
|
761
|
-
const u = c /
|
|
762
|
-
let
|
|
763
|
-
for (const
|
|
764
|
-
const v =
|
|
765
|
-
if (v <= u &&
|
|
766
|
-
const C = v +
|
|
767
|
-
C < b && (b = C,
|
|
768
|
-
}
|
|
769
|
-
if (v >= u &&
|
|
770
|
-
const C = v -
|
|
771
|
-
C >
|
|
772
|
-
}
|
|
773
|
-
if (v >= u &&
|
|
774
|
-
const C = v +
|
|
775
|
-
C >
|
|
776
|
-
}
|
|
777
|
-
if (v <= u &&
|
|
778
|
-
const C =
|
|
779
|
-
C >
|
|
780
|
-
}
|
|
781
|
-
}
|
|
782
|
-
return !
|
|
755
|
+
findRegionCorners(i, n, l) {
|
|
756
|
+
let c = 0, x = 0;
|
|
757
|
+
for (const S of i) {
|
|
758
|
+
const v = S % n, d = Math.floor(S / n);
|
|
759
|
+
c += v, x += d;
|
|
760
|
+
}
|
|
761
|
+
const u = c / i.size, f = x / i.size;
|
|
762
|
+
let a = null, b = 1 / 0, s = null, h = -1 / 0, p = null, g = -1 / 0, R = null, O = -1 / 0;
|
|
763
|
+
for (const S of i) {
|
|
764
|
+
const v = S % n, d = Math.floor(S / n);
|
|
765
|
+
if (v <= u && d <= f) {
|
|
766
|
+
const C = v + d;
|
|
767
|
+
C < b && (b = C, a = [v, d]);
|
|
768
|
+
}
|
|
769
|
+
if (v >= u && d <= f) {
|
|
770
|
+
const C = v - d;
|
|
771
|
+
C > h && (h = C, s = [v, d]);
|
|
772
|
+
}
|
|
773
|
+
if (v >= u && d >= f) {
|
|
774
|
+
const C = v + d;
|
|
775
|
+
C > g && (g = C, p = [v, d]);
|
|
776
|
+
}
|
|
777
|
+
if (v <= u && d >= f) {
|
|
778
|
+
const C = d - v;
|
|
779
|
+
C > O && (O = C, R = [v, d]);
|
|
780
|
+
}
|
|
781
|
+
}
|
|
782
|
+
return !a || !s || !p || !R ? null : { tl: a, tr: s, br: p, bl: R };
|
|
783
783
|
}
|
|
784
|
-
validateQuad(
|
|
785
|
-
const { tl: c, tr:
|
|
786
|
-
for (const
|
|
787
|
-
if (!
|
|
784
|
+
validateQuad(i, n, l) {
|
|
785
|
+
const { tl: c, tr: x, br: u, bl: f } = i;
|
|
786
|
+
for (const S of [c, x, u, f])
|
|
787
|
+
if (!S || S[0] < 0 || S[0] >= n || S[1] < 0 || S[1] >= l)
|
|
788
788
|
return !1;
|
|
789
|
-
if (c[0] >=
|
|
789
|
+
if (c[0] >= x[0] - 5 || f[0] >= u[0] - 5 || c[1] >= f[1] - 5 || x[1] >= u[1] - 5)
|
|
790
790
|
return !1;
|
|
791
|
-
const
|
|
792
|
-
if (
|
|
791
|
+
const a = Math.hypot(x[0] - c[0], x[1] - c[1]), b = Math.hypot(u[0] - f[0], u[1] - f[1]), s = Math.hypot(f[0] - c[0], f[1] - c[1]), h = Math.hypot(u[0] - x[0], u[1] - x[1]), p = (a + b) / 2, g = (s + h) / 2;
|
|
792
|
+
if (p < 10 || g < 10)
|
|
793
793
|
return !1;
|
|
794
|
-
const
|
|
795
|
-
return !(
|
|
796
|
-
(
|
|
797
|
-
) <
|
|
794
|
+
const R = p / g;
|
|
795
|
+
return !(R < 0.3 || R > 3.5 || a / b > 2.5 || b / a > 2.5 || s / h > 2.5 || h / s > 2.5 || 0.5 * Math.abs(
|
|
796
|
+
(x[0] - f[0]) * (c[1] - u[1]) - (c[0] - u[0]) * (x[1] - f[1])
|
|
797
|
+
) < n * l * 0.05);
|
|
798
798
|
}
|
|
799
|
-
smooth(
|
|
799
|
+
smooth(i) {
|
|
800
800
|
if (!this.smoothCorners)
|
|
801
|
-
return this.smoothCorners =
|
|
802
|
-
if (this.cornerDistance(this.smoothCorners,
|
|
803
|
-
return this.smoothCorners =
|
|
804
|
-
const
|
|
801
|
+
return this.smoothCorners = i, i;
|
|
802
|
+
if (this.cornerDistance(this.smoothCorners, i) > 50)
|
|
803
|
+
return this.smoothCorners = i, i;
|
|
804
|
+
const l = 0.35;
|
|
805
805
|
return this.smoothCorners = {
|
|
806
|
-
tl: this.lerp(this.smoothCorners.tl,
|
|
807
|
-
tr: this.lerp(this.smoothCorners.tr,
|
|
808
|
-
br: this.lerp(this.smoothCorners.br,
|
|
809
|
-
bl: this.lerp(this.smoothCorners.bl,
|
|
806
|
+
tl: this.lerp(this.smoothCorners.tl, i.tl, l),
|
|
807
|
+
tr: this.lerp(this.smoothCorners.tr, i.tr, l),
|
|
808
|
+
br: this.lerp(this.smoothCorners.br, i.br, l),
|
|
809
|
+
bl: this.lerp(this.smoothCorners.bl, i.bl, l)
|
|
810
810
|
}, this.smoothCorners;
|
|
811
811
|
}
|
|
812
|
-
cornerDistance(
|
|
813
|
-
let
|
|
812
|
+
cornerDistance(i, n) {
|
|
813
|
+
let l = 0;
|
|
814
814
|
for (const c of ["tl", "tr", "br", "bl"]) {
|
|
815
|
-
const
|
|
816
|
-
|
|
815
|
+
const x = i[c][0] - n[c][0], u = i[c][1] - n[c][1];
|
|
816
|
+
l += Math.sqrt(x * x + u * u);
|
|
817
817
|
}
|
|
818
|
-
return
|
|
818
|
+
return l / 4;
|
|
819
819
|
}
|
|
820
|
-
lerp(
|
|
820
|
+
lerp(i, n, l) {
|
|
821
821
|
return [
|
|
822
|
-
|
|
823
|
-
|
|
822
|
+
i[0] + l * (n[0] - i[0]),
|
|
823
|
+
i[1] + l * (n[1] - i[1])
|
|
824
824
|
];
|
|
825
825
|
}
|
|
826
826
|
handleMiss() {
|
|
@@ -830,140 +830,315 @@ class gt {
|
|
|
830
830
|
this.smoothCorners = null, this.missCount = 0;
|
|
831
831
|
}
|
|
832
832
|
}
|
|
833
|
-
const
|
|
834
|
-
const
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
let
|
|
838
|
-
async function
|
|
833
|
+
const yt = ({ onCapture: D, onClose: i }) => {
|
|
834
|
+
const n = Q(null), l = Q(null), [c, x] = te(!1), [u, f] = te(null), [a, b] = te([]), s = Q(null), h = Q(null), p = Q(0);
|
|
835
|
+
gt(() => {
|
|
836
|
+
s.current || (s.current = new bt());
|
|
837
|
+
let v = null;
|
|
838
|
+
async function d() {
|
|
839
839
|
try {
|
|
840
|
-
const
|
|
840
|
+
const M = await navigator.mediaDevices.getUserMedia({
|
|
841
841
|
video: { facingMode: "environment", width: { ideal: 1920 } }
|
|
842
842
|
});
|
|
843
|
-
|
|
844
|
-
} catch (
|
|
845
|
-
console.error("Camera access error:",
|
|
843
|
+
n.current && (n.current.srcObject = M, n.current.play(), v = requestAnimationFrame(C));
|
|
844
|
+
} catch (M) {
|
|
845
|
+
console.error("Camera access error:", M);
|
|
846
846
|
}
|
|
847
847
|
}
|
|
848
|
-
function
|
|
849
|
-
var
|
|
850
|
-
if (((
|
|
851
|
-
const
|
|
852
|
-
if (
|
|
848
|
+
function C() {
|
|
849
|
+
var M;
|
|
850
|
+
if (((M = n.current) == null ? void 0 : M.readyState) >= 2) {
|
|
851
|
+
const N = n.current, L = l.current;
|
|
852
|
+
if (!L)
|
|
853
853
|
return;
|
|
854
|
-
const
|
|
855
|
-
|
|
856
|
-
const
|
|
857
|
-
|
|
854
|
+
const W = L.getContext("2d");
|
|
855
|
+
L.width !== N.videoWidth && (L.width = N.videoWidth, L.height = N.videoHeight), W.drawImage(N, 0, 0);
|
|
856
|
+
const $ = s.current.detect(N, 0.18);
|
|
857
|
+
$ ? (h.current && g($, h.current) ? p.current = Math.min(15, p.current + 1) : p.current = 0, h.current = $, p.current > 5 && (x(!0), f($))) : (p.current = Math.max(0, p.current - 2), p.current === 0 && (h.current = null, x(!1), f(null)));
|
|
858
858
|
}
|
|
859
|
-
|
|
859
|
+
v = requestAnimationFrame(C);
|
|
860
860
|
}
|
|
861
|
-
return
|
|
862
|
-
cancelAnimationFrame(
|
|
861
|
+
return d(), () => {
|
|
862
|
+
cancelAnimationFrame(v), s.current && s.current.reset();
|
|
863
863
|
};
|
|
864
864
|
}, []);
|
|
865
|
-
const
|
|
866
|
-
const
|
|
867
|
-
if (!
|
|
865
|
+
const g = (v, d) => Math.abs(v.tl[0] - d.tl[0]) + Math.abs(v.tl[1] - d.tl[1]) < 50, R = () => {
|
|
866
|
+
const v = n.current, d = h.current;
|
|
867
|
+
if (!v || !d)
|
|
868
868
|
return;
|
|
869
|
-
const
|
|
870
|
-
|
|
871
|
-
const
|
|
872
|
-
|
|
873
|
-
const
|
|
874
|
-
for (let
|
|
875
|
-
for (let
|
|
876
|
-
const
|
|
877
|
-
z.data[
|
|
878
|
-
}
|
|
879
|
-
|
|
880
|
-
const
|
|
881
|
-
|
|
882
|
-
},
|
|
883
|
-
|
|
884
|
-
},
|
|
885
|
-
if (!
|
|
869
|
+
const C = 1240, M = 1754, N = document.createElement("canvas");
|
|
870
|
+
N.width = C, N.height = M;
|
|
871
|
+
const L = N.getContext("2d"), W = document.createElement("canvas");
|
|
872
|
+
W.width = v.videoWidth, W.height = v.videoHeight, W.getContext("2d").drawImage(v, 0, 0);
|
|
873
|
+
const $ = W.getContext("2d").getImageData(0, 0, W.width, W.height), z = L.createImageData(C, M);
|
|
874
|
+
for (let Y = 0; Y < M; Y++)
|
|
875
|
+
for (let B = 0; B < C; B++) {
|
|
876
|
+
const T = B / C, P = Y / M, V = Math.floor((1 - T) * (1 - P) * d.tl[0] + T * (1 - P) * d.tr[0] + (1 - T) * P * d.bl[0] + T * P * d.br[0]), re = Math.floor((1 - T) * (1 - P) * d.tl[1] + T * (1 - P) * d.tr[1] + (1 - T) * P * d.bl[1] + T * P * d.br[1]), U = (Y * C + B) * 4, q = (re * W.width + V) * 4;
|
|
877
|
+
z.data[U] = $.data[q], z.data[U + 1] = $.data[q + 1], z.data[U + 2] = $.data[q + 2], z.data[U + 3] = 255;
|
|
878
|
+
}
|
|
879
|
+
L.putImageData(z, 0, 0);
|
|
880
|
+
const ie = N.toDataURL("image/jpeg", 0.92);
|
|
881
|
+
b((Y) => [...Y, ie]);
|
|
882
|
+
}, O = () => {
|
|
883
|
+
a.length > 0 && D(a);
|
|
884
|
+
}, S = () => {
|
|
885
|
+
if (!u || !n.current)
|
|
886
886
|
return "";
|
|
887
|
-
const
|
|
888
|
-
return `${
|
|
887
|
+
const v = n.current.videoWidth, d = n.current.videoHeight, C = (M) => `${M[0] / v * 100},${M[1] / d * 100}`;
|
|
888
|
+
return `${C(u.tl)} ${C(u.tr)} ${C(u.br)} ${C(u.bl)}`;
|
|
889
889
|
};
|
|
890
|
-
return /* @__PURE__ */
|
|
890
|
+
return /* @__PURE__ */ r.jsxs("div", { style: {
|
|
891
891
|
position: "fixed",
|
|
892
892
|
inset: 0,
|
|
893
893
|
backgroundColor: "#000",
|
|
894
894
|
fontFamily: "system-ui, -apple-system, sans-serif",
|
|
895
895
|
overflow: "hidden"
|
|
896
896
|
}, children: [
|
|
897
|
-
/* @__PURE__ */
|
|
898
|
-
/* @__PURE__ */
|
|
899
|
-
/* @__PURE__ */
|
|
897
|
+
/* @__PURE__ */ r.jsx("video", { ref: n, style: { display: "none" }, playsInline: !0, muted: !0 }),
|
|
898
|
+
/* @__PURE__ */ r.jsx("canvas", { ref: l, style: { width: "100vw", height: "100vh", objectFit: "cover" } }),
|
|
899
|
+
/* @__PURE__ */ r.jsx(
|
|
900
900
|
"svg",
|
|
901
901
|
{
|
|
902
902
|
viewBox: "0 0 100 100",
|
|
903
903
|
preserveAspectRatio: "none",
|
|
904
904
|
style: { position: "absolute", top: 0, left: 0, width: "100%", height: "100%", pointerEvents: "none", zIndex: 10 },
|
|
905
|
-
children:
|
|
905
|
+
children: u && /* @__PURE__ */ r.jsx(
|
|
906
906
|
"polygon",
|
|
907
907
|
{
|
|
908
|
-
points:
|
|
908
|
+
points: S(),
|
|
909
909
|
fill: "rgba(0, 255, 70, 0.15)",
|
|
910
910
|
stroke: "#00FF46",
|
|
911
|
-
strokeWidth: "0.
|
|
911
|
+
strokeWidth: "0.2",
|
|
912
912
|
style: { transition: "all 0.1s ease-out" }
|
|
913
913
|
}
|
|
914
914
|
)
|
|
915
915
|
}
|
|
916
916
|
),
|
|
917
|
-
/* @__PURE__ */
|
|
918
|
-
|
|
919
|
-
|
|
917
|
+
/* @__PURE__ */ r.jsxs("div", { style: { position: "absolute", top: 0, width: "100%", padding: "40px 16px 20px", background: "linear-gradient(rgba(0,0,0,0.6), transparent)", display: "flex", alignItems: "center", justifyContent: "center", zIndex: 20 }, children: [
|
|
918
|
+
i && /* @__PURE__ */ r.jsx(
|
|
919
|
+
"button",
|
|
920
|
+
{
|
|
921
|
+
onClick: i,
|
|
922
|
+
style: {
|
|
923
|
+
position: "absolute",
|
|
924
|
+
right: "16px",
|
|
925
|
+
top: "40px",
|
|
926
|
+
width: "44px",
|
|
927
|
+
height: "44px",
|
|
928
|
+
borderRadius: "50%",
|
|
929
|
+
border: "none",
|
|
930
|
+
backgroundColor: "rgba(255,255,255,0.15)",
|
|
931
|
+
backdropFilter: "blur(8px)",
|
|
932
|
+
color: "#fff",
|
|
933
|
+
fontSize: "20px",
|
|
934
|
+
cursor: "pointer",
|
|
935
|
+
display: "flex",
|
|
936
|
+
alignItems: "center",
|
|
937
|
+
justifyContent: "center",
|
|
938
|
+
transition: "all 0.2s ease"
|
|
939
|
+
},
|
|
940
|
+
onMouseEnter: (v) => v.currentTarget.style.backgroundColor = "rgba(255,255,255,0.25)",
|
|
941
|
+
onMouseLeave: (v) => v.currentTarget.style.backgroundColor = "rgba(255,255,255,0.15)",
|
|
942
|
+
children: /* @__PURE__ */ r.jsxs("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
943
|
+
/* @__PURE__ */ r.jsx("line", { x1: "18", y1: "6", x2: "6", y2: "18" }),
|
|
944
|
+
/* @__PURE__ */ r.jsx("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
|
|
945
|
+
] })
|
|
946
|
+
}
|
|
947
|
+
),
|
|
948
|
+
/* @__PURE__ */ r.jsx("div", { style: { display: "inline-block", padding: "6px 16px", borderRadius: "20px", backgroundColor: c ? "#00FF46" : "rgba(255,255,255,0.2)", color: c ? "#000" : "#fff", fontSize: "12px", fontWeight: "bold" }, children: c ? "READY TO SCAN" : "POSITION DOCUMENT" })
|
|
949
|
+
] }),
|
|
950
|
+
/* @__PURE__ */ r.jsxs("div", { style: { position: "absolute", bottom: 0, width: "100%", height: "160px", background: "linear-gradient(transparent, rgba(0,0,0,0.8))", display: "flex", alignItems: "center", justifyContent: "space-around", zIndex: 20 }, children: [
|
|
951
|
+
/* @__PURE__ */ r.jsxs(
|
|
920
952
|
"div",
|
|
921
953
|
{
|
|
922
|
-
onClick:
|
|
954
|
+
onClick: O,
|
|
923
955
|
style: {
|
|
924
956
|
width: "64px",
|
|
925
957
|
height: "64px",
|
|
926
958
|
position: "relative",
|
|
927
|
-
cursor:
|
|
928
|
-
opacity:
|
|
959
|
+
cursor: a.length > 0 ? "pointer" : "default",
|
|
960
|
+
opacity: a.length > 0 ? 1 : 0.4,
|
|
929
961
|
transition: "transform 0.2s"
|
|
930
962
|
},
|
|
931
|
-
onMouseDown: (
|
|
932
|
-
onMouseUp: (
|
|
963
|
+
onMouseDown: (v) => a.length > 0 && (v.currentTarget.style.transform = "scale(0.9)"),
|
|
964
|
+
onMouseUp: (v) => v.currentTarget.style.transform = "scale(1)",
|
|
933
965
|
children: [
|
|
934
|
-
|
|
935
|
-
/* @__PURE__ */
|
|
936
|
-
/* @__PURE__ */
|
|
937
|
-
] }) : /* @__PURE__ */
|
|
938
|
-
/* @__PURE__ */
|
|
966
|
+
a.length > 0 ? /* @__PURE__ */ r.jsxs(r.Fragment, { children: [
|
|
967
|
+
/* @__PURE__ */ r.jsx("img", { src: a[a.length - 1], style: { width: "100%", height: "100%", objectFit: "cover", border: "2px solid #fff", borderRadius: "4px" }, alt: "preview" }),
|
|
968
|
+
/* @__PURE__ */ r.jsx("div", { style: { position: "absolute", top: "-8px", right: "-8px", background: "#00FF46", color: "#000", width: "22px", height: "22px", borderRadius: "50%", fontSize: "12px", fontWeight: "bold", display: "flex", alignItems: "center", justifyContent: "center", border: "2px solid #000" }, children: a.length })
|
|
969
|
+
] }) : /* @__PURE__ */ r.jsx("div", { style: { width: "100%", height: "100%", borderRadius: "4px", backgroundColor: "rgba(255,255,255,0.1)", border: "1px dashed #555" } }),
|
|
970
|
+
/* @__PURE__ */ r.jsx("span", { style: { fontSize: "10px", display: "block", textAlign: "center", marginTop: "4px", color: "#fff" }, children: "DONE" })
|
|
939
971
|
]
|
|
940
972
|
}
|
|
941
973
|
),
|
|
942
|
-
/* @__PURE__ */
|
|
943
|
-
/* @__PURE__ */
|
|
974
|
+
/* @__PURE__ */ r.jsx("button", { onClick: R, disabled: !c, style: { width: "84px", height: "84px", borderRadius: "50%", border: `4px solid ${c ? "#00FF46" : "#555"}`, backgroundColor: "transparent", cursor: "pointer", display: "flex", alignItems: "center", justifyContent: "center" }, children: /* @__PURE__ */ r.jsx("div", { style: { width: "68px", height: "68px", borderRadius: "50%", backgroundColor: c ? "#fff" : "#444" } }) }),
|
|
975
|
+
/* @__PURE__ */ r.jsx("div", { style: { width: "64px" } })
|
|
944
976
|
] })
|
|
945
977
|
] });
|
|
946
978
|
};
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
979
|
+
const Le = () => /* @__PURE__ */ r.jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
980
|
+
/* @__PURE__ */ r.jsx("path", { d: "M3 7V5a2 2 0 0 1 2-2h2" }),
|
|
981
|
+
/* @__PURE__ */ r.jsx("path", { d: "M17 3h2a2 2 0 0 1 2 2v2" }),
|
|
982
|
+
/* @__PURE__ */ r.jsx("path", { d: "M21 17v2a2 2 0 0 1-2 2h-2" }),
|
|
983
|
+
/* @__PURE__ */ r.jsx("path", { d: "M7 21H5a2 2 0 0 1-2-2v-2" }),
|
|
984
|
+
/* @__PURE__ */ r.jsx("rect", { x: "7", y: "7", width: "10", height: "10", rx: "1" })
|
|
985
|
+
] }), $e = () => /* @__PURE__ */ r.jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
986
|
+
/* @__PURE__ */ r.jsx("path", { d: "M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" }),
|
|
987
|
+
/* @__PURE__ */ r.jsx("polyline", { points: "14,2 14,8 20,8" }),
|
|
988
|
+
/* @__PURE__ */ r.jsx("line", { x1: "16", y1: "13", x2: "8", y2: "13" }),
|
|
989
|
+
/* @__PURE__ */ r.jsx("line", { x1: "16", y1: "17", x2: "8", y2: "17" }),
|
|
990
|
+
/* @__PURE__ */ r.jsx("polyline", { points: "10,9 9,9 8,9" })
|
|
991
|
+
] }), jt = () => /* @__PURE__ */ r.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ r.jsx("path", { d: "M12 0C5.37 0 0 5.37 0 12c0 5.31 3.435 9.795 8.205 11.385.6.105.825-.255.825-.57 0-.285-.015-1.23-.015-2.235-3.015.555-3.795-.735-4.035-1.41-.135-.345-.72-1.41-1.23-1.695-.42-.225-1.02-.78-.015-.795.945-.015 1.62.87 1.845 1.23 1.08 1.815 2.805 1.305 3.495.99.105-.78.42-1.305.765-1.605-2.67-.3-5.46-1.335-5.46-5.925 0-1.305.465-2.385 1.23-3.225-.12-.3-.54-1.53.12-3.18 0 0 1.005-.315 3.3 1.23.96-.27 1.98-.405 3-.405s2.04.135 3 .405c2.295-1.56 3.3-1.23 3.3-1.23.66 1.65.24 2.88.12 3.18.765.84 1.23 1.905 1.23 3.225 0 4.605-2.805 5.625-5.475 5.925.435.375.81 1.095.81 2.22 0 1.605-.015 2.895-.015 3.3 0 .315.225.69.825.57A12.02 12.02 0 0 0 24 12c0-6.63-5.37-12-12-12z" }) }), Ct = () => /* @__PURE__ */ r.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ r.jsx("path", { d: "M20.447 20.452h-3.554v-5.569c0-1.328-.027-3.037-1.852-3.037-1.853 0-2.136 1.445-2.136 2.939v5.667H9.351V9h3.414v1.561h.046c.477-.9 1.637-1.85 3.37-1.85 3.601 0 4.267 2.37 4.267 5.455v6.286zM5.337 7.433a2.062 2.062 0 0 1-2.063-2.065 2.064 2.064 0 1 1 2.063 2.065zm1.782 13.019H3.555V9h3.564v11.452zM22.225 0H1.771C.792 0 0 .774 0 1.729v20.542C0 23.227.792 24 1.771 24h20.451C23.2 24 24 23.227 24 22.271V1.729C24 .774 23.2 0 22.222 0h.003z" }) }), ze = () => /* @__PURE__ */ r.jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
992
|
+
/* @__PURE__ */ r.jsx("path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" }),
|
|
993
|
+
/* @__PURE__ */ r.jsx("polyline", { points: "7 10 12 15 17 10" }),
|
|
994
|
+
/* @__PURE__ */ r.jsx("line", { x1: "12", y1: "15", x2: "12", y2: "3" })
|
|
995
|
+
] }), wt = () => /* @__PURE__ */ r.jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
996
|
+
/* @__PURE__ */ r.jsx("polyline", { points: "23 4 23 10 17 10" }),
|
|
997
|
+
/* @__PURE__ */ r.jsx("polyline", { points: "1 20 1 14 7 14" }),
|
|
998
|
+
/* @__PURE__ */ r.jsx("path", { d: "M3.51 9a9 9 0 0 1 14.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0 0 20.49 15" })
|
|
999
|
+
] });
|
|
1000
|
+
function Et() {
|
|
1001
|
+
const [D, i] = te(null), [n, l] = te(!1), c = (s) => {
|
|
1002
|
+
i(s), l(!1);
|
|
1003
|
+
}, x = () => {
|
|
1004
|
+
l(!0);
|
|
1005
|
+
}, u = () => {
|
|
1006
|
+
i(null), l(!0);
|
|
1007
|
+
}, f = (s, h) => {
|
|
1008
|
+
const p = document.createElement("a");
|
|
1009
|
+
p.href = s, p.download = `scanned-document-${h + 1}.jpg`, document.body.appendChild(p), p.click(), document.body.removeChild(p);
|
|
1010
|
+
}, a = () => {
|
|
1011
|
+
D == null || D.forEach((s, h) => {
|
|
1012
|
+
setTimeout(() => f(s, h), h * 200);
|
|
1013
|
+
});
|
|
1014
|
+
}, b = () => {
|
|
1015
|
+
l(!1);
|
|
1016
|
+
};
|
|
1017
|
+
return n ? /* @__PURE__ */ r.jsx(yt, { onCapture: c, onClose: b }) : /* @__PURE__ */ r.jsxs("div", { className: "app-container", children: [
|
|
1018
|
+
/* @__PURE__ */ r.jsx("header", { className: "header", children: /* @__PURE__ */ r.jsxs("div", { className: "header-content", children: [
|
|
1019
|
+
/* @__PURE__ */ r.jsxs("a", { href: "/", className: "logo", children: [
|
|
1020
|
+
/* @__PURE__ */ r.jsx("div", { className: "logo-icon", children: /* @__PURE__ */ r.jsx(Le, {}) }),
|
|
1021
|
+
/* @__PURE__ */ r.jsx("span", { className: "logo-text", children: "DocScanner" })
|
|
1022
|
+
] }),
|
|
1023
|
+
/* @__PURE__ */ r.jsx("span", { className: "header-badge", children: "✨ 100% Browser-based" })
|
|
1024
|
+
] }) }),
|
|
1025
|
+
/* @__PURE__ */ r.jsxs("main", { className: "main-content", children: [
|
|
1026
|
+
/* @__PURE__ */ r.jsxs("section", { className: "hero-section", children: [
|
|
1027
|
+
/* @__PURE__ */ r.jsx("h1", { className: "hero-title", children: D ? "Your Scanned Documents" : "Smart Document Scanner" }),
|
|
1028
|
+
/* @__PURE__ */ r.jsx("p", { className: "hero-subtitle", children: D ? `Successfully captured ${D.length} document${D.length > 1 ? "s" : ""}` : "Capture, enhance, and digitize your documents with precision edge detection — all in your browser" })
|
|
1029
|
+
] }),
|
|
1030
|
+
D ? /* @__PURE__ */ r.jsxs("section", { className: "results-section", children: [
|
|
1031
|
+
/* @__PURE__ */ r.jsxs("div", { className: "results-header", children: [
|
|
1032
|
+
/* @__PURE__ */ r.jsxs("h2", { className: "results-title", children: [
|
|
1033
|
+
/* @__PURE__ */ r.jsx($e, {}),
|
|
1034
|
+
/* @__PURE__ */ r.jsx("span", { children: "Scanned Documents" }),
|
|
1035
|
+
/* @__PURE__ */ r.jsx("span", { className: "results-count", children: D.length })
|
|
1036
|
+
] }),
|
|
1037
|
+
/* @__PURE__ */ r.jsxs("div", { className: "results-actions", children: [
|
|
1038
|
+
/* @__PURE__ */ r.jsxs("button", { className: "btn btn-secondary", onClick: a, children: [
|
|
1039
|
+
/* @__PURE__ */ r.jsx(ze, {}),
|
|
1040
|
+
/* @__PURE__ */ r.jsx("span", { children: "Download All" })
|
|
1041
|
+
] }),
|
|
1042
|
+
/* @__PURE__ */ r.jsxs("button", { className: "btn btn-primary", onClick: u, children: [
|
|
1043
|
+
/* @__PURE__ */ r.jsx(wt, {}),
|
|
1044
|
+
/* @__PURE__ */ r.jsx("span", { children: "Scan More" })
|
|
1045
|
+
] })
|
|
1046
|
+
] })
|
|
1047
|
+
] }),
|
|
1048
|
+
/* @__PURE__ */ r.jsx("div", { className: "results-grid", children: D.map((s, h) => /* @__PURE__ */ r.jsxs(
|
|
1049
|
+
"article",
|
|
1050
|
+
{
|
|
1051
|
+
className: "result-card animate-fade-in",
|
|
1052
|
+
style: { animationDelay: `${h * 0.1}s` },
|
|
1053
|
+
children: [
|
|
1054
|
+
/* @__PURE__ */ r.jsxs("span", { className: "result-card-number", children: [
|
|
1055
|
+
"#",
|
|
1056
|
+
h + 1
|
|
1057
|
+
] }),
|
|
1058
|
+
/* @__PURE__ */ r.jsx(
|
|
1059
|
+
"img",
|
|
1060
|
+
{
|
|
1061
|
+
src: s,
|
|
1062
|
+
alt: `Scanned document ${h + 1}`,
|
|
1063
|
+
className: "result-card-image"
|
|
1064
|
+
}
|
|
1065
|
+
),
|
|
1066
|
+
/* @__PURE__ */ r.jsx("div", { className: "result-card-overlay" }),
|
|
1067
|
+
/* @__PURE__ */ r.jsx("div", { className: "result-card-actions", children: /* @__PURE__ */ r.jsx(
|
|
1068
|
+
"button",
|
|
1069
|
+
{
|
|
1070
|
+
className: "btn btn-icon",
|
|
1071
|
+
onClick: (p) => {
|
|
1072
|
+
p.stopPropagation(), f(s, h);
|
|
1073
|
+
},
|
|
1074
|
+
title: "Download",
|
|
1075
|
+
children: /* @__PURE__ */ r.jsx(ze, {})
|
|
1076
|
+
}
|
|
1077
|
+
) })
|
|
1078
|
+
]
|
|
1079
|
+
},
|
|
1080
|
+
h
|
|
1081
|
+
)) })
|
|
1082
|
+
] }) : /* @__PURE__ */ r.jsxs("section", { className: "empty-state animate-fade-in", children: [
|
|
1083
|
+
/* @__PURE__ */ r.jsx("div", { className: "empty-state-icon", children: /* @__PURE__ */ r.jsx($e, {}) }),
|
|
1084
|
+
/* @__PURE__ */ r.jsx("h3", { className: "empty-state-title", children: "No Documents Scanned Yet" }),
|
|
1085
|
+
/* @__PURE__ */ r.jsx("p", { className: "empty-state-text", children: "Start scanning to capture and enhance your documents instantly" }),
|
|
1086
|
+
/* @__PURE__ */ r.jsxs("button", { className: "btn btn-primary", onClick: x, children: [
|
|
1087
|
+
/* @__PURE__ */ r.jsx(Le, {}),
|
|
1088
|
+
" Start Scanning"
|
|
1089
|
+
] })
|
|
1090
|
+
] })
|
|
1091
|
+
] }),
|
|
1092
|
+
/* @__PURE__ */ r.jsx("footer", { className: "footer", children: /* @__PURE__ */ r.jsxs("div", { className: "footer-content", children: [
|
|
1093
|
+
/* @__PURE__ */ r.jsxs("div", { className: "footer-links", children: [
|
|
1094
|
+
/* @__PURE__ */ r.jsxs(
|
|
1095
|
+
"a",
|
|
1096
|
+
{
|
|
1097
|
+
href: "https://github.com/uzair2244/document-scanner",
|
|
1098
|
+
target: "_blank",
|
|
1099
|
+
rel: "noopener noreferrer",
|
|
1100
|
+
className: "footer-link",
|
|
1101
|
+
children: [
|
|
1102
|
+
/* @__PURE__ */ r.jsx(jt, {}),
|
|
1103
|
+
/* @__PURE__ */ r.jsx("span", { children: "View on GitHub" })
|
|
1104
|
+
]
|
|
1105
|
+
}
|
|
1106
|
+
),
|
|
1107
|
+
/* @__PURE__ */ r.jsxs(
|
|
1108
|
+
"a",
|
|
1109
|
+
{
|
|
1110
|
+
href: "https://www.linkedin.com/in/muhammad-uzair-shahid-rao/",
|
|
1111
|
+
target: "_blank",
|
|
1112
|
+
rel: "noopener noreferrer",
|
|
1113
|
+
className: "footer-link",
|
|
1114
|
+
children: [
|
|
1115
|
+
/* @__PURE__ */ r.jsx(Ct, {}),
|
|
1116
|
+
/* @__PURE__ */ r.jsx("span", { children: "Connect on LinkedIn" })
|
|
1117
|
+
]
|
|
1118
|
+
}
|
|
1119
|
+
)
|
|
1120
|
+
] }),
|
|
1121
|
+
/* @__PURE__ */ r.jsxs("p", { className: "footer-text", children: [
|
|
1122
|
+
"Built with ❤️ by",
|
|
1123
|
+
" ",
|
|
1124
|
+
/* @__PURE__ */ r.jsx(
|
|
1125
|
+
"a",
|
|
1126
|
+
{
|
|
1127
|
+
href: "https://www.linkedin.com/in/muhammad-uzair-shahid-rao/",
|
|
1128
|
+
target: "_blank",
|
|
1129
|
+
rel: "noopener noreferrer",
|
|
1130
|
+
children: "Muhammad Uzair Shahid Rao"
|
|
1131
|
+
}
|
|
1132
|
+
),
|
|
1133
|
+
" ",
|
|
1134
|
+
"• © ",
|
|
1135
|
+
(/* @__PURE__ */ new Date()).getFullYear(),
|
|
1136
|
+
" DocScanner"
|
|
1137
|
+
] })
|
|
1138
|
+
] }) })
|
|
964
1139
|
] });
|
|
965
1140
|
}
|
|
966
1141
|
export {
|
|
967
|
-
|
|
968
|
-
|
|
1142
|
+
Et as App,
|
|
1143
|
+
yt as DocumentScanner
|
|
969
1144
|
};
|