@idscan/idvc2 3.9.2 → 3.9.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -0
- package/dist/idvc.js +1 -1
- package/dist/idvc.js.gzip +0 -0
- package/dist/js/defaultConfig.ts +2 -2
- package/dist/js/environment/stepsDescription.ts +13 -1
- package/dist/networks/MRZ-chunk.js +1 -1
- package/dist/networks/PDF-chunk.js +1 -1
- package/dist/types/constatnts/animations.d.ts +3 -3
- package/dist/types/environment/stepsDescription.d.ts +10 -52
- package/dist/types/helpers/timings.d.ts +1 -0
- package/dist/types/initialize.d.ts +4 -6
- package/dist/types/modules/App/getCameraDevice.d.ts +1 -7
- package/dist/types/modules/camera/cameraManager.d.ts +1 -0
- package/dist/types/modules/validation/ValidateDocumentTypes.d.ts +1 -1
- package/package.json +3 -1
- package/dist/types/modules/mediaDevices.d.ts +0 -2
package/dist/idvc.js.gzip
CHANGED
|
Binary file
|
package/dist/js/defaultConfig.ts
CHANGED
|
@@ -147,7 +147,7 @@ const defaultConfig: IDefaultConfig[] = [
|
|
|
147
147
|
name: 'language',
|
|
148
148
|
values: Array.from(supportedLanguages),
|
|
149
149
|
type: 'Array',
|
|
150
|
-
description: '
|
|
150
|
+
description: 'Sets the language for translating text in the library',
|
|
151
151
|
defaultValue: 'en',
|
|
152
152
|
validationFn: 'validateDistinctStringInArray',
|
|
153
153
|
arrayValues: Array.from(supportedLanguages),
|
|
@@ -163,7 +163,7 @@ const defaultConfig: IDefaultConfig[] = [
|
|
|
163
163
|
{
|
|
164
164
|
name: 'documentTypes',
|
|
165
165
|
type: 'Array',
|
|
166
|
-
description: 'The option
|
|
166
|
+
description: 'The option showing required steps for each document type',
|
|
167
167
|
defaultValue: [{
|
|
168
168
|
type: 'DL',
|
|
169
169
|
steps: [
|
|
@@ -1,7 +1,17 @@
|
|
|
1
1
|
export type StepType = 'mrz' | 'front' | 'pdf' | 'face' | 'barcode' | 'back';
|
|
2
2
|
export type StepTypeImageName = StepType | 'mrzFront';
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
type StepDescription = {
|
|
5
|
+
id: number;
|
|
6
|
+
camera: 'environment' | 'user';
|
|
7
|
+
name: string;
|
|
8
|
+
time: number;
|
|
9
|
+
max?: number;
|
|
10
|
+
core: string[];
|
|
11
|
+
description: string;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
const stepsDescription: Record<StepType, StepDescription> = {
|
|
5
15
|
mrz: {
|
|
6
16
|
id: 1,
|
|
7
17
|
camera: 'environment',
|
|
@@ -65,3 +75,5 @@ export default {
|
|
|
65
75
|
description: 'detection and capture information from back side of the document',
|
|
66
76
|
},
|
|
67
77
|
};
|
|
78
|
+
|
|
79
|
+
export default stepsDescription;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(self.webpackChunk_idscan_idvc2=self.webpackChunk_idscan_idvc2||[]).push([[343],{4550:(e,t,r)=>{r.d(t,{o:()=>s});var n=r(7885),o=r(7666);function i(e,t,r,n,o,i,u){try{var a=e[i](u),c=a.value}catch(e){return void r(e)}a.done?t(c):Promise.resolve(c).then(n,o)}function u(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var u=e.apply(t,r);function a(e){i(u,n,o,a,c,"next",e)}function c(e){i(u,n,o,a,c,"throw",e)}a(void 0)}))}}function a(e,t){var r,n,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;u;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return u.label++,{value:i[1],done:!1};case 5:u.label++,n=i[1],i=[0];continue;case 7:i=u.ops.pop(),u.trys.pop();continue;default:if(!(o=u.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){u=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){u.label=i[1];break}if(6===i[0]&&u.label<o[1]){u.label=o[1],o=i;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(i);break}o[2]&&u.ops.pop(),u.trys.pop();continue}i=t.call(e,u)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}}var c,l=(c=u((function(e){var t,r,i,u,c;return a(this,(function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),r=Uint8Array.bind,[4,(0,o.xl)(e)];case 1:return t=new(r.apply(Uint8Array,[void 0,a.sent()])),i=(0,n.ec)(t),u=new Blob([i.buffer],{type:"application/javascript"}),[2,URL.createObjectURL(u)];case 2:throw c=a.sent(),console.error("Error loading and decompressing worker file:",c),c;case 3:return[2]}}))})),function(e){return c.apply(this,arguments)}),s=function(){var e=u((function(e){var t;return a(this,(function(r){switch(r.label){case 0:return[4,l(e)];case 1:return t=r.sent(),[2,new Worker(t)]}}))}));return function(t){return e.apply(this,arguments)}}()},5470:(e,t,r)=>{r.r(t),r.d(t,{default:()=>Z});var n=r(4328),o=r(7286),i=r(8417),u=r(6955),a=r(813),c=r(683),l=["0","1","2","3","4","*","5","6","7","*","8","9","A","*","B","C","*","D","*","E","*","F","*","G","*","H","I","J","*","K","*","L","*","M","N","O","P","*","Q","R","*","S","T","*","U","*","V","*","W","X","Y","*","Z","<","*"];function s(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function f(e,t,r,n,o,i,u){try{var a=e[i](u),c=a.value}catch(e){return void r(e)}a.done?t(c):Promise.resolve(c).then(n,o)}function p(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function y(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function h(e){return h=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},h(e)}function b(e,t){return!t||"object"!=((r=t)&&"undefined"!=typeof Symbol&&r.constructor===Symbol?"symbol":typeof r)&&"function"!=typeof t?s(e):t;var r}function v(e,t){return v=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},v(e,t)}function d(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=h(e);if(t){var o=h(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return b(this,r)}}function w(e,t){var r,n,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;u;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return u.label++,{value:i[1],done:!1};case 5:u.label++,n=i[1],i=[0];continue;case 7:i=u.ops.pop(),u.trys.pop();continue;default:if(!(o=u.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){u=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){u.label=i[1];break}if(6===i[0]&&u.label<o[1]){u.label=o[1],o=i;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(i);break}o[2]&&u.ops.pop(),u.trys.pop();continue}i=t.call(e,u)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}}var m=[1,28,28,1],g=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&v(e,t)}(u,e);var t,r,n,o=d(u);function u(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:a.z.WASM,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,u),y(s(e=o.call(this,t,r,n)),"predictionList",void 0),y(s(e),"interpretedPredictionsList",void 0),e}return t=u,r=[{key:"predict",value:function(e){var t=y({},"input_1",new i.es("float32",e,m));return this.session.run(t)}},{key:"predictFromArray",value:function(e,t){var r,n=this;return(r=function(){var r,o,i;return w(this,(function(u){switch(u.label){case 0:if(n.predictionList||(n.predictionList=new Array(t).fill(0)),n.interpretedPredictionsList||(n.interpretedPredictionsList=new Array(t).fill(0)),n.loading)return[2,[]];r=(0,c.Fv)(e,c.eQ.STANDART),o=0,u.label=1;case 1:return o<t?(i=n.predictionList,[4,n.predict(r.subarray(784*o,784*(o+1)))]):[3,4];case 2:i[o]=u.sent(),u.label=3;case 3:return o+=1,[3,1];case 4:return n.predictionList.forEach((function(e,t){n.interpretedPredictionsList[t]=n.interpret(e.dense.data)})),[2,n.interpretedPredictionsList]}}))},function(){var e=this,t=arguments;return new Promise((function(n,o){var i=r.apply(e,t);function u(e){f(i,n,o,u,a,"next",e)}function a(e){f(i,n,o,u,a,"throw",e)}u(void 0)}))})()}},{key:"interpret",value:function(e){return Array.from(e).map((function(e,t){return{value:l[t],confidence:e}})).sort((function(e,t){return e.confidence-t.confidence})).slice(-3).reverse()}},{key:"isLoading",get:function(){return this.loading}},{key:"predictFromImage",value:function(e,t){}}],r&&p(t.prototype,r),n&&p(t,n),u}(u.Z),k=r(4554);function O(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function P(e,t,r,n,o,i,u){try{var a=e[i](u),c=a.value}catch(e){return void r(e)}a.done?t(c):Promise.resolve(c).then(n,o)}function x(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var i=e.apply(t,r);function u(e){P(i,n,o,u,a,"next",e)}function a(e){P(i,n,o,u,a,"throw",e)}u(void 0)}))}}function j(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function S(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function R(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter((function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable})))),n.forEach((function(t){S(e,t,r[t])}))}return e}function A(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))})),e}function E(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,i=[],u=!0,a=!1;try{for(r=r.call(e);!(u=(n=r.next()).done)&&(i.push(n.value),!t||i.length!==t);u=!0);}catch(e){a=!0,o=e}finally{try{u||null==r.return||r.return()}finally{if(a)throw o}}return i}}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return O(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(r);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return O(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function M(e,t){var r,n,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;u;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return u.label++,{value:i[1],done:!1};case 5:u.label++,n=i[1],i=[0];continue;case 7:i=u.ops.pop(),u.trys.pop();continue;default:if(!(o=u.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){u=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){u.label=i[1];break}if(6===i[0]&&u.label<o[1]){u.label=o[1],o=i;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(i);break}o[2]&&u.ops.pop(),u.trys.pop();continue}i=t.call(e,u)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}}var L=function(){function e(t,r,n){var o=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),S(this,"w",0),S(this,"h",0),S(this,"successCount",0),S(this,"worker",void 0),S(this,"model",void 0),S(this,"isInitialized",!1),S(this,"isProcessing",!1),S(this,"MIN_MRZ_FRAMES",3),this.model=new g("".concat(k.t.$I),a.z.WASM,n),this.worker=t,this.worker.postMessage({fn:"init",initData:{key:r,networkUrl:n}}),this.worker.onmessage=function(e){var t=e.data,r=t.name,n=t.data;"initialization"===r&&(o.isInitialized=n)}}var t,r,n;return t=e,r=[{key:"getErrorVal",value:function(e){var t;return-3===e&&(t=0),-2===e&&(t=1),t}},{key:"licenseError",value:function(e){return{error:!0,errorType:"licenceKeyError",errorVal:this.getErrorVal(e)}}},{key:"yComparator",value:function(e,t){return e.y<t.y?[e,t]:[t,e]}},{key:"allocate",value:function(){}},{key:"prepareMRZLocation",value:function(e){var t=[e.leftTop,e.rightTop,e.rightBottom,e.leftBottom].sort((function(e,t){return e.x-t.x})),r=E(this.yComparator(t[0],t[1]),2),n=r[0],o=r[1],i=E(this.yComparator(t[2],t[3]),2),u=i[0],a=i[1],c=.03;return{leftTop:{x:n.x-c,y:n.y-c},rightTop:{x:u.x+c,y:u.y-c},rightBottom:{x:a.x+c,y:a.y+c},leftBottom:{x:o.x-c,y:o.y+c}}}},{key:"writeResults",value:function(e){var t={mrzText:""},r=e.fields.filter((function(e){return-1!==e.name.indexOf("Line")&&e.value.length>0})).map((function(e){return e.value})).join("\n");return r.length>0&&(t.mrzText=window.btoa(r)),t}},{key:"predict",value:function(e,t){var r=this;return x((function(){var n;return M(this,(function(o){switch(o.label){case 0:return[4,r.model.predictFromArray(e,t)];case 1:return(n=o.sent()).filter((function(e){return"*"===E(e,1)[0].value})).length>3?[4,r.model.predictFromArray(e.reverse(),t)]:[3,3];case 2:n=o.sent(),o.label=3;case 3:return[2,n]}}))}))()}},{key:"scan",value:function(e){var t=this;return new Promise((function(r){t.worker.postMessage({fn:"prepare",iData:e});var n,o=t;t.worker.onmessage=(n=x((function(e){var t,n,i,u;return M(this,(function(a){switch(a.label){case 0:return t=e.data,n=t.name,i=t.data,"batchArr"!==n?[3,2]:[4,o.predict(i.batchArr,i.batchSize)];case 1:return u=a.sent(),o.worker.postMessage({fn:"process",predictions:u}),[2];case 2:return"result"===n&&r(i),r(i),[2]}}))})),function(e){return n.apply(this,arguments)})}))}},{key:"processMRZ",value:function(e){var t=this;return x((function(){var r,n,o,i,u,a,c;return M(this,(function(l){switch(l.label){case 0:return n={status:!1,cancel:!1,touch:!1,image:null,type:"mrz",isSuccessProcess:!1},t.isProcessing?[2,n]:t.isInitialized?(t.isProcessing=!0,[4,t.scan(e)]):[2,n];case 1:return(null==(o=l.sent())?void 0:o.errorId)?(t.isProcessing=!1,[2,A(R({},o),{error:t.licenseError(o.errorId)})]):(o&&0===(null==o||null===(r=o.status)||void 0===r?void 0:r.value)&&(null==o?void 0:o.count)>0?(i=t.estimateResults(o),u=i===o.count&&o.symbolsConf>.95?"green":"yellow",n.coords={locations:t.prepareMRZLocation(o.location),color:u},a=i===o.count&&o.symbolsConf>.85,c=i>=o.count-2,(a||c)&&(t.successCount+=1,n.isSuccessProcess=!0,t.successCount>=t.MIN_MRZ_FRAMES&&(n.status=!0,n.needToCut=!0,n.image=e,n.results=t.writeResults(o)))):(n.coords=null,t.successCount=0),t.isProcessing=!1,[2,n])}}))}))()}},{key:"estimateResults",value:function(e){return 0===e.count?0:e.fields.reduce((function(e,t){return"Valid"===t.status?e+1:e}),0)}},{key:"detectMrz",value:function(e){var t=this;return x((function(){var r,n,o,i,u;return M(this,(function(a){switch(a.label){case 0:return[4,t.scan(e)];case 1:return r=a.sent(),n=!0,r&&r.count>0&&r.symbolsConf>.8?(o=t.prepareMRZLocation(r.location),i=t.writeResults(r),[2,{status:!0,locations:o,results:i,isNotMRZ:n=!1}]):(r&&r.symbolsConf>.6&&(n=!1),u={status:!1,isNotMRZ:n},(null==r?void 0:r.errorId)&&(u.error=t.licenseError(r.errorId)),[2,u])}}))}))()}}],r&&j(t.prototype,r),n&&j(t,n),e}();const T=L;var C=r(4295),_=r(4550);function z(e,t,r,n,o,i,u){try{var a=e[i](u),c=a.value}catch(e){return void r(e)}a.done?t(c):Promise.resolve(c).then(n,o)}function I(e,t){var r,n,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;u;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return u.label++,{value:i[1],done:!1};case 5:u.label++,n=i[1],i=[0];continue;case 7:i=u.ops.pop(),u.trys.pop();continue;default:if(!(o=u.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){u=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){u.label=i[1];break}if(6===i[0]&&u.label<o[1]){u.label=o[1],o=i;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(i);break}o[2]&&u.ops.pop(),u.trys.pop();continue}i=t.call(e,u)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}}const Z=(D=function(e){var t,r,i,u;return I(this,(function(a){switch(a.label){case 0:return(t=e.commonLicenseKey)?[3,1]:((0,C.Z)(),[3,3]);case 1:return[4,(0,_.o)("".concat(n.Z.networkUrl,"mrzWorker.js.gzip"))];case 2:i=a.sent(),u=new T(i,t,n.Z.networkUrl),o.Z.setModule("module","mrz",u),r=[u.model.initialize.bind(u.model)],a.label=3;case 3:return[2,r]}}))},U=function(){var e=this,t=arguments;return new Promise((function(r,n){var o=D.apply(e,t);function i(e){z(o,r,n,i,u,"next",e)}function u(e){z(o,r,n,i,u,"throw",e)}i(void 0)}))},function(e){return U.apply(this,arguments)});var D,U}}]);
|
|
1
|
+
(self.webpackChunk_idscan_idvc2=self.webpackChunk_idscan_idvc2||[]).push([[343],{4550:(e,t,r)=>{r.d(t,{o:()=>s});var n=r(7885),o=r(7666);function i(e,t,r,n,o,i,u){try{var a=e[i](u),c=a.value}catch(e){return void r(e)}a.done?t(c):Promise.resolve(c).then(n,o)}function u(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var u=e.apply(t,r);function a(e){i(u,n,o,a,c,"next",e)}function c(e){i(u,n,o,a,c,"throw",e)}a(void 0)}))}}function a(e,t){var r,n,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;u;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return u.label++,{value:i[1],done:!1};case 5:u.label++,n=i[1],i=[0];continue;case 7:i=u.ops.pop(),u.trys.pop();continue;default:if(!(o=u.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){u=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){u.label=i[1];break}if(6===i[0]&&u.label<o[1]){u.label=o[1],o=i;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(i);break}o[2]&&u.ops.pop(),u.trys.pop();continue}i=t.call(e,u)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}}var c,l=(c=u((function(e){var t,r,i,u,c;return a(this,(function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),r=Uint8Array.bind,[4,(0,o.xl)(e)];case 1:return t=new(r.apply(Uint8Array,[void 0,a.sent()])),i=(0,n.ec)(t),u=new Blob([i.buffer],{type:"application/javascript"}),[2,URL.createObjectURL(u)];case 2:throw c=a.sent(),console.error("Error loading and decompressing worker file:",c),c;case 3:return[2]}}))})),function(e){return c.apply(this,arguments)}),s=function(){var e=u((function(e){var t;return a(this,(function(r){switch(r.label){case 0:return[4,l(e)];case 1:return t=r.sent(),[2,new Worker(t)]}}))}));return function(t){return e.apply(this,arguments)}}()},5470:(e,t,r)=>{r.r(t),r.d(t,{default:()=>D});var n=r(4328),o=r(7286),i=r(8417),u=r(6955),a=r(813),c=r(683),l=["0","1","2","3","4","*","5","6","7","*","8","9","A","*","B","C","*","D","*","E","*","F","*","G","*","H","I","J","*","K","*","L","*","M","N","O","P","*","Q","R","*","S","T","*","U","*","V","*","W","X","Y","*","Z","<","*"];function s(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function f(e,t,r,n,o,i,u){try{var a=e[i](u),c=a.value}catch(e){return void r(e)}a.done?t(c):Promise.resolve(c).then(n,o)}function p(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function y(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function h(e){return h=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},h(e)}function b(e,t){return!t||"object"!=((r=t)&&"undefined"!=typeof Symbol&&r.constructor===Symbol?"symbol":typeof r)&&"function"!=typeof t?s(e):t;var r}function d(e,t){return d=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},d(e,t)}function v(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=h(e);if(t){var o=h(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return b(this,r)}}function w(e,t){var r,n,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;u;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return u.label++,{value:i[1],done:!1};case 5:u.label++,n=i[1],i=[0];continue;case 7:i=u.ops.pop(),u.trys.pop();continue;default:if(!(o=u.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){u=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){u.label=i[1];break}if(6===i[0]&&u.label<o[1]){u.label=o[1],o=i;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(i);break}o[2]&&u.ops.pop(),u.trys.pop();continue}i=t.call(e,u)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}}var m=[1,28,28,1],g=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&d(e,t)}(u,e);var t,r,n,o=v(u);function u(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:a.z.WASM,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,u),y(s(e=o.call(this,t,r,n)),"predictionList",void 0),y(s(e),"interpretedPredictionsList",void 0),e}return t=u,r=[{key:"predict",value:function(e){var t=y({},"input_1",new i.es("float32",e,m));return this.session.run(t)}},{key:"predictFromArray",value:function(e,t){var r,n=this;return(r=function(){var r,o,i;return w(this,(function(u){switch(u.label){case 0:if(n.predictionList||(n.predictionList=new Array(t).fill(0)),n.interpretedPredictionsList||(n.interpretedPredictionsList=new Array(t).fill(0)),n.loading)return[2,[]];r=(0,c.Fv)(e,c.eQ.STANDART),o=0,u.label=1;case 1:return o<t?(i=n.predictionList,[4,n.predict(r.subarray(784*o,784*(o+1)))]):[3,4];case 2:i[o]=u.sent(),u.label=3;case 3:return o+=1,[3,1];case 4:return n.predictionList.forEach((function(e,t){n.interpretedPredictionsList[t]=n.interpret(e.dense.data)})),[2,n.interpretedPredictionsList]}}))},function(){var e=this,t=arguments;return new Promise((function(n,o){var i=r.apply(e,t);function u(e){f(i,n,o,u,a,"next",e)}function a(e){f(i,n,o,u,a,"throw",e)}u(void 0)}))})()}},{key:"interpret",value:function(e){return Array.from(e).map((function(e,t){return{value:l[t],confidence:e}})).sort((function(e,t){return e.confidence-t.confidence})).slice(-3).reverse()}},{key:"isLoading",get:function(){return this.loading}},{key:"predictFromImage",value:function(e,t){}}],r&&p(t.prototype,r),n&&p(t,n),u}(u.Z),k=r(3970),O=r(4554);function P(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function x(e,t,r,n,o,i,u){try{var a=e[i](u),c=a.value}catch(e){return void r(e)}a.done?t(c):Promise.resolve(c).then(n,o)}function j(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var i=e.apply(t,r);function u(e){x(i,n,o,u,a,"next",e)}function a(e){x(i,n,o,u,a,"throw",e)}u(void 0)}))}}function S(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function R(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function A(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter((function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable})))),n.forEach((function(t){R(e,t,r[t])}))}return e}function E(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))})),e}function L(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,i=[],u=!0,a=!1;try{for(r=r.call(e);!(u=(n=r.next()).done)&&(i.push(n.value),!t||i.length!==t);u=!0);}catch(e){a=!0,o=e}finally{try{u||null==r.return||r.return()}finally{if(a)throw o}}return i}}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return P(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(r);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return P(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function M(e,t){var r,n,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;u;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return u.label++,{value:i[1],done:!1};case 5:u.label++,n=i[1],i=[0];continue;case 7:i=u.ops.pop(),u.trys.pop();continue;default:if(!(o=u.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){u=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){u.label=i[1];break}if(6===i[0]&&u.label<o[1]){u.label=o[1],o=i;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(i);break}o[2]&&u.ops.pop(),u.trys.pop();continue}i=t.call(e,u)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}}var T=function(){function e(t,r,n){var o=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),R(this,"w",0),R(this,"h",0),R(this,"successCount",0),R(this,"worker",void 0),R(this,"model",void 0),R(this,"isInitialized",!1),R(this,"isProcessing",!1),R(this,"MIN_MRZ_FRAMES",3),this.model=new g("".concat(O.t.$I),a.z.WASM,n),this.worker=t,this.worker.postMessage({fn:"init",initData:{key:r,networkUrl:n}}),this.worker.onmessage=function(e){var t=e.data,r=t.name,n=t.data;"initialization"===r&&(o.isInitialized=n)}}var t,r,n;return t=e,r=[{key:"getErrorVal",value:function(e){var t;return-3===e&&(t=0),-2===e&&(t=1),t}},{key:"licenseError",value:function(e){return{error:!0,errorType:"licenceKeyError",errorVal:this.getErrorVal(e)}}},{key:"yComparator",value:function(e,t){return e.y<t.y?[e,t]:[t,e]}},{key:"allocate",value:function(){}},{key:"prepareMRZLocation",value:function(e){var t=[e.leftTop,e.rightTop,e.rightBottom,e.leftBottom].sort((function(e,t){return e.x-t.x})),r=L(this.yComparator(t[0],t[1]),2),n=r[0],o=r[1],i=L(this.yComparator(t[2],t[3]),2),u=i[0],a=i[1],c=.03;return{leftTop:{x:n.x-c,y:n.y-c},rightTop:{x:u.x+c,y:u.y-c},rightBottom:{x:a.x+c,y:a.y+c},leftBottom:{x:o.x-c,y:o.y+c}}}},{key:"writeResults",value:function(e){var t={mrzText:""},r=e.fields.filter((function(e){return-1!==e.name.indexOf("Line")&&e.value.length>0})).map((function(e){return e.value})).join("\n");return r.length>0&&(t.mrzText=window.btoa(r)),t}},{key:"predict",value:function(e,t){var r=this;return j((function(){var n;return M(this,(function(o){switch(o.label){case 0:return[4,r.model.predictFromArray(e,t)];case 1:return(n=o.sent()).filter((function(e){return"*"===L(e,1)[0].value})).length>3?[4,r.model.predictFromArray(e.reverse(),t)]:[3,3];case 2:n=o.sent(),o.label=3;case 3:return[2,n]}}))}))()}},{key:"scan",value:function(e){var t=this;return new Promise((function(r){t.worker.postMessage({fn:"prepare",iData:e});var n,o=t;t.worker.onmessage=(n=j((function(e){var t,n,i,u;return M(this,(function(a){switch(a.label){case 0:return t=e.data,n=t.name,i=t.data,"batchArr"!==n?[3,2]:[4,o.predict(i.batchArr,i.batchSize)];case 1:return u=a.sent(),o.worker.postMessage({fn:"process",predictions:u}),[2];case 2:return"result"===n&&r(i),r(i),[2]}}))})),function(e){return n.apply(this,arguments)})}))}},{key:"processMRZ",value:function(e){var t=this;return j((function(){var r,n,o,i,u,a,c;return M(this,(function(l){switch(l.label){case 0:return n={status:!1,cancel:!1,touch:!1,image:null,type:"mrz",isSuccessProcess:!1},t.isProcessing?[2,n]:t.isInitialized?(t.isProcessing=!0,[4,(0,k.L)("mrz_stream",(function(){return t.scan(e)}))]):[2,n];case 1:return(null==(o=l.sent())?void 0:o.errorId)?(t.isProcessing=!1,[2,E(A({},o),{error:t.licenseError(o.errorId)})]):(o&&0===(null==o||null===(r=o.status)||void 0===r?void 0:r.value)&&(null==o?void 0:o.count)>0?(i=t.estimateResults(o),u=i===o.count&&o.symbolsConf>.95?"green":"yellow",n.coords={locations:t.prepareMRZLocation(o.location),color:u},a=i===o.count&&o.symbolsConf>.85,c=i>=o.count-2,(a||c)&&(t.successCount+=1,n.isSuccessProcess=!0,t.successCount>=t.MIN_MRZ_FRAMES&&(n.status=!0,n.needToCut=!0,n.image=e,n.results=t.writeResults(o)))):(n.coords=null,t.successCount=0),t.isProcessing=!1,[2,n])}}))}))()}},{key:"estimateResults",value:function(e){return 0===e.count?0:e.fields.reduce((function(e,t){return"Valid"===t.status?e+1:e}),0)}},{key:"detectMrz",value:function(e){var t=this;return j((function(){var r,n,o,i,u;return M(this,(function(a){switch(a.label){case 0:return[4,(0,k.L)("mrz_upload",(function(){return t.scan(e)}))];case 1:return r=a.sent(),n=!0,r&&r.count>0&&r.symbolsConf>.8?(o=t.prepareMRZLocation(r.location),i=t.writeResults(r),[2,{status:!0,locations:o,results:i,isNotMRZ:n=!1}]):(r&&r.symbolsConf>.6&&(n=!1),u={status:!1,isNotMRZ:n},(null==r?void 0:r.errorId)&&(u.error=t.licenseError(r.errorId)),[2,u])}}))}))()}}],r&&S(t.prototype,r),n&&S(t,n),e}();const _=T;var C=r(4295),z=r(4550);function I(e,t,r,n,o,i,u){try{var a=e[i](u),c=a.value}catch(e){return void r(e)}a.done?t(c):Promise.resolve(c).then(n,o)}function Z(e,t){var r,n,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;u;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return u.label++,{value:i[1],done:!1};case 5:u.label++,n=i[1],i=[0];continue;case 7:i=u.ops.pop(),u.trys.pop();continue;default:if(!(o=u.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){u=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){u.label=i[1];break}if(6===i[0]&&u.label<o[1]){u.label=o[1],o=i;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(i);break}o[2]&&u.ops.pop(),u.trys.pop();continue}i=t.call(e,u)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}}const D=(U=function(e){var t,r,i,u;return Z(this,(function(a){switch(a.label){case 0:return(t=e.commonLicenseKey)?[3,1]:((0,C.Z)(),[3,3]);case 1:return[4,(0,z.o)("".concat(n.Z.networkUrl,"mrzWorker.js.gzip"))];case 2:i=a.sent(),u=new _(i,t,n.Z.networkUrl),o.Z.setModule("module","mrz",u),r=[u.model.initialize.bind(u.model)],a.label=3;case 3:return[2,r]}}))},B=function(){var e=this,t=arguments;return new Promise((function(r,n){var o=U.apply(e,t);function i(e){I(o,r,n,i,u,"next",e)}function u(e){I(o,r,n,i,u,"throw",e)}i(void 0)}))},function(e){return B.apply(this,arguments)});var U,B}}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(self.webpackChunk_idscan_idvc2=self.webpackChunk_idscan_idvc2||[]).push([[596],{4550:(e,t,r)=>{r.d(t,{o:()=>l});var n=r(7885),o=r(7666);function i(e,t,r,n,o,i,a){try{var u=e[i](a),s=u.value}catch(e){return void r(e)}u.done?t(s):Promise.resolve(s).then(n,o)}function a(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var a=e.apply(t,r);function u(e){i(a,n,o,u,s,"next",e)}function s(e){i(a,n,o,u,s,"throw",e)}u(void 0)}))}}function u(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(i){return function(u){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,u])}}}var s,c=(s=a((function(e){var t,r,i,a,s;return u(this,(function(u){switch(u.label){case 0:return u.trys.push([0,2,,3]),r=Uint8Array.bind,[4,(0,o.xl)(e)];case 1:return t=new(r.apply(Uint8Array,[void 0,u.sent()])),i=(0,n.ec)(t),a=new Blob([i.buffer],{type:"application/javascript"}),[2,URL.createObjectURL(a)];case 2:throw s=u.sent(),console.error("Error loading and decompressing worker file:",s),s;case 3:return[2]}}))})),function(e){return s.apply(this,arguments)}),l=function(){var e=a((function(e){var t;return u(this,(function(r){switch(r.label){case 0:return[4,c(e)];case 1:return t=r.sent(),[2,new Worker(t)]}}))}));return function(t){return e.apply(this,arguments)}}()},8766:(e,t,r)=>{r.r(t),r.d(t,{default:()=>k});var n=r(4328),o=r(6399);function i(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function a(e,t,r,n,o,i,a){try{var u=e[i](a),s=u.value}catch(e){return void r(e)}u.done?t(s):Promise.resolve(s).then(n,o)}function u(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var i=e.apply(t,r);function u(e){a(i,n,o,u,s,"next",e)}function s(e){a(i,n,o,u,s,"throw",e)}u(void 0)}))}}function s(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function c(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function l(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,i=[],a=!0,u=!1;try{for(r=r.call(e);!(a=(n=r.next()).done)&&(i.push(n.value),!t||i.length!==t);a=!0);}catch(e){u=!0,o=e}finally{try{a||null==r.return||r.return()}finally{if(u)throw o}}return i}}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return i(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(r);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return i(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function f(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(i){return function(u){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,u])}}}var d=function(){function e(t,r,n){var o=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),c(this,"module",void 0),c(this,"handle",null),c(this,"bw",0),c(this,"bh",0),c(this,"src",null),c(this,"out",null),c(this,"isAllocate",!1),c(this,"worker",void 0),c(this,"isProcessing",!1),c(this,"isInitialized",!1),c(this,"successCount",0),c(this,"pdfCapturedCount",0),c(this,"src2",null),c(this,"locations",null),c(this,"pdfCount",0),c(this,"geometry",void 0),c(this,"minPDFframes",1),c(this,"cropSizes",void 0),c(this,"canvasSizes",void 0),c(this,"privateErrorId",0),this.worker=t,this.worker.onmessage=function(e){var t=e.data,r=t.name,n=t.data;"initialization"===r&&(o.isInitialized=n)},this.worker.postMessage({fn:"init",key:r,isNeedToLoadPDFWIthPreprocess:n})}var t,r,n;return t=e,(r=[{key:"errorId",get:function(){return this.privateErrorId},set:function(e){this.privateErrorId=[o.l.Detected,o.l.Decoded].includes(e)?0:e}},{key:"errorVal",get:function(){var e;return this.errorId===o.l.LicenseKeyHasExpired&&(e=0),this.errorId===o.l.InvalidLicenseKey&&(e=1),e}},{key:"init",value:function(e,t,r,n){this.geometry=e,this.minPDFframes=t,this.cropSizes=r,this.canvasSizes=n}},{key:"licenseError",value:function(){return{error:!0,errorType:"licenceKeyError",errorVal:this.errorVal}}},{key:"create",value:function(){}},{key:"setSizes",value:function(e,t){this.bw=e,this.bh=t,this.worker.postMessage({fn:"setSizes",bw:e,bh:t})}},{key:"allocate",value:function(){this.worker.postMessage({fn:"allocate"})}},{key:"calculateCords",value:function(e){var t=this,r=[];if(e){var n=[];Object.entries(e).forEach((function(e){var r=l(e,2),o=r[0],i=r[1],a=Math.trunc(i),u=o[0],s=+o[1]-1;n[s]||(n[s]={x:0,y:0}),"x"===u?n[s].x=t.canvasSizes.width*a/t.bw:n[s].y=t.canvasSizes.height*a/t.bh}));var o=[n[3].x-n[0].x,n[3].y-n[0].y],i=[n[1].x-n[0].x,n[1].y-n[0].y],a=[n[2].x-n[1].x,n[2].y-n[1].y],u=[n[3].x-n[2].x,n[3].y-n[2].y],s=this.geometry.angleBetweenTwoVectors(o,i),c=this.geometry.angleBetweenTwoVectors(a,u);s<=100&&s>=80&&c<=100&&c>=80&&(r=n)}return r}},{key:"processPDF",value:function(e){var t=this;return u((function(){var r,n;return f(this,(function(i){switch(i.label){case 0:return t.isProcessing?[2,{}]:(r={status:!1,predict:!1,touch:!1,image:null,type:"pdf",error:null,coords:[],trackString:"",pdfSuccessCount:0,pdfCount:0,isSuccessProcess:!1,pdfCapturedCount:0},t.isInitialized?(t.isProcessing=!0,[4,t.readPDF(e)]):[2,r]);case 1:return(n=i.sent()).error?(t.isProcessing=!1,r.error=n,[2,r]):(n&&"status"in n&&(n.status.value===o.l.Detected&&(t.pdfCapturedCount+=1),n.status.value===o.l.Detected||n.status.value===o.l.Decoded?(r.coords=t.calculateCords(n.location),r.isSuccessProcess=!0):(t.successCount+=1,t.calculateCords(null)),n.status.value===o.l.Decoded?(t.pdfCount+=1,t.pdfCount>=t.minPDFframes&&(t.successCount=0,t.pdfCapturedCount=0,t.pdfCount=0,r.trackString=n.trackString||n.data||"",r.status=!0,r.image=e,r.pdfCapturedCount=0)):t.pdfCount=0),r.pdfSuccessCount=t.successCount,r.pdfCount=t.pdfCount,r.pdfCapturedCount=t.pdfCapturedCount,t.isProcessing=!1,[2,r])}}))}))()}},{key:"decodeSubmitString",value:function(e){var t=e.data,r=e.resultParams,n=r.columns,o=r.rows,i=r.ecl,a=Object.fromEntries(Object.entries(e.location).map((function(e){var t=l(e,2),r=t[0],n=t[1];return[r,Number(n.toFixed(6))]}))),u="columns:".concat(n,",rows:").concat(o,",ecl:").concat(i,",").concat(Object.entries(a).map((function(e){var t=l(e,2),r=t[0],n=t[1];return"".concat(r,":").concat(n)})).join(","));return"".concat(t,".").concat(btoa(u))}},{key:"processPDFWithPreProcess",value:function(e){var t=this;return new Promise((function(r){t.worker.onmessage=function(e){var n=e.data,o=n.name,i=n.data;if("result"===o){var a;t.errorId=null==i||null===(a=i.status)||void 0===a?void 0:a.value;var u=t.errorId?t.licenseError():null;i.data&&(i.data=t.decodeSubmitString(i)),r(u||i)}else r(i)},t.worker.postMessage({fn:"pdfWithPreProcess",iData:e})}))}},{key:"readPDF",value:function(e){var t=this;return u((function(){return f(this,(function(r){return[2,new Promise((function(r){t.worker.onmessage=function(e){var n=e.data,o=n.name,i=n.data,a=n.bw,u=n.bh;if("ready"===o)t.worker.postMessage({fn:"process"});else if("result"===o){var s;t.errorId=null==i||null===(s=i.status)||void 0===s?void 0:s.value;var c=(t.errorId?t.licenseError():null)||i;t.bw=a,t.bh=u,r(c)}else r(i)},t.worker.postMessage({fn:"prepare",iData:e})}))]}))}))()}}])&&s(t.prototype,r),n&&s(t,n),e}();var p,h,y=r(7286),v=r(4550);function b(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function w(e,t,r,n,o,i,a){try{var u=e[i](a),s=u.value}catch(e){return void r(e)}u.done?t(s):Promise.resolve(s).then(n,o)}function m(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,i=[],a=!0,u=!1;try{for(r=r.call(e);!(a=(n=r.next()).done)&&(i.push(n.value),!t||i.length!==t);a=!0);}catch(e){u=!0,o=e}finally{try{a||null==r.return||r.return()}finally{if(u)throw o}}return i}}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return b(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(r);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return b(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function g(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(i){return function(u){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,u])}}}const k=(p=function(e){var t,r,o,i;return g(this,(function(a){switch(a.label){case 0:return t=e.pdf417key,r=!!Object.entries(n.Z.config.documentTypes).find((function(e){var t=m(e,2);return t[0],t[1].find((function(e){return("pdf"===e.type||"back"===e.type)&&e.mode.uploader}))})),[4,(0,v.o)("".concat(n.Z.networkUrl,"pdfWorker.js.gzip"))];case 1:return o=a.sent(),i=new d(o,t,r),y.Z.setModule("module","pdf",i),[2]}}))},h=function(){var e=this,t=arguments;return new Promise((function(r,n){var o=p.apply(e,t);function i(e){w(o,r,n,i,a,"next",e)}function a(e){w(o,r,n,i,a,"throw",e)}i(void 0)}))},function(e){return h.apply(this,arguments)})}}]);
|
|
1
|
+
(self.webpackChunk_idscan_idvc2=self.webpackChunk_idscan_idvc2||[]).push([[596],{4550:(e,t,r)=>{r.d(t,{o:()=>l});var n=r(7885),o=r(7666);function i(e,t,r,n,o,i,a){try{var u=e[i](a),s=u.value}catch(e){return void r(e)}u.done?t(s):Promise.resolve(s).then(n,o)}function a(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var a=e.apply(t,r);function u(e){i(a,n,o,u,s,"next",e)}function s(e){i(a,n,o,u,s,"throw",e)}u(void 0)}))}}function u(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(i){return function(u){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,u])}}}var s,c=(s=a((function(e){var t,r,i,a,s;return u(this,(function(u){switch(u.label){case 0:return u.trys.push([0,2,,3]),r=Uint8Array.bind,[4,(0,o.xl)(e)];case 1:return t=new(r.apply(Uint8Array,[void 0,u.sent()])),i=(0,n.ec)(t),a=new Blob([i.buffer],{type:"application/javascript"}),[2,URL.createObjectURL(a)];case 2:throw s=u.sent(),console.error("Error loading and decompressing worker file:",s),s;case 3:return[2]}}))})),function(e){return s.apply(this,arguments)}),l=function(){var e=a((function(e){var t;return u(this,(function(r){switch(r.label){case 0:return[4,c(e)];case 1:return t=r.sent(),[2,new Worker(t)]}}))}));return function(t){return e.apply(this,arguments)}}()},8766:(e,t,r)=>{r.r(t),r.d(t,{default:()=>C});var n=r(4328),o=r(3970),i=r(6399);function a(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function u(e,t,r,n,o,i,a){try{var u=e[i](a),s=u.value}catch(e){return void r(e)}u.done?t(s):Promise.resolve(s).then(n,o)}function s(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var i=e.apply(t,r);function a(e){u(i,n,o,a,s,"next",e)}function s(e){u(i,n,o,a,s,"throw",e)}a(void 0)}))}}function c(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function l(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function f(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,i=[],a=!0,u=!1;try{for(r=r.call(e);!(a=(n=r.next()).done)&&(i.push(n.value),!t||i.length!==t);a=!0);}catch(e){u=!0,o=e}finally{try{a||null==r.return||r.return()}finally{if(u)throw o}}return i}}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return a(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(r);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return a(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function d(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(i){return function(u){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,u])}}}var p=function(){function e(t,r,n){var o=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),l(this,"module",void 0),l(this,"handle",null),l(this,"bw",0),l(this,"bh",0),l(this,"src",null),l(this,"out",null),l(this,"isAllocate",!1),l(this,"worker",void 0),l(this,"isProcessing",!1),l(this,"isInitialized",!1),l(this,"successCount",0),l(this,"pdfCapturedCount",0),l(this,"src2",null),l(this,"locations",null),l(this,"pdfCount",0),l(this,"geometry",void 0),l(this,"minPDFframes",1),l(this,"cropSizes",void 0),l(this,"canvasSizes",void 0),l(this,"privateErrorId",0),this.worker=t,this.worker.onmessage=function(e){var t=e.data,r=t.name,n=t.data;"initialization"===r&&(o.isInitialized=n)},this.worker.postMessage({fn:"init",key:r,isNeedToLoadPDFWIthPreprocess:n})}var t,r,n;return t=e,(r=[{key:"errorId",get:function(){return this.privateErrorId},set:function(e){this.privateErrorId=[i.l.Detected,i.l.Decoded].includes(e)?0:e}},{key:"errorVal",get:function(){var e;return this.errorId===i.l.LicenseKeyHasExpired&&(e=0),this.errorId===i.l.InvalidLicenseKey&&(e=1),e}},{key:"init",value:function(e,t,r,n){this.geometry=e,this.minPDFframes=t,this.cropSizes=r,this.canvasSizes=n}},{key:"licenseError",value:function(){return{error:!0,errorType:"licenceKeyError",errorVal:this.errorVal}}},{key:"create",value:function(){}},{key:"setSizes",value:function(e,t){this.bw=e,this.bh=t,this.worker.postMessage({fn:"setSizes",bw:e,bh:t})}},{key:"allocate",value:function(){this.worker.postMessage({fn:"allocate"})}},{key:"calculateCords",value:function(e){var t=this,r=[];if(e){var n=[];Object.entries(e).forEach((function(e){var r=f(e,2),o=r[0],i=r[1],a=Math.trunc(i),u=o[0],s=+o[1]-1;n[s]||(n[s]={x:0,y:0}),"x"===u?n[s].x=t.canvasSizes.width*a/t.bw:n[s].y=t.canvasSizes.height*a/t.bh}));var o=[n[3].x-n[0].x,n[3].y-n[0].y],i=[n[1].x-n[0].x,n[1].y-n[0].y],a=[n[2].x-n[1].x,n[2].y-n[1].y],u=[n[3].x-n[2].x,n[3].y-n[2].y],s=this.geometry.angleBetweenTwoVectors(o,i),c=this.geometry.angleBetweenTwoVectors(a,u);s<=100&&s>=80&&c<=100&&c>=80&&(r=n)}return r}},{key:"processPDF",value:function(e){var t=this;return s((function(){var r,n;return d(this,(function(a){switch(a.label){case 0:return t.isProcessing?[2,{}]:(r={status:!1,predict:!1,touch:!1,image:null,type:"pdf",error:null,coords:[],trackString:"",pdfSuccessCount:0,pdfCount:0,isSuccessProcess:!1,pdfCapturedCount:0},t.isInitialized?(t.isProcessing=!0,[4,(0,o.L)("pdf_stream",(function(){return t.readPDF(e)}))]):[2,r]);case 1:return(n=a.sent()).error?(t.isProcessing=!1,r.error=n,[2,r]):(n&&"status"in n&&(n.status.value===i.l.Detected&&(t.pdfCapturedCount+=1),n.status.value===i.l.Detected||n.status.value===i.l.Decoded?(r.coords=t.calculateCords(n.location),r.isSuccessProcess=!0):(t.successCount+=1,t.calculateCords(null)),n.status.value===i.l.Decoded?(t.pdfCount+=1,t.pdfCount>=t.minPDFframes&&(t.successCount=0,t.pdfCapturedCount=0,t.pdfCount=0,r.trackString=n.trackString||n.data||"",r.status=!0,r.image=e,r.pdfCapturedCount=0)):t.pdfCount=0),r.pdfSuccessCount=t.successCount,r.pdfCount=t.pdfCount,r.pdfCapturedCount=t.pdfCapturedCount,t.isProcessing=!1,[2,r])}}))}))()}},{key:"decodeSubmitString",value:function(e){var t=e.data,r=e.resultParams,n=r.columns,o=r.rows,i=r.ecl,a=Object.fromEntries(Object.entries(e.location).map((function(e){var t=f(e,2),r=t[0],n=t[1];return[r,Number(n.toFixed(6))]}))),u="columns:".concat(n,",rows:").concat(o,",ecl:").concat(i,",").concat(Object.entries(a).map((function(e){var t=f(e,2),r=t[0],n=t[1];return"".concat(r,":").concat(n)})).join(","));return"".concat(t,".").concat(btoa(u))}},{key:"processPDFWithPreProcess",value:function(e){var t=this;return s((function(){return d(this,(function(r){return[2,(0,o.L)("pdf_upload",(function(){return new Promise((function(r){t.worker.onmessage=function(e){var n=e.data,o=n.name,i=n.data;if("result"===o){var a;t.errorId=null==i||null===(a=i.status)||void 0===a?void 0:a.value;var u=t.errorId?t.licenseError():null;i.data&&(i.data=t.decodeSubmitString(i)),r(u||i)}else r(i)},t.worker.postMessage({fn:"pdfWithPreProcess",iData:e})}))}))]}))}))()}},{key:"readPDF",value:function(e){var t=this;return s((function(){return d(this,(function(r){return[2,new Promise((function(r){t.worker.onmessage=function(e){var n=e.data,o=n.name,i=n.data,a=n.bw,u=n.bh;if("ready"===o)t.worker.postMessage({fn:"process"});else if("result"===o){var s;t.errorId=null==i||null===(s=i.status)||void 0===s?void 0:s.value;var c=(t.errorId?t.licenseError():null)||i;t.bw=a,t.bh=u,r(c)}else r(i)},t.worker.postMessage({fn:"prepare",iData:e})}))]}))}))()}}])&&c(t.prototype,r),n&&c(t,n),e}();var h,y,v=r(7286),b=r(4550);function w(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function m(e,t,r,n,o,i,a){try{var u=e[i](a),s=u.value}catch(e){return void r(e)}u.done?t(s):Promise.resolve(s).then(n,o)}function g(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,i=[],a=!0,u=!1;try{for(r=r.call(e);!(a=(n=r.next()).done)&&(i.push(n.value),!t||i.length!==t);a=!0);}catch(e){u=!0,o=e}finally{try{a||null==r.return||r.return()}finally{if(u)throw o}}return i}}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return w(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(r);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return w(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function k(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(i){return function(u){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,u])}}}const C=(h=function(e){var t,r,o,i;return k(this,(function(a){switch(a.label){case 0:return t=e.pdf417key,r=!!Object.entries(n.Z.config.documentTypes).find((function(e){var t=g(e,2);return t[0],t[1].find((function(e){return("pdf"===e.type||"back"===e.type)&&e.mode.uploader}))})),[4,(0,b.o)("".concat(n.Z.networkUrl,"pdfWorker.js.gzip"))];case 1:return o=a.sent(),i=new p(o,t,r),v.Z.setModule("module","pdf",i),[2]}}))},y=function(){var e=this,t=arguments;return new Promise((function(r,n){var o=h.apply(e,t);function i(e){m(o,r,n,i,a,"next",e)}function a(e){m(o,r,n,i,a,"throw",e)}i(void 0)}))},function(e){return y.apply(this,arguments)})}}]);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const TIME_TO_SCALE =
|
|
2
|
-
export declare const TIME_TO_ROTATE =
|
|
3
|
-
export declare const TIME_TO_SCAN =
|
|
1
|
+
export declare const TIME_TO_SCALE = 800;
|
|
2
|
+
export declare const TIME_TO_ROTATE = 800;
|
|
3
|
+
export declare const TIME_TO_SCAN = 800;
|
|
4
4
|
export declare const SHOW_PREVIEW_DELAY: number;
|
|
@@ -1,55 +1,13 @@
|
|
|
1
1
|
export type StepType = 'mrz' | 'front' | 'pdf' | 'face' | 'barcode' | 'back';
|
|
2
2
|
export type StepTypeImageName = StepType | 'mrzFront';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
};
|
|
12
|
-
front: {
|
|
13
|
-
id: number;
|
|
14
|
-
camera: string;
|
|
15
|
-
name: string;
|
|
16
|
-
time: number;
|
|
17
|
-
max: number;
|
|
18
|
-
core: string[];
|
|
19
|
-
description: string;
|
|
20
|
-
};
|
|
21
|
-
pdf: {
|
|
22
|
-
id: number;
|
|
23
|
-
camera: string;
|
|
24
|
-
name: string;
|
|
25
|
-
time: number;
|
|
26
|
-
core: string[];
|
|
27
|
-
description: string;
|
|
28
|
-
};
|
|
29
|
-
face: {
|
|
30
|
-
id: number;
|
|
31
|
-
camera: string;
|
|
32
|
-
name: string;
|
|
33
|
-
time: number;
|
|
34
|
-
max: number;
|
|
35
|
-
core: string[];
|
|
36
|
-
description: string;
|
|
37
|
-
};
|
|
38
|
-
barcode: {
|
|
39
|
-
id: number;
|
|
40
|
-
camera: string;
|
|
41
|
-
name: string;
|
|
42
|
-
time: number;
|
|
43
|
-
core: string[];
|
|
44
|
-
description: string;
|
|
45
|
-
};
|
|
46
|
-
back: {
|
|
47
|
-
id: number;
|
|
48
|
-
camera: string;
|
|
49
|
-
name: string;
|
|
50
|
-
time: number;
|
|
51
|
-
core: string[];
|
|
52
|
-
description: string;
|
|
53
|
-
};
|
|
3
|
+
type StepDescription = {
|
|
4
|
+
id: number;
|
|
5
|
+
camera: 'environment' | 'user';
|
|
6
|
+
name: string;
|
|
7
|
+
time: number;
|
|
8
|
+
max?: number;
|
|
9
|
+
core: string[];
|
|
10
|
+
description: string;
|
|
54
11
|
};
|
|
55
|
-
|
|
12
|
+
declare const stepsDescription: Record<StepType, StepDescription>;
|
|
13
|
+
export default stepsDescription;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const measure: <T>(label: string, fn: () => Promise<T>) => Promise<T>;
|
|
@@ -3,12 +3,10 @@ declare const _default: {
|
|
|
3
3
|
typesInit: () => void;
|
|
4
4
|
checkCompatibility: () => void;
|
|
5
5
|
start: () => void;
|
|
6
|
-
isCameraRequired: () =>
|
|
7
|
-
isUploaderRequired: () =>
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
isCameraRequiredForCurrentDocument: () => any;
|
|
11
|
-
isCameraNeededForCurrentDocument: () => any;
|
|
6
|
+
isCameraRequired: () => boolean;
|
|
7
|
+
isUploaderRequired: () => boolean;
|
|
8
|
+
isCameraRequiredForCurrentDocument: () => boolean;
|
|
9
|
+
checkCameraNeeded: () => boolean;
|
|
12
10
|
detectAndSetBrowser: () => void;
|
|
13
11
|
detectAndSetRealFaceMode: () => void;
|
|
14
12
|
};
|
|
@@ -1,8 +1,2 @@
|
|
|
1
|
-
export declare const getCameraDevices: () => Promise<
|
|
2
|
-
deviceId: string;
|
|
3
|
-
groupId: string;
|
|
4
|
-
kind: MediaDeviceKind;
|
|
5
|
-
label: string;
|
|
6
|
-
toJSON: any;
|
|
7
|
-
}[]>;
|
|
1
|
+
export declare const getCameraDevices: () => Promise<Array<MediaDeviceInfo>>;
|
|
8
2
|
export declare const checkHasCameraDevices: (devices: Array<MediaDeviceInfo>) => boolean;
|
|
@@ -6,6 +6,7 @@ import { CameraError } from '../initErrorHandler';
|
|
|
6
6
|
export declare const cameraObjects: CameraObjects;
|
|
7
7
|
export declare const cameraTypes: CameraMapType[];
|
|
8
8
|
export declare const stopTrack: (mediaStream: MediaStream) => void;
|
|
9
|
+
export declare const getSuitableDevices: () => Promise<Array<MediaDeviceInfo>>;
|
|
9
10
|
export declare const fillVideoDevices: (additionalConstrains: IAdditionalConstrains) => Promise<{
|
|
10
11
|
cameraObjects: VideoDevice[];
|
|
11
12
|
cameraTypes: CameraMapType[];
|
|
@@ -17,7 +17,7 @@ declare class ValidateDocumentTypes implements IValidator<DocumentType[]> {
|
|
|
17
17
|
tooltipTextMap: Partial<Record<DocumentTypeName, string>>;
|
|
18
18
|
static checkIsDocumentTypes(obj: unknown): obj is IValidateDocumentTypes;
|
|
19
19
|
validate(val: DocumentType[], fallback: DocumentType[], configName: DefaultConfigName): IValidateDocumentTypes;
|
|
20
|
-
validateTypes
|
|
20
|
+
private validateTypes;
|
|
21
21
|
transformDocType({ type, steps }: DocumentType): void;
|
|
22
22
|
setCommonStepTypes(): void;
|
|
23
23
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@idscan/idvc2",
|
|
3
|
-
"version": "3.9.
|
|
3
|
+
"version": "3.9.3",
|
|
4
4
|
"description": "component for the capturing documents",
|
|
5
5
|
"main": "dist/idvc.js",
|
|
6
6
|
"types": "dist/types/idvc.d.ts",
|
|
@@ -16,9 +16,11 @@
|
|
|
16
16
|
"prepush": "npm run lint && npm run test",
|
|
17
17
|
"start": "webpack serve --mode development",
|
|
18
18
|
"start:logging": "webpack serve --mode development --env logging",
|
|
19
|
+
"start:metrics": "webpack serve --mode development --env metrics",
|
|
19
20
|
"build": "webpack --mode production --progress --color && tsc",
|
|
20
21
|
"build:develop": "webpack --mode development --progress --color && npm run pack",
|
|
21
22
|
"build:logging": "webpack --mode production --env logging && tsc",
|
|
23
|
+
"build:metrics": "webpack --mode production --env metrics && tsc",
|
|
22
24
|
"pack": "npm pack",
|
|
23
25
|
"minor": "npm version minor",
|
|
24
26
|
"patch": "npm version patch",
|