@ekyc_qoobiss/qbs-ect-cmp 1.2.7 → 1.2.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.
Files changed (29) hide show
  1. package/dist/cjs/_commonjsHelpers-c0bd7d34.js +528 -0
  2. package/dist/cjs/{agreement-check_17.cjs.entry.js → agreement-check_16.cjs.entry.js} +191 -3650
  3. package/dist/cjs/loader.cjs.js +1 -1
  4. package/dist/cjs/mobile-redirect.cjs.entry.js +2969 -0
  5. package/dist/cjs/qbs-ect-cmp.cjs.js +1 -1
  6. package/dist/collection/components/flow/landing-validation/landing-validation.js +5 -1
  7. package/dist/collection/components/identification-component/identification-component.css +4 -69
  8. package/dist/collection/components/identification-component/identification-component.js +8 -8
  9. package/dist/collection/helpers/Events.js +13 -5
  10. package/dist/collection/helpers/textValues.js +1 -0
  11. package/dist/esm/_commonjsHelpers-d06997a2.js +511 -0
  12. package/dist/esm/{agreement-check_17.entry.js → agreement-check_16.entry.js} +27 -3485
  13. package/dist/esm/{index-9d69e511.js → index-5d6f9123.js} +1 -1
  14. package/dist/esm/loader-dots.entry.js +1 -1
  15. package/dist/esm/loader.js +3 -3
  16. package/dist/esm/mobile-redirect.entry.js +2965 -0
  17. package/dist/esm/qbs-ect-cmp.js +3 -3
  18. package/dist/qbs-ect-cmp/{p-b490e98d.entry.js → p-139820b9.entry.js} +24 -24
  19. package/dist/qbs-ect-cmp/p-72635f9d.entry.js +1 -0
  20. package/dist/qbs-ect-cmp/{p-4c8e922b.entry.js → p-7c33dd41.entry.js} +1 -1
  21. package/dist/qbs-ect-cmp/p-80888f13.js +1 -0
  22. package/dist/qbs-ect-cmp/{p-06e42b28.js → p-aacd7024.js} +1 -1
  23. package/dist/qbs-ect-cmp/qbs-ect-cmp.esm.js +1 -1
  24. package/dist/types/components/flow/landing-validation/landing-validation.d.ts +1 -0
  25. package/dist/types/components/identification-component/identification-component.d.ts +1 -1
  26. package/dist/types/components.d.ts +2 -2
  27. package/dist/types/helpers/Events.d.ts +2 -1
  28. package/dist/types/helpers/textValues.d.ts +1 -0
  29. package/package.json +1 -1
@@ -1,493 +1,5 @@
1
- import { g as getRenderingRef, f as forceUpdate, r as registerInstance, c as createEvent, h, a as getElement } from './index-9d69e511.js';
2
-
3
- var OrderStatuses;
4
- (function (OrderStatuses) {
5
- OrderStatuses[OrderStatuses["Capturing"] = 0] = "Capturing";
6
- OrderStatuses[OrderStatuses["FinishedCapturing"] = 1] = "FinishedCapturing";
7
- OrderStatuses[OrderStatuses["Waiting"] = 2] = "Waiting";
8
- OrderStatuses[OrderStatuses["NotFound"] = 3] = "NotFound";
9
- })(OrderStatuses || (OrderStatuses = {}));
10
-
11
- const appendToMap = (map, propName, value) => {
12
- const items = map.get(propName);
13
- if (!items) {
14
- map.set(propName, [value]);
15
- }
16
- else if (!items.includes(value)) {
17
- items.push(value);
18
- }
19
- };
20
- const debounce = (fn, ms) => {
21
- let timeoutId;
22
- return (...args) => {
23
- if (timeoutId) {
24
- clearTimeout(timeoutId);
25
- }
26
- timeoutId = setTimeout(() => {
27
- timeoutId = 0;
28
- fn(...args);
29
- }, ms);
30
- };
31
- };
32
-
33
- /**
34
- * Check if a possible element isConnected.
35
- * The property might not be there, so we check for it.
36
- *
37
- * We want it to return true if isConnected is not a property,
38
- * otherwise we would remove these elements and would not update.
39
- *
40
- * Better leak in Edge than to be useless.
41
- */
42
- const isConnected = (maybeElement) => !('isConnected' in maybeElement) || maybeElement.isConnected;
43
- const cleanupElements = debounce((map) => {
44
- for (let key of map.keys()) {
45
- map.set(key, map.get(key).filter(isConnected));
46
- }
47
- }, 2000);
48
- const stencilSubscription = () => {
49
- if (typeof getRenderingRef !== 'function') {
50
- // If we are not in a stencil project, we do nothing.
51
- // This function is not really exported by @stencil/core.
52
- return {};
53
- }
54
- const elmsToUpdate = new Map();
55
- return {
56
- dispose: () => elmsToUpdate.clear(),
57
- get: (propName) => {
58
- const elm = getRenderingRef();
59
- if (elm) {
60
- appendToMap(elmsToUpdate, propName, elm);
61
- }
62
- },
63
- set: (propName) => {
64
- const elements = elmsToUpdate.get(propName);
65
- if (elements) {
66
- elmsToUpdate.set(propName, elements.filter(forceUpdate));
67
- }
68
- cleanupElements(elmsToUpdate);
69
- },
70
- reset: () => {
71
- elmsToUpdate.forEach((elms) => elms.forEach(forceUpdate));
72
- cleanupElements(elmsToUpdate);
73
- },
74
- };
75
- };
76
-
77
- const unwrap = (val) => (typeof val === 'function' ? val() : val);
78
- const createObservableMap = (defaultState, shouldUpdate = (a, b) => a !== b) => {
79
- const unwrappedState = unwrap(defaultState);
80
- let states = new Map(Object.entries(unwrappedState !== null && unwrappedState !== void 0 ? unwrappedState : {}));
81
- const handlers = {
82
- dispose: [],
83
- get: [],
84
- set: [],
85
- reset: [],
86
- };
87
- const reset = () => {
88
- var _a;
89
- // When resetting the state, the default state may be a function - unwrap it to invoke it.
90
- // otherwise, the state won't be properly reset
91
- states = new Map(Object.entries((_a = unwrap(defaultState)) !== null && _a !== void 0 ? _a : {}));
92
- handlers.reset.forEach((cb) => cb());
93
- };
94
- const dispose = () => {
95
- // Call first dispose as resetting the state would
96
- // cause less updates ;)
97
- handlers.dispose.forEach((cb) => cb());
98
- reset();
99
- };
100
- const get = (propName) => {
101
- handlers.get.forEach((cb) => cb(propName));
102
- return states.get(propName);
103
- };
104
- const set = (propName, value) => {
105
- const oldValue = states.get(propName);
106
- if (shouldUpdate(value, oldValue, propName)) {
107
- states.set(propName, value);
108
- handlers.set.forEach((cb) => cb(propName, value, oldValue));
109
- }
110
- };
111
- const state = (typeof Proxy === 'undefined'
112
- ? {}
113
- : new Proxy(unwrappedState, {
114
- get(_, propName) {
115
- return get(propName);
116
- },
117
- ownKeys(_) {
118
- return Array.from(states.keys());
119
- },
120
- getOwnPropertyDescriptor() {
121
- return {
122
- enumerable: true,
123
- configurable: true,
124
- };
125
- },
126
- has(_, propName) {
127
- return states.has(propName);
128
- },
129
- set(_, propName, value) {
130
- set(propName, value);
131
- return true;
132
- },
133
- }));
134
- const on = (eventName, callback) => {
135
- handlers[eventName].push(callback);
136
- return () => {
137
- removeFromArray(handlers[eventName], callback);
138
- };
139
- };
140
- const onChange = (propName, cb) => {
141
- const unSet = on('set', (key, newValue) => {
142
- if (key === propName) {
143
- cb(newValue);
144
- }
145
- });
146
- // We need to unwrap the defaultState because it might be a function.
147
- // Otherwise we might not be sending the right reset value.
148
- const unReset = on('reset', () => cb(unwrap(defaultState)[propName]));
149
- return () => {
150
- unSet();
151
- unReset();
152
- };
153
- };
154
- const use = (...subscriptions) => {
155
- const unsubs = subscriptions.reduce((unsubs, subscription) => {
156
- if (subscription.set) {
157
- unsubs.push(on('set', subscription.set));
158
- }
159
- if (subscription.get) {
160
- unsubs.push(on('get', subscription.get));
161
- }
162
- if (subscription.reset) {
163
- unsubs.push(on('reset', subscription.reset));
164
- }
165
- if (subscription.dispose) {
166
- unsubs.push(on('dispose', subscription.dispose));
167
- }
168
- return unsubs;
169
- }, []);
170
- return () => unsubs.forEach((unsub) => unsub());
171
- };
172
- const forceUpdate = (key) => {
173
- const oldValue = states.get(key);
174
- handlers.set.forEach((cb) => cb(key, oldValue, oldValue));
175
- };
176
- return {
177
- state,
178
- get,
179
- set,
180
- on,
181
- onChange,
182
- use,
183
- dispose,
184
- reset,
185
- forceUpdate,
186
- };
187
- };
188
- const removeFromArray = (array, item) => {
189
- const index = array.indexOf(item);
190
- if (index >= 0) {
191
- array[index] = array[array.length - 1];
192
- array.length--;
193
- }
194
- };
195
-
196
- const createStore = (defaultState, shouldUpdate) => {
197
- const map = createObservableMap(defaultState, shouldUpdate);
198
- map.use(stencilSubscription());
199
- return map;
200
- };
201
-
202
- var FlowStatus;
203
- (function (FlowStatus) {
204
- FlowStatus[FlowStatus["LANDING"] = 0] = "LANDING";
205
- FlowStatus[FlowStatus["AGREEMENT"] = 1] = "AGREEMENT";
206
- FlowStatus[FlowStatus["PHONE"] = 2] = "PHONE";
207
- FlowStatus[FlowStatus["CODE"] = 3] = "CODE";
208
- FlowStatus[FlowStatus["CODEERROR"] = 4] = "CODEERROR";
209
- FlowStatus[FlowStatus["ID"] = 5] = "ID";
210
- FlowStatus[FlowStatus["LIVENESS"] = 6] = "LIVENESS";
211
- FlowStatus[FlowStatus["COMPLETE"] = 7] = "COMPLETE";
212
- FlowStatus[FlowStatus["ERROREND"] = 8] = "ERROREND";
213
- })(FlowStatus || (FlowStatus = {}));
214
-
215
- class GlobalValues {
216
- }
217
- GlobalValues.FooterText = 'Qoobiss eKYC';
218
- GlobalValues.VideoLenght = 3100;
219
- class HowToValues extends GlobalValues {
220
- }
221
- HowToValues.IdTitile = 'Prezintă actul tău de identitate';
222
- HowToValues.IdSubTitileFace = 'Este necesară captarea actului de identitate. Urmează intrucțiunile ce vor fi afișate pe ecran.';
223
- HowToValues.IdSubTitileBack = 'Este necesară captarea actului de identitate. Urmează intrucțiunile ce vor fi afișate pe ecran.';
224
- HowToValues.IdButton = 'Sunt gata!';
225
- HowToValues.SelfieTitile = 'Validare video';
226
- HowToValues.SelfieSubTitile = 'Este necesară realizarea unei înregistrări video. Respectă intrucțiunile ce vor fi afișate pe ecran.';
227
- HowToValues.SelfieButton = 'Sunt gata!';
228
- class LandingValues extends GlobalValues {
229
- }
230
- LandingValues.Title = 'Validarea identității la distanță este o procedură simplă și rapidă';
231
- LandingValues.Description = 'Asigură-te că ai:';
232
- LandingValues.IdInfo = 'Actul de identitate, în original';
233
- LandingValues.DeviceInfo = 'Un telefon mobil sau un calculator cu camera web';
234
- LandingValues.SmsInfo = 'Acces la un telefon mobil ce permite primirea de mesaje SMS';
235
- LandingValues.Warning = 'ATENȚIE! În cadrul acestui proces se poate utiliza doar cartea de identitate Românească.';
236
- LandingValues.WarningMd = 'ATENȚIE! In cadrul acestui proces se pot utiliza doar buletinele de identitate din Republica Moldova.';
237
- LandingValues.Terms = 'Prin continuarea procesului, confirmi că ai citit termenii de utilizare și ești de acord cu aceștia.';
238
- LandingValues.Button = 'Am înțeles';
239
- class PhoneValidationValues extends GlobalValues {
240
- }
241
- PhoneValidationValues.Title = 'Este necesar să validăm numărul tău de telefon';
242
- PhoneValidationValues.Description = 'Introdu mai jos numarul tau de telefon:';
243
- PhoneValidationValues.Button = 'Trimite SMS de verificare';
244
- PhoneValidationValues.Label = 'Numarul tau de telefon';
245
- class CodeValidationValues extends GlobalValues {
246
- }
247
- CodeValidationValues.Title = 'Introdu codul de validare primit prin sms:';
248
- CodeValidationValues.Description = ' ';
249
- CodeValidationValues.Button = 'Validează';
250
- CodeValidationValues.Error = 'Codul introdus nu este valid. Asigură-te că îl introduci corect';
251
- class CompleteValues extends GlobalValues {
252
- }
253
- CompleteValues.Title = 'Procesul a fost finalizat.';
254
- CompleteValues.Description = 'Vei fi redirecționat în câteva momente.';
255
- CompleteValues.Message = 'Îți mulțumim!';
256
- class SessionKeys {
257
- }
258
- SessionKeys.FlowStatusKey = 'qbs-ect-flowstatus';
259
- SessionKeys.RequestIdKey = 'qbs-ect-requestid';
260
- SessionKeys.TokenKey = 'qbs-ect-token';
261
- SessionKeys.InitialisedKey = 'qbs-ect-initialised';
262
- SessionKeys.HasIdBackKey = 'qbs-ect-has-id-back';
263
- SessionKeys.AgreementValidationKey = 'qbs-ect-agreement-validation';
264
- SessionKeys.PhoneValidationKey = 'qbs-ect-phone-validation';
265
- class IdCaptureValues extends GlobalValues {
266
- }
267
- IdCaptureValues.Button = 'Încerc din nou';
268
- IdCaptureValues.Title = 'Încadrează actul de identitate în chenarul de pe ecran.';
269
- IdCaptureValues.TitleBack = 'Încadrează spatele actului de identitate în chenarul de pe ecran.';
270
- IdCaptureValues.TtileRotate = 'Întoarce actul de identitate.';
271
- IdCaptureValues.Error = 'Procesul a eșuat. Te rugăm să respecți întocmai instrucțiunile de pe ecran. Ai grijă să încadrezi integral actul în chenraul de pe ecran și să nu apară reflexii de lumină pe suprafața acestuia.';
272
- IdCaptureValues.IDPoseMapping = {
273
- 0: '',
274
- 1: 'Înclină actul de identitate spre spate.',
275
- 2: '',
276
- 3: '',
277
- 4: '',
278
- };
279
- IdCaptureValues.IDPoseDemoMapping = {
280
- 0: 'https://ekyc.blob.core.windows.net/$web/animations/id/id_front.mp4',
281
- 1: 'https://ekyc.blob.core.windows.net/$web/animations/id/id_front_tilt.mp4',
282
- 2: 'https://ekyc.blob.core.windows.net/$web/animations/id/id_rotate.mp4',
283
- 3: 'https://ekyc.blob.core.windows.net/$web/animations/id/id_back.mp4',
284
- 4: 'https://ekyc.blob.core.windows.net/$web/animations/id/id_back_tilt.mp4',
285
- };
286
- IdCaptureValues.Loading = 'Transferăm datele. Asteptați...';
287
- class SelfieCaptureValues extends GlobalValues {
288
- }
289
- SelfieCaptureValues.Title = 'Încadrează fața în chenarul de pe ecran.';
290
- SelfieCaptureValues.FinalTitle = 'Îndreaptă capul și încadrează fața în chenarul de pe ecran.';
291
- SelfieCaptureValues.Error = 'Procesul a eșuat. Te rugăm să respecți întocmai instrucțiunile de pe ecran.';
292
- SelfieCaptureValues.Loading = 'Transferăm datele. Asteptați...';
293
- SelfieCaptureValues.FacePoseMapping = {
294
- 0: 'Întoarce capul spre stânga.',
295
- 1: 'Întoarce capul spre dreapta.',
296
- 2: 'Înclină capul spre spate.',
297
- 3: 'Înclină capul în față.',
298
- // 4: 'Înclină capul spre stânga.',
299
- // 5: 'Înclină capul spre dreapta.',
300
- 4: '',
301
- };
302
- SelfieCaptureValues.FacePoseDemoMapping = {
303
- 0: 'https://ekyc.blob.core.windows.net/$web/animations/selfie/selfie_rotate_left.mp4',
304
- 1: 'https://ekyc.blob.core.windows.net/$web/animations/selfie/selfie_rotate_right.mp4',
305
- 2: 'https://ekyc.blob.core.windows.net/$web/animations/selfie/selfie_tilt_back.mp4',
306
- 3: 'https://ekyc.blob.core.windows.net/$web/animations/selfie/selfie_tilt_front.mp4',
307
- // 4: 'https://ekyc.blob.core.windows.net/$web/animations/selfie/selfie_tilt_left.mp4',
308
- // 5: 'https://ekyc.blob.core.windows.net/$web/animations/selfie/selfie_tilt_right.mp4',
309
- 4: 'https://ekyc.blob.core.windows.net/$web/animations/selfie/selfie_main.mp4',
310
- };
311
- class AgreementInfoValues extends GlobalValues {
312
- }
313
- AgreementInfoValues.Title = 'Pentru începerea identificării avem nevoie de acordurile tale:';
314
- AgreementInfoValues.Button = 'Încep identificarea';
315
- AgreementInfoValues.Terms = 'Am luat la cunoștință și sunt de acord cu Termenii și condițiile generale de utilizare';
316
- AgreementInfoValues.Agreement = 'Îmi exprim acordul pentru prelucrarea datelor cu caracter personal';
317
- class AgreementCheckValues extends GlobalValues {
318
- }
319
- AgreementCheckValues.ButtonYes = 'Sunt de acord';
320
- AgreementCheckValues.ButtonNo = 'Nu sunt de acord';
321
- class ApiUrls {
322
- constructor() {
323
- this.uriEnv = '/';
324
- this.uriEnv = state.environment == 'QA' ? '/dev_' : '/';
325
- this.OtpSend = this.uriEnv + 'validation/otp/send';
326
- this.OtpCheck = this.uriEnv + 'validation/otp/check';
327
- this.IdentityInsert = this.uriEnv + 'validation/identity/insert';
328
- this.UploadCapture = this.uriEnv + 'validation/upload/capture';
329
- this.GetAgreement = this.uriEnv + 'validation/agreement/content';
330
- this.GenerateAgreement = this.uriEnv + 'validation/agreement/generate';
331
- this.SendLink = this.uriEnv + 'validation/otp/sendlink';
332
- this.GetStatus = this.uriEnv + 'validation/identity/status';
333
- this.AddLog = this.uriEnv + 'validation/logs/add';
334
- }
335
- }
336
- class MobileRedirectValues extends GlobalValues {
337
- }
338
- MobileRedirectValues.InfoTop = 'Pentru a continua scanați codul de mai jos cu un smartphone.';
339
- MobileRedirectValues.InfoBottom = 'Sau introduceți un număr de telefon pentru a primi link-ul pe smartphone.';
340
- MobileRedirectValues.Validation = 'Număr de telefon invalid!';
341
- MobileRedirectValues.InfoWaiting = 'Așteptăm finalizarea procesului pe smartphone.';
342
-
343
- const { state, onChange } = createStore({
344
- flowStatus: FlowStatus.LANDING,
345
- environment: 'PROD',
346
- requestId: '',
347
- redirectId: '',
348
- initialised: false,
349
- token: '',
350
- cameraIds: [],
351
- cameraId: '',
352
- hasIdBack: false,
353
- agreementsValidation: true,
354
- phoneValidation: true,
355
- phoneNumber: '',
356
- apiBaseUrl: 'https://apiro.id-kyc.com',
357
- });
358
- onChange('flowStatus', value => {
359
- sessionStorage.setItem(SessionKeys.FlowStatusKey, FlowStatus[value]);
360
- });
361
- onChange('token', value => {
362
- sessionStorage.setItem(SessionKeys.TokenKey, value);
363
- });
364
- onChange('requestId', value => {
365
- sessionStorage.setItem(SessionKeys.RequestIdKey, value);
366
- });
367
- onChange('initialised', value => {
368
- sessionStorage.setItem(SessionKeys.InitialisedKey, String(value));
369
- });
370
- onChange('hasIdBack', value => {
371
- sessionStorage.setItem(SessionKeys.HasIdBackKey, String(value));
372
- });
373
- onChange('agreementsValidation', value => {
374
- sessionStorage.setItem(SessionKeys.AgreementValidationKey, String(value));
375
- });
376
- onChange('phoneValidation', value => {
377
- sessionStorage.setItem(SessionKeys.PhoneValidationKey, String(value));
378
- });
379
-
380
- class ApiCall {
381
- constructor() {
382
- this.toBase64 = (file) => new Promise((resolve, reject) => {
383
- const reader = new FileReader();
384
- reader.readAsDataURL(file);
385
- reader.onload = () => resolve(reader.result);
386
- reader.onerror = error => reject(error);
387
- });
388
- this.urls = new ApiUrls();
389
- }
390
- async http(request) {
391
- const response = await fetch(request);
392
- if (!response.ok) {
393
- throw new Error(response.statusText);
394
- }
395
- try {
396
- // may error if there is no body
397
- return await response.json();
398
- }
399
- catch (ex) {
400
- throw new Error('No json found in response ' + ex);
401
- }
402
- }
403
- async post(url, data) {
404
- return await this.http(new Request(state.apiBaseUrl + url, {
405
- method: 'POST',
406
- body: data,
407
- headers: {
408
- 'Content-Type': 'application/json',
409
- 'Authorization': 'IDKYC-TOKEN ' + state.token,
410
- },
411
- }));
412
- }
413
- async get(url) {
414
- return await this.http(new Request(state.apiBaseUrl + url, {
415
- method: 'GET',
416
- headers: {
417
- 'Content-Type': 'application/json',
418
- 'Authorization': 'IDKYC-TOKEN ' + state.token,
419
- },
420
- }));
421
- }
422
- async SendOTPCode(requestId, phoneNumber) {
423
- let data = { requestId: requestId, phone: phoneNumber };
424
- let jsonResp = await this.post(this.urls.OtpSend, JSON.stringify(data));
425
- return jsonResp.sent;
426
- }
427
- async CheckOTPCode(requestId, otpCode) {
428
- let data = { requestId: requestId, otp: otpCode };
429
- let jsonResp = await this.post(this.urls.OtpCheck, JSON.stringify(data));
430
- return jsonResp.valid;
431
- }
432
- async AddIdentificationRequest(deviceInfo) {
433
- let data = {
434
- requestId: state.requestId,
435
- clientDeviceInfo: JSON.stringify(deviceInfo),
436
- redirectId: state.redirectId,
437
- phoneNumber: state.phoneNumber,
438
- };
439
- let jsonResp = await this.post(this.urls.IdentityInsert, JSON.stringify(data));
440
- if (state.requestId == '') {
441
- state.requestId = jsonResp.requestId;
442
- }
443
- state.hasIdBack = jsonResp.hasIdBack;
444
- state.agreementsValidation = jsonResp.agreementsValidation;
445
- state.phoneValidation = jsonResp.phoneValidation;
446
- state.phoneNumber = jsonResp.phoneNumber;
447
- return true;
448
- }
449
- async UploadFileForRequestB64(requestId, type, file) {
450
- let data = {
451
- requestId: requestId,
452
- type: type,
453
- data: await this.toBase64(file),
454
- };
455
- let respJson = await this.post(this.urls.UploadCapture, JSON.stringify(data));
456
- if (!state.hasIdBack && type == 'IdFront') {
457
- return respJson.isValid;
458
- }
459
- if (state.hasIdBack && type == 'IdBack') {
460
- return respJson.isValid;
461
- }
462
- return true;
463
- }
464
- async GetAgreement(agreementType) {
465
- let resp = await this.get(this.urls.GetAgreement + '?type=' + agreementType + '&requestId=' + state.requestId);
466
- return resp.htmlText;
467
- }
468
- async GenerateAgreement(agreementType) {
469
- let data = { requestId: state.requestId, documentType: agreementType };
470
- let resp = await this.post(this.urls.GenerateAgreement, JSON.stringify(data));
471
- return resp.generation;
472
- }
473
- async GetStatus(requestId) {
474
- let resp = await this.get(this.urls.GetStatus + '?orderId=' + requestId);
475
- return OrderStatuses[resp.status];
476
- }
477
- async SendLink(link, phoneNumber) {
478
- let data = { requestId: state.requestId, link: link, phoneNumber: phoneNumber };
479
- let resp = await this.post(this.urls.SendLink, JSON.stringify(data));
480
- return resp.sent;
481
- }
482
- async AddLog(error) {
483
- try {
484
- let data = { requestId: state.requestId, action: FlowStatus[state.flowStatus], message: JSON.stringify(error !== null && error !== void 0 ? error : 'no error data') };
485
- let result = await this.post(this.urls.AddLog, JSON.stringify(data));
486
- return result.saved;
487
- }
488
- catch (_a) { }
489
- }
490
- }
1
+ import { r as registerInstance, c as createEvent, h, g as getElement } from './index-5d6f9123.js';
2
+ import { A as ApiCall, a as AgreementCheckValues, b as AgreementInfoValues, s as state, F as FlowStatus, c as createCommonjsModule, g as getDefaultExportFromCjs, G as GlobalValues, I as IdCaptureValues, S as SelfieCaptureValues, C as CompleteValues, H as HowToValues, d as SessionKeys, L as LandingValues, P as PhoneValidationValues, e as CodeValidationValues } from './_commonjsHelpers-d06997a2.js';
491
3
 
