@sekyro/web 0.1.0-rc.10 → 0.1.0-rc.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/{capture-session-doc-GK6G7JOI.js → capture-session-doc-DMQ7T3HC.js} +1 -1
  3. package/dist/{capture-session-v3-CmJw_bK0.d.cts → capture-session-v3-CCHws1mz.d.cts} +34 -3
  4. package/dist/{capture-session-v3-DGG2stO6.d.ts → capture-session-v3-DYrhYJoM.d.ts} +34 -3
  5. package/dist/{chunk-SEC64KZ3.js → chunk-73M7LS4H.js} +1 -1
  6. package/dist/chunk-AHD4DA2V.js +1 -0
  7. package/dist/chunk-GT2ZLGF7.js +1 -0
  8. package/dist/chunk-HHCGQSD4.js +1 -0
  9. package/dist/chunk-IJLHPX35.js +1 -0
  10. package/dist/{chunk-FFDB6LQN.js → chunk-JDGEZ542.js} +1 -1
  11. package/dist/{chunk-BAGSM67V.js → chunk-LUKTHL6K.js} +1 -1
  12. package/dist/chunk-MXNZMTC2.js +1 -0
  13. package/dist/{chunk-UGMHAFEY.js → chunk-OWU22VXP.js} +1 -1
  14. package/dist/chunk-U6TYL2IJ.js +1 -0
  15. package/dist/chunk-URUKV6NC.js +1 -0
  16. package/dist/chunk-V5K2JLC7.js +1 -0
  17. package/dist/client/index.cjs +1 -1
  18. package/dist/client/index.d.cts +5 -3
  19. package/dist/client/index.d.ts +5 -3
  20. package/dist/client/index.js +1 -1
  21. package/dist/core/index.cjs +1 -1
  22. package/dist/core/index.d.cts +3 -2
  23. package/dist/core/index.d.ts +3 -2
  24. package/dist/core/index.js +1 -1
  25. package/dist/{create-document-capture-IGUQP2NS.js → create-document-capture-FV4XGUKQ.js} +1 -1
  26. package/dist/{create-portrait-capture-RJSFY37D.js → create-portrait-capture-C462EIB6.js} +1 -1
  27. package/dist/{create-verification-Bb20j6zk.d.ts → create-verification-CmJzn7sq.d.ts} +81 -8
  28. package/dist/{create-verification-CtqF4A9W.d.cts → create-verification-CzLrQjeM.d.cts} +81 -8
  29. package/dist/icao-gate-BeznQECA.d.cts +500 -0
  30. package/dist/icao-gate-Bw5sQVlt.d.ts +500 -0
  31. package/dist/index.cjs +1 -1
  32. package/dist/index.d.cts +16 -5
  33. package/dist/index.d.ts +16 -5
  34. package/dist/index.js +1 -1
  35. package/dist/internal/index.cjs +1 -1
  36. package/dist/internal/index.d.cts +17 -8
  37. package/dist/internal/index.d.ts +17 -8
  38. package/dist/internal/index.js +1 -1
  39. package/dist/{plan-runner-QCK2SOGS.js → plan-runner-ZVAY4FSB.js} +1 -1
  40. package/dist/popup/index.cjs +1 -1
  41. package/dist/popup/index.d.cts +7 -1
  42. package/dist/popup/index.d.ts +7 -1
  43. package/dist/popup/index.js +1 -1
  44. package/dist/{icao-gate-terzKYD7.d.cts → types-BWyAHKt_.d.cts} +164 -499
  45. package/dist/{icao-gate-terzKYD7.d.ts → types-BWyAHKt_.d.ts} +164 -499
  46. package/package.json +1 -1
  47. package/sbom.cdx.json +7 -7
  48. package/dist/chunk-3MSUJYBO.js +0 -1
  49. package/dist/chunk-ETY6SAAZ.js +0 -1
  50. package/dist/chunk-HAO6EQTH.js +0 -1
  51. package/dist/chunk-HWAXEQD5.js +0 -1
  52. package/dist/chunk-SXZCL5NO.js +0 -1
  53. package/dist/chunk-SZ7YGNUZ.js +0 -1
  54. package/dist/chunk-WKJJEPWA.js +0 -1
  55. package/dist/chunk-XR64UFLK.js +0 -1
