/**
 * Skipped minification because the original files appears to be already minified.
 * Original file: /npm/@scandit/web-datacapture-id@8.5.2/build/js/index.js
 *
 * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
 */
import{AdditionalLayerPosition as e,BrowserHelper as t,Brush as n,CameraSettings as r,Color as i,DataCaptureContext as a,DataCaptureError as o,DataCaptureLoader as s,Feedback as c,FocusGestureStrategy as l,INTERNAL_ACCESS as u,Localization as d,Logger as f,Point as p,Quadrilateral as m,Sound as h,VideoResolution as ee,assertUnreachable as te}from"@scandit/web-datacapture-core";import{SafeStorage as ne}from"@scandit/web-datacapture-core/build/js/private/utils/safeStorage.js";import{ScanditHTMLElement as re,css as ie,defineCustomElements as ae,html as oe}from"@scandit/web-datacapture-core/build/js/private/utils/index.js";let se=function(e){return e.Undefined=`Undefined`,e.RecoveredAfterFailure=`RecoveredAfterFailure`,e.InvalidLicenseKeyForVIZProcessing=`InvalidLicenseKeyForVIZProcessing`,e.InvalidSettingsForVIZProcessing=`InvalidSettingsForVIZProcessing`,e.InvalidLicenseKeyForParser=`InvalidLicenseKeyForParser`,e}({});var g=class e extends Error{constructor(...e){super(...e),this._type=`Undefined`,this._message=``}get type(){return this._type}get message(){return this._message}static create(t){let n=new e;return t&&(n.name=t.type,n._type=t.type,n._message=t.message),n}static fromJSON(t){let n=new e;return n._type=t.type,n._message=t.message,n}},ce=class{constructor(e){this.idCaptureWorkerManager=e}get workerCommand(){return this.idCaptureWorkerManager.workerCommand.bind(this.idCaptureWorkerManager)}async getLicenseText(){return(await this.workerCommand(`getIdOpenSourceSoftwareLicenseInfo`,{})).licenseText}};const le={"id.idCaptureOverlay.scanFrontSideHint":``,"id.idCaptureOverlay.scanBackSideHint":``,"id.idCaptureOverlay.moveCloseTextHint":``,"id.idCaptureOverlay.moveFurtherAwayTextHint":``,"id.idCaptureOverlay.tapShutterToScan":``,"id.idCaptureOverlay.lookingForDocument":``,"id.idCaptureOverlay.holdStill":``,"id.idCaptureOverlay.processingDocument":`Processing...`};var ue=`id-worker-8.5.2.js`;function de(e){try{var t=e.endsWith(`/`)?e:e+`/`;return new URL(ue,t).href}catch(t){var n=t instanceof Error?t.message:String(t);throw Error(`Invalid worker URL: `+e+`/`+ue+` (`+n+`)`)}}function fe(e){try{return new URL(e).origin===location.origin}catch(n){var t=n instanceof Error?n.message:String(n);return console.warn(`Could not determine origin for worker URL "`+e+`": `+t+`. Defaulting to cross-origin path.`),!1}}function pe(e,t){/javascript|ecmascript/i.test(e.type)||(e=new Blob([e],{type:`application/javascript`}));var n=URL.createObjectURL(e),r=new Worker(n,{name:t});return setTimeout(function(){URL.revokeObjectURL(n)},0),r}async function me(e){if(!e||!e.libraryLocation)throw Error(`ExternalWorker requires options.libraryLocation`);var t=de(e.libraryLocation);try{var n=await fetch(t,fe(t)?{}:{mode:`cors`});if(!n.ok)throw Error(`Failed to load worker script: `+t+` (status `+n.status+`)`);var r=await n.blob();return fe(t)?new Worker(t,{name:e.name}):pe(r,e.name)}catch(e){throw e instanceof Error&&e.message.startsWith(`Failed to load worker script:`)?e:Error(`Failed to load worker script: `+t+` (`+(e instanceof Error?e.message:e)+`)`)}}var he=class e extends s{constructor(...e){super(...e),this._name=`IdCapture`}get dataCaptureWorker(){if(!this._dataCaptureWorker)throw Error(`Worker not initialized. Use IdCaptureWorkerManager.create() to instantiate.`);return this._dataCaptureWorker}get name(){return this._name}get fixedWasmMemory(){return t.isIPhone()&&t.isSafari()?300:null}async createDataCaptureWorker(){return await me({name:this.name,libraryLocation:this.libraryLocation})}static async create(t){let n=new e(t);return n._dataCaptureWorker=await n.createDataCaptureWorker(),n.addWorkerMessageListener(),n.workerCommand(`setLogLevel`,{level:n.logLevel}),await n.load(),n}async workerCommand(...e){let[t,n,r]=e;return new Promise((e,i)=>{let a=this.workerCommandId++;this.workerTasks.set(a,{resolve:e,reject:i,command:t});let o={...n,command:t,id:a};this.dataCaptureWorker.postMessage(o,r)})}};
/**
* @license
* Copyright 2019 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
const ge=Symbol(`Comlink.proxy`),_e=Symbol(`Comlink.endpoint`),ve=Symbol(`Comlink.releaseProxy`),ye=Symbol(`Comlink.finalizer`),_=Symbol(`Comlink.thrown`),be=e=>typeof e==`object`&&!!e||typeof e==`function`,xe=new Map([[`proxy`,{canHandle:e=>be(e)&&e[ge],serialize(e){let{port1:t,port2:n}=new MessageChannel;return Ce(e,t),[n,[n]]},deserialize(e){return e.start(),Ee(e)}}],[`throw`,{canHandle:e=>be(e)&&_ in e,serialize({value:e}){let t;return t=e instanceof Error?{isError:!0,value:{message:e.message,name:e.name,stack:e.stack}}:{isError:!1,value:e},[t,[]]},deserialize(e){throw e.isError?Object.assign(Error(e.value.message),e.value):e.value}}]]);function Se(e,t){for(let n of e)if(t===n||n===`*`||n instanceof RegExp&&n.test(t))return!0;return!1}function Ce(e,t=globalThis,n=[`*`]){t.addEventListener(`message`,function r(i){if(!i||!i.data)return;if(!Se(n,i.origin)){console.warn(`Invalid origin '${i.origin}' for comlink proxy`);return}let{id:a,type:o,path:s}=Object.assign({path:[]},i.data),c=(i.data.argumentList||[]).map(C),l;try{let t=s.slice(0,-1).reduce((e,t)=>e[t],e),n=s.reduce((e,t)=>e[t],e);switch(o){case`GET`:l=n;break;case`SET`:t[s.slice(-1)[0]]=C(i.data.value),l=!0;break;case`APPLY`:l=n.apply(t,c);break;case`CONSTRUCT`:l=Pe(new n(...c));break;case`ENDPOINT`:{let{port1:t,port2:n}=new MessageChannel;Ce(e,n),l=Ne(t,[t])}break;case`RELEASE`:l=void 0;break;default:return}}catch(e){l={value:e,[_]:0}}Promise.resolve(l).catch(e=>({value:e,[_]:0})).then(n=>{let[i,s]=S(n);t.postMessage(Object.assign(Object.assign({},i),{id:a}),s),o===`RELEASE`&&(t.removeEventListener(`message`,r),Te(t),ye in e&&typeof e[ye]==`function`&&e[ye]())}).catch(e=>{let[n,r]=S({value:TypeError(`Unserializable return value`),[_]:0});t.postMessage(Object.assign(Object.assign({},n),{id:a}),r)})}),t.start&&t.start()}function we(e){return e.constructor.name===`MessagePort`}function Te(e){we(e)&&e.close()}function Ee(e,t){let n=new Map;return e.addEventListener(`message`,function(e){let{data:t}=e;if(!t||!t.id)return;let r=n.get(t.id);if(r)try{r(t)}finally{n.delete(t.id)}}),x(e,n,[],t)}function v(e){if(e)throw Error(`Proxy has been released and is not useable`)}function De(e){return w(e,new Map,{type:`RELEASE`}).then(()=>{Te(e)})}const y=new WeakMap,b=`FinalizationRegistry`in globalThis&&new FinalizationRegistry(e=>{let t=(y.get(e)||0)-1;y.set(e,t),t===0&&De(e)});function Oe(e,t){let n=(y.get(t)||0)+1;y.set(t,n),b&&b.register(e,t,e)}function ke(e){b&&b.unregister(e)}function x(e,t,n=[],r=function(){}){let i=!1,a=new Proxy(r,{get(r,o){if(v(i),o===ve)return()=>{ke(a),De(e),t.clear(),i=!0};if(o===`then`){if(n.length===0)return{then:()=>a};let r=w(e,t,{type:`GET`,path:n.map(e=>e.toString())}).then(C);return r.then.bind(r)}return x(e,t,[...n,o])},set(r,a,o){v(i);let[s,c]=S(o);return w(e,t,{type:`SET`,path:[...n,a].map(e=>e.toString()),value:s},c).then(C)},apply(r,a,o){v(i);let s=n[n.length-1];if(s===_e)return w(e,t,{type:`ENDPOINT`}).then(C);if(s===`bind`)return x(e,t,n.slice(0,-1));let[c,l]=je(o);return w(e,t,{type:`APPLY`,path:n.map(e=>e.toString()),argumentList:c},l).then(C)},construct(r,a){v(i);let[o,s]=je(a);return w(e,t,{type:`CONSTRUCT`,path:n.map(e=>e.toString()),argumentList:o},s).then(C)}});return Oe(a,e),a}function Ae(e){return Array.prototype.concat.apply([],e)}function je(e){let t=e.map(S);return[t.map(e=>e[0]),Ae(t.map(e=>e[1]))]}const Me=new WeakMap;function Ne(e,t){return Me.set(e,t),e}function Pe(e){return Object.assign(e,{[ge]:!0})}function S(e){for(let[t,n]of xe)if(n.canHandle(e)){let[r,i]=n.serialize(e);return[{type:`HANDLER`,name:t,value:r},i]}return[{type:`RAW`,value:e},Me.get(e)||[]]}function C(e){switch(e.type){case`HANDLER`:return xe.get(e.name).deserialize(e.value);case`RAW`:return e.value}}function w(e,t,n,r){return new Promise(i=>{let a=Fe();t.set(a,i),e.start&&e.start(),e.postMessage(Object.assign({id:a},n),r)})}function Fe(){return[,,,,].fill(0).map(()=>Math.floor(Math.random()*(2**53-1)).toString(16)).join(`-`)}var Ie=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),Le=Re([``,``],[``,``]);function Re(e,t){return Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function ze(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}var T=function(){function e(){for(var t=this,n=arguments.length,r=Array(n),i=0;i<n;i++)r[i]=arguments[i];return ze(this,e),this.tag=function(e){var n=[...arguments].slice(1);return typeof e==`function`?t.interimTag.bind(t,e):typeof e==`string`?t.transformEndResult(e):(e=e.map(t.transformString.bind(t)),t.transformEndResult(e.reduce(t.processSubstitutions.bind(t,n))))},r.length>0&&Array.isArray(r[0])&&(r=r[0]),this.transformers=r.map(function(e){return typeof e==`function`?e():e}),this.tag}return Ie(e,[{key:`interimTag`,value:function(e,t){var n=[...arguments].slice(2);return this.tag(Le,e.apply(void 0,[t].concat(n)))}},{key:`processSubstitutions`,value:function(e,t,n){return`${t}${this.transformSubstitution(e.shift(),t)}${n}`}},{key:`transformString`,value:function(e){return this.transformers.reduce(function(e,t){return t.onString?t.onString(e):e},e)}},{key:`transformSubstitution`,value:function(e,t){return this.transformers.reduce(function(e,n){return n.onSubstitution?n.onSubstitution(e,t):e},e)}},{key:`transformEndResult`,value:function(e){return this.transformers.reduce(function(e,t){return t.onEndResult?t.onEndResult(e):e},e)}}]),e}(),E=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:``;return{onEndResult:function(t){if(e===``)return t.trim();if(e=e.toLowerCase(),e===`start`||e===`left`)return t.replace(/^\s*/,``);if(e===`end`||e===`right`)return t.replace(/\s*$/,``);throw Error(`Side not supported: `+e)}}};function Be(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}else return Array.from(e)}var D=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:`initial`;return{onEndResult:function(t){if(e===`initial`){var n=t.match(/^[^\S\n]*(?=\S)/gm),r=n&&Math.min.apply(Math,Be(n.map(function(e){return e.length})));if(r){var i=RegExp(`^.{`+r+`}`,`gm`);return t.replace(i,``)}return t}if(e===`all`)return t.replace(/^[^\S\n]+/gm,``);throw Error(`Unknown type: `+e)}}},O=function(e,t){return{onEndResult:function(n){if(e==null||t==null)throw Error(`replaceResultTransformer requires at least 2 arguments.`);return n.replace(e,t)}}},k=function(e,t){return{onSubstitution:function(n,r){if(e==null||t==null)throw Error(`replaceSubstitutionTransformer requires at least 2 arguments.`);return n==null?n:n.toString().replace(e,t)}}},Ve={separator:``,conjunction:``,serial:!1},A=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Ve;return{onSubstitution:function(t,n){if(Array.isArray(t)){var r=t.length,i=e.separator,a=e.conjunction,o=e.serial,s=n.match(/(\n?[^\S\n]+)$/);if(t=s?t.join(i+s[1]):t.join(i+` `),a&&r>1){var c=t.lastIndexOf(i);t=t.slice(0,c)+(o?i:``)+` `+a+t.slice(c+1)}}return t}}},He=function(e){return{onSubstitution:function(t,n){return typeof t==`string`&&t.includes(e)&&(t=t.split(e)),t}}},Ue=function(e){return e!=null&&!Number.isNaN(e)&&typeof e!=`boolean`};new T(A({separator:`,`}),D,E),new T(A({separator:`,`,conjunction:`and`}),D,E),new T(A({separator:`,`,conjunction:`or`}),D,E),new T(He(`
`),function(){return{onSubstitution:function(e){return Array.isArray(e)?e.filter(Ue):Ue(e)?e:``}}},A,D,E),new T(He(`
`),A,D,E,k(/&/g,`&amp;`),k(/</g,`&lt;`),k(/>/g,`&gt;`),k(/"/g,`&quot;`),k(/'/g,`&#x27;`),k(/`/g,`&#x60;`)),new T(O(/(?:\n(?:\s*))+/g,` `),E);var We=new T(O(/(?:\n\s*)/g,``),E);new T(A({separator:`,`}),O(/(?:\s+)/g,` `),E),new T(A({separator:`,`,conjunction:`or`}),O(/(?:\s+)/g,` `),E),new T(A({separator:`,`,conjunction:`and`}),O(/(?:\s+)/g,` `),E),new T(A,D,E),new T(A,O(/(?:\s+)/g,` `),E),new T(D,E),new T(D(`all`),E);const Ge=`application/javascript`,Ke=(e,t={})=>{let n={skipSameOrigin:!0,useBlob:!0,...t};if(n.skipSameOrigin&&new URL(e).origin===self.location.origin)return Promise.resolve(e);let r;try{let e=new AbortController;r=e.signal;let t=setTimeout(()=>{e.abort()},3e3);r.addEventListener(`abort`,()=>{clearTimeout(t),e.abort()})}catch{}return new Promise((t,i)=>void fetch(e,{signal:r}).then(e=>e.text()).then(e=>{let r=``;if(n.useBlob){let t=new Blob([e],{type:Ge});r=URL.createObjectURL(t)}else r=`data:${Ge},`+encodeURIComponent(e);t(r)}).catch(()=>{i(Error(`Failed to fetch worker from ${e}`))}))};var qe=class extends Error{constructor(e,t){super(e,t),this.name=`FrameTransferError`}};const Je=(e,t)=>{let n=t instanceof Error&&t.message?`: ${t.message}`:``;return t instanceof Error?new qe(`${e}${n}`,{cause:t}):new qe(`${e}${n}`)},Ye=e=>e.startsWith(`data:`),Xe=e=>e.startsWith(`blob:`),Ze=e=>!Ye(e)&&!Xe(e),Qe=async e=>{let t=await fetch(e,{method:`HEAD`}),n=t.headers.get(`content-type`),r=n==null?void 0:n.includes(`javascript`);if(n!=null&&n.includes(`html`))throw Error(We`${e} resolved to a resource with the content type ${n}.
      This is likely an issue with the server configuration redirecting to an index.html file.
      Check that your resources are properly hosted`);if(!r)throw Error(`Worker file is not a JavaScript file: ${n}`);if(!t.ok)throw Error(`Worker file not found or inaccessible: ${t.status} ${t.statusText}`)};async function $e(e,t){let n=await Ke(new URL(`resources/${t}`,e).toString());Ze(n)&&await Qe(n);let r=new Worker(n,{type:`module`}),i=Ee(r);return r.onerror=e=>{console.error(`Worker error:`,e),i[ve]()},new Proxy(i,{get(e,t,n){return t===`createScanningSession`?async(...t)=>{let n=await e.createScanningSession(...t);return new Proxy(n,{get(e,t,n){return t===`process`?t=>{let n={data:t.data,width:t.width,height:t.height,colorSpace:t.colorSpace??`srgb`},r;try{r=Ne(n,[t.data.buffer])}catch(e){throw Je(`Failed to transfer frame to worker`,e)}return e.process(r)}:Reflect.get(e,t,n)}})}:Reflect.get(e,t,n)}})}function et(){let e=navigator.userAgent;if(/iPad/.test(e)||/Macintosh/.test(e)&&navigator.maxTouchPoints>1)return`iPad`;if(/iPhone/.test(e))return`iPhone`;if(/Macintosh/.test(e))return`Mac`}const tt=[{name:`Facebook In-App`,regex:/FBAV\/([\d.]+)/,getVersion:e=>e[1]},{name:`Instagram In-App`,regex:/Instagram ([\d.]+)/,getVersion:e=>e[1]},{name:`TikTok In-App`,regex:/TikTok/,getVersion:()=>``},{name:`Edge`,regex:/Edg\/([\d.]+)/,getVersion:e=>e[1]},{name:`DuckDuckGo`,regex:/DuckDuckGo\/([\d.]+)/,getVersion:e=>e[1]},{name:`Vivaldi`,regex:/Vivaldi\/([\d.]+)/,getVersion:e=>e[1]},{name:`Opera`,regex:/OPR\/([\d.]+)/,getVersion:e=>e[1]},{name:`Samsung Browser`,regex:/SamsungBrowser\/([\d.]+)/,getVersion:e=>e[1]},{name:`Firefox`,regex:/FxiOS\/([\S]+)/,getVersion:e=>e[1]},{name:`Chrome`,regex:/CriOS\/([\S]+)/,getVersion:e=>e[1]},{name:`Android WebView`,regex:/; wv\)/,getVersion:(e,t)=>{var n;return((n=t.match(/Chrome\/([\d.]+)/))==null?void 0:n[1])??``}},{name:`Brave`,regex:/Brave/,getVersion:(e,t)=>{var n;return((n=t.match(/Chrome\/([\d.]+)/))==null?void 0:n[1])??``}},{name:`Chrome`,regex:/Chrome\/([\d.]+)/,getVersion:e=>e[1]},{name:`Firefox`,regex:/Firefox\/([\d.]+)/,getVersion:e=>e[1]},{name:`Safari`,regex:/Version\/([\d.]+).*Safari/,getVersion:e=>e[1]}];function nt(){var e;let t=navigator.userAgent;for(let e of tt){let n=t.match(e.regex);if(n)return{name:e.name,version:e.getVersion(n,t)}}if((e=window.webkit)!=null&&e.messageHandlers){let e=t.match(/OS ([\d_]+)/);return{name:`iOS WebView`,version:e?e[1].replace(/_/g,`.`):``}}return{name:`Unknown`,version:``}}function rt(e,t){if(!t.versionRegex)return``;let n=e.match(t.versionRegex);return n!=null&&n[1]?t.versionTransform?t.versionTransform(n[1]):n[1]:``}function it(){let e=navigator.userAgent,t={"10.0":`10 or 11`,6.3:`8.1`,6.2:`8`,6.1:`7`},n=[{os:`iPadOS`,condition:/Macintosh/.test(e)&&navigator.maxTouchPoints>1,versionRegex:/Mac OS X ([\d_]+)/,versionTransform:e=>e.replace(/_/g,`.`)},{os:`iOS`,condition:/iPhone/.test(e),versionRegex:/iPhone OS ([\d_]+)/,versionTransform:e=>e.replace(/_/g,`.`)},{os:`macOS`,condition:/Macintosh/.test(e),versionRegex:/Mac OS X ([\d_]+)/,versionTransform:e=>e.replace(/_/g,`.`)},{os:`Windows`,condition:/Win/.test(e),versionRegex:/Windows NT ([\d.]+)/,versionTransform:e=>t[e]||e},{os:`Android`,condition:/Android/.test(e),versionRegex:/Android ([\d.]+)/},{os:`Linux`,condition:/Linux/.test(e)}];for(let t of n)if(t.condition){let n=rt(e,t);return{os:t.os,version:n}}return{os:``,version:``}}function at(e,t){var n,r,i,a,o;let s=et(),c=``;if(t!=null&&t.model)c=t.model;else if(s)c=s;else{let t=e.match(/Android.*?; ([^)]+)\)/);t!=null&&t[1]&&(c=t[1])}let l=[`Desktop`];!(t==null||(n=t.formFactors)==null)&&n.length?l=t.formFactors:t!=null&&t.mobile?l=[`Mobile`]:s&&(s===`iPhone`?l=[`Mobile`]:s===`iPad`&&(l=[`Tablet`]));let u=``;u=t!=null&&t.platform?t.platform:it().os;let d=``,f=``;if(!(t==null||(r=t.brands)==null)&&r.length)d=((i=t.brands.find(e=>!/not.a.brand/i.test(e.brand)&&e.brand!==`Chromium`)??t.brands.find(e=>!/not.a.brand/i.test(e.brand)))==null?void 0:i.brand)??``,f=t.fullVersionList?((a=t.fullVersionList.find(e=>e.brand===d))==null?void 0:a.version)??``:((o=t.brands.find(e=>e.brand===d))==null?void 0:o.version)??``;else{let e=nt();d=e.name,f=e.version}return c===``&&u===`macOS`&&(c=`Mac`),{model:c,formFactors:l,platform:u,browser:{brand:d,version:f}}}function ot(){let e=document.createElement(`canvas`).getContext(`webgl`);if(e&&e instanceof WebGLRenderingContext){let t=e.getExtension(`WEBGL_debug_renderer_info`);return{renderer:t?e.getParameter(t.UNMASKED_RENDERER_WEBGL):e.getParameter(e.RENDERER),shadingLanguageVersion:e.getParameter(e.SHADING_LANGUAGE_VERSION),vendor:t?e.getParameter(t.UNMASKED_VENDOR_WEBGL):e.getParameter(e.VENDOR),version:e.getParameter(e.VERSION)}}}function st(){try{let e=`__storage_test__`;return window.localStorage.setItem(e,e),window.localStorage.removeItem(e),!0}catch{return!1}}async function ct(){let e;try{var t;e=await((t=navigator.userAgentData)==null?void 0:t.getHighEntropyValues([`brands`,`mobile`,`platform`,`architecture`,`bitness`,`formFactors`,`model`,`platformVersion`,`fullVersionList`,`wow64`]))}catch{}return e}async function lt(){let e=await ct();return{userAgentData:e,userAgent:navigator.userAgent,threads:navigator.hardwareConcurrency,memory:navigator.deviceMemory,gpu:ot(),screen:{screenWidth:window.screen.width,screenHeight:window.screen.height,devicePixelRatio:window.devicePixelRatio,physicalScreenWidth:window.screen.width*window.devicePixelRatio,physicalScreenHeight:window.screen.height*window.devicePixelRatio,maxTouchPoints:navigator.maxTouchPoints},browserStorageSupport:{cookieEnabled:navigator.cookieEnabled,localStorageEnabled:st()},derivedDeviceInfo:at(navigator.userAgent,e)}}let ut=(e=21)=>crypto.getRandomValues(new Uint8Array(e)).reduce((e,t)=>(t&=63,t<36?e+=t.toString(36):t<62?e+=(t-26).toString(36).toUpperCase():t>62?e+=`-`:e+=`_`,e),``);function dt(e){if(!ft())return ut();let t=localStorage.getItem(e);if(t)return t;let n=ut();return localStorage.setItem(e,n),n}function ft(){try{return localStorage.setItem(`test`,`test`),localStorage.removeItem(`test`),!0}catch{return!1}}async function pt(){let e=await lt();if(e.derivedDeviceInfo.formFactors.some(e=>e===`Mobile`||e===`Tablet`)&&e.memory!==void 0)return e.memory<4}const mt={inputImageSource:`video`,scanningMode:`automatic`,scanningSettings:{allowUncertainFrontSideScan:!1,blurDetectionLevel:`mid`,glareDetectionLevel:`mid`,tiltDetectionLevel:`mid`,skipImagesWithBlur:!0,skipImagesWithGlare:!0,skipImagesOccludedByHand:!0,skipImagesWithInadequateLightingConditions:!0,combineResultsFromMultipleInputImages:!0,croppedImageSettings:{dotsPerInch:250,extensionFactor:0,returnDocumentImage:!1,returnFaceImage:!1,returnSignatureImage:!1},customDocumentAnonymizationSettings:[],customDocumentRules:[],enableBarcodeScanOnly:!1,enableCharacterValidation:!0,inputImageMargin:.02,maxAllowedMismatchesPerField:0,recognitionModeFilter:{enableBarcodeId:!0,enableFullDocumentRecognition:!0,enableMrzId:!0,enableMrzPassport:!0,enableMrzVisa:!0,enablePhotoId:!0},returnInputImages:!1,scanCroppedDocumentImage:!1,scanPassportDataPageOnly:!0,scanUnsupportedBack:!1,anonymizationMode:`full-result`}};async function ht(e,t){let n=await $e(e.resourcesLocation??window.location.href,`centaurus-worker.js`);e.userId||=dt(`centaurus-userid`),e.resourcesLocation||=window.location.href,e.useLightweightBuild===void 0&&(e.useLightweightBuild=await pt());let r=t?Pe(t):void 0;try{return await n[atob(`aW5pdEJsaW5rSWQ=`)](e,mt,r),n}catch(e){throw Error(`Failed to initialize Centaurus`,{cause:e})}}const gt=Symbol();globalThis.__CENTAURUS_CORE__||=gt,globalThis.__CENTAURUS_CORE__!==gt&&console.warn(`Detected multiple instances of Centaurus. This can lead to unexpected behavior.`);const j=(...e)=>void 0,M=j,_t=j,vt=j,yt=new Map;yt.set([77,105,99,114,111,98,108,105,110,107],`Scandit`),yt.set([66,108,105,110,107,73,68],`ID Capture`);var N=class e{static async load(t){let n=new e;try{await n.initCentaurus(t)}catch(e){throw n.createErrorFromCentaurusError(e)}return n}static unload(){var t;(t=e.wasmSDK)==null||t.terminate(),e.wasmSDK=void 0,M(`CentaurusLoader: unload complete`)}static replaceCentaurusMentions(e,t){return typeof e==`string`?[...t.entries()].reduce((e,[t,n])=>{let r=t.map(e=>String.fromCodePoint(e)).join(``);return e.replace(new RegExp(r,`gi`),n)},e):`(no message)`}createErrorFromCentaurusError(e){return e instanceof Error&&(e.cause instanceof Error?e.cause:e).name===`LicenseError`?new o({name:`IdCaptureLoadingError`,message:`Error 260: The Scandit SDK license validation failed. Your license key does not include support for this domain (Centaurus error).`}):new o({name:`IdCaptureLoadingError`,message:`Error while loading Centaurus library.`})}static async getWasmType(){let[e,n]=await Promise.all([t.hasSIMDSupport(),t.hasThreadsSupport()]);return e?n&&t.isDesktopDevice()?`advanced-threads`:`advanced`:`basic`}async initCentaurus(t){e.licenseKey=t.licenseKey;let n=new URL(`8.5.2/`,t.libraryLocation).toString();e.wasmSDK=await ht({licenseKey:t.licenseKey,initialMemory:500,resourcesLocation:n,useLightweightBuild:!0,wasmVariant:await e.getWasmType()},({progress:e})=>{var n;(n=t.loadProgressNotifier)==null||n.call(t,{percentage:e,privateUri:new URL(`Centaurus.wasm`,t.libraryLocation).toString()})})}};function bt(e){if(typeof e!=`function`)return;let t=Object.keys({"scandit-datacapture-sdk-id-pthreads.wasm":{bytes:9185051},"scandit-datacapture-sdk-id.wasm":{bytes:9309014},"scandit-datacapture-sdk-id-simd.wasm":{bytes:9251592},"scandit-datacapture-sdk-id-simd-pthreads.wasm":{bytes:9141157}});return function(n){if(n.percentage===null){e(n);return}let{pathname:r}=new URL(n.privateUri,document.baseURI),i={...n};t.some(e=>r.endsWith(e))?i.percentage=43*n.percentage/100:r.endsWith(`Centaurus.wasm`)&&(i.percentage=43+57*n.percentage/100),e(i)}}let xt=function(e){return e.Authentic=`authentic`,e.LikelyForged=`likelyForged`,e.Forged=`forged`,e}({});var St=class e{get allChecksPassed(){return this.status===`authentic`}get error(){var e;return((e=this.json)==null?void 0:e.error)??null}get status(){var e;return((e=this.json)==null?void 0:e.status)??null}static fromJSON(t){let n=new e;return n.json=t,n}},Ct=class e{constructor(e){this._useStagingEnv=!1,this._context=e}static async create(t){return new e(t)}async verify(e){var t;let n=await this._context.workerCommand(`idCaptureBarcodeVerifyAamvaCapture`,{capturedId:e.toJSONObject(),useStagingEnv:this._useStagingEnv});return((t=n.result)==null?void 0:t.error)!=null&&f.log(f.Level.Warn,`Error during Aamva verification:`,n.result.error),St.fromJSON(n.result)}},wt=class{constructor(e,t,n){this._days=e,this._months=t,this._years=n}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}}};let Tt=function(e){return e.FrontOnly=`frontOnly`,e.FrontAndBack=`frontAndBack`,e}({}),Et=function(e){return e.Face=`face`,e.CroppedDocument=`croppedDocument`,e.Frame=`frame`,e}({}),Dt=function(e){return e.Front=`front`,e.Back=`back`,e}({}),Ot=function(e){return e.None=`none`,e.FieldsOnly=`fieldsOnly`,e.ImagesOnly=`imagesOnly`,e.FieldsAndImages=`fieldsAndImages`,e}({}),kt=function(e){return e.Auto=`auto`,e.ButtonTap=`buttonTap`,e}({}),At=function(e){return e.AdditionalAddressInformation=`additionalAddressInformation`,e.AdditionalNameInformation=`additionalNameInformation`,e.Address=`address`,e.Age=`age`,e.BarcodeDictionary=`barcodeDictionary`,e.BloodType=`bloodType`,e.DateOfBirth=`dateOfBirth`,e.DateOfExpiry=`dateOfExpiry`,e.DateOfIssue=`dateOfIssue`,e.DocumentAdditionalNumber=`documentAdditionalNumber`,e.DocumentNumber=`documentNumber`,e.Employer=`employer`,e.FathersName=`fathersName`,e.FirstName=`firstName`,e.FullName=`fullName`,e.IssuingAuthority=`issuingAuthority`,e.LastName=`lastName`,e.MaritalStatus=`maritalStatus`,e.MothersName=`mothersName`,e.MrzOptionalDataInLine1=`mrzOptionalDataInLine1`,e.MrzOptionalDataInLine2=`mrzOptionalDataInLine2`,e.Nationality=`nationality`,e.PersonalIdNumber=`personalIdNumber`,e.PlaceOfBirth=`placeOfBirth`,e.Profession=`profession`,e.Race=`race`,e.Religion=`religion`,e.ResidentialStatus=`residentialStatus`,e.Sex=`sex`,e}({}),jt=function(e){return e.Rounded=`rounded`,e.Square=`square`,e}({}),Mt=function(e){return e.Light=`light`,e.Bold=`bold`,e}({}),Nt=function(e){return e.NotAvailable=`notAvailable`,e.NotRealIdCompliant=`notRealIdCompliant`,e.RealIdCompliant=`realIdCompliant`,e}({}),Pt=function(e){return e.Female=`female`,e.Male=`male`,e.Unspecified=`unspecified`,e}({}),Ft=function(e){return e.Approved=`approved`,e.Granted=`granted`,e.Pending=`pending`,e.Denied=`denied`,e.Revoked=`revoked`,e.Expired=`expired`,e.Cancelled=`cancelled`,e.Other=`other`,e.Unknown=`unknown`,e}({});var It=class e{constructor(){this.idCaptured=c.defaultFeedback,this.idRejected=new c(null,null)}static get defaultFeedback(){return new e}static get defaultSuccessSound(){return h.defaultSound}static get defaultFailureSound(){return new h(`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=`)}toJSONObject(){return{idCaptured:this.idCaptured.toJSONObject(),idRejected:this.idRejected.toJSONObject()}}};let Lt=function(e){return e.Passport=`passport`,e.IdCard=`idCard`,e.DriverLicense=`driverLicense`,e.VisaIcao=`visaIcao`,e.ResidencePermit=`residencePermit`,e.HealthInsuranceCard=`healthInsuranceCard`,e.RegionSpecific=`regionSpecific`,e.VisaLetter=`visaLetter`,e}({});var P=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`}isVisaLetter(){return this.documentType===`visaLetter`}isHealthInsuranceCard(){return this.documentType===`healthInsuranceCard`}isResidencePermit(){return this.documentType===`residencePermit`}isRegionSpecific(){return this.documentType===`regionSpecific`}},Rt=class e{constructor(){this.json={}}get errorCorrection(){return this.json.errorCorrection}get moduleCountX(){return this.json.moduleCountX}get moduleCountY(){return this.json.moduleCountY}static fromJSON(t){if(t==null)return null;let n=new e;return n.json=t,n}toJSONObject(){return{errorCorrection:this.errorCorrection,moduleCountX:this.moduleCountX,moduleCountY:this.moduleCountY}}},F=class e{constructor(){this.json={}}get day(){return this.json.day}get month(){return this.json.month}get year(){return this.json.year}get localDate(){return new Date(this.json.year,this.json.month?this.json.month-1:0,this.json.day||1)}get utcDate(){return new Date(Date.UTC(this.json.year,this.json.month?this.json.month-1:0,this.json.day||1))}static fromJSON(t){if(t==null)return null;let n=new e;return n.json=t,n}toJSONObject(){return{day:this.day,month:this.month,year:this.year}}},zt=class e{get dateOfExpiry(){return F.fromJSON(this.json.dateOfExpiry)??new F}get codes(){return this.json.codes}static fromJSON(t){if(t===null)return null;let n=new e;return n.json=t,n}toJSONObject(){return{codes:[...this.codes],dateOfExpiry:this.dateOfExpiry.toJSONObject()}}},Bt=class e{get vehicleCode(){return this.json.vehicleCode}get vehicleRestriction(){return this.json.vehicleRestriction}get dateOfIssue(){return F.fromJSON(this.json.dateOfIssue)??new F}static fromJSON(t){if(t===null)return null;let n=new e;return n.json=t,n}toJSONObject(){return{dateOfIssue:this.dateOfIssue.toJSONObject(),vehicleCode:this.vehicleCode,vehicleRestriction:this.vehicleRestriction}}},Vt=class e{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 F.fromJSON(this.json.cardRevisionDate)}get categories(){return this.json.categories==null?[]:this.json.categories}get champusEffectiveDate(){return F.fromJSON(this.json.champusEffectiveDate)}get champusExpiryDate(){return F.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 Rt.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?null:zt.fromJSON(this.json.professionalDrivingPermit)}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=>Bt.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 F.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 F.fromJSON(this.json.dateOfExpiry)}get dateOfIssue(){return F.fromJSON(this.json.dateOfIssue)}get barcodeDataElements(){return this.json.dictionary}static fromJSON(t){let n=new e;return n.json=t,n}toJSONObject(){var e,t,n,r,i,a,o;return{aamvaVersion:this.aamvaVersion,address:this.address,aliasFamilyName:this.aliasFamilyName,aliasGivenName:this.aliasGivenName,aliasSuffixName:this.aliasSuffixName,barcodeMetadata:((e=this.barcodeMetadata)==null?void 0:e.toJSONObject())??null,bloodType:this.bloodType,branchOfService:this.branchOfService,cardInstanceIdentifier:this.cardInstanceIdentifier,cardRevisionDate:this.cardRevisionDate?this.cardRevisionDate.toJSONObject():null,categories:[...this.categories],champusEffectiveDate:((t=this.champusEffectiveDate)==null?void 0:t.toJSONObject())??null,champusExpiryDate:((n=this.champusExpiryDate)==null?void 0:n.toJSONObject())??null,citizenshipStatus:this.citizenshipStatus,civilianHealthCareFlagCode:this.civilianHealthCareFlagCode,civilianHealthCareFlagDescription:this.civilianHealthCareFlagDescription,commissaryFlagCode:this.commissaryFlagCode,commissaryFlagDescription:this.commissaryFlagDescription,countryOfBirth:this.countryOfBirth,countryOfBirthIso:this.countryOfBirthIso,dateOfBirth:((r=this.dateOfBirth)==null?void 0:r.toJSONObject())??null,dateOfExpiry:((i=this.dateOfExpiry)==null?void 0:i.toJSONObject())??null,dateOfIssue:((a=this.dateOfIssue)==null?void 0:a.toJSONObject())??null,deersDependentSuffixCode:this.deersDependentSuffixCode,deersDependentSuffixDescription:this.deersDependentSuffixDescription,dictionary:{...this.barcodeDataElements},directCareFlagCode:this.directCareFlagCode,directCareFlagDescription:this.directCareFlagDescription,documentAdditionalNumber:this.json.documentAdditionalNumber,documentCopy:this.documentCopy,documentDiscriminatorNumber:this.documentDiscriminatorNumber,documentNumber:this.documentNumber,documentSubtype:this.json.documentSubtype,documentType:this.json.documentType,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,firstName:this.firstName,firstNameTruncation:this.firstNameTruncation,firstNameWithoutMiddleName:this.firstNameWithoutMiddleName,formNumber:this.formNumber,fullName:this.fullName,genevaConventionCategory:this.genevaConventionCategory,hairColor:this.hairColor,heightCm:this.heightCm,heightInch:this.heightInch,iin:this.IIN,identificationType:this.identificationType,isRealId:this.isRealId,issuingCountry:this.json.issuingCountry,issuingCountryIso:this.json.issuingCountryIso,issuingJurisdiction:this.issuingJurisdiction,issuingJurisdictionIso:this.issuingJurisdictionIso,jpegData:this.jpegData,jurisdictionVersion:this.jurisdictionVersion,lastNameTruncation:this.lastNameTruncation,licenseCountryOfIssue:this.licenseCountryOfIssue,lastName:this.lastName,location:this.json.location??null,middleName:this.middleName,middleNameTruncation:this.middleNameTruncation,mwrFlagCode:this.mwrFlagCode,mwrFlagDescription:this.mwrFlagDescription,nationality:this.nationality,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:((o=this.professionalDrivingPermit)==null?void 0:o.toJSONObject())??null,race:this.race,rank:this.rank,rawData:this.rawData==null?null:[...this.rawData],relationshipCode:this.relationshipCode,relationshipDescription:this.relationshipDescription,restrictionsCode:this.restrictionsCode,securityCode:this.securityCode,serviceCode:this.serviceCode,sex:this.sex,sexOriginal:this.json.sexOriginal,sponsorFlag:this.sponsorFlag,sponsorName:this.sponsorName,sponsorPersonDesignatorIdentifier:this.sponsorPersonDesignatorIdentifier,statusCode:this.statusCode,statusCodeDescription:this.statusCodeDescription,vehicleClass:this.vehicleClass,vehicleRestrictions:this.vehicleRestrictions.map(e=>e.toJSONObject()),version:this.version,weightKg:this.weightKg,weightLbs:this.weightLbs}}},Ht=class e{constructor(){this.json=null}get face(){var e;return((e=this.json)==null?void 0:e.front.face)??null}get frame(){var e,t;return((e=this.json)==null?void 0:e.front.frame)??((t=this.json)==null?void 0:t.back.frame)??null}static fromJSON(t){let n=new e;return t!=null&&(n.json=t),n}getFrame(e){switch(e){case`front`:var t;return((t=this.json)==null?void 0:t.front.frame)??null;case`back`:var n;return((n=this.json)==null?void 0:n.back.frame)??null}return null}getCroppedDocument(e){switch(e){case`front`:var t;return((t=this.json)==null?void 0:t.front.croppedDocument)??null;case`back`:var n;return((n=this.json)==null?void 0:n.back.croppedDocument)??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`)}}}},Ut=class e{get documentCode(){return this.json.documentCode}get namesAreTruncated(){return this.json.namesAreTruncated}get optionalDataInLine1(){return this.json.optionalDataInLine1}get optionalDataInLine2(){return this.json.optionalDataInLine2}get capturedMrz(){return this.json.capturedMrz}get personalIdNumber(){return this.json.personalIdNumber}get renewalTimes(){return this.json.renewalTimes}get fullNameSimplifiedChinese(){return this.json.fullNameSimplifiedChinese}get omittedCharacterCountInGbkName(){return this.json.omittedCharacterCountInGbkName}get omittedNameCount(){return this.json.omittedNameCount}get issuingAuthorityCode(){return this.json.issuingAuthorityCode}get passportIssuerIso(){return this.json.passportIssuerIso}get passportNumber(){return this.json.passportNumber}get passportType(){return this.json.passportType===null?null:this.json.passportType}get passportDateOfExpiry(){return F.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 F.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 F.fromJSON(this.json.dateOfExpiry)}get dateOfIssue(){return F.fromJSON(this.json.dateOfIssue)}static fromJSON(t){let n=new e;return n.json=t,n}toJSONObject(){var e,t;return{...this.json,documentCode:this.documentCode,namesAreTruncated:this.namesAreTruncated,optionalDataInLine1:this.optionalDataInLine1,optionalDataInLine2:this.optionalDataInLine2,capturedMrz:this.capturedMrz,personalIdNumber:this.personalIdNumber,renewalTimes:this.renewalTimes,fullNameSimplifiedChinese:this.fullNameSimplifiedChinese,omittedCharacterCountInGbkName:this.omittedCharacterCountInGbkName,omittedNameCount:this.omittedNameCount,issuingAuthorityCode:this.issuingAuthorityCode,passportIssuerIso:this.passportIssuerIso,passportNumber:this.passportNumber,passportType:this.passportType,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:((e=this.dateOfExpiry)==null?void 0:e.toJSONObject())??null,dateOfIssue:((t=this.dateOfIssue)==null?void 0:t.toJSONObject())??null}}},Wt=class e{constructor(){this.json={}}get code(){return this.json.code}get dateOfIssue(){return F.fromJSON(this.json.dateOfIssue)}get dateOfExpiry(){return F.fromJSON(this.json.dateOfExpiry)}static fromJSON(t){if(t==null)return null;let n=new e;return n.json=t,n}toJSONObject(){return{code:this.code,dateOfIssue:this.dateOfIssue?this.dateOfIssue.toJSONObject():null,dateOfExpiry:this.dateOfExpiry?this.dateOfExpiry.toJSONObject():null}}},I=class e{constructor(){this.json={}}get drivingLicenseCategories(){return this.json.drivingLicenseCategories.map(e=>Wt.fromJSON(e)).filter(e=>e!=null)}get restrictions(){return this.json.restrictions}get endorsements(){return this.json.endorsements}static fromJSON(t){if(t==null)return null;let n=new e;return n.json=t,n}toJSONObject(){return{drivingLicenseCategories:this.drivingLicenseCategories.map(e=>e.toJSONObject()),restrictions:this.restrictions,endorsements:this.endorsements}}},Gt=class e{get applicationStatus(){return Object.values(Ft).includes(this.json.applicationStatus)?this.json.applicationStatus:null}get durationInDays(){return this.json.durationInDays}get fullName(){return this.json.fullName}get geographicValidity(){return this.json.geographicValidity}get dateOfIssue(){return F.fromJSON(this.json.dateOfIssue)}get issuingCountryIso(){return this.json.issuingCountryIso}get issuingAuthority(){return this.json.issuingAuthority}get numberOfEntries(){return this.json.numberOfEntries}get multipleEntries(){return this.json.multipleEntries}get passportNumber(){return this.json.passportNumber}get visaNumber(){return this.json.visaNumber}get validFrom(){return F.fromJSON(this.json.validFrom)}get validUntil(){return F.fromJSON(this.json.validUntil)}get visaType(){return this.json.visaType}get foilNumber(){return this.json.foilNumber}toJSONObject(){var e,t,n;return{applicationStatus:this.applicationStatus,dateOfIssue:((e=this.dateOfIssue)==null?void 0:e.toJSONObject())??null,durationInDays:this.durationInDays,fullName:this.fullName,geographicValidity:this.geographicValidity,issuingCountryIso:this.issuingCountryIso,issuingAuthority:this.issuingAuthority,multipleEntries:this.multipleEntries,numberOfEntries:this.numberOfEntries,passportNumber:this.passportNumber,visaNumber:this.visaNumber,validFrom:((t=this.validFrom)==null?void 0:t.toJSONObject())??null,validUntil:((n=this.validUntil)==null?void 0:n.toJSONObject())??null,visaType:this.visaType??null,foilNumber:this.foilNumber}}static fromJSON(t){if(t==null)return null;let n=new e;return n.json=t,n}},Kt=class e{get firstName(){return this.json.firstName}get lastName(){return this.json.lastName}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 I.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 F.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 F.fromJSON(this.json.dateOfExpiry)}get dateOfIssue(){return F.fromJSON(this.json.dateOfIssue)}get vehicleOwner(){return this.json.vehicleOwner}get visaDetails(){return Gt.fromJSON(this.json.visaDetails)}static fromJSON(t){if(t==null)return null;let n=new e;return n.json=t,n}toJSONObject(){var e,t,n,r;return{...this.json,firstName:this.firstName,lastName:this.lastName,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:((e=this.dateOfBirth)==null?void 0:e.toJSONObject())??null,nationality:this.nationality,address:this.address,documentNumber:this.documentNumber,dateOfExpiry:((t=this.dateOfExpiry)==null?void 0:t.toJSONObject())??null,dateOfIssue:((n=this.dateOfIssue)==null?void 0:n.toJSONObject())??null,vehicleOwner:this.vehicleOwner,visaDetails:((r=this.visaDetails)==null?void 0:r.toJSONObject())??null}}};const L={IssuingCountryIso:`issuing country`,IssuingJurisdictionIso:`issuing jurisdiction`,DocumentNumber:`document number`,FullName:`full name`,BirthDate:`date of birth`,ExpiryDate:`date of expiry`,IssueDate:`date of issue`,FirstName:`first name`,LastName:`last name`};var qt=class e{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(t){let n=new e;return n.json=t,n}async frontReviewImage(){let e=this.json.frontFieldLocations,t=e!=null&&Object.keys(e).length>0,n=this.json.frontImage;if(!this.allChecksPassed&&n!=null&&t)try{return await this.highlightImage(n,e)}catch(e){f.log(f.Level.Warn,`Failed to create image with mismatching fields.`,e)}return``}toJSONObject(){return{...this.json}}async highlightImage(e,t){let n=new Image;n.src=`data:image/png;base64,${e}`,await n.decode();let r=document.createElement(`canvas`);r.width=n.width,r.height=n.height;let i=r.getContext(`2d`);if(!i)throw Error(`Failed to get 2d context from canvas`);i.drawImage(n,0,0);let a=this.getMismatchedQuads(t);if(a.length===0)return``;i.beginPath(),i.rect(0,0,n.width,n.height);for(let e of a)i.moveTo(e.topLeft.x,e.topLeft.y),i.lineTo(e.topLeft.x,e.bottomRight.y),i.lineTo(e.bottomRight.x,e.bottomRight.y),i.lineTo(e.bottomRight.x,e.topLeft.y),i.lineTo(e.topLeft.x,e.topLeft.y);i.fillStyle=`rgba(0, 0, 0, 0.30)`,i.fill(),i.lineWidth=3,i.strokeStyle=`red`,i.beginPath();for(let e of a)i.rect(e.topLeft.x,e.topLeft.y,e.bottomRight.x-e.topLeft.x,e.bottomRight.y-e.topLeft.y);return i.stroke(),r.toDataURL(`image/jpeg`,1)}getQuadsForFields(e,t){return t.map(t=>e[t]).filter(e=>e!=null).map(e=>m.fromJSON(e))}getMismatchedQuads(e){if(e==null)return[];let t=new Set;for(let e of this.failedChecks)switch(e){case`documentNumberComparison`:t.add(L.DocumentNumber);break;case`fullNameComparison`:t.add(L.FullName),t.add(L.FirstName),t.add(L.LastName);break;case`issuingCountryComparison`:t.add(L.IssuingCountryIso);break;case`issuingJurisdictionComparison`:t.add(L.IssuingJurisdictionIso);break;case`dateOfBirthComparison`:t.add(L.BirthDate);break;case`dateOfExpiryComparison`:t.add(L.ExpiryDate);break;case`dateOfIssueComparison`:t.add(L.IssueDate);break;default:}return this.getQuadsForFields(e,Array.from(t))}},Jt=class e{constructor(){this.json=null}get dataConsistency(){var e;return((e=this.json)==null?void 0:e.dataConsistencyResult)==null?null:qt.fromJSON(this.json.dataConsistencyResult)}static fromJSON(t){let n=new e;return n.json=t,n}toJSONObject(){var e;return{dataConsistencyResult:((e=this.dataConsistency)==null?void 0:e.toJSONObject())??null}}},R=class extends P{constructor(e){super(e),this.documentType=`driverLicense`}get region(){return this._region}toJSONObject(){return{region:this.region,documentType:this.documentType}}},z=class extends P{constructor(e){super(e),this.documentType=`healthInsuranceCard`}get region(){return this._region}toJSONObject(){return{region:this.region,documentType:this.documentType}}},B=class extends P{constructor(e){super(e),this.documentType=`idCard`}get region(){return this._region}toJSONObject(){return{region:this.region,documentType:this.documentType}}},V=class extends P{constructor(e){super(e),this.documentType=`passport`}get region(){return this._region}toJSONObject(){return{region:this.region,documentType:this.documentType}}};let Yt=function(e){return e.Any=`any`,e.EuAndSchengen=`euAndSchengen`,e.Aruba=`aruba`,e.Afghanistan=`afghanistan`,e.Angola=`angola`,e.Anguilla=`anguilla`,e.AlandIslands=`alandIslands`,e.Albania=`albania`,e.Andorra=`andorra`,e.Uae=`uae`,e.Argentina=`argentina`,e.Armenia=`armenia`,e.AmericanSamoa=`americanSamoa`,e.Antarctica=`antarctica`,e.FrenchSouthernTerritories=`frenchSouthernTerritories`,e.AntiguaAndBarbuda=`antiguaAndBarbuda`,e.Australia=`australia`,e.Austria=`austria`,e.Azerbaijan=`azerbaijan`,e.Burundi=`burundi`,e.Belgium=`belgium`,e.Benin=`benin`,e.BonaireSintEustatiusAndSaba=`bonaireSintEustatiusAndSaba`,e.BurkinaFaso=`burkinaFaso`,e.Bangladesh=`bangladesh`,e.Bulgaria=`bulgaria`,e.Bahrain=`bahrain`,e.Bahamas=`bahamas`,e.BosniaHerzegovina=`bosniaHerzegovina`,e.SaintBarthelemy=`saintBarthelemy`,e.Belarus=`belarus`,e.Belize=`belize`,e.Bermuda=`bermuda`,e.Bolivia=`bolivia`,e.Brazil=`brazil`,e.Barbados=`barbados`,e.BruneiDarussalam=`bruneiDarussalam`,e.Bhutan=`bhutan`,e.BouvetIsland=`bouvetIsland`,e.Botswana=`botswana`,e.Car=`car`,e.Canada=`canada`,e.CocosIslands=`cocosIslands`,e.Switzerland=`switzerland`,e.Chile=`chile`,e.China=`china`,e.CoteIvoire=`coteIvoire`,e.Cameroon=`cameroon`,e.DemocraticRepublicOfCongo=`democraticRepublicOfCongo`,e.Congo=`congo`,e.CookIslands=`cookIslands`,e.Colombia=`colombia`,e.Comoros=`comoros`,e.CaboVerde=`caboVerde`,e.CostaRica=`costaRica`,e.Cuba=`cuba`,e.Curacao=`curacao`,e.ChristmasIsland=`christmasIsland`,e.CaymanIslands=`caymanIslands`,e.Cyprus=`cyprus`,e.Czechia=`czechia`,e.Germany=`germany`,e.Djibouti=`djibouti`,e.Dominica=`dominica`,e.Denmark=`denmark`,e.DominicanRepublic=`dominicanRepublic`,e.Algeria=`algeria`,e.Ecuador=`ecuador`,e.Egypt=`egypt`,e.Eritrea=`eritrea`,e.WesternSahara=`westernSahara`,e.Spain=`spain`,e.Estonia=`estonia`,e.Ethiopia=`ethiopia`,e.Finland=`finland`,e.Fiji=`fiji`,e.FalklandIslands=`falklandIslands`,e.France=`france`,e.FaroeIslands=`faroeIslands`,e.Micronesia=`micronesia`,e.Gabon=`gabon`,e.Uk=`uk`,e.Georgia=`georgia`,e.Guernsey=`guernsey`,e.Ghana=`ghana`,e.Gibraltar=`gibraltar`,e.Guinea=`guinea`,e.Guadeloupe=`guadeloupe`,e.Gambia=`gambia`,e.GuineaBissau=`guineaBissau`,e.EquatorialGuinea=`equatorialGuinea`,e.Greece=`greece`,e.Grenada=`grenada`,e.Greenland=`greenland`,e.Guatemala=`guatemala`,e.FrenchGuiana=`frenchGuiana`,e.Guam=`guam`,e.Guyana=`guyana`,e.HongKong=`hongKong`,e.HeardIslandAndMcDonaldIslands=`heardIslandAndMcDonaldIslands`,e.Honduras=`honduras`,e.Croatia=`croatia`,e.Haiti=`haiti`,e.Hungary=`hungary`,e.Indonesia=`indonesia`,e.IsleOfMan=`isleOfMan`,e.India=`india`,e.BritishIndianOceanTerritory=`britishIndianOceanTerritory`,e.Ireland=`ireland`,e.Iran=`iran`,e.Iraq=`iraq`,e.Iceland=`iceland`,e.Israel=`israel`,e.Italy=`italy`,e.Jamaica=`jamaica`,e.Jersey=`jersey`,e.Jordan=`jordan`,e.Japan=`japan`,e.Kazakhstan=`kazakhstan`,e.Kenya=`kenya`,e.Kyrgyzstan=`kyrgyzstan`,e.Cambodia=`cambodia`,e.Kiribati=`kiribati`,e.SaintKittsAndNevis=`saintKittsAndNevis`,e.SouthKorea=`southKorea`,e.Kuwait=`kuwait`,e.Lao=`lao`,e.Lebanon=`lebanon`,e.Liberia=`liberia`,e.Libya=`libya`,e.SaintLucia=`saintLucia`,e.Liechtenstein=`liechtenstein`,e.SriLanka=`sriLanka`,e.Lesotho=`lesotho`,e.Lithuania=`lithuania`,e.Luxembourg=`luxembourg`,e.Latvia=`latvia`,e.Macao=`macao`,e.FrenchSaintMartin=`frenchSaintMartin`,e.Morocco=`morocco`,e.Monaco=`monaco`,e.Moldova=`moldova`,e.Madagascar=`madagascar`,e.Maldives=`maldives`,e.Mexico=`mexico`,e.MarshallIslands=`marshallIslands`,e.NorthMacedonia=`northMacedonia`,e.Mali=`mali`,e.Malta=`malta`,e.Myanmar=`myanmar`,e.Montenegro=`montenegro`,e.Mongolia=`mongolia`,e.NorthernMarianaIslands=`northernMarianaIslands`,e.Mozambique=`mozambique`,e.Mauritania=`mauritania`,e.Montserrat=`montserrat`,e.Martinique=`martinique`,e.Mauritius=`mauritius`,e.Malawi=`malawi`,e.Malaysia=`malaysia`,e.Mayotte=`mayotte`,e.Namibia=`namibia`,e.NewCaledonia=`newCaledonia`,e.Niger=`niger`,e.NorfolkIsland=`norfolkIsland`,e.Nigeria=`nigeria`,e.Nicaragua=`nicaragua`,e.Niue=`niue`,e.Netherlands=`netherlands`,e.Norway=`norway`,e.Nepal=`nepal`,e.Nauru=`nauru`,e.NewZealand=`newZealand`,e.Oman=`oman`,e.Pakistan=`pakistan`,e.Panama=`panama`,e.Pitcairn=`pitcairn`,e.Peru=`peru`,e.Philippines=`philippines`,e.Palau=`palau`,e.PapuaNewGuinea=`papuaNewGuinea`,e.Poland=`poland`,e.PuertoRico=`puertoRico`,e.NorthKorea=`northKorea`,e.Portugal=`portugal`,e.Paraguay=`paraguay`,e.Palestine=`palestine`,e.FrenchPolynesia=`frenchPolynesia`,e.Qatar=`qatar`,e.Reunion=`reunion`,e.Romania=`romania`,e.Russia=`russia`,e.Rwanda=`rwanda`,e.SaudiArabia=`saudiArabia`,e.Sudan=`sudan`,e.Senegal=`senegal`,e.Singapore=`singapore`,e.SouthGeorgiaAndTheSouthSandwichIslands=`southGeorgiaAndTheSouthSandwichIslands`,e.SaintHelena=`saintHelena`,e.SvalbardAndJanMayen=`svalbardAndJanMayen`,e.SolomonIslands=`solomonIslands`,e.SierraLeone=`sierraLeone`,e.ElSalvador=`elSalvador`,e.SanMarino=`sanMarino`,e.Somalia=`somalia`,e.SaintPierreAndMiquelon=`saintPierreAndMiquelon`,e.Serbia=`serbia`,e.SouthSudan=`southSudan`,e.SaoTomeAndPrincipe=`saoTomeAndPrincipe`,e.Suriname=`suriname`,e.Slovakia=`slovakia`,e.Slovenia=`slovenia`,e.Sweden=`sweden`,e.Eswatini=`eswatini`,e.DutchSintMaarten=`dutchSintMaarten`,e.Seychelles=`seychelles`,e.Syria=`syria`,e.TurksAndCaicosIslands=`turksAndCaicosIslands`,e.Chad=`chad`,e.Togo=`togo`,e.Thailand=`thailand`,e.Tajikistan=`tajikistan`,e.Tokelau=`tokelau`,e.Turkmenistan=`turkmenistan`,e.TimorLeste=`timorLeste`,e.Tonga=`tonga`,e.TrinidadAndTobago=`trinidadAndTobago`,e.Tunisia=`tunisia`,e.Turkey=`turkey`,e.Tuvalu=`tuvalu`,e.Taiwan=`taiwan`,e.Tanzania=`tanzania`,e.Uganda=`uganda`,e.Ukraine=`ukraine`,e.UsMinorOutlyingIslands=`usMinorOutlyingIslands`,e.Uruguay=`uruguay`,e.Us=`us`,e.Uzbekistan=`uzbekistan`,e.HolySee=`holySee`,e.SaintVincentAndTheGrenadines=`saintVincentAndTheGrenadines`,e.Venezuela=`venezuela`,e.BritishVirginIslands=`britishVirginIslands`,e.UsVirginIslands=`usVirginIslands`,e.Vietnam=`vietnam`,e.Vanuatu=`vanuatu`,e.WallisAndFutuna=`wallisAndFutuna`,e.Samoa=`samoa`,e.Kosovo=`kosovo`,e.Yemen=`yemen`,e.SouthAfrica=`southAfrica`,e.Zambia=`zambia`,e.Zimbabwe=`zimbabwe`,e}({});var H=class extends P{constructor(e){super(`any`),this.documentType=`regionSpecific`,this.subtype=e}get region(){return this._region}toJSONObject(){return{region:this.region,documentType:this.documentType,documentSubtype:this.subtype}}},U=class extends P{constructor(e){super(e),this.documentType=`residencePermit`}get region(){return this._region}toJSONObject(){return{region:this.region,documentType:this.documentType}}},W=class extends P{constructor(e){super(e),this.documentType=`visaIcao`}get region(){return this._region}toJSONObject(){return{region:this.region,documentType:this.documentType}}},Xt=class e{get dateOfBirth(){return F.fromJSON(this.json.dateOfBirth)}get dateOfExpiry(){return F.fromJSON(this.json.dateOfExpiry)}get documentNumber(){return this.json.documentNumber}get firstName(){return this.json.firstName}get fullName(){return this.json.fullName}get lastName(){return this.json.lastName}get sex(){return this.json.sex}get nationality(){return this.json.nationality}get address(){return this.json.address}get documentAdditionalNumber(){return this.json.documentAdditionalNumber}get dateOfIssue(){return F.fromJSON(this.json.dateOfIssue)}get issuingJurisdiction(){return this.json.issuingJurisdiction}get issuingJurisdictionIso(){return this.json.issuingJurisdictionIso}static fromJSON(t){let n=new e;return n.json=t,n}toJSONObject(){var e,t,n;return{dateOfBirth:((e=this.dateOfBirth)==null?void 0:e.toJSONObject())??null,dateOfExpiry:((t=this.dateOfExpiry)==null?void 0:t.toJSONObject())??null,dateOfIssue:((n=this.dateOfIssue)==null?void 0:n.toJSONObject())??null,documentNumber:this.documentNumber,documentAdditionalNumber:this.documentAdditionalNumber,firstName:this.firstName,fullName:this.fullName,lastName:this.lastName,sex:this.sex,nationality:this.nationality,address:this.address,issuingJurisdiction:this.issuingJurisdiction,issuingJurisdictionIso:this.issuingJurisdictionIso}}},G=class extends P{constructor(e){super(e),this.documentType=`visaLetter`}get region(){return this._region}toJSONObject(){return{region:this.region,documentType:this.documentType}}},Zt=class e{get firstName(){return this.json.firstName}get lastName(){return this.json.lastName}get fullName(){return this.json.fullName}get sexType(){return this.json.sex}get sex(){return this.json.sex}get dateOfBirth(){return F.fromJSON(this.json.dateOfBirth)}get age(){return this.json.age}get nationality(){return this.json.nationality}get nationalityISO(){return this.json.nationalityISO}get address(){return this.json.address}get document(){if(this.json.documentType!=null){let e=this.json.documentType,t=this.json.documentSubtype,n=this.issuingCountry;switch(e){case`passport`:return new V(n);case`idCard`:return new B(n);case`driverLicense`:return new R(n);case`visaIcao`:return new W(n);case`residencePermit`:return new U(n);case`healthInsuranceCard`:return new z(n);case`regionSpecific`:return new H(t);case`visaLetter`:return new G(n);default:}}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 F.fromJSON(this.json.dateOfExpiry)}get isExpired(){return this.json.isExpired}get isCitizenPassport(){if(typeof this.json.isCitizenPassport!=`boolean`)throw Error(`Missing or invalid property isCitizenPassport in json data`);return this.json.isCitizenPassport}get dateOfIssue(){return F.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!0:return`realIdCompliant`;case!1:return`notRealIdCompliant`;default:return`notAvailable`}}get isCapturingComplete(){return this.json.isCapturingComplete}get barcode(){return this._barcodeResult==null&&this.json.barcodeResult!=null&&(this._barcodeResult=Vt.fromJSON(this.json.barcodeResult)),this._barcodeResult??null}get mrzResult(){return this._mrzResult==null&&this.json.mrzResult!=null&&(this._mrzResult=Ut.fromJSON(this.json.mrzResult)),this._mrzResult??null}get vizResult(){return this._vizResult==null&&this.json.vizResult!=null&&(this._vizResult=Kt.fromJSON(this.json.vizResult)),this._vizResult??null}get mobileDocumentOCRResult(){return this._mobileDocumentOCRResult==null&&this.json.mobileDocumentOcrResult!=null&&(this._mobileDocumentOCRResult=Xt.fromJSON(this.json.mobileDocumentOcrResult)),this._mobileDocumentOCRResult??null}get verificationResult(){return this._verificationResult==null&&this.json.verificationResult!=null&&(this._verificationResult=Jt.fromJSON(this.json.verificationResult)),this._verificationResult??new Jt}get images(){return Ht.fromJSON(this.json.imageInfo)}get anonymizedFields(){return(this.json.anonymizedFields??[]).map(e=>e)}get rejectionDiagnosticJSON(){return this.json.rejectionDiagnosticJSON}isAnonymized(e){return this.anonymizedFields.indexOf(e)!==-1}get barcodeResultsJSON(){var e;return{barcodeResult:((e=this.barcode)==null?void 0:e.toJSONObject())??null}}get mrzResultsJSON(){return{mrzResult:this.mrzResult?this.mrzResult.toJSONObject():null}}static fromJSON(t){let n=new e;return n.json=t,n}isIdCard(){var e;return((e=this.document)==null?void 0:e.isIdCard())??!1}isDriverLicense(){var e;return((e=this.document)==null?void 0:e.isDriverLicense())??!1}isPassport(){var e;return((e=this.document)==null?void 0:e.isPassport())??!1}isVisaIcao(){var e;return((e=this.document)==null?void 0:e.isVisaIcao())??!1}isVisaLetter(){var e;return((e=this.document)==null?void 0:e.isVisaLetter())??!1}isRegionSpecific(e){return this.document?this.document.isRegionSpecific()&&this.document.subtype===e:!1}isResidencePermit(){var e;return((e=this.document)==null?void 0:e.isResidencePermit())??!1}isHealthInsuranceCard(){var e;return((e=this.document)==null?void 0:e.isHealthInsuranceCard())??!1}toJSONObject(){var e,t,n,r,i,a,o,s;return{firstName:this.firstName,lastName:this.lastName,fullName:this.fullName,sex:this.sex,nationality:this.nationality,nationalityISO:this.nationalityISO,address:this.address,issuingCountry:this.issuingCountry,issuingCountryIso:this.issuingCountryIso,documentNumber:this.documentNumber,documentAdditionalNumber:this.documentAdditionalNumber,dateOfBirth:((e=this.dateOfBirth)==null?void 0:e.toJSONObject())??null,age:this.age,dateOfExpiry:((t=this.dateOfExpiry)==null?void 0:t.toJSONObject())??null,isExpired:this.isExpired,dateOfIssue:((n=this.dateOfIssue)==null?void 0:n.toJSONObject())??null,documentType:((r=this.document)==null?void 0:r.documentType)??null,documentSubtype:((i=this.document)==null?void 0:i.isRegionSpecific())==null?null:this.document.subtype,imageInfo:this.images.toJSONObject(),verificationResult:((a=this.verificationResult)==null?void 0:a.toJSONObject())??null,vizResult:((o=this.vizResult)==null?void 0:o.toJSONObject())??null,mobileDocumentOcrResult:((s=this.mobileDocumentOCRResult)==null?void 0:s.toJSONObject())??null,idVerificationDataComparisonAvailable:this.json.idVerificationDataComparisonAvailable,usRealIdStatus:this.usRealIdStatus,isCapturingComplete:this.isCapturingComplete,isCitizenPassport:this.isCitizenPassport,anonymizedFields:this.anonymizedFields,rejectionDiagnosticJSON:this.rejectionDiagnosticJSON,...this.barcodeResultsJSON,...this.mrzResultsJSON}}};const K={IdCapture:{RecommendedCameraSettings:r.fromJSON({zoomFactor:1,zoomGestureZoomFactor:2,focusGestureStrategy:l.ManualUntilCapture,preferredResolution:ee.FullHD}),IdCaptureOverlayDefaults:{defaultCapturedBrush:new n(i.fromJSON(`#00000000`),i.fromJSON(`#FFFFFFFF`),3),defaultLocalizedBrush:new n(i.fromJSON(`#FFFFFF80`),i.fromJSON(`#FFFFFF00`),0),defaultRejectedBrush:new n(i.fromJSON(`#00000000`),i.fromJSON(`#FFFFFFFF`),3)}}};var Qt=class e{get location(){return this._location}static fromJSON(t){let n=new e;return t.location!=null&&(n._location=m.fromJSON(t.location)),n}toJSONObject(){return{location:this.location.toJSONObject()}}};function $t(e){return new m(new p(e.upperLeft.x,e.upperLeft.y),new p(e.upperRight.x,e.upperRight.y),new p(e.lowerRight.x,e.lowerRight.y),new p(e.lowerLeft.x,e.lowerLeft.y))}function q(e){return e==null?null:typeof e.latin==`object`&&e.latin.value.length>0?e.latin:typeof e.arabic==`object`&&e.arabic.value.length>0?e.arabic:typeof e.cyrillic==`object`&&e.cyrillic.value.length>0?e.cyrillic:typeof e.greek==`object`&&e.greek.value.length>0?e.greek:null}function en(e){return e.location!=null&&typeof e.location.x==`number`}function tn(e){return typeof e==`object`&&!!e}function nn(e){return tn(e)?Object.prototype.hasOwnProperty.call(e,`filledByDomainKnowledge`)&&Object.prototype.hasOwnProperty.call(e,`originalString`):!1}function rn(e){return tn(e)?Object.prototype.hasOwnProperty.call(e,`latin`)&&Object.prototype.hasOwnProperty.call(e,`arabic`)&&Object.prototype.hasOwnProperty.call(e,`cyrillic`)&&Object.prototype.hasOwnProperty.call(e,`greek`):!1}function J(e){if(e!=null&&nn(e)&&e.successfullyParsed===!0){if(e.year==null)return null;let t=e;return{day:t.day,month:t.month,year:t.year}}return null}function an(e){let{x:t,y:n,width:r,height:i}=e;return new m(new p(t,n),new p(t+r,n),new p(t+r,n+i),new p(t,n+i)).toJSONObject()}const on={"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`,odisha:`Odisha`,punjab:`Punjab`,"tamil-nadu":`Tamil Nadu`,telangana:`Telangana`,uttarakhand:`Uttarakhand`,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árez, Guerrero`,"guerrero-cocula":`Cocula, Guerrero`,"guerrero-juchitan":`Juchitán, Guerrero`,"guerrero-tepecoacuilco":`Tepecoacuilco de Trujano, Guerrero`,"guerrero-tlacoapa":`Tlacoapa, Guerrero`,hidalgo:`Hidalgo`,jalisco:`Jalisco`,mexico:`México`,michoacan:`Michoacán`,morelos:`Morelos`,nayarit:`Nayarit`,"nuevo-leon":`Nuevo León`,oaxaca:`Oaxaca`,puebla:`Puebla`,"quintana-roo":`Quintana Roo`,"quintana-roo-benito-juarez":`Benito Juárez, Quintana Roo`,"quintana-roo-solidaridad":`Solidaridad, Quintana Roo`,"quintana-roo-cozumel":`Cozumel, Quintana Roo`,queretaro:`Querétaro`,"san-luis-potosi":`San Luis Potosí`,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`,acre:`Acre`,alagoas:`Alagoas`,ceara:`Ceará`,"distrito-federal":`Federal District`,"espirito-santo":`Espirito Santo`,goias:`Goiás`,maranhao:`Maranhão`,"mato-grosso":`Mato Grosso`,"mato-grosso-do-sul":`Mato Grosso do Sul`,"minas-gerais":`Minas Gerais`,para:`Pará`,paraiba:`Paraíba`,parana:`Paraná`,pernambuco:`Pernambuco`,piaui:`Piauí`,"rio-de-janeiro":`Rio de Janeiro`,"rio-grande-do-norte":`Rio Grande do Norte`,"rio-grande-do-sul":`Rio Grand do Sul`,"santa-catarina":`Santa Catarina`,"sao-paolo":`Sao Paolo`,sergipe:`Sergipe`,tocantins:`Tocantins`,bangsamoro:`Bangsamoro`};function sn(e){return e==null?null:on[e]??null}var cn=class e{constructor(e){this.workerCall=e}static create(t){return new e(t)}async createDrivingLicenseDetailsFromCentaurusData(e,t,n){let r=await this.workerCall(`idCaptureDrivingLicenseDetailsCreateWithCentaurusData`,{details:{vehicleClass:e,restrictions:t,endorsements:n}});return I.fromJSON(r.result)}};const ln={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`};let un=function(e){return e.UsBorderCrossingCard=`usBorderCrossingCard`,e.ChinaExitEntryPermit=`chinaExitEntryPermit`,e.UsGlobalEntryCard=`usGlobalEntryCard`,e.ChinaMainlandTravelPermitTaiwan=`chinaMainlandTravelPermitTaiwan`,e.UsNexusCard=`usNexusCard`,e.ChinaMainlandTravelPermitHongKongMacau=`chinaMainlandTravelPermitHongKongMacau`,e.ApecBusinessTravelCard=`apecBusinessTravelCard`,e.PakistanAfghanCitizenCard=`pakistanAfghanCitizenCard`,e.SingaporeFinCard=`singaporeFinCard`,e.MalaysiaIkad=`malaysiaIkad`,e.MalaysiaMykad=`malaysiaMykad`,e.MalaysiaMypr=`malaysiaMypr`,e.MexicoConsularVoterId=`mexicoConsularVoterId`,e.GermanyEid=`germanyEid`,e.UsCommonAccessCard=`usCommonAccessCard`,e.PhilippinesMultipurposeId=`philippinesMultipurposeId`,e.MalaysiaMykas=`malaysiaMykas`,e.MalaysiaMykid=`malaysiaMykid`,e.MalaysiaMytentera=`malaysiaMytentera`,e.MexicoProfessionalId=`mexicoProfessionalId`,e.MalaysiaRefugeeId=`malaysiaRefugeeId`,e.CanadaTribalId=`canadaTribalId`,e.UsUniformedServicesId=`usUniformedServicesId`,e.UsVeteranId=`usVeteranId`,e.PhilippinesWorkPermit=`philippinesWorkPermit`,e.SingaporeWorkPermit=`singaporeWorkPermit`,e.UsWorkPermit=`usWorkPermit`,e.PhilippinesSocialSecurityCard=`philippinesSocialSecurityCard`,e.SwedenSocialSecurityCard=`swedenSocialSecurityCard`,e.CanadaSocialSecurityCard=`canadaSocialSecurityCard`,e.UsSocialSecurityCard=`usSocialSecurityCard`,e.BelgiumMinorsId=`belgiumMinorsId`,e.ColombiaMinorsId=`colombiaMinorsId`,e.PeruMinorsId=`peruMinorsId`,e.BoliviaMinorsId=`boliviaMinorsId`,e.HungaryAddressCard=`hungaryAddressCard`,e.UkAsylumRequest=`ukAsylumRequest`,e.CanadaCitizenshipCertificate=`canadaCitizenshipCertificate`,e.SingaporeEmploymentPass=`singaporeEmploymentPass`,e.CanadaMinorsPublicServicesCard=`canadaMinorsPublicServicesCard`,e.MalaysiaMypolis=`malaysiaMypolis`,e.PhilippinesNbiClearance=`philippinesNbiClearance`,e.IndiaPanCard=`indiaPanCard`,e.PhilippinesPostalId=`philippinesPostalId`,e.PakistanProofOfRegistration=`pakistanProofOfRegistration`,e.SingaporeSPass=`singaporeSPass`,e.SwedenSisId=`swedenSisId`,e.ColombiaTemporaryProtectionPermit=`colombiaTemporaryProtectionPermit`,e.UsTwicCard=`usTwicCard`,e.UsWeaponPermit=`usWeaponPermit`,e.CanadaWeaponPermit=`canadaWeaponPermit`,e.IrelandPublicServicesCard=`irelandPublicServicesCard`,e.CanadaPublicServicesCard=`canadaPublicServicesCard`,e.PakistanConsularId=`pakistanConsularId`,e.GuatemalaConsularId=`guatemalaConsularId`,e.MexicoConsularId=`mexicoConsularId`,e.PhilippinesTaxId=`philippinesTaxId`,e.MexicoTaxId=`mexicoTaxId`,e.ChinaOneWayPermit=`chinaOneWayPermit`,e.UsMedicalMarijuanaCard=`usMedicalMarijuanaCard`,e.UsMunicipalId=`usMunicipalId`,e.AustraliaAsicCard=`australiaAsicCard`,e.UaeVehicleRegistrationCard=`uaeVehicleRegistrationCard`,e.UaeEsaadCard=`uaeEsaadCard`,e.UkMilitaryId=`ukMilitaryId`,e.ChinaBusinessTravelPermitHongKongMacau=`chinaBusinessTravelPermitHongKongMacau`,e.IrelandAgeCard=`irelandAgeCard`,e}({});const dn={additionalAddressInformation:`additional address information`,additionalNameInformation:`additional name information`,address:`address`,bloodType:`blood type`,dateOfBirth:`date of birth`,dateOfExpiry:`date of expiry`,dateOfIssue:`date of issue`,documentAdditionalNumber:`document additional number`,documentNumber:`document number`,employer:`employer`,fathersName:`fathers name`,firstName:`first name`,fullName:`full name`,issuingAuthority:`issuing authority`,lastName:`last name`,maritalStatus:`marital status`,mothersName:`mothers name`,nationality:`nationality`,personalIdNumber:`personal id number`,placeOfBirth:`place of birth`,profession:`profession`,race:`race`,religion:`religion`,residentialStatus:`residential status`,sex:`sex`},fn=[`field-identification-failed`,`invalid-characters-found`,`mandatory-field-missing`,`detection-failed`,`image-return-failed`,`image-preprocessing-failed`,`stability-test-failed`,`not-scanned`];var pn=class{constructor(e){this.workerCallProvider=e}async processResult(e,t,n){return this.hasFrontVIZResult(e)?fn.includes(t.processingStatus)?(M(`CentaurusResultProcessor: Invalid capture status "${t.processingStatus}", return null.`),null):{nationalityISO:null,mrzResult:null,barcodeResult:null,mobileDocumentOcrResult:null,verificationResult:null,vizResult:await this.getVizResult(e,t,n),imageInfo:this.getImageData(e),rejectionDiagnosticJSON:null}:null}isBackSideCaptureSupported(e,t){let{scanningStatus:n}=e;return n===`side-scanned`||t.subResults.length>1}async getVizResult(e,t,n){var r,i;let a={...await this.extractVizData(t.documentClassInfo,e,n),usRealIdStatus:this.getRealIdStatus(t),capturedSides:`frontOnly`,isBackSideCaptureSupported:this.isBackSideCaptureSupported(n,e),frontFieldLocations:this.getFieldLocations(((r=e.subResults[0])==null?void 0:r.viz)??{}),backFieldLocations:this.getFieldLocations(((i=e.subResults[1])==null?void 0:i.viz)??{}),location:this.getLocation(t),visaDetails:null};if(this.adjustResultForSpecialCases(e,a),n.scanningStatus===`document-scanned`&&this.hasFrontAndBackVIZResult(e)){a.capturedSides=`frontAndBack`;let t=[`address`,`dateOfBirth`,`dateOfExpiry`,`dateOfIssue`,`documentNumber`,`firstName`,`fullName`,`lastName`,`nationality`,`sex`,`additionalAddressInformation`,`additionalNameInformation`,`documentAdditionalNumber`,`employer`,`issuingAuthority`,`maritalStatus`,`personalIdNumber`,`placeOfBirth`,`profession`,`race`,`religion`,`residentialStatus`,`mothersName`,`fathersName`],n=e.subResults[1].viz;for(let e of t){let t=a[e]==null||a[e]===``,r=n==null?void 0:n[e];t&&r!=null&&this.handleEmptyFrontValue(a,e,r)}}return a}handleEmptyFrontValue(e,t,n){if(nn(n)){let r=J(n);r&&(e[t]=r)}else if(rn(n)){let r=q(n);r!=null&&r.value&&r.value.length>0&&(e[t]=r.value)}}async extractVizData(e,t,n){var r,i,a,o;let s=t.subResults[0].viz;function c(e){var t;return e==null?null:((t=q(e))==null?void 0:t.value)??null}function l(){return s.additionalNameInformation?c(s.additionalNameInformation):c(t.additionalNameInformation)}let u=c((r=t.driverLicenseDetailedInfo)==null?void 0:r.vehicleClass)??``,d=c((i=t.driverLicenseDetailedInfo)==null?void 0:i.restrictions)??``,f=c((a=t.driverLicenseDetailedInfo)==null?void 0:a.endorsements)??``,p=this.workerCallProvider(),m=null;p&&(u.length>0||d.length>0||f.length>0)&&(m=await cn.create(p).createDrivingLicenseDetailsFromCentaurusData(u,d,f));let[h,ee]=hn(e.type,e.country)??[null,null],te=e.type===`voter-id`;return{address:c(s.address),additionalAddressInformation:c(s.additionalAddressInformation),additionalNameInformation:l(),bloodType:c(s.bloodType),dateOfBirth:J(s.dateOfBirth),dateOfExpiry:J(s.dateOfExpiry)??mn((o=t.driverLicenseDetailedInfo)==null?void 0:o.vehicleClassesInfo),dateOfIssue:J(s.dateOfIssue),documentAdditionalNumber:c(s.documentAdditionalNumber),documentNumber:c(s.documentNumber),documentType:h,documentSubtype:ee,drivingLicenseDetails:(m==null?void 0:m.toJSONObject())??null,employer:c(s.employer),fathersName:c(s.fathersName),firstName:c(s.firstName),fullName:c(s.fullName)??``,issuingAuthority:c(s.issuingAuthority),issuingCountryIso:e.isoAlpha3CountryCode??null,issuingCountry:ln[e.isoAlpha3CountryCode??``]??null,issuingJurisdictionIso:null,lastName:c(s.lastName),maritalStatus:c(s.maritalStatus),mothersName:c(s.mothersName),mrzDetected:n.mrzExtracted,isVoterCard:te,nationality:c(s.nationality),passportNumber:null,personalIdNumber:c(s.personalIdNumber),placeOfBirth:c(s.placeOfBirth),profession:c(s.profession),race:c(s.race),religion:c(s.religion),residentialStatus:c(s.residentialStatus),sex:c(s.sex),sexOriginal:c(s.sex),issuingJurisdiction:sn(e.region),sponsor:c(s.sponsor),vehicleOwner:c(s.vehicleOwner),visaNumber:null}}adjustResultForSpecialCases(e,t){let n=e.documentClassInfo;if(n.country===`germany`&&n.type===`id`){var r,i;t.lastName=((i=q(e.lastName?e.lastName:(r=e.subResults[0].viz)==null?void 0:r.lastName))==null?void 0:i.value)??null}}getFieldLocations(e){let t={};for(let[n,r]of Object.entries(e)){let e=n in dn?dn[n]:n;if(typeof r==`object`&&r){if(nn(r)){let n=q(r.originalString);n&&en(n)&&(t[e]=an(n.location))}else if(rn(r)){let n=q(r);n!=null&&en(n)&&(t[e]=an(n.location))}}}return t}getLocation(e){return e.documentDetectionStatus===`failed`||!e.documentLocation?null:$t(e.documentLocation).toJSONObject()}getImageBase64String(e){if(e==null)return null;let t=document.createElement(`canvas`);t.width=e.width,t.height=e.height;let n=t.getContext(`2d`);return n?(n.putImageData(e,0,0),t.toDataURL(`image/jpeg`,1).split(`,`)[1]):null}getImageData(e){var t;let[n,r]=e.subResults,i={face:this.getImageBase64String(n==null||(t=n.faceImage)==null?void 0:t.image)};return this.hasFrontAndBackVIZResult(e)?{front:{...i,croppedDocument:this.getImageBase64String(n.documentImage),frame:null},back:{face:null,croppedDocument:this.getImageBase64String(r==null?void 0:r.documentImage),frame:null}}:{front:{...i,croppedDocument:this.getImageBase64String(n==null?void 0:n.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 mn(e){let t=(e??[]).map(e=>J(e.expiryDate)).filter(e=>e!=null);if(t.length===0)return null;let n=e=>(e.year??0)*1e4+(e.month??0)*100+(e.day??0);return t.reduce((e,t)=>n(t)>n(e)?t:e)}function hn(e,t){if(e==null)return null;switch(e){case`id`:case`voter-id`:case`passport-card`:case`proof-of-registration`:case`non-voter-id`:case`gendarmerie-id`:case`police-id`:case`nin-card`:return[`idCard`,null];case`proof-of-age-card`:return vn(t);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`:case`emergency-passport`:case`temporary-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 _n(t);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 yn(t);case`work-permit`:return bn(t);case`ikad`:return[`regionSpecific`,`malaysiaIkad`];case`military-id`:return gn(t);case`mykas`:return[`regionSpecific`,`malaysiaMykas`];case`mysss-card`:return[`regionSpecific`,`philippinesSocialSecurityCard`];case`social-security-card`:return xn(t);case`s-pass`:return[`regionSpecific`,`singaporeSPass`];case`address-card`:return[`regionSpecific`,`hungaryAddressCard`];case`green-card`:return[`residencePermit`,null];case`minors-id`:return Sn(t);case`postal-id`:return[`regionSpecific`,`philippinesPostalId`];case`tax-id`:return Cn(t);case`weapon-permit`:return wn(t);case`border-crossing-card`:return[`regionSpecific`,`usBorderCrossingCard`];case`global-entry-card`:return[`regionSpecific`,`usGlobalEntryCard`];case`mypolis`:return[`regionSpecific`,`malaysiaMypolis`];case`nexus-card`:return[`regionSpecific`,`usNexusCard`];case`refugee-id`:return[`regionSpecific`,`malaysiaRefugeeId`];case`tribal-id`:case`metis-federation-card`:case`non-card-tribal-id`:return[`regionSpecific`,`canadaTribalId`];case`veteran-id`:return[`regionSpecific`,`usVeteranId`];case`citizenship-certificate`:return[`regionSpecific`,`canadaCitizenshipCertificate`];case`minors-public-services-card`:return[`regionSpecific`,`canadaMinorsPublicServicesCard`];case`asylum-request`:return[`regionSpecific`,`ukAsylumRequest`];case`uniformed-services-id`:return[`regionSpecific`,`usUniformedServicesId`];case`consular-voter-id`:return[`regionSpecific`,`mexicoConsularVoterId`];case`twic-card`:return[`regionSpecific`,`usTwicCard`];case`nbi-clearance`:return[`regionSpecific`,`philippinesNbiClearance`];case`temporary-protection-permit`:return[`regionSpecific`,`colombiaTemporaryProtectionPermit`];case`afghan-citizen-card`:return[`regionSpecific`,`pakistanAfghanCitizenCard`];case`eid`:return[`regionSpecific`,`germanyEid`];case`sis-id`:return[`regionSpecific`,`swedenSisId`];case`asic-card`:return[`regionSpecific`,`australiaAsicCard`];case`vehicle-registration`:return[`regionSpecific`,`uaeVehicleRegistrationCard`];case`esaad-card`:return[`regionSpecific`,`uaeEsaadCard`];case`medical-marijuana-id`:return[`regionSpecific`,`usMedicalMarijuanaCard`];case`exit-entry-permit`:return[`regionSpecific`,`chinaExitEntryPermit`];case`mainland-travel-permit-taiwan`:return[`regionSpecific`,`chinaMainlandTravelPermitTaiwan`];case`registration-certificate`:return[`residencePermit`,null];case`diplomatic-id`:case`bidoon-card`:case`pass`:case`my-number-card`:case`adr-certificate`:return null;default:te(e)}return null}function gn(e){return e===`uk`?[`regionSpecific`,`ukMilitaryId`]:[`regionSpecific`,`usCommonAccessCard`]}function _n(e){switch(e){case`pakistan`:return[`regionSpecific`,`pakistanConsularId`];case`guatemala`:return[`regionSpecific`,`guatemalaConsularId`];case`mexico`:return[`regionSpecific`,`mexicoConsularId`];default:return[`regionSpecific`,null]}}function vn(e){switch(e){case`ireland`:return[`regionSpecific`,`irelandAgeCard`];default:return[`idCard`,null]}}function yn(e){switch(e){case`ireland`:return[`regionSpecific`,`irelandPublicServicesCard`];case`canada`:return[`regionSpecific`,`canadaPublicServicesCard`];default:return[`regionSpecific`,null]}}function bn(e){switch(e){case`philippines`:return[`regionSpecific`,`philippinesWorkPermit`];case`singapore`:return[`regionSpecific`,`singaporeWorkPermit`];case`usa`:return[`regionSpecific`,`usWorkPermit`];default:return[`regionSpecific`,null]}}function xn(e){switch(e){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 Sn(e){switch(e){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 Cn(e){switch(e){case`philippines`:return[`regionSpecific`,`philippinesTaxId`];case`mexico`:return[`regionSpecific`,`mexicoTaxId`];default:return[`regionSpecific`,null]}}function wn(e){switch(e){case`usa`:return[`regionSpecific`,`usWeaponPermit`];case`canada`:return[`regionSpecific`,`canadaWeaponPermit`];default:return[`regionSpecific`,null]}}var Y=class{constructor(e,t,n){this.isDeleted=!1,this.isRecreating=!1,this.centaurusWasmSDK=e,this.idCaptureSettings=t,this.scannerDefaultSettings=n}get type(){return this._type}async process(e){return{...await this.session.process(e),centaurusResult:await this.getResult()}}async getResult(){if(this.isDeleted||this.isRecreating)throw Error(`Cannot call getResult() on ${this._type} session that is ${this.isDeleted?`deleted`:`being recreated`}`);return this.session.getResult()}async delete(){this.isDeleted||(this.isDeleted=!0,await this.session.delete())}async createSession(e){var t;let n={inputImageSource:this.inputImageSource,scanningMode:(t=this.idCaptureSettings.scanner.physicalDocument)!=null&&t.isSingleSideScanner()?`single`:`automatic`,scanningSettings:{anonymizationMode:null,scanCroppedDocumentImage:(e==null?void 0:e.scanCroppedDocumentImage)??!1,skipImagesOccludedByHand:this.scannerDefaultSettings.skipImagesOccludedByHand,combineResultsFromMultipleInputImages:this.scannerDefaultSettings.combineResultsFromMultipleInputImages,scanUnsupportedBack:this.scannerDefaultSettings.scanUnsupportedBack,recognitionModeFilter:{enableBarcodeId:this.scannerDefaultSettings.filter.enableBarcodeId,enableFullDocumentRecognition:!(e!=null&&e.detectionOnlyMode)&&this.scannerDefaultSettings.filter.enableFullDocumentRecognition,enableMrzId:this.scannerDefaultSettings.filter.enableMrzId,enableMrzPassport:this.scannerDefaultSettings.filter.enableMrzPassport,enableMrzVisa:this.scannerDefaultSettings.filter.enableMrzVisa,enablePhotoId:this.scannerDefaultSettings.filter.enablePhotoId},croppedImageSettings:{returnDocumentImage:this.idCaptureSettings.getShouldPassImageTypeToResult(`croppedDocument`)||this.shouldEnforceCroppedDocumentImage(),returnFaceImage:this.idCaptureSettings.getShouldPassImageTypeToResult(`face`)}}};M(`Creating Centaurus session of type ${this.type} with settings:`,n);let 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(e=>String.fromCodePoint(e)).join(``);return this.centaurusWasmSDK[r](n)}shouldEnforceCroppedDocumentImage(){return this.idCaptureSettings.getShouldPassImageTypeToResult(`frame`)&&(this.idCaptureSettings.anonymizationMode===`imagesOnly`||this.idCaptureSettings.anonymizationMode===`fieldsAndImages`)}},Tn=class e extends Y{constructor(...e){super(...e),this._type=`default`,this.inputImageSource=`video`}static async create(t,n,r){let i=new e(t,n,r);return i.session=await i.createSession(),i}},En=class e extends Y{constructor(...e){super(...e),this._type=`localizeOnly`,this.inputImageSource=`video`,this.needsRecreation=!1}static async create(t,n,r){let i=new e(t,n,r);return i.session=await i.createSession(),i}async createSession(){return super.createSession({detectionOnlyMode:!0})}async process(e){this.needsRecreation&&await this.recreateSession();let t=await super.process(e);return t.resultCompleteness.scanningStatus===`document-scanned`&&(this.needsRecreation=!0),t}async recreateSession(){this.needsRecreation=!1,this.isRecreating=!0;try{await this.session.delete(),this.session=await this.createSession()}finally{this.isRecreating=!1}}},Dn=class e extends Y{constructor(...e){super(...e),this._type=`photoMode`,this.inputImageSource=`photo`}static async create(t,n,r){let i=new e(t,n,r);return i.session=await i.createSession(),i}},On=class e extends Y{constructor(...e){super(...e),this._type=`scanCroppedDocument`,this.inputImageSource=`photo`}static async create(t,n,r,i){let a=new e(t,n,r);return a.session=await a.createSession({scanCroppedDocumentImage:!0}),a.resultProcessor=i,a}async process(e){let t=await this.doProcess(e);if(t.hasCapturedId)return t;M(`No capturedId, trying with scaled images`);for(let n of[.9,.8,.7]){M(`Trying with zoom level ${n}`);let r=await this.scaleImage(this.imageDataFromArrayBuffer(t.arrayBuffer,e.width,e.height),n);if(r){if(t=await this.doProcess(r),t.hasCapturedId)return t}else M(`Failed to scale image, skipping for zoom level ${n}`)}return t}async scaleImage(e,t){let n=document.createElement(`canvas`);n.width=e.width,n.height=e.height;let r=n.getContext(`2d`);if(r){r.fillStyle=`#000000`,r.fillRect(0,0,n.width,n.height),r.scale(t,t);let a=[(n.width/t-e.width)/2,(n.height/t-e.height)/2];if(typeof createImageBitmap<`u`){let t=await createImageBitmap(e);r.drawImage(t,a[0],a[1],e.width,e.height),t.close()}else{var i;let t=document.createElement(`canvas`);t.width=e.width,t.height=e.height,(i=t.getContext(`2d`))==null||i.putImageData(e,0,0),r.drawImage(t,a[0],a[1],e.width,e.height)}return r.getImageData(0,0,n.width,n.height)}return null}async doProcess(e){let{inputImageAnalysisResult:t,resultCompleteness:n,arrayBuffer:r}=await this.session.process(e),i=await this.getResult();return{inputImageAnalysisResult:t,resultCompleteness:n,arrayBuffer:r,centaurusResult:i,hasCapturedId:await this.resultProcessor.processResult(i,t,n)!=null}}imageDataFromArrayBuffer(e,t,n){return new ImageData(new Uint8ClampedArray(e),t,n,{colorSpace:`srgb`})}},kn=class e extends Y{constructor(...e){super(...e),this._type=`combinedSingleImage`,this.inputImageSource=`photo`,this.lastSessionUsed=null}static async create(t,n,r,i){let a=new e(t,n,r);return a.photoModeSession=await Dn.create(t,n,r),a.croppedDocumentSession=await On.create(t,n,r,i),a}async process(e){if(this.lastSessionUsed!==null)return this.processWithSession(e,this.lastSessionUsed);let t=await this.processWithSession(e,this.photoModeSession);return this.hasPositiveResult(t)?t:this.processWithSession(e,this.croppedDocumentSession)}async delete(){this.isDeleted||=(await this.photoModeSession.delete(),await this.croppedDocumentSession.delete(),!0)}async processWithSession(e,t){let n=await t.process(e);return this.hasPositiveResult(n)&&(this.lastSessionUsed=t),n}hasPositiveResult(e){return e.resultCompleteness.scanningStatus===`side-scanned`||e.resultCompleteness.scanningStatus===`document-scanned`}},An=class{constructor(e,t){this.isProcessing=!1,this._lastError=null,this._lastResult=null,this._lastLocalization=null,this._initialized=!1,this._currentFrameSourceType=null,this._engagedSession=null,this._isDetectionOnlyMode=!1,this._hasDefaultSessionFullResult=!1,this.centaurusWasmSDK=e,this._workerCallProvider=t}get engagedSession(){return this._engagedSession??null}get lastError(){return this._lastError}set engagedSession(e){this._engagedSession!==e&&(M(`Setting engaged session to: ${e.type}`),this._engagedSession=e)}async init(e,t,n){var r;this.idCaptureSettings=e.clone(),this.resultProcessor=new pn(this._workerCallProvider),this.scannerDefaultSettings=t,this._currentFrameSourceType=(n==null||(r=n.toJSONObject())==null?void 0:r.type)??null,await this.createAllSessions(),this._lastResult=null,this._lastError=null,this._lastLocalization=null,this._initialized=!0}isReadyToProcessFrame(){return this.isProcessing===!1}async processFrame(e){this.isProcessing=!0,this._lastError=null;try{let t=this.autoSelectSession();this.engagedSession=t;let{inputImageAnalysisResult:n,resultCompleteness:r,arrayBuffer:i,centaurusResult:a}=await t.process({...e,colorSpace:`srgb`});_t(()=>{M(`Centaurus result after processing frame (${t.type} session):`,{scanningSide:n.scanningSide,processingStatus:n.processingStatus,resultCompleteness:r.scanningStatus,vizExtracted:r.vizExtracted,documentDetectionStatus:n.documentDetectionStatus,result:a}),this.displayDetectionStatusInUI(n.documentDetectionStatus)});let o=null;if(this.engagedSession!==this.localizeOnlySession)try{o=await this.resultProcessor.processResult(a,n,r),r.scanningStatus===`document-scanned`&&(M(`Centaurus: document fully scanned`),this._hasDefaultSessionFullResult=!0)}catch(e){this._lastError={type:`ParsingError`,message:e instanceof Error?e.message:String(e)},M(`Centaurus: error processing result`,e),o=null}let s=this.toLocalizedOnlyId(this.resultProcessor.getLocation(n)),c=this.toDetectionIssue(n.documentDetectionStatus),l=this.extractDiagnosticJSON(n);return{arrayBuffer:i,capturedId:o,localizedOnlyId:s,detectionIssue:c,diagnostics:l}}finally{this.isProcessing=!1}}async reset(){M(`Resetting Centaurus`),await this.deleteAllSessions(),await this.createAllSessions(),this._lastResult=null,this._lastError=null,this._lastLocalization=null,this._hasDefaultSessionFullResult=!1}async deleteAllSessions(){for(let e of[this.defaultSession,this.localizeOnlySession,this.combinedSingeImageSession])await(e==null?void 0:e.delete())}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.combinedSingeImageSession,this.localizeOnlySession])await(e==null?void 0:e.delete())}async onFrameSourceChanged(e){var t;if(!this._initialized)return;let n=(e==null||(t=e.toJSONObject())==null?void 0:t.type)??null;n!==this._currentFrameSourceType&&(M(`Frame source changed from`,this._currentFrameSourceType,`to`,n),this._currentFrameSourceType=n)}async createAllSessions(){M(`Creating all centaurus sessions`),this.defaultSession=await Tn.create(this.centaurusWasmSDK,this.idCaptureSettings,this.scannerDefaultSettings),this.combinedSingeImageSession=await kn.create(this.centaurusWasmSDK,this.idCaptureSettings,this.scannerDefaultSettings,this.resultProcessor),this.localizeOnlySession=await En.create(this.centaurusWasmSDK,this.idCaptureSettings,this.scannerDefaultSettings)}autoSelectSession(){return this._hasDefaultSessionFullResult||this._isDetectionOnlyMode?this.localizeOnlySession:this._currentFrameSourceType===`singleImageUploader`||this._currentFrameSourceType===`imageFrameSource`?this.combinedSingeImageSession:this.defaultSession}toLocalizedOnlyId(e){return e==null?null:Qt.fromJSON({location:e})}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}extractDiagnosticJSON(e){try{var t;let n={};switch(n.idType=`viz`,e.blurDetectionStatus===`detected`&&(n.blurDetected=!0),e.glareDetectionStatus===`detected`&&(n.glareDetected=!0),e.documentLightingStatus){case`too-dark`:n.lightingIssue=`tooDark`;break;case`too-bright`:n.lightingIssue=`tooBright`;break}return e.documentHandOcclusionStatus===`detected`&&(n.occlusionDetected=!0),((t=e.missingMandatoryFields)==null?void 0:t.length)>0&&(n.mandatoryFieldsMissing=e.missingMandatoryFields.map(e=>e.rawValue?e.rawValue:e)),Object.keys(n).length>1?JSON.stringify(n):null}catch(e){return M(`Error extracting diagnostics:`,e),null}}displayDetectionStatusInUI(e){let t=window,n=t.centaurusDetectionStatus;n??(n=document.createElement(`div`),n.className=`centaurusDetectionStatus`,n.style.position=`absolute`,n.style.zIndex=`1000`,n.style.top=`10px`,n.style.left=`10px`,n.style.padding=`0 1rem`,n.style.backgroundColor=`white`,document.body.append(n),t.centaurusDetectionStatus=n),n.textContent=`LocalizedStatus: ${e}`}},jn=class e{constructor(e){this.blurDetected=e.blurDetected??!1,this.glareDetected=e.glareDetected??!1,this.occlusionDetected=e.occlusionDetected??!1,this.lightingIssue=e.lightingIssue??null,this.mandatoryFieldsMissing=e.mandatoryFieldsMissing??[]}static fromJSON(t){return new e(t)}};let Mn=function(e){return e.NotAcceptedDocumentType=`notAcceptedDocumentType`,e.InvalidFormat=`invalidFormat`,e.DocumentVoided=`documentVoided`,e.Timeout=`timeout`,e.SingleImageNotRecognized=`singleImageNotRecognized`,e.DocumentExpired=`documentExpired`,e.DocumentExpiresSoon=`documentExpiresSoon`,e.NotRealIdCompliant=`notRealIdCompliant`,e.HolderUnderage=`holderUnderage`,e.ForgedAamvaBarcode=`forgedAamvaBarcode`,e.InconsistentData=`inconsistentData`,e.CloudRequestFailed=`cloudRequestFailed`,e}({});var Nn=class{constructor(e){this.quadType=e}async outlineRegions(e,t){let n=await this.renderImage(e);n.beginPath(),n.rect(0,0,n.canvas.width,n.canvas.height);for(let e of t)n.moveTo(e.topLeft.x,e.topLeft.y),n.lineTo(e.topLeft.x,e.bottomRight.y),n.lineTo(e.bottomRight.x,e.bottomRight.y),n.lineTo(e.bottomRight.x,e.topLeft.y),n.lineTo(e.topLeft.x,e.topLeft.y);n.fillStyle=`rgba(0, 0, 0, 0.30)`,n.fill(),n.lineWidth=3,n.strokeStyle=`red`,n.beginPath();for(let e of t)n.rect(e.topLeft.x,e.topLeft.y,e.bottomRight.x-e.topLeft.x,e.bottomRight.y-e.topLeft.y);return n.stroke(),n.canvas.toDataURL(`image/jpeg`,1)}async obscureRegions(e,t){let n=await this.renderImage(e);n.beginPath(),n.fillStyle=`black`;for(let e of t)n.rect(e.topLeft.x,e.topLeft.y,e.bottomRight.x-e.topLeft.x,e.bottomRight.y-e.topLeft.y);return n.fill(),n.canvas.toDataURL(`image/jpeg`,1)}get canvas(){return this._canvas||=document.createElement(`canvas`),this._canvas}async renderImage(e){let t=await this.loadImage(e);this.canvas.width=t.naturalWidth,this.canvas.height=t.naturalHeight;let n=this.canvas.getContext(`2d`);return n.drawImage(t,0,0),n}async loadImage(e){let t=new Image;return t.src=e,await t.decode(),t}};const X=`reloadDetector`;var Pn=class e{constructor(t,n=e.DEFAULT_WRITE_INTERVAL_MS){this._lastWrite=0,this._storage=t,this._writeIntervalMs=n}hasDataAlreadyWritten(){return this._storage.getItem(X)!==null}write(e){return this._pendingData={...e},this.scheduleWrite(),e}read(){if(this._pendingData)return this._pendingData;let e=this._storage.getItem(X)??`{}`;return JSON.parse(e)}clear(){this._storage.removeItem(X),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(X,JSON.stringify(this._pendingData)),this._pendingData=void 0,this._lastWrite=performance.now()):this._writeTimer=setTimeout(this.scheduleWrite.bind(this),this._writeIntervalMs-e)}};Pn.DEFAULT_WRITE_INTERVAL_MS=500;var Fn=class{constructor(e){this.onUnload=()=>{this._storage.clear()},this._onPageAbruptlyReloaded=e,this._storage=new Pn(this.getStorage())}static isSafari(){return t.isSafari()}install(){if(t.isSafari()){if(window.addEventListener(`unload`,this.onUnload,{once:!0}),!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 ne.getInstanceFor(`sessionStorage`)}},In=class e{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),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(t){this._framesProcessedCount=t,this._upTimeTimer??=(this._firstFrameProcessedTime=performance.now(),setInterval(this.updateUpTime.bind(this),e.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))}};In.UP_TIME_UPDATE_INTERVAL_MS=500;const Z=Symbol(`ID Capture internals`),Ln={standby:`standby`,active:`active`,scanning:`scanning`};var Rn=class{constructor(){this.type=`shutter`,this.controlsLayout=void 0}toJSONObject(){return{type:this.type}}async install(e){if(this.controlsLayout=e.controlsElement,!this.shutterButton){let{ShutterButton:e}=await import(`@scandit/web-datacapture-core/build/js/private/ui/atoms/ShutterButton.js`);this.shutterButton||(e.register(),this.shutterButton=e.create(),this.shutterButton.style.margin=`0`,this.shutterButton.style.position=`absolute`,this.shutterButton.style.pointerEvents=`all`,this.shutterButton.style.width=`32px`,this.shutterButton.style.height=`32px`,this.shutterButton.style.backgroundColor=`transparent`,this.shutterButton.style.backgroundRepeat=`no-repeat`,this.shutterButton.style.border=`none`,this.shutterButton.style.cursor=`pointer`,this.lastPositionReceived&&this.applyPositioning(this.lastPositionReceived))}return this.appendShutterButton(),!0}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=!0,this.shutterButton.pulse=!1;break;case`standby`:this.shutterButton.rotating=!1,this.shutterButton.pulse=!1;break;case`active`:this.shutterButton.rotating=!1,this.shutterButton.pulse=!0;break}}remove(e){var t;(t=this.shutterButton)==null||t.remove(),e===!0&&(this.shutterButton=void 0,this.controlsLayout=void 0)}appendShutterButton(){this.shutterButton&&this.controlsLayout&&!this.controlsLayout.contains(this.shutterButton)&&this.controlsLayout.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`)}},zn=class e extends re{static get observedAttributes(){return[`visible`]}constructor(){super();let t=this.attachShadow({mode:`open`});t.innerHTML=oe`<div class="line"></div><div class="text"><slot></slot></div>`,t.append(e.createStyleElement().cloneNode(!0)),t.querySelector(`slot`).addEventListener(`slotchange`,()=>this.updateTextVisibility()),this.updateTextVisibility()}attributeChangedCallback(e,t,n){this.updateTextVisibility()}get visible(){return this.hasAttribute(`visible`)}set visible(e){this.toggleAttribute(`visible`,e)}updateTextVisibility(){let e=this.shadowRoot.querySelector(`slot`),t=this.shadowRoot.querySelector(`.text`),n=e.assignedNodes({flatten:!0}).some(e=>{var t;return e.nodeType!==Node.TEXT_NODE||(((t=e.textContent)==null?void 0:t.trim())??``)!==``});t.style.display=n?``:`none`}static create(){return e.register(),document.createElement(e.tag)}static register(){ae({[e.tag]:e})}static createStyleElement(){return ie`:host{display:flex;height:100%;inset:0;opacity:0;pointer-events:none;position:absolute;transition:opacity 1s ease-in-out;width:100%}:host([visible]){opacity:1;pointer-events:auto}.line{background:#eee;box-shadow:0 0 30px 25px #ffffff80;clip-path:inset(0);height:2px;left:0;position:absolute;right:0;top:0;width:100%}:host([visible]) .line{animation:scan 2s ease-in-out infinite alternate,trailing-shadow 4s ease-in-out infinite}.text{animation:bgnd 1s ease-in-out infinite alternate;background-color:#fff;border-radius:.4rem;color:#111619;font-size:15px;font-weight:600;justify-content:center;margin:auto;padding:2rem}@keyframes bgnd{0%{color:#111619}to{color:#11161980}}@keyframes scan{to{transform:translateY(100dvh)}}@keyframes trailing-shadow{33%{clip-path:inset(-50px 0 0 0)}50%{clip-path:inset(0 0 0 0)}83%{clip-path:inset(0 0 -50px 0)}}`}};zn.tag=`scandit-horizontal-scanning-animation`;var Bn=class t{constructor(){this.type=`idCapture`,this._idLayoutStyle=`rounded`,this._defaultCapturedBrush=K.IdCapture.IdCaptureOverlayDefaults.defaultCapturedBrush.clone(),this._defaultLocalizedBrush=K.IdCapture.IdCaptureOverlayDefaults.defaultLocalizedBrush.clone(),this._defaultRejectedBrush=K.IdCapture.IdCaptureOverlayDefaults.defaultRejectedBrush.clone(),this._capturedBrush=this._defaultCapturedBrush,this._localizedBrush=this._defaultLocalizedBrush,this._rejectedBrush=this._defaultRejectedBrush,this._idLayoutLineStyle=`light`,this._showTextHints=!0,this._frontSideTextHint=d.getInstance().get(`id.idCaptureOverlay.scanFrontSideHint`),this._backSideTextHint=d.getInstance().get(`id.idCaptureOverlay.scanBackSideHint`),this._moveCloserTextHint=d.getInstance().get(`id.idCaptureOverlay.moveCloseTextHint`),this._moveFurtherAwayTextHint=d.getInstance().get(`id.idCaptureOverlay.moveFurtherAwayTextHint`),this._tapShutterToScanTextHint=d.getInstance().get(`id.idCaptureOverlay.tapShutterToScan`),this._lookingForDocumentTextHint=d.getInstance().get(`id.idCaptureOverlay.lookingForDocument`),this._holdStillTextHint=d.getInstance().get(`id.idCaptureOverlay.holdStill`),this.shutterControl=new Rn,this._cloudScanningAnimation=null,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 t.withIdCaptureForView(e,null)}static async withIdCaptureForView(n,r){var i;let a=new t;return a.idCapture=n,await a.setCapturedBrush(a.defaultCapturedBrush),await a.setLocalizedBrush(a.defaultLocalizedBrush),await a.setRejectedBrush(a.defaultRejectedBrush),r&&(a.view=r,await r.addOverlay(a),await a.installShutterButton()),n.addOverlayListener(a.overlayListener),(i=n.context)==null||i.updateListeners.add(a.onContextUpdatedListener),a._cloudScanningAnimation=zn.create(),r==null||r[u].attachAdditionalLayer(a._cloudScanningAnimation,e.AboveControls),a}onCloudProcessingStarted(){this.showCloudProcessingAnimation()}onCloudProcessingFinished(){this.hideCloudProcessingAnimation()}showCloudProcessingAnimation(){this._cloudScanningAnimation&&(this._cloudScanningAnimation.textContent=d.getInstance().get(`id.idCaptureOverlay.processingDocument`),this._cloudScanningAnimation.setAttribute(`visible`,`true`))}hideCloudProcessingAnimation(){var e;(e=this._cloudScanningAnimation)==null||e.removeAttribute(`visible`)}async setFrontSideTextHint(e){f.log(f.Level.Debug,`DEPRECATED: IdCaptureOverlay.setFrontSideTextHint. Use the Localization API instead.`),this._frontSideTextHint=e,await this.idCapture.didChange()}async setBackSideTextHint(e){f.log(f.Level.Debug,`DEPRECATED: IdCaptureOverlay.setBackSideTextHint. Use the Localization API instead.`),this._backSideTextHint=e,await this.idCapture.didChange()}async setMoveCloserTextHint(e){f.log(f.Level.Debug,`DEPRECATED: IdCaptureOverlay.setMoveCloserTextHint. Use the Localization API instead.`),this._moveCloserTextHint=e,await this.idCapture.didChange()}async setMoveFurtherAwayTextHint(e){f.log(f.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(){this.view&&this.idCapture.settings.captureTrigger===`buttonTap`&&this.view.addControl(this.shutterControl)}onContextUpdated(e){var t;if(e.type===`modeEnabled`&&!e.newValue&&this.shutterControl){var n;(n=this.view)==null||n.removeControl(this.shutterControl);return}if(e.type===`removeOverlay`&&e.newValue===this){var r;this.idCapture.removeOverlayListener(this.overlayListener),(r=this.idCapture.context)==null||r.updateListeners.delete(this.onContextUpdatedListener)}let i=(t=this.idCapture.context)==null?void 0:t.toJSONObject().modes,a=i==null?void 0:i.find(e=>e.type===`idCapture`);if(a&&a.settings.captureTrigger===`auto`&&this.shutterControl){var o;(o=this.view)==null||o.removeControl(this.shutterControl)}else this.installShutterButton()}onShutterPositionUpdate(e){var t;if((t=this.shutterControl)==null||t.updatePosition(e),e.size.width===0&&e.size.height===0&&this.shutterControl){var n;(n=this.view)==null||n.removeControl(this.shutterControl)}}onShutterButtonStateChanged(e){switch(e){case`untapped`:var t;(t=this.shutterControl)==null||t.updateState(Ln.standby);break;case`untappedLocalized`:var n;(n=this.shutterControl)==null||n.updateState(Ln.active);break;case`tapped`:var r;(r=this.shutterControl)==null||r.updateState(Ln.scanning);break;case`tappedLocalized`:break}}};const Q={Initializing:`Initializing`,Available:`Available`,ProcessingFrame:`ProcessingFrame`,ProcessingQueue:`ProcessingQueue`};var Vn=class e{constructor(e){this.type=`idCapture`,this._synchronousFrameFlow=!0,this.state=Q.Initializing,this._isEnabled=!0,this._context=null,this.listeners=[],this.overlayListeners=new Set,this._endOfCycleTasks=[],this._feedback=It.defaultFeedback,this._scanMode=`local`,this._onProcessFrameListener=this.onProcessFrame.bind(this),this.workerMessageListener=this.onWorkerMessage.bind(this),this.settings=e.clone(),this.shouldEnableCentaurus()&&(this._centaurusConnector=new An(N.wasmSDK,()=>{var e;return(e=this.privateContext)==null?void 0:e.workerCommand})),this.contextListener={didChangeFrameSource:this.didChangeFrameSource.bind(this)}}static get recommendedCameraSettings(){return new r(K.IdCapture.RecommendedCameraSettings)}get context(){return this._context}get feedback(){return this._feedback}get privateContext(){return this.context}static async forContext(t,n){let r=new e(n);if(t&&(await t.addMode(r),r.shouldEnableCentaurus()&&await r.initCentaurusConnector(),r.privateFrameSignalsEnabled)){var i;await((i=r.privateContext)==null?void 0:i.workerCommand(`idCaptureEnablePrivateFrameSignals`,{enabled:!0}))}return r.moveToState(Q.Available),r}async setFeedback(e){return this._feedback=e,this.didChange()}addListener(e){this.listeners.includes(e)||this.listeners.push(e)}removeListener(e){this.listeners.includes(e)&&this.listeners.splice(this.listeners.indexOf(e),1)}isEnabled(){return this._isEnabled}async setEnabled(e){this._isEnabled!==e&&(this._isEnabled=e,this.enqueueTask(async()=>this.didChange([{type:`modeEnabled`,newValue:e}])),this.state===Q.Available&&this.moveToState(Q.ProcessingQueue)),e&&this.checkCaptureSettingsAgainstSDKConfiguration(this._settings)}async reset(){this.enqueueTask(async()=>this.doReset()),this.state===Q.Available&&this.moveToState(Q.ProcessingQueue)}async applySettings(e){this.enqueueTask(async()=>this.doApplySettings(e.clone())),this.state===Q.Available&&this.moveToState(Q.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 e=t.result;if((e==null?void 0:e.status)===`error`)throw g.create({type:`InvalidLicenseKeyForParser`,message:e.error});if((e==null?void 0:e.status)===`success`){let t=await this.processRawImages(e.capturedId.rawImageInfo);return Zt.fromJSON({...e.capturedId,imageInfo:t})}}}return null}async setExternalTransactionId(e){var t;return(t=this.privateContext)==null?void 0:t.workerCommand(`idCaptureSetExternalTransactionId`,{transactionId:e})}async getExternalTransactionId(){var e,t;return((e=await((t=this.privateContext)==null?void 0:t.workerCommand(`idCaptureGetExternalTransactionId`,{})))==null?void 0:e.transactionId)??null}toJSONObject(){return{enabled:this._isEnabled,type:this.type,settings:{...this.settings.toJSONObject(),licensee:``,licenseKey:N.licenseKey??``}}}get settings(){return this._settings}get privateFrameSignalsEnabled(){return this.settings.getProperty(`enablePrivateFrameSignals`)??!1}set settings(e){e[Z].willScanInTheCloud()?(e.setProperty(`displayIdOutline`,!0),this._scanMode=`cloud`):this._scanMode=`local`,M(`Applying IdCapture settings:`,e),this._settings=e}shouldEnableCentaurus(){return N.wasmSDK!=null&&!this.settings[Z].willScanInTheCloud()}async initCentaurusConnector(){var e;if(!this.privateContext)throw g.create({type:`Undefined`,message:`Cannot initialize Centaurus without a context`});let t=await((e=this.privateContext)==null?void 0:e.workerCommand(`idCaptureGetCentaurusSettings`,{}));try{var n;await this._centaurusConnector.init(this.settings,Object.freeze(t.result),((n=this._context)==null?void 0:n.frameSource)??null)}catch(e){throw e instanceof o&&e.name===`MULTIPLE_RECOGNIZER_RUNNER`&&f.log(f.Level.Error,`The newly created IdCapture mode is invalid, an existing IdCapture mode is still attached to the context and must be removed first.`),e}}async onSDCResetDone(){var e;return(e=this._centaurusConnector)==null?void 0:e.reset()}didChangeFrameSource(e,t){var n;this.moveToState(Q.ProcessingQueue),(n=this._centaurusConnector)==null||n.onFrameSourceChanged(t)}moveToState(e){M(`IDCapture State update: ${this.state} => ${e}`),this.state=e,e===Q.ProcessingQueue&&this.processQueue()}async doReset(){var e;await((e=this.privateContext)==null?void 0:e.workerCommand(`idCaptureReset`,{}))}async doApplySettings(e){if(this.context){var t,n,r;this.settings=e.clone(),await Promise.all([e[Z].shouldEnableVIZScanner()?(t=this._centaurusConnector)==null?void 0:t.applySettings(e):Promise.resolve(),(n=this.privateContext)==null?void 0:n.workerCommand(`idCaptureApplySettings`,{settings:e.toJSONObject()}),(r=this.privateContext)==null?void 0:r.update()]),this._safariOOMStatsCollector&&this._safariOOMStatsCollector.applySettingsCount++}}addOverlayListener(e){this.overlayListeners.add(e)}removeOverlayListener(e){this.overlayListeners.delete(e)}checkCaptureSettingsAgainstSDKConfiguration(e){!this._centaurusConnector&&e[Z].shouldEnableVIZScanner()&&f.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.`);let t=e.scanner.physicalDocument;t!=null&&t.isSingleSideScanner()&&t.freeFormText&&!e[Z].allowCloudScanning()&&f.warn(`Invalid IdCapture settings: singleSideScanner has freeFormText enabled but allowCloudScanning is not set to true.`),e[Z].validateScannerForCloudDocuments()||f.warn(`Invalid IdCapture settings: some cloud documents are enabled but the scanner is not a single side scanner with free form text enabled.`),e[Z].documentsRequireCloudScanning()&&e[Z].allowCloudScanning()&&!(t!=null&&t.isSingleSideScanner()&&t.freeFormText)&&f.warn(`Invalid IdCapture settings: cloud-compatible documents are configured with allowCloudScanning enabled but free-form text is not enabled on the scanner.`)}async onProcessFrame(e){var t,n;if(this.state!==Q.Available)return M(`Incoming frame ignored, current state is ${this.state}`),{action:`skip`,frame:e};(t=this.privateContext)==null||t.performanceMark(`processFrameBeforeCentaurus`),this.moveToState(Q.ProcessingFrame);let r=await this.doProcessFrame(e);return(n=this.privateContext)==null||n.performanceMark(`processFrameAfterCentaurus`),{action:`continue`,frame:r}}async doProcessFrame(e){return!this._isEnabled||!this.settings[Z].shouldEnableVIZScanner()?e:(M(`Start processing frame`),await this.processFrameWithCentaurus(e))}async onAfterProcessFrame(){if(vt(()=>this.logPerformance()),this._safariOOMStatsCollector){var e;this._safariOOMStatsCollector.framesProcessedCount++;let t=(e=this.context)==null||(e=e.frameSource)==null?void 0:e.currentResolution;t?this._safariOOMStatsCollector.videoResolution=`${t.width}x${t.height}`:this._safariOOMStatsCollector.videoResolution=``}this.moveToState(Q.ProcessingQueue)}async onCloudProcessingStarted(){var e;(e=this.privateContext)==null||(e=e.getView())==null||e[u].freezeFrame();let t=this.getOverlay();t==null||t.onCloudProcessingStarted()}async onCloudProcessingFinished(){var e;(e=this.privateContext)==null||(e=e.getView())==null||e[u].unfreezeFrame();let t=this.getOverlay();t==null||t.onCloudProcessingFinished()}getOverlay(){var e;let t=(e=this.privateContext)==null?void 0:e.getView();if(t){for(let e of t[u].overlays)if(e instanceof Bn)return e}}logPerformance(){let e=performance.getEntriesByName(`processFrameBeforeCentaurus`).length>0?performance.measure(`Centaurus`,`processFrameBeforeCentaurus`,`processFrameAfterCentaurus`).duration:0,t=performance.measure(`SDC`,`processFrameBeforeSDC`,`processFrameAfterSDC`).duration,n=`${(e+t).toFixed(2)}ms`;M(`centaurus: ${e.toFixed(2)}`,`sdc: ${t.toFixed(2)}`,`total: ${n}`),performance.clearMarks()}enqueueTask(e){this._endOfCycleTasks.push(e)}async processQueue(){if(this._endOfCycleTasks.length===0){M(`Queue is empty.`),this.moveToState(Q.Available);return}for(M(`Processing queue, ${this._endOfCycleTasks.length} tasks.`);this._endOfCycleTasks.length>0;){let e=this._endOfCycleTasks.shift();await(e==null?void 0:e())}M(`Queue has been processed and emptied`),this.moveToState(Q.Available)}attachedToContext(e){var t;this._context=e,this._context.subscribeToWorkerMessages(this.workerMessageListener),this._context.registerFrameHandler(this._onProcessFrameListener),Fn.isSafari()&&(this._safariOOMDetector=new Fn(this.onPageAbruptlyReloaded.bind(this)),this._safariOOMDetector.install(),this._safariOOMStatsCollector=new In(this._safariOOMDetector)),this._context.addListener(this.contextListener),(t=this._centaurusConnector)==null||t.onFrameSourceChanged(this.context.frameSource)}async detachedFromContext(){await this.dispose()}async dispose(){var e,t,n,r,i,a,o;(e=this._context)==null||e.unsubscribeToWorkerMessages(this.workerMessageListener),(t=this._context)==null||t.unregisterFrameHandler(this._onProcessFrameListener),(n=this._context)==null||n.removeListener(this.contextListener),(r=this._safariOOMDetector)==null||r.uninstall(),this._safariOOMDetector=void 0,(i=this._safariOOMStatsCollector)==null||i.destroy(),this._safariOOMStatsCollector=void 0,this.listeners=[],await((a=this._centaurusConnector)==null?void 0:a.dispose()),this._centaurusConnector=void 0,(o=this.privateContext)==null||o.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 t of this.overlayListeners)t.onShutterPositionUpdate(e.payload.position);break;case`idCaptureDidShutterButtonStateChanged`:for(let t of this.overlayListeners)t.onShutterButtonStateChanged(e.payload.state);break;case`idCaptureIdCapturedFeedback`:this._feedback.idCaptured.emit();break;case`idCaptureIdRejectedFeedback`:this._feedback.idRejected.emit();break;case`idCaptureDidUpdateIdOutline`:this.triggerListenersForIdOutline(e.payload.idOutline,e.payload.isGoodFrame??null,e.payload.diagnostics??null);break;case`idCaptureCaptureIssueEncountered`:this.triggerListenersForCaptureIssue(e.payload.issue);break;case`idCaptureViewfinderHintChanged`:this.triggerListenersForViewfinderHint(e.payload.hint);break;case`idCaptureBackendReset`:this.enqueueTask(async()=>this.onSDCResetDone());break;case`idCaptureDetectionOnlyMode`:this.enqueueTask(async()=>{var t;return(t=this._centaurusConnector)==null?void 0:t.setDetectionOnlyMode(e.payload.detectionOnlyMode)}),this.state===Q.Available&&this.moveToState(Q.ProcessingQueue);break;case`onFrameProcessingStarted`:M(`SDC::onFrameProcessingStarted`);break;case`onFrameProcessingFinished`:M(`SDC::onFrameProcessingFinished`),this.onAfterProcessFrame();break;case`onFrameSkipped`:M(`SDC::onFrameSkipped`),this.onAfterProcessFrame();break;case`idCaptureCloudProcessingStarted`:M(`SDC::idCaptureCloudProcessingStarted`),this.onCloudProcessingStarted();break;case`idCaptureCloudProcessingFinished`:M(`SDC::idCaptureCloudProcessingFinished`),this.onCloudProcessingFinished();break}}async processFrameWithCentaurus(e){var t;if(!((t=this._centaurusConnector)!=null&&t.isReadyToProcessFrame()))return e;try{let{arrayBuffer:t,capturedId:n,detectionIssue:r,localizedOnlyId:i,diagnostics:a}=await this._centaurusConnector.processFrame(e);return await this.reportToBackend(n,r,i,a),{frameId:e.frameId,width:e.width,height:e.height,colorType:e.colorType,data:new Uint8ClampedArray(t)}}catch(t){return t instanceof g?(f.log(f.Level.Debug,t.message),this.triggerErrorListener(t)):(f.log(f.Level.Debug,`Error while processing incoming frame from SDC`,t),this.triggerErrorListener(g.create({type:`Undefined`,message:`Error while processing a frame`}))),e}}async reportToBackend(e,t,n,r){var i;e!==void 0&&await this.reportLastResult(e),await this.reportLastLocalizedId(n),await this.reportLastDetectionIssue(t),await this.reportLastDiagnostics(r),await this.reportLastError(((i=this._centaurusConnector)==null?void 0:i.lastError)??null)}uint8ArrayImageToBase64(e,t,n){let r=document.createElement(`canvas`);r.width=t,r.height=n;let i=r.getContext(`2d`);if(!i)throw Error(`Could not get 2d context from an HTMLCanvasElement`);i.putImageData(new ImageData(e,t,n,{colorSpace:`srgb`}),0,0);let a=i.canvas.toDataURL(`image/png`,1);return i=null,r=null,a}async processRawImages(e){let{front:t,back:n}=e,r=e.front.frame.image,i=e.back.frame.image;return{front:{face:t.face,croppedDocument:await this.anonymizeImage(t.croppedDocument.image,t.croppedDocument.obscuredRegions),frame:await this.anonymizeImage(r.data==null?null:this.uint8ArrayImageToBase64(r.data,r.width,r.height),t.frame.obscuredRegions)},back:{face:null,croppedDocument:await this.anonymizeImage(n.croppedDocument.image,n.croppedDocument.obscuredRegions),frame:await this.anonymizeImage(i.data==null?null:this.uint8ArrayImageToBase64(i.data,i.width,i.height),n.frame.obscuredRegions)}}}async anonymizeImage(e,t){return e==null?null:t.length===0?e:await new Nn(`obscure`).obscureRegions(e,t)}async triggerListenersForLocalization(e){for(let t of this.listeners)typeof t.didLocalizeId==`function`&&t.didLocalizeId(Qt.fromJSON(e))}triggerListenersForCaptureIssue(e){if(this.privateFrameSignalsEnabled)for(let n of this.listeners){var t;(t=n.didEncounterCaptureIssue)==null||t.call(n,e)}}triggerListenersForViewfinderHint(e){if(this.privateFrameSignalsEnabled)for(let n of this.listeners){var t;(t=n.didChangeViewfinderHint)==null||t.call(n,e)}}triggerListenersForIdOutline(e,t,n){if(this.privateFrameSignalsEnabled){let i=e?m.fromJSON(e):null,a=n?jn.fromJSON(n):null;for(let e of this.listeners){var r;(r=e.didUpdateIdOutline)==null||r.call(e,i,t,a)}}}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 n=null;if(t.capturedId){let e=await this.processRawImages(t.capturedId.rawImageInfo);n=Zt.fromJSON({...t.capturedId,imageInfo:e})}for(let r of this.listeners)if(typeof r[e]==`function`){let i=[n];e===`didRejectId`&&typeof t.rejectionReason==`string`&&i.push(t.rejectionReason);let a=r[e].apply(null,i);a instanceof Promise&&await a}}notifyRecoveryAfterCrash(){var e;if(!this._isEnabled)return;let t=!1;for(let e of this.listeners)typeof e.didFailWithError==`function`&&(e.didFailWithError(this,g.create({type:`RecoveredAfterFailure`,message:`Last image processing failed but SDK could recover. Please reset scanning process.`})),t=!0);!t&&(e=this.settings.scanner.physicalDocument)!=null&&e.isFullDocumentScanner()&&f.log(f.Level.Warn,`A process responsible to scan images malfunctioned and was restarted. No listener for "didFailWithError" was
        found: this may result in unexpected behaviour in your application. Please define the listener
        "didFailWithError" and handle the error "IdCaptureErrorCode.RecoveredAfterFailure". Informing the user to
        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){if(M(`IdCapture::reportLastResult`,e),this.context){var t;return(t=this.privateContext)==null?void 0:t.workerCommand(`idCaptureSetLastResult`,{result:e==null?``:JSON.stringify(e)})}}async reportLastError(e){if(this.context){var t;return(t=this.privateContext)==null?void 0:t.workerCommand(`idCaptureSetLastError`,{error:e==null?``:JSON.stringify(e)})}}async reportLastLocalizedId(e){if(this.context){var t;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 reportLastDiagnostics(e){try{var t;return(t=this.privateContext)==null?void 0:t.workerCommand(`idCaptureSetLastDiagnostics`,{diagnostics:e??``})}catch(e){M(`Error reporting diagnostics:`,e)}}async onPageAbruptlyReloaded(){var e;if(f.debug(`Detected abrupt page reload`),this.context==null||this._safariOOMDetector==null)return;function t(e){if(e==null)return null;try{return new URL(e).hostname}catch{return null}}let n={...this._safariOOMDetector.data,parentDomain:t(document.referrer)??void 0,centaurusEnabled:N.wasmSDK!=null};f.debug(`Abrupt page reload environment data`,n),(e=this.privateContext)==null||e.workerCommand(`idCaptureReportSafariAbruptReload`,{environmentData:n})}},Hn=class{constructor(e){this.allowCloudScanning=!1,this[Z]={setAllowCloudScanning:e=>{this.allowCloudScanning=e},getAllowCloudScanning:()=>this.allowCloudScanning},this.physicalDocument=(e==null?void 0:e.physicalDocument)??null,this.mobileDocument=(e==null?void 0:e.mobileDocument)??null,this.allowCloudScanning=(e==null?void 0:e.allowCloudScanning)??!1}toJSONObject(){var e,t;let n={physicalDocument:((e=this.physicalDocument)==null?void 0:e.toJSONObject())??null,mobileDocument:((t=this.mobileDocument)==null?void 0:t.toJSONObject())??null};return this.allowCloudScanning&&(n.allowCloudScanning=this.allowCloudScanning),n}},Un=class{constructor(){this._ocr=!0}toJSONObject(){return{ocr:this._ocr}}};let Wn=function(e){return e.FullDocument=`fullDocument`,e.SingleSide=`singleSide`,e}({});var Gn=class{isSingleSideScanner(){return this.type===`singleSide`}isFullDocumentScanner(){return this.type===`fullDocument`}},Kn=class extends Gn{constructor(){super(),this.type=`fullDocument`}toJSONObject(){return{type:this.type,isFull:!0,options:{barcode:!0,machineReadableZone:!0,visualInspectionZone:!0}}}},qn=class extends Gn{constructor(e,t,n,r=!1){super(),this.type=`singleSide`,this._freeFormText=!1,this._barcode=e,this._machineReadableZone=t,this._visualInspectionZone=n,this._freeFormText=r}get barcode(){return this._barcode}get machineReadableZone(){return this._machineReadableZone}get visualInspectionZone(){return this._visualInspectionZone}get freeFormText(){return this._freeFormText}toJSONObject(){let e={barcode:this.barcode,machineReadableZone:this.machineReadableZone,visualInspectionZone:this.visualInspectionZone,freeFormText:this.freeFormText};return{type:this.type,isFull:!1,options:e}}},Jn=class e{constructor(){this.acceptedDocuments=[],this.rejectedDocuments=[],this.anonymizationMode=`fieldsOnly`,this.anonymizeDefaultFields=!0,this.captureTrigger=`auto`,this.rejectVoidedIds=!1,this.decodeBackOfEuropeanDrivingLicense=!1,this.rejectExpiredIds=!1,this.rejectNotRealIdCompliant=!1,this.rejectInconsistentData=!1,this.rejectHolderBelowAge=null,this.rejectIdsExpiringIn=null,this.rejectionTimeoutSeconds=6,this.notifyOnSideCapture=!1,this.properties={},this.imageToResult={},this.anonymizationMap=new Map,this[Z]={allowCloudScanning:this.allowCloudScanning.bind(this),documentsRequireCloudScanning:this.documentsRequireCloudScanning.bind(this),shouldEnableVIZScanner:this.shouldEnableVIZScanner.bind(this),validateScannerForCloudDocuments:this.validateScannerForCloudDocuments.bind(this),willScanInTheCloud:this.willScanInTheCloud.bind(this)},this.scanner=new Hn}setProperty(e,t){this.properties[e]=t}getProperty(e){return this.properties[e]}setShouldPassImageTypeToResult(e,t){this.imageToResult[e]=t}getShouldPassImageTypeToResult(e){return this.imageToResult[e]??!1}addAnonymizedField(e,t){let n=JSON.stringify(e.toJSONObject()),r=this.anonymizationMap.get(n)??new Set;r.add(t),this.anonymizationMap.set(n,r)}removeAnonymizedField(e,t){let n=JSON.stringify(e.toJSONObject()),r=this.anonymizationMap.get(n);r!==void 0&&(r.delete(t),r.size===0&&this.anonymizationMap.delete(n))}clearAnonymizedFields(){this.anonymizationMap.clear()}clone(){return e.fromJSON(this.toJSONObject())}toJSONObject(){let e={};for(let[t,n]of this.anonymizationMap)e[t]=Array.from(n);return{acceptedDocuments:this.acceptedDocuments.map(e=>e.toJSONObject()),rejectedDocuments:this.rejectedDocuments.map(e=>e.toJSONObject()),scanner:this.scanner.toJSONObject(),imageToResult:{face:this.imageToResult.face??!1,croppedDocument:this.imageToResult.croppedDocument??!1,frame:this.imageToResult.frame??!1},properties:this.properties,anonymizationMode:this.anonymizationMode,anonymizeDefaultFields:this.anonymizeDefaultFields,anonymizationMap:e,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,rejectionTimeoutSeconds:this.rejectionTimeoutSeconds,notifyOnSideCapture:this.notifyOnSideCapture}}allowCloudScanning(){return this.scanner[Z].getAllowCloudScanning()??!1}willScanInTheCloud(){return this.validateScannerForCloudDocuments()&&this.allowCloudScanning()}validateScannerForCloudDocuments(){if(this.documentsRequireCloudScanning()){let e=this.scanner.physicalDocument;return((e==null?void 0:e.isSingleSideScanner())&&e.freeFormText)??!1}return!0}documentsRequireCloudScanning(){return this.acceptedDocuments.some(e=>e.documentType===`visaLetter`)}shouldEnableVIZScanner(){var e,t;return this.documentsRequireCloudScanning()?!1:(e=this.scanner.physicalDocument)!=null&&e.isFullDocumentScanner()?!0:((t=this.scanner.physicalDocument)==null?void 0:t.visualInspectionZone)??!1}static fromJSON(t){let n=new e;if(n.acceptedDocuments=t.acceptedDocuments.map(t=>e.createDocumentFromJSON(t)),n.rejectedDocuments=t.rejectedDocuments.map(t=>e.createDocumentFromJSON(t)),n.scanner=new Hn,t.scanner.mobileDocument!=null&&(n.scanner.mobileDocument=new Un),t.scanner.allowCloudScanning&&n.scanner[Z].setAllowCloudScanning(!0),t.scanner.physicalDocument!=null)if(t.scanner.physicalDocument.type===`fullDocument`)n.scanner.physicalDocument=new Kn;else{let e=t.scanner.physicalDocument;n.scanner.physicalDocument=new qn(e.options.barcode,e.options.machineReadableZone,e.options.visualInspectionZone,e.options.freeFormText??!1)}n.anonymizationMode=t.anonymizationMode,n.anonymizeDefaultFields=t.anonymizeDefaultFields??!0,n.decodeBackOfEuropeanDrivingLicense=t.decodeBackOfEuropeanDrivingLicense,n.captureTrigger=t.captureTrigger,n.rejectVoidedIds=t.rejectVoidedIds,n.rejectExpiredIds=t.rejectExpiredIds,n.rejectNotRealIdCompliant=t.rejectNotRealIdCompliant,n.rejectInconsistentData=t.rejectInconsistentData,n.rejectHolderBelowAge=t.rejectHolderBelowAge;let r=t.rejectIdsExpiringIn;if(n.rejectIdsExpiringIn=r?new wt(r.days,r.months,r.years):null,n.rejectionTimeoutSeconds=t.rejectionTimeoutSeconds??6,n.imageToResult={...t.imageToResult},n.properties={...t.properties},n.notifyOnSideCapture=t.notifyOnSideCapture,t.anonymizationMap)for(let[e,r]of Object.entries(t.anonymizationMap))n.anonymizationMap.set(e,new Set(r));return n}static createDocumentFromJSON(e){let t=e.documentType,n=e.region;switch(t){case`driverLicense`:return new R(n);case`healthInsuranceCard`:return new z(n);case`idCard`:return new B(n);case`passport`:return new V(n);case`residencePermit`:return new U(n);case`visaIcao`:return new W(n);case`regionSpecific`:return new H(e.documentSubtype);case`visaLetter`:return new G(n)}}};let Yn=function(e){return e.National=`national`,e.Emergency=`emergency`,e.Diplomatic=`diplomatic`,e.Official=`official`,e.Refugee=`refugee`,e.Alien=`alien`,e.Stateless=`stateless`,e.LaissezPasser=`laissezPasser`,e.Military=`military`,e.Seafarer=`seafarer`,e}({}),$;function Xn(e){d.getInstance().updateIfMissing({...le});let t=typeof(e==null?void 0:e.enableVIZDocuments)==`boolean`?e.enableVIZDocuments:!1;return{moduleName:`IdCapture`,load:async e=>{if(e.loadProgressNotifier=t?bt(e.loadProgressNotifier):e.loadProgressNotifier,e.threadsSupport=!1,e.verifyResponseHash=!0,$=await he.create(e),a.moduleLicenseTextProviders.push(new ce($)),!t)return f.log(f.Level.Debug,`VIZ scanning is disabled (enableVIZDocuments option was not passed to idCaptureLoader, or its value was false)`),$;let n=(await $.workerCommand(`extractCentaurusLicense`,{licenseKey:e.licenseKey})).centaurus.licenseKey;if(n.length===0)throw f.log(f.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.`),g.create({type:`InvalidLicenseKeyForVIZProcessing`,message:`Invalid license key for VIZ scanning. Update license key or disable VIZ scanning.`});return f.log(f.Level.Debug,`VIZ scanning is enabled, VIZ processor will be initialized`),await N.load({libraryLocation:`${e.libraryLocation}idcapture/`,licenseKey:n,logLevel:e.logLevel,loadProgressNotifier:e.loadProgressNotifier}),$}}}function Zn(e){$=e}export{St as AamvaBarcodeVerificationResult,xt as AamvaBarcodeVerificationStatus,Ct as AamvaBarcodeVerifier,Ft as ApplicationStatus,Vt as BarcodeResult,Zt as CapturedId,Tt as CapturedSides,qt as DataConsistencyResult,F as DateResult,R as DriverLicense,Wt as DrivingLicenseCategory,I as DrivingLicenseDetails,wt as Duration,Kn as FullDocumentScanner,z as HealthInsuranceCard,Z as INTERNAL_ACCESS,Ot as IdAnonymizationMode,Vn as IdCapture,P as IdCaptureDocument,Lt as IdCaptureDocumentType,g as IdCaptureError,se as IdCaptureErrorCode,It as IdCaptureFeedback,Bn as IdCaptureOverlay,Hn as IdCaptureScanner,Jn as IdCaptureSettings,kt as IdCaptureTrigger,B as IdCard,At as IdFieldType,Et as IdImageType,Mt as IdLayoutLineStyle,jt as IdLayoutStyle,Dt as IdSide,Qt as LocalizedOnlyId,Ut as MRZResult,Un as MobileDocumentScanner,V as Passport,Yn as PassportType,Gn as PhysicalDocumentScanner,Wn as PhysicalDocumentScannerType,zt as ProfessionalDrivingPermit,Yt as Region,H as RegionSpecific,un as RegionSpecificSubtype,Mn as RejectionReason,U as ResidencePermit,Q as STATE,Pt as Sex,qn as SingleSideScanner,Nt as UsRealIdStatus,Kt as VIZResult,Bt as VehicleRestriction,W as VisaIcao,G as VisaLetter,Xn as idCaptureLoader,$ as mainDataCaptureLoader,Zn as setMainDataCaptureLoader};