492
4
  const agreementCheckCss = "";
493
5
 
@@ -564,24 +76,6 @@ const AgreementInfo = class {
564
76
  };
565
77
  AgreementInfo.style = agreementInfoCss;
566
78
 
567
- function getDefaultExportFromCjs (x) {
568
- return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
569
- }
570
-
571
- function createCommonjsModule(fn, basedir, module) {
572
- return module = {
573
- path: basedir,
574
- exports: {},
575
- require: function (path, base) {
576
- return commonjsRequire();
577
- }
578
- }, fn(module, module.exports), module.exports;
579
- }
580
-
581
- function commonjsRequire () {
582
- throw new Error('Dynamic requires are not currently supported by @rollup/plugin-commonjs');
583
- }
584
-
585
79
  var ml5_min = createCommonjsModule(function (module, exports) {
586
80
  !function(t,e){module.exports=e();}(window,function(){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:r});},n.r=function(t){Object.defineProperty(t,"__esModule",{value:!0});},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="/",n(n.s=581)}([function(t,e,n){n.r(e),function(t,r,i,o){n.d(e,"AdadeltaOptimizer",function(){return Dh}),n.d(e,"AdagradOptimizer",function(){return Fh}),n.d(e,"AdamOptimizer",function(){return Th}),n.d(e,"AdamaxOptimizer",function(){return Nh}),n.d(e,"Add",function(){return Er}),n.d(e,"AddN",function(){return Cr}),n.d(e,"BroadcastTo",function(){return Tr}),n.d(e,"DataStorage",function(){return ho}),n.d(e,"Div",function(){return Ar}),n.d(e,"ENV",function(){return h}),n.d(e,"Environment",function(){return l}),n.d(e,"FromPixels",function(){return jr}),n.d(e,"FusedBatchNorm",function(){return Or}),n.d(e,"Identity",function(){return Ir}),n.d(e,"KernelBackend",function(){return po}),n.d(e,"MaxPoolWithArgmax",function(){return Br}),n.d(e,"MomentumOptimizer",function(){return Rh}),n.d(e,"NonMaxSuppressionV5",function(){return Fr}),n.d(e,"OneHot",function(){return Nr}),n.d(e,"Optimizer",function(){return Sh}),n.d(e,"PadV2",function(){return Mr}),n.d(e,"RMSPropOptimizer",function(){return Mh}),n.d(e,"Rank",function(){return Ot}),n.d(e,"Reduction",function(){return pl}),n.d(e,"SGDOptimizer",function(){return Ih}),n.d(e,"Square",function(){return Sr}),n.d(e,"SquaredDifference",function(){return _r}),n.d(e,"Tensor",function(){return At}),n.d(e,"TensorBuffer",function(){return wt}),n.d(e,"Tile",function(){return Rr}),n.d(e,"Transpose",function(){return Dr}),n.d(e,"Variable",function(){return Tt}),n.d(e,"abs",function(){return Wr}),n.d(e,"acos",function(){return Vr}),n.d(e,"acosh",function(){return qr}),n.d(e,"add",function(){return Pr}),n.d(e,"addN",function(){return Ps}),n.d(e,"addStrict",function(){return ki}),n.d(e,"all",function(){return Ic}),n.d(e,"any",function(){return Rc}),n.d(e,"argMax",function(){return Mc}),n.d(e,"argMin",function(){return jc}),n.d(e,"asin",function(){return $r}),n.d(e,"asinh",function(){return Hr}),n.d(e,"atan",function(){return Gr}),n.d(e,"atan2",function(){return Ei}),n.d(e,"atanh",function(){return Kr}),n.d(e,"avgPool",function(){return kc}),n.d(e,"avgPool3d",function(){return Ac}),n.d(e,"backend",function(){return mn}),n.d(e,"backend_util",function(){return To}),n.d(e,"basicLSTMCell",function(){return Qc}),n.d(e,"batchNorm",function(){return qs}),n.d(e,"batchNorm2d",function(){return Gs}),n.d(e,"batchNorm3d",function(){return Ys}),n.d(e,"batchNorm4d",function(){return Zs}),n.d(e,"batchNormalization",function(){return Vs}),n.d(e,"batchNormalization2d",function(){return Hs}),n.d(e,"batchNormalization3d",function(){return Xs}),n.d(e,"batchNormalization4d",function(){return Qs}),n.d(e,"batchToSpaceND",function(){return sr}),n.d(e,"booleanMaskAsync",function(){return Yu}),n.d(e,"broadcastTo",function(){return tu}),n.d(e,"browser",function(){return wh}),n.d(e,"buffer",function(){return or}),n.d(e,"cast",function(){return ur}),n.d(e,"ceil",function(){return Xr}),n.d(e,"clipByValue",function(){return Yr}),n.d(e,"clone",function(){return eu}),n.d(e,"complex",function(){return In}),n.d(e,"concat",function(){return Zn}),n.d(e,"concat1d",function(){return tr}),n.d(e,"concat2d",function(){return er}),n.d(e,"concat3d",function(){return nr}),n.d(e,"concat4d",function(){return rr}),n.d(e,"conv1d",function(){return tc}),n.d(e,"conv2d",function(){return ec}),n.d(e,"conv2dTranspose",function(){return cc}),n.d(e,"conv3d",function(){return nc}),n.d(e,"conv3dTranspose",function(){return lc}),n.d(e,"cos",function(){return Jr}),n.d(e,"cosh",function(){return Qr}),n.d(e,"cumsum",function(){return cr}),n.d(e,"customGrad",function(){return so}),n.d(e,"deprecationWarn",function(){return Qe}),n.d(e,"depthToSpace",function(){return lr}),n.d(e,"depthwiseConv2d",function(){return oc}),n.d(e,"diag",function(){return fl}),n.d(e,"disableDeprecationWarnings",function(){return Je}),n.d(e,"dispose",function(){return on}),n.d(e,"disposeVariables",function(){return Ze}),n.d(e,"div",function(){return Li}),n.d(e,"divNoNan",function(){return uu}),n.d(e,"divStrict",function(){return Ci}),n.d(e,"dot",function(){return hc}),n.d(e,"dropout",function(){return hl}),n.d(e,"elu",function(){return qc}),n.d(e,"enableDebugMode",function(){return Ye}),n.d(e,"enableProdMode",function(){return Xe}),n.d(e,"engine",function(){return tn}),n.d(e,"env",function(){return f}),n.d(e,"equal",function(){return Ru}),n.d(e,"equalStrict",function(){return Mu}),n.d(e,"erf",function(){return Zr}),n.d(e,"exp",function(){return ti}),n.d(e,"expandDims",function(){return fr}),n.d(e,"expm1",function(){return ei}),n.d(e,"eye",function(){return lu}),n.d(e,"fft",function(){return il}),n.d(e,"fill",function(){return Kn}),n.d(e,"findBackend",function(){return hn}),n.d(e,"findBackendFactory",function(){return dn}),n.d(e,"floor",function(){return ni}),n.d(e,"floorDiv",function(){return Ai}),n.d(e,"frame",function(){return vl}),n.d(e,"fused",function(){return Yl}),n.d(e,"gather",function(){return Ku}),n.d(e,"gatherND",function(){return ll}),n.d(e,"gather_util",function(){return Ui}),n.d(e,"getBackend",function(){return ln}),n.d(e,"getGradient",function(){return g}),n.d(e,"getKernel",function(){return m}),n.d(e,"getKernelsForBackend",function(){return v}),n.d(e,"grad",function(){return no}),n.d(e,"grads",function(){return ro}),n.d(e,"greater",function(){return ju}),n.d(e,"greaterEqual",function(){return Bu}),n.d(e,"greaterEqualStrict",function(){return Pu}),n.d(e,"greaterStrict",function(){return Lu}),n.d(e,"hammingWindow",function(){return gl}),n.d(e,"hannWindow",function(){return ml}),n.d(e,"ifft",function(){return ol}),n.d(e,"imag",function(){return Mn}),n.d(e,"image",function(){return Wl}),n.d(e,"inTopKAsync",function(){return xl}),n.d(e,"io",function(){return vh}),n.d(e,"irfft",function(){return sl}),n.d(e,"isFinite",function(){return pi}),n.d(e,"isInf",function(){return di}),n.d(e,"isNaN",function(){return hi}),n.d(e,"keep",function(){return an}),n.d(e,"leakyRelu",function(){return $c}),n.d(e,"less",function(){return zu}),n.d(e,"lessEqual",function(){return Uu}),n.d(e,"lessEqualStrict",function(){return Wu}),n.d(e,"lessStrict",function(){return Vu}),n.d(e,"linalg",function(){return Ml}),n.d(e,"linspace",function(){return Xn}),n.d(e,"localResponseNormalization",function(){return Yc}),n.d(e,"log",function(){return ri}),n.d(e,"log1p",function(){return ii}),n.d(e,"logSigmoid",function(){return oi}),n.d(e,"logSoftmax",function(){return lo}),n.d(e,"logSumExp",function(){return Bc}),n.d(e,"logicalAnd",function(){return nu}),n.d(e,"logicalNot",function(){return ru}),n.d(e,"logicalOr",function(){return iu}),n.d(e,"logicalXor",function(){return ou}),n.d(e,"losses",function(){return Fl}),n.d(e,"matMul",function(){return fc}),n.d(e,"math",function(){return bh}),n.d(e,"max",function(){return Pc}),n.d(e,"maxPool",function(){return wc}),n.d(e,"maxPool3d",function(){return Cc}),n.d(e,"maxPoolWithArgmax",function(){return Oc}),n.d(e,"maximum",function(){return Oi}),n.d(e,"maximumStrict",function(){return _i}),n.d(e,"mean",function(){return Lc}),n.d(e,"memory",function(){return en}),n.d(e,"min",function(){return zc}),n.d(e,"minimum",function(){return Si}),n.d(e,"minimumStrict",function(){return Di}),n.d(e,"mod",function(){return Fi}),n.d(e,"modStrict",function(){return Ti}),n.d(e,"moments",function(){return Uc}),n.d(e,"movingAverage",function(){return tl}),n.d(e,"mul",function(){return Ni}),n.d(e,"mulStrict",function(){return Ii}),n.d(e,"multiRNNCell",function(){return Zc}),n.d(e,"multinomial",function(){return fu}),n.d(e,"neg",function(){return ai}),n.d(e,"nextFrame",function(){return Lh}),n.d(e,"norm",function(){return Jc}),n.d(e,"notEqual",function(){return qu}),n.d(e,"notEqualStrict",function(){return $u}),n.d(e,"oneHot",function(){return hu}),n.d(e,"ones",function(){return Hn}),n.d(e,"onesLike",function(){return Jn}),n.d(e,"op",function(){return Nn}),n.d(e,"outerProduct",function(){return dc}),n.d(e,"pad",function(){return du}),n.d(e,"pad1d",function(){return pu}),n.d(e,"pad2d",function(){return mu}),n.d(e,"pad3d",function(){return gu}),n.d(e,"pad4d",function(){return vu}),n.d(e,"pool",function(){return Ec}),n.d(e,"pow",function(){return Ri}),n.d(e,"powStrict",function(){return Mi}),n.d(e,"prelu",function(){return Hc}),n.d(e,"print",function(){return ar}),n.d(e,"prod",function(){return Vc}),n.d(e,"profile",function(){return nn}),n.d(e,"rand",function(){return yu}),n.d(e,"randomGamma",function(){return Su}),n.d(e,"randomNormal",function(){return Du}),n.d(e,"randomUniform",function(){return Fu}),n.d(e,"range",function(){return Yn}),n.d(e,"ready",function(){return cn}),n.d(e,"real",function(){return Rn}),n.d(e,"reciprocal",function(){return si}),n.d(e,"registerBackend",function(){return pn}),n.d(e,"registerGradient",function(){return b}),n.d(e,"registerKernel",function(){return y}),n.d(e,"relu",function(){return Gc}),n.d(e,"relu6",function(){return Kc}),n.d(e,"removeBackend",function(){return fn}),n.d(e,"reshape",function(){return hr}),n.d(e,"reverse",function(){return pc}),n.d(e,"reverse1d",function(){return mc}),n.d(e,"reverse2d",function(){return gc}),n.d(e,"reverse3d",function(){return vc}),n.d(e,"reverse4d",function(){return yc}),n.d(e,"rfft",function(){return al}),n.d(e,"round",function(){return ui}),n.d(e,"rsqrt",function(){return ci}),n.d(e,"scalar",function(){return Pn}),n.d(e,"scatterND",function(){return rl}),n.d(e,"scatter_util",function(){return Gi}),n.d(e,"selu",function(){return Xc}),n.d(e,"separableConv2d",function(){return uc}),n.d(e,"serialization",function(){return Ah}),n.d(e,"setBackend",function(){return un}),n.d(e,"setPlatform",function(){return gn}),n.d(e,"setdiff1dAsync",function(){return vr}),n.d(e,"sigmoid",function(){return li}),n.d(e,"sign",function(){return fi}),n.d(e,"signal",function(){return bl}),n.d(e,"sin",function(){return mi}),n.d(e,"sinh",function(){return gi}),n.d(e,"slice",function(){return _c}),n.d(e,"slice1d",function(){return Sc}),n.d(e,"slice2d",function(){return Dc}),n.d(e,"slice3d",function(){return Fc}),n.d(e,"slice4d",function(){return Tc}),n.d(e,"slice_util",function(){return eo}),n.d(e,"softmax",function(){return co}),n.d(e,"softplus",function(){return vi}),n.d(e,"spaceToBatchND",function(){return dr}),n.d(e,"sparseToDense",function(){return cl}),n.d(e,"spectral",function(){return ul}),n.d(e,"split",function(){return ir}),n.d(e,"sqrt",function(){return yi}),n.d(e,"square",function(){return Tu}),n.d(e,"squaredDifference",function(){return Nu}),n.d(e,"squaredDifferenceStrict",function(){return ji}),n.d(e,"squeeze",function(){return pr}),n.d(e,"stack",function(){return mr}),n.d(e,"step",function(){return bi}),n.d(e,"stft",function(){return yl}),n.d(e,"stridedSlice",function(){return el}),n.d(e,"sub",function(){return Bi}),n.d(e,"subStrict",function(){return Pi}),n.d(e,"sum",function(){return Wc}),n.d(e,"sumOutType",function(){return Rt}),n.d(e,"tan",function(){return xi}),n.d(e,"tanh",function(){return wi}),n.d(e,"tensor",function(){return jn}),n.d(e,"tensor1d",function(){return Ln}),n.d(e,"tensor2d",function(){return zn}),n.d(e,"tensor3d",function(){return Un}),n.d(e,"tensor4d",function(){return Wn}),n.d(e,"tensor5d",function(){return Vn}),n.d(e,"tensor6d",function(){return qn}),n.d(e,"tensor_util",function(){return Lt}),n.d(e,"test_util",function(){return Cu}),n.d(e,"tidy",function(){return rn}),n.d(e,"tile",function(){return cu}),n.d(e,"time",function(){return sn}),n.d(e,"topk",function(){return nl}),n.d(e,"train",function(){return Bh}),n.d(e,"transpose",function(){return fo}),n.d(e,"truncatedNormal",function(){return Iu}),n.d(e,"unregisterGradient",function(){return w}),n.d(e,"unregisterKernel",function(){return x}),n.d(e,"unsortedSegmentSum",function(){return Xu}),n.d(e,"unstack",function(){return gr}),n.d(e,"util",function(){return ht}),n.d(e,"valueAndGrad",function(){return io}),n.d(e,"valueAndGrads",function(){return oo}),n.d(e,"variable",function(){return $n}),n.d(e,"variableGrads",function(){return ao}),n.d(e,"version_core",function(){return Oh}),n.d(e,"webgl",function(){return _h}),n.d(e,"where",function(){return au}),n.d(e,"whereAsync",function(){return su}),n.d(e,"zeros",function(){return Gn}),n.d(e,"zerosLike",function(){return Qn});
587
81
  /**
@@ -5129,10 +4623,18 @@ const completeSvg = 'data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iODMiIGhlaWdodD0iO
5129
4623
 
5130
4624
  class Events {
5131
4625
  static init(element) {
5132
- this.cameraModule = element;
4626
+ this.callingModule = element;
5133
4627
  }
5134
4628
  static flowStarted() {
5135
- this.cameraModule.dispatchEvent(new CustomEvent('ect-started', {
4629
+ this.callingModule.dispatchEvent(new CustomEvent('ect-started', {
4630
+ detail: {},
4631
+ bubbles: true,
4632
+ cancelable: true,
4633
+ composed: true,
4634
+ }));
4635
+ }
4636
+ static flowAborted() {
4637
+ this.callingModule.dispatchEvent(new CustomEvent('ect-aborted', {
5136
4638
  detail: {},
5137
4639
  bubbles: true,
5138
4640
  cancelable: true,
@@ -5141,7 +4643,7 @@ class Events {
5141
4643
  }
5142
4644
  static flowCompleted() {
5143
4645
  sessionStorage.clear();
5144
- this.cameraModule.dispatchEvent(new CustomEvent('ect-completed', {
4646
+ this.callingModule.dispatchEvent(new CustomEvent('ect-completed', {
5145
4647
  detail: {},
5146
4648
  bubbles: true,
5147
4649
  cancelable: true,
@@ -5150,7 +4652,7 @@ class Events {
5150
4652
  }
5151
4653
  static flowError(error) {
5152
4654
  sessionStorage.clear();
5153
- this.cameraModule.dispatchEvent(new CustomEvent('ect-error', {
4655
+ this.callingModule.dispatchEvent(new CustomEvent('ect-error', {
5154
4656
  detail: { error },
5155
4657
  bubbles: true,
5156
4658
  cancelable: true,
@@ -5158,7 +4660,7 @@ class Events {
5158
4660
  }));
5159
4661
  }
5160
4662
  static tokenExpired() {
5161
- this.cameraModule.dispatchEvent(new CustomEvent('ect-session-expired', {
4663
+ this.callingModule.dispatchEvent(new CustomEvent('ect-session-expired', {
5162
4664
  detail: {},
5163
4665
  bubbles: true,
5164
4666
  cancelable: true,
@@ -5981,7 +5483,7 @@ function v4(options, buf, offset) {
5981
5483
  return unsafeStringify(rnds);
5982
5484
  }
5983
5485
 
5984
- const identificationComponentCss = "@font-face{font-family:'Inter';font-style:normal;font-display:swap;font-weight:400;src:url('./files/inter-cyrillic-ext-400-normal.woff2') format('woff2'), url('./files/inter-all-400-normal.woff') format('woff');unicode-range:U+0460-052F,U+1C80-1C88,U+20B4,U+2DE0-2DFF,U+A640-A69F,U+FE2E-FE2F}@font-face{font-family:'Inter';font-style:normal;font-display:swap;font-weight:400;src:url('./files/inter-cyrillic-400-normal.woff2') format('woff2'), url('./files/inter-all-400-normal.woff') format('woff');unicode-range:U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116}@font-face{font-family:'Inter';font-style:normal;font-display:swap;font-weight:400;src:url('./files/inter-greek-ext-400-normal.woff2') format('woff2'), url('./files/inter-all-400-normal.woff') format('woff');unicode-range:U+1F00-1FFF}@font-face{font-family:'Inter';font-style:normal;font-display:swap;font-weight:400;src:url('./files/inter-greek-400-normal.woff2') format('woff2'), url('./files/inter-all-400-normal.woff') format('woff');unicode-range:U+0370-03FF}@font-face{font-family:'Inter';font-style:normal;font-display:swap;font-weight:400;src:url('./files/inter-vietnamese-400-normal.woff2') format('woff2'), url('./files/inter-all-400-normal.woff') format('woff');unicode-range:U+0102-0103,U+0110-0111,U+0128-0129,U+0168-0169,U+01A0-01A1,U+01AF-01B0,U+1EA0-1EF9,U+20AB}@font-face{font-family:'Inter';font-style:normal;font-display:swap;font-weight:400;src:url('./files/inter-latin-ext-400-normal.woff2') format('woff2'), url('./files/inter-all-400-normal.woff') format('woff');unicode-range:U+0100-024F,U+0259,U+1E00-1EFF,U+2020,U+20A0-20AB,U+20AD-20CF,U+2113,U+2C60-2C7F,U+A720-A7FF}@font-face{font-family:'Inter';font-style:normal;font-display:swap;font-weight:400;src:url('./files/inter-latin-400-normal.woff2') format('woff2'), url('./files/inter-all-400-normal.woff') format('woff');unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}@font-face{font-family:'Inter';font-style:normal;font-display:swap;font-weight:900;src:url('./files/inter-cyrillic-ext-900-normal.woff2') format('woff2'), url('./files/inter-all-900-normal.woff') format('woff');unicode-range:U+0460-052F,U+1C80-1C88,U+20B4,U+2DE0-2DFF,U+A640-A69F,U+FE2E-FE2F}@font-face{font-family:'Inter';font-style:normal;font-display:swap;font-weight:900;src:url('./files/inter-cyrillic-900-normal.woff2') format('woff2'), url('./files/inter-all-900-normal.woff') format('woff');unicode-range:U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116}@font-face{font-family:'Inter';font-style:normal;font-display:swap;font-weight:900;src:url('./files/inter-greek-ext-900-normal.woff2') format('woff2'), url('./files/inter-all-900-normal.woff') format('woff');unicode-range:U+1F00-1FFF}@font-face{font-family:'Inter';font-style:normal;font-display:swap;font-weight:900;src:url('./files/inter-greek-900-normal.woff2') format('woff2'), url('./files/inter-all-900-normal.woff') format('woff');unicode-range:U+0370-03FF}@font-face{font-family:'Inter';font-style:normal;font-display:swap;font-weight:900;src:url('./files/inter-vietnamese-900-normal.woff2') format('woff2'), url('./files/inter-all-900-normal.woff') format('woff');unicode-range:U+0102-0103,U+0110-0111,U+0128-0129,U+0168-0169,U+01A0-01A1,U+01AF-01B0,U+1EA0-1EF9,U+20AB}@font-face{font-family:'Inter';font-style:normal;font-display:swap;font-weight:900;src:url('./files/inter-latin-ext-900-normal.woff2') format('woff2'), url('./files/inter-all-900-normal.woff') format('woff');unicode-range:U+0100-024F,U+0259,U+1E00-1EFF,U+2020,U+20A0-20AB,U+20AD-20CF,U+2113,U+2C60-2C7F,U+A720-A7FF}@font-face{font-family:'Inter';font-style:normal;font-display:swap;font-weight:900;src:url('./files/inter-latin-900-normal.woff2') format('woff2'), url('./files/inter-all-900-normal.woff') format('woff');unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}@font-face{font-family:'Inter';font-style:normal;font-display:swap;font-weight:700;src:url('./files/inter-cyrillic-ext-700-normal.woff2') format('woff2'), url('./files/inter-all-700-normal.woff') format('woff');unicode-range:U+0460-052F,U+1C80-1C88,U+20B4,U+2DE0-2DFF,U+A640-A69F,U+FE2E-FE2F}@font-face{font-family:'Inter';font-style:normal;font-display:swap;font-weight:700;src:url('./files/inter-cyrillic-700-normal.woff2') format('woff2'), url('./files/inter-all-700-normal.woff') format('woff');unicode-range:U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116}@font-face{font-family:'Inter';font-style:normal;font-display:swap;font-weight:700;src:url('./files/inter-greek-ext-700-normal.woff2') format('woff2'), url('./files/inter-all-700-normal.woff') format('woff');unicode-range:U+1F00-1FFF}@font-face{font-family:'Inter';font-style:normal;font-display:swap;font-weight:700;src:url('./files/inter-greek-700-normal.woff2') format('woff2'), url('./files/inter-all-700-normal.woff') format('woff');unicode-range:U+0370-03FF}@font-face{font-family:'Inter';font-style:normal;font-display:swap;font-weight:700;src:url('./files/inter-vietnamese-700-normal.woff2') format('woff2'), url('./files/inter-all-700-normal.woff') format('woff');unicode-range:U+0102-0103,U+0110-0111,U+0128-0129,U+0168-0169,U+01A0-01A1,U+01AF-01B0,U+1EA0-1EF9,U+20AB}@font-face{font-family:'Inter';font-style:normal;font-display:swap;font-weight:700;src:url('./files/inter-latin-ext-700-normal.woff2') format('woff2'), url('./files/inter-all-700-normal.woff') format('woff');unicode-range:U+0100-024F,U+0259,U+1E00-1EFF,U+2020,U+20A0-20AB,U+20AD-20CF,U+2113,U+2C60-2C7F,U+A720-A7FF}@font-face{font-family:'Inter';font-style:normal;font-display:swap;font-weight:700;src:url('./files/inter-latin-700-normal.woff2') format('woff2'), url('./files/inter-all-700-normal.woff') format('woff');unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}@font-face{font-family:'Inter';font-style:normal;font-display:swap;font-weight:600;src:url('./files/inter-cyrillic-ext-600-normal.woff2') format('woff2'), url('./files/inter-all-600-normal.woff') format('woff');unicode-range:U+0460-052F,U+1C80-1C88,U+20B4,U+2DE0-2DFF,U+A640-A69F,U+FE2E-FE2F}@font-face{font-family:'Inter';font-style:normal;font-display:swap;font-weight:600;src:url('./files/inter-cyrillic-600-normal.woff2') format('woff2'), url('./files/inter-all-600-normal.woff') format('woff');unicode-range:U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116}@font-face{font-family:'Inter';font-style:normal;font-display:swap;font-weight:600;src:url('./files/inter-greek-ext-600-normal.woff2') format('woff2'), url('./files/inter-all-600-normal.woff') format('woff');unicode-range:U+1F00-1FFF}@font-face{font-family:'Inter';font-style:normal;font-display:swap;font-weight:600;src:url('./files/inter-greek-600-normal.woff2') format('woff2'), url('./files/inter-all-600-normal.woff') format('woff');unicode-range:U+0370-03FF}@font-face{font-family:'Inter';font-style:normal;font-display:swap;font-weight:600;src:url('./files/inter-vietnamese-600-normal.woff2') format('woff2'), url('./files/inter-all-600-normal.woff') format('woff');unicode-range:U+0102-0103,U+0110-0111,U+0128-0129,U+0168-0169,U+01A0-01A1,U+01AF-01B0,U+1EA0-1EF9,U+20AB}@font-face{font-family:'Inter';font-style:normal;font-display:swap;font-weight:600;src:url('./files/inter-latin-ext-600-normal.woff2') format('woff2'), url('./files/inter-all-600-normal.woff') format('woff');unicode-range:U+0100-024F,U+0259,U+1E00-1EFF,U+2020,U+20A0-20AB,U+20AD-20CF,U+2113,U+2C60-2C7F,U+A720-A7FF}@font-face{font-family:'Inter';font-style:normal;font-display:swap;font-weight:600;src:url('./files/inter-latin-600-normal.woff2') format('woff2'), url('./files/inter-all-600-normal.woff') format('woff');unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}@font-face{font-family:'Inter';font-style:normal;font-display:swap;font-weight:400;src:url('./files/inter-cyrillic-ext-400-normal.woff2') format('woff2'), url('./files/inter-all-400-normal.woff') format('woff');unicode-range:U+0460-052F,U+1C80-1C88,U+20B4,U+2DE0-2DFF,U+A640-A69F,U+FE2E-FE2F}@font-face{font-family:'Inter';font-style:normal;font-display:swap;font-weight:400;src:url('./files/inter-cyrillic-400-normal.woff2') format('woff2'), url('./files/inter-all-400-normal.woff') format('woff');unicode-range:U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116}@font-face{font-family:'Inter';font-style:normal;font-display:swap;font-weight:400;src:url('./files/inter-greek-ext-400-normal.woff2') format('woff2'), url('./files/inter-all-400-normal.woff') format('woff');unicode-range:U+1F00-1FFF}@font-face{font-family:'Inter';font-style:normal;font-display:swap;font-weight:400;src:url('./files/inter-greek-400-normal.woff2') format('woff2'), url('./files/inter-all-400-normal.woff') format('woff');unicode-range:U+0370-03FF}@font-face{font-family:'Inter';font-style:normal;font-display:swap;font-weight:400;src:url('./files/inter-vietnamese-400-normal.woff2') format('woff2'), url('./files/inter-all-400-normal.woff') format('woff');unicode-range:U+0102-0103,U+0110-0111,U+0128-0129,U+0168-0169,U+01A0-01A1,U+01AF-01B0,U+1EA0-1EF9,U+20AB}@font-face{font-family:'Inter';font-style:normal;font-display:swap;font-weight:400;src:url('./files/inter-latin-ext-400-normal.woff2') format('woff2'), url('./files/inter-all-400-normal.woff') format('woff');unicode-range:U+0100-024F,U+0259,U+1E00-1EFF,U+2020,U+20A0-20AB,U+20AD-20CF,U+2113,U+2C60-2C7F,U+A720-A7FF}@font-face{font-family:'Inter';font-style:normal;font-display:swap;font-weight:400;src:url('./files/inter-latin-400-normal.woff2') format('woff2'), url('./files/inter-all-400-normal.woff') format('woff');unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}*{font-family:'Inter', sans-serif}h1{font-weight:900;letter-spacing:0.01em;color:#1f2024;font-size:3.2vh;margin:0;line-height:3.5vh}.row-validare h1{font-size:27px;line-height:29px}body{margin:0;padding:0;height:100vh;position:relative;}.container{width:100%;height:100%;background-color:#fff;max-width:991px;margin:auto;position:relative;overflow:hidden}.container-video{height:99vh;text-align:center;position:relative;overflow:hidden}.row{padding:3.5vh 2.5vh;height:100%;overflow:hidden;position:relative;}.ctheight-100{height:99vh}.d-flex{display:flex}.space-between{justify-content:space-between}.img-info img{width:0.8vh;z-index:5;position:relative}.img-info{width:7vh;height:7vh;border-radius:100%;display:flex;align-items:center;justify-content:center;background:radial-gradient(100% 100% at 50% 0%, #d3b6e9 0%, #fbc2bd 100%)}.i-effect{animation:2.5s infinite transition-i;position:absolute;z-index:2;border-radius:100%;background:radial-gradient(100% 100% at 50% 0%, #d3b6e9 0%, #fbc2bd 100%)}.two-buttons{margin-top:3vh;justify-content:center}.align-center{align-items:center}.main-text{font-weight:400;color:#71727a}.font-size-2{font-size:2vh}.row-validare .font-size-2{font-size:17px;line-height:19px}.img-text{display:flex;align-items:center;margin-bottom:3vh}.img-text .bg-img img{width:100%;padding:2vh}.img-text h3{color:#333333;font-weight:700;font-size:2.3vh;margin:0}.img-text .bg-img{background:#e1e3e9;border-radius:30%;width:11vh;height:11vh;display:flex;align-items:center;justify-content:center;flex:none;margin-right:3vh}.font-weight-bold{font-weight:bold}.font-size-18{font-size:1.8vh}.row-validare .font-size-18{font-size:15px;line-height:16px}a{font-size:inherit;color:inherit;text-decoration:none}.color-black{color:#000}.main-button{background:#1feaa6;box-shadow:0 6px 8px rgba(71, 182, 162, 0.2);border-radius:25px;text-align:center;width:100%;padding:2vh;color:#fff;border:0;font-size:2vh}.main-button:disabled{color:#71727a}.normal-button{background:#1feaa6;box-shadow:0 6px 8px rgba(71, 182, 162, 0.2);border-radius:25px;text-align:center;padding:2vh;margin-right:1vw;margin-left:1vw;color:#fff;border:0;font-size:2vh}.red-button{background:#ff535d}.row-validare .main-button{font-size:17px}.text-right{text-align:right}.mb-1{margin-bottom:1vh}.mb-0{margin-bottom:0}.row-validare.row{padding:29px 21px}.row-validare .main-button{padding:16px}.row-validare .btn-buletin{position:relative;width:100%;bottom:0}.show-bottom{bottom:-2vh}.row-validare .main-input{padding:14px 12px;border-radius:12px;font-weight:700;border:2px solid #464e58;font-size:19px}.main-input{width:100%;padding:22px 26px;border:3px solid #464e58;border-radius:20px;font-weight:600;font-size:2.3vh;font-family:'Inter', sans-serif}.second-input{width:46px;height:46px;font-weight:700;font-size:16px;font-family:'Inter', sans-serif;text-align:center;border:2px solid #c5c6cc;border-radius:12px;outline:none;padding:2px}.second-input:not(:placeholder-shown){border:2px solid #1feaa6;color:#1feaa6}.mt-9{margin-top:9%}.second-input::placeholder{color:#fff;opacity:0}.second-input:focus{border:2px solid #464e58;color:#464e58}.second-input.error{border:2px solid #b67171}.second-input.error:focus{border:3px solid #b67171;color:#b67171;padding:1px}.second-input.error:not(:placeholder-shown){border:3px solid #b67171;color:#b67171;padding:2px}.second-input-container{margin-top:30%;display:flex;flex-wrap:wrap;justify-content:space-between}.input-container{display:flex;flex-wrap:wrap}.mt-15{margin-top:15%}.row-validare .mt-15{margin-top:40px}.mb-15{margin-bottom:15%}.row-validare .mb-15{margin-bottom:40px}.mb-20{margin-bottom:20%}.row-validare .mb-1{margin-bottom:20px}.row-validare .mb-20{margin-bottom:60px}.mt-90{margin-top:90px}.op-05{opacity:0.5}.color-red{color:#b67171}.error-text{position:relative;top:50px;margin-bottom:0;margin-top:0}.top-50{top:50px}.mt-25{margin-top:25%}.text-center{text-align:center}.scale-2{transform:scale(2)}.mt-20{margin-top:20%}.div-ci img{max-height:60vh;max-width:80vw}.div-ci{text-align:center}.mt-10{margin-top:10vh}.pos-relative{position:relative}.pos-absolute{position:absolute}.btn-buletin{text-align:center}.buletin-container img{width:60%}.buletin-container>img{margin-top:10vh}.buletin-container{text-align:center}.bg-black{background-color:#242426}.color-white{color:#fff}.chenar-buletin{margin-top:3em;text-align:center}.chenar-buletin .ci-img{width:96%}.chenar-buletin .face-img,.chenar-buletin .chenar-img{left:4%;width:92%;top:-20px;min-height:55vw;display:flex;position:absolute;align-items:center;background-color:rgba(255, 255, 255, 0.2);justify-content:center}.chenar-buletin img{width:auto;height:100%;top:0;left:0;position:absolute;border-radius:10px;z-index:4}.chenar-buletin .face-img{background-color:rgba(255, 255, 255, 0.3)}.buletin-container .w-40{width:40%}.animation{width:100%;height:100%;}.color-black-2{color:#71727a}.font-size-3{font-size:3vh}.font-weight-900{font-weight:900}.mt-8{margin-top:8vh}.mt-12{margin-top:12vh}.mt-30-i{margin-top:30% !important}.chenar-buletin .face-img{left:-2%;width:104%;top:-40px}.pl-2-5{padding-left:2.5vh}.container-coin{background-color:transparent;perspective:1000px;rotate:120deg 0deg}.dot-effect{position:fixed;bottom:13vh;width:calc(100% - 5vh);text-align:center;display:flex;align-items:center;justify-content:center}.coin-flip{animation:flip 0.4s ease-in;animation-delay:0.5s;transform-style:preserve-3d;animation-fill-mode:forwards;visibility:hidden}.coin-scale{animation:show 0.4s ease-in;animation-delay:0.5s;transform-style:preserve-3d;animation-fill-mode:forwards}.scroll{margin:4px, 4px;padding:4px;height:70vh;overflow-x:hidden;overflow-y:auto}.video-demo{z-index:0;width:100%;height:100%;border-radius:20px}.video-capture{padding:2.5vh 2.5vh;margin-top:3em;text-align:center;position:relative}.capture-title{z-index:4;margin-top:3vh;position:absolute;bottom:5vh;padding:2.5vh 2.5vh}@keyframes transition-i{from{width:0;height:0;opacity:1}80%{width:10vh;height:10vh;opacity:0.5}100%{opacity:0}}@keyframes flip{0%{transform:rotateX(140deg);visibility:visible}25%{transform:rotateX(120deg);visibility:visible}50%{transform:rotateX(90deg);visibility:visible}75%{transform:rotateX(75deg);visibility:visible}100%{transform:rotateX(0deg);visibility:visible}}@keyframes show{0%{transform:scale(0)}25%{transform:scale(0.2)}40%{transform:scale(0.4)}50%{transform:scale(0.5)}60%{transform:scale(0.6)}70%{transform:scale(0.7)}100%{transform:scale(1)}}@keyframes rise{0%{visibility:hidden}50%{visibility:visible}100%{visibility:visible}}.dot-shuttle{position:relative;left:-15px;width:12px;height:12px;border-radius:6px;background-color:#1feaa6;color:transparent;margin:-1px 0;opacity:1}.dot-shuttle::before{opacity:0.5}.dot-shuttle::after{opacity:0.5}.dot-shuttle::before,.dot-shuttle::after{content:'';display:inline-block;position:absolute;top:0;width:12px;height:12px;border-radius:6px;background-color:#1feaa6;color:transparent}.dot-shuttle::before{left:0;animation:dotShuttle 2s infinite ease-out}.dot-shuttle::after{left:0;animation:dotShuttle 2s infinite ease-out;animation-delay:1s}.buletin-container.rotate-x img{animation:transform-rotate-x 2s infinite ease-in}.rotateimg90{animation:transform-rotate-x2 2s forwards;animation-delay:1s;position:absolute}.rotateimg180{animation:transform-rotate-x3 2s forwards;animation-delay:3s;position:absolute;opacity:0}.buletin-back{display:flex;justify-content:center}@keyframes transform-rotate-x3{from{transform:rotateY(-90deg);opacity:1}to{transform:rotateY(0deg);opacity:1}}@keyframes transform-rotate-x2{to{transform:rotateY(90deg)}}@keyframes transform-rotate-x{to{transform:perspective(600px) rotateX(40deg)}}@keyframes dotShuttle{0%,50%,100%{transform:translateX(0);opacity:1}25%{transform:translateX(-30px);opacity:0.5}75%{transform:translateX(30px);opacity:0.5}}@media only screen and (max-width: 350px){.second-input{width:36px;height:36px}}@media only screen and (max-width: 390px){.second-input{width:40px;height:40px}}@media only screen and (min-width: 530px) and (max-width: 767px){.chenar-buletin .face-img{width:70%;min-height:auto;margin:auto;left:15%;right:auto;top:-15vh}}@media only screen and (min-width: 600px) and (max-width: 767px){.max-h img{margin-left:15%;margin-right:15%}.max-h{display:flex;align-items:center}}@media only screen and (max-width: 991px){.buletin-container img{max-width:220px}}@media only screen and (min-width: 767px){.container{max-width:530px;margin:40px auto;border-radius:20px;box-shadow:1px 1px 10px rgba(0, 0, 0, 0.1)}body{height:90vh}.btn-buletin{max-width:490px;bottom:7vh}.buletin-container img{width:45%}.chenar-buletin .face-img,.chenar-buletin .chenar-img{min-height:300px}.chenar-buletin .face-img{width:80%;min-height:auto;margin:auto;left:10%;right:auto;top:-10vh}.dot-effect{max-width:490px}}";
5486
+ const identificationComponentCss = "@font-face{font-family:'Inter';font-style:normal;font-display:swap;font-weight:400;src:url('./files/inter-cyrillic-ext-400-normal.woff2') format('woff2'), url('./files/inter-all-400-normal.woff') format('woff');unicode-range:U+0460-052F,U+1C80-1C88,U+20B4,U+2DE0-2DFF,U+A640-A69F,U+FE2E-FE2F}@font-face{font-family:'Inter';font-style:normal;font-display:swap;font-weight:400;src:url('./files/inter-cyrillic-400-normal.woff2') format('woff2'), url('./files/inter-all-400-normal.woff') format('woff');unicode-range:U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116}@font-face{font-family:'Inter';font-style:normal;font-display:swap;font-weight:400;src:url('./files/inter-greek-ext-400-normal.woff2') format('woff2'), url('./files/inter-all-400-normal.woff') format('woff');unicode-range:U+1F00-1FFF}@font-face{font-family:'Inter';font-style:normal;font-display:swap;font-weight:400;src:url('./files/inter-greek-400-normal.woff2') format('woff2'), url('./files/inter-all-400-normal.woff') format('woff');unicode-range:U+0370-03FF}@font-face{font-family:'Inter';font-style:normal;font-display:swap;font-weight:400;src:url('./files/inter-vietnamese-400-normal.woff2') format('woff2'), url('./files/inter-all-400-normal.woff') format('woff');unicode-range:U+0102-0103,U+0110-0111,U+0128-0129,U+0168-0169,U+01A0-01A1,U+01AF-01B0,U+1EA0-1EF9,U+20AB}@font-face{font-family:'Inter';font-style:normal;font-display:swap;font-weight:400;src:url('./files/inter-latin-ext-400-normal.woff2') format('woff2'), url('./files/inter-all-400-normal.woff') format('woff');unicode-range:U+0100-024F,U+0259,U+1E00-1EFF,U+2020,U+20A0-20AB,U+20AD-20CF,U+2113,U+2C60-2C7F,U+A720-A7FF}@font-face{font-family:'Inter';font-style:normal;font-display:swap;font-weight:400;src:url('./files/inter-latin-400-normal.woff2') format('woff2'), url('./files/inter-all-400-normal.woff') format('woff');unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}@font-face{font-family:'Inter';font-style:normal;font-display:swap;font-weight:900;src:url('./files/inter-cyrillic-ext-900-normal.woff2') format('woff2'), url('./files/inter-all-900-normal.woff') format('woff');unicode-range:U+0460-052F,U+1C80-1C88,U+20B4,U+2DE0-2DFF,U+A640-A69F,U+FE2E-FE2F}@font-face{font-family:'Inter';font-style:normal;font-display:swap;font-weight:900;src:url('./files/inter-cyrillic-900-normal.woff2') format('woff2'), url('./files/inter-all-900-normal.woff') format('woff');unicode-range:U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116}@font-face{font-family:'Inter';font-style:normal;font-display:swap;font-weight:900;src:url('./files/inter-greek-ext-900-normal.woff2') format('woff2'), url('./files/inter-all-900-normal.woff') format('woff');unicode-range:U+1F00-1FFF}@font-face{font-family:'Inter';font-style:normal;font-display:swap;font-weight:900;src:url('./files/inter-greek-900-normal.woff2') format('woff2'), url('./files/inter-all-900-normal.woff') format('woff');unicode-range:U+0370-03FF}@font-face{font-family:'Inter';font-style:normal;font-display:swap;font-weight:900;src:url('./files/inter-vietnamese-900-normal.woff2') format('woff2'), url('./files/inter-all-900-normal.woff') format('woff');unicode-range:U+0102-0103,U+0110-0111,U+0128-0129,U+0168-0169,U+01A0-01A1,U+01AF-01B0,U+1EA0-1EF9,U+20AB}@font-face{font-family:'Inter';font-style:normal;font-display:swap;font-weight:900;src:url('./files/inter-latin-ext-900-normal.woff2') format('woff2'), url('./files/inter-all-900-normal.woff') format('woff');unicode-range:U+0100-024F,U+0259,U+1E00-1EFF,U+2020,U+20A0-20AB,U+20AD-20CF,U+2113,U+2C60-2C7F,U+A720-A7FF}@font-face{font-family:'Inter';font-style:normal;font-display:swap;font-weight:900;src:url('./files/inter-latin-900-normal.woff2') format('woff2'), url('./files/inter-all-900-normal.woff') format('woff');unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}@font-face{font-family:'Inter';font-style:normal;font-display:swap;font-weight:700;src:url('./files/inter-cyrillic-ext-700-normal.woff2') format('woff2'), url('./files/inter-all-700-normal.woff') format('woff');unicode-range:U+0460-052F,U+1C80-1C88,U+20B4,U+2DE0-2DFF,U+A640-A69F,U+FE2E-FE2F}@font-face{font-family:'Inter';font-style:normal;font-display:swap;font-weight:700;src:url('./files/inter-cyrillic-700-normal.woff2') format('woff2'), url('./files/inter-all-700-normal.woff') format('woff');unicode-range:U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116}@font-face{font-family:'Inter';font-style:normal;font-display:swap;font-weight:700;src:url('./files/inter-greek-ext-700-normal.woff2') format('woff2'), url('./files/inter-all-700-normal.woff') format('woff');unicode-range:U+1F00-1FFF}@font-face{font-family:'Inter';font-style:normal;font-display:swap;font-weight:700;src:url('./files/inter-greek-700-normal.woff2') format('woff2'), url('./files/inter-all-700-normal.woff') format('woff');unicode-range:U+0370-03FF}@font-face{font-family:'Inter';font-style:normal;font-display:swap;font-weight:700;src:url('./files/inter-vietnamese-700-normal.woff2') format('woff2'), url('./files/inter-all-700-normal.woff') format('woff');unicode-range:U+0102-0103,U+0110-0111,U+0128-0129,U+0168-0169,U+01A0-01A1,U+01AF-01B0,U+1EA0-1EF9,U+20AB}@font-face{font-family:'Inter';font-style:normal;font-display:swap;font-weight:700;src:url('./files/inter-latin-ext-700-normal.woff2') format('woff2'), url('./files/inter-all-700-normal.woff') format('woff');unicode-range:U+0100-024F,U+0259,U+1E00-1EFF,U+2020,U+20A0-20AB,U+20AD-20CF,U+2113,U+2C60-2C7F,U+A720-A7FF}@font-face{font-family:'Inter';font-style:normal;font-display:swap;font-weight:700;src:url('./files/inter-latin-700-normal.woff2') format('woff2'), url('./files/inter-all-700-normal.woff') format('woff');unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}@font-face{font-family:'Inter';font-style:normal;font-display:swap;font-weight:600;src:url('./files/inter-cyrillic-ext-600-normal.woff2') format('woff2'), url('./files/inter-all-600-normal.woff') format('woff');unicode-range:U+0460-052F,U+1C80-1C88,U+20B4,U+2DE0-2DFF,U+A640-A69F,U+FE2E-FE2F}@font-face{font-family:'Inter';font-style:normal;font-display:swap;font-weight:600;src:url('./files/inter-cyrillic-600-normal.woff2') format('woff2'), url('./files/inter-all-600-normal.woff') format('woff');unicode-range:U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116}@font-face{font-family:'Inter';font-style:normal;font-display:swap;font-weight:600;src:url('./files/inter-greek-ext-600-normal.woff2') format('woff2'), url('./files/inter-all-600-normal.woff') format('woff');unicode-range:U+1F00-1FFF}@font-face{font-family:'Inter';font-style:normal;font-display:swap;font-weight:600;src:url('./files/inter-greek-600-normal.woff2') format('woff2'), url('./files/inter-all-600-normal.woff') format('woff');unicode-range:U+0370-03FF}@font-face{font-family:'Inter';font-style:normal;font-display:swap;font-weight:600;src:url('./files/inter-vietnamese-600-normal.woff2') format('woff2'), url('./files/inter-all-600-normal.woff') format('woff');unicode-range:U+0102-0103,U+0110-0111,U+0128-0129,U+0168-0169,U+01A0-01A1,U+01AF-01B0,U+1EA0-1EF9,U+20AB}@font-face{font-family:'Inter';font-style:normal;font-display:swap;font-weight:600;src:url('./files/inter-latin-ext-600-normal.woff2') format('woff2'), url('./files/inter-all-600-normal.woff') format('woff');unicode-range:U+0100-024F,U+0259,U+1E00-1EFF,U+2020,U+20A0-20AB,U+20AD-20CF,U+2113,U+2C60-2C7F,U+A720-A7FF}@font-face{font-family:'Inter';font-style:normal;font-display:swap;font-weight:600;src:url('./files/inter-latin-600-normal.woff2') format('woff2'), url('./files/inter-all-600-normal.woff') format('woff');unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}@font-face{font-family:'Inter';font-style:normal;font-display:swap;font-weight:400;src:url('./files/inter-cyrillic-ext-400-normal.woff2') format('woff2'), url('./files/inter-all-400-normal.woff') format('woff');unicode-range:U+0460-052F,U+1C80-1C88,U+20B4,U+2DE0-2DFF,U+A640-A69F,U+FE2E-FE2F}@font-face{font-family:'Inter';font-style:normal;font-display:swap;font-weight:400;src:url('./files/inter-cyrillic-400-normal.woff2') format('woff2'), url('./files/inter-all-400-normal.woff') format('woff');unicode-range:U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116}@font-face{font-family:'Inter';font-style:normal;font-display:swap;font-weight:400;src:url('./files/inter-greek-ext-400-normal.woff2') format('woff2'), url('./files/inter-all-400-normal.woff') format('woff');unicode-range:U+1F00-1FFF}@font-face{font-family:'Inter';font-style:normal;font-display:swap;font-weight:400;src:url('./files/inter-greek-400-normal.woff2') format('woff2'), url('./files/inter-all-400-normal.woff') format('woff');unicode-range:U+0370-03FF}@font-face{font-family:'Inter';font-style:normal;font-display:swap;font-weight:400;src:url('./files/inter-vietnamese-400-normal.woff2') format('woff2'), url('./files/inter-all-400-normal.woff') format('woff');unicode-range:U+0102-0103,U+0110-0111,U+0128-0129,U+0168-0169,U+01A0-01A1,U+01AF-01B0,U+1EA0-1EF9,U+20AB}@font-face{font-family:'Inter';font-style:normal;font-display:swap;font-weight:400;src:url('./files/inter-latin-ext-400-normal.woff2') format('woff2'), url('./files/inter-all-400-normal.woff') format('woff');unicode-range:U+0100-024F,U+0259,U+1E00-1EFF,U+2020,U+20A0-20AB,U+20AD-20CF,U+2113,U+2C60-2C7F,U+A720-A7FF}@font-face{font-family:'Inter';font-style:normal;font-display:swap;font-weight:400;src:url('./files/inter-latin-400-normal.woff2') format('woff2'), url('./files/inter-all-400-normal.woff') format('woff');unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}*{font-family:'Inter', sans-serif}h1{font-weight:900;letter-spacing:0.01em;color:#1f2024;font-size:3.2vh;margin:0;line-height:3.5vh}.row-validare h1{font-size:27px;line-height:29px}body{margin:0;padding:0;height:100vh;position:relative;}.container{width:100%;height:100%;background-color:#fff;max-width:991px;margin:auto;position:relative;overflow:hidden}.container-video{height:99vh;text-align:center;position:relative;overflow:hidden}.row{padding:3.5vh 2.5vh;height:100%;overflow:hidden;position:relative;}.ctheight-100{height:99vh}.d-flex{display:flex}.space-between{justify-content:space-between}.img-info img{width:0.8vh;z-index:5;position:relative}.img-info{width:7vh;height:7vh;border-radius:100%;display:flex;align-items:center;justify-content:center;background:radial-gradient(100% 100% at 50% 0%, #d3b6e9 0%, #fbc2bd 100%)}.i-effect{animation:2.5s infinite transition-i;position:absolute;z-index:2;border-radius:100%;background:radial-gradient(100% 100% at 50% 0%, #d3b6e9 0%, #fbc2bd 100%)}.two-buttons{margin-top:3vh;justify-content:center}.align-center{align-items:center}.main-text{font-weight:400;color:#71727a}.link-text{margin-top:1vh;text-decoration:underline}.font-size-2{font-size:2vh}.row-validare .font-size-2{font-size:17px;line-height:19px}.img-text{display:flex;align-items:center;margin-bottom:3vh}.img-text .bg-img img{width:100%;padding:2vh}.img-text h3{color:#333333;font-weight:700;font-size:2.3vh;margin:0}.img-text .bg-img{background:#e1e3e9;border-radius:30%;width:11vh;height:11vh;display:flex;align-items:center;justify-content:center;flex:none;margin-right:3vh}.font-weight-bold{font-weight:bold}.font-size-18{font-size:1.8vh}.row-validare .font-size-18{font-size:15px;line-height:16px}a{font-size:inherit;color:inherit;text-decoration:none}.color-black{color:#000}.main-button{background:#1feaa6;box-shadow:0 6px 8px rgba(71, 182, 162, 0.2);border-radius:25px;text-align:center;width:100%;padding:2vh;color:#fff;border:0;font-size:2vh}.main-button:disabled{color:#71727a}.normal-button{background:#1feaa6;box-shadow:0 6px 8px rgba(71, 182, 162, 0.2);border-radius:25px;text-align:center;padding:2vh;margin-right:1vw;margin-left:1vw;color:#fff;border:0;font-size:2vh}.red-button{background:#ff535d}.row-validare .main-button{font-size:17px}.text-right{text-align:right}.mb-1{margin-bottom:1vh}.mb-0{margin-bottom:0}.row-validare.row{padding:29px 21px}.row-validare .main-button{padding:16px}.row-validare .btn-buletin{position:relative;width:100%;bottom:0}.show-bottom{bottom:-2vh}.row-validare .main-input{padding:14px 12px;border-radius:12px;font-weight:700;border:2px solid #464e58;font-size:19px}.main-input{width:100%;padding:22px 26px;border:3px solid #464e58;border-radius:20px;font-weight:600;font-size:2.3vh;font-family:'Inter', sans-serif}.second-input{width:46px;height:46px;font-weight:700;font-size:16px;font-family:'Inter', sans-serif;text-align:center;border:2px solid #c5c6cc;border-radius:12px;outline:none;padding:2px}.second-input:not(:placeholder-shown){border:2px solid #1feaa6;color:#1feaa6}.mt-9{margin-top:9%}.second-input::placeholder{color:#fff;opacity:0}.second-input:focus{border:2px solid #464e58;color:#464e58}.second-input.error{border:2px solid #b67171}.second-input.error:focus{border:3px solid #b67171;color:#b67171;padding:1px}.second-input.error:not(:placeholder-shown){border:3px solid #b67171;color:#b67171;padding:2px}.second-input-container{margin-top:30%;display:flex;flex-wrap:wrap;justify-content:space-between}.input-container{display:flex;flex-wrap:wrap}.mt-15{margin-top:15%}.row-validare .mt-15{margin-top:40px}.mb-15{margin-bottom:15%}.row-validare .mb-15{margin-bottom:40px}.mb-20{margin-bottom:20%}.row-validare .mb-1{margin-bottom:20px}.row-validare .mb-20{margin-bottom:60px}.mt-90{margin-top:90px}.op-05{opacity:0.5}.color-red{color:#b67171}.error-text{position:relative;top:50px;margin-bottom:0;margin-top:0}.top-50{top:50px}.mt-25{margin-top:25%}.text-center{text-align:center}.scale-2{transform:scale(2)}.mt-20{margin-top:20%}.div-ci img{max-height:60vh;max-width:80vw}.div-ci{text-align:center}.mt-10{margin-top:10vh}.pos-relative{position:relative}.pos-absolute{position:absolute}.btn-buletin{text-align:center}.buletin-container img{width:60%}.buletin-container>img{margin-top:10vh}.buletin-container{text-align:center}.bg-black{background-color:#242426}.color-white{color:#fff}.chenar-buletin{margin-top:3em;text-align:center}.chenar-buletin .ci-img{width:96%}.chenar-buletin .face-img,.chenar-buletin .chenar-img{left:4%;width:92%;top:-20px;min-height:55vw;display:flex;position:absolute;align-items:center;background-color:rgba(255, 255, 255, 0.2);justify-content:center}.chenar-buletin img{width:auto;height:100%;top:0;left:0;position:absolute;border-radius:10px;z-index:4}.chenar-buletin .face-img{background-color:rgba(255, 255, 255, 0.3)}.buletin-container .w-40{width:40%}.animation{width:100%;height:100%;}.color-black-2{color:#71727a}.font-size-3{font-size:3vh}.font-weight-900{font-weight:900}.mt-8{margin-top:8vh}.mt-12{margin-top:12vh}.mt-30-i{margin-top:30% !important}.chenar-buletin .face-img{left:-2%;width:104%;top:-40px}.pl-2-5{padding-left:2.5vh}.container-coin{background-color:transparent;perspective:1000px;rotate:120deg 0deg}.coin-flip{animation:flip 0.4s ease-in;animation-delay:0.5s;transform-style:preserve-3d;animation-fill-mode:forwards;visibility:hidden}.coin-scale{animation:show 0.4s ease-in;animation-delay:0.5s;transform-style:preserve-3d;animation-fill-mode:forwards}.scroll{margin:4px, 4px;padding:4px;height:70vh;overflow-x:hidden;overflow-y:auto}.video-demo{z-index:0;width:100%;height:100%;border-radius:20px}.video-capture{padding:2.5vh 2.5vh;margin-top:3em;text-align:center;position:relative}.capture-title{z-index:4;margin-top:3vh;position:absolute;bottom:5vh;padding:2.5vh 2.5vh}@keyframes transition-i{from{width:0;height:0;opacity:1}80%{width:10vh;height:10vh;opacity:0.5}100%{opacity:0}}@keyframes flip{0%{transform:rotateX(140deg);visibility:visible}25%{transform:rotateX(120deg);visibility:visible}50%{transform:rotateX(90deg);visibility:visible}75%{transform:rotateX(75deg);visibility:visible}100%{transform:rotateX(0deg);visibility:visible}}@keyframes show{0%{transform:scale(0)}25%{transform:scale(0.2)}40%{transform:scale(0.4)}50%{transform:scale(0.5)}60%{transform:scale(0.6)}70%{transform:scale(0.7)}100%{transform:scale(1)}}@keyframes rise{0%{visibility:hidden}50%{visibility:visible}100%{visibility:visible}}.buletin-container.rotate-x img{animation:transform-rotate-x 2s infinite ease-in}.rotateimg90{animation:transform-rotate-x2 2s forwards;animation-delay:1s;position:absolute}.rotateimg180{animation:transform-rotate-x3 2s forwards;animation-delay:3s;position:absolute;opacity:0}.buletin-back{display:flex;justify-content:center}@keyframes transform-rotate-x3{from{transform:rotateY(-90deg);opacity:1}to{transform:rotateY(0deg);opacity:1}}@keyframes transform-rotate-x2{to{transform:rotateY(90deg)}}@keyframes transform-rotate-x{to{transform:perspective(600px) rotateX(40deg)}}@media only screen and (max-width: 350px){.second-input{width:36px;height:36px}}@media only screen and (max-width: 390px){.second-input{width:40px;height:40px}}@media only screen and (min-width: 530px) and (max-width: 767px){.chenar-buletin .face-img{width:70%;min-height:auto;margin:auto;left:15%;right:auto;top:-15vh}}@media only screen and (min-width: 600px) and (max-width: 767px){.max-h img{margin-left:15%;margin-right:15%}.max-h{display:flex;align-items:center}}@media only screen and (max-width: 991px){.buletin-container img{max-width:220px}}@media only screen and (min-width: 767px){.container{max-width:530px;margin:40px auto;border-radius:20px;box-shadow:1px 1px 10px rgba(0, 0, 0, 0.1)}body{height:90vh}.btn-buletin{max-width:490px;bottom:7vh}.buletin-container img{width:45%}.chenar-buletin .face-img,.chenar-buletin .chenar-img{min-height:300px}.chenar-buletin .face-img{width:80%;min-height:auto;margin:auto;left:10%;right:auto;top:-10vh}}";
5985
5487
 
5986
5488
  const IdentificationComponent = class {
5987
5489
  async onTokenChange(newValue, _oldValue) {
@@ -6077,7 +5579,7 @@ const IdentificationComponent = class {
6077
5579
  this.api_url = undefined;
6078
5580
  this.env = undefined;
6079
5581
  this.redirect_id = undefined;
6080
- this.otp_phone_number = undefined;
5582
+ this.phone_number = undefined;
6081
5583
  this.idSide = '';
6082
5584
  this.errorMessage = undefined;
6083
5585
  this.errorTitle = undefined;
@@ -6097,8 +5599,8 @@ const IdentificationComponent = class {
6097
5599
  if (this.redirect_id) {
6098
5600
  state.redirectId = this.redirect_id;
6099
5601
  }
6100
- if (this.otp_phone_number) {
6101
- state.phoneNumber = this.otp_phone_number;
5602
+ if (this.phone_number) {
5603
+ state.phoneNumber = this.phone_number;
6102
5604
  }
6103
5605
  var flowSt = sessionStorage.getItem(SessionKeys.FlowStatusKey);
6104
5606
  if (flowSt) {
@@ -6164,14 +5666,11 @@ const IdentificationComponent = class {
6164
5666
  }
6165
5667
  render() {
6166
5668
  let currentBlock = h("div", null);
6167
- if (this.device.isMobile) {
5669
+ {
6168
5670
  if (state.flowStatus == FlowStatus.LANDING) {
6169
5671
  currentBlock = h("landing-validation", { device: this.device });
6170
5672
  }
6171
5673
  }
6172
- else {
6173
- currentBlock = h("mobile-redirect", null);
6174
- }
6175
5674
  if (state.flowStatus == FlowStatus.AGREEMENT) {
6176
5675
  currentBlock = h("agreement-info", null);
6177
5676
  }
@@ -6207,7 +5706,7 @@ const IdentificationComponent = class {
6207
5706
  "api_url": ["onApiUrlChange"],
6208
5707
  "env": ["onEnvChange"],
6209
5708
  "redirect_id": ["onRedirectIdChange"],
6210
- "otp_phone_number": ["onPhoneChange"]
5709
+ "phone_number": ["onPhoneChange"]
6211
5710
  }; }
6212
5711
  };
6213
5712
  IdentificationComponent.style = identificationComponentCss;
@@ -6257,2973 +5756,16 @@ const LandingValidation = class {
6257
5756
  }
6258
5757
  }
6259
5758
  }
5759
+ async leaveFlow() {
5760
+ state.initialised = false;
5761
+ Events.flowAborted();
5762
+ }
6260
5763
  render() {
6261
- return (h("div", { class: "container" }, h("div", { class: "row" }, h("div", null, h("h1", { class: "text-center" }, LandingValues.Title), h("div", { class: "d-flex space-between align-center" }, h("p", { class: "main-text font-size-2" }, LandingValues.Description), h("div", { class: "img-info" }, h("div", { class: "i-effect" }), h("img", { src: infoSvg })))), h("div", { class: "info-container" }, h("div", { class: "img-text" }, h("div", { class: "bg-img" }, h("img", { src: idSvg })), h("h3", null, LandingValues.IdInfo)), h("div", { class: "img-text" }, h("div", { class: "bg-img" }, h("img", { src: deviceSvg })), h("h3", null, LandingValues.DeviceInfo)), h("div", { class: "img-text" }, h("div", { class: "bg-img" }, h("img", { src: validationSvg })), h("h3", null, LandingValues.SmsInfo))), h("div", { class: "terms-container" }, h("h3", { class: "font-size-2 mb-1 text-center" }, this.warningText)), h("div", { class: "pos-relative show-bottom" }, h("div", { class: "btn-buletin" }, h("button", { class: "main-button", disabled: !state.initialised, onClick: () => this.startFlow() }, LandingValues.Button), h("p", { class: "main-text font-size-18 text-right mb-0" }, LandingValues.FooterText))))));
5764
+ return (h("div", { class: "container" }, h("div", { class: "row" }, h("div", null, h("h1", { class: "text-center" }, LandingValues.Title), h("div", { class: "d-flex space-between align-center" }, h("p", { class: "main-text font-size-2" }, LandingValues.Description), h("div", { class: "img-info" }, h("div", { class: "i-effect" }), h("img", { src: infoSvg })))), h("div", { class: "info-container" }, h("div", { class: "img-text" }, h("div", { class: "bg-img" }, h("img", { src: idSvg })), h("h3", null, LandingValues.IdInfo)), h("div", { class: "img-text" }, h("div", { class: "bg-img" }, h("img", { src: deviceSvg })), h("h3", null, LandingValues.DeviceInfo)), h("div", { class: "img-text" }, h("div", { class: "bg-img" }, h("img", { src: validationSvg })), h("h3", null, LandingValues.SmsInfo))), h("div", { class: "terms-container" }, h("h3", { class: "font-size-2 mb-1 text-center" }, this.warningText)), h("div", { class: "pos-relative show-bottom" }, h("div", { class: "btn-buletin" }, h("button", { class: "main-button", type: "button", disabled: !state.initialised, onClick: () => this.startFlow() }, LandingValues.Button), h("p", { class: "main-text font-size-2 link-text mb-0", onClick: () => this.leaveFlow() }, LandingValues.ButtonLeave), h("p", { class: "main-text font-size-18 text-right mb-0" }, LandingValues.FooterText))))));
6262
5765
  }
6263
5766
  };
6264
5767
  LandingValidation.style = landingValidationCss;
6265
5768
 
6266
- // can-promise has a crash in some versions of react native that dont have
6267
- // standard global objects
6268
- // https://github.com/soldair/node-qrcode/issues/157
6269
-
6270
- var canPromise = function () {
6271
- return typeof Promise === 'function' && Promise.prototype && Promise.prototype.then
6272
- };
6273
-
6274
- let toSJISFunction;
6275
- const CODEWORDS_COUNT = [
6276
- 0, // Not used
6277
- 26, 44, 70, 100, 134, 172, 196, 242, 292, 346,
6278
- 404, 466, 532, 581, 655, 733, 815, 901, 991, 1085,
6279
- 1156, 1258, 1364, 1474, 1588, 1706, 1828, 1921, 2051, 2185,
6280
- 2323, 2465, 2611, 2761, 2876, 3034, 3196, 3362, 3532, 3706
6281
- ];
6282
-
6283
- /**
6284
- * Returns the QR Code size for the specified version
6285
- *
6286
- * @param {Number} version QR Code version
6287
- * @return {Number} size of QR code
6288
- */
6289
- var getSymbolSize$1 = function getSymbolSize (version) {
6290
- if (!version) throw new Error('"version" cannot be null or undefined')
6291
- if (version < 1 || version > 40) throw new Error('"version" should be in range from 1 to 40')
6292
- return version * 4 + 17
6293
- };
6294
-
6295
- /**
6296
- * Returns the total number of codewords used to store data and EC information.
6297
- *
6298
- * @param {Number} version QR Code version
6299
- * @return {Number} Data length in bits
6300
- */
6301
- var getSymbolTotalCodewords = function getSymbolTotalCodewords (version) {
6302
- return CODEWORDS_COUNT[version]
6303
- };
6304
-
6305
- /**
6306
- * Encode data with Bose-Chaudhuri-Hocquenghem
6307
- *
6308
- * @param {Number} data Value to encode
6309
- * @return {Number} Encoded value
6310
- */
6311
- var getBCHDigit = function (data) {
6312
- let digit = 0;
6313
-
6314
- while (data !== 0) {
6315
- digit++;
6316
- data >>>= 1;
6317
- }
6318
-
6319
- return digit
6320
- };
6321
-
6322
- var setToSJISFunction = function setToSJISFunction (f) {
6323
- if (typeof f !== 'function') {
6324
- throw new Error('"toSJISFunc" is not a valid function.')
6325
- }
6326
-
6327
- toSJISFunction = f;
6328
- };
6329
-
6330
- var isKanjiModeEnabled = function () {
6331
- return typeof toSJISFunction !== 'undefined'
6332
- };
6333
-
6334
- var toSJIS = function toSJIS (kanji) {
6335
- return toSJISFunction(kanji)
6336
- };
6337
-
6338
- var utils$1 = {
6339
- getSymbolSize: getSymbolSize$1,
6340
- getSymbolTotalCodewords: getSymbolTotalCodewords,
6341
- getBCHDigit: getBCHDigit,
6342
- setToSJISFunction: setToSJISFunction,
6343
- isKanjiModeEnabled: isKanjiModeEnabled,
6344
- toSJIS: toSJIS
6345
- };
6346
-
6347
- var errorCorrectionLevel = createCommonjsModule(function (module, exports) {
6348
- exports.L = { bit: 1 };
6349
- exports.M = { bit: 0 };
6350
- exports.Q = { bit: 3 };
6351
- exports.H = { bit: 2 };
6352
-
6353
- function fromString (string) {
6354
- if (typeof string !== 'string') {
6355
- throw new Error('Param is not a string')
6356
- }
6357
-
6358
- const lcStr = string.toLowerCase();
6359
-
6360
- switch (lcStr) {
6361
- case 'l':
6362
- case 'low':
6363
- return exports.L
6364
-
6365
- case 'm':
6366
- case 'medium':
6367
- return exports.M
6368
-
6369
- case 'q':
6370
- case 'quartile':
6371
- return exports.Q
6372
-
6373
- case 'h':
6374
- case 'high':
6375
- return exports.H
6376
-
6377
- default:
6378
- throw new Error('Unknown EC Level: ' + string)
6379
- }
6380
- }
6381
-
6382
- exports.isValid = function isValid (level) {
6383
- return level && typeof level.bit !== 'undefined' &&
6384
- level.bit >= 0 && level.bit < 4
6385
- };
6386
-
6387
- exports.from = function from (value, defaultValue) {
6388
- if (exports.isValid(value)) {
6389
- return value
6390
- }
6391
-
6392
- try {
6393
- return fromString(value)
6394
- } catch (e) {
6395
- return defaultValue
6396
- }
6397
- };
6398
- });
6399
-
6400
- function BitBuffer () {
6401
- this.buffer = [];
6402
- this.length = 0;
6403
- }
6404
-
6405
- BitBuffer.prototype = {
6406
-
6407
- get: function (index) {
6408
- const bufIndex = Math.floor(index / 8);
6409
- return ((this.buffer[bufIndex] >>> (7 - index % 8)) & 1) === 1
6410
- },
6411
-
6412
- put: function (num, length) {
6413
- for (let i = 0; i < length; i++) {
6414
- this.putBit(((num >>> (length - i - 1)) & 1) === 1);
6415
- }
6416
- },
6417
-
6418
- getLengthInBits: function () {
6419
- return this.length
6420
- },
6421
-
6422
- putBit: function (bit) {
6423
- const bufIndex = Math.floor(this.length / 8);
6424
- if (this.buffer.length <= bufIndex) {
6425
- this.buffer.push(0);
6426
- }
6427
-
6428
- if (bit) {
6429
- this.buffer[bufIndex] |= (0x80 >>> (this.length % 8));
6430
- }
6431
-
6432
- this.length++;
6433
- }
6434
- };
6435
-
6436
- var bitBuffer = BitBuffer;
6437
-
6438
- /**
6439
- * Helper class to handle QR Code symbol modules
6440
- *
6441
- * @param {Number} size Symbol size
6442
- */
6443
- function BitMatrix (size) {
6444
- if (!size || size < 1) {
6445
- throw new Error('BitMatrix size must be defined and greater than 0')
6446
- }
6447
-
6448
- this.size = size;
6449
- this.data = new Uint8Array(size * size);
6450
- this.reservedBit = new Uint8Array(size * size);
6451
- }
6452
-
6453
- /**
6454
- * Set bit value at specified location
6455
- * If reserved flag is set, this bit will be ignored during masking process
6456
- *
6457
- * @param {Number} row
6458
- * @param {Number} col
6459
- * @param {Boolean} value
6460
- * @param {Boolean} reserved
6461
- */
6462
- BitMatrix.prototype.set = function (row, col, value, reserved) {
6463
- const index = row * this.size + col;
6464
- this.data[index] = value;
6465
- if (reserved) this.reservedBit[index] = true;
6466
- };
6467
-
6468
- /**
6469
- * Returns bit value at specified location
6470
- *
6471
- * @param {Number} row
6472
- * @param {Number} col
6473
- * @return {Boolean}
6474
- */
6475
- BitMatrix.prototype.get = function (row, col) {
6476
- return this.data[row * this.size + col]
6477
- };
6478
-
6479
- /**
6480
- * Applies xor operator at specified location
6481
- * (used during masking process)
6482
- *
6483
- * @param {Number} row
6484
- * @param {Number} col
6485
- * @param {Boolean} value
6486
- */
6487
- BitMatrix.prototype.xor = function (row, col, value) {
6488
- this.data[row * this.size + col] ^= value;
6489
- };
6490
-
6491
- /**
6492
- * Check if bit at specified location is reserved
6493
- *
6494
- * @param {Number} row
6495
- * @param {Number} col
6496
- * @return {Boolean}
6497
- */
6498
- BitMatrix.prototype.isReserved = function (row, col) {
6499
- return this.reservedBit[row * this.size + col]
6500
- };
6501
-
6502
- var bitMatrix = BitMatrix;
6503
-
6504
- var alignmentPattern = createCommonjsModule(function (module, exports) {
6505
- /**
6506
- * Alignment pattern are fixed reference pattern in defined positions
6507
- * in a matrix symbology, which enables the decode software to re-synchronise
6508
- * the coordinate mapping of the image modules in the event of moderate amounts
6509
- * of distortion of the image.
6510
- *
6511
- * Alignment patterns are present only in QR Code symbols of version 2 or larger
6512
- * and their number depends on the symbol version.
6513
- */
6514
-
6515
- const getSymbolSize = utils$1.getSymbolSize;
6516
-
6517
- /**
6518
- * Calculate the row/column coordinates of the center module of each alignment pattern
6519
- * for the specified QR Code version.
6520
- *
6521
- * The alignment patterns are positioned symmetrically on either side of the diagonal
6522
- * running from the top left corner of the symbol to the bottom right corner.
6523
- *
6524
- * Since positions are simmetrical only half of the coordinates are returned.
6525
- * Each item of the array will represent in turn the x and y coordinate.
6526
- * @see {@link getPositions}
6527
- *
6528
- * @param {Number} version QR Code version
6529
- * @return {Array} Array of coordinate
6530
- */
6531
- exports.getRowColCoords = function getRowColCoords (version) {
6532
- if (version === 1) return []
6533
-
6534
- const posCount = Math.floor(version / 7) + 2;
6535
- const size = getSymbolSize(version);
6536
- const intervals = size === 145 ? 26 : Math.ceil((size - 13) / (2 * posCount - 2)) * 2;
6537
- const positions = [size - 7]; // Last coord is always (size - 7)
6538
-
6539
- for (let i = 1; i < posCount - 1; i++) {
6540
- positions[i] = positions[i - 1] - intervals;
6541
- }
6542
-
6543
- positions.push(6); // First coord is always 6
6544
-
6545
- return positions.reverse()
6546
- };
6547
-
6548
- /**
6549
- * Returns an array containing the positions of each alignment pattern.
6550
- * Each array's element represent the center point of the pattern as (x, y) coordinates
6551
- *
6552
- * Coordinates are calculated expanding the row/column coordinates returned by {@link getRowColCoords}
6553
- * and filtering out the items that overlaps with finder pattern
6554
- *
6555
- * @example
6556
- * For a Version 7 symbol {@link getRowColCoords} returns values 6, 22 and 38.
6557
- * The alignment patterns, therefore, are to be centered on (row, column)
6558
- * positions (6,22), (22,6), (22,22), (22,38), (38,22), (38,38).
6559
- * Note that the coordinates (6,6), (6,38), (38,6) are occupied by finder patterns
6560
- * and are not therefore used for alignment patterns.
6561
- *
6562
- * let pos = getPositions(7)
6563
- * // [[6,22], [22,6], [22,22], [22,38], [38,22], [38,38]]
6564
- *
6565
- * @param {Number} version QR Code version
6566
- * @return {Array} Array of coordinates
6567
- */
6568
- exports.getPositions = function getPositions (version) {
6569
- const coords = [];
6570
- const pos = exports.getRowColCoords(version);
6571
- const posLength = pos.length;
6572
-
6573
- for (let i = 0; i < posLength; i++) {
6574
- for (let j = 0; j < posLength; j++) {
6575
- // Skip if position is occupied by finder patterns
6576
- if ((i === 0 && j === 0) || // top-left
6577
- (i === 0 && j === posLength - 1) || // bottom-left
6578
- (i === posLength - 1 && j === 0)) { // top-right
6579
- continue
6580
- }
6581
-
6582
- coords.push([pos[i], pos[j]]);
6583
- }
6584
- }
6585
-
6586
- return coords
6587
- };
6588
- });
6589
-
6590
- const getSymbolSize = utils$1.getSymbolSize;
6591
- const FINDER_PATTERN_SIZE = 7;
6592
-
6593
- /**
6594
- * Returns an array containing the positions of each finder pattern.
6595
- * Each array's element represent the top-left point of the pattern as (x, y) coordinates
6596
- *
6597
- * @param {Number} version QR Code version
6598
- * @return {Array} Array of coordinates
6599
- */
6600
- var getPositions = function getPositions (version) {
6601
- const size = getSymbolSize(version);
6602
-
6603
- return [
6604
- // top-left
6605
- [0, 0],
6606
- // top-right
6607
- [size - FINDER_PATTERN_SIZE, 0],
6608
- // bottom-left
6609
- [0, size - FINDER_PATTERN_SIZE]
6610
- ]
6611
- };
6612
-
6613
- var finderPattern = {
6614
- getPositions: getPositions
6615
- };
6616
-
6617
- var maskPattern = createCommonjsModule(function (module, exports) {
6618
- /**
6619
- * Data mask pattern reference
6620
- * @type {Object}
6621
- */
6622
- exports.Patterns = {
6623
- PATTERN000: 0,
6624
- PATTERN001: 1,
6625
- PATTERN010: 2,
6626
- PATTERN011: 3,
6627
- PATTERN100: 4,
6628
- PATTERN101: 5,
6629
- PATTERN110: 6,
6630
- PATTERN111: 7
6631
- };
6632
-
6633
- /**
6634
- * Weighted penalty scores for the undesirable features
6635
- * @type {Object}
6636
- */
6637
- const PenaltyScores = {
6638
- N1: 3,
6639
- N2: 3,
6640
- N3: 40,
6641
- N4: 10
6642
- };
6643
-
6644
- /**
6645
- * Check if mask pattern value is valid
6646
- *
6647
- * @param {Number} mask Mask pattern
6648
- * @return {Boolean} true if valid, false otherwise
6649
- */
6650
- exports.isValid = function isValid (mask) {
6651
- return mask != null && mask !== '' && !isNaN(mask) && mask >= 0 && mask <= 7
6652
- };
6653
-
6654
- /**
6655
- * Returns mask pattern from a value.
6656
- * If value is not valid, returns undefined
6657
- *
6658
- * @param {Number|String} value Mask pattern value
6659
- * @return {Number} Valid mask pattern or undefined
6660
- */
6661
- exports.from = function from (value) {
6662
- return exports.isValid(value) ? parseInt(value, 10) : undefined
6663
- };
6664
-
6665
- /**
6666
- * Find adjacent modules in row/column with the same color
6667
- * and assign a penalty value.
6668
- *
6669
- * Points: N1 + i
6670
- * i is the amount by which the number of adjacent modules of the same color exceeds 5
6671
- */
6672
- exports.getPenaltyN1 = function getPenaltyN1 (data) {
6673
- const size = data.size;
6674
- let points = 0;
6675
- let sameCountCol = 0;
6676
- let sameCountRow = 0;
6677
- let lastCol = null;
6678
- let lastRow = null;
6679
-
6680
- for (let row = 0; row < size; row++) {
6681
- sameCountCol = sameCountRow = 0;
6682
- lastCol = lastRow = null;
6683
-
6684
- for (let col = 0; col < size; col++) {
6685
- let module = data.get(row, col);
6686
- if (module === lastCol) {
6687
- sameCountCol++;
6688
- } else {
6689
- if (sameCountCol >= 5) points += PenaltyScores.N1 + (sameCountCol - 5);
6690
- lastCol = module;
6691
- sameCountCol = 1;
6692
- }
6693
-
6694
- module = data.get(col, row);
6695
- if (module === lastRow) {
6696
- sameCountRow++;
6697
- } else {
6698
- if (sameCountRow >= 5) points += PenaltyScores.N1 + (sameCountRow - 5);
6699
- lastRow = module;
6700
- sameCountRow = 1;
6701
- }
6702
- }
6703
-
6704
- if (sameCountCol >= 5) points += PenaltyScores.N1 + (sameCountCol - 5);
6705
- if (sameCountRow >= 5) points += PenaltyScores.N1 + (sameCountRow - 5);
6706
- }
6707
-
6708
- return points
6709
- };
6710
-
6711
- /**
6712
- * Find 2x2 blocks with the same color and assign a penalty value
6713
- *
6714
- * Points: N2 * (m - 1) * (n - 1)
6715
- */
6716
- exports.getPenaltyN2 = function getPenaltyN2 (data) {
6717
- const size = data.size;
6718
- let points = 0;
6719
-
6720
- for (let row = 0; row < size - 1; row++) {
6721
- for (let col = 0; col < size - 1; col++) {
6722
- const last = data.get(row, col) +
6723
- data.get(row, col + 1) +
6724
- data.get(row + 1, col) +
6725
- data.get(row + 1, col + 1);
6726
-
6727
- if (last === 4 || last === 0) points++;
6728
- }
6729
- }
6730
-
6731
- return points * PenaltyScores.N2
6732
- };
6733
-
6734
- /**
6735
- * Find 1:1:3:1:1 ratio (dark:light:dark:light:dark) pattern in row/column,
6736
- * preceded or followed by light area 4 modules wide
6737
- *
6738
- * Points: N3 * number of pattern found
6739
- */
6740
- exports.getPenaltyN3 = function getPenaltyN3 (data) {
6741
- const size = data.size;
6742
- let points = 0;
6743
- let bitsCol = 0;
6744
- let bitsRow = 0;
6745
-
6746
- for (let row = 0; row < size; row++) {
6747
- bitsCol = bitsRow = 0;
6748
- for (let col = 0; col < size; col++) {
6749
- bitsCol = ((bitsCol << 1) & 0x7FF) | data.get(row, col);
6750
- if (col >= 10 && (bitsCol === 0x5D0 || bitsCol === 0x05D)) points++;
6751
-
6752
- bitsRow = ((bitsRow << 1) & 0x7FF) | data.get(col, row);
6753
- if (col >= 10 && (bitsRow === 0x5D0 || bitsRow === 0x05D)) points++;
6754
- }
6755
- }
6756
-
6757
- return points * PenaltyScores.N3
6758
- };
6759
-
6760
- /**
6761
- * Calculate proportion of dark modules in entire symbol
6762
- *
6763
- * Points: N4 * k
6764
- *
6765
- * k is the rating of the deviation of the proportion of dark modules
6766
- * in the symbol from 50% in steps of 5%
6767
- */
6768
- exports.getPenaltyN4 = function getPenaltyN4 (data) {
6769
- let darkCount = 0;
6770
- const modulesCount = data.data.length;
6771
-
6772
- for (let i = 0; i < modulesCount; i++) darkCount += data.data[i];
6773
-
6774
- const k = Math.abs(Math.ceil((darkCount * 100 / modulesCount) / 5) - 10);
6775
-
6776
- return k * PenaltyScores.N4
6777
- };
6778
-
6779
- /**
6780
- * Return mask value at given position
6781
- *
6782
- * @param {Number} maskPattern Pattern reference value
6783
- * @param {Number} i Row
6784
- * @param {Number} j Column
6785
- * @return {Boolean} Mask value
6786
- */
6787
- function getMaskAt (maskPattern, i, j) {
6788
- switch (maskPattern) {
6789
- case exports.Patterns.PATTERN000: return (i + j) % 2 === 0
6790
- case exports.Patterns.PATTERN001: return i % 2 === 0
6791
- case exports.Patterns.PATTERN010: return j % 3 === 0
6792
- case exports.Patterns.PATTERN011: return (i + j) % 3 === 0
6793
- case exports.Patterns.PATTERN100: return (Math.floor(i / 2) + Math.floor(j / 3)) % 2 === 0
6794
- case exports.Patterns.PATTERN101: return (i * j) % 2 + (i * j) % 3 === 0
6795
- case exports.Patterns.PATTERN110: return ((i * j) % 2 + (i * j) % 3) % 2 === 0
6796
- case exports.Patterns.PATTERN111: return ((i * j) % 3 + (i + j) % 2) % 2 === 0
6797
-
6798
- default: throw new Error('bad maskPattern:' + maskPattern)
6799
- }
6800
- }
6801
-
6802
- /**
6803
- * Apply a mask pattern to a BitMatrix
6804
- *
6805
- * @param {Number} pattern Pattern reference number
6806
- * @param {BitMatrix} data BitMatrix data
6807
- */
6808
- exports.applyMask = function applyMask (pattern, data) {
6809
- const size = data.size;
6810
-
6811
- for (let col = 0; col < size; col++) {
6812
- for (let row = 0; row < size; row++) {
6813
- if (data.isReserved(row, col)) continue
6814
- data.xor(row, col, getMaskAt(pattern, row, col));
6815
- }
6816
- }
6817
- };
6818
-
6819
- /**
6820
- * Returns the best mask pattern for data
6821
- *
6822
- * @param {BitMatrix} data
6823
- * @return {Number} Mask pattern reference number
6824
- */
6825
- exports.getBestMask = function getBestMask (data, setupFormatFunc) {
6826
- const numPatterns = Object.keys(exports.Patterns).length;
6827
- let bestPattern = 0;
6828
- let lowerPenalty = Infinity;
6829
-
6830
- for (let p = 0; p < numPatterns; p++) {
6831
- setupFormatFunc(p);
6832
- exports.applyMask(p, data);
6833
-
6834
- // Calculate penalty
6835
- const penalty =
6836
- exports.getPenaltyN1(data) +
6837
- exports.getPenaltyN2(data) +
6838
- exports.getPenaltyN3(data) +
6839
- exports.getPenaltyN4(data);
6840
-
6841
- // Undo previously applied mask
6842
- exports.applyMask(p, data);
6843
-
6844
- if (penalty < lowerPenalty) {
6845
- lowerPenalty = penalty;
6846
- bestPattern = p;
6847
- }
6848
- }
6849
-
6850
- return bestPattern
6851
- };
6852
- });
6853
-
6854
- const EC_BLOCKS_TABLE = [
6855
- // L M Q H
6856
- 1, 1, 1, 1,
6857
- 1, 1, 1, 1,
6858
- 1, 1, 2, 2,
6859
- 1, 2, 2, 4,
6860
- 1, 2, 4, 4,
6861
- 2, 4, 4, 4,
6862
- 2, 4, 6, 5,
6863
- 2, 4, 6, 6,
6864
- 2, 5, 8, 8,
6865
- 4, 5, 8, 8,
6866
- 4, 5, 8, 11,
6867
- 4, 8, 10, 11,
6868
- 4, 9, 12, 16,
6869
- 4, 9, 16, 16,
6870
- 6, 10, 12, 18,
6871
- 6, 10, 17, 16,
6872
- 6, 11, 16, 19,
6873
- 6, 13, 18, 21,
6874
- 7, 14, 21, 25,
6875
- 8, 16, 20, 25,
6876
- 8, 17, 23, 25,
6877
- 9, 17, 23, 34,
6878
- 9, 18, 25, 30,
6879
- 10, 20, 27, 32,
6880
- 12, 21, 29, 35,
6881
- 12, 23, 34, 37,
6882
- 12, 25, 34, 40,
6883
- 13, 26, 35, 42,
6884
- 14, 28, 38, 45,
6885
- 15, 29, 40, 48,
6886
- 16, 31, 43, 51,
6887
- 17, 33, 45, 54,
6888
- 18, 35, 48, 57,
6889
- 19, 37, 51, 60,
6890
- 19, 38, 53, 63,
6891
- 20, 40, 56, 66,
6892
- 21, 43, 59, 70,
6893
- 22, 45, 62, 74,
6894
- 24, 47, 65, 77,
6895
- 25, 49, 68, 81
6896
- ];
6897
-
6898
- const EC_CODEWORDS_TABLE = [
6899
- // L M Q H
6900
- 7, 10, 13, 17,
6901
- 10, 16, 22, 28,
6902
- 15, 26, 36, 44,
6903
- 20, 36, 52, 64,
6904
- 26, 48, 72, 88,
6905
- 36, 64, 96, 112,
6906
- 40, 72, 108, 130,
6907
- 48, 88, 132, 156,
6908
- 60, 110, 160, 192,
6909
- 72, 130, 192, 224,
6910
- 80, 150, 224, 264,
6911
- 96, 176, 260, 308,
6912
- 104, 198, 288, 352,
6913
- 120, 216, 320, 384,
6914
- 132, 240, 360, 432,
6915
- 144, 280, 408, 480,
6916
- 168, 308, 448, 532,
6917
- 180, 338, 504, 588,
6918
- 196, 364, 546, 650,
6919
- 224, 416, 600, 700,
6920
- 224, 442, 644, 750,
6921
- 252, 476, 690, 816,
6922
- 270, 504, 750, 900,
6923
- 300, 560, 810, 960,
6924
- 312, 588, 870, 1050,
6925
- 336, 644, 952, 1110,
6926
- 360, 700, 1020, 1200,
6927
- 390, 728, 1050, 1260,
6928
- 420, 784, 1140, 1350,
6929
- 450, 812, 1200, 1440,
6930
- 480, 868, 1290, 1530,
6931
- 510, 924, 1350, 1620,
6932
- 540, 980, 1440, 1710,
6933
- 570, 1036, 1530, 1800,
6934
- 570, 1064, 1590, 1890,
6935
- 600, 1120, 1680, 1980,
6936
- 630, 1204, 1770, 2100,
6937
- 660, 1260, 1860, 2220,
6938
- 720, 1316, 1950, 2310,
6939
- 750, 1372, 2040, 2430
6940
- ];
6941
-
6942
- /**
6943
- * Returns the number of error correction block that the QR Code should contain
6944
- * for the specified version and error correction level.
6945
- *
6946
- * @param {Number} version QR Code version
6947
- * @param {Number} errorCorrectionLevel Error correction level
6948
- * @return {Number} Number of error correction blocks
6949
- */
6950
- var getBlocksCount = function getBlocksCount (version, errorCorrectionLevel$1) {
6951
- switch (errorCorrectionLevel$1) {
6952
- case errorCorrectionLevel.L:
6953
- return EC_BLOCKS_TABLE[(version - 1) * 4 + 0]
6954
- case errorCorrectionLevel.M:
6955
- return EC_BLOCKS_TABLE[(version - 1) * 4 + 1]
6956
- case errorCorrectionLevel.Q:
6957
- return EC_BLOCKS_TABLE[(version - 1) * 4 + 2]
6958
- case errorCorrectionLevel.H:
6959
- return EC_BLOCKS_TABLE[(version - 1) * 4 + 3]
6960
- default:
6961
- return undefined
6962
- }
6963
- };
6964
-
6965
- /**
6966
- * Returns the number of error correction codewords to use for the specified
6967
- * version and error correction level.
6968
- *
6969
- * @param {Number} version QR Code version
6970
- * @param {Number} errorCorrectionLevel Error correction level
6971
- * @return {Number} Number of error correction codewords
6972
- */
6973
- var getTotalCodewordsCount = function getTotalCodewordsCount (version, errorCorrectionLevel$1) {
6974
- switch (errorCorrectionLevel$1) {
6975
- case errorCorrectionLevel.L:
6976
- return EC_CODEWORDS_TABLE[(version - 1) * 4 + 0]
6977
- case errorCorrectionLevel.M:
6978
- return EC_CODEWORDS_TABLE[(version - 1) * 4 + 1]
6979
- case errorCorrectionLevel.Q:
6980
- return EC_CODEWORDS_TABLE[(version - 1) * 4 + 2]
6981
- case errorCorrectionLevel.H:
6982
- return EC_CODEWORDS_TABLE[(version - 1) * 4 + 3]
6983
- default:
6984
- return undefined
6985
- }
6986
- };
6987
-
6988
- var errorCorrectionCode = {
6989
- getBlocksCount: getBlocksCount,
6990
- getTotalCodewordsCount: getTotalCodewordsCount
6991
- };
6992
-
6993
- const EXP_TABLE = new Uint8Array(512);
6994
- const LOG_TABLE = new Uint8Array(256)
6995
- /**
6996
- * Precompute the log and anti-log tables for faster computation later
6997
- *
6998
- * For each possible value in the galois field 2^8, we will pre-compute
6999
- * the logarithm and anti-logarithm (exponential) of this value
7000
- *
7001
- * ref {@link https://en.wikiversity.org/wiki/Reed%E2%80%93Solomon_codes_for_coders#Introduction_to_mathematical_fields}
7002
- */
7003
- ;(function initTables () {
7004
- let x = 1;
7005
- for (let i = 0; i < 255; i++) {
7006
- EXP_TABLE[i] = x;
7007
- LOG_TABLE[x] = i;
7008
-
7009
- x <<= 1; // multiply by 2
7010
-
7011
- // The QR code specification says to use byte-wise modulo 100011101 arithmetic.
7012
- // This means that when a number is 256 or larger, it should be XORed with 0x11D.
7013
- if (x & 0x100) { // similar to x >= 256, but a lot faster (because 0x100 == 256)
7014
- x ^= 0x11D;
7015
- }
7016
- }
7017
-
7018
- // Optimization: double the size of the anti-log table so that we don't need to mod 255 to
7019
- // stay inside the bounds (because we will mainly use this table for the multiplication of
7020
- // two GF numbers, no more).
7021
- // @see {@link mul}
7022
- for (let i = 255; i < 512; i++) {
7023
- EXP_TABLE[i] = EXP_TABLE[i - 255];
7024
- }
7025
- }());
7026
-
7027
- /**
7028
- * Returns log value of n inside Galois Field
7029
- *
7030
- * @param {Number} n
7031
- * @return {Number}
7032
- */
7033
- var log = function log (n) {
7034
- if (n < 1) throw new Error('log(' + n + ')')
7035
- return LOG_TABLE[n]
7036
- };
7037
-
7038
- /**
7039
- * Returns anti-log value of n inside Galois Field
7040
- *
7041
- * @param {Number} n
7042
- * @return {Number}
7043
- */
7044
- var exp = function exp (n) {
7045
- return EXP_TABLE[n]
7046
- };
7047
-
7048
- /**
7049
- * Multiplies two number inside Galois Field
7050
- *
7051
- * @param {Number} x
7052
- * @param {Number} y
7053
- * @return {Number}
7054
- */
7055
- var mul = function mul (x, y) {
7056
- if (x === 0 || y === 0) return 0
7057
-
7058
- // should be EXP_TABLE[(LOG_TABLE[x] + LOG_TABLE[y]) % 255] if EXP_TABLE wasn't oversized
7059
- // @see {@link initTables}
7060
- return EXP_TABLE[LOG_TABLE[x] + LOG_TABLE[y]]
7061
- };
7062
-
7063
- var galoisField = {
7064
- log: log,
7065
- exp: exp,
7066
- mul: mul
7067
- };
7068
-
7069
- var polynomial = createCommonjsModule(function (module, exports) {
7070
- /**
7071
- * Multiplies two polynomials inside Galois Field
7072
- *
7073
- * @param {Uint8Array} p1 Polynomial
7074
- * @param {Uint8Array} p2 Polynomial
7075
- * @return {Uint8Array} Product of p1 and p2
7076
- */
7077
- exports.mul = function mul (p1, p2) {
7078
- const coeff = new Uint8Array(p1.length + p2.length - 1);
7079
-
7080
- for (let i = 0; i < p1.length; i++) {
7081
- for (let j = 0; j < p2.length; j++) {
7082
- coeff[i + j] ^= galoisField.mul(p1[i], p2[j]);
7083
- }
7084
- }
7085
-
7086
- return coeff
7087
- };
7088
-
7089
- /**
7090
- * Calculate the remainder of polynomials division
7091
- *
7092
- * @param {Uint8Array} divident Polynomial
7093
- * @param {Uint8Array} divisor Polynomial
7094
- * @return {Uint8Array} Remainder
7095
- */
7096
- exports.mod = function mod (divident, divisor) {
7097
- let result = new Uint8Array(divident);
7098
-
7099
- while ((result.length - divisor.length) >= 0) {
7100
- const coeff = result[0];
7101
-
7102
- for (let i = 0; i < divisor.length; i++) {
7103
- result[i] ^= galoisField.mul(divisor[i], coeff);
7104
- }
7105
-
7106
- // remove all zeros from buffer head
7107
- let offset = 0;
7108
- while (offset < result.length && result[offset] === 0) offset++;
7109
- result = result.slice(offset);
7110
- }
7111
-
7112
- return result
7113
- };
7114
-
7115
- /**
7116
- * Generate an irreducible generator polynomial of specified degree
7117
- * (used by Reed-Solomon encoder)
7118
- *
7119
- * @param {Number} degree Degree of the generator polynomial
7120
- * @return {Uint8Array} Buffer containing polynomial coefficients
7121
- */
7122
- exports.generateECPolynomial = function generateECPolynomial (degree) {
7123
- let poly = new Uint8Array([1]);
7124
- for (let i = 0; i < degree; i++) {
7125
- poly = exports.mul(poly, new Uint8Array([1, galoisField.exp(i)]));
7126
- }
7127
-
7128
- return poly
7129
- };
7130
- });
7131
-
7132
- function ReedSolomonEncoder (degree) {
7133
- this.genPoly = undefined;
7134
- this.degree = degree;
7135
-
7136
- if (this.degree) this.initialize(this.degree);
7137
- }
7138
-
7139
- /**
7140
- * Initialize the encoder.
7141
- * The input param should correspond to the number of error correction codewords.
7142
- *
7143
- * @param {Number} degree
7144
- */
7145
- ReedSolomonEncoder.prototype.initialize = function initialize (degree) {
7146
- // create an irreducible generator polynomial
7147
- this.degree = degree;
7148
- this.genPoly = polynomial.generateECPolynomial(this.degree);
7149
- };
7150
-
7151
- /**
7152
- * Encodes a chunk of data
7153
- *
7154
- * @param {Uint8Array} data Buffer containing input data
7155
- * @return {Uint8Array} Buffer containing encoded data
7156
- */
7157
- ReedSolomonEncoder.prototype.encode = function encode (data) {
7158
- if (!this.genPoly) {
7159
- throw new Error('Encoder not initialized')
7160
- }
7161
-
7162
- // Calculate EC for this data block
7163
- // extends data size to data+genPoly size
7164
- const paddedData = new Uint8Array(data.length + this.degree);
7165
- paddedData.set(data);
7166
-
7167
- // The error correction codewords are the remainder after dividing the data codewords
7168
- // by a generator polynomial
7169
- const remainder = polynomial.mod(paddedData, this.genPoly);
7170
-
7171
- // return EC data blocks (last n byte, where n is the degree of genPoly)
7172
- // If coefficients number in remainder are less than genPoly degree,
7173
- // pad with 0s to the left to reach the needed number of coefficients
7174
- const start = this.degree - remainder.length;
7175
- if (start > 0) {
7176
- const buff = new Uint8Array(this.degree);
7177
- buff.set(remainder, start);
7178
-
7179
- return buff
7180
- }
7181
-
7182
- return remainder
7183
- };
7184
-
7185
- var reedSolomonEncoder = ReedSolomonEncoder;
7186
-
7187
- /**
7188
- * Check if QR Code version is valid
7189
- *
7190
- * @param {Number} version QR Code version
7191
- * @return {Boolean} true if valid version, false otherwise
7192
- */
7193
- var isValid = function isValid (version) {
7194
- return !isNaN(version) && version >= 1 && version <= 40
7195
- };
7196
-
7197
- var versionCheck = {
7198
- isValid: isValid
7199
- };
7200
-
7201
- const numeric = '[0-9]+';
7202
- const alphanumeric = '[A-Z $%*+\\-./:]+';
7203
- let kanji = '(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|' +
7204
- '[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|' +
7205
- '[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|' +
7206
- '[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+';
7207
- kanji = kanji.replace(/u/g, '\\u');
7208
-
7209
- const byte = '(?:(?![A-Z0-9 $%*+\\-./:]|' + kanji + ')(?:.|[\r\n]))+';
7210
-
7211
- var KANJI = new RegExp(kanji, 'g');
7212
- var BYTE_KANJI = new RegExp('[^A-Z0-9 $%*+\\-./:]+', 'g');
7213
- var BYTE = new RegExp(byte, 'g');
7214
- var NUMERIC = new RegExp(numeric, 'g');
7215
- var ALPHANUMERIC = new RegExp(alphanumeric, 'g');
7216
-
7217
- const TEST_KANJI = new RegExp('^' + kanji + '$');
7218
- const TEST_NUMERIC = new RegExp('^' + numeric + '$');
7219
- const TEST_ALPHANUMERIC = new RegExp('^[A-Z0-9 $%*+\\-./:]+$');
7220
-
7221
- var testKanji = function testKanji (str) {
7222
- return TEST_KANJI.test(str)
7223
- };
7224
-
7225
- var testNumeric = function testNumeric (str) {
7226
- return TEST_NUMERIC.test(str)
7227
- };
7228
-
7229
- var testAlphanumeric = function testAlphanumeric (str) {
7230
- return TEST_ALPHANUMERIC.test(str)
7231
- };
7232
-
7233
- var regex = {
7234
- KANJI: KANJI,
7235
- BYTE_KANJI: BYTE_KANJI,
7236
- BYTE: BYTE,
7237
- NUMERIC: NUMERIC,
7238
- ALPHANUMERIC: ALPHANUMERIC,
7239
- testKanji: testKanji,
7240
- testNumeric: testNumeric,
7241
- testAlphanumeric: testAlphanumeric
7242
- };
7243
-
7244
- var mode = createCommonjsModule(function (module, exports) {
7245
- /**
7246
- * Numeric mode encodes data from the decimal digit set (0 - 9)
7247
- * (byte values 30HEX to 39HEX).
7248
- * Normally, 3 data characters are represented by 10 bits.
7249
- *
7250
- * @type {Object}
7251
- */
7252
- exports.NUMERIC = {
7253
- id: 'Numeric',
7254
- bit: 1 << 0,
7255
- ccBits: [10, 12, 14]
7256
- };
7257
-
7258
- /**
7259
- * Alphanumeric mode encodes data from a set of 45 characters,
7260
- * i.e. 10 numeric digits (0 - 9),
7261
- * 26 alphabetic characters (A - Z),
7262
- * and 9 symbols (SP, $, %, *, +, -, ., /, :).
7263
- * Normally, two input characters are represented by 11 bits.
7264
- *
7265
- * @type {Object}
7266
- */
7267
- exports.ALPHANUMERIC = {
7268
- id: 'Alphanumeric',
7269
- bit: 1 << 1,
7270
- ccBits: [9, 11, 13]
7271
- };
7272
-
7273
- /**
7274
- * In byte mode, data is encoded at 8 bits per character.
7275
- *
7276
- * @type {Object}
7277
- */
7278
- exports.BYTE = {
7279
- id: 'Byte',
7280
- bit: 1 << 2,
7281
- ccBits: [8, 16, 16]
7282
- };
7283
-
7284
- /**
7285
- * The Kanji mode efficiently encodes Kanji characters in accordance with
7286
- * the Shift JIS system based on JIS X 0208.
7287
- * The Shift JIS values are shifted from the JIS X 0208 values.
7288
- * JIS X 0208 gives details of the shift coded representation.
7289
- * Each two-byte character value is compacted to a 13-bit binary codeword.
7290
- *
7291
- * @type {Object}
7292
- */
7293
- exports.KANJI = {
7294
- id: 'Kanji',
7295
- bit: 1 << 3,
7296
- ccBits: [8, 10, 12]
7297
- };
7298
-
7299
- /**
7300
- * Mixed mode will contain a sequences of data in a combination of any of
7301
- * the modes described above
7302
- *
7303
- * @type {Object}
7304
- */
7305
- exports.MIXED = {
7306
- bit: -1
7307
- };
7308
-
7309
- /**
7310
- * Returns the number of bits needed to store the data length
7311
- * according to QR Code specifications.
7312
- *
7313
- * @param {Mode} mode Data mode
7314
- * @param {Number} version QR Code version
7315
- * @return {Number} Number of bits
7316
- */
7317
- exports.getCharCountIndicator = function getCharCountIndicator (mode, version) {
7318
- if (!mode.ccBits) throw new Error('Invalid mode: ' + mode)
7319
-
7320
- if (!versionCheck.isValid(version)) {
7321
- throw new Error('Invalid version: ' + version)
7322
- }
7323
-
7324
- if (version >= 1 && version < 10) return mode.ccBits[0]
7325
- else if (version < 27) return mode.ccBits[1]
7326
- return mode.ccBits[2]
7327
- };
7328
-
7329
- /**
7330
- * Returns the most efficient mode to store the specified data
7331
- *
7332
- * @param {String} dataStr Input data string
7333
- * @return {Mode} Best mode
7334
- */
7335
- exports.getBestModeForData = function getBestModeForData (dataStr) {
7336
- if (regex.testNumeric(dataStr)) return exports.NUMERIC
7337
- else if (regex.testAlphanumeric(dataStr)) return exports.ALPHANUMERIC
7338
- else if (regex.testKanji(dataStr)) return exports.KANJI
7339
- else return exports.BYTE
7340
- };
7341
-
7342
- /**
7343
- * Return mode name as string
7344
- *
7345
- * @param {Mode} mode Mode object
7346
- * @returns {String} Mode name
7347
- */
7348
- exports.toString = function toString (mode) {
7349
- if (mode && mode.id) return mode.id
7350
- throw new Error('Invalid mode')
7351
- };
7352
-
7353
- /**
7354
- * Check if input param is a valid mode object
7355
- *
7356
- * @param {Mode} mode Mode object
7357
- * @returns {Boolean} True if valid mode, false otherwise
7358
- */
7359
- exports.isValid = function isValid (mode) {
7360
- return mode && mode.bit && mode.ccBits
7361
- };
7362
-
7363
- /**
7364
- * Get mode object from its name
7365
- *
7366
- * @param {String} string Mode name
7367
- * @returns {Mode} Mode object
7368
- */
7369
- function fromString (string) {
7370
- if (typeof string !== 'string') {
7371
- throw new Error('Param is not a string')
7372
- }
7373
-
7374
- const lcStr = string.toLowerCase();
7375
-
7376
- switch (lcStr) {
7377
- case 'numeric':
7378
- return exports.NUMERIC
7379
- case 'alphanumeric':
7380
- return exports.ALPHANUMERIC
7381
- case 'kanji':
7382
- return exports.KANJI
7383
- case 'byte':
7384
- return exports.BYTE
7385
- default:
7386
- throw new Error('Unknown mode: ' + string)
7387
- }
7388
- }
7389
-
7390
- /**
7391
- * Returns mode from a value.
7392
- * If value is not a valid mode, returns defaultValue
7393
- *
7394
- * @param {Mode|String} value Encoding mode
7395
- * @param {Mode} defaultValue Fallback value
7396
- * @return {Mode} Encoding mode
7397
- */
7398
- exports.from = function from (value, defaultValue) {
7399
- if (exports.isValid(value)) {
7400
- return value
7401
- }
7402
-
7403
- try {
7404
- return fromString(value)
7405
- } catch (e) {
7406
- return defaultValue
7407
- }
7408
- };
7409
- });
7410
-
7411
- var version = createCommonjsModule(function (module, exports) {
7412
- // Generator polynomial used to encode version information
7413
- const G18 = (1 << 12) | (1 << 11) | (1 << 10) | (1 << 9) | (1 << 8) | (1 << 5) | (1 << 2) | (1 << 0);
7414
- const G18_BCH = utils$1.getBCHDigit(G18);
7415
-
7416
- function getBestVersionForDataLength (mode, length, errorCorrectionLevel) {
7417
- for (let currentVersion = 1; currentVersion <= 40; currentVersion++) {
7418
- if (length <= exports.getCapacity(currentVersion, errorCorrectionLevel, mode)) {
7419
- return currentVersion
7420
- }
7421
- }
7422
-
7423
- return undefined
7424
- }
7425
-
7426
- function getReservedBitsCount (mode$1, version) {
7427
- // Character count indicator + mode indicator bits
7428
- return mode.getCharCountIndicator(mode$1, version) + 4
7429
- }
7430
-
7431
- function getTotalBitsFromDataArray (segments, version) {
7432
- let totalBits = 0;
7433
-
7434
- segments.forEach(function (data) {
7435
- const reservedBits = getReservedBitsCount(data.mode, version);
7436
- totalBits += reservedBits + data.getBitsLength();
7437
- });
7438
-
7439
- return totalBits
7440
- }
7441
-
7442
- function getBestVersionForMixedData (segments, errorCorrectionLevel) {
7443
- for (let currentVersion = 1; currentVersion <= 40; currentVersion++) {
7444
- const length = getTotalBitsFromDataArray(segments, currentVersion);
7445
- if (length <= exports.getCapacity(currentVersion, errorCorrectionLevel, mode.MIXED)) {
7446
- return currentVersion
7447
- }
7448
- }
7449
-
7450
- return undefined
7451
- }
7452
-
7453
- /**
7454
- * Returns version number from a value.
7455
- * If value is not a valid version, returns defaultValue
7456
- *
7457
- * @param {Number|String} value QR Code version
7458
- * @param {Number} defaultValue Fallback value
7459
- * @return {Number} QR Code version number
7460
- */
7461
- exports.from = function from (value, defaultValue) {
7462
- if (versionCheck.isValid(value)) {
7463
- return parseInt(value, 10)
7464
- }
7465
-
7466
- return defaultValue
7467
- };
7468
-
7469
- /**
7470
- * Returns how much data can be stored with the specified QR code version
7471
- * and error correction level
7472
- *
7473
- * @param {Number} version QR Code version (1-40)
7474
- * @param {Number} errorCorrectionLevel Error correction level
7475
- * @param {Mode} mode Data mode
7476
- * @return {Number} Quantity of storable data
7477
- */
7478
- exports.getCapacity = function getCapacity (version, errorCorrectionLevel, mode$1) {
7479
- if (!versionCheck.isValid(version)) {
7480
- throw new Error('Invalid QR Code version')
7481
- }
7482
-
7483
- // Use Byte mode as default
7484
- if (typeof mode$1 === 'undefined') mode$1 = mode.BYTE;
7485
-
7486
- // Total codewords for this QR code version (Data + Error correction)
7487
- const totalCodewords = utils$1.getSymbolTotalCodewords(version);
7488
-
7489
- // Total number of error correction codewords
7490
- const ecTotalCodewords = errorCorrectionCode.getTotalCodewordsCount(version, errorCorrectionLevel);
7491
-
7492
- // Total number of data codewords
7493
- const dataTotalCodewordsBits = (totalCodewords - ecTotalCodewords) * 8;
7494
-
7495
- if (mode$1 === mode.MIXED) return dataTotalCodewordsBits
7496
-
7497
- const usableBits = dataTotalCodewordsBits - getReservedBitsCount(mode$1, version);
7498
-
7499
- // Return max number of storable codewords
7500
- switch (mode$1) {
7501
- case mode.NUMERIC:
7502
- return Math.floor((usableBits / 10) * 3)
7503
-
7504
- case mode.ALPHANUMERIC:
7505
- return Math.floor((usableBits / 11) * 2)
7506
-
7507
- case mode.KANJI:
7508
- return Math.floor(usableBits / 13)
7509
-
7510
- case mode.BYTE:
7511
- default:
7512
- return Math.floor(usableBits / 8)
7513
- }
7514
- };
7515
-
7516
- /**
7517
- * Returns the minimum version needed to contain the amount of data
7518
- *
7519
- * @param {Segment} data Segment of data
7520
- * @param {Number} [errorCorrectionLevel=H] Error correction level
7521
- * @param {Mode} mode Data mode
7522
- * @return {Number} QR Code version
7523
- */
7524
- exports.getBestVersionForData = function getBestVersionForData (data, errorCorrectionLevel$1) {
7525
- let seg;
7526
-
7527
- const ecl = errorCorrectionLevel.from(errorCorrectionLevel$1, errorCorrectionLevel.M);
7528
-
7529
- if (Array.isArray(data)) {
7530
- if (data.length > 1) {
7531
- return getBestVersionForMixedData(data, ecl)
7532
- }
7533
-
7534
- if (data.length === 0) {
7535
- return 1
7536
- }
7537
-
7538
- seg = data[0];
7539
- } else {
7540
- seg = data;
7541
- }
7542
-
7543
- return getBestVersionForDataLength(seg.mode, seg.getLength(), ecl)
7544
- };
7545
-
7546
- /**
7547
- * Returns version information with relative error correction bits
7548
- *
7549
- * The version information is included in QR Code symbols of version 7 or larger.
7550
- * It consists of an 18-bit sequence containing 6 data bits,
7551
- * with 12 error correction bits calculated using the (18, 6) Golay code.
7552
- *
7553
- * @param {Number} version QR Code version
7554
- * @return {Number} Encoded version info bits
7555
- */
7556
- exports.getEncodedBits = function getEncodedBits (version) {
7557
- if (!versionCheck.isValid(version) || version < 7) {
7558
- throw new Error('Invalid QR Code version')
7559
- }
7560
-
7561
- let d = version << 12;
7562
-
7563
- while (utils$1.getBCHDigit(d) - G18_BCH >= 0) {
7564
- d ^= (G18 << (utils$1.getBCHDigit(d) - G18_BCH));
7565
- }
7566
-
7567
- return (version << 12) | d
7568
- };
7569
- });
7570
-
7571
- const G15 = (1 << 10) | (1 << 8) | (1 << 5) | (1 << 4) | (1 << 2) | (1 << 1) | (1 << 0);
7572
- const G15_MASK = (1 << 14) | (1 << 12) | (1 << 10) | (1 << 4) | (1 << 1);
7573
- const G15_BCH = utils$1.getBCHDigit(G15);
7574
-
7575
- /**
7576
- * Returns format information with relative error correction bits
7577
- *
7578
- * The format information is a 15-bit sequence containing 5 data bits,
7579
- * with 10 error correction bits calculated using the (15, 5) BCH code.
7580
- *
7581
- * @param {Number} errorCorrectionLevel Error correction level
7582
- * @param {Number} mask Mask pattern
7583
- * @return {Number} Encoded format information bits
7584
- */
7585
- var getEncodedBits = function getEncodedBits (errorCorrectionLevel, mask) {
7586
- const data = ((errorCorrectionLevel.bit << 3) | mask);
7587
- let d = data << 10;
7588
-
7589
- while (utils$1.getBCHDigit(d) - G15_BCH >= 0) {
7590
- d ^= (G15 << (utils$1.getBCHDigit(d) - G15_BCH));
7591
- }
7592
-
7593
- // xor final data with mask pattern in order to ensure that
7594
- // no combination of Error Correction Level and data mask pattern
7595
- // will result in an all-zero data string
7596
- return ((data << 10) | d) ^ G15_MASK
7597
- };
7598
-
7599
- var formatInfo = {
7600
- getEncodedBits: getEncodedBits
7601
- };
7602
-
7603
- function NumericData (data) {
7604
- this.mode = mode.NUMERIC;
7605
- this.data = data.toString();
7606
- }
7607
-
7608
- NumericData.getBitsLength = function getBitsLength (length) {
7609
- return 10 * Math.floor(length / 3) + ((length % 3) ? ((length % 3) * 3 + 1) : 0)
7610
- };
7611
-
7612
- NumericData.prototype.getLength = function getLength () {
7613
- return this.data.length
7614
- };
7615
-
7616
- NumericData.prototype.getBitsLength = function getBitsLength () {
7617
- return NumericData.getBitsLength(this.data.length)
7618
- };
7619
-
7620
- NumericData.prototype.write = function write (bitBuffer) {
7621
- let i, group, value;
7622
-
7623
- // The input data string is divided into groups of three digits,
7624
- // and each group is converted to its 10-bit binary equivalent.
7625
- for (i = 0; i + 3 <= this.data.length; i += 3) {
7626
- group = this.data.substr(i, 3);
7627
- value = parseInt(group, 10);
7628
-
7629
- bitBuffer.put(value, 10);
7630
- }
7631
-
7632
- // If the number of input digits is not an exact multiple of three,
7633
- // the final one or two digits are converted to 4 or 7 bits respectively.
7634
- const remainingNum = this.data.length - i;
7635
- if (remainingNum > 0) {
7636
- group = this.data.substr(i);
7637
- value = parseInt(group, 10);
7638
-
7639
- bitBuffer.put(value, remainingNum * 3 + 1);
7640
- }
7641
- };
7642
-
7643
- var numericData = NumericData;
7644
-
7645
- /**
7646
- * Array of characters available in alphanumeric mode
7647
- *
7648
- * As per QR Code specification, to each character
7649
- * is assigned a value from 0 to 44 which in this case coincides
7650
- * with the array index
7651
- *
7652
- * @type {Array}
7653
- */
7654
- const ALPHA_NUM_CHARS = [
7655
- '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
7656
- 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M',
7657
- 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
7658
- ' ', '$', '%', '*', '+', '-', '.', '/', ':'
7659
- ];
7660
-
7661
- function AlphanumericData (data) {
7662
- this.mode = mode.ALPHANUMERIC;
7663
- this.data = data;
7664
- }
7665
-
7666
- AlphanumericData.getBitsLength = function getBitsLength (length) {
7667
- return 11 * Math.floor(length / 2) + 6 * (length % 2)
7668
- };
7669
-
7670
- AlphanumericData.prototype.getLength = function getLength () {
7671
- return this.data.length
7672
- };
7673
-
7674
- AlphanumericData.prototype.getBitsLength = function getBitsLength () {
7675
- return AlphanumericData.getBitsLength(this.data.length)
7676
- };
7677
-
7678
- AlphanumericData.prototype.write = function write (bitBuffer) {
7679
- let i;
7680
-
7681
- // Input data characters are divided into groups of two characters
7682
- // and encoded as 11-bit binary codes.
7683
- for (i = 0; i + 2 <= this.data.length; i += 2) {
7684
- // The character value of the first character is multiplied by 45
7685
- let value = ALPHA_NUM_CHARS.indexOf(this.data[i]) * 45;
7686
-
7687
- // The character value of the second digit is added to the product
7688
- value += ALPHA_NUM_CHARS.indexOf(this.data[i + 1]);
7689
-
7690
- // The sum is then stored as 11-bit binary number
7691
- bitBuffer.put(value, 11);
7692
- }
7693
-
7694
- // If the number of input data characters is not a multiple of two,
7695
- // the character value of the final character is encoded as a 6-bit binary number.
7696
- if (this.data.length % 2) {
7697
- bitBuffer.put(ALPHA_NUM_CHARS.indexOf(this.data[i]), 6);
7698
- }
7699
- };
7700
-
7701
- var alphanumericData = AlphanumericData;
7702
-
7703
- var encodeUtf8 = function encodeUtf8 (input) {
7704
- var result = [];
7705
- var size = input.length;
7706
-
7707
- for (var index = 0; index < size; index++) {
7708
- var point = input.charCodeAt(index);
7709
-
7710
- if (point >= 0xD800 && point <= 0xDBFF && size > index + 1) {
7711
- var second = input.charCodeAt(index + 1);
7712
-
7713
- if (second >= 0xDC00 && second <= 0xDFFF) {
7714
- // https://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae
7715
- point = (point - 0xD800) * 0x400 + second - 0xDC00 + 0x10000;
7716
- index += 1;
7717
- }
7718
- }
7719
-
7720
- // US-ASCII
7721
- if (point < 0x80) {
7722
- result.push(point);
7723
- continue
7724
- }
7725
-
7726
- // 2-byte UTF-8
7727
- if (point < 0x800) {
7728
- result.push((point >> 6) | 192);
7729
- result.push((point & 63) | 128);
7730
- continue
7731
- }
7732
-
7733
- // 3-byte UTF-8
7734
- if (point < 0xD800 || (point >= 0xE000 && point < 0x10000)) {
7735
- result.push((point >> 12) | 224);
7736
- result.push(((point >> 6) & 63) | 128);
7737
- result.push((point & 63) | 128);
7738
- continue
7739
- }
7740
-
7741
- // 4-byte UTF-8
7742
- if (point >= 0x10000 && point <= 0x10FFFF) {
7743
- result.push((point >> 18) | 240);
7744
- result.push(((point >> 12) & 63) | 128);
7745
- result.push(((point >> 6) & 63) | 128);
7746
- result.push((point & 63) | 128);
7747
- continue
7748
- }
7749
-
7750
- // Invalid character
7751
- result.push(0xEF, 0xBF, 0xBD);
7752
- }
7753
-
7754
- return new Uint8Array(result).buffer
7755
- };
7756
-
7757
- function ByteData (data) {
7758
- this.mode = mode.BYTE;
7759
- if (typeof (data) === 'string') {
7760
- data = encodeUtf8(data);
7761
- }
7762
- this.data = new Uint8Array(data);
7763
- }
7764
-
7765
- ByteData.getBitsLength = function getBitsLength (length) {
7766
- return length * 8
7767
- };
7768
-
7769
- ByteData.prototype.getLength = function getLength () {
7770
- return this.data.length
7771
- };
7772
-
7773
- ByteData.prototype.getBitsLength = function getBitsLength () {
7774
- return ByteData.getBitsLength(this.data.length)
7775
- };
7776
-
7777
- ByteData.prototype.write = function (bitBuffer) {
7778
- for (let i = 0, l = this.data.length; i < l; i++) {
7779
- bitBuffer.put(this.data[i], 8);
7780
- }
7781
- };
7782
-
7783
- var byteData = ByteData;
7784
-
7785
- function KanjiData (data) {
7786
- this.mode = mode.KANJI;
7787
- this.data = data;
7788
- }
7789
-
7790
- KanjiData.getBitsLength = function getBitsLength (length) {
7791
- return length * 13
7792
- };
7793
-
7794
- KanjiData.prototype.getLength = function getLength () {
7795
- return this.data.length
7796
- };
7797
-
7798
- KanjiData.prototype.getBitsLength = function getBitsLength () {
7799
- return KanjiData.getBitsLength(this.data.length)
7800
- };
7801
-
7802
- KanjiData.prototype.write = function (bitBuffer) {
7803
- let i;
7804
-
7805
- // In the Shift JIS system, Kanji characters are represented by a two byte combination.
7806
- // These byte values are shifted from the JIS X 0208 values.
7807
- // JIS X 0208 gives details of the shift coded representation.
7808
- for (i = 0; i < this.data.length; i++) {
7809
- let value = utils$1.toSJIS(this.data[i]);
7810
-
7811
- // For characters with Shift JIS values from 0x8140 to 0x9FFC:
7812
- if (value >= 0x8140 && value <= 0x9FFC) {
7813
- // Subtract 0x8140 from Shift JIS value
7814
- value -= 0x8140;
7815
-
7816
- // For characters with Shift JIS values from 0xE040 to 0xEBBF
7817
- } else if (value >= 0xE040 && value <= 0xEBBF) {
7818
- // Subtract 0xC140 from Shift JIS value
7819
- value -= 0xC140;
7820
- } else {
7821
- throw new Error(
7822
- 'Invalid SJIS character: ' + this.data[i] + '\n' +
7823
- 'Make sure your charset is UTF-8')
7824
- }
7825
-
7826
- // Multiply most significant byte of result by 0xC0
7827
- // and add least significant byte to product
7828
- value = (((value >>> 8) & 0xff) * 0xC0) + (value & 0xff);
7829
-
7830
- // Convert result to a 13-bit binary string
7831
- bitBuffer.put(value, 13);
7832
- }
7833
- };
7834
-
7835
- var kanjiData = KanjiData;
7836
-
7837
- var dijkstra_1 = createCommonjsModule(function (module) {
7838
-
7839
- /******************************************************************************
7840
- * Created 2008-08-19.
7841
- *
7842
- * Dijkstra path-finding functions. Adapted from the Dijkstar Python project.
7843
- *
7844
- * Copyright (C) 2008
7845
- * Wyatt Baldwin <self@wyattbaldwin.com>
7846
- * All rights reserved
7847
- *
7848
- * Licensed under the MIT license.
7849
- *
7850
- * http://www.opensource.org/licenses/mit-license.php
7851
- *
7852
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
7853
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
7854
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
7855
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
7856
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
7857
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
7858
- * THE SOFTWARE.
7859
- *****************************************************************************/
7860
- var dijkstra = {
7861
- single_source_shortest_paths: function(graph, s, d) {
7862
- // Predecessor map for each node that has been encountered.
7863
- // node ID => predecessor node ID
7864
- var predecessors = {};
7865
-
7866
- // Costs of shortest paths from s to all nodes encountered.
7867
- // node ID => cost
7868
- var costs = {};
7869
- costs[s] = 0;
7870
-
7871
- // Costs of shortest paths from s to all nodes encountered; differs from
7872
- // `costs` in that it provides easy access to the node that currently has
7873
- // the known shortest path from s.
7874
- // XXX: Do we actually need both `costs` and `open`?
7875
- var open = dijkstra.PriorityQueue.make();
7876
- open.push(s, 0);
7877
-
7878
- var closest,
7879
- u, v,
7880
- cost_of_s_to_u,
7881
- adjacent_nodes,
7882
- cost_of_e,
7883
- cost_of_s_to_u_plus_cost_of_e,
7884
- cost_of_s_to_v,
7885
- first_visit;
7886
- while (!open.empty()) {
7887
- // In the nodes remaining in graph that have a known cost from s,
7888
- // find the node, u, that currently has the shortest path from s.
7889
- closest = open.pop();
7890
- u = closest.value;
7891
- cost_of_s_to_u = closest.cost;
7892
-
7893
- // Get nodes adjacent to u...
7894
- adjacent_nodes = graph[u] || {};
7895
-
7896
- // ...and explore the edges that connect u to those nodes, updating
7897
- // the cost of the shortest paths to any or all of those nodes as
7898
- // necessary. v is the node across the current edge from u.
7899
- for (v in adjacent_nodes) {
7900
- if (adjacent_nodes.hasOwnProperty(v)) {
7901
- // Get the cost of the edge running from u to v.
7902
- cost_of_e = adjacent_nodes[v];
7903
-
7904
- // Cost of s to u plus the cost of u to v across e--this is *a*
7905
- // cost from s to v that may or may not be less than the current
7906
- // known cost to v.
7907
- cost_of_s_to_u_plus_cost_of_e = cost_of_s_to_u + cost_of_e;
7908
-
7909
- // If we haven't visited v yet OR if the current known cost from s to
7910
- // v is greater than the new cost we just found (cost of s to u plus
7911
- // cost of u to v across e), update v's cost in the cost list and
7912
- // update v's predecessor in the predecessor list (it's now u).
7913
- cost_of_s_to_v = costs[v];
7914
- first_visit = (typeof costs[v] === 'undefined');
7915
- if (first_visit || cost_of_s_to_v > cost_of_s_to_u_plus_cost_of_e) {
7916
- costs[v] = cost_of_s_to_u_plus_cost_of_e;
7917
- open.push(v, cost_of_s_to_u_plus_cost_of_e);
7918
- predecessors[v] = u;
7919
- }
7920
- }
7921
- }
7922
- }
7923
-
7924
- if (typeof d !== 'undefined' && typeof costs[d] === 'undefined') {
7925
- var msg = ['Could not find a path from ', s, ' to ', d, '.'].join('');
7926
- throw new Error(msg);
7927
- }
7928
-
7929
- return predecessors;
7930
- },
7931
-
7932
- extract_shortest_path_from_predecessor_list: function(predecessors, d) {
7933
- var nodes = [];
7934
- var u = d;
7935
- while (u) {
7936
- nodes.push(u);
7937
- u = predecessors[u];
7938
- }
7939
- nodes.reverse();
7940
- return nodes;
7941
- },
7942
-
7943
- find_path: function(graph, s, d) {
7944
- var predecessors = dijkstra.single_source_shortest_paths(graph, s, d);
7945
- return dijkstra.extract_shortest_path_from_predecessor_list(
7946
- predecessors, d);
7947
- },
7948
-
7949
- /**
7950
- * A very naive priority queue implementation.
7951
- */
7952
- PriorityQueue: {
7953
- make: function (opts) {
7954
- var T = dijkstra.PriorityQueue,
7955
- t = {},
7956
- key;
7957
- opts = opts || {};
7958
- for (key in T) {
7959
- if (T.hasOwnProperty(key)) {
7960
- t[key] = T[key];
7961
- }
7962
- }
7963
- t.queue = [];
7964
- t.sorter = opts.sorter || T.default_sorter;
7965
- return t;
7966
- },
7967
-
7968
- default_sorter: function (a, b) {
7969
- return a.cost - b.cost;
7970
- },
7971
-
7972
- /**
7973
- * Add a new item to the queue and ensure the highest priority element
7974
- * is at the front of the queue.
7975
- */
7976
- push: function (value, cost) {
7977
- var item = {value: value, cost: cost};
7978
- this.queue.push(item);
7979
- this.queue.sort(this.sorter);
7980
- },
7981
-
7982
- /**
7983
- * Return the highest priority element in the queue.
7984
- */
7985
- pop: function () {
7986
- return this.queue.shift();
7987
- },
7988
-
7989
- empty: function () {
7990
- return this.queue.length === 0;
7991
- }
7992
- }
7993
- };
7994
-
7995
-
7996
- // node.js module exports
7997
- {
7998
- module.exports = dijkstra;
7999
- }
8000
- });
8001
-
8002
- var segments = createCommonjsModule(function (module, exports) {
8003
- /**
8004
- * Returns UTF8 byte length
8005
- *
8006
- * @param {String} str Input string
8007
- * @return {Number} Number of byte
8008
- */
8009
- function getStringByteLength (str) {
8010
- return unescape(encodeURIComponent(str)).length
8011
- }
8012
-
8013
- /**
8014
- * Get a list of segments of the specified mode
8015
- * from a string
8016
- *
8017
- * @param {Mode} mode Segment mode
8018
- * @param {String} str String to process
8019
- * @return {Array} Array of object with segments data
8020
- */
8021
- function getSegments (regex, mode, str) {
8022
- const segments = [];
8023
- let result;
8024
-
8025
- while ((result = regex.exec(str)) !== null) {
8026
- segments.push({
8027
- data: result[0],
8028
- index: result.index,
8029
- mode: mode,
8030
- length: result[0].length
8031
- });
8032
- }
8033
-
8034
- return segments
8035
- }
8036
-
8037
- /**
8038
- * Extracts a series of segments with the appropriate
8039
- * modes from a string
8040
- *
8041
- * @param {String} dataStr Input string
8042
- * @return {Array} Array of object with segments data
8043
- */
8044
- function getSegmentsFromString (dataStr) {
8045
- const numSegs = getSegments(regex.NUMERIC, mode.NUMERIC, dataStr);
8046
- const alphaNumSegs = getSegments(regex.ALPHANUMERIC, mode.ALPHANUMERIC, dataStr);
8047
- let byteSegs;
8048
- let kanjiSegs;
8049
-
8050
- if (utils$1.isKanjiModeEnabled()) {
8051
- byteSegs = getSegments(regex.BYTE, mode.BYTE, dataStr);
8052
- kanjiSegs = getSegments(regex.KANJI, mode.KANJI, dataStr);
8053
- } else {
8054
- byteSegs = getSegments(regex.BYTE_KANJI, mode.BYTE, dataStr);
8055
- kanjiSegs = [];
8056
- }
8057
-
8058
- const segs = numSegs.concat(alphaNumSegs, byteSegs, kanjiSegs);
8059
-
8060
- return segs
8061
- .sort(function (s1, s2) {
8062
- return s1.index - s2.index
8063
- })
8064
- .map(function (obj) {
8065
- return {
8066
- data: obj.data,
8067
- mode: obj.mode,
8068
- length: obj.length
8069
- }
8070
- })
8071
- }
8072
-
8073
- /**
8074
- * Returns how many bits are needed to encode a string of
8075
- * specified length with the specified mode
8076
- *
8077
- * @param {Number} length String length
8078
- * @param {Mode} mode Segment mode
8079
- * @return {Number} Bit length
8080
- */
8081
- function getSegmentBitsLength (length, mode$1) {
8082
- switch (mode$1) {
8083
- case mode.NUMERIC:
8084
- return numericData.getBitsLength(length)
8085
- case mode.ALPHANUMERIC:
8086
- return alphanumericData.getBitsLength(length)
8087
- case mode.KANJI:
8088
- return kanjiData.getBitsLength(length)
8089
- case mode.BYTE:
8090
- return byteData.getBitsLength(length)
8091
- }
8092
- }
8093
-
8094
- /**
8095
- * Merges adjacent segments which have the same mode
8096
- *
8097
- * @param {Array} segs Array of object with segments data
8098
- * @return {Array} Array of object with segments data
8099
- */
8100
- function mergeSegments (segs) {
8101
- return segs.reduce(function (acc, curr) {
8102
- const prevSeg = acc.length - 1 >= 0 ? acc[acc.length - 1] : null;
8103
- if (prevSeg && prevSeg.mode === curr.mode) {
8104
- acc[acc.length - 1].data += curr.data;
8105
- return acc
8106
- }
8107
-
8108
- acc.push(curr);
8109
- return acc
8110
- }, [])
8111
- }
8112
-
8113
- /**
8114
- * Generates a list of all possible nodes combination which
8115
- * will be used to build a segments graph.
8116
- *
8117
- * Nodes are divided by groups. Each group will contain a list of all the modes
8118
- * in which is possible to encode the given text.
8119
- *
8120
- * For example the text '12345' can be encoded as Numeric, Alphanumeric or Byte.
8121
- * The group for '12345' will contain then 3 objects, one for each
8122
- * possible encoding mode.
8123
- *
8124
- * Each node represents a possible segment.
8125
- *
8126
- * @param {Array} segs Array of object with segments data
8127
- * @return {Array} Array of object with segments data
8128
- */
8129
- function buildNodes (segs) {
8130
- const nodes = [];
8131
- for (let i = 0; i < segs.length; i++) {
8132
- const seg = segs[i];
8133
-
8134
- switch (seg.mode) {
8135
- case mode.NUMERIC:
8136
- nodes.push([seg,
8137
- { data: seg.data, mode: mode.ALPHANUMERIC, length: seg.length },
8138
- { data: seg.data, mode: mode.BYTE, length: seg.length }
8139
- ]);
8140
- break
8141
- case mode.ALPHANUMERIC:
8142
- nodes.push([seg,
8143
- { data: seg.data, mode: mode.BYTE, length: seg.length }
8144
- ]);
8145
- break
8146
- case mode.KANJI:
8147
- nodes.push([seg,
8148
- { data: seg.data, mode: mode.BYTE, length: getStringByteLength(seg.data) }
8149
- ]);
8150
- break
8151
- case mode.BYTE:
8152
- nodes.push([
8153
- { data: seg.data, mode: mode.BYTE, length: getStringByteLength(seg.data) }
8154
- ]);
8155
- }
8156
- }
8157
-
8158
- return nodes
8159
- }
8160
-
8161
- /**
8162
- * Builds a graph from a list of nodes.
8163
- * All segments in each node group will be connected with all the segments of
8164
- * the next group and so on.
8165
- *
8166
- * At each connection will be assigned a weight depending on the
8167
- * segment's byte length.
8168
- *
8169
- * @param {Array} nodes Array of object with segments data
8170
- * @param {Number} version QR Code version
8171
- * @return {Object} Graph of all possible segments
8172
- */
8173
- function buildGraph (nodes, version) {
8174
- const table = {};
8175
- const graph = { start: {} };
8176
- let prevNodeIds = ['start'];
8177
-
8178
- for (let i = 0; i < nodes.length; i++) {
8179
- const nodeGroup = nodes[i];
8180
- const currentNodeIds = [];
8181
-
8182
- for (let j = 0; j < nodeGroup.length; j++) {
8183
- const node = nodeGroup[j];
8184
- const key = '' + i + j;
8185
-
8186
- currentNodeIds.push(key);
8187
- table[key] = { node: node, lastCount: 0 };
8188
- graph[key] = {};
8189
-
8190
- for (let n = 0; n < prevNodeIds.length; n++) {
8191
- const prevNodeId = prevNodeIds[n];
8192
-
8193
- if (table[prevNodeId] && table[prevNodeId].node.mode === node.mode) {
8194
- graph[prevNodeId][key] =
8195
- getSegmentBitsLength(table[prevNodeId].lastCount + node.length, node.mode) -
8196
- getSegmentBitsLength(table[prevNodeId].lastCount, node.mode);
8197
-
8198
- table[prevNodeId].lastCount += node.length;
8199
- } else {
8200
- if (table[prevNodeId]) table[prevNodeId].lastCount = node.length;
8201
-
8202
- graph[prevNodeId][key] = getSegmentBitsLength(node.length, node.mode) +
8203
- 4 + mode.getCharCountIndicator(node.mode, version); // switch cost
8204
- }
8205
- }
8206
- }
8207
-
8208
- prevNodeIds = currentNodeIds;
8209
- }
8210
-
8211
- for (let n = 0; n < prevNodeIds.length; n++) {
8212
- graph[prevNodeIds[n]].end = 0;
8213
- }
8214
-
8215
- return { map: graph, table: table }
8216
- }
8217
-
8218
- /**
8219
- * Builds a segment from a specified data and mode.
8220
- * If a mode is not specified, the more suitable will be used.
8221
- *
8222
- * @param {String} data Input data
8223
- * @param {Mode | String} modesHint Data mode
8224
- * @return {Segment} Segment
8225
- */
8226
- function buildSingleSegment (data, modesHint) {
8227
- let mode$1;
8228
- const bestMode = mode.getBestModeForData(data);
8229
-
8230
- mode$1 = mode.from(modesHint, bestMode);
8231
-
8232
- // Make sure data can be encoded
8233
- if (mode$1 !== mode.BYTE && mode$1.bit < bestMode.bit) {
8234
- throw new Error('"' + data + '"' +
8235
- ' cannot be encoded with mode ' + mode.toString(mode$1) +
8236
- '.\n Suggested mode is: ' + mode.toString(bestMode))
8237
- }
8238
-
8239
- // Use Mode.BYTE if Kanji support is disabled
8240
- if (mode$1 === mode.KANJI && !utils$1.isKanjiModeEnabled()) {
8241
- mode$1 = mode.BYTE;
8242
- }
8243
-
8244
- switch (mode$1) {
8245
- case mode.NUMERIC:
8246
- return new numericData(data)
8247
-
8248
- case mode.ALPHANUMERIC:
8249
- return new alphanumericData(data)
8250
-
8251
- case mode.KANJI:
8252
- return new kanjiData(data)
8253
-
8254
- case mode.BYTE:
8255
- return new byteData(data)
8256
- }
8257
- }
8258
-
8259
- /**
8260
- * Builds a list of segments from an array.
8261
- * Array can contain Strings or Objects with segment's info.
8262
- *
8263
- * For each item which is a string, will be generated a segment with the given
8264
- * string and the more appropriate encoding mode.
8265
- *
8266
- * For each item which is an object, will be generated a segment with the given
8267
- * data and mode.
8268
- * Objects must contain at least the property "data".
8269
- * If property "mode" is not present, the more suitable mode will be used.
8270
- *
8271
- * @param {Array} array Array of objects with segments data
8272
- * @return {Array} Array of Segments
8273
- */
8274
- exports.fromArray = function fromArray (array) {
8275
- return array.reduce(function (acc, seg) {
8276
- if (typeof seg === 'string') {
8277
- acc.push(buildSingleSegment(seg, null));
8278
- } else if (seg.data) {
8279
- acc.push(buildSingleSegment(seg.data, seg.mode));
8280
- }
8281
-
8282
- return acc
8283
- }, [])
8284
- };
8285
-
8286
- /**
8287
- * Builds an optimized sequence of segments from a string,
8288
- * which will produce the shortest possible bitstream.
8289
- *
8290
- * @param {String} data Input string
8291
- * @param {Number} version QR Code version
8292
- * @return {Array} Array of segments
8293
- */
8294
- exports.fromString = function fromString (data, version) {
8295
- const segs = getSegmentsFromString(data, utils$1.isKanjiModeEnabled());
8296
-
8297
- const nodes = buildNodes(segs);
8298
- const graph = buildGraph(nodes, version);
8299
- const path = dijkstra_1.find_path(graph.map, 'start', 'end');
8300
-
8301
- const optimizedSegs = [];
8302
- for (let i = 1; i < path.length - 1; i++) {
8303
- optimizedSegs.push(graph.table[path[i]].node);
8304
- }
8305
-
8306
- return exports.fromArray(mergeSegments(optimizedSegs))
8307
- };
8308
-
8309
- /**
8310
- * Splits a string in various segments with the modes which
8311
- * best represent their content.
8312
- * The produced segments are far from being optimized.
8313
- * The output of this function is only used to estimate a QR Code version
8314
- * which may contain the data.
8315
- *
8316
- * @param {string} data Input string
8317
- * @return {Array} Array of segments
8318
- */
8319
- exports.rawSplit = function rawSplit (data) {
8320
- return exports.fromArray(
8321
- getSegmentsFromString(data, utils$1.isKanjiModeEnabled())
8322
- )
8323
- };
8324
- });
8325
-
8326
- /**
8327
- * QRCode for JavaScript
8328
- *
8329
- * modified by Ryan Day for nodejs support
8330
- * Copyright (c) 2011 Ryan Day
8331
- *
8332
- * Licensed under the MIT license:
8333
- * http://www.opensource.org/licenses/mit-license.php
8334
- *
8335
- //---------------------------------------------------------------------
8336
- // QRCode for JavaScript
8337
- //
8338
- // Copyright (c) 2009 Kazuhiko Arase
8339
- //
8340
- // URL: http://www.d-project.com/
8341
- //
8342
- // Licensed under the MIT license:
8343
- // http://www.opensource.org/licenses/mit-license.php
8344
- //
8345
- // The word "QR Code" is registered trademark of
8346
- // DENSO WAVE INCORPORATED
8347
- // http://www.denso-wave.com/qrcode/faqpatent-e.html
8348
- //
8349
- //---------------------------------------------------------------------
8350
- */
8351
-
8352
- /**
8353
- * Add finder patterns bits to matrix
8354
- *
8355
- * @param {BitMatrix} matrix Modules matrix
8356
- * @param {Number} version QR Code version
8357
- */
8358
- function setupFinderPattern (matrix, version) {
8359
- const size = matrix.size;
8360
- const pos = finderPattern.getPositions(version);
8361
-
8362
- for (let i = 0; i < pos.length; i++) {
8363
- const row = pos[i][0];
8364
- const col = pos[i][1];
8365
-
8366
- for (let r = -1; r <= 7; r++) {
8367
- if (row + r <= -1 || size <= row + r) continue
8368
-
8369
- for (let c = -1; c <= 7; c++) {
8370
- if (col + c <= -1 || size <= col + c) continue
8371
-
8372
- if ((r >= 0 && r <= 6 && (c === 0 || c === 6)) ||
8373
- (c >= 0 && c <= 6 && (r === 0 || r === 6)) ||
8374
- (r >= 2 && r <= 4 && c >= 2 && c <= 4)) {
8375
- matrix.set(row + r, col + c, true, true);
8376
- } else {
8377
- matrix.set(row + r, col + c, false, true);
8378
- }
8379
- }
8380
- }
8381
- }
8382
- }
8383
-
8384
- /**
8385
- * Add timing pattern bits to matrix
8386
- *
8387
- * Note: this function must be called before {@link setupAlignmentPattern}
8388
- *
8389
- * @param {BitMatrix} matrix Modules matrix
8390
- */
8391
- function setupTimingPattern (matrix) {
8392
- const size = matrix.size;
8393
-
8394
- for (let r = 8; r < size - 8; r++) {
8395
- const value = r % 2 === 0;
8396
- matrix.set(r, 6, value, true);
8397
- matrix.set(6, r, value, true);
8398
- }
8399
- }
8400
-
8401
- /**
8402
- * Add alignment patterns bits to matrix
8403
- *
8404
- * Note: this function must be called after {@link setupTimingPattern}
8405
- *
8406
- * @param {BitMatrix} matrix Modules matrix
8407
- * @param {Number} version QR Code version
8408
- */
8409
- function setupAlignmentPattern (matrix, version) {
8410
- const pos = alignmentPattern.getPositions(version);
8411
-
8412
- for (let i = 0; i < pos.length; i++) {
8413
- const row = pos[i][0];
8414
- const col = pos[i][1];
8415
-
8416
- for (let r = -2; r <= 2; r++) {
8417
- for (let c = -2; c <= 2; c++) {
8418
- if (r === -2 || r === 2 || c === -2 || c === 2 ||
8419
- (r === 0 && c === 0)) {
8420
- matrix.set(row + r, col + c, true, true);
8421
- } else {
8422
- matrix.set(row + r, col + c, false, true);
8423
- }
8424
- }
8425
- }
8426
- }
8427
- }
8428
-
8429
- /**
8430
- * Add version info bits to matrix
8431
- *
8432
- * @param {BitMatrix} matrix Modules matrix
8433
- * @param {Number} version QR Code version
8434
- */
8435
- function setupVersionInfo (matrix, version$1) {
8436
- const size = matrix.size;
8437
- const bits = version.getEncodedBits(version$1);
8438
- let row, col, mod;
8439
-
8440
- for (let i = 0; i < 18; i++) {
8441
- row = Math.floor(i / 3);
8442
- col = i % 3 + size - 8 - 3;
8443
- mod = ((bits >> i) & 1) === 1;
8444
-
8445
- matrix.set(row, col, mod, true);
8446
- matrix.set(col, row, mod, true);
8447
- }
8448
- }
8449
-
8450
- /**
8451
- * Add format info bits to matrix
8452
- *
8453
- * @param {BitMatrix} matrix Modules matrix
8454
- * @param {ErrorCorrectionLevel} errorCorrectionLevel Error correction level
8455
- * @param {Number} maskPattern Mask pattern reference value
8456
- */
8457
- function setupFormatInfo (matrix, errorCorrectionLevel, maskPattern) {
8458
- const size = matrix.size;
8459
- const bits = formatInfo.getEncodedBits(errorCorrectionLevel, maskPattern);
8460
- let i, mod;
8461
-
8462
- for (i = 0; i < 15; i++) {
8463
- mod = ((bits >> i) & 1) === 1;
8464
-
8465
- // vertical
8466
- if (i < 6) {
8467
- matrix.set(i, 8, mod, true);
8468
- } else if (i < 8) {
8469
- matrix.set(i + 1, 8, mod, true);
8470
- } else {
8471
- matrix.set(size - 15 + i, 8, mod, true);
8472
- }
8473
-
8474
- // horizontal
8475
- if (i < 8) {
8476
- matrix.set(8, size - i - 1, mod, true);
8477
- } else if (i < 9) {
8478
- matrix.set(8, 15 - i - 1 + 1, mod, true);
8479
- } else {
8480
- matrix.set(8, 15 - i - 1, mod, true);
8481
- }
8482
- }
8483
-
8484
- // fixed module
8485
- matrix.set(size - 8, 8, 1, true);
8486
- }
8487
-
8488
- /**
8489
- * Add encoded data bits to matrix
8490
- *
8491
- * @param {BitMatrix} matrix Modules matrix
8492
- * @param {Uint8Array} data Data codewords
8493
- */
8494
- function setupData (matrix, data) {
8495
- const size = matrix.size;
8496
- let inc = -1;
8497
- let row = size - 1;
8498
- let bitIndex = 7;
8499
- let byteIndex = 0;
8500
-
8501
- for (let col = size - 1; col > 0; col -= 2) {
8502
- if (col === 6) col--;
8503
-
8504
- while (true) {
8505
- for (let c = 0; c < 2; c++) {
8506
- if (!matrix.isReserved(row, col - c)) {
8507
- let dark = false;
8508
-
8509
- if (byteIndex < data.length) {
8510
- dark = (((data[byteIndex] >>> bitIndex) & 1) === 1);
8511
- }
8512
-
8513
- matrix.set(row, col - c, dark);
8514
- bitIndex--;
8515
-
8516
- if (bitIndex === -1) {
8517
- byteIndex++;
8518
- bitIndex = 7;
8519
- }
8520
- }
8521
- }
8522
-
8523
- row += inc;
8524
-
8525
- if (row < 0 || size <= row) {
8526
- row -= inc;
8527
- inc = -inc;
8528
- break
8529
- }
8530
- }
8531
- }
8532
- }
8533
-
8534
- /**
8535
- * Create encoded codewords from data input
8536
- *
8537
- * @param {Number} version QR Code version
8538
- * @param {ErrorCorrectionLevel} errorCorrectionLevel Error correction level
8539
- * @param {ByteData} data Data input
8540
- * @return {Uint8Array} Buffer containing encoded codewords
8541
- */
8542
- function createData (version, errorCorrectionLevel, segments) {
8543
- // Prepare data buffer
8544
- const buffer = new bitBuffer();
8545
-
8546
- segments.forEach(function (data) {
8547
- // prefix data with mode indicator (4 bits)
8548
- buffer.put(data.mode.bit, 4);
8549
-
8550
- // Prefix data with character count indicator.
8551
- // The character count indicator is a string of bits that represents the
8552
- // number of characters that are being encoded.
8553
- // The character count indicator must be placed after the mode indicator
8554
- // and must be a certain number of bits long, depending on the QR version
8555
- // and data mode
8556
- // @see {@link Mode.getCharCountIndicator}.
8557
- buffer.put(data.getLength(), mode.getCharCountIndicator(data.mode, version));
8558
-
8559
- // add binary data sequence to buffer
8560
- data.write(buffer);
8561
- });
8562
-
8563
- // Calculate required number of bits
8564
- const totalCodewords = utils$1.getSymbolTotalCodewords(version);
8565
- const ecTotalCodewords = errorCorrectionCode.getTotalCodewordsCount(version, errorCorrectionLevel);
8566
- const dataTotalCodewordsBits = (totalCodewords - ecTotalCodewords) * 8;
8567
-
8568
- // Add a terminator.
8569
- // If the bit string is shorter than the total number of required bits,
8570
- // a terminator of up to four 0s must be added to the right side of the string.
8571
- // If the bit string is more than four bits shorter than the required number of bits,
8572
- // add four 0s to the end.
8573
- if (buffer.getLengthInBits() + 4 <= dataTotalCodewordsBits) {
8574
- buffer.put(0, 4);
8575
- }
8576
-
8577
- // If the bit string is fewer than four bits shorter, add only the number of 0s that
8578
- // are needed to reach the required number of bits.
8579
-
8580
- // After adding the terminator, if the number of bits in the string is not a multiple of 8,
8581
- // pad the string on the right with 0s to make the string's length a multiple of 8.
8582
- while (buffer.getLengthInBits() % 8 !== 0) {
8583
- buffer.putBit(0);
8584
- }
8585
-
8586
- // Add pad bytes if the string is still shorter than the total number of required bits.
8587
- // Extend the buffer to fill the data capacity of the symbol corresponding to
8588
- // the Version and Error Correction Level by adding the Pad Codewords 11101100 (0xEC)
8589
- // and 00010001 (0x11) alternately.
8590
- const remainingByte = (dataTotalCodewordsBits - buffer.getLengthInBits()) / 8;
8591
- for (let i = 0; i < remainingByte; i++) {
8592
- buffer.put(i % 2 ? 0x11 : 0xEC, 8);
8593
- }
8594
-
8595
- return createCodewords(buffer, version, errorCorrectionLevel)
8596
- }
8597
-
8598
- /**
8599
- * Encode input data with Reed-Solomon and return codewords with
8600
- * relative error correction bits
8601
- *
8602
- * @param {BitBuffer} bitBuffer Data to encode
8603
- * @param {Number} version QR Code version
8604
- * @param {ErrorCorrectionLevel} errorCorrectionLevel Error correction level
8605
- * @return {Uint8Array} Buffer containing encoded codewords
8606
- */
8607
- function createCodewords (bitBuffer, version, errorCorrectionLevel) {
8608
- // Total codewords for this QR code version (Data + Error correction)
8609
- const totalCodewords = utils$1.getSymbolTotalCodewords(version);
8610
-
8611
- // Total number of error correction codewords
8612
- const ecTotalCodewords = errorCorrectionCode.getTotalCodewordsCount(version, errorCorrectionLevel);
8613
-
8614
- // Total number of data codewords
8615
- const dataTotalCodewords = totalCodewords - ecTotalCodewords;
8616
-
8617
- // Total number of blocks
8618
- const ecTotalBlocks = errorCorrectionCode.getBlocksCount(version, errorCorrectionLevel);
8619
-
8620
- // Calculate how many blocks each group should contain
8621
- const blocksInGroup2 = totalCodewords % ecTotalBlocks;
8622
- const blocksInGroup1 = ecTotalBlocks - blocksInGroup2;
8623
-
8624
- const totalCodewordsInGroup1 = Math.floor(totalCodewords / ecTotalBlocks);
8625
-
8626
- const dataCodewordsInGroup1 = Math.floor(dataTotalCodewords / ecTotalBlocks);
8627
- const dataCodewordsInGroup2 = dataCodewordsInGroup1 + 1;
8628
-
8629
- // Number of EC codewords is the same for both groups
8630
- const ecCount = totalCodewordsInGroup1 - dataCodewordsInGroup1;
8631
-
8632
- // Initialize a Reed-Solomon encoder with a generator polynomial of degree ecCount
8633
- const rs = new reedSolomonEncoder(ecCount);
8634
-
8635
- let offset = 0;
8636
- const dcData = new Array(ecTotalBlocks);
8637
- const ecData = new Array(ecTotalBlocks);
8638
- let maxDataSize = 0;
8639
- const buffer = new Uint8Array(bitBuffer.buffer);
8640
-
8641
- // Divide the buffer into the required number of blocks
8642
- for (let b = 0; b < ecTotalBlocks; b++) {
8643
- const dataSize = b < blocksInGroup1 ? dataCodewordsInGroup1 : dataCodewordsInGroup2;
8644
-
8645
- // extract a block of data from buffer
8646
- dcData[b] = buffer.slice(offset, offset + dataSize);
8647
-
8648
- // Calculate EC codewords for this data block
8649
- ecData[b] = rs.encode(dcData[b]);
8650
-
8651
- offset += dataSize;
8652
- maxDataSize = Math.max(maxDataSize, dataSize);
8653
- }
8654
-
8655
- // Create final data
8656
- // Interleave the data and error correction codewords from each block
8657
- const data = new Uint8Array(totalCodewords);
8658
- let index = 0;
8659
- let i, r;
8660
-
8661
- // Add data codewords
8662
- for (i = 0; i < maxDataSize; i++) {
8663
- for (r = 0; r < ecTotalBlocks; r++) {
8664
- if (i < dcData[r].length) {
8665
- data[index++] = dcData[r][i];
8666
- }
8667
- }
8668
- }
8669
-
8670
- // Apped EC codewords
8671
- for (i = 0; i < ecCount; i++) {
8672
- for (r = 0; r < ecTotalBlocks; r++) {
8673
- data[index++] = ecData[r][i];
8674
- }
8675
- }
8676
-
8677
- return data
8678
- }
8679
-
8680
- /**
8681
- * Build QR Code symbol
8682
- *
8683
- * @param {String} data Input string
8684
- * @param {Number} version QR Code version
8685
- * @param {ErrorCorretionLevel} errorCorrectionLevel Error level
8686
- * @param {MaskPattern} maskPattern Mask pattern
8687
- * @return {Object} Object containing symbol data
8688
- */
8689
- function createSymbol (data, version$1, errorCorrectionLevel, maskPattern$1) {
8690
- let segments$1;
8691
-
8692
- if (Array.isArray(data)) {
8693
- segments$1 = segments.fromArray(data);
8694
- } else if (typeof data === 'string') {
8695
- let estimatedVersion = version$1;
8696
-
8697
- if (!estimatedVersion) {
8698
- const rawSegments = segments.rawSplit(data);
8699
-
8700
- // Estimate best version that can contain raw splitted segments
8701
- estimatedVersion = version.getBestVersionForData(rawSegments, errorCorrectionLevel);
8702
- }
8703
-
8704
- // Build optimized segments
8705
- // If estimated version is undefined, try with the highest version
8706
- segments$1 = segments.fromString(data, estimatedVersion || 40);
8707
- } else {
8708
- throw new Error('Invalid data')
8709
- }
8710
-
8711
- // Get the min version that can contain data
8712
- const bestVersion = version.getBestVersionForData(segments$1, errorCorrectionLevel);
8713
-
8714
- // If no version is found, data cannot be stored
8715
- if (!bestVersion) {
8716
- throw new Error('The amount of data is too big to be stored in a QR Code')
8717
- }
8718
-
8719
- // If not specified, use min version as default
8720
- if (!version$1) {
8721
- version$1 = bestVersion;
8722
-
8723
- // Check if the specified version can contain the data
8724
- } else if (version$1 < bestVersion) {
8725
- throw new Error('\n' +
8726
- 'The chosen QR Code version cannot contain this amount of data.\n' +
8727
- 'Minimum version required to store current data is: ' + bestVersion + '.\n'
8728
- )
8729
- }
8730
-
8731
- const dataBits = createData(version$1, errorCorrectionLevel, segments$1);
8732
-
8733
- // Allocate matrix buffer
8734
- const moduleCount = utils$1.getSymbolSize(version$1);
8735
- const modules = new bitMatrix(moduleCount);
8736
-
8737
- // Add function modules
8738
- setupFinderPattern(modules, version$1);
8739
- setupTimingPattern(modules);
8740
- setupAlignmentPattern(modules, version$1);
8741
-
8742
- // Add temporary dummy bits for format info just to set them as reserved.
8743
- // This is needed to prevent these bits from being masked by {@link MaskPattern.applyMask}
8744
- // since the masking operation must be performed only on the encoding region.
8745
- // These blocks will be replaced with correct values later in code.
8746
- setupFormatInfo(modules, errorCorrectionLevel, 0);
8747
-
8748
- if (version$1 >= 7) {
8749
- setupVersionInfo(modules, version$1);
8750
- }
8751
-
8752
- // Add data codewords
8753
- setupData(modules, dataBits);
8754
-
8755
- if (isNaN(maskPattern$1)) {
8756
- // Find best mask pattern
8757
- maskPattern$1 = maskPattern.getBestMask(modules,
8758
- setupFormatInfo.bind(null, modules, errorCorrectionLevel));
8759
- }
8760
-
8761
- // Apply mask pattern
8762
- maskPattern.applyMask(maskPattern$1, modules);
8763
-
8764
- // Replace format info bits with correct values
8765
- setupFormatInfo(modules, errorCorrectionLevel, maskPattern$1);
8766
-
8767
- return {
8768
- modules: modules,
8769
- version: version$1,
8770
- errorCorrectionLevel: errorCorrectionLevel,
8771
- maskPattern: maskPattern$1,
8772
- segments: segments$1
8773
- }
8774
- }
8775
-
8776
- /**
8777
- * QR Code
8778
- *
8779
- * @param {String | Array} data Input data
8780
- * @param {Object} options Optional configurations
8781
- * @param {Number} options.version QR Code version
8782
- * @param {String} options.errorCorrectionLevel Error correction level
8783
- * @param {Function} options.toSJISFunc Helper func to convert utf8 to sjis
8784
- */
8785
- var create$1 = function create (data, options) {
8786
- if (typeof data === 'undefined' || data === '') {
8787
- throw new Error('No input text')
8788
- }
8789
-
8790
- let errorCorrectionLevel$1 = errorCorrectionLevel.M;
8791
- let version$1;
8792
- let mask;
8793
-
8794
- if (typeof options !== 'undefined') {
8795
- // Use higher error correction level as default
8796
- errorCorrectionLevel$1 = errorCorrectionLevel.from(options.errorCorrectionLevel, errorCorrectionLevel.M);
8797
- version$1 = version.from(options.version);
8798
- mask = maskPattern.from(options.maskPattern);
8799
-
8800
- if (options.toSJISFunc) {
8801
- utils$1.setToSJISFunction(options.toSJISFunc);
8802
- }
8803
- }
8804
-
8805
- return createSymbol(data, version$1, errorCorrectionLevel$1, mask)
8806
- };
8807
-
8808
- var qrcode = {
8809
- create: create$1
8810
- };
8811
-
8812
- var utils = createCommonjsModule(function (module, exports) {
8813
- function hex2rgba (hex) {
8814
- if (typeof hex === 'number') {
8815
- hex = hex.toString();
8816
- }
8817
-
8818
- if (typeof hex !== 'string') {
8819
- throw new Error('Color should be defined as hex string')
8820
- }
8821
-
8822
- let hexCode = hex.slice().replace('#', '').split('');
8823
- if (hexCode.length < 3 || hexCode.length === 5 || hexCode.length > 8) {
8824
- throw new Error('Invalid hex color: ' + hex)
8825
- }
8826
-
8827
- // Convert from short to long form (fff -> ffffff)
8828
- if (hexCode.length === 3 || hexCode.length === 4) {
8829
- hexCode = Array.prototype.concat.apply([], hexCode.map(function (c) {
8830
- return [c, c]
8831
- }));
8832
- }
8833
-
8834
- // Add default alpha value
8835
- if (hexCode.length === 6) hexCode.push('F', 'F');
8836
-
8837
- const hexValue = parseInt(hexCode.join(''), 16);
8838
-
8839
- return {
8840
- r: (hexValue >> 24) & 255,
8841
- g: (hexValue >> 16) & 255,
8842
- b: (hexValue >> 8) & 255,
8843
- a: hexValue & 255,
8844
- hex: '#' + hexCode.slice(0, 6).join('')
8845
- }
8846
- }
8847
-
8848
- exports.getOptions = function getOptions (options) {
8849
- if (!options) options = {};
8850
- if (!options.color) options.color = {};
8851
-
8852
- const margin = typeof options.margin === 'undefined' ||
8853
- options.margin === null ||
8854
- options.margin < 0
8855
- ? 4
8856
- : options.margin;
8857
-
8858
- const width = options.width && options.width >= 21 ? options.width : undefined;
8859
- const scale = options.scale || 4;
8860
-
8861
- return {
8862
- width: width,
8863
- scale: width ? 4 : scale,
8864
- margin: margin,
8865
- color: {
8866
- dark: hex2rgba(options.color.dark || '#000000ff'),
8867
- light: hex2rgba(options.color.light || '#ffffffff')
8868
- },
8869
- type: options.type,
8870
- rendererOpts: options.rendererOpts || {}
8871
- }
8872
- };
8873
-
8874
- exports.getScale = function getScale (qrSize, opts) {
8875
- return opts.width && opts.width >= qrSize + opts.margin * 2
8876
- ? opts.width / (qrSize + opts.margin * 2)
8877
- : opts.scale
8878
- };
8879
-
8880
- exports.getImageWidth = function getImageWidth (qrSize, opts) {
8881
- const scale = exports.getScale(qrSize, opts);
8882
- return Math.floor((qrSize + opts.margin * 2) * scale)
8883
- };
8884
-
8885
- exports.qrToImageData = function qrToImageData (imgData, qr, opts) {
8886
- const size = qr.modules.size;
8887
- const data = qr.modules.data;
8888
- const scale = exports.getScale(size, opts);
8889
- const symbolSize = Math.floor((size + opts.margin * 2) * scale);
8890
- const scaledMargin = opts.margin * scale;
8891
- const palette = [opts.color.light, opts.color.dark];
8892
-
8893
- for (let i = 0; i < symbolSize; i++) {
8894
- for (let j = 0; j < symbolSize; j++) {
8895
- let posDst = (i * symbolSize + j) * 4;
8896
- let pxColor = opts.color.light;
8897
-
8898
- if (i >= scaledMargin && j >= scaledMargin &&
8899
- i < symbolSize - scaledMargin && j < symbolSize - scaledMargin) {
8900
- const iSrc = Math.floor((i - scaledMargin) / scale);
8901
- const jSrc = Math.floor((j - scaledMargin) / scale);
8902
- pxColor = palette[data[iSrc * size + jSrc] ? 1 : 0];
8903
- }
8904
-
8905
- imgData[posDst++] = pxColor.r;
8906
- imgData[posDst++] = pxColor.g;
8907
- imgData[posDst++] = pxColor.b;
8908
- imgData[posDst] = pxColor.a;
8909
- }
8910
- }
8911
- };
8912
- });
8913
-
8914
- var canvas = createCommonjsModule(function (module, exports) {
8915
- function clearCanvas (ctx, canvas, size) {
8916
- ctx.clearRect(0, 0, canvas.width, canvas.height);
8917
-
8918
- if (!canvas.style) canvas.style = {};
8919
- canvas.height = size;
8920
- canvas.width = size;
8921
- canvas.style.height = size + 'px';
8922
- canvas.style.width = size + 'px';
8923
- }
8924
-
8925
- function getCanvasElement () {
8926
- try {
8927
- return document.createElement('canvas')
8928
- } catch (e) {
8929
- throw new Error('You need to specify a canvas element')
8930
- }
8931
- }
8932
-
8933
- exports.render = function render (qrData, canvas, options) {
8934
- let opts = options;
8935
- let canvasEl = canvas;
8936
-
8937
- if (typeof opts === 'undefined' && (!canvas || !canvas.getContext)) {
8938
- opts = canvas;
8939
- canvas = undefined;
8940
- }
8941
-
8942
- if (!canvas) {
8943
- canvasEl = getCanvasElement();
8944
- }
8945
-
8946
- opts = utils.getOptions(opts);
8947
- const size = utils.getImageWidth(qrData.modules.size, opts);
8948
-
8949
- const ctx = canvasEl.getContext('2d');
8950
- const image = ctx.createImageData(size, size);
8951
- utils.qrToImageData(image.data, qrData, opts);
8952
-
8953
- clearCanvas(ctx, canvasEl, size);
8954
- ctx.putImageData(image, 0, 0);
8955
-
8956
- return canvasEl
8957
- };
8958
-
8959
- exports.renderToDataURL = function renderToDataURL (qrData, canvas, options) {
8960
- let opts = options;
8961
-
8962
- if (typeof opts === 'undefined' && (!canvas || !canvas.getContext)) {
8963
- opts = canvas;
8964
- canvas = undefined;
8965
- }
8966
-
8967
- if (!opts) opts = {};
8968
-
8969
- const canvasEl = exports.render(qrData, canvas, opts);
8970
-
8971
- const type = opts.type || 'image/png';
8972
- const rendererOpts = opts.rendererOpts || {};
8973
-
8974
- return canvasEl.toDataURL(type, rendererOpts.quality)
8975
- };
8976
- });
8977
-
8978
- function getColorAttrib (color, attrib) {
8979
- const alpha = color.a / 255;
8980
- const str = attrib + '="' + color.hex + '"';
8981
-
8982
- return alpha < 1
8983
- ? str + ' ' + attrib + '-opacity="' + alpha.toFixed(2).slice(1) + '"'
8984
- : str
8985
- }
8986
-
8987
- function svgCmd (cmd, x, y) {
8988
- let str = cmd + x;
8989
- if (typeof y !== 'undefined') str += ' ' + y;
8990
-
8991
- return str
8992
- }
8993
-
8994
- function qrToPath (data, size, margin) {
8995
- let path = '';
8996
- let moveBy = 0;
8997
- let newRow = false;
8998
- let lineLength = 0;
8999
-
9000
- for (let i = 0; i < data.length; i++) {
9001
- const col = Math.floor(i % size);
9002
- const row = Math.floor(i / size);
9003
-
9004
- if (!col && !newRow) newRow = true;
9005
-
9006
- if (data[i]) {
9007
- lineLength++;
9008
-
9009
- if (!(i > 0 && col > 0 && data[i - 1])) {
9010
- path += newRow
9011
- ? svgCmd('M', col + margin, 0.5 + row + margin)
9012
- : svgCmd('m', moveBy, 0);
9013
-
9014
- moveBy = 0;
9015
- newRow = false;
9016
- }
9017
-
9018
- if (!(col + 1 < size && data[i + 1])) {
9019
- path += svgCmd('h', lineLength);
9020
- lineLength = 0;
9021
- }
9022
- } else {
9023
- moveBy++;
9024
- }
9025
- }
9026
-
9027
- return path
9028
- }
9029
-
9030
- var render = function render (qrData, options, cb) {
9031
- const opts = utils.getOptions(options);
9032
- const size = qrData.modules.size;
9033
- const data = qrData.modules.data;
9034
- const qrcodesize = size + opts.margin * 2;
9035
-
9036
- const bg = !opts.color.light.a
9037
- ? ''
9038
- : '<path ' + getColorAttrib(opts.color.light, 'fill') +
9039
- ' d="M0 0h' + qrcodesize + 'v' + qrcodesize + 'H0z"/>';
9040
-
9041
- const path =
9042
- '<path ' + getColorAttrib(opts.color.dark, 'stroke') +
9043
- ' d="' + qrToPath(data, size, opts.margin) + '"/>';
9044
-
9045
- const viewBox = 'viewBox="' + '0 0 ' + qrcodesize + ' ' + qrcodesize + '"';
9046
-
9047
- const width = !opts.width ? '' : 'width="' + opts.width + '" height="' + opts.width + '" ';
9048
-
9049
- const svgTag = '<svg xmlns="http://www.w3.org/2000/svg" ' + width + viewBox + ' shape-rendering="crispEdges">' + bg + path + '</svg>\n';
9050
-
9051
- if (typeof cb === 'function') {
9052
- cb(null, svgTag);
9053
- }
9054
-
9055
- return svgTag
9056
- };
9057
-
9058
- var svgTag = {
9059
- render: render
9060
- };
9061
-
9062
- function renderCanvas (renderFunc, canvas, text, opts, cb) {
9063
- const args = [].slice.call(arguments, 1);
9064
- const argsNum = args.length;
9065
- const isLastArgCb = typeof args[argsNum - 1] === 'function';
9066
-
9067
- if (!isLastArgCb && !canPromise()) {
9068
- throw new Error('Callback required as last argument')
9069
- }
9070
-
9071
- if (isLastArgCb) {
9072
- if (argsNum < 2) {
9073
- throw new Error('Too few arguments provided')
9074
- }
9075
-
9076
- if (argsNum === 2) {
9077
- cb = text;
9078
- text = canvas;
9079
- canvas = opts = undefined;
9080
- } else if (argsNum === 3) {
9081
- if (canvas.getContext && typeof cb === 'undefined') {
9082
- cb = opts;
9083
- opts = undefined;
9084
- } else {
9085
- cb = opts;
9086
- opts = text;
9087
- text = canvas;
9088
- canvas = undefined;
9089
- }
9090
- }
9091
- } else {
9092
- if (argsNum < 1) {
9093
- throw new Error('Too few arguments provided')
9094
- }
9095
-
9096
- if (argsNum === 1) {
9097
- text = canvas;
9098
- canvas = opts = undefined;
9099
- } else if (argsNum === 2 && !canvas.getContext) {
9100
- opts = text;
9101
- text = canvas;
9102
- canvas = undefined;
9103
- }
9104
-
9105
- return new Promise(function (resolve, reject) {
9106
- try {
9107
- const data = qrcode.create(text, opts);
9108
- resolve(renderFunc(data, canvas, opts));
9109
- } catch (e) {
9110
- reject(e);
9111
- }
9112
- })
9113
- }
9114
-
9115
- try {
9116
- const data = qrcode.create(text, opts);
9117
- cb(null, renderFunc(data, canvas, opts));
9118
- } catch (e) {
9119
- cb(e);
9120
- }
9121
- }
9122
-
9123
- var create = qrcode.create;
9124
- var toCanvas = renderCanvas.bind(null, canvas.render);
9125
- var toDataURL = renderCanvas.bind(null, canvas.renderToDataURL);
9126
-
9127
- // only svg for now.
9128
- var toString_1 = renderCanvas.bind(null, function (data, _, opts) {
9129
- return svgTag.render(data, opts)
9130
- });
9131
-
9132
- var browser = {
9133
- create: create,
9134
- toCanvas: toCanvas,
9135
- toDataURL: toDataURL,
9136
- toString: toString_1
9137
- };
9138
-
9139
- const mobileRedirectCss = ".qr-canvas{max-height:60vh;max-width:80vw;text-align:center}.qr-canvas>canvas{width:100%;height:100%}";
9140
-
9141
- const MobileRedirect = class {
9142
- constructor(hostRef) {
9143
- registerInstance(this, hostRef);
9144
- this.apiErrorEvent = createEvent(this, "apiError", 7);
9145
- this.delay = ms => new Promise(res => setTimeout(res, ms));
9146
- this.infoTextTop = undefined;
9147
- this.infoTextBottom = undefined;
9148
- this.contact = undefined;
9149
- this.invalidValue = undefined;
9150
- this.waitingMobile = undefined;
9151
- this.orderStatus = undefined;
9152
- this.redirectLink = undefined;
9153
- this.qrCode = undefined;
9154
- this.prefilledPhone = false;
9155
- this.apiCall = new ApiCall();
9156
- this.invalidValue = false;
9157
- this.waitingMobile = false;
9158
- }
9159
- async componentWillLoad() {
9160
- this.infoTextTop = MobileRedirectValues.InfoTop;
9161
- this.infoTextBottom = MobileRedirectValues.InfoBottom;
9162
- let envUri = state.environment == 'PROD' ? 'ect' : 'test';
9163
- let baseUri = state.hasIdBack ? 'https://onmd.id-kyc.com/' : 'https://onro.id-kyc.com/';
9164
- this.redirectLink = baseUri + envUri + '/identification?redirectId=' + state.redirectId;
9165
- if (state.phoneNumber != '') {
9166
- this.contact = state.phoneNumber;
9167
- this.prefilledPhone = true;
9168
- }
9169
- var self = this;
9170
- browser.toDataURL(this.redirectLink, { type: 'image/png', errorCorrectionLevel: 'M', scale: 6 }, function (error, url) {
9171
- if (error)
9172
- console.error(error);
9173
- self.qrCode = url;
9174
- });
9175
- }
9176
- componentWillRender() { }
9177
- async componentDidLoad() {
9178
- await this.delay(5000);
9179
- await this.checkStatus();
9180
- while (this.orderStatus == OrderStatuses.Capturing || this.orderStatus == OrderStatuses.Waiting) {
9181
- await this.checkStatus();
9182
- await this.delay(5000);
9183
- }
9184
- }
9185
- async checkStatus() {
9186
- this.orderStatus = await this.apiCall.GetStatus(state.requestId);
9187
- if (this.orderStatus == OrderStatuses.FinishedCapturing) {
9188
- this.waitingMobile = false;
9189
- state.flowStatus = FlowStatus.COMPLETE;
9190
- }
9191
- if (this.orderStatus == OrderStatuses.NotFound) {
9192
- this.apiErrorEvent.emit({ message: 'No order was started for this process.' });
9193
- }
9194
- if (this.orderStatus == OrderStatuses.Capturing) {
9195
- this.infoTextTop = MobileRedirectValues.InfoWaiting;
9196
- this.waitingMobile = true;
9197
- }
9198
- }
9199
- async buttonClick() {
9200
- if (this.contact == '' || this.contact.length != 10) {
9201
- return;
9202
- }
9203
- this.waitingMobile = true;
9204
- this.infoTextTop = MobileRedirectValues.InfoWaiting;
9205
- try {
9206
- await this.apiCall.SendLink(this.redirectLink, this.contact);
9207
- }
9208
- catch (e) {
9209
- this.apiErrorEvent.emit(e);
9210
- }
9211
- }
9212
- handleChangeContact(ev) {
9213
- let value = ev.target ? ev.target.value : '';
9214
- this.contact = value.replace(/\D/g, '');
9215
- if (this.contact.length > 10) {
9216
- this.contact = this.contact.substring(0, 10);
9217
- }
9218
- this.invalidValue = this.contact.length != 10;
9219
- ev.target.value = this.contact;
9220
- }
9221
- render() {
9222
- return (h("div", { class: "container" }, h("div", { class: "row" }, h("div", { hidden: this.waitingMobile }, h("div", { class: "text-center" }, h("p", { class: "font-size-2" }, this.infoTextTop)), h("div", { class: "qr-canvas align-center" }, h("img", { src: this.qrCode })), h("div", { class: "text-center" }, h("p", { class: "font-size-2" }, this.infoTextBottom)), h("div", { class: "input-container mb-15" }, h("label", { class: "font-size-18 mb-1 color-red", hidden: this.invalidValue == false }, h("b", null, MobileRedirectValues.Validation)), h("input", { type: "text", id: "codeInput", class: "main-input", disabled: this.prefilledPhone, value: this.contact, onInput: ev => this.handleChangeContact(ev) })), h("div", { class: "pos-relative" }, h("div", { class: "btn-buletin" }, h("button", { class: "main-button", onClick: () => this.buttonClick() }, "Trimite"), h("p", { class: "main-text font-size-18 text-right mb-0" }, MobileRedirectValues.FooterText)))), h("div", { hidden: this.waitingMobile == false }, h("div", { class: "text-center" }, h("p", { class: "font-size-2" }, this.infoTextTop))))));
9223
- }
9224
- };
9225
- MobileRedirect.style = mobileRedirectCss;
9226
-
9227
5769
  const selfieCaptureCss = "";
9228
5770
 
9229
5771
  const SelfieCapture = class {
@@ -9555,4 +6097,4 @@ const UserLiveness = class {
9555
6097
  };
9556
6098
  UserLiveness.style = userLivenessCss;
9557
6099
 
9558
- export { AgreementCheck as agreement_check, AgreementInfo as agreement_info, Camera as camera_comp, CaptureError as capture_error, EndRedirect as end_redirect, ErrorEnd as error_end, HowToInfo as how_to_info, IdBackCapture as id_back_capture, IdCapture as id_capture, IdDoubleSide as id_double_side, IdSingleSide as id_single_side, IdentificationComponent as identification_component, LandingValidation as landing_validation, MobileRedirect as mobile_redirect, SelfieCapture as selfie_capture, SmsCodeValidation as sms_code_validation, UserLiveness as user_liveness };
6100
+ export { AgreementCheck as agreement_check, AgreementInfo as agreement_info, Camera as camera_comp, CaptureError as capture_error, EndRedirect as end_redirect, ErrorEnd as error_end, HowToInfo as how_to_info, IdBackCapture as id_back_capture, IdCapture as id_capture, IdDoubleSide as id_double_side, IdSingleSide as id_single_side, IdentificationComponent as identification_component, LandingValidation as landing_validation, SelfieCapture as selfie_capture, SmsCodeValidation as sms_code_validation, UserLiveness as user_liveness };