@@ -1 +1 @@
1
- "use strict";var je=Object.create;var P=Object.defineProperty;var $e=Object.getOwnPropertyDescriptor;var Je=Object.getOwnPropertyNames;var et=Object.getPrototypeOf,tt=Object.prototype.hasOwnProperty;var rt=(t,e)=>()=>(t&&(e=t(t=0)),e);var me=(t,e)=>{for(var r in e)P(t,r,{get:e[r],enumerable:!0})},pe=(t,e,r,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Je(e))!tt.call(t,n)&&n!==r&&P(t,n,{get:()=>e[n],enumerable:!(i=$e(e,n))||i.enumerable});return t};var nt=(t,e,r)=>(r=t!=null?je(et(t)):{},pe(e||!t||!t.__esModule?P(r,"default",{value:t,enumerable:!0}):r,t)),it=t=>pe(P({},"__esModule",{value:!0}),t);var Ke={};me(Ke,{RANK_CANDIDATES:()=>Ct,RANK_TOLERANCE:()=>B,RANK_WINDOW_MS:()=>It,ROLL_ZERO_DEG:()=>Rt,SHARPNESS_REPORT_MAX:()=>Ne,YAW_REPORT_MAX:()=>Ge,YAW_ZERO_IOD:()=>Ot,collectRankedKeyframes:()=>Ve,default:()=>Pt,featuresOf:()=>Le,frontalOf:()=>Pe,rankKeyframes:()=>Fe});function Pe(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 s=Math.abs(Math.atan2(i,Math.abs(r))*180/Math.PI),a=Ae(1-s/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),a*=Ae(1-o/.5)}return{frontal:a,yaw:o,roll:s}}function Le(t,e){return t===null?{face:!1,frontal:0,yaw:null,roll:null,eyes:null,score:0,sharpness:e}:{face:!0,...Pe(t),eyes:null,score:t.score,sharpness:e}}function Fe(t){let e=t.map((n,s)=>s),r=(n,s)=>{let a=Number.NEGATIVE_INFINITY;for(let o of e)a=Math.max(a,n(t[o]));e=e.filter(o=>n(t[o])>=a-s)};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 At(t){return{face:t.face,frontal:D(t.frontal),...t.yaw!==null?{yaw:Math.min(D(t.yaw),Ge)}:{},...t.roll!==null?{roll:D(t.roll)}:{},...t.eyes!==null?{eyes:D(t.eyes)}:{},score:D(t.score),sharpness:Math.min(D(t.sharpness),Ne)}}async function Ve(t,e){let{options:r}=t,i=r.video,n=r.now??(()=>performance.now()),s=r.captureKeyframe??(m=>t.defaultKeyframe(m)),a=600/3,o=[],c=[],d=0;for(let m=0;m<4;m+=1){if(e!==t.attempt)return null;let p=t.detector,g=Promise.resolve(null),h,f=0;try{if(p!==null){let A=t.profiler?.profile.inputWidth??160,Ze=r.makeSnapshot?.(i,A)??t.defaultSnapshot(i,A);h=s(i).then(q=>(f=n(),q));let Qe=n();g=p.detect(Ze,i.videoWidth,i.videoHeight).then(q=>(d+=n()-Qe,q),()=>null)}else h=s(i).then(A=>(f=n(),A));let[R,Ye]=await Promise.all([h,g]);o.push(R),c.push(Le(Ye,R.sharpness))}catch{h?.catch(()=>{})}let qe=f>0?Math.max(0,n()-f):0;m<3&&await new Promise(R=>setTimeout(R,Math.max(0,a-qe)))}if(e!==t.attempt)return null;let u=Fe(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(At)})}catch{}return o[u]??null}var Ct,It,Ot,Rt,B,Ae,D,Ge,Ne,Pt,We=rt(()=>{"use strict";Ct=4,It=600,Ot=.5,Rt=30,B={frontal:.1,eyes:.1,score:.05},Ae=t=>t<0?0:t>1?1:t;D=t=>Number.isFinite(t)?Math.round(t*1e3)/1e3:0,Ge=99,Ne=999999;Pt=Ve});var Vt={};me(Vt,{CENTERED_FACTOR:()=>pt,CIRCLE_RADIUS_FACTOR:()=>dt,CLIP_MS:()=>fe,CaptureSessionV3:()=>de,ClipError:()=>y,ClipRecorder:()=>T,DEFAULT_CLIP_MIME:()=>L,DEFAULT_TIER_ORDER:()=>xe,DEFAULT_V3_ASSET_BASE_URL:()=>_e,DEVICE_PROFILES:()=>De,DetectScheduler:()=>O,DetectorLadderError:()=>E,DeviceProfiler:()=>I,EXPOSURE_BAND:()=>C,FaceGateV3:()=>S,GATE_SNAPSHOT_MS:()=>Be,GateBlockStats:()=>k,HOLD_UPRIGHT_KEY:()=>z,IN_CIRCLE_FACTOR:()=>mt,KEYFRAME_CANDIDATES:()=>X,KEYFRAME_WINDOW_MS:()=>Xe,MAX_CLIP_BYTES:()=>F,MIME_CANDIDATES:()=>he,PHONE_MAX_SHORT_SIDE:()=>be,SHARP_REF:()=>er,STOP_GRACE_MS:()=>ge,TIMESLICE_MS:()=>ye,UPRIGHT_WATCH_MS:()=>ze,V3_GATE_DEFAULTS:()=>ke,VIDEO_BPS:()=>J,blockReasonOf:()=>Re,buildCaptureConstraints:()=>ee,buildLivenessV2FormData:()=>at,cameraPreflight:()=>j,captureMirroredKeyframe:()=>$,classifyDevice:()=>oe,createDetector:()=>_,detectFormFactor:()=>G,detectIsMobile:()=>te,errorCopy:()=>ot,exposure:()=>ie,extForMime:()=>Y,intrinsicSize:()=>v,isClipTooLarge:()=>w,isMediaRecorderSupported:()=>st,mapGetUserMediaError:()=>Q,meanLuma:()=>W,pickMimeType:()=>Z,probeDevice:()=>ae,sharpness:()=>H,toStreamPixels:()=>M,trackFacingMode:()=>re,uiCopy:()=>ct});module.exports=it(Vt);var he=["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 Z(){let t=globalThis.MediaRecorder;return!t||typeof t.isTypeSupported!="function"?"":he.find(e=>t.isTypeSupported(e))??""}var L="video/webm";function Q(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 j(){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 st(){let t=globalThis.MediaRecorder;return typeof t<"u"&&typeof t.isTypeSupported=="function"}var F=8*1024*1024;function w(t){return t.size>F}function Y(t){let e=(t||"").toLowerCase();return e.startsWith("image/jpeg")?"jpg":e.startsWith("video/mp4")?"mp4":(e.startsWith("video/webm"),"webm")}function at(t){let{token:e,clip:r,keyframe:i}=t,n=t.ts??Date.now(),s=r.type||L,a=i.type||"image/jpeg",o=new FormData;return o.append("token",e),o.append("clip",new File([r],`liveness-${n}.${Y(s)}`,{type:s})),o.append("keyframe",new File([i],`keyframe-${n}.${Y(a)}`,{type:a})),o}function $(t,e,r=.92){return new Promise((i,n)=>{let s=t.videoWidth,a=t.videoHeight;if(!s||!a){n(new Error("video-not-ready"));return}let o=e.getContext("2d");if(!o){n(new Error("no-2d-context"));return}e.width=s,e.height=a,o.scale(-1,1),o.drawImage(t,-s,0),e.toBlob(c=>c?i(c):n(new Error("empty-keyframe")),"image/jpeg",r)})}var ot={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."}},ct={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 fe=2500,ye=1e3,ge=1500,J=25e5,y=class extends Error{constructor(e,r){super(r??e),this.kind=e}},T=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 y("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=Z();return new Promise((n,s)=>{let a;try{a=new MediaRecorder(e,i?{mimeType:i,videoBitsPerSecond:J}:{videoBitsPerSecond:J})}catch{try{a=new MediaRecorder(e)}catch{s(new y("unsupported"));return}}this.recorder=a;let o=d=>{this.settled||(this.settled=!0,this.clearTimers(),d())},c=()=>o(()=>{let d=a.mimeType||i||L,u=new Blob(this.chunks,{type:d});if(u.size===0){s(new y("generic","empty clip"));return}if(w(u)){s(new y("cliptoolarge"));return}n({blob:u,mimeType:d})});a.ondataavailable=d=>{d.data&&d.data.size&&(this.chunks.push(d.data),this.bytes+=d.data.size,this.bytes>F&&o(()=>{try{a.state!=="inactive"&&a.stop()}catch{}s(new y("cliptoolarge"))}))},a.onstop=c,a.onerror=()=>o(()=>s(new y("generic")));try{a.start(ye)}catch{o(()=>s(new y("generic")));return}this.hardStopTimer=setTimeout(()=>{if(this.settled||r?.(),a.state!=="inactive"){try{a.stop()}catch{c()}this.graceTimer=setTimeout(c,ge)}else c()},fe)})}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 ee(t,e){return{video:{width:{ideal:1280,max:1280},height:{ideal:720,max:720},facingMode:e,frameRate:{ideal:24,max:30}},audio:!1}}var be=600;function G(){if(typeof window>"u"||typeof navigator>"u")return"desktop";let t=String(navigator.userAgent??"");if(/iPhone|iPod/i.test(t))return"phone";if(/iPad/i.test(t))return"tablet";if(/Android/i.test(t))return/Mobile/i.test(t)?"phone":"tablet";if(/BlackBerry|IEMobile|Opera Mini/i.test(t))return"phone";if(Number(navigator.maxTouchPoints??0)<=1)return"desktop";if(/Macintosh/.test(t))return"tablet";if(!lt())return"desktop";let r=ut();return r>0&&r<be?"phone":"tablet"}function te(){return G()!=="desktop"}function ut(){try{let t=window.screen,e=Number(t?.width??0),r=Number(t?.height??0);return e>0&&r>0?Math.min(e,r):0}catch{return 0}}function re(t){try{let r=t?.getVideoTracks?.()[0]?.getSettings?.().facingMode;return r==="user"||r==="environment"?r:null}catch{return null}}function lt(){try{return typeof window.matchMedia=="function"&&window.matchMedia("(pointer: coarse)").matches}catch{return!1}}var dt=.45,mt=.9,pt=.4;var ve=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),s=await i.FaceDetector.createFromOptions(n,{baseOptions:{modelAssetPath:`${e}/blaze_face_short_range.tflite`,delegate:"CPU"},runningMode:"IMAGE"});return new t(s,r)}async detect(e,r,i){let n;try{n=this.inner.detect(e).detections}catch{return null}let s=ht(n);if(s?.boundingBox===void 0)return null;let a=v(e),o=ft(s.keypoints,a),c=s.keypoints?.[2],d={box:{x:s.boundingBox.originX,y:s.boundingBox.originY,width:s.boundingBox.width,height:s.boundingBox.height},...o!==void 0?{eyes:o}:{},...c!==void 0?{nose:{x:c.x*a.width,y:c.y*a.height}}:{},score:s.categories[0]?.score??0};return M(d,e,r,i)}destroy(){try{this.inner.close()}catch{}}};function ht(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 ft(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}),[s,a]=[n(r),n(i)];return s.x<=a.x?{left:s,right:a}:{left:a,right:s}}function yt(){if(typeof OffscreenCanvas=="function")return new OffscreenCanvas(2,2);let t=document.createElement("canvas");return t.width=2,t.height=2,t}async function Ee(){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(yt()),{ok:!0,instance:e}}catch(e){return{ok:!1,reason:`smoke_failed:${e instanceof Error?e.message:String(e)}`}}}var V=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 s=n[0];if(s===void 0)return null;let a=gt(s.landmarks),o={box:{x:s.boundingBox.x,y:s.boundingBox.y,width:s.boundingBox.width,height:s.boundingBox.height},...a!==void 0?{eyes:a}:{},score:1};return M(o,e,r,i)}destroy(){}};function gt(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 _e="/models-v3",xe=["native","blaze"],E=class extends Error{constructor(e){super(`no detector tier available (${e})`),this.name="DetectorLadderError",this.fallbackReason=e}};function v(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 M(t,e,r,i){let n=v(e),s=n.width>0?r/n.width:1,a=n.height>0?i/n.height:1,o=c=>({x:c.x*s,y:c.y*a});return{box:{x:t.box.x*s,y:t.box.y*a,width:t.box.width*s,height:t.box.height*a},...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 bt(t){return t instanceof Error?t.message:String(t)}async function _(t){let e=t.preferred??xe,r=[];for(let i of e){if(i==="native"){let n=await Ee();if(n.ok)return new V(n.instance,ne(r));r.push(`native:${n.reason}`);continue}try{return await vt(N.create(t.v3AssetBaseUrl??_e,ne(r)),t.blazeInitTimeoutMs??ve)}catch(n){r.push(n instanceof K?"blaze:blaze_init_timeout":`blaze:${bt(n)}`)}}throw new E(ne(r)??"no_tier_available")}function ne(t){return t.length>0?t.join("; "):void 0}var K=class extends Error{};function vt(t,e){return new Promise((r,i)=>{let n=setTimeout(()=>{i(new K(`init exceeded ${e}ms`)),t.then(s=>s.destroy(),()=>{})},e);t.then(s=>{clearTimeout(n),r(s)},s=>{clearTimeout(n),i(s)})})}var er=180,C=[100,190],Et=64;function Se(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 s=0;for(let a=0;a<n;a+=1)s+=Se(e,a*4);return s/n}function H(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]=Se(e,u*4);let s=0,a=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);s+=p,a+=p*p,o+=1}if(o===0)return 0;let c=s/o,d=a/o-c*c;return Math.min(1,Math.max(0,d)/180)}function ie(t){let e=W(t),[r,i]=C,n=e<r?r-e:e>i?e-i:0;return Math.max(0,1-n/Et)}var ke=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}),x=t=>Math.min(1,Math.max(0,t)),S=class{constructor(e={}){this.p=0;this.lastTickAt=null;this.lastCenter=null;this.velocityEma=0;this.qWindow=[];this.lastSizeDirection="ideal";this.t={...ke,...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,s=this.lastTickAt===null?0:Math.max(0,(n-this.lastTickAt)/1e3);this.lastTickAt=n;let a={presence:0,centering:0,size:0,pose:0,sharpness:x(i.sharpness),exposure:x(i.exposure),motion:1};if(r!==null){a.presence=1;let u=this.geometryOf(r,e);a.centering=u.centering,a.size=u.size,a.pose=u.pose,a.motion=this.motionOf(u.center,u.iod,n)}else this.lastCenter=null,this.velocityEma=0;let o=Math.min(a.presence,a.centering,a.size,a.pose,a.sharpness,a.exposure,a.motion);this.p=x(this.p+(o>=this.t.Q_GOOD?this.t.RISE_PER_S*o:-this.t.FALL_PER_S*(1-o))*s),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:a,guidanceKey:this.guidanceOf(a,i,o),ready:d,accepted:o>=this.t.Q_GOOD}}geometryOf(e,r){let{box:i,eyes:n}=e,s={x:r.frameWidth/2,y:r.frameHeight/2},a=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-s.x,o.y-s.y),u=c<=0?0:1-x(d/(this.t.CENTER_FALLOFF_IOD_MULTIPLE*c)),l=a>0?c/a: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 g=Math.abs(Math.atan2(n.right.y-n.left.y,n.right.x-n.left.x))*180/Math.PI;p=1-x(g/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 s=(i-n.at)/1e3;if(s<=0)return 1;let a=Math.hypot(e.x-n.x,e.y-n.y)/r/s;a<=this.t.MOTION_DEADBAND_IOD_PER_S&&(a=0);let o=1-Math.exp(-s/this.t.MOTION_TAU_S);return this.velocityEma=o*a+(1-o)*this.velocityEma,1-x(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"]],s=n[0];for(let a of n)e[a[0]]<e[s[0]]&&(s=a);return s[1]}return"fcv3.hold_still"}sizeGuidance(){return this.lastSizeDirection==="far"?"fcv3.come_closer":"fcv3.move_back"}exposureGuidance(e){let r=(C[0]+C[1])/2;return e.meanLuma<r?"fcv3.more_light":"fcv3.too_bright"}};var De=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"})}),_t=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 ae(){let t=typeof navigator>"u"?void 0:navigator,e=!1;try{e=typeof WebAssembly<"u"&&WebAssembly.validate(_t)}catch{e=!1}return{cores:t?.hardwareConcurrency??2,memGB:t?.deviceMemory??null,simd:e}}function oe(t){let e=t.memGB??4;return t.cores<4||e<3?"LOW":t.cores>=8&&e>=6?"HIGH":"MID"}var se=["LOW","MID","HIGH"],I=class{constructor(e){this.samples=[];this.adjusted=!1;this.current=e}get deviceClass(){return this.current}get profile(){return De[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=se.indexOf(this.current);this.current=se[Math.min(se.length-1,i+1)]??this.current}return this.current}};var O=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 we="0.1.0-rc.10";var Te="sekyro.did",Me;function Ce(){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 xt(){try{let t=localStorage.getItem(Te);if(t)return t;let e=Ce();return e!==void 0&&localStorage.setItem(Te,e),e}catch{return Me??(Me=Ce()),Me}}async function St(){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 kt(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 Dt(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=St().catch(()=>""));let i=[];navigator.webdriver&&i.push("webdriver"),/HeadlessChrome/.test(navigator.userAgent)&&i.push("headless");let n=await r,s=xt(),a={v:1,platform:"web",sdk:t.sdk.slice(0,64),ids:[...s?[{kind:"web_local",value:s.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 kt(JSON.stringify(a))}catch{return}}}}var ce=Symbol.for("sekyro.web.clientContext"),ue=globalThis,wt=ue[ce]??(ue[ce]=Dt({sdk:`@sekyro/web@${we}`}));function Ie(t){try{let e=t.getVideoTracks?.()[0];e&&wt.noteCameraLabel(e.label)}catch{}}var b=1;function Oe(){return typeof OffscreenCanvas=="function"&&typeof createImageBitmap=="function"&&typeof Worker=="function"}function Tt(t,e={}){let r=e.createDetector??_,i=null;t.onmessage=n=>{let s=n.data;if(s.v!==b){s.bitmap?.close?.();return}if(s.type==="init"){r(s.options).then(a=>{i=a;let o={v:b,type:"ready",tier:a.tier,...a.fallbackReason!==void 0?{fallbackReason:a.fallbackReason}:{}};t.postMessage(o)});return}if(s.type==="detect"){let a=o=>{let c={v:b,type:"result",id:s.id,observation:o};t.postMessage(c),s.bitmap.close?.()};if(i===null){a(null);return}i.detect(s.bitmap,s.streamWidth,s.streamHeight).then(a,()=>a(null))}}}typeof self<"u"&&typeof self.importScripts=="function"&&Tt(self);var U=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 s=this.pending.get(n.id);this.pending.delete(n.id),s?.(n.observation)})}static create(e,r,i=1e4){return new Promise((n,s)=>{let a=setTimeout(()=>{e.removeEventListener("message",o),e.terminate(),s(new Error(`worker detector not ready within ${i}ms`))},i),o=d=>{let u=d.data;u.v!==b||u.type!=="ready"||(clearTimeout(a),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 s=this.nextId;return this.nextId+=1,new Promise(a=>{this.pending.set(s,a);let o={v:b,type:"detect",id:s,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 Mt=["size","centering","pose","exposure","sharpness","motion"];function Re(t){if(t.accepted)return null;if(t.factors.presence<=0)return"no_face";let e="size";for(let r of Mt)t.factors[r]<t.factors[e]&&(e=r);return e}var k=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=Re(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 Be=1e3,z="fcv3.hold_upright",ze=200,X=4,Xe=600,He={sharpness:1,exposure:1,meanLuma:128};function Lt(t,e){return e.width=t.videoWidth,e.height=t.videoHeight,e.getContext("2d").drawImage(t,0,0),new Promise((r,i)=>e.toBlob(n=>n?r(n):i(new Error("empty-keyframe")),"image/jpeg",.92))}function Ft(){return G()==="phone"}var de=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.uprightGuard=!1;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.uprightGuard=(r.isPhone??Ft)(),this.setState("preflight");let i=j();if(i!=="OK"){this.fail(i==="INSECURE_CONTEXT"?"insecure":"unsupported");return}this.setState("acquiring");let n=r.getUserMedia??(c=>navigator.mediaDevices.getUserMedia(c)),s;this.cameraRequestedAt=this.now();try{s=await n(ee(te(),this.facing))}catch(c){if(e!==this.attempt)return;this.fail(Q(c));return}if(Ie(s),e!==this.attempt){for(let c of s.getTracks())c.stop();return}if(this.stream=s,this.facing=re(s)??this.facing,r.video.srcObject=s,await r.video.play().catch(()=>{}),e!==this.attempt)return;if(this.cameraReadyAt=this.now(),this.detector===null){let c={v3AssetBaseUrl:r.v3AssetBaseUrl},d=r.createDetector??(r.createWorker!==void 0&&Oe()?async()=>{try{return await U.create(r.createWorker(),c)}catch{return _(c)}}:()=>_(c)),u;try{u=await d()}catch(l){e===this.attempt&&this.fail("models",l instanceof E?l.fallbackReason:Nt(l));return}if(e!==this.attempt){u.destroy();return}this.detector=u,this.options.telemetry?.({type:"detector",tier:u.tier,fallbackReason:u.fallbackReason})}let a=ae(),o=r.deviceClass??oe(a);this.profiler=new I(o),this.options.telemetry?.({type:"profile",staticClass:o,activeClass:this.profiler.deviceClass,simd:a.simd}),this.gate=new S(r.thresholds??{}),this.blockStats=new k,this.lastGateSnapshotAt=this.now(),r.rankKeyframes?.()&&Promise.resolve().then(()=>(We(),Ke)).then(c=>le=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 O({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,s=this.options.video;if(e!==this.attempt||r===null||i===null||n===null||this.fired||s.videoWidth===0)return;if(this.isLandscape()){this.holdUpright(e);return}let a=n.deviceClass,o=this.now(),c=this.options.makeSnapshot?.(s,n.profile.inputWidth)??this.defaultSnapshot(s,n.profile.inputWidth),d=null;try{d=await r.detect(c,s.videoWidth,s.videoHeight)}catch{d=null}if(e!==this.attempt||this.fired)return;n.record(this.now()-o),n.deviceClass!==a&&this.startScheduler(e);let u=d===null?He:this.options.measureQuality?.(s,d.box)??this.defaultQuality(s,d.box),l=i.tick({timestampMs:this.now(),observation:d,quality:u,frameWidth:s.videoWidth,frameHeight:s.videoHeight});l.accepted&&this.faceAcquiredAt===null&&(this.faceAcquiredAt=l.at),this.blockStats?.record(l),!l.ready&&l.at-this.lastGateSnapshotAt>=Be&&(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},s=[...this.carriedMeans,...n.meanDetectMs>0?[n.meanDetectMs]:[]];r.telemetry?.({type:"fired",timeToGateMs:this.now()-this.positioningStartedAt,degradeCount:this.carriedDegrade+n.degradeCount,meanDetectMs:s.length===0?0:s.reduce((h,f)=>h+f,0)/s.length});let a=r.mode??"clip",o=r.rankKeyframes?.()&&le?le.default(this,e).catch(()=>this.collectKeyframes(e)):this.collectKeyframes(e);if(a==="photo"){let h=this.watchRotation(e,null),f=await o;if(h(),e!==this.attempt)return;if(f===null){this.fail("generic");return}this.finishCapture({keyframe:f.blob,previewDataUrl:f.previewDataUrl});return}this.setState("recording");let c=r.createRecorder?.()??new T,d=this.stream;if(d===null){this.fail("generic");return}let u=this.watchRotation(e,c),l=null;o.then(h=>{l=h},()=>{});let m=()=>{e===this.attempt&&l!==null&&this.emit("frozen",{previewDataUrl:l.previewDataUrl})},p,g;try{[p,g]=await Promise.all([c.record(d,m),o])}catch(h){if(u(),e!==this.attempt)return;let f=h.kind;this.fail(f==="cliptoolarge"?"cliptoolarge":"recorder");return}if(u(),e===this.attempt){if(w(p.blob)){this.fail("cliptoolarge");return}if(g===null){this.fail("generic");return}this.finishCapture({clip:p.blob,clipMimeType:p.mimeType,keyframe:g.blob,previewDataUrl:g.previewDataUrl})}}isLandscape(){let e=this.options.video;return this.uprightGuard&&e.videoWidth>e.videoHeight}holdUpright(e){this.gate?.reset(),this.emit("checks",{engine:"v3",progress:0,q:0,factors:{presence:0,centering:0,size:0,pose:0,sharpness:0,exposure:0,motion:0},attempt:e}),this.lastGuidanceKey!==z&&(this.lastGuidanceKey=z,this.emit("guidance",{key:z}))}watchRotation(e,r){if(!this.uprightGuard)return()=>{};let i=this.options.video,n=()=>{if(e!==this.attempt||r!==null&&this.stateValue!=="recording"){o();return}i.videoWidth>0&&this.isLandscape()&&(o(),this.abortRecording(e,r))},s=setInterval(n,ze);i.addEventListener?.("resize",n);let a=!1;function o(){a||(a=!0,clearInterval(s),i.removeEventListener?.("resize",n))}return o}abortRecording(e,r){if(e!==this.attempt)return;this.attempt+=1;let i=this.attempt;try{r?.stop()}catch{}this.fired=!1,this.captureCompleteAt=null,this.gate=new S(this.options.thresholds??{}),this.blockStats=new k,this.lastGateSnapshotAt=this.now(),this.lastGuidanceKey=null,this.setState("positioning"),this.positioningStartedAt=this.now(),this.holdUpright(i),this.startScheduler(i)}async collectKeyframes(e){let r=this.options.captureKeyframe??(s=>this.defaultKeyframe(s)),i=Xe/(X-1),n=null;for(let s=0;s<X;s+=1){if(e!==this.attempt)return n;try{let a=await r(this.options.video);(n===null||a.sharpness>n.sharpness)&&(n=a)}catch{}s<X-1&&await Gt(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={},r=(i,n,s)=>{n!==null&&s!==null&&(e[i]=Math.max(0,Math.round(s-n)))};return r("cameraReadyMs",this.cameraRequestedAt,this.cameraReadyAt),r("faceAcquireMs",this.cameraReadyAt,this.faceAcquiredAt),r("captureMs",this.faceAcquiredAt,this.captureCompleteAt),Object.keys(e).length>0?e:void 0}async defaultKeyframe(e){let r=document.createElement("canvas"),i=await(this.facing==="user"?$:Lt)(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),s=Math.max(1,Math.round(e.videoWidth*n)),a=Math.max(1,Math.round(e.videoHeight*n)),o=i.getContext("2d");return o===null?e:(i.width!==s&&(i.width=s),i.height!==a&&(i.height=a),o.drawImage(e,0,0,s,a),this.snapshotCanvas=i,i)}catch{return e}}defaultQuality(e,r){let i=Ue(e,r,96);return i===null?He:{sharpness:H(i),exposure:ie(i),meanLuma:W(i)}}centerSharpness(e){let r=v(e),i=Ue(e,{x:r.width*.25,y:r.height*.25,width:r.width*.5,height:r.height*.5},96);return i===null?0:H(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()}},le;function Gt(t){return new Promise(e=>setTimeout(e,t))}function Nt(t){return t instanceof Error?t.message:String(t)}function Ue(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 s=i.getContext("2d");return s===null?null:(s.drawImage(t,e.x,e.y,e.width,e.height,0,0,i.width,i.height),s.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,HOLD_UPRIGHT_KEY,IN_CIRCLE_FACTOR,KEYFRAME_CANDIDATES,KEYFRAME_WINDOW_MS,MAX_CLIP_BYTES,MIME_CANDIDATES,PHONE_MAX_SHORT_SIDE,SHARP_REF,STOP_GRACE_MS,TIMESLICE_MS,UPRIGHT_WATCH_MS,V3_GATE_DEFAULTS,VIDEO_BPS,blockReasonOf,buildCaptureConstraints,buildLivenessV2FormData,cameraPreflight,captureMirroredKeyframe,classifyDevice,createDetector,detectFormFactor,detectIsMobile,errorCopy,exposure,extForMime,intrinsicSize,isClipTooLarge,isMediaRecorderSupported,mapGetUserMediaError,meanLuma,pickMimeType,probeDevice,sharpness,toStreamPixels,trackFacingMode,uiCopy});
1
+ "use strict";var st=Object.create;var V=Object.defineProperty;var ot=Object.getOwnPropertyDescriptor;var ct=Object.getOwnPropertyNames;var lt=Object.getPrototypeOf,ut=Object.prototype.hasOwnProperty;var dt=(r,e)=>()=>(r&&(e=r(r=0)),e);var be=(r,e)=>{for(var t in e)V(r,t,{get:e[t],enumerable:!0})},ve=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of ct(e))!ut.call(r,i)&&i!==t&&V(r,i,{get:()=>e[i],enumerable:!(n=ot(e,i))||n.enumerable});return r};var mt=(r,e,t)=>(t=r!=null?st(lt(r)):{},ve(e||!r||!r.__esModule?V(t,"default",{value:r,enumerable:!0}):t,r)),pt=r=>ve(V({},"__esModule",{value:!0}),r);var je={};be(je,{RANK_CANDIDATES:()=>qt,RANK_TOLERANCE:()=>Z,RANK_WINDOW_MS:()=>Yt,ROLL_ZERO_DEG:()=>Qt,SHARPNESS_REPORT_MAX:()=>Ze,YAW_REPORT_MAX:()=>Ye,YAW_ZERO_IOD:()=>Zt,collectRankedKeyframes:()=>Qe,default:()=>$t,featuresOf:()=>Xe,frontalOf:()=>ze,rankKeyframes:()=>qe});function ze(r){let e=r.eyes;if(e===void 0)return{frontal:1,yaw:null,roll:null};let t=e.right.x-e.left.x,n=e.right.y-e.left.y,i=t*t+n*n;if(i===0)return{frontal:1,yaw:null,roll:null};let a=Math.abs(Math.atan2(n,Math.abs(t))*180/Math.PI),s=Be(1-a/30),o=null,l=r.nose;if(l!==void 0){let d=(e.left.x+e.right.x)/2,c=(e.left.y+e.right.y)/2;o=Math.abs(((l.x-d)*t+(l.y-c)*n)/i),s*=Be(1-o/.5)}return{frontal:s,yaw:o,roll:a}}function Xe(r,e){return r===null?{face:!1,frontal:0,yaw:null,roll:null,eyes:null,score:0,sharpness:e}:{face:!0,...ze(r),eyes:null,score:r.score,sharpness:e}}function qe(r){let e=r.map((i,a)=>a),t=(i,a)=>{let s=Number.NEGATIVE_INFINITY;for(let o of e)s=Math.max(s,i(r[o]));e=e.filter(o=>i(r[o])>=s-a)};t(i=>i.frontal,Z.frontal),t(i=>i.eyes??1,Z.eyes),t(i=>i.score,Z.score);let n=-1;for(let i of e)(n===-1||r[i].sharpness>r[n].sharpness)&&(n=i);return n}function jt(r){return{face:r.face,frontal:O(r.frontal),...r.yaw!==null?{yaw:Math.min(O(r.yaw),Ye)}:{},...r.roll!==null?{roll:O(r.roll)}:{},...r.eyes!==null?{eyes:O(r.eyes)}:{},score:O(r.score),sharpness:Math.min(O(r.sharpness),Ze)}}async function Qe(r,e){let{options:t}=r,n=t.video,i=t.now??(()=>performance.now()),a=t.captureKeyframe??(m=>r.defaultKeyframe(m)),s=600/3,o=[],l=[],d=0;for(let m=0;m<4;m+=1){if(e!==r.attempt)return null;let f=r.detector,p=Promise.resolve(null),h,g=0;try{if(f!==null){let k=r.profiler?.profile.inputWidth??160,I=t.makeSnapshot?.(n,k)??r.defaultSnapshot(n,k);h=a(n).then(y=>(g=i(),y));let $=i();p=f.detect(I,n.videoWidth,n.videoHeight).then(y=>(d+=i()-$,y),()=>null)}else h=a(n).then(k=>(g=i(),k));let[v,_]=await Promise.all([h,p]);o.push(v),l.push(Xe(_,v.sharpness))}catch{h?.catch(()=>{})}let E=g>0?Math.max(0,i()-g):0;m<3&&await new Promise(v=>setTimeout(v,Math.max(0,s-E)))}if(e!==r.attempt)return null;let c=qe(l);if(c===-1)return null;let u=0;l.forEach((m,f)=>{m.sharpness>l[u].sharpness&&(u=f)});try{t.telemetry?.({type:"keyframe",tier:r.detector?.tier??null,chosen:c,sharpest:u,detectMs:Math.round(d),candidates:l.map(jt)})}catch{}return o[c]??null}var qt,Yt,Zt,Qt,Z,Be,O,Ye,Ze,$t,$e=dt(()=>{"use strict";qt=4,Yt=600,Zt=.5,Qt=30,Z={frontal:.1,eyes:.1,score:.05},Be=r=>r<0?0:r>1?1:r;O=r=>Number.isFinite(r)?Math.round(r*1e3)/1e3:0,Ye=99,Ze=999999;$t=Qe});var nr={};be(nr,{CENTERED_FACTOR:()=>Mt,CIRCLE_RADIUS_FACTOR:()=>Et,CLIP_MS:()=>Se,CaptureSessionV3:()=>ye,ClipError:()=>b,ClipRecorder:()=>P,DEFAULT_CLIP_MIME:()=>W,DEFAULT_TIER_ORDER:()=>xe,DEFAULT_V3_ASSET_BASE_URL:()=>Re,DEVICE_PROFILES:()=>Oe,DetectScheduler:()=>G,DetectorLadderError:()=>C,DeviceProfiler:()=>N,EXPOSURE_BAND:()=>L,FaceGateV3:()=>w,GATE_SNAPSHOT_MS:()=>tt,GateBlockStats:()=>D,HOLD_UPRIGHT_KEY:()=>Q,IN_CIRCLE_FACTOR:()=>St,KEYFRAME_CANDIDATES:()=>j,KEYFRAME_WINDOW_MS:()=>nt,MAX_CLIP_BYTES:()=>H,MIME_CANDIDATES:()=>Ee,PHONE_MAX_SHORT_SIDE:()=>ke,PROVENANCE_WAIT_MS:()=>it,SHARP_REF:()=>br,STOP_GRACE_MS:()=>_e,TIMESLICE_MS:()=>Me,UPRIGHT_WATCH_MS:()=>rt,V3_GATE_DEFAULTS:()=>De,VIDEO_BPS:()=>ie,blockReasonOf:()=>Ue,buildCaptureConstraints:()=>ae,buildLivenessV2FormData:()=>ht,cameraPreflight:()=>re,captureMirroredKeyframe:()=>ne,classifyDevice:()=>me,createDetector:()=>R,detectFormFactor:()=>K,detectIsMobile:()=>se,errorCopy:()=>gt,exposure:()=>le,extForMime:()=>J,intrinsicSize:()=>T,isClipTooLarge:()=>A,isMediaRecorderSupported:()=>ft,mapGetUserMediaError:()=>te,meanLuma:()=>X,pickMimeType:()=>ee,probeDevice:()=>de,sharpness:()=>q,toStreamPixels:()=>F,trackFacingMode:()=>oe,uiCopy:()=>yt});module.exports=pt(nr);var Ee=["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 ee(){let r=globalThis.MediaRecorder;return!r||typeof r.isTypeSupported!="function"?"":Ee.find(e=>r.isTypeSupported(e))??""}var W="video/webm";function te(r){if(r instanceof TypeError)return"insecure";switch(r?.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 re(){let r=globalThis;if(typeof r.window<"u"&&r.window.isSecureContext===!1)return"INSECURE_CONTEXT";let e=r.navigator?.mediaDevices;return!e||typeof e.getUserMedia!="function"?"UNSUPPORTED":"OK"}function ft(){let r=globalThis.MediaRecorder;return typeof r<"u"&&typeof r.isTypeSupported=="function"}var H=8*1024*1024;function A(r){return r.size>H}function J(r){let e=(r||"").toLowerCase();return e.startsWith("image/jpeg")?"jpg":e.startsWith("video/mp4")?"mp4":(e.startsWith("video/webm"),"webm")}function ht(r){let{token:e,clip:t,keyframe:n}=r,i=r.ts??Date.now(),a=t.type||W,s=n.type||"image/jpeg",o=new FormData;return o.append("token",e),o.append("clip",new File([t],`liveness-${i}.${J(a)}`,{type:a})),o.append("keyframe",new File([n],`keyframe-${i}.${J(s)}`,{type:s})),o}function ne(r,e,t=.92){return new Promise((n,i)=>{let a=r.videoWidth,s=r.videoHeight;if(!a||!s){i(new Error("video-not-ready"));return}let o=e.getContext("2d");if(!o){i(new Error("no-2d-context"));return}e.width=a,e.height=s,o.scale(-1,1),o.drawImage(r,-a,0),e.toBlob(l=>l?n(l):i(new Error("empty-keyframe")),"image/jpeg",t)})}var gt={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."}},yt={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 Se=2500,Me=1e3,_e=1500,ie=25e5,b=class extends Error{constructor(e,t){super(t??e),this.kind=e}},P=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,t,n){if(this.recorder&&!this.settled)return Promise.reject(new b("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=ee();return new Promise((a,s)=>{let o;try{o=new MediaRecorder(e,i?{mimeType:i,videoBitsPerSecond:ie}:{videoBitsPerSecond:ie})}catch{try{o=new MediaRecorder(e)}catch{s(new b("unsupported"));return}}this.recorder=o;let l=c=>{this.settled||(this.settled=!0,this.clearTimers(),c())},d=()=>l(()=>{let c=o.mimeType||i||W,u=new Blob(this.chunks,{type:c});if(u.size===0){s(new b("generic","empty clip"));return}if(A(u)){s(new b("cliptoolarge"));return}a({blob:u,mimeType:c})});if(o.ondataavailable=c=>{c.data&&c.data.size&&(this.chunks.push(c.data),this.bytes+=c.data.size,this.bytes>H&&l(()=>{try{o.state!=="inactive"&&o.stop()}catch{}s(new b("cliptoolarge"))}))},o.onstop=d,o.onerror=()=>l(()=>s(new b("generic"))),n!==void 0){let c=!1;o.onstart=()=>{if(!(c||this.settled)){c=!0;try{n()}catch{}}}}try{o.start(Me)}catch{l(()=>s(new b("generic")));return}this.hardStopTimer=setTimeout(()=>{if(this.settled||t?.(),o.state!=="inactive"){try{o.stop()}catch{d()}this.graceTimer=setTimeout(d,_e)}else d()},Se)})}stop(e){this.clearTimers();let t=this.recorder;if(t&&t.state!=="inactive")try{t.stop()}catch{}this.recorder=null,(e??this.stream)?.getTracks().forEach(i=>i.stop()),this.stream=null}};function ae(r,e){return{video:{width:{ideal:1280,max:1280},height:{ideal:720,max:720},facingMode:e,frameRate:{ideal:24,max:30}},audio:!1}}var ke=600;function K(){if(typeof window>"u"||typeof navigator>"u")return"desktop";let r=String(navigator.userAgent??"");if(/iPhone|iPod/i.test(r))return"phone";if(/iPad/i.test(r))return"tablet";if(/Android/i.test(r))return/Mobile/i.test(r)?"phone":"tablet";if(/BlackBerry|IEMobile|Opera Mini/i.test(r))return"phone";if(Number(navigator.maxTouchPoints??0)<=1)return"desktop";if(/Macintosh/.test(r))return"tablet";if(!vt())return"desktop";let t=bt();return t>0&&t<ke?"phone":"tablet"}function se(){return K()!=="desktop"}function bt(){try{let r=window.screen,e=Number(r?.width??0),t=Number(r?.height??0);return e>0&&t>0?Math.min(e,t):0}catch{return 0}}function oe(r){try{let t=r?.getVideoTracks?.()[0]?.getSettings?.().facingMode;return t==="user"||t==="environment"?t:null}catch{return null}}function vt(){try{return typeof window.matchMedia=="function"&&window.matchMedia("(pointer: coarse)").matches}catch{return!1}}var Et=.45,St=.9,Mt=.4;var Te=1e4,U=class r{constructor(e,t){this.tier="blaze";this.inner=e,t!==void 0&&(this.fallbackReason=t)}static async create(e,t){let n=await import("@mediapipe/tasks-vision"),i=await n.FilesetResolver.forVisionTasks(e),a=await n.FaceDetector.createFromOptions(i,{baseOptions:{modelAssetPath:`${e}/blaze_face_short_range.tflite`,delegate:"CPU"},runningMode:"IMAGE"});return new r(a,t)}async detect(e,t,n){let i;try{i=this.inner.detect(e).detections}catch{return null}let a=_t(i);if(a?.boundingBox===void 0)return null;let s=T(e),o=kt(a.keypoints,s),l=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}:{},...l!==void 0?{nose:{x:l.x*s.width,y:l.y*s.height}}:{},score:a.categories[0]?.score??0};return F(d,e,t,n)}destroy(){try{this.inner.close()}catch{}}};function _t(r){let e,t=-1;for(let n of r){let i=n.categories[0]?.score??0;i>t&&(e=n,t=i)}return e}function kt(r,e){let t=r?.[0],n=r?.[1];if(t===void 0||n===void 0)return;let i=o=>({x:o.x*e.width,y:o.y*e.height}),[a,s]=[i(t),i(n)];return a.x<=s.x?{left:a,right:s}:{left:s,right:a}}function Tt(){if(typeof OffscreenCanvas=="function")return new OffscreenCanvas(2,2);let r=document.createElement("canvas");return r.width=2,r.height=2,r}async function Ce(){let r=globalThis.FaceDetector;if(typeof r!="function")return{ok:!1,reason:"unsupported"};try{let e=new r({fastMode:!0,maxDetectedFaces:1});return await e.detect(Tt()),{ok:!0,instance:e}}catch(e){return{ok:!1,reason:`smoke_failed:${e instanceof Error?e.message:String(e)}`}}}var B=class{constructor(e,t){this.tier="native";this.inner=e,t!==void 0&&(this.fallbackReason=t)}async detect(e,t,n){let i;try{i=await this.inner.detect(e)}catch{return null}let a=i[0];if(a===void 0)return null;let s=Ct(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 F(o,e,t,n)}destroy(){}};function Ct(r){if(r===void 0)return;let e=r.filter(i=>i.type==="eye").map(i=>i.locations[0]).filter(i=>i!==void 0),[t,n]=e;if(!(t===void 0||n===void 0))return t.x<=n.x?{left:t,right:n}:{left:n,right:t}}var Re="/models-v3",xe=["native","blaze"],C=class extends Error{constructor(e){super(`no detector tier available (${e})`),this.name="DetectorLadderError",this.fallbackReason=e}};function T(r){let e=r;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 t=typeof e.width=="number"?e.width:0,n=typeof e.height=="number"?e.height:0;return{width:t,height:n}}function F(r,e,t,n){let i=T(e),a=i.width>0?t/i.width:1,s=i.height>0?n/i.height:1,o=l=>({x:l.x*a,y:l.y*s});return{box:{x:r.box.x*a,y:r.box.y*s,width:r.box.width*a,height:r.box.height*s},...r.eyes!==void 0?{eyes:{left:o(r.eyes.left),right:o(r.eyes.right)}}:{},...r.nose!==void 0?{nose:o(r.nose)}:{},score:r.score}}function Rt(r){return r instanceof Error?r.message:String(r)}async function R(r){let e=r.preferred??xe,t=[];for(let n of e){if(n==="native"){let i=await Ce();if(i.ok)return new B(i.instance,ce(t));t.push(`native:${i.reason}`);continue}try{return await xt(U.create(r.v3AssetBaseUrl??Re,ce(t)),r.blazeInitTimeoutMs??Te)}catch(i){t.push(i instanceof z?"blaze:blaze_init_timeout":`blaze:${Rt(i)}`)}}throw new C(ce(t)??"no_tier_available")}function ce(r){return r.length>0?r.join("; "):void 0}var z=class extends Error{};function xt(r,e){return new Promise((t,n)=>{let i=setTimeout(()=>{n(new z(`init exceeded ${e}ms`)),r.then(a=>a.destroy(),()=>{})},e);r.then(a=>{clearTimeout(i),t(a)},a=>{clearTimeout(i),n(a)})})}var br=180,L=[100,190],wt=64;function we(r,e){return .299*(r[e]??0)+.587*(r[e+1]??0)+.114*(r[e+2]??0)}function X(r){let{data:e,width:t,height:n}=r,i=t*n;if(i===0)return 0;let a=0;for(let s=0;s<i;s+=1)a+=we(e,s*4);return a/i}function q(r){let{data:e,width:t,height:n}=r;if(t<3||n<3)return 0;let i=new Float32Array(t*n);for(let c=0;c<i.length;c+=1)i[c]=we(e,c*4);let a=0,s=0,o=0;for(let c=1;c<n-1;c+=1)for(let u=1;u<t-1;u+=1){let m=c*t+u,f=(i[m-t]??0)+(i[m-1]??0)+(i[m+1]??0)+(i[m+t]??0)-4*(i[m]??0);a+=f,s+=f*f,o+=1}if(o===0)return 0;let l=a/o,d=s/o-l*l;return Math.min(1,Math.max(0,d)/180)}function le(r){let e=X(r),[t,n]=L,i=e<t?t-e:e>n?e-n:0;return Math.max(0,1-i/wt)}var De=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}),x=r=>Math.min(1,Math.max(0,r)),w=class{constructor(e={}){this.p=0;this.lastTickAt=null;this.lastCenter=null;this.velocityEma=0;this.qWindow=[];this.lastSizeDirection="ideal";this.t={...De,...e}}reset(){this.p=0,this.lastTickAt=null,this.lastCenter=null,this.velocityEma=0,this.qWindow=[],this.lastSizeDirection="ideal"}tick(e){let{observation:t,quality:n,timestampMs:i}=e,a=this.lastTickAt===null?0:Math.max(0,(i-this.lastTickAt)/1e3);this.lastTickAt=i;let s={presence:0,centering:0,size:0,pose:0,sharpness:x(n.sharpness),exposure:x(n.exposure),motion:1};if(t!==null){s.presence=1;let c=this.geometryOf(t,e);s.centering=c.centering,s.size=c.size,s.pose=c.pose,s.motion=this.motionOf(c.center,c.iod,i)}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=x(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:i,q:o}),this.qWindow=this.qWindow.filter(c=>c.at>=i-this.t.READY_WINDOW_MS);let l=this.qWindow.map(c=>c.q);if(l.length>=3){let c=Math.min(...l),u=l.indexOf(c);l=l.filter((m,f)=>f!==u)}let d=this.p>=1&&l.every(c=>c>=this.t.Q_GOOD);return{at:i,q:o,p:this.p,factors:s,guidanceKey:this.guidanceOf(s,n,o),ready:d,accepted:o>=this.t.Q_GOOD}}geometryOf(e,t){let{box:n,eyes:i}=e,a={x:t.frameWidth/2,y:t.frameHeight/2},s=Math.min(t.frameWidth,t.frameHeight),o=i!==void 0?{x:(i.left.x+i.right.x)/2,y:(i.left.y+i.right.y)/2}:{x:n.x+n.width/2,y:n.y+n.height/2-this.t.BOX_EYE_OFFSET_FACTOR*n.height},l=i!==void 0?Math.hypot(i.right.x-i.left.x,i.right.y-i.left.y):this.t.IOD_BOX_PROXY_FACTOR*n.width,d=Math.hypot(o.x-a.x,o.y-a.y),c=l<=0?0:1-x(d/(this.t.CENTER_FALLOFF_IOD_MULTIPLE*l)),u=s>0?l/s:0;this.lastSizeDirection=u<this.t.SIZE_IDEAL_MIN?"far":u>this.t.SIZE_IDEAL_MAX?"close":"ideal";let m;u<this.t.SIZE_HARD_MIN||u>this.t.SIZE_HARD_MAX?m=0:u<this.t.SIZE_IDEAL_MIN?m=(u-this.t.SIZE_HARD_MIN)/(this.t.SIZE_IDEAL_MIN-this.t.SIZE_HARD_MIN):u>this.t.SIZE_IDEAL_MAX?m=(this.t.SIZE_HARD_MAX-u)/(this.t.SIZE_HARD_MAX-this.t.SIZE_IDEAL_MAX):m=1;let f=1;if(i!==void 0){let p=Math.abs(Math.atan2(i.right.y-i.left.y,i.right.x-i.left.x))*180/Math.PI;f=1-x(p/this.t.ROLL_MAX_DEG)}return{center:o,iod:l,centering:c,size:m,pose:f}}motionOf(e,t,n){let i=this.lastCenter;if(this.lastCenter={...e,at:n},i===null||t<=0)return 1;let a=(n-i.at)/1e3;if(a<=0)return 1;let s=Math.hypot(e.x-i.x,e.y-i.y)/t/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-x(this.velocityEma/this.t.MOTION_VELOCITY_IOD_PER_S)}guidanceOf(e,t,n){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(t);if(e.sharpness<this.t.GUIDE_SHARPNESS)return"fcv3.steady_camera";if(e.motion<this.t.GUIDE_MOTION)return"fcv3.hold_still";if(n<this.t.Q_GOOD){let i=[["size",this.sizeGuidance()],["centering","fcv3.center_face"],["pose","fcv3.straighten"],["exposure",this.exposureGuidance(t)],["sharpness","fcv3.steady_camera"],["motion","fcv3.hold_still"]],a=i[0];for(let s of i)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 t=(L[0]+L[1])/2;return e.meanLuma<t?"fcv3.more_light":"fcv3.too_bright"}};var Oe=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"})}),Dt=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 de(){let r=typeof navigator>"u"?void 0:navigator,e=!1;try{e=typeof WebAssembly<"u"&&WebAssembly.validate(Dt)}catch{e=!1}return{cores:r?.hardwareConcurrency??2,memGB:r?.deviceMemory??null,simd:e}}function me(r){let e=r.memGB??4;return r.cores<4||e<3?"LOW":r.cores>=8&&e>=6?"HIGH":"MID"}var ue=["LOW","MID","HIGH"],N=class{constructor(e){this.samples=[];this.adjusted=!1;this.current=e}get deviceClass(){return this.current}get profile(){return Oe[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 t=this.samples.reduce((n,i)=>n+i,0)/this.samples.length;if(t>70)this.current="LOW";else if(t<25){let n=ue.indexOf(this.current);this.current=ue[Math.min(ue.length-1,n+1)]??this.current}return this.current}};var G=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 t=()=>{this.running&&(this.frameCallbackId=e.requestVideoFrameCallback?.(()=>{this.frameCallbackId=null,this.now()-this.lastRunAt>=this.periodMs&&this.tick(),t()}))};t();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((t,n)=>t+n,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 Ie="0.1.0-rc.11";var Ae="sekyro.did",Pe;function Fe(){let r=globalThis.crypto;try{if(typeof r?.randomUUID=="function")return r.randomUUID()}catch{}try{if(typeof r?.getRandomValues=="function"){let e=r.getRandomValues(new Uint8Array(16));return Array.from(e,t=>t.toString(16).padStart(2,"0")).join("")}}catch{}}function Ot(){try{let r=localStorage.getItem(Ae);if(r)return r;let e=Fe();return e!==void 0&&localStorage.setItem(Ae,e),e}catch{return Pe??(Pe=Fe()),Pe}}async function It(){let r=globalThis.crypto?.subtle;if(!r)return"";let e=navigator,t=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]),n=await r.digest("SHA-256",new TextEncoder().encode(t));return Array.from(new Uint8Array(n),i=>i.toString(16).padStart(2,"0")).join("").slice(0,32)}function At(r){let e=new TextEncoder().encode(r),t="";for(let n of e)t+=String.fromCharCode(n);return btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function Pt(r){let e,t;return{timezone(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone?.slice(0,64)||void 0}catch{return}},noteCameraLabel(n){n&&(e=n.slice(0,128))},async deviceHeader(){try{t??(t=It().catch(()=>""));let n=[];navigator.webdriver&&n.push("webdriver"),/HeadlessChrome/.test(navigator.userAgent)&&n.push("headless");let i=await t,a=Ot(),s={v:1,platform:"web",sdk:r.sdk.slice(0,64),ids:[...a?[{kind:"web_local",value:a.slice(0,128)}]:[],...i?[{kind:"web_fp",value:i}]:[]],screen:{w:screen.width,h:screen.height,dpr:globalThis.devicePixelRatio??1},...e?{cameraLabel:e}:{},...n.length?{signals:n}:{}};return At(JSON.stringify(s))}catch{return}}}}var pe=Symbol.for("sekyro.web.clientContext"),fe=globalThis,Ft=fe[pe]??(fe[pe]=Pt({sdk:`@sekyro/web@${Ie}`}));function Le(r){try{let e=r.getVideoTracks?.()[0];e&&Ft.noteCameraLabel(e.label)}catch{}}var Lt=["obs","manycam","virtual","snap camera","xsplit","droidcam","iriun","camo"],Nt=[/^(front|back|rear)( [a-z ]+)? camera$/i,/^camera2? ?\d+, facing (front|back|external)/i,/facetime/i,/\b(integrated|built-in|builtin) (web)?cam(era)?\b/i,/\b(hd )?web ?cam\b/i,/\([0-9a-f]{4}:[0-9a-f]{4}\)\s*$/i];function Gt(r){let e=(r??"").trim().toLowerCase();return e.length===0?"unknown":Lt.some(t=>e.includes(t))?"known_virtual":Nt.some(t=>t.test(e))?"platform":"unknown"}function Ne(r){if(typeof r!="function")return!1;try{return/\{\s*\[native code\]\s*\}\s*$/.test(Function.prototype.toString.call(r))}catch{return!1}}function Vt(r=globalThis){return Ne(r.navigator?.mediaDevices?.getUserMedia)&&Ne(r.MediaStreamTrack?.prototype?.getSettings)}async function Wt(r,e=globalThis){let t=e.crypto?.subtle?.digest;if(typeof t=="function")try{let n=new Uint8Array(await t.call(e.crypto?.subtle,"SHA-256",new TextEncoder().encode(r)));return Array.from(n.subarray(0,8),i=>i.toString(16).padStart(2,"0")).join("")}catch{return}}async function Ge(r,e=globalThis){let t={};try{t=typeof r.getSettings=="function"?r.getSettings()??{}:{}}catch{t={}}let n={};if((t.facingMode==="user"||t.facingMode==="environment"||t.facingMode==="left"||t.facingMode==="right")&&(n.facingMode=t.facingMode),typeof t.frameRate=="number"&&Number.isFinite(t.frameRate)&&(n.frameRate=t.frameRate),typeof t.width=="number"&&Number.isFinite(t.width)&&(n.width=t.width),typeof t.height=="number"&&Number.isFinite(t.height)&&(n.height=t.height),typeof t.deviceId=="string"&&t.deviceId.length>0){let a=await Wt(t.deviceId,e);a!==void 0&&(n.deviceIdHash=a)}let i;try{i=r.label}catch{i=void 0}return{trackSettings:n,capabilitiesPresent:typeof r.getCapabilities=="function",labelClass:Gt(i),prototypesIntact:Vt(e)}}var he=r=>Math.round(r*100)/100;function Ve(r){let e=r,t=typeof e?.requestVideoFrameCallback=="function",n=null,i=null,a=0,s=0,o=0,l=0,d=0,c=0,u=()=>{!t||e?.requestVideoFrameCallback===void 0||(n=e.requestVideoFrameCallback((m,f)=>{if(n=null,!t)return;let p=f.presentationTime;if(i!==null){let h=p-i.presentationTimeMs;s+=1;let g=h-o;o+=g/s,l+=g*(h-o)}typeof f.captureTime=="number"&&Number.isFinite(f.captureTime)&&(d+=p-f.captureTime,c+=1),a+=1,i={mediaTimeMs:f.mediaTime*1e3,presentationTimeMs:p},u()}))};return u(),{latest:()=>i,stats:()=>({n:a,meanGapMs:s===0?0:he(o),stdGapMs:s<2?0:he(Math.sqrt(l/(s-1))),captureLatencyMs:c===0?null:he(d/c)}),stop:()=>{t&&(t=!1,n!==null&&e?.cancelVideoFrameCallback?.(n),n=null)}}}function We(r,e,t){return{...r,rvfc:e,rampPainter:t}}var Ht=["rose","peach","sand","mint","sky","lilac"];var Kt=4,Ut=4;function Bt(r){if(typeof r!="object"||r===null)return!1;let e=r;if(typeof e.nonce!="string"||e.nonce.length===0||!Array.isArray(e.colours)||e.colours.length!==3||!e.colours.every(n=>Ht.includes(n))||!Array.isArray(e.onsetsMs)||e.onsetsMs.length!==3)return!1;let t=-1;for(let n of e.onsetsMs){if(typeof n!="number"||!Number.isFinite(n)||n<=t||n>=2e3)return!1;t=n}return!0}function He(r,e){let t=e.now??(()=>performance.now()),n=Bt(r)?r:void 0,i=[],a=null,s=null,o=null,l=!1,d=null,c=p=>{d=p;try{e.paint(p)}catch{}},u=p=>{let h=e.frames?.()??null;return h!==null&&o!==null?h.mediaTimeMs+(p-h.presentationTimeMs)-o:p-(s??p)},m=(p,h,g=0)=>{if(l)return;let E=Math.max(0,p-u(t()));a=setTimeout(()=>{if(a=null,!l){if(g<Kt&&u(t())<p-Ut){m(p,h,g+1);return}h()}},E)},f=p=>{if(n!==void 0){if(p>=3){m(2e3,()=>c(null));return}m(n.onsetsMs[p],()=>{let h=u(t());if(h>2e3){d!==null&&c(null);return}let g=n.colours[p];c(g);let E=i.length===0?0:i[i.length-1].tMs;i.push({tMs:Math.max(E,Math.round(h)),colour:g}),f(p+1)})}};return{started(p){if(n===void 0||l||s!==null)return;s=p;let h=e.frames?.()??null;o=h===null?null:h.mediaTimeMs+(p-h.presentationTimeMs),f(0)},stop(){l||(l=!0,a!==null&&clearTimeout(a),a=null,d!==null&&c(null))},report(){return n===void 0?void 0:{nonce:n.nonce,rendered:[...i]}}}}var M=1;function Ke(){return typeof OffscreenCanvas=="function"&&typeof createImageBitmap=="function"&&typeof Worker=="function"}function zt(r,e={}){let t=e.createDetector??R,n=null;r.onmessage=i=>{let a=i.data;if(a.v!==M){a.bitmap?.close?.();return}if(a.type==="init"){t(a.options).then(s=>{n=s;let o={v:M,type:"ready",tier:s.tier,...s.fallbackReason!==void 0?{fallbackReason:s.fallbackReason}:{}};r.postMessage(o)});return}if(a.type==="detect"){let s=o=>{let l={v:M,type:"result",id:a.id,observation:o};r.postMessage(l),a.bitmap.close?.()};if(n===null){s(null);return}n.detect(a.bitmap,a.streamWidth,a.streamHeight).then(s,()=>s(null))}}}typeof self<"u"&&typeof self.importScripts=="function"&&zt(self);var Y=class r{constructor(e,t){this.pending=new Map;this.nextId=1;this.worker=e,this.tier=t.tier,t.fallbackReason!==void 0&&(this.fallbackReason=t.fallbackReason),e.addEventListener("message",n=>{let i=n.data;if(i.v!==M||i.type!=="result")return;let a=this.pending.get(i.id);this.pending.delete(i.id),a?.(i.observation)})}static create(e,t,n=1e4){return new Promise((i,a)=>{let s=setTimeout(()=>{e.removeEventListener("message",o),e.terminate(),a(new Error(`worker detector not ready within ${n}ms`))},n),o=d=>{let c=d.data;c.v!==M||c.type!=="ready"||(clearTimeout(s),e.removeEventListener("message",o),i(new r(e,c)))};e.addEventListener("message",o);let l={v:M,type:"init",options:t};e.postMessage(l)})}async detect(e,t,n){let i;try{typeof ImageBitmap<"u"&&e instanceof ImageBitmap?i=e:typeof createImageBitmap=="function"?i=await createImageBitmap(e):i=e}catch{return null}let a=this.nextId;return this.nextId+=1,new Promise(s=>{this.pending.set(a,s);let o={v:M,type:"detect",id:a,bitmap:i,streamWidth:t,streamHeight:n};this.worker.postMessage(o,[i])})}destroy(){for(let e of this.pending.values())e(null);this.pending.clear(),this.worker.terminate()}};var Xt=["size","centering","pose","exposure","sharpness","motion"];function Ue(r){if(r.accepted)return null;if(r.factors.presence<=0)return"no_face";let e="size";for(let t of Xt)r.factors[t]<r.factors[e]&&(e=t);return e}var D=class{constructor(){this.blocked={};this.acceptedMs=0;this.ticks=0;this.lastAt=null}record(e){let t=this.lastAt===null?0:Math.max(0,e.at-this.lastAt);this.lastAt=e.at,this.ticks+=1;let n=Ue(e);if(n===null){this.acceptedMs+=t;return}let i=this.blocked[n]??{count:0,ms:0};i.count+=1,i.ms+=t,this.blocked[n]=i}summary(){let e={};for(let[t,n]of Object.entries(this.blocked))e[t]={count:n.count,ms:Math.round(n.ms)};return{blocked:e,acceptedMs:Math.round(this.acceptedMs),ticks:this.ticks}}};var tt=1e3,Q="fcv3.hold_upright",rt=200,j=4,nt=600,it=1e3,Je={sharpness:1,exposure:1,meanLuma:128};function Jt(r,e){return e.width=r.videoWidth,e.height=r.videoHeight,e.getContext("2d").drawImage(r,0,0),new Promise((t,n)=>e.toBlob(i=>i?t(i):n(new Error("empty-keyframe")),"image/jpeg",.92))}function er(){return K()==="phone"}var ye=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.uprightGuard=!1;this.trackProvenance=null;this.ramp=null;this.snapshotCanvas=null;this.options=e,this.facing=e.facingMode??"user"}get state(){return this.stateValue}on(e,t){let n=this.handlers.get(e);return n||(n=new Set,this.handlers.set(e,n)),n.add(t),()=>n?.delete(t)}emit(e,t){for(let n of[...this.handlers.get(e)??[]])n(t)}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:t}=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.uprightGuard=(t.isPhone??er)(),this.setState("preflight");let n=re();if(n!=="OK"){this.fail(n==="INSECURE_CONTEXT"?"insecure":"unsupported");return}this.setState("acquiring");let i=t.getUserMedia??(d=>navigator.mediaDevices.getUserMedia(d)),a;this.cameraRequestedAt=this.now();try{a=await i(ae(se(),this.facing))}catch(d){if(e!==this.attempt)return;this.fail(te(d));return}if(Le(a),e!==this.attempt){for(let d of a.getTracks())d.stop();return}this.stream=a;let s=a.getVideoTracks?.()[0];if(this.trackProvenance=s===void 0?null:Ge(s).catch(()=>null),this.facing=oe(a)??this.facing,t.video.srcObject=a,await t.video.play().catch(()=>{}),e!==this.attempt)return;if(this.cameraReadyAt=this.now(),this.detector===null){let d={v3AssetBaseUrl:t.v3AssetBaseUrl},c=t.createDetector??(t.createWorker!==void 0&&Ke()?async()=>{try{return await Y.create(t.createWorker(),d)}catch{return R(d)}}:()=>R(d)),u;try{u=await c()}catch(m){e===this.attempt&&this.fail("models",m instanceof C?m.fallbackReason:rr(m));return}if(e!==this.attempt){u.destroy();return}this.detector=u,this.options.telemetry?.({type:"detector",tier:u.tier,fallbackReason:u.fallbackReason})}let o=de(),l=t.deviceClass??me(o);this.profiler=new N(l),this.options.telemetry?.({type:"profile",staticClass:l,activeClass:this.profiler.deviceClass,simd:o.simd}),this.gate=new w(t.thresholds??{}),this.blockStats=new D,this.lastGateSnapshotAt=this.now(),t.rankKeyframes?.()&&Promise.resolve().then(()=>($e(),je)).then(d=>ge=d,()=>{}),this.setState("positioning"),this.positioningStartedAt=this.now(),this.startScheduler(e)}get animations(){return this.profiler?.profile.animations??"full"}startScheduler(e){let t=this.profiler;if(t===null)return;if(this.scheduler!==null){let i=this.scheduler.stats();this.carriedDegrade+=i.degradeCount,i.meanDetectMs>0&&this.carriedMeans.push(i.meanDetectMs),this.scheduler.stop()}let n=new G({cadenceHz:t.profile.cadenceHz,video:this.options.video,now:this.options.now,run:()=>this.detectTick(e)});this.scheduler=n,n.start()}async detectTick(e){let{detector:t,gate:n,profiler:i}=this,a=this.options.video;if(e!==this.attempt||t===null||n===null||i===null||this.fired||a.videoWidth===0)return;if(this.isLandscape()){this.holdUpright(e);return}let s=i.deviceClass,o=this.now(),l=this.options.makeSnapshot?.(a,i.profile.inputWidth)??this.defaultSnapshot(a,i.profile.inputWidth),d=null;try{d=await t.detect(l,a.videoWidth,a.videoHeight)}catch{d=null}if(e!==this.attempt||this.fired)return;i.record(this.now()-o),i.deviceClass!==s&&this.startScheduler(e);let c=d===null?Je:this.options.measureQuality?.(a,d.box)??this.defaultQuality(a,d.box),u=n.tick({timestampMs:this.now(),observation:d,quality:c,frameWidth:a.videoWidth,frameHeight:a.videoHeight});u.accepted&&this.faceAcquiredAt===null&&(this.faceAcquiredAt=u.at),this.blockStats?.record(u),!u.ready&&u.at-this.lastGateSnapshotAt>=tt&&(this.lastGateSnapshotAt=u.at,this.reportGate(!1)),this.emit("checks",{engine:"v3",progress:u.p,q:u.q,factors:u.factors,attempt:e}),u.guidanceKey!==this.lastGuidanceKey&&(this.lastGuidanceKey=u.guidanceKey,this.emit("guidance",{key:u.guidanceKey})),u.ready&&this.stateValue==="positioning"&&(this.fired=!0,this.captureCompleteAt=u.at,this.fire(e))}async fire(e){let{options:t}=this,n=this.scheduler;n?.stop(),this.reportGate(!0);let i=n?.stats()??{degradeCount:0,meanDetectMs:0},a=[...this.carriedMeans,...i.meanDetectMs>0?[i.meanDetectMs]:[]];t.telemetry?.({type:"fired",timeToGateMs:this.now()-this.positioningStartedAt,degradeCount:this.carriedDegrade+i.degradeCount,meanDetectMs:a.length===0?0:a.reduce((y,S)=>y+S,0)/a.length});let s=t.mode??"clip",o=t.rankKeyframes?.()&&ge?ge.default(this,e).catch(()=>this.collectKeyframes(e)):this.collectKeyframes(e);if(s==="photo"){let y=this.watchRotation(e,null),S=await o;if(y(),e!==this.attempt)return;if(S===null){this.fail("generic");return}let at=await this.provenance({n:0,meanGapMs:0,stdGapMs:0,captureLatencyMs:null},!1);if(e!==this.attempt)return;this.finishCapture({keyframe:S.blob,previewDataUrl:S.previewDataUrl,...at});return}this.setState("recording");let l=t.createRecorder?.()??new P,d=this.stream;if(d===null){this.fail("generic");return}let c=Ve(t.video),u=t.screenRamp?.(),m=u!==void 0,f=He(u,{paint:y=>{(y===null||e===this.attempt)&&this.emit("ramp",{colour:y})},now:()=>this.now(),frames:c.latest});this.ramp=f;let p=()=>{c.stop(),f.stop(),this.ramp===f&&(this.ramp=null)},h=this.watchRotation(e,l),g=null;o.then(y=>{g=y},()=>{});let E=()=>{e===this.attempt&&g!==null&&this.emit("frozen",{previewDataUrl:g.previewDataUrl})},v,_;try{[v,_]=await Promise.all([l.record(d,E,()=>f.started(this.now())),o])}catch(y){if(h(),p(),e!==this.attempt)return;let S=y.kind;this.fail(S==="cliptoolarge"?"cliptoolarge":"recorder");return}h();let k=c.stats();if(p(),e!==this.attempt)return;if(A(v.blob)){this.fail("cliptoolarge");return}if(_===null){this.fail("generic");return}let I=f.report(),$=await this.provenance(k,m);e===this.attempt&&this.finishCapture({clip:v.blob,clipMimeType:v.mimeType,keyframe:_.blob,previewDataUrl:_.previewDataUrl,...I!==void 0&&I.rendered.length>0?{screenRamp:I}:{},...$})}async provenance(e,t){let n=this.trackProvenance;if(n===null)return{};let i,a=new Promise(o=>{i=setTimeout(()=>o(null),it)}),s=await Promise.race([n,a]);return clearTimeout(i),s===null?{}:{provenance:We(s,e,t)}}isLandscape(){let e=this.options.video;return this.uprightGuard&&e.videoWidth>e.videoHeight}holdUpright(e){this.gate?.reset(),this.emit("checks",{engine:"v3",progress:0,q:0,factors:{presence:0,centering:0,size:0,pose:0,sharpness:0,exposure:0,motion:0},attempt:e}),this.lastGuidanceKey!==Q&&(this.lastGuidanceKey=Q,this.emit("guidance",{key:Q}))}watchRotation(e,t){if(!this.uprightGuard)return()=>{};let n=this.options.video,i=()=>{if(e!==this.attempt||t!==null&&this.stateValue!=="recording"){o();return}n.videoWidth>0&&this.isLandscape()&&(o(),this.abortRecording(e,t))},a=setInterval(i,rt);n.addEventListener?.("resize",i);let s=!1;function o(){s||(s=!0,clearInterval(a),n.removeEventListener?.("resize",i))}return o}abortRecording(e,t){if(e!==this.attempt)return;this.attempt+=1;let n=this.attempt;try{t?.stop()}catch{}this.ramp?.stop(),this.ramp=null,this.fired=!1,this.captureCompleteAt=null,this.gate=new w(this.options.thresholds??{}),this.blockStats=new D,this.lastGateSnapshotAt=this.now(),this.lastGuidanceKey=null,this.setState("positioning"),this.positioningStartedAt=this.now(),this.holdUpright(n),this.startScheduler(n)}async collectKeyframes(e){let t=this.options.captureKeyframe??(a=>this.defaultKeyframe(a)),n=nt/(j-1),i=null;for(let a=0;a<j;a+=1){if(e!==this.attempt)return i;try{let s=await t(this.options.video);(i===null||s.sharpness>i.sharpness)&&(i=s)}catch{}a<j-1&&await tr(n)}return i}finishCapture(e){this.stopTracks(),this.setState("captured");let t=this.captureTiming();this.emit("artifacts",t===void 0?e:{...e,timing:t})}captureTiming(){let e={},t=(n,i,a)=>{i!==null&&a!==null&&(e[n]=Math.max(0,Math.round(a-i)))};return t("cameraReadyMs",this.cameraRequestedAt,this.cameraReadyAt),t("faceAcquireMs",this.cameraReadyAt,this.faceAcquiredAt),t("captureMs",this.faceAcquiredAt,this.captureCompleteAt),Object.keys(e).length>0?e:void 0}async defaultKeyframe(e){let t=document.createElement("canvas"),n=await(this.facing==="user"?ne:Jt)(e,t),i=t.toDataURL("image/jpeg",.92);return{blob:n,previewDataUrl:i,sharpness:this.centerSharpness(e)}}defaultSnapshot(e,t){try{let n=this.snapshotCanvas??document.createElement("canvas"),i=t/Math.max(1,e.videoWidth),a=Math.max(1,Math.round(e.videoWidth*i)),s=Math.max(1,Math.round(e.videoHeight*i)),o=n.getContext("2d");return o===null?e:(n.width!==a&&(n.width=a),n.height!==s&&(n.height=s),o.drawImage(e,0,0,a,s),this.snapshotCanvas=n,n)}catch{return e}}defaultQuality(e,t){let n=et(e,t,96);return n===null?Je:{sharpness:q(n),exposure:le(n),meanLuma:X(n)}}centerSharpness(e){let t=T(e),n=et(e,{x:t.width*.25,y:t.height*.25,width:t.width*.5,height:t.height*.5},96);return n===null?0:q(n)}teardownAttempt(){this.scheduler?.stop(),this.scheduler=null,this.reportGate(!0),this.gate=null,this.ramp?.stop(),this.ramp=null,this.stopTracks()}reportGate(e){let t=this.blockStats,n=this.profiler;if(t===null||n===null)return;let i=t.summary();e&&(this.blockStats=null),i.ticks!==0&&this.options.telemetry?.({type:"gate",final:e,activeClass:n.deviceClass,cadenceHz:n.profile.cadenceHz,...i})}stopTracks(){if(this.stream!==null){for(let e of this.stream.getTracks())e.stop();this.stream=null}}fail(e,t){this.scheduler?.stop(),this.reportGate(!0),this.stopTracks(),this.setState("error"),this.options.telemetry?.({type:"error",kind:e,fallbackReason:t}),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()}},ge;function tr(r){return new Promise(e=>setTimeout(e,r))}function rr(r){return r instanceof Error?r.message:String(r)}function et(r,e,t){try{let n=document.createElement("canvas"),i=t/Math.max(1,e.width);n.width=Math.max(1,Math.round(e.width*i)),n.height=Math.max(1,Math.round(e.height*i));let a=n.getContext("2d");return a===null?null:(a.drawImage(r,e.x,e.y,e.width,e.height,0,0,n.width,n.height),a.getImageData(0,0,n.width,n.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,HOLD_UPRIGHT_KEY,IN_CIRCLE_FACTOR,KEYFRAME_CANDIDATES,KEYFRAME_WINDOW_MS,MAX_CLIP_BYTES,MIME_CANDIDATES,PHONE_MAX_SHORT_SIDE,PROVENANCE_WAIT_MS,SHARP_REF,STOP_GRACE_MS,TIMESLICE_MS,UPRIGHT_WATCH_MS,V3_GATE_DEFAULTS,VIDEO_BPS,blockReasonOf,buildCaptureConstraints,buildLivenessV2FormData,cameraPreflight,captureMirroredKeyframe,classifyDevice,createDetector,detectFormFactor,detectIsMobile,errorCopy,exposure,extForMime,intrinsicSize,isClipTooLarge,isMediaRecorderSupported,mapGetUserMediaError,meanLuma,pickMimeType,probeDevice,sharpness,toStreamPixels,trackFacingMode,uiCopy});
@@ -1,7 +1,8 @@
1
- import { C as CameraErrorKind } from '../capture-session-v3-CmJw_bK0.cjs';
2
- export { a as CLIP_MS, b as CaptureArtifacts, c as CaptureErrorKind, d as CaptureSessionEvents, e as CaptureSessionV3, f as CaptureSessionV3Events, g as CaptureSessionV3Options, h as CaptureSessionV3StartOptions, i as CaptureState, j as CaptureTiming, k as ClipError, l as ClipErrorKind, m as ClipRecorder, n as ClipResult, D as DEFAULT_CLIP_MIME, o as DEVICE_PROFILES, p as DeviceClass, q as DeviceProbe, r as DeviceProfile, s as DeviceProfiler, E as EscalationClipArtifact, t as EscalationHook, F as FaceGateV3, G as GATE_SNAPSHOT_MS, u as GateBlockEntry, v as GateBlockReason, w as GateBlockStats, x as GateBlockSummary, y as GateChecks, H as HOLD_UPRIGHT_KEY, K as KEYFRAME_CANDIDATES, z as KEYFRAME_WINDOW_MS, M as MAX_CLIP_BYTES, A as MIME_CANDIDATES, S as STOP_GRACE_MS, T as TIMESLICE_MS, U as UPRIGHT_WATCH_MS, V as V3ChecksPayload, B as V3GateFactor, I as V3GateQuality, J as V3GateThresholds, L as V3GateTick, N as V3GateTickInput, O as V3TelemetryEvent, P as V3_GATE_DEFAULTS, Q as VIDEO_BPS, R as blockReasonOf, W as buildLivenessV2FormData, X as cameraPreflight, Y as classifyDevice, Z as extForMime, _ as isClipTooLarge, $ as isMediaRecorderSupported, a0 as mapGetUserMediaError, a1 as pickMimeType, a2 as probeDevice } from '../capture-session-v3-CmJw_bK0.cjs';
1
+ import { C as CameraErrorKind } from '../capture-session-v3-CCHws1mz.cjs';
2
+ export { a as CLIP_MS, b as CaptureArtifacts, c as CaptureErrorKind, d as CaptureSessionEvents, e as CaptureSessionV3, f as CaptureSessionV3Events, g as CaptureSessionV3Options, h as CaptureSessionV3StartOptions, i as CaptureState, j as CaptureTiming, k as ClipError, l as ClipErrorKind, m as ClipRecorder, n as ClipResult, D as DEFAULT_CLIP_MIME, o as DEVICE_PROFILES, p as DeviceClass, q as DeviceProbe, r as DeviceProfile, s as DeviceProfiler, E as EscalationClipArtifact, t as EscalationHook, F as FaceGateV3, G as GATE_SNAPSHOT_MS, u as GateBlockEntry, v as GateBlockReason, w as GateBlockStats, x as GateBlockSummary, y as GateChecks, H as HOLD_UPRIGHT_KEY, K as KEYFRAME_CANDIDATES, z as KEYFRAME_WINDOW_MS, M as MAX_CLIP_BYTES, A as MIME_CANDIDATES, P as PROVENANCE_WAIT_MS, S as STOP_GRACE_MS, T as TIMESLICE_MS, U as UPRIGHT_WATCH_MS, V as V3ChecksPayload, B as V3GateFactor, I as V3GateQuality, J as V3GateThresholds, L as V3GateTick, N as V3GateTickInput, O as V3TelemetryEvent, Q as V3_GATE_DEFAULTS, R as VIDEO_BPS, W as blockReasonOf, X as buildLivenessV2FormData, Y as cameraPreflight, Z as classifyDevice, _ as extForMime, $ as isClipTooLarge, a0 as isMediaRecorderSupported, a1 as mapGetUserMediaError, a2 as pickMimeType, a3 as probeDevice } from '../capture-session-v3-CCHws1mz.cjs';
3
3
  export { C as CENTERED_FACTOR, a as CIRCLE_RADIUS_FACTOR, F as FormFactor, I as IN_CIRCLE_FACTOR, P as PHONE_MAX_SHORT_SIDE, b as buildCaptureConstraints, d as detectFormFactor, c as detectIsMobile, t as trackFacingMode } from '../capture-constraints-B5omafmk.cjs';
4
4
  export { C as CreateDetectorOptions, D as DEFAULT_TIER_ORDER, a as DEFAULT_V3_ASSET_BASE_URL, b as Detector, c as DetectorLadderError, F as FaceObservation, d as createDetector, i as intrinsicSize, t as toStreamPixels } from '../detect-worker-DclNxkZT.cjs';
5
+ import '../types-BWyAHKt_.cjs';
5
6
 
6
7
  declare function captureMirroredKeyframe(video: HTMLVideoElement, canvas: HTMLCanvasElement, quality?: number): Promise<Blob>;
7
8
 
@@ -1,7 +1,8 @@
1
- import { C as CameraErrorKind } from '../capture-session-v3-DGG2stO6.js';
2
- export { a as CLIP_MS, b as CaptureArtifacts, c as CaptureErrorKind, d as CaptureSessionEvents, e as CaptureSessionV3, f as CaptureSessionV3Events, g as CaptureSessionV3Options, h as CaptureSessionV3StartOptions, i as CaptureState, j as CaptureTiming, k as ClipError, l as ClipErrorKind, m as ClipRecorder, n as ClipResult, D as DEFAULT_CLIP_MIME, o as DEVICE_PROFILES, p as DeviceClass, q as DeviceProbe, r as DeviceProfile, s as DeviceProfiler, E as EscalationClipArtifact, t as EscalationHook, F as FaceGateV3, G as GATE_SNAPSHOT_MS, u as GateBlockEntry, v as GateBlockReason, w as GateBlockStats, x as GateBlockSummary, y as GateChecks, H as HOLD_UPRIGHT_KEY, K as KEYFRAME_CANDIDATES, z as KEYFRAME_WINDOW_MS, M as MAX_CLIP_BYTES, A as MIME_CANDIDATES, S as STOP_GRACE_MS, T as TIMESLICE_MS, U as UPRIGHT_WATCH_MS, V as V3ChecksPayload, B as V3GateFactor, I as V3GateQuality, J as V3GateThresholds, L as V3GateTick, N as V3GateTickInput, O as V3TelemetryEvent, P as V3_GATE_DEFAULTS, Q as VIDEO_BPS, R as blockReasonOf, W as buildLivenessV2FormData, X as cameraPreflight, Y as classifyDevice, Z as extForMime, _ as isClipTooLarge, $ as isMediaRecorderSupported, a0 as mapGetUserMediaError, a1 as pickMimeType, a2 as probeDevice } from '../capture-session-v3-DGG2stO6.js';
1
+ import { C as CameraErrorKind } from '../capture-session-v3-DYrhYJoM.js';
2
+ export { a as CLIP_MS, b as CaptureArtifacts, c as CaptureErrorKind, d as CaptureSessionEvents, e as CaptureSessionV3, f as CaptureSessionV3Events, g as CaptureSessionV3Options, h as CaptureSessionV3StartOptions, i as CaptureState, j as CaptureTiming, k as ClipError, l as ClipErrorKind, m as ClipRecorder, n as ClipResult, D as DEFAULT_CLIP_MIME, o as DEVICE_PROFILES, p as DeviceClass, q as DeviceProbe, r as DeviceProfile, s as DeviceProfiler, E as EscalationClipArtifact, t as EscalationHook, F as FaceGateV3, G as GATE_SNAPSHOT_MS, u as GateBlockEntry, v as GateBlockReason, w as GateBlockStats, x as GateBlockSummary, y as GateChecks, H as HOLD_UPRIGHT_KEY, K as KEYFRAME_CANDIDATES, z as KEYFRAME_WINDOW_MS, M as MAX_CLIP_BYTES, A as MIME_CANDIDATES, P as PROVENANCE_WAIT_MS, S as STOP_GRACE_MS, T as TIMESLICE_MS, U as UPRIGHT_WATCH_MS, V as V3ChecksPayload, B as V3GateFactor, I as V3GateQuality, J as V3GateThresholds, L as V3GateTick, N as V3GateTickInput, O as V3TelemetryEvent, Q as V3_GATE_DEFAULTS, R as VIDEO_BPS, W as blockReasonOf, X as buildLivenessV2FormData, Y as cameraPreflight, Z as classifyDevice, _ as extForMime, $ as isClipTooLarge, a0 as isMediaRecorderSupported, a1 as mapGetUserMediaError, a2 as pickMimeType, a3 as probeDevice } from '../capture-session-v3-DYrhYJoM.js';
3
3
  export { C as CENTERED_FACTOR, a as CIRCLE_RADIUS_FACTOR, F as FormFactor, I as IN_CIRCLE_FACTOR, P as PHONE_MAX_SHORT_SIDE, b as buildCaptureConstraints, d as detectFormFactor, c as detectIsMobile, t as trackFacingMode } from '../capture-constraints-B5omafmk.js';
4
4
  export { C as CreateDetectorOptions, D as DEFAULT_TIER_ORDER, a as DEFAULT_V3_ASSET_BASE_URL, b as Detector, c as DetectorLadderError, F as FaceObservation, d as createDetector, i as intrinsicSize, t as toStreamPixels } from '../detect-worker-DclNxkZT.js';
5
+ import '../types-BWyAHKt_.js';
5
6
 
6
7
  declare function captureMirroredKeyframe(video: HTMLVideoElement, canvas: HTMLCanvasElement, quality?: number): Promise<Blob>;
7
8
 
@@ -1 +1 @@
1
- import{a as x,b as k,c as z,d as C,e as L,f as T,g as E,h as N,i as w,j as D,k as G,l as I,m as J,n as M,o as Q,p as W,q as X,r as Y}from"../chunk-SZ7YGNUZ.js";import{a as e,b as r,c as o,d as n,e as a,f as s,g as t,h as i}from"../chunk-FUHDOEBP.js";import{a as P,b as S,c as B,d as F}from"../chunk-POIQGEZM.js";import{a as c,b as p,c as u,d as f,e as m,f as d,g as l,h as v,i as y,j as g}from"../chunk-FHJ7HO3M.js";import{a as O,b as U,c as V,d as j,e as q}from"../chunk-FPXL63KZ.js";import"../chunk-BAGSM67V.js";import{a as R,b as h,c as b,d as A,e as H,f as K}from"../chunk-OKWG3PVH.js";var Z={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."}},_={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{i as CENTERED_FACTOR,s as CIRCLE_RADIUS_FACTOR,x as CLIP_MS,Y as CaptureSessionV3,L as ClipError,T as ClipRecorder,u as DEFAULT_CLIP_MIME,h as DEFAULT_TIER_ORDER,R as DEFAULT_V3_ASSET_BASE_URL,P as DEVICE_PROFILES,N as DetectScheduler,b as DetectorLadderError,F as DeviceProfiler,U as EXPOSURE_BAND,D as FaceGateV3,J as GATE_SNAPSHOT_MS,I as GateBlockStats,M as HOLD_UPRIGHT_KEY,t as IN_CIRCLE_FACTOR,W as KEYFRAME_CANDIDATES,X as KEYFRAME_WINDOW_MS,l as MAX_CLIP_BYTES,c as MIME_CANDIDATES,r as PHONE_MAX_SHORT_SIDE,O as SHARP_REF,z as STOP_GRACE_MS,k as TIMESLICE_MS,Q as UPRIGHT_WATCH_MS,w as V3_GATE_DEFAULTS,C as VIDEO_BPS,G as blockReasonOf,e as buildCaptureConstraints,g as buildLivenessV2FormData,m as cameraPreflight,E as captureMirroredKeyframe,B as classifyDevice,K as createDetector,o as detectFormFactor,n as detectIsMobile,Z as errorCopy,q as exposure,y as extForMime,A as intrinsicSize,v as isClipTooLarge,d as isMediaRecorderSupported,f as mapGetUserMediaError,V as meanLuma,p as pickMimeType,S as probeDevice,j as sharpness,H as toStreamPixels,a as trackFacingMode,_ as uiCopy};
1
+ import{a as x,b as k,c as z,d as C,e as L,f as T,k as E,l as N,m as w,n as D,o as G,p as I,q as J,r as M,s as Q,t as W,u as X,v as Y,w as Z}from"../chunk-HHCGQSD4.js";import{a as e,b as r,c as o,d as n,e as a,f as s,g as t,h as i}from"../chunk-FUHDOEBP.js";import{a as P,b as S,c as B,d as F}from"../chunk-POIQGEZM.js";import{a as c,b as p,c as u,d as f,e as m,f as d,g as l,h as v,i as y,j as g}from"../chunk-FHJ7HO3M.js";import{a as O,b as U,c as V,d as j,e as q}from"../chunk-FPXL63KZ.js";import"../chunk-LUKTHL6K.js";import{a as R,b as h,c as b,d as A,e as H,f as K}from"../chunk-OKWG3PVH.js";var _={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."}},$={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{i as CENTERED_FACTOR,s as CIRCLE_RADIUS_FACTOR,x as CLIP_MS,Z as CaptureSessionV3,L as ClipError,T as ClipRecorder,u as DEFAULT_CLIP_MIME,h as DEFAULT_TIER_ORDER,R as DEFAULT_V3_ASSET_BASE_URL,P as DEVICE_PROFILES,N as DetectScheduler,b as DetectorLadderError,F as DeviceProfiler,U as EXPOSURE_BAND,D as FaceGateV3,J as GATE_SNAPSHOT_MS,I as GateBlockStats,M as HOLD_UPRIGHT_KEY,t as IN_CIRCLE_FACTOR,W as KEYFRAME_CANDIDATES,X as KEYFRAME_WINDOW_MS,l as MAX_CLIP_BYTES,c as MIME_CANDIDATES,r as PHONE_MAX_SHORT_SIDE,Y as PROVENANCE_WAIT_MS,O as SHARP_REF,z as STOP_GRACE_MS,k as TIMESLICE_MS,Q as UPRIGHT_WATCH_MS,w as V3_GATE_DEFAULTS,C as VIDEO_BPS,G as blockReasonOf,e as buildCaptureConstraints,g as buildLivenessV2FormData,m as cameraPreflight,E as captureMirroredKeyframe,B as classifyDevice,K as createDetector,o as detectFormFactor,n as detectIsMobile,_ as errorCopy,q as exposure,y as extForMime,A as intrinsicSize,v as isClipTooLarge,d as isMediaRecorderSupported,f as mapGetUserMediaError,V as meanLuma,p as pickMimeType,S as probeDevice,j as sharpness,H as toStreamPixels,a as trackFacingMode,$ as uiCopy};
@@ -1 +1 @@
1
- import{u as a,v as b,w as c,x as d}from"./chunk-FFDB6LQN.js";import"./chunk-G6LKLN4U.js";import"./chunk-TDLIXFDT.js";import"./chunk-ETY6SAAZ.js";import"./chunk-HAO6EQTH.js";import"./chunk-SZ7YGNUZ.js";import"./chunk-FUHDOEBP.js";import"./chunk-POIQGEZM.js";import"./chunk-FHJ7HO3M.js";import"./chunk-FPXL63KZ.js";import"./chunk-BAGSM67V.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
+ import{u as a,v as b,w as c,x as d}from"./chunk-JDGEZ542.js";import"./chunk-G6LKLN4U.js";import"./chunk-TDLIXFDT.js";import"./chunk-IJLHPX35.js";import"./chunk-GT2ZLGF7.js";import"./chunk-HHCGQSD4.js";import"./chunk-FUHDOEBP.js";import"./chunk-POIQGEZM.js";import"./chunk-FHJ7HO3M.js";import"./chunk-FPXL63KZ.js";import"./chunk-LUKTHL6K.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 +1 @@
1
- import{j as a,k as b,l as c,m as d,n as e,o as f,p as g}from"./chunk-SEC64KZ3.js";import"./chunk-CJHMFPL6.js";import"./chunk-RI3E7GBN.js";import"./chunk-7ZCZY3ZP.js";import"./chunk-BPE5NSQ2.js";import"./chunk-GI3UFGRQ.js";import"./chunk-HAO6EQTH.js";import"./chunk-FUHDOEBP.js";import"./chunk-FHJ7HO3M.js";export{a as ANALYSIS_LONG_EDGE,c as PORTRAIT_JPEG_QUALITY,b as STILL_MAX_HEIGHT,f as createPortraitCaptureInternal,d as defaultGrabber,e as observe,g as warmPortraitCapture};
1
+ import{j as a,k as b,l as c,m as d,n as e,o as f,p as g}from"./chunk-73M7LS4H.js";import"./chunk-CJHMFPL6.js";import"./chunk-RI3E7GBN.js";import"./chunk-7ZCZY3ZP.js";import"./chunk-BPE5NSQ2.js";import"./chunk-GI3UFGRQ.js";import"./chunk-GT2ZLGF7.js";import"./chunk-FUHDOEBP.js";import"./chunk-FHJ7HO3M.js";export{a as ANALYSIS_LONG_EDGE,c as PORTRAIT_JPEG_QUALITY,b as STILL_MAX_HEIGHT,f as createPortraitCaptureInternal,d as defaultGrabber,e as observe,g as warmPortraitCapture};
@@ -1,6 +1,7 @@
1
1
  import { b as Detector } from './detect-worker-DclNxkZT.js';
2
- import { A as AcceptedDocumentType, Z as NationalEidOption, af as StepSection, j as HostedBranding, a6 as PlanSectionView, a3 as PlanChoiceKind, d as ContactChannel, a as CheckReason, T as IdentityMethod, E as EidAfterPass, U as IdentitySummarySource, s as HostedIcaoPolicy, R as IcaoReportEntry, K as IcaoCaptureTuning, B as HostedSessionView, G as HostedStepView, a7 as PlanStepView, P as IcaoGateSummary, Q as IcaoGateUpdate, C as CaptureMode, ac as SessionFailureReason, Y as MethodChoiceView, J as HostedVoiceView, ax as Point, aT as PersonMask, ah as Box, ap as IcaoFrameObservation, aU as HostedClient, aV as AttestationInput, c as CheckType, aa as PortraitIcaoInput, aq as IcaoGate } from './icao-gate-terzKYD7.js';
3
- import { i as CaptureState$1, f as CaptureSessionV3Events, g as CaptureSessionV3Options, c as CaptureErrorKind$1, p as DeviceClass, b as CaptureArtifacts, I as V3GateQuality, O as V3TelemetryEvent } from './capture-session-v3-DGG2stO6.js';
2
+ import { A as AcceptedDocumentType, a3 as NationalEidOption, ap as StepSection, r as HostedBranding, ac as PlanSectionView, a9 as PlanChoiceKind, l as ContactChannel, j as CheckReason, ai as RetakeHint, Z as IdentityMethod, E as EidAfterPass, _ as IdentitySummarySource, z as HostedIcaoPolicy, Y as IcaoReportEntry, X as IcaoCaptureTuning, H as HostedSessionView, U as HostedStepView, ad as PlanStepView, h as CaptureMode, al as ScreenRampReport, i as CaptureProvenance, S as ScreenRampColour, am as SessionFailureReason, ar as VerificationLevel, aq as VerificationAssurance, a2 as MethodChoiceView, b as CameraUnavailableCause, W as HostedVoiceView, aj as ScreenRampChallenge, av as PersonMask, aw as AttestationInput, e as CheckType, ag as PortraitIcaoInput } from './types-BWyAHKt_.js';
3
+ import { i as CaptureState$1, f as CaptureSessionV3Events, g as CaptureSessionV3Options, c as CaptureErrorKind$1, p as DeviceClass, b as CaptureArtifacts, I as V3GateQuality, O as V3TelemetryEvent } from './capture-session-v3-DYrhYJoM.js';
4
+ import { c as IcaoGateSummary, d as IcaoGateUpdate, P as Point, e as Box, j as IcaoFrameObservation, N as HostedClient, k as IcaoGate } from './icao-gate-Bw5sQVlt.js';
4
5
 
5
6
  declare const ISSUER_CODES: readonly string[];
6
7
 
@@ -66,9 +67,18 @@ interface StepContext {
66
67
  progress: PlanSectionView[];
67
68
  /** The step's in-lane switch (C4 client rule §5 item 6); absent without an open choice. */
68
69
  switchable?: InLaneSwitch;
70
+ /** Spec 2026-10-29 §6.7: the session's copy set (`view.purpose`; `identity` from an older backend). */
71
+ purpose: "human" | "identity";
72
+ /**
73
+ * Spec 2026-10-29 §3.4: a flow fallback takes over a missing camera at the live step (`view.cameraUnavailableHandled`).
74
+ * Absent otherwise: then only a `human` session offers "continue without a camera".
75
+ */
76
+ cameraUnavailableHandled?: true;
69
77
  }
70
78
  interface StepAttempts {
71
79
  reason?: CheckReason;
80
+ /** Liveness v7 §5.2: what to change for the next capture, when the API reports it (prefer `hints.*` copy). */
81
+ retakeHint?: RetakeHint;
72
82
  attemptsRemaining: number;
73
83
  attemptsExhausted: boolean;
74
84
  }
@@ -738,6 +748,14 @@ interface CapturedArtifacts {
738
748
  formFactor?: "phone" | "tablet" | "desktop";
739
749
  /** The capture mode the attempt ran in ({@link LivenessCaptureHandle.captureMode}). Always set by the SDK. */
740
750
  mode?: CaptureMode;
751
+ /**
752
+ * Liveness v7 §4.4: the screen ramp rendered against the session's issued challenge, stamped on the clip's own
753
+ * timeline. Present only when a challenge was issued, the capture is `self` and clip mode, and a host painted the
754
+ * `ramp` event. Forwarded as `input.capture.screenRamp`.
755
+ */
756
+ screenRamp?: ScreenRampReport;
757
+ /** Liveness v7 §4.5 item 2: how the capture was made (track settings, label class, frame statistics, prototype check). */
758
+ provenance?: CaptureProvenance;
741
759
  }
742
760
  /** Capture engine identifier carried on {@link CapturedArtifacts.engine}. */
743
761
  type CaptureEngineId = "v1" | "v3";
@@ -752,6 +770,12 @@ interface CaptureError {
752
770
  */
753
771
  retryable: boolean;
754
772
  }
773
+
774
+ /**
775
+ * The cause a camera failure reports (2026-10-30): `permission` is `denied`; `notfound`, `insecure` and `unsupported`
776
+ * are `no_camera`; any other kind (`inuse`, `generic`) is not a missing camera and maps to nothing.
777
+ */
778
+ declare function cameraUnavailableCauseOf(kind: CaptureErrorKind): CameraUnavailableCause | undefined;
755
779
  /** Event map of a {@link LivenessCaptureHandle}. */
756
780
  interface LivenessCaptureEvents {
757
781
  /** Every state transition. */
@@ -779,6 +803,17 @@ interface LivenessCaptureEvents {
779
803
  profile: {
780
804
  animations: "full" | "reduced";
781
805
  };
806
+ /**
807
+ * Liveness v7 §4.4: paint a full-viewport layer this colour (`screenRampColourValue(colour)`), or clear it
808
+ * (`null`). Fires while the clip records, at the onsets the session's challenge issued; at most four times per
809
+ * recording. Subscribing is the acknowledgement: the engine runs the ramp only when a listener is bound when the
810
+ * recording starts, and the stamps it reports describe exactly these calls. `@sekyro/react` paints it; a host on
811
+ * `@sekyro/web` alone paints it itself (a `position: fixed; inset: 0` element behind its chrome) or leaves the
812
+ * event unbound. Never fires in an assisted capture or a keyframe-only capture.
813
+ */
814
+ ramp: {
815
+ colour: ScreenRampColour | null;
816
+ };
782
817
  }
783
818
  /** Which camera to open: the selfie camera (`'user'`) or the rear one (`'environment'`). */
784
819
  type CameraFacing = "user" | "environment";
@@ -900,11 +935,27 @@ interface VerificationResult {
900
935
  * the parked check after this one, for the host's coaching copy.
901
936
  */
902
937
  attemptsRemaining?: number;
938
+ /**
939
+ * `retry` on a liveness step (liveness v7 §5.2): what to change for the next
940
+ * capture, when the API reports it. Show `hints.<retakeHint>` copy instead of
941
+ * the reason's generic text; absent on older APIs and on decisive results.
942
+ */
943
+ retakeHint?: RetakeHint;
903
944
  /**
904
945
  * ISO-8601 time from which this device may verify again — set on a
905
946
  * `rejected` result with reason `device_cooldown` (profile v2 step 4).
906
947
  */
907
948
  retryAfter?: string;
949
+ /**
950
+ * What the session proved (`approved`, `rejected`, `review`), when the API
951
+ * reports it: `1` a live person, `2` their identity, `3` corroborated, `0`
952
+ * rejected. A display hint: confirm on your server with the result token.
953
+ */
954
+ level?: VerificationLevel;
955
+ /** How the level was proved, when the API reports it. */
956
+ assurance?: VerificationAssurance;
957
+ /** The subject (person) the session is linked to, when known. */
958
+ subjectId?: string;
908
959
  }
909
960
  /**
910
961
  * `on('busy')` payload: the model service answered
@@ -915,8 +966,11 @@ interface VerificationBusy {
915
966
  attempt: number;
916
967
  retryAfterSeconds: number;
917
968
  }
918
- /** Consent locale picklist (mirrors the backend HostedConsentSchema). */
919
- type VerificationLocale = "ar" | "fr" | "en";
969
+ /**
970
+ * Consent locale picklist (mirrors the backend HostedConsentSchema): the six end-user locales (spec 2026-10-29 §9).
971
+ * A backend older than Plan C accepts ar/fr/en only.
972
+ */
973
+ type VerificationLocale = "ar" | "fr" | "en" | "es" | "pt" | "de";
920
974
  /** Options of {@link createVerification}. */
921
975
  interface VerificationOptions {
922
976
  /** The session's client token (from `POST /api/v2/sessions` → `client_token`). */
@@ -984,6 +1038,18 @@ interface Verification {
984
1038
  * `RangeError` when the session offers no such option.
985
1039
  */
986
1040
  selectMethod(method: IdentityMethod): Promise<void>;
1041
+ /**
1042
+ * Spec 2026-10-29 §3.4: the device has no usable camera (denied or absent) and the person ends the live step
1043
+ * without a capture. Records consent when needed, then `POST /hosted/camera-unavailable`: the server fails the
1044
+ * liveness step with `camera_unavailable` (no attempt, nothing billed) and the runner shows what the flow chose (a
1045
+ * fallback step, else the result at level 0). A 409 `check_out_of_order` (the live step is no longer the current one)
1046
+ * re-reads the view and resolves; other failures reject with the typed `HostedApiError`. Optional so custom / older
1047
+ * `Verification` implementations stay valid:
1048
+ * without it, offer no "continue without a camera" action.
1049
+ * `cause` (2026-10-30) says why: `denied` when the permission was refused, `no_camera` otherwise; the server
1050
+ * records it under the same reason. Omit it when unknown.
1051
+ */
1052
+ reportCameraUnavailable?(cause?: CameraUnavailableCause): Promise<void>;
987
1053
  /**
988
1054
  * The session's pending liveness step must be captured on a phone
989
1055
  * (`HostedStepView.requiresMobile`, profile v2 step 4 automatic decisions)
@@ -1282,7 +1348,13 @@ rankKeyframes?: () => boolean,
1282
1348
  * Who films the face (spec 2026-10-28 §4.3): createVerification reads the session's `capture.mode`, read at every
1283
1349
  * start and switch. Absent (a capture bound to no session) → `self`.
1284
1350
  */
1285
- captureMode?: () => CaptureMode): LivenessCaptureInternalHandle;
1351
+ captureMode?: () => CaptureMode,
1352
+ /**
1353
+ * Liveness v7 §4.4: the session's screen-ramp challenge (`capture.liveness.screenRamp`), read when the recording
1354
+ * starts. The engine gets it only for a `self` capture with a `ramp` listener bound (the host paints); absent (a
1355
+ * capture bound to no session, older backends) → no ramp.
1356
+ */
1357
+ screenRamp?: () => ScreenRampChallenge | undefined): LivenessCaptureInternalHandle;
1286
1358
  /**
1287
1359
  * Create a standalone liveness capture (no upload — pair it with your own
1288
1360
  * submission, or use {@link Verification.liveness} for the full flow).
@@ -2750,7 +2822,7 @@ captureMode?: () => CaptureMode): PortraitCaptureController;
2750
2822
  * live-camera capture proof methods are optional (a fake / an older bridge
2751
2823
  * without them presigns without a proof).
2752
2824
  */
2753
- type HostedClientLike = Pick<HostedClient, "getSession" | "recordConsent" | "choose" | "presign" | "uploadToSpaces" | "completeMedia" | "submitCheck"> & Partial<Pick<HostedClient, "presignCapture" | "armCapture">> & Partial<Pick<HostedClient, "confirmIdentity" | "identityPortrait">>;
2825
+ type HostedClientLike = Pick<HostedClient, "getSession" | "recordConsent" | "choose" | "presign" | "uploadToSpaces" | "completeMedia" | "submitCheck"> & Partial<Pick<HostedClient, "presignCapture" | "armCapture">> & Partial<Pick<HostedClient, "confirmIdentity" | "identityPortrait">> & Partial<Pick<HostedClient, "reportCameraUnavailable">>;
2754
2826
  /** The presign policy allowlist for `kind: 'clip'` (media.policy.ts mirror). */
2755
2827
  declare const CLIP_MIME_ALLOWLIST: readonly string[];
2756
2828
  /** Same-key transport replays AFTER the first try, and the pause between them. */
@@ -2836,7 +2908,8 @@ type LivenessFlowOutcome = {
2836
2908
  * Run the biometric submissions the CURRENT frontier allows, re-evaluating
2837
2909
  * after every submit and after every RESYNC re-GET:
2838
2910
  * - frontier `liveness` → clip upload + attestation + `liveness` (once per capture);
2839
- * - frontier `face_match` → keyframe upload + `face_match` (once per capture),
2911
+ * - frontier `face_match` → keyframe upload + `face_match` (once per match node, at most two per capture: a
2912
+ * step-up's bound match then its document match, same keyframe),
2840
2913
  * allowed when liveness was NOT part of this capture (it had already
2841
2914
  * settled — any state, incl. `failed`: the selfie-fallback case, where this
2842
2915
  * capture only feeds face_match) or settled chainable from this capture
@@ -2965,4 +3038,4 @@ declare function createVerification(options: VerificationOptions): Verification;
2965
3038
  /** {@link createVerification} with construction seams (tests / Sekyro AI-internal hosts). */
2966
3039
  declare function createVerificationInternal(options: VerificationOptions, internals: VerificationInternals): Verification;
2967
3040
 
2968
- 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 TextLockTuning 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 UnsupportedSnapshot as aA, type UnsupportedStepHandle as aB, type Verification as aC, type VerificationBusy as aD, type VerificationEvents as aE, type VerificationLocale as aF, type VerificationOptions as aG, type VerificationResult as aH, type VerificationStatus as aI, type VerificationStep as aJ, WEB_IDENTITY_METHODS as aK, acceptedIssuers as aL, acceptedTypesFor as aM, createLivenessCapture as aN, createVerification as aO, deriveStep as aP, flagOf as aQ, getLivenessAssetsStatus as aR, laneOf as aS, otherOptions as aT, preloadLivenessAssets as aU, releaseLivenessAssets as aV, resolveAcceptedDocuments as aW, sectionOf as aX, subscribeLivenessAssets as aY, type DocCatalogEntry as aZ, type LiveMrzTuning 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 PortraitStartOptions as aj, type PortraitStepHandle as ak, type PreloadLivenessAssetsOptions as al, type ProcessingSnapshot as am, type ProcessingStepHandle as an, type ReasonCode as ao, type RegistrySnapshot as ap, type RegistrySource as aq, type RegistryStepHandle as ar, type ResultDisplay as as, type ResultSnapshot as at, type ResultStepHandle as au, type SdkFailureReason as av, type StepAttempts as aw, type StepContext as ax, type StepSnapshot as ay, type UnsupportedReason as az, type PortraitCaptureHandle as b, type GlareStatus as b$, type OcrEngineClient as b0, type DocAssistReport as b1, type ReadyInfo as b2, type LoadFailure as b3, type OcrEngineOptions as b4, type SubmitRuntime as b5, type HostedClientLike as b6, ANALYSIS_LONG_EDGE as b7, ASPECT_BANDS as b8, AttestationError as b9, type DocEngineLike as bA, DocFeedbackAggregator as bB, type DocFeedbackKey as bC, type DocFeedbackState as bD, type DocFormat as bE, type DocFrameAnalysis as bF, type DocFrameMeasures as bG, type DocGateQuality as bH, type DocGateThresholds as bI, type DocGateTick as bJ, type DocGateTickInput as bK, DocGateV1 as bL, type DocQuad as bM, type DocQuadPoint as bN, type DocShutterReason as bO, type DocShutterTuning as bP, type DocSide as bQ, type DocumentCaptureController as bR, type DocumentCaptureInternals as bS, EMPTY_GUIDE_METRICS as bT, type EncodedDocument as bU, FLIP_FILL_MIN as bV, FLIP_GAP_MS as bW, FLIP_TIMEOUT_MS as bX, type FocusCaps as bY, type FramingStatus as bZ, GUIDE_LOCK_DEFAULTS as b_, BLUR_REFUSE_SHARPNESS_MAX as ba, type BlurStatus as bb, CAPTURE_CANDIDATE_SPACING_MS as bc, CAPTURE_EXTRA_CANDIDATES as bd, CLIP_MIME_ALLOWLIST as be, type CaptureEngine as bf, CaptureSessionDoc as bg, type CaptureSessionDocEvents as bh, type CaptureSessionDocOptions as bi, DOC_ANALYSIS_DEFAULTS as bj, DOC_CADENCE_HZ as bk, DOC_CAMERA_TUNING_DEFAULTS as bl, DOC_CATALOG as bm, DOC_DETECT_WIDTH as bn, DOC_FEEDBACK_STATES as bo, DOC_GATE_V1_DEFAULTS as bp, DOC_SHUTTER_DEFAULTS as bq, type DeviceReadHint as br, type DocArtifacts as bs, DocAssist as bt, type DocAssistEngine as bu, type DocAssistTick as bv, type DocCameraTuning as bw, type DocCaptureReport as bx, type DocCaptureVia as by, type DocChecksPayload as bz, type CaptureChannel as c, createDocumentCaptureInternal as c$, type GrabbedFrame as c0, type GuideBlocker as c1, GuideLock as c2, type GuideLockTick as c3, type GuideLockTuning as c4, type GuideMetrics as c5, type GuideRect as c6, INFERENCE_RETRY_ATTEMPTS as c7, INFERENCE_RETRY_DEFAULT_S as c8, LANDMARKER_MODEL as c9, PRELOAD_BLAZE_INIT_TIMEOUT_MS as cA, PRELOAD_BUDGET_MS as cB, PROCESSING_POLL_DELAY_MS as cC, PROCESSING_POLL_MAX as cD, type PortraitCaptureController as cE, type PortraitCaptureInternals as cF, REGISTRY_RETRY_DELAY_MS as cG, type ReticleType as cH, SAME_FACE_MAX_DROPS as cI, type ScanEvent as cJ, type ScanLayout as cK, type ScanNotice as cL, type ScanPhase as cM, type ScanReport as cN, type ScanSide as cO, type ScanState as cP, type SubmitExecutor as cQ, TEXT_LOCK_DEFAULTS as cR, TRANSPORT_REPLAY_ATTEMPTS as cS, TRANSPORT_REPLAY_DELAY_MS as cT, type VerificationInternals as cU, analyzeDocFrame as cV, analyzeGuide as cW, aspectBand as cX, aspectFits as cY, buildDeviceReadHint as cZ, coverPointToVideo as c_, LENS_STORAGE_KEY as ca, LENS_TRY_MAX as cb, LIVE_MRZ_DEFAULTS as cc, LIVE_PHOTO_IDLE_MS as cd, LIVE_PHOTO_MAX_HZ as ce, type LandmarkedFace as cf, type LandmarkerLike as cg, type LensKind as ch, type LensSource as ci, type LightingStatus as cj, type LiveMrzCapture as ck, type LiveMrzState as cl, type LivePhotoGate as cm, type LivePhotoKit as cn, type LivePhotoKitInternals as co, type LivePhotoKitOptions as cp, type LivePhotoStill as cq, type LivenessCaptureInternalHandle as cr, type LivenessCaptureInternals as cs, type LivenessFlowDeps as ct, type LivenessFlowOutcome as cu, MANUAL_SHUTTER_MS as cv, MR_DOC_CATALOG as cw, NO_REPORT_MS as cx, type OpenDocCameraDeps as cy, PORTRAIT_JPEG_QUALITY as cz, type CaptureEngineId as d, createFaceLandmarker as d0, createLivePhotoKit as d1, createLivenessCaptureInternal as d2, createPortraitCaptureInternal as d3, createVerificationInternal as d4, docZoomFor as d5, encodeDocumentImage as d6, facesOf as d7, feedbackVoteOf as d8, focusOk as d9, runSubmission as dA, scannerFormatFor as dB, setPreloadLoaderForTests as dC, settledHint as dD, singleShotFocusAt as dE, specularFraction as dF, supportsFocusMode as dG, warmDocDetector as dH, writeStoredLens as dI, guideQuad as da, guideRegionInFrame as db, initialScanState as dc, lensKindOf as dd, mapEngineState as de, mapErrorKind as df, mapGuidanceHint as dg, nextScanState as dh, observe as di, openDocCamera as dj, passportBandOf as dk, portraitMatchStep as dl, preloadedDetectorFactory as dm, quadAreaFrac as dn, quadBounds as dp, quadIou as dq, quadTiltRatio as dr, randomUuid as ds, rankBackCameras as dt, readStoredLens as du, resetLivenessAssetsForTests as dv, resolveDocCameraTuning as dw, resolveDocShutterTuning as dx, resolveGuideLockTuning as dy, runLivenessFlow 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 };
3041
+ 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 LiveMrzTuning 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 UnsupportedSnapshot as aA, type UnsupportedStepHandle as aB, type Verification as aC, type VerificationBusy as aD, type VerificationEvents as aE, type VerificationLocale as aF, type VerificationOptions as aG, type VerificationResult as aH, type VerificationStatus as aI, type VerificationStep as aJ, WEB_IDENTITY_METHODS as aK, acceptedIssuers as aL, acceptedTypesFor as aM, cameraUnavailableCauseOf as aN, createLivenessCapture as aO, createVerification as aP, deriveStep as aQ, flagOf as aR, getLivenessAssetsStatus as aS, laneOf as aT, otherOptions as aU, preloadLivenessAssets as aV, releaseLivenessAssets as aW, resolveAcceptedDocuments as aX, sectionOf as aY, subscribeLivenessAssets as aZ, type DocCatalogEntry 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 PortraitStartOptions as aj, type PortraitStepHandle as ak, type PreloadLivenessAssetsOptions as al, type ProcessingSnapshot as am, type ProcessingStepHandle as an, type ReasonCode as ao, type RegistrySnapshot as ap, type RegistrySource as aq, type RegistryStepHandle as ar, type ResultDisplay as as, type ResultSnapshot as at, type ResultStepHandle as au, type SdkFailureReason as av, type StepAttempts as aw, type StepContext as ax, type StepSnapshot as ay, type UnsupportedReason as az, type PortraitCaptureHandle as b, GUIDE_LOCK_DEFAULTS as b$, type TextLockTuning as b0, type OcrEngineClient as b1, type DocAssistReport as b2, type ReadyInfo as b3, type LoadFailure as b4, type OcrEngineOptions as b5, type SubmitRuntime as b6, type HostedClientLike as b7, ANALYSIS_LONG_EDGE as b8, ASPECT_BANDS as b9, type DocChecksPayload as bA, type DocEngineLike as bB, DocFeedbackAggregator as bC, type DocFeedbackKey as bD, type DocFeedbackState as bE, type DocFormat as bF, type DocFrameAnalysis as bG, type DocFrameMeasures as bH, type DocGateQuality as bI, type DocGateThresholds as bJ, type DocGateTick as bK, type DocGateTickInput as bL, DocGateV1 as bM, type DocQuad as bN, type DocQuadPoint as bO, type DocShutterReason as bP, type DocShutterTuning as bQ, type DocSide as bR, type DocumentCaptureController as bS, type DocumentCaptureInternals as bT, EMPTY_GUIDE_METRICS as bU, type EncodedDocument as bV, FLIP_FILL_MIN as bW, FLIP_GAP_MS as bX, FLIP_TIMEOUT_MS as bY, type FocusCaps as bZ, type FramingStatus as b_, AttestationError as ba, BLUR_REFUSE_SHARPNESS_MAX as bb, type BlurStatus as bc, CAPTURE_CANDIDATE_SPACING_MS as bd, CAPTURE_EXTRA_CANDIDATES as be, CLIP_MIME_ALLOWLIST as bf, type CaptureEngine as bg, CaptureSessionDoc as bh, type CaptureSessionDocEvents as bi, type CaptureSessionDocOptions as bj, DOC_ANALYSIS_DEFAULTS as bk, DOC_CADENCE_HZ as bl, DOC_CAMERA_TUNING_DEFAULTS as bm, DOC_CATALOG as bn, DOC_DETECT_WIDTH as bo, DOC_FEEDBACK_STATES as bp, DOC_GATE_V1_DEFAULTS as bq, DOC_SHUTTER_DEFAULTS as br, type DeviceReadHint as bs, type DocArtifacts as bt, DocAssist as bu, type DocAssistEngine as bv, type DocAssistTick as bw, type DocCameraTuning as bx, type DocCaptureReport as by, type DocCaptureVia as bz, type CaptureChannel as c, coverPointToVideo as c$, type GlareStatus as c0, type GrabbedFrame as c1, type GuideBlocker as c2, GuideLock as c3, type GuideLockTick as c4, type GuideLockTuning as c5, type GuideMetrics as c6, type GuideRect as c7, INFERENCE_RETRY_ATTEMPTS as c8, INFERENCE_RETRY_DEFAULT_S as c9, PORTRAIT_JPEG_QUALITY as cA, PRELOAD_BLAZE_INIT_TIMEOUT_MS as cB, PRELOAD_BUDGET_MS as cC, PROCESSING_POLL_DELAY_MS as cD, PROCESSING_POLL_MAX as cE, type PortraitCaptureController as cF, type PortraitCaptureInternals as cG, REGISTRY_RETRY_DELAY_MS as cH, type ReticleType as cI, SAME_FACE_MAX_DROPS as cJ, type ScanEvent as cK, type ScanLayout as cL, type ScanNotice as cM, type ScanPhase as cN, type ScanReport as cO, type ScanSide as cP, type ScanState as cQ, type SubmitExecutor as cR, TEXT_LOCK_DEFAULTS as cS, TRANSPORT_REPLAY_ATTEMPTS as cT, TRANSPORT_REPLAY_DELAY_MS as cU, type VerificationInternals as cV, analyzeDocFrame as cW, analyzeGuide as cX, aspectBand as cY, aspectFits as cZ, buildDeviceReadHint as c_, LANDMARKER_MODEL as ca, LENS_STORAGE_KEY as cb, LENS_TRY_MAX as cc, LIVE_MRZ_DEFAULTS as cd, LIVE_PHOTO_IDLE_MS as ce, LIVE_PHOTO_MAX_HZ as cf, type LandmarkedFace as cg, type LandmarkerLike as ch, type LensKind as ci, type LensSource as cj, type LightingStatus as ck, type LiveMrzCapture as cl, type LiveMrzState as cm, type LivePhotoGate as cn, type LivePhotoKit as co, type LivePhotoKitInternals as cp, type LivePhotoKitOptions as cq, type LivePhotoStill as cr, type LivenessCaptureInternalHandle as cs, type LivenessCaptureInternals as ct, type LivenessFlowDeps as cu, type LivenessFlowOutcome as cv, MANUAL_SHUTTER_MS as cw, MR_DOC_CATALOG as cx, NO_REPORT_MS as cy, type OpenDocCameraDeps as cz, type CaptureEngineId as d, createDocumentCaptureInternal as d0, createFaceLandmarker as d1, createLivePhotoKit as d2, createLivenessCaptureInternal as d3, createPortraitCaptureInternal as d4, createVerificationInternal as d5, docZoomFor as d6, encodeDocumentImage as d7, facesOf as d8, feedbackVoteOf as d9, runLivenessFlow as dA, runSubmission as dB, scannerFormatFor as dC, setPreloadLoaderForTests as dD, settledHint as dE, singleShotFocusAt as dF, specularFraction as dG, supportsFocusMode as dH, warmDocDetector as dI, writeStoredLens as dJ, focusOk as da, guideQuad as db, guideRegionInFrame as dc, initialScanState as dd, lensKindOf as de, mapEngineState as df, mapErrorKind as dg, mapGuidanceHint as dh, nextScanState as di, observe as dj, openDocCamera as dk, passportBandOf as dl, portraitMatchStep as dm, preloadedDetectorFactory as dn, quadAreaFrac as dp, quadBounds as dq, quadIou as dr, quadTiltRatio as ds, randomUuid as dt, rankBackCameras as du, readStoredLens as dv, resetLivenessAssetsForTests as dw, resolveDocCameraTuning as dx, resolveDocShutterTuning as dy, resolveGuideLockTuning 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 };