@scandit/web-datacapture-id 7.6.1 → 7.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (20) hide show
  1. package/build/js/index.js +2 -2
  2. package/package.json +2 -2
  3. package/sdc-lib/scandit-datacapture-sdk-id-pthreads.js +1 -1
  4. package/sdc-lib/scandit-datacapture-sdk-id-pthreads.wasm +0 -0
  5. package/sdc-lib/scandit-datacapture-sdk-id-simd-pthreads.js +1 -1
  6. package/sdc-lib/scandit-datacapture-sdk-id-simd-pthreads.wasm +0 -0
  7. package/sdc-lib/scandit-datacapture-sdk-id-simd.js +1 -1
  8. package/sdc-lib/scandit-datacapture-sdk-id-simd.wasm +0 -0
  9. package/sdc-lib/scandit-datacapture-sdk-id.js +1 -1
  10. package/sdc-lib/scandit-datacapture-sdk-id.wasm +0 -0
  11. /package/sdc-lib/idcapture/{7.6.1 → 7.6.2}/resources/centaurus-worker.js +0 -0
  12. /package/sdc-lib/idcapture/{7.6.1 → 7.6.2}/resources/lightweight/advanced/Centaurus.data +0 -0
  13. /package/sdc-lib/idcapture/{7.6.1 → 7.6.2}/resources/lightweight/advanced/Centaurus.js +0 -0
  14. /package/sdc-lib/idcapture/{7.6.1 → 7.6.2}/resources/lightweight/advanced/Centaurus.wasm +0 -0
  15. /package/sdc-lib/idcapture/{7.6.1 → 7.6.2}/resources/lightweight/advanced-threads/Centaurus.data +0 -0
  16. /package/sdc-lib/idcapture/{7.6.1 → 7.6.2}/resources/lightweight/advanced-threads/Centaurus.js +0 -0
  17. /package/sdc-lib/idcapture/{7.6.1 → 7.6.2}/resources/lightweight/advanced-threads/Centaurus.wasm +0 -0
  18. /package/sdc-lib/idcapture/{7.6.1 → 7.6.2}/resources/lightweight/basic/Centaurus.data +0 -0
  19. /package/sdc-lib/idcapture/{7.6.1 → 7.6.2}/resources/lightweight/basic/Centaurus.js +0 -0
  20. /package/sdc-lib/idcapture/{7.6.1 → 7.6.2}/resources/lightweight/basic/Centaurus.wasm +0 -0
package/build/js/index.js CHANGED
@@ -1,8 +1,8 @@
1
- import {Color,CameraSettings,Feedback,Sound,Logger,Quadrilateral,DataCaptureError,Brush,Localization,OverrideState,DataCaptureContext,BrowserHelper,DataCaptureLoader,Point,assertUnreachable}from'@scandit/web-datacapture-core';import {isObject}from'@scandit/web-datacapture-core/build/js/private/utils/isObject.js';import {ViewClassNames}from'@scandit/web-datacapture-core/build/js/private/ViewClassNames.js';import {ShutterButton}from'@scandit/web-datacapture-core/build/js/private/ui/atoms/ShutterButton.js';var d={"scandit-datacapture-sdk-id-pthreads.wasm":{bytes:8757110},"scandit-datacapture-sdk-id-simd-pthreads.wasm":{bytes:8690889},"scandit-datacapture-sdk-id-simd.wasm":{bytes:8581830},"scandit-datacapture-sdk-id.wasm":{bytes:8648534}};var Fe=(s=>(s.Undefined="Undefined",s.RecoveredAfterFailure="RecoveredAfterFailure",s.InvalidLicenseKeyForVIZProcessing="InvalidLicenseKeyForVIZProcessing",s.InvalidSettingsForVIZProcessing="InvalidSettingsForVIZProcessing",s.InvalidLicenseKeyForParser="InvalidLicenseKeyForParser",s))(Fe||{}),v=class a extends Error{constructor(){super(...arguments);this._type="Undefined";this._message="";}get type(){return this._type}get message(){return this._message}static create(t){let r=new a;return t&&(r.name=t.type,r._type=t.type,r._message=t.message),r}static fromJSON(t){let r=new a;return r._type=t.type,r._message=t.message,r}};var ie=class{constructor(e){this.idCaptureWorkerManager=e;}get workerCommand(){return this.idCaptureWorkerManager.workerCommand.bind(this.idCaptureWorkerManager)}async getLicenseText(){return (await this.workerCommand("getIdOpenSourceSoftwareLicenseInfo",{})).licenseText}};var nt={"id.idCaptureOverlay.scanFrontSideHint":"","id.idCaptureOverlay.scanBackSideHint":"","id.idCaptureOverlay.moveCloseTextHint":"","id.idCaptureOverlay.moveFurtherAwayTextHint":"","id.idCaptureOverlay.tapShutterToScan":"","id.idCaptureOverlay.lookingForDocument":"","id.idCaptureOverlay.holdStill":""};function st(a){let e=URL.createObjectURL(new Blob(['"use strict";(()=>{var fe=(r,e)=>()=>(r&&(e=r(r=0)),e);var g,o=fe(()=>{g={"scandit-datacapture-sdk-id-pthreads.wasm":{bytes:8757110},"scandit-datacapture-sdk-id-simd-pthreads.wasm":{bytes:8690889},"scandit-datacapture-sdk-id-simd.wasm":{bytes:8581830},"scandit-datacapture-sdk-id.wasm":{bytes:8648534}}});o();o();o();o();var n;(r=>{(p=>(p.Debug="debug",p.Info="info",p.Warn="warn",p.Error="error",p.Quiet="quiet"))(r.Level||(r.Level={}));let e=new Map([["debug",1],["info",2],["warn",3],["error",4],["quiet",5]]),a="debug";function t(p){a=p}r.setLevel=t;function s(p,...h){if(!(e.get(a)>e.get(p)))switch(p){case"debug":{console.debug(...h);break}case"info":{console.log(...h);break}case"warn":{console.warn(...h);break}case"error":{console.error(...h);break}}}r.log=s;function i(...p){s("warn",...p)}r.warn=i;function d(...p){s("debug",...p)}r.debug=d;function l(...p){s("info",...p)}r.info=l;function C(...p){s("error",...p)}r.error=C})(n||(n={}));o();var Ie=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])),Se=()=>(async r=>{try{return typeof MessageChannel<"u"&&new MessageChannel().port1.postMessage(new SharedArrayBuffer(1)),WebAssembly.validate(r)}catch{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]));function be(){return typeof crossOriginIsolated>"u"?!1:crossOriginIsolated}function De(){try{return new WebAssembly.Memory({initial:1,maximum:1,shared:!0}).buffer.constructor.name==="SharedArrayBuffer"}catch{return!1}}async function G(){return Ie()}async function we(){if(!await Se())return!1;let r=null;try{r=new Worker(URL.createObjectURL(new Blob([\'postMessage("Worker" in self);\'],{type:"text/javascript"})),{name:"nestedWorkerTest"})}catch{return!1}return new Promise(e=>{if(r==null){e(!1);return}r.onmessage=a=>{r==null||r.terminate(),e(a.data)}})}async function K(){let r=await we();return be()&&De()&&r}o();function q(){if(typeof self=="object")return!1;let r=(()=>{if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;if(typeof self<"u")return self;throw new Error("No global object found")})();return Object.defineProperty(r,"globalThis",{value:r,writable:!0,configurable:!0}),!0}o();o();o();o();var A=class Z extends Error{constructor(e){super(e.message),Object.setPrototypeOf(this,Z.prototype),this.name=e.name}toString(){return`${this.name}: ${this.message}`}};var O=Promise.resolve(),B=!1,T=!1,M,H={writableDataPath:""};async function X(r){if(M==null)return;B=!0;let e=new Promise((a,t)=>{setTimeout(()=>{t(new A({name:"BlockedIndexedDB",message:"IndexedDB database is blocked"}))},1500)});try{await Promise.race([new Promise((a,t)=>{M==null||M(r,s=>{if(s!=null){t(s);return}a()})}),e])}finally{B=!1}}async function Y(r){return T||(B?(T=!0,O=O.then(async()=>(T=!1,X(r)))):O=X(r)),O}async function Q(r){H=r,M=FS.syncfs,FS.syncfs=(e,a)=>{let t=a,s=()=>{t()},i=d=>{t(d)};Y(e).then(s).catch(i)};try{FS.mkdir(H.writableDataPath)}catch(e){if(e.code!=="EEXIST")throw M=void 0,e}return FS.mount(IDBFS,{},H.writableDataPath),Y(!0)}o();o();o();var ee={};function Me(r){return[...new Uint8Array(r)].map(e=>{let a=e.toString(16);return a.length===1?`0${a}`:a}).join("")}async function*xe(r){let e=r.getReader();try{for(;;){let{done:a,value:t}=await e.read();if(a)return;yield t}}finally{e.releaseLock()}}async function ve(r){let e=[],a=0,t=0;for await(let i of xe(r))e.push(i),a+=i.length;let s=new Uint8Array(a);for(let i of e)s.set(i,t),t+=i.length;return s.buffer}var Re=(r=>(r.VALID="VALID",r.INVALID="INVALID",r.NOT_VERIFIABLE="NOT_VERIFIABLE",r))(Re||{});async function Le(r,e,a){if(typeof crypto.subtle.digest!="function")return n.log(n.Level.Warn,`Insecure context (see https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts): The hash of the Scandit Data Capture library WASM file found at ${a} could not be verified`),"NOT_VERIFIABLE";try{let t=r instanceof Promise?await r:r,s=await crypto.subtle.digest("SHA-256",t),i=Me(s);return e==null?(n.log(n.Level.Warn,"The library hash is not defined or empty, cannot correctly verify integrity."),"NOT_VERIFIABLE"):i===e?(n.log(n.Level.Debug,`Data Capture library WASM integrity found at ${a} has been verified correctly.`),"VALID"):(n.log(n.Level.Warn,`The Scandit Data Capture library WASM file found at ${a} seems invalid: expected file hash doesn\'t match (received: ${i}, expected: ${e}). Please ensure the correct Scandit Data Capture file (with correct version) is retrieved.`),"INVALID")}catch(t){return n.log(n.Level.Warn,"Wasm response could not be verified",t),"NOT_VERIFIABLE"}}var V=new Map([["br",4.4],["gzip",2.9],["none",1]]);function ke(r){var e;let a="content-encoding";if(r==null||r.get(a)==null)return V.get("none");let t=new Set(((e=r.get(a))!=null?e:"").split(",").map(s=>s.trim()));for(let[s,i]of V)if(t.has(s))return i;return V.get("none")}function Ae(r){var e,a;if(r==null)return 0;let t=(e=ke(r))!=null?e:1,s=Number.parseInt((a=r.get("content-length"))!=null?a:"0",10);return Number.isNaN(s)?0:Math.floor(s*t*100)/100}function Oe(r){let{pathname:e}=new URL(r);for(let[a,t]of Object.entries(ee))if(e.endsWith(a))return t.bytes;return 0}function te(r){ee=r}var Ee=(r,e)=>{let a=Ae(e);return a===0?Oe(r):a};function Pe(r,e,a,{onProgress:t,onError:s,onComplete:i}){if(!e.body)return[e];let d=Ee(r,e.headers),l=0,C=0;if(typeof TransformStream>"u")return n.warn("TransformStream is not supported in this environment. Progress tracking will be disabled."),[e];let[p,h]=a?e.body.tee():[e.body],c=p.pipeThrough(new TransformStream({async transform(m,y){try{l+=m.length,C=Number((l/d*100).toFixed(2)),d>0&&m.length>0&&C<100?t==null||t({percentage:C,loadedBytes:l,privateUri:r}):d===0&&m.length>0&&(t==null||t({percentage:null,loadedBytes:l,privateUri:r})),y.enqueue(m)}catch(S){y.error(S),s==null||s({error:S})}},flush(m){t==null||t({percentage:100,loadedBytes:l,privateUri:r}),i==null||i({percentage:100,loadedBytes:l,privateUri:r}),m.terminate()}}));return[new Response(c,{headers:new Headers(e.headers),status:e.status,statusText:e.statusText}),h]}async function J({wasmURI:r,expectedHash:e,verifyResponseHash:a,onProgress:t,onComplete:s,onError:i,referredOrigin:d}){let l=await fetch(r,{referrerPolicy:"origin",referrer:d!=null?d:""});if(!l.ok)throw new Error(`HTTP status code is not ok: ${l.status}, ${l.statusText}`);let[C,p]=Pe(r,l,a,{onProgress:t,onError:i,onComplete:s});return p!=null&&Le(ve(p),e,r),C}function ae({wasmURI:r,expectedHash:e,verifyResponseHash:a,progressCallback:t,successCallback:s,errorCallback:i,importObject:d,referredOrigin:l}){async function C(h){try{let c=await J({wasmURI:r,expectedHash:e,verifyResponseHash:a,onProgress:t,referredOrigin:l}),m=await(h!=null?h:c).arrayBuffer(),y=await self.WebAssembly.instantiate(m,d);s(y.instance,y.module)}catch(c){n.log(n.Level.Error,c),n.log(n.Level.Error,`Couldn\'t instantiate Scandit SDK DataCapture library at ${r}, did you configure the path for it correctly?`),i==null||i(c)}}async function p(){let h;try{h=await J({wasmURI:r,expectedHash:e,verifyResponseHash:a,onProgress:t,referredOrigin:l});let c=await self.WebAssembly.instantiateStreaming(h,d);s(c.instance,c.module)}catch(c){n.log(n.Level.Warn,c),n.log(n.Level.Warn,"WebAssembly streaming compile failed. Falling back to ArrayBuffer instantiation (this will make things slower)"),C((h==null?void 0:h.bodyUsed)===!0?void 0:h)}}typeof self.WebAssembly.instantiateStreaming=="function"?p():C()}async function _(r,e,a,t){return new Promise((s,i)=>{r().then(s).catch(d=>{let l=e*2;if(l>a){i(d);return}t(d),self.setTimeout(()=>{_(r,l,a,t).then(s).catch(i)},e)})})}function z(r){var e,a;let t="unknown";if((e=r.href)!=null&&e.startsWith("blob:null/"))t="localhost";else{let s=((a=r.pathname)==null?void 0:a.length)>1&&!r.pathname.startsWith("/");t=new URL(s?r.pathname:r.origin).hostname}return t.startsWith("[")&&t.endsWith("]")?(t=t.slice(1,-1),t):(/^(\\d{1,3}\\.){3}\\d{1,3}$/.test(t)&&(t=t.split(".").map(s=>Number.parseInt(s,10).toString()).join(".")),t)}async function re(r,e){async function a(){return importScripts(r)}try{await _(a,250,4e3,s=>{n.log(n.Level.Warn,s),n.log(n.Level.Warn,`Couldn\'t retrieve Scandit Data Capture library at ${r}, retrying...`)}),self.Module.mainScriptUrlOrBlob=r;let t=self.SDC_WASM_JS_VERSION;return t!==e&&n.log(n.Level.Warn,`The Scandit Data Capture library JS file found at ${r} seems invalid: expected version doesn\'t match (received: ${t}, expected: ${e}). Please ensure the correct Scandit Data Capture file (with correct version) is retrieved.`),!0}catch(t){return n.log(n.Level.Error,t),!1}}o();function We(r){return/^https?:\\/\\/(?:[^./]*\\.)*cdn.jsdelivr.net\\//.test(r)?{result:!0,cdnBaseURL:"https://cdn.jsdelivr.net/npm/"}:/^https?:\\/\\/(?:[^./]*\\.)*unpkg.com\\//.test(r)?{result:!0,cdnBaseURL:"https://unpkg.com/"}:{result:!1,cdnBaseURL:""}}function Fe(r){let e=/@scandit\\/web-datacapture-[a-z]+/i.exec(r);return e?e[0]:null}function se(r,e,a){let t=e,s=We(t);if(s.result){let d=Fe(t);d!=null&&(t=`${s.cdnBaseURL}${d}@${r}/sdc-lib/`)}let i=a.replace(".wasm","");return s.result?{jsURI:`${t}${i}.js`,wasmURI:`${t}${i}.wasm`}:{jsURI:`${t}${i}.js?v=${r}`,wasmURI:`${t}${i}.wasm?v=${r}`}}o();var E;(r=>{function e(){return"7.6.1"}r.sdkVersion=e})(E||(E={}));o();var ie=class{constructor(){this.promise=new Promise((r,e)=>{this.reject=e,this.resolve=r})}};var ne=class oe{constructor(e,a){this.hintPresenterV2=null,this.MAX_NUMBER_OF_IMAGES_IN_FRAME_DATA_POOL=10,this.redrawInterval=1e3/30,this.redrawRequests=[],this._isDrawLoopRunning=!1,this.frameDataPool=new Map,this.lastFrameCounter=-1,this.poorMansBenchmarkLogs=!1,this.writableDataPathStandard="/scandit_sync_folder",this.resourceFilesSubfolder="resources",this.performanceMetricsReporterTimer=void 0,this.performanceMetrics={frameDataPoolSize:0,processedFramesCount:0,redrawRequestsCount:0,actualRedrawsCount:0},this.gestureListener=null,this.webPlatformHintPresenter=null,this.moduleHandler=e,this.workerFunctions=a,this._loadProgressCallback=this._loadProgressCallback.bind(this),te(this.getWasmMetadata())}get Module(){return this.moduleHandler.get()}set isDrawLoopRunning(e){this._isDrawLoopRunning=e,!e&&typeof this.loopTimeoutId=="number"&&(clearTimeout(this.loopTimeoutId),this.loopTimeoutId=void 0)}get isDrawLoopRunning(){return this._isDrawLoopRunning}convertToLoadableFrameData(e){let a=this.getNextFrameId();this.frameDataPool.set(a,new Uint8ClampedArray(e.getFrameData()));let t=this.lastUsedModuleMirrorAxis==null?!1:this.lastUsedModuleMirrorAxis!==this.Module.Axis.None;return{frameId:a,width:e.getWidth(),height:e.getHeight(),isFrameSourceMirrored:t}}createContext(e){var a,t,s,i,d;let l=this.getModeDeserializers(),C=z(location);(C==="localhost"||C==="127.0.0.1")&&navigator.userAgent.includes("Electron")&&e.appName!=null&&(C+=`-${e.appName}`),this.parentDomain=e.parentDomain,this.contextDeserializer=new this.Module.DataCaptureContextDeserializer(this.writableDataPath,e.deviceId,e.context.deviceModelName,C,this.parentDomain,l,e.delayedRegistration,e.highEndBlurryRecognition,this.resourcePath);let p=this.contextDeserializer.contextFromJson(JSON.stringify(e.context));if(p==null){let u=this.contextDeserializer.getLastError();throw new Error(`Could not create the context: ${u}`)}let h=p.getView();this.context=p.getContext(),p.delete();let c=this.Module.DataCaptureContextListener.extend("DataCaptureContextListener",{didChangeStatus:(u,I)=>{this.contextDidChangeStatus(JSON.parse(I.toJson())),u.delete()},didStartObservingContext:u=>{this.didStartObservingContext(),u.delete()},didStopObservingContext:u=>{u.delete()}}),m=this.Module.DataCaptureContextFrameListener.extend("DataCaptureContextFrameListener",{onObservationStarted:u=>{u.delete()},onObservationStopped:u=>{u.delete()},onFrameProcessingStarted:(u,I)=>{this.workerFunctions.postMessage({type:"onFrameProcessingStarted"}),I.delete(),u.delete()},onFrameProcessingFinished:(u,I)=>{this.workerFunctions.postMessage({type:"onFrameProcessingFinished"}),I.delete(),u.delete()},onFrameSkipped:(u,I)=>{this.workerFunctions.postMessage({type:"onFrameSkipped"}),I.delete(),u.delete()}}),y=this.Module.GestureRecognizer.extend("GestureRecognizer",{setGestureListener:(u,I)=>{var L;(L=this.gestureListener)==null||L.delete(),this.gestureListener=u.clone(),u.delete()}});(a=this.gestureRecognizer)==null||a.delete(),this.gestureRecognizer=new y;let S=new c;this.context.addListener(S),S.delete();let b=new m;this.context.addFrameListener(b),b.delete(),this.setView(h),(t=this.view)==null||t.setGestureRecognizer(this.gestureRecognizer);let w=this.Module.PlatformHintPresenter.extend("PlatformHintPresenter",{setHintPresenter:u=>{u.delete()},showToast:u=>{this.workerFunctions.postMessage({type:"showToast",payload:JSON.parse(u)})},hideToast:u=>{this.workerFunctions.postMessage({type:"hideToast",payload:JSON.parse(u)})},showGuidance:u=>{this.workerFunctions.postMessage({type:"showGuidance",payload:JSON.parse(u)})},hideGuidance:u=>{this.workerFunctions.postMessage({type:"hideGuidance",payload:JSON.parse(u)})},startUpdateTimer:u=>{this.workerFunctions.postMessage({type:"startUpdateTimer",payload:{duration:{unit:"ms",value:u}}})},stopUpdateTimer:()=>{this.workerFunctions.postMessage({type:"stopUpdateTimer"})}});(s=this.hintPresenterV2)==null||s.delete(),this.hintPresenterV2=null,(i=this.webPlatformHintPresenter)==null||i.delete(),this.webPlatformHintPresenter=null,this.webPlatformHintPresenter=new w,this.view&&(this.hintPresenterV2=new this.Module.HintPresenterV2(this.webPlatformHintPresenter),(d=this.view)==null||d.setHintPresenterV2(this.hintPresenterV2))}onTap(e){var a;(a=this.gestureListener)==null||a.onTap(JSON.stringify(e))}hintPresenterV2Update(){var e;(e=this.hintPresenterV2)==null||e.update()}startReportingPerformanceMetrics(){this.performanceMetricsReporterTimer==null&&(this.performanceMetricsReporterTimer=setInterval(()=>{this.reportPerformanceMetrics();for(let e of Object.keys(this.performanceMetrics))this.performanceMetrics[e]=0},1e3))}async reportPerformanceMetrics(){this.workerFunctions.postMessage({type:"performanceMetricsReport",payload:{...this.performanceMetrics}})}deleteFrameData(e){this.frameDataPool.delete(e)}dispose(){var e,a,t,s;this.context.dispose(),this.frameDataPool.clear(),this.isDrawLoopRunning=!1,this.lastFrameCounter=-1,(e=this.gestureRecognizer)==null||e.delete(),this.gestureRecognizer=null,(a=this.gestureListener)==null||a.delete(),this.gestureListener=null,(t=this.hintPresenterV2)==null||t.delete(),this.hintPresenterV2=null,(s=this.webPlatformHintPresenter)==null||s.delete(),this.webPlatformHintPresenter=null}flushAnalytics(){this.context.flushAnalytics()}extractCentaurusLicense(e){return{payload:{centaurus:{licenseKey:this.Module.LicenseUtils[oe.get3dPartyLicenseKeyMethodName](e)}}}}getModeDeserializers(){return new this.Module.VectorDataCaptureModeDeserializer}loadLibrary(e){return this.libraryLoadingPromise!=null?this.libraryLoadingPromise:(this.libraryLoadingPromise=this.setup(e),this.libraryLoadingPromise)}processFrame(e){var a;if(this.context==null)return{payload:e,transferables:[e.data.buffer]};let t=e.data,s=e.colorType==="GRAYSCALE"?this.Module.ImageBufferFormat.Grayscale8:this.Module.ImageBufferFormat.Rgba8888,i=this.Module.allocateUint8Array(t.byteLength);return this.Module.HEAPU8.set(t,i),(a=this.imageFrameSource)==null||a.outputFrame(i,e.width,e.height,s),{payload:e,transferables:[e.data.buffer]}}reportCameraProperties(e){this.context.setCameraProperties(e.deviceId,e.isFrontFacing,e.hasAutofocus)}requestFrameData(e){let a=this.frameDataPool.get(e);return a==null?{payload:{data:null}}:{payload:{data:a},transferables:[a.buffer]}}scheduleRedraw(e,a){this.addRedrawRequest(a),this.isDrawLoopRunning||this.startDrawLoop(e)}sendViewRefreshCommands(e){this.workerFunctions.postMessage({type:"draw",payload:e},[e.buffer])}setFrameSource(e,a){var t;this.lastUsedModuleMirrorAxis=this.mapMirrorAxisOnModule(e),(t=this.imageFrameSource)==null||t.delete(),this.imageFrameSource=new this.Module.ImageBufferFrameSource(this.lastUsedModuleMirrorAxis,a,0),this.context.setFrameSource(this.imageFrameSource)}startDrawLoop(e){this.isDrawLoopRunning=!0;let a=i=>this.redrawRequests.length>0&&this.redrawRequests[0]<=i,t=i=>{for(;this.redrawRequests.length>0&&this.redrawRequests[0]<=i;)this.redrawRequests.shift()},s=()=>{this.loopTimeoutId=setTimeout(()=>{if(!this.isDrawLoopRunning)return;let i=performance.now();if(a(i)){t(i),e.draw();let d=e.getDrawCommands();this.sendViewRefreshCommands(new Uint8Array(d))}s()},this.redrawInterval)};s()}updateContext(e){if(this.context!=null&&this.contextDeserializer!=null){e.view!=null&&!e.view.visible&&this.context.flushAnalytics();let a=this.onBeforeUpdateContextHook(e),t=this.contextDeserializer.updateContextFromJson(this.context,this.view,JSON.stringify(a.context));if(t==null){let i=this.contextDeserializer.getLastError();throw new Error(`Could not update the context: ${i}`)}this.context.delete(),this.context=t.getContext();let s=t.getView();t.delete(),s!=null&&a.view!=null&&s.setViewSize(a.view.width,a.view.height,a.view.orientation),!this.hintPresenterV2&&this.webPlatformHintPresenter&&(this.hintPresenterV2=new this.Module.HintPresenterV2(this.webPlatformHintPresenter)),s!=null&&this.hintPresenterV2&&s.setHintPresenterV2(this.hintPresenterV2),this.gestureRecognizer!=null&&(s==null||s.setGestureRecognizer(this.gestureRecognizer)),this.setView(s),n.debug("context updated",a)}}onBeforeUpdateContextHook(e){return e}onDocumentVisibilityChange(e){e==="hidden"&&this.context.flushAnalytics()}isFeatureSupported(e){return{payload:{supported:this.context.isFeatureSupported(e)}}}getViewfinderInfo(){var e,a;return{payload:{isDisplayingViewfinder:(a=(e=this.view)==null?void 0:e.isDisplayingViewfinder())!=null?a:!1,rect:JSON.parse(this.view.getViewfinderRect())}}}getOpenSourceSoftwareLicenseInfo(){return{payload:{licenseText:this.Module.OpenSourceSoftwareLicenseInfo.getLicenseText()}}}getNextFrameId(){return this.lastFrameCounter++,this.lastFrameCounter>=this.MAX_NUMBER_OF_IMAGES_IN_FRAME_DATA_POOL&&(this.lastFrameCounter=0),this.lastFrameCounter}getWasmDynamicLibraries(e){return this.getWasmSideModuleFileName()==null?[]:[`${e.replace(/\\/[^/]*$/,"/")}${this.getWasmSideModuleFileName()}`]}getWasmCoreExpectedHash(e,a){return a?e?"7190b37a1ac67e83296ba37ccdc41fc4a1e137abece156003c1e5f6ff5c5c33c":"e935f51c14a02deff48ae89db39a11ed1538480e75b9034b5d4301f369be4d23":e?"037f5067b50af5ec1cae74d533b67f029f77b895a5409f89b993ef7c4a3da29e":""}getWasmCoreFileName(e,a){return a?e?"scandit-datacapture-sdk-id-simd-pthreads.wasm":"scandit-datacapture-sdk-id-pthreads.wasm":e?"scandit-datacapture-sdk-id-simd.wasm":""}getWasmMetadata(){return g}getWasmSideModuleFileName(){return""}_loadProgressCallback(e){this.workerFunctions.postMessage({type:"loadLibraryProgress",payload:e})}addRedrawRequest(e){this.redrawRequests.push(Math.round(performance.now())+e),this.redrawRequests.sort((a,t)=>a-t)}contextDidChangeStatus(e){e.code===260?e.message=e.message.replace("domain name",`domain name (${z(location)})`):e.code===265&&(e.message=e.message.replace("domain name",`domain name (${this.parentDomain})`)),this.workerFunctions.postMessage({type:"contextDidChangeStatus",payload:e})}didStartObservingContext(){this.workerFunctions.postMessage({type:"didStartObservingContext"})}mapMirrorAxisOnModule(e){switch(e){case"None":return this.Module.Axis.None;case"X":return this.Module.Axis.X;case"Y":return this.Module.Axis.Y;default:return this.Module.Axis.None}}setView(e){this.view=e,this.setViewRefreshHandler(e),e==null&&(this.isDrawLoopRunning=!1,this.sendViewRefreshCommands(new Uint8Array([])))}addNativeOverlay(e){n.warn("addNativeOverlay has not been implemented for this module",e)}removeNativeOverlay(e){n.warn("removeNativeOverlay has not been implemented for this module",e)}setViewRefreshHandler(e){if(e==null||e.isViewRefreshHandlerSet)return;let a=this.Module.NeedsRedrawDelegate.extend("NeedsRedrawDelegate",{setNeedsRedrawIn:this.scheduleRedraw.bind(this,e)}),t=new a;e.setNeedsRedrawDelegate(t),e.isViewRefreshHandlerSet=!0}setupDataDecoding(){let e=this.moduleHandler.get(),a=e.DataDecoding.extend("DataDecoding",{decode(t,s){try{let i=JSON.parse(s),d=[];for(let l of i){let C=new TextDecoder(l.ianaName,{fatal:!0});d.push(C.decode(t.slice(l.startIndex,l.endIndex)))}return d.join("")}catch{return""}}});e.setDataDecoding(new a)}start(e,a,t){e&&a&&(this.setupDataDecoding(),this.moduleHandler.get().callMain(),this.moduleHandler.get().__emscripten_proxy_main!==void 0||t())}getWritableDataPath(e){return e!=null?(n.debug(`IndexedDB database name override in use to recover from blocked standard database: ${e}`),e):this.writableDataPathStandard}numOfMBToPages(e){return Math.ceil(1024*e*1024/64/1024)}async setup({libraryLocation:e,locationPath:a,writableDataPathOverride:t,overrideThreadsSupport:s,overrideSimdSupport:i,verifyResponseHash:d,referredOrigin:l,fixedWasmMemory:C}){var p;let h=!1,c=!1;this.writableDataPath=this.getWritableDataPath(t),this.resourcePath=`${e}${this.resourceFilesSubfolder}/`,self.path=a;let{resolve:m,reject:y,promise:S}=new ie,b=E.sdkVersion();if(b==="")throw new A({name:"Invalid library version",message:"Library version is not defined or empty, cannot generate proper path to library files."});let[w,u]=await Promise.all([G(),K()]);s!=="auto"&&(u=s==="on"),i!=="auto"&&(w=i==="on");let I=this.getWasmCoreFileName(w,u),L=se(b,e,I),{jsURI:N,wasmURI:j}=L,Ce={instantiateWasm:(D,ge)=>(ae({importObject:D,wasmURI:j,expectedHash:this.getWasmCoreExpectedHash(w,u),verifyResponseHash:d,successCallback:ge,progressCallback:this._loadProgressCallback,errorCallback:he=>{y(he)},referredOrigin:l}),{})},k=C===null?null:new WebAssembly.Memory({initial:this.numOfMBToPages(C),maximum:this.numOfMBToPages(300),shared:u});return k!==null&&n.log(n.Level.Debug,"Fixed wasmMemory set",k),this.moduleHandler.set({...k?{wasmMemory:k}:{},mainScriptUrlOrBlob:N,canvas:(p=this.workerFunctions.getOffscreenCanvas())!=null?p:{getContext:()=>null},...Ce,dynamicLibraries:this.getWasmDynamicLibraries(j),locateFile:D=>e+D,noInitialRun:!0,preRun:[async()=>{try{await Q({writableDataPath:this.writableDataPath})}catch(D){if(D.name==="BlockedIndexedDB"){y(D.toString());return}n.log(n.Level.Debug,"No IndexedDB support, some data will not be persisted:",D)}c=!0,this.start(c,h,m)}],onMainComplete:()=>{if([h,c].includes(!1)){n.log(n.Level.Warn,{runtimeLoaded:h,fileSystemSynced:c},"Both runtimeLoaded and fileSystemSynced should be true when calling onMainComplete"),y("onMainComplete has been called but runtime or file system was not ready.");return}m()},onRuntimeInitialized:()=>{h=!0,this.start(c,h,m)},print:D=>{n.log(n.Level.Info,D)}}),await re(N,b)||y(`Couldn\'t retrieve Scandit Data Capture library at ${N}, did you configure the path for it correctly?`),S}};ne.get3dPartyLicenseKeyMethodName=atob("Z2V0QmxpbmtJZExpY2Vuc2VLZXk=");var x=ne;o();var Ne=class{constructor(r){if(typeof r!="function")throw new TypeError("FinalizationRegistry callback must be a function")}register(r,e,a){}unregister(r){return!1}};function de(r){typeof r.FinalizationRegistry>"u"&&(r.FinalizationRegistry=Ne)}o();o();function v(r){return typeof r=="object"&&r!=null}function R(r){if(typeof r=="string")return r;if(v(r)){if(typeof r.message=="string")return r.message}else if(typeof(r==null?void 0:r.toString)=="function")return r.toString();return"unknown error"}o();function ue(r){return typeof r=="object"&&r!=null&&r.document==null&&"addEventListener"in r&&typeof r.importScripts=="function"}o();function le(r){console.warn("Reached unexpected case",r)}var U=class{constructor(r,e){this.onMessageListener=this.onMessage.bind(this),this.workerSelf=r,this.dataCaptureInstance=new x(e,{postMessage:this.postMessage.bind(this),getOffscreenCanvas:this.getOffscreenCanvas.bind(this)}),ue(r)&&(de(r),this.listenToMessages())}listenToMessages(){this.workerSelf.addEventListener("message",this.onMessageListener),this.workerSelf.addEventListener("error",r=>{n.log(n.Level.Error,r)}),this.workerSelf.addEventListener("messageerror",r=>{n.log(n.Level.Error,r)})}postMessage(r,e){this.workerSelf.postMessage(r,e!=null?e:[])}getOffscreenCanvas(){if(typeof this.workerSelf.OffscreenCanvas=="function")return new this.workerSelf.OffscreenCanvas(32,32)}hasPayload(r){return v(r)&&"payload"in r}hasTransferables(r){return v(r)&&Array.isArray(r.transferables)}async respondWith(r,e,a){let t=null,s;try{s=a(),s instanceof Promise&&(s=await s)}catch(d){s=void 0,t=R(d)}let i={type:"workerTaskId",command:r,id:e,payload:this.hasPayload(s)?s.payload:void 0};t!=null&&(i.error=t),this.postMessage(i,this.hasTransferables(s)?s.transferables:[])}onMessage(r){switch(r.data.command){case"loadLibrary":{{let{data:e}=r;this.respondWith(e.command,e.id,async()=>this.dataCaptureInstance.loadLibrary({libraryLocation:e.libraryLocation,locationPath:e.locationPath,referredOrigin:e.referredOrigin,writableDataPathOverride:e.writableDataPathOverride,overrideThreadsSupport:e.overrideThreadsSupport,overrideSimdSupport:e.overrideSimdSupport,verifyResponseHash:e.verifyResponseHash,fixedWasmMemory:e.fixedWasmMemory}))}break}case"onTap":{{let{data:e}=r;this.respondWith(e.command,e.id,async()=>{this.dataCaptureInstance.onTap(e.point)})}break}case"hintPresenterV2update":{{let{data:e}=r;this.respondWith(e.command,e.id,async()=>{this.dataCaptureInstance.hintPresenterV2Update()})}break}case"createContext":{{let{data:e}=r;this.respondWith(e.command,e.id,()=>this.dataCaptureInstance.createContext({context:e.context,deviceId:e.deviceId,delayedRegistration:e.delayedRegistration,highEndBlurryRecognition:e.highEndBlurryRecognition,appName:e.appName,parentDomain:e.parentDomain}))}break}case"setFrameSource":{{let{data:e}=r;this.respondWith(e.command,e.id,()=>this.dataCaptureInstance.setFrameSource(e.mirrorAxis,e.isCameraFrameSource))}break}case"processFrame":{{let{data:e}=r;this.respondWith(e.command,e.id,()=>this.dataCaptureInstance.processFrame({data:e.data,width:e.width,height:e.height,colorType:e.colorType}))}break}case"requestFrameData":{{let{data:e}=r;this.respondWith(e.command,e.id,()=>this.dataCaptureInstance.requestFrameData(e.frameId))}break}case"deleteFrameData":{{let{data:e}=r;this.respondWith(e.command,e.id,()=>{this.dataCaptureInstance.deleteFrameData(e.frameId)})}break}case"updateContext":{{let{data:e}=r;this.respondWith(e.command,e.id,async()=>this.dataCaptureInstance.updateContext(e))}break}case"dispose":{this.respondWith(r.data.command,r.data.id,()=>this.dataCaptureInstance.dispose());break}case"flushAnalytics":{this.respondWith(r.data.command,r.data.id,()=>{this.dataCaptureInstance.flushAnalytics()});break}case"reportCameraProperties":{{let{data:e}=r;this.respondWith(e.command,e.id,async()=>this.dataCaptureInstance.reportCameraProperties(e))}break}case"setLogLevel":{{let{data:e}=r;this.respondWith(e.command,e.id,()=>{n.setLevel(e.level)})}break}case"extractCentaurusLicense":{{let{data:e}=r;this.respondWith(e.command,e.id,()=>this.dataCaptureInstance.extractCentaurusLicense(e.licenseKey))}break}case"documentVisibility":{{let{data:e}=r;this.respondWith(e.command,e.id,()=>{this.dataCaptureInstance.onDocumentVisibilityChange(e.state)})}break}case"isFeatureSupported":{{let{data:e}=r;this.respondWith(e.command,e.id,()=>this.dataCaptureInstance.isFeatureSupported(e.feature))}break}case"getViewfinderInfo":{{let{data:e}=r;this.respondWith(e.command,e.id,()=>this.dataCaptureInstance.getViewfinderInfo())}break}case"getOpenSourceSoftwareLicenseInfo":{{let{data:e}=r;this.respondWith(e.command,e.id,()=>this.dataCaptureInstance.getOpenSourceSoftwareLicenseInfo())}break}case"addNativeOverlay":this.dataCaptureInstance.addNativeOverlay(r);break;case"removeNativeOverlay":this.dataCaptureInstance.removeNativeOverlay(r);break;default:return le(r.data),!1}return!0}};q();o();o();o();o();o();function pe(r){return r.ok()}function ce(r,e){return pe(r)?r.value():e}function me(r,e){return pe(r)?e:r.error()}function f(r,e){return r===void 0?e:r}var P=class{constructor(e,a,t){this.SDCIdCaptureMode=null;this.lastResult="";this.lastError="";this.lastLocalizedId="";this.lastDetectionIssue="";this.coreEngine=e,this.Module=e.Module,this.workerFunctions=e.workerFunctions,this.start(a,t)}start(e,a){this.initHintPresenterIfNotInitialized();let t=this.Module.IdCaptureListener.extend("IdCaptureListener",{onSessionUpdated:(c,m)=>{c.delete(),m.delete()},onIdCaptured:(c,m)=>{this.onIdCapturedCallback(m),c.delete(),m.delete()},onIdPartiallyCaptured:(c,m)=>{this.onIdPartiallyCapturedCallback(m),c.delete(),m.delete()},onIdRejected:(c,m,y)=>{this.onIdRejectedCallback(m,y),c.delete(),m==null||m.delete()},onIdLocalized:(c,m)=>{this.onIdLocalizedCallback(m),c.delete()},onShutterButtonPositionChanged:c=>{this.onShutterButtonPositionChangedCallback(c)},onShutterButtonStateChanged:c=>{this.onShutterButtonStateChangedCallback(c)}}),s=this.Module.Feedback.extend("Feedback",{emit:()=>{this.workerFunctions.postMessage({type:"idCaptureIdCapturedFeedback"})}}),i=this.Module.Feedback.extend("Feedback",{emit:()=>{this.workerFunctions.postMessage({type:"idCaptureIdRejectedFeedback"})}}),d=this.Module.IdCaptureBackend.extend("IdCaptureBackend",{getLastError:()=>this.lastError,getLastResult:()=>this.backendGetLastResult(),getLocalizedOnlyId:()=>this.lastLocalizedId,getLastIssue:()=>this.lastDetectionIssue,processFrame:()=>{},reset:this.onResetFromSDC.bind(this),setDetectionOnlyMode:this.setDetectionOnlyMode.bind(this)}),l=new d;this.SDCIdCaptureMode=new this.Module.IdCapture(e,l,a,null),l.delete();let C=new t;this.SDCIdCaptureMode.addListener(C),C.delete();let p=new s,h=new i;this.SDCIdCaptureMode.setFeedbacks(p,h),p.delete(),h.delete()}getSDCIdCaptureMode(){if(!this.SDCIdCaptureMode)throw new Error("IdCaptureMode not initialized");return this.SDCIdCaptureMode}backendGetLastResult(){return this.lastResult}setLastResult(e){this.lastResult=e}setLastError(e){this.lastError=e}setLastLocalizedId(e){this.lastLocalizedId=e}setLastDetectionIssue(e){this.lastDetectionIssue=e}applySettings(e){var a;(a=this.SDCIdCaptureMode)==null||a.applySettings(JSON.stringify(e))}reset(){var e;(e=this.SDCIdCaptureMode)==null||e.reset()}setExternalTransactionId(e){var a;(a=this.SDCIdCaptureMode)==null||a.setExternalTransactionId(e)}getExternalTransactionId(){var e;return(e=this.SDCIdCaptureMode)==null?void 0:e.getExternalTransactionId()}parseCode(e){if(this.SDCIdCaptureMode){let a=this.SDCIdCaptureMode.parse(e);if(a.ok()){let t=ce(a,null);if(t!=null){let s=this.extractCaptureId(t);if(s!=null)return{status:"success",capturedId:s}}}else return{status:"error",error:me(a,"Undefined error")}}return null}getCentaurusSettings(){let e=this.getSDCIdCaptureMode().getCentaurusSettings();return JSON.parse(e)}dataConsistencyVerifyCapture(e){let t=new this.Module.DataConsistencyVerifier(this.coreEngine.context).verify(JSON.stringify(e));if(t==null)return null;let s=JSON.parse(t.toJson());return t.delete(),s}async barcodeVerifyAamvaCapture(e,a){return new Promise(t=>{let s=this.Module.AamvaBarcodeVerifier.extend("AamvaBarcodeVerifier",{retriggerVerificationIn(d){setTimeout(()=>{i.startVerification(JSON.stringify(e))},d)},verificationEnded(){let d=i.getBarcodeVerificationResponse();t({isSuccess:d.isSuccess,error:d.error,allChecksPassed:d.allChecksPassed,serverResponseJSON:d.serverResponseJson})}}),i=new s;i.initialize(this.coreEngine.context,a==null?"":a),i.startVerification(JSON.stringify(e))})}onResetFromSDC(e){this.workerFunctions.postMessage({type:"idCaptureBackendReset"}),this.lastError="",this.lastResult="",this.lastLocalizedId=""}setDetectionOnlyMode(e){this.workerFunctions.postMessage({type:"idCaptureDetectionOnlyMode",payload:{detectionOnlyMode:e}})}onIdCapturedCallback(e){let a=this.extractCaptureId(e);a&&this.workerFunctions.postMessage({type:"idCaptureDidCaptureId",payload:{capturedId:a}},this.extractImageTransferablesFromCapturedId(a))}onIdPartiallyCapturedCallback(e){let a=this.extractCaptureId(e);a&&this.workerFunctions.postMessage({type:"idCaptureDidPartiallyCaptureId",payload:{capturedId:a}},this.extractImageTransferablesFromCapturedId(a))}onIdRejectedCallback(e,a){let t=this.extractCaptureId(e);this.workerFunctions.postMessage({type:"idCaptureDidRejectId",payload:{capturedId:t,rejectionReason:a}},t?this.extractImageTransferablesFromCapturedId(t):[])}onIdLocalizedCallback(e){this.workerFunctions.postMessage({type:"idCaptureDidLocalizeId",payload:{localization:JSON.parse(e)}})}extractCaptureId(e){var c,m,y,S,b,w,u,I;if(e==null)return null;let a=e.getImages(),t=a.getFrameFront(),s=a.getFrameBack(),i=f(a.getFace(),null),d=f(a.getCroppedDocumentFront(),null),l=f(a.getCroppedDocumentBack(),null),C={front:{face:i,croppedDocument:d,frame:{data:t?new Uint8ClampedArray(t.getFrameData()):null,width:(c=t==null?void 0:t.getWidth())!=null?c:0,height:(m=t==null?void 0:t.getHeight())!=null?m:0,mirrorAxis:(y=t==null?void 0:t.getMirrorAxis().value)!=null?y:0,orientation:(S=t==null?void 0:t.getOrientation())!=null?S:0}},back:{face:null,croppedDocument:l,frame:{data:s?new Uint8ClampedArray(s.getFrameData()):null,width:(b=s==null?void 0:s.getWidth())!=null?b:0,height:(w=s==null?void 0:s.getHeight())!=null?w:0,mirrorAxis:(u=s==null?void 0:s.getMirrorAxis().value)!=null?u:0,orientation:(I=s==null?void 0:s.getOrientation())!=null?I:0}}};t==null||t.delete(),s==null||s.delete(),a.delete();let p=JSON.parse(e.toJson());return{...{firstName:f(e.getFirstName(),""),lastName:f(e.getLastName(),""),secondaryLastName:f(e.getSecondaryLastName(),""),fullName:e.getFullName(),sex:f(e.getSex(),""),age:f(e.getAge(),null),isExpired:f(e.isExpired(),null),nationality:f(e.getNationality(),""),address:f(e.getAddress(),""),issuingCountry:f(e.getIssuingCountry(),""),issuingCountryIso:f(e.getIssuingCountryIso(),""),documentNumber:f(e.getDocumentNumber(),""),documentAdditionalNumber:f(e.getDocumentAdditionalNumber(),""),dateOfBirth:$(f(e.getDateOfBirth(),null)),dateOfExpiry:$(f(e.getDateOfExpiry(),null)),dateOfIssue:$(f(e.getDateOfIssue(),null)),documentType:f(e.getDocumentType(),null),documentSubtype:f(e.getDocumentSubtype(),null)},...p,imageInfo:null,rawImageInfo:C}}onShutterButtonPositionChangedCallback(e){this.workerFunctions.postMessage({type:"idCaptureDidShutterButtonPositionChanged",payload:{position:JSON.parse(e)}})}onShutterButtonStateChangedCallback(e){this.workerFunctions.postMessage({type:"idCaptureDidShutterButtonStateChanged",payload:{state:e}})}async reportSafariAbruptReload(e){let a=new this.Module.OutOfMemoryAnalyticsData(e.framesProcessedCount,e.didCaptureCount,e.didRejectCount,e.applySettingsCount,e.upTime,e.videoResolution,e.parentDomain,e.centaurusEnabled);this.Module.OutOfMemoryAnalyticsHelper.storeAnalyticsEvent(this.coreEngine.context,a),a.delete()}parseIdCaptureSession(e){return JSON.parse(e.toJson())}dispose(){var e;(e=this.SDCIdCaptureMode)==null||e.delete(),this.SDCIdCaptureMode=null,this.lastError="",this.lastLocalizedId="",this.lastResult=""}extractImageTransferablesFromCapturedId(e){let a=[];return e.rawImageInfo.front.frame.data&&e.rawImageInfo.front.frame.data.length>0&&a.push(e.rawImageInfo.front.frame.data.buffer),e.rawImageInfo.back.frame.data&&e.rawImageInfo.back.frame.data.length>0&&a.push(e.rawImageInfo.back.frame.data.buffer),a}isReadyToDisplayHints(){return this.coreEngine.view?this.coreEngine.view.hintPresenterInitialized():!1}initHintPresenterIfNotInitialized(){var a;if(this.isReadyToDisplayHints())return;let e=this.Module.HintPresenter.extend("HintPresenter",{showHint:(t,s)=>{this.workerFunctions.postMessage({type:"showHint",payload:{text:t,style:JSON.parse(s)}})},updateHint:t=>{this.workerFunctions.postMessage({type:"updateHint",payload:{style:JSON.parse(t)}})},hideHint:()=>{this.workerFunctions.postMessage({type:"hideHint",payload:{}})}});(a=this.coreEngine.view)==null||a.setHintPresenter(new e)}};function $(r){if(typeof r=="string")try{return JSON.parse(r)}catch{return null}return null}function Te(r,e,a){let t=e.IdCaptureDeserializerHelper.extend("IdCaptureDeserializerHelper",{createMode:(d,l)=>{let C=new P(r,d,l);return a(C),d.delete(),l.delete(),C.getSDCIdCaptureMode()}}),s=new t,i=new e.IdCaptureDeserializer(s);return s.delete(),i}var W=class extends x{constructor(){super(...arguments);this.idCaptureMode=null;this.lastIdCaptureModeSerializedSettings=""}getModeDeserializers(){let a=super.getModeDeserializers();return a.push_back(Te(this,this.Module,this.receiveNewCaptureMode.bind(this))),a}receiveNewCaptureMode(a){this.idCaptureMode=a}processFrame(a){return this.idCaptureMode?super.processFrame(a):{payload:a,transferables:[a.data.buffer]}}updateContext(a){super.updateContext(a)}idCaptureSetLastResult(a){var t;(t=this.idCaptureMode)==null||t.setLastResult(a)}idCaptureSetLastError(a){var t;(t=this.idCaptureMode)==null||t.setLastError(a)}idCaptureSetLastLocalizedId(a){var t;(t=this.idCaptureMode)==null||t.setLastLocalizedId(a)}idCaptureSetLastDetectionIssue(a){var t;(t=this.idCaptureMode)==null||t.setLastDetectionIssue(a)}idCaptureReset(){var a;(a=this.idCaptureMode)==null||a.reset()}idCaptureSetExternalTransactionId(a){var t;(t=this.idCaptureMode)==null||t.setExternalTransactionId(a)}idCaptureGetExternalTransactionId(){var a,t;return{payload:{transactionId:(t=(a=this.idCaptureMode)==null?void 0:a.getExternalTransactionId())!=null?t:null}}}idCaptureApplySettings(a){var t;(t=this.idCaptureMode)==null||t.applySettings(a)}idCaptureGetCentaurusSettings(){return{payload:{result:this.idCaptureMode.getCentaurusSettings()}}}idCaptureParse(a){var t,s;return{payload:{result:(s=(t=this.idCaptureMode)==null?void 0:t.parseCode(a))!=null?s:null}}}async idCaptureBarcodeVerifyAamvaCapture(a,t){var s,i;return{payload:{result:(i=await((s=this.idCaptureMode)==null?void 0:s.barcodeVerifyAamvaCapture(a,t)))!=null?i:null}}}idCaptureDataConsistencyVerifyCapture(a){var t,s;return{payload:{result:(s=(t=this.idCaptureMode)==null?void 0:t.dataConsistencyVerifyCapture(a))!=null?s:null}}}idCaptureDrivingLicenseDetailsCreateWithCentaurusData(a,t,s){let i=this.Module.DrivingLicenseDetails.createWithCentaurusData(a,t,s);return{payload:{result:JSON.parse(i)}}}getIdOpenSourceSoftwareLicenseInfo(){return{payload:{licenseText:this.Module.IdOpenSourceSoftwareLicenseInfo.getLicenseText()}}}idCaptureReportSafariAbruptReload(a){var t;(t=this.idCaptureMode)==null||t.reportSafariAbruptReload(a)}idCaptureDispose(){var a;(a=this.idCaptureMode)==null||a.dispose(),this.idCaptureMode=null}getWasmSideModuleFileName(){return""}getWasmCoreFileName(a,t){return t?a?"scandit-datacapture-sdk-id-simd-pthreads.wasm":"scandit-datacapture-sdk-id-pthreads.wasm":a?"scandit-datacapture-sdk-id-simd.wasm":"scandit-datacapture-sdk-id.wasm"}getWasmCoreExpectedHash(a,t){return t?a?"7190b37a1ac67e83296ba37ccdc41fc4a1e137abece156003c1e5f6ff5c5c33c":"e935f51c14a02deff48ae89db39a11ed1538480e75b9034b5d4301f369be4d23":a?"037f5067b50af5ec1cae74d533b67f029f77b895a5409f89b993ef7c4a3da29e":"07e2d0c729c118134fc32412429aaa191a0670385932318cff0004e5a7ea5ff8"}getWasmMetadata(){return g}};var F=class extends U{constructor(e,a){super(e,a),this.dataCaptureInstance=new W(a,{postMessage:this.postMessage.bind(this),getOffscreenCanvas:this.getOffscreenCanvas.bind(this)})}async respondWith(e,a,t){let s=null,i;try{i=t(),i instanceof Promise&&(i=await i)}catch(l){n.log(n.Level.Debug,l),i=void 0,s=R(l)}let d={type:"workerTaskId",command:e,id:a,payload:this.hasPayload(i)?i.payload:void 0};s!=null&&(d.error=s),this.postMessage(d,this.hasTransferables(i)?i.transferables:[])}onMessage(e){switch(e.data.command){case"idCaptureSetLastResult":{let{data:t}=e;return this.respondWith(t.command,t.id,()=>{this.dataCaptureInstance.idCaptureSetLastResult(t.result)}),!0}case"idCaptureSetLastError":{let{data:t}=e;return this.respondWith(t.command,t.id,()=>{this.dataCaptureInstance.idCaptureSetLastError(t.error)}),!0}case"idCaptureSetLastLocalizedId":{let{data:t}=e;return this.respondWith(t.command,t.id,()=>{this.dataCaptureInstance.idCaptureSetLastLocalizedId(t.localizedId)}),!0}case"idCaptureSetLastDetectionIssue":{let{data:t}=e;return this.respondWith(t.command,t.id,()=>{this.dataCaptureInstance.idCaptureSetLastDetectionIssue(t.issue)}),!0}case"idCaptureReset":{let{data:t}=e;return this.respondWith(t.command,t.id,()=>this.dataCaptureInstance.idCaptureReset()),!0}case"idCaptureDispose":{let{data:t}=e;return this.respondWith(t.command,t.id,()=>this.dataCaptureInstance.idCaptureDispose()),!0}case"idCaptureApplySettings":{let{data:t}=e;return this.respondWith(t.command,t.id,()=>this.dataCaptureInstance.idCaptureApplySettings(t.settings)),!0}case"idCaptureParse":{let{data:t}=e;return this.respondWith(t.command,t.id,()=>this.dataCaptureInstance.idCaptureParse(t.code)),!0}case"idCaptureGetCentaurusSettings":{let{data:t}=e;return this.respondWith(t.command,t.id,()=>this.dataCaptureInstance.idCaptureGetCentaurusSettings()),!0}case"idCaptureBarcodeVerifyAamvaCapture":{let{data:t}=e;return this.respondWith(t.command,t.id,()=>this.dataCaptureInstance.idCaptureBarcodeVerifyAamvaCapture(t.capturedId,t.endpoint)),!0}case"idCaptureDataConsistencyVerifyCapture":{let{data:t}=e;return this.respondWith(t.command,t.id,()=>this.dataCaptureInstance.idCaptureDataConsistencyVerifyCapture(t.capturedId)),!0}case"idCaptureDrivingLicenseDetailsCreateWithCentaurusData":{let{data:t}=e;return this.respondWith(t.command,t.id,()=>this.dataCaptureInstance.idCaptureDrivingLicenseDetailsCreateWithCentaurusData(t.details.vehicleClass,t.details.restrictions,t.details.endorsements)),!0}case"getIdOpenSourceSoftwareLicenseInfo":{let{data:t}=e;return this.respondWith(t.command,t.id,()=>this.dataCaptureInstance.getIdOpenSourceSoftwareLicenseInfo()),!0}case"idCaptureReportSafariAbruptReload":{let{data:t}=e;return this.respondWith(t.command,t.id,()=>this.dataCaptureInstance.idCaptureReportSafariAbruptReload(t.environmentData)),!0}case"idCaptureSetExternalTransactionId":{let{data:t}=e;return this.respondWith(t.command,t.id,()=>this.dataCaptureInstance.idCaptureSetExternalTransactionId(t.transactionId)),!0}case"idCaptureGetExternalTransactionId":{let{data:t}=e;return this.respondWith(t.command,t.id,()=>this.dataCaptureInstance.idCaptureGetExternalTransactionId()),!0}default:return super.onMessage(e)}}};var Da=new F(self,{get:()=>self.Module,set:r=>{self.Module=r}});function wa(r){}})();\n'],{type:"application/javascript"})),t=new Worker(e,a);return URL.revokeObjectURL(e),t}var ne=class a extends DataCaptureLoader{constructor(){super(...arguments);this._name="IdCapture";}get dataCaptureWorker(){return (this._dataCaptureWorker)!=null||(this._dataCaptureWorker=st({name:this.name})),this._dataCaptureWorker}get name(){return this._name}get fixedWasmMemory(){return BrowserHelper.isIPhone()&&BrowserHelper.isSafari()?256:null}static async create(t){var i;let r=new a(t);return r.workerCommand("setLogLevel",{level:(i=t.logLevel)!=null?i:Logger.Level.Debug}),await r.load(),r}async workerCommand(...t){let[r,i,s]=t;return new Promise((o,u)=>{let c=this.workerCommandId++;this.workerTasks.set(c,{resolve:o,reject:u,command:r});let m={...i,command:r,id:c};this.dataCaptureWorker.postMessage(m,s);})}};var mt=Symbol("Comlink.proxy"),Kt=Symbol("Comlink.endpoint"),ht=Symbol("Comlink.releaseProxy"),Je=Symbol("Comlink.finalizer"),oe=Symbol("Comlink.thrown"),gt=a=>typeof a=="object"&&a!==null||typeof a=="function",Gt={canHandle:a=>gt(a)&&a[mt],serialize(a){let{port1:e,port2:t}=new MessageChannel;return Ct(a,e),[t,[t]]},deserialize(a){return a.start(),yt(a)}},Zt={canHandle:a=>gt(a)&&oe in a,serialize({value:a}){let e;return a instanceof Error?e={isError:true,value:{message:a.message,name:a.name,stack:a.stack}}:e={isError:false,value:a},[e,[]]},deserialize(a){throw a.isError?Object.assign(new Error(a.value.message),a.value):a.value}},ft=new Map([["proxy",Gt],["throw",Zt]]);function Qt(a,e){for(let t of a)if(e===t||t==="*"||t instanceof RegExp&&t.test(e))return true;return false}function Ct(a,e=globalThis,t=["*"]){e.addEventListener("message",function r(i){if(!i||!i.data)return;if(!Qt(t,i.origin)){console.warn(`Invalid origin '${i.origin}' for comlink proxy`);return}let{id:s,type:o,path:u}=Object.assign({path:[]},i.data),c=(i.data.argumentList||[]).map(P),m;try{let h=u.slice(0,-1).reduce((C,N)=>C[N],a),g=u.reduce((C,N)=>C[N],a);switch(o){case "GET":m=g;break;case "SET":h[u.slice(-1)[0]]=P(i.data.value),m=true;break;case "APPLY":m=g.apply(h,c);break;case "CONSTRUCT":{let C=new g(...c);m=vt(C);}break;case "ENDPOINT":{let{port1:C,port2:N}=new MessageChannel;Ct(a,N),m=tr(C,[C]);}break;case "RELEASE":m=void 0;break;default:return}}catch(h){m={value:h,[oe]:0};}Promise.resolve(m).catch(h=>({value:h,[oe]:0})).then(h=>{let[g,C]=de(h);e.postMessage(Object.assign(Object.assign({},g),{id:s}),C),o==="RELEASE"&&(e.removeEventListener("message",r),St(e),Je in a&&typeof a[Je]=="function"&&a[Je]());}).catch(h=>{let[g,C]=de({value:new TypeError("Unserializable return value"),[oe]:0});e.postMessage(Object.assign(Object.assign({},g),{id:s}),C);});}),e.start&&e.start();}function $t(a){return a.constructor.name==="MessagePort"}function St(a){$t(a)&&a.close();}function yt(a,e){let t=new Map;return a.addEventListener("message",function(i){let{data:s}=i;if(!s||!s.id)return;let o=t.get(s.id);if(o)try{o(s);}finally{t.delete(s.id);}}),ze(a,t,[],e)}function se(a){if(a)throw new Error("Proxy has been released and is not useable")}function bt(a){return j(a,new Map,{type:"RELEASE"}).then(()=>{St(a);})}var ue=new WeakMap,le="FinalizationRegistry"in globalThis&&new FinalizationRegistry(a=>{let e=(ue.get(a)||0)-1;ue.set(a,e),e===0&&bt(a);});function Yt(a,e){let t=(ue.get(e)||0)+1;ue.set(e,t),le&&le.register(a,e,a);}function Xt(a){le&&le.unregister(a);}function ze(a,e,t=[],r=function(){}){let i=false,s=new Proxy(r,{get(o,u){if(se(i),u===ht)return ()=>{Xt(s),bt(a),e.clear(),i=true;};if(u==="then"){if(t.length===0)return {then:()=>s};let c=j(a,e,{type:"GET",path:t.map(m=>m.toString())}).then(P);return c.then.bind(c)}return ze(a,e,[...t,u])},set(o,u,c){se(i);let[m,h]=de(c);return j(a,e,{type:"SET",path:[...t,u].map(g=>g.toString()),value:m},h).then(P)},apply(o,u,c){se(i);let m=t[t.length-1];if(m===Kt)return j(a,e,{type:"ENDPOINT"}).then(P);if(m==="bind")return ze(a,e,t.slice(0,-1));let[h,g]=ut(c);return j(a,e,{type:"APPLY",path:t.map(C=>C.toString()),argumentList:h},g).then(P)},construct(o,u){se(i);let[c,m]=ut(u);return j(a,e,{type:"CONSTRUCT",path:t.map(h=>h.toString()),argumentList:c},m).then(P)}});return Yt(s,a),s}function er(a){return Array.prototype.concat.apply([],a)}function ut(a){let e=a.map(de);return [e.map(t=>t[0]),er(e.map(t=>t[1]))]}var It=new WeakMap;function tr(a,e){return It.set(a,e),a}function vt(a){return Object.assign(a,{[mt]:true})}function de(a){for(let[e,t]of ft)if(t.canHandle(a)){let[r,i]=t.serialize(a);return [{type:"HANDLER",name:e,value:r},i]}return [{type:"RAW",value:a},It.get(a)||[]]}function P(a){switch(a.type){case "HANDLER":return ft.get(a.name).deserialize(a.value);case "RAW":return a.value}}function j(a,e,t,r){return new Promise(i=>{let s=rr();e.set(s,i),a.start&&a.start(),a.postMessage(Object.assign({id:s},t),r);})}function rr(){return new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-")}var lt="application/javascript",ar=(a,e={})=>{let t={skipSameOrigin:true,useBlob:true,...e};if(t.skipSameOrigin&&new URL(a).origin===self.location.origin)return Promise.resolve(a);let r;try{let i=new AbortController;r=i.signal;let s=setTimeout(()=>{i.abort();},3e3),o=()=>{clearTimeout(s),i.abort();};r.addEventListener("abort",o);}catch(i){}return new Promise((i,s)=>void fetch(a,{signal:r}).then(o=>o.text()).then(o=>{let u="";if(t.useBlob){let c=new Blob([o],{type:lt});u=URL.createObjectURL(c);}else u=`data:${lt},`+encodeURIComponent(o);i(u);}).catch(()=>{s(new Error(`Failed to fetch worker from ${a}`));}))},ir=function(){function a(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||false,i.configurable=true,"value"in i&&(i.writable=true),Object.defineProperty(e,i.key,i);}}return function(e,t,r){return t&&a(e.prototype,t),r&&a(e,r),e}}(),nr=sr(["",""],["",""]);function sr(a,e){return Object.freeze(Object.defineProperties(a,{raw:{value:Object.freeze(e)}}))}function or(a,e){if(!(a instanceof e))throw new TypeError("Cannot call a class as a function")}var y=function(){function a(){for(var e=this,t=arguments.length,r=Array(t),i=0;i<t;i++)r[i]=arguments[i];return or(this,a),this.tag=function(s){for(var o=arguments.length,u=Array(o>1?o-1:0),c=1;c<o;c++)u[c-1]=arguments[c];return typeof s=="function"?e.interimTag.bind(e,s):typeof s=="string"?e.transformEndResult(s):(s=s.map(e.transformString.bind(e)),e.transformEndResult(s.reduce(e.processSubstitutions.bind(e,u))))},r.length>0&&Array.isArray(r[0])&&(r=r[0]),this.transformers=r.map(function(s){return typeof s=="function"?s():s}),this.tag}return ir(a,[{key:"interimTag",value:function(t,r){for(var i=arguments.length,s=Array(i>2?i-2:0),o=2;o<i;o++)s[o-2]=arguments[o];return this.tag(nr,t.apply(void 0,[r].concat(s)))}},{key:"processSubstitutions",value:function(t,r,i){var s=this.transformSubstitution(t.shift(),r);return "".concat(r,s,i)}},{key:"transformString",value:function(t){var r=function(s,o){return o.onString?o.onString(s):s};return this.transformers.reduce(r,t)}},{key:"transformSubstitution",value:function(t,r){var i=function(o,u){return u.onSubstitution?u.onSubstitution(o,r):o};return this.transformers.reduce(i,t)}},{key:"transformEndResult",value:function(t){var r=function(s,o){return o.onEndResult?o.onEndResult(s):s};return this.transformers.reduce(r,t)}}]),a}(),b=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"";return {onEndResult:function(r){if(e==="")return r.trim();if(e=e.toLowerCase(),e==="start"||e==="left")return r.replace(/^\s*/,"");if(e==="end"||e==="right")return r.replace(/\s*$/,"");throw new Error("Side not supported: "+e)}}};function ur(a){if(Array.isArray(a)){for(var e=0,t=Array(a.length);e<a.length;e++)t[e]=a[e];return t}else return Array.from(a)}var x=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"initial";return {onEndResult:function(r){if(e==="initial"){var i=r.match(/^[^\S\n]*(?=\S)/gm),s=i&&Math.min.apply(Math,ur(i.map(function(u){return u.length})));if(s){var o=new RegExp("^.{"+s+"}","gm");return r.replace(o,"")}return r}if(e==="all")return r.replace(/^[^\S\n]+/gm,"");throw new Error("Unknown type: "+e)}}},E=function(e,t){return {onEndResult:function(i){if(e==null||t==null)throw new Error("replaceResultTransformer requires at least 2 arguments.");return i.replace(e,t)}}},B=function(e,t){return {onSubstitution:function(i,s){if(e==null||t==null)throw new Error("replaceSubstitutionTransformer requires at least 2 arguments.");return i==null?i:i.toString().replace(e,t)}}},lr={separator:"",conjunction:"",serial:false},D=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:lr;return {onSubstitution:function(r,i){if(Array.isArray(r)){var s=r.length,o=e.separator,u=e.conjunction,c=e.serial,m=i.match(/(\n?[^\S\n]+)$/);if(m?r=r.join(o+m[1]):r=r.join(o+" "),u&&s>1){var h=r.lastIndexOf(o);r=r.slice(0,h)+(c?o:"")+" "+u+r.slice(h+1);}}return r}}},Dt=function(e){return {onSubstitution:function(r,i){return typeof r=="string"&&r.includes(e)&&(r=r.split(e)),r}}},dt=function(e){return e!=null&&!Number.isNaN(e)&&typeof e!="boolean"},dr=function(){return {onSubstitution:function(t){return Array.isArray(t)?t.filter(dt):dt(t)?t:""}}};new y(D({separator:","}),x,b);new y(D({separator:",",conjunction:"and"}),x,b);new y(D({separator:",",conjunction:"or"}),x,b);new y(Dt(`
1
+ import {Color,CameraSettings,Feedback,Sound,Logger,Quadrilateral,DataCaptureError,Brush,Localization,OverrideState,DataCaptureContext,BrowserHelper,DataCaptureLoader,Point,assertUnreachable}from'@scandit/web-datacapture-core';import {isObject}from'@scandit/web-datacapture-core/build/js/private/utils/isObject.js';import {ViewClassNames}from'@scandit/web-datacapture-core/build/js/private/ViewClassNames.js';import {ShutterButton}from'@scandit/web-datacapture-core/build/js/private/ui/atoms/ShutterButton.js';var d={"scandit-datacapture-sdk-id-pthreads.wasm":{bytes:8780737},"scandit-datacapture-sdk-id-simd-pthreads.wasm":{bytes:8715190},"scandit-datacapture-sdk-id-simd.wasm":{bytes:8606829},"scandit-datacapture-sdk-id.wasm":{bytes:8672853}};var Fe=(s=>(s.Undefined="Undefined",s.RecoveredAfterFailure="RecoveredAfterFailure",s.InvalidLicenseKeyForVIZProcessing="InvalidLicenseKeyForVIZProcessing",s.InvalidSettingsForVIZProcessing="InvalidSettingsForVIZProcessing",s.InvalidLicenseKeyForParser="InvalidLicenseKeyForParser",s))(Fe||{}),v=class a extends Error{constructor(){super(...arguments);this._type="Undefined";this._message="";}get type(){return this._type}get message(){return this._message}static create(t){let r=new a;return t&&(r.name=t.type,r._type=t.type,r._message=t.message),r}static fromJSON(t){let r=new a;return r._type=t.type,r._message=t.message,r}};var ie=class{constructor(e){this.idCaptureWorkerManager=e;}get workerCommand(){return this.idCaptureWorkerManager.workerCommand.bind(this.idCaptureWorkerManager)}async getLicenseText(){return (await this.workerCommand("getIdOpenSourceSoftwareLicenseInfo",{})).licenseText}};var nt={"id.idCaptureOverlay.scanFrontSideHint":"","id.idCaptureOverlay.scanBackSideHint":"","id.idCaptureOverlay.moveCloseTextHint":"","id.idCaptureOverlay.moveFurtherAwayTextHint":"","id.idCaptureOverlay.tapShutterToScan":"","id.idCaptureOverlay.lookingForDocument":"","id.idCaptureOverlay.holdStill":""};function st(a){let e=URL.createObjectURL(new Blob(['"use strict";(()=>{var fe=(r,e)=>()=>(r&&(e=r(r=0)),e);var g,o=fe(()=>{g={"scandit-datacapture-sdk-id-pthreads.wasm":{bytes:8780737},"scandit-datacapture-sdk-id-simd-pthreads.wasm":{bytes:8715190},"scandit-datacapture-sdk-id-simd.wasm":{bytes:8606829},"scandit-datacapture-sdk-id.wasm":{bytes:8672853}}});o();o();o();o();var n;(r=>{(p=>(p.Debug="debug",p.Info="info",p.Warn="warn",p.Error="error",p.Quiet="quiet"))(r.Level||(r.Level={}));let e=new Map([["debug",1],["info",2],["warn",3],["error",4],["quiet",5]]),a="debug";function t(p){a=p}r.setLevel=t;function s(p,...h){if(!(e.get(a)>e.get(p)))switch(p){case"debug":{console.debug(...h);break}case"info":{console.log(...h);break}case"warn":{console.warn(...h);break}case"error":{console.error(...h);break}}}r.log=s;function i(...p){s("warn",...p)}r.warn=i;function d(...p){s("debug",...p)}r.debug=d;function l(...p){s("info",...p)}r.info=l;function C(...p){s("error",...p)}r.error=C})(n||(n={}));o();var Ie=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])),Se=()=>(async r=>{try{return typeof MessageChannel<"u"&&new MessageChannel().port1.postMessage(new SharedArrayBuffer(1)),WebAssembly.validate(r)}catch{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]));function be(){return typeof crossOriginIsolated>"u"?!1:crossOriginIsolated}function De(){try{return new WebAssembly.Memory({initial:1,maximum:1,shared:!0}).buffer.constructor.name==="SharedArrayBuffer"}catch{return!1}}async function G(){return Ie()}async function we(){if(!await Se())return!1;let r=null;try{r=new Worker(URL.createObjectURL(new Blob([\'postMessage("Worker" in self);\'],{type:"text/javascript"})),{name:"nestedWorkerTest"})}catch{return!1}return new Promise(e=>{if(r==null){e(!1);return}r.onmessage=a=>{r==null||r.terminate(),e(a.data)}})}async function K(){let r=await we();return be()&&De()&&r}o();function q(){if(typeof self=="object")return!1;let r=(()=>{if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;if(typeof self<"u")return self;throw new Error("No global object found")})();return Object.defineProperty(r,"globalThis",{value:r,writable:!0,configurable:!0}),!0}o();o();o();o();var A=class Z extends Error{constructor(e){super(e.message),Object.setPrototypeOf(this,Z.prototype),this.name=e.name}toString(){return`${this.name}: ${this.message}`}};var O=Promise.resolve(),B=!1,T=!1,M,H={writableDataPath:""};async function X(r){if(M==null)return;B=!0;let e=new Promise((a,t)=>{setTimeout(()=>{t(new A({name:"BlockedIndexedDB",message:"IndexedDB database is blocked"}))},1500)});try{await Promise.race([new Promise((a,t)=>{M==null||M(r,s=>{if(s!=null){t(s);return}a()})}),e])}finally{B=!1}}async function Y(r){return T||(B?(T=!0,O=O.then(async()=>(T=!1,X(r)))):O=X(r)),O}async function Q(r){H=r,M=FS.syncfs,FS.syncfs=(e,a)=>{let t=a,s=()=>{t()},i=d=>{t(d)};Y(e).then(s).catch(i)};try{FS.mkdir(H.writableDataPath)}catch(e){if(e.code!=="EEXIST")throw M=void 0,e}return FS.mount(IDBFS,{},H.writableDataPath),Y(!0)}o();o();o();var ee={};function Me(r){return[...new Uint8Array(r)].map(e=>{let a=e.toString(16);return a.length===1?`0${a}`:a}).join("")}async function*xe(r){let e=r.getReader();try{for(;;){let{done:a,value:t}=await e.read();if(a)return;yield t}}finally{e.releaseLock()}}async function ve(r){let e=[],a=0,t=0;for await(let i of xe(r))e.push(i),a+=i.length;let s=new Uint8Array(a);for(let i of e)s.set(i,t),t+=i.length;return s.buffer}var Re=(r=>(r.VALID="VALID",r.INVALID="INVALID",r.NOT_VERIFIABLE="NOT_VERIFIABLE",r))(Re||{});async function Le(r,e,a){if(typeof crypto.subtle.digest!="function")return n.log(n.Level.Warn,`Insecure context (see https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts): The hash of the Scandit Data Capture library WASM file found at ${a} could not be verified`),"NOT_VERIFIABLE";try{let t=r instanceof Promise?await r:r,s=await crypto.subtle.digest("SHA-256",t),i=Me(s);return e==null?(n.log(n.Level.Warn,"The library hash is not defined or empty, cannot correctly verify integrity."),"NOT_VERIFIABLE"):i===e?(n.log(n.Level.Debug,`Data Capture library WASM integrity found at ${a} has been verified correctly.`),"VALID"):(n.log(n.Level.Warn,`The Scandit Data Capture library WASM file found at ${a} seems invalid: expected file hash doesn\'t match (received: ${i}, expected: ${e}). Please ensure the correct Scandit Data Capture file (with correct version) is retrieved.`),"INVALID")}catch(t){return n.log(n.Level.Warn,"Wasm response could not be verified",t),"NOT_VERIFIABLE"}}var V=new Map([["br",4.4],["gzip",2.9],["none",1]]);function ke(r){var e;let a="content-encoding";if(r==null||r.get(a)==null)return V.get("none");let t=new Set(((e=r.get(a))!=null?e:"").split(",").map(s=>s.trim()));for(let[s,i]of V)if(t.has(s))return i;return V.get("none")}function Ae(r){var e,a;if(r==null)return 0;let t=(e=ke(r))!=null?e:1,s=Number.parseInt((a=r.get("content-length"))!=null?a:"0",10);return Number.isNaN(s)?0:Math.floor(s*t*100)/100}function Oe(r){let{pathname:e}=new URL(r);for(let[a,t]of Object.entries(ee))if(e.endsWith(a))return t.bytes;return 0}function te(r){ee=r}var Ee=(r,e)=>{let a=Ae(e);return a===0?Oe(r):a};function Pe(r,e,a,{onProgress:t,onError:s,onComplete:i}){if(!e.body)return[e];let d=Ee(r,e.headers),l=0,C=0;if(typeof TransformStream>"u")return n.warn("TransformStream is not supported in this environment. Progress tracking will be disabled."),[e];let[p,h]=a?e.body.tee():[e.body],c=p.pipeThrough(new TransformStream({async transform(m,y){try{l+=m.length,C=Number((l/d*100).toFixed(2)),d>0&&m.length>0&&C<100?t==null||t({percentage:C,loadedBytes:l,privateUri:r}):d===0&&m.length>0&&(t==null||t({percentage:null,loadedBytes:l,privateUri:r})),y.enqueue(m)}catch(S){y.error(S),s==null||s({error:S})}},flush(m){t==null||t({percentage:100,loadedBytes:l,privateUri:r}),i==null||i({percentage:100,loadedBytes:l,privateUri:r}),m.terminate()}}));return[new Response(c,{headers:new Headers(e.headers),status:e.status,statusText:e.statusText}),h]}async function J({wasmURI:r,expectedHash:e,verifyResponseHash:a,onProgress:t,onComplete:s,onError:i,referredOrigin:d}){let l=await fetch(r,{referrerPolicy:"origin",referrer:d!=null?d:""});if(!l.ok)throw new Error(`HTTP status code is not ok: ${l.status}, ${l.statusText}`);let[C,p]=Pe(r,l,a,{onProgress:t,onError:i,onComplete:s});return p!=null&&Le(ve(p),e,r),C}function ae({wasmURI:r,expectedHash:e,verifyResponseHash:a,progressCallback:t,successCallback:s,errorCallback:i,importObject:d,referredOrigin:l}){async function C(h){try{let c=await J({wasmURI:r,expectedHash:e,verifyResponseHash:a,onProgress:t,referredOrigin:l}),m=await(h!=null?h:c).arrayBuffer(),y=await self.WebAssembly.instantiate(m,d);s(y.instance,y.module)}catch(c){n.log(n.Level.Error,c),n.log(n.Level.Error,`Couldn\'t instantiate Scandit SDK DataCapture library at ${r}, did you configure the path for it correctly?`),i==null||i(c)}}async function p(){let h;try{h=await J({wasmURI:r,expectedHash:e,verifyResponseHash:a,onProgress:t,referredOrigin:l});let c=await self.WebAssembly.instantiateStreaming(h,d);s(c.instance,c.module)}catch(c){n.log(n.Level.Warn,c),n.log(n.Level.Warn,"WebAssembly streaming compile failed. Falling back to ArrayBuffer instantiation (this will make things slower)"),C((h==null?void 0:h.bodyUsed)===!0?void 0:h)}}typeof self.WebAssembly.instantiateStreaming=="function"?p():C()}async function _(r,e,a,t){return new Promise((s,i)=>{r().then(s).catch(d=>{let l=e*2;if(l>a){i(d);return}t(d),self.setTimeout(()=>{_(r,l,a,t).then(s).catch(i)},e)})})}function z(r){var e,a;let t="unknown";if((e=r.href)!=null&&e.startsWith("blob:null/"))t="localhost";else{let s=((a=r.pathname)==null?void 0:a.length)>1&&!r.pathname.startsWith("/");t=new URL(s?r.pathname:r.origin).hostname}return t.startsWith("[")&&t.endsWith("]")?(t=t.slice(1,-1),t):(/^(\\d{1,3}\\.){3}\\d{1,3}$/.test(t)&&(t=t.split(".").map(s=>Number.parseInt(s,10).toString()).join(".")),t)}async function re(r,e){async function a(){return importScripts(r)}try{await _(a,250,4e3,s=>{n.log(n.Level.Warn,s),n.log(n.Level.Warn,`Couldn\'t retrieve Scandit Data Capture library at ${r}, retrying...`)}),self.Module.mainScriptUrlOrBlob=r;let t=self.SDC_WASM_JS_VERSION;return t!==e&&n.log(n.Level.Warn,`The Scandit Data Capture library JS file found at ${r} seems invalid: expected version doesn\'t match (received: ${t}, expected: ${e}). Please ensure the correct Scandit Data Capture file (with correct version) is retrieved.`),!0}catch(t){return n.log(n.Level.Error,t),!1}}o();function We(r){return/^https?:\\/\\/(?:[^./]*\\.)*cdn.jsdelivr.net\\//.test(r)?{result:!0,cdnBaseURL:"https://cdn.jsdelivr.net/npm/"}:/^https?:\\/\\/(?:[^./]*\\.)*unpkg.com\\//.test(r)?{result:!0,cdnBaseURL:"https://unpkg.com/"}:{result:!1,cdnBaseURL:""}}function Fe(r){let e=/@scandit\\/web-datacapture-[a-z]+/i.exec(r);return e?e[0]:null}function se(r,e,a){let t=e,s=We(t);if(s.result){let d=Fe(t);d!=null&&(t=`${s.cdnBaseURL}${d}@${r}/sdc-lib/`)}let i=a.replace(".wasm","");return s.result?{jsURI:`${t}${i}.js`,wasmURI:`${t}${i}.wasm`}:{jsURI:`${t}${i}.js?v=${r}`,wasmURI:`${t}${i}.wasm?v=${r}`}}o();var E;(r=>{function e(){return"7.6.2"}r.sdkVersion=e})(E||(E={}));o();var ie=class{constructor(){this.promise=new Promise((r,e)=>{this.reject=e,this.resolve=r})}};var ne=class oe{constructor(e,a){this.hintPresenterV2=null,this.MAX_NUMBER_OF_IMAGES_IN_FRAME_DATA_POOL=10,this.redrawInterval=1e3/30,this.redrawRequests=[],this._isDrawLoopRunning=!1,this.frameDataPool=new Map,this.lastFrameCounter=-1,this.poorMansBenchmarkLogs=!1,this.writableDataPathStandard="/scandit_sync_folder",this.resourceFilesSubfolder="resources",this.performanceMetricsReporterTimer=void 0,this.performanceMetrics={frameDataPoolSize:0,processedFramesCount:0,redrawRequestsCount:0,actualRedrawsCount:0},this.gestureListener=null,this.webPlatformHintPresenter=null,this.moduleHandler=e,this.workerFunctions=a,this._loadProgressCallback=this._loadProgressCallback.bind(this),te(this.getWasmMetadata())}get Module(){return this.moduleHandler.get()}set isDrawLoopRunning(e){this._isDrawLoopRunning=e,!e&&typeof this.loopTimeoutId=="number"&&(clearTimeout(this.loopTimeoutId),this.loopTimeoutId=void 0)}get isDrawLoopRunning(){return this._isDrawLoopRunning}convertToLoadableFrameData(e){let a=this.getNextFrameId();this.frameDataPool.set(a,new Uint8ClampedArray(e.getFrameData()));let t=this.lastUsedModuleMirrorAxis==null?!1:this.lastUsedModuleMirrorAxis!==this.Module.Axis.None;return{frameId:a,width:e.getWidth(),height:e.getHeight(),isFrameSourceMirrored:t}}createContext(e){var a,t,s,i,d;let l=this.getModeDeserializers(),C=z(location);(C==="localhost"||C==="127.0.0.1")&&navigator.userAgent.includes("Electron")&&e.appName!=null&&(C+=`-${e.appName}`),this.parentDomain=e.parentDomain,this.contextDeserializer=new this.Module.DataCaptureContextDeserializer(this.writableDataPath,e.deviceId,e.context.deviceModelName,C,this.parentDomain,l,e.delayedRegistration,e.highEndBlurryRecognition,this.resourcePath);let p=this.contextDeserializer.contextFromJson(JSON.stringify(e.context));if(p==null){let u=this.contextDeserializer.getLastError();throw new Error(`Could not create the context: ${u}`)}let h=p.getView();this.context=p.getContext(),p.delete();let c=this.Module.DataCaptureContextListener.extend("DataCaptureContextListener",{didChangeStatus:(u,I)=>{this.contextDidChangeStatus(JSON.parse(I.toJson())),u.delete()},didStartObservingContext:u=>{this.didStartObservingContext(),u.delete()},didStopObservingContext:u=>{u.delete()}}),m=this.Module.DataCaptureContextFrameListener.extend("DataCaptureContextFrameListener",{onObservationStarted:u=>{u.delete()},onObservationStopped:u=>{u.delete()},onFrameProcessingStarted:(u,I)=>{this.workerFunctions.postMessage({type:"onFrameProcessingStarted"}),I.delete(),u.delete()},onFrameProcessingFinished:(u,I)=>{this.workerFunctions.postMessage({type:"onFrameProcessingFinished"}),I.delete(),u.delete()},onFrameSkipped:(u,I)=>{this.workerFunctions.postMessage({type:"onFrameSkipped"}),I.delete(),u.delete()}}),y=this.Module.GestureRecognizer.extend("GestureRecognizer",{setGestureListener:(u,I)=>{var L;(L=this.gestureListener)==null||L.delete(),this.gestureListener=u.clone(),u.delete()}});(a=this.gestureRecognizer)==null||a.delete(),this.gestureRecognizer=new y;let S=new c;this.context.addListener(S),S.delete();let b=new m;this.context.addFrameListener(b),b.delete(),this.setView(h),(t=this.view)==null||t.setGestureRecognizer(this.gestureRecognizer);let w=this.Module.PlatformHintPresenter.extend("PlatformHintPresenter",{setHintPresenter:u=>{u.delete()},showToast:u=>{this.workerFunctions.postMessage({type:"showToast",payload:JSON.parse(u)})},hideToast:u=>{this.workerFunctions.postMessage({type:"hideToast",payload:JSON.parse(u)})},showGuidance:u=>{this.workerFunctions.postMessage({type:"showGuidance",payload:JSON.parse(u)})},hideGuidance:u=>{this.workerFunctions.postMessage({type:"hideGuidance",payload:JSON.parse(u)})},startUpdateTimer:u=>{this.workerFunctions.postMessage({type:"startUpdateTimer",payload:{duration:{unit:"ms",value:u}}})},stopUpdateTimer:()=>{this.workerFunctions.postMessage({type:"stopUpdateTimer"})}});(s=this.hintPresenterV2)==null||s.delete(),this.hintPresenterV2=null,(i=this.webPlatformHintPresenter)==null||i.delete(),this.webPlatformHintPresenter=null,this.webPlatformHintPresenter=new w,this.view&&(this.hintPresenterV2=new this.Module.HintPresenterV2(this.webPlatformHintPresenter),(d=this.view)==null||d.setHintPresenterV2(this.hintPresenterV2))}onTap(e){var a;(a=this.gestureListener)==null||a.onTap(JSON.stringify(e))}hintPresenterV2Update(){var e;(e=this.hintPresenterV2)==null||e.update()}startReportingPerformanceMetrics(){this.performanceMetricsReporterTimer==null&&(this.performanceMetricsReporterTimer=setInterval(()=>{this.reportPerformanceMetrics();for(let e of Object.keys(this.performanceMetrics))this.performanceMetrics[e]=0},1e3))}async reportPerformanceMetrics(){this.workerFunctions.postMessage({type:"performanceMetricsReport",payload:{...this.performanceMetrics}})}deleteFrameData(e){this.frameDataPool.delete(e)}dispose(){var e,a,t,s;this.context.dispose(),this.frameDataPool.clear(),this.isDrawLoopRunning=!1,this.lastFrameCounter=-1,(e=this.gestureRecognizer)==null||e.delete(),this.gestureRecognizer=null,(a=this.gestureListener)==null||a.delete(),this.gestureListener=null,(t=this.hintPresenterV2)==null||t.delete(),this.hintPresenterV2=null,(s=this.webPlatformHintPresenter)==null||s.delete(),this.webPlatformHintPresenter=null}flushAnalytics(){this.context.flushAnalytics()}extractCentaurusLicense(e){return{payload:{centaurus:{licenseKey:this.Module.LicenseUtils[oe.get3dPartyLicenseKeyMethodName](e)}}}}getModeDeserializers(){return new this.Module.VectorDataCaptureModeDeserializer}loadLibrary(e){return this.libraryLoadingPromise!=null?this.libraryLoadingPromise:(this.libraryLoadingPromise=this.setup(e),this.libraryLoadingPromise)}processFrame(e){var a;if(this.context==null)return{payload:e,transferables:[e.data.buffer]};let t=e.data,s=e.colorType==="GRAYSCALE"?this.Module.ImageBufferFormat.Grayscale8:this.Module.ImageBufferFormat.Rgba8888,i=this.Module.allocateUint8Array(t.byteLength);return this.Module.HEAPU8.set(t,i),(a=this.imageFrameSource)==null||a.outputFrame(i,e.width,e.height,s),{payload:e,transferables:[e.data.buffer]}}reportCameraProperties(e){this.context.setCameraProperties(e.deviceId,e.isFrontFacing,e.hasAutofocus)}requestFrameData(e){let a=this.frameDataPool.get(e);return a==null?{payload:{data:null}}:{payload:{data:a},transferables:[a.buffer]}}scheduleRedraw(e,a){this.addRedrawRequest(a),this.isDrawLoopRunning||this.startDrawLoop(e)}sendViewRefreshCommands(e){this.workerFunctions.postMessage({type:"draw",payload:e},[e.buffer])}setFrameSource(e,a){var t;this.lastUsedModuleMirrorAxis=this.mapMirrorAxisOnModule(e),(t=this.imageFrameSource)==null||t.delete(),this.imageFrameSource=new this.Module.ImageBufferFrameSource(this.lastUsedModuleMirrorAxis,a,0),this.context.setFrameSource(this.imageFrameSource)}startDrawLoop(e){this.isDrawLoopRunning=!0;let a=i=>this.redrawRequests.length>0&&this.redrawRequests[0]<=i,t=i=>{for(;this.redrawRequests.length>0&&this.redrawRequests[0]<=i;)this.redrawRequests.shift()},s=()=>{this.loopTimeoutId=setTimeout(()=>{if(!this.isDrawLoopRunning)return;let i=performance.now();if(a(i)){t(i),e.draw();let d=e.getDrawCommands();this.sendViewRefreshCommands(new Uint8Array(d))}s()},this.redrawInterval)};s()}updateContext(e){if(this.context!=null&&this.contextDeserializer!=null){e.view!=null&&!e.view.visible&&this.context.flushAnalytics();let a=this.onBeforeUpdateContextHook(e),t=this.contextDeserializer.updateContextFromJson(this.context,this.view,JSON.stringify(a.context));if(t==null){let i=this.contextDeserializer.getLastError();throw new Error(`Could not update the context: ${i}`)}this.context.delete(),this.context=t.getContext();let s=t.getView();t.delete(),s!=null&&a.view!=null&&s.setViewSize(a.view.width,a.view.height,a.view.orientation),!this.hintPresenterV2&&this.webPlatformHintPresenter&&(this.hintPresenterV2=new this.Module.HintPresenterV2(this.webPlatformHintPresenter)),s!=null&&this.hintPresenterV2&&s.setHintPresenterV2(this.hintPresenterV2),this.gestureRecognizer!=null&&(s==null||s.setGestureRecognizer(this.gestureRecognizer)),this.setView(s),n.debug("context updated",a)}}onBeforeUpdateContextHook(e){return e}onDocumentVisibilityChange(e){e==="hidden"&&this.context.flushAnalytics()}isFeatureSupported(e){return{payload:{supported:this.context.isFeatureSupported(e)}}}getViewfinderInfo(){var e,a;return{payload:{isDisplayingViewfinder:(a=(e=this.view)==null?void 0:e.isDisplayingViewfinder())!=null?a:!1,rect:JSON.parse(this.view.getViewfinderRect())}}}getOpenSourceSoftwareLicenseInfo(){return{payload:{licenseText:this.Module.OpenSourceSoftwareLicenseInfo.getLicenseText()}}}getNextFrameId(){return this.lastFrameCounter++,this.lastFrameCounter>=this.MAX_NUMBER_OF_IMAGES_IN_FRAME_DATA_POOL&&(this.lastFrameCounter=0),this.lastFrameCounter}getWasmDynamicLibraries(e){return this.getWasmSideModuleFileName()==null?[]:[`${e.replace(/\\/[^/]*$/,"/")}${this.getWasmSideModuleFileName()}`]}getWasmCoreExpectedHash(e,a){return a?e?"a92963d9afa21cfbcb66855a15b5dbbe67a3eddaa7689545fdaeecca4ec85cea":"b8912949cd839410d2f796559aca6c9f65573a7a093106b99b9a1f4fac94747b":e?"a9534ba6bcfcdbc24dbd59798a99591fdc4eb39b562e01bbd1ce343fff378cc5":""}getWasmCoreFileName(e,a){return a?e?"scandit-datacapture-sdk-id-simd-pthreads.wasm":"scandit-datacapture-sdk-id-pthreads.wasm":e?"scandit-datacapture-sdk-id-simd.wasm":""}getWasmMetadata(){return g}getWasmSideModuleFileName(){return""}_loadProgressCallback(e){this.workerFunctions.postMessage({type:"loadLibraryProgress",payload:e})}addRedrawRequest(e){this.redrawRequests.push(Math.round(performance.now())+e),this.redrawRequests.sort((a,t)=>a-t)}contextDidChangeStatus(e){e.code===260?e.message=e.message.replace("domain name",`domain name (${z(location)})`):e.code===265&&(e.message=e.message.replace("domain name",`domain name (${this.parentDomain})`)),this.workerFunctions.postMessage({type:"contextDidChangeStatus",payload:e})}didStartObservingContext(){this.workerFunctions.postMessage({type:"didStartObservingContext"})}mapMirrorAxisOnModule(e){switch(e){case"None":return this.Module.Axis.None;case"X":return this.Module.Axis.X;case"Y":return this.Module.Axis.Y;default:return this.Module.Axis.None}}setView(e){this.view=e,this.setViewRefreshHandler(e),e==null&&(this.isDrawLoopRunning=!1,this.sendViewRefreshCommands(new Uint8Array([])))}addNativeOverlay(e){n.warn("addNativeOverlay has not been implemented for this module",e)}removeNativeOverlay(e){n.warn("removeNativeOverlay has not been implemented for this module",e)}setViewRefreshHandler(e){if(e==null||e.isViewRefreshHandlerSet)return;let a=this.Module.NeedsRedrawDelegate.extend("NeedsRedrawDelegate",{setNeedsRedrawIn:this.scheduleRedraw.bind(this,e)}),t=new a;e.setNeedsRedrawDelegate(t),e.isViewRefreshHandlerSet=!0}setupDataDecoding(){let e=this.moduleHandler.get(),a=e.DataDecoding.extend("DataDecoding",{decode(t,s){try{let i=JSON.parse(s),d=[];for(let l of i){let C=new TextDecoder(l.ianaName,{fatal:!0});d.push(C.decode(t.slice(l.startIndex,l.endIndex)))}return d.join("")}catch{return""}}});e.setDataDecoding(new a)}start(e,a,t){e&&a&&(this.setupDataDecoding(),this.moduleHandler.get().callMain(),this.moduleHandler.get().__emscripten_proxy_main!==void 0||t())}getWritableDataPath(e){return e!=null?(n.debug(`IndexedDB database name override in use to recover from blocked standard database: ${e}`),e):this.writableDataPathStandard}numOfMBToPages(e){return Math.ceil(1024*e*1024/64/1024)}async setup({libraryLocation:e,locationPath:a,writableDataPathOverride:t,overrideThreadsSupport:s,overrideSimdSupport:i,verifyResponseHash:d,referredOrigin:l,fixedWasmMemory:C}){var p;let h=!1,c=!1;this.writableDataPath=this.getWritableDataPath(t),this.resourcePath=`${e}${this.resourceFilesSubfolder}/`,self.path=a;let{resolve:m,reject:y,promise:S}=new ie,b=E.sdkVersion();if(b==="")throw new A({name:"Invalid library version",message:"Library version is not defined or empty, cannot generate proper path to library files."});let[w,u]=await Promise.all([G(),K()]);s!=="auto"&&(u=s==="on"),i!=="auto"&&(w=i==="on");let I=this.getWasmCoreFileName(w,u),L=se(b,e,I),{jsURI:N,wasmURI:j}=L,Ce={instantiateWasm:(D,ge)=>(ae({importObject:D,wasmURI:j,expectedHash:this.getWasmCoreExpectedHash(w,u),verifyResponseHash:d,successCallback:ge,progressCallback:this._loadProgressCallback,errorCallback:he=>{y(he)},referredOrigin:l}),{})},k=C===null?null:new WebAssembly.Memory({initial:this.numOfMBToPages(C),maximum:this.numOfMBToPages(300),shared:u});return k!==null&&n.log(n.Level.Debug,"Fixed wasmMemory set",k),this.moduleHandler.set({...k?{wasmMemory:k}:{},mainScriptUrlOrBlob:N,canvas:(p=this.workerFunctions.getOffscreenCanvas())!=null?p:{getContext:()=>null},...Ce,dynamicLibraries:this.getWasmDynamicLibraries(j),locateFile:D=>e+D,noInitialRun:!0,preRun:[async()=>{try{await Q({writableDataPath:this.writableDataPath})}catch(D){if(D.name==="BlockedIndexedDB"){y(D.toString());return}n.log(n.Level.Debug,"No IndexedDB support, some data will not be persisted:",D)}c=!0,this.start(c,h,m)}],onMainComplete:()=>{if([h,c].includes(!1)){n.log(n.Level.Warn,{runtimeLoaded:h,fileSystemSynced:c},"Both runtimeLoaded and fileSystemSynced should be true when calling onMainComplete"),y("onMainComplete has been called but runtime or file system was not ready.");return}m()},onRuntimeInitialized:()=>{h=!0,this.start(c,h,m)},print:D=>{n.log(n.Level.Info,D)}}),await re(N,b)||y(`Couldn\'t retrieve Scandit Data Capture library at ${N}, did you configure the path for it correctly?`),S}};ne.get3dPartyLicenseKeyMethodName=atob("Z2V0QmxpbmtJZExpY2Vuc2VLZXk=");var x=ne;o();var Ne=class{constructor(r){if(typeof r!="function")throw new TypeError("FinalizationRegistry callback must be a function")}register(r,e,a){}unregister(r){return!1}};function de(r){typeof r.FinalizationRegistry>"u"&&(r.FinalizationRegistry=Ne)}o();o();function v(r){return typeof r=="object"&&r!=null}function R(r){if(typeof r=="string")return r;if(v(r)){if(typeof r.message=="string")return r.message}else if(typeof(r==null?void 0:r.toString)=="function")return r.toString();return"unknown error"}o();function ue(r){return typeof r=="object"&&r!=null&&r.document==null&&"addEventListener"in r&&typeof r.importScripts=="function"}o();function le(r){console.warn("Reached unexpected case",r)}var U=class{constructor(r,e){this.onMessageListener=this.onMessage.bind(this),this.workerSelf=r,this.dataCaptureInstance=new x(e,{postMessage:this.postMessage.bind(this),getOffscreenCanvas:this.getOffscreenCanvas.bind(this)}),ue(r)&&(de(r),this.listenToMessages())}listenToMessages(){this.workerSelf.addEventListener("message",this.onMessageListener),this.workerSelf.addEventListener("error",r=>{n.log(n.Level.Error,r)}),this.workerSelf.addEventListener("messageerror",r=>{n.log(n.Level.Error,r)})}postMessage(r,e){this.workerSelf.postMessage(r,e!=null?e:[])}getOffscreenCanvas(){if(typeof this.workerSelf.OffscreenCanvas=="function")return new this.workerSelf.OffscreenCanvas(32,32)}hasPayload(r){return v(r)&&"payload"in r}hasTransferables(r){return v(r)&&Array.isArray(r.transferables)}async respondWith(r,e,a){let t=null,s;try{s=a(),s instanceof Promise&&(s=await s)}catch(d){s=void 0,t=R(d)}let i={type:"workerTaskId",command:r,id:e,payload:this.hasPayload(s)?s.payload:void 0};t!=null&&(i.error=t),this.postMessage(i,this.hasTransferables(s)?s.transferables:[])}onMessage(r){switch(r.data.command){case"loadLibrary":{{let{data:e}=r;this.respondWith(e.command,e.id,async()=>this.dataCaptureInstance.loadLibrary({libraryLocation:e.libraryLocation,locationPath:e.locationPath,referredOrigin:e.referredOrigin,writableDataPathOverride:e.writableDataPathOverride,overrideThreadsSupport:e.overrideThreadsSupport,overrideSimdSupport:e.overrideSimdSupport,verifyResponseHash:e.verifyResponseHash,fixedWasmMemory:e.fixedWasmMemory}))}break}case"onTap":{{let{data:e}=r;this.respondWith(e.command,e.id,async()=>{this.dataCaptureInstance.onTap(e.point)})}break}case"hintPresenterV2update":{{let{data:e}=r;this.respondWith(e.command,e.id,async()=>{this.dataCaptureInstance.hintPresenterV2Update()})}break}case"createContext":{{let{data:e}=r;this.respondWith(e.command,e.id,()=>this.dataCaptureInstance.createContext({context:e.context,deviceId:e.deviceId,delayedRegistration:e.delayedRegistration,highEndBlurryRecognition:e.highEndBlurryRecognition,appName:e.appName,parentDomain:e.parentDomain}))}break}case"setFrameSource":{{let{data:e}=r;this.respondWith(e.command,e.id,()=>this.dataCaptureInstance.setFrameSource(e.mirrorAxis,e.isCameraFrameSource))}break}case"processFrame":{{let{data:e}=r;this.respondWith(e.command,e.id,()=>this.dataCaptureInstance.processFrame({data:e.data,width:e.width,height:e.height,colorType:e.colorType}))}break}case"requestFrameData":{{let{data:e}=r;this.respondWith(e.command,e.id,()=>this.dataCaptureInstance.requestFrameData(e.frameId))}break}case"deleteFrameData":{{let{data:e}=r;this.respondWith(e.command,e.id,()=>{this.dataCaptureInstance.deleteFrameData(e.frameId)})}break}case"updateContext":{{let{data:e}=r;this.respondWith(e.command,e.id,async()=>this.dataCaptureInstance.updateContext(e))}break}case"dispose":{this.respondWith(r.data.command,r.data.id,()=>this.dataCaptureInstance.dispose());break}case"flushAnalytics":{this.respondWith(r.data.command,r.data.id,()=>{this.dataCaptureInstance.flushAnalytics()});break}case"reportCameraProperties":{{let{data:e}=r;this.respondWith(e.command,e.id,async()=>this.dataCaptureInstance.reportCameraProperties(e))}break}case"setLogLevel":{{let{data:e}=r;this.respondWith(e.command,e.id,()=>{n.setLevel(e.level)})}break}case"extractCentaurusLicense":{{let{data:e}=r;this.respondWith(e.command,e.id,()=>this.dataCaptureInstance.extractCentaurusLicense(e.licenseKey))}break}case"documentVisibility":{{let{data:e}=r;this.respondWith(e.command,e.id,()=>{this.dataCaptureInstance.onDocumentVisibilityChange(e.state)})}break}case"isFeatureSupported":{{let{data:e}=r;this.respondWith(e.command,e.id,()=>this.dataCaptureInstance.isFeatureSupported(e.feature))}break}case"getViewfinderInfo":{{let{data:e}=r;this.respondWith(e.command,e.id,()=>this.dataCaptureInstance.getViewfinderInfo())}break}case"getOpenSourceSoftwareLicenseInfo":{{let{data:e}=r;this.respondWith(e.command,e.id,()=>this.dataCaptureInstance.getOpenSourceSoftwareLicenseInfo())}break}case"addNativeOverlay":this.dataCaptureInstance.addNativeOverlay(r);break;case"removeNativeOverlay":this.dataCaptureInstance.removeNativeOverlay(r);break;default:return le(r.data),!1}return!0}};q();o();o();o();o();o();function pe(r){return r.ok()}function ce(r,e){return pe(r)?r.value():e}function me(r,e){return pe(r)?e:r.error()}function f(r,e){return r===void 0?e:r}var P=class{constructor(e,a,t){this.SDCIdCaptureMode=null;this.lastResult="";this.lastError="";this.lastLocalizedId="";this.lastDetectionIssue="";this.coreEngine=e,this.Module=e.Module,this.workerFunctions=e.workerFunctions,this.start(a,t)}start(e,a){this.initHintPresenterIfNotInitialized();let t=this.Module.IdCaptureListener.extend("IdCaptureListener",{onSessionUpdated:(c,m)=>{c.delete(),m.delete()},onIdCaptured:(c,m)=>{this.onIdCapturedCallback(m),c.delete(),m.delete()},onIdPartiallyCaptured:(c,m)=>{this.onIdPartiallyCapturedCallback(m),c.delete(),m.delete()},onIdRejected:(c,m,y)=>{this.onIdRejectedCallback(m,y),c.delete(),m==null||m.delete()},onIdLocalized:(c,m)=>{this.onIdLocalizedCallback(m),c.delete()},onShutterButtonPositionChanged:c=>{this.onShutterButtonPositionChangedCallback(c)},onShutterButtonStateChanged:c=>{this.onShutterButtonStateChangedCallback(c)}}),s=this.Module.Feedback.extend("Feedback",{emit:()=>{this.workerFunctions.postMessage({type:"idCaptureIdCapturedFeedback"})}}),i=this.Module.Feedback.extend("Feedback",{emit:()=>{this.workerFunctions.postMessage({type:"idCaptureIdRejectedFeedback"})}}),d=this.Module.IdCaptureBackend.extend("IdCaptureBackend",{getLastError:()=>this.lastError,getLastResult:()=>this.backendGetLastResult(),getLocalizedOnlyId:()=>this.lastLocalizedId,getLastIssue:()=>this.lastDetectionIssue,processFrame:()=>{},reset:this.onResetFromSDC.bind(this),setDetectionOnlyMode:this.setDetectionOnlyMode.bind(this)}),l=new d;this.SDCIdCaptureMode=new this.Module.IdCapture(e,l,a,null),l.delete();let C=new t;this.SDCIdCaptureMode.addListener(C),C.delete();let p=new s,h=new i;this.SDCIdCaptureMode.setFeedbacks(p,h),p.delete(),h.delete()}getSDCIdCaptureMode(){if(!this.SDCIdCaptureMode)throw new Error("IdCaptureMode not initialized");return this.SDCIdCaptureMode}backendGetLastResult(){return this.lastResult}setLastResult(e){this.lastResult=e}setLastError(e){this.lastError=e}setLastLocalizedId(e){this.lastLocalizedId=e}setLastDetectionIssue(e){this.lastDetectionIssue=e}applySettings(e){var a;(a=this.SDCIdCaptureMode)==null||a.applySettings(JSON.stringify(e))}reset(){var e;(e=this.SDCIdCaptureMode)==null||e.reset()}setExternalTransactionId(e){var a;(a=this.SDCIdCaptureMode)==null||a.setExternalTransactionId(e)}getExternalTransactionId(){var e;return(e=this.SDCIdCaptureMode)==null?void 0:e.getExternalTransactionId()}parseCode(e){if(this.SDCIdCaptureMode){let a=this.SDCIdCaptureMode.parse(e);if(a.ok()){let t=ce(a,null);if(t!=null){let s=this.extractCaptureId(t);if(s!=null)return{status:"success",capturedId:s}}}else return{status:"error",error:me(a,"Undefined error")}}return null}getCentaurusSettings(){let e=this.getSDCIdCaptureMode().getCentaurusSettings();return JSON.parse(e)}dataConsistencyVerifyCapture(e){let t=new this.Module.DataConsistencyVerifier(this.coreEngine.context).verify(JSON.stringify(e));if(t==null)return null;let s=JSON.parse(t.toJson());return t.delete(),s}async barcodeVerifyAamvaCapture(e,a){return new Promise(t=>{let s=this.Module.AamvaBarcodeVerifier.extend("AamvaBarcodeVerifier",{retriggerVerificationIn(d){setTimeout(()=>{i.startVerification(JSON.stringify(e))},d)},verificationEnded(){let d=i.getBarcodeVerificationResponse();t({isSuccess:d.isSuccess,error:d.error,allChecksPassed:d.allChecksPassed,serverResponseJSON:d.serverResponseJson})}}),i=new s;i.initialize(this.coreEngine.context,a==null?"":a),i.startVerification(JSON.stringify(e))})}onResetFromSDC(e){this.workerFunctions.postMessage({type:"idCaptureBackendReset"}),this.lastError="",this.lastResult="",this.lastLocalizedId=""}setDetectionOnlyMode(e){this.workerFunctions.postMessage({type:"idCaptureDetectionOnlyMode",payload:{detectionOnlyMode:e}})}onIdCapturedCallback(e){let a=this.extractCaptureId(e);a&&this.workerFunctions.postMessage({type:"idCaptureDidCaptureId",payload:{capturedId:a}},this.extractImageTransferablesFromCapturedId(a))}onIdPartiallyCapturedCallback(e){let a=this.extractCaptureId(e);a&&this.workerFunctions.postMessage({type:"idCaptureDidPartiallyCaptureId",payload:{capturedId:a}},this.extractImageTransferablesFromCapturedId(a))}onIdRejectedCallback(e,a){let t=this.extractCaptureId(e);this.workerFunctions.postMessage({type:"idCaptureDidRejectId",payload:{capturedId:t,rejectionReason:a}},t?this.extractImageTransferablesFromCapturedId(t):[])}onIdLocalizedCallback(e){this.workerFunctions.postMessage({type:"idCaptureDidLocalizeId",payload:{localization:JSON.parse(e)}})}extractCaptureId(e){var c,m,y,S,b,w,u,I;if(e==null)return null;let a=e.getImages(),t=a.getFrameFront(),s=a.getFrameBack(),i=f(a.getFace(),null),d=f(a.getCroppedDocumentFront(),null),l=f(a.getCroppedDocumentBack(),null),C={front:{face:i,croppedDocument:d,frame:{data:t?new Uint8ClampedArray(t.getFrameData()):null,width:(c=t==null?void 0:t.getWidth())!=null?c:0,height:(m=t==null?void 0:t.getHeight())!=null?m:0,mirrorAxis:(y=t==null?void 0:t.getMirrorAxis().value)!=null?y:0,orientation:(S=t==null?void 0:t.getOrientation())!=null?S:0}},back:{face:null,croppedDocument:l,frame:{data:s?new Uint8ClampedArray(s.getFrameData()):null,width:(b=s==null?void 0:s.getWidth())!=null?b:0,height:(w=s==null?void 0:s.getHeight())!=null?w:0,mirrorAxis:(u=s==null?void 0:s.getMirrorAxis().value)!=null?u:0,orientation:(I=s==null?void 0:s.getOrientation())!=null?I:0}}};t==null||t.delete(),s==null||s.delete(),a.delete();let p=JSON.parse(e.toJson());return{...{firstName:f(e.getFirstName(),""),lastName:f(e.getLastName(),""),secondaryLastName:f(e.getSecondaryLastName(),""),fullName:e.getFullName(),sex:f(e.getSex(),""),age:f(e.getAge(),null),isExpired:f(e.isExpired(),null),nationality:f(e.getNationality(),""),address:f(e.getAddress(),""),issuingCountry:f(e.getIssuingCountry(),""),issuingCountryIso:f(e.getIssuingCountryIso(),""),documentNumber:f(e.getDocumentNumber(),""),documentAdditionalNumber:f(e.getDocumentAdditionalNumber(),""),dateOfBirth:$(f(e.getDateOfBirth(),null)),dateOfExpiry:$(f(e.getDateOfExpiry(),null)),dateOfIssue:$(f(e.getDateOfIssue(),null)),documentType:f(e.getDocumentType(),null),documentSubtype:f(e.getDocumentSubtype(),null)},...p,imageInfo:null,rawImageInfo:C}}onShutterButtonPositionChangedCallback(e){this.workerFunctions.postMessage({type:"idCaptureDidShutterButtonPositionChanged",payload:{position:JSON.parse(e)}})}onShutterButtonStateChangedCallback(e){this.workerFunctions.postMessage({type:"idCaptureDidShutterButtonStateChanged",payload:{state:e}})}async reportSafariAbruptReload(e){let a=new this.Module.OutOfMemoryAnalyticsData(e.framesProcessedCount,e.didCaptureCount,e.didRejectCount,e.applySettingsCount,e.upTime,e.videoResolution,e.parentDomain,e.centaurusEnabled);this.Module.OutOfMemoryAnalyticsHelper.storeAnalyticsEvent(this.coreEngine.context,a),a.delete()}parseIdCaptureSession(e){return JSON.parse(e.toJson())}dispose(){var e;(e=this.SDCIdCaptureMode)==null||e.delete(),this.SDCIdCaptureMode=null,this.lastError="",this.lastLocalizedId="",this.lastResult=""}extractImageTransferablesFromCapturedId(e){let a=[];return e.rawImageInfo.front.frame.data&&e.rawImageInfo.front.frame.data.length>0&&a.push(e.rawImageInfo.front.frame.data.buffer),e.rawImageInfo.back.frame.data&&e.rawImageInfo.back.frame.data.length>0&&a.push(e.rawImageInfo.back.frame.data.buffer),a}isReadyToDisplayHints(){return this.coreEngine.view?this.coreEngine.view.hintPresenterInitialized():!1}initHintPresenterIfNotInitialized(){var a;if(this.isReadyToDisplayHints())return;let e=this.Module.HintPresenter.extend("HintPresenter",{showHint:(t,s)=>{this.workerFunctions.postMessage({type:"showHint",payload:{text:t,style:JSON.parse(s)}})},updateHint:t=>{this.workerFunctions.postMessage({type:"updateHint",payload:{style:JSON.parse(t)}})},hideHint:()=>{this.workerFunctions.postMessage({type:"hideHint",payload:{}})}});(a=this.coreEngine.view)==null||a.setHintPresenter(new e)}};function $(r){if(typeof r=="string")try{return JSON.parse(r)}catch{return null}return null}function Te(r,e,a){let t=e.IdCaptureDeserializerHelper.extend("IdCaptureDeserializerHelper",{createMode:(d,l)=>{let C=new P(r,d,l);return a(C),d.delete(),l.delete(),C.getSDCIdCaptureMode()}}),s=new t,i=new e.IdCaptureDeserializer(s);return s.delete(),i}var W=class extends x{constructor(){super(...arguments);this.idCaptureMode=null;this.lastIdCaptureModeSerializedSettings=""}getModeDeserializers(){let a=super.getModeDeserializers();return a.push_back(Te(this,this.Module,this.receiveNewCaptureMode.bind(this))),a}receiveNewCaptureMode(a){this.idCaptureMode=a}processFrame(a){return this.idCaptureMode?super.processFrame(a):{payload:a,transferables:[a.data.buffer]}}updateContext(a){super.updateContext(a)}idCaptureSetLastResult(a){var t;(t=this.idCaptureMode)==null||t.setLastResult(a)}idCaptureSetLastError(a){var t;(t=this.idCaptureMode)==null||t.setLastError(a)}idCaptureSetLastLocalizedId(a){var t;(t=this.idCaptureMode)==null||t.setLastLocalizedId(a)}idCaptureSetLastDetectionIssue(a){var t;(t=this.idCaptureMode)==null||t.setLastDetectionIssue(a)}idCaptureReset(){var a;(a=this.idCaptureMode)==null||a.reset()}idCaptureSetExternalTransactionId(a){var t;(t=this.idCaptureMode)==null||t.setExternalTransactionId(a)}idCaptureGetExternalTransactionId(){var a,t;return{payload:{transactionId:(t=(a=this.idCaptureMode)==null?void 0:a.getExternalTransactionId())!=null?t:null}}}idCaptureApplySettings(a){var t;(t=this.idCaptureMode)==null||t.applySettings(a)}idCaptureGetCentaurusSettings(){return{payload:{result:this.idCaptureMode.getCentaurusSettings()}}}idCaptureParse(a){var t,s;return{payload:{result:(s=(t=this.idCaptureMode)==null?void 0:t.parseCode(a))!=null?s:null}}}async idCaptureBarcodeVerifyAamvaCapture(a,t){var s,i;return{payload:{result:(i=await((s=this.idCaptureMode)==null?void 0:s.barcodeVerifyAamvaCapture(a,t)))!=null?i:null}}}idCaptureDataConsistencyVerifyCapture(a){var t,s;return{payload:{result:(s=(t=this.idCaptureMode)==null?void 0:t.dataConsistencyVerifyCapture(a))!=null?s:null}}}idCaptureDrivingLicenseDetailsCreateWithCentaurusData(a,t,s){let i=this.Module.DrivingLicenseDetails.createWithCentaurusData(a,t,s);return{payload:{result:JSON.parse(i)}}}getIdOpenSourceSoftwareLicenseInfo(){return{payload:{licenseText:this.Module.IdOpenSourceSoftwareLicenseInfo.getLicenseText()}}}idCaptureReportSafariAbruptReload(a){var t;(t=this.idCaptureMode)==null||t.reportSafariAbruptReload(a)}idCaptureDispose(){var a;(a=this.idCaptureMode)==null||a.dispose(),this.idCaptureMode=null}getWasmSideModuleFileName(){return""}getWasmCoreFileName(a,t){return t?a?"scandit-datacapture-sdk-id-simd-pthreads.wasm":"scandit-datacapture-sdk-id-pthreads.wasm":a?"scandit-datacapture-sdk-id-simd.wasm":"scandit-datacapture-sdk-id.wasm"}getWasmCoreExpectedHash(a,t){return t?a?"a92963d9afa21cfbcb66855a15b5dbbe67a3eddaa7689545fdaeecca4ec85cea":"b8912949cd839410d2f796559aca6c9f65573a7a093106b99b9a1f4fac94747b":a?"a9534ba6bcfcdbc24dbd59798a99591fdc4eb39b562e01bbd1ce343fff378cc5":"673a36ee2d4d7fd761a44f73970855cb13ea8cfc4bb894d88c30a80498053b0f"}getWasmMetadata(){return g}};var F=class extends U{constructor(e,a){super(e,a),this.dataCaptureInstance=new W(a,{postMessage:this.postMessage.bind(this),getOffscreenCanvas:this.getOffscreenCanvas.bind(this)})}async respondWith(e,a,t){let s=null,i;try{i=t(),i instanceof Promise&&(i=await i)}catch(l){n.log(n.Level.Debug,l),i=void 0,s=R(l)}let d={type:"workerTaskId",command:e,id:a,payload:this.hasPayload(i)?i.payload:void 0};s!=null&&(d.error=s),this.postMessage(d,this.hasTransferables(i)?i.transferables:[])}onMessage(e){switch(e.data.command){case"idCaptureSetLastResult":{let{data:t}=e;return this.respondWith(t.command,t.id,()=>{this.dataCaptureInstance.idCaptureSetLastResult(t.result)}),!0}case"idCaptureSetLastError":{let{data:t}=e;return this.respondWith(t.command,t.id,()=>{this.dataCaptureInstance.idCaptureSetLastError(t.error)}),!0}case"idCaptureSetLastLocalizedId":{let{data:t}=e;return this.respondWith(t.command,t.id,()=>{this.dataCaptureInstance.idCaptureSetLastLocalizedId(t.localizedId)}),!0}case"idCaptureSetLastDetectionIssue":{let{data:t}=e;return this.respondWith(t.command,t.id,()=>{this.dataCaptureInstance.idCaptureSetLastDetectionIssue(t.issue)}),!0}case"idCaptureReset":{let{data:t}=e;return this.respondWith(t.command,t.id,()=>this.dataCaptureInstance.idCaptureReset()),!0}case"idCaptureDispose":{let{data:t}=e;return this.respondWith(t.command,t.id,()=>this.dataCaptureInstance.idCaptureDispose()),!0}case"idCaptureApplySettings":{let{data:t}=e;return this.respondWith(t.command,t.id,()=>this.dataCaptureInstance.idCaptureApplySettings(t.settings)),!0}case"idCaptureParse":{let{data:t}=e;return this.respondWith(t.command,t.id,()=>this.dataCaptureInstance.idCaptureParse(t.code)),!0}case"idCaptureGetCentaurusSettings":{let{data:t}=e;return this.respondWith(t.command,t.id,()=>this.dataCaptureInstance.idCaptureGetCentaurusSettings()),!0}case"idCaptureBarcodeVerifyAamvaCapture":{let{data:t}=e;return this.respondWith(t.command,t.id,()=>this.dataCaptureInstance.idCaptureBarcodeVerifyAamvaCapture(t.capturedId,t.endpoint)),!0}case"idCaptureDataConsistencyVerifyCapture":{let{data:t}=e;return this.respondWith(t.command,t.id,()=>this.dataCaptureInstance.idCaptureDataConsistencyVerifyCapture(t.capturedId)),!0}case"idCaptureDrivingLicenseDetailsCreateWithCentaurusData":{let{data:t}=e;return this.respondWith(t.command,t.id,()=>this.dataCaptureInstance.idCaptureDrivingLicenseDetailsCreateWithCentaurusData(t.details.vehicleClass,t.details.restrictions,t.details.endorsements)),!0}case"getIdOpenSourceSoftwareLicenseInfo":{let{data:t}=e;return this.respondWith(t.command,t.id,()=>this.dataCaptureInstance.getIdOpenSourceSoftwareLicenseInfo()),!0}case"idCaptureReportSafariAbruptReload":{let{data:t}=e;return this.respondWith(t.command,t.id,()=>this.dataCaptureInstance.idCaptureReportSafariAbruptReload(t.environmentData)),!0}case"idCaptureSetExternalTransactionId":{let{data:t}=e;return this.respondWith(t.command,t.id,()=>this.dataCaptureInstance.idCaptureSetExternalTransactionId(t.transactionId)),!0}case"idCaptureGetExternalTransactionId":{let{data:t}=e;return this.respondWith(t.command,t.id,()=>this.dataCaptureInstance.idCaptureGetExternalTransactionId()),!0}default:return super.onMessage(e)}}};var Da=new F(self,{get:()=>self.Module,set:r=>{self.Module=r}});function wa(r){}})();\n'],{type:"application/javascript"})),t=new Worker(e,a);return URL.revokeObjectURL(e),t}var ne=class a extends DataCaptureLoader{constructor(){super(...arguments);this._name="IdCapture";}get dataCaptureWorker(){return (this._dataCaptureWorker)!=null||(this._dataCaptureWorker=st({name:this.name})),this._dataCaptureWorker}get name(){return this._name}get fixedWasmMemory(){return BrowserHelper.isIPhone()&&BrowserHelper.isSafari()?256:null}static async create(t){var i;let r=new a(t);return r.workerCommand("setLogLevel",{level:(i=t.logLevel)!=null?i:Logger.Level.Debug}),await r.load(),r}async workerCommand(...t){let[r,i,s]=t;return new Promise((o,u)=>{let c=this.workerCommandId++;this.workerTasks.set(c,{resolve:o,reject:u,command:r});let m={...i,command:r,id:c};this.dataCaptureWorker.postMessage(m,s);})}};var mt=Symbol("Comlink.proxy"),Kt=Symbol("Comlink.endpoint"),ht=Symbol("Comlink.releaseProxy"),Je=Symbol("Comlink.finalizer"),oe=Symbol("Comlink.thrown"),gt=a=>typeof a=="object"&&a!==null||typeof a=="function",Gt={canHandle:a=>gt(a)&&a[mt],serialize(a){let{port1:e,port2:t}=new MessageChannel;return Ct(a,e),[t,[t]]},deserialize(a){return a.start(),yt(a)}},Zt={canHandle:a=>gt(a)&&oe in a,serialize({value:a}){let e;return a instanceof Error?e={isError:true,value:{message:a.message,name:a.name,stack:a.stack}}:e={isError:false,value:a},[e,[]]},deserialize(a){throw a.isError?Object.assign(new Error(a.value.message),a.value):a.value}},ft=new Map([["proxy",Gt],["throw",Zt]]);function Qt(a,e){for(let t of a)if(e===t||t==="*"||t instanceof RegExp&&t.test(e))return true;return false}function Ct(a,e=globalThis,t=["*"]){e.addEventListener("message",function r(i){if(!i||!i.data)return;if(!Qt(t,i.origin)){console.warn(`Invalid origin '${i.origin}' for comlink proxy`);return}let{id:s,type:o,path:u}=Object.assign({path:[]},i.data),c=(i.data.argumentList||[]).map(P),m;try{let h=u.slice(0,-1).reduce((C,N)=>C[N],a),g=u.reduce((C,N)=>C[N],a);switch(o){case "GET":m=g;break;case "SET":h[u.slice(-1)[0]]=P(i.data.value),m=true;break;case "APPLY":m=g.apply(h,c);break;case "CONSTRUCT":{let C=new g(...c);m=vt(C);}break;case "ENDPOINT":{let{port1:C,port2:N}=new MessageChannel;Ct(a,N),m=tr(C,[C]);}break;case "RELEASE":m=void 0;break;default:return}}catch(h){m={value:h,[oe]:0};}Promise.resolve(m).catch(h=>({value:h,[oe]:0})).then(h=>{let[g,C]=de(h);e.postMessage(Object.assign(Object.assign({},g),{id:s}),C),o==="RELEASE"&&(e.removeEventListener("message",r),St(e),Je in a&&typeof a[Je]=="function"&&a[Je]());}).catch(h=>{let[g,C]=de({value:new TypeError("Unserializable return value"),[oe]:0});e.postMessage(Object.assign(Object.assign({},g),{id:s}),C);});}),e.start&&e.start();}function $t(a){return a.constructor.name==="MessagePort"}function St(a){$t(a)&&a.close();}function yt(a,e){let t=new Map;return a.addEventListener("message",function(i){let{data:s}=i;if(!s||!s.id)return;let o=t.get(s.id);if(o)try{o(s);}finally{t.delete(s.id);}}),ze(a,t,[],e)}function se(a){if(a)throw new Error("Proxy has been released and is not useable")}function bt(a){return j(a,new Map,{type:"RELEASE"}).then(()=>{St(a);})}var ue=new WeakMap,le="FinalizationRegistry"in globalThis&&new FinalizationRegistry(a=>{let e=(ue.get(a)||0)-1;ue.set(a,e),e===0&&bt(a);});function Yt(a,e){let t=(ue.get(e)||0)+1;ue.set(e,t),le&&le.register(a,e,a);}function Xt(a){le&&le.unregister(a);}function ze(a,e,t=[],r=function(){}){let i=false,s=new Proxy(r,{get(o,u){if(se(i),u===ht)return ()=>{Xt(s),bt(a),e.clear(),i=true;};if(u==="then"){if(t.length===0)return {then:()=>s};let c=j(a,e,{type:"GET",path:t.map(m=>m.toString())}).then(P);return c.then.bind(c)}return ze(a,e,[...t,u])},set(o,u,c){se(i);let[m,h]=de(c);return j(a,e,{type:"SET",path:[...t,u].map(g=>g.toString()),value:m},h).then(P)},apply(o,u,c){se(i);let m=t[t.length-1];if(m===Kt)return j(a,e,{type:"ENDPOINT"}).then(P);if(m==="bind")return ze(a,e,t.slice(0,-1));let[h,g]=ut(c);return j(a,e,{type:"APPLY",path:t.map(C=>C.toString()),argumentList:h},g).then(P)},construct(o,u){se(i);let[c,m]=ut(u);return j(a,e,{type:"CONSTRUCT",path:t.map(h=>h.toString()),argumentList:c},m).then(P)}});return Yt(s,a),s}function er(a){return Array.prototype.concat.apply([],a)}function ut(a){let e=a.map(de);return [e.map(t=>t[0]),er(e.map(t=>t[1]))]}var It=new WeakMap;function tr(a,e){return It.set(a,e),a}function vt(a){return Object.assign(a,{[mt]:true})}function de(a){for(let[e,t]of ft)if(t.canHandle(a)){let[r,i]=t.serialize(a);return [{type:"HANDLER",name:e,value:r},i]}return [{type:"RAW",value:a},It.get(a)||[]]}function P(a){switch(a.type){case "HANDLER":return ft.get(a.name).deserialize(a.value);case "RAW":return a.value}}function j(a,e,t,r){return new Promise(i=>{let s=rr();e.set(s,i),a.start&&a.start(),a.postMessage(Object.assign({id:s},t),r);})}function rr(){return new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-")}var lt="application/javascript",ar=(a,e={})=>{let t={skipSameOrigin:true,useBlob:true,...e};if(t.skipSameOrigin&&new URL(a).origin===self.location.origin)return Promise.resolve(a);let r;try{let i=new AbortController;r=i.signal;let s=setTimeout(()=>{i.abort();},3e3),o=()=>{clearTimeout(s),i.abort();};r.addEventListener("abort",o);}catch(i){}return new Promise((i,s)=>void fetch(a,{signal:r}).then(o=>o.text()).then(o=>{let u="";if(t.useBlob){let c=new Blob([o],{type:lt});u=URL.createObjectURL(c);}else u=`data:${lt},`+encodeURIComponent(o);i(u);}).catch(()=>{s(new Error(`Failed to fetch worker from ${a}`));}))},ir=function(){function a(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||false,i.configurable=true,"value"in i&&(i.writable=true),Object.defineProperty(e,i.key,i);}}return function(e,t,r){return t&&a(e.prototype,t),r&&a(e,r),e}}(),nr=sr(["",""],["",""]);function sr(a,e){return Object.freeze(Object.defineProperties(a,{raw:{value:Object.freeze(e)}}))}function or(a,e){if(!(a instanceof e))throw new TypeError("Cannot call a class as a function")}var y=function(){function a(){for(var e=this,t=arguments.length,r=Array(t),i=0;i<t;i++)r[i]=arguments[i];return or(this,a),this.tag=function(s){for(var o=arguments.length,u=Array(o>1?o-1:0),c=1;c<o;c++)u[c-1]=arguments[c];return typeof s=="function"?e.interimTag.bind(e,s):typeof s=="string"?e.transformEndResult(s):(s=s.map(e.transformString.bind(e)),e.transformEndResult(s.reduce(e.processSubstitutions.bind(e,u))))},r.length>0&&Array.isArray(r[0])&&(r=r[0]),this.transformers=r.map(function(s){return typeof s=="function"?s():s}),this.tag}return ir(a,[{key:"interimTag",value:function(t,r){for(var i=arguments.length,s=Array(i>2?i-2:0),o=2;o<i;o++)s[o-2]=arguments[o];return this.tag(nr,t.apply(void 0,[r].concat(s)))}},{key:"processSubstitutions",value:function(t,r,i){var s=this.transformSubstitution(t.shift(),r);return "".concat(r,s,i)}},{key:"transformString",value:function(t){var r=function(s,o){return o.onString?o.onString(s):s};return this.transformers.reduce(r,t)}},{key:"transformSubstitution",value:function(t,r){var i=function(o,u){return u.onSubstitution?u.onSubstitution(o,r):o};return this.transformers.reduce(i,t)}},{key:"transformEndResult",value:function(t){var r=function(s,o){return o.onEndResult?o.onEndResult(s):s};return this.transformers.reduce(r,t)}}]),a}(),b=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"";return {onEndResult:function(r){if(e==="")return r.trim();if(e=e.toLowerCase(),e==="start"||e==="left")return r.replace(/^\s*/,"");if(e==="end"||e==="right")return r.replace(/\s*$/,"");throw new Error("Side not supported: "+e)}}};function ur(a){if(Array.isArray(a)){for(var e=0,t=Array(a.length);e<a.length;e++)t[e]=a[e];return t}else return Array.from(a)}var x=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"initial";return {onEndResult:function(r){if(e==="initial"){var i=r.match(/^[^\S\n]*(?=\S)/gm),s=i&&Math.min.apply(Math,ur(i.map(function(u){return u.length})));if(s){var o=new RegExp("^.{"+s+"}","gm");return r.replace(o,"")}return r}if(e==="all")return r.replace(/^[^\S\n]+/gm,"");throw new Error("Unknown type: "+e)}}},E=function(e,t){return {onEndResult:function(i){if(e==null||t==null)throw new Error("replaceResultTransformer requires at least 2 arguments.");return i.replace(e,t)}}},B=function(e,t){return {onSubstitution:function(i,s){if(e==null||t==null)throw new Error("replaceSubstitutionTransformer requires at least 2 arguments.");return i==null?i:i.toString().replace(e,t)}}},lr={separator:"",conjunction:"",serial:false},D=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:lr;return {onSubstitution:function(r,i){if(Array.isArray(r)){var s=r.length,o=e.separator,u=e.conjunction,c=e.serial,m=i.match(/(\n?[^\S\n]+)$/);if(m?r=r.join(o+m[1]):r=r.join(o+" "),u&&s>1){var h=r.lastIndexOf(o);r=r.slice(0,h)+(c?o:"")+" "+u+r.slice(h+1);}}return r}}},Dt=function(e){return {onSubstitution:function(r,i){return typeof r=="string"&&r.includes(e)&&(r=r.split(e)),r}}},dt=function(e){return e!=null&&!Number.isNaN(e)&&typeof e!="boolean"},dr=function(){return {onSubstitution:function(t){return Array.isArray(t)?t.filter(dt):dt(t)?t:""}}};new y(D({separator:","}),x,b);new y(D({separator:",",conjunction:"and"}),x,b);new y(D({separator:",",conjunction:"or"}),x,b);new y(Dt(`
2
2
  `),dr,D,x,b);new y(Dt(`
3
3
  `),D,x,b,B(/&/g,"&amp;"),B(/</g,"&lt;"),B(/>/g,"&gt;"),B(/"/g,"&quot;"),B(/'/g,"&#x27;"),B(/`/g,"&#x60;"));new y(E(/(?:\n(?:\s*))+/g," "),b);var cr=new y(E(/(?:\n\s*)/g,""),b);new y(D({separator:","}),E(/(?:\s+)/g," "),b);new y(D({separator:",",conjunction:"or"}),E(/(?:\s+)/g," "),b);new y(D({separator:",",conjunction:"and"}),E(/(?:\s+)/g," "),b);new y(D,x,b);new y(D,E(/(?:\s+)/g," "),b);new y(x,b);new y(x("all"),b);var pr=a=>a.startsWith("data:"),mr=a=>a.startsWith("blob:"),hr=a=>!pr(a)&&!mr(a),gr=async a=>{let e=await fetch(a,{method:"HEAD"}),t=e.headers.get("content-type"),r=t==null?void 0:t.includes("javascript");if(t==null?void 0:t.includes("html"))throw new Error(cr`${a} resolved to a resource with the content type ${t}.
4
4
  This is likely an issue with the server configuration redirecting to an index.html file.
5
- Check that your resources are properly hosted`);if(!r)throw new Error(`Worker file is not a JavaScript file: ${t}`);if(!e.ok)throw new Error(`Worker file not found or inaccessible: ${e.status} ${e.statusText}`)},fr=async(a=window.location.href)=>{let e=await ar(new URL("resources/centaurus-worker.js",a).toString());hr(e)&&await gr(e);let t=new Worker(e,{type:"module"});t.onerror=i=>{console.error("Worker error:",i),r[ht]();};let r=yt(t);return r},ct=(a=21)=>crypto.getRandomValues(new Uint8Array(a)).reduce((e,t)=>(t&=63,t<36?e+=t.toString(36):t<62?e+=(t-26).toString(36).toUpperCase():t>62?e+="-":e+="_",e),""),pt="centaurus-userid";function Cr(){if(!Sr())return ct();let e=localStorage.getItem(pt);if(e)return e;let t=ct();return localStorage.setItem(pt,t),t}function Sr(){try{return localStorage.setItem("test","test"),localStorage.removeItem("test"),true}catch(a){return false}}var yr={inputImageSource:"video",scanningMode:"automatic",scanningSettings:{allowUncertainFrontSideScan:false,blurDetectionLevel:"mid",glareDetectionLevel:"mid",tiltDetectionLevel:"mid",skipImagesWithBlur:true,skipImagesWithGlare:true,skipImagesOccludedByHand:true,skipImagesWithInadequateLightingConditions:true,combineResultsFromMultipleInputImages:true,croppedImageSettings:{dotsPerInch:250,extensionFactor:0,returnDocumentImage:false,returnFaceImage:false,returnSignatureImage:false},customDocumentAnonymizationSettings:[],customDocumentRules:[],enableBarcodeScanOnly:false,enableCharacterValidation:true,inputImageMargin:.02,maxAllowedMismatchesPerField:0,recognitionModeFilter:{enableBarcodeId:true,enableFullDocumentRecognition:true,enableMrzId:true,enableMrzPassport:true,enableMrzVisa:true,enablePhotoId:true},returnInputImages:false,scanCroppedDocumentImage:false,scanPassportDataPageOnly:true,scanUnsupportedBack:false,anonymizationMode:"full-result"}};async function At(a,e){let t=await fr(a.resourcesLocation);a.userId||(a.userId=Cr()),a.resourcesLocation||(a.resourcesLocation=window.location.href),a.useLightweightBuild===void 0&&(a.useLightweightBuild=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent));let r=e?vt(e):void 0;try{return await t[atob("aW5pdEJsaW5rSWQ=")](a,yr,r),t}catch(i){throw new Error("Failed to initialize Centaurus",{cause:i})}}var qt=Symbol();globalThis.__CENTAURUS_CORE__||(globalThis.__CENTAURUS_CORE__=qt);globalThis.__CENTAURUS_CORE__!==qt&&console.warn("Detected multiple instances of Centaurus. This can lead to unexpected behavior.");var We=new Map;We.set([77,105,99,114,111,98,108,105,110,107],"Scandit");We.set([66,108,105,110,107,73,68],"ID Capture");var Ue="Centaurus",O=class a{static async load(e){let t=new a;try{await t.initCentaurus(e);}catch(r){throw new DataCaptureError({message:a.replaceCentaurusMentions(isObject(r)&&"message"in r?r.message:"(no message)",We),name:"IdCaptureLoadingError"})}return t}static unload(){var e;(e=a.wasmSDK)==null||e.terminate(),a.wasmSDK=void 0;}static replaceCentaurusMentions(e,t){return typeof e=="string"?[...t.entries()].reduce((r,[i,s])=>{let o=i.map(u=>String.fromCodePoint(u)).join("");return r.replace(new RegExp(o,"gi"),s)},e):"(no message)"}static async getWasmType(){let[e,t]=await Promise.all([BrowserHelper.hasSIMDSupport(),BrowserHelper.hasThreadsSupport()]);return e?t&&BrowserHelper.isDesktopDevice()?"advanced-threads":"advanced":"basic"}async initCentaurus(e){a.licenseKey=e.licenseKey;let t=new URL("7.6.1/",e.libraryLocation).toString(),r={licenseKey:e.licenseKey,initialMemory:500,resourcesLocation:t,useLightweightBuild:true,wasmVariant:await a.getWasmType()};a.wasmSDK=await At(r,({progress:i})=>{var s;(s=e.loadProgressNotifier)==null||s.call(e,{percentage:i,privateUri:new URL(`${Ue}.wasm`,e.libraryLocation).toString()});});}};var Ve=43,Dr=100-Ve;function Ar(a){if(typeof a!="function")return;let e=Object.keys(d);return function(r){if(r.percentage===null){a(r);return}let{pathname:i}=new URL(r.privateUri,document.baseURI),s={...r};e.some(o=>i.endsWith(o))?s.percentage=Ve*r.percentage/100:i.endsWith(`${Ue}.wasm`)&&(s.percentage=Ve+Dr*r.percentage/100),a(s);}}var wt=Ar;var qr=(t=>(t.FrontOnly="frontOnly",t.FrontAndBack="frontAndBack",t))(qr||{}),wr=(r=>(r.Face="face",r.CroppedDocument="croppedDocument",r.Frame="frame",r))(wr||{}),Or=(t=>(t.Front="front",t.Back="back",t))(Or||{}),Nr=(i=>(i.None="none",i.FieldsOnly="fieldsOnly",i.ImagesOnly="imagesOnly",i.FieldsAndImages="fieldsAndImages",i))(Nr||{}),xr=(t=>(t.Auto="auto",t.ButtonTap="buttonTap",t))(xr||{}),Tr=(t=>(t.Rounded="rounded",t.Square="square",t))(Tr||{}),kr=(t=>(t.Light="light",t.Bold="bold",t))(kr||{}),Rr=(r=>(r.NotAvailable="notAvailable",r.NotRealIdCompliant="notRealIdCompliant",r.RealIdCompliant="realIdCompliant",r))(Rr||{}),Pr=(r=>(r.Female="female",r.Male="male",r.Unspecified="unspecified",r))(Pr||{});var Lr=a=>({IdCapture:{RecommendedCameraSettings:CameraSettings.fromJSON(a.IdCapture.RecommendedCameraSettings),IdCaptureOverlayDefaults:{defaultCapturedBrush:{fillColor:Color.fromJSON(a.IdCapture.IdCaptureOverlayDefaults.defaultCapturedBrush.fillColor),strokeColor:Color.fromJSON(a.IdCapture.IdCaptureOverlayDefaults.defaultCapturedBrush.strokeColor),strokeWidth:a.IdCapture.IdCaptureOverlayDefaults.defaultCapturedBrush.strokeWidth},defaultLocalizedBrush:{fillColor:Color.fromJSON(a.IdCapture.IdCaptureOverlayDefaults.defaultLocalizedBrush.fillColor),strokeColor:Color.fromJSON(a.IdCapture.IdCaptureOverlayDefaults.defaultLocalizedBrush.strokeColor),strokeWidth:a.IdCapture.IdCaptureOverlayDefaults.defaultLocalizedBrush.strokeWidth},defaultRejectedBrush:{fillColor:Color.fromJSON(a.IdCapture.IdCaptureOverlayDefaults.defaultRejectedBrush.fillColor),strokeColor:Color.fromJSON(a.IdCapture.IdCaptureOverlayDefaults.defaultRejectedBrush.strokeColor),strokeWidth:a.IdCapture.IdCaptureOverlayDefaults.defaultRejectedBrush.strokeWidth}}}}),I=Lr({IdCapture:{RecommendedCameraSettings:{zoomFactor:1,zoomGestureZoomFactor:2,focusGestureStrategy:"manualUntilCapture",preferredResolution:"fullHd"},IdCaptureOverlayDefaults:{defaultCapturedBrush:{fillColor:"#00000000",strokeColor:"#FFFFFFFF",strokeWidth:3},defaultLocalizedBrush:{fillColor:"#FFFFFF80",strokeColor:"#FFFFFF00",strokeWidth:0},defaultRejectedBrush:{fillColor:"#00000000",strokeColor:"#FFFFFFFF",strokeWidth:3}}}});var Ot="data:audio/mpeg;base64,SUQzBAAAAAACGFRFTkMAAAALAAADUHJvIFRvb2xzAFRYWFgAAAAjAAADb3JpZ2luYXRvcl9yZWZlcmVuY2UAYWE0RVFOcW9VQk9rAFRJVDIAAAAeAAADMDdfU2NhbmRpdF9TY2FubmVkLVdyb25nSXRlbQBUWFhYAAAASQAAA3VtaWQAMHgwNjBBMkIzNDAxMDEwMTA1MDEwMTBGMTAxMzAwMDAwMDg2RUUzOTA5RUE3QjgwMDBGNjZGQzVERDdBNzc5ODE0AFRYWFgAAAAYAAADdGltZV9yZWZlcmVuY2UAMjY3MDU5MABURFJDAAAADAAAAzIwMjMtMDMtMjQAVFNTRQAAAA8AAANMYXZmNTkuMTcuMTAxAAAAAAAAAAAAAAD/+1QAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABJbmZvAAAADwAAABQAAAhAACIiIiIuLi4uLjo6Ojo6RUVFRUVRUVFRUV1dXV1daGhoaGh0dHR0dICAgICAi4uLi4uXl5eXl6KioqKirq6urq66urq6usXFxcXF0dHR0dHd3d3d3ejo6Ojo9PT09PT//////wAAAABMYXZjNTkuMjAAAAAAAAAAAAAAAAAkAsAAAAAAAAAIQBl5jwn/+xRkAAAAVgDUjQBgAAAADSCgAAEDiBduGIGACAAANIMAAAAgP8plFgg7znL+Q4k4B5uo2Rk9c+LQuOexRB4iCTT6t24x+9f7f/ve/OAAwiE0lTn2XHl6PVZxCA5GsdT/+xRkCoPwcwJexxhAAAAADSDgAAEBiAl0oJxAEAAANIAAAAQLpHM6PLpQzOOJP9g5lhihlyb2dlebf8JCDTyRW9i0P7qaz/+QAFBoW4NDEqQuutHr41//tAlwcSVBnm3/+xRkGwPwdwHbgCsQAAAADSAAAAEBlAd5AIhAAAAANIAAAATHiGz+Vc+PkABIAc4KvoFaqtnriqAiChQ15lfsMNqJ+6pCWSiwWiCplZ48GhwdztADJY5zm8nAqeDYITz/+xRkKwPweAReQCYQAAAADSAAAAEB5BF+gYhgKAAANIAAAARCDP8WxCCX+BeBTH3/iEEQWPLf/j9xbSKUgEEVL1p+0zaZlevKU5jbmwnBfkrWVYFOA8ttpVTjnZNQTAj/+xRkOYHwcAJeQCIYAAAADSAAAAEBwAd1AJhAAAAANIAAAAQh4cpNFFitO6uKSSRkaPEOmFCjhCufYvSYAMRykUrsTqSNnkFv2JqLbTWsOJFsnYRXo/r1z8r/7+mDiwH/+xRkSYAAdwLcJSQACAAADSCgAAEEeJFKGKUACAAANIMAAABxOtc6Jp53xlXP35AAcoV0pquMq1q/64ds9sxEh5Gt1gF6lGuqIWmtoDBY0qSi+FDRUEFIX0BPlJEDhYT/+xRkTgPxAxRZhzDAAAAADSDgAAEBlAl5AJhAAAAANIAAAATqelYAwIlAy0/IoV/EKh5Gw6UEDpn9pqpMQU1FqkxBTUUzLjk5LjWqqqqqqqqqqqqqqqqqqqqqqqqqqqr/+xRkVYPweQJfIMkQCAAADSAAAAEBzAlyAJwAAAAANIAAAASqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkxBTUUzLjk5LjWqqqqqqqqqqqqqqqqqqqqqqqqqqqr/+xRkZIPwdAdgoEEYigAADSAAAAEB1AuEgQhAKAAANIAAAASqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkxBTUUzLjk5LjWqqqqqqqqqqqqqqqqqqqqqqqqqqqr/+xRkc4PwcAdewMEQoAAADSAAAAEBrAmCgQhgKAAANIAAAASqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkxBTUUzLjk5LjWqqqqqqqqqqqqqqqqqqqqqqqqqqqr/+xRkg4fwcgHcIMYICgAADSAAAAEBcA8wrGHgKAAANIAAAASqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkxBTUUzLjk5LjWqqqqqqqqqqqqqqqqqqqqqqqqqqqr/+xRklI/wTgLEAwkACgAADSAAAAEBWBTkBIxiaAAANIAAAASqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkxBTUUzLjk5LjWqqqqqqqqqqqqqqqqqqqqqqqqqqqr/+xRkqA/wAABpAAAACAAADSAAAAEAAAGkAAAAIAAANIAAAASqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqr/+xRkxg/wAABpAAAACAAADSAAAAEAAAGkAAAAIAAANIAAAASqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqr/+xRk4Y/wAABpAAAACAAADSAAAAEAAAGkAAAAIAAANIAAAASqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqr/+xRk4Y/wAABpAAAACAAADSAAAAEAAAGkAAAAIAAANIAAAASqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqr/+xRk4Y/wAABpAAAACAAADSAAAAEAAAGkAAAAIAAANIAAAASqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqr/+xRk4Y/wAABpAAAACAAADSAAAAEAAAGkAAAAIAAANIAAAASqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqr/+xRk4Y/wAABpAAAACAAADSAAAAEAAAGkAAAAIAAANIAAAASqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqr/+xRk4Y/wAABpAAAACAAADSAAAAEAAAGkAAAAIAAANIAAAASqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqo=";var ce=class a{constructor(){this.idCaptured=Feedback.defaultFeedback;this.idRejected=new Feedback(null,null);}static get defaultFeedback(){return new a}static get defaultSuccessSound(){return Sound.defaultSound}static get defaultFailureSound(){return new Sound(Ot)}toJSONObject(){return {idCaptured:this.idCaptured.toJSONObject(),idRejected:this.idRejected.toJSONObject()}}};var T=(u=>(u.Passport="passport",u.IdCard="idCard",u.DriverLicense="driverLicense",u.VisaIcao="visaIcao",u.ResidencePermit="residencePermit",u.HealthInsuranceCard="healthInsuranceCard",u.RegionSpecific="regionSpecific",u))(T||{}),S=class{constructor(e){this._region=e;}get region(){return this._region}isPassport(){return this.documentType==="passport"}isIdCard(){return this.documentType==="idCard"}isDriverLicense(){return this.documentType==="driverLicense"}isVisaIcao(){return this.documentType==="visaIcao"}isHealthInsuranceCard(){return this.documentType==="healthInsuranceCard"}isResidencePermit(){return this.documentType==="residencePermit"}isRegionSpecific(){return this.documentType==="regionSpecific"}};var pe=class a{constructor(){this.json={};}get errorCorrection(){return this.json.errorCorrection}get moduleCountX(){return this.json.moduleCountX}get moduleCountY(){return this.json.moduleCountY}static fromJSON(e){if(e==null)return null;let t=new a;return t.json=e,t}toJSONObject(){return {errorCorrection:this.errorCorrection,moduleCountX:this.moduleCountX,moduleCountY:this.moduleCountY}}};var p=class a{constructor(){this.json={};}get day(){return this.json.day}get month(){return this.json.month}get year(){return this.json.year}static fromJSON(e){if(e==null)return null;let t=new a;return t.json=e,t}toJSONObject(){return {day:this.day,month:this.month,year:this.year}}};var me=class a{get dateOfExpiry(){var e;return (e=p.fromJSON(this.json.dateOfExpiry))!=null?e:new p}get codes(){return this.json.codes}static fromJSON(e){if(e===null)return null;let t=new a;return t.json=e,t}toJSONObject(){return {codes:[...this.codes],dateOfExpiry:this.dateOfExpiry.toJSONObject()}}};var he=class a{get vehicleCode(){return this.json.vehicleCode}get vehicleRestriction(){return this.json.vehicleRestriction}get dateOfIssue(){var e;return (e=p.fromJSON(this.json.dateOfIssue))!=null?e:new p}static fromJSON(e){if(e===null)return null;let t=new a;return t.json=e,t}toJSONObject(){return {dateOfIssue:this.dateOfIssue.toJSONObject(),vehicleCode:this.vehicleCode,vehicleRestriction:this.vehicleRestriction}}};var ge=class a{get aamvaVersion(){return this.json.aamvaVersion}get aliasFamilyName(){return this.json.aliasFamilyName}get aliasGivenName(){return this.json.aliasGivenName}get aliasSuffixName(){return this.json.aliasSuffixName}get bloodType(){return this.json.bloodType}get branchOfService(){return this.json.branchOfService}get cardInstanceIdentifier(){return this.json.cardInstanceIdentifier}get cardRevisionDate(){return p.fromJSON(this.json.cardRevisionDate)}get categories(){return this.json.categories!=null?this.json.categories:[]}get champusEffectiveDate(){return p.fromJSON(this.json.champusEffectiveDate)}get champusExpiryDate(){return p.fromJSON(this.json.champusExpiryDate)}get citizenshipStatus(){return this.json.citizenshipStatus}get civilianHealthCareFlagCode(){return this.json.civilianHealthCareFlagCode}get civilianHealthCareFlagDescription(){return this.json.civilianHealthCareFlagDescription}get commissaryFlagCode(){return this.json.commissaryFlagCode}get commissaryFlagDescription(){return this.json.commissaryFlagDescription}get countryOfBirth(){return this.json.countryOfBirth}get countryOfBirthIso(){return this.json.countryOfBirthIso}get deersDependentSuffixCode(){return this.json.deersDependentSuffixCode}get deersDependentSuffixDescription(){return this.json.deersDependentSuffixDescription}get directCareFlagCode(){return this.json.directCareFlagCode}get directCareFlagDescription(){return this.json.directCareFlagDescription}get documentCopy(){return this.json.documentCopy}get documentDiscriminatorNumber(){return this.json.documentDiscriminatorNumber}get driverNamePrefix(){return this.json.driverNamePrefix}get driverNameSuffix(){return this.json.driverNameSuffix}get driverRestrictionCodes(){return this.json.driverRestrictionCodes!=null?this.json.driverRestrictionCodes:[]}get ediPersonIdentifier(){return this.json.ediPersonIdentifier}get endorsementsCode(){return this.json.endorsementsCode}get exchangeFlagCode(){return this.json.exchangeFlagCode}get exchangeFlagDescription(){return this.json.exchangeFlagDescription}get eyeColor(){return this.json.eyeColor}get familySequenceNumber(){return this.json.familySequenceNumber}get firstNameTruncation(){return this.json.firstNameTruncation}get firstNameWithoutMiddleName(){return this.json.firstNameWithoutMiddleName}get formNumber(){return this.json.formNumber}get genevaConventionCategory(){return this.json.genevaConventionCategory}get hairColor(){return this.json.hairColor}get heightCm(){return this.json.heightCm}get heightInch(){return this.json.heightInch}get IIN(){return this.json.iin}get identificationType(){return this.json.identificationType}get issuingJurisdiction(){return this.json.issuingJurisdiction}get issuingJurisdictionIso(){return this.json.issuingJurisdictionIso}get barcodeMetadata(){return pe.fromJSON(this.json.barcodeMetadata)}get jpegData(){return this.json.jpegData}get jurisdictionVersion(){return this.json.jurisdictionVersion}get lastNameTruncation(){return this.json.lastNameTruncation}get licenseCountryOfIssue(){return this.json.licenseCountryOfIssue}get middleName(){return this.json.middleName}get middleNameTruncation(){return this.json.middleNameTruncation}get mwrFlagCode(){return this.json.mwrFlagCode}get mwrFlagDescription(){return this.json.mwrFlagDescription}get payGrade(){return this.json.payGrade}get payPlanCode(){return this.json.payPlanCode}get payPlanGradeCode(){return this.json.payPlanGradeCode}get personDesignatorDocument(){return this.json.personDesignatorDocument}get personDesignatorTypeCode(){return this.json.personDesignatorTypeCode}get personMiddleInitial(){return this.json.personMiddleInitial}get personalIdNumber(){return this.json.personalIdNumber}get personalIdNumberType(){return this.json.personalIdNumberType}get personnelCategoryCode(){return this.json.personnelCategoryCode}get personnelEntitlementConditionType(){return this.json.personnelEntitlementConditionType}get placeOfBirth(){return this.json.placeOfBirth}get professionalDrivingPermit(){return this.json.professionalDrivingPermit!=null?me.fromJSON(this.json.professionalDrivingPermit):null}get race(){return this.json.race}get rank(){return this.json.rank}get rawData(){return this.json.rawData}get relationshipCode(){return this.json.relationshipCode}get relationshipDescription(){return this.json.relationshipDescription}get restrictionsCode(){return this.json.restrictionsCode}get securityCode(){return this.json.securityCode}get serviceCode(){return this.json.serviceCode}get sponsorFlag(){return this.json.sponsorFlag}get sponsorName(){return this.json.sponsorName}get sponsorPersonDesignatorIdentifier(){return this.json.sponsorPersonDesignatorIdentifier}get statusCode(){return this.json.statusCode}get statusCodeDescription(){return this.json.statusCodeDescription}get vehicleClass(){return this.json.vehicleClass}get vehicleRestrictions(){return this.json.vehicleRestrictions!=null?this.json.vehicleRestrictions.map(e=>he.fromJSON(e)).filter(e=>e!=null):[]}get version(){return this.json.version}get weightKg(){return this.json.weightKg}get weightLbs(){return this.json.weightLbs}get isRealId(){return this.json.isRealId}get firstName(){return this.json.firstName}get lastName(){return this.json.lastName}get fullName(){return this.json.fullName}get sex(){return this.json.sex}get dateOfBirth(){return p.fromJSON(this.json.dateOfBirth)}get nationality(){return this.json.nationality}get address(){return this.json.address}get documentNumber(){return this.json.documentNumber}get dateOfExpiry(){return p.fromJSON(this.json.dateOfExpiry)}get dateOfIssue(){return p.fromJSON(this.json.dateOfIssue)}get barcodeDataElements(){return this.json.dictionary}static fromJSON(e){let t=new a;return t.json=e,t}toJSONObject(){var e,t,r,i,s,o;return {firstName:this.firstName,lastName:this.lastName,secondaryLastName:this.json.secondaryLastName,fullName:this.fullName,sex:this.sex,nationality:this.nationality,address:this.address,issuingCountry:this.json.issuingCountry,issuingCountryIso:this.json.issuingCountryIso,barcodeMetadata:this.barcodeMetadata?this.barcodeMetadata.toJSONObject():null,documentNumber:this.documentNumber,documentType:this.json.documentType,documentSubtype:this.json.documentSubtype,documentAdditionalNumber:this.json.documentAdditionalNumber,dateOfBirth:(t=(e=this.dateOfBirth)==null?void 0:e.toJSONObject())!=null?t:null,dateOfExpiry:(i=(r=this.dateOfExpiry)==null?void 0:r.toJSONObject())!=null?i:null,dateOfIssue:(o=(s=this.dateOfIssue)==null?void 0:s.toJSONObject())!=null?o:null,aamvaVersion:this.aamvaVersion,aliasFamilyName:this.aliasFamilyName,aliasGivenName:this.aliasGivenName,aliasSuffixName:this.aliasSuffixName,bloodType:this.bloodType,branchOfService:this.branchOfService,cardInstanceIdentifier:this.cardInstanceIdentifier,cardRevisionDate:this.cardRevisionDate?this.cardRevisionDate.toJSONObject():null,categories:[...this.categories],champusEffectiveDate:this.champusEffectiveDate?this.champusEffectiveDate.toJSONObject():null,champusExpiryDate:this.champusExpiryDate?this.champusExpiryDate.toJSONObject():null,citizenshipStatus:this.citizenshipStatus,civilianHealthCareFlagCode:this.civilianHealthCareFlagCode,civilianHealthCareFlagDescription:this.civilianHealthCareFlagDescription,commissaryFlagCode:this.commissaryFlagCode,commissaryFlagDescription:this.commissaryFlagDescription,countryOfBirth:this.countryOfBirth,countryOfBirthIso:this.countryOfBirthIso,deersDependentSuffixCode:this.deersDependentSuffixCode,deersDependentSuffixDescription:this.deersDependentSuffixDescription,directCareFlagCode:this.directCareFlagCode,directCareFlagDescription:this.directCareFlagDescription,documentCopy:this.documentCopy,documentDiscriminatorNumber:this.documentDiscriminatorNumber,driverNamePrefix:this.driverNamePrefix,driverNameSuffix:this.driverNameSuffix,driverRestrictionCodes:[...this.driverRestrictionCodes],ediPersonIdentifier:this.ediPersonIdentifier,endorsementsCode:this.endorsementsCode,exchangeFlagCode:this.exchangeFlagCode,exchangeFlagDescription:this.exchangeFlagDescription,eyeColor:this.eyeColor,familySequenceNumber:this.familySequenceNumber,firstNameTruncation:this.firstNameTruncation,firstNameWithoutMiddleName:this.firstNameWithoutMiddleName,formNumber:this.formNumber,genevaConventionCategory:this.genevaConventionCategory,hairColor:this.hairColor,heightCm:this.heightCm,heightInch:this.heightInch,iin:this.IIN,identificationType:this.identificationType,issuingJurisdiction:this.issuingJurisdiction,issuingJurisdictionIso:this.issuingJurisdictionIso,jpegData:this.jpegData,jurisdictionVersion:this.jurisdictionVersion,lastNameTruncation:this.lastNameTruncation,licenseCountryOfIssue:this.licenseCountryOfIssue,middleName:this.middleName,middleNameTruncation:this.middleNameTruncation,mwrFlagCode:this.mwrFlagCode,mwrFlagDescription:this.mwrFlagDescription,payGrade:this.payGrade,payPlanCode:this.payPlanCode,payPlanGradeCode:this.payPlanGradeCode,personDesignatorDocument:this.personDesignatorDocument,personDesignatorTypeCode:this.personDesignatorTypeCode,personMiddleInitial:this.personMiddleInitial,personalIdNumber:this.personalIdNumber,personalIdNumberType:this.personalIdNumberType,personnelCategoryCode:this.personnelCategoryCode,personnelEntitlementConditionType:this.personnelEntitlementConditionType,placeOfBirth:this.placeOfBirth,professionalDrivingPermit:this.professionalDrivingPermit?this.professionalDrivingPermit.toJSONObject():null,race:this.race,rank:this.rank,rawData:this.rawData,relationshipCode:this.relationshipCode,relationshipDescription:this.relationshipDescription,restrictionsCode:this.restrictionsCode,securityCode:this.securityCode,serviceCode:this.serviceCode,sponsorFlag:this.sponsorFlag,sponsorName:this.sponsorName,sponsorPersonDesignatorIdentifier:this.sponsorPersonDesignatorIdentifier,statusCode:this.statusCode,statusCodeDescription:this.statusCodeDescription,vehicleClass:this.vehicleClass,vehicleRestrictions:this.vehicleRestrictions.map(u=>u.toJSONObject()),version:this.version,weightKg:this.weightKg,weightLbs:this.weightLbs,isRealId:this.isRealId,dictionary:{...this.barcodeDataElements}}}};var fe=class a{constructor(){this.json=null;}get face(){var e,t;return (t=(e=this.json)==null?void 0:e.front.face)!=null?t:null}get frame(){var e,t,r,i;return (i=(r=(e=this.json)==null?void 0:e.front.frame)!=null?r:(t=this.json)==null?void 0:t.back.frame)!=null?i:null}static fromJSON(e){let t=new a;return e!=null&&(t.json=e),t}getFrame(e){var t,r,i,s;switch(e){case "front":return (r=(t=this.json)==null?void 0:t.front.frame)!=null?r:null;case "back":return (s=(i=this.json)==null?void 0:i.back.frame)!=null?s:null}return null}getCroppedDocument(e){var t,r,i,s;switch(e){case "front":return (r=(t=this.json)==null?void 0:t.front.croppedDocument)!=null?r:null;case "back":return (s=(i=this.json)==null?void 0:i.back.croppedDocument)!=null?s:null}return null}toJSONObject(){return {front:{face:this.face,croppedDocument:this.getCroppedDocument("front"),frame:this.getFrame("front")},back:{face:null,croppedDocument:this.getCroppedDocument("back"),frame:this.getFrame("back")}}}};var Ce=class a{get documentCode(){return this.json.documentCode}get namesAreTruncated(){return this.json.namesAreTruncated}get optional(){return this.json.optional}get optional1(){return this.json.optional1}get optionalDataInLine1(){return this.json.optionalDataInLine1}get optionalDataInLine2(){return this.json.optionalDataInLine2}get capturedMrz(){return this.json.capturedMrz}get personalIdNumber(){return this.json.personalIdNumber}get renewalTimes(){return this.json.renewalTimes}get fullNameSimplifiedChinese(){return this.json.fullNameSimplifiedChinese}get omittedCharacterCountInGbkName(){return this.json.omittedCharacterCountInGbkName}get omittedNameCount(){return this.json.omittedNameCount}get issuingAuthorityCode(){return this.json.issuingAuthorityCode}get passportIssuerIso(){return this.json.passportIssuerIso}get passportNumber(){return this.json.passportNumber}get passportDateOfExpiry(){return p.fromJSON(this.json.passportDateOfExpiry)}get firstName(){return this.json.firstName}get lastName(){return this.json.lastName}get fullName(){return this.json.fullName}get sex(){return this.json.sex}get dateOfBirth(){return p.fromJSON(this.json.dateOfBirth)}get nationality(){return this.json.nationality}get address(){return this.json.address}get documentNumber(){return this.json.documentNumber}get dateOfExpiry(){return p.fromJSON(this.json.dateOfExpiry)}get dateOfIssue(){return p.fromJSON(this.json.dateOfIssue)}static fromJSON(e){let t=new a;return t.json=e,t}toJSONObject(){var e,t,r,i;return {...this.json,documentCode:this.documentCode,namesAreTruncated:this.namesAreTruncated,optional:this.optional,optional1:this.optional1,optionalDataInLine1:this.optionalDataInLine1,optionalDataInLine2:this.optionalDataInLine2,capturedMrz:this.capturedMrz,personalIdNumber:this.personalIdNumber,renewalTimes:this.renewalTimes,fullNameSimplifiedChinese:this.fullNameSimplifiedChinese,omittedCharacterCountInGbkName:this.omittedCharacterCountInGbkName,omittedNameCount:this.omittedNameCount,issuingAuthorityCode:this.issuingAuthorityCode,passportIssuerIso:this.passportIssuerIso,passportNumber:this.passportNumber,passportDateOfExpiry:this.passportDateOfExpiry?this.passportDateOfExpiry.toJSONObject():null,firstName:this.firstName,lastName:this.lastName,fullName:this.fullName,sex:this.sex,dateOfBirth:this.dateOfBirth?this.dateOfBirth.toJSONObject():null,nationality:this.nationality,address:this.address,documentNumber:this.documentNumber,dateOfExpiry:(t=(e=this.dateOfExpiry)==null?void 0:e.toJSONObject())!=null?t:null,dateOfIssue:(i=(r=this.dateOfIssue)==null?void 0:r.toJSONObject())!=null?i:null}}};var Se=class a{constructor(){this.json={};}get code(){return this.json.code}get dateOfIssue(){return p.fromJSON(this.json.dateOfIssue)}get dateOfExpiry(){return p.fromJSON(this.json.dateOfExpiry)}static fromJSON(e){if(e==null)return null;let t=new a;return t.json=e,t}toJSONObject(){return {code:this.code,dateOfIssue:this.dateOfIssue?this.dateOfIssue.toJSONObject():null,dateOfExpiry:this.dateOfExpiry?this.dateOfExpiry.toJSONObject():null}}};var J=class a{constructor(){this.json={};}get drivingLicenseCategories(){return this.json.drivingLicenseCategories.map(e=>Se.fromJSON(e)).filter(e=>e!=null)}get restrictions(){return this.json.restrictions}get endorsements(){return this.json.endorsements}static fromJSON(e){if(e==null)return null;let t=new a;return t.json=e,t}toJSONObject(){return {drivingLicenseCategories:this.drivingLicenseCategories.map(e=>e.toJSONObject()),restrictions:this.restrictions,endorsements:this.endorsements}}};var ye=class a{get firstName(){return this.json.firstName}get lastName(){return this.json.lastName}get secondaryLastName(){return this.json.secondaryLastName}get fullName(){return this.json.fullName}get additionalAddressInformation(){return this.json.additionalAddressInformation}get additionalNameInformation(){return this.json.additionalNameInformation}get documentAdditionalNumber(){return this.json.documentAdditionalNumber}get employer(){return this.json.employer}get issuingAuthority(){return this.json.issuingAuthority}get issuingJurisdiction(){return this.json.issuingJurisdiction}get issuingJurisdictionIso(){return this.json.issuingJurisdictionIso}get maritalStatus(){return this.json.maritalStatus}get personalIdNumber(){return this.json.personalIdNumber}get placeOfBirth(){return this.json.placeOfBirth}get profession(){return this.json.profession}get race(){return this.json.race}get religion(){return this.json.religion}get residentialStatus(){return this.json.residentialStatus}get mothersName(){return this.json.mothersName}get fathersName(){return this.json.fathersName}get capturedSides(){return this.json.capturedSides}get isBackSideCaptureSupported(){return this.json.isBackSideCaptureSupported}get drivingLicenseDetails(){return J.fromJSON(this.json.drivingLicenseDetails)}get bloodType(){return this.json.bloodType}get sponsor(){return this.json.sponsor}get visaNumber(){return this.json.visaNumber}get passportNumber(){return this.json.passportNumber}get sex(){return this.json.sex}get dateOfBirth(){return p.fromJSON(this.json.dateOfBirth)}get nationality(){return this.json.nationality}get address(){return this.json.address}get documentNumber(){return this.json.documentNumber}get dateOfExpiry(){return p.fromJSON(this.json.dateOfExpiry)}get dateOfIssue(){return p.fromJSON(this.json.dateOfIssue)}get vehicleOwner(){return this.json.vehicleOwner}static fromJSON(e){let t=new a;return t.json=e,t}toJSONObject(){var e,t,r,i,s,o;return {...this.json,firstName:this.firstName,lastName:this.lastName,secondaryLastName:this.secondaryLastName,fullName:this.fullName,additionalAddressInformation:this.additionalAddressInformation,additionalNameInformation:this.additionalNameInformation,documentAdditionalNumber:this.documentAdditionalNumber,employer:this.employer,issuingAuthority:this.issuingAuthority,issuingJurisdiction:this.issuingJurisdiction,issuingJurisdictionIso:this.issuingJurisdictionIso,maritalStatus:this.maritalStatus,personalIdNumber:this.personalIdNumber,placeOfBirth:this.placeOfBirth,profession:this.profession,race:this.race,religion:this.religion,residentialStatus:this.residentialStatus,mothersName:this.mothersName,fathersName:this.fathersName,capturedSides:this.capturedSides,isBackSideCaptureSupported:this.isBackSideCaptureSupported,drivingLicenseDetails:this.drivingLicenseDetails?this.drivingLicenseDetails.toJSONObject():null,bloodType:this.bloodType,sponsor:this.sponsor,passportNumber:this.passportNumber,visaNumber:this.visaNumber,sex:this.sex,dateOfBirth:(t=(e=this.dateOfBirth)==null?void 0:e.toJSONObject())!=null?t:null,nationality:this.nationality,address:this.address,documentNumber:this.documentNumber,dateOfExpiry:(i=(r=this.dateOfExpiry)==null?void 0:r.toJSONObject())!=null?i:null,dateOfIssue:(o=(s=this.dateOfIssue)==null?void 0:s.toJSONObject())!=null?o:null,vehicleOwner:this.vehicleOwner}}};var z=class a{constructor(){this.json={};}get allChecksPassed(){return this.json.allChecksPassed}get failedChecks(){return this.json.failedChecks}get skippedChecks(){return this.json.skippedChecks}get passedChecks(){return this.json.passedChecks}static fromJSON(e){let t=new a;return t.json=e,t}async frontReviewImage(){let e=this.json.frontFieldLocations,t=e!=null&&Object.keys(e).length>0,r=this.json.frontImage;if(!this.allChecksPassed&&r!=null&&t)try{return await this.highlightImage(r,e)}catch(i){Logger.log(Logger.Level.Warn,"Failed to create image with mismatching fields.",i);}return ""}toJSONObject(){return {...this.json}}pushQuadForKey(e,t,r){let i=e[r];return i!=null?(t.push(Quadrilateral.fromJSON(i)),true):false}pushQuadsForKeys(e,t,r,i=[]){if(!this.pushQuadForKey(e,t,r))for(let s of i)this.pushQuadForKey(e,t,s);}getMismatchedQuads(e){let t=[];return e!=null&&(this.failedChecks.includes("documentNumberComparison")&&this.pushQuadsForKeys(e,t,"documentNumber"),this.failedChecks.includes("fullNameComparison")&&this.pushQuadsForKeys(e,t,"fullName",["firstName","lastName"]),this.failedChecks.includes("dateOfBirthComparison")&&this.pushQuadsForKeys(e,t,"dateOfBirth"),this.failedChecks.includes("dateOfExpiryComparison")&&this.pushQuadsForKeys(e,t,"dateOfExpiry"),this.failedChecks.includes("dateOfIssueComparison")&&this.pushQuadsForKeys(e,t,"dateOfIssue")),t}async highlightImage(e,t){let r=new Image;r.src=`data:image/png;base64,${e}`,await r.decode();let i=document.createElement("canvas");i.width=r.width,i.height=r.height;let s=i.getContext("2d");if(!s)throw new Error("Failed to get 2d context from canvas");s.drawImage(r,0,0);let o=this.getMismatchedQuads(t);if(o.length===0)return "";s.beginPath(),s.rect(0,0,r.width,r.height);for(let u of o)s.moveTo(u.topLeft.x,u.topLeft.y),s.lineTo(u.topLeft.x,u.bottomRight.y),s.lineTo(u.bottomRight.x,u.bottomRight.y),s.lineTo(u.bottomRight.x,u.topLeft.y),s.lineTo(u.topLeft.x,u.topLeft.y);s.fillStyle="rgba(0, 0, 0, 0.30)",s.fill(),s.lineWidth=3,s.strokeStyle="red",s.beginPath();for(let u of o)s.rect(u.topLeft.x,u.topLeft.y,u.bottomRight.x-u.topLeft.x,u.bottomRight.y-u.topLeft.y);return s.stroke(),i.toDataURL("image/jpeg",1)}};var X=class a{get dataConsistency(){let e=this.json.rejectsInconsistentData;return this.json.dataConsistencyResult!=null&&e?z.fromJSON(this.json.dataConsistencyResult):null}static fromJSON(e){let t=new a;return t.json=e,t}toJSONObject(){return {...this.json}}};var _=class extends S{constructor(t){super(t);this.documentType="driverLicense";}get region(){return this._region}toJSONObject(){return {region:this.region,documentType:this.documentType}}};var W=class extends S{constructor(t){super(t);this.documentType="healthInsuranceCard";}get region(){return this._region}toJSONObject(){return {region:this.region,documentType:this.documentType}}};var U=class extends S{constructor(t){super(t);this.documentType="idCard";}get region(){return this._region}toJSONObject(){return {region:this.region,documentType:this.documentType}}};var V=class extends S{constructor(t){super(t);this.documentType="passport";}get region(){return this._region}toJSONObject(){return {region:this.region,documentType:this.documentType}}};var jr=(n=>(n.Any="any",n.EuAndSchengen="euAndSchengen",n.Aruba="aruba",n.Afghanistan="afghanistan",n.Angola="angola",n.Anguilla="anguilla",n.AlandIslands="alandIslands",n.Albania="albania",n.Andorra="andorra",n.Uae="uae",n.Argentina="argentina",n.Armenia="armenia",n.AmericanSamoa="americanSamoa",n.Antarctica="antarctica",n.FrenchSouthernTerritories="frenchSouthernTerritories",n.AntiguaAndBarbuda="antiguaAndBarbuda",n.Australia="australia",n.Austria="austria",n.Azerbaijan="azerbaijan",n.Burundi="burundi",n.Belgium="belgium",n.Benin="benin",n.BonaireSintEustatiusAndSaba="bonaireSintEustatiusAndSaba",n.BurkinaFaso="burkinaFaso",n.Bangladesh="bangladesh",n.Bulgaria="bulgaria",n.Bahrain="bahrain",n.Bahamas="bahamas",n.BosniaHerzegovina="bosniaHerzegovina",n.SaintBarthelemy="saintBarthelemy",n.Belarus="belarus",n.Belize="belize",n.Bermuda="bermuda",n.Bolivia="bolivia",n.Brazil="brazil",n.Barbados="barbados",n.BruneiDarussalam="bruneiDarussalam",n.Bhutan="bhutan",n.BouvetIsland="bouvetIsland",n.Botswana="botswana",n.Car="car",n.Canada="canada",n.CocosIslands="cocosIslands",n.Switzerland="switzerland",n.Chile="chile",n.China="china",n.CoteIvoire="coteIvoire",n.Cameroon="cameroon",n.DemocraticRepublicOfCongo="democraticRepublicOfCongo",n.Congo="congo",n.CookIslands="cookIslands",n.Colombia="colombia",n.Comoros="comoros",n.CaboVerde="caboVerde",n.CostaRica="costaRica",n.Cuba="cuba",n.Curacao="curacao",n.ChristmasIsland="christmasIsland",n.CaymanIslands="caymanIslands",n.Cyprus="cyprus",n.Czechia="czechia",n.Germany="germany",n.Djibouti="djibouti",n.Dominica="dominica",n.Denmark="denmark",n.DominicanRepublic="dominicanRepublic",n.Algeria="algeria",n.Ecuador="ecuador",n.Egypt="egypt",n.Eritrea="eritrea",n.WesternSahara="westernSahara",n.Spain="spain",n.Estonia="estonia",n.Ethiopia="ethiopia",n.Finland="finland",n.Fiji="fiji",n.FalklandIslands="falklandIslands",n.France="france",n.FaroeIslands="faroeIslands",n.Micronesia="micronesia",n.Gabon="gabon",n.Uk="uk",n.Georgia="georgia",n.Guernsey="guernsey",n.Ghana="ghana",n.Gibraltar="gibraltar",n.Guinea="guinea",n.Guadeloupe="guadeloupe",n.Gambia="gambia",n.GuineaBissau="guineaBissau",n.EquatorialGuinea="equatorialGuinea",n.Greece="greece",n.Grenada="grenada",n.Greenland="greenland",n.Guatemala="guatemala",n.FrenchGuiana="frenchGuiana",n.Guam="guam",n.Guyana="guyana",n.HongKong="hongKong",n.HeardIslandAndMcDonaldIslands="heardIslandAndMcDonaldIslands",n.Honduras="honduras",n.Croatia="croatia",n.Haiti="haiti",n.Hungary="hungary",n.Indonesia="indonesia",n.IsleOfMan="isleOfMan",n.India="india",n.BritishIndianOceanTerritory="britishIndianOceanTerritory",n.Ireland="ireland",n.Iran="iran",n.Iraq="iraq",n.Iceland="iceland",n.Israel="israel",n.Italy="italy",n.Jamaica="jamaica",n.Jersey="jersey",n.Jordan="jordan",n.Japan="japan",n.Kazakhstan="kazakhstan",n.Kenya="kenya",n.Kyrgyzstan="kyrgyzstan",n.Cambodia="cambodia",n.Kiribati="kiribati",n.SaintKittsAndNevis="saintKittsAndNevis",n.SouthKorea="southKorea",n.Kuwait="kuwait",n.Lao="lao",n.Lebanon="lebanon",n.Liberia="liberia",n.Libya="libya",n.SaintLucia="saintLucia",n.Liechtenstein="liechtenstein",n.SriLanka="sriLanka",n.Lesotho="lesotho",n.Lithuania="lithuania",n.Luxembourg="luxembourg",n.Latvia="latvia",n.Macao="macao",n.FrenchSaintMartin="frenchSaintMartin",n.Morocco="morocco",n.Monaco="monaco",n.Moldova="moldova",n.Madagascar="madagascar",n.Maldives="maldives",n.Mexico="mexico",n.MarshallIslands="marshallIslands",n.NorthMacedonia="northMacedonia",n.Mali="mali",n.Malta="malta",n.Myanmar="myanmar",n.Montenegro="montenegro",n.Mongolia="mongolia",n.NorthernMarianaIslands="northernMarianaIslands",n.Mozambique="mozambique",n.Mauritania="mauritania",n.Montserrat="montserrat",n.Martinique="martinique",n.Mauritius="mauritius",n.Malawi="malawi",n.Malaysia="malaysia",n.Mayotte="mayotte",n.Namibia="namibia",n.NewCaledonia="newCaledonia",n.Niger="niger",n.NorfolkIsland="norfolkIsland",n.Nigeria="nigeria",n.Nicaragua="nicaragua",n.Niue="niue",n.Netherlands="netherlands",n.Norway="norway",n.Nepal="nepal",n.Nauru="nauru",n.NewZealand="newZealand",n.Oman="oman",n.Pakistan="pakistan",n.Panama="panama",n.Pitcairn="pitcairn",n.Peru="peru",n.Philippines="philippines",n.Palau="palau",n.PapuaNewGuinea="papuaNewGuinea",n.Poland="poland",n.PuertoRico="puertoRico",n.NorthKorea="northKorea",n.Portugal="portugal",n.Paraguay="paraguay",n.Palestine="palestine",n.FrenchPolynesia="frenchPolynesia",n.Qatar="qatar",n.Reunion="reunion",n.Romania="romania",n.Russia="russia",n.Rwanda="rwanda",n.SaudiArabia="saudiArabia",n.Sudan="sudan",n.Senegal="senegal",n.Singapore="singapore",n.SouthGeorgiaAndTheSouthSandwichIslands="southGeorgiaAndTheSouthSandwichIslands",n.SaintHelena="saintHelena",n.SvalbardAndJanMayen="svalbardAndJanMayen",n.SolomonIslands="solomonIslands",n.SierraLeone="sierraLeone",n.ElSalvador="elSalvador",n.SanMarino="sanMarino",n.Somalia="somalia",n.SaintPierreAndMiquelon="saintPierreAndMiquelon",n.Serbia="serbia",n.SouthSudan="southSudan",n.SaoTomeAndPrincipe="saoTomeAndPrincipe",n.Suriname="suriname",n.Slovakia="slovakia",n.Slovenia="slovenia",n.Sweden="sweden",n.Eswatini="eswatini",n.DutchSintMaarten="dutchSintMaarten",n.Seychelles="seychelles",n.Syria="syria",n.TurksAndCaicosIslands="turksAndCaicosIslands",n.Chad="chad",n.Togo="togo",n.Thailand="thailand",n.Tajikistan="tajikistan",n.Tokelau="tokelau",n.Turkmenistan="turkmenistan",n.TimorLeste="timorLeste",n.Tonga="tonga",n.TrinidadAndTobago="trinidadAndTobago",n.Tunisia="tunisia",n.Turkey="turkey",n.Tuvalu="tuvalu",n.Taiwan="taiwan",n.Tanzania="tanzania",n.Uganda="uganda",n.Ukraine="ukraine",n.UsMinorOutlyingIslands="usMinorOutlyingIslands",n.Uruguay="uruguay",n.Us="us",n.Uzbekistan="uzbekistan",n.HolySee="holySee",n.SaintVincentAndTheGrenadines="saintVincentAndTheGrenadines",n.Venezuela="venezuela",n.BritishVirginIslands="britishVirginIslands",n.UsVirginIslands="usVirginIslands",n.Vietnam="vietnam",n.Vanuatu="vanuatu",n.WallisAndFutuna="wallisAndFutuna",n.Samoa="samoa",n.Kosovo="kosovo",n.Yemen="yemen",n.SouthAfrica="southAfrica",n.Zambia="zambia",n.Zimbabwe="zimbabwe",n))(jr||{});var H=class extends S{constructor(t){super("any");this.documentType="regionSpecific";this.subtype=t;}get region(){return this._region}toJSONObject(){return {region:this.region,documentType:this.documentType,documentSubtype:this.subtype}}};var K=class extends S{constructor(t){super(t);this.documentType="residencePermit";}get region(){return this._region}toJSONObject(){return {region:this.region,documentType:this.documentType}}};var G=class extends S{constructor(t){super(t);this.documentType="visaIcao";}get region(){return this._region}toJSONObject(){return {region:this.region,documentType:this.documentType}}};var ee=class a{get firstName(){return this.json.firstName}get lastName(){return this.json.lastName}get secondaryLastName(){return this.json.secondaryLastName}get fullName(){return this.json.fullName}get sexType(){return this.json.sex}get sex(){return this.json.sex}get dateOfBirth(){return p.fromJSON(this.json.dateOfBirth)}get age(){return this.json.age}get nationality(){return this.json.nationality}get address(){return this.json.address}get document(){if(this.json.documentType!=null){let e=this.json.documentType,t=this.json.documentSubtype,r=this.issuingCountry;switch(e){case "passport":return new V(r);case "idCard":return new U(r);case "driverLicense":return new _(r);case "visaIcao":return new G(r);case "residencePermit":return new K(r);case "healthInsuranceCard":return new W(r);case "regionSpecific":return new H(t);}}return null}get issuingCountryIso(){return this.json.issuingCountryIso}get issuingCountry(){return this.json.issuingCountry}get documentNumber(){return this.json.documentNumber}get documentAdditionalNumber(){return this.json.documentAdditionalNumber}get dateOfExpiry(){return p.fromJSON(this.json.dateOfExpiry)}get isExpired(){return this.json.isExpired}get dateOfIssue(){return p.fromJSON(this.json.dateOfIssue)}get usRealIdStatus(){var e,t;if(((e=this.json.vizResult)==null?void 0:e.usRealIdStatus)!=null&&this.json.vizResult.usRealIdStatus!=="notAvailable")return this.json.vizResult.usRealIdStatus;switch((t=this.barcode)==null?void 0:t.isRealId){case true:return "realIdCompliant";case false:return "notRealIdCompliant";default:return "notAvailable"}}get isCapturingComplete(){return this.json.isCapturingComplete}get barcode(){var e;return this._barcodeResult==null&&this.json.barcodeResult!=null&&(this._barcodeResult=ge.fromJSON(this.json.barcodeResult)),(e=this._barcodeResult)!=null?e:null}get mrzResult(){var e;return this._mrzResult==null&&this.json.mrzResult!=null&&(this._mrzResult=Ce.fromJSON(this.json.mrzResult)),(e=this._mrzResult)!=null?e:null}get vizResult(){var e;return this._vizResult==null&&this.json.vizResult!=null&&(this._vizResult=ye.fromJSON(this.json.vizResult)),(e=this._vizResult)!=null?e:null}get verificationResult(){var e;return this._verificationResult==null&&this.json.verificationResult!=null&&(this._verificationResult=X.fromJSON(this.json.verificationResult)),(e=this._verificationResult)!=null?e:new X}get images(){return fe.fromJSON(this.json.imageInfo)}get barcodeResultsJSON(){var e,t;return {barcodeResult:(t=(e=this.barcode)==null?void 0:e.toJSONObject())!=null?t:null}}get mrzResultsJSON(){return {mrzResult:this.mrzResult?this.mrzResult.toJSONObject():null}}static fromJSON(e){let t=new a;return t.json=e,t}isIdCard(){var e,t;return (t=(e=this.document)==null?void 0:e.isIdCard())!=null?t:false}isDriverLicense(){var e,t;return (t=(e=this.document)==null?void 0:e.isDriverLicense())!=null?t:false}isPassport(){var e,t;return (t=(e=this.document)==null?void 0:e.isPassport())!=null?t:false}isVisaIcao(){var e,t;return (t=(e=this.document)==null?void 0:e.isVisaIcao())!=null?t:false}isRegionSpecific(e){return this.document?this.document.isRegionSpecific()&&this.document.subtype===e:false}isResidencePermit(){var e,t;return (t=(e=this.document)==null?void 0:e.isResidencePermit())!=null?t:false}isHealthInsuranceCard(){var e,t;return (t=(e=this.document)==null?void 0:e.isHealthInsuranceCard())!=null?t:false}toJSONObject(){var e;return {firstName:this.firstName,lastName:this.lastName,secondaryLastName:this.secondaryLastName,fullName:this.fullName,sex:this.sex,nationality:this.nationality,address:this.address,issuingCountry:this.issuingCountry,issuingCountryIso:this.issuingCountryIso,documentNumber:this.documentNumber,documentAdditionalNumber:this.documentAdditionalNumber,dateOfBirth:this.dateOfBirth?this.dateOfBirth.toJSONObject():null,age:this.age,dateOfExpiry:this.dateOfExpiry?this.dateOfExpiry.toJSONObject():null,isExpired:this.isExpired,dateOfIssue:this.dateOfIssue?this.dateOfIssue.toJSONObject():null,documentType:this.document?this.document.documentType:null,documentSubtype:((e=this.document)==null?void 0:e.isRegionSpecific())==null?null:this.document.subtype,imageInfo:this.images.toJSONObject(),verificationResult:this.verificationResult?this.verificationResult.toJSONObject():null,vizResult:this.vizResult?this.vizResult.toJSONObject():null,idVerificationDataComparisonAvailable:this.json.idVerificationDataComparisonAvailable,usRealIdStatus:this.usRealIdStatus,isCapturingComplete:this.isCapturingComplete,...this.barcodeResultsJSON,...this.mrzResultsJSON}}};var Z=class a{get location(){return this._location}static fromJSON(e){let t=new a;return e.location!=null&&(t._location=Quadrilateral.fromJSON(e.location)),t}toJSONObject(){return {location:this.location.toJSONObject()}}};function be(a){let e=a,t="lowerLeft "in e?e["lowerLeft "]:e.lowerLeft;return new Quadrilateral(new Point(e.upperLeft.x,e.upperLeft.y),new Point(e.upperRight.x,e.upperRight.y),new Point(e.lowerRight.x,e.lowerRight.y),new Point(t.x,t.y))}function Q(a){return a==null?null:typeof a.latin=="object"&&a.latin.value.length>0?a.latin:typeof a.arabic=="object"&&a.arabic.value.length>0?a.arabic:typeof a.cyrillic=="object"&&a.cyrillic.value.length>0?a.cyrillic:typeof a.greek=="object"&&a.greek.value.length>0?a.greek:null}function He(a){return a.location!=null&&typeof a.location.x=="number"}function Rt(a){return typeof a=="object"&&a!==null}function Ie(a){return Rt(a)?Object.prototype.hasOwnProperty.call(a,"filledByDomainKnowledge")&&Object.prototype.hasOwnProperty.call(a,"originalString"):false}function Ke(a){return Rt(a)?Object.prototype.hasOwnProperty.call(a,"latin")&&Object.prototype.hasOwnProperty.call(a,"arabic")&&Object.prototype.hasOwnProperty.call(a,"cyrillic")&&Object.prototype.hasOwnProperty.call(a,"greek"):false}function te(a){if(a!=null&&Ie(a)&&a.successfullyParsed===true){if(a.year==null)return null;let e=a;return {day:e.day,month:e.month,year:e.year}}return null}function Ge(a){let{x:e,y:t,width:r,height:i}=a;return new Quadrilateral(new Point(e,t),new Point(e+r,t),new Point(e+r,t+i),new Point(e,t+i)).toJSONObject()}var Fr={"australian-capital-territory":"Australian Capital Territory","new-south-wales":"New South Wales","northern-territory":"Northern Territory",queensland:"Queensland","south-australia":"South Australia",tasmania:"Tasmania","western-australia":"Western Australia",victoria:"Victoria",alberta:"Alberta","british-columbia":"British Columbia",manitoba:"Manitoba","new-brunswick":"New Brunswick","newfoundland-and-labrador":"Newfoundland and Labrador","northwest-territories":"Northwest Territories","nova-scotia":"Nova Scotia",nunavut:"Nunavut","prince-edward-island":"Prince Edward Island",quebec:"Quebec",saskatchewan:"Saskatchewan","andhra-pradesh":"Andhra Pradesh",gujarat:"Gujarat",haryana:"Haryana",karnataka:"Karnataka",kerala:"Kerala","madhya-pradesh":"Madhya Pradesh",maharashtra:"Maharashtra",punjab:"Punjab","tamil-nadu":"Tamil Nadu",aguascalientes:"Aguascalientes","baja-california":"Baja California","baja-california-sur":"Baja California Sur",campeche:"Campeche",chiapas:"Chiapas",chihuahua:"Chihuahua","ciudad-de-mexico":"Mexico City",coahuila:"Coahuila",colima:"Colima",durango:"Durango",guanajuato:"Guanajuato",guerrero:"Guerrero","guerrero-acapulco-de-juarez":"Acapulco de Ju\xE1rez, Guerrero","guerrero-cocula":"Cocula, Guerrero","guerrero-juchitan":"Juchit\xE1n, Guerrero","guerrero-tepecoacuilco":"Tepecoacuilco de Trujano, Guerrero","guerrero-tlacoapa":"Tlacoapa, Guerrero",hidalgo:"Hidalgo",jalisco:"Jalisco",mexico:"M\xE9xico",michoacan:"Michoac\xE1n",morelos:"Morelos",nayarit:"Nayarit","nuevo-leon":"Nuevo Le\xF3n",oaxaca:"Oaxaca",puebla:"Puebla","quintana-roo":"Quintana Roo","quintana-roo-benito-juarez":"Benito Ju\xE1rez, Quintana Roo","quintana-roo-solidaridad":"Solidaridad, Quintana Roo","quintana-roo-cozumel":"Cozumel, Quintana Roo",queretaro:"Quer\xE9taro","san-luis-potosi":"San Luis Potos\xED",sinaloa:"Sinaloa",sonora:"Sonora",tabasco:"Tabasco",tamaulipas:"Tamaulipas",tlaxcala:"Tlaxcala",veracruz:"Veracruz",yucatan:"Yucatan",zacatecas:"Zacatecas","khyber-pakhtunkhwa":"Khyber Pakhtunkhwa",alabama:"Alabama",alaska:"Alaska",arizona:"Arizona",arkansas:"Arkansas",california:"California",colorado:"Colorado",connecticut:"Connecticut",delaware:"Delaware","district-of-columbia":"District of Columbia",florida:"Florida",georgia:"Georgia",hawaii:"Hawaii",idaho:"Idaho",illinois:"Illinois",indiana:"Indiana",iowa:"Iowa",kansas:"Kansas",kentucky:"Kentucky",louisiana:"Louisiana",maine:"Maine",maryland:"Maryland",massachusetts:"Massachusetts",michigan:"Michigan",minnesota:"Minnesota",mississippi:"Mississippi",missouri:"Missouri",montana:"Montana",nebraska:"Nebraska",nevada:"Nevada","new-hampshire":"New Hampshire","new-jersey":"New Jersey","new-mexico":"New Mexico","new-york":"New York","new-york-city":"New York City","north-carolina":"North Carolina","north-dakota":"North Dakota",ohio:"Ohio",oklahoma:"Oklahoma",ontario:"Ontario",oregon:"Oregon",pennsylvania:"Pennsylvania","rhode-island":"Rhode Island","south-carolina":"South Carolina","south-dakota":"South Dakota",tennessee:"Tennessee",texas:"Texas",utah:"Utah",vermont:"Vermont",virginia:"Virginia",washington:"Washington","west-virginia":"West Virginia",wisconsin:"Wisconsin",wyoming:"Wyoming",yukon:"Yukon",ceara:"Cear\xE1","distrito-federal":"Federal District",goias:"Goi\xE1s",maranhao:"Maranh\xE3o","mato-grosso":"Mato Grosso","minas-gerais":"Minas Gerais",para:"Par\xE1",parana:"Paran\xE1",pernambuco:"Pernambuco","rio-de-janeiro":"Rio de Janeiro","rio-grande-do-sul":"Rio Grand do Sul","santa-catarina":"Santa Catarina","sao-paolo":"Sao Paolo",sergipe:"Sergipe",alagoas:"Alagoas",bangsamoro:"Bangsamoro"};function Mt(a){var e;return a==null?null:(e=Fr[a])!=null?e:null}var ve=class a{constructor(e){this.workerCall=e;}static create(e){return new a(e)}async createDrivingLicenseDetailsFromCentaurusData(e,t,r){let i=await this.workerCall("idCaptureDrivingLicenseDetailsCreateWithCentaurusData",{details:{vehicleClass:e,restrictions:t,endorsements:r}});return J.fromJSON(i.result)}};var Lt={ABW:"aruba",AFG:"afghanistan",AGO:"angola",AIA:"anguilla",ALA:"alandIslands",ALB:"albania",AND:"andorra",ARE:"uae",ARG:"argentina",ARM:"armenia",ASM:"americanSamoa",ATA:"antarctica",ATF:"frenchSouthernTerritories",ATG:"antiguaAndBarbuda",AUS:"australia",AUT:"austria",AZE:"azerbaijan",BDI:"burundi",BEL:"belgium",BEN:"benin",BES:"bonaireSintEustatiusAndSaba",BFA:"burkinaFaso",BGD:"bangladesh",BGR:"bulgaria",BHR:"bahrain",BHS:"bahamas",BIH:"bosniaHerzegovina",BLM:"saintBarthelemy",BLR:"belarus",BLZ:"belize",BMU:"bermuda",BOL:"bolivia",BRA:"brazil",BRB:"barbados",BRN:"bruneiDarussalam",BTN:"bhutan",BVT:"bouvetIsland",BWA:"botswana",CAF:"car",CAN:"canada",CCK:"cocosIslands",CHE:"switzerland",CHL:"chile",CHN:"china",CIV:"coteIvoire",CMR:"cameroon",COD:"democraticRepublicOfCongo",COG:"congo",COK:"cookIslands",COL:"colombia",COM:"comoros",CPV:"caboVerde",CRI:"costaRica",CUB:"cuba",CUW:"curacao",CXR:"christmasIsland",CYM:"caymanIslands",CYP:"cyprus",CZE:"czechia",DEU:"germany",DJI:"djibouti",DMA:"dominica",DNK:"denmark",DOM:"dominicanRepublic",DZA:"algeria",ECU:"ecuador",EGY:"egypt",ERI:"eritrea",ESH:"westernSahara",ESP:"spain",EST:"estonia",ETH:"ethiopia",FIN:"finland",FJI:"fiji",FLK:"falklandIslands",FRA:"france",FRO:"faroeIslands",FSM:"micronesia",GAB:"gabon",GBR:"uk",GEO:"georgia",GGY:"guernsey",GHA:"ghana",GIB:"gibraltar",GIN:"guinea",GLP:"guadeloupe",GMB:"gambia",GNB:"guineaBissau",GNQ:"equatorialGuinea",GRC:"greece",GRD:"grenada",GRL:"greenland",GTM:"guatemala",GUF:"frenchGuiana",GUM:"guam",GUY:"guyana",HKG:"hongKong",HMD:"heardIslandAndMcDonaldIslands",HND:"honduras",HRV:"croatia",HTI:"haiti",HUN:"hungary",IDN:"indonesia",IMN:"isleOfMan",IND:"india",IOT:"britishIndianOceanTerritory",IRL:"ireland",IRN:"iran",IRQ:"iraq",ISL:"iceland",ISR:"israel",ITA:"italy",JAM:"jamaica",JEY:"jersey",JOR:"jordan",JPN:"japan",KAZ:"kazakhstan",KEN:"kenya",KGZ:"kyrgyzstan",KHM:"cambodia",KIR:"kiribati",KNA:"saintKittsAndNevis",KOR:"southKorea",KWT:"kuwait",LAO:"lao",LBN:"lebanon",LBR:"liberia",LBY:"libya",LCA:"saintLucia",LIE:"liechtenstein",LKA:"sriLanka",LSO:"lesotho",LTU:"lithuania",LUX:"luxembourg",LVA:"latvia",MAC:"macao",MAF:"frenchSaintMartin",MAR:"morocco",MCO:"monaco",MDA:"moldova",MDG:"madagascar",MDV:"maldives",MEX:"mexico",MHL:"marshallIslands",MKD:"northMacedonia",MLI:"mali",MLT:"malta",MMR:"myanmar",MNE:"montenegro",MNG:"mongolia",MNP:"northernMarianaIslands",MOZ:"mozambique",MRT:"mauritania",MSR:"montserrat",MTQ:"martinique",MUS:"mauritius",MWI:"malawi",MYS:"malaysia",MYT:"mayotte",NAM:"namibia",NCL:"newCaledonia",NER:"niger",NFK:"norfolkIsland",NGA:"nigeria",NIC:"nicaragua",NIU:"niue",NLD:"netherlands",NOR:"norway",NPL:"nepal",NRU:"nauru",NZL:"newZealand",OMN:"oman",PAK:"pakistan",PAN:"panama",PCN:"pitcairn",PER:"peru",PHL:"philippines",PLW:"palau",PNG:"papuaNewGuinea",POL:"poland",PRI:"puertoRico",PRK:"northKorea",PRT:"portugal",PRY:"paraguay",PSE:"palestine",PYF:"frenchPolynesia",QAT:"qatar",REU:"reunion",ROU:"romania",RUS:"russia",RWA:"rwanda",SAU:"saudiArabia",SDN:"sudan",SEN:"senegal",SGP:"singapore",SGS:"southGeorgiaAndTheSouthSandwichIslands",SHN:"saintHelena",SJM:"svalbardAndJanMayen",SLB:"solomonIslands",SLE:"sierraLeone",SLV:"elSalvador",SMR:"sanMarino",SOM:"somalia",SPM:"saintPierreAndMiquelon",SRB:"serbia",SSD:"southSudan",STP:"saoTomeAndPrincipe",SUR:"suriname",SVK:"slovakia",SVN:"slovenia",SWE:"sweden",SWZ:"eswatini",SXM:"dutchSintMaarten",SYC:"seychelles",SYR:"syria",TCA:"turksAndCaicosIslands",TCD:"chad",TGO:"togo",THA:"thailand",TJK:"tajikistan",TKL:"tokelau",TKM:"turkmenistan",TLS:"timorLeste",TON:"tonga",TTO:"trinidadAndTobago",TUN:"tunisia",TUR:"turkey",TUV:"tuvalu",TWN:"taiwan",TZA:"tanzania",UGA:"uganda",UKR:"ukraine",UMI:"usMinorOutlyingIslands",URY:"uruguay",USA:"us",UZB:"uzbekistan",VAT:"holySee",VCT:"saintVincentAndTheGrenadines",VEN:"venezuela",VGB:"britishVirginIslands",VIR:"usVirginIslands",VNM:"vietnam",VUT:"vanuatu",WLF:"wallisAndFutuna",WSM:"samoa",XKX:"kosovo",YEM:"yemen",ZAF:"southAfrica",ZMB:"zambia",ZWE:"zimbabwe"};var Jr=(l=>(l.UsBorderCrossingCard="usBorderCrossingCard",l.ChinaExitEntryPermit="chinaExitEntryPermit",l.UsGlobalEntryCard="usGlobalEntryCard",l.ChinaMainlandTravelPermitTaiwan="chinaMainlandTravelPermitTaiwan",l.UsNexusCard="usNexusCard",l.ChinaMainlandTravelPermitHongKongMacau="chinaMainlandTravelPermitHongKongMacau",l.ApecBusinessTravelCard="apecBusinessTravelCard",l.PakistanAfghanCitizenCard="pakistanAfghanCitizenCard",l.SingaporeFinCard="singaporeFinCard",l.UsGreenCard="usGreenCard",l.MalaysiaIkad="malaysiaIkad",l.MalaysiaMykad="malaysiaMykad",l.MalaysiaMypr="malaysiaMypr",l.MexicoConsularVoterId="mexicoConsularVoterId",l.GermanyEid="germanyEid",l.UsCommonAccessCard="usCommonAccessCard",l.PhilippinesMultipurposeId="philippinesMultipurposeId",l.MalaysiaMykas="malaysiaMykas",l.MalaysiaMykid="malaysiaMykid",l.MalaysiaMytentera="malaysiaMytentera",l.MexicoProfessionalId="mexicoProfessionalId",l.MalaysiaRefugeeId="malaysiaRefugeeId",l.CanadaTribalId="canadaTribalId",l.UsUniformedServicesId="usUniformedServicesId",l.UsVeteranId="usVeteranId",l.PhilippinesWorkPermit="philippinesWorkPermit",l.SingaporeWorkPermit="singaporeWorkPermit",l.UsWorkPermit="usWorkPermit",l.PhilippinesSocialSecurityCard="philippinesSocialSecurityCard",l.SwedenSocialSecurityCard="swedenSocialSecurityCard",l.CanadaSocialSecurityCard="canadaSocialSecurityCard",l.UsSocialSecurityCard="usSocialSecurityCard",l.BelgiumMinorsId="belgiumMinorsId",l.ColombiaMinorsId="colombiaMinorsId",l.PeruMinorsId="peruMinorsId",l.BoliviaMinorsId="boliviaMinorsId",l.HungaryAddressCard="hungaryAddressCard",l.UkAsylumRequest="ukAsylumRequest",l.CanadaCitizenshipCertificate="canadaCitizenshipCertificate",l.SingaporeEmploymentPass="singaporeEmploymentPass",l.CanadaMinorsPublicServicesCard="canadaMinorsPublicServicesCard",l.MalaysiaMypolis="malaysiaMypolis",l.PhilippinesNbiClearance="philippinesNbiClearance",l.IndiaPanCard="indiaPanCard",l.PhilippinesPostalId="philippinesPostalId",l.PakistanProofOfRegistration="pakistanProofOfRegistration",l.SingaporeSPass="singaporeSPass",l.SwedenSisId="swedenSisId",l.ColombiaTemporaryProtectionPermit="colombiaTemporaryProtectionPermit",l.UsTwicCard="usTwicCard",l.UsWeaponPermit="usWeaponPermit",l.CanadaWeaponPermit="canadaWeaponPermit",l.IrelandPublicServicesCard="irelandPublicServicesCard",l.CanadaPublicServicesCard="canadaPublicServicesCard",l.PakistanConsularId="pakistanConsularId",l.GuatemalaConsularId="guatemalaConsularId",l.MexicoConsularId="mexicoConsularId",l.PhilippinesTaxId="philippinesTaxId",l.MexicoTaxId="mexicoTaxId",l.ChinaOneWayPermit="chinaOneWayPermit",l.UsMedicalMarijuanaCard="usMedicalMarijuanaCard",l.UsMunicipalId="usMunicipalId",l.AustraliaAsicCard="australiaAsicCard",l.UaeVehicleRegistrationCard="uaeVehicleRegistrationCard",l.UaeEsaadCard="uaeEsaadCard",l.UkMilitaryId="ukMilitaryId",l))(Jr||{});var _r=["field-identification-failed","invalid-characters-found","mandatory-field-missing","detection-failed","image-return-failed","not-scanned"],De=class{constructor(e){this.workerCallProvider=e;}async processResult(e,t,r){return !this.hasFrontVIZResult(e)||_r.includes(t.processingStatus)?null:{mrzResult:null,barcodeResult:null,verificationResult:null,vizResult:await this.getVizResult(e,t,r),imageInfo:this.getImageData(e),isCapturingComplete:false}}isBackSideCaptureSupported(e,t){let{scanningStatus:r}=e;return r==="side-scanned"||t.subResults.length>1}async getVizResult(e,t,r){let i=t.documentClassInfo,s={...await this.extractVizData(i,e),usRealIdStatus:this.getRealIdStatus(t),capturedSides:"frontOnly",isBackSideCaptureSupported:this.isBackSideCaptureSupported(r,e),frontFieldLocations:this.getFieldLocations(e),location:t.documentLocation?be(t.documentLocation).toJSONObject():null};if(this.adjustResultForSpecialCases(e,s),r.scanningStatus==="document-scanned"&&this.hasFrontAndBackVIZResult(e)){s.capturedSides="frontAndBack";let o=["address","dateOfBirth","dateOfExpiry","dateOfIssue","documentNumber","firstName","fullName","lastName","nationality","sex","additionalAddressInformation","additionalNameInformation","documentAdditionalNumber","employer","issuingAuthority","maritalStatus","personalIdNumber","placeOfBirth","profession","race","religion","residentialStatus","mothersName","fathersName"],u=e.subResults[1].viz;for(let c of o){let m=s[c]==null||s[c]==="",h=u==null?void 0:u[c];m&&h!=null&&this.handleEmptyFrontValue(s,c,h);}}return s}handleEmptyFrontValue(e,t,r){if(Ie(r)){let i=te(r);i&&(e[t]=i);}else if(Ke(r)){let i=Q(r);i!=null&&i.value&&i.value.length>0&&(e[t]=i.value);}}async extractVizData(e,t){var N,Qe,$e,Ye,Xe,et,tt;let r=t.subResults[0].viz;function i(rt){var at,it;return rt==null?"":(it=(at=Q(rt))==null?void 0:at.value)!=null?it:""}function s(){return r.additionalNameInformation?i(r.additionalNameInformation):i(t.additionalNameInformation)}let o=i((N=t.driverLicenseDetailedInfo)==null?void 0:N.vehicleClass),u=i((Qe=t.driverLicenseDetailedInfo)==null?void 0:Qe.restrictions),c=i(($e=t.driverLicenseDetailedInfo)==null?void 0:$e.endorsements),m=this.workerCallProvider(),h=null;m&&(o.length>0||u.length>0||c.length>0)&&(h=await ve.create(m).createDrivingLicenseDetailsFromCentaurusData(o,u,c));let[g,C]=(Ye=Wr(e.type,e.country))!=null?Ye:[null,null];return {firstName:i(r.firstName),lastName:i(r.lastName),secondaryLastName:null,fullName:i(r.fullName),sex:i(r.sex),dateOfBirth:te(r.dateOfBirth),nationality:i(r.nationality),address:i(r.address),documentType:g,documentSubtype:C,issuingCountryIso:(Xe=e.isoAlpha3CountryCode)!=null?Xe:null,issuingCountry:(tt=Lt[(et=e.isoAlpha3CountryCode)!=null?et:""])!=null?tt:null,documentNumber:i(r.documentNumber),dateOfExpiry:te(r.dateOfExpiry),dateOfIssue:te(r.dateOfIssue),additionalAddressInformation:i(r.additionalAddressInformation),additionalNameInformation:s(),documentAdditionalNumber:i(r.documentAdditionalNumber),employer:i(r.employer),issuingAuthority:i(r.issuingAuthority),maritalStatus:i(r.maritalStatus),personalIdNumber:i(r.personalIdNumber),placeOfBirth:i(r.placeOfBirth),profession:i(r.profession),race:i(r.race),religion:i(r.religion),residentialStatus:i(r.residentialStatus),mothersName:i(r.mothersName),fathersName:i(r.fathersName),issuingJurisdiction:Mt(e.region),issuingJurisdictionIso:null,drivingLicenseDetails:h?h.toJSONObject():null,bloodType:i(r.bloodType),sponsor:i(r.sponsor),passportNumber:null,visaNumber:null,vehicleOwner:i(r.vehicleOwner)}}adjustResultForSpecialCases(e,t){var i,s,o;let r=e.documentClassInfo;if(r.country==="germany"&&r.type==="id"){let u=e.lastName?e.lastName:(i=e.subResults[0].viz)==null?void 0:i.lastName;t.lastName=(o=(s=Q(u))==null?void 0:s.value)!=null?o:null;}}getFieldLocations(e){var i;let t=(i=e.subResults[0].viz)!=null?i:{},r={};for(let[s,o]of Object.entries(t)){let u=s;if(typeof o=="object"&&o!=null){if(Ie(o)){let c=Q(o.originalString);c&&He(c)&&(r[u]=Ge(c.location));}else if(Ke(o)){let c=Q(o);c!=null&&He(c)&&(r[u]=Ge(c.location));}}}return r}getImageBase64String(e){if(e==null)return null;let t=document.createElement("canvas");t.width=e.width,t.height=e.height;let r=t.getContext("2d");return r?(r.putImageData(e,0,0),t.toDataURL().split(",")[1]):null}getImageData(e){var s;let[t,r]=e.subResults,i={face:this.getImageBase64String((s=t==null?void 0:t.faceImage)==null?void 0:s.image)};return this.hasFrontAndBackVIZResult(e)?{front:{...i,croppedDocument:this.getImageBase64String(t.documentImage),frame:null},back:{face:null,croppedDocument:this.getImageBase64String(r==null?void 0:r.documentImage),frame:null}}:{front:{...i,croppedDocument:this.getImageBase64String(t==null?void 0:t.documentImage),frame:null},back:{face:null,croppedDocument:null,frame:null}}}getRealIdStatus(e){switch(e.realIDDetectionStatus){case "not-available":return "notAvailable";case "not-detected":return "notRealIdCompliant";case "detected":return "realIdCompliant";default:return "notAvailable"}}hasFrontVIZResult(e){return e.subResults[0].viz!=null}hasFrontAndBackVIZResult(e){return e.subResults.length>1}};function Wr(a,e){if(a==null)return null;switch(a){case "id":case "voter-id":case "passport-card":case "proof-of-registration":case "non-voter-id":case "proof-of-age-card":return ["idCard",null];case "dl":case "dl-public-services-card":case "professional-dl":case "driver-card":case "driving-privilege-card":case "driver-qualification-card":case "provisional-dl":return ["driverLicense",null];case "passport":case "alien-passport":case "consular-passport":case "minors-passport":case "refugee-passport":return ["passport",null];case "residence-permit":case "resident-id":case "temporary-residence-permit":case "alien-id":case "special-id":return ["residencePermit",null];case "visa":case "immigrant-visa":return ["visaIcao",null];case "health-insurance-card":case "interim-health-insurance-card":case "reciprocal-health-insurance-card":return ["healthInsuranceCard",null];case "consular-id":return Vr(e);case "employment-pass":return ["regionSpecific","singaporeEmploymentPass"];case "fin-card":return ["regionSpecific","singaporeFinCard"];case "multipurpose-id":return ["regionSpecific","philippinesMultipurposeId"];case "mykad":return ["regionSpecific","malaysiaMykad"];case "mykid":return ["regionSpecific","malaysiaMykid"];case "mypr":return ["regionSpecific","malaysiaMypr"];case "mytentera":return ["regionSpecific","malaysiaMytentera"];case "pan-card":return ["regionSpecific","indiaPanCard"];case "professional-id":return ["regionSpecific","mexicoProfessionalId"];case "public-services-card":return Hr(e);case "work-permit":return Kr(e);case "ikad":return ["regionSpecific","malaysiaIkad"];case "military-id":return Ur(e);case "mykas":return ["regionSpecific","malaysiaMykas"];case "social-security-card":return Gr(e);case "s-pass":return ["regionSpecific","singaporeSPass"];case "address-card":return ["regionSpecific","hungaryAddressCard"];case "green-card":return ["regionSpecific","usGreenCard"];case "minors-id":return Zr(e);case "postal-id":return ["regionSpecific","philippinesPostalId"];case "tax-id":return Qr(e);case "weapon-permit":return $r(e);case "border-crossing-card":return ["regionSpecific","usBorderCrossingCard"];case "global-entry-card":return ["regionSpecific","usGlobalEntryCard"];case "mypolis":return ["regionSpecific","malaysiaMypolis"];case "nexus-card":return ["regionSpecific","usNexusCard"];case "refugee-id":return ["regionSpecific","malaysiaRefugeeId"];case "tribal-id":case "non-card-tribal-id":return ["regionSpecific","canadaTribalId"];case "veteran-id":return ["regionSpecific","usVeteranId"];case "citizenship-certificate":return ["regionSpecific","canadaCitizenshipCertificate"];case "minors-public-services-card":return ["regionSpecific","canadaMinorsPublicServicesCard"];case "asylum-request":return ["regionSpecific","ukAsylumRequest"];case "uniformed-services-id":return ["regionSpecific","usUniformedServicesId"];case "consular-voter-id":return ["regionSpecific","mexicoConsularVoterId"];case "twic-card":return ["regionSpecific","usTwicCard"];case "nbi-clearance":return ["regionSpecific","philippinesNbiClearance"];case "temporary-protection-permit":return ["regionSpecific","colombiaTemporaryProtectionPermit"];case "afghan-citizen-card":return ["regionSpecific","pakistanAfghanCitizenCard"];case "eid":return ["regionSpecific","germanyEid"];case "sis-id":return ["regionSpecific","swedenSisId"];case "asic-card":return ["regionSpecific","australiaAsicCard"];case "vehicle-registration":return ["regionSpecific","uaeVehicleRegistrationCard"];case "esaad-card":return ["regionSpecific","uaeEsaadCard"];case "medical-marijuana-id":return ["regionSpecific","usMedicalMarijuanaCard"];case "registration-certificate":return ["residencePermit",null];case "diplomatic-id":case "exit-entry-permit":case "mainland-travel-permit-taiwan":case "bidoon-card":case "pass":case "my-number-card":return null;default:assertUnreachable(a);}return null}function Ur(a){return a==="uk"?["regionSpecific","ukMilitaryId"]:["regionSpecific","usCommonAccessCard"]}function Vr(a){switch(a){case "pakistan":return ["regionSpecific","pakistanConsularId"];case "guatemala":return ["regionSpecific","guatemalaConsularId"];case "mexico":return ["regionSpecific","mexicoConsularId"];default:return ["regionSpecific",null]}}function Hr(a){switch(a){case "ireland":return ["regionSpecific","irelandPublicServicesCard"];case "canada":return ["regionSpecific","canadaPublicServicesCard"];default:return ["regionSpecific",null]}}function Kr(a){switch(a){case "philippines":return ["regionSpecific","philippinesWorkPermit"];case "singapore":return ["regionSpecific","singaporeWorkPermit"];case "usa":return ["regionSpecific","usWorkPermit"];default:return ["regionSpecific",null]}}function Gr(a){switch(a){case "philippines":return ["regionSpecific","philippinesSocialSecurityCard"];case "sweden":return ["regionSpecific","swedenSocialSecurityCard"];case "canada":return ["regionSpecific","canadaSocialSecurityCard"];case "usa":return ["regionSpecific","usSocialSecurityCard"];default:return ["regionSpecific",null]}}function Zr(a){switch(a){case "belgium":return ["regionSpecific","belgiumMinorsId"];case "colombia":return ["regionSpecific","colombiaMinorsId"];case "peru":return ["regionSpecific","peruMinorsId"];case "bolivia":return ["regionSpecific","boliviaMinorsId"];default:return ["regionSpecific",null]}}function Qr(a){switch(a){case "philippines":return ["regionSpecific","philippinesTaxId"];case "mexico":return ["regionSpecific","mexicoTaxId"];default:return ["regionSpecific",null]}}function $r(a){switch(a){case "usa":return ["regionSpecific","usWeaponPermit"];case "canada":return ["regionSpecific","canadaWeaponPermit"];default:return ["regionSpecific",null]}}var A=class{static isSingleSideScanner(e){return !e._isFull}static isFullDocumentScanner(e){return e._isFull}};var q=class{constructor(e,t,r){this.isDeleted=false;this.centaurusWasmSDK=e,this.idCaptureSettings=t,this.scannerDefaultSettings=r;}get type(){return this._type}async process(e){return {...await this.session.process(e),centaurusResult:await this.getResult()}}async getResult(){return this.session.getResult()}async delete(){this.isDeleted||(this.isDeleted=true,await this.session.delete());}async createSession(e){var i,s;let t={inputImageSource:((i=e==null?void 0:e.inputImageSource)!=null?i:e!=null&&e.scanCroppedDocumentImage)?"photo":"video",scanningMode:A.isSingleSideScanner(this.idCaptureSettings.scannerType)?"single":"automatic",scanningSettings:{anonymizationMode:this.getAnonymizationMode(),scanCroppedDocumentImage:(s=e==null?void 0:e.scanCroppedDocumentImage)!=null?s:false,skipImagesOccludedByHand:this.scannerDefaultSettings.skipImagesOccludedByHand,scanUnsupportedBack:this.scannerDefaultSettings.scanUnsupportedBack,recognitionModeFilter:{enableBarcodeId:this.scannerDefaultSettings.filter.enableBarcodeId,enableFullDocumentRecognition:!(e!=null&&e.detectionOnlyMode)&&this.scannerDefaultSettings.filter.enableFullDocumentRecognition,enableMrzId:this.scannerDefaultSettings.filter.enableMrzId,enableMrzPassport:this.scannerDefaultSettings.filter.enableMrzPassport,enableMrzVisa:this.scannerDefaultSettings.filter.enableMrzVisa,enablePhotoId:this.scannerDefaultSettings.filter.enablePhotoId},croppedImageSettings:{returnDocumentImage:this.idCaptureSettings.getShouldPassImageTypeToResult("croppedDocument"),returnFaceImage:this.idCaptureSettings.getShouldPassImageTypeToResult("face")}}},r=[99,114,101,97,116,101,66,108,105,110,107,73,100,83,99,97,110,110,105,110,103,83,101,115,115,105,111,110].map(o=>String.fromCodePoint(o)).join("");return this.centaurusWasmSDK[r](t)}getAnonymizationMode(){switch(this.idCaptureSettings.anonymizationMode){case "none":return null;case "fieldsOnly":return null;case "imagesOnly":return "image-only";case "fieldsAndImages":return "image-only"}}};var Ae=class a extends q{constructor(){super(...arguments);this._type="scanCroppedDocument";}static async create(t,r,i,s){let o=new a(t,r,i);return o.session=await o.createSession({scanCroppedDocumentImage:true}),o.resultProcessor=s,o}async process(t){let r=await this.doProcess(t);if(r.hasCapturedId)return r;let i=[.9,.8,.7];for(let s of i){let o=await this.scaleImage(this.imageDataFromArrayBuffer(r.arrayBuffer,t.width,t.height),s);if(o&&(r=await this.doProcess(o),r.hasCapturedId))return r}return r}async scaleImage(t,r){let i=document.createElement("canvas");i.width=t.width,i.height=t.height;let s=i.getContext("2d"),o=await createImageBitmap(t);return s?(s.fillStyle="#000000",s.fillRect(0,0,i.width,i.height),s.scale(r,r),s.drawImage(o,(i.width/r-t.width)/2,(i.height/r-t.height)/2,t.width,t.height),s.getImageData(0,0,i.width,i.height)):null}async doProcess(t){let{inputImageAnalysisResult:r,resultCompleteness:i,arrayBuffer:s}=await this.session.process(t),o=await this.getResult(),u=await this.resultProcessor.processResult(o,r,i);return {inputImageAnalysisResult:r,resultCompleteness:i,arrayBuffer:s,centaurusResult:o,hasCapturedId:u!=null}}imageDataFromArrayBuffer(t,r,i){return new ImageData(new Uint8ClampedArray(t),r,i,{colorSpace:"srgb"})}};var qe=class a extends q{constructor(){super(...arguments);this._type="default";}static async create(t,r,i){let s=new a(t,r,i);return s.session=await s.createSession(),s}};var we=class a extends q{constructor(){super(...arguments);this._type="localizeOnly";}static async create(t,r,i){let s=new a(t,r,i);return s.session=await s.createSession(),s}async createSession(){return super.createSession({detectionOnlyMode:true})}async process(t){let r=await super.process(t);return r.resultCompleteness.scanningStatus==="document-scanned"&&(await this.session.delete(),this.session=await this.createSession()),r}};var Oe=class a extends q{constructor(){super(...arguments);this._type="photoMode";}static async create(t,r,i){let s=new a(t,r,i);return s.session=await s.createSession({inputImageSource:"photo"}),s}};var Ne=class{constructor(e,t){this.isProcessing=false;this._lastError=null;this._lastResult=null;this._lastLocalization=null;this._engagedSession=null;this._isDetectionOnlyMode=false;this._hasDefaultSessionFullResult=false;this.centaurusWasmSDK=e,this._workerCallProvider=t;}get engagedSession(){var e;return (e=this._engagedSession)!=null?e:null}set engagedSession(e){this._engagedSession!==e&&(this._engagedSession=e);}async init(e,t){this.idCaptureSettings=e.clone(),this.resultProcessor=new De(this._workerCallProvider),this.scannerDefaultSettings=t,await this.createAllSessions(),this._lastResult=null,this._lastError=null,this._lastLocalization=null;}isReadyToProcessFrame(){return this.isProcessing===false}async processFrame(e,t){this.isProcessing=true,this.engagedSession=this.autoSelectSession(t);let{inputImageAnalysisResult:r,resultCompleteness:i,arrayBuffer:s,centaurusResult:o}=await this.engagedSession.process({...e,colorSpace:"srgb"}),u=null;this.engagedSession!==this.localizeOnlySession&&(u=await this.resultProcessor.processResult(o,r,i),i.scanningStatus==="document-scanned"&&(this._hasDefaultSessionFullResult=true));let c=this.getLocation(r),m=this.toLocalizedOnlyId(c),h=this.toDetectionIssue(r.documentDetectionStatus);return u&&c&&(u.vizResult.location=c.toJSONObject()),this.isProcessing=false,{arrayBuffer:s,capturedId:u,localizedOnlyId:m,detectionIssue:h}}async reset(){for(let e of [this.defaultSession,this.scanCroppedDocumentSession,this.localizeOnlySession,this.photoModeSession])await(e==null?void 0:e.delete());await this.createAllSessions(),this._lastResult=null,this._lastError=null,this._lastLocalization=null,this._hasDefaultSessionFullResult=false;}async applySettings(e){this.idCaptureSettings=e.clone(),await this.reset(),this.setDetectionOnlyMode(this.idCaptureSettings.captureTrigger==="buttonTap");}async setDetectionOnlyMode(e){this._isDetectionOnlyMode!==e&&(this._isDetectionOnlyMode=e);}async dispose(){for(let e of [this.defaultSession,this.scanCroppedDocumentSession,this.localizeOnlySession,this.photoModeSession])await(e==null?void 0:e.delete());}async createAllSessions(){this.defaultSession=await qe.create(this.centaurusWasmSDK,this.idCaptureSettings,this.scannerDefaultSettings),this.scanCroppedDocumentSession=await Ae.create(this.centaurusWasmSDK,this.idCaptureSettings,this.scannerDefaultSettings,this.resultProcessor),this.photoModeSession=await Oe.create(this.centaurusWasmSDK,this.idCaptureSettings,this.scannerDefaultSettings),this.localizeOnlySession=await we.create(this.centaurusWasmSDK,this.idCaptureSettings,this.scannerDefaultSettings);}autoSelectSession(e){return this._hasDefaultSessionFullResult||this._isDetectionOnlyMode?this.localizeOnlySession:e.scanCroppedDocumentImage?this.scanCroppedDocumentSession:e.forcePhotoImageSource?this.photoModeSession:this.defaultSession}getLocation(e){return e.documentDetectionStatus==="failed"||!e.documentLocation?null:be(e.documentLocation)}toLocalizedOnlyId(e){return e!=null?Z.fromJSON({location:e.toJSONObject()}):null}toDetectionIssue(e){let t=null;switch(e){case "camera-too-far":{t="DocumentTooFar";break}case "camera-too-close":case "document-too-close-to-camera-edge":case "document-partially-visible":{t="DocumentTooClose";break}default:t=null;}return t}displayDetectionStatusInUI(e){let t=window,r=t.centaurusDetectionStatus;r==null&&(r=document.createElement("div"),r.className="centaurusDetectionStatus",r.style.position="absolute",r.style.zIndex="1000",r.style.top="10px",r.style.left="10px",r.style.padding="0 1rem",r.style.backgroundColor="white",document.body.append(r),t.centaurusDetectionStatus=r),r.textContent=`LocalizedStatus: ${e}`;}};var Yr=(g=>(g.NotAcceptedDocumentType="notAcceptedDocumentType",g.InvalidFormat="invalidFormat",g.DocumentVoided="documentVoided",g.Timeout="timeout",g.SingleImageNotRecognized="singleImageNotRecognized",g.DocumentExpired="documentExpired",g.DocumentExpiresSoon="documentExpiresSoon",g.NotRealIdCompliant="notRealIdCompliant",g.HolderUnderage="holderUnderage",g.ForgedAamvaBarcode="forgedAamvaBarcode",g.InconsistentData="inconsistentData",g))(Yr||{});var xe="reloadDetector",ke=class ke{constructor(e,t=ke.DEFAULT_WRITE_INTERVAL_MS){this._lastWrite=0;this._storage=e,this._writeIntervalMs=t;}hasDataAlreadyWritten(){return this._storage.getItem(xe)!==null}write(e){return this._pendingData={...e},this.scheduleWrite(),e}read(){var t;if(this._pendingData)return this._pendingData;let e=(t=this._storage.getItem(xe))!=null?t:"{}";return JSON.parse(e)}clear(){this._storage.removeItem(xe),this._pendingData=void 0,this._lastWrite=0,clearTimeout(this._writeTimer);}scheduleWrite(){clearTimeout(this._writeTimer);let e=performance.now()-this._lastWrite;e>this._writeIntervalMs?(this._storage.setItem(xe,JSON.stringify(this._pendingData)),this._pendingData=void 0,this._lastWrite=performance.now()):this._writeTimer=setTimeout(this.scheduleWrite.bind(this),this._writeIntervalMs-e);}};ke.DEFAULT_WRITE_INTERVAL_MS=500;var Te=ke;var re=class{constructor(e){this.onUnload=()=>{this._storage.clear();};this._onPageAbruptlyReloaded=e,this._storage=new Te(this.getStorage());}static isSafari(){return BrowserHelper.isSafari()}install(){if(BrowserHelper.isSafari()){if(window.addEventListener("unload",this.onUnload,{once:true}),!this._storage.hasDataAlreadyWritten()){this._storage.write({});return}this._onPageAbruptlyReloaded();}}updateData(e){this._storage.write(e);}get data(){return this._storage.read()}uninstall(){window.removeEventListener("unload",this.onUnload);}getStorage(){return sessionStorage}};var Pe=class Pe{constructor(e){this._framesProcessedCount=0;this._didCaptureCount=0;this._didRejectCount=0;this._applySettingsCount=1;this._videoResolution="";this._upTimeMs=0;this._upTimeTimer=null;this._detector=e;}destroy(){this._upTimeTimer&&(clearInterval(this._upTimeTimer),this._upTimeTimer=null);}get framesProcessedCount(){return this._framesProcessedCount}get didCaptureCount(){return this._didCaptureCount}get didRejectCount(){return this._didRejectCount}get applySettingsCount(){return this._applySettingsCount}get videoResolution(){return this._videoResolution}set framesProcessedCount(e){this._framesProcessedCount=e,this._upTimeTimer==null&&(this._firstFrameProcessedTime=performance.now(),this._upTimeTimer=setInterval(this.updateUpTime.bind(this),Pe.UP_TIME_UPDATE_INTERVAL_MS)),this._detector.updateData(this.data);}set didCaptureCount(e){this._didCaptureCount=e,this._detector.updateData(this.data);}set didRejectCount(e){this._didRejectCount=e,this._detector.updateData(this.data);}set applySettingsCount(e){this._applySettingsCount=e,this._detector.updateData(this.data);}set videoResolution(e){this._videoResolution=e,this._detector.updateData(this.data);}get data(){return {framesProcessedCount:this._framesProcessedCount,didCaptureCount:this._didCaptureCount,didRejectCount:this._didRejectCount,applySettingsCount:this._applySettingsCount,upTime:Math.round(this._upTimeMs/100)/10,videoResolution:this._videoResolution}}updateUpTime(){this._firstFrameProcessedTime&&(this._upTimeMs=performance.now()-this._firstFrameProcessedTime,this._detector.updateData(this.data));}};Pe.UP_TIME_UPDATE_INTERVAL_MS=500;var Re=Pe;var f={Initializing:"Initializing",Available:"Available",ProcessingFrame:"ProcessingFrame",ProcessingQueue:"ProcessingQueue"},jt=class a{constructor(){this.type="idCapture";this._synchronousFrameFlow=true;this.state=f.Initializing;this._isEnabled=true;this._context=null;this.listeners=[];this.overlayListeners=new Set;this._endOfCycleTasks=[];this._feedback=ce.defaultFeedback;this._onProcessFrameListener=this.onProcessFrame.bind(this);this.workerMessageListener=this.onWorkerMessage.bind(this);this.shouldEnableCentaurus()&&(this._centaurusConnector=new Ne(O.wasmSDK,()=>{var e;return (e=this.privateContext)==null?void 0:e.workerCommand})),this.contextListener={didChangeFrameSource:this.didChangeFrameSource.bind(this)};}static get recommendedCameraSettings(){return new CameraSettings(I.IdCapture.RecommendedCameraSettings)}get context(){return this._context}get feedback(){return this._feedback}get privateContext(){return this.context}static async forContext(e,t){let r=new a;return r.settings=t,e&&(await e.addMode(r),r.shouldEnableCentaurus()&&await r.initCentaurusConnector()),r.checkCaptureSettingsAgainstSDKConfiguration(t),r.moveToState(f.Available),r}async setFeedback(e){return this._feedback=e,this.didChange()}addListener(e){this.listeners.includes(e)||this.listeners.push(e);}removeListener(e){this.listeners.includes(e)&&this.listeners.splice(this.listeners.indexOf(e),1);}isEnabled(){return this._isEnabled}async setEnabled(e){this._isEnabled!==e&&(this._isEnabled=e,this.enqueueTask(async()=>this.didChange([{type:"modeEnabled",newValue:e}])),this.state===f.Available&&this.moveToState(f.ProcessingQueue));}async reset(){this.enqueueTask(async()=>this.doReset()),this.state===f.Available&&this.moveToState(f.ProcessingQueue);}async applySettings(e){this.enqueueTask(async()=>this.doApplySettings(e.clone())),this.state===f.Available&&this.moveToState(f.ProcessingQueue);}async parse(e){if(this.context){let t=await this.context.workerCommand("idCaptureParse",{code:e});if((t==null?void 0:t.result)!=null){let r=t.result;if((r==null?void 0:r.status)==="error")throw v.create({type:"InvalidLicenseKeyForParser",message:r.error});if((r==null?void 0:r.status)==="success"){let i=this.convertRawImagesToBase64(r.capturedId.rawImageInfo);return ee.fromJSON({...r.capturedId,imageInfo:i})}}}return null}async setExternalTransactionId(e){var t;return (t=this.privateContext)==null?void 0:t.workerCommand("idCaptureSetExternalTransactionId",{transactionId:e})}async getExternalTransactionId(){var e,t,r;return (r=(t=await((e=this.privateContext)==null?void 0:e.workerCommand("idCaptureGetExternalTransactionId",{})))==null?void 0:t.transactionId)!=null?r:null}toJSONObject(){var e;return {enabled:this._isEnabled,type:this.type,settings:{...this.settings.toJSONObject(),licensee:"",licenseKey:(e=O.licenseKey)!=null?e:""}}}shouldEnableCentaurus(){return O.wasmSDK!=null}async initCentaurusConnector(){var t;if(!this.privateContext)throw v.create({type:"Undefined",message:"Cannot initialize Centaurus without a context"});let e=await((t=this.privateContext)==null?void 0:t.workerCommand("idCaptureGetCentaurusSettings",{}));try{await this._centaurusConnector.init(this.settings,Object.freeze(e.result));}catch(r){throw r instanceof DataCaptureError&&r.name==="MULTIPLE_RECOGNIZER_RUNNER"&&Logger.log(Logger.Level.Error,"The newly created IdCapture mode is invalid, an existing IdCapture mode is still attached to the context and must be removed first."),r}}async onSDCResetDone(){var e;return (e=this._centaurusConnector)==null?void 0:e.reset()}didChangeFrameSource(){this.moveToState(f.ProcessingQueue);}moveToState(e){this.state=e,e===f.ProcessingQueue&&this.processQueue();}async doReset(){var e;await((e=this.privateContext)==null?void 0:e.workerCommand("idCaptureReset",{}));}async doApplySettings(e){var t,r,i;this.context&&(this.settings=e,this.checkCaptureSettingsAgainstSDKConfiguration(e),await Promise.all([this.shouldEnableVIZScanner(e)?(t=this._centaurusConnector)==null?void 0:t.applySettings(e):Promise.resolve(),(r=this.privateContext)==null?void 0:r.workerCommand("idCaptureApplySettings",{settings:e.toJSONObject()}),(i=this.privateContext)==null?void 0:i.update()]),this._safariOOMStatsCollector&&this._safariOOMStatsCollector.applySettingsCount++);}addOverlayListener(e){this.overlayListeners.add(e);}removeOverlayListener(e){this.overlayListeners.delete(e);}checkCaptureSettingsAgainstSDKConfiguration(e){!this._centaurusConnector&&this.shouldEnableVIZScanner(e)&&console.warn('Invalid IdCapture configuration or settings: VIZ scanner enabled but not loaded. You either need to set the "enableVIZDocuments" option to true when calling configure(), or adapt the Id Capture settings to not enable VIZ scanning.');}async onProcessFrame(e){var r,i;if(this.state!==f.Available)return {action:"skip",frame:e};(r=this.privateContext)==null||r.performanceMark("processFrameBeforeCentaurus"),this.moveToState(f.ProcessingFrame);let t=await this.doProcessFrame(e);return (i=this.privateContext)==null||i.performanceMark("processFrameAfterCentaurus"),{action:"continue",frame:t}}async doProcessFrame(e){var c;if(!this._isEnabled||!this.shouldEnableVIZScanner(this.settings))return e;let t=(c=this.context)==null?void 0:c.frameSource,r="singleImageUploader",i="imageFrameSource",s=(t==null?void 0:t.type)===r,o=(t==null?void 0:t.type)===i;return await this.processFrameWithCentaurus(e,{scanCroppedDocumentImage:s,forcePhotoImageSource:o})}async onAfterProcessFrame(){var e,t;if(this._safariOOMStatsCollector){this._safariOOMStatsCollector.framesProcessedCount++;let r=(t=(e=this.context)==null?void 0:e.frameSource)==null?void 0:t.currentResolution;r?this._safariOOMStatsCollector.videoResolution=`${r.width}x${r.height}`:this._safariOOMStatsCollector.videoResolution="";}this.moveToState(f.ProcessingQueue);}logPerformance(){let e=performance.getEntriesByName("processFrameBeforeCentaurus").length>0?performance.measure("Centaurus","processFrameBeforeCentaurus","processFrameAfterCentaurus").duration:0,t=performance.measure("SDC","processFrameBeforeSDC","processFrameAfterSDC").duration,r=`${(e+t).toFixed(2)}ms`;console.log(`centaurus: ${e.toFixed(2)}`,`sdc: ${t.toFixed(2)}`,`total: ${r}`),performance.clearMarks();}enqueueTask(e){this._endOfCycleTasks.push(e);}async processQueue(){if(this._endOfCycleTasks.length===0){this.moveToState(f.Available);return}for(;this._endOfCycleTasks.length>0;){let e=this._endOfCycleTasks.shift();await(e==null?void 0:e());}this.moveToState(f.Available);}shouldEnableVIZScanner(e){let{scannerType:t}=e;return A.isFullDocumentScanner(t)?true:t.visualInspectionZone}attachedToContext(e){this._context=e,this._context.subscribeToWorkerMessages(this.workerMessageListener),this._context.registerFrameHandler(this._onProcessFrameListener),re.isSafari()&&(this._safariOOMDetector=new re(this.onPageAbruptlyReloaded.bind(this)),this._safariOOMDetector.install(),this._safariOOMStatsCollector=new Re(this._safariOOMDetector)),this._context.addListener(this.contextListener);}async detachedFromContext(){await this.dispose();}async dispose(){var e,t,r,i,s,o,u;(e=this._context)==null||e.unsubscribeToWorkerMessages(this.workerMessageListener),(t=this._context)==null||t.unregisterFrameHandler(this._onProcessFrameListener),(r=this._context)==null||r.removeListener(this.contextListener),(i=this._safariOOMDetector)==null||i.uninstall(),this._safariOOMDetector=void 0,(s=this._safariOOMStatsCollector)==null||s.destroy(),this._safariOOMStatsCollector=void 0,this.listeners=[],await((o=this._centaurusConnector)==null?void 0:o.dispose()),this._centaurusConnector=void 0,(u=this.privateContext)==null||u.workerCommand("idCaptureDispose",{}),this._context=null,this.moveToState("Available");}async didChange(e){if(this.context)return this.context.update(e)}async onWorkerMessage(e){switch(e.type){case "idCaptureDidCaptureId":{this.triggerListenersForResult("didCaptureId",e.payload);break}case "idCaptureDidPartiallyCaptureId":{this.triggerListenersForResult("didPartiallyCaptureId",e.payload);break}case "idCaptureDidRejectId":{await this.triggerListenersForResult("didRejectId",e.payload),e.payload.rejectionReason==="singleImageNotRecognized"&&await this.reset();break}case "idCaptureDidLocalizeId":{this.triggerListenersForLocalization(e.payload.localization);break}case "idCaptureDidShutterButtonPositionChanged":{for(let r of this.overlayListeners)r.onShutterPositionUpdate(e.payload.position);break}case "idCaptureDidShutterButtonStateChanged":{for(let r of this.overlayListeners)r.onShutterButtonStateChanged(e.payload.state);break}case "idCaptureIdCapturedFeedback":{this._feedback.idCaptured.emit();break}case "idCaptureIdRejectedFeedback":{this._feedback.idRejected.emit();break}case "idCaptureBackendReset":{this.enqueueTask(async()=>this.onSDCResetDone());break}case "idCaptureDetectionOnlyMode":{this.enqueueTask(async()=>{var r;return (r=this._centaurusConnector)==null?void 0:r.setDetectionOnlyMode(e.payload.detectionOnlyMode)}),this.state===f.Available&&this.moveToState(f.ProcessingQueue);break}case "onFrameProcessingStarted":break;case "onFrameProcessingFinished":{this.onAfterProcessFrame();break}case "onFrameSkipped":{this.onAfterProcessFrame();break}}}async processFrameWithCentaurus(e,t){var r;if(!((r=this._centaurusConnector)!=null&&r.isReadyToProcessFrame()))return e;try{let{arrayBuffer:i,capturedId:s,detectionIssue:o,localizedOnlyId:u}=await this._centaurusConnector.processFrame(e,t);return await this.reportToBackend(s,o,u),{width:e.width,height:e.height,colorType:e.colorType,data:new Uint8ClampedArray(i)}}catch(i){return i instanceof v?(Logger.log(Logger.Level.Debug,i.message),this.triggerErrorListener(i)):(Logger.log(Logger.Level.Debug,"Error while processing incoming frame from SDC",i),this.triggerErrorListener(v.create({type:"Undefined",message:"Error while processing a frame"}))),e}}async reportToBackend(e,t,r){e!==void 0&&await this.reportLastResult(e),await this.reportLastLocalizedId(r),await this.reportLastDetectionIssue(t),await this.reportLastError(null);}uint8ArrayImageToBase64(e,t,r){let i=document.createElement("canvas");i.width=t,i.height=r;let s=i.getContext("2d");if(!s)throw new Error("Could not get 2d context from an HTMLCanvasElement");s.putImageData(new ImageData(e,t,r,{colorSpace:"srgb"}),0,0);let o=s.canvas.toDataURL("image/png",1).replace("data:image/png;base64,","");return s=null,i=null,o}convertRawImagesToBase64(e){return {front:{...e.front,frame:e.front.frame.data==null?null:this.uint8ArrayImageToBase64(e.front.frame.data,e.front.frame.width,e.front.frame.height)},back:{...e.back,frame:e.back.frame.data==null?null:this.uint8ArrayImageToBase64(e.back.frame.data,e.back.frame.width,e.back.frame.height)}}}async triggerListenersForLocalization(e){for(let t of this.listeners)typeof t.didLocalizeId=="function"&&t.didLocalizeId(Z.fromJSON(e));}async triggerListenersForResult(e,t){if(!this.context||!this._isEnabled)return;e==="didCaptureId"?this._safariOOMStatsCollector&&this._safariOOMStatsCollector.didCaptureCount++:e==="didRejectId"&&this._safariOOMStatsCollector&&this._safariOOMStatsCollector.didRejectCount++;let r=null;if(t.capturedId){let i=this.convertRawImagesToBase64(t.capturedId.rawImageInfo);r=ee.fromJSON({...t.capturedId,imageInfo:i});}for(let i of this.listeners)if(typeof i[e]=="function"){let s=[r];e==="didRejectId"&&typeof t.rejectionReason=="string"&&s.push(t.rejectionReason);let o=i[e].apply(null,s);o instanceof Promise&&await o;}}notifyRecoveryAfterCrash(){if(!this._isEnabled)return;let e=false;for(let t of this.listeners)typeof t.didFailWithError=="function"&&(t.didFailWithError(this,v.create({type:"RecoveredAfterFailure",message:"Last image processing failed but SDK could recover. Please reset scanning process."})),e=true);!e&&this.settings.scannerType._isFull&&Logger.log(Logger.Level.Warn,`A process responsible to scan images malfunctioned and was restarted. No listener for "didFailWithError" was
5
+ Check that your resources are properly hosted`);if(!r)throw new Error(`Worker file is not a JavaScript file: ${t}`);if(!e.ok)throw new Error(`Worker file not found or inaccessible: ${e.status} ${e.statusText}`)},fr=async(a=window.location.href)=>{let e=await ar(new URL("resources/centaurus-worker.js",a).toString());hr(e)&&await gr(e);let t=new Worker(e,{type:"module"});t.onerror=i=>{console.error("Worker error:",i),r[ht]();};let r=yt(t);return r},ct=(a=21)=>crypto.getRandomValues(new Uint8Array(a)).reduce((e,t)=>(t&=63,t<36?e+=t.toString(36):t<62?e+=(t-26).toString(36).toUpperCase():t>62?e+="-":e+="_",e),""),pt="centaurus-userid";function Cr(){if(!Sr())return ct();let e=localStorage.getItem(pt);if(e)return e;let t=ct();return localStorage.setItem(pt,t),t}function Sr(){try{return localStorage.setItem("test","test"),localStorage.removeItem("test"),true}catch(a){return false}}var yr={inputImageSource:"video",scanningMode:"automatic",scanningSettings:{allowUncertainFrontSideScan:false,blurDetectionLevel:"mid",glareDetectionLevel:"mid",tiltDetectionLevel:"mid",skipImagesWithBlur:true,skipImagesWithGlare:true,skipImagesOccludedByHand:true,skipImagesWithInadequateLightingConditions:true,combineResultsFromMultipleInputImages:true,croppedImageSettings:{dotsPerInch:250,extensionFactor:0,returnDocumentImage:false,returnFaceImage:false,returnSignatureImage:false},customDocumentAnonymizationSettings:[],customDocumentRules:[],enableBarcodeScanOnly:false,enableCharacterValidation:true,inputImageMargin:.02,maxAllowedMismatchesPerField:0,recognitionModeFilter:{enableBarcodeId:true,enableFullDocumentRecognition:true,enableMrzId:true,enableMrzPassport:true,enableMrzVisa:true,enablePhotoId:true},returnInputImages:false,scanCroppedDocumentImage:false,scanPassportDataPageOnly:true,scanUnsupportedBack:false,anonymizationMode:"full-result"}};async function At(a,e){let t=await fr(a.resourcesLocation);a.userId||(a.userId=Cr()),a.resourcesLocation||(a.resourcesLocation=window.location.href),a.useLightweightBuild===void 0&&(a.useLightweightBuild=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent));let r=e?vt(e):void 0;try{return await t[atob("aW5pdEJsaW5rSWQ=")](a,yr,r),t}catch(i){throw new Error("Failed to initialize Centaurus",{cause:i})}}var qt=Symbol();globalThis.__CENTAURUS_CORE__||(globalThis.__CENTAURUS_CORE__=qt);globalThis.__CENTAURUS_CORE__!==qt&&console.warn("Detected multiple instances of Centaurus. This can lead to unexpected behavior.");var We=new Map;We.set([77,105,99,114,111,98,108,105,110,107],"Scandit");We.set([66,108,105,110,107,73,68],"ID Capture");var Ue="Centaurus",O=class a{static async load(e){let t=new a;try{await t.initCentaurus(e);}catch(r){throw new DataCaptureError({message:a.replaceCentaurusMentions(isObject(r)&&"message"in r?r.message:"(no message)",We),name:"IdCaptureLoadingError"})}return t}static unload(){var e;(e=a.wasmSDK)==null||e.terminate(),a.wasmSDK=void 0;}static replaceCentaurusMentions(e,t){return typeof e=="string"?[...t.entries()].reduce((r,[i,s])=>{let o=i.map(u=>String.fromCodePoint(u)).join("");return r.replace(new RegExp(o,"gi"),s)},e):"(no message)"}static async getWasmType(){let[e,t]=await Promise.all([BrowserHelper.hasSIMDSupport(),BrowserHelper.hasThreadsSupport()]);return e?t&&BrowserHelper.isDesktopDevice()?"advanced-threads":"advanced":"basic"}async initCentaurus(e){a.licenseKey=e.licenseKey;let t=new URL("7.6.2/",e.libraryLocation).toString(),r={licenseKey:e.licenseKey,initialMemory:500,resourcesLocation:t,useLightweightBuild:true,wasmVariant:await a.getWasmType()};a.wasmSDK=await At(r,({progress:i})=>{var s;(s=e.loadProgressNotifier)==null||s.call(e,{percentage:i,privateUri:new URL(`${Ue}.wasm`,e.libraryLocation).toString()});});}};var Ve=43,Dr=100-Ve;function Ar(a){if(typeof a!="function")return;let e=Object.keys(d);return function(r){if(r.percentage===null){a(r);return}let{pathname:i}=new URL(r.privateUri,document.baseURI),s={...r};e.some(o=>i.endsWith(o))?s.percentage=Ve*r.percentage/100:i.endsWith(`${Ue}.wasm`)&&(s.percentage=Ve+Dr*r.percentage/100),a(s);}}var wt=Ar;var qr=(t=>(t.FrontOnly="frontOnly",t.FrontAndBack="frontAndBack",t))(qr||{}),wr=(r=>(r.Face="face",r.CroppedDocument="croppedDocument",r.Frame="frame",r))(wr||{}),Or=(t=>(t.Front="front",t.Back="back",t))(Or||{}),Nr=(i=>(i.None="none",i.FieldsOnly="fieldsOnly",i.ImagesOnly="imagesOnly",i.FieldsAndImages="fieldsAndImages",i))(Nr||{}),xr=(t=>(t.Auto="auto",t.ButtonTap="buttonTap",t))(xr||{}),Tr=(t=>(t.Rounded="rounded",t.Square="square",t))(Tr||{}),kr=(t=>(t.Light="light",t.Bold="bold",t))(kr||{}),Rr=(r=>(r.NotAvailable="notAvailable",r.NotRealIdCompliant="notRealIdCompliant",r.RealIdCompliant="realIdCompliant",r))(Rr||{}),Pr=(r=>(r.Female="female",r.Male="male",r.Unspecified="unspecified",r))(Pr||{});var Lr=a=>({IdCapture:{RecommendedCameraSettings:CameraSettings.fromJSON(a.IdCapture.RecommendedCameraSettings),IdCaptureOverlayDefaults:{defaultCapturedBrush:{fillColor:Color.fromJSON(a.IdCapture.IdCaptureOverlayDefaults.defaultCapturedBrush.fillColor),strokeColor:Color.fromJSON(a.IdCapture.IdCaptureOverlayDefaults.defaultCapturedBrush.strokeColor),strokeWidth:a.IdCapture.IdCaptureOverlayDefaults.defaultCapturedBrush.strokeWidth},defaultLocalizedBrush:{fillColor:Color.fromJSON(a.IdCapture.IdCaptureOverlayDefaults.defaultLocalizedBrush.fillColor),strokeColor:Color.fromJSON(a.IdCapture.IdCaptureOverlayDefaults.defaultLocalizedBrush.strokeColor),strokeWidth:a.IdCapture.IdCaptureOverlayDefaults.defaultLocalizedBrush.strokeWidth},defaultRejectedBrush:{fillColor:Color.fromJSON(a.IdCapture.IdCaptureOverlayDefaults.defaultRejectedBrush.fillColor),strokeColor:Color.fromJSON(a.IdCapture.IdCaptureOverlayDefaults.defaultRejectedBrush.strokeColor),strokeWidth:a.IdCapture.IdCaptureOverlayDefaults.defaultRejectedBrush.strokeWidth}}}}),I=Lr({IdCapture:{RecommendedCameraSettings:{zoomFactor:1,zoomGestureZoomFactor:2,focusGestureStrategy:"manualUntilCapture",preferredResolution:"fullHd"},IdCaptureOverlayDefaults:{defaultCapturedBrush:{fillColor:"#00000000",strokeColor:"#FFFFFFFF",strokeWidth:3},defaultLocalizedBrush:{fillColor:"#FFFFFF80",strokeColor:"#FFFFFF00",strokeWidth:0},defaultRejectedBrush:{fillColor:"#00000000",strokeColor:"#FFFFFFFF",strokeWidth:3}}}});var Ot="data:audio/mpeg;base64,SUQzBAAAAAACGFRFTkMAAAALAAADUHJvIFRvb2xzAFRYWFgAAAAjAAADb3JpZ2luYXRvcl9yZWZlcmVuY2UAYWE0RVFOcW9VQk9rAFRJVDIAAAAeAAADMDdfU2NhbmRpdF9TY2FubmVkLVdyb25nSXRlbQBUWFhYAAAASQAAA3VtaWQAMHgwNjBBMkIzNDAxMDEwMTA1MDEwMTBGMTAxMzAwMDAwMDg2RUUzOTA5RUE3QjgwMDBGNjZGQzVERDdBNzc5ODE0AFRYWFgAAAAYAAADdGltZV9yZWZlcmVuY2UAMjY3MDU5MABURFJDAAAADAAAAzIwMjMtMDMtMjQAVFNTRQAAAA8AAANMYXZmNTkuMTcuMTAxAAAAAAAAAAAAAAD/+1QAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABJbmZvAAAADwAAABQAAAhAACIiIiIuLi4uLjo6Ojo6RUVFRUVRUVFRUV1dXV1daGhoaGh0dHR0dICAgICAi4uLi4uXl5eXl6KioqKirq6urq66urq6usXFxcXF0dHR0dHd3d3d3ejo6Ojo9PT09PT//////wAAAABMYXZjNTkuMjAAAAAAAAAAAAAAAAAkAsAAAAAAAAAIQBl5jwn/+xRkAAAAVgDUjQBgAAAADSCgAAEDiBduGIGACAAANIMAAAAgP8plFgg7znL+Q4k4B5uo2Rk9c+LQuOexRB4iCTT6t24x+9f7f/ve/OAAwiE0lTn2XHl6PVZxCA5GsdT/+xRkCoPwcwJexxhAAAAADSDgAAEBiAl0oJxAEAAANIAAAAQLpHM6PLpQzOOJP9g5lhihlyb2dlebf8JCDTyRW9i0P7qaz/+QAFBoW4NDEqQuutHr41//tAlwcSVBnm3/+xRkGwPwdwHbgCsQAAAADSAAAAEBlAd5AIhAAAAANIAAAATHiGz+Vc+PkABIAc4KvoFaqtnriqAiChQ15lfsMNqJ+6pCWSiwWiCplZ48GhwdztADJY5zm8nAqeDYITz/+xRkKwPweAReQCYQAAAADSAAAAEB5BF+gYhgKAAANIAAAARCDP8WxCCX+BeBTH3/iEEQWPLf/j9xbSKUgEEVL1p+0zaZlevKU5jbmwnBfkrWVYFOA8ttpVTjnZNQTAj/+xRkOYHwcAJeQCIYAAAADSAAAAEBwAd1AJhAAAAANIAAAAQh4cpNFFitO6uKSSRkaPEOmFCjhCufYvSYAMRykUrsTqSNnkFv2JqLbTWsOJFsnYRXo/r1z8r/7+mDiwH/+xRkSYAAdwLcJSQACAAADSCgAAEEeJFKGKUACAAANIMAAABxOtc6Jp53xlXP35AAcoV0pquMq1q/64ds9sxEh5Gt1gF6lGuqIWmtoDBY0qSi+FDRUEFIX0BPlJEDhYT/+xRkTgPxAxRZhzDAAAAADSDgAAEBlAl5AJhAAAAANIAAAATqelYAwIlAy0/IoV/EKh5Gw6UEDpn9pqpMQU1FqkxBTUUzLjk5LjWqqqqqqqqqqqqqqqqqqqqqqqqqqqr/+xRkVYPweQJfIMkQCAAADSAAAAEBzAlyAJwAAAAANIAAAASqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkxBTUUzLjk5LjWqqqqqqqqqqqqqqqqqqqqqqqqqqqr/+xRkZIPwdAdgoEEYigAADSAAAAEB1AuEgQhAKAAANIAAAASqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkxBTUUzLjk5LjWqqqqqqqqqqqqqqqqqqqqqqqqqqqr/+xRkc4PwcAdewMEQoAAADSAAAAEBrAmCgQhgKAAANIAAAASqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkxBTUUzLjk5LjWqqqqqqqqqqqqqqqqqqqqqqqqqqqr/+xRkg4fwcgHcIMYICgAADSAAAAEBcA8wrGHgKAAANIAAAASqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkxBTUUzLjk5LjWqqqqqqqqqqqqqqqqqqqqqqqqqqqr/+xRklI/wTgLEAwkACgAADSAAAAEBWBTkBIxiaAAANIAAAASqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkxBTUUzLjk5LjWqqqqqqqqqqqqqqqqqqqqqqqqqqqr/+xRkqA/wAABpAAAACAAADSAAAAEAAAGkAAAAIAAANIAAAASqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqr/+xRkxg/wAABpAAAACAAADSAAAAEAAAGkAAAAIAAANIAAAASqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqr/+xRk4Y/wAABpAAAACAAADSAAAAEAAAGkAAAAIAAANIAAAASqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqr/+xRk4Y/wAABpAAAACAAADSAAAAEAAAGkAAAAIAAANIAAAASqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqr/+xRk4Y/wAABpAAAACAAADSAAAAEAAAGkAAAAIAAANIAAAASqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqr/+xRk4Y/wAABpAAAACAAADSAAAAEAAAGkAAAAIAAANIAAAASqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqr/+xRk4Y/wAABpAAAACAAADSAAAAEAAAGkAAAAIAAANIAAAASqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqr/+xRk4Y/wAABpAAAACAAADSAAAAEAAAGkAAAAIAAANIAAAASqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqo=";var ce=class a{constructor(){this.idCaptured=Feedback.defaultFeedback;this.idRejected=new Feedback(null,null);}static get defaultFeedback(){return new a}static get defaultSuccessSound(){return Sound.defaultSound}static get defaultFailureSound(){return new Sound(Ot)}toJSONObject(){return {idCaptured:this.idCaptured.toJSONObject(),idRejected:this.idRejected.toJSONObject()}}};var T=(u=>(u.Passport="passport",u.IdCard="idCard",u.DriverLicense="driverLicense",u.VisaIcao="visaIcao",u.ResidencePermit="residencePermit",u.HealthInsuranceCard="healthInsuranceCard",u.RegionSpecific="regionSpecific",u))(T||{}),S=class{constructor(e){this._region=e;}get region(){return this._region}isPassport(){return this.documentType==="passport"}isIdCard(){return this.documentType==="idCard"}isDriverLicense(){return this.documentType==="driverLicense"}isVisaIcao(){return this.documentType==="visaIcao"}isHealthInsuranceCard(){return this.documentType==="healthInsuranceCard"}isResidencePermit(){return this.documentType==="residencePermit"}isRegionSpecific(){return this.documentType==="regionSpecific"}};var pe=class a{constructor(){this.json={};}get errorCorrection(){return this.json.errorCorrection}get moduleCountX(){return this.json.moduleCountX}get moduleCountY(){return this.json.moduleCountY}static fromJSON(e){if(e==null)return null;let t=new a;return t.json=e,t}toJSONObject(){return {errorCorrection:this.errorCorrection,moduleCountX:this.moduleCountX,moduleCountY:this.moduleCountY}}};var p=class a{constructor(){this.json={};}get day(){return this.json.day}get month(){return this.json.month}get year(){return this.json.year}static fromJSON(e){if(e==null)return null;let t=new a;return t.json=e,t}toJSONObject(){return {day:this.day,month:this.month,year:this.year}}};var me=class a{get dateOfExpiry(){var e;return (e=p.fromJSON(this.json.dateOfExpiry))!=null?e:new p}get codes(){return this.json.codes}static fromJSON(e){if(e===null)return null;let t=new a;return t.json=e,t}toJSONObject(){return {codes:[...this.codes],dateOfExpiry:this.dateOfExpiry.toJSONObject()}}};var he=class a{get vehicleCode(){return this.json.vehicleCode}get vehicleRestriction(){return this.json.vehicleRestriction}get dateOfIssue(){var e;return (e=p.fromJSON(this.json.dateOfIssue))!=null?e:new p}static fromJSON(e){if(e===null)return null;let t=new a;return t.json=e,t}toJSONObject(){return {dateOfIssue:this.dateOfIssue.toJSONObject(),vehicleCode:this.vehicleCode,vehicleRestriction:this.vehicleRestriction}}};var ge=class a{get aamvaVersion(){return this.json.aamvaVersion}get aliasFamilyName(){return this.json.aliasFamilyName}get aliasGivenName(){return this.json.aliasGivenName}get aliasSuffixName(){return this.json.aliasSuffixName}get bloodType(){return this.json.bloodType}get branchOfService(){return this.json.branchOfService}get cardInstanceIdentifier(){return this.json.cardInstanceIdentifier}get cardRevisionDate(){return p.fromJSON(this.json.cardRevisionDate)}get categories(){return this.json.categories!=null?this.json.categories:[]}get champusEffectiveDate(){return p.fromJSON(this.json.champusEffectiveDate)}get champusExpiryDate(){return p.fromJSON(this.json.champusExpiryDate)}get citizenshipStatus(){return this.json.citizenshipStatus}get civilianHealthCareFlagCode(){return this.json.civilianHealthCareFlagCode}get civilianHealthCareFlagDescription(){return this.json.civilianHealthCareFlagDescription}get commissaryFlagCode(){return this.json.commissaryFlagCode}get commissaryFlagDescription(){return this.json.commissaryFlagDescription}get countryOfBirth(){return this.json.countryOfBirth}get countryOfBirthIso(){return this.json.countryOfBirthIso}get deersDependentSuffixCode(){return this.json.deersDependentSuffixCode}get deersDependentSuffixDescription(){return this.json.deersDependentSuffixDescription}get directCareFlagCode(){return this.json.directCareFlagCode}get directCareFlagDescription(){return this.json.directCareFlagDescription}get documentCopy(){return this.json.documentCopy}get documentDiscriminatorNumber(){return this.json.documentDiscriminatorNumber}get driverNamePrefix(){return this.json.driverNamePrefix}get driverNameSuffix(){return this.json.driverNameSuffix}get driverRestrictionCodes(){return this.json.driverRestrictionCodes!=null?this.json.driverRestrictionCodes:[]}get ediPersonIdentifier(){return this.json.ediPersonIdentifier}get endorsementsCode(){return this.json.endorsementsCode}get exchangeFlagCode(){return this.json.exchangeFlagCode}get exchangeFlagDescription(){return this.json.exchangeFlagDescription}get eyeColor(){return this.json.eyeColor}get familySequenceNumber(){return this.json.familySequenceNumber}get firstNameTruncation(){return this.json.firstNameTruncation}get firstNameWithoutMiddleName(){return this.json.firstNameWithoutMiddleName}get formNumber(){return this.json.formNumber}get genevaConventionCategory(){return this.json.genevaConventionCategory}get hairColor(){return this.json.hairColor}get heightCm(){return this.json.heightCm}get heightInch(){return this.json.heightInch}get IIN(){return this.json.iin}get identificationType(){return this.json.identificationType}get issuingJurisdiction(){return this.json.issuingJurisdiction}get issuingJurisdictionIso(){return this.json.issuingJurisdictionIso}get barcodeMetadata(){return pe.fromJSON(this.json.barcodeMetadata)}get jpegData(){return this.json.jpegData}get jurisdictionVersion(){return this.json.jurisdictionVersion}get lastNameTruncation(){return this.json.lastNameTruncation}get licenseCountryOfIssue(){return this.json.licenseCountryOfIssue}get middleName(){return this.json.middleName}get middleNameTruncation(){return this.json.middleNameTruncation}get mwrFlagCode(){return this.json.mwrFlagCode}get mwrFlagDescription(){return this.json.mwrFlagDescription}get payGrade(){return this.json.payGrade}get payPlanCode(){return this.json.payPlanCode}get payPlanGradeCode(){return this.json.payPlanGradeCode}get personDesignatorDocument(){return this.json.personDesignatorDocument}get personDesignatorTypeCode(){return this.json.personDesignatorTypeCode}get personMiddleInitial(){return this.json.personMiddleInitial}get personalIdNumber(){return this.json.personalIdNumber}get personalIdNumberType(){return this.json.personalIdNumberType}get personnelCategoryCode(){return this.json.personnelCategoryCode}get personnelEntitlementConditionType(){return this.json.personnelEntitlementConditionType}get placeOfBirth(){return this.json.placeOfBirth}get professionalDrivingPermit(){return this.json.professionalDrivingPermit!=null?me.fromJSON(this.json.professionalDrivingPermit):null}get race(){return this.json.race}get rank(){return this.json.rank}get rawData(){return this.json.rawData}get relationshipCode(){return this.json.relationshipCode}get relationshipDescription(){return this.json.relationshipDescription}get restrictionsCode(){return this.json.restrictionsCode}get securityCode(){return this.json.securityCode}get serviceCode(){return this.json.serviceCode}get sponsorFlag(){return this.json.sponsorFlag}get sponsorName(){return this.json.sponsorName}get sponsorPersonDesignatorIdentifier(){return this.json.sponsorPersonDesignatorIdentifier}get statusCode(){return this.json.statusCode}get statusCodeDescription(){return this.json.statusCodeDescription}get vehicleClass(){return this.json.vehicleClass}get vehicleRestrictions(){return this.json.vehicleRestrictions!=null?this.json.vehicleRestrictions.map(e=>he.fromJSON(e)).filter(e=>e!=null):[]}get version(){return this.json.version}get weightKg(){return this.json.weightKg}get weightLbs(){return this.json.weightLbs}get isRealId(){return this.json.isRealId}get firstName(){return this.json.firstName}get lastName(){return this.json.lastName}get fullName(){return this.json.fullName}get sex(){return this.json.sex}get dateOfBirth(){return p.fromJSON(this.json.dateOfBirth)}get nationality(){return this.json.nationality}get address(){return this.json.address}get documentNumber(){return this.json.documentNumber}get dateOfExpiry(){return p.fromJSON(this.json.dateOfExpiry)}get dateOfIssue(){return p.fromJSON(this.json.dateOfIssue)}get barcodeDataElements(){return this.json.dictionary}static fromJSON(e){let t=new a;return t.json=e,t}toJSONObject(){var e,t,r,i,s,o;return {firstName:this.firstName,lastName:this.lastName,secondaryLastName:this.json.secondaryLastName,fullName:this.fullName,sex:this.sex,nationality:this.nationality,address:this.address,issuingCountry:this.json.issuingCountry,issuingCountryIso:this.json.issuingCountryIso,barcodeMetadata:this.barcodeMetadata?this.barcodeMetadata.toJSONObject():null,documentNumber:this.documentNumber,documentType:this.json.documentType,documentSubtype:this.json.documentSubtype,documentAdditionalNumber:this.json.documentAdditionalNumber,dateOfBirth:(t=(e=this.dateOfBirth)==null?void 0:e.toJSONObject())!=null?t:null,dateOfExpiry:(i=(r=this.dateOfExpiry)==null?void 0:r.toJSONObject())!=null?i:null,dateOfIssue:(o=(s=this.dateOfIssue)==null?void 0:s.toJSONObject())!=null?o:null,aamvaVersion:this.aamvaVersion,aliasFamilyName:this.aliasFamilyName,aliasGivenName:this.aliasGivenName,aliasSuffixName:this.aliasSuffixName,bloodType:this.bloodType,branchOfService:this.branchOfService,cardInstanceIdentifier:this.cardInstanceIdentifier,cardRevisionDate:this.cardRevisionDate?this.cardRevisionDate.toJSONObject():null,categories:[...this.categories],champusEffectiveDate:this.champusEffectiveDate?this.champusEffectiveDate.toJSONObject():null,champusExpiryDate:this.champusExpiryDate?this.champusExpiryDate.toJSONObject():null,citizenshipStatus:this.citizenshipStatus,civilianHealthCareFlagCode:this.civilianHealthCareFlagCode,civilianHealthCareFlagDescription:this.civilianHealthCareFlagDescription,commissaryFlagCode:this.commissaryFlagCode,commissaryFlagDescription:this.commissaryFlagDescription,countryOfBirth:this.countryOfBirth,countryOfBirthIso:this.countryOfBirthIso,deersDependentSuffixCode:this.deersDependentSuffixCode,deersDependentSuffixDescription:this.deersDependentSuffixDescription,directCareFlagCode:this.directCareFlagCode,directCareFlagDescription:this.directCareFlagDescription,documentCopy:this.documentCopy,documentDiscriminatorNumber:this.documentDiscriminatorNumber,driverNamePrefix:this.driverNamePrefix,driverNameSuffix:this.driverNameSuffix,driverRestrictionCodes:[...this.driverRestrictionCodes],ediPersonIdentifier:this.ediPersonIdentifier,endorsementsCode:this.endorsementsCode,exchangeFlagCode:this.exchangeFlagCode,exchangeFlagDescription:this.exchangeFlagDescription,eyeColor:this.eyeColor,familySequenceNumber:this.familySequenceNumber,firstNameTruncation:this.firstNameTruncation,firstNameWithoutMiddleName:this.firstNameWithoutMiddleName,formNumber:this.formNumber,genevaConventionCategory:this.genevaConventionCategory,hairColor:this.hairColor,heightCm:this.heightCm,heightInch:this.heightInch,iin:this.IIN,identificationType:this.identificationType,issuingJurisdiction:this.issuingJurisdiction,issuingJurisdictionIso:this.issuingJurisdictionIso,jpegData:this.jpegData,jurisdictionVersion:this.jurisdictionVersion,lastNameTruncation:this.lastNameTruncation,licenseCountryOfIssue:this.licenseCountryOfIssue,middleName:this.middleName,middleNameTruncation:this.middleNameTruncation,mwrFlagCode:this.mwrFlagCode,mwrFlagDescription:this.mwrFlagDescription,payGrade:this.payGrade,payPlanCode:this.payPlanCode,payPlanGradeCode:this.payPlanGradeCode,personDesignatorDocument:this.personDesignatorDocument,personDesignatorTypeCode:this.personDesignatorTypeCode,personMiddleInitial:this.personMiddleInitial,personalIdNumber:this.personalIdNumber,personalIdNumberType:this.personalIdNumberType,personnelCategoryCode:this.personnelCategoryCode,personnelEntitlementConditionType:this.personnelEntitlementConditionType,placeOfBirth:this.placeOfBirth,professionalDrivingPermit:this.professionalDrivingPermit?this.professionalDrivingPermit.toJSONObject():null,race:this.race,rank:this.rank,rawData:this.rawData,relationshipCode:this.relationshipCode,relationshipDescription:this.relationshipDescription,restrictionsCode:this.restrictionsCode,securityCode:this.securityCode,serviceCode:this.serviceCode,sponsorFlag:this.sponsorFlag,sponsorName:this.sponsorName,sponsorPersonDesignatorIdentifier:this.sponsorPersonDesignatorIdentifier,statusCode:this.statusCode,statusCodeDescription:this.statusCodeDescription,vehicleClass:this.vehicleClass,vehicleRestrictions:this.vehicleRestrictions.map(u=>u.toJSONObject()),version:this.version,weightKg:this.weightKg,weightLbs:this.weightLbs,isRealId:this.isRealId,dictionary:{...this.barcodeDataElements}}}};var fe=class a{constructor(){this.json=null;}get face(){var e,t;return (t=(e=this.json)==null?void 0:e.front.face)!=null?t:null}get frame(){var e,t,r,i;return (i=(r=(e=this.json)==null?void 0:e.front.frame)!=null?r:(t=this.json)==null?void 0:t.back.frame)!=null?i:null}static fromJSON(e){let t=new a;return e!=null&&(t.json=e),t}getFrame(e){var t,r,i,s;switch(e){case "front":return (r=(t=this.json)==null?void 0:t.front.frame)!=null?r:null;case "back":return (s=(i=this.json)==null?void 0:i.back.frame)!=null?s:null}return null}getCroppedDocument(e){var t,r,i,s;switch(e){case "front":return (r=(t=this.json)==null?void 0:t.front.croppedDocument)!=null?r:null;case "back":return (s=(i=this.json)==null?void 0:i.back.croppedDocument)!=null?s:null}return null}toJSONObject(){return {front:{face:this.face,croppedDocument:this.getCroppedDocument("front"),frame:this.getFrame("front")},back:{face:null,croppedDocument:this.getCroppedDocument("back"),frame:this.getFrame("back")}}}};var Ce=class a{get documentCode(){return this.json.documentCode}get namesAreTruncated(){return this.json.namesAreTruncated}get optional(){return this.json.optional}get optional1(){return this.json.optional1}get optionalDataInLine1(){return this.json.optionalDataInLine1}get optionalDataInLine2(){return this.json.optionalDataInLine2}get capturedMrz(){return this.json.capturedMrz}get personalIdNumber(){return this.json.personalIdNumber}get renewalTimes(){return this.json.renewalTimes}get fullNameSimplifiedChinese(){return this.json.fullNameSimplifiedChinese}get omittedCharacterCountInGbkName(){return this.json.omittedCharacterCountInGbkName}get omittedNameCount(){return this.json.omittedNameCount}get issuingAuthorityCode(){return this.json.issuingAuthorityCode}get passportIssuerIso(){return this.json.passportIssuerIso}get passportNumber(){return this.json.passportNumber}get passportDateOfExpiry(){return p.fromJSON(this.json.passportDateOfExpiry)}get firstName(){return this.json.firstName}get lastName(){return this.json.lastName}get fullName(){return this.json.fullName}get sex(){return this.json.sex}get dateOfBirth(){return p.fromJSON(this.json.dateOfBirth)}get nationality(){return this.json.nationality}get address(){return this.json.address}get documentNumber(){return this.json.documentNumber}get dateOfExpiry(){return p.fromJSON(this.json.dateOfExpiry)}get dateOfIssue(){return p.fromJSON(this.json.dateOfIssue)}static fromJSON(e){let t=new a;return t.json=e,t}toJSONObject(){var e,t,r,i;return {...this.json,documentCode:this.documentCode,namesAreTruncated:this.namesAreTruncated,optional:this.optional,optional1:this.optional1,optionalDataInLine1:this.optionalDataInLine1,optionalDataInLine2:this.optionalDataInLine2,capturedMrz:this.capturedMrz,personalIdNumber:this.personalIdNumber,renewalTimes:this.renewalTimes,fullNameSimplifiedChinese:this.fullNameSimplifiedChinese,omittedCharacterCountInGbkName:this.omittedCharacterCountInGbkName,omittedNameCount:this.omittedNameCount,issuingAuthorityCode:this.issuingAuthorityCode,passportIssuerIso:this.passportIssuerIso,passportNumber:this.passportNumber,passportDateOfExpiry:this.passportDateOfExpiry?this.passportDateOfExpiry.toJSONObject():null,firstName:this.firstName,lastName:this.lastName,fullName:this.fullName,sex:this.sex,dateOfBirth:this.dateOfBirth?this.dateOfBirth.toJSONObject():null,nationality:this.nationality,address:this.address,documentNumber:this.documentNumber,dateOfExpiry:(t=(e=this.dateOfExpiry)==null?void 0:e.toJSONObject())!=null?t:null,dateOfIssue:(i=(r=this.dateOfIssue)==null?void 0:r.toJSONObject())!=null?i:null}}};var Se=class a{constructor(){this.json={};}get code(){return this.json.code}get dateOfIssue(){return p.fromJSON(this.json.dateOfIssue)}get dateOfExpiry(){return p.fromJSON(this.json.dateOfExpiry)}static fromJSON(e){if(e==null)return null;let t=new a;return t.json=e,t}toJSONObject(){return {code:this.code,dateOfIssue:this.dateOfIssue?this.dateOfIssue.toJSONObject():null,dateOfExpiry:this.dateOfExpiry?this.dateOfExpiry.toJSONObject():null}}};var J=class a{constructor(){this.json={};}get drivingLicenseCategories(){return this.json.drivingLicenseCategories.map(e=>Se.fromJSON(e)).filter(e=>e!=null)}get restrictions(){return this.json.restrictions}get endorsements(){return this.json.endorsements}static fromJSON(e){if(e==null)return null;let t=new a;return t.json=e,t}toJSONObject(){return {drivingLicenseCategories:this.drivingLicenseCategories.map(e=>e.toJSONObject()),restrictions:this.restrictions,endorsements:this.endorsements}}};var ye=class a{get firstName(){return this.json.firstName}get lastName(){return this.json.lastName}get secondaryLastName(){return this.json.secondaryLastName}get fullName(){return this.json.fullName}get additionalAddressInformation(){return this.json.additionalAddressInformation}get additionalNameInformation(){return this.json.additionalNameInformation}get documentAdditionalNumber(){return this.json.documentAdditionalNumber}get employer(){return this.json.employer}get issuingAuthority(){return this.json.issuingAuthority}get issuingJurisdiction(){return this.json.issuingJurisdiction}get issuingJurisdictionIso(){return this.json.issuingJurisdictionIso}get maritalStatus(){return this.json.maritalStatus}get personalIdNumber(){return this.json.personalIdNumber}get placeOfBirth(){return this.json.placeOfBirth}get profession(){return this.json.profession}get race(){return this.json.race}get religion(){return this.json.religion}get residentialStatus(){return this.json.residentialStatus}get mothersName(){return this.json.mothersName}get fathersName(){return this.json.fathersName}get capturedSides(){return this.json.capturedSides}get isBackSideCaptureSupported(){return this.json.isBackSideCaptureSupported}get drivingLicenseDetails(){return J.fromJSON(this.json.drivingLicenseDetails)}get bloodType(){return this.json.bloodType}get sponsor(){return this.json.sponsor}get visaNumber(){return this.json.visaNumber}get passportNumber(){return this.json.passportNumber}get sex(){return this.json.sex}get dateOfBirth(){return p.fromJSON(this.json.dateOfBirth)}get nationality(){return this.json.nationality}get address(){return this.json.address}get documentNumber(){return this.json.documentNumber}get dateOfExpiry(){return p.fromJSON(this.json.dateOfExpiry)}get dateOfIssue(){return p.fromJSON(this.json.dateOfIssue)}get vehicleOwner(){return this.json.vehicleOwner}static fromJSON(e){let t=new a;return t.json=e,t}toJSONObject(){var e,t,r,i,s,o;return {...this.json,firstName:this.firstName,lastName:this.lastName,secondaryLastName:this.secondaryLastName,fullName:this.fullName,additionalAddressInformation:this.additionalAddressInformation,additionalNameInformation:this.additionalNameInformation,documentAdditionalNumber:this.documentAdditionalNumber,employer:this.employer,issuingAuthority:this.issuingAuthority,issuingJurisdiction:this.issuingJurisdiction,issuingJurisdictionIso:this.issuingJurisdictionIso,maritalStatus:this.maritalStatus,personalIdNumber:this.personalIdNumber,placeOfBirth:this.placeOfBirth,profession:this.profession,race:this.race,religion:this.religion,residentialStatus:this.residentialStatus,mothersName:this.mothersName,fathersName:this.fathersName,capturedSides:this.capturedSides,isBackSideCaptureSupported:this.isBackSideCaptureSupported,drivingLicenseDetails:this.drivingLicenseDetails?this.drivingLicenseDetails.toJSONObject():null,bloodType:this.bloodType,sponsor:this.sponsor,passportNumber:this.passportNumber,visaNumber:this.visaNumber,sex:this.sex,dateOfBirth:(t=(e=this.dateOfBirth)==null?void 0:e.toJSONObject())!=null?t:null,nationality:this.nationality,address:this.address,documentNumber:this.documentNumber,dateOfExpiry:(i=(r=this.dateOfExpiry)==null?void 0:r.toJSONObject())!=null?i:null,dateOfIssue:(o=(s=this.dateOfIssue)==null?void 0:s.toJSONObject())!=null?o:null,vehicleOwner:this.vehicleOwner}}};var z=class a{constructor(){this.json={};}get allChecksPassed(){return this.json.allChecksPassed}get failedChecks(){return this.json.failedChecks}get skippedChecks(){return this.json.skippedChecks}get passedChecks(){return this.json.passedChecks}static fromJSON(e){let t=new a;return t.json=e,t}async frontReviewImage(){let e=this.json.frontFieldLocations,t=e!=null&&Object.keys(e).length>0,r=this.json.frontImage;if(!this.allChecksPassed&&r!=null&&t)try{return await this.highlightImage(r,e)}catch(i){Logger.log(Logger.Level.Warn,"Failed to create image with mismatching fields.",i);}return ""}toJSONObject(){return {...this.json}}pushQuadForKey(e,t,r){let i=e[r];return i!=null?(t.push(Quadrilateral.fromJSON(i)),true):false}pushQuadsForKeys(e,t,r,i=[]){if(!this.pushQuadForKey(e,t,r))for(let s of i)this.pushQuadForKey(e,t,s);}getMismatchedQuads(e){let t=[];return e!=null&&(this.failedChecks.includes("documentNumberComparison")&&this.pushQuadsForKeys(e,t,"documentNumber"),this.failedChecks.includes("fullNameComparison")&&this.pushQuadsForKeys(e,t,"fullName",["firstName","lastName"]),this.failedChecks.includes("dateOfBirthComparison")&&this.pushQuadsForKeys(e,t,"dateOfBirth"),this.failedChecks.includes("dateOfExpiryComparison")&&this.pushQuadsForKeys(e,t,"dateOfExpiry"),this.failedChecks.includes("dateOfIssueComparison")&&this.pushQuadsForKeys(e,t,"dateOfIssue")),t}async highlightImage(e,t){let r=new Image;r.src=`data:image/png;base64,${e}`,await r.decode();let i=document.createElement("canvas");i.width=r.width,i.height=r.height;let s=i.getContext("2d");if(!s)throw new Error("Failed to get 2d context from canvas");s.drawImage(r,0,0);let o=this.getMismatchedQuads(t);if(o.length===0)return "";s.beginPath(),s.rect(0,0,r.width,r.height);for(let u of o)s.moveTo(u.topLeft.x,u.topLeft.y),s.lineTo(u.topLeft.x,u.bottomRight.y),s.lineTo(u.bottomRight.x,u.bottomRight.y),s.lineTo(u.bottomRight.x,u.topLeft.y),s.lineTo(u.topLeft.x,u.topLeft.y);s.fillStyle="rgba(0, 0, 0, 0.30)",s.fill(),s.lineWidth=3,s.strokeStyle="red",s.beginPath();for(let u of o)s.rect(u.topLeft.x,u.topLeft.y,u.bottomRight.x-u.topLeft.x,u.bottomRight.y-u.topLeft.y);return s.stroke(),i.toDataURL("image/jpeg",1)}};var X=class a{get dataConsistency(){let e=this.json.rejectsInconsistentData;return this.json.dataConsistencyResult!=null&&e?z.fromJSON(this.json.dataConsistencyResult):null}static fromJSON(e){let t=new a;return t.json=e,t}toJSONObject(){return {...this.json}}};var _=class extends S{constructor(t){super(t);this.documentType="driverLicense";}get region(){return this._region}toJSONObject(){return {region:this.region,documentType:this.documentType}}};var W=class extends S{constructor(t){super(t);this.documentType="healthInsuranceCard";}get region(){return this._region}toJSONObject(){return {region:this.region,documentType:this.documentType}}};var U=class extends S{constructor(t){super(t);this.documentType="idCard";}get region(){return this._region}toJSONObject(){return {region:this.region,documentType:this.documentType}}};var V=class extends S{constructor(t){super(t);this.documentType="passport";}get region(){return this._region}toJSONObject(){return {region:this.region,documentType:this.documentType}}};var jr=(n=>(n.Any="any",n.EuAndSchengen="euAndSchengen",n.Aruba="aruba",n.Afghanistan="afghanistan",n.Angola="angola",n.Anguilla="anguilla",n.AlandIslands="alandIslands",n.Albania="albania",n.Andorra="andorra",n.Uae="uae",n.Argentina="argentina",n.Armenia="armenia",n.AmericanSamoa="americanSamoa",n.Antarctica="antarctica",n.FrenchSouthernTerritories="frenchSouthernTerritories",n.AntiguaAndBarbuda="antiguaAndBarbuda",n.Australia="australia",n.Austria="austria",n.Azerbaijan="azerbaijan",n.Burundi="burundi",n.Belgium="belgium",n.Benin="benin",n.BonaireSintEustatiusAndSaba="bonaireSintEustatiusAndSaba",n.BurkinaFaso="burkinaFaso",n.Bangladesh="bangladesh",n.Bulgaria="bulgaria",n.Bahrain="bahrain",n.Bahamas="bahamas",n.BosniaHerzegovina="bosniaHerzegovina",n.SaintBarthelemy="saintBarthelemy",n.Belarus="belarus",n.Belize="belize",n.Bermuda="bermuda",n.Bolivia="bolivia",n.Brazil="brazil",n.Barbados="barbados",n.BruneiDarussalam="bruneiDarussalam",n.Bhutan="bhutan",n.BouvetIsland="bouvetIsland",n.Botswana="botswana",n.Car="car",n.Canada="canada",n.CocosIslands="cocosIslands",n.Switzerland="switzerland",n.Chile="chile",n.China="china",n.CoteIvoire="coteIvoire",n.Cameroon="cameroon",n.DemocraticRepublicOfCongo="democraticRepublicOfCongo",n.Congo="congo",n.CookIslands="cookIslands",n.Colombia="colombia",n.Comoros="comoros",n.CaboVerde="caboVerde",n.CostaRica="costaRica",n.Cuba="cuba",n.Curacao="curacao",n.ChristmasIsland="christmasIsland",n.CaymanIslands="caymanIslands",n.Cyprus="cyprus",n.Czechia="czechia",n.Germany="germany",n.Djibouti="djibouti",n.Dominica="dominica",n.Denmark="denmark",n.DominicanRepublic="dominicanRepublic",n.Algeria="algeria",n.Ecuador="ecuador",n.Egypt="egypt",n.Eritrea="eritrea",n.WesternSahara="westernSahara",n.Spain="spain",n.Estonia="estonia",n.Ethiopia="ethiopia",n.Finland="finland",n.Fiji="fiji",n.FalklandIslands="falklandIslands",n.France="france",n.FaroeIslands="faroeIslands",n.Micronesia="micronesia",n.Gabon="gabon",n.Uk="uk",n.Georgia="georgia",n.Guernsey="guernsey",n.Ghana="ghana",n.Gibraltar="gibraltar",n.Guinea="guinea",n.Guadeloupe="guadeloupe",n.Gambia="gambia",n.GuineaBissau="guineaBissau",n.EquatorialGuinea="equatorialGuinea",n.Greece="greece",n.Grenada="grenada",n.Greenland="greenland",n.Guatemala="guatemala",n.FrenchGuiana="frenchGuiana",n.Guam="guam",n.Guyana="guyana",n.HongKong="hongKong",n.HeardIslandAndMcDonaldIslands="heardIslandAndMcDonaldIslands",n.Honduras="honduras",n.Croatia="croatia",n.Haiti="haiti",n.Hungary="hungary",n.Indonesia="indonesia",n.IsleOfMan="isleOfMan",n.India="india",n.BritishIndianOceanTerritory="britishIndianOceanTerritory",n.Ireland="ireland",n.Iran="iran",n.Iraq="iraq",n.Iceland="iceland",n.Israel="israel",n.Italy="italy",n.Jamaica="jamaica",n.Jersey="jersey",n.Jordan="jordan",n.Japan="japan",n.Kazakhstan="kazakhstan",n.Kenya="kenya",n.Kyrgyzstan="kyrgyzstan",n.Cambodia="cambodia",n.Kiribati="kiribati",n.SaintKittsAndNevis="saintKittsAndNevis",n.SouthKorea="southKorea",n.Kuwait="kuwait",n.Lao="lao",n.Lebanon="lebanon",n.Liberia="liberia",n.Libya="libya",n.SaintLucia="saintLucia",n.Liechtenstein="liechtenstein",n.SriLanka="sriLanka",n.Lesotho="lesotho",n.Lithuania="lithuania",n.Luxembourg="luxembourg",n.Latvia="latvia",n.Macao="macao",n.FrenchSaintMartin="frenchSaintMartin",n.Morocco="morocco",n.Monaco="monaco",n.Moldova="moldova",n.Madagascar="madagascar",n.Maldives="maldives",n.Mexico="mexico",n.MarshallIslands="marshallIslands",n.NorthMacedonia="northMacedonia",n.Mali="mali",n.Malta="malta",n.Myanmar="myanmar",n.Montenegro="montenegro",n.Mongolia="mongolia",n.NorthernMarianaIslands="northernMarianaIslands",n.Mozambique="mozambique",n.Mauritania="mauritania",n.Montserrat="montserrat",n.Martinique="martinique",n.Mauritius="mauritius",n.Malawi="malawi",n.Malaysia="malaysia",n.Mayotte="mayotte",n.Namibia="namibia",n.NewCaledonia="newCaledonia",n.Niger="niger",n.NorfolkIsland="norfolkIsland",n.Nigeria="nigeria",n.Nicaragua="nicaragua",n.Niue="niue",n.Netherlands="netherlands",n.Norway="norway",n.Nepal="nepal",n.Nauru="nauru",n.NewZealand="newZealand",n.Oman="oman",n.Pakistan="pakistan",n.Panama="panama",n.Pitcairn="pitcairn",n.Peru="peru",n.Philippines="philippines",n.Palau="palau",n.PapuaNewGuinea="papuaNewGuinea",n.Poland="poland",n.PuertoRico="puertoRico",n.NorthKorea="northKorea",n.Portugal="portugal",n.Paraguay="paraguay",n.Palestine="palestine",n.FrenchPolynesia="frenchPolynesia",n.Qatar="qatar",n.Reunion="reunion",n.Romania="romania",n.Russia="russia",n.Rwanda="rwanda",n.SaudiArabia="saudiArabia",n.Sudan="sudan",n.Senegal="senegal",n.Singapore="singapore",n.SouthGeorgiaAndTheSouthSandwichIslands="southGeorgiaAndTheSouthSandwichIslands",n.SaintHelena="saintHelena",n.SvalbardAndJanMayen="svalbardAndJanMayen",n.SolomonIslands="solomonIslands",n.SierraLeone="sierraLeone",n.ElSalvador="elSalvador",n.SanMarino="sanMarino",n.Somalia="somalia",n.SaintPierreAndMiquelon="saintPierreAndMiquelon",n.Serbia="serbia",n.SouthSudan="southSudan",n.SaoTomeAndPrincipe="saoTomeAndPrincipe",n.Suriname="suriname",n.Slovakia="slovakia",n.Slovenia="slovenia",n.Sweden="sweden",n.Eswatini="eswatini",n.DutchSintMaarten="dutchSintMaarten",n.Seychelles="seychelles",n.Syria="syria",n.TurksAndCaicosIslands="turksAndCaicosIslands",n.Chad="chad",n.Togo="togo",n.Thailand="thailand",n.Tajikistan="tajikistan",n.Tokelau="tokelau",n.Turkmenistan="turkmenistan",n.TimorLeste="timorLeste",n.Tonga="tonga",n.TrinidadAndTobago="trinidadAndTobago",n.Tunisia="tunisia",n.Turkey="turkey",n.Tuvalu="tuvalu",n.Taiwan="taiwan",n.Tanzania="tanzania",n.Uganda="uganda",n.Ukraine="ukraine",n.UsMinorOutlyingIslands="usMinorOutlyingIslands",n.Uruguay="uruguay",n.Us="us",n.Uzbekistan="uzbekistan",n.HolySee="holySee",n.SaintVincentAndTheGrenadines="saintVincentAndTheGrenadines",n.Venezuela="venezuela",n.BritishVirginIslands="britishVirginIslands",n.UsVirginIslands="usVirginIslands",n.Vietnam="vietnam",n.Vanuatu="vanuatu",n.WallisAndFutuna="wallisAndFutuna",n.Samoa="samoa",n.Kosovo="kosovo",n.Yemen="yemen",n.SouthAfrica="southAfrica",n.Zambia="zambia",n.Zimbabwe="zimbabwe",n))(jr||{});var H=class extends S{constructor(t){super("any");this.documentType="regionSpecific";this.subtype=t;}get region(){return this._region}toJSONObject(){return {region:this.region,documentType:this.documentType,documentSubtype:this.subtype}}};var K=class extends S{constructor(t){super(t);this.documentType="residencePermit";}get region(){return this._region}toJSONObject(){return {region:this.region,documentType:this.documentType}}};var G=class extends S{constructor(t){super(t);this.documentType="visaIcao";}get region(){return this._region}toJSONObject(){return {region:this.region,documentType:this.documentType}}};var ee=class a{get firstName(){return this.json.firstName}get lastName(){return this.json.lastName}get secondaryLastName(){return this.json.secondaryLastName}get fullName(){return this.json.fullName}get sexType(){return this.json.sex}get sex(){return this.json.sex}get dateOfBirth(){return p.fromJSON(this.json.dateOfBirth)}get age(){return this.json.age}get nationality(){return this.json.nationality}get address(){return this.json.address}get document(){if(this.json.documentType!=null){let e=this.json.documentType,t=this.json.documentSubtype,r=this.issuingCountry;switch(e){case "passport":return new V(r);case "idCard":return new U(r);case "driverLicense":return new _(r);case "visaIcao":return new G(r);case "residencePermit":return new K(r);case "healthInsuranceCard":return new W(r);case "regionSpecific":return new H(t);}}return null}get issuingCountryIso(){return this.json.issuingCountryIso}get issuingCountry(){return this.json.issuingCountry}get documentNumber(){return this.json.documentNumber}get documentAdditionalNumber(){return this.json.documentAdditionalNumber}get dateOfExpiry(){return p.fromJSON(this.json.dateOfExpiry)}get isExpired(){return this.json.isExpired}get dateOfIssue(){return p.fromJSON(this.json.dateOfIssue)}get usRealIdStatus(){var e,t;if(((e=this.json.vizResult)==null?void 0:e.usRealIdStatus)!=null&&this.json.vizResult.usRealIdStatus!=="notAvailable")return this.json.vizResult.usRealIdStatus;switch((t=this.barcode)==null?void 0:t.isRealId){case true:return "realIdCompliant";case false:return "notRealIdCompliant";default:return "notAvailable"}}get isCapturingComplete(){return this.json.isCapturingComplete}get barcode(){var e;return this._barcodeResult==null&&this.json.barcodeResult!=null&&(this._barcodeResult=ge.fromJSON(this.json.barcodeResult)),(e=this._barcodeResult)!=null?e:null}get mrzResult(){var e;return this._mrzResult==null&&this.json.mrzResult!=null&&(this._mrzResult=Ce.fromJSON(this.json.mrzResult)),(e=this._mrzResult)!=null?e:null}get vizResult(){var e;return this._vizResult==null&&this.json.vizResult!=null&&(this._vizResult=ye.fromJSON(this.json.vizResult)),(e=this._vizResult)!=null?e:null}get verificationResult(){var e;return this._verificationResult==null&&this.json.verificationResult!=null&&(this._verificationResult=X.fromJSON(this.json.verificationResult)),(e=this._verificationResult)!=null?e:new X}get images(){return fe.fromJSON(this.json.imageInfo)}get barcodeResultsJSON(){var e,t;return {barcodeResult:(t=(e=this.barcode)==null?void 0:e.toJSONObject())!=null?t:null}}get mrzResultsJSON(){return {mrzResult:this.mrzResult?this.mrzResult.toJSONObject():null}}static fromJSON(e){let t=new a;return t.json=e,t}isIdCard(){var e,t;return (t=(e=this.document)==null?void 0:e.isIdCard())!=null?t:false}isDriverLicense(){var e,t;return (t=(e=this.document)==null?void 0:e.isDriverLicense())!=null?t:false}isPassport(){var e,t;return (t=(e=this.document)==null?void 0:e.isPassport())!=null?t:false}isVisaIcao(){var e,t;return (t=(e=this.document)==null?void 0:e.isVisaIcao())!=null?t:false}isRegionSpecific(e){return this.document?this.document.isRegionSpecific()&&this.document.subtype===e:false}isResidencePermit(){var e,t;return (t=(e=this.document)==null?void 0:e.isResidencePermit())!=null?t:false}isHealthInsuranceCard(){var e,t;return (t=(e=this.document)==null?void 0:e.isHealthInsuranceCard())!=null?t:false}toJSONObject(){var e;return {firstName:this.firstName,lastName:this.lastName,secondaryLastName:this.secondaryLastName,fullName:this.fullName,sex:this.sex,nationality:this.nationality,address:this.address,issuingCountry:this.issuingCountry,issuingCountryIso:this.issuingCountryIso,documentNumber:this.documentNumber,documentAdditionalNumber:this.documentAdditionalNumber,dateOfBirth:this.dateOfBirth?this.dateOfBirth.toJSONObject():null,age:this.age,dateOfExpiry:this.dateOfExpiry?this.dateOfExpiry.toJSONObject():null,isExpired:this.isExpired,dateOfIssue:this.dateOfIssue?this.dateOfIssue.toJSONObject():null,documentType:this.document?this.document.documentType:null,documentSubtype:((e=this.document)==null?void 0:e.isRegionSpecific())==null?null:this.document.subtype,imageInfo:this.images.toJSONObject(),verificationResult:this.verificationResult?this.verificationResult.toJSONObject():null,vizResult:this.vizResult?this.vizResult.toJSONObject():null,idVerificationDataComparisonAvailable:this.json.idVerificationDataComparisonAvailable,usRealIdStatus:this.usRealIdStatus,isCapturingComplete:this.isCapturingComplete,...this.barcodeResultsJSON,...this.mrzResultsJSON}}};var Z=class a{get location(){return this._location}static fromJSON(e){let t=new a;return e.location!=null&&(t._location=Quadrilateral.fromJSON(e.location)),t}toJSONObject(){return {location:this.location.toJSONObject()}}};function be(a){let e=a,t="lowerLeft "in e?e["lowerLeft "]:e.lowerLeft;return new Quadrilateral(new Point(e.upperLeft.x,e.upperLeft.y),new Point(e.upperRight.x,e.upperRight.y),new Point(e.lowerRight.x,e.lowerRight.y),new Point(t.x,t.y))}function Q(a){return a==null?null:typeof a.latin=="object"&&a.latin.value.length>0?a.latin:typeof a.arabic=="object"&&a.arabic.value.length>0?a.arabic:typeof a.cyrillic=="object"&&a.cyrillic.value.length>0?a.cyrillic:typeof a.greek=="object"&&a.greek.value.length>0?a.greek:null}function He(a){return a.location!=null&&typeof a.location.x=="number"}function Rt(a){return typeof a=="object"&&a!==null}function Ie(a){return Rt(a)?Object.prototype.hasOwnProperty.call(a,"filledByDomainKnowledge")&&Object.prototype.hasOwnProperty.call(a,"originalString"):false}function Ke(a){return Rt(a)?Object.prototype.hasOwnProperty.call(a,"latin")&&Object.prototype.hasOwnProperty.call(a,"arabic")&&Object.prototype.hasOwnProperty.call(a,"cyrillic")&&Object.prototype.hasOwnProperty.call(a,"greek"):false}function te(a){if(a!=null&&Ie(a)&&a.successfullyParsed===true){if(a.year==null)return null;let e=a;return {day:e.day,month:e.month,year:e.year}}return null}function Ge(a){let{x:e,y:t,width:r,height:i}=a;return new Quadrilateral(new Point(e,t),new Point(e+r,t),new Point(e+r,t+i),new Point(e,t+i)).toJSONObject()}var Fr={"australian-capital-territory":"Australian Capital Territory","new-south-wales":"New South Wales","northern-territory":"Northern Territory",queensland:"Queensland","south-australia":"South Australia",tasmania:"Tasmania","western-australia":"Western Australia",victoria:"Victoria",alberta:"Alberta","british-columbia":"British Columbia",manitoba:"Manitoba","new-brunswick":"New Brunswick","newfoundland-and-labrador":"Newfoundland and Labrador","northwest-territories":"Northwest Territories","nova-scotia":"Nova Scotia",nunavut:"Nunavut","prince-edward-island":"Prince Edward Island",quebec:"Quebec",saskatchewan:"Saskatchewan","andhra-pradesh":"Andhra Pradesh",gujarat:"Gujarat",haryana:"Haryana",karnataka:"Karnataka",kerala:"Kerala","madhya-pradesh":"Madhya Pradesh",maharashtra:"Maharashtra",punjab:"Punjab","tamil-nadu":"Tamil Nadu",aguascalientes:"Aguascalientes","baja-california":"Baja California","baja-california-sur":"Baja California Sur",campeche:"Campeche",chiapas:"Chiapas",chihuahua:"Chihuahua","ciudad-de-mexico":"Mexico City",coahuila:"Coahuila",colima:"Colima",durango:"Durango",guanajuato:"Guanajuato",guerrero:"Guerrero","guerrero-acapulco-de-juarez":"Acapulco de Ju\xE1rez, Guerrero","guerrero-cocula":"Cocula, Guerrero","guerrero-juchitan":"Juchit\xE1n, Guerrero","guerrero-tepecoacuilco":"Tepecoacuilco de Trujano, Guerrero","guerrero-tlacoapa":"Tlacoapa, Guerrero",hidalgo:"Hidalgo",jalisco:"Jalisco",mexico:"M\xE9xico",michoacan:"Michoac\xE1n",morelos:"Morelos",nayarit:"Nayarit","nuevo-leon":"Nuevo Le\xF3n",oaxaca:"Oaxaca",puebla:"Puebla","quintana-roo":"Quintana Roo","quintana-roo-benito-juarez":"Benito Ju\xE1rez, Quintana Roo","quintana-roo-solidaridad":"Solidaridad, Quintana Roo","quintana-roo-cozumel":"Cozumel, Quintana Roo",queretaro:"Quer\xE9taro","san-luis-potosi":"San Luis Potos\xED",sinaloa:"Sinaloa",sonora:"Sonora",tabasco:"Tabasco",tamaulipas:"Tamaulipas",tlaxcala:"Tlaxcala",veracruz:"Veracruz",yucatan:"Yucatan",zacatecas:"Zacatecas","khyber-pakhtunkhwa":"Khyber Pakhtunkhwa",alabama:"Alabama",alaska:"Alaska",arizona:"Arizona",arkansas:"Arkansas",california:"California",colorado:"Colorado",connecticut:"Connecticut",delaware:"Delaware","district-of-columbia":"District of Columbia",florida:"Florida",georgia:"Georgia",hawaii:"Hawaii",idaho:"Idaho",illinois:"Illinois",indiana:"Indiana",iowa:"Iowa",kansas:"Kansas",kentucky:"Kentucky",louisiana:"Louisiana",maine:"Maine",maryland:"Maryland",massachusetts:"Massachusetts",michigan:"Michigan",minnesota:"Minnesota",mississippi:"Mississippi",missouri:"Missouri",montana:"Montana",nebraska:"Nebraska",nevada:"Nevada","new-hampshire":"New Hampshire","new-jersey":"New Jersey","new-mexico":"New Mexico","new-york":"New York","new-york-city":"New York City","north-carolina":"North Carolina","north-dakota":"North Dakota",ohio:"Ohio",oklahoma:"Oklahoma",ontario:"Ontario",oregon:"Oregon",pennsylvania:"Pennsylvania","rhode-island":"Rhode Island","south-carolina":"South Carolina","south-dakota":"South Dakota",tennessee:"Tennessee",texas:"Texas",utah:"Utah",vermont:"Vermont",virginia:"Virginia",washington:"Washington","west-virginia":"West Virginia",wisconsin:"Wisconsin",wyoming:"Wyoming",yukon:"Yukon",ceara:"Cear\xE1","distrito-federal":"Federal District",goias:"Goi\xE1s",maranhao:"Maranh\xE3o","mato-grosso":"Mato Grosso","minas-gerais":"Minas Gerais",para:"Par\xE1",parana:"Paran\xE1",pernambuco:"Pernambuco","rio-de-janeiro":"Rio de Janeiro","rio-grande-do-sul":"Rio Grand do Sul","santa-catarina":"Santa Catarina","sao-paolo":"Sao Paolo",sergipe:"Sergipe",alagoas:"Alagoas",bangsamoro:"Bangsamoro"};function Mt(a){var e;return a==null?null:(e=Fr[a])!=null?e:null}var ve=class a{constructor(e){this.workerCall=e;}static create(e){return new a(e)}async createDrivingLicenseDetailsFromCentaurusData(e,t,r){let i=await this.workerCall("idCaptureDrivingLicenseDetailsCreateWithCentaurusData",{details:{vehicleClass:e,restrictions:t,endorsements:r}});return J.fromJSON(i.result)}};var Lt={ABW:"aruba",AFG:"afghanistan",AGO:"angola",AIA:"anguilla",ALA:"alandIslands",ALB:"albania",AND:"andorra",ARE:"uae",ARG:"argentina",ARM:"armenia",ASM:"americanSamoa",ATA:"antarctica",ATF:"frenchSouthernTerritories",ATG:"antiguaAndBarbuda",AUS:"australia",AUT:"austria",AZE:"azerbaijan",BDI:"burundi",BEL:"belgium",BEN:"benin",BES:"bonaireSintEustatiusAndSaba",BFA:"burkinaFaso",BGD:"bangladesh",BGR:"bulgaria",BHR:"bahrain",BHS:"bahamas",BIH:"bosniaHerzegovina",BLM:"saintBarthelemy",BLR:"belarus",BLZ:"belize",BMU:"bermuda",BOL:"bolivia",BRA:"brazil",BRB:"barbados",BRN:"bruneiDarussalam",BTN:"bhutan",BVT:"bouvetIsland",BWA:"botswana",CAF:"car",CAN:"canada",CCK:"cocosIslands",CHE:"switzerland",CHL:"chile",CHN:"china",CIV:"coteIvoire",CMR:"cameroon",COD:"democraticRepublicOfCongo",COG:"congo",COK:"cookIslands",COL:"colombia",COM:"comoros",CPV:"caboVerde",CRI:"costaRica",CUB:"cuba",CUW:"curacao",CXR:"christmasIsland",CYM:"caymanIslands",CYP:"cyprus",CZE:"czechia",DEU:"germany",DJI:"djibouti",DMA:"dominica",DNK:"denmark",DOM:"dominicanRepublic",DZA:"algeria",ECU:"ecuador",EGY:"egypt",ERI:"eritrea",ESH:"westernSahara",ESP:"spain",EST:"estonia",ETH:"ethiopia",FIN:"finland",FJI:"fiji",FLK:"falklandIslands",FRA:"france",FRO:"faroeIslands",FSM:"micronesia",GAB:"gabon",GBR:"uk",GEO:"georgia",GGY:"guernsey",GHA:"ghana",GIB:"gibraltar",GIN:"guinea",GLP:"guadeloupe",GMB:"gambia",GNB:"guineaBissau",GNQ:"equatorialGuinea",GRC:"greece",GRD:"grenada",GRL:"greenland",GTM:"guatemala",GUF:"frenchGuiana",GUM:"guam",GUY:"guyana",HKG:"hongKong",HMD:"heardIslandAndMcDonaldIslands",HND:"honduras",HRV:"croatia",HTI:"haiti",HUN:"hungary",IDN:"indonesia",IMN:"isleOfMan",IND:"india",IOT:"britishIndianOceanTerritory",IRL:"ireland",IRN:"iran",IRQ:"iraq",ISL:"iceland",ISR:"israel",ITA:"italy",JAM:"jamaica",JEY:"jersey",JOR:"jordan",JPN:"japan",KAZ:"kazakhstan",KEN:"kenya",KGZ:"kyrgyzstan",KHM:"cambodia",KIR:"kiribati",KNA:"saintKittsAndNevis",KOR:"southKorea",KWT:"kuwait",LAO:"lao",LBN:"lebanon",LBR:"liberia",LBY:"libya",LCA:"saintLucia",LIE:"liechtenstein",LKA:"sriLanka",LSO:"lesotho",LTU:"lithuania",LUX:"luxembourg",LVA:"latvia",MAC:"macao",MAF:"frenchSaintMartin",MAR:"morocco",MCO:"monaco",MDA:"moldova",MDG:"madagascar",MDV:"maldives",MEX:"mexico",MHL:"marshallIslands",MKD:"northMacedonia",MLI:"mali",MLT:"malta",MMR:"myanmar",MNE:"montenegro",MNG:"mongolia",MNP:"northernMarianaIslands",MOZ:"mozambique",MRT:"mauritania",MSR:"montserrat",MTQ:"martinique",MUS:"mauritius",MWI:"malawi",MYS:"malaysia",MYT:"mayotte",NAM:"namibia",NCL:"newCaledonia",NER:"niger",NFK:"norfolkIsland",NGA:"nigeria",NIC:"nicaragua",NIU:"niue",NLD:"netherlands",NOR:"norway",NPL:"nepal",NRU:"nauru",NZL:"newZealand",OMN:"oman",PAK:"pakistan",PAN:"panama",PCN:"pitcairn",PER:"peru",PHL:"philippines",PLW:"palau",PNG:"papuaNewGuinea",POL:"poland",PRI:"puertoRico",PRK:"northKorea",PRT:"portugal",PRY:"paraguay",PSE:"palestine",PYF:"frenchPolynesia",QAT:"qatar",REU:"reunion",ROU:"romania",RUS:"russia",RWA:"rwanda",SAU:"saudiArabia",SDN:"sudan",SEN:"senegal",SGP:"singapore",SGS:"southGeorgiaAndTheSouthSandwichIslands",SHN:"saintHelena",SJM:"svalbardAndJanMayen",SLB:"solomonIslands",SLE:"sierraLeone",SLV:"elSalvador",SMR:"sanMarino",SOM:"somalia",SPM:"saintPierreAndMiquelon",SRB:"serbia",SSD:"southSudan",STP:"saoTomeAndPrincipe",SUR:"suriname",SVK:"slovakia",SVN:"slovenia",SWE:"sweden",SWZ:"eswatini",SXM:"dutchSintMaarten",SYC:"seychelles",SYR:"syria",TCA:"turksAndCaicosIslands",TCD:"chad",TGO:"togo",THA:"thailand",TJK:"tajikistan",TKL:"tokelau",TKM:"turkmenistan",TLS:"timorLeste",TON:"tonga",TTO:"trinidadAndTobago",TUN:"tunisia",TUR:"turkey",TUV:"tuvalu",TWN:"taiwan",TZA:"tanzania",UGA:"uganda",UKR:"ukraine",UMI:"usMinorOutlyingIslands",URY:"uruguay",USA:"us",UZB:"uzbekistan",VAT:"holySee",VCT:"saintVincentAndTheGrenadines",VEN:"venezuela",VGB:"britishVirginIslands",VIR:"usVirginIslands",VNM:"vietnam",VUT:"vanuatu",WLF:"wallisAndFutuna",WSM:"samoa",XKX:"kosovo",YEM:"yemen",ZAF:"southAfrica",ZMB:"zambia",ZWE:"zimbabwe"};var Jr=(l=>(l.UsBorderCrossingCard="usBorderCrossingCard",l.ChinaExitEntryPermit="chinaExitEntryPermit",l.UsGlobalEntryCard="usGlobalEntryCard",l.ChinaMainlandTravelPermitTaiwan="chinaMainlandTravelPermitTaiwan",l.UsNexusCard="usNexusCard",l.ChinaMainlandTravelPermitHongKongMacau="chinaMainlandTravelPermitHongKongMacau",l.ApecBusinessTravelCard="apecBusinessTravelCard",l.PakistanAfghanCitizenCard="pakistanAfghanCitizenCard",l.SingaporeFinCard="singaporeFinCard",l.UsGreenCard="usGreenCard",l.MalaysiaIkad="malaysiaIkad",l.MalaysiaMykad="malaysiaMykad",l.MalaysiaMypr="malaysiaMypr",l.MexicoConsularVoterId="mexicoConsularVoterId",l.GermanyEid="germanyEid",l.UsCommonAccessCard="usCommonAccessCard",l.PhilippinesMultipurposeId="philippinesMultipurposeId",l.MalaysiaMykas="malaysiaMykas",l.MalaysiaMykid="malaysiaMykid",l.MalaysiaMytentera="malaysiaMytentera",l.MexicoProfessionalId="mexicoProfessionalId",l.MalaysiaRefugeeId="malaysiaRefugeeId",l.CanadaTribalId="canadaTribalId",l.UsUniformedServicesId="usUniformedServicesId",l.UsVeteranId="usVeteranId",l.PhilippinesWorkPermit="philippinesWorkPermit",l.SingaporeWorkPermit="singaporeWorkPermit",l.UsWorkPermit="usWorkPermit",l.PhilippinesSocialSecurityCard="philippinesSocialSecurityCard",l.SwedenSocialSecurityCard="swedenSocialSecurityCard",l.CanadaSocialSecurityCard="canadaSocialSecurityCard",l.UsSocialSecurityCard="usSocialSecurityCard",l.BelgiumMinorsId="belgiumMinorsId",l.ColombiaMinorsId="colombiaMinorsId",l.PeruMinorsId="peruMinorsId",l.BoliviaMinorsId="boliviaMinorsId",l.HungaryAddressCard="hungaryAddressCard",l.UkAsylumRequest="ukAsylumRequest",l.CanadaCitizenshipCertificate="canadaCitizenshipCertificate",l.SingaporeEmploymentPass="singaporeEmploymentPass",l.CanadaMinorsPublicServicesCard="canadaMinorsPublicServicesCard",l.MalaysiaMypolis="malaysiaMypolis",l.PhilippinesNbiClearance="philippinesNbiClearance",l.IndiaPanCard="indiaPanCard",l.PhilippinesPostalId="philippinesPostalId",l.PakistanProofOfRegistration="pakistanProofOfRegistration",l.SingaporeSPass="singaporeSPass",l.SwedenSisId="swedenSisId",l.ColombiaTemporaryProtectionPermit="colombiaTemporaryProtectionPermit",l.UsTwicCard="usTwicCard",l.UsWeaponPermit="usWeaponPermit",l.CanadaWeaponPermit="canadaWeaponPermit",l.IrelandPublicServicesCard="irelandPublicServicesCard",l.CanadaPublicServicesCard="canadaPublicServicesCard",l.PakistanConsularId="pakistanConsularId",l.GuatemalaConsularId="guatemalaConsularId",l.MexicoConsularId="mexicoConsularId",l.PhilippinesTaxId="philippinesTaxId",l.MexicoTaxId="mexicoTaxId",l.ChinaOneWayPermit="chinaOneWayPermit",l.UsMedicalMarijuanaCard="usMedicalMarijuanaCard",l.UsMunicipalId="usMunicipalId",l.AustraliaAsicCard="australiaAsicCard",l.UaeVehicleRegistrationCard="uaeVehicleRegistrationCard",l.UaeEsaadCard="uaeEsaadCard",l.UkMilitaryId="ukMilitaryId",l))(Jr||{});var _r=["field-identification-failed","invalid-characters-found","mandatory-field-missing","detection-failed","image-return-failed","not-scanned"],De=class{constructor(e){this.workerCallProvider=e;}async processResult(e,t,r){return !this.hasFrontVIZResult(e)||_r.includes(t.processingStatus)?null:{mrzResult:null,barcodeResult:null,verificationResult:null,vizResult:await this.getVizResult(e,t,r),imageInfo:this.getImageData(e),isCapturingComplete:false}}isBackSideCaptureSupported(e,t){let{scanningStatus:r}=e;return r==="side-scanned"||t.subResults.length>1}async getVizResult(e,t,r){let i=t.documentClassInfo,s={...await this.extractVizData(i,e),usRealIdStatus:this.getRealIdStatus(t),capturedSides:"frontOnly",isBackSideCaptureSupported:this.isBackSideCaptureSupported(r,e),frontFieldLocations:this.getFieldLocations(e),location:t.documentLocation?be(t.documentLocation).toJSONObject():null};if(this.adjustResultForSpecialCases(e,s),r.scanningStatus==="document-scanned"&&this.hasFrontAndBackVIZResult(e)){s.capturedSides="frontAndBack";let o=["address","dateOfBirth","dateOfExpiry","dateOfIssue","documentNumber","firstName","fullName","lastName","nationality","sex","additionalAddressInformation","additionalNameInformation","documentAdditionalNumber","employer","issuingAuthority","maritalStatus","personalIdNumber","placeOfBirth","profession","race","religion","residentialStatus","mothersName","fathersName"],u=e.subResults[1].viz;for(let c of o){let m=s[c]==null||s[c]==="",h=u==null?void 0:u[c];m&&h!=null&&this.handleEmptyFrontValue(s,c,h);}}return s}handleEmptyFrontValue(e,t,r){if(Ie(r)){let i=te(r);i&&(e[t]=i);}else if(Ke(r)){let i=Q(r);i!=null&&i.value&&i.value.length>0&&(e[t]=i.value);}}async extractVizData(e,t){var N,Qe,$e,Ye,Xe,et,tt;let r=t.subResults[0].viz;function i(rt){var at,it;return rt==null?"":(it=(at=Q(rt))==null?void 0:at.value)!=null?it:""}function s(){return r.additionalNameInformation?i(r.additionalNameInformation):i(t.additionalNameInformation)}let o=i((N=t.driverLicenseDetailedInfo)==null?void 0:N.vehicleClass),u=i((Qe=t.driverLicenseDetailedInfo)==null?void 0:Qe.restrictions),c=i(($e=t.driverLicenseDetailedInfo)==null?void 0:$e.endorsements),m=this.workerCallProvider(),h=null;m&&(o.length>0||u.length>0||c.length>0)&&(h=await ve.create(m).createDrivingLicenseDetailsFromCentaurusData(o,u,c));let[g,C]=(Ye=Wr(e.type,e.country))!=null?Ye:[null,null];return {firstName:i(r.firstName),lastName:i(r.lastName),secondaryLastName:null,fullName:i(r.fullName),sex:i(r.sex),dateOfBirth:te(r.dateOfBirth),nationality:i(r.nationality),address:i(r.address),documentType:g,documentSubtype:C,issuingCountryIso:(Xe=e.isoAlpha3CountryCode)!=null?Xe:null,issuingCountry:(tt=Lt[(et=e.isoAlpha3CountryCode)!=null?et:""])!=null?tt:null,documentNumber:i(r.documentNumber),dateOfExpiry:te(r.dateOfExpiry),dateOfIssue:te(r.dateOfIssue),additionalAddressInformation:i(r.additionalAddressInformation),additionalNameInformation:s(),documentAdditionalNumber:i(r.documentAdditionalNumber),employer:i(r.employer),issuingAuthority:i(r.issuingAuthority),maritalStatus:i(r.maritalStatus),personalIdNumber:i(r.personalIdNumber),placeOfBirth:i(r.placeOfBirth),profession:i(r.profession),race:i(r.race),religion:i(r.religion),residentialStatus:i(r.residentialStatus),mothersName:i(r.mothersName),fathersName:i(r.fathersName),issuingJurisdiction:Mt(e.region),issuingJurisdictionIso:null,drivingLicenseDetails:h?h.toJSONObject():null,bloodType:i(r.bloodType),sponsor:i(r.sponsor),passportNumber:null,visaNumber:null,vehicleOwner:i(r.vehicleOwner)}}adjustResultForSpecialCases(e,t){var i,s,o;let r=e.documentClassInfo;if(r.country==="germany"&&r.type==="id"){let u=e.lastName?e.lastName:(i=e.subResults[0].viz)==null?void 0:i.lastName;t.lastName=(o=(s=Q(u))==null?void 0:s.value)!=null?o:null;}}getFieldLocations(e){var i;let t=(i=e.subResults[0].viz)!=null?i:{},r={};for(let[s,o]of Object.entries(t)){let u=s;if(typeof o=="object"&&o!=null){if(Ie(o)){let c=Q(o.originalString);c&&He(c)&&(r[u]=Ge(c.location));}else if(Ke(o)){let c=Q(o);c!=null&&He(c)&&(r[u]=Ge(c.location));}}}return r}getImageBase64String(e){if(e==null)return null;let t=document.createElement("canvas");t.width=e.width,t.height=e.height;let r=t.getContext("2d");return r?(r.putImageData(e,0,0),t.toDataURL().split(",")[1]):null}getImageData(e){var s;let[t,r]=e.subResults,i={face:this.getImageBase64String((s=t==null?void 0:t.faceImage)==null?void 0:s.image)};return this.hasFrontAndBackVIZResult(e)?{front:{...i,croppedDocument:this.getImageBase64String(t.documentImage),frame:null},back:{face:null,croppedDocument:this.getImageBase64String(r==null?void 0:r.documentImage),frame:null}}:{front:{...i,croppedDocument:this.getImageBase64String(t==null?void 0:t.documentImage),frame:null},back:{face:null,croppedDocument:null,frame:null}}}getRealIdStatus(e){switch(e.realIDDetectionStatus){case "not-available":return "notAvailable";case "not-detected":return "notRealIdCompliant";case "detected":return "realIdCompliant";default:return "notAvailable"}}hasFrontVIZResult(e){return e.subResults[0].viz!=null}hasFrontAndBackVIZResult(e){return e.subResults.length>1}};function Wr(a,e){if(a==null)return null;switch(a){case "id":case "voter-id":case "passport-card":case "proof-of-registration":case "non-voter-id":case "proof-of-age-card":return ["idCard",null];case "dl":case "dl-public-services-card":case "professional-dl":case "driver-card":case "driving-privilege-card":case "driver-qualification-card":case "provisional-dl":return ["driverLicense",null];case "passport":case "alien-passport":case "consular-passport":case "minors-passport":case "refugee-passport":return ["passport",null];case "residence-permit":case "resident-id":case "temporary-residence-permit":case "alien-id":case "special-id":return ["residencePermit",null];case "visa":case "immigrant-visa":return ["visaIcao",null];case "health-insurance-card":case "interim-health-insurance-card":case "reciprocal-health-insurance-card":return ["healthInsuranceCard",null];case "consular-id":return Vr(e);case "employment-pass":return ["regionSpecific","singaporeEmploymentPass"];case "fin-card":return ["regionSpecific","singaporeFinCard"];case "multipurpose-id":return ["regionSpecific","philippinesMultipurposeId"];case "mykad":return ["regionSpecific","malaysiaMykad"];case "mykid":return ["regionSpecific","malaysiaMykid"];case "mypr":return ["regionSpecific","malaysiaMypr"];case "mytentera":return ["regionSpecific","malaysiaMytentera"];case "pan-card":return ["regionSpecific","indiaPanCard"];case "professional-id":return ["regionSpecific","mexicoProfessionalId"];case "public-services-card":return Hr(e);case "work-permit":return Kr(e);case "ikad":return ["regionSpecific","malaysiaIkad"];case "military-id":return Ur(e);case "mykas":return ["regionSpecific","malaysiaMykas"];case "social-security-card":return Gr(e);case "s-pass":return ["regionSpecific","singaporeSPass"];case "address-card":return ["regionSpecific","hungaryAddressCard"];case "green-card":return ["regionSpecific","usGreenCard"];case "minors-id":return Zr(e);case "postal-id":return ["regionSpecific","philippinesPostalId"];case "tax-id":return Qr(e);case "weapon-permit":return $r(e);case "border-crossing-card":return ["regionSpecific","usBorderCrossingCard"];case "global-entry-card":return ["regionSpecific","usGlobalEntryCard"];case "mypolis":return ["regionSpecific","malaysiaMypolis"];case "nexus-card":return ["regionSpecific","usNexusCard"];case "refugee-id":return ["regionSpecific","malaysiaRefugeeId"];case "tribal-id":case "non-card-tribal-id":return ["regionSpecific","canadaTribalId"];case "veteran-id":return ["regionSpecific","usVeteranId"];case "citizenship-certificate":return ["regionSpecific","canadaCitizenshipCertificate"];case "minors-public-services-card":return ["regionSpecific","canadaMinorsPublicServicesCard"];case "asylum-request":return ["regionSpecific","ukAsylumRequest"];case "uniformed-services-id":return ["regionSpecific","usUniformedServicesId"];case "consular-voter-id":return ["regionSpecific","mexicoConsularVoterId"];case "twic-card":return ["regionSpecific","usTwicCard"];case "nbi-clearance":return ["regionSpecific","philippinesNbiClearance"];case "temporary-protection-permit":return ["regionSpecific","colombiaTemporaryProtectionPermit"];case "afghan-citizen-card":return ["regionSpecific","pakistanAfghanCitizenCard"];case "eid":return ["regionSpecific","germanyEid"];case "sis-id":return ["regionSpecific","swedenSisId"];case "asic-card":return ["regionSpecific","australiaAsicCard"];case "vehicle-registration":return ["regionSpecific","uaeVehicleRegistrationCard"];case "esaad-card":return ["regionSpecific","uaeEsaadCard"];case "medical-marijuana-id":return ["regionSpecific","usMedicalMarijuanaCard"];case "registration-certificate":return ["residencePermit",null];case "diplomatic-id":case "exit-entry-permit":case "mainland-travel-permit-taiwan":case "bidoon-card":case "pass":case "my-number-card":return null;default:assertUnreachable(a);}return null}function Ur(a){return a==="uk"?["regionSpecific","ukMilitaryId"]:["regionSpecific","usCommonAccessCard"]}function Vr(a){switch(a){case "pakistan":return ["regionSpecific","pakistanConsularId"];case "guatemala":return ["regionSpecific","guatemalaConsularId"];case "mexico":return ["regionSpecific","mexicoConsularId"];default:return ["regionSpecific",null]}}function Hr(a){switch(a){case "ireland":return ["regionSpecific","irelandPublicServicesCard"];case "canada":return ["regionSpecific","canadaPublicServicesCard"];default:return ["regionSpecific",null]}}function Kr(a){switch(a){case "philippines":return ["regionSpecific","philippinesWorkPermit"];case "singapore":return ["regionSpecific","singaporeWorkPermit"];case "usa":return ["regionSpecific","usWorkPermit"];default:return ["regionSpecific",null]}}function Gr(a){switch(a){case "philippines":return ["regionSpecific","philippinesSocialSecurityCard"];case "sweden":return ["regionSpecific","swedenSocialSecurityCard"];case "canada":return ["regionSpecific","canadaSocialSecurityCard"];case "usa":return ["regionSpecific","usSocialSecurityCard"];default:return ["regionSpecific",null]}}function Zr(a){switch(a){case "belgium":return ["regionSpecific","belgiumMinorsId"];case "colombia":return ["regionSpecific","colombiaMinorsId"];case "peru":return ["regionSpecific","peruMinorsId"];case "bolivia":return ["regionSpecific","boliviaMinorsId"];default:return ["regionSpecific",null]}}function Qr(a){switch(a){case "philippines":return ["regionSpecific","philippinesTaxId"];case "mexico":return ["regionSpecific","mexicoTaxId"];default:return ["regionSpecific",null]}}function $r(a){switch(a){case "usa":return ["regionSpecific","usWeaponPermit"];case "canada":return ["regionSpecific","canadaWeaponPermit"];default:return ["regionSpecific",null]}}var A=class{static isSingleSideScanner(e){return !e._isFull}static isFullDocumentScanner(e){return e._isFull}};var q=class{constructor(e,t,r){this.isDeleted=false;this.centaurusWasmSDK=e,this.idCaptureSettings=t,this.scannerDefaultSettings=r;}get type(){return this._type}async process(e){return {...await this.session.process(e),centaurusResult:await this.getResult()}}async getResult(){return this.session.getResult()}async delete(){this.isDeleted||(this.isDeleted=true,await this.session.delete());}async createSession(e){var i,s;let t={inputImageSource:((i=e==null?void 0:e.inputImageSource)!=null?i:e!=null&&e.scanCroppedDocumentImage)?"photo":"video",scanningMode:A.isSingleSideScanner(this.idCaptureSettings.scannerType)?"single":"automatic",scanningSettings:{anonymizationMode:this.getAnonymizationMode(),scanCroppedDocumentImage:(s=e==null?void 0:e.scanCroppedDocumentImage)!=null?s:false,skipImagesOccludedByHand:this.scannerDefaultSettings.skipImagesOccludedByHand,scanUnsupportedBack:this.scannerDefaultSettings.scanUnsupportedBack,recognitionModeFilter:{enableBarcodeId:this.scannerDefaultSettings.filter.enableBarcodeId,enableFullDocumentRecognition:!(e!=null&&e.detectionOnlyMode)&&this.scannerDefaultSettings.filter.enableFullDocumentRecognition,enableMrzId:this.scannerDefaultSettings.filter.enableMrzId,enableMrzPassport:this.scannerDefaultSettings.filter.enableMrzPassport,enableMrzVisa:this.scannerDefaultSettings.filter.enableMrzVisa,enablePhotoId:this.scannerDefaultSettings.filter.enablePhotoId},croppedImageSettings:{returnDocumentImage:this.idCaptureSettings.getShouldPassImageTypeToResult("croppedDocument"),returnFaceImage:this.idCaptureSettings.getShouldPassImageTypeToResult("face")}}},r=[99,114,101,97,116,101,66,108,105,110,107,73,100,83,99,97,110,110,105,110,103,83,101,115,115,105,111,110].map(o=>String.fromCodePoint(o)).join("");return this.centaurusWasmSDK[r](t)}getAnonymizationMode(){switch(this.idCaptureSettings.anonymizationMode){case "none":return null;case "fieldsOnly":return null;case "imagesOnly":return "image-only";case "fieldsAndImages":return "image-only"}}};var Ae=class a extends q{constructor(){super(...arguments);this._type="scanCroppedDocument";}static async create(t,r,i,s){let o=new a(t,r,i);return o.session=await o.createSession({scanCroppedDocumentImage:true}),o.resultProcessor=s,o}async process(t){let r=await this.doProcess(t);if(r.hasCapturedId)return r;let i=[.9,.8,.7];for(let s of i){let o=await this.scaleImage(this.imageDataFromArrayBuffer(r.arrayBuffer,t.width,t.height),s);if(o&&(r=await this.doProcess(o),r.hasCapturedId))return r}return r}async scaleImage(t,r){let i=document.createElement("canvas");i.width=t.width,i.height=t.height;let s=i.getContext("2d"),o=await createImageBitmap(t);return s?(s.fillStyle="#000000",s.fillRect(0,0,i.width,i.height),s.scale(r,r),s.drawImage(o,(i.width/r-t.width)/2,(i.height/r-t.height)/2,t.width,t.height),s.getImageData(0,0,i.width,i.height)):null}async doProcess(t){let{inputImageAnalysisResult:r,resultCompleteness:i,arrayBuffer:s}=await this.session.process(t),o=await this.getResult(),u=await this.resultProcessor.processResult(o,r,i);return {inputImageAnalysisResult:r,resultCompleteness:i,arrayBuffer:s,centaurusResult:o,hasCapturedId:u!=null}}imageDataFromArrayBuffer(t,r,i){return new ImageData(new Uint8ClampedArray(t),r,i,{colorSpace:"srgb"})}};var qe=class a extends q{constructor(){super(...arguments);this._type="default";}static async create(t,r,i){let s=new a(t,r,i);return s.session=await s.createSession(),s}};var we=class a extends q{constructor(){super(...arguments);this._type="localizeOnly";}static async create(t,r,i){let s=new a(t,r,i);return s.session=await s.createSession(),s}async createSession(){return super.createSession({detectionOnlyMode:true})}async process(t){let r=await super.process(t);return r.resultCompleteness.scanningStatus==="document-scanned"&&(await this.session.delete(),this.session=await this.createSession()),r}};var Oe=class a extends q{constructor(){super(...arguments);this._type="photoMode";}static async create(t,r,i){let s=new a(t,r,i);return s.session=await s.createSession({inputImageSource:"photo"}),s}};var Ne=class{constructor(e,t){this.isProcessing=false;this._lastError=null;this._lastResult=null;this._lastLocalization=null;this._engagedSession=null;this._isDetectionOnlyMode=false;this._hasDefaultSessionFullResult=false;this.centaurusWasmSDK=e,this._workerCallProvider=t;}get engagedSession(){var e;return (e=this._engagedSession)!=null?e:null}set engagedSession(e){this._engagedSession!==e&&(this._engagedSession=e);}async init(e,t){this.idCaptureSettings=e.clone(),this.resultProcessor=new De(this._workerCallProvider),this.scannerDefaultSettings=t,await this.createAllSessions(),this._lastResult=null,this._lastError=null,this._lastLocalization=null;}isReadyToProcessFrame(){return this.isProcessing===false}async processFrame(e,t){this.isProcessing=true,this.engagedSession=this.autoSelectSession(t);let{inputImageAnalysisResult:r,resultCompleteness:i,arrayBuffer:s,centaurusResult:o}=await this.engagedSession.process({...e,colorSpace:"srgb"}),u=null;this.engagedSession!==this.localizeOnlySession&&(u=await this.resultProcessor.processResult(o,r,i),i.scanningStatus==="document-scanned"&&(this._hasDefaultSessionFullResult=true));let c=this.getLocation(r),m=this.toLocalizedOnlyId(c),h=this.toDetectionIssue(r.documentDetectionStatus);return u&&c&&(u.vizResult.location=c.toJSONObject()),this.isProcessing=false,{arrayBuffer:s,capturedId:u,localizedOnlyId:m,detectionIssue:h}}async reset(){for(let e of [this.defaultSession,this.scanCroppedDocumentSession,this.localizeOnlySession,this.photoModeSession])await(e==null?void 0:e.delete());await this.createAllSessions(),this._lastResult=null,this._lastError=null,this._lastLocalization=null,this._hasDefaultSessionFullResult=false;}async applySettings(e){this.idCaptureSettings=e.clone(),await this.reset(),this.setDetectionOnlyMode(this.idCaptureSettings.captureTrigger==="buttonTap");}async setDetectionOnlyMode(e){this._isDetectionOnlyMode!==e&&(this._isDetectionOnlyMode=e);}async dispose(){for(let e of [this.defaultSession,this.scanCroppedDocumentSession,this.localizeOnlySession,this.photoModeSession])await(e==null?void 0:e.delete());}async createAllSessions(){this.defaultSession=await qe.create(this.centaurusWasmSDK,this.idCaptureSettings,this.scannerDefaultSettings),this.scanCroppedDocumentSession=await Ae.create(this.centaurusWasmSDK,this.idCaptureSettings,this.scannerDefaultSettings,this.resultProcessor),this.photoModeSession=await Oe.create(this.centaurusWasmSDK,this.idCaptureSettings,this.scannerDefaultSettings),this.localizeOnlySession=await we.create(this.centaurusWasmSDK,this.idCaptureSettings,this.scannerDefaultSettings);}autoSelectSession(e){return this._hasDefaultSessionFullResult||this._isDetectionOnlyMode?this.localizeOnlySession:e.scanCroppedDocumentImage?this.scanCroppedDocumentSession:e.forcePhotoImageSource?this.photoModeSession:this.defaultSession}getLocation(e){return e.documentDetectionStatus==="failed"||!e.documentLocation?null:be(e.documentLocation)}toLocalizedOnlyId(e){return e!=null?Z.fromJSON({location:e.toJSONObject()}):null}toDetectionIssue(e){let t=null;switch(e){case "camera-too-far":{t="DocumentTooFar";break}case "camera-too-close":case "document-too-close-to-camera-edge":case "document-partially-visible":{t="DocumentTooClose";break}default:t=null;}return t}displayDetectionStatusInUI(e){let t=window,r=t.centaurusDetectionStatus;r==null&&(r=document.createElement("div"),r.className="centaurusDetectionStatus",r.style.position="absolute",r.style.zIndex="1000",r.style.top="10px",r.style.left="10px",r.style.padding="0 1rem",r.style.backgroundColor="white",document.body.append(r),t.centaurusDetectionStatus=r),r.textContent=`LocalizedStatus: ${e}`;}};var Yr=(g=>(g.NotAcceptedDocumentType="notAcceptedDocumentType",g.InvalidFormat="invalidFormat",g.DocumentVoided="documentVoided",g.Timeout="timeout",g.SingleImageNotRecognized="singleImageNotRecognized",g.DocumentExpired="documentExpired",g.DocumentExpiresSoon="documentExpiresSoon",g.NotRealIdCompliant="notRealIdCompliant",g.HolderUnderage="holderUnderage",g.ForgedAamvaBarcode="forgedAamvaBarcode",g.InconsistentData="inconsistentData",g))(Yr||{});var xe="reloadDetector",ke=class ke{constructor(e,t=ke.DEFAULT_WRITE_INTERVAL_MS){this._lastWrite=0;this._storage=e,this._writeIntervalMs=t;}hasDataAlreadyWritten(){return this._storage.getItem(xe)!==null}write(e){return this._pendingData={...e},this.scheduleWrite(),e}read(){var t;if(this._pendingData)return this._pendingData;let e=(t=this._storage.getItem(xe))!=null?t:"{}";return JSON.parse(e)}clear(){this._storage.removeItem(xe),this._pendingData=void 0,this._lastWrite=0,clearTimeout(this._writeTimer);}scheduleWrite(){clearTimeout(this._writeTimer);let e=performance.now()-this._lastWrite;e>this._writeIntervalMs?(this._storage.setItem(xe,JSON.stringify(this._pendingData)),this._pendingData=void 0,this._lastWrite=performance.now()):this._writeTimer=setTimeout(this.scheduleWrite.bind(this),this._writeIntervalMs-e);}};ke.DEFAULT_WRITE_INTERVAL_MS=500;var Te=ke;var re=class{constructor(e){this.onUnload=()=>{this._storage.clear();};this._onPageAbruptlyReloaded=e,this._storage=new Te(this.getStorage());}static isSafari(){return BrowserHelper.isSafari()}install(){if(BrowserHelper.isSafari()){if(window.addEventListener("unload",this.onUnload,{once:true}),!this._storage.hasDataAlreadyWritten()){this._storage.write({});return}this._onPageAbruptlyReloaded();}}updateData(e){this._storage.write(e);}get data(){return this._storage.read()}uninstall(){window.removeEventListener("unload",this.onUnload);}getStorage(){return sessionStorage}};var Pe=class Pe{constructor(e){this._framesProcessedCount=0;this._didCaptureCount=0;this._didRejectCount=0;this._applySettingsCount=1;this._videoResolution="";this._upTimeMs=0;this._upTimeTimer=null;this._detector=e;}destroy(){this._upTimeTimer&&(clearInterval(this._upTimeTimer),this._upTimeTimer=null);}get framesProcessedCount(){return this._framesProcessedCount}get didCaptureCount(){return this._didCaptureCount}get didRejectCount(){return this._didRejectCount}get applySettingsCount(){return this._applySettingsCount}get videoResolution(){return this._videoResolution}set framesProcessedCount(e){this._framesProcessedCount=e,this._upTimeTimer==null&&(this._firstFrameProcessedTime=performance.now(),this._upTimeTimer=setInterval(this.updateUpTime.bind(this),Pe.UP_TIME_UPDATE_INTERVAL_MS)),this._detector.updateData(this.data);}set didCaptureCount(e){this._didCaptureCount=e,this._detector.updateData(this.data);}set didRejectCount(e){this._didRejectCount=e,this._detector.updateData(this.data);}set applySettingsCount(e){this._applySettingsCount=e,this._detector.updateData(this.data);}set videoResolution(e){this._videoResolution=e,this._detector.updateData(this.data);}get data(){return {framesProcessedCount:this._framesProcessedCount,didCaptureCount:this._didCaptureCount,didRejectCount:this._didRejectCount,applySettingsCount:this._applySettingsCount,upTime:Math.round(this._upTimeMs/100)/10,videoResolution:this._videoResolution}}updateUpTime(){this._firstFrameProcessedTime&&(this._upTimeMs=performance.now()-this._firstFrameProcessedTime,this._detector.updateData(this.data));}};Pe.UP_TIME_UPDATE_INTERVAL_MS=500;var Re=Pe;var f={Initializing:"Initializing",Available:"Available",ProcessingFrame:"ProcessingFrame",ProcessingQueue:"ProcessingQueue"},jt=class a{constructor(){this.type="idCapture";this._synchronousFrameFlow=true;this.state=f.Initializing;this._isEnabled=true;this._context=null;this.listeners=[];this.overlayListeners=new Set;this._endOfCycleTasks=[];this._feedback=ce.defaultFeedback;this._onProcessFrameListener=this.onProcessFrame.bind(this);this.workerMessageListener=this.onWorkerMessage.bind(this);this.shouldEnableCentaurus()&&(this._centaurusConnector=new Ne(O.wasmSDK,()=>{var e;return (e=this.privateContext)==null?void 0:e.workerCommand})),this.contextListener={didChangeFrameSource:this.didChangeFrameSource.bind(this)};}static get recommendedCameraSettings(){return new CameraSettings(I.IdCapture.RecommendedCameraSettings)}get context(){return this._context}get feedback(){return this._feedback}get privateContext(){return this.context}static async forContext(e,t){let r=new a;return r.settings=t,e&&(await e.addMode(r),r.shouldEnableCentaurus()&&await r.initCentaurusConnector()),r.checkCaptureSettingsAgainstSDKConfiguration(t),r.moveToState(f.Available),r}async setFeedback(e){return this._feedback=e,this.didChange()}addListener(e){this.listeners.includes(e)||this.listeners.push(e);}removeListener(e){this.listeners.includes(e)&&this.listeners.splice(this.listeners.indexOf(e),1);}isEnabled(){return this._isEnabled}async setEnabled(e){this._isEnabled!==e&&(this._isEnabled=e,this.enqueueTask(async()=>this.didChange([{type:"modeEnabled",newValue:e}])),this.state===f.Available&&this.moveToState(f.ProcessingQueue));}async reset(){this.enqueueTask(async()=>this.doReset()),this.state===f.Available&&this.moveToState(f.ProcessingQueue);}async applySettings(e){this.enqueueTask(async()=>this.doApplySettings(e.clone())),this.state===f.Available&&this.moveToState(f.ProcessingQueue);}async parse(e){if(this.context){let t=await this.context.workerCommand("idCaptureParse",{code:e});if((t==null?void 0:t.result)!=null){let r=t.result;if((r==null?void 0:r.status)==="error")throw v.create({type:"InvalidLicenseKeyForParser",message:r.error});if((r==null?void 0:r.status)==="success"){let i=this.convertRawImagesToBase64(r.capturedId.rawImageInfo);return ee.fromJSON({...r.capturedId,imageInfo:i})}}}return null}async setExternalTransactionId(e){var t;return (t=this.privateContext)==null?void 0:t.workerCommand("idCaptureSetExternalTransactionId",{transactionId:e})}async getExternalTransactionId(){var e,t,r;return (r=(t=await((e=this.privateContext)==null?void 0:e.workerCommand("idCaptureGetExternalTransactionId",{})))==null?void 0:t.transactionId)!=null?r:null}toJSONObject(){var e;return {enabled:this._isEnabled,type:this.type,settings:{...this.settings.toJSONObject(),licensee:"",licenseKey:(e=O.licenseKey)!=null?e:""}}}shouldEnableCentaurus(){return O.wasmSDK!=null}async initCentaurusConnector(){var t;if(!this.privateContext)throw v.create({type:"Undefined",message:"Cannot initialize Centaurus without a context"});let e=await((t=this.privateContext)==null?void 0:t.workerCommand("idCaptureGetCentaurusSettings",{}));try{await this._centaurusConnector.init(this.settings,Object.freeze(e.result));}catch(r){throw r instanceof DataCaptureError&&r.name==="MULTIPLE_RECOGNIZER_RUNNER"&&Logger.log(Logger.Level.Error,"The newly created IdCapture mode is invalid, an existing IdCapture mode is still attached to the context and must be removed first."),r}}async onSDCResetDone(){var e;return (e=this._centaurusConnector)==null?void 0:e.reset()}didChangeFrameSource(){this.moveToState(f.ProcessingQueue);}moveToState(e){this.state=e,e===f.ProcessingQueue&&this.processQueue();}async doReset(){var e;await((e=this.privateContext)==null?void 0:e.workerCommand("idCaptureReset",{}));}async doApplySettings(e){var t,r,i;this.context&&(this.settings=e,this.checkCaptureSettingsAgainstSDKConfiguration(e),await Promise.all([this.shouldEnableVIZScanner(e)?(t=this._centaurusConnector)==null?void 0:t.applySettings(e):Promise.resolve(),(r=this.privateContext)==null?void 0:r.workerCommand("idCaptureApplySettings",{settings:e.toJSONObject()}),(i=this.privateContext)==null?void 0:i.update()]),this._safariOOMStatsCollector&&this._safariOOMStatsCollector.applySettingsCount++);}addOverlayListener(e){this.overlayListeners.add(e);}removeOverlayListener(e){this.overlayListeners.delete(e);}checkCaptureSettingsAgainstSDKConfiguration(e){!this._centaurusConnector&&this.shouldEnableVIZScanner(e)&&console.warn('Invalid IdCapture configuration or settings: VIZ scanner enabled but not loaded. You either need to set the "enableVIZDocuments" option to true when calling configure(), or adapt the Id Capture settings to not enable VIZ scanning.');}async onProcessFrame(e){var r,i;if(this.state!==f.Available)return {action:"skip",frame:e};(r=this.privateContext)==null||r.performanceMark("processFrameBeforeCentaurus"),this.moveToState(f.ProcessingFrame);let t=await this.doProcessFrame(e);return (i=this.privateContext)==null||i.performanceMark("processFrameAfterCentaurus"),{action:"continue",frame:t}}async doProcessFrame(e){var c;if(!this._isEnabled||!this.shouldEnableVIZScanner(this.settings))return e;let t=(c=this.context)==null?void 0:c.frameSource,r="singleImageUploader",i="imageFrameSource",s=(t==null?void 0:t.type)===r,o=(t==null?void 0:t.type)===i;return await this.processFrameWithCentaurus(e,{scanCroppedDocumentImage:s,forcePhotoImageSource:o})}async onAfterProcessFrame(){var e,t;if(this._safariOOMStatsCollector){this._safariOOMStatsCollector.framesProcessedCount++;let r=(t=(e=this.context)==null?void 0:e.frameSource)==null?void 0:t.currentResolution;r?this._safariOOMStatsCollector.videoResolution=`${r.width}x${r.height}`:this._safariOOMStatsCollector.videoResolution="";}this.moveToState(f.ProcessingQueue);}logPerformance(){let e=performance.getEntriesByName("processFrameBeforeCentaurus").length>0?performance.measure("Centaurus","processFrameBeforeCentaurus","processFrameAfterCentaurus").duration:0,t=performance.measure("SDC","processFrameBeforeSDC","processFrameAfterSDC").duration,r=`${(e+t).toFixed(2)}ms`;console.log(`centaurus: ${e.toFixed(2)}`,`sdc: ${t.toFixed(2)}`,`total: ${r}`),performance.clearMarks();}enqueueTask(e){this._endOfCycleTasks.push(e);}async processQueue(){if(this._endOfCycleTasks.length===0){this.moveToState(f.Available);return}for(;this._endOfCycleTasks.length>0;){let e=this._endOfCycleTasks.shift();await(e==null?void 0:e());}this.moveToState(f.Available);}shouldEnableVIZScanner(e){let{scannerType:t}=e;return A.isFullDocumentScanner(t)?true:t.visualInspectionZone}attachedToContext(e){this._context=e,this._context.subscribeToWorkerMessages(this.workerMessageListener),this._context.registerFrameHandler(this._onProcessFrameListener),re.isSafari()&&(this._safariOOMDetector=new re(this.onPageAbruptlyReloaded.bind(this)),this._safariOOMDetector.install(),this._safariOOMStatsCollector=new Re(this._safariOOMDetector)),this._context.addListener(this.contextListener);}async detachedFromContext(){await this.dispose();}async dispose(){var e,t,r,i,s,o,u;(e=this._context)==null||e.unsubscribeToWorkerMessages(this.workerMessageListener),(t=this._context)==null||t.unregisterFrameHandler(this._onProcessFrameListener),(r=this._context)==null||r.removeListener(this.contextListener),(i=this._safariOOMDetector)==null||i.uninstall(),this._safariOOMDetector=void 0,(s=this._safariOOMStatsCollector)==null||s.destroy(),this._safariOOMStatsCollector=void 0,this.listeners=[],await((o=this._centaurusConnector)==null?void 0:o.dispose()),this._centaurusConnector=void 0,(u=this.privateContext)==null||u.workerCommand("idCaptureDispose",{}),this._context=null,this.moveToState("Available");}async didChange(e){if(this.context)return this.context.update(e)}async onWorkerMessage(e){switch(e.type){case "idCaptureDidCaptureId":{this.triggerListenersForResult("didCaptureId",e.payload);break}case "idCaptureDidPartiallyCaptureId":{this.triggerListenersForResult("didPartiallyCaptureId",e.payload);break}case "idCaptureDidRejectId":{await this.triggerListenersForResult("didRejectId",e.payload),e.payload.rejectionReason==="singleImageNotRecognized"&&await this.reset();break}case "idCaptureDidLocalizeId":{this.triggerListenersForLocalization(e.payload.localization);break}case "idCaptureDidShutterButtonPositionChanged":{for(let r of this.overlayListeners)r.onShutterPositionUpdate(e.payload.position);break}case "idCaptureDidShutterButtonStateChanged":{for(let r of this.overlayListeners)r.onShutterButtonStateChanged(e.payload.state);break}case "idCaptureIdCapturedFeedback":{this._feedback.idCaptured.emit();break}case "idCaptureIdRejectedFeedback":{this._feedback.idRejected.emit();break}case "idCaptureBackendReset":{this.enqueueTask(async()=>this.onSDCResetDone());break}case "idCaptureDetectionOnlyMode":{this.enqueueTask(async()=>{var r;return (r=this._centaurusConnector)==null?void 0:r.setDetectionOnlyMode(e.payload.detectionOnlyMode)}),this.state===f.Available&&this.moveToState(f.ProcessingQueue);break}case "onFrameProcessingStarted":break;case "onFrameProcessingFinished":{this.onAfterProcessFrame();break}case "onFrameSkipped":{this.onAfterProcessFrame();break}}}async processFrameWithCentaurus(e,t){var r;if(!((r=this._centaurusConnector)!=null&&r.isReadyToProcessFrame()))return e;try{let{arrayBuffer:i,capturedId:s,detectionIssue:o,localizedOnlyId:u}=await this._centaurusConnector.processFrame(e,t);return await this.reportToBackend(s,o,u),{width:e.width,height:e.height,colorType:e.colorType,data:new Uint8ClampedArray(i)}}catch(i){return i instanceof v?(Logger.log(Logger.Level.Debug,i.message),this.triggerErrorListener(i)):(Logger.log(Logger.Level.Debug,"Error while processing incoming frame from SDC",i),this.triggerErrorListener(v.create({type:"Undefined",message:"Error while processing a frame"}))),e}}async reportToBackend(e,t,r){e!==void 0&&await this.reportLastResult(e),await this.reportLastLocalizedId(r),await this.reportLastDetectionIssue(t),await this.reportLastError(null);}uint8ArrayImageToBase64(e,t,r){let i=document.createElement("canvas");i.width=t,i.height=r;let s=i.getContext("2d");if(!s)throw new Error("Could not get 2d context from an HTMLCanvasElement");s.putImageData(new ImageData(e,t,r,{colorSpace:"srgb"}),0,0);let o=s.canvas.toDataURL("image/png",1).replace("data:image/png;base64,","");return s=null,i=null,o}convertRawImagesToBase64(e){return {front:{...e.front,frame:e.front.frame.data==null?null:this.uint8ArrayImageToBase64(e.front.frame.data,e.front.frame.width,e.front.frame.height)},back:{...e.back,frame:e.back.frame.data==null?null:this.uint8ArrayImageToBase64(e.back.frame.data,e.back.frame.width,e.back.frame.height)}}}async triggerListenersForLocalization(e){for(let t of this.listeners)typeof t.didLocalizeId=="function"&&t.didLocalizeId(Z.fromJSON(e));}async triggerListenersForResult(e,t){if(!this.context||!this._isEnabled)return;e==="didCaptureId"?this._safariOOMStatsCollector&&this._safariOOMStatsCollector.didCaptureCount++:e==="didRejectId"&&this._safariOOMStatsCollector&&this._safariOOMStatsCollector.didRejectCount++;let r=null;if(t.capturedId){let i=this.convertRawImagesToBase64(t.capturedId.rawImageInfo);r=ee.fromJSON({...t.capturedId,imageInfo:i});}for(let i of this.listeners)if(typeof i[e]=="function"){let s=[r];e==="didRejectId"&&typeof t.rejectionReason=="string"&&s.push(t.rejectionReason);let o=i[e].apply(null,s);o instanceof Promise&&await o;}}notifyRecoveryAfterCrash(){if(!this._isEnabled)return;let e=false;for(let t of this.listeners)typeof t.didFailWithError=="function"&&(t.didFailWithError(this,v.create({type:"RecoveredAfterFailure",message:"Last image processing failed but SDK could recover. Please reset scanning process."})),e=true);!e&&this.settings.scannerType._isFull&&Logger.log(Logger.Level.Warn,`A process responsible to scan images malfunctioned and was restarted. No listener for "didFailWithError" was
6
6
  found: this may result in unexpected behaviour in your application. Please define the listener
7
7
  "didFailWithError" and handle the error "IdCaptureErrorCode.RecoveredAfterFailure". Informing the user to
8
8
  start over and calling "idCapture.reset()" in this case is recommended.`);}triggerErrorListener(e){if(this._isEnabled)for(let t of this.listeners)typeof t.didFailWithError=="function"&&t.didFailWithError(this,e);}async reportLastResult(e){var t;if(this.context)return (t=this.privateContext)==null?void 0:t.workerCommand("idCaptureSetLastResult",{result:e==null?"":JSON.stringify(e)})}async reportLastError(e){var t;if(this.context)return (t=this.privateContext)==null?void 0:t.workerCommand("idCaptureSetLastError",{error:e==null?"":JSON.stringify(e)})}async reportLastLocalizedId(e){var t;if(this.context)return (t=this.privateContext)==null?void 0:t.workerCommand("idCaptureSetLastLocalizedId",{localizedId:e==null?"":JSON.stringify(e.toJSONObject())})}async reportLastDetectionIssue(e){var t;return (t=this.privateContext)==null?void 0:t.workerCommand("idCaptureSetLastDetectionIssue",{issue:e?JSON.stringify({issue:e}):""})}async onPageAbruptlyReloaded(){var r,i;if(Logger.debug("Detected abrupt page reload"),this.context==null||this._safariOOMDetector==null)return;function e(s){if(s==null)return null;try{return new URL(s).hostname}catch(o){return null}}let t={...this._safariOOMDetector.data,parentDomain:(r=e(document.referrer))!=null?r:void 0,centaurusEnabled:O.wasmSDK!=null};Logger.debug("Abrupt page reload environment data",t),(i=this.privateContext)==null||i.workerCommand("idCaptureReportSafariAbruptReload",{environmentData:t});}};var M=class{constructor(){this.type="shutter";this.view=null;}toJSONObject(){return {type:this.type}}};M.CLASS_NAME=ViewClassNames.SHUTTER_BUTTON_CONTROL_CLASS_NAME;var Le={standby:"standby",active:"active",scanning:"scanning"},Me=class{constructor(e,t){this.control=e,this.controlsElement=t;}async install(){return this.shutterButton||(ShutterButton.register(),this.shutterButton=ShutterButton.create(),this.shutterButton.classList.add("scandit-control-widget"),this.shutterButton.classList.add(`scandit-control-widget-${M.CLASS_NAME}`),this.shutterButton.style.margin="0",this.lastPositionReceived&&this.applyPositioning(this.lastPositionReceived)),this.appendShutterButton(),true}updatePosition(e){if(e.size.width===0&&e.size.height===0&&this.shutterButton){this.remove();return}this.lastPositionReceived=structuredClone(e),this.applyPositioning(e),this.appendShutterButton();}updateState(e){if(this.shutterButton)switch(e){case "scanning":{this.shutterButton.rotating=true,this.shutterButton.pulse=false;break}case "standby":{this.shutterButton.rotating=false,this.shutterButton.pulse=false;break}case "active":{this.shutterButton.rotating=false,this.shutterButton.pulse=true;break}}}remove(e){var t;(t=this.shutterButton)==null||t.remove(),e===true&&(this.shutterButton=void 0);}appendShutterButton(){this.shutterButton&&!this.controlsElement.contains(this.shutterButton)&&this.controlsElement.append(this.shutterButton);}applyPositioning(e){this.shutterButton&&(this.shutterButton.style.position="absolute",this.shutterButton.style.left=`${e.origin.x}px`,this.shutterButton.style.top=`${e.origin.y}px`,this.shutterButton.style.width=`${e.size.width}px`,this.shutterButton.style.height=`${e.size.height}px`);}};var Ft=class a{constructor(){this.type="idCapture";this._idLayoutStyle="rounded";this._defaultCapturedBrush=new Brush(I.IdCapture.IdCaptureOverlayDefaults.defaultCapturedBrush.fillColor,I.IdCapture.IdCaptureOverlayDefaults.defaultCapturedBrush.strokeColor,I.IdCapture.IdCaptureOverlayDefaults.defaultCapturedBrush.strokeWidth);this._defaultLocalizedBrush=new Brush(I.IdCapture.IdCaptureOverlayDefaults.defaultLocalizedBrush.fillColor,I.IdCapture.IdCaptureOverlayDefaults.defaultLocalizedBrush.strokeColor,I.IdCapture.IdCaptureOverlayDefaults.defaultLocalizedBrush.strokeWidth);this._defaultRejectedBrush=new Brush(I.IdCapture.IdCaptureOverlayDefaults.defaultRejectedBrush.fillColor,I.IdCapture.IdCaptureOverlayDefaults.defaultRejectedBrush.strokeColor,I.IdCapture.IdCaptureOverlayDefaults.defaultRejectedBrush.strokeWidth);this._capturedBrush=this._defaultCapturedBrush;this._localizedBrush=this._defaultLocalizedBrush;this._rejectedBrush=this._defaultRejectedBrush;this._idLayoutLineStyle="light";this._showTextHints=true;this._frontSideTextHint=Localization.getInstance().get("id.idCaptureOverlay.scanFrontSideHint");this._backSideTextHint=Localization.getInstance().get("id.idCaptureOverlay.scanBackSideHint");this._moveCloserTextHint=Localization.getInstance().get("id.idCaptureOverlay.moveCloseTextHint");this._moveFurtherAwayTextHint=Localization.getInstance().get("id.idCaptureOverlay.moveFurtherAwayTextHint");this._tapShutterToScanTextHint=Localization.getInstance().get("id.idCaptureOverlay.tapShutterToScan");this._lookingForDocumentTextHint=Localization.getInstance().get("id.idCaptureOverlay.lookingForDocument");this._holdStillTextHint=Localization.getInstance().get("id.idCaptureOverlay.holdStill");this.onShutterPositionUpdateListener=this.onShutterPositionUpdate.bind(this);this.onShutterButtonStateChangedListener=this.onShutterButtonStateChanged.bind(this);this.onContextUpdatedListener=this.onContextUpdated.bind(this);this.overlayListener={onShutterPositionUpdate:this.onShutterPositionUpdateListener,onShutterButtonStateChanged:this.onShutterButtonStateChangedListener};}get idLayoutStyle(){return this._idLayoutStyle}set idLayoutStyle(e){this._idLayoutStyle=e,this.idCapture.didChange();}get idLayoutLineStyle(){return this._idLayoutLineStyle}set idLayoutLineStyle(e){this._idLayoutLineStyle=e,this.idCapture.didChange();}get showTextHints(){return this._showTextHints}set showTextHints(e){this._showTextHints=e,this.idCapture.didChange();}get defaultCapturedBrush(){return this._defaultCapturedBrush}get defaultLocalizedBrush(){return this._defaultLocalizedBrush}get defaultRejectedBrush(){return this._defaultRejectedBrush}static async withIdCapture(e){return a.withIdCaptureForView(e,null)}static async withIdCaptureForView(e,t){var i;let r=new a;return r.idCapture=e,await r.setCapturedBrush(r.defaultCapturedBrush),await r.setLocalizedBrush(r.defaultLocalizedBrush),await r.setRejectedBrush(r.defaultRejectedBrush),t&&(r.view=t,await t.addOverlay(r),await r.installShutterButton()),e.addOverlayListener(r.overlayListener),(i=e.context)==null||i.updateListeners.add(r.onContextUpdatedListener),r}async setFrontSideTextHint(e){Logger.log(Logger.Level.Debug,"DEPRECATED: IdCaptureOverlay.setFrontSideTextHint. Use the Localization API instead."),this._frontSideTextHint=e,await this.idCapture.didChange();}async setBackSideTextHint(e){Logger.log(Logger.Level.Debug,"DEPRECATED: IdCaptureOverlay.setBackSideTextHint. Use the Localization API instead."),this._backSideTextHint=e,await this.idCapture.didChange();}async setMoveCloserTextHint(e){Logger.log(Logger.Level.Debug,"DEPRECATED: IdCaptureOverlay.setMoveCloserTextHint. Use the Localization API instead."),this._moveCloserTextHint=e,await this.idCapture.didChange();}async setMoveFurtherAwayTextHint(e){Logger.log(Logger.Level.Debug,"DEPRECATED: IdCaptureOverlay.setMoveFurtherAwayTextHint. Use the Localization API instead."),this._moveFurtherAwayTextHint=e,await this.idCapture.didChange();}getCapturedBrush(){return this._capturedBrush}async setCapturedBrush(e){this._capturedBrush=e,await this.idCapture.didChange();}getLocalizedBrush(){return this._localizedBrush}async setLocalizedBrush(e){this._localizedBrush=e,await this.idCapture.didChange();}getRejectedBrush(){return this._rejectedBrush}async setRejectedBrush(e){this._rejectedBrush=e,await this.idCapture.didChange();}toJSONObject(){return {type:this.type,idLayoutStyle:this.idLayoutStyle,idLayoutLineStyle:this.idLayoutLineStyle,showTextHints:this._showTextHints,capturedBrush:this._capturedBrush.toJSONObject(),localizedBrush:this._localizedBrush.toJSONObject(),rejectedBrush:this._rejectedBrush.toJSONObject(),frontSideTextHint:this._frontSideTextHint,backSideTextHint:this._backSideTextHint,moveCloserTextHint:this._moveCloserTextHint,moveFurtherAwayTextHint:this._moveFurtherAwayTextHint,tapShutterToScanTextHint:this._tapShutterToScanTextHint,lookingForDocumentTextHint:this._lookingForDocumentTextHint,holdStillTextHint:this._holdStillTextHint}}async installShutterButton(){if(this.view&&this.idCapture.settings.captureTrigger==="buttonTap")if(this.shutterWidget)await this.shutterWidget.install();else {let e=new M;this.shutterWidget=this.view.registerControlWidget(e,Me),this.view.addControl(e);}}onContextUpdated(e){var i,s,o,u;if(e.type==="modeEnabled"&&!e.newValue){(i=this.shutterWidget)==null||i.remove();return}e.type==="removeOverlay"&&e.newValue===this&&(this.idCapture.removeOverlayListener(this.overlayListener),(s=this.idCapture.context)==null||s.updateListeners.delete(this.onContextUpdatedListener));let t=(o=this.idCapture.context)==null?void 0:o.toJSONObject().modes,r=t==null?void 0:t.find(c=>c.type==="idCapture");r&&r.settings.captureTrigger==="auto"&&this.shutterWidget?(u=this.view)==null||u.removeControl(this.shutterWidget.control):this.installShutterButton();}onShutterPositionUpdate(e){var t,r,i;(t=this.shutterWidget)==null||t.updatePosition(e),e.size.width===0&&e.size.height===0&&((r=this.shutterWidget)!=null&&r.control)&&((i=this.view)==null||i.removeControl(this.shutterWidget.control));}onShutterButtonStateChanged(e){var t,r,i;switch(e){case "untapped":{(t=this.shutterWidget)==null||t.updateState(Le.standby);break}case "untappedLocalized":{(r=this.shutterWidget)==null||r.updateState(Le.active);break}case "tapped":{(i=this.shutterWidget)==null||i.updateState(Le.scanning);break}}}};var Be=class{constructor(e,t,r){this._days=e,this._months=t,this._years=r;}get days(){return this._days}get months(){return this._months}get years(){return this._years}toJSONObject(){return {days:this.days,months:this.months,years:this.years}}};var je=class extends A{constructor(){super();this._isFull=true;}toJSONObject(){return {isFull:this._isFull,options:{barcode:true,machineReadableZone:true,visualInspectionZone:true}}}};var ae=class extends A{constructor(t,r,i){super();this._isFull=false;this._barcode=t,this._machineReadableZone=r,this._visualInspectionZone=i;}get barcode(){return this._barcode}get machineReadableZone(){return this._machineReadableZone}get visualInspectionZone(){return this._visualInspectionZone}toJSONObject(){return {isFull:this._isFull,options:{barcode:this.barcode,machineReadableZone:this.machineReadableZone,visualInspectionZone:this.visualInspectionZone}}}};var Jt=class a{constructor(){this.acceptedDocuments=[];this.rejectedDocuments=[];this.anonymizationMode="fieldsOnly";this.captureTrigger="auto";this.rejectVoidedIds=false;this.decodeBackOfEuropeanDrivingLicense=false;this.rejectExpiredIds=false;this.rejectNotRealIdCompliant=false;this.rejectInconsistentData=false;this.rejectHolderBelowAge=null;this.rejectIdsExpiringIn=null;this.decodeMobileDriverLicenseViz=false;this.notifyOnSideCapture=false;this.properties={};this.imageToResult={};this.scannerType=new ae(false,false,false);}setProperty(e,t){this.properties[e]=t;}getProperty(e){return this.properties[e]}setShouldPassImageTypeToResult(e,t){this.imageToResult[e]=t;}getShouldPassImageTypeToResult(e){var t;return (t=this.imageToResult[e])!=null?t:false}clone(){return a.fromJSON(this.toJSONObject())}toJSONObject(){return {acceptedDocuments:this.acceptedDocuments.map(e=>e.toJSONObject()),rejectedDocuments:this.rejectedDocuments.map(e=>e.toJSONObject()),scannerType:this.scannerType.toJSONObject(),imageToResult:{face:this.imageToResult.face,croppedDocument:this.imageToResult.croppedDocument,frame:this.imageToResult.frame},properties:this.properties,anonymizationMode:this.anonymizationMode,captureTrigger:this.captureTrigger,rejectVoidedIds:this.rejectVoidedIds,decodeBackOfEuropeanDrivingLicense:this.decodeBackOfEuropeanDrivingLicense,rejectExpiredIds:this.rejectExpiredIds,rejectNotRealIdCompliant:this.rejectNotRealIdCompliant,rejectInconsistentData:this.rejectInconsistentData,rejectHolderBelowAge:this.rejectHolderBelowAge,rejectIdsExpiringIn:this.rejectIdsExpiringIn?this.rejectIdsExpiringIn.toJSONObject():null,decodeMobileDriverLicenseViz:this.decodeMobileDriverLicenseViz,notifyOnSideCapture:this.notifyOnSideCapture}}static fromJSON(e){let t=new a;t.acceptedDocuments=e.acceptedDocuments.map(s=>a.createDocumentFromJSON(s)),t.rejectedDocuments=e.rejectedDocuments.map(s=>a.createDocumentFromJSON(s));let r=e.scannerType;t.scannerType=e.scannerType.isFull?new je:new ae(r.options.barcode,r.options.machineReadableZone,r.options.visualInspectionZone),t.anonymizationMode=e.anonymizationMode,t.decodeBackOfEuropeanDrivingLicense=e.decodeBackOfEuropeanDrivingLicense,t.captureTrigger=e.captureTrigger,t.rejectVoidedIds=e.rejectVoidedIds,t.rejectExpiredIds=e.rejectExpiredIds,t.rejectNotRealIdCompliant=e.rejectNotRealIdCompliant,t.rejectInconsistentData=e.rejectInconsistentData,t.rejectHolderBelowAge=e.rejectHolderBelowAge;let i=e.rejectIdsExpiringIn;return t.rejectIdsExpiringIn=i?new Be(i.days,i.months,i.years):null,t.decodeMobileDriverLicenseViz=e.decodeMobileDriverLicenseViz,t.imageToResult={...e.imageToResult},t.properties={...e.properties},t.notifyOnSideCapture=e.notifyOnSideCapture,t}static createDocumentFromJSON(e){let t=e.documentType,r=e.region;switch(t){case "driverLicense":return new _(r);case "healthInsuranceCard":return new W(r);case "idCard":return new U(r);case "passport":return new V(r);case "residencePermit":return new K(r);case "visaIcao":return new G(r);case "regionSpecific":{let i=e;return new H(i.documentSubtype)}}}};var Ee=class a{get allChecksPassed(){var e,t;return (t=(e=this.json)==null?void 0:e.allChecksPassed)!=null?t:false}get error(){var e;return typeof((e=this.json)==null?void 0:e.error)=="string"&&this.json.error!==""?this.json.error:null}static fromJSON(e){let t=new a;return t.json=e,t}};var _t=class a{constructor(e,t=null){this._context=e,this._endpoint=t;}static async create(e){return new a(e)}async verify(e){var r,i;let t=await this._context.workerCommand("idCaptureBarcodeVerifyAamvaCapture",{capturedId:e.toJSONObject(),endpoint:this._endpoint});return (r=t.result)!=null&&r.isSuccess||Logger.log(Logger.Level.Warn,"Error during Aamva verification:",(i=t.result)==null?void 0:i.error),Ee.fromJSON(t.result)}};var Wt=class a{constructor(e){this._context=e;}static create(e){return new a(e)}async verify(e){let t=await this._context.workerCommand("idCaptureDataConsistencyVerifyCapture",{capturedId:e.toJSONObject()});return t.result==null?null:z.fromJSON(t.result)}};var Y;function Co(a){Localization.getInstance().updateIfMissing({...nt});let e=typeof(a==null?void 0:a.enableVIZDocuments)=="boolean"?a.enableVIZDocuments:false;return {moduleName:"IdCapture",load:async t=>{if(t.loadProgressNotifier=e?wt(t.loadProgressNotifier):t.loadProgressNotifier,t.overrideThreadsSupport=OverrideState.Off,t.verifyResponseHash=true,Y=await ne.create(t),DataCaptureContext.moduleLicenseTextProviders.push(new ie(Y)),!e)return Logger.log(Logger.Level.Debug,"VIZ scanning is disabled (enableVIZDocuments option was not passed to idCaptureLoader, or its value was false)"),Y;let s=(await Y.workerCommand("extractCentaurusLicense",{licenseKey:t.licenseKey})).centaurus.licenseKey;if(s.length===0)throw Logger.log(Logger.Level.Error,"Invalid license key: VIZ scanning is enabled in the options but the license key has no VIZ scanning enabled. Update the license key or disable VIZ scanning when calling idCaptureloader."),v.create({type:"InvalidLicenseKeyForVIZProcessing",message:"Invalid license key for VIZ scanning. Update license key or disable VIZ scanning."});return Logger.log(Logger.Level.Debug,"VIZ scanning is enabled, VIZ processor will be initialized"),await O.load({libraryLocation:`${t.libraryLocation}idcapture/`,licenseKey:s,logLevel:t.logLevel,loadProgressNotifier:t.loadProgressNotifier}),Y}}}function So(a){Y=a;}export{Ee as AamvaBarcodeVerificationResult,_t as AamvaBarcodeVerifier,ge as BarcodeResult,ee as CapturedId,qr as CapturedSides,z as DataConsistencyResult,Wt as DataConsistencyVerifier,p as DateResult,_ as DriverLicense,Se as DrivingLicenseCategory,J as DrivingLicenseDetails,Be as Duration,je as FullDocumentScanner,W as HealthInsuranceCard,Nr as IdAnonymizationMode,jt as IdCapture,S as IdCaptureDocument,T as IdCaptureDocumentType,v as IdCaptureError,Fe as IdCaptureErrorCode,ce as IdCaptureFeedback,Ft as IdCaptureOverlay,A as IdCaptureScanner,Jt as IdCaptureSettings,xr as IdCaptureTrigger,U as IdCard,wr as IdImageType,kr as IdLayoutLineStyle,Tr as IdLayoutStyle,Or as IdSide,Z as LocalizedOnlyId,Ce as MRZResult,V as Passport,me as ProfessionalDrivingPermit,jr as Region,H as RegionSpecific,Jr as RegionSpecificSubtype,Yr as RejectionReason,K as ResidencePermit,f as STATE,Pr as Sex,ae as SingleSideScanner,Rr as UsRealIdStatus,ye as VIZResult,he as VehicleRestriction,G as VisaIcao,Co as idCaptureLoader,Y as mainDataCaptureLoader,So as setMainDataCaptureLoader};