@sekyro/web 0.1.0-rc.38 → 0.1.0-rc.39
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/dist/{capture-session-doc-MGDYUASI.js → capture-session-doc-J4MIDQOS.js} +1 -1
- package/dist/{capture-session-v3-Z2KI_2p9.d.ts → capture-session-v3-BnRN9WuV.d.ts} +1 -1
- package/dist/{capture-session-v3-Dz-AQW52.d.cts → capture-session-v3-DjWqEJG0.d.cts} +1 -1
- package/dist/chunk-26XZRWBD.js +3 -0
- package/dist/chunk-3565JBSZ.js +1 -0
- package/dist/{chunk-TOISWBOX.js → chunk-3WQJI7UL.js} +1 -1
- package/dist/{chunk-PBWIMNSN.js → chunk-7FGOUBAN.js} +1 -1
- package/dist/{chunk-5AR5GTEJ.js → chunk-BRLQIJYF.js} +1 -1
- package/dist/{chunk-COZXZAD5.js → chunk-HMOOVRKA.js} +1 -1
- package/dist/{chunk-QTOMWAS6.js → chunk-P5OIQXVM.js} +1 -1
- package/dist/{chunk-TQQK7464.js → chunk-PNOGF72U.js} +1 -1
- package/dist/{chunk-IAKYKPL6.js → chunk-TGSMTRG5.js} +1 -1
- package/dist/{chunk-VMHFHHPP.js → chunk-UKYJYZZS.js} +1 -1
- package/dist/{chunk-XDB7L5KS.js → chunk-WI7GAUCH.js} +1 -1
- package/dist/client/index.cjs +1 -1
- package/dist/client/index.d.cts +3 -3
- package/dist/client/index.d.ts +3 -3
- package/dist/client/index.js +1 -1
- package/dist/core/index.cjs +1 -1
- package/dist/core/index.d.cts +3 -3
- package/dist/core/index.d.ts +3 -3
- package/dist/core/index.js +1 -1
- package/dist/create-document-capture-SMEKDBGF.js +1 -0
- package/dist/{create-verification-BG6A2iyO.d.cts → create-verification-BSOb3N6w.d.cts} +27 -4
- package/dist/{create-verification-2Qm_K28Y.d.ts → create-verification-C6Hoh_0h.d.ts} +27 -4
- package/dist/{detector-scanic-JC25DD3A.js → detector-scanic-P2RTEQUV.js} +1 -1
- package/dist/{icao-gate-QqtNED0V.d.ts → icao-gate-Bux2CcJc.d.ts} +1 -1
- package/dist/{icao-gate-Dyb0wGO3.d.cts → icao-gate-C-fkVe6r.d.cts} +1 -1
- package/dist/{icao-policy-iIBtqhbf.d.cts → icao-policy-B_daycJk.d.cts} +2 -2
- package/dist/{icao-policy-DsaRylAQ.d.ts → icao-policy-C5XcEwqj.d.ts} +2 -2
- package/dist/index.cjs +2 -2
- package/dist/index.d.cts +7 -7
- package/dist/index.d.ts +7 -7
- package/dist/index.js +1 -1
- package/dist/internal/index.cjs +2 -2
- package/dist/internal/index.d.cts +6 -6
- package/dist/internal/index.d.ts +6 -6
- package/dist/internal/index.js +1 -1
- package/dist/{plan-runner-NWK4LZFI.js → plan-runner-ZVYJ3UI3.js} +1 -1
- package/dist/{types-Cy_SJtPf.d.cts → types-BUnFqG97.d.cts} +11 -1
- package/dist/{types-Cy_SJtPf.d.ts → types-BUnFqG97.d.ts} +11 -1
- package/package.json +1 -1
- package/sbom.cdx.json +19 -19
- package/dist/chunk-C4XDRRU5.js +0 -1
- package/dist/chunk-IOCOIZKE.js +0 -3
- package/dist/create-document-capture-KISF6XD3.js +0 -1
package/dist/client/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var w=Object.defineProperty;var ne=Object.getOwnPropertyDescriptor;var te=Object.getOwnPropertyNames;var re=Object.prototype.hasOwnProperty;var f=(n,e)=>()=>(n&&(e=n(n=0)),e);var P=(n,e)=>{for(var t in e)w(n,t,{get:e[t],enumerable:!0})},ie=(n,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of te(e))!re.call(n,i)&&i!==t&&w(n,i,{get:()=>e[i],enumerable:!(r=ne(e,i))||r.enumerable});return n};var oe=n=>ie(w({},"__esModule",{value:!0}),n);function A(n,e=80){return typeof n=="string"&&n.replace(/[^A-Za-z0-9 ()\-._,]/g,"").trim().slice(0,e)||void 0}function le(n){let e={};for(let[t,r]of Object.entries(n))r!==void 0&&(e[t]=r);return Object.keys(e).length>0?e:void 0}function O(n,e){x=le({renderer:A(n),vendor:A(e)})??x}var Je,x,N=f(()=>{"use strict";Je="zoom torch focusMode focusDistance exposureMode exposureCompensation exposureTime whiteBalanceMode colorTemperature iso facingMode frameRate width height aspectRatio resizeMode deviceId groupId".split(" ")});var H=f(()=>{"use strict"});function S(n,e){return new Promise(t=>{let r=setTimeout(()=>t(void 0),e),i=o=>{clearTimeout(r),t(o)};try{n().then(i,()=>i(void 0))}catch{i(void 0)}})}async function D(n){let e=await crypto.subtle.digest("SHA-256",new TextEncoder().encode(JSON.stringify(n)));return Array.from(new Uint8Array(e).subarray(0,8),t=>t.toString(16).padStart(2,"0")).join("")}var V=f(()=>{"use strict";H()});var K={};P(K,{computePrint:()=>Te,readHints:()=>U});function F(n,e){if(typeof n!="string")return;let t=n.trim();return t.length>0&&t.length<=e?t:void 0}async function U(){let n=navigator.userAgentData;if(typeof n?.getHighEntropyValues!="function")return;let e=await S(()=>n.getHighEntropyValues(["model","platformVersion"]),he);if(e==null)return;let t=F(e.model,ge),r=F(e.platformVersion,be),i={...t!==void 0?{model:t}:{},...r!==void 0?{platformVersion:r}:{}};return Object.keys(i).length>0?i:void 0}async function _e(){let[n,e]=await Promise.all([new L.Thumbmark({stabilize:["private","iframe"],exclude:["permissions","webrtc","speech"],logging:!1,collect_beacon:!1,timeout:me}).get(),U()]),t=n?.components?.hardware?.videocard;t!==null&&typeof t=="object"&&O(t.rendererUnmasked??t.renderer,t.vendorUnmasked??t.vendor);let r=n?.thumbmark;if(typeof r!="string"||r.length<we||r.length>Se)return;let i={};for(let o of pe){let s=n.components?.[o];s==null||s.timeout==="true"||(i[o]=await D(s))}return{hash:r,c:i,...e!==void 0?{hints:e}:{}}}function ve(){return new Promise(n=>{typeof globalThis.requestIdleCallback=="function"?globalThis.requestIdleCallback(()=>n(),{timeout:ye}):n()})}async function Te(n){return n()||(await ve(),n())?"busy":S(_e,fe)}var L,pe,me,fe,he,ye,ge,be,we,Se,B=f(()=>{"use strict";L=require("@thumbmarkjs/thumbmarkjs");N();V();pe=["canvas","webgl","audio","fonts","hardware","screen","system","locales","math","plugins"],me=2e3,fe=4e3,he=1e3,ye=2e3,ge=64,be=32,we=8,Se=128});var qe={};P(qe,{HostedApiError:()=>l,HostedClient:()=>b,KNOWN_CODES:()=>k,SEKYRO_SDK_HEADER:()=>C,icaoPolicyOf:()=>J,isInAppBrowser:()=>g,isKnownCode:()=>$,portraitIcaoGate:()=>Q,stripMimeParams:()=>m});module.exports=oe(qe);var se=600;function E(){if(typeof window>"u"||typeof navigator>"u")return"desktop";let n=navigator.userAgentData,e=n?.mobile||/Android|i(Pad)?OS/.test(String(n?.platform)),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(!e){if(Number(navigator.maxTouchPoints??0)<=1)return"desktop";if(/Macintosh/.test(t))return"tablet";if(/Windows NT|CrOS/.test(t)||!ce())return"desktop"}let r=ae();return r>0&&r<se?"phone":"tablet"}function ae(){try{let n=window.screen,e=Number(n?.width??0),t=Number(n?.height??0);return e>0&&t>0?Math.min(e,t):0}catch{return 0}}function ce(){try{return typeof window.matchMedia=="function"&&window.matchMedia("(pointer: coarse)").matches}catch{return!1}}var de=["magenta","yellow","green","blue"];var h=n=>typeof n=="number"&&Number.isFinite(n);function I(n){if(typeof n!="object"||n===null)return!1;let e=n;if(typeof e.nonce!="string"||e.nonce.length===0||!Array.isArray(e.colours)||e.colours.length<1||e.colours.length>8||!e.colours.every(r=>de.includes(r))||!Array.isArray(e.onsetsMs)||e.onsetsMs.length!==e.colours.length)return!1;let t=-1;for(let r of e.onsetsMs){if(!h(r)||r<0||r<=t)return!1;t=r}return!(!h(e.holdMs)||e.holdMs<=0||!h(e.endMs)||e.endMs<=t||!h(e.clipMs)||e.clipMs<e.endMs||e.clipMs>8e3)}var y="0.1.0-rc.38";var ue=/FBAN|FBAV|FB_IAB|FBIOS|MessengerForiOS|Instagram|WhatsApp|musical_ly|BytedanceWebview|TikTok|Snapchat|\bLine\/|LinkedInApp|Pinterest|MicroMessenger|; wv\)/i;function g(n){let e=n??(typeof navigator>"u"?"":String(navigator.userAgent??""));return ue.test(e)}var G="sekyro.did",ke=1e4,Re=()=>globalThis.process?.versions?.node,W;function q(){let n=globalThis.crypto;try{if(typeof n?.randomUUID=="function")return n.randomUUID()}catch{}try{if(typeof n?.getRandomValues=="function"){let e=n.getRandomValues(new Uint8Array(16));return Array.from(e,t=>t.toString(16).padStart(2,"0")).join("")}}catch{}}function Me(){try{let n=localStorage.getItem(G);if(n)return n;let e=q();return e!==void 0&&localStorage.setItem(G,e),e}catch{return W??(W=q()),W}}async function Ce(){let n=globalThis.crypto?.subtle;if(!n)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]),r=await n.digest("SHA-256",new TextEncoder().encode(t));return Array.from(new Uint8Array(r),i=>i.toString(16).padStart(2,"0")).join("").slice(0,32)}function Pe(){try{let n=Number(navigator.maxTouchPoints);return Number.isFinite(n)&&n>=0?{touch:Math.min(64,Math.trunc(n))}:{}}catch{return{}}}function Ee(n){let e=new TextEncoder().encode(n),t="";for(let r of e)t+=String.fromCharCode(r);return btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function Ie(n){let e,t,r,i,o,s,d=()=>s?.readyState==="live",a=()=>{o!==void 0||!globalThis.crypto?.subtle||Re()||d()||(o=Promise.race([Promise.resolve().then(()=>(B(),K)),new Promise(c=>setTimeout(c,ke))]).then(c=>c?.computePrint(d)).then(c=>{c==="busy"?o=void 0:i=c}).catch(()=>{}))};return{timezone(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone?.slice(0,64)||void 0}catch{return}},noteCameraLabel(c){c&&(e=c.slice(0,128))},noteCamera(c){t=c},noteCameraTrack(c){s=c},async deviceHeader(){try{r??(r=Ce().catch(()=>""));let c=[];navigator.webdriver&&c.push("webdriver"),/HeadlessChrome/.test(navigator.userAgent)&&c.push("headless");let u=await r,p=Me(),Z={v:1,platform:"web",sdk:n.sdk.slice(0,64),caps:["session_proof"],rampAtArm:!0,ids:[...p?[{kind:"web_local",value:p.slice(0,128)}]:[],...u?[{kind:"web_fp",value:u}]:[]],screen:{w:screen.width,h:screen.height,dpr:globalThis.devicePixelRatio??1},...Pe(),...e?{cameraLabel:e}:{},...c.length?{signals:c}:{},...i?{print:{v:2,...i,...t?{camera:t}:{}}}:{},...g()?{inApp:!0}:{}},ee=Ee(JSON.stringify(Z));return a(),ee}catch{return}},printReady(){return o??Promise.resolve()}}}var _=Symbol.for("sekyro.web.clientContext"),v=globalThis,T=v[_]??(v[_]=Ie({sdk:`@sekyro/web@${y}`}));var k=["session_token_invalid","session_token_required","session_token_session_mismatch","session_not_found","rate_limit_exceeded","consent_required","session_not_active","check_not_found","check_already_finalized","check_out_of_order","check_type_unsupported","force_outcome_forbidden","attestation_invalid","platform_unregistered","app_attest_invalid","too_many_challenges","inference_unavailable","mobile_required","nni_locked","document_nni_mismatch","media_content_type_not_allowed","media_too_large","media_key_invalid","media_key_forbidden","media_not_found","media_unreadable","media_session_invalid","idempotency_key_collision","idempotency_in_progress","idempotency_key_required","validation_error","internal_error","unknown_error","upload_failed","network_error","timeout","nfc_outcome_not_accepted","identity_confirm_required","identity_confirm_locked","choice_not_found","choice_locked","choice_option_unavailable","step_not_on_path","check_not_active","sekyro_app_not_allowed","sekyro_app_unverified","id_number_locked","document_id_number_mismatch","simulated_capture_forbidden","native_app_required"];function $(n){return k.includes(n)}var l=class extends Error{constructor(e){super(e.message),this.name="HostedApiError",this.status=e.status,this.code=e.code,e.retryAfterSeconds!==void 0&&(this.retryAfterSeconds=e.retryAfterSeconds),e.details&&(this.details=e.details)}};function j(n,e,t=Math.random){let r=(n??e)*1e3,i=Math.min(Math.max(r,500),2e4),o=Math.round(i*(1+(t()*2-1)*.25));return Math.min(Math.max(o,500),2e4)}var Y=6e4,R=4,Ae=3e4,xe=9e5,Oe=200,Ne=5,He=400,De=new Set(["server_busy","request_timeout"]),Ve=20,Fe=60,Le=600,Ue=2;function m(n){return(n.split(";")[0]??"").trim()}var Ke={liveness:"clipKey",face_match:"imageKey",doc_ocr:"imageKey"},C=`@sekyro/web/${y}`,Be=C,b=class{constructor(e){this.sessionId=null;this.bootstrap=null;this.captureNonces=[];this.captureFetch=null;this.reportedIssues=new Map;this.issueReports=0;this.issuesPausedUntil=0;this.apiOrigin=e.apiOrigin.replace(/\/+$/,""),this.sessionToken=e.sessionToken;let t=e.fetch;this.fetchImpl=(r,i)=>(t??globalThis.fetch).call(globalThis,r,i),this.requestTimeoutMs=e.requestTimeoutMs??Ae,this.retryAttempts=e.inProgressRetry?.attempts??Ne,this.retryDelayMs=e.inProgressRetry?.delayMs??He,this.random=e.random??Math.random,this.clientLocale=e.locale}async getSession(){let e=await this.api("GET","/hosted/session");return this.sessionId=e.sessionId,e}async recordConsent(e){let t=await this.api("POST","/hosted/consent",{body:{locale:e},busyRetry:!0}),r=this.captureHold;return this.captureHold=void 0,r&&this.armCapture(r),t}async reportCameraUnavailable(e){return this.api("POST","/hosted/camera-unavailable",{body:{cause:e}})}async testerGate(e){return this.api("POST","/hosted/tester-gate",{body:{input:e}})}async reportCaptureIssue(e){let t=typeof e.name=="string"?e.name.replace(/[^A-Za-z]/g,"").slice(0,40):"",r=typeof e.engineKind=="string"&&/^[a-z_]{1,32}$/.test(e.engineKind)?e.engineKind:void 0,i=typeof e.attempt=="number"&&Number.isInteger(e.attempt)&&e.attempt>=0&&e.attempt<=1e3?e.attempt:void 0,o=e.check==="attestation"?i??"":"",s=[e.check,o,e.kind,t,e.phase??"",r??""].join("|"),d=this.reportedIssues.get(s);if(d!==void 0)return d;if(Date.now()<this.issuesPausedUntil||this.issueReports>=Ve)return;let a={check:e.check,kind:e.kind,...t!==""?{name:t}:{},...e.phase!==void 0?{phase:e.phase}:{},...r!==void 0?{engineKind:r}:{},...i!==void 0?{attempt:i}:{},...e.formFactor!==void 0?{formFactor:e.formFactor}:{},...typeof e.detail=="string"&&/^\d{1,10}$/.test(e.detail)?{detail:e.detail}:{},...z(e.challengeMs)?{challengeMs:e.challengeMs}:{},...z(e.readyMs)?{readyMs:e.readyMs}:{},...e.inApp===!0?{inApp:!0}:{}};this.issueReports+=1;let c=this.api("POST","/hosted/capture-issue",{body:a,empty:!0}).catch(u=>{if(u instanceof l&&u.status===429){let p=Math.min(Math.max(u.retryAfterSeconds??Fe,0),Le);this.issuesPausedUntil=Math.max(this.issuesPausedUntil,Date.now()+p*1e3);return}(!(u instanceof l)||u.status===0||u.status>=500)&&this.reportedIssues.delete(s)});return this.reportedIssues.set(s,c),c}async choose(e,t){let r=await this.api("POST","/hosted/choice",{body:{nodeId:e,option:t},busyRetry:!0});return this.sessionId=r.sessionId,r}async confirmIdentity(e){return this.api("POST","/hosted/identity/confirm",{body:{decision:e}})}async identityPortrait(){return this.api("GET","/hosted/identity/portrait",{blob:!0})}async presign(e,t,r,i={}){let o=await this.ensureSessionId(),s={kind:e,contentType:m(t),contentLength:r,...i.source==="upload"?{source:"upload"}:{}};return this.api("POST",`/sessions/${o}/media`,{body:s})}armCapture(e=2){let t=Date.now();this.captureNonces.filter(r=>r.expiresAt-Y>t).length>=e||(this.captureHold===void 0?this.fillCaptureNonces(e,e):this.captureHold=Math.max(this.captureHold,e))}async armRamp(){try{let e=await this.ensureSessionId(),t=await this.api("POST",`/sessions/${e}/media/capture-nonces`,{body:{count:2,ramp:!0}}),r=Date.now(),i=I(t.screenRamp)?t.screenRamp:void 0,o=r+Math.max(0,t.expiresIn)*1e3;for(let d of Array.isArray(t.nonces)?t.nonces:[])typeof d!="string"||d.length===0||this.captureNonces.push({nonce:d,expiresAt:o,...i!==void 0?{arm:i.nonce}:{}});this.captureNonces=this.captureNonces.slice(-R),this.captureHold=void 0;let s=typeof t.rampExpiresIn=="number"&&t.rampExpiresIn>0?t.rampExpiresIn:0;return{...i!==void 0?{challenge:i}:{},expiresAt:r+s*1e3}}catch{return}}async presignCapture(e,t,r,i={}){let o=await this.ensureSessionId(),s=await this.takeCaptureNonce(i.arm),d=s===void 0?void 0:{nonce:s,...i.engine!==void 0?{engine:i.engine.slice(0,32)}:{},...i.durationMs!==void 0&&Number.isFinite(i.durationMs)?{captureMs:Math.min(36e5,Math.max(0,Math.round(i.durationMs)))}:{}},a={kind:e,contentType:m(t),contentLength:r,capture:d};return this.api("POST",`/sessions/${o}/media`,{body:a})}async takeCaptureNonce(e){let t=()=>{let r=Date.now();this.captureNonces=this.captureNonces.filter(o=>o.expiresAt-Y>r);let i=this.captureNonces.findIndex(o=>o.arm===e);return this.captureNonces.splice(i<0?0:i,1)[0]?.nonce};for(let r=0;r<2;r++){let i=t();if(i!==void 0)return i;await this.fillCaptureNonces(1)}return t()}fillCaptureNonces(e,t=0){return this.captureFetch??(this.captureFetch=(async()=>{try{let r=await this.ensureSessionId(),i=await this.api("POST",`/sessions/${r}/media/capture-nonces`,{body:{count:Math.min(R,Math.max(1,e))}}),o=Date.now()+Math.max(0,i.expiresIn)*1e3;for(let s of Array.isArray(i.nonces)?i.nonces:[])typeof s=="string"&&s.length>0&&this.captureNonces.push({nonce:s,expiresAt:o});this.captureNonces=this.captureNonces.slice(-R),this.captureHold=void 0}catch(r){r instanceof l&&r.code==="consent_required"&&(this.captureHold=Math.max(this.captureHold??0,t))}})().finally(()=>{this.captureFetch=null})),this.captureFetch}async uploadToSpaces(e,t,r){let i;try{i=await this.fetchImpl(e,{method:"PUT",headers:{"content-type":m(r)},body:t,signal:AbortSignal.timeout(xe)})}catch(o){throw M(o)}if(!i.ok){let o=(await i.text().catch(()=>"")).slice(0,Oe);throw new l({status:i.status,code:"upload_failed",message:`media upload failed (HTTP ${i.status})${o?`: ${o}`:""}`})}}async completeMedia(e){let t=await this.ensureSessionId();return this.api("POST",`/sessions/${t}/media/complete`,{body:{key:e}})}async submitCheck(e,t,r={}){let i=await this.ensureSessionId(),o={input:t,forceOutcome:r.forceOutcome};return this.api("POST",`/sessions/${i}/checks/${e}`,{body:o,idempotencyKey:r.idempotencyKey,...r.browserCheckToken!==void 0?{browserCheckToken:r.browserCheckToken}:{},busyRetry:r.idempotencyKey!==void 0})}async uploadAndSubmit(e,t,r,i={}){let o=m(t.contentType),s=await this.presign(t.kind,o,t.blob.size);await this.uploadToSpaces(s.uploadUrl,t.blob,o);let d=await this.completeMedia(s.key),a={...r,[Ke[e]]:d.key};return this.submitCheck(e,a,i)}async ensureSessionId(){return this.sessionId!==null?this.sessionId:(this.bootstrap??(this.bootstrap=this.getSession().finally(()=>{this.bootstrap=null})),(await this.bootstrap).sessionId)}async api(e,t,r={}){let i=e==="GET"||r.busyRetry===!0,o=`${this.apiOrigin}/api/v2${t}`,s={"x-session-token":this.sessionToken,"x-sekyro-sdk":Be};r.body!==void 0&&(s["content-type"]="application/json"),r.idempotencyKey!==void 0&&(s["x-idempotency-key"]=r.idempotencyKey),r.browserCheckToken!==void 0&&(s["sekyro-browser-check"]=r.browserCheckToken),this.clientLocale!==void 0&&(s["sekyro-client-locale"]=this.clientLocale);try{let d=T.timezone();d!==void 0&&(s["sekyro-client-timezone"]=d)}catch{}s["sekyro-client-form-factor"]=E();try{let d=await T.deviceHeader();d!==void 0&&(s["sekyro-client-device"]=d)}catch{}for(let d=0;;d++){let a;try{a=await this.fetchImpl(o,{method:e,headers:s,...r.body!==void 0?{body:JSON.stringify(r.body)}:{},cache:"no-store",signal:AbortSignal.timeout(this.requestTimeoutMs)})}catch(u){throw M(u)}if(a.ok){if(r.empty===!0)return;if(r.blob===!0)try{return await a.blob()}catch(p){throw M(p)}let u;try{u=await a.json()}catch{throw new l({status:a.status,code:"unknown_error",message:`response body was not valid JSON (HTTP ${a.status})`})}return Ge(u)}let c=await We(a);if(c.code==="idempotency_in_progress"&&d<this.retryAttempts){this.retryDelayMs>0&&await X(this.retryDelayMs);continue}if(i&&c.status===503&&De.has(c.code)){i=!1,await X(j(c.retryAfterSeconds,Ue,this.random));continue}throw c}}};function z(n){return typeof n=="number"&&Number.isInteger(n)&&n>=0&&n<=6e5}function M(n){if((typeof n=="object"&&n!==null?n.name:void 0)==="TimeoutError")return new l({status:0,code:"timeout",message:"request timed out"});let t=n instanceof Error?n.message:String(n);return new l({status:0,code:"network_error",message:`network request failed: ${t}`})}function Ge(n){return n!==null&&typeof n=="object"&&"success"in n&&"data"in n?n.data:n}async function We(n){let e="unknown_error",t=`request failed (HTTP ${n.status})`,r=Number.NaN,i;try{let d=await n.json();if(d!==null&&typeof d=="object"){let a=d;typeof a.code=="string"&&a.code.length>0&&(e=a.code),typeof a.message=="string"&&a.message.length>0&&(t=a.message),typeof a.retryAfterSeconds=="number"&&(r=a.retryAfterSeconds),Array.isArray(a.details?.issues)?i=a.details:Array.isArray(a.details?.errors)&&(i={...a.details,issues:[]})}}catch{}let o=n.headers.get("retry-after"),s=o===null?Math.floor(r):Number.parseInt(o,10);return new l({status:n.status,code:e,message:t,...Number.isFinite(s)&&s>=0?{retryAfterSeconds:s}:{},details:i})}function X(n){return new Promise(e=>setTimeout(e,n))}function J(n){let e=n?.portrait,t=e?.icao,r=e?.purpose==="id_document";return t==null?r?{policy:"reject",profile:"id_document"}:null:{policy:t.policy==="alert"?"alert":"reject",profile:r||t.profile==="id_document"?"id_document":"selfie"}}function Q(n){return{...n.baselineEyeOpenness!==void 0?{baselineEyeOpenness:n.baselineEyeOpenness}:{},...n.baselineEyeOpennessLeft!==void 0&&n.baselineEyeOpennessRight!==void 0?{baselineEyeOpennessLeft:n.baselineEyeOpennessLeft,baselineEyeOpennessRight:n.baselineEyeOpennessRight}:{},criteria:n.verdict??{},...n.backgroundCheck!==void 0?{backgroundCheck:n.backgroundCheck}:{}}}0&&(module.exports={HostedApiError,HostedClient,KNOWN_CODES,SEKYRO_SDK_HEADER,icaoPolicyOf,isInAppBrowser,isKnownCode,portraitIcaoGate,stripMimeParams});
|
|
1
|
+
"use strict";var w=Object.defineProperty;var ne=Object.getOwnPropertyDescriptor;var te=Object.getOwnPropertyNames;var re=Object.prototype.hasOwnProperty;var f=(n,e)=>()=>(n&&(e=n(n=0)),e);var P=(n,e)=>{for(var t in e)w(n,t,{get:e[t],enumerable:!0})},ie=(n,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of te(e))!re.call(n,i)&&i!==t&&w(n,i,{get:()=>e[i],enumerable:!(r=ne(e,i))||r.enumerable});return n};var oe=n=>ie(w({},"__esModule",{value:!0}),n);function A(n,e=80){return typeof n=="string"&&n.replace(/[^A-Za-z0-9 ()\-._,]/g,"").trim().slice(0,e)||void 0}function le(n){let e={};for(let[t,r]of Object.entries(n))r!==void 0&&(e[t]=r);return Object.keys(e).length>0?e:void 0}function O(n,e){x=le({renderer:A(n),vendor:A(e)})??x}var Je,x,N=f(()=>{"use strict";Je="zoom torch focusMode focusDistance exposureMode exposureCompensation exposureTime whiteBalanceMode colorTemperature iso facingMode frameRate width height aspectRatio resizeMode deviceId groupId".split(" ")});var H=f(()=>{"use strict"});function S(n,e){return new Promise(t=>{let r=setTimeout(()=>t(void 0),e),i=o=>{clearTimeout(r),t(o)};try{n().then(i,()=>i(void 0))}catch{i(void 0)}})}async function D(n){let e=await crypto.subtle.digest("SHA-256",new TextEncoder().encode(JSON.stringify(n)));return Array.from(new Uint8Array(e).subarray(0,8),t=>t.toString(16).padStart(2,"0")).join("")}var V=f(()=>{"use strict";H()});var K={};P(K,{computePrint:()=>Te,readHints:()=>U});function F(n,e){if(typeof n!="string")return;let t=n.trim();return t.length>0&&t.length<=e?t:void 0}async function U(){let n=navigator.userAgentData;if(typeof n?.getHighEntropyValues!="function")return;let e=await S(()=>n.getHighEntropyValues(["model","platformVersion"]),he);if(e==null)return;let t=F(e.model,ge),r=F(e.platformVersion,be),i={...t!==void 0?{model:t}:{},...r!==void 0?{platformVersion:r}:{}};return Object.keys(i).length>0?i:void 0}async function _e(){let[n,e]=await Promise.all([new L.Thumbmark({stabilize:["private","iframe"],exclude:["permissions","webrtc","speech"],logging:!1,collect_beacon:!1,timeout:me}).get(),U()]),t=n?.components?.hardware?.videocard;t!==null&&typeof t=="object"&&O(t.rendererUnmasked??t.renderer,t.vendorUnmasked??t.vendor);let r=n?.thumbmark;if(typeof r!="string"||r.length<we||r.length>Se)return;let i={};for(let o of pe){let s=n.components?.[o];s==null||s.timeout==="true"||(i[o]=await D(s))}return{hash:r,c:i,...e!==void 0?{hints:e}:{}}}function ve(){return new Promise(n=>{typeof globalThis.requestIdleCallback=="function"?globalThis.requestIdleCallback(()=>n(),{timeout:ye}):n()})}async function Te(n){return n()||(await ve(),n())?"busy":S(_e,fe)}var L,pe,me,fe,he,ye,ge,be,we,Se,B=f(()=>{"use strict";L=require("@thumbmarkjs/thumbmarkjs");N();V();pe=["canvas","webgl","audio","fonts","hardware","screen","system","locales","math","plugins"],me=2e3,fe=4e3,he=1e3,ye=2e3,ge=64,be=32,we=8,Se=128});var qe={};P(qe,{HostedApiError:()=>l,HostedClient:()=>b,KNOWN_CODES:()=>k,SEKYRO_SDK_HEADER:()=>C,icaoPolicyOf:()=>J,isInAppBrowser:()=>g,isKnownCode:()=>$,portraitIcaoGate:()=>Q,stripMimeParams:()=>m});module.exports=oe(qe);var se=600;function E(){if(typeof window>"u"||typeof navigator>"u")return"desktop";let n=navigator.userAgentData,e=n?.mobile||/Android|i(Pad)?OS/.test(String(n?.platform)),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(!e){if(Number(navigator.maxTouchPoints??0)<=1)return"desktop";if(/Macintosh/.test(t))return"tablet";if(/Windows NT|CrOS/.test(t)||!ce())return"desktop"}let r=ae();return r>0&&r<se?"phone":"tablet"}function ae(){try{let n=window.screen,e=Number(n?.width??0),t=Number(n?.height??0);return e>0&&t>0?Math.min(e,t):0}catch{return 0}}function ce(){try{return typeof window.matchMedia=="function"&&window.matchMedia("(pointer: coarse)").matches}catch{return!1}}var de=["magenta","yellow","green","blue"];var h=n=>typeof n=="number"&&Number.isFinite(n);function I(n){if(typeof n!="object"||n===null)return!1;let e=n;if(typeof e.nonce!="string"||e.nonce.length===0||!Array.isArray(e.colours)||e.colours.length<1||e.colours.length>8||!e.colours.every(r=>de.includes(r))||!Array.isArray(e.onsetsMs)||e.onsetsMs.length!==e.colours.length)return!1;let t=-1;for(let r of e.onsetsMs){if(!h(r)||r<0||r<=t)return!1;t=r}return!(!h(e.holdMs)||e.holdMs<=0||!h(e.endMs)||e.endMs<=t||!h(e.clipMs)||e.clipMs<e.endMs||e.clipMs>8e3)}var y="0.1.0-rc.39";var ue=/FBAN|FBAV|FB_IAB|FBIOS|MessengerForiOS|Instagram|WhatsApp|musical_ly|BytedanceWebview|TikTok|Snapchat|\bLine\/|LinkedInApp|Pinterest|MicroMessenger|; wv\)/i;function g(n){let e=n??(typeof navigator>"u"?"":String(navigator.userAgent??""));return ue.test(e)}var G="sekyro.did",ke=1e4,Re=()=>globalThis.process?.versions?.node,W;function q(){let n=globalThis.crypto;try{if(typeof n?.randomUUID=="function")return n.randomUUID()}catch{}try{if(typeof n?.getRandomValues=="function"){let e=n.getRandomValues(new Uint8Array(16));return Array.from(e,t=>t.toString(16).padStart(2,"0")).join("")}}catch{}}function Me(){try{let n=localStorage.getItem(G);if(n)return n;let e=q();return e!==void 0&&localStorage.setItem(G,e),e}catch{return W??(W=q()),W}}async function Ce(){let n=globalThis.crypto?.subtle;if(!n)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]),r=await n.digest("SHA-256",new TextEncoder().encode(t));return Array.from(new Uint8Array(r),i=>i.toString(16).padStart(2,"0")).join("").slice(0,32)}function Pe(){try{let n=Number(navigator.maxTouchPoints);return Number.isFinite(n)&&n>=0?{touch:Math.min(64,Math.trunc(n))}:{}}catch{return{}}}function Ee(n){let e=new TextEncoder().encode(n),t="";for(let r of e)t+=String.fromCharCode(r);return btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function Ie(n){let e,t,r,i,o,s,d=()=>s?.readyState==="live",a=()=>{o!==void 0||!globalThis.crypto?.subtle||Re()||d()||(o=Promise.race([Promise.resolve().then(()=>(B(),K)),new Promise(c=>setTimeout(c,ke))]).then(c=>c?.computePrint(d)).then(c=>{c==="busy"?o=void 0:i=c}).catch(()=>{}))};return{timezone(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone?.slice(0,64)||void 0}catch{return}},noteCameraLabel(c){c&&(e=c.slice(0,128))},noteCamera(c){t=c},noteCameraTrack(c){s=c},async deviceHeader(){try{r??(r=Ce().catch(()=>""));let c=[];navigator.webdriver&&c.push("webdriver"),/HeadlessChrome/.test(navigator.userAgent)&&c.push("headless");let u=await r,p=Me(),Z={v:1,platform:"web",sdk:n.sdk.slice(0,64),caps:["session_proof"],rampAtArm:!0,ids:[...p?[{kind:"web_local",value:p.slice(0,128)}]:[],...u?[{kind:"web_fp",value:u}]:[]],screen:{w:screen.width,h:screen.height,dpr:globalThis.devicePixelRatio??1},...Pe(),...e?{cameraLabel:e}:{},...c.length?{signals:c}:{},...i?{print:{v:2,...i,...t?{camera:t}:{}}}:{},...g()?{inApp:!0}:{}},ee=Ee(JSON.stringify(Z));return a(),ee}catch{return}},printReady(){return o??Promise.resolve()}}}var _=Symbol.for("sekyro.web.clientContext"),v=globalThis,T=v[_]??(v[_]=Ie({sdk:`@sekyro/web@${y}`}));var k=["session_token_invalid","session_token_required","session_token_session_mismatch","session_not_found","rate_limit_exceeded","consent_required","session_not_active","check_not_found","check_already_finalized","check_out_of_order","check_type_unsupported","force_outcome_forbidden","attestation_invalid","platform_unregistered","app_attest_invalid","too_many_challenges","inference_unavailable","mobile_required","nni_locked","document_nni_mismatch","media_content_type_not_allowed","media_too_large","media_key_invalid","media_key_forbidden","media_not_found","media_unreadable","media_session_invalid","idempotency_key_collision","idempotency_in_progress","idempotency_key_required","validation_error","internal_error","unknown_error","upload_failed","network_error","timeout","nfc_outcome_not_accepted","identity_confirm_required","identity_confirm_locked","choice_not_found","choice_locked","choice_option_unavailable","step_not_on_path","check_not_active","sekyro_app_not_allowed","sekyro_app_unverified","id_number_locked","document_id_number_mismatch","simulated_capture_forbidden","native_app_required"];function $(n){return k.includes(n)}var l=class extends Error{constructor(e){super(e.message),this.name="HostedApiError",this.status=e.status,this.code=e.code,e.retryAfterSeconds!==void 0&&(this.retryAfterSeconds=e.retryAfterSeconds),e.details&&(this.details=e.details)}};function j(n,e,t=Math.random){let r=(n??e)*1e3,i=Math.min(Math.max(r,500),2e4),o=Math.round(i*(1+(t()*2-1)*.25));return Math.min(Math.max(o,500),2e4)}var Y=6e4,R=4,Ae=3e4,xe=9e5,Oe=200,Ne=5,He=400,De=new Set(["server_busy","request_timeout"]),Ve=20,Fe=60,Le=600,Ue=2;function m(n){return(n.split(";")[0]??"").trim()}var Ke={liveness:"clipKey",face_match:"imageKey",doc_ocr:"imageKey"},C=`@sekyro/web/${y}`,Be=C,b=class{constructor(e){this.sessionId=null;this.bootstrap=null;this.captureNonces=[];this.captureFetch=null;this.reportedIssues=new Map;this.issueReports=0;this.issuesPausedUntil=0;this.apiOrigin=e.apiOrigin.replace(/\/+$/,""),this.sessionToken=e.sessionToken;let t=e.fetch;this.fetchImpl=(r,i)=>(t??globalThis.fetch).call(globalThis,r,i),this.requestTimeoutMs=e.requestTimeoutMs??Ae,this.retryAttempts=e.inProgressRetry?.attempts??Ne,this.retryDelayMs=e.inProgressRetry?.delayMs??He,this.random=e.random??Math.random,this.clientLocale=e.locale}async getSession(){let e=await this.api("GET","/hosted/session");return this.sessionId=e.sessionId,e}async recordConsent(e){let t=await this.api("POST","/hosted/consent",{body:{locale:e},busyRetry:!0}),r=this.captureHold;return this.captureHold=void 0,r&&this.armCapture(r),t}async reportCameraUnavailable(e){return this.api("POST","/hosted/camera-unavailable",{body:{cause:e}})}async testerGate(e){return this.api("POST","/hosted/tester-gate",{body:{input:e}})}async reportCaptureIssue(e){let t=typeof e.name=="string"?e.name.replace(/[^A-Za-z]/g,"").slice(0,40):"",r=typeof e.engineKind=="string"&&/^[a-z_]{1,32}$/.test(e.engineKind)?e.engineKind:void 0,i=typeof e.attempt=="number"&&Number.isInteger(e.attempt)&&e.attempt>=0&&e.attempt<=1e3?e.attempt:void 0,o=e.check==="attestation"?i??"":"",s=[e.check,o,e.kind,t,e.phase??"",r??""].join("|"),d=this.reportedIssues.get(s);if(d!==void 0)return d;if(Date.now()<this.issuesPausedUntil||this.issueReports>=Ve)return;let a={check:e.check,kind:e.kind,...t!==""?{name:t}:{},...e.phase!==void 0?{phase:e.phase}:{},...r!==void 0?{engineKind:r}:{},...i!==void 0?{attempt:i}:{},...e.formFactor!==void 0?{formFactor:e.formFactor}:{},...typeof e.detail=="string"&&/^\d{1,10}$/.test(e.detail)?{detail:e.detail}:{},...z(e.challengeMs)?{challengeMs:e.challengeMs}:{},...z(e.readyMs)?{readyMs:e.readyMs}:{},...e.inApp===!0?{inApp:!0}:{}};this.issueReports+=1;let c=this.api("POST","/hosted/capture-issue",{body:a,empty:!0}).catch(u=>{if(u instanceof l&&u.status===429){let p=Math.min(Math.max(u.retryAfterSeconds??Fe,0),Le);this.issuesPausedUntil=Math.max(this.issuesPausedUntil,Date.now()+p*1e3);return}(!(u instanceof l)||u.status===0||u.status>=500)&&this.reportedIssues.delete(s)});return this.reportedIssues.set(s,c),c}async choose(e,t){let r=await this.api("POST","/hosted/choice",{body:{nodeId:e,option:t},busyRetry:!0});return this.sessionId=r.sessionId,r}async confirmIdentity(e){return this.api("POST","/hosted/identity/confirm",{body:{decision:e}})}async identityPortrait(){return this.api("GET","/hosted/identity/portrait",{blob:!0})}async presign(e,t,r,i={}){let o=await this.ensureSessionId(),s={kind:e,contentType:m(t),contentLength:r,...i.source==="upload"?{source:"upload"}:{}};return this.api("POST",`/sessions/${o}/media`,{body:s})}armCapture(e=2){let t=Date.now();this.captureNonces.filter(r=>r.expiresAt-Y>t).length>=e||(this.captureHold===void 0?this.fillCaptureNonces(e,e):this.captureHold=Math.max(this.captureHold,e))}async armRamp(){try{let e=await this.ensureSessionId(),t=await this.api("POST",`/sessions/${e}/media/capture-nonces`,{body:{count:2,ramp:!0}}),r=Date.now(),i=I(t.screenRamp)?t.screenRamp:void 0,o=r+Math.max(0,t.expiresIn)*1e3;for(let d of Array.isArray(t.nonces)?t.nonces:[])typeof d!="string"||d.length===0||this.captureNonces.push({nonce:d,expiresAt:o,...i!==void 0?{arm:i.nonce}:{}});this.captureNonces=this.captureNonces.slice(-R),this.captureHold=void 0;let s=typeof t.rampExpiresIn=="number"&&t.rampExpiresIn>0?t.rampExpiresIn:0;return{...i!==void 0?{challenge:i}:{},expiresAt:r+s*1e3}}catch{return}}async presignCapture(e,t,r,i={}){let o=await this.ensureSessionId(),s=await this.takeCaptureNonce(i.arm),d=s===void 0?void 0:{nonce:s,...i.engine!==void 0?{engine:i.engine.slice(0,32)}:{},...i.durationMs!==void 0&&Number.isFinite(i.durationMs)?{captureMs:Math.min(36e5,Math.max(0,Math.round(i.durationMs)))}:{}},a={kind:e,contentType:m(t),contentLength:r,capture:d};return this.api("POST",`/sessions/${o}/media`,{body:a})}async takeCaptureNonce(e){let t=()=>{let r=Date.now();this.captureNonces=this.captureNonces.filter(o=>o.expiresAt-Y>r);let i=this.captureNonces.findIndex(o=>o.arm===e);return this.captureNonces.splice(i<0?0:i,1)[0]?.nonce};for(let r=0;r<2;r++){let i=t();if(i!==void 0)return i;await this.fillCaptureNonces(1)}return t()}fillCaptureNonces(e,t=0){return this.captureFetch??(this.captureFetch=(async()=>{try{let r=await this.ensureSessionId(),i=await this.api("POST",`/sessions/${r}/media/capture-nonces`,{body:{count:Math.min(R,Math.max(1,e))}}),o=Date.now()+Math.max(0,i.expiresIn)*1e3;for(let s of Array.isArray(i.nonces)?i.nonces:[])typeof s=="string"&&s.length>0&&this.captureNonces.push({nonce:s,expiresAt:o});this.captureNonces=this.captureNonces.slice(-R),this.captureHold=void 0}catch(r){r instanceof l&&r.code==="consent_required"&&(this.captureHold=Math.max(this.captureHold??0,t))}})().finally(()=>{this.captureFetch=null})),this.captureFetch}async uploadToSpaces(e,t,r){let i;try{i=await this.fetchImpl(e,{method:"PUT",headers:{"content-type":m(r)},body:t,signal:AbortSignal.timeout(xe)})}catch(o){throw M(o)}if(!i.ok){let o=(await i.text().catch(()=>"")).slice(0,Oe);throw new l({status:i.status,code:"upload_failed",message:`media upload failed (HTTP ${i.status})${o?`: ${o}`:""}`})}}async completeMedia(e){let t=await this.ensureSessionId();return this.api("POST",`/sessions/${t}/media/complete`,{body:{key:e}})}async submitCheck(e,t,r={}){let i=await this.ensureSessionId(),o={input:t,forceOutcome:r.forceOutcome};return this.api("POST",`/sessions/${i}/checks/${e}`,{body:o,idempotencyKey:r.idempotencyKey,...r.browserCheckToken!==void 0?{browserCheckToken:r.browserCheckToken}:{},busyRetry:r.idempotencyKey!==void 0})}async uploadAndSubmit(e,t,r,i={}){let o=m(t.contentType),s=await this.presign(t.kind,o,t.blob.size);await this.uploadToSpaces(s.uploadUrl,t.blob,o);let d=await this.completeMedia(s.key),a={...r,[Ke[e]]:d.key};return this.submitCheck(e,a,i)}async ensureSessionId(){return this.sessionId!==null?this.sessionId:(this.bootstrap??(this.bootstrap=this.getSession().finally(()=>{this.bootstrap=null})),(await this.bootstrap).sessionId)}async api(e,t,r={}){let i=e==="GET"||r.busyRetry===!0,o=`${this.apiOrigin}/api/v2${t}`,s={"x-session-token":this.sessionToken,"x-sekyro-sdk":Be};r.body!==void 0&&(s["content-type"]="application/json"),r.idempotencyKey!==void 0&&(s["x-idempotency-key"]=r.idempotencyKey),r.browserCheckToken!==void 0&&(s["sekyro-browser-check"]=r.browserCheckToken),this.clientLocale!==void 0&&(s["sekyro-client-locale"]=this.clientLocale);try{let d=T.timezone();d!==void 0&&(s["sekyro-client-timezone"]=d)}catch{}s["sekyro-client-form-factor"]=E();try{let d=await T.deviceHeader();d!==void 0&&(s["sekyro-client-device"]=d)}catch{}for(let d=0;;d++){let a;try{a=await this.fetchImpl(o,{method:e,headers:s,...r.body!==void 0?{body:JSON.stringify(r.body)}:{},cache:"no-store",signal:AbortSignal.timeout(this.requestTimeoutMs)})}catch(u){throw M(u)}if(a.ok){if(r.empty===!0)return;if(r.blob===!0)try{return await a.blob()}catch(p){throw M(p)}let u;try{u=await a.json()}catch{throw new l({status:a.status,code:"unknown_error",message:`response body was not valid JSON (HTTP ${a.status})`})}return Ge(u)}let c=await We(a);if(c.code==="idempotency_in_progress"&&d<this.retryAttempts){this.retryDelayMs>0&&await X(this.retryDelayMs);continue}if(i&&c.status===503&&De.has(c.code)){i=!1,await X(j(c.retryAfterSeconds,Ue,this.random));continue}throw c}}};function z(n){return typeof n=="number"&&Number.isInteger(n)&&n>=0&&n<=6e5}function M(n){if((typeof n=="object"&&n!==null?n.name:void 0)==="TimeoutError")return new l({status:0,code:"timeout",message:"request timed out"});let t=n instanceof Error?n.message:String(n);return new l({status:0,code:"network_error",message:`network request failed: ${t}`})}function Ge(n){return n!==null&&typeof n=="object"&&"success"in n&&"data"in n?n.data:n}async function We(n){let e="unknown_error",t=`request failed (HTTP ${n.status})`,r=Number.NaN,i;try{let d=await n.json();if(d!==null&&typeof d=="object"){let a=d;typeof a.code=="string"&&a.code.length>0&&(e=a.code),typeof a.message=="string"&&a.message.length>0&&(t=a.message),typeof a.retryAfterSeconds=="number"&&(r=a.retryAfterSeconds),Array.isArray(a.details?.issues)?i=a.details:Array.isArray(a.details?.errors)&&(i={...a.details,issues:[]})}}catch{}let o=n.headers.get("retry-after"),s=o===null?Math.floor(r):Number.parseInt(o,10);return new l({status:n.status,code:e,message:t,...Number.isFinite(s)&&s>=0?{retryAfterSeconds:s}:{},details:i})}function X(n){return new Promise(e=>setTimeout(e,n))}function J(n){let e=n?.portrait,t=e?.icao,r=e?.purpose==="id_document";return t==null?r?{policy:"reject",profile:"id_document"}:null:{policy:t.policy==="alert"?"alert":"reject",profile:r||t.profile==="id_document"?"id_document":"selfie"}}function Q(n){return{...n.baselineEyeOpenness!==void 0?{baselineEyeOpenness:n.baselineEyeOpenness}:{},...n.baselineEyeOpennessLeft!==void 0&&n.baselineEyeOpennessRight!==void 0?{baselineEyeOpennessLeft:n.baselineEyeOpennessLeft,baselineEyeOpennessRight:n.baselineEyeOpennessRight}:{},criteria:n.verdict??{},...n.backgroundCheck!==void 0?{backgroundCheck:n.backgroundCheck}:{}}}0&&(module.exports={HostedApiError,HostedClient,KNOWN_CODES,SEKYRO_SDK_HEADER,icaoPolicyOf,isInAppBrowser,isKnownCode,portraitIcaoGate,stripMimeParams});
|
package/dist/client/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { H as HostedClient, a as HostedClientOptions, M as MediaCheckType, S as SEKYRO_SDK_HEADER, b as SubmitOptions, U as UploadMedia, s as stripMimeParams } from '../icao-gate-
|
|
2
|
-
export { H as HostedApiError, a as HostedErrorDetails, b as HostedErrorIssue, K as KNOWN_CODES, c as KnownCode, i as icaoPolicyOf, d as isKnownCode, p as portraitIcaoGate } from '../icao-policy-
|
|
3
|
-
export { A as AcceptedDocumentType, a as ArmedRamp, b as AttestationInput, C as CaptureContext, c as CaptureMode, d as CaptureNoncesResult, e as CaptureProof, f as CheckInputByType, g as CheckReason, h as CheckState, i as CheckType, j as ClosedBy, k as CompleteMediaResult, l as ConsentLocale, m as ContactChannel, D as DecisionReason, n as DocDeviceRead, o as DocOcrInput, p as DocReason, q as DocSide, E as EidAfterPass, r as EidAuthInput, s as EidReason, t as EmailOtpInput, u as EmailOtpReason, F as FaceMatchInput, v as FaceMatchReason, w as FormAddressValue, x as FormAnswerValue, y as FormChoiceView, z as FormConsentView, B as FormCustomQuestionView, G as FormFieldName, H as FormFieldQuestionView, I as FormInput, J as FormIssueCode, K as FormLocale, L as FormQuestionOptions, M as FormQuestionType, N as FormQuestionView, O as HostedAcceptedDocuments, P as HostedCaptureTuning, Q as HostedChallengeView, R as HostedConsentView, S as HostedDocumentCaptureTuning, T as HostedDocumentScanTuning, U as HostedDocumentsView, V as HostedEidView, W as HostedEmailOtpView, X as HostedFlowRef, Y as HostedFormView, Z as HostedIcaoPolicy, _ as HostedIntegrity, $ as HostedLivePhotoTuning, a0 as HostedNativeAppView, a1 as HostedNativeCaptureTuning, a2 as HostedOcrTuning, a3 as HostedOtpView, a4 as HostedPlanView, a5 as HostedPoaRuleKindView, a6 as HostedPoaRuleView, a7 as HostedPortraitPendingFix, a8 as HostedPortraitView, a9 as HostedProofOfAddressView, aa as HostedSessionView, ab as HostedSimulationView, ac as HostedStepView, ad as HostedTesterGateView, ae as HostedVoiceLocale, af as HostedVoiceView, ag as IcaoCriterion, ah as IcaoReportEntry, ai as IdentityConfirmDecision, aj as IdentityMethod, ak as IdentitySummarySource, al as IdentitySummaryView, am as LivenessCaptureInput, an as LivenessInput, ao as LivenessReason, ap as MatchReason, aq as MediaKind, ar as MethodChoiceView, as as NationalEidOption, at as NfcChipReason, au as NfcStepView, av as OtpChoiceView, aw as PhoneCountryRule, ax as PhoneFormat, ay as PhoneOtpInput, az as PhoneOtpReason, aA as PhotoSource, aB as PhotoSourcePick, aC as PlanAttempts, aD as PlanChoiceKind, aE as PlanChoiceOption, aF as PlanChoiceView, aG as PlanSectionView, aH as PlanStepView, aI as PoaImagesInput, aJ as PoaInput, aK as PoaKind, aL as PoaLicenceInput, aM as PoaNameMatchMode, aN as PoaPdfInput, aO as PoaReason, aP as PoaRuleSource, aQ as PopulationInput, aR as PopulationReason, aS as PortraitFix, aT as PortraitFixReviewInput, aU as PortraitIcaoInput, aV as PortraitIcaoReason, aW as PortraitOutputFormat, aX as PresignRequest, aY as PresignUploadResult, aZ as RecordConsentResult, a_ as ResolvedCaptureMode, a$ as SandboxSimulatedReason, b0 as SandboxSimulation, b1 as SessionDecidingStep, b2 as SessionFailureReason, b3 as SessionReason, b4 as SessionStatus, b5 as SessionStepView, b6 as SessionView, b7 as SimulatedCaptureInput, b8 as StepResult, b9 as StepSection, ba as SubmitCheckBody, bb as TesterGateInput, bc as TesterGateResponse, bd as VerificationAssurance, be as VerificationLevel } from '../types-
|
|
1
|
+
export { H as HostedClient, a as HostedClientOptions, M as MediaCheckType, S as SEKYRO_SDK_HEADER, b as SubmitOptions, U as UploadMedia, s as stripMimeParams } from '../icao-gate-C-fkVe6r.cjs';
|
|
2
|
+
export { H as HostedApiError, a as HostedErrorDetails, b as HostedErrorIssue, K as KNOWN_CODES, c as KnownCode, i as icaoPolicyOf, d as isKnownCode, p as portraitIcaoGate } from '../icao-policy-B_daycJk.cjs';
|
|
3
|
+
export { A as AcceptedDocumentType, a as ArmedRamp, b as AttestationInput, C as CaptureContext, c as CaptureMode, d as CaptureNoncesResult, e as CaptureProof, f as CheckInputByType, g as CheckReason, h as CheckState, i as CheckType, j as ClosedBy, k as CompleteMediaResult, l as ConsentLocale, m as ContactChannel, D as DecisionReason, n as DocDeviceRead, o as DocOcrInput, p as DocReason, q as DocSide, E as EidAfterPass, r as EidAuthInput, s as EidReason, t as EmailOtpInput, u as EmailOtpReason, F as FaceMatchInput, v as FaceMatchReason, w as FormAddressValue, x as FormAnswerValue, y as FormChoiceView, z as FormConsentView, B as FormCustomQuestionView, G as FormFieldName, H as FormFieldQuestionView, I as FormInput, J as FormIssueCode, K as FormLocale, L as FormQuestionOptions, M as FormQuestionType, N as FormQuestionView, O as HostedAcceptedDocuments, P as HostedCaptureTuning, Q as HostedChallengeView, R as HostedConsentView, S as HostedDocumentCaptureTuning, T as HostedDocumentScanTuning, U as HostedDocumentsView, V as HostedEidView, W as HostedEmailOtpView, X as HostedFlowRef, Y as HostedFormView, Z as HostedIcaoPolicy, _ as HostedIntegrity, $ as HostedLivePhotoTuning, a0 as HostedNativeAppView, a1 as HostedNativeCaptureTuning, a2 as HostedOcrTuning, a3 as HostedOtpView, a4 as HostedPlanView, a5 as HostedPoaRuleKindView, a6 as HostedPoaRuleView, a7 as HostedPortraitPendingFix, a8 as HostedPortraitView, a9 as HostedProofOfAddressView, aa as HostedSessionView, ab as HostedSimulationView, ac as HostedStepView, ad as HostedTesterGateView, ae as HostedVoiceLocale, af as HostedVoiceView, ag as IcaoCriterion, ah as IcaoReportEntry, ai as IdentityConfirmDecision, aj as IdentityMethod, ak as IdentitySummarySource, al as IdentitySummaryView, am as LivenessCaptureInput, an as LivenessInput, ao as LivenessReason, ap as MatchReason, aq as MediaKind, ar as MethodChoiceView, as as NationalEidOption, at as NfcChipReason, au as NfcStepView, av as OtpChoiceView, aw as PhoneCountryRule, ax as PhoneFormat, ay as PhoneOtpInput, az as PhoneOtpReason, aA as PhotoSource, aB as PhotoSourcePick, aC as PlanAttempts, aD as PlanChoiceKind, aE as PlanChoiceOption, aF as PlanChoiceView, aG as PlanSectionView, aH as PlanStepView, aI as PoaImagesInput, aJ as PoaInput, aK as PoaKind, aL as PoaLicenceInput, aM as PoaNameMatchMode, aN as PoaPdfInput, aO as PoaReason, aP as PoaRuleSource, aQ as PopulationInput, aR as PopulationReason, aS as PortraitFix, aT as PortraitFixReviewInput, aU as PortraitIcaoInput, aV as PortraitIcaoReason, aW as PortraitOutputFormat, aX as PresignRequest, aY as PresignUploadResult, aZ as RecordConsentResult, a_ as ResolvedCaptureMode, a$ as SandboxSimulatedReason, b0 as SandboxSimulation, b1 as SessionDecidingStep, b2 as SessionFailureReason, b3 as SessionReason, b4 as SessionStatus, b5 as SessionStepView, b6 as SessionView, b7 as SimulatedCaptureInput, b8 as StepResult, b9 as StepSection, ba as SubmitCheckBody, bb as TesterGateInput, bc as TesterGateResponse, bd as VerificationAssurance, be as VerificationLevel } from '../types-BUnFqG97.cjs';
|
|
4
4
|
|
|
5
5
|
/** The page runs inside an app's WebView (WhatsApp, Instagram, Facebook, TikTok, Snapchat, LINE, LinkedIn, WeChat, an Android WebView…). */
|
|
6
6
|
declare function isInAppBrowser(userAgent?: string): boolean;
|
package/dist/client/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { H as HostedClient, a as HostedClientOptions, M as MediaCheckType, S as SEKYRO_SDK_HEADER, b as SubmitOptions, U as UploadMedia, s as stripMimeParams } from '../icao-gate-
|
|
2
|
-
export { H as HostedApiError, a as HostedErrorDetails, b as HostedErrorIssue, K as KNOWN_CODES, c as KnownCode, i as icaoPolicyOf, d as isKnownCode, p as portraitIcaoGate } from '../icao-policy-
|
|
3
|
-
export { A as AcceptedDocumentType, a as ArmedRamp, b as AttestationInput, C as CaptureContext, c as CaptureMode, d as CaptureNoncesResult, e as CaptureProof, f as CheckInputByType, g as CheckReason, h as CheckState, i as CheckType, j as ClosedBy, k as CompleteMediaResult, l as ConsentLocale, m as ContactChannel, D as DecisionReason, n as DocDeviceRead, o as DocOcrInput, p as DocReason, q as DocSide, E as EidAfterPass, r as EidAuthInput, s as EidReason, t as EmailOtpInput, u as EmailOtpReason, F as FaceMatchInput, v as FaceMatchReason, w as FormAddressValue, x as FormAnswerValue, y as FormChoiceView, z as FormConsentView, B as FormCustomQuestionView, G as FormFieldName, H as FormFieldQuestionView, I as FormInput, J as FormIssueCode, K as FormLocale, L as FormQuestionOptions, M as FormQuestionType, N as FormQuestionView, O as HostedAcceptedDocuments, P as HostedCaptureTuning, Q as HostedChallengeView, R as HostedConsentView, S as HostedDocumentCaptureTuning, T as HostedDocumentScanTuning, U as HostedDocumentsView, V as HostedEidView, W as HostedEmailOtpView, X as HostedFlowRef, Y as HostedFormView, Z as HostedIcaoPolicy, _ as HostedIntegrity, $ as HostedLivePhotoTuning, a0 as HostedNativeAppView, a1 as HostedNativeCaptureTuning, a2 as HostedOcrTuning, a3 as HostedOtpView, a4 as HostedPlanView, a5 as HostedPoaRuleKindView, a6 as HostedPoaRuleView, a7 as HostedPortraitPendingFix, a8 as HostedPortraitView, a9 as HostedProofOfAddressView, aa as HostedSessionView, ab as HostedSimulationView, ac as HostedStepView, ad as HostedTesterGateView, ae as HostedVoiceLocale, af as HostedVoiceView, ag as IcaoCriterion, ah as IcaoReportEntry, ai as IdentityConfirmDecision, aj as IdentityMethod, ak as IdentitySummarySource, al as IdentitySummaryView, am as LivenessCaptureInput, an as LivenessInput, ao as LivenessReason, ap as MatchReason, aq as MediaKind, ar as MethodChoiceView, as as NationalEidOption, at as NfcChipReason, au as NfcStepView, av as OtpChoiceView, aw as PhoneCountryRule, ax as PhoneFormat, ay as PhoneOtpInput, az as PhoneOtpReason, aA as PhotoSource, aB as PhotoSourcePick, aC as PlanAttempts, aD as PlanChoiceKind, aE as PlanChoiceOption, aF as PlanChoiceView, aG as PlanSectionView, aH as PlanStepView, aI as PoaImagesInput, aJ as PoaInput, aK as PoaKind, aL as PoaLicenceInput, aM as PoaNameMatchMode, aN as PoaPdfInput, aO as PoaReason, aP as PoaRuleSource, aQ as PopulationInput, aR as PopulationReason, aS as PortraitFix, aT as PortraitFixReviewInput, aU as PortraitIcaoInput, aV as PortraitIcaoReason, aW as PortraitOutputFormat, aX as PresignRequest, aY as PresignUploadResult, aZ as RecordConsentResult, a_ as ResolvedCaptureMode, a$ as SandboxSimulatedReason, b0 as SandboxSimulation, b1 as SessionDecidingStep, b2 as SessionFailureReason, b3 as SessionReason, b4 as SessionStatus, b5 as SessionStepView, b6 as SessionView, b7 as SimulatedCaptureInput, b8 as StepResult, b9 as StepSection, ba as SubmitCheckBody, bb as TesterGateInput, bc as TesterGateResponse, bd as VerificationAssurance, be as VerificationLevel } from '../types-
|
|
1
|
+
export { H as HostedClient, a as HostedClientOptions, M as MediaCheckType, S as SEKYRO_SDK_HEADER, b as SubmitOptions, U as UploadMedia, s as stripMimeParams } from '../icao-gate-Bux2CcJc.js';
|
|
2
|
+
export { H as HostedApiError, a as HostedErrorDetails, b as HostedErrorIssue, K as KNOWN_CODES, c as KnownCode, i as icaoPolicyOf, d as isKnownCode, p as portraitIcaoGate } from '../icao-policy-C5XcEwqj.js';
|
|
3
|
+
export { A as AcceptedDocumentType, a as ArmedRamp, b as AttestationInput, C as CaptureContext, c as CaptureMode, d as CaptureNoncesResult, e as CaptureProof, f as CheckInputByType, g as CheckReason, h as CheckState, i as CheckType, j as ClosedBy, k as CompleteMediaResult, l as ConsentLocale, m as ContactChannel, D as DecisionReason, n as DocDeviceRead, o as DocOcrInput, p as DocReason, q as DocSide, E as EidAfterPass, r as EidAuthInput, s as EidReason, t as EmailOtpInput, u as EmailOtpReason, F as FaceMatchInput, v as FaceMatchReason, w as FormAddressValue, x as FormAnswerValue, y as FormChoiceView, z as FormConsentView, B as FormCustomQuestionView, G as FormFieldName, H as FormFieldQuestionView, I as FormInput, J as FormIssueCode, K as FormLocale, L as FormQuestionOptions, M as FormQuestionType, N as FormQuestionView, O as HostedAcceptedDocuments, P as HostedCaptureTuning, Q as HostedChallengeView, R as HostedConsentView, S as HostedDocumentCaptureTuning, T as HostedDocumentScanTuning, U as HostedDocumentsView, V as HostedEidView, W as HostedEmailOtpView, X as HostedFlowRef, Y as HostedFormView, Z as HostedIcaoPolicy, _ as HostedIntegrity, $ as HostedLivePhotoTuning, a0 as HostedNativeAppView, a1 as HostedNativeCaptureTuning, a2 as HostedOcrTuning, a3 as HostedOtpView, a4 as HostedPlanView, a5 as HostedPoaRuleKindView, a6 as HostedPoaRuleView, a7 as HostedPortraitPendingFix, a8 as HostedPortraitView, a9 as HostedProofOfAddressView, aa as HostedSessionView, ab as HostedSimulationView, ac as HostedStepView, ad as HostedTesterGateView, ae as HostedVoiceLocale, af as HostedVoiceView, ag as IcaoCriterion, ah as IcaoReportEntry, ai as IdentityConfirmDecision, aj as IdentityMethod, ak as IdentitySummarySource, al as IdentitySummaryView, am as LivenessCaptureInput, an as LivenessInput, ao as LivenessReason, ap as MatchReason, aq as MediaKind, ar as MethodChoiceView, as as NationalEidOption, at as NfcChipReason, au as NfcStepView, av as OtpChoiceView, aw as PhoneCountryRule, ax as PhoneFormat, ay as PhoneOtpInput, az as PhoneOtpReason, aA as PhotoSource, aB as PhotoSourcePick, aC as PlanAttempts, aD as PlanChoiceKind, aE as PlanChoiceOption, aF as PlanChoiceView, aG as PlanSectionView, aH as PlanStepView, aI as PoaImagesInput, aJ as PoaInput, aK as PoaKind, aL as PoaLicenceInput, aM as PoaNameMatchMode, aN as PoaPdfInput, aO as PoaReason, aP as PoaRuleSource, aQ as PopulationInput, aR as PopulationReason, aS as PortraitFix, aT as PortraitFixReviewInput, aU as PortraitIcaoInput, aV as PortraitIcaoReason, aW as PortraitOutputFormat, aX as PresignRequest, aY as PresignUploadResult, aZ as RecordConsentResult, a_ as ResolvedCaptureMode, a$ as SandboxSimulatedReason, b0 as SandboxSimulation, b1 as SessionDecidingStep, b2 as SessionFailureReason, b3 as SessionReason, b4 as SessionStatus, b5 as SessionStepView, b6 as SessionView, b7 as SimulatedCaptureInput, b8 as StepResult, b9 as StepSection, ba as SubmitCheckBody, bb as TesterGateInput, bc as TesterGateResponse, bd as VerificationAssurance, be as VerificationLevel } from '../types-BUnFqG97.js';
|
|
4
4
|
|
|
5
5
|
/** The page runs inside an app's WebView (WhatsApp, Instagram, Facebook, TikTok, Snapchat, LINE, LinkedIn, WeChat, an Android WebView…). */
|
|
6
6
|
declare function isInAppBrowser(userAgent?: string): boolean;
|
package/dist/client/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as o,b as t,c as i,e as n,f as s,g as a,h as r,i as p}from"../chunk-
|
|
1
|
+
import{a as o,b as t,c as i,e as n,f as s,g as a,h as r,i as p}from"../chunk-PNOGF72U.js";import"../chunk-U5TL63CG.js";import"../chunk-TSA6GHUG.js";import{b as e}from"../chunk-HMOOVRKA.js";export{i as HostedApiError,a as HostedClient,o as KNOWN_CODES,s as SEKYRO_SDK_HEADER,r as icaoPolicyOf,e as isInAppBrowser,t as isKnownCode,p as portraitIcaoGate,n as stripMimeParams};
|
package/dist/core/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var _n=Object.create;var Q=Object.defineProperty;var An=Object.getOwnPropertyDescriptor;var Dn=Object.getOwnPropertyNames;var In=Object.getPrototypeOf,On=Object.prototype.hasOwnProperty;var R=(t,e)=>()=>(t&&(e=t(t=0)),e);var B=(t,e)=>{for(var n in e)Q(t,n,{get:e[n],enumerable:!0})},Je=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Dn(e))!On.call(t,i)&&i!==n&&Q(t,i,{get:()=>e[i],enumerable:!(r=An(e,i))||r.enumerable});return t};var Pn=(t,e,n)=>(n=t!=null?_n(In(t)):{},Je(e||!t||!t.__esModule?Q(n,"default",{value:t,enumerable:!0}):n,t)),Fn=t=>Je(Q({},"__esModule",{value:!0}),t);var mt={};B(mt,{blobBytes:()=>rt,inspectClip:()=>Kn,inspectClipBytes:()=>it,webmDurationMs:()=>ir,withWebmDuration:()=>rr});async function Kn(t){try{return it(await rt(t))}catch{return null}}async function rt(t){return typeof t.arrayBuffer=="function"?new Uint8Array(await t.arrayBuffer()):new Promise((e,n)=>{let r=new FileReader;r.onload=()=>e(new Uint8Array(r.result)),r.onerror=()=>n(r.error),r.readAsArrayBuffer(t)})}function it(t){if(t.length<8)return null;try{if(t[0]===26&&t[1]===69&&t[2]===223&&t[3]===163)return nr(t);if(Ee(t,4,4)==="ftyp")return qn(t)}catch{return null}return null}function qn(t){let e=new DataView(t.buffer,t.byteOffset,t.byteLength),n=[],r=null,i=null,a=0,o=(c,u)=>{let l=c;for(;l+8<=u;){let d=e.getUint32(l),f=Ee(t,l+4,4),h=8;if(d===1){if(l+16>u)return;d=Number(e.getBigUint64(l+8)),h=16}else d===0&&(d=u-l);if(d<h)return;let p=Math.min(l+d,u),m=l+h;if(f==="trak"&&(r={id:0,video:!1,timescale:0,frames:0,units:0,defaultDuration:0},n.push(r)),f==="traf"&&(i=null,a=0),zn.has(f))o(m,p);else if(f==="tkhd"&&r)r.id=e.getUint32(m+(t[m]===1?20:12));else if(f==="hdlr"&&r)r.video=Ee(t,m+8,4)==="vide";else if(f==="mdhd"&&r)r.timescale=e.getUint32(m+(t[m]===1?20:12));else if(f==="stts"&&r){let b=e.getUint32(m+4);for(let g=0;g<b;g++){let y=e.getUint32(m+8+g*8);r.frames+=y,r.units+=y*e.getUint32(m+12+g*8)}}else if(f==="trex"){let b=n.find(g=>g.id===e.getUint32(m+4));b&&(b.defaultDuration=e.getUint32(m+12))}else if(f==="tfhd"){let b=e.getUint32(m)&16777215;i=n.find(y=>y.id===e.getUint32(m+4))??null;let g=m+8;b&1&&(g+=8),b&2&&(g+=4),a=b&8?e.getUint32(g):i?.defaultDuration??0}else if(f==="trun"&&i){let b=e.getUint32(m)&16777215,g=e.getUint32(m+4),y=m+8;b&1&&(y+=4),b&4&&(y+=4);let w=(b&256?4:0)+(b&512?4:0)+(b&1024?4:0)+(b&2048?4:0);for(let k=0;k<g;k++)i.units+=b&256?e.getUint32(y+k*w):a;i.frames+=g}l=p}};o(0,t.length);let s=n.find(c=>c.video&&c.timescale>0);return!s||s.frames===0?null:{container:"mp4",frames:s.frames,durationMs:xe(s.units*1e3/s.timescale)}}function tr(t,e){let n=t[e];if(n===void 0||n===0)return null;let r=Math.clz32(n)-23;if(r<1||r>4||e+r>t.length)return null;let i=0;for(let a=0;a<r;a++)i=i*256+t[e+a];return[i,r]}function dt(t,e){let n=t[e];if(n===void 0||n===0)return null;let r=Math.clz32(n)-23;if(r<1||r>8||e+r>t.length)return null;let i=n&255>>r,a=i===255>>r;for(let o=1;o<r;o++){let s=t[e+o];i=i*256+s,s!==255&&(a=!1)}return[a?-1:i,r]}function _(t,e,n){let r=0;for(let i=0;i<n;i++)r=r*256+t[e+i];return r}function Se(t){let e=[],n=0;for(;n<t.length;){let r=tr(t,n);if(!r)break;let i=dt(t,n+r[1]);if(!i)break;let a={id:r[0],start:n,sizeAt:n+r[1],data:n+r[1]+i[1],size:i[0]};if(e.push(a),lt.has(a.id))n=a.data;else{if(a.size<0)break;n=a.data+a.size}}return e}function nr(t){let e=new DataView(t.buffer,t.byteOffset,t.byteLength),n=1e6,r=[],i=0,a=[];for(let c of Se(t)){if(c.data+Math.max(0,c.size)>t.length&&!lt.has(c.id))break;switch(c.id){case Te:n=_(t,c.data,c.size)||n;break;case st:r.push({num:0,type:0});break;case Zn:r.length&&(r[r.length-1].num=_(t,c.data,c.size));break;case jn:r.length&&(r[r.length-1].type=_(t,c.data,c.size));break;case $n:i=_(t,c.data,c.size);break;case Qn:case Jn:{let u=dt(t,c.data);if(!u||c.data+u[1]+2>t.length)break;let l=r.filter(d=>d.type===1).map(d=>d.num);if(l.length>0&&!l.includes(u[0]))break;a.push((i+e.getInt16(c.data+u[1]))*n/1e6);break}default:break}}if(a.length===0)return null;a.sort((c,u)=>c-u);let o=a.slice(1).map((c,u)=>c-a[u]),s=o.length?o.sort((c,u)=>c-u)[Math.floor(o.length/2)]:0;return{container:"webm",frames:a.length,durationMs:xe(a[a.length-1]-a[0]+s)}}function rr(t,e){if(!(e>0))return null;let n=Se(t),r=n.find(m=>m.id===at);if(!r||r.size!==-1||n.some(m=>m.id===er))return null;let i=n.find(m=>m.id===ot);if(!i||i.size<0||i.data+i.size>t.length)return null;let a=1e6,o=[];for(let m of n)m.start<i.data||m.start>=i.data+i.size||(m.id===Te&&(a=_(t,m.data,m.size)||a),m.id!==ut&&o.push(t.subarray(m.start,m.data+m.size)));let s=new Uint8Array(11);s.set([68,137,136]),new DataView(s.buffer).setFloat64(3,e*1e6/a);let c=o.reduce((m,b)=>m+b.length,0)+s.length,u=new Uint8Array(12);u.set([21,73,169,102,1]);let l=c;for(let m=11;m>=5;m--)u[m]=l&255,l=Math.floor(l/256);let d=t.subarray(i.data+i.size),f=new Uint8Array(i.start+u.length+c+d.length),h=0,p=m=>{f.set(m,h),h+=m.length};return p(t.subarray(0,i.start)),p(u),o.forEach(p),p(s),p(d),f}function ir(t){let e=1e6,n=null,r=new DataView(t.buffer,t.byteOffset,t.byteLength);for(let i of Se(t))if(i.id===Te&&(e=_(t,i.data,i.size)||e),i.id===ut&&(n=i.size===8?r.getFloat64(i.data):i.size===4?r.getFloat32(i.data):null),i.id===ct)break;return n===null?null:xe(n*e/1e6)}function Ee(t,e,n){let r="";for(let i=0;i<n&&e+i<t.length;i++)r+=String.fromCharCode(t[e+i]);return r}function xe(t){return Math.round(t*10)/10}var zn,at,ot,Xn,st,ct,Yn,Te,ut,Zn,jn,$n,Qn,Jn,er,lt,ft=R(()=>{"use strict";zn=new Set(["moov","trak","mdia","minf","stbl","mvex","moof","traf","edts"]);at=408125543,ot=357149030,Xn=374648427,st=174,ct=524531317,Yn=160,Te=2807729,ut=17545,Zn=215,jn=131,$n=231,Qn=163,Jn=161,er=290298740,lt=new Set([at,ot,Xn,st,ct,Yn])});function Ne(t,e=80){return typeof t=="string"&&t.replace(/[^A-Za-z0-9 ()\-._,]/g,"").trim().slice(0,e)||void 0}function L(t){try{return t()}catch{return}}function N(t){let e={};for(let[n,r]of Object.entries(t))r!==void 0&&(e[n]=r);return Object.keys(e).length>0?e:void 0}function Ue(t,e){F=N({renderer:Ne(t),vendor:Ne(e)})??F}function Tr(t){return F===void 0&&(F=null,L(()=>{let e=t?.createElement("canvas").getContext("webgl");if(e){let n=e.getExtension("WEBGL_debug_renderer_info");Ue(e.getParameter(n?n.UNMASKED_RENDERER_WEBGL:e.RENDERER),e.getParameter(n?n.UNMASKED_VENDOR_WEBGL:e.VENDOR)),e.getExtension("WEBGL_lose_context")?.loseContext()}})),F??void 0}function Sr(t){let e=t.navigator,n=t.screen?.orientation?.type,r=t.devicePixelRatio;return N({touchPoints:S(e?.maxTouchPoints),webdriver:Ot(e?.webdriver),uaMobile:Ot(e?.userAgentData?.mobile),uaPlatform:Ne(e?.userAgentData?.platform,32),screenW:S(t.screen?.width),screenH:S(t.screen?.height),dpr:typeof r=="number"&&r>0&&Number.isFinite(r)?Ve(r):void 0,coarse:Pt(t,"(pointer: coarse)"),noHover:Pt(t,"(hover: none)"),orientation:Er.test(n)?n:void 0})}function xr(t,e){let n=L(()=>t.getCapabilities?.()),r=i=>{let a=i;return typeof a?.min=="number"&&typeof a.max=="number"?a.max>a.min:void 0};return N({inputs:e,capabilities:n?Mr.filter(i=>i in n):void 0,frameRateRange:r(n?.frameRate),widthRange:r(n?.width)})}async function Lt(t,e=globalThis){let n=new Promise(a=>{let o=()=>a(Tr(e.document));F!==void 0?o():typeof e.requestIdleCallback=="function"?e.requestIdleCallback(o,{timeout:It}):setTimeout(o,0)}),r=Promise.race([Promise.resolve().then(()=>e.navigator?.mediaDevices?.enumerateDevices?.()).then(a=>a?.filter(o=>o.kind==="videoinput").length,()=>{}),new Promise(a=>setTimeout(a,It))]),i=L(()=>Sr(e));return N({gpu:await n,device:i,camera:xr(t,await r)})??{}}function Ft(){let t=0,e=0,n=0;return{add(r,i,a){if(typeof r!="number"||typeof i!="number"||typeof a!="number")return;let o=Math.hypot(r,i,a);if(!Number.isFinite(o))return;t+=1;let s=o-e;e+=s/t,n+=s*(o-e)},std:()=>t<2?void 0:Ve(Math.sqrt(n/(t-1)))}}function Nt(t=globalThis){let e=t.DeviceMotionEvent,n=typeof e=="function"&&typeof e.requestPermission!="function"&&typeof t.addEventListener=="function",r=0,i,a=Ft(),o=Ft(),s=d=>{r+=1,typeof d.interval=="number"&&d.interval>=0&&Number.isFinite(d.interval)&&(i=Ve(d.interval));let f=d.accelerationIncludingGravity;f&&a.add(f.x,f.y,f.z);let h=d.rotationRate;h&&o.add(h.alpha,h.beta,h.gamma)},c=0,u=()=>{c+=1};L(()=>{n&&t.addEventListener("devicemotion",s),t.document?.addEventListener("visibilitychange",u)});let l;return{stop(){return l!==void 0||(L(()=>{n&&t.removeEventListener?.("devicemotion",s),t.document?.removeEventListener("visibilitychange",u)}),l={motion:n?{available:n,events:r,...N({intervalMs:i,accelStd:a.std(),rotationStd:o.std()})}:{available:n},page:N({visibilityChanges:c,outerW:S(t.outerWidth),outerH:S(t.outerHeight),innerW:S(t.innerWidth),innerH:S(t.innerHeight)})}),l}}}var Mr,Er,It,S,Ot,Ve,F,Pt,Ge=R(()=>{"use strict";Mr="zoom torch focusMode focusDistance exposureMode exposureCompensation exposureTime whiteBalanceMode colorTemperature iso facingMode frameRate width height aspectRatio resizeMode deviceId groupId".split(" "),Er=/^(portrait|landscape)-(primary|secondary)$/,It=1e3;S=t=>typeof t=="number"&&Number.isFinite(t)&&t>=0?Math.round(t):void 0,Ot=t=>typeof t=="boolean"?t:void 0,Ve=t=>Math.round(t*1e4)/1e4;Pt=(t,e)=>L(()=>t.matchMedia?.(e).matches)});function Vt(t){let e=(t??"").trim().toLowerCase();return e.length===0?"unknown":Cr.some(n=>e.includes(n))?"known_virtual":Rr.some(n=>n.test(e))?"platform":"unknown"}var Cr,Rr,Ut=R(()=>{"use strict";Cr=["obs","manycam","virtual","snap camera","xsplit","droidcam","iriun","camo","fake_device","fake-capture-device"],Rr=[/^(front|back|rear)( [a-z ]+)? camera$/i,/^caméra (avant|arrière)\b/i,/^cámara (frontal|trasera|delantera)\b/i,/^câmera (frontal|traseira)\b/i,/^(front|rück)kamera\b/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]});var Bt={};B(Bt,{bounded:()=>j,cameraHash:()=>Gt,hex16:()=>le,noteCameraTrait:()=>Dr});function j(t,e){return new Promise(n=>{let r=setTimeout(()=>n(void 0),e),i=a=>{clearTimeout(r),n(a)};try{t().then(i,()=>i(void 0))}catch{i(void 0)}})}async function le(t){let e=await crypto.subtle.digest("SHA-256",new TextEncoder().encode(JSON.stringify(t)));return Array.from(new Uint8Array(e).subarray(0,8),n=>n.toString(16).padStart(2,"0")).join("")}function Ar(t){try{return t.getSettings?.().facingMode==="environment"}catch{return!1}}async function Gt(t){try{if(t.readyState==="ended"||Ar(t))return;let e={};try{e=t.getCapabilities?.()??{}}catch{}let n=await j(()=>navigator.mediaDevices.enumerateDevices(),_r);return await le([He(e.width),He(e.height),He(e.frameRate),Be(e.facingMode),Be(e.focusMode),Be(e.exposureMode),Vt(t.label),n?.filter(r=>r.kind==="videoinput").length??null])}catch{return}}async function Dr(t,e){let n=await Gt(t);n&&e.noteCamera(n)}var _r,Be,He,We=R(()=>{"use strict";Ut();_r=1e3;Be=t=>Array.isArray(t)?[...t].sort():null,He=t=>{let e=t;return e==null?null:[e.min??null,e.max??null]}});var zt={};B(zt,{computePrint:()=>Wr,readHints:()=>Kt});function Ht(t,e){if(typeof t!="string")return;let n=t.trim();return n.length>0&&n.length<=e?n:void 0}async function Kt(){let t=navigator.userAgentData;if(typeof t?.getHighEntropyValues!="function")return;let e=await j(()=>t.getHighEntropyValues(["model","platformVersion"]),Fr);if(e==null)return;let n=Ht(e.model,Nr),r=Ht(e.platformVersion,Vr),i={...n!==void 0?{model:n}:{},...r!==void 0?{platformVersion:r}:{}};return Object.keys(i).length>0?i:void 0}async function Br(){let[t,e]=await Promise.all([new Wt.Thumbmark({stabilize:["private","iframe"],exclude:["permissions","webrtc","speech"],logging:!1,collect_beacon:!1,timeout:Or}).get(),Kt()]),n=t?.components?.hardware?.videocard;n!==null&&typeof n=="object"&&Ue(n.rendererUnmasked??n.renderer,n.vendorUnmasked??n.vendor);let r=t?.thumbmark;if(typeof r!="string"||r.length<Ur||r.length>Gr)return;let i={};for(let a of Ir){let o=t.components?.[a];o==null||o.timeout==="true"||(i[a]=await le(o))}return{hash:r,c:i,...e!==void 0?{hints:e}:{}}}function Hr(){return new Promise(t=>{typeof globalThis.requestIdleCallback=="function"?globalThis.requestIdleCallback(()=>t(),{timeout:Lr}):t()})}async function Wr(t){return t()||(await Hr(),t())?"busy":j(Br,Pr)}var Wt,Ir,Or,Pr,Fr,Lr,Nr,Vr,Ur,Gr,qt=R(()=>{"use strict";Wt=require("@thumbmarkjs/thumbmarkjs");Ge();We();Ir=["canvas","webgl","audio","fonts","hardware","screen","system","locales","math","plugins"],Or=2e3,Pr=4e3,Fr=1e3,Lr=2e3,Nr=64,Vr=32,Ur=8,Gr=128});var kn={};B(kn,{RANK_CANDIDATES:()=>mi,RANK_TOLERANCE:()=>pe,RANK_WINDOW_MS:()=>fi,ROLL_ZERO_DEG:()=>hi,SHARPNESS_REPORT_MAX:()=>yn,YAW_REPORT_MAX:()=>bn,YAW_ZERO_IOD:()=>pi,collectRankedKeyframes:()=>vn,default:()=>bi,featuresOf:()=>hn,frontalOf:()=>pn,rankKeyframes:()=>gn});function pn(t){let e=t.eyes;if(e===void 0)return{frontal:1,yaw:null,roll:null};let n=e.right.x-e.left.x,r=e.right.y-e.left.y,i=n*n+r*r;if(i===0)return{frontal:1,yaw:null,roll:null};let a=Math.abs(Math.atan2(r,Math.abs(n))*180/Math.PI),o=fn(1-a/30),s=null,c=t.nose;if(c!==void 0){let u=(e.left.x+e.right.x)/2,l=(e.left.y+e.right.y)/2;s=Math.abs(((c.x-u)*n+(c.y-l)*r)/i),o*=fn(1-s/.5)}return{frontal:o,yaw:s,roll:a}}function hn(t,e){return t===null?{face:!1,frontal:0,yaw:null,roll:null,eyes:null,score:0,sharpness:e}:{face:!0,...pn(t),eyes:null,score:t.score,sharpness:e}}function gn(t){let e=t.map((i,a)=>a),n=(i,a)=>{let o=Number.NEGATIVE_INFINITY;for(let s of e)o=Math.max(o,i(t[s]));e=e.filter(s=>i(t[s])>=o-a)};n(i=>i.frontal,pe.frontal),n(i=>i.eyes??1,pe.eyes),n(i=>i.score,pe.score);let r=-1;for(let i of e)(r===-1||t[i].sharpness>t[r].sharpness)&&(r=i);return r}function gi(t){return{face:t.face,frontal:G(t.frontal),...t.yaw!==null?{yaw:Math.min(G(t.yaw),bn)}:{},...t.roll!==null?{roll:G(t.roll)}:{},...t.eyes!==null?{eyes:G(t.eyes)}:{},score:G(t.score),sharpness:Math.min(G(t.sharpness),yn)}}async function vn(t,e){let{options:n}=t,r=n.video,i=n.now??(()=>performance.now()),a=n.captureKeyframe??(f=>t.defaultKeyframe(f)),o=600/3,s=[],c=[],u=0;for(let f=0;f<4;f+=1){if(e!==t.attempt)return null;let h=t.detector,p=Promise.resolve(null),m,b=0;try{if(h!==null){let k=t.profiler?.profile.inputWidth??160,C=n.makeSnapshot?.(r,k)??t.defaultSnapshot(r,k);m=a(r).then(v=>(b=i(),v));let M=i();p=h.detect(C,r.videoWidth,r.videoHeight).then(v=>(u+=i()-M,v),()=>null)}else m=a(r).then(k=>(b=i(),k));let[y,w]=await Promise.all([m,p]);s.push(y),c.push(hn(w,y.sharpness))}catch{m?.catch(()=>{})}let g=b>0?Math.max(0,i()-b):0;f<3&&await new Promise(y=>setTimeout(y,Math.max(0,o-g)))}if(e!==t.attempt)return null;let l=gn(c);if(l===-1)return null;let d=0;c.forEach((f,h)=>{f.sharpness>c[d].sharpness&&(d=h)});try{n.telemetry?.({type:"keyframe",tier:t.detector?.tier??null,chosen:l,sharpest:d,detectMs:Math.round(u),candidates:c.map(gi)})}catch{}return s[l]??null}var mi,fi,pi,hi,pe,fn,G,bn,yn,bi,wn=R(()=>{"use strict";mi=4,fi=600,pi=.5,hi=30,pe={frontal:.1,eyes:.1,score:.05},fn=t=>t<0?0:t>1?1:t;G=t=>Number.isFinite(t)?Math.round(t*1e3)/1e3:0,bn=99,yn=999999;bi=vn});var Ei={};B(Ei,{CENTERED_FACTOR:()=>dr,CIRCLE_RADIUS_FACTOR:()=>ur,CLIP_MS:()=>ne,CaptureSessionV3:()=>Qe,ClipError:()=>E,ClipRecorder:()=>W,DEFAULT_CLIP_MIME:()=>ee,DEFAULT_TIER_ORDER:()=>xt,DEFAULT_V3_ASSET_BASE_URL:()=>St,DEVICE_PROFILES:()=>_t,DetectScheduler:()=>Z,DetectorLadderError:()=>D,DeviceProfiler:()=>Y,ENCODER_TAIL_MS:()=>gt,EXPOSURE_BAND:()=>X,FRAME_POLL_MS:()=>yt,FaceGateV3:()=>P,GATE_SNAPSHOT_MS:()=>Tn,GateBlockStats:()=>U,HOLD_UPRIGHT_KEY:()=>he,INSPECT_WAIT_MS:()=>vt,IN_CIRCLE_FACTOR:()=>lr,KEYFRAME_CANDIDATES:()=>ge,KEYFRAME_WINDOW_MS:()=>xn,MAX_CLIP_BYTES:()=>te,MAX_OVERRUN_MS:()=>bt,MIME_CANDIDATES:()=>J,PHONE_MAX_SHORT_SIDE:()=>wt,PROVENANCE_WAIT_MS:()=>Cn,SECOND_FACE_AREA_RATIO:()=>Tt,SHARP_REF:()=>Bi,SHORT_CLIP_TOLERANCE_MS:()=>kt,STOP_GRACE_MS:()=>ht,TIMESLICE_MS:()=>pt,UPRIGHT_WATCH_MS:()=>Sn,V3_GATE_DEFAULTS:()=>Rt,VIDEO_BPS:()=>Re,betterTake:()=>_e,blockReasonOf:()=>mn,buildCaptureConstraints:()=>Ae,buildLivenessV2FormData:()=>Vn,cameraPreflight:()=>ke,captureMirroredKeyframe:()=>we,classifyDevice:()=>Le,countExtraFaces:()=>z,createDetector:()=>I,detectFormFactor:()=>ie,detectIsMobile:()=>De,errorCopy:()=>Un,exposure:()=>Oe,extForMime:()=>ye,intrinsicSize:()=>A,isClipTooLarge:()=>H,isMediaRecorderSupported:()=>Nn,mapGetUserMediaError:()=>ve,meanLuma:()=>ce,needsRetake:()=>re,pickMimeType:()=>Ln,probeDevice:()=>Fe,sharpness:()=>ue,toStreamPixels:()=>q,trackFacingMode:()=>K,uiCopy:()=>Gn});module.exports=Fn(Ei);var J=["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 Ln(){let t=globalThis.MediaRecorder;return!t||typeof t.isTypeSupported!="function"?"":J.find(e=>t.isTypeSupported(e))??""}var ee="video/webm";function ve(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 ke(){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 Nn(){let t=globalThis.MediaRecorder;return typeof t<"u"&&typeof t.isTypeSupported=="function"}var te=8*1024*1024;function H(t){return t.size>te}function ye(t){let e=(t||"").toLowerCase();return e.startsWith("image/jpeg")?"jpg":e.startsWith("video/mp4")?"mp4":(e.startsWith("video/webm"),"webm")}function Vn(t){let{token:e,clip:n,keyframe:r}=t,i=t.ts??Date.now(),a=n.type||ee,o=r.type||"image/jpeg",s=new FormData;return s.append("token",e),s.append("clip",new File([n],`liveness-${i}.${ye(a)}`,{type:a})),s.append("keyframe",new File([r],`keyframe-${i}.${ye(o)}`,{type:o})),s}function we(t,e,n=.92){return new Promise((r,i)=>{let a=t.videoWidth,o=t.videoHeight;if(!a||!o){i(new Error("video-not-ready"));return}let s=e.getContext("2d");if(!s){i(new Error("no-2d-context"));return}e.width=a,e.height=o,s.scale(-1,1),s.drawImage(t,-a,0),e.toBlob(c=>c?r(c):i(new Error("empty-keyframe")),"image/jpeg",n)})}var Un={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."}},Gn={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 Bn=[...J.filter(t=>t.startsWith("video/mp4")),"video/webm;codecs=h264","video/webm;codecs=avc1","video/webm;codecs=vp8","video/webm;codecs=vp9","video/webm"],et=new Set;function Hn(t){let e=/(?:Chrome|Chromium)\/(\d+)\./.exec(t??"");return e?Number(e[1]):null}function tt(t=Wn(),e=globalThis.navigator?.userAgent){if(t===void 0)return"";let n=Hn(e)===126;for(let r of Bn)if(!(et.has(r)||n&&r.startsWith("video/mp4")))try{if(t(r))return r}catch{}return""}function Me(t){t!==""&&et.add(t)}function nt(t){return t.replace(/^video\/x-matroska/i,"video/webm")}function Wn(){let t=globalThis.MediaRecorder;return t&&typeof t.isTypeSupported=="function"?e=>t.isTypeSupported(e):void 0}var ne=2500,pt=1e3,ht=1500,Re=25e5,gt=100,bt=700,yt=20,vt=1500,Ce=null;function ar(){return Ce??(Ce=Promise.resolve().then(()=>(ft(),mt)).catch(t=>{throw Ce=null,t})),Ce.catch(()=>null)}var E=class extends Error{constructor(e,n){super(n??e),this.kind=e}},kt=100;function re(t,e){return t.stats===void 0?!1:t.stats===null?!0:t.stats.durationMs<e-kt}function _e(t,e){return t.stats?e.stats?t.stats.durationMs>e.stats.durationMs:!0:!1}var W=class{constructor(e={}){this.recorder=null;this.stream=null;this.chunks=[];this.bytes=0;this.hardStopTimer=null;this.graceTimer=null;this.pollTimer=null;this.settled=!1;this.now=e.now??(()=>globalThis.performance?.now?.()??Date.now())}clearTimers(){this.hardStopTimer&&clearTimeout(this.hardStopTimer),this.graceTimer&&clearTimeout(this.graceTimer),this.pollTimer&&clearInterval(this.pollTimer),this.hardStopTimer=null,this.graceTimer=null,this.pollTimer=null}record(e,n,r,i=ne,a){let o=tt(),s=ar();return this.recordRaw(e,n,r,i,a,o).then(c=>or(c,s),c=>{throw c instanceof E&&(c.requestedMimeType=o),c})}recordRaw(e,n,r,i,a,o){return this.recorder&&!this.settled?Promise.reject(new E("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,new Promise((s,c)=>{let u;try{u=new MediaRecorder(e,o?{mimeType:o,videoBitsPerSecond:Re}:{videoBitsPerSecond:Re})}catch{try{u=new MediaRecorder(e)}catch{c(new E("unsupported"));return}}this.recorder=u;let l=g=>{this.settled||(this.settled=!0,this.clearTimers(),g())},d=()=>l(()=>{let g=nt(u.mimeType||o||ee),y=new Blob(this.chunks,{type:g});if(y.size===0){c(new E("generic","empty clip"));return}if(H(y)){c(new E("cliptoolarge"));return}s({blob:y,mimeType:g,requestedMimeType:o})});u.ondataavailable=g=>{g.data&&g.data.size&&(this.chunks.push(g.data),this.bytes+=g.data.size,this.bytes>te&&l(()=>{try{u.state!=="inactive"&&u.stop()}catch{}c(new E("cliptoolarge"))}))},u.onstop=d,u.onerror=()=>l(()=>c(new E("generic")));let f=this.now();if(r!==void 0||a!==void 0){let g=!1;u.onstart=()=>{if(!(g||this.settled)&&(g=!0,f=this.now(),r!==void 0))try{r()}catch{}}}try{u.start(pt)}catch{l(()=>c(new E("generic")));return}let h=()=>{if(this.pollTimer&&clearInterval(this.pollTimer),this.pollTimer=null,this.hardStopTimer&&clearTimeout(this.hardStopTimer),this.hardStopTimer=null,this.settled||n?.(),u.state!=="inactive"){try{u.stop()}catch{d()}this.graceTimer=setTimeout(d,ht)}else d()},p=this.now();if(a===void 0){this.hardStopTimer=setTimeout(h,i);return}let m=null,b=!1;this.hardStopTimer=setTimeout(h,i+bt),this.pollTimer=setInterval(()=>{if(this.settled||b)return;let g=null;try{g=a.latest()}catch{g=null}let y=g?.presentationTimeMs;y!==void 0&&Number.isFinite(y)&&y>=f&&m===null&&(m=y);let w=m!==null&&y!==void 0&&y-m>=i,k=m===null&&this.now()-p>=i;if(!(!w&&!k)){if(b=!0,this.pollTimer&&clearInterval(this.pollTimer),this.pollTimer=null,k){h();return}this.hardStopTimer&&clearTimeout(this.hardStopTimer),this.hardStopTimer=setTimeout(h,gt)}},yt)}))}stop(e){this.clearTimers();let n=this.recorder;if(n&&n.state!=="inactive")try{n.stop()}catch{}this.recorder=null,(e??this.stream)?.getTracks().forEach(i=>i.stop()),this.stream=null}};async function or(t,e){let n,r=new Promise(u=>{n=setTimeout(()=>u(null),vt)}),i=await Promise.race([e,r]);if(clearTimeout(n),i===null)return t;let a;try{a=await i.blobBytes(t.blob)}catch{return{...t,stats:null}}let o=i.inspectClipBytes(a);if(o?.container!=="webm")return{...t,stats:o};let s=i.withWebmDuration(a,o.durationMs);if(s===null)return{...t,stats:o};let c=i.inspectClipBytes(s);return c===null||c.frames!==o.frames||c.durationMs!==o.durationMs?{...t,stats:o}:{...t,blob:new Blob([s],{type:t.blob.type}),stats:o}}function Ae(t,e){return{video:{width:{ideal:1280,max:1280},height:{ideal:720,max:720},facingMode:e,frameRate:{ideal:24,max:30}},audio:!1}}var wt=600;function ie(){if(typeof window>"u"||typeof navigator>"u")return"desktop";let t=navigator.userAgentData,e=t?.mobile||/Android|i(Pad)?OS/.test(String(t?.platform)),n=String(navigator.userAgent??"");if(/iPhone|iPod/i.test(n))return"phone";if(/iPad/i.test(n))return"tablet";if(/Android/i.test(n))return/Mobile/i.test(n)?"phone":"tablet";if(/BlackBerry|IEMobile|Opera Mini/i.test(n))return"phone";if(!e){if(Number(navigator.maxTouchPoints??0)<=1)return"desktop";if(/Macintosh/.test(n))return"tablet";if(/Windows NT|CrOS/.test(n)||!cr())return"desktop"}let r=sr();return r>0&&r<wt?"phone":"tablet"}function De(){return ie()!=="desktop"}function sr(){try{let t=window.screen,e=Number(t?.width??0),n=Number(t?.height??0);return e>0&&n>0?Math.min(e,n):0}catch{return 0}}function K(t){try{let n=t?.getVideoTracks?.()[0]?.getSettings?.().facingMode;return n==="user"||n==="environment"?n:null}catch{return null}}function cr(){try{return typeof window.matchMedia=="function"&&window.matchMedia("(pointer: coarse)").matches}catch{return!1}}var ur=.45,lr=.9,dr=.4;var Mt=1e4,ae=class t{constructor(e,n){this.tier="blaze";this.inner=e,n!==void 0&&(this.fallbackReason=n)}static async create(e,n){let r=await import("@mediapipe/tasks-vision"),i=await r.FilesetResolver.forVisionTasks(e),a=await r.FaceDetector.createFromOptions(i,{baseOptions:{modelAssetPath:`${e}/blaze_face_short_range.tflite`,delegate:"CPU"},runningMode:"IMAGE"});return new t(a,n)}async detect(e,n,r){let i;try{i=this.inner.detect(e).detections}catch{return null}let a=mr(i);if(a?.boundingBox===void 0)return null;let o=A(e),s=fr(a.keypoints,o),c=a.keypoints?.[2],u={box:{x:a.boundingBox.originX,y:a.boundingBox.originY,width:a.boundingBox.width,height:a.boundingBox.height},...s!==void 0?{eyes:s}:{},...c!==void 0?{nose:{x:c.x*o.width,y:c.y*o.height}}:{},score:a.categories[0]?.score??0,extraFaces:z(i.map(l=>l.boundingBox??{width:0,height:0}),i.indexOf(a))};return q(u,e,n,r)}destroy(){try{this.inner.close()}catch{}}};function mr(t){let e,n=-1;for(let r of t){let i=r.categories[0]?.score??0;i>n&&(e=r,n=i)}return e}function fr(t,e){let n=t?.[0],r=t?.[1];if(n===void 0||r===void 0)return;let i=s=>({x:s.x*e.width,y:s.y*e.height}),[a,o]=[i(n),i(r)];return a.x<=o.x?{left:a,right:o}:{left:o,right:a}}function pr(){if(typeof OffscreenCanvas=="function")return new OffscreenCanvas(2,2);let t=document.createElement("canvas");return t.width=2,t.height=2,t}var hr=4;async function Et(){let t=globalThis.FaceDetector;if(typeof t!="function")return{ok:!1,reason:"unsupported"};try{let e=new t({fastMode:!0,maxDetectedFaces:hr});return await e.detect(pr()),{ok:!0,instance:e}}catch(e){return{ok:!1,reason:`smoke_failed:${e instanceof Error?e.message:String(e)}`}}}var oe=class{constructor(e,n){this.tier="native";this.inner=e,n!==void 0&&(this.fallbackReason=n)}async detect(e,n,r){let i;try{i=await this.inner.detect(e)}catch{return null}let a=i.map(l=>l.boundingBox),o=-1;a.forEach((l,d)=>{let f=a[o];(f===void 0||l.width*l.height>f.width*f.height)&&(o=d)});let s=i[o];if(s===void 0)return null;let c=gr(s.landmarks),u={box:{x:s.boundingBox.x,y:s.boundingBox.y,width:s.boundingBox.width,height:s.boundingBox.height},...c!==void 0?{eyes:c}:{},score:1,extraFaces:z(a,o)};return q(u,e,n,r)}destroy(){}};function gr(t){if(t===void 0)return;let e=t.filter(i=>i.type==="eye").map(i=>i.locations[0]).filter(i=>i!==void 0),[n,r]=e;if(!(n===void 0||r===void 0))return n.x<=r.x?{left:n,right:r}:{left:r,right:n}}var Tt=.25;function z(t,e){let n=t[e],r=n===void 0?0:n.width*n.height;if(!(r>0))return 0;let i=0;return t.forEach((a,o)=>{o!==e&&a.width*a.height>=Tt*r&&(i+=1)}),i}var St="/models-v3",xt=["native","blaze"],D=class extends Error{constructor(e){super(`no detector tier available (${e})`),this.name="DetectorLadderError",this.fallbackReason=e}};function A(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 n=typeof e.width=="number"?e.width:0,r=typeof e.height=="number"?e.height:0;return{width:n,height:r}}function q(t,e,n,r){let i=A(e),a=i.width>0?n/i.width:1,o=i.height>0?r/i.height:1,s=c=>({x:c.x*a,y:c.y*o});return{box:{x:t.box.x*a,y:t.box.y*o,width:t.box.width*a,height:t.box.height*o},...t.eyes!==void 0?{eyes:{left:s(t.eyes.left),right:s(t.eyes.right)}}:{},...t.nose!==void 0?{nose:s(t.nose)}:{},score:t.score,...t.extraFaces!==void 0?{extraFaces:t.extraFaces}:{}}}function br(t){return t instanceof Error?t.message:String(t)}async function I(t){let e=t.preferred??xt,n=[];for(let r of e){if(r==="native"){let i=await Et();if(i.ok)return new oe(i.instance,Ie(n));n.push(`native:${i.reason}`);continue}try{return await yr(ae.create(t.v3AssetBaseUrl??St,Ie(n)),t.blazeInitTimeoutMs??Mt)}catch(i){n.push(i instanceof se?"blaze:blaze_init_timeout":`blaze:${br(i)}`)}}throw new D(Ie(n)??"no_tier_available")}function Ie(t){return t.length>0?t.join("; "):void 0}var se=class extends Error{};function yr(t,e){return new Promise((n,r)=>{let i=setTimeout(()=>{r(new se(`init exceeded ${e}ms`)),t.then(a=>a.destroy(),()=>{})},e);t.then(a=>{clearTimeout(i),n(a)},a=>{clearTimeout(i),r(a)})})}var Bi=180,X=[100,190],vr=64;function Ct(t,e){return .299*(t[e]??0)+.587*(t[e+1]??0)+.114*(t[e+2]??0)}function ce(t){let{data:e,width:n,height:r}=t,i=n*r;if(i===0)return 0;let a=0;for(let o=0;o<i;o+=1)a+=Ct(e,o*4);return a/i}function ue(t){let{data:e,width:n,height:r}=t;if(n<3||r<3)return 0;let i=new Float32Array(n*r);for(let l=0;l<i.length;l+=1)i[l]=Ct(e,l*4);let a=0,o=0,s=0;for(let l=1;l<r-1;l+=1)for(let d=1;d<n-1;d+=1){let f=l*n+d,h=(i[f-n]??0)+(i[f-1]??0)+(i[f+1]??0)+(i[f+n]??0)-4*(i[f]??0);a+=h,o+=h*h,s+=1}if(s===0)return 0;let c=a/s,u=o/s-c*c;return Math.min(1,Math.max(0,u)/180)}function Oe(t){let e=ce(t),[n,r]=X,i=e<n?n-e:e>r?e-r:0;return Math.max(0,1-i/vr)}var Rt=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}),O=t=>Math.min(1,Math.max(0,t)),P=class{constructor(e={}){this.p=0;this.lastTickAt=null;this.lastCenter=null;this.velocityEma=0;this.qWindow=[];this.lastSizeDirection="ideal";this.t={...Rt,...e}}reset(){this.p=0,this.lastTickAt=null,this.lastCenter=null,this.velocityEma=0,this.qWindow=[],this.lastSizeDirection="ideal"}tick(e){let{observation:n,quality:r,timestampMs:i}=e,a=this.lastTickAt===null?0:Math.max(0,(i-this.lastTickAt)/1e3);this.lastTickAt=i;let o={presence:0,single:1,centering:0,size:0,pose:0,sharpness:O(r.sharpness),exposure:O(r.exposure),motion:1};if(n!==null){o.presence=1,o.single=(n.extraFaces??0)>0?0:1;let l=this.geometryOf(n,e);o.centering=l.centering,o.size=l.size,o.pose=l.pose,o.motion=this.motionOf(l.center,l.iod,i)}else this.lastCenter=null,this.velocityEma=0;let s=Math.min(o.presence,o.single,o.centering,o.size,o.pose,o.sharpness,o.exposure,o.motion);this.p=O(this.p+(s>=this.t.Q_GOOD?this.t.RISE_PER_S*s:-this.t.FALL_PER_S*(1-s))*a),this.qWindow.push({at:i,q:s}),this.qWindow=this.qWindow.filter(l=>l.at>=i-this.t.READY_WINDOW_MS);let c=this.qWindow.map(l=>l.q);if(c.length>=3){let l=Math.min(...c),d=c.indexOf(l);c=c.filter((f,h)=>h!==d)}let u=this.p>=1&&c.every(l=>l>=this.t.Q_GOOD);return{at:i,q:s,p:this.p,factors:o,guidanceKey:this.guidanceOf(o,r,s),ready:u,accepted:s>=this.t.Q_GOOD}}geometryOf(e,n){let{box:r,eyes:i}=e,a={x:n.frameWidth/2,y:n.frameHeight/2},o=Math.min(n.frameWidth,n.frameHeight),s=i!==void 0?{x:(i.left.x+i.right.x)/2,y:(i.left.y+i.right.y)/2}:{x:r.x+r.width/2,y:r.y+r.height/2-this.t.BOX_EYE_OFFSET_FACTOR*r.height},c=i!==void 0?Math.hypot(i.right.x-i.left.x,i.right.y-i.left.y):this.t.IOD_BOX_PROXY_FACTOR*r.width,u=Math.hypot(s.x-a.x,s.y-a.y),l=c<=0?0:1-O(u/(this.t.CENTER_FALLOFF_IOD_MULTIPLE*c)),d=o>0?c/o:0;this.lastSizeDirection=d<this.t.SIZE_IDEAL_MIN?"far":d>this.t.SIZE_IDEAL_MAX?"close":"ideal";let f;d<this.t.SIZE_HARD_MIN||d>this.t.SIZE_HARD_MAX?f=0:d<this.t.SIZE_IDEAL_MIN?f=(d-this.t.SIZE_HARD_MIN)/(this.t.SIZE_IDEAL_MIN-this.t.SIZE_HARD_MIN):d>this.t.SIZE_IDEAL_MAX?f=(this.t.SIZE_HARD_MAX-d)/(this.t.SIZE_HARD_MAX-this.t.SIZE_IDEAL_MAX):f=1;let h=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;h=1-O(p/this.t.ROLL_MAX_DEG)}return{center:s,iod:c,centering:l,size:f,pose:h}}motionOf(e,n,r){let i=this.lastCenter;if(this.lastCenter={...e,at:r},i===null||n<=0)return 1;let a=(r-i.at)/1e3;if(a<=0)return 1;let o=Math.hypot(e.x-i.x,e.y-i.y)/n/a;o<=this.t.MOTION_DEADBAND_IOD_PER_S&&(o=0);let s=1-Math.exp(-a/this.t.MOTION_TAU_S);return this.velocityEma=s*o+(1-s)*this.velocityEma,1-O(this.velocityEma/this.t.MOTION_VELOCITY_IOD_PER_S)}guidanceOf(e,n,r){if(e.presence<=0)return"fcv3.no_face";if(e.single<=0)return"fcv3.one_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(n);if(e.sharpness<this.t.GUIDE_SHARPNESS)return"fcv3.steady_camera";if(e.motion<this.t.GUIDE_MOTION)return"fcv3.hold_still";if(r<this.t.Q_GOOD){let i=[["size",this.sizeGuidance()],["centering","fcv3.center_face"],["pose","fcv3.straighten"],["exposure",this.exposureGuidance(n)],["sharpness","fcv3.steady_camera"],["motion","fcv3.hold_still"]],a=i[0];for(let o of i)e[o[0]]<e[a[0]]&&(a=o);return a[1]}return"fcv3.hold_still"}sizeGuidance(){return this.lastSizeDirection==="far"?"fcv3.come_closer":"fcv3.move_back"}exposureGuidance(e){let n=(X[0]+X[1])/2;return e.meanLuma<n?"fcv3.more_light":"fcv3.too_bright"}};var _t=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"})}),kr=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 Fe(){let t=typeof navigator>"u"?void 0:navigator,e=!1;try{e=typeof WebAssembly<"u"&&WebAssembly.validate(kr)}catch{e=!1}return{cores:t?.hardwareConcurrency??2,memGB:t?.deviceMemory??null,simd:e}}function Le(t){let e=t.memGB??4;return t.cores<4||e<3?"LOW":t.cores>=8&&e>=6?"HIGH":"MID"}var Pe=["LOW","MID","HIGH"],Y=class{constructor(e){this.samples=[];this.adjusted=!1;this.current=e}get deviceClass(){return this.current}get profile(){return _t[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 n=this.samples.reduce((r,i)=>r+i,0)/this.samples.length;if(n>70)this.current="LOW";else if(n<25){let r=Pe.indexOf(this.current);this.current=Pe[Math.min(Pe.length-1,r+1)]??this.current}return this.current}};var Z=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 n=()=>{this.running&&(this.frameCallbackId=e.requestVideoFrameCallback?.(()=>{this.frameCallbackId=null,this.now()-this.lastRunAt>=this.periodMs&&this.tick(),n()}))};n();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((n,r)=>n+r,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 At="0.1.0-rc.38";var wr=/FBAN|FBAV|FB_IAB|FBIOS|MessengerForiOS|Instagram|WhatsApp|musical_ly|BytedanceWebview|TikTok|Snapchat|\bLine\/|LinkedInApp|Pinterest|MicroMessenger|; wv\)/i;function Dt(t){let e=t??(typeof navigator>"u"?"":String(navigator.userAgent??""));return wr.test(e)}var Xt="sekyro.did",Kr=1e4,jt=()=>globalThis.process?.versions?.node,Yt;function Zt(){let t=globalThis.crypto;try{if(typeof t?.randomUUID=="function")return t.randomUUID()}catch{}try{if(typeof t?.getRandomValues=="function"){let e=t.getRandomValues(new Uint8Array(16));return Array.from(e,n=>n.toString(16).padStart(2,"0")).join("")}}catch{}}function zr(){try{let t=localStorage.getItem(Xt);if(t)return t;let e=Zt();return e!==void 0&&localStorage.setItem(Xt,e),e}catch{return Yt??(Yt=Zt()),Yt}}async function qr(){let t=globalThis.crypto?.subtle;if(!t)return"";let e=navigator,n=JSON.stringify([e.userAgent,e.platform,e.hardwareConcurrency??null,e.deviceMemory??null,e.maxTouchPoints??0,screen.width,screen.height,screen.colorDepth,globalThis.devicePixelRatio??1,Intl.DateTimeFormat().resolvedOptions().timeZone,e.languages?.join(",")??e.language]),r=await t.digest("SHA-256",new TextEncoder().encode(n));return Array.from(new Uint8Array(r),i=>i.toString(16).padStart(2,"0")).join("").slice(0,32)}function Xr(){try{let t=Number(navigator.maxTouchPoints);return Number.isFinite(t)&&t>=0?{touch:Math.min(64,Math.trunc(t))}:{}}catch{return{}}}function Yr(t){let e=new TextEncoder().encode(t),n="";for(let r of e)n+=String.fromCharCode(r);return btoa(n).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function Zr(t){let e,n,r,i,a,o,s=()=>o?.readyState==="live",c=()=>{a!==void 0||!globalThis.crypto?.subtle||jt()||s()||(a=Promise.race([Promise.resolve().then(()=>(qt(),zt)),new Promise(u=>setTimeout(u,Kr))]).then(u=>u?.computePrint(s)).then(u=>{u==="busy"?a=void 0:i=u}).catch(()=>{}))};return{timezone(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone?.slice(0,64)||void 0}catch{return}},noteCameraLabel(u){u&&(e=u.slice(0,128))},noteCamera(u){n=u},noteCameraTrack(u){o=u},async deviceHeader(){try{r??(r=qr().catch(()=>""));let u=[];navigator.webdriver&&u.push("webdriver"),/HeadlessChrome/.test(navigator.userAgent)&&u.push("headless");let l=await r,d=zr(),f={v:1,platform:"web",sdk:t.sdk.slice(0,64),caps:["session_proof"],rampAtArm:!0,ids:[...d?[{kind:"web_local",value:d.slice(0,128)}]:[],...l?[{kind:"web_fp",value:l}]:[]],screen:{w:screen.width,h:screen.height,dpr:globalThis.devicePixelRatio??1},...Xr(),...e?{cameraLabel:e}:{},...u.length?{signals:u}:{},...i?{print:{v:2,...i,...n?{camera:n}:{}}}:{},...Dt()?{inApp:!0}:{}},h=Yr(JSON.stringify(f));return c(),h}catch{return}},printReady(){return a??Promise.resolve()}}}var Ke=Symbol.for("sekyro.web.clientContext"),ze=globalThis,qe=ze[Ke]??(ze[Ke]=Zr({sdk:`@sekyro/web@${At}`}));function $t(t){try{let e=t.getVideoTracks?.()[0];if(e){if(qe.noteCameraLabel(e.label),qe.noteCameraTrack(e),jt())return;Promise.resolve().then(()=>(We(),Bt)).then(n=>n.noteCameraTrait(e,qe)).catch(()=>{})}}catch{}}var Xe=Symbol.for("sekyro.web.cameraStreams"),Ye=globalThis,jr=Ye[Xe]??(Ye[Xe]=new Set);function Qt(t){try{jr.add(t)}catch{}}Ge();var $r=["obs","manycam","virtual","snap camera","xsplit","droidcam","iriun","camo","fake_device","fake-capture-device"],Qr=[/^(front|back|rear)( [a-z ]+)? camera$/i,/^caméra (avant|arrière)\b/i,/^cámara (frontal|trasera|delantera)\b/i,/^câmera (frontal|traseira)\b/i,/^(front|rück)kamera\b/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 Jr(t){let e=(t??"").trim().toLowerCase();return e.length===0?"unknown":$r.some(n=>e.includes(n))?"known_virtual":Qr.some(n=>n.test(e))?"platform":"unknown"}function Jt(t){if(typeof t!="function")return!1;try{return/\{\s*\[native code\]\s*\}\s*$/.test(Function.prototype.toString.call(t))}catch{return!1}}function ei(t=globalThis){return Jt(t.navigator?.mediaDevices?.getUserMedia)&&Jt(t.MediaStreamTrack?.prototype?.getSettings)}async function ti(t,e=globalThis){let n=e.crypto?.subtle?.digest;if(typeof n=="function")try{let r=new Uint8Array(await n.call(e.crypto?.subtle,"SHA-256",new TextEncoder().encode(t)));return Array.from(r.subarray(0,8),i=>i.toString(16).padStart(2,"0")).join("")}catch{return}}async function en(t,e=globalThis){let n={};try{n=typeof t.getSettings=="function"?t.getSettings()??{}:{}}catch{n={}}let r={};if((n.facingMode==="user"||n.facingMode==="environment"||n.facingMode==="left"||n.facingMode==="right")&&(r.facingMode=n.facingMode),typeof n.frameRate=="number"&&Number.isFinite(n.frameRate)&&(r.frameRate=n.frameRate),typeof n.width=="number"&&Number.isFinite(n.width)&&(r.width=n.width),typeof n.height=="number"&&Number.isFinite(n.height)&&(r.height=n.height),typeof n.deviceId=="string"&&n.deviceId.length>0){let a=await ti(n.deviceId,e);a!==void 0&&(r.deviceIdHash=a)}let i;try{i=t.label}catch{i=void 0}return{trackSettings:r,capabilitiesPresent:typeof t.getCapabilities=="function",labelClass:Jr(i),prototypesIntact:ei(e)}}var Ze=t=>Math.round(t*100)/100;function tn(t){let e=t,n=typeof e?.requestVideoFrameCallback=="function",r=null,i=null,a=0,o=0,s=0,c=0,u=0,l=0,d=()=>{!n||e?.requestVideoFrameCallback===void 0||(r=e.requestVideoFrameCallback((f,h)=>{if(r=null,!n)return;let p=h.presentationTime;if(i!==null){let m=p-i.presentationTimeMs;o+=1;let b=m-s;s+=b/o,c+=b*(m-s)}typeof h.captureTime=="number"&&Number.isFinite(h.captureTime)&&(u+=p-h.captureTime,l+=1),a+=1,i={mediaTimeMs:h.mediaTime*1e3,presentationTimeMs:p},d()}))};return d(),{latest:()=>i,stats:()=>({n:a,meanGapMs:o===0?0:Ze(s),stdGapMs:o<2?0:Ze(Math.sqrt(c/(o-1))),captureLatencyMs:l===0?null:Ze(u/l)}),stop:()=>{n&&(n=!1,r!==null&&e?.cancelVideoFrameCallback?.(r),r=null)}}}function nn(t,e,n){return{...t,rvfc:e,rampPainter:n}}var ni=["magenta","yellow","green","blue"];var ri=4,ii=4,de=t=>typeof t=="number"&&Number.isFinite(t);function me(t){if(typeof t!="object"||t===null)return!1;let e=t;if(typeof e.nonce!="string"||e.nonce.length===0||!Array.isArray(e.colours)||e.colours.length<1||e.colours.length>8||!e.colours.every(r=>ni.includes(r))||!Array.isArray(e.onsetsMs)||e.onsetsMs.length!==e.colours.length)return!1;let n=-1;for(let r of e.onsetsMs){if(!de(r)||r<0||r<=n)return!1;n=r}return!(!de(e.holdMs)||e.holdMs<=0||!de(e.endMs)||e.endMs<=n||!de(e.clipMs)||e.clipMs<e.endMs||e.clipMs>8e3)}function rn(t,e){return me(t)?Math.max(e,Math.ceil(t.clipMs)):e}function an(t,e){let n=e.now??(()=>performance.now()),r=me(t)?t:void 0,i=[],a=null,o=null,s=null,c=!1,u=null,l=p=>{u=p;try{e.paint(p)}catch{}},d=p=>{let m=e.frames?.()??null;return m!==null&&s!==null?m.mediaTimeMs+(p-m.presentationTimeMs)-s:p-(o??p)},f=(p,m,b=0)=>{if(c)return;let g=Math.max(0,p-d(n()));a=setTimeout(()=>{if(a=null,!c){if(b<ri&&d(n())<p-ii){f(p,m,b+1);return}m()}},g)},h=p=>{if(r===void 0)return;let m=r.endMs;if(p>=r.colours.length){f(m,()=>l(null));return}let b=r.onsetsMs[p],g=p+1<r.onsetsMs.length?r.onsetsMs[p+1]:m;f(b,()=>{let y=d(n());if(y>m){u!==null&&l(null);return}let w=r.colours[p];l(w);let k=i.length===0?0:i[i.length-1].tMs;i.push({tMs:Math.max(k,Math.round(y)),colour:w});let C=b+r.holdMs;if(C<g){f(C,()=>{if(d(n())>m){u!==null&&l(null);return}l("dark"),h(p+1)});return}h(p+1)})};return{started(p){if(r===void 0||c||o!==null)return;o=p;let m=e.frames?.()??null;s=m===null?null:m.mediaTimeMs+(p-m.presentationTimeMs),h(0)},stop(){c||(c=!0,a!==null&&clearTimeout(a),a=null,u!==null&&l(null))},report(){return r===void 0?void 0:{nonce:r.nonce,rendered:[...i]}}}}var ai=40;function V(t){if(t===null||typeof t!="object"&&typeof t!="function")return;let e;try{e=t.name}catch{return}return oi(e)}function oi(t){if(typeof t!="string")return;let e=t.replace(/[^A-Za-z]/g,"").slice(0,ai);return e===""?void 0:e}function on(t){let e=ve(t);if(e!=="generic")return e;switch(V(t)){case"AbortError":return"inuse";case"SecurityError":return"permission";default:return e}}function si(t){let e=t.toLowerCase();return e===""?"unknown":/front|facing front|user|selfie|face ?time/.test(e)?"front":/ultra|0\.5x|wide angle/.test(e)?"ultra":/tele|zoom|periscope|[2-9]x/.test(e)?"tele":/depth|tof|infrared|\bir\b|truedepth|lidar|macro|monochrome|mono\b/.test(e)?"depth":/dual|triple/.test(e)?"virtual":/back|rear|environment|facing back|arrière|خلفية/.test(e)?"main":"unknown"}function ci(t){let e=/camera2?\s*(\d+)/i.exec(t);return e?Number(e[1]):Number.POSITIVE_INFINITY}function sn(t){let e={main:0,virtual:1,ultra:9,tele:9,depth:9,front:9,unknown:9};return t.filter(n=>(n.kind===void 0||n.kind==="videoinput")&&n.deviceId!=="").map((n,r)=>({id:n.deviceId,kind:si(n.label),index:ci(n.label),i:r})).filter(n=>e[n.kind]<9).sort((n,r)=>e[n.kind]-e[r.kind]||n.index-r.index||n.i-r.i).map(n=>n.id)}var $=class extends Error{constructor(){super("the back camera could not be opened");this.name="BackCameraUnavailableError"}},cn=new Set(["NotAllowedError","PermissionDeniedError","SecurityError"]);function un(t){try{return String(t?.name??"")}catch{return""}}function je(t){if(t!==null)for(let e of t.getTracks())e.stop()}async function ln(t,e,n){let r=l=>({video:{...e,...l},audio:!1});if(t==="user")return n.getUserMedia(r({facingMode:"user"}));let i=l=>K(l)!=="user";try{let l=await n.getUserMedia(r({facingMode:{exact:"environment"}}));if(i(l))return l;je(l)}catch(l){if(cn.has(un(l)))throw l}let a=!1,o=async()=>{if(n.enumerateDevices===void 0||a)return null;let l;try{l=sn(await n.enumerateDevices()).slice(0,3)}catch{return null}a=l.length>0;for(let d of l){let f;try{f=await n.getUserMedia(r({deviceId:{exact:d}}))}catch(h){if(cn.has(un(h)))throw h;continue}if(i(f))return f;je(f)}return null},s=await o();if(s!==null)return s;let c=await n.getUserMedia(r({facingMode:"environment"}));if(i(c))return c;je(c);let u=await o();if(u!==null)return u;throw new $}var x=1;function dn(){return typeof OffscreenCanvas=="function"&&typeof createImageBitmap=="function"&&typeof Worker=="function"}function li(t,e={}){let n=e.createDetector??I,r=null;t.onmessage=i=>{let a=i.data;if(a.v!==x){a.bitmap?.close?.();return}if(a.type==="init"){n(a.options).then(o=>{r=o;let s={v:x,type:"ready",tier:o.tier,...o.fallbackReason!==void 0?{fallbackReason:o.fallbackReason}:{}};t.postMessage(s)});return}if(a.type==="detect"){let o=s=>{let c={v:x,type:"result",id:a.id,observation:s};t.postMessage(c),a.bitmap.close?.()};if(r===null){o(null);return}r.detect(a.bitmap,a.streamWidth,a.streamHeight).then(o,()=>o(null))}}}typeof self<"u"&&typeof self.importScripts=="function"&&li(self);var fe=class t{constructor(e,n){this.pending=new Map;this.nextId=1;this.worker=e,this.tier=n.tier,n.fallbackReason!==void 0&&(this.fallbackReason=n.fallbackReason),e.addEventListener("message",r=>{let i=r.data;if(i.v!==x||i.type!=="result")return;let a=this.pending.get(i.id);this.pending.delete(i.id),a?.(i.observation)})}static create(e,n,r=1e4){return new Promise((i,a)=>{let o=setTimeout(()=>{e.removeEventListener("message",s),e.terminate(),a(new Error(`worker detector not ready within ${r}ms`))},r),s=u=>{let l=u.data;l.v!==x||l.type!=="ready"||(clearTimeout(o),e.removeEventListener("message",s),i(new t(e,l)))};e.addEventListener("message",s);let c={v:x,type:"init",options:n};e.postMessage(c)})}async detect(e,n,r){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(o=>{this.pending.set(a,o);let s={v:x,type:"detect",id:a,bitmap:i,streamWidth:n,streamHeight:r};this.worker.postMessage(s,[i])})}destroy(){for(let e of this.pending.values())e(null);this.pending.clear(),this.worker.terminate()}};var di=["single","size","centering","pose","exposure","sharpness","motion"];function mn(t){if(t.accepted)return null;if(t.factors.presence<=0)return"no_face";let e="single";for(let n of di)t.factors[n]<t.factors[e]&&(e=n);return e}var U=class{constructor(){this.blocked={};this.acceptedMs=0;this.ticks=0;this.lastAt=null}record(e){let n=this.lastAt===null?0:Math.max(0,e.at-this.lastAt);this.lastAt=e.at,this.ticks+=1;let r=mn(e);if(r===null){this.acceptedMs+=n;return}let i=this.blocked[r]??{count:0,ms:0};i.count+=1,i.ms+=n,this.blocked[r]=i}summary(){let e={};for(let[n,r]of Object.entries(this.blocked))e[n]={count:r.count,ms:Math.round(r.ms)};return{blocked:e,acceptedMs:Math.round(this.acceptedMs),ticks:this.ticks}}};var Tn=1e3,he="fcv3.hold_upright",Sn=200,ge=4,xn=600,Cn=1e3,Mn={sharpness:1,exposure:1,meanLuma:128};function yi(t,e){return e.width=t.videoWidth,e.height=t.videoHeight,e.getContext("2d").drawImage(t,0,0),new Promise((n,r)=>e.toBlob(i=>i?n(i):r(new Error("empty-keyframe")),"image/jpeg",.92))}function vi(){return ie()==="phone"}var Qe=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.openEnvironment=null;this.ramp=null;this.snapshotCanvas=null;this.options=e,this.facing=e.facingMode??"user"}get state(){return this.stateValue}on(e,n){let r=this.handlers.get(e);return r||(r=new Set,this.handlers.set(e,r)),r.add(n),()=>r?.delete(n)}emit(e,n){for(let r of[...this.handlers.get(e)??[]])r(n)}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()}restart(e){this.facing=e,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:n}=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=(n.isPhone??vi)(),this.setState("preflight");let r=ke();if(r!=="OK"){this.fail(r==="INSECURE_CONTEXT"?"insecure":"unsupported",{phase:"preflight"});return}this.setState("acquiring");let i=n.getUserMedia??(u=>navigator.mediaDevices.getUserMedia(u)),a;this.cameraRequestedAt=this.now();try{let{facingMode:u,...l}=Ae(De(),this.facing).video;a=await ln(this.facing,l,{getUserMedia:i,enumerateDevices:Mi(n)})}catch(u){if(e!==this.attempt)return;if(u instanceof $){this.fail("backcamera",{phase:"acquiring",name:V(u)});return}this.fail(on(u),{phase:"acquiring",name:V(u)});return}if($t(a),Qt(a),e!==this.attempt){for(let u of a.getTracks())u.stop();return}this.stream=a;let o=a.getVideoTracks?.()[0];if(this.trackProvenance=o===void 0?null:en(o).catch(()=>null),this.openEnvironment=o===void 0?null:Lt(o).catch(()=>({})),this.facing=K(a)??this.facing,n.video.srcObject=a,await n.video.play().catch(()=>{}),e!==this.attempt)return;if(this.cameraReadyAt=this.now(),this.detector===null){let u={v3AssetBaseUrl:n.v3AssetBaseUrl},l=n.createDetector??(n.createWorker!==void 0&&dn()?async()=>{try{return await fe.create(n.createWorker(),u)}catch{return I(u)}}:()=>I(u)),d;try{d=await l()}catch(f){e===this.attempt&&this.fail("models",{phase:"models",name:V(f)},f instanceof D?f.fallbackReason:wi(f));return}if(e!==this.attempt){d.destroy();return}this.detector=d,this.options.telemetry?.({type:"detector",tier:d.tier,fallbackReason:d.fallbackReason})}let s=Fe(),c=n.deviceClass??Le(s);this.profiler=new Y(c),this.options.telemetry?.({type:"profile",staticClass:c,activeClass:this.profiler.deviceClass,simd:s.simd}),this.gate=new P(n.thresholds??{}),this.blockStats=new U,this.lastGateSnapshotAt=this.now(),n.rankKeyframes?.()&&Promise.resolve().then(()=>(wn(),kn)).then(u=>$e=u,()=>{}),this.setState("positioning"),this.positioningStartedAt=this.now(),this.startScheduler(e)}get animations(){return this.profiler?.profile.animations??"full"}startScheduler(e){let n=this.profiler;if(n===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 r=new Z({cadenceHz:n.profile.cadenceHz,video:this.options.video,now:this.options.now,run:()=>this.detectTick(e)});this.scheduler=r,r.start()}async detectTick(e){let{detector:n,gate:r,profiler:i}=this,a=this.options.video;if(e!==this.attempt||n===null||r===null||i===null||this.fired||a.videoWidth===0)return;if(this.isLandscape()){this.holdUpright(e);return}let o=i.deviceClass,s=this.now(),c=this.options.makeSnapshot?.(a,i.profile.inputWidth)??this.defaultSnapshot(a,i.profile.inputWidth),u=null;try{u=await n.detect(c,a.videoWidth,a.videoHeight)}catch{u=null}if(e!==this.attempt||this.fired)return;i.record(this.now()-s),i.deviceClass!==o&&this.startScheduler(e);let l=u===null?Mn:this.options.measureQuality?.(a,u.box)??this.defaultQuality(a,u.box),d=r.tick({timestampMs:this.now(),observation:u,quality:l,frameWidth:a.videoWidth,frameHeight:a.videoHeight});d.accepted&&this.faceAcquiredAt===null&&(this.faceAcquiredAt=d.at),this.blockStats?.record(d),!d.ready&&d.at-this.lastGateSnapshotAt>=Tn&&(this.lastGateSnapshotAt=d.at,this.reportGate(!1)),this.emit("checks",{engine:"v3",progress:d.p,q:d.q,factors:d.factors,attempt:e}),d.guidanceKey!==this.lastGuidanceKey&&(this.lastGuidanceKey=d.guidanceKey,this.emit("guidance",{key:d.guidanceKey})),d.ready&&this.stateValue==="positioning"&&(this.fired=!0,this.captureCompleteAt=d.at,this.fire(e))}async fire(e){let{options:n}=this,r=this.scheduler;r?.stop(),this.reportGate(!0);let i=r?.stats()??{degradeCount:0,meanDetectMs:0},a=[...this.carriedMeans,...i.meanDetectMs>0?[i.meanDetectMs]:[]];n.telemetry?.({type:"fired",timeToGateMs:this.now()-this.positioningStartedAt,degradeCount:this.carriedDegrade+i.degradeCount,meanDetectMs:a.length===0?0:a.reduce((M,v)=>M+v,0)/a.length});let o=n.mode??"clip",s=n.rankKeyframes?.()&&$e?$e.default(this,e).catch(()=>this.collectKeyframes(e)):this.collectKeyframes(e);if(o==="photo"){let M=this.watchRotation(e,null),v=await s;if(M(),e!==this.attempt)return;if(v===null){this.fail("generic",{phase:"keyframes"});return}let be=await this.provenance({n:0,meanGapMs:0,stdGapMs:0,captureLatencyMs:null},!1);if(e!==this.attempt)return;this.finishCapture({keyframe:v.blob,previewDataUrl:v.previewDataUrl,...be});return}this.setState("recording");let c=this.stream;if(c===null){this.fail("generic",{phase:"recording"});return}let u=n.screenRamp?.(),l=me(u),d=null;s.then(M=>{d=M},()=>{});let f=()=>{e===this.attempt&&d!==null&&this.emit("frozen",{previewDataUrl:d.previewDataUrl})},h=rn(u,ne),p=null,m,b=0;try{let M=this.recordTake(e,c,u,h,void 0).then(T=>T,T=>({failed:T})),[v,be]=await Promise.all([M,s]);if(m=be,e!==this.attempt)return;if("failed"in v){if(v.failed.kind==="cliptoolarge")throw v.failed;Me(v.failed.requestedMimeType??"")}else p=v,re(v.clip,h)?v.clip.stats===null&&Me(v.clip.requestedMimeType??""):f();if(p===null||re(p.clip,h)){b=1,n.telemetry?.({type:"clip_retake",reason:p===null?"error":p.clip.stats===null?"unreadable":"short"});let T=null;try{T=await this.recordTake(e,c,u,h,f)}catch(Rn){if(p===null)throw Rn}if(e!==this.attempt)return;T!==null&&(p===null||_e(T.clip,p.clip))&&(p=T),T===null&&f()}}catch(M){if(e!==this.attempt)return;let v=M.kind;this.fail(v==="cliptoolarge"?"cliptoolarge":"recorder",{phase:"recording",name:V(M)});return}if(p===null){this.fail("recorder",{phase:"recording"});return}let{clip:g,rvfc:y,report:w,watched:k}=p;if(H(g.blob)){this.fail("cliptoolarge",{phase:"recording"});return}if(m===null){this.fail("generic",{phase:"keyframes"});return}let C=await this.provenance(y,l,k);e===this.attempt&&this.finishCapture({clip:g.blob,clipMimeType:g.mimeType,...g.stats?{clipStats:g.stats}:{},clipRetakes:b,keyframe:m.blob,previewDataUrl:m.previewDataUrl,...w!==void 0&&w.rendered.length>0?{screenRamp:w}:{},...C})}async recordTake(e,n,r,i,a){let o=this.options.createRecorder?.()??new W({now:()=>this.now()}),s=tn(this.options.video),c=an(r,{paint:f=>{(f===null||e===this.attempt)&&this.emit("ramp",{colour:f})},now:()=>this.now(),frames:s.latest});this.ramp=c;let u=()=>{s.stop(),c.stop(),this.ramp===c&&(this.ramp=null)},l=this.watchRotation(e,o),d=Nt();try{return{clip:await o.record(n,a,()=>c.started(this.now()),i,s),rvfc:s.stats(),report:c.report(),watched:d.stop()}}finally{d.stop(),l(),u()}}async provenance(e,n,r={}){let i=this.trackProvenance;if(i===null)return{};let a,o=new Promise(l=>{a=setTimeout(()=>l(null),Cn)}),s=await Promise.race([i,o]),c=s===null?null:await Promise.race([this.openEnvironment,o]);if(clearTimeout(a),s===null)return{};let u={...c,...r};return{provenance:{...nn(s,e,n),...Object.keys(u).length>0?{env:u}:{}}}}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,single:1,centering:0,size:0,pose:0,sharpness:0,exposure:0,motion:0},attempt:e}),this.lastGuidanceKey!==he&&(this.lastGuidanceKey=he,this.emit("guidance",{key:he}))}watchRotation(e,n){if(!this.uprightGuard)return()=>{};let r=this.options.video,i=()=>{if(e!==this.attempt||n!==null&&this.stateValue!=="recording"){s();return}r.videoWidth>0&&this.isLandscape()&&(s(),this.abortRecording(e,n))},a=setInterval(i,Sn);r.addEventListener?.("resize",i);let o=!1;function s(){o||(o=!0,clearInterval(a),r.removeEventListener?.("resize",i))}return s}abortRecording(e,n){if(e!==this.attempt)return;this.attempt+=1;let r=this.attempt;try{n?.stop()}catch{}this.ramp?.stop(),this.ramp=null,this.fired=!1,this.captureCompleteAt=null,this.gate=new P(this.options.thresholds??{}),this.blockStats=new U,this.lastGateSnapshotAt=this.now(),this.lastGuidanceKey=null,this.setState("positioning"),this.positioningStartedAt=this.now(),this.holdUpright(r),this.startScheduler(r)}async collectKeyframes(e){let n=this.options.captureKeyframe??(a=>this.defaultKeyframe(a)),r=xn/(ge-1),i=null;for(let a=0;a<ge;a+=1){if(e!==this.attempt)return i;try{let o=await n(this.options.video);(i===null||o.sharpness>i.sharpness)&&(i=o)}catch{}a<ge-1&&await ki(r)}return i}finishCapture(e){this.stopTracks(),this.setState("captured");let n=this.captureTiming();this.emit("artifacts",n===void 0?e:{...e,timing:n})}captureTiming(){let e={},n=(r,i,a)=>{i!==null&&a!==null&&(e[r]=Math.max(0,Math.round(a-i)))};return n("cameraReadyMs",this.cameraRequestedAt,this.cameraReadyAt),n("faceAcquireMs",this.cameraReadyAt,this.faceAcquiredAt),n("captureMs",this.faceAcquiredAt,this.captureCompleteAt),Object.keys(e).length>0?e:void 0}async defaultKeyframe(e){let n=document.createElement("canvas"),r=await(this.facing==="user"?we:yi)(e,n),i=n.toDataURL("image/jpeg",.92);return{blob:r,previewDataUrl:i,sharpness:this.centerSharpness(e)}}defaultSnapshot(e,n){try{let r=this.snapshotCanvas??document.createElement("canvas"),i=n/Math.max(1,e.videoWidth),a=Math.max(1,Math.round(e.videoWidth*i)),o=Math.max(1,Math.round(e.videoHeight*i)),s=r.getContext("2d");return s===null?e:(r.width!==a&&(r.width=a),r.height!==o&&(r.height=o),s.drawImage(e,0,0,a,o),this.snapshotCanvas=r,r)}catch{return e}}defaultQuality(e,n){let r=En(e,n,96);return r===null?Mn:{sharpness:ue(r),exposure:Oe(r),meanLuma:ce(r)}}centerSharpness(e){let n=A(e),r=En(e,{x:n.width*.25,y:n.height*.25,width:n.width*.5,height:n.height*.5},96);return r===null?0:ue(r)}teardownAttempt(){this.scheduler?.stop(),this.scheduler=null,this.reportGate(!0),this.gate=null,this.ramp?.stop(),this.ramp=null,this.stopTracks()}reportGate(e){let n=this.blockStats,r=this.profiler;if(n===null||r===null)return;let i=n.summary();e&&(this.blockStats=null),i.ticks!==0&&this.options.telemetry?.({type:"gate",final:e,activeClass:r.deviceClass,cadenceHz:r.profile.cadenceHz,...i})}stopTracks(){if(this.stream!==null){for(let e of this.stream.getTracks())e.stop();this.stream=null}}fail(e,n,r){this.scheduler?.stop(),this.reportGate(!0),this.stopTracks(),this.setState("error"),this.options.telemetry?.({type:"error",kind:e,fallbackReason:r});let{phase:i,name:a}=n;this.emit("error",{kind:e,retryable:e!=="insecure"&&e!=="unsupported",detail:a===void 0?{phase:i}:{phase:i,name:a}})}setState(e){this.stateValue=e,this.emit("statechange",{state:e})}now(){return this.options.now?.()??performance.now()}},$e;function ki(t){return new Promise(e=>setTimeout(e,t))}function wi(t){return t instanceof Error?t.message:String(t)}function En(t,e,n){try{let r=document.createElement("canvas"),i=n/Math.max(1,e.width);r.width=Math.max(1,Math.round(e.width*i)),r.height=Math.max(1,Math.round(e.height*i));let a=r.getContext("2d");return a===null?null:(a.drawImage(t,e.x,e.y,e.width,e.height,0,0,r.width,r.height),a.getImageData(0,0,r.width,r.height))}catch{return null}}function Mi(t){if(t.enumerateDevices!==void 0)return t.enumerateDevices;if(t.getUserMedia===void 0&&!(typeof navigator>"u"||typeof navigator.mediaDevices?.enumerateDevices!="function"))return()=>navigator.mediaDevices.enumerateDevices()}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,ENCODER_TAIL_MS,EXPOSURE_BAND,FRAME_POLL_MS,FaceGateV3,GATE_SNAPSHOT_MS,GateBlockStats,HOLD_UPRIGHT_KEY,INSPECT_WAIT_MS,IN_CIRCLE_FACTOR,KEYFRAME_CANDIDATES,KEYFRAME_WINDOW_MS,MAX_CLIP_BYTES,MAX_OVERRUN_MS,MIME_CANDIDATES,PHONE_MAX_SHORT_SIDE,PROVENANCE_WAIT_MS,SECOND_FACE_AREA_RATIO,SHARP_REF,SHORT_CLIP_TOLERANCE_MS,STOP_GRACE_MS,TIMESLICE_MS,UPRIGHT_WATCH_MS,V3_GATE_DEFAULTS,VIDEO_BPS,betterTake,blockReasonOf,buildCaptureConstraints,buildLivenessV2FormData,cameraPreflight,captureMirroredKeyframe,classifyDevice,countExtraFaces,createDetector,detectFormFactor,detectIsMobile,errorCopy,exposure,extForMime,intrinsicSize,isClipTooLarge,isMediaRecorderSupported,mapGetUserMediaError,meanLuma,needsRetake,pickMimeType,probeDevice,sharpness,toStreamPixels,trackFacingMode,uiCopy});
|
|
1
|
+
"use strict";var _n=Object.create;var Q=Object.defineProperty;var An=Object.getOwnPropertyDescriptor;var Dn=Object.getOwnPropertyNames;var In=Object.getPrototypeOf,On=Object.prototype.hasOwnProperty;var R=(t,e)=>()=>(t&&(e=t(t=0)),e);var B=(t,e)=>{for(var n in e)Q(t,n,{get:e[n],enumerable:!0})},Je=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Dn(e))!On.call(t,i)&&i!==n&&Q(t,i,{get:()=>e[i],enumerable:!(r=An(e,i))||r.enumerable});return t};var Pn=(t,e,n)=>(n=t!=null?_n(In(t)):{},Je(e||!t||!t.__esModule?Q(n,"default",{value:t,enumerable:!0}):n,t)),Fn=t=>Je(Q({},"__esModule",{value:!0}),t);var mt={};B(mt,{blobBytes:()=>rt,inspectClip:()=>Kn,inspectClipBytes:()=>it,webmDurationMs:()=>ir,withWebmDuration:()=>rr});async function Kn(t){try{return it(await rt(t))}catch{return null}}async function rt(t){return typeof t.arrayBuffer=="function"?new Uint8Array(await t.arrayBuffer()):new Promise((e,n)=>{let r=new FileReader;r.onload=()=>e(new Uint8Array(r.result)),r.onerror=()=>n(r.error),r.readAsArrayBuffer(t)})}function it(t){if(t.length<8)return null;try{if(t[0]===26&&t[1]===69&&t[2]===223&&t[3]===163)return nr(t);if(Ee(t,4,4)==="ftyp")return qn(t)}catch{return null}return null}function qn(t){let e=new DataView(t.buffer,t.byteOffset,t.byteLength),n=[],r=null,i=null,a=0,o=(c,u)=>{let l=c;for(;l+8<=u;){let d=e.getUint32(l),f=Ee(t,l+4,4),h=8;if(d===1){if(l+16>u)return;d=Number(e.getBigUint64(l+8)),h=16}else d===0&&(d=u-l);if(d<h)return;let p=Math.min(l+d,u),m=l+h;if(f==="trak"&&(r={id:0,video:!1,timescale:0,frames:0,units:0,defaultDuration:0},n.push(r)),f==="traf"&&(i=null,a=0),zn.has(f))o(m,p);else if(f==="tkhd"&&r)r.id=e.getUint32(m+(t[m]===1?20:12));else if(f==="hdlr"&&r)r.video=Ee(t,m+8,4)==="vide";else if(f==="mdhd"&&r)r.timescale=e.getUint32(m+(t[m]===1?20:12));else if(f==="stts"&&r){let b=e.getUint32(m+4);for(let g=0;g<b;g++){let y=e.getUint32(m+8+g*8);r.frames+=y,r.units+=y*e.getUint32(m+12+g*8)}}else if(f==="trex"){let b=n.find(g=>g.id===e.getUint32(m+4));b&&(b.defaultDuration=e.getUint32(m+12))}else if(f==="tfhd"){let b=e.getUint32(m)&16777215;i=n.find(y=>y.id===e.getUint32(m+4))??null;let g=m+8;b&1&&(g+=8),b&2&&(g+=4),a=b&8?e.getUint32(g):i?.defaultDuration??0}else if(f==="trun"&&i){let b=e.getUint32(m)&16777215,g=e.getUint32(m+4),y=m+8;b&1&&(y+=4),b&4&&(y+=4);let w=(b&256?4:0)+(b&512?4:0)+(b&1024?4:0)+(b&2048?4:0);for(let k=0;k<g;k++)i.units+=b&256?e.getUint32(y+k*w):a;i.frames+=g}l=p}};o(0,t.length);let s=n.find(c=>c.video&&c.timescale>0);return!s||s.frames===0?null:{container:"mp4",frames:s.frames,durationMs:xe(s.units*1e3/s.timescale)}}function tr(t,e){let n=t[e];if(n===void 0||n===0)return null;let r=Math.clz32(n)-23;if(r<1||r>4||e+r>t.length)return null;let i=0;for(let a=0;a<r;a++)i=i*256+t[e+a];return[i,r]}function dt(t,e){let n=t[e];if(n===void 0||n===0)return null;let r=Math.clz32(n)-23;if(r<1||r>8||e+r>t.length)return null;let i=n&255>>r,a=i===255>>r;for(let o=1;o<r;o++){let s=t[e+o];i=i*256+s,s!==255&&(a=!1)}return[a?-1:i,r]}function _(t,e,n){let r=0;for(let i=0;i<n;i++)r=r*256+t[e+i];return r}function Se(t){let e=[],n=0;for(;n<t.length;){let r=tr(t,n);if(!r)break;let i=dt(t,n+r[1]);if(!i)break;let a={id:r[0],start:n,sizeAt:n+r[1],data:n+r[1]+i[1],size:i[0]};if(e.push(a),lt.has(a.id))n=a.data;else{if(a.size<0)break;n=a.data+a.size}}return e}function nr(t){let e=new DataView(t.buffer,t.byteOffset,t.byteLength),n=1e6,r=[],i=0,a=[];for(let c of Se(t)){if(c.data+Math.max(0,c.size)>t.length&&!lt.has(c.id))break;switch(c.id){case Te:n=_(t,c.data,c.size)||n;break;case st:r.push({num:0,type:0});break;case Zn:r.length&&(r[r.length-1].num=_(t,c.data,c.size));break;case jn:r.length&&(r[r.length-1].type=_(t,c.data,c.size));break;case $n:i=_(t,c.data,c.size);break;case Qn:case Jn:{let u=dt(t,c.data);if(!u||c.data+u[1]+2>t.length)break;let l=r.filter(d=>d.type===1).map(d=>d.num);if(l.length>0&&!l.includes(u[0]))break;a.push((i+e.getInt16(c.data+u[1]))*n/1e6);break}default:break}}if(a.length===0)return null;a.sort((c,u)=>c-u);let o=a.slice(1).map((c,u)=>c-a[u]),s=o.length?o.sort((c,u)=>c-u)[Math.floor(o.length/2)]:0;return{container:"webm",frames:a.length,durationMs:xe(a[a.length-1]-a[0]+s)}}function rr(t,e){if(!(e>0))return null;let n=Se(t),r=n.find(m=>m.id===at);if(!r||r.size!==-1||n.some(m=>m.id===er))return null;let i=n.find(m=>m.id===ot);if(!i||i.size<0||i.data+i.size>t.length)return null;let a=1e6,o=[];for(let m of n)m.start<i.data||m.start>=i.data+i.size||(m.id===Te&&(a=_(t,m.data,m.size)||a),m.id!==ut&&o.push(t.subarray(m.start,m.data+m.size)));let s=new Uint8Array(11);s.set([68,137,136]),new DataView(s.buffer).setFloat64(3,e*1e6/a);let c=o.reduce((m,b)=>m+b.length,0)+s.length,u=new Uint8Array(12);u.set([21,73,169,102,1]);let l=c;for(let m=11;m>=5;m--)u[m]=l&255,l=Math.floor(l/256);let d=t.subarray(i.data+i.size),f=new Uint8Array(i.start+u.length+c+d.length),h=0,p=m=>{f.set(m,h),h+=m.length};return p(t.subarray(0,i.start)),p(u),o.forEach(p),p(s),p(d),f}function ir(t){let e=1e6,n=null,r=new DataView(t.buffer,t.byteOffset,t.byteLength);for(let i of Se(t))if(i.id===Te&&(e=_(t,i.data,i.size)||e),i.id===ut&&(n=i.size===8?r.getFloat64(i.data):i.size===4?r.getFloat32(i.data):null),i.id===ct)break;return n===null?null:xe(n*e/1e6)}function Ee(t,e,n){let r="";for(let i=0;i<n&&e+i<t.length;i++)r+=String.fromCharCode(t[e+i]);return r}function xe(t){return Math.round(t*10)/10}var zn,at,ot,Xn,st,ct,Yn,Te,ut,Zn,jn,$n,Qn,Jn,er,lt,ft=R(()=>{"use strict";zn=new Set(["moov","trak","mdia","minf","stbl","mvex","moof","traf","edts"]);at=408125543,ot=357149030,Xn=374648427,st=174,ct=524531317,Yn=160,Te=2807729,ut=17545,Zn=215,jn=131,$n=231,Qn=163,Jn=161,er=290298740,lt=new Set([at,ot,Xn,st,ct,Yn])});function Ne(t,e=80){return typeof t=="string"&&t.replace(/[^A-Za-z0-9 ()\-._,]/g,"").trim().slice(0,e)||void 0}function L(t){try{return t()}catch{return}}function N(t){let e={};for(let[n,r]of Object.entries(t))r!==void 0&&(e[n]=r);return Object.keys(e).length>0?e:void 0}function Ue(t,e){F=N({renderer:Ne(t),vendor:Ne(e)})??F}function Tr(t){return F===void 0&&(F=null,L(()=>{let e=t?.createElement("canvas").getContext("webgl");if(e){let n=e.getExtension("WEBGL_debug_renderer_info");Ue(e.getParameter(n?n.UNMASKED_RENDERER_WEBGL:e.RENDERER),e.getParameter(n?n.UNMASKED_VENDOR_WEBGL:e.VENDOR)),e.getExtension("WEBGL_lose_context")?.loseContext()}})),F??void 0}function Sr(t){let e=t.navigator,n=t.screen?.orientation?.type,r=t.devicePixelRatio;return N({touchPoints:S(e?.maxTouchPoints),webdriver:Ot(e?.webdriver),uaMobile:Ot(e?.userAgentData?.mobile),uaPlatform:Ne(e?.userAgentData?.platform,32),screenW:S(t.screen?.width),screenH:S(t.screen?.height),dpr:typeof r=="number"&&r>0&&Number.isFinite(r)?Ve(r):void 0,coarse:Pt(t,"(pointer: coarse)"),noHover:Pt(t,"(hover: none)"),orientation:Er.test(n)?n:void 0})}function xr(t,e){let n=L(()=>t.getCapabilities?.()),r=i=>{let a=i;return typeof a?.min=="number"&&typeof a.max=="number"?a.max>a.min:void 0};return N({inputs:e,capabilities:n?Mr.filter(i=>i in n):void 0,frameRateRange:r(n?.frameRate),widthRange:r(n?.width)})}async function Lt(t,e=globalThis){let n=new Promise(a=>{let o=()=>a(Tr(e.document));F!==void 0?o():typeof e.requestIdleCallback=="function"?e.requestIdleCallback(o,{timeout:It}):setTimeout(o,0)}),r=Promise.race([Promise.resolve().then(()=>e.navigator?.mediaDevices?.enumerateDevices?.()).then(a=>a?.filter(o=>o.kind==="videoinput").length,()=>{}),new Promise(a=>setTimeout(a,It))]),i=L(()=>Sr(e));return N({gpu:await n,device:i,camera:xr(t,await r)})??{}}function Ft(){let t=0,e=0,n=0;return{add(r,i,a){if(typeof r!="number"||typeof i!="number"||typeof a!="number")return;let o=Math.hypot(r,i,a);if(!Number.isFinite(o))return;t+=1;let s=o-e;e+=s/t,n+=s*(o-e)},std:()=>t<2?void 0:Ve(Math.sqrt(n/(t-1)))}}function Nt(t=globalThis){let e=t.DeviceMotionEvent,n=typeof e=="function"&&typeof e.requestPermission!="function"&&typeof t.addEventListener=="function",r=0,i,a=Ft(),o=Ft(),s=d=>{r+=1,typeof d.interval=="number"&&d.interval>=0&&Number.isFinite(d.interval)&&(i=Ve(d.interval));let f=d.accelerationIncludingGravity;f&&a.add(f.x,f.y,f.z);let h=d.rotationRate;h&&o.add(h.alpha,h.beta,h.gamma)},c=0,u=()=>{c+=1};L(()=>{n&&t.addEventListener("devicemotion",s),t.document?.addEventListener("visibilitychange",u)});let l;return{stop(){return l!==void 0||(L(()=>{n&&t.removeEventListener?.("devicemotion",s),t.document?.removeEventListener("visibilitychange",u)}),l={motion:n?{available:n,events:r,...N({intervalMs:i,accelStd:a.std(),rotationStd:o.std()})}:{available:n},page:N({visibilityChanges:c,outerW:S(t.outerWidth),outerH:S(t.outerHeight),innerW:S(t.innerWidth),innerH:S(t.innerHeight)})}),l}}}var Mr,Er,It,S,Ot,Ve,F,Pt,Ge=R(()=>{"use strict";Mr="zoom torch focusMode focusDistance exposureMode exposureCompensation exposureTime whiteBalanceMode colorTemperature iso facingMode frameRate width height aspectRatio resizeMode deviceId groupId".split(" "),Er=/^(portrait|landscape)-(primary|secondary)$/,It=1e3;S=t=>typeof t=="number"&&Number.isFinite(t)&&t>=0?Math.round(t):void 0,Ot=t=>typeof t=="boolean"?t:void 0,Ve=t=>Math.round(t*1e4)/1e4;Pt=(t,e)=>L(()=>t.matchMedia?.(e).matches)});function Vt(t){let e=(t??"").trim().toLowerCase();return e.length===0?"unknown":Cr.some(n=>e.includes(n))?"known_virtual":Rr.some(n=>n.test(e))?"platform":"unknown"}var Cr,Rr,Ut=R(()=>{"use strict";Cr=["obs","manycam","virtual","snap camera","xsplit","droidcam","iriun","camo","fake_device","fake-capture-device"],Rr=[/^(front|back|rear)( [a-z ]+)? camera$/i,/^caméra (avant|arrière)\b/i,/^cámara (frontal|trasera|delantera)\b/i,/^câmera (frontal|traseira)\b/i,/^(front|rück)kamera\b/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]});var Bt={};B(Bt,{bounded:()=>j,cameraHash:()=>Gt,hex16:()=>le,noteCameraTrait:()=>Dr});function j(t,e){return new Promise(n=>{let r=setTimeout(()=>n(void 0),e),i=a=>{clearTimeout(r),n(a)};try{t().then(i,()=>i(void 0))}catch{i(void 0)}})}async function le(t){let e=await crypto.subtle.digest("SHA-256",new TextEncoder().encode(JSON.stringify(t)));return Array.from(new Uint8Array(e).subarray(0,8),n=>n.toString(16).padStart(2,"0")).join("")}function Ar(t){try{return t.getSettings?.().facingMode==="environment"}catch{return!1}}async function Gt(t){try{if(t.readyState==="ended"||Ar(t))return;let e={};try{e=t.getCapabilities?.()??{}}catch{}let n=await j(()=>navigator.mediaDevices.enumerateDevices(),_r);return await le([He(e.width),He(e.height),He(e.frameRate),Be(e.facingMode),Be(e.focusMode),Be(e.exposureMode),Vt(t.label),n?.filter(r=>r.kind==="videoinput").length??null])}catch{return}}async function Dr(t,e){let n=await Gt(t);n&&e.noteCamera(n)}var _r,Be,He,We=R(()=>{"use strict";Ut();_r=1e3;Be=t=>Array.isArray(t)?[...t].sort():null,He=t=>{let e=t;return e==null?null:[e.min??null,e.max??null]}});var zt={};B(zt,{computePrint:()=>Wr,readHints:()=>Kt});function Ht(t,e){if(typeof t!="string")return;let n=t.trim();return n.length>0&&n.length<=e?n:void 0}async function Kt(){let t=navigator.userAgentData;if(typeof t?.getHighEntropyValues!="function")return;let e=await j(()=>t.getHighEntropyValues(["model","platformVersion"]),Fr);if(e==null)return;let n=Ht(e.model,Nr),r=Ht(e.platformVersion,Vr),i={...n!==void 0?{model:n}:{},...r!==void 0?{platformVersion:r}:{}};return Object.keys(i).length>0?i:void 0}async function Br(){let[t,e]=await Promise.all([new Wt.Thumbmark({stabilize:["private","iframe"],exclude:["permissions","webrtc","speech"],logging:!1,collect_beacon:!1,timeout:Or}).get(),Kt()]),n=t?.components?.hardware?.videocard;n!==null&&typeof n=="object"&&Ue(n.rendererUnmasked??n.renderer,n.vendorUnmasked??n.vendor);let r=t?.thumbmark;if(typeof r!="string"||r.length<Ur||r.length>Gr)return;let i={};for(let a of Ir){let o=t.components?.[a];o==null||o.timeout==="true"||(i[a]=await le(o))}return{hash:r,c:i,...e!==void 0?{hints:e}:{}}}function Hr(){return new Promise(t=>{typeof globalThis.requestIdleCallback=="function"?globalThis.requestIdleCallback(()=>t(),{timeout:Lr}):t()})}async function Wr(t){return t()||(await Hr(),t())?"busy":j(Br,Pr)}var Wt,Ir,Or,Pr,Fr,Lr,Nr,Vr,Ur,Gr,qt=R(()=>{"use strict";Wt=require("@thumbmarkjs/thumbmarkjs");Ge();We();Ir=["canvas","webgl","audio","fonts","hardware","screen","system","locales","math","plugins"],Or=2e3,Pr=4e3,Fr=1e3,Lr=2e3,Nr=64,Vr=32,Ur=8,Gr=128});var kn={};B(kn,{RANK_CANDIDATES:()=>mi,RANK_TOLERANCE:()=>pe,RANK_WINDOW_MS:()=>fi,ROLL_ZERO_DEG:()=>hi,SHARPNESS_REPORT_MAX:()=>yn,YAW_REPORT_MAX:()=>bn,YAW_ZERO_IOD:()=>pi,collectRankedKeyframes:()=>vn,default:()=>bi,featuresOf:()=>hn,frontalOf:()=>pn,rankKeyframes:()=>gn});function pn(t){let e=t.eyes;if(e===void 0)return{frontal:1,yaw:null,roll:null};let n=e.right.x-e.left.x,r=e.right.y-e.left.y,i=n*n+r*r;if(i===0)return{frontal:1,yaw:null,roll:null};let a=Math.abs(Math.atan2(r,Math.abs(n))*180/Math.PI),o=fn(1-a/30),s=null,c=t.nose;if(c!==void 0){let u=(e.left.x+e.right.x)/2,l=(e.left.y+e.right.y)/2;s=Math.abs(((c.x-u)*n+(c.y-l)*r)/i),o*=fn(1-s/.5)}return{frontal:o,yaw:s,roll:a}}function hn(t,e){return t===null?{face:!1,frontal:0,yaw:null,roll:null,eyes:null,score:0,sharpness:e}:{face:!0,...pn(t),eyes:null,score:t.score,sharpness:e}}function gn(t){let e=t.map((i,a)=>a),n=(i,a)=>{let o=Number.NEGATIVE_INFINITY;for(let s of e)o=Math.max(o,i(t[s]));e=e.filter(s=>i(t[s])>=o-a)};n(i=>i.frontal,pe.frontal),n(i=>i.eyes??1,pe.eyes),n(i=>i.score,pe.score);let r=-1;for(let i of e)(r===-1||t[i].sharpness>t[r].sharpness)&&(r=i);return r}function gi(t){return{face:t.face,frontal:G(t.frontal),...t.yaw!==null?{yaw:Math.min(G(t.yaw),bn)}:{},...t.roll!==null?{roll:G(t.roll)}:{},...t.eyes!==null?{eyes:G(t.eyes)}:{},score:G(t.score),sharpness:Math.min(G(t.sharpness),yn)}}async function vn(t,e){let{options:n}=t,r=n.video,i=n.now??(()=>performance.now()),a=n.captureKeyframe??(f=>t.defaultKeyframe(f)),o=600/3,s=[],c=[],u=0;for(let f=0;f<4;f+=1){if(e!==t.attempt)return null;let h=t.detector,p=Promise.resolve(null),m,b=0;try{if(h!==null){let k=t.profiler?.profile.inputWidth??160,C=n.makeSnapshot?.(r,k)??t.defaultSnapshot(r,k);m=a(r).then(v=>(b=i(),v));let M=i();p=h.detect(C,r.videoWidth,r.videoHeight).then(v=>(u+=i()-M,v),()=>null)}else m=a(r).then(k=>(b=i(),k));let[y,w]=await Promise.all([m,p]);s.push(y),c.push(hn(w,y.sharpness))}catch{m?.catch(()=>{})}let g=b>0?Math.max(0,i()-b):0;f<3&&await new Promise(y=>setTimeout(y,Math.max(0,o-g)))}if(e!==t.attempt)return null;let l=gn(c);if(l===-1)return null;let d=0;c.forEach((f,h)=>{f.sharpness>c[d].sharpness&&(d=h)});try{n.telemetry?.({type:"keyframe",tier:t.detector?.tier??null,chosen:l,sharpest:d,detectMs:Math.round(u),candidates:c.map(gi)})}catch{}return s[l]??null}var mi,fi,pi,hi,pe,fn,G,bn,yn,bi,wn=R(()=>{"use strict";mi=4,fi=600,pi=.5,hi=30,pe={frontal:.1,eyes:.1,score:.05},fn=t=>t<0?0:t>1?1:t;G=t=>Number.isFinite(t)?Math.round(t*1e3)/1e3:0,bn=99,yn=999999;bi=vn});var Ei={};B(Ei,{CENTERED_FACTOR:()=>dr,CIRCLE_RADIUS_FACTOR:()=>ur,CLIP_MS:()=>ne,CaptureSessionV3:()=>Qe,ClipError:()=>E,ClipRecorder:()=>W,DEFAULT_CLIP_MIME:()=>ee,DEFAULT_TIER_ORDER:()=>xt,DEFAULT_V3_ASSET_BASE_URL:()=>St,DEVICE_PROFILES:()=>_t,DetectScheduler:()=>Z,DetectorLadderError:()=>D,DeviceProfiler:()=>Y,ENCODER_TAIL_MS:()=>gt,EXPOSURE_BAND:()=>X,FRAME_POLL_MS:()=>yt,FaceGateV3:()=>P,GATE_SNAPSHOT_MS:()=>Tn,GateBlockStats:()=>U,HOLD_UPRIGHT_KEY:()=>he,INSPECT_WAIT_MS:()=>vt,IN_CIRCLE_FACTOR:()=>lr,KEYFRAME_CANDIDATES:()=>ge,KEYFRAME_WINDOW_MS:()=>xn,MAX_CLIP_BYTES:()=>te,MAX_OVERRUN_MS:()=>bt,MIME_CANDIDATES:()=>J,PHONE_MAX_SHORT_SIDE:()=>wt,PROVENANCE_WAIT_MS:()=>Cn,SECOND_FACE_AREA_RATIO:()=>Tt,SHARP_REF:()=>Bi,SHORT_CLIP_TOLERANCE_MS:()=>kt,STOP_GRACE_MS:()=>ht,TIMESLICE_MS:()=>pt,UPRIGHT_WATCH_MS:()=>Sn,V3_GATE_DEFAULTS:()=>Rt,VIDEO_BPS:()=>Re,betterTake:()=>_e,blockReasonOf:()=>mn,buildCaptureConstraints:()=>Ae,buildLivenessV2FormData:()=>Vn,cameraPreflight:()=>ke,captureMirroredKeyframe:()=>we,classifyDevice:()=>Le,countExtraFaces:()=>z,createDetector:()=>I,detectFormFactor:()=>ie,detectIsMobile:()=>De,errorCopy:()=>Un,exposure:()=>Oe,extForMime:()=>ye,intrinsicSize:()=>A,isClipTooLarge:()=>H,isMediaRecorderSupported:()=>Nn,mapGetUserMediaError:()=>ve,meanLuma:()=>ce,needsRetake:()=>re,pickMimeType:()=>Ln,probeDevice:()=>Fe,sharpness:()=>ue,toStreamPixels:()=>q,trackFacingMode:()=>K,uiCopy:()=>Gn});module.exports=Fn(Ei);var J=["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 Ln(){let t=globalThis.MediaRecorder;return!t||typeof t.isTypeSupported!="function"?"":J.find(e=>t.isTypeSupported(e))??""}var ee="video/webm";function ve(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 ke(){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 Nn(){let t=globalThis.MediaRecorder;return typeof t<"u"&&typeof t.isTypeSupported=="function"}var te=8*1024*1024;function H(t){return t.size>te}function ye(t){let e=(t||"").toLowerCase();return e.startsWith("image/jpeg")?"jpg":e.startsWith("video/mp4")?"mp4":(e.startsWith("video/webm"),"webm")}function Vn(t){let{token:e,clip:n,keyframe:r}=t,i=t.ts??Date.now(),a=n.type||ee,o=r.type||"image/jpeg",s=new FormData;return s.append("token",e),s.append("clip",new File([n],`liveness-${i}.${ye(a)}`,{type:a})),s.append("keyframe",new File([r],`keyframe-${i}.${ye(o)}`,{type:o})),s}function we(t,e,n=.92){return new Promise((r,i)=>{let a=t.videoWidth,o=t.videoHeight;if(!a||!o){i(new Error("video-not-ready"));return}let s=e.getContext("2d");if(!s){i(new Error("no-2d-context"));return}e.width=a,e.height=o,s.scale(-1,1),s.drawImage(t,-a,0),e.toBlob(c=>c?r(c):i(new Error("empty-keyframe")),"image/jpeg",n)})}var Un={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."}},Gn={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 Bn=[...J.filter(t=>t.startsWith("video/mp4")),"video/webm;codecs=h264","video/webm;codecs=avc1","video/webm;codecs=vp8","video/webm;codecs=vp9","video/webm"],et=new Set;function Hn(t){let e=/(?:Chrome|Chromium)\/(\d+)\./.exec(t??"");return e?Number(e[1]):null}function tt(t=Wn(),e=globalThis.navigator?.userAgent){if(t===void 0)return"";let n=Hn(e)===126;for(let r of Bn)if(!(et.has(r)||n&&r.startsWith("video/mp4")))try{if(t(r))return r}catch{}return""}function Me(t){t!==""&&et.add(t)}function nt(t){return t.replace(/^video\/x-matroska/i,"video/webm")}function Wn(){let t=globalThis.MediaRecorder;return t&&typeof t.isTypeSupported=="function"?e=>t.isTypeSupported(e):void 0}var ne=2500,pt=1e3,ht=1500,Re=25e5,gt=100,bt=700,yt=20,vt=1500,Ce=null;function ar(){return Ce??(Ce=Promise.resolve().then(()=>(ft(),mt)).catch(t=>{throw Ce=null,t})),Ce.catch(()=>null)}var E=class extends Error{constructor(e,n){super(n??e),this.kind=e}},kt=100;function re(t,e){return t.stats===void 0?!1:t.stats===null?!0:t.stats.durationMs<e-kt}function _e(t,e){return t.stats?e.stats?t.stats.durationMs>e.stats.durationMs:!0:!1}var W=class{constructor(e={}){this.recorder=null;this.stream=null;this.chunks=[];this.bytes=0;this.hardStopTimer=null;this.graceTimer=null;this.pollTimer=null;this.settled=!1;this.now=e.now??(()=>globalThis.performance?.now?.()??Date.now())}clearTimers(){this.hardStopTimer&&clearTimeout(this.hardStopTimer),this.graceTimer&&clearTimeout(this.graceTimer),this.pollTimer&&clearInterval(this.pollTimer),this.hardStopTimer=null,this.graceTimer=null,this.pollTimer=null}record(e,n,r,i=ne,a){let o=tt(),s=ar();return this.recordRaw(e,n,r,i,a,o).then(c=>or(c,s),c=>{throw c instanceof E&&(c.requestedMimeType=o),c})}recordRaw(e,n,r,i,a,o){return this.recorder&&!this.settled?Promise.reject(new E("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,new Promise((s,c)=>{let u;try{u=new MediaRecorder(e,o?{mimeType:o,videoBitsPerSecond:Re}:{videoBitsPerSecond:Re})}catch{try{u=new MediaRecorder(e)}catch{c(new E("unsupported"));return}}this.recorder=u;let l=g=>{this.settled||(this.settled=!0,this.clearTimers(),g())},d=()=>l(()=>{let g=nt(u.mimeType||o||ee),y=new Blob(this.chunks,{type:g});if(y.size===0){c(new E("generic","empty clip"));return}if(H(y)){c(new E("cliptoolarge"));return}s({blob:y,mimeType:g,requestedMimeType:o})});u.ondataavailable=g=>{g.data&&g.data.size&&(this.chunks.push(g.data),this.bytes+=g.data.size,this.bytes>te&&l(()=>{try{u.state!=="inactive"&&u.stop()}catch{}c(new E("cliptoolarge"))}))},u.onstop=d,u.onerror=()=>l(()=>c(new E("generic")));let f=this.now();if(r!==void 0||a!==void 0){let g=!1;u.onstart=()=>{if(!(g||this.settled)&&(g=!0,f=this.now(),r!==void 0))try{r()}catch{}}}try{u.start(pt)}catch{l(()=>c(new E("generic")));return}let h=()=>{if(this.pollTimer&&clearInterval(this.pollTimer),this.pollTimer=null,this.hardStopTimer&&clearTimeout(this.hardStopTimer),this.hardStopTimer=null,this.settled||n?.(),u.state!=="inactive"){try{u.stop()}catch{d()}this.graceTimer=setTimeout(d,ht)}else d()},p=this.now();if(a===void 0){this.hardStopTimer=setTimeout(h,i);return}let m=null,b=!1;this.hardStopTimer=setTimeout(h,i+bt),this.pollTimer=setInterval(()=>{if(this.settled||b)return;let g=null;try{g=a.latest()}catch{g=null}let y=g?.presentationTimeMs;y!==void 0&&Number.isFinite(y)&&y>=f&&m===null&&(m=y);let w=m!==null&&y!==void 0&&y-m>=i,k=m===null&&this.now()-p>=i;if(!(!w&&!k)){if(b=!0,this.pollTimer&&clearInterval(this.pollTimer),this.pollTimer=null,k){h();return}this.hardStopTimer&&clearTimeout(this.hardStopTimer),this.hardStopTimer=setTimeout(h,gt)}},yt)}))}stop(e){this.clearTimers();let n=this.recorder;if(n&&n.state!=="inactive")try{n.stop()}catch{}this.recorder=null,(e??this.stream)?.getTracks().forEach(i=>i.stop()),this.stream=null}};async function or(t,e){let n,r=new Promise(u=>{n=setTimeout(()=>u(null),vt)}),i=await Promise.race([e,r]);if(clearTimeout(n),i===null)return t;let a;try{a=await i.blobBytes(t.blob)}catch{return{...t,stats:null}}let o=i.inspectClipBytes(a);if(o?.container!=="webm")return{...t,stats:o};let s=i.withWebmDuration(a,o.durationMs);if(s===null)return{...t,stats:o};let c=i.inspectClipBytes(s);return c===null||c.frames!==o.frames||c.durationMs!==o.durationMs?{...t,stats:o}:{...t,blob:new Blob([s],{type:t.blob.type}),stats:o}}function Ae(t,e){return{video:{width:{ideal:1280,max:1280},height:{ideal:720,max:720},facingMode:e,frameRate:{ideal:24,max:30}},audio:!1}}var wt=600;function ie(){if(typeof window>"u"||typeof navigator>"u")return"desktop";let t=navigator.userAgentData,e=t?.mobile||/Android|i(Pad)?OS/.test(String(t?.platform)),n=String(navigator.userAgent??"");if(/iPhone|iPod/i.test(n))return"phone";if(/iPad/i.test(n))return"tablet";if(/Android/i.test(n))return/Mobile/i.test(n)?"phone":"tablet";if(/BlackBerry|IEMobile|Opera Mini/i.test(n))return"phone";if(!e){if(Number(navigator.maxTouchPoints??0)<=1)return"desktop";if(/Macintosh/.test(n))return"tablet";if(/Windows NT|CrOS/.test(n)||!cr())return"desktop"}let r=sr();return r>0&&r<wt?"phone":"tablet"}function De(){return ie()!=="desktop"}function sr(){try{let t=window.screen,e=Number(t?.width??0),n=Number(t?.height??0);return e>0&&n>0?Math.min(e,n):0}catch{return 0}}function K(t){try{let n=t?.getVideoTracks?.()[0]?.getSettings?.().facingMode;return n==="user"||n==="environment"?n:null}catch{return null}}function cr(){try{return typeof window.matchMedia=="function"&&window.matchMedia("(pointer: coarse)").matches}catch{return!1}}var ur=.45,lr=.9,dr=.4;var Mt=1e4,ae=class t{constructor(e,n){this.tier="blaze";this.inner=e,n!==void 0&&(this.fallbackReason=n)}static async create(e,n){let r=await import("@mediapipe/tasks-vision"),i=await r.FilesetResolver.forVisionTasks(e),a=await r.FaceDetector.createFromOptions(i,{baseOptions:{modelAssetPath:`${e}/blaze_face_short_range.tflite`,delegate:"CPU"},runningMode:"IMAGE"});return new t(a,n)}async detect(e,n,r){let i;try{i=this.inner.detect(e).detections}catch{return null}let a=mr(i);if(a?.boundingBox===void 0)return null;let o=A(e),s=fr(a.keypoints,o),c=a.keypoints?.[2],u={box:{x:a.boundingBox.originX,y:a.boundingBox.originY,width:a.boundingBox.width,height:a.boundingBox.height},...s!==void 0?{eyes:s}:{},...c!==void 0?{nose:{x:c.x*o.width,y:c.y*o.height}}:{},score:a.categories[0]?.score??0,extraFaces:z(i.map(l=>l.boundingBox??{width:0,height:0}),i.indexOf(a))};return q(u,e,n,r)}destroy(){try{this.inner.close()}catch{}}};function mr(t){let e,n=-1;for(let r of t){let i=r.categories[0]?.score??0;i>n&&(e=r,n=i)}return e}function fr(t,e){let n=t?.[0],r=t?.[1];if(n===void 0||r===void 0)return;let i=s=>({x:s.x*e.width,y:s.y*e.height}),[a,o]=[i(n),i(r)];return a.x<=o.x?{left:a,right:o}:{left:o,right:a}}function pr(){if(typeof OffscreenCanvas=="function")return new OffscreenCanvas(2,2);let t=document.createElement("canvas");return t.width=2,t.height=2,t}var hr=4;async function Et(){let t=globalThis.FaceDetector;if(typeof t!="function")return{ok:!1,reason:"unsupported"};try{let e=new t({fastMode:!0,maxDetectedFaces:hr});return await e.detect(pr()),{ok:!0,instance:e}}catch(e){return{ok:!1,reason:`smoke_failed:${e instanceof Error?e.message:String(e)}`}}}var oe=class{constructor(e,n){this.tier="native";this.inner=e,n!==void 0&&(this.fallbackReason=n)}async detect(e,n,r){let i;try{i=await this.inner.detect(e)}catch{return null}let a=i.map(l=>l.boundingBox),o=-1;a.forEach((l,d)=>{let f=a[o];(f===void 0||l.width*l.height>f.width*f.height)&&(o=d)});let s=i[o];if(s===void 0)return null;let c=gr(s.landmarks),u={box:{x:s.boundingBox.x,y:s.boundingBox.y,width:s.boundingBox.width,height:s.boundingBox.height},...c!==void 0?{eyes:c}:{},score:1,extraFaces:z(a,o)};return q(u,e,n,r)}destroy(){}};function gr(t){if(t===void 0)return;let e=t.filter(i=>i.type==="eye").map(i=>i.locations[0]).filter(i=>i!==void 0),[n,r]=e;if(!(n===void 0||r===void 0))return n.x<=r.x?{left:n,right:r}:{left:r,right:n}}var Tt=.25;function z(t,e){let n=t[e],r=n===void 0?0:n.width*n.height;if(!(r>0))return 0;let i=0;return t.forEach((a,o)=>{o!==e&&a.width*a.height>=Tt*r&&(i+=1)}),i}var St="/models-v3",xt=["native","blaze"],D=class extends Error{constructor(e){super(`no detector tier available (${e})`),this.name="DetectorLadderError",this.fallbackReason=e}};function A(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 n=typeof e.width=="number"?e.width:0,r=typeof e.height=="number"?e.height:0;return{width:n,height:r}}function q(t,e,n,r){let i=A(e),a=i.width>0?n/i.width:1,o=i.height>0?r/i.height:1,s=c=>({x:c.x*a,y:c.y*o});return{box:{x:t.box.x*a,y:t.box.y*o,width:t.box.width*a,height:t.box.height*o},...t.eyes!==void 0?{eyes:{left:s(t.eyes.left),right:s(t.eyes.right)}}:{},...t.nose!==void 0?{nose:s(t.nose)}:{},score:t.score,...t.extraFaces!==void 0?{extraFaces:t.extraFaces}:{}}}function br(t){return t instanceof Error?t.message:String(t)}async function I(t){let e=t.preferred??xt,n=[];for(let r of e){if(r==="native"){let i=await Et();if(i.ok)return new oe(i.instance,Ie(n));n.push(`native:${i.reason}`);continue}try{return await yr(ae.create(t.v3AssetBaseUrl??St,Ie(n)),t.blazeInitTimeoutMs??Mt)}catch(i){n.push(i instanceof se?"blaze:blaze_init_timeout":`blaze:${br(i)}`)}}throw new D(Ie(n)??"no_tier_available")}function Ie(t){return t.length>0?t.join("; "):void 0}var se=class extends Error{};function yr(t,e){return new Promise((n,r)=>{let i=setTimeout(()=>{r(new se(`init exceeded ${e}ms`)),t.then(a=>a.destroy(),()=>{})},e);t.then(a=>{clearTimeout(i),n(a)},a=>{clearTimeout(i),r(a)})})}var Bi=180,X=[100,190],vr=64;function Ct(t,e){return .299*(t[e]??0)+.587*(t[e+1]??0)+.114*(t[e+2]??0)}function ce(t){let{data:e,width:n,height:r}=t,i=n*r;if(i===0)return 0;let a=0;for(let o=0;o<i;o+=1)a+=Ct(e,o*4);return a/i}function ue(t){let{data:e,width:n,height:r}=t;if(n<3||r<3)return 0;let i=new Float32Array(n*r);for(let l=0;l<i.length;l+=1)i[l]=Ct(e,l*4);let a=0,o=0,s=0;for(let l=1;l<r-1;l+=1)for(let d=1;d<n-1;d+=1){let f=l*n+d,h=(i[f-n]??0)+(i[f-1]??0)+(i[f+1]??0)+(i[f+n]??0)-4*(i[f]??0);a+=h,o+=h*h,s+=1}if(s===0)return 0;let c=a/s,u=o/s-c*c;return Math.min(1,Math.max(0,u)/180)}function Oe(t){let e=ce(t),[n,r]=X,i=e<n?n-e:e>r?e-r:0;return Math.max(0,1-i/vr)}var Rt=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}),O=t=>Math.min(1,Math.max(0,t)),P=class{constructor(e={}){this.p=0;this.lastTickAt=null;this.lastCenter=null;this.velocityEma=0;this.qWindow=[];this.lastSizeDirection="ideal";this.t={...Rt,...e}}reset(){this.p=0,this.lastTickAt=null,this.lastCenter=null,this.velocityEma=0,this.qWindow=[],this.lastSizeDirection="ideal"}tick(e){let{observation:n,quality:r,timestampMs:i}=e,a=this.lastTickAt===null?0:Math.max(0,(i-this.lastTickAt)/1e3);this.lastTickAt=i;let o={presence:0,single:1,centering:0,size:0,pose:0,sharpness:O(r.sharpness),exposure:O(r.exposure),motion:1};if(n!==null){o.presence=1,o.single=(n.extraFaces??0)>0?0:1;let l=this.geometryOf(n,e);o.centering=l.centering,o.size=l.size,o.pose=l.pose,o.motion=this.motionOf(l.center,l.iod,i)}else this.lastCenter=null,this.velocityEma=0;let s=Math.min(o.presence,o.single,o.centering,o.size,o.pose,o.sharpness,o.exposure,o.motion);this.p=O(this.p+(s>=this.t.Q_GOOD?this.t.RISE_PER_S*s:-this.t.FALL_PER_S*(1-s))*a),this.qWindow.push({at:i,q:s}),this.qWindow=this.qWindow.filter(l=>l.at>=i-this.t.READY_WINDOW_MS);let c=this.qWindow.map(l=>l.q);if(c.length>=3){let l=Math.min(...c),d=c.indexOf(l);c=c.filter((f,h)=>h!==d)}let u=this.p>=1&&c.every(l=>l>=this.t.Q_GOOD);return{at:i,q:s,p:this.p,factors:o,guidanceKey:this.guidanceOf(o,r,s),ready:u,accepted:s>=this.t.Q_GOOD}}geometryOf(e,n){let{box:r,eyes:i}=e,a={x:n.frameWidth/2,y:n.frameHeight/2},o=Math.min(n.frameWidth,n.frameHeight),s=i!==void 0?{x:(i.left.x+i.right.x)/2,y:(i.left.y+i.right.y)/2}:{x:r.x+r.width/2,y:r.y+r.height/2-this.t.BOX_EYE_OFFSET_FACTOR*r.height},c=i!==void 0?Math.hypot(i.right.x-i.left.x,i.right.y-i.left.y):this.t.IOD_BOX_PROXY_FACTOR*r.width,u=Math.hypot(s.x-a.x,s.y-a.y),l=c<=0?0:1-O(u/(this.t.CENTER_FALLOFF_IOD_MULTIPLE*c)),d=o>0?c/o:0;this.lastSizeDirection=d<this.t.SIZE_IDEAL_MIN?"far":d>this.t.SIZE_IDEAL_MAX?"close":"ideal";let f;d<this.t.SIZE_HARD_MIN||d>this.t.SIZE_HARD_MAX?f=0:d<this.t.SIZE_IDEAL_MIN?f=(d-this.t.SIZE_HARD_MIN)/(this.t.SIZE_IDEAL_MIN-this.t.SIZE_HARD_MIN):d>this.t.SIZE_IDEAL_MAX?f=(this.t.SIZE_HARD_MAX-d)/(this.t.SIZE_HARD_MAX-this.t.SIZE_IDEAL_MAX):f=1;let h=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;h=1-O(p/this.t.ROLL_MAX_DEG)}return{center:s,iod:c,centering:l,size:f,pose:h}}motionOf(e,n,r){let i=this.lastCenter;if(this.lastCenter={...e,at:r},i===null||n<=0)return 1;let a=(r-i.at)/1e3;if(a<=0)return 1;let o=Math.hypot(e.x-i.x,e.y-i.y)/n/a;o<=this.t.MOTION_DEADBAND_IOD_PER_S&&(o=0);let s=1-Math.exp(-a/this.t.MOTION_TAU_S);return this.velocityEma=s*o+(1-s)*this.velocityEma,1-O(this.velocityEma/this.t.MOTION_VELOCITY_IOD_PER_S)}guidanceOf(e,n,r){if(e.presence<=0)return"fcv3.no_face";if(e.single<=0)return"fcv3.one_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(n);if(e.sharpness<this.t.GUIDE_SHARPNESS)return"fcv3.steady_camera";if(e.motion<this.t.GUIDE_MOTION)return"fcv3.hold_still";if(r<this.t.Q_GOOD){let i=[["size",this.sizeGuidance()],["centering","fcv3.center_face"],["pose","fcv3.straighten"],["exposure",this.exposureGuidance(n)],["sharpness","fcv3.steady_camera"],["motion","fcv3.hold_still"]],a=i[0];for(let o of i)e[o[0]]<e[a[0]]&&(a=o);return a[1]}return"fcv3.hold_still"}sizeGuidance(){return this.lastSizeDirection==="far"?"fcv3.come_closer":"fcv3.move_back"}exposureGuidance(e){let n=(X[0]+X[1])/2;return e.meanLuma<n?"fcv3.more_light":"fcv3.too_bright"}};var _t=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"})}),kr=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 Fe(){let t=typeof navigator>"u"?void 0:navigator,e=!1;try{e=typeof WebAssembly<"u"&&WebAssembly.validate(kr)}catch{e=!1}return{cores:t?.hardwareConcurrency??2,memGB:t?.deviceMemory??null,simd:e}}function Le(t){let e=t.memGB??4;return t.cores<4||e<3?"LOW":t.cores>=8&&e>=6?"HIGH":"MID"}var Pe=["LOW","MID","HIGH"],Y=class{constructor(e){this.samples=[];this.adjusted=!1;this.current=e}get deviceClass(){return this.current}get profile(){return _t[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 n=this.samples.reduce((r,i)=>r+i,0)/this.samples.length;if(n>70)this.current="LOW";else if(n<25){let r=Pe.indexOf(this.current);this.current=Pe[Math.min(Pe.length-1,r+1)]??this.current}return this.current}};var Z=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 n=()=>{this.running&&(this.frameCallbackId=e.requestVideoFrameCallback?.(()=>{this.frameCallbackId=null,this.now()-this.lastRunAt>=this.periodMs&&this.tick(),n()}))};n();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((n,r)=>n+r,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 At="0.1.0-rc.39";var wr=/FBAN|FBAV|FB_IAB|FBIOS|MessengerForiOS|Instagram|WhatsApp|musical_ly|BytedanceWebview|TikTok|Snapchat|\bLine\/|LinkedInApp|Pinterest|MicroMessenger|; wv\)/i;function Dt(t){let e=t??(typeof navigator>"u"?"":String(navigator.userAgent??""));return wr.test(e)}var Xt="sekyro.did",Kr=1e4,jt=()=>globalThis.process?.versions?.node,Yt;function Zt(){let t=globalThis.crypto;try{if(typeof t?.randomUUID=="function")return t.randomUUID()}catch{}try{if(typeof t?.getRandomValues=="function"){let e=t.getRandomValues(new Uint8Array(16));return Array.from(e,n=>n.toString(16).padStart(2,"0")).join("")}}catch{}}function zr(){try{let t=localStorage.getItem(Xt);if(t)return t;let e=Zt();return e!==void 0&&localStorage.setItem(Xt,e),e}catch{return Yt??(Yt=Zt()),Yt}}async function qr(){let t=globalThis.crypto?.subtle;if(!t)return"";let e=navigator,n=JSON.stringify([e.userAgent,e.platform,e.hardwareConcurrency??null,e.deviceMemory??null,e.maxTouchPoints??0,screen.width,screen.height,screen.colorDepth,globalThis.devicePixelRatio??1,Intl.DateTimeFormat().resolvedOptions().timeZone,e.languages?.join(",")??e.language]),r=await t.digest("SHA-256",new TextEncoder().encode(n));return Array.from(new Uint8Array(r),i=>i.toString(16).padStart(2,"0")).join("").slice(0,32)}function Xr(){try{let t=Number(navigator.maxTouchPoints);return Number.isFinite(t)&&t>=0?{touch:Math.min(64,Math.trunc(t))}:{}}catch{return{}}}function Yr(t){let e=new TextEncoder().encode(t),n="";for(let r of e)n+=String.fromCharCode(r);return btoa(n).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function Zr(t){let e,n,r,i,a,o,s=()=>o?.readyState==="live",c=()=>{a!==void 0||!globalThis.crypto?.subtle||jt()||s()||(a=Promise.race([Promise.resolve().then(()=>(qt(),zt)),new Promise(u=>setTimeout(u,Kr))]).then(u=>u?.computePrint(s)).then(u=>{u==="busy"?a=void 0:i=u}).catch(()=>{}))};return{timezone(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone?.slice(0,64)||void 0}catch{return}},noteCameraLabel(u){u&&(e=u.slice(0,128))},noteCamera(u){n=u},noteCameraTrack(u){o=u},async deviceHeader(){try{r??(r=qr().catch(()=>""));let u=[];navigator.webdriver&&u.push("webdriver"),/HeadlessChrome/.test(navigator.userAgent)&&u.push("headless");let l=await r,d=zr(),f={v:1,platform:"web",sdk:t.sdk.slice(0,64),caps:["session_proof"],rampAtArm:!0,ids:[...d?[{kind:"web_local",value:d.slice(0,128)}]:[],...l?[{kind:"web_fp",value:l}]:[]],screen:{w:screen.width,h:screen.height,dpr:globalThis.devicePixelRatio??1},...Xr(),...e?{cameraLabel:e}:{},...u.length?{signals:u}:{},...i?{print:{v:2,...i,...n?{camera:n}:{}}}:{},...Dt()?{inApp:!0}:{}},h=Yr(JSON.stringify(f));return c(),h}catch{return}},printReady(){return a??Promise.resolve()}}}var Ke=Symbol.for("sekyro.web.clientContext"),ze=globalThis,qe=ze[Ke]??(ze[Ke]=Zr({sdk:`@sekyro/web@${At}`}));function $t(t){try{let e=t.getVideoTracks?.()[0];if(e){if(qe.noteCameraLabel(e.label),qe.noteCameraTrack(e),jt())return;Promise.resolve().then(()=>(We(),Bt)).then(n=>n.noteCameraTrait(e,qe)).catch(()=>{})}}catch{}}var Xe=Symbol.for("sekyro.web.cameraStreams"),Ye=globalThis,jr=Ye[Xe]??(Ye[Xe]=new Set);function Qt(t){try{jr.add(t)}catch{}}Ge();var $r=["obs","manycam","virtual","snap camera","xsplit","droidcam","iriun","camo","fake_device","fake-capture-device"],Qr=[/^(front|back|rear)( [a-z ]+)? camera$/i,/^caméra (avant|arrière)\b/i,/^cámara (frontal|trasera|delantera)\b/i,/^câmera (frontal|traseira)\b/i,/^(front|rück)kamera\b/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 Jr(t){let e=(t??"").trim().toLowerCase();return e.length===0?"unknown":$r.some(n=>e.includes(n))?"known_virtual":Qr.some(n=>n.test(e))?"platform":"unknown"}function Jt(t){if(typeof t!="function")return!1;try{return/\{\s*\[native code\]\s*\}\s*$/.test(Function.prototype.toString.call(t))}catch{return!1}}function ei(t=globalThis){return Jt(t.navigator?.mediaDevices?.getUserMedia)&&Jt(t.MediaStreamTrack?.prototype?.getSettings)}async function ti(t,e=globalThis){let n=e.crypto?.subtle?.digest;if(typeof n=="function")try{let r=new Uint8Array(await n.call(e.crypto?.subtle,"SHA-256",new TextEncoder().encode(t)));return Array.from(r.subarray(0,8),i=>i.toString(16).padStart(2,"0")).join("")}catch{return}}async function en(t,e=globalThis){let n={};try{n=typeof t.getSettings=="function"?t.getSettings()??{}:{}}catch{n={}}let r={};if((n.facingMode==="user"||n.facingMode==="environment"||n.facingMode==="left"||n.facingMode==="right")&&(r.facingMode=n.facingMode),typeof n.frameRate=="number"&&Number.isFinite(n.frameRate)&&(r.frameRate=n.frameRate),typeof n.width=="number"&&Number.isFinite(n.width)&&(r.width=n.width),typeof n.height=="number"&&Number.isFinite(n.height)&&(r.height=n.height),typeof n.deviceId=="string"&&n.deviceId.length>0){let a=await ti(n.deviceId,e);a!==void 0&&(r.deviceIdHash=a)}let i;try{i=t.label}catch{i=void 0}return{trackSettings:r,capabilitiesPresent:typeof t.getCapabilities=="function",labelClass:Jr(i),prototypesIntact:ei(e)}}var Ze=t=>Math.round(t*100)/100;function tn(t){let e=t,n=typeof e?.requestVideoFrameCallback=="function",r=null,i=null,a=0,o=0,s=0,c=0,u=0,l=0,d=()=>{!n||e?.requestVideoFrameCallback===void 0||(r=e.requestVideoFrameCallback((f,h)=>{if(r=null,!n)return;let p=h.presentationTime;if(i!==null){let m=p-i.presentationTimeMs;o+=1;let b=m-s;s+=b/o,c+=b*(m-s)}typeof h.captureTime=="number"&&Number.isFinite(h.captureTime)&&(u+=p-h.captureTime,l+=1),a+=1,i={mediaTimeMs:h.mediaTime*1e3,presentationTimeMs:p},d()}))};return d(),{latest:()=>i,stats:()=>({n:a,meanGapMs:o===0?0:Ze(s),stdGapMs:o<2?0:Ze(Math.sqrt(c/(o-1))),captureLatencyMs:l===0?null:Ze(u/l)}),stop:()=>{n&&(n=!1,r!==null&&e?.cancelVideoFrameCallback?.(r),r=null)}}}function nn(t,e,n){return{...t,rvfc:e,rampPainter:n}}var ni=["magenta","yellow","green","blue"];var ri=4,ii=4,de=t=>typeof t=="number"&&Number.isFinite(t);function me(t){if(typeof t!="object"||t===null)return!1;let e=t;if(typeof e.nonce!="string"||e.nonce.length===0||!Array.isArray(e.colours)||e.colours.length<1||e.colours.length>8||!e.colours.every(r=>ni.includes(r))||!Array.isArray(e.onsetsMs)||e.onsetsMs.length!==e.colours.length)return!1;let n=-1;for(let r of e.onsetsMs){if(!de(r)||r<0||r<=n)return!1;n=r}return!(!de(e.holdMs)||e.holdMs<=0||!de(e.endMs)||e.endMs<=n||!de(e.clipMs)||e.clipMs<e.endMs||e.clipMs>8e3)}function rn(t,e){return me(t)?Math.max(e,Math.ceil(t.clipMs)):e}function an(t,e){let n=e.now??(()=>performance.now()),r=me(t)?t:void 0,i=[],a=null,o=null,s=null,c=!1,u=null,l=p=>{u=p;try{e.paint(p)}catch{}},d=p=>{let m=e.frames?.()??null;return m!==null&&s!==null?m.mediaTimeMs+(p-m.presentationTimeMs)-s:p-(o??p)},f=(p,m,b=0)=>{if(c)return;let g=Math.max(0,p-d(n()));a=setTimeout(()=>{if(a=null,!c){if(b<ri&&d(n())<p-ii){f(p,m,b+1);return}m()}},g)},h=p=>{if(r===void 0)return;let m=r.endMs;if(p>=r.colours.length){f(m,()=>l(null));return}let b=r.onsetsMs[p],g=p+1<r.onsetsMs.length?r.onsetsMs[p+1]:m;f(b,()=>{let y=d(n());if(y>m){u!==null&&l(null);return}let w=r.colours[p];l(w);let k=i.length===0?0:i[i.length-1].tMs;i.push({tMs:Math.max(k,Math.round(y)),colour:w});let C=b+r.holdMs;if(C<g){f(C,()=>{if(d(n())>m){u!==null&&l(null);return}l("dark"),h(p+1)});return}h(p+1)})};return{started(p){if(r===void 0||c||o!==null)return;o=p;let m=e.frames?.()??null;s=m===null?null:m.mediaTimeMs+(p-m.presentationTimeMs),h(0)},stop(){c||(c=!0,a!==null&&clearTimeout(a),a=null,u!==null&&l(null))},report(){return r===void 0?void 0:{nonce:r.nonce,rendered:[...i]}}}}var ai=40;function V(t){if(t===null||typeof t!="object"&&typeof t!="function")return;let e;try{e=t.name}catch{return}return oi(e)}function oi(t){if(typeof t!="string")return;let e=t.replace(/[^A-Za-z]/g,"").slice(0,ai);return e===""?void 0:e}function on(t){let e=ve(t);if(e!=="generic")return e;switch(V(t)){case"AbortError":return"inuse";case"SecurityError":return"permission";default:return e}}function si(t){let e=t.toLowerCase();return e===""?"unknown":/front|facing front|user|selfie|face ?time/.test(e)?"front":/ultra|0\.5x|wide angle/.test(e)?"ultra":/tele|zoom|periscope|[2-9]x/.test(e)?"tele":/depth|tof|infrared|\bir\b|truedepth|lidar|macro|monochrome|mono\b/.test(e)?"depth":/dual|triple/.test(e)?"virtual":/back|rear|environment|facing back|arrière|خلفية/.test(e)?"main":"unknown"}function ci(t){let e=/camera2?\s*(\d+)/i.exec(t);return e?Number(e[1]):Number.POSITIVE_INFINITY}function sn(t){let e={main:0,virtual:1,ultra:9,tele:9,depth:9,front:9,unknown:9};return t.filter(n=>(n.kind===void 0||n.kind==="videoinput")&&n.deviceId!=="").map((n,r)=>({id:n.deviceId,kind:si(n.label),index:ci(n.label),i:r})).filter(n=>e[n.kind]<9).sort((n,r)=>e[n.kind]-e[r.kind]||n.index-r.index||n.i-r.i).map(n=>n.id)}var $=class extends Error{constructor(){super("the back camera could not be opened");this.name="BackCameraUnavailableError"}},cn=new Set(["NotAllowedError","PermissionDeniedError","SecurityError"]);function un(t){try{return String(t?.name??"")}catch{return""}}function je(t){if(t!==null)for(let e of t.getTracks())e.stop()}async function ln(t,e,n){let r=l=>({video:{...e,...l},audio:!1});if(t==="user")return n.getUserMedia(r({facingMode:"user"}));let i=l=>K(l)!=="user";try{let l=await n.getUserMedia(r({facingMode:{exact:"environment"}}));if(i(l))return l;je(l)}catch(l){if(cn.has(un(l)))throw l}let a=!1,o=async()=>{if(n.enumerateDevices===void 0||a)return null;let l;try{l=sn(await n.enumerateDevices()).slice(0,3)}catch{return null}a=l.length>0;for(let d of l){let f;try{f=await n.getUserMedia(r({deviceId:{exact:d}}))}catch(h){if(cn.has(un(h)))throw h;continue}if(i(f))return f;je(f)}return null},s=await o();if(s!==null)return s;let c=await n.getUserMedia(r({facingMode:"environment"}));if(i(c))return c;je(c);let u=await o();if(u!==null)return u;throw new $}var x=1;function dn(){return typeof OffscreenCanvas=="function"&&typeof createImageBitmap=="function"&&typeof Worker=="function"}function li(t,e={}){let n=e.createDetector??I,r=null;t.onmessage=i=>{let a=i.data;if(a.v!==x){a.bitmap?.close?.();return}if(a.type==="init"){n(a.options).then(o=>{r=o;let s={v:x,type:"ready",tier:o.tier,...o.fallbackReason!==void 0?{fallbackReason:o.fallbackReason}:{}};t.postMessage(s)});return}if(a.type==="detect"){let o=s=>{let c={v:x,type:"result",id:a.id,observation:s};t.postMessage(c),a.bitmap.close?.()};if(r===null){o(null);return}r.detect(a.bitmap,a.streamWidth,a.streamHeight).then(o,()=>o(null))}}}typeof self<"u"&&typeof self.importScripts=="function"&&li(self);var fe=class t{constructor(e,n){this.pending=new Map;this.nextId=1;this.worker=e,this.tier=n.tier,n.fallbackReason!==void 0&&(this.fallbackReason=n.fallbackReason),e.addEventListener("message",r=>{let i=r.data;if(i.v!==x||i.type!=="result")return;let a=this.pending.get(i.id);this.pending.delete(i.id),a?.(i.observation)})}static create(e,n,r=1e4){return new Promise((i,a)=>{let o=setTimeout(()=>{e.removeEventListener("message",s),e.terminate(),a(new Error(`worker detector not ready within ${r}ms`))},r),s=u=>{let l=u.data;l.v!==x||l.type!=="ready"||(clearTimeout(o),e.removeEventListener("message",s),i(new t(e,l)))};e.addEventListener("message",s);let c={v:x,type:"init",options:n};e.postMessage(c)})}async detect(e,n,r){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(o=>{this.pending.set(a,o);let s={v:x,type:"detect",id:a,bitmap:i,streamWidth:n,streamHeight:r};this.worker.postMessage(s,[i])})}destroy(){for(let e of this.pending.values())e(null);this.pending.clear(),this.worker.terminate()}};var di=["single","size","centering","pose","exposure","sharpness","motion"];function mn(t){if(t.accepted)return null;if(t.factors.presence<=0)return"no_face";let e="single";for(let n of di)t.factors[n]<t.factors[e]&&(e=n);return e}var U=class{constructor(){this.blocked={};this.acceptedMs=0;this.ticks=0;this.lastAt=null}record(e){let n=this.lastAt===null?0:Math.max(0,e.at-this.lastAt);this.lastAt=e.at,this.ticks+=1;let r=mn(e);if(r===null){this.acceptedMs+=n;return}let i=this.blocked[r]??{count:0,ms:0};i.count+=1,i.ms+=n,this.blocked[r]=i}summary(){let e={};for(let[n,r]of Object.entries(this.blocked))e[n]={count:r.count,ms:Math.round(r.ms)};return{blocked:e,acceptedMs:Math.round(this.acceptedMs),ticks:this.ticks}}};var Tn=1e3,he="fcv3.hold_upright",Sn=200,ge=4,xn=600,Cn=1e3,Mn={sharpness:1,exposure:1,meanLuma:128};function yi(t,e){return e.width=t.videoWidth,e.height=t.videoHeight,e.getContext("2d").drawImage(t,0,0),new Promise((n,r)=>e.toBlob(i=>i?n(i):r(new Error("empty-keyframe")),"image/jpeg",.92))}function vi(){return ie()==="phone"}var Qe=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.openEnvironment=null;this.ramp=null;this.snapshotCanvas=null;this.options=e,this.facing=e.facingMode??"user"}get state(){return this.stateValue}on(e,n){let r=this.handlers.get(e);return r||(r=new Set,this.handlers.set(e,r)),r.add(n),()=>r?.delete(n)}emit(e,n){for(let r of[...this.handlers.get(e)??[]])r(n)}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()}restart(e){this.facing=e,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:n}=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=(n.isPhone??vi)(),this.setState("preflight");let r=ke();if(r!=="OK"){this.fail(r==="INSECURE_CONTEXT"?"insecure":"unsupported",{phase:"preflight"});return}this.setState("acquiring");let i=n.getUserMedia??(u=>navigator.mediaDevices.getUserMedia(u)),a;this.cameraRequestedAt=this.now();try{let{facingMode:u,...l}=Ae(De(),this.facing).video;a=await ln(this.facing,l,{getUserMedia:i,enumerateDevices:Mi(n)})}catch(u){if(e!==this.attempt)return;if(u instanceof $){this.fail("backcamera",{phase:"acquiring",name:V(u)});return}this.fail(on(u),{phase:"acquiring",name:V(u)});return}if($t(a),Qt(a),e!==this.attempt){for(let u of a.getTracks())u.stop();return}this.stream=a;let o=a.getVideoTracks?.()[0];if(this.trackProvenance=o===void 0?null:en(o).catch(()=>null),this.openEnvironment=o===void 0?null:Lt(o).catch(()=>({})),this.facing=K(a)??this.facing,n.video.srcObject=a,await n.video.play().catch(()=>{}),e!==this.attempt)return;if(this.cameraReadyAt=this.now(),this.detector===null){let u={v3AssetBaseUrl:n.v3AssetBaseUrl},l=n.createDetector??(n.createWorker!==void 0&&dn()?async()=>{try{return await fe.create(n.createWorker(),u)}catch{return I(u)}}:()=>I(u)),d;try{d=await l()}catch(f){e===this.attempt&&this.fail("models",{phase:"models",name:V(f)},f instanceof D?f.fallbackReason:wi(f));return}if(e!==this.attempt){d.destroy();return}this.detector=d,this.options.telemetry?.({type:"detector",tier:d.tier,fallbackReason:d.fallbackReason})}let s=Fe(),c=n.deviceClass??Le(s);this.profiler=new Y(c),this.options.telemetry?.({type:"profile",staticClass:c,activeClass:this.profiler.deviceClass,simd:s.simd}),this.gate=new P(n.thresholds??{}),this.blockStats=new U,this.lastGateSnapshotAt=this.now(),n.rankKeyframes?.()&&Promise.resolve().then(()=>(wn(),kn)).then(u=>$e=u,()=>{}),this.setState("positioning"),this.positioningStartedAt=this.now(),this.startScheduler(e)}get animations(){return this.profiler?.profile.animations??"full"}startScheduler(e){let n=this.profiler;if(n===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 r=new Z({cadenceHz:n.profile.cadenceHz,video:this.options.video,now:this.options.now,run:()=>this.detectTick(e)});this.scheduler=r,r.start()}async detectTick(e){let{detector:n,gate:r,profiler:i}=this,a=this.options.video;if(e!==this.attempt||n===null||r===null||i===null||this.fired||a.videoWidth===0)return;if(this.isLandscape()){this.holdUpright(e);return}let o=i.deviceClass,s=this.now(),c=this.options.makeSnapshot?.(a,i.profile.inputWidth)??this.defaultSnapshot(a,i.profile.inputWidth),u=null;try{u=await n.detect(c,a.videoWidth,a.videoHeight)}catch{u=null}if(e!==this.attempt||this.fired)return;i.record(this.now()-s),i.deviceClass!==o&&this.startScheduler(e);let l=u===null?Mn:this.options.measureQuality?.(a,u.box)??this.defaultQuality(a,u.box),d=r.tick({timestampMs:this.now(),observation:u,quality:l,frameWidth:a.videoWidth,frameHeight:a.videoHeight});d.accepted&&this.faceAcquiredAt===null&&(this.faceAcquiredAt=d.at),this.blockStats?.record(d),!d.ready&&d.at-this.lastGateSnapshotAt>=Tn&&(this.lastGateSnapshotAt=d.at,this.reportGate(!1)),this.emit("checks",{engine:"v3",progress:d.p,q:d.q,factors:d.factors,attempt:e}),d.guidanceKey!==this.lastGuidanceKey&&(this.lastGuidanceKey=d.guidanceKey,this.emit("guidance",{key:d.guidanceKey})),d.ready&&this.stateValue==="positioning"&&(this.fired=!0,this.captureCompleteAt=d.at,this.fire(e))}async fire(e){let{options:n}=this,r=this.scheduler;r?.stop(),this.reportGate(!0);let i=r?.stats()??{degradeCount:0,meanDetectMs:0},a=[...this.carriedMeans,...i.meanDetectMs>0?[i.meanDetectMs]:[]];n.telemetry?.({type:"fired",timeToGateMs:this.now()-this.positioningStartedAt,degradeCount:this.carriedDegrade+i.degradeCount,meanDetectMs:a.length===0?0:a.reduce((M,v)=>M+v,0)/a.length});let o=n.mode??"clip",s=n.rankKeyframes?.()&&$e?$e.default(this,e).catch(()=>this.collectKeyframes(e)):this.collectKeyframes(e);if(o==="photo"){let M=this.watchRotation(e,null),v=await s;if(M(),e!==this.attempt)return;if(v===null){this.fail("generic",{phase:"keyframes"});return}let be=await this.provenance({n:0,meanGapMs:0,stdGapMs:0,captureLatencyMs:null},!1);if(e!==this.attempt)return;this.finishCapture({keyframe:v.blob,previewDataUrl:v.previewDataUrl,...be});return}this.setState("recording");let c=this.stream;if(c===null){this.fail("generic",{phase:"recording"});return}let u=n.screenRamp?.(),l=me(u),d=null;s.then(M=>{d=M},()=>{});let f=()=>{e===this.attempt&&d!==null&&this.emit("frozen",{previewDataUrl:d.previewDataUrl})},h=rn(u,ne),p=null,m,b=0;try{let M=this.recordTake(e,c,u,h,void 0).then(T=>T,T=>({failed:T})),[v,be]=await Promise.all([M,s]);if(m=be,e!==this.attempt)return;if("failed"in v){if(v.failed.kind==="cliptoolarge")throw v.failed;Me(v.failed.requestedMimeType??"")}else p=v,re(v.clip,h)?v.clip.stats===null&&Me(v.clip.requestedMimeType??""):f();if(p===null||re(p.clip,h)){b=1,n.telemetry?.({type:"clip_retake",reason:p===null?"error":p.clip.stats===null?"unreadable":"short"});let T=null;try{T=await this.recordTake(e,c,u,h,f)}catch(Rn){if(p===null)throw Rn}if(e!==this.attempt)return;T!==null&&(p===null||_e(T.clip,p.clip))&&(p=T),T===null&&f()}}catch(M){if(e!==this.attempt)return;let v=M.kind;this.fail(v==="cliptoolarge"?"cliptoolarge":"recorder",{phase:"recording",name:V(M)});return}if(p===null){this.fail("recorder",{phase:"recording"});return}let{clip:g,rvfc:y,report:w,watched:k}=p;if(H(g.blob)){this.fail("cliptoolarge",{phase:"recording"});return}if(m===null){this.fail("generic",{phase:"keyframes"});return}let C=await this.provenance(y,l,k);e===this.attempt&&this.finishCapture({clip:g.blob,clipMimeType:g.mimeType,...g.stats?{clipStats:g.stats}:{},clipRetakes:b,keyframe:m.blob,previewDataUrl:m.previewDataUrl,...w!==void 0&&w.rendered.length>0?{screenRamp:w}:{},...C})}async recordTake(e,n,r,i,a){let o=this.options.createRecorder?.()??new W({now:()=>this.now()}),s=tn(this.options.video),c=an(r,{paint:f=>{(f===null||e===this.attempt)&&this.emit("ramp",{colour:f})},now:()=>this.now(),frames:s.latest});this.ramp=c;let u=()=>{s.stop(),c.stop(),this.ramp===c&&(this.ramp=null)},l=this.watchRotation(e,o),d=Nt();try{return{clip:await o.record(n,a,()=>c.started(this.now()),i,s),rvfc:s.stats(),report:c.report(),watched:d.stop()}}finally{d.stop(),l(),u()}}async provenance(e,n,r={}){let i=this.trackProvenance;if(i===null)return{};let a,o=new Promise(l=>{a=setTimeout(()=>l(null),Cn)}),s=await Promise.race([i,o]),c=s===null?null:await Promise.race([this.openEnvironment,o]);if(clearTimeout(a),s===null)return{};let u={...c,...r};return{provenance:{...nn(s,e,n),...Object.keys(u).length>0?{env:u}:{}}}}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,single:1,centering:0,size:0,pose:0,sharpness:0,exposure:0,motion:0},attempt:e}),this.lastGuidanceKey!==he&&(this.lastGuidanceKey=he,this.emit("guidance",{key:he}))}watchRotation(e,n){if(!this.uprightGuard)return()=>{};let r=this.options.video,i=()=>{if(e!==this.attempt||n!==null&&this.stateValue!=="recording"){s();return}r.videoWidth>0&&this.isLandscape()&&(s(),this.abortRecording(e,n))},a=setInterval(i,Sn);r.addEventListener?.("resize",i);let o=!1;function s(){o||(o=!0,clearInterval(a),r.removeEventListener?.("resize",i))}return s}abortRecording(e,n){if(e!==this.attempt)return;this.attempt+=1;let r=this.attempt;try{n?.stop()}catch{}this.ramp?.stop(),this.ramp=null,this.fired=!1,this.captureCompleteAt=null,this.gate=new P(this.options.thresholds??{}),this.blockStats=new U,this.lastGateSnapshotAt=this.now(),this.lastGuidanceKey=null,this.setState("positioning"),this.positioningStartedAt=this.now(),this.holdUpright(r),this.startScheduler(r)}async collectKeyframes(e){let n=this.options.captureKeyframe??(a=>this.defaultKeyframe(a)),r=xn/(ge-1),i=null;for(let a=0;a<ge;a+=1){if(e!==this.attempt)return i;try{let o=await n(this.options.video);(i===null||o.sharpness>i.sharpness)&&(i=o)}catch{}a<ge-1&&await ki(r)}return i}finishCapture(e){this.stopTracks(),this.setState("captured");let n=this.captureTiming();this.emit("artifacts",n===void 0?e:{...e,timing:n})}captureTiming(){let e={},n=(r,i,a)=>{i!==null&&a!==null&&(e[r]=Math.max(0,Math.round(a-i)))};return n("cameraReadyMs",this.cameraRequestedAt,this.cameraReadyAt),n("faceAcquireMs",this.cameraReadyAt,this.faceAcquiredAt),n("captureMs",this.faceAcquiredAt,this.captureCompleteAt),Object.keys(e).length>0?e:void 0}async defaultKeyframe(e){let n=document.createElement("canvas"),r=await(this.facing==="user"?we:yi)(e,n),i=n.toDataURL("image/jpeg",.92);return{blob:r,previewDataUrl:i,sharpness:this.centerSharpness(e)}}defaultSnapshot(e,n){try{let r=this.snapshotCanvas??document.createElement("canvas"),i=n/Math.max(1,e.videoWidth),a=Math.max(1,Math.round(e.videoWidth*i)),o=Math.max(1,Math.round(e.videoHeight*i)),s=r.getContext("2d");return s===null?e:(r.width!==a&&(r.width=a),r.height!==o&&(r.height=o),s.drawImage(e,0,0,a,o),this.snapshotCanvas=r,r)}catch{return e}}defaultQuality(e,n){let r=En(e,n,96);return r===null?Mn:{sharpness:ue(r),exposure:Oe(r),meanLuma:ce(r)}}centerSharpness(e){let n=A(e),r=En(e,{x:n.width*.25,y:n.height*.25,width:n.width*.5,height:n.height*.5},96);return r===null?0:ue(r)}teardownAttempt(){this.scheduler?.stop(),this.scheduler=null,this.reportGate(!0),this.gate=null,this.ramp?.stop(),this.ramp=null,this.stopTracks()}reportGate(e){let n=this.blockStats,r=this.profiler;if(n===null||r===null)return;let i=n.summary();e&&(this.blockStats=null),i.ticks!==0&&this.options.telemetry?.({type:"gate",final:e,activeClass:r.deviceClass,cadenceHz:r.profile.cadenceHz,...i})}stopTracks(){if(this.stream!==null){for(let e of this.stream.getTracks())e.stop();this.stream=null}}fail(e,n,r){this.scheduler?.stop(),this.reportGate(!0),this.stopTracks(),this.setState("error"),this.options.telemetry?.({type:"error",kind:e,fallbackReason:r});let{phase:i,name:a}=n;this.emit("error",{kind:e,retryable:e!=="insecure"&&e!=="unsupported",detail:a===void 0?{phase:i}:{phase:i,name:a}})}setState(e){this.stateValue=e,this.emit("statechange",{state:e})}now(){return this.options.now?.()??performance.now()}},$e;function ki(t){return new Promise(e=>setTimeout(e,t))}function wi(t){return t instanceof Error?t.message:String(t)}function En(t,e,n){try{let r=document.createElement("canvas"),i=n/Math.max(1,e.width);r.width=Math.max(1,Math.round(e.width*i)),r.height=Math.max(1,Math.round(e.height*i));let a=r.getContext("2d");return a===null?null:(a.drawImage(t,e.x,e.y,e.width,e.height,0,0,r.width,r.height),a.getImageData(0,0,r.width,r.height))}catch{return null}}function Mi(t){if(t.enumerateDevices!==void 0)return t.enumerateDevices;if(t.getUserMedia===void 0&&!(typeof navigator>"u"||typeof navigator.mediaDevices?.enumerateDevices!="function"))return()=>navigator.mediaDevices.enumerateDevices()}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,ENCODER_TAIL_MS,EXPOSURE_BAND,FRAME_POLL_MS,FaceGateV3,GATE_SNAPSHOT_MS,GateBlockStats,HOLD_UPRIGHT_KEY,INSPECT_WAIT_MS,IN_CIRCLE_FACTOR,KEYFRAME_CANDIDATES,KEYFRAME_WINDOW_MS,MAX_CLIP_BYTES,MAX_OVERRUN_MS,MIME_CANDIDATES,PHONE_MAX_SHORT_SIDE,PROVENANCE_WAIT_MS,SECOND_FACE_AREA_RATIO,SHARP_REF,SHORT_CLIP_TOLERANCE_MS,STOP_GRACE_MS,TIMESLICE_MS,UPRIGHT_WATCH_MS,V3_GATE_DEFAULTS,VIDEO_BPS,betterTake,blockReasonOf,buildCaptureConstraints,buildLivenessV2FormData,cameraPreflight,captureMirroredKeyframe,classifyDevice,countExtraFaces,createDetector,detectFormFactor,detectIsMobile,errorCopy,exposure,extForMime,intrinsicSize,isClipTooLarge,isMediaRecorderSupported,mapGetUserMediaError,meanLuma,needsRetake,pickMimeType,probeDevice,sharpness,toStreamPixels,trackFacingMode,uiCopy});
|
package/dist/core/index.d.cts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { C as CameraErrorKind } from '../capture-session-v3-
|
|
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 ClipRecorderOptions, o as ClipResult, D as DEFAULT_CLIP_MIME, p as DEVICE_PROFILES, q as DeviceClass, r as DeviceProbe, s as DeviceProfile, t as DeviceProfiler, E as ENCODER_TAIL_MS, u as EscalationClipArtifact, v as EscalationHook, F as FRAME_POLL_MS, w as FaceGateV3, x as FrameClock, G as GATE_SNAPSHOT_MS, y as GateBlockEntry, z as GateBlockReason, A as GateBlockStats, B as GateBlockSummary, H as GateChecks, I as HOLD_UPRIGHT_KEY, J as INSPECT_WAIT_MS, K as KEYFRAME_CANDIDATES, L as KEYFRAME_WINDOW_MS, M as MAX_CLIP_BYTES, N as MAX_OVERRUN_MS, O as MIME_CANDIDATES, P as PROVENANCE_WAIT_MS, S as SHORT_CLIP_TOLERANCE_MS, Q as STOP_GRACE_MS, T as TIMESLICE_MS, U as UPRIGHT_WATCH_MS, V as V3ChecksPayload, R as V3GateFactor, W as V3GateQuality, X as V3GateThresholds, Y as V3GateTick, Z as V3GateTickInput, _ as V3TelemetryEvent, $ as V3_GATE_DEFAULTS, a0 as VIDEO_BPS, a1 as betterTake, a2 as blockReasonOf, a3 as buildLivenessV2FormData, a4 as cameraPreflight, a5 as classifyDevice, a6 as extForMime, a7 as isClipTooLarge, a8 as isMediaRecorderSupported, a9 as mapGetUserMediaError, aa as needsRetake, ab as pickMimeType, ac as probeDevice } from '../capture-session-v3-
|
|
1
|
+
import { C as CameraErrorKind } from '../capture-session-v3-DjWqEJG0.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 ClipRecorderOptions, o as ClipResult, D as DEFAULT_CLIP_MIME, p as DEVICE_PROFILES, q as DeviceClass, r as DeviceProbe, s as DeviceProfile, t as DeviceProfiler, E as ENCODER_TAIL_MS, u as EscalationClipArtifact, v as EscalationHook, F as FRAME_POLL_MS, w as FaceGateV3, x as FrameClock, G as GATE_SNAPSHOT_MS, y as GateBlockEntry, z as GateBlockReason, A as GateBlockStats, B as GateBlockSummary, H as GateChecks, I as HOLD_UPRIGHT_KEY, J as INSPECT_WAIT_MS, K as KEYFRAME_CANDIDATES, L as KEYFRAME_WINDOW_MS, M as MAX_CLIP_BYTES, N as MAX_OVERRUN_MS, O as MIME_CANDIDATES, P as PROVENANCE_WAIT_MS, S as SHORT_CLIP_TOLERANCE_MS, Q as STOP_GRACE_MS, T as TIMESLICE_MS, U as UPRIGHT_WATCH_MS, V as V3ChecksPayload, R as V3GateFactor, W as V3GateQuality, X as V3GateThresholds, Y as V3GateTick, Z as V3GateTickInput, _ as V3TelemetryEvent, $ as V3_GATE_DEFAULTS, a0 as VIDEO_BPS, a1 as betterTake, a2 as blockReasonOf, a3 as buildLivenessV2FormData, a4 as cameraPreflight, a5 as classifyDevice, a6 as extForMime, a7 as isClipTooLarge, a8 as isMediaRecorderSupported, a9 as mapGetUserMediaError, aa as needsRetake, ab as pickMimeType, ac as probeDevice } from '../capture-session-v3-DjWqEJG0.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-CVqpMNGA.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, S as SECOND_FACE_AREA_RATIO, d as countExtraFaces, e as createDetector, i as intrinsicSize, t as toStreamPixels } from '../detect-worker-CHqsPJoM.cjs';
|
|
5
|
-
import '../types-
|
|
5
|
+
import '../types-BUnFqG97.cjs';
|
|
6
6
|
|
|
7
7
|
declare function captureMirroredKeyframe(video: HTMLVideoElement, canvas: HTMLCanvasElement, quality?: number): Promise<Blob>;
|
|
8
8
|
|
package/dist/core/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { C as CameraErrorKind } from '../capture-session-v3-
|
|
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 ClipRecorderOptions, o as ClipResult, D as DEFAULT_CLIP_MIME, p as DEVICE_PROFILES, q as DeviceClass, r as DeviceProbe, s as DeviceProfile, t as DeviceProfiler, E as ENCODER_TAIL_MS, u as EscalationClipArtifact, v as EscalationHook, F as FRAME_POLL_MS, w as FaceGateV3, x as FrameClock, G as GATE_SNAPSHOT_MS, y as GateBlockEntry, z as GateBlockReason, A as GateBlockStats, B as GateBlockSummary, H as GateChecks, I as HOLD_UPRIGHT_KEY, J as INSPECT_WAIT_MS, K as KEYFRAME_CANDIDATES, L as KEYFRAME_WINDOW_MS, M as MAX_CLIP_BYTES, N as MAX_OVERRUN_MS, O as MIME_CANDIDATES, P as PROVENANCE_WAIT_MS, S as SHORT_CLIP_TOLERANCE_MS, Q as STOP_GRACE_MS, T as TIMESLICE_MS, U as UPRIGHT_WATCH_MS, V as V3ChecksPayload, R as V3GateFactor, W as V3GateQuality, X as V3GateThresholds, Y as V3GateTick, Z as V3GateTickInput, _ as V3TelemetryEvent, $ as V3_GATE_DEFAULTS, a0 as VIDEO_BPS, a1 as betterTake, a2 as blockReasonOf, a3 as buildLivenessV2FormData, a4 as cameraPreflight, a5 as classifyDevice, a6 as extForMime, a7 as isClipTooLarge, a8 as isMediaRecorderSupported, a9 as mapGetUserMediaError, aa as needsRetake, ab as pickMimeType, ac as probeDevice } from '../capture-session-v3-
|
|
1
|
+
import { C as CameraErrorKind } from '../capture-session-v3-BnRN9WuV.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 ClipRecorderOptions, o as ClipResult, D as DEFAULT_CLIP_MIME, p as DEVICE_PROFILES, q as DeviceClass, r as DeviceProbe, s as DeviceProfile, t as DeviceProfiler, E as ENCODER_TAIL_MS, u as EscalationClipArtifact, v as EscalationHook, F as FRAME_POLL_MS, w as FaceGateV3, x as FrameClock, G as GATE_SNAPSHOT_MS, y as GateBlockEntry, z as GateBlockReason, A as GateBlockStats, B as GateBlockSummary, H as GateChecks, I as HOLD_UPRIGHT_KEY, J as INSPECT_WAIT_MS, K as KEYFRAME_CANDIDATES, L as KEYFRAME_WINDOW_MS, M as MAX_CLIP_BYTES, N as MAX_OVERRUN_MS, O as MIME_CANDIDATES, P as PROVENANCE_WAIT_MS, S as SHORT_CLIP_TOLERANCE_MS, Q as STOP_GRACE_MS, T as TIMESLICE_MS, U as UPRIGHT_WATCH_MS, V as V3ChecksPayload, R as V3GateFactor, W as V3GateQuality, X as V3GateThresholds, Y as V3GateTick, Z as V3GateTickInput, _ as V3TelemetryEvent, $ as V3_GATE_DEFAULTS, a0 as VIDEO_BPS, a1 as betterTake, a2 as blockReasonOf, a3 as buildLivenessV2FormData, a4 as cameraPreflight, a5 as classifyDevice, a6 as extForMime, a7 as isClipTooLarge, a8 as isMediaRecorderSupported, a9 as mapGetUserMediaError, aa as needsRetake, ab as pickMimeType, ac as probeDevice } from '../capture-session-v3-BnRN9WuV.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-CVqpMNGA.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, S as SECOND_FACE_AREA_RATIO, d as countExtraFaces, e as createDetector, i as intrinsicSize, t as toStreamPixels } from '../detect-worker-CHqsPJoM.js';
|
|
5
|
-
import '../types-
|
|
5
|
+
import '../types-BUnFqG97.js';
|
|
6
6
|
|
|
7
7
|
declare function captureMirroredKeyframe(video: HTMLVideoElement, canvas: HTMLCanvasElement, quality?: number): Promise<Blob>;
|
|
8
8
|
|
package/dist/core/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{A as te,b as x,c as k,d as z,e as C,f as L,g as T,h as E,i as R,j as h,k as b,l as A,m as H,n as K,o as P,p as I,q as Y,r as Z,s as _,t as $,u as ee,v as re,w as oe,x as ne,y as ae,z as se}from"../chunk-
|
|
1
|
+
import{A as te,b as x,c as k,d as z,e as C,f as L,g as T,h as E,i as R,j as h,k as b,l as A,m as H,n as K,o as P,p as I,q as Y,r as Z,s as _,t as $,u as ee,v as re,w as oe,x as ne,y as ae,z as se}from"../chunk-7FGOUBAN.js";import"../chunk-SX7TUC3V.js";import"../chunk-W357WDNU.js";import{a as q,b as w,c as D,d as G}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-CPUECYAJ.js";import{a as J,b as M,c as Q,d as W,e as X}from"../chunk-FPXL63KZ.js";import"../chunk-U5TL63CG.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-TSA6GHUG.js";import"../chunk-HMOOVRKA.js";import{a as S,b as B,c as F,d as N,e as O,f as U,g as V,h as j}from"../chunk-FSSMUAKC.js";var ie={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."}},ce={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,te as CaptureSessionV3,h as ClipError,K as ClipRecorder,u as DEFAULT_CLIP_MIME,N as DEFAULT_TIER_ORDER,F as DEFAULT_V3_ASSET_BASE_URL,q as DEVICE_PROFILES,I as DetectScheduler,O as DetectorLadderError,G as DeviceProfiler,L as ENCODER_TAIL_MS,M as EXPOSURE_BAND,E as FRAME_POLL_MS,Z as FaceGateV3,ee as GATE_SNAPSHOT_MS,$ as GateBlockStats,re as HOLD_UPRIGHT_KEY,R as INSPECT_WAIT_MS,t as IN_CIRCLE_FACTOR,ne as KEYFRAME_CANDIDATES,ae as KEYFRAME_WINDOW_MS,l as MAX_CLIP_BYTES,T as MAX_OVERRUN_MS,c as MIME_CANDIDATES,r as PHONE_MAX_SHORT_SIDE,se as PROVENANCE_WAIT_MS,S as SECOND_FACE_AREA_RATIO,J as SHARP_REF,b as SHORT_CLIP_TOLERANCE_MS,z as STOP_GRACE_MS,k as TIMESLICE_MS,oe as UPRIGHT_WATCH_MS,Y as V3_GATE_DEFAULTS,C as VIDEO_BPS,H as betterTake,_ as blockReasonOf,e as buildCaptureConstraints,g as buildLivenessV2FormData,m as cameraPreflight,P as captureMirroredKeyframe,D as classifyDevice,B as countExtraFaces,j as createDetector,o as detectFormFactor,n as detectIsMobile,ie as errorCopy,X as exposure,y as extForMime,U as intrinsicSize,v as isClipTooLarge,d as isMediaRecorderSupported,f as mapGetUserMediaError,Q as meanLuma,A as needsRetake,p as pickMimeType,w as probeDevice,W as sharpness,V as toStreamPixels,a as trackFacingMode,ce as uiCopy};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{u as a,v as b,w as c,x as d,y as e}from"./chunk-WI7GAUCH.js";import"./chunk-MQHTFHSN.js";import"./chunk-BRLQIJYF.js";import"./chunk-P5OIQXVM.js";import"./chunk-7QZWBDI5.js";import"./chunk-7FGOUBAN.js";import"./chunk-SX7TUC3V.js";import"./chunk-W357WDNU.js";import"./chunk-POIQGEZM.js";import"./chunk-CPUECYAJ.js";import"./chunk-FPXL63KZ.js";import"./chunk-U5TL63CG.js";import"./chunk-TSA6GHUG.js";import"./chunk-HMOOVRKA.js";import"./chunk-FSSMUAKC.js";import"./chunk-WNBEOK5Q.js";export{b as BARCODE_BUDGET_MS,a as SAME_FACE_MAX_DROPS,d as createDocumentCapture,e as createDocumentCaptureInternal,c as warmDocumentCapture};
|