@scandit/web-datacapture-id 7.5.0 → 7.5.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 (21) hide show
  1. package/build/js/index.js +3 -3
  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.5.0 → 7.5.2}/resources/centaurus-worker.js +0 -0
  12. /package/sdc-lib/idcapture/{7.5.0 → 7.5.2}/resources/lightweight/advanced/Centaurus.data +0 -0
  13. /package/sdc-lib/idcapture/{7.5.0 → 7.5.2}/resources/lightweight/advanced/Centaurus.js +0 -0
  14. /package/sdc-lib/idcapture/{7.5.0 → 7.5.2}/resources/lightweight/advanced/Centaurus.wasm +0 -0
  15. /package/sdc-lib/idcapture/{7.5.0 → 7.5.2}/resources/lightweight/advanced-threads/Centaurus.data +0 -0
  16. /package/sdc-lib/idcapture/{7.5.0 → 7.5.2}/resources/lightweight/advanced-threads/Centaurus.js +0 -0
  17. /package/sdc-lib/idcapture/{7.5.0 → 7.5.2}/resources/lightweight/advanced-threads/Centaurus.wasm +0 -0
  18. /package/sdc-lib/idcapture/{7.5.0 → 7.5.2}/resources/lightweight/advanced-threads/Centaurus.worker.js +0 -0
  19. /package/sdc-lib/idcapture/{7.5.0 → 7.5.2}/resources/lightweight/basic/Centaurus.data +0 -0
  20. /package/sdc-lib/idcapture/{7.5.0 → 7.5.2}/resources/lightweight/basic/Centaurus.js +0 -0
  21. /package/sdc-lib/idcapture/{7.5.0 → 7.5.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:8612522},"scandit-datacapture-sdk-id-simd-pthreads.wasm":{bytes:8547077},"scandit-datacapture-sdk-id-simd.wasm":{bytes:8436099},"scandit-datacapture-sdk-id.wasm":{bytes:8501837}};var Ee=(s=>(s.Undefined="Undefined",s.RecoveredAfterFailure="RecoveredAfterFailure",s.InvalidLicenseKeyForVIZProcessing="InvalidLicenseKeyForVIZProcessing",s.InvalidSettingsForVIZProcessing="InvalidSettingsForVIZProcessing",s.InvalidLicenseKeyForParser="InvalidLicenseKeyForParser",s))(Ee||{}),q=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 it={"id.idCaptureOverlay.scanFrontSideHint":"","id.idCaptureOverlay.scanBackSideHint":"","id.idCaptureOverlay.moveCloseTextHint":"","id.idCaptureOverlay.moveFurtherAwayTextHint":"","id.idCaptureOverlay.tapShutterToScan":"","id.idCaptureOverlay.lookingForDocument":"","id.idCaptureOverlay.holdStill":""};function nt(a){let e=URL.createObjectURL(new Blob(['"use strict";(()=>{var Ie=(a,e)=>()=>(a&&(e=a(a=0)),e);var g,u=Ie(()=>{g={"scandit-datacapture-sdk-id-pthreads.wasm":{bytes:8612522},"scandit-datacapture-sdk-id-simd-pthreads.wasm":{bytes:8547077},"scandit-datacapture-sdk-id-simd.wasm":{bytes:8436099},"scandit-datacapture-sdk-id.wasm":{bytes:8501837}}});u();u();u();u();var d;(a=>{(o=>(o.Debug="debug",o.Info="info",o.Warn="warn",o.Error="error",o.Quiet="quiet"))(a.Level||(a.Level={}));let e=new Map([["debug",1],["info",2],["warn",3],["error",4],["quiet",5]]),t="debug";function r(o){t=o}a.setLevel=r;function s(o,...C){if(!(e.get(t)>e.get(o)))switch(o){case"debug":{console.debug(...C);break}case"info":{console.log(...C);break}case"warn":{console.warn(...C);break}case"error":{console.error(...C);break}}}a.log=s;function i(...o){s("warn",...o)}a.warn=i;function n(...o){s("debug",...o)}a.debug=n;function l(...o){s("info",...o)}a.info=l;function c(...o){s("error",...o)}a.error=c})(d||(d={}));u();u();u();u();var O=class q extends Error{constructor(e){super(e.message),Object.setPrototypeOf(this,q.prototype),this.name=e.name}toString(){return`${this.name}: ${this.message}`}};var A=Promise.resolve(),B=!1,T=!1,M,H={writableDataPath:""};async function Z(a){if(M==null)return;B=!0;let e=new Promise((t,r)=>{setTimeout(()=>{r(new O({name:"BlockedIndexedDB",message:"IndexedDB database is blocked"}))},1500)});try{await Promise.race([new Promise((t,r)=>{M?.(a,s=>{if(s!=null){r(s);return}t()})}),e])}finally{B=!1}}async function X(a){return T||(B?(T=!0,A=A.then(async()=>(T=!1,Z(a)))):A=Z(a)),A}async function Y(a){H=a,M=FS.syncfs,FS.syncfs=(e,t)=>{let r=t,s=()=>{r()},i=n=>{r(n)};X(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),X(!0)}u();u();u();u();var V=(a,e)=>(e=Symbol[a])?e:Symbol.for("Symbol."+a);var _=function(a,e){this[0]=a,this[1]=e},Q=(a,e,t)=>{var r=(n,l,c,o)=>{try{var C=t[n](l),m=(l=C.value)instanceof _,h=C.done;Promise.resolve(m?l[0]:l).then(f=>m?r(n==="return"?n:"next",l[1]?{done:f.done,value:f.value}:f,c,o):c({value:f,done:h})).catch(f=>r("throw",f,c,o))}catch(f){o(f)}},s=n=>i[n]=l=>new Promise((c,o)=>r(n,l,c,o)),i={};return t=t.apply(a,e),i[V("asyncIterator")]=()=>i,s("next"),s("throw"),s("return"),i},ee=(a,e,t)=>(e=a[V("asyncIterator")])?e.call(a):(a=a[V("iterator")](),e={},t=(r,s)=>(s=a[r])&&(e[r]=i=>new Promise((n,l,c)=>(i=s.call(a,i),c=i.done,Promise.resolve(i.value).then(o=>n({value:o,done:c}),l)))),t("next"),t("return"),e);var te={};function be(a){return[...new Uint8Array(a)].map(e=>{let t=e.toString(16);return t.length===1?`0${t}`:t}).join("")}function De(a){return Q(this,null,function*(){let e=a.getReader();try{for(;;){let{done:t,value:r}=yield new _(e.read());if(t)return;yield r}}finally{e.releaseLock()}})}async function we(a){let e=[],t=0,r=0;try{for(var s=ee(De(a)),i,n,l;i=!(n=await s.next()).done;i=!1){let o=n.value;e.push(o),t+=o.length}}catch(o){l=[o]}finally{try{i&&(n=s.return)&&await n.call(s)}finally{if(l)throw l[0]}}let c=new Uint8Array(t);for(let o of e)c.set(o,r),r+=o.length;return c.buffer}var Me=(a=>(a.VALID="VALID",a.INVALID="INVALID",a.NOT_VERIFIABLE="NOT_VERIFIABLE",a))(Me||{});async function ve(a,e,t){if(typeof crypto.subtle.digest!="function")return d.log(d.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 ${t} could not be verified`),"NOT_VERIFIABLE";try{let r=a instanceof Promise?await a:a,s=await crypto.subtle.digest("SHA-256",r),i=be(s);return e==null?(d.log(d.Level.Warn,"The library hash is not defined or empty, cannot correctly verify integrity."),"NOT_VERIFIABLE"):i===e?(d.log(d.Level.Debug,`Data Capture library WASM integrity found at ${t} has been verified correctly.`),"VALID"):(d.log(d.Level.Warn,`The Scandit Data Capture library WASM file found at ${t} 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(r){return d.log(d.Level.Warn,"Wasm response could not be verified",r),"NOT_VERIFIABLE"}}var J=new Map([["br",4.4],["gzip",2.9],["none",1]]);function xe(a){var e;let t="content-encoding";if(a==null||a.get(t)==null)return J.get("none");let r=new Set(((e=a.get(t))!=null?e:"").split(",").map(s=>s.trim()));for(let[s,i]of J)if(r.has(s))return i;return J.get("none")}function Re(a){var e,t;if(a==null)return 0;let r=(e=xe(a))!=null?e:1,s=Number.parseInt((t=a.get("content-length"))!=null?t:"0",10);return Number.isNaN(s)?0:Math.floor(s*r*100)/100}function Le(a){let{pathname:e}=new URL(a);for(let[t,r]of Object.entries(te))if(e.endsWith(t))return r.bytes;return 0}function ae(a){te=a}var ke=(a,e)=>{let t=Re(e);return t===0?Le(a):t};function Oe(a,e,t,{onProgress:r,onError:s,onComplete:i}){if(!e.body)return[e];let n=ke(a,e.headers),l=0,c=0,[o,C]=t?e.body.tee():[e.body],m=o.pipeThrough(new TransformStream({async transform(h,f){try{l+=h.length,c=Number((l/n*100).toFixed(2)),n>0&&h.length>0&&c<100?r?.({percentage:c,loadedBytes:l,privateUri:a}):n===0&&h.length>0&&r?.({percentage:null,loadedBytes:l,privateUri:a}),f.enqueue(h)}catch(b){f.error(b),s?.({error:b})}},flush(h){r?.({percentage:100,loadedBytes:l,privateUri:a}),i?.({percentage:100,loadedBytes:l,privateUri:a}),h.terminate()}}));return[new Response(m,{headers:new Headers(e.headers),status:e.status,statusText:e.statusText}),C]}async function z({wasmURI:a,expectedHash:e,verifyResponseHash:t,onProgress:r,onComplete:s,onError:i,referredOrigin:n}){let l=await fetch(a,{referrerPolicy:"origin",referrer:n??""});if(!l.ok)throw new Error(`HTTP status code is not ok: ${l.status}, ${l.statusText}`);let[c,o]=Oe(a,l,t,{onProgress:r,onError:i,onComplete:s});return o!=null&&ve(we(o),e,a),c}function re({wasmURI:a,expectedHash:e,verifyResponseHash:t,progressCallback:r,successCallback:s,errorCallback:i,importObject:n,referredOrigin:l}){async function c(C){try{let m=await z({wasmURI:a,expectedHash:e,verifyResponseHash:t,onProgress:r,referredOrigin:l}),h=await(C??m).arrayBuffer(),f=await globalThis.WebAssembly.instantiate(h,n);s(f.instance,f.module)}catch(m){d.log(d.Level.Error,m),d.log(d.Level.Error,`Couldn\'t instantiate Scandit SDK DataCapture library at ${a}, did you configure the path for it correctly?`),i?.(m)}}async function o(){let C;try{C=await z({wasmURI:a,expectedHash:e,verifyResponseHash:t,onProgress:r,referredOrigin:l});let m=await globalThis.WebAssembly.instantiateStreaming(C,n);s(m.instance,m.module)}catch(m){d.log(d.Level.Warn,m),d.log(d.Level.Warn,"WebAssembly streaming compile failed. Falling back to ArrayBuffer instantiation (this will make things slower)"),c(C?.bodyUsed===!0?void 0:C)}}typeof globalThis.WebAssembly.instantiateStreaming=="function"?o():c()}async function U(a,e,t,r){return new Promise((s,i)=>{a().then(s).catch(n=>{let l=e*2;if(l>t){i(n);return}r(n),globalThis.setTimeout(()=>{U(a,l,t,r).then(s).catch(i)},e)})})}function $(a){var e,t;let r="unknown";if((e=a.href)!=null&&e.startsWith("blob:null/"))r="localhost";else{let s=((t=a.pathname)==null?void 0:t.length)>1&&!a.pathname.startsWith("/");r=new URL(s?a.pathname:a.origin).hostname}return r.startsWith("[")&&r.endsWith("]")?(r=r.slice(1,-1),r):(/^(\\d{1,3}\\.){3}\\d{1,3}$/.test(r)&&(r=r.split(".").map(s=>Number.parseInt(s,10).toString()).join(".")),r)}async function se(a,e){async function t(){return importScripts(a)}try{await U(t,250,4e3,s=>{d.log(d.Level.Warn,s),d.log(d.Level.Warn,`Couldn\'t retrieve Scandit Data Capture library at ${a}, retrying...`)}),self.Module.mainScriptUrlOrBlob=a;let r=globalThis.SDC_WASM_JS_VERSION;return r!==e&&d.log(d.Level.Warn,`The Scandit Data Capture library JS file found at ${a} seems invalid: expected version doesn\'t match (received: ${r}, expected: ${e}). Please ensure the correct Scandit Data Capture file (with correct version) is retrieved.`),!0}catch(r){return d.log(d.Level.Error,r),!1}}u();function Ae(a){return/^https?:\\/\\/(?:[^./]*\\.)*cdn.jsdelivr.net\\//.test(a)?{result:!0,cdnBaseURL:"https://cdn.jsdelivr.net/npm/"}:/^https?:\\/\\/(?:[^./]*\\.)*unpkg.com\\//.test(a)?{result:!0,cdnBaseURL:"https://unpkg.com/"}:{result:!1,cdnBaseURL:""}}function Fe(a){let e=/@scandit\\/web-datacapture-[a-z]+/i.exec(a);return e?e[0]:null}function ie(a,e,t){let r=e,s=Ae(r);if(s.result){let n=Fe(r);n!=null&&(r=`${s.cdnBaseURL}${n}@${a}/sdc-lib/`)}let i=t.replace(".wasm","");return s.result?{jsURI:`${r}${i}.js`,wasmURI:`${r}${i}.wasm`}:{jsURI:`${r}${i}.js?v=${a}`,wasmURI:`${r}${i}.wasm?v=${a}`}}u();var F;(a=>{function e(){return"7.5.0"}a.sdkVersion=e})(F||(F={}));u();var ne=class{constructor(){this.promise=new Promise((a,e)=>{this.reject=e,this.resolve=a})}};u();var Ee=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])),Pe=()=>(async a=>{try{return typeof MessageChannel<"u"&&new MessageChannel().port1.postMessage(new SharedArrayBuffer(1)),WebAssembly.validate(a)}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 We(){return typeof crossOriginIsolated>"u"?!1:crossOriginIsolated}function Ne(){try{return new WebAssembly.Memory({initial:1,maximum:1,shared:!0}).buffer.constructor.name==="SharedArrayBuffer"}catch{return!1}}async function oe(){return Ee()}async function Te(){if(!await Pe())return!1;let a=null;try{a=new Worker(URL.createObjectURL(new Blob([\'postMessage("Worker" in self);\'],{type:"text/javascript"})),{name:"nestedWorkerTest"})}catch{return!1}return new Promise(e=>{if(a==null){e(!1);return}a.onmessage=t=>{a?.terminate(),e(t.data)}})}async function de(){let a=await Te();return We()&&Ne()&&a}var le=class ue{constructor(e,t){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=t,this._loadProgressCallback=this._loadProgressCallback.bind(this),ae(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 t=this.getNextFrameId();this.frameDataPool.set(t,new Uint8ClampedArray(e.getFrameData()));let r=this.lastUsedModuleMirrorAxis==null?!1:this.lastUsedModuleMirrorAxis!==this.Module.Axis.None;return{frameId:t,width:e.getWidth(),height:e.getHeight(),isFrameSourceMirrored:r}}createContext(e){var t,r,s,i,n;let l=this.getModeDeserializers(),c=$(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 o=this.contextDeserializer.contextFromJson(JSON.stringify(e.context));if(o==null){let p=this.contextDeserializer.getLastError();throw new Error(`Could not create the context: ${p}`)}let C=o.getView();this.context=o.getContext(),o.delete();let m=this.Module.DataCaptureContextListener.extend("DataCaptureContextListener",{didChangeStatus:(p,I)=>{this.contextDidChangeStatus(JSON.parse(I.toJson())),p.delete()},didStartObservingContext:p=>{this.didStartObservingContext(),p.delete()},didStopObservingContext:p=>{p.delete()}}),h=this.Module.DataCaptureContextFrameListener.extend("DataCaptureContextFrameListener",{onObservationStarted:p=>{p.delete()},onObservationStopped:p=>{p.delete()},onFrameProcessingStarted:(p,I)=>{this.workerFunctions.postMessage({type:"onFrameProcessingStarted"}),I.delete(),p.delete()},onFrameProcessingFinished:(p,I)=>{this.workerFunctions.postMessage({type:"onFrameProcessingFinished"}),I.delete(),p.delete()},onFrameSkipped:(p,I)=>{this.workerFunctions.postMessage({type:"onFrameSkipped"}),I.delete(),p.delete()}}),f=this.Module.GestureRecognizer.extend("GestureRecognizer",{setGestureListener:(p,I)=>{var L;(L=this.gestureListener)==null||L.delete(),this.gestureListener=p.clone(),p.delete()}});(t=this.gestureRecognizer)==null||t.delete(),this.gestureRecognizer=new f;let b=new m;this.context.addListener(b),b.delete();let D=new h;this.context.addFrameListener(D),D.delete(),this.setView(C),(r=this.view)==null||r.setGestureRecognizer(this.gestureRecognizer);let w=this.Module.PlatformHintPresenter.extend("PlatformHintPresenter",{setHintPresenter:p=>{p.delete()},showToast:p=>{this.workerFunctions.postMessage({type:"showToast",payload:JSON.parse(p)})},hideToast:p=>{this.workerFunctions.postMessage({type:"hideToast",payload:JSON.parse(p)})},showGuidance:p=>{this.workerFunctions.postMessage({type:"showGuidance",payload:JSON.parse(p)})},hideGuidance:p=>{this.workerFunctions.postMessage({type:"hideGuidance",payload:JSON.parse(p)})},startUpdateTimer:p=>{this.workerFunctions.postMessage({type:"startUpdateTimer",payload:{duration:{unit:"ms",value:p}}})},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),(n=this.view)==null||n.setHintPresenterV2(this.hintPresenterV2))}onTap(e){var t;(t=this.gestureListener)==null||t.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,t,r,s;this.context.dispose(),this.frameDataPool.clear(),this.isDrawLoopRunning=!1,this.lastFrameCounter=-1,(e=this.gestureRecognizer)==null||e.delete(),this.gestureRecognizer=null,(t=this.gestureListener)==null||t.delete(),this.gestureListener=null,(r=this.hintPresenterV2)==null||r.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[ue.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 t;if(this.context==null)return{payload:e,transferables:[e.data.buffer]};let r=e.data,s=e.colorType==="GRAYSCALE"?this.Module.ImageBufferFormat.Grayscale8:this.Module.ImageBufferFormat.Rgba8888,i=this.Module.allocateUint8Array(r.byteLength);return this.Module.HEAPU8.set(r,i),(t=this.imageFrameSource)==null||t.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 t=this.frameDataPool.get(e);return t==null?{payload:{data:null}}:{payload:{data:t},transferables:[t.buffer]}}scheduleRedraw(e,t){this.addRedrawRequest(t),this.isDrawLoopRunning||this.startDrawLoop(e)}sendViewRefreshCommands(e){this.workerFunctions.postMessage({type:"draw",payload:e},[e.buffer])}setFrameSource(e,t){var r;this.lastUsedModuleMirrorAxis=this.mapMirrorAxisOnModule(e),(r=this.imageFrameSource)==null||r.delete(),this.imageFrameSource=new this.Module.ImageBufferFrameSource(this.lastUsedModuleMirrorAxis,t,0),this.context.setFrameSource(this.imageFrameSource)}startDrawLoop(e){this.isDrawLoopRunning=!0;let t=i=>this.redrawRequests.length>0&&this.redrawRequests[0]<=i,r=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(t(i)){r(i),e.draw();let n=e.getDrawCommands();this.sendViewRefreshCommands(new Uint8Array(n))}s()},this.redrawInterval)};s()}updateContext(e){if(this.context!=null&&this.contextDeserializer!=null){e.view!=null&&!e.view.visible&&this.context.flushAnalytics();let t=this.onBeforeUpdateContextHook(e),r=this.contextDeserializer.updateContextFromJson(this.context,this.view,JSON.stringify(t.context));if(r==null){let i=this.contextDeserializer.getLastError();throw new Error(`Could not update the context: ${i}`)}this.context.delete(),this.context=r.getContext();let s=r.getView();r.delete(),s!=null&&t.view!=null&&s.setViewSize(t.view.width,t.view.height,t.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?.setGestureRecognizer(this.gestureRecognizer),this.setView(s),d.debug("context updated",t)}}onBeforeUpdateContextHook(e){return e}onDocumentVisibilityChange(e){e==="hidden"&&this.context.flushAnalytics()}isFeatureSupported(e){return{payload:{supported:this.context.isFeatureSupported(e)}}}getViewfinderInfo(){var e,t;return{payload:{isDisplayingViewfinder:(t=(e=this.view)==null?void 0:e.isDisplayingViewfinder())!=null?t:!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,t){return t?e?"7195bf4ba9f92bc68c5753dee387c3c438fa6cf378739a6b947fea1d15e7ece8":"a9bdcfb55cf1d374081240ef4db07a9d077b4ab6c81f902bc664fc7fb8e4a06c":e?"97b630e9d6cfad093f8052765f726d51c2d117e6af4a40bd2ce8b058352f15bf":""}getWasmCoreFileName(e,t){return t?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((t,r)=>t-r)}contextDidChangeStatus(e){e.code===260?e.message=e.message.replace("domain name",`domain name (${$(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){d.warn("addNativeOverlay has not been implemented for this module",e)}removeNativeOverlay(e){d.warn("removeNativeOverlay has not been implemented for this module",e)}setViewRefreshHandler(e){if(e==null||e.isViewRefreshHandlerSet)return;let t=this.Module.NeedsRedrawDelegate.extend("NeedsRedrawDelegate",{setNeedsRedrawIn:this.scheduleRedraw.bind(this,e)}),r=new t;e.setNeedsRedrawDelegate(r),e.isViewRefreshHandlerSet=!0}setupDataDecoding(){let e=this.moduleHandler.get(),t=e.DataDecoding.extend("DataDecoding",{decode(r,s){try{let i=JSON.parse(s),n=[];for(let l of i){let c=new TextDecoder(l.ianaName,{fatal:!0});n.push(c.decode(r.slice(l.startIndex,l.endIndex)))}return n.join("")}catch{return""}}});e.setDataDecoding(new t)}start(e,t,r){e&&t&&(this.setupDataDecoding(),this.moduleHandler.get().callMain(),this.moduleHandler.get().__emscripten_proxy_main!==void 0||r())}getWritableDataPath(e){return e!=null?(d.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:t,writableDataPathOverride:r,overrideThreadsSupport:s,overrideSimdSupport:i,verifyResponseHash:n,referredOrigin:l,fixedWasmMemory:c}){var o;let C=!1,m=!1;this.writableDataPath=this.getWritableDataPath(r),this.resourcePath=`${e}${this.resourceFilesSubfolder}/`,globalThis.path=t;let{resolve:h,reject:f,promise:b}=new ne,D=F.sdkVersion();if(D==="")throw new O({name:"Invalid library version",message:"Library version is not defined or empty, cannot generate proper path to library files."});let[w,p]=await Promise.all([oe(),de()]);s!=="auto"&&(p=s==="on"),i!=="auto"&&(w=i==="on");let I=this.getWasmCoreFileName(w,p),L=ie(D,e,I),{jsURI:N,wasmURI:K}=L,ge={instantiateWasm:(S,fe)=>(re({importObject:S,wasmURI:K,expectedHash:this.getWasmCoreExpectedHash(w,p),verifyResponseHash:n,successCallback:fe,progressCallback:this._loadProgressCallback,errorCallback:ye=>{f(ye)},referredOrigin:l}),{})},k=c===null?null:new WebAssembly.Memory({initial:this.numOfMBToPages(c),maximum:this.numOfMBToPages(300),shared:p});return k!==null&&d.log(d.Level.Debug,"Fixed wasmMemory set",k),this.moduleHandler.set({...k?{wasmMemory:k}:{},mainScriptUrlOrBlob:N,canvas:(o=this.workerFunctions.getOffscreenCanvas())!=null?o:{getContext:()=>null},...ge,dynamicLibraries:this.getWasmDynamicLibraries(K),locateFile:S=>e+S,noInitialRun:!0,preRun:[async()=>{try{await Y({writableDataPath:this.writableDataPath})}catch(S){if(S.name==="BlockedIndexedDB"){f(S.toString());return}d.log(d.Level.Debug,"No IndexedDB support, some data will not be persisted:",S)}m=!0,this.start(m,C,h)}],onMainComplete:()=>{if([C,m].includes(!1)){d.log(d.Level.Warn,{runtimeLoaded:C,fileSystemSynced:m},"Both runtimeLoaded and fileSystemSynced should be true when calling onMainComplete"),f("onMainComplete has been called but runtime or file system was not ready.");return}h()},onRuntimeInitialized:()=>{C=!0,this.start(m,C,h)},print:S=>{d.log(d.Level.Info,S)}}),await se(N,D)||f(`Couldn\'t retrieve Scandit Data Capture library at ${N}, did you configure the path for it correctly?`),b}};le.get3dPartyLicenseKeyMethodName=atob("Z2V0QmxpbmtJZExpY2Vuc2VLZXk=");var v=le;u();u();function x(a){return typeof a=="object"&&a!=null}function R(a){if(typeof a=="string")return a;if(x(a)){if(typeof a.message=="string")return a.message}else if(typeof a?.toString=="function")return a.toString();return"unknown error"}u();function ce(a){return typeof a=="object"&&a!=null&&a.document==null&&"addEventListener"in a&&typeof a.importScripts=="function"}u();function pe(a){console.warn("Reached unexpected case",a)}var j=class{constructor(a,e){this.onMessageListener=this.onMessage.bind(this),this.workerSelf=a,this.dataCaptureInstance=new v(e,{postMessage:this.postMessage.bind(this),getOffscreenCanvas:this.getOffscreenCanvas.bind(this)}),ce(a)&&this.listenToMessages()}listenToMessages(){this.workerSelf.addEventListener("message",this.onMessageListener),this.workerSelf.addEventListener("error",a=>{d.log(d.Level.Error,a)}),this.workerSelf.addEventListener("messageerror",a=>{d.log(d.Level.Error,a)})}postMessage(a,e){this.workerSelf.postMessage(a,e??[])}getOffscreenCanvas(){if(typeof this.workerSelf.OffscreenCanvas=="function")return new this.workerSelf.OffscreenCanvas(32,32)}hasPayload(a){return x(a)&&"payload"in a}hasTransferables(a){return x(a)&&Array.isArray(a.transferables)}async respondWith(a,e,t){let r=null,s;try{s=t(),s instanceof Promise&&(s=await s)}catch(n){s=void 0,r=R(n)}let i={type:"workerTaskId",command:a,id:e,payload:this.hasPayload(s)?s.payload:void 0};r!=null&&(i.error=r),this.postMessage(i,this.hasTransferables(s)?s.transferables:[])}onMessage(a){switch(a.data.command){case"loadLibrary":{{let{data:e}=a;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}=a;this.respondWith(e.command,e.id,async()=>{this.dataCaptureInstance.onTap(e.point)})}break}case"hintPresenterV2update":{{let{data:e}=a;this.respondWith(e.command,e.id,async()=>{this.dataCaptureInstance.hintPresenterV2Update()})}break}case"createContext":{{let{data:e}=a;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}=a;this.respondWith(e.command,e.id,()=>this.dataCaptureInstance.setFrameSource(e.mirrorAxis,e.isCameraFrameSource))}break}case"processFrame":{{let{data:e}=a;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}=a;this.respondWith(e.command,e.id,()=>this.dataCaptureInstance.requestFrameData(e.frameId))}break}case"deleteFrameData":{{let{data:e}=a;this.respondWith(e.command,e.id,()=>{this.dataCaptureInstance.deleteFrameData(e.frameId)})}break}case"updateContext":{{let{data:e}=a;this.respondWith(e.command,e.id,async()=>this.dataCaptureInstance.updateContext(e))}break}case"dispose":{this.respondWith(a.data.command,a.data.id,()=>this.dataCaptureInstance.dispose());break}case"flushAnalytics":{this.respondWith(a.data.command,a.data.id,()=>{this.dataCaptureInstance.flushAnalytics()});break}case"reportCameraProperties":{{let{data:e}=a;this.respondWith(e.command,e.id,async()=>this.dataCaptureInstance.reportCameraProperties(e))}break}case"setLogLevel":{{let{data:e}=a;this.respondWith(e.command,e.id,()=>{d.setLevel(e.level)})}break}case"extractCentaurusLicense":{{let{data:e}=a;this.respondWith(e.command,e.id,()=>this.dataCaptureInstance.extractCentaurusLicense(e.licenseKey))}break}case"documentVisibility":{{let{data:e}=a;this.respondWith(e.command,e.id,()=>{this.dataCaptureInstance.onDocumentVisibilityChange(e.state)})}break}case"isFeatureSupported":{{let{data:e}=a;this.respondWith(e.command,e.id,()=>this.dataCaptureInstance.isFeatureSupported(e.feature))}break}case"getViewfinderInfo":{{let{data:e}=a;this.respondWith(e.command,e.id,()=>this.dataCaptureInstance.getViewfinderInfo())}break}case"getOpenSourceSoftwareLicenseInfo":{{let{data:e}=a;this.respondWith(e.command,e.id,()=>this.dataCaptureInstance.getOpenSourceSoftwareLicenseInfo())}break}case"addNativeOverlay":this.dataCaptureInstance.addNativeOverlay(a);break;case"removeNativeOverlay":this.dataCaptureInstance.removeNativeOverlay(a);break;default:return pe(a.data),!1}return!0}};u();u();u();u();u();function me(a){return a.ok()}function Ce(a,e){return me(a)?a.value():e}function he(a,e){return me(a)?e:a.error()}function y(a,e){return a===void 0?e:a}var E=class{constructor(e,t,r){this.SDCIdCaptureMode=null;this.lastResult="";this.lastError="";this.lastLocalizedId="";this.lastDetectionIssue="";this.coreEngine=e,this.Module=e.Module,this.workerFunctions=e.workerFunctions,this.start(t,r)}start(e,t){this.initHintPresenterIfNotInitialized();let r=this.Module.IdCaptureListener.extend("IdCaptureListener",{onSessionUpdated:(m,h)=>{m.delete(),h.delete()},onIdCaptured:(m,h)=>{this.onIdCapturedCallback(h),m.delete(),h.delete()},onIdPartiallyCaptured:(m,h)=>{this.onIdPartiallyCapturedCallback(h),m.delete(),h.delete()},onIdRejected:(m,h,f)=>{this.onIdRejectedCallback(h,f),m.delete(),h?.delete()},onIdLocalized:(m,h)=>{this.onIdLocalizedCallback(h),m.delete()},onShutterButtonPositionChanged:m=>{this.onShutterButtonPositionChangedCallback(m)},onShutterButtonStateChanged:m=>{this.onShutterButtonStateChangedCallback(m)}}),s=this.Module.Feedback.extend("Feedback",{emit:()=>{this.workerFunctions.postMessage({type:"idCaptureIdCapturedFeedback"})}}),i=this.Module.Feedback.extend("Feedback",{emit:()=>{this.workerFunctions.postMessage({type:"idCaptureIdRejectedFeedback"})}}),n=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 n;this.SDCIdCaptureMode=new this.Module.IdCapture(e,l,t,null),l.delete();let c=new r;this.SDCIdCaptureMode.addListener(c),c.delete();let o=new s,C=new i;this.SDCIdCaptureMode.setFeedbacks(o,C),o.delete(),C.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){this.SDCIdCaptureMode?.applySettings(JSON.stringify(e))}reset(){this.SDCIdCaptureMode?.reset()}parseCode(e){if(this.SDCIdCaptureMode){let t=this.SDCIdCaptureMode.parse(e);if(t.ok()){let r=Ce(t,null);if(r!=null){let s=this.extractCaptureId(r);if(s!=null)return{status:"success",capturedId:s}}}else return{status:"error",error:he(t,"Undefined error")}}return null}dataConsistencyVerifyCapture(e){let r=new this.Module.DataConsistencyVerifier(this.coreEngine.context).verify(JSON.stringify(e));if(r==null)return null;let s=JSON.parse(r.toJson());return r.delete(),s}async barcodeVerifyAamvaCapture(e,t){return new Promise(r=>{let s=this.Module.AamvaBarcodeVerifier.extend("AamvaBarcodeVerifier",{retriggerVerificationIn(n){setTimeout(()=>{i.startVerification(JSON.stringify(e))},n)},verificationEnded(){let n=i.getBarcodeVerificationResponse();r({isSuccess:n.isSuccess,error:n.error,allChecksPassed:n.allChecksPassed,serverResponseJSON:n.serverResponseJson})}}),i=new s;i.initialize(this.coreEngine.context,t??""),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 t=this.extractCaptureId(e);t&&this.workerFunctions.postMessage({type:"idCaptureDidCaptureId",payload:{capturedId:t}},this.extractImageTransferablesFromCapturedId(t))}onIdPartiallyCapturedCallback(e){let t=this.extractCaptureId(e);t&&this.workerFunctions.postMessage({type:"idCaptureDidPartiallyCaptureId",payload:{capturedId:t}},this.extractImageTransferablesFromCapturedId(t))}onIdRejectedCallback(e,t){let r=this.extractCaptureId(e);this.workerFunctions.postMessage({type:"idCaptureDidRejectId",payload:{capturedId:r,rejectionReason:t}},r?this.extractImageTransferablesFromCapturedId(r):[])}onIdLocalizedCallback(e){this.workerFunctions.postMessage({type:"idCaptureDidLocalizeId",payload:{localization:JSON.parse(e)}})}extractCaptureId(e){if(e==null)return null;let t=e.getImages(),r=t.getFrameFront(),s=t.getFrameBack(),i=y(t.getFace(),null),n=y(t.getCroppedDocumentFront(),null),l=y(t.getCroppedDocumentBack(),null),c={front:{face:i,croppedDocument:n,frame:{data:r?new Uint8ClampedArray(r.getFrameData()):null,width:r?.getWidth()??0,height:r?.getHeight()??0,mirrorAxis:r?.getMirrorAxis().value??0,orientation:r?.getOrientation()??0}},back:{face:null,croppedDocument:l,frame:{data:s?new Uint8ClampedArray(s.getFrameData()):null,width:s?.getWidth()??0,height:s?.getHeight()??0,mirrorAxis:s?.getMirrorAxis().value??0,orientation:s?.getOrientation()??0}}};r?.delete(),s?.delete(),t.delete();let o=JSON.parse(e.toJson());return{...{firstName:y(e.getFirstName(),""),lastName:y(e.getLastName(),""),secondaryLastName:y(e.getSecondaryLastName(),""),fullName:e.getFullName(),sex:y(e.getSex(),""),age:y(e.getAge(),null),isExpired:y(e.isExpired(),null),nationality:y(e.getNationality(),""),address:y(e.getAddress(),""),issuingCountry:y(e.getIssuingCountry(),""),issuingCountryIso:y(e.getIssuingCountryIso(),""),documentNumber:y(e.getDocumentNumber(),""),documentAdditionalNumber:y(e.getDocumentAdditionalNumber(),""),dateOfBirth:G(y(e.getDateOfBirth(),null)),dateOfExpiry:G(y(e.getDateOfExpiry(),null)),dateOfIssue:G(y(e.getDateOfIssue(),null)),documentType:y(e.getDocumentType(),null),documentSubtype:y(e.getDocumentSubtype(),null)},...o,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 t=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,t),t.delete()}parseIdCaptureSession(e){return JSON.parse(e.toJson())}dispose(){this.SDCIdCaptureMode?.delete(),this.SDCIdCaptureMode=null,this.lastError="",this.lastLocalizedId="",this.lastResult=""}extractImageTransferablesFromCapturedId(e){let t=[];return e.rawImageInfo.front.frame.data&&e.rawImageInfo.front.frame.data.length>0&&t.push(e.rawImageInfo.front.frame.data.buffer),e.rawImageInfo.back.frame.data&&e.rawImageInfo.back.frame.data.length>0&&t.push(e.rawImageInfo.back.frame.data.buffer),t}isReadyToDisplayHints(){return this.coreEngine.view?this.coreEngine.view.hintPresenterInitialized():!1}initHintPresenterIfNotInitialized(){if(this.isReadyToDisplayHints())return;let e=this.Module.HintPresenter.extend("HintPresenter",{showHint:(t,r)=>{this.workerFunctions.postMessage({type:"showHint",payload:{text:t,style:JSON.parse(r)}})},updateHint:t=>{this.workerFunctions.postMessage({type:"updateHint",payload:{style:JSON.parse(t)}})},hideHint:()=>{this.workerFunctions.postMessage({type:"hideHint",payload:{}})}});this.coreEngine.view?.setHintPresenter(new e)}};function G(a){if(typeof a=="string")try{return JSON.parse(a)}catch{return null}return null}function He(a,e,t){let r=e.IdCaptureDeserializerHelper.extend("IdCaptureDeserializerHelper",{createMode:(n,l)=>{let c=new E(a,n,l);return t(c),n.delete(),l.delete(),c.getSDCIdCaptureMode()}}),s=new r,i=new e.IdCaptureDeserializer(s);return s.delete(),i}var P=class extends v{constructor(){super(...arguments);this.idCaptureMode=null;this.lastIdCaptureModeSerializedSettings=""}getModeDeserializers(){let t=super.getModeDeserializers();return t.push_back(He(this,this.Module,this.receiveNewCaptureMode.bind(this))),t}receiveNewCaptureMode(t){this.idCaptureMode=t}processFrame(t){return this.idCaptureMode?super.processFrame(t):{payload:t,transferables:[t.data.buffer]}}updateContext(t){super.updateContext(t)}idCaptureSetLastResult(t){this.idCaptureMode?.setLastResult(t)}idCaptureSetLastError(t){this.idCaptureMode?.setLastError(t)}idCaptureSetLastLocalizedId(t){this.idCaptureMode?.setLastLocalizedId(t)}idCaptureSetLastDetectionIssue(t){this.idCaptureMode?.setLastDetectionIssue(t)}idCaptureReset(){this.idCaptureMode?.reset()}idCaptureApplySettings(t){this.idCaptureMode?.applySettings(t)}idCaptureParse(t){return{payload:{result:this.idCaptureMode?.parseCode(t)??null}}}async idCaptureBarcodeVerifyAamvaCapture(t,r){return{payload:{result:await this.idCaptureMode?.barcodeVerifyAamvaCapture(t,r)??null}}}idCaptureDataConsistencyVerifyCapture(t){return{payload:{result:this.idCaptureMode?.dataConsistencyVerifyCapture(t)??null}}}idCaptureDrivingLicenseDetailsCreateWithCentaurusData(t,r,s){let i=this.Module.DrivingLicenseDetails.createWithCentaurusData(t,r,s);return{payload:{result:JSON.parse(i)}}}getIdOpenSourceSoftwareLicenseInfo(){return{payload:{licenseText:this.Module.IdOpenSourceSoftwareLicenseInfo.getLicenseText()}}}idCaptureReportSafariAbruptReload(t){this.idCaptureMode?.reportSafariAbruptReload(t)}idCaptureDispose(){this.idCaptureMode?.dispose(),this.idCaptureMode=null}getWasmSideModuleFileName(){return""}getWasmCoreFileName(t,r){return r?t?"scandit-datacapture-sdk-id-simd-pthreads.wasm":"scandit-datacapture-sdk-id-pthreads.wasm":t?"scandit-datacapture-sdk-id-simd.wasm":"scandit-datacapture-sdk-id.wasm"}getWasmCoreExpectedHash(t,r){return r?t?"7195bf4ba9f92bc68c5753dee387c3c438fa6cf378739a6b947fea1d15e7ece8":"a9bdcfb55cf1d374081240ef4db07a9d077b4ab6c81f902bc664fc7fb8e4a06c":t?"97b630e9d6cfad093f8052765f726d51c2d117e6af4a40bd2ce8b058352f15bf":"fdd188c826d2ebf6c03a3ff0af22e69209a26ef805729f99dea7b916320eaa98"}getWasmMetadata(){return g}};var W=class extends j{constructor(e,t){super(e,t),this.dataCaptureInstance=new P(t,{postMessage:this.postMessage.bind(this),getOffscreenCanvas:this.getOffscreenCanvas.bind(this)})}async respondWith(e,t,r){let s=null,i;try{i=r(),i instanceof Promise&&(i=await i)}catch(l){d.log(d.Level.Debug,l),i=void 0,s=R(l)}let n={type:"workerTaskId",command:e,id:t,payload:this.hasPayload(i)?i.payload:void 0};s!=null&&(n.error=s),this.postMessage(n,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"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}default:return super.onMessage(e)}}};var Ia=new W(globalThis,{get:()=>globalThis.Module,set:a=>{globalThis.Module=a}});function Sa(a){}})();\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=nt({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 pt=Symbol("Comlink.proxy"),Ht=Symbol("Comlink.endpoint"),mt=Symbol("Comlink.releaseProxy"),Fe=Symbol("Comlink.finalizer"),oe=Symbol("Comlink.thrown"),ht=a=>typeof a=="object"&&a!==null||typeof a=="function",Kt={canHandle:a=>ht(a)&&a[pt],serialize(a){let{port1:e,port2:t}=new MessageChannel;return ft(a,e),[t,[t]]},deserialize(a){return a.start(),yt(a)}},Gt={canHandle:a=>ht(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}},gt=new Map([["proxy",Kt],["throw",Gt]]);function Zt(a,e){for(let t of a)if(e===t||t==="*"||t instanceof RegExp&&t.test(e))return true;return false}function ft(a,e=globalThis,t=["*"]){e.addEventListener("message",function r(i){if(!i||!i.data)return;if(!Zt(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 g=u.slice(0,-1).reduce((f,w)=>f[w],a),h=u.reduce((f,w)=>f[w],a);switch(o){case "GET":m=h;break;case "SET":g[u.slice(-1)[0]]=P(i.data.value),m=true;break;case "APPLY":m=h.apply(g,c);break;case "CONSTRUCT":{let f=new h(...c);m=It(f);}break;case "ENDPOINT":{let{port1:f,port2:w}=new MessageChannel;ft(a,w),m=er(f,[f]);}break;case "RELEASE":m=void 0;break;default:return}}catch(g){m={value:g,[oe]:0};}Promise.resolve(m).catch(g=>({value:g,[oe]:0})).then(g=>{let[h,f]=de(g);e.postMessage(Object.assign(Object.assign({},h),{id:s}),f),o==="RELEASE"&&(e.removeEventListener("message",r),Ct(e),Fe in a&&typeof a[Fe]=="function"&&a[Fe]());}).catch(g=>{let[h,f]=de({value:new TypeError("Unserializable return value"),[oe]:0});e.postMessage(Object.assign(Object.assign({},h),{id:s}),f);});}),e.start&&e.start();}function Qt(a){return a.constructor.name==="MessagePort"}function Ct(a){Qt(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);}}),Je(a,t,[],e)}function se(a){if(a)throw new Error("Proxy has been released and is not useable")}function St(a){return j(a,new Map,{type:"RELEASE"}).then(()=>{Ct(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&&St(a);});function $t(a,e){let t=(ue.get(e)||0)+1;ue.set(e,t),le&&le.register(a,e,a);}function Yt(a){le&&le.unregister(a);}function Je(a,e,t=[],r=function(){}){let i=false,s=new Proxy(r,{get(o,u){if(se(i),u===mt)return ()=>{Yt(s),St(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 Je(a,e,[...t,u])},set(o,u,c){se(i);let[m,g]=de(c);return j(a,e,{type:"SET",path:[...t,u].map(h=>h.toString()),value:m},g).then(P)},apply(o,u,c){se(i);let m=t[t.length-1];if(m===Ht)return j(a,e,{type:"ENDPOINT"}).then(P);if(m==="bind")return Je(a,e,t.slice(0,-1));let[g,h]=ot(c);return j(a,e,{type:"APPLY",path:t.map(f=>f.toString()),argumentList:g},h).then(P)},construct(o,u){se(i);let[c,m]=ot(u);return j(a,e,{type:"CONSTRUCT",path:t.map(g=>g.toString()),argumentList:c},m).then(P)}});return $t(s,a),s}function Xt(a){return Array.prototype.concat.apply([],a)}function ot(a){let e=a.map(de);return [e.map(t=>t[0]),Xt(e.map(t=>t[1]))]}var bt=new WeakMap;function er(a,e){return bt.set(a,e),a}function It(a){return Object.assign(a,{[pt]:true})}function de(a){for(let[e,t]of gt)if(t.canHandle(a)){let[r,i]=t.serialize(a);return [{type:"HANDLER",name:e,value:r},i]}return [{type:"RAW",value:a},bt.get(a)||[]]}function P(a){switch(a.type){case "HANDLER":return gt.get(a.name).deserialize(a.value);case "RAW":return a.value}}function j(a,e,t,r){return new Promise(i=>{let s=tr();e.set(s,i),a.start&&a.start(),a.postMessage(Object.assign({id:s},t),r);})}function tr(){return new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-")}var ut="application/javascript",rr=(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:ut});u=URL.createObjectURL(c);}else u=`data:${ut},`+encodeURIComponent(o);i(u);}).catch(()=>{s(new Error(`Failed to fetch worker from ${a}`));}))},ar=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}}(),ir=nr(["",""],["",""]);function nr(a,e){return Object.freeze(Object.defineProperties(a,{raw:{value:Object.freeze(e)}}))}function sr(a,e){if(!(a instanceof e))throw new TypeError("Cannot call a class as a function")}var S=function(){function a(){for(var e=this,t=arguments.length,r=Array(t),i=0;i<t;i++)r[i]=arguments[i];return sr(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 ar(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(ir,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 or(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 N=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,or(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)}}},ur={separator:"",conjunction:"",serial:false},v=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:ur;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 g=r.lastIndexOf(o);r=r.slice(0,g)+(c?o:"")+" "+u+r.slice(g+1);}}return r}}},vt=function(e){return {onSubstitution:function(r,i){return typeof r=="string"&&r.includes(e)&&(r=r.split(e)),r}}},lt=function(e){return e!=null&&!Number.isNaN(e)&&typeof e!="boolean"},lr=function(){return {onSubstitution:function(t){return Array.isArray(t)?t.filter(lt):lt(t)?t:""}}};new S(v({separator:","}),N,b);new S(v({separator:",",conjunction:"and"}),N,b);new S(v({separator:",",conjunction:"or"}),N,b);new S(vt(`
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:8629501},"scandit-datacapture-sdk-id-simd-pthreads.wasm":{bytes:8565184},"scandit-datacapture-sdk-id.wasm":{bytes:8519496},"scandit-datacapture-sdk-id-simd.wasm":{bytes:8454877}};var Ee=(s=>(s.Undefined="Undefined",s.RecoveredAfterFailure="RecoveredAfterFailure",s.InvalidLicenseKeyForVIZProcessing="InvalidLicenseKeyForVIZProcessing",s.InvalidSettingsForVIZProcessing="InvalidSettingsForVIZProcessing",s.InvalidLicenseKeyForParser="InvalidLicenseKeyForParser",s))(Ee||{}),q=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 it={"id.idCaptureOverlay.scanFrontSideHint":"","id.idCaptureOverlay.scanBackSideHint":"","id.idCaptureOverlay.moveCloseTextHint":"","id.idCaptureOverlay.moveFurtherAwayTextHint":"","id.idCaptureOverlay.tapShutterToScan":"","id.idCaptureOverlay.lookingForDocument":"","id.idCaptureOverlay.holdStill":""};function nt(a){let e=URL.createObjectURL(new Blob(['"use strict";(()=>{var fe=(r,e)=>()=>(r&&(e=r(r=0)),e);var h,o=fe(()=>{h={"scandit-datacapture-sdk-id-pthreads.wasm":{bytes:8629501},"scandit-datacapture-sdk-id-simd-pthreads.wasm":{bytes:8565184},"scandit-datacapture-sdk-id.wasm":{bytes:8519496},"scandit-datacapture-sdk-id-simd.wasm":{bytes:8454877}}});o();o();o();o();function G(){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();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,...g){if(!(e.get(a)>e.get(p)))switch(p){case"debug":{console.debug(...g);break}case"info":{console.log(...g);break}case"warn":{console.warn(...g);break}case"error":{console.error(...g);break}}}r.log=s;function i(...p){s("warn",...p)}r.warn=i;function d(...p){s("debug",...p)}r.debug=d;function u(...p){s("info",...p)}r.info=u;function C(...p){s("error",...p)}r.error=C})(n||(n={}));o();o();var Ie=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 K(r){typeof r.FinalizationRegistry>"u"&&(r.FinalizationRegistry=Ie)}o();o();function be(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 Se(r){let e=/@scandit\\/web-datacapture-[a-z]+/i.exec(r);return e?e[0]:null}function q(r,e,a){let t=e,s=be(t);if(s.result){let d=Se(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();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 De(r){return[...new Uint8Array(r)].map(e=>{let a=e.toString(16);return a.length===1?`0${a}`:a}).join("")}async function*we(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 Me(r){let e=[],a=0,t=0;for await(let i of we(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 ve=(r=>(r.VALID="VALID",r.INVALID="INVALID",r.NOT_VERIFIABLE="NOT_VERIFIABLE",r))(ve||{});async function xe(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=De(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 Re(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 Le(r){var e,a;if(r==null)return 0;let t=(e=Re(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 ke(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 Ae=(r,e)=>{let a=Le(e);return a===0?ke(r):a};function Oe(r,e,a,{onProgress:t,onError:s,onComplete:i}){if(!e.body)return[e];let d=Ae(r,e.headers),u=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,g]=a?e.body.tee():[e.body],c=p.pipeThrough(new TransformStream({async transform(m,y){try{u+=m.length,C=Number((u/d*100).toFixed(2)),d>0&&m.length>0&&C<100?t==null||t({percentage:C,loadedBytes:u,privateUri:r}):d===0&&m.length>0&&(t==null||t({percentage:null,loadedBytes:u,privateUri:r})),y.enqueue(m)}catch(b){y.error(b),s==null||s({error:b})}},flush(m){t==null||t({percentage:100,loadedBytes:u,privateUri:r}),i==null||i({percentage:100,loadedBytes:u,privateUri:r}),m.terminate()}}));return[new Response(c,{headers:new Headers(e.headers),status:e.status,statusText:e.statusText}),g]}async function J({wasmURI:r,expectedHash:e,verifyResponseHash:a,onProgress:t,onComplete:s,onError:i,referredOrigin:d}){let u=await fetch(r,{referrerPolicy:"origin",referrer:d!=null?d:""});if(!u.ok)throw new Error(`HTTP status code is not ok: ${u.status}, ${u.statusText}`);let[C,p]=Oe(r,u,a,{onProgress:t,onError:i,onComplete:s});return p!=null&&xe(Me(p),e,r),C}function ae({wasmURI:r,expectedHash:e,verifyResponseHash:a,progressCallback:t,successCallback:s,errorCallback:i,importObject:d,referredOrigin:u}){async function C(g){try{let c=await J({wasmURI:r,expectedHash:e,verifyResponseHash:a,onProgress:t,referredOrigin:u}),m=await(g!=null?g: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 g;try{g=await J({wasmURI:r,expectedHash:e,verifyResponseHash:a,onProgress:t,referredOrigin:u});let c=await self.WebAssembly.instantiateStreaming(g,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((g==null?void 0:g.bodyUsed)===!0?void 0:g)}}typeof self.WebAssembly.instantiateStreaming=="function"?p():C()}async function _(r,e,a,t){return new Promise((s,i)=>{r().then(s).catch(d=>{let u=e*2;if(u>a){i(d);return}t(d),self.setTimeout(()=>{_(r,u,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();var E;(r=>{function e(){return"7.5.2"}r.sdkVersion=e})(E||(E={}));o();var se=class{constructor(){this.promise=new Promise((r,e)=>{this.reject=e,this.resolve=r})}};o();var Ee=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])),Pe=()=>(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 We(){return typeof crossOriginIsolated>"u"?!1:crossOriginIsolated}function Fe(){try{return new WebAssembly.Memory({initial:1,maximum:1,shared:!0}).buffer.constructor.name==="SharedArrayBuffer"}catch{return!1}}async function ie(){return Ee()}async function Ne(){if(!await Pe())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 ne(){let r=await Ne();return We()&&Fe()&&r}var oe=class de{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 u=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,u,e.delayedRegistration,e.highEndBlurryRecognition,this.resourcePath);let p=this.contextDeserializer.contextFromJson(JSON.stringify(e.context));if(p==null){let l=this.contextDeserializer.getLastError();throw new Error(`Could not create the context: ${l}`)}let g=p.getView();this.context=p.getContext(),p.delete();let c=this.Module.DataCaptureContextListener.extend("DataCaptureContextListener",{didChangeStatus:(l,I)=>{this.contextDidChangeStatus(JSON.parse(I.toJson())),l.delete()},didStartObservingContext:l=>{this.didStartObservingContext(),l.delete()},didStopObservingContext:l=>{l.delete()}}),m=this.Module.DataCaptureContextFrameListener.extend("DataCaptureContextFrameListener",{onObservationStarted:l=>{l.delete()},onObservationStopped:l=>{l.delete()},onFrameProcessingStarted:(l,I)=>{this.workerFunctions.postMessage({type:"onFrameProcessingStarted"}),I.delete(),l.delete()},onFrameProcessingFinished:(l,I)=>{this.workerFunctions.postMessage({type:"onFrameProcessingFinished"}),I.delete(),l.delete()},onFrameSkipped:(l,I)=>{this.workerFunctions.postMessage({type:"onFrameSkipped"}),I.delete(),l.delete()}}),y=this.Module.GestureRecognizer.extend("GestureRecognizer",{setGestureListener:(l,I)=>{var L;(L=this.gestureListener)==null||L.delete(),this.gestureListener=l.clone(),l.delete()}});(a=this.gestureRecognizer)==null||a.delete(),this.gestureRecognizer=new y;let b=new c;this.context.addListener(b),b.delete();let S=new m;this.context.addFrameListener(S),S.delete(),this.setView(g),(t=this.view)==null||t.setGestureRecognizer(this.gestureRecognizer);let w=this.Module.PlatformHintPresenter.extend("PlatformHintPresenter",{setHintPresenter:l=>{l.delete()},showToast:l=>{this.workerFunctions.postMessage({type:"showToast",payload:JSON.parse(l)})},hideToast:l=>{this.workerFunctions.postMessage({type:"hideToast",payload:JSON.parse(l)})},showGuidance:l=>{this.workerFunctions.postMessage({type:"showGuidance",payload:JSON.parse(l)})},hideGuidance:l=>{this.workerFunctions.postMessage({type:"hideGuidance",payload:JSON.parse(l)})},startUpdateTimer:l=>{this.workerFunctions.postMessage({type:"startUpdateTimer",payload:{duration:{unit:"ms",value:l}}})},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[de.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?"a492dbc88aa6f3356194fd03da76a4ec45a4ff803126bc3acf9bba35f5798a23":"e76c8ccaafd7605f67bb17b10a46d6a73f06d901683c409cb06558e2b25bdfb0":e?"ce0b4bb0eaf051b3edfe6d712da94d1fb38e8ca46a9e7bd874ec2b6aac543706":""}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 h}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 u of i){let C=new TextDecoder(u.ianaName,{fatal:!0});d.push(C.decode(t.slice(u.startIndex,u.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:u,fixedWasmMemory:C}){var p;let g=!1,c=!1;this.writableDataPath=this.getWritableDataPath(t),this.resourcePath=`${e}${this.resourceFilesSubfolder}/`,self.path=a;let{resolve:m,reject:y,promise:b}=new se,S=E.sdkVersion();if(S==="")throw new A({name:"Invalid library version",message:"Library version is not defined or empty, cannot generate proper path to library files."});let[w,l]=await Promise.all([ie(),ne()]);s!=="auto"&&(l=s==="on"),i!=="auto"&&(w=i==="on");let I=this.getWasmCoreFileName(w,l),L=q(S,e,I),{jsURI:N,wasmURI:j}=L,Ce={instantiateWasm:(D,he)=>(ae({importObject:D,wasmURI:j,expectedHash:this.getWasmCoreExpectedHash(w,l),verifyResponseHash:d,successCallback:he,progressCallback:this._loadProgressCallback,errorCallback:ge=>{y(ge)},referredOrigin:u}),{})},k=C===null?null:new WebAssembly.Memory({initial:this.numOfMBToPages(C),maximum:this.numOfMBToPages(300),shared:l});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,g,m)}],onMainComplete:()=>{if([g,c].includes(!1)){n.log(n.Level.Warn,{runtimeLoaded:g,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:()=>{g=!0,this.start(c,g,m)},print:D=>{n.log(n.Level.Info,D)}}),await re(N,S)||y(`Couldn\'t retrieve Scandit Data Capture library at ${N}, did you configure the path for it correctly?`),b}};oe.get3dPartyLicenseKeyMethodName=atob("Z2V0QmxpbmtJZExpY2Vuc2VLZXk=");var v=oe;o();o();function x(r){return typeof r=="object"&&r!=null}function R(r){if(typeof r=="string")return r;if(x(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 le(r){return typeof r=="object"&&r!=null&&r.document==null&&"addEventListener"in r&&typeof r.importScripts=="function"}o();function ue(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 v(e,{postMessage:this.postMessage.bind(this),getOffscreenCanvas:this.getOffscreenCanvas.bind(this)}),le(r)&&(K(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 x(r)&&"payload"in r}hasTransferables(r){return x(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 ue(r.data),!1}return!0}};G();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)}),u=new d;this.SDCIdCaptureMode=new this.Module.IdCapture(e,u,a,null),u.delete();let C=new t;this.SDCIdCaptureMode.addListener(C),C.delete();let p=new s,g=new i;this.SDCIdCaptureMode.setFeedbacks(p,g),p.delete(),g.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()}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}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,b,S,w,l,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),u=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:(b=t==null?void 0:t.getOrientation())!=null?b:0}},back:{face:null,croppedDocument:u,frame:{data:s?new Uint8ClampedArray(s.getFrameData()):null,width:(S=s==null?void 0:s.getWidth())!=null?S:0,height:(w=s==null?void 0:s.getHeight())!=null?w:0,mirrorAxis:(l=s==null?void 0:s.getMirrorAxis().value)!=null?l: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,u)=>{let C=new P(r,d,u);return a(C),d.delete(),u.delete(),C.getSDCIdCaptureMode()}}),s=new t,i=new e.IdCaptureDeserializer(s);return s.delete(),i}var W=class extends v{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()}idCaptureApplySettings(a){var t;(t=this.idCaptureMode)==null||t.applySettings(a)}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?"a492dbc88aa6f3356194fd03da76a4ec45a4ff803126bc3acf9bba35f5798a23":"e76c8ccaafd7605f67bb17b10a46d6a73f06d901683c409cb06558e2b25bdfb0":a?"ce0b4bb0eaf051b3edfe6d712da94d1fb38e8ca46a9e7bd874ec2b6aac543706":"03f18242cbf7ead6aa142b7718282793ce34dbdf79e3751a19dd1cf4f39fb0c0"}getWasmMetadata(){return h}};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(u){n.log(n.Level.Debug,u),i=void 0,s=R(u)}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"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}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=nt({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 pt=Symbol("Comlink.proxy"),Ht=Symbol("Comlink.endpoint"),mt=Symbol("Comlink.releaseProxy"),Fe=Symbol("Comlink.finalizer"),oe=Symbol("Comlink.thrown"),ht=a=>typeof a=="object"&&a!==null||typeof a=="function",Kt={canHandle:a=>ht(a)&&a[pt],serialize(a){let{port1:e,port2:t}=new MessageChannel;return ft(a,e),[t,[t]]},deserialize(a){return a.start(),yt(a)}},Gt={canHandle:a=>ht(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}},gt=new Map([["proxy",Kt],["throw",Gt]]);function Zt(a,e){for(let t of a)if(e===t||t==="*"||t instanceof RegExp&&t.test(e))return true;return false}function ft(a,e=globalThis,t=["*"]){e.addEventListener("message",function r(i){if(!i||!i.data)return;if(!Zt(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 g=u.slice(0,-1).reduce((f,O)=>f[O],a),h=u.reduce((f,O)=>f[O],a);switch(o){case "GET":m=h;break;case "SET":g[u.slice(-1)[0]]=P(i.data.value),m=true;break;case "APPLY":m=h.apply(g,c);break;case "CONSTRUCT":{let f=new h(...c);m=It(f);}break;case "ENDPOINT":{let{port1:f,port2:O}=new MessageChannel;ft(a,O),m=er(f,[f]);}break;case "RELEASE":m=void 0;break;default:return}}catch(g){m={value:g,[oe]:0};}Promise.resolve(m).catch(g=>({value:g,[oe]:0})).then(g=>{let[h,f]=de(g);e.postMessage(Object.assign(Object.assign({},h),{id:s}),f),o==="RELEASE"&&(e.removeEventListener("message",r),Ct(e),Fe in a&&typeof a[Fe]=="function"&&a[Fe]());}).catch(g=>{let[h,f]=de({value:new TypeError("Unserializable return value"),[oe]:0});e.postMessage(Object.assign(Object.assign({},h),{id:s}),f);});}),e.start&&e.start();}function Qt(a){return a.constructor.name==="MessagePort"}function Ct(a){Qt(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);}}),Je(a,t,[],e)}function se(a){if(a)throw new Error("Proxy has been released and is not useable")}function St(a){return j(a,new Map,{type:"RELEASE"}).then(()=>{Ct(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&&St(a);});function $t(a,e){let t=(ue.get(e)||0)+1;ue.set(e,t),le&&le.register(a,e,a);}function Yt(a){le&&le.unregister(a);}function Je(a,e,t=[],r=function(){}){let i=false,s=new Proxy(r,{get(o,u){if(se(i),u===mt)return ()=>{Yt(s),St(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 Je(a,e,[...t,u])},set(o,u,c){se(i);let[m,g]=de(c);return j(a,e,{type:"SET",path:[...t,u].map(h=>h.toString()),value:m},g).then(P)},apply(o,u,c){se(i);let m=t[t.length-1];if(m===Ht)return j(a,e,{type:"ENDPOINT"}).then(P);if(m==="bind")return Je(a,e,t.slice(0,-1));let[g,h]=ot(c);return j(a,e,{type:"APPLY",path:t.map(f=>f.toString()),argumentList:g},h).then(P)},construct(o,u){se(i);let[c,m]=ot(u);return j(a,e,{type:"CONSTRUCT",path:t.map(g=>g.toString()),argumentList:c},m).then(P)}});return $t(s,a),s}function Xt(a){return Array.prototype.concat.apply([],a)}function ot(a){let e=a.map(de);return [e.map(t=>t[0]),Xt(e.map(t=>t[1]))]}var bt=new WeakMap;function er(a,e){return bt.set(a,e),a}function It(a){return Object.assign(a,{[pt]:true})}function de(a){for(let[e,t]of gt)if(t.canHandle(a)){let[r,i]=t.serialize(a);return [{type:"HANDLER",name:e,value:r},i]}return [{type:"RAW",value:a},bt.get(a)||[]]}function P(a){switch(a.type){case "HANDLER":return gt.get(a.name).deserialize(a.value);case "RAW":return a.value}}function j(a,e,t,r){return new Promise(i=>{let s=tr();e.set(s,i),a.start&&a.start(),a.postMessage(Object.assign({id:s},t),r);})}function tr(){return new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-")}var ut="application/javascript",rr=(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:ut});u=URL.createObjectURL(c);}else u=`data:${ut},`+encodeURIComponent(o);i(u);}).catch(()=>{s(new Error(`Failed to fetch worker from ${a}`));}))},ar=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}}(),ir=nr(["",""],["",""]);function nr(a,e){return Object.freeze(Object.defineProperties(a,{raw:{value:Object.freeze(e)}}))}function sr(a,e){if(!(a instanceof e))throw new TypeError("Cannot call a class as a function")}var S=function(){function a(){for(var e=this,t=arguments.length,r=Array(t),i=0;i<t;i++)r[i]=arguments[i];return sr(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 ar(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(ir,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 or(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 N=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,or(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)}}},ur={separator:"",conjunction:"",serial:false},v=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:ur;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 g=r.lastIndexOf(o);r=r.slice(0,g)+(c?o:"")+" "+u+r.slice(g+1);}}return r}}},vt=function(e){return {onSubstitution:function(r,i){return typeof r=="string"&&r.includes(e)&&(r=r.split(e)),r}}},lt=function(e){return e!=null&&!Number.isNaN(e)&&typeof e!="boolean"},lr=function(){return {onSubstitution:function(t){return Array.isArray(t)?t.filter(lt):lt(t)?t:""}}};new S(v({separator:","}),N,b);new S(v({separator:",",conjunction:"and"}),N,b);new S(v({separator:",",conjunction:"or"}),N,b);new S(vt(`
2
2
  `),lr,v,N,b);new S(vt(`
3
3
  `),v,N,b,B(/&/g,"&amp;"),B(/</g,"&lt;"),B(/>/g,"&gt;"),B(/"/g,"&quot;"),B(/'/g,"&#x27;"),B(/`/g,"&#x60;"));new S(E(/(?:\n(?:\s*))+/g," "),b);var dr=new S(E(/(?:\n\s*)/g,""),b);new S(v({separator:","}),E(/(?:\s+)/g," "),b);new S(v({separator:",",conjunction:"or"}),E(/(?:\s+)/g," "),b);new S(v({separator:",",conjunction:"and"}),E(/(?:\s+)/g," "),b);new S(v,N,b);new S(v,E(/(?:\s+)/g," "),b);new S(N,b);new S(N("all"),b);var cr=a=>a.startsWith("data:"),pr=a=>a.startsWith("blob:"),mr=a=>!cr(a)&&!pr(a),hr=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(dr`${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}`)},gr=async(a=window.location.href)=>{let e=await rr(new URL("resources/centaurus-worker.js",a).toString());mr(e)&&await hr(e);let t=new Worker(e,{type:"module"});t.onerror=i=>{console.error("Worker error:",i),r[mt]();};let r=yt(t);return r},dt=(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),""),ct="centaurus-userid";function fr(){if(!Cr())return dt();let e=localStorage.getItem(ct);if(e)return e;let t=dt();return localStorage.setItem(ct,t),t}function Cr(){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 Dt(a,e){let t=await gr(a.resourcesLocation);a.userId||(a.userId=fr()),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?It(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 At=Symbol();globalThis.__CENTAURUS_CORE__||(globalThis.__CENTAURUS_CORE__=At);globalThis.__CENTAURUS_CORE__!==At&&console.warn("Detected multiple instances of Centaurus. This can lead to unexpected behavior.");var _e=new Map;_e.set([77,105,99,114,111,98,108,105,110,107],"Scandit");_e.set([66,108,105,110,107,73,68],"ID Capture");var We="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)",_e),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.5.0/",e.libraryLocation).toString(),r={licenseKey:e.licenseKey,initialMemory:500,resourcesLocation:t,useLightweightBuild:true,wasmVariant:await a.getWasmType()};a.wasmSDK=await Dt(r,({progress:i})=>{var s;(s=e.loadProgressNotifier)==null||s.call(e,{percentage:i,privateUri:new URL(`${We}.wasm`,e.libraryLocation).toString()});});}};var Ue=43,vr=100-Ue;function Dr(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=Ue*r.percentage/100:i.endsWith(`${We}.wasm`)&&(s.percentage=Ue+vr*r.percentage/100),a(s);}}var qt=Dr;var Ar=(t=>(t.FrontOnly="frontOnly",t.FrontAndBack="frontAndBack",t))(Ar||{}),qr=(r=>(r.Face="face",r.CroppedDocument="croppedDocument",r.Frame="frame",r))(qr||{}),Or=(t=>(t.Front="front",t.Back="back",t))(Or||{}),wr=(i=>(i.None="none",i.FieldsOnly="fieldsOnly",i.ImagesOnly="imagesOnly",i.FieldsAndImages="fieldsAndImages",i))(wr||{}),Nr=(t=>(t.Auto="auto",t.ButtonTap="buttonTap",t))(Nr||{}),kr=(t=>(t.Rounded="rounded",t.Square="square",t))(kr||{}),Tr=(t=>(t.Light="light",t.Bold="bold",t))(Tr||{}),xr=(r=>(r.NotAvailable="notAvailable",r.NotRealIdCompliant="notRealIdCompliant",r.RealIdCompliant="realIdCompliant",r))(xr||{}),Rr=(r=>(r.Female="female",r.Male="male",r.Unspecified="unspecified",r))(Rr||{});var Mr=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=Mr({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 k=(u=>(u.Passport="passport",u.IdCard="idCard",u.DriverLicense="driverLicense",u.VisaIcao="visaIcao",u.ResidencePermit="residencePermit",u.HealthInsuranceCard="healthInsuranceCard",u.RegionSpecific="regionSpecific",u))(k||{}),C=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 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,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 ye=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=>ye.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 Se=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 C{constructor(t){super(t);this.documentType="driverLicense";}get region(){return this._region}toJSONObject(){return {region:this.region,documentType:this.documentType}}};var W=class extends C{constructor(t){super(t);this.documentType="healthInsuranceCard";}get region(){return this._region}toJSONObject(){return {region:this.region,documentType:this.documentType}}};var U=class extends C{constructor(t){super(t);this.documentType="idCard";}get region(){return this._region}toJSONObject(){return {region:this.region,documentType:this.documentType}}};var V=class extends C{constructor(t){super(t);this.documentType="passport";}get region(){return this._region}toJSONObject(){return {region:this.region,documentType:this.documentType}}};var Br=(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))(Br||{});var H=class extends C{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 C{constructor(t){super(t);this.documentType="residencePermit";}get region(){return this._region}toJSONObject(){return {region:this.region,documentType:this.documentType}}};var G=class extends C{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=Se.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 Ve(a){return a.location!=null&&typeof a.location.x=="number"}function xt(a){return typeof a=="object"&&a!==null}function Ie(a){return xt(a)?Object.prototype.hasOwnProperty.call(a,"filledByDomainKnowledge")&&Object.prototype.hasOwnProperty.call(a,"originalString"):false}function He(a){return xt(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){let e=a;return {day:e.day,month:e.month,year:e.year}}return null}function Ke(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 Er={"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 Pt(a){var e;return a==null?null:(e=Er[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 Mt={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 Fr=(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))(Fr||{});var zr=["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)||zr.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]==="",g=u==null?void 0:u[c];m&&g!=null&&this.handleEmptyFrontValue(s,c,g);}}return s}handleEmptyFrontValue(e,t,r){if(Ie(r)){let i=te(r);i&&(e[t]=i);}else if(He(r)){let i=Q(r);i!=null&&i.value&&i.value.length>0&&(e[t]=i.value);}}async extractVizData(e,t){var w,Ze,Qe,$e,Ye,Xe,et;let r=t.subResults[0].viz;function i(tt){var rt,at;return tt==null?"":(at=(rt=Q(tt))==null?void 0:rt.value)!=null?at:""}function s(){return r.additionalNameInformation?i(r.additionalNameInformation):i(t.additionalNameInformation)}let o=i((w=t.driverLicenseDetailedInfo)==null?void 0:w.vehicleClass),u=i((Ze=t.driverLicenseDetailedInfo)==null?void 0:Ze.restrictions),c=i((Qe=t.driverLicenseDetailedInfo)==null?void 0:Qe.endorsements),m=this.workerCallProvider(),g=null;m&&(o.length>0||u.length>0||c.length>0)&&(g=await ve.create(m).createDrivingLicenseDetailsFromCentaurusData(o,u,c));let[h,f]=($e=_r(e.type,e.country))!=null?$e:[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:h,documentSubtype:f,issuingCountryIso:(Ye=e.isoAlpha3CountryCode)!=null?Ye:null,issuingCountry:(et=Mt[(Xe=e.isoAlpha3CountryCode)!=null?Xe:""])!=null?et: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:Pt(e.region),issuingJurisdictionIso:null,drivingLicenseDetails:g?g.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&&Ve(c)&&(r[u]=Ke(c.location));}else if(He(o)){let c=Q(o);c!=null&&Ve(c)&&(r[u]=Ke(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 _r(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 Wr(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 Ur(e);case "work-permit":return Vr(e);case "ikad":return ["regionSpecific","malaysiaIkad"];case "military-id":return ["regionSpecific","usCommonAccessCard"];case "mykas":return ["regionSpecific","malaysiaMykas"];case "social-security-card":return Hr(e);case "s-pass":return ["regionSpecific","singaporeSPass"];case "address-card":return ["regionSpecific","hungaryAddressCard"];case "green-card":return ["regionSpecific","usGreenCard"];case "minors-id":return Kr(e);case "postal-id":return ["regionSpecific","philippinesPostalId"];case "tax-id":return Gr(e);case "weapon-permit":return Zr(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":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 "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 Wr(a){switch(a){case "pakistan":return ["regionSpecific","pakistanConsularId"];case "guatemala":return ["regionSpecific","guatemalaConsularId"];case "mexico":return ["regionSpecific","mexicoConsularId"];default:return ["regionSpecific",null]}}function Ur(a){switch(a){case "ireland":return ["regionSpecific","irelandPublicServicesCard"];case "canada":return ["regionSpecific","canadaPublicServicesCard"];default:return ["regionSpecific",null]}}function Vr(a){switch(a){case "philippines":return ["regionSpecific","philippinesWorkPermit"];case "singapore":return ["regionSpecific","singaporeWorkPermit"];case "usa":return ["regionSpecific","usWorkPermit"];default:return ["regionSpecific",null]}}function Hr(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 Kr(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 Gr(a){switch(a){case "philippines":return ["regionSpecific","philippinesTaxId"];case "mexico":return ["regionSpecific","mexicoTaxId"];default:return ["regionSpecific",null]}}function Zr(a){switch(a){case "usa":return ["regionSpecific","usWeaponPermit"];case "canada":return ["regionSpecific","canadaWeaponPermit"];default:return ["regionSpecific",null]}}var D=class{static isSingleSideScanner(e){return !e._isFull}static isFullDocumentScanner(e){return e._isFull}};var x=class{constructor(e,t){this.isDeleted=false;this.centaurusWasmSDK=e,this.idCaptureSettings=t;}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;let t={inputImageSource:"photo",scanningMode:D.isSingleSideScanner(this.idCaptureSettings.scannerType)?"single":"automatic",scanningSettings:{anonymizationMode:this.getAnonymizationMode(),scanCroppedDocumentImage:(i=e==null?void 0:e.scanCroppedDocumentImage)!=null?i:false,skipImagesOccludedByHand:true,scanUnsupportedBack:true,recognitionModeFilter:{enableBarcodeId:false,enableFullDocumentRecognition:!(e!=null&&e.detectionOnlyMode),enableMrzId:false,enableMrzPassport:false,enableMrzVisa:false,enablePhotoId:false},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(s=>String.fromCodePoint(s)).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 x{constructor(){super(...arguments);this._type="scanCroppedDocument";}static async create(t,r,i){let s=new a(t,r);return s.session=await s.createSession({scanCroppedDocumentImage:true}),s.resultProcessor=i,s}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 x{constructor(){super(...arguments);this._type="default";}static async create(t,r){let i=new a(t,r);return i.session=await i.createSession(),i}};var Oe=class a extends x{constructor(){super(...arguments);this._type="localizeOnly";}static async create(t,r){let i=new a(t,r);return i.session=await i.createSession(),i}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 we=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){this.idCaptureSettings=e.clone(),this.resultProcessor=new De(this._workerCallProvider),await this.createAllSessions(),this._lastResult=null,this._lastError=null,this._lastLocalization=null;}isReadyToProcessFrame(){return this.isProcessing===false}async processFrame(e,t){var h;this.isProcessing=true,this.engagedSession=this.autoSelectSession((h=t.scanCroppedDocumentImage)!=null?h:false);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),g=this.toDetectionIssue(r.documentDetectionStatus);return u&&c&&(u.vizResult.location=c.toJSONObject()),this.isProcessing=false,{arrayBuffer:s,capturedId:u,localizedOnlyId:m,detectionIssue:g}}async reset(){for(let e of [this.defaultSession,this.scanCroppedDocumentSession,this.localizeOnlySession])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])await(e==null?void 0:e.delete());}async createAllSessions(){this.defaultSession=await qe.create(this.centaurusWasmSDK,this.idCaptureSettings),this.scanCroppedDocumentSession=await Ae.create(this.centaurusWasmSDK,this.idCaptureSettings,this.resultProcessor),this.localizeOnlySession=await Oe.create(this.centaurusWasmSDK,this.idCaptureSettings);}autoSelectSession(e){return this._hasDefaultSessionFullResult||this._isDetectionOnlyMode?this.localizeOnlySession:e?this.scanCroppedDocumentSession: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 Qr=(h=>(h.NotAcceptedDocumentType="notAcceptedDocumentType",h.InvalidFormat="invalidFormat",h.DocumentVoided="documentVoided",h.Timeout="timeout",h.SingleImageNotRecognized="singleImageNotRecognized",h.DocumentExpired="documentExpired",h.DocumentExpiresSoon="documentExpiresSoon",h.NotRealIdCompliant="notRealIdCompliant",h.HolderUnderage="holderUnderage",h.ForgedAamvaBarcode="forgedAamvaBarcode",h.InconsistentData="inconsistentData",h))(Qr||{});var Ne="reloadDetector",Te=class Te{constructor(e,t=Te.DEFAULT_WRITE_INTERVAL_MS){this._lastWrite=0;this._storage=e,this._writeIntervalMs=t;}hasDataAlreadyWritten(){return this._storage.getItem(Ne)!==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(Ne))!=null?t:"{}";return JSON.parse(e)}clear(){this._storage.removeItem(Ne),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(Ne,JSON.stringify(this._pendingData)),this._pendingData=void 0,this._lastWrite=performance.now()):this._writeTimer=setTimeout(this.scheduleWrite.bind(this),this._writeIntervalMs-e);}};Te.DEFAULT_WRITE_INTERVAL_MS=500;var ke=Te;var re=class{constructor(e){this.onUnload=()=>{this._storage.clear();};this._onPageAbruptlyReloaded=e,this._storage=new ke(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 Re=class Re{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),Re.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));}};Re.UP_TIME_UPDATE_INTERVAL_MS=500;var xe=Re;var y={Available:"Available",ProcessingFrame:"ProcessingFrame",ProcessingQueue:"ProcessingQueue"},Bt=class a{constructor(){this.type="idCapture";this._synchronousFrameFlow=true;this.state=y.Available;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);O.wasmSDK!=null&&(this._centaurusConnector=new we(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;if(r.settings=t,r._centaurusConnector)try{await r._centaurusConnector.init(r.settings);}catch(i){throw i instanceof DataCaptureError&&i.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."),i}else r.checkCaptureSettingsAgainstSDKConfiguration(t);return e&&await e.addMode(r),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===y.Available&&this.moveToState(y.ProcessingQueue));}async reset(){this.enqueueTask(async()=>this.doReset()),this.state===y.Available&&this.moveToState(y.ProcessingQueue);}async applySettings(e){this.enqueueTask(async()=>this.doApplySettings(e.clone())),this.state===y.Available&&this.moveToState(y.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 q.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}toJSONObject(){var e;return {enabled:this._isEnabled,type:this.type,settings:{...this.settings.toJSONObject(),licensee:"",licenseKey:(e=O.licenseKey)!=null?e:""}}}async onSDCResetDone(){var e;return (e=this._centaurusConnector)==null?void 0:e.reset()}didChangeFrameSource(){this.moveToState(y.ProcessingQueue);}moveToState(e){this.state=e,e===y.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!==y.Available)return {action:"skip",frame:e};(r=this.privateContext)==null||r.performanceMark("processFrameBeforeCentaurus"),this.moveToState(y.ProcessingFrame);let t=await this.doProcessFrame(e);return (i=this.privateContext)==null||i.performanceMark("processFrameAfterCentaurus"),{action:"continue",frame:t}}async doProcessFrame(e){var o;if(!this._isEnabled||!this.shouldEnableVIZScanner(this.settings))return e;let t=(o=this.context)==null?void 0:o.frameSource,i=(t==null?void 0:t.type)==="singleImageUploader";return await this.processFrameWithCentaurus(e,{scanCroppedDocumentImage:i})}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(y.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(y.Available);return}for(;this._endOfCycleTasks.length>0;){let e=this._endOfCycleTasks.shift();await(e==null?void 0:e());}this.moveToState(y.Available);}shouldEnableVIZScanner(e){let{scannerType:t}=e;return D.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 xe(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===y.Available&&this.moveToState(y.ProcessingQueue);break}case "onFrameProcessingStarted":break;case "onFrameProcessingFinished":{this.onAfterProcessFrame();break}case "onFrameSkipped":{this.onAfterProcessFrame();break}}}async processFrameWithCentaurus(e,t){var r;if(!this._centaurusConnector.isReadyToProcessFrame())return e;try{let{arrayBuffer:i,capturedId:s,detectionIssue:o,localizedOnlyId:u}=await this._centaurusConnector.processFrame(e,{scanCroppedDocumentImage:(r=t==null?void 0:t.scanCroppedDocumentImage)!=null?r:false});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 q?(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(q.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,q.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}`)},gr=async(a=window.location.href)=>{let e=await rr(new URL("resources/centaurus-worker.js",a).toString());mr(e)&&await hr(e);let t=new Worker(e,{type:"module"});t.onerror=i=>{console.error("Worker error:",i),r[mt]();};let r=yt(t);return r},dt=(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),""),ct="centaurus-userid";function fr(){if(!Cr())return dt();let e=localStorage.getItem(ct);if(e)return e;let t=dt();return localStorage.setItem(ct,t),t}function Cr(){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 Dt(a,e){let t=await gr(a.resourcesLocation);a.userId||(a.userId=fr()),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?It(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 At=Symbol();globalThis.__CENTAURUS_CORE__||(globalThis.__CENTAURUS_CORE__=At);globalThis.__CENTAURUS_CORE__!==At&&console.warn("Detected multiple instances of Centaurus. This can lead to unexpected behavior.");var _e=new Map;_e.set([77,105,99,114,111,98,108,105,110,107],"Scandit");_e.set([66,108,105,110,107,73,68],"ID Capture");var We="Centaurus",w=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)",_e),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.5.2/",e.libraryLocation).toString(),r={licenseKey:e.licenseKey,initialMemory:500,resourcesLocation:t,useLightweightBuild:true,wasmVariant:await a.getWasmType()};a.wasmSDK=await Dt(r,({progress:i})=>{var s;(s=e.loadProgressNotifier)==null||s.call(e,{percentage:i,privateUri:new URL(`${We}.wasm`,e.libraryLocation).toString()});});}};var Ve=43,vr=100-Ve;function Dr(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(`${We}.wasm`)&&(s.percentage=Ve+vr*r.percentage/100),a(s);}}var qt=Dr;var Ar=(t=>(t.FrontOnly="frontOnly",t.FrontAndBack="frontAndBack",t))(Ar||{}),qr=(r=>(r.Face="face",r.CroppedDocument="croppedDocument",r.Frame="frame",r))(qr||{}),wr=(t=>(t.Front="front",t.Back="back",t))(wr||{}),Or=(i=>(i.None="none",i.FieldsOnly="fieldsOnly",i.ImagesOnly="imagesOnly",i.FieldsAndImages="fieldsAndImages",i))(Or||{}),Nr=(t=>(t.Auto="auto",t.ButtonTap="buttonTap",t))(Nr||{}),kr=(t=>(t.Rounded="rounded",t.Square="square",t))(kr||{}),Tr=(t=>(t.Light="light",t.Bold="bold",t))(Tr||{}),xr=(r=>(r.NotAvailable="notAvailable",r.NotRealIdCompliant="notRealIdCompliant",r.RealIdCompliant="realIdCompliant",r))(xr||{}),Rr=(r=>(r.Female="female",r.Male="male",r.Unspecified="unspecified",r))(Rr||{});var Mr=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=Mr({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 wt="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(wt)}toJSONObject(){return {idCaptured:this.idCaptured.toJSONObject(),idRejected:this.idRejected.toJSONObject()}}};var k=(u=>(u.Passport="passport",u.IdCard="idCard",u.DriverLicense="driverLicense",u.VisaIcao="visaIcao",u.ResidencePermit="residencePermit",u.HealthInsuranceCard="healthInsuranceCard",u.RegionSpecific="regionSpecific",u))(k||{}),C=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 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,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 ye=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=>ye.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 Se=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 C{constructor(t){super(t);this.documentType="driverLicense";}get region(){return this._region}toJSONObject(){return {region:this.region,documentType:this.documentType}}};var W=class extends C{constructor(t){super(t);this.documentType="healthInsuranceCard";}get region(){return this._region}toJSONObject(){return {region:this.region,documentType:this.documentType}}};var V=class extends C{constructor(t){super(t);this.documentType="idCard";}get region(){return this._region}toJSONObject(){return {region:this.region,documentType:this.documentType}}};var U=class extends C{constructor(t){super(t);this.documentType="passport";}get region(){return this._region}toJSONObject(){return {region:this.region,documentType:this.documentType}}};var Br=(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))(Br||{});var H=class extends C{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 C{constructor(t){super(t);this.documentType="residencePermit";}get region(){return this._region}toJSONObject(){return {region:this.region,documentType:this.documentType}}};var G=class extends C{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 U(r);case "idCard":return new V(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=Se.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 Ue(a){return a.location!=null&&typeof a.location.x=="number"}function xt(a){return typeof a=="object"&&a!==null}function Ie(a){return xt(a)?Object.prototype.hasOwnProperty.call(a,"filledByDomainKnowledge")&&Object.prototype.hasOwnProperty.call(a,"originalString"):false}function He(a){return xt(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){let e=a;return {day:e.day,month:e.month,year:e.year}}return null}function Ke(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 Er={"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 Pt(a){var e;return a==null?null:(e=Er[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 Mt={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 Fr=(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))(Fr||{});var zr=["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)||zr.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]==="",g=u==null?void 0:u[c];m&&g!=null&&this.handleEmptyFrontValue(s,c,g);}}return s}handleEmptyFrontValue(e,t,r){if(Ie(r)){let i=te(r);i&&(e[t]=i);}else if(He(r)){let i=Q(r);i!=null&&i.value&&i.value.length>0&&(e[t]=i.value);}}async extractVizData(e,t){var O,Ze,Qe,$e,Ye,Xe,et;let r=t.subResults[0].viz;function i(tt){var rt,at;return tt==null?"":(at=(rt=Q(tt))==null?void 0:rt.value)!=null?at:""}function s(){return r.additionalNameInformation?i(r.additionalNameInformation):i(t.additionalNameInformation)}let o=i((O=t.driverLicenseDetailedInfo)==null?void 0:O.vehicleClass),u=i((Ze=t.driverLicenseDetailedInfo)==null?void 0:Ze.restrictions),c=i((Qe=t.driverLicenseDetailedInfo)==null?void 0:Qe.endorsements),m=this.workerCallProvider(),g=null;m&&(o.length>0||u.length>0||c.length>0)&&(g=await ve.create(m).createDrivingLicenseDetailsFromCentaurusData(o,u,c));let[h,f]=($e=_r(e.type,e.country))!=null?$e:[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:h,documentSubtype:f,issuingCountryIso:(Ye=e.isoAlpha3CountryCode)!=null?Ye:null,issuingCountry:(et=Mt[(Xe=e.isoAlpha3CountryCode)!=null?Xe:""])!=null?et: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:Pt(e.region),issuingJurisdictionIso:null,drivingLicenseDetails:g?g.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&&Ue(c)&&(r[u]=Ke(c.location));}else if(He(o)){let c=Q(o);c!=null&&Ue(c)&&(r[u]=Ke(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 _r(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 Wr(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 Vr(e);case "work-permit":return Ur(e);case "ikad":return ["regionSpecific","malaysiaIkad"];case "military-id":return ["regionSpecific","usCommonAccessCard"];case "mykas":return ["regionSpecific","malaysiaMykas"];case "social-security-card":return Hr(e);case "s-pass":return ["regionSpecific","singaporeSPass"];case "address-card":return ["regionSpecific","hungaryAddressCard"];case "green-card":return ["regionSpecific","usGreenCard"];case "minors-id":return Kr(e);case "postal-id":return ["regionSpecific","philippinesPostalId"];case "tax-id":return Gr(e);case "weapon-permit":return Zr(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":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 "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 Wr(a){switch(a){case "pakistan":return ["regionSpecific","pakistanConsularId"];case "guatemala":return ["regionSpecific","guatemalaConsularId"];case "mexico":return ["regionSpecific","mexicoConsularId"];default:return ["regionSpecific",null]}}function Vr(a){switch(a){case "ireland":return ["regionSpecific","irelandPublicServicesCard"];case "canada":return ["regionSpecific","canadaPublicServicesCard"];default:return ["regionSpecific",null]}}function Ur(a){switch(a){case "philippines":return ["regionSpecific","philippinesWorkPermit"];case "singapore":return ["regionSpecific","singaporeWorkPermit"];case "usa":return ["regionSpecific","usWorkPermit"];default:return ["regionSpecific",null]}}function Hr(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 Kr(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 Gr(a){switch(a){case "philippines":return ["regionSpecific","philippinesTaxId"];case "mexico":return ["regionSpecific","mexicoTaxId"];default:return ["regionSpecific",null]}}function Zr(a){switch(a){case "usa":return ["regionSpecific","usWeaponPermit"];case "canada":return ["regionSpecific","canadaWeaponPermit"];default:return ["regionSpecific",null]}}var D=class{static isSingleSideScanner(e){return !e._isFull}static isFullDocumentScanner(e){return e._isFull}};var x=class{constructor(e,t){this.isDeleted=false;this.centaurusWasmSDK=e,this.idCaptureSettings=t;}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;let t={inputImageSource:"photo",scanningMode:D.isSingleSideScanner(this.idCaptureSettings.scannerType)?"single":"automatic",scanningSettings:{anonymizationMode:this.getAnonymizationMode(),scanCroppedDocumentImage:(i=e==null?void 0:e.scanCroppedDocumentImage)!=null?i:false,skipImagesOccludedByHand:true,scanUnsupportedBack:true,recognitionModeFilter:{enableBarcodeId:false,enableFullDocumentRecognition:!(e!=null&&e.detectionOnlyMode),enableMrzId:false,enableMrzPassport:false,enableMrzVisa:false,enablePhotoId:false},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(s=>String.fromCodePoint(s)).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 x{constructor(){super(...arguments);this._type="scanCroppedDocument";}static async create(t,r,i){let s=new a(t,r);return s.session=await s.createSession({scanCroppedDocumentImage:true}),s.resultProcessor=i,s}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 x{constructor(){super(...arguments);this._type="default";}static async create(t,r){let i=new a(t,r);return i.session=await i.createSession(),i}};var we=class a extends x{constructor(){super(...arguments);this._type="localizeOnly";}static async create(t,r){let i=new a(t,r);return i.session=await i.createSession(),i}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{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){this.idCaptureSettings=e.clone(),this.resultProcessor=new De(this._workerCallProvider),await this.createAllSessions(),this._lastResult=null,this._lastError=null,this._lastLocalization=null;}isReadyToProcessFrame(){return this.isProcessing===false}async processFrame(e,t){var h;this.isProcessing=true,this.engagedSession=this.autoSelectSession((h=t.scanCroppedDocumentImage)!=null?h:false);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),g=this.toDetectionIssue(r.documentDetectionStatus);return u&&c&&(u.vizResult.location=c.toJSONObject()),this.isProcessing=false,{arrayBuffer:s,capturedId:u,localizedOnlyId:m,detectionIssue:g}}async reset(){for(let e of [this.defaultSession,this.scanCroppedDocumentSession,this.localizeOnlySession])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])await(e==null?void 0:e.delete());}async createAllSessions(){this.defaultSession=await qe.create(this.centaurusWasmSDK,this.idCaptureSettings),this.scanCroppedDocumentSession=await Ae.create(this.centaurusWasmSDK,this.idCaptureSettings,this.resultProcessor),this.localizeOnlySession=await we.create(this.centaurusWasmSDK,this.idCaptureSettings);}autoSelectSession(e){return this._hasDefaultSessionFullResult||this._isDetectionOnlyMode?this.localizeOnlySession:e?this.scanCroppedDocumentSession: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 Qr=(h=>(h.NotAcceptedDocumentType="notAcceptedDocumentType",h.InvalidFormat="invalidFormat",h.DocumentVoided="documentVoided",h.Timeout="timeout",h.SingleImageNotRecognized="singleImageNotRecognized",h.DocumentExpired="documentExpired",h.DocumentExpiresSoon="documentExpiresSoon",h.NotRealIdCompliant="notRealIdCompliant",h.HolderUnderage="holderUnderage",h.ForgedAamvaBarcode="forgedAamvaBarcode",h.InconsistentData="inconsistentData",h))(Qr||{});var Ne="reloadDetector",Te=class Te{constructor(e,t=Te.DEFAULT_WRITE_INTERVAL_MS){this._lastWrite=0;this._storage=e,this._writeIntervalMs=t;}hasDataAlreadyWritten(){return this._storage.getItem(Ne)!==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(Ne))!=null?t:"{}";return JSON.parse(e)}clear(){this._storage.removeItem(Ne),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(Ne,JSON.stringify(this._pendingData)),this._pendingData=void 0,this._lastWrite=performance.now()):this._writeTimer=setTimeout(this.scheduleWrite.bind(this),this._writeIntervalMs-e);}};Te.DEFAULT_WRITE_INTERVAL_MS=500;var ke=Te;var re=class{constructor(e){this.onUnload=()=>{this._storage.clear();};this._onPageAbruptlyReloaded=e,this._storage=new ke(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 Re=class Re{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),Re.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));}};Re.UP_TIME_UPDATE_INTERVAL_MS=500;var xe=Re;var y={Available:"Available",ProcessingFrame:"ProcessingFrame",ProcessingQueue:"ProcessingQueue"},Bt=class a{constructor(){this.type="idCapture";this._synchronousFrameFlow=true;this.state=y.Available;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);w.wasmSDK!=null&&(this._centaurusConnector=new Oe(w.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;if(r.settings=t,r._centaurusConnector)try{await r._centaurusConnector.init(r.settings);}catch(i){throw i instanceof DataCaptureError&&i.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."),i}else r.checkCaptureSettingsAgainstSDKConfiguration(t);return e&&await e.addMode(r),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===y.Available&&this.moveToState(y.ProcessingQueue));}async reset(){this.enqueueTask(async()=>this.doReset()),this.state===y.Available&&this.moveToState(y.ProcessingQueue);}async applySettings(e){this.enqueueTask(async()=>this.doApplySettings(e.clone())),this.state===y.Available&&this.moveToState(y.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 q.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}toJSONObject(){var e;return {enabled:this._isEnabled,type:this.type,settings:{...this.settings.toJSONObject(),licensee:"",licenseKey:(e=w.licenseKey)!=null?e:""}}}async onSDCResetDone(){var e;return (e=this._centaurusConnector)==null?void 0:e.reset()}didChangeFrameSource(){this.moveToState(y.ProcessingQueue);}moveToState(e){this.state=e,e===y.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!==y.Available)return {action:"skip",frame:e};(r=this.privateContext)==null||r.performanceMark("processFrameBeforeCentaurus"),this.moveToState(y.ProcessingFrame);let t=await this.doProcessFrame(e);return (i=this.privateContext)==null||i.performanceMark("processFrameAfterCentaurus"),{action:"continue",frame:t}}async doProcessFrame(e){var o;if(!this._isEnabled||!this.shouldEnableVIZScanner(this.settings))return e;let t=(o=this.context)==null?void 0:o.frameSource,i=(t==null?void 0:t.type)==="singleImageUploader";return await this.processFrameWithCentaurus(e,{scanCroppedDocumentImage:i})}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(y.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(y.Available);return}for(;this._endOfCycleTasks.length>0;){let e=this._endOfCycleTasks.shift();await(e==null?void 0:e());}this.moveToState(y.Available);}shouldEnableVIZScanner(e){let{scannerType:t}=e;return D.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 xe(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===y.Available&&this.moveToState(y.ProcessingQueue);break}case "onFrameProcessingStarted":break;case "onFrameProcessingFinished":{this.onAfterProcessFrame();break}case "onFrameSkipped":{this.onAfterProcessFrame();break}}}async processFrameWithCentaurus(e,t){var r;if(!this._centaurusConnector.isReadyToProcessFrame())return e;try{let{arrayBuffer:i,capturedId:s,detectionIssue:o,localizedOnlyId:u}=await this._centaurusConnector.processFrame(e,{scanCroppedDocumentImage:(r=t==null?void 0:t.scanCroppedDocumentImage)!=null?r:false});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 q?(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(q.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,q.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
- 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 Me={standby:"standby",active:"active",scanning:"scanning"},Pe=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 Et=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,Pe),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(Me.standby);break}case "untappedLocalized":{(r=this.shutterWidget)==null||r.updateState(Me.active);break}case "tapped":{(i=this.shutterWidget)==null||i.updateState(Me.scanning);break}}}};var Le=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 Be=class extends D{constructor(){super();this._isFull=true;}toJSONObject(){return {isFull:this._isFull,options:{barcode:true,machineReadableZone:true,visualInspectionZone:true}}}};var ae=class extends D{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 Ft=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 Be: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 Le(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 je=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 zt=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),je.fromJSON(t.result)}};var _t=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({...it});let e=typeof(a==null?void 0:a.enableVIZDocuments)=="boolean"?a.enableVIZDocuments:false;return {moduleName:"IdCapture",load:async t=>{if(t.loadProgressNotifier=e?qt(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."),q.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 po(a){Y=a;}export{je as AamvaBarcodeVerificationResult,zt as AamvaBarcodeVerifier,ge as BarcodeResult,ee as CapturedId,Ar as CapturedSides,z as DataConsistencyResult,_t as DataConsistencyVerifier,p as DateResult,_ as DriverLicense,ye as DrivingLicenseCategory,J as DrivingLicenseDetails,Le as Duration,Be as FullDocumentScanner,W as HealthInsuranceCard,wr as IdAnonymizationMode,Bt as IdCapture,C as IdCaptureDocument,k as IdCaptureDocumentType,q as IdCaptureError,Ee as IdCaptureErrorCode,ce as IdCaptureFeedback,Et as IdCaptureOverlay,D as IdCaptureScanner,Ft as IdCaptureSettings,Nr as IdCaptureTrigger,U as IdCard,qr as IdImageType,Tr as IdLayoutLineStyle,kr as IdLayoutStyle,Or as IdSide,Z as LocalizedOnlyId,Ce as MRZResult,V as Passport,me as ProfessionalDrivingPermit,Br as Region,H as RegionSpecific,Fr as RegionSpecificSubtype,Qr as RejectionReason,K as ResidencePermit,y as STATE,Rr as Sex,ae as SingleSideScanner,xr as UsRealIdStatus,Se as VIZResult,he as VehicleRestriction,G as VisaIcao,co as idCaptureLoader,Y as mainDataCaptureLoader,po as setMainDataCaptureLoader};
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:w.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 Me={standby:"standby",active:"active",scanning:"scanning"},Pe=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 Et=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,Pe),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(Me.standby);break}case "untappedLocalized":{(r=this.shutterWidget)==null||r.updateState(Me.active);break}case "tapped":{(i=this.shutterWidget)==null||i.updateState(Me.scanning);break}}}};var Le=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 Be=class extends D{constructor(){super();this._isFull=true;}toJSONObject(){return {isFull:this._isFull,options:{barcode:true,machineReadableZone:true,visualInspectionZone:true}}}};var ae=class extends D{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 Ft=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 Be: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 Le(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 V(r);case "passport":return new U(r);case "residencePermit":return new K(r);case "visaIcao":return new G(r);case "regionSpecific":{let i=e;return new H(i.documentSubtype)}}}};var je=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 zt=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),je.fromJSON(t.result)}};var _t=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({...it});let e=typeof(a==null?void 0:a.enableVIZDocuments)=="boolean"?a.enableVIZDocuments:false;return {moduleName:"IdCapture",load:async t=>{if(t.loadProgressNotifier=e?qt(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."),q.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 w.load({libraryLocation:`${t.libraryLocation}idcapture/`,licenseKey:s,logLevel:t.logLevel,loadProgressNotifier:t.loadProgressNotifier}),Y}}}function po(a){Y=a;}export{je as AamvaBarcodeVerificationResult,zt as AamvaBarcodeVerifier,ge as BarcodeResult,ee as CapturedId,Ar as CapturedSides,z as DataConsistencyResult,_t as DataConsistencyVerifier,p as DateResult,_ as DriverLicense,ye as DrivingLicenseCategory,J as DrivingLicenseDetails,Le as Duration,Be as FullDocumentScanner,W as HealthInsuranceCard,Or as IdAnonymizationMode,Bt as IdCapture,C as IdCaptureDocument,k as IdCaptureDocumentType,q as IdCaptureError,Ee as IdCaptureErrorCode,ce as IdCaptureFeedback,Et as IdCaptureOverlay,D as IdCaptureScanner,Ft as IdCaptureSettings,Nr as IdCaptureTrigger,V as IdCard,qr as IdImageType,Tr as IdLayoutLineStyle,kr as IdLayoutStyle,wr as IdSide,Z as LocalizedOnlyId,Ce as MRZResult,U as Passport,me as ProfessionalDrivingPermit,Br as Region,H as RegionSpecific,Fr as RegionSpecificSubtype,Qr as RejectionReason,K as ResidencePermit,y as STATE,Rr as Sex,ae as SingleSideScanner,xr as UsRealIdStatus,Se as VIZResult,he as VehicleRestriction,G as VisaIcao,co as idCaptureLoader,Y as mainDataCaptureLoader,po as setMainDataCaptureLoader};