@idscan/idvc2 2.11.1 → 2.12.0

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.
@@ -1 +1 @@
1
- (self.webpackChunk_idscan_idvc2=self.webpackChunk_idscan_idvc2||[]).push([[596],{4550:(e,r,t)=>{t.d(r,{o:()=>c});var n=t(7885),o=t(7666);function i(e,r,t,n,o,i,a){try{var u=e[i](a),s=u.value}catch(e){return void t(e)}u.done?r(s):Promise.resolve(s).then(n,o)}function a(e){return function(){var r=this,t=arguments;return new Promise((function(n,o){var a=e.apply(r,t);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,r){var t,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(t)throw new TypeError("Generator is already executing.");for(;a;)try{if(t=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=r.call(e,a)}catch(e){i=[6,e],n=0}finally{t=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,u])}}}var s,l=(s=a((function(e){var r,t,i,a,s;return u(this,(function(u){switch(u.label){case 0:return u.trys.push([0,2,,3]),t=Uint8Array.bind,[4,(0,o.xl)(e)];case 1:return r=new(t.apply(Uint8Array,[void 0,u.sent()])),i=(0,n.ec)(r),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)}),c=function(){var e=a((function(e){var r;return u(this,(function(t){switch(t.label){case 0:return[4,l(e)];case 1:return r=t.sent(),[2,new Worker(r)]}}))}));return function(r){return e.apply(this,arguments)}}()},8766:(e,r,t)=>{t.r(r),t.d(r,{default:()=>k});var n=t(4328),o=t(6399);function i(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}function a(e,r,t,n,o,i,a){try{var u=e[i](a),s=u.value}catch(e){return void t(e)}u.done?r(s):Promise.resolve(s).then(n,o)}function u(e){return function(){var r=this,t=arguments;return new Promise((function(n,o){var i=e.apply(r,t);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,r){for(var t=0;t<r.length;t++){var n=r[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function l(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function c(e,r){return function(e){if(Array.isArray(e))return e}(e)||function(e,r){var t=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=t){var n,o,i=[],a=!0,u=!1;try{for(t=t.call(e);!(a=(n=t.next()).done)&&(i.push(n.value),!r||i.length!==r);a=!0);}catch(e){u=!0,o=e}finally{try{a||null==t.return||t.return()}finally{if(u)throw o}}return i}}(e,r)||function(e,r){if(!e)return;if("string"==typeof e)return i(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);"Object"===t&&e.constructor&&(t=e.constructor.name);if("Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return i(e,r)}(e,r)||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,r){var t,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(t)throw new TypeError("Generator is already executing.");for(;a;)try{if(t=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=r.call(e,a)}catch(e){i=[6,e],n=0}finally{t=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(r,t,n){var o=this;!function(e,r){if(!(e instanceof r))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=r,this.worker.onmessage=function(e){var r=e.data,t=r.name,n=r.data;"initialization"===t&&(o.isInitialized=n)},this.worker.postMessage({fn:"init",key:t,isNeedToLoadPDFWIthPreprocess:n})}var r,t,n;return r=e,(t=[{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,r,t,n){this.geometry=e,this.minPDFframes=r,this.cropSizes=t,this.canvasSizes=n}},{key:"licenseError",value:function(){return{error:!0,errorType:"licenceKeyError",errorVal:this.errorVal}}},{key:"create",value:function(){}},{key:"setSizes",value:function(e,r){this.bw=e,this.bh=r,this.worker.postMessage({fn:"setSizes",bw:e,bh:r})}},{key:"allocate",value:function(){this.worker.postMessage({fn:"allocate"})}},{key:"drawCords",value:function(e){var r=this,t=[];if(e){var n=[];Object.entries(e).forEach((function(e){var t=c(e,2),o=t[0],i=t[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=r.canvasSizes.width*a/r.bw:n[s].y=r.canvasSizes.height*a/r.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),l=this.geometry.angleBetweenTwoVectors(a,u);s<=100&&s>=80&&l<=100&&l>=80&&(t=n)}return t}},{key:"processPDF",value:function(e){var r=this;return u((function(){var t,n;return f(this,(function(i){switch(i.label){case 0:return r.isProcessing?[2,{}]:(t={status:!1,predict:!1,touch:!1,image:null,type:"pdf",error:null,coords:[],trackString:"",pdfSuccessCount:0,pdfCount:0,isSuccessProcess:!1,pdfCapturedCount:0},r.isInitialized?(r.isProcessing=!0,[4,r.readPDF(e)]):[2,t]);case 1:return(n=i.sent()).error?(r.isProcessing=!1,t.error=n,[2,t]):(n&&"status"in n&&(n.status.value===o.l.Detected&&(r.pdfCapturedCount+=1),n.status.value===o.l.Detected||n.status.value===o.l.Decoded?(t.coords=r.drawCords(n.location),t.isSuccessProcess=!0):(r.successCount+=1,r.drawCords(null)),n.status.value===o.l.Decoded?(r.pdfCount+=1,r.pdfCount>=r.minPDFframes&&(r.successCount=0,r.pdfCapturedCount=0,r.pdfCount=0,t.trackString=n.trackString||n.data||"",t.status=!0,t.image=e,t.pdfCapturedCount=0)):r.pdfCount=0),t.pdfSuccessCount=r.successCount,t.pdfCount=r.pdfCount,t.pdfCapturedCount=r.pdfCapturedCount,r.isProcessing=!1,[2,t])}}))}))()}},{key:"processPDFWithPreProcess",value:function(e){var r=this;return new Promise((function(t){r.worker.onmessage=function(e){var n=e.data,o=n.name,i=n.data;if("result"===o){var a;r.errorId=null==i||null===(a=i.status)||void 0===a?void 0:a.value;var u=r.errorId?r.licenseError():null;t(u||i)}else t(i)},r.worker.postMessage({fn:"pdfWithPreProcess",iData:e})}))}},{key:"readPDF",value:function(e){var r=this;return u((function(){return f(this,(function(t){return[2,new Promise((function(t){r.worker.onmessage=function(e){var n=e.data,o=n.name,i=n.data,a=n.bw,u=n.bh;if("ready"===o)r.worker.postMessage({fn:"process"});else if("result"===o){var s;r.errorId=null==i||null===(s=i.status)||void 0===s?void 0:s.value;var l=(r.errorId?r.licenseError():null)||i;r.bw=a,r.bh=u,t(l)}else t(i)},r.worker.postMessage({fn:"prepare",iData:e})}))]}))}))()}}])&&s(r.prototype,t),n&&s(r,n),e}();var p,h,y=t(7286),v=t(4550);function b(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}function w(e,r,t,n,o,i,a){try{var u=e[i](a),s=u.value}catch(e){return void t(e)}u.done?r(s):Promise.resolve(s).then(n,o)}function m(e,r){return function(e){if(Array.isArray(e))return e}(e)||function(e,r){var t=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=t){var n,o,i=[],a=!0,u=!1;try{for(t=t.call(e);!(a=(n=t.next()).done)&&(i.push(n.value),!r||i.length!==r);a=!0);}catch(e){u=!0,o=e}finally{try{a||null==t.return||t.return()}finally{if(u)throw o}}return i}}(e,r)||function(e,r){if(!e)return;if("string"==typeof e)return b(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);"Object"===t&&e.constructor&&(t=e.constructor.name);if("Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return b(e,r)}(e,r)||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,r){var t,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(t)throw new TypeError("Generator is already executing.");for(;a;)try{if(t=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=r.call(e,a)}catch(e){i=[6,e],n=0}finally{t=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 r,t,o,i;return g(this,(function(a){switch(a.label){case 0:return r=e.pdf417key,t=!!Object.entries(n.Z.config.documentTypes).find((function(e){var r=m(e,2);return r[0],r[1].find((function(e){return("pdf"===e.type||"back"===e.type)&&e.mode.uploader}))})),[4,(0,v.o)("".concat(n.Z.chunkPublicPath,"pdfWorker.js.gzip"))];case 1:return o=a.sent(),i=new d(o,r,t),y.Z.setModule("module","pdf",i),[2]}}))},h=function(){var e=this,r=arguments;return new Promise((function(t,n){var o=p.apply(e,r);function i(e){w(o,t,n,i,a,"next",e)}function a(e){w(o,t,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,r,t)=>{t.d(r,{o:()=>c});var n=t(7885),o=t(7666);function i(e,r,t,n,o,i,a){try{var u=e[i](a),s=u.value}catch(e){return void t(e)}u.done?r(s):Promise.resolve(s).then(n,o)}function a(e){return function(){var r=this,t=arguments;return new Promise((function(n,o){var a=e.apply(r,t);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,r){var t,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(t)throw new TypeError("Generator is already executing.");for(;a;)try{if(t=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=r.call(e,a)}catch(e){i=[6,e],n=0}finally{t=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,u])}}}var s,l=(s=a((function(e){var r,t,i,a,s;return u(this,(function(u){switch(u.label){case 0:return u.trys.push([0,2,,3]),t=Uint8Array.bind,[4,(0,o.xl)(e)];case 1:return r=new(t.apply(Uint8Array,[void 0,u.sent()])),i=(0,n.ec)(r),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)}),c=function(){var e=a((function(e){var r;return u(this,(function(t){switch(t.label){case 0:return[4,l(e)];case 1:return r=t.sent(),[2,new Worker(r)]}}))}));return function(r){return e.apply(this,arguments)}}()},8766:(e,r,t)=>{t.r(r),t.d(r,{default:()=>k});var n=t(4328),o=t(6399);function i(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}function a(e,r,t,n,o,i,a){try{var u=e[i](a),s=u.value}catch(e){return void t(e)}u.done?r(s):Promise.resolve(s).then(n,o)}function u(e){return function(){var r=this,t=arguments;return new Promise((function(n,o){var i=e.apply(r,t);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,r){for(var t=0;t<r.length;t++){var n=r[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function l(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function c(e,r){return function(e){if(Array.isArray(e))return e}(e)||function(e,r){var t=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=t){var n,o,i=[],a=!0,u=!1;try{for(t=t.call(e);!(a=(n=t.next()).done)&&(i.push(n.value),!r||i.length!==r);a=!0);}catch(e){u=!0,o=e}finally{try{a||null==t.return||t.return()}finally{if(u)throw o}}return i}}(e,r)||function(e,r){if(!e)return;if("string"==typeof e)return i(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);"Object"===t&&e.constructor&&(t=e.constructor.name);if("Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return i(e,r)}(e,r)||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,r){var t,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(t)throw new TypeError("Generator is already executing.");for(;a;)try{if(t=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=r.call(e,a)}catch(e){i=[6,e],n=0}finally{t=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(r,t,n){var o=this;!function(e,r){if(!(e instanceof r))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=r,this.worker.onmessage=function(e){var r=e.data,t=r.name,n=r.data;"initialization"===t&&(o.isInitialized=n)},this.worker.postMessage({fn:"init",key:t,isNeedToLoadPDFWIthPreprocess:n})}var r,t,n;return r=e,(t=[{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,r,t,n){this.geometry=e,this.minPDFframes=r,this.cropSizes=t,this.canvasSizes=n}},{key:"licenseError",value:function(){return{error:!0,errorType:"licenceKeyError",errorVal:this.errorVal}}},{key:"create",value:function(){}},{key:"setSizes",value:function(e,r){this.bw=e,this.bh=r,this.worker.postMessage({fn:"setSizes",bw:e,bh:r})}},{key:"allocate",value:function(){this.worker.postMessage({fn:"allocate"})}},{key:"drawCords",value:function(e){var r=this,t=[];if(e){var n=[];Object.entries(e).forEach((function(e){var t=c(e,2),o=t[0],i=t[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=r.canvasSizes.width*a/r.bw:n[s].y=r.canvasSizes.height*a/r.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),l=this.geometry.angleBetweenTwoVectors(a,u);s<=100&&s>=80&&l<=100&&l>=80&&(t=n)}return t}},{key:"processPDF",value:function(e){var r=this;return u((function(){var t,n;return f(this,(function(i){switch(i.label){case 0:return r.isProcessing?[2,{}]:(t={status:!1,predict:!1,touch:!1,type:"pdf",error:null,coords:[],trackString:"",pdfSuccessCount:0,pdfCount:0,isSuccessProcess:!1,pdfCapturedCount:0},r.isInitialized?(r.isProcessing=!0,[4,r.readPDF(e)]):[2,t]);case 1:return(n=i.sent()).error?(r.isProcessing=!1,t.error=n,[2,t]):(n&&"status"in n&&(n.status.value===o.l.Detected&&(r.pdfCapturedCount+=1),n.status.value===o.l.Detected||n.status.value===o.l.Decoded?(t.coords=r.drawCords(n.location),t.isSuccessProcess=!0):(r.successCount+=1,r.drawCords(null)),n.status.value===o.l.Decoded?(r.pdfCount+=1,r.pdfCount>=r.minPDFframes&&(r.successCount=0,r.pdfCapturedCount=0,r.pdfCount=0,t.trackString=n.trackString||n.data||"",t.status=!0,t.pdfCapturedCount=0)):r.pdfCount=0),t.pdfSuccessCount=r.successCount,t.pdfCount=r.pdfCount,t.pdfCapturedCount=r.pdfCapturedCount,r.isProcessing=!1,[2,t])}}))}))()}},{key:"processPDFWithPreProcess",value:function(e){var r=this;return new Promise((function(t){r.worker.onmessage=function(e){var n=e.data,o=n.name,i=n.data;if("result"===o){var a;r.errorId=null==i||null===(a=i.status)||void 0===a?void 0:a.value;var u=r.errorId?r.licenseError():null;t(u||i)}else t(i)},r.worker.postMessage({fn:"pdfWithPreProcess",iData:e})}))}},{key:"readPDF",value:function(e){var r=this;return u((function(){return f(this,(function(t){return[2,new Promise((function(t){r.worker.onmessage=function(e){var n=e.data,o=n.name,i=n.data,a=n.bw,u=n.bh;if("ready"===o)r.worker.postMessage({fn:"process"});else if("result"===o){var s;r.errorId=null==i||null===(s=i.status)||void 0===s?void 0:s.value;var l=(r.errorId?r.licenseError():null)||i;r.bw=a,r.bh=u,t(l)}else t(i)},r.worker.postMessage({fn:"prepare",iData:e})}))]}))}))()}}])&&s(r.prototype,t),n&&s(r,n),e}();var p,h,y=t(7286),v=t(4550);function b(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}function w(e,r,t,n,o,i,a){try{var u=e[i](a),s=u.value}catch(e){return void t(e)}u.done?r(s):Promise.resolve(s).then(n,o)}function m(e,r){return function(e){if(Array.isArray(e))return e}(e)||function(e,r){var t=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=t){var n,o,i=[],a=!0,u=!1;try{for(t=t.call(e);!(a=(n=t.next()).done)&&(i.push(n.value),!r||i.length!==r);a=!0);}catch(e){u=!0,o=e}finally{try{a||null==t.return||t.return()}finally{if(u)throw o}}return i}}(e,r)||function(e,r){if(!e)return;if("string"==typeof e)return b(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);"Object"===t&&e.constructor&&(t=e.constructor.name);if("Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return b(e,r)}(e,r)||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,r){var t,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(t)throw new TypeError("Generator is already executing.");for(;a;)try{if(t=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=r.call(e,a)}catch(e){i=[6,e],n=0}finally{t=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 r,t,o,i;return g(this,(function(a){switch(a.label){case 0:return r=e.pdf417key,t=!!Object.entries(n.Z.config.documentTypes).find((function(e){var r=m(e,2);return r[0],r[1].find((function(e){return("pdf"===e.type||"back"===e.type)&&e.mode.uploader}))})),[4,(0,v.o)("".concat(n.Z.chunkPublicPath,"pdfWorker.js.gzip"))];case 1:return o=a.sent(),i=new d(o,r,t),y.Z.setModule("module","pdf",i),[2]}}))},h=function(){var e=this,r=arguments;return new Promise((function(t,n){var o=p.apply(e,r);function i(e){w(o,t,n,i,a,"next",e)}function a(e){w(o,t,n,i,a,"throw",e)}i(void 0)}))},function(e){return h.apply(this,arguments)})}}]);
@@ -10,7 +10,6 @@ declare const bl: {
10
10
  resetSteps(): Promise<void>;
11
11
  updateDocumentTypes(documentTypes: IDocumentTypeConfig): Promise<any>;
12
12
  reloadComponent(config: Partial<IConfig>): Promise<void>;
13
- showSpinner(val: boolean): void;
14
13
  showLoader(val: boolean, bottomText?: string, topText?: string): void;
15
14
  };
16
15
  export default bl;
@@ -33,6 +33,10 @@ interface IHintTexts {
33
33
  back: string;
34
34
  barcode: string;
35
35
  };
36
+ capture: {
37
+ pdf: string;
38
+ mrz: string;
39
+ };
36
40
  dontSee: string;
37
41
  dontMove: string;
38
42
  turnFaceLeft: string;
@@ -62,6 +66,7 @@ interface IGeneral {
62
66
  barcode: string;
63
67
  back: string;
64
68
  photo: string;
69
+ awaiting: string;
65
70
  notificationStepSuccess: string;
66
71
  notificationStepWarning: string;
67
72
  notificationDocumentTypeChangedInfo: string;
@@ -69,6 +74,7 @@ interface IGeneral {
69
74
  notificationStepMinSize: string;
70
75
  notificationSubmit: string;
71
76
  notificationCaptureHook: string;
77
+ notificationCaptureSide: string;
72
78
  initialLoader: {
73
79
  top: string;
74
80
  bottom: string;
@@ -32,6 +32,7 @@ export declare const cropAndResize: (src: HTMLCanvasElement | HTMLVideoElement,
32
32
  export declare const createCanvas: (id: string, size: Size) => HTMLCanvasElement;
33
33
  export declare const createCanvasFromImage: (id: string, image: HTMLImageElement) => HTMLCanvasElement;
34
34
  export declare const createCanvasFromImageData: (id: string, imageData: ImageData) => HTMLCanvasElement;
35
+ export declare const getCanvasFromImageData: (imageData: ImageData) => HTMLCanvasElement;
35
36
  export declare function calculateFitInSquare(outerBox: any, innerBox: any, padding?: number): {
36
37
  x: number;
37
38
  y: number;
@@ -0,0 +1 @@
1
+ export declare const applyStyles: (scssString: string) => void;
@@ -1,7 +1,6 @@
1
- import './assets/scss/index.scss';
2
1
  import { IConfig } from './modules/Config';
3
- import { SupportedLanguage } from './environment/langs';
4
- import { IDocumentTypeConfig } from './modules/validator';
2
+ import type { SupportedLanguage } from './environment/langs';
3
+ import type { IDocumentTypeConfig } from './modules/validator';
5
4
  export default class VideoCapturing {
6
5
  constructor(config: IConfig);
7
6
  get version(): string;
@@ -1,8 +1,7 @@
1
1
  import { MainScreen } from '../ui/MainScreen/MainScreen';
2
2
  import { Size } from '../../helpers/image';
3
- import { Spinner } from '../Spinner/Spinner';
3
+ import { Loader } from '../Spinner/Loader';
4
4
  import SelectDocumentType from '../ui/SelectDocumentType';
5
- import { InitialLoader } from '../ui/InitialLoader/initialLoader';
6
5
  import { DocumentsList } from '../ui/DocumentsList/DocumentsList';
7
6
  import { StepsList } from '../ui/StepsList/StepsList';
8
7
  import { IDVCVersionPlank } from '../ui/IDVCVersionPlank/IDVCVersionPlank';
@@ -10,9 +9,8 @@ import { AnimationSettings, Notification, NotificationState } from '../ui/Notifi
10
9
  import type { Context } from '../../types/context';
11
10
  export declare class WeblibUI {
12
11
  mountElement: HTMLElement;
13
- initialLoader: InitialLoader;
14
12
  mainScreen: MainScreen;
15
- spinner: Spinner;
13
+ loader: Loader;
16
14
  selectDocumentType: SelectDocumentType;
17
15
  initScreen: DocumentsList;
18
16
  stepsScreen: StepsList;
@@ -1,16 +1,16 @@
1
- import { SpinnerState } from '../ui/Spinner/SpinnerUI';
2
- interface ISpinner {
1
+ import { LoaderState } from '../ui/Spinner/LoaderUI';
2
+ interface ILoader {
3
3
  addSpinnerState: () => void;
4
4
  showSpinner: () => void;
5
5
  removeSpinnerState: () => void;
6
6
  clearState: () => void;
7
7
  hideSpinner: () => void;
8
8
  }
9
- export declare class Spinner implements ISpinner {
9
+ export declare class Loader implements ILoader {
10
10
  private ui;
11
11
  private stats;
12
- constructor(mountElement: any, state: SpinnerState);
13
- addSpinnerState(bottomText?: string, topText?: string, isInitializing?: boolean): void;
12
+ constructor(mountElement: any, state: LoaderState);
13
+ addSpinnerState(bottomText?: string, topText?: string): void;
14
14
  removeSpinnerState(): void;
15
15
  clearState(): void;
16
16
  showSpinner(): void;
@@ -25,15 +25,23 @@ export declare class MeshFace {
25
25
  processFace(prediction: FacePrediction, resizedSize: HTMLCanvasElement | HTMLVideoElement): RealFaceResultObject;
26
26
  dropSuccess(): void;
27
27
  getDirection(): RealFaceTurnSide;
28
+ isCorrectKeyPointsDistances(keyPointsDistances: {
29
+ eyeDistance: number;
30
+ earDistance: number;
31
+ }): boolean;
28
32
  setDirection(value: any): void;
29
33
  getMf(center: any): number[];
30
34
  processBadPerimeter(perimeter: any): void;
31
- main(perimeter: any, mf: any): void;
35
+ main(perimeter: any, mf: any, keyPointsDistances: any): void;
32
36
  processRealFace(): void;
33
37
  calculateFace(): {
34
38
  perimeter: number;
35
39
  mf: number[];
36
40
  };
41
+ calculateKeyPointsDistances(): {
42
+ eyeDistance: number;
43
+ earDistance: number;
44
+ };
37
45
  processPrediction(): void;
38
46
  processDistance(): void;
39
47
  /**
@@ -1,3 +1,3 @@
1
- export declare const dropRes: () => void;
1
+ export declare const dropCaptureProgress: () => void;
2
2
  declare const _default: (data: ImageData) => Promise<Record<string, any>>;
3
3
  export default _default;
@@ -7,11 +7,12 @@ import { StepType } from '../../../environment/stepsDescription';
7
7
  import { ControlButton, ControlButtonClickedCustomEvent } from '../ControlButton/ControlButton';
8
8
  import { CallbackHandler, MessageBox } from '../MessageBox/MessageBox';
9
9
  import { DesktopNotification, DesktopNotificationVisibility } from '../DesktopNotification/DesktopNotification';
10
- import { SpinnerUI } from '../Spinner/SpinnerUI';
10
+ import { LoaderUI } from '../Spinner/LoaderUI';
11
11
  import { Component, StateBase } from '../Component';
12
12
  import type { Context } from '../../../types/context';
13
13
  import type { DocumentTypeIndex, DocumentTypeName } from '../../../environment/documentTypes';
14
14
  import { Slider } from '../../Slider';
15
+ import { HintType, MaskType } from '../VideoWrapper/MaskCapture';
15
16
  export type MainScreenUIEvents = {
16
17
  onSwitch: (event: CustomEvent) => void;
17
18
  onCardClick: (event: CustomEvent) => void;
@@ -28,7 +29,7 @@ export declare class MainScreen {
28
29
  mainContainer: HTMLElement;
29
30
  videoWrapper: VideoWrapper;
30
31
  desktopNotification: DesktopNotification;
31
- spinner: SpinnerUI;
32
+ spinner: LoaderUI;
32
33
  componentWrapper: HTMLElement;
33
34
  captureButtonsMountElement: HTMLElement;
34
35
  notificationContainer: HTMLElement;
@@ -57,7 +58,9 @@ export declare class MainScreen {
57
58
  currentStepType: StepType;
58
59
  type: DocumentTypeIndex | 0;
59
60
  }): void;
60
- updateMaskCapture(currentStepType: StepType, type: DocumentTypeIndex | 0): void;
61
+ updateMaskCapture(currentStepType: StepType, type: DocumentTypeIndex, hintType?: HintType): void;
62
+ changeMaskType(maskType: MaskType): void;
63
+ showMaskHint(currentStepType: StepType, currentDocument: DocumentTypeIndex, hintType?: HintType): void;
61
64
  updateKeyError(licenseKeyError: string): void;
62
65
  resetState(): void;
63
66
  initSteps(steps: Step[], currentDocument: DocumentTypeName | ''): void;
@@ -1,11 +1,11 @@
1
1
  import { Component } from '../Component';
2
- export type SpinnerState = {
2
+ export type LoaderState = {
3
3
  loading: boolean;
4
4
  spinnerVisibility: boolean;
5
5
  bottomText?: string;
6
6
  topText?: string;
7
7
  };
8
- export declare class SpinnerUI extends Component<SpinnerState> {
9
- constructor(mountElement: any, state: SpinnerState, events?: any);
8
+ export declare class LoaderUI extends Component<LoaderState> {
9
+ constructor(mountElement: any, state: LoaderState, events?: any);
10
10
  protected addEventListeners(): void;
11
11
  }
@@ -1,5 +1,7 @@
1
1
  import type { StepType } from '../../../environment/stepsDescription';
2
2
  import type { DocumentTypeIndex } from '../../../environment/documentTypes';
3
+ export type MaskType = 'document' | 'trackString' | 'user';
4
+ export type HintType = 'pdf' | 'mrz2' | 'mrz3';
3
5
  export declare class MaskCapture {
4
6
  private componentWrapper;
5
7
  private readonly svg;
@@ -13,7 +15,7 @@ export declare class MaskCapture {
13
15
  private cssVars;
14
16
  private sizesMap;
15
17
  private hintElements;
16
- private hintType;
18
+ private maskType;
17
19
  constructor(componentWrapper: HTMLElement, cssVarContainer: HTMLElement);
18
20
  set sizes({ width, height }: {
19
21
  width: any;
@@ -23,12 +25,13 @@ export declare class MaskCapture {
23
25
  private get svgSizes();
24
26
  private get strokeLength();
25
27
  private set borderSizes(value);
26
- applyMaskCaptureSizes(mainContainer: HTMLElement, currentStepType: StepType, type: DocumentTypeIndex | 0): void;
27
- changeHintState(currentStepType: any, currentDocument: any): void;
28
+ applyMaskCaptureSizes(currentStepType: StepType, type: DocumentTypeIndex | 0): void;
29
+ showHint(currentStepType: StepType, currentDocument: DocumentTypeIndex, hintType?: HintType): void;
30
+ changeMaskType(maskType: MaskType): void;
28
31
  /**
29
32
  * resizes frame based on width and height of main container
30
33
  */
31
- private calculateMainContainerSizes;
34
+ calculateMainContainerSizes(): void;
32
35
  private hideAllHints;
33
36
  private showHintForCurrentStep;
34
37
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@idscan/idvc2",
3
- "version": "2.11.1",
3
+ "version": "2.12.0",
4
4
  "description": "component for the capturing documents",
5
5
  "main": "dist/idvc.js",
6
6
  "types": "dist/types/idvc.d.ts",
@@ -51,6 +51,7 @@
51
51
  "jest": "29.5.0",
52
52
  "jsdom": "22.0.0",
53
53
  "mini-css-extract-plugin": "2.7.6",
54
+ "raw-loader": "^4.0.2",
54
55
  "remove-files-webpack-plugin": "^1.5.0",
55
56
  "sass": "1.62.0",
56
57
  "sass-loader": "13.2.1",