@sekyro/elements 0.1.0-rc.2 → 0.1.0-rc.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +9 -0
- package/dist/cdn/chunks/{capture-session-doc-O33KRXH7-X5MKSSBA.js → capture-session-doc-WZMI5XPE-AZDHR6MQ.js} +1 -1
- package/dist/cdn/chunks/{chunk-OVRHETMK.js → chunk-2T6RLTDQ.js} +1 -1
- package/dist/cdn/chunks/{chunk-3NAYOW43.js → chunk-434MMEWK.js} +1 -1
- package/dist/cdn/chunks/{chunk-JAIRD73U.js → chunk-5K4YQOZN.js} +1 -1
- package/dist/cdn/chunks/chunk-6BRQUKUP.js +1 -0
- package/dist/cdn/chunks/{chunk-YF5BWIHV.js → chunk-7MV4CI4L.js} +1 -1
- package/dist/cdn/chunks/{chunk-WQW232LA.js → chunk-CXQO6QMQ.js} +1 -1
- package/dist/cdn/chunks/{chunk-FAQCPBKF.js → chunk-EWTKC2C2.js} +1 -1
- package/dist/cdn/chunks/{chunk-SVIHEXDZ.js → chunk-FV4TIWHC.js} +1 -1
- package/dist/cdn/chunks/{chunk-Y7VOIKUK.js → chunk-H22YHQ6V.js} +1 -1
- package/dist/cdn/chunks/{chunk-4ECYTYEB.js → chunk-LA2MA2UQ.js} +1 -1
- package/dist/cdn/chunks/{chunk-UJSGILV7.js → chunk-MJEQ5ANO.js} +1 -1
- package/dist/cdn/chunks/{chunk-HTLQX2R3.js → chunk-POHYEXNR.js} +1 -1
- package/dist/cdn/chunks/{chunk-KQQ6BZAH.js → chunk-QOZB3DLY.js} +1 -1
- package/dist/cdn/chunks/{chunk-M2F5OJOZ.js → chunk-RKH7O2P5.js} +1 -1
- package/dist/cdn/chunks/chunk-SGUCIULX.js +3 -0
- package/dist/cdn/chunks/{chunk-OTGSYUHN.js → chunk-SIPFHN7E.js} +1 -1
- package/dist/cdn/chunks/chunk-TKJVGZWP.js +33 -0
- package/dist/cdn/chunks/{chunk-NQHMZQZA.js → chunk-UNQ3QO4U.js} +1 -1
- package/dist/cdn/chunks/{chunk-Y27EXTAY.js → chunk-WPRIGJHG.js} +1 -1
- package/dist/cdn/chunks/chunk-YRTHQZAW.js +1 -0
- package/dist/cdn/chunks/{chunk-UQ5AELS3.js → chunk-ZMHEKDRM.js} +1 -1
- package/dist/cdn/chunks/{chunk-P3OIDL7Y.js → chunk-ZYZPLDA2.js} +1 -1
- package/dist/cdn/chunks/{create-document-capture-OLKNUVTU-Q3AGV6QB.js → create-document-capture-OXPLKHOF-GVCM77EK.js} +1 -1
- package/dist/cdn/chunks/{detector-scanic-YCDNLCGV-FH6NWNXC.js → detector-scanic-23DAYT3H-AJXQA7H4.js} +1 -1
- package/dist/cdn/chunks/document-capture-view-UL3ISHNS-WZLR5RSQ.js +1 -0
- package/dist/cdn/chunks/{eid-view-ERVRHLLD-ONTAYXU7.js → eid-view-FKFEF42L-2OQYMKAB.js} +1 -1
- package/dist/cdn/chunks/email-otp-view-NRZCAJJ4-BJNXOVUF.js +1 -0
- package/dist/cdn/chunks/{flow-views-IGQ5MYS2-3UXKITDZ.js → flow-views-N7LBFI55-27RU7EZG.js} +1 -1
- package/dist/cdn/chunks/overlay-de-KYSF3MDD-XORYFTYU.js +1 -0
- package/dist/cdn/chunks/overlay-es-36H5G6S5-22UFLFPZ.js +1 -0
- package/dist/cdn/chunks/overlay-pt-EB4UDBFE-CWJXQDCQ.js +1 -0
- package/dist/cdn/chunks/plan-runner-EP26JU6A-LU7KJ6JU.js +1 -0
- package/dist/cdn/chunks/{portrait-capture-view-TMHG2UX2-N44IPYHU.js → portrait-capture-view-6KZGPAJU-2O54W4SR.js} +1 -1
- package/dist/cdn/chunks/{portrait-review-view-XUWQ5LIN-M5WOPF2E.js → portrait-review-view-TBSABVSX-5SVU25AE.js} +1 -1
- package/dist/cdn/chunks/proof-of-address-view-3GG3XEQK-CPQ2AQEQ.js +1 -0
- package/dist/cdn/chunks/upload-file-EGXXM6TQ-NNVVB5QQ.js +1 -0
- package/dist/cdn/define.js +1 -1
- package/dist/cdn/index.js +1 -1
- package/dist/{chunk-LREBBPJW.js → chunk-2FHYNKUL.js} +1 -1
- package/dist/{chunk-KXJRO6VZ.js → chunk-A75VY7L7.js} +1 -1
- package/dist/{chunk-SBJNQYEL.js → chunk-APM7FCA2.js} +1 -1
- package/dist/{chunk-S6JGFCOP.js → chunk-CFERAKA2.js} +1 -1
- package/dist/{chunk-LHD2PSUM.js → chunk-JCCTKW23.js} +1 -1
- package/dist/{chunk-GTN3SYJJ.js → chunk-JUB6FRPB.js} +1 -1
- package/dist/chunk-LYFBZCIH.js +33 -0
- package/dist/{chunk-6LR6LY2U.js → chunk-PMIO3U3J.js} +1 -1
- package/dist/{chunk-IFHBX74I.js → chunk-PNTIMH72.js} +1 -1
- package/dist/{chunk-OQUTKFRP.js → chunk-UXPM24JI.js} +1 -1
- package/dist/{chunk-IQ7FLSNW.js → chunk-UZJG5SPC.js} +1 -1
- package/dist/chunk-WBXQX6DQ.js +1 -0
- package/dist/{chunk-INKK6CKB.js → chunk-YPBTBTOU.js} +1 -1
- package/dist/define.cjs +6 -6
- package/dist/define.js +1 -1
- package/dist/document-capture-view-UL3ISHNS-K636D7VR.js +1 -0
- package/dist/{eid-view-ERVRHLLD-NLA6CQL7.js → eid-view-FKFEF42L-ZXQWPIIA.js} +1 -1
- package/dist/email-otp-view-NRZCAJJ4-RANTR7SO.js +1 -0
- package/dist/{flow-views-IGQ5MYS2-DVYTE4D2.js → flow-views-N7LBFI55-DZ3PH2EP.js} +1 -1
- package/dist/index.cjs +6 -6
- package/dist/index.d.cts +69 -0
- package/dist/index.d.ts +69 -0
- package/dist/index.js +1 -1
- package/dist/overlay-de-KYSF3MDD-2ZNXM2N7.js +1 -0
- package/dist/overlay-es-36H5G6S5-VQWD57TO.js +1 -0
- package/dist/overlay-pt-EB4UDBFE-6VWPTFO2.js +1 -0
- package/dist/{portrait-capture-view-TMHG2UX2-4DHDNWRH.js → portrait-capture-view-6KZGPAJU-LAGNB7A4.js} +1 -1
- package/dist/{portrait-review-view-XUWQ5LIN-7GZ3GF2B.js → portrait-review-view-TBSABVSX-MLNZZBL5.js} +1 -1
- package/dist/proof-of-address-view-3GG3XEQK-FWM7OQ4K.js +1 -0
- package/dist/styles.css +15 -0
- package/package.json +2 -2
- package/sbom.cdx.json +4 -4
- package/dist/cdn/chunks/chunk-CSM63KBJ.js +0 -3
- package/dist/cdn/chunks/chunk-EPEHFY6J.js +0 -1
- package/dist/cdn/chunks/chunk-GRJNZG6Y.js +0 -33
- package/dist/cdn/chunks/chunk-LNQJGD3J.js +0 -1
- package/dist/cdn/chunks/document-capture-view-GZX5JJ7N-PRYTX37D.js +0 -1
- package/dist/cdn/chunks/email-otp-view-B7UQ5CHL-GWHWAR75.js +0 -1
- package/dist/cdn/chunks/overlay-de-5KYN4JFO-I4ESJMAS.js +0 -1
- package/dist/cdn/chunks/overlay-es-6CAERCCN-SPFAX3SD.js +0 -1
- package/dist/cdn/chunks/overlay-pt-UBGXJ3C3-MWW4QOSN.js +0 -1
- package/dist/cdn/chunks/plan-runner-VKPRZ3AD-VYRGIMQG.js +0 -1
- package/dist/cdn/chunks/upload-file-UYXOHCRG-MBYCMRP2.js +0 -1
- package/dist/chunk-4QKQAQKO.js +0 -1
- package/dist/chunk-GRQ3QAMU.js +0 -33
- package/dist/document-capture-view-GZX5JJ7N-ZW55IE6H.js +0 -1
- package/dist/email-otp-view-B7UQ5CHL-67LKMWBY.js +0 -1
- package/dist/overlay-de-5KYN4JFO-MYA62T4Z.js +0 -1
- package/dist/overlay-es-6CAERCCN-QPH54AX7.js +0 -1
- package/dist/overlay-pt-UBGXJ3C3-VG6FOOCX.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{d as Et,e as Bt,f as Wt,g as qt}from"./chunk-3NAYOW43.js";import{a as it,b as zt,c as rt,d as Ht}from"./chunk-P7K7ELYZ.js";import{a as kt,b as V,c as Tt,d as _t,e as St,g as At,h as tt,i as It,j as xt,k as Nt,l as Lt}from"./chunk-CW56KMMH.js";import{a as Dt,b as Rt,c as Ct,d as Ot,e as Pt,f as et,g as K,h as Gt,i as Ut,j as Ft}from"./chunk-JS2IXPNL.js";import{a as o}from"./chunk-4FHWXBOB.js";var me=1e4,C,pe=(C=class{constructor(t,e){this.tier="blaze",this.inner=t,e!==void 0&&(this.fallbackReason=e)}static async create(t,e){let r=await import("./vision_bundle-WBHR7TEE.js"),s=await r.FilesetResolver.forVisionTasks(t),a=await r.FaceDetector.createFromOptions(s,{baseOptions:{modelAssetPath:`${t}/blaze_face_short_range.tflite`,delegate:"CPU"},runningMode:"IMAGE"});return new C(a,e)}async detect(t,e,r){let s;try{s=this.inner.detect(t).detections}catch{return null}let a=ge(s);if(a?.boundingBox===void 0)return null;let n=Z(t),l=ve(a.keypoints,n),c=a.keypoints?.[2],h={box:{x:a.boundingBox.originX,y:a.boundingBox.originY,width:a.boundingBox.width,height:a.boundingBox.height},...l!==void 0?{eyes:l}:{},...c!==void 0?{nose:{x:c.x*n.width,y:c.y*n.height}}:{},score:a.categories[0]?.score??0,extraFaces:Kt(s.map(d=>d.boundingBox??{width:0,height:0}),s.indexOf(a))};return Xt(h,t,e,r)}destroy(){try{this.inner.close()}catch{}}},o(C,"t"),C);function ge(i){let t,e=-1;for(let r of i){let s=r.categories[0]?.score??0;s>e&&(t=r,e=s)}return t}o(ge,"R");function ve(i,t){let e=i?.[0],r=i?.[1];if(e===void 0||r===void 0)return;let s=o(l=>({x:l.x*t.width,y:l.y*t.height}),"n"),[a,n]=[s(e),s(r)];return a.x<=n.x?{left:a,right:n}:{left:n,right:a}}o(ve,"T");function ye(){if(typeof OffscreenCanvas=="function")return new OffscreenCanvas(2,2);let i=document.createElement("canvas");return i.width=2,i.height=2,i}o(ye,"E");var we=4;async function be(){let i=globalThis.FaceDetector;if(typeof i!="function")return{ok:!1,reason:"unsupported"};try{let t=new i({fastMode:!0,maxDetectedFaces:we});return await t.detect(ye()),{ok:!0,instance:t}}catch(t){return{ok:!1,reason:`smoke_failed:${t instanceof Error?t.message:String(t)}`}}}o(be,"w");var P,Me=(P=class{constructor(t,e){this.tier="native",this.inner=t,e!==void 0&&(this.fallbackReason=e)}async detect(t,e,r){let s;try{s=await this.inner.detect(t)}catch{return null}let a=s.map(d=>d.boundingBox),n=-1;a.forEach((d,u)=>{let v=a[n];(v===void 0||d.width*d.height>v.width*v.height)&&(n=u)});let l=s[n];if(l===void 0)return null;let c=ke(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:Kt(a,n)};return Xt(h,t,e,r)}destroy(){}},o(P,"b"),P);function ke(i){if(i===void 0)return;let t=i.filter(s=>s.type==="eye").map(s=>s.locations[0]).filter(s=>s!==void 0),[e,r]=t;if(!(e===void 0||r===void 0))return e.x<=r.x?{left:e,right:r}:{left:r,right:e}}o(ke,"S");var Te=.25;function Kt(i,t){let e=i[t],r=e===void 0?0:e.width*e.height;if(!(r>0))return 0;let s=0;return i.forEach((a,n)=>{n!==t&&a.width*a.height>=Te*r&&(s+=1)}),s}o(Kt,"f");var at="/models-v3",_e=["native","blaze"],G,nt=(G=class extends Error{constructor(t){super(`no detector tier available (${t})`),this.name="DetectorLadderError",this.fallbackReason=t}},o(G,"x"),G);function Z(i){let t=i;if(typeof t.videoWidth=="number"&&t.videoWidth>0)return{width:t.videoWidth,height:t.videoHeight??0};if(typeof t.naturalWidth=="number"&&t.naturalWidth>0)return{width:t.naturalWidth,height:t.naturalHeight??0};let e=typeof t.width=="number"?t.width:0,r=typeof t.height=="number"?t.height:0;return{width:e,height:r}}o(Z,"y");function Xt(i,t,e,r){let s=Z(t),a=s.width>0?e/s.width:1,n=s.height>0?r/s.height:1,l=o(c=>({x:c.x*a,y:c.y*n}),"s");return{box:{x:i.box.x*a,y:i.box.y*n,width:i.box.width*a,height:i.box.height*n},...i.eyes!==void 0?{eyes:{left:l(i.eyes.left),right:l(i.eyes.right)}}:{},...i.nose!==void 0?{nose:l(i.nose)}:{},score:i.score,...i.extraFaces!==void 0?{extraFaces:i.extraFaces}:{}}}o(Xt,"h");function Ee(i){return i instanceof Error?i.message:String(i)}o(Ee,"C");async function x(i){let t=i.preferred??_e,e=[];for(let r of t){if(r==="native"){let s=await be();if(s.ok)return new Me(s.instance,st(e));e.push(`native:${s.reason}`);continue}try{return await Se(pe.create(i.v3AssetBaseUrl??at,st(e)),i.blazeInitTimeoutMs??me)}catch(s){e.push(s instanceof Vt?"blaze:blaze_init_timeout":`blaze:${Ee(s)}`)}}throw new nt(st(e)??"no_tier_available")}o(x,"O");function st(i){return i.length>0?i.join("; "):void 0}o(st,"v");var U,Vt=(U=class extends Error{},o(U,"g"),U);function Se(i,t){return new Promise((e,r)=>{let s=setTimeout(()=>{r(new Vt(`init exceeded ${t}ms`)),i.then(a=>a.destroy(),()=>{})},t);i.then(a=>{clearTimeout(s),e(a)},a=>{clearTimeout(s),r(a)})})}o(Se,"W");var R=1;function Zt(){return typeof OffscreenCanvas=="function"&&typeof createImageBitmap=="function"&&typeof Worker=="function"}o(Zt,"K");function Ae(i,t={}){let e=t.createDetector??x,r=null;i.onmessage=s=>{let a=s.data;if(a.v!==R){a.bitmap?.close?.();return}if(a.type==="init"){e(a.options).then(n=>{r=n;let l={v:R,type:"ready",tier:n.tier,...n.fallbackReason!==void 0?{fallbackReason:n.fallbackReason}:{}};i.postMessage(l)});return}if(a.type==="detect"){let n=o(l=>{let c={v:R,type:"result",id:a.id,observation:l};i.postMessage(c),a.bitmap.close?.()},"a");if(r===null){n(null);return}r.detect(a.bitmap,a.streamWidth,a.streamHeight).then(n,()=>n(null))}}}o(Ae,"B");typeof self<"u"&&typeof self.importScripts=="function"&&Ae(self);var O,jt=(O=class{constructor(t,e){this.pending=new Map,this.nextId=1,this.worker=t,this.tier=e.tier,e.fallbackReason!==void 0&&(this.fallbackReason=e.fallbackReason),t.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(t,e,r=1e4){return new Promise((s,a)=>{let n=setTimeout(()=>{t.removeEventListener("message",l),t.terminate(),a(new Error(`worker detector not ready within ${r}ms`))},r),l=o(h=>{let d=h.data;d.v!==R||d.type!=="ready"||(clearTimeout(n),t.removeEventListener("message",l),s(new O(t,d)))},"s");t.addEventListener("message",l);let c={v:R,type:"init",options:e};t.postMessage(c)})}async detect(t,e,r){let s;try{typeof ImageBitmap<"u"&&t instanceof ImageBitmap?s=t:typeof createImageBitmap=="function"?s=await createImageBitmap(t):s=t}catch{return null}let a=this.nextId;return this.nextId+=1,new Promise(n=>{this.pending.set(a,n);let l={v:R,type:"detect",id:a,bitmap:s,streamWidth:e,streamHeight:r};this.worker.postMessage(l,[s])})}destroy(){for(let t of this.pending.values())t(null);this.pending.clear(),this.worker.terminate()}},o(O,"t"),O);var Ie=[...Dt.filter(i=>i.startsWith("video/mp4")),"video/webm;codecs=h264","video/webm;codecs=avc1","video/webm;codecs=vp8","video/webm;codecs=vp9","video/webm"],se=new Set;function xe(i){let t=/(?:Chrome|Chromium)\/(\d+)\./.exec(i??"");return t?Number(t[1]):null}o(xe,"De");function De(i=Ce(),t=globalThis.navigator?.userAgent){if(i===void 0)return"";let e=xe(t)===126;for(let r of Ie)if(!(se.has(r)||e&&r.startsWith("video/mp4")))try{if(i(r))return r}catch{}return""}o(De,"he");function $t(i){i!==""&&se.add(i)}o($t,"F");function Re(i){return i.replace(/^video\/x-matroska/i,"video/webm")}o(Re,"fe");function ae(i){let t=/codecs=["']?([^,;"']+)/i.exec(i);return t?t[1].trim():i.split(";")[0].trim()}o(ae,"ut");function Ce(){let i=globalThis.MediaRecorder;return i&&typeof i.isTypeSupported=="function"?t=>i.isTypeSupported(t):void 0}o(Ce,"Oe");var ne=2500,Oe=1e3,Pe=1500,Yt=25e5,Ge=100,Ue=700,Fe=20,Ne=1500,j=null;function Le(){return j??(j=import("./clip-inspect-DLJXVKV6-TNHTD4LV.js").catch(i=>{throw j=null,i})),j.catch(()=>null)}o(Le,"Ne");var N,D=(N=class extends Error{constructor(t,e){super(e??t),this.kind=t}},o(N,"S"),N),Be=100;function Qt(i,t){return i.stats===void 0?!1:i.stats===null?!0:i.stats.durationMs<t-Be}o(Qt,"U");function We(i,t){return i.stats?t.stats?i.stats.durationMs>t.stats.durationMs:!0:!1}o(We,"ge");var L,qe=(L=class{constructor(t={}){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=t.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(t,e,r,s=ne,a){let n=De(),l=Le();return this.recordRaw(t,e,r,s,a,n).then(c=>ze(c,l),c=>{throw c instanceof D&&(c.requestedMimeType=n),c})}recordRaw(t,e,r,s,a,n){return this.recorder&&!this.settled?Promise.reject(new D("generic","record() called while a recording is in flight — ClipRecorder handles one recording at a time")):(this.recorder=null,this.clearTimers(),this.chunks=[],this.bytes=0,this.settled=!1,this.stream=t,new Promise((l,c)=>{let h;try{h=new MediaRecorder(t,n?{mimeType:n,videoBitsPerSecond:Yt}:{videoBitsPerSecond:Yt})}catch{try{h=new MediaRecorder(t)}catch{c(new D("unsupported"));return}}this.recorder=h;let d=o(p=>{this.settled||(this.settled=!0,this.clearTimers(),p())},"d"),u=o(()=>d(()=>{let p=Re(h.mimeType||n||Rt),M=new Blob(this.chunks,{type:p});if(M.size===0){c(new D("generic","empty clip"));return}if(et(M)){c(new D("cliptoolarge"));return}l({blob:M,mimeType:p,requestedMimeType:n})}),"u");h.ondataavailable=p=>{p.data&&p.data.size&&(this.chunks.push(p.data),this.bytes+=p.data.size,this.bytes>Pt&&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(Oe)}catch{d(()=>c(new D("generic")));return}let w=o(()=>{if(this.pollTimer&&clearInterval(this.pollTimer),this.pollTimer=null,this.hardStopTimer&&clearTimeout(this.hardStopTimer),this.hardStopTimer=null,this.settled||e?.(),h.state!=="inactive"){try{h.stop()}catch{u()}this.graceTimer=setTimeout(u,Pe)}else u()},"v"),m=this.now();if(a===void 0){this.hardStopTimer=setTimeout(w,s);return}let g=null,y=!1;this.hardStopTimer=setTimeout(w,s+Ue),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 T=g!==null&&M!==void 0&&M-g>=s,A=g===null&&this.now()-m>=s;if(!(!T&&!A)){if(y=!0,this.pollTimer&&clearInterval(this.pollTimer),this.pollTimer=null,A){w();return}this.hardStopTimer&&clearTimeout(this.hardStopTimer),this.hardStopTimer=setTimeout(w,Ge)}},Fe)}))}stop(t){this.clearTimers();let e=this.recorder;if(e&&e.state!=="inactive")try{e.stop()}catch{}this.recorder=null,(t??this.stream)?.getTracks().forEach(r=>r.stop()),this.stream=null}},o(L,"I"),L);async function ze(i,t){let e,r=new Promise(h=>{e=setTimeout(()=>h(null),Ne)}),s=await Promise.race([t,r]);if(clearTimeout(e),s===null)return i;let a;try{a=await s.blobBytes(i.blob)}catch{return{...i,stats:null}}let n=s.inspectClipBytes(a);if(n?.container!=="webm")return{...i,stats:n};let l=s.withWebmDuration(a,n.durationMs);if(l===null)return{...i,stats:n};let c=s.inspectClipBytes(l);return c===null||c.frames!==n.frames||c.durationMs!==n.durationMs?{...i,stats:n}:{...i,blob:new Blob([l],{type:i.blob.type}),stats:n}}o(ze,"He");var He=["magenta","yellow","green","blue"],Ke={magenta:"rgb(255, 72, 150)",yellow:"rgb(255, 190, 0)",green:"rgb(0, 238, 175)",blue:"rgb(25, 150, 255)",dark:"rgb(0, 0, 0)"};function zi(i){return Ke[i]}o(zi,"ft");var Xe=4,Ve=4,$=o(i=>typeof i=="number"&&Number.isFinite(i),"D");function oe(i){if(typeof i!="object"||i===null)return!1;let t=i;if(typeof t.nonce!="string"||t.nonce.length===0||!Array.isArray(t.colours)||t.colours.length<1||t.colours.length>8||!t.colours.every(r=>He.includes(r))||!Array.isArray(t.onsetsMs)||t.onsetsMs.length!==t.colours.length)return!1;let e=-1;for(let r of t.onsetsMs){if(!$(r)||r<0||r<=e)return!1;e=r}return!(!$(t.holdMs)||t.holdMs<=0||!$(t.endMs)||t.endMs<=e||!$(t.clipMs)||t.clipMs<t.endMs||t.clipMs>8e3)}o(oe,"be");function Ze(i,t){return oe(i)?Math.max(t,Math.ceil(i.clipMs)):t}o(Ze,"ye");function je(i,t){let e=t.now??(()=>performance.now()),r=oe(i)?i:void 0,s=[],a=null,n=null,l=null,c=!1,h=null,d=o(m=>{h=m;try{t.paint(m)}catch{}},"d"),u=o(m=>{let g=t.frames?.()??null;return g!==null&&l!==null?g.mediaTimeMs+(m-g.presentationTimeMs)-l:m-(n??m)},"u"),v=o((m,g,y=0)=>{if(c)return;let p=Math.max(0,m-u(e()));a=setTimeout(()=>{if(a=null,!c){if(y<Xe&&u(e())<m-Ve){v(m,g,y+1);return}g()}},p)},"f"),w=o(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(e());if(M>g){h!==null&&d(null);return}let T=r.colours[m];d(T);let A=s.length===0?0:s[s.length-1].tMs;s.push({tMs:Math.max(A,Math.round(M)),colour:T});let k=y+r.holdMs;if(k<p){v(k,()=>{if(u(e())>g){h!==null&&d(null);return}d("dark"),w(m+1)});return}w(m+1)})},"v");return{started(m){if(r===void 0||c||n!==null)return;n=m;let g=t.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]}}}}o(je,"Me");function $e(i,t,e=.92){return new Promise((r,s)=>{let a=i.videoWidth,n=i.videoHeight;if(!a||!n){s(new Error("video-not-ready"));return}let l=t.getContext("2d");if(!l){s(new Error("no-2d-context"));return}t.width=a,t.height=n,l.scale(-1,1),l.drawImage(i,-a,0),t.toBlob(c=>c?r(c):s(new Error("empty-keyframe")),"image/jpeg",e)})}o($e,"Se");var B,Ye=(B=class{constructor(t){this.timer=null,this.frameCallbackId=null,this.running=!1,this.busy=!1,this.lastRunAt=Number.NEGATIVE_INFINITY,this.degradeCount=0,this.durations=[],this.options=t,this.periodMs=1e3/t.cadenceHz}start(){if(this.running)return;this.running=!0;let t=this.options.video;if(typeof t?.requestVideoFrameCallback=="function"){let e=o(()=>{this.running&&(this.frameCallbackId=t.requestVideoFrameCallback?.(()=>{this.frameCallbackId=null,this.now()-this.lastRunAt>=this.periodMs&&this.tick(),e()}))},"t");e();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 t=this.durations.length===0?0:this.durations.reduce((e,r)=>e+r,0)/this.durations.length;return{degradeCount:this.degradeCount,meanDetectMs:t}}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 t=this.now();this.options.run().catch(()=>{}).finally(()=>{this.busy=!1,this.durations.push(this.now()-t),this.durations.length>20&&this.durations.shift()})}},o(B,"O"),B),Qe=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}),F=o(i=>Math.min(1,Math.max(0,i)),"_"),W,Jt=(W=class{constructor(t={}){this.p=0,this.lastTickAt=null,this.lastCenter=null,this.velocityEma=0,this.qWindow=[],this.lastSizeDirection="ideal",this.t={...Qe,...t}}reset(){this.p=0,this.lastTickAt=null,this.lastCenter=null,this.velocityEma=0,this.qWindow=[],this.lastSizeDirection="ideal"}tick(t){let{observation:e,quality:r,timestampMs:s}=t,a=this.lastTickAt===null?0:Math.max(0,(s-this.lastTickAt)/1e3);this.lastTickAt=s;let n={presence:0,single:1,centering:0,size:0,pose:0,sharpness:F(r.sharpness),exposure:F(r.exposure),motion:1};if(e!==null){n.presence=1,n.single=(e.extraFaces??0)>0?0:1;let d=this.geometryOf(e,t);n.centering=d.centering,n.size=d.size,n.pose=d.pose,n.motion=this.motionOf(d.center,d.iod,s)}else this.lastCenter=null,this.velocityEma=0;let l=Math.min(n.presence,n.single,n.centering,n.size,n.pose,n.sharpness,n.exposure,n.motion);this.p=F(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:n,guidanceKey:this.guidanceOf(n,r,l),ready:h,accepted:l>=this.t.Q_GOOD}}geometryOf(t,e){let{box:r,eyes:s}=t,a={x:e.frameWidth/2,y:e.frameHeight/2},n=Math.min(e.frameWidth,e.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-F(h/(this.t.CENTER_FALLOFF_IOD_MULTIPLE*c)),u=n>0?c/n:0;this.lastSizeDirection=u<this.t.SIZE_IDEAL_MIN?"far":u>this.t.SIZE_IDEAL_MAX?"close":"ideal";let 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-F(m/this.t.ROLL_MAX_DEG)}return{center:l,iod:c,centering:d,size:v,pose:w}}motionOf(t,e,r){let s=this.lastCenter;if(this.lastCenter={...t,at:r},s===null||e<=0)return 1;let a=(r-s.at)/1e3;if(a<=0)return 1;let n=Math.hypot(t.x-s.x,t.y-s.y)/e/a;n<=this.t.MOTION_DEADBAND_IOD_PER_S&&(n=0);let l=1-Math.exp(-a/this.t.MOTION_TAU_S);return this.velocityEma=l*n+(1-l)*this.velocityEma,1-F(this.velocityEma/this.t.MOTION_VELOCITY_IOD_PER_S)}guidanceOf(t,e,r){if(t.presence<=0)return"fcv3.no_face";if(t.single<=0)return"fcv3.one_face";if(t.size<this.t.GUIDE_SIZE)return this.sizeGuidance();if(t.centering<this.t.GUIDE_CENTERING)return"fcv3.center_face";if(t.pose<this.t.GUIDE_POSE)return"fcv3.straighten";if(t.exposure<this.t.GUIDE_EXPOSURE)return this.exposureGuidance(e);if(t.sharpness<this.t.GUIDE_SHARPNESS)return"fcv3.steady_camera";if(t.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(e)],["sharpness","fcv3.steady_camera"],["motion","fcv3.hold_still"]],a=s[0];for(let n of s)t[n[0]]<t[a[0]]&&(a=n);return a[1]}return"fcv3.hold_still"}sizeGuidance(){return this.lastSizeDirection==="far"?"fcv3.come_closer":"fcv3.move_back"}exposureGuidance(t){let e=(it[0]+it[1])/2;return t.meanLuma<e?"fcv3.more_light":"fcv3.too_bright"}},o(W,"k"),W),Je=["single","size","centering","pose","exposure","sharpness","motion"];function ti(i){if(i.accepted)return null;if(i.factors.presence<=0)return"no_face";let t="single";for(let e of Je)i.factors[e]<i.factors[t]&&(t=e);return t}o(ti,"Ze");var q,te=(q=class{constructor(){this.blocked={},this.acceptedMs=0,this.ticks=0,this.lastAt=null}record(t){let e=this.lastAt===null?0:Math.max(0,t.at-this.lastAt);this.lastAt=t.at,this.ticks+=1;let r=ti(t);if(r===null){this.acceptedMs+=e;return}let s=this.blocked[r]??{count:0,ms:0};s.count+=1,s.ms+=e,this.blocked[r]=s}summary(){let t={};for(let[e,r]of Object.entries(this.blocked))t[e]={count:r.count,ms:Math.round(r.ms)};return{blocked:t,acceptedMs:Math.round(this.acceptedMs),ticks:this.ticks}}},o(q,"w"),q),ei=["obs","manycam","virtual","snap camera","xsplit","droidcam","iriun","camo"],ii=[/^(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 ri(i){let t=(i??"").trim().toLowerCase();return t.length===0?"unknown":ei.some(e=>t.includes(e))?"known_virtual":ii.some(e=>e.test(t))?"platform":"unknown"}o(ri,"je");function ee(i){if(typeof i!="function")return!1;try{return/\{\s*\[native code\]\s*\}\s*$/.test(Function.prototype.toString.call(i))}catch{return!1}}o(ee,"Te");function si(i=globalThis){return ee(i.navigator?.mediaDevices?.getUserMedia)&&ee(i.MediaStreamTrack?.prototype?.getSettings)}o(si,"$e");async function ai(i,t=globalThis){let e=t.crypto?.subtle?.digest;if(typeof e=="function")try{let r=new Uint8Array(await e.call(t.crypto?.subtle,"SHA-256",new TextEncoder().encode(i)));return Array.from(r.subarray(0,8),s=>s.toString(16).padStart(2,"0")).join("")}catch{return}}o(ai,"Je");async function ni(i,t=globalThis){let e={};try{e=typeof i.getSettings=="function"?i.getSettings()??{}:{}}catch{e={}}let r={};if((e.facingMode==="user"||e.facingMode==="environment"||e.facingMode==="left"||e.facingMode==="right")&&(r.facingMode=e.facingMode),typeof e.frameRate=="number"&&Number.isFinite(e.frameRate)&&(r.frameRate=e.frameRate),typeof e.width=="number"&&Number.isFinite(e.width)&&(r.width=e.width),typeof e.height=="number"&&Number.isFinite(e.height)&&(r.height=e.height),typeof e.deviceId=="string"&&e.deviceId.length>0){let a=await ai(e.deviceId,t);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:ri(s),prototypesIntact:si(t)}}o(ni,"Ce");var ot=o(i=>Math.round(i*100)/100,"H");function oi(i){let t=i,e=typeof t?.requestVideoFrameCallback=="function",r=null,s=null,a=0,n=0,l=0,c=0,h=0,d=0,u=o(()=>{!e||t?.requestVideoFrameCallback===void 0||(r=t.requestVideoFrameCallback((v,w)=>{if(r=null,!e)return;let m=w.presentationTime;if(s!==null){let g=m-s.presentationTimeMs;n+=1;let y=g-l;l+=y/n,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:o(()=>s,"latest"),stats:o(()=>({n:a,meanGapMs:n===0?0:ot(l),stdGapMs:n<2?0:ot(Math.sqrt(c/(n-1))),captureLatencyMs:d===0?null:ot(h/d)}),"stats"),stop:o(()=>{e&&(e=!1,r!==null&&t?.cancelVideoFrameCallback?.(r),r=null)},"stop")}}o(oi,"Ee");function li(i,t,e){return{...i,rvfc:t,rampPainter:e}}o(li,"_e");var ci=1e3,lt="fcv3.hold_upright",hi=200,ct=4,ui=600,di=1e3,ie={sharpness:1,exposure:1,meanLuma:128};function fi(i,t){return t.width=i.videoWidth,t.height=i.videoHeight,t.getContext("2d").drawImage(i,0,0),new Promise((e,r)=>t.toBlob(s=>s?e(s):r(new Error("empty-keyframe")),"image/jpeg",.92))}o(fi,"it");function mi(){return V()==="phone"}o(mi,"at");var z,le=(z=class{constructor(t){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=t,this.facing=t.facingMode??"user"}get state(){return this.stateValue}on(t,e){let r=this.handlers.get(t);return r||(r=new Set,this.handlers.set(t,r)),r.add(e),()=>r?.delete(e)}emit(t,e){for(let r of[...this.handlers.get(t)??[]])r(e)}async start(t={}){t.facingMode!==void 0&&(this.facing=t.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(t){this.facing=t,this.teardownAttempt(),this.start()}destroy(){this.attempt+=1,this.teardownAttempt(),this.detector?.destroy(),this.detector=null,this.options.video.srcObject=null}async run(t){let{options:e}=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=(e.isPhone??mi)(),this.setState("preflight");let r=Ct();if(r!=="OK"){this.fail(r==="INSECURE_CONTEXT"?"insecure":"unsupported",{phase:"preflight"});return}this.setState("acquiring");let s=e.getUserMedia??(h=>navigator.mediaDevices.getUserMedia(h)),a;this.cameraRequestedAt=this.now();try{let{facingMode:h,...d}=kt(Tt(),this.facing).video;a=await Lt(this.facing,d,{getUserMedia:s,enumerateDevices:vi(e)})}catch(h){if(t!==this.attempt)return;if(h instanceof Nt){this.fail("backcamera",{phase:"acquiring",name:K(h)});return}this.fail(Ut(h),{phase:"acquiring",name:K(h)});return}if(Et(a),Ft(a),t!==this.attempt){for(let h of a.getTracks())h.stop();return}this.stream=a;let n=a.getVideoTracks?.()[0];if(this.trackProvenance=n===void 0?null:ni(n).catch(()=>null),this.facing=_t(a)??this.facing,e.video.srcObject=a,await e.video.play().catch(()=>{}),t!==this.attempt)return;if(this.cameraReadyAt=this.now(),this.detector===null){let h={v3AssetBaseUrl:e.v3AssetBaseUrl},d=e.createDetector??(e.createWorker!==void 0&&Zt()?async()=>{try{return await jt.create(e.createWorker(),h)}catch{return x(h)}}:()=>x(h)),u;try{u=await d()}catch(v){t===this.attempt&&this.fail("models",{phase:"models",name:K(v)},v instanceof nt?v.fallbackReason:gi(v));return}if(t!==this.attempt){u.destroy();return}this.detector=u,this.options.telemetry?.({type:"detector",tier:u.tier,fallbackReason:u.fallbackReason})}let l=Bt(),c=e.deviceClass??Wt(l);this.profiler=new qt(c),this.options.telemetry?.({type:"profile",staticClass:c,activeClass:this.profiler.deviceClass,simd:l.simd}),this.gate=new Jt(e.thresholds??{}),this.blockStats=new te,this.lastGateSnapshotAt=this.now(),e.rankKeyframes?.()&&import("./keyframe-rank-YAJLYJYF-WCA6RPMD.js").then(h=>ht=h,()=>{}),this.setState("positioning"),this.positioningStartedAt=this.now(),this.startScheduler(t)}get animations(){return this.profiler?.profile.animations??"full"}startScheduler(t){let e=this.profiler;if(e===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 Ye({cadenceHz:e.profile.cadenceHz,video:this.options.video,now:this.options.now,run:o(()=>this.detectTick(t),"run")});this.scheduler=r,r.start()}async detectTick(t){let{detector:e,gate:r,profiler:s}=this,a=this.options.video;if(t!==this.attempt||e===null||r===null||s===null||this.fired||a.videoWidth===0)return;if(this.isLandscape()){this.holdUpright(t);return}let n=s.deviceClass,l=this.now(),c=this.options.makeSnapshot?.(a,s.profile.inputWidth)??this.defaultSnapshot(a,s.profile.inputWidth),h=null;try{h=await e.detect(c,a.videoWidth,a.videoHeight)}catch{h=null}if(t!==this.attempt||this.fired)return;s.record(this.now()-l),s.deviceClass!==n&&this.startScheduler(t);let d=h===null?ie: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>=ci&&(this.lastGateSnapshotAt=u.at,this.reportGate(!1)),this.emit("checks",{engine:"v3",progress:u.p,q:u.q,factors:u.factors,attempt:t}),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(t))}async fire(t){let{options:e}=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]:[]];e.telemetry?.({type:"fired",timeToGateMs:this.now()-this.positioningStartedAt,degradeCount:this.carriedDegrade+s.degradeCount,meanDetectMs:a.length===0?0:a.reduce((k,b)=>k+b,0)/a.length});let n=e.mode??"clip",l=e.rankKeyframes?.()&&ht?ht.default(this,t).catch(()=>this.collectKeyframes(t)):this.collectKeyframes(t);if(n==="photo"){let k=this.watchRotation(t,null),b=await l;if(k(),t!==this.attempt)return;if(b===null){this.fail("generic",{phase:"keyframes"});return}let I=await this.provenance({n:0,meanGapMs:0,stdGapMs:0,captureLatencyMs:null},!1);if(t!==this.attempt)return;this.finishCapture({keyframe:b.blob,previewDataUrl:b.previewDataUrl,...I});return}this.setState("recording");let c=this.stream;if(c===null){this.fail("generic",{phase:"recording"});return}let h=e.screenRamp?.(),d=h!==void 0,u=null;l.then(k=>{u=k},()=>{});let v=o(()=>{t===this.attempt&&u!==null&&this.emit("frozen",{previewDataUrl:u.previewDataUrl})},"f"),w=Ze(h,ne),m=null,g,y=0;try{let k=this.recordTake(t,c,h,w,void 0).then(_=>_,_=>({failed:_})),[b,I]=await Promise.all([k,l]);if(g=I,t!==this.attempt)return;if("failed"in b){if(b.failed.kind==="cliptoolarge")throw b.failed;$t(b.failed.requestedMimeType??"")}else m=b,Qt(b.clip,w)?b.clip.stats===null&&$t(b.clip.requestedMimeType??""):v();if(m===null||Qt(m.clip,w)){y=1,e.telemetry?.({type:"clip_retake",reason:m===null?"error":m.clip.stats===null?"unreadable":"short"});let _=null;try{_=await this.recordTake(t,c,h,w,v)}catch(H){if(m===null)throw H}if(t!==this.attempt)return;_!==null&&(m===null||We(_.clip,m.clip))&&(m=_),_===null&&v()}}catch(k){if(t!==this.attempt)return;let b=k.kind;this.fail(b==="cliptoolarge"?"cliptoolarge":"recorder",{phase:"recording",name:K(k)});return}if(m===null){this.fail("recorder",{phase:"recording"});return}let{clip:p,rvfc:M,report:T}=m;if(et(p.blob)){this.fail("cliptoolarge",{phase:"recording"});return}if(g===null){this.fail("generic",{phase:"keyframes"});return}let A=await this.provenance(M,d);t===this.attempt&&this.finishCapture({clip:p.blob,clipMimeType:p.mimeType,...p.stats?{clipStats:p.stats}:{},clipRetakes:y,keyframe:g.blob,previewDataUrl:g.previewDataUrl,...T!==void 0&&T.rendered.length>0?{screenRamp:T}:{},...A})}async recordTake(t,e,r,s,a){let n=this.options.createRecorder?.()??new qe({now:o(()=>this.now(),"now")}),l=oi(this.options.video),c=je(r,{paint:o(u=>{(u===null||t===this.attempt)&&this.emit("ramp",{colour:u})},"paint"),now:o(()=>this.now(),"now"),frames:l.latest});this.ramp=c;let h=o(()=>{l.stop(),c.stop(),this.ramp===c&&(this.ramp=null)},"l"),d=this.watchRotation(t,n);try{return{clip:await n.record(e,a,()=>c.started(this.now()),s,l),rvfc:l.stats(),report:c.report()}}finally{d(),h()}}async provenance(t,e){let r=this.trackProvenance;if(r===null)return{};let s,a=new Promise(l=>{s=setTimeout(()=>l(null),di)}),n=await Promise.race([r,a]);return clearTimeout(s),n===null?{}:{provenance:li(n,t,e)}}isLandscape(){let t=this.options.video;return this.uprightGuard&&t.videoWidth>t.videoHeight}holdUpright(t){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:t}),this.lastGuidanceKey!==lt&&(this.lastGuidanceKey=lt,this.emit("guidance",{key:lt}))}watchRotation(t,e){if(!this.uprightGuard)return()=>{};let r=this.options.video,s=o(()=>{if(t!==this.attempt||e!==null&&this.stateValue!=="recording"){l();return}r.videoWidth>0&&this.isLandscape()&&(l(),this.abortRecording(t,e))},"n"),a=setInterval(s,hi);r.addEventListener?.("resize",s);let n=!1;function l(){n||(n=!0,clearInterval(a),r.removeEventListener?.("resize",s))}return o(l,"o"),l}abortRecording(t,e){if(t!==this.attempt)return;this.attempt+=1;let r=this.attempt;try{e?.stop()}catch{}this.ramp?.stop(),this.ramp=null,this.fired=!1,this.captureCompleteAt=null,this.gate=new Jt(this.options.thresholds??{}),this.blockStats=new te,this.lastGateSnapshotAt=this.now(),this.lastGuidanceKey=null,this.setState("positioning"),this.positioningStartedAt=this.now(),this.holdUpright(r),this.startScheduler(r)}async collectKeyframes(t){let e=this.options.captureKeyframe??(a=>this.defaultKeyframe(a)),r=ui/(ct-1),s=null;for(let a=0;a<ct;a+=1){if(t!==this.attempt)return s;try{let n=await e(this.options.video);(s===null||n.sharpness>s.sharpness)&&(s=n)}catch{}a<ct-1&&await pi(r)}return s}finishCapture(t){this.stopTracks(),this.setState("captured");let e=this.captureTiming();this.emit("artifacts",e===void 0?t:{...t,timing:e})}captureTiming(){let t={},e=o((r,s,a)=>{s!==null&&a!==null&&(t[r]=Math.max(0,Math.round(a-s)))},"t");return e("cameraReadyMs",this.cameraRequestedAt,this.cameraReadyAt),e("faceAcquireMs",this.cameraReadyAt,this.faceAcquiredAt),e("captureMs",this.faceAcquiredAt,this.captureCompleteAt),Object.keys(t).length>0?t:void 0}async defaultKeyframe(t){let e=document.createElement("canvas"),r=await(this.facing==="user"?$e:fi)(t,e),s=e.toDataURL("image/jpeg",.92);return{blob:r,previewDataUrl:s,sharpness:this.centerSharpness(t)}}defaultSnapshot(t,e){try{let r=this.snapshotCanvas??document.createElement("canvas"),s=e/Math.max(1,t.videoWidth),a=Math.max(1,Math.round(t.videoWidth*s)),n=Math.max(1,Math.round(t.videoHeight*s)),l=r.getContext("2d");return l===null?t:(r.width!==a&&(r.width=a),r.height!==n&&(r.height=n),l.drawImage(t,0,0,a,n),this.snapshotCanvas=r,r)}catch{return t}}defaultQuality(t,e){let r=re(t,e,96);return r===null?ie:{sharpness:rt(r),exposure:Ht(r),meanLuma:zt(r)}}centerSharpness(t){let e=Z(t),r=re(t,{x:e.width*.25,y:e.height*.25,width:e.width*.5,height:e.height*.5},96);return r===null?0:rt(r)}teardownAttempt(){this.scheduler?.stop(),this.scheduler=null,this.reportGate(!0),this.gate=null,this.ramp?.stop(),this.ramp=null,this.stopTracks()}reportGate(t){let e=this.blockStats,r=this.profiler;if(e===null||r===null)return;let s=e.summary();t&&(this.blockStats=null),s.ticks!==0&&this.options.telemetry?.({type:"gate",final:t,activeClass:r.deviceClass,cadenceHz:r.profile.cadenceHz,...s})}stopTracks(){if(this.stream!==null){for(let t of this.stream.getTracks())t.stop();this.stream=null}}fail(t,e,r){this.scheduler?.stop(),this.reportGate(!0),this.stopTracks(),this.setState("error"),this.options.telemetry?.({type:"error",kind:t,fallbackReason:r});let{phase:s,name:a}=e;this.emit("error",{kind:t,retryable:t!=="insecure"&&t!=="unsupported",detail:a===void 0?{phase:s}:{phase:s,name:a}})}setState(t){this.stateValue=t,this.emit("statechange",{state:t})}now(){return this.options.now?.()??performance.now()}},o(z,"ke"),z),ht;function pi(i){return new Promise(t=>setTimeout(t,i))}o(pi,"st");function gi(i){return i instanceof Error?i.message:String(i)}o(gi,"ot");function re(i,t,e){try{let r=document.createElement("canvas"),s=e/Math.max(1,t.width);r.width=Math.max(1,Math.round(t.width*s)),r.height=Math.max(1,Math.round(t.height*s));let a=r.getContext("2d");return a===null?null:(a.drawImage(i,t.x,t.y,t.width,t.height,0,0,r.width,r.height),a.getImageData(0,0,r.width,r.height))}catch{return null}}o(re,"we");function vi(i){if(i.enumerateDevices!==void 0)return i.enumerateDevices;if(i.getUserMedia===void 0&&!(typeof navigator>"u"||typeof navigator.mediaDevices?.enumerateDevices!="function"))return()=>navigator.mediaDevices.enumerateDevices()}o(vi,"lt");var yi=12e4,ce=13e4,wi=3e3,bi=1200,ut=Symbol.for("@sekyro/web.preload.v1");function ft(){let i=globalThis;return i[ut]??(i[ut]=new Map),i[ut]}o(ft,"g");function Y(i){let t=(i??at).replace(/\/+$/,"");return t===""?"/":t}o(Y,"S");function ue(i){let t=ft(),e=t.get(i);return e===void 0&&(e={status:"idle",promise:null,scheduled:null,detectorPromise:null,detector:null,listeners:new Set},t.set(i,e)),e}o(ue,"se");function dt(i,t){if(i.status!==t){i.status=t;for(let e of[...i.listeners])e(t)}}o(dt,"A");var Mi=o(i=>x({preferred:["blaze"],v3AssetBaseUrl:i,blazeInitTimeoutMs:yi}),"x"),ki=Mi;function Ti(){return typeof window<"u"&&typeof navigator<"u"&&typeof navigator.mediaDevices?.getUserMedia=="function"}o(Ti,"pe");function _i(){return navigator.connection?.saveData===!0}o(_i,"me");function Ei(i){let t=window;if(typeof t.requestIdleCallback=="function"){let r=t.requestIdleCallback(i,{timeout:wi});return()=>t.cancelIdleCallback?.(r)}let e=setTimeout(i,bi);return()=>clearTimeout(e)}o(Ei,"ve");function Si(i,t){let e,r=new Promise(l=>{e=l}),s=!1,a=o(()=>{},"d"),n={promise:r,settle:o(l=>{s||(s=!0,a(),i.scheduled===n&&(i.scheduled=null),e(l))},"settle")};return i.scheduled=n,a=Ei(()=>{s||n.settle(mt(i,t))}),r}o(Si,"ge");function mt(i,t){if((i.status==="loading"||i.status==="ready")&&i.promise!==null)return i.promise;dt(i,"loading");let e=new Promise(n=>n(ki(t)));i.detectorPromise=e;let r,s=new Promise((n,l)=>{r=setTimeout(()=>{e.then(c=>c.destroy(),()=>{}),l(new Error(`detector preload exceeded ${ce} ms`))},ce)}),a=Promise.race([e,s]).then(n=>i.detectorPromise!==e?(n.destroy(),i.status):(i.detector=n,dt(i,"ready"),"ready"),n=>(i.detectorPromise===e&&(i.detectorPromise=null,i.detector=null,dt(i,"failed"),console.warn("[@sekyro/web] face-detector preload failed:",n)),i.status)).finally(()=>clearTimeout(r));return i.promise=a,i.scheduled?.settle(a),a}o(mt,"I");function Yi(i={}){if(!Ti())return Promise.resolve("idle");let t=Y(i.assetBaseUrl),e=ue(t);return i.respectSaveData===!0&&_i()?Promise.resolve(e.status):(e.status==="loading"||e.status==="ready")&&e.promise!==null?e.promise:i.idle===!0?e.scheduled?.promise??Si(e,t):mt(e,t)}o(Yi,"we");function Qi(i){return ft().get(Y(i))?.status??"idle"}o(Qi,"ke");function Ji(i,t){let e=ue(Y(t));return e.listeners.add(i),()=>{e.listeners.delete(i)}}o(Ji,"De");function Ai(i){return{get tier(){return i.tier},get fallbackReason(){return i.fallbackReason},detect:o((...t)=>i.detect(...t),"detect"),destroy:o(()=>{},"destroy")}}o(Ai,"he");function Ii(i){let t=Y(i),e=ft().get(t);if(!(e===void 0||e.detector===null&&e.detectorPromise===null&&e.scheduled===null))return async()=>{e.scheduled!==null&&mt(e,t);let r=e.promise;for(;e.detector===null&&r!==null&&(await r,e.promise!==r);)r=e.promise;return e.detector!==null?Ai(e.detector):x({v3AssetBaseUrl:t})}}o(Ii,"oe");function xi(i){switch(i){case"fcv3.no_face":case"fcv3.center_face":case"fcv3.straighten":return"center";case"fcv3.come_closer":return"closer";case"fcv3.move_back":return"farther";case"fcv3.more_light":case"fcv3.too_bright":return"light";case"fcv3.hold_still":case"fcv3.steady_camera":return"still";case"fcv3.hold_upright":return"upright";case"fcv3.one_face":return"one_face";default:return null}}o(xi,"Ce");function Di(i){switch(i){case"preflight":case"acquiring":return"starting";case"positioning":return"gating";default:return i}}o(Di,"Se");function he(i){switch(i){case"permission":case"notfound":case"inuse":case"insecure":case"unsupported":return i;case"backcamera":return"notfound";default:{let t=i;return"generic"}}}o(he,"ie");function Ri(i,t,e){if(e===void 0)return{kind:he(i),retryable:t};let r=Gt(e.name);return{kind:he(i),retryable:t,detail:{...r!==void 0?{name:r}:{},phase:e.phase,engineKind:i}}}o(Ri,"Le");var Ci=new Set(["captured","uploading","checking"]);function Oi(i,t={},e,r=()=>"self",s=()=>{},a){let n=t.now??(()=>performance.now()),l=t.canChooseFacing??At,c="user",h=It(),d=r(),u=St(),v=!Ot(),w=t.engineOptions,m=w?.createDetector===void 0&&w?.createWorker===void 0?{createDetector:o(()=>{let f=Ii(i.assetBaseUrl);return f!==void 0?f():x({v3AssetBaseUrl:i.assetBaseUrl})},"createDetector")}:{},g={video:i.video,mode:v?"photo":"clip",rankKeyframes:e,facingMode:void 0,v3AssetBaseUrl:i.assetBaseUrl,screenRamp:o(()=>d==="self"&&u.count("ramp")>0?s():void 0,"screenRamp"),...t.engineOptions??{},...m},y=t.createEngine?.(g)??new le(g),p="idle",M=null,T=0,A=!1,k="full",b=null,I=null,_=0,H=0,pt=o(()=>{i.video.videoWidth>0&&i.video.videoHeight>0&&(_=i.video.videoWidth,H=i.video.videoHeight)},"K"),gt=xt({enabled:i.keepScreenAwake!==!1}),X=o(f=>{p=f,gt.setActive(f==="starting"||f==="gating"||f==="recording"),u.emit("state",f)},"M"),Q=o(()=>u.emit("gate",{progress:T,hint:M,faceDetected:A}),"R"),vt=o(()=>{let f=y.animations??"full";f!==k&&(k=f,u.emit("profile",{animations:k}))},"G"),de=[y.on("statechange",({state:f})=>{let E=Di(f);E==="starting"&&p!=="starting"&&(M=null,T=0,A=!1,b=null,I=null,_=0,H=0),X(E),vt(),E==="recording"&&(pt(),b=n(),M="hold",T=1,Q())}),y.on("checks",f=>{pt(),T=f.progress,A=f.factors.presence>0,Q(),vt()}),y.on("guidance",({key:f})=>{M=xi(f),Q()}),y.on("frozen",({previewDataUrl:f})=>{I=n(),u.emit("frozen",{previewDataUrl:f})}),y.on("ramp",f=>u.emit("ramp",f)),y.on("artifacts",f=>{if(p!=="captured")return;let E=V(),S=f.clipStats,bt=S!==void 0?Math.round(S.durationMs):b!==null&&I!==null?Math.max(0,Math.round(I-b)):void 0,Mt=S!==void 0&&S.frames>1&&S.durationMs>0?Math.round(S.frames*1e4/S.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||_,height:i.video.videoHeight||H,...bt!==void 0?{clipMs:bt}:{},...S!==void 0?{clipFrames:S.frames}:{},...Mt!==void 0?{fps:Mt}:{},...f.clipRetakes!==void 0?{clipRetakes:f.clipRetakes}:{},...f.clipMimeType!==void 0?{codec:ae(f.clipMimeType)}:{},captureChannel:E==="desktop"?"desktop":"mobile",formFactor:E,...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:E,detail:S})=>{f==="backcamera"&&fe()||u.emit("error",Ri(f,E,S))})],yt=!1;function fe(){return J||yt||d!=="assisted"||a===void 0||a.session()!=="choice"?!1:(yt=!0,a.onModeChange("self"),d="self",c=tt("self"),X("mode_switch"),y.restart(c),!0)}o(fe,"ce");let wt=o(async()=>a!==void 0&&a.session()==="choice"&&await l().catch(()=>!1),"W"),J=!1;return{handle:{get state(){return p},get captureMode(){return r()},get facingMode(){return y.facingMode??c},on:o((f,E)=>u.on(f,E),"on"),start:o(f=>(d=r(),h.facing(d,i.facing),c=h.facing(d,f?.facing),y.start({facingMode:c})),"start"),retry:o(()=>y.retry(),"retry"),switchCamera:o(()=>h.refuseSwitch(r()),"switchCamera"),canSwitchCaptureMode:wt,setCaptureMode:o(async f=>{if(f===r()||!await wt()||J||Ci.has(p)||a===void 0)return!1;a.onModeChange(f),d=f;let E=tt(f);return c=E,p==="idle"||(X("mode_switch"),y.restart(E)),!0},"setCaptureMode"),destroy:o(()=>{J=!0;for(let f of de)f();gt.setActive(!1),y.destroy(),u.clear()},"destroy")},setFlowState:o(f=>{p!==f&&X(f)},"setFlowState")}}o(Oi,"Ee");function tr(i){return Oi(i).handle}o(tr,"ze");export{zi as a,Yi as b,Qi as c,Ji as d,Ri as e,Oi as f,tr as g};
|
|
1
|
+
import{d as Et,e as Bt,f as Wt,g as qt}from"./chunk-434MMEWK.js";import{a as it,b as zt,c as rt,d as Ht}from"./chunk-P7K7ELYZ.js";import{a as kt,b as V,c as Tt,d as _t,e as St,g as At,h as tt,i as It,j as xt,k as Nt,l as Lt}from"./chunk-CW56KMMH.js";import{a as Dt,b as Rt,c as Ct,d as Ot,e as Pt,f as et,g as K,h as Gt,i as Ut,j as Ft}from"./chunk-JS2IXPNL.js";import{a as o}from"./chunk-4FHWXBOB.js";var me=1e4,C,pe=(C=class{constructor(t,e){this.tier="blaze",this.inner=t,e!==void 0&&(this.fallbackReason=e)}static async create(t,e){let r=await import("./vision_bundle-WBHR7TEE.js"),s=await r.FilesetResolver.forVisionTasks(t),a=await r.FaceDetector.createFromOptions(s,{baseOptions:{modelAssetPath:`${t}/blaze_face_short_range.tflite`,delegate:"CPU"},runningMode:"IMAGE"});return new C(a,e)}async detect(t,e,r){let s;try{s=this.inner.detect(t).detections}catch{return null}let a=ge(s);if(a?.boundingBox===void 0)return null;let n=Z(t),l=ve(a.keypoints,n),c=a.keypoints?.[2],h={box:{x:a.boundingBox.originX,y:a.boundingBox.originY,width:a.boundingBox.width,height:a.boundingBox.height},...l!==void 0?{eyes:l}:{},...c!==void 0?{nose:{x:c.x*n.width,y:c.y*n.height}}:{},score:a.categories[0]?.score??0,extraFaces:Kt(s.map(d=>d.boundingBox??{width:0,height:0}),s.indexOf(a))};return Xt(h,t,e,r)}destroy(){try{this.inner.close()}catch{}}},o(C,"t"),C);function ge(i){let t,e=-1;for(let r of i){let s=r.categories[0]?.score??0;s>e&&(t=r,e=s)}return t}o(ge,"R");function ve(i,t){let e=i?.[0],r=i?.[1];if(e===void 0||r===void 0)return;let s=o(l=>({x:l.x*t.width,y:l.y*t.height}),"n"),[a,n]=[s(e),s(r)];return a.x<=n.x?{left:a,right:n}:{left:n,right:a}}o(ve,"T");function ye(){if(typeof OffscreenCanvas=="function")return new OffscreenCanvas(2,2);let i=document.createElement("canvas");return i.width=2,i.height=2,i}o(ye,"E");var we=4;async function be(){let i=globalThis.FaceDetector;if(typeof i!="function")return{ok:!1,reason:"unsupported"};try{let t=new i({fastMode:!0,maxDetectedFaces:we});return await t.detect(ye()),{ok:!0,instance:t}}catch(t){return{ok:!1,reason:`smoke_failed:${t instanceof Error?t.message:String(t)}`}}}o(be,"w");var P,Me=(P=class{constructor(t,e){this.tier="native",this.inner=t,e!==void 0&&(this.fallbackReason=e)}async detect(t,e,r){let s;try{s=await this.inner.detect(t)}catch{return null}let a=s.map(d=>d.boundingBox),n=-1;a.forEach((d,u)=>{let v=a[n];(v===void 0||d.width*d.height>v.width*v.height)&&(n=u)});let l=s[n];if(l===void 0)return null;let c=ke(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:Kt(a,n)};return Xt(h,t,e,r)}destroy(){}},o(P,"b"),P);function ke(i){if(i===void 0)return;let t=i.filter(s=>s.type==="eye").map(s=>s.locations[0]).filter(s=>s!==void 0),[e,r]=t;if(!(e===void 0||r===void 0))return e.x<=r.x?{left:e,right:r}:{left:r,right:e}}o(ke,"S");var Te=.25;function Kt(i,t){let e=i[t],r=e===void 0?0:e.width*e.height;if(!(r>0))return 0;let s=0;return i.forEach((a,n)=>{n!==t&&a.width*a.height>=Te*r&&(s+=1)}),s}o(Kt,"f");var at="/models-v3",_e=["native","blaze"],G,nt=(G=class extends Error{constructor(t){super(`no detector tier available (${t})`),this.name="DetectorLadderError",this.fallbackReason=t}},o(G,"x"),G);function Z(i){let t=i;if(typeof t.videoWidth=="number"&&t.videoWidth>0)return{width:t.videoWidth,height:t.videoHeight??0};if(typeof t.naturalWidth=="number"&&t.naturalWidth>0)return{width:t.naturalWidth,height:t.naturalHeight??0};let e=typeof t.width=="number"?t.width:0,r=typeof t.height=="number"?t.height:0;return{width:e,height:r}}o(Z,"y");function Xt(i,t,e,r){let s=Z(t),a=s.width>0?e/s.width:1,n=s.height>0?r/s.height:1,l=o(c=>({x:c.x*a,y:c.y*n}),"s");return{box:{x:i.box.x*a,y:i.box.y*n,width:i.box.width*a,height:i.box.height*n},...i.eyes!==void 0?{eyes:{left:l(i.eyes.left),right:l(i.eyes.right)}}:{},...i.nose!==void 0?{nose:l(i.nose)}:{},score:i.score,...i.extraFaces!==void 0?{extraFaces:i.extraFaces}:{}}}o(Xt,"h");function Ee(i){return i instanceof Error?i.message:String(i)}o(Ee,"C");async function x(i){let t=i.preferred??_e,e=[];for(let r of t){if(r==="native"){let s=await be();if(s.ok)return new Me(s.instance,st(e));e.push(`native:${s.reason}`);continue}try{return await Se(pe.create(i.v3AssetBaseUrl??at,st(e)),i.blazeInitTimeoutMs??me)}catch(s){e.push(s instanceof Vt?"blaze:blaze_init_timeout":`blaze:${Ee(s)}`)}}throw new nt(st(e)??"no_tier_available")}o(x,"O");function st(i){return i.length>0?i.join("; "):void 0}o(st,"v");var U,Vt=(U=class extends Error{},o(U,"g"),U);function Se(i,t){return new Promise((e,r)=>{let s=setTimeout(()=>{r(new Vt(`init exceeded ${t}ms`)),i.then(a=>a.destroy(),()=>{})},t);i.then(a=>{clearTimeout(s),e(a)},a=>{clearTimeout(s),r(a)})})}o(Se,"W");var R=1;function Zt(){return typeof OffscreenCanvas=="function"&&typeof createImageBitmap=="function"&&typeof Worker=="function"}o(Zt,"K");function Ae(i,t={}){let e=t.createDetector??x,r=null;i.onmessage=s=>{let a=s.data;if(a.v!==R){a.bitmap?.close?.();return}if(a.type==="init"){e(a.options).then(n=>{r=n;let l={v:R,type:"ready",tier:n.tier,...n.fallbackReason!==void 0?{fallbackReason:n.fallbackReason}:{}};i.postMessage(l)});return}if(a.type==="detect"){let n=o(l=>{let c={v:R,type:"result",id:a.id,observation:l};i.postMessage(c),a.bitmap.close?.()},"a");if(r===null){n(null);return}r.detect(a.bitmap,a.streamWidth,a.streamHeight).then(n,()=>n(null))}}}o(Ae,"B");typeof self<"u"&&typeof self.importScripts=="function"&&Ae(self);var O,jt=(O=class{constructor(t,e){this.pending=new Map,this.nextId=1,this.worker=t,this.tier=e.tier,e.fallbackReason!==void 0&&(this.fallbackReason=e.fallbackReason),t.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(t,e,r=1e4){return new Promise((s,a)=>{let n=setTimeout(()=>{t.removeEventListener("message",l),t.terminate(),a(new Error(`worker detector not ready within ${r}ms`))},r),l=o(h=>{let d=h.data;d.v!==R||d.type!=="ready"||(clearTimeout(n),t.removeEventListener("message",l),s(new O(t,d)))},"s");t.addEventListener("message",l);let c={v:R,type:"init",options:e};t.postMessage(c)})}async detect(t,e,r){let s;try{typeof ImageBitmap<"u"&&t instanceof ImageBitmap?s=t:typeof createImageBitmap=="function"?s=await createImageBitmap(t):s=t}catch{return null}let a=this.nextId;return this.nextId+=1,new Promise(n=>{this.pending.set(a,n);let l={v:R,type:"detect",id:a,bitmap:s,streamWidth:e,streamHeight:r};this.worker.postMessage(l,[s])})}destroy(){for(let t of this.pending.values())t(null);this.pending.clear(),this.worker.terminate()}},o(O,"t"),O);var Ie=[...Dt.filter(i=>i.startsWith("video/mp4")),"video/webm;codecs=h264","video/webm;codecs=avc1","video/webm;codecs=vp8","video/webm;codecs=vp9","video/webm"],se=new Set;function xe(i){let t=/(?:Chrome|Chromium)\/(\d+)\./.exec(i??"");return t?Number(t[1]):null}o(xe,"De");function De(i=Ce(),t=globalThis.navigator?.userAgent){if(i===void 0)return"";let e=xe(t)===126;for(let r of Ie)if(!(se.has(r)||e&&r.startsWith("video/mp4")))try{if(i(r))return r}catch{}return""}o(De,"he");function $t(i){i!==""&&se.add(i)}o($t,"F");function Re(i){return i.replace(/^video\/x-matroska/i,"video/webm")}o(Re,"fe");function ae(i){let t=/codecs=["']?([^,;"']+)/i.exec(i);return t?t[1].trim():i.split(";")[0].trim()}o(ae,"ut");function Ce(){let i=globalThis.MediaRecorder;return i&&typeof i.isTypeSupported=="function"?t=>i.isTypeSupported(t):void 0}o(Ce,"Oe");var ne=2500,Oe=1e3,Pe=1500,Yt=25e5,Ge=100,Ue=700,Fe=20,Ne=1500,j=null;function Le(){return j??(j=import("./clip-inspect-DLJXVKV6-TNHTD4LV.js").catch(i=>{throw j=null,i})),j.catch(()=>null)}o(Le,"Ne");var N,D=(N=class extends Error{constructor(t,e){super(e??t),this.kind=t}},o(N,"S"),N),Be=100;function Qt(i,t){return i.stats===void 0?!1:i.stats===null?!0:i.stats.durationMs<t-Be}o(Qt,"U");function We(i,t){return i.stats?t.stats?i.stats.durationMs>t.stats.durationMs:!0:!1}o(We,"ge");var L,qe=(L=class{constructor(t={}){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=t.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(t,e,r,s=ne,a){let n=De(),l=Le();return this.recordRaw(t,e,r,s,a,n).then(c=>ze(c,l),c=>{throw c instanceof D&&(c.requestedMimeType=n),c})}recordRaw(t,e,r,s,a,n){return this.recorder&&!this.settled?Promise.reject(new D("generic","record() called while a recording is in flight — ClipRecorder handles one recording at a time")):(this.recorder=null,this.clearTimers(),this.chunks=[],this.bytes=0,this.settled=!1,this.stream=t,new Promise((l,c)=>{let h;try{h=new MediaRecorder(t,n?{mimeType:n,videoBitsPerSecond:Yt}:{videoBitsPerSecond:Yt})}catch{try{h=new MediaRecorder(t)}catch{c(new D("unsupported"));return}}this.recorder=h;let d=o(p=>{this.settled||(this.settled=!0,this.clearTimers(),p())},"d"),u=o(()=>d(()=>{let p=Re(h.mimeType||n||Rt),M=new Blob(this.chunks,{type:p});if(M.size===0){c(new D("generic","empty clip"));return}if(et(M)){c(new D("cliptoolarge"));return}l({blob:M,mimeType:p,requestedMimeType:n})}),"u");h.ondataavailable=p=>{p.data&&p.data.size&&(this.chunks.push(p.data),this.bytes+=p.data.size,this.bytes>Pt&&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(Oe)}catch{d(()=>c(new D("generic")));return}let w=o(()=>{if(this.pollTimer&&clearInterval(this.pollTimer),this.pollTimer=null,this.hardStopTimer&&clearTimeout(this.hardStopTimer),this.hardStopTimer=null,this.settled||e?.(),h.state!=="inactive"){try{h.stop()}catch{u()}this.graceTimer=setTimeout(u,Pe)}else u()},"v"),m=this.now();if(a===void 0){this.hardStopTimer=setTimeout(w,s);return}let g=null,y=!1;this.hardStopTimer=setTimeout(w,s+Ue),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 T=g!==null&&M!==void 0&&M-g>=s,A=g===null&&this.now()-m>=s;if(!(!T&&!A)){if(y=!0,this.pollTimer&&clearInterval(this.pollTimer),this.pollTimer=null,A){w();return}this.hardStopTimer&&clearTimeout(this.hardStopTimer),this.hardStopTimer=setTimeout(w,Ge)}},Fe)}))}stop(t){this.clearTimers();let e=this.recorder;if(e&&e.state!=="inactive")try{e.stop()}catch{}this.recorder=null,(t??this.stream)?.getTracks().forEach(r=>r.stop()),this.stream=null}},o(L,"I"),L);async function ze(i,t){let e,r=new Promise(h=>{e=setTimeout(()=>h(null),Ne)}),s=await Promise.race([t,r]);if(clearTimeout(e),s===null)return i;let a;try{a=await s.blobBytes(i.blob)}catch{return{...i,stats:null}}let n=s.inspectClipBytes(a);if(n?.container!=="webm")return{...i,stats:n};let l=s.withWebmDuration(a,n.durationMs);if(l===null)return{...i,stats:n};let c=s.inspectClipBytes(l);return c===null||c.frames!==n.frames||c.durationMs!==n.durationMs?{...i,stats:n}:{...i,blob:new Blob([l],{type:i.blob.type}),stats:n}}o(ze,"He");var He=["magenta","yellow","green","blue"],Ke={magenta:"rgb(255, 72, 150)",yellow:"rgb(255, 190, 0)",green:"rgb(0, 238, 175)",blue:"rgb(25, 150, 255)",dark:"rgb(0, 0, 0)"};function zi(i){return Ke[i]}o(zi,"ft");var Xe=4,Ve=4,$=o(i=>typeof i=="number"&&Number.isFinite(i),"D");function oe(i){if(typeof i!="object"||i===null)return!1;let t=i;if(typeof t.nonce!="string"||t.nonce.length===0||!Array.isArray(t.colours)||t.colours.length<1||t.colours.length>8||!t.colours.every(r=>He.includes(r))||!Array.isArray(t.onsetsMs)||t.onsetsMs.length!==t.colours.length)return!1;let e=-1;for(let r of t.onsetsMs){if(!$(r)||r<0||r<=e)return!1;e=r}return!(!$(t.holdMs)||t.holdMs<=0||!$(t.endMs)||t.endMs<=e||!$(t.clipMs)||t.clipMs<t.endMs||t.clipMs>8e3)}o(oe,"be");function Ze(i,t){return oe(i)?Math.max(t,Math.ceil(i.clipMs)):t}o(Ze,"ye");function je(i,t){let e=t.now??(()=>performance.now()),r=oe(i)?i:void 0,s=[],a=null,n=null,l=null,c=!1,h=null,d=o(m=>{h=m;try{t.paint(m)}catch{}},"d"),u=o(m=>{let g=t.frames?.()??null;return g!==null&&l!==null?g.mediaTimeMs+(m-g.presentationTimeMs)-l:m-(n??m)},"u"),v=o((m,g,y=0)=>{if(c)return;let p=Math.max(0,m-u(e()));a=setTimeout(()=>{if(a=null,!c){if(y<Xe&&u(e())<m-Ve){v(m,g,y+1);return}g()}},p)},"f"),w=o(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(e());if(M>g){h!==null&&d(null);return}let T=r.colours[m];d(T);let A=s.length===0?0:s[s.length-1].tMs;s.push({tMs:Math.max(A,Math.round(M)),colour:T});let k=y+r.holdMs;if(k<p){v(k,()=>{if(u(e())>g){h!==null&&d(null);return}d("dark"),w(m+1)});return}w(m+1)})},"v");return{started(m){if(r===void 0||c||n!==null)return;n=m;let g=t.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]}}}}o(je,"Me");function $e(i,t,e=.92){return new Promise((r,s)=>{let a=i.videoWidth,n=i.videoHeight;if(!a||!n){s(new Error("video-not-ready"));return}let l=t.getContext("2d");if(!l){s(new Error("no-2d-context"));return}t.width=a,t.height=n,l.scale(-1,1),l.drawImage(i,-a,0),t.toBlob(c=>c?r(c):s(new Error("empty-keyframe")),"image/jpeg",e)})}o($e,"Se");var B,Ye=(B=class{constructor(t){this.timer=null,this.frameCallbackId=null,this.running=!1,this.busy=!1,this.lastRunAt=Number.NEGATIVE_INFINITY,this.degradeCount=0,this.durations=[],this.options=t,this.periodMs=1e3/t.cadenceHz}start(){if(this.running)return;this.running=!0;let t=this.options.video;if(typeof t?.requestVideoFrameCallback=="function"){let e=o(()=>{this.running&&(this.frameCallbackId=t.requestVideoFrameCallback?.(()=>{this.frameCallbackId=null,this.now()-this.lastRunAt>=this.periodMs&&this.tick(),e()}))},"t");e();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 t=this.durations.length===0?0:this.durations.reduce((e,r)=>e+r,0)/this.durations.length;return{degradeCount:this.degradeCount,meanDetectMs:t}}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 t=this.now();this.options.run().catch(()=>{}).finally(()=>{this.busy=!1,this.durations.push(this.now()-t),this.durations.length>20&&this.durations.shift()})}},o(B,"O"),B),Qe=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}),F=o(i=>Math.min(1,Math.max(0,i)),"_"),W,Jt=(W=class{constructor(t={}){this.p=0,this.lastTickAt=null,this.lastCenter=null,this.velocityEma=0,this.qWindow=[],this.lastSizeDirection="ideal",this.t={...Qe,...t}}reset(){this.p=0,this.lastTickAt=null,this.lastCenter=null,this.velocityEma=0,this.qWindow=[],this.lastSizeDirection="ideal"}tick(t){let{observation:e,quality:r,timestampMs:s}=t,a=this.lastTickAt===null?0:Math.max(0,(s-this.lastTickAt)/1e3);this.lastTickAt=s;let n={presence:0,single:1,centering:0,size:0,pose:0,sharpness:F(r.sharpness),exposure:F(r.exposure),motion:1};if(e!==null){n.presence=1,n.single=(e.extraFaces??0)>0?0:1;let d=this.geometryOf(e,t);n.centering=d.centering,n.size=d.size,n.pose=d.pose,n.motion=this.motionOf(d.center,d.iod,s)}else this.lastCenter=null,this.velocityEma=0;let l=Math.min(n.presence,n.single,n.centering,n.size,n.pose,n.sharpness,n.exposure,n.motion);this.p=F(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:n,guidanceKey:this.guidanceOf(n,r,l),ready:h,accepted:l>=this.t.Q_GOOD}}geometryOf(t,e){let{box:r,eyes:s}=t,a={x:e.frameWidth/2,y:e.frameHeight/2},n=Math.min(e.frameWidth,e.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-F(h/(this.t.CENTER_FALLOFF_IOD_MULTIPLE*c)),u=n>0?c/n:0;this.lastSizeDirection=u<this.t.SIZE_IDEAL_MIN?"far":u>this.t.SIZE_IDEAL_MAX?"close":"ideal";let 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-F(m/this.t.ROLL_MAX_DEG)}return{center:l,iod:c,centering:d,size:v,pose:w}}motionOf(t,e,r){let s=this.lastCenter;if(this.lastCenter={...t,at:r},s===null||e<=0)return 1;let a=(r-s.at)/1e3;if(a<=0)return 1;let n=Math.hypot(t.x-s.x,t.y-s.y)/e/a;n<=this.t.MOTION_DEADBAND_IOD_PER_S&&(n=0);let l=1-Math.exp(-a/this.t.MOTION_TAU_S);return this.velocityEma=l*n+(1-l)*this.velocityEma,1-F(this.velocityEma/this.t.MOTION_VELOCITY_IOD_PER_S)}guidanceOf(t,e,r){if(t.presence<=0)return"fcv3.no_face";if(t.single<=0)return"fcv3.one_face";if(t.size<this.t.GUIDE_SIZE)return this.sizeGuidance();if(t.centering<this.t.GUIDE_CENTERING)return"fcv3.center_face";if(t.pose<this.t.GUIDE_POSE)return"fcv3.straighten";if(t.exposure<this.t.GUIDE_EXPOSURE)return this.exposureGuidance(e);if(t.sharpness<this.t.GUIDE_SHARPNESS)return"fcv3.steady_camera";if(t.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(e)],["sharpness","fcv3.steady_camera"],["motion","fcv3.hold_still"]],a=s[0];for(let n of s)t[n[0]]<t[a[0]]&&(a=n);return a[1]}return"fcv3.hold_still"}sizeGuidance(){return this.lastSizeDirection==="far"?"fcv3.come_closer":"fcv3.move_back"}exposureGuidance(t){let e=(it[0]+it[1])/2;return t.meanLuma<e?"fcv3.more_light":"fcv3.too_bright"}},o(W,"k"),W),Je=["single","size","centering","pose","exposure","sharpness","motion"];function ti(i){if(i.accepted)return null;if(i.factors.presence<=0)return"no_face";let t="single";for(let e of Je)i.factors[e]<i.factors[t]&&(t=e);return t}o(ti,"Ze");var q,te=(q=class{constructor(){this.blocked={},this.acceptedMs=0,this.ticks=0,this.lastAt=null}record(t){let e=this.lastAt===null?0:Math.max(0,t.at-this.lastAt);this.lastAt=t.at,this.ticks+=1;let r=ti(t);if(r===null){this.acceptedMs+=e;return}let s=this.blocked[r]??{count:0,ms:0};s.count+=1,s.ms+=e,this.blocked[r]=s}summary(){let t={};for(let[e,r]of Object.entries(this.blocked))t[e]={count:r.count,ms:Math.round(r.ms)};return{blocked:t,acceptedMs:Math.round(this.acceptedMs),ticks:this.ticks}}},o(q,"w"),q),ei=["obs","manycam","virtual","snap camera","xsplit","droidcam","iriun","camo"],ii=[/^(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 ri(i){let t=(i??"").trim().toLowerCase();return t.length===0?"unknown":ei.some(e=>t.includes(e))?"known_virtual":ii.some(e=>e.test(t))?"platform":"unknown"}o(ri,"je");function ee(i){if(typeof i!="function")return!1;try{return/\{\s*\[native code\]\s*\}\s*$/.test(Function.prototype.toString.call(i))}catch{return!1}}o(ee,"Te");function si(i=globalThis){return ee(i.navigator?.mediaDevices?.getUserMedia)&&ee(i.MediaStreamTrack?.prototype?.getSettings)}o(si,"$e");async function ai(i,t=globalThis){let e=t.crypto?.subtle?.digest;if(typeof e=="function")try{let r=new Uint8Array(await e.call(t.crypto?.subtle,"SHA-256",new TextEncoder().encode(i)));return Array.from(r.subarray(0,8),s=>s.toString(16).padStart(2,"0")).join("")}catch{return}}o(ai,"Je");async function ni(i,t=globalThis){let e={};try{e=typeof i.getSettings=="function"?i.getSettings()??{}:{}}catch{e={}}let r={};if((e.facingMode==="user"||e.facingMode==="environment"||e.facingMode==="left"||e.facingMode==="right")&&(r.facingMode=e.facingMode),typeof e.frameRate=="number"&&Number.isFinite(e.frameRate)&&(r.frameRate=e.frameRate),typeof e.width=="number"&&Number.isFinite(e.width)&&(r.width=e.width),typeof e.height=="number"&&Number.isFinite(e.height)&&(r.height=e.height),typeof e.deviceId=="string"&&e.deviceId.length>0){let a=await ai(e.deviceId,t);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:ri(s),prototypesIntact:si(t)}}o(ni,"Ce");var ot=o(i=>Math.round(i*100)/100,"H");function oi(i){let t=i,e=typeof t?.requestVideoFrameCallback=="function",r=null,s=null,a=0,n=0,l=0,c=0,h=0,d=0,u=o(()=>{!e||t?.requestVideoFrameCallback===void 0||(r=t.requestVideoFrameCallback((v,w)=>{if(r=null,!e)return;let m=w.presentationTime;if(s!==null){let g=m-s.presentationTimeMs;n+=1;let y=g-l;l+=y/n,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:o(()=>s,"latest"),stats:o(()=>({n:a,meanGapMs:n===0?0:ot(l),stdGapMs:n<2?0:ot(Math.sqrt(c/(n-1))),captureLatencyMs:d===0?null:ot(h/d)}),"stats"),stop:o(()=>{e&&(e=!1,r!==null&&t?.cancelVideoFrameCallback?.(r),r=null)},"stop")}}o(oi,"Ee");function li(i,t,e){return{...i,rvfc:t,rampPainter:e}}o(li,"_e");var ci=1e3,lt="fcv3.hold_upright",hi=200,ct=4,ui=600,di=1e3,ie={sharpness:1,exposure:1,meanLuma:128};function fi(i,t){return t.width=i.videoWidth,t.height=i.videoHeight,t.getContext("2d").drawImage(i,0,0),new Promise((e,r)=>t.toBlob(s=>s?e(s):r(new Error("empty-keyframe")),"image/jpeg",.92))}o(fi,"it");function mi(){return V()==="phone"}o(mi,"at");var z,le=(z=class{constructor(t){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=t,this.facing=t.facingMode??"user"}get state(){return this.stateValue}on(t,e){let r=this.handlers.get(t);return r||(r=new Set,this.handlers.set(t,r)),r.add(e),()=>r?.delete(e)}emit(t,e){for(let r of[...this.handlers.get(t)??[]])r(e)}async start(t={}){t.facingMode!==void 0&&(this.facing=t.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(t){this.facing=t,this.teardownAttempt(),this.start()}destroy(){this.attempt+=1,this.teardownAttempt(),this.detector?.destroy(),this.detector=null,this.options.video.srcObject=null}async run(t){let{options:e}=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=(e.isPhone??mi)(),this.setState("preflight");let r=Ct();if(r!=="OK"){this.fail(r==="INSECURE_CONTEXT"?"insecure":"unsupported",{phase:"preflight"});return}this.setState("acquiring");let s=e.getUserMedia??(h=>navigator.mediaDevices.getUserMedia(h)),a;this.cameraRequestedAt=this.now();try{let{facingMode:h,...d}=kt(Tt(),this.facing).video;a=await Lt(this.facing,d,{getUserMedia:s,enumerateDevices:vi(e)})}catch(h){if(t!==this.attempt)return;if(h instanceof Nt){this.fail("backcamera",{phase:"acquiring",name:K(h)});return}this.fail(Ut(h),{phase:"acquiring",name:K(h)});return}if(Et(a),Ft(a),t!==this.attempt){for(let h of a.getTracks())h.stop();return}this.stream=a;let n=a.getVideoTracks?.()[0];if(this.trackProvenance=n===void 0?null:ni(n).catch(()=>null),this.facing=_t(a)??this.facing,e.video.srcObject=a,await e.video.play().catch(()=>{}),t!==this.attempt)return;if(this.cameraReadyAt=this.now(),this.detector===null){let h={v3AssetBaseUrl:e.v3AssetBaseUrl},d=e.createDetector??(e.createWorker!==void 0&&Zt()?async()=>{try{return await jt.create(e.createWorker(),h)}catch{return x(h)}}:()=>x(h)),u;try{u=await d()}catch(v){t===this.attempt&&this.fail("models",{phase:"models",name:K(v)},v instanceof nt?v.fallbackReason:gi(v));return}if(t!==this.attempt){u.destroy();return}this.detector=u,this.options.telemetry?.({type:"detector",tier:u.tier,fallbackReason:u.fallbackReason})}let l=Bt(),c=e.deviceClass??Wt(l);this.profiler=new qt(c),this.options.telemetry?.({type:"profile",staticClass:c,activeClass:this.profiler.deviceClass,simd:l.simd}),this.gate=new Jt(e.thresholds??{}),this.blockStats=new te,this.lastGateSnapshotAt=this.now(),e.rankKeyframes?.()&&import("./keyframe-rank-YAJLYJYF-WCA6RPMD.js").then(h=>ht=h,()=>{}),this.setState("positioning"),this.positioningStartedAt=this.now(),this.startScheduler(t)}get animations(){return this.profiler?.profile.animations??"full"}startScheduler(t){let e=this.profiler;if(e===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 Ye({cadenceHz:e.profile.cadenceHz,video:this.options.video,now:this.options.now,run:o(()=>this.detectTick(t),"run")});this.scheduler=r,r.start()}async detectTick(t){let{detector:e,gate:r,profiler:s}=this,a=this.options.video;if(t!==this.attempt||e===null||r===null||s===null||this.fired||a.videoWidth===0)return;if(this.isLandscape()){this.holdUpright(t);return}let n=s.deviceClass,l=this.now(),c=this.options.makeSnapshot?.(a,s.profile.inputWidth)??this.defaultSnapshot(a,s.profile.inputWidth),h=null;try{h=await e.detect(c,a.videoWidth,a.videoHeight)}catch{h=null}if(t!==this.attempt||this.fired)return;s.record(this.now()-l),s.deviceClass!==n&&this.startScheduler(t);let d=h===null?ie: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>=ci&&(this.lastGateSnapshotAt=u.at,this.reportGate(!1)),this.emit("checks",{engine:"v3",progress:u.p,q:u.q,factors:u.factors,attempt:t}),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(t))}async fire(t){let{options:e}=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]:[]];e.telemetry?.({type:"fired",timeToGateMs:this.now()-this.positioningStartedAt,degradeCount:this.carriedDegrade+s.degradeCount,meanDetectMs:a.length===0?0:a.reduce((k,b)=>k+b,0)/a.length});let n=e.mode??"clip",l=e.rankKeyframes?.()&&ht?ht.default(this,t).catch(()=>this.collectKeyframes(t)):this.collectKeyframes(t);if(n==="photo"){let k=this.watchRotation(t,null),b=await l;if(k(),t!==this.attempt)return;if(b===null){this.fail("generic",{phase:"keyframes"});return}let I=await this.provenance({n:0,meanGapMs:0,stdGapMs:0,captureLatencyMs:null},!1);if(t!==this.attempt)return;this.finishCapture({keyframe:b.blob,previewDataUrl:b.previewDataUrl,...I});return}this.setState("recording");let c=this.stream;if(c===null){this.fail("generic",{phase:"recording"});return}let h=e.screenRamp?.(),d=h!==void 0,u=null;l.then(k=>{u=k},()=>{});let v=o(()=>{t===this.attempt&&u!==null&&this.emit("frozen",{previewDataUrl:u.previewDataUrl})},"f"),w=Ze(h,ne),m=null,g,y=0;try{let k=this.recordTake(t,c,h,w,void 0).then(_=>_,_=>({failed:_})),[b,I]=await Promise.all([k,l]);if(g=I,t!==this.attempt)return;if("failed"in b){if(b.failed.kind==="cliptoolarge")throw b.failed;$t(b.failed.requestedMimeType??"")}else m=b,Qt(b.clip,w)?b.clip.stats===null&&$t(b.clip.requestedMimeType??""):v();if(m===null||Qt(m.clip,w)){y=1,e.telemetry?.({type:"clip_retake",reason:m===null?"error":m.clip.stats===null?"unreadable":"short"});let _=null;try{_=await this.recordTake(t,c,h,w,v)}catch(H){if(m===null)throw H}if(t!==this.attempt)return;_!==null&&(m===null||We(_.clip,m.clip))&&(m=_),_===null&&v()}}catch(k){if(t!==this.attempt)return;let b=k.kind;this.fail(b==="cliptoolarge"?"cliptoolarge":"recorder",{phase:"recording",name:K(k)});return}if(m===null){this.fail("recorder",{phase:"recording"});return}let{clip:p,rvfc:M,report:T}=m;if(et(p.blob)){this.fail("cliptoolarge",{phase:"recording"});return}if(g===null){this.fail("generic",{phase:"keyframes"});return}let A=await this.provenance(M,d);t===this.attempt&&this.finishCapture({clip:p.blob,clipMimeType:p.mimeType,...p.stats?{clipStats:p.stats}:{},clipRetakes:y,keyframe:g.blob,previewDataUrl:g.previewDataUrl,...T!==void 0&&T.rendered.length>0?{screenRamp:T}:{},...A})}async recordTake(t,e,r,s,a){let n=this.options.createRecorder?.()??new qe({now:o(()=>this.now(),"now")}),l=oi(this.options.video),c=je(r,{paint:o(u=>{(u===null||t===this.attempt)&&this.emit("ramp",{colour:u})},"paint"),now:o(()=>this.now(),"now"),frames:l.latest});this.ramp=c;let h=o(()=>{l.stop(),c.stop(),this.ramp===c&&(this.ramp=null)},"l"),d=this.watchRotation(t,n);try{return{clip:await n.record(e,a,()=>c.started(this.now()),s,l),rvfc:l.stats(),report:c.report()}}finally{d(),h()}}async provenance(t,e){let r=this.trackProvenance;if(r===null)return{};let s,a=new Promise(l=>{s=setTimeout(()=>l(null),di)}),n=await Promise.race([r,a]);return clearTimeout(s),n===null?{}:{provenance:li(n,t,e)}}isLandscape(){let t=this.options.video;return this.uprightGuard&&t.videoWidth>t.videoHeight}holdUpright(t){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:t}),this.lastGuidanceKey!==lt&&(this.lastGuidanceKey=lt,this.emit("guidance",{key:lt}))}watchRotation(t,e){if(!this.uprightGuard)return()=>{};let r=this.options.video,s=o(()=>{if(t!==this.attempt||e!==null&&this.stateValue!=="recording"){l();return}r.videoWidth>0&&this.isLandscape()&&(l(),this.abortRecording(t,e))},"n"),a=setInterval(s,hi);r.addEventListener?.("resize",s);let n=!1;function l(){n||(n=!0,clearInterval(a),r.removeEventListener?.("resize",s))}return o(l,"o"),l}abortRecording(t,e){if(t!==this.attempt)return;this.attempt+=1;let r=this.attempt;try{e?.stop()}catch{}this.ramp?.stop(),this.ramp=null,this.fired=!1,this.captureCompleteAt=null,this.gate=new Jt(this.options.thresholds??{}),this.blockStats=new te,this.lastGateSnapshotAt=this.now(),this.lastGuidanceKey=null,this.setState("positioning"),this.positioningStartedAt=this.now(),this.holdUpright(r),this.startScheduler(r)}async collectKeyframes(t){let e=this.options.captureKeyframe??(a=>this.defaultKeyframe(a)),r=ui/(ct-1),s=null;for(let a=0;a<ct;a+=1){if(t!==this.attempt)return s;try{let n=await e(this.options.video);(s===null||n.sharpness>s.sharpness)&&(s=n)}catch{}a<ct-1&&await pi(r)}return s}finishCapture(t){this.stopTracks(),this.setState("captured");let e=this.captureTiming();this.emit("artifacts",e===void 0?t:{...t,timing:e})}captureTiming(){let t={},e=o((r,s,a)=>{s!==null&&a!==null&&(t[r]=Math.max(0,Math.round(a-s)))},"t");return e("cameraReadyMs",this.cameraRequestedAt,this.cameraReadyAt),e("faceAcquireMs",this.cameraReadyAt,this.faceAcquiredAt),e("captureMs",this.faceAcquiredAt,this.captureCompleteAt),Object.keys(t).length>0?t:void 0}async defaultKeyframe(t){let e=document.createElement("canvas"),r=await(this.facing==="user"?$e:fi)(t,e),s=e.toDataURL("image/jpeg",.92);return{blob:r,previewDataUrl:s,sharpness:this.centerSharpness(t)}}defaultSnapshot(t,e){try{let r=this.snapshotCanvas??document.createElement("canvas"),s=e/Math.max(1,t.videoWidth),a=Math.max(1,Math.round(t.videoWidth*s)),n=Math.max(1,Math.round(t.videoHeight*s)),l=r.getContext("2d");return l===null?t:(r.width!==a&&(r.width=a),r.height!==n&&(r.height=n),l.drawImage(t,0,0,a,n),this.snapshotCanvas=r,r)}catch{return t}}defaultQuality(t,e){let r=re(t,e,96);return r===null?ie:{sharpness:rt(r),exposure:Ht(r),meanLuma:zt(r)}}centerSharpness(t){let e=Z(t),r=re(t,{x:e.width*.25,y:e.height*.25,width:e.width*.5,height:e.height*.5},96);return r===null?0:rt(r)}teardownAttempt(){this.scheduler?.stop(),this.scheduler=null,this.reportGate(!0),this.gate=null,this.ramp?.stop(),this.ramp=null,this.stopTracks()}reportGate(t){let e=this.blockStats,r=this.profiler;if(e===null||r===null)return;let s=e.summary();t&&(this.blockStats=null),s.ticks!==0&&this.options.telemetry?.({type:"gate",final:t,activeClass:r.deviceClass,cadenceHz:r.profile.cadenceHz,...s})}stopTracks(){if(this.stream!==null){for(let t of this.stream.getTracks())t.stop();this.stream=null}}fail(t,e,r){this.scheduler?.stop(),this.reportGate(!0),this.stopTracks(),this.setState("error"),this.options.telemetry?.({type:"error",kind:t,fallbackReason:r});let{phase:s,name:a}=e;this.emit("error",{kind:t,retryable:t!=="insecure"&&t!=="unsupported",detail:a===void 0?{phase:s}:{phase:s,name:a}})}setState(t){this.stateValue=t,this.emit("statechange",{state:t})}now(){return this.options.now?.()??performance.now()}},o(z,"ke"),z),ht;function pi(i){return new Promise(t=>setTimeout(t,i))}o(pi,"st");function gi(i){return i instanceof Error?i.message:String(i)}o(gi,"ot");function re(i,t,e){try{let r=document.createElement("canvas"),s=e/Math.max(1,t.width);r.width=Math.max(1,Math.round(t.width*s)),r.height=Math.max(1,Math.round(t.height*s));let a=r.getContext("2d");return a===null?null:(a.drawImage(i,t.x,t.y,t.width,t.height,0,0,r.width,r.height),a.getImageData(0,0,r.width,r.height))}catch{return null}}o(re,"we");function vi(i){if(i.enumerateDevices!==void 0)return i.enumerateDevices;if(i.getUserMedia===void 0&&!(typeof navigator>"u"||typeof navigator.mediaDevices?.enumerateDevices!="function"))return()=>navigator.mediaDevices.enumerateDevices()}o(vi,"lt");var yi=12e4,ce=13e4,wi=3e3,bi=1200,ut=Symbol.for("@sekyro/web.preload.v1");function ft(){let i=globalThis;return i[ut]??(i[ut]=new Map),i[ut]}o(ft,"g");function Y(i){let t=(i??at).replace(/\/+$/,"");return t===""?"/":t}o(Y,"S");function ue(i){let t=ft(),e=t.get(i);return e===void 0&&(e={status:"idle",promise:null,scheduled:null,detectorPromise:null,detector:null,listeners:new Set},t.set(i,e)),e}o(ue,"se");function dt(i,t){if(i.status!==t){i.status=t;for(let e of[...i.listeners])e(t)}}o(dt,"A");var Mi=o(i=>x({preferred:["blaze"],v3AssetBaseUrl:i,blazeInitTimeoutMs:yi}),"x"),ki=Mi;function Ti(){return typeof window<"u"&&typeof navigator<"u"&&typeof navigator.mediaDevices?.getUserMedia=="function"}o(Ti,"pe");function _i(){return navigator.connection?.saveData===!0}o(_i,"me");function Ei(i){let t=window;if(typeof t.requestIdleCallback=="function"){let r=t.requestIdleCallback(i,{timeout:wi});return()=>t.cancelIdleCallback?.(r)}let e=setTimeout(i,bi);return()=>clearTimeout(e)}o(Ei,"ve");function Si(i,t){let e,r=new Promise(l=>{e=l}),s=!1,a=o(()=>{},"d"),n={promise:r,settle:o(l=>{s||(s=!0,a(),i.scheduled===n&&(i.scheduled=null),e(l))},"settle")};return i.scheduled=n,a=Ei(()=>{s||n.settle(mt(i,t))}),r}o(Si,"ge");function mt(i,t){if((i.status==="loading"||i.status==="ready")&&i.promise!==null)return i.promise;dt(i,"loading");let e=new Promise(n=>n(ki(t)));i.detectorPromise=e;let r,s=new Promise((n,l)=>{r=setTimeout(()=>{e.then(c=>c.destroy(),()=>{}),l(new Error(`detector preload exceeded ${ce} ms`))},ce)}),a=Promise.race([e,s]).then(n=>i.detectorPromise!==e?(n.destroy(),i.status):(i.detector=n,dt(i,"ready"),"ready"),n=>(i.detectorPromise===e&&(i.detectorPromise=null,i.detector=null,dt(i,"failed"),console.warn("[@sekyro/web] face-detector preload failed:",n)),i.status)).finally(()=>clearTimeout(r));return i.promise=a,i.scheduled?.settle(a),a}o(mt,"I");function Yi(i={}){if(!Ti())return Promise.resolve("idle");let t=Y(i.assetBaseUrl),e=ue(t);return i.respectSaveData===!0&&_i()?Promise.resolve(e.status):(e.status==="loading"||e.status==="ready")&&e.promise!==null?e.promise:i.idle===!0?e.scheduled?.promise??Si(e,t):mt(e,t)}o(Yi,"we");function Qi(i){return ft().get(Y(i))?.status??"idle"}o(Qi,"ke");function Ji(i,t){let e=ue(Y(t));return e.listeners.add(i),()=>{e.listeners.delete(i)}}o(Ji,"De");function Ai(i){return{get tier(){return i.tier},get fallbackReason(){return i.fallbackReason},detect:o((...t)=>i.detect(...t),"detect"),destroy:o(()=>{},"destroy")}}o(Ai,"he");function Ii(i){let t=Y(i),e=ft().get(t);if(!(e===void 0||e.detector===null&&e.detectorPromise===null&&e.scheduled===null))return async()=>{e.scheduled!==null&&mt(e,t);let r=e.promise;for(;e.detector===null&&r!==null&&(await r,e.promise!==r);)r=e.promise;return e.detector!==null?Ai(e.detector):x({v3AssetBaseUrl:t})}}o(Ii,"oe");function xi(i){switch(i){case"fcv3.no_face":case"fcv3.center_face":case"fcv3.straighten":return"center";case"fcv3.come_closer":return"closer";case"fcv3.move_back":return"farther";case"fcv3.more_light":case"fcv3.too_bright":return"light";case"fcv3.hold_still":case"fcv3.steady_camera":return"still";case"fcv3.hold_upright":return"upright";case"fcv3.one_face":return"one_face";default:return null}}o(xi,"Ce");function Di(i){switch(i){case"preflight":case"acquiring":return"starting";case"positioning":return"gating";default:return i}}o(Di,"Se");function he(i){switch(i){case"permission":case"notfound":case"inuse":case"insecure":case"unsupported":return i;case"backcamera":return"notfound";default:{let t=i;return"generic"}}}o(he,"ie");function Ri(i,t,e){if(e===void 0)return{kind:he(i),retryable:t};let r=Gt(e.name);return{kind:he(i),retryable:t,detail:{...r!==void 0?{name:r}:{},phase:e.phase,engineKind:i}}}o(Ri,"Le");var Ci=new Set(["captured","uploading","checking"]);function Oi(i,t={},e,r=()=>"self",s=()=>{},a){let n=t.now??(()=>performance.now()),l=t.canChooseFacing??At,c="user",h=It(),d=r(),u=St(),v=!Ot(),w=t.engineOptions,m=w?.createDetector===void 0&&w?.createWorker===void 0?{createDetector:o(()=>{let f=Ii(i.assetBaseUrl);return f!==void 0?f():x({v3AssetBaseUrl:i.assetBaseUrl})},"createDetector")}:{},g={video:i.video,mode:v?"photo":"clip",rankKeyframes:e,facingMode:void 0,v3AssetBaseUrl:i.assetBaseUrl,screenRamp:o(()=>d==="self"&&u.count("ramp")>0?s():void 0,"screenRamp"),...t.engineOptions??{},...m},y=t.createEngine?.(g)??new le(g),p="idle",M=null,T=0,A=!1,k="full",b=null,I=null,_=0,H=0,pt=o(()=>{i.video.videoWidth>0&&i.video.videoHeight>0&&(_=i.video.videoWidth,H=i.video.videoHeight)},"K"),gt=xt({enabled:i.keepScreenAwake!==!1}),X=o(f=>{p=f,gt.setActive(f==="starting"||f==="gating"||f==="recording"),u.emit("state",f)},"M"),Q=o(()=>u.emit("gate",{progress:T,hint:M,faceDetected:A}),"R"),vt=o(()=>{let f=y.animations??"full";f!==k&&(k=f,u.emit("profile",{animations:k}))},"G"),de=[y.on("statechange",({state:f})=>{let E=Di(f);E==="starting"&&p!=="starting"&&(M=null,T=0,A=!1,b=null,I=null,_=0,H=0),X(E),vt(),E==="recording"&&(pt(),b=n(),M="hold",T=1,Q())}),y.on("checks",f=>{pt(),T=f.progress,A=f.factors.presence>0,Q(),vt()}),y.on("guidance",({key:f})=>{M=xi(f),Q()}),y.on("frozen",({previewDataUrl:f})=>{I=n(),u.emit("frozen",{previewDataUrl:f})}),y.on("ramp",f=>u.emit("ramp",f)),y.on("artifacts",f=>{if(p!=="captured")return;let E=V(),S=f.clipStats,bt=S!==void 0?Math.round(S.durationMs):b!==null&&I!==null?Math.max(0,Math.round(I-b)):void 0,Mt=S!==void 0&&S.frames>1&&S.durationMs>0?Math.round(S.frames*1e4/S.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||_,height:i.video.videoHeight||H,...bt!==void 0?{clipMs:bt}:{},...S!==void 0?{clipFrames:S.frames}:{},...Mt!==void 0?{fps:Mt}:{},...f.clipRetakes!==void 0?{clipRetakes:f.clipRetakes}:{},...f.clipMimeType!==void 0?{codec:ae(f.clipMimeType)}:{},captureChannel:E==="desktop"?"desktop":"mobile",formFactor:E,...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:E,detail:S})=>{f==="backcamera"&&fe()||u.emit("error",Ri(f,E,S))})],yt=!1;function fe(){return J||yt||d!=="assisted"||a===void 0||a.session()!=="choice"?!1:(yt=!0,a.onModeChange("self"),d="self",c=tt("self"),X("mode_switch"),y.restart(c),!0)}o(fe,"ce");let wt=o(async()=>a!==void 0&&a.session()==="choice"&&await l().catch(()=>!1),"W"),J=!1;return{handle:{get state(){return p},get captureMode(){return r()},get facingMode(){return y.facingMode??c},on:o((f,E)=>u.on(f,E),"on"),start:o(f=>(d=r(),h.facing(d,i.facing),c=h.facing(d,f?.facing),y.start({facingMode:c})),"start"),retry:o(()=>y.retry(),"retry"),switchCamera:o(()=>h.refuseSwitch(r()),"switchCamera"),canSwitchCaptureMode:wt,setCaptureMode:o(async f=>{if(f===r()||!await wt()||J||Ci.has(p)||a===void 0)return!1;a.onModeChange(f),d=f;let E=tt(f);return c=E,p==="idle"||(X("mode_switch"),y.restart(E)),!0},"setCaptureMode"),destroy:o(()=>{J=!0;for(let f of de)f();gt.setActive(!1),y.destroy(),u.clear()},"destroy")},setFlowState:o(f=>{p!==f&&X(f)},"setFlowState")}}o(Oi,"Ee");function tr(i){return Oi(i).handle}o(tr,"ze");export{zi as a,Yi as b,Qi as c,Ji as d,Ri as e,Oi as f,tr as g};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{d as U}from"./chunk-
|
|
1
|
+
import{d as U}from"./chunk-UNQ3QO4U.js";import{E as C,I as H,a as Z,b as E,v as B}from"./chunk-SIPFHN7E.js";import{a as d}from"./chunk-5QL6W6FW.js";import{a as N,c as R}from"./chunk-4FHWXBOB.js";var y=R(Z(),1),s=R(E(),1);var b=72;function P(c,t){let r=c*.72,a=r*1.32;return{cx:c/2,cy:(t-a)/2.1+a/2,a:r/2,b:a/2}}N(P,"B");d(P,"faceOval");function z({cx:c,cy:t,a:r,b:a}){return Array.from({length:b},(j,M)=>{let m=-Math.PI/2+M/b*2*Math.PI,h=Math.cos(m),i=Math.sin(m),u=c+r*h,f=t+a*i,k=Math.hypot(a*h,r*i),p=a*h/k,$=r*i/k,o=d(v=>Math.round(v*10)/10,"r");return`M${o(u+p*16)} ${o(f+$*16)}L${o(u+p*28)} ${o(f+$*28)}`})}N(z,"E");d(z,"ticks");function F({video:c,instruction:t,note:r,status:a,busy:j,progress:M,still:m,overlay:h,ramp:i,onClose:u,closeLabel:f,end:k,live:p=!0,children:$,testId:o}){C(p);let v=(0,y.useRef)(null),[l,A]=(0,y.useState)({w:0,h:0});(0,y.useLayoutEffect)(()=>{let x=v.current;if(x===null)return;let I=d(()=>A({w:x.clientWidth,h:x.clientHeight}),"measure");if(I(),typeof ResizeObserver>"u")return;let L=new ResizeObserver(I);return L.observe(x),()=>L.disconnect()},[]);let e=P(l.w,l.h),g=l.w>0?z(e):[],w=Math.round(Math.min(1,Math.max(0,M))*b),S=e.cy-e.b,n=Math.max(e.a,e.b)+40,O=70*Math.PI/180;return(0,s.jsx)("section",{className:"sekyro-lm sekyro-fc","aria-label":t,"data-testid":o,"data-ramp":i?"":void 0,children:(0,s.jsxs)("div",{ref:v,className:"sekyro-lm-stage",children:[c,m?(0,s.jsx)("img",{className:"sekyro-lm-video sekyro-fc-still",src:m,alt:""}):null,h,(0,s.jsx)(U,{colour:i??null}),l.w>0?(0,s.jsxs)("svg",{className:"sekyro-lm-overlay",viewBox:`0 0 ${l.w} ${l.h}`,"aria-hidden":"true",focusable:"false",children:[(0,s.jsxs)("defs",{children:[(0,s.jsxs)("linearGradient",{id:"sekyro-fc-fade",gradientUnits:"userSpaceOnUse",x1:e.cx-n*Math.sin(O),y1:e.cy,x2:e.cx,y2:e.cy,children:[(0,s.jsx)("stop",{offset:"0",className:"sekyro-fc-fade",stopOpacity:"0"}),(0,s.jsx)("stop",{offset:"1",className:"sekyro-fc-fade"})]}),(0,s.jsx)("mask",{id:"sekyro-fc-light",maskUnits:"userSpaceOnUse",x:"0",y:"0",width:l.w,height:l.h,children:(0,s.jsx)("path",{className:"sekyro-fc-sweep",style:{transformOrigin:`${e.cx}px ${e.cy}px`},d:`M${e.cx} ${e.cy}L${e.cx-n*Math.sin(O)} ${e.cy-n*Math.cos(O)}A${n} ${n} 0 0 1 ${e.cx} ${e.cy-n}Z`,fill:"url(#sekyro-fc-fade)"})})]}),(0,s.jsx)("path",{className:"sekyro-fc-scrim",fillRule:"evenodd",d:`M0 0H${l.w}V${l.h}H0Z M${e.cx-e.a} ${e.cy}a${e.a} ${e.b} 0 1 0 ${2*e.a} 0a${e.a} ${e.b} 0 1 0 ${-2*e.a} 0Z`}),(0,s.jsx)("ellipse",{className:"sekyro-fc-rim",cx:e.cx,cy:e.cy,rx:e.a,ry:e.b}),(0,s.jsx)("path",{className:"sekyro-fc-ticks",d:g.join("")}),w>0?(0,s.jsx)("path",{className:"sekyro-fc-ticks is-done",d:g.slice(0,w).join("")}):null,w<b?(0,s.jsx)("path",{className:"sekyro-fc-ticks is-light",d:g.join(""),mask:"url(#sekyro-fc-light)"}):null]}):null,(0,s.jsx)("div",{className:"sekyro-lm-instruction sekyro-fc-instruction",style:{insetBlockStart:S-80},children:(0,s.jsx)("div",{role:"status","aria-live":"polite",children:(0,s.jsx)(H,{swapKey:t,className:"sekyro-lm-line",children:t})})}),a!==void 0?(0,s.jsx)("p",{role:"status",className:"sekyro-visually-hidden","data-testid":"sekyro-camera-status",children:a??""}):null,r?(0,s.jsxs)("p",{className:"sekyro-lm-under sekyro-lm-note",style:{insetBlockStart:S+2*e.b+48},children:[j?(0,s.jsx)("span",{className:"sekyro-lm-spinner","aria-hidden":"true"}):null,(0,s.jsx)("span",{children:r})]}):null,(0,s.jsxs)("div",{className:"sekyro-lm-controls",children:[(0,s.jsxs)("div",{className:"sekyro-lm-bar",children:[u!==void 0?(0,s.jsx)("button",{type:"button",className:"sekyro-glass","aria-label":f,onClick:u,children:(0,s.jsx)(B,{name:"close"})}):null,k]}),$]})]})})}N(F,"T");d(F,"FaceCamera");export{F as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as o}from"./chunk-4FHWXBOB.js";var a={"ID-1":{center:1.586,tolerance:.15},"ID-2":{center:1.419,tolerance:.12},"ID-3":{center:1.42,tolerance:.2}},i={"ID-1":["ID-1"],"ID-2":["ID-2"],"ID-3":["ID-3"],card:["ID-1","ID-2"]};function d(e){return a[e==="card"?"ID-1":e]}o(d,"i");function
|
|
1
|
+
import{a as o}from"./chunk-4FHWXBOB.js";var a={"ID-1":{center:1.586,tolerance:.15},"ID-2":{center:1.419,tolerance:.12},"ID-3":{center:1.42,tolerance:.2}},i={"ID-1":["ID-1"],"ID-2":["ID-2"],"ID-3":["ID-3"],card:["ID-1","ID-2"]};function d(e){return a[e==="card"?"ID-1":e]}o(d,"i");function n(e,r){return i[e].some(t=>Math.abs(r-a[t].center)<=a[t].tolerance)}o(n,"d");var c=[{docType:"carte_identite",format:"ID-1",sides:["recto","verso"],mrz:"td1",portraitSide:"recto",aspectRatio:1.586,identifierSource:"mrz"},{docType:"passport",format:"ID-3",sides:["single"],mrz:"td3",portraitSide:"single",aspectRatio:1.42,identifierSource:"mrz"}],s=[...c,{docType:"residence_permit",format:"ID-1",sides:["recto","verso"],mrz:"td1",portraitSide:"recto",aspectRatio:1.586,identifierSource:"mrz"},{docType:"drivers_license",format:"ID-1",sides:["recto","verso"],mrz:"none",portraitSide:"recto",aspectRatio:1.586}];function p(e){let r=s.find(t=>t.docType===e);return r===void 0||r.format==="ID-1"?"card":r.format}o(p,"s");export{d as a,n as b,s as c,p as d};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as g}from"./chunk-
|
|
1
|
+
import{a as g}from"./chunk-LA2MA2UQ.js";import{K as b,a as k,b as y,c as x}from"./chunk-SIPFHN7E.js";import{a as n}from"./chunk-5QL6W6FW.js";import{a as c,c as f}from"./chunk-4FHWXBOB.js";var l=f(k(),1),t=f(k(),1),w=f(k(),1),r=f(y(),1),e=f(y(),1);var i,C=(i=class extends w.Component{constructor(){super(...arguments),this.state={failed:!1}}static getDerivedStateFromError(){return{failed:!0}}render(){return this.state.failed?this.props.fallback:this.props.children}},c(i,"c"),i);n(C,"LoadBoundary");var j=C,F={load:n(()=>import("./flow-views-N7LBFI55-27RU7EZG.js"),"load")};function S({view:s,i18n:a,quiet:o,...m}){let[d,h]=(0,t.useState)(0),u=(0,t.useMemo)(()=>(0,t.lazy)(()=>F.load().then(v=>({default:v[s]}))),[s,d]),p=(0,r.jsxs)(b,{tone:"danger",children:[(0,r.jsx)("span",{children:a.t("errors.network_error")}),(0,r.jsx)(x,{kind:"secondary",onClick:c(()=>h(v=>v+1),"onClick"),children:a.t("common.retry")})]});return(0,r.jsx)(j,{fallback:p,children:(0,r.jsx)(t.Suspense,{fallback:o===!0?null:(0,r.jsx)("p",{role:"status","aria-busy":"true",className:"sekyro-text-muted",children:a.t("common.loading")}),children:(0,r.jsx)(u,{...m,i18n:a})})},d)}c(S,"k");n(S,"Flow");var B=(0,l.createContext)(void 0);function H({i18n:s,lead:a,refresh:o,actions:m}){let d=(0,l.useContext)(B),[h,u]=(0,l.useState)(!1);if(d!==void 0)return(0,e.jsx)(S,{view:"HandoffView",i18n:s,url:d,lead:a,...o!==void 0?{refresh:o}:{},footer:m});let p=n(()=>{o!==void 0&&(u(!0),o().catch(()=>{}).finally(()=>u(!1)))},"again");return(0,e.jsx)(g,{tone:"brand",icon:"smartphone",title:s.t("handoff.title"),testId:"sekyro-phone-handoff",actions:(0,e.jsxs)(e.Fragment,{children:[m,o!==void 0?(0,e.jsx)(x,{kind:"secondary",full:!0,disabled:h,onClick:p,children:s.t("common.refresh")}):null]}),children:(0,e.jsx)("p",{children:a})})}c(H,"K");n(H,"PhoneHandoff");export{j as a,S as b,B as c,H as d};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b,c as t,v as s,w as i,y as l}from"./chunk-
|
|
1
|
+
import{b,c as t,v as s,w as i,y as l}from"./chunk-SIPFHN7E.js";import{a as r}from"./chunk-5QL6W6FW.js";import{a as o,c as k}from"./chunk-4FHWXBOB.js";var a=k(b(),1);function x({title:n,lead:d,cameraLabel:c,uploadLabel:m,notice:p,testId:e,onCamera:h,onUpload:u,onPhone:f=!1}){return(0,a.jsxs)("section",{className:"sekyro-step","data-testid":e,children:[(0,a.jsx)(i,{title:n,lead:d}),p,(0,a.jsxs)(l,{children:[(0,a.jsxs)(t,{full:!0,onClick:h,"data-testid":`${e}-camera`,children:[(0,a.jsx)(s,{name:f?"smartphone":"camera"}),c]}),(0,a.jsx)(t,{full:!0,kind:"ghost",onClick:u,"data-testid":`${e}-upload`,children:m})]})]})}o(x,"k");r(x,"PhotoSourceView");export{x as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b,t as r,v as l,y as o}from"./chunk-
|
|
1
|
+
import{b,t as r,v as l,y as o}from"./chunk-SIPFHN7E.js";import{a as i}from"./chunk-5QL6W6FW.js";import{a,c as p}from"./chunk-4FHWXBOB.js";var s=p(b(),1);function f({tone:d,icon:n,busy:c,title:m,titleId:e,children:u,actions:t,live:y,testId:h}){let k=r();return(0,s.jsxs)("section",{className:"sekyro-step sekyro-status",...e!==void 0?{"aria-labelledby":e}:{},...y?{role:"status","aria-live":"polite"}:{},"data-testid":h,children:[(0,s.jsxs)("div",{className:"sekyro-status__body",children:[(0,s.jsx)("span",{className:`sekyro-tile sekyro-tile--${d}${c?" is-busy":""}`,"aria-hidden":"true",children:(0,s.jsx)(l,{name:n})}),(0,s.jsxs)("div",{className:"sekyro-heading sekyro-status__text",children:[(0,s.jsx)("h2",{id:e,ref:k,tabIndex:-1,className:"sekyro-text-body",children:m}),u]})]}),t!=null&&t!==!1?(0,s.jsx)(o,{children:t}):null]})}a(f,"g");i(f,"StatusPage");export{f as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{A as a,a as i,z as n}from"./chunk-
|
|
1
|
+
import{A as a,a as i,z as n}from"./chunk-ZYZPLDA2.js";import{a as t}from"./chunk-5QL6W6FW.js";import{a as o}from"./chunk-4FHWXBOB.js";function d(r,p){if(r instanceof n)return r.field==="phone"?"otp.phoneInvalid":r.field==="code"?"otp.codeInvalid":r.kind==="check_digit"?"population.reason_id_number_invalid":"population.invalid";if(r instanceof a&&r.field==="channel")return"otp.reason_otp_channel_unavailable";if(r instanceof i){let e=`errors.${r.code}`;if(Object.hasOwn(p,e))return e}return"errors.network_error"}o(d,"d");t(d,"errorKey");export{d as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as j}from"./chunk-
|
|
1
|
+
import{a as j}from"./chunk-H22YHQ6V.js";import{d as U}from"./chunk-FV4TIWHC.js";import{K as k,L as I,a as A,b as V,c as h,v as T,w as _,y as C}from"./chunk-SIPFHN7E.js";import{a as n}from"./chunk-5QL6W6FW.js";import{a as s,c as N}from"./chunk-4FHWXBOB.js";var f=N(A(),1),e=N(V(),1);var D={"portrait.source.title":"كيف تريد إضافة صورتك الشخصية؟","portrait.source.description":"التقط صورة جديدة بالكاميرا، أو ارفع صورة حديثة من هذا الجهاز.","portrait.source.camera":"التقاط صورة","portrait.source.upload":"رفع صورة","portrait.source.uploadInstead":"رفع صورة بدلًا من ذلك","portrait.upload.title":"ارفع صورتك الشخصية","portrait.upload.hint":"صورة حديثة لوجهك، تنظر فيها مباشرة إلى الكاميرا، أمام جدار فاتح وبلون واحد.","portrait.upload.choose":"اختيار صورة","portrait.upload.unsupported":"اختر صورة بصيغة JPEG أو PNG أو HEIC.","portrait.upload.failed":"تعذّر إرسال هذه الصورة. حاول مرة أخرى.","portrait.review.title":"تحقّق من صورتك المعدّلة","portrait.review.description":"عدّلنا صورتك لتطابق قواعد صور الهوية. لم نغيّر وجهك.","portrait.review.original":"صورتك","portrait.review.fixed":"الصورة المعدّلة","portrait.review.fixesTitle":"ما الذي غيّرناه","portrait.review.accept":"استخدام هذه الصورة","portrait.review.retake":"إعادة الالتقاط","portrait.review.uploadAnother":"رفع صورة أخرى","portrait.fixes.crop":"قُصّت","portrait.fixes.scale":"غُيّر حجمها","portrait.fixes.straighten":"عُدّل ميلها","portrait.fixes.background":"استُبدلت الخلفية","portrait.fixes.exposure":"عُدّل السطوع","portrait.fixes.white_balance":"وُزنت الألوان","reasons.portrait_morph_suspected":"لا يمكن استخدام هذه الصورة. التقط صورة جديدة للشخص.","reasons.portrait_reference_mismatch":"لا تطابق الصورة المرجع. التقط صورة جديدة للشخص.","reasons.portrait_declined_fix":"التقط صورة أخرى أو ارفعها."},y={"portrait.source.title":"How do you want to add your ID photo?","portrait.source.description":"Take a new photo with the camera, or upload a recent photo from this device.","portrait.source.camera":"Take a photo","portrait.source.upload":"Upload a photo","portrait.source.uploadInstead":"Upload a photo instead","portrait.upload.title":"Upload your ID photo","portrait.upload.hint":"A recent photo of your face, looking straight at the camera, in front of a plain, light wall.","portrait.upload.choose":"Choose a photo","portrait.upload.unsupported":"Choose a JPEG, PNG or HEIC photo.","portrait.upload.failed":"We could not send this photo. Try again.","portrait.review.title":"Check your adjusted photo","portrait.review.description":"We adjusted your photo to meet the ID photo rules. Your face was not changed.","portrait.review.original":"Your photo","portrait.review.fixed":"Adjusted photo","portrait.review.fixesTitle":"What we changed","portrait.review.accept":"Use this photo","portrait.review.retake":"Take another","portrait.review.uploadAnother":"Upload another","portrait.fixes.crop":"Cropped","portrait.fixes.scale":"Resized","portrait.fixes.straighten":"Straightened","portrait.fixes.background":"Background replaced","portrait.fixes.exposure":"Brightness adjusted","portrait.fixes.white_balance":"Colours balanced","reasons.portrait_morph_suspected":"This photo cannot be used. Take a new photo of the person.","reasons.portrait_reference_mismatch":"The photo does not match the reference. Take a new photo of the person.","reasons.portrait_declined_fix":"Take or upload another photo."},G={"portrait.source.title":"Comment voulez-vous ajouter votre photo d'identité ?","portrait.source.description":"Prenez une nouvelle photo avec la caméra, ou importez une photo récente depuis cet appareil.","portrait.source.camera":"Prendre une photo","portrait.source.upload":"Importer une photo","portrait.source.uploadInstead":"Importer une photo à la place","portrait.upload.title":"Importez votre photo d'identité","portrait.upload.hint":"Une photo récente de votre visage, de face, devant un mur clair et uni.","portrait.upload.choose":"Choisir une photo","portrait.upload.unsupported":"Choisissez une photo JPEG, PNG ou HEIC.","portrait.upload.failed":"Nous n'avons pas pu envoyer cette photo. Réessayez.","portrait.review.title":"Vérifiez votre photo ajustée","portrait.review.description":"Nous avons ajusté votre photo pour qu'elle respecte les règles des photos d'identité. Votre visage n'a pas été modifié.","portrait.review.original":"Votre photo","portrait.review.fixed":"Photo ajustée","portrait.review.fixesTitle":"Ce que nous avons modifié","portrait.review.accept":"Utiliser cette photo","portrait.review.retake":"Reprendre","portrait.review.uploadAnother":"Importer une autre","portrait.fixes.crop":"Recadrée","portrait.fixes.scale":"Redimensionnée","portrait.fixes.straighten":"Redressée","portrait.fixes.background":"Fond remplacé","portrait.fixes.exposure":"Luminosité ajustée","portrait.fixes.white_balance":"Couleurs équilibrées","reasons.portrait_morph_suspected":"Cette photo ne peut pas être utilisée. Prenez une nouvelle photo de la personne.","reasons.portrait_reference_mismatch":"La photo ne correspond pas à la référence. Prenez une nouvelle photo de la personne.","reasons.portrait_declined_fix":"Prenez ou importez une autre photo."},H={en:y,fr:G,ar:D,es:y,pt:y,de:y},S="image/jpeg,image/png,image/heic,image/heif";function m(r){let o=r.strings,a=H[r.locale];return t=>o[t]??a[t]??""}s(m,"v");n(m,"portraitCopy");function b({step:r,i18n:o}){if(r.reason===void 0||r.reason==="portrait_fix_review")return null;let a=m(o)(`reasons.${r.reason}`)||o.t("portrait.retryTitle");return(0,e.jsxs)(k,{tone:"warning",children:[(0,e.jsx)("span",{children:a}),(0,e.jsx)("span",{children:I(o,r.attemptsRemaining,r.attemptsExhausted)})]})}s(b,"R");n(b,"ReasonNotice");function z({step:r,i18n:o,onCamera:a,onUpload:t}){let i=m(o),p=r.photo?.cameraOnPhone===!0;return(0,e.jsx)(j,{testId:"sekyro-portrait-source",title:i("portrait.source.title"),lead:i("portrait.source.description"),cameraLabel:p?o.t("capture.source.phone"):i("portrait.source.camera"),onPhone:p,uploadLabel:i("portrait.source.upload"),notice:(0,e.jsx)(b,{step:r,i18n:o}),onCamera:a,onUpload:t})}s(z,"z");n(z,"PortraitSourceView");function R({step:r,i18n:o,onCamera:a}){let t=m(o),i=(0,f.useRef)(null),[p,v]=(0,f.useState)("idle"),u=p==="sending",d=r.photo?.uploadOffered===!0,g=n(async c=>{let x=c.currentTarget.files?.[0];if(c.currentTarget.value="",x!==void 0){v("sending");try{await r.uploadPortrait(x),v("idle")}catch(w){v(w instanceof TypeError&&w.message==="unsupported_file"?"unsupported":"failed")}}},"onFile");return(0,e.jsxs)("section",{className:"sekyro-step","data-testid":"sekyro-portrait-upload-screen",children:[(0,e.jsx)(_,{title:t("portrait.upload.title"),lead:t("portrait.upload.hint")}),p==="idle"||p==="sending"?(0,e.jsx)(b,{step:r,i18n:o}):null,p==="unsupported"||p==="failed"?(0,e.jsx)(k,{tone:"warning",children:(0,e.jsx)("span",{children:t(p==="unsupported"?"portrait.upload.unsupported":"portrait.upload.failed")})}):null,u?(0,e.jsx)("p",{className:"sekyro-text-muted",role:"status","aria-busy":"true",children:o.t("portrait.uploading")}):null,(0,e.jsx)("input",{ref:i,type:"file",accept:S,hidden:!0,"data-testid":"sekyro-portrait-upload","aria-label":t("portrait.upload.title"),onChange:s(c=>{g(c)},"onChange")}),(0,e.jsxs)(C,{children:[(0,e.jsx)(h,{full:!0,onClick:s(()=>i.current?.click(),"onClick"),disabled:u||!d||r.attemptsExhausted,children:t("portrait.upload.choose")}),a!==void 0?(0,e.jsxs)(h,{full:!0,kind:"ghost",onClick:a,disabled:u,children:[(0,e.jsx)(T,{name:"camera"}),t("portrait.source.camera")]}):null]})]})}s(R,"A");n(R,"PortraitUploadView");function E({step:r,i18n:o,onDeclined:a}){let t=m(o),[i,p]=(0,f.useState)(!1),[v,u]=(0,f.useState)(!1),d=r.pendingFix;if(d==null)return null;let g=n(async l=>{p(!0),u(!1);try{await r.confirmFix(l),l||a?.()}catch{u(!0)}finally{p(!1)}},"answer"),c=r.photo?.source==="upload"?t("portrait.review.uploadAnother"):t("portrait.review.retake"),x=n(l=>t(`portrait.fixes.${l}`)||l,"fixName"),w=t("portrait.review.original"),P=t("portrait.review.fixed");return(0,e.jsxs)("section",{className:"sekyro-step","data-testid":"sekyro-portrait-review",children:[(0,e.jsx)(_,{title:t("portrait.review.title"),lead:t("portrait.review.description")}),(0,e.jsxs)("div",{className:"sekyro-portrait-pair",children:[(0,e.jsxs)("figure",{className:"sekyro-portrait-pair__item",children:[(0,e.jsx)("img",{src:d.originalUrl,alt:w}),(0,e.jsx)("figcaption",{className:"sekyro-text-muted",children:w})]}),(0,e.jsxs)("figure",{className:"sekyro-portrait-pair__item",children:[(0,e.jsx)("img",{src:d.fixedUrl,alt:P}),(0,e.jsx)("figcaption",{className:"sekyro-text-muted",children:P})]})]}),d.fixes.length>0?(0,e.jsxs)("div",{className:"sekyro-stack sekyro-stack--1",children:[(0,e.jsx)("p",{className:"sekyro-text-body",children:t("portrait.review.fixesTitle")}),(0,e.jsx)("ul",{className:"sekyro-portrait-fixes","data-testid":"sekyro-portrait-fixes",children:d.fixes.map(l=>(0,e.jsx)("li",{children:x(l)},l))})]}):null,v?(0,e.jsx)(k,{tone:"danger",children:(0,e.jsx)("span",{children:o.t("errors.network_error")})}):null,(0,e.jsxs)(C,{children:[(0,e.jsx)(h,{full:!0,onClick:s(()=>{g(!0)},"onClick"),disabled:i,"data-testid":"sekyro-portrait-accept",children:t("portrait.review.accept")}),(0,e.jsx)(h,{full:!0,kind:"ghost",onClick:s(()=>{g(!1)},"onClick"),disabled:i,"data-testid":"sekyro-portrait-decline",children:c})]})]})}s(E,"j");n(E,"PortraitReviewView");function q({screen:r,step:o,i18n:a,onCamera:t,onUpload:i,onDeclined:p}){return r==="phone"?(0,e.jsx)(U,{i18n:a,lead:a.t("handoff.lead.portrait"),refresh:o.refresh,actions:(0,e.jsx)(h,{kind:"ghost",full:!0,onClick:i,children:m(a)("portrait.source.upload")})}):r==="review"?(0,e.jsx)(E,{step:o,i18n:a,onDeclined:p}):r==="upload"?(0,e.jsx)(R,{step:o,i18n:a,...t!==void 0?{onCamera:t}:{}}):(0,e.jsx)(z,{step:o,i18n:a,onCamera:t??i,onUpload:i})}s(q,"Q");n(q,"PortraitScreens");export{m as a,z as b,R as c,E as d,q as e};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as C,d as f,e as l,f as d,g as m,h as v,i as p,j as g,l as x}from"./chunk-
|
|
1
|
+
import{a as C,d as f,e as l,f as d,g as m,h as v,i as p,j as g,l as x}from"./chunk-SIPFHN7E.js";import{a as i}from"./chunk-5QL6W6FW.js";import{a as o,c as b}from"./chunk-4FHWXBOB.js";var r=b(C(),1);var y={ar:l,fr:d,en:f};function h(e,t){let s=v(e),a=s===void 0?y[m(e)]:{...y.en,...s};if(t===void 0)return a;let n={...a};for(let u of Object.keys(t)){let c=t[u];typeof c=="string"&&(n[u]=c)}return x(n,t),n}o(h,"T");i(h,"resolveStrings");function j(e){let[,t]=(0,r.useState)(0),s=p(e);return(0,r.useEffect)(()=>{if(!s)return;let a=!0;return g(e).then(()=>a&&t(n=>n+1)),()=>{a=!1}},[e,s]),!s}o(j,"w");i(j,"useLocaleReady");var S=(0,r.createContext)(e=>f[e]??""),E=S.Provider;function k(){return(0,r.useContext)(S)}o(k,"I");i(k,"useStrings");export{h as a,j as b,E as c,k as d};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{d as v}from"./chunk-
|
|
1
|
+
import{d as v}from"./chunk-SGUCIULX.js";import{a as y,b as C}from"./chunk-SIPFHN7E.js";import{a as d}from"./chunk-5QL6W6FW.js";import{a,c as p}from"./chunk-4FHWXBOB.js";var r=p(y(),1),o=p(C(),1),m=p(y(),1);function w(t,e,i){let[n,c]=(0,r.useState)(!1),s=(0,r.useRef)(i);return s.current=i,(0,r.useEffect)(()=>{t&&(c(!0),s.current())},[t,e]),[n,()=>c(!1)]}a(w,"I");d(w,"useWrongCode");function x({id:t,value:e,onChange:i,length:n=6,describedBy:c,invalid:s}){let[k,f]=(0,r.useState)(!1),[h,N]=(0,r.useState)(0);(0,r.useEffect)(()=>{s&&N(l=>l+1)},[s]);let g=(0,r.useRef)(null);(0,r.useEffect)(()=>{let l=setTimeout(()=>g.current?.focus({preventScroll:!0}),350);return()=>clearTimeout(l)},[]);let b=e.length<n?e.length:-1;return(0,o.jsxs)("div",{className:"sekyro-otp-boxes",dir:"ltr",children:[(0,o.jsx)("div",{className:`sekyro-otp-row${h>0?" is-shaking":""}`,"aria-hidden":"true",children:Array.from({length:n},(l,u)=>(0,o.jsx)("span",{className:`sekyro-otp-box${u<e.length?" is-filled":""}${k&&u===b?" is-current":""}${s?" is-invalid":""}`,children:e[u]!==void 0?(0,o.jsx)("span",{className:"sekyro-otp-digit",children:e[u]},e[u]):null},u))},h),(0,o.jsx)("input",{ref:g,id:t,className:"sekyro-input sekyro-input--code",dir:"ltr",inputMode:"numeric",autoComplete:"one-time-code",value:e,"aria-describedby":c,"aria-invalid":s||void 0,onFocus:a(()=>f(!0),"onFocus"),onBlur:a(()=>f(!1),"onBlur"),onChange:a(l=>i(v(l.target.value).replace(/\D/g,"").slice(0,n)),"onChange")})]})}a(x,"S");d(x,"CodeInput");function I(t){let[e,i]=(0,m.useState)(()=>Date.now());return(0,m.useEffect)(()=>{if(!t)return;let n=setInterval(()=>i(Date.now()),1e3);return()=>clearInterval(n)},[t]),e}a(I,"B");d(I,"useNow");export{w as a,x as b,I as c};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{B as ee,C as j,D as De,E as Ge,a as V,b as we,c as Ce,f as Me,g as Ae,h as Se,i as Ie,j as Te,k as Ee,m as E,o as A,p as R,q as N,r as F,s as S,t as X,u as Re,v as Pe,w as Oe,x as xe,y as Ne}from"./chunk-ZYZPLDA2.js";import{f as Le}from"./chunk-7MV4CI4L.js";import{b as ke,c as Q,e as Ue}from"./chunk-CW56KMMH.js";import{a as t}from"./chunk-4FHWXBOB.js";function dt(n){return n.idNumberBound??n.nniBound}t(dt,"te");function Ke(n){return n===void 0?void 0:n.idNumberFromDocument??n.nniFromDocument}t(Ke,"j");var Ve="https://api.sekyro.ai",pt=5e3,ft=24e4,mt=3e4,ht=1500,vt=10;function Be(n){return n instanceof Error&&n.name==="ChallengeError"&&n.code||"challenge_failed"}t(Be,"tt");function yt(n){return new Promise(a=>setTimeout(a,n))}t(yt,"vt");function _t(){let n=globalThis.crypto;if(n!==void 0&&typeof n.randomUUID=="function")return n.randomUUID();let a=new Uint8Array(16);if(n!==void 0&&typeof n.getRandomValues=="function")n.getRandomValues(a);else for(let p=0;p<16;p+=1)a[p]=Math.floor(Math.random()*256);a[6]=(a[6]??0)&15|64,a[8]=(a[8]??0)&63|128;let d=[...a].map(p=>p.toString(16).padStart(2,"0")).join("");return`${d.slice(0,8)}-${d.slice(8,12)}-${d.slice(12,16)}-${d.slice(16,20)}-${d.slice(20)}`}t(_t,"Et");function gt(n){return bt(n,{})}t(gt,"wn");function bt(n,a){let d=n.apiOrigin??Ve,p=n.autoRetry??!0,Ze=n.rearm??"auto",f=a.client??new Ce({apiOrigin:d,sessionToken:n.clientToken,fetch:n.fetch}),D=a.sleep??yt,Ye=a.uuid??_t,We=a.getChallengeToken??((e,r)=>import("./challenge-frame-NUGPTWFP-V3GGQN65.js").then(i=>i.executeChallenge({frameUrl:e.url,siteKey:e.siteKey,action:"liveness",subject:r.subject,signal:r.signal}))),M=Ue(),I=null,ne=null,u=!1,re=new AbortController,l=null,G=null,U=null,L=t(()=>U??De(l),"Z"),ie=t(()=>Ge(j(l),L()),"ge"),g=t(e=>{l=e,M.emit("view",e),I?.onView(e)},"O"),m=t(()=>l!==null?Promise.resolve(l):(G??(G=f.getSession().then(e=>(g(e),e)).finally(()=>{G=null})),G),"_"),b=t(async()=>{let e=await f.getSession();return g(e),e},"w"),H=t(async(e,r)=>{e.plan!==void 0?g(e):await b()},"ne"),K=null,ae=t(async e=>{let r=await m();if(e||!r.consentRecorded){let i=await f.recordConsent(n.locale);i.plan!==void 0?g(i):l!==null&&g({...l,consentRecorded:!0})}ve(r)},"Ce"),k=t(e=>e?.force===!0?ae(!0):(K??(K=ae(!1).finally(()=>{K=null})),K),"v"),q={client:f,ensureConsent:t(e=>k(e),"ensureConsent"),sleep:D,uuid:Ye,...a.random!==void 0?{random:a.random}:{},onBusy:t(e=>{u||M.emit("busy",e)},"onBusy")},oe=!1,se=null,$=t(e=>{if(e.status==="verified"||e.status==="not_verified"||e.status==="review"){if(oe)return;oe=!0}se=JSON.stringify(e),M.emit("result",e)},"re"),Je=t(e=>{se!==JSON.stringify(e)&&$(e)},"pt"),le=t(async e=>{let r=l;e&&(r=await b().catch(()=>l));let i=r===null?null:E(r);return i!==null&&!u&&M.emit("method",i),i!==null},"Pe"),z=null,ue=!1,ce=!1,de=t(()=>Oe(q,(e,r)=>e.submitCheck("population_registry",{},{idempotencyKey:r})),"Ae"),pe=t(e=>dt(e)===!0||Ke(N(e,"population_registry"))===!0,"Oe"),Qe=t(async()=>{try{let e=await m();if(A(e)||E(e)!==null||R(e)?.checkType!=="population_registry")return;if(!pe(e)&&Ke(N(e,"population_registry"))===void 0&&(e=await b()),!pe(e)){ce=!0;return}await k(),await H(await de(),"population_registry");let r=l===null?void 0:N(l,"population_registry");if(r?.state==="input_required"&&r.reason==="registry_unavailable"&&Ee(r)>0){if(await D(pt),u)return;await H(await de(),"population_registry")}}catch(e){if(e instanceof V&&(e.code==="check_not_active"||e.code==="step_not_on_path")){await b().catch(()=>{});return}ue=!0;return}l!==null&&A(l)&&$(X(l,{autoRetry:p}))},"ft"),fe=t(()=>(z??(z=Qe()),z),"we"),Z=a.now??Date.now,T=null,P,Y,me=t((e,r)=>`${e.url}
|
|
2
|
+
${e.siteKey}
|
|
3
|
+
${r}`,"Ie"),W=t((e,r)=>{let i=We(e,{signal:re.signal,subject:r});return i.then(()=>{Y=void 0},o=>{let s=Be(o);u||s==="aborted"||(Y=s,O({check:"attestation",kind:"unavailable",engineKind:s}))}),i},"ce"),he=t((e,r)=>e!==null&&e.key===r&&Z()-e.at<ft,"Me"),ve=t(e=>{let r=e?.challenge??null;if(e===null||r===null||u)return;let i=me(r,F(e.sessionId));if(he(T,i))return;let o=W(r,F(e.sessionId));o.catch(()=>{}),T={key:i,at:Z(),token:o}},"ve"),Xe=t(async(e,r)=>{let i=me(e,r),o=T;T=null;let s=he(o,i),y=s?o.at:Z(),w=s?o.token.catch(()=>W(e,r)):W(e,r);w.catch(()=>{});let v,c=new Promise(_=>{v=setTimeout(()=>_("late"),mt)});try{let _=await Promise.race([w.then(C=>({token:C}),C=>({error:Be(C)})),c]);return _==="late"&&!u&&T===null&&(T={key:i,at:y,token:w}),_}finally{clearTimeout(v)}},"mt"),ye=t(async()=>{P=void 0;let e=await m(),r=e.challenge;if(r==null)return{};let i=await Xe(r,F(e.sessionId));return i!=="late"&&"token"in i?{channel:"hosted_web",turnstileToken:i.token}:(P=i!=="late"?i.error:Y,{channel:"hosted_web"})},"Ee"),et=t(()=>P,"ht"),O=t(e=>{if(u)return;let r=f.reportCaptureIssue;if(r===void 0)return;let i=e.formFactor;try{i??(i=ke())}catch{}try{Promise.resolve(r.call(f,{...e,...i!==void 0?{formFactor:i}:{}})).catch(()=>{})}catch{}},"G"),h=null,_e=Promise.resolve(),x=0,tt=t(async()=>{let e=await m();for(let r=0;r<vt&&!u&&!A(e)&&R(e)===void 0&&Te(e).some(i=>i.state==="processing")&&(await D(ht),!u);r+=1)e=await b();return e},"St"),nt=t(async(e,r,i)=>{let{capture:o}=e,s=t(()=>u,"h"),y=t(()=>e.alive&&e.attempt===i,"b"),w=t(c=>{y()&&o.setFlowState(c)},"E"),v=t(c=>{if(!s()&&(c.status==="unavailable"&&c.reasonCode!==void 0&&!Me(c.reasonCode)&&O({check:"liveness",kind:"unavailable",phase:"upload",engineKind:c.reasonCode,attempt:Math.max(0,e.issues.value)}),$(c),!!y())){if(c.status==="retry"&&Ze==="auto"){o.handle.retry();return}o.setFlowState("done")}},"P");if(r.degraded==="NO_RECORDER"){let c=l?.sessionId??(await m().catch(()=>null))?.sessionId??"";v(S(c,"no_recorder"));return}w("uploading");try{if(await fe(),s())return;let c=await m(),_;if(!A(c)&&E(c)!==null){await le(!1),v(S(c.sessionId,"method_required"));return}if(!A(c)){if(R(c)?.checkType==="population_registry"){v(S(c.sessionId,ce?"nni_unbound":ue?"network":"registry_unavailable"));return}if(await k(),s())return;_=l??c;let C=await xe({...q,artifacts:r,getAttestation:ye,attestationError:et,getView:t(()=>l??c,"getView"),refreshView:b,applySubmit:H,onPhase:w,isCancelled:s,onKeyframePromoted:t(B=>{ne=B},"onKeyframePromoted")});if(s())return;if(C.kind==="unavailable"){let B=S(c.sessionId,C.reason),be=C.reason==="attestation"?P:void 0;v(be!==void 0?{...B,attestationError:be}:B);return}if(C.kind==="resync"&&await b(),l!==null&&E(l)!==null){await le(!1),v(S(c.sessionId,"method_required"));return}c=await tt()}v(X(c,{autoRetry:p,previous:_}))}catch{if(s())return;v(S(l?.sessionId??"","network"))}},"yt"),rt=t((e,r)=>{let i=e.attempt;x>0&&e.alive&&e.capture.setFlowState("uploading"),x+=1,_e=_e.then(()=>nt(e,r,i)).finally(()=>{x-=1,x===0&&I?.onChainIdle()}).catch(()=>{})},"gt"),ge=t(e=>{h?.capture.handle.destroy(),h!==null&&(h.alive=!1);let r=Le(e,I?.captureInternals?.(e)??a.capture,()=>l?.capture?.liveness?.keyframe?.rank===!0,ie,()=>l?.capture?.liveness?.screenRamp,{session:t(()=>j(l),"session"),onModeChange:t(s=>{U=s},"onModeChange")}),i={capture:r,alive:!0,attempt:0,issues:Se()};h=i,r.handle.on("error",s=>{O(Ae("liveness",s,i.issues.value))}),r.handle.on("state",s=>{if(i.issues.note(s),s==="starting"){i.attempt+=1,ve(l);let y=l===null?void 0:R(l)?.checkType;(y==="liveness"||y==="face_match")&&k().catch(()=>{})}}),r.handle.on("captured",s=>{Promise.resolve().then(()=>rt(i,s))});let o=r.handle;return{get state(){return o.state},get captureMode(){return o.captureMode},get facingMode(){return o.facingMode},on:t((s,y)=>o.on(s,y),"on"),start:t(async s=>{if(l===null&&await m().catch(()=>{}),!!i.alive)return o.start(s)},"start"),retry:t(()=>o.retry(),"retry"),switchCamera:t(()=>o.switchCamera(),"switchCamera"),canSwitchCaptureMode:t(()=>o.canSwitchCaptureMode(),"canSwitchCaptureMode"),setCaptureMode:t(s=>o.setCaptureMode(s),"setCaptureMode"),destroy:t(()=>{i.alive=!1,h===i&&(h=null),o.destroy()},"destroy")}},"Ve"),it=t(async()=>{if(u)return null;try{let e=await m();return u?null:E(e)}catch{return null}},"Ct"),at=t(async()=>{if(u)return"self";try{let e=await m();if(u)return"self";let r=j(e);return r==="choice"?L()??r:r}catch{return"self"}},"_t"),ot=t(async()=>{if(u)return!1;try{let e=await m();return u||A(e)||Q()?!1:ee(e,R(e))==="phone"||ee(e,N(e,"liveness"))==="phone"}catch{return!1}},"kt"),st=t(async()=>{if(u)return!1;try{let e=await m();return!u&&e.returning===!0}catch{return!1}},"Pt"),lt=t(async e=>{let r=(await m()).plan?.choice,i=r?.options.find(s=>Ie[s.service]===e);if(!i)throw new RangeError(`method ${String(e)} is not offered`);let o=await f.choose(r.nodeId,i.id);u||g(o)},"bt"),J=null,ut=t(()=>(J??(J=import("./plan-runner-EP26JU6A-LU7KJ6JU.js").then(e=>{let r=e.createPlanRunner({runtime:q,currentView:t(()=>l,"currentView"),cameraMode:ie,captureModeSwitch:{pick:L,choose:t(i=>{U=i},"choose")},ensureView:m,refreshView:b,ensureConsent:t(()=>k(),"ensureConsent"),liveness:ge,stopLiveness:t(()=>{h!==null&&(h.alive=!1,h.capture.handle.destroy(),h=null)},"stopLiveness"),chainBusy:t(()=>x>0,"chainBusy"),destroyed:t(()=>u,"destroyed"),sleep:D,isMobile:Q,now:a.now??Date.now,keptFaceKey:t(()=>ne,"keptFaceKey"),setView:g,baseCapture:a.capture,emitStep:t(i=>{u||M.emit("step",i)},"emitStep"),emitResult:Je,reportCaptureIssue:O,documentInternals:a.document,portraitInternals:a.portrait,livePhotoInternals:a.livePhoto,uploadInternals:a.upload,pageCameraInternals:a.pageCamera});return I=r,r})),J),"xt");return{consent:t(()=>k(),"consent"),startRegistry:fe,methodChoice:it,selectMethod:lt,reportCameraUnavailable:t(async e=>{await k();let r=f.reportCameraUnavailable;if(r===void 0)throw new TypeError("this client cannot report a missing camera");let i=await r.call(f,e).catch(o=>{if(o instanceof V&&o.code==="check_out_of_order")return f.getSession();throw o});u||g(i)},"reportCameraUnavailable"),reportCaptureIssue:O,testerGate:t(async e=>{let r=f.testerGate;if(r===void 0)throw new TypeError("this client cannot run the tester gate");let i=e.clip,o=we(e.clipMime??"");if(i===void 0||!Pe.includes(o))throw new TypeError("the capture has no clip");await k();let s=await Re(f,"clip",o,i.size,{engine:e.engine,durationMs:e.clipMs});await f.uploadToSpaces(s.uploadUrl,i,o);let{key:y}=await f.completeMedia(s.key),w=await ye(),v=await r.call(f,{clipKey:y,attestation:w,captureChannel:e.captureChannel,capture:{...Ne(e),attestationError:P}}),{bound:c,..._}=v;return u||(_.plan!==void 0?g(_):await b()),{bound:c===!0}},"testerGate"),mobileRequired:ot,captureMode:at,chooseCaptureMode:t(e=>{U=e},"chooseCaptureMode"),get captureChoice(){return L()},returning:st,liveness:ge,run:t(async()=>{if(u)throw new Error("verification destroyed");return(await ut()).run()},"run"),currentStep:t(()=>I?.current()??null,"currentStep"),voiceClips:t(async()=>{if(u)return null;try{let e=await m();return u?null:e.voice??null}catch{return null}},"voiceClips"),on:t((e,r)=>M.on(e,r),"on"),destroy:t(()=>{u=!0,re.abort(),I?.destroy(),h!==null&&(h.alive=!1,h.capture.handle.destroy(),h=null),M.clear()},"destroy")}}t(bt,"Tt");var Fe=["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"],je=["carte_identite","passport","residence_permit","drivers_license"],kt=["carte_identite","passport","residence_permit"];function te(n,a){let d=n.byIssuer?.[a]??n.default;return je.filter(p=>d==="*"?kt.includes(p):d.includes(p))}t(te,"Dt");function He(n,a=Fe){return[...new Set([...a,...Object.keys(n.byIssuer??{})])].filter(d=>te(n,d).length>0).sort()}t(He,"En");var qe=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"}),Ft=new Map(Object.entries(qe)),jt=new Map(Object.entries(qe).map(([n,a])=>[a,n]));var Ht=10*1024*1024;function wn(n){if(n==="permission")return"denied";if(n==="notfound"||n==="insecure"||n==="unsupported")return"no_camera"}t(wn,"oe");var wt=/^[A-Z0-9][A-Z0-9 -]{0,39}$/,Ct=Object.freeze({normalize:t(n=>n.trim().toUpperCase().replace(/\s+/g," "),"normalize"),check:t(n=>wt.test(n),"check"),registrySources:Object.freeze([]),describe:"number must be 1 to 40 letters, digits, spaces or hyphens"}),Mt=/^[A-Z0-9]{4,20}$/,$e=t(n=>n.trim().toUpperCase().replace(/[\s-]+/g,""),"R"),ze=Object.freeze({normalize:$e,check:t(n=>Mt.test($e(n)),"check"),registrySources:Object.freeze([]),describe:"number must be 4 to 20 letters or digits"});function At(n){return typeof n=="string"&&/^\d{10}$/.test(n)&&Number(n)%97===1}t(At,"ae");var St=Object.freeze({normalize:t(n=>n.trim(),"normalize"),check:t(n=>At(n),"check"),registrySources:Object.freeze(["MR.anrpts"]),describe:"number must be the 10-digit Mauritanian national ID number with a valid check digit"}),It=Object.freeze({...ze,check:t(n=>/^\d{8}$/.test(n.trim()),"check"),describe:"number must be the 8-digit Mauritanian driver's license number"}),Tt=Object.freeze({"MR:national_id":St,"MR:drivers_license":It});function Et(n,a){return Tt[`${n.toUpperCase()}:${a}`]??(a==="drivers_license"?ze:Ct)}t(Et,"m");var Cn=Object.freeze({MRT:"MR"});function Mn(n){return Et("MR","national_id").check(n)}t(Mn,"le");function Rt(n){let a="";for(let d of n){let p=d.codePointAt(0)??0;p>=1632&&p<=1641?a+=String(p-1632):p>=1776&&p<=1785?a+=String(p-1776):d!==" "&&d!=="-"&&d!==" "&&(a+=d)}return a}t(Rt,"E");function An(n){return Rt(n)}t(An,"me");var Sn=te,In=He;var Pt=t(()=>import("./create-document-capture-OXPLKHOF-GVCM77EK.js"),"H");function Ot(){Pt().then(n=>n.warmDocumentCapture()).catch(()=>{})}t(Ot,"D");function Tn(){Ot()}t(Tn,"Ke");var xt=t(()=>import("./create-portrait-capture-5VGYZUOK-N3333DJC.js"),"L");function Nt(){xt().then(n=>n.warmPortraitCapture()).catch(()=>{})}t(Nt,"I");function En(){Nt()}t(En,"Ye");export{gt as a,wn as b,Mn as c,An as d,Sn as e,In as f,Tn as g,En as h};
|