@authme/util 2.2.0 → 2.2.1-rc.3

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.
Files changed (66) hide show
  1. package/index.cjs +1717 -0
  2. package/index.js +1678 -0
  3. package/package.json +7 -6
  4. package/src/index.d.ts +3 -2
  5. package/src/lib/authme-error.d.ts +29 -0
  6. package/src/lib/authme-log.d.ts +1 -0
  7. package/src/lib/common/index.d.ts +7 -7
  8. package/src/lib/enum/index.d.ts +1 -0
  9. package/src/lib/enum/timeUnit.enum.d.ts +5 -0
  10. package/src/lib/shared-util.d.ts +5 -2
  11. package/src/lib/storage/index.d.ts +1 -1
  12. package/src/lib/storage/storage.d.ts +11 -11
  13. package/src/lib/version.d.ts +1 -0
  14. package/src/ui/camera.d.ts +35 -30
  15. package/src/ui/canvas/clear-canvas.d.ts +1 -1
  16. package/src/ui/canvas/get-canvas-size.d.ts +19 -19
  17. package/src/ui/canvas/index.d.ts +3 -3
  18. package/src/ui/canvas/video-to-image.d.ts +14 -14
  19. package/src/ui/element-style.d.ts +2 -2
  20. package/src/ui/error-message.d.ts +5 -5
  21. package/src/ui/icon.d.ts +3 -3
  22. package/src/ui/index.d.ts +8 -8
  23. package/src/ui/popup.d.ts +3 -3
  24. package/src/ui/sdk-loading.d.ts +2 -2
  25. package/src/ui/spinner.d.ts +2 -2
  26. package/src/ui/ui-lottie/index.d.ts +1 -1
  27. package/src/ui/ui-lottie/sdk_loading.d.ts +239 -239
  28. package/CHANGELOG.md +0 -376
  29. package/src/index.js +0 -6
  30. package/src/index.js.map +0 -1
  31. package/src/lib/common/index.js +0 -93
  32. package/src/lib/common/index.js.map +0 -1
  33. package/src/lib/shared-util.js +0 -6
  34. package/src/lib/shared-util.js.map +0 -1
  35. package/src/lib/storage/index.js +0 -5
  36. package/src/lib/storage/index.js.map +0 -1
  37. package/src/lib/storage/storage.js +0 -26
  38. package/src/lib/storage/storage.js.map +0 -1
  39. package/src/ui/camera.js +0 -143
  40. package/src/ui/camera.js.map +0 -1
  41. package/src/ui/canvas/clear-canvas.js +0 -9
  42. package/src/ui/canvas/clear-canvas.js.map +0 -1
  43. package/src/ui/canvas/get-canvas-size.js +0 -85
  44. package/src/ui/canvas/get-canvas-size.js.map +0 -1
  45. package/src/ui/canvas/index.js +0 -7
  46. package/src/ui/canvas/index.js.map +0 -1
  47. package/src/ui/canvas/video-to-image.js +0 -27
  48. package/src/ui/canvas/video-to-image.js.map +0 -1
  49. package/src/ui/element-style.js +0 -14
  50. package/src/ui/element-style.js.map +0 -1
  51. package/src/ui/error-message.js +0 -80
  52. package/src/ui/error-message.js.map +0 -1
  53. package/src/ui/icon.js +0 -8
  54. package/src/ui/icon.js.map +0 -1
  55. package/src/ui/index.js +0 -12
  56. package/src/ui/index.js.map +0 -1
  57. package/src/ui/popup.js +0 -58
  58. package/src/ui/popup.js.map +0 -1
  59. package/src/ui/sdk-loading.js +0 -33
  60. package/src/ui/sdk-loading.js.map +0 -1
  61. package/src/ui/spinner.js +0 -28
  62. package/src/ui/spinner.js.map +0 -1
  63. package/src/ui/ui-lottie/index.js +0 -5
  64. package/src/ui/ui-lottie/index.js.map +0 -1
  65. package/src/ui/ui-lottie/sdk_loading.js +0 -971
  66. package/src/ui/ui-lottie/sdk_loading.js.map +0 -1
