@sekyro/web 0.1.0-rc.26 → 0.1.0-rc.28

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/README.md +4 -1
  3. package/dist/{capture-session-doc-WZMI5XPE.js → capture-session-doc-LUA4Y7PZ.js} +1 -1
  4. package/dist/{capture-session-v3-BKSjJ6L0.d.cts → capture-session-v3-ClByT4KN.d.cts} +1 -1
  5. package/dist/{capture-session-v3-C1I_GLC9.d.ts → capture-session-v3-IjQwKfLS.d.ts} +1 -1
  6. package/dist/chunk-CUBNJXZN.js +1 -0
  7. package/dist/{chunk-LLX2CKZ3.js → chunk-FSXWIMSG.js} +1 -1
  8. package/dist/{chunk-XOTKATN6.js → chunk-J7D3S5ZJ.js} +1 -1
  9. package/dist/{chunk-7MZW3FFH.js → chunk-KLEARRAD.js} +1 -1
  10. package/dist/chunk-MJUOZH3U.js +1 -0
  11. package/dist/chunk-MOOWUPOZ.js +1 -0
  12. package/dist/{chunk-65JZHKVG.js → chunk-QP23DM4Z.js} +1 -1
  13. package/dist/chunk-R4IQTGF5.js +3 -0
  14. package/dist/{chunk-LV23FCYP.js → chunk-THQWX6EH.js} +1 -1
  15. package/dist/client/index.cjs +1 -1
  16. package/dist/client/index.d.cts +3 -3
  17. package/dist/client/index.d.ts +3 -3
  18. package/dist/client/index.js +1 -1
  19. package/dist/core/index.cjs +1 -1
  20. package/dist/core/index.d.cts +3 -3
  21. package/dist/core/index.d.ts +3 -3
  22. package/dist/core/index.js +1 -1
  23. package/dist/{create-document-capture-OXPLKHOF.js → create-document-capture-ZTJKSEJB.js} +1 -1
  24. package/dist/{create-verification-YeuI7_B0.d.cts → create-verification-BN7ebjC2.d.cts} +10 -5
  25. package/dist/{create-verification-7wPXJN_P.d.ts → create-verification-C4FMWIix.d.ts} +10 -5
  26. package/dist/{icao-gate-BK8TGaCk.d.ts → icao-gate-CYb-35iH.d.ts} +1 -1
  27. package/dist/{icao-gate-pD2dUV3P.d.cts → icao-gate-CjbKCatx.d.cts} +1 -1
  28. package/dist/{icao-policy-CdR6PFHS.d.cts → icao-policy-CAZZYEJ6.d.cts} +2 -2
  29. package/dist/{icao-policy-qJpZOOOu.d.ts → icao-policy-D4AZivI8.d.ts} +2 -2
  30. package/dist/index.cjs +2 -2
  31. package/dist/index.d.cts +7 -7
  32. package/dist/index.d.ts +7 -7
  33. package/dist/index.js +1 -1
  34. package/dist/internal/index.cjs +2 -2
  35. package/dist/internal/index.d.cts +6 -6
  36. package/dist/internal/index.d.ts +6 -6
  37. package/dist/internal/index.js +1 -1
  38. package/dist/{plan-runner-EP26JU6A.js → plan-runner-INQLWFGS.js} +1 -1
  39. package/dist/popup/index.d.cts +2 -2
  40. package/dist/popup/index.d.ts +2 -2
  41. package/dist/popup/index.js +1 -1
  42. package/dist/{types-DB-cZTSn.d.cts → types-CgHWIEZj.d.cts} +33 -6
  43. package/dist/{types-DB-cZTSn.d.ts → types-CgHWIEZj.d.ts} +33 -6
  44. package/package.json +1 -1
  45. package/sbom.cdx.json +10 -10
  46. package/dist/chunk-DVTK2DGX.js +0 -1
  47. package/dist/chunk-GPFAPAS6.js +0 -3
  48. package/dist/chunk-OVP7FAMJ.js +0 -1
  49. package/dist/chunk-ZCW6PNUX.js +0 -1
  50. /package/dist/{chunk-LJYMZQY2.js → chunk-GFJATPUR.js} +0 -0
