@sekyro/elements 0.1.0-rc.25 → 0.1.0-rc.26
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 +9 -0
- package/dist/cdn/chunks/capture-session-doc-GMJHALX2-ARC4FOZR.js +1 -0
- package/dist/cdn/chunks/{chunk-53PI7QVO.js → chunk-3YI7B3GE.js} +1 -1
- package/dist/cdn/chunks/{chunk-W5QMFEZY.js → chunk-4LUARCPT.js} +1 -1
- package/dist/cdn/chunks/chunk-5EMGDVL5.js +1 -0
- package/dist/cdn/chunks/{chunk-AXCBMN2S.js → chunk-5MZT6V5W.js} +2 -2
- package/dist/cdn/chunks/chunk-6RG5RG7Q.js +1 -0
- package/dist/cdn/chunks/{chunk-43I6I3SU.js → chunk-BLRCS3XB.js} +1 -1
- package/dist/cdn/chunks/{chunk-IHKI3APK.js → chunk-CTQAORJP.js} +1 -1
- package/dist/cdn/chunks/chunk-DFGFFVZV.js +3 -0
- package/dist/cdn/chunks/{chunk-B5QW2GSC.js → chunk-EP25HO5D.js} +1 -1
- package/dist/cdn/chunks/{chunk-23W5VB46.js → chunk-FD543JGD.js} +1 -1
- package/dist/cdn/chunks/{chunk-4EWD6VW3.js → chunk-H6JCZ7X4.js} +1 -1
- package/dist/cdn/chunks/{chunk-SS7SVE6O.js → chunk-HW2VL6K5.js} +1 -1
- package/dist/cdn/chunks/{chunk-5ZUDZLHN.js → chunk-IYEBJ2ZV.js} +1 -1
- package/dist/cdn/chunks/{chunk-XYXBZEKH.js → chunk-NEULQ5JV.js} +1 -1
- package/dist/cdn/chunks/{chunk-34QKBDWM.js → chunk-RTFEIA57.js} +1 -1
- package/dist/cdn/chunks/{chunk-UALTP6H4.js → chunk-S6RK76P5.js} +1 -1
- package/dist/cdn/chunks/{chunk-YR7GTH7M.js → chunk-SA3JLP6W.js} +1 -1
- package/dist/cdn/chunks/{chunk-E7S6A26U.js → chunk-SX74G3GE.js} +1 -1
- package/dist/cdn/chunks/chunk-T5ZB7FLK.js +1 -0
- package/dist/cdn/chunks/{chunk-YWAPDHEW.js → chunk-TD4WLFWX.js} +1 -1
- package/dist/cdn/chunks/chunk-VP7GHHEK.js +1 -0
- package/dist/cdn/chunks/{chunk-PPERVFSD.js → chunk-WQA4EGMT.js} +1 -1
- package/dist/cdn/chunks/{create-document-capture-TTMHZP7R-YI3GL7MF.js → create-document-capture-AFUM53J2-RHFJOKSG.js} +1 -1
- package/dist/cdn/chunks/document-capture-view-C7G76Z5Z-47KQFEKS.js +1 -0
- package/dist/cdn/chunks/{eid-view-INQTMVDU-FRHHODOC.js → eid-view-I7JWDMJ4-NLMOCQTP.js} +1 -1
- package/dist/cdn/chunks/{email-otp-view-OO535PQT-6N2IPXEG.js → email-otp-view-WVQSVKW4-UAEN7WJP.js} +1 -1
- package/dist/cdn/chunks/flow-views-OQMWGGG3-HT4WAHJ2.js +1 -0
- package/dist/cdn/chunks/{form-view-LJLYP54G-N2BB5ZXR.js → form-view-GA2TGOJL-UO5HMK5Q.js} +1 -1
- package/dist/cdn/chunks/overlay-de-OC3UDZ6R-Y4PL6NJC.js +1 -0
- package/dist/cdn/chunks/overlay-es-SYZKGHMP-WWIOE7ES.js +1 -0
- package/dist/cdn/chunks/overlay-pt-CTVAN7HT-ESRXIQKH.js +1 -0
- package/dist/cdn/chunks/{plan-runner-FW3EAJCC-H4N5NEL4.js → plan-runner-B75OACFY-IKQWQZK2.js} +1 -1
- package/dist/cdn/chunks/{portrait-capture-view-N36CKIFR-JIO6P6XN.js → portrait-capture-view-O6M7N32A-BNCHYVMO.js} +1 -1
- package/dist/cdn/chunks/{portrait-review-view-OG23OEMA-E4JD5Q5S.js → portrait-review-view-TI34GIXN-EFM6O45B.js} +1 -1
- package/dist/cdn/chunks/{proof-of-address-view-CHM5JRHI-PUHZCNXH.js → proof-of-address-view-BTCXADNY-LJ5HXDRA.js} +1 -1
- package/dist/cdn/define.js +1 -1
- package/dist/cdn/index.js +1 -1
- package/dist/{chunk-RXILZ6JM.js → chunk-2IOKT6MW.js} +1 -1
- package/dist/{chunk-2PJRIGH2.js → chunk-2UKKUNLM.js} +1 -1
- package/dist/{chunk-SD4A47RM.js → chunk-3AB3BDSC.js} +1 -1
- package/dist/{chunk-MLH4M6JP.js → chunk-AIQISJXO.js} +1 -1
- package/dist/chunk-BBMKEHE2.js +1 -0
- package/dist/{chunk-GDADEN5C.js → chunk-EHI6A6IC.js} +2 -2
- package/dist/{chunk-JW4QXADM.js → chunk-JHCWF5SC.js} +1 -1
- package/dist/{chunk-2QEYDBI7.js → chunk-K2HD46BJ.js} +1 -1
- package/dist/{chunk-FFRJKCZK.js → chunk-K7FZ3SWO.js} +1 -1
- package/dist/{chunk-RJVZHRDP.js → chunk-MGZU2EY6.js} +1 -1
- package/dist/{chunk-KEN7JBVG.js → chunk-NZB3FFMJ.js} +1 -1
- package/dist/{chunk-JAEOFYLJ.js → chunk-RUGMWI6S.js} +1 -1
- package/dist/{chunk-RAF7Z7I3.js → chunk-SAH7S6QH.js} +1 -1
- package/dist/{chunk-OEZKZQC4.js → chunk-SBLYDU3J.js} +1 -1
- package/dist/define.cjs +5 -5
- package/dist/define.js +1 -1
- package/dist/document-capture-view-C7G76Z5Z-B37X2GAQ.js +1 -0
- package/dist/{eid-view-INQTMVDU-H7KHUN3L.js → eid-view-I7JWDMJ4-KZ5TCWLJ.js} +1 -1
- package/dist/{email-otp-view-OO535PQT-6EYUU43N.js → email-otp-view-WVQSVKW4-PC7XV2PN.js} +1 -1
- package/dist/flow-views-OQMWGGG3-5QDNKNYP.js +1 -0
- package/dist/{form-view-LJLYP54G-OUW66I62.js → form-view-GA2TGOJL-Y6LZSZ57.js} +1 -1
- package/dist/index.cjs +5 -5
- package/dist/index.d.cts +4 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +1 -1
- package/dist/overlay-de-OC3UDZ6R-2XA2EF5R.js +1 -0
- package/dist/overlay-es-SYZKGHMP-WPBHUSMV.js +1 -0
- package/dist/overlay-pt-CTVAN7HT-GQFAZU5I.js +1 -0
- package/dist/{portrait-capture-view-N36CKIFR-S2H37PI5.js → portrait-capture-view-O6M7N32A-DITR3Z7I.js} +1 -1
- package/dist/{portrait-review-view-OG23OEMA-MO3FN432.js → portrait-review-view-TI34GIXN-XA4FB3UB.js} +1 -1
- package/dist/{proof-of-address-view-CHM5JRHI-U6ARAGX7.js → proof-of-address-view-BTCXADNY-RLSTG7XR.js} +1 -1
- package/dist/styles.css +2 -0
- package/package.json +2 -2
- package/sbom.cdx.json +4 -4
- package/dist/cdn/chunks/capture-session-doc-56O6IQ3D-FTWOAELH.js +0 -1
- package/dist/cdn/chunks/chunk-4VFGV3VA.js +0 -1
- package/dist/cdn/chunks/chunk-F6BL7IXJ.js +0 -1
- package/dist/cdn/chunks/chunk-PNQ5TDY5.js +0 -1
- package/dist/cdn/chunks/chunk-VD2BADU2.js +0 -1
- package/dist/cdn/chunks/chunk-VQSFTT4B.js +0 -3
- package/dist/cdn/chunks/document-capture-view-5EYETVEI-UMC6FOKY.js +0 -1
- package/dist/cdn/chunks/flow-views-EW2KEEFU-7LTB52QC.js +0 -1
- package/dist/cdn/chunks/overlay-de-VGC75M5R-ZUC7ZPRY.js +0 -1
- package/dist/cdn/chunks/overlay-es-CSXBWVAG-IQMHKRYH.js +0 -1
- package/dist/cdn/chunks/overlay-pt-RGTYSSOJ-EH2IJ6QI.js +0 -1
- package/dist/chunk-NMUB5C2E.js +0 -1
- package/dist/document-capture-view-5EYETVEI-ZQ5RAN4Y.js +0 -1
- package/dist/flow-views-EW2KEEFU-H7LOLIEJ.js +0 -1
- package/dist/overlay-de-VGC75M5R-C6XYWRT5.js +0 -1
- package/dist/overlay-es-CSXBWVAG-MSMVW5KX.js +0 -1
- package/dist/overlay-pt-RGTYSSOJ-QA5FJP3U.js +0 -1
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{A as ot,B as st,C as lt,H as ve,I as oe,J as ut,K as ct,L as dt,a as G,b as We,c as Je,f as Ye,g as Qe,h as Xe,i as et,j as he,k as tt,m as K,o as N,p as L,q as J,r as ae,s as D,t as ye,v as nt,w as rt,x as it,y as at}from"./chunk-NEULQ5JV.js";import{g as ft}from"./chunk-EP25HO5D.js";import{b as Ze}from"./chunk-BLRCS3XB.js";import{b as ze,c as me,e as pt}from"./chunk-6MYG4HWP.js";import{a as t}from"./chunk-4FHWXBOB.js";function Vt(n){let a=n.now??(()=>Date.now()),f=n.setTimer??((w,u)=>setTimeout(w,u)),p=n.clearTimer??(w=>clearTimeout(w)),A=null,M=!1,g=!1,x=!1,B=0,P=null,C=t(()=>{P!==null&&p(P),P=null},"_"),T=t(()=>{let w=n.armRamp;w===void 0||M||g||x||a()<B||(M=!0,w().catch(()=>{}).then(u=>{if(M=!1,!x){if(u===void 0){B=a()+2e3;return}if(u.challenge===void 0){g=!0;return}A={challenge:u.challenge,expiresAt:u.expiresAt},C(),P=f(()=>{P=null,!x&&A!==null&&n.waiting()&&T()},Math.max(1e3,u.expiresAt-a()-2e4))}}))},"x");return{arm(){A!==null&&A.expiresAt-a()>2e4||T()},take(){let w=A;return A=null,C(),w!==null&&w.expiresAt-a()>=12e3?w.challenge:void 0},stop(){x=!0,A=null,C()}}}t(Vt,"Rt");function $t(n){return n.idNumberBound??n.nniBound}t($t,"he");function mt(n){return n===void 0?void 0:n.idNumberFromDocument??n.nniFromDocument}t(mt,"re");var yt="https://api.sekyro.ai",Ht=5e3,zt=24e4,vt=3e4,Zt=15e4,gt=9e4;function ht(n,a){return n==="portrait_icao"||n==="poa"||n==="doc_ocr"&&a.source==="upload"?gt:vt}t(ht,"Pt");var Wt=25*6e4,Jt=30*6e4,Nn=20*6e4,Yt=1,Qt=3e3,Xt=1500,en=10;function ge(n){return n instanceof Error&&n.name==="ChallengeError"&&n.code||"challenge_failed"}t(ge,"Ae");var _e=new Set(["aborted","embedder_opaque","site_key_rejected","clock_wrong"]);function tn(n){return new Promise(a=>setTimeout(a,n))}t(tn,"Rn");function nn(){let n=globalThis.crypto;if(n!==void 0&&typeof n.randomUUID=="function")return n.randomUUID();let a=new Uint8Array(16);if(n!==void 0&&typeof n.getRandomValues=="function")n.getRandomValues(a);else for(let p=0;p<16;p+=1)a[p]=Math.floor(Math.random()*256);a[6]=(a[6]??0)&15|64,a[8]=(a[8]??0)&63|128;let f=[...a].map(p=>p.toString(16).padStart(2,"0")).join("");return`${f.slice(0,8)}-${f.slice(8,12)}-${f.slice(12,16)}-${f.slice(16,20)}-${f.slice(20)}`}t(nn,"xn");function rn(n){return an(n,{})}t(rn,"jo");function an(n,a){let f=n.apiOrigin??yt,p=n.autoRetry??!0,A=n.rearm??"auto",M=a.client??new Je({apiOrigin:f,sessionToken:n.clientToken,fetch:n.fetch,locale:n.locale}),g=new Proxy(M,{get(e,r){if(r==="submitCheck")return Rt;let i=Reflect.get(e,r,e);return typeof i=="function"?i.bind(e):i}}),x=a.sleep??tn,B=a.uuid??nn,P=a.getChallengeToken??((e,r)=>import("./challenge-frame-LWDSKM5K-J3CNO3XT.js").then(i=>i.executeChallenge({frameUrl:e.url,siteKey:e.siteKey,action:"liveness",subject:r.subject,signal:r.signal,...n.locale!==void 0?{locale:n.locale}:{},...r.onInteractive!==void 0?{onInteractive:r.onInteractive}:{},...r.onRuns!==void 0?{onRuns:r.onRuns}:{}}))),C=pt(),T=null,w=null,u=!1,Ae=new AbortController,h=null,Y=null,Q=null,X=t(()=>Q??ut(h),"ae"),ee=t(()=>ct(oe(h),X()),"ue"),I=t(e=>{h=e,N(e)||It(e),C.emit("view",e),T?.onView(e)},"T"),b=t(()=>h!==null?Promise.resolve(h):(Y??(Y=g.getSession().then(e=>(I(e),e)).finally(()=>{Y=null})),Y),"M"),O=t(async()=>{let e=await g.getSession();return I(e),e},"V"),se=t(async(e,r)=>{e.plan!==void 0?I(e):await O()},"ge"),te=null,Me=t(async e=>{let r=await b();if(e||!r.consentRecorded){let i=await g.recordConsent(n.locale);i.plan!==void 0?I(i):h!==null&&I({...h,consentRecorded:!0})}z()&&re(r)},"Te"),E=t(e=>e?.force===!0?Me(!0):(te??(te=Me(!1).finally(()=>{te=null})),te),"L"),le={client:g,ensureConsent:t(e=>E(e),"ensureConsent"),sleep:x,uuid:B,...a.random!==void 0?{random:a.random}:{},onBusy:t(e=>{u||C.emit("busy",e)},"onBusy")},Ce=!1,Se=null,ue=t(e=>{if(e.status==="verified"||e.status==="not_verified"||e.status==="review"){if(Ce)return;Ce=!0}Se=JSON.stringify(e),C.emit("result",e)},"ke"),At=t(e=>{Se!==JSON.stringify(e)&&ue(e)},"$t"),xe=t(async e=>{let r=h;e&&(r=await O().catch(()=>h));let i=r===null?null:K(r);return i!==null&&!u&&C.emit("method",i),i!==null},"Fe"),ce=null,Te=!1,Ie=!1,Oe=t(()=>ot(le,(e,r)=>e.submitCheck("population_registry",{},{idempotencyKey:r})),"Ue"),Re=t(e=>$t(e)===!0||mt(J(e,"population_registry"))===!0,"Be"),Mt=t(async()=>{try{let e=await b();if(N(e)||K(e)!==null||L(e)?.checkType!=="population_registry")return;if(!Re(e)&&mt(J(e,"population_registry"))===void 0&&(e=await O()),!Re(e)){Ie=!0;return}await E(),await se(await Oe(),"population_registry");let r=h===null?void 0:J(h,"population_registry");if(r?.state==="input_required"&&r.reason==="registry_unavailable"&&tt(r)>0){if(await x(Ht),u)return;await se(await Oe(),"population_registry")}}catch(e){if(e instanceof G&&(e.code==="check_not_active"||e.code==="step_not_on_path")){await O().catch(()=>{});return}Te=!0;return}h!==null&&N(h)&&ue(ye(h,{autoRetry:p}))},"Qt"),Ee=t(()=>(ce??(ce=Mt()),ce),"qe"),S=a.now??Date.now,U=null,V,Ct=0,de=t((e,r)=>`${e.url}
|
|
2
|
+
${e.siteKey}
|
|
3
|
+
${r}`,"be"),Ne=0,$=0,ne,F=0,H=0,St=0,Pe=t(()=>{u||C.emit("browserCheck",{pending:H>0,...F>0?{interactive:!0}:{}})},"Ke"),pe=t((e,r)=>{Ne+=1;let i=S(),o=!1,s=!1,d=t(m=>{if(o===m)return;o=m,m&&(s=!0);let k=F>0;F=Math.max(0,F+(m?1:-1)),k!==F>0&&Pe()},"S");$+=1;let c=0,v=t(m=>{$+=c===0?Math.max(0,m-1):m,c+=m},"A"),l=P(e,{signal:Ae.signal,subject:r,onInteractive:d,onRuns:v}),y={key:de(e,r),at:i,token:l};return l.then(()=>{y.issuedAt=S(),d(!1),s&&!u&&q({check:"attestation",kind:"generic",engineKind:"interactive_passed",attempt:St++,challengeMs:S()-i,interactive:!0,checks:Math.min(50,$)})},m=>{let k=ge(m);if(y.failed=k,d(!1),u||k==="aborted")return;let{detail:ie,readyMs:Kt}=m;q({check:"attestation",kind:"unavailable",engineKind:k,attempt:Ct++,challengeMs:S()-i,readyMs:Kt,detail:ie,inApp:Ze(),...s?{interactive:!0}:{},checks:Math.min(50,$)})}),l.catch(()=>{}),y},"Ce"),Le=t((e,r)=>e!==null&&e.key===r&&(e.issuedAt===void 0||S()-e.issuedAt<zt),"je"),re=t((e,r={})=>{let i=e?.challenge??null;if(e===null||i===null||u)return;let o=ae(e.sessionId),s=U;(r.replaceFailed===!0&&s?.failed!==void 0&&!_e.has(s.failed)||!Le(s,de(i,o)))&&(U=pe(i,o))},"de"),De=t(e=>{let r=H>0;H=Math.max(0,H+e),r!==H>0&&Pe()},"Ye"),xt=t(async e=>{De(1);let r;try{let i=e.token.then(o=>({token:o}),o=>({error:ge(o)}));for(;;){let o=await Promise.race([i,new Promise(s=>{r=setTimeout(()=>s(void 0),Zt)})]);if(u)return{error:"aborted"};if(!(o===void 0&&F>0))return o}}finally{clearTimeout(r),De(-1)}},"Jt"),je=t(async(e,r,i)=>{let o=de(e,r),s=U;U=null;let d=Le(s,o)&&(s.failed===void 0||_e.has(s.failed))?s:pe(e,r),c=d===s?0:1,v,l=new Promise(y=>{v=setTimeout(()=>y("late"),i)});try{for(;;){let y=await Promise.race([d.token.then(m=>({token:m}),m=>({error:ge(m)})),l]);if(y==="late"){let m=u?void 0:await xt(d);return m===void 0?(!u&&U===null&&(U=d),{error:"timeout"}):("token"in m&&(ne=Math.max(0,Math.round((d.issuedAt??S())-d.at))),m)}if("token"in y)return ne=Math.max(0,Math.round((d.issuedAt??S())-d.at)),y;if(u||_e.has(y.error)||c>=Yt||c>0&&await Promise.race([x(Qt*c),l])==="late")return y;if(u)return{error:"aborted"};c+=1,d=pe(e,r)}}finally{clearTimeout(v)}},"We"),R=null,Tt=t(e=>R===null||S()-R>=e,"zt"),z=t(()=>Tt(Wt),"Z"),Ue=!1,Fe=null,It=t(e=>{let r=e.challenge?.provenMs;R===null&&typeof r=="number"&&r>0&&(R=S()-Math.max(0,Jt-r)),Ue||(Ue=!0,z()&&re(e));let i=L(e),o=i!==void 0&&(i.checkType==="phone_otp"||i.checkType==="email_otp")?`${i.checkType}:${he(e).indexOf(i)}`:null;o!==null&&o!==Fe&&(Fe=o,re(e))},"en"),Ot=t(e=>{let r=e.attestation;return typeof r?.turnstileToken=="string"&&r.turnstileToken.length>0},"tn"),qe=new Map,Ge=t(async e=>{let r=await b(),i=r.challenge;if(i==null||r.simulation!==void 0)return;let o=await je(i,ae(r.sessionId),e);if(!("token"in o))throw at(o.error);return o.token},"Xe"),Rt=t(async(e,r,i={})=>{let o=r;if("attestation"in o)try{let l=await M.submitCheck(e,r,i);return Ot(o)&&(R=S()),l}catch(l){throw l instanceof G&&l.code==="attestation_invalid"&&(R=null),l}let s=(e==="phone_otp"||e==="email_otp")&&o.action!=="verify",d=i.idempotencyKey,c=d!==void 0?qe.get(d):void 0;c===void 0&&(s||z())&&(c=await Ge(ht(e,o)),d!==void 0&&c!==void 0&&qe.set(d,c));let v=t((l,y)=>l!==void 0?{...y,browserCheckToken:l}:y,"A");try{let l=await M.submitCheck(e,r,v(c,i));return c!==void 0&&(R=S()),l}catch(l){if(!(l instanceof G)||l.code!=="attestation_invalid"||(R=null,c!==void 0))throw l;let y=await Ge(ht(e,o)),m=d!==void 0?{...i,idempotencyKey:B()}:i,k=await M.submitCheck(e,r,v(y,m));return y!==void 0&&(R=S()),k}},"nn"),Ke=t(async(e={})=>{if(V=void 0,e.always!==!0&&!z())return{};let r=await b(),i=r.challenge;if(i==null)return{};let o=e.always===!0?gt:vt,s=await je(i,ae(r.sessionId),o);if("token"in s)return{channel:"hosted_web",turnstileToken:s.token};if(V=s.error,r.simulation!==void 0&&e.always!==!0)return{channel:"hosted_web"};throw new it(s.error)},"Je"),Et=t(()=>V,"on"),Nt=t(()=>({checks:Math.min(50,Math.max(Ne,$)),...ne!==void 0?{challengeMs:Math.min(6e5,ne)}:{}}),"rn"),q=t(e=>{if(u)return;let r=g.reportCaptureIssue;if(r===void 0)return;let i=e.formFactor;try{i??(i=ze())}catch{}try{Promise.resolve(r.call(g,{...e,...i!==void 0?{formFactor:i}:{}})).catch(()=>{})}catch{}},"j"),_=null,Z=null,Be=new WeakMap,Ve=Promise.resolve(),W=0,Pt=t(async()=>{let e=await b();for(let r=0;r<en&&!u&&!N(e)&&L(e)===void 0&&he(e).some(i=>i.state==="processing")&&(await x(Xt),!u);r+=1)e=await O();return e},"sn"),Lt=t(async(e,r,i)=>{let{capture:o}=e,s=t(()=>u,"m"),d=t(()=>e.alive&&e.attempt===i,"S"),c=t(l=>{d()&&o.setFlowState(l)},"g"),v=t(l=>{if(!s()&&(l.status==="unavailable"&&l.reasonCode!==void 0&&!Ye(l.reasonCode)&&q({check:"liveness",kind:"unavailable",phase:"upload",engineKind:l.reasonCode,attempt:Math.max(0,e.issues.value)}),ue(l),!!d())){if(l.status==="retry"&&A==="auto"){o.handle.retry();return}o.setFlowState("done")}},"A");if(r.degraded==="NO_RECORDER"){let l=h?.sessionId??(await b().catch(()=>null))?.sessionId??"";v(D(l,"no_recorder"));return}c("uploading");try{if(await Ee(),s())return;let l=await b(),y;if(!N(l)&&K(l)!==null){await xe(!1),v(D(l.sessionId,"method_required"));return}if(!N(l)){if(L(l)?.checkType==="population_registry"){v(D(l.sessionId,Ie?"nni_unbound":Te?"network":"registry_unavailable"));return}if(await E(),s())return;y=h??l;let m=await st({...le,artifacts:r,getAttestation:Ke,attestationError:Et,attestationFacts:Nt,clipKeys:{get:t(()=>Be.get(r)??null,"get"),set:t(k=>{Be.set(r,k)},"set")},getView:t(()=>h??l,"getView"),refreshView:O,applySubmit:se,onPhase:c,isCancelled:s,onKeyframePromoted:t(k=>{w=k},"onKeyframePromoted")});if(s())return;if(m.kind==="unavailable"){m.reason==="attestation"&&(Z={bound:e,artifacts:r});let k=D(l.sessionId,m.reason),ie=m.reason==="attestation"?V:void 0;v(ie!==void 0?{...k,attestationError:ie}:k);return}if(m.kind==="resync"&&await O(),h!==null&&K(h)!==null){await xe(!1),v(D(l.sessionId,"method_required"));return}l=await Pt()}v(ye(l,{autoRetry:p,previous:y}))}catch{if(s())return;v(D(h?.sessionId??"","network"))}},"an"),$e=t((e,r)=>{let i=e.attempt;W>0&&e.alive&&e.capture.setFlowState("uploading"),W+=1,Ve=Ve.then(()=>Lt(e,r,i)).finally(()=>{W-=1,W===0&&T?.onChainIdle()}).catch(()=>{})},"tt"),He=t(e=>{_?.capture.handle.destroy(),_!==null&&(_.alive=!1,_.ramp.stop());let r=Vt({armRamp:typeof g.armRamp=="function"?()=>g.armRamp():void 0,waiting:t(()=>s.alive&&ee()==="self"&&(o.handle.state==="starting"||o.handle.state==="gating"),"waiting")}),i=Promise.resolve(),o=ft(e,T?.captureInternals?.(e)??a.capture,()=>h?.capture?.liveness?.keyframe?.rank===!0,ee,()=>r.take()??h?.capture?.liveness?.screenRamp,{session:t(()=>oe(h),"session"),onModeChange:t(c=>{Q=c},"onModeChange")}),s={capture:o,alive:!0,ramp:r,attempt:0,issues:Xe()};_=s,o.handle.on("error",c=>{q(Qe("liveness",c,s.issues.value))}),o.handle.on("state",c=>{if(s.issues.note(c),c==="starting"){s.attempt+=1,Z?.bound===s&&(Z=null),z()&&re(h,{replaceFailed:!0});let v=h===null?void 0:L(h)?.checkType;i=v==="liveness"||v==="face_match"?E().catch(()=>{}):Promise.resolve()}(c==="starting"||c==="gating")&&ee()==="self"&&i.then(()=>{s.alive&&r.arm()})}),o.handle.on("captured",c=>{Promise.resolve().then(()=>$e(s,c))});let d=o.handle;return{get state(){return d.state},get captureMode(){return d.captureMode},get facingMode(){return d.facingMode},on:t((c,v)=>d.on(c,v),"on"),start:t(async c=>{if(h===null&&await b().catch(()=>{}),!!s.alive)return d.start(c)},"start"),retry:t(()=>{let c=Z;if(c!==null&&c.bound===s&&s.alive){Z=null,$e(s,c.artifacts);return}d.retry()},"retry"),switchCamera:t(()=>d.switchCamera(),"switchCamera"),canSwitchCaptureMode:t(()=>d.canSwitchCaptureMode(),"canSwitchCaptureMode"),setCaptureMode:t(c=>d.setCaptureMode(c),"setCaptureMode"),destroy:t(()=>{s.alive=!1,r.stop(),_===s&&(_=null),d.destroy()},"destroy")}},"nt"),Dt=t(async()=>{if(u)return null;try{let e=await b();return u?null:K(e)}catch{return null}},"un"),jt=t(async()=>{if(u)return"self";try{let e=await b();if(u)return"self";let r=oe(e);return r==="choice"?X()??r:r}catch{return"self"}},"cn"),Ut=t(async()=>{if(u)return!1;try{let e=await b();return u||N(e)||me()?!1:ve(e,L(e))==="phone"||ve(e,J(e,"liveness"))==="phone"}catch{return!1}},"dn"),Ft=t(async()=>{if(u)return!1;try{let e=await b();return!u&&e.returning===!0}catch{return!1}},"ln"),qt=t(async e=>{let r=(await b()).plan?.choice,i=r?.options.find(s=>et[s.service]===e);if(!i)throw new RangeError(`method ${String(e)} is not offered`);let o=await g.choose(r.nodeId,i.id);u||I(o)},"pn"),fe=null,Gt=t(()=>(fe??(fe=import("./plan-runner-B75OACFY-IKQWQZK2.js").then(e=>{let r=e.createPlanRunner({runtime:le,currentView:t(()=>h,"currentView"),cameraMode:ee,captureModeSwitch:{pick:X,choose:t(i=>{Q=i},"choose")},ensureView:b,refreshView:O,ensureConsent:t(()=>E(),"ensureConsent"),liveness:He,stopLiveness:t(()=>{_!==null&&(_.alive=!1,_.ramp.stop(),_.capture.handle.destroy(),_=null)},"stopLiveness"),chainBusy:t(()=>W>0,"chainBusy"),destroyed:t(()=>u,"destroyed"),sleep:x,isMobile:me,now:a.now??Date.now,keptFaceKey:t(()=>w,"keptFaceKey"),setView:I,baseCapture:a.capture,emitStep:t(i=>{u||C.emit("step",i)},"emitStep"),emitResult:At,reportCaptureIssue:q,documentInternals:a.document,documentFacts:a.documentFacts,portraitInternals:a.portrait,livePhotoInternals:a.livePhoto,uploadInternals:a.upload,pageCameraInternals:a.pageCamera});return T=r,r})),fe),"fn");return{consent:t(()=>E(),"consent"),startRegistry:Ee,methodChoice:Dt,selectMethod:qt,reportCameraUnavailable:t(async e=>{await E();let r=g.reportCameraUnavailable;if(r===void 0)throw new TypeError("this client cannot report a missing camera");let i=await r.call(g,e).catch(o=>{if(o instanceof G&&o.code==="check_out_of_order")return g.getSession();throw o});u||I(i)},"reportCameraUnavailable"),reportCaptureIssue:q,testerGate:t(async e=>{let r=g.testerGate;if(r===void 0)throw new TypeError("this client cannot run the tester gate");let i=e.clip,o=We(e.clipMime??"");if(i===void 0||!rt.includes(o))throw new TypeError("the capture has no clip");await E();let s=await Ke({always:!0}),d=await nt(g,"clip",o,i.size,{engine:e.engine,durationMs:e.clipMs});await g.uploadToSpaces(d.uploadUrl,i,o);let{key:c}=await g.completeMedia(d.key),v=await r.call(g,{clipKey:c,attestation:s,captureChannel:e.captureChannel,capture:{...lt(e),attestationError:V}}),{bound:l,missReason:y,...m}=v;return u||(m.plan!==void 0?I(m):await O()),l===!0||y===void 0?{bound:l===!0}:{bound:!1,missReason:y}},"testerGate"),mobileRequired:Ut,captureMode:jt,chooseCaptureMode:t(e=>{Q=e},"chooseCaptureMode"),get captureChoice(){return X()},returning:Ft,liveness:He,run:t(async()=>{if(u)throw new Error("verification destroyed");return(await Gt()).run()},"run"),currentStep:t(()=>T?.current()??null,"currentStep"),voiceClips:t(async()=>{if(u)return null;try{let e=await b();return u?null:e.voice??null}catch{return null}},"voiceClips"),on:t((e,r)=>C.on(e,r),"on"),destroy:t(()=>{u=!0,Ae.abort(),T?.destroy(),_!==null&&(_.alive=!1,_.capture.handle.destroy(),_=null),C.clear()},"destroy")}}t(an,"Pn");var _t=["AD","AE","AF","AG","AI","AL","AM","AO","AQ","AR","AS","AT","AU","AW","AX","AZ","BA","BB","BD","BE","BF","BG","BH","BI","BJ","BL","BM","BN","BO","BQ","BR","BS","BT","BV","BW","BY","BZ","CA","CC","CD","CF","CG","CH","CI","CK","CL","CM","CN","CO","CR","CU","CV","CW","CX","CY","CZ","DE","DJ","DK","DM","DO","DZ","EC","EE","EG","EH","ER","ES","ET","FI","FJ","FK","FM","FO","FR","GA","GB","GD","GE","GF","GG","GH","GI","GL","GM","GN","GP","GQ","GR","GS","GT","GU","GW","GY","HK","HM","HN","HR","HT","HU","ID","IE","IL","IM","IN","IO","IQ","IR","IS","IT","JE","JM","JO","JP","KE","KG","KH","KI","KM","KN","KP","KR","KW","KY","KZ","LA","LB","LC","LI","LK","LR","LS","LT","LU","LV","LY","MA","MC","MD","ME","MF","MG","MH","MK","ML","MM","MN","MO","MP","MQ","MR","MS","MT","MU","MV","MW","MX","MY","MZ","NA","NC","NE","NF","NG","NI","NL","NO","NP","NR","NU","NZ","OM","PA","PE","PF","PG","PH","PK","PL","PM","PN","PR","PS","PT","PW","PY","QA","RE","RO","RS","RU","RW","SA","SB","SC","SD","SE","SG","SH","SI","SJ","SK","SL","SM","SN","SO","SR","SS","ST","SV","SX","SY","SZ","TC","TD","TF","TG","TH","TJ","TK","TL","TM","TN","TO","TR","TT","TV","TW","TZ","UA","UG","UM","US","UY","UZ","VA","VC","VE","VG","VI","VN","VU","WF","WS","XK","YE","YT","ZA","ZM","ZW"],bt=["carte_identite","passport","residence_permit","drivers_license"],on=["carte_identite","passport","residence_permit"];function ke(n,a){let f=n.byIssuer?.[a]??n.default;return bt.filter(p=>f==="*"?on.includes(p):f.includes(p))}t(ke,"En");function kt(n,a=_t){return[...new Set([...a,...Object.keys(n.byIssuer??{})])].filter(f=>ke(n,f).length>0).sort()}t(kt,"Qo");var j={fullNameMin:2,fullName:200,email:254,occupation:120,shortText:120,longText:1e3,addressLine:120,addressLines:4,city:80,postcode:16,number:1e12,dateMin:"1900-01-01",dateMax:"2100-12-31",remoteOptions:30,remoteFilterAbove:12,remoteOther:120,remoteValue:128};function sn(n,a){let f=be(a);return f===""?[...n]:n.filter(p=>be([p.title,p.label,p.description].filter(Boolean).join(" ")).includes(f))}t(sn,"Jo");function be(n){return n.normalize("NFKD").replace(/[\u0300-\u036f\u064b-\u065f\u0670\u0640]/g,"").toLowerCase().replace(/\s+/g," ").trim()}t(be,"vt");var Pn={remote_choice:j.remoteOther,full_name:j.fullName,occupation:j.occupation,email:j.email,short_text:j.shortText,long_text:j.longText},wt=Object.freeze({nni_invalid:"id_number_invalid",nni_not_found:"registry_record_not_found",nni_recheck:"id_number_recheck",document_nni_mismatch:"document_id_number_mismatch",nni_locked:"id_number_locked",nni_unbound:"id_number_unbound",missing_nni:"missing_id_number",registry_needs_nni_source:"registry_needs_id_number_source"}),Ln=new Map(Object.entries(wt)),Dn=new Map(Object.entries(wt).map(([n,a])=>[a,n]));function ln(n,a){let f=Object.keys(n.names??{});if(f.length===1){let A=n.names?.[f[0]],M=A?.[a]??A?.en;if(M!==void 0&&M!=="")return M}if(f.length>1)return;let p=n.nationalEid?.providerName;return p!==void 0&&p!==""?p:void 0}t(ln,"pr");var jn=10*1024*1024;function Ar(n){if(n==="permission")return"denied";if(n==="notfound"||n==="insecure"||n==="unsupported")return"no_camera"}t(Ar,"Se");var un=/^[A-Z0-9][A-Z0-9 -]{0,39}$/,cn=Object.freeze({normalize:t(n=>n.trim().toUpperCase().replace(/\s+/g," "),"normalize"),check:t(n=>un.test(n),"check"),registrySources:Object.freeze([]),describe:"number must be 1 to 40 letters, digits, spaces or hyphens"}),dn=/^[A-Z0-9]{4,20}$/,we=t(n=>n.trim().toUpperCase().replace(/[\s-]+/g,""),"m"),pn=Object.freeze({normalize:we,check:t(n=>dn.test(we(n)),"check"),registrySources:Object.freeze([]),describe:"number must be 4 to 20 letters or digits"});function fn(n){return typeof n=="string"&&/^\d{10}$/.test(n)&&Number(n)%97===1}t(fn,"Re");var mn={trim:t(n=>n.trim(),"trim"),upper_single_space:t(n=>n.trim().toUpperCase().replace(/\s+/g," "),"upper_single_space"),upper_no_space_or_hyphen:we},hn={mr_nni_mod97:t(n=>fn(n),"mr_nni_mod97")};function yn(n){let a=new RegExp(n.pattern,"u"),f=n.check===null?void 0:hn[n.check];return Object.freeze({normalize:mn[n.normalize],check:t(p=>a.test(p.trim())&&(f===void 0||f(p)),"check"),registrySources:Object.freeze([...n.registrySources]),describe:n.describe})}t(yn,"Me");var vn=Object.freeze(Object.fromEntries(Object.entries(dt).map(([n,a])=>[n,yn(a)])));function gn(n,a){return vn[`${n.toUpperCase()}:${a}`]??(a==="drivers_license"?pn:cn)}t(gn,"C");var Mr=Object.freeze({JPN:"JP",MRT:"MR"});function Cr(n){return gn("MR","national_id").check(n)}t(Cr,"Oe");function _n(n){let a="";for(let f of n){let p=f.codePointAt(0)??0;p>=1632&&p<=1641?a+=String(p-1632):p>=1776&&p<=1785?a+=String(p-1776):f!==" "&&f!=="-"&&f!==" "&&(a+=f)}return a}t(_n,"H");function Sr(n){return _n(n)}t(Sr,"De");var xr=ke,Tr=kt;var bn=t(()=>import("./create-document-capture-AFUM53J2-RHFJOKSG.js"),"E");function kn(){bn().then(n=>n.warmDocumentCapture()).catch(()=>{})}t(kn,"O");function Ir(){kn()}t(Ir,"nt");var wn=t(()=>import("./create-portrait-capture-5VGYZUOK-KTCFCHTN.js"),"D");function An(){wn().then(n=>n.warmPortraitCapture()).catch(()=>{})}t(An,"L");function Or(){An()}t(Or,"ut");export{rn as a,j as b,sn as c,ln as d,Ar as e,Cr as f,Sr as g,xr as h,Tr as i,Ir as j,Or as k};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{d as Re,e as Xe,f as Ze,g as Ve}from"./chunk-43I6I3SU.js";import{a as le,b as je,c as ce,d as $e}from"./chunk-P7K7ELYZ.js";import{a as Se,b as Q,c as Ae,d as Ie,e as Ce,h as Oe,i as ne,j as Pe,k as Ge,l as He,m as Ke}from"./chunk-6MYG4HWP.js";import{a as Ue,b as Fe,c as Ne,d as Le,e as Be,f as oe,g as j,h as qe,i as We,j as ze}from"./chunk-JS2IXPNL.js";import{b as xe,c as De}from"./chunk-SLLJX5QK.js";import{a as o}from"./chunk-4FHWXBOB.js";var Tt=["magenta","yellow","green","blue"],_t={magenta:"rgb(255, 72, 150)",yellow:"rgb(255, 190, 0)",green:"rgb(0, 238, 175)",blue:"rgb(25, 150, 255)",dark:"rgb(0, 0, 0)"};function zi(i){return _t[i]}o(zi,"P");var Et=4,St=4,J=o(i=>typeof i=="number"&&Number.isFinite(i),"R");function ee(i){if(typeof i!="object"||i===null)return!1;let e=i;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=>Tt.includes(r))||!Array.isArray(e.onsetsMs)||e.onsetsMs.length!==e.colours.length)return!1;let t=-1;for(let r of e.onsetsMs){if(!J(r)||r<0||r<=t)return!1;t=r}return!(!J(e.holdMs)||e.holdMs<=0||!J(e.endMs)||e.endMs<=t||!J(e.clipMs)||e.clipMs<e.endMs||e.clipMs>8e3)}o(ee,"_");function Ye(i,e){return ee(i)?Math.max(e,Math.ceil(i.clipMs)):e}o(Ye,"O");function Qe(i,e){let t=e.now??(()=>performance.now()),r=ee(i)?i:void 0,s=[],a=null,n=null,l=null,c=!1,h=null,d=o(p=>{h=p;try{e.paint(p)}catch{}},"s"),u=o(p=>{let v=e.frames?.()??null;return v!==null&&l!==null?v.mediaTimeMs+(p-v.presentationTimeMs)-l:p-(n??p)},"p"),m=o((p,v,y=0)=>{if(c)return;let g=Math.max(0,p-u(t()));a=setTimeout(()=>{if(a=null,!c){if(y<Et&&u(t())<p-St){m(p,v,y+1);return}v()}},g)},"f"),w=o(p=>{if(r===void 0)return;let v=r.endMs;if(p>=r.colours.length){m(v,()=>d(null));return}let y=r.onsetsMs[p],g=p+1<r.onsetsMs.length?r.onsetsMs[p+1]:v;m(y,()=>{let M=u(t());if(M>v){h!==null&&d(null);return}let E=r.colours[p];d(E);let A=s.length===0?0:s[s.length-1].tMs;s.push({tMs:Math.max(A,Math.round(M)),colour:E});let I=y+r.holdMs;if(I<g){m(I,()=>{if(u(t())>v){h!==null&&d(null);return}d("dark"),w(p+1)});return}w(p+1)})},"S");return{started(p){if(r===void 0||c||n!==null)return;n=p;let v=e.frames?.()??null;l=v===null?null:v.mediaTimeMs+(p-v.presentationTimeMs),w(0)},stop(){c||(c=!0,a!==null&&clearTimeout(a),a=null,h!==null&&d(null))},report(){return r===void 0?void 0:{nonce:r.nonce,rendered:[...s]}}}}o(Qe,"w");var At=1e4,O,It=(O=class{constructor(e,t){this.tier="blaze",this.inner=e,t!==void 0&&(this.fallbackReason=t)}static async create(e,t){let r=await import("./vision_bundle-WBHR7TEE.js"),s=await r.FilesetResolver.forVisionTasks(e),a=await r.FaceDetector.createFromOptions(s,{baseOptions:{modelAssetPath:`${e}/blaze_face_short_range.tflite`,delegate:"CPU"},runningMode:"IMAGE"});return new O(a,t)}async detect(e,t,r){let s;try{s=this.inner.detect(e).detections}catch{return null}let a=xt(s);if(a?.boundingBox===void 0)return null;let n=te(e),l=Dt(a.keypoints,n),c=a.keypoints?.[2],h={box:{x:a.boundingBox.originX,y:a.boundingBox.originY,width:a.boundingBox.width,height:a.boundingBox.height},...l!==void 0?{eyes:l}:{},...c!==void 0?{nose:{x:c.x*n.width,y:c.y*n.height}}:{},score:a.categories[0]?.score??0,extraFaces:Je(s.map(d=>d.boundingBox??{width:0,height:0}),s.indexOf(a))};return et(h,e,t,r)}destroy(){try{this.inner.close()}catch{}}},o(O,"t"),O);function xt(i){let e,t=-1;for(let r of i){let s=r.categories[0]?.score??0;s>t&&(e=r,t=s)}return e}o(xt,"R");function Dt(i,e){let t=i?.[0],r=i?.[1];if(t===void 0||r===void 0)return;let s=o(l=>({x:l.x*e.width,y:l.y*e.height}),"n"),[a,n]=[s(t),s(r)];return a.x<=n.x?{left:a,right:n}:{left:n,right:a}}o(Dt,"T");function Rt(){if(typeof OffscreenCanvas=="function")return new OffscreenCanvas(2,2);let i=document.createElement("canvas");return i.width=2,i.height=2,i}o(Rt,"E");var Ct=4;async function Ot(){let i=globalThis.FaceDetector;if(typeof i!="function")return{ok:!1,reason:"unsupported"};try{let e=new i({fastMode:!0,maxDetectedFaces:Ct});return await e.detect(Rt()),{ok:!0,instance:e}}catch(e){return{ok:!1,reason:`smoke_failed:${e instanceof Error?e.message:String(e)}`}}}o(Ot,"w");var U,Pt=(U=class{constructor(e,t){this.tier="native",this.inner=e,t!==void 0&&(this.fallbackReason=t)}async detect(e,t,r){let s;try{s=await this.inner.detect(e)}catch{return null}let a=s.map(d=>d.boundingBox),n=-1;a.forEach((d,u)=>{let m=a[n];(m===void 0||d.width*d.height>m.width*m.height)&&(n=u)});let l=s[n];if(l===void 0)return null;let c=Gt(l.landmarks),h={box:{x:l.boundingBox.x,y:l.boundingBox.y,width:l.boundingBox.width,height:l.boundingBox.height},...c!==void 0?{eyes:c}:{},score:1,extraFaces:Je(a,n)};return et(h,e,t,r)}destroy(){}},o(U,"b"),U);function Gt(i){if(i===void 0)return;let e=i.filter(s=>s.type==="eye").map(s=>s.locations[0]).filter(s=>s!==void 0),[t,r]=e;if(!(t===void 0||r===void 0))return t.x<=r.x?{left:t,right:r}:{left:r,right:t}}o(Gt,"S");var Ut=.25;function Je(i,e){let t=i[e],r=t===void 0?0:t.width*t.height;if(!(r>0))return 0;let s=0;return i.forEach((a,n)=>{n!==e&&a.width*a.height>=Ut*r&&(s+=1)}),s}o(Je,"f");var ue="/models-v3",Ft=["native","blaze"],F,de=(F=class extends Error{constructor(e){super(`no detector tier available (${e})`),this.name="DetectorLadderError",this.fallbackReason=e}},o(F,"x"),F);function te(i){let e=i;if(typeof e.videoWidth=="number"&&e.videoWidth>0)return{width:e.videoWidth,height:e.videoHeight??0};if(typeof e.naturalWidth=="number"&&e.naturalWidth>0)return{width:e.naturalWidth,height:e.naturalHeight??0};let t=typeof e.width=="number"?e.width:0,r=typeof e.height=="number"?e.height:0;return{width:t,height:r}}o(te,"y");function et(i,e,t,r){let s=te(e),a=s.width>0?t/s.width:1,n=s.height>0?r/s.height:1,l=o(c=>({x:c.x*a,y:c.y*n}),"s");return{box:{x:i.box.x*a,y:i.box.y*n,width:i.box.width*a,height:i.box.height*n},...i.eyes!==void 0?{eyes:{left:l(i.eyes.left),right:l(i.eyes.right)}}:{},...i.nose!==void 0?{nose:l(i.nose)}:{},score:i.score,...i.extraFaces!==void 0?{extraFaces:i.extraFaces}:{}}}o(et,"h");function Nt(i){return i instanceof Error?i.message:String(i)}o(Nt,"C");async function x(i){let e=i.preferred??Ft,t=[];for(let r of e){if(r==="native"){let s=await Ot();if(s.ok)return new Pt(s.instance,he(t));t.push(`native:${s.reason}`);continue}try{return await Lt(It.create(i.v3AssetBaseUrl??ue,he(t)),i.blazeInitTimeoutMs??At)}catch(s){t.push(s instanceof tt?"blaze:blaze_init_timeout":`blaze:${Nt(s)}`)}}throw new de(he(t)??"no_tier_available")}o(x,"O");function he(i){return i.length>0?i.join("; "):void 0}o(he,"v");var N,tt=(N=class extends Error{},o(N,"g"),N);function Lt(i,e){return new Promise((t,r)=>{let s=setTimeout(()=>{r(new tt(`init exceeded ${e}ms`)),i.then(a=>a.destroy(),()=>{})},e);i.then(a=>{clearTimeout(s),t(a)},a=>{clearTimeout(s),r(a)})})}o(Lt,"W");var C=1;function it(){return typeof OffscreenCanvas=="function"&&typeof createImageBitmap=="function"&&typeof Worker=="function"}o(it,"K");function Bt(i,e={}){let t=e.createDetector??x,r=null;i.onmessage=s=>{let a=s.data;if(a.v!==C){a.bitmap?.close?.();return}if(a.type==="init"){t(a.options).then(n=>{r=n;let l={v:C,type:"ready",tier:n.tier,...n.fallbackReason!==void 0?{fallbackReason:n.fallbackReason}:{}};i.postMessage(l)});return}if(a.type==="detect"){let n=o(l=>{let c={v:C,type:"result",id:a.id,observation:l};i.postMessage(c),a.bitmap.close?.()},"a");if(r===null){n(null);return}r.detect(a.bitmap,a.streamWidth,a.streamHeight).then(n,()=>n(null))}}}o(Bt,"B");typeof self<"u"&&typeof self.importScripts=="function"&&Bt(self);var P,rt=(P=class{constructor(e,t){this.pending=new Map,this.nextId=1,this.worker=e,this.tier=t.tier,t.fallbackReason!==void 0&&(this.fallbackReason=t.fallbackReason),e.addEventListener("message",r=>{let s=r.data;if(s.v!==C||s.type!=="result")return;let a=this.pending.get(s.id);this.pending.delete(s.id),a?.(s.observation)})}static create(e,t,r=1e4){return new Promise((s,a)=>{let n=setTimeout(()=>{e.removeEventListener("message",l),e.terminate(),a(new Error(`worker detector not ready within ${r}ms`))},r),l=o(h=>{let d=h.data;d.v!==C||d.type!=="ready"||(clearTimeout(n),e.removeEventListener("message",l),s(new P(e,d)))},"s");e.addEventListener("message",l);let c={v:C,type:"init",options:t};e.postMessage(c)})}async detect(e,t,r){let s;try{typeof ImageBitmap<"u"&&e instanceof ImageBitmap?s=e:typeof createImageBitmap=="function"?s=await createImageBitmap(e):s=e}catch{return null}let a=this.nextId;return this.nextId+=1,new Promise(n=>{this.pending.set(a,n);let l={v:C,type:"detect",id:a,bitmap:s,streamWidth:t,streamHeight:r};this.worker.postMessage(l,[s])})}destroy(){for(let e of this.pending.values())e(null);this.pending.clear(),this.worker.terminate()}},o(P,"t"),P);var qt=[...Ue.filter(i=>i.startsWith("video/mp4")),"video/webm;codecs=h264","video/webm;codecs=avc1","video/webm;codecs=vp8","video/webm;codecs=vp9","video/webm"],dt=new Set;function Wt(i){let e=/(?:Chrome|Chromium)\/(\d+)\./.exec(i??"");return e?Number(e[1]):null}o(Wt,"Pe");function zt(i=Kt(),e=globalThis.navigator?.userAgent){if(i===void 0)return"";let t=Wt(e)===126;for(let r of qt)if(!(dt.has(r)||t&&r.startsWith("video/mp4")))try{if(i(r))return r}catch{}return""}o(zt,"be");function st(i){i!==""&&dt.add(i)}o(st,"L");function Ht(i){return i.replace(/^video\/x-matroska/i,"video/webm")}o(Ht,"ye");function ft(i){let e=/codecs=["']?([^,;"']+)/i.exec(i);return e?e[1].trim():i.split(";")[0].trim()}o(ft,"lt");function Kt(){let i=globalThis.MediaRecorder;return i&&typeof i.isTypeSupported=="function"?e=>i.isTypeSupported(e):void 0}o(Kt,"xe");var pt=2500,Xt=1e3,Zt=1500,at=25e5,Vt=100,jt=700,$t=20,Yt=1500,ie=null;function Qt(){return ie??(ie=import("./clip-inspect-DLJXVKV6-TNHTD4LV.js").catch(i=>{throw ie=null,i})),ie.catch(()=>null)}o(Qt,"He");var B,D=(B=class extends Error{constructor(e,t){super(t??e),this.kind=e}},o(B,"T"),B),Jt=100;function nt(i,e){return i.stats===void 0?!1:i.stats===null?!0:i.stats.durationMs<e-Jt}o(nt,"N");function ei(i,e){return i.stats?e.stats?i.stats.durationMs>e.stats.durationMs:!0:!1}o(ei,"Ee");var q,ti=(q=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,t,r,s=pt,a){let n=zt(),l=Qt();return this.recordRaw(e,t,r,s,a,n).then(c=>ii(c,l),c=>{throw c instanceof D&&(c.requestedMimeType=n),c})}recordRaw(e,t,r,s,a,n){return this.recorder&&!this.settled?Promise.reject(new D("generic","record() called while a recording is in flight — 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((l,c)=>{let h;try{h=new MediaRecorder(e,n?{mimeType:n,videoBitsPerSecond:at}:{videoBitsPerSecond:at})}catch{try{h=new MediaRecorder(e)}catch{c(new D("unsupported"));return}}this.recorder=h;let d=o(g=>{this.settled||(this.settled=!0,this.clearTimers(),g())},"d"),u=o(()=>d(()=>{let g=Ht(h.mimeType||n||Fe),M=new Blob(this.chunks,{type:g});if(M.size===0){c(new D("generic","empty clip"));return}if(oe(M)){c(new D("cliptoolarge"));return}l({blob:M,mimeType:g,requestedMimeType:n})}),"u");h.ondataavailable=g=>{g.data&&g.data.size&&(this.chunks.push(g.data),this.bytes+=g.data.size,this.bytes>Be&&d(()=>{try{h.state!=="inactive"&&h.stop()}catch{}c(new D("cliptoolarge"))}))},h.onstop=u,h.onerror=()=>d(()=>c(new D("generic")));let m=this.now();if(r!==void 0||a!==void 0){let g=!1;h.onstart=()=>{if(!(g||this.settled)&&(g=!0,m=this.now(),r!==void 0))try{r()}catch{}}}try{h.start(Xt)}catch{d(()=>c(new D("generic")));return}let w=o(()=>{if(this.pollTimer&&clearInterval(this.pollTimer),this.pollTimer=null,this.hardStopTimer&&clearTimeout(this.hardStopTimer),this.hardStopTimer=null,this.settled||t?.(),h.state!=="inactive"){try{h.stop()}catch{u()}this.graceTimer=setTimeout(u,Zt)}else u()},"m"),p=this.now();if(a===void 0){this.hardStopTimer=setTimeout(w,s);return}let v=null,y=!1;this.hardStopTimer=setTimeout(w,s+jt),this.pollTimer=setInterval(()=>{if(this.settled||y)return;let g=null;try{g=a.latest()}catch{g=null}let M=g?.presentationTimeMs;M!==void 0&&Number.isFinite(M)&&M>=m&&v===null&&(v=M);let E=v!==null&&M!==void 0&&M-v>=s,A=v===null&&this.now()-p>=s;if(!(!E&&!A)){if(y=!0,this.pollTimer&&clearInterval(this.pollTimer),this.pollTimer=null,A){w();return}this.hardStopTimer&&clearTimeout(this.hardStopTimer),this.hardStopTimer=setTimeout(w,Vt)}},$t)}))}stop(e){this.clearTimers();let t=this.recorder;if(t&&t.state!=="inactive")try{t.stop()}catch{}this.recorder=null,(e??this.stream)?.getTracks().forEach(r=>r.stop()),this.stream=null}},o(q,"A"),q);async function ii(i,e){let t,r=new Promise(h=>{t=setTimeout(()=>h(null),Yt)}),s=await Promise.race([e,r]);if(clearTimeout(t),s===null)return i;let a;try{a=await s.blobBytes(i.blob)}catch{return{...i,stats:null}}let n=s.inspectClipBytes(a);if(n?.container!=="webm")return{...i,stats:n};let l=s.withWebmDuration(a,n.durationMs);if(l===null)return{...i,stats:n};let c=s.inspectClipBytes(l);return c===null||c.frames!==n.frames||c.durationMs!==n.durationMs?{...i,stats:n}:{...i,blob:new Blob([l],{type:i.blob.type}),stats:n}}o(ii,"Be");function ri(i,e,t=.92){return new Promise((r,s)=>{let a=i.videoWidth,n=i.videoHeight;if(!a||!n){s(new Error("video-not-ready"));return}let l=e.getContext("2d");if(!l){s(new Error("no-2d-context"));return}e.width=a,e.height=n,l.scale(-1,1),l.drawImage(i,-a,0),e.toBlob(c=>c?r(c):s(new Error("empty-keyframe")),"image/jpeg",t)})}o(ri,"Me");var W,si=(W=class{constructor(e){this.timer=null,this.frameCallbackId=null,this.running=!1,this.busy=!1,this.lastRunAt=Number.NEGATIVE_INFINITY,this.degradeCount=0,this.durations=[],this.options=e,this.periodMs=1e3/e.cadenceHz}start(){if(this.running)return;this.running=!0;let e=this.options.video;if(typeof e?.requestVideoFrameCallback=="function"){let t=o(()=>{this.running&&(this.frameCallbackId=e.requestVideoFrameCallback?.(()=>{this.frameCallbackId=null,this.now()-this.lastRunAt>=this.periodMs&&this.tick(),t()}))},"t");t();return}this.timer=setInterval(()=>this.tick(),this.periodMs)}stop(){this.running=!1,this.timer!==null&&(clearInterval(this.timer),this.timer=null),this.frameCallbackId!==null&&(this.options.video?.cancelVideoFrameCallback?.(this.frameCallbackId),this.frameCallbackId=null)}stats(){let e=this.durations.length===0?0:this.durations.reduce((t,r)=>t+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()})}},o(W,"D"),W),ai=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}),L=o(i=>Math.min(1,Math.max(0,i)),"C"),z,ot=(z=class{constructor(e={}){this.p=0,this.lastTickAt=null,this.lastCenter=null,this.velocityEma=0,this.qWindow=[],this.lastSizeDirection="ideal",this.t={...ai,...e}}reset(){this.p=0,this.lastTickAt=null,this.lastCenter=null,this.velocityEma=0,this.qWindow=[],this.lastSizeDirection="ideal"}tick(e){let{observation:t,quality:r,timestampMs:s}=e,a=this.lastTickAt===null?0:Math.max(0,(s-this.lastTickAt)/1e3);this.lastTickAt=s;let n={presence:0,single:1,centering:0,size:0,pose:0,sharpness:L(r.sharpness),exposure:L(r.exposure),motion:1};if(t!==null){n.presence=1,n.single=(t.extraFaces??0)>0?0:1;let d=this.geometryOf(t,e);n.centering=d.centering,n.size=d.size,n.pose=d.pose,n.motion=this.motionOf(d.center,d.iod,s)}else this.lastCenter=null,this.velocityEma=0;let l=Math.min(n.presence,n.single,n.centering,n.size,n.pose,n.sharpness,n.exposure,n.motion);this.p=L(this.p+(l>=this.t.Q_GOOD?this.t.RISE_PER_S*l:-this.t.FALL_PER_S*(1-l))*a),this.qWindow.push({at:s,q:l}),this.qWindow=this.qWindow.filter(d=>d.at>=s-this.t.READY_WINDOW_MS);let c=this.qWindow.map(d=>d.q);if(c.length>=3){let d=Math.min(...c),u=c.indexOf(d);c=c.filter((m,w)=>w!==u)}let h=this.p>=1&&c.every(d=>d>=this.t.Q_GOOD);return{at:s,q:l,p:this.p,factors:n,guidanceKey:this.guidanceOf(n,r,l),ready:h,accepted:l>=this.t.Q_GOOD}}geometryOf(e,t){let{box:r,eyes:s}=e,a={x:t.frameWidth/2,y:t.frameHeight/2},n=Math.min(t.frameWidth,t.frameHeight),l=s!==void 0?{x:(s.left.x+s.right.x)/2,y:(s.left.y+s.right.y)/2}:{x:r.x+r.width/2,y:r.y+r.height/2-this.t.BOX_EYE_OFFSET_FACTOR*r.height},c=s!==void 0?Math.hypot(s.right.x-s.left.x,s.right.y-s.left.y):this.t.IOD_BOX_PROXY_FACTOR*r.width,h=Math.hypot(l.x-a.x,l.y-a.y),d=c<=0?0:1-L(h/(this.t.CENTER_FALLOFF_IOD_MULTIPLE*c)),u=n>0?c/n:0;this.lastSizeDirection=u<this.t.SIZE_IDEAL_MIN?"far":u>this.t.SIZE_IDEAL_MAX?"close":"ideal";let m;u<this.t.SIZE_HARD_MIN||u>this.t.SIZE_HARD_MAX?m=0:u<this.t.SIZE_IDEAL_MIN?m=(u-this.t.SIZE_HARD_MIN)/(this.t.SIZE_IDEAL_MIN-this.t.SIZE_HARD_MIN):u>this.t.SIZE_IDEAL_MAX?m=(this.t.SIZE_HARD_MAX-u)/(this.t.SIZE_HARD_MAX-this.t.SIZE_IDEAL_MAX):m=1;let w=1;if(s!==void 0){let p=Math.abs(Math.atan2(s.right.y-s.left.y,s.right.x-s.left.x))*180/Math.PI;w=1-L(p/this.t.ROLL_MAX_DEG)}return{center:l,iod:c,centering:d,size:m,pose:w}}motionOf(e,t,r){let s=this.lastCenter;if(this.lastCenter={...e,at:r},s===null||t<=0)return 1;let a=(r-s.at)/1e3;if(a<=0)return 1;let n=Math.hypot(e.x-s.x,e.y-s.y)/t/a;n<=this.t.MOTION_DEADBAND_IOD_PER_S&&(n=0);let l=1-Math.exp(-a/this.t.MOTION_TAU_S);return this.velocityEma=l*n+(1-l)*this.velocityEma,1-L(this.velocityEma/this.t.MOTION_VELOCITY_IOD_PER_S)}guidanceOf(e,t,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(t);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 s=[["size",this.sizeGuidance()],["centering","fcv3.center_face"],["pose","fcv3.straighten"],["exposure",this.exposureGuidance(t)],["sharpness","fcv3.steady_camera"],["motion","fcv3.hold_still"]],a=s[0];for(let n of s)e[n[0]]<e[a[0]]&&(a=n);return a[1]}return"fcv3.hold_still"}sizeGuidance(){return this.lastSizeDirection==="far"?"fcv3.come_closer":"fcv3.move_back"}exposureGuidance(e){let t=(le[0]+le[1])/2;return e.meanLuma<t?"fcv3.more_light":"fcv3.too_bright"}},o(z,"_"),z),ni=["single","size","centering","pose","exposure","sharpness","motion"];function oi(i){if(i.accepted)return null;if(i.factors.presence<=0)return"no_face";let e="single";for(let t of ni)i.factors[t]<i.factors[e]&&(e=t);return e}o(oi,"ze");var H,lt=(H=class{constructor(){this.blocked={},this.acceptedMs=0,this.ticks=0,this.lastAt=null}record(e){let t=this.lastAt===null?0:Math.max(0,e.at-this.lastAt);this.lastAt=e.at,this.ticks+=1;let r=oi(e);if(r===null){this.acceptedMs+=t;return}let s=this.blocked[r]??{count:0,ms:0};s.count+=1,s.ms+=t,this.blocked[r]=s}summary(){let e={};for(let[t,r]of Object.entries(this.blocked))e[t]={count:r.count,ms:Math.round(r.ms)};return{blocked:e,acceptedMs:Math.round(this.acceptedMs),ticks:this.ticks}}},o(H,"w"),H),li=["obs","manycam","virtual","snap camera","xsplit","droidcam","iriun","camo","fake_device","fake-capture-device"],ci=[/^(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 hi(i){let e=(i??"").trim().toLowerCase();return e.length===0?"unknown":li.some(t=>e.includes(t))?"known_virtual":ci.some(t=>t.test(e))?"platform":"unknown"}o(hi,"Qe");function ct(i){if(typeof i!="function")return!1;try{return/\{\s*\[native code\]\s*\}\s*$/.test(Function.prototype.toString.call(i))}catch{return!1}}o(ct,"Ce");function ui(i=globalThis){return ct(i.navigator?.mediaDevices?.getUserMedia)&&ct(i.MediaStreamTrack?.prototype?.getSettings)}o(ui,"Ye");async function di(i,e=globalThis){let t=e.crypto?.subtle?.digest;if(typeof t=="function")try{let r=new Uint8Array(await t.call(e.crypto?.subtle,"SHA-256",new TextEncoder().encode(i)));return Array.from(r.subarray(0,8),s=>s.toString(16).padStart(2,"0")).join("")}catch{return}}o(di,"je");async function fi(i,e=globalThis){let t={};try{t=typeof i.getSettings=="function"?i.getSettings()??{}:{}}catch{t={}}let r={};if((t.facingMode==="user"||t.facingMode==="environment"||t.facingMode==="left"||t.facingMode==="right")&&(r.facingMode=t.facingMode),typeof t.frameRate=="number"&&Number.isFinite(t.frameRate)&&(r.frameRate=t.frameRate),typeof t.width=="number"&&Number.isFinite(t.width)&&(r.width=t.width),typeof t.height=="number"&&Number.isFinite(t.height)&&(r.height=t.height),typeof t.deviceId=="string"&&t.deviceId.length>0){let a=await di(t.deviceId,e);a!==void 0&&(r.deviceIdHash=a)}let s;try{s=i.label}catch{s=void 0}return{trackSettings:r,capabilitiesPresent:typeof i.getCapabilities=="function",labelClass:hi(s),prototypesIntact:ui(e)}}o(fi,"Se");var fe=o(i=>Math.round(i*100)/100,"U");function pi(i){let e=i,t=typeof e?.requestVideoFrameCallback=="function",r=null,s=null,a=0,n=0,l=0,c=0,h=0,d=0,u=o(()=>{!t||e?.requestVideoFrameCallback===void 0||(r=e.requestVideoFrameCallback((m,w)=>{if(r=null,!t)return;let p=w.presentationTime;if(s!==null){let v=p-s.presentationTimeMs;n+=1;let y=v-l;l+=y/n,c+=y*(v-l)}typeof w.captureTime=="number"&&Number.isFinite(w.captureTime)&&(h+=p-w.captureTime,d+=1),a+=1,s={mediaTimeMs:w.mediaTime*1e3,presentationTimeMs:p},u()}))},"u");return u(),{latest:o(()=>s,"latest"),stats:o(()=>({n:a,meanGapMs:n===0?0:fe(l),stdGapMs:n<2?0:fe(Math.sqrt(c/(n-1))),captureLatencyMs:d===0?null:fe(h/d)}),"stats"),stop:o(()=>{t&&(t=!1,r!==null&&e?.cancelVideoFrameCallback?.(r),r=null)},"stop")}}o(pi,"ke");function mi(i,e,t){return{...i,rvfc:e,rampPainter:t}}o(mi,"_e");var gi=1e3,pe="fcv3.hold_upright",vi=200,me=4,yi=600,wi=1e3,ht={sharpness:1,exposure:1,meanLuma:128};function bi(i,e){return e.width=i.videoWidth,e.height=i.videoHeight,e.getContext("2d").drawImage(i,0,0),new Promise((t,r)=>e.toBlob(s=>s?t(s):r(new Error("empty-keyframe")),"image/jpeg",.92))}o(bi,"rt");function Mi(){return Q()==="phone"}o(Mi,"it");var K,mt=(K=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,t){let r=this.handlers.get(e);return r||(r=new Set,this.handlers.set(e,r)),r.add(t),()=>r?.delete(t)}emit(e,t){for(let r of[...this.handlers.get(e)??[]])r(t)}async start(e={}){e.facingMode!==void 0&&(this.facing=e.facingMode),this.attempt+=1,await this.run(this.attempt)}get facingMode(){return this.facing}retry(){this.teardownAttempt(),this.start()}switchCamera(){this.facing=this.facing==="user"?"environment":"user",this.teardownAttempt(),this.start()}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:t}=this;this.fired=!1,this.lastGuidanceKey=null,this.carriedDegrade=0,this.carriedMeans=[],this.cameraRequestedAt=null,this.cameraReadyAt=null,this.faceAcquiredAt=null,this.captureCompleteAt=null,this.uprightGuard=(t.isPhone??Mi)(),this.setState("preflight");let r=Ne();if(r!=="OK"){this.fail(r==="INSECURE_CONTEXT"?"insecure":"unsupported",{phase:"preflight"});return}this.setState("acquiring");let s=t.getUserMedia??(h=>navigator.mediaDevices.getUserMedia(h)),a;this.cameraRequestedAt=this.now();try{let{facingMode:h,...d}=Se(Ae(),this.facing).video;a=await Ke(this.facing,d,{getUserMedia:s,enumerateDevices:_i(t)})}catch(h){if(e!==this.attempt)return;if(h instanceof He){this.fail("backcamera",{phase:"acquiring",name:j(h)});return}this.fail(We(h),{phase:"acquiring",name:j(h)});return}if(Re(a),ze(a),e!==this.attempt){for(let h of a.getTracks())h.stop();return}this.stream=a;let n=a.getVideoTracks?.()[0];if(this.trackProvenance=n===void 0?null:fi(n).catch(()=>null),this.openEnvironment=n===void 0?null:xe(n).catch(()=>({})),this.facing=Ie(a)??this.facing,t.video.srcObject=a,await t.video.play().catch(()=>{}),e!==this.attempt)return;if(this.cameraReadyAt=this.now(),this.detector===null){let h={v3AssetBaseUrl:t.v3AssetBaseUrl},d=t.createDetector??(t.createWorker!==void 0&&it()?async()=>{try{return await rt.create(t.createWorker(),h)}catch{return x(h)}}:()=>x(h)),u;try{u=await d()}catch(m){e===this.attempt&&this.fail("models",{phase:"models",name:j(m)},m instanceof de?m.fallbackReason:Ti(m));return}if(e!==this.attempt){u.destroy();return}this.detector=u,this.options.telemetry?.({type:"detector",tier:u.tier,fallbackReason:u.fallbackReason})}let l=Xe(),c=t.deviceClass??Ze(l);this.profiler=new Ve(c),this.options.telemetry?.({type:"profile",staticClass:c,activeClass:this.profiler.deviceClass,simd:l.simd}),this.gate=new ot(t.thresholds??{}),this.blockStats=new lt,this.lastGateSnapshotAt=this.now(),t.rankKeyframes?.()&&import("./keyframe-rank-YAJLYJYF-WCA6RPMD.js").then(h=>ge=h,()=>{}),this.setState("positioning"),this.positioningStartedAt=this.now(),this.startScheduler(e)}get animations(){return this.profiler?.profile.animations??"full"}startScheduler(e){let t=this.profiler;if(t===null)return;if(this.scheduler!==null){let s=this.scheduler.stats();this.carriedDegrade+=s.degradeCount,s.meanDetectMs>0&&this.carriedMeans.push(s.meanDetectMs),this.scheduler.stop()}let r=new si({cadenceHz:t.profile.cadenceHz,video:this.options.video,now:this.options.now,run:o(()=>this.detectTick(e),"run")});this.scheduler=r,r.start()}async detectTick(e){let{detector:t,gate:r,profiler:s}=this,a=this.options.video;if(e!==this.attempt||t===null||r===null||s===null||this.fired||a.videoWidth===0)return;if(this.isLandscape()){this.holdUpright(e);return}let n=s.deviceClass,l=this.now(),c=this.options.makeSnapshot?.(a,s.profile.inputWidth)??this.defaultSnapshot(a,s.profile.inputWidth),h=null;try{h=await t.detect(c,a.videoWidth,a.videoHeight)}catch{h=null}if(e!==this.attempt||this.fired)return;s.record(this.now()-l),s.deviceClass!==n&&this.startScheduler(e);let d=h===null?ht:this.options.measureQuality?.(a,h.box)??this.defaultQuality(a,h.box),u=r.tick({timestampMs:this.now(),observation:h,quality:d,frameWidth:a.videoWidth,frameHeight:a.videoHeight});u.accepted&&this.faceAcquiredAt===null&&(this.faceAcquiredAt=u.at),this.blockStats?.record(u),!u.ready&&u.at-this.lastGateSnapshotAt>=gi&&(this.lastGateSnapshotAt=u.at,this.reportGate(!1)),this.emit("checks",{engine:"v3",progress:u.p,q:u.q,factors:u.factors,attempt:e}),u.guidanceKey!==this.lastGuidanceKey&&(this.lastGuidanceKey=u.guidanceKey,this.emit("guidance",{key:u.guidanceKey})),u.ready&&this.stateValue==="positioning"&&(this.fired=!0,this.captureCompleteAt=u.at,this.fire(e))}async fire(e){let{options:t}=this,r=this.scheduler;r?.stop(),this.reportGate(!0);let s=r?.stats()??{degradeCount:0,meanDetectMs:0},a=[...this.carriedMeans,...s.meanDetectMs>0?[s.meanDetectMs]:[]];t.telemetry?.({type:"fired",timeToGateMs:this.now()-this.positioningStartedAt,degradeCount:this.carriedDegrade+s.degradeCount,meanDetectMs:a.length===0?0:a.reduce((_,b)=>_+b,0)/a.length});let n=t.mode??"clip",l=t.rankKeyframes?.()&&ge?ge.default(this,e).catch(()=>this.collectKeyframes(e)):this.collectKeyframes(e);if(n==="photo"){let _=this.watchRotation(e,null),b=await l;if(_(),e!==this.attempt)return;if(b===null){this.fail("generic",{phase:"keyframes"});return}let R=await this.provenance({n:0,meanGapMs:0,stdGapMs:0,captureLatencyMs:null},!1);if(e!==this.attempt)return;this.finishCapture({keyframe:b.blob,previewDataUrl:b.previewDataUrl,...R});return}this.setState("recording");let c=this.stream;if(c===null){this.fail("generic",{phase:"recording"});return}let h=t.screenRamp?.(),d=ee(h),u=null;l.then(_=>{u=_},()=>{});let m=o(()=>{e===this.attempt&&u!==null&&this.emit("frozen",{previewDataUrl:u.previewDataUrl})},"p"),w=Ye(h,pt),p=null,v,y=0;try{let _=this.recordTake(e,c,h,w,void 0).then(S=>S,S=>({failed:S})),[b,R]=await Promise.all([_,l]);if(v=R,e!==this.attempt)return;if("failed"in b){if(b.failed.kind==="cliptoolarge")throw b.failed;st(b.failed.requestedMimeType??"")}else p=b,nt(b.clip,w)?b.clip.stats===null&&st(b.clip.requestedMimeType??""):m();if(p===null||nt(p.clip,w)){y=1,t.telemetry?.({type:"clip_retake",reason:p===null?"error":p.clip.stats===null?"unreadable":"short"});let S=null;try{S=await this.recordTake(e,c,h,w,m)}catch($){if(p===null)throw $}if(e!==this.attempt)return;S!==null&&(p===null||ei(S.clip,p.clip))&&(p=S),S===null&&m()}}catch(_){if(e!==this.attempt)return;let b=_.kind;this.fail(b==="cliptoolarge"?"cliptoolarge":"recorder",{phase:"recording",name:j(_)});return}if(p===null){this.fail("recorder",{phase:"recording"});return}let{clip:g,rvfc:M,report:E,watched:A}=p;if(oe(g.blob)){this.fail("cliptoolarge",{phase:"recording"});return}if(v===null){this.fail("generic",{phase:"keyframes"});return}let I=await this.provenance(M,d,A);e===this.attempt&&this.finishCapture({clip:g.blob,clipMimeType:g.mimeType,...g.stats?{clipStats:g.stats}:{},clipRetakes:y,keyframe:v.blob,previewDataUrl:v.previewDataUrl,...E!==void 0&&E.rendered.length>0?{screenRamp:E}:{},...I})}async recordTake(e,t,r,s,a){let n=this.options.createRecorder?.()??new ti({now:o(()=>this.now(),"now")}),l=pi(this.options.video),c=Qe(r,{paint:o(m=>{(m===null||e===this.attempt)&&this.emit("ramp",{colour:m})},"paint"),now:o(()=>this.now(),"now"),frames:l.latest});this.ramp=c;let h=o(()=>{l.stop(),c.stop(),this.ramp===c&&(this.ramp=null)},"l"),d=this.watchRotation(e,n),u=De();try{return{clip:await n.record(t,a,()=>c.started(this.now()),s,l),rvfc:l.stats(),report:c.report(),watched:u.stop()}}finally{u.stop(),d(),h()}}async provenance(e,t,r={}){let s=this.trackProvenance;if(s===null)return{};let a,n=new Promise(d=>{a=setTimeout(()=>d(null),wi)}),l=await Promise.race([s,n]),c=l===null?null:await Promise.race([this.openEnvironment,n]);if(clearTimeout(a),l===null)return{};let h={...c,...r};return{provenance:{...mi(l,e,t),...Object.keys(h).length>0?{env:h}:{}}}}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!==pe&&(this.lastGuidanceKey=pe,this.emit("guidance",{key:pe}))}watchRotation(e,t){if(!this.uprightGuard)return()=>{};let r=this.options.video,s=o(()=>{if(e!==this.attempt||t!==null&&this.stateValue!=="recording"){l();return}r.videoWidth>0&&this.isLandscape()&&(l(),this.abortRecording(e,t))},"i"),a=setInterval(s,vi);r.addEventListener?.("resize",s);let n=!1;function l(){n||(n=!0,clearInterval(a),r.removeEventListener?.("resize",s))}return o(l,"o"),l}abortRecording(e,t){if(e!==this.attempt)return;this.attempt+=1;let r=this.attempt;try{t?.stop()}catch{}this.ramp?.stop(),this.ramp=null,this.fired=!1,this.captureCompleteAt=null,this.gate=new ot(this.options.thresholds??{}),this.blockStats=new lt,this.lastGateSnapshotAt=this.now(),this.lastGuidanceKey=null,this.setState("positioning"),this.positioningStartedAt=this.now(),this.holdUpright(r),this.startScheduler(r)}async collectKeyframes(e){let t=this.options.captureKeyframe??(a=>this.defaultKeyframe(a)),r=yi/(me-1),s=null;for(let a=0;a<me;a+=1){if(e!==this.attempt)return s;try{let n=await t(this.options.video);(s===null||n.sharpness>s.sharpness)&&(s=n)}catch{}a<me-1&&await ki(r)}return s}finishCapture(e){this.stopTracks(),this.setState("captured");let t=this.captureTiming();this.emit("artifacts",t===void 0?e:{...e,timing:t})}captureTiming(){let e={},t=o((r,s,a)=>{s!==null&&a!==null&&(e[r]=Math.max(0,Math.round(a-s)))},"t");return t("cameraReadyMs",this.cameraRequestedAt,this.cameraReadyAt),t("faceAcquireMs",this.cameraReadyAt,this.faceAcquiredAt),t("captureMs",this.faceAcquiredAt,this.captureCompleteAt),Object.keys(e).length>0?e:void 0}async defaultKeyframe(e){let t=document.createElement("canvas"),r=await(this.facing==="user"?ri:bi)(e,t),s=t.toDataURL("image/jpeg",.92);return{blob:r,previewDataUrl:s,sharpness:this.centerSharpness(e)}}defaultSnapshot(e,t){try{let r=this.snapshotCanvas??document.createElement("canvas"),s=t/Math.max(1,e.videoWidth),a=Math.max(1,Math.round(e.videoWidth*s)),n=Math.max(1,Math.round(e.videoHeight*s)),l=r.getContext("2d");return l===null?e:(r.width!==a&&(r.width=a),r.height!==n&&(r.height=n),l.drawImage(e,0,0,a,n),this.snapshotCanvas=r,r)}catch{return e}}defaultQuality(e,t){let r=ut(e,t,96);return r===null?ht:{sharpness:ce(r),exposure:$e(r),meanLuma:je(r)}}centerSharpness(e){let t=te(e),r=ut(e,{x:t.width*.25,y:t.height*.25,width:t.width*.5,height:t.height*.5},96);return r===null?0:ce(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 t=this.blockStats,r=this.profiler;if(t===null||r===null)return;let s=t.summary();e&&(this.blockStats=null),s.ticks!==0&&this.options.telemetry?.({type:"gate",final:e,activeClass:r.deviceClass,cadenceHz:r.profile.cadenceHz,...s})}stopTracks(){if(this.stream!==null){for(let e of this.stream.getTracks())e.stop();this.stream=null}}fail(e,t,r){this.scheduler?.stop(),this.reportGate(!0),this.stopTracks(),this.setState("error"),this.options.telemetry?.({type:"error",kind:e,fallbackReason:r});let{phase:s,name:a}=t;this.emit("error",{kind:e,retryable:e!=="insecure"&&e!=="unsupported",detail:a===void 0?{phase:s}:{phase:s,name:a}})}setState(e){this.stateValue=e,this.emit("statechange",{state:e})}now(){return this.options.now?.()??performance.now()}},o(K,"Ie"),K),ge;function ki(i){return new Promise(e=>setTimeout(e,i))}o(ki,"nt");function Ti(i){return i instanceof Error?i.message:String(i)}o(Ti,"at");function ut(i,e,t){try{let r=document.createElement("canvas"),s=t/Math.max(1,e.width);r.width=Math.max(1,Math.round(e.width*s)),r.height=Math.max(1,Math.round(e.height*s));let a=r.getContext("2d");return a===null?null:(a.drawImage(i,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}}o(ut,"Re");function _i(i){if(i.enumerateDevices!==void 0)return i.enumerateDevices;if(i.getUserMedia===void 0&&!(typeof navigator>"u"||typeof navigator.mediaDevices?.enumerateDevices!="function"))return()=>navigator.mediaDevices.enumerateDevices()}o(_i,"st");var Ei=12e4,gt=13e4,Si=3e3,Ai=1200,ve=Symbol.for("@sekyro/web.preload.v1");function we(){let i=globalThis;return i[ve]??(i[ve]=new Map),i[ve]}o(we,"h");function re(i){let e=(i??ue).replace(/\/+$/,"");return e===""?"/":e}o(re,"b");function yt(i){let e=we(),t=e.get(i);return t===void 0&&(t={status:"idle",promise:null,scheduled:null,detectorPromise:null,detector:null,listeners:new Set},e.set(i,t)),t}o(yt,"ae");function ye(i,e){if(i.status!==e){i.status=e;for(let t of[...i.listeners])t(e)}}o(ye,"k");var Ii=o(i=>x({preferred:["blaze"],v3AssetBaseUrl:i,blazeInitTimeoutMs:Ei}),"K"),xi=Ii;function Di(){return typeof window<"u"&&typeof navigator<"u"&&typeof navigator.mediaDevices?.getUserMedia=="function"}o(Di,"Ce");function Ri(){return navigator.connection?.saveData===!0}o(Ri,"Se");function Ci(i){let e=window;if(typeof e.requestIdleCallback=="function"){let r=e.requestIdleCallback(i,{timeout:Si});return()=>e.cancelIdleCallback?.(r)}let t=setTimeout(i,Ai);return()=>clearTimeout(t)}o(Ci,"Ee");function Oi(i,e){let t,r=new Promise(l=>{t=l}),s=!1,a=o(()=>{},"u"),n={promise:r,settle:o(l=>{s||(s=!0,a(),i.scheduled===n&&(i.scheduled=null),t(l))},"settle")};return i.scheduled=n,a=Ci(()=>{s||n.settle(be(i,e))}),r}o(Oi,"ye");function be(i,e){if((i.status==="loading"||i.status==="ready")&&i.promise!==null)return i.promise;ye(i,"loading");let t=new Promise(n=>n(xi(e)));i.detectorPromise=t;let r,s=new Promise((n,l)=>{r=setTimeout(()=>{t.then(c=>c.destroy(),()=>{}),l(new Error(`detector preload exceeded ${gt} ms`))},gt)}),a=Promise.race([t,s]).then(n=>i.detectorPromise!==t?(n.destroy(),i.status):(i.detector=n,ye(i,"ready"),"ready"),n=>(i.detectorPromise===t&&(i.detectorPromise=null,i.detector=null,ye(i,"failed"),console.warn("[@sekyro/web] face-detector preload failed:",n)),i.status)).finally(()=>clearTimeout(r));return i.promise=a,i.scheduled?.settle(a),a}o(be,"U");function hr(i={}){if(!Di())return Promise.resolve("idle");let e=re(i.assetBaseUrl),t=yt(e);return i.respectSaveData===!0&&Ri()?Promise.resolve(t.status):(t.status==="loading"||t.status==="ready")&&t.promise!==null?t.promise:i.idle===!0?t.scheduled?.promise??Oi(t,e):be(t,e)}o(hr,"xe");function ur(i){return we().get(re(i))?.status??"idle"}o(ur,"Fe");function dr(i,e){let t=yt(re(e));return t.listeners.add(i),()=>{t.listeners.delete(i)}}o(dr,"Ie");function Pi(i){return{get tier(){return i.tier},get fallbackReason(){return i.fallbackReason},detect:o((...e)=>i.detect(...e),"detect"),destroy:o(()=>{},"destroy")}}o(Pi,"Le");function Gi(i){let e=re(i),t=we().get(e);if(!(t===void 0||t.detector===null&&t.detectorPromise===null&&t.scheduled===null))return async()=>{t.scheduled!==null&&be(t,e);let r=t.promise;for(;t.detector===null&&r!==null&&(await r,t.promise!==r);)r=t.promise;return t.detector!==null?Pi(t.detector):x({v3AssetBaseUrl:e})}}o(Gi,"de");var Ui=new Set(["inuse","overconstrained","notfound"]),Fi=[500,1500];function Ni(i){switch(i){case"fcv3.no_face":case"fcv3.center_face":case"fcv3.straighten":return"center";case"fcv3.come_closer":return"closer";case"fcv3.move_back":return"farther";case"fcv3.more_light":case"fcv3.too_bright":return"light";case"fcv3.hold_still":case"fcv3.steady_camera":return"still";case"fcv3.hold_upright":return"upright";case"fcv3.one_face":return"one_face";default:return null}}o(Ni,"Ae");function Li(i){switch(i){case"preflight":case"acquiring":return"starting";case"positioning":return"gating";default:return i}}o(Li,"Pe");function vt(i){switch(i){case"permission":case"notfound":case"inuse":case"insecure":case"unsupported":return i;case"backcamera":return"notfound";default:{let e=i;return"generic"}}}o(vt,"ue");function Bi(i,e,t){if(t===void 0)return{kind:vt(i),retryable:e};let r=qe(t.name);return{kind:vt(i),retryable:e,detail:{...r!==void 0?{name:r}:{},phase:t.phase,engineKind:i}}}o(Bi,"we");var qi=new Set(["captured","uploading","checking"]);function Wi(i,e={},t,r=()=>"self",s=()=>{},a){let n=e.now??(()=>performance.now()),l=e.canChooseFacing??Oe,c="user",h=Pe(),d=r(),u=Ce(),m=!Le(),w=e.engineOptions,p=w?.createDetector===void 0&&w?.createWorker===void 0?{createDetector:o(()=>{let f=Gi(i.assetBaseUrl);return f!==void 0?f():x({v3AssetBaseUrl:i.assetBaseUrl})},"createDetector")}:{},v={video:i.video,mode:m?"photo":"clip",rankKeyframes:t,facingMode:void 0,v3AssetBaseUrl:i.assetBaseUrl,screenRamp:o(()=>d==="self"&&u.count("ramp")>0?s():void 0,"screenRamp"),...e.engineOptions??{},...p},y=e.createEngine?.(v)??new mt(v),g="idle",M=null,E=0,A=!1,I="full",_=null,b=null,R=0,S=0,$=o(()=>{i.video.videoWidth>0&&i.video.videoHeight>0&&(R=i.video.videoWidth,S=i.video.videoHeight)},"W"),Me=Ge({enabled:i.keepScreenAwake!==!1}),X=o(f=>{g=f,Me.setActive(f==="starting"||f==="gating"||f==="recording"),u.emit("state",f)},"S"),se=o(()=>u.emit("gate",{progress:E,hint:M,faceDetected:A}),"F"),ae=o(()=>{let f=y.animations??"full";f!==I&&(I=f,u.emit("profile",{animations:I}))},"I"),G=0,Y=null,wt=e.schedule??((f,k)=>{let T=setTimeout(f,k);return()=>clearTimeout(T)}),Z=o(()=>{Y?.(),Y=null},"E"),bt=o((f,k)=>{if(V||!Ui.has(f)||k?.phase!=="acquiring")return!1;let T=Fi[G];return T===void 0?!1:(G+=1,Z(),Y=wt(()=>{Y=null,V||y.retry()},T),!0)},"fe"),Mt=[y.on("statechange",({state:f})=>{if(f==="error")return;let k=Li(f);k==="gating"&&(G=0),k==="starting"&&g!=="starting"&&(M=null,E=0,A=!1,_=null,b=null,R=0,S=0),X(k),ae(),k==="recording"&&($(),_=n(),M="hold",E=1,se())}),y.on("checks",f=>{$(),E=f.progress,A=f.factors.presence>0,se(),ae()}),y.on("guidance",({key:f})=>{M=Ni(f),se()}),y.on("frozen",({previewDataUrl:f})=>{b=n(),u.emit("frozen",{previewDataUrl:f})}),y.on("ramp",f=>u.emit("ramp",f)),y.on("artifacts",f=>{if(g!=="captured")return;let k=Q(),T=f.clipStats,_e=T!==void 0?Math.round(T.durationMs):_!==null&&b!==null?Math.max(0,Math.round(b-_)):void 0,Ee=T!==void 0&&T.frames>1&&T.durationMs>0?Math.round(T.frames*1e4/T.durationMs)/10:void 0;u.emit("captured",{keyframe:f.keyframe,...f.clip!==void 0?{clip:f.clip}:{},...f.clipMimeType!==void 0?{clipMime:f.clipMimeType}:{},width:i.video.videoWidth||R,height:i.video.videoHeight||S,..._e!==void 0?{clipMs:_e}:{},...T!==void 0?{clipFrames:T.frames}:{},...Ee!==void 0?{fps:Ee}:{},...f.clipRetakes!==void 0?{clipRetakes:f.clipRetakes}:{},...f.clipMimeType!==void 0?{codec:ft(f.clipMimeType)}:{},captureChannel:k==="desktop"?"desktop":"mobile",formFactor:k,...m?{degraded:"NO_RECORDER"}:{},engine:"v3",facingMode:y.facingMode,mode:d,...f.timing,...f.screenRamp!==void 0?{screenRamp:f.screenRamp}:{},...f.provenance!==void 0?{provenance:f.provenance}:{}})}),y.on("error",({kind:f,retryable:k,detail:T})=>{f==="backcamera"&&kt()||bt(f,T)||(X("error"),ae(),u.emit("error",Bi(f,k,T)))})],ke=!1;function kt(){return V||ke||d!=="assisted"||a===void 0||a.session()!=="choice"?!1:(ke=!0,a.onModeChange("self"),d="self",c=ne("self"),X("mode_switch"),y.restart(c),!0)}o(kt,"me");let Te=o(async()=>a!==void 0&&a.session()==="choice"&&await l().catch(()=>!1),"$"),V=!1;return{handle:{get state(){return g},get captureMode(){return r()},get facingMode(){return y.facingMode??c},on:o((f,k)=>u.on(f,k),"on"),start:o(f=>(d=r(),h.facing(d,i.facing),c=h.facing(d,f?.facing),Z(),G=0,y.start({facingMode:c})),"start"),retry:o(()=>{Z(),G=0,y.retry()},"retry"),switchCamera:o(()=>h.refuseSwitch(r()),"switchCamera"),canSwitchCaptureMode:Te,setCaptureMode:o(async f=>{if(f===r()||!await Te()||V||qi.has(g)||a===void 0)return!1;a.onModeChange(f),d=f;let k=ne(f);return c=k,g==="idle"||(X("mode_switch"),Z(),G=0,y.restart(k)),!0},"setCaptureMode"),destroy:o(()=>{V=!0,Z();for(let f of Mt)f();Me.setActive(!1),y.destroy(),u.clear()},"destroy")},setFlowState:o(f=>{g!==f&&X(f)},"setFlowState")}}o(Wi,"De");function fr(i){return Wi(i).handle}o(fr,"Ze");export{zi as a,ee as b,hr as c,ur as d,dr as e,Bi as f,Wi as g,fr as h};
|
|
1
|
+
import{d as Re,e as Xe,f as Ze,g as Ve}from"./chunk-BLRCS3XB.js";import{a as le,b as je,c as ce,d as $e}from"./chunk-P7K7ELYZ.js";import{a as Se,b as Q,c as Ae,d as Ie,e as Ce,h as Oe,i as ne,j as Pe,k as Ge,l as He,m as Ke}from"./chunk-6MYG4HWP.js";import{a as Ue,b as Fe,c as Ne,d as Le,e as Be,f as oe,g as j,h as qe,i as We,j as ze}from"./chunk-JS2IXPNL.js";import{b as xe,c as De}from"./chunk-SLLJX5QK.js";import{a as o}from"./chunk-4FHWXBOB.js";var Tt=["magenta","yellow","green","blue"],_t={magenta:"rgb(255, 72, 150)",yellow:"rgb(255, 190, 0)",green:"rgb(0, 238, 175)",blue:"rgb(25, 150, 255)",dark:"rgb(0, 0, 0)"};function zi(i){return _t[i]}o(zi,"P");var Et=4,St=4,J=o(i=>typeof i=="number"&&Number.isFinite(i),"R");function ee(i){if(typeof i!="object"||i===null)return!1;let e=i;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=>Tt.includes(r))||!Array.isArray(e.onsetsMs)||e.onsetsMs.length!==e.colours.length)return!1;let t=-1;for(let r of e.onsetsMs){if(!J(r)||r<0||r<=t)return!1;t=r}return!(!J(e.holdMs)||e.holdMs<=0||!J(e.endMs)||e.endMs<=t||!J(e.clipMs)||e.clipMs<e.endMs||e.clipMs>8e3)}o(ee,"_");function Ye(i,e){return ee(i)?Math.max(e,Math.ceil(i.clipMs)):e}o(Ye,"O");function Qe(i,e){let t=e.now??(()=>performance.now()),r=ee(i)?i:void 0,s=[],a=null,n=null,l=null,c=!1,h=null,d=o(p=>{h=p;try{e.paint(p)}catch{}},"s"),u=o(p=>{let v=e.frames?.()??null;return v!==null&&l!==null?v.mediaTimeMs+(p-v.presentationTimeMs)-l:p-(n??p)},"p"),m=o((p,v,y=0)=>{if(c)return;let g=Math.max(0,p-u(t()));a=setTimeout(()=>{if(a=null,!c){if(y<Et&&u(t())<p-St){m(p,v,y+1);return}v()}},g)},"f"),w=o(p=>{if(r===void 0)return;let v=r.endMs;if(p>=r.colours.length){m(v,()=>d(null));return}let y=r.onsetsMs[p],g=p+1<r.onsetsMs.length?r.onsetsMs[p+1]:v;m(y,()=>{let M=u(t());if(M>v){h!==null&&d(null);return}let E=r.colours[p];d(E);let A=s.length===0?0:s[s.length-1].tMs;s.push({tMs:Math.max(A,Math.round(M)),colour:E});let I=y+r.holdMs;if(I<g){m(I,()=>{if(u(t())>v){h!==null&&d(null);return}d("dark"),w(p+1)});return}w(p+1)})},"S");return{started(p){if(r===void 0||c||n!==null)return;n=p;let v=e.frames?.()??null;l=v===null?null:v.mediaTimeMs+(p-v.presentationTimeMs),w(0)},stop(){c||(c=!0,a!==null&&clearTimeout(a),a=null,h!==null&&d(null))},report(){return r===void 0?void 0:{nonce:r.nonce,rendered:[...s]}}}}o(Qe,"w");var At=1e4,O,It=(O=class{constructor(e,t){this.tier="blaze",this.inner=e,t!==void 0&&(this.fallbackReason=t)}static async create(e,t){let r=await import("./vision_bundle-WBHR7TEE.js"),s=await r.FilesetResolver.forVisionTasks(e),a=await r.FaceDetector.createFromOptions(s,{baseOptions:{modelAssetPath:`${e}/blaze_face_short_range.tflite`,delegate:"CPU"},runningMode:"IMAGE"});return new O(a,t)}async detect(e,t,r){let s;try{s=this.inner.detect(e).detections}catch{return null}let a=xt(s);if(a?.boundingBox===void 0)return null;let n=te(e),l=Dt(a.keypoints,n),c=a.keypoints?.[2],h={box:{x:a.boundingBox.originX,y:a.boundingBox.originY,width:a.boundingBox.width,height:a.boundingBox.height},...l!==void 0?{eyes:l}:{},...c!==void 0?{nose:{x:c.x*n.width,y:c.y*n.height}}:{},score:a.categories[0]?.score??0,extraFaces:Je(s.map(d=>d.boundingBox??{width:0,height:0}),s.indexOf(a))};return et(h,e,t,r)}destroy(){try{this.inner.close()}catch{}}},o(O,"t"),O);function xt(i){let e,t=-1;for(let r of i){let s=r.categories[0]?.score??0;s>t&&(e=r,t=s)}return e}o(xt,"R");function Dt(i,e){let t=i?.[0],r=i?.[1];if(t===void 0||r===void 0)return;let s=o(l=>({x:l.x*e.width,y:l.y*e.height}),"n"),[a,n]=[s(t),s(r)];return a.x<=n.x?{left:a,right:n}:{left:n,right:a}}o(Dt,"T");function Rt(){if(typeof OffscreenCanvas=="function")return new OffscreenCanvas(2,2);let i=document.createElement("canvas");return i.width=2,i.height=2,i}o(Rt,"E");var Ct=4;async function Ot(){let i=globalThis.FaceDetector;if(typeof i!="function")return{ok:!1,reason:"unsupported"};try{let e=new i({fastMode:!0,maxDetectedFaces:Ct});return await e.detect(Rt()),{ok:!0,instance:e}}catch(e){return{ok:!1,reason:`smoke_failed:${e instanceof Error?e.message:String(e)}`}}}o(Ot,"w");var U,Pt=(U=class{constructor(e,t){this.tier="native",this.inner=e,t!==void 0&&(this.fallbackReason=t)}async detect(e,t,r){let s;try{s=await this.inner.detect(e)}catch{return null}let a=s.map(d=>d.boundingBox),n=-1;a.forEach((d,u)=>{let m=a[n];(m===void 0||d.width*d.height>m.width*m.height)&&(n=u)});let l=s[n];if(l===void 0)return null;let c=Gt(l.landmarks),h={box:{x:l.boundingBox.x,y:l.boundingBox.y,width:l.boundingBox.width,height:l.boundingBox.height},...c!==void 0?{eyes:c}:{},score:1,extraFaces:Je(a,n)};return et(h,e,t,r)}destroy(){}},o(U,"b"),U);function Gt(i){if(i===void 0)return;let e=i.filter(s=>s.type==="eye").map(s=>s.locations[0]).filter(s=>s!==void 0),[t,r]=e;if(!(t===void 0||r===void 0))return t.x<=r.x?{left:t,right:r}:{left:r,right:t}}o(Gt,"S");var Ut=.25;function Je(i,e){let t=i[e],r=t===void 0?0:t.width*t.height;if(!(r>0))return 0;let s=0;return i.forEach((a,n)=>{n!==e&&a.width*a.height>=Ut*r&&(s+=1)}),s}o(Je,"f");var ue="/models-v3",Ft=["native","blaze"],F,de=(F=class extends Error{constructor(e){super(`no detector tier available (${e})`),this.name="DetectorLadderError",this.fallbackReason=e}},o(F,"x"),F);function te(i){let e=i;if(typeof e.videoWidth=="number"&&e.videoWidth>0)return{width:e.videoWidth,height:e.videoHeight??0};if(typeof e.naturalWidth=="number"&&e.naturalWidth>0)return{width:e.naturalWidth,height:e.naturalHeight??0};let t=typeof e.width=="number"?e.width:0,r=typeof e.height=="number"?e.height:0;return{width:t,height:r}}o(te,"y");function et(i,e,t,r){let s=te(e),a=s.width>0?t/s.width:1,n=s.height>0?r/s.height:1,l=o(c=>({x:c.x*a,y:c.y*n}),"s");return{box:{x:i.box.x*a,y:i.box.y*n,width:i.box.width*a,height:i.box.height*n},...i.eyes!==void 0?{eyes:{left:l(i.eyes.left),right:l(i.eyes.right)}}:{},...i.nose!==void 0?{nose:l(i.nose)}:{},score:i.score,...i.extraFaces!==void 0?{extraFaces:i.extraFaces}:{}}}o(et,"h");function Nt(i){return i instanceof Error?i.message:String(i)}o(Nt,"C");async function x(i){let e=i.preferred??Ft,t=[];for(let r of e){if(r==="native"){let s=await Ot();if(s.ok)return new Pt(s.instance,he(t));t.push(`native:${s.reason}`);continue}try{return await Lt(It.create(i.v3AssetBaseUrl??ue,he(t)),i.blazeInitTimeoutMs??At)}catch(s){t.push(s instanceof tt?"blaze:blaze_init_timeout":`blaze:${Nt(s)}`)}}throw new de(he(t)??"no_tier_available")}o(x,"O");function he(i){return i.length>0?i.join("; "):void 0}o(he,"v");var N,tt=(N=class extends Error{},o(N,"g"),N);function Lt(i,e){return new Promise((t,r)=>{let s=setTimeout(()=>{r(new tt(`init exceeded ${e}ms`)),i.then(a=>a.destroy(),()=>{})},e);i.then(a=>{clearTimeout(s),t(a)},a=>{clearTimeout(s),r(a)})})}o(Lt,"W");var C=1;function it(){return typeof OffscreenCanvas=="function"&&typeof createImageBitmap=="function"&&typeof Worker=="function"}o(it,"K");function Bt(i,e={}){let t=e.createDetector??x,r=null;i.onmessage=s=>{let a=s.data;if(a.v!==C){a.bitmap?.close?.();return}if(a.type==="init"){t(a.options).then(n=>{r=n;let l={v:C,type:"ready",tier:n.tier,...n.fallbackReason!==void 0?{fallbackReason:n.fallbackReason}:{}};i.postMessage(l)});return}if(a.type==="detect"){let n=o(l=>{let c={v:C,type:"result",id:a.id,observation:l};i.postMessage(c),a.bitmap.close?.()},"a");if(r===null){n(null);return}r.detect(a.bitmap,a.streamWidth,a.streamHeight).then(n,()=>n(null))}}}o(Bt,"B");typeof self<"u"&&typeof self.importScripts=="function"&&Bt(self);var P,rt=(P=class{constructor(e,t){this.pending=new Map,this.nextId=1,this.worker=e,this.tier=t.tier,t.fallbackReason!==void 0&&(this.fallbackReason=t.fallbackReason),e.addEventListener("message",r=>{let s=r.data;if(s.v!==C||s.type!=="result")return;let a=this.pending.get(s.id);this.pending.delete(s.id),a?.(s.observation)})}static create(e,t,r=1e4){return new Promise((s,a)=>{let n=setTimeout(()=>{e.removeEventListener("message",l),e.terminate(),a(new Error(`worker detector not ready within ${r}ms`))},r),l=o(h=>{let d=h.data;d.v!==C||d.type!=="ready"||(clearTimeout(n),e.removeEventListener("message",l),s(new P(e,d)))},"s");e.addEventListener("message",l);let c={v:C,type:"init",options:t};e.postMessage(c)})}async detect(e,t,r){let s;try{typeof ImageBitmap<"u"&&e instanceof ImageBitmap?s=e:typeof createImageBitmap=="function"?s=await createImageBitmap(e):s=e}catch{return null}let a=this.nextId;return this.nextId+=1,new Promise(n=>{this.pending.set(a,n);let l={v:C,type:"detect",id:a,bitmap:s,streamWidth:t,streamHeight:r};this.worker.postMessage(l,[s])})}destroy(){for(let e of this.pending.values())e(null);this.pending.clear(),this.worker.terminate()}},o(P,"t"),P);var qt=[...Ue.filter(i=>i.startsWith("video/mp4")),"video/webm;codecs=h264","video/webm;codecs=avc1","video/webm;codecs=vp8","video/webm;codecs=vp9","video/webm"],dt=new Set;function Wt(i){let e=/(?:Chrome|Chromium)\/(\d+)\./.exec(i??"");return e?Number(e[1]):null}o(Wt,"Pe");function zt(i=Kt(),e=globalThis.navigator?.userAgent){if(i===void 0)return"";let t=Wt(e)===126;for(let r of qt)if(!(dt.has(r)||t&&r.startsWith("video/mp4")))try{if(i(r))return r}catch{}return""}o(zt,"be");function st(i){i!==""&&dt.add(i)}o(st,"L");function Ht(i){return i.replace(/^video\/x-matroska/i,"video/webm")}o(Ht,"ye");function ft(i){let e=/codecs=["']?([^,;"']+)/i.exec(i);return e?e[1].trim():i.split(";")[0].trim()}o(ft,"lt");function Kt(){let i=globalThis.MediaRecorder;return i&&typeof i.isTypeSupported=="function"?e=>i.isTypeSupported(e):void 0}o(Kt,"xe");var pt=2500,Xt=1e3,Zt=1500,at=25e5,Vt=100,jt=700,$t=20,Yt=1500,ie=null;function Qt(){return ie??(ie=import("./clip-inspect-DLJXVKV6-TNHTD4LV.js").catch(i=>{throw ie=null,i})),ie.catch(()=>null)}o(Qt,"He");var B,D=(B=class extends Error{constructor(e,t){super(t??e),this.kind=e}},o(B,"T"),B),Jt=100;function nt(i,e){return i.stats===void 0?!1:i.stats===null?!0:i.stats.durationMs<e-Jt}o(nt,"N");function ei(i,e){return i.stats?e.stats?i.stats.durationMs>e.stats.durationMs:!0:!1}o(ei,"Ee");var q,ti=(q=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,t,r,s=pt,a){let n=zt(),l=Qt();return this.recordRaw(e,t,r,s,a,n).then(c=>ii(c,l),c=>{throw c instanceof D&&(c.requestedMimeType=n),c})}recordRaw(e,t,r,s,a,n){return this.recorder&&!this.settled?Promise.reject(new D("generic","record() called while a recording is in flight — 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((l,c)=>{let h;try{h=new MediaRecorder(e,n?{mimeType:n,videoBitsPerSecond:at}:{videoBitsPerSecond:at})}catch{try{h=new MediaRecorder(e)}catch{c(new D("unsupported"));return}}this.recorder=h;let d=o(g=>{this.settled||(this.settled=!0,this.clearTimers(),g())},"d"),u=o(()=>d(()=>{let g=Ht(h.mimeType||n||Fe),M=new Blob(this.chunks,{type:g});if(M.size===0){c(new D("generic","empty clip"));return}if(oe(M)){c(new D("cliptoolarge"));return}l({blob:M,mimeType:g,requestedMimeType:n})}),"u");h.ondataavailable=g=>{g.data&&g.data.size&&(this.chunks.push(g.data),this.bytes+=g.data.size,this.bytes>Be&&d(()=>{try{h.state!=="inactive"&&h.stop()}catch{}c(new D("cliptoolarge"))}))},h.onstop=u,h.onerror=()=>d(()=>c(new D("generic")));let m=this.now();if(r!==void 0||a!==void 0){let g=!1;h.onstart=()=>{if(!(g||this.settled)&&(g=!0,m=this.now(),r!==void 0))try{r()}catch{}}}try{h.start(Xt)}catch{d(()=>c(new D("generic")));return}let w=o(()=>{if(this.pollTimer&&clearInterval(this.pollTimer),this.pollTimer=null,this.hardStopTimer&&clearTimeout(this.hardStopTimer),this.hardStopTimer=null,this.settled||t?.(),h.state!=="inactive"){try{h.stop()}catch{u()}this.graceTimer=setTimeout(u,Zt)}else u()},"m"),p=this.now();if(a===void 0){this.hardStopTimer=setTimeout(w,s);return}let v=null,y=!1;this.hardStopTimer=setTimeout(w,s+jt),this.pollTimer=setInterval(()=>{if(this.settled||y)return;let g=null;try{g=a.latest()}catch{g=null}let M=g?.presentationTimeMs;M!==void 0&&Number.isFinite(M)&&M>=m&&v===null&&(v=M);let E=v!==null&&M!==void 0&&M-v>=s,A=v===null&&this.now()-p>=s;if(!(!E&&!A)){if(y=!0,this.pollTimer&&clearInterval(this.pollTimer),this.pollTimer=null,A){w();return}this.hardStopTimer&&clearTimeout(this.hardStopTimer),this.hardStopTimer=setTimeout(w,Vt)}},$t)}))}stop(e){this.clearTimers();let t=this.recorder;if(t&&t.state!=="inactive")try{t.stop()}catch{}this.recorder=null,(e??this.stream)?.getTracks().forEach(r=>r.stop()),this.stream=null}},o(q,"A"),q);async function ii(i,e){let t,r=new Promise(h=>{t=setTimeout(()=>h(null),Yt)}),s=await Promise.race([e,r]);if(clearTimeout(t),s===null)return i;let a;try{a=await s.blobBytes(i.blob)}catch{return{...i,stats:null}}let n=s.inspectClipBytes(a);if(n?.container!=="webm")return{...i,stats:n};let l=s.withWebmDuration(a,n.durationMs);if(l===null)return{...i,stats:n};let c=s.inspectClipBytes(l);return c===null||c.frames!==n.frames||c.durationMs!==n.durationMs?{...i,stats:n}:{...i,blob:new Blob([l],{type:i.blob.type}),stats:n}}o(ii,"Be");function ri(i,e,t=.92){return new Promise((r,s)=>{let a=i.videoWidth,n=i.videoHeight;if(!a||!n){s(new Error("video-not-ready"));return}let l=e.getContext("2d");if(!l){s(new Error("no-2d-context"));return}e.width=a,e.height=n,l.scale(-1,1),l.drawImage(i,-a,0),e.toBlob(c=>c?r(c):s(new Error("empty-keyframe")),"image/jpeg",t)})}o(ri,"Me");var W,si=(W=class{constructor(e){this.timer=null,this.frameCallbackId=null,this.running=!1,this.busy=!1,this.lastRunAt=Number.NEGATIVE_INFINITY,this.degradeCount=0,this.durations=[],this.options=e,this.periodMs=1e3/e.cadenceHz}start(){if(this.running)return;this.running=!0;let e=this.options.video;if(typeof e?.requestVideoFrameCallback=="function"){let t=o(()=>{this.running&&(this.frameCallbackId=e.requestVideoFrameCallback?.(()=>{this.frameCallbackId=null,this.now()-this.lastRunAt>=this.periodMs&&this.tick(),t()}))},"t");t();return}this.timer=setInterval(()=>this.tick(),this.periodMs)}stop(){this.running=!1,this.timer!==null&&(clearInterval(this.timer),this.timer=null),this.frameCallbackId!==null&&(this.options.video?.cancelVideoFrameCallback?.(this.frameCallbackId),this.frameCallbackId=null)}stats(){let e=this.durations.length===0?0:this.durations.reduce((t,r)=>t+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()})}},o(W,"D"),W),ai=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}),L=o(i=>Math.min(1,Math.max(0,i)),"C"),z,ot=(z=class{constructor(e={}){this.p=0,this.lastTickAt=null,this.lastCenter=null,this.velocityEma=0,this.qWindow=[],this.lastSizeDirection="ideal",this.t={...ai,...e}}reset(){this.p=0,this.lastTickAt=null,this.lastCenter=null,this.velocityEma=0,this.qWindow=[],this.lastSizeDirection="ideal"}tick(e){let{observation:t,quality:r,timestampMs:s}=e,a=this.lastTickAt===null?0:Math.max(0,(s-this.lastTickAt)/1e3);this.lastTickAt=s;let n={presence:0,single:1,centering:0,size:0,pose:0,sharpness:L(r.sharpness),exposure:L(r.exposure),motion:1};if(t!==null){n.presence=1,n.single=(t.extraFaces??0)>0?0:1;let d=this.geometryOf(t,e);n.centering=d.centering,n.size=d.size,n.pose=d.pose,n.motion=this.motionOf(d.center,d.iod,s)}else this.lastCenter=null,this.velocityEma=0;let l=Math.min(n.presence,n.single,n.centering,n.size,n.pose,n.sharpness,n.exposure,n.motion);this.p=L(this.p+(l>=this.t.Q_GOOD?this.t.RISE_PER_S*l:-this.t.FALL_PER_S*(1-l))*a),this.qWindow.push({at:s,q:l}),this.qWindow=this.qWindow.filter(d=>d.at>=s-this.t.READY_WINDOW_MS);let c=this.qWindow.map(d=>d.q);if(c.length>=3){let d=Math.min(...c),u=c.indexOf(d);c=c.filter((m,w)=>w!==u)}let h=this.p>=1&&c.every(d=>d>=this.t.Q_GOOD);return{at:s,q:l,p:this.p,factors:n,guidanceKey:this.guidanceOf(n,r,l),ready:h,accepted:l>=this.t.Q_GOOD}}geometryOf(e,t){let{box:r,eyes:s}=e,a={x:t.frameWidth/2,y:t.frameHeight/2},n=Math.min(t.frameWidth,t.frameHeight),l=s!==void 0?{x:(s.left.x+s.right.x)/2,y:(s.left.y+s.right.y)/2}:{x:r.x+r.width/2,y:r.y+r.height/2-this.t.BOX_EYE_OFFSET_FACTOR*r.height},c=s!==void 0?Math.hypot(s.right.x-s.left.x,s.right.y-s.left.y):this.t.IOD_BOX_PROXY_FACTOR*r.width,h=Math.hypot(l.x-a.x,l.y-a.y),d=c<=0?0:1-L(h/(this.t.CENTER_FALLOFF_IOD_MULTIPLE*c)),u=n>0?c/n:0;this.lastSizeDirection=u<this.t.SIZE_IDEAL_MIN?"far":u>this.t.SIZE_IDEAL_MAX?"close":"ideal";let m;u<this.t.SIZE_HARD_MIN||u>this.t.SIZE_HARD_MAX?m=0:u<this.t.SIZE_IDEAL_MIN?m=(u-this.t.SIZE_HARD_MIN)/(this.t.SIZE_IDEAL_MIN-this.t.SIZE_HARD_MIN):u>this.t.SIZE_IDEAL_MAX?m=(this.t.SIZE_HARD_MAX-u)/(this.t.SIZE_HARD_MAX-this.t.SIZE_IDEAL_MAX):m=1;let w=1;if(s!==void 0){let p=Math.abs(Math.atan2(s.right.y-s.left.y,s.right.x-s.left.x))*180/Math.PI;w=1-L(p/this.t.ROLL_MAX_DEG)}return{center:l,iod:c,centering:d,size:m,pose:w}}motionOf(e,t,r){let s=this.lastCenter;if(this.lastCenter={...e,at:r},s===null||t<=0)return 1;let a=(r-s.at)/1e3;if(a<=0)return 1;let n=Math.hypot(e.x-s.x,e.y-s.y)/t/a;n<=this.t.MOTION_DEADBAND_IOD_PER_S&&(n=0);let l=1-Math.exp(-a/this.t.MOTION_TAU_S);return this.velocityEma=l*n+(1-l)*this.velocityEma,1-L(this.velocityEma/this.t.MOTION_VELOCITY_IOD_PER_S)}guidanceOf(e,t,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(t);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 s=[["size",this.sizeGuidance()],["centering","fcv3.center_face"],["pose","fcv3.straighten"],["exposure",this.exposureGuidance(t)],["sharpness","fcv3.steady_camera"],["motion","fcv3.hold_still"]],a=s[0];for(let n of s)e[n[0]]<e[a[0]]&&(a=n);return a[1]}return"fcv3.hold_still"}sizeGuidance(){return this.lastSizeDirection==="far"?"fcv3.come_closer":"fcv3.move_back"}exposureGuidance(e){let t=(le[0]+le[1])/2;return e.meanLuma<t?"fcv3.more_light":"fcv3.too_bright"}},o(z,"_"),z),ni=["single","size","centering","pose","exposure","sharpness","motion"];function oi(i){if(i.accepted)return null;if(i.factors.presence<=0)return"no_face";let e="single";for(let t of ni)i.factors[t]<i.factors[e]&&(e=t);return e}o(oi,"ze");var H,lt=(H=class{constructor(){this.blocked={},this.acceptedMs=0,this.ticks=0,this.lastAt=null}record(e){let t=this.lastAt===null?0:Math.max(0,e.at-this.lastAt);this.lastAt=e.at,this.ticks+=1;let r=oi(e);if(r===null){this.acceptedMs+=t;return}let s=this.blocked[r]??{count:0,ms:0};s.count+=1,s.ms+=t,this.blocked[r]=s}summary(){let e={};for(let[t,r]of Object.entries(this.blocked))e[t]={count:r.count,ms:Math.round(r.ms)};return{blocked:e,acceptedMs:Math.round(this.acceptedMs),ticks:this.ticks}}},o(H,"w"),H),li=["obs","manycam","virtual","snap camera","xsplit","droidcam","iriun","camo","fake_device","fake-capture-device"],ci=[/^(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 hi(i){let e=(i??"").trim().toLowerCase();return e.length===0?"unknown":li.some(t=>e.includes(t))?"known_virtual":ci.some(t=>t.test(e))?"platform":"unknown"}o(hi,"Qe");function ct(i){if(typeof i!="function")return!1;try{return/\{\s*\[native code\]\s*\}\s*$/.test(Function.prototype.toString.call(i))}catch{return!1}}o(ct,"Ce");function ui(i=globalThis){return ct(i.navigator?.mediaDevices?.getUserMedia)&&ct(i.MediaStreamTrack?.prototype?.getSettings)}o(ui,"Ye");async function di(i,e=globalThis){let t=e.crypto?.subtle?.digest;if(typeof t=="function")try{let r=new Uint8Array(await t.call(e.crypto?.subtle,"SHA-256",new TextEncoder().encode(i)));return Array.from(r.subarray(0,8),s=>s.toString(16).padStart(2,"0")).join("")}catch{return}}o(di,"je");async function fi(i,e=globalThis){let t={};try{t=typeof i.getSettings=="function"?i.getSettings()??{}:{}}catch{t={}}let r={};if((t.facingMode==="user"||t.facingMode==="environment"||t.facingMode==="left"||t.facingMode==="right")&&(r.facingMode=t.facingMode),typeof t.frameRate=="number"&&Number.isFinite(t.frameRate)&&(r.frameRate=t.frameRate),typeof t.width=="number"&&Number.isFinite(t.width)&&(r.width=t.width),typeof t.height=="number"&&Number.isFinite(t.height)&&(r.height=t.height),typeof t.deviceId=="string"&&t.deviceId.length>0){let a=await di(t.deviceId,e);a!==void 0&&(r.deviceIdHash=a)}let s;try{s=i.label}catch{s=void 0}return{trackSettings:r,capabilitiesPresent:typeof i.getCapabilities=="function",labelClass:hi(s),prototypesIntact:ui(e)}}o(fi,"Se");var fe=o(i=>Math.round(i*100)/100,"U");function pi(i){let e=i,t=typeof e?.requestVideoFrameCallback=="function",r=null,s=null,a=0,n=0,l=0,c=0,h=0,d=0,u=o(()=>{!t||e?.requestVideoFrameCallback===void 0||(r=e.requestVideoFrameCallback((m,w)=>{if(r=null,!t)return;let p=w.presentationTime;if(s!==null){let v=p-s.presentationTimeMs;n+=1;let y=v-l;l+=y/n,c+=y*(v-l)}typeof w.captureTime=="number"&&Number.isFinite(w.captureTime)&&(h+=p-w.captureTime,d+=1),a+=1,s={mediaTimeMs:w.mediaTime*1e3,presentationTimeMs:p},u()}))},"u");return u(),{latest:o(()=>s,"latest"),stats:o(()=>({n:a,meanGapMs:n===0?0:fe(l),stdGapMs:n<2?0:fe(Math.sqrt(c/(n-1))),captureLatencyMs:d===0?null:fe(h/d)}),"stats"),stop:o(()=>{t&&(t=!1,r!==null&&e?.cancelVideoFrameCallback?.(r),r=null)},"stop")}}o(pi,"ke");function mi(i,e,t){return{...i,rvfc:e,rampPainter:t}}o(mi,"_e");var gi=1e3,pe="fcv3.hold_upright",vi=200,me=4,yi=600,wi=1e3,ht={sharpness:1,exposure:1,meanLuma:128};function bi(i,e){return e.width=i.videoWidth,e.height=i.videoHeight,e.getContext("2d").drawImage(i,0,0),new Promise((t,r)=>e.toBlob(s=>s?t(s):r(new Error("empty-keyframe")),"image/jpeg",.92))}o(bi,"rt");function Mi(){return Q()==="phone"}o(Mi,"it");var K,mt=(K=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,t){let r=this.handlers.get(e);return r||(r=new Set,this.handlers.set(e,r)),r.add(t),()=>r?.delete(t)}emit(e,t){for(let r of[...this.handlers.get(e)??[]])r(t)}async start(e={}){e.facingMode!==void 0&&(this.facing=e.facingMode),this.attempt+=1,await this.run(this.attempt)}get facingMode(){return this.facing}retry(){this.teardownAttempt(),this.start()}switchCamera(){this.facing=this.facing==="user"?"environment":"user",this.teardownAttempt(),this.start()}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:t}=this;this.fired=!1,this.lastGuidanceKey=null,this.carriedDegrade=0,this.carriedMeans=[],this.cameraRequestedAt=null,this.cameraReadyAt=null,this.faceAcquiredAt=null,this.captureCompleteAt=null,this.uprightGuard=(t.isPhone??Mi)(),this.setState("preflight");let r=Ne();if(r!=="OK"){this.fail(r==="INSECURE_CONTEXT"?"insecure":"unsupported",{phase:"preflight"});return}this.setState("acquiring");let s=t.getUserMedia??(h=>navigator.mediaDevices.getUserMedia(h)),a;this.cameraRequestedAt=this.now();try{let{facingMode:h,...d}=Se(Ae(),this.facing).video;a=await Ke(this.facing,d,{getUserMedia:s,enumerateDevices:_i(t)})}catch(h){if(e!==this.attempt)return;if(h instanceof He){this.fail("backcamera",{phase:"acquiring",name:j(h)});return}this.fail(We(h),{phase:"acquiring",name:j(h)});return}if(Re(a),ze(a),e!==this.attempt){for(let h of a.getTracks())h.stop();return}this.stream=a;let n=a.getVideoTracks?.()[0];if(this.trackProvenance=n===void 0?null:fi(n).catch(()=>null),this.openEnvironment=n===void 0?null:xe(n).catch(()=>({})),this.facing=Ie(a)??this.facing,t.video.srcObject=a,await t.video.play().catch(()=>{}),e!==this.attempt)return;if(this.cameraReadyAt=this.now(),this.detector===null){let h={v3AssetBaseUrl:t.v3AssetBaseUrl},d=t.createDetector??(t.createWorker!==void 0&&it()?async()=>{try{return await rt.create(t.createWorker(),h)}catch{return x(h)}}:()=>x(h)),u;try{u=await d()}catch(m){e===this.attempt&&this.fail("models",{phase:"models",name:j(m)},m instanceof de?m.fallbackReason:Ti(m));return}if(e!==this.attempt){u.destroy();return}this.detector=u,this.options.telemetry?.({type:"detector",tier:u.tier,fallbackReason:u.fallbackReason})}let l=Xe(),c=t.deviceClass??Ze(l);this.profiler=new Ve(c),this.options.telemetry?.({type:"profile",staticClass:c,activeClass:this.profiler.deviceClass,simd:l.simd}),this.gate=new ot(t.thresholds??{}),this.blockStats=new lt,this.lastGateSnapshotAt=this.now(),t.rankKeyframes?.()&&import("./keyframe-rank-YAJLYJYF-WCA6RPMD.js").then(h=>ge=h,()=>{}),this.setState("positioning"),this.positioningStartedAt=this.now(),this.startScheduler(e)}get animations(){return this.profiler?.profile.animations??"full"}startScheduler(e){let t=this.profiler;if(t===null)return;if(this.scheduler!==null){let s=this.scheduler.stats();this.carriedDegrade+=s.degradeCount,s.meanDetectMs>0&&this.carriedMeans.push(s.meanDetectMs),this.scheduler.stop()}let r=new si({cadenceHz:t.profile.cadenceHz,video:this.options.video,now:this.options.now,run:o(()=>this.detectTick(e),"run")});this.scheduler=r,r.start()}async detectTick(e){let{detector:t,gate:r,profiler:s}=this,a=this.options.video;if(e!==this.attempt||t===null||r===null||s===null||this.fired||a.videoWidth===0)return;if(this.isLandscape()){this.holdUpright(e);return}let n=s.deviceClass,l=this.now(),c=this.options.makeSnapshot?.(a,s.profile.inputWidth)??this.defaultSnapshot(a,s.profile.inputWidth),h=null;try{h=await t.detect(c,a.videoWidth,a.videoHeight)}catch{h=null}if(e!==this.attempt||this.fired)return;s.record(this.now()-l),s.deviceClass!==n&&this.startScheduler(e);let d=h===null?ht:this.options.measureQuality?.(a,h.box)??this.defaultQuality(a,h.box),u=r.tick({timestampMs:this.now(),observation:h,quality:d,frameWidth:a.videoWidth,frameHeight:a.videoHeight});u.accepted&&this.faceAcquiredAt===null&&(this.faceAcquiredAt=u.at),this.blockStats?.record(u),!u.ready&&u.at-this.lastGateSnapshotAt>=gi&&(this.lastGateSnapshotAt=u.at,this.reportGate(!1)),this.emit("checks",{engine:"v3",progress:u.p,q:u.q,factors:u.factors,attempt:e}),u.guidanceKey!==this.lastGuidanceKey&&(this.lastGuidanceKey=u.guidanceKey,this.emit("guidance",{key:u.guidanceKey})),u.ready&&this.stateValue==="positioning"&&(this.fired=!0,this.captureCompleteAt=u.at,this.fire(e))}async fire(e){let{options:t}=this,r=this.scheduler;r?.stop(),this.reportGate(!0);let s=r?.stats()??{degradeCount:0,meanDetectMs:0},a=[...this.carriedMeans,...s.meanDetectMs>0?[s.meanDetectMs]:[]];t.telemetry?.({type:"fired",timeToGateMs:this.now()-this.positioningStartedAt,degradeCount:this.carriedDegrade+s.degradeCount,meanDetectMs:a.length===0?0:a.reduce((_,b)=>_+b,0)/a.length});let n=t.mode??"clip",l=t.rankKeyframes?.()&&ge?ge.default(this,e).catch(()=>this.collectKeyframes(e)):this.collectKeyframes(e);if(n==="photo"){let _=this.watchRotation(e,null),b=await l;if(_(),e!==this.attempt)return;if(b===null){this.fail("generic",{phase:"keyframes"});return}let R=await this.provenance({n:0,meanGapMs:0,stdGapMs:0,captureLatencyMs:null},!1);if(e!==this.attempt)return;this.finishCapture({keyframe:b.blob,previewDataUrl:b.previewDataUrl,...R});return}this.setState("recording");let c=this.stream;if(c===null){this.fail("generic",{phase:"recording"});return}let h=t.screenRamp?.(),d=ee(h),u=null;l.then(_=>{u=_},()=>{});let m=o(()=>{e===this.attempt&&u!==null&&this.emit("frozen",{previewDataUrl:u.previewDataUrl})},"p"),w=Ye(h,pt),p=null,v,y=0;try{let _=this.recordTake(e,c,h,w,void 0).then(S=>S,S=>({failed:S})),[b,R]=await Promise.all([_,l]);if(v=R,e!==this.attempt)return;if("failed"in b){if(b.failed.kind==="cliptoolarge")throw b.failed;st(b.failed.requestedMimeType??"")}else p=b,nt(b.clip,w)?b.clip.stats===null&&st(b.clip.requestedMimeType??""):m();if(p===null||nt(p.clip,w)){y=1,t.telemetry?.({type:"clip_retake",reason:p===null?"error":p.clip.stats===null?"unreadable":"short"});let S=null;try{S=await this.recordTake(e,c,h,w,m)}catch($){if(p===null)throw $}if(e!==this.attempt)return;S!==null&&(p===null||ei(S.clip,p.clip))&&(p=S),S===null&&m()}}catch(_){if(e!==this.attempt)return;let b=_.kind;this.fail(b==="cliptoolarge"?"cliptoolarge":"recorder",{phase:"recording",name:j(_)});return}if(p===null){this.fail("recorder",{phase:"recording"});return}let{clip:g,rvfc:M,report:E,watched:A}=p;if(oe(g.blob)){this.fail("cliptoolarge",{phase:"recording"});return}if(v===null){this.fail("generic",{phase:"keyframes"});return}let I=await this.provenance(M,d,A);e===this.attempt&&this.finishCapture({clip:g.blob,clipMimeType:g.mimeType,...g.stats?{clipStats:g.stats}:{},clipRetakes:y,keyframe:v.blob,previewDataUrl:v.previewDataUrl,...E!==void 0&&E.rendered.length>0?{screenRamp:E}:{},...I})}async recordTake(e,t,r,s,a){let n=this.options.createRecorder?.()??new ti({now:o(()=>this.now(),"now")}),l=pi(this.options.video),c=Qe(r,{paint:o(m=>{(m===null||e===this.attempt)&&this.emit("ramp",{colour:m})},"paint"),now:o(()=>this.now(),"now"),frames:l.latest});this.ramp=c;let h=o(()=>{l.stop(),c.stop(),this.ramp===c&&(this.ramp=null)},"l"),d=this.watchRotation(e,n),u=De();try{return{clip:await n.record(t,a,()=>c.started(this.now()),s,l),rvfc:l.stats(),report:c.report(),watched:u.stop()}}finally{u.stop(),d(),h()}}async provenance(e,t,r={}){let s=this.trackProvenance;if(s===null)return{};let a,n=new Promise(d=>{a=setTimeout(()=>d(null),wi)}),l=await Promise.race([s,n]),c=l===null?null:await Promise.race([this.openEnvironment,n]);if(clearTimeout(a),l===null)return{};let h={...c,...r};return{provenance:{...mi(l,e,t),...Object.keys(h).length>0?{env:h}:{}}}}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!==pe&&(this.lastGuidanceKey=pe,this.emit("guidance",{key:pe}))}watchRotation(e,t){if(!this.uprightGuard)return()=>{};let r=this.options.video,s=o(()=>{if(e!==this.attempt||t!==null&&this.stateValue!=="recording"){l();return}r.videoWidth>0&&this.isLandscape()&&(l(),this.abortRecording(e,t))},"i"),a=setInterval(s,vi);r.addEventListener?.("resize",s);let n=!1;function l(){n||(n=!0,clearInterval(a),r.removeEventListener?.("resize",s))}return o(l,"o"),l}abortRecording(e,t){if(e!==this.attempt)return;this.attempt+=1;let r=this.attempt;try{t?.stop()}catch{}this.ramp?.stop(),this.ramp=null,this.fired=!1,this.captureCompleteAt=null,this.gate=new ot(this.options.thresholds??{}),this.blockStats=new lt,this.lastGateSnapshotAt=this.now(),this.lastGuidanceKey=null,this.setState("positioning"),this.positioningStartedAt=this.now(),this.holdUpright(r),this.startScheduler(r)}async collectKeyframes(e){let t=this.options.captureKeyframe??(a=>this.defaultKeyframe(a)),r=yi/(me-1),s=null;for(let a=0;a<me;a+=1){if(e!==this.attempt)return s;try{let n=await t(this.options.video);(s===null||n.sharpness>s.sharpness)&&(s=n)}catch{}a<me-1&&await ki(r)}return s}finishCapture(e){this.stopTracks(),this.setState("captured");let t=this.captureTiming();this.emit("artifacts",t===void 0?e:{...e,timing:t})}captureTiming(){let e={},t=o((r,s,a)=>{s!==null&&a!==null&&(e[r]=Math.max(0,Math.round(a-s)))},"t");return t("cameraReadyMs",this.cameraRequestedAt,this.cameraReadyAt),t("faceAcquireMs",this.cameraReadyAt,this.faceAcquiredAt),t("captureMs",this.faceAcquiredAt,this.captureCompleteAt),Object.keys(e).length>0?e:void 0}async defaultKeyframe(e){let t=document.createElement("canvas"),r=await(this.facing==="user"?ri:bi)(e,t),s=t.toDataURL("image/jpeg",.92);return{blob:r,previewDataUrl:s,sharpness:this.centerSharpness(e)}}defaultSnapshot(e,t){try{let r=this.snapshotCanvas??document.createElement("canvas"),s=t/Math.max(1,e.videoWidth),a=Math.max(1,Math.round(e.videoWidth*s)),n=Math.max(1,Math.round(e.videoHeight*s)),l=r.getContext("2d");return l===null?e:(r.width!==a&&(r.width=a),r.height!==n&&(r.height=n),l.drawImage(e,0,0,a,n),this.snapshotCanvas=r,r)}catch{return e}}defaultQuality(e,t){let r=ut(e,t,96);return r===null?ht:{sharpness:ce(r),exposure:$e(r),meanLuma:je(r)}}centerSharpness(e){let t=te(e),r=ut(e,{x:t.width*.25,y:t.height*.25,width:t.width*.5,height:t.height*.5},96);return r===null?0:ce(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 t=this.blockStats,r=this.profiler;if(t===null||r===null)return;let s=t.summary();e&&(this.blockStats=null),s.ticks!==0&&this.options.telemetry?.({type:"gate",final:e,activeClass:r.deviceClass,cadenceHz:r.profile.cadenceHz,...s})}stopTracks(){if(this.stream!==null){for(let e of this.stream.getTracks())e.stop();this.stream=null}}fail(e,t,r){this.scheduler?.stop(),this.reportGate(!0),this.stopTracks(),this.setState("error"),this.options.telemetry?.({type:"error",kind:e,fallbackReason:r});let{phase:s,name:a}=t;this.emit("error",{kind:e,retryable:e!=="insecure"&&e!=="unsupported",detail:a===void 0?{phase:s}:{phase:s,name:a}})}setState(e){this.stateValue=e,this.emit("statechange",{state:e})}now(){return this.options.now?.()??performance.now()}},o(K,"Ie"),K),ge;function ki(i){return new Promise(e=>setTimeout(e,i))}o(ki,"nt");function Ti(i){return i instanceof Error?i.message:String(i)}o(Ti,"at");function ut(i,e,t){try{let r=document.createElement("canvas"),s=t/Math.max(1,e.width);r.width=Math.max(1,Math.round(e.width*s)),r.height=Math.max(1,Math.round(e.height*s));let a=r.getContext("2d");return a===null?null:(a.drawImage(i,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}}o(ut,"Re");function _i(i){if(i.enumerateDevices!==void 0)return i.enumerateDevices;if(i.getUserMedia===void 0&&!(typeof navigator>"u"||typeof navigator.mediaDevices?.enumerateDevices!="function"))return()=>navigator.mediaDevices.enumerateDevices()}o(_i,"st");var Ei=12e4,gt=13e4,Si=3e3,Ai=1200,ve=Symbol.for("@sekyro/web.preload.v1");function we(){let i=globalThis;return i[ve]??(i[ve]=new Map),i[ve]}o(we,"h");function re(i){let e=(i??ue).replace(/\/+$/,"");return e===""?"/":e}o(re,"b");function yt(i){let e=we(),t=e.get(i);return t===void 0&&(t={status:"idle",promise:null,scheduled:null,detectorPromise:null,detector:null,listeners:new Set},e.set(i,t)),t}o(yt,"ae");function ye(i,e){if(i.status!==e){i.status=e;for(let t of[...i.listeners])t(e)}}o(ye,"k");var Ii=o(i=>x({preferred:["blaze"],v3AssetBaseUrl:i,blazeInitTimeoutMs:Ei}),"K"),xi=Ii;function Di(){return typeof window<"u"&&typeof navigator<"u"&&typeof navigator.mediaDevices?.getUserMedia=="function"}o(Di,"Ce");function Ri(){return navigator.connection?.saveData===!0}o(Ri,"Se");function Ci(i){let e=window;if(typeof e.requestIdleCallback=="function"){let r=e.requestIdleCallback(i,{timeout:Si});return()=>e.cancelIdleCallback?.(r)}let t=setTimeout(i,Ai);return()=>clearTimeout(t)}o(Ci,"Ee");function Oi(i,e){let t,r=new Promise(l=>{t=l}),s=!1,a=o(()=>{},"u"),n={promise:r,settle:o(l=>{s||(s=!0,a(),i.scheduled===n&&(i.scheduled=null),t(l))},"settle")};return i.scheduled=n,a=Ci(()=>{s||n.settle(be(i,e))}),r}o(Oi,"ye");function be(i,e){if((i.status==="loading"||i.status==="ready")&&i.promise!==null)return i.promise;ye(i,"loading");let t=new Promise(n=>n(xi(e)));i.detectorPromise=t;let r,s=new Promise((n,l)=>{r=setTimeout(()=>{t.then(c=>c.destroy(),()=>{}),l(new Error(`detector preload exceeded ${gt} ms`))},gt)}),a=Promise.race([t,s]).then(n=>i.detectorPromise!==t?(n.destroy(),i.status):(i.detector=n,ye(i,"ready"),"ready"),n=>(i.detectorPromise===t&&(i.detectorPromise=null,i.detector=null,ye(i,"failed"),console.warn("[@sekyro/web] face-detector preload failed:",n)),i.status)).finally(()=>clearTimeout(r));return i.promise=a,i.scheduled?.settle(a),a}o(be,"U");function hr(i={}){if(!Di())return Promise.resolve("idle");let e=re(i.assetBaseUrl),t=yt(e);return i.respectSaveData===!0&&Ri()?Promise.resolve(t.status):(t.status==="loading"||t.status==="ready")&&t.promise!==null?t.promise:i.idle===!0?t.scheduled?.promise??Oi(t,e):be(t,e)}o(hr,"xe");function ur(i){return we().get(re(i))?.status??"idle"}o(ur,"Fe");function dr(i,e){let t=yt(re(e));return t.listeners.add(i),()=>{t.listeners.delete(i)}}o(dr,"Ie");function Pi(i){return{get tier(){return i.tier},get fallbackReason(){return i.fallbackReason},detect:o((...e)=>i.detect(...e),"detect"),destroy:o(()=>{},"destroy")}}o(Pi,"Le");function Gi(i){let e=re(i),t=we().get(e);if(!(t===void 0||t.detector===null&&t.detectorPromise===null&&t.scheduled===null))return async()=>{t.scheduled!==null&&be(t,e);let r=t.promise;for(;t.detector===null&&r!==null&&(await r,t.promise!==r);)r=t.promise;return t.detector!==null?Pi(t.detector):x({v3AssetBaseUrl:e})}}o(Gi,"de");var Ui=new Set(["inuse","overconstrained","notfound"]),Fi=[500,1500];function Ni(i){switch(i){case"fcv3.no_face":case"fcv3.center_face":case"fcv3.straighten":return"center";case"fcv3.come_closer":return"closer";case"fcv3.move_back":return"farther";case"fcv3.more_light":case"fcv3.too_bright":return"light";case"fcv3.hold_still":case"fcv3.steady_camera":return"still";case"fcv3.hold_upright":return"upright";case"fcv3.one_face":return"one_face";default:return null}}o(Ni,"Ae");function Li(i){switch(i){case"preflight":case"acquiring":return"starting";case"positioning":return"gating";default:return i}}o(Li,"Pe");function vt(i){switch(i){case"permission":case"notfound":case"inuse":case"insecure":case"unsupported":return i;case"backcamera":return"notfound";default:{let e=i;return"generic"}}}o(vt,"ue");function Bi(i,e,t){if(t===void 0)return{kind:vt(i),retryable:e};let r=qe(t.name);return{kind:vt(i),retryable:e,detail:{...r!==void 0?{name:r}:{},phase:t.phase,engineKind:i}}}o(Bi,"we");var qi=new Set(["captured","uploading","checking"]);function Wi(i,e={},t,r=()=>"self",s=()=>{},a){let n=e.now??(()=>performance.now()),l=e.canChooseFacing??Oe,c="user",h=Pe(),d=r(),u=Ce(),m=!Le(),w=e.engineOptions,p=w?.createDetector===void 0&&w?.createWorker===void 0?{createDetector:o(()=>{let f=Gi(i.assetBaseUrl);return f!==void 0?f():x({v3AssetBaseUrl:i.assetBaseUrl})},"createDetector")}:{},v={video:i.video,mode:m?"photo":"clip",rankKeyframes:t,facingMode:void 0,v3AssetBaseUrl:i.assetBaseUrl,screenRamp:o(()=>d==="self"&&u.count("ramp")>0?s():void 0,"screenRamp"),...e.engineOptions??{},...p},y=e.createEngine?.(v)??new mt(v),g="idle",M=null,E=0,A=!1,I="full",_=null,b=null,R=0,S=0,$=o(()=>{i.video.videoWidth>0&&i.video.videoHeight>0&&(R=i.video.videoWidth,S=i.video.videoHeight)},"W"),Me=Ge({enabled:i.keepScreenAwake!==!1}),X=o(f=>{g=f,Me.setActive(f==="starting"||f==="gating"||f==="recording"),u.emit("state",f)},"S"),se=o(()=>u.emit("gate",{progress:E,hint:M,faceDetected:A}),"F"),ae=o(()=>{let f=y.animations??"full";f!==I&&(I=f,u.emit("profile",{animations:I}))},"I"),G=0,Y=null,wt=e.schedule??((f,k)=>{let T=setTimeout(f,k);return()=>clearTimeout(T)}),Z=o(()=>{Y?.(),Y=null},"E"),bt=o((f,k)=>{if(V||!Ui.has(f)||k?.phase!=="acquiring")return!1;let T=Fi[G];return T===void 0?!1:(G+=1,Z(),Y=wt(()=>{Y=null,V||y.retry()},T),!0)},"fe"),Mt=[y.on("statechange",({state:f})=>{if(f==="error")return;let k=Li(f);k==="gating"&&(G=0),k==="starting"&&g!=="starting"&&(M=null,E=0,A=!1,_=null,b=null,R=0,S=0),X(k),ae(),k==="recording"&&($(),_=n(),M="hold",E=1,se())}),y.on("checks",f=>{$(),E=f.progress,A=f.factors.presence>0,se(),ae()}),y.on("guidance",({key:f})=>{M=Ni(f),se()}),y.on("frozen",({previewDataUrl:f})=>{b=n(),u.emit("frozen",{previewDataUrl:f})}),y.on("ramp",f=>u.emit("ramp",f)),y.on("artifacts",f=>{if(g!=="captured")return;let k=Q(),T=f.clipStats,_e=T!==void 0?Math.round(T.durationMs):_!==null&&b!==null?Math.max(0,Math.round(b-_)):void 0,Ee=T!==void 0&&T.frames>1&&T.durationMs>0?Math.round(T.frames*1e4/T.durationMs)/10:void 0;u.emit("captured",{keyframe:f.keyframe,...f.clip!==void 0?{clip:f.clip}:{},...f.clipMimeType!==void 0?{clipMime:f.clipMimeType}:{},width:i.video.videoWidth||R,height:i.video.videoHeight||S,..._e!==void 0?{clipMs:_e}:{},...T!==void 0?{clipFrames:T.frames}:{},...Ee!==void 0?{fps:Ee}:{},...f.clipRetakes!==void 0?{clipRetakes:f.clipRetakes}:{},...f.clipMimeType!==void 0?{codec:ft(f.clipMimeType)}:{},captureChannel:k==="desktop"?"desktop":"mobile",formFactor:k,...m?{degraded:"NO_RECORDER"}:{},engine:"v3",facingMode:y.facingMode,mode:d,...f.timing,...f.screenRamp!==void 0?{screenRamp:f.screenRamp}:{},...f.provenance!==void 0?{provenance:f.provenance}:{}})}),y.on("error",({kind:f,retryable:k,detail:T})=>{f==="backcamera"&&kt()||bt(f,T)||(X("error"),ae(),u.emit("error",Bi(f,k,T)))})],ke=!1;function kt(){return V||ke||d!=="assisted"||a===void 0||a.session()!=="choice"?!1:(ke=!0,a.onModeChange("self"),d="self",c=ne("self"),X("mode_switch"),y.restart(c),!0)}o(kt,"me");let Te=o(async()=>a!==void 0&&a.session()==="choice"&&await l().catch(()=>!1),"$"),V=!1;return{handle:{get state(){return g},get captureMode(){return r()},get facingMode(){return y.facingMode??c},on:o((f,k)=>u.on(f,k),"on"),start:o(f=>(d=r(),h.facing(d,i.facing),c=h.facing(d,f?.facing),Z(),G=0,y.start({facingMode:c})),"start"),retry:o(()=>{Z(),G=0,y.retry()},"retry"),switchCamera:o(()=>h.refuseSwitch(r()),"switchCamera"),canSwitchCaptureMode:Te,setCaptureMode:o(async f=>{if(f===r()||!await Te()||V||qi.has(g)||a===void 0)return!1;a.onModeChange(f),d=f;let k=ne(f);return c=k,g==="idle"||(X("mode_switch"),Z(),G=0,y.restart(k)),!0},"setCaptureMode"),destroy:o(()=>{V=!0,Z();for(let f of Mt)f();Me.setActive(!1),y.destroy(),u.clear()},"destroy")},setFlowState:o(f=>{g!==f&&X(f)},"setFlowState")}}o(Wi,"De");function fr(i){return Wi(i).handle}o(fr,"Ze");export{zi as a,ee as b,hr as c,ur as d,dr as e,Bi as f,Wi as g,fr as h};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{d as I}from"./chunk-YR7GTH7M.js";import{a as C,b as P,c as H}from"./chunk-IHKI3APK.js";import{a as T}from"./chunk-B5QW2GSC.js";import{a as u}from"./chunk-5QL6W6FW.js";import{a as s,b as D,c as N}from"./chunk-4FHWXBOB.js";var j=D(l=>{"use strict";var Q=C();function V(r){var e="https://react.dev/errors/"+r;if(1<arguments.length){e+="?args[]="+encodeURIComponent(arguments[1]);for(var t=2;t<arguments.length;t++)e+="&args[]="+encodeURIComponent(arguments[t])}return"Minified React error #"+r+"; visit "+e+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}s(V,"formatProdErrorMessage");function h(){}s(h,"noop");var c={d:{f:h,r:s(function(){throw Error(V(522))},"r"),D:h,C:h,L:h,m:h,X:h,S:h,M:h},p:0,findDOMNode:null},ee=Symbol.for("react.portal");function re(r,e,t){var n=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:ee,key:n==null?null:""+n,children:r,containerInfo:e,implementation:t}}s(re,"createPortal$1");var O=Q.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function M(r,e){if(r==="font")return"";if(typeof e=="string")return e==="use-credentials"?e:""}s(M,"getCrossOriginStringAs");l.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=c;l.createPortal=function(r,e){var t=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)throw Error(V(299));return re(r,e,null,t)};l.flushSync=function(r){var e=O.T,t=c.p;try{if(O.T=null,c.p=2,r)return r()}finally{O.T=e,c.p=t,c.d.f()}};l.preconnect=function(r,e){typeof r=="string"&&(e?(e=e.crossOrigin,e=typeof e=="string"?e==="use-credentials"?e:"":void 0):e=null,c.d.C(r,e))};l.prefetchDNS=function(r){typeof r=="string"&&c.d.D(r)};l.preinit=function(r,e){if(typeof r=="string"&&e&&typeof e.as=="string"){var t=e.as,n=M(t,e.crossOrigin),o=typeof e.integrity=="string"?e.integrity:void 0,i=typeof e.fetchPriority=="string"?e.fetchPriority:void 0;t==="style"?c.d.S(r,typeof e.precedence=="string"?e.precedence:void 0,{crossOrigin:n,integrity:o,fetchPriority:i}):t==="script"&&c.d.X(r,{crossOrigin:n,integrity:o,fetchPriority:i,nonce:typeof e.nonce=="string"?e.nonce:void 0})}};l.preinitModule=function(r,e){if(typeof r=="string")if(typeof e=="object"&&e!==null){if(e.as==null||e.as==="script"){var t=M(e.as,e.crossOrigin);c.d.M(r,{crossOrigin:t,integrity:typeof e.integrity=="string"?e.integrity:void 0,nonce:typeof e.nonce=="string"?e.nonce:void 0})}}else e==null&&c.d.M(r)};l.preload=function(r,e){if(typeof r=="string"&&typeof e=="object"&&e!==null&&typeof e.as=="string"){var t=e.as,n=M(t,e.crossOrigin);c.d.L(r,t,{crossOrigin:n,integrity:typeof e.integrity=="string"?e.integrity:void 0,nonce:typeof e.nonce=="string"?e.nonce:void 0,type:typeof e.type=="string"?e.type:void 0,fetchPriority:typeof e.fetchPriority=="string"?e.fetchPriority:void 0,referrerPolicy:typeof e.referrerPolicy=="string"?e.referrerPolicy:void 0,imageSrcSet:typeof e.imageSrcSet=="string"?e.imageSrcSet:void 0,imageSizes:typeof e.imageSizes=="string"?e.imageSizes:void 0,media:typeof e.media=="string"?e.media:void 0})}};l.preloadModule=function(r,e){if(typeof r=="string")if(e){var t=M(e.as,e.crossOrigin);c.d.m(r,{as:typeof e.as=="string"&&e.as!=="script"?e.as:void 0,crossOrigin:t,integrity:typeof e.integrity=="string"?e.integrity:void 0})}else c.d.m(r)};l.requestFormReset=function(r){c.d.r(r)};l.unstable_batchedUpdates=function(r,e){return r(e)};l.useFormState=function(r,e,t){return O.H.useFormState(r,e,t)};l.useFormStatus=function(){return O.H.useHostTransitionStatus()};l.version="19.2.0"});var W=D((de,B)=>{"use strict";function U(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(U)}catch(r){console.error(r)}}s(U,"checkDCE");U(),B.exports=j()});var z=N(C(),1),f=N(P(),1),a=N(P(),1);var E=N(C(),1),Z=N(W(),1),v=N(P(),1);var te=Array.from({length:56},(r,e)=>{let t=e/56*2*Math.PI-Math.PI/2,n=Math.cos(t),o=Math.sin(t);return{id:`tick-${e}`,frac:e/55,x1:150+108*n,y1:150+108*o,x2:150+138*n,y2:150+138*o,style:{transitionDelay:`${e*6}ms`}}});function F(r,e,t,n){return t?"var(--sekyro-color-success)":r?n?"color-mix(in srgb, var(--sekyro-color-warning) 75%, transparent)":e<.33?"color-mix(in srgb, var(--sekyro-color-brand) 55%, transparent)":e<.66?"color-mix(in srgb, var(--sekyro-color-brand) 80%, transparent)":"var(--sekyro-color-brand)":"color-mix(in srgb, var(--sekyro-color-surface) 32%, transparent)"}s(F,"T");u(F,"tickColor");var ae="M0 -50 H300 V350 H0 Z M50 150 a100,100 0 1 0 200,0 a100,100 0 1 0 -200,0 Z";function G({progress:r,phase:e,draining:t=!1}){let n=Math.min(1,Math.max(0,r)),o=Math.round(n*56),i=e==="checking",y=e==="recording",d=e==="frozen",m=i||d,p=i||y||d,k=e==="locked"||p,S=t&&!k;return(0,f.jsxs)("svg",{"aria-hidden":"true",viewBox:"0 0 300 300",preserveAspectRatio:"xMidYMid meet",className:"sekyro-stage__arc","data-testid":"sekyro-capture-arc","data-phase":e,"data-filled":o,"data-recording":y?"":void 0,"data-draining":S?"":void 0,children:[(0,f.jsx)("path",{fillRule:"evenodd",d:ae,fill:"color-mix(in srgb, var(--sekyro-color-fg) var(--sekyro-scrim, 96%), transparent)",style:{"--sekyro-scrim":m?"100%":"96%"},className:"sekyro-arc__scrim sekyro-capture-fade-in","data-testid":"sekyro-capture-scrim"}),(0,f.jsxs)("g",{className:e==="locked"?"sekyro-capture-settle":void 0,children:[(0,f.jsx)("g",{className:m?"sekyro-arc__ring sekyro-arc__ring--dim":"sekyro-arc__ring",children:te.map((g,x)=>(0,f.jsx)("line",{x1:g.x1,y1:g.y1,x2:g.x2,y2:g.y2,stroke:F(x<o,g.frac,k,S),strokeWidth:3,strokeLinecap:"round",style:g.style,className:"sekyro-arc__tick"},g.id))}),(0,f.jsx)("g",{className:e==="seeking"?"sekyro-capture-breathe":void 0,children:(0,f.jsx)("circle",{cx:150,cy:150,r:100,fill:"none",stroke:k?"var(--sekyro-color-success)":"var(--sekyro-color-surface)",strokeWidth:k?3.5:2.5,className:p?"sekyro-arc__guide sekyro-arc__guide--spin sekyro-capture-ring-spin":"sekyro-arc__guide sekyro-capture-fade-in","data-testid":"sekyro-capture-guide"})})]})]})}s(G,"x");u(G,"CaptureArc");function ne({videoRef:r,guidanceText:e,guidanceHint:t,guidanceKey:n,progress:o,phase:i,draining:y=!1,stillUrl:d,showChecking:m,operatorText:p=null,voicePrompt:k,overlay:S,reduceMotion:g=!1,modeSwitch:x=null}){let b=I(),w=i==="checking",_=w||i==="frozen",A=_&&m?b("capture.checking"):e,L=k?.(t,A,n);return(0,a.jsxs)("div",{className:g?"sekyro-stage sekyro-capture-reduce":"sekyro-stage","data-testid":"sekyro-capture-stage",children:[(0,a.jsx)("video",{ref:r,playsInline:!0,muted:!0,className:"sekyro-stage__video","data-testid":"sekyro-capture-video"}),d!==null&&_?(0,a.jsx)("img",{src:d,alt:b("capture.previewAlt"),className:"sekyro-stage__still sekyro-capture-develop","data-testid":"sekyro-capture-still"}):null,(0,a.jsx)(G,{progress:o,phase:i,draining:y}),S?.(r),L!=null&&!_?(0,a.jsx)("div",{className:"sekyro-stage__corner-start","data-testid":"sekyro-voice-slot",children:L}):null,x!==null&&!_?(0,a.jsx)($,{view:x,className:"sekyro-stage__corner-end sekyro-stage__mode-switch",kind:"chip"}):null,w&&m?(0,a.jsxs)("span",{className:"sekyro-stage__corner-end sekyro-stage__pill sekyro-capture-pill-in","data-testid":"sekyro-camera-off-pill",children:[(0,a.jsx)(Y,{}),b("capture.cameraOff")]}):null,(0,a.jsxs)("p",{"aria-live":"polite",className:"sekyro-stage__guidance","data-testid":"sekyro-capture-guidance",children:[(0,a.jsx)("span",{className:"sekyro-stage__guidance-text sekyro-capture-text-in",children:A},A),_&&m?(0,a.jsx)("span",{className:"sekyro-stage__guidance-hint",children:b("capture.checkingHint")}):p!==null&&!_?(0,a.jsx)("span",{className:"sekyro-stage__guidance-hint","data-testid":"sekyro-operator-line",children:p}):null]})]})}s(ne,"ne");u(ne,"CaptureStage");function $({view:r,className:e,kind:t}){let n=(0,z.useId)(),o=(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(K,{}),(0,a.jsx)("span",{children:r.label})]}),i={onClick:r.onSwitch,"aria-describedby":n,"data-testid":"sekyro-capture-mode-switch","data-mode":r.to};return(0,a.jsxs)(a.Fragment,{children:[t==="chip"?(0,a.jsx)(H,{kind:"chip",className:e,...i,children:o}):(0,a.jsx)("button",{type:"button",className:e,...i,children:o}),(0,a.jsx)("span",{id:n,className:"sekyro-visually-hidden",children:r.description})]})}s($,"H");u($,"ModeSwitchChip");function K(){return(0,a.jsxs)("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",className:"sekyro-icon",children:[(0,a.jsx)("path",{d:"M4 7.5h2.2l1.4-1.9h8.8l1.4 1.9H20a1.6 1.6 0 0 1 1.6 1.6v8.3A1.6 1.6 0 0 1 20 19H4a1.6 1.6 0 0 1-1.6-1.6V9.1A1.6 1.6 0 0 1 4 7.5Z"}),(0,a.jsx)("path",{d:"M15.4 11.9a3.5 3.5 0 0 0-6.1-1.4M15.4 11.9h-2.1m2.1 0V9.8"}),(0,a.jsx)("path",{d:"M8.6 13.4a3.5 3.5 0 0 0 6.1 1.4M8.6 13.4h2.1m-2.1 0v2.1"})]})}s(K,"D");u(K,"FlipCameraIcon");function Y(){return(0,a.jsxs)("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",className:"sekyro-icon sekyro-icon--sm",children:[(0,a.jsx)("path",{d:"M4 7.5h2.2l1.4-1.9h8.8l1.4 1.9H20a1.6 1.6 0 0 1 1.6 1.6v8.3A1.6 1.6 0 0 1 20 19H4a1.6 1.6 0 0 1-1.6-1.6V9.1A1.6 1.6 0 0 1 4 7.5Z"}),(0,a.jsx)("path",{d:"M3 3l18 18"})]})}s(Y,"G");u(Y,"CameraOffIcon");var ie=typeof window>"u"?E.useEffect:E.useLayoutEffect,R="data-sekyro-ramp",se=[["background-color","transparent"],["background-image","none"]];function q(r){let e=[],t=r.ownerDocument;for(let i=r;i!==null&&i!==t.documentElement;i=i.parentElement){if(!(i instanceof HTMLElement)&&!(i instanceof SVGElement))continue;let y=i.style;for(let[d,m]of se){let p=y.getPropertyValue(d),k=y.getPropertyPriority(d);y.setProperty(d,m,"important"),e.push(()=>{p===""?y.removeProperty(d):y.setProperty(d,p,k)})}}let n=t.documentElement,o=n.hasAttribute(R);return n.setAttribute(R,""),o||e.push(()=>n.removeAttribute(R)),()=>{for(let i of e.reverse())i()}}s(q,"z");u(q,"clearAncestorBackdrops");function X(r){return{position:"fixed",inset:0,minWidth:"100vw",minHeight:"100lvh",margin:0,padding:0,border:0,zIndex:-1,pointerEvents:"none",backgroundColor:T(r)}}s(X,"B");u(X,"washStyle");function J(r){return{position:"absolute",inset:0,pointerEvents:"none",backgroundColor:T(r)}}s(J,"Y");u(J,"coverStyle");function oe({colour:r}){let e=(0,E.useRef)(null),t=r!==null;return ie(()=>{let n=e.current?.parentElement;if(!(!t||n===null||n===void 0))return q(n)},[t]),r===null||typeof document>"u"?null:(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)("div",{ref:e,"aria-hidden":"true","data-testid":"sekyro-screen-ramp-cover","data-colour":r,style:J(r)}),(0,Z.createPortal)((0,v.jsx)("div",{"aria-hidden":"true","data-testid":"sekyro-screen-ramp","data-colour":r,style:X(r)}),document.body)]})}s(oe,"de");u(oe,"ScreenRampLayer");export{W as a,ne as b,$ as c,oe as d};
|
|
1
|
+
import{d as I}from"./chunk-SA3JLP6W.js";import{a as C,b as P,c as H}from"./chunk-CTQAORJP.js";import{a as T}from"./chunk-EP25HO5D.js";import{a as u}from"./chunk-5QL6W6FW.js";import{a as s,b as D,c as N}from"./chunk-4FHWXBOB.js";var j=D(l=>{"use strict";var Q=C();function V(r){var e="https://react.dev/errors/"+r;if(1<arguments.length){e+="?args[]="+encodeURIComponent(arguments[1]);for(var t=2;t<arguments.length;t++)e+="&args[]="+encodeURIComponent(arguments[t])}return"Minified React error #"+r+"; visit "+e+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}s(V,"formatProdErrorMessage");function h(){}s(h,"noop");var c={d:{f:h,r:s(function(){throw Error(V(522))},"r"),D:h,C:h,L:h,m:h,X:h,S:h,M:h},p:0,findDOMNode:null},ee=Symbol.for("react.portal");function re(r,e,t){var n=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:ee,key:n==null?null:""+n,children:r,containerInfo:e,implementation:t}}s(re,"createPortal$1");var O=Q.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function M(r,e){if(r==="font")return"";if(typeof e=="string")return e==="use-credentials"?e:""}s(M,"getCrossOriginStringAs");l.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=c;l.createPortal=function(r,e){var t=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)throw Error(V(299));return re(r,e,null,t)};l.flushSync=function(r){var e=O.T,t=c.p;try{if(O.T=null,c.p=2,r)return r()}finally{O.T=e,c.p=t,c.d.f()}};l.preconnect=function(r,e){typeof r=="string"&&(e?(e=e.crossOrigin,e=typeof e=="string"?e==="use-credentials"?e:"":void 0):e=null,c.d.C(r,e))};l.prefetchDNS=function(r){typeof r=="string"&&c.d.D(r)};l.preinit=function(r,e){if(typeof r=="string"&&e&&typeof e.as=="string"){var t=e.as,n=M(t,e.crossOrigin),o=typeof e.integrity=="string"?e.integrity:void 0,i=typeof e.fetchPriority=="string"?e.fetchPriority:void 0;t==="style"?c.d.S(r,typeof e.precedence=="string"?e.precedence:void 0,{crossOrigin:n,integrity:o,fetchPriority:i}):t==="script"&&c.d.X(r,{crossOrigin:n,integrity:o,fetchPriority:i,nonce:typeof e.nonce=="string"?e.nonce:void 0})}};l.preinitModule=function(r,e){if(typeof r=="string")if(typeof e=="object"&&e!==null){if(e.as==null||e.as==="script"){var t=M(e.as,e.crossOrigin);c.d.M(r,{crossOrigin:t,integrity:typeof e.integrity=="string"?e.integrity:void 0,nonce:typeof e.nonce=="string"?e.nonce:void 0})}}else e==null&&c.d.M(r)};l.preload=function(r,e){if(typeof r=="string"&&typeof e=="object"&&e!==null&&typeof e.as=="string"){var t=e.as,n=M(t,e.crossOrigin);c.d.L(r,t,{crossOrigin:n,integrity:typeof e.integrity=="string"?e.integrity:void 0,nonce:typeof e.nonce=="string"?e.nonce:void 0,type:typeof e.type=="string"?e.type:void 0,fetchPriority:typeof e.fetchPriority=="string"?e.fetchPriority:void 0,referrerPolicy:typeof e.referrerPolicy=="string"?e.referrerPolicy:void 0,imageSrcSet:typeof e.imageSrcSet=="string"?e.imageSrcSet:void 0,imageSizes:typeof e.imageSizes=="string"?e.imageSizes:void 0,media:typeof e.media=="string"?e.media:void 0})}};l.preloadModule=function(r,e){if(typeof r=="string")if(e){var t=M(e.as,e.crossOrigin);c.d.m(r,{as:typeof e.as=="string"&&e.as!=="script"?e.as:void 0,crossOrigin:t,integrity:typeof e.integrity=="string"?e.integrity:void 0})}else c.d.m(r)};l.requestFormReset=function(r){c.d.r(r)};l.unstable_batchedUpdates=function(r,e){return r(e)};l.useFormState=function(r,e,t){return O.H.useFormState(r,e,t)};l.useFormStatus=function(){return O.H.useHostTransitionStatus()};l.version="19.2.0"});var W=D((de,B)=>{"use strict";function U(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(U)}catch(r){console.error(r)}}s(U,"checkDCE");U(),B.exports=j()});var z=N(C(),1),f=N(P(),1),a=N(P(),1);var E=N(C(),1),Z=N(W(),1),v=N(P(),1);var te=Array.from({length:56},(r,e)=>{let t=e/56*2*Math.PI-Math.PI/2,n=Math.cos(t),o=Math.sin(t);return{id:`tick-${e}`,frac:e/55,x1:150+108*n,y1:150+108*o,x2:150+138*n,y2:150+138*o,style:{transitionDelay:`${e*6}ms`}}});function F(r,e,t,n){return t?"var(--sekyro-color-success)":r?n?"color-mix(in srgb, var(--sekyro-color-warning) 75%, transparent)":e<.33?"color-mix(in srgb, var(--sekyro-color-brand) 55%, transparent)":e<.66?"color-mix(in srgb, var(--sekyro-color-brand) 80%, transparent)":"var(--sekyro-color-brand)":"color-mix(in srgb, var(--sekyro-color-surface) 32%, transparent)"}s(F,"T");u(F,"tickColor");var ae="M0 -50 H300 V350 H0 Z M50 150 a100,100 0 1 0 200,0 a100,100 0 1 0 -200,0 Z";function G({progress:r,phase:e,draining:t=!1}){let n=Math.min(1,Math.max(0,r)),o=Math.round(n*56),i=e==="checking",y=e==="recording",d=e==="frozen",m=i||d,p=i||y||d,k=e==="locked"||p,S=t&&!k;return(0,f.jsxs)("svg",{"aria-hidden":"true",viewBox:"0 0 300 300",preserveAspectRatio:"xMidYMid meet",className:"sekyro-stage__arc","data-testid":"sekyro-capture-arc","data-phase":e,"data-filled":o,"data-recording":y?"":void 0,"data-draining":S?"":void 0,children:[(0,f.jsx)("path",{fillRule:"evenodd",d:ae,fill:"color-mix(in srgb, var(--sekyro-color-fg) var(--sekyro-scrim, 96%), transparent)",style:{"--sekyro-scrim":m?"100%":"96%"},className:"sekyro-arc__scrim sekyro-capture-fade-in","data-testid":"sekyro-capture-scrim"}),(0,f.jsxs)("g",{className:e==="locked"?"sekyro-capture-settle":void 0,children:[(0,f.jsx)("g",{className:m?"sekyro-arc__ring sekyro-arc__ring--dim":"sekyro-arc__ring",children:te.map((g,x)=>(0,f.jsx)("line",{x1:g.x1,y1:g.y1,x2:g.x2,y2:g.y2,stroke:F(x<o,g.frac,k,S),strokeWidth:3,strokeLinecap:"round",style:g.style,className:"sekyro-arc__tick"},g.id))}),(0,f.jsx)("g",{className:e==="seeking"?"sekyro-capture-breathe":void 0,children:(0,f.jsx)("circle",{cx:150,cy:150,r:100,fill:"none",stroke:k?"var(--sekyro-color-success)":"var(--sekyro-color-surface)",strokeWidth:k?3.5:2.5,className:p?"sekyro-arc__guide sekyro-arc__guide--spin sekyro-capture-ring-spin":"sekyro-arc__guide sekyro-capture-fade-in","data-testid":"sekyro-capture-guide"})})]})]})}s(G,"x");u(G,"CaptureArc");function ne({videoRef:r,guidanceText:e,guidanceHint:t,guidanceKey:n,progress:o,phase:i,draining:y=!1,stillUrl:d,showChecking:m,operatorText:p=null,voicePrompt:k,overlay:S,reduceMotion:g=!1,modeSwitch:x=null}){let b=I(),w=i==="checking",_=w||i==="frozen",A=_&&m?b("capture.checking"):e,L=k?.(t,A,n);return(0,a.jsxs)("div",{className:g?"sekyro-stage sekyro-capture-reduce":"sekyro-stage","data-testid":"sekyro-capture-stage",children:[(0,a.jsx)("video",{ref:r,playsInline:!0,muted:!0,className:"sekyro-stage__video","data-testid":"sekyro-capture-video"}),d!==null&&_?(0,a.jsx)("img",{src:d,alt:b("capture.previewAlt"),className:"sekyro-stage__still sekyro-capture-develop","data-testid":"sekyro-capture-still"}):null,(0,a.jsx)(G,{progress:o,phase:i,draining:y}),S?.(r),L!=null&&!_?(0,a.jsx)("div",{className:"sekyro-stage__corner-start","data-testid":"sekyro-voice-slot",children:L}):null,x!==null&&!_?(0,a.jsx)($,{view:x,className:"sekyro-stage__corner-end sekyro-stage__mode-switch",kind:"chip"}):null,w&&m?(0,a.jsxs)("span",{className:"sekyro-stage__corner-end sekyro-stage__pill sekyro-capture-pill-in","data-testid":"sekyro-camera-off-pill",children:[(0,a.jsx)(Y,{}),b("capture.cameraOff")]}):null,(0,a.jsxs)("p",{"aria-live":"polite",className:"sekyro-stage__guidance","data-testid":"sekyro-capture-guidance",children:[(0,a.jsx)("span",{className:"sekyro-stage__guidance-text sekyro-capture-text-in",children:A},A),_&&m?(0,a.jsx)("span",{className:"sekyro-stage__guidance-hint",children:b("capture.checkingHint")}):p!==null&&!_?(0,a.jsx)("span",{className:"sekyro-stage__guidance-hint","data-testid":"sekyro-operator-line",children:p}):null]})]})}s(ne,"ne");u(ne,"CaptureStage");function $({view:r,className:e,kind:t}){let n=(0,z.useId)(),o=(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(K,{}),(0,a.jsx)("span",{children:r.label})]}),i={onClick:r.onSwitch,"aria-describedby":n,"data-testid":"sekyro-capture-mode-switch","data-mode":r.to};return(0,a.jsxs)(a.Fragment,{children:[t==="chip"?(0,a.jsx)(H,{kind:"chip",className:e,...i,children:o}):(0,a.jsx)("button",{type:"button",className:e,...i,children:o}),(0,a.jsx)("span",{id:n,className:"sekyro-visually-hidden",children:r.description})]})}s($,"H");u($,"ModeSwitchChip");function K(){return(0,a.jsxs)("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",className:"sekyro-icon",children:[(0,a.jsx)("path",{d:"M4 7.5h2.2l1.4-1.9h8.8l1.4 1.9H20a1.6 1.6 0 0 1 1.6 1.6v8.3A1.6 1.6 0 0 1 20 19H4a1.6 1.6 0 0 1-1.6-1.6V9.1A1.6 1.6 0 0 1 4 7.5Z"}),(0,a.jsx)("path",{d:"M15.4 11.9a3.5 3.5 0 0 0-6.1-1.4M15.4 11.9h-2.1m2.1 0V9.8"}),(0,a.jsx)("path",{d:"M8.6 13.4a3.5 3.5 0 0 0 6.1 1.4M8.6 13.4h2.1m-2.1 0v2.1"})]})}s(K,"D");u(K,"FlipCameraIcon");function Y(){return(0,a.jsxs)("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",className:"sekyro-icon sekyro-icon--sm",children:[(0,a.jsx)("path",{d:"M4 7.5h2.2l1.4-1.9h8.8l1.4 1.9H20a1.6 1.6 0 0 1 1.6 1.6v8.3A1.6 1.6 0 0 1 20 19H4a1.6 1.6 0 0 1-1.6-1.6V9.1A1.6 1.6 0 0 1 4 7.5Z"}),(0,a.jsx)("path",{d:"M3 3l18 18"})]})}s(Y,"G");u(Y,"CameraOffIcon");var ie=typeof window>"u"?E.useEffect:E.useLayoutEffect,R="data-sekyro-ramp",se=[["background-color","transparent"],["background-image","none"]];function q(r){let e=[],t=r.ownerDocument;for(let i=r;i!==null&&i!==t.documentElement;i=i.parentElement){if(!(i instanceof HTMLElement)&&!(i instanceof SVGElement))continue;let y=i.style;for(let[d,m]of se){let p=y.getPropertyValue(d),k=y.getPropertyPriority(d);y.setProperty(d,m,"important"),e.push(()=>{p===""?y.removeProperty(d):y.setProperty(d,p,k)})}}let n=t.documentElement,o=n.hasAttribute(R);return n.setAttribute(R,""),o||e.push(()=>n.removeAttribute(R)),()=>{for(let i of e.reverse())i()}}s(q,"z");u(q,"clearAncestorBackdrops");function X(r){return{position:"fixed",inset:0,minWidth:"100vw",minHeight:"100lvh",margin:0,padding:0,border:0,zIndex:-1,pointerEvents:"none",backgroundColor:T(r)}}s(X,"B");u(X,"washStyle");function J(r){return{position:"absolute",inset:0,pointerEvents:"none",backgroundColor:T(r)}}s(J,"Y");u(J,"coverStyle");function oe({colour:r}){let e=(0,E.useRef)(null),t=r!==null;return ie(()=>{let n=e.current?.parentElement;if(!(!t||n===null||n===void 0))return q(n)},[t]),r===null||typeof document>"u"?null:(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)("div",{ref:e,"aria-hidden":"true","data-testid":"sekyro-screen-ramp-cover","data-colour":r,style:J(r)}),(0,Z.createPortal)((0,v.jsx)("div",{"aria-hidden":"true","data-testid":"sekyro-screen-ramp","data-colour":r,style:X(r)}),document.body)]})}s(oe,"de");u(oe,"ScreenRampLayer");export{W as a,ne as b,$ as c,oe as d};
|
|
2
2
|
/*! Bundled license information:
|
|
3
3
|
|
|
4
4
|
react-dom/cjs/react-dom.production.js:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{d as U}from"./chunk-
|
|
1
|
+
import{d as U}from"./chunk-FD543JGD.js";import{E as C,I as H,a as Z,b as E,v as B}from"./chunk-CTQAORJP.js";import{a as d}from"./chunk-5QL6W6FW.js";import{a as N,c as R}from"./chunk-4FHWXBOB.js";var y=R(Z(),1),s=R(E(),1);var b=72;function P(c,t){let r=c*.72,a=r*1.32;return{cx:c/2,cy:(t-a)/2.1+a/2,a:r/2,b:a/2}}N(P,"B");d(P,"faceOval");function z({cx:c,cy:t,a:r,b:a}){return Array.from({length:b},(j,M)=>{let m=-Math.PI/2+M/b*2*Math.PI,h=Math.cos(m),i=Math.sin(m),u=c+r*h,f=t+a*i,k=Math.hypot(a*h,r*i),p=a*h/k,$=r*i/k,o=d(v=>Math.round(v*10)/10,"r");return`M${o(u+p*16)} ${o(f+$*16)}L${o(u+p*28)} ${o(f+$*28)}`})}N(z,"E");d(z,"ticks");function F({video:c,instruction:t,note:r,status:a,busy:j,progress:M,still:m,overlay:h,ramp:i,onClose:u,closeLabel:f,end:k,live:p=!0,children:$,testId:o}){C(p);let v=(0,y.useRef)(null),[l,A]=(0,y.useState)({w:0,h:0});(0,y.useLayoutEffect)(()=>{let x=v.current;if(x===null)return;let I=d(()=>A({w:x.clientWidth,h:x.clientHeight}),"measure");if(I(),typeof ResizeObserver>"u")return;let L=new ResizeObserver(I);return L.observe(x),()=>L.disconnect()},[]);let e=P(l.w,l.h),g=l.w>0?z(e):[],w=Math.round(Math.min(1,Math.max(0,M))*b),S=e.cy-e.b,n=Math.max(e.a,e.b)+40,O=70*Math.PI/180;return(0,s.jsx)("section",{className:"sekyro-lm sekyro-fc","aria-label":t,"data-testid":o,"data-ramp":i?"":void 0,children:(0,s.jsxs)("div",{ref:v,className:"sekyro-lm-stage",children:[c,m?(0,s.jsx)("img",{className:"sekyro-lm-video sekyro-fc-still",src:m,alt:""}):null,h,(0,s.jsx)(U,{colour:i??null}),l.w>0?(0,s.jsxs)("svg",{className:"sekyro-lm-overlay",viewBox:`0 0 ${l.w} ${l.h}`,"aria-hidden":"true",focusable:"false",children:[(0,s.jsxs)("defs",{children:[(0,s.jsxs)("linearGradient",{id:"sekyro-fc-fade",gradientUnits:"userSpaceOnUse",x1:e.cx-n*Math.sin(O),y1:e.cy,x2:e.cx,y2:e.cy,children:[(0,s.jsx)("stop",{offset:"0",className:"sekyro-fc-fade",stopOpacity:"0"}),(0,s.jsx)("stop",{offset:"1",className:"sekyro-fc-fade"})]}),(0,s.jsx)("mask",{id:"sekyro-fc-light",maskUnits:"userSpaceOnUse",x:"0",y:"0",width:l.w,height:l.h,children:(0,s.jsx)("path",{className:"sekyro-fc-sweep",style:{transformOrigin:`${e.cx}px ${e.cy}px`},d:`M${e.cx} ${e.cy}L${e.cx-n*Math.sin(O)} ${e.cy-n*Math.cos(O)}A${n} ${n} 0 0 1 ${e.cx} ${e.cy-n}Z`,fill:"url(#sekyro-fc-fade)"})})]}),(0,s.jsx)("path",{className:"sekyro-fc-scrim",fillRule:"evenodd",d:`M0 0H${l.w}V${l.h}H0Z M${e.cx-e.a} ${e.cy}a${e.a} ${e.b} 0 1 0 ${2*e.a} 0a${e.a} ${e.b} 0 1 0 ${-2*e.a} 0Z`}),(0,s.jsx)("ellipse",{className:"sekyro-fc-rim",cx:e.cx,cy:e.cy,rx:e.a,ry:e.b}),(0,s.jsx)("path",{className:"sekyro-fc-ticks",d:g.join("")}),w>0?(0,s.jsx)("path",{className:"sekyro-fc-ticks is-done",d:g.slice(0,w).join("")}):null,w<b?(0,s.jsx)("path",{className:"sekyro-fc-ticks is-light",d:g.join(""),mask:"url(#sekyro-fc-light)"}):null]}):null,(0,s.jsx)("div",{className:"sekyro-lm-instruction sekyro-fc-instruction",style:{insetBlockStart:S-80},children:(0,s.jsx)("div",{role:"status","aria-live":"polite",children:(0,s.jsx)(H,{swapKey:t,className:"sekyro-lm-line",children:t})})}),a!==void 0?(0,s.jsx)("p",{role:"status",className:"sekyro-visually-hidden","data-testid":"sekyro-camera-status",children:a??""}):null,r?(0,s.jsxs)("p",{className:"sekyro-lm-under sekyro-lm-note",style:{insetBlockStart:S+2*e.b+48},children:[j?(0,s.jsx)("span",{className:"sekyro-lm-spinner","aria-hidden":"true"}):null,(0,s.jsx)("span",{children:r})]}):null,(0,s.jsxs)("div",{className:"sekyro-lm-controls",children:[(0,s.jsxs)("div",{className:"sekyro-lm-bar",children:[u!==void 0?(0,s.jsx)("button",{type:"button",className:"sekyro-glass","aria-label":f,onClick:u,children:(0,s.jsx)(B,{name:"close"})}):null,k]}),$]})]})})}N(F,"T");d(F,"FaceCamera");export{F as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{F as t,G as a,a as i}from"./chunk-
|
|
1
|
+
import{F as t,G as a,a as i}from"./chunk-NEULQ5JV.js";import{a as n}from"./chunk-5QL6W6FW.js";import{a as o}from"./chunk-4FHWXBOB.js";function d(r,c){if(r instanceof t)return r.field==="phone"?"otp.phoneInvalid":r.field==="code"?"otp.codeInvalid":r.kind==="check_digit"?"population.reason_id_number_invalid":"population.invalid";if(r instanceof a&&r.field==="channel")return"otp.reason_otp_channel_unavailable";if(r instanceof i){if(r.code==="attestation_invalid"&&r.details?.browserCheck==="clock_wrong")return"errors.device_clock";let e=`errors.${r.code}`;if(Object.hasOwn(c,e))return e}return"errors.network_error"}o(d,"d");n(d,"errorKey");export{d as a};
|