/*! ****************************************************************************
Copyright (c) Microblink. All rights reserved.

THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
***************************************************************************** */
/*! *****************************************************************************
Copyright (c) Microsoft Corporation.

Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */
function e(e,t,A,i){return new(A||(A=Promise))((function(n,a){function o(e){try{r(i.next(e))}catch(e){a(e)}}function s(e){try{r(i.throw(e))}catch(e){a(e)}}function r(e){var t;e.done?n(e.value):(t=e.value,t instanceof A?t:new A((function(e){e(t)}))).then(o,s)}r((i=i.apply(e,t||[])).next())}))}let t=0;class A{constructor(e){this.action=e,this.messageID=function(){const e=t;return t+=1,e}()}}class i extends A{constructor(e,t){super(i.action),this.wasmModuleName=e.wasmModuleName,this.licenseKey=e.licenseKey,this.userId=t,this.registerLoadCallback=null!==e.loadProgressCallback,this.allowHelloMessage=e.allowHelloMessage,this.engineLocation=e.engineLocation,this.wasmType=e.wasmType,this.numberOfWorkers=e.numberOfWorkers}}var n,a,o;i.action="init",function(e){e[e.Any=0]="Any",e[e.Recognizer=1]="Recognizer",e[e.RecognizerSettings=2]="RecognizerSettings",e[e.Callback=3]="Callback"}(n||(n={}));class s extends A{constructor(e,t){super(s.action),this.className=e,this.params=t}}s.action="createNewNativeObject";class r extends A{constructor(e,t,A){super(r.action),this.recognizerHandles=e,this.allowMultipleResults=t,this.registeredMetadataCallbacks=A}}r.action="createRecognizerRunner";class c extends A{constructor(e,t){super(c.action),this.recognizerHandles=e,this.allowMultipleResults=t}}c.action="reconfigureRecognizerRunner";class I extends A{constructor(){super(I.action)}}I.action="deleteRecognizerRunner";class N extends A{constructor(e,t,A){super(N.action),this.objectHandle=e,this.methodName=t,this.params=A}}N.action="invokeObject";class l extends A{constructor(e){super(l.action),this.frame=e}getTransferrables(){return[this.frame.imageData.data.buffer]}}l.action="processImage";class R extends A{constructor(e){super(R.action),this.hardReset=e}}R.action="resetRecognizers";class E{constructor(){this.onDebugText=!1,this.onDetectionFailed=!1,this.onQuadDetection=!1,this.onPointsDetection=!1,this.onFirstSideResult=!1,this.onGlare=!1}}class d extends A{constructor(e){super(d.action),this.registeredMetadataCallbacks=e}}d.action="registerMetadataCallbacks";class S extends A{constructor(e){super(S.action),this.detectionOnlyMode=e}}S.action="setDetectionOnly";class O extends A{constructor(e){super(O.action),this.callbackNonEmpty=e}}O.action="setClearTimeoutCallback";class T extends A{constructor(e){super(T.action),this.cameraPreviewMirrored=e}}T.action="setCameraPreviewMirrored",function(e){e[e.onDebugText=0]="onDebugText",e[e.onDetectionFailed=1]="onDetectionFailed",e[e.onQuadDetection=2]="onQuadDetection",e[e.onPointsDetection=3]="onPointsDetection",e[e.onFirstSideResult=4]="onFirstSideResult",e[e.clearTimeoutCallback=5]="clearTimeoutCallback",e[e.onGlare=6]="onGlare",e[e.recognizerCallback=7]="recognizerCallback"}(a||(a={})),function(e){e.Basic="BASIC",e.Advanced="ADVANCED",e.AdvancedWithThreads="ADVANCED_WITH_THREADS"}(o||(o={}));function u(e,t){return A=>{const i=A;i.success?e():t(i.error)}}function C(e,t){return A=>{const i=A;i.success?e(A):t(i.error)}}class _{constructor(e,t,A){this.wasmSDKWorker=e,this.objectHandle=A,this.recognizerName=t,this.callbacks=new Map}getRemoteObjectHandle(){return this.objectHandle}currentSettings(){return new Promise(((e,t)=>{if(0>this.objectHandle)return void t("Invalid object handle: "+this.objectHandle);const A=new N(this.objectHandle,"currentSettings",[]),i=C((t=>{e(t.result)}),t);this.wasmSDKWorker.postMessage(A,i)}))}toJSON(){return Promise.resolve(null)}clearAllCallbacks(){this.callbacks.clear(),this.wasmSDKWorker.unregisterRecognizerCallbacks(this.objectHandle)}removeFunctions(e){this.clearAllCallbacks();const t=Object.keys(e);let A=!1;for(const i of t){const t=e[i];if("function"==typeof t){this.callbacks.set(i,t);e[i]={parameter:{recognizerHandle:this.objectHandle,callbackName:i},type:n.Callback},A=!0}}return A&&this.wasmSDKWorker.registerRecognizerCallbacks(this.objectHandle,this),e}updateSettings(e){return new Promise(((t,A)=>{if(0>this.objectHandle)return void A("Invalid object handle: "+this.objectHandle);const i=new N(this.objectHandle,"updateSettings",[{parameter:this.removeFunctions(e),type:n.RecognizerSettings}]),a=u(t,A);this.wasmSDKWorker.postMessage(i,a)}))}invokeCallback(e,t){const A=this.callbacks.get(e);void 0!==A?A(...t):console.warn("Cannot find callback",e)}getResult(){return new Promise(((e,t)=>{if(0>this.objectHandle)return void t("Invalid object handle: "+this.objectHandle);const A=new N(this.objectHandle,"getResult",[]),i=C((t=>{e(t.result)}),t);this.wasmSDKWorker.postMessage(A,i)}))}delete(){return new Promise(((e,t)=>{if(0>this.objectHandle)return void t("Invalid object handle: "+this.objectHandle);this.clearAllCallbacks();const A=new N(this.objectHandle,"delete",[]),i=u((()=>{this.objectHandle=-1,e()}),t);this.wasmSDKWorker.postMessage(A,i)}))}}function D(e){const t=new E;return t.onDebugText=!!e.onDebugText,t.onDetectionFailed=!!e.onDetectionFailed,t.onPointsDetection=!!e.onPointsDetection,t.onQuadDetection=!!e.onQuadDetection,t.onFirstSideResult=!!e.onFirstSideResult,t.onGlare=!!e.onGlare,t}class h{constructor(e){this.deleted=!1,this.wasmSDKWorker=e}processImage(e){return new Promise(((t,A)=>{if(this.deleted)return void A("Recognizer runner is deleted. It cannot be used anymore!");const i=new l(e),n=C((e=>{t(e.recognitionState)}),A);this.wasmSDKWorker.postTransferrableMessage(i,n)}))}reconfigureRecognizers(e,t){return new Promise(((A,i)=>{if(this.deleted)return void i("Recognizer runner is deleted. It cannot be used anymore!");const n=L(e),a=new c(n,t),o=u(A,i);this.wasmSDKWorker.postMessage(a,o)}))}setMetadataCallbacks(e){return new Promise(((t,A)=>{const i=new d(D(e)),n=u(t,A);this.wasmSDKWorker.postMessageAndRegisterCallbacks(i,e,n)}))}resetRecognizers(e){return new Promise(((t,A)=>{const i=new R(e),n=u(t,A);this.wasmSDKWorker.postMessage(i,n)}))}setDetectionOnlyMode(e){return new Promise(((t,A)=>{const i=new S(e),n=u(t,A);this.wasmSDKWorker.postMessage(i,n)}))}setClearTimeoutCallback(e){return new Promise(((t,A)=>{const i=new O(null!==e),n=u(t,A);this.wasmSDKWorker.registerClearTimeoutCallback(e),this.wasmSDKWorker.postMessage(i,n)}))}setCameraPreviewMirrored(e){return new Promise(((t,A)=>{const i=new T(e),n=u(t,A);this.wasmSDKWorker.postMessage(i,n)}))}delete(){return this.deleted?Promise.reject("Recognizer runner is already deleted."):new Promise(((e,t)=>{const A=new I,i=u((()=>{this.deleted=!0,e()}),t);this.wasmSDKWorker.postMessage(A,i)}))}}function L(e){const t=[];for(const A of e)t.push(A.getRemoteObjectHandle());return t}class U{constructor(e){this.wasmSDKWorker=e}createRecognizerRunner(e,t=!1,A={}){return new Promise(((i,n)=>{const a=L(e),o=new r(a,t,D(A)),s=u((()=>{i(new h(this.wasmSDKWorker))}),n);this.wasmSDKWorker.postMessageAndRegisterCallbacks(o,A,s)}))}newRecognizer(e,...t){return new Promise(((A,i)=>{const a=new s(e,function(e){const t=[];for(let A of e){let e=n.Any;A instanceof _&&(e=n.Recognizer,A=A.getRemoteObjectHandle()),t.push({parameter:A,type:e})}return t}(t)),o=C((t=>{const i=new _(this.wasmSDKWorker,e,t.objectHandle);A(i)}),i);this.wasmSDKWorker.postMessage(a,o)}))}}class m{constructor(e,t,A){this.eventHandlers={},this.metadataCallbacks={},this.clearTimeoutCallback=null,this.loadedWasmType=o.Basic,this.mbWasmWorker=e,this.mbWasmWorker.onmessage=e=>{this.handleWorkerEvent(e)},this.mbWasmWorker.onerror=()=>{A("Problem during initialization of worker file!")},this.mbWasmModule=new U(this),this.loadCallback=t,this.recognizersWithCallbacks=new Map,this.showOverlay=!1}postMessage(e,t){this.eventHandlers[e.messageID]=t,this.mbWasmWorker.postMessage(e)}postTransferrableMessage(e,t){this.eventHandlers[e.messageID]=t,this.mbWasmWorker.postMessage(e,e.getTransferrables())}postMessageAndRegisterCallbacks(e,t,A){this.eventHandlers[e.messageID]=A,this.metadataCallbacks=t,this.mbWasmWorker.postMessage(e)}registerClearTimeoutCallback(e){this.clearTimeoutCallback=e}registerRecognizerCallbacks(e,t){this.recognizersWithCallbacks.set(e,t)}unregisterRecognizerCallbacks(e){this.recognizersWithCallbacks.delete(e)}delete(){this.mbWasmWorker.terminate()}handleWorkerEvent(e){if("isCallbackMessage"in e.data){const t=e.data;switch(t.callbackType){case a.onDebugText:"function"==typeof this.metadataCallbacks.onDebugText&&this.metadataCallbacks.onDebugText(t.callbackParameters[0]);break;case a.onDetectionFailed:"function"==typeof this.metadataCallbacks.onDetectionFailed&&this.metadataCallbacks.onDetectionFailed();break;case a.onPointsDetection:"function"==typeof this.metadataCallbacks.onPointsDetection&&this.metadataCallbacks.onPointsDetection(t.callbackParameters[0]);break;case a.onQuadDetection:"function"==typeof this.metadataCallbacks.onQuadDetection&&this.metadataCallbacks.onQuadDetection(t.callbackParameters[0]);break;case a.onFirstSideResult:"function"==typeof this.metadataCallbacks.onFirstSideResult&&this.metadataCallbacks.onFirstSideResult();break;case a.clearTimeoutCallback:this.clearTimeoutCallback&&"function"==typeof this.clearTimeoutCallback.onClearTimeout&&this.clearTimeoutCallback.onClearTimeout();break;case a.onGlare:"function"==typeof this.metadataCallbacks.onGlare&&this.metadataCallbacks.onGlare(t.callbackParameters[0]);break;case a.recognizerCallback:{const e=t.callbackParameters.shift(),A=this.recognizersWithCallbacks.get(e.recognizerHandle);void 0!==A?A.invokeCallback(e.callbackName,t.callbackParameters):console.warn("Cannot find recognizer to deliver callback message. Maybe it's destroyed?",e);break}default:throw Error("Unknown callback type: "+a[t.callbackType])}}else if("isLoadProgressMessage"in e.data){const t=e.data;"function"==typeof this.loadCallback&&this.loadCallback(t.progress)}else{const t=e.data,A=this.eventHandlers[t.messageID];delete this.eventHandlers[t.messageID],A(t)}}static createWasmWorker(t,A,n){return e(this,void 0,void 0,(function*(){return new Promise(((e,a)=>{const o=new m(t,A.loadProgressCallback,a),s=new i(A,n),r=C((t=>{const A=t;o.showOverlay=A.showOverlay,o.loadedWasmType=A.wasmType,e(o)}),(e=>{o&&"function"==typeof o.delete&&o.delete(),a(e)}));o.postMessage(s,r)}))}))}}var M;!function(e){e[e.BackFacingCamera=0]="BackFacingCamera",e[e.FrontFacingCamera=1]="FrontFacingCamera"}(M||(M={}));const g=["rear","back","rück","arrière","trasera","trás","traseira","posteriore","后面","後面","背面","后置","後置","背置","задней","الخلفية","후","arka","achterzijde","หลัง","baksidan","bagside","sau","bak","tylny","takakamera","belakang","אחורית","πίσω","spate","hátsó","zadní","darrere","zadná","задня","stražnja","belakang","बैक"];function b(e){const t=e.toLowerCase();return g.some((e=>t.includes(e)))}class P{constructor(e,t){this.deviceId=e.deviceId,this.facing=t,this.groupId=e.groupId,this.label=e.label}}function v(){return e(this,void 0,void 0,(function*(){const e=[],t=[];{let A=yield navigator.mediaDevices.enumerateDevices();if(A.filter((e=>"videoinput"===e.kind)).every((e=>""===e.label))){const e=yield navigator.mediaDevices.getUserMedia({video:{facingMode:{ideal:"environment"}},audio:!1});A=yield navigator.mediaDevices.enumerateDevices(),e.getTracks().forEach((e=>e.stop()))}const i=A.filter((e=>"videoinput"===e.kind));for(const A of i)b(A.label)?t.push(new P(A,M.BackFacingCamera)):e.push(new P(A,M.FrontFacingCamera))}return{frontCameras:e,backCameras:t}}))}function H(t,A){return e(this,void 0,void 0,(function*(){const{frontCameras:e,backCameras:i}=yield v();if(e.length>0||i.length>0){let n=i.length>0?i:e;A===M.BackFacingCamera&&i.length>0&&(n=i),A===M.FrontFacingCamera&&e.length>0&&(n=e),n=n.sort(((e,t)=>e.label.localeCompare(t.label)));{let A=0;const a=n.map((e=>{const t=/\b([0-9]+)MP?\b/i.exec(e.label);return null!==t?parseInt(t[1],10):NaN}));if(a.some((e=>isNaN(e)))||(A=a.lastIndexOf(Math.max(...a))),t){let A=null;return A=e.filter((e=>e.deviceId===t))[0],A||(A=i.filter((e=>e.deviceId===t))[0]),A||null}return n[A]}}return null}))}function f(t,A,i=M.BackFacingCamera){return e(this,void 0,void 0,(function*(){const e={audio:!1,video:{width:{min:640,ideal:1920,max:1920},height:{min:480,ideal:1080,max:1080}}};if(""===t.deviceId){e.video.facingMode={ideal:i===M.BackFacingCamera?"environment":"user"}}else e.video.deviceId={exact:t.deviceId};const n=yield navigator.mediaDevices.getUserMedia(e);A.controls=!1,A.srcObject=n;let a=!1;return t.facing===M.FrontFacingCamera&&(A.style.transform="scaleX(-1)",a=!0),a}))}function p(e){e&&null!==e.srcObject&&(e.srcObject.getTracks().forEach((e=>e.stop())),e.srcObject=null)}var B,F,G;let k;!function(e){e[e.RotatedLeft90=0]="RotatedLeft90",e[e.NoRotation=1]="NoRotation",e[e.RotatedRight90=2]="RotatedRight90",e[e.Rotated180=3]="Rotated180"}(B||(B={})),function(e){e[e.Empty=0]="Empty",e[e.Uncertain=1]="Uncertain",e[e.Valid=2]="Valid",e[e.StageValid=3]="StageValid"}(F||(F={})),function(e){e[e.Fail=0]="Fail",e[e.Success=1]="Success",e[e.CameraTooHigh=2]="CameraTooHigh",e[e.FallbackSuccess=3]="FallbackSuccess",e[e.Partial=4]="Partial",e[e.CameraAtAngle=5]="CameraAtAngle",e[e.CameraTooNear=6]="CameraTooNear",e[e.DocumentTooCloseToEdge=7]="DocumentTooCloseToEdge"}(G||(G={}));class w{constructor(e,t,A){this.imageData=e,this.orientation=t,this.videoFrame=A}}function W(e){let t,A,i=!1;if(e instanceof HTMLVideoElement)t=e.videoWidth,A=e.videoHeight,i=!0;else if(e instanceof HTMLImageElement)t=e.naturalWidth,A=e.naturalHeight;else{if(e instanceof SVGImageElement)throw Error("Recognition of SVG elements not supported!");t=e.width,A=e.height}k=k||document.createElement("canvas"),k.width=t,k.height=A;const n=k.getContext("2d");if(!n)throw Error("Could not get canvas 2d context!");n.drawImage(e,0,0,k.width,k.height);const a=n.getImageData(0,0,k.width,k.height);return new w(a,B.NoRotation,i)}var y,K;!function(e){e.MediaDevicesNotSupported="MediaDevicesNotSupported",e.CameraNotFound="CameraNotFound",e.CameraNotAllowed="CameraNotAllowed",e.CameraInUse="CameraInUse",e.CameraNotAvailable="CameraNotAvailable",e.VideoElementNotProvided="VideoElementNotProvided"}(y||(y={}));class V extends Error{constructor(e,...t){super(...t),this.reason=e,this.name="VideoRecognizerError"}}!function(e){e[e.Recognition=0]="Recognition",e[e.RecognitionTest=1]="RecognitionTest",e[e.DetectionTest=2]="DetectionTest"}(K||(K={}));class Y{constructor(e,t,A=!1,i=!1,n=null){this.deviceId=null,this.videoFeed=null,this.cancelled=!1,this.timedOut=!1,this.recognitionPaused=!1,this.recognitionTimeoutMs=2e4,this.timeoutID=0,this.videoRecognitionMode=K.Recognition,this.onScanningDone=null,this.allowManualVideoPlayout=!1,this.cameraFlipped=!1,this.shouldReleaseVideoFeed=!1,this.videoFeed=e,this.recognizerRunner=t,this.cameraFlipped=A,this.allowManualVideoPlayout=i,this.deviceId=n}static createVideoRecognizerFromCameraStream(t,A,i=null,n=M.BackFacingCamera){return e(this,void 0,void 0,(function*(){return new Promise(((a,o)=>e(this,void 0,void 0,(function*(){if(t&&t instanceof Element)if(navigator.mediaDevices&&void 0!==navigator.mediaDevices.getUserMedia)try{const e=yield H(i,n);if(null===e)return void o(new V(y.CameraNotFound));const s=yield f(e,t,n);yield A.setCameraPreviewMirrored(s),a(new Y(t,A,s,!1,e.deviceId))}catch(e){let t=y.CameraInUse;switch(e.name){case"NotFoundError":case"OverconstrainedError":t=y.CameraNotFound;break;case"NotAllowedError":case"SecurityError":t=y.CameraNotAllowed;break;case"AbortError":case"NotReadableError":t=y.CameraNotAvailable;break;case"TypeError":throw e}o(new V(t,e.message))}else o(new V(y.MediaDevicesNotSupported));else{o(new V(y.VideoElementNotProvided,"Video element, i.e. camera feed is not provided!"))}}))))}))}static createVideoRecognizerFromVideoPath(t,A,i){return e(this,void 0,void 0,(function*(){return new Promise((e=>{A.src=t,A.currentTime=0,A.onended=()=>{n.cancelRecognition()};const n=new Y(A,i);e(n)}))}))}flipCamera(){return e(this,void 0,void 0,(function*(){this.videoFeed&&(this.cameraFlipped?(this.videoFeed.style.transform="scaleX(1)",this.cameraFlipped=!1):(this.videoFeed.style.transform="scaleX(-1)",this.cameraFlipped=!0),yield this.recognizerRunner.setCameraPreviewMirrored(this.cameraFlipped))}))}setVideoRecognitionMode(t){return e(this,void 0,void 0,(function*(){this.videoRecognitionMode=t;const e=this.videoRecognitionMode===K.DetectionTest;yield this.recognizerRunner.setDetectionOnlyMode(e)}))}startRecognition(e,t=2e4){return new Promise(((A,i)=>{null!==this.videoFeed?this.videoFeed.paused?(this.cancelled=!1,this.recognitionPaused=!1,this.clearTimeout(),this.recognitionTimeoutMs=t,this.onScanningDone=e,this.recognizerRunner.setClearTimeoutCallback({onClearTimeout:()=>this.clearTimeout()}),this.videoFeed.play().then((()=>this.playPauseEvent().then((()=>A())).catch((e=>i(e)))),(e=>{if(!this.allowManualVideoPlayout)return console.warn("Native error",e),void i(Error("The play() request was interrupted or prevented by browser security rules!"));this.videoFeed&&(this.videoFeed.controls=!0,this.videoFeed.addEventListener("play",(()=>{this.playPauseEvent().then().catch((e=>i(e)))})),this.videoFeed.addEventListener("pause",(()=>{this.playPauseEvent().then().catch((e=>i(e)))})))}))):i(Error("The associated video feed is not paused. Use resumeRecognition instead!")):i(Error("The associated video feed has been released!"))}))}recognize(e=2e4){return new Promise(((t,A)=>{try{this.startRecognition((e=>{this.pauseVideoFeed(),t(e)}),e).then().catch((e=>A(e)))}catch(e){A(e)}}))}cancelRecognition(){this.cancelled=!0}pauseVideoFeed(){this.pauseRecognition(),this.videoFeed&&this.videoFeed.pause()}pauseRecognition(){this.recognitionPaused=!0}resetRecognizers(t){return e(this,void 0,void 0,(function*(){yield this.recognizerRunner.resetRecognizers(t)}))}getRecognizerRunner(){return this.recognizerRunner}resumeRecognition(e){return new Promise(((t,A)=>{if(this.cancelled=!1,this.timedOut=!1,this.recognitionPaused=!1,this.videoFeed&&this.videoFeed.paused){A(Error("Cannot resume recognition while video feed is paused! Use recognize or startRecognition"))}else setTimeout((()=>{e?this.resetRecognizers(!0).then((()=>{this.recognitionLoop().then((()=>t())).catch((e=>A(e)))})).catch((()=>{A(Error("Could not reset recognizers!"))})):this.recognitionLoop().then((()=>t())).catch((e=>A(e)))}),1)}))}releaseVideoFeed(){var e,t;this.videoFeed&&(null===(e=this.videoFeed)||void 0===e?void 0:e.readyState)>=(null===(t=this.videoFeed)||void 0===t?void 0:t.HAVE_CURRENT_DATA)?(this.videoFeed.paused||this.cancelRecognition(),p(this.videoFeed),this.videoFeed=null,this.shouldReleaseVideoFeed=!1):this.shouldReleaseVideoFeed=!0}changeCameraDevice(e){return new Promise(((t,A)=>{null!==this.videoFeed?(this.pauseRecognition(),p(this.videoFeed),f(e,this.videoFeed).then((()=>{null!==this.videoFeed?this.videoFeed.play().then((()=>{this.resumeRecognition(!0),t()}),(e=>{if(this.allowManualVideoPlayout)this.videoFeed?this.videoFeed.controls=!0:A(Error("Cannot change camera device because video feed is missing!"));else{console.warn("Native error",e);A(Error("The play() request was interrupted or prevented by browser security rules!"))}})):A(Error("Cannot change camera device because video feed is missing!"))})).catch((e=>A(e)))):A(Error("Cannot change camera device because video feed is missing!"))}))}playPauseEvent(){return new Promise(((e,t)=>{if(this.videoFeed&&this.videoFeed.paused)return this.cancelRecognition(),void e();this.resumeRecognition(!0).then((()=>e())).catch((e=>t(e)))}))}recognitionLoop(){return new Promise(((e,t)=>{if(!this.videoFeed)return void t(Error("Missing video feed!"));if(this.shouldReleaseVideoFeed&&this.videoFeed.readyState>this.videoFeed.HAVE_CURRENT_DATA)return this.releaseVideoFeed(),void e();const A=W(this.videoFeed);this.recognizerRunner.processImage(A).then((A=>{const i=()=>{this.recognitionPaused?e():setTimeout((()=>{this.recognitionLoop().then((()=>e())).catch((e=>t(e)))}),1)};if(A===F.Valid||this.cancelled||this.timedOut){if(this.videoRecognitionMode!==K.Recognition&&!this.cancelled)return void this.recognizerRunner.resetRecognizers(!0).then((()=>{this.clearTimeout(),i()})).catch((e=>t(e)));this.clearTimeout(),this.onScanningDone&&this.onScanningDone(A)}else{if(A===F.Uncertain)return 0===this.timeoutID&&(this.timeoutID=window.setTimeout((()=>{this.timedOut=!0}),this.recognitionTimeoutMs)),void i();if(A===F.StageValid)return this.clearTimeout(),void i()}i()})).catch((e=>t(e)))}))}clearTimeout(){this.timeoutID>0&&(window.clearTimeout(this.timeoutID),this.timeoutID=0)}}class z{constructor(e){if(this.allowHelloMessage=!0,this.engineLocation="",this.wasmType=null,this.numberOfWorkers=null,this.loadProgressCallback=null,this.wasmModuleName="BlinkIDImageCaptureWasmSDK",!e)throw Error("Missing license key!");this.licenseKey=e}}function j(t){return e(this,void 0,void 0,(function*(){const e=yield(async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,5,3,1,0,1,10,14,1,12,0,65,0,65,0,65,0,252,10,0,0,11])))(),A=yield(async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,10,12,1,10,0,67,0,0,0,0,252,0,26,11])))(),i=yield(async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,10,8,1,6,0,65,0,192,26,11])))(),n=yield(async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,10,1,8,0,65,0,253,15,253,98,11])))(),a=yield(async e=>{try{return"undefined"!=typeof MessageChannel&&(new MessageChannel).port1.postMessage(new SharedArrayBuffer(1)),WebAssembly.validate(e)}catch(e){return!1}})(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,5,4,1,3,1,1,10,11,1,9,0,65,0,254,16,2,0,26,11]));if(!(e&&A&&i&&n))return o.Basic;if(!a)return o.Advanced;try{return new Worker(t+"/Worker.test.js").terminate(),o.AdvancedWithThreads}catch(e){return o.Advanced}}))}function Z(e){switch(e){case o.AdvancedWithThreads:return"advanced-threads";case o.Advanced:return"advanced";case o.Basic:return"basic"}}function J(){try{if("object"==typeof WebAssembly&&"function"==typeof WebAssembly.instantiate){const e=new WebAssembly.Module(Uint8Array.of(0,97,115,109,1,0,0,0));if(e instanceof WebAssembly.Module)return new WebAssembly.Instance(e)instanceof WebAssembly.Instance}}catch(e){return!1}return!1}function x(){const e=navigator.userAgent||navigator.vendor;return!!/(instagram|fbav|linkedinapp|twitter|micromessenger|whatsapp|tiktok)[/\s]?([\w.]*)/i.exec(e)}function Q(){return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)))}function X(t){return e(this,void 0,void 0,(function*(){return new Promise(((e,A)=>{if(!t||"object"!=typeof t)return void A("Missing WASM load settings!");if("string"!=typeof t.licenseKey)return void A("Missing license key!");if(!t.wasmModuleName)return void A("Missing WASM module name!");if("string"!=typeof t.engineLocation)return void A("Setting property 'engineLocation' must be a string!");const i=function(){try{let e=localStorage.getItem("mb-user-id");return null===e&&(e=Q(),localStorage.setItem("mb-user-id",e)),e}catch(e){return Q()}}();try{const n=new Blob([String.raw`!function(){"use strict";
/*! *****************************************************************************
    Copyright (c) Microsoft Corporation.

    Permission to use, copy, modify, and/or distribute this software for any
    purpose with or without fee is hereby granted.

    THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
    REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
    AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
    INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
    LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
    OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
    PERFORMANCE OF THIS SOFTWARE.
    ***************************************************************************** */function e(e,t,s,r){return new(s||(s=Promise))((function(n,i){function o(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?n(e.value):(t=e.value,t instanceof s?t:new s((function(e){e(t)}))).then(o,a)}c((r=r.apply(e,t||[])).next())}))}let t=0;class s{constructor(e){this.action=e,this.messageID=function(){const e=t;return t+=1,e}()}}class r extends s{constructor(e,t){super(r.action),this.wasmModuleName=e.wasmModuleName,this.licenseKey=e.licenseKey,this.userId=t,this.registerLoadCallback=null!==e.loadProgressCallback,this.allowHelloMessage=e.allowHelloMessage,this.engineLocation=e.engineLocation,this.wasmType=e.wasmType,this.numberOfWorkers=e.numberOfWorkers}}var n,i;r.action="init",function(e){e[e.Any=0]="Any",e[e.Recognizer=1]="Recognizer",e[e.RecognizerSettings=2]="RecognizerSettings",e[e.Callback=3]="Callback"}(n||(n={}));class o extends s{constructor(e,t){super(o.action),this.funcName=e,this.params=t}}o.action="invokeFunction";class a extends s{constructor(e,t){super(a.action),this.className=e,this.params=t}}a.action="createNewNativeObject";class c extends s{constructor(e,t,s){super(c.action),this.recognizerHandles=e,this.allowMultipleResults=t,this.registeredMetadataCallbacks=s}}c.action="createRecognizerRunner";class l extends s{constructor(e,t){super(l.action),this.recognizerHandles=e,this.allowMultipleResults=t}}l.action="reconfigureRecognizerRunner";class u extends s{constructor(){super(u.action)}}u.action="deleteRecognizerRunner";class h extends s{constructor(e,t,s){super(h.action),this.objectHandle=e,this.methodName=t,this.params=s}}h.action="invokeObject";class d extends s{constructor(e){super(d.action),this.frame=e}getTransferrables(){return[this.frame.imageData.data.buffer]}}d.action="processImage";class g extends s{constructor(e){super(g.action),this.hardReset=e}}g.action="resetRecognizers";class m extends s{constructor(e){super(m.action),this.registeredMetadataCallbacks=e}}m.action="registerMetadataCallbacks";class f extends s{constructor(e){super(f.action),this.detectionOnlyMode=e}}f.action="setDetectionOnly";class y extends s{constructor(e){super(y.action),this.callbackNonEmpty=e}}y.action="setClearTimeoutCallback";class p extends s{constructor(e){super(p.action),this.cameraPreviewMirrored=e}}p.action="setCameraPreviewMirrored";class b{constructor(e,t,s){this.success=!0,this.error=null,this.messageID=e,this.success=t,this.error=s}}class k{constructor(e,t,s,r){this.success=!0,this.showOverlay=!0,this.messageID=e,this.showOverlay=s,this.wasmType=r}}class R extends b{constructor(e,t){super(e,!0,null),this.result=t}}class w extends b{constructor(e,t){super(e,!0,null),this.objectHandle=t}}class v extends b{constructor(e,t){super(e,!0,null),this.recognitionState=t}}class C{constructor(e){this.isLoadProgressMessage=!0,this.progress=e}}!function(e){e[e.onDebugText=0]="onDebugText",e[e.onDetectionFailed=1]="onDetectionFailed",e[e.onQuadDetection=2]="onQuadDetection",e[e.onPointsDetection=3]="onPointsDetection",e[e.onFirstSideResult=4]="onFirstSideResult",e[e.clearTimeoutCallback=5]="clearTimeoutCallback",e[e.onGlare=6]="onGlare",e[e.recognizerCallback=7]="recognizerCallback"}(i||(i={}));class E{constructor(e,t){this.isCallbackMessage=!0,this.callbackType=e,this.callbackParameters=t}}function z(e,t){return t=t||"",""===(e=e||"")?t:e.endsWith("/")?t.startsWith("/")?e+t.substring(1):e+t:t.startsWith("/")?e+t:e+"/"+t}var M,T,S;function I(t){return e(this,void 0,void 0,(function*(){const e=yield(async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,5,3,1,0,1,10,14,1,12,0,65,0,65,0,65,0,252,10,0,0,11])))(),s=yield(async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,10,12,1,10,0,67,0,0,0,0,252,0,26,11])))(),r=yield(async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,10,8,1,6,0,65,0,192,26,11])))(),n=yield(async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,10,1,8,0,65,0,253,15,253,98,11])))(),i=yield(async e=>{try{return"undefined"!=typeof MessageChannel&&(new MessageChannel).port1.postMessage(new SharedArrayBuffer(1)),WebAssembly.validate(e)}catch(e){return!1}})(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,5,4,1,3,1,1,10,11,1,9,0,65,0,254,16,2,0,26,11]));if(!(e&&s&&r&&n))return M.Basic;if(!i)return M.Advanced;try{return new Worker(t+"/Worker.test.js").terminate(),M.AdvancedWithThreads}catch(e){return M.Advanced}}))}!function(e){e.Basic="BASIC",e.Advanced="ADVANCED",e.AdvancedWithThreads="ADVANCED_WITH_THREADS"}(M||(M={})),function(e){e[e.Invalid=0]="Invalid",e[e.RequiresServerPermission=1]="RequiresServerPermission",e[e.Valid=2]="Valid"}(T||(T={})),function(e){e.LicenseTokenStateInvalid="LICENSE_TOKEN_STATE_INVALID",e.NetworkError="NETWORK_ERROR",e.RemoteLock="REMOTE_LOCK",e.PermissionExpired="PERMISSION_EXPIRED",e.PayloadCorrupted="PAYLOAD_CORRUPTED",e.PayloadSignatureVerificationFailed="PAYLOAD_SIGNATURE_VERIFICATION_FAILED",e.IncorrectTokenState="INCORRECT_TOKEN_STATE"}(S||(S={}));class x{constructor(e,t){this.code="UNLOCK_LICENSE_ERROR",this.message=null,this.type=e,t&&(this.message=t)}}function D(e){return{licenseId:e.licenseId,licensee:e.licensee,packageName:e.packageName,platform:"Browser",sdkName:e.sdkName,sdkVersion:e.sdkVersion}}var P;function O(t,s){return e(this,void 0,void 0,(function*(){try{const e=yield fetch("https://baltazar.microblink.com/api/v1/status/check",{method:"POST",headers:{"Content-Type":"application/json"},cache:"no-cache",body:JSON.stringify(D(t))});if(e.ok){const t=""+(yield e.text());return s.submitServerPermission(t)}return{status:P.NetworkError,lease:0,networkErrorDescription:"Server responded with status "+e.status}}catch(e){return{status:P.NetworkError,lease:0,networkErrorDescription:"Unexpected error: "+JSON.stringify(e)}}}))}function N(e){return e===M.AdvancedWithThreads}!function(e){e[e.Ok=0]="Ok",e[e.NetworkError=1]="NetworkError",e[e.RemoteLock=2]="RemoteLock",e[e.PermissionExpired=3]="PermissionExpired",e[e.PayloadCorrupted=4]="PayloadCorrupted",e[e.PayloadSignatureVerificationFailed=5]="PayloadSignatureVerificationFailed",e[e.IncorrectTokenState=6]="IncorrectTokenState"}(P||(P={}));new class{constructor(){this.context=self,this.wasmModule=null,this.nativeRecognizerRunner=null,this.objects={},this.nextObjectHandle=0,this.metadataCallbacks={},this.clearTimeoutCallback=null,this.context.onmessage=e=>{const t=e.data;switch(t.action){case r.action:this.processInitMessage(t);break;case o.action:this.processInvokeFunction(t);break;case a.action:this.processCreateNewRecognizer(t);break;case h.action:this.processInvokeObject(t);break;case c.action:this.processCreateRecognizerRunner(t);break;case l.action:this.processReconfigureRecognizerRunner(t);break;case u.action:this.processDeleteRecognizerRunner(t);break;case d.action:this.processImage(t);break;case g.action:this.resetRecognizers(t);break;case f.action:this.setDetectionOnly(t);break;case p.action:this.setCameraPreviewMirrored(t);break;case m.action:this.registerMetadataCallbacks(t);break;case y.action:this.registerClearTimeoutCallback(t);break;default:throw Error("Unknown message action: "+JSON.stringify(t.action))}}}getNextObjectHandle(){const e=this.nextObjectHandle;return this.nextObjectHandle=this.nextObjectHandle+1,e}notifyError(e,t){this.context.postMessage(new b(e.messageID,!1,t))}notifySuccess(e){this.context.postMessage(new b(e.messageID,!0,null))}notifyInitSuccess(e,t,s){this.context.postMessage(new k(e.messageID,!0,t,s))}unwrapParameters(e){const t=[];for(const s of e.params){let r=s.parameter;s.type===n.Recognizer?(r=this.objects[r],void 0===r&&this.notifyError(e,"Cannot find object with handle: undefined")):s.type===n.RecognizerSettings&&(r=this.restoreFunctions(r)),t.push(r)}return t}restoreFunctions(e){const t=Object.keys(e);for(const s of t){const t=e[s];"object"==typeof t&&null!==t&&"parameter"in t&&"type"in t&&t.type===n.Callback&&(e[s]=(...e)=>{const s=new E(i.recognizerCallback,[t.parameter].concat(e));this.context.postMessage(s)})}return e}scanForTransferrables(e){if("object"==typeof e){const t=Object.keys(e),s=[];for(const r of t){const t=e[r];t instanceof ImageData?s.push(t.data.buffer):t instanceof Uint8Array?s.push(t.buffer):null!==t&&"object"==typeof t&&s.push(...this.scanForTransferrables(t))}return s}return[]}registerHeartBeat(e){this.unregisterHeartBeat(),this.lease=e;let t=e-Math.floor(Date.now()/1e3);t>120?t-=120:t/=2,this.inFlightHeartBeatTimeoutId=setTimeout((()=>{this.obtainNewServerPermission(!0)}),1e3*t)}unregisterHeartBeat(){this.lease&&delete this.lease,this.inFlightHeartBeatTimeoutId&&(clearTimeout(this.inFlightHeartBeatTimeoutId),delete this.inFlightHeartBeatTimeoutId)}obtainNewServerPermission(t){return e(this,void 0,void 0,(function*(){if(this.wasmModule){const e=this.wasmModule.getActiveLicenseTokenInfo(),s=yield O(e,this.wasmModule);switch(s.status){case P.Ok:case P.RemoteLock:this.registerHeartBeat(s.lease);break;case P.NetworkError:case P.PayloadSignatureVerificationFailed:case P.PayloadCorrupted:t?(console.warn("Problem with obtaining server permission. Will attempt in 10 seconds "+P[s.status]),this.inFlightHeartBeatTimeoutId=setTimeout((()=>{this.obtainNewServerPermission(!1)}),1e4)):console.error("Problem with obtaining server permission. "+P[s.status]);break;case P.IncorrectTokenState:case P.PermissionExpired:console.error("Internal error: "+P[s.status])}return s.status}return console.error("Internal inconsistency! Wasm module not initialized where it's expected to be!"),P.IncorrectTokenState}))}willSoonExpire(){if(this.lease){if(this.wasmModule.getActiveLicenseTokenInfo().unlockResult===T.Valid){const e=Math.floor(Date.now()/1e3);return 30>this.lease-e}return!0}return!1}calculateWasmType(t){return e(this,void 0,void 0,(function*(){return null!==t.wasmType?t.wasmType:yield I(t.engineLocation)}))}calculateEngineLocationPrefix(e,t){const s=z(""===e.engineLocation?self.location.origin:e.engineLocation,function(e){switch(e){case M.AdvancedWithThreads:return"advanced-threads";case M.Advanced:return"advanced";case M.Basic:return"basic"}}(t));return e.allowHelloMessage&&console.log("Engine location prefix is:",s),s}processInitMessage(t){return e(this,void 0,void 0,(function*(){const s=yield this.calculateWasmType(t),r=this.calculateEngineLocationPrefix(t,s);let n={locateFile:e=>z(r,e)};t.registerLoadCallback&&(n=Object.assign(n,{setStatus:e=>{const t=new C(function(e){if("Running..."===e)return 100;if(0===e.length)return 0;const t=/([^(]+)\((\d+(\.\d+)?)\/(\d+)\)/.exec(e);if(t)return 100*parseInt(t[2])/parseInt(t[4]);return NaN}(e));this.context.postMessage(t)}}));try{const i=z(r,t.wasmModuleName+".js");N(s)&&(n=function(e,t,s){return t&&t>0&&(e=Object.assign(e,{allowedThreads:t})),null!==s&&(e=Object.assign(e,{mainScriptUrlOrBlob:s})),e}(n,t.numberOfWorkers,i)),importScripts(i);(0,self[t.wasmModuleName])(n).then((r=>e(this,void 0,void 0,(function*(){N(s)&&(t.allowHelloMessage&&console.log("Waiting for thread workers to boot..."),yield function(t){return e(this,void 0,void 0,(function*(){t.threadWorkersReadyPromise&&(yield t.threadWorkersReadyPromise)}))}(r));const n=yield function(t,s,r,n){return e(this,void 0,void 0,(function*(){const e=n.initializeWithLicenseKey(t,r,s);switch(e.unlockResult){case T.Invalid:return{error:new x(S.LicenseTokenStateInvalid,e.licenseError)};case T.Valid:return{error:null,showOverlay:(i=e.isTrial,o=e.allowRemoveDemoOverlay,a=e.allowRemoveProductionOverlay,!(i&&o||!i&&a))};case T.RequiresServerPermission:{const t=yield O(e,n);switch(t.status){case P.Ok:return{error:null,lease:t.lease};case P.NetworkError:{let e="";return t.networkErrorDescription&&(e=" "+t.networkErrorDescription),{error:new x(S.NetworkError,"There has been a network error while obtaining the server permission!"+e)}}case P.RemoteLock:return{error:new x(S.RemoteLock,"Provided license key has been remotely locked.Please contact support for more information!"),lease:t.lease};case P.PermissionExpired:return{error:new x(S.PermissionExpired,"Internal error (server permission expired)"),lease:t.lease};case P.PayloadCorrupted:return{error:new x(S.PayloadCorrupted,"Server permission payload is corrupted!"),lease:t.lease};case P.PayloadSignatureVerificationFailed:return{error:new x(S.PayloadSignatureVerificationFailed,"Failed to verify server permission's digital signature!"),lease:t.lease};case P.IncorrectTokenState:return{error:new x(S.IncorrectTokenState,"Internal error (Incorrect token state)"),lease:t.lease}}}}var i,o,a}))}(t.licenseKey,t.allowHelloMessage,t.userId,r);null===n.error?(this.wasmModule=r,n.lease?this.registerHeartBeat(n.lease):this.unregisterHeartBeat(),this.notifyInitSuccess(t,!!n.showOverlay,s)):this.notifyError(t,n.error)}))),(e=>{this.notifyError(t,e)}))}catch(e){this.notifyError(t,e)}}))}processInvokeFunction(e){if(null===this.wasmModule)return void this.notifyError(e,"WASM module is not initialized!");const t=e.funcName,s=this.unwrapParameters(e);try{const r=this.wasmModule[t](...s);this.context.postMessage(new R(e.messageID,r))}catch(t){this.notifyError(e,t)}}processCreateNewRecognizer(e){if(null===this.wasmModule)return void this.notifyError(e,"WASM module is not initialized!");const t=e.className,s=this.unwrapParameters(e);try{const r=new this.wasmModule[t](...s),n=this.getNextObjectHandle();this.objects[n]=r,this.context.postMessage(new w(e.messageID,n))}catch(t){this.notifyError(e,t)}}getRecognizers(e){const t=[];for(const s of e){t.push(this.objects[s])}return t}processCreateRecognizerRunner(t){return e(this,void 0,void 0,(function*(){if(null===this.wasmModule)this.notifyError(t,"WASM module is not initialized!");else if(null!==this.nativeRecognizerRunner)this.notifyError(t,"Recognizer runner is already created! Multiple instances are not allowed!");else{this.setupMetadataCallbacks(t.registeredMetadataCallbacks);try{if(this.willSoonExpire()){const e=yield this.obtainNewServerPermission(!1);if(e!==P.Ok){const s=P[e];return void this.notifyError(t,new x(S[s],"Cannot initialize recognizers because of invalid server permission: "+s))}}const e=this.getRecognizers(t.recognizerHandles);this.nativeRecognizerRunner=new this.wasmModule.RecognizerRunner(e,t.allowMultipleResults,this.metadataCallbacks),this.notifySuccess(t)}catch(e){this.notifyError(t,e)}}}))}processReconfigureRecognizerRunner(e){if(null===this.wasmModule)this.notifyError(e,"WASM module is not initialized!");else if(null===this.nativeRecognizerRunner)this.notifyError(e,"Recognizer runner is not created! There is nothing to reconfigure!");else try{const t=this.getRecognizers(e.recognizerHandles);this.nativeRecognizerRunner.reconfigureRecognizers(t,e.allowMultipleResults),this.notifySuccess(e)}catch(t){this.notifyError(e,t)}}processDeleteRecognizerRunner(e){if(null!==this.nativeRecognizerRunner)try{this.nativeRecognizerRunner.delete(),this.nativeRecognizerRunner=null,this.notifySuccess(e)}catch(t){this.notifyError(e,t)}else this.notifyError(e,"Recognizer runner is already deleted!")}wrapFunctions(e,t){if("object"!=typeof e)return e;const s=Object.assign({},e),r=Object.keys(s);for(const e of r){if("function"==typeof s[e]){s[e]={parameter:{recognizerHandle:t,callbackName:e},type:n.Callback}}}return s}processInvokeObject(e){try{const t=e.objectHandle,s=e.methodName,r=this.unwrapParameters(e),n=this.objects[t];if(void 0===n)this.notifyError(e,"Cannot find object with handle: "+t);else{const i=this.wrapFunctions(n[s](...r),t),o=this.scanForTransferrables(i);"delete"===s&&delete this.objects[t],this.context.postMessage(new R(e.messageID,i),o)}}catch(t){this.notifyError(e,t)}}processImage(e){if(null!==this.nativeRecognizerRunner)try{const t=this.nativeRecognizerRunner.processImage(e.frame);this.context.postMessage(new v(e.messageID,t))}catch(t){this.notifyError(e,t)}else this.notifyError(e,"Recognizer runner is not initialized! Cannot process image!")}resetRecognizers(e){if(null!==this.nativeRecognizerRunner)try{this.nativeRecognizerRunner.resetRecognizers(e.hardReset),this.notifySuccess(e)}catch(t){this.notifyError(e,t)}else this.notifyError(e,"Recognizer runner is not initialized! Cannot process image!")}setDetectionOnly(e){if(null!==this.nativeRecognizerRunner)try{this.nativeRecognizerRunner.setDetectionOnlyMode(e.detectionOnlyMode),this.notifySuccess(e)}catch(t){this.notifyError(e,t)}else this.notifyError(e,"Recognizer runner is not initialized! Cannot process image!")}setCameraPreviewMirrored(e){if(null!==this.nativeRecognizerRunner)try{this.nativeRecognizerRunner.setCameraPreviewMirrored(e.cameraPreviewMirrored),this.notifySuccess(e)}catch(t){this.notifyError(e,t)}else this.notifyError(e,"Recognizer runner is not initialized! Cannot process image!")}setupMetadataCallbacks(e){e.onDebugText?this.metadataCallbacks.onDebugText=e=>{const t=new E(i.onDebugText,[e]);this.context.postMessage(t)}:delete this.metadataCallbacks.onDebugText,e.onDetectionFailed?this.metadataCallbacks.onDetectionFailed=()=>{const e=new E(i.onDetectionFailed,[]);this.context.postMessage(e)}:delete this.metadataCallbacks.onDetectionFailed,e.onPointsDetection?this.metadataCallbacks.onPointsDetection=e=>{const t=new E(i.onPointsDetection,[e]);this.context.postMessage(t)}:delete this.metadataCallbacks.onPointsDetection,e.onQuadDetection?this.metadataCallbacks.onQuadDetection=e=>{const t=new E(i.onQuadDetection,[e]);this.context.postMessage(t)}:delete this.metadataCallbacks.onQuadDetection,e.onFirstSideResult?this.metadataCallbacks.onFirstSideResult=()=>{const e=new E(i.onFirstSideResult,[]);this.context.postMessage(e)}:delete this.metadataCallbacks.onFirstSideResult,e.onGlare?this.metadataCallbacks.onGlare=e=>{const t=new E(i.onGlare,[e]);this.context.postMessage(t)}:delete this.metadataCallbacks.onGlare}registerMetadataCallbacks(e){if(null!==this.nativeRecognizerRunner){this.setupMetadataCallbacks(e.registeredMetadataCallbacks);try{this.nativeRecognizerRunner.setJSDelegate(this.metadataCallbacks),this.notifySuccess(e)}catch(t){this.notifyError(e,t)}}else this.notifyError(e,"Recognizer runner is not initialized! Cannot process image!")}registerClearTimeoutCallback(e){if(null!==this.nativeRecognizerRunner){this.clearTimeoutCallback=e.callbackNonEmpty?{onClearTimeout:()=>{const e=new E(i.clearTimeoutCallback,[]);this.context.postMessage(e)}}:null;try{this.nativeRecognizerRunner.setClearTimeoutCallback(this.clearTimeoutCallback),this.notifySuccess(e)}catch(t){this.notifyError(e,t)}}else this.notifyError(e,"Recognizer runner is not initialized! Cannot process image!")}}}();
`],{type:"application/javascript"}),a=URL.createObjectURL(n),o=new Worker(a);m.createWasmWorker(o,t,i).then((t=>{e(t)}),A)}catch(e){A(e)}}))}))}function q(t,A,i=!1,n={}){return e(this,void 0,void 0,(function*(){if("object"!=typeof t)throw Error("SDK is not provided!");if("object"!=typeof A||1>A.length)throw Error("To create RecognizerRunner at least 1 recognizer is required.");return t.mbWasmModule.createRecognizerRunner(A,i,n)}))}class ${constructor(){this.enableMrzId=!0,this.enableMrzPassport=!0,this.enableMrzVisa=!0,this.enablePhotoId=!0,this.enableBarcodeId=!0,this.enableFullDocumentRecognition=!0}}var ee,te,Ae,ie,ne,ae;!function(e){e[e.NONE=0]="NONE",e[e.ALBANIA=1]="ALBANIA",e[e.ALGERIA=2]="ALGERIA",e[e.ARGENTINA=3]="ARGENTINA",e[e.AUSTRALIA=4]="AUSTRALIA",e[e.AUSTRIA=5]="AUSTRIA",e[e.AZERBAIJAN=6]="AZERBAIJAN",e[e.BAHRAIN=7]="BAHRAIN",e[e.BANGLADESH=8]="BANGLADESH",e[e.BELGIUM=9]="BELGIUM",e[e.BOSNIA_AND_HERZEGOVINA=10]="BOSNIA_AND_HERZEGOVINA",e[e.BRUNEI=11]="BRUNEI",e[e.BULGARIA=12]="BULGARIA",e[e.CAMBODIA=13]="CAMBODIA",e[e.CANADA=14]="CANADA",e[e.CHILE=15]="CHILE",e[e.COLOMBIA=16]="COLOMBIA",e[e.COSTA_RICA=17]="COSTA_RICA",e[e.CROATIA=18]="CROATIA",e[e.CYPRUS=19]="CYPRUS",e[e.CZECHIA=20]="CZECHIA",e[e.DENMARK=21]="DENMARK",e[e.DOMINICAN_REPUBLIC=22]="DOMINICAN_REPUBLIC",e[e.EGYPT=23]="EGYPT",e[e.ESTONIA=24]="ESTONIA",e[e.FINLAND=25]="FINLAND",e[e.FRANCE=26]="FRANCE",e[e.GEORGIA=27]="GEORGIA",e[e.GERMANY=28]="GERMANY",e[e.GHANA=29]="GHANA",e[e.GREECE=30]="GREECE",e[e.GUATEMALA=31]="GUATEMALA",e[e.HONG_KONG=32]="HONG_KONG",e[e.HUNGARY=33]="HUNGARY",e[e.INDIA=34]="INDIA",e[e.INDONESIA=35]="INDONESIA",e[e.IRELAND=36]="IRELAND",e[e.ISRAEL=37]="ISRAEL",e[e.ITALY=38]="ITALY",e[e.JORDAN=39]="JORDAN",e[e.KAZAKHSTAN=40]="KAZAKHSTAN",e[e.KENYA=41]="KENYA",e[e.KOSOVO=42]="KOSOVO",e[e.KUWAIT=43]="KUWAIT",e[e.LATVIA=44]="LATVIA",e[e.LITHUANIA=45]="LITHUANIA",e[e.MALAYSIA=46]="MALAYSIA",e[e.MALDIVES=47]="MALDIVES",e[e.MALTA=48]="MALTA",e[e.MAURITIUS=49]="MAURITIUS",e[e.MEXICO=50]="MEXICO",e[e.MOROCCO=51]="MOROCCO",e[e.NETHERLANDS=52]="NETHERLANDS",e[e.NEW_ZEALAND=53]="NEW_ZEALAND",e[e.NIGERIA=54]="NIGERIA",e[e.PAKISTAN=55]="PAKISTAN",e[e.PANAMA=56]="PANAMA",e[e.PARAGUAY=57]="PARAGUAY",e[e.PHILIPPINES=58]="PHILIPPINES",e[e.POLAND=59]="POLAND",e[e.PORTUGAL=60]="PORTUGAL",e[e.PUERTO_RICO=61]="PUERTO_RICO",e[e.QATAR=62]="QATAR",e[e.ROMANIA=63]="ROMANIA",e[e.RUSSIA=64]="RUSSIA",e[e.SAUDI_ARABIA=65]="SAUDI_ARABIA",e[e.SERBIA=66]="SERBIA",e[e.SINGAPORE=67]="SINGAPORE",e[e.SLOVAKIA=68]="SLOVAKIA",e[e.SLOVENIA=69]="SLOVENIA",e[e.SOUTH_AFRICA=70]="SOUTH_AFRICA",e[e.SPAIN=71]="SPAIN",e[e.SWEDEN=72]="SWEDEN",e[e.SWITZERLAND=73]="SWITZERLAND",e[e.TAIWAN=74]="TAIWAN",e[e.THAILAND=75]="THAILAND",e[e.TUNISIA=76]="TUNISIA",e[e.TURKEY=77]="TURKEY",e[e.UAE=78]="UAE",e[e.UGANDA=79]="UGANDA",e[e.UK=80]="UK",e[e.UKRAINE=81]="UKRAINE",e[e.USA=82]="USA",e[e.VIETNAM=83]="VIETNAM",e[e.BRAZIL=84]="BRAZIL",e[e.NORWAY=85]="NORWAY",e[e.OMAN=86]="OMAN",e[e.ECUADOR=87]="ECUADOR",e[e.EL_SALVADOR=88]="EL_SALVADOR",e[e.SRI_LANKA=89]="SRI_LANKA",e[e.PERU=90]="PERU",e[e.URUGUAY=91]="URUGUAY",e[e.BAHAMAS=92]="BAHAMAS",e[e.BERMUDA=93]="BERMUDA",e[e.BOLIVIA=94]="BOLIVIA",e[e.CHINA=95]="CHINA",e[e.EUROPEAN_UNION=96]="EUROPEAN_UNION",e[e.HAITI=97]="HAITI",e[e.HONDURAS=98]="HONDURAS",e[e.ICELAND=99]="ICELAND",e[e.JAPAN=100]="JAPAN",e[e.LUXEMBOURG=101]="LUXEMBOURG",e[e.MONTENEGRO=102]="MONTENEGRO",e[e.NICARAGUA=103]="NICARAGUA",e[e.SOUTH_KOREA=104]="SOUTH_KOREA",e[e.VENEZUELA=105]="VENEZUELA",e[e.AFGHANISTAN=106]="AFGHANISTAN",e[e.ALAND_ISLANDS=107]="ALAND_ISLANDS",e[e.AMERICAN_SAMOA=108]="AMERICAN_SAMOA",e[e.ANDORRA=109]="ANDORRA",e[e.ANGOLA=110]="ANGOLA",e[e.ANGUILLA=111]="ANGUILLA",e[e.ANTARCTICA=112]="ANTARCTICA",e[e.ANTIGUA_AND_BARBUDA=113]="ANTIGUA_AND_BARBUDA",e[e.ARMENIA=114]="ARMENIA",e[e.ARUBA=115]="ARUBA",e[e.BAILIWICK_OF_GUERNSEY=116]="BAILIWICK_OF_GUERNSEY",e[e.BAILIWICK_OF_JERSEY=117]="BAILIWICK_OF_JERSEY",e[e.BARBADOS=118]="BARBADOS",e[e.BELARUS=119]="BELARUS",e[e.BELIZE=120]="BELIZE",e[e.BENIN=121]="BENIN",e[e.BHUTAN=122]="BHUTAN",e[e.BONAIRE_SAINT_EUSTATIUS_AND_SABA=123]="BONAIRE_SAINT_EUSTATIUS_AND_SABA",e[e.BOTSWANA=124]="BOTSWANA",e[e.BOUVET_ISLAND=125]="BOUVET_ISLAND",e[e.BRITISH_INDIAN_OCEAN_TERRITORY=126]="BRITISH_INDIAN_OCEAN_TERRITORY",e[e.BURKINA_FASO=127]="BURKINA_FASO",e[e.BURUNDI=128]="BURUNDI",e[e.CAMEROON=129]="CAMEROON",e[e.CAPE_VERDE=130]="CAPE_VERDE",e[e.CARIBBEAN_NETHERLANDS=131]="CARIBBEAN_NETHERLANDS",e[e.CAYMAN_ISLANDS=132]="CAYMAN_ISLANDS",e[e.CENTRAL_AFRICAN_REPUBLIC=133]="CENTRAL_AFRICAN_REPUBLIC",e[e.CHAD=134]="CHAD",e[e.CHRISTMAS_ISLAND=135]="CHRISTMAS_ISLAND",e[e.COCOS_ISLANDS=136]="COCOS_ISLANDS",e[e.COMOROS=137]="COMOROS",e[e.CONGO=138]="CONGO",e[e.COOK_ISLANDS=139]="COOK_ISLANDS",e[e.CUBA=140]="CUBA",e[e.CURACAO=141]="CURACAO",e[e.DEMOCRATIC_REPUBLIC_OF_THE_CONGO=142]="DEMOCRATIC_REPUBLIC_OF_THE_CONGO",e[e.DJIBOUTI=143]="DJIBOUTI",e[e.DOMINICA=144]="DOMINICA",e[e.EAST_TIMOR=145]="EAST_TIMOR",e[e.EQUATORIAL_GUINEA=146]="EQUATORIAL_GUINEA",e[e.ERITREA=147]="ERITREA",e[e.ETHIOPIA=148]="ETHIOPIA",e[e.FALKLAND_ISLANDS=149]="FALKLAND_ISLANDS",e[e.FAROE_ISLANDS=150]="FAROE_ISLANDS",e[e.FEDERATED_STATES_OF_MICRONESIA=151]="FEDERATED_STATES_OF_MICRONESIA",e[e.FIJI=152]="FIJI",e[e.FRENCH_GUIANA=153]="FRENCH_GUIANA",e[e.FRENCH_POLYNESIA=154]="FRENCH_POLYNESIA",e[e.FRENCH_SOUTHERN_TERRITORIES=155]="FRENCH_SOUTHERN_TERRITORIES",e[e.GABON=156]="GABON",e[e.GAMBIA=157]="GAMBIA",e[e.GIBRALTAR=158]="GIBRALTAR",e[e.GREENLAND=159]="GREENLAND",e[e.GRENADA=160]="GRENADA",e[e.GUADELOUPE=161]="GUADELOUPE",e[e.GUAM=162]="GUAM",e[e.GUINEA=163]="GUINEA",e[e.GUINEA_BISSAU=164]="GUINEA_BISSAU",e[e.GUYANA=165]="GUYANA",e[e.HEARD_ISLAND_AND_MCDONALD_ISLANDS=166]="HEARD_ISLAND_AND_MCDONALD_ISLANDS",e[e.IRAN=167]="IRAN",e[e.IRAQ=168]="IRAQ",e[e.ISLE_OF_MAN=169]="ISLE_OF_MAN",e[e.IVORY_COAST=170]="IVORY_COAST",e[e.JAMAICA=171]="JAMAICA",e[e.KIRIBATI=172]="KIRIBATI",e[e.KYRGYZSTAN=173]="KYRGYZSTAN",e[e.LAOS=174]="LAOS",e[e.LEBANON=175]="LEBANON",e[e.LESOTHO=176]="LESOTHO",e[e.LIBERIA=177]="LIBERIA",e[e.LIBYA=178]="LIBYA",e[e.LIECHTENSTEIN=179]="LIECHTENSTEIN",e[e.MACAU=180]="MACAU",e[e.MADAGASCAR=181]="MADAGASCAR",e[e.MALAWI=182]="MALAWI",e[e.MALI=183]="MALI",e[e.MARSHALL_ISLANDS=184]="MARSHALL_ISLANDS",e[e.MARTINIQUE=185]="MARTINIQUE",e[e.MAURITANIA=186]="MAURITANIA",e[e.MAYOTTE=187]="MAYOTTE",e[e.MOLDOVA=188]="MOLDOVA",e[e.MONACO=189]="MONACO",e[e.MONGOLIA=190]="MONGOLIA",e[e.MONTSERRAT=191]="MONTSERRAT",e[e.MOZAMBIQUE=192]="MOZAMBIQUE",e[e.MYANMAR=193]="MYANMAR",e[e.NAMIBIA=194]="NAMIBIA",e[e.NAURU=195]="NAURU",e[e.NEPAL=196]="NEPAL",e[e.NEW_CALEDONIA=197]="NEW_CALEDONIA",e[e.NIGER=198]="NIGER",e[e.NIUE=199]="NIUE",e[e.NORFOLK_ISLAND=200]="NORFOLK_ISLAND",e[e.NORTHERN_CYPRUS=201]="NORTHERN_CYPRUS",e[e.NORTHERN_MARIANA_ISLANDS=202]="NORTHERN_MARIANA_ISLANDS",e[e.NORTH_KOREA=203]="NORTH_KOREA",e[e.NORTH_MACEDONIA=204]="NORTH_MACEDONIA",e[e.PALAU=205]="PALAU",e[e.PALESTINE=206]="PALESTINE",e[e.PAPUA_NEW_GUINEA=207]="PAPUA_NEW_GUINEA",e[e.PITCAIRN=208]="PITCAIRN",e[e.REUNION=209]="REUNION",e[e.RWANDA=210]="RWANDA",e[e.SAINT_BARTHELEMY=211]="SAINT_BARTHELEMY",e[e.SAINT_HELENA_ASCENSION_AND_TRISTIAN_DA_CUNHA=212]="SAINT_HELENA_ASCENSION_AND_TRISTIAN_DA_CUNHA",e[e.SAINT_KITTS_AND_NEVIS=213]="SAINT_KITTS_AND_NEVIS",e[e.SAINT_LUCIA=214]="SAINT_LUCIA",e[e.SAINT_MARTIN=215]="SAINT_MARTIN",e[e.SAINT_PIERRE_AND_MIQUELON=216]="SAINT_PIERRE_AND_MIQUELON",e[e.SAINT_VINCENT_AND_THE_GRENADINES=217]="SAINT_VINCENT_AND_THE_GRENADINES",e[e.SAMOA=218]="SAMOA",e[e.SAN_MARINO=219]="SAN_MARINO",e[e.SAO_TOME_AND_PRINCIPE=220]="SAO_TOME_AND_PRINCIPE",e[e.SENEGAL=221]="SENEGAL",e[e.SEYCHELLES=222]="SEYCHELLES",e[e.SIERRA_LEONE=223]="SIERRA_LEONE",e[e.SINT_MAARTEN=224]="SINT_MAARTEN",e[e.SOLOMON_ISLANDS=225]="SOLOMON_ISLANDS",e[e.SOMALIA=226]="SOMALIA",e[e.SOUTH_GEORGIA_AND_THE_SOUTH_SANDWICH_ISLANDS=227]="SOUTH_GEORGIA_AND_THE_SOUTH_SANDWICH_ISLANDS",e[e.SOUTH_SUDAN=228]="SOUTH_SUDAN",e[e.SUDAN=229]="SUDAN",e[e.SURINAME=230]="SURINAME",e[e.SVALBARD_AND_JAN_MAYEN=231]="SVALBARD_AND_JAN_MAYEN",e[e.ESWATINI=232]="ESWATINI",e[e.SYRIA=233]="SYRIA",e[e.TAJIKISTAN=234]="TAJIKISTAN",e[e.TANZANIA=235]="TANZANIA",e[e.TOGO=236]="TOGO",e[e.TOKELAU=237]="TOKELAU",e[e.TONGA=238]="TONGA",e[e.TRINIDAD_AND_TOBAGO=239]="TRINIDAD_AND_TOBAGO",e[e.TURKMENISTAN=240]="TURKMENISTAN",e[e.TURKS_AND_CAICOS_ISLANDS=241]="TURKS_AND_CAICOS_ISLANDS",e[e.TUVALU=242]="TUVALU",e[e.UNITED_STATES_MINOR_OUTLYING_ISLANDS=243]="UNITED_STATES_MINOR_OUTLYING_ISLANDS",e[e.UZBEKISTAN=244]="UZBEKISTAN",e[e.VANUATU=245]="VANUATU",e[e.VATICAN_CITY=246]="VATICAN_CITY",e[e.VIRGIN_ISLANDS_BRITISH=247]="VIRGIN_ISLANDS_BRITISH",e[e.VIRGIN_ISLANDS_US=248]="VIRGIN_ISLANDS_US",e[e.WALLIS_AND_FUTUNA=249]="WALLIS_AND_FUTUNA",e[e.WESTERN_SAHARA=250]="WESTERN_SAHARA",e[e.YEMEN=251]="YEMEN",e[e.YUGOSLAVIA=252]="YUGOSLAVIA",e[e.ZAMBIA=253]="ZAMBIA",e[e.ZIMBABWE=254]="ZIMBABWE",e[e.COUNT=255]="COUNT"}(ee||(ee={})),function(e){e[e.NONE=0]="NONE",e[e.ALABAMA=1]="ALABAMA",e[e.ALASKA=2]="ALASKA",e[e.ALBERTA=3]="ALBERTA",e[e.ARIZONA=4]="ARIZONA",e[e.ARKANSAS=5]="ARKANSAS",e[e.AUSTRALIAN_CAPITAL_TERRITORY=6]="AUSTRALIAN_CAPITAL_TERRITORY",e[e.BRITISH_COLUMBIA=7]="BRITISH_COLUMBIA",e[e.CALIFORNIA=8]="CALIFORNIA",e[e.COLORADO=9]="COLORADO",e[e.CONNECTICUT=10]="CONNECTICUT",e[e.DELAWARE=11]="DELAWARE",e[e.DISTRICT_OF_COLUMBIA=12]="DISTRICT_OF_COLUMBIA",e[e.FLORIDA=13]="FLORIDA",e[e.GEORGIA=14]="GEORGIA",e[e.HAWAII=15]="HAWAII",e[e.IDAHO=16]="IDAHO",e[e.ILLINOIS=17]="ILLINOIS",e[e.INDIANA=18]="INDIANA",e[e.IOWA=19]="IOWA",e[e.KANSAS=20]="KANSAS",e[e.KENTUCKY=21]="KENTUCKY",e[e.LOUISIANA=22]="LOUISIANA",e[e.MAINE=23]="MAINE",e[e.MANITOBA=24]="MANITOBA",e[e.MARYLAND=25]="MARYLAND",e[e.MASSACHUSETTS=26]="MASSACHUSETTS",e[e.MICHIGAN=27]="MICHIGAN",e[e.MINNESOTA=28]="MINNESOTA",e[e.MISSISSIPPI=29]="MISSISSIPPI",e[e.MISSOURI=30]="MISSOURI",e[e.MONTANA=31]="MONTANA",e[e.NEBRASKA=32]="NEBRASKA",e[e.NEVADA=33]="NEVADA",e[e.NEW_BRUNSWICK=34]="NEW_BRUNSWICK",e[e.NEW_HAMPSHIRE=35]="NEW_HAMPSHIRE",e[e.NEW_JERSEY=36]="NEW_JERSEY",e[e.NEW_MEXICO=37]="NEW_MEXICO",e[e.NEW_SOUTH_WALES=38]="NEW_SOUTH_WALES",e[e.NEW_YORK=39]="NEW_YORK",e[e.NORTHERN_TERRITORY=40]="NORTHERN_TERRITORY",e[e.NORTH_CAROLINA=41]="NORTH_CAROLINA",e[e.NORTH_DAKOTA=42]="NORTH_DAKOTA",e[e.NOVA_SCOTIA=43]="NOVA_SCOTIA",e[e.OHIO=44]="OHIO",e[e.OKLAHOMA=45]="OKLAHOMA",e[e.ONTARIO=46]="ONTARIO",e[e.OREGON=47]="OREGON",e[e.PENNSYLVANIA=48]="PENNSYLVANIA",e[e.QUEBEC=49]="QUEBEC",e[e.QUEENSLAND=50]="QUEENSLAND",e[e.RHODE_ISLAND=51]="RHODE_ISLAND",e[e.SASKATCHEWAN=52]="SASKATCHEWAN",e[e.SOUTH_AUSTRALIA=53]="SOUTH_AUSTRALIA",e[e.SOUTH_CAROLINA=54]="SOUTH_CAROLINA",e[e.SOUTH_DAKOTA=55]="SOUTH_DAKOTA",e[e.TASMANIA=56]="TASMANIA",e[e.TENNESSEE=57]="TENNESSEE",e[e.TEXAS=58]="TEXAS",e[e.UTAH=59]="UTAH",e[e.VERMONT=60]="VERMONT",e[e.VICTORIA=61]="VICTORIA",e[e.VIRGINIA=62]="VIRGINIA",e[e.WASHINGTON=63]="WASHINGTON",e[e.WESTERN_AUSTRALIA=64]="WESTERN_AUSTRALIA",e[e.WEST_VIRGINIA=65]="WEST_VIRGINIA",e[e.WISCONSIN=66]="WISCONSIN",e[e.WYOMING=67]="WYOMING",e[e.YUKON=68]="YUKON",e[e.CIUDAD_DE_MEXICO=69]="CIUDAD_DE_MEXICO",e[e.JALISCO=70]="JALISCO",e[e.NEWFOUNDLAND_AND_LABRADOR=71]="NEWFOUNDLAND_AND_LABRADOR",e[e.NUEVO_LEON=72]="NUEVO_LEON",e[e.BAJA_CALIFORNIA=73]="BAJA_CALIFORNIA",e[e.CHIHUAHUA=74]="CHIHUAHUA",e[e.GUANAJUATO=75]="GUANAJUATO",e[e.GUERRERO=76]="GUERRERO",e[e.MEXICO=77]="MEXICO",e[e.MICHOACAN=78]="MICHOACAN",e[e.NEW_YORK_CITY=79]="NEW_YORK_CITY",e[e.TAMAULIPAS=80]="TAMAULIPAS",e[e.VERACRUZ=81]="VERACRUZ",e[e.CHIAPAS=82]="CHIAPAS",e[e.COAHUILA=83]="COAHUILA",e[e.DURANGO=84]="DURANGO",e[e.GUERRERO_COCULA=85]="GUERRERO_COCULA",e[e.GUERRERO_JUCHITAN=86]="GUERRERO_JUCHITAN",e[e.GUERRERO_TEPECOACUILCO=87]="GUERRERO_TEPECOACUILCO",e[e.GUERRERO_TLACOAPA=88]="GUERRERO_TLACOAPA",e[e.GUJARAT=89]="GUJARAT",e[e.HIDALGO=90]="HIDALGO",e[e.KARNATAKA=91]="KARNATAKA",e[e.KERALA=92]="KERALA",e[e.KHYBER_PAKHTUNKHWA=93]="KHYBER_PAKHTUNKHWA",e[e.MADHYA_PRADESH=94]="MADHYA_PRADESH",e[e.MAHARASHTRA=95]="MAHARASHTRA",e[e.MORELOS=96]="MORELOS",e[e.NAYARIT=97]="NAYARIT",e[e.OAXACA=98]="OAXACA",e[e.PUEBLA=99]="PUEBLA",e[e.PUNJAB=100]="PUNJAB",e[e.QUERETARO=101]="QUERETARO",e[e.SAN_LUIS_POTOSI=102]="SAN_LUIS_POTOSI",e[e.SINALOA=103]="SINALOA",e[e.SONORA=104]="SONORA",e[e.TABASCO=105]="TABASCO",e[e.TAMIL_NADU=106]="TAMIL_NADU",e[e.YUCATAN=107]="YUCATAN",e[e.ZACATECAS=108]="ZACATECAS",e[e.AGUASCALIENTES=109]="AGUASCALIENTES",e[e.BAJA_CALIFORNIA_SUR=110]="BAJA_CALIFORNIA_SUR",e[e.CAMPECHE=111]="CAMPECHE",e[e.COLIMA=112]="COLIMA",e[e.QUINTANA_ROO_BENITO_JUAREZ=113]="QUINTANA_ROO_BENITO_JUAREZ",e[e.COUNT=114]="COUNT"}(te||(te={})),function(e){e[e.NONE=0]="NONE",e[e.CONSULAR_ID=1]="CONSULAR_ID",e[e.DL=2]="DL",e[e.DL_PUBLIC_SERVICES_CARD=3]="DL_PUBLIC_SERVICES_CARD",e[e.EMPLOYMENT_PASS=4]="EMPLOYMENT_PASS",e[e.FIN_CARD=5]="FIN_CARD",e[e.ID=6]="ID",e[e.MULTIPURPOSE_ID=7]="MULTIPURPOSE_ID",e[e.MyKad=8]="MyKad",e[e.MyKid=9]="MyKid",e[e.MyPR=10]="MyPR",e[e.MyTentera=11]="MyTentera",e[e.PAN_CARD=12]="PAN_CARD",e[e.PROFESSIONAL_ID=13]="PROFESSIONAL_ID",e[e.PUBLIC_SERVICES_CARD=14]="PUBLIC_SERVICES_CARD",e[e.RESIDENCE_PERMIT=15]="RESIDENCE_PERMIT",e[e.RESIDENT_ID=16]="RESIDENT_ID",e[e.TEMPORARY_RESIDENCE_PERMIT=17]="TEMPORARY_RESIDENCE_PERMIT",e[e.VOTER_ID=18]="VOTER_ID",e[e.WORK_PERMIT=19]="WORK_PERMIT",e[e.iKAD=20]="iKAD",e[e.MILITARY_ID=21]="MILITARY_ID",e[e.MyKAS=22]="MyKAS",e[e.SOCIAL_SECURITY_CARD=23]="SOCIAL_SECURITY_CARD",e[e.HEALTH_INSURANCE_CARD=24]="HEALTH_INSURANCE_CARD",e[e.PASSPORT=25]="PASSPORT",e[e.S_PASS=26]="S_PASS",e[e.ADDRESS_CARD=27]="ADDRESS_CARD",e[e.ALIEN_ID=28]="ALIEN_ID",e[e.ALIEN_PASSPORT=29]="ALIEN_PASSPORT",e[e.GREEN_CARD=30]="GREEN_CARD",e[e.MINORS_ID=31]="MINORS_ID",e[e.POSTAL_ID=32]="POSTAL_ID",e[e.PROFESSIONAL_DL=33]="PROFESSIONAL_DL",e[e.TAX_ID=34]="TAX_ID",e[e.WEAPON_PERMIT=35]="WEAPON_PERMIT",e[e.VISA=36]="VISA",e[e.BORDER_CROSSING_CARD=37]="BORDER_CROSSING_CARD",e[e.DRIVER_CARD=38]="DRIVER_CARD",e[e.GLOBAL_ENTRY_CARD=39]="GLOBAL_ENTRY_CARD",e[e.MyPolis=40]="MyPolis",e[e.NEXUS_CARD=41]="NEXUS_CARD",e[e.PASSPORT_CARD=42]="PASSPORT_CARD",e[e.PROOF_OF_AGE_CARD=43]="PROOF_OF_AGE_CARD",e[e.REFUGEE_ID=44]="REFUGEE_ID",e[e.TRIBAL_ID=45]="TRIBAL_ID",e[e.VETERAN_ID=46]="VETERAN_ID",e[e.CITIZENSHIP_CERTIFICATE=47]="CITIZENSHIP_CERTIFICATE",e[e.COUNT=48]="COUNT"}(Ae||(Ae={})),function(e){e[e.NotAvailable=0]="NotAvailable",e[e.BlackAndWhite=1]="BlackAndWhite",e[e.Color=2]="Color"}(ie||(ie={})),function(e){e[e.NotAvailable=0]="NotAvailable",e[e.NotDetected=1]="NotDetected",e[e.Detected=2]="Detected"}(ne||(ne={})),function(e){e[e.Success=0]="Success",e[e.DetectionFailed=1]="DetectionFailed",e[e.ImagePreprocessingFailed=2]="ImagePreprocessingFailed",e[e.StabilityTestFailed=3]="StabilityTestFailed",e[e.ScanningWrongSide=4]="ScanningWrongSide",e[e.FieldIdentificationFailed=5]="FieldIdentificationFailed",e[e.MandatoryFieldMissing=6]="MandatoryFieldMissing",e[e.InvalidCharactersFound=7]="InvalidCharactersFound",e[e.ImageReturnFailed=8]="ImageReturnFailed",e[e.BarcodeRecognitionFailed=9]="BarcodeRecognitionFailed",e[e.MrzParsingFailed=10]="MrzParsingFailed",e[e.ClassFiltered=11]="ClassFiltered",e[e.UnsupportedClass=12]="UnsupportedClass",e[e.UnsupportedByLicense=13]="UnsupportedByLicense",e[e.AwaitingOtherSide=14]="AwaitingOtherSide",e[e.Count=15]="Count"}(ae||(ae={}));class oe{constructor(){this.captureBothDocumentSides=!1,this.barcodeCaptureStartedCallback=null,this.scanCroppedDocumentImage=!1,this.captureModeFilter=new $}}function se(t){return e(this,void 0,void 0,(function*(){return t.mbWasmModule.newRecognizer("BlinkIdImageCaptureRecognizer")}))}function re(t,A){return e(this,void 0,void 0,(function*(){const e=yield t.mbWasmModule.newRecognizer("SuccessFrameGrabberRecognizer",A);return e.wrappedRecognizer=A,e}))}export{oe as BlinkIdImageCaptureRecognizerSettings,w as CapturedFrame,ee as Country,G as DetectionStatus,ie as DocumentImageColorStatus,Ae as DocumentType,ne as ImageAnalysisDetectionStatus,B as ImageOrientation,y as NotSupportedReason,M as PreferredCameraType,ae as ProcessingStatus,$ as RecognitionModeFilter,F as RecognizerResultState,te as Region,P as SelectedCamera,K as VideoRecognitionMode,Y as VideoRecognizer,V as VideoRecognizerError,z as WasmSDKLoadSettings,o as WasmType,f as bindCameraToVideoFeed,W as captureFrame,p as clearVideoFeed,se as createBlinkIdImageCaptureRecognizer,q as createRecognizerRunner,re as createSuccessFrameGrabberRecognizer,j as detectWasmType,v as getCameraDevices,J as isBrowserSupported,x as isInAppBrowser,X as loadWasmModule,H as selectCamera,Z as wasmFolder};