@@ -1 +1 @@
1
- import{a as Y,d as ee,e as O,f as te,g as ne}from"./chunk-7QZWBDI5.js";import{C as X,a as j}from"./chunk-OVP7FAMJ.js";import{f as Q,l as Z}from"./chunk-CPUECYAJ.js";import{c as $}from"./chunk-TSA6GHUG.js";import{c as J,h as C}from"./chunk-FSSMUAKC.js";var ue=12e4,re=13e4,le=3e3,fe=1200,P=Symbol.for("@sekyro/web.preload.v1");function g(){let e=globalThis;return e[P]??(e[P]=new Map),e[P]}function S(e){let n=(e??J).replace(/\/+$/,"");return n===""?"/":n}function se(e){let n=g(),r=n.get(e);return r===void 0&&(r={status:"idle",promise:null,scheduled:null,detectorPromise:null,detector:null,listeners:new Set},n.set(e,r)),r}function A(e,n){if(e.status!==n){e.status=n;for(let r of[...e.listeners])r(n)}}var x=e=>C({preferred:["blaze"],v3AssetBaseUrl:e,blazeInitTimeoutMs:ue}),F=x;function Pe(e){F=e??x}function Ae(){for(let e of g().values())e.detector?.destroy();g().clear(),F=x}function pe(){return typeof window<"u"&&typeof navigator<"u"&&typeof navigator.mediaDevices?.getUserMedia=="function"}function me(){return navigator.connection?.saveData===!0}function ve(e){let n=window;if(typeof n.requestIdleCallback=="function"){let s=n.requestIdleCallback(e,{timeout:le});return()=>n.cancelIdleCallback?.(s)}let r=setTimeout(e,fe);return()=>clearTimeout(r)}function ge(e,n){let r,s=new Promise(i=>{r=i}),m=!1,d=()=>{},u={promise:s,settle:i=>{m||(m=!0,d(),e.scheduled===u&&(e.scheduled=null),r(i))}};return e.scheduled=u,d=ve(()=>{m||u.settle(I(e,n))}),s}function I(e,n){if((e.status==="loading"||e.status==="ready")&&e.promise!==null)return e.promise;A(e,"loading");let r=new Promise(i=>i(F(n)));e.detectorPromise=r;let s,m=new Promise((i,f)=>{s=setTimeout(()=>{r.then(h=>h.destroy(),()=>{}),f(new Error(`detector preload exceeded ${re} ms`))},re)}),u=Promise.race([r,m]).then(i=>e.detectorPromise!==r?(i.destroy(),e.status):(e.detector=i,A(e,"ready"),"ready"),i=>(e.detectorPromise===r&&(e.detectorPromise=null,e.detector=null,A(e,"failed"),console.warn("[@sekyro/web] face-detector preload failed:",i)),e.status)).finally(()=>clearTimeout(s));return e.promise=u,e.scheduled?.settle(u),u}function we(e={}){if(!pe())return Promise.resolve("idle");let n=S(e.assetBaseUrl),r=se(n);return e.respectSaveData===!0&&me()?Promise.resolve(r.status):(r.status==="loading"||r.status==="ready")&&r.promise!==null?r.promise:e.idle===!0?r.scheduled?.promise??ge(r,n):I(r,n)}function ke(e){return g().get(S(e))?.status??"idle"}function De(e,n){let r=se(S(n));return r.listeners.add(e),()=>{r.listeners.delete(e)}}function _e(e){let n=g().get(S(e));n!==void 0&&(n.scheduled?.settle("idle"),n.detector?.destroy(),n.detector=null,n.detectorPromise=null,n.promise=null,A(n,"idle"))}function he(e){return{get tier(){return e.tier},get fallbackReason(){return e.fallbackReason},detect:(...n)=>e.detect(...n),destroy:()=>{}}}function oe(e){let n=S(e),r=g().get(n);if(!(r===void 0||r.detector===null&&r.detectorPromise===null&&r.scheduled===null))return async()=>{r.scheduled!==null&&I(r,n);let s=r.promise;for(;r.detector===null&&s!==null&&(await s,r.promise!==s);)s=r.promise;return r.detector!==null?he(r.detector):C({v3AssetBaseUrl:n})}}function Ce(e){switch(e){case"fcv3.no_face":case"fcv3.center_face":case"fcv3.straighten":return"center";case"fcv3.come_closer":return"closer";case"fcv3.move_back":return"farther";case"fcv3.more_light":case"fcv3.too_bright":return"light";case"fcv3.hold_still":case"fcv3.steady_camera":return"still";case"fcv3.hold_upright":return"upright";case"fcv3.one_face":return"one_face";default:return null}}function Se(e){switch(e){case"preflight":case"acquiring":return"starting";case"positioning":return"gating";default:return e}}function ie(e){switch(e){case"permission":case"notfound":case"inuse":case"insecure":case"unsupported":return e;case"backcamera":return"notfound";default:{let n=e;return"generic"}}}function Le(e,n,r){if(r===void 0)return{kind:ie(e),retryable:n};let s=Z(r.name);return{kind:ie(e),retryable:n,detail:{...s!==void 0?{name:s}:{},phase:r.phase,engineKind:e}}}var ye=new Set(["captured","uploading","checking"]);function Ee(e,n={},r,s=()=>"self",m=()=>{},d){let u=n.now??(()=>performance.now()),i=n.canChooseFacing??ee,f="user",h=te(),p=s(),l=Y(),B=!Q(),H=n.engineOptions,ae=H?.createDetector===void 0&&H?.createWorker===void 0?{createDetector:()=>{let t=oe(e.assetBaseUrl);return t!==void 0?t():C({v3AssetBaseUrl:e.assetBaseUrl})}}:{},U={video:e.video,mode:B?"photo":"clip",rankKeyframes:r,facingMode:void 0,v3AssetBaseUrl:e.assetBaseUrl,screenRamp:()=>p==="self"&&l.count("ramp")>0?m():void 0,...n.engineOptions??{},...ae},o=n.createEngine?.(U)??new X(U),v="idle",L=null,y=0,w=!1,k="full",E=null,b=null,D=0,_=0,K=()=>{e.video.videoWidth>0&&e.video.videoHeight>0&&(D=e.video.videoWidth,_=e.video.videoHeight)},V=ne({enabled:e.keepScreenAwake!==!1}),M=t=>{v=t,V.setActive(t==="starting"||t==="gating"||t==="recording"),l.emit("state",t)},R=()=>l.emit("gate",{progress:y,hint:L,faceDetected:w}),G=()=>{let t=o.animations??"full";t!==k&&(k=t,l.emit("profile",{animations:k}))},de=[o.on("statechange",({state:t})=>{let a=Se(t);a==="starting"&&v!=="starting"&&(L=null,y=0,w=!1,E=null,b=null,D=0,_=0),M(a),G(),a==="recording"&&(K(),E=u(),L="hold",y=1,R())}),o.on("checks",t=>{K(),y=t.progress,w=t.factors.presence>0,R(),G()}),o.on("guidance",({key:t})=>{L=Ce(t),R()}),o.on("frozen",({previewDataUrl:t})=>{b=u(),l.emit("frozen",{previewDataUrl:t})}),o.on("ramp",t=>l.emit("ramp",t)),o.on("artifacts",t=>{if(v!=="captured")return;let a=$(),c=t.clipStats,q=c!==void 0?Math.round(c.durationMs):E!==null&&b!==null?Math.max(0,Math.round(b-E)):void 0,N=c!==void 0&&c.frames>1&&c.durationMs>0?Math.round(c.frames*1e4/c.durationMs)/10:void 0;l.emit("captured",{keyframe:t.keyframe,...t.clip!==void 0?{clip:t.clip}:{},...t.clipMimeType!==void 0?{clipMime:t.clipMimeType}:{},width:e.video.videoWidth||D,height:e.video.videoHeight||_,...q!==void 0?{clipMs:q}:{},...c!==void 0?{clipFrames:c.frames}:{},...N!==void 0?{fps:N}:{},...t.clipRetakes!==void 0?{clipRetakes:t.clipRetakes}:{},...t.clipMimeType!==void 0?{codec:j(t.clipMimeType)}:{},captureChannel:a==="desktop"?"desktop":"mobile",formFactor:a,...B?{degraded:"NO_RECORDER"}:{},engine:"v3",facingMode:o.facingMode,mode:p,...t.timing,...t.screenRamp!==void 0?{screenRamp:t.screenRamp}:{},...t.provenance!==void 0?{provenance:t.provenance}:{}})}),o.on("error",({kind:t,retryable:a,detail:c})=>{t==="backcamera"&&ce()||l.emit("error",Le(t,a,c))})],z=!1;function ce(){return T||z||p!=="assisted"||d===void 0||d.session()!=="choice"?!1:(z=!0,d.onModeChange("self"),p="self",f=O("self"),M("mode_switch"),o.restart(f),!0)}let W=async()=>d!==void 0&&d.session()==="choice"&&await i().catch(()=>!1),T=!1;return{handle:{get state(){return v},get captureMode(){return s()},get facingMode(){return o.facingMode??f},on:(t,a)=>l.on(t,a),start:t=>(p=s(),h.facing(p,e.facing),f=h.facing(p,t?.facing),o.start({facingMode:f})),retry:()=>o.retry(),switchCamera:()=>h.refuseSwitch(s()),canSwitchCaptureMode:W,setCaptureMode:async t=>{if(t===s()||!await W()||T||ye.has(v)||d===void 0)return!1;d.onModeChange(t),p=t;let a=O(t);return f=a,v==="idle"||(M("mode_switch"),o.restart(a)),!0},destroy:()=>{T=!0;for(let t of de)t();V.setActive(!1),o.destroy(),l.clear()}},setFlowState:t=>{v!==t&&M(t)}}}function ze(e){return Ee(e).handle}export{ue as a,re as b,Pe as c,Ae as d,we as e,ke as f,De as g,_e as h,oe as i,Ce as j,Se as k,ie as l,Le as m,Ee as n,ze as o};
1
+ import{a as Y,d as ee,e as O,f as te,g as ne}from"./chunk-7QZWBDI5.js";import{C as X,a as j}from"./chunk-MOOWUPOZ.js";import{f as Q,l as Z}from"./chunk-CPUECYAJ.js";import{c as $}from"./chunk-TSA6GHUG.js";import{c as J,h as C}from"./chunk-FSSMUAKC.js";var ue=12e4,re=13e4,le=3e3,fe=1200,P=Symbol.for("@sekyro/web.preload.v1");function g(){let e=globalThis;return e[P]??(e[P]=new Map),e[P]}function S(e){let n=(e??J).replace(/\/+$/,"");return n===""?"/":n}function se(e){let n=g(),r=n.get(e);return r===void 0&&(r={status:"idle",promise:null,scheduled:null,detectorPromise:null,detector:null,listeners:new Set},n.set(e,r)),r}function A(e,n){if(e.status!==n){e.status=n;for(let r of[...e.listeners])r(n)}}var x=e=>C({preferred:["blaze"],v3AssetBaseUrl:e,blazeInitTimeoutMs:ue}),F=x;function Pe(e){F=e??x}function Ae(){for(let e of g().values())e.detector?.destroy();g().clear(),F=x}function pe(){return typeof window<"u"&&typeof navigator<"u"&&typeof navigator.mediaDevices?.getUserMedia=="function"}function me(){return navigator.connection?.saveData===!0}function ve(e){let n=window;if(typeof n.requestIdleCallback=="function"){let s=n.requestIdleCallback(e,{timeout:le});return()=>n.cancelIdleCallback?.(s)}let r=setTimeout(e,fe);return()=>clearTimeout(r)}function ge(e,n){let r,s=new Promise(i=>{r=i}),m=!1,d=()=>{},u={promise:s,settle:i=>{m||(m=!0,d(),e.scheduled===u&&(e.scheduled=null),r(i))}};return e.scheduled=u,d=ve(()=>{m||u.settle(I(e,n))}),s}function I(e,n){if((e.status==="loading"||e.status==="ready")&&e.promise!==null)return e.promise;A(e,"loading");let r=new Promise(i=>i(F(n)));e.detectorPromise=r;let s,m=new Promise((i,f)=>{s=setTimeout(()=>{r.then(h=>h.destroy(),()=>{}),f(new Error(`detector preload exceeded ${re} ms`))},re)}),u=Promise.race([r,m]).then(i=>e.detectorPromise!==r?(i.destroy(),e.status):(e.detector=i,A(e,"ready"),"ready"),i=>(e.detectorPromise===r&&(e.detectorPromise=null,e.detector=null,A(e,"failed"),console.warn("[@sekyro/web] face-detector preload failed:",i)),e.status)).finally(()=>clearTimeout(s));return e.promise=u,e.scheduled?.settle(u),u}function we(e={}){if(!pe())return Promise.resolve("idle");let n=S(e.assetBaseUrl),r=se(n);return e.respectSaveData===!0&&me()?Promise.resolve(r.status):(r.status==="loading"||r.status==="ready")&&r.promise!==null?r.promise:e.idle===!0?r.scheduled?.promise??ge(r,n):I(r,n)}function ke(e){return g().get(S(e))?.status??"idle"}function De(e,n){let r=se(S(n));return r.listeners.add(e),()=>{r.listeners.delete(e)}}function _e(e){let n=g().get(S(e));n!==void 0&&(n.scheduled?.settle("idle"),n.detector?.destroy(),n.detector=null,n.detectorPromise=null,n.promise=null,A(n,"idle"))}function he(e){return{get tier(){return e.tier},get fallbackReason(){return e.fallbackReason},detect:(...n)=>e.detect(...n),destroy:()=>{}}}function oe(e){let n=S(e),r=g().get(n);if(!(r===void 0||r.detector===null&&r.detectorPromise===null&&r.scheduled===null))return async()=>{r.scheduled!==null&&I(r,n);let s=r.promise;for(;r.detector===null&&s!==null&&(await s,r.promise!==s);)s=r.promise;return r.detector!==null?he(r.detector):C({v3AssetBaseUrl:n})}}function Ce(e){switch(e){case"fcv3.no_face":case"fcv3.center_face":case"fcv3.straighten":return"center";case"fcv3.come_closer":return"closer";case"fcv3.move_back":return"farther";case"fcv3.more_light":case"fcv3.too_bright":return"light";case"fcv3.hold_still":case"fcv3.steady_camera":return"still";case"fcv3.hold_upright":return"upright";case"fcv3.one_face":return"one_face";default:return null}}function Se(e){switch(e){case"preflight":case"acquiring":return"starting";case"positioning":return"gating";default:return e}}function ie(e){switch(e){case"permission":case"notfound":case"inuse":case"insecure":case"unsupported":return e;case"backcamera":return"notfound";default:{let n=e;return"generic"}}}function Le(e,n,r){if(r===void 0)return{kind:ie(e),retryable:n};let s=Z(r.name);return{kind:ie(e),retryable:n,detail:{...s!==void 0?{name:s}:{},phase:r.phase,engineKind:e}}}var ye=new Set(["captured","uploading","checking"]);function Ee(e,n={},r,s=()=>"self",m=()=>{},d){let u=n.now??(()=>performance.now()),i=n.canChooseFacing??ee,f="user",h=te(),p=s(),l=Y(),B=!Q(),H=n.engineOptions,ae=H?.createDetector===void 0&&H?.createWorker===void 0?{createDetector:()=>{let t=oe(e.assetBaseUrl);return t!==void 0?t():C({v3AssetBaseUrl:e.assetBaseUrl})}}:{},U={video:e.video,mode:B?"photo":"clip",rankKeyframes:r,facingMode:void 0,v3AssetBaseUrl:e.assetBaseUrl,screenRamp:()=>p==="self"&&l.count("ramp")>0?m():void 0,...n.engineOptions??{},...ae},o=n.createEngine?.(U)??new X(U),v="idle",L=null,y=0,w=!1,k="full",E=null,b=null,D=0,_=0,K=()=>{e.video.videoWidth>0&&e.video.videoHeight>0&&(D=e.video.videoWidth,_=e.video.videoHeight)},V=ne({enabled:e.keepScreenAwake!==!1}),M=t=>{v=t,V.setActive(t==="starting"||t==="gating"||t==="recording"),l.emit("state",t)},R=()=>l.emit("gate",{progress:y,hint:L,faceDetected:w}),G=()=>{let t=o.animations??"full";t!==k&&(k=t,l.emit("profile",{animations:k}))},de=[o.on("statechange",({state:t})=>{let a=Se(t);a==="starting"&&v!=="starting"&&(L=null,y=0,w=!1,E=null,b=null,D=0,_=0),M(a),G(),a==="recording"&&(K(),E=u(),L="hold",y=1,R())}),o.on("checks",t=>{K(),y=t.progress,w=t.factors.presence>0,R(),G()}),o.on("guidance",({key:t})=>{L=Ce(t),R()}),o.on("frozen",({previewDataUrl:t})=>{b=u(),l.emit("frozen",{previewDataUrl:t})}),o.on("ramp",t=>l.emit("ramp",t)),o.on("artifacts",t=>{if(v!=="captured")return;let a=$(),c=t.clipStats,q=c!==void 0?Math.round(c.durationMs):E!==null&&b!==null?Math.max(0,Math.round(b-E)):void 0,N=c!==void 0&&c.frames>1&&c.durationMs>0?Math.round(c.frames*1e4/c.durationMs)/10:void 0;l.emit("captured",{keyframe:t.keyframe,...t.clip!==void 0?{clip:t.clip}:{},...t.clipMimeType!==void 0?{clipMime:t.clipMimeType}:{},width:e.video.videoWidth||D,height:e.video.videoHeight||_,...q!==void 0?{clipMs:q}:{},...c!==void 0?{clipFrames:c.frames}:{},...N!==void 0?{fps:N}:{},...t.clipRetakes!==void 0?{clipRetakes:t.clipRetakes}:{},...t.clipMimeType!==void 0?{codec:j(t.clipMimeType)}:{},captureChannel:a==="desktop"?"desktop":"mobile",formFactor:a,...B?{degraded:"NO_RECORDER"}:{},engine:"v3",facingMode:o.facingMode,mode:p,...t.timing,...t.screenRamp!==void 0?{screenRamp:t.screenRamp}:{},...t.provenance!==void 0?{provenance:t.provenance}:{}})}),o.on("error",({kind:t,retryable:a,detail:c})=>{t==="backcamera"&&ce()||l.emit("error",Le(t,a,c))})],z=!1;function ce(){return T||z||p!=="assisted"||d===void 0||d.session()!=="choice"?!1:(z=!0,d.onModeChange("self"),p="self",f=O("self"),M("mode_switch"),o.restart(f),!0)}let W=async()=>d!==void 0&&d.session()==="choice"&&await i().catch(()=>!1),T=!1;return{handle:{get state(){return v},get captureMode(){return s()},get facingMode(){return o.facingMode??f},on:(t,a)=>l.on(t,a),start:t=>(p=s(),h.facing(p,e.facing),f=h.facing(p,t?.facing),o.start({facingMode:f})),retry:()=>o.retry(),switchCamera:()=>h.refuseSwitch(s()),canSwitchCaptureMode:W,setCaptureMode:async t=>{if(t===s()||!await W()||T||ye.has(v)||d===void 0)return!1;d.onModeChange(t),p=t;let a=O(t);return f=a,v==="idle"||(M("mode_switch"),o.restart(a)),!0},destroy:()=>{T=!0;for(let t of de)t();V.setActive(!1),o.destroy(),l.clear()}},setFlowState:t=>{v!==t&&M(t)}}}function ze(e){return Ee(e).handle}export{ue as a,re as b,Pe as c,Ae as d,we as e,ke as f,De as g,_e as h,oe as i,Ce as j,Se as k,ie as l,Le as m,Ee as n,ze as o};
@@ -0,0 +1,3 @@
1
+ import{B as Xe,C as ze,D as et,a as Ge,b as Ke,c as qe,d as q,e as Q,f as X,g as Ye,h as L,i as We,j as O,k as U,l as w,m as H,n as D,o as Y,p as je,q as W,r as z,s as $e,t as Ze,u as Je,v as Qe}from"./chunk-MJUOZH3U.js";import{n as Ue}from"./chunk-QP23DM4Z.js";import{a as Le}from"./chunk-7QZWBDI5.js";import{c as de,e as Fe,g as Be,h as ee}from"./chunk-J7D3S5ZJ.js";import{c as Ne,d as ue}from"./chunk-TSA6GHUG.js";function te(e){return e.idNumberBound??e.nniBound}function j(e){return e===void 0?void 0:e.idNumberFromDocument??e.nniFromDocument}function tt(e){let t=e.idNumberMasked??e.nniMasked;return typeof t=="string"&&t!==""?t:void 0}var Ot="https://api.sekyro.ai",At=5e3,It=24e4,wt=3e4,Mt=1500,vt=10;function nt(e){return e instanceof Error&&e.name==="ChallengeError"&&e.code||"challenge_failed"}function Et(e){return new Promise(t=>setTimeout(t,e))}function Tt(){let e=globalThis.crypto;if(e!==void 0&&typeof e.randomUUID=="function")return e.randomUUID();let t=new Uint8Array(16);if(e!==void 0&&typeof e.getRandomValues=="function")e.getRandomValues(t);else for(let r=0;r<16;r+=1)t[r]=Math.floor(Math.random()*256);t[6]=(t[6]??0)&15|64,t[8]=(t[8]??0)&63|128;let o=[...t].map(r=>r.toString(16).padStart(2,"0")).join("");return`${o.slice(0,8)}-${o.slice(8,12)}-${o.slice(12,16)}-${o.slice(16,20)}-${o.slice(20)}`}function wn(e){return Vt(e,{})}function Vt(e,t){let o=e.apiOrigin??Ot,r=e.autoRetry??!0,i=e.rearm??"auto",s=t.client??new Be({apiOrigin:o,sessionToken:e.clientToken,fetch:e.fetch}),u=t.sleep??Et,c=t.uuid??Tt,p=t.getChallengeToken??((n,a)=>import("./challenge-frame-NUGPTWFP.js").then(d=>d.executeChallenge({frameUrl:n.url,siteKey:n.siteKey,action:"liveness",subject:a.subject,signal:a.signal}))),S=Le(),g=null,x=null,l=!1,C=new AbortController,f=null,V=null,$=null,Z=()=>$??$e(f),ge=()=>Ze(z(f),Z()),A=n=>{f=n,S.emit("view",n),g?.onView(n)},_=()=>f!==null?Promise.resolve(f):(V??(V=s.getSession().then(n=>(A(n),n)).finally(()=>{V=null})),V),I=async()=>{let n=await s.getSession();return A(n),n},ne=async(n,a)=>{n.plan!==void 0?A(n):await I()},oe=null,Ce=async n=>{let a=await _();if(n||!a.consentRecorded){let d=await s.recordConsent(e.locale);d.plan!==void 0?A(d):f!==null&&A({...f,consentRecorded:!0})}ve(a)},v=n=>n?.force===!0?Ce(!0):(oe??(oe=Ce(!1).finally(()=>{oe=null})),oe),ie={client:s,ensureConsent:n=>v(n),sleep:u,uuid:c,...t.random!==void 0?{random:t.random}:{},onBusy:n=>{l||S.emit("busy",n)}},_e=!1,ke=null,re=n=>{if(n.status==="verified"||n.status==="not_verified"||n.status==="review"){if(_e)return;_e=!0}ke=JSON.stringify(n),S.emit("result",n)},ft=n=>{ke!==JSON.stringify(n)&&re(n)},Pe=async n=>{let a=f;n&&(a=await I().catch(()=>f));let d=a===null?null:L(a);return d!==null&&!l&&S.emit("method",d),d!==null},be=null,xe=!1,Re=!1,Oe=()=>Xe(ie,(n,a)=>n.submitCheck("population_registry",{},{idempotencyKey:a})),Ae=n=>te(n)===!0||j(w(n,"population_registry"))===!0,mt=async()=>{try{let n=await _();if(O(n)||L(n)!==null||U(n)?.checkType!=="population_registry")return;if(!Ae(n)&&j(w(n,"population_registry"))===void 0&&(n=await I()),!Ae(n)){Re=!0;return}await v(),await ne(await Oe(),"population_registry");let a=f===null?void 0:w(f,"population_registry");if(a?.state==="input_required"&&a.reason==="registry_unavailable"&&X(a)>0){if(await u(At),l)return;await ne(await Oe(),"population_registry")}}catch(n){if(n instanceof de&&(n.code==="check_not_active"||n.code==="step_not_on_path")){await I().catch(()=>{});return}xe=!0;return}f!==null&&O(f)&&re(Y(f,{autoRetry:r}))},Ie=()=>(be??(be=mt()),be),se=t.now??Date.now,N=null,B,ae,we=(n,a)=>`${n.url}
2
+ ${n.siteKey}
3
+ ${a}`,ce=(n,a)=>{let d=p(n,{signal:C.signal,subject:a});return d.then(()=>{ae=void 0},m=>{let h=nt(m);l||h==="aborted"||(ae=h,G({check:"attestation",kind:"unavailable",engineKind:h}))}),d},Me=(n,a)=>n!==null&&n.key===a&&se()-n.at<It,ve=n=>{let a=n?.challenge??null;if(n===null||a===null||l)return;let d=we(a,H(n.sessionId));if(Me(N,d))return;let m=ce(a,H(n.sessionId));m.catch(()=>{}),N={key:d,at:se(),token:m}},ht=async(n,a)=>{let d=we(n,a),m=N;N=null;let h=Me(m,d),b=h?m.at:se(),E=h?m.token.catch(()=>ce(n,a)):ce(n,a);E.catch(()=>{});let P,y=new Promise(R=>{P=setTimeout(()=>R("late"),wt)});try{let R=await Promise.race([E.then(T=>({token:T}),T=>({error:nt(T)})),y]);return R==="late"&&!l&&N===null&&(N={key:d,at:b,token:E}),R}finally{clearTimeout(P)}},Ee=async()=>{B=void 0;let n=await _(),a=n.challenge;if(a==null)return{};let d=await ht(a,H(n.sessionId));return d!=="late"&&"token"in d?{channel:"hosted_web",turnstileToken:d.token}:(B=d!=="late"?d.error:ae,{channel:"hosted_web"})},St=()=>B,G=n=>{if(l)return;let a=s.reportCaptureIssue;if(a===void 0)return;let d=n.formFactor;try{d??(d=Ne())}catch{}try{Promise.resolve(a.call(s,{...n,...d!==void 0?{formFactor:d}:{}})).catch(()=>{})}catch{}},k=null,Te=Promise.resolve(),K=0,yt=async()=>{let n=await _();for(let a=0;a<vt&&!l&&!O(n)&&U(n)===void 0&&Q(n).some(d=>d.state==="processing")&&(await u(Mt),!l);a+=1)n=await I();return n},gt=async(n,a,d)=>{let{capture:m}=n,h=()=>l,b=()=>n.alive&&n.attempt===d,E=y=>{b()&&m.setFlowState(y)},P=y=>{if(!h()&&(y.status==="unavailable"&&y.reasonCode!==void 0&&!Ge(y.reasonCode)&&G({check:"liveness",kind:"unavailable",phase:"upload",engineKind:y.reasonCode,attempt:Math.max(0,n.issues.value)}),re(y),!!b())){if(y.status==="retry"&&i==="auto"){m.handle.retry();return}m.setFlowState("done")}};if(a.degraded==="NO_RECORDER"){let y=f?.sessionId??(await _().catch(()=>null))?.sessionId??"";P(D(y,"no_recorder"));return}E("uploading");try{if(await Ie(),h())return;let y=await _(),R;if(!O(y)&&L(y)!==null){await Pe(!1),P(D(y.sessionId,"method_required"));return}if(!O(y)){if(U(y)?.checkType==="population_registry"){P(D(y.sessionId,Re?"nni_unbound":xe?"network":"registry_unavailable"));return}if(await v(),h())return;R=f??y;let T=await ze({...ie,artifacts:a,getAttestation:Ee,attestationError:St,getView:()=>f??y,refreshView:I,applySubmit:ne,onPhase:E,isCancelled:h,onKeyframePromoted:J=>{x=J}});if(h())return;if(T.kind==="unavailable"){let J=D(y.sessionId,T.reason),De=T.reason==="attestation"?B:void 0;P(De!==void 0?{...J,attestationError:De}:J);return}if(T.kind==="resync"&&await I(),f!==null&&L(f)!==null){await Pe(!1),P(D(y.sessionId,"method_required"));return}y=await yt()}P(Y(y,{autoRetry:r,previous:R}))}catch{if(h())return;P(D(f?.sessionId??"","network"))}},Ct=(n,a)=>{let d=n.attempt;K>0&&n.alive&&n.capture.setFlowState("uploading"),K+=1,Te=Te.then(()=>gt(n,a,d)).finally(()=>{K-=1,K===0&&g?.onChainIdle()}).catch(()=>{})},Ve=n=>{k?.capture.handle.destroy(),k!==null&&(k.alive=!1);let a=Ue(n,g?.captureInternals?.(n)??t.capture,()=>f?.capture?.liveness?.keyframe?.rank===!0,ge,()=>f?.capture?.liveness?.screenRamp,{session:()=>z(f),onModeChange:h=>{$=h}}),d={capture:a,alive:!0,attempt:0,issues:qe()};k=d,a.handle.on("error",h=>{G(Ke("liveness",h,d.issues.value))}),a.handle.on("state",h=>{if(d.issues.note(h),h==="starting"){d.attempt+=1,ve(f);let b=f===null?void 0:U(f)?.checkType;(b==="liveness"||b==="face_match")&&v().catch(()=>{})}}),a.handle.on("captured",h=>{Promise.resolve().then(()=>Ct(d,h))});let m=a.handle;return{get state(){return m.state},get captureMode(){return m.captureMode},get facingMode(){return m.facingMode},on:(h,b)=>m.on(h,b),start:async h=>{if(f===null&&await _().catch(()=>{}),!!d.alive)return m.start(h)},retry:()=>m.retry(),switchCamera:()=>m.switchCamera(),canSwitchCaptureMode:()=>m.canSwitchCaptureMode(),setCaptureMode:h=>m.setCaptureMode(h),destroy:()=>{d.alive=!1,k===d&&(k=null),m.destroy()}}},_t=async()=>{if(l)return null;try{let n=await _();return l?null:L(n)}catch{return null}},kt=async()=>{if(l)return"self";try{let n=await _();if(l)return"self";let a=z(n);return a==="choice"?Z()??a:a}catch{return"self"}},Pt=async()=>{if(l)return!1;try{let n=await _();return l||O(n)||ue()?!1:W(n,U(n))==="phone"||W(n,w(n,"liveness"))==="phone"}catch{return!1}},bt=async()=>{if(l)return!1;try{let n=await _();return!l&&n.returning===!0}catch{return!1}},xt=async n=>{let a=(await _()).plan?.choice,d=a?.options.find(h=>q[h.service]===n);if(!d)throw new RangeError(`method ${String(n)} is not offered`);let m=await s.choose(a.nodeId,d.id);l||A(m)},He=null,Rt=()=>(He??(He=import("./plan-runner-INQLWFGS.js").then(n=>{let a=n.createPlanRunner({runtime:ie,currentView:()=>f,cameraMode:ge,captureModeSwitch:{pick:Z,choose:d=>{$=d}},ensureView:_,refreshView:I,ensureConsent:()=>v(),liveness:Ve,stopLiveness:()=>{k!==null&&(k.alive=!1,k.capture.handle.destroy(),k=null)},chainBusy:()=>K>0,destroyed:()=>l,sleep:u,isMobile:ue,now:t.now??Date.now,keptFaceKey:()=>x,setView:A,baseCapture:t.capture,emitStep:d=>{l||S.emit("step",d)},emitResult:ft,reportCaptureIssue:G,documentInternals:t.document,portraitInternals:t.portrait,livePhotoInternals:t.livePhoto,uploadInternals:t.upload,pageCameraInternals:t.pageCamera});return g=a,a})),He);return{consent:()=>v(),startRegistry:Ie,methodChoice:_t,selectMethod:xt,reportCameraUnavailable:async n=>{await v();let a=s.reportCameraUnavailable;if(a===void 0)throw new TypeError("this client cannot report a missing camera");let d=await a.call(s,n).catch(m=>{if(m instanceof de&&m.code==="check_out_of_order")return s.getSession();throw m});l||A(d)},reportCaptureIssue:G,testerGate:async n=>{let a=s.testerGate;if(a===void 0)throw new TypeError("this client cannot run the tester gate");let d=n.clip,m=Fe(n.clipMime??"");if(d===void 0||!Qe.includes(m))throw new TypeError("the capture has no clip");await v();let h=await Je(s,"clip",m,d.size,{engine:n.engine,durationMs:n.clipMs});await s.uploadToSpaces(h.uploadUrl,d,m);let{key:b}=await s.completeMedia(h.key),E=await Ee(),P=await a.call(s,{clipKey:b,attestation:E,captureChannel:n.captureChannel,capture:{...et(n),attestationError:B}}),{bound:y,...R}=P;return l||(R.plan!==void 0?A(R):await I()),{bound:y===!0}},mobileRequired:Pt,captureMode:kt,chooseCaptureMode:n=>{$=n},get captureChoice(){return Z()},returning:bt,liveness:Ve,run:async()=>{if(l)throw new Error("verification destroyed");return(await Rt()).run()},currentStep:()=>g?.current()??null,voiceClips:async()=>{if(l)return null;try{let n=await _();return l?null:n.voice??null}catch{return null}},on:(n,a)=>S.on(n,a),destroy:()=>{l=!0,C.abort(),g?.destroy(),k!==null&&(k.alive=!1,k.capture.handle.destroy(),k=null),S.clear()}}}var ot=["AD","AE","AF","AG","AI","AL","AM","AO","AQ","AR","AS","AT","AU","AW","AX","AZ","BA","BB","BD","BE","BF","BG","BH","BI","BJ","BL","BM","BN","BO","BQ","BR","BS","BT","BV","BW","BY","BZ","CA","CC","CD","CF","CG","CH","CI","CK","CL","CM","CN","CO","CR","CU","CV","CW","CX","CY","CZ","DE","DJ","DK","DM","DO","DZ","EC","EE","EG","EH","ER","ES","ET","FI","FJ","FK","FM","FO","FR","GA","GB","GD","GE","GF","GG","GH","GI","GL","GM","GN","GP","GQ","GR","GS","GT","GU","GW","GY","HK","HM","HN","HR","HT","HU","ID","IE","IL","IM","IN","IO","IQ","IR","IS","IT","JE","JM","JO","JP","KE","KG","KH","KI","KM","KN","KP","KR","KW","KY","KZ","LA","LB","LC","LI","LK","LR","LS","LT","LU","LV","LY","MA","MC","MD","ME","MF","MG","MH","MK","ML","MM","MN","MO","MP","MQ","MR","MS","MT","MU","MV","MW","MX","MY","MZ","NA","NC","NE","NF","NG","NI","NL","NO","NP","NR","NU","NZ","OM","PA","PE","PF","PG","PH","PK","PL","PM","PN","PR","PS","PT","PW","PY","QA","RE","RO","RS","RU","RW","SA","SB","SC","SD","SE","SG","SH","SI","SJ","SK","SL","SM","SN","SO","SR","SS","ST","SV","SX","SY","SZ","TC","TD","TF","TG","TH","TJ","TK","TL","TM","TN","TO","TR","TT","TV","TW","TZ","UA","UG","UM","US","UY","UZ","VA","VC","VE","VG","VI","VN","VU","WF","WS","XK","YE","YT","ZA","ZM","ZW"];var Ht=["carte_identite","passport","residence_permit","drivers_license"],Dt=["carte_identite","passport","residence_permit"];function Nt(e,t){let o=e.byIssuer?.[t]??e.default;return Ht.filter(r=>o==="*"?Dt.includes(r):o.includes(r))}function Tn(e,t=ot){return[...new Set([...t,...Object.keys(e.byIssuer??{})])].filter(r=>Nt(e,r).length>0).sort()}function it(e){if(e.acceptedDocuments)return e.acceptedDocuments;let t=e.acceptedDocumentTypes?.length?[...e.acceptedDocumentTypes]:["carte_identite","passport"];return{default:[],byIssuer:{MR:t}}}function Vn(e){return/^[A-Z]{2}$/.test(e)?String.fromCodePoint(...[...e].map(t=>127462+t.charCodeAt(0)-65)):""}var rt=Object.freeze({nni_invalid:"id_number_invalid",nni_not_found:"registry_record_not_found",nni_recheck:"id_number_recheck",document_nni_mismatch:"document_id_number_mismatch",nni_locked:"id_number_locked",nni_unbound:"id_number_unbound",missing_nni:"missing_id_number",registry_needs_nni_source:"registry_needs_id_number_source"}),Lt=new Map(Object.entries(rt)),Dn=new Map(Object.entries(rt).map(([e,t])=>[t,e]));function st(e){return Lt.get(e)??e}var qn=["national_number","document_photo","national_eid"],Ut=new Set(["phone_otp","email_otp","national_eid","document","nfc","population_registry","supplied_identity","summary_confirm","liveness","portrait","face_match","aml_screening","face_dedup","age_estimation","proof_of_address"]),Ft=new Set(["supplied_identity","aml_screening","face_dedup","age_estimation"]),pe=["document","population_registry","national_eid"],fe=["phone_otp","email_otp"],ut={identity_method:pe,contact:fe},Bt=["population_registry","document"],me="platform_unsupported",Gt=new Set(["prefilled","user_entered","prefilled_or_entered"]),Kt={phone_otp:"contact",email_otp:"contact",eid_auth:"identity",doc_ocr:"identity",nfc_chip:"identity",population_registry:"identity",liveness:"live_photo",portrait_icao:"live_photo",face_match:"live_photo",poa:"documents"};function M(e){return e.section??Kt[e.checkType]??null}function qt(e,t){let o=e.plan?.choice;if(o===void 0||o.locked)return;let r=o.options.find(i=>i.id!==o.selected&&i.available!==!1&&t.includes(i.service));return r===void 0?void 0:{nodeId:o.nodeId,option:r}}function he(e){let t=e.plan,o=t?.choice;if(t===void 0||o===void 0||o.locked||t.current===null||t.current===o.nodeId||O(e))return null;let r=ut[o.kind]??[...pe,...fe],i=o.options.flatMap(c=>c.available===!1||!r.includes(c.service)?[]:[c.nationalEid!=null?{id:c.id,service:c.service,nationalEid:c.nationalEid}:{id:c.id,service:c.service}]),s=t.steps.find(c=>c.id===t.current)?.service,u=o.selected??i.find(c=>c.service===s)?.id??null;return i.some(c=>c.id!==u)?{nodeId:o.nodeId,kind:o.kind,current:u,options:i}:null}function dt(e){return e==null?[]:e.options.filter(t=>t.id!==e.current)}function Yt(e){let t=e.simulation;if(typeof t!="object"||t===null)return;let{otpCode:o,skipCapture:r}=t;if(typeof o!="string"||o===""||typeof r!="boolean")return;let i=je(e);return i!==void 0?{otpCode:o,skipCapture:r,reason:i}:{otpCode:o,skipCapture:r}}function Wt(e){let t=(e.plan?.sections??[]).map(u=>({id:u.id,state:u.state})),o={sessionId:H(e.sessionId),orgName:e.orgName,sandbox:e.sandbox===!0,returning:e.returning===!0,consentRecorded:e.consentRecorded,expiresAt:e.expiresAt,sections:t.map(u=>u.id),progress:t,purpose:e.purpose??"identity"};e.branding!==void 0&&(o.branding=e.branding),e.cameraUnavailableHandled===!0&&(o.cameraUnavailableHandled=!0);let r=Yt(e);r!==void 0&&(o.simulation=r);let i=e.testerGate;i?.offered===!0&&typeof i.attemptsLeft=="number"&&i.attemptsLeft>0&&(o.testerGate={attemptsLeft:i.attemptsLeft});let s=he(e);return s!==null&&(o.switchable=s),o}function jt(e){let t={attemptsRemaining:X(e),attemptsExhausted:e.attempts.used>=e.attempts.max};return e.reason!==void 0&&(t.reason=e.reason),e.retakeHint!==void 0&&(t.retakeHint=e.retakeHint),t}var lt={phone_otp:"phone",email_otp:"email"};function $t(e,t){let o=qt(e,[t==="phone_otp"?"email_otp":"phone_otp"]);return o===void 0?void 0:lt[o.option.service]}function Zt(e,t,o,r){let i=t.checkType==="email_otp",s=(i?t.emailOtp:t.otp)??{},u=i?t.emailOtp?.emailSource:t.otp?.numberSource,c=u!==void 0&&Gt.has(u)?u:i?"prefilled_or_entered":"user_entered",p=typeof s.sentToMasked=="string"&&s.sentToMasked.length>0,S=s.prefilled===!0,g=$t(e,i?"email_otp":"phone_otp"),x={key:t.checkType,context:o,section:M(t),phase:p?"verify":"send",canSwitch:g!==void 0,...r},l=i?{kind:"email_otp",...x,emailSource:c,needsEmail:c!=="prefilled"&&!S}:{kind:"phone_otp",...x,numberSource:c,needsPhone:c!=="prefilled"&&!S,channels:(t.otp?.channels??[]).filter(C=>C==="whatsapp"||C==="sms")};if(g!==void 0&&(l.switchChannel=g),S&&(l.prefilled=!0),p&&(l.sentToMasked=s.sentToMasked),!i&&t.otp?.channel!==void 0&&(l.channel=t.otp.channel),!i&&Array.isArray(t.phoneCountries)&&(l.phoneCountries=t.phoneCountries.filter(C=>typeof C=="string"&&/^[A-Z]{2}$/.test(C))),!i&&Array.isArray(t.phoneRules)){let C=l.phoneCountries??[];l.phoneRules=t.phoneRules.flatMap(f=>{let V=Xt(f);return V!==void 0&&C.includes(V.code)?[V]:[]})}return!i&&t.phoneInternational===!0&&(l.phoneInternational=!0),s.expiresAt!==void 0&&(l.codeExpiresAt=s.expiresAt),s.resendAvailableAt!==void 0&&(l.resendAvailableAt=s.resendAvailableAt),l}var Jt=/^[\d[\]\-|()?:^]{1,64}$/;function Qt(e){try{return typeof e=="string"&&Jt.test(e)&&new RegExp(e)!==null}catch{return!1}}var at=e=>typeof e=="number"&&Number.isInteger(e)&&e>=1&&e<=15;function Xt(e){let{code:t,dial:o,trunk:r,lengths:i,formats:s}=e??{};if(typeof t!="string"||typeof o!="string"||!/^\d{1,3}$/.test(o)||r!==void 0&&(typeof r!="string"||!/^\d{1,3}$/.test(r))||!Array.isArray(i)||i.length===0||!i.every(at))return;let u={code:t,dial:o,lengths:[...i].sort((c,p)=>c-p)};if(r!==void 0&&(u.trunk=r),s!==void 0){if(!(Array.isArray(s)&&s.length<=8&&s.every(p=>Qt(p?.leading)&&Array.isArray(p.groups)&&p.groups.every(at)&&i.includes(p.groups.reduce((S,g)=>S+g,0)))))return;u.formats=s.map(p=>({leading:p.leading,groups:[...p.groups]}))}return u}function zt(e,t,o,r){let i=te(e)===!0?"bound":j(t)===!0?"document":"typed",s=i==="typed"&&t.state==="input_required"&&t.reason!==void 0&&st(t.reason)==="id_number_recheck",u=dt(he(e)),c=!r.attemptsExhausted&&u.length===1&&u[0]?.service==="document";return{kind:"registry",key:"registry",context:o,section:M(t),state:t.state==="input_required"?"input_required":"pending",source:i,recheck:s,canUseDocument:c,...r}}function en(e,t,o,r,i){let s=[...t.acceptedSides??[]],u={kind:"document",key:"document",context:o,section:M(t),side:s.includes("recto")?"verso":"recto",acceptedSides:s,documents:it(e),photo:ye(Se(e.documents),i),...r};return e.detectedCountry!==void 0&&(u.detectedCountry=e.detectedCountry),on(e)&&(u.ageStepUp=!0),u}function Se(e,t=!0){let o=e?.source==="upload"||e?.source==="choice"?e.source:"camera",r=e?.sourcePick==="camera"||e?.sourcePick==="upload"?e.sourcePick:null;return{source:o,pick:r,uploadOffered:t&&e?.uploadOffered===!0}}function ye(e,t){return t?{...e,cameraOnPhone:!0}:e}var tn=10*1024*1024;function nn(e,t,o,r,i){let s=e.proofOfAddress,u=s?.pdf?.maxBytes,c=s?.phase==="holder_letter"?"holder_letter":"document";return{kind:"proof_of_address",key:"proof_of_address",context:o,section:M(t),phase:c,rule:s?.rule??{country:null,countryFrom:"global",source:"preset_global",kinds:[]},nameMatch:s?.nameMatch??"exact_person",photo:ye(Se(s),i),maxPages:3,pdf:{maxBytes:typeof u=="number"&&u>0?u:tn,maxPages:3},licenceAddressAccepted:c==="document"&&s?.licenceAddressAccepted===!0,...r}}function on(e){let t=Q(e).find(r=>r.checkType==="age_estimation"),o=t?.reason;return t?.state==="failed"&&(o==="age_uncertain"||o==="age_unavailable")}function rn(e){let t=w(e,"liveness");return t?.state==="passed"||t?.state==="review"}function ct(e,t,o,r,i,s=!1){let u=t.icao?.report,c=e.portrait,p=i==="capture"?c?.pendingFix??null:null;p!==null&&(i="review");let S=pt(e);return{kind:"portrait",key:`portrait:${i}`,context:o,section:M(t),phase:i,report:Array.isArray(u)?u:null,review:t.state==="review",tuning:e.capture?.icao??null,tuningVersion:e.capture?.tuningVersion??null,icao:ee(e),retakeOnly:i==="capture"&&t.state==="input_required"&&S===void 0&&e.capture?.livePhoto?.oneCapture===!0&&rn(e),photo:ye(Se(c,i==="capture"),s&&i==="capture"),pendingFix:p,...S!==void 0?{captureMode:S}:{},...c?.reuse?.pending===!0?{reuse:!0}:{},...r}}function pt(e){let t=e.portrait?.captureMode;return t==="self"||t==="assisted"||t==="choice"?t:void 0}var le={minLongSidePx:1280,jpegQuality:.95};function sn(e,t){let o=e.capture?.livePhoto;if(o?.oneCapture!==!0)return null;let r=w(e,"portrait_icao"),i=o.still??le;return{icao:t==="liveness"&&ee(e)!==null&&pt(e)===void 0&&r!==void 0&&r.state==="pending"&&r.reason===void 0,still:{minLongSidePx:i.minLongSidePx??le.minLongSidePx,jpegQuality:i.jpegQuality??le.jpegQuality}}}function an(e,t,o,r){let i=t.eid,s=M(t);if(i===void 0||i.challenge!=="app_code")return{kind:"unsupported",key:"unsupported:eid_auth",context:o,section:s,checkType:"eid_auth",reason:"update_required"};let u=dt(he(e)),c=u.length===1&&Bt.includes(u[0]?.service??"")?u[0]:void 0,p=c===void 0?void 0:q[c.service],S=p!==void 0,g={kind:"eid",key:"eid",context:o,section:s,provider:i.provider,providerName:i.providerName,country:i.country,challenge:"app_code",phase:i.awaiting==="code"?"code":"identifier",identifierBound:i.identifierBound===!0,canUseCamera:S,afterPass:i.afterPass==="continue"?"continue":"end",...r};return S&&(g.cameraMethod=p),i.expiresAt!==void 0&&(g.codeExpiresAt=i.expiresAt),i.resendAvailableAt!==void 0&&(g.resendAvailableAt=i.resendAvailableAt),i.resendsRemaining!==void 0&&(g.resendsRemaining=i.resendsRemaining),i.codeAttemptsRemaining!==void 0&&(g.codeAttemptsRemaining=i.codeAttemptsRemaining),g}function cn(e,t){if(t.checkType!=="face_match"||t.reason!==void 0)return null;let o=w(e,"portrait_icao");return o!==void 0&&(o.state==="passed"||o.state==="review")?o:null}var un={rejected:"rejected",inconclusive:"inconclusive",unavailable:"unavailable",abandoned:"expired",not_opened:"expired",cancelled:"expired",superseded:"expired",policy:"policy"};function dn(e){return e.reasonCode===me?"platform_unsupported":e.status==="review_pending"?"review":e.status==="verified"?"verified":e.reasonCode==="device_cooldown"?"cooldown":e.reasonCode==="starter_credit_claimed"?"policy":(e.status==="not_verified"&&e.reason!==void 0?un[e.reason]:void 0)??"rejected"}function ln(e,t){let o=dn(e),r=o==="platform_unsupported"?{sessionId:H(e.sessionId),status:"unavailable",reasonCode:me}:Y(e,{autoRetry:!1}),i={kind:"result",key:"result",context:t,section:null,display:o,result:r};return e.status==="not_verified"&&e.reason!==void 0&&(i.reason=e.reason),e.reasonCode!==void 0&&(i.reasonCode=e.reasonCode),e.status==="not_verified"&&e.step!==void 0&&(i.step=e.step),e.retryAfter!==void 0&&(i.retryAfter=e.retryAfter),i}function pn(e,t,o){let r=e.identitySummary;if(r==null)return null;let i={kind:"identity_summary",key:"identity_summary",context:t,section:o??"identity",summaryKind:r.kind==="partial"?"partial":r.kind??"full",source:r.source,portraitAvailable:r.portrait?.available===!0,retakeAvailable:r.retakeAvailable===!0};for(let u of fn){let c=r[u];typeof c=="string"&&c!==""&&(i[u]=c)}let s=tt(r);return s!==void 0&&(i.idNumberMasked=s,i.nniMasked=s),i}var fn=["fullName","birthDate","birthYear","nationality","documentType","documentNumberMasked","expiryDate","retakeTarget"];function F(e,t,o,r){return{kind:"unsupported",key:`unsupported:${o}`,context:e,section:t,checkType:o,reason:r}}function mn(e){return e.kind==="contact"?"contact":(e.kind==="identity_method","identity")}function hn(e,t){let o=ut[e.kind]??[...pe,...fe],r=mn(e),i=e.options.flatMap(u=>{if(u.available===!1||!o.includes(u.service))return[];let c={id:u.id,service:u.service};u.nationalEid!=null&&(c.nationalEid=u.nationalEid);let p=(u.channels??[]).filter(S=>S==="whatsapp"||S==="sms");return u.service==="phone_otp"&&p.length>0&&(c.channels=p),[c]});if(i.length===0){let u=e.options.length>0&&e.options.every(c=>c.service==="nfc");return F(t,r,"choice",u?"platform_unsupported":"update_required")}let s={nodeId:e.nodeId,kind:e.kind,selected:e.selected,options:i};if(e.kind==="identity_method"){let u={kind:"method",key:"method",context:t,section:r,options:i.map(p=>q[p.service]),choice:s},c=i.find(p=>p.nationalEid!==void 0)?.nationalEid;return c!==void 0&&(u.nationalEid=c),u}return e.kind==="contact"?{kind:"contact_choice",key:"contact_choice",context:t,section:r,options:i.map(u=>lt[u.service]),selected:null,locked:!1,choice:s}:{kind:"choice",key:`choice:${e.nodeId}`,context:t,section:r,choice:s}}function Yn(e,t={}){let o=Wt(e);if(O(e)||e.reasonCode===me)return ln(e,o);let r=e.plan;if(r===void 0||!Array.isArray(r.sections))return F(o,null,"plan","update_required");let i=Ye(e);if(i!==null)return hn(i,o);let s=r.current===null?void 0:r.steps.find(l=>l.id===r.current),u=l=>{let C={kind:"processing",key:"processing",context:o,section:l!==void 0?M(l):r.sections.find(f=>f.state==="current")?.id??null,stalled:!1};return typeof l?.service=="string"&&l.service!==""&&(C.service=l.service),C};if(r.current===null)return u(r.steps.find(l=>l.state==="processing"));if(s===void 0)return F(o,null,"step","update_required");if(!Ut.has(s.service))return s.interaction==="server"?u(s):F(o,M(s),s.service,"update_required");if(Ft.has(s.service)||!We(s))return u(s);let c=s,p=jt(c),S=c.checkType,g=M(c),x=t.isMobile===!1?W(e,c):null;if(x==="phone")return{kind:"mobile_required",key:"mobile_required",context:o,section:g,checkType:S};switch(S){case"phone_otp":case"email_otp":return Zt(e,c,o,p);case"population_registry":return zt(e,c,o,p);case"eid_auth":return an(e,c,o,p);case"doc_ocr":return en(e,c,o,p,x==="upload_or_phone");case"identity_confirm":return pn(e,o,g)??u(c);case"portrait_icao":return ct(e,c,o,p,"capture",x==="upload_or_phone");case"liveness":case"face_match":{let l=cn(e,c);if(l!==null)return ct(e,l,o,p,"match");let C=c.requiresMobile===!0,f=ee(e);return{kind:"liveness",key:"biometric",context:o,section:g,mode:S==="face_match"?"selfie":"liveness",requiresMobile:C,instructions:f===null?"standard":"icao",icao:f,livePhoto:sn(e,S),...p}}case"poa":return nn(e,c,o,p,x==="upload_or_phone");case"nfc_chip":return F(o,g,S,"platform_unsupported");default:return F(o,g,S,"update_required")}}export{Ot as a,At as b,Mt as c,vt as d,Tt as e,wn as f,Vt as g,ot as h,Ht as i,Nt as j,Tn as k,it as l,Vn as m,qn as n,me as o,M as p,he as q,dt as r,cn as s,Yn as t};
@@ -1 +1 @@
1
- import{d as Z,h as Se,i as Me,j as ke,l as De}from"./chunk-G6LKLN4U.js";import{e as he,f as ye}from"./chunk-NFHLJOHW.js";import{m as V}from"./chunk-65JZHKVG.js";import{a as ge,g as be}from"./chunk-7QZWBDI5.js";import{k as J}from"./chunk-CPUECYAJ.js";var Xe={low:{maxLongEdge:1920,payloadTargetBytes:7e5,qMin:.7,qMax:.92},mid:{maxLongEdge:2240,payloadTargetBytes:12e5,qMin:.7,qMax:.92},good:{maxLongEdge:2560,payloadTargetBytes:16e5,qMin:.7,qMax:.92}};function Ve(e){let{deviceMemory:t,effectiveType:n,saveData:r,downlinkMbps:i,sourceLongEdge:c}=e,s=r===!0||n==="slow-2g"||n==="2g"||i!=null&&i>0&&i<1,u=t!=null&&t<=2,l=n==="4g"||i!=null&&i>=5,f=t!=null&&t>=6,p;s||u?p="low":l&&f?p="good":p="mid";let b=Xe[p],S=c&&c>0?Math.min(b.maxLongEdge,c):b.maxLongEdge;return{tier:p,...b,maxLongEdge:S}}function we(e){let t={};try{let n=navigator;typeof n.deviceMemory=="number"&&(t.deviceMemory=n.deviceMemory);let r=n.connection;r&&(t.effectiveType=r.effectiveType,t.saveData=r.saveData,t.downlinkMbps=r.downlink)}catch{}return typeof e=="number"&&e>0&&(t.sourceLongEdge=e),Ve(t)}function Ye(e,t,n){let r=Math.min(1,Math.max(0,(e-.28)/.21999999999999997)),i=(t+n)/2;return Math.max(t,n-r*(n-i))}function Qe(e,t,n){let r=Math.max(e,t),i=r>0?Math.min(1,n/r):1;return{width:Math.max(1,Math.round(e*i)),height:Math.max(1,Math.round(t*i))}}async function Ke(e,t){let n=t.startQ,r=await e(n);for(let i=0;i<4&&!(r.size<=t.budgetBytes||n<=t.qMin);i++)n=Math.max(t.qMin,n-.08),r=await e(n);return{blob:r,quality:n}}async function Ce(e,t,n,r,i){if(t<=0||n<=0)return null;let{width:c,height:s}=Qe(t,n,r.maxLongEdge),u=document.createElement("canvas");u.width=c,u.height=s;let l=u.getContext("2d");if(!l)return null;l.drawImage(e,0,0,c,s);let f=B=>new Promise((h,w)=>{u.toBlob(d=>d?h(d):w(new Error("canvas toBlob returned null")),"image/jpeg",B)}),p=Ye(i,r.qMin,r.qMax),{blob:b,quality:S}=await Ke(f,{startQ:p,qMin:r.qMin,budgetBytes:r.payloadTargetBytes}).finally(()=>{u.width=0,u.height=0});if(b.size>5242880)throw new Error("encoded document exceeds the 5242880-byte media cap");return{blob:b,quality:S,width:c,height:s}}async function ee(e){let t=we(Math.max(e.width,e.height)),n=await Ce(e,e.width,e.height,t,.5);if(n===null)throw new Error("canvas encode unavailable");return{blob:n.blob,width:n.width,height:n.height}}async function ft(e){let t=await createImageBitmap(e);try{return await ee(t)}finally{t.close()}}var bt=250,ht=.6,yt=1800,St=6e3,Mt=2e3,Re=.16;function ne(e,t){return{layout:e,phase:"framing",captured:{},pending:[],lastCaptureAt:t,lastReportAt:t,manualShutter:!1,restPhase:"framing",readSides:[],needFlip:!1,flipped:!1,flipTimeoutSpent:!1,timeoutCapture:!1,lastShotByTimeout:!1}}var xe=e=>e==="recto"?"verso":"recto",ve=e=>e.phase==="framing"||e.phase==="locking"||e.phase==="flipCue"||e.phase==="reaskRecto",re=e=>(e.captured.recto!==void 0?1:0)+(e.captured.verso!==void 0?1:0)+e.pending.length;function te(e,t){return e.lastCaptureAt>=0&&e.lastReportAt>=0?e:{...e,lastCaptureAt:e.lastCaptureAt<0?t:e.lastCaptureAt,lastReportAt:e.lastReportAt<0?t:e.lastReportAt}}function je(e,t,n){if(e.phase==="result")return{...e,lastReportAt:n};let r=!t.present||e.captureArea!==void 0&&t.areaFrac<.6*e.captureArea,{flipped:i,awaySince:c}=e;r&&(c=c??n),c!==void 0&&n-c>=250&&(i=!0),r||(c=void 0);let s=e.flipTimeoutSpent&&!(i&&!e.flipped),u={...e,lastReportAt:n,flipped:i,awaySince:c,flipTimeoutSpent:s,lastArea:t.areaFrac};if(!ve(e))return u;if(e.needFlip&&!i){if(!t.ready)return{...u,phase:e.restPhase,goodSince:void 0};let l=e.lastShot!==void 0&&e.pending.includes(e.lastShot);if(s||l)return{...u,goodSince:void 0,phase:e.restPhase};let f=e.goodSince??n;return n-f>=1800?{...u,goodSince:f,phase:"capturing",flipTimeoutSpent:!0,timeoutCapture:!0}:{...u,goodSince:f,phase:e.restPhase}}return t.ready?{...u,phase:"capturing",goodSince:e.goodSince??n}:{...u,goodSince:void 0,phase:t.locking?"locking":e.restPhase}}function $e(e,t){if(!ve(e)||e.manualShutter)return e;let n=t-e.lastReportAt>=2e3,r=t-e.lastCaptureAt>=6e3;return n||r?{...e,manualShutter:!0}:e}function Je(e,t,n){let r=e.layout==="singlePage",i=r?{recto:t}:e.captured,c=r?[]:[...e.pending,t],s={...e,captured:i,pending:c,lastShot:t,lastCaptureAt:n,lastReportAt:-1,manualShutter:!1,goodSince:void 0,notice:void 0,awaySince:void 0,flipped:!1,lastShotByTimeout:e.timeoutCapture,timeoutCapture:!1,captureArea:e.lastArea};return r||re({captured:i,pending:c})>=2?{...s,phase:"reading",restPhase:"framing",current:void 0,needFlip:!1}:{...s,phase:"flipCue",restPhase:"flipCue",current:void 0,needFlip:!0}}function Le(e,t,n){return e.pending.includes(t)?{...e,pending:e.pending.filter(r=>r!==t),lastShot:e.lastShot===t?void 0:e.lastShot,phase:e.phase==="capturing"?e.phase:"flipCue",restPhase:"flipCue",current:xe(n),needFlip:!0,flipTimeoutSpent:!0,goodSince:void 0,manualShutter:!0,notice:"same_face",lastCaptureAt:-1,lastReportAt:-1}:e}function Ze(e,t,n){if(!e.pending.includes(t))return e;if(e.captured[n]!==void 0)return Le(e,t,n);let r=e.pending.filter(l=>l!==t),i={...e,pending:r,captured:{...e.captured,[n]:t}};if(re(i)!==1||e.layout==="singlePage")return i;let c=xe(n),s=c==="recto"&&e.restPhase==="reaskRecto"?"reaskRecto":"flipCue",u=e.phase==="flipCue"||e.phase==="reaskRecto"||e.phase==="framing";return{...i,restPhase:s,current:c,phase:u?s:e.phase}}function et(e,t){let n=t.id??e.captured[t.side],r={...e.captured};(t.id===void 0||r[t.side]===t.id)&&delete r[t.side];let i=e.pending.filter(f=>f!==n),c=e.layout==="twoSided"&&re({captured:r,pending:i})>0,s=e.lastShotByTimeout||n===e.lastShot!==e.flipped,u=c&&!s,l=u?t.side==="recto"?"reaskRecto":"flipCue":"framing";return{...e,captured:r,pending:i,readSides:e.readSides.filter(f=>f!==t.side),lastShot:e.lastShot===n?void 0:e.lastShot,notice:t.issue,goodSince:void 0,manualShutter:!1,phase:l,restPhase:l,current:t.side,needFlip:u,flipped:!1,flipTimeoutSpent:!1,awaySince:void 0,lastCaptureAt:-1,lastReportAt:-1}}function Te(e,t){switch(t.type){case"report":return je(te(e,t.at),t.report,t.at);case"tick":return $e(te(e,t.at),t.at);case"captured":return Je(te(e,t.at),t.id,t.at);case"captureFailed":return{...e,phase:e.restPhase,goodSince:void 0,lastCaptureAt:t.at,manualShutter:!0,timeoutCapture:!1};case"classified":return Ze(e,t.id,t.side);case"duplicate":return Le(e,t.id,t.side);case"readOk":{let n=e.readSides.includes(t.side)?e.readSides:[...e.readSides,t.side],r=["recto","verso"].filter(c=>e.captured[c]!==void 0),i=e.phase==="reading"&&e.pending.length===0&&r.every(c=>n.includes(c));return{...e,readSides:n,flipTimeoutSpent:!1,phase:i?"result":e.phase}}case"readFailed":return et(e,t);case"clockRestart":return e.lastCaptureAt<0&&e.lastReportAt<0&&e.awaySince===void 0?e:{...e,awaySince:void 0,lastCaptureAt:-1,lastReportAt:-1};case"retake":return{...ne(e.layout,-1),lastCaptureAt:-1,lastReportAt:-1};default:return e}}function tt(e,t,n=!1){let r=e(t);return r===null?"recto":!n||r.y+r.height/2>=t.height/2?"verso":"recto"}async function nt(e,t=!1){let{detectMrzBand:n}=await import("./mrz-band-VYHOTDHY.js");return tt(n,e,t)}async function oe(e,t=480,n,r=n!=null){let i=n??{x:0,y:0,width:e.width,height:e.height},c=Math.max(1,Math.round(i.height/i.width*t)),s=document.createElement("canvas");s.width=t,s.height=c;try{let u=s.getContext("2d");return u===null?"recto":(u.drawImage(e,i.x,i.y,i.width,i.height,0,0,t,c),await nt(u.getImageData(0,0,t,c),r))}finally{s.width=0,s.height=0}}async function Dt(e,t=480){try{let n=await createImageBitmap(e),r=Math.max(1,Math.round(n.height/n.width*t)),i=document.createElement("canvas");i.width=t,i.height=r;let c=i.getContext("2d");return c===null?(n.close(),null):(c.drawImage(n,0,0,t,r),n.close(),c.getImageData(0,0,t,r))}catch{return null}}var ae=(e,t,n)=>Math.min(n,Math.max(t,Math.round(e))),Y=e=>Math.round(Math.min(1,Math.max(0,e))*1e4)/1e4;async function _e(e,t,n,r){let i=r.decode??(l=>createImageBitmap(l)),c=async()=>e.stillRead(await i(t),r.region??[0,0,1,1],r.detectorLimit),s;try{s=await c()}catch{try{await new Promise(l=>setTimeout(l,r.retryMs??300)),s=await c()}catch{return null}}let u=s.mrzBox;return u===void 0?null:{engine:r.engine,source:"live_mrz",format:n.format,lineCount:ae(n.lineCount,2,3),checkDigitsValid:!0,stillConfirmed:s.valid&&s.digest===n.digest,band:[Y(u[0]),Y(u[1]),Y(Math.min(u[2],1-u[0])),Y(Math.min(u[3],1-u[1]))],digest:n.digest,framesToValid:ae(n.framesToValid,1,1e3),msToValid:ae(n.msToValid,0,12e4)}}function Ct(e){let t=null;return e?.then(n=>{t=n}),()=>t}var rt=new Uint8Array([0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,10,1,8,0,65,0,253,15,253,98,11]),ot=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,10,7,1,5,0,6,64,11,11]);function Ee(e,t=globalThis){let n=t.WebAssembly?.validate;if(typeof n!="function")return{ok:!1,reason:"simd"};try{if(!n.call(t.WebAssembly,rt)||!n.call(t.WebAssembly,ot))return{ok:!1,reason:"simd"}}catch{return{ok:!1,reason:"simd"}}if(typeof t.Worker!="function")return{ok:!1,reason:"worker"};if(typeof t.createImageBitmap!="function")return{ok:!1,reason:"bitmap"};let r=t.navigator?.deviceMemory;return typeof r=="number"&&r<e.minDeviceMemoryGb?{ok:!1,reason:"memory"}:{ok:!0}}function Oe(e=globalThis){let t=e.navigator?.connection;return t?.saveData===!0||["slow-2g","2g","3g"].includes(t?.effectiveType??"")}var _=class extends Error{constructor(t){super(t),this.name="OcrEngineError",this.code=t}};function Pe(){let e=t=>(t.close(),Promise.reject(new _("unsupported")));return{ready:Promise.resolve("unsupported"),busy:!1,bandRead:e,stillRead:e,layoutRead:e,dispose:()=>{}}}function Ae(e){let t;try{if(e.createWorker)t=e.createWorker();else if(e.workerUrl!==void 0)t=new Worker(e.workerUrl,{type:"module",name:"sekyro-ocr"});else return Pe()}catch{return Pe()}let n=new Map,r=0,i=!1,c=!1,s=!1;t.addEventListener("message",d=>{let g=d.data,C=n.get(g.id);C&&(n.delete(g.id),C.resolve(g))});let u=()=>{for(let d of n.values())d.reject(new _("error"));n.clear(),f()};t.addEventListener("error",u),t.addEventListener("messageerror",u);function l(d,g=[]){if(i)return Promise.reject(new _("disposed"));let C=++r;return new Promise((A,O)=>{n.set(C,{resolve:A,reject:O});try{t.postMessage({...d,id:C},g)}catch{n.delete(C),O(new _("error"))}})}function f(){if(!i){i=!0;try{t.postMessage({id:++r,kind:"dispose"})}catch{}t.terminate();for(let d of n.values())d.reject(new _("disposed"));n.clear()}}let p=(async()=>{let d=await l({kind:"init",baseUrl:e.baseUrl,salt:e.salt,detectorLimit:e.tuning.detectorLimit,maxDownloadMs:e.tuning.maxDownloadMs});if(d.kind==="failed")return d.reason;if(d.kind!=="ready")return"error";let g=await l({kind:"warmup"});return g.kind!=="ready"?"error":{warmupMs:g.warmupMs,downloadMs:d.downloadMs,cached:d.cached}})().catch(()=>"error"),b,S=new Promise(d=>{b=setTimeout(()=>d("timeout"),e.tuning.loadTimeoutMs)}),B=Promise.race([p,S]).then(d=>(clearTimeout(b),typeof d=="string"?f():s=!0,i&&typeof d!="string"?"error":d));(e.page===void 0?globalThis.addEventListener?globalThis:null:e.page)?.addEventListener("pagehide",f,{once:!0});async function w(d,g,C){if(i)throw g.close(),new _("disposed");if(!s)throw g.close(),new _("not_ready");if(c)throw g.close(),new _("busy");c=!0;let A;try{let O=new Promise((Q,M)=>{A=setTimeout(()=>{M(new _("timeout")),f()},e.tuning.readTimeoutMs??1e4)}),P=await Promise.race([l(d,[g]),O]);if(P.kind===C){let{id:Q,...M}=P;return M}throw new _(P.kind==="error"?P.code:P.kind==="failed"?P.reason:"error")}finally{clearTimeout(A),c=!1}}return{ready:B,get busy(){return c},bandRead:(d,g=e.tuning.detectorLimit)=>w({kind:"band",bitmap:d,detectorLimit:g},d,"band"),stillRead:(d,g,C=e.tuning.detectorLimit)=>w({kind:"still",bitmap:d,region:g,detectorLimit:C},d,"band"),layoutRead:(d,g)=>w({kind:"layout",bitmap:d,detectorLimit:g},d,"layout"),dispose:f}}var U="sekyro-ocr-1",ie=e=>e!==null&&typeof e=="object"?e:{},v=(e,t,n,r)=>typeof e=="number"&&Number.isFinite(e)&&e>=t&&e<=n?e:r,Be=(e,t)=>typeof e=="boolean"?e:t,Ie=e=>{let t=typeof e=="string"?/^sekyro-ocr-(\d{1,4})$/.exec(e):null;return t?Number(t[1]):Number.POSITIVE_INFINITY};function We(e,t={}){let n=ie(e),r=ie(n.liveMrz),i=ie(n.frontLock),c=Ie(t.engine??U),s=t.mode==="off",u=d=>d.enabled===!0?d.arm==="live"?"live":"control":null,l=u(r),f=u(i),p=(d,g)=>!s&&g==="live"&&Ie(d.minEngine??U)<=c,b=ke,S=p(r,l)?{detectorLimit:v(r.detectorLimit,320,1600,b.detectorLimit),bandMaxWidthPx:v(r.bandMaxWidthPx,320,4096,b.bandMaxWidthPx),minBandWidthPx:v(r.minBandWidthPx,0,4096,b.minBandWidthPx),bandTop:v(r.bandTop,0,.95,b.bandTop),minIntervalMs:v(r.minIntervalMs,0,5e3,b.minIntervalMs),stableReads:Math.round(v(r.stableReads,1,10,b.stableReads)),profileReads:Math.round(v(r.profileReads,1,100,b.profileReads)),maxReadMs:v(r.maxReadMs,50,6e4,b.maxReadMs),searchTimeoutMs:v(r.searchTimeoutMs,1e3,12e4,b.searchTimeoutMs),hint:Be(r.hint,!0),stillConfirm:Be(r.stillConfirm,!0)}:null,B=Me,h=(d,g,C)=>v(i[d],g,C,B[d]),w=p(i,f)?{minLines:Math.round(h("minLines",1,50)),fillMin:h("fillMin",0,1),fillMax:h("fillMax",0,2),offsetMax:h("offsetMax",0,1),steadyFillDelta:h("steadyFillDelta",0,1),steadyOffsetDelta:h("steadyOffsetDelta",0,1),layoutShiftMax:h("layoutShiftMax",0,1),lineCountDelta:Math.round(h("lineCountDelta",0,50)),lockMs:h("lockMs",0,3e4),steadyMs:h("steadyMs",0,3e4),minFrames:Math.round(h("minFrames",1,100)),minIntervalMs:h("minIntervalMs",0,5e3),maxWidthPx:h("maxWidthPx",160,2048),detectorLimit:h("detectorLimit",320,1600),searchTimeoutMs:h("searchTimeoutMs",1e3,12e4)}:null;return{enabled:S!==null||w!==null,liveMrz:S,textLock:w,liveMrzArm:l,frontLockArm:f,load:{detectorLimit:S?.detectorLimit??w?.detectorLimit??b.detectorLimit,loadTimeoutMs:v(r.loadTimeoutMs,1e3,12e4,2e4),maxDownloadMs:v(r.maxDownloadMs,1e3,12e4,2e4),minDeviceMemoryGb:v(r.minDeviceMemoryGb,0,64,2)},reportSampleRate:v(r.reportSampleRate,0,1,1)}}function Fe(e,t){return e.enabled?!(t.probe??Ee)({minDeviceMemoryGb:e.load.minDeviceMemoryGb}).ok||(t.slow??Oe)()?{ok:!1,reason:"unsupported"}:{ok:!0,engine:Ae({baseUrl:t.baseUrl,salt:t.salt,tuning:{detectorLimit:e.load.detectorLimit,maxDownloadMs:e.load.maxDownloadMs,loadTimeoutMs:e.load.loadTimeoutMs},...t.workerUrl!==void 0?{workerUrl:t.workerUrl}:{},...t.createWorker!==void 0?{createWorker:t.createWorker}:{},...t.page!==void 0?{page:t.page}:{}})}:{ok:!1,reason:"off"}}function at(e=typeof navigator<"u"?navigator.userAgent:""){return/SamsungBrowser\//.test(e)?"samsung":/Firefox\/|FxiOS\//.test(e)?"firefox":/Chrome\/|CriOS\/|Chromium\//.test(e)&&!/Edg\/|OPR\//.test(e)?"chrome":/Safari\//.test(e)&&/Version\/|Mobile\//.test(e)&&!/Chrome\/|CriOS\//.test(e)?"safari":"other"}var W=e=>e===void 0||!Number.isFinite(e)?void 0:Math.min(6e5,Math.max(0,Math.round(e))),se=(e,t,n)=>e===void 0||!Number.isFinite(e)?void 0:Math.min(n,Math.max(t,Math.round(e)));function ze(e){let t=e.assist??null,n=e.load!==null&&e.load!==void 0&&typeof e.load=="object"?e.load:null,r=typeof e.load=="string"?e.load:null,i=t!==null?t.outcome:r==="unsupported"||r==="download"||r==="integrity"?r:r==="error"||r==="timeout"?"error":"off",c={kind:"live_mrz",platform:"web",engine:e.engine??U,arm:e.arm,capture:e.capture,outcome:i,reads:se(t?.reads??0,0,1e4)??0,browser:e.browser??at()},s=(u,l)=>{l!==void 0&&(c[u]=l)};return s("format",t?.format),s("framesToValid",se(t?.framesToValid,1,1e4)),s("msToValid",W(t?.msToValid)),s("framesToLock",se(t?.framesToLock,1,1e4)),s("msToLock",W(t?.msToLock)),s("msToCapture",W(e.msToCapture)),s("readP50Ms",W(t?.readP50Ms)),s("readP90Ms",W(t?.readP90Ms)),s("deviceClass",t?.deviceClass),n!==null&&(s("warmupMs",W(n.warmupMs)),s("downloadMs",W(n.downloadMs)),s("cached",n.cached)),s("stillConfirmed",e.stillConfirmed),s("typeMismatch",e.typeMismatch),c}function ue(e,t){return e===void 0?!1:t==="passport"?e!=="TD3":e==="TD3"}var it=2;async function st(e){let t=await import("./capture-session-doc-WZMI5XPE.js");return new t.CaptureSessionDoc(e)}function ut(e){return{topLeft:{x:e.x,y:e.y},topRight:{x:e.x+e.width,y:e.y},bottomRight:{x:e.x+e.width,y:e.y+e.height},bottomLeft:{x:e.x,y:e.y+e.height}}}function ct(e,t,n){let r=[e.topLeft,e.topRight,e.bottomRight,e.bottomLeft],i=0;for(let c=0;c<r.length;c+=1){let s=r[c],u=r[(c+1)%r.length];i+=s.x*u.y-u.x*s.y}return t>0&&n>0?Math.abs(i)/2/(t*n):0}function Ht(){import("./capture-session-doc-WZMI5XPE.js").then(e=>e.warmDocDetector()).catch(()=>{})}function Xt(e){return lt(e,{}).handle}function lt(e,t){let n=ge(),r=be({enabled:e.keepScreenAwake!==!1}),i=t.decode??(o=>createImageBitmap(o)),c=t.blurRefuseSharpnessMax??.16,s=t.now??(()=>performance.now()),u=e.documentType==="passport"||e.side==="single",l=ne(u?"singlePage":"twoSided",s());if(!u&&(e.side==="recto"||e.side==="verso")){let o=e.side==="recto"?"verso":"recto";l={...l,captured:{[o]:"server"},readSides:[o],current:e.side,phase:"flipCue",restPhase:"flipCue"}}let f="idle",p=null,b=null,S=!0,B=0,h=0,w=!1,d=!1,g="",C=null,A,O=null,P=[],Q=he.find(o=>o.docType===e.documentType)?.mrz==="none",M=t.webOcr!==void 0&&!Q?We(t.webOcr.captureDocument,{mode:e.liveMrz?.mode??"auto"}):null,N=null,F=M===null||!M.enabled?"off":null,G=null,q=null,ce=new WeakMap,K="";if(M!==null&&M.enabled&&t.webOcr!==void 0){let o=t.webOcr,a=Fe(M,{baseUrl:e.liveMrz?.assetBaseUrl??o.baseUrl,salt:o.salt,...e.liveMrz?.workerUrl!==void 0?{workerUrl:e.liveMrz.workerUrl}:{},...o.createWorker!==void 0?{createWorker:o.createWorker}:{}});if(a.ok){N=a.engine;let m=new De({textLock:M.textLock,liveMrz:M.liveMrz});G=m;let y=a.engine;y.ready.then(L=>{F=L,typeof L!="string"&&S&&m.setEngine(y)})}else F=a.reason}let z=o=>{let a=JSON.stringify(o);a!==K&&(K=a,n.emit("mrz",o))},le=(o,a)=>{let m=t.webOcr?.reports;if(m===void 0||M===null||o===void 0)return;let y=o.format==="ID-3"||o.side==="single"?"single":o.side==="verso"?"verso":"recto",L=y!=="recto"?M.liveMrzArm??M.frontLockArm:M.frontLockArm;if(L===null||Math.random()>=M.reportSampleRate)return;let T=o.via==="live_mrz"?q:null,x=()=>{let E=T?.value??null;m([ze({arm:L,capture:y,assist:o.ocr??null,load:L==="control"?"off":F,...o.msToCapture!==void 0?{msToCapture:o.msToCapture}:{},...E!==null&&E.stillConfirmed!==void 0?{stillConfirmed:E.stillConfirmed}:{},...a!==void 0?{typeMismatch:ue(a.format,e.documentType==="passport"?"passport":"card")}:{}})])};T!==null&&T.value===null?Promise.race([T.promise,new Promise(E=>setTimeout(E,3e3))]).then(x):x()},I=o=>{!S||o===f||(f=o,r.setActive(o==="starting"||o==="scanning"),n.emit("state",o))},Ne=(o,a)=>a===void 0?null:u?"single":o.captured.recto===a?"recto":o.captured.verso===a?"verso":null,Ue=o=>({phase:o.phase,captured:u?o.captured.recto!==void 0?["single"]:[]:["recto","verso"].filter(a=>o.captured[a]!==void 0),expected:u?null:o.current??null,notice:o.notice??null,lastShot:Ne(o,o.lastShot),manualShutter:o.manualShutter,torchAvailable:p?.torchAvailable()??!1,torch:d}),de=()=>{let o=p;o!==null&&o.captureNow().catch(()=>R({type:"captureFailed",at:s()}))};function R(o){if(!S)return;let a=l;l=Te(l,o),l.phase==="capturing"&&a.phase!=="capturing"&&Promise.resolve().then(de),l.phase==="result"&&a.phase!=="result"&&(I("done"),me());let m=Ue(l),y=JSON.stringify(m);y!==g&&(g=y,n.emit("scan",m))}function me(){O!==null&&clearInterval(O),O=null;for(let o of P.splice(0))o();p?.destroy(),p=null,r.setActive(!1)}let pe=()=>p?.captureReport?.(),j=!1,fe=(o,a)=>{if(!(o===void 0||t.onFaceReport===void 0))try{t.onFaceReport(o,a)}catch{}},H=o=>{K="",!(p===null||l.phase==="reading"||l.phase==="result")&&(j=!1,p.rearm(u?"single":l.current??o))},Ge=async(o,a,m,y)=>{if(q=null,y!==void 0&&N!==null&&M?.liveMrz?.hint===!0){let k={promise:_e(N,o,y,{engine:U,detectorLimit:M.liveMrz.detectorLimit}).catch(()=>null),value:null};k.promise.then(D=>{k.value=D}),q=k}y!==void 0&&ue(y.format,e.documentType==="passport"?"passport":"card")&&z({state:"mismatch",format:y.format});let L=pe();fe(L,"captured"),j=!0,le(L,y);let T=m===void 0?C:m===null?null:{quad:ut(m),frameWidth:0,frameHeight:0,inStill:!0},x={decoded:null},E=()=>(x.decoded??(x.decoded=Promise.resolve().then(()=>i(o)).catch(()=>null)),x.decoded);try{await qe(o,a,T,E,q)}finally{x.decoded!==null&&(await x.decoded)?.close()}},qe=async(o,a,m,y,L)=>{let T=`shot-${B+=1}`;if(R({type:"captured",id:T,at:s()}),e.haptics!==!1)try{globalThis.navigator?.vibrate?.(30)}catch{}if(!w&&c>0){let k=await(t.measureSharpness!==void 0?t.measureSharpness(o,m):y().then(D=>D===null?-1:Se(D,Z(m?.quad??null,m?.inStill===!0?D:{width:m?.frameWidth??0,height:m?.frameHeight??0},D)))).catch(()=>-1);if(!S)return;if(Number.isFinite(k)&&k>=0&&k<c){w=!0;let D=u?"recto":l.current??(l.captured.recto===void 0?"recto":"verso");R({type:"readFailed",side:D,id:T,issue:"blurry"}),H(D);return}}w=!1;let x;if(u)x="single";else{let k=l.current,D=await(t.classify!==void 0?t.classify(o):y().then(X=>X===null?k??"recto":m?.inStill===!0?oe(X,480,null,!0):oe(X,480,Z(m?.quad??null,{width:m?.frameWidth??0,height:m?.frameHeight??0},X)))).catch(()=>k??"recto");if(!S)return;if(l.captured[D]!==void 0&&h<it){h+=1,R({type:"duplicate",id:T,side:D}),H(D==="recto"?"verso":"recto");return}x=l.captured[D]!==void 0&&k!==void 0?k:D,h=0,R({type:"classified",id:T,side:x})}let E=x==="verso"?"verso":"recto";try{let k=t.encode!==void 0?await t.encode(o):await y().then(D=>{if(D===null)throw new Error("the still could not be decoded");return ee(D)});if(!S)return;L!==null&&ce.set(k.blob,L),n.emit("captured",{image:k.blob,side:x,documentType:e.documentType,...e.issuer!==void 0?{issuer:e.issuer}:{},width:k.width,height:k.height,previewDataUrl:a}),t.deferRead!==!0&&R({type:"readOk",side:E})}catch(k){R({type:"readFailed",side:E,id:T,issue:"technical"}),n.emit("error",V("generic",!0,{phase:"keyframes",name:J(k)}))}H(E==="recto"?"verso":"recto")},He=o=>{P.push(o.on("statechange",({state:a})=>{a==="preflight"||a==="acquiring"?I("starting"):a==="positioning"?I("scanning"):a==="captured"?I("captured"):a==="error"&&I("error")}),o.on("feedback",({key:a,reticle:m})=>n.emit("feedback",{key:a,reticle:m})),o.on("checks",a=>{n.emit("gate",{progress:a.p,quad:a.quad,frameWidth:a.frameWidth,frameHeight:a.frameHeight,...a.guide!==void 0?{guide:{detected:a.guide.detected,fill:a.guide.fill,offsetX:a.guide.offsetX??0,offsetY:a.guide.offsetY??0}}:{}});let m=a.ocr?.mrz;m!==void 0&&(m.state==="fallback"?z({state:"fallback",reason:m.reason}):m.state==="valid"?z({state:"valid",format:m.format}):m.state==="reading"?z({state:"reading",...m.format?{format:m.format}:{},...m.coach?{coach:m.coach}:{}}):z({state:"searching"}));let y=a.quad===null?0:ct(a.quad,a.frameWidth,a.frameHeight);C=a.quad===null?null:{quad:a.quad,frameWidth:a.frameWidth,frameHeight:a.frameHeight},R({type:"report",report:{present:a.quad!==null&&a.plausible||a.guide?.detected===!0,ready:a.ready===!0,locking:a.p>=.5,areaFrac:y},at:s()})}),o.on("error",({kind:a,retryable:m,detail:y})=>n.emit("error",V(a,m,y))),o.on("artifacts",a=>{Ge(a.keyframe,a.previewDataUrl,a.docRegion,a.liveMrz)}))},$=()=>(b??(b=(async()=>{if(S){if(p===null){let o;try{o=await(t.createEngine??st)({...t.engineOptions??{},...A!==void 0?{guide:A}:{},video:e.video,format:ye(e.documentType),side:u?"single":e.side??"recto",autoCapture:!1,...G!==null?{ocr:G}:{}})}catch(m){I("error"),n.emit("error",V("models",!0,{phase:"models",name:J(m)}));return}if(!S){o.destroy();return}p=o,He(o);let a=t.tickMs??500;a>0&&(O=setInterval(()=>R({type:"tick",at:s()}),a))}R({type:"clockRestart"}),M!==null&&M.liveMrzArm==="live"&&(F==="unsupported"||F==="off")&&z({state:"fallback",reason:F}),await p.start()}})().finally(()=>{b=null})),b);return{handle:{get state(){return f},on:(o,a)=>n.on(o,a),start:$,retry:()=>{if(p===null&&l.phase==="result"){R({type:"retake"}),h=0,w=!1,$();return}if(p!==null&&f!=="error"){R({type:"retake"}),h=0,w=!1,p.rearm(u?"single":void 0);return}$()},setSide:o=>{u||o==="single"||(l.current!==o&&(l={...l,current:o}),R({type:"clockRestart"}),l.phase!=="reading"&&l.phase!=="result"&&p?.rearm(o))},shutter:de,focusAt:(o,a)=>{p?.focusAt?.(o,a)},setGuide:o=>{A=o,p?.setGuide?.(o)},setTorch:o=>{d=o,p?.setTorch(o),R({type:"tick",at:s()})},destroy:()=>{if(S&&p!==null&&f!=="done"){let o=pe();!j&&o!==void 0&&o.ticks>0&&fe(o,"abandoned"),le(o,void 0)}S=!1,me(),G?.setEngine(null),N?.dispose(),N=null,n.clear()}},setFlowState:o=>{(l.phase==="reading"||l.phase==="result")&&I(o==="done"&&l.phase!=="result"?"scanning":o)},settle:(o,a)=>{let m=o==="verso"?"verso":"recto";R(a.ok?{type:"readOk",side:m}:{type:"readFailed",side:m,issue:a.issue}),a.ok||H(m)},takeDeviceRead:o=>ce.get(o.image)?.value??null}}export{ft as a,bt as b,ht as c,yt as d,St as e,Mt as f,Re as g,ne as h,Te as i,tt as j,nt as k,Dt as l,_e as m,Ct as n,U as o,We as p,Fe as q,at as r,ze as s,ue as t,it as u,Ht as v,Xt as w,lt as x};
1
+ import{d as Z,h as Se,i as Me,j as ke,l as De}from"./chunk-G6LKLN4U.js";import{e as he,f as ye}from"./chunk-NFHLJOHW.js";import{m as V}from"./chunk-QP23DM4Z.js";import{a as ge,g as be}from"./chunk-7QZWBDI5.js";import{k as J}from"./chunk-CPUECYAJ.js";var Xe={low:{maxLongEdge:1920,payloadTargetBytes:7e5,qMin:.7,qMax:.92},mid:{maxLongEdge:2240,payloadTargetBytes:12e5,qMin:.7,qMax:.92},good:{maxLongEdge:2560,payloadTargetBytes:16e5,qMin:.7,qMax:.92}};function Ve(e){let{deviceMemory:t,effectiveType:n,saveData:r,downlinkMbps:i,sourceLongEdge:c}=e,s=r===!0||n==="slow-2g"||n==="2g"||i!=null&&i>0&&i<1,u=t!=null&&t<=2,l=n==="4g"||i!=null&&i>=5,f=t!=null&&t>=6,p;s||u?p="low":l&&f?p="good":p="mid";let b=Xe[p],S=c&&c>0?Math.min(b.maxLongEdge,c):b.maxLongEdge;return{tier:p,...b,maxLongEdge:S}}function we(e){let t={};try{let n=navigator;typeof n.deviceMemory=="number"&&(t.deviceMemory=n.deviceMemory);let r=n.connection;r&&(t.effectiveType=r.effectiveType,t.saveData=r.saveData,t.downlinkMbps=r.downlink)}catch{}return typeof e=="number"&&e>0&&(t.sourceLongEdge=e),Ve(t)}function Ye(e,t,n){let r=Math.min(1,Math.max(0,(e-.28)/.21999999999999997)),i=(t+n)/2;return Math.max(t,n-r*(n-i))}function Qe(e,t,n){let r=Math.max(e,t),i=r>0?Math.min(1,n/r):1;return{width:Math.max(1,Math.round(e*i)),height:Math.max(1,Math.round(t*i))}}async function Ke(e,t){let n=t.startQ,r=await e(n);for(let i=0;i<4&&!(r.size<=t.budgetBytes||n<=t.qMin);i++)n=Math.max(t.qMin,n-.08),r=await e(n);return{blob:r,quality:n}}async function Ce(e,t,n,r,i){if(t<=0||n<=0)return null;let{width:c,height:s}=Qe(t,n,r.maxLongEdge),u=document.createElement("canvas");u.width=c,u.height=s;let l=u.getContext("2d");if(!l)return null;l.drawImage(e,0,0,c,s);let f=B=>new Promise((h,w)=>{u.toBlob(d=>d?h(d):w(new Error("canvas toBlob returned null")),"image/jpeg",B)}),p=Ye(i,r.qMin,r.qMax),{blob:b,quality:S}=await Ke(f,{startQ:p,qMin:r.qMin,budgetBytes:r.payloadTargetBytes}).finally(()=>{u.width=0,u.height=0});if(b.size>5242880)throw new Error("encoded document exceeds the 5242880-byte media cap");return{blob:b,quality:S,width:c,height:s}}async function ee(e){let t=we(Math.max(e.width,e.height)),n=await Ce(e,e.width,e.height,t,.5);if(n===null)throw new Error("canvas encode unavailable");return{blob:n.blob,width:n.width,height:n.height}}async function ft(e){let t=await createImageBitmap(e);try{return await ee(t)}finally{t.close()}}var bt=250,ht=.6,yt=1800,St=6e3,Mt=2e3,Re=.16;function ne(e,t){return{layout:e,phase:"framing",captured:{},pending:[],lastCaptureAt:t,lastReportAt:t,manualShutter:!1,restPhase:"framing",readSides:[],needFlip:!1,flipped:!1,flipTimeoutSpent:!1,timeoutCapture:!1,lastShotByTimeout:!1}}var xe=e=>e==="recto"?"verso":"recto",ve=e=>e.phase==="framing"||e.phase==="locking"||e.phase==="flipCue"||e.phase==="reaskRecto",re=e=>(e.captured.recto!==void 0?1:0)+(e.captured.verso!==void 0?1:0)+e.pending.length;function te(e,t){return e.lastCaptureAt>=0&&e.lastReportAt>=0?e:{...e,lastCaptureAt:e.lastCaptureAt<0?t:e.lastCaptureAt,lastReportAt:e.lastReportAt<0?t:e.lastReportAt}}function je(e,t,n){if(e.phase==="result")return{...e,lastReportAt:n};let r=!t.present||e.captureArea!==void 0&&t.areaFrac<.6*e.captureArea,{flipped:i,awaySince:c}=e;r&&(c=c??n),c!==void 0&&n-c>=250&&(i=!0),r||(c=void 0);let s=e.flipTimeoutSpent&&!(i&&!e.flipped),u={...e,lastReportAt:n,flipped:i,awaySince:c,flipTimeoutSpent:s,lastArea:t.areaFrac};if(!ve(e))return u;if(e.needFlip&&!i){if(!t.ready)return{...u,phase:e.restPhase,goodSince:void 0};let l=e.lastShot!==void 0&&e.pending.includes(e.lastShot);if(s||l)return{...u,goodSince:void 0,phase:e.restPhase};let f=e.goodSince??n;return n-f>=1800?{...u,goodSince:f,phase:"capturing",flipTimeoutSpent:!0,timeoutCapture:!0}:{...u,goodSince:f,phase:e.restPhase}}return t.ready?{...u,phase:"capturing",goodSince:e.goodSince??n}:{...u,goodSince:void 0,phase:t.locking?"locking":e.restPhase}}function $e(e,t){if(!ve(e)||e.manualShutter)return e;let n=t-e.lastReportAt>=2e3,r=t-e.lastCaptureAt>=6e3;return n||r?{...e,manualShutter:!0}:e}function Je(e,t,n){let r=e.layout==="singlePage",i=r?{recto:t}:e.captured,c=r?[]:[...e.pending,t],s={...e,captured:i,pending:c,lastShot:t,lastCaptureAt:n,lastReportAt:-1,manualShutter:!1,goodSince:void 0,notice:void 0,awaySince:void 0,flipped:!1,lastShotByTimeout:e.timeoutCapture,timeoutCapture:!1,captureArea:e.lastArea};return r||re({captured:i,pending:c})>=2?{...s,phase:"reading",restPhase:"framing",current:void 0,needFlip:!1}:{...s,phase:"flipCue",restPhase:"flipCue",current:void 0,needFlip:!0}}function Le(e,t,n){return e.pending.includes(t)?{...e,pending:e.pending.filter(r=>r!==t),lastShot:e.lastShot===t?void 0:e.lastShot,phase:e.phase==="capturing"?e.phase:"flipCue",restPhase:"flipCue",current:xe(n),needFlip:!0,flipTimeoutSpent:!0,goodSince:void 0,manualShutter:!0,notice:"same_face",lastCaptureAt:-1,lastReportAt:-1}:e}function Ze(e,t,n){if(!e.pending.includes(t))return e;if(e.captured[n]!==void 0)return Le(e,t,n);let r=e.pending.filter(l=>l!==t),i={...e,pending:r,captured:{...e.captured,[n]:t}};if(re(i)!==1||e.layout==="singlePage")return i;let c=xe(n),s=c==="recto"&&e.restPhase==="reaskRecto"?"reaskRecto":"flipCue",u=e.phase==="flipCue"||e.phase==="reaskRecto"||e.phase==="framing";return{...i,restPhase:s,current:c,phase:u?s:e.phase}}function et(e,t){let n=t.id??e.captured[t.side],r={...e.captured};(t.id===void 0||r[t.side]===t.id)&&delete r[t.side];let i=e.pending.filter(f=>f!==n),c=e.layout==="twoSided"&&re({captured:r,pending:i})>0,s=e.lastShotByTimeout||n===e.lastShot!==e.flipped,u=c&&!s,l=u?t.side==="recto"?"reaskRecto":"flipCue":"framing";return{...e,captured:r,pending:i,readSides:e.readSides.filter(f=>f!==t.side),lastShot:e.lastShot===n?void 0:e.lastShot,notice:t.issue,goodSince:void 0,manualShutter:!1,phase:l,restPhase:l,current:t.side,needFlip:u,flipped:!1,flipTimeoutSpent:!1,awaySince:void 0,lastCaptureAt:-1,lastReportAt:-1}}function Te(e,t){switch(t.type){case"report":return je(te(e,t.at),t.report,t.at);case"tick":return $e(te(e,t.at),t.at);case"captured":return Je(te(e,t.at),t.id,t.at);case"captureFailed":return{...e,phase:e.restPhase,goodSince:void 0,lastCaptureAt:t.at,manualShutter:!0,timeoutCapture:!1};case"classified":return Ze(e,t.id,t.side);case"duplicate":return Le(e,t.id,t.side);case"readOk":{let n=e.readSides.includes(t.side)?e.readSides:[...e.readSides,t.side],r=["recto","verso"].filter(c=>e.captured[c]!==void 0),i=e.phase==="reading"&&e.pending.length===0&&r.every(c=>n.includes(c));return{...e,readSides:n,flipTimeoutSpent:!1,phase:i?"result":e.phase}}case"readFailed":return et(e,t);case"clockRestart":return e.lastCaptureAt<0&&e.lastReportAt<0&&e.awaySince===void 0?e:{...e,awaySince:void 0,lastCaptureAt:-1,lastReportAt:-1};case"retake":return{...ne(e.layout,-1),lastCaptureAt:-1,lastReportAt:-1};default:return e}}function tt(e,t,n=!1){let r=e(t);return r===null?"recto":!n||r.y+r.height/2>=t.height/2?"verso":"recto"}async function nt(e,t=!1){let{detectMrzBand:n}=await import("./mrz-band-VYHOTDHY.js");return tt(n,e,t)}async function oe(e,t=480,n,r=n!=null){let i=n??{x:0,y:0,width:e.width,height:e.height},c=Math.max(1,Math.round(i.height/i.width*t)),s=document.createElement("canvas");s.width=t,s.height=c;try{let u=s.getContext("2d");return u===null?"recto":(u.drawImage(e,i.x,i.y,i.width,i.height,0,0,t,c),await nt(u.getImageData(0,0,t,c),r))}finally{s.width=0,s.height=0}}async function Dt(e,t=480){try{let n=await createImageBitmap(e),r=Math.max(1,Math.round(n.height/n.width*t)),i=document.createElement("canvas");i.width=t,i.height=r;let c=i.getContext("2d");return c===null?(n.close(),null):(c.drawImage(n,0,0,t,r),n.close(),c.getImageData(0,0,t,r))}catch{return null}}var ae=(e,t,n)=>Math.min(n,Math.max(t,Math.round(e))),Y=e=>Math.round(Math.min(1,Math.max(0,e))*1e4)/1e4;async function _e(e,t,n,r){let i=r.decode??(l=>createImageBitmap(l)),c=async()=>e.stillRead(await i(t),r.region??[0,0,1,1],r.detectorLimit),s;try{s=await c()}catch{try{await new Promise(l=>setTimeout(l,r.retryMs??300)),s=await c()}catch{return null}}let u=s.mrzBox;return u===void 0?null:{engine:r.engine,source:"live_mrz",format:n.format,lineCount:ae(n.lineCount,2,3),checkDigitsValid:!0,stillConfirmed:s.valid&&s.digest===n.digest,band:[Y(u[0]),Y(u[1]),Y(Math.min(u[2],1-u[0])),Y(Math.min(u[3],1-u[1]))],digest:n.digest,framesToValid:ae(n.framesToValid,1,1e3),msToValid:ae(n.msToValid,0,12e4)}}function Ct(e){let t=null;return e?.then(n=>{t=n}),()=>t}var rt=new Uint8Array([0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,10,1,8,0,65,0,253,15,253,98,11]),ot=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,10,7,1,5,0,6,64,11,11]);function Ee(e,t=globalThis){let n=t.WebAssembly?.validate;if(typeof n!="function")return{ok:!1,reason:"simd"};try{if(!n.call(t.WebAssembly,rt)||!n.call(t.WebAssembly,ot))return{ok:!1,reason:"simd"}}catch{return{ok:!1,reason:"simd"}}if(typeof t.Worker!="function")return{ok:!1,reason:"worker"};if(typeof t.createImageBitmap!="function")return{ok:!1,reason:"bitmap"};let r=t.navigator?.deviceMemory;return typeof r=="number"&&r<e.minDeviceMemoryGb?{ok:!1,reason:"memory"}:{ok:!0}}function Oe(e=globalThis){let t=e.navigator?.connection;return t?.saveData===!0||["slow-2g","2g","3g"].includes(t?.effectiveType??"")}var _=class extends Error{constructor(t){super(t),this.name="OcrEngineError",this.code=t}};function Pe(){let e=t=>(t.close(),Promise.reject(new _("unsupported")));return{ready:Promise.resolve("unsupported"),busy:!1,bandRead:e,stillRead:e,layoutRead:e,dispose:()=>{}}}function Ae(e){let t;try{if(e.createWorker)t=e.createWorker();else if(e.workerUrl!==void 0)t=new Worker(e.workerUrl,{type:"module",name:"sekyro-ocr"});else return Pe()}catch{return Pe()}let n=new Map,r=0,i=!1,c=!1,s=!1;t.addEventListener("message",d=>{let g=d.data,C=n.get(g.id);C&&(n.delete(g.id),C.resolve(g))});let u=()=>{for(let d of n.values())d.reject(new _("error"));n.clear(),f()};t.addEventListener("error",u),t.addEventListener("messageerror",u);function l(d,g=[]){if(i)return Promise.reject(new _("disposed"));let C=++r;return new Promise((A,O)=>{n.set(C,{resolve:A,reject:O});try{t.postMessage({...d,id:C},g)}catch{n.delete(C),O(new _("error"))}})}function f(){if(!i){i=!0;try{t.postMessage({id:++r,kind:"dispose"})}catch{}t.terminate();for(let d of n.values())d.reject(new _("disposed"));n.clear()}}let p=(async()=>{let d=await l({kind:"init",baseUrl:e.baseUrl,salt:e.salt,detectorLimit:e.tuning.detectorLimit,maxDownloadMs:e.tuning.maxDownloadMs});if(d.kind==="failed")return d.reason;if(d.kind!=="ready")return"error";let g=await l({kind:"warmup"});return g.kind!=="ready"?"error":{warmupMs:g.warmupMs,downloadMs:d.downloadMs,cached:d.cached}})().catch(()=>"error"),b,S=new Promise(d=>{b=setTimeout(()=>d("timeout"),e.tuning.loadTimeoutMs)}),B=Promise.race([p,S]).then(d=>(clearTimeout(b),typeof d=="string"?f():s=!0,i&&typeof d!="string"?"error":d));(e.page===void 0?globalThis.addEventListener?globalThis:null:e.page)?.addEventListener("pagehide",f,{once:!0});async function w(d,g,C){if(i)throw g.close(),new _("disposed");if(!s)throw g.close(),new _("not_ready");if(c)throw g.close(),new _("busy");c=!0;let A;try{let O=new Promise((Q,M)=>{A=setTimeout(()=>{M(new _("timeout")),f()},e.tuning.readTimeoutMs??1e4)}),P=await Promise.race([l(d,[g]),O]);if(P.kind===C){let{id:Q,...M}=P;return M}throw new _(P.kind==="error"?P.code:P.kind==="failed"?P.reason:"error")}finally{clearTimeout(A),c=!1}}return{ready:B,get busy(){return c},bandRead:(d,g=e.tuning.detectorLimit)=>w({kind:"band",bitmap:d,detectorLimit:g},d,"band"),stillRead:(d,g,C=e.tuning.detectorLimit)=>w({kind:"still",bitmap:d,region:g,detectorLimit:C},d,"band"),layoutRead:(d,g)=>w({kind:"layout",bitmap:d,detectorLimit:g},d,"layout"),dispose:f}}var U="sekyro-ocr-1",ie=e=>e!==null&&typeof e=="object"?e:{},v=(e,t,n,r)=>typeof e=="number"&&Number.isFinite(e)&&e>=t&&e<=n?e:r,Be=(e,t)=>typeof e=="boolean"?e:t,Ie=e=>{let t=typeof e=="string"?/^sekyro-ocr-(\d{1,4})$/.exec(e):null;return t?Number(t[1]):Number.POSITIVE_INFINITY};function We(e,t={}){let n=ie(e),r=ie(n.liveMrz),i=ie(n.frontLock),c=Ie(t.engine??U),s=t.mode==="off",u=d=>d.enabled===!0?d.arm==="live"?"live":"control":null,l=u(r),f=u(i),p=(d,g)=>!s&&g==="live"&&Ie(d.minEngine??U)<=c,b=ke,S=p(r,l)?{detectorLimit:v(r.detectorLimit,320,1600,b.detectorLimit),bandMaxWidthPx:v(r.bandMaxWidthPx,320,4096,b.bandMaxWidthPx),minBandWidthPx:v(r.minBandWidthPx,0,4096,b.minBandWidthPx),bandTop:v(r.bandTop,0,.95,b.bandTop),minIntervalMs:v(r.minIntervalMs,0,5e3,b.minIntervalMs),stableReads:Math.round(v(r.stableReads,1,10,b.stableReads)),profileReads:Math.round(v(r.profileReads,1,100,b.profileReads)),maxReadMs:v(r.maxReadMs,50,6e4,b.maxReadMs),searchTimeoutMs:v(r.searchTimeoutMs,1e3,12e4,b.searchTimeoutMs),hint:Be(r.hint,!0),stillConfirm:Be(r.stillConfirm,!0)}:null,B=Me,h=(d,g,C)=>v(i[d],g,C,B[d]),w=p(i,f)?{minLines:Math.round(h("minLines",1,50)),fillMin:h("fillMin",0,1),fillMax:h("fillMax",0,2),offsetMax:h("offsetMax",0,1),steadyFillDelta:h("steadyFillDelta",0,1),steadyOffsetDelta:h("steadyOffsetDelta",0,1),layoutShiftMax:h("layoutShiftMax",0,1),lineCountDelta:Math.round(h("lineCountDelta",0,50)),lockMs:h("lockMs",0,3e4),steadyMs:h("steadyMs",0,3e4),minFrames:Math.round(h("minFrames",1,100)),minIntervalMs:h("minIntervalMs",0,5e3),maxWidthPx:h("maxWidthPx",160,2048),detectorLimit:h("detectorLimit",320,1600),searchTimeoutMs:h("searchTimeoutMs",1e3,12e4)}:null;return{enabled:S!==null||w!==null,liveMrz:S,textLock:w,liveMrzArm:l,frontLockArm:f,load:{detectorLimit:S?.detectorLimit??w?.detectorLimit??b.detectorLimit,loadTimeoutMs:v(r.loadTimeoutMs,1e3,12e4,2e4),maxDownloadMs:v(r.maxDownloadMs,1e3,12e4,2e4),minDeviceMemoryGb:v(r.minDeviceMemoryGb,0,64,2)},reportSampleRate:v(r.reportSampleRate,0,1,1)}}function Fe(e,t){return e.enabled?!(t.probe??Ee)({minDeviceMemoryGb:e.load.minDeviceMemoryGb}).ok||(t.slow??Oe)()?{ok:!1,reason:"unsupported"}:{ok:!0,engine:Ae({baseUrl:t.baseUrl,salt:t.salt,tuning:{detectorLimit:e.load.detectorLimit,maxDownloadMs:e.load.maxDownloadMs,loadTimeoutMs:e.load.loadTimeoutMs},...t.workerUrl!==void 0?{workerUrl:t.workerUrl}:{},...t.createWorker!==void 0?{createWorker:t.createWorker}:{},...t.page!==void 0?{page:t.page}:{}})}:{ok:!1,reason:"off"}}function at(e=typeof navigator<"u"?navigator.userAgent:""){return/SamsungBrowser\//.test(e)?"samsung":/Firefox\/|FxiOS\//.test(e)?"firefox":/Chrome\/|CriOS\/|Chromium\//.test(e)&&!/Edg\/|OPR\//.test(e)?"chrome":/Safari\//.test(e)&&/Version\/|Mobile\//.test(e)&&!/Chrome\/|CriOS\//.test(e)?"safari":"other"}var W=e=>e===void 0||!Number.isFinite(e)?void 0:Math.min(6e5,Math.max(0,Math.round(e))),se=(e,t,n)=>e===void 0||!Number.isFinite(e)?void 0:Math.min(n,Math.max(t,Math.round(e)));function ze(e){let t=e.assist??null,n=e.load!==null&&e.load!==void 0&&typeof e.load=="object"?e.load:null,r=typeof e.load=="string"?e.load:null,i=t!==null?t.outcome:r==="unsupported"||r==="download"||r==="integrity"?r:r==="error"||r==="timeout"?"error":"off",c={kind:"live_mrz",platform:"web",engine:e.engine??U,arm:e.arm,capture:e.capture,outcome:i,reads:se(t?.reads??0,0,1e4)??0,browser:e.browser??at()},s=(u,l)=>{l!==void 0&&(c[u]=l)};return s("format",t?.format),s("framesToValid",se(t?.framesToValid,1,1e4)),s("msToValid",W(t?.msToValid)),s("framesToLock",se(t?.framesToLock,1,1e4)),s("msToLock",W(t?.msToLock)),s("msToCapture",W(e.msToCapture)),s("readP50Ms",W(t?.readP50Ms)),s("readP90Ms",W(t?.readP90Ms)),s("deviceClass",t?.deviceClass),n!==null&&(s("warmupMs",W(n.warmupMs)),s("downloadMs",W(n.downloadMs)),s("cached",n.cached)),s("stillConfirmed",e.stillConfirmed),s("typeMismatch",e.typeMismatch),c}function ue(e,t){return e===void 0?!1:t==="passport"?e!=="TD3":e==="TD3"}var it=2;async function st(e){let t=await import("./capture-session-doc-LUA4Y7PZ.js");return new t.CaptureSessionDoc(e)}function ut(e){return{topLeft:{x:e.x,y:e.y},topRight:{x:e.x+e.width,y:e.y},bottomRight:{x:e.x+e.width,y:e.y+e.height},bottomLeft:{x:e.x,y:e.y+e.height}}}function ct(e,t,n){let r=[e.topLeft,e.topRight,e.bottomRight,e.bottomLeft],i=0;for(let c=0;c<r.length;c+=1){let s=r[c],u=r[(c+1)%r.length];i+=s.x*u.y-u.x*s.y}return t>0&&n>0?Math.abs(i)/2/(t*n):0}function Ht(){import("./capture-session-doc-LUA4Y7PZ.js").then(e=>e.warmDocDetector()).catch(()=>{})}function Xt(e){return lt(e,{}).handle}function lt(e,t){let n=ge(),r=be({enabled:e.keepScreenAwake!==!1}),i=t.decode??(o=>createImageBitmap(o)),c=t.blurRefuseSharpnessMax??.16,s=t.now??(()=>performance.now()),u=e.documentType==="passport"||e.side==="single",l=ne(u?"singlePage":"twoSided",s());if(!u&&(e.side==="recto"||e.side==="verso")){let o=e.side==="recto"?"verso":"recto";l={...l,captured:{[o]:"server"},readSides:[o],current:e.side,phase:"flipCue",restPhase:"flipCue"}}let f="idle",p=null,b=null,S=!0,B=0,h=0,w=!1,d=!1,g="",C=null,A,O=null,P=[],Q=he.find(o=>o.docType===e.documentType)?.mrz==="none",M=t.webOcr!==void 0&&!Q?We(t.webOcr.captureDocument,{mode:e.liveMrz?.mode??"auto"}):null,N=null,F=M===null||!M.enabled?"off":null,G=null,q=null,ce=new WeakMap,K="";if(M!==null&&M.enabled&&t.webOcr!==void 0){let o=t.webOcr,a=Fe(M,{baseUrl:e.liveMrz?.assetBaseUrl??o.baseUrl,salt:o.salt,...e.liveMrz?.workerUrl!==void 0?{workerUrl:e.liveMrz.workerUrl}:{},...o.createWorker!==void 0?{createWorker:o.createWorker}:{}});if(a.ok){N=a.engine;let m=new De({textLock:M.textLock,liveMrz:M.liveMrz});G=m;let y=a.engine;y.ready.then(L=>{F=L,typeof L!="string"&&S&&m.setEngine(y)})}else F=a.reason}let z=o=>{let a=JSON.stringify(o);a!==K&&(K=a,n.emit("mrz",o))},le=(o,a)=>{let m=t.webOcr?.reports;if(m===void 0||M===null||o===void 0)return;let y=o.format==="ID-3"||o.side==="single"?"single":o.side==="verso"?"verso":"recto",L=y!=="recto"?M.liveMrzArm??M.frontLockArm:M.frontLockArm;if(L===null||Math.random()>=M.reportSampleRate)return;let T=o.via==="live_mrz"?q:null,x=()=>{let E=T?.value??null;m([ze({arm:L,capture:y,assist:o.ocr??null,load:L==="control"?"off":F,...o.msToCapture!==void 0?{msToCapture:o.msToCapture}:{},...E!==null&&E.stillConfirmed!==void 0?{stillConfirmed:E.stillConfirmed}:{},...a!==void 0?{typeMismatch:ue(a.format,e.documentType==="passport"?"passport":"card")}:{}})])};T!==null&&T.value===null?Promise.race([T.promise,new Promise(E=>setTimeout(E,3e3))]).then(x):x()},I=o=>{!S||o===f||(f=o,r.setActive(o==="starting"||o==="scanning"),n.emit("state",o))},Ne=(o,a)=>a===void 0?null:u?"single":o.captured.recto===a?"recto":o.captured.verso===a?"verso":null,Ue=o=>({phase:o.phase,captured:u?o.captured.recto!==void 0?["single"]:[]:["recto","verso"].filter(a=>o.captured[a]!==void 0),expected:u?null:o.current??null,notice:o.notice??null,lastShot:Ne(o,o.lastShot),manualShutter:o.manualShutter,torchAvailable:p?.torchAvailable()??!1,torch:d}),de=()=>{let o=p;o!==null&&o.captureNow().catch(()=>R({type:"captureFailed",at:s()}))};function R(o){if(!S)return;let a=l;l=Te(l,o),l.phase==="capturing"&&a.phase!=="capturing"&&Promise.resolve().then(de),l.phase==="result"&&a.phase!=="result"&&(I("done"),me());let m=Ue(l),y=JSON.stringify(m);y!==g&&(g=y,n.emit("scan",m))}function me(){O!==null&&clearInterval(O),O=null;for(let o of P.splice(0))o();p?.destroy(),p=null,r.setActive(!1)}let pe=()=>p?.captureReport?.(),j=!1,fe=(o,a)=>{if(!(o===void 0||t.onFaceReport===void 0))try{t.onFaceReport(o,a)}catch{}},H=o=>{K="",!(p===null||l.phase==="reading"||l.phase==="result")&&(j=!1,p.rearm(u?"single":l.current??o))},Ge=async(o,a,m,y)=>{if(q=null,y!==void 0&&N!==null&&M?.liveMrz?.hint===!0){let k={promise:_e(N,o,y,{engine:U,detectorLimit:M.liveMrz.detectorLimit}).catch(()=>null),value:null};k.promise.then(D=>{k.value=D}),q=k}y!==void 0&&ue(y.format,e.documentType==="passport"?"passport":"card")&&z({state:"mismatch",format:y.format});let L=pe();fe(L,"captured"),j=!0,le(L,y);let T=m===void 0?C:m===null?null:{quad:ut(m),frameWidth:0,frameHeight:0,inStill:!0},x={decoded:null},E=()=>(x.decoded??(x.decoded=Promise.resolve().then(()=>i(o)).catch(()=>null)),x.decoded);try{await qe(o,a,T,E,q)}finally{x.decoded!==null&&(await x.decoded)?.close()}},qe=async(o,a,m,y,L)=>{let T=`shot-${B+=1}`;if(R({type:"captured",id:T,at:s()}),e.haptics!==!1)try{globalThis.navigator?.vibrate?.(30)}catch{}if(!w&&c>0){let k=await(t.measureSharpness!==void 0?t.measureSharpness(o,m):y().then(D=>D===null?-1:Se(D,Z(m?.quad??null,m?.inStill===!0?D:{width:m?.frameWidth??0,height:m?.frameHeight??0},D)))).catch(()=>-1);if(!S)return;if(Number.isFinite(k)&&k>=0&&k<c){w=!0;let D=u?"recto":l.current??(l.captured.recto===void 0?"recto":"verso");R({type:"readFailed",side:D,id:T,issue:"blurry"}),H(D);return}}w=!1;let x;if(u)x="single";else{let k=l.current,D=await(t.classify!==void 0?t.classify(o):y().then(X=>X===null?k??"recto":m?.inStill===!0?oe(X,480,null,!0):oe(X,480,Z(m?.quad??null,{width:m?.frameWidth??0,height:m?.frameHeight??0},X)))).catch(()=>k??"recto");if(!S)return;if(l.captured[D]!==void 0&&h<it){h+=1,R({type:"duplicate",id:T,side:D}),H(D==="recto"?"verso":"recto");return}x=l.captured[D]!==void 0&&k!==void 0?k:D,h=0,R({type:"classified",id:T,side:x})}let E=x==="verso"?"verso":"recto";try{let k=t.encode!==void 0?await t.encode(o):await y().then(D=>{if(D===null)throw new Error("the still could not be decoded");return ee(D)});if(!S)return;L!==null&&ce.set(k.blob,L),n.emit("captured",{image:k.blob,side:x,documentType:e.documentType,...e.issuer!==void 0?{issuer:e.issuer}:{},width:k.width,height:k.height,previewDataUrl:a}),t.deferRead!==!0&&R({type:"readOk",side:E})}catch(k){R({type:"readFailed",side:E,id:T,issue:"technical"}),n.emit("error",V("generic",!0,{phase:"keyframes",name:J(k)}))}H(E==="recto"?"verso":"recto")},He=o=>{P.push(o.on("statechange",({state:a})=>{a==="preflight"||a==="acquiring"?I("starting"):a==="positioning"?I("scanning"):a==="captured"?I("captured"):a==="error"&&I("error")}),o.on("feedback",({key:a,reticle:m})=>n.emit("feedback",{key:a,reticle:m})),o.on("checks",a=>{n.emit("gate",{progress:a.p,quad:a.quad,frameWidth:a.frameWidth,frameHeight:a.frameHeight,...a.guide!==void 0?{guide:{detected:a.guide.detected,fill:a.guide.fill,offsetX:a.guide.offsetX??0,offsetY:a.guide.offsetY??0}}:{}});let m=a.ocr?.mrz;m!==void 0&&(m.state==="fallback"?z({state:"fallback",reason:m.reason}):m.state==="valid"?z({state:"valid",format:m.format}):m.state==="reading"?z({state:"reading",...m.format?{format:m.format}:{},...m.coach?{coach:m.coach}:{}}):z({state:"searching"}));let y=a.quad===null?0:ct(a.quad,a.frameWidth,a.frameHeight);C=a.quad===null?null:{quad:a.quad,frameWidth:a.frameWidth,frameHeight:a.frameHeight},R({type:"report",report:{present:a.quad!==null&&a.plausible||a.guide?.detected===!0,ready:a.ready===!0,locking:a.p>=.5,areaFrac:y},at:s()})}),o.on("error",({kind:a,retryable:m,detail:y})=>n.emit("error",V(a,m,y))),o.on("artifacts",a=>{Ge(a.keyframe,a.previewDataUrl,a.docRegion,a.liveMrz)}))},$=()=>(b??(b=(async()=>{if(S){if(p===null){let o;try{o=await(t.createEngine??st)({...t.engineOptions??{},...A!==void 0?{guide:A}:{},video:e.video,format:ye(e.documentType),side:u?"single":e.side??"recto",autoCapture:!1,...G!==null?{ocr:G}:{}})}catch(m){I("error"),n.emit("error",V("models",!0,{phase:"models",name:J(m)}));return}if(!S){o.destroy();return}p=o,He(o);let a=t.tickMs??500;a>0&&(O=setInterval(()=>R({type:"tick",at:s()}),a))}R({type:"clockRestart"}),M!==null&&M.liveMrzArm==="live"&&(F==="unsupported"||F==="off")&&z({state:"fallback",reason:F}),await p.start()}})().finally(()=>{b=null})),b);return{handle:{get state(){return f},on:(o,a)=>n.on(o,a),start:$,retry:()=>{if(p===null&&l.phase==="result"){R({type:"retake"}),h=0,w=!1,$();return}if(p!==null&&f!=="error"){R({type:"retake"}),h=0,w=!1,p.rearm(u?"single":void 0);return}$()},setSide:o=>{u||o==="single"||(l.current!==o&&(l={...l,current:o}),R({type:"clockRestart"}),l.phase!=="reading"&&l.phase!=="result"&&p?.rearm(o))},shutter:de,focusAt:(o,a)=>{p?.focusAt?.(o,a)},setGuide:o=>{A=o,p?.setGuide?.(o)},setTorch:o=>{d=o,p?.setTorch(o),R({type:"tick",at:s()})},destroy:()=>{if(S&&p!==null&&f!=="done"){let o=pe();!j&&o!==void 0&&o.ticks>0&&fe(o,"abandoned"),le(o,void 0)}S=!1,me(),G?.setEngine(null),N?.dispose(),N=null,n.clear()}},setFlowState:o=>{(l.phase==="reading"||l.phase==="result")&&I(o==="done"&&l.phase!=="result"?"scanning":o)},settle:(o,a)=>{let m=o==="verso"?"verso":"recto";R(a.ok?{type:"readOk",side:m}:{type:"readFailed",side:m,issue:a.issue}),a.ok||H(m)},takeDeviceRead:o=>ce.get(o.image)?.value??null}}export{ft as a,bt as b,ht as c,yt as d,St as e,Mt as f,Re as g,ne as h,Te as i,tt as j,nt as k,Dt as l,_e as m,Ct as n,U as o,We as p,Fe as q,at as r,ze as s,ue as t,it as u,Ht as v,Xt as w,lt as x};
@@ -1 +1 @@
1
- "use strict";var g=Object.defineProperty;var W=Object.getOwnPropertyDescriptor;var j=Object.getOwnPropertyNames;var z=Object.prototype.hasOwnProperty;var b=(t,e)=>()=>(t&&(e=t(t=0)),e);var I=(t,e)=>{for(var n in e)g(t,n,{get:e[n],enumerable:!0})},X=(t,e,n,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of j(e))!z.call(t,o)&&o!==n&&g(t,o,{get:()=>e[o],enumerable:!(i=W(e,o))||i.enumerable});return t};var J=t=>X(g({},"__esModule",{value:!0}),t);var v=b(()=>{"use strict"});function _(t,e){return new Promise(n=>{let i=setTimeout(()=>n(void 0),e),o=r=>{clearTimeout(i),n(r)};try{t().then(o,()=>o(void 0))}catch{o(void 0)}})}async function R(t){let e=await crypto.subtle.digest("SHA-256",new TextEncoder().encode(JSON.stringify(t)));return Array.from(new Uint8Array(e).subarray(0,8),n=>n.toString(16).padStart(2,"0")).join("")}var E=b(()=>{"use strict";v()});var H={};I(H,{computePrint:()=>me,readHints:()=>O});function A(t,e){if(typeof t!="string")return;let n=t.trim();return n.length>0&&n.length<=e?n:void 0}async function O(){let t=navigator.userAgentData;if(typeof t?.getHighEntropyValues!="function")return;let e=await _(()=>t.getHighEntropyValues(["model","platformVersion"]),re);if(e==null)return;let n=A(e.model,ae),i=A(e.platformVersion,ce),o={...n!==void 0?{model:n}:{},...i!==void 0?{platformVersion:i}:{}};return Object.keys(o).length>0?o:void 0}async function le(){let[t,e]=await Promise.all([new x.Thumbmark({stabilize:["private","iframe"],exclude:["permissions","webrtc","speech"],logging:!1,collect_beacon:!1,timeout:ie}).get(),O()]),n=t?.thumbmark;if(typeof n!="string"||n.length<de||n.length>ue)return;let i={};for(let o of ne){let r=t.components?.[o];r==null||r.timeout==="true"||(i[o]=await R(r))}return{hash:n,c:i,...e!==void 0?{hints:e}:{}}}function pe(){return new Promise(t=>{typeof globalThis.requestIdleCallback=="function"?globalThis.requestIdleCallback(()=>t(),{timeout:se}):t()})}async function me(t){return t()||(await pe(),t())?"busy":_(le,oe)}var x,ne,ie,oe,re,se,ae,ce,de,ue,N=b(()=>{"use strict";x=require("@thumbmarkjs/thumbmarkjs");E();ne=["canvas","webgl","audio","fonts","hardware","screen","system","locales","math","plugins"],ie=2e3,oe=4e3,re=1e3,se=2e3,ae=64,ce=32,de=8,ue=128});var Oe={};I(Oe,{HostedApiError:()=>u,HostedClient:()=>h,KNOWN_CODES:()=>P,SEKYRO_SDK_HEADER:()=>k,icaoPolicyOf:()=>q,isInAppBrowser:()=>y,isKnownCode:()=>L,portraitIcaoGate:()=>G,stripMimeParams:()=>p});module.exports=J(Oe);var Z=600;function M(){if(typeof window>"u"||typeof navigator>"u")return"desktop";let t=navigator.userAgentData,e=t?.mobile||/Android|i(Pad)?OS/.test(String(t?.platform)),n=String(navigator.userAgent??"");if(/iPhone|iPod/i.test(n))return"phone";if(/iPad/i.test(n))return"tablet";if(/Android/i.test(n))return/Mobile/i.test(n)?"phone":"tablet";if(/BlackBerry|IEMobile|Opera Mini/i.test(n))return"phone";if(!e){if(Number(navigator.maxTouchPoints??0)<=1)return"desktop";if(/Macintosh/.test(n))return"tablet";if(/Windows NT|CrOS/.test(n)||!ee())return"desktop"}let i=Q();return i>0&&i<Z?"phone":"tablet"}function Q(){try{let t=window.screen,e=Number(t?.width??0),n=Number(t?.height??0);return e>0&&n>0?Math.min(e,n):0}catch{return 0}}function ee(){try{return typeof window.matchMedia=="function"&&window.matchMedia("(pointer: coarse)").matches}catch{return!1}}var f="0.1.0-rc.26";var te=/FBAN|FBAV|FB_IAB|FBIOS|MessengerForiOS|Instagram|WhatsApp|musical_ly|BytedanceWebview|TikTok|Snapchat|\bLine\/|LinkedInApp|Pinterest|MicroMessenger|; wv\)/i;function y(t){let e=t??(typeof navigator>"u"?"":String(navigator.userAgent??""));return te.test(e)}var D="sekyro.did",fe=1e4,ye=()=>globalThis.process?.versions?.node,V;function F(){let t=globalThis.crypto;try{if(typeof t?.randomUUID=="function")return t.randomUUID()}catch{}try{if(typeof t?.getRandomValues=="function"){let e=t.getRandomValues(new Uint8Array(16));return Array.from(e,n=>n.toString(16).padStart(2,"0")).join("")}}catch{}}function he(){try{let t=localStorage.getItem(D);if(t)return t;let e=F();return e!==void 0&&localStorage.setItem(D,e),e}catch{return V??(V=F()),V}}async function ge(){let t=globalThis.crypto?.subtle;if(!t)return"";let e=navigator,n=JSON.stringify([e.userAgent,e.platform,e.hardwareConcurrency??null,e.deviceMemory??null,e.maxTouchPoints??0,screen.width,screen.height,screen.colorDepth,globalThis.devicePixelRatio??1,Intl.DateTimeFormat().resolvedOptions().timeZone,e.languages?.join(",")??e.language]),i=await t.digest("SHA-256",new TextEncoder().encode(n));return Array.from(new Uint8Array(i),o=>o.toString(16).padStart(2,"0")).join("").slice(0,32)}function be(){try{let t=Number(navigator.maxTouchPoints);return Number.isFinite(t)&&t>=0?{touch:Math.min(64,Math.trunc(t))}:{}}catch{return{}}}function _e(t){let e=new TextEncoder().encode(t),n="";for(let i of e)n+=String.fromCharCode(i);return btoa(n).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function Te(t){let e,n,i,o,r,a,d=()=>a?.readyState==="live",s=()=>{r!==void 0||!globalThis.crypto?.subtle||ye()||d()||(r=Promise.race([Promise.resolve().then(()=>(N(),H)),new Promise(c=>setTimeout(c,fe))]).then(c=>c?.computePrint(d)).then(c=>{c==="busy"?r=void 0:o=c}).catch(()=>{}))};return{timezone(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone?.slice(0,64)||void 0}catch{return}},noteCameraLabel(c){c&&(e=c.slice(0,128))},noteCamera(c){n=c},noteCameraTrack(c){a=c},async deviceHeader(){try{i??(i=ge().catch(()=>""));let c=[];navigator.webdriver&&c.push("webdriver"),/HeadlessChrome/.test(navigator.userAgent)&&c.push("headless");let l=await i,m=he(),$={v:1,platform:"web",sdk:t.sdk.slice(0,64),ids:[...m?[{kind:"web_local",value:m.slice(0,128)}]:[],...l?[{kind:"web_fp",value:l}]:[]],screen:{w:screen.width,h:screen.height,dpr:globalThis.devicePixelRatio??1},...be(),...e?{cameraLabel:e}:{},...c.length?{signals:c}:{},...o?{print:{v:2,...o,...n?{camera:n}:{}}}:{},...y()?{inApp:!0}:{}},Y=_e(JSON.stringify($));return s(),Y}catch{return}},printReady(){return r??Promise.resolve()}}}var T=Symbol.for("sekyro.web.clientContext"),S=globalThis,w=S[T]??(S[T]=Te({sdk:`@sekyro/web@${f}`}));var P=["session_token_invalid","session_token_required","session_token_session_mismatch","session_not_found","rate_limit_exceeded","consent_required","session_not_active","check_not_found","check_already_finalized","check_out_of_order","check_type_unsupported","force_outcome_forbidden","attestation_invalid","platform_unregistered","app_attest_invalid","too_many_challenges","inference_unavailable","mobile_required","nni_locked","document_nni_mismatch","media_content_type_not_allowed","media_too_large","media_key_invalid","media_key_forbidden","media_not_found","media_unreadable","media_session_invalid","idempotency_key_collision","idempotency_in_progress","idempotency_key_required","validation_error","internal_error","unknown_error","upload_failed","network_error","timeout","nfc_outcome_not_accepted","identity_confirm_required","identity_confirm_locked","choice_not_found","choice_locked","choice_option_unavailable","step_not_on_path","check_not_active","sekyro_app_not_allowed","sekyro_app_unverified","id_number_locked","document_id_number_mismatch","simulated_capture_forbidden"];function L(t){return P.includes(t)}var u=class extends Error{constructor(e){super(e.message),this.name="HostedApiError",this.status=e.status,this.code=e.code,e.retryAfterSeconds!==void 0&&(this.retryAfterSeconds=e.retryAfterSeconds),e.details&&(this.details=e.details)}};function K(t,e,n=Math.random){let i=(t??e)*1e3,o=Math.min(Math.max(i,500),2e4),r=Math.round(o*(1+(n()*2-1)*.25));return Math.min(Math.max(r,500),2e4)}var Se=6e4,U=4,we=3e4,Pe=9e5,Ce=200,ke=5,Ie=400,Me=new Set(["server_busy","request_timeout"]),ve=2;function p(t){return(t.split(";")[0]??"").trim()}var Re={liveness:"clipKey",face_match:"imageKey",doc_ocr:"imageKey"},k=`@sekyro/web/${f}`,Ee=k,h=class{constructor(e){this.sessionId=null;this.bootstrap=null;this.captureNonces=[];this.captureFetch=null;this.reportedIssues=new Map;this.apiOrigin=e.apiOrigin.replace(/\/+$/,""),this.sessionToken=e.sessionToken;let n=e.fetch;this.fetchImpl=(i,o)=>(n??globalThis.fetch).call(globalThis,i,o),this.requestTimeoutMs=e.requestTimeoutMs??we,this.retryAttempts=e.inProgressRetry?.attempts??ke,this.retryDelayMs=e.inProgressRetry?.delayMs??Ie,this.random=e.random??Math.random}async getSession(){let e=await this.api("GET","/hosted/session");return this.sessionId=e.sessionId,e}async recordConsent(e){return this.api("POST","/hosted/consent",{body:{locale:e},busyRetry:!0})}async reportCameraUnavailable(e){return this.api("POST","/hosted/camera-unavailable",{body:{cause:e}})}async testerGate(e){return this.api("POST","/hosted/tester-gate",{body:{input:e}})}async reportCaptureIssue(e){let n=typeof e.name=="string"?e.name.replace(/[^A-Za-z]/g,"").slice(0,40):"",i=typeof e.engineKind=="string"&&/^[a-z_]{1,32}$/.test(e.engineKind)?e.engineKind:void 0,o=typeof e.attempt=="number"&&Number.isInteger(e.attempt)&&e.attempt>=0&&e.attempt<=1e3?e.attempt:void 0,r=[e.check,o??"",e.kind,n,e.phase??""].join("|"),a=this.reportedIssues.get(r);if(a!==void 0)return a;let d={check:e.check,kind:e.kind,...n!==""?{name:n}:{},...e.phase!==void 0?{phase:e.phase}:{},...i!==void 0?{engineKind:i}:{},...o!==void 0?{attempt:o}:{},...e.formFactor!==void 0?{formFactor:e.formFactor}:{}},s=this.api("POST","/hosted/capture-issue",{body:d,empty:!0}).catch(()=>{this.reportedIssues.delete(r)});return this.reportedIssues.set(r,s),s}async choose(e,n){let i=await this.api("POST","/hosted/choice",{body:{nodeId:e,option:n},busyRetry:!0});return this.sessionId=i.sessionId,i}async confirmIdentity(e){return this.api("POST","/hosted/identity/confirm",{body:{decision:e}})}async identityPortrait(){return this.api("GET","/hosted/identity/portrait",{blob:!0})}async presign(e,n,i,o={}){let r=await this.ensureSessionId(),a={kind:e,contentType:p(n),contentLength:i,...o.source==="upload"?{source:"upload"}:{}};return this.api("POST",`/sessions/${r}/media`,{body:a})}armCapture(e=2){this.fillCaptureNonces(e)}async presignCapture(e,n,i,o={}){let r=await this.ensureSessionId(),a=await this.takeCaptureNonce(),d=a===void 0?void 0:{nonce:a,...o.engine!==void 0?{engine:o.engine.slice(0,32)}:{},...o.durationMs!==void 0&&Number.isFinite(o.durationMs)?{captureMs:Math.min(36e5,Math.max(0,Math.round(o.durationMs)))}:{}},s={kind:e,contentType:p(n),contentLength:i,capture:d};return this.api("POST",`/sessions/${r}/media`,{body:s})}async takeCaptureNonce(){let e=()=>{let n=Date.now();return this.captureNonces=this.captureNonces.filter(i=>i.expiresAt-Se>n),this.captureNonces.shift()?.nonce};for(let n=0;n<2;n++){let i=e();if(i!==void 0)return i;await this.fillCaptureNonces(1)}return e()}fillCaptureNonces(e){return this.captureFetch??(this.captureFetch=(async()=>{try{let n=await this.ensureSessionId(),i=await this.api("POST",`/sessions/${n}/media/capture-nonces`,{body:{count:Math.min(U,Math.max(1,e))}}),o=Date.now()+Math.max(0,i.expiresIn)*1e3;for(let r of Array.isArray(i.nonces)?i.nonces:[])typeof r=="string"&&r.length>0&&this.captureNonces.push({nonce:r,expiresAt:o});this.captureNonces=this.captureNonces.slice(-U)}catch{}})().finally(()=>{this.captureFetch=null})),this.captureFetch}async uploadToSpaces(e,n,i){let o;try{o=await this.fetchImpl(e,{method:"PUT",headers:{"content-type":p(i)},body:n,signal:AbortSignal.timeout(Pe)})}catch(r){throw C(r)}if(!o.ok){let r=(await o.text().catch(()=>"")).slice(0,Ce);throw new u({status:o.status,code:"upload_failed",message:`media upload failed (HTTP ${o.status})${r?`: ${r}`:""}`})}}async completeMedia(e){let n=await this.ensureSessionId();return this.api("POST",`/sessions/${n}/media/complete`,{body:{key:e}})}async submitCheck(e,n,i={}){let o=await this.ensureSessionId(),r={input:n,forceOutcome:i.forceOutcome};return this.api("POST",`/sessions/${o}/checks/${e}`,{body:r,idempotencyKey:i.idempotencyKey,busyRetry:i.idempotencyKey!==void 0})}async uploadAndSubmit(e,n,i,o={}){let r=p(n.contentType),a=await this.presign(n.kind,r,n.blob.size);await this.uploadToSpaces(a.uploadUrl,n.blob,r);let d=await this.completeMedia(a.key),s={...i,[Re[e]]:d.key};return this.submitCheck(e,s,o)}async ensureSessionId(){return this.sessionId!==null?this.sessionId:(this.bootstrap??(this.bootstrap=this.getSession().finally(()=>{this.bootstrap=null})),(await this.bootstrap).sessionId)}async api(e,n,i={}){let o=e==="GET"||i.busyRetry===!0,r=`${this.apiOrigin}/api/v2${n}`,a={"x-session-token":this.sessionToken,"x-sekyro-sdk":Ee};i.body!==void 0&&(a["content-type"]="application/json"),i.idempotencyKey!==void 0&&(a["x-idempotency-key"]=i.idempotencyKey);try{let d=w.timezone();d!==void 0&&(a["sekyro-client-timezone"]=d)}catch{}a["sekyro-client-form-factor"]=M();try{let d=await w.deviceHeader();d!==void 0&&(a["sekyro-client-device"]=d)}catch{}for(let d=0;;d++){let s;try{s=await this.fetchImpl(r,{method:e,headers:a,...i.body!==void 0?{body:JSON.stringify(i.body)}:{},cache:"no-store",signal:AbortSignal.timeout(this.requestTimeoutMs)})}catch(l){throw C(l)}if(s.ok){if(i.empty===!0)return;if(i.blob===!0)try{return await s.blob()}catch(m){throw C(m)}let l;try{l=await s.json()}catch{throw new u({status:s.status,code:"unknown_error",message:`response body was not valid JSON (HTTP ${s.status})`})}return Ae(l)}let c=await xe(s);if(c.code==="idempotency_in_progress"&&d<this.retryAttempts){this.retryDelayMs>0&&await B(this.retryDelayMs);continue}if(o&&c.status===503&&Me.has(c.code)){o=!1,await B(K(c.retryAfterSeconds,ve,this.random));continue}throw c}}};function C(t){if((typeof t=="object"&&t!==null?t.name:void 0)==="TimeoutError")return new u({status:0,code:"timeout",message:"request timed out"});let n=t instanceof Error?t.message:String(t);return new u({status:0,code:"network_error",message:`network request failed: ${n}`})}function Ae(t){return t!==null&&typeof t=="object"&&"success"in t&&"data"in t?t.data:t}async function xe(t){let e="unknown_error",n=`request failed (HTTP ${t.status})`,i=Number.NaN,o;try{let d=await t.json();if(d!==null&&typeof d=="object"){let s=d;typeof s.code=="string"&&s.code.length>0&&(e=s.code),typeof s.message=="string"&&s.message.length>0&&(n=s.message),typeof s.retryAfterSeconds=="number"&&(i=s.retryAfterSeconds),Array.isArray(s.details?.issues)&&(o=s.details)}}catch{}let r=t.headers.get("retry-after"),a=r===null?Math.floor(i):Number.parseInt(r,10);return new u({status:t.status,code:e,message:n,...Number.isFinite(a)&&a>=0?{retryAfterSeconds:a}:{},details:o})}function B(t){return new Promise(e=>setTimeout(e,t))}function q(t){let e=t?.portrait,n=e?.icao,i=e?.purpose==="id_document";return n==null?i?{policy:"reject",profile:"id_document"}:null:{policy:n.policy==="alert"?"alert":"reject",profile:i||n.profile==="id_document"?"id_document":"selfie"}}function G(t){return{...t.baselineEyeOpenness!==void 0?{baselineEyeOpenness:t.baselineEyeOpenness}:{},...t.baselineEyeOpennessLeft!==void 0&&t.baselineEyeOpennessRight!==void 0?{baselineEyeOpennessLeft:t.baselineEyeOpennessLeft,baselineEyeOpennessRight:t.baselineEyeOpennessRight}:{},criteria:t.verdict??{},...t.backgroundCheck!==void 0?{backgroundCheck:t.backgroundCheck}:{}}}0&&(module.exports={HostedApiError,HostedClient,KNOWN_CODES,SEKYRO_SDK_HEADER,icaoPolicyOf,isInAppBrowser,isKnownCode,portraitIcaoGate,stripMimeParams});
1
+ "use strict";var g=Object.defineProperty;var W=Object.getOwnPropertyDescriptor;var j=Object.getOwnPropertyNames;var z=Object.prototype.hasOwnProperty;var b=(t,e)=>()=>(t&&(e=t(t=0)),e);var I=(t,e)=>{for(var n in e)g(t,n,{get:e[n],enumerable:!0})},X=(t,e,n,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of j(e))!z.call(t,o)&&o!==n&&g(t,o,{get:()=>e[o],enumerable:!(i=W(e,o))||i.enumerable});return t};var J=t=>X(g({},"__esModule",{value:!0}),t);var v=b(()=>{"use strict"});function _(t,e){return new Promise(n=>{let i=setTimeout(()=>n(void 0),e),o=r=>{clearTimeout(i),n(r)};try{t().then(o,()=>o(void 0))}catch{o(void 0)}})}async function R(t){let e=await crypto.subtle.digest("SHA-256",new TextEncoder().encode(JSON.stringify(t)));return Array.from(new Uint8Array(e).subarray(0,8),n=>n.toString(16).padStart(2,"0")).join("")}var E=b(()=>{"use strict";v()});var H={};I(H,{computePrint:()=>me,readHints:()=>O});function A(t,e){if(typeof t!="string")return;let n=t.trim();return n.length>0&&n.length<=e?n:void 0}async function O(){let t=navigator.userAgentData;if(typeof t?.getHighEntropyValues!="function")return;let e=await _(()=>t.getHighEntropyValues(["model","platformVersion"]),re);if(e==null)return;let n=A(e.model,ae),i=A(e.platformVersion,ce),o={...n!==void 0?{model:n}:{},...i!==void 0?{platformVersion:i}:{}};return Object.keys(o).length>0?o:void 0}async function le(){let[t,e]=await Promise.all([new x.Thumbmark({stabilize:["private","iframe"],exclude:["permissions","webrtc","speech"],logging:!1,collect_beacon:!1,timeout:ie}).get(),O()]),n=t?.thumbmark;if(typeof n!="string"||n.length<de||n.length>ue)return;let i={};for(let o of ne){let r=t.components?.[o];r==null||r.timeout==="true"||(i[o]=await R(r))}return{hash:n,c:i,...e!==void 0?{hints:e}:{}}}function pe(){return new Promise(t=>{typeof globalThis.requestIdleCallback=="function"?globalThis.requestIdleCallback(()=>t(),{timeout:se}):t()})}async function me(t){return t()||(await pe(),t())?"busy":_(le,oe)}var x,ne,ie,oe,re,se,ae,ce,de,ue,N=b(()=>{"use strict";x=require("@thumbmarkjs/thumbmarkjs");E();ne=["canvas","webgl","audio","fonts","hardware","screen","system","locales","math","plugins"],ie=2e3,oe=4e3,re=1e3,se=2e3,ae=64,ce=32,de=8,ue=128});var Oe={};I(Oe,{HostedApiError:()=>u,HostedClient:()=>h,KNOWN_CODES:()=>P,SEKYRO_SDK_HEADER:()=>k,icaoPolicyOf:()=>q,isInAppBrowser:()=>y,isKnownCode:()=>L,portraitIcaoGate:()=>G,stripMimeParams:()=>p});module.exports=J(Oe);var Z=600;function M(){if(typeof window>"u"||typeof navigator>"u")return"desktop";let t=navigator.userAgentData,e=t?.mobile||/Android|i(Pad)?OS/.test(String(t?.platform)),n=String(navigator.userAgent??"");if(/iPhone|iPod/i.test(n))return"phone";if(/iPad/i.test(n))return"tablet";if(/Android/i.test(n))return/Mobile/i.test(n)?"phone":"tablet";if(/BlackBerry|IEMobile|Opera Mini/i.test(n))return"phone";if(!e){if(Number(navigator.maxTouchPoints??0)<=1)return"desktop";if(/Macintosh/.test(n))return"tablet";if(/Windows NT|CrOS/.test(n)||!ee())return"desktop"}let i=Q();return i>0&&i<Z?"phone":"tablet"}function Q(){try{let t=window.screen,e=Number(t?.width??0),n=Number(t?.height??0);return e>0&&n>0?Math.min(e,n):0}catch{return 0}}function ee(){try{return typeof window.matchMedia=="function"&&window.matchMedia("(pointer: coarse)").matches}catch{return!1}}var f="0.1.0-rc.28";var te=/FBAN|FBAV|FB_IAB|FBIOS|MessengerForiOS|Instagram|WhatsApp|musical_ly|BytedanceWebview|TikTok|Snapchat|\bLine\/|LinkedInApp|Pinterest|MicroMessenger|; wv\)/i;function y(t){let e=t??(typeof navigator>"u"?"":String(navigator.userAgent??""));return te.test(e)}var D="sekyro.did",fe=1e4,ye=()=>globalThis.process?.versions?.node,V;function F(){let t=globalThis.crypto;try{if(typeof t?.randomUUID=="function")return t.randomUUID()}catch{}try{if(typeof t?.getRandomValues=="function"){let e=t.getRandomValues(new Uint8Array(16));return Array.from(e,n=>n.toString(16).padStart(2,"0")).join("")}}catch{}}function he(){try{let t=localStorage.getItem(D);if(t)return t;let e=F();return e!==void 0&&localStorage.setItem(D,e),e}catch{return V??(V=F()),V}}async function ge(){let t=globalThis.crypto?.subtle;if(!t)return"";let e=navigator,n=JSON.stringify([e.userAgent,e.platform,e.hardwareConcurrency??null,e.deviceMemory??null,e.maxTouchPoints??0,screen.width,screen.height,screen.colorDepth,globalThis.devicePixelRatio??1,Intl.DateTimeFormat().resolvedOptions().timeZone,e.languages?.join(",")??e.language]),i=await t.digest("SHA-256",new TextEncoder().encode(n));return Array.from(new Uint8Array(i),o=>o.toString(16).padStart(2,"0")).join("").slice(0,32)}function be(){try{let t=Number(navigator.maxTouchPoints);return Number.isFinite(t)&&t>=0?{touch:Math.min(64,Math.trunc(t))}:{}}catch{return{}}}function _e(t){let e=new TextEncoder().encode(t),n="";for(let i of e)n+=String.fromCharCode(i);return btoa(n).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function Se(t){let e,n,i,o,r,a,d=()=>a?.readyState==="live",s=()=>{r!==void 0||!globalThis.crypto?.subtle||ye()||d()||(r=Promise.race([Promise.resolve().then(()=>(N(),H)),new Promise(c=>setTimeout(c,fe))]).then(c=>c?.computePrint(d)).then(c=>{c==="busy"?r=void 0:o=c}).catch(()=>{}))};return{timezone(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone?.slice(0,64)||void 0}catch{return}},noteCameraLabel(c){c&&(e=c.slice(0,128))},noteCamera(c){n=c},noteCameraTrack(c){a=c},async deviceHeader(){try{i??(i=ge().catch(()=>""));let c=[];navigator.webdriver&&c.push("webdriver"),/HeadlessChrome/.test(navigator.userAgent)&&c.push("headless");let l=await i,m=he(),$={v:1,platform:"web",sdk:t.sdk.slice(0,64),ids:[...m?[{kind:"web_local",value:m.slice(0,128)}]:[],...l?[{kind:"web_fp",value:l}]:[]],screen:{w:screen.width,h:screen.height,dpr:globalThis.devicePixelRatio??1},...be(),...e?{cameraLabel:e}:{},...c.length?{signals:c}:{},...o?{print:{v:2,...o,...n?{camera:n}:{}}}:{},...y()?{inApp:!0}:{}},Y=_e(JSON.stringify($));return s(),Y}catch{return}},printReady(){return r??Promise.resolve()}}}var S=Symbol.for("sekyro.web.clientContext"),T=globalThis,w=T[S]??(T[S]=Se({sdk:`@sekyro/web@${f}`}));var P=["session_token_invalid","session_token_required","session_token_session_mismatch","session_not_found","rate_limit_exceeded","consent_required","session_not_active","check_not_found","check_already_finalized","check_out_of_order","check_type_unsupported","force_outcome_forbidden","attestation_invalid","platform_unregistered","app_attest_invalid","too_many_challenges","inference_unavailable","mobile_required","nni_locked","document_nni_mismatch","media_content_type_not_allowed","media_too_large","media_key_invalid","media_key_forbidden","media_not_found","media_unreadable","media_session_invalid","idempotency_key_collision","idempotency_in_progress","idempotency_key_required","validation_error","internal_error","unknown_error","upload_failed","network_error","timeout","nfc_outcome_not_accepted","identity_confirm_required","identity_confirm_locked","choice_not_found","choice_locked","choice_option_unavailable","step_not_on_path","check_not_active","sekyro_app_not_allowed","sekyro_app_unverified","id_number_locked","document_id_number_mismatch","simulated_capture_forbidden"];function L(t){return P.includes(t)}var u=class extends Error{constructor(e){super(e.message),this.name="HostedApiError",this.status=e.status,this.code=e.code,e.retryAfterSeconds!==void 0&&(this.retryAfterSeconds=e.retryAfterSeconds),e.details&&(this.details=e.details)}};function K(t,e,n=Math.random){let i=(t??e)*1e3,o=Math.min(Math.max(i,500),2e4),r=Math.round(o*(1+(n()*2-1)*.25));return Math.min(Math.max(r,500),2e4)}var Te=6e4,U=4,we=3e4,Pe=9e5,Ce=200,ke=5,Ie=400,Me=new Set(["server_busy","request_timeout"]),ve=2;function p(t){return(t.split(";")[0]??"").trim()}var Re={liveness:"clipKey",face_match:"imageKey",doc_ocr:"imageKey"},k=`@sekyro/web/${f}`,Ee=k,h=class{constructor(e){this.sessionId=null;this.bootstrap=null;this.captureNonces=[];this.captureFetch=null;this.reportedIssues=new Map;this.apiOrigin=e.apiOrigin.replace(/\/+$/,""),this.sessionToken=e.sessionToken;let n=e.fetch;this.fetchImpl=(i,o)=>(n??globalThis.fetch).call(globalThis,i,o),this.requestTimeoutMs=e.requestTimeoutMs??we,this.retryAttempts=e.inProgressRetry?.attempts??ke,this.retryDelayMs=e.inProgressRetry?.delayMs??Ie,this.random=e.random??Math.random}async getSession(){let e=await this.api("GET","/hosted/session");return this.sessionId=e.sessionId,e}async recordConsent(e){return this.api("POST","/hosted/consent",{body:{locale:e},busyRetry:!0})}async reportCameraUnavailable(e){return this.api("POST","/hosted/camera-unavailable",{body:{cause:e}})}async testerGate(e){return this.api("POST","/hosted/tester-gate",{body:{input:e}})}async reportCaptureIssue(e){let n=typeof e.name=="string"?e.name.replace(/[^A-Za-z]/g,"").slice(0,40):"",i=typeof e.engineKind=="string"&&/^[a-z_]{1,32}$/.test(e.engineKind)?e.engineKind:void 0,o=typeof e.attempt=="number"&&Number.isInteger(e.attempt)&&e.attempt>=0&&e.attempt<=1e3?e.attempt:void 0,r=[e.check,o??"",e.kind,n,e.phase??""].join("|"),a=this.reportedIssues.get(r);if(a!==void 0)return a;let d={check:e.check,kind:e.kind,...n!==""?{name:n}:{},...e.phase!==void 0?{phase:e.phase}:{},...i!==void 0?{engineKind:i}:{},...o!==void 0?{attempt:o}:{},...e.formFactor!==void 0?{formFactor:e.formFactor}:{}},s=this.api("POST","/hosted/capture-issue",{body:d,empty:!0}).catch(()=>{this.reportedIssues.delete(r)});return this.reportedIssues.set(r,s),s}async choose(e,n){let i=await this.api("POST","/hosted/choice",{body:{nodeId:e,option:n},busyRetry:!0});return this.sessionId=i.sessionId,i}async confirmIdentity(e){return this.api("POST","/hosted/identity/confirm",{body:{decision:e}})}async identityPortrait(){return this.api("GET","/hosted/identity/portrait",{blob:!0})}async presign(e,n,i,o={}){let r=await this.ensureSessionId(),a={kind:e,contentType:p(n),contentLength:i,...o.source==="upload"?{source:"upload"}:{}};return this.api("POST",`/sessions/${r}/media`,{body:a})}armCapture(e=2){this.fillCaptureNonces(e)}async presignCapture(e,n,i,o={}){let r=await this.ensureSessionId(),a=await this.takeCaptureNonce(),d=a===void 0?void 0:{nonce:a,...o.engine!==void 0?{engine:o.engine.slice(0,32)}:{},...o.durationMs!==void 0&&Number.isFinite(o.durationMs)?{captureMs:Math.min(36e5,Math.max(0,Math.round(o.durationMs)))}:{}},s={kind:e,contentType:p(n),contentLength:i,capture:d};return this.api("POST",`/sessions/${r}/media`,{body:s})}async takeCaptureNonce(){let e=()=>{let n=Date.now();return this.captureNonces=this.captureNonces.filter(i=>i.expiresAt-Te>n),this.captureNonces.shift()?.nonce};for(let n=0;n<2;n++){let i=e();if(i!==void 0)return i;await this.fillCaptureNonces(1)}return e()}fillCaptureNonces(e){return this.captureFetch??(this.captureFetch=(async()=>{try{let n=await this.ensureSessionId(),i=await this.api("POST",`/sessions/${n}/media/capture-nonces`,{body:{count:Math.min(U,Math.max(1,e))}}),o=Date.now()+Math.max(0,i.expiresIn)*1e3;for(let r of Array.isArray(i.nonces)?i.nonces:[])typeof r=="string"&&r.length>0&&this.captureNonces.push({nonce:r,expiresAt:o});this.captureNonces=this.captureNonces.slice(-U)}catch{}})().finally(()=>{this.captureFetch=null})),this.captureFetch}async uploadToSpaces(e,n,i){let o;try{o=await this.fetchImpl(e,{method:"PUT",headers:{"content-type":p(i)},body:n,signal:AbortSignal.timeout(Pe)})}catch(r){throw C(r)}if(!o.ok){let r=(await o.text().catch(()=>"")).slice(0,Ce);throw new u({status:o.status,code:"upload_failed",message:`media upload failed (HTTP ${o.status})${r?`: ${r}`:""}`})}}async completeMedia(e){let n=await this.ensureSessionId();return this.api("POST",`/sessions/${n}/media/complete`,{body:{key:e}})}async submitCheck(e,n,i={}){let o=await this.ensureSessionId(),r={input:n,forceOutcome:i.forceOutcome};return this.api("POST",`/sessions/${o}/checks/${e}`,{body:r,idempotencyKey:i.idempotencyKey,busyRetry:i.idempotencyKey!==void 0})}async uploadAndSubmit(e,n,i,o={}){let r=p(n.contentType),a=await this.presign(n.kind,r,n.blob.size);await this.uploadToSpaces(a.uploadUrl,n.blob,r);let d=await this.completeMedia(a.key),s={...i,[Re[e]]:d.key};return this.submitCheck(e,s,o)}async ensureSessionId(){return this.sessionId!==null?this.sessionId:(this.bootstrap??(this.bootstrap=this.getSession().finally(()=>{this.bootstrap=null})),(await this.bootstrap).sessionId)}async api(e,n,i={}){let o=e==="GET"||i.busyRetry===!0,r=`${this.apiOrigin}/api/v2${n}`,a={"x-session-token":this.sessionToken,"x-sekyro-sdk":Ee};i.body!==void 0&&(a["content-type"]="application/json"),i.idempotencyKey!==void 0&&(a["x-idempotency-key"]=i.idempotencyKey);try{let d=w.timezone();d!==void 0&&(a["sekyro-client-timezone"]=d)}catch{}a["sekyro-client-form-factor"]=M();try{let d=await w.deviceHeader();d!==void 0&&(a["sekyro-client-device"]=d)}catch{}for(let d=0;;d++){let s;try{s=await this.fetchImpl(r,{method:e,headers:a,...i.body!==void 0?{body:JSON.stringify(i.body)}:{},cache:"no-store",signal:AbortSignal.timeout(this.requestTimeoutMs)})}catch(l){throw C(l)}if(s.ok){if(i.empty===!0)return;if(i.blob===!0)try{return await s.blob()}catch(m){throw C(m)}let l;try{l=await s.json()}catch{throw new u({status:s.status,code:"unknown_error",message:`response body was not valid JSON (HTTP ${s.status})`})}return Ae(l)}let c=await xe(s);if(c.code==="idempotency_in_progress"&&d<this.retryAttempts){this.retryDelayMs>0&&await B(this.retryDelayMs);continue}if(o&&c.status===503&&Me.has(c.code)){o=!1,await B(K(c.retryAfterSeconds,ve,this.random));continue}throw c}}};function C(t){if((typeof t=="object"&&t!==null?t.name:void 0)==="TimeoutError")return new u({status:0,code:"timeout",message:"request timed out"});let n=t instanceof Error?t.message:String(t);return new u({status:0,code:"network_error",message:`network request failed: ${n}`})}function Ae(t){return t!==null&&typeof t=="object"&&"success"in t&&"data"in t?t.data:t}async function xe(t){let e="unknown_error",n=`request failed (HTTP ${t.status})`,i=Number.NaN,o;try{let d=await t.json();if(d!==null&&typeof d=="object"){let s=d;typeof s.code=="string"&&s.code.length>0&&(e=s.code),typeof s.message=="string"&&s.message.length>0&&(n=s.message),typeof s.retryAfterSeconds=="number"&&(i=s.retryAfterSeconds),Array.isArray(s.details?.issues)&&(o=s.details)}}catch{}let r=t.headers.get("retry-after"),a=r===null?Math.floor(i):Number.parseInt(r,10);return new u({status:t.status,code:e,message:n,...Number.isFinite(a)&&a>=0?{retryAfterSeconds:a}:{},details:o})}function B(t){return new Promise(e=>setTimeout(e,t))}function q(t){let e=t?.portrait,n=e?.icao,i=e?.purpose==="id_document";return n==null?i?{policy:"reject",profile:"id_document"}:null:{policy:n.policy==="alert"?"alert":"reject",profile:i||n.profile==="id_document"?"id_document":"selfie"}}function G(t){return{...t.baselineEyeOpenness!==void 0?{baselineEyeOpenness:t.baselineEyeOpenness}:{},...t.baselineEyeOpennessLeft!==void 0&&t.baselineEyeOpennessRight!==void 0?{baselineEyeOpennessLeft:t.baselineEyeOpennessLeft,baselineEyeOpennessRight:t.baselineEyeOpennessRight}:{},criteria:t.verdict??{},...t.backgroundCheck!==void 0?{backgroundCheck:t.backgroundCheck}:{}}}0&&(module.exports={HostedApiError,HostedClient,KNOWN_CODES,SEKYRO_SDK_HEADER,icaoPolicyOf,isInAppBrowser,isKnownCode,portraitIcaoGate,stripMimeParams});
@@ -1,6 +1,6 @@
1
- export { H as HostedClient, a as HostedClientOptions, M as MediaCheckType, S as SEKYRO_SDK_HEADER, b as SubmitOptions, U as UploadMedia, s as stripMimeParams } from '../icao-gate-pD2dUV3P.cjs';
2
- export { H as HostedApiError, a as HostedErrorDetails, b as HostedErrorIssue, K as KNOWN_CODES, c as KnownCode, i as icaoPolicyOf, d as isKnownCode, p as portraitIcaoGate } from '../icao-policy-CdR6PFHS.cjs';
3
- export { A as AcceptedDocumentType, a as AttestationInput, C as CaptureContext, b as CaptureMode, c as CaptureNoncesResult, d as CaptureProof, e as CheckInputByType, f as CheckReason, g as CheckState, h as CheckType, i as ClosedBy, j as CompleteMediaResult, k as ConsentLocale, l as ContactChannel, D as DecisionReason, m as DocDeviceRead, n as DocOcrInput, o as DocReason, p as DocSide, E as EidAfterPass, q as EidAuthInput, r as EidReason, s as EmailOtpInput, t as EmailOtpReason, F as FaceMatchInput, u as FaceMatchReason, H as HostedAcceptedDocuments, v as HostedCaptureTuning, w as HostedChallengeView, x as HostedConsentView, y as HostedDocumentCaptureTuning, z as HostedDocumentScanTuning, B as HostedDocumentsView, G as HostedEidView, I as HostedEmailOtpView, J as HostedFlowRef, K as HostedIcaoPolicy, L as HostedIntegrity, M as HostedLivePhotoTuning, N as HostedNativeCaptureTuning, O as HostedOcrTuning, P as HostedOtpView, Q as HostedPlanView, R as HostedPoaRuleKindView, S as HostedPoaRuleView, T as HostedPortraitPendingFix, U as HostedPortraitView, V as HostedProofOfAddressView, W as HostedSessionView, X as HostedSimulationView, Y as HostedStepView, Z as HostedTesterGateView, _ as HostedVoiceLocale, $ as HostedVoiceView, a0 as IcaoCriterion, a1 as IcaoReportEntry, a2 as IdentityConfirmDecision, a3 as IdentityMethod, a4 as IdentitySummarySource, a5 as IdentitySummaryView, a6 as LivenessCaptureInput, a7 as LivenessInput, a8 as LivenessReason, a9 as MatchReason, aa as MediaKind, ab as MethodChoiceView, ac as NationalEidOption, ad as NfcChipReason, ae as NfcStepView, af as OtpChoiceView, ag as PhoneCountryRule, ah as PhoneFormat, ai as PhoneOtpInput, aj as PhoneOtpReason, ak as PhotoSource, al as PhotoSourcePick, am as PlanAttempts, an as PlanChoiceKind, ao as PlanChoiceOption, ap as PlanChoiceView, aq as PlanSectionView, ar as PlanStepView, as as PoaImagesInput, at as PoaInput, au as PoaKind, av as PoaLicenceInput, aw as PoaNameMatchMode, ax as PoaPdfInput, ay as PoaReason, az as PoaRuleSource, aA as PopulationInput, aB as PopulationReason, aC as PortraitFix, aD as PortraitFixReviewInput, aE as PortraitIcaoInput, aF as PortraitIcaoReason, aG as PortraitOutputFormat, aH as PresignRequest, aI as PresignUploadResult, aJ as RecordConsentResult, aK as ResolvedCaptureMode, aL as SessionDecidingStep, aM as SessionFailureReason, aN as SessionReason, aO as SessionStatus, aP as SessionStepView, aQ as SessionView, aR as SimulatedCaptureInput, aS as StepResult, aT as StepSection, aU as SubmitCheckBody, aV as TesterGateInput, aW as TesterGateResponse, aX as VerificationAssurance, aY as VerificationLevel } from '../types-DB-cZTSn.cjs';
1
+ export { H as HostedClient, a as HostedClientOptions, M as MediaCheckType, S as SEKYRO_SDK_HEADER, b as SubmitOptions, U as UploadMedia, s as stripMimeParams } from '../icao-gate-CjbKCatx.cjs';
2
+ export { H as HostedApiError, a as HostedErrorDetails, b as HostedErrorIssue, K as KNOWN_CODES, c as KnownCode, i as icaoPolicyOf, d as isKnownCode, p as portraitIcaoGate } from '../icao-policy-CAZZYEJ6.cjs';
3
+ export { A as AcceptedDocumentType, a as AttestationInput, C as CaptureContext, b as CaptureMode, c as CaptureNoncesResult, d as CaptureProof, e as CheckInputByType, f as CheckReason, g as CheckState, h as CheckType, i as ClosedBy, j as CompleteMediaResult, k as ConsentLocale, l as ContactChannel, D as DecisionReason, m as DocDeviceRead, n as DocOcrInput, o as DocReason, p as DocSide, E as EidAfterPass, q as EidAuthInput, r as EidReason, s as EmailOtpInput, t as EmailOtpReason, F as FaceMatchInput, u as FaceMatchReason, H as HostedAcceptedDocuments, v as HostedCaptureTuning, w as HostedChallengeView, x as HostedConsentView, y as HostedDocumentCaptureTuning, z as HostedDocumentScanTuning, B as HostedDocumentsView, G as HostedEidView, I as HostedEmailOtpView, J as HostedFlowRef, K as HostedIcaoPolicy, L as HostedIntegrity, M as HostedLivePhotoTuning, N as HostedNativeCaptureTuning, O as HostedOcrTuning, P as HostedOtpView, Q as HostedPlanView, R as HostedPoaRuleKindView, S as HostedPoaRuleView, T as HostedPortraitPendingFix, U as HostedPortraitView, V as HostedProofOfAddressView, W as HostedSessionView, X as HostedSimulationView, Y as HostedStepView, Z as HostedTesterGateView, _ as HostedVoiceLocale, $ as HostedVoiceView, a0 as IcaoCriterion, a1 as IcaoReportEntry, a2 as IdentityConfirmDecision, a3 as IdentityMethod, a4 as IdentitySummarySource, a5 as IdentitySummaryView, a6 as LivenessCaptureInput, a7 as LivenessInput, a8 as LivenessReason, a9 as MatchReason, aa as MediaKind, ab as MethodChoiceView, ac as NationalEidOption, ad as NfcChipReason, ae as NfcStepView, af as OtpChoiceView, ag as PhoneCountryRule, ah as PhoneFormat, ai as PhoneOtpInput, aj as PhoneOtpReason, ak as PhotoSource, al as PhotoSourcePick, am as PlanAttempts, an as PlanChoiceKind, ao as PlanChoiceOption, ap as PlanChoiceView, aq as PlanSectionView, ar as PlanStepView, as as PoaImagesInput, at as PoaInput, au as PoaKind, av as PoaLicenceInput, aw as PoaNameMatchMode, ax as PoaPdfInput, ay as PoaReason, az as PoaRuleSource, aA as PopulationInput, aB as PopulationReason, aC as PortraitFix, aD as PortraitFixReviewInput, aE as PortraitIcaoInput, aF as PortraitIcaoReason, aG as PortraitOutputFormat, aH as PresignRequest, aI as PresignUploadResult, aJ as RecordConsentResult, aK as ResolvedCaptureMode, aL as SandboxSimulatedReason, aM as SandboxSimulation, aN as SessionDecidingStep, aO as SessionFailureReason, aP as SessionReason, aQ as SessionStatus, aR as SessionStepView, aS as SessionView, aT as SimulatedCaptureInput, aU as StepResult, aV as StepSection, aW as SubmitCheckBody, aX as TesterGateInput, aY as TesterGateResponse, aZ as VerificationAssurance, a_ as VerificationLevel } from '../types-CgHWIEZj.cjs';
4
4
 
5
5
  /** The page runs inside an app's WebView (WhatsApp, Instagram, Facebook, TikTok, Snapchat, LINE, LinkedIn, WeChat, an Android WebView…). */
6
6
  declare function isInAppBrowser(userAgent?: string): boolean;
@@ -1,6 +1,6 @@
1
- export { H as HostedClient, a as HostedClientOptions, M as MediaCheckType, S as SEKYRO_SDK_HEADER, b as SubmitOptions, U as UploadMedia, s as stripMimeParams } from '../icao-gate-BK8TGaCk.js';
2
- export { H as HostedApiError, a as HostedErrorDetails, b as HostedErrorIssue, K as KNOWN_CODES, c as KnownCode, i as icaoPolicyOf, d as isKnownCode, p as portraitIcaoGate } from '../icao-policy-qJpZOOOu.js';
3
- export { A as AcceptedDocumentType, a as AttestationInput, C as CaptureContext, b as CaptureMode, c as CaptureNoncesResult, d as CaptureProof, e as CheckInputByType, f as CheckReason, g as CheckState, h as CheckType, i as ClosedBy, j as CompleteMediaResult, k as ConsentLocale, l as ContactChannel, D as DecisionReason, m as DocDeviceRead, n as DocOcrInput, o as DocReason, p as DocSide, E as EidAfterPass, q as EidAuthInput, r as EidReason, s as EmailOtpInput, t as EmailOtpReason, F as FaceMatchInput, u as FaceMatchReason, H as HostedAcceptedDocuments, v as HostedCaptureTuning, w as HostedChallengeView, x as HostedConsentView, y as HostedDocumentCaptureTuning, z as HostedDocumentScanTuning, B as HostedDocumentsView, G as HostedEidView, I as HostedEmailOtpView, J as HostedFlowRef, K as HostedIcaoPolicy, L as HostedIntegrity, M as HostedLivePhotoTuning, N as HostedNativeCaptureTuning, O as HostedOcrTuning, P as HostedOtpView, Q as HostedPlanView, R as HostedPoaRuleKindView, S as HostedPoaRuleView, T as HostedPortraitPendingFix, U as HostedPortraitView, V as HostedProofOfAddressView, W as HostedSessionView, X as HostedSimulationView, Y as HostedStepView, Z as HostedTesterGateView, _ as HostedVoiceLocale, $ as HostedVoiceView, a0 as IcaoCriterion, a1 as IcaoReportEntry, a2 as IdentityConfirmDecision, a3 as IdentityMethod, a4 as IdentitySummarySource, a5 as IdentitySummaryView, a6 as LivenessCaptureInput, a7 as LivenessInput, a8 as LivenessReason, a9 as MatchReason, aa as MediaKind, ab as MethodChoiceView, ac as NationalEidOption, ad as NfcChipReason, ae as NfcStepView, af as OtpChoiceView, ag as PhoneCountryRule, ah as PhoneFormat, ai as PhoneOtpInput, aj as PhoneOtpReason, ak as PhotoSource, al as PhotoSourcePick, am as PlanAttempts, an as PlanChoiceKind, ao as PlanChoiceOption, ap as PlanChoiceView, aq as PlanSectionView, ar as PlanStepView, as as PoaImagesInput, at as PoaInput, au as PoaKind, av as PoaLicenceInput, aw as PoaNameMatchMode, ax as PoaPdfInput, ay as PoaReason, az as PoaRuleSource, aA as PopulationInput, aB as PopulationReason, aC as PortraitFix, aD as PortraitFixReviewInput, aE as PortraitIcaoInput, aF as PortraitIcaoReason, aG as PortraitOutputFormat, aH as PresignRequest, aI as PresignUploadResult, aJ as RecordConsentResult, aK as ResolvedCaptureMode, aL as SessionDecidingStep, aM as SessionFailureReason, aN as SessionReason, aO as SessionStatus, aP as SessionStepView, aQ as SessionView, aR as SimulatedCaptureInput, aS as StepResult, aT as StepSection, aU as SubmitCheckBody, aV as TesterGateInput, aW as TesterGateResponse, aX as VerificationAssurance, aY as VerificationLevel } from '../types-DB-cZTSn.js';
1
+ export { H as HostedClient, a as HostedClientOptions, M as MediaCheckType, S as SEKYRO_SDK_HEADER, b as SubmitOptions, U as UploadMedia, s as stripMimeParams } from '../icao-gate-CYb-35iH.js';
2
+ export { H as HostedApiError, a as HostedErrorDetails, b as HostedErrorIssue, K as KNOWN_CODES, c as KnownCode, i as icaoPolicyOf, d as isKnownCode, p as portraitIcaoGate } from '../icao-policy-D4AZivI8.js';
3
+ export { A as AcceptedDocumentType, a as AttestationInput, C as CaptureContext, b as CaptureMode, c as CaptureNoncesResult, d as CaptureProof, e as CheckInputByType, f as CheckReason, g as CheckState, h as CheckType, i as ClosedBy, j as CompleteMediaResult, k as ConsentLocale, l as ContactChannel, D as DecisionReason, m as DocDeviceRead, n as DocOcrInput, o as DocReason, p as DocSide, E as EidAfterPass, q as EidAuthInput, r as EidReason, s as EmailOtpInput, t as EmailOtpReason, F as FaceMatchInput, u as FaceMatchReason, H as HostedAcceptedDocuments, v as HostedCaptureTuning, w as HostedChallengeView, x as HostedConsentView, y as HostedDocumentCaptureTuning, z as HostedDocumentScanTuning, B as HostedDocumentsView, G as HostedEidView, I as HostedEmailOtpView, J as HostedFlowRef, K as HostedIcaoPolicy, L as HostedIntegrity, M as HostedLivePhotoTuning, N as HostedNativeCaptureTuning, O as HostedOcrTuning, P as HostedOtpView, Q as HostedPlanView, R as HostedPoaRuleKindView, S as HostedPoaRuleView, T as HostedPortraitPendingFix, U as HostedPortraitView, V as HostedProofOfAddressView, W as HostedSessionView, X as HostedSimulationView, Y as HostedStepView, Z as HostedTesterGateView, _ as HostedVoiceLocale, $ as HostedVoiceView, a0 as IcaoCriterion, a1 as IcaoReportEntry, a2 as IdentityConfirmDecision, a3 as IdentityMethod, a4 as IdentitySummarySource, a5 as IdentitySummaryView, a6 as LivenessCaptureInput, a7 as LivenessInput, a8 as LivenessReason, a9 as MatchReason, aa as MediaKind, ab as MethodChoiceView, ac as NationalEidOption, ad as NfcChipReason, ae as NfcStepView, af as OtpChoiceView, ag as PhoneCountryRule, ah as PhoneFormat, ai as PhoneOtpInput, aj as PhoneOtpReason, ak as PhotoSource, al as PhotoSourcePick, am as PlanAttempts, an as PlanChoiceKind, ao as PlanChoiceOption, ap as PlanChoiceView, aq as PlanSectionView, ar as PlanStepView, as as PoaImagesInput, at as PoaInput, au as PoaKind, av as PoaLicenceInput, aw as PoaNameMatchMode, ax as PoaPdfInput, ay as PoaReason, az as PoaRuleSource, aA as PopulationInput, aB as PopulationReason, aC as PortraitFix, aD as PortraitFixReviewInput, aE as PortraitIcaoInput, aF as PortraitIcaoReason, aG as PortraitOutputFormat, aH as PresignRequest, aI as PresignUploadResult, aJ as RecordConsentResult, aK as ResolvedCaptureMode, aL as SandboxSimulatedReason, aM as SandboxSimulation, aN as SessionDecidingStep, aO as SessionFailureReason, aP as SessionReason, aQ as SessionStatus, aR as SessionStepView, aS as SessionView, aT as SimulatedCaptureInput, aU as StepResult, aV as StepSection, aW as SubmitCheckBody, aX as TesterGateInput, aY as TesterGateResponse, aZ as VerificationAssurance, a_ as VerificationLevel } from '../types-CgHWIEZj.js';
4
4
 
5
5
  /** The page runs inside an app's WebView (WhatsApp, Instagram, Facebook, TikTok, Snapchat, LINE, LinkedIn, WeChat, an Android WebView…). */
6
6
  declare function isInAppBrowser(userAgent?: string): boolean;
@@ -1 +1 @@
1
- import{a as t,b as o,c as i,e as n,f as s,g as a,h as p,i as r}from"../chunk-XOTKATN6.js";import"../chunk-TSA6GHUG.js";import{b as e}from"../chunk-LLX2CKZ3.js";export{i as HostedApiError,a as HostedClient,t as KNOWN_CODES,s as SEKYRO_SDK_HEADER,p as icaoPolicyOf,e as isInAppBrowser,o as isKnownCode,r as portraitIcaoGate,n as stripMimeParams};
1
+ import{a as t,b as o,c as i,e as n,f as s,g as a,h as p,i as r}from"../chunk-J7D3S5ZJ.js";import"../chunk-TSA6GHUG.js";import{b as e}from"../chunk-FSXWIMSG.js";export{i as HostedApiError,a as HostedClient,t as KNOWN_CODES,s as SEKYRO_SDK_HEADER,p as icaoPolicyOf,e as isInAppBrowser,o as isKnownCode,r as portraitIcaoGate,n as stripMimeParams};