@sekyro/elements 0.1.0-rc.5 → 0.1.0-rc.7
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 +17 -0
- package/README.md +7 -8
- package/dist/cdn/chunks/{capture-session-doc-FRBI7OKF-AIBTLOVK.js → capture-session-doc-LUA4Y7PZ-LOMSB7V7.js} +1 -1
- package/dist/cdn/chunks/{chunk-TDXKYHM3.js → chunk-33KMCERZ.js} +1 -1
- package/dist/cdn/chunks/{chunk-BM5R2ZWK.js → chunk-3ELDB5WG.js} +1 -1
- package/dist/cdn/chunks/chunk-4FTXJ6MZ.js +1 -0
- package/dist/cdn/chunks/{chunk-HMNCXTZQ.js → chunk-AXYGICTN.js} +2 -2
- package/dist/cdn/chunks/{chunk-ZYDEMK5I.js → chunk-D2JAXHZF.js} +1 -1
- package/dist/cdn/chunks/{chunk-DOALUHGP.js → chunk-DBGVBAMW.js} +1 -1
- package/dist/cdn/chunks/{chunk-YJ47LCKM.js → chunk-DQAVYXAF.js} +1 -1
- package/dist/cdn/chunks/{chunk-LEQF5COS.js → chunk-ETJPN5LO.js} +1 -1
- package/dist/cdn/chunks/{chunk-J7ISCCTD.js → chunk-F4IM73DE.js} +1 -1
- package/dist/cdn/chunks/{chunk-JUVC4HGY.js → chunk-FGBKOHVK.js} +1 -1
- package/dist/cdn/chunks/{chunk-RPCMWL2U.js → chunk-FWZOENNU.js} +1 -1
- package/dist/cdn/chunks/{chunk-FDZFYD5T.js → chunk-HH33TJJH.js} +1 -1
- package/dist/cdn/chunks/{chunk-G2RZQTCT.js → chunk-L2UAVB62.js} +1 -1
- package/dist/cdn/chunks/{chunk-53GEI2Z4.js → chunk-M4UCDUJB.js} +1 -1
- package/dist/cdn/chunks/chunk-NYF6B3ZA.js +1 -0
- package/dist/cdn/chunks/{chunk-AKUFZTNC.js → chunk-OGRBLEPE.js} +1 -1
- package/dist/cdn/chunks/chunk-OPRYWIQM.js +33 -0
- package/dist/cdn/chunks/{chunk-33BAX5ZK.js → chunk-QMITFZK4.js} +1 -1
- package/dist/cdn/chunks/chunk-UGHWANZX.js +1 -0
- package/dist/cdn/chunks/{chunk-GIGTK355.js → chunk-W4RXHXFP.js} +1 -1
- package/dist/cdn/chunks/{create-document-capture-2YBCDEUB-GYUIXEAL.js → create-document-capture-ZTJKSEJB-NIBVRVLZ.js} +1 -1
- package/dist/cdn/chunks/{document-capture-view-FILRDMYI-OV7OFRCF.js → document-capture-view-ZKT3W6UE-FQWRXOHT.js} +1 -1
- package/dist/cdn/chunks/{eid-view-GO5HMDK7-RVZXTAKC.js → eid-view-7CTFIZ5R-PN357YSL.js} +1 -1
- package/dist/cdn/chunks/{email-otp-view-TXBTC2O4-GLLTZHLS.js → email-otp-view-MB334KKV-YKOW7MU6.js} +1 -1
- package/dist/cdn/chunks/{flow-views-AGAPIWYC-JJCSNEBI.js → flow-views-SRAXHC6K-J3H3VF3P.js} +1 -1
- package/dist/cdn/chunks/overlay-de-ILMZBGZH-DIOHROVO.js +1 -0
- package/dist/cdn/chunks/overlay-es-YLDY73HJ-LSXKLJQ2.js +1 -0
- package/dist/cdn/chunks/overlay-pt-GZXT2S6D-ASML67UA.js +1 -0
- package/dist/cdn/chunks/plan-runner-INQLWFGS-24JH5MQZ.js +1 -0
- package/dist/cdn/chunks/{portrait-capture-view-D3E7TJJF-5QFFD3OM.js → portrait-capture-view-DSUGE7PI-L7U7UVJY.js} +1 -1
- package/dist/cdn/chunks/{portrait-review-view-YOKRFRS7-BSDBK62O.js → portrait-review-view-PPYEEMYM-V4UMKNJE.js} +1 -1
- package/dist/cdn/chunks/{proof-of-address-view-T2JVJIXO-3D5KHNSZ.js → proof-of-address-view-2M6UDK76-ND76DOHN.js} +1 -1
- package/dist/cdn/define.js +1 -1
- package/dist/cdn/index.js +1 -1
- package/dist/{chunk-WZH7X3YQ.js → chunk-3BGD4PJ7.js} +1 -1
- package/dist/{chunk-SBCRIFUO.js → chunk-BJ2YKUCC.js} +1 -1
- package/dist/{chunk-OZAVYK2D.js → chunk-F2IPIZ4J.js} +1 -1
- package/dist/{chunk-3NK4SWKS.js → chunk-FSGDOTCB.js} +1 -1
- package/dist/{chunk-OIZMNQH3.js → chunk-KHBP6WWR.js} +1 -1
- package/dist/{chunk-D5FVJZ26.js → chunk-LNCABBX7.js} +1 -1
- package/dist/{chunk-53WAJ4BQ.js → chunk-OSC2SC2X.js} +1 -1
- package/dist/{chunk-YKCLH42N.js → chunk-PFH7S4E7.js} +1 -1
- package/dist/chunk-ULVT7UW6.js +1 -0
- package/dist/chunk-UUDX5GK4.js +33 -0
- package/dist/{chunk-KWQ47MUC.js → chunk-VEOZABLV.js} +1 -1
- package/dist/{chunk-UXGIWFTO.js → chunk-XLLG6AKG.js} +1 -1
- package/dist/{chunk-UO2JAUR5.js → chunk-YQ7XHAQJ.js} +1 -1
- package/dist/define.cjs +5 -5
- package/dist/define.js +1 -1
- package/dist/{document-capture-view-FILRDMYI-E73FWJ6Y.js → document-capture-view-ZKT3W6UE-5JRPJOO5.js} +1 -1
- package/dist/{eid-view-GO5HMDK7-WKALLDOA.js → eid-view-7CTFIZ5R-OL2YXQZO.js} +1 -1
- package/dist/{email-otp-view-TXBTC2O4-NX4QO2MA.js → email-otp-view-MB334KKV-Q7237EQV.js} +1 -1
- package/dist/{flow-views-AGAPIWYC-7BEC3EVR.js → flow-views-SRAXHC6K-DUSVVMFO.js} +1 -1
- package/dist/index.cjs +5 -5
- package/dist/index.d.cts +8 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +1 -1
- package/dist/overlay-de-ILMZBGZH-L5N7BMI4.js +1 -0
- package/dist/overlay-es-YLDY73HJ-JYBZEXG5.js +1 -0
- package/dist/overlay-pt-GZXT2S6D-WCIUJ4DI.js +1 -0
- package/dist/{portrait-capture-view-D3E7TJJF-SJN6ZKF2.js → portrait-capture-view-DSUGE7PI-HBLXJDXY.js} +1 -1
- package/dist/{portrait-review-view-YOKRFRS7-X2GXYLR6.js → portrait-review-view-PPYEEMYM-W66WNNUM.js} +1 -1
- package/dist/{proof-of-address-view-T2JVJIXO-6WHTGQQY.js → proof-of-address-view-2M6UDK76-27QSU4R3.js} +1 -1
- package/dist/styles.css +14 -8
- package/package.json +2 -2
- package/sbom.cdx.json +4 -4
- package/dist/cdn/chunks/chunk-32KM6WDQ.js +0 -1
- package/dist/cdn/chunks/chunk-H5GXVL63.js +0 -1
- package/dist/cdn/chunks/chunk-KLODCY6G.js +0 -1
- package/dist/cdn/chunks/chunk-RM3QCXAZ.js +0 -33
- package/dist/cdn/chunks/overlay-de-YOFRSJUH-QVDBX4EK.js +0 -1
- package/dist/cdn/chunks/overlay-es-EDOMRYLM-5UDBEJJV.js +0 -1
- package/dist/cdn/chunks/overlay-pt-UFWRNW4M-J4ZII6O3.js +0 -1
- package/dist/cdn/chunks/plan-runner-KQM7I4MR-HEXIU27Q.js +0 -1
- package/dist/chunk-OT335VGJ.js +0 -1
- package/dist/chunk-W6AA5J75.js +0 -33
- package/dist/overlay-de-YOFRSJUH-KXGTVVJC.js +0 -1
- package/dist/overlay-es-EDOMRYLM-DGVRFM6A.js +0 -1
- package/dist/overlay-pt-UFWRNW4M-7JSJJ7NU.js +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @sekyro/elements
|
|
2
2
|
|
|
3
|
+
## 0.1.0-rc.7
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Carries the @sekyro/react release of this version: the changes in its changelog reach the element.
|
|
8
|
+
|
|
9
|
+
## 0.1.0-rc.6
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- f3470cd: The result screen's words fit a person who is still in your app or page. The verified line reads "Your verification is complete." (no more "You can go back to {org}"). The inconclusive, unavailable and expired screens no longer ask for a new link: inconclusive says "Start again from {org}, in good light and holding the phone upright. Contact {org} if this keeps happening.", unavailable says "Try again later from {org}, or contact {org} if this keeps happening.", and expired is titled "This verification has ended" with "Start again from {org}.". The verified title now says what the session proved, from `result.level` and `result.assurance`: "Your identity is verified" at level 3, "Your phone number is confirmed" or "Your email address is confirmed" for a level 1 code, and "You're verified" otherwise (level 2, a liveness check, no longer claims an identity). All six languages. New string keys you can override through `strings`: `native.result.expiredTitle`, `session.result.verified.titleHuman`, `session.result.verified.titlePhone`, `session.result.verified.titleEmail`.
|
|
14
|
+
- 5379d91: A level 1 result that is not exactly one phone code or one email code (for example both confirmed, or a contact your organization supplied) is now titled "Your details are confirmed" instead of "You're verified". Level 2 and a result with no level keep "You're verified". The same on Android, iOS and Flutter. All six languages. New string key you can override through `strings`: `session.result.verified.titleContact`.
|
|
15
|
+
- 14faf9e: The result screen of a simulated Sandbox session now shows a short notice: "This was a simulation", with what to do to run real checks (enroll a Sandbox tester, or run the tester check at the start of the session). It appears only on a Sandbox session that no enrolled tester ran, never in Live, and it follows your theme and the six languages. The result you receive (`onResult`, `onClose`, the `sekyro-result` event) carries `sandbox: { simulated: true, reason }` with `@sekyro/web` at this release or later. Three string keys are new and can be overridden through `strings`: `sandbox.simulatedTitle`, `sandbox.simulatedNoTesters` and `sandbox.simulatedGate`.
|
|
16
|
+
- Updated dependencies [94565f2]
|
|
17
|
+
- Updated dependencies [14faf9e]
|
|
18
|
+
- @sekyro/web@0.1.0-rc.28
|
|
19
|
+
|
|
3
20
|
## 0.1.0-rc.5
|
|
4
21
|
|
|
5
22
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -79,6 +79,10 @@ The string attributes reflect: setting the property sets the attribute, and the
|
|
|
79
79
|
| `documentLiveMrz` | `DocumentLiveMrzOptions` | Live MRZ reading on the document step: `workerUrl`, `assetBaseUrl`, or `mode: "off"`. |
|
|
80
80
|
| `voice` | `false \| VoiceOptions` | Spoken guidance options. Set, it wins over the `voice` attribute. |
|
|
81
81
|
|
|
82
|
+
The element creates its own verification with the default `rearm: "auto"`: after a retryable refusal the camera
|
|
83
|
+
reopens by itself. For the coaching screen and a "Start a new attempt" button instead, create the verification with
|
|
84
|
+
`createVerification({ clientToken, locale, rearm: "manual" })` and set it as `verification`.
|
|
85
|
+
|
|
82
86
|
Properties set before the element is defined (a framework binding, a script that ran first) are picked up when it
|
|
83
87
|
upgrades.
|
|
84
88
|
|
|
@@ -232,17 +236,12 @@ page's resets: under Bootstrap's reboot or Tailwind's preflight the flow looks a
|
|
|
232
236
|
## Sandbox
|
|
233
237
|
|
|
234
238
|
A Sandbox session shows its test chrome in the element exactly as in `@sekyro/react`: the "Test session" badge, the
|
|
235
|
-
"Skip with test data" action
|
|
239
|
+
"Skip with test data" action, the tester check and, on the result screen of a session no enrolled tester ran, the
|
|
240
|
+
"This was a simulation" notice. The `sekyro-result` detail then carries `sandbox: { simulated: true, reason }`.
|
|
241
|
+
Nothing to configure: it follows the session.
|
|
236
242
|
|
|
237
243
|
## Size
|
|
238
244
|
|
|
239
245
|
React and ReactDOM (production builds) and the whole flow, gzip, measured by `npm run size`: about 143 KiB for the
|
|
240
246
|
npm entry (your bundler adds `@sekyro/web`), about 174 KiB for the CDN entry with `@sekyro/web`. Each step's view,
|
|
241
247
|
the document camera and the es, pt and de copy load later, when used.
|
|
242
|
-
|
|
243
|
-
## Scripts
|
|
244
|
-
|
|
245
|
-
- `npm run build`: the npm build (ESM and CJS), rolled-up declarations, `styles.css` and its fonts, and the CDN build.
|
|
246
|
-
- `npm test`: the manifest check and the unit tests (jsdom, over the real flow); `npm run test:dist` checks the build.
|
|
247
|
-
- `npm run e2e`: Playwright, the plain HTML page against a fixture-mode API (after `npm run build`).
|
|
248
|
-
- `npm run size`, `npm run api:check`, `npm run manifest`.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as a,d as s,e as o,f as r,g as _,h as t,i as A,j as C,k as D,l as p,m as i}from"./chunk-
|
|
1
|
+
import{c as a,d as s,e as o,f as r,g as _,h as t,i as A,j as C,k as D,l as p,m as i}from"./chunk-L2UAVB62.js";import"./chunk-WPRIGJHG.js";import"./chunk-2FETDQV5.js";import"./chunk-EWTKC2C2.js";import"./chunk-L22GFJQV.js";import"./chunk-W4RXHXFP.js";import"./chunk-P7K7ELYZ.js";import"./chunk-JS2IXPNL.js";import"./chunk-4FHWXBOB.js";export{i as CAPTURE_CANDIDATE_SPACING_MS,p as CAPTURE_EXTRA_CANDIDATES,C as CaptureSessionDoc,o as DOC_BLACK_FRAME_LUMA,r as DOC_BLACK_FRAME_TICKS,_ as DOC_CADENCE_HZ,s as DOC_FIRST_FRAME_MS,t as DOC_SHUTTER_DEFAULTS,D as passportBandOf,A as resolveDocShutterTuning,a as warmDocDetector};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as d}from"./chunk-
|
|
1
|
+
import{a as d}from"./chunk-DQAVYXAF.js";import{a as t}from"./chunk-5QL6W6FW.js";import{a as i,c as r}from"./chunk-4FHWXBOB.js";var s=r(d(),1);var u=(0,s.createContext)(null);function c(a,n,o){let e=n.detail;return{check:a,kind:n.kind,...e?.name!==void 0?{name:e.name}:{},...e?.phase!==void 0?{phase:e.phase}:{},...e?.engineKind!==void 0?{engineKind:e.engineKind}:{},attempt:Math.max(0,Math.min(1e3,o))}}i(c,"a");t(c,"captureIssueOf");function m(a,n){if(a!==void 0)try{a(n)}catch{}}i(m,"o");t(m,"sendCaptureIssue");export{u as a,c as b,m as c};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{d as v}from"./chunk-
|
|
1
|
+
import{d as v}from"./chunk-AXYGICTN.js";import{a as y,b as C}from"./chunk-DQAVYXAF.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 @@
|
|
|
1
|
+
import{d as St,e as Wt,f as qt,g as zt}from"./chunk-W4RXHXFP.js";import{a as it,b as Ht,c as rt,d as Kt}from"./chunk-P7K7ELYZ.js";import{a as Tt,b as V,c as _t,d as Et,e as At,g as It,h as tt,i as xt,j as Dt,k as Lt,l as Bt}from"./chunk-CW56KMMH.js";import{a as Rt,b as Ct,c as Ot,d as Gt,e as Pt,f as et,g as K,h as Ut,i as Ft,j as Nt}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:Xt(s.map(d=>d.boundingBox??{width:0,height:0}),s.indexOf(a))};return Vt(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 G,Me=(G=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:Xt(a,n)};return Vt(h,t,e,r)}destroy(){}},o(G,"b"),G);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 Xt(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(Xt,"f");var at="/models-v3",_e=["native","blaze"],P,nt=(P=class extends Error{constructor(t){super(`no detector tier available (${t})`),this.name="DetectorLadderError",this.fallbackReason=t}},o(P,"x"),P);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 Vt(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(Vt,"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 Zt?"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,Zt=(U=class extends Error{},o(U,"g"),U);function Se(i,t){return new Promise((e,r)=>{let s=setTimeout(()=>{r(new Zt(`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 jt(){return typeof OffscreenCanvas=="function"&&typeof createImageBitmap=="function"&&typeof Worker=="function"}o(jt,"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,$t=(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=[...Rt.filter(i=>i.startsWith("video/mp4")),"video/webm;codecs=h264","video/webm;codecs=avc1","video/webm;codecs=vp8","video/webm;codecs=vp9","video/webm"],ae=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(!(ae.has(r)||e&&r.startsWith("video/mp4")))try{if(i(r))return r}catch{}return""}o(De,"fe");function Yt(i){i!==""&&ae.add(i)}o(Yt,"V");function Re(i){return i.replace(/^video\/x-matroska/i,"video/webm")}o(Re,"ge");function ne(i){let t=/codecs=["']?([^,;"']+)/i.exec(i);return t?t[1].trim():i.split(";")[0].trim()}o(ne,"ut");function Ce(){let i=globalThis.MediaRecorder;return i&&typeof i.isTypeSupported=="function"?t=>i.isTypeSupported(t):void 0}o(Ce,"Oe");var oe=2500,Oe=1e3,Ge=1500,Qt=25e5,Pe=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 Jt(i,t){return i.stats===void 0?!1:i.stats===null?!0:i.stats.durationMs<t-Be}o(Jt,"H");function We(i,t){return i.stats?t.stats?i.stats.durationMs>t.stats.durationMs:!0:!1}o(We,"be");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=oe,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:Qt}:{videoBitsPerSecond:Qt})}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||Ct),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,Ge)}else u()},"g"),m=this.now();if(a===void 0){this.hardStopTimer=setTimeout(w,s);return}let g=null,y=!1;this.hardStopTimer=setTimeout(w,s+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,Pe)}},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 ut(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(ut,"O");function Ze(i,t){return ut(i)?Math.max(t,Math.ceil(i.clipMs)):t}o(Ze,"ye");function je(i,t){let e=t.now??(()=>performance.now()),r=ut(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)})},"g");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,"P"),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,te=(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,ee=(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 ie(i){if(typeof i!="function")return!1;try{return/\{\s*\[native code\]\s*\}\s*$/.test(Function.prototype.toString.call(i))}catch{return!1}}o(ie,"Te");function si(i=globalThis){return ie(i.navigator?.mediaDevices?.getUserMedia)&&ie(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,"K");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,re={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=Ot();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}=Tt(_t(),this.facing).video;a=await Bt(this.facing,d,{getUserMedia:s,enumerateDevices:vi(e)})}catch(h){if(t!==this.attempt)return;if(h instanceof Lt){this.fail("backcamera",{phase:"acquiring",name:K(h)});return}this.fail(Ft(h),{phase:"acquiring",name:K(h)});return}if(St(a),Nt(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=Et(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&&jt()?async()=>{try{return await $t.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=Wt(),c=e.deviceClass??qt(l);this.profiler=new zt(c),this.options.telemetry?.({type:"profile",staticClass:c,activeClass:this.profiler.deviceClass,simd:l.simd}),this.gate=new te(e.thresholds??{}),this.blockStats=new ee,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?re: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=ut(h),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,oe),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;Yt(b.failed.requestedMimeType??"")}else m=b,Jt(b.clip,w)?b.clip.stats===null&&Yt(b.clip.requestedMimeType??""):v();if(m===null||Jt(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 te(this.options.thresholds??{}),this.blockStats=new ee,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=se(t,e,96);return r===null?re:{sharpness:rt(r),exposure:Kt(r),meanLuma:Ht(r)}}centerSharpness(t){let e=Z(t),r=se(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 se(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(se,"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,dt=Symbol.for("@sekyro/web.preload.v1");function mt(){let i=globalThis;return i[dt]??(i[dt]=new Map),i[dt]}o(mt,"g");function Y(i){let t=(i??at).replace(/\/+$/,"");return t===""?"/":t}o(Y,"S");function ue(i){let t=mt(),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 ft(i,t){if(i.status!==t){i.status=t;for(let e of[...i.listeners])e(t)}}o(ft,"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(pt(i,t))}),r}o(Si,"ge");function pt(i,t){if((i.status==="loading"||i.status==="ready")&&i.promise!==null)return i.promise;ft(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,ft(i,"ready"),"ready"),n=>(i.detectorPromise===e&&(i.detectorPromise=null,i.detector=null,ft(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(pt,"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):pt(e,t)}o(Yi,"we");function Qi(i){return mt().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=mt().get(t);if(!(e===void 0||e.detector===null&&e.detectorPromise===null&&e.scheduled===null))return async()=>{e.scheduled!==null&&pt(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=Ut(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??It,c="user",h=xt(),d=r(),u=At(),v=!Gt(),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,gt=o(()=>{i.video.videoWidth>0&&i.video.videoHeight>0&&(_=i.video.videoWidth,H=i.video.videoHeight)},"K"),vt=Dt({enabled:i.keepScreenAwake!==!1}),X=o(f=>{p=f,vt.setActive(f==="starting"||f==="gating"||f==="recording"),u.emit("state",f)},"M"),Q=o(()=>u.emit("gate",{progress:T,hint:M,faceDetected:A}),"R"),yt=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),yt(),E==="recording"&&(gt(),b=n(),M="hold",T=1,Q())}),y.on("checks",f=>{gt(),T=f.progress,A=f.factors.presence>0,Q(),yt()}),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,Mt=S!==void 0?Math.round(S.durationMs):b!==null&&I!==null?Math.max(0,Math.round(I-b)):void 0,kt=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,...Mt!==void 0?{clipMs:Mt}:{},...S!==void 0?{clipFrames:S.frames}:{},...kt!==void 0?{fps:kt}:{},...f.clipRetakes!==void 0?{clipRetakes:f.clipRetakes}:{},...f.clipMimeType!==void 0?{codec:ne(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))})],wt=!1;function fe(){return J||wt||d!=="assisted"||a===void 0||a.session()!=="choice"?!1:(wt=!0,a.onModeChange("self"),d="self",c=tt("self"),X("mode_switch"),y.restart(c),!0)}o(fe,"ce");let bt=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:bt,setCaptureMode:o(async f=>{if(f===r()||!await bt()||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();vt.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,3 +1,3 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{C as ee,D as j,E as De,F 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,v as Re,w as Pe,x as Oe,y as xe,z as Ne}from"./chunk-NYF6B3ZA.js";import{f as Le}from"./chunk-4FTXJ6MZ.js";import{b as be,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 Be(n){return n===void 0?void 0:n.idNumberFromDocument??n.nniFromDocument}t(Be,"j");var Ve="https://api.sekyro.ai",pt=5e3,ft=24e4,mt=3e4,ht=1500,vt=10;function Ke(n){return n instanceof Error&&n.name==="ChallengeError"&&n.code||"challenge_failed"}t(Ke,"nt");function yt(n){return new Promise(a=>setTimeout(a,n))}t(yt,"Et");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,"Tt");function gt(n){return kt(n,{})}t(gt,"wn");function kt(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)},"A"),m=t(()=>l!==null?Promise.resolve(l):(G??(G=f.getSession().then(e=>(g(e),e)).finally(()=>{G=null})),G),"_"),k=t(async()=>{let e=await f.getSession();return g(e),e},"I"),q=t(async(e,r)=>{e.plan!==void 0?g(e):await k()},"ne"),B=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"),b=t(e=>e?.force===!0?ae(!0):(B??(B=ae(!1).finally(()=>{B=null})),B),"v"),H={client:f,ensureConsent:t(e=>b(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)},"ft"),le=t(async e=>{let r=l;e&&(r=await k().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(H,(e,r)=>e.submitCheck("population_registry",{},{idempotencyKey:r})),"Oe"),pe=t(e=>dt(e)===!0||Be(N(e,"population_registry"))===!0,"Ae"),Qe=t(async()=>{try{let e=await m();if(A(e)||E(e)!==null||R(e)?.checkType!=="population_registry")return;if(!pe(e)&&Be(N(e,"population_registry"))===void 0&&(e=await k()),!pe(e)){ce=!0;return}await b(),await q(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 q(await de(),"population_registry")}}catch(e){if(e instanceof V&&(e.code==="check_not_active"||e.code==="step_not_on_path")){await k().catch(()=>{});return}ue=!0;return}l!==null&&A(l)&&$(X(l,{autoRetry:p}))},"mt"),fe=t(()=>(z??(z=Qe()),z),"Ie"),Z=a.now??Date.now,T=null,P,Y,me=t((e,r)=>`${e.url}
|
|
2
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-KQM7I4MR-HEXIU27Q.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-2YBCDEUB-GYUIXEAL.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};
|
|
3
|
+
${r}`,"we"),W=t((e,r)=>{let i=We(e,{signal:re.signal,subject:r});return i.then(()=>{Y=void 0},o=>{let s=Ke(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:Ke(C)})),c]);return _==="late"&&!u&&T===null&&(T={key:i,at:y,token:w}),_}finally{clearTimeout(v)}},"ht"),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,"St"),O=t(e=>{if(u)return;let r=f.reportCaptureIssue;if(r===void 0)return;let i=e.formFactor;try{i??(i=be())}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 k();return e},"yt"),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 b(),s())return;_=l??c;let C=await xe({...H,artifacts:r,getAttestation:ye,attestationError:et,getView:t(()=>l??c,"getView"),refreshView:k,applySubmit:q,onPhase:w,isCancelled:s,onKeyframePromoted:t(K=>{ne=K},"onKeyframePromoted")});if(s())return;if(C.kind==="unavailable"){let K=S(c.sessionId,C.reason),ke=C.reason==="attestation"?P:void 0;v(ke!==void 0?{...K,attestationError:ke}:K);return}if(C.kind==="resync"&&await k(),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"))}},"gt"),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(()=>{})},"Ct"),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")&&b().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}},"_t"),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"}},"kt"),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}},"Pt"),st=t(async()=>{if(u)return!1;try{let e=await m();return!u&&e.returning===!0}catch{return!1}},"bt"),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)},"xt"),J=null,ut=t(()=>(J??(J=import("./plan-runner-INQLWFGS-24JH5MQZ.js").then(e=>{let r=e.createPlanRunner({runtime:H,currentView:t(()=>l,"currentView"),cameraMode:ie,captureModeSwitch:{pick:L,choose:t(i=>{U=i},"choose")},ensureView:m,refreshView:k,ensureConsent:t(()=>b(),"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),"Rt");return{consent:t(()=>b(),"consent"),startRegistry:fe,methodChoice:it,selectMethod:lt,reportCameraUnavailable:t(async e=>{await b();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 b();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 k()),{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(kt,"Vt");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"],bt=["carte_identite","passport","residence_permit"];function te(n,a){let d=n.byIssuer?.[a]??n.default;return je.filter(p=>d==="*"?bt.includes(p):d.includes(p))}t(te,"Nt");function qe(n,a=Fe){return[...new Set([...a,...Object.keys(n.byIssuer??{})])].filter(d=>te(n,d).length>0).sort()}t(qe,"Tn");var He=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"}),jt=new Map(Object.entries(He)),qt=new Map(Object.entries(He).map(([n,a])=>[a,n]));var Ht=10*1024*1024;function Cn(n){if(n==="permission")return"denied";if(n==="notfound"||n==="insecure"||n==="unsupported")return"no_camera"}t(Cn,"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 Mn=Object.freeze({MRT:"MR"});function An(n){return Et("MR","national_id").check(n)}t(An,"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 Sn(n){return Rt(n)}t(Sn,"me");var In=te,Tn=qe;var Pt=t(()=>import("./create-document-capture-ZTJKSEJB-NIBVRVLZ.js"),"H");function Ot(){Pt().then(n=>n.warmDocumentCapture()).catch(()=>{})}t(Ot,"D");function En(){Ot()}t(En,"Ke");var xt=t(()=>import("./create-portrait-capture-5VGYZUOK-N3333DJC.js"),"L");function Nt(){xt().then(n=>n.warmPortraitCapture()).catch(()=>{})}t(Nt,"b");function Rn(){Nt()}t(Rn,"Ye");export{gt as a,Cn as b,An as c,Sn as d,In as e,Tn as f,En as g,Rn as h};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{d as I}from"./chunk-LEQF5COS.js";import{a as C,b as P,c as H}from"./chunk-YJ47LCKM.js";import{a as T}from"./chunk-H5GXVL63.js";import{a as u}from"./chunk-5QL6W6FW.js";import{a as s,b as D,c as N}from"./chunk-4FHWXBOB.js";var j=D(l=>{"use strict";var Q=C();function V(r){var e="https://react.dev/errors/"+r;if(1<arguments.length){e+="?args[]="+encodeURIComponent(arguments[1]);for(var t=2;t<arguments.length;t++)e+="&args[]="+encodeURIComponent(arguments[t])}return"Minified React error #"+r+"; visit "+e+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}s(V,"formatProdErrorMessage");function h(){}s(h,"noop");var c={d:{f:h,r:s(function(){throw Error(V(522))},"r"),D:h,C:h,L:h,m:h,X:h,S:h,M:h},p:0,findDOMNode:null},ee=Symbol.for("react.portal");function re(r,e,t){var n=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:ee,key:n==null?null:""+n,children:r,containerInfo:e,implementation:t}}s(re,"createPortal$1");var O=Q.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function M(r,e){if(r==="font")return"";if(typeof e=="string")return e==="use-credentials"?e:""}s(M,"getCrossOriginStringAs");l.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=c;l.createPortal=function(r,e){var t=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)throw Error(V(299));return re(r,e,null,t)};l.flushSync=function(r){var e=O.T,t=c.p;try{if(O.T=null,c.p=2,r)return r()}finally{O.T=e,c.p=t,c.d.f()}};l.preconnect=function(r,e){typeof r=="string"&&(e?(e=e.crossOrigin,e=typeof e=="string"?e==="use-credentials"?e:"":void 0):e=null,c.d.C(r,e))};l.prefetchDNS=function(r){typeof r=="string"&&c.d.D(r)};l.preinit=function(r,e){if(typeof r=="string"&&e&&typeof e.as=="string"){var t=e.as,n=M(t,e.crossOrigin),o=typeof e.integrity=="string"?e.integrity:void 0,i=typeof e.fetchPriority=="string"?e.fetchPriority:void 0;t==="style"?c.d.S(r,typeof e.precedence=="string"?e.precedence:void 0,{crossOrigin:n,integrity:o,fetchPriority:i}):t==="script"&&c.d.X(r,{crossOrigin:n,integrity:o,fetchPriority:i,nonce:typeof e.nonce=="string"?e.nonce:void 0})}};l.preinitModule=function(r,e){if(typeof r=="string")if(typeof e=="object"&&e!==null){if(e.as==null||e.as==="script"){var t=M(e.as,e.crossOrigin);c.d.M(r,{crossOrigin:t,integrity:typeof e.integrity=="string"?e.integrity:void 0,nonce:typeof e.nonce=="string"?e.nonce:void 0})}}else e==null&&c.d.M(r)};l.preload=function(r,e){if(typeof r=="string"&&typeof e=="object"&&e!==null&&typeof e.as=="string"){var t=e.as,n=M(t,e.crossOrigin);c.d.L(r,t,{crossOrigin:n,integrity:typeof e.integrity=="string"?e.integrity:void 0,nonce:typeof e.nonce=="string"?e.nonce:void 0,type:typeof e.type=="string"?e.type:void 0,fetchPriority:typeof e.fetchPriority=="string"?e.fetchPriority:void 0,referrerPolicy:typeof e.referrerPolicy=="string"?e.referrerPolicy:void 0,imageSrcSet:typeof e.imageSrcSet=="string"?e.imageSrcSet:void 0,imageSizes:typeof e.imageSizes=="string"?e.imageSizes:void 0,media:typeof e.media=="string"?e.media:void 0})}};l.preloadModule=function(r,e){if(typeof r=="string")if(e){var t=M(e.as,e.crossOrigin);c.d.m(r,{as:typeof e.as=="string"&&e.as!=="script"?e.as:void 0,crossOrigin:t,integrity:typeof e.integrity=="string"?e.integrity:void 0})}else c.d.m(r)};l.requestFormReset=function(r){c.d.r(r)};l.unstable_batchedUpdates=function(r,e){return r(e)};l.useFormState=function(r,e,t){return O.H.useFormState(r,e,t)};l.useFormStatus=function(){return O.H.useHostTransitionStatus()};l.version="19.2.0"});var W=D((de,B)=>{"use strict";function U(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(U)}catch(r){console.error(r)}}s(U,"checkDCE");U(),B.exports=j()});var z=N(C(),1),f=N(P(),1),a=N(P(),1);var E=N(C(),1),Z=N(W(),1),v=N(P(),1);var te=Array.from({length:56},(r,e)=>{let t=e/56*2*Math.PI-Math.PI/2,n=Math.cos(t),o=Math.sin(t);return{id:`tick-${e}`,frac:e/55,x1:150+108*n,y1:150+108*o,x2:150+138*n,y2:150+138*o,style:{transitionDelay:`${e*6}ms`}}});function F(r,e,t,n){return t?"var(--sekyro-color-success)":r?n?"color-mix(in srgb, var(--sekyro-color-warning) 75%, transparent)":e<.33?"color-mix(in srgb, var(--sekyro-color-brand) 55%, transparent)":e<.66?"color-mix(in srgb, var(--sekyro-color-brand) 80%, transparent)":"var(--sekyro-color-brand)":"color-mix(in srgb, var(--sekyro-color-surface) 32%, transparent)"}s(F,"T");u(F,"tickColor");var ae="M0 -50 H300 V350 H0 Z M50 150 a100,100 0 1 0 200,0 a100,100 0 1 0 -200,0 Z";function G({progress:r,phase:e,draining:t=!1}){let n=Math.min(1,Math.max(0,r)),o=Math.round(n*56),i=e==="checking",y=e==="recording",d=e==="frozen",m=i||d,p=i||y||d,k=e==="locked"||p,S=t&&!k;return(0,f.jsxs)("svg",{"aria-hidden":"true",viewBox:"0 0 300 300",preserveAspectRatio:"xMidYMid meet",className:"sekyro-stage__arc","data-testid":"sekyro-capture-arc","data-phase":e,"data-filled":o,"data-recording":y?"":void 0,"data-draining":S?"":void 0,children:[(0,f.jsx)("path",{fillRule:"evenodd",d:ae,fill:"color-mix(in srgb, var(--sekyro-color-fg) var(--sekyro-scrim, 96%), transparent)",style:{"--sekyro-scrim":m?"100%":"96%"},className:"sekyro-arc__scrim sekyro-capture-fade-in","data-testid":"sekyro-capture-scrim"}),(0,f.jsxs)("g",{className:e==="locked"?"sekyro-capture-settle":void 0,children:[(0,f.jsx)("g",{className:m?"sekyro-arc__ring sekyro-arc__ring--dim":"sekyro-arc__ring",children:te.map((g,x)=>(0,f.jsx)("line",{x1:g.x1,y1:g.y1,x2:g.x2,y2:g.y2,stroke:F(x<o,g.frac,k,S),strokeWidth:3,strokeLinecap:"round",style:g.style,className:"sekyro-arc__tick"},g.id))}),(0,f.jsx)("g",{className:e==="seeking"?"sekyro-capture-breathe":void 0,children:(0,f.jsx)("circle",{cx:150,cy:150,r:100,fill:"none",stroke:k?"var(--sekyro-color-success)":"var(--sekyro-color-surface)",strokeWidth:k?3.5:2.5,className:p?"sekyro-arc__guide sekyro-arc__guide--spin sekyro-capture-ring-spin":"sekyro-arc__guide sekyro-capture-fade-in","data-testid":"sekyro-capture-guide"})})]})]})}s(G,"x");u(G,"CaptureArc");function ne({videoRef:r,guidanceText:e,guidanceHint:t,guidanceKey:n,progress:o,phase:i,draining:y=!1,stillUrl:d,showChecking:m,operatorText:p=null,voicePrompt:k,overlay:S,reduceMotion:g=!1,modeSwitch:x=null}){let b=I(),w=i==="checking",_=w||i==="frozen",A=_&&m?b("capture.checking"):e,L=k?.(t,A,n);return(0,a.jsxs)("div",{className:g?"sekyro-stage sekyro-capture-reduce":"sekyro-stage","data-testid":"sekyro-capture-stage",children:[(0,a.jsx)("video",{ref:r,playsInline:!0,muted:!0,className:"sekyro-stage__video","data-testid":"sekyro-capture-video"}),d!==null&&_?(0,a.jsx)("img",{src:d,alt:b("capture.previewAlt"),className:"sekyro-stage__still sekyro-capture-develop","data-testid":"sekyro-capture-still"}):null,(0,a.jsx)(G,{progress:o,phase:i,draining:y}),S?.(r),L!=null&&!_?(0,a.jsx)("div",{className:"sekyro-stage__corner-start","data-testid":"sekyro-voice-slot",children:L}):null,x!==null&&!_?(0,a.jsx)($,{view:x,className:"sekyro-stage__corner-end sekyro-stage__mode-switch",kind:"chip"}):null,w&&m?(0,a.jsxs)("span",{className:"sekyro-stage__corner-end sekyro-stage__pill sekyro-capture-pill-in","data-testid":"sekyro-camera-off-pill",children:[(0,a.jsx)(Y,{}),b("capture.cameraOff")]}):null,(0,a.jsxs)("p",{"aria-live":"polite",className:"sekyro-stage__guidance","data-testid":"sekyro-capture-guidance",children:[(0,a.jsx)("span",{className:"sekyro-stage__guidance-text sekyro-capture-text-in",children:A},A),_&&m?(0,a.jsx)("span",{className:"sekyro-stage__guidance-hint",children:b("capture.checkingHint")}):p!==null&&!_?(0,a.jsx)("span",{className:"sekyro-stage__guidance-hint","data-testid":"sekyro-operator-line",children:p}):null]})]})}s(ne,"ne");u(ne,"CaptureStage");function $({view:r,className:e,kind:t}){let n=(0,z.useId)(),o=(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(K,{}),(0,a.jsx)("span",{children:r.label})]}),i={onClick:r.onSwitch,"aria-describedby":n,"data-testid":"sekyro-capture-mode-switch","data-mode":r.to};return(0,a.jsxs)(a.Fragment,{children:[t==="chip"?(0,a.jsx)(H,{kind:"chip",className:e,...i,children:o}):(0,a.jsx)("button",{type:"button",className:e,...i,children:o}),(0,a.jsx)("span",{id:n,className:"sekyro-visually-hidden",children:r.description})]})}s($,"H");u($,"ModeSwitchChip");function K(){return(0,a.jsxs)("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",className:"sekyro-icon",children:[(0,a.jsx)("path",{d:"M4 7.5h2.2l1.4-1.9h8.8l1.4 1.9H20a1.6 1.6 0 0 1 1.6 1.6v8.3A1.6 1.6 0 0 1 20 19H4a1.6 1.6 0 0 1-1.6-1.6V9.1A1.6 1.6 0 0 1 4 7.5Z"}),(0,a.jsx)("path",{d:"M15.4 11.9a3.5 3.5 0 0 0-6.1-1.4M15.4 11.9h-2.1m2.1 0V9.8"}),(0,a.jsx)("path",{d:"M8.6 13.4a3.5 3.5 0 0 0 6.1 1.4M8.6 13.4h2.1m-2.1 0v2.1"})]})}s(K,"D");u(K,"FlipCameraIcon");function Y(){return(0,a.jsxs)("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",className:"sekyro-icon sekyro-icon--sm",children:[(0,a.jsx)("path",{d:"M4 7.5h2.2l1.4-1.9h8.8l1.4 1.9H20a1.6 1.6 0 0 1 1.6 1.6v8.3A1.6 1.6 0 0 1 20 19H4a1.6 1.6 0 0 1-1.6-1.6V9.1A1.6 1.6 0 0 1 4 7.5Z"}),(0,a.jsx)("path",{d:"M3 3l18 18"})]})}s(Y,"G");u(Y,"CameraOffIcon");var ie=typeof window>"u"?E.useEffect:E.useLayoutEffect,R="data-sekyro-ramp",se=[["background-color","transparent"],["background-image","none"]];function q(r){let e=[],t=r.ownerDocument;for(let i=r;i!==null&&i!==t.documentElement;i=i.parentElement){if(!(i instanceof HTMLElement)&&!(i instanceof SVGElement))continue;let y=i.style;for(let[d,m]of se){let p=y.getPropertyValue(d),k=y.getPropertyPriority(d);y.setProperty(d,m,"important"),e.push(()=>{p===""?y.removeProperty(d):y.setProperty(d,p,k)})}}let n=t.documentElement,o=n.hasAttribute(R);return n.setAttribute(R,""),o||e.push(()=>n.removeAttribute(R)),()=>{for(let i of e.reverse())i()}}s(q,"z");u(q,"clearAncestorBackdrops");function X(r){return{position:"fixed",inset:0,minWidth:"100vw",minHeight:"100lvh",margin:0,padding:0,border:0,zIndex:-1,pointerEvents:"none",backgroundColor:T(r)}}s(X,"B");u(X,"washStyle");function J(r){return{position:"absolute",inset:0,pointerEvents:"none",backgroundColor:T(r)}}s(J,"Y");u(J,"coverStyle");function oe({colour:r}){let e=(0,E.useRef)(null),t=r!==null;return ie(()=>{let n=e.current?.parentElement;if(!(!t||n===null||n===void 0))return q(n)},[t]),r===null||typeof document>"u"?null:(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)("div",{ref:e,"aria-hidden":"true","data-testid":"sekyro-screen-ramp-cover","data-colour":r,style:J(r)}),(0,Z.createPortal)((0,v.jsx)("div",{"aria-hidden":"true","data-testid":"sekyro-screen-ramp","data-colour":r,style:X(r)}),document.body)]})}s(oe,"de");u(oe,"ScreenRampLayer");export{W as a,ne as b,$ as c,oe as d};
|
|
1
|
+
import{d as I}from"./chunk-ETJPN5LO.js";import{a as C,b as P,c as H}from"./chunk-DQAVYXAF.js";import{a as T}from"./chunk-4FTXJ6MZ.js";import{a as u}from"./chunk-5QL6W6FW.js";import{a as s,b as D,c as N}from"./chunk-4FHWXBOB.js";var j=D(l=>{"use strict";var Q=C();function V(r){var e="https://react.dev/errors/"+r;if(1<arguments.length){e+="?args[]="+encodeURIComponent(arguments[1]);for(var t=2;t<arguments.length;t++)e+="&args[]="+encodeURIComponent(arguments[t])}return"Minified React error #"+r+"; visit "+e+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}s(V,"formatProdErrorMessage");function h(){}s(h,"noop");var c={d:{f:h,r:s(function(){throw Error(V(522))},"r"),D:h,C:h,L:h,m:h,X:h,S:h,M:h},p:0,findDOMNode:null},ee=Symbol.for("react.portal");function re(r,e,t){var n=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:ee,key:n==null?null:""+n,children:r,containerInfo:e,implementation:t}}s(re,"createPortal$1");var O=Q.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function M(r,e){if(r==="font")return"";if(typeof e=="string")return e==="use-credentials"?e:""}s(M,"getCrossOriginStringAs");l.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=c;l.createPortal=function(r,e){var t=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)throw Error(V(299));return re(r,e,null,t)};l.flushSync=function(r){var e=O.T,t=c.p;try{if(O.T=null,c.p=2,r)return r()}finally{O.T=e,c.p=t,c.d.f()}};l.preconnect=function(r,e){typeof r=="string"&&(e?(e=e.crossOrigin,e=typeof e=="string"?e==="use-credentials"?e:"":void 0):e=null,c.d.C(r,e))};l.prefetchDNS=function(r){typeof r=="string"&&c.d.D(r)};l.preinit=function(r,e){if(typeof r=="string"&&e&&typeof e.as=="string"){var t=e.as,n=M(t,e.crossOrigin),o=typeof e.integrity=="string"?e.integrity:void 0,i=typeof e.fetchPriority=="string"?e.fetchPriority:void 0;t==="style"?c.d.S(r,typeof e.precedence=="string"?e.precedence:void 0,{crossOrigin:n,integrity:o,fetchPriority:i}):t==="script"&&c.d.X(r,{crossOrigin:n,integrity:o,fetchPriority:i,nonce:typeof e.nonce=="string"?e.nonce:void 0})}};l.preinitModule=function(r,e){if(typeof r=="string")if(typeof e=="object"&&e!==null){if(e.as==null||e.as==="script"){var t=M(e.as,e.crossOrigin);c.d.M(r,{crossOrigin:t,integrity:typeof e.integrity=="string"?e.integrity:void 0,nonce:typeof e.nonce=="string"?e.nonce:void 0})}}else e==null&&c.d.M(r)};l.preload=function(r,e){if(typeof r=="string"&&typeof e=="object"&&e!==null&&typeof e.as=="string"){var t=e.as,n=M(t,e.crossOrigin);c.d.L(r,t,{crossOrigin:n,integrity:typeof e.integrity=="string"?e.integrity:void 0,nonce:typeof e.nonce=="string"?e.nonce:void 0,type:typeof e.type=="string"?e.type:void 0,fetchPriority:typeof e.fetchPriority=="string"?e.fetchPriority:void 0,referrerPolicy:typeof e.referrerPolicy=="string"?e.referrerPolicy:void 0,imageSrcSet:typeof e.imageSrcSet=="string"?e.imageSrcSet:void 0,imageSizes:typeof e.imageSizes=="string"?e.imageSizes:void 0,media:typeof e.media=="string"?e.media:void 0})}};l.preloadModule=function(r,e){if(typeof r=="string")if(e){var t=M(e.as,e.crossOrigin);c.d.m(r,{as:typeof e.as=="string"&&e.as!=="script"?e.as:void 0,crossOrigin:t,integrity:typeof e.integrity=="string"?e.integrity:void 0})}else c.d.m(r)};l.requestFormReset=function(r){c.d.r(r)};l.unstable_batchedUpdates=function(r,e){return r(e)};l.useFormState=function(r,e,t){return O.H.useFormState(r,e,t)};l.useFormStatus=function(){return O.H.useHostTransitionStatus()};l.version="19.2.0"});var W=D((de,B)=>{"use strict";function U(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(U)}catch(r){console.error(r)}}s(U,"checkDCE");U(),B.exports=j()});var z=N(C(),1),f=N(P(),1),a=N(P(),1);var E=N(C(),1),Z=N(W(),1),v=N(P(),1);var te=Array.from({length:56},(r,e)=>{let t=e/56*2*Math.PI-Math.PI/2,n=Math.cos(t),o=Math.sin(t);return{id:`tick-${e}`,frac:e/55,x1:150+108*n,y1:150+108*o,x2:150+138*n,y2:150+138*o,style:{transitionDelay:`${e*6}ms`}}});function F(r,e,t,n){return t?"var(--sekyro-color-success)":r?n?"color-mix(in srgb, var(--sekyro-color-warning) 75%, transparent)":e<.33?"color-mix(in srgb, var(--sekyro-color-brand) 55%, transparent)":e<.66?"color-mix(in srgb, var(--sekyro-color-brand) 80%, transparent)":"var(--sekyro-color-brand)":"color-mix(in srgb, var(--sekyro-color-surface) 32%, transparent)"}s(F,"T");u(F,"tickColor");var ae="M0 -50 H300 V350 H0 Z M50 150 a100,100 0 1 0 200,0 a100,100 0 1 0 -200,0 Z";function G({progress:r,phase:e,draining:t=!1}){let n=Math.min(1,Math.max(0,r)),o=Math.round(n*56),i=e==="checking",y=e==="recording",d=e==="frozen",m=i||d,p=i||y||d,k=e==="locked"||p,S=t&&!k;return(0,f.jsxs)("svg",{"aria-hidden":"true",viewBox:"0 0 300 300",preserveAspectRatio:"xMidYMid meet",className:"sekyro-stage__arc","data-testid":"sekyro-capture-arc","data-phase":e,"data-filled":o,"data-recording":y?"":void 0,"data-draining":S?"":void 0,children:[(0,f.jsx)("path",{fillRule:"evenodd",d:ae,fill:"color-mix(in srgb, var(--sekyro-color-fg) var(--sekyro-scrim, 96%), transparent)",style:{"--sekyro-scrim":m?"100%":"96%"},className:"sekyro-arc__scrim sekyro-capture-fade-in","data-testid":"sekyro-capture-scrim"}),(0,f.jsxs)("g",{className:e==="locked"?"sekyro-capture-settle":void 0,children:[(0,f.jsx)("g",{className:m?"sekyro-arc__ring sekyro-arc__ring--dim":"sekyro-arc__ring",children:te.map((g,x)=>(0,f.jsx)("line",{x1:g.x1,y1:g.y1,x2:g.x2,y2:g.y2,stroke:F(x<o,g.frac,k,S),strokeWidth:3,strokeLinecap:"round",style:g.style,className:"sekyro-arc__tick"},g.id))}),(0,f.jsx)("g",{className:e==="seeking"?"sekyro-capture-breathe":void 0,children:(0,f.jsx)("circle",{cx:150,cy:150,r:100,fill:"none",stroke:k?"var(--sekyro-color-success)":"var(--sekyro-color-surface)",strokeWidth:k?3.5:2.5,className:p?"sekyro-arc__guide sekyro-arc__guide--spin sekyro-capture-ring-spin":"sekyro-arc__guide sekyro-capture-fade-in","data-testid":"sekyro-capture-guide"})})]})]})}s(G,"x");u(G,"CaptureArc");function ne({videoRef:r,guidanceText:e,guidanceHint:t,guidanceKey:n,progress:o,phase:i,draining:y=!1,stillUrl:d,showChecking:m,operatorText:p=null,voicePrompt:k,overlay:S,reduceMotion:g=!1,modeSwitch:x=null}){let b=I(),w=i==="checking",_=w||i==="frozen",A=_&&m?b("capture.checking"):e,L=k?.(t,A,n);return(0,a.jsxs)("div",{className:g?"sekyro-stage sekyro-capture-reduce":"sekyro-stage","data-testid":"sekyro-capture-stage",children:[(0,a.jsx)("video",{ref:r,playsInline:!0,muted:!0,className:"sekyro-stage__video","data-testid":"sekyro-capture-video"}),d!==null&&_?(0,a.jsx)("img",{src:d,alt:b("capture.previewAlt"),className:"sekyro-stage__still sekyro-capture-develop","data-testid":"sekyro-capture-still"}):null,(0,a.jsx)(G,{progress:o,phase:i,draining:y}),S?.(r),L!=null&&!_?(0,a.jsx)("div",{className:"sekyro-stage__corner-start","data-testid":"sekyro-voice-slot",children:L}):null,x!==null&&!_?(0,a.jsx)($,{view:x,className:"sekyro-stage__corner-end sekyro-stage__mode-switch",kind:"chip"}):null,w&&m?(0,a.jsxs)("span",{className:"sekyro-stage__corner-end sekyro-stage__pill sekyro-capture-pill-in","data-testid":"sekyro-camera-off-pill",children:[(0,a.jsx)(Y,{}),b("capture.cameraOff")]}):null,(0,a.jsxs)("p",{"aria-live":"polite",className:"sekyro-stage__guidance","data-testid":"sekyro-capture-guidance",children:[(0,a.jsx)("span",{className:"sekyro-stage__guidance-text sekyro-capture-text-in",children:A},A),_&&m?(0,a.jsx)("span",{className:"sekyro-stage__guidance-hint",children:b("capture.checkingHint")}):p!==null&&!_?(0,a.jsx)("span",{className:"sekyro-stage__guidance-hint","data-testid":"sekyro-operator-line",children:p}):null]})]})}s(ne,"ne");u(ne,"CaptureStage");function $({view:r,className:e,kind:t}){let n=(0,z.useId)(),o=(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(K,{}),(0,a.jsx)("span",{children:r.label})]}),i={onClick:r.onSwitch,"aria-describedby":n,"data-testid":"sekyro-capture-mode-switch","data-mode":r.to};return(0,a.jsxs)(a.Fragment,{children:[t==="chip"?(0,a.jsx)(H,{kind:"chip",className:e,...i,children:o}):(0,a.jsx)("button",{type:"button",className:e,...i,children:o}),(0,a.jsx)("span",{id:n,className:"sekyro-visually-hidden",children:r.description})]})}s($,"H");u($,"ModeSwitchChip");function K(){return(0,a.jsxs)("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",className:"sekyro-icon",children:[(0,a.jsx)("path",{d:"M4 7.5h2.2l1.4-1.9h8.8l1.4 1.9H20a1.6 1.6 0 0 1 1.6 1.6v8.3A1.6 1.6 0 0 1 20 19H4a1.6 1.6 0 0 1-1.6-1.6V9.1A1.6 1.6 0 0 1 4 7.5Z"}),(0,a.jsx)("path",{d:"M15.4 11.9a3.5 3.5 0 0 0-6.1-1.4M15.4 11.9h-2.1m2.1 0V9.8"}),(0,a.jsx)("path",{d:"M8.6 13.4a3.5 3.5 0 0 0 6.1 1.4M8.6 13.4h2.1m-2.1 0v2.1"})]})}s(K,"D");u(K,"FlipCameraIcon");function Y(){return(0,a.jsxs)("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",className:"sekyro-icon sekyro-icon--sm",children:[(0,a.jsx)("path",{d:"M4 7.5h2.2l1.4-1.9h8.8l1.4 1.9H20a1.6 1.6 0 0 1 1.6 1.6v8.3A1.6 1.6 0 0 1 20 19H4a1.6 1.6 0 0 1-1.6-1.6V9.1A1.6 1.6 0 0 1 4 7.5Z"}),(0,a.jsx)("path",{d:"M3 3l18 18"})]})}s(Y,"G");u(Y,"CameraOffIcon");var ie=typeof window>"u"?E.useEffect:E.useLayoutEffect,R="data-sekyro-ramp",se=[["background-color","transparent"],["background-image","none"]];function q(r){let e=[],t=r.ownerDocument;for(let i=r;i!==null&&i!==t.documentElement;i=i.parentElement){if(!(i instanceof HTMLElement)&&!(i instanceof SVGElement))continue;let y=i.style;for(let[d,m]of se){let p=y.getPropertyValue(d),k=y.getPropertyPriority(d);y.setProperty(d,m,"important"),e.push(()=>{p===""?y.removeProperty(d):y.setProperty(d,p,k)})}}let n=t.documentElement,o=n.hasAttribute(R);return n.setAttribute(R,""),o||e.push(()=>n.removeAttribute(R)),()=>{for(let i of e.reverse())i()}}s(q,"z");u(q,"clearAncestorBackdrops");function X(r){return{position:"fixed",inset:0,minWidth:"100vw",minHeight:"100lvh",margin:0,padding:0,border:0,zIndex:-1,pointerEvents:"none",backgroundColor:T(r)}}s(X,"B");u(X,"washStyle");function J(r){return{position:"absolute",inset:0,pointerEvents:"none",backgroundColor:T(r)}}s(J,"Y");u(J,"coverStyle");function oe({colour:r}){let e=(0,E.useRef)(null),t=r!==null;return ie(()=>{let n=e.current?.parentElement;if(!(!t||n===null||n===void 0))return q(n)},[t]),r===null||typeof document>"u"?null:(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)("div",{ref:e,"aria-hidden":"true","data-testid":"sekyro-screen-ramp-cover","data-colour":r,style:J(r)}),(0,Z.createPortal)((0,v.jsx)("div",{"aria-hidden":"true","data-testid":"sekyro-screen-ramp","data-colour":r,style:X(r)}),document.body)]})}s(oe,"de");u(oe,"ScreenRampLayer");export{W as a,ne as b,$ as c,oe as d};
|
|
2
2
|
/*! Bundled license information:
|
|
3
3
|
|
|
4
4
|
react-dom/cjs/react-dom.production.js:
|