@sekyro/web 0.1.0-rc.8 → 0.1.0-rc.9
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.
- package/CHANGELOG.md +15 -0
- package/README.md +54 -61
- package/dist/{capture-session-doc-YBE3UMJJ.js → capture-session-doc-QQHDBZG4.js} +1 -1
- package/dist/{chunk-YPG7CB4O.js → chunk-4Q7EMVP7.js} +1 -1
- package/dist/{chunk-RNRFHUJA.js → chunk-56GT33O3.js} +1 -1
- package/dist/{chunk-DQWW4OCK.js → chunk-EVVGQSNJ.js} +1 -1
- package/dist/chunk-F5ST423J.js +1 -0
- package/dist/chunk-GBTZIKGZ.js +1 -0
- package/dist/chunk-H6HC7B77.js +1 -0
- package/dist/{chunk-LQ7C44JG.js → chunk-LUHNRNTO.js} +1 -1
- package/dist/{chunk-RVHAKRAI.js → chunk-WRKUWIJW.js} +1 -1
- package/dist/chunk-ZUHTYCY4.js +1 -0
- package/dist/client/index.cjs +1 -1
- package/dist/client/index.d.cts +26 -4
- package/dist/client/index.d.ts +26 -4
- package/dist/client/index.js +1 -1
- package/dist/core/index.cjs +1 -1
- package/dist/core/index.js +1 -1
- package/dist/create-document-capture-DWRNFXA2.js +1 -0
- package/dist/{create-verification-DoFpgzok.d.cts → create-verification-BS2qbe75.d.cts} +101 -16
- package/dist/{create-verification-C0AVIcVW.d.ts → create-verification-CCR-CwVQ.d.ts} +101 -16
- package/dist/{icao-gate-D8qm1O2t.d.cts → icao-gate-DKbWXP51.d.cts} +104 -39
- package/dist/{icao-gate-D8qm1O2t.d.ts → icao-gate-DKbWXP51.d.ts} +104 -39
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +1 -1
- package/dist/internal/index.cjs +1 -1
- package/dist/internal/index.d.cts +11 -20
- package/dist/internal/index.d.ts +11 -20
- package/dist/internal/index.js +1 -1
- package/dist/{plan-runner-UBK4B4CG.js → plan-runner-X4YW3INX.js} +1 -1
- package/package.json +1 -1
- package/sbom.cdx.json +7 -7
- package/dist/chunk-4RS2YIL4.js +0 -1
- package/dist/chunk-MY6EXEL2.js +0 -1
- package/dist/chunk-XLN5OT25.js +0 -1
- package/dist/chunk-YDQBVWXG.js +0 -1
- package/dist/create-document-capture-T4APHJMY.js +0 -1
package/dist/core/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var Xe=Object.create;var P=Object.defineProperty;var qe=Object.getOwnPropertyDescriptor;var Ye=Object.getOwnPropertyNames;var Ze=Object.getPrototypeOf,Qe=Object.prototype.hasOwnProperty;var je=(t,e)=>()=>(t&&(e=t(t=0)),e);var ue=(t,e)=>{for(var r in e)P(t,r,{get:e[r],enumerable:!0})},le=(t,e,r,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Ye(e))!Qe.call(t,n)&&n!==r&&P(t,n,{get:()=>e[n],enumerable:!(i=qe(e,n))||i.enumerable});return t};var $e=(t,e,r)=>(r=t!=null?Xe(Ze(t)):{},le(e||!t||!t.__esModule?P(r,"default",{value:t,enumerable:!0}):r,t)),Je=t=>le(P({},"__esModule",{value:!0}),t);var Fe={};ue(Fe,{RANK_CANDIDATES:()=>xt,RANK_TOLERANCE:()=>B,RANK_WINDOW_MS:()=>St,ROLL_ZERO_DEG:()=>kt,SHARPNESS_REPORT_MAX:()=>Pe,YAW_REPORT_MAX:()=>Ae,YAW_ZERO_IOD:()=>Dt,collectRankedKeyframes:()=>Le,default:()=>Ct,featuresOf:()=>Ie,frontalOf:()=>Oe,rankKeyframes:()=>Re});function Oe(t){let e=t.eyes;if(e===void 0)return{frontal:1,yaw:null,roll:null};let r=e.right.x-e.left.x,i=e.right.y-e.left.y,n=r*r+i*i;if(n===0)return{frontal:1,yaw:null,roll:null};let a=Math.abs(Math.atan2(i,Math.abs(r))*180/Math.PI),s=we(1-a/30),o=null,c=t.nose;if(c!==void 0){let d=(e.left.x+e.right.x)/2,u=(e.left.y+e.right.y)/2;o=Math.abs(((c.x-d)*r+(c.y-u)*i)/n),s*=we(1-o/.5)}return{frontal:s,yaw:o,roll:a}}function Ie(t,e){return t===null?{face:!1,frontal:0,yaw:null,roll:null,eyes:null,score:0,sharpness:e}:{face:!0,...Oe(t),eyes:null,score:t.score,sharpness:e}}function Re(t){let e=t.map((n,a)=>a),r=(n,a)=>{let s=Number.NEGATIVE_INFINITY;for(let o of e)s=Math.max(s,n(t[o]));e=e.filter(o=>n(t[o])>=s-a)};r(n=>n.frontal,B.frontal),r(n=>n.eyes??1,B.eyes),r(n=>n.score,B.score);let i=-1;for(let n of e)(i===-1||t[n].sharpness>t[i].sharpness)&&(i=n);return i}function Tt(t){return{face:t.face,frontal:x(t.frontal),...t.yaw!==null?{yaw:Math.min(x(t.yaw),Ae)}:{},...t.roll!==null?{roll:x(t.roll)}:{},...t.eyes!==null?{eyes:x(t.eyes)}:{},score:x(t.score),sharpness:Math.min(x(t.sharpness),Pe)}}async function Le(t,e){let{options:r}=t,i=r.video,n=r.now??(()=>performance.now()),a=r.captureKeyframe??(m=>t.defaultKeyframe(m)),s=600/3,o=[],c=[],d=0;for(let m=0;m<4;m+=1){if(e!==t.attempt)return null;let p=t.detector,h=Promise.resolve(null),y,I=0;try{if(p!==null){let A=t.profiler?.profile.inputWidth??160,Ue=r.makeSnapshot?.(i,A)??t.defaultSnapshot(i,A);y=a(i).then(z=>(I=n(),z));let ze=n();h=p.detect(Ue,i.videoWidth,i.videoHeight).then(z=>(d+=n()-ze,z),()=>null)}else y=a(i).then(A=>(I=n(),A));let[R,Be]=await Promise.all([y,h]);o.push(R),c.push(Ie(Be,R.sharpness))}catch{y?.catch(()=>{})}let He=I>0?Math.max(0,n()-I):0;m<3&&await new Promise(R=>setTimeout(R,Math.max(0,s-He)))}if(e!==t.attempt)return null;let u=Re(c);if(u===-1)return null;let l=0;c.forEach((m,p)=>{m.sharpness>c[l].sharpness&&(l=p)});try{r.telemetry?.({type:"keyframe",tier:t.detector?.tier??null,chosen:u,sharpest:l,detectMs:Math.round(d),candidates:c.map(Tt)})}catch{}return o[u]??null}var xt,St,Dt,kt,B,we,x,Ae,Pe,Ct,Ne=je(()=>{"use strict";xt=4,St=600,Dt=.5,kt=30,B={frontal:.1,eyes:.1,score:.05},we=t=>t<0?0:t>1?1:t;x=t=>Number.isFinite(t)?Math.round(t*1e3)/1e3:0,Ae=99,Pe=999999;Ct=Le});var Ot={};ue(Ot,{CENTERED_FACTOR:()=>st,CIRCLE_RADIUS_FACTOR:()=>it,CLIP_MS:()=>me,CaptureSessionV3:()=>ce,ClipError:()=>f,ClipRecorder:()=>D,DEFAULT_CLIP_MIME:()=>L,DEFAULT_TIER_ORDER:()=>ge,DEFAULT_V3_ASSET_BASE_URL:()=>be,DEVICE_PROFILES:()=>_e,DetectScheduler:()=>w,DetectorLadderError:()=>v,DeviceProfiler:()=>M,EXPOSURE_BAND:()=>T,FaceGateV3:()=>C,GATE_SNAPSHOT_MS:()=>We,GateBlockStats:()=>O,IN_CIRCLE_FACTOR:()=>at,KEYFRAME_CANDIDATES:()=>U,KEYFRAME_WINDOW_MS:()=>Ke,MAX_CLIP_BYTES:()=>F,MIME_CANDIDATES:()=>de,SHARP_REF:()=>zt,STOP_GRACE_MS:()=>he,TIMESLICE_MS:()=>pe,V3_GATE_DEFAULTS:()=>Ee,VIDEO_BPS:()=>j,blockReasonOf:()=>Me,buildCaptureConstraints:()=>$,buildLivenessV2FormData:()=>tt,cameraPreflight:()=>Z,captureMirroredKeyframe:()=>Q,classifyDevice:()=>ie,createDetector:()=>E,detectIsMobile:()=>J,errorCopy:()=>rt,exposure:()=>te,extForMime:()=>X,intrinsicSize:()=>g,isClipTooLarge:()=>S,isMediaRecorderSupported:()=>et,mapGetUserMediaError:()=>Y,meanLuma:()=>W,pickMimeType:()=>q,probeDevice:()=>ne,sharpness:()=>K,toStreamPixels:()=>k,uiCopy:()=>nt});module.exports=Je(Ot);var de=["video/mp4;codecs=avc1.42E01E,mp4a.40.2","video/mp4;codecs=avc1.42E01E","video/mp4","video/webm;codecs=vp9,opus","video/webm;codecs=vp9","video/webm;codecs=vp8,opus","video/webm;codecs=vp8","video/webm"];function q(){let t=globalThis.MediaRecorder;return!t||typeof t.isTypeSupported!="function"?"":de.find(e=>t.isTypeSupported(e))??""}var L="video/webm";function Y(t){if(t instanceof TypeError)return"insecure";switch(t?.name??""){case"NotAllowedError":case"PermissionDeniedError":return"permission";case"NotFoundError":case"DevicesNotFoundError":return"notfound";case"NotReadableError":case"TrackStartError":return"inuse";case"OverconstrainedError":case"ConstraintNotSatisfiedError":return"overconstrained";default:return"generic"}}function Z(){let t=globalThis;if(typeof t.window<"u"&&t.window.isSecureContext===!1)return"INSECURE_CONTEXT";let e=t.navigator?.mediaDevices;return!e||typeof e.getUserMedia!="function"?"UNSUPPORTED":"OK"}function et(){let t=globalThis.MediaRecorder;return typeof t<"u"&&typeof t.isTypeSupported=="function"}var F=8*1024*1024;function S(t){return t.size>F}function X(t){let e=(t||"").toLowerCase();return e.startsWith("image/jpeg")?"jpg":e.startsWith("video/mp4")?"mp4":(e.startsWith("video/webm"),"webm")}function tt(t){let{token:e,clip:r,keyframe:i}=t,n=t.ts??Date.now(),a=r.type||L,s=i.type||"image/jpeg",o=new FormData;return o.append("token",e),o.append("clip",new File([r],`liveness-${n}.${X(a)}`,{type:a})),o.append("keyframe",new File([i],`keyframe-${n}.${X(s)}`,{type:s})),o}function Q(t,e,r=.92){return new Promise((i,n)=>{let a=t.videoWidth,s=t.videoHeight;if(!a||!s){n(new Error("video-not-ready"));return}let o=e.getContext("2d");if(!o){n(new Error("no-2d-context"));return}e.width=a,e.height=s,o.scale(-1,1),o.drawImage(t,-a,0),e.toBlob(c=>c?i(c):n(new Error("empty-keyframe")),"image/jpeg",r)})}var rt={permission:{key:"fcv2.err.permission",fr:"Autorisez la cam\xE9ra dans les r\xE9glages du navigateur (ic\xF4ne cam\xE9ra dans la barre d\u2019adresse), puis r\xE9essayez."},notfound:{key:"fcv2.err.notfound",fr:"Aucune cam\xE9ra d\xE9tect\xE9e. Branchez ou activez une cam\xE9ra, puis r\xE9essayez."},inuse:{key:"fcv2.err.inuse",fr:"La cam\xE9ra est utilis\xE9e par une autre application. Fermez-la puis r\xE9essayez."},overconstrained:{key:"fcv2.err.overconstrained",fr:"La cam\xE9ra ne prend pas en charge les r\xE9glages demand\xE9s. Nouvel essai en cours\u2026"},insecure:{key:"fcv2.err.insecure",fr:"La cam\xE9ra n\xE9cessite une connexion s\xE9curis\xE9e (HTTPS). Ouvrez la page en HTTPS."},unsupported:{key:"fcv2.err.unsupported",fr:"Votre navigateur ne prend pas en charge l\u2019enregistrement vid\xE9o. Utilisez un navigateur r\xE9cent."},generic:{key:"fcv2.err.generic",fr:"Cam\xE9ra indisponible. R\xE9essayez ou contactez le support."}},nt={recording:{key:"fcv2.recording",fr:"Enregistrement en cours\u2026"},uploading:{key:"fcv2.uploading",fr:"Envoi en cours\u2026"},clipTooLarge:{key:"fcv2.err.cliptoolarge",fr:"La vid\xE9o est trop volumineuse. R\xE9essayez dans un endroit mieux \xE9clair\xE9."},retry:{key:"fcv2.retry",fr:"R\xE9essayer"},listen:{key:"fcv2.listen",fr:"\xC9couter"}};var me=2500,pe=1e3,he=1500,j=25e5,f=class extends Error{constructor(e,r){super(r??e),this.kind=e}},D=class{constructor(){this.recorder=null;this.stream=null;this.chunks=[];this.bytes=0;this.hardStopTimer=null;this.graceTimer=null;this.settled=!1}clearTimers(){this.hardStopTimer&&clearTimeout(this.hardStopTimer),this.graceTimer&&clearTimeout(this.graceTimer),this.hardStopTimer=null,this.graceTimer=null}record(e,r){if(this.recorder&&!this.settled)return Promise.reject(new f("generic","record() called while a recording is in flight \u2014 ClipRecorder handles one recording at a time"));this.recorder=null,this.clearTimers(),this.chunks=[],this.bytes=0,this.settled=!1,this.stream=e;let i=q();return new Promise((n,a)=>{let s;try{s=new MediaRecorder(e,i?{mimeType:i,videoBitsPerSecond:j}:{videoBitsPerSecond:j})}catch{try{s=new MediaRecorder(e)}catch{a(new f("unsupported"));return}}this.recorder=s;let o=d=>{this.settled||(this.settled=!0,this.clearTimers(),d())},c=()=>o(()=>{let d=s.mimeType||i||L,u=new Blob(this.chunks,{type:d});if(u.size===0){a(new f("generic","empty clip"));return}if(S(u)){a(new f("cliptoolarge"));return}n({blob:u,mimeType:d})});s.ondataavailable=d=>{d.data&&d.data.size&&(this.chunks.push(d.data),this.bytes+=d.data.size,this.bytes>F&&o(()=>{try{s.state!=="inactive"&&s.stop()}catch{}a(new f("cliptoolarge"))}))},s.onstop=c,s.onerror=()=>o(()=>a(new f("generic")));try{s.start(pe)}catch{o(()=>a(new f("generic")));return}this.hardStopTimer=setTimeout(()=>{if(this.settled||r?.(),s.state!=="inactive"){try{s.stop()}catch{c()}this.graceTimer=setTimeout(c,he)}else c()},me)})}stop(e){this.clearTimers();let r=this.recorder;if(r&&r.state!=="inactive")try{r.stop()}catch{}this.recorder=null,(e??this.stream)?.getTracks().forEach(n=>n.stop()),this.stream=null}};function $(t,e){return{video:{width:{ideal:1280,max:1280},height:{ideal:720,max:720},facingMode:e,frameRate:{ideal:24,max:30}},audio:!1}}function J(){return typeof window>"u"||typeof navigator>"u"?!1:window.innerWidth<=768||/Android|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(String(navigator.userAgent??""))}var it=.45,at=.9,st=.4;var fe=1e4,N=class t{constructor(e,r){this.tier="blaze";this.inner=e,r!==void 0&&(this.fallbackReason=r)}static async create(e,r){let i=await import("@mediapipe/tasks-vision"),n=await i.FilesetResolver.forVisionTasks(e),a=await i.FaceDetector.createFromOptions(n,{baseOptions:{modelAssetPath:`${e}/blaze_face_short_range.tflite`,delegate:"CPU"},runningMode:"IMAGE"});return new t(a,r)}async detect(e,r,i){let n;try{n=this.inner.detect(e).detections}catch{return null}let a=ot(n);if(a?.boundingBox===void 0)return null;let s=g(e),o=ct(a.keypoints,s),c=a.keypoints?.[2],d={box:{x:a.boundingBox.originX,y:a.boundingBox.originY,width:a.boundingBox.width,height:a.boundingBox.height},...o!==void 0?{eyes:o}:{},...c!==void 0?{nose:{x:c.x*s.width,y:c.y*s.height}}:{},score:a.categories[0]?.score??0};return k(d,e,r,i)}destroy(){try{this.inner.close()}catch{}}};function ot(t){let e,r=-1;for(let i of t){let n=i.categories[0]?.score??0;n>r&&(e=i,r=n)}return e}function ct(t,e){let r=t?.[0],i=t?.[1];if(r===void 0||i===void 0)return;let n=o=>({x:o.x*e.width,y:o.y*e.height}),[a,s]=[n(r),n(i)];return a.x<=s.x?{left:a,right:s}:{left:s,right:a}}function ut(){if(typeof OffscreenCanvas=="function")return new OffscreenCanvas(2,2);let t=document.createElement("canvas");return t.width=2,t.height=2,t}async function ye(){let t=globalThis.FaceDetector;if(typeof t!="function")return{ok:!1,reason:"unsupported"};try{let e=new t({fastMode:!0,maxDetectedFaces:1});return await e.detect(ut()),{ok:!0,instance:e}}catch(e){return{ok:!1,reason:`smoke_failed:${e instanceof Error?e.message:String(e)}`}}}var G=class{constructor(e,r){this.tier="native";this.inner=e,r!==void 0&&(this.fallbackReason=r)}async detect(e,r,i){let n;try{n=await this.inner.detect(e)}catch{return null}let a=n[0];if(a===void 0)return null;let s=lt(a.landmarks),o={box:{x:a.boundingBox.x,y:a.boundingBox.y,width:a.boundingBox.width,height:a.boundingBox.height},...s!==void 0?{eyes:s}:{},score:1};return k(o,e,r,i)}destroy(){}};function lt(t){if(t===void 0)return;let e=t.filter(n=>n.type==="eye").map(n=>n.locations[0]).filter(n=>n!==void 0),[r,i]=e;if(!(r===void 0||i===void 0))return r.x<=i.x?{left:r,right:i}:{left:i,right:r}}var be="/models-v3",ge=["native","blaze"],v=class extends Error{constructor(e){super(`no detector tier available (${e})`),this.name="DetectorLadderError",this.fallbackReason=e}};function g(t){let e=t;if(typeof e.videoWidth=="number"&&e.videoWidth>0)return{width:e.videoWidth,height:e.videoHeight??0};if(typeof e.naturalWidth=="number"&&e.naturalWidth>0)return{width:e.naturalWidth,height:e.naturalHeight??0};let r=typeof e.width=="number"?e.width:0,i=typeof e.height=="number"?e.height:0;return{width:r,height:i}}function k(t,e,r,i){let n=g(e),a=n.width>0?r/n.width:1,s=n.height>0?i/n.height:1,o=c=>({x:c.x*a,y:c.y*s});return{box:{x:t.box.x*a,y:t.box.y*s,width:t.box.width*a,height:t.box.height*s},...t.eyes!==void 0?{eyes:{left:o(t.eyes.left),right:o(t.eyes.right)}}:{},...t.nose!==void 0?{nose:o(t.nose)}:{},score:t.score}}function dt(t){return t instanceof Error?t.message:String(t)}async function E(t){let e=t.preferred??ge,r=[];for(let i of e){if(i==="native"){let n=await ye();if(n.ok)return new G(n.instance,ee(r));r.push(`native:${n.reason}`);continue}try{return await mt(N.create(t.v3AssetBaseUrl??be,ee(r)),t.blazeInitTimeoutMs??fe)}catch(n){r.push(n instanceof V?"blaze:blaze_init_timeout":`blaze:${dt(n)}`)}}throw new v(ee(r)??"no_tier_available")}function ee(t){return t.length>0?t.join("; "):void 0}var V=class extends Error{};function mt(t,e){return new Promise((r,i)=>{let n=setTimeout(()=>{i(new V(`init exceeded ${e}ms`)),t.then(a=>a.destroy(),()=>{})},e);t.then(a=>{clearTimeout(n),r(a)},a=>{clearTimeout(n),i(a)})})}var zt=180,T=[100,190],pt=64;function ve(t,e){return .299*(t[e]??0)+.587*(t[e+1]??0)+.114*(t[e+2]??0)}function W(t){let{data:e,width:r,height:i}=t,n=r*i;if(n===0)return 0;let a=0;for(let s=0;s<n;s+=1)a+=ve(e,s*4);return a/n}function K(t){let{data:e,width:r,height:i}=t;if(r<3||i<3)return 0;let n=new Float32Array(r*i);for(let u=0;u<n.length;u+=1)n[u]=ve(e,u*4);let a=0,s=0,o=0;for(let u=1;u<i-1;u+=1)for(let l=1;l<r-1;l+=1){let m=u*r+l,p=(n[m-r]??0)+(n[m-1]??0)+(n[m+1]??0)+(n[m+r]??0)-4*(n[m]??0);a+=p,s+=p*p,o+=1}if(o===0)return 0;let c=a/o,d=s/o-c*c;return Math.min(1,Math.max(0,d)/180)}function te(t){let e=W(t),[r,i]=T,n=e<r?r-e:e>i?e-i:0;return Math.max(0,1-n/pt)}var Ee=Object.freeze({Q_GOOD:.6,RISE_PER_S:.9,FALL_PER_S:.25,CENTER_FALLOFF_IOD_MULTIPLE:1.35,BOX_EYE_OFFSET_FACTOR:.12,IOD_BOX_PROXY_FACTOR:.42,SIZE_IDEAL_MIN:.12,SIZE_IDEAL_MAX:.3,SIZE_HARD_MIN:.08,SIZE_HARD_MAX:.45,ROLL_MAX_DEG:25,MOTION_VELOCITY_IOD_PER_S:.5,MOTION_TAU_S:.4,MOTION_DEADBAND_IOD_PER_S:.1,READY_WINDOW_MS:500,GUIDE_SIZE:.6,GUIDE_CENTERING:.6,GUIDE_POSE:.6,GUIDE_EXPOSURE:.6,GUIDE_SHARPNESS:.35,GUIDE_MOTION:.5}),_=t=>Math.min(1,Math.max(0,t)),C=class{constructor(e={}){this.p=0;this.lastTickAt=null;this.lastCenter=null;this.velocityEma=0;this.qWindow=[];this.lastSizeDirection="ideal";this.t={...Ee,...e}}reset(){this.p=0,this.lastTickAt=null,this.lastCenter=null,this.velocityEma=0,this.qWindow=[],this.lastSizeDirection="ideal"}tick(e){let{observation:r,quality:i,timestampMs:n}=e,a=this.lastTickAt===null?0:Math.max(0,(n-this.lastTickAt)/1e3);this.lastTickAt=n;let s={presence:0,centering:0,size:0,pose:0,sharpness:_(i.sharpness),exposure:_(i.exposure),motion:1};if(r!==null){s.presence=1;let u=this.geometryOf(r,e);s.centering=u.centering,s.size=u.size,s.pose=u.pose,s.motion=this.motionOf(u.center,u.iod,n)}else this.lastCenter=null,this.velocityEma=0;let o=Math.min(s.presence,s.centering,s.size,s.pose,s.sharpness,s.exposure,s.motion);this.p=_(this.p+(o>=this.t.Q_GOOD?this.t.RISE_PER_S*o:-this.t.FALL_PER_S*(1-o))*a),this.qWindow.push({at:n,q:o}),this.qWindow=this.qWindow.filter(u=>u.at>=n-this.t.READY_WINDOW_MS);let c=this.qWindow.map(u=>u.q);if(c.length>=3){let u=Math.min(...c),l=c.indexOf(u);c=c.filter((m,p)=>p!==l)}let d=this.p>=1&&c.every(u=>u>=this.t.Q_GOOD);return{at:n,q:o,p:this.p,factors:s,guidanceKey:this.guidanceOf(s,i,o),ready:d,accepted:o>=this.t.Q_GOOD}}geometryOf(e,r){let{box:i,eyes:n}=e,a={x:r.frameWidth/2,y:r.frameHeight/2},s=Math.min(r.frameWidth,r.frameHeight),o=n!==void 0?{x:(n.left.x+n.right.x)/2,y:(n.left.y+n.right.y)/2}:{x:i.x+i.width/2,y:i.y+i.height/2-this.t.BOX_EYE_OFFSET_FACTOR*i.height},c=n!==void 0?Math.hypot(n.right.x-n.left.x,n.right.y-n.left.y):this.t.IOD_BOX_PROXY_FACTOR*i.width,d=Math.hypot(o.x-a.x,o.y-a.y),u=c<=0?0:1-_(d/(this.t.CENTER_FALLOFF_IOD_MULTIPLE*c)),l=s>0?c/s:0;this.lastSizeDirection=l<this.t.SIZE_IDEAL_MIN?"far":l>this.t.SIZE_IDEAL_MAX?"close":"ideal";let m;l<this.t.SIZE_HARD_MIN||l>this.t.SIZE_HARD_MAX?m=0:l<this.t.SIZE_IDEAL_MIN?m=(l-this.t.SIZE_HARD_MIN)/(this.t.SIZE_IDEAL_MIN-this.t.SIZE_HARD_MIN):l>this.t.SIZE_IDEAL_MAX?m=(this.t.SIZE_HARD_MAX-l)/(this.t.SIZE_HARD_MAX-this.t.SIZE_IDEAL_MAX):m=1;let p=1;if(n!==void 0){let h=Math.abs(Math.atan2(n.right.y-n.left.y,n.right.x-n.left.x))*180/Math.PI;p=1-_(h/this.t.ROLL_MAX_DEG)}return{center:o,iod:c,centering:u,size:m,pose:p}}motionOf(e,r,i){let n=this.lastCenter;if(this.lastCenter={...e,at:i},n===null||r<=0)return 1;let a=(i-n.at)/1e3;if(a<=0)return 1;let s=Math.hypot(e.x-n.x,e.y-n.y)/r/a;s<=this.t.MOTION_DEADBAND_IOD_PER_S&&(s=0);let o=1-Math.exp(-a/this.t.MOTION_TAU_S);return this.velocityEma=o*s+(1-o)*this.velocityEma,1-_(this.velocityEma/this.t.MOTION_VELOCITY_IOD_PER_S)}guidanceOf(e,r,i){if(e.presence<=0)return"fcv3.no_face";if(e.size<this.t.GUIDE_SIZE)return this.sizeGuidance();if(e.centering<this.t.GUIDE_CENTERING)return"fcv3.center_face";if(e.pose<this.t.GUIDE_POSE)return"fcv3.straighten";if(e.exposure<this.t.GUIDE_EXPOSURE)return this.exposureGuidance(r);if(e.sharpness<this.t.GUIDE_SHARPNESS)return"fcv3.steady_camera";if(e.motion<this.t.GUIDE_MOTION)return"fcv3.hold_still";if(i<this.t.Q_GOOD){let n=[["size",this.sizeGuidance()],["centering","fcv3.center_face"],["pose","fcv3.straighten"],["exposure",this.exposureGuidance(r)],["sharpness","fcv3.steady_camera"],["motion","fcv3.hold_still"]],a=n[0];for(let s of n)e[s[0]]<e[a[0]]&&(a=s);return a[1]}return"fcv3.hold_still"}sizeGuidance(){return this.lastSizeDirection==="far"?"fcv3.come_closer":"fcv3.move_back"}exposureGuidance(e){let r=(T[0]+T[1])/2;return e.meanLuma<r?"fcv3.more_light":"fcv3.too_bright"}};var _e=Object.freeze({LOW:Object.freeze({cadenceHz:5,inputWidth:128,animations:"reduced"}),MID:Object.freeze({cadenceHz:8,inputWidth:160,animations:"full"}),HIGH:Object.freeze({cadenceHz:10,inputWidth:192,animations:"full"})}),ht=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]);function ne(){let t=typeof navigator>"u"?void 0:navigator,e=!1;try{e=typeof WebAssembly<"u"&&WebAssembly.validate(ht)}catch{e=!1}return{cores:t?.hardwareConcurrency??2,memGB:t?.deviceMemory??null,simd:e}}function ie(t){let e=t.memGB??4;return t.cores<4||e<3?"LOW":t.cores>=8&&e>=6?"HIGH":"MID"}var re=["LOW","MID","HIGH"],M=class{constructor(e){this.samples=[];this.adjusted=!1;this.current=e}get deviceClass(){return this.current}get profile(){return _e[this.current]}record(e){if(this.adjusted||this.samples.length>=10)return this.current;if(this.samples.push(e),this.samples.length<10)return this.current;this.adjusted=!0;let r=this.samples.reduce((i,n)=>i+n,0)/this.samples.length;if(r>70)this.current="LOW";else if(r<25){let i=re.indexOf(this.current);this.current=re[Math.min(re.length-1,i+1)]??this.current}return this.current}};var w=class{constructor(e){this.timer=null;this.frameCallbackId=null;this.running=!1;this.busy=!1;this.lastRunAt=Number.NEGATIVE_INFINITY;this.degradeCount=0;this.durations=[];this.options=e,this.periodMs=1e3/e.cadenceHz}start(){if(this.running)return;this.running=!0;let e=this.options.video;if(typeof e?.requestVideoFrameCallback=="function"){let r=()=>{this.running&&(this.frameCallbackId=e.requestVideoFrameCallback?.(()=>{this.frameCallbackId=null,this.now()-this.lastRunAt>=this.periodMs&&this.tick(),r()}))};r();return}this.timer=setInterval(()=>this.tick(),this.periodMs)}stop(){this.running=!1,this.timer!==null&&(clearInterval(this.timer),this.timer=null),this.frameCallbackId!==null&&(this.options.video?.cancelVideoFrameCallback?.(this.frameCallbackId),this.frameCallbackId=null)}stats(){let e=this.durations.length===0?0:this.durations.reduce((r,i)=>r+i,0)/this.durations.length;return{degradeCount:this.degradeCount,meanDetectMs:e}}now(){return this.options.now?.()??performance.now()}tick(){if(!this.running)return;if(this.busy){this.degradeCount+=1;return}this.busy=!0,this.lastRunAt=this.now();let e=this.now();this.options.run().catch(()=>{}).finally(()=>{this.busy=!1,this.durations.push(this.now()-e),this.durations.length>20&&this.durations.shift()})}};var xe="0.1.0-rc.8";var Se="sekyro.did",De;function ke(){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,r=>r.toString(16).padStart(2,"0")).join("")}}catch{}}function ft(){try{let t=localStorage.getItem(Se);if(t)return t;let e=ke();return e!==void 0&&localStorage.setItem(Se,e),e}catch{return De??(De=ke()),De}}async function yt(){let t=globalThis.crypto?.subtle;if(!t)return"";let e=navigator,r=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(r));return Array.from(new Uint8Array(i),n=>n.toString(16).padStart(2,"0")).join("").slice(0,32)}function bt(t){let e=new TextEncoder().encode(t),r="";for(let i of e)r+=String.fromCharCode(i);return btoa(r).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function gt(t){let e,r;return{timezone(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone?.slice(0,64)||void 0}catch{return}},noteCameraLabel(i){i&&(e=i.slice(0,128))},async deviceHeader(){try{r??(r=yt().catch(()=>""));let i=[];navigator.webdriver&&i.push("webdriver"),/HeadlessChrome/.test(navigator.userAgent)&&i.push("headless");let n=await r,a=ft(),s={v:1,platform:"web",sdk:t.sdk.slice(0,64),ids:[...a?[{kind:"web_local",value:a.slice(0,128)}]:[],...n?[{kind:"web_fp",value:n}]:[]],screen:{w:screen.width,h:screen.height,dpr:globalThis.devicePixelRatio??1},...e?{cameraLabel:e}:{},...i.length?{signals:i}:{}};return bt(JSON.stringify(s))}catch{return}}}}var ae=Symbol.for("sekyro.web.clientContext"),se=globalThis,vt=se[ae]??(se[ae]=gt({sdk:`@sekyro/web@${xe}`}));function Te(t){try{let e=t.getVideoTracks?.()[0];e&&vt.noteCameraLabel(e.label)}catch{}}var b=1;function Ce(){return typeof OffscreenCanvas=="function"&&typeof createImageBitmap=="function"&&typeof Worker=="function"}function Et(t,e={}){let r=e.createDetector??E,i=null;t.onmessage=n=>{let a=n.data;if(a.v!==b){a.bitmap?.close?.();return}if(a.type==="init"){r(a.options).then(s=>{i=s;let o={v:b,type:"ready",tier:s.tier,...s.fallbackReason!==void 0?{fallbackReason:s.fallbackReason}:{}};t.postMessage(o)});return}if(a.type==="detect"){let s=o=>{let c={v:b,type:"result",id:a.id,observation:o};t.postMessage(c),a.bitmap.close?.()};if(i===null){s(null);return}i.detect(a.bitmap,a.streamWidth,a.streamHeight).then(s,()=>s(null))}}}typeof self<"u"&&typeof self.importScripts=="function"&&Et(self);var H=class t{constructor(e,r){this.pending=new Map;this.nextId=1;this.worker=e,this.tier=r.tier,r.fallbackReason!==void 0&&(this.fallbackReason=r.fallbackReason),e.addEventListener("message",i=>{let n=i.data;if(n.v!==b||n.type!=="result")return;let a=this.pending.get(n.id);this.pending.delete(n.id),a?.(n.observation)})}static create(e,r,i=1e4){return new Promise((n,a)=>{let s=setTimeout(()=>{e.removeEventListener("message",o),e.terminate(),a(new Error(`worker detector not ready within ${i}ms`))},i),o=d=>{let u=d.data;u.v!==b||u.type!=="ready"||(clearTimeout(s),e.removeEventListener("message",o),n(new t(e,u)))};e.addEventListener("message",o);let c={v:b,type:"init",options:r};e.postMessage(c)})}async detect(e,r,i){let n;try{typeof ImageBitmap<"u"&&e instanceof ImageBitmap?n=e:typeof createImageBitmap=="function"?n=await createImageBitmap(e):n=e}catch{return null}let a=this.nextId;return this.nextId+=1,new Promise(s=>{this.pending.set(a,s);let o={v:b,type:"detect",id:a,bitmap:n,streamWidth:r,streamHeight:i};this.worker.postMessage(o,[n])})}destroy(){for(let e of this.pending.values())e(null);this.pending.clear(),this.worker.terminate()}};var _t=["size","centering","pose","exposure","sharpness","motion"];function Me(t){if(t.accepted)return null;if(t.factors.presence<=0)return"no_face";let e="size";for(let r of _t)t.factors[r]<t.factors[e]&&(e=r);return e}var O=class{constructor(){this.blocked={};this.acceptedMs=0;this.ticks=0;this.lastAt=null}record(e){let r=this.lastAt===null?0:Math.max(0,e.at-this.lastAt);this.lastAt=e.at,this.ticks+=1;let i=Me(e);if(i===null){this.acceptedMs+=r;return}let n=this.blocked[i]??{count:0,ms:0};n.count+=1,n.ms+=r,this.blocked[i]=n}summary(){let e={};for(let[r,i]of Object.entries(this.blocked))e[r]={count:i.count,ms:Math.round(i.ms)};return{blocked:e,acceptedMs:Math.round(this.acceptedMs),ticks:this.ticks}}};var We=1e3,U=4,Ke=600,Ge={sharpness:1,exposure:1,meanLuma:128},ce=class{constructor(e){this.handlers=new Map;this.stateValue="idle";this.attempt=0;this.stream=null;this.detector=null;this.scheduler=null;this.gate=null;this.profiler=null;this.lastGuidanceKey=null;this.positioningStartedAt=0;this.cameraRequestedAt=null;this.cameraReadyAt=null;this.faceAcquiredAt=null;this.captureCompleteAt=null;this.fired=!1;this.carriedDegrade=0;this.carriedMeans=[];this.blockStats=null;this.lastGateSnapshotAt=Number.NEGATIVE_INFINITY;this.snapshotCanvas=null;this.options=e,this.facing=e.facingMode??"user"}get state(){return this.stateValue}on(e,r){let i=this.handlers.get(e);return i||(i=new Set,this.handlers.set(e,i)),i.add(r),()=>i?.delete(r)}emit(e,r){for(let i of[...this.handlers.get(e)??[]])i(r)}async start(e={}){e.facingMode!==void 0&&(this.facing=e.facingMode),this.attempt+=1,await this.run(this.attempt)}get facingMode(){return this.facing}retry(){this.teardownAttempt(),this.start()}switchCamera(){this.facing=this.facing==="user"?"environment":"user",this.teardownAttempt(),this.start()}destroy(){this.attempt+=1,this.teardownAttempt(),this.detector?.destroy(),this.detector=null,this.options.video.srcObject=null}async run(e){let{options:r}=this;this.fired=!1,this.lastGuidanceKey=null,this.carriedDegrade=0,this.carriedMeans=[],this.cameraRequestedAt=null,this.cameraReadyAt=null,this.faceAcquiredAt=null,this.captureCompleteAt=null,this.setState("preflight");let i=Z();if(i!=="OK"){this.fail(i==="INSECURE_CONTEXT"?"insecure":"unsupported");return}this.setState("acquiring");let n=r.getUserMedia??(c=>navigator.mediaDevices.getUserMedia(c)),a;this.cameraRequestedAt=this.now();try{a=await n($(J(),this.facing))}catch(c){if(e!==this.attempt)return;this.fail(Y(c));return}if(Te(a),e!==this.attempt){for(let c of a.getTracks())c.stop();return}if(this.stream=a,r.video.srcObject=a,await r.video.play().catch(()=>{}),e!==this.attempt)return;if(this.cameraReadyAt=this.now(),this.detector===null){let c={...r.v3AssetBaseUrl!==void 0?{v3AssetBaseUrl:r.v3AssetBaseUrl}:{}},d=r.createDetector??(r.createWorker!==void 0&&Ce()?async()=>{try{return await H.create(r.createWorker(),c)}catch{return E(c)}}:()=>E(c)),u;try{u=await d()}catch(l){e===this.attempt&&this.fail("models",l instanceof v?l.fallbackReason:wt(l));return}if(e!==this.attempt){u.destroy();return}this.detector=u,this.options.telemetry?.({type:"detector",tier:u.tier,fallbackReason:u.fallbackReason})}let s=ne(),o=r.deviceClass??ie(s);this.profiler=new M(o),this.options.telemetry?.({type:"profile",staticClass:o,activeClass:this.profiler.deviceClass,simd:s.simd}),this.gate=new C(r.thresholds??{}),this.blockStats=new O,this.lastGateSnapshotAt=this.now(),r.rankKeyframes?.()&&Promise.resolve().then(()=>(Ne(),Fe)).then(c=>oe=c,()=>{}),this.setState("positioning"),this.positioningStartedAt=this.now(),this.startScheduler(e)}get animations(){return this.profiler?.profile.animations??"full"}startScheduler(e){let r=this.profiler;if(r===null)return;if(this.scheduler!==null){let n=this.scheduler.stats();this.carriedDegrade+=n.degradeCount,n.meanDetectMs>0&&this.carriedMeans.push(n.meanDetectMs),this.scheduler.stop()}let i=new w({cadenceHz:r.profile.cadenceHz,video:this.options.video,now:this.options.now,run:()=>this.detectTick(e)});this.scheduler=i,i.start()}async detectTick(e){let{detector:r,gate:i,profiler:n}=this,a=this.options.video;if(e!==this.attempt||r===null||i===null||n===null||this.fired||a.videoWidth===0)return;let s=n.deviceClass,o=this.now(),c=this.options.makeSnapshot?.(a,n.profile.inputWidth)??this.defaultSnapshot(a,n.profile.inputWidth),d=null;try{d=await r.detect(c,a.videoWidth,a.videoHeight)}catch{d=null}if(e!==this.attempt||this.fired)return;n.record(this.now()-o),n.deviceClass!==s&&this.startScheduler(e);let u=d===null?Ge:this.options.measureQuality?.(a,d.box)??this.defaultQuality(a,d.box),l=i.tick({timestampMs:this.now(),observation:d,quality:u,frameWidth:a.videoWidth,frameHeight:a.videoHeight});l.accepted&&this.faceAcquiredAt===null&&(this.faceAcquiredAt=l.at),this.blockStats?.record(l),!l.ready&&l.at-this.lastGateSnapshotAt>=We&&(this.lastGateSnapshotAt=l.at,this.reportGate(!1)),this.emit("checks",{engine:"v3",progress:l.p,q:l.q,factors:l.factors,attempt:e}),l.guidanceKey!==this.lastGuidanceKey&&(this.lastGuidanceKey=l.guidanceKey,this.emit("guidance",{key:l.guidanceKey})),l.ready&&this.stateValue==="positioning"&&(this.fired=!0,this.captureCompleteAt=l.at,this.fire(e))}async fire(e){let{options:r}=this,i=this.scheduler;i?.stop(),this.reportGate(!0);let n=i?.stats()??{degradeCount:0,meanDetectMs:0},a=[...this.carriedMeans,...n.meanDetectMs>0?[n.meanDetectMs]:[]];r.telemetry?.({type:"fired",timeToGateMs:this.now()-this.positioningStartedAt,degradeCount:this.carriedDegrade+n.degradeCount,meanDetectMs:a.length===0?0:a.reduce((h,y)=>h+y,0)/a.length});let s=r.mode??"clip",o=r.rankKeyframes?.()&&oe?oe.default(this,e).catch(()=>this.collectKeyframes(e)):this.collectKeyframes(e);if(s==="photo"){let h=await o;if(e!==this.attempt)return;if(h===null){this.fail("generic");return}this.finishCapture({keyframe:h.blob,previewDataUrl:h.previewDataUrl});return}this.setState("recording");let c=r.createRecorder?.()??new D,d=this.stream;if(d===null){this.fail("generic");return}let u=null;o.then(h=>{u=h},()=>{});let l=()=>{e===this.attempt&&u!==null&&this.emit("frozen",{previewDataUrl:u.previewDataUrl})},m,p;try{[m,p]=await Promise.all([c.record(d,l),o])}catch(h){if(e!==this.attempt)return;let y=h.kind;this.fail(y==="cliptoolarge"?"cliptoolarge":"recorder");return}if(e===this.attempt){if(S(m.blob)){this.fail("cliptoolarge");return}if(p===null){this.fail("generic");return}this.finishCapture({clip:m.blob,clipMimeType:m.mimeType,keyframe:p.blob,previewDataUrl:p.previewDataUrl})}}async collectKeyframes(e){let r=this.options.captureKeyframe??(a=>this.defaultKeyframe(a)),i=Ke/(U-1),n=null;for(let a=0;a<U;a+=1){if(e!==this.attempt)return n;try{let s=await r(this.options.video);(n===null||s.sharpness>n.sharpness)&&(n=s)}catch{}a<U-1&&await Mt(i)}return n}finishCapture(e){this.stopTracks(),this.setState("captured");let r=this.captureTiming();this.emit("artifacts",r===void 0?e:{...e,timing:r})}captureTiming(){let e=(s,o)=>s!==null&&o!==null?Math.max(0,Math.round(o-s)):void 0,r=e(this.cameraRequestedAt,this.cameraReadyAt),i=e(this.cameraReadyAt,this.faceAcquiredAt),n=e(this.faceAcquiredAt,this.captureCompleteAt),a={...r!==void 0?{cameraReadyMs:r}:{},...i!==void 0?{faceAcquireMs:i}:{},...n!==void 0?{captureMs:n}:{}};return Object.keys(a).length>0?a:void 0}async defaultKeyframe(e){let r=document.createElement("canvas"),i=await Q(e,r),n=r.toDataURL("image/jpeg",.92);return{blob:i,previewDataUrl:n,sharpness:this.centerSharpness(e)}}defaultSnapshot(e,r){try{let i=this.snapshotCanvas??document.createElement("canvas"),n=r/Math.max(1,e.videoWidth),a=Math.max(1,Math.round(e.videoWidth*n)),s=Math.max(1,Math.round(e.videoHeight*n)),o=i.getContext("2d");return o===null?e:(i.width!==a&&(i.width=a),i.height!==s&&(i.height=s),o.drawImage(e,0,0,a,s),this.snapshotCanvas=i,i)}catch{return e}}defaultQuality(e,r){let i=Ve(e,r,96);return i===null?Ge:{sharpness:K(i),exposure:te(i),meanLuma:W(i)}}centerSharpness(e){let r=g(e),i=Ve(e,{x:r.width*.25,y:r.height*.25,width:r.width*.5,height:r.height*.5},96);return i===null?0:K(i)}teardownAttempt(){this.scheduler?.stop(),this.scheduler=null,this.reportGate(!0),this.gate=null,this.stopTracks()}reportGate(e){let r=this.blockStats,i=this.profiler;if(r===null||i===null)return;let n=r.summary();e&&(this.blockStats=null),n.ticks!==0&&this.options.telemetry?.({type:"gate",final:e,activeClass:i.deviceClass,cadenceHz:i.profile.cadenceHz,...n})}stopTracks(){if(this.stream!==null){for(let e of this.stream.getTracks())e.stop();this.stream=null}}fail(e,r){this.scheduler?.stop(),this.reportGate(!0),this.stopTracks(),this.setState("error"),this.options.telemetry?.({type:"error",kind:e,fallbackReason:r}),this.emit("error",{kind:e,retryable:e!=="insecure"&&e!=="unsupported"})}setState(e){this.stateValue=e,this.emit("statechange",{state:e})}now(){return this.options.now?.()??performance.now()}},oe;function Mt(t){return new Promise(e=>setTimeout(e,t))}function wt(t){return t instanceof Error?t.message:String(t)}function Ve(t,e,r){try{let i=document.createElement("canvas"),n=r/Math.max(1,e.width);i.width=Math.max(1,Math.round(e.width*n)),i.height=Math.max(1,Math.round(e.height*n));let a=i.getContext("2d");return a===null?null:(a.drawImage(t,e.x,e.y,e.width,e.height,0,0,i.width,i.height),a.getImageData(0,0,i.width,i.height))}catch{return null}}0&&(module.exports={CENTERED_FACTOR,CIRCLE_RADIUS_FACTOR,CLIP_MS,CaptureSessionV3,ClipError,ClipRecorder,DEFAULT_CLIP_MIME,DEFAULT_TIER_ORDER,DEFAULT_V3_ASSET_BASE_URL,DEVICE_PROFILES,DetectScheduler,DetectorLadderError,DeviceProfiler,EXPOSURE_BAND,FaceGateV3,GATE_SNAPSHOT_MS,GateBlockStats,IN_CIRCLE_FACTOR,KEYFRAME_CANDIDATES,KEYFRAME_WINDOW_MS,MAX_CLIP_BYTES,MIME_CANDIDATES,SHARP_REF,STOP_GRACE_MS,TIMESLICE_MS,V3_GATE_DEFAULTS,VIDEO_BPS,blockReasonOf,buildCaptureConstraints,buildLivenessV2FormData,cameraPreflight,captureMirroredKeyframe,classifyDevice,createDetector,detectIsMobile,errorCopy,exposure,extForMime,intrinsicSize,isClipTooLarge,isMediaRecorderSupported,mapGetUserMediaError,meanLuma,pickMimeType,probeDevice,sharpness,toStreamPixels,uiCopy});
|
|
1
|
+
"use strict";var Xe=Object.create;var P=Object.defineProperty;var qe=Object.getOwnPropertyDescriptor;var Ye=Object.getOwnPropertyNames;var Ze=Object.getPrototypeOf,Qe=Object.prototype.hasOwnProperty;var je=(t,e)=>()=>(t&&(e=t(t=0)),e);var ue=(t,e)=>{for(var r in e)P(t,r,{get:e[r],enumerable:!0})},le=(t,e,r,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Ye(e))!Qe.call(t,n)&&n!==r&&P(t,n,{get:()=>e[n],enumerable:!(i=qe(e,n))||i.enumerable});return t};var $e=(t,e,r)=>(r=t!=null?Xe(Ze(t)):{},le(e||!t||!t.__esModule?P(r,"default",{value:t,enumerable:!0}):r,t)),Je=t=>le(P({},"__esModule",{value:!0}),t);var Fe={};ue(Fe,{RANK_CANDIDATES:()=>xt,RANK_TOLERANCE:()=>B,RANK_WINDOW_MS:()=>St,ROLL_ZERO_DEG:()=>kt,SHARPNESS_REPORT_MAX:()=>Pe,YAW_REPORT_MAX:()=>Ae,YAW_ZERO_IOD:()=>Dt,collectRankedKeyframes:()=>Le,default:()=>Ct,featuresOf:()=>Ie,frontalOf:()=>Oe,rankKeyframes:()=>Re});function Oe(t){let e=t.eyes;if(e===void 0)return{frontal:1,yaw:null,roll:null};let r=e.right.x-e.left.x,i=e.right.y-e.left.y,n=r*r+i*i;if(n===0)return{frontal:1,yaw:null,roll:null};let a=Math.abs(Math.atan2(i,Math.abs(r))*180/Math.PI),s=we(1-a/30),o=null,c=t.nose;if(c!==void 0){let d=(e.left.x+e.right.x)/2,u=(e.left.y+e.right.y)/2;o=Math.abs(((c.x-d)*r+(c.y-u)*i)/n),s*=we(1-o/.5)}return{frontal:s,yaw:o,roll:a}}function Ie(t,e){return t===null?{face:!1,frontal:0,yaw:null,roll:null,eyes:null,score:0,sharpness:e}:{face:!0,...Oe(t),eyes:null,score:t.score,sharpness:e}}function Re(t){let e=t.map((n,a)=>a),r=(n,a)=>{let s=Number.NEGATIVE_INFINITY;for(let o of e)s=Math.max(s,n(t[o]));e=e.filter(o=>n(t[o])>=s-a)};r(n=>n.frontal,B.frontal),r(n=>n.eyes??1,B.eyes),r(n=>n.score,B.score);let i=-1;for(let n of e)(i===-1||t[n].sharpness>t[i].sharpness)&&(i=n);return i}function Tt(t){return{face:t.face,frontal:x(t.frontal),...t.yaw!==null?{yaw:Math.min(x(t.yaw),Ae)}:{},...t.roll!==null?{roll:x(t.roll)}:{},...t.eyes!==null?{eyes:x(t.eyes)}:{},score:x(t.score),sharpness:Math.min(x(t.sharpness),Pe)}}async function Le(t,e){let{options:r}=t,i=r.video,n=r.now??(()=>performance.now()),a=r.captureKeyframe??(m=>t.defaultKeyframe(m)),s=600/3,o=[],c=[],d=0;for(let m=0;m<4;m+=1){if(e!==t.attempt)return null;let p=t.detector,h=Promise.resolve(null),y,I=0;try{if(p!==null){let A=t.profiler?.profile.inputWidth??160,Ue=r.makeSnapshot?.(i,A)??t.defaultSnapshot(i,A);y=a(i).then(z=>(I=n(),z));let ze=n();h=p.detect(Ue,i.videoWidth,i.videoHeight).then(z=>(d+=n()-ze,z),()=>null)}else y=a(i).then(A=>(I=n(),A));let[R,Be]=await Promise.all([y,h]);o.push(R),c.push(Ie(Be,R.sharpness))}catch{y?.catch(()=>{})}let He=I>0?Math.max(0,n()-I):0;m<3&&await new Promise(R=>setTimeout(R,Math.max(0,s-He)))}if(e!==t.attempt)return null;let u=Re(c);if(u===-1)return null;let l=0;c.forEach((m,p)=>{m.sharpness>c[l].sharpness&&(l=p)});try{r.telemetry?.({type:"keyframe",tier:t.detector?.tier??null,chosen:u,sharpest:l,detectMs:Math.round(d),candidates:c.map(Tt)})}catch{}return o[u]??null}var xt,St,Dt,kt,B,we,x,Ae,Pe,Ct,Ne=je(()=>{"use strict";xt=4,St=600,Dt=.5,kt=30,B={frontal:.1,eyes:.1,score:.05},we=t=>t<0?0:t>1?1:t;x=t=>Number.isFinite(t)?Math.round(t*1e3)/1e3:0,Ae=99,Pe=999999;Ct=Le});var Ot={};ue(Ot,{CENTERED_FACTOR:()=>st,CIRCLE_RADIUS_FACTOR:()=>it,CLIP_MS:()=>me,CaptureSessionV3:()=>ce,ClipError:()=>f,ClipRecorder:()=>D,DEFAULT_CLIP_MIME:()=>L,DEFAULT_TIER_ORDER:()=>ge,DEFAULT_V3_ASSET_BASE_URL:()=>be,DEVICE_PROFILES:()=>_e,DetectScheduler:()=>w,DetectorLadderError:()=>v,DeviceProfiler:()=>M,EXPOSURE_BAND:()=>T,FaceGateV3:()=>C,GATE_SNAPSHOT_MS:()=>We,GateBlockStats:()=>O,IN_CIRCLE_FACTOR:()=>at,KEYFRAME_CANDIDATES:()=>U,KEYFRAME_WINDOW_MS:()=>Ke,MAX_CLIP_BYTES:()=>F,MIME_CANDIDATES:()=>de,SHARP_REF:()=>zt,STOP_GRACE_MS:()=>he,TIMESLICE_MS:()=>pe,V3_GATE_DEFAULTS:()=>Ee,VIDEO_BPS:()=>j,blockReasonOf:()=>Me,buildCaptureConstraints:()=>$,buildLivenessV2FormData:()=>tt,cameraPreflight:()=>Z,captureMirroredKeyframe:()=>Q,classifyDevice:()=>ie,createDetector:()=>E,detectIsMobile:()=>J,errorCopy:()=>rt,exposure:()=>te,extForMime:()=>X,intrinsicSize:()=>g,isClipTooLarge:()=>S,isMediaRecorderSupported:()=>et,mapGetUserMediaError:()=>Y,meanLuma:()=>W,pickMimeType:()=>q,probeDevice:()=>ne,sharpness:()=>K,toStreamPixels:()=>k,uiCopy:()=>nt});module.exports=Je(Ot);var de=["video/mp4;codecs=avc1.42E01E,mp4a.40.2","video/mp4;codecs=avc1.42E01E","video/mp4","video/webm;codecs=vp9,opus","video/webm;codecs=vp9","video/webm;codecs=vp8,opus","video/webm;codecs=vp8","video/webm"];function q(){let t=globalThis.MediaRecorder;return!t||typeof t.isTypeSupported!="function"?"":de.find(e=>t.isTypeSupported(e))??""}var L="video/webm";function Y(t){if(t instanceof TypeError)return"insecure";switch(t?.name??""){case"NotAllowedError":case"PermissionDeniedError":return"permission";case"NotFoundError":case"DevicesNotFoundError":return"notfound";case"NotReadableError":case"TrackStartError":return"inuse";case"OverconstrainedError":case"ConstraintNotSatisfiedError":return"overconstrained";default:return"generic"}}function Z(){let t=globalThis;if(typeof t.window<"u"&&t.window.isSecureContext===!1)return"INSECURE_CONTEXT";let e=t.navigator?.mediaDevices;return!e||typeof e.getUserMedia!="function"?"UNSUPPORTED":"OK"}function et(){let t=globalThis.MediaRecorder;return typeof t<"u"&&typeof t.isTypeSupported=="function"}var F=8*1024*1024;function S(t){return t.size>F}function X(t){let e=(t||"").toLowerCase();return e.startsWith("image/jpeg")?"jpg":e.startsWith("video/mp4")?"mp4":(e.startsWith("video/webm"),"webm")}function tt(t){let{token:e,clip:r,keyframe:i}=t,n=t.ts??Date.now(),a=r.type||L,s=i.type||"image/jpeg",o=new FormData;return o.append("token",e),o.append("clip",new File([r],`liveness-${n}.${X(a)}`,{type:a})),o.append("keyframe",new File([i],`keyframe-${n}.${X(s)}`,{type:s})),o}function Q(t,e,r=.92){return new Promise((i,n)=>{let a=t.videoWidth,s=t.videoHeight;if(!a||!s){n(new Error("video-not-ready"));return}let o=e.getContext("2d");if(!o){n(new Error("no-2d-context"));return}e.width=a,e.height=s,o.scale(-1,1),o.drawImage(t,-a,0),e.toBlob(c=>c?i(c):n(new Error("empty-keyframe")),"image/jpeg",r)})}var rt={permission:{key:"fcv2.err.permission",fr:"Autorisez la cam\xE9ra dans les r\xE9glages du navigateur (ic\xF4ne cam\xE9ra dans la barre d\u2019adresse), puis r\xE9essayez."},notfound:{key:"fcv2.err.notfound",fr:"Aucune cam\xE9ra d\xE9tect\xE9e. Branchez ou activez une cam\xE9ra, puis r\xE9essayez."},inuse:{key:"fcv2.err.inuse",fr:"La cam\xE9ra est utilis\xE9e par une autre application. Fermez-la puis r\xE9essayez."},overconstrained:{key:"fcv2.err.overconstrained",fr:"La cam\xE9ra ne prend pas en charge les r\xE9glages demand\xE9s. Nouvel essai en cours\u2026"},insecure:{key:"fcv2.err.insecure",fr:"La cam\xE9ra n\xE9cessite une connexion s\xE9curis\xE9e (HTTPS). Ouvrez la page en HTTPS."},unsupported:{key:"fcv2.err.unsupported",fr:"Votre navigateur ne prend pas en charge l\u2019enregistrement vid\xE9o. Utilisez un navigateur r\xE9cent."},generic:{key:"fcv2.err.generic",fr:"Cam\xE9ra indisponible. R\xE9essayez ou contactez le support."}},nt={recording:{key:"fcv2.recording",fr:"Enregistrement en cours\u2026"},uploading:{key:"fcv2.uploading",fr:"Envoi en cours\u2026"},clipTooLarge:{key:"fcv2.err.cliptoolarge",fr:"La vid\xE9o est trop volumineuse. R\xE9essayez dans un endroit mieux \xE9clair\xE9."},retry:{key:"fcv2.retry",fr:"R\xE9essayer"},listen:{key:"fcv2.listen",fr:"\xC9couter"}};var me=2500,pe=1e3,he=1500,j=25e5,f=class extends Error{constructor(e,r){super(r??e),this.kind=e}},D=class{constructor(){this.recorder=null;this.stream=null;this.chunks=[];this.bytes=0;this.hardStopTimer=null;this.graceTimer=null;this.settled=!1}clearTimers(){this.hardStopTimer&&clearTimeout(this.hardStopTimer),this.graceTimer&&clearTimeout(this.graceTimer),this.hardStopTimer=null,this.graceTimer=null}record(e,r){if(this.recorder&&!this.settled)return Promise.reject(new f("generic","record() called while a recording is in flight \u2014 ClipRecorder handles one recording at a time"));this.recorder=null,this.clearTimers(),this.chunks=[],this.bytes=0,this.settled=!1,this.stream=e;let i=q();return new Promise((n,a)=>{let s;try{s=new MediaRecorder(e,i?{mimeType:i,videoBitsPerSecond:j}:{videoBitsPerSecond:j})}catch{try{s=new MediaRecorder(e)}catch{a(new f("unsupported"));return}}this.recorder=s;let o=d=>{this.settled||(this.settled=!0,this.clearTimers(),d())},c=()=>o(()=>{let d=s.mimeType||i||L,u=new Blob(this.chunks,{type:d});if(u.size===0){a(new f("generic","empty clip"));return}if(S(u)){a(new f("cliptoolarge"));return}n({blob:u,mimeType:d})});s.ondataavailable=d=>{d.data&&d.data.size&&(this.chunks.push(d.data),this.bytes+=d.data.size,this.bytes>F&&o(()=>{try{s.state!=="inactive"&&s.stop()}catch{}a(new f("cliptoolarge"))}))},s.onstop=c,s.onerror=()=>o(()=>a(new f("generic")));try{s.start(pe)}catch{o(()=>a(new f("generic")));return}this.hardStopTimer=setTimeout(()=>{if(this.settled||r?.(),s.state!=="inactive"){try{s.stop()}catch{c()}this.graceTimer=setTimeout(c,he)}else c()},me)})}stop(e){this.clearTimers();let r=this.recorder;if(r&&r.state!=="inactive")try{r.stop()}catch{}this.recorder=null,(e??this.stream)?.getTracks().forEach(n=>n.stop()),this.stream=null}};function $(t,e){return{video:{width:{ideal:1280,max:1280},height:{ideal:720,max:720},facingMode:e,frameRate:{ideal:24,max:30}},audio:!1}}function J(){return typeof window>"u"||typeof navigator>"u"?!1:window.innerWidth<=768||/Android|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(String(navigator.userAgent??""))}var it=.45,at=.9,st=.4;var fe=1e4,N=class t{constructor(e,r){this.tier="blaze";this.inner=e,r!==void 0&&(this.fallbackReason=r)}static async create(e,r){let i=await import("@mediapipe/tasks-vision"),n=await i.FilesetResolver.forVisionTasks(e),a=await i.FaceDetector.createFromOptions(n,{baseOptions:{modelAssetPath:`${e}/blaze_face_short_range.tflite`,delegate:"CPU"},runningMode:"IMAGE"});return new t(a,r)}async detect(e,r,i){let n;try{n=this.inner.detect(e).detections}catch{return null}let a=ot(n);if(a?.boundingBox===void 0)return null;let s=g(e),o=ct(a.keypoints,s),c=a.keypoints?.[2],d={box:{x:a.boundingBox.originX,y:a.boundingBox.originY,width:a.boundingBox.width,height:a.boundingBox.height},...o!==void 0?{eyes:o}:{},...c!==void 0?{nose:{x:c.x*s.width,y:c.y*s.height}}:{},score:a.categories[0]?.score??0};return k(d,e,r,i)}destroy(){try{this.inner.close()}catch{}}};function ot(t){let e,r=-1;for(let i of t){let n=i.categories[0]?.score??0;n>r&&(e=i,r=n)}return e}function ct(t,e){let r=t?.[0],i=t?.[1];if(r===void 0||i===void 0)return;let n=o=>({x:o.x*e.width,y:o.y*e.height}),[a,s]=[n(r),n(i)];return a.x<=s.x?{left:a,right:s}:{left:s,right:a}}function ut(){if(typeof OffscreenCanvas=="function")return new OffscreenCanvas(2,2);let t=document.createElement("canvas");return t.width=2,t.height=2,t}async function ye(){let t=globalThis.FaceDetector;if(typeof t!="function")return{ok:!1,reason:"unsupported"};try{let e=new t({fastMode:!0,maxDetectedFaces:1});return await e.detect(ut()),{ok:!0,instance:e}}catch(e){return{ok:!1,reason:`smoke_failed:${e instanceof Error?e.message:String(e)}`}}}var G=class{constructor(e,r){this.tier="native";this.inner=e,r!==void 0&&(this.fallbackReason=r)}async detect(e,r,i){let n;try{n=await this.inner.detect(e)}catch{return null}let a=n[0];if(a===void 0)return null;let s=lt(a.landmarks),o={box:{x:a.boundingBox.x,y:a.boundingBox.y,width:a.boundingBox.width,height:a.boundingBox.height},...s!==void 0?{eyes:s}:{},score:1};return k(o,e,r,i)}destroy(){}};function lt(t){if(t===void 0)return;let e=t.filter(n=>n.type==="eye").map(n=>n.locations[0]).filter(n=>n!==void 0),[r,i]=e;if(!(r===void 0||i===void 0))return r.x<=i.x?{left:r,right:i}:{left:i,right:r}}var be="/models-v3",ge=["native","blaze"],v=class extends Error{constructor(e){super(`no detector tier available (${e})`),this.name="DetectorLadderError",this.fallbackReason=e}};function g(t){let e=t;if(typeof e.videoWidth=="number"&&e.videoWidth>0)return{width:e.videoWidth,height:e.videoHeight??0};if(typeof e.naturalWidth=="number"&&e.naturalWidth>0)return{width:e.naturalWidth,height:e.naturalHeight??0};let r=typeof e.width=="number"?e.width:0,i=typeof e.height=="number"?e.height:0;return{width:r,height:i}}function k(t,e,r,i){let n=g(e),a=n.width>0?r/n.width:1,s=n.height>0?i/n.height:1,o=c=>({x:c.x*a,y:c.y*s});return{box:{x:t.box.x*a,y:t.box.y*s,width:t.box.width*a,height:t.box.height*s},...t.eyes!==void 0?{eyes:{left:o(t.eyes.left),right:o(t.eyes.right)}}:{},...t.nose!==void 0?{nose:o(t.nose)}:{},score:t.score}}function dt(t){return t instanceof Error?t.message:String(t)}async function E(t){let e=t.preferred??ge,r=[];for(let i of e){if(i==="native"){let n=await ye();if(n.ok)return new G(n.instance,ee(r));r.push(`native:${n.reason}`);continue}try{return await mt(N.create(t.v3AssetBaseUrl??be,ee(r)),t.blazeInitTimeoutMs??fe)}catch(n){r.push(n instanceof V?"blaze:blaze_init_timeout":`blaze:${dt(n)}`)}}throw new v(ee(r)??"no_tier_available")}function ee(t){return t.length>0?t.join("; "):void 0}var V=class extends Error{};function mt(t,e){return new Promise((r,i)=>{let n=setTimeout(()=>{i(new V(`init exceeded ${e}ms`)),t.then(a=>a.destroy(),()=>{})},e);t.then(a=>{clearTimeout(n),r(a)},a=>{clearTimeout(n),i(a)})})}var zt=180,T=[100,190],pt=64;function ve(t,e){return .299*(t[e]??0)+.587*(t[e+1]??0)+.114*(t[e+2]??0)}function W(t){let{data:e,width:r,height:i}=t,n=r*i;if(n===0)return 0;let a=0;for(let s=0;s<n;s+=1)a+=ve(e,s*4);return a/n}function K(t){let{data:e,width:r,height:i}=t;if(r<3||i<3)return 0;let n=new Float32Array(r*i);for(let u=0;u<n.length;u+=1)n[u]=ve(e,u*4);let a=0,s=0,o=0;for(let u=1;u<i-1;u+=1)for(let l=1;l<r-1;l+=1){let m=u*r+l,p=(n[m-r]??0)+(n[m-1]??0)+(n[m+1]??0)+(n[m+r]??0)-4*(n[m]??0);a+=p,s+=p*p,o+=1}if(o===0)return 0;let c=a/o,d=s/o-c*c;return Math.min(1,Math.max(0,d)/180)}function te(t){let e=W(t),[r,i]=T,n=e<r?r-e:e>i?e-i:0;return Math.max(0,1-n/pt)}var Ee=Object.freeze({Q_GOOD:.6,RISE_PER_S:.9,FALL_PER_S:.25,CENTER_FALLOFF_IOD_MULTIPLE:1.35,BOX_EYE_OFFSET_FACTOR:.12,IOD_BOX_PROXY_FACTOR:.42,SIZE_IDEAL_MIN:.12,SIZE_IDEAL_MAX:.3,SIZE_HARD_MIN:.08,SIZE_HARD_MAX:.45,ROLL_MAX_DEG:25,MOTION_VELOCITY_IOD_PER_S:.5,MOTION_TAU_S:.4,MOTION_DEADBAND_IOD_PER_S:.1,READY_WINDOW_MS:500,GUIDE_SIZE:.6,GUIDE_CENTERING:.6,GUIDE_POSE:.6,GUIDE_EXPOSURE:.6,GUIDE_SHARPNESS:.35,GUIDE_MOTION:.5}),_=t=>Math.min(1,Math.max(0,t)),C=class{constructor(e={}){this.p=0;this.lastTickAt=null;this.lastCenter=null;this.velocityEma=0;this.qWindow=[];this.lastSizeDirection="ideal";this.t={...Ee,...e}}reset(){this.p=0,this.lastTickAt=null,this.lastCenter=null,this.velocityEma=0,this.qWindow=[],this.lastSizeDirection="ideal"}tick(e){let{observation:r,quality:i,timestampMs:n}=e,a=this.lastTickAt===null?0:Math.max(0,(n-this.lastTickAt)/1e3);this.lastTickAt=n;let s={presence:0,centering:0,size:0,pose:0,sharpness:_(i.sharpness),exposure:_(i.exposure),motion:1};if(r!==null){s.presence=1;let u=this.geometryOf(r,e);s.centering=u.centering,s.size=u.size,s.pose=u.pose,s.motion=this.motionOf(u.center,u.iod,n)}else this.lastCenter=null,this.velocityEma=0;let o=Math.min(s.presence,s.centering,s.size,s.pose,s.sharpness,s.exposure,s.motion);this.p=_(this.p+(o>=this.t.Q_GOOD?this.t.RISE_PER_S*o:-this.t.FALL_PER_S*(1-o))*a),this.qWindow.push({at:n,q:o}),this.qWindow=this.qWindow.filter(u=>u.at>=n-this.t.READY_WINDOW_MS);let c=this.qWindow.map(u=>u.q);if(c.length>=3){let u=Math.min(...c),l=c.indexOf(u);c=c.filter((m,p)=>p!==l)}let d=this.p>=1&&c.every(u=>u>=this.t.Q_GOOD);return{at:n,q:o,p:this.p,factors:s,guidanceKey:this.guidanceOf(s,i,o),ready:d,accepted:o>=this.t.Q_GOOD}}geometryOf(e,r){let{box:i,eyes:n}=e,a={x:r.frameWidth/2,y:r.frameHeight/2},s=Math.min(r.frameWidth,r.frameHeight),o=n!==void 0?{x:(n.left.x+n.right.x)/2,y:(n.left.y+n.right.y)/2}:{x:i.x+i.width/2,y:i.y+i.height/2-this.t.BOX_EYE_OFFSET_FACTOR*i.height},c=n!==void 0?Math.hypot(n.right.x-n.left.x,n.right.y-n.left.y):this.t.IOD_BOX_PROXY_FACTOR*i.width,d=Math.hypot(o.x-a.x,o.y-a.y),u=c<=0?0:1-_(d/(this.t.CENTER_FALLOFF_IOD_MULTIPLE*c)),l=s>0?c/s:0;this.lastSizeDirection=l<this.t.SIZE_IDEAL_MIN?"far":l>this.t.SIZE_IDEAL_MAX?"close":"ideal";let m;l<this.t.SIZE_HARD_MIN||l>this.t.SIZE_HARD_MAX?m=0:l<this.t.SIZE_IDEAL_MIN?m=(l-this.t.SIZE_HARD_MIN)/(this.t.SIZE_IDEAL_MIN-this.t.SIZE_HARD_MIN):l>this.t.SIZE_IDEAL_MAX?m=(this.t.SIZE_HARD_MAX-l)/(this.t.SIZE_HARD_MAX-this.t.SIZE_IDEAL_MAX):m=1;let p=1;if(n!==void 0){let h=Math.abs(Math.atan2(n.right.y-n.left.y,n.right.x-n.left.x))*180/Math.PI;p=1-_(h/this.t.ROLL_MAX_DEG)}return{center:o,iod:c,centering:u,size:m,pose:p}}motionOf(e,r,i){let n=this.lastCenter;if(this.lastCenter={...e,at:i},n===null||r<=0)return 1;let a=(i-n.at)/1e3;if(a<=0)return 1;let s=Math.hypot(e.x-n.x,e.y-n.y)/r/a;s<=this.t.MOTION_DEADBAND_IOD_PER_S&&(s=0);let o=1-Math.exp(-a/this.t.MOTION_TAU_S);return this.velocityEma=o*s+(1-o)*this.velocityEma,1-_(this.velocityEma/this.t.MOTION_VELOCITY_IOD_PER_S)}guidanceOf(e,r,i){if(e.presence<=0)return"fcv3.no_face";if(e.size<this.t.GUIDE_SIZE)return this.sizeGuidance();if(e.centering<this.t.GUIDE_CENTERING)return"fcv3.center_face";if(e.pose<this.t.GUIDE_POSE)return"fcv3.straighten";if(e.exposure<this.t.GUIDE_EXPOSURE)return this.exposureGuidance(r);if(e.sharpness<this.t.GUIDE_SHARPNESS)return"fcv3.steady_camera";if(e.motion<this.t.GUIDE_MOTION)return"fcv3.hold_still";if(i<this.t.Q_GOOD){let n=[["size",this.sizeGuidance()],["centering","fcv3.center_face"],["pose","fcv3.straighten"],["exposure",this.exposureGuidance(r)],["sharpness","fcv3.steady_camera"],["motion","fcv3.hold_still"]],a=n[0];for(let s of n)e[s[0]]<e[a[0]]&&(a=s);return a[1]}return"fcv3.hold_still"}sizeGuidance(){return this.lastSizeDirection==="far"?"fcv3.come_closer":"fcv3.move_back"}exposureGuidance(e){let r=(T[0]+T[1])/2;return e.meanLuma<r?"fcv3.more_light":"fcv3.too_bright"}};var _e=Object.freeze({LOW:Object.freeze({cadenceHz:5,inputWidth:128,animations:"reduced"}),MID:Object.freeze({cadenceHz:8,inputWidth:160,animations:"full"}),HIGH:Object.freeze({cadenceHz:10,inputWidth:192,animations:"full"})}),ht=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]);function ne(){let t=typeof navigator>"u"?void 0:navigator,e=!1;try{e=typeof WebAssembly<"u"&&WebAssembly.validate(ht)}catch{e=!1}return{cores:t?.hardwareConcurrency??2,memGB:t?.deviceMemory??null,simd:e}}function ie(t){let e=t.memGB??4;return t.cores<4||e<3?"LOW":t.cores>=8&&e>=6?"HIGH":"MID"}var re=["LOW","MID","HIGH"],M=class{constructor(e){this.samples=[];this.adjusted=!1;this.current=e}get deviceClass(){return this.current}get profile(){return _e[this.current]}record(e){if(this.adjusted||this.samples.length>=10)return this.current;if(this.samples.push(e),this.samples.length<10)return this.current;this.adjusted=!0;let r=this.samples.reduce((i,n)=>i+n,0)/this.samples.length;if(r>70)this.current="LOW";else if(r<25){let i=re.indexOf(this.current);this.current=re[Math.min(re.length-1,i+1)]??this.current}return this.current}};var w=class{constructor(e){this.timer=null;this.frameCallbackId=null;this.running=!1;this.busy=!1;this.lastRunAt=Number.NEGATIVE_INFINITY;this.degradeCount=0;this.durations=[];this.options=e,this.periodMs=1e3/e.cadenceHz}start(){if(this.running)return;this.running=!0;let e=this.options.video;if(typeof e?.requestVideoFrameCallback=="function"){let r=()=>{this.running&&(this.frameCallbackId=e.requestVideoFrameCallback?.(()=>{this.frameCallbackId=null,this.now()-this.lastRunAt>=this.periodMs&&this.tick(),r()}))};r();return}this.timer=setInterval(()=>this.tick(),this.periodMs)}stop(){this.running=!1,this.timer!==null&&(clearInterval(this.timer),this.timer=null),this.frameCallbackId!==null&&(this.options.video?.cancelVideoFrameCallback?.(this.frameCallbackId),this.frameCallbackId=null)}stats(){let e=this.durations.length===0?0:this.durations.reduce((r,i)=>r+i,0)/this.durations.length;return{degradeCount:this.degradeCount,meanDetectMs:e}}now(){return this.options.now?.()??performance.now()}tick(){if(!this.running)return;if(this.busy){this.degradeCount+=1;return}this.busy=!0,this.lastRunAt=this.now();let e=this.now();this.options.run().catch(()=>{}).finally(()=>{this.busy=!1,this.durations.push(this.now()-e),this.durations.length>20&&this.durations.shift()})}};var xe="0.1.0-rc.9";var Se="sekyro.did",De;function ke(){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,r=>r.toString(16).padStart(2,"0")).join("")}}catch{}}function ft(){try{let t=localStorage.getItem(Se);if(t)return t;let e=ke();return e!==void 0&&localStorage.setItem(Se,e),e}catch{return De??(De=ke()),De}}async function yt(){let t=globalThis.crypto?.subtle;if(!t)return"";let e=navigator,r=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(r));return Array.from(new Uint8Array(i),n=>n.toString(16).padStart(2,"0")).join("").slice(0,32)}function bt(t){let e=new TextEncoder().encode(t),r="";for(let i of e)r+=String.fromCharCode(i);return btoa(r).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function gt(t){let e,r;return{timezone(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone?.slice(0,64)||void 0}catch{return}},noteCameraLabel(i){i&&(e=i.slice(0,128))},async deviceHeader(){try{r??(r=yt().catch(()=>""));let i=[];navigator.webdriver&&i.push("webdriver"),/HeadlessChrome/.test(navigator.userAgent)&&i.push("headless");let n=await r,a=ft(),s={v:1,platform:"web",sdk:t.sdk.slice(0,64),ids:[...a?[{kind:"web_local",value:a.slice(0,128)}]:[],...n?[{kind:"web_fp",value:n}]:[]],screen:{w:screen.width,h:screen.height,dpr:globalThis.devicePixelRatio??1},...e?{cameraLabel:e}:{},...i.length?{signals:i}:{}};return bt(JSON.stringify(s))}catch{return}}}}var ae=Symbol.for("sekyro.web.clientContext"),se=globalThis,vt=se[ae]??(se[ae]=gt({sdk:`@sekyro/web@${xe}`}));function Te(t){try{let e=t.getVideoTracks?.()[0];e&&vt.noteCameraLabel(e.label)}catch{}}var b=1;function Ce(){return typeof OffscreenCanvas=="function"&&typeof createImageBitmap=="function"&&typeof Worker=="function"}function Et(t,e={}){let r=e.createDetector??E,i=null;t.onmessage=n=>{let a=n.data;if(a.v!==b){a.bitmap?.close?.();return}if(a.type==="init"){r(a.options).then(s=>{i=s;let o={v:b,type:"ready",tier:s.tier,...s.fallbackReason!==void 0?{fallbackReason:s.fallbackReason}:{}};t.postMessage(o)});return}if(a.type==="detect"){let s=o=>{let c={v:b,type:"result",id:a.id,observation:o};t.postMessage(c),a.bitmap.close?.()};if(i===null){s(null);return}i.detect(a.bitmap,a.streamWidth,a.streamHeight).then(s,()=>s(null))}}}typeof self<"u"&&typeof self.importScripts=="function"&&Et(self);var H=class t{constructor(e,r){this.pending=new Map;this.nextId=1;this.worker=e,this.tier=r.tier,r.fallbackReason!==void 0&&(this.fallbackReason=r.fallbackReason),e.addEventListener("message",i=>{let n=i.data;if(n.v!==b||n.type!=="result")return;let a=this.pending.get(n.id);this.pending.delete(n.id),a?.(n.observation)})}static create(e,r,i=1e4){return new Promise((n,a)=>{let s=setTimeout(()=>{e.removeEventListener("message",o),e.terminate(),a(new Error(`worker detector not ready within ${i}ms`))},i),o=d=>{let u=d.data;u.v!==b||u.type!=="ready"||(clearTimeout(s),e.removeEventListener("message",o),n(new t(e,u)))};e.addEventListener("message",o);let c={v:b,type:"init",options:r};e.postMessage(c)})}async detect(e,r,i){let n;try{typeof ImageBitmap<"u"&&e instanceof ImageBitmap?n=e:typeof createImageBitmap=="function"?n=await createImageBitmap(e):n=e}catch{return null}let a=this.nextId;return this.nextId+=1,new Promise(s=>{this.pending.set(a,s);let o={v:b,type:"detect",id:a,bitmap:n,streamWidth:r,streamHeight:i};this.worker.postMessage(o,[n])})}destroy(){for(let e of this.pending.values())e(null);this.pending.clear(),this.worker.terminate()}};var _t=["size","centering","pose","exposure","sharpness","motion"];function Me(t){if(t.accepted)return null;if(t.factors.presence<=0)return"no_face";let e="size";for(let r of _t)t.factors[r]<t.factors[e]&&(e=r);return e}var O=class{constructor(){this.blocked={};this.acceptedMs=0;this.ticks=0;this.lastAt=null}record(e){let r=this.lastAt===null?0:Math.max(0,e.at-this.lastAt);this.lastAt=e.at,this.ticks+=1;let i=Me(e);if(i===null){this.acceptedMs+=r;return}let n=this.blocked[i]??{count:0,ms:0};n.count+=1,n.ms+=r,this.blocked[i]=n}summary(){let e={};for(let[r,i]of Object.entries(this.blocked))e[r]={count:i.count,ms:Math.round(i.ms)};return{blocked:e,acceptedMs:Math.round(this.acceptedMs),ticks:this.ticks}}};var We=1e3,U=4,Ke=600,Ge={sharpness:1,exposure:1,meanLuma:128},ce=class{constructor(e){this.handlers=new Map;this.stateValue="idle";this.attempt=0;this.stream=null;this.detector=null;this.scheduler=null;this.gate=null;this.profiler=null;this.lastGuidanceKey=null;this.positioningStartedAt=0;this.cameraRequestedAt=null;this.cameraReadyAt=null;this.faceAcquiredAt=null;this.captureCompleteAt=null;this.fired=!1;this.carriedDegrade=0;this.carriedMeans=[];this.blockStats=null;this.lastGateSnapshotAt=Number.NEGATIVE_INFINITY;this.snapshotCanvas=null;this.options=e,this.facing=e.facingMode??"user"}get state(){return this.stateValue}on(e,r){let i=this.handlers.get(e);return i||(i=new Set,this.handlers.set(e,i)),i.add(r),()=>i?.delete(r)}emit(e,r){for(let i of[...this.handlers.get(e)??[]])i(r)}async start(e={}){e.facingMode!==void 0&&(this.facing=e.facingMode),this.attempt+=1,await this.run(this.attempt)}get facingMode(){return this.facing}retry(){this.teardownAttempt(),this.start()}switchCamera(){this.facing=this.facing==="user"?"environment":"user",this.teardownAttempt(),this.start()}destroy(){this.attempt+=1,this.teardownAttempt(),this.detector?.destroy(),this.detector=null,this.options.video.srcObject=null}async run(e){let{options:r}=this;this.fired=!1,this.lastGuidanceKey=null,this.carriedDegrade=0,this.carriedMeans=[],this.cameraRequestedAt=null,this.cameraReadyAt=null,this.faceAcquiredAt=null,this.captureCompleteAt=null,this.setState("preflight");let i=Z();if(i!=="OK"){this.fail(i==="INSECURE_CONTEXT"?"insecure":"unsupported");return}this.setState("acquiring");let n=r.getUserMedia??(c=>navigator.mediaDevices.getUserMedia(c)),a;this.cameraRequestedAt=this.now();try{a=await n($(J(),this.facing))}catch(c){if(e!==this.attempt)return;this.fail(Y(c));return}if(Te(a),e!==this.attempt){for(let c of a.getTracks())c.stop();return}if(this.stream=a,r.video.srcObject=a,await r.video.play().catch(()=>{}),e!==this.attempt)return;if(this.cameraReadyAt=this.now(),this.detector===null){let c={...r.v3AssetBaseUrl!==void 0?{v3AssetBaseUrl:r.v3AssetBaseUrl}:{}},d=r.createDetector??(r.createWorker!==void 0&&Ce()?async()=>{try{return await H.create(r.createWorker(),c)}catch{return E(c)}}:()=>E(c)),u;try{u=await d()}catch(l){e===this.attempt&&this.fail("models",l instanceof v?l.fallbackReason:wt(l));return}if(e!==this.attempt){u.destroy();return}this.detector=u,this.options.telemetry?.({type:"detector",tier:u.tier,fallbackReason:u.fallbackReason})}let s=ne(),o=r.deviceClass??ie(s);this.profiler=new M(o),this.options.telemetry?.({type:"profile",staticClass:o,activeClass:this.profiler.deviceClass,simd:s.simd}),this.gate=new C(r.thresholds??{}),this.blockStats=new O,this.lastGateSnapshotAt=this.now(),r.rankKeyframes?.()&&Promise.resolve().then(()=>(Ne(),Fe)).then(c=>oe=c,()=>{}),this.setState("positioning"),this.positioningStartedAt=this.now(),this.startScheduler(e)}get animations(){return this.profiler?.profile.animations??"full"}startScheduler(e){let r=this.profiler;if(r===null)return;if(this.scheduler!==null){let n=this.scheduler.stats();this.carriedDegrade+=n.degradeCount,n.meanDetectMs>0&&this.carriedMeans.push(n.meanDetectMs),this.scheduler.stop()}let i=new w({cadenceHz:r.profile.cadenceHz,video:this.options.video,now:this.options.now,run:()=>this.detectTick(e)});this.scheduler=i,i.start()}async detectTick(e){let{detector:r,gate:i,profiler:n}=this,a=this.options.video;if(e!==this.attempt||r===null||i===null||n===null||this.fired||a.videoWidth===0)return;let s=n.deviceClass,o=this.now(),c=this.options.makeSnapshot?.(a,n.profile.inputWidth)??this.defaultSnapshot(a,n.profile.inputWidth),d=null;try{d=await r.detect(c,a.videoWidth,a.videoHeight)}catch{d=null}if(e!==this.attempt||this.fired)return;n.record(this.now()-o),n.deviceClass!==s&&this.startScheduler(e);let u=d===null?Ge:this.options.measureQuality?.(a,d.box)??this.defaultQuality(a,d.box),l=i.tick({timestampMs:this.now(),observation:d,quality:u,frameWidth:a.videoWidth,frameHeight:a.videoHeight});l.accepted&&this.faceAcquiredAt===null&&(this.faceAcquiredAt=l.at),this.blockStats?.record(l),!l.ready&&l.at-this.lastGateSnapshotAt>=We&&(this.lastGateSnapshotAt=l.at,this.reportGate(!1)),this.emit("checks",{engine:"v3",progress:l.p,q:l.q,factors:l.factors,attempt:e}),l.guidanceKey!==this.lastGuidanceKey&&(this.lastGuidanceKey=l.guidanceKey,this.emit("guidance",{key:l.guidanceKey})),l.ready&&this.stateValue==="positioning"&&(this.fired=!0,this.captureCompleteAt=l.at,this.fire(e))}async fire(e){let{options:r}=this,i=this.scheduler;i?.stop(),this.reportGate(!0);let n=i?.stats()??{degradeCount:0,meanDetectMs:0},a=[...this.carriedMeans,...n.meanDetectMs>0?[n.meanDetectMs]:[]];r.telemetry?.({type:"fired",timeToGateMs:this.now()-this.positioningStartedAt,degradeCount:this.carriedDegrade+n.degradeCount,meanDetectMs:a.length===0?0:a.reduce((h,y)=>h+y,0)/a.length});let s=r.mode??"clip",o=r.rankKeyframes?.()&&oe?oe.default(this,e).catch(()=>this.collectKeyframes(e)):this.collectKeyframes(e);if(s==="photo"){let h=await o;if(e!==this.attempt)return;if(h===null){this.fail("generic");return}this.finishCapture({keyframe:h.blob,previewDataUrl:h.previewDataUrl});return}this.setState("recording");let c=r.createRecorder?.()??new D,d=this.stream;if(d===null){this.fail("generic");return}let u=null;o.then(h=>{u=h},()=>{});let l=()=>{e===this.attempt&&u!==null&&this.emit("frozen",{previewDataUrl:u.previewDataUrl})},m,p;try{[m,p]=await Promise.all([c.record(d,l),o])}catch(h){if(e!==this.attempt)return;let y=h.kind;this.fail(y==="cliptoolarge"?"cliptoolarge":"recorder");return}if(e===this.attempt){if(S(m.blob)){this.fail("cliptoolarge");return}if(p===null){this.fail("generic");return}this.finishCapture({clip:m.blob,clipMimeType:m.mimeType,keyframe:p.blob,previewDataUrl:p.previewDataUrl})}}async collectKeyframes(e){let r=this.options.captureKeyframe??(a=>this.defaultKeyframe(a)),i=Ke/(U-1),n=null;for(let a=0;a<U;a+=1){if(e!==this.attempt)return n;try{let s=await r(this.options.video);(n===null||s.sharpness>n.sharpness)&&(n=s)}catch{}a<U-1&&await Mt(i)}return n}finishCapture(e){this.stopTracks(),this.setState("captured");let r=this.captureTiming();this.emit("artifacts",r===void 0?e:{...e,timing:r})}captureTiming(){let e=(s,o)=>s!==null&&o!==null?Math.max(0,Math.round(o-s)):void 0,r=e(this.cameraRequestedAt,this.cameraReadyAt),i=e(this.cameraReadyAt,this.faceAcquiredAt),n=e(this.faceAcquiredAt,this.captureCompleteAt),a={...r!==void 0?{cameraReadyMs:r}:{},...i!==void 0?{faceAcquireMs:i}:{},...n!==void 0?{captureMs:n}:{}};return Object.keys(a).length>0?a:void 0}async defaultKeyframe(e){let r=document.createElement("canvas"),i=await Q(e,r),n=r.toDataURL("image/jpeg",.92);return{blob:i,previewDataUrl:n,sharpness:this.centerSharpness(e)}}defaultSnapshot(e,r){try{let i=this.snapshotCanvas??document.createElement("canvas"),n=r/Math.max(1,e.videoWidth),a=Math.max(1,Math.round(e.videoWidth*n)),s=Math.max(1,Math.round(e.videoHeight*n)),o=i.getContext("2d");return o===null?e:(i.width!==a&&(i.width=a),i.height!==s&&(i.height=s),o.drawImage(e,0,0,a,s),this.snapshotCanvas=i,i)}catch{return e}}defaultQuality(e,r){let i=Ve(e,r,96);return i===null?Ge:{sharpness:K(i),exposure:te(i),meanLuma:W(i)}}centerSharpness(e){let r=g(e),i=Ve(e,{x:r.width*.25,y:r.height*.25,width:r.width*.5,height:r.height*.5},96);return i===null?0:K(i)}teardownAttempt(){this.scheduler?.stop(),this.scheduler=null,this.reportGate(!0),this.gate=null,this.stopTracks()}reportGate(e){let r=this.blockStats,i=this.profiler;if(r===null||i===null)return;let n=r.summary();e&&(this.blockStats=null),n.ticks!==0&&this.options.telemetry?.({type:"gate",final:e,activeClass:i.deviceClass,cadenceHz:i.profile.cadenceHz,...n})}stopTracks(){if(this.stream!==null){for(let e of this.stream.getTracks())e.stop();this.stream=null}}fail(e,r){this.scheduler?.stop(),this.reportGate(!0),this.stopTracks(),this.setState("error"),this.options.telemetry?.({type:"error",kind:e,fallbackReason:r}),this.emit("error",{kind:e,retryable:e!=="insecure"&&e!=="unsupported"})}setState(e){this.stateValue=e,this.emit("statechange",{state:e})}now(){return this.options.now?.()??performance.now()}},oe;function Mt(t){return new Promise(e=>setTimeout(e,t))}function wt(t){return t instanceof Error?t.message:String(t)}function Ve(t,e,r){try{let i=document.createElement("canvas"),n=r/Math.max(1,e.width);i.width=Math.max(1,Math.round(e.width*n)),i.height=Math.max(1,Math.round(e.height*n));let a=i.getContext("2d");return a===null?null:(a.drawImage(t,e.x,e.y,e.width,e.height,0,0,i.width,i.height),a.getImageData(0,0,i.width,i.height))}catch{return null}}0&&(module.exports={CENTERED_FACTOR,CIRCLE_RADIUS_FACTOR,CLIP_MS,CaptureSessionV3,ClipError,ClipRecorder,DEFAULT_CLIP_MIME,DEFAULT_TIER_ORDER,DEFAULT_V3_ASSET_BASE_URL,DEVICE_PROFILES,DetectScheduler,DetectorLadderError,DeviceProfiler,EXPOSURE_BAND,FaceGateV3,GATE_SNAPSHOT_MS,GateBlockStats,IN_CIRCLE_FACTOR,KEYFRAME_CANDIDATES,KEYFRAME_WINDOW_MS,MAX_CLIP_BYTES,MIME_CANDIDATES,SHARP_REF,STOP_GRACE_MS,TIMESLICE_MS,V3_GATE_DEFAULTS,VIDEO_BPS,blockReasonOf,buildCaptureConstraints,buildLivenessV2FormData,cameraPreflight,captureMirroredKeyframe,classifyDevice,createDetector,detectIsMobile,errorCopy,exposure,extForMime,intrinsicSize,isClipTooLarge,isMediaRecorderSupported,mapGetUserMediaError,meanLuma,pickMimeType,probeDevice,sharpness,toStreamPixels,uiCopy});
|
package/dist/core/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,b as r,c as o,d as n,e as a,f as v,g as y,h as g,i as x,j as k,k as z,l as C,m as S,n as V,o as j,p as q,q as w,r as D,s as G,t as I,u as J}from"../chunk-
|
|
1
|
+
import{a as e,b as r,c as o,d as n,e as a,f as v,g as y,h as g,i as x,j as k,k as z,l as C,m as S,n as V,o as j,p as q,q as w,r as D,s as G,t as I,u as J}from"../chunk-EVVGQSNJ.js";import{a as A,b as H,c as K,d as P}from"../chunk-POIQGEZM.js";import{a as s,b as t,c as i,d as c,e as p,f as u,g as f,h as m,i as d,j as l}from"../chunk-FHJ7HO3M.js";import{a as B,b as F,c as N,d as O,e as U}from"../chunk-FPXL63KZ.js";import"../chunk-LUHNRNTO.js";import{a as L,b as T,c as E,d as R,e as h,f as b}from"../chunk-OKWG3PVH.js";var M={permission:{key:"fcv2.err.permission",fr:"Autorisez la cam\xE9ra dans les r\xE9glages du navigateur (ic\xF4ne cam\xE9ra dans la barre d\u2019adresse), puis r\xE9essayez."},notfound:{key:"fcv2.err.notfound",fr:"Aucune cam\xE9ra d\xE9tect\xE9e. Branchez ou activez une cam\xE9ra, puis r\xE9essayez."},inuse:{key:"fcv2.err.inuse",fr:"La cam\xE9ra est utilis\xE9e par une autre application. Fermez-la puis r\xE9essayez."},overconstrained:{key:"fcv2.err.overconstrained",fr:"La cam\xE9ra ne prend pas en charge les r\xE9glages demand\xE9s. Nouvel essai en cours\u2026"},insecure:{key:"fcv2.err.insecure",fr:"La cam\xE9ra n\xE9cessite une connexion s\xE9curis\xE9e (HTTPS). Ouvrez la page en HTTPS."},unsupported:{key:"fcv2.err.unsupported",fr:"Votre navigateur ne prend pas en charge l\u2019enregistrement vid\xE9o. Utilisez un navigateur r\xE9cent."},generic:{key:"fcv2.err.generic",fr:"Cam\xE9ra indisponible. R\xE9essayez ou contactez le support."}},Q={recording:{key:"fcv2.recording",fr:"Enregistrement en cours\u2026"},uploading:{key:"fcv2.uploading",fr:"Envoi en cours\u2026"},clipTooLarge:{key:"fcv2.err.cliptoolarge",fr:"La vid\xE9o est trop volumineuse. R\xE9essayez dans un endroit mieux \xE9clair\xE9."},retry:{key:"fcv2.retry",fr:"R\xE9essayer"},listen:{key:"fcv2.listen",fr:"\xC9couter"}};export{a as CENTERED_FACTOR,o as CIRCLE_RADIUS_FACTOR,v as CLIP_MS,J as CaptureSessionV3,k as ClipError,z as ClipRecorder,i as DEFAULT_CLIP_MIME,T as DEFAULT_TIER_ORDER,L as DEFAULT_V3_ASSET_BASE_URL,A as DEVICE_PROFILES,S as DetectScheduler,E as DetectorLadderError,P as DeviceProfiler,F as EXPOSURE_BAND,j as FaceGateV3,D as GATE_SNAPSHOT_MS,w as GateBlockStats,n as IN_CIRCLE_FACTOR,G as KEYFRAME_CANDIDATES,I as KEYFRAME_WINDOW_MS,f as MAX_CLIP_BYTES,s as MIME_CANDIDATES,B as SHARP_REF,g as STOP_GRACE_MS,y as TIMESLICE_MS,V as V3_GATE_DEFAULTS,x as VIDEO_BPS,q as blockReasonOf,e as buildCaptureConstraints,l as buildLivenessV2FormData,p as cameraPreflight,C as captureMirroredKeyframe,K as classifyDevice,b as createDetector,r as detectIsMobile,M as errorCopy,U as exposure,d as extForMime,R as intrinsicSize,m as isClipTooLarge,u as isMediaRecorderSupported,c as mapGetUserMediaError,N as meanLuma,t as pickMimeType,H as probeDevice,O as sharpness,h as toStreamPixels,Q as uiCopy};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{u as a,v as b,w as c,x as d}from"./chunk-56GT33O3.js";import"./chunk-G6LKLN4U.js";import"./chunk-TDLIXFDT.js";import"./chunk-WRKUWIJW.js";import"./chunk-7V2M6Y2W.js";import"./chunk-EVVGQSNJ.js";import"./chunk-POIQGEZM.js";import"./chunk-FHJ7HO3M.js";import"./chunk-FPXL63KZ.js";import"./chunk-LUHNRNTO.js";import"./chunk-OKWG3PVH.js";import"./chunk-DK5YPBDQ.js";export{a as SAME_FACE_MAX_DROPS,c as createDocumentCapture,d as createDocumentCaptureInternal,b as warmDocumentCapture};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { b as Detector } from './detect-worker-DclNxkZT.cjs';
|
|
2
2
|
import { i as CaptureState$1, f as CaptureSessionV3Events, g as CaptureSessionV3Options, c as CaptureErrorKind$1, p as DeviceClass, b as CaptureArtifacts, H as V3GateQuality, N as V3TelemetryEvent } from './capture-session-v3-Dvob-uH2.cjs';
|
|
3
|
-
import { A as AcceptedDocumentType,
|
|
3
|
+
import { A as AcceptedDocumentType, Y as NationalEidOption, ae as StepSection, i as HostedBranding, a5 as PlanSectionView, a2 as PlanChoiceKind, c as ContactChannel, C as CheckReason, S as IdentityMethod, E as EidAfterPass, T as IdentitySummarySource, r as HostedIcaoPolicy, Q as IcaoReportEntry, J as IcaoCaptureTuning, z as HostedSessionView, B as HostedStepView, a6 as PlanStepView, O as IcaoGateSummary, P as IcaoGateUpdate, ab as SessionFailureReason, X as MethodChoiceView, I as HostedVoiceView, aw as Point, aS as PersonMask, ag as Box, ao as IcaoFrameObservation, aT as HostedClient, aU as AttestationInput, b as CheckType, a9 as PortraitIcaoInput, ap as IcaoGate } from './icao-gate-DKbWXP51.cjs';
|
|
4
4
|
|
|
5
5
|
declare const ISSUER_CODES: readonly string[];
|
|
6
6
|
|
|
@@ -28,6 +28,23 @@ declare const WEB_IDENTITY_METHODS: readonly IdentityMethod[];
|
|
|
28
28
|
declare const PLATFORM_UNSUPPORTED = "platform_unsupported";
|
|
29
29
|
/** A step's section: the view's value (kept even when unknown), else the check type's. */
|
|
30
30
|
declare function sectionOf(step: Pick<HostedStepView, "checkType" | "section">): StepSection | null;
|
|
31
|
+
declare function sectionOf(step: Pick<PlanStepView, "checkType" | "section">): StepSection | null;
|
|
32
|
+
/**
|
|
33
|
+
* The in-lane switch of a step screen (C4 client rule §5 item 6): the session's choice is still open (present,
|
|
34
|
+
* unlocked) while a step of one of its lanes is current. `options` are the choice's options this SDK renders, in
|
|
35
|
+
* the server's order; `current` is the lane taken. With exactly one other option a screen offers a direct switch
|
|
36
|
+
* labelled by it; with two or more, « Use another option » re-opens the choice locally.
|
|
37
|
+
*/
|
|
38
|
+
interface InLaneSwitch {
|
|
39
|
+
nodeId: string;
|
|
40
|
+
kind: PlanChoiceKind;
|
|
41
|
+
current: string | null;
|
|
42
|
+
options: ChoiceOptionSnapshot[];
|
|
43
|
+
}
|
|
44
|
+
/** The open choice of the view as an in-lane switch, `null` without one (locked, absent, or the choice itself current). */
|
|
45
|
+
declare function laneOf(view: HostedSessionView): InLaneSwitch | null;
|
|
46
|
+
/** The other options of an in-lane switch. */
|
|
47
|
+
declare function otherOptions(lane: InLaneSwitch | null | undefined): ChoiceOptionSnapshot[];
|
|
31
48
|
type DocumentSide = "recto" | "verso" | "single";
|
|
32
49
|
interface DeriveStepEnv {
|
|
33
50
|
/** A phone / tablet browser; `false` routes a `requiresMobile` biometric step to `mobile_required`. */
|
|
@@ -41,10 +58,14 @@ interface StepContext {
|
|
|
41
58
|
expiresAt: string;
|
|
42
59
|
branding?: HostedBranding;
|
|
43
60
|
/**
|
|
44
|
-
* The sections of this session in flow order (
|
|
45
|
-
* progress segment each
|
|
61
|
+
* The sections of this session in flow order (`plan.sections`), one
|
|
62
|
+
* progress segment each: the sections still possible on any remaining path.
|
|
46
63
|
*/
|
|
47
64
|
sections: StepSection[];
|
|
65
|
+
/** `plan.sections` with their states (`done | current | upcoming`): draw the progress from these. */
|
|
66
|
+
progress: PlanSectionView[];
|
|
67
|
+
/** The step's in-lane switch (C4 client rule §5 item 6); absent without an open choice. */
|
|
68
|
+
switchable?: InLaneSwitch;
|
|
48
69
|
}
|
|
49
70
|
interface StepAttempts {
|
|
50
71
|
reason?: CheckReason;
|
|
@@ -113,6 +134,34 @@ interface EmailOtpSnapshot extends StepAttempts {
|
|
|
113
134
|
* Step 1 contact choice (flow model 2026-10-23): a `one_of` session before the
|
|
114
135
|
* person chose phone or email.
|
|
115
136
|
*/
|
|
137
|
+
/** One option of a choice screen (server order; only services this SDK renders). */
|
|
138
|
+
interface ChoiceOptionSnapshot {
|
|
139
|
+
/** The option id {@link ChoiceStepHandle.choose} sends. */
|
|
140
|
+
id: string;
|
|
141
|
+
/** The lane's service: label it (`document`, `population_registry`, `national_eid`, `phone_otp`, `email_otp`). */
|
|
142
|
+
service: string;
|
|
143
|
+
/** `national_eid`: the provider ("Verify with Houwiyeti"); absent = the generic eID copy. */
|
|
144
|
+
nationalEid?: NationalEidOption;
|
|
145
|
+
}
|
|
146
|
+
/** `plan.choice` as a choice screen shows it. */
|
|
147
|
+
interface PlanChoiceSnapshot {
|
|
148
|
+
nodeId: string;
|
|
149
|
+
/** `identity_method` (method.* copy), `contact` (contact.* copy) or `generic` (choice.* copy). */
|
|
150
|
+
kind: PlanChoiceKind;
|
|
151
|
+
selected: string | null;
|
|
152
|
+
options: ChoiceOptionSnapshot[];
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* A choice screen of another kind (Sekyro flows `generic`): the person picks
|
|
156
|
+
* one option; its `kind` decides the copy (`choice.*`).
|
|
157
|
+
*/
|
|
158
|
+
interface ChoiceSnapshot {
|
|
159
|
+
section: StepSection | null;
|
|
160
|
+
kind: "choice";
|
|
161
|
+
key: string;
|
|
162
|
+
context: StepContext;
|
|
163
|
+
choice: PlanChoiceSnapshot;
|
|
164
|
+
}
|
|
116
165
|
interface ContactChoiceSnapshot {
|
|
117
166
|
/**
|
|
118
167
|
* Flow model 2026-10-23: the section of the flow (`contact`, `identity`,
|
|
@@ -126,6 +175,8 @@ interface ContactChoiceSnapshot {
|
|
|
126
175
|
options: ContactChannel[];
|
|
127
176
|
selected: ContactChannel | null;
|
|
128
177
|
locked: boolean;
|
|
178
|
+
/** The choice behind this screen (`plan.choice`, kind `contact`). */
|
|
179
|
+
choice: PlanChoiceSnapshot;
|
|
129
180
|
}
|
|
130
181
|
/**
|
|
131
182
|
* Step 2b summary and confirm (flow model 2026-10-23): the identity data read so
|
|
@@ -173,6 +224,8 @@ interface MethodSnapshot {
|
|
|
173
224
|
options: IdentityMethod[];
|
|
174
225
|
/** The provider behind `national_eid` ("Verify with Houwiyeti"); absent when it is not offered. */
|
|
175
226
|
nationalEid?: NationalEidOption;
|
|
227
|
+
/** The choice behind this screen (`plan.choice`, kind `identity_method`). */
|
|
228
|
+
choice: PlanChoiceSnapshot;
|
|
176
229
|
}
|
|
177
230
|
/**
|
|
178
231
|
* The national eID sign-in (SDK spec §3.2; Houwiyeti in MR). Two phases:
|
|
@@ -364,15 +417,15 @@ interface ResultSnapshot {
|
|
|
364
417
|
failureReason?: string;
|
|
365
418
|
retryAfter?: string;
|
|
366
419
|
}
|
|
367
|
-
type StepSnapshot = PhoneOtpSnapshot | EmailOtpSnapshot | ContactChoiceSnapshot | IdentitySummarySnapshot | MethodSnapshot | EidSnapshot | RegistrySnapshot | DocumentSnapshot | LivenessSnapshot | PortraitSnapshot | MobileRequiredSnapshot | ProcessingSnapshot | UnsupportedSnapshot | ResultSnapshot;
|
|
420
|
+
type StepSnapshot = PhoneOtpSnapshot | EmailOtpSnapshot | ContactChoiceSnapshot | IdentitySummarySnapshot | MethodSnapshot | ChoiceSnapshot | EidSnapshot | RegistrySnapshot | DocumentSnapshot | LivenessSnapshot | PortraitSnapshot | MobileRequiredSnapshot | ProcessingSnapshot | UnsupportedSnapshot | ResultSnapshot;
|
|
368
421
|
/**
|
|
369
422
|
* ID mode: `face_match` is due right after an ACCEPTED portrait (passed, or
|
|
370
423
|
* review after the cap) that it has not been tried with yet — the portrait is
|
|
371
424
|
* the probe (the server picks it), so no selfie is taken. A face_match that
|
|
372
425
|
* already carries a reason was tried: the regular selfie path applies.
|
|
373
426
|
*/
|
|
374
|
-
declare function portraitMatchStep(view: HostedSessionView, frontier:
|
|
375
|
-
/** The step the view asks for right now. */
|
|
427
|
+
declare function portraitMatchStep(view: HostedSessionView, frontier: PlanStepView): PlanStepView | null;
|
|
428
|
+
/** The step the view asks for right now (the C4 client rule, Sekyro flows §8.3). */
|
|
376
429
|
declare function deriveStep(view: HostedSessionView, env?: DeriveStepEnv): StepSnapshot;
|
|
377
430
|
|
|
378
431
|
type DocumentCaptureState = "idle" | "starting" | "scanning" | "captured" | "uploading" | "checking" | "done" | "error";
|
|
@@ -858,9 +911,10 @@ interface Verification {
|
|
|
858
911
|
*/
|
|
859
912
|
methodChoice(): Promise<MethodChoiceView | null>;
|
|
860
913
|
/**
|
|
861
|
-
* Send the person's identity method
|
|
862
|
-
*
|
|
863
|
-
* 409 `
|
|
914
|
+
* Send the person's identity method: the identity choice's option of that
|
|
915
|
+
* method (`POST /hosted/choice`), then continue from the returned view.
|
|
916
|
+
* Rejects with the typed `HostedApiError` (e.g. 409 `choice_locked`), or a
|
|
917
|
+
* `RangeError` when the session offers no such option.
|
|
864
918
|
*/
|
|
865
919
|
selectMethod(method: IdentityMethod): Promise<void>;
|
|
866
920
|
/**
|
|
@@ -908,6 +962,8 @@ interface Verification {
|
|
|
908
962
|
}
|
|
909
963
|
/** Phone OTP (profile v2 §4.1): send, then verify the 6-digit code. */
|
|
910
964
|
interface PhoneOtpStepHandle extends PhoneOtpSnapshot {
|
|
965
|
+
/** Switch to another option of the open choice (`context.switchable`; `POST /hosted/choice`). Present only with it. */
|
|
966
|
+
chooseOption?(option: string): Promise<void>;
|
|
911
967
|
/** ISO time from which a resend is allowed (the server's cooldown, else 30 s after this page's last send). */
|
|
912
968
|
resendAvailableAt?: string;
|
|
913
969
|
/**
|
|
@@ -928,6 +984,8 @@ interface PhoneOtpStepHandle extends PhoneOtpSnapshot {
|
|
|
928
984
|
}
|
|
929
985
|
/** Email OTP (profile v2 §4.6.5): send a code to the address, then verify it. */
|
|
930
986
|
interface EmailOtpStepHandle extends EmailOtpSnapshot {
|
|
987
|
+
/** Switch to another option of the open choice (`context.switchable`; `POST /hosted/choice`). Present only with it. */
|
|
988
|
+
chooseOption?(option: string): Promise<void>;
|
|
931
989
|
/** Send or resend. `email` is required when `needsEmail` (checked locally: `OtpInputError("email", "format")`); a resend reuses the last one. */
|
|
932
990
|
send(input?: {
|
|
933
991
|
email?: string;
|
|
@@ -941,12 +999,16 @@ interface EmailOtpStepHandle extends EmailOtpSnapshot {
|
|
|
941
999
|
interface ContactChoiceStepHandle extends ContactChoiceSnapshot {
|
|
942
1000
|
/** Rejects with `RangeError` for a channel not in `options`. */
|
|
943
1001
|
select(channel: ContactChannel): Promise<void>;
|
|
1002
|
+
/** Pick by option id (`choice.options[].id`). */
|
|
1003
|
+
choose(option: string): Promise<void>;
|
|
944
1004
|
}
|
|
945
1005
|
/**
|
|
946
1006
|
* Step 2b summary and confirm (flow model 2026-10-23). PII: show the values,
|
|
947
1007
|
* never log them or pass them to analytics.
|
|
948
1008
|
*/
|
|
949
1009
|
interface IdentitySummaryStepHandle extends IdentitySummarySnapshot {
|
|
1010
|
+
/** Switch to another option of the open choice (`context.switchable`; `POST /hosted/choice`). Present only with it. */
|
|
1011
|
+
chooseOption?(option: string): Promise<void>;
|
|
950
1012
|
/**
|
|
951
1013
|
* The portrait on record as a JPEG `Blob` (fetched with the session token;
|
|
952
1014
|
* show it with `URL.createObjectURL` and revoke it when done). `null` when
|
|
@@ -962,12 +1024,23 @@ interface IdentitySummaryStepHandle extends IdentitySummarySnapshot {
|
|
|
962
1024
|
interface MethodStepHandle extends MethodSnapshot {
|
|
963
1025
|
/** Rejects with `RangeError` for a method not in `options`. */
|
|
964
1026
|
select(method: IdentityMethod): Promise<void>;
|
|
1027
|
+
/** Pick by option id (`choice.options[].id`): the same answer as {@link MethodStepHandle.select}. */
|
|
1028
|
+
choose(option: string): Promise<void>;
|
|
965
1029
|
}
|
|
966
1030
|
/**
|
|
967
1031
|
* The national eID sign-in (SDK spec §3.2; Houwiyeti in MR). Every action
|
|
968
1032
|
* submits `eid_auth` and re-reads the view; a passed eID ends the session.
|
|
969
1033
|
*/
|
|
1034
|
+
/**
|
|
1035
|
+
* A choice of another kind (Sekyro flows `generic`, copy `choice.*`): pick one
|
|
1036
|
+
* of `choice.options` (`POST /hosted/choice`); the next step follows.
|
|
1037
|
+
*/
|
|
1038
|
+
interface ChoiceStepHandle extends ChoiceSnapshot {
|
|
1039
|
+
choose(option: string): Promise<void>;
|
|
1040
|
+
}
|
|
970
1041
|
interface EidStepHandle extends EidSnapshot {
|
|
1042
|
+
/** Switch to another option of the open choice (`context.switchable`; `POST /hosted/choice`). Present only with it. */
|
|
1043
|
+
chooseOption?(option: string): Promise<void>;
|
|
971
1044
|
/**
|
|
972
1045
|
* `identifier` phase: ask the provider for a code. `identifier` (the NNI in
|
|
973
1046
|
* MR, checked locally: 10 digits and the check digit — else
|
|
@@ -984,6 +1057,8 @@ interface EidStepHandle extends EidSnapshot {
|
|
|
984
1057
|
}
|
|
985
1058
|
/** The registry step (SDK spec §5.5). */
|
|
986
1059
|
interface RegistryStepHandle extends RegistrySnapshot {
|
|
1060
|
+
/** Switch to another option of the open choice (`context.switchable`; `POST /hosted/choice`). Present only with it. */
|
|
1061
|
+
chooseOption?(option: string): Promise<void>;
|
|
987
1062
|
/** Typed source only: checks the NNI locally (format, mod-97) before submitting. */
|
|
988
1063
|
submitNni(nni: string): Promise<void>;
|
|
989
1064
|
/** Bound or document source: submit with an empty input (the server holds the NNI). */
|
|
@@ -993,6 +1068,8 @@ interface RegistryStepHandle extends RegistrySnapshot {
|
|
|
993
1068
|
}
|
|
994
1069
|
/** The document step — any issuing country (profile v2 §5.3a). */
|
|
995
1070
|
interface DocumentStepHandle extends DocumentSnapshot {
|
|
1071
|
+
/** Switch to another option of the open choice (`context.switchable`; `POST /hosted/choice`). Present only with it. */
|
|
1072
|
+
chooseOption?(option: string): Promise<void>;
|
|
996
1073
|
/** The picked issuer (`null` until picked; a verso keeps the recto's pick). */
|
|
997
1074
|
issuer: string | null;
|
|
998
1075
|
/** The picked type (`null` until picked). */
|
|
@@ -1016,6 +1093,8 @@ interface DocumentStepHandle extends DocumentSnapshot {
|
|
|
1016
1093
|
}
|
|
1017
1094
|
/** The liveness / selfie step. */
|
|
1018
1095
|
interface LivenessStepHandle extends LivenessSnapshot {
|
|
1096
|
+
/** Switch to another option of the open choice (`context.switchable`; `POST /hosted/choice`). Present only with it. */
|
|
1097
|
+
chooseOption?(option: string): Promise<void>;
|
|
1019
1098
|
/** Same as {@link Verification.liveness}: the SDK uploads + submits on `captured`. */
|
|
1020
1099
|
capture(options: LivenessCaptureOptions): LivenessCaptureHandle;
|
|
1021
1100
|
/**
|
|
@@ -1034,6 +1113,8 @@ interface LivePhotoGateUpdate {
|
|
|
1034
1113
|
}
|
|
1035
1114
|
/** The ICAO portrait step (SDK spec §4.9, §5.4; ID-document sessions). */
|
|
1036
1115
|
interface PortraitStepHandle extends PortraitSnapshot {
|
|
1116
|
+
/** Switch to another option of the open choice (`context.switchable`; `POST /hosted/choice`). Present only with it. */
|
|
1117
|
+
chooseOption?(option: string): Promise<void>;
|
|
1037
1118
|
/**
|
|
1038
1119
|
* The last submission failed on the network (nothing was decided): in the
|
|
1039
1120
|
* `capture` phase offer a new take (`retry()` on the capture handle), in the
|
|
@@ -1057,11 +1138,15 @@ interface PortraitStepHandle extends PortraitSnapshot {
|
|
|
1057
1138
|
}
|
|
1058
1139
|
/** The biometric step needs a phone (desktop browser). */
|
|
1059
1140
|
interface MobileRequiredStepHandle extends MobileRequiredSnapshot {
|
|
1141
|
+
/** Switch to another option of the open choice (`context.switchable`; `POST /hosted/choice`). Present only with it. */
|
|
1142
|
+
chooseOption?(option: string): Promise<void>;
|
|
1060
1143
|
/** Re-read the session (e.g. after the person finished on their phone). */
|
|
1061
1144
|
refresh(): Promise<void>;
|
|
1062
1145
|
}
|
|
1063
1146
|
/** The server is still deciding. */
|
|
1064
1147
|
interface ProcessingStepHandle extends ProcessingSnapshot {
|
|
1148
|
+
/** Switch to another option of the open choice (`context.switchable`; `POST /hosted/choice`). Present only with it. */
|
|
1149
|
+
chooseOption?(option: string): Promise<void>;
|
|
1065
1150
|
/** Re-read the session now (also after `stalled`). */
|
|
1066
1151
|
refresh(): Promise<void>;
|
|
1067
1152
|
}
|
|
@@ -1070,7 +1155,7 @@ type UnsupportedStepHandle = UnsupportedSnapshot;
|
|
|
1070
1155
|
/** The session's outcome — display only (the SDK never decides it). */
|
|
1071
1156
|
type ResultStepHandle = ResultSnapshot;
|
|
1072
1157
|
/** What `on('step')` delivers: the step's data plus its actions. */
|
|
1073
|
-
type VerificationStep = PhoneOtpStepHandle | EmailOtpStepHandle | ContactChoiceStepHandle | IdentitySummaryStepHandle | MethodStepHandle | EidStepHandle | RegistryStepHandle | DocumentStepHandle | LivenessStepHandle | PortraitStepHandle | MobileRequiredStepHandle | ProcessingStepHandle | UnsupportedStepHandle | ResultStepHandle;
|
|
1158
|
+
type VerificationStep = PhoneOtpStepHandle | EmailOtpStepHandle | ContactChoiceStepHandle | IdentitySummaryStepHandle | MethodStepHandle | ChoiceStepHandle | EidStepHandle | RegistryStepHandle | DocumentStepHandle | LivenessStepHandle | PortraitStepHandle | MobileRequiredStepHandle | ProcessingStepHandle | UnsupportedStepHandle | ResultStepHandle;
|
|
1074
1159
|
|
|
1075
1160
|
/** The engine surface the handle binds — CaptureSessionV3 or a test double. */
|
|
1076
1161
|
interface CaptureEngine {
|
|
@@ -2569,7 +2654,7 @@ declare function createPortraitCaptureInternal(options: PortraitCaptureOptions,
|
|
|
2569
2654
|
* live-camera capture proof methods are optional (a fake / an older bridge
|
|
2570
2655
|
* without them presigns without a proof).
|
|
2571
2656
|
*/
|
|
2572
|
-
type HostedClientLike = Pick<HostedClient, "getSession" | "recordConsent" | "
|
|
2657
|
+
type HostedClientLike = Pick<HostedClient, "getSession" | "recordConsent" | "choose" | "presign" | "uploadToSpaces" | "completeMedia" | "submitCheck"> & Partial<Pick<HostedClient, "presignCapture" | "armCapture">> & Partial<Pick<HostedClient, "confirmIdentity" | "identityPortrait">>;
|
|
2573
2658
|
/** The presign policy allowlist for `kind: 'clip'` (media.policy.ts mirror). */
|
|
2574
2659
|
declare const CLIP_MIME_ALLOWLIST: readonly string[];
|
|
2575
2660
|
/** Same-key transport replays AFTER the first try, and the pause between them. */
|
|
@@ -2589,7 +2674,7 @@ declare class AttestationError extends Error {
|
|
|
2589
2674
|
constructor(message: string);
|
|
2590
2675
|
}
|
|
2591
2676
|
/** One logical submission: receives the client and ITS idempotency key. */
|
|
2592
|
-
type SubmitExecutor = (client: HostedClientLike, idempotencyKey: string) => Promise<
|
|
2677
|
+
type SubmitExecutor = (client: HostedClientLike, idempotencyKey: string) => Promise<HostedSessionView>;
|
|
2593
2678
|
interface SubmitRuntime {
|
|
2594
2679
|
client: HostedClientLike;
|
|
2595
2680
|
/** Force-record consent (the server just said it is missing). */
|
|
@@ -2619,7 +2704,7 @@ interface SubmitRuntime {
|
|
|
2619
2704
|
*/
|
|
2620
2705
|
declare function runSubmission(rt: SubmitRuntime, executor: SubmitExecutor, hooks?: {
|
|
2621
2706
|
onAttestationInvalid?: () => void;
|
|
2622
|
-
}): Promise<
|
|
2707
|
+
}): Promise<HostedSessionView>;
|
|
2623
2708
|
interface LivenessFlowDeps extends SubmitRuntime {
|
|
2624
2709
|
artifacts: CapturedArtifacts;
|
|
2625
2710
|
/** Fresh attestation per call (Turnstile execute, or `{sandbox: true}`). */
|
|
@@ -2628,8 +2713,8 @@ interface LivenessFlowDeps extends SubmitRuntime {
|
|
|
2628
2713
|
getView(): HostedSessionView;
|
|
2629
2714
|
/** Re-GET the view from the server (after a RESYNC code) and fold it in. */
|
|
2630
2715
|
refreshView(): Promise<HostedSessionView>;
|
|
2631
|
-
/** Fold a submit response into the view. */
|
|
2632
|
-
applySubmit(view:
|
|
2716
|
+
/** Fold a submit response into the view (re-reading it when the response says nothing about the next step). */
|
|
2717
|
+
applySubmit(view: HostedSessionView, submitted: CheckType): void | Promise<void>;
|
|
2633
2718
|
/** Flow-state hook for the capture handle. */
|
|
2634
2719
|
onPhase(phase: "uploading" | "checking"): void;
|
|
2635
2720
|
/** The verification was destroyed (the only thing that cancels a chain). */
|
|
@@ -2784,4 +2869,4 @@ declare function createVerification(options: VerificationOptions): Verification;
|
|
|
2784
2869
|
/** {@link createVerification} with construction seams (tests / Sekyro AI-internal hosts). */
|
|
2785
2870
|
declare function createVerificationInternal(options: VerificationOptions, internals: VerificationInternals): Verification;
|
|
2786
2871
|
|
|
2787
|
-
export { type
|
|
2872
|
+
export { type LivenessCaptureEvents as $, type AcceptedDocumentsLike as A, type DocumentMrzUpdate as B, type CameraFacing as C, type DocumentCaptureOptions as D, type DocumentPoint as E, type DocumentQuad as F, type DocumentReticle as G, type DocumentScanPhase as H, type DocumentScanUpdate as I, type DocumentSide as J, type DocumentSnapshot as K, type DocumentStepHandle as L, type EidSnapshot as M, type EidStepHandle as N, type EmailOtpSnapshot as O, type PortraitCaptureOptions as P, type EmailOtpStepHandle as Q, type EmailSource as R, type GateHint as S, type GateUpdate as T, ISSUER_CODES as U, type IdentitySummarySnapshot as V, type IdentitySummaryStepHandle as W, type InLaneSwitch as X, type LivePhotoGateUpdate as Y, type LivePhotoPlan as Z, type LivenessAssetsStatus as _, type DocumentCaptureHandle as a, type OcrEngineClient as a$, type LivenessCaptureHandle as a0, type LivenessCaptureOptions as a1, type LivenessSnapshot as a2, type LivenessStartOptions as a3, type LivenessStepHandle as a4, type MethodSnapshot as a5, type MethodStepHandle as a6, type MobileRequiredSnapshot as a7, type MobileRequiredStepHandle as a8, type OtpChannel as a9, type UnsupportedStepHandle as aA, type Verification as aB, type VerificationBusy as aC, type VerificationEvents as aD, type VerificationLocale as aE, type VerificationOptions as aF, type VerificationResult as aG, type VerificationStatus as aH, type VerificationStep as aI, WEB_IDENTITY_METHODS as aJ, acceptedIssuers as aK, acceptedTypesFor as aL, createLivenessCapture as aM, createVerification as aN, deriveStep as aO, flagOf as aP, getLivenessAssetsStatus as aQ, laneOf as aR, otherOptions as aS, preloadLivenessAssets as aT, releaseLivenessAssets as aU, resolveAcceptedDocuments as aV, sectionOf as aW, subscribeLivenessAssets as aX, type DocCatalogEntry as aY, type LiveMrzTuning as aZ, type TextLockTuning as a_, type OtpNumberSource as aa, PLATFORM_UNSUPPORTED as ab, type PhoneOtpSnapshot as ac, type PhoneOtpStepHandle as ad, type PlanChoiceSnapshot as ae, type PortraitCaptureEvents as af, type PortraitCaptureState as ag, type PortraitGateUpdate as ah, type PortraitSnapshot as ai, type PortraitStepHandle as aj, type PreloadLivenessAssetsOptions as ak, type ProcessingSnapshot as al, type ProcessingStepHandle as am, type ReasonCode as an, type RegistrySnapshot as ao, type RegistrySource as ap, type RegistryStepHandle as aq, type ResultDisplay as ar, type ResultSnapshot as as, type ResultStepHandle as at, type SdkFailureReason as au, type StepAttempts as av, type StepContext as aw, type StepSnapshot as ax, type UnsupportedReason as ay, type UnsupportedSnapshot as az, type PortraitCaptureHandle as b, type GrabbedFrame as b$, type DocAssistReport as b0, type ReadyInfo as b1, type LoadFailure as b2, type OcrEngineOptions as b3, type SubmitRuntime as b4, type HostedClientLike as b5, ANALYSIS_LONG_EDGE as b6, ASPECT_BANDS as b7, AttestationError as b8, BLUR_REFUSE_SHARPNESS_MAX as b9, DocFeedbackAggregator as bA, type DocFeedbackKey as bB, type DocFeedbackState as bC, type DocFormat as bD, type DocFrameAnalysis as bE, type DocFrameMeasures as bF, type DocGateQuality as bG, type DocGateThresholds as bH, type DocGateTick as bI, type DocGateTickInput as bJ, DocGateV1 as bK, type DocQuad as bL, type DocQuadPoint as bM, type DocShutterReason as bN, type DocShutterTuning as bO, type DocSide as bP, type DocumentCaptureController as bQ, type DocumentCaptureInternals as bR, EMPTY_GUIDE_METRICS as bS, type EncodedDocument as bT, FLIP_FILL_MIN as bU, FLIP_GAP_MS as bV, FLIP_TIMEOUT_MS as bW, type FocusCaps as bX, type FramingStatus as bY, GUIDE_LOCK_DEFAULTS as bZ, type GlareStatus as b_, type BlurStatus as ba, CAPTURE_CANDIDATE_SPACING_MS as bb, CAPTURE_EXTRA_CANDIDATES as bc, CLIP_MIME_ALLOWLIST as bd, type CaptureEngine as be, CaptureSessionDoc as bf, type CaptureSessionDocEvents as bg, type CaptureSessionDocOptions as bh, DOC_ANALYSIS_DEFAULTS as bi, DOC_CADENCE_HZ as bj, DOC_CAMERA_TUNING_DEFAULTS as bk, DOC_CATALOG as bl, DOC_DETECT_WIDTH as bm, DOC_FEEDBACK_STATES as bn, DOC_GATE_V1_DEFAULTS as bo, DOC_SHUTTER_DEFAULTS as bp, type DeviceReadHint as bq, type DocArtifacts as br, DocAssist as bs, type DocAssistEngine as bt, type DocAssistTick as bu, type DocCameraTuning as bv, type DocCaptureReport as bw, type DocCaptureVia as bx, type DocChecksPayload as by, type DocEngineLike as bz, type CaptureChannel as c, createFaceLandmarker as c$, type GuideBlocker as c0, GuideLock as c1, type GuideLockTick as c2, type GuideLockTuning as c3, type GuideMetrics as c4, type GuideRect as c5, INFERENCE_RETRY_ATTEMPTS as c6, INFERENCE_RETRY_DEFAULT_S as c7, LANDMARKER_MODEL as c8, LENS_STORAGE_KEY as c9, PRELOAD_BUDGET_MS as cA, PROCESSING_POLL_DELAY_MS as cB, PROCESSING_POLL_MAX as cC, type PortraitCaptureController as cD, type PortraitCaptureInternals as cE, REGISTRY_RETRY_DELAY_MS as cF, type ReticleType as cG, SAME_FACE_MAX_DROPS as cH, type ScanEvent as cI, type ScanLayout as cJ, type ScanNotice as cK, type ScanPhase as cL, type ScanReport as cM, type ScanSide as cN, type ScanState as cO, type SubmitExecutor as cP, TEXT_LOCK_DEFAULTS as cQ, TRANSPORT_REPLAY_ATTEMPTS as cR, TRANSPORT_REPLAY_DELAY_MS as cS, type VerificationInternals as cT, analyzeDocFrame as cU, analyzeGuide as cV, aspectBand as cW, aspectFits as cX, buildDeviceReadHint as cY, coverPointToVideo as cZ, createDocumentCaptureInternal as c_, LENS_TRY_MAX as ca, LIVE_MRZ_DEFAULTS as cb, LIVE_PHOTO_IDLE_MS as cc, LIVE_PHOTO_MAX_HZ as cd, type LandmarkedFace as ce, type LandmarkerLike as cf, type LensKind as cg, type LensSource as ch, type LightingStatus as ci, type LiveMrzCapture as cj, type LiveMrzState as ck, type LivePhotoGate as cl, type LivePhotoKit as cm, type LivePhotoKitInternals as cn, type LivePhotoKitOptions as co, type LivePhotoStill as cp, type LivenessCaptureInternalHandle as cq, type LivenessCaptureInternals as cr, type LivenessFlowDeps as cs, type LivenessFlowOutcome as ct, MANUAL_SHUTTER_MS as cu, MR_DOC_CATALOG as cv, NO_REPORT_MS as cw, type OpenDocCameraDeps as cx, PORTRAIT_JPEG_QUALITY as cy, PRELOAD_BLAZE_INIT_TIMEOUT_MS as cz, type CaptureEngineId as d, createLivePhotoKit as d0, createLivenessCaptureInternal as d1, createPortraitCaptureInternal as d2, createVerificationInternal as d3, docZoomFor as d4, encodeDocumentImage as d5, facesOf as d6, feedbackVoteOf as d7, focusOk as d8, guideQuad as d9, scannerFormatFor as dA, setPreloadLoaderForTests as dB, settledHint as dC, singleShotFocusAt as dD, specularFraction as dE, supportsFocusMode as dF, warmDocDetector as dG, writeStoredLens as dH, guideRegionInFrame as da, initialScanState as db, lensKindOf as dc, mapEngineState as dd, mapErrorKind as de, mapGuidanceHint as df, nextScanState as dg, observe as dh, openDocCamera as di, passportBandOf as dj, portraitMatchStep as dk, preloadedDetectorFactory as dl, quadAreaFrac as dm, quadBounds as dn, quadIou as dp, quadTiltRatio as dq, randomUuid as dr, rankBackCameras as ds, readStoredLens as dt, resetLivenessAssetsForTests as du, resolveDocCameraTuning as dv, resolveDocShutterTuning as dw, resolveGuideLockTuning as dx, runLivenessFlow as dy, runSubmission as dz, type CaptureError as e, type CaptureErrorKind as f, type CaptureState as g, type CapturedArtifacts as h, type CapturedDocument as i, type CapturedPortrait as j, type ChoiceOptionSnapshot as k, type ChoiceSnapshot as l, type ChoiceStepHandle as m, type ContactChoiceSnapshot as n, type ContactChoiceStepHandle as o, DEFAULT_API_ORIGIN as p, DOCUMENT_TYPE_ORDER as q, type DeriveStepEnv as r, type DocumentCaptureEvents as s, type DocumentCaptureState as t, type DocumentFeedback as u, type DocumentFeedbackKey as v, type DocumentGateUpdate as w, type DocumentGuide as x, type DocumentGuideMeasure as y, type DocumentLiveMrzOptions as z };
|