@idscan/onboarding 2.4.0 → 2.5.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.
- package/dist/@types/src/modules/ValidationModal.d.ts +1 -0
- package/dist/css/onboarding.css +2 -2
- package/dist/js/wrapper.js +1 -1
- package/dist/networks/Face-chunk.js +1 -1
- package/dist/networks/MRZ-chunk.js +1 -1
- package/dist/networks/blurWorker.js.gzip +0 -0
- package/dist/networks/generalTypeDetectionYolo29052024.onnx.gzip +0 -0
- package/dist/networks/mrzWorker.js.gzip +0 -0
- package/package.json +2 -2
- package/readme.md +7 -0
- package/dist/networks/ClassLocal-chunk.js +0 -1
- package/dist/networks/classLocal03032023.onnx.gzip +0 -0
|
@@ -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=(o=u.trys).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:()=>L});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 v(e,t){return v=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},v(e,t)}function b(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 function(e,t){return!t||"object"!=((r=t)&&"undefined"!=typeof Symbol&&r.constructor===Symbol?"symbol":typeof r)&&"function"!=typeof t?s(e):t;var r}(this,r)}}var d=[1,28,28,1],w=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)}(o,e);var t,r,n=b(o);function o(){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,i=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,o),y(s(e=n.call(this,t,r,i)),"predictionList",void 0),y(s(e),"interpretedPredictionsList",void 0),e}return t=o,r=[{key:"predict",value:function(e){var t=y({},"input_1",new i.es("float32",e,d));return this.session.run(t)}},{key:"predictFromArray",value:function(e,t){var r,n=this;return(r=function(){var r,o,i;return function(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=(o=u.trys).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])}}}(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),o}(u.Z),m=r(4554);function g(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 k(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){return function(){var t=this,r=arguments;return new Promise((function(n,o){var i=e.apply(t,r);function u(e){k(i,n,o,u,a,"next",e)}function a(e){k(i,n,o,u,a,"throw",e)}u(void 0)}))}}function O(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 x(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function j(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){x(e,t,r[t])}))}return e}function S(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);r.push.apply(r,n)}return r}(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))})),e}function R(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){if("string"==typeof e)return g(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(r):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?g(e,t):void 0}}(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 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=(o=u.trys).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 E=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),x(this,"w",0),x(this,"h",0),x(this,"successCount",0),x(this,"worker",void 0),x(this,"model",void 0),x(this,"isInitialized",!1),x(this,"isProcessing",!1),x(this,"MIN_MRZ_FRAMES",3),this.model=new w("".concat(m.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;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=R(this.yComparator(t[0],t[1]),2),n=r[0],o=r[1],i=R(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 P((function(){var n;return A(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"*"===R(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=P((function(e){var t,n,i,u;return A(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 P((function(){var r,n,o,i,u,a,c;return A(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,S(j({},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 P((function(){var r,n,o,i,u;return A(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&&O(t.prototype,r),e}();const M=E;var T=r(4295),C=r(4550);function _(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)}const L=(z=function(e){var t,r,i,u;return function(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=(o=u.trys).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])}}}(this,(function(a){switch(a.label){case 0:return(t=e.commonLicenseKey)?[3,1]:((0,T.Z)(),[3,3]);case 1:return[4,(0,C.o)("".concat(n.Z.chunkPublicPath,"mrzWorker.js.gzip"))];case 2:i=a.sent(),u=new M(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]}}))},I=function(){var e=this,t=arguments;return new Promise((function(r,n){var o=z.apply(e,t);function i(e){_(o,r,n,i,u,"next",e)}function u(e){_(o,r,n,i,u,"throw",e)}i(void 0)}))},function(e){return I.apply(this,arguments)});var z,I}}]);
|
|
1
|
+
(self.webpackChunk_idscan_idvc2=self.webpackChunk_idscan_idvc2||[]).push([[343],{4550:(e,t,r)=>{r.d(t,{o:()=>l});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=(o=u.trys).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,s=(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)}),l=function(){var e=u((function(e){var t;return a(this,(function(r){switch(r.label){case 0:return[4,s(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:()=>_});var n=r(4328),o=r(7286),i=r(8417),u=r(6955),a=r(813),c=r(683),s=["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 l(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 v(e,t){return v=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},v(e,t)}function b(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 function(e,t){return!t||"object"!=((r=t)&&"undefined"!=typeof Symbol&&r.constructor===Symbol?"symbol":typeof r)&&"function"!=typeof t?l(e):t;var r}(this,r)}}var d=[1,28,28,1],w=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)}(o,e);var t,r,n=b(o);function o(){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,i=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,o),y(l(e=n.call(this,t,r,i)),"predictionList",void 0),y(l(e),"interpretedPredictionsList",void 0),e}return t=o,r=[{key:"predict",value:function(e){var t=y({},"input_1",new i.es("float32",e,d));return this.session.run(t)}},{key:"predictFromArray",value:function(e,t){var r,n=this;return(r=function(){var r,o,i;return function(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=(o=u.trys).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])}}}(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:s[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),o}(u.Z),m=r(4554);function g(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 k(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){return function(){var t=this,r=arguments;return new Promise((function(n,o){var i=e.apply(t,r);function u(e){k(i,n,o,u,a,"next",e)}function a(e){k(i,n,o,u,a,"throw",e)}u(void 0)}))}}function O(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 x(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function j(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){x(e,t,r[t])}))}return e}function S(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);r.push.apply(r,n)}return r}(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))})),e}function R(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){if("string"==typeof e)return g(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(r):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?g(e,t):void 0}}(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 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=(o=u.trys).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 E=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),x(this,"w",0),x(this,"h",0),x(this,"successCount",0),x(this,"worker",void 0),x(this,"model",void 0),x(this,"isInitialized",!1),x(this,"isProcessing",!1),x(this,"MIN_MRZ_FRAMES",3),this.model=new w("".concat(m.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;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=R(this.yComparator(t[0],t[1]),2),n=r[0],o=r[1],i=R(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 P((function(){var n;return A(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"*"===R(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=P((function(e){var t,n,i,u;return A(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 P((function(){var r,n,o,i,u,a,c;return A(this,(function(s){switch(s.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=s.sent())?void 0:o.errorId)?(t.isProcessing=!1,[2,S(j({},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 P((function(){var r,n,o,i,u;return A(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&&O(t.prototype,r),e}();const M=E;var L=r(4295),T=r(4550);function C(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)}const _=(z=function(e){var t,r,i,u;return function(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=(o=u.trys).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])}}}(this,(function(a){switch(a.label){case 0:return(t=e.commonLicenseKey)?[3,1]:((0,L.Z)(),[3,3]);case 1:return[4,(0,T.o)("".concat(n.Z.chunkPublicPath,"mrzWorker.js.gzip"))];case 2:i=a.sent(),u=new M(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]}}))},I=function(){var e=this,t=arguments;return new Promise((function(r,n){var o=z.apply(e,t);function i(e){C(o,r,n,i,u,"next",e)}function u(e){C(o,r,n,i,u,"throw",e)}i(void 0)}))},function(e){return I.apply(this,arguments)});var z,I}}]);
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@idscan/onboarding",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.5.0",
|
|
4
4
|
"description": "Wrapper of the IDVC library for DVS Online.",
|
|
5
5
|
"main": "dist/js/wrapper.js",
|
|
6
6
|
"types": "dist/@types/src/Wrapper.d.ts",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"minor": "npm version minor"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@idscan/idvc2": "2.
|
|
23
|
+
"@idscan/idvc2": "2.10.0",
|
|
24
24
|
"core-js": "^3.30.0",
|
|
25
25
|
"qrcode": "^1.5.1",
|
|
26
26
|
"regenerator-runtime": "^0.13.11"
|
package/readme.md
CHANGED
|
@@ -174,6 +174,13 @@ btn.addEventListener('click', () => {
|
|
|
174
174
|
|
|
175
175
|
## Version history
|
|
176
176
|
|
|
177
|
+
- **2.5.0**
|
|
178
|
+
- Updated IDVC component
|
|
179
|
+
- feat: update UI
|
|
180
|
+
|
|
181
|
+
- **2.4.1**
|
|
182
|
+
- Minor fixes
|
|
183
|
+
|
|
177
184
|
- **2.4.0**
|
|
178
185
|
- feat: added a new public method to show the loader.
|
|
179
186
|
Method: showLoader(val: boolean, bottomText?: string, topText?: string)
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_idscan_idvc2=self.webpackChunk_idscan_idvc2||[]).push([[423],{2093:(e,t,n)=>{n.r(t),n.d(t,{default:()=>k});var r=n(4328),o=n(4554),i=n(7286),a=n(8417),c=n(6955),u=n(813),l=n(528),s=n(683),f=["Back","BackWithoutBarcode","Front","None"];function h(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function p(e,t,n,r,o,i,a){try{var c=e[i](a),u=c.value}catch(e){return void n(e)}c.done?t(u):Promise.resolve(u).then(r,o)}function b(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function v(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function d(e){return d=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},d(e)}function y(e,t){return y=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},y(e,t)}function w(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 n,r=d(e);if(t){var o=d(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return function(e,t){return!t||"object"!=((n=t)&&"undefined"!=typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)&&"function"!=typeof t?h(e):t;var n}(this,n)}}new Set(["Back","BackWithoutBarcode"]);var g=[1,320,320,3],m=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&&y(e,t)}(o,e);var t,n,r=w(o);function o(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:u.z.WASM,i=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,o),v(h(e=r.call(this,t,n,i)),"canvasSize",{width:1,height:1}),e}return t=o,n=[{key:"setSizes",value:function(e){var t=e.height,n=e.width;this.canvasSize.width=n,this.canvasSize.height=t}},{key:"predictFromImage",value:function(e,t,n,r){var o,i=this;return(o=function(){var o,a,c,u,f;return function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(i){return function(c){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=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++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).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],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,c])}}}(this,(function(h){switch(h.label){case 0:return i.loading?[2,[]]:(o=i.createSrc(e,"angles-input-canvas"),a=t||(0,l.vL)("angles-canvas",{width:320,height:320}),c=(0,l.SI)(o,a,n,r),u=(0,s.Di)(c,s.eQ.WITHOUT),console.time("classLocal"),[4,i.predict(u)]);case 1:return f=h.sent(),console.timeEnd("classLocal"),i.setSizes(o),[2,i.interpret(f["StatefulPartitionedCall:1"].data,f["StatefulPartitionedCall:0"].data)]}}))},function(){var e=this,t=arguments;return new Promise((function(n,r){var i=o.apply(e,t);function a(e){p(i,n,r,a,c,"next",e)}function c(e){p(i,n,r,a,c,"throw",e)}a(void 0)}))})()}},{key:"interpret",value:function(e,t){var n={side:"None",bbox:{topLeft:{x:0,y:0},bottomRight:{x:1,y:1}},perimeterInPercents:{width:0,height:0}},r=[];return e.forEach((function(e,t){return r.push({label:f[t],score:e})})),n.side=r.sort((function(e,t){return t.score-e.score}))[0].label,n.bbox.topLeft.x=~~(t[0]*this.canvasSize.width),n.bbox.topLeft.y=~~(t[1]*this.canvasSize.height),n.bbox.bottomRight.x=~~(t[2]*this.canvasSize.width),n.bbox.bottomRight.y=~~(t[3]*this.canvasSize.height),n.perimeterInPercents.width=~~(100*(t[2]-t[0])),n.perimeterInPercents.height=~~(100*(t[3]-t[1])),n}},{key:"predict",value:function(e){var t=v({},"serving_default_input_2:0",new a.es("float32",e,g));return this.session.run(t)}}],n&&b(t.prototype,n),o}(c.Z);function S(e,t,n,r,o,i,a){try{var c=e[i](a),u=c.value}catch(e){return void n(e)}c.done?t(u):Promise.resolve(u).then(r,o)}const k=function(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var i=e.apply(t,n);function a(e){S(i,r,o,a,c,"next",e)}function c(e){S(i,r,o,a,c,"throw",e)}a(void 0)}))}}((function(){var e;return function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(i){return function(c){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=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++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).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],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,c])}}}(this,(function(t){return e=new m("".concat(o.t.cK),u.z.WASM,r.Z.networkUrl),i.Z.setModule("model","classLocal",e),[2,[e.initialize.bind(e)]]}))}))}}]);
|
|
Binary file
|