package/index.js ADDED
@@ -0,0 +1,1678 @@
1
+ import 'core-js/modules/es.array.iterator.js';
2
+ import 'core-js/modules/es.array-buffer.slice.js';
3
+ import 'core-js/modules/es.typed-array.uint8-array.js';
4
+ import 'core-js/modules/es.typed-array.fill.js';
5
+ import 'core-js/modules/es.typed-array.set.js';
6
+ import 'core-js/modules/es.typed-array.sort.js';
7
+ import 'core-js/modules/es.typed-array.to-locale-string.js';
8
+ import 'core-js/modules/es.promise.js';
9
+ import 'core-js/modules/es.regexp.exec.js';
10
+ import 'core-js/modules/web.dom-collections.iterator.js';
11
+ import 'core-js/modules/web.url-search-params.js';
12
+ import 'core-js/modules/es.string.search.js';
13
+ import 'core-js/modules/es.string.match.js';
14
+ import 'core-js/modules/es.array.sort.js';
15
+ import 'core-js/modules/es.array.includes.js';
16
+ import 'core-js/modules/es.string.includes.js';
17
+ import lottie from 'lottie-web';
18
+ import 'core-js/modules/es.symbol.description.js';
19
+
20
+ const GLOBAL_KEY = '_AuthmeConfig';
21
+ function getItem(key) {
22
+ return window[GLOBAL_KEY][key];
23
+ }
24
+ function setItem(key, val) {
25
+ if (!window[GLOBAL_KEY]) {
26
+ window[GLOBAL_KEY] = {};
27
+ }
28
+ return window[GLOBAL_KEY][key] = val;
29
+ }
30
+ function removeItem(key) {
31
+ return delete window[GLOBAL_KEY][key];
32
+ }
33
+ function clear() {
34
+ window[GLOBAL_KEY] = {};
35
+ }
36
+ const Storage = {
37
+ getItem,
38
+ setItem,
39
+ removeItem,
40
+ clear
41
+ };
42
+
43
+ /******************************************************************************
44
+ Copyright (c) Microsoft Corporation.
45
+
46
+ Permission to use, copy, modify, and/or distribute this software for any
47
+ purpose with or without fee is hereby granted.
48
+
49
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
50
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
51
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
52
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
53
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
54
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
55
+ PERFORMANCE OF THIS SOFTWARE.
56
+ ***************************************************************************** */
57
+
58
+ function __awaiter(thisArg, _arguments, P, generator) {
59
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
60
+ return new (P || (P = Promise))(function (resolve, reject) {
61
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
62
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
63
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
64
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
65
+ });
66
+ }
67
+
68
+ function __values(o) {
69
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
70
+ if (m) return m.call(o);
71
+ if (o && typeof o.length === "number") return {
72
+ next: function () {
73
+ if (o && i >= o.length) o = void 0;
74
+ return { value: o && o[i++], done: !o };
75
+ }
76
+ };
77
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
78
+ }
79
+
80
+ function __await(v) {
81
+ return this instanceof __await ? (this.v = v, this) : new __await(v);
82
+ }
83
+
84
+ function __asyncGenerator(thisArg, _arguments, generator) {
85
+ if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
86
+ var g = generator.apply(thisArg, _arguments || []), i, q = [];
87
+ return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
88
+ function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
89
+ function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
90
+ function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
91
+ function fulfill(value) { resume("next", value); }
92
+ function reject(value) { resume("throw", value); }
93
+ function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
94
+ }
95
+
96
+ function __asyncValues(o) {
97
+ if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
98
+ var m = o[Symbol.asyncIterator], i;
99
+ return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
100
+ function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
101
+ function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
102
+ }
103
+
104
+ function dataURItoBlob(dataURI) {
105
+ // convert base64/URLEncoded data component to raw binary data held in a string
106
+ const byteString = atob(dataURI.split(',')[1]);
107
+ // separate out the mime component
108
+ const mimeString = dataURI.split(',')[0].split(':')[1].split(';')[0];
109
+ // write the bytes of the string to a typed array
110
+ const ia = new Uint8Array(byteString.length);
111
+ for (let i = 0; i < byteString.length; i++) {
112
+ ia[i] = byteString.charCodeAt(i);
113
+ }
114
+ const blob = new Blob([ia], {
115
+ type: mimeString
116
+ });
117
+ return blob;
118
+ }
119
+ function UintArrayToBlob(width, height, data, canvasEle, imageFormat) {
120
+ if (document) {
121
+ if (!canvasEle) {
122
+ canvasEle = document.createElement('canvas');
123
+ }
124
+ const ctx = canvasEle.getContext('2d');
125
+ canvasEle.height = height;
126
+ canvasEle.width = width;
127
+ if (ctx) {
128
+ const imageData = ctx.createImageData(canvasEle.width, canvasEle.height);
129
+ imageData.data.set(data);
130
+ ctx.putImageData(imageData, 0, 0);
131
+ if (imageFormat === 'png') {
132
+ return dataURItoBlob(canvasEle.toDataURL('image/png'));
133
+ } else {
134
+ return dataURItoBlob(canvasEle.toDataURL('image/jpeg', 0.85));
135
+ }
136
+ }
137
+ throw '[UintArrayToBlob] not running in browser.';
138
+ } else {
139
+ throw '[UintArrayToBlob] not running in browser.';
140
+ }
141
+ }
142
+ function waitTime(ms) {
143
+ return new Promise(res => {
144
+ setTimeout(() => {
145
+ res();
146
+ }, ms);
147
+ });
148
+ }
149
+ function retryPromiseWithCondition(promiseFactory, conditionFactory) {
150
+ return __awaiter(this, void 0, void 0, function* () {
151
+ try {
152
+ const res = yield promiseFactory();
153
+ return res;
154
+ } catch (e) {
155
+ console.error(e);
156
+ const retry = yield conditionFactory(e);
157
+ if (retry) {
158
+ return retryPromiseWithCondition(promiseFactory, conditionFactory);
159
+ } else {
160
+ throw e;
161
+ }
162
+ }
163
+ });
164
+ }
165
+ function getUserAgent() {
166
+ return `platform: ${navigator === null || navigator === void 0 ? void 0 : navigator.platform}`;
167
+ }
168
+ function isMobileOrTablet() {
169
+ return function (a) {
170
+ return !!(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(a) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw-(n|u)|c55\/|capi|ccwa|cdm-|cell|chtm|cldc|cmd-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc-s|devi|dica|dmob|do(c|p)o|ds(12|-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(-|_)|g1 u|g560|gene|gf-5|g-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd-(m|p|t)|hei-|hi(pt|ta)|hp( i|ip)|hs-c|ht(c(-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i-(20|go|ma)|i230|iac( |-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|-[a-w])|libw|lynx|m1-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|-([1-8]|c))|phil|pire|pl(ay|uc)|pn-2|po(ck|rt|se)|prox|psio|pt-g|qa-a|qc(07|12|21|32|60|-[2-7]|i-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h-|oo|p-)|sdk\/|se(c(-|0|1)|47|mc|nd|ri)|sgh-|shar|sie(-|m)|sk-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h-|v-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl-|tdg-|tel(i|m)|tim-|t-mo|to(pl|sh)|ts(70|m-|m3|m5)|tx-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas-|your|zeto|zte-/i.test(a.substr(0, 4)) || /Android|webOS|iPhone|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) || navigator.maxTouchPoints && navigator.maxTouchPoints > 2);
171
+ }(navigator.userAgent || navigator.vendor || window.opera);
172
+ }
173
+ function isMobile() {
174
+ return function (a) {
175
+ return !!(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(a) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw-(n|u)|c55\/|capi|ccwa|cdm-|cell|chtm|cldc|cmd-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc-s|devi|dica|dmob|do(c|p)o|ds(12|-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(-|_)|g1 u|g560|gene|gf-5|g-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd-(m|p|t)|hei-|hi(pt|ta)|hp( i|ip)|hs-c|ht(c(-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i-(20|go|ma)|i230|iac( |-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|-[a-w])|libw|lynx|m1-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|-([1-8]|c))|phil|pire|pl(ay|uc)|pn-2|po(ck|rt|se)|prox|psio|pt-g|qa-a|qc(07|12|21|32|60|-[2-7]|i-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h-|oo|p-)|sdk\/|se(c(-|0|1)|47|mc|nd|ri)|sgh-|shar|sie(-|m)|sk-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h-|v-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl-|tdg-|tel(i|m)|tim-|t-mo|to(pl|sh)|ts(70|m-|m3|m5)|tx-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas-|your|zeto|zte-/i.test(a.substr(0, 4)) || /Android|webOS|iPhone|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent));
176
+ }(navigator.userAgent || navigator.vendor || window.opera);
177
+ }
178
+
179
+ class AuthmeError {
180
+ constructor(code, cause = null) {
181
+ this._cause = null;
182
+ this._code = null;
183
+ this._code = code;
184
+ this._cause = cause;
185
+ }
186
+ get message() {
187
+ return '[Authme SDK Error] Code: ' + this.code;
188
+ }
189
+ setCode(code) {
190
+ this._code = code;
191
+ }
192
+ get code() {
193
+ return this._code;
194
+ }
195
+ get cause() {
196
+ return this._cause;
197
+ }
198
+ }
199
+ var ErrorCode;
200
+ (function (ErrorCode) {
201
+ // 1XX for engine
202
+ ErrorCode[ErrorCode["BROWSER_NOT_SUPPORT"] = 100] = "BROWSER_NOT_SUPPORT";
203
+ ErrorCode[ErrorCode["ENGINE_INIT_ERROR"] = 101] = "ENGINE_INIT_ERROR";
204
+ ErrorCode[ErrorCode["ENGINE_MODULE_IS_INITIALIZING"] = 102] = "ENGINE_MODULE_IS_INITIALIZING";
205
+ ErrorCode[ErrorCode["ENGINE_MODULE_INIT_ERROR"] = 103] = "ENGINE_MODULE_INIT_ERROR";
206
+ ErrorCode[ErrorCode["RECOGNITION_NOT_AVAILABLE"] = 104] = "RECOGNITION_NOT_AVAILABLE";
207
+ ErrorCode[ErrorCode["RECOGNITION_ERROR"] = 105] = "RECOGNITION_ERROR";
208
+ ErrorCode[ErrorCode["INVALID_AUTH_ERROR"] = 106] = "INVALID_AUTH_ERROR";
209
+ ErrorCode[ErrorCode["SCREEN_RESOLUTION_TOO_LOW"] = 107] = "SCREEN_RESOLUTION_TOO_LOW";
210
+ ErrorCode[ErrorCode["SCREEN_SIZE_CHANGED"] = 108] = "SCREEN_SIZE_CHANGED";
211
+ // 2 for LIVENESS
212
+ ErrorCode[ErrorCode["LIVENESS_NOT_PASSED"] = 201] = "LIVENESS_NOT_PASSED";
213
+ // 3 for ID-Recognition
214
+ ErrorCode[ErrorCode["ID_RECOGNITION_CONFIRM_INFO_ERROR"] = 301] = "ID_RECOGNITION_CONFIRM_INFO_ERROR";
215
+ ErrorCode[ErrorCode["ID_RECOGNITION_TIMEOUT"] = 302] = "ID_RECOGNITION_TIMEOUT";
216
+ // 4 for Anti-fraud
217
+ ErrorCode[ErrorCode["ID_RECOGNITION_ANTI_FRAUD_NOT_PASSED"] = 401] = "ID_RECOGNITION_ANTI_FRAUD_NOT_PASSED";
218
+ // 9 for common
219
+ ErrorCode[ErrorCode["SDK_INTERNAL_ERROR"] = 900] = "SDK_INTERNAL_ERROR";
220
+ ErrorCode[ErrorCode["NETWORK_ERROR"] = 901] = "NETWORK_ERROR";
221
+ ErrorCode[ErrorCode["HTTP_ERROR_RESPONSE"] = 902] = "HTTP_ERROR_RESPONSE";
222
+ ErrorCode[ErrorCode["USER_CANCEL"] = 903] = "USER_CANCEL";
223
+ ErrorCode[ErrorCode["CAMERA_NOT_SUPPORT"] = 904] = "CAMERA_NOT_SUPPORT";
224
+ })(ErrorCode || (ErrorCode = {}));
225
+
226
+ function debugLog(message, ...others) {
227
+ if (new URLSearchParams(location.search).get('authme-debug') === 'true') {
228
+ console.log(message, ...others);
229
+ }
230
+ }
231
+
232
+ var TIME_UNIT;
233
+ (function (TIME_UNIT) {
234
+ TIME_UNIT[TIME_UNIT["SECOND"] = 1000] = "SECOND";
235
+ TIME_UNIT[TIME_UNIT["MINUTE"] = 60000] = "MINUTE";
236
+ TIME_UNIT[TIME_UNIT["HOUR"] = 3600000] = "HOUR";
237
+ })(TIME_UNIT || (TIME_UNIT = {}));
238
+
239
+ function getImageData(canvas, ctx, video, sizeInfo, base64 = false, imageType = 'jpg') {
240
+ canvas.width = sizeInfo.canvasWidth;
241
+ canvas.height = sizeInfo.canvasHeight;
242
+ ctx.drawImage(video, sizeInfo.startX, sizeInfo.startY, sizeInfo.width, sizeInfo.height, 0, 0, sizeInfo.canvasWidth, sizeInfo.canvasHeight);
243
+ return {
244
+ data: ctx.getImageData(0, 0, sizeInfo.canvasWidth, sizeInfo.canvasHeight).data,
245
+ base64: base64 ? {
246
+ jpg: imageType === 'jpg' || imageType === 'all' ? canvas.toDataURL('image/jpeg', 0.85) : '',
247
+ png: imageType === 'png' || imageType === 'all' ? canvas.toDataURL('image/png') : ''
248
+ } : {
249
+ jpg: '',
250
+ png: ''
251
+ }
252
+ };
253
+ }
254
+
255
+ function clearCanvas(canvas) {
256
+ const ctx = canvas.getContext('2d');
257
+ ctx.clearRect(0, 0, canvas.width, canvas.height);
258
+ }
259
+
260
+ function resize(originWidth, originHeight, targetWidth, targetHeight) {
261
+ const originRatio = originWidth / originHeight;
262
+ const targetRatio = targetWidth / targetHeight;
263
+ if (originRatio > targetRatio) {
264
+ return {
265
+ width: originHeight * targetRatio,
266
+ height: originHeight,
267
+ startX: (originWidth - originHeight * targetRatio) / 2,
268
+ startY: 0
269
+ };
270
+ } else {
271
+ return {
272
+ width: originWidth,
273
+ height: originWidth * targetRatio,
274
+ startX: 0,
275
+ startY: (originHeight - originWidth * targetRatio) / 2
276
+ };
277
+ }
278
+ }
279
+ function getCanvasSize(video) {
280
+ return __awaiter(this, void 0, void 0, function* () {
281
+ let videoWidth = video.videoWidth;
282
+ let videoHeight = video.videoHeight;
283
+ while (video.videoWidth === 0 || video.videoHeight === 0) {
284
+ yield waitTime(200);
285
+ videoWidth = video.videoWidth;
286
+ videoHeight = video.videoHeight;
287
+ }
288
+ const result = {
289
+ height: 0,
290
+ width: 0,
291
+ startX: 0,
292
+ startY: 0,
293
+ canvasWidth: 0,
294
+ canvasHeight: 0
295
+ };
296
+ const windowWidth = window.innerWidth;
297
+ const windowHeight = window.innerHeight;
298
+ const videoRatio = videoWidth / videoHeight;
299
+ const windowRatio = windowWidth / windowHeight;
300
+ if (videoRatio > windowRatio) {
301
+ result.height = videoHeight;
302
+ result.width = Math.floor(videoHeight * windowRatio);
303
+ result.startX = Math.floor((videoWidth - result.width) / 2);
304
+ result.startY = 0;
305
+ } else {
306
+ result.width = videoWidth;
307
+ result.height = Math.floor(videoWidth / windowRatio);
308
+ result.startX = 0;
309
+ result.startY = Math.floor((videoHeight - result.height) / 2);
310
+ }
311
+ const maxHeight = videoHeight > videoWidth ? 1280 : 720;
312
+ const maxWidth = videoHeight > videoWidth ? 720 : 1280;
313
+ const resizeRatioH = maxHeight / Math.max(result.height, maxHeight);
314
+ const resizeRatioW = maxWidth / Math.max(result.width, maxWidth);
315
+ const resizeRatio = Math.max(resizeRatioH, resizeRatioW);
316
+ // const resizeRatio = 1;
317
+ result.canvasWidth = Math.floor(result.width * resizeRatio);
318
+ result.canvasHeight = Math.floor(result.height * resizeRatio);
319
+ return result;
320
+ });
321
+ }
322
+ function cropByRatio(width, height, ratio) {
323
+ let expectedHeight = height;
324
+ let expectedWidth = Math.floor(height * ratio);
325
+ if (expectedWidth > width) {
326
+ expectedWidth = width;
327
+ expectedHeight = Math.floor(width / ratio);
328
+ }
329
+ return {
330
+ width: expectedWidth,
331
+ height: expectedHeight
332
+ };
333
+ }
334
+
335
+ function startSpinner(text) {
336
+ const body = document.querySelector('.authme-container');
337
+ const spinnerOuter = document.createElement('div');
338
+ spinnerOuter.className = 'loading-outer';
339
+ const spinner = document.createElement('div');
340
+ spinner.className = 'loading';
341
+ const spinnerText = document.createElement('div');
342
+ spinnerOuter.appendChild(spinner);
343
+ if (text) {
344
+ spinnerText.className = 'loading-text';
345
+ spinnerText.textContent = text;
346
+ spinnerOuter.appendChild(spinnerText);
347
+ }
348
+ body === null || body === void 0 ? void 0 : body.appendChild(spinnerOuter);
349
+ }
350
+ function stopSpinner() {
351
+ const body = document.querySelector('.authme-container');
352
+ const spinner = document.querySelector('.loading-outer');
353
+ if (spinner) {
354
+ body === null || body === void 0 ? void 0 : body.removeChild(spinner);
355
+ }
356
+ }
357
+
358
+ var Icon;
359
+ (function (Icon) {
360
+ Icon["CloseIcon"] = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAALdSURBVHgBzZm/bhpBEMY/TINEgxuUEjoKpNDhzrhLid8geQDkuAopUM6ioYstXoA2lUmXVJy7hMoukOhyaWlCCqS4y3znPXJcuD97rOF+0rCnu13p0+zO7O6QQ0ra7XZLmobYqWpLyshSzFH2IGaPx2MbKcjpdBZRFHAh9tYnJimOmC12JWKdpIMSCVTCPihhJhghodB8XAcRR4+NxVowB5dEu1ar/Z7P5/dRHSMFiriP0lhiBZiHs0KRJRH5NaxTLkQYB9/CrNeioBfPZMqXwQ9HIQNs7E8c4ZTfbvvw3xSraW1j/1S2TfeGQBH3WpoBDseJCpxv3ov1GhRxFWkmYhUcFq7Dqrce/WvQwuHFES/nurgeVN77gWxxTC96HrSQPdxdyxN4Cg3K5TL6/b7bmuwbgDsY8upUorXHdrtd1Ot1NJtNTKdTrFYrRImrVquuTSYTaFCQiL6jB1vQZDgcYrFYRHrH/419OSYFjbyopPdqOqPoMXqOHqSAoCeD4nq9ntum4JEC38nDC2gSJrJYLJoSRwo5WYO/oH/4XBP0lvfOgDjippnU4ohfCIUZFEdKR8g4FLjEDgSnOC66NVnuJHBbtPqn24BIh1F8Bs00EyaObVwK0uQ7BTLFvNIZFZfnDIr8xCm+1x3V6XRiozUY3RyTAjsvp1dH7SaJb26z2czdWweDQWQq8TzJvtzqND3oyHHr0jsPWvAdEjPCSAS+8fLgNbLHFX9cger8f4PsMPLKIsE7yU5J2xAOlPfI+topwfJHguURminnGbj0l+o27sW8j4rIY3k8wWG4EXEb9/Kw2gzP5i3slwcR1wi+DDvNnCNFAt8BGyEOiSxgiieZfi7wvHBaQy9tkfVBWZNfZE3+xL8atEmYMd6LOCuqU2yFlRVQEflZHhk8DZiBOfc8SWFdt4hewVO+5EW/Aj28zeB6W6EyDC2BftSFn/YST2Jp/r8haAy0O7Zp/4b4C0A7bruoqtIMAAAAAElFTkSuQmCC";
361
+ })(Icon || (Icon = {}));
362
+
363
+ function showErrorMessage(text, showRetryBtn, callback) {
364
+ return __awaiter(this, void 0, void 0, function* () {
365
+ const target = document.querySelector('.authme-container');
366
+ if (!target) {
367
+ return;
368
+ }
369
+ const errorMessagePanel = document.createElement('div');
370
+ errorMessagePanel.className = 'error-message-panel';
371
+ const icon = document.createElement('img');
372
+ icon.className = 'error-icon';
373
+ icon.src = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAIoSURBVHgBrZY9TxRBGMdn5XwpOCRyJlZoI8HTShNfGkqNEs8GrO4z2HqFwQr9DpYWaGKuUKOJL5XxMxATTSBCAwcFHITjLcPvYf9HNhd2doF7kt/uZud5mdmZ+c9GLsW89xG3q/AURqAMJbD3DfgDX+EbTEdR5F1eI/kw1KHpY2vBAszCfz3vqM183sGVvMnHYUnBczAJt2EACnAaLsE9mJCPV9FqVvIabAkLLuboUFGdWFNcLc2xKodFGNUc5B11BE8UaznGOh0uq9F6UXHHNHVsE5bhWrL6e33HybSe875HEz8F51z6SF4qV30/F5cbWglzoW9OWz/MiP6AXx/MK+fQKd49gF54w1puuhMaOVa5vVXOcSvwEHbhh+uefYRNGLECw7AMM6579g9sJGUrcBFaKtItW4ENKFmB/BqS36I2BS5LYMvuvAuPYh1+wxk9h2xAORu2rL5LzO5kBLX3QuYOl06ZGP60T/QLzkIlI8iW3Wf4xPOFjBr3oQe+WOBQYqP1BQrc0g7dhpsBv+RGu97e3nUFTwSkoheewYuAj+V6rVxTB34mTD4+A0wJR90xTYq6prNhsLNxTEpoqlrxR5frxwm5rqY5PpfDOrwKzUkipigF3VIHa1kBVQ3Ra+JtXu76+JgsiJIta3ViXr4N33nQBIoM+vggbx/6OypqB/6snltqa2qRlA/LFQWKWJsFmZw/crEomm6ZtNhvy7SL99AH+Jv227IHljuhn5g7LqwAAAAASUVORK5CYII=';
374
+ const errorText = document.createElement('div');
375
+ errorText.className = 'error-text';
376
+ errorText.textContent = text;
377
+ errorMessagePanel.appendChild(icon);
378
+ errorMessagePanel.appendChild(errorText);
379
+ if (showRetryBtn) {
380
+ const retryText = document.createElement('div');
381
+ retryText.className = 'retry-text';
382
+ retryText.textContent = '重試';
383
+ errorMessagePanel.appendChild(retryText);
384
+ if (callback) {
385
+ retryText.addEventListener('click', e => {
386
+ target.removeChild(errorMessagePanel);
387
+ callback(e);
388
+ });
389
+ }
390
+ }
391
+ target === null || target === void 0 ? void 0 : target.appendChild(errorMessagePanel);
392
+ });
393
+ }
394
+ function hideErrorMessage() {
395
+ const body = document.querySelector('.authme-container');
396
+ const errorMessagePanel = document.querySelector('.error-message-panel');
397
+ if (body && errorMessagePanel) {
398
+ body === null || body === void 0 ? void 0 : body.removeChild(errorMessagePanel);
399
+ }
400
+ }
401
+ function asyncShowErrorMessage(text, showRetryBtn) {
402
+ return __awaiter(this, void 0, void 0, function* () {
403
+ return new Promise((res, rej) => {
404
+ const callback = () => {
405
+ res(true);
406
+ hideErrorMessage();
407
+ };
408
+ showErrorMessage(text, showRetryBtn, callback);
409
+ });
410
+ });
411
+ }
412
+ function asyncOnLineShowErrorMessage(text, showRetryBtn) {
413
+ return __awaiter(this, void 0, void 0, function* () {
414
+ return new Promise((res, rej) => {
415
+ const callback = () => {
416
+ if (window.navigator.onLine) {
417
+ res(true);
418
+ hideErrorMessage();
419
+ }
420
+ };
421
+ showErrorMessage(text, showRetryBtn, callback);
422
+ });
423
+ });
424
+ }
425
+ function checkOnlineStatus(msg) {
426
+ return __awaiter(this, void 0, void 0, function* () {
427
+ if (!window.navigator.onLine) {
428
+ yield asyncOnLineShowErrorMessage(msg, true);
429
+ }
430
+ });
431
+ }
432
+
433
+ function showPopup(title, content, showButton = true, button, callback) {
434
+ return __awaiter(this, void 0, void 0, function* () {
435
+ const target = document.querySelector('.authme-container');
436
+ const popupBackground = document.createElement('div');
437
+ popupBackground.className = 'popup-background';
438
+ const popupPanel = document.createElement('div');
439
+ popupPanel.className = 'popup-panel';
440
+ const popupTitle = document.createElement('div');
441
+ popupTitle.className = 'popup-title';
442
+ popupTitle.textContent = title;
443
+ const popupContent = document.createElement('div');
444
+ popupContent.className = 'popup-content';
445
+ popupContent.textContent = content;
446
+ const popupConfirmBtn = document.createElement('button');
447
+ popupConfirmBtn.className = 'popup-btn';
448
+ popupConfirmBtn.textContent = '確定';
449
+ popupPanel.appendChild(popupTitle);
450
+ popupPanel.appendChild(popupContent);
451
+ if (showButton) {
452
+ popupPanel.appendChild(popupConfirmBtn);
453
+ }
454
+ if (callback && showButton) {
455
+ popupConfirmBtn.addEventListener('click', callback);
456
+ }
457
+ target === null || target === void 0 ? void 0 : target.appendChild(popupPanel);
458
+ target === null || target === void 0 ? void 0 : target.appendChild(popupBackground);
459
+ });
460
+ }
461
+ function hidePopup() {
462
+ const popupPanel = document.querySelector('.popup-panel');
463
+ if (popupPanel) {
464
+ popupPanel.remove();
465
+ }
466
+ const popupBackground = document.querySelector('.popup-background');
467
+ if (popupBackground) {
468
+ popupBackground.remove();
469
+ }
470
+ }
471
+ function asyncShowPopup(title, content, showButton = true, button) {
472
+ return __awaiter(this, void 0, void 0, function* () {
473
+ return new Promise((res, rej) => {
474
+ const callback = () => {
475
+ res(true);
476
+ hidePopup();
477
+ };
478
+ showPopup(title, content, showButton, button, callback);
479
+ });
480
+ });
481
+ }
482
+
483
+ const videoConstraintsFactory = (isPC, facingMode) => {
484
+ return isPC ? {
485
+ video: {
486
+ width: {
487
+ min: 1280,
488
+ ideal: 1920,
489
+ max: 1920
490
+ },
491
+ height: {
492
+ min: 720,
493
+ ideal: 1080,
494
+ max: 1080
495
+ },
496
+ facingMode
497
+ }
498
+ } : {
499
+ video: {
500
+ width: {
501
+ ideal: 1920
502
+ },
503
+ height: {
504
+ ideal: 1080
505
+ },
506
+ facingMode
507
+ }
508
+ };
509
+ };
510
+ function inferFacingModeFromLabel(label) {
511
+ const pattern = /rear|back|rück|arrière|trasera|trás|traseira|posteriore|后|後|背|задней|الخلفية|후|arka|achterzijde|หลัง|baksidan|bagside|sau|bak|tylny|takakamera|belakang|אחורית|πίσω|spate|hátsó|zadní|darrere|zadná|задня|stražnja|belakang|बैक/i;
512
+ if (pattern.test(label !== null && label !== void 0 ? label : '')) {
513
+ return 'back';
514
+ } else {
515
+ return undefined;
516
+ }
517
+ }
518
+ function inferFacingModeFromCapabilities(capabilities) {
519
+ var _a, _b, _c, _d;
520
+ if (((_b = (_a = capabilities === null || capabilities === void 0 ? void 0 : capabilities.facingMode) === null || _a === void 0 ? void 0 : _a.indexOf('user')) !== null && _b !== void 0 ? _b : -1) >= 0) {
521
+ return 'front';
522
+ } else if (((_d = (_c = capabilities === null || capabilities === void 0 ? void 0 : capabilities.facingMode) === null || _c === void 0 ? void 0 : _c.indexOf('environment')) !== null && _d !== void 0 ? _d : -1) >= 0) {
523
+ return 'back';
524
+ } else {
525
+ return undefined;
526
+ }
527
+ }
528
+ function inferFacingModeFromMixedInfo(fromLabel, fromCapabilities) {
529
+ var _a;
530
+ return (_a = fromLabel !== null && fromLabel !== void 0 ? fromLabel : fromCapabilities) !== null && _a !== void 0 ? _a : 'front';
531
+ }
532
+ function asyncMap(mapping, items) {
533
+ return __asyncGenerator(this, arguments, function* asyncMap_1() {
534
+ for (const item of items) {
535
+ yield yield __await(yield __await(mapping(item)));
536
+ }
537
+ });
538
+ }
539
+ function arrayFromAsync(asyncIterable) {
540
+ var asyncIterable_1, asyncIterable_1_1;
541
+ var e_1, _a;
542
+ return __awaiter(this, void 0, void 0, function* () {
543
+ const result = [];
544
+ try {
545
+ for (asyncIterable_1 = __asyncValues(asyncIterable); asyncIterable_1_1 = yield asyncIterable_1.next(), !asyncIterable_1_1.done;) {
546
+ const item = asyncIterable_1_1.value;
547
+ result.push(item);
548
+ }
549
+ } catch (e_1_1) {
550
+ e_1 = {
551
+ error: e_1_1
552
+ };
553
+ } finally {
554
+ try {
555
+ if (asyncIterable_1_1 && !asyncIterable_1_1.done && (_a = asyncIterable_1.return)) yield _a.call(asyncIterable_1);
556
+ } finally {
557
+ if (e_1) throw e_1.error;
558
+ }
559
+ }
560
+ return result;
561
+ });
562
+ }
563
+ function _requestCamera(video, facingMode) {
564
+ var _a;
565
+ return __awaiter(this, void 0, void 0, function* () {
566
+ if (!('mediaDevices' in navigator)) {
567
+ throw 'NOT_SUPPORT';
568
+ }
569
+ let isSamsung = false;
570
+ if (navigator.userAgent.match(/SAMSUNG|Samsung|SGH-[I|N|T]|GT-[I|N]|SM-[A|G|N|P|T|Z|S]|SHV-E|SCH-[I|J|R|S]|SPH-L/i)) {
571
+ isSamsung = true;
572
+ }
573
+ // 必須先請求攝影機權限,才能透過 enumerateDevices 取得攝影機 Label 資訊
574
+ const media = yield navigator.mediaDevices.getUserMedia({
575
+ video: true
576
+ });
577
+ media.getTracks().forEach(function (track) {
578
+ track.stop(); // 取得後會啟用攝影機,所以要關閉
579
+ });
580
+ // 輪詢取得攝影機 解析度等資訊
581
+ const videoDevices = (yield navigator.mediaDevices.enumerateDevices()).filter(device => device.kind === 'videoinput');
582
+ const deviceMetas = yield arrayFromAsync(asyncMap(device => __awaiter(this, void 0, void 0, function* () {
583
+ var _b, _c, _d, _e;
584
+ const stream = yield navigator.mediaDevices.getUserMedia({
585
+ video: {
586
+ deviceId: {
587
+ exact: device.deviceId
588
+ }
589
+ }
590
+ });
591
+ const track = (_b = stream.getVideoTracks()) === null || _b === void 0 ? void 0 : _b[0];
592
+ const capabilities = ((_c = track === null || track === void 0 ? void 0 : track.getCapabilities) !== null && _c !== void 0 ? _c : () => undefined).bind(track)(); // firefox 沒有 getCapabilities 可以用。
593
+ const widthMax = (_d = capabilities === null || capabilities === void 0 ? void 0 : capabilities.width) === null || _d === void 0 ? void 0 : _d.max;
594
+ const heightMax = (_e = capabilities === null || capabilities === void 0 ? void 0 : capabilities.height) === null || _e === void 0 ? void 0 : _e.max;
595
+ const resolution = widthMax && heightMax ? widthMax * heightMax : 0;
596
+ const facingModeFromLabel = inferFacingModeFromLabel(device === null || device === void 0 ? void 0 : device.label);
597
+ const facingModeFromapabilities = inferFacingModeFromCapabilities(capabilities);
598
+ const facingMode = inferFacingModeFromMixedInfo(facingModeFromLabel, facingModeFromapabilities);
599
+ const meta = {
600
+ resolution,
601
+ facingMode,
602
+ facingModeFromLabel,
603
+ facingModeFromapabilities,
604
+ capabilities
605
+ };
606
+ track === null || track === void 0 ? void 0 : track.stop();
607
+ return {
608
+ device,
609
+ meta,
610
+ capabilities
611
+ };
612
+ }), videoDevices));
613
+ const firstDevice = (_a = deviceMetas.sort((a, b) => {
614
+ // 若是 Samsung 手機且模式為後鏡頭,則優先使用Label為 camera2 0 的鏡頭
615
+ let samsungCondition = 0;
616
+ if (isSamsung && facingMode === 'back') {
617
+ const samsungCamera = 'camera2 0';
618
+ const bScore = b.device.label.includes(samsungCamera) ? 1 : 0; // 特定鏡頭優先
619
+ const aScore = a.device.label.includes(samsungCamera) ? 1 : 0;
620
+ samsungCondition = bScore - aScore;
621
+ }
622
+ let cameraFacingCondition = 0;
623
+ {
624
+ const aFacingMode = a.meta.facingMode;
625
+ const bFacingMode = b.meta.facingMode;
626
+ const bScore = bFacingMode === facingMode ? 1 : 0; // 鏡頭符合 faceMode 優先。
627
+ const aScore = aFacingMode === facingMode ? 1 : 0;
628
+ cameraFacingCondition = bScore - aScore;
629
+ }
630
+ const resolutionCondition = b.meta.resolution - a.meta.resolution;
631
+ return samsungCondition || cameraFacingCondition || resolutionCondition;
632
+ })) === null || _a === void 0 ? void 0 : _a[0];
633
+ const deviceId = firstDevice.device.deviceId;
634
+ if (!deviceId) {
635
+ throw 'NO_CAMERA';
636
+ }
637
+ const constraints = {
638
+ video: {
639
+ // 推測依然需要使用 width & height 的限制條件,
640
+ // 否則即使是高解析度相機,也有可能拿到低解析度的圖片。(待驗證)
641
+ width: {
642
+ min: 1280,
643
+ ideal: 1920,
644
+ max: 1920
645
+ },
646
+ height: {
647
+ min: 720,
648
+ ideal: 1080,
649
+ max: 1080
650
+ },
651
+ focusMode: 'auto',
652
+ deviceId: {
653
+ exact: deviceId
654
+ }
655
+ }
656
+ };
657
+ debugLog('camera info', {
658
+ firstDevice,
659
+ deviceMetas
660
+ });
661
+ const stream = yield navigator.mediaDevices.getUserMedia(constraints);
662
+ video.srcObject = stream;
663
+ yield video.play();
664
+ // Note: Fix Safari 15 video not showing bug
665
+ video.srcObject = null;
666
+ setTimeout(() => {
667
+ video.srcObject = stream;
668
+ }, 10);
669
+ return firstDevice.meta.facingMode;
670
+ });
671
+ }
672
+ function isOverconstrainedError(error) {
673
+ if (error === null || typeof error === 'undefined') {
674
+ return false;
675
+ }
676
+ if (typeof error !== 'object') {
677
+ return false;
678
+ }
679
+ return 'constraint' in error;
680
+ }
681
+ function requestCamera({
682
+ video,
683
+ facingMode,
684
+ translate,
685
+ showMessage
686
+ }) {
687
+ return __awaiter(this, void 0, void 0, function* () {
688
+ try {
689
+ return yield _requestCamera(video, facingMode);
690
+ } catch (error) {
691
+ if (error === 'NOT_SUPPORT') {
692
+ showMessage(translate('camera.error.notFound'));
693
+ throw new AuthmeError(ErrorCode.CAMERA_NOT_SUPPORT, 'Browser not support WebRTC, or https required.');
694
+ }
695
+ if (error === 'NO_CAMERA') {
696
+ showMessage(translate('camera.error.notFound'));
697
+ throw new AuthmeError(ErrorCode.CAMERA_NOT_SUPPORT, 'camera not found');
698
+ }
699
+ if ((error === null || error === void 0 ? void 0 : error.name) === 'NotAllowedError') {
700
+ showMessage(translate('camera.error.notFound'));
701
+ throw new AuthmeError(ErrorCode.CAMERA_NOT_SUPPORT, error);
702
+ }
703
+ if (isOverconstrainedError(error)) {
704
+ showMessage(translate('camera.error.lowResolution'));
705
+ throw new AuthmeError(ErrorCode.CAMERA_NOT_SUPPORT, error);
706
+ }
707
+ throw error;
708
+ }
709
+ });
710
+ }
711
+
712
+ function showElement(element) {
713
+ element.classList.remove('hide');
714
+ element.classList.add('show');
715
+ }
716
+ function hideElement(element) {
717
+ element.classList.remove('show');
718
+ element.classList.add('hide');
719
+ }
720
+
721
+ const sdk_loading = () => ({
722
+ nm: 'Waiting',
723
+ mn: '',
724
+ layers: [{
725
+ ty: 4,
726
+ nm: '3',
727
+ mn: '',
728
+ sr: 1,
729
+ st: 38,
730
+ op: 938,
731
+ ip: -20,
732
+ hd: false,
733
+ cl: '',
734
+ ln: '',
735
+ ddd: 0,
736
+ bm: 0,
737
+ tt: 0,
738
+ hasMask: false,
739
+ td: 0,
740
+ ao: 0,
741
+ ks: {
742
+ a: {
743
+ a: 0,
744
+ k: [113, -41.653, 0],
745
+ ix: 1
746
+ },
747
+ s: {
748
+ a: 0,
749
+ k: [100, 100, 100],
750
+ ix: 6
751
+ },
752
+ sk: {
753
+ a: 0,
754
+ k: 0
755
+ },
756
+ p: {
757
+ a: 1,
758
+ k: [{
759
+ o: {
760
+ x: 0.167,
761
+ y: 0
762
+ },
763
+ i: {
764
+ x: 0.29,
765
+ y: 1
766
+ },
767
+ s: [250, 100.847, 0],
768
+ t: 20.251
769
+ }, {
770
+ o: {
771
+ x: 0.167,
772
+ y: 0
773
+ },
774
+ i: {
775
+ x: 0.29,
776
+ y: 1
777
+ },
778
+ s: [250, 53.847, 0],
779
+ t: 29.715
780
+ }, {
781
+ o: {
782
+ x: 0.167,
783
+ y: 0
784
+ },
785
+ i: {
786
+ x: 0.29,
787
+ y: 1
788
+ },
789
+ s: [250, 66.885, 0],
790
+ t: 41.702
791
+ }, {
792
+ o: {
793
+ x: 0.167,
794
+ y: 0.167
795
+ },
796
+ i: {
797
+ x: 0.833,
798
+ y: 0.833
799
+ },
800
+ s: [250, 100.847, 0],
801
+ t: 46.75
802
+ }],
803
+ ix: 2
804
+ },
805
+ sa: {
806
+ a: 0,
807
+ k: 0
808
+ },
809
+ o: {
810
+ a: 0,
811
+ k: 100,
812
+ ix: 11
813
+ },
814
+ r: {
815
+ a: 0,
816
+ k: 0,
817
+ ix: 10
818
+ }
819
+ },
820
+ ef: [],
821
+ shapes: [{
822
+ ty: 'gr',
823
+ bm: 0,
824
+ cl: '',
825
+ ln: '',
826
+ hd: false,
827
+ mn: 'ADBE Vector Group',
828
+ nm: 'Group 1',
829
+ ix: 1,
830
+ cix: 2,
831
+ np: 3,
832
+ it: [{
833
+ ty: 'sh',
834
+ bm: 0,
835
+ cl: '',
836
+ ln: '',
837
+ hd: false,
838
+ mn: 'ADBE Vector Shape - Group',
839
+ nm: 'Path 1',
840
+ ix: 1,
841
+ d: 1,
842
+ ks: {
843
+ a: 1,
844
+ k: [{
845
+ o: {
846
+ x: 0.167,
847
+ y: 0
848
+ },
849
+ i: {
850
+ x: 0.29,
851
+ y: 1
852
+ },
853
+ s: [{
854
+ c: true,
855
+ i: [[0.018, 0], [0, -0.018], [-0.018, 0], [0, 0.018]],
856
+ o: [[-0.018, 0], [0, 0.018], [0.018, 0], [0, -0.018]],
857
+ v: [[114.22, -40.406], [114.188, -40.373], [114.22, -40.34], [114.253, -40.373]]
858
+ }],
859
+ t: 27.2
860
+ }, {
861
+ o: {
862
+ x: 0.167,
863
+ y: 0
864
+ },
865
+ i: {
866
+ x: 0.29,
867
+ y: 1
868
+ },
869
+ s: [{
870
+ c: true,
871
+ i: [[12.339, 0], [0, -12.338], [-12.339, 0], [0, 12.339]],
872
+ o: [[-12.339, 0], [0, 12.339], [12.339, 0], [0, -12.338]],
873
+ v: [[113, -64.029], [90.623, -41.653], [113, -19.276], [135.377, -41.653]]
874
+ }],
875
+ t: 34
876
+ }, {
877
+ o: {
878
+ x: 0.167,
879
+ y: 0
880
+ },
881
+ i: {
882
+ x: 0.29,
883
+ y: 1
884
+ },
885
+ s: [{
886
+ c: true,
887
+ i: [[12.339, 0], [0, -12.338], [-12.339, 0], [0, 12.339]],
888
+ o: [[-12.339, 0], [0, 12.339], [12.339, 0], [0, -12.338]],
889
+ v: [[113, -64.029], [90.623, -41.653], [113, -19.276], [135.377, -41.653]]
890
+ }],
891
+ t: 46.75
892
+ }, {
893
+ o: {
894
+ x: 0.167,
895
+ y: 0.167
896
+ },
897
+ i: {
898
+ x: 0.833,
899
+ y: 0.833
900
+ },
901
+ s: [{
902
+ c: true,
903
+ i: [[0.018, 0], [0, -0.018], [-0.018, 0], [0, 0.018]],
904
+ o: [[-0.018, 0], [0, 0.018], [0.018, 0], [0, -0.018]],
905
+ v: [[114.22, -40.406], [114.188, -40.373], [114.22, -40.34], [114.253, -40.373]]
906
+ }],
907
+ t: 59.5
908
+ }],
909
+ ix: 2
910
+ }
911
+ }, {
912
+ ty: 'sh',
913
+ bm: 0,
914
+ cl: '',
915
+ ln: '',
916
+ hd: false,
917
+ mn: 'ADBE Vector Shape - Group',
918
+ nm: 'Path 2',
919
+ ix: 2,
920
+ d: 1,
921
+ ks: {
922
+ a: 0,
923
+ k: {
924
+ c: true,
925
+ i: [[18.404, 0], [0, 18.404], [-18.404, 0], [0, -18.404]],
926
+ o: [[-18.404, 0], [0, -18.404], [18.404, 0], [0, 18.404]],
927
+ v: [[113, -8.276], [79.623, -41.653], [113, -75.029], [146.377, -41.653]]
928
+ },
929
+ ix: 2
930
+ }
931
+ }, {
932
+ ty: 'fl',
933
+ bm: 0,
934
+ cl: '',
935
+ ln: '',
936
+ hd: false,
937
+ mn: 'ADBE Vector Graphic - Fill',
938
+ nm: 'Fill 1',
939
+ c: {
940
+ a: 0,
941
+ k: [0, 0.7569, 0.7137],
942
+ ix: 4
943
+ },
944
+ r: 1,
945
+ o: {
946
+ a: 0,
947
+ k: 100,
948
+ ix: 5
949
+ }
950
+ }, {
951
+ ty: 'tr',
952
+ a: {
953
+ a: 0,
954
+ k: [0, 0],
955
+ ix: 1
956
+ },
957
+ s: {
958
+ a: 0,
959
+ k: [100, 100],
960
+ ix: 3
961
+ },
962
+ sk: {
963
+ a: 0,
964
+ k: 0,
965
+ ix: 4
966
+ },
967
+ p: {
968
+ a: 0,
969
+ k: [0, 0],
970
+ ix: 2
971
+ },
972
+ r: {
973
+ a: 0,
974
+ k: 0,
975
+ ix: 6
976
+ },
977
+ sa: {
978
+ a: 0,
979
+ k: 0,
980
+ ix: 5
981
+ },
982
+ o: {
983
+ a: 0,
984
+ k: 100,
985
+ ix: 7
986
+ }
987
+ }]
988
+ }],
989
+ ind: 0
990
+ }, {
991
+ ty: 4,
992
+ nm: '2',
993
+ mn: '',
994
+ sr: 1,
995
+ st: 19,
996
+ op: 919,
997
+ ip: -9,
998
+ hd: false,
999
+ cl: '',
1000
+ ln: '',
1001
+ ddd: 0,
1002
+ bm: 0,
1003
+ tt: 0,
1004
+ hasMask: false,
1005
+ td: 0,
1006
+ ao: 0,
1007
+ ks: {
1008
+ a: {
1009
+ a: 0,
1010
+ k: [113, -41.653, 0],
1011
+ ix: 1
1012
+ },
1013
+ s: {
1014
+ a: 0,
1015
+ k: [100, 100, 100],
1016
+ ix: 6
1017
+ },
1018
+ sk: {
1019
+ a: 0,
1020
+ k: 0
1021
+ },
1022
+ p: {
1023
+ a: 1,
1024
+ k: [{
1025
+ o: {
1026
+ x: 0.167,
1027
+ y: 0
1028
+ },
1029
+ i: {
1030
+ x: 0.29,
1031
+ y: 1
1032
+ },
1033
+ s: [150, 100.847, 0],
1034
+ t: 10.673
1035
+ }, {
1036
+ o: {
1037
+ x: 0.167,
1038
+ y: 0
1039
+ },
1040
+ i: {
1041
+ x: 0.29,
1042
+ y: 1
1043
+ },
1044
+ s: [150, 53.847, 0],
1045
+ t: 20.137
1046
+ }, {
1047
+ o: {
1048
+ x: 0.167,
1049
+ y: 0
1050
+ },
1051
+ i: {
1052
+ x: 0.29,
1053
+ y: 1
1054
+ },
1055
+ s: [150, 66.885, 0],
1056
+ t: 32.125
1057
+ }, {
1058
+ o: {
1059
+ x: 0.167,
1060
+ y: 0.167
1061
+ },
1062
+ i: {
1063
+ x: 0.833,
1064
+ y: 0.833
1065
+ },
1066
+ s: [150, 100.847, 0],
1067
+ t: 37.1728515625
1068
+ }],
1069
+ ix: 2
1070
+ },
1071
+ sa: {
1072
+ a: 0,
1073
+ k: 0
1074
+ },
1075
+ o: {
1076
+ a: 0,
1077
+ k: 100,
1078
+ ix: 11
1079
+ },
1080
+ r: {
1081
+ a: 0,
1082
+ k: 0,
1083
+ ix: 10
1084
+ }
1085
+ },
1086
+ ef: [],
1087
+ shapes: [{
1088
+ ty: 'gr',
1089
+ bm: 0,
1090
+ cl: '',
1091
+ ln: '',
1092
+ hd: false,
1093
+ mn: 'ADBE Vector Group',
1094
+ nm: 'Group 1',
1095
+ ix: 1,
1096
+ cix: 2,
1097
+ np: 3,
1098
+ it: [{
1099
+ ty: 'sh',
1100
+ bm: 0,
1101
+ cl: '',
1102
+ ln: '',
1103
+ hd: false,
1104
+ mn: 'ADBE Vector Shape - Group',
1105
+ nm: 'Path 1',
1106
+ ix: 1,
1107
+ d: 1,
1108
+ ks: {
1109
+ a: 1,
1110
+ k: [{
1111
+ o: {
1112
+ x: 0.167,
1113
+ y: 0
1114
+ },
1115
+ i: {
1116
+ x: 0.29,
1117
+ y: 1
1118
+ },
1119
+ s: [{
1120
+ c: true,
1121
+ i: [[0.018, 0], [0, -0.018], [-0.018, 0], [0, 0.018]],
1122
+ o: [[-0.018, 0], [0, 0.018], [0.018, 0], [0, -0.018]],
1123
+ v: [[114.22, -40.406], [114.188, -40.373], [114.22, -40.34], [114.253, -40.373]]
1124
+ }],
1125
+ t: 17.85
1126
+ }, {
1127
+ o: {
1128
+ x: 0.167,
1129
+ y: 0
1130
+ },
1131
+ i: {
1132
+ x: 0.29,
1133
+ y: 1
1134
+ },
1135
+ s: [{
1136
+ c: true,
1137
+ i: [[12.339, 0], [0, -12.338], [-12.339, 0], [0, 12.339]],
1138
+ o: [[-12.339, 0], [0, 12.339], [12.339, 0], [0, -12.338]],
1139
+ v: [[113, -64.029], [90.623, -41.653], [113, -19.276], [135.377, -41.653]]
1140
+ }],
1141
+ t: 25.5
1142
+ }, {
1143
+ o: {
1144
+ x: 0.167,
1145
+ y: 0
1146
+ },
1147
+ i: {
1148
+ x: 0.29,
1149
+ y: 1
1150
+ },
1151
+ s: [{
1152
+ c: true,
1153
+ i: [[12.339, 0], [0, -12.338], [-12.339, 0], [0, 12.339]],
1154
+ o: [[-12.339, 0], [0, 12.339], [12.339, 0], [0, -12.338]],
1155
+ v: [[113, -64.029], [90.623, -41.653], [113, -19.276], [135.377, -41.653]]
1156
+ }],
1157
+ t: 28.949
1158
+ }, {
1159
+ o: {
1160
+ x: 0.167,
1161
+ y: 0
1162
+ },
1163
+ i: {
1164
+ x: 0.29,
1165
+ y: 1
1166
+ },
1167
+ s: [{
1168
+ c: true,
1169
+ i: [[0.018, 0], [0, -0.018], [-0.018, 0], [0, 0.018]],
1170
+ o: [[-0.018, 0], [0, 0.018], [0.018, 0], [0, -0.018]],
1171
+ v: [[111.72, -40.406], [111.688, -40.373], [111.72, -40.34], [111.753, -40.373]]
1172
+ }],
1173
+ t: 35.005
1174
+ }, {
1175
+ o: {
1176
+ x: 0.167,
1177
+ y: 0
1178
+ },
1179
+ i: {
1180
+ x: 0.29,
1181
+ y: 1
1182
+ },
1183
+ s: [{
1184
+ c: true,
1185
+ i: [[0.018, 0], [0, -0.018], [-0.018, 0], [0, 0.018]],
1186
+ o: [[-0.018, 0], [0, 0.018], [0.018, 0], [0, -0.018]],
1187
+ v: [[111.72, -40.406], [111.688, -40.373], [111.72, -40.34], [111.753, -40.373]]
1188
+ }],
1189
+ t: 46.75
1190
+ }, {
1191
+ o: {
1192
+ x: 0.167,
1193
+ y: 0
1194
+ },
1195
+ i: {
1196
+ x: 0.29,
1197
+ y: 1
1198
+ },
1199
+ s: [{
1200
+ c: true,
1201
+ i: [[12.339, 0], [0, -12.338], [-12.339, 0], [0, 12.339]],
1202
+ o: [[-12.339, 0], [0, 12.339], [12.339, 0], [0, -12.338]],
1203
+ v: [[113, -64.029], [90.623, -41.653], [113, -19.276], [135.377, -41.653]]
1204
+ }],
1205
+ t: 59.5
1206
+ }, {
1207
+ o: {
1208
+ x: 0.167,
1209
+ y: 0.167
1210
+ },
1211
+ i: {
1212
+ x: 0.833,
1213
+ y: 0.833
1214
+ },
1215
+ s: [{
1216
+ c: true,
1217
+ i: [[0.018, 0], [0, -0.018], [-0.018, 0], [0, 0.018]],
1218
+ o: [[-0.018, 0], [0, 0.018], [0.018, 0], [0, -0.018]],
1219
+ v: [[111.72, -40.406], [111.688, -40.373], [111.72, -40.34], [111.753, -40.373]]
1220
+ }],
1221
+ t: 72.25
1222
+ }],
1223
+ ix: 2
1224
+ }
1225
+ }, {
1226
+ ty: 'sh',
1227
+ bm: 0,
1228
+ cl: '',
1229
+ ln: '',
1230
+ hd: false,
1231
+ mn: 'ADBE Vector Shape - Group',
1232
+ nm: 'Path 2',
1233
+ ix: 2,
1234
+ d: 1,
1235
+ ks: {
1236
+ a: 0,
1237
+ k: {
1238
+ c: true,
1239
+ i: [[18.404, 0], [0, 18.404], [-18.404, 0], [0, -18.404]],
1240
+ o: [[-18.404, 0], [0, -18.404], [18.404, 0], [0, 18.404]],
1241
+ v: [[113, -8.276], [79.623, -41.653], [113, -75.029], [146.377, -41.653]]
1242
+ },
1243
+ ix: 2
1244
+ }
1245
+ }, {
1246
+ ty: 'fl',
1247
+ bm: 0,
1248
+ cl: '',
1249
+ ln: '',
1250
+ hd: false,
1251
+ mn: 'ADBE Vector Graphic - Fill',
1252
+ nm: 'Fill 1',
1253
+ c: {
1254
+ a: 0,
1255
+ k: [0, 0.7569, 0.7137],
1256
+ ix: 4
1257
+ },
1258
+ r: 1,
1259
+ o: {
1260
+ a: 0,
1261
+ k: 100,
1262
+ ix: 5
1263
+ }
1264
+ }, {
1265
+ ty: 'tr',
1266
+ a: {
1267
+ a: 0,
1268
+ k: [0, 0],
1269
+ ix: 1
1270
+ },
1271
+ s: {
1272
+ a: 0,
1273
+ k: [100, 100],
1274
+ ix: 3
1275
+ },
1276
+ sk: {
1277
+ a: 0,
1278
+ k: 0,
1279
+ ix: 4
1280
+ },
1281
+ p: {
1282
+ a: 0,
1283
+ k: [0, 0],
1284
+ ix: 2
1285
+ },
1286
+ r: {
1287
+ a: 0,
1288
+ k: 0,
1289
+ ix: 6
1290
+ },
1291
+ sa: {
1292
+ a: 0,
1293
+ k: 0,
1294
+ ix: 5
1295
+ },
1296
+ o: {
1297
+ a: 0,
1298
+ k: 100,
1299
+ ix: 7
1300
+ }
1301
+ }]
1302
+ }],
1303
+ ind: 1
1304
+ }, {
1305
+ ty: 4,
1306
+ nm: '1',
1307
+ mn: '',
1308
+ sr: 1,
1309
+ st: 0,
1310
+ op: 900,
1311
+ ip: 0,
1312
+ hd: false,
1313
+ cl: '',
1314
+ ln: '',
1315
+ ddd: 0,
1316
+ bm: 0,
1317
+ tt: 0,
1318
+ hasMask: false,
1319
+ td: 0,
1320
+ ao: 0,
1321
+ ks: {
1322
+ a: {
1323
+ a: 0,
1324
+ k: [113, -41.653, 0],
1325
+ ix: 1
1326
+ },
1327
+ s: {
1328
+ a: 0,
1329
+ k: [100, 100, 100],
1330
+ ix: 6
1331
+ },
1332
+ sk: {
1333
+ a: 0,
1334
+ k: 0
1335
+ },
1336
+ p: {
1337
+ a: 1,
1338
+ k: [{
1339
+ o: {
1340
+ x: 0.167,
1341
+ y: 0
1342
+ },
1343
+ i: {
1344
+ x: 0.29,
1345
+ y: 1
1346
+ },
1347
+ s: [46.5, 100.847, 0],
1348
+ t: 0
1349
+ }, {
1350
+ o: {
1351
+ x: 0.167,
1352
+ y: 0
1353
+ },
1354
+ i: {
1355
+ x: 0.29,
1356
+ y: 1
1357
+ },
1358
+ s: [46.5, 53.847, 0],
1359
+ t: 9.464
1360
+ }, {
1361
+ o: {
1362
+ x: 0.167,
1363
+ y: 0
1364
+ },
1365
+ i: {
1366
+ x: 0.29,
1367
+ y: 1
1368
+ },
1369
+ s: [46.5, 66.885, 0],
1370
+ t: 21.452
1371
+ }, {
1372
+ o: {
1373
+ x: 0.167,
1374
+ y: 0.167
1375
+ },
1376
+ i: {
1377
+ x: 0.833,
1378
+ y: 0.833
1379
+ },
1380
+ s: [46.5, 100.847, 0],
1381
+ t: 26.4990234375
1382
+ }],
1383
+ ix: 2
1384
+ },
1385
+ sa: {
1386
+ a: 0,
1387
+ k: 0
1388
+ },
1389
+ o: {
1390
+ a: 0,
1391
+ k: 100,
1392
+ ix: 11
1393
+ },
1394
+ r: {
1395
+ a: 0,
1396
+ k: 0,
1397
+ ix: 10
1398
+ }
1399
+ },
1400
+ ef: [],
1401
+ shapes: [{
1402
+ ty: 'gr',
1403
+ bm: 0,
1404
+ cl: '',
1405
+ ln: '',
1406
+ hd: false,
1407
+ mn: 'ADBE Vector Group',
1408
+ nm: 'Group 1',
1409
+ ix: 1,
1410
+ cix: 2,
1411
+ np: 3,
1412
+ it: [{
1413
+ ty: 'sh',
1414
+ bm: 0,
1415
+ cl: '',
1416
+ ln: '',
1417
+ hd: false,
1418
+ mn: 'ADBE Vector Shape - Group',
1419
+ nm: 'Path 1',
1420
+ ix: 1,
1421
+ d: 1,
1422
+ ks: {
1423
+ a: 1,
1424
+ k: [{
1425
+ o: {
1426
+ x: 0.167,
1427
+ y: 0
1428
+ },
1429
+ i: {
1430
+ x: 0.29,
1431
+ y: 1
1432
+ },
1433
+ s: [{
1434
+ c: true,
1435
+ i: [[0.018, 0], [0, -0.018], [-0.018, 0], [0, 0.018]],
1436
+ o: [[-0.018, 0], [0, 0.018], [0.018, 0], [0, -0.018]],
1437
+ v: [[114.22, -40.406], [114.188, -40.373], [114.22, -40.34], [114.253, -40.373]]
1438
+ }],
1439
+ t: 6.8
1440
+ }, {
1441
+ o: {
1442
+ x: 0.167,
1443
+ y: 0
1444
+ },
1445
+ i: {
1446
+ x: 0.29,
1447
+ y: 1
1448
+ },
1449
+ s: [{
1450
+ c: true,
1451
+ i: [[12.339, 0], [0, -12.338], [-12.339, 0], [0, 12.339]],
1452
+ o: [[-12.339, 0], [0, 12.339], [12.339, 0], [0, -12.338]],
1453
+ v: [[113, -64.029], [90.623, -41.653], [113, -19.276], [135.377, -41.653]]
1454
+ }],
1455
+ t: 13.6
1456
+ }, {
1457
+ o: {
1458
+ x: 0.167,
1459
+ y: 0
1460
+ },
1461
+ i: {
1462
+ x: 0.29,
1463
+ y: 1
1464
+ },
1465
+ s: [{
1466
+ c: true,
1467
+ i: [[12.339, 0], [0, -12.338], [-12.339, 0], [0, 12.339]],
1468
+ o: [[-12.339, 0], [0, 12.339], [12.339, 0], [0, -12.338]],
1469
+ v: [[113, -64.029], [90.623, -41.653], [113, -19.276], [135.377, -41.653]]
1470
+ }],
1471
+ t: 17.899
1472
+ }, {
1473
+ o: {
1474
+ x: 0.167,
1475
+ y: 0
1476
+ },
1477
+ i: {
1478
+ x: 0.29,
1479
+ y: 1
1480
+ },
1481
+ s: [{
1482
+ c: true,
1483
+ i: [[0.018, 0], [0, -0.018], [-0.018, 0], [0, 0.018]],
1484
+ o: [[-0.018, 0], [0, 0.018], [0.018, 0], [0, -0.018]],
1485
+ v: [[111.72, -40.406], [111.688, -40.373], [111.72, -40.34], [111.753, -40.373]]
1486
+ }],
1487
+ t: 23.954
1488
+ }, {
1489
+ o: {
1490
+ x: 0.167,
1491
+ y: 0
1492
+ },
1493
+ i: {
1494
+ x: 0.29,
1495
+ y: 1
1496
+ },
1497
+ s: [{
1498
+ c: true,
1499
+ i: [[0.018, 0], [0, -0.018], [-0.018, 0], [0, 0.018]],
1500
+ o: [[-0.018, 0], [0, 0.018], [0.018, 0], [0, -0.018]],
1501
+ v: [[111.72, -40.406], [111.688, -40.373], [111.72, -40.34], [111.753, -40.373]]
1502
+ }],
1503
+ t: 59.5
1504
+ }, {
1505
+ o: {
1506
+ x: 0.167,
1507
+ y: 0
1508
+ },
1509
+ i: {
1510
+ x: 0.29,
1511
+ y: 1
1512
+ },
1513
+ s: [{
1514
+ c: true,
1515
+ i: [[12.339, 0], [0, -12.338], [-12.339, 0], [0, 12.339]],
1516
+ o: [[-12.339, 0], [0, 12.339], [12.339, 0], [0, -12.338]],
1517
+ v: [[113, -64.029], [90.623, -41.653], [113, -19.276], [135.377, -41.653]]
1518
+ }],
1519
+ t: 72.25
1520
+ }, {
1521
+ o: {
1522
+ x: 0.167,
1523
+ y: 0.167
1524
+ },
1525
+ i: {
1526
+ x: 0.833,
1527
+ y: 0.833
1528
+ },
1529
+ s: [{
1530
+ c: true,
1531
+ i: [[0.018, 0], [0, -0.018], [-0.018, 0], [0, 0.018]],
1532
+ o: [[-0.018, 0], [0, 0.018], [0.018, 0], [0, -0.018]],
1533
+ v: [[111.72, -40.406], [111.688, -40.373], [111.72, -40.34], [111.753, -40.373]]
1534
+ }],
1535
+ t: 85
1536
+ }],
1537
+ ix: 2
1538
+ }
1539
+ }, {
1540
+ ty: 'sh',
1541
+ bm: 0,
1542
+ cl: '',
1543
+ ln: '',
1544
+ hd: false,
1545
+ mn: 'ADBE Vector Shape - Group',
1546
+ nm: 'Path 2',
1547
+ ix: 2,
1548
+ d: 1,
1549
+ ks: {
1550
+ a: 0,
1551
+ k: {
1552
+ c: true,
1553
+ i: [[18.404, 0], [0, 18.404], [-18.404, 0], [0, -18.404]],
1554
+ o: [[-18.404, 0], [0, -18.404], [18.404, 0], [0, 18.404]],
1555
+ v: [[113, -8.276], [79.623, -41.653], [113, -75.029], [146.377, -41.653]]
1556
+ },
1557
+ ix: 2
1558
+ }
1559
+ }, {
1560
+ ty: 'fl',
1561
+ bm: 0,
1562
+ cl: '',
1563
+ ln: '',
1564
+ hd: false,
1565
+ mn: 'ADBE Vector Graphic - Fill',
1566
+ nm: 'Fill 1',
1567
+ c: {
1568
+ a: 0,
1569
+ k: [0, 0.7569, 0.7137],
1570
+ ix: 4
1571
+ },
1572
+ r: 1,
1573
+ o: {
1574
+ a: 0,
1575
+ k: 100,
1576
+ ix: 5
1577
+ }
1578
+ }, {
1579
+ ty: 'tr',
1580
+ a: {
1581
+ a: 0,
1582
+ k: [0, 0],
1583
+ ix: 1
1584
+ },
1585
+ s: {
1586
+ a: 0,
1587
+ k: [100, 100],
1588
+ ix: 3
1589
+ },
1590
+ sk: {
1591
+ a: 0,
1592
+ k: 0,
1593
+ ix: 4
1594
+ },
1595
+ p: {
1596
+ a: 0,
1597
+ k: [0, 0],
1598
+ ix: 2
1599
+ },
1600
+ r: {
1601
+ a: 0,
1602
+ k: 0,
1603
+ ix: 6
1604
+ },
1605
+ sa: {
1606
+ a: 0,
1607
+ k: 0,
1608
+ ix: 5
1609
+ },
1610
+ o: {
1611
+ a: 0,
1612
+ k: 100,
1613
+ ix: 7
1614
+ }
1615
+ }]
1616
+ }],
1617
+ ind: 2
1618
+ }],
1619
+ ddd: 0,
1620
+ h: 200,
1621
+ w: 300,
1622
+ meta: {
1623
+ a: '',
1624
+ k: '',
1625
+ d: '',
1626
+ g: 'LottieFiles AE 1.0.0',
1627
+ tc: '#ffffff'
1628
+ },
1629
+ v: '4.8.0',
1630
+ fr: 30,
1631
+ op: 86,
1632
+ ip: 0,
1633
+ assets: []
1634
+ });
1635
+
1636
+ function startLoadingSDK(text) {
1637
+ const body = document.body;
1638
+ const loadingSDKOuter = document.createElement('div');
1639
+ const loadingSDKContent = document.createElement('div');
1640
+ loadingSDKOuter.classList.add('authme-loading-sdk-outer');
1641
+ loadingSDKContent.classList.add('authme-loading-sdk-content');
1642
+ loadingSDKOuter.appendChild(loadingSDKContent);
1643
+ lottie.loadAnimation({
1644
+ container: loadingSDKContent,
1645
+ renderer: 'svg',
1646
+ loop: true,
1647
+ autoplay: true,
1648
+ name: 'tutorial',
1649
+ animationData: sdk_loading()
1650
+ });
1651
+ body === null || body === void 0 ? void 0 : body.appendChild(loadingSDKOuter);
1652
+ }
1653
+ function stopLoadingSDK() {
1654
+ const body = document.body;
1655
+ const loadingSDKOuter = document.querySelector('.authme-loading-sdk-outer');
1656
+ if (loadingSDKOuter) {
1657
+ body === null || body === void 0 ? void 0 : body.removeChild(loadingSDKOuter);
1658
+ }
1659
+ }
1660
+
1661
+ var name = "@authme/util";
1662
+ var version$1 = "2.2.1-rc.3";
1663
+ var peerDependencies = {
1664
+ "core-js": "^3.6.0"
1665
+ };
1666
+ var packageInfo = {
1667
+ name: name,
1668
+ version: version$1,
1669
+ peerDependencies: peerDependencies
1670
+ };
1671
+
1672
+ var _a;
1673
+ var _b, _c;
1674
+ const version = packageInfo.version;
1675
+ (_a = (_b = window)[_c = Symbol.for('authme-sdk')]) !== null && _a !== void 0 ? _a : _b[_c] = {};
1676
+ window[Symbol.for('authme-sdk')][packageInfo.name] = version;
1677
+
1678
+ export { AuthmeError, ErrorCode, Icon, Storage, TIME_UNIT, UintArrayToBlob, asyncOnLineShowErrorMessage, asyncShowErrorMessage, asyncShowPopup, checkOnlineStatus, clearCanvas, cropByRatio, dataURItoBlob, debugLog, getCanvasSize, getImageData, getUserAgent, hideElement, hideErrorMessage, hidePopup, isMobile, isMobileOrTablet, requestCamera, resize, retryPromiseWithCondition, showElement, showErrorMessage, showPopup, startLoadingSDK, startSpinner, stopLoadingSDK, stopSpinner, version, videoConstraintsFactory, waitTime };