@sekyro/elements 0.1.0-rc.12 → 0.1.0-rc.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/cdn/chunks/{capture-session-doc-FAMDLRRZ-QPOFTNTG.js → capture-session-doc-GCL2FYQH-X7QTUFGI.js} +1 -1
  3. package/dist/cdn/chunks/{chunk-SDK2YXFV.js → chunk-26HXTRWG.js} +1 -1
  4. package/dist/cdn/chunks/{chunk-XDRH4VWV.js → chunk-3I6AVO6X.js} +1 -1
  5. package/dist/cdn/chunks/chunk-3NOBU7TE.js +1 -0
  6. package/dist/cdn/chunks/chunk-A5SXWFOO.js +1 -0
  7. package/dist/cdn/chunks/{chunk-CVFJQIMW.js → chunk-CK3CQAFP.js} +1 -1
  8. package/dist/cdn/chunks/{chunk-YFJBTK3L.js → chunk-CPVOHNLU.js} +1 -1
  9. package/dist/cdn/chunks/{chunk-LBZCFEU4.js → chunk-CSPTLSJY.js} +2 -2
  10. package/dist/cdn/chunks/{chunk-JI5WT66H.js → chunk-CX52FPYW.js} +1 -1
  11. package/dist/cdn/chunks/chunk-DEGFGNRM.js +3 -0
  12. package/dist/cdn/chunks/{chunk-GPGK6XZM.js → chunk-DKZUKWGP.js} +1 -1
  13. package/dist/cdn/chunks/{chunk-4YBL75VD.js → chunk-F7DKVXQW.js} +1 -1
  14. package/dist/cdn/chunks/chunk-FZXXMIZ4.js +1 -0
  15. package/dist/cdn/chunks/{chunk-UN4V3UNQ.js → chunk-LHEWQFCZ.js} +1 -1
  16. package/dist/cdn/chunks/{chunk-BMUUDLFA.js → chunk-PYUD6W3P.js} +1 -1
  17. package/dist/cdn/chunks/chunk-QTPSRWXY.js +1 -0
  18. package/dist/cdn/chunks/{chunk-VHNWBOKW.js → chunk-SHOVUF5C.js} +1 -1
  19. package/dist/cdn/chunks/chunk-VXXXAUQD.js +1 -0
  20. package/dist/cdn/chunks/{chunk-7JUL7AKT.js → chunk-ZPSZDTDP.js} +1 -1
  21. package/dist/cdn/chunks/{create-document-capture-WFTNVMCE-QOCPJSAU.js → create-document-capture-IMDGCTMM-TBX7G2XG.js} +1 -1
  22. package/dist/cdn/chunks/{detector-scanic-S4PB2RNW-3KSM3MW5.js → detector-scanic-QVQVJI3C-K3ZARXJR.js} +1 -1
  23. package/dist/cdn/chunks/{document-capture-view-GENB535Z-YBRM7NWN.js → document-capture-view-GENB535Z-J72QDPT4.js} +1 -1
  24. package/dist/cdn/chunks/{eid-view-IQRZGEMP-SPGYQDQP.js → eid-view-IQRZGEMP-RHLNP5ZM.js} +1 -1
  25. package/dist/cdn/chunks/{email-otp-view-CL76K5TY-TJMSLYLZ.js → email-otp-view-CL76K5TY-ZSNIDTY3.js} +1 -1
  26. package/dist/cdn/chunks/{flow-views-C3EIMXME-ODOF67JZ.js → flow-views-C3EIMXME-U7PKRKNU.js} +1 -1
  27. package/dist/cdn/chunks/{form-view-MEYCK437-JBO5DNG5.js → form-view-MEYCK437-HDYDY2QI.js} +1 -1
  28. package/dist/cdn/chunks/plan-runner-HBUVNDGH-6DM4PNGI.js +1 -0
  29. package/dist/cdn/chunks/{portrait-capture-view-VTN2VU3E-JH34ISLI.js → portrait-capture-view-VTN2VU3E-WCQNHK3E.js} +1 -1
  30. package/dist/cdn/chunks/{portrait-review-view-JTRGDYNV-C2O6OFYY.js → portrait-review-view-JTRGDYNV-25TZW6WY.js} +1 -1
  31. package/dist/cdn/chunks/{proof-of-address-view-UQOZZXQO-T3QOIQNE.js → proof-of-address-view-UQOZZXQO-DITYLW35.js} +1 -1
  32. package/dist/cdn/define.js +1 -1
  33. package/dist/cdn/index.js +1 -1
  34. package/package.json +2 -2
  35. package/sbom.cdx.json +4 -4
  36. package/dist/cdn/chunks/chunk-2FETDQV5.js +0 -1
  37. package/dist/cdn/chunks/chunk-FVWYONHZ.js +0 -1
  38. package/dist/cdn/chunks/chunk-K4BLQMYZ.js +0 -1
  39. package/dist/cdn/chunks/chunk-Q5BUNNRN.js +0 -3
  40. package/dist/cdn/chunks/chunk-XSGZY4JI.js +0 -1
  41. package/dist/cdn/chunks/chunk-YLH3WX7Y.js +0 -1
  42. package/dist/cdn/chunks/plan-runner-LSQTIO6L-XZJIKXPZ.js +0 -1
@@ -1 +1 @@
1
- import{c as M}from"./chunk-XSGZY4JI.js";import{a as c}from"./chunk-P7K7ELYZ.js";import{a as r}from"./chunk-4FHWXBOB.js";var T=480,I=Object.freeze({MIN_AREA_FRAC:.15,EDGE_CLIP_MARGIN_PX:4,STABLE_TICKS:3,IOU_STABLE_MIN:.85,RISE_PER_S:.9,FALL_PER_S:.25,GUIDE_EXPOSURE:.6,GUIDE_SHARPNESS:.35,ID3_BAND_MIN_WIDTH_FRAC:.55,ID3_BAND_ASPECT_MIN:4,ID3_BAND_ASPECT_MAX:40}),x=r(i=>Math.min(1,Math.max(0,i)),"p");function E(i,h,t){let s=[i.topLeft,i.topRight,i.bottomRight,i.bottomLeft],e=0;for(let a=0;a<4;a++){let l=s[a],_=s[(a+1)%4];e+=l.x*_.y-_.x*l.y}let o=h*t;return o>0?Math.abs(e/2)/o:0}r(E,"E");function g(i,h){let t=A(i),s=A(h),e=Math.max(t.x1,s.x1),o=Math.max(t.y1,s.y1),a=Math.min(t.x2,s.x2),l=Math.min(t.y2,s.y2),_=Math.max(0,a-e)*Math.max(0,l-o),d=(t.x2-t.x1)*(t.y2-t.y1),u=(s.x2-s.x1)*(s.y2-s.y1),p=d+u-_;return p>0?_/p:0}r(g,"I");function L(i){let h=A(i);return{width:h.x2-h.x1,height:h.y2-h.y1}}r(L,"R");function A(i){let h=[i.topLeft,i.topRight,i.bottomRight,i.bottomLeft];return{x1:Math.min(...h.map(t=>t.x)),y1:Math.min(...h.map(t=>t.y)),x2:Math.max(...h.map(t=>t.x)),y2:Math.max(...h.map(t=>t.y))}}r(A,"D");function S(i){let h=Math.hypot(i.topRight.x-i.topLeft.x,i.topRight.y-i.topLeft.y),t=Math.hypot(i.bottomRight.x-i.bottomLeft.x,i.bottomRight.y-i.bottomLeft.y),s=Math.hypot(i.bottomLeft.x-i.topLeft.x,i.bottomLeft.y-i.topLeft.y),e=Math.hypot(i.bottomRight.x-i.topRight.x,i.bottomRight.y-i.topRight.y),o=(h+t)/2,a=(s+e)/2;return o<=0||a<=0?0:Math.max(o,a)/Math.min(o,a)}r(S,"M");var n,N=(n=class{constructor(h,t={}){this.p=0,this.lastTickAt=null,this.lastQuad=null,this.streak=0,this.format=h,this.t={...I,...t}}reset(){this.p=0,this.lastTickAt=null,this.lastQuad=null,this.streak=0}tick(h){let{quad:t,quality:s,timestampMs:e}=h,o=this.lastTickAt===null?0:Math.max(0,(e-this.lastTickAt)/1e3);this.lastTickAt=e;let a=null;if(t===null)a="dcv1.no_doc";else if(this.format==="ID-3"){let m=L(t),y=m.height>0?m.width/m.height:0;m.width<this.t.ID3_BAND_MIN_WIDTH_FRAC*h.frameWidth?a="dcv1.come_closer":this.edgeClipped(t,h.frameWidth,h.frameHeight)?a="dcv1.fit_document":(y<this.t.ID3_BAND_ASPECT_MIN||y>this.t.ID3_BAND_ASPECT_MAX)&&(a="dcv1.wrong_shape")}else E(t,h.frameWidth,h.frameHeight)<this.t.MIN_AREA_FRAC?a="dcv1.come_closer":this.edgeClipped(t,h.frameWidth,h.frameHeight)?a="dcv1.fit_document":M(this.format,S(t))||(a="dcv1.wrong_shape");let l=a===null,_=x(s.exposure)>=this.t.GUIDE_EXPOSURE,d=x(s.sharpness)>=this.t.GUIDE_SHARPNESS,u=_&&d;if(l&&u&&t!==null){let m=this.lastQuad===null||g(t,this.lastQuad)>=this.t.IOU_STABLE_MIN;this.streak=m?this.streak+1:1}else this.streak=0;this.lastQuad=t;let p=l&&u;this.p=x(this.p+(p?this.t.RISE_PER_S:-this.t.FALL_PER_S)*o);let R=p&&this.streak>=this.t.STABLE_TICKS,f;if(a!==null)f=a;else if(_)d?f="dcv1.hold_still":f="dcv1.steady";else{let m=(c[0]+c[1])/2;f=s.meanLuma<m?"dcv1.more_light":"dcv1.too_bright"}return{at:e,quad:t,plausible:l,p:this.p,guidanceKey:f,ready:R,stableTicks:this.streak}}edgeClipped(h,t,s){let e=this.t.EDGE_CLIP_MARGIN_PX;return[h.topLeft,h.topRight,h.bottomRight,h.bottomLeft].some(o=>o.x<=e||o.y<=e||o.x>=t-e||o.y>=s-e)}},r(n,"d"),n);export{T as a,I as b,E as c,L as d,N as e};
1
+ import{c as M}from"./chunk-QTPSRWXY.js";import{a as c}from"./chunk-P7K7ELYZ.js";import{a as r}from"./chunk-4FHWXBOB.js";var T=480,I=Object.freeze({MIN_AREA_FRAC:.15,EDGE_CLIP_MARGIN_PX:4,STABLE_TICKS:3,IOU_STABLE_MIN:.85,RISE_PER_S:.9,FALL_PER_S:.25,GUIDE_EXPOSURE:.6,GUIDE_SHARPNESS:.35,ID3_BAND_MIN_WIDTH_FRAC:.55,ID3_BAND_ASPECT_MIN:4,ID3_BAND_ASPECT_MAX:40}),x=r(i=>Math.min(1,Math.max(0,i)),"p");function E(i,h,t){let s=[i.topLeft,i.topRight,i.bottomRight,i.bottomLeft],e=0;for(let a=0;a<4;a++){let l=s[a],_=s[(a+1)%4];e+=l.x*_.y-_.x*l.y}let o=h*t;return o>0?Math.abs(e/2)/o:0}r(E,"E");function g(i,h){let t=A(i),s=A(h),e=Math.max(t.x1,s.x1),o=Math.max(t.y1,s.y1),a=Math.min(t.x2,s.x2),l=Math.min(t.y2,s.y2),_=Math.max(0,a-e)*Math.max(0,l-o),d=(t.x2-t.x1)*(t.y2-t.y1),u=(s.x2-s.x1)*(s.y2-s.y1),p=d+u-_;return p>0?_/p:0}r(g,"I");function L(i){let h=A(i);return{width:h.x2-h.x1,height:h.y2-h.y1}}r(L,"R");function A(i){let h=[i.topLeft,i.topRight,i.bottomRight,i.bottomLeft];return{x1:Math.min(...h.map(t=>t.x)),y1:Math.min(...h.map(t=>t.y)),x2:Math.max(...h.map(t=>t.x)),y2:Math.max(...h.map(t=>t.y))}}r(A,"D");function S(i){let h=Math.hypot(i.topRight.x-i.topLeft.x,i.topRight.y-i.topLeft.y),t=Math.hypot(i.bottomRight.x-i.bottomLeft.x,i.bottomRight.y-i.bottomLeft.y),s=Math.hypot(i.bottomLeft.x-i.topLeft.x,i.bottomLeft.y-i.topLeft.y),e=Math.hypot(i.bottomRight.x-i.topRight.x,i.bottomRight.y-i.topRight.y),o=(h+t)/2,a=(s+e)/2;return o<=0||a<=0?0:Math.max(o,a)/Math.min(o,a)}r(S,"M");var n,N=(n=class{constructor(h,t={}){this.p=0,this.lastTickAt=null,this.lastQuad=null,this.streak=0,this.format=h,this.t={...I,...t}}reset(){this.p=0,this.lastTickAt=null,this.lastQuad=null,this.streak=0}tick(h){let{quad:t,quality:s,timestampMs:e}=h,o=this.lastTickAt===null?0:Math.max(0,(e-this.lastTickAt)/1e3);this.lastTickAt=e;let a=null;if(t===null)a="dcv1.no_doc";else if(this.format==="ID-3"){let m=L(t),y=m.height>0?m.width/m.height:0;m.width<this.t.ID3_BAND_MIN_WIDTH_FRAC*h.frameWidth?a="dcv1.come_closer":this.edgeClipped(t,h.frameWidth,h.frameHeight)?a="dcv1.fit_document":(y<this.t.ID3_BAND_ASPECT_MIN||y>this.t.ID3_BAND_ASPECT_MAX)&&(a="dcv1.wrong_shape")}else E(t,h.frameWidth,h.frameHeight)<this.t.MIN_AREA_FRAC?a="dcv1.come_closer":this.edgeClipped(t,h.frameWidth,h.frameHeight)?a="dcv1.fit_document":M(this.format,S(t))||(a="dcv1.wrong_shape");let l=a===null,_=x(s.exposure)>=this.t.GUIDE_EXPOSURE,d=x(s.sharpness)>=this.t.GUIDE_SHARPNESS,u=_&&d;if(l&&u&&t!==null){let m=this.lastQuad===null||g(t,this.lastQuad)>=this.t.IOU_STABLE_MIN;this.streak=m?this.streak+1:1}else this.streak=0;this.lastQuad=t;let p=l&&u;this.p=x(this.p+(p?this.t.RISE_PER_S:-this.t.FALL_PER_S)*o);let R=p&&this.streak>=this.t.STABLE_TICKS,f;if(a!==null)f=a;else if(_)d?f="dcv1.hold_still":f="dcv1.steady";else{let m=(c[0]+c[1])/2;f=s.meanLuma<m?"dcv1.more_light":"dcv1.too_bright"}return{at:e,quad:t,plausible:l,p:this.p,guidanceKey:f,ready:R,stableTicks:this.streak}}edgeClipped(h,t,s){let e=this.t.EDGE_CLIP_MARGIN_PX;return[h.topLeft,h.topRight,h.bottomRight,h.bottomLeft].some(o=>o.x<=e||o.y<=e||o.x>=t-e||o.y>=s-e)}},r(n,"d"),n);export{T as a,I as b,E as c,L as d,N as e};
@@ -0,0 +1,3 @@
1
+ import{A as Je,F as ue,G as W,H as Qe,I as Xe,J as et,a as I,b as Ge,c as Ue,f as je,g as Ke,h as Be,i as Ve,j as se,k as $e,m as P,o as M,p as O,q as j,r as Z,s as E,t as le,v as He,w as ze,x as Ze,y as We,z as Ye}from"./chunk-A5SXWFOO.js";import{f as nt}from"./chunk-DKZUKWGP.js";import{b as Fe}from"./chunk-F7DKVXQW.js";import{b as qe,c as oe,e as tt}from"./chunk-6MYG4HWP.js";import{a as t}from"./chunk-4FHWXBOB.js";function Et(r){return r.idNumberBound??r.nniBound}t(Et,"ae");function rt(r){return r===void 0?void 0:r.idNumberFromDocument??r.nniFromDocument}t(rt,"ee");var ot="https://api.sekyro.ai",Rt=5e3,Nt=24e4,Pt=9e4,Ot=25*6e4,Lt=20*6e4,Dt=3,qt=3e3,Ft=1500,Gt=10;function it(r){return r instanceof Error&&r.name==="ChallengeError"&&r.code||"challenge_failed"}t(it,"St");var at=new Set(["aborted","embedder_opaque","site_key_rejected"]);function Ut(r){return new Promise(s=>setTimeout(s,r))}t(Ut,"un");function jt(){let r=globalThis.crypto;if(r!==void 0&&typeof r.randomUUID=="function")return r.randomUUID();let s=new Uint8Array(16);if(r!==void 0&&typeof r.getRandomValues=="function")r.getRandomValues(s);else for(let f=0;f<16;f+=1)s[f]=Math.floor(Math.random()*256);s[6]=(s[6]??0)&15|64,s[8]=(s[8]??0)&63|128;let p=[...s].map(f=>f.toString(16).padStart(2,"0")).join("");return`${p.slice(0,8)}-${p.slice(8,12)}-${p.slice(12,16)}-${p.slice(16,20)}-${p.slice(20)}`}t(jt,"cn");function Kt(r){return Bt(r,{})}t(Kt,"wo");function Bt(r,s){let p=r.apiOrigin??ot,f=r.autoRetry??!0,dt=r.rearm??"auto",K=s.client??new Ue({apiOrigin:p,sessionToken:r.clientToken,fetch:r.fetch,locale:r.locale}),y=new Proxy(K,{get(e,n){if(n==="submitCheck")return _t;let i=Reflect.get(e,n,e);return typeof i=="function"?i.bind(e):i}}),D=s.sleep??Ut,pe=s.uuid??jt,pt=s.getChallengeToken??((e,n)=>import("./challenge-frame-YBTLAQ5G-NN763UU5.js").then(i=>i.executeChallenge({frameUrl:e.url,siteKey:e.siteKey,action:"liveness",subject:n.subject,signal:n.signal}))),S=tt(),R=null,fe=null,u=!1,me=new AbortController,c=null,B=null,V=null,$=t(()=>V??Qe(c),"ne"),he=t(()=>Xe(W(c),$()),"Re"),b=t(e=>{c=e,!M(e)&&(xe(Lt)||yt(e))&&ie(e),S.emit("view",e),R?.onView(e)},"O"),v=t(()=>c!==null?Promise.resolve(c):(B??(B=y.getSession().then(e=>(b(e),e)).finally(()=>{B=null})),B),"A"),k=t(async()=>{let e=await y.getSession();return b(e),e},"E"),Y=t(async(e,n)=>{e.plan!==void 0?b(e):await k()},"de"),H=null,ye=t(async e=>{let n=await v();if(e||!n.consentRecorded){let i=await y.recordConsent(r.locale);i.plan!==void 0?b(i):c!==null&&b({...c,consentRecorded:!0})}z()&&ie(n)},"Ie"),A=t(e=>e?.force===!0?ye(!0):(H??(H=ye(!1).finally(()=>{H=null})),H),"F"),J={client:y,ensureConsent:t(e=>A(e),"ensureConsent"),sleep:D,uuid:pe,...s.random!==void 0?{random:s.random}:{},onBusy:t(e=>{u||S.emit("busy",e)},"onBusy")},ve=!1,_e=null,Q=t(e=>{if(e.status==="verified"||e.status==="not_verified"||e.status==="review"){if(ve)return;ve=!0}_e=JSON.stringify(e),S.emit("result",e)},"fe"),ft=t(e=>{_e!==JSON.stringify(e)&&Q(e)},"Ft"),ge=t(async e=>{let n=c;e&&(n=await k().catch(()=>c));let i=n===null?null:P(n);return i!==null&&!u&&S.emit("method",i),i!==null},"Ee"),X=null,be=!1,ke=!1,we=t(()=>We(J,(e,n)=>e.submitCheck("population_registry",{},{idempotencyKey:n})),"Fe"),Ae=t(e=>Et(e)===!0||rt(j(e,"population_registry"))===!0,"Ne"),mt=t(async()=>{try{let e=await v();if(M(e)||P(e)!==null||O(e)?.checkType!=="population_registry")return;if(!Ae(e)&&rt(j(e,"population_registry"))===void 0&&(e=await k()),!Ae(e)){ke=!0;return}await A(),await Y(await we(),"population_registry");let n=c===null?void 0:j(c,"population_registry");if(n?.state==="input_required"&&n.reason==="registry_unavailable"&&$e(n)>0){if(await D(Rt),u)return;await Y(await we(),"population_registry")}}catch(e){if(e instanceof I&&(e.code==="check_not_active"||e.code==="step_not_on_path")){await k().catch(()=>{});return}be=!0;return}c!==null&&M(c)&&Q(le(c,{autoRetry:f}))},"Nt"),Ce=t(()=>(X??(X=mt()),X),"He"),w=s.now??Date.now,N=null,q,ee,ht=0,te=t((e,n)=>`${e.url}
2
+ ${e.siteKey}
3
+ ${n}`,"he"),Me=0,ne,re=t((e,n)=>{Me+=1;let i=w(),l=pt(e,{signal:me.signal,subject:n}),o={key:te(e,n),at:i,token:l};return l.then(()=>{o.issuedAt=w(),ee=void 0},d=>{let m=it(d);if(o.failed=m,u||m==="aborted")return;ee=m;let{detail:h,readyMs:a}=d;F({check:"attestation",kind:"unavailable",engineKind:m,attempt:ht++,challengeMs:w()-i,readyMs:a,detail:h,inApp:Fe()})}),l.catch(()=>{}),o},"ge"),Se=t((e,n)=>e!==null&&e.key===n&&(e.issuedAt===void 0||w()-e.issuedAt<Nt),"De"),ie=t((e,n={})=>{let i=e?.challenge??null;if(e===null||i===null||u)return;let l=Z(e.sessionId),o=N;(n.replaceFailed===!0&&o?.failed!==void 0&&!at.has(o.failed)||!Se(o,te(i,l)))&&(N=re(i,l))},"Se"),Te=t(async(e,n)=>{let i=te(e,n),l=N;N=null;let o=Se(l,i)?l:re(e,n),d=o===l?0:1,m,h=new Promise(a=>{m=setTimeout(()=>a("late"),Pt)});try{for(;;){let a=await Promise.race([o.token.then(_=>({token:_}),_=>({error:it(_)})),h]);if(a==="late")return!u&&N===null&&(N=o),{error:ee??"timeout"};if("token"in a)return ne=Math.max(0,Math.round((o.issuedAt??w())-o.at)),a;if(u||at.has(a.error)||d>=Dt||d>0&&await Promise.race([D(qt*d),h])==="late")return a;if(u)return{error:"aborted"};d+=1,o=re(e,n)}}finally{clearTimeout(m)}},"Ue"),T=null,yt=t(e=>se(e).some(n=>(n.checkType==="phone_otp"||n.checkType==="email_otp")&&n.state!=="passed"&&n.state!=="skipped"),"Lt"),xe=t(e=>T===null||w()-T>=e,"Be"),z=t(()=>xe(Ot),"oe"),vt=t(e=>{let n=e.attestation;return typeof n?.turnstileToken=="string"&&n.turnstileToken.length>0},"Dt"),Ie=new Map,Ee=t(async()=>{let e=await v(),n=e.challenge;if(n==null||e.simulation!==void 0)return;let i=await Te(n,Z(e.sessionId));if(!("token"in i))throw new I({status:400,code:"attestation_invalid",message:`browser check: ${i.error}`});return i.token},"Ge"),_t=t(async(e,n,i={})=>{let l=n;if("attestation"in l)try{let a=await K.submitCheck(e,n,i);return vt(l)&&(T=w()),a}catch(a){throw a instanceof I&&a.code==="attestation_invalid"&&(T=null),a}let o=(e==="phone_otp"||e==="email_otp")&&l.action!=="verify",d=i.idempotencyKey,m=d!==void 0?Ie.get(d):void 0;m===void 0&&(o||z())&&(m=await Ee(),d!==void 0&&m!==void 0&&Ie.set(d,m));let h=t((a,_)=>a!==void 0?{..._,browserCheckToken:a}:_,"w");try{let a=await K.submitCheck(e,n,h(m,i));return m!==void 0&&(T=w()),a}catch(a){if(!(a instanceof I)||a.code!=="attestation_invalid"||(T=null,m!==void 0))throw a;let _=await Ee(),x=d!==void 0?{...i,idempotencyKey:pe()}:i,C=await K.submitCheck(e,n,h(_,x));return _!==void 0&&(T=w()),C}},"Ut"),Re=t(async(e={})=>{if(q=void 0,e.always!==!0&&!z())return{};let n=await v(),i=n.challenge;if(i==null)return{};let l=await Te(i,Z(n.sessionId));if("token"in l)return{channel:"hosted_web",turnstileToken:l.token};if(q=l.error,n.simulation!==void 0)return{channel:"hosted_web"};throw new Ze(l.error)},"Ke"),gt=t(()=>q,"Bt"),bt=t(()=>({checks:Math.min(50,Me),...ne!==void 0?{challengeMs:Math.min(6e5,ne)}:{}}),"qt"),F=t(e=>{if(u)return;let n=y.reportCaptureIssue;if(n===void 0)return;let i=e.formFactor;try{i??(i=qe())}catch{}try{Promise.resolve(n.call(y,{...e,...i!==void 0?{formFactor:i}:{}})).catch(()=>{})}catch{}},"W"),g=null,G=null,Ne=new WeakMap,Pe=Promise.resolve(),U=0,kt=t(async()=>{let e=await v();for(let n=0;n<Gt&&!u&&!M(e)&&O(e)===void 0&&se(e).some(i=>i.state==="processing")&&(await D(Ft),!u);n+=1)e=await k();return e},"Gt"),wt=t(async(e,n,i)=>{let{capture:l}=e,o=t(()=>u,"p"),d=t(()=>e.alive&&e.attempt===i,"k"),m=t(a=>{d()&&l.setFlowState(a)},"C"),h=t(a=>{if(!o()&&(a.status==="unavailable"&&a.reasonCode!==void 0&&!je(a.reasonCode)&&F({check:"liveness",kind:"unavailable",phase:"upload",engineKind:a.reasonCode,attempt:Math.max(0,e.issues.value)}),Q(a),!!d())){if(a.status==="retry"&&dt==="auto"){l.handle.retry();return}l.setFlowState("done")}},"w");if(n.degraded==="NO_RECORDER"){let a=c?.sessionId??(await v().catch(()=>null))?.sessionId??"";h(E(a,"no_recorder"));return}m("uploading");try{if(await Ce(),o())return;let a=await v(),_;if(!M(a)&&P(a)!==null){await ge(!1),h(E(a.sessionId,"method_required"));return}if(!M(a)){if(O(a)?.checkType==="population_registry"){h(E(a.sessionId,ke?"nni_unbound":be?"network":"registry_unavailable"));return}if(await A(),o())return;_=c??a;let x=await Ye({...J,artifacts:n,getAttestation:Re,attestationError:gt,attestationFacts:bt,clipKeys:{get:t(()=>Ne.get(n)??null,"get"),set:t(C=>{Ne.set(n,C)},"set")},getView:t(()=>c??a,"getView"),refreshView:k,applySubmit:Y,onPhase:m,isCancelled:o,onKeyframePromoted:t(C=>{fe=C},"onKeyframePromoted")});if(o())return;if(x.kind==="unavailable"){x.reason==="attestation"&&(G={bound:e,artifacts:n});let C=E(a.sessionId,x.reason),De=x.reason==="attestation"?q:void 0;h(De!==void 0?{...C,attestationError:De}:C);return}if(x.kind==="resync"&&await k(),c!==null&&P(c)!==null){await ge(!1),h(E(a.sessionId,"method_required"));return}a=await kt()}h(le(a,{autoRetry:f,previous:_}))}catch{if(o())return;h(E(c?.sessionId??"","network"))}},"Kt"),Oe=t((e,n)=>{let i=e.attempt;U>0&&e.alive&&e.capture.setFlowState("uploading"),U+=1,Pe=Pe.then(()=>wt(e,n,i)).finally(()=>{U-=1,U===0&&R?.onChainIdle()}).catch(()=>{})},"We"),Le=t(e=>{g?.capture.handle.destroy(),g!==null&&(g.alive=!1);let n=nt(e,R?.captureInternals?.(e)??s.capture,()=>c?.capture?.liveness?.keyframe?.rank===!0,he,()=>c?.capture?.liveness?.screenRamp,{session:t(()=>W(c),"session"),onModeChange:t(o=>{V=o},"onModeChange")}),i={capture:n,alive:!0,attempt:0,issues:Be()};g=i,n.handle.on("error",o=>{F(Ke("liveness",o,i.issues.value))}),n.handle.on("state",o=>{if(i.issues.note(o),o==="starting"){i.attempt+=1,G?.bound===i&&(G=null),z()&&ie(c,{replaceFailed:!0});let d=c===null?void 0:O(c)?.checkType;(d==="liveness"||d==="face_match")&&A().catch(()=>{})}}),n.handle.on("captured",o=>{Promise.resolve().then(()=>Oe(i,o))});let l=n.handle;return{get state(){return l.state},get captureMode(){return l.captureMode},get facingMode(){return l.facingMode},on:t((o,d)=>l.on(o,d),"on"),start:t(async o=>{if(c===null&&await v().catch(()=>{}),!!i.alive)return l.start(o)},"start"),retry:t(()=>{let o=G;if(o!==null&&o.bound===i&&i.alive){G=null,Oe(i,o.artifacts);return}l.retry()},"retry"),switchCamera:t(()=>l.switchCamera(),"switchCamera"),canSwitchCaptureMode:t(()=>l.canSwitchCaptureMode(),"canSwitchCaptureMode"),setCaptureMode:t(o=>l.setCaptureMode(o),"setCaptureMode"),destroy:t(()=>{i.alive=!1,g===i&&(g=null),l.destroy()},"destroy")}},"$e"),At=t(async()=>{if(u)return null;try{let e=await v();return u?null:P(e)}catch{return null}},"jt"),Ct=t(async()=>{if(u)return"self";try{let e=await v();if(u)return"self";let n=W(e);return n==="choice"?$()??n:n}catch{return"self"}},"Yt"),Mt=t(async()=>{if(u)return!1;try{let e=await v();return u||M(e)||oe()?!1:ue(e,O(e))==="phone"||ue(e,j(e,"liveness"))==="phone"}catch{return!1}},"Wt"),St=t(async()=>{if(u)return!1;try{let e=await v();return!u&&e.returning===!0}catch{return!1}},"$t"),Tt=t(async e=>{let n=(await v()).plan?.choice,i=n?.options.find(o=>Ve[o.service]===e);if(!i)throw new RangeError(`method ${String(e)} is not offered`);let l=await y.choose(n.nodeId,i.id);u||b(l)},"Qt"),ae=null,xt=t(()=>(ae??(ae=import("./plan-runner-HBUVNDGH-6DM4PNGI.js").then(e=>{let n=e.createPlanRunner({runtime:J,currentView:t(()=>c,"currentView"),cameraMode:he,captureModeSwitch:{pick:$,choose:t(i=>{V=i},"choose")},ensureView:v,refreshView:k,ensureConsent:t(()=>A(),"ensureConsent"),liveness:Le,stopLiveness:t(()=>{g!==null&&(g.alive=!1,g.capture.handle.destroy(),g=null)},"stopLiveness"),chainBusy:t(()=>U>0,"chainBusy"),destroyed:t(()=>u,"destroyed"),sleep:D,isMobile:oe,now:s.now??Date.now,keptFaceKey:t(()=>fe,"keptFaceKey"),setView:b,baseCapture:s.capture,emitStep:t(i=>{u||S.emit("step",i)},"emitStep"),emitResult:ft,reportCaptureIssue:F,documentInternals:s.document,documentFacts:s.documentFacts,portraitInternals:s.portrait,livePhotoInternals:s.livePhoto,uploadInternals:s.upload,pageCameraInternals:s.pageCamera});return R=n,n})),ae),"Zt");return{consent:t(()=>A(),"consent"),startRegistry:Ce,methodChoice:At,selectMethod:Tt,reportCameraUnavailable:t(async e=>{await A();let n=y.reportCameraUnavailable;if(n===void 0)throw new TypeError("this client cannot report a missing camera");let i=await n.call(y,e).catch(l=>{if(l instanceof I&&l.code==="check_out_of_order")return y.getSession();throw l});u||b(i)},"reportCameraUnavailable"),reportCaptureIssue:F,testerGate:t(async e=>{let n=y.testerGate;if(n===void 0)throw new TypeError("this client cannot run the tester gate");let i=e.clip,l=Ge(e.clipMime??"");if(i===void 0||!ze.includes(l))throw new TypeError("the capture has no clip");await A();let o=await He(y,"clip",l,i.size,{engine:e.engine,durationMs:e.clipMs});await y.uploadToSpaces(o.uploadUrl,i,l);let{key:d}=await y.completeMedia(o.key),m=await Re({always:!0}),h=await n.call(y,{clipKey:d,attestation:m,captureChannel:e.captureChannel,capture:{...Je(e),attestationError:q}}),{bound:a,..._}=h;return u||(_.plan!==void 0?b(_):await k()),{bound:a===!0}},"testerGate"),mobileRequired:Mt,captureMode:Ct,chooseCaptureMode:t(e=>{V=e},"chooseCaptureMode"),get captureChoice(){return $()},returning:St,liveness:Le,run:t(async()=>{if(u)throw new Error("verification destroyed");return(await xt()).run()},"run"),currentStep:t(()=>R?.current()??null,"currentStep"),voiceClips:t(async()=>{if(u)return null;try{let e=await v();return u?null:e.voice??null}catch{return null}},"voiceClips"),on:t((e,n)=>S.on(e,n),"on"),destroy:t(()=>{u=!0,me.abort(),R?.destroy(),g!==null&&(g.alive=!1,g.capture.handle.destroy(),g=null),S.clear()},"destroy")}}t(Bt,"dn");var st=["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"],lt=["carte_identite","passport","residence_permit","drivers_license"],Vt=["carte_identite","passport","residence_permit"];function ce(r,s){let p=r.byIssuer?.[s]??r.default;return lt.filter(f=>p==="*"?Vt.includes(f):p.includes(f))}t(ce,"fn");function ut(r,s=st){return[...new Set([...s,...Object.keys(r.byIssuer??{})])].filter(p=>ce(r,p).length>0).sort()}t(ut,"Ro");var L={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"};var yn={full_name:L.fullName,occupation:L.occupation,email:L.email,short_text:L.shortText,long_text:L.longText},ct=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"}),vn=new Map(Object.entries(ct)),_n=new Map(Object.entries(ct).map(([r,s])=>[s,r]));var gn=10*1024*1024;function ir(r){if(r==="permission")return"denied";if(r==="notfound"||r==="insecure"||r==="unsupported")return"no_camera"}t(ir,"ce");var $t=/^[A-Z0-9][A-Z0-9 -]{0,39}$/,Ht=Object.freeze({normalize:t(r=>r.trim().toUpperCase().replace(/\s+/g," "),"normalize"),check:t(r=>$t.test(r),"check"),registrySources:Object.freeze([]),describe:"number must be 1 to 40 letters, digits, spaces or hyphens"}),zt=/^[A-Z0-9]{4,20}$/,de=t(r=>r.trim().toUpperCase().replace(/[\s-]+/g,""),"m"),Zt=Object.freeze({normalize:de,check:t(r=>zt.test(de(r)),"check"),registrySources:Object.freeze([]),describe:"number must be 4 to 20 letters or digits"});function Wt(r){return typeof r=="string"&&/^\d{10}$/.test(r)&&Number(r)%97===1}t(Wt,"fe");var Yt={trim:t(r=>r.trim(),"trim"),upper_single_space:t(r=>r.trim().toUpperCase().replace(/\s+/g," "),"upper_single_space"),upper_no_space_or_hyphen:de},Jt={mr_nni_mod97:t(r=>Wt(r),"mr_nni_mod97")};function Qt(r){let s=new RegExp(r.pattern,"u"),p=r.check===null?void 0:Jt[r.check];return Object.freeze({normalize:Yt[r.normalize],check:t(f=>s.test(f.trim())&&(p===void 0||p(f)),"check"),registrySources:Object.freeze([...r.registrySources]),describe:r.describe})}t(Qt,"Pe");var Xt=Object.freeze(Object.fromEntries(Object.entries(et).map(([r,s])=>[r,Qt(s)])));function en(r,s){return Xt[`${r.toUpperCase()}:${s}`]??(s==="drivers_license"?Zt:Ht)}t(en,"C");var ar=Object.freeze({MRT:"MR"});function or(r){return en("MR","national_id").check(r)}t(or,"Me");function tn(r){let s="";for(let p of r){let f=p.codePointAt(0)??0;f>=1632&&f<=1641?s+=String(f-1632):f>=1776&&f<=1785?s+=String(f-1776):p!==" "&&p!=="-"&&p!==" "&&(s+=p)}return s}t(tn,"H");function sr(r){return tn(r)}t(sr,"He");var lr=ce,ur=ut;var nn=t(()=>import("./create-document-capture-IMDGCTMM-TBX7G2XG.js"),"E");function rn(){nn().then(r=>r.warmDocumentCapture()).catch(()=>{})}t(rn,"D");function cr(){rn()}t(cr,"et");var an=t(()=>import("./create-portrait-capture-5VGYZUOK-KTCFCHTN.js"),"O");function on(){an().then(r=>r.warmPortraitCapture()).catch(()=>{})}t(on,"I");function dr(){on()}t(dr,"at");export{Kt as a,ir as b,or as c,sr as d,lr as e,ur as f,cr as g,dr as h};
@@ -1 +1 @@
1
- import{d as xe,e as He,f as Ke,g as Xe}from"./chunk-4YBL75VD.js";import{a as ne,b as Ze,c as oe,d as Ve}from"./chunk-P7K7ELYZ.js";import{a as Se,b as Y,c as Ie,d as Ae,e as De,h as Re,i as se,j as Ce,k as Oe,l as We,m as ze}from"./chunk-6MYG4HWP.js";import{a as Ge,b as Pe,c as Ue,d as Fe,e as Ne,f as ae,g as j,h as Be,i as Le,j as qe}from"./chunk-JS2IXPNL.js";import{a as n}from"./chunk-4FHWXBOB.js";var wt=1e4,C,bt=(C=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 C(a,t)}async detect(e,t,r){let s;try{s=this.inner.detect(e).detections}catch{return null}let a=Mt(s);if(a?.boundingBox===void 0)return null;let o=Q(e),l=kt(a.keypoints,o),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*o.width,y:c.y*o.height}}:{},score:a.categories[0]?.score??0,extraFaces:je(s.map(d=>d.boundingBox??{width:0,height:0}),s.indexOf(a))};return $e(h,e,t,r)}destroy(){try{this.inner.close()}catch{}}},n(C,"t"),C);function Mt(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}n(Mt,"R");function kt(i,e){let t=i?.[0],r=i?.[1];if(t===void 0||r===void 0)return;let s=n(l=>({x:l.x*e.width,y:l.y*e.height}),"n"),[a,o]=[s(t),s(r)];return a.x<=o.x?{left:a,right:o}:{left:o,right:a}}n(kt,"T");function Tt(){if(typeof OffscreenCanvas=="function")return new OffscreenCanvas(2,2);let i=document.createElement("canvas");return i.width=2,i.height=2,i}n(Tt,"E");var _t=4;async function Et(){let i=globalThis.FaceDetector;if(typeof i!="function")return{ok:!1,reason:"unsupported"};try{let e=new i({fastMode:!0,maxDetectedFaces:_t});return await e.detect(Tt()),{ok:!0,instance:e}}catch(e){return{ok:!1,reason:`smoke_failed:${e instanceof Error?e.message:String(e)}`}}}n(Et,"w");var P,St=(P=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),o=-1;a.forEach((d,u)=>{let v=a[o];(v===void 0||d.width*d.height>v.width*v.height)&&(o=u)});let l=s[o];if(l===void 0)return null;let c=It(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,o)};return $e(h,e,t,r)}destroy(){}},n(P,"b"),P);function It(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}}n(It,"S");var At=.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,o)=>{o!==e&&a.width*a.height>=At*r&&(s+=1)}),s}n(je,"f");var ce="/models-v3",xt=["native","blaze"],U,he=(U=class extends Error{constructor(e){super(`no detector tier available (${e})`),this.name="DetectorLadderError",this.fallbackReason=e}},n(U,"x"),U);function Q(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}}n(Q,"y");function $e(i,e,t,r){let s=Q(e),a=s.width>0?t/s.width:1,o=s.height>0?r/s.height:1,l=n(c=>({x:c.x*a,y:c.y*o}),"s");return{box:{x:i.box.x*a,y:i.box.y*o,width:i.box.width*a,height:i.box.height*o},...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}:{}}}n($e,"h");function Dt(i){return i instanceof Error?i.message:String(i)}n(Dt,"C");async function x(i){let e=i.preferred??xt,t=[];for(let r of e){if(r==="native"){let s=await Et();if(s.ok)return new St(s.instance,le(t));t.push(`native:${s.reason}`);continue}try{return await Rt(bt.create(i.v3AssetBaseUrl??ce,le(t)),i.blazeInitTimeoutMs??wt)}catch(s){t.push(s instanceof Ye?"blaze:blaze_init_timeout":`blaze:${Dt(s)}`)}}throw new he(le(t)??"no_tier_available")}n(x,"O");function le(i){return i.length>0?i.join("; "):void 0}n(le,"v");var F,Ye=(F=class extends Error{},n(F,"g"),F);function Rt(i,e){return new Promise((t,r)=>{let s=setTimeout(()=>{r(new Ye(`init exceeded ${e}ms`)),i.then(a=>a.destroy(),()=>{})},e);i.then(a=>{clearTimeout(s),t(a)},a=>{clearTimeout(s),r(a)})})}n(Rt,"W");var R=1;function Qe(){return typeof OffscreenCanvas=="function"&&typeof createImageBitmap=="function"&&typeof Worker=="function"}n(Qe,"K");function Ct(i,e={}){let t=e.createDetector??x,r=null;i.onmessage=s=>{let a=s.data;if(a.v!==R){a.bitmap?.close?.();return}if(a.type==="init"){t(a.options).then(o=>{r=o;let l={v:R,type:"ready",tier:o.tier,...o.fallbackReason!==void 0?{fallbackReason:o.fallbackReason}:{}};i.postMessage(l)});return}if(a.type==="detect"){let o=n(l=>{let c={v:R,type:"result",id:a.id,observation:l};i.postMessage(c),a.bitmap.close?.()},"a");if(r===null){o(null);return}r.detect(a.bitmap,a.streamWidth,a.streamHeight).then(o,()=>o(null))}}}n(Ct,"B");typeof self<"u"&&typeof self.importScripts=="function"&&Ct(self);var O,Je=(O=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!==R||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 o=setTimeout(()=>{e.removeEventListener("message",l),e.terminate(),a(new Error(`worker detector not ready within ${r}ms`))},r),l=n(h=>{let d=h.data;d.v!==R||d.type!=="ready"||(clearTimeout(o),e.removeEventListener("message",l),s(new O(e,d)))},"s");e.addEventListener("message",l);let c={v:R,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(o=>{this.pending.set(a,o);let l={v:R,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()}},n(O,"t"),O);var Ot=[...Ge.filter(i=>i.startsWith("video/mp4")),"video/webm;codecs=h264","video/webm;codecs=avc1","video/webm;codecs=vp8","video/webm;codecs=vp9","video/webm"],lt=new Set;function Gt(i){let e=/(?:Chrome|Chromium)\/(\d+)\./.exec(i??"");return e?Number(e[1]):null}n(Gt,"De");function Pt(i=Ft(),e=globalThis.navigator?.userAgent){if(i===void 0)return"";let t=Gt(e)===126;for(let r of Ot)if(!(lt.has(r)||t&&r.startsWith("video/mp4")))try{if(i(r))return r}catch{}return""}n(Pt,"fe");function et(i){i!==""&&lt.add(i)}n(et,"V");function Ut(i){return i.replace(/^video\/x-matroska/i,"video/webm")}n(Ut,"ge");function ct(i){let e=/codecs=["']?([^,;"']+)/i.exec(i);return e?e[1].trim():i.split(";")[0].trim()}n(ct,"ut");function Ft(){let i=globalThis.MediaRecorder;return i&&typeof i.isTypeSupported=="function"?e=>i.isTypeSupported(e):void 0}n(Ft,"Oe");var ht=2500,Nt=1e3,Bt=1500,tt=25e5,Lt=100,qt=700,Wt=20,zt=1500,J=null;function Ht(){return J??(J=import("./clip-inspect-DLJXVKV6-TNHTD4LV.js").catch(i=>{throw J=null,i})),J.catch(()=>null)}n(Ht,"Ne");var B,D=(B=class extends Error{constructor(e,t){super(t??e),this.kind=e}},n(B,"S"),B),Kt=100;function it(i,e){return i.stats===void 0?!1:i.stats===null?!0:i.stats.durationMs<e-Kt}n(it,"H");function Xt(i,e){return i.stats?e.stats?i.stats.durationMs>e.stats.durationMs:!0:!1}n(Xt,"be");var L,Zt=(L=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=ht,a){let o=Pt(),l=Ht();return this.recordRaw(e,t,r,s,a,o).then(c=>Vt(c,l),c=>{throw c instanceof D&&(c.requestedMimeType=o),c})}recordRaw(e,t,r,s,a,o){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,o?{mimeType:o,videoBitsPerSecond:tt}:{videoBitsPerSecond:tt})}catch{try{h=new MediaRecorder(e)}catch{c(new D("unsupported"));return}}this.recorder=h;let d=n(p=>{this.settled||(this.settled=!0,this.clearTimers(),p())},"d"),u=n(()=>d(()=>{let p=Ut(h.mimeType||o||Pe),M=new Blob(this.chunks,{type:p});if(M.size===0){c(new D("generic","empty clip"));return}if(ae(M)){c(new D("cliptoolarge"));return}l({blob:M,mimeType:p,requestedMimeType:o})}),"u");h.ondataavailable=p=>{p.data&&p.data.size&&(this.chunks.push(p.data),this.bytes+=p.data.size,this.bytes>Ne&&d(()=>{try{h.state!=="inactive"&&h.stop()}catch{}c(new D("cliptoolarge"))}))},h.onstop=u,h.onerror=()=>d(()=>c(new D("generic")));let v=this.now();if(r!==void 0||a!==void 0){let p=!1;h.onstart=()=>{if(!(p||this.settled)&&(p=!0,v=this.now(),r!==void 0))try{r()}catch{}}}try{h.start(Nt)}catch{d(()=>c(new D("generic")));return}let w=n(()=>{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,Bt)}else u()},"g"),m=this.now();if(a===void 0){this.hardStopTimer=setTimeout(w,s);return}let g=null,y=!1;this.hardStopTimer=setTimeout(w,s+qt),this.pollTimer=setInterval(()=>{if(this.settled||y)return;let p=null;try{p=a.latest()}catch{p=null}let M=p?.presentationTimeMs;M!==void 0&&Number.isFinite(M)&&M>=v&&g===null&&(g=M);let E=g!==null&&M!==void 0&&M-g>=s,I=g===null&&this.now()-m>=s;if(!(!E&&!I)){if(y=!0,this.pollTimer&&clearInterval(this.pollTimer),this.pollTimer=null,I){w();return}this.hardStopTimer&&clearTimeout(this.hardStopTimer),this.hardStopTimer=setTimeout(w,Lt)}},Wt)}))}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}},n(L,"I"),L);async function Vt(i,e){let t,r=new Promise(h=>{t=setTimeout(()=>h(null),zt)}),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 o=s.inspectClipBytes(a);if(o?.container!=="webm")return{...i,stats:o};let l=s.withWebmDuration(a,o.durationMs);if(l===null)return{...i,stats:o};let c=s.inspectClipBytes(l);return c===null||c.frames!==o.frames||c.durationMs!==o.durationMs?{...i,stats:o}:{...i,blob:new Blob([l],{type:i.blob.type}),stats:o}}n(Vt,"He");var jt=["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 $i(i){return $t[i]}n($i,"ft");var Yt=4,Qt=4,ee=n(i=>typeof i=="number"&&Number.isFinite(i),"D");function pe(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=>jt.includes(r))||!Array.isArray(e.onsetsMs)||e.onsetsMs.length!==e.colours.length)return!1;let t=-1;for(let r of e.onsetsMs){if(!ee(r)||r<0||r<=t)return!1;t=r}return!(!ee(e.holdMs)||e.holdMs<=0||!ee(e.endMs)||e.endMs<=t||!ee(e.clipMs)||e.clipMs<e.endMs||e.clipMs>8e3)}n(pe,"O");function Jt(i,e){return pe(i)?Math.max(e,Math.ceil(i.clipMs)):e}n(Jt,"ye");function ei(i,e){let t=e.now??(()=>performance.now()),r=pe(i)?i:void 0,s=[],a=null,o=null,l=null,c=!1,h=null,d=n(m=>{h=m;try{e.paint(m)}catch{}},"d"),u=n(m=>{let g=e.frames?.()??null;return g!==null&&l!==null?g.mediaTimeMs+(m-g.presentationTimeMs)-l:m-(o??m)},"u"),v=n((m,g,y=0)=>{if(c)return;let p=Math.max(0,m-u(t()));a=setTimeout(()=>{if(a=null,!c){if(y<Yt&&u(t())<m-Qt){v(m,g,y+1);return}g()}},p)},"f"),w=n(m=>{if(r===void 0)return;let g=r.endMs;if(m>=r.colours.length){v(g,()=>d(null));return}let y=r.onsetsMs[m],p=m+1<r.onsetsMs.length?r.onsetsMs[m+1]:g;v(y,()=>{let M=u(t());if(M>g){h!==null&&d(null);return}let E=r.colours[m];d(E);let I=s.length===0?0:s[s.length-1].tMs;s.push({tMs:Math.max(I,Math.round(M)),colour:E});let T=y+r.holdMs;if(T<p){v(T,()=>{if(u(t())>g){h!==null&&d(null);return}d("dark"),w(m+1)});return}w(m+1)})},"g");return{started(m){if(r===void 0||c||o!==null)return;o=m;let g=e.frames?.()??null;l=g===null?null:g.mediaTimeMs+(m-g.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]}}}}n(ei,"Me");function ti(i,e,t=.92){return new Promise((r,s)=>{let a=i.videoWidth,o=i.videoHeight;if(!a||!o){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=o,l.scale(-1,1),l.drawImage(i,-a,0),e.toBlob(c=>c?r(c):s(new Error("empty-keyframe")),"image/jpeg",t)})}n(ti,"Se");var q,ii=(q=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=n(()=>{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()})}},n(q,"P"),q),ri=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}),N=n(i=>Math.min(1,Math.max(0,i)),"_"),W,rt=(W=class{constructor(e={}){this.p=0,this.lastTickAt=null,this.lastCenter=null,this.velocityEma=0,this.qWindow=[],this.lastSizeDirection="ideal",this.t={...ri,...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 o={presence:0,single:1,centering:0,size:0,pose:0,sharpness:N(r.sharpness),exposure:N(r.exposure),motion:1};if(t!==null){o.presence=1,o.single=(t.extraFaces??0)>0?0:1;let d=this.geometryOf(t,e);o.centering=d.centering,o.size=d.size,o.pose=d.pose,o.motion=this.motionOf(d.center,d.iod,s)}else this.lastCenter=null,this.velocityEma=0;let l=Math.min(o.presence,o.single,o.centering,o.size,o.pose,o.sharpness,o.exposure,o.motion);this.p=N(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((v,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:o,guidanceKey:this.guidanceOf(o,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},o=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-N(h/(this.t.CENTER_FALLOFF_IOD_MULTIPLE*c)),u=o>0?c/o:0;this.lastSizeDirection=u<this.t.SIZE_IDEAL_MIN?"far":u>this.t.SIZE_IDEAL_MAX?"close":"ideal";let v;u<this.t.SIZE_HARD_MIN||u>this.t.SIZE_HARD_MAX?v=0:u<this.t.SIZE_IDEAL_MIN?v=(u-this.t.SIZE_HARD_MIN)/(this.t.SIZE_IDEAL_MIN-this.t.SIZE_HARD_MIN):u>this.t.SIZE_IDEAL_MAX?v=(this.t.SIZE_HARD_MAX-u)/(this.t.SIZE_HARD_MAX-this.t.SIZE_IDEAL_MAX):v=1;let w=1;if(s!==void 0){let m=Math.abs(Math.atan2(s.right.y-s.left.y,s.right.x-s.left.x))*180/Math.PI;w=1-N(m/this.t.ROLL_MAX_DEG)}return{center:l,iod:c,centering:d,size:v,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 o=Math.hypot(e.x-s.x,e.y-s.y)/t/a;o<=this.t.MOTION_DEADBAND_IOD_PER_S&&(o=0);let l=1-Math.exp(-a/this.t.MOTION_TAU_S);return this.velocityEma=l*o+(1-l)*this.velocityEma,1-N(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 o of s)e[o[0]]<e[a[0]]&&(a=o);return a[1]}return"fcv3.hold_still"}sizeGuidance(){return this.lastSizeDirection==="far"?"fcv3.come_closer":"fcv3.move_back"}exposureGuidance(e){let t=(ne[0]+ne[1])/2;return e.meanLuma<t?"fcv3.more_light":"fcv3.too_bright"}},n(W,"k"),W),si=["single","size","centering","pose","exposure","sharpness","motion"];function ai(i){if(i.accepted)return null;if(i.factors.presence<=0)return"no_face";let e="single";for(let t of si)i.factors[t]<i.factors[e]&&(e=t);return e}n(ai,"Ze");var z,st=(z=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=ai(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}}},n(z,"w"),z),ni=["obs","manycam","virtual","snap camera","xsplit","droidcam","iriun","camo"],oi=[/^(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 li(i){let e=(i??"").trim().toLowerCase();return e.length===0?"unknown":ni.some(t=>e.includes(t))?"known_virtual":oi.some(t=>t.test(e))?"platform":"unknown"}n(li,"je");function at(i){if(typeof i!="function")return!1;try{return/\{\s*\[native code\]\s*\}\s*$/.test(Function.prototype.toString.call(i))}catch{return!1}}n(at,"Te");function ci(i=globalThis){return at(i.navigator?.mediaDevices?.getUserMedia)&&at(i.MediaStreamTrack?.prototype?.getSettings)}n(ci,"$e");async function hi(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}}n(hi,"Je");async function ui(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 hi(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:li(s),prototypesIntact:ci(e)}}n(ui,"Ce");var ue=n(i=>Math.round(i*100)/100,"K");function di(i){let e=i,t=typeof e?.requestVideoFrameCallback=="function",r=null,s=null,a=0,o=0,l=0,c=0,h=0,d=0,u=n(()=>{!t||e?.requestVideoFrameCallback===void 0||(r=e.requestVideoFrameCallback((v,w)=>{if(r=null,!t)return;let m=w.presentationTime;if(s!==null){let g=m-s.presentationTimeMs;o+=1;let y=g-l;l+=y/o,c+=y*(g-l)}typeof w.captureTime=="number"&&Number.isFinite(w.captureTime)&&(h+=m-w.captureTime,d+=1),a+=1,s={mediaTimeMs:w.mediaTime*1e3,presentationTimeMs:m},u()}))},"u");return u(),{latest:n(()=>s,"latest"),stats:n(()=>({n:a,meanGapMs:o===0?0:ue(l),stdGapMs:o<2?0:ue(Math.sqrt(c/(o-1))),captureLatencyMs:d===0?null:ue(h/d)}),"stats"),stop:n(()=>{t&&(t=!1,r!==null&&e?.cancelVideoFrameCallback?.(r),r=null)},"stop")}}n(di,"Ee");function fi(i,e,t){return{...i,rvfc:e,rampPainter:t}}n(fi,"_e");var mi=1e3,de="fcv3.hold_upright",pi=200,fe=4,gi=600,vi=1e3,nt={sharpness:1,exposure:1,meanLuma:128};function yi(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))}n(yi,"it");function wi(){return Y()==="phone"}n(wi,"at");var H,ut=(H=class{constructor(e){this.handlers=new Map,this.stateValue="idle",this.attempt=0,this.stream=null,this.detector=null,this.scheduler=null,this.gate=null,this.profiler=null,this.lastGuidanceKey=null,this.positioningStartedAt=0,this.cameraRequestedAt=null,this.cameraReadyAt=null,this.faceAcquiredAt=null,this.captureCompleteAt=null,this.fired=!1,this.carriedDegrade=0,this.carriedMeans=[],this.blockStats=null,this.lastGateSnapshotAt=Number.NEGATIVE_INFINITY,this.uprightGuard=!1,this.trackProvenance=null,this.ramp=null,this.snapshotCanvas=null,this.options=e,this.facing=e.facingMode??"user"}get state(){return this.stateValue}on(e,t){let 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??wi)(),this.setState("preflight");let r=Ue();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(Ie(),this.facing).video;a=await ze(this.facing,d,{getUserMedia:s,enumerateDevices:ki(t)})}catch(h){if(e!==this.attempt)return;if(h instanceof We){this.fail("backcamera",{phase:"acquiring",name:j(h)});return}this.fail(Le(h),{phase:"acquiring",name:j(h)});return}if(xe(a),qe(a),e!==this.attempt){for(let h of a.getTracks())h.stop();return}this.stream=a;let o=a.getVideoTracks?.()[0];if(this.trackProvenance=o===void 0?null:ui(o).catch(()=>null),this.facing=Ae(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&&Qe()?async()=>{try{return await Je.create(t.createWorker(),h)}catch{return x(h)}}:()=>x(h)),u;try{u=await d()}catch(v){e===this.attempt&&this.fail("models",{phase:"models",name:j(v)},v instanceof he?v.fallbackReason:Mi(v));return}if(e!==this.attempt){u.destroy();return}this.detector=u,this.options.telemetry?.({type:"detector",tier:u.tier,fallbackReason:u.fallbackReason})}let l=He(),c=t.deviceClass??Ke(l);this.profiler=new Xe(c),this.options.telemetry?.({type:"profile",staticClass:c,activeClass:this.profiler.deviceClass,simd:l.simd}),this.gate=new rt(t.thresholds??{}),this.blockStats=new st,this.lastGateSnapshotAt=this.now(),t.rankKeyframes?.()&&import("./keyframe-rank-YAJLYJYF-WCA6RPMD.js").then(h=>me=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 ii({cadenceHz:t.profile.cadenceHz,video:this.options.video,now:this.options.now,run:n(()=>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 o=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!==o&&this.startScheduler(e);let d=h===null?nt: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>=mi&&(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((T,b)=>T+b,0)/a.length});let o=t.mode??"clip",l=t.rankKeyframes?.()&&me?me.default(this,e).catch(()=>this.collectKeyframes(e)):this.collectKeyframes(e);if(o==="photo"){let T=this.watchRotation(e,null),b=await l;if(T(),e!==this.attempt)return;if(b===null){this.fail("generic",{phase:"keyframes"});return}let A=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,...A});return}this.setState("recording");let c=this.stream;if(c===null){this.fail("generic",{phase:"recording"});return}let h=t.screenRamp?.(),d=pe(h),u=null;l.then(T=>{u=T},()=>{});let v=n(()=>{e===this.attempt&&u!==null&&this.emit("frozen",{previewDataUrl:u.previewDataUrl})},"f"),w=Jt(h,ht),m=null,g,y=0;try{let T=this.recordTake(e,c,h,w,void 0).then(S=>S,S=>({failed:S})),[b,A]=await Promise.all([T,l]);if(g=A,e!==this.attempt)return;if("failed"in b){if(b.failed.kind==="cliptoolarge")throw b.failed;et(b.failed.requestedMimeType??"")}else m=b,it(b.clip,w)?b.clip.stats===null&&et(b.clip.requestedMimeType??""):v();if(m===null||it(m.clip,w)){y=1,t.telemetry?.({type:"clip_retake",reason:m===null?"error":m.clip.stats===null?"unreadable":"short"});let S=null;try{S=await this.recordTake(e,c,h,w,v)}catch(K){if(m===null)throw K}if(e!==this.attempt)return;S!==null&&(m===null||Xt(S.clip,m.clip))&&(m=S),S===null&&v()}}catch(T){if(e!==this.attempt)return;let b=T.kind;this.fail(b==="cliptoolarge"?"cliptoolarge":"recorder",{phase:"recording",name:j(T)});return}if(m===null){this.fail("recorder",{phase:"recording"});return}let{clip:p,rvfc:M,report:E}=m;if(ae(p.blob)){this.fail("cliptoolarge",{phase:"recording"});return}if(g===null){this.fail("generic",{phase:"keyframes"});return}let I=await this.provenance(M,d);e===this.attempt&&this.finishCapture({clip:p.blob,clipMimeType:p.mimeType,...p.stats?{clipStats:p.stats}:{},clipRetakes:y,keyframe:g.blob,previewDataUrl:g.previewDataUrl,...E!==void 0&&E.rendered.length>0?{screenRamp:E}:{},...I})}async recordTake(e,t,r,s,a){let o=this.options.createRecorder?.()??new Zt({now:n(()=>this.now(),"now")}),l=di(this.options.video),c=ei(r,{paint:n(u=>{(u===null||e===this.attempt)&&this.emit("ramp",{colour:u})},"paint"),now:n(()=>this.now(),"now"),frames:l.latest});this.ramp=c;let h=n(()=>{l.stop(),c.stop(),this.ramp===c&&(this.ramp=null)},"l"),d=this.watchRotation(e,o);try{return{clip:await o.record(t,a,()=>c.started(this.now()),s,l),rvfc:l.stats(),report:c.report()}}finally{d(),h()}}async provenance(e,t){let r=this.trackProvenance;if(r===null)return{};let s,a=new Promise(l=>{s=setTimeout(()=>l(null),vi)}),o=await Promise.race([r,a]);return clearTimeout(s),o===null?{}:{provenance:fi(o,e,t)}}isLandscape(){let e=this.options.video;return this.uprightGuard&&e.videoWidth>e.videoHeight}holdUpright(e){this.gate?.reset(),this.emit("checks",{engine:"v3",progress:0,q:0,factors:{presence:0,single:1,centering:0,size:0,pose:0,sharpness:0,exposure:0,motion:0},attempt:e}),this.lastGuidanceKey!==de&&(this.lastGuidanceKey=de,this.emit("guidance",{key:de}))}watchRotation(e,t){if(!this.uprightGuard)return()=>{};let r=this.options.video,s=n(()=>{if(e!==this.attempt||t!==null&&this.stateValue!=="recording"){l();return}r.videoWidth>0&&this.isLandscape()&&(l(),this.abortRecording(e,t))},"n"),a=setInterval(s,pi);r.addEventListener?.("resize",s);let o=!1;function l(){o||(o=!0,clearInterval(a),r.removeEventListener?.("resize",s))}return n(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 rt(this.options.thresholds??{}),this.blockStats=new st,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=gi/(fe-1),s=null;for(let a=0;a<fe;a+=1){if(e!==this.attempt)return s;try{let o=await t(this.options.video);(s===null||o.sharpness>s.sharpness)&&(s=o)}catch{}a<fe-1&&await bi(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=n((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"?ti:yi)(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)),o=Math.max(1,Math.round(e.videoHeight*s)),l=r.getContext("2d");return l===null?e:(r.width!==a&&(r.width=a),r.height!==o&&(r.height=o),l.drawImage(e,0,0,a,o),this.snapshotCanvas=r,r)}catch{return e}}defaultQuality(e,t){let r=ot(e,t,96);return r===null?nt:{sharpness:oe(r),exposure:Ve(r),meanLuma:Ze(r)}}centerSharpness(e){let t=Q(e),r=ot(e,{x:t.width*.25,y:t.height*.25,width:t.width*.5,height:t.height*.5},96);return r===null?0:oe(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()}},n(H,"ke"),H),me;function bi(i){return new Promise(e=>setTimeout(e,i))}n(bi,"st");function Mi(i){return i instanceof Error?i.message:String(i)}n(Mi,"ot");function ot(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}}n(ot,"we");function ki(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()}n(ki,"lt");var Ti=12e4,dt=13e4,_i=3e3,Ei=1200,ge=Symbol.for("@sekyro/web.preload.v1");function ye(){let i=globalThis;return i[ge]??(i[ge]=new Map),i[ge]}n(ye,"h");function te(i){let e=(i??ce).replace(/\/+$/,"");return e===""?"/":e}n(te,"b");function mt(i){let e=ye(),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}n(mt,"ae");function ve(i,e){if(i.status!==e){i.status=e;for(let t of[...i.listeners])t(e)}}n(ve,"k");var Si=n(i=>x({preferred:["blaze"],v3AssetBaseUrl:i,blazeInitTimeoutMs:Ti}),"K"),Ii=Si;function Ai(){return typeof window<"u"&&typeof navigator<"u"&&typeof navigator.mediaDevices?.getUserMedia=="function"}n(Ai,"Ce");function xi(){return navigator.connection?.saveData===!0}n(xi,"Se");function Di(i){let e=window;if(typeof e.requestIdleCallback=="function"){let r=e.requestIdleCallback(i,{timeout:_i});return()=>e.cancelIdleCallback?.(r)}let t=setTimeout(i,Ei);return()=>clearTimeout(t)}n(Di,"Ee");function Ri(i,e){let t,r=new Promise(l=>{t=l}),s=!1,a=n(()=>{},"u"),o={promise:r,settle:n(l=>{s||(s=!0,a(),i.scheduled===o&&(i.scheduled=null),t(l))},"settle")};return i.scheduled=o,a=Di(()=>{s||o.settle(we(i,e))}),r}n(Ri,"ye");function we(i,e){if((i.status==="loading"||i.status==="ready")&&i.promise!==null)return i.promise;ve(i,"loading");let t=new Promise(o=>o(Ii(e)));i.detectorPromise=t;let r,s=new Promise((o,l)=>{r=setTimeout(()=>{t.then(c=>c.destroy(),()=>{}),l(new Error(`detector preload exceeded ${dt} ms`))},dt)}),a=Promise.race([t,s]).then(o=>i.detectorPromise!==t?(o.destroy(),i.status):(i.detector=o,ve(i,"ready"),"ready"),o=>(i.detectorPromise===t&&(i.detectorPromise=null,i.detector=null,ve(i,"failed"),console.warn("[@sekyro/web] face-detector preload failed:",o)),i.status)).finally(()=>clearTimeout(r));return i.promise=a,i.scheduled?.settle(a),a}n(we,"U");function sr(i={}){if(!Ai())return Promise.resolve("idle");let e=te(i.assetBaseUrl),t=mt(e);return i.respectSaveData===!0&&xi()?Promise.resolve(t.status):(t.status==="loading"||t.status==="ready")&&t.promise!==null?t.promise:i.idle===!0?t.scheduled?.promise??Ri(t,e):we(t,e)}n(sr,"xe");function ar(i){return ye().get(te(i))?.status??"idle"}n(ar,"Fe");function nr(i,e){let t=mt(te(e));return t.listeners.add(i),()=>{t.listeners.delete(i)}}n(nr,"Ie");function Ci(i){return{get tier(){return i.tier},get fallbackReason(){return i.fallbackReason},detect:n((...e)=>i.detect(...e),"detect"),destroy:n(()=>{},"destroy")}}n(Ci,"Le");function Oi(i){let e=te(i),t=ye().get(e);if(!(t===void 0||t.detector===null&&t.detectorPromise===null&&t.scheduled===null))return async()=>{t.scheduled!==null&&we(t,e);let r=t.promise;for(;t.detector===null&&r!==null&&(await r,t.promise!==r);)r=t.promise;return t.detector!==null?Ci(t.detector):x({v3AssetBaseUrl:e})}}n(Oi,"de");var Gi=new Set(["inuse","overconstrained","notfound"]),Pi=[500,1500];function Ui(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}}n(Ui,"Ae");function Fi(i){switch(i){case"preflight":case"acquiring":return"starting";case"positioning":return"gating";default:return i}}n(Fi,"Pe");function ft(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"}}}n(ft,"ue");function Ni(i,e,t){if(t===void 0)return{kind:ft(i),retryable:e};let r=Be(t.name);return{kind:ft(i),retryable:e,detail:{...r!==void 0?{name:r}:{},phase:t.phase,engineKind:i}}}n(Ni,"we");var Bi=new Set(["captured","uploading","checking"]);function Li(i,e={},t,r=()=>"self",s=()=>{},a){let o=e.now??(()=>performance.now()),l=e.canChooseFacing??Re,c="user",h=Ce(),d=r(),u=De(),v=!Fe(),w=e.engineOptions,m=w?.createDetector===void 0&&w?.createWorker===void 0?{createDetector:n(()=>{let f=Oi(i.assetBaseUrl);return f!==void 0?f():x({v3AssetBaseUrl:i.assetBaseUrl})},"createDetector")}:{},g={video:i.video,mode:v?"photo":"clip",rankKeyframes:t,facingMode:void 0,v3AssetBaseUrl:i.assetBaseUrl,screenRamp:n(()=>d==="self"&&u.count("ramp")>0?s():void 0,"screenRamp"),...e.engineOptions??{},...m},y=e.createEngine?.(g)??new ut(g),p="idle",M=null,E=0,I=!1,T="full",b=null,A=null,S=0,K=0,be=n(()=>{i.video.videoWidth>0&&i.video.videoHeight>0&&(S=i.video.videoWidth,K=i.video.videoHeight)},"W"),Me=Oe({enabled:i.keepScreenAwake!==!1}),X=n(f=>{p=f,Me.setActive(f==="starting"||f==="gating"||f==="recording"),u.emit("state",f)},"S"),ie=n(()=>u.emit("gate",{progress:E,hint:M,faceDetected:I}),"F"),re=n(()=>{let f=y.animations??"full";f!==T&&(T=f,u.emit("profile",{animations:T}))},"I"),G=0,$=null,pt=e.schedule??((f,k)=>{let _=setTimeout(f,k);return()=>clearTimeout(_)}),Z=n(()=>{$?.(),$=null},"E"),gt=n((f,k)=>{if(V||!Gi.has(f)||k?.phase!=="acquiring")return!1;let _=Pi[G];return _===void 0?!1:(G+=1,Z(),$=pt(()=>{$=null,V||y.retry()},_),!0)},"fe"),vt=[y.on("statechange",({state:f})=>{if(f==="error")return;let k=Fi(f);k==="gating"&&(G=0),k==="starting"&&p!=="starting"&&(M=null,E=0,I=!1,b=null,A=null,S=0,K=0),X(k),re(),k==="recording"&&(be(),b=o(),M="hold",E=1,ie())}),y.on("checks",f=>{be(),E=f.progress,I=f.factors.presence>0,ie(),re()}),y.on("guidance",({key:f})=>{M=Ui(f),ie()}),y.on("frozen",({previewDataUrl:f})=>{A=o(),u.emit("frozen",{previewDataUrl:f})}),y.on("ramp",f=>u.emit("ramp",f)),y.on("artifacts",f=>{if(p!=="captured")return;let k=Y(),_=f.clipStats,_e=_!==void 0?Math.round(_.durationMs):b!==null&&A!==null?Math.max(0,Math.round(A-b)):void 0,Ee=_!==void 0&&_.frames>1&&_.durationMs>0?Math.round(_.frames*1e4/_.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||S,height:i.video.videoHeight||K,..._e!==void 0?{clipMs:_e}:{},..._!==void 0?{clipFrames:_.frames}:{},...Ee!==void 0?{fps:Ee}:{},...f.clipRetakes!==void 0?{clipRetakes:f.clipRetakes}:{},...f.clipMimeType!==void 0?{codec:ct(f.clipMimeType)}:{},captureChannel:k==="desktop"?"desktop":"mobile",formFactor:k,...v?{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:_})=>{f==="backcamera"&&yt()||gt(f,_)||(X("error"),re(),u.emit("error",Ni(f,k,_)))})],ke=!1;function yt(){return V||ke||d!=="assisted"||a===void 0||a.session()!=="choice"?!1:(ke=!0,a.onModeChange("self"),d="self",c=se("self"),X("mode_switch"),y.restart(c),!0)}n(yt,"me");let Te=n(async()=>a!==void 0&&a.session()==="choice"&&await l().catch(()=>!1),"$"),V=!1;return{handle:{get state(){return p},get captureMode(){return r()},get facingMode(){return y.facingMode??c},on:n((f,k)=>u.on(f,k),"on"),start:n(f=>(d=r(),h.facing(d,i.facing),c=h.facing(d,f?.facing),Z(),G=0,y.start({facingMode:c})),"start"),retry:n(()=>{Z(),G=0,y.retry()},"retry"),switchCamera:n(()=>h.refuseSwitch(r()),"switchCamera"),canSwitchCaptureMode:Te,setCaptureMode:n(async f=>{if(f===r()||!await Te()||V||Bi.has(p)||a===void 0)return!1;a.onModeChange(f),d=f;let k=se(f);return c=k,p==="idle"||(X("mode_switch"),Z(),G=0,y.restart(k)),!0},"setCaptureMode"),destroy:n(()=>{V=!0,Z();for(let f of vt)f();Me.setActive(!1),y.destroy(),u.clear()},"destroy")},setFlowState:n(f=>{p!==f&&X(f)},"setFlowState")}}n(Li,"De");function or(i){return Li(i).handle}n(or,"Ze");export{$i as a,sr as b,ar as c,nr as d,Ni as e,Li as f,or as g};
1
+ import{d as xe,e as He,f as Ke,g as Xe}from"./chunk-F7DKVXQW.js";import{a as ne,b as Ze,c as oe,d as Ve}from"./chunk-P7K7ELYZ.js";import{a as Se,b as Y,c as Ie,d as Ae,e as De,h as Re,i as se,j as Ce,k as Oe,l as We,m as ze}from"./chunk-6MYG4HWP.js";import{a as Ge,b as Pe,c as Ue,d as Fe,e as Ne,f as ae,g as j,h as Be,i as Le,j as qe}from"./chunk-JS2IXPNL.js";import{a as n}from"./chunk-4FHWXBOB.js";var wt=1e4,C,bt=(C=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 C(a,t)}async detect(e,t,r){let s;try{s=this.inner.detect(e).detections}catch{return null}let a=Mt(s);if(a?.boundingBox===void 0)return null;let o=Q(e),l=kt(a.keypoints,o),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*o.width,y:c.y*o.height}}:{},score:a.categories[0]?.score??0,extraFaces:je(s.map(d=>d.boundingBox??{width:0,height:0}),s.indexOf(a))};return $e(h,e,t,r)}destroy(){try{this.inner.close()}catch{}}},n(C,"t"),C);function Mt(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}n(Mt,"R");function kt(i,e){let t=i?.[0],r=i?.[1];if(t===void 0||r===void 0)return;let s=n(l=>({x:l.x*e.width,y:l.y*e.height}),"n"),[a,o]=[s(t),s(r)];return a.x<=o.x?{left:a,right:o}:{left:o,right:a}}n(kt,"T");function Tt(){if(typeof OffscreenCanvas=="function")return new OffscreenCanvas(2,2);let i=document.createElement("canvas");return i.width=2,i.height=2,i}n(Tt,"E");var _t=4;async function Et(){let i=globalThis.FaceDetector;if(typeof i!="function")return{ok:!1,reason:"unsupported"};try{let e=new i({fastMode:!0,maxDetectedFaces:_t});return await e.detect(Tt()),{ok:!0,instance:e}}catch(e){return{ok:!1,reason:`smoke_failed:${e instanceof Error?e.message:String(e)}`}}}n(Et,"w");var P,St=(P=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),o=-1;a.forEach((d,u)=>{let v=a[o];(v===void 0||d.width*d.height>v.width*v.height)&&(o=u)});let l=s[o];if(l===void 0)return null;let c=It(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,o)};return $e(h,e,t,r)}destroy(){}},n(P,"b"),P);function It(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}}n(It,"S");var At=.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,o)=>{o!==e&&a.width*a.height>=At*r&&(s+=1)}),s}n(je,"f");var ce="/models-v3",xt=["native","blaze"],U,he=(U=class extends Error{constructor(e){super(`no detector tier available (${e})`),this.name="DetectorLadderError",this.fallbackReason=e}},n(U,"x"),U);function Q(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}}n(Q,"y");function $e(i,e,t,r){let s=Q(e),a=s.width>0?t/s.width:1,o=s.height>0?r/s.height:1,l=n(c=>({x:c.x*a,y:c.y*o}),"s");return{box:{x:i.box.x*a,y:i.box.y*o,width:i.box.width*a,height:i.box.height*o},...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}:{}}}n($e,"h");function Dt(i){return i instanceof Error?i.message:String(i)}n(Dt,"C");async function x(i){let e=i.preferred??xt,t=[];for(let r of e){if(r==="native"){let s=await Et();if(s.ok)return new St(s.instance,le(t));t.push(`native:${s.reason}`);continue}try{return await Rt(bt.create(i.v3AssetBaseUrl??ce,le(t)),i.blazeInitTimeoutMs??wt)}catch(s){t.push(s instanceof Ye?"blaze:blaze_init_timeout":`blaze:${Dt(s)}`)}}throw new he(le(t)??"no_tier_available")}n(x,"O");function le(i){return i.length>0?i.join("; "):void 0}n(le,"v");var F,Ye=(F=class extends Error{},n(F,"g"),F);function Rt(i,e){return new Promise((t,r)=>{let s=setTimeout(()=>{r(new Ye(`init exceeded ${e}ms`)),i.then(a=>a.destroy(),()=>{})},e);i.then(a=>{clearTimeout(s),t(a)},a=>{clearTimeout(s),r(a)})})}n(Rt,"W");var R=1;function Qe(){return typeof OffscreenCanvas=="function"&&typeof createImageBitmap=="function"&&typeof Worker=="function"}n(Qe,"K");function Ct(i,e={}){let t=e.createDetector??x,r=null;i.onmessage=s=>{let a=s.data;if(a.v!==R){a.bitmap?.close?.();return}if(a.type==="init"){t(a.options).then(o=>{r=o;let l={v:R,type:"ready",tier:o.tier,...o.fallbackReason!==void 0?{fallbackReason:o.fallbackReason}:{}};i.postMessage(l)});return}if(a.type==="detect"){let o=n(l=>{let c={v:R,type:"result",id:a.id,observation:l};i.postMessage(c),a.bitmap.close?.()},"a");if(r===null){o(null);return}r.detect(a.bitmap,a.streamWidth,a.streamHeight).then(o,()=>o(null))}}}n(Ct,"B");typeof self<"u"&&typeof self.importScripts=="function"&&Ct(self);var O,Je=(O=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!==R||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 o=setTimeout(()=>{e.removeEventListener("message",l),e.terminate(),a(new Error(`worker detector not ready within ${r}ms`))},r),l=n(h=>{let d=h.data;d.v!==R||d.type!=="ready"||(clearTimeout(o),e.removeEventListener("message",l),s(new O(e,d)))},"s");e.addEventListener("message",l);let c={v:R,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(o=>{this.pending.set(a,o);let l={v:R,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()}},n(O,"t"),O);var Ot=[...Ge.filter(i=>i.startsWith("video/mp4")),"video/webm;codecs=h264","video/webm;codecs=avc1","video/webm;codecs=vp8","video/webm;codecs=vp9","video/webm"],lt=new Set;function Gt(i){let e=/(?:Chrome|Chromium)\/(\d+)\./.exec(i??"");return e?Number(e[1]):null}n(Gt,"De");function Pt(i=Ft(),e=globalThis.navigator?.userAgent){if(i===void 0)return"";let t=Gt(e)===126;for(let r of Ot)if(!(lt.has(r)||t&&r.startsWith("video/mp4")))try{if(i(r))return r}catch{}return""}n(Pt,"fe");function et(i){i!==""&&lt.add(i)}n(et,"V");function Ut(i){return i.replace(/^video\/x-matroska/i,"video/webm")}n(Ut,"ge");function ct(i){let e=/codecs=["']?([^,;"']+)/i.exec(i);return e?e[1].trim():i.split(";")[0].trim()}n(ct,"ut");function Ft(){let i=globalThis.MediaRecorder;return i&&typeof i.isTypeSupported=="function"?e=>i.isTypeSupported(e):void 0}n(Ft,"Oe");var ht=2500,Nt=1e3,Bt=1500,tt=25e5,Lt=100,qt=700,Wt=20,zt=1500,J=null;function Ht(){return J??(J=import("./clip-inspect-DLJXVKV6-TNHTD4LV.js").catch(i=>{throw J=null,i})),J.catch(()=>null)}n(Ht,"Ne");var B,D=(B=class extends Error{constructor(e,t){super(t??e),this.kind=e}},n(B,"S"),B),Kt=100;function it(i,e){return i.stats===void 0?!1:i.stats===null?!0:i.stats.durationMs<e-Kt}n(it,"H");function Xt(i,e){return i.stats?e.stats?i.stats.durationMs>e.stats.durationMs:!0:!1}n(Xt,"be");var L,Zt=(L=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=ht,a){let o=Pt(),l=Ht();return this.recordRaw(e,t,r,s,a,o).then(c=>Vt(c,l),c=>{throw c instanceof D&&(c.requestedMimeType=o),c})}recordRaw(e,t,r,s,a,o){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,o?{mimeType:o,videoBitsPerSecond:tt}:{videoBitsPerSecond:tt})}catch{try{h=new MediaRecorder(e)}catch{c(new D("unsupported"));return}}this.recorder=h;let d=n(p=>{this.settled||(this.settled=!0,this.clearTimers(),p())},"d"),u=n(()=>d(()=>{let p=Ut(h.mimeType||o||Pe),M=new Blob(this.chunks,{type:p});if(M.size===0){c(new D("generic","empty clip"));return}if(ae(M)){c(new D("cliptoolarge"));return}l({blob:M,mimeType:p,requestedMimeType:o})}),"u");h.ondataavailable=p=>{p.data&&p.data.size&&(this.chunks.push(p.data),this.bytes+=p.data.size,this.bytes>Ne&&d(()=>{try{h.state!=="inactive"&&h.stop()}catch{}c(new D("cliptoolarge"))}))},h.onstop=u,h.onerror=()=>d(()=>c(new D("generic")));let v=this.now();if(r!==void 0||a!==void 0){let p=!1;h.onstart=()=>{if(!(p||this.settled)&&(p=!0,v=this.now(),r!==void 0))try{r()}catch{}}}try{h.start(Nt)}catch{d(()=>c(new D("generic")));return}let w=n(()=>{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,Bt)}else u()},"g"),m=this.now();if(a===void 0){this.hardStopTimer=setTimeout(w,s);return}let g=null,y=!1;this.hardStopTimer=setTimeout(w,s+qt),this.pollTimer=setInterval(()=>{if(this.settled||y)return;let p=null;try{p=a.latest()}catch{p=null}let M=p?.presentationTimeMs;M!==void 0&&Number.isFinite(M)&&M>=v&&g===null&&(g=M);let E=g!==null&&M!==void 0&&M-g>=s,I=g===null&&this.now()-m>=s;if(!(!E&&!I)){if(y=!0,this.pollTimer&&clearInterval(this.pollTimer),this.pollTimer=null,I){w();return}this.hardStopTimer&&clearTimeout(this.hardStopTimer),this.hardStopTimer=setTimeout(w,Lt)}},Wt)}))}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}},n(L,"I"),L);async function Vt(i,e){let t,r=new Promise(h=>{t=setTimeout(()=>h(null),zt)}),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 o=s.inspectClipBytes(a);if(o?.container!=="webm")return{...i,stats:o};let l=s.withWebmDuration(a,o.durationMs);if(l===null)return{...i,stats:o};let c=s.inspectClipBytes(l);return c===null||c.frames!==o.frames||c.durationMs!==o.durationMs?{...i,stats:o}:{...i,blob:new Blob([l],{type:i.blob.type}),stats:o}}n(Vt,"He");var jt=["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 $i(i){return $t[i]}n($i,"ft");var Yt=4,Qt=4,ee=n(i=>typeof i=="number"&&Number.isFinite(i),"D");function pe(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=>jt.includes(r))||!Array.isArray(e.onsetsMs)||e.onsetsMs.length!==e.colours.length)return!1;let t=-1;for(let r of e.onsetsMs){if(!ee(r)||r<0||r<=t)return!1;t=r}return!(!ee(e.holdMs)||e.holdMs<=0||!ee(e.endMs)||e.endMs<=t||!ee(e.clipMs)||e.clipMs<e.endMs||e.clipMs>8e3)}n(pe,"O");function Jt(i,e){return pe(i)?Math.max(e,Math.ceil(i.clipMs)):e}n(Jt,"ye");function ei(i,e){let t=e.now??(()=>performance.now()),r=pe(i)?i:void 0,s=[],a=null,o=null,l=null,c=!1,h=null,d=n(m=>{h=m;try{e.paint(m)}catch{}},"d"),u=n(m=>{let g=e.frames?.()??null;return g!==null&&l!==null?g.mediaTimeMs+(m-g.presentationTimeMs)-l:m-(o??m)},"u"),v=n((m,g,y=0)=>{if(c)return;let p=Math.max(0,m-u(t()));a=setTimeout(()=>{if(a=null,!c){if(y<Yt&&u(t())<m-Qt){v(m,g,y+1);return}g()}},p)},"f"),w=n(m=>{if(r===void 0)return;let g=r.endMs;if(m>=r.colours.length){v(g,()=>d(null));return}let y=r.onsetsMs[m],p=m+1<r.onsetsMs.length?r.onsetsMs[m+1]:g;v(y,()=>{let M=u(t());if(M>g){h!==null&&d(null);return}let E=r.colours[m];d(E);let I=s.length===0?0:s[s.length-1].tMs;s.push({tMs:Math.max(I,Math.round(M)),colour:E});let T=y+r.holdMs;if(T<p){v(T,()=>{if(u(t())>g){h!==null&&d(null);return}d("dark"),w(m+1)});return}w(m+1)})},"g");return{started(m){if(r===void 0||c||o!==null)return;o=m;let g=e.frames?.()??null;l=g===null?null:g.mediaTimeMs+(m-g.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]}}}}n(ei,"Me");function ti(i,e,t=.92){return new Promise((r,s)=>{let a=i.videoWidth,o=i.videoHeight;if(!a||!o){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=o,l.scale(-1,1),l.drawImage(i,-a,0),e.toBlob(c=>c?r(c):s(new Error("empty-keyframe")),"image/jpeg",t)})}n(ti,"Se");var q,ii=(q=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=n(()=>{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()})}},n(q,"P"),q),ri=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}),N=n(i=>Math.min(1,Math.max(0,i)),"_"),W,rt=(W=class{constructor(e={}){this.p=0,this.lastTickAt=null,this.lastCenter=null,this.velocityEma=0,this.qWindow=[],this.lastSizeDirection="ideal",this.t={...ri,...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 o={presence:0,single:1,centering:0,size:0,pose:0,sharpness:N(r.sharpness),exposure:N(r.exposure),motion:1};if(t!==null){o.presence=1,o.single=(t.extraFaces??0)>0?0:1;let d=this.geometryOf(t,e);o.centering=d.centering,o.size=d.size,o.pose=d.pose,o.motion=this.motionOf(d.center,d.iod,s)}else this.lastCenter=null,this.velocityEma=0;let l=Math.min(o.presence,o.single,o.centering,o.size,o.pose,o.sharpness,o.exposure,o.motion);this.p=N(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((v,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:o,guidanceKey:this.guidanceOf(o,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},o=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-N(h/(this.t.CENTER_FALLOFF_IOD_MULTIPLE*c)),u=o>0?c/o:0;this.lastSizeDirection=u<this.t.SIZE_IDEAL_MIN?"far":u>this.t.SIZE_IDEAL_MAX?"close":"ideal";let v;u<this.t.SIZE_HARD_MIN||u>this.t.SIZE_HARD_MAX?v=0:u<this.t.SIZE_IDEAL_MIN?v=(u-this.t.SIZE_HARD_MIN)/(this.t.SIZE_IDEAL_MIN-this.t.SIZE_HARD_MIN):u>this.t.SIZE_IDEAL_MAX?v=(this.t.SIZE_HARD_MAX-u)/(this.t.SIZE_HARD_MAX-this.t.SIZE_IDEAL_MAX):v=1;let w=1;if(s!==void 0){let m=Math.abs(Math.atan2(s.right.y-s.left.y,s.right.x-s.left.x))*180/Math.PI;w=1-N(m/this.t.ROLL_MAX_DEG)}return{center:l,iod:c,centering:d,size:v,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 o=Math.hypot(e.x-s.x,e.y-s.y)/t/a;o<=this.t.MOTION_DEADBAND_IOD_PER_S&&(o=0);let l=1-Math.exp(-a/this.t.MOTION_TAU_S);return this.velocityEma=l*o+(1-l)*this.velocityEma,1-N(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 o of s)e[o[0]]<e[a[0]]&&(a=o);return a[1]}return"fcv3.hold_still"}sizeGuidance(){return this.lastSizeDirection==="far"?"fcv3.come_closer":"fcv3.move_back"}exposureGuidance(e){let t=(ne[0]+ne[1])/2;return e.meanLuma<t?"fcv3.more_light":"fcv3.too_bright"}},n(W,"k"),W),si=["single","size","centering","pose","exposure","sharpness","motion"];function ai(i){if(i.accepted)return null;if(i.factors.presence<=0)return"no_face";let e="single";for(let t of si)i.factors[t]<i.factors[e]&&(e=t);return e}n(ai,"Ze");var z,st=(z=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=ai(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}}},n(z,"w"),z),ni=["obs","manycam","virtual","snap camera","xsplit","droidcam","iriun","camo"],oi=[/^(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 li(i){let e=(i??"").trim().toLowerCase();return e.length===0?"unknown":ni.some(t=>e.includes(t))?"known_virtual":oi.some(t=>t.test(e))?"platform":"unknown"}n(li,"je");function at(i){if(typeof i!="function")return!1;try{return/\{\s*\[native code\]\s*\}\s*$/.test(Function.prototype.toString.call(i))}catch{return!1}}n(at,"Te");function ci(i=globalThis){return at(i.navigator?.mediaDevices?.getUserMedia)&&at(i.MediaStreamTrack?.prototype?.getSettings)}n(ci,"$e");async function hi(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}}n(hi,"Je");async function ui(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 hi(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:li(s),prototypesIntact:ci(e)}}n(ui,"Ce");var ue=n(i=>Math.round(i*100)/100,"K");function di(i){let e=i,t=typeof e?.requestVideoFrameCallback=="function",r=null,s=null,a=0,o=0,l=0,c=0,h=0,d=0,u=n(()=>{!t||e?.requestVideoFrameCallback===void 0||(r=e.requestVideoFrameCallback((v,w)=>{if(r=null,!t)return;let m=w.presentationTime;if(s!==null){let g=m-s.presentationTimeMs;o+=1;let y=g-l;l+=y/o,c+=y*(g-l)}typeof w.captureTime=="number"&&Number.isFinite(w.captureTime)&&(h+=m-w.captureTime,d+=1),a+=1,s={mediaTimeMs:w.mediaTime*1e3,presentationTimeMs:m},u()}))},"u");return u(),{latest:n(()=>s,"latest"),stats:n(()=>({n:a,meanGapMs:o===0?0:ue(l),stdGapMs:o<2?0:ue(Math.sqrt(c/(o-1))),captureLatencyMs:d===0?null:ue(h/d)}),"stats"),stop:n(()=>{t&&(t=!1,r!==null&&e?.cancelVideoFrameCallback?.(r),r=null)},"stop")}}n(di,"Ee");function fi(i,e,t){return{...i,rvfc:e,rampPainter:t}}n(fi,"_e");var mi=1e3,de="fcv3.hold_upright",pi=200,fe=4,gi=600,vi=1e3,nt={sharpness:1,exposure:1,meanLuma:128};function yi(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))}n(yi,"it");function wi(){return Y()==="phone"}n(wi,"at");var H,ut=(H=class{constructor(e){this.handlers=new Map,this.stateValue="idle",this.attempt=0,this.stream=null,this.detector=null,this.scheduler=null,this.gate=null,this.profiler=null,this.lastGuidanceKey=null,this.positioningStartedAt=0,this.cameraRequestedAt=null,this.cameraReadyAt=null,this.faceAcquiredAt=null,this.captureCompleteAt=null,this.fired=!1,this.carriedDegrade=0,this.carriedMeans=[],this.blockStats=null,this.lastGateSnapshotAt=Number.NEGATIVE_INFINITY,this.uprightGuard=!1,this.trackProvenance=null,this.ramp=null,this.snapshotCanvas=null,this.options=e,this.facing=e.facingMode??"user"}get state(){return this.stateValue}on(e,t){let 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??wi)(),this.setState("preflight");let r=Ue();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(Ie(),this.facing).video;a=await ze(this.facing,d,{getUserMedia:s,enumerateDevices:ki(t)})}catch(h){if(e!==this.attempt)return;if(h instanceof We){this.fail("backcamera",{phase:"acquiring",name:j(h)});return}this.fail(Le(h),{phase:"acquiring",name:j(h)});return}if(xe(a),qe(a),e!==this.attempt){for(let h of a.getTracks())h.stop();return}this.stream=a;let o=a.getVideoTracks?.()[0];if(this.trackProvenance=o===void 0?null:ui(o).catch(()=>null),this.facing=Ae(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&&Qe()?async()=>{try{return await Je.create(t.createWorker(),h)}catch{return x(h)}}:()=>x(h)),u;try{u=await d()}catch(v){e===this.attempt&&this.fail("models",{phase:"models",name:j(v)},v instanceof he?v.fallbackReason:Mi(v));return}if(e!==this.attempt){u.destroy();return}this.detector=u,this.options.telemetry?.({type:"detector",tier:u.tier,fallbackReason:u.fallbackReason})}let l=He(),c=t.deviceClass??Ke(l);this.profiler=new Xe(c),this.options.telemetry?.({type:"profile",staticClass:c,activeClass:this.profiler.deviceClass,simd:l.simd}),this.gate=new rt(t.thresholds??{}),this.blockStats=new st,this.lastGateSnapshotAt=this.now(),t.rankKeyframes?.()&&import("./keyframe-rank-YAJLYJYF-WCA6RPMD.js").then(h=>me=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 ii({cadenceHz:t.profile.cadenceHz,video:this.options.video,now:this.options.now,run:n(()=>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 o=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!==o&&this.startScheduler(e);let d=h===null?nt: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>=mi&&(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((T,b)=>T+b,0)/a.length});let o=t.mode??"clip",l=t.rankKeyframes?.()&&me?me.default(this,e).catch(()=>this.collectKeyframes(e)):this.collectKeyframes(e);if(o==="photo"){let T=this.watchRotation(e,null),b=await l;if(T(),e!==this.attempt)return;if(b===null){this.fail("generic",{phase:"keyframes"});return}let A=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,...A});return}this.setState("recording");let c=this.stream;if(c===null){this.fail("generic",{phase:"recording"});return}let h=t.screenRamp?.(),d=pe(h),u=null;l.then(T=>{u=T},()=>{});let v=n(()=>{e===this.attempt&&u!==null&&this.emit("frozen",{previewDataUrl:u.previewDataUrl})},"f"),w=Jt(h,ht),m=null,g,y=0;try{let T=this.recordTake(e,c,h,w,void 0).then(S=>S,S=>({failed:S})),[b,A]=await Promise.all([T,l]);if(g=A,e!==this.attempt)return;if("failed"in b){if(b.failed.kind==="cliptoolarge")throw b.failed;et(b.failed.requestedMimeType??"")}else m=b,it(b.clip,w)?b.clip.stats===null&&et(b.clip.requestedMimeType??""):v();if(m===null||it(m.clip,w)){y=1,t.telemetry?.({type:"clip_retake",reason:m===null?"error":m.clip.stats===null?"unreadable":"short"});let S=null;try{S=await this.recordTake(e,c,h,w,v)}catch(K){if(m===null)throw K}if(e!==this.attempt)return;S!==null&&(m===null||Xt(S.clip,m.clip))&&(m=S),S===null&&v()}}catch(T){if(e!==this.attempt)return;let b=T.kind;this.fail(b==="cliptoolarge"?"cliptoolarge":"recorder",{phase:"recording",name:j(T)});return}if(m===null){this.fail("recorder",{phase:"recording"});return}let{clip:p,rvfc:M,report:E}=m;if(ae(p.blob)){this.fail("cliptoolarge",{phase:"recording"});return}if(g===null){this.fail("generic",{phase:"keyframes"});return}let I=await this.provenance(M,d);e===this.attempt&&this.finishCapture({clip:p.blob,clipMimeType:p.mimeType,...p.stats?{clipStats:p.stats}:{},clipRetakes:y,keyframe:g.blob,previewDataUrl:g.previewDataUrl,...E!==void 0&&E.rendered.length>0?{screenRamp:E}:{},...I})}async recordTake(e,t,r,s,a){let o=this.options.createRecorder?.()??new Zt({now:n(()=>this.now(),"now")}),l=di(this.options.video),c=ei(r,{paint:n(u=>{(u===null||e===this.attempt)&&this.emit("ramp",{colour:u})},"paint"),now:n(()=>this.now(),"now"),frames:l.latest});this.ramp=c;let h=n(()=>{l.stop(),c.stop(),this.ramp===c&&(this.ramp=null)},"l"),d=this.watchRotation(e,o);try{return{clip:await o.record(t,a,()=>c.started(this.now()),s,l),rvfc:l.stats(),report:c.report()}}finally{d(),h()}}async provenance(e,t){let r=this.trackProvenance;if(r===null)return{};let s,a=new Promise(l=>{s=setTimeout(()=>l(null),vi)}),o=await Promise.race([r,a]);return clearTimeout(s),o===null?{}:{provenance:fi(o,e,t)}}isLandscape(){let e=this.options.video;return this.uprightGuard&&e.videoWidth>e.videoHeight}holdUpright(e){this.gate?.reset(),this.emit("checks",{engine:"v3",progress:0,q:0,factors:{presence:0,single:1,centering:0,size:0,pose:0,sharpness:0,exposure:0,motion:0},attempt:e}),this.lastGuidanceKey!==de&&(this.lastGuidanceKey=de,this.emit("guidance",{key:de}))}watchRotation(e,t){if(!this.uprightGuard)return()=>{};let r=this.options.video,s=n(()=>{if(e!==this.attempt||t!==null&&this.stateValue!=="recording"){l();return}r.videoWidth>0&&this.isLandscape()&&(l(),this.abortRecording(e,t))},"n"),a=setInterval(s,pi);r.addEventListener?.("resize",s);let o=!1;function l(){o||(o=!0,clearInterval(a),r.removeEventListener?.("resize",s))}return n(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 rt(this.options.thresholds??{}),this.blockStats=new st,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=gi/(fe-1),s=null;for(let a=0;a<fe;a+=1){if(e!==this.attempt)return s;try{let o=await t(this.options.video);(s===null||o.sharpness>s.sharpness)&&(s=o)}catch{}a<fe-1&&await bi(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=n((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"?ti:yi)(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)),o=Math.max(1,Math.round(e.videoHeight*s)),l=r.getContext("2d");return l===null?e:(r.width!==a&&(r.width=a),r.height!==o&&(r.height=o),l.drawImage(e,0,0,a,o),this.snapshotCanvas=r,r)}catch{return e}}defaultQuality(e,t){let r=ot(e,t,96);return r===null?nt:{sharpness:oe(r),exposure:Ve(r),meanLuma:Ze(r)}}centerSharpness(e){let t=Q(e),r=ot(e,{x:t.width*.25,y:t.height*.25,width:t.width*.5,height:t.height*.5},96);return r===null?0:oe(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()}},n(H,"ke"),H),me;function bi(i){return new Promise(e=>setTimeout(e,i))}n(bi,"st");function Mi(i){return i instanceof Error?i.message:String(i)}n(Mi,"ot");function ot(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}}n(ot,"we");function ki(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()}n(ki,"lt");var Ti=12e4,dt=13e4,_i=3e3,Ei=1200,ge=Symbol.for("@sekyro/web.preload.v1");function ye(){let i=globalThis;return i[ge]??(i[ge]=new Map),i[ge]}n(ye,"h");function te(i){let e=(i??ce).replace(/\/+$/,"");return e===""?"/":e}n(te,"b");function mt(i){let e=ye(),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}n(mt,"ae");function ve(i,e){if(i.status!==e){i.status=e;for(let t of[...i.listeners])t(e)}}n(ve,"k");var Si=n(i=>x({preferred:["blaze"],v3AssetBaseUrl:i,blazeInitTimeoutMs:Ti}),"K"),Ii=Si;function Ai(){return typeof window<"u"&&typeof navigator<"u"&&typeof navigator.mediaDevices?.getUserMedia=="function"}n(Ai,"Ce");function xi(){return navigator.connection?.saveData===!0}n(xi,"Se");function Di(i){let e=window;if(typeof e.requestIdleCallback=="function"){let r=e.requestIdleCallback(i,{timeout:_i});return()=>e.cancelIdleCallback?.(r)}let t=setTimeout(i,Ei);return()=>clearTimeout(t)}n(Di,"Ee");function Ri(i,e){let t,r=new Promise(l=>{t=l}),s=!1,a=n(()=>{},"u"),o={promise:r,settle:n(l=>{s||(s=!0,a(),i.scheduled===o&&(i.scheduled=null),t(l))},"settle")};return i.scheduled=o,a=Di(()=>{s||o.settle(we(i,e))}),r}n(Ri,"ye");function we(i,e){if((i.status==="loading"||i.status==="ready")&&i.promise!==null)return i.promise;ve(i,"loading");let t=new Promise(o=>o(Ii(e)));i.detectorPromise=t;let r,s=new Promise((o,l)=>{r=setTimeout(()=>{t.then(c=>c.destroy(),()=>{}),l(new Error(`detector preload exceeded ${dt} ms`))},dt)}),a=Promise.race([t,s]).then(o=>i.detectorPromise!==t?(o.destroy(),i.status):(i.detector=o,ve(i,"ready"),"ready"),o=>(i.detectorPromise===t&&(i.detectorPromise=null,i.detector=null,ve(i,"failed"),console.warn("[@sekyro/web] face-detector preload failed:",o)),i.status)).finally(()=>clearTimeout(r));return i.promise=a,i.scheduled?.settle(a),a}n(we,"U");function sr(i={}){if(!Ai())return Promise.resolve("idle");let e=te(i.assetBaseUrl),t=mt(e);return i.respectSaveData===!0&&xi()?Promise.resolve(t.status):(t.status==="loading"||t.status==="ready")&&t.promise!==null?t.promise:i.idle===!0?t.scheduled?.promise??Ri(t,e):we(t,e)}n(sr,"xe");function ar(i){return ye().get(te(i))?.status??"idle"}n(ar,"Fe");function nr(i,e){let t=mt(te(e));return t.listeners.add(i),()=>{t.listeners.delete(i)}}n(nr,"Ie");function Ci(i){return{get tier(){return i.tier},get fallbackReason(){return i.fallbackReason},detect:n((...e)=>i.detect(...e),"detect"),destroy:n(()=>{},"destroy")}}n(Ci,"Le");function Oi(i){let e=te(i),t=ye().get(e);if(!(t===void 0||t.detector===null&&t.detectorPromise===null&&t.scheduled===null))return async()=>{t.scheduled!==null&&we(t,e);let r=t.promise;for(;t.detector===null&&r!==null&&(await r,t.promise!==r);)r=t.promise;return t.detector!==null?Ci(t.detector):x({v3AssetBaseUrl:e})}}n(Oi,"de");var Gi=new Set(["inuse","overconstrained","notfound"]),Pi=[500,1500];function Ui(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}}n(Ui,"Ae");function Fi(i){switch(i){case"preflight":case"acquiring":return"starting";case"positioning":return"gating";default:return i}}n(Fi,"Pe");function ft(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"}}}n(ft,"ue");function Ni(i,e,t){if(t===void 0)return{kind:ft(i),retryable:e};let r=Be(t.name);return{kind:ft(i),retryable:e,detail:{...r!==void 0?{name:r}:{},phase:t.phase,engineKind:i}}}n(Ni,"we");var Bi=new Set(["captured","uploading","checking"]);function Li(i,e={},t,r=()=>"self",s=()=>{},a){let o=e.now??(()=>performance.now()),l=e.canChooseFacing??Re,c="user",h=Ce(),d=r(),u=De(),v=!Fe(),w=e.engineOptions,m=w?.createDetector===void 0&&w?.createWorker===void 0?{createDetector:n(()=>{let f=Oi(i.assetBaseUrl);return f!==void 0?f():x({v3AssetBaseUrl:i.assetBaseUrl})},"createDetector")}:{},g={video:i.video,mode:v?"photo":"clip",rankKeyframes:t,facingMode:void 0,v3AssetBaseUrl:i.assetBaseUrl,screenRamp:n(()=>d==="self"&&u.count("ramp")>0?s():void 0,"screenRamp"),...e.engineOptions??{},...m},y=e.createEngine?.(g)??new ut(g),p="idle",M=null,E=0,I=!1,T="full",b=null,A=null,S=0,K=0,be=n(()=>{i.video.videoWidth>0&&i.video.videoHeight>0&&(S=i.video.videoWidth,K=i.video.videoHeight)},"W"),Me=Oe({enabled:i.keepScreenAwake!==!1}),X=n(f=>{p=f,Me.setActive(f==="starting"||f==="gating"||f==="recording"),u.emit("state",f)},"S"),ie=n(()=>u.emit("gate",{progress:E,hint:M,faceDetected:I}),"F"),re=n(()=>{let f=y.animations??"full";f!==T&&(T=f,u.emit("profile",{animations:T}))},"I"),G=0,$=null,pt=e.schedule??((f,k)=>{let _=setTimeout(f,k);return()=>clearTimeout(_)}),Z=n(()=>{$?.(),$=null},"E"),gt=n((f,k)=>{if(V||!Gi.has(f)||k?.phase!=="acquiring")return!1;let _=Pi[G];return _===void 0?!1:(G+=1,Z(),$=pt(()=>{$=null,V||y.retry()},_),!0)},"fe"),vt=[y.on("statechange",({state:f})=>{if(f==="error")return;let k=Fi(f);k==="gating"&&(G=0),k==="starting"&&p!=="starting"&&(M=null,E=0,I=!1,b=null,A=null,S=0,K=0),X(k),re(),k==="recording"&&(be(),b=o(),M="hold",E=1,ie())}),y.on("checks",f=>{be(),E=f.progress,I=f.factors.presence>0,ie(),re()}),y.on("guidance",({key:f})=>{M=Ui(f),ie()}),y.on("frozen",({previewDataUrl:f})=>{A=o(),u.emit("frozen",{previewDataUrl:f})}),y.on("ramp",f=>u.emit("ramp",f)),y.on("artifacts",f=>{if(p!=="captured")return;let k=Y(),_=f.clipStats,_e=_!==void 0?Math.round(_.durationMs):b!==null&&A!==null?Math.max(0,Math.round(A-b)):void 0,Ee=_!==void 0&&_.frames>1&&_.durationMs>0?Math.round(_.frames*1e4/_.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||S,height:i.video.videoHeight||K,..._e!==void 0?{clipMs:_e}:{},..._!==void 0?{clipFrames:_.frames}:{},...Ee!==void 0?{fps:Ee}:{},...f.clipRetakes!==void 0?{clipRetakes:f.clipRetakes}:{},...f.clipMimeType!==void 0?{codec:ct(f.clipMimeType)}:{},captureChannel:k==="desktop"?"desktop":"mobile",formFactor:k,...v?{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:_})=>{f==="backcamera"&&yt()||gt(f,_)||(X("error"),re(),u.emit("error",Ni(f,k,_)))})],ke=!1;function yt(){return V||ke||d!=="assisted"||a===void 0||a.session()!=="choice"?!1:(ke=!0,a.onModeChange("self"),d="self",c=se("self"),X("mode_switch"),y.restart(c),!0)}n(yt,"me");let Te=n(async()=>a!==void 0&&a.session()==="choice"&&await l().catch(()=>!1),"$"),V=!1;return{handle:{get state(){return p},get captureMode(){return r()},get facingMode(){return y.facingMode??c},on:n((f,k)=>u.on(f,k),"on"),start:n(f=>(d=r(),h.facing(d,i.facing),c=h.facing(d,f?.facing),Z(),G=0,y.start({facingMode:c})),"start"),retry:n(()=>{Z(),G=0,y.retry()},"retry"),switchCamera:n(()=>h.refuseSwitch(r()),"switchCamera"),canSwitchCaptureMode:Te,setCaptureMode:n(async f=>{if(f===r()||!await Te()||V||Bi.has(p)||a===void 0)return!1;a.onModeChange(f),d=f;let k=se(f);return c=k,p==="idle"||(X("mode_switch"),Z(),G=0,y.restart(k)),!0},"setCaptureMode"),destroy:n(()=>{V=!0,Z();for(let f of vt)f();Me.setActive(!1),y.destroy(),u.clear()},"destroy")},setFlowState:n(f=>{p!==f&&X(f)},"setFlowState")}}n(Li,"De");function or(i){return Li(i).handle}n(or,"Ze");export{$i as a,sr as b,ar as c,nr as d,Ni as e,Li as f,or as g};
@@ -1 +1 @@
1
- import{a as n}from"./chunk-4FHWXBOB.js";var S="0.1.0-rc.33",k=/FBAN|FBAV|FB_IAB|FBIOS|MessengerForiOS|Instagram|WhatsApp|musical_ly|BytedanceWebview|TikTok|Snapchat|\bLine\/|LinkedInApp|Pinterest|MicroMessenger|; wv\)/i;function O(t){let e=t??(typeof navigator>"u"?"":String(navigator.userAgent??""));return k.test(e)}n(O,"p");var f="sekyro.did",C=1e4,w=n(()=>globalThis.process?.versions?.node,"v"),l;function y(){let t=globalThis.crypto;try{if(typeof t?.randomUUID=="function")return t.randomUUID()}catch{}try{if(typeof t?.getRandomValues=="function"){let e=t.getRandomValues(new Uint8Array(16));return Array.from(e,a=>a.toString(16).padStart(2,"0")).join("")}}catch{}}n(y,"b");function H(){try{let t=localStorage.getItem(f);if(t)return t;let e=y();return e!==void 0&&localStorage.setItem(f,e),e}catch{return l??(l=y()),l}}n(H,"I");async function M(){let t=globalThis.crypto?.subtle;if(!t)return"";let e=navigator,a=JSON.stringify([e.userAgent,e.platform,e.hardwareConcurrency??null,e.deviceMemory??null,e.maxTouchPoints??0,screen.width,screen.height,screen.colorDepth,globalThis.devicePixelRatio??1,Intl.DateTimeFormat().resolvedOptions().timeZone,e.languages?.join(",")??e.language]),i=await t.digest("SHA-256",new TextEncoder().encode(a));return Array.from(new Uint8Array(i),s=>s.toString(16).padStart(2,"0")).join("").slice(0,32)}n(M,"w");function x(){try{let t=Number(navigator.maxTouchPoints);return Number.isFinite(t)&&t>=0?{touch:Math.min(64,Math.trunc(t))}:{}}catch{return{}}}n(x,"k");function W(t){let e=new TextEncoder().encode(t),a="";for(let i of e)a+=String.fromCharCode(i);return btoa(a).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}n(W,"x");function j(t){let e,a,i,s,c,d,m=n(()=>d?.readyState==="live","u"),T=n(()=>{c!==void 0||!globalThis.crypto?.subtle||w()||m()||(c=Promise.race([import("./print-SEWS3VHQ-HWJTHADG.js"),new Promise(r=>setTimeout(r,C))]).then(r=>r?.computePrint(m)).then(r=>{r==="busy"?c=void 0:s=r}).catch(()=>{}))},"_");return{timezone(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone?.slice(0,64)||void 0}catch{return}},noteCameraLabel(r){r&&(e=r.slice(0,128))},noteCamera(r){a=r},noteCameraTrack(r){d=r},async deviceHeader(){try{i??(i=M().catch(()=>""));let r=[];navigator.webdriver&&r.push("webdriver"),/HeadlessChrome/.test(navigator.userAgent)&&r.push("headless");let g=await i,p=H(),A={v:1,platform:"web",sdk:t.sdk.slice(0,64),caps:["session_proof"],ids:[...p?[{kind:"web_local",value:p.slice(0,128)}]:[],...g?[{kind:"web_fp",value:g}]:[]],screen:{w:screen.width,h:screen.height,dpr:globalThis.devicePixelRatio??1},...x(),...e?{cameraLabel:e}:{},...r.length?{signals:r}:{},...s?{print:{v:2,...s,...a?{camera:a}:{}}}:{},...O()?{inApp:!0}:{}},I=W(JSON.stringify(A));return T(),I}catch{return}},printReady(){return c??Promise.resolve()}}}n(j,"A");var v=Symbol.for("sekyro.web.clientContext"),b=globalThis,u=b[v]??(b[v]=j({sdk:`@sekyro/web@${S}`}));function z(t){try{let e=t.getVideoTracks?.()[0];if(e){if(u.noteCameraLabel(e.label),u.noteCameraTrack(e),w())return;import("./camera-trait-V4UAOPIQ-TFCPOCSU.js").then(a=>a.noteCameraTrait(e,u)).catch(()=>{})}}catch{}}n(z,"M");var P=Object.freeze({LOW:Object.freeze({cadenceHz:5,inputWidth:128,animations:"reduced"}),MID:Object.freeze({cadenceHz:8,inputWidth:160,animations:"full"}),HIGH:Object.freeze({cadenceHz:10,inputWidth:192,animations:"full"})}),L=new Uint8Array([0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,10,1,8,0,65,0,253,15,253,98,11]);function F(){let t=typeof navigator>"u"?void 0:navigator,e=!1;try{e=typeof WebAssembly<"u"&&WebAssembly.validate(L)}catch{e=!1}return{cores:t?.hardwareConcurrency??2,memGB:t?.deviceMemory??null,simd:e}}n(F,"o");function U(t){let e=t.memGB??4;return t.cores<4||e<3?"LOW":t.cores>=8&&e>=6?"HIGH":"MID"}n(U,"l");var h=["LOW","MID","HIGH"],o,_=(o=class{constructor(e){this.samples=[],this.adjusted=!1,this.current=e}get deviceClass(){return this.current}get profile(){return P[this.current]}record(e){if(this.adjusted||this.samples.length>=10)return this.current;if(this.samples.push(e),this.samples.length<10)return this.current;this.adjusted=!0;let a=this.samples.reduce((i,s)=>i+s,0)/this.samples.length;if(a>70)this.current="LOW";else if(a<25){let i=h.indexOf(this.current);this.current=h[Math.min(h.length-1,i+1)]??this.current}return this.current}},n(o,"i"),o);export{S as a,O as b,u as c,z as d,F as e,U as f,_ as g};
1
+ import{a as n}from"./chunk-4FHWXBOB.js";var S="0.1.0-rc.34",k=/FBAN|FBAV|FB_IAB|FBIOS|MessengerForiOS|Instagram|WhatsApp|musical_ly|BytedanceWebview|TikTok|Snapchat|\bLine\/|LinkedInApp|Pinterest|MicroMessenger|; wv\)/i;function O(t){let e=t??(typeof navigator>"u"?"":String(navigator.userAgent??""));return k.test(e)}n(O,"p");var f="sekyro.did",C=1e4,w=n(()=>globalThis.process?.versions?.node,"v"),l;function y(){let t=globalThis.crypto;try{if(typeof t?.randomUUID=="function")return t.randomUUID()}catch{}try{if(typeof t?.getRandomValues=="function"){let e=t.getRandomValues(new Uint8Array(16));return Array.from(e,a=>a.toString(16).padStart(2,"0")).join("")}}catch{}}n(y,"b");function H(){try{let t=localStorage.getItem(f);if(t)return t;let e=y();return e!==void 0&&localStorage.setItem(f,e),e}catch{return l??(l=y()),l}}n(H,"I");async function M(){let t=globalThis.crypto?.subtle;if(!t)return"";let e=navigator,a=JSON.stringify([e.userAgent,e.platform,e.hardwareConcurrency??null,e.deviceMemory??null,e.maxTouchPoints??0,screen.width,screen.height,screen.colorDepth,globalThis.devicePixelRatio??1,Intl.DateTimeFormat().resolvedOptions().timeZone,e.languages?.join(",")??e.language]),i=await t.digest("SHA-256",new TextEncoder().encode(a));return Array.from(new Uint8Array(i),s=>s.toString(16).padStart(2,"0")).join("").slice(0,32)}n(M,"w");function x(){try{let t=Number(navigator.maxTouchPoints);return Number.isFinite(t)&&t>=0?{touch:Math.min(64,Math.trunc(t))}:{}}catch{return{}}}n(x,"k");function W(t){let e=new TextEncoder().encode(t),a="";for(let i of e)a+=String.fromCharCode(i);return btoa(a).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}n(W,"x");function j(t){let e,a,i,s,c,d,m=n(()=>d?.readyState==="live","u"),T=n(()=>{c!==void 0||!globalThis.crypto?.subtle||w()||m()||(c=Promise.race([import("./print-SEWS3VHQ-HWJTHADG.js"),new Promise(r=>setTimeout(r,C))]).then(r=>r?.computePrint(m)).then(r=>{r==="busy"?c=void 0:s=r}).catch(()=>{}))},"_");return{timezone(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone?.slice(0,64)||void 0}catch{return}},noteCameraLabel(r){r&&(e=r.slice(0,128))},noteCamera(r){a=r},noteCameraTrack(r){d=r},async deviceHeader(){try{i??(i=M().catch(()=>""));let r=[];navigator.webdriver&&r.push("webdriver"),/HeadlessChrome/.test(navigator.userAgent)&&r.push("headless");let g=await i,p=H(),A={v:1,platform:"web",sdk:t.sdk.slice(0,64),caps:["session_proof"],ids:[...p?[{kind:"web_local",value:p.slice(0,128)}]:[],...g?[{kind:"web_fp",value:g}]:[]],screen:{w:screen.width,h:screen.height,dpr:globalThis.devicePixelRatio??1},...x(),...e?{cameraLabel:e}:{},...r.length?{signals:r}:{},...s?{print:{v:2,...s,...a?{camera:a}:{}}}:{},...O()?{inApp:!0}:{}},I=W(JSON.stringify(A));return T(),I}catch{return}},printReady(){return c??Promise.resolve()}}}n(j,"A");var v=Symbol.for("sekyro.web.clientContext"),b=globalThis,u=b[v]??(b[v]=j({sdk:`@sekyro/web@${S}`}));function z(t){try{let e=t.getVideoTracks?.()[0];if(e){if(u.noteCameraLabel(e.label),u.noteCameraTrack(e),w())return;import("./camera-trait-V4UAOPIQ-TFCPOCSU.js").then(a=>a.noteCameraTrait(e,u)).catch(()=>{})}}catch{}}n(z,"M");var P=Object.freeze({LOW:Object.freeze({cadenceHz:5,inputWidth:128,animations:"reduced"}),MID:Object.freeze({cadenceHz:8,inputWidth:160,animations:"full"}),HIGH:Object.freeze({cadenceHz:10,inputWidth:192,animations:"full"})}),L=new Uint8Array([0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,10,1,8,0,65,0,253,15,253,98,11]);function F(){let t=typeof navigator>"u"?void 0:navigator,e=!1;try{e=typeof WebAssembly<"u"&&WebAssembly.validate(L)}catch{e=!1}return{cores:t?.hardwareConcurrency??2,memGB:t?.deviceMemory??null,simd:e}}n(F,"o");function U(t){let e=t.memGB??4;return t.cores<4||e<3?"LOW":t.cores>=8&&e>=6?"HIGH":"MID"}n(U,"l");var h=["LOW","MID","HIGH"],o,_=(o=class{constructor(e){this.samples=[],this.adjusted=!1,this.current=e}get deviceClass(){return this.current}get profile(){return P[this.current]}record(e){if(this.adjusted||this.samples.length>=10)return this.current;if(this.samples.push(e),this.samples.length<10)return this.current;this.adjusted=!0;let a=this.samples.reduce((i,s)=>i+s,0)/this.samples.length;if(a>70)this.current="LOW";else if(a<25){let i=h.indexOf(this.current);this.current=h[Math.min(h.length-1,i+1)]??this.current}return this.current}},n(o,"i"),o);export{S as a,O as b,u as c,z as d,F as e,U as f,_ as g};
@@ -0,0 +1 @@
1
+ import{a as ke,b as Se,c as ie,d as xe,e as Te,f as Ce,h as Ae}from"./chunk-3NOBU7TE.js";import{a as ne,d as Le,e as Re}from"./chunk-QTPSRWXY.js";import{e as Q}from"./chunk-DKZUKWGP.js";import{e as Me,k as be}from"./chunk-6MYG4HWP.js";import{g as ae}from"./chunk-JS2IXPNL.js";import{a as n}from"./chunk-4FHWXBOB.js";function Pe(e,t){let r=new Set(e.flatMap(i=>i.sides.filter(l=>l[t]!==null).map(l=>l.side)));return r.size===1?[...r][0]:null}n(Pe,"Ee");function Xe(e){let t=Le.find(i=>i.docType===e),r=t.mrz==="none"?null:t.mrz==="td3"?"single":"verso";return{sides:t.sides,format:Re(e),mrz:t.mrz==="none"?"none":"required",mrzSide:r,barcodeSide:null,portraitSide:t.portraitSide,scripts:null}}n(Xe,"st");function Ye(e){let t=[];for(let r of e)for(let i of r.sides){if(!Array.isArray(i.scripts))return null;for(let l of i.scripts)t.includes(l)||t.push(l)}return t}n(Ye,"ct");function Je(e,t){if(t.length===0)return Xe(e);let r=t.some(s=>s.sides.length>1),i=new Set(t.map(s=>s.format)),l=i.size===1?[...i][0]:"card",u=t.filter(s=>s.sides.some(h=>h.mrz!==null)).length,d=t.find(s=>s.sides.length>1===r)?.sides.find(s=>s.portrait)?.side;return{sides:r?["recto","verso"]:["single"],format:l,mrz:u===t.length?"required":u===0?"none":"optional",mrzSide:Pe(t,"mrz"),barcodeSide:Pe(t,"barcode"),portraitSide:d??(r?"recto":"single"),scripts:Ye(t)}}n(Je,"Oe");function Qe(e,t){if(e===void 0)return[];let r=e.toUpperCase();return Object.prototype.hasOwnProperty.call(ne,r)?ne[r]?.[t]??[]:[]}n(Qe,"Ae");async function $e(e,t,r){return await e(t)?r:r==="recto"?"verso":"recto"}n($e,"Be");function Ze(e,t,r){return e!==t&&t==="verso"&&r.recto!==void 0&&r.verso===void 0?"verso":e}n(Ze,"Ie");var Ke={low:{maxLongEdge:1920,payloadTargetBytes:7e5,qMin:.7,qMax:.92},mid:{maxLongEdge:2240,payloadTargetBytes:12e5,qMin:.7,qMax:.92},good:{maxLongEdge:2560,payloadTargetBytes:16e5,qMin:.7,qMax:.92}};function et(e){let{deviceMemory:t,effectiveType:r,saveData:i,downlinkMbps:l,sourceLongEdge:u}=e,d=i===!0||r==="slow-2g"||r==="2g"||l!=null&&l>0&&l<1,s=t!=null&&t<=2,h=r==="4g"||l!=null&&l>=5,c=t!=null&&t>=6,k;d||s?k="low":h&&c?k="good":k="mid";let f=Ke[k],P=u&&u>0?Math.min(f.maxLongEdge,u):f.maxLongEdge;return{tier:k,...f,maxLongEdge:P}}n(et,"lt");function tt(e){let t={};try{let r=navigator;typeof r.deviceMemory=="number"&&(t.deviceMemory=r.deviceMemory);let i=r.connection;i&&(t.effectiveType=i.effectiveType,t.saveData=i.saveData,t.downlinkMbps=i.downlink)}catch{}return typeof e=="number"&&e>0&&(t.sourceLongEdge=e),et(t)}n(tt,"Fe");function rt(e,t,r){let i=Math.min(1,Math.max(0,(e-.28)/.21999999999999997)),l=(t+r)/2;return Math.max(t,r-i*(r-l))}n(rt,"dt");function at(e,t,r){let i=Math.max(e,t),l=i>0?Math.min(1,r/i):1;return{width:Math.max(1,Math.round(e*l)),height:Math.max(1,Math.round(t*l))}}n(at,"mt");async function it(e,t){let r=t.startQ,i=await e(r);for(let l=0;l<4&&!(i.size<=t.budgetBytes||r<=t.qMin);l++)r=Math.max(t.qMin,r-.08),i=await e(r);return{blob:i,quality:r}}n(it,"pt");async function nt(e,t,r,i,l){if(t<=0||r<=0)return null;let{width:u,height:d}=at(t,r,i.maxLongEdge),s=document.createElement("canvas");s.width=u,s.height=d;let h=s.getContext("2d");if(!h)return null;h.drawImage(e,0,0,u,d);let c=n(T=>new Promise((y,m)=>{s.toBlob(g=>g?y(g):m(new Error("canvas toBlob returned null")),"image/jpeg",T)}),"l"),k=rt(l,i.qMin,i.qMax),{blob:f,quality:P}=await it(c,{startQ:k,qMin:i.qMin,budgetBytes:i.payloadTargetBytes}).finally(()=>{s.width=0,s.height=0});if(f.size>5242880)throw new Error("encoded document exceeds the 5242880-byte media cap");return{blob:f,quality:P,width:u,height:d}}n(nt,"We");async function ot(e){let t=tt(Math.max(e.width,e.height)),r=await nt(e,e.width,e.height,t,.5);if(r===null)throw new Error("canvas encode unavailable");return{blob:r.blob,width:r.width,height:r.height}}n(ot,"oe");function We(e,t){return{layout:e,phase:"framing",captured:{},pending:[],lastCaptureAt:t,lastReportAt:t,manualShutter:!1,restPhase:"framing",readSides:[],needFlip:!1,flipped:!1,flipTimeoutSpent:!1,timeoutCapture:!1,lastShotByTimeout:!1}}n(We,"ie");var Ie=n(e=>e==="recto"?"verso":"recto","Ue"),Be=n(e=>e.phase==="framing"||e.phase==="locking"||e.phase==="flipCue"||e.phase==="reaskRecto","Ne"),ue=n(e=>(e.captured.recto!==void 0?1:0)+(e.captured.verso!==void 0?1:0)+e.pending.length,"se");function oe(e,t){return e.lastCaptureAt>=0&&e.lastReportAt>=0?e:{...e,lastCaptureAt:e.lastCaptureAt<0?t:e.lastCaptureAt,lastReportAt:e.lastReportAt<0?t:e.lastReportAt}}n(oe,"ae");function lt(e,t,r){if(e.phase==="result")return{...e,lastReportAt:r};let i=!t.present||e.captureArea!==void 0&&t.areaFrac<.6*e.captureArea,{flipped:l,awaySince:u}=e;i&&(u=u??r),u!==void 0&&r-u>=250&&(l=!0),i||(u=void 0);let d=e.flipTimeoutSpent&&!(l&&!e.flipped),s={...e,lastReportAt:r,flipped:l,awaySince:u,flipTimeoutSpent:d,lastArea:t.areaFrac};if(!Be(e))return s;if(e.needFlip&&!l){if(!t.ready)return{...s,phase:e.restPhase,goodSince:void 0};let h=e.lastShot!==void 0&&e.pending.includes(e.lastShot);if(d||h)return{...s,goodSince:void 0,phase:e.restPhase};let c=e.goodSince??r;return r-c>=1800?{...s,goodSince:c,phase:"capturing",flipTimeoutSpent:!0,timeoutCapture:!0}:{...s,goodSince:c,phase:e.restPhase}}return t.ready?{...s,phase:"capturing",goodSince:e.goodSince??r}:{...s,goodSince:void 0,phase:t.locking?"locking":e.restPhase}}n(lt,"ft");function st(e,t){if(!Be(e)||e.manualShutter)return e;let r=t-e.lastReportAt>=2e3,i=t-e.lastCaptureAt>=6e3;return r||i?{...e,manualShutter:!0}:e}n(st,"gt");function dt(e,t,r){let i=e.layout==="singlePage",l=i?{recto:t}:e.captured,u=i?[]:[...e.pending,t],d={...e,captured:l,pending:u,lastShot:t,lastCaptureAt:r,lastReportAt:-1,manualShutter:!1,goodSince:void 0,notice:void 0,awaySince:void 0,flipped:!1,lastShotByTimeout:e.timeoutCapture,timeoutCapture:!1,captureArea:e.lastArea};return i||ue({captured:l,pending:u})>=2?{...d,phase:"reading",restPhase:"framing",current:void 0,needFlip:!1}:{...d,phase:"flipCue",restPhase:"flipCue",current:void 0,needFlip:!0}}n(dt,"ht");function Ue(e,t,r){return e.pending.includes(t)?{...e,pending:e.pending.filter(i=>i!==t),lastShot:e.lastShot===t?void 0:e.lastShot,phase:e.phase==="capturing"?e.phase:"flipCue",restPhase:"flipCue",current:Ie(r),needFlip:!0,flipTimeoutSpent:!0,goodSince:void 0,manualShutter:!0,notice:"same_face",lastCaptureAt:-1,lastReportAt:-1}:e}n(Ue,"Ge");function ut(e,t,r){if(!e.pending.includes(t))return e;if(e.captured[r]!==void 0)return Ue(e,t,r);let i=e.pending.filter(h=>h!==t),l={...e,pending:i,captured:{...e.captured,[r]:t}};if(ue(l)!==1||e.layout==="singlePage")return l;let u=Ie(r),d=u==="recto"&&e.restPhase==="reaskRecto"?"reaskRecto":"flipCue",s=e.phase==="flipCue"||e.phase==="reaskRecto"||e.phase==="framing";return{...l,restPhase:d,current:u,phase:s?d:e.phase}}n(ut,"bt");function ct(e,t){let r=t.id??e.captured[t.side],i={...e.captured};(t.id===void 0||i[t.side]===t.id)&&delete i[t.side];let l=e.pending.filter(c=>c!==r),u=e.layout==="twoSided"&&ue({captured:i,pending:l})>0,d=e.lastShotByTimeout||r===e.lastShot!==e.flipped,s=u&&!d,h=s?t.side==="recto"?"reaskRecto":"flipCue":"framing";return{...e,captured:i,pending:l,readSides:e.readSides.filter(c=>c!==t.side),lastShot:e.lastShot===r?void 0:e.lastShot,notice:t.issue,goodSince:void 0,manualShutter:!1,phase:h,restPhase:h,current:t.side,needFlip:s,flipped:!1,flipTimeoutSpent:!1,awaySince:void 0,lastCaptureAt:-1,lastReportAt:-1}}n(ct,"yt");function pt(e,t){switch(t.type){case"report":return lt(oe(e,t.at),t.report,t.at);case"tick":return st(oe(e,t.at),t.at);case"captured":return dt(oe(e,t.at),t.id,t.at);case"captureFailed":return{...e,phase:e.restPhase,goodSince:void 0,lastCaptureAt:t.at,manualShutter:!0,timeoutCapture:!1};case"classified":return ut(e,t.id,t.side);case"duplicate":return Ue(e,t.id,t.side);case"readOk":{let r=e.readSides.includes(t.side)?e.readSides:[...e.readSides,t.side],i=["recto","verso"].filter(u=>e.captured[u]!==void 0),l=e.phase==="reading"&&e.pending.length===0&&i.every(u=>r.includes(u));return{...e,readSides:r,flipTimeoutSpent:!1,phase:l?"result":e.phase}}case"readFailed":return ct(e,t);case"clockRestart":return e.lastCaptureAt<0&&e.lastReportAt<0&&e.awaySince===void 0?e:{...e,awaySince:void 0,lastCaptureAt:-1,lastReportAt:-1};case"retake":return{...We(e.layout,-1),lastCaptureAt:-1,lastReportAt:-1};default:return e}}n(pt,"qe");function mt(e,t,r=!1){let i=e(t);return i===null?"recto":!r||i.y+i.height/2>=t.height/2?"verso":"recto"}n(mt,"St");async function ht(e,t=!1){let{detectMrzBand:r}=await import("./mrz-band-VYHOTDHY-VEZ2J5IL.js");return mt(r,e,t)}n(ht,"Mt");async function ze(e,t=480,r,i=r!=null){let l=r??{x:0,y:0,width:e.width,height:e.height},u=Math.max(1,Math.round(l.height/l.width*t)),d=document.createElement("canvas");d.width=t,d.height=u;try{let s=d.getContext("2d");return s===null?"recto":(s.drawImage(e,l.x,l.y,l.width,l.height,0,0,t,u),await ht(s.getImageData(0,0,t,u),i))}finally{d.width=0,d.height=0}}n(ze,"ce");var le=n((e,t,r)=>Math.min(r,Math.max(t,Math.round(e))),"ue"),$=n(e=>Math.round(Math.min(1,Math.max(0,e))*1e4)/1e4,"$");async function ft(e,t,r,i){let l=i.decode??(h=>createImageBitmap(h)),u=n(async()=>e.stillRead(await l(t),i.region??[0,0,1,1],i.detectorLimit),"u"),d;try{d=await u()}catch{try{await new Promise(h=>setTimeout(h,i.retryMs??300)),d=await u()}catch{return null}}let s=d.mrzBox;return s===void 0?null:{engine:i.engine,source:"live_mrz",format:r.format,lineCount:le(r.lineCount,2,3),checkDigitsValid:!0,stillConfirmed:d.valid&&d.digest===r.digest,band:[$(s[0]),$(s[1]),$(Math.min(s[2],1-s[0])),$(Math.min(s[3],1-s[1]))],digest:r.digest,framesToValid:le(r.framesToValid,1,1e3),msToValid:le(r.msToValid,0,12e4)}}n(ft,"He");var gt=new Uint8Array([0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,10,1,8,0,65,0,253,15,253,98,11]),vt=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,10,7,1,5,0,6,64,11,11]);function yt(e=globalThis){let t=e.WebAssembly?.validate;if(typeof t!="function")return{ok:!1,reason:"simd"};try{if(!t.call(e.WebAssembly,gt)||!t.call(e.WebAssembly,vt))return{ok:!1,reason:"simd"}}catch{return{ok:!1,reason:"simd"}}return typeof e.Worker!="function"?{ok:!1,reason:"worker"}:typeof e.createImageBitmap!="function"?{ok:!1,reason:"bitmap"}:{ok:!0}}n(yt,"Xe");function wt(e=globalThis){let t=e.navigator?.connection;return t?.saveData===!0||["slow-2g","2g","3g"].includes(t?.effectiveType??"")}n(wt,"Ye");var j,E=(j=class extends Error{constructor(t){super(t),this.name="OcrEngineError",this.code=t}},n(j,"E"),j);function De(){let e=n(t=>(t.close(),Promise.reject(new E("unsupported"))),"e");return{ready:Promise.resolve("unsupported"),busy:!1,bandRead:e,stillRead:e,layoutRead:e,dispose:n(()=>{},"dispose")}}n(De,"Ve");function Mt(e){let t;try{if(e.createWorker)t=e.createWorker();else if(e.workerUrl!==void 0)t=new Worker(e.workerUrl,{type:"module",name:"sekyro-ocr"});else return De()}catch{return De()}let r=new Map,i=0,l=!1,u=!1,d=!1;t.addEventListener("message",m=>{let g=m.data,b=r.get(g.id);b&&(r.delete(g.id),b.resolve(g))});let s=n(()=>{for(let m of r.values())m.reject(new E("error"));r.clear(),c()},"s");t.addEventListener("error",s),t.addEventListener("messageerror",s);function h(m,g=[]){if(l)return Promise.reject(new E("disposed"));let b=++i;return new Promise((D,W)=>{r.set(b,{resolve:D,reject:W});try{t.postMessage({...m,id:b},g)}catch{r.delete(b),W(new E("error"))}})}n(h,"p");function c(){if(!l){l=!0;try{t.postMessage({id:++i,kind:"dispose"})}catch{}t.terminate();for(let m of r.values())m.reject(new E("disposed"));r.clear()}}n(c,"l");let k=(async()=>{let m=await h({kind:"init",baseUrl:e.baseUrl,salt:e.salt,detectorLimit:e.tuning.detectorLimit,maxDownloadMs:e.tuning.maxDownloadMs});if(m.kind==="failed")return m.reason;if(m.kind!=="ready")return"error";let g=await h({kind:"warmup"});if(g.kind!=="ready")return"error";let b=g.benchMs??g.warmupMs,D=e.deviceMemoryGb===void 0?Se():e.deviceMemoryGb;return{warmupMs:g.warmupMs,downloadMs:m.downloadMs,cached:m.cached,benchMs:b,tier:ke(b,D)}})().catch(()=>"error"),f,P=new Promise(m=>{f=setTimeout(()=>m("timeout"),e.tuning.loadTimeoutMs)}),T=Promise.race([k,P]).then(m=>(clearTimeout(f),typeof m=="string"?c():d=!0,l&&typeof m!="string"?"error":m));(e.page===void 0?globalThis.addEventListener?globalThis:null:e.page)?.addEventListener("pagehide",c,{once:!0});async function y(m,g,b){if(l)throw g.close(),new E("disposed");if(!d)throw g.close(),new E("not_ready");if(u)throw g.close(),new E("busy");u=!0;let D;try{let W=new Promise((U,O)=>{D=setTimeout(()=>{O(new E("timeout")),c()},e.tuning.readTimeoutMs??1e4)}),q=await Promise.race([h(m,[g]),W]);if(q.kind===b){let{id:U,...O}=q;return O}throw new E(q.kind==="error"?q.code:q.kind==="failed"?q.reason:"error")}finally{clearTimeout(D),u=!1}}return n(y,"P"),{ready:T,get busy(){return u},bandRead:n((m,g=e.tuning.detectorLimit)=>y({kind:"band",bitmap:m,detectorLimit:g},m,"band"),"bandRead"),stillRead:n((m,g,b=e.tuning.detectorLimit)=>y({kind:"still",bitmap:m,region:g,detectorLimit:b},m,"band"),"stillRead"),layoutRead:n((m,g)=>y({kind:"layout",bitmap:m,detectorLimit:g},m,"layout"),"layoutRead"),dispose:c}}n(Mt,"Qe");var Z="sekyro-ocr-1",se=n(e=>e!==null&&typeof e=="object"?e:{},"le"),z=n((e,t,r,i)=>typeof e=="number"&&Number.isFinite(e)&&e>=t&&e<=r?e:i,"_"),qe=n((e,t)=>typeof e=="boolean"?e:t,"Ke"),Ee=n(e=>{let t=typeof e=="string"?/^sekyro-ocr-(\d{1,4})$/.exec(e):null;return t?Number(t[1]):Number.POSITIVE_INFINITY},"je");function bt(e,t={}){let r=se(e),i=se(r.liveMrz),l=se(r.frontLock),u=Ee(t.engine??Z),d=t.mode==="off",s=n(g=>g.enabled===!0?g.arm==="live"?"live":"control":null,"s"),h=s(i),c=s(l),k=n((g,b)=>!d&&b==="live"&&Ee(g.minEngine??Z)<=u,"M"),f=Ce,P=k(i,h)?{detectorLimit:z(i.detectorLimit,320,1600,f.detectorLimit),bandMaxWidthPx:z(i.bandMaxWidthPx,320,4096,f.bandMaxWidthPx),minBandWidthPx:z(i.minBandWidthPx,0,4096,f.minBandWidthPx),bandTop:z(i.bandTop,0,.95,f.bandTop),minIntervalMs:z(i.minIntervalMs,0,5e3,f.minIntervalMs),stableReads:Math.round(z(i.stableReads,1,10,f.stableReads)),profileReads:Math.round(z(i.profileReads,1,100,f.profileReads)),maxReadMs:z(i.maxReadMs,50,6e4,f.maxReadMs),searchTimeoutMs:z(i.searchTimeoutMs,1e3,12e4,f.searchTimeoutMs),hint:qe(i.hint,!0),stillConfirm:qe(i.stillConfirm,!0)}:null,T=Te,y=n((g,b,D)=>z(l[g],b,D,T[g]),"S"),m=k(l,c)?{minLines:Math.round(y("minLines",1,50)),fillMin:y("fillMin",0,1),fillMax:y("fillMax",0,2),offsetMax:y("offsetMax",0,1),steadyFillDelta:y("steadyFillDelta",0,1),steadyOffsetDelta:y("steadyOffsetDelta",0,1),layoutShiftMax:y("layoutShiftMax",0,1),lineCountDelta:Math.round(y("lineCountDelta",0,50)),lockMs:y("lockMs",0,3e4),steadyMs:y("steadyMs",0,3e4),minFrames:Math.round(y("minFrames",1,100)),minIntervalMs:y("minIntervalMs",0,5e3),maxWidthPx:y("maxWidthPx",160,2048),detectorLimit:y("detectorLimit",320,1600),searchTimeoutMs:y("searchTimeoutMs",1e3,12e4)}:null;return{enabled:P!==null||m!==null,liveMrz:P,textLock:m,liveMrzArm:h,frontLockArm:c,load:{detectorLimit:P?.detectorLimit??m?.detectorLimit??f.detectorLimit,loadTimeoutMs:z(i.loadTimeoutMs,1e3,12e4,2e4),maxDownloadMs:z(i.maxDownloadMs,1e3,12e4,2e4)},reportSampleRate:z(i.reportSampleRate,0,1,1)}}n(bt,"$e");function kt(e,t){return e.enabled?!(t.probe??yt)().ok||(t.slow??wt)()?{ok:!1,reason:"unsupported"}:{ok:!0,engine:Mt({baseUrl:t.baseUrl,salt:t.salt,tuning:{detectorLimit:e.load.detectorLimit,maxDownloadMs:e.load.maxDownloadMs,loadTimeoutMs:e.load.loadTimeoutMs},...t.workerUrl!==void 0?{workerUrl:t.workerUrl}:{},...t.createWorker!==void 0?{createWorker:t.createWorker}:{},...t.page!==void 0?{page:t.page}:{},...t.deviceMemoryGb!==void 0?{deviceMemoryGb:t.deviceMemoryGb}:{}})}:{ok:!1,reason:"off"}}n(kt,"Je");function St(e=typeof navigator<"u"?navigator.userAgent:""){return/SamsungBrowser\//.test(e)?"samsung":/Firefox\/|FxiOS\//.test(e)?"firefox":/Chrome\/|CriOS\/|Chromium\//.test(e)&&!/Edg\/|OPR\//.test(e)?"chrome":/Safari\//.test(e)&&/Version\/|Mobile\//.test(e)&&!/Chrome\/|CriOS\//.test(e)?"safari":"other"}n(St,"kt");var F=n(e=>e===void 0||!Number.isFinite(e)?void 0:Math.min(6e5,Math.max(0,Math.round(e))),"I"),de=n((e,t,r)=>e===void 0||!Number.isFinite(e)?void 0:Math.min(r,Math.max(t,Math.round(e))),"de");function xt(e){let t=e.assist??null,r=e.load!==null&&e.load!==void 0&&typeof e.load=="object"?e.load:null,i=typeof e.load=="string"?e.load:null,l=t!==null?t.outcome:i==="unsupported"||i==="download"||i==="integrity"?i:i==="error"||i==="timeout"?"error":"off",u={kind:"live_mrz",platform:"web",engine:e.engine??Z,arm:e.arm,capture:e.capture,outcome:l,reads:de(t?.reads??0,0,1e4)??0,browser:e.browser??St()},d=n((s,h)=>{h!==void 0&&(u[s]=h)},"c");return d("format",t?.format),d("framesToValid",de(t?.framesToValid,1,1e4)),d("msToValid",F(t?.msToValid)),d("framesToLock",de(t?.framesToLock,1,1e4)),d("msToLock",F(t?.msToLock)),d("msToCapture",F(e.msToCapture)),d("readP50Ms",F(t?.readP50Ms)),d("readP90Ms",F(t?.readP90Ms)),d("deviceClass",t?.deviceClass),r!==null&&(d("warmupMs",F(r.warmupMs)),d("downloadMs",F(r.downloadMs)),d("cached",r.cached),d("tier",r.tier),d("benchMs",F(r.benchMs))),d("stillConfirmed",e.stillConfirmed),d("typeMismatch",e.typeMismatch),u}n(xt,"Ze");function Fe(e,t){return e===void 0?!1:t==="passport"?e!=="TD3":e==="TD3"}n(Fe,"me");var Tt=2;async function Ct(e){let t=await import("./capture-session-doc-GCL2FYQH-X7QTUFGI.js");return new t.CaptureSessionDoc(e)}n(Ct,"xt");function At(e){return{topLeft:{x:e.x,y:e.y},topRight:{x:e.x+e.width,y:e.y},bottomRight:{x:e.x+e.width,y:e.y+e.height},bottomLeft:{x:e.x,y:e.y+e.height}}}n(At,"vt");function Lt(e,t,r){let i=[e.topLeft,e.topRight,e.bottomRight,e.bottomLeft],l=0;for(let u=0;u<i.length;u+=1){let d=i[u],s=i[(u+1)%i.length];l+=d.x*s.y-s.x*d.y}return t>0&&r>0?Math.abs(l)/2/(t*r):0}n(Lt,"Rt");function Wt(){import("./capture-session-doc-GCL2FYQH-X7QTUFGI.js").then(e=>e.warmDocDetector()).catch(()=>{})}n(Wt,"hn");function It(e){return Rt(e,{}).handle}n(It,"bn");function Rt(e,t){let r=Me(),i=be({enabled:e.keepScreenAwake!==!1}),l=t.decode??(a=>createImageBitmap(a)),u=t.blurRefuseSharpnessMax??.16,d=t.now??(()=>performance.now()),s=Je(e.documentType,t.catalogCapture===!0?t.captureSeries??Qe(e.issuer,e.documentType):[]),h=s.sides.length===1||e.side==="single",c=We(h?"singlePage":"twoSided",d());if(!h&&(e.side==="recto"||e.side==="verso")){let a=e.side==="recto"?"verso":"recto";c={...c,captured:{[a]:"server"},readSides:[a],current:e.side,phase:"flipCue",restPhase:"flipCue"}}let k="idle",f=null,P=null,T=!0,y=0,m=0,g=!1,b=!1,D="",W=null,q,U=null,O=[],ce=s.mrz==="none",Oe=s.barcodeSide==="recto"||s.barcodeSide==="verso"?s.barcodeSide:null,I=ce&&!h?t.barcode?.side??Oe:null,pe=e.barcodeAssetBaseUrl??t.barcode?.assetBaseUrl,K=null,me=n(()=>I===null||pe===void 0||t.barcode?.seen!==void 0?Promise.resolve(null):(K??(K=import("./barcode-detect-C5IOXMKI-ZOZ2WOWU.js").then(a=>a.loadBarcodeDetect(pe)).catch(()=>null)),K),"ge"),Ne=n(async(a,o)=>{if(I===null)return null;let p=I==="recto"?"verso":"recto";try{let v=t.barcode?.seen;if(v!==void 0)return await v(a)?I:p;let[A,S]=await Promise.all([me(),o()]);if(A===null||S===null)return null;let x=Math.min(1600,S.width),M=document.createElement("canvas");M.width=x,M.height=Math.max(1,Math.round(S.height/S.width*x));try{let w=M.getContext("2d");return w===null?null:(w.drawImage(S,0,0,M.width,M.height),await $e(A,w.getImageData(0,0,M.width,M.height),I))}finally{M.width=0,M.height=0}}catch{return null}},"tt"),C=t.webOcr!==void 0&&!ce?bt(t.webOcr.captureDocument,{mode:e.liveMrz?.mode??"auto"}):null,G=null,N=C===null||!C.enabled?"off":null,_=null,X=null,he=new WeakMap,ee="";if(C!==null&&C.enabled&&t.webOcr!==void 0){let a=t.webOcr,o=kt(C,{baseUrl:e.liveMrz?.assetBaseUrl??a.baseUrl,salt:a.salt,...e.liveMrz?.workerUrl!==void 0?{workerUrl:e.liveMrz.workerUrl}:{},...a.createWorker!==void 0?{createWorker:a.createWorker}:{}});if(o.ok){G=o.engine;let p=new Ae({textLock:C.textLock,liveMrz:C.liveMrz});_=p;let v=o.engine;v.ready.then(A=>{N=A,typeof A!="string"&&T&&p.setEngine(v,A.tier)})}else N=o.reason}let V=n(a=>{let o=JSON.stringify(a);o!==ee&&(ee=o,r.emit("mrz",a))},"N"),fe=n((a,o)=>{let p=t.webOcr?.reports;if(p===void 0||C===null||a===void 0)return;let v=a.format==="ID-3"||a.side==="single"?"single":a.side==="verso"?"verso":"recto",A=v!=="recto"?C.liveMrzArm??C.frontLockArm:C.frontLockArm;if(A===null||Math.random()>=C.reportSampleRate)return;let S=a.via==="live_mrz"?X:null,x=n(()=>{let M=S?.value??null;p([xt({arm:A,capture:v,assist:a.ocr??null,load:A==="control"?"off":N,...a.msToCapture!==void 0?{msToCapture:a.msToCapture}:{},...M!==null&&M.stillConfirmed!==void 0?{stillConfirmed:M.stillConfirmed}:{},...o!==void 0?{typeMismatch:Fe(o.format,s.format==="ID-3"?"passport":"card")}:{}})])},"k");S!==null&&S.value===null?Promise.race([S.promise,new Promise(M=>setTimeout(M,3e3))]).then(x):x()},"be"),B=n(a=>{!T||a===k||(k=a,i.setActive(a==="starting"||a==="scanning"),r.emit("state",a))},"W"),Ve=n((a,o)=>o===void 0?null:h?"single":a.captured.recto===o?"recto":a.captured.verso===o?"verso":null,"nt"),je=n(a=>({phase:a.phase,captured:h?a.captured.recto!==void 0?["single"]:[]:["recto","verso"].filter(o=>a.captured[o]!==void 0),expected:h?null:a.current??null,notice:a.notice??null,lastShot:Ve(a,a.lastShot),manualShutter:a.manualShutter,torchAvailable:f?.torchAvailable()??!1,torch:b}),"rt"),ge=n(()=>{let a=f;a!==null&&a.captureNow().catch(()=>R({type:"captureFailed",at:d()}))},"ye");function R(a){if(!T)return;let o=c;c=pt(c,a),c.phase==="capturing"&&o.phase!=="capturing"&&Promise.resolve().then(ge),c.phase==="result"&&o.phase!=="result"&&(B("done"),ve());let p=je(c),v=JSON.stringify(p);v!==D&&(D=v,r.emit("scan",p))}n(R,"L");function ve(){U!==null&&clearInterval(U),U=null;for(let a of O.splice(0))a();f?.destroy(),f=null,i.setActive(!1)}n(ve,"Se");let ye=n(()=>f?.captureReport?.(),"Me"),te=!1,we=n((a,o)=>{if(!(a===void 0||t.onFaceReport===void 0))try{t.onFaceReport(a,o)}catch{}},"De"),Y=n(a=>{ee="",!(f===null||c.phase==="reading"||c.phase==="result")&&(te=!1,f.rearm(h?"single":c.current??a))},"Q"),Ge=n(async(a,o,p,v)=>{if(X=null,v!==void 0&&G!==null&&C?.liveMrz?.hint===!0){let w={promise:ft(G,a,v,{engine:Z,detectorLimit:C.liveMrz.detectorLimit}).catch(()=>null),value:null};w.promise.then(L=>{w.value=L}),X=w}v!==void 0&&Fe(v.format,s.format==="ID-3"?"passport":"card")&&V({state:"mismatch",format:v.format});let A=ye();we(A,"captured"),te=!0,fe(A,v);let S=p===void 0?W:p===null?null:{quad:At(p),frameWidth:0,frameHeight:0,inStill:!0},x={decoded:null},M=n(()=>(x.decoded??(x.decoded=Promise.resolve().then(()=>l(a)).catch(()=>null)),x.decoded),"y");try{await He(a,o,S,M,X)}finally{x.decoded!==null&&(await x.decoded)?.close()}},"ot"),He=n(async(a,o,p,v,A)=>{let S=`shot-${y+=1}`;if(R({type:"captured",id:S,at:d()}),e.haptics!==!1)try{globalThis.navigator?.vibrate?.(30)}catch{}if(!g&&u>0){let w=await(t.measureSharpness!==void 0?t.measureSharpness(a,p):v().then(L=>L===null?-1:xe(L,ie(p?.quad??null,p?.inStill===!0?L:{width:p?.frameWidth??0,height:p?.frameHeight??0},L)))).catch(()=>-1);if(!T)return;if(Number.isFinite(w)&&w>=0&&w<u){g=!0;let L=h?"recto":c.current??(c.captured.recto===void 0?"recto":"verso");R({type:"readFailed",side:L,id:S,issue:"blurry"}),Y(L);return}}g=!1;let x;if(h)x="single";else{let w=c.current,L=t.classify===void 0?await Ne(a,v):null,H=(L===null||I===null?L:Ze(L,I,c.captured))??await(t.classify!==void 0?t.classify(a):v().then(J=>J===null?w??"recto":p?.inStill===!0?ze(J,480,null,!0):ze(J,480,ie(p?.quad??null,{width:p?.frameWidth??0,height:p?.frameHeight??0},J)))).catch(()=>w??"recto");if(!T)return;if(c.captured[H]!==void 0&&m<Tt){m+=1,R({type:"duplicate",id:S,side:H}),Y(H==="recto"?"verso":"recto");return}x=c.captured[H]!==void 0&&w!==void 0?w:H,m=0,R({type:"classified",id:S,side:x})}let M=x==="verso"?"verso":"recto";try{let w=t.encode!==void 0?await t.encode(a):await v().then(L=>{if(L===null)throw new Error("the still could not be decoded");return ot(L)});if(!T)return;A!==null&&he.set(w.blob,A),r.emit("captured",{image:w.blob,side:x,documentType:e.documentType,...e.issuer!==void 0?{issuer:e.issuer}:{},width:w.width,height:w.height,previewDataUrl:o}),t.deferRead!==!0&&R({type:"readOk",side:M})}catch(w){R({type:"readFailed",side:M,id:S,issue:"technical"}),r.emit("error",Q("generic",!0,{phase:"keyframes",name:ae(w)}))}Y(M==="recto"?"verso":"recto")},"at"),_e=n(a=>{O.push(a.on("statechange",({state:o})=>{o==="preflight"||o==="acquiring"?B("starting"):o==="positioning"?B("scanning"):o==="captured"?B("captured"):o==="error"&&B("error")}),a.on("feedback",({key:o,reticle:p})=>r.emit("feedback",{key:o,reticle:p})),a.on("checks",o=>{r.emit("gate",{progress:o.p,quad:o.quad,frameWidth:o.frameWidth,frameHeight:o.frameHeight,...o.guide!==void 0?{guide:{detected:o.guide.detected,fill:o.guide.fill,offsetX:o.guide.offsetX??0,offsetY:o.guide.offsetY??0}}:{}});let p=o.ocr?.mrz;p!==void 0&&(p.state==="fallback"?V({state:"fallback",reason:p.reason}):p.state==="valid"?V({state:"valid",format:p.format}):p.state==="reading"?V({state:"reading",...p.format?{format:p.format}:{},...p.coach?{coach:p.coach}:{}}):V({state:"searching"}));let v=o.quad===null?0:Lt(o.quad,o.frameWidth,o.frameHeight);W=o.quad===null?null:{quad:o.quad,frameWidth:o.frameWidth,frameHeight:o.frameHeight},R({type:"report",report:{present:o.quad!==null&&o.plausible||o.guide?.detected===!0,ready:o.ready===!0,locking:o.p>=.5,areaFrac:v},at:d()})}),a.on("error",({kind:o,retryable:p,detail:v})=>r.emit("error",Q(o,p,v))),a.on("artifacts",o=>{Ge(o.keyframe,o.previewDataUrl,o.docRegion,o.liveMrz)}))},"it"),re=n(()=>(P??(P=(async()=>{if(T){if(me(),f===null){let a;try{a=await(t.createEngine??Ct)({...t.engineOptions??{},...q!==void 0?{guide:q}:{},video:e.video,format:s.format,side:h?"single":e.side??"recto",autoCapture:!1,..._!==null?{ocr:_}:{}})}catch(p){B("error"),r.emit("error",Q("models",!0,{phase:"models",name:ae(p)}));return}if(!T){a.destroy();return}f=a,_e(a);let o=t.tickMs??500;o>0&&(U=setInterval(()=>R({type:"tick",at:d()}),o))}R({type:"clockRestart"}),C!==null&&C.liveMrzArm==="live"&&(N==="unsupported"||N==="off")&&V({state:"fallback",reason:N}),await f.start()}})().finally(()=>{P=null})),P),"ee");return{handle:{get state(){return k},on:n((a,o)=>r.on(a,o),"on"),start:re,retry:n(()=>{if(f===null&&c.phase==="result"){R({type:"retake"}),m=0,g=!1,re();return}if(f!==null&&k!=="error"){R({type:"retake"}),m=0,g=!1,f.rearm(h?"single":void 0);return}re()},"retry"),setSide:n(a=>{h||a==="single"||(c.current!==a&&(c={...c,current:a}),R({type:"clockRestart"}),c.phase!=="reading"&&c.phase!=="result"&&f?.rearm(a))},"setSide"),shutter:ge,focusAt:n((a,o)=>{f?.focusAt?.(a,o)},"focusAt"),setGuide:n(a=>{q=a,f?.setGuide?.(a)},"setGuide"),setTorch:n(a=>{b=a,f?.setTorch(a),R({type:"tick",at:d()})},"setTorch"),destroy:n(()=>{if(T&&f!==null&&k!=="done"){let a=ye();!te&&a!==void 0&&a.ticks>0&&we(a,"abandoned"),fe(a,void 0)}T=!1,ve(),_?.setEngine(null),G?.dispose(),G=null,r.clear()},"destroy")},plan:s,setFlowState:n(a=>{(c.phase==="reading"||c.phase==="result")&&B(a==="done"&&c.phase!=="result"?"scanning":a)},"setFlowState"),settle:n((a,o)=>{let p=a==="verso"?"verso":"recto";R(o.ok?{type:"readOk",side:p}:{type:"readFailed",side:p,issue:o.issue}),o.ok||Y(p)},"settle"),takeDeviceRead:n(a=>he.get(a.image)?.value??null,"takeDeviceRead")}}n(Rt,"Pt");export{Tt as a,Wt as b,It as c,Rt as d};
@@ -1 +1 @@
1
- import{d as X}from"./chunk-Q5BUNNRN.js";import{a as z,b as ee}from"./chunk-JJ3Q52P3.js";import{a as n}from"./chunk-5QL6W6FW.js";import{a,c as Z}from"./chunk-4FHWXBOB.js";var u=Z(z(),1),J=Z(z(),1),s=Z(ee(),1);var h=Z(ee(),1);var he="AC247 AD376 AE971/0 AF93/0 AG1/1 AI1/1 AL355/0 AM374/0 AO244 AR54/0 AS1/1 AT43/0 AU61/0 AW297 AX358/0 AZ994/0 BA387/0 BB1/1 BD880/0 BE32/0 BF226 BG359/0 BH973 BI257 BJ229 BL590/0 BM1/1 BN673 BO591/0 BQ599 BR55/0 BS1/1 BT975 BW267 BY375/8 BZ501 CA1/1 CC61/0 CD243/0 CF236 CG242 CH41/0 CI225 CK682 CL56 CM237 CN86/0 CO57/0 CR506 CU53/0 CV238 CW599 CX61/0 CY357 CZ420 DE49/0 DJ253 DK45 DM1/1 DO1/1 DZ213/0 EC593/0 EE372 EG20/0 EH212/0 ER291/0 ES34 ET251/0 FI358/0 FJ679 FK500 FM691 FO298 FR33/0 GA241 GB44/0 GD1/1 GE995/0 GF594/0 GG44/0 GH233/0 GI350 GL299 GM220 GN224 GP590/0 GQ240 GR30 GT502 GU1/1 GW245 GY592 HK852 HN504 HR385/0 HT509 HU36/06 ID62/0 IE353/0 IL972/0 IM44/0 IN91/0 IO246 IQ964/0 IR98/0 IS354 IT39 JE44/0 JM1/1 JO962/0 JP81/0 KE254/0 KG996/0 KH855/0 KI686/0 KM269 KN1/1 KP850/0 KR82/0 KW965 KY1/1 KZ7/8 LA856/0 LB961/0 LC1/1 LI423/0 LK94/0 LR231/0 LS266 LT370/0 LU352 LV371 LY218/0 MA212/0 MC377/0 MD373/0 ME382/0 MF590/0 MG261/0 MH692/1 MK389/0 ML223 MM95/0 MN976/0 MO853 MP1/1 MQ596/0 MR222 MS1/1 MT356 MU230 MV960 MW265/0 MX52 MY60/0 MZ258 NA264/0 NC687 NE227 NF672 NG234/0 NI505 NL31/0 NO47 NP977/0 NR674 NU683 NZ64/0 OM968 PA507 PE51/0 PF689 PG675 PH63/0 PK92/0 PL48 PM508/0 PR1/1 PS970/0 PT351 PW680 PY595/0 QA974 RE262/0 RO40/0 RS381/0 RU7/8 RW250/0 SA966/0 SB677 SC248 SD249/0 SE46/0 SG65 SH290 SI386/0 SJ47 SK421/0 SL232/0 SM378 SN221 SO252/0 SR597 SS211/0 ST239 SV503 SX1/1 SY963/0 SZ268 TA290 TC1/1 TD235 TG228 TH66/0 TJ992 TK690 TL670 TM993/8 TN216 TO676 TR90/0 TT1/1 TV688 TW886/0 TZ255/0 UA380/0 UG256/0 US1/1 UY598/0 UZ998 VA39 VC1/1 VE58/0 VG1/1 VI1/1 VN84/0 VU678 WF681 WS685 XK383/0 YE967/0 YT262/0 ZA27/0 ZM260/0 ZW263/0",j;function Q(e){return j??(j=new Map(he.split(" ").map(l=>{let[r,t]=l.slice(2).split("/");return[l.slice(0,2),[r,t]]}))),j.get(e.toUpperCase())}a(Q,"z");n(Q,"entryOf");function pe(e){return Q(e)?.[0]}a(pe,"Ne");n(pe,"dialCodeOf");function ne(e){return Q(e)?.[1]}a(ne,"ee");n(ne,"nationalPrefixOf");var le=n(e=>e.normalize("NFD").replace(/\p{Diacritic}/gu,"").toLocaleLowerCase(),"fold");function ae(e,l){let r=le(l.trim());return r===""?e:e.filter(t=>le(t.name).includes(r)||t.code.toLowerCase()===r)}a(ae,"ce");n(ae,"matchCountries");function oe({countries:e,label:l,searchPlaceholder:r,noMatch:t,onPick:v,selected:P,searchRef:f,scroll:E=!1,searchable:w=!0,detail:D,extra:y}){let[M,b]=(0,J.useState)(""),c=(0,J.useId)(),T=ae(e,M),N=(0,s.jsxs)("ul",{className:`sekyro-rows${E?" sekyro-rows--scroll":""}`,children:[T.map(d=>{let S=D?.(d.code);return(0,s.jsx)("li",{children:(0,s.jsxs)("button",{type:"button",className:"sekyro-row-btn","aria-current":P===d.code||void 0,onClick:a(()=>v(d.code),"onClick"),children:[(0,s.jsx)("span",{className:"sekyro-row-btn__flag","aria-hidden":"true",children:ce(d.code)}),(0,s.jsx)("span",{className:"sekyro-row-btn__name",children:d.name}),S!==void 0?(0,s.jsx)("bdi",{className:"sekyro-row-btn__detail",dir:"ltr",children:S}):null]})},d.code)}),y!==void 0?(0,s.jsx)("li",{children:(0,s.jsxs)("button",{type:"button",className:"sekyro-row-btn","aria-current":y.current||void 0,onClick:y.onPick,children:[(0,s.jsx)("span",{className:"sekyro-row-btn__flag","aria-hidden":"true",children:"🌐"}),(0,s.jsx)("span",{className:"sekyro-row-btn__name",children:y.label})]})}):null]});return w?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"sekyro-field",children:[(0,s.jsx)("label",{className:"sekyro-label",htmlFor:c,children:l}),(0,s.jsx)("input",{ref:f,id:c,type:"search",className:"sekyro-input",placeholder:r,value:M,onChange:a(d=>b(d.target.value),"onChange")})]}),T.length===0&&y===void 0?(0,s.jsx)("p",{className:"sekyro-text-muted",children:t}):N]}):N}a(oe,"te");n(oe,"CountryList");function U(e){let l=X(e).replace(/\D/g,"");return/^\D*\+/.test(e)?`+${l}`:l.startsWith("00")?`+${l.slice(2)}`:l}a(U,"H");n(U,"digitsOf");var te=n((e,l)=>(l.trunk!==void 0&&e.startsWith(l.trunk)?e.slice(l.trunk.length):e).slice(0,Math.max(...l.lengths)),"fitDigits");function Y(e,l){let r="",t=0;for(let v of l?.formats?.find(P=>new RegExp(`^(?:${P.leading})`).test(e))?.groups??[])t<e.length&&(r+=(t>0?" ":"")+e.slice(t,t+v)),t+=v;return r+e.slice(t)}a(Y,"Z");n(Y,"groupDigits");function ie(e,l){let r=0;for(let t=l;t>0&&r<e.length;r+=1)e[r]!==" "&&(t-=1);return r}a(ie,"oe");n(ie,"caretAfter");var se=n((e,l)=>l.find(r=>e.startsWith(r.dial)),"countryOfNumber"),me=n((e,l)=>e.lengths.join(", ").replace(/, (\d+)$/,` ${l} $1`),"lengthsLabel");function q(e){let l=U(e).replace("+","");return/^\d{8,15}$/.test(l)?`+${l}`:null}a(q,"le");n(q,"normalizedPhone");var ce=n(e=>String.fromCodePoint(...Array.from(e.toUpperCase(),l=>127397+l.charCodeAt(0))),"flagOf");function de(e,l){if(l===null||!e.startsWith(l.dial))return q(e);let r=e.slice(l.dial.length).replace(/\D/g,""),t=ne(l.code);return t!==void 0&&r.startsWith(t)&&(r=r.slice(t.length)),q(l.dial+r)}a(de,"ye");n(de,"e164Of");var re=n((e,l)=>(se(e,l)??l[0])?.code??null,"countryFor");function ue(e){let l=null;try{l=new Intl.DisplayNames([e],{type:"region"})}catch{}return r=>`${l?.of(r.code)??r.code} (${r.dial})`}a(ue,"me");n(ue,"countryLabels");var fe="other",ye=8;function ge({countries:e,international:l,closed:r,defaultPhone:t}){let[v,P]=(0,u.useState)(()=>re(t,e)),[f,E]=(0,u.useState)(t),[w,D]=(0,u.useState)(!1),[y,M]=(0,u.useState)(!1),b=e.map(o=>o.code).join(","),c=e.find(o=>o.code===v)??null,T=(0,u.useRef)(c);c!==null&&(T.current=c),(0,u.useEffect)(()=>{if(v===null||!e.some(o=>o.code===v)){let o=re(t,e);P(o);let i=T.current,k=e.find(C=>C.code===o)?.dial;k!==void 0&&E(C=>i!==null&&C.startsWith(i.dial)?k+C.slice(i.dial.length):C.startsWith("+")?C:k)}},[b,t]);let N=w||c===null,d=N||f.startsWith("+")&&!f.startsWith(c.dial),S=d?void 0:c.rule,x=d?f:f.replace(c.dial,"").replace(/\D/g,""),p=S?te(x,S):x,W=d&&!N&&!l&&r&&!e.some(o=>o.dial.startsWith(f)),I=W?null:S?S.lengths.includes(p.length)?c.dial+p:null:N&&!f.startsWith("+")?null:de(f,w?null:c),H=d||c===null?I??f:`${c.dial} ${Y(p,S)}`,B=d?U(f).replace("+","")==="":p==="";return{countries:e,international:l,phone:f,selected:c,other:w,whole:d,free:N,rule:S,national:p,refused:W,typed:I,shown:H,empty:B,lengthShown:y,setLengthShown:M,onNumber:n(o=>{let i=o.target,k=o.nativeEvent.inputType,C=Math.max(0,i.value.lastIndexOf("+")),G=U(i.value.slice(C)),A=se(G,e),_=U(i.value.slice(C,i.selectionStart)).length,F=G,V=G;if(M(!1),!A&&(N||G.startsWith("+")))l&&D(!0);else{let R=A??c,g=A?G.slice(A.dial.length):G;if(P(R.code),D(!1),g===p&&k?.startsWith("delete")&&(k.endsWith("Forward")||(_-=1),g=g.slice(0,_)+g.slice(_+1)),R.rule){let $=te(g,R.rule),O=g.length-$.length;_-=O,g=O>0&&!A&&p.length===$.length?p:$}V=R.dial+g,F=Y(g,R.rule)}E(V),i.value=F;let K=ie(F,_);i.setSelectionRange(K,K)},"onNumber"),onCountry:n(o=>{M(!1);let i=e.find(k=>k.code===o);D(i===void 0),i!==void 0&&P(i.code),E(i===void 0?"":i.dial+(d?"":p))},"onCountry")}}a(ge,"_e");n(ge,"usePhoneField");function Ne({field:e,id:l,locale:r,t,inputRef:v,invalid:P=!1,describedby:f,required:E,compact:w=!1,ready:D}){let{selected:y,whole:M,other:b,free:c,national:T,rule:N,phone:d,refused:S,typed:x,countries:p,international:W}=e,[I,H]=(0,u.useState)(!1),B=(0,u.useRef)(null),o=(0,u.useRef)(null),i=(0,u.useRef)(null),k=(0,u.useRef)(null),C=v??k,G=(0,u.useId)(),A=S?t("otp.reason_otp_destination_not_allowed"):e.lengthShown&&N?t("otp.phoneLengthError",{digits:me(N,t("otp.or"))}):"",_=p.length>1||W,F=ue(r),V=(0,u.useMemo)(()=>{let m=null;try{m=new Intl.DisplayNames([r],{type:"region"})}catch{}return p.map(L=>({code:L.code,name:m?.of(L.code)??L.code}))},[p,r]),K=p.length>ye,R=[M?"":`${l}-dial ${l}-hint`,A?`${l}-error`:"",f??""].join(" ").trim()||void 0,g=n(m=>{H(!1),requestAnimationFrame(()=>(m==="lead"?B.current:C.current)?.focus())},"close"),$=n(()=>{if(I)return g("lead");H(!0),requestAnimationFrame(()=>(i.current??o.current?.querySelector('[aria-current="true"]')??o.current?.querySelector("button"))?.focus())},"toggle"),O=n(()=>(0,h.jsxs)("span",{className:"sekyro-phone__dial",id:`${l}-dial`,"aria-hidden":_||void 0,children:[(0,h.jsx)("span",{className:"sekyro-phone__flag","aria-hidden":"true",children:b?"🌐":ce(y.code)}),b?null:y.dial]}),"dial");return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)("div",{className:`sekyro-phone${w?" sekyro-phone--compact":""}`,dir:"ltr",children:[y===null||M&&!b?null:_?(0,h.jsx)("button",{ref:B,type:"button",className:"sekyro-phone__lead sekyro-phone__pick","aria-label":`${t("otp.countryLabel")}: ${b?t("otp.otherCountry"):F(y)}`,"aria-expanded":I,"aria-controls":I?G:void 0,onClick:$,children:O()}):(0,h.jsx)("div",{className:"sekyro-phone__lead",children:O()}),(0,h.jsx)("input",{ref:C,id:l,className:"sekyro-phone__input",type:"tel",dir:"ltr",inputMode:"tel",autoComplete:"tel",required:E,"aria-describedby":R,"aria-invalid":!!A||P||void 0,placeholder:c?"+":void 0,value:M?d:Y(T,N),onChange:e.onNumber,onKeyDown:a(m=>{m.key==="Enter"&&D===!1&&e.setLengthShown(!0)},"onKeyDown"),onBlur:a(m=>{let L=m.relatedTarget;L!==null&&(B.current?.contains(L)||o.current?.contains(L))||e.setLengthShown(T!==""&&x===null)},"onBlur")})]}),I?(0,h.jsx)("div",{ref:o,id:G,className:"sekyro-phone__list",onKeyDown:a(m=>{m.key==="Escape"&&(m.preventDefault(),g("lead"))},"onKeyDown"),children:(0,h.jsx)(oe,{countries:V,label:(0,h.jsx)("span",{className:"sekyro-visually-hidden",children:t("otp.countrySearch")}),searchPlaceholder:t("otp.countrySearch"),noMatch:t("doc.noCountryMatch"),searchable:K,scroll:!0,...K?{searchRef:i}:{},...!b&&y!==null?{selected:y.code}:{},detail:a(m=>p.find(L=>L.code===m)?.dial,"detail"),onPick:a(m=>{e.onCountry(m),g("number")},"onPick"),...W?{extra:{label:t("otp.otherCountry"),current:b,onPick:n(()=>{e.onCountry(fe),g("number")},"onPick")}}:{}})}):null,M?null:(0,h.jsx)("span",{className:"sekyro-help",id:`${l}-hint`,children:t("otp.phonePlaceholderGeneric")}),A?(0,h.jsx)("span",{className:"sekyro-help is-danger",id:`${l}-error`,role:"alert",children:A}):null]})}a(Ne,"xe");n(Ne,"PhoneField");export{pe as a,oe as b,ce as c,ge as d,Ne as e};
1
+ import{d as X}from"./chunk-DEGFGNRM.js";import{a as z,b as ee}from"./chunk-JJ3Q52P3.js";import{a as n}from"./chunk-5QL6W6FW.js";import{a,c as Z}from"./chunk-4FHWXBOB.js";var u=Z(z(),1),J=Z(z(),1),s=Z(ee(),1);var h=Z(ee(),1);var he="AC247 AD376 AE971/0 AF93/0 AG1/1 AI1/1 AL355/0 AM374/0 AO244 AR54/0 AS1/1 AT43/0 AU61/0 AW297 AX358/0 AZ994/0 BA387/0 BB1/1 BD880/0 BE32/0 BF226 BG359/0 BH973 BI257 BJ229 BL590/0 BM1/1 BN673 BO591/0 BQ599 BR55/0 BS1/1 BT975 BW267 BY375/8 BZ501 CA1/1 CC61/0 CD243/0 CF236 CG242 CH41/0 CI225 CK682 CL56 CM237 CN86/0 CO57/0 CR506 CU53/0 CV238 CW599 CX61/0 CY357 CZ420 DE49/0 DJ253 DK45 DM1/1 DO1/1 DZ213/0 EC593/0 EE372 EG20/0 EH212/0 ER291/0 ES34 ET251/0 FI358/0 FJ679 FK500 FM691 FO298 FR33/0 GA241 GB44/0 GD1/1 GE995/0 GF594/0 GG44/0 GH233/0 GI350 GL299 GM220 GN224 GP590/0 GQ240 GR30 GT502 GU1/1 GW245 GY592 HK852 HN504 HR385/0 HT509 HU36/06 ID62/0 IE353/0 IL972/0 IM44/0 IN91/0 IO246 IQ964/0 IR98/0 IS354 IT39 JE44/0 JM1/1 JO962/0 JP81/0 KE254/0 KG996/0 KH855/0 KI686/0 KM269 KN1/1 KP850/0 KR82/0 KW965 KY1/1 KZ7/8 LA856/0 LB961/0 LC1/1 LI423/0 LK94/0 LR231/0 LS266 LT370/0 LU352 LV371 LY218/0 MA212/0 MC377/0 MD373/0 ME382/0 MF590/0 MG261/0 MH692/1 MK389/0 ML223 MM95/0 MN976/0 MO853 MP1/1 MQ596/0 MR222 MS1/1 MT356 MU230 MV960 MW265/0 MX52 MY60/0 MZ258 NA264/0 NC687 NE227 NF672 NG234/0 NI505 NL31/0 NO47 NP977/0 NR674 NU683 NZ64/0 OM968 PA507 PE51/0 PF689 PG675 PH63/0 PK92/0 PL48 PM508/0 PR1/1 PS970/0 PT351 PW680 PY595/0 QA974 RE262/0 RO40/0 RS381/0 RU7/8 RW250/0 SA966/0 SB677 SC248 SD249/0 SE46/0 SG65 SH290 SI386/0 SJ47 SK421/0 SL232/0 SM378 SN221 SO252/0 SR597 SS211/0 ST239 SV503 SX1/1 SY963/0 SZ268 TA290 TC1/1 TD235 TG228 TH66/0 TJ992 TK690 TL670 TM993/8 TN216 TO676 TR90/0 TT1/1 TV688 TW886/0 TZ255/0 UA380/0 UG256/0 US1/1 UY598/0 UZ998 VA39 VC1/1 VE58/0 VG1/1 VI1/1 VN84/0 VU678 WF681 WS685 XK383/0 YE967/0 YT262/0 ZA27/0 ZM260/0 ZW263/0",j;function Q(e){return j??(j=new Map(he.split(" ").map(l=>{let[r,t]=l.slice(2).split("/");return[l.slice(0,2),[r,t]]}))),j.get(e.toUpperCase())}a(Q,"z");n(Q,"entryOf");function pe(e){return Q(e)?.[0]}a(pe,"Ne");n(pe,"dialCodeOf");function ne(e){return Q(e)?.[1]}a(ne,"ee");n(ne,"nationalPrefixOf");var le=n(e=>e.normalize("NFD").replace(/\p{Diacritic}/gu,"").toLocaleLowerCase(),"fold");function ae(e,l){let r=le(l.trim());return r===""?e:e.filter(t=>le(t.name).includes(r)||t.code.toLowerCase()===r)}a(ae,"ce");n(ae,"matchCountries");function oe({countries:e,label:l,searchPlaceholder:r,noMatch:t,onPick:v,selected:P,searchRef:f,scroll:E=!1,searchable:w=!0,detail:D,extra:y}){let[M,b]=(0,J.useState)(""),c=(0,J.useId)(),T=ae(e,M),N=(0,s.jsxs)("ul",{className:`sekyro-rows${E?" sekyro-rows--scroll":""}`,children:[T.map(d=>{let S=D?.(d.code);return(0,s.jsx)("li",{children:(0,s.jsxs)("button",{type:"button",className:"sekyro-row-btn","aria-current":P===d.code||void 0,onClick:a(()=>v(d.code),"onClick"),children:[(0,s.jsx)("span",{className:"sekyro-row-btn__flag","aria-hidden":"true",children:ce(d.code)}),(0,s.jsx)("span",{className:"sekyro-row-btn__name",children:d.name}),S!==void 0?(0,s.jsx)("bdi",{className:"sekyro-row-btn__detail",dir:"ltr",children:S}):null]})},d.code)}),y!==void 0?(0,s.jsx)("li",{children:(0,s.jsxs)("button",{type:"button",className:"sekyro-row-btn","aria-current":y.current||void 0,onClick:y.onPick,children:[(0,s.jsx)("span",{className:"sekyro-row-btn__flag","aria-hidden":"true",children:"🌐"}),(0,s.jsx)("span",{className:"sekyro-row-btn__name",children:y.label})]})}):null]});return w?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"sekyro-field",children:[(0,s.jsx)("label",{className:"sekyro-label",htmlFor:c,children:l}),(0,s.jsx)("input",{ref:f,id:c,type:"search",className:"sekyro-input",placeholder:r,value:M,onChange:a(d=>b(d.target.value),"onChange")})]}),T.length===0&&y===void 0?(0,s.jsx)("p",{className:"sekyro-text-muted",children:t}):N]}):N}a(oe,"te");n(oe,"CountryList");function U(e){let l=X(e).replace(/\D/g,"");return/^\D*\+/.test(e)?`+${l}`:l.startsWith("00")?`+${l.slice(2)}`:l}a(U,"H");n(U,"digitsOf");var te=n((e,l)=>(l.trunk!==void 0&&e.startsWith(l.trunk)?e.slice(l.trunk.length):e).slice(0,Math.max(...l.lengths)),"fitDigits");function Y(e,l){let r="",t=0;for(let v of l?.formats?.find(P=>new RegExp(`^(?:${P.leading})`).test(e))?.groups??[])t<e.length&&(r+=(t>0?" ":"")+e.slice(t,t+v)),t+=v;return r+e.slice(t)}a(Y,"Z");n(Y,"groupDigits");function ie(e,l){let r=0;for(let t=l;t>0&&r<e.length;r+=1)e[r]!==" "&&(t-=1);return r}a(ie,"oe");n(ie,"caretAfter");var se=n((e,l)=>l.find(r=>e.startsWith(r.dial)),"countryOfNumber"),me=n((e,l)=>e.lengths.join(", ").replace(/, (\d+)$/,` ${l} $1`),"lengthsLabel");function q(e){let l=U(e).replace("+","");return/^\d{8,15}$/.test(l)?`+${l}`:null}a(q,"le");n(q,"normalizedPhone");var ce=n(e=>String.fromCodePoint(...Array.from(e.toUpperCase(),l=>127397+l.charCodeAt(0))),"flagOf");function de(e,l){if(l===null||!e.startsWith(l.dial))return q(e);let r=e.slice(l.dial.length).replace(/\D/g,""),t=ne(l.code);return t!==void 0&&r.startsWith(t)&&(r=r.slice(t.length)),q(l.dial+r)}a(de,"ye");n(de,"e164Of");var re=n((e,l)=>(se(e,l)??l[0])?.code??null,"countryFor");function ue(e){let l=null;try{l=new Intl.DisplayNames([e],{type:"region"})}catch{}return r=>`${l?.of(r.code)??r.code} (${r.dial})`}a(ue,"me");n(ue,"countryLabels");var fe="other",ye=8;function ge({countries:e,international:l,closed:r,defaultPhone:t}){let[v,P]=(0,u.useState)(()=>re(t,e)),[f,E]=(0,u.useState)(t),[w,D]=(0,u.useState)(!1),[y,M]=(0,u.useState)(!1),b=e.map(o=>o.code).join(","),c=e.find(o=>o.code===v)??null,T=(0,u.useRef)(c);c!==null&&(T.current=c),(0,u.useEffect)(()=>{if(v===null||!e.some(o=>o.code===v)){let o=re(t,e);P(o);let i=T.current,k=e.find(C=>C.code===o)?.dial;k!==void 0&&E(C=>i!==null&&C.startsWith(i.dial)?k+C.slice(i.dial.length):C.startsWith("+")?C:k)}},[b,t]);let N=w||c===null,d=N||f.startsWith("+")&&!f.startsWith(c.dial),S=d?void 0:c.rule,x=d?f:f.replace(c.dial,"").replace(/\D/g,""),p=S?te(x,S):x,W=d&&!N&&!l&&r&&!e.some(o=>o.dial.startsWith(f)),I=W?null:S?S.lengths.includes(p.length)?c.dial+p:null:N&&!f.startsWith("+")?null:de(f,w?null:c),H=d||c===null?I??f:`${c.dial} ${Y(p,S)}`,B=d?U(f).replace("+","")==="":p==="";return{countries:e,international:l,phone:f,selected:c,other:w,whole:d,free:N,rule:S,national:p,refused:W,typed:I,shown:H,empty:B,lengthShown:y,setLengthShown:M,onNumber:n(o=>{let i=o.target,k=o.nativeEvent.inputType,C=Math.max(0,i.value.lastIndexOf("+")),G=U(i.value.slice(C)),A=se(G,e),_=U(i.value.slice(C,i.selectionStart)).length,F=G,V=G;if(M(!1),!A&&(N||G.startsWith("+")))l&&D(!0);else{let R=A??c,g=A?G.slice(A.dial.length):G;if(P(R.code),D(!1),g===p&&k?.startsWith("delete")&&(k.endsWith("Forward")||(_-=1),g=g.slice(0,_)+g.slice(_+1)),R.rule){let $=te(g,R.rule),O=g.length-$.length;_-=O,g=O>0&&!A&&p.length===$.length?p:$}V=R.dial+g,F=Y(g,R.rule)}E(V),i.value=F;let K=ie(F,_);i.setSelectionRange(K,K)},"onNumber"),onCountry:n(o=>{M(!1);let i=e.find(k=>k.code===o);D(i===void 0),i!==void 0&&P(i.code),E(i===void 0?"":i.dial+(d?"":p))},"onCountry")}}a(ge,"_e");n(ge,"usePhoneField");function Ne({field:e,id:l,locale:r,t,inputRef:v,invalid:P=!1,describedby:f,required:E,compact:w=!1,ready:D}){let{selected:y,whole:M,other:b,free:c,national:T,rule:N,phone:d,refused:S,typed:x,countries:p,international:W}=e,[I,H]=(0,u.useState)(!1),B=(0,u.useRef)(null),o=(0,u.useRef)(null),i=(0,u.useRef)(null),k=(0,u.useRef)(null),C=v??k,G=(0,u.useId)(),A=S?t("otp.reason_otp_destination_not_allowed"):e.lengthShown&&N?t("otp.phoneLengthError",{digits:me(N,t("otp.or"))}):"",_=p.length>1||W,F=ue(r),V=(0,u.useMemo)(()=>{let m=null;try{m=new Intl.DisplayNames([r],{type:"region"})}catch{}return p.map(L=>({code:L.code,name:m?.of(L.code)??L.code}))},[p,r]),K=p.length>ye,R=[M?"":`${l}-dial ${l}-hint`,A?`${l}-error`:"",f??""].join(" ").trim()||void 0,g=n(m=>{H(!1),requestAnimationFrame(()=>(m==="lead"?B.current:C.current)?.focus())},"close"),$=n(()=>{if(I)return g("lead");H(!0),requestAnimationFrame(()=>(i.current??o.current?.querySelector('[aria-current="true"]')??o.current?.querySelector("button"))?.focus())},"toggle"),O=n(()=>(0,h.jsxs)("span",{className:"sekyro-phone__dial",id:`${l}-dial`,"aria-hidden":_||void 0,children:[(0,h.jsx)("span",{className:"sekyro-phone__flag","aria-hidden":"true",children:b?"🌐":ce(y.code)}),b?null:y.dial]}),"dial");return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)("div",{className:`sekyro-phone${w?" sekyro-phone--compact":""}`,dir:"ltr",children:[y===null||M&&!b?null:_?(0,h.jsx)("button",{ref:B,type:"button",className:"sekyro-phone__lead sekyro-phone__pick","aria-label":`${t("otp.countryLabel")}: ${b?t("otp.otherCountry"):F(y)}`,"aria-expanded":I,"aria-controls":I?G:void 0,onClick:$,children:O()}):(0,h.jsx)("div",{className:"sekyro-phone__lead",children:O()}),(0,h.jsx)("input",{ref:C,id:l,className:"sekyro-phone__input",type:"tel",dir:"ltr",inputMode:"tel",autoComplete:"tel",required:E,"aria-describedby":R,"aria-invalid":!!A||P||void 0,placeholder:c?"+":void 0,value:M?d:Y(T,N),onChange:e.onNumber,onKeyDown:a(m=>{m.key==="Enter"&&D===!1&&e.setLengthShown(!0)},"onKeyDown"),onBlur:a(m=>{let L=m.relatedTarget;L!==null&&(B.current?.contains(L)||o.current?.contains(L))||e.setLengthShown(T!==""&&x===null)},"onBlur")})]}),I?(0,h.jsx)("div",{ref:o,id:G,className:"sekyro-phone__list",onKeyDown:a(m=>{m.key==="Escape"&&(m.preventDefault(),g("lead"))},"onKeyDown"),children:(0,h.jsx)(oe,{countries:V,label:(0,h.jsx)("span",{className:"sekyro-visually-hidden",children:t("otp.countrySearch")}),searchPlaceholder:t("otp.countrySearch"),noMatch:t("doc.noCountryMatch"),searchable:K,scroll:!0,...K?{searchRef:i}:{},...!b&&y!==null?{selected:y.code}:{},detail:a(m=>p.find(L=>L.code===m)?.dial,"detail"),onPick:a(m=>{e.onCountry(m),g("number")},"onPick"),...W?{extra:{label:t("otp.otherCountry"),current:b,onPick:n(()=>{e.onCountry(fe),g("number")},"onPick")}}:{}})}):null,M?null:(0,h.jsx)("span",{className:"sekyro-help",id:`${l}-hint`,children:t("otp.phonePlaceholderGeneric")}),A?(0,h.jsx)("span",{className:"sekyro-help is-danger",id:`${l}-error`,role:"alert",children:A}):null]})}a(Ne,"xe");n(Ne,"PhoneField");export{pe as a,oe as b,ce as c,ge as d,Ne as e};
@@ -1,4 +1,4 @@
1
- import{d as I}from"./chunk-AARN2MG7.js";import{a as C,b as P,c as H}from"./chunk-JJ3Q52P3.js";import{a as T}from"./chunk-GPGK6XZM.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-AARN2MG7.js";import{a as C,b as P,c as H}from"./chunk-JJ3Q52P3.js";import{a as T}from"./chunk-DKZUKWGP